diff -Nru erlang-18.2-dfsg/aclocal.m4 erlang-17.3-dfsg/aclocal.m4 --- erlang-18.2-dfsg/aclocal.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/aclocal.m4 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ dnl dnl %CopyrightBegin% dnl -dnl Copyright Ericsson AB 1998-2015. All Rights Reserved. +dnl Copyright Ericsson AB 1998-2013. All Rights Reserved. dnl -dnl Licensed under the Apache License, Version 2.0 (the "License"); -dnl you may not use this file except in compliance with the License. -dnl You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. +dnl +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. dnl dnl %CopyrightEnd% dnl @@ -61,6 +60,7 @@ dnl Cross compilation variables AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigaltstack, [have working sigaltstack(): yes|no (only used when cross compiling)]) @@ -142,18 +142,18 @@ AC_MSG_CHECKING(for mixed cygwin or msys and native VC++ environment) if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then - if test -x /usr/bin/msys-?.0.dll; then - CFLAGS="-O2" - MIXED_MSYS=yes - AC_MSG_RESULT([MSYS and VC]) - MIXED_MSYS_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" - elif test -x /usr/bin/cygpath; then + if test -x /usr/bin/cygpath; then CFLAGS="-O2" MIXED_CYGWIN=yes AC_MSG_RESULT([Cygwin and VC]) MIXED_CYGWIN_VC=yes CPPFLAGS="$CPPFLAGS -DERTS_MIXED_CYGWIN_VC" + elif test -x /usr/bin/msysinfo; then + CFLAGS="-O2" + MIXED_MSYS=yes + AC_MSG_RESULT([MSYS and VC]) + MIXED_MSYS_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" else AC_MSG_RESULT([undeterminable]) AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!) @@ -246,31 +246,31 @@ return 1; lbl2: return 2; -],ac_cv_prog_emu_cc="$CC",ac_cv_prog_emu_cc=no) +],ac_cv_prog_emu_cc=$CC,ac_cv_prog_emu_cc=no) -if test "$ac_cv_prog_emu_cc" = no; then +if test $ac_cv_prog_emu_cc = no; then for ac_progname in emu_cc.sh gcc-4.2 gcc; do IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_progname"; then - ac_cv_prog_emu_cc="$ac_dir/$ac_progname" + if test -f $ac_dir/$ac_progname; then + ac_cv_prog_emu_cc=$ac_dir/$ac_progname break fi done IFS="$ac_save_ifs" - if test "$ac_cv_prog_emu_cc" != no; then + if test $ac_cv_prog_emu_cc != no; then break fi done fi -if test "$ac_cv_prog_emu_cc" != no; then - save_CC="$CC" +if test $ac_cv_prog_emu_cc != no; then + save_CC=$CC save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS - CC="$ac_cv_prog_emu_cc" + CC=$ac_cv_prog_emu_cc CFLAGS="" CPPFLAGS="" AC_TRY_COMPILE([],[ @@ -291,17 +291,17 @@ return 1; lbl2: return 2; - ],ac_cv_prog_emu_cc="$CC",ac_cv_prog_emu_cc=no) + ],ac_cv_prog_emu_cc=$CC,ac_cv_prog_emu_cc=no) CC=$save_CC CFLAGS=$save_CFLAGS CPPFLAGS=$save_CPPFLAGS fi ]) -if test "$ac_cv_prog_emu_cc" = no; then +if test $ac_cv_prog_emu_cc = no; then AC_DEFINE(NO_JUMP_TABLE,[],[Defined if no found C compiler can handle jump tables]) - EMU_CC="$CC" + EMU_CC=$CC else - EMU_CC="$ac_cv_prog_emu_cc" + EMU_CC=$ac_cv_prog_emu_cc fi AC_SUBST(EMU_CC) ]) @@ -559,7 +559,7 @@ AC_DEFUN(LM_SYS_MULTICAST, [AC_CACHE_CHECK([for multicast support], ac_cv_sys_multicast_support, -[AC_EGREP_CPP(^yes$, +[AC_EGREP_CPP(yes, [#include #include #include @@ -724,250 +724,6 @@ ])# AC_C_DOUBLE_MIDDLE_ENDIAN -AC_DEFUN(ERL_MONOTONIC_CLOCK, -[ - if test "$3" = "yes"; then - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_BOOTTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_PRECISE" - else - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_UPTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_UPTIME_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_UPTIME_PRECISE" - fi - - case "$1" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_monotonic="$high_resolution_clock_gettime_monotonic" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_monotonic="$low_resolution_clock_gettime_monotonic" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_monotonic="$2" - ;; - *) - check_msg="custom " - prefer_resolution_clock_gettime_monotonic="$2" - ;; - esac - - AC_CACHE_CHECK([for clock_gettime(CLOCK_MONOTONIC_RAW, _)], erl_cv_clock_gettime_monotonic_raw, - [ - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_monotonic_raw=yes, - erl_cv_clock_gettime_monotonic_raw=no) - ]) - - AC_CACHE_CHECK([for clock_gettime() with ${check_msg}monotonic clock type], erl_cv_clock_gettime_monotonic_$1, - [ - for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_monotonic_$1=$clock_type, - erl_cv_clock_gettime_monotonic_$1=no) - test $erl_cv_clock_gettime_monotonic_$1 = no || break - done - ]) - - AC_CHECK_FUNCS([clock_getres clock_get_attributes gethrtime]) - - AC_CACHE_CHECK([for mach clock_get_time() with monotonic clock type], erl_cv_mach_clock_get_time_monotonic, - [ - AC_TRY_COMPILE([ -#include -#include - ], - [ - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - ], - erl_cv_mach_clock_get_time_monotonic=yes, - erl_cv_mach_clock_get_time_monotonic=no) - ]) - - erl_corrected_monotonic_clock=no - case $erl_cv_clock_gettime_monotonic_$1-$ac_cv_func_gethrtime-$erl_cv_mach_clock_get_time_monotonic-$host_os in - *-*-*-win32) - erl_monotonic_clock_func=WindowsAPI - ;; - CLOCK_*-*-*-linux*) - case $erl_cv_clock_gettime_monotonic_$1-$erl_cv_clock_gettime_monotonic_raw in - CLOCK_BOOTTIME-yes|CLOCK_MONOTONIC-yes) - erl_corrected_monotonic_clock=yes - ;; - *) - # We don't trust CLOCK_MONOTONIC to be NTP - # adjusted on linux systems that do not have - # CLOCK_MONOTONIC_RAW (although it seems to - # be...) - ;; - esac - erl_monotonic_clock_func=clock_gettime - ;; - no-no-no-linux*) - erl_monotonic_clock_func=times - ;; - CLOCK_*-*-*-*) - erl_monotonic_clock_func=clock_gettime - ;; - no-yes-*-*) - erl_monotonic_clock_func=gethrtime - ;; - no-no-yes-*) - erl_monotonic_clock_func=mach_clock_get_time - ;; - no-no-no-*) - erl_monotonic_clock_func=none - ;; - esac - - erl_monotonic_clock_low_resolution=no - erl_monotonic_clock_lib= - erl_monotonic_clock_id= - case $erl_monotonic_clock_func in - clock_gettime) - erl_monotonic_clock_id=$erl_cv_clock_gettime_monotonic_$1 - for low_res_id in $low_resolution_clock_gettime_monotonic; do - if test $erl_monotonic_clock_id = $low_res_id; then - erl_monotonic_clock_low_resolution=yes - break - fi - done - AC_CHECK_LIB(rt, clock_gettime, [erl_monotonic_clock_lib="-lrt"]) - ;; - mach_clock_get_time) - erl_monotonic_clock_id=SYSTEM_CLOCK - ;; - times) - erl_monotonic_clock_low_resolution=yes - ;; - *) - ;; - esac - -]) - -AC_DEFUN(ERL_WALL_CLOCK, -[ - default_resolution_clock_gettime_wall="CLOCK_REALTIME" - low_resolution_clock_gettime_wall="CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST" - high_resolution_clock_gettime_wall="CLOCK_REALTIME_PRECISE" - - case "$1" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_wall="$high_resolution_clock_gettime_wall" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_wall="$low_resolution_clock_gettime_wall" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_wall="$2" - ;; - *) - check_msg="" - prefer_resolution_clock_gettime_wall= - ;; - esac - - AC_CACHE_CHECK([for clock_gettime() with ${check_msg}wall clock type], erl_cv_clock_gettime_wall_$1, - [ - for clock_type in $prefer_resolution_clock_gettime_wall $default_resolution_clock_gettime_wall $high_resolution_clock_gettime_wall $low_resolution_clock_gettime_wall; do - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_wall_$1=$clock_type, - erl_cv_clock_gettime_wall_$1=no) - test $erl_cv_clock_gettime_wall_$1 = no || break - done - ]) - - AC_CHECK_FUNCS([clock_getres clock_get_attributes gettimeofday]) - - AC_CACHE_CHECK([for mach clock_get_time() with wall clock type], erl_cv_mach_clock_get_time_wall, - [ - AC_TRY_COMPILE([ -#include -#include - ], - [ - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - ], - erl_cv_mach_clock_get_time_wall=yes, - erl_cv_mach_clock_get_time_wall=no) - ]) - - erl_wall_clock_low_resolution=no - erl_wall_clock_id= - case $1-$erl_cv_clock_gettime_wall_$1-$erl_cv_mach_clock_get_time_wall-$ac_cv_func_gettimeofday-$host_os in - *-*-*-*-win32) - erl_wall_clock_func=WindowsAPI - erl_wall_clock_low_resolution=yes - ;; - high_resolution-no-yes-*-*) - erl_wall_clock_func=mach_clock_get_time - erl_wall_clock_id=CALENDAR_CLOCK - ;; - *-CLOCK_*-*-*-*) - erl_wall_clock_func=clock_gettime - erl_wall_clock_id=$erl_cv_clock_gettime_wall_$1 - for low_res_id in $low_resolution_clock_gettime_wall; do - if test $erl_wall_clock_id = $low_res_id; then - erl_wall_clock_low_resolution=yes - break - fi - done - ;; - *-no-*-yes-*) - erl_wall_clock_func=gettimeofday - ;; - *) - erl_wall_clock_func=none - ;; - esac -]) - dnl ---------------------------------------------------------------------- dnl dnl LM_CHECK_THR_LIB @@ -1152,226 +908,24 @@ ]) -AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OP__, -[ - # $1 - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]]" - case $1 in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, __ATOMIC_RELAXED); res = $1(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = $1(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = $1(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - AC_MSG_ERROR([Internal error: missing implementation for $1]) - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - AC_CACHE_CHECK([for 32-bit $1()], ethr_cv_32bit_$1, - [ - ethr_cv_32bit_$1=no - AC_TRY_LINK([], [$atomic32_call], [ethr_cv_32bit_$1=yes]) - ]) - AC_CACHE_CHECK([for 64-bit $1()], ethr_cv_64bit_$1, - [ - ethr_cv_64bit_$1=no - AC_TRY_LINK([], [$atomic64_call], [ethr_cv_64bit_$1=yes]) - ]) - AC_CACHE_CHECK([for 128-bit $1()], ethr_cv_128bit_$1, - [ - ethr_cv_128bit_$1=no - AC_TRY_LINK([], [$atomic128_call], [ethr_cv_128bit_$1=yes]) - ]) - - case $ethr_cv_128bit_$1-$ethr_cv_64bit_$1-$ethr_cv_32bit_$1 in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - AC_DEFINE_UNQUOTED([ETHR_HAVE_$1], [$have_atomic_ops], [Define as a bitmask corresponding to the word sizes that $1() can handle on your system]) -]) - -AC_DEFUN(ETHR_CHK_IF_NOOP, +AC_DEFUN(ETHR_CHK_SYNC_OP, [ - ethr_test_filename="chk_if_$1$3_noop_config1test.$$" - cat > "${ethr_test_filename}.c" < "${ethr_test_filename}.c" </dev/null 2>&1; then - ethr_$1$3_noop=yes - else - ethr_$1$3_noop=no - fi - rm -f "${ethr_test_filename}.c" "${ethr_test_filename}1.o" "${ethr_test_filename}2.o" -]) - -AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OPS, -[ - AC_CHECK_SIZEOF(short) - AC_CHECK_SIZEOF(int) - AC_CHECK_SIZEOF(long) - AC_CHECK_SIZEOF(long long) - AC_CHECK_SIZEOF(__int128_t) - - if test "$ac_cv_sizeof_short" = "4"; then - gcc_atomic_type32="short" - elif test "$ac_cv_sizeof_int" = "4"; then - gcc_atomic_type32="int" - elif test "$ac_cv_sizeof_long" = "4"; then - gcc_atomic_type32="long" - else - AC_MSG_ERROR([No 32-bit type found]) - fi - - if test "$ac_cv_sizeof_int" = "8"; then - gcc_atomic_type64="int" - elif test "$ac_cv_sizeof_long" = "8"; then - gcc_atomic_type64="long" - elif test "$ac_cv_sizeof_long_long" = "8"; then - gcc_atomic_type64="long long" - else - AC_MSG_ERROR([No 64-bit type found]) - fi - - if test "$ac_cv_sizeof___int128_t" = "16"; then - gcc_atomic_type128="__int128_t" - else - gcc_atomic_type128="#error " - fi - AC_CACHE_CHECK([for a working __sync_synchronize()], ethr_cv___sync_synchronize, - [ - ethr_cv___sync_synchronize=no - AC_TRY_LINK([], - [ __sync_synchronize(); ], - [ethr_cv___sync_synchronize=yes]) - if test $ethr_cv___sync_synchronize = yes; then - # - # Old gcc versions on at least x86 have a buggy - # __sync_synchronize() which does not emit a - # memory barrier. We try to detect this by - # compiling to assembly with and without - # __sync_synchronize() and compare the results. - # - ETHR_CHK_IF_NOOP(__sync_synchronize, [()], []) - if test $ethr___sync_synchronize_noop = yes; then - # Got a buggy implementation of - # __sync_synchronize... - ethr_cv___sync_synchronize="no; buggy implementation" - fi - fi - ]) - - if test "$ethr_cv___sync_synchronize" = "yes"; then - have_sync_synchronize_value="~0" - else - have_sync_synchronize_value="0" - fi - AC_DEFINE_UNQUOTED([ETHR_HAVE___sync_synchronize], [$have_sync_synchronize_value], [Define as a bitmask corresponding to the word sizes that __sync_synchronize() can handle on your system]) - - ETHR_CHK_GCC_ATOMIC_OP__(__sync_add_and_fetch) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_fetch_and_and) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_fetch_and_or) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_val_compare_and_swap) - - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_store_n) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_load_n) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_add_fetch) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_fetch_and) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_fetch_or) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_compare_exchange_n) - - ethr_have_gcc_native_atomics=no - ethr_arm_dbm_instr_val=0 - case "$GCC-$host_cpu" in - yes-arm*) - AC_CACHE_CHECK([for ARM DMB instruction], ethr_cv_arm_dbm_instr, - [ - ethr_cv_arm_dbm_instr=no - AC_TRY_LINK([], - [ - __asm__ __volatile__("dmb sy" : : : "memory"); - __asm__ __volatile__("dmb st" : : : "memory"); - ], - [ethr_cv_arm_dbm_instr=yes]) - ]) - if test $ethr_cv_arm_dbm_instr = yes; then - ethr_arm_dbm_instr_val=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi;; - *) - ;; + AC_MSG_CHECKING([for $3-bit $1()]) + case "$2" in + "1") sync_call="$1(&var);";; + "2") sync_call="$1(&var, ($4) 0);";; + "3") sync_call="$1(&var, ($4) 0, ($4) 0);";; esac - AC_DEFINE_UNQUOTED([ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION], [$ethr_arm_dbm_instr_val], [Define as a boolean indicating whether you have a gcc compatible compiler capable of generating the ARM DMB instruction, and are compiling for an ARM processor with ARM DMB instruction support, or not]) - test $ethr_cv_32bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_64bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - if test "$ethr_cv___sync_synchronize" = "yes"; then - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi - ethr_have_gcc_atomic_builtins=0 - if test $ethr_have_gcc_native_atomics = yes; then - ethr_native_atomic_implementation=gcc_sync - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_have_gcc_atomic_builtins = 1 && ethr_native_atomic_implementation=gcc_atomic_sync - fi - AC_DEFINE_UNQUOTED([ETHR_HAVE_GCC___ATOMIC_BUILTINS], [$ethr_have_gcc_atomic_builtins], [Define as a boolean indicating whether you have a gcc __atomic builtins or not]) - test $ethr_have_gcc_native_atomics = yes && ethr_have_native_atomics=yes + have_sync_op=no + AC_TRY_LINK([], + [ + $4 res; + volatile $4 var; + res = $sync_call + ], + [have_sync_op=yes]) + test $have_sync_op = yes && $5 + AC_MSG_RESULT([$have_sync_op]) ]) AC_DEFUN(ETHR_CHK_INTERLOCKED, @@ -1451,16 +1005,6 @@ test $enable_prefer_gcc_native_ethr_impls = yes && AC_DEFINE(ETHR_PREFER_GCC_NATIVE_IMPLS, 1, [Define if you prefer gcc native ethread implementations]) -AC_ARG_ENABLE(trust-gcc-atomic-builtins-memory-barriers, - AS_HELP_STRING([--enable-trust-gcc-atomic-builtins-memory-barriers], - [trust gcc atomic builtins memory barriers]), -[ case "$enableval" in - yes) trust_gcc_atomic_builtins_mbs=1 ;; - *) trust_gcc_atomic_builtins_mbs=0 ;; - esac ], trust_gcc_atomic_builtins_mbs=0) - -AC_DEFINE_UNQUOTED(ETHR_TRUST_GCC_ATOMIC_BUILTINS_MEMORY_BARRIERS, [$trust_gcc_atomic_builtins_mbs], [Define as a boolean indicating whether you trust gcc's __atomic_* builtins memory barrier implementations, or not]) - AC_ARG_WITH(libatomic_ops, AS_HELP_STRING([--with-libatomic_ops=PATH], [specify and prefer usage of libatomic_ops in the ethread library])) @@ -1472,33 +1016,12 @@ LM_CHECK_THR_LIB ERL_INTERNAL_LIBS -ERL_MONOTONIC_CLOCK(try_find_pthread_compatible, CLOCK_HIGHRES CLOCK_MONOTONIC, no) - -case $erl_monotonic_clock_func in - clock_gettime) - AC_DEFINE(ETHR_HAVE_CLOCK_GETTIME_MONOTONIC, [1], [Define if you have a clock_gettime() with a monotonic clock]) - ;; - mach_clock_get_time) - AC_DEFINE(ETHR_HAVE_MACH_CLOCK_GET_TIME, [1], [Define if you have a mach clock_get_time() with a monotonic clock]) - ;; - gethrtime) - AC_DEFINE(ETHR_HAVE_GETHRTIME, [1], [Define if you have a monotonic gethrtime()]) - ;; - *) - ;; -esac - -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(ETHR_MONOTONIC_CLOCK_ID, [$erl_monotonic_clock_id], [Define to the monotonic clock id to use]) -fi - -ethr_native_atomic_implementation=none ethr_have_native_atomics=no ethr_have_native_spinlock=no ETHR_THR_LIB_BASE="$THR_LIB_NAME" ETHR_THR_LIB_BASE_TYPE="$THR_LIB_TYPE" ETHR_DEFS="$THR_DEFS" -ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS $erl_monotonic_clock_lib" +ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS" ETHR_LIBS= ETHR_LIB_NAME= @@ -1577,10 +1100,7 @@ ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange128], [4], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE128, 1, [Define if you have _InterlockedCompareExchange128()])) fi - if test "$ethr_have_native_atomics" = "yes"; then - ethr_native_atomic_implementation=windows - ethr_have_native_spinlock=yes - fi + test "$ethr_have_native_atomics" = "yes" && ethr_have_native_spinlock=yes ;; pthread|ose_threads) @@ -1809,50 +1329,6 @@ AC_DEFINE(ETHR_HAVE_PTHREAD_ATTR_SETGUARDSIZE, 1, \ [Define if you have the pthread_attr_setguardsize function.])) - if test "x$erl_monotonic_clock_id" != "x"; then - AC_MSG_CHECKING(whether pthread_cond_timedwait() can use the monotonic clock $erl_monotonic_clock_id for timeout) - pthread_cond_timedwait_monotonic=no - AC_TRY_LINK([ - #if defined(ETHR_NEED_NPTL_PTHREAD_H) - # include - #elif defined(ETHR_HAVE_MIT_PTHREAD_H) - # include - #elif defined(ETHR_HAVE_PTHREAD_H) - # include - #endif - #ifdef ETHR_TIME_WITH_SYS_TIME - # include - # include - #else - # ifdef ETHR_HAVE_SYS_TIME_H - # include - # else - # include - # endif - #endif - #if defined(ETHR_HAVE_MACH_CLOCK_GET_TIME) - # include - # include - #endif - ], - [ - int res; - pthread_condattr_t attr; - pthread_cond_t cond; - struct timespec cond_timeout; - pthread_mutex_t mutex; - res = pthread_condattr_init(&attr); - res = pthread_condattr_setclock(&attr, ETHR_MONOTONIC_CLOCK_ID); - res = pthread_cond_init(&cond, &attr); - res = pthread_cond_timedwait(&cond, &mutex, &cond_timeout); - ], - [pthread_cond_timedwait_monotonic=yes]) - AC_MSG_RESULT([$pthread_cond_timedwait_monotonic]) - if test $pthread_cond_timedwait_monotonic = yes; then - AC_DEFINE(ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC, [1], [Define if pthread_cond_timedwait() can be used with a monotonic clock]) - fi - fi - linux_futex=no AC_MSG_CHECKING([for Linux futexes]) AC_TRY_LINK([ @@ -1873,62 +1349,56 @@ AC_MSG_RESULT([$linux_futex]) test $linux_futex = yes && AC_DEFINE(ETHR_HAVE_LINUX_FUTEX, 1, [Define if you have a linux futex implementation.]) - pthread_setname=no - AC_MSG_CHECKING([for pthread_setname_np]) - old_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Werror" - AC_TRY_LINK([#define __USE_GNU - #include ], - [pthread_setname_np(pthread_self(), "name");], - pthread_setname=linux) - AC_TRY_LINK([#define __USE_GNU - #include ], - [pthread_set_name_np(pthread_self(), "name");], - pthread_setname=bsd) - AC_TRY_LINK([#define _DARWIN_C_SOURCE - #include ], - [pthread_setname_np("name");], - pthread_setname=darwin) - AC_MSG_RESULT([$pthread_setname]) - case $pthread_setname in - linux) AC_DEFINE(ETHR_HAVE_PTHREAD_SETNAME_NP_2, 1, - [Define if you have linux style pthread_setname_np]);; - bsd) AC_DEFINE(ETHR_HAVE_PTHREAD_SET_NAME_NP_2, 1, - [Define if you have bsd style pthread_set_name_np]);; - darwin) AC_DEFINE(ETHR_HAVE_PTHREAD_SETNAME_NP_1, 1, - [Define if you have darwin style pthread_setname_np]);; - *) ;; - esac + fi - pthread_getname=no - AC_MSG_CHECKING([for pthread_getname_np]) - AC_TRY_LINK([#define __USE_GNU - #define _DARWIN_C_SOURCE - #include ], - [char buff[256]; pthread_getname_np(pthread_self(), buff, 256);], - pthread_getname=linux) - AC_TRY_LINK([#define __USE_GNU - #define _DARWIN_C_SOURCE - #include ], - [char buff[256]; pthread_getname_np(pthread_self(), buff);], - pthread_getname=ibm) - AC_MSG_RESULT([$pthread_getname]) - case $pthread_getname in - linux) AC_DEFINE(ETHR_HAVE_PTHREAD_GETNAME_NP_3, 1, - [Define if you have linux style pthread_getname_np]);; - ibm) AC_DEFINE(ETHR_HAVE_PTHREAD_GETNAME_NP_2, 1, - [Define if you have ibm style pthread_getname_np]);; - *) ;; - esac - CFLAGS=$old_CFLAGS + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(long) + AC_CHECK_SIZEOF(long long) + AC_CHECK_SIZEOF(__int128_t) + + if test "$ac_cv_sizeof_int" = "4"; then + int32="int" + elif test "$ac_cv_sizeof_long" = "4"; then + int32="long" + elif test "$ac_cv_sizeof_long_long" = "4"; then + int32="long long" + else + AC_MSG_ERROR([No 32-bit type found]) + fi - fi ## test "x$THR_LIB_NAME" = "xpthread" + if test "$ac_cv_sizeof_int" = "8"; then + int64="int" + elif test "$ac_cv_sizeof_long" = "8"; then + int64="long" + elif test "$ac_cv_sizeof_long_long" = "8"; then + int64="long long" + else + AC_MSG_ERROR([No 64-bit type found]) + fi + + int128=no + if test "$ac_cv_sizeof___int128_t" = "16"; then + int128="__int128_t" + fi if test "X$disable_native_ethr_impls" = "Xyes"; then ethr_have_native_atomics=no else + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32, 1, [Define if you have __sync_val_compare_and_swap() for 32-bit integers])) + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_SYNC_OP([__sync_add_and_fetch], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_ADD_AND_FETCH32, 1, [Define if you have __sync_add_and_fetch() for 32-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_and], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_AND32, 1, [Define if you have __sync_fetch_and_and() for 32-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_or], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_OR32, 1, [Define if you have __sync_fetch_and_or() for 32-bit integers])) + + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64, 1, [Define if you have __sync_val_compare_and_swap() for 64-bit integers])) + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_SYNC_OP([__sync_add_and_fetch], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_ADD_AND_FETCH64, 1, [Define if you have __sync_add_and_fetch() for 64-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_and], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_AND64, 1, [Define if you have __sync_fetch_and_and() for 64-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_or], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_OR64, 1, [Define if you have __sync_fetch_and_or() for 64-bit integers])) - ETHR_CHK_GCC_ATOMIC_OPS([]) + if test $int128 != no; then + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [128], [$int128], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP128, 1, [Define if you have __sync_val_compare_and_swap() for 128-bit integers])) + fi AC_MSG_CHECKING([for a usable libatomic_ops implementation]) case "x$with_libatomic_ops" in @@ -1951,34 +1421,11 @@ int z; AO_nop_full(); -#if defined(AO_HAVE_store) AO_store(&x, (AO_t) 0); -#elif defined(AO_HAVE_store_release) - AO_store_release(&x, (AO_t) 0); -#else -#error No store -#endif -#if defined(AO_HAVE_load) z = AO_load(&x); -#elif defined(AO_HAVE_load_acquire) - z = AO_load_acquire(&x); -#else -#error No load -#endif -#if defined(AO_HAVE_compare_and_swap_full) z = AO_compare_and_swap_full(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap_release) - z = AO_compare_and_swap_release(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap_acquire) - z = AO_compare_and_swap_acquire(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap) - z = AO_compare_and_swap(&x, (AO_t) 0, (AO_t) 1); -#else -#error No compare_and_swap -#endif ], [ethr_have_native_atomics=yes - ethr_native_atomic_implementation=libatomic_ops ethr_have_libatomic_ops=yes]) AC_MSG_RESULT([$ethr_have_libatomic_ops]) if test $ethr_have_libatomic_ops = yes; then @@ -2010,19 +1457,15 @@ *) AC_MSG_ERROR([Unsupported Sparc memory order: $with_sparc_memory_order]);; esac - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; i86pc | i*86 | x86_64 | amd64) if test "$enable_x86_out_of_order" = "yes"; then AC_DEFINE(ETHR_X86_OUT_OF_ORDER, 1, [Define if x86/x86_64 out of order instructions should be synchronized]) fi - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; macppc | ppc | powerpc | "Power Macintosh") - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; tile) - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; *) ;; @@ -2195,233 +1638,109 @@ ]) + dnl ---------------------------------------------------------------------- dnl dnl ERL_TIME_CORRECTION dnl -dnl Check for primitives that can be used for implementing -dnl erts_os_monotonic_time() and erts_os_system_time() +dnl In the presence of a high resolution realtime timer Erlang can adapt +dnl its view of time relative to this timer. On solaris such a timer is +dnl available with the syscall gethrtime(). On other OS's a fallback +dnl solution using times() is implemented. (However on e.g. FreeBSD times() +dnl is implemented using gettimeofday so it doesn't make much sense to +dnl use it there...) On second thought, it seems to be safer to do it the +dnl other way around. I.e. only use times() on OS's where we know it will +dnl work... dnl AC_DEFUN(ERL_TIME_CORRECTION, -[ - -AC_ARG_WITH(clock-resolution, -AS_HELP_STRING([--with-clock-resolution=high|low|default], - [specify wanted clock resolution])) - -AC_ARG_WITH(clock-gettime-realtime-id, -AS_HELP_STRING([--with-clock-gettime-realtime-id=CLOCKID], - [specify clock id to use with clock_gettime() for realtime time)])) - -AC_ARG_WITH(clock-gettime-monotonic-id, -AS_HELP_STRING([--with-clock-gettime-monotonic-id=CLOCKID], - [specify clock id to use with clock_gettime() for monotonic time)])) - -AC_ARG_ENABLE(prefer-elapsed-monotonic-time-during-suspend, -AS_HELP_STRING([--enable-prefer-elapsed-monotonic-time-during-suspend], - [Prefer an OS monotonic time source with elapsed time during suspend]) -AS_HELP_STRING([--disable-prefer-elapsed-monotonic-time-during-suspend], - [Do not prefer an OS monotonic time source with elapsed time during suspend]), -[ case "$enableval" in - yes) prefer_elapsed_monotonic_time_during_suspend=yes ;; - *) prefer_elapsed_monotonic_time_during_suspend=no ;; - esac ], prefer_elapsed_monotonic_time_during_suspend=no) - -AC_ARG_ENABLE(gettimeofday-as-os-system-time, - AS_HELP_STRING([--enable-gettimeofday-as-os-system-time], - [Force usage of gettimeofday() for OS system time]), -[ case "$enableval" in - yes) force_gettimeofday_os_system_time=yes ;; - *) force_gettimeofday_os_system_time=no ;; - esac ], force_gettimeofday_os_system_time=no) - -case "$with_clock_resolution" in - ""|no|yes) - with_clock_resolution=default;; - high|low|default) - ;; - *) - AC_MSG_ERROR([Invalid wanted clock resolution: $with_clock_resolution]) - ;; -esac - -if test "$force_gettimeofday_os_system_time" = "yes"; then - - AC_CHECK_FUNCS([gettimeofday]) - if test "$ac_cv_func_gettimeofday" = "yes"; then - AC_DEFINE(OS_SYSTEM_TIME_GETTIMEOFDAY, [1], [Define if you want to implement erts_os_system_time() using gettimeofday()]) - else - AC_MSG_ERROR([No gettimeofday() available]) - fi - -else # $force_gettimeofday_os_system_time != yes - -case "$with_clock_gettime_realtime_id" in - ""|no) - with_clock_gettime_realtime_id=no - ;; - CLOCK_*CPUTIME*) - AC_MSG_ERROR([Invalid clock_gettime() realtime clock id: Refusing to use the cputime clock id $with_clock_gettime_realtime_id as realtime clock id]) - ;; - CLOCK_MONOTONIC*|CLOCK_BOOTTIME*|CLOCK_UPTIME*|CLOCK_HIGHRES*) - AC_MSG_ERROR([Invalid clock_gettime() realtime clock id: Refusing to use the monotonic clock id $with_clock_gettime_realtime_id as realtime clock id]) - ;; - CLOCK_*) - ;; - *) - AC_MSG_ERROR([Invalid clock_gettime() clock id: $with_clock_gettime_realtime_id]) - ;; -esac - -case "$with_clock_resolution-$with_clock_gettime_realtime_id" in - high-no) - ERL_WALL_CLOCK(high_resolution);; - low-no) - ERL_WALL_CLOCK(low_resolution);; - default-no) - ERL_WALL_CLOCK(default_resolution);; - *) - ERL_WALL_CLOCK(custom_resolution, $with_clock_gettime_realtime_id);; -esac - -case "$erl_wall_clock_func-$erl_wall_clock_id-$with_clock_gettime_realtime_id" in - *-*-no) - ;; - clock_gettime-$with_clock_gettime_realtime_id-$with_clock_gettime_realtime_id) - ;; - *) - AC_MSG_ERROR([$with_clock_gettime_realtime_id as clock id to clock_gettime() doesn't compile]) - ;; -esac - -case $erl_wall_clock_func in - none) - AC_MSG_ERROR([No wall clock source found]) - ;; - mach_clock_get_time) - AC_DEFINE(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_system_time() using mach clock_get_time()]) - ;; - clock_gettime) - AC_DEFINE(OS_SYSTEM_TIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_system_time() using clock_gettime()]) - ;; - gettimeofday) - AC_DEFINE(OS_SYSTEM_TIME_GETTIMEOFDAY, [1], [Define if you want to implement erts_os_system_time() using gettimeofday()]) - ;; - *) - ;; -esac - -if test "x$erl_wall_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(WALL_CLOCK_ID_STR, ["$erl_wall_clock_id"], [Define as a string of wall clock id to use]) - AC_DEFINE_UNQUOTED(WALL_CLOCK_ID, [$erl_wall_clock_id], [Define to wall clock id to use]) -fi - -fi # $force_gettimeofday_os_system_time != yes - -case "$with_clock_gettime_monotonic_id" in - ""|no) - with_clock_gettime_monotonic_id=no - ;; - CLOCK_*CPUTIME*) - AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the cputime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) - ;; - CLOCK_REALTIME*|CLOCK_TAI*) - AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the realtime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) - ;; - CLOCK_*) - ;; - *) - AC_MSG_ERROR([Invalid clock_gettime() clock id: $with_clock_gettime_monotonic_id]) - ;; -esac - -case "$with_clock_resolution-$with_clock_gettime_monotonic_id" in - high-no) - ERL_MONOTONIC_CLOCK(high_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - low-no) - ERL_MONOTONIC_CLOCK(low_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - default-no) - ERL_MONOTONIC_CLOCK(default_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - *) - ERL_MONOTONIC_CLOCK(custom_resolution, $with_clock_gettime_monotonic_id, $prefer_elapsed_monotonic_time_during_suspend);; -esac - -case "$erl_monotonic_clock_func-$erl_monotonic_clock_id-$with_clock_gettime_monotonic_id" in - *-*-no) - ;; - clock_gettime-$with_clock_gettime_monotonic_id-$with_clock_gettime_monotonic_id) - ;; - *) - AC_MSG_ERROR([$with_clock_gettime_monotonic_id as clock id to clock_gettime() doesn't compile]) - ;; -esac - -case $erl_monotonic_clock_func in - times) - AC_DEFINE(OS_MONOTONIC_TIME_USING_TIMES, [1], [Define if you want to implement erts_os_monotonic_time() using times()]) - ;; - mach_clock_get_time) - AC_DEFINE(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_monotonic_time() using mach clock_get_time()]) - ;; - clock_gettime) - AC_DEFINE(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_monotonic_time() using clock_gettime()]) - ;; - gethrtime) - AC_DEFINE(OS_MONOTONIC_TIME_USING_GETHRTIME, [1], [Define if you want to implement erts_os_monotonic_time() using gethrtime()]) - ;; - *) - ;; -esac - -if test $erl_corrected_monotonic_clock = yes; then - AC_DEFINE(ERTS_HAVE_CORRECTED_OS_MONOTONIC_TIME, [1], [Define if OS monotonic clock is corrected]) -fi - -if test $erl_monotonic_clock_low_resolution = yes; then - AC_DEFINE(ERTS_HAVE_LOW_RESOLUTION_OS_MONOTONIC_LOW, [1], [Define if you have a low resolution OS monotonic clock]) -fi - -xrtlib="$erl_monotonic_clock_lib" -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(MONOTONIC_CLOCK_ID_STR, ["$erl_monotonic_clock_id"], [Define as a string of monotonic clock id to use]) - AC_DEFINE_UNQUOTED(MONOTONIC_CLOCK_ID, [$erl_monotonic_clock_id], [Define to monotonic clock id to use]) +[if test x$ac_cv_func_gethrtime = x; then + AC_CHECK_FUNC(gethrtime) fi - -if test $erl_cv_clock_gettime_monotonic_raw = yes; then - AC_DEFINE(HAVE_CLOCK_GETTIME_MONOTONIC_RAW, [1], [Define if you have clock_gettime(CLOCK_MONOTONIC_RAW, _)]) +if test x$clock_gettime_correction = xunknown; then + AC_TRY_COMPILE([#include ], + [struct timespec ts; + long long result; + clock_gettime(CLOCK_MONOTONIC,&ts); + result = ((long long) ts.tv_sec) * 1000000000LL + + ((long long) ts.tv_nsec);], + clock_gettime_compiles=yes, + clock_gettime_compiles=no) +else + clock_gettime_compiles=no fi + -ERL_MONOTONIC_CLOCK(high_resolution, undefined, no) +AC_CACHE_CHECK([how to correct for time adjustments], erl_cv_time_correction, +[ +case $clock_gettime_correction in + yes) + erl_cv_time_correction=clock_gettime;; + no|unknown) + case $ac_cv_func_gethrtime in + yes) + erl_cv_time_correction=hrtime ;; + no) + case $host_os in + linux*) + case $clock_gettime_correction in + unknown) + if test x$clock_gettime_compiles = xyes; then + if test X$cross_compiling != Xyes; then + linux_kernel_vsn_=`uname -r` + case $linux_kernel_vsn_ in + [[0-1]].*|2.[[0-5]]|2.[[0-5]].*) + erl_cv_time_correction=times ;; + *) + erl_cv_time_correction=clock_gettime;; + esac + else + case X$erl_xcomp_linux_clock_gettime_correction in + X) + erl_cv_time_correction=cross;; + Xyes|Xno) + if test $erl_xcomp_linux_clock_gettime_correction = yes; then + erl_cv_time_correction=clock_gettime + else + erl_cv_time_correction=times + fi;; + *) + AC_MSG_ERROR([Bad erl_xcomp_linux_clock_gettime_correction value: $erl_xcomp_linux_clock_gettime_correction]);; + esac + fi + else + erl_cv_time_correction=times + fi + ;; + *) + erl_cv_time_correction=times ;; + esac + ;; + *) + erl_cv_time_correction=none ;; + esac + ;; + esac + ;; +esac +]) -case $$erl_monotonic_clock_low_resolution-$erl_monotonic_clock_func in - no-mach_clock_get_time) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_hrtime() using mach clock_get_time()]) - ;; - no-clock_gettime) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_hrtime() using clock_gettime()]) - ;; - no-gethrtime) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_GETHRTIME, [1], [Define if you want to implement erts_os_hrtime() using gethrtime()]) +xrtlib="" +case $erl_cv_time_correction in + times) + AC_DEFINE(CORRECT_USING_TIMES,[], + [Define if you do not have a high-res. timer & want to use times() instead]) ;; - *) - monotonic_hrtime=no + clock_gettime|cross) + if test $erl_cv_time_correction = cross; then + erl_cv_time_correction=clock_gettime + AC_MSG_WARN([result clock_gettime guessed because of cross compilation]) + fi + xrtlib="-lrt" + AC_DEFINE(GETHRTIME_WITH_CLOCK_GETTIME,[1], + [Define if you want to use clock_gettime to simulate gethrtime]) ;; esac - -if test $monotonic_hrtime = yes; then - AC_DEFINE(HAVE_MONOTONIC_ERTS_SYS_HRTIME, [1], [Define if you have a monotonic erts_os_hrtime() implementation]) -fi - -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(HRTIME_CLOCK_ID_STR, ["$erl_monotonic_clock_id"], [Define as a string of monotonic clock id to use]) - AC_DEFINE_UNQUOTED(HRTIME_CLOCK_ID, [$erl_monotonic_clock_id], [Define to monotonic clock id to use]) -fi - - dnl dnl Check if gethrvtime is working, and if to use procfs ioctl dnl or (yet to be written) write to the procfs ctl file. @@ -2494,7 +1813,6 @@ esac ]) -LIBRT=$xrtlib case $erl_gethrvtime in procfs_ioctl) AC_DEFINE(HAVE_GETHRVTIME_PROCFS_IOCTL,[1], @@ -2541,33 +1859,43 @@ exit(0); return 0; } ], - erl_clock_gettime_cpu_time=yes, - erl_clock_gettime_cpu_time=no, + erl_clock_gettime=yes, + erl_clock_gettime=no, [ case X$erl_xcomp_clock_gettime_cpu_time in - X) erl_clock_gettime_cpu_time=cross;; - Xyes|Xno) erl_clock_gettime_cpu_time=$erl_xcomp_clock_gettime_cpu_time;; + X) erl_clock_gettime=cross;; + Xyes|Xno) erl_clock_gettime=$erl_xcomp_clock_gettime_cpu_time;; *) AC_MSG_ERROR([Bad erl_xcomp_clock_gettime_cpu_time value: $erl_xcomp_clock_gettime_cpu_time]);; esac ]) LIBS=$save_libs - AC_MSG_RESULT($erl_clock_gettime_cpu_time) - case $erl_clock_gettime_cpu_time in - yes) - AC_DEFINE(HAVE_CLOCK_GETTIME_CPU_TIME,[], - [define if clock_gettime() works for getting process time]) - LIBRT=-lrt - ;; - cross) - erl_clock_gettime_cpu_time=no - AC_MSG_WARN([result no guessed because of cross compilation]) + case $host_os in + linux*) + AC_MSG_RESULT([no; not stable]) + LIBRT=$xrtlib ;; *) + AC_MSG_RESULT($erl_clock_gettime) + case $erl_clock_gettime in + yes) + AC_DEFINE(HAVE_CLOCK_GETTIME,[], + [define if clock_gettime() works for getting process time]) + LIBRT=-lrt + ;; + cross) + erl_clock_gettime=no + AC_MSG_WARN([result no guessed because of cross compilation]) + LIBRT=$xrtlib + ;; + *) + LIBRT=$xrtlib + ;; + esac ;; esac + AC_SUBST(LIBRT) ;; esac -AC_SUBST(LIBRT) ])dnl dnl ---------------------------------------------------------------------- Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/bin/start.boot and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/bin/start.boot differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/bin/start_clean.boot and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/bin/start_clean.boot differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_a.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_a.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_asm.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_asm.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_block.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_block.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_bool.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_bool.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_bsm.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_bsm.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_clean.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_clean.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_dead.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_dead.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_dict.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_dict.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_disasm.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_disasm.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_except.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_except.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_flatten.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_flatten.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_jump.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_jump.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_listing.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_listing.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_opcodes.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_opcodes.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_peep.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_peep.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_receive.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_receive.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_split.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_split.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_trim.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_trim.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_type.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_type.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_utils.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_utils.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_validator.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_validator.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/beam_z.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/beam_z.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/cerl.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/cerl.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/cerl_clauses.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/cerl_clauses.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/cerl_inline.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/cerl_inline.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/cerl_sets.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/cerl_sets.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/cerl_trees.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/cerl_trees.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/compile.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/compile.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/core_lib.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/core_lib.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/core_lint.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/core_lint.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/core_parse.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/core_parse.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/core_pp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/core_pp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/core_scan.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/core_scan.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/erl_bifs.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/erl_bifs.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/rec_env.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/rec_env.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/sys_core_dsetel.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/sys_core_dsetel.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/sys_core_fold.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/sys_core_fold.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/sys_core_fold_lists.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/sys_core_fold_lists.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/sys_core_inline.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/sys_core_inline.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/sys_pre_attributes.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/sys_pre_attributes.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/sys_pre_expand.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/sys_pre_expand.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/v3_codegen.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/v3_codegen.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/v3_core.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/v3_core.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/v3_kernel.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/v3_kernel.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/v3_kernel_pp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/v3_kernel_pp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/compiler/ebin/v3_life.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/compiler/ebin/v3_life.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/application.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/application.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/application_controller.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/application_controller.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/application_master.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/application_master.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/application_starter.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/application_starter.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/auth.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/auth.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/code.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/code.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/code_server.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/code_server.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/disk_log_1.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/disk_log_1.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/disk_log.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/disk_log.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/disk_log_server.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/disk_log_server.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/disk_log_sup.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/disk_log_sup.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/dist_ac.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/dist_ac.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/dist_util.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/dist_util.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/erl_boot_server.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/erl_boot_server.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/erl_ddll.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/erl_ddll.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/erl_distribution.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/erl_distribution.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/erl_epmd.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/erl_epmd.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/erl_reply.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/erl_reply.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/error_handler.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/error_handler.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/error_logger.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/error_logger.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/erts_debug.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/erts_debug.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/file.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/file.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/file_io_server.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/file_io_server.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/file_server.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/file_server.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/gen_sctp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/gen_sctp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/gen_tcp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/gen_tcp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/gen_udp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/gen_udp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/global.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/global.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/global_group.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/global_group.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/global_search.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/global_search.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/group.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/group.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/heart.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/heart.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/hipe_unified_loader.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/hipe_unified_loader.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet6_sctp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet6_sctp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet6_tcp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet6_tcp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet6_tcp_dist.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet6_tcp_dist.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet6_udp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet6_udp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_config.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_config.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_db.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_db.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_dns.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_dns.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_gethost_native.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_gethost_native.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_hosts.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_hosts.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_parse.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_parse.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_res.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_res.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_sctp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_sctp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_tcp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_tcp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_tcp_dist.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_tcp_dist.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/inet_udp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/inet_udp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/kernel.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/kernel.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/kernel_config.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/kernel_config.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/net_adm.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/net_adm.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/net.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/net.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/net_kernel.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/net_kernel.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/os.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/os.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/pg2.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/pg2.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/ram_file.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/ram_file.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/rpc.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/rpc.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/seq_trace.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/seq_trace.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/standard_error.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/standard_error.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/user.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/user.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/user_drv.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/user_drv.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/user_sup.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/user_sup.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/kernel/ebin/wrap_log_reader.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/kernel/ebin/wrap_log_reader.beam differ diff -Nru erlang-18.2-dfsg/bootstrap/lib/kernel/include/dist.hrl erlang-17.3-dfsg/bootstrap/lib/kernel/include/dist.hrl --- erlang-18.2-dfsg/bootstrap/lib/kernel/include/dist.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/kernel/include/dist.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/bootstrap/lib/kernel/include/dist_util.hrl erlang-17.3-dfsg/bootstrap/lib/kernel/include/dist_util.hrl --- erlang-18.2-dfsg/bootstrap/lib/kernel/include/dist_util.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/kernel/include/dist_util.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/bootstrap/lib/kernel/include/file.hrl erlang-17.3-dfsg/bootstrap/lib/kernel/include/file.hrl --- erlang-18.2-dfsg/bootstrap/lib/kernel/include/file.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/kernel/include/file.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/bootstrap/lib/kernel/include/inet.hrl erlang-17.3-dfsg/bootstrap/lib/kernel/include/inet.hrl --- erlang-18.2-dfsg/bootstrap/lib/kernel/include/inet.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/kernel/include/inet.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/bootstrap/lib/kernel/include/inet_sctp.hrl erlang-17.3-dfsg/bootstrap/lib/kernel/include/inet_sctp.hrl --- erlang-18.2-dfsg/bootstrap/lib/kernel/include/inet_sctp.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/kernel/include/inet_sctp.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/bootstrap/lib/kernel/include/net_address.hrl erlang-17.3-dfsg/bootstrap/lib/kernel/include/net_address.hrl --- erlang-18.2-dfsg/bootstrap/lib/kernel/include/net_address.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/kernel/include/net_address.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/array.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/array.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/base64.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/base64.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/beam_lib.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/beam_lib.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/binary.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/binary.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/calendar.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/calendar.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/c.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/c.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/dets.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/dets.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/dets_server.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/dets_server.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/dets_sup.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/dets_sup.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/dets_utils.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/dets_utils.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/dets_v8.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/dets_v8.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/dets_v9.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/dets_v9.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/dict.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/dict.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/digraph.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/digraph.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/digraph_utils.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/digraph_utils.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/edlin.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/edlin.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/edlin_expand.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/edlin_expand.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/epp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/epp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_anno.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_anno.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_bits.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_bits.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_compile.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_compile.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_eval.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_eval.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_expand_records.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_expand_records.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_internal.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_internal.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_lint.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_lint.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_parse.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_parse.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_posix_msg.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_posix_msg.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_pp.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_pp.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_scan.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_scan.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/erl_tar.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/erl_tar.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/error_logger_file_h.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/error_logger_file_h.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/error_logger_tty_h.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/error_logger_tty_h.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/escript.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/escript.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/ets.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/ets.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/eval_bits.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/eval_bits.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/filelib.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/filelib.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/filename.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/filename.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/file_sorter.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/file_sorter.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/gb_sets.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/gb_sets.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/gb_trees.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/gb_trees.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/gen.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/gen.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/gen_event.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/gen_event.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/gen_fsm.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/gen_fsm.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/gen_server.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/gen_server.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/io.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/io.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/io_lib.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/io_lib.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/io_lib_format.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/io_lib_format.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/io_lib_fread.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/io_lib_fread.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/io_lib_pretty.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/io_lib_pretty.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/lib.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/lib.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/lists.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/lists.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/log_mf_h.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/log_mf_h.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/maps.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/maps.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/math.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/math.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/ms_transform.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/ms_transform.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/orddict.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/orddict.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/ordsets.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/ordsets.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/otp_internal.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/otp_internal.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/pg.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/pg.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/pool.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/pool.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/proc_lib.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/proc_lib.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/proplists.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/proplists.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/qlc.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/qlc.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/qlc_pt.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/qlc_pt.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/queue.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/queue.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/rand.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/rand.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/random.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/random.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/re.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/re.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/sets.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/sets.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/shell.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/shell.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/shell_default.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/shell_default.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/slave.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/slave.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/sofs.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/sofs.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/string.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/string.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/supervisor.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/supervisor.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/supervisor_bridge.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/supervisor_bridge.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/sys.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/sys.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/timer.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/timer.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/unicode.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/unicode.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/win32reg.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/win32reg.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/bootstrap/lib/stdlib/ebin/zip.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/bootstrap/lib/stdlib/ebin/zip.beam differ diff -Nru erlang-18.2-dfsg/bootstrap/lib/stdlib/include/assert.hrl erlang-17.3-dfsg/bootstrap/lib/stdlib/include/assert.hrl --- erlang-18.2-dfsg/bootstrap/lib/stdlib/include/assert.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/stdlib/include/assert.hrl 1970-01-01 00:00:00.000000000 +0000 @@ -1,261 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright (C) 2004-2014 Richard Carlsson, Mickaël Rémond -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - --ifndef(ASSERT_HRL). --define(ASSERT_HRL, true). - -%% Asserts are enabled unless NOASSERT is defined, and ASSERT can be used to -%% override it: if both ASSERT and NOASSERT are defined, then ASSERT takes -%% precedence, and NOASSERT will become undefined. -%% -%% Furthermore, if NODEBUG is defined, it implies NOASSERT, unless DEBUG or -%% ASSERT are defined. -%% -%% If asserts are disabled, all assert macros are defined to be the atom -%% 'ok'. If asserts are enabled, all assert macros are defined to yield 'ok' -%% as the result if the test succeeds, and raise an error exception if the -%% test fails. The error term will then have the form {Name, Info} where -%% Name is the name of the macro and Info is a list of tagged tuples. - -%% allow NODEBUG to imply NOASSERT, unless DEBUG --ifdef(NODEBUG). --ifndef(DEBUG). --ifndef(NOASSERT). --define(NOASSERT, true). --endif. --endif. --endif. - -%% allow ASSERT to override NOASSERT --ifdef(ASSERT). --undef(NOASSERT). --endif. - -%% Assert macros must not depend on any non-kernel or stdlib libraries. -%% -%% We must use fun-call wrappers ((fun () -> ... end)()) to avoid -%% exporting local variables, and furthermore we only use variable names -%% prefixed with "__", that hopefully will not be bound outside the fun. -%% It is not possible to nest assert macros. - --ifdef(NOASSERT). --define(assert(BoolExpr),ok). --else. -%% The assert macro is written the way it is so as not to cause warnings -%% for clauses that cannot match, even if the expression is a constant. --define(assert(BoolExpr), - begin - ((fun () -> - case (BoolExpr) of - true -> ok; - __V -> erlang:error({assert, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??BoolExpr)}, - {expected, true}, - case __V of false -> {value, __V}; - _ -> {not_boolean,__V} - end]}) - end - end)()) - end). --endif. - -%% This is the inverse case of assert, for convenience. --ifdef(NOASSERT). --define(assertNot(BoolExpr),ok). --else. --define(assertNot(BoolExpr), - begin - ((fun () -> - case (BoolExpr) of - false -> ok; - __V -> erlang:error({assert, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??BoolExpr)}, - {expected, false}, - case __V of true -> {value, __V}; - _ -> {not_boolean,__V} - end]}) - end - end)()) - end). --endif. - -%% This is mostly a convenience which gives more detailed reports. -%% Note: Guard is a guarded pattern, and can not be used for value. --ifdef(NOASSERT). --define(assertMatch(Guard, Expr), ok). --else. --define(assertMatch(Guard, Expr), - begin - ((fun () -> - case (Expr) of - Guard -> ok; - __V -> erlang:error({assertMatch, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {pattern, (??Guard)}, - {value, __V}]}) - end - end)()) - end). --endif. - -%% This is the inverse case of assertMatch, for convenience. --ifdef(NOASSERT). --define(assertNotMatch(Guard, Expr), ok). --else. --define(assertNotMatch(Guard, Expr), - begin - ((fun () -> - __V = (Expr), - case __V of - Guard -> erlang:error({assertNotMatch, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {pattern, (??Guard)}, - {value, __V}]}); - _ -> ok - end - end)()) - end). --endif. - -%% This is a convenience macro which gives more detailed reports when -%% the expected LHS value is not a pattern, but a computed value --ifdef(NOASSERT). --define(assertEqual(Expect, Expr), ok). --else. --define(assertEqual(Expect, Expr), - begin - ((fun (__X) -> - case (Expr) of - __X -> ok; - __V -> erlang:error({assertEqual, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {expected, __X}, - {value, __V}]}) - end - end)(Expect)) - end). --endif. - -%% This is the inverse case of assertEqual, for convenience. --ifdef(NOASSERT). --define(assertNotEqual(Unexpected, Expr), ok). --else. --define(assertNotEqual(Unexpected, Expr), - begin - ((fun (__X) -> - case (Expr) of - __X -> erlang:error({assertNotEqual, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {value, __X}]}); - _ -> ok - end - end)(Unexpected)) - end). --endif. - -%% Note: Class and Term are patterns, and can not be used for value. -%% Term can be a guarded pattern, but Class cannot. --ifdef(NOASSERT). --define(assertException(Class, Term, Expr), ok). --else. --define(assertException(Class, Term, Expr), - begin - ((fun () -> - try (Expr) of - __V -> erlang:error({assertException, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {pattern, - "{ "++(??Class)++" , "++(??Term) - ++" , [...] }"}, - {unexpected_success, __V}]}) - catch - Class:Term -> ok; - __C:__T -> - erlang:error({assertException, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {pattern, - "{ "++(??Class)++" , "++(??Term) - ++" , [...] }"}, - {unexpected_exception, - {__C, __T, - erlang:get_stacktrace()}}]}) - end - end)()) - end). --endif. - --define(assertError(Term, Expr), ?assertException(error, Term, Expr)). --define(assertExit(Term, Expr), ?assertException(exit, Term, Expr)). --define(assertThrow(Term, Expr), ?assertException(throw, Term, Expr)). - -%% This is the inverse case of assertException, for convenience. -%% Note: Class and Term are patterns, and can not be used for value. -%% Both Class and Term can be guarded patterns. --ifdef(NOASSERT). --define(assertNotException(Class, Term, Expr), ok). --else. --define(assertNotException(Class, Term, Expr), - begin - ((fun () -> - try (Expr) of - _ -> ok - catch - __C:__T -> - case __C of - Class -> - case __T of - Term -> - erlang:error({assertNotException, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {pattern, - "{ "++(??Class)++" , " - ++(??Term)++" , [...] }"}, - {unexpected_exception, - {__C, __T, - erlang:get_stacktrace() - }}]}); - _ -> ok - end; - _ -> ok - end - end - end)()) - end). --endif. - --endif. % ASSERT_HRL diff -Nru erlang-18.2-dfsg/bootstrap/lib/stdlib/include/erl_bits.hrl erlang-17.3-dfsg/bootstrap/lib/stdlib/include/erl_bits.hrl --- erlang-18.2-dfsg/bootstrap/lib/stdlib/include/erl_bits.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/stdlib/include/erl_bits.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/bootstrap/lib/stdlib/include/erl_compile.hrl erlang-17.3-dfsg/bootstrap/lib/stdlib/include/erl_compile.hrl --- erlang-18.2-dfsg/bootstrap/lib/stdlib/include/erl_compile.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/stdlib/include/erl_compile.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/bootstrap/lib/stdlib/include/ms_transform.hrl erlang-17.3-dfsg/bootstrap/lib/stdlib/include/ms_transform.hrl --- erlang-18.2-dfsg/bootstrap/lib/stdlib/include/ms_transform.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/stdlib/include/ms_transform.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/bootstrap/lib/stdlib/include/qlc.hrl erlang-17.3-dfsg/bootstrap/lib/stdlib/include/qlc.hrl --- erlang-18.2-dfsg/bootstrap/lib/stdlib/include/qlc.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/stdlib/include/qlc.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/bootstrap/lib/stdlib/include/zip.hrl erlang-17.3-dfsg/bootstrap/lib/stdlib/include/zip.hrl --- erlang-18.2-dfsg/bootstrap/lib/stdlib/include/zip.hrl 2015-12-20 18:13:21.000000000 +0000 +++ erlang-17.3-dfsg/bootstrap/lib/stdlib/include/zip.hrl 2014-09-18 07:51:05.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/configure erlang-17.3-dfsg/configure --- erlang-18.2-dfsg/configure 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/configure 2014-09-16 19:10:57.000000000 +0000 @@ -272,7 +272,7 @@ PACKAGE_BUGREPORT= ac_subdirs_all="$ac_subdirs_all lib erts" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS ERL_TOP CC CFLAGS STATIC_CFLAGS CFLAG_RUNTIME_LIBRARY_PATH CPP CPPFLAGS CXX CXXFLAGS LD LDFLAGS DED_LD DED_LDFLAGS DED_LD_FLAG_RUNTIME_LIBRARY_PATH LFS_CFLAGS LFS_LDFLAGS LFS_LIBS RANLIB AR GETCONF erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_double_middle_endian erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers erl_xcomp_ose_ldflags_pass1 erl_xcomp_ose_ldflags_pass2 erl_xcomp_ose_OSEROOT erl_xcomp_ose_STRIP erl_xcomp_ose_LM_POST_LINK erl_xcomp_ose_LM_SET_CONF erl_xcomp_ose_LM_ELF_SIZE erl_xcomp_ose_LM_LCF erl_xcomp_ose_BEAM_LM_CONF erl_xcomp_ose_EPMD_LM_CONF erl_xcomp_ose_RUN_ERL_LM_CONF erl_xcomp_ose_CONFD erl_xcomp_ose_CRT0_LM build build_cpu build_vendor build_os host host_cpu host_vendor host_os TARGET CROSS_COMPILING BOOTSTRAP_ONLY ac_ct_CC EXEEXT OBJEXT ac_ct_CXX ac_ct_LD MAKE_PROG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S ac_ct_RANLIB ERTS_VSN OTP_REL OTP_VSN DEFAULT_VERBOSITY NATIVE_LIBS_ENABLED subdirs LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS ERL_TOP CC CFLAGS STATIC_CFLAGS CFLAG_RUNTIME_LIBRARY_PATH CPP CPPFLAGS CXX CXXFLAGS LD LDFLAGS DED_LD DED_LDFLAGS DED_LD_FLAG_RUNTIME_LIBRARY_PATH LFS_CFLAGS LFS_LDFLAGS LFS_LIBS RANLIB AR GETCONF erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_double_middle_endian erl_xcomp_linux_clock_gettime_correction erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers erl_xcomp_ose_ldflags_pass1 erl_xcomp_ose_ldflags_pass2 erl_xcomp_ose_OSEROOT erl_xcomp_ose_STRIP erl_xcomp_ose_LM_POST_LINK erl_xcomp_ose_LM_SET_CONF erl_xcomp_ose_LM_ELF_SIZE erl_xcomp_ose_LM_LCF erl_xcomp_ose_BEAM_LM_CONF erl_xcomp_ose_EPMD_LM_CONF erl_xcomp_ose_RUN_ERL_LM_CONF erl_xcomp_ose_CONFD erl_xcomp_ose_CRT0_LM build build_cpu build_vendor build_os host host_cpu host_vendor host_os TARGET CROSS_COMPILING BOOTSTRAP_ONLY ac_ct_CC EXEEXT OBJEXT ac_ct_CXX ac_ct_LD MAKE_PROG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S ac_ct_RANLIB ERTS_VSN OTP_REL OTP_VSN DEFAULT_VERBOSITY NATIVE_LIBS_ENABLED subdirs LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -813,6 +813,10 @@ ac_env_erl_xcomp_double_middle_endian_value=$erl_xcomp_double_middle_endian ac_cv_env_erl_xcomp_double_middle_endian_set=${erl_xcomp_double_middle_endian+set} ac_cv_env_erl_xcomp_double_middle_endian_value=$erl_xcomp_double_middle_endian +ac_env_erl_xcomp_linux_clock_gettime_correction_set=${erl_xcomp_linux_clock_gettime_correction+set} +ac_env_erl_xcomp_linux_clock_gettime_correction_value=$erl_xcomp_linux_clock_gettime_correction +ac_cv_env_erl_xcomp_linux_clock_gettime_correction_set=${erl_xcomp_linux_clock_gettime_correction+set} +ac_cv_env_erl_xcomp_linux_clock_gettime_correction_value=$erl_xcomp_linux_clock_gettime_correction ac_env_erl_xcomp_linux_nptl_set=${erl_xcomp_linux_nptl+set} ac_env_erl_xcomp_linux_nptl_value=$erl_xcomp_linux_nptl ac_cv_env_erl_xcomp_linux_nptl_set=${erl_xcomp_linux_nptl+set} @@ -1041,14 +1045,6 @@ --with-ssl=PATH specify location of OpenSSL include and lib --with-ssl use SSL (default) --without-ssl don't use SSL - --with-ssl-incl=PATH location of OpenSSL include dir, if different than - specified by --with-ssl=PATH - --with-ssl-rpath=yes|no|PATHS - runtime library path for OpenSSL. Default is 'yes', - which equates to a number of standard locations. If - 'no', then no runtime library paths wil be used. - Anything else should be a comma separated list of - paths. --with-libatomic_ops=PATH specify and prefer usage of libatomic_ops in the ethread library @@ -1094,6 +1090,9 @@ erl_xcomp_double_middle_endian double-middle-endian system: yes|no (only used when cross compiling) + erl_xcomp_linux_clock_gettime_correction + clock_gettime() can be used for time correction: yes|no (only + used when cross compiling) erl_xcomp_linux_nptl have Native POSIX Thread Library: yes|no (only used when cross compiling) @@ -1663,6 +1662,7 @@ + default_cache_file=./config.cache if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then @@ -3547,20 +3547,6 @@ fi; - -# Check whether --with-ssl-incl or --without-ssl-incl was given. -if test "${with_ssl_incl+set}" = set; then - withval="$with_ssl_incl" - -fi; - - -# Check whether --with-ssl-rpath or --without-ssl-rpath was given. -if test "${with_ssl_rpath+set}" = set; then - withval="$with_ssl_rpath" - -fi; - # Check whether --enable-dynamic-ssl-lib or --disable-dynamic-ssl-lib was given. if test "${enable_dynamic_ssl_lib+set}" = set; then enableval="$enable_dynamic_ssl_lib" @@ -3721,7 +3707,7 @@ rm -f $ERL_TOP/lib/SKIP-APPLICATIONS for app in `cd lib && ls -d *`; do var=`eval echo \\$with_$app` - if test X${var} = Xno; then + if test X${var} == Xno; then echo "$app" >> $ERL_TOP/lib/SKIP-APPLICATIONS fi done @@ -4398,6 +4384,7 @@ s,@erl_xcomp_isysroot@,$erl_xcomp_isysroot,;t t s,@erl_xcomp_bigendian@,$erl_xcomp_bigendian,;t t s,@erl_xcomp_double_middle_endian@,$erl_xcomp_double_middle_endian,;t t +s,@erl_xcomp_linux_clock_gettime_correction@,$erl_xcomp_linux_clock_gettime_correction,;t t s,@erl_xcomp_linux_nptl@,$erl_xcomp_linux_nptl,;t t s,@erl_xcomp_linux_usable_sigusrx@,$erl_xcomp_linux_usable_sigusrx,;t t s,@erl_xcomp_linux_usable_sigaltstack@,$erl_xcomp_linux_usable_sigaltstack,;t t diff -Nru erlang-18.2-dfsg/configure.in erlang-17.3-dfsg/configure.in --- erlang-18.2-dfsg/configure.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/configure.in 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ dnl dnl Copyright Ericsson AB 1998-2014. All Rights Reserved. dnl -dnl Licensed under the Apache License, Version 2.0 (the "License"); -dnl you may not use this file except in compliance with the License. -dnl You may obtain a copy of the License at +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. dnl dnl %CopyrightEnd% @@ -263,17 +262,6 @@ AS_HELP_STRING([--with-ssl], [use SSL (default)]) AS_HELP_STRING([--without-ssl], [don't use SSL])) -AC_ARG_WITH(ssl-incl, -AS_HELP_STRING([--with-ssl-incl=PATH], - [location of OpenSSL include dir, if different than specified by --with-ssl=PATH])) - -AC_ARG_WITH(ssl-rpath, -AS_HELP_STRING([--with-ssl-rpath=yes|no|PATHS], - [runtime library path for OpenSSL. Default is 'yes', which equates to a - number of standard locations. If 'no', then no runtime - library paths wil be used. Anything else should be a - comma separated list of paths.])) - AC_ARG_ENABLE(dynamic-ssl-lib, AS_HELP_STRING([--disable-dynamic-ssl-lib], [disable using dynamic openssl libraries])) @@ -424,7 +412,7 @@ rm -f $ERL_TOP/lib/SKIP-APPLICATIONS for app in `cd lib && ls -d *`; do var=`eval echo \\$with_$app` - if test X${var} = Xno; then + if test X${var} == Xno; then echo "$app" >> $ERL_TOP/lib/SKIP-APPLICATIONS fi done diff -Nru erlang-18.2-dfsg/debian/changelog erlang-17.3-dfsg/debian/changelog --- erlang-18.2-dfsg/debian/changelog 2016-03-12 09:01:04.000000000 +0000 +++ erlang-17.3-dfsg/debian/changelog 2016-03-17 23:22:59.000000000 +0000 @@ -1,146 +1,8 @@ -erlang (1:18.2-dfsg-2~14.04.1) trusty; urgency=medium +erlang (1:17.3-dfsg-3ubuntu1~14.04.0) trusty; urgency=medium * backport to trusty - -- Richard Hansen Sat, 12 Mar 2016 02:58:19 -0500 - -erlang (1:18.2-dfsg-2ubuntu1) xenial; urgency=low - - * Merge from Debian unstable. Remaining changes: - - d/patches/fix-pointer-conversion.patch: Remove implicit integer to - pointer conversion. - - d/control: Drop libwxgtk3.0-dev build dependency. Wx isn't in main, - and not supposed to. - - d/control: Drop erlang-wx binary and associated dependencies from - other erlang-* packages. - - d/rules: Add "+debug_info" to ERL_COMPILE_FLAGS for debug builds. - - d/p/bytecode-compat.patch: Specify source/target = 1.5 when compiling - Java source code. - - d/rules: Use "-DEPMD6" in CPPFLAGS and ensure this is passed to - relevant bits of the build process, enabling IPv6 support. - - d/control: Build erlang-base-hipe on ppc64 and ppc64el. - - d/control: Drop BD on fop to support demotion to universe. - - -- James Page Thu, 14 Jan 2016 15:44:38 +0200 - -erlang (1:18.2-dfsg-2) unstable; urgency=medium - - * Fixed FTBFS for GNU/kFreeBSD and GNU/Hurd due to incorrectly checked - presence of gethostname_r() function. - * Fixed FTBFS for X32 architecture due to incorrectly used inline assembly. - - -- Sergei Golovan Sun, 27 Dec 2015 12:40:53 +0300 - -erlang (1:18.2-dfsg-1) unstable; urgency=medium - - * New upstream release. - - -- Sergei Golovan Sun, 20 Dec 2015 21:11:53 +0300 - -erlang (1:18.1-dfsg-1) unstable; urgency=medium - - * New upstream release. - - -- Sergei Golovan Sat, 07 Nov 2015 10:33:50 +0300 - -erlang (1:18.0-dfsg-2) unstable; urgency=medium - - * Added a patch from Chris Lamb which allows Erlang compiler to put - a specified timestamp into the compiled binaries instead of the - current time. This helps with reproducibility of Erlang binaries - (closes: #795834). - - -- Sergei Golovan Mon, 17 Aug 2015 15:14:59 +0300 - -erlang (1:18.0-dfsg-1ubuntu2) xenial; urgency=medium - - * d/control: Drop BD on fop to support demotion to universe. - - -- James Page Mon, 04 Jan 2016 13:56:48 +0000 - -erlang (1:18.0-dfsg-1ubuntu1) wily; urgency=low - - * Merge from Debian unstable. Remaining changes: - - d/patches/fix-pointer-conversion.patch: Remove implicit integer to - pointer conversion. - - d/control: Drop libwxgtk3.0-dev build dependency. Wx isn't in main, - and not supposed to. - - d/control: Drop erlang-wx binary and associated dependencies from - other erlang-* packages. - - d/rules: Add "+debug_info" to ERL_COMPILE_FLAGS for debug builds. - - d/p/bytecode-compat.patch: Specify source/target = 1.5 when compiling - Java source code. - - d/rules: Use "-DEPMD6" in CPPFLAGS and ensure this is passed to - relevant bits of the build process, enabling IPv6 support. - - d/control: Build erlang-base-hipe on ppc64 and ppc64el. - - -- James Page Wed, 08 Jul 2015 13:52:33 +0100 - -erlang (1:18.0-dfsg-1) unstable; urgency=medium - - * New upstream release. - * Refreshed patches, removed patch which disables SSLv3 protocol in - the ssl application because this protocol has been disabled upstream. - * Changed the license in debian/copyright because upstream relicensed - Erlang/OTP from Erlang public license to Apache 2.0 license. - - -- Sergei Golovan Sat, 27 Jun 2015 14:29:01 +0300 - -erlang (1:17.5-dfsg-2ubuntu1) wily; urgency=low - - * Merge from Debian unstable. Remaining changes: - - d/patches/fix-pointer-conversion.patch: Remove implicit integer to - pointer conversion. - - d/control: Drop libwxgtk3.0-dev build dependency. Wx isn't in main, - and not supposed to. - - d/control: Drop erlang-wx binary and associated dependencies from - other erlang-* packages. - - d/rules: Add "+debug_info" to ERL_COMPILE_FLAGS for debug builds. - - d/p/bytecode-compat.patch: Specify source/target = 1.5 when compiling - Java source code. - - d/rules: Use "-DEPMD6" in CPPFLAGS and ensure this is passed to - relevant bits of the build process, enabling IPv6 support. - - d/control: Build erlang-base-hipe on ppc64 and ppc64el. - - -- James Page Tue, 07 Jul 2015 17:42:33 +0100 - -erlang (1:17.5-dfsg-2) unstable; urgency=medium - - * Upload into unstable. - * Removed the patch which fixes TLS POODLE vulnerability in the Erlang - SSL application (CVE-2015-2774) because it has been applied upstream. - - -- Sergei Golovan Wed, 27 May 2015 08:18:40 +0300 - -erlang (1:17.5-dfsg-1) experimental; urgency=medium - - * New upstream release. - * Put erl_interface.app and erl_interface.appup into the erlang-dev package. - - -- Sergei Golovan Wed, 01 Apr 2015 12:04:55 +0300 - -erlang (1:17.4-dfsg-1) experimental; urgency=medium - - * New upstream release. - * Removed a patch which fixed empty SNI extension processing in the - ssl application because it has been applied upstream. - * Removed a patch which removes rpath from the crypto application binary - and use the new --with-ssl-rpath=no configure option instead. - * Search for an Erlang module manual page in section 3erl only in - Emacs Erlang mode (closes: #772876). - - -- Sergei Golovan Sun, 14 Dec 2014 09:07:42 +0300 - -erlang (1:17.3-dfsg-4) unstable; urgency=medium - - * Added a patch from upstream which fixes TLS POODLE vulnerability in - the Erlang SSL application (CVE-2015-2774) (closes: #781839). - * Fixed erts_gzinflate_buffer() declaration to prevent possible buffer - overflow (closes: #747593). - * Replaced libsystemd-daemon-dev by libsystemd-dev in build dependencies - (closes: #779750). - - -- Sergei Golovan Sat, 04 Apr 2015 17:00:55 +0300 + -- Richard Hansen Thu, 17 Mar 2016 19:20:14 -0400 erlang (1:17.3-dfsg-3ubuntu1) vivid; urgency=low diff -Nru erlang-18.2-dfsg/debian/control erlang-17.3-dfsg/debian/control --- erlang-18.2-dfsg/debian/control 2016-01-04 20:12:17.000000000 +0000 +++ erlang-17.3-dfsg/debian/control 2014-12-05 11:15:46.000000000 +0000 @@ -9,8 +9,8 @@ libncurses5-dev, autotools-dev, unixodbc-dev, bison, flex, ed, dctrl-tools, xsltproc, libgl1-mesa-dev | libgl-dev, libglu1-mesa-dev | libglu-dev, - libsctp-dev [linux-any], libsystemd-dev [linux-any], dh-systemd -Build-Depends-Indep: default-jdk | sun-java6-jdk + libsctp-dev [linux-any], libsystemd-daemon-dev [linux-any], dh-systemd +Build-Depends-Indep: fop, default-jdk | sun-java6-jdk Build-Conflicts: autoconf2.13, libwxgtk2.4-dev, libwxgtk2.6-dev, libwxgtk2.8-dev Homepage: http://www.erlang.org/ Vcs-Svn: svn://anonscm.debian.org/pkg-erlang/erlang/trunk/ @@ -201,7 +201,7 @@ Replaces: erlang (<< ${source:Version}), erlang-base (<< ${binary:Version}), erlang-base-hipe (<< ${binary:Version}), erlang-nox (<< ${source:Version}), erlang-x11 (<< ${binary:Version}), erlang-src (<< ${source:Version}), erlang-dev (<< ${binary:Version}), erlang-examples (<< ${source:Version}), erlang-mode (<< 1:12.b.1-dfsg-2), erlang-doc (<< ${source:Upstream-Version}), erlang-doc (>> ${source:Upstream-Version}-999), erlang-manpages (<= 1:11.b.1-2) Description: Erlang/OTP documentation stylesheets The erl_docgen package includes XSLT stylesheets and document type - definitions used for Erlang/OTP documentation. They allow one to + definitions used for Erlang/OTP documentation. They allow to transform documentation to manpage, HTML, and PDF formats. diff -Nru erlang-18.2-dfsg/debian/copyright erlang-17.3-dfsg/debian/copyright --- erlang-18.2-dfsg/debian/copyright 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/copyright 2014-12-01 04:10:56.000000000 +0000 @@ -29,13 +29,9 @@ with prebuilt architecture-independent binaries. They are removed from the source package (except for required bootstrap files). -The files lib/diameter/doc/standards/*, lib/megaco/doc/standards/*, -lib/ssh/doc/standards/* and lib/inets/doc/archive/* have been removed +The files lib/megaco/standards/* and lib/ssh/standards/* have been removed from the upstream tarball because they are not DFSG free. -The files lib/common_test/priv/*.js have been removed from the upstream tarball -because they are minified Javascript files. - ============================================================================ This licence applies to lib/edoc and lib/syntax_tools @@ -62,8 +58,6 @@ ============================================================================ This licence applies to lib/eldap -Copyright (c) 2010, Torbjorn Tornkvist - 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 @@ -163,21 +157,291 @@ THE POSSIBILITY OF SUCH INJURY OR DAMAGE. ============================================================================ -This license applies to the rest of the Erlang/OTP source files -Copyright Ericsson AB 2002-2013. All Rights Reserved. +ERLANG PUBLIC LICENSE +Version 1.1 -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +1. Definitions. - http://www.apache.org/licenses/LICENSE-2.0 +1.1. ``Contributor'' means each entity that creates or contributes to +the creation of Modifications. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +1.2. ``Contributor Version'' means the combination of the Original +Code, prior Modifications used by a Contributor, and the Modifications +made by that particular Contributor. + +1.3. ``Covered Code'' means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case +including portions thereof. + +1.4. ``Electronic Distribution Mechanism'' means a mechanism generally +accepted in the software development community for the electronic +transfer of data. + +1.5. ``Executable'' means Covered Code in any form other than Source +Code. + +1.6. ``Initial Developer'' means the individual or entity identified +as the Initial Developer in the Source Code notice required by Exhibit +A. + +1.7. ``Larger Work'' means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + +1.8. ``License'' means this document. + +1.9. ``Modifications'' means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + +A. Any addition to or deletion from the contents of a file containing + Original Code or previous Modifications. + +B. Any new file that contains any part of the Original Code or + previous Modifications. + +1.10. ``Original Code'' means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as +Original Code, and which, at the time of its release under this +License is not already Covered Code governed by this License. + +1.11. ``Source Code'' means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus +any associated interface definition files, scripts used to control +compilation and installation of an Executable, or a list of source +code differential comparisons against either the Original Code or +another well known, available Covered Code of the Contributor's +choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is +widely available for no charge. + +1.12. ``You'' means an individual or a legal entity exercising rights +under, and complying with all of the terms of, this License. For legal +entities,``You'' includes any entity which controls, is controlled by, +or is under common control with You. For purposes of this definition, +``control'' means (a) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (b) ownership of fifty percent (50%) or more of the +outstanding shares or beneficial ownership of such entity. + +2. Source Code License. + +2.1. The Initial Developer Grant. +The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property +claims: + +(a) to use, reproduce, modify, display, perform, sublicense and + distribute the Original Code (or portions thereof) with or without + Modifications, or as part of a Larger Work; and + +(b) under patents now or hereafter owned or controlled by Initial + Developer, to make, have made, use and sell (``Utilize'') the + Original Code (or portions thereof), but solely to the extent that + any such patent is reasonably necessary to enable You to Utilize + the Original Code (or portions thereof) and not to any greater + extent that may be necessary to Utilize further Modifications or + combinations. + +2.2. Contributor Grant. +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property +claims: + +(a) to use, reproduce, modify, display, perform, sublicense and + distribute the Modifications created by such Contributor (or + portions thereof) either on an unmodified basis, with other + Modifications, as Covered Code or as part of a Larger Work; and + +(b) under patents now or hereafter owned or controlled by Contributor, + to Utilize the Contributor Version (or portions thereof), but + solely to the extent that any such patent is reasonably necessary + to enable You to Utilize the Contributor Version (or portions + thereof), and not to any greater extent that may be necessary to + Utilize further Modifications or combinations. + +3. Distribution Obligations. + +3.1. Application of License. +The Modifications which You contribute are governed by the terms of +this License, including without limitation Section 2.2. The Source +Code version of Covered Code may be distributed only under the terms +of this License, and You must include a copy of this License with +every copy of the Source Code You distribute. You may not offer or +impose any terms on any Source Code version that alters or restricts +the applicable version of this License or the recipients' rights +hereunder. However, You may include an additional document offering +the additional rights described in Section 3.5. + +3.2. Availability of Source Code. +Any Modification which You contribute must be made available in Source +Code form under the terms of this License either on the same media as +an Executable version or via an accepted Electronic Distribution +Mechanism to anyone to whom you made an Executable version available; +and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it +initially became available, or at least six (6) months after a +subsequent version of that particular Modification has been made +available to such recipients. You are responsible for ensuring that +the Source Code version remains available even if the Electronic +Distribution Mechanism is maintained by a third party. + +3.3. Description of Modifications. +You must cause all Covered Code to which you contribute to contain a +file documenting the changes You made to create that Covered Code and +the date of any change. You must include a prominent statement that +the Modification is derived, directly or indirectly, from Original +Code provided by the Initial Developer and including the name of the +Initial Developer in (a) the Source Code, and (b) in any notice in an +Executable version or related documentation in which You describe the +origin or ownership of the Covered Code. + +3.4. Intellectual Property Matters + +(a) Third Party Claims. + If You have knowledge that a party claims an intellectual property + right in particular functionality or code (or its utilization + under this License), you must include a text file with the source + code distribution titled ``LEGAL'' which describes the claim and + the party making the claim in sufficient detail that a recipient + will know whom to contact. If you obtain such knowledge after You + make Your Modification available as described in Section 3.2, You + shall promptly modify the LEGAL file in all copies You make + available thereafter and shall take other steps (such as notifying + appropriate mailing lists or newsgroups) reasonably calculated to + inform those who received the Covered Code that new knowledge has + been obtained. + +(b) Contributor APIs. + If Your Modification is an application programming interface and + You own or control patents which are reasonably necessary to + implement that API, you must also include this information in the + LEGAL file. + +3.5. Required Notices. +You must duplicate the notice in Exhibit A in each file of the Source +Code, and this License in any documentation for the Source Code, where +You describe recipients' rights relating to Covered Code. If You +created one or more Modification(s), You may add your name as a +Contributor to the notice described in Exhibit A. If it is not +possible to put such notice in a particular Source Code file due to +its structure, then you must include such notice in a location (such +as a relevant directory file) where a user would be likely to look for +such a notice. You may choose to offer, and to charge a fee for, +warranty, support, indemnity or liability obligations to one or more +recipients of Covered Code. However, You may do so only on Your own +behalf, and not on behalf of the Initial Developer or any +Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, +and You hereby agree to indemnify the Initial Developer and every +Contributor for any liability incurred by the Initial Developer or +such Contributor as a result of warranty, support, indemnity or +liability terms You offer. + +3.6. Distribution of Executable Versions. +You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, +and if You include a notice stating that the Source Code version of +the Covered Code is available under the terms of this License, +including a description of how and where You have fulfilled the +obligations of Section 3.2. The notice must be conspicuously included +in any notice in an Executable version, related documentation or +collateral in which You describe recipients' rights relating to the +Covered Code. You may distribute the Executable version of Covered +Code under a license of Your choice, which may contain terms different +from this License, provided that You are in compliance with the terms +of this License and that the license for the Executable version does +not attempt to limit or alter the recipient's rights in the Source +Code version from the rights set forth in this License. If You +distribute the Executable version under a different license You must +make it absolutely clear that any terms which differ from this License +are offered by You alone, not by the Initial Developer or any +Contributor. You hereby agree to indemnify the Initial Developer and +every Contributor for any liability incurred by the Initial Developer +or such Contributor as a result of any such terms You offer. + +3.7. Larger Works. +You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger +Work as a single product. In such a case, You must make sure the +requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute +or regulation then You must: (a) comply with the terms of this License +to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL +file described in Section 3.4 and must be included with all +distributions of the Source Code. Except to the extent prohibited by +statute or regulation, such description must be sufficiently detailed +for a recipient of ordinary skill to be able to understand it. + +5. Application of this License. + +This License applies to code to which the Initial Developer has +attached the notice in Exhibit A, and to related Covered Code. + +6. CONNECTION TO MOZILLA PUBLIC LICENSE + +This Erlang License is a derivative work of the Mozilla Public +License, Version 1.0. It contains terms which differ from the Mozilla +Public License, Version 1.0. + +7. DISCLAIMER OF WARRANTY. + +COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF +DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR +NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF +THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE +IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER +CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART +OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER +EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. +This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure +such breach within 30 days of becoming aware of the breach. All +sublicenses to the Covered Code which are properly granted shall +survive any termination of this License. Provisions which, by their +nature, must remain in effect beyond the termination of this License +shall survive. + +9. DISCLAIMER OF LIABILITY +Any utilization of Covered Code shall not cause the Initial Developer +or any Contributor to be liable for any damages (neither direct nor +indirect). + +10. MISCELLANEOUS +This License represents the complete agreement concerning the subject +matter hereof. If any provision is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be construed by and in accordance with +the substantive laws of Sweden. Any dispute, controversy or claim +arising out of or relating to this License, or the breach, termination +or invalidity thereof, shall be subject to the exclusive jurisdiction +of Swedish courts, with the Stockholm City Court as the first +instance. + +EXHIBIT A. + +``The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved via the world wide web at http://www.erlang.org/. + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. + +The Initial Developer of the Original Code is Ericsson Utvecklings AB. +Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +AB. All Rights Reserved.'' -On a Debian system the complete text of the Apache-2.0 license can be -found in /usr/share/common-licenses/Apache-2.0 diff -Nru erlang-18.2-dfsg/debian/patches/beamload.patch erlang-17.3-dfsg/debian/patches/beamload.patch --- erlang-18.2-dfsg/debian/patches/beamload.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/beamload.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -Author: Sergei Golovan -Description: Patch fixes function declaration. -Bugs-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=747593 - ---- a/erts/emulator/beam/beam_load.c -+++ b/erts/emulator/beam/beam_load.c -@@ -45,7 +45,7 @@ - #include "hipe_arch.h" - #endif - --ErlDrvBinary* erts_gzinflate_buffer(char*, int); -+ErlDrvBinary* erts_gzinflate_buffer(char*, uLong); - - #define MAX_OPARGS 8 - #define CALLED 0 diff -Nru erlang-18.2-dfsg/debian/patches/bytecode-compat.patch erlang-17.3-dfsg/debian/patches/bytecode-compat.patch --- erlang-18.2-dfsg/debian/patches/bytecode-compat.patch 2016-01-14 12:33:45.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/bytecode-compat.patch 2013-07-10 09:29:30.000000000 +0000 @@ -10,7 +10,7 @@ --- a/lib/ic/java_src/com/ericsson/otp/ic/Makefile +++ b/lib/ic/java_src/com/ericsson/otp/ic/Makefile -@@ -91,7 +91,7 @@ ifneq ($(V),0) +@@ -90,7 +90,7 @@ ifneq ($(V),0) JARFLAGS= -cfv endif @@ -21,12 +21,12 @@ # Make Rules --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile -@@ -79,7 +79,7 @@ ifneq ($(V),0) +@@ -66,7 +66,7 @@ ifneq ($(V),0) JARFLAGS=-cfv endif --JAVA_OPTIONS = -Xlint -+JAVA_OPTIONS = -Xlint -source 1.5 -target 1.5 +-JAVA_OPTIONS = ++JAVA_OPTIONS = -source 1.5 -target 1.5 ifeq ($(TESTROOT),) RELEASE_PATH="$(ERL_TOP)/release/$(TARGET)" diff -Nru erlang-18.2-dfsg/debian/patches/clean.patch erlang-17.3-dfsg/debian/patches/clean.patch --- erlang-18.2-dfsg/debian/patches/clean.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/clean.patch 2014-12-01 04:10:57.000000000 +0000 @@ -5,7 +5,7 @@ --- a/Makefile.in +++ b/Makefile.in -@@ -1093,6 +1093,7 @@ +@@ -1092,6 +1092,7 @@ rm -f *~ *.bak config.log config.status prebuilt.files ibin/* cd erts && ERL_TOP=$(ERL_TOP) $(MAKE) clean cd lib && ERL_TOP=$(ERL_TOP) $(MAKE) clean BUILD_ALL=true @@ -13,7 +13,7 @@ distclean: clean find . -type f -name SKIP -print | xargs $(RM) -@@ -1134,3 +1135,209 @@ +@@ -1133,3 +1134,209 @@ || $(MAKE) BOOTSTRAP_ROOT=$(BOOTSTRAP_ROOT) bootstrap_root_clean # ---------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/debian/patches/docs.patch erlang-17.3-dfsg/debian/patches/docs.patch --- erlang-18.2-dfsg/debian/patches/docs.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/docs.patch 2014-12-01 04:10:57.000000000 +0000 @@ -5,7 +5,7 @@ --- a/lib/erl_docgen/priv/xsl/db_man.xsl +++ b/lib/erl_docgen/priv/xsl/db_man.xsl -@@ -517,7 +517,7 @@ +@@ -516,7 +516,7 @@ .RS 2 .LP @@ -14,7 +14,7 @@ -@@ -853,7 +853,7 @@ +@@ -824,7 +824,7 @@ .RS @@ -25,7 +25,7 @@ --- a/lib/megaco/doc/src/Makefile +++ b/lib/megaco/doc/src/Makefile -@@ -170,8 +170,6 @@ +@@ -169,8 +169,6 @@ $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" @@ -36,7 +36,7 @@ --- a/lib/stdlib/doc/src/re.xml +++ b/lib/stdlib/doc/src/re.xml -@@ -377,7 +377,7 @@ +@@ -372,7 +372,7 @@ metacharacter should not match before it. Setting this without multiline (at compile time) causes circumflex never to match. This option only affects the behavior of the circumflex @@ -45,7 +45,7 @@ noteol -@@ -386,8 +386,8 @@ +@@ -381,8 +381,8 @@ match it nor (except in multiline mode) a newline immediately before it. Setting this without multiline (at compile time) causes dollar never to match. This option affects only the @@ -58,7 +58,7 @@ --- a/lib/tools/Makefile +++ b/lib/tools/Makefile -@@ -24,7 +24,7 @@ +@@ -23,7 +23,7 @@ # Macros # ---------------------------------------------------- @@ -69,7 +69,7 @@ VSN = $(TOOLS_VSN) --- a/system/doc/top/Makefile +++ b/system/doc/top/Makefile -@@ -35,7 +35,7 @@ +@@ -34,7 +34,7 @@ GIF_FILES = diff -Nru erlang-18.2-dfsg/debian/patches/emacs.patch erlang-17.3-dfsg/debian/patches/emacs.patch --- erlang-18.2-dfsg/debian/patches/emacs.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/emacs.patch 2014-12-01 04:10:57.000000000 +0000 @@ -5,7 +5,7 @@ --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el -@@ -498,8 +498,8 @@ +@@ -497,8 +497,8 @@ (defvar erlang-man-dirs '(("Man - Commands" "/man/man1" t) ("Man - Modules" "/man/man3" t) @@ -16,7 +16,7 @@ "*The man directories displayed in the Erlang menu. Each item in the list should be a list with three elements, the first -@@ -1292,23 +1292,22 @@ +@@ -1286,23 +1286,22 @@ (or (fboundp 'eval-when-compile) (defmacro eval-when-compile (&rest rest) nil)) @@ -44,7 +44,7 @@ ;; defvar some obsolete variables, which we still support for ;; backwards compatibility reasons. -@@ -2031,7 +2030,7 @@ +@@ -2025,7 +2024,7 @@ (defun erlang-man-make-menu-item (file) "Create a menu item containing the name of the man page." @@ -53,7 +53,7 @@ (let ((page (substring file (match-beginning 1) (match-end 1)))) (list (capitalize page) (list 'lambda '() -@@ -2042,7 +2041,7 @@ +@@ -2036,7 +2035,7 @@ (defun erlang-man-get-files (dir) "Return files in directory DIR." @@ -62,16 +62,16 @@ (defun erlang-man-module (&optional module) -@@ -2062,7 +2061,7 @@ +@@ -2056,7 +2055,7 @@ (if (or (null module) (string= module "")) (error "No Erlang module name given")) (let ((dir-list erlang-man-dirs) - (pat (concat "/" (regexp-quote module) "\\.\\([124-9]\\|3\\(erl\\)?\\)\\(\\.gz\\)?$")) -+ (pat (concat "/" (regexp-quote module) "\\.\\(3\\(erl\\)\\)\\(\\.gz\\)?$")) ++ (pat (concat "/" (regexp-quote module) "\\.\\([124-9]\\|3\\(erl\\)\\)\\(\\.gz\\)?$")) (file nil) file-list) (while (and dir-list (null file)) -@@ -2203,9 +2202,9 @@ +@@ -2197,9 +2196,9 @@ (error nil)) (if file (let ((process-environment (copy-sequence process-environment))) diff -Nru erlang-18.2-dfsg/debian/patches/fix-pointer-converstion.patch erlang-17.3-dfsg/debian/patches/fix-pointer-converstion.patch --- erlang-18.2-dfsg/debian/patches/fix-pointer-converstion.patch 2016-01-14 12:33:38.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/fix-pointer-converstion.patch 2013-07-10 09:29:30.000000000 +0000 @@ -2,9 +2,11 @@ Subject: resolve buildd failure "Function `erl_malloc' implicitly converted to pointer at legacy/erl_timeout.c:77" Bug-Ubuntu: https://launchpad.net/bugs/778484 ---- a/lib/erl_interface/src/legacy/erl_timeout.c -+++ b/lib/erl_interface/src/legacy/erl_timeout.c -@@ -46,6 +46,7 @@ +Index: erlang-14.b.4-dfsg-1ubuntu1/lib/erl_interface/src/legacy/erl_timeout.c +=================================================================== +--- erlang-14.b.4-dfsg-1ubuntu1.orig/lib/erl_interface/src/legacy/erl_timeout.c 2011-12-15 16:39:50.958344893 -0800 ++++ erlang-14.b.4-dfsg-1ubuntu1/lib/erl_interface/src/legacy/erl_timeout.c 2011-12-15 16:40:45.183171477 -0800 +@@ -45,6 +45,7 @@ #include "erl_interface.h" #include "erl_timeout.h" @@ -12,7 +14,7 @@ typedef struct jmp_s { jmp_buf jmpbuf; -@@ -76,7 +77,7 @@ jmp_buf *timeout_setup(int ms) +@@ -75,7 +76,7 @@ t.it_value.tv_usec = (ms % 1000) * 1000; /* get a jump buffer and save it */ diff -Nru erlang-18.2-dfsg/debian/patches/gethostbyname.patch erlang-17.3-dfsg/debian/patches/gethostbyname.patch --- erlang-18.2-dfsg/debian/patches/gethostbyname.patch 2015-12-27 05:08:00.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/gethostbyname.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -Author: Sergei Golovan -Description: Patch fixes FTBFS on GNU/kFreeBSD and GNU/Hurd. -Last-Modified: Sun, 27 Dec 2015 08:05:22 +0300 - ---- a/lib/erl_interface/src/connect/ei_resolve.c -+++ b/lib/erl_interface/src/connect/ei_resolve.c -@@ -607,7 +607,7 @@ - * - * TODO: check this properly in configure.in - */ --#if (defined(__linux__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__)) -+#if (defined(__GLIBC__) || defined(__linux__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__)) - #define HAVE_GETHOSTBYADDR_R_8 1 - #endif - diff -Nru erlang-18.2-dfsg/debian/patches/gnu.patch erlang-17.3-dfsg/debian/patches/gnu.patch --- erlang-18.2-dfsg/debian/patches/gnu.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/gnu.patch 2014-12-01 04:10:57.000000000 +0000 @@ -13,7 +13,7 @@ --- a/erts/configure.in +++ b/erts/configure.in -@@ -464,7 +464,7 @@ +@@ -481,7 +481,7 @@ dnl NOTE: CPPFLAGS will be included in CFLAGS at the end case $host_os in @@ -22,7 +22,7 @@ win32) # The ethread library requires _WIN32_WINNT of at least 0x0403. # -D_WIN32_WINNT=* from CPPFLAGS is saved in ETHR_DEFS. -@@ -1339,7 +1339,7 @@ +@@ -1334,7 +1334,7 @@ solaris*) enable_child_waiter_thread=yes ;; @@ -33,7 +33,7 @@ AC_DEFINE(ERTS_NEED_DLOPEN_BEFORE_DLERROR,[1], --- a/lib/os_mon/c_src/memsup.c +++ b/lib/os_mon/c_src/memsup.c -@@ -99,6 +99,11 @@ +@@ -98,6 +98,11 @@ #include #include @@ -47,9 +47,9 @@ #include --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c -@@ -723,6 +723,11 @@ - (((unsigned char*) (s))[1] << 8) | \ - (((unsigned char*) (s))[0])) +@@ -692,6 +692,11 @@ + inet_driver_select((d)->port, (ErlDrvEvent)(long)(d)->event, (flags), (onoff)); \ + } while(0) +#ifdef __GNU__ +#warning "Undefined AF_LINK for GNU/Hurd" @@ -57,11 +57,11 @@ +#endif + - #ifdef VALGRIND - # include + #endif /* !__WIN32__ && !__OSE__ */ + --- a/erts/etc/common/erlexec.c +++ b/erts/etc/common/erlexec.c -@@ -1581,7 +1581,7 @@ +@@ -1561,7 +1561,7 @@ if (!bindir) { /* Determine bindir from absolute path to executable */ char *p; @@ -70,7 +70,7 @@ strncpy(buffer, argv[0], sizeof(buffer)); buffer[sizeof(buffer)-1] = '\0'; -@@ -1595,7 +1595,7 @@ +@@ -1575,7 +1575,7 @@ if (!rootdir) { /* Determine rootdir from absolute path to bindir */ char *p; @@ -81,7 +81,7 @@ --- a/erts/etc/common/escript.c +++ b/erts/etc/common/escript.c -@@ -55,7 +55,7 @@ +@@ -54,7 +54,7 @@ # define IS_DIRSEP(c) ((c) == '/') # define DIRSEPSTR "/" # define PATHSEPSTR ":" @@ -92,7 +92,7 @@ --- a/erts/etc/unix/dyn_erl.c +++ b/erts/etc/unix/dyn_erl.c -@@ -150,8 +150,8 @@ +@@ -149,8 +149,8 @@ static char * find_prog(char *origpath) { @@ -103,7 +103,7 @@ strcpy(relpath, origpath); -@@ -162,7 +162,7 @@ +@@ -161,7 +161,7 @@ envpath = get_env("PATH"); if (envpath) { /* Try to find the executable in the path */ @@ -112,7 +112,7 @@ char *beg = envpath; char *end; int sz; -@@ -276,7 +276,7 @@ +@@ -275,7 +275,7 @@ /* List install dir and look for latest erts-vsn */ DIR *dp; /* Pointer to directory structure. */ struct dirent* dirp; /* Pointer to directory entry. */ @@ -121,7 +121,7 @@ dp = opendir(erl_top); if (dp == NULL) { -@@ -316,7 +316,7 @@ +@@ -315,7 +315,7 @@ char *p; char *p2; @@ -130,7 +130,7 @@ strcpy(buffer, erlpath); -@@ -359,9 +359,9 @@ +@@ -358,9 +358,9 @@ char *p; char *abspath; char *bindir; /* Location of executables. */ diff -Nru erlang-18.2-dfsg/debian/patches/hppa.patch erlang-17.3-dfsg/debian/patches/hppa.patch --- erlang-18.2-dfsg/debian/patches/hppa.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/hppa.patch 2014-12-01 04:10:57.000000000 +0000 @@ -8,7 +8,7 @@ --- a/erts/configure.in +++ b/erts/configure.in -@@ -2184,6 +2184,14 @@ +@@ -2160,6 +2160,14 @@ AC_CHECK_DECLS([posix2time, time2posix],,,[#include ]) disable_vfork=false diff -Nru erlang-18.2-dfsg/debian/patches/java.patch erlang-17.3-dfsg/debian/patches/java.patch --- erlang-18.2-dfsg/debian/patches/java.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/java.patch 2014-12-01 04:10:57.000000000 +0000 @@ -8,19 +8,19 @@ --- a/erts/configure.in +++ b/erts/configure.in -@@ -4761,7 +4761,8 @@ - dnl Make sure it's at least JDK 1.6 - AC_CACHE_CHECK(for JDK version 1.6, - ac_cv_prog_javac_ver_1_6, +@@ -4682,7 +4682,8 @@ + dnl Make sure it's at least JDK 1.5 + AC_CACHE_CHECK(for JDK version 1.5, + ac_cv_prog_javac_ver_1_5, - [ERL_TRY_LINK_JAVA([], [for (String i : args);], + [ERL_TRY_LINK_JAVA([], [for (String i : args); + int[] values = {}; String s = new String(values, 0, values.length);], - ac_cv_prog_javac_ver_1_6=yes, ac_cv_prog_javac_ver_1_6=no)]) - if test $ac_cv_prog_javac_ver_1_6 = no; then + ac_cv_prog_javac_ver_1_5=yes, ac_cv_prog_javac_ver_1_5=no)]) + if test $ac_cv_prog_javac_ver_1_5 = no; then unset -v JAVAC --- a/lib/test_server/src/configure.in +++ b/lib/test_server/src/configure.in -@@ -485,7 +485,8 @@ +@@ -468,7 +468,8 @@ dnl Make sure it's at least JDK 1.5 AC_CACHE_CHECK(for JDK version 1.5, ac_cv_prog_javac_ver_1_5, diff -Nru erlang-18.2-dfsg/debian/patches/javascript.patch erlang-17.3-dfsg/debian/patches/javascript.patch --- erlang-18.2-dfsg/debian/patches/javascript.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/javascript.patch 2014-12-01 04:10:57.000000000 +0000 @@ -1,6 +1,6 @@ --- a/lib/common_test/priv/Makefile.in +++ b/lib/common_test/priv/Makefile.in -@@ -61,7 +61,7 @@ +@@ -60,7 +60,7 @@ SCRIPTS = IMAGES = tile1.jpg CSS = ct_default.css diff -Nru erlang-18.2-dfsg/debian/patches/man.patch erlang-17.3-dfsg/debian/patches/man.patch --- erlang-18.2-dfsg/debian/patches/man.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/man.patch 2014-12-01 04:10:57.000000000 +0000 @@ -6,7 +6,7 @@ --- a/erts/etc/common/erlexec.c +++ b/erts/etc/common/erlexec.c -@@ -728,8 +728,10 @@ +@@ -722,8 +722,10 @@ error("-man not supported on Windows"); #else argv[i] = "man"; diff -Nru erlang-18.2-dfsg/debian/patches/reproducible-build.patch erlang-17.3-dfsg/debian/patches/reproducible-build.patch --- erlang-18.2-dfsg/debian/patches/reproducible-build.patch 2015-08-17 11:40:29.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/reproducible-build.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -Author: Chris Lamb -Description: Patch makes erlang compiler honor the SOURCE_DATE_EPOCH - environment variable and use its value in build results instead of the - current timestamp. The goal is to maintain reproducible builds. More info: - https://wiki.debian.org/ReproducibleBuilds -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=795834 -Last-modified: Mon, 17 Aug 2015 14:32:15 +0300 - ---- a/lib/compiler/src/beam_asm.erl -+++ b/lib/compiler/src/beam_asm.erl -@@ -226,7 +226,11 @@ - build_attributes(Opts, SourceFile, Attr, MD5) -> - Misc = case member(slim, Opts) of - false -> -- {{Y,Mo,D},{H,Mi,S}} = erlang:universaltime(), -+ {{Y,Mo,D},{H,Mi,S}} = case string:to_integer(os:getenv("SOURCE_DATE_EPOCH")) of -+ {N,[]} ->calendar:gregorian_seconds_to_datetime(N + -+ calendar:datetime_to_gregorian_seconds({{1970,1,1},{0,0,0}})); -+ {_,_} -> erlang:universaltime() -+ end, - [{time,{Y,Mo,D,H,Mi,S}},{source,SourceFile}]; - true -> [] - end, diff -Nru erlang-18.2-dfsg/debian/patches/rpath.patch erlang-17.3-dfsg/debian/patches/rpath.patch --- erlang-18.2-dfsg/debian/patches/rpath.patch 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/rpath.patch 2014-12-01 04:10:57.000000000 +0000 @@ -0,0 +1,21 @@ +Author: Sergei Golovan +Description: A quick hack which removes rpath from crypto and ssl applications binaries to + satisfy Debian policy. +Forwarded: no +Last-modified:Sat, 27 Feb 2010 09:34:43 +0300 + +--- a/erts/configure.in ++++ b/erts/configure.in +@@ -4540,9 +4540,9 @@ + SSL_CC_RUNTIME_LIBRARY_PATH= + SSL_LD_RUNTIME_LIBRARY_PATH= + SSL_DED_LD_RUNTIME_LIBRARY_PATH= +-cc_rflg="$CFLAG_RUNTIME_LIBRARY_PATH" +-ld_rflg="$LDFLAG_RUNTIME_LIBRARY_PATH" +-ded_ld_rflg="$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" ++cc_rflg= ++ld_rflg= ++ded_ld_rflg= + + if test "$SSL_APP" != "" && test "$SSL_DYNAMIC_ONLY" = "yes" && \ + { test "$cc_rflg" != "" || test "$ld_rflg" != "" || test "$ded_ld_rflg" != ""; } ; then diff -Nru erlang-18.2-dfsg/debian/patches/series erlang-17.3-dfsg/debian/patches/series --- erlang-18.2-dfsg/debian/patches/series 2016-01-14 12:32:56.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/series 2014-12-05 11:16:15.000000000 +0000 @@ -1,4 +1,5 @@ clean.patch +rpath.patch gnu.patch sparc.patch man.patch @@ -7,12 +8,9 @@ java.patch hppa.patch javascript.patch +ssl.patch wx3.0-constants.patch -beamload.patch -reproducible-build.patch -gethostbyname.patch -x32.patch - +sslv3disable.patch # Ubuntu patches fix-pointer-converstion.patch bytecode-compat.patch diff -Nru erlang-18.2-dfsg/debian/patches/sparc.patch erlang-17.3-dfsg/debian/patches/sparc.patch --- erlang-18.2-dfsg/debian/patches/sparc.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/sparc.patch 2014-12-01 04:10:57.000000000 +0000 @@ -7,7 +7,7 @@ --- a/erts/configure.in +++ b/erts/configure.in -@@ -645,7 +645,7 @@ +@@ -662,7 +662,7 @@ fi case $chk_arch_ in @@ -18,7 +18,7 @@ i86pc) ARCH=x86;; --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c -@@ -997,16 +997,6 @@ +@@ -989,16 +989,6 @@ * in registers. */ @@ -35,7 +35,7 @@ # define REG_x0 # define REG_xregs # define REG_htop -@@ -1015,7 +1005,6 @@ +@@ -1007,7 +997,6 @@ # define REG_fcalls # define REG_tmp_arg1 # define REG_tmp_arg2 diff -Nru erlang-18.2-dfsg/debian/patches/ssl.patch erlang-17.3-dfsg/debian/patches/ssl.patch --- erlang-18.2-dfsg/debian/patches/ssl.patch 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/ssl.patch 2014-09-27 15:06:21.000000000 +0000 @@ -0,0 +1,13 @@ +--- a/lib/ssl/src/ssl_handshake.erl ++++ b/lib/ssl/src/ssl_handshake.erl +@@ -1732,6 +1732,10 @@ + #ec_point_formats{ec_point_format_list = + ECPointFormats}}); + ++dec_hello_extensions(<>, Acc) when Len == 0 -> ++ dec_hello_extensions(Rest, Acc#hello_extensions{sni = ""}); %% Server may send an empy SNI ++ ++ + dec_hello_extensions(<>, Acc) -> + <> = ExtData, diff -Nru erlang-18.2-dfsg/debian/patches/sslv3disable.patch erlang-17.3-dfsg/debian/patches/sslv3disable.patch --- erlang-18.2-dfsg/debian/patches/sslv3disable.patch 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/sslv3disable.patch 2014-11-30 19:38:28.000000000 +0000 @@ -0,0 +1,90 @@ +Description: Patch removes support for SSLv3 protocol because it is proved to + be insecure and nobody should use it anymore. +Author Sergei Golovan +Bug-Debian: https://bugs.debian.org/771359 +Last-Update: Sun, 30 Nov 2014 20:20:41 +0300 + +--- a/lib/ssl/doc/src/ssl_app.xml ++++ b/lib/ssl/doc/src/ssl_app.xml +@@ -47,10 +47,10 @@ +

+

Note that the environment parameters can be set on the command line, + for instance,

+-

erl ... -ssl protocol_version '[sslv3, tlsv1]' .... ++

erl ... -ssl protocol_version '[tlsv1.1, tlsv1]' .... +

+ +- ]]>. ++ ]]>. + +

Protocol that will be supported by started clients and + servers. If this option is not set it will default to all +@@ -58,6 +58,9 @@ + Note that this option may be overridden by the version option + to ssl:connect/[2,3] and ssl:listen/2. +

++

For Debian GNU/Linux distribution the sslv3 protocol was ++ disabled due to its security issues. ++

+
+ + ]]> +--- a/lib/ssl/doc/src/ssl.xml ++++ b/lib/ssl/doc/src/ssl.xml +@@ -123,7 +123,7 @@ + +

sslsocket() - opaque to the user.

+ +-

protocol() = sslv3 | tlsv1 | 'tlsv1.1' | 'tlsv1.2'

++

protocol() = tlsv1 | 'tlsv1.1' | 'tlsv1.2'

+ +

ciphers() = [ciphersuite()] | string() (according to old API)

+ +--- a/lib/ssl/src/ssl_internal.hrl ++++ b/lib/ssl/src/ssl_internal.hrl +@@ -64,8 +64,8 @@ + -define(TRUE, 0). + -define(FALSE, 1). + +--define(ALL_SUPPORTED_VERSIONS, ['tlsv1.2', 'tlsv1.1', tlsv1, sslv3]). +--define(MIN_SUPPORTED_VERSIONS, ['tlsv1.1', tlsv1, sslv3]). ++-define(ALL_SUPPORTED_VERSIONS, ['tlsv1.2', 'tlsv1.1', tlsv1]). ++-define(MIN_SUPPORTED_VERSIONS, ['tlsv1.1', tlsv1]). + -define(ALL_DATAGRAM_SUPPORTED_VERSIONS, ['dtlsv1.2', dtlsv1]). + -define(MIN_DATAGRAM_SUPPORTED_VERSIONS, ['dtlsv1.2', dtlsv1]). + +--- a/lib/ssl/src/ssl_record.hrl ++++ b/lib/ssl/src/ssl_record.hrl +@@ -144,6 +144,7 @@ + %% }). + + -define(LOWEST_MAJOR_SUPPORTED_VERSION, 3). ++-define(LOWEST_MINOR_SUPPORTED_VERSION, 1). + + + -record(generic_stream_cipher, { +--- a/lib/ssl/src/tls_record.erl ++++ b/lib/ssl/src/tls_record.erl +@@ -276,14 +276,20 @@ + %%-------------------------------------------------------------------- + -spec is_acceptable_version(tls_version()) -> boolean(). + is_acceptable_version({N,_}) +- when N >= ?LOWEST_MAJOR_SUPPORTED_VERSION -> ++ when N > ?LOWEST_MAJOR_SUPPORTED_VERSION -> ++ true; ++is_acceptable_version({N,M}) ++ when N == ?LOWEST_MAJOR_SUPPORTED_VERSION andalso M >= ?LOWEST_MINOR_SUPPORTED_VERSION -> + true; + is_acceptable_version(_) -> + false. + + -spec is_acceptable_version(tls_version(), Supported :: [tls_version()]) -> boolean(). + is_acceptable_version({N,_} = Version, Versions) +- when N >= ?LOWEST_MAJOR_SUPPORTED_VERSION -> ++ when N > ?LOWEST_MAJOR_SUPPORTED_VERSION -> ++ lists:member(Version, Versions); ++is_acceptable_version({N,M} = Version, Versions) ++ when N == ?LOWEST_MAJOR_SUPPORTED_VERSION andalso M >= ?LOWEST_MINOR_SUPPORTED_VERSION -> + lists:member(Version, Versions); + is_acceptable_version(_,_) -> + false. diff -Nru erlang-18.2-dfsg/debian/patches/wx3.0-constants.patch erlang-17.3-dfsg/debian/patches/wx3.0-constants.patch --- erlang-18.2-dfsg/debian/patches/wx3.0-constants.patch 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/wx3.0-constants.patch 2014-11-30 19:38:28.000000000 +0000 @@ -8,7 +8,7 @@ --- a/lib/wx/include/wx.hrl +++ b/lib/wx/include/wx.hrl -@@ -771,7 +771,7 @@ +@@ -744,7 +744,7 @@ % From "checkbox.h" -define(wxCHK_ALLOW_3RD_STATE_FOR_USER, 8192). -define(wxCHK_3STATE, 4096). @@ -17,7 +17,7 @@ % From "checkbox.h": wxCheckBoxState -define(wxCHK_UNCHECKED, 0). -define(wxCHK_CHECKED, 1). -@@ -1018,10 +1018,10 @@ +@@ -991,10 +991,10 @@ -define(wxSIZE_AUTO_WIDTH, 1). -define(wxSETUP, 131072). -define(wxMORE, 65536). @@ -32,7 +32,7 @@ -define(wxICON_MASK, (16#00000100 bor 16#00000200 bor 16#00000400 bor 16#00000800)). -define(wxICON_ASTERISK, ?wxICON_INFORMATION). -define(wxICON_STOP, ?wxICON_HAND). -@@ -1053,8 +1053,8 @@ +@@ -1026,8 +1026,8 @@ -define(wxTC_TOP, 0). -define(wxTC_FIXEDWIDTH, 32). -define(wxTC_RIGHTJUSTIFY, 16). @@ -43,7 +43,7 @@ -define(wxSP_VERTICAL, ?wxVERTICAL). -define(wxSP_HORIZONTAL, ?wxHORIZONTAL). -define(wxSB_VERTICAL, ?wxVERTICAL). -@@ -1075,8 +1075,8 @@ +@@ -1048,8 +1048,8 @@ -define(wxCB_SIMPLE, 4). -define(wxLB_INT_HEIGHT, 2048). -define(wxLB_HSCROLL, ?wxHSCROLL). @@ -54,7 +54,7 @@ -define(wxLB_OWNERDRAW, 256). -define(wxLB_EXTENDED, 128). -define(wxLB_MULTIPLE, 64). -@@ -1552,7 +1552,7 @@ +@@ -1525,7 +1525,7 @@ -define(wxUPDATE_UI_FROMIDLE, 2). % From "dialog.h" -define(wxDEFAULT_DIALOG_STYLE, (?wxCAPTION bor ?wxSYSTEM_MENU bor ?wxCLOSE_BOX)). @@ -63,7 +63,425 @@ % From "dirctrlg.h" -define(wxDIRCTRL_DIR_ONLY, 16). -define(wxDIRCTRL_SELECT_FIRST, 32). -@@ -3732,7 +3732,7 @@ +@@ -2013,212 +2013,212 @@ + -define(wxLANGUAGE_ARABIC_YEMEN, 24). + -define(wxLANGUAGE_ARMENIAN, 25). + -define(wxLANGUAGE_ASSAMESE, 26). +--define(wxLANGUAGE_AYMARA, 27). +--define(wxLANGUAGE_AZERI, 28). +--define(wxLANGUAGE_AZERI_CYRILLIC, 29). +--define(wxLANGUAGE_AZERI_LATIN, 30). +--define(wxLANGUAGE_BASHKIR, 31). +--define(wxLANGUAGE_BASQUE, 32). +--define(wxLANGUAGE_BELARUSIAN, 33). +--define(wxLANGUAGE_BENGALI, 34). +--define(wxLANGUAGE_BHUTANI, 35). +--define(wxLANGUAGE_BIHARI, 36). +--define(wxLANGUAGE_BISLAMA, 37). +--define(wxLANGUAGE_BRETON, 38). +--define(wxLANGUAGE_BULGARIAN, 39). +--define(wxLANGUAGE_BURMESE, 40). +--define(wxLANGUAGE_CAMBODIAN, 41). +--define(wxLANGUAGE_CATALAN, 42). +--define(wxLANGUAGE_CHINESE, 43). +--define(wxLANGUAGE_CHINESE_SIMPLIFIED, 44). +--define(wxLANGUAGE_CHINESE_TRADITIONAL, 45). +--define(wxLANGUAGE_CHINESE_HONGKONG, 46). +--define(wxLANGUAGE_CHINESE_MACAU, 47). +--define(wxLANGUAGE_CHINESE_SINGAPORE, 48). +--define(wxLANGUAGE_CHINESE_TAIWAN, 49). +--define(wxLANGUAGE_CORSICAN, 50). +--define(wxLANGUAGE_CROATIAN, 51). +--define(wxLANGUAGE_CZECH, 52). +--define(wxLANGUAGE_DANISH, 53). +--define(wxLANGUAGE_DUTCH, 54). +--define(wxLANGUAGE_DUTCH_BELGIAN, 55). +--define(wxLANGUAGE_ENGLISH, 56). +--define(wxLANGUAGE_ENGLISH_UK, 57). +--define(wxLANGUAGE_ENGLISH_US, 58). +--define(wxLANGUAGE_ENGLISH_AUSTRALIA, 59). +--define(wxLANGUAGE_ENGLISH_BELIZE, 60). +--define(wxLANGUAGE_ENGLISH_BOTSWANA, 61). +--define(wxLANGUAGE_ENGLISH_CANADA, 62). +--define(wxLANGUAGE_ENGLISH_CARIBBEAN, 63). +--define(wxLANGUAGE_ENGLISH_DENMARK, 64). +--define(wxLANGUAGE_ENGLISH_EIRE, 65). +--define(wxLANGUAGE_ENGLISH_JAMAICA, 66). +--define(wxLANGUAGE_ENGLISH_NEW_ZEALAND, 67). +--define(wxLANGUAGE_ENGLISH_PHILIPPINES, 68). +--define(wxLANGUAGE_ENGLISH_SOUTH_AFRICA, 69). +--define(wxLANGUAGE_ENGLISH_TRINIDAD, 70). +--define(wxLANGUAGE_ENGLISH_ZIMBABWE, 71). +--define(wxLANGUAGE_ESPERANTO, 72). +--define(wxLANGUAGE_ESTONIAN, 73). +--define(wxLANGUAGE_FAEROESE, 74). +--define(wxLANGUAGE_FARSI, 75). +--define(wxLANGUAGE_FIJI, 76). +--define(wxLANGUAGE_FINNISH, 77). +--define(wxLANGUAGE_FRENCH, 78). +--define(wxLANGUAGE_FRENCH_BELGIAN, 79). +--define(wxLANGUAGE_FRENCH_CANADIAN, 80). +--define(wxLANGUAGE_FRENCH_LUXEMBOURG, 81). +--define(wxLANGUAGE_FRENCH_MONACO, 82). +--define(wxLANGUAGE_FRENCH_SWISS, 83). +--define(wxLANGUAGE_FRISIAN, 84). +--define(wxLANGUAGE_GALICIAN, 85). +--define(wxLANGUAGE_GEORGIAN, 86). +--define(wxLANGUAGE_GERMAN, 87). +--define(wxLANGUAGE_GERMAN_AUSTRIAN, 88). +--define(wxLANGUAGE_GERMAN_BELGIUM, 89). +--define(wxLANGUAGE_GERMAN_LIECHTENSTEIN, 90). +--define(wxLANGUAGE_GERMAN_LUXEMBOURG, 91). +--define(wxLANGUAGE_GERMAN_SWISS, 92). +--define(wxLANGUAGE_GREEK, 93). +--define(wxLANGUAGE_GREENLANDIC, 94). +--define(wxLANGUAGE_GUARANI, 95). +--define(wxLANGUAGE_GUJARATI, 96). +--define(wxLANGUAGE_HAUSA, 97). +--define(wxLANGUAGE_HEBREW, 98). +--define(wxLANGUAGE_HINDI, 99). +--define(wxLANGUAGE_HUNGARIAN, 100). +--define(wxLANGUAGE_ICELANDIC, 101). +--define(wxLANGUAGE_INDONESIAN, 102). +--define(wxLANGUAGE_INTERLINGUA, 103). +--define(wxLANGUAGE_INTERLINGUE, 104). +--define(wxLANGUAGE_INUKTITUT, 105). +--define(wxLANGUAGE_INUPIAK, 106). +--define(wxLANGUAGE_IRISH, 107). +--define(wxLANGUAGE_ITALIAN, 108). +--define(wxLANGUAGE_ITALIAN_SWISS, 109). +--define(wxLANGUAGE_JAPANESE, 110). +--define(wxLANGUAGE_JAVANESE, 111). +--define(wxLANGUAGE_KANNADA, 112). +--define(wxLANGUAGE_KASHMIRI, 113). +--define(wxLANGUAGE_KASHMIRI_INDIA, 114). +--define(wxLANGUAGE_KAZAKH, 115). +--define(wxLANGUAGE_KERNEWEK, 116). +--define(wxLANGUAGE_KINYARWANDA, 117). +--define(wxLANGUAGE_KIRGHIZ, 118). +--define(wxLANGUAGE_KIRUNDI, 119). +--define(wxLANGUAGE_KONKANI, 120). +--define(wxLANGUAGE_KOREAN, 121). +--define(wxLANGUAGE_KURDISH, 122). +--define(wxLANGUAGE_LAOTHIAN, 123). +--define(wxLANGUAGE_LATIN, 124). +--define(wxLANGUAGE_LATVIAN, 125). +--define(wxLANGUAGE_LINGALA, 126). +--define(wxLANGUAGE_LITHUANIAN, 127). +--define(wxLANGUAGE_MACEDONIAN, 128). +--define(wxLANGUAGE_MALAGASY, 129). +--define(wxLANGUAGE_MALAY, 130). +--define(wxLANGUAGE_MALAYALAM, 131). +--define(wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, 132). +--define(wxLANGUAGE_MALAY_MALAYSIA, 133). +--define(wxLANGUAGE_MALTESE, 134). +--define(wxLANGUAGE_MANIPURI, 135). +--define(wxLANGUAGE_MAORI, 136). +--define(wxLANGUAGE_MARATHI, 137). +--define(wxLANGUAGE_MOLDAVIAN, 138). +--define(wxLANGUAGE_MONGOLIAN, 139). +--define(wxLANGUAGE_NAURU, 140). +--define(wxLANGUAGE_NEPALI, 141). +--define(wxLANGUAGE_NEPALI_INDIA, 142). +--define(wxLANGUAGE_NORWEGIAN_BOKMAL, 143). +--define(wxLANGUAGE_NORWEGIAN_NYNORSK, 144). +--define(wxLANGUAGE_OCCITAN, 145). +--define(wxLANGUAGE_ORIYA, 146). +--define(wxLANGUAGE_OROMO, 147). +--define(wxLANGUAGE_PASHTO, 148). +--define(wxLANGUAGE_POLISH, 149). +--define(wxLANGUAGE_PORTUGUESE, 150). +--define(wxLANGUAGE_PORTUGUESE_BRAZILIAN, 151). +--define(wxLANGUAGE_PUNJABI, 152). +--define(wxLANGUAGE_QUECHUA, 153). +--define(wxLANGUAGE_RHAETO_ROMANCE, 154). +--define(wxLANGUAGE_ROMANIAN, 155). +--define(wxLANGUAGE_RUSSIAN, 156). +--define(wxLANGUAGE_RUSSIAN_UKRAINE, 157). +--define(wxLANGUAGE_SAMOAN, 158). +--define(wxLANGUAGE_SANGHO, 159). +--define(wxLANGUAGE_SANSKRIT, 160). +--define(wxLANGUAGE_SCOTS_GAELIC, 161). +--define(wxLANGUAGE_SERBIAN, 162). +--define(wxLANGUAGE_SERBIAN_CYRILLIC, 163). +--define(wxLANGUAGE_SERBIAN_LATIN, 164). +--define(wxLANGUAGE_SERBO_CROATIAN, 165). +--define(wxLANGUAGE_SESOTHO, 166). +--define(wxLANGUAGE_SETSWANA, 167). +--define(wxLANGUAGE_SHONA, 168). +--define(wxLANGUAGE_SINDHI, 169). +--define(wxLANGUAGE_SINHALESE, 170). +--define(wxLANGUAGE_SISWATI, 171). +--define(wxLANGUAGE_SLOVAK, 172). +--define(wxLANGUAGE_SLOVENIAN, 173). +--define(wxLANGUAGE_SOMALI, 174). +--define(wxLANGUAGE_SPANISH, 175). +--define(wxLANGUAGE_SPANISH_ARGENTINA, 176). +--define(wxLANGUAGE_SPANISH_BOLIVIA, 177). +--define(wxLANGUAGE_SPANISH_CHILE, 178). +--define(wxLANGUAGE_SPANISH_COLOMBIA, 179). +--define(wxLANGUAGE_SPANISH_COSTA_RICA, 180). +--define(wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, 181). +--define(wxLANGUAGE_SPANISH_ECUADOR, 182). +--define(wxLANGUAGE_SPANISH_EL_SALVADOR, 183). +--define(wxLANGUAGE_SPANISH_GUATEMALA, 184). +--define(wxLANGUAGE_SPANISH_HONDURAS, 185). +--define(wxLANGUAGE_SPANISH_MEXICAN, 186). +--define(wxLANGUAGE_SPANISH_MODERN, 187). +--define(wxLANGUAGE_SPANISH_NICARAGUA, 188). +--define(wxLANGUAGE_SPANISH_PANAMA, 189). +--define(wxLANGUAGE_SPANISH_PARAGUAY, 190). +--define(wxLANGUAGE_SPANISH_PERU, 191). +--define(wxLANGUAGE_SPANISH_PUERTO_RICO, 192). +--define(wxLANGUAGE_SPANISH_URUGUAY, 193). +--define(wxLANGUAGE_SPANISH_US, 194). +--define(wxLANGUAGE_SPANISH_VENEZUELA, 195). +--define(wxLANGUAGE_SUNDANESE, 196). +--define(wxLANGUAGE_SWAHILI, 197). +--define(wxLANGUAGE_SWEDISH, 198). +--define(wxLANGUAGE_SWEDISH_FINLAND, 199). +--define(wxLANGUAGE_TAGALOG, 200). +--define(wxLANGUAGE_TAJIK, 201). +--define(wxLANGUAGE_TAMIL, 202). +--define(wxLANGUAGE_TATAR, 203). +--define(wxLANGUAGE_TELUGU, 204). +--define(wxLANGUAGE_THAI, 205). +--define(wxLANGUAGE_TIBETAN, 206). +--define(wxLANGUAGE_TIGRINYA, 207). +--define(wxLANGUAGE_TONGA, 208). +--define(wxLANGUAGE_TSONGA, 209). +--define(wxLANGUAGE_TURKISH, 210). +--define(wxLANGUAGE_TURKMEN, 211). +--define(wxLANGUAGE_TWI, 212). +--define(wxLANGUAGE_UIGHUR, 213). +--define(wxLANGUAGE_UKRAINIAN, 214). +--define(wxLANGUAGE_URDU, 215). +--define(wxLANGUAGE_URDU_INDIA, 216). +--define(wxLANGUAGE_URDU_PAKISTAN, 217). +--define(wxLANGUAGE_UZBEK, 218). +--define(wxLANGUAGE_UZBEK_CYRILLIC, 219). +--define(wxLANGUAGE_UZBEK_LATIN, 220). +--define(wxLANGUAGE_VIETNAMESE, 221). +--define(wxLANGUAGE_VOLAPUK, 222). +--define(wxLANGUAGE_WELSH, 223). +--define(wxLANGUAGE_WOLOF, 224). +--define(wxLANGUAGE_XHOSA, 225). +--define(wxLANGUAGE_YIDDISH, 226). +--define(wxLANGUAGE_YORUBA, 227). +--define(wxLANGUAGE_ZHUANG, 228). +--define(wxLANGUAGE_ZULU, 229). ++-define(wxLANGUAGE_AYMARA, 28). ++-define(wxLANGUAGE_AZERI, 29). ++-define(wxLANGUAGE_AZERI_CYRILLIC, 30). ++-define(wxLANGUAGE_AZERI_LATIN, 31). ++-define(wxLANGUAGE_BASHKIR, 32). ++-define(wxLANGUAGE_BASQUE, 33). ++-define(wxLANGUAGE_BELARUSIAN, 34). ++-define(wxLANGUAGE_BENGALI, 35). ++-define(wxLANGUAGE_BHUTANI, 36). ++-define(wxLANGUAGE_BIHARI, 37). ++-define(wxLANGUAGE_BISLAMA, 38). ++-define(wxLANGUAGE_BRETON, 40). ++-define(wxLANGUAGE_BULGARIAN, 41). ++-define(wxLANGUAGE_BURMESE, 42). ++-define(wxLANGUAGE_CAMBODIAN, 43). ++-define(wxLANGUAGE_CATALAN, 44). ++-define(wxLANGUAGE_CHINESE, 45). ++-define(wxLANGUAGE_CHINESE_SIMPLIFIED, 46). ++-define(wxLANGUAGE_CHINESE_TRADITIONAL, 47). ++-define(wxLANGUAGE_CHINESE_HONGKONG, 48). ++-define(wxLANGUAGE_CHINESE_MACAU, 49). ++-define(wxLANGUAGE_CHINESE_SINGAPORE, 50). ++-define(wxLANGUAGE_CHINESE_TAIWAN, 51). ++-define(wxLANGUAGE_CORSICAN, 52). ++-define(wxLANGUAGE_CROATIAN, 53). ++-define(wxLANGUAGE_CZECH, 54). ++-define(wxLANGUAGE_DANISH, 55). ++-define(wxLANGUAGE_DUTCH, 56). ++-define(wxLANGUAGE_DUTCH_BELGIAN, 57). ++-define(wxLANGUAGE_ENGLISH, 58). ++-define(wxLANGUAGE_ENGLISH_UK, 59). ++-define(wxLANGUAGE_ENGLISH_US, 60). ++-define(wxLANGUAGE_ENGLISH_AUSTRALIA, 61). ++-define(wxLANGUAGE_ENGLISH_BELIZE, 62). ++-define(wxLANGUAGE_ENGLISH_BOTSWANA, 63). ++-define(wxLANGUAGE_ENGLISH_CANADA, 64). ++-define(wxLANGUAGE_ENGLISH_CARIBBEAN, 65). ++-define(wxLANGUAGE_ENGLISH_DENMARK, 66). ++-define(wxLANGUAGE_ENGLISH_EIRE, 67). ++-define(wxLANGUAGE_ENGLISH_JAMAICA, 68). ++-define(wxLANGUAGE_ENGLISH_NEW_ZEALAND, 69). ++-define(wxLANGUAGE_ENGLISH_PHILIPPINES, 70). ++-define(wxLANGUAGE_ENGLISH_SOUTH_AFRICA, 71). ++-define(wxLANGUAGE_ENGLISH_TRINIDAD, 72). ++-define(wxLANGUAGE_ENGLISH_ZIMBABWE, 73). ++-define(wxLANGUAGE_ESPERANTO, 74). ++-define(wxLANGUAGE_ESTONIAN, 75). ++-define(wxLANGUAGE_FAEROESE, 76). ++-define(wxLANGUAGE_FARSI, 77). ++-define(wxLANGUAGE_FIJI, 78). ++-define(wxLANGUAGE_FINNISH, 79). ++-define(wxLANGUAGE_FRENCH, 80). ++-define(wxLANGUAGE_FRENCH_BELGIAN, 81). ++-define(wxLANGUAGE_FRENCH_CANADIAN, 82). ++-define(wxLANGUAGE_FRENCH_LUXEMBOURG, 83). ++-define(wxLANGUAGE_FRENCH_MONACO, 84). ++-define(wxLANGUAGE_FRENCH_SWISS, 85). ++-define(wxLANGUAGE_FRISIAN, 86). ++-define(wxLANGUAGE_GALICIAN, 87). ++-define(wxLANGUAGE_GEORGIAN, 88). ++-define(wxLANGUAGE_GERMAN, 89). ++-define(wxLANGUAGE_GERMAN_AUSTRIAN, 90). ++-define(wxLANGUAGE_GERMAN_BELGIUM, 91). ++-define(wxLANGUAGE_GERMAN_LIECHTENSTEIN, 92). ++-define(wxLANGUAGE_GERMAN_LUXEMBOURG, 93). ++-define(wxLANGUAGE_GERMAN_SWISS, 94). ++-define(wxLANGUAGE_GREEK, 95). ++-define(wxLANGUAGE_GREENLANDIC, 96). ++-define(wxLANGUAGE_GUARANI, 97). ++-define(wxLANGUAGE_GUJARATI, 98). ++-define(wxLANGUAGE_HAUSA, 99). ++-define(wxLANGUAGE_HEBREW, 100). ++-define(wxLANGUAGE_HINDI, 101). ++-define(wxLANGUAGE_HUNGARIAN, 102). ++-define(wxLANGUAGE_ICELANDIC, 103). ++-define(wxLANGUAGE_INDONESIAN, 104). ++-define(wxLANGUAGE_INTERLINGUA, 105). ++-define(wxLANGUAGE_INTERLINGUE, 106). ++-define(wxLANGUAGE_INUKTITUT, 107). ++-define(wxLANGUAGE_INUPIAK, 108). ++-define(wxLANGUAGE_IRISH, 109). ++-define(wxLANGUAGE_ITALIAN, 110). ++-define(wxLANGUAGE_ITALIAN_SWISS, 111). ++-define(wxLANGUAGE_JAPANESE, 112). ++-define(wxLANGUAGE_JAVANESE, 113). ++-define(wxLANGUAGE_KANNADA, 114). ++-define(wxLANGUAGE_KASHMIRI, 115). ++-define(wxLANGUAGE_KASHMIRI_INDIA, 116). ++-define(wxLANGUAGE_KAZAKH, 117). ++-define(wxLANGUAGE_KERNEWEK, 118). ++-define(wxLANGUAGE_KINYARWANDA, 119). ++-define(wxLANGUAGE_KIRGHIZ, 120). ++-define(wxLANGUAGE_KIRUNDI, 121). ++-define(wxLANGUAGE_KONKANI, 122). ++-define(wxLANGUAGE_KOREAN, 123). ++-define(wxLANGUAGE_KURDISH, 124). ++-define(wxLANGUAGE_LAOTHIAN, 125). ++-define(wxLANGUAGE_LATIN, 126). ++-define(wxLANGUAGE_LATVIAN, 127). ++-define(wxLANGUAGE_LINGALA, 128). ++-define(wxLANGUAGE_LITHUANIAN, 129). ++-define(wxLANGUAGE_MACEDONIAN, 130). ++-define(wxLANGUAGE_MALAGASY, 131). ++-define(wxLANGUAGE_MALAY, 132). ++-define(wxLANGUAGE_MALAYALAM, 133). ++-define(wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, 134). ++-define(wxLANGUAGE_MALAY_MALAYSIA, 135). ++-define(wxLANGUAGE_MALTESE, 136). ++-define(wxLANGUAGE_MANIPURI, 137). ++-define(wxLANGUAGE_MAORI, 138). ++-define(wxLANGUAGE_MARATHI, 139). ++-define(wxLANGUAGE_MOLDAVIAN, 140). ++-define(wxLANGUAGE_MONGOLIAN, 141). ++-define(wxLANGUAGE_NAURU, 142). ++-define(wxLANGUAGE_NEPALI, 143). ++-define(wxLANGUAGE_NEPALI_INDIA, 144). ++-define(wxLANGUAGE_NORWEGIAN_BOKMAL, 145). ++-define(wxLANGUAGE_NORWEGIAN_NYNORSK, 146). ++-define(wxLANGUAGE_OCCITAN, 147). ++-define(wxLANGUAGE_ORIYA, 148). ++-define(wxLANGUAGE_OROMO, 149). ++-define(wxLANGUAGE_PASHTO, 150). ++-define(wxLANGUAGE_POLISH, 151). ++-define(wxLANGUAGE_PORTUGUESE, 152). ++-define(wxLANGUAGE_PORTUGUESE_BRAZILIAN, 153). ++-define(wxLANGUAGE_PUNJABI, 154). ++-define(wxLANGUAGE_QUECHUA, 155). ++-define(wxLANGUAGE_RHAETO_ROMANCE, 156). ++-define(wxLANGUAGE_ROMANIAN, 157). ++-define(wxLANGUAGE_RUSSIAN, 158). ++-define(wxLANGUAGE_RUSSIAN_UKRAINE, 159). ++-define(wxLANGUAGE_SAMOAN, 161). ++-define(wxLANGUAGE_SANGHO, 162). ++-define(wxLANGUAGE_SANSKRIT, 163). ++-define(wxLANGUAGE_SCOTS_GAELIC, 164). ++-define(wxLANGUAGE_SERBIAN, 165). ++-define(wxLANGUAGE_SERBIAN_CYRILLIC, 166). ++-define(wxLANGUAGE_SERBIAN_LATIN, 167). ++-define(wxLANGUAGE_SERBO_CROATIAN, 168). ++-define(wxLANGUAGE_SESOTHO, 169). ++-define(wxLANGUAGE_SETSWANA, 170). ++-define(wxLANGUAGE_SHONA, 171). ++-define(wxLANGUAGE_SINDHI, 172). ++-define(wxLANGUAGE_SINHALESE, 173). ++-define(wxLANGUAGE_SISWATI, 174). ++-define(wxLANGUAGE_SLOVAK, 175). ++-define(wxLANGUAGE_SLOVENIAN, 176). ++-define(wxLANGUAGE_SOMALI, 177). ++-define(wxLANGUAGE_SPANISH, 178). ++-define(wxLANGUAGE_SPANISH_ARGENTINA, 179). ++-define(wxLANGUAGE_SPANISH_BOLIVIA, 180). ++-define(wxLANGUAGE_SPANISH_CHILE, 181). ++-define(wxLANGUAGE_SPANISH_COLOMBIA, 182). ++-define(wxLANGUAGE_SPANISH_COSTA_RICA, 183). ++-define(wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, 184). ++-define(wxLANGUAGE_SPANISH_ECUADOR, 185). ++-define(wxLANGUAGE_SPANISH_EL_SALVADOR, 186). ++-define(wxLANGUAGE_SPANISH_GUATEMALA, 187). ++-define(wxLANGUAGE_SPANISH_HONDURAS, 188). ++-define(wxLANGUAGE_SPANISH_MEXICAN, 189). ++-define(wxLANGUAGE_SPANISH_MODERN, 190). ++-define(wxLANGUAGE_SPANISH_NICARAGUA, 191). ++-define(wxLANGUAGE_SPANISH_PANAMA, 192). ++-define(wxLANGUAGE_SPANISH_PARAGUAY, 193). ++-define(wxLANGUAGE_SPANISH_PERU, 194). ++-define(wxLANGUAGE_SPANISH_PUERTO_RICO, 195). ++-define(wxLANGUAGE_SPANISH_URUGUAY, 196). ++-define(wxLANGUAGE_SPANISH_US, 197). ++-define(wxLANGUAGE_SPANISH_VENEZUELA, 198). ++-define(wxLANGUAGE_SUNDANESE, 199). ++-define(wxLANGUAGE_SWAHILI, 200). ++-define(wxLANGUAGE_SWEDISH, 201). ++-define(wxLANGUAGE_SWEDISH_FINLAND, 202). ++-define(wxLANGUAGE_TAGALOG, 203). ++-define(wxLANGUAGE_TAJIK, 204). ++-define(wxLANGUAGE_TAMIL, 205). ++-define(wxLANGUAGE_TATAR, 206). ++-define(wxLANGUAGE_TELUGU, 207). ++-define(wxLANGUAGE_THAI, 208). ++-define(wxLANGUAGE_TIBETAN, 209). ++-define(wxLANGUAGE_TIGRINYA, 210). ++-define(wxLANGUAGE_TONGA, 211). ++-define(wxLANGUAGE_TSONGA, 212). ++-define(wxLANGUAGE_TURKISH, 213). ++-define(wxLANGUAGE_TURKMEN, 214). ++-define(wxLANGUAGE_TWI, 215). ++-define(wxLANGUAGE_UIGHUR, 216). ++-define(wxLANGUAGE_UKRAINIAN, 217). ++-define(wxLANGUAGE_URDU, 218). ++-define(wxLANGUAGE_URDU_INDIA, 219). ++-define(wxLANGUAGE_URDU_PAKISTAN, 220). ++-define(wxLANGUAGE_UZBEK, 221). ++-define(wxLANGUAGE_UZBEK_CYRILLIC, 222). ++-define(wxLANGUAGE_UZBEK_LATIN, 223). ++-define(wxLANGUAGE_VIETNAMESE, 225). ++-define(wxLANGUAGE_VOLAPUK, 226). ++-define(wxLANGUAGE_WELSH, 227). ++-define(wxLANGUAGE_WOLOF, 228). ++-define(wxLANGUAGE_XHOSA, 229). ++-define(wxLANGUAGE_YIDDISH, 230). ++-define(wxLANGUAGE_YORUBA, 231). ++-define(wxLANGUAGE_ZHUANG, 232). ++-define(wxLANGUAGE_ZULU, 233). + -define(wxLANGUAGE_USER_DEFINED, 230). +--define(wxLANGUAGE_VALENCIAN, 536870911). +--define(wxLANGUAGE_SAMI, 536870912). ++-define(wxLANGUAGE_VALENCIAN, 224). ++-define(wxLANGUAGE_SAMI, 160). + % From "intl.h": wxLayoutDirection + -define(wxLayout_Default, 0). + -define(wxLayout_LeftToRight, 1). +@@ -3705,7 +3705,7 @@ -define(wxSTC_KEY_LEFT, 302). -define(wxSTC_KEY_UP, 301). -define(wxSTC_KEY_DOWN, 300). @@ -72,7 +490,7 @@ -define(wxSTC_MULTILINEUNDOREDO, 4096). -define(wxSTC_MOD_BEFOREDELETE, 2048). -define(wxSTC_MOD_BEFOREINSERT, 1024). -@@ -3814,7 +3814,7 @@ +@@ -3787,7 +3787,7 @@ -define(wxSTC_INDIC_TT, 2). -define(wxSTC_INDIC_SQUIGGLE, 1). -define(wxSTC_INDIC_PLAIN, 0). @@ -81,7 +499,7 @@ -define(wxSTC_CASE_LOWER, 2). -define(wxSTC_CASE_UPPER, 1). -define(wxSTC_CASE_MIXED, 0). -@@ -3839,7 +3839,7 @@ +@@ -3812,7 +3812,7 @@ -define(wxSTC_CHARSET_BALTIC, 186). -define(wxSTC_CHARSET_DEFAULT, 1). -define(wxSTC_CHARSET_ANSI, 0). @@ -90,7 +508,7 @@ -define(wxSTC_STYLE_LASTPREDEFINED, 39). -define(wxSTC_STYLE_CALLTIP, 38). -define(wxSTC_STYLE_INDENTGUIDE, 37). -@@ -3938,9 +3938,9 @@ +@@ -3911,9 +3911,9 @@ -define(wxTE_PROCESS_TAB, 64). -define(wxTE_MULTILINE, 32). -define(wxTE_READONLY, 16). @@ -102,7 +520,7 @@ % From "textctrl.h": wxTextAttrAlignment -define(wxTEXT_ALIGNMENT_DEFAULT, 0). -define(wxTEXT_ALIGNMENT_LEFT, 1). -@@ -3990,7 +3990,7 @@ +@@ -3963,7 +3963,7 @@ -define(wxDEFAULT_FRAME_STYLE, (?wxSYSTEM_MENU bor ?wxRESIZE_BORDER bor ?wxMINIMIZE_BOX bor ?wxMAXIMIZE_BOX bor ?wxCLOSE_BOX bor ?wxCAPTION bor ?wxCLIP_CHILDREN)). -define(wxRESIZE_BORDER, 64). -define(wxTINY_CAPTION_VERT, 128). diff -Nru erlang-18.2-dfsg/debian/patches/x32.patch erlang-17.3-dfsg/debian/patches/x32.patch --- erlang-18.2-dfsg/debian/patches/x32.patch 2016-01-14 12:33:34.000000000 +0000 +++ erlang-17.3-dfsg/debian/patches/x32.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -Author: Sergei Golovan -Description: This (not yet thoroughly tested) patch fixes FTBFS for x86_x32 - architecture (x86_64 with 32-bit integers, longs and pointers). -Last-Modified: Sun, 27 Dec 2015 12:39:07 +0300 - ---- a/erts/lib_src/pthread/ethread.c -+++ b/erts/lib_src/pthread/ethread.c -@@ -195,13 +195,25 @@ ethr_x86_cpuid__(int *eax, int *ebx, int - * we have the cpuid instruction. - */ - __asm__ ("pushf\n\t" -+#if __x86_64__ || (__x86_64__ && __ILP32__) -+ "popq %%rax\n\t" -+#else /* i386 */ - "popl %%eax\n\t" -+#endif - "movl %%eax, %%ecx\n\t" - "xorl $0x200000, %%eax\n\t" -+#if __x86_64__ || (__x86_64__ && __ILP32__) -+ "pushq %%rax\n\t" -+#else /* i386 */ - "pushl %%eax\n\t" -+#endif - "popf\n\t" - "pushf\n\t" -+#if __x86_64__ || (__x86_64__ && __ILP32__) -+ "popq %%rax\n\t" -+#else /* i386 */ - "popl %%eax\n\t" -+#endif - "movl $0x0, %0\n\t" - "xorl %%ecx, %%eax\n\t" - "jz no_cpuid\n\t" -@@ -223,10 +235,19 @@ ethr_x86_cpuid__(int *eax, int *ebx, int - * B register explicitly (for some reason gcc doesn't provide this - * service to us). - */ -- __asm__ ("pushl %%ebx\n\t" -+ __asm__ ( -+#if __x86_64__ || (__x86_64__ && __ILP32__) -+ "pushq %%rbx\n\t" -+#else /* i386 */ -+ "pushl %%ebx\n\t" -+#endif - "cpuid\n\t" - "movl %%ebx, %1\n\t" -+#if __x86_64__ || (__x86_64__ && __ILP32__) -+ "popq %%rbx\n\t" -+#else /* i386 */ - "popl %%ebx\n\t" -+#endif - : "=a"(*eax), "=r"(*ebx), "=c"(*ecx), "=d"(*edx) - : "0"(*eax) - : "cc"); diff -Nru erlang-18.2-dfsg/debian/patterns/erlang-dev.patterns erlang-17.3-dfsg/debian/patterns/erlang-dev.patterns --- erlang-18.2-dfsg/debian/patterns/erlang-dev.patterns 2016-01-04 20:12:18.000000000 +0000 +++ erlang-17.3-dfsg/debian/patterns/erlang-dev.patterns 2014-12-01 04:10:57.000000000 +0000 @@ -12,7 +12,6 @@ ./usr/lib/erlang/lib/diameter-.*/include/ ./usr/lib/erlang/lib/edoc-.*/include/ ./usr/lib/erlang/lib/eldap-.*/include/ -./usr/lib/erlang/lib/erl_interface-.*/ebin/ ./usr/lib/erlang/lib/erl_interface-.*/include/ ./usr/lib/erlang/lib/erl_interface-.*/lib/ ./usr/lib/erlang/lib/et-.*/include/ diff -Nru erlang-18.2-dfsg/debian/rules erlang-17.3-dfsg/debian/rules --- erlang-18.2-dfsg/debian/rules 2016-01-04 20:12:17.000000000 +0000 +++ erlang-17.3-dfsg/debian/rules 2014-12-01 04:10:56.000000000 +0000 @@ -201,7 +201,6 @@ --enable-sctp \ $(CLOCK_GETTIME_OPT) \ --enable-dynamic-ssl-lib \ - --with-ssl-rpath=no \ --enable-ethread-pre-pentium4-compatibility \ --enable-shared-zlib \ --without-ssl-zlib @@ -234,7 +233,6 @@ --enable-sctp \ $(CLOCK_GETTIME_OPT) \ --enable-dynamic-ssl-lib \ - --with-ssl-rpath=no \ --enable-ethread-pre-pentium4-compatibility \ --enable-shared-zlib \ --without-ssl-zlib @@ -324,6 +322,9 @@ # touch manpages-stamp +# CC_R_FLAG and LD_R_FLAG are empty because Debian doesn't recommend +# RPATH definition in binaries +# CC_R_OPT is used in percept build-hipe: build-hipe-stamp build-hipe-stamp: configure-hipe-stamp dh_testdir @@ -512,7 +513,7 @@ binary: binary-indep binary-arch -REL=18.2 +REL=17.3 RELDIR=$(REL) DEB_REL=$(REL)-dfsg diff -Nru erlang-18.2-dfsg/EPLICENCE erlang-17.3-dfsg/EPLICENCE --- erlang-18.2-dfsg/EPLICENCE 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/EPLICENCE 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,286 @@ +ERLANG PUBLIC LICENSE +Version 1.1 + +1. Definitions. + +1.1. ``Contributor'' means each entity that creates or contributes to +the creation of Modifications. + +1.2. ``Contributor Version'' means the combination of the Original +Code, prior Modifications used by a Contributor, and the Modifications +made by that particular Contributor. + +1.3. ``Covered Code'' means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case +including portions thereof. + +1.4. ``Electronic Distribution Mechanism'' means a mechanism generally +accepted in the software development community for the electronic +transfer of data. + +1.5. ``Executable'' means Covered Code in any form other than Source +Code. + +1.6. ``Initial Developer'' means the individual or entity identified +as the Initial Developer in the Source Code notice required by Exhibit +A. + +1.7. ``Larger Work'' means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + +1.8. ``License'' means this document. + +1.9. ``Modifications'' means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + +A. Any addition to or deletion from the contents of a file containing + Original Code or previous Modifications. + +B. Any new file that contains any part of the Original Code or + previous Modifications. + +1.10. ``Original Code'' means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as +Original Code, and which, at the time of its release under this +License is not already Covered Code governed by this License. + +1.11. ``Source Code'' means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus +any associated interface definition files, scripts used to control +compilation and installation of an Executable, or a list of source +code differential comparisons against either the Original Code or +another well known, available Covered Code of the Contributor's +choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is +widely available for no charge. + +1.12. ``You'' means an individual or a legal entity exercising rights +under, and complying with all of the terms of, this License. For legal +entities,``You'' includes any entity which controls, is controlled by, +or is under common control with You. For purposes of this definition, +``control'' means (a) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (b) ownership of fifty percent (50%) or more of the +outstanding shares or beneficial ownership of such entity. + +2. Source Code License. + +2.1. The Initial Developer Grant. +The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property +claims: + +(a) to use, reproduce, modify, display, perform, sublicense and + distribute the Original Code (or portions thereof) with or without + Modifications, or as part of a Larger Work; and + +(b) under patents now or hereafter owned or controlled by Initial + Developer, to make, have made, use and sell (``Utilize'') the + Original Code (or portions thereof), but solely to the extent that + any such patent is reasonably necessary to enable You to Utilize + the Original Code (or portions thereof) and not to any greater + extent that may be necessary to Utilize further Modifications or + combinations. + +2.2. Contributor Grant. +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property +claims: + +(a) to use, reproduce, modify, display, perform, sublicense and + distribute the Modifications created by such Contributor (or + portions thereof) either on an unmodified basis, with other + Modifications, as Covered Code or as part of a Larger Work; and + +(b) under patents now or hereafter owned or controlled by Contributor, + to Utilize the Contributor Version (or portions thereof), but + solely to the extent that any such patent is reasonably necessary + to enable You to Utilize the Contributor Version (or portions + thereof), and not to any greater extent that may be necessary to + Utilize further Modifications or combinations. + +3. Distribution Obligations. + +3.1. Application of License. +The Modifications which You contribute are governed by the terms of +this License, including without limitation Section 2.2. The Source +Code version of Covered Code may be distributed only under the terms +of this License, and You must include a copy of this License with +every copy of the Source Code You distribute. You may not offer or +impose any terms on any Source Code version that alters or restricts +the applicable version of this License or the recipients' rights +hereunder. However, You may include an additional document offering +the additional rights described in Section 3.5. + +3.2. Availability of Source Code. +Any Modification which You contribute must be made available in Source +Code form under the terms of this License either on the same media as +an Executable version or via an accepted Electronic Distribution +Mechanism to anyone to whom you made an Executable version available; +and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it +initially became available, or at least six (6) months after a +subsequent version of that particular Modification has been made +available to such recipients. You are responsible for ensuring that +the Source Code version remains available even if the Electronic +Distribution Mechanism is maintained by a third party. + +3.3. Description of Modifications. +You must cause all Covered Code to which you contribute to contain a +file documenting the changes You made to create that Covered Code and +the date of any change. You must include a prominent statement that +the Modification is derived, directly or indirectly, from Original +Code provided by the Initial Developer and including the name of the +Initial Developer in (a) the Source Code, and (b) in any notice in an +Executable version or related documentation in which You describe the +origin or ownership of the Covered Code. + +3.4. Intellectual Property Matters + +(a) Third Party Claims. + If You have knowledge that a party claims an intellectual property + right in particular functionality or code (or its utilization + under this License), you must include a text file with the source + code distribution titled ``LEGAL'' which describes the claim and + the party making the claim in sufficient detail that a recipient + will know whom to contact. If you obtain such knowledge after You + make Your Modification available as described in Section 3.2, You + shall promptly modify the LEGAL file in all copies You make + available thereafter and shall take other steps (such as notifying + appropriate mailing lists or newsgroups) reasonably calculated to + inform those who received the Covered Code that new knowledge has + been obtained. + +(b) Contributor APIs. + If Your Modification is an application programming interface and + You own or control patents which are reasonably necessary to + implement that API, you must also include this information in the + LEGAL file. + +3.5. Required Notices. +You must duplicate the notice in Exhibit A in each file of the Source +Code, and this License in any documentation for the Source Code, where +You describe recipients' rights relating to Covered Code. If You +created one or more Modification(s), You may add your name as a +Contributor to the notice described in Exhibit A. If it is not +possible to put such notice in a particular Source Code file due to +its structure, then you must include such notice in a location (such +as a relevant directory file) where a user would be likely to look for +such a notice. You may choose to offer, and to charge a fee for, +warranty, support, indemnity or liability obligations to one or more +recipients of Covered Code. However, You may do so only on Your own +behalf, and not on behalf of the Initial Developer or any +Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, +and You hereby agree to indemnify the Initial Developer and every +Contributor for any liability incurred by the Initial Developer or +such Contributor as a result of warranty, support, indemnity or +liability terms You offer. + +3.6. Distribution of Executable Versions. +You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, +and if You include a notice stating that the Source Code version of +the Covered Code is available under the terms of this License, +including a description of how and where You have fulfilled the +obligations of Section 3.2. The notice must be conspicuously included +in any notice in an Executable version, related documentation or +collateral in which You describe recipients' rights relating to the +Covered Code. You may distribute the Executable version of Covered +Code under a license of Your choice, which may contain terms different +from this License, provided that You are in compliance with the terms +of this License and that the license for the Executable version does +not attempt to limit or alter the recipient's rights in the Source +Code version from the rights set forth in this License. If You +distribute the Executable version under a different license You must +make it absolutely clear that any terms which differ from this License +are offered by You alone, not by the Initial Developer or any +Contributor. You hereby agree to indemnify the Initial Developer and +every Contributor for any liability incurred by the Initial Developer +or such Contributor as a result of any such terms You offer. + +3.7. Larger Works. +You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger +Work as a single product. In such a case, You must make sure the +requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute +or regulation then You must: (a) comply with the terms of this License +to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL +file described in Section 3.4 and must be included with all +distributions of the Source Code. Except to the extent prohibited by +statute or regulation, such description must be sufficiently detailed +for a recipient of ordinary skill to be able to understand it. + +5. Application of this License. + +This License applies to code to which the Initial Developer has +attached the notice in Exhibit A, and to related Covered Code. + +6. CONNECTION TO MOZILLA PUBLIC LICENSE + +This Erlang License is a derivative work of the Mozilla Public +License, Version 1.0. It contains terms which differ from the Mozilla +Public License, Version 1.0. + +7. DISCLAIMER OF WARRANTY. + +COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF +DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR +NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF +THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE +IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER +CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART +OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER +EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. +This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure +such breach within 30 days of becoming aware of the breach. All +sublicenses to the Covered Code which are properly granted shall +survive any termination of this License. Provisions which, by their +nature, must remain in effect beyond the termination of this License +shall survive. + +9. DISCLAIMER OF LIABILITY +Any utilization of Covered Code shall not cause the Initial Developer +or any Contributor to be liable for any damages (neither direct nor +indirect). + +10. MISCELLANEOUS +This License represents the complete agreement concerning the subject +matter hereof. If any provision is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be construed by and in accordance with +the substantive laws of Sweden. Any dispute, controversy or claim +arising out of or relating to this License, or the breach, termination +or invalidity thereof, shall be subject to the exclusive jurisdiction +of Swedish courts, with the Stockholm City Court as the first +instance. + +EXHIBIT A. + +``The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved via the world wide web at http://www.erlang.org/. + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. + +The Initial Developer of the Original Code is Ericsson Utvecklings AB. +Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +AB. All Rights Reserved.'' diff -Nru erlang-18.2-dfsg/erl-build-tool-vars.sh erlang-17.3-dfsg/erl-build-tool-vars.sh --- erlang-18.2-dfsg/erl-build-tool-vars.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erl-build-tool-vars.sh 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/aclocal.m4 erlang-17.3-dfsg/erts/aclocal.m4 --- erlang-18.2-dfsg/erts/aclocal.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/aclocal.m4 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ dnl dnl %CopyrightBegin% dnl -dnl Copyright Ericsson AB 1998-2015. All Rights Reserved. +dnl Copyright Ericsson AB 1998-2013. All Rights Reserved. dnl -dnl Licensed under the Apache License, Version 2.0 (the "License"); -dnl you may not use this file except in compliance with the License. -dnl You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. +dnl +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. dnl dnl %CopyrightEnd% dnl @@ -61,6 +60,7 @@ dnl Cross compilation variables AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigaltstack, [have working sigaltstack(): yes|no (only used when cross compiling)]) @@ -142,18 +142,18 @@ AC_MSG_CHECKING(for mixed cygwin or msys and native VC++ environment) if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then - if test -x /usr/bin/msys-?.0.dll; then - CFLAGS="-O2" - MIXED_MSYS=yes - AC_MSG_RESULT([MSYS and VC]) - MIXED_MSYS_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" - elif test -x /usr/bin/cygpath; then + if test -x /usr/bin/cygpath; then CFLAGS="-O2" MIXED_CYGWIN=yes AC_MSG_RESULT([Cygwin and VC]) MIXED_CYGWIN_VC=yes CPPFLAGS="$CPPFLAGS -DERTS_MIXED_CYGWIN_VC" + elif test -x /usr/bin/msysinfo; then + CFLAGS="-O2" + MIXED_MSYS=yes + AC_MSG_RESULT([MSYS and VC]) + MIXED_MSYS_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" else AC_MSG_RESULT([undeterminable]) AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!) @@ -246,31 +246,31 @@ return 1; lbl2: return 2; -],ac_cv_prog_emu_cc="$CC",ac_cv_prog_emu_cc=no) +],ac_cv_prog_emu_cc=$CC,ac_cv_prog_emu_cc=no) -if test "$ac_cv_prog_emu_cc" = no; then +if test $ac_cv_prog_emu_cc = no; then for ac_progname in emu_cc.sh gcc-4.2 gcc; do IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_progname"; then - ac_cv_prog_emu_cc="$ac_dir/$ac_progname" + if test -f $ac_dir/$ac_progname; then + ac_cv_prog_emu_cc=$ac_dir/$ac_progname break fi done IFS="$ac_save_ifs" - if test "$ac_cv_prog_emu_cc" != no; then + if test $ac_cv_prog_emu_cc != no; then break fi done fi -if test "$ac_cv_prog_emu_cc" != no; then - save_CC="$CC" +if test $ac_cv_prog_emu_cc != no; then + save_CC=$CC save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS - CC="$ac_cv_prog_emu_cc" + CC=$ac_cv_prog_emu_cc CFLAGS="" CPPFLAGS="" AC_TRY_COMPILE([],[ @@ -291,17 +291,17 @@ return 1; lbl2: return 2; - ],ac_cv_prog_emu_cc="$CC",ac_cv_prog_emu_cc=no) + ],ac_cv_prog_emu_cc=$CC,ac_cv_prog_emu_cc=no) CC=$save_CC CFLAGS=$save_CFLAGS CPPFLAGS=$save_CPPFLAGS fi ]) -if test "$ac_cv_prog_emu_cc" = no; then +if test $ac_cv_prog_emu_cc = no; then AC_DEFINE(NO_JUMP_TABLE,[],[Defined if no found C compiler can handle jump tables]) - EMU_CC="$CC" + EMU_CC=$CC else - EMU_CC="$ac_cv_prog_emu_cc" + EMU_CC=$ac_cv_prog_emu_cc fi AC_SUBST(EMU_CC) ]) @@ -559,7 +559,7 @@ AC_DEFUN(LM_SYS_MULTICAST, [AC_CACHE_CHECK([for multicast support], ac_cv_sys_multicast_support, -[AC_EGREP_CPP(^yes$, +[AC_EGREP_CPP(yes, [#include #include #include @@ -724,250 +724,6 @@ ])# AC_C_DOUBLE_MIDDLE_ENDIAN -AC_DEFUN(ERL_MONOTONIC_CLOCK, -[ - if test "$3" = "yes"; then - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_BOOTTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_PRECISE" - else - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_UPTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_UPTIME_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_UPTIME_PRECISE" - fi - - case "$1" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_monotonic="$high_resolution_clock_gettime_monotonic" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_monotonic="$low_resolution_clock_gettime_monotonic" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_monotonic="$2" - ;; - *) - check_msg="custom " - prefer_resolution_clock_gettime_monotonic="$2" - ;; - esac - - AC_CACHE_CHECK([for clock_gettime(CLOCK_MONOTONIC_RAW, _)], erl_cv_clock_gettime_monotonic_raw, - [ - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_monotonic_raw=yes, - erl_cv_clock_gettime_monotonic_raw=no) - ]) - - AC_CACHE_CHECK([for clock_gettime() with ${check_msg}monotonic clock type], erl_cv_clock_gettime_monotonic_$1, - [ - for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_monotonic_$1=$clock_type, - erl_cv_clock_gettime_monotonic_$1=no) - test $erl_cv_clock_gettime_monotonic_$1 = no || break - done - ]) - - AC_CHECK_FUNCS([clock_getres clock_get_attributes gethrtime]) - - AC_CACHE_CHECK([for mach clock_get_time() with monotonic clock type], erl_cv_mach_clock_get_time_monotonic, - [ - AC_TRY_COMPILE([ -#include -#include - ], - [ - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - ], - erl_cv_mach_clock_get_time_monotonic=yes, - erl_cv_mach_clock_get_time_monotonic=no) - ]) - - erl_corrected_monotonic_clock=no - case $erl_cv_clock_gettime_monotonic_$1-$ac_cv_func_gethrtime-$erl_cv_mach_clock_get_time_monotonic-$host_os in - *-*-*-win32) - erl_monotonic_clock_func=WindowsAPI - ;; - CLOCK_*-*-*-linux*) - case $erl_cv_clock_gettime_monotonic_$1-$erl_cv_clock_gettime_monotonic_raw in - CLOCK_BOOTTIME-yes|CLOCK_MONOTONIC-yes) - erl_corrected_monotonic_clock=yes - ;; - *) - # We don't trust CLOCK_MONOTONIC to be NTP - # adjusted on linux systems that do not have - # CLOCK_MONOTONIC_RAW (although it seems to - # be...) - ;; - esac - erl_monotonic_clock_func=clock_gettime - ;; - no-no-no-linux*) - erl_monotonic_clock_func=times - ;; - CLOCK_*-*-*-*) - erl_monotonic_clock_func=clock_gettime - ;; - no-yes-*-*) - erl_monotonic_clock_func=gethrtime - ;; - no-no-yes-*) - erl_monotonic_clock_func=mach_clock_get_time - ;; - no-no-no-*) - erl_monotonic_clock_func=none - ;; - esac - - erl_monotonic_clock_low_resolution=no - erl_monotonic_clock_lib= - erl_monotonic_clock_id= - case $erl_monotonic_clock_func in - clock_gettime) - erl_monotonic_clock_id=$erl_cv_clock_gettime_monotonic_$1 - for low_res_id in $low_resolution_clock_gettime_monotonic; do - if test $erl_monotonic_clock_id = $low_res_id; then - erl_monotonic_clock_low_resolution=yes - break - fi - done - AC_CHECK_LIB(rt, clock_gettime, [erl_monotonic_clock_lib="-lrt"]) - ;; - mach_clock_get_time) - erl_monotonic_clock_id=SYSTEM_CLOCK - ;; - times) - erl_monotonic_clock_low_resolution=yes - ;; - *) - ;; - esac - -]) - -AC_DEFUN(ERL_WALL_CLOCK, -[ - default_resolution_clock_gettime_wall="CLOCK_REALTIME" - low_resolution_clock_gettime_wall="CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST" - high_resolution_clock_gettime_wall="CLOCK_REALTIME_PRECISE" - - case "$1" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_wall="$high_resolution_clock_gettime_wall" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_wall="$low_resolution_clock_gettime_wall" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_wall="$2" - ;; - *) - check_msg="" - prefer_resolution_clock_gettime_wall= - ;; - esac - - AC_CACHE_CHECK([for clock_gettime() with ${check_msg}wall clock type], erl_cv_clock_gettime_wall_$1, - [ - for clock_type in $prefer_resolution_clock_gettime_wall $default_resolution_clock_gettime_wall $high_resolution_clock_gettime_wall $low_resolution_clock_gettime_wall; do - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_wall_$1=$clock_type, - erl_cv_clock_gettime_wall_$1=no) - test $erl_cv_clock_gettime_wall_$1 = no || break - done - ]) - - AC_CHECK_FUNCS([clock_getres clock_get_attributes gettimeofday]) - - AC_CACHE_CHECK([for mach clock_get_time() with wall clock type], erl_cv_mach_clock_get_time_wall, - [ - AC_TRY_COMPILE([ -#include -#include - ], - [ - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - ], - erl_cv_mach_clock_get_time_wall=yes, - erl_cv_mach_clock_get_time_wall=no) - ]) - - erl_wall_clock_low_resolution=no - erl_wall_clock_id= - case $1-$erl_cv_clock_gettime_wall_$1-$erl_cv_mach_clock_get_time_wall-$ac_cv_func_gettimeofday-$host_os in - *-*-*-*-win32) - erl_wall_clock_func=WindowsAPI - erl_wall_clock_low_resolution=yes - ;; - high_resolution-no-yes-*-*) - erl_wall_clock_func=mach_clock_get_time - erl_wall_clock_id=CALENDAR_CLOCK - ;; - *-CLOCK_*-*-*-*) - erl_wall_clock_func=clock_gettime - erl_wall_clock_id=$erl_cv_clock_gettime_wall_$1 - for low_res_id in $low_resolution_clock_gettime_wall; do - if test $erl_wall_clock_id = $low_res_id; then - erl_wall_clock_low_resolution=yes - break - fi - done - ;; - *-no-*-yes-*) - erl_wall_clock_func=gettimeofday - ;; - *) - erl_wall_clock_func=none - ;; - esac -]) - dnl ---------------------------------------------------------------------- dnl dnl LM_CHECK_THR_LIB @@ -1152,226 +908,24 @@ ]) -AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OP__, -[ - # $1 - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]]" - case $1 in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, __ATOMIC_RELAXED); res = $1(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = $1(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = $1(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - AC_MSG_ERROR([Internal error: missing implementation for $1]) - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - AC_CACHE_CHECK([for 32-bit $1()], ethr_cv_32bit_$1, - [ - ethr_cv_32bit_$1=no - AC_TRY_LINK([], [$atomic32_call], [ethr_cv_32bit_$1=yes]) - ]) - AC_CACHE_CHECK([for 64-bit $1()], ethr_cv_64bit_$1, - [ - ethr_cv_64bit_$1=no - AC_TRY_LINK([], [$atomic64_call], [ethr_cv_64bit_$1=yes]) - ]) - AC_CACHE_CHECK([for 128-bit $1()], ethr_cv_128bit_$1, - [ - ethr_cv_128bit_$1=no - AC_TRY_LINK([], [$atomic128_call], [ethr_cv_128bit_$1=yes]) - ]) - - case $ethr_cv_128bit_$1-$ethr_cv_64bit_$1-$ethr_cv_32bit_$1 in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - AC_DEFINE_UNQUOTED([ETHR_HAVE_$1], [$have_atomic_ops], [Define as a bitmask corresponding to the word sizes that $1() can handle on your system]) -]) - -AC_DEFUN(ETHR_CHK_IF_NOOP, +AC_DEFUN(ETHR_CHK_SYNC_OP, [ - ethr_test_filename="chk_if_$1$3_noop_config1test.$$" - cat > "${ethr_test_filename}.c" < "${ethr_test_filename}.c" </dev/null 2>&1; then - ethr_$1$3_noop=yes - else - ethr_$1$3_noop=no - fi - rm -f "${ethr_test_filename}.c" "${ethr_test_filename}1.o" "${ethr_test_filename}2.o" -]) - -AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OPS, -[ - AC_CHECK_SIZEOF(short) - AC_CHECK_SIZEOF(int) - AC_CHECK_SIZEOF(long) - AC_CHECK_SIZEOF(long long) - AC_CHECK_SIZEOF(__int128_t) - - if test "$ac_cv_sizeof_short" = "4"; then - gcc_atomic_type32="short" - elif test "$ac_cv_sizeof_int" = "4"; then - gcc_atomic_type32="int" - elif test "$ac_cv_sizeof_long" = "4"; then - gcc_atomic_type32="long" - else - AC_MSG_ERROR([No 32-bit type found]) - fi - - if test "$ac_cv_sizeof_int" = "8"; then - gcc_atomic_type64="int" - elif test "$ac_cv_sizeof_long" = "8"; then - gcc_atomic_type64="long" - elif test "$ac_cv_sizeof_long_long" = "8"; then - gcc_atomic_type64="long long" - else - AC_MSG_ERROR([No 64-bit type found]) - fi - - if test "$ac_cv_sizeof___int128_t" = "16"; then - gcc_atomic_type128="__int128_t" - else - gcc_atomic_type128="#error " - fi - AC_CACHE_CHECK([for a working __sync_synchronize()], ethr_cv___sync_synchronize, - [ - ethr_cv___sync_synchronize=no - AC_TRY_LINK([], - [ __sync_synchronize(); ], - [ethr_cv___sync_synchronize=yes]) - if test $ethr_cv___sync_synchronize = yes; then - # - # Old gcc versions on at least x86 have a buggy - # __sync_synchronize() which does not emit a - # memory barrier. We try to detect this by - # compiling to assembly with and without - # __sync_synchronize() and compare the results. - # - ETHR_CHK_IF_NOOP(__sync_synchronize, [()], []) - if test $ethr___sync_synchronize_noop = yes; then - # Got a buggy implementation of - # __sync_synchronize... - ethr_cv___sync_synchronize="no; buggy implementation" - fi - fi - ]) - - if test "$ethr_cv___sync_synchronize" = "yes"; then - have_sync_synchronize_value="~0" - else - have_sync_synchronize_value="0" - fi - AC_DEFINE_UNQUOTED([ETHR_HAVE___sync_synchronize], [$have_sync_synchronize_value], [Define as a bitmask corresponding to the word sizes that __sync_synchronize() can handle on your system]) - - ETHR_CHK_GCC_ATOMIC_OP__(__sync_add_and_fetch) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_fetch_and_and) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_fetch_and_or) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_val_compare_and_swap) - - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_store_n) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_load_n) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_add_fetch) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_fetch_and) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_fetch_or) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_compare_exchange_n) - - ethr_have_gcc_native_atomics=no - ethr_arm_dbm_instr_val=0 - case "$GCC-$host_cpu" in - yes-arm*) - AC_CACHE_CHECK([for ARM DMB instruction], ethr_cv_arm_dbm_instr, - [ - ethr_cv_arm_dbm_instr=no - AC_TRY_LINK([], - [ - __asm__ __volatile__("dmb sy" : : : "memory"); - __asm__ __volatile__("dmb st" : : : "memory"); - ], - [ethr_cv_arm_dbm_instr=yes]) - ]) - if test $ethr_cv_arm_dbm_instr = yes; then - ethr_arm_dbm_instr_val=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi;; - *) - ;; + AC_MSG_CHECKING([for $3-bit $1()]) + case "$2" in + "1") sync_call="$1(&var);";; + "2") sync_call="$1(&var, ($4) 0);";; + "3") sync_call="$1(&var, ($4) 0, ($4) 0);";; esac - AC_DEFINE_UNQUOTED([ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION], [$ethr_arm_dbm_instr_val], [Define as a boolean indicating whether you have a gcc compatible compiler capable of generating the ARM DMB instruction, and are compiling for an ARM processor with ARM DMB instruction support, or not]) - test $ethr_cv_32bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_64bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - if test "$ethr_cv___sync_synchronize" = "yes"; then - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi - ethr_have_gcc_atomic_builtins=0 - if test $ethr_have_gcc_native_atomics = yes; then - ethr_native_atomic_implementation=gcc_sync - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_have_gcc_atomic_builtins = 1 && ethr_native_atomic_implementation=gcc_atomic_sync - fi - AC_DEFINE_UNQUOTED([ETHR_HAVE_GCC___ATOMIC_BUILTINS], [$ethr_have_gcc_atomic_builtins], [Define as a boolean indicating whether you have a gcc __atomic builtins or not]) - test $ethr_have_gcc_native_atomics = yes && ethr_have_native_atomics=yes + have_sync_op=no + AC_TRY_LINK([], + [ + $4 res; + volatile $4 var; + res = $sync_call + ], + [have_sync_op=yes]) + test $have_sync_op = yes && $5 + AC_MSG_RESULT([$have_sync_op]) ]) AC_DEFUN(ETHR_CHK_INTERLOCKED, @@ -1451,16 +1005,6 @@ test $enable_prefer_gcc_native_ethr_impls = yes && AC_DEFINE(ETHR_PREFER_GCC_NATIVE_IMPLS, 1, [Define if you prefer gcc native ethread implementations]) -AC_ARG_ENABLE(trust-gcc-atomic-builtins-memory-barriers, - AS_HELP_STRING([--enable-trust-gcc-atomic-builtins-memory-barriers], - [trust gcc atomic builtins memory barriers]), -[ case "$enableval" in - yes) trust_gcc_atomic_builtins_mbs=1 ;; - *) trust_gcc_atomic_builtins_mbs=0 ;; - esac ], trust_gcc_atomic_builtins_mbs=0) - -AC_DEFINE_UNQUOTED(ETHR_TRUST_GCC_ATOMIC_BUILTINS_MEMORY_BARRIERS, [$trust_gcc_atomic_builtins_mbs], [Define as a boolean indicating whether you trust gcc's __atomic_* builtins memory barrier implementations, or not]) - AC_ARG_WITH(libatomic_ops, AS_HELP_STRING([--with-libatomic_ops=PATH], [specify and prefer usage of libatomic_ops in the ethread library])) @@ -1472,33 +1016,12 @@ LM_CHECK_THR_LIB ERL_INTERNAL_LIBS -ERL_MONOTONIC_CLOCK(try_find_pthread_compatible, CLOCK_HIGHRES CLOCK_MONOTONIC, no) - -case $erl_monotonic_clock_func in - clock_gettime) - AC_DEFINE(ETHR_HAVE_CLOCK_GETTIME_MONOTONIC, [1], [Define if you have a clock_gettime() with a monotonic clock]) - ;; - mach_clock_get_time) - AC_DEFINE(ETHR_HAVE_MACH_CLOCK_GET_TIME, [1], [Define if you have a mach clock_get_time() with a monotonic clock]) - ;; - gethrtime) - AC_DEFINE(ETHR_HAVE_GETHRTIME, [1], [Define if you have a monotonic gethrtime()]) - ;; - *) - ;; -esac - -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(ETHR_MONOTONIC_CLOCK_ID, [$erl_monotonic_clock_id], [Define to the monotonic clock id to use]) -fi - -ethr_native_atomic_implementation=none ethr_have_native_atomics=no ethr_have_native_spinlock=no ETHR_THR_LIB_BASE="$THR_LIB_NAME" ETHR_THR_LIB_BASE_TYPE="$THR_LIB_TYPE" ETHR_DEFS="$THR_DEFS" -ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS $erl_monotonic_clock_lib" +ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS" ETHR_LIBS= ETHR_LIB_NAME= @@ -1577,10 +1100,7 @@ ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange128], [4], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE128, 1, [Define if you have _InterlockedCompareExchange128()])) fi - if test "$ethr_have_native_atomics" = "yes"; then - ethr_native_atomic_implementation=windows - ethr_have_native_spinlock=yes - fi + test "$ethr_have_native_atomics" = "yes" && ethr_have_native_spinlock=yes ;; pthread|ose_threads) @@ -1809,50 +1329,6 @@ AC_DEFINE(ETHR_HAVE_PTHREAD_ATTR_SETGUARDSIZE, 1, \ [Define if you have the pthread_attr_setguardsize function.])) - if test "x$erl_monotonic_clock_id" != "x"; then - AC_MSG_CHECKING(whether pthread_cond_timedwait() can use the monotonic clock $erl_monotonic_clock_id for timeout) - pthread_cond_timedwait_monotonic=no - AC_TRY_LINK([ - #if defined(ETHR_NEED_NPTL_PTHREAD_H) - # include - #elif defined(ETHR_HAVE_MIT_PTHREAD_H) - # include - #elif defined(ETHR_HAVE_PTHREAD_H) - # include - #endif - #ifdef ETHR_TIME_WITH_SYS_TIME - # include - # include - #else - # ifdef ETHR_HAVE_SYS_TIME_H - # include - # else - # include - # endif - #endif - #if defined(ETHR_HAVE_MACH_CLOCK_GET_TIME) - # include - # include - #endif - ], - [ - int res; - pthread_condattr_t attr; - pthread_cond_t cond; - struct timespec cond_timeout; - pthread_mutex_t mutex; - res = pthread_condattr_init(&attr); - res = pthread_condattr_setclock(&attr, ETHR_MONOTONIC_CLOCK_ID); - res = pthread_cond_init(&cond, &attr); - res = pthread_cond_timedwait(&cond, &mutex, &cond_timeout); - ], - [pthread_cond_timedwait_monotonic=yes]) - AC_MSG_RESULT([$pthread_cond_timedwait_monotonic]) - if test $pthread_cond_timedwait_monotonic = yes; then - AC_DEFINE(ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC, [1], [Define if pthread_cond_timedwait() can be used with a monotonic clock]) - fi - fi - linux_futex=no AC_MSG_CHECKING([for Linux futexes]) AC_TRY_LINK([ @@ -1873,62 +1349,56 @@ AC_MSG_RESULT([$linux_futex]) test $linux_futex = yes && AC_DEFINE(ETHR_HAVE_LINUX_FUTEX, 1, [Define if you have a linux futex implementation.]) - pthread_setname=no - AC_MSG_CHECKING([for pthread_setname_np]) - old_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Werror" - AC_TRY_LINK([#define __USE_GNU - #include ], - [pthread_setname_np(pthread_self(), "name");], - pthread_setname=linux) - AC_TRY_LINK([#define __USE_GNU - #include ], - [pthread_set_name_np(pthread_self(), "name");], - pthread_setname=bsd) - AC_TRY_LINK([#define _DARWIN_C_SOURCE - #include ], - [pthread_setname_np("name");], - pthread_setname=darwin) - AC_MSG_RESULT([$pthread_setname]) - case $pthread_setname in - linux) AC_DEFINE(ETHR_HAVE_PTHREAD_SETNAME_NP_2, 1, - [Define if you have linux style pthread_setname_np]);; - bsd) AC_DEFINE(ETHR_HAVE_PTHREAD_SET_NAME_NP_2, 1, - [Define if you have bsd style pthread_set_name_np]);; - darwin) AC_DEFINE(ETHR_HAVE_PTHREAD_SETNAME_NP_1, 1, - [Define if you have darwin style pthread_setname_np]);; - *) ;; - esac + fi - pthread_getname=no - AC_MSG_CHECKING([for pthread_getname_np]) - AC_TRY_LINK([#define __USE_GNU - #define _DARWIN_C_SOURCE - #include ], - [char buff[256]; pthread_getname_np(pthread_self(), buff, 256);], - pthread_getname=linux) - AC_TRY_LINK([#define __USE_GNU - #define _DARWIN_C_SOURCE - #include ], - [char buff[256]; pthread_getname_np(pthread_self(), buff);], - pthread_getname=ibm) - AC_MSG_RESULT([$pthread_getname]) - case $pthread_getname in - linux) AC_DEFINE(ETHR_HAVE_PTHREAD_GETNAME_NP_3, 1, - [Define if you have linux style pthread_getname_np]);; - ibm) AC_DEFINE(ETHR_HAVE_PTHREAD_GETNAME_NP_2, 1, - [Define if you have ibm style pthread_getname_np]);; - *) ;; - esac - CFLAGS=$old_CFLAGS + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(long) + AC_CHECK_SIZEOF(long long) + AC_CHECK_SIZEOF(__int128_t) + + if test "$ac_cv_sizeof_int" = "4"; then + int32="int" + elif test "$ac_cv_sizeof_long" = "4"; then + int32="long" + elif test "$ac_cv_sizeof_long_long" = "4"; then + int32="long long" + else + AC_MSG_ERROR([No 32-bit type found]) + fi - fi ## test "x$THR_LIB_NAME" = "xpthread" + if test "$ac_cv_sizeof_int" = "8"; then + int64="int" + elif test "$ac_cv_sizeof_long" = "8"; then + int64="long" + elif test "$ac_cv_sizeof_long_long" = "8"; then + int64="long long" + else + AC_MSG_ERROR([No 64-bit type found]) + fi + + int128=no + if test "$ac_cv_sizeof___int128_t" = "16"; then + int128="__int128_t" + fi if test "X$disable_native_ethr_impls" = "Xyes"; then ethr_have_native_atomics=no else + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32, 1, [Define if you have __sync_val_compare_and_swap() for 32-bit integers])) + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_SYNC_OP([__sync_add_and_fetch], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_ADD_AND_FETCH32, 1, [Define if you have __sync_add_and_fetch() for 32-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_and], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_AND32, 1, [Define if you have __sync_fetch_and_and() for 32-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_or], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_OR32, 1, [Define if you have __sync_fetch_and_or() for 32-bit integers])) + + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64, 1, [Define if you have __sync_val_compare_and_swap() for 64-bit integers])) + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_SYNC_OP([__sync_add_and_fetch], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_ADD_AND_FETCH64, 1, [Define if you have __sync_add_and_fetch() for 64-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_and], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_AND64, 1, [Define if you have __sync_fetch_and_and() for 64-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_or], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_OR64, 1, [Define if you have __sync_fetch_and_or() for 64-bit integers])) - ETHR_CHK_GCC_ATOMIC_OPS([]) + if test $int128 != no; then + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [128], [$int128], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP128, 1, [Define if you have __sync_val_compare_and_swap() for 128-bit integers])) + fi AC_MSG_CHECKING([for a usable libatomic_ops implementation]) case "x$with_libatomic_ops" in @@ -1951,34 +1421,11 @@ int z; AO_nop_full(); -#if defined(AO_HAVE_store) AO_store(&x, (AO_t) 0); -#elif defined(AO_HAVE_store_release) - AO_store_release(&x, (AO_t) 0); -#else -#error No store -#endif -#if defined(AO_HAVE_load) z = AO_load(&x); -#elif defined(AO_HAVE_load_acquire) - z = AO_load_acquire(&x); -#else -#error No load -#endif -#if defined(AO_HAVE_compare_and_swap_full) z = AO_compare_and_swap_full(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap_release) - z = AO_compare_and_swap_release(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap_acquire) - z = AO_compare_and_swap_acquire(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap) - z = AO_compare_and_swap(&x, (AO_t) 0, (AO_t) 1); -#else -#error No compare_and_swap -#endif ], [ethr_have_native_atomics=yes - ethr_native_atomic_implementation=libatomic_ops ethr_have_libatomic_ops=yes]) AC_MSG_RESULT([$ethr_have_libatomic_ops]) if test $ethr_have_libatomic_ops = yes; then @@ -2010,19 +1457,15 @@ *) AC_MSG_ERROR([Unsupported Sparc memory order: $with_sparc_memory_order]);; esac - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; i86pc | i*86 | x86_64 | amd64) if test "$enable_x86_out_of_order" = "yes"; then AC_DEFINE(ETHR_X86_OUT_OF_ORDER, 1, [Define if x86/x86_64 out of order instructions should be synchronized]) fi - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; macppc | ppc | powerpc | "Power Macintosh") - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; tile) - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; *) ;; @@ -2195,233 +1638,109 @@ ]) + dnl ---------------------------------------------------------------------- dnl dnl ERL_TIME_CORRECTION dnl -dnl Check for primitives that can be used for implementing -dnl erts_os_monotonic_time() and erts_os_system_time() +dnl In the presence of a high resolution realtime timer Erlang can adapt +dnl its view of time relative to this timer. On solaris such a timer is +dnl available with the syscall gethrtime(). On other OS's a fallback +dnl solution using times() is implemented. (However on e.g. FreeBSD times() +dnl is implemented using gettimeofday so it doesn't make much sense to +dnl use it there...) On second thought, it seems to be safer to do it the +dnl other way around. I.e. only use times() on OS's where we know it will +dnl work... dnl AC_DEFUN(ERL_TIME_CORRECTION, -[ - -AC_ARG_WITH(clock-resolution, -AS_HELP_STRING([--with-clock-resolution=high|low|default], - [specify wanted clock resolution])) - -AC_ARG_WITH(clock-gettime-realtime-id, -AS_HELP_STRING([--with-clock-gettime-realtime-id=CLOCKID], - [specify clock id to use with clock_gettime() for realtime time)])) - -AC_ARG_WITH(clock-gettime-monotonic-id, -AS_HELP_STRING([--with-clock-gettime-monotonic-id=CLOCKID], - [specify clock id to use with clock_gettime() for monotonic time)])) - -AC_ARG_ENABLE(prefer-elapsed-monotonic-time-during-suspend, -AS_HELP_STRING([--enable-prefer-elapsed-monotonic-time-during-suspend], - [Prefer an OS monotonic time source with elapsed time during suspend]) -AS_HELP_STRING([--disable-prefer-elapsed-monotonic-time-during-suspend], - [Do not prefer an OS monotonic time source with elapsed time during suspend]), -[ case "$enableval" in - yes) prefer_elapsed_monotonic_time_during_suspend=yes ;; - *) prefer_elapsed_monotonic_time_during_suspend=no ;; - esac ], prefer_elapsed_monotonic_time_during_suspend=no) - -AC_ARG_ENABLE(gettimeofday-as-os-system-time, - AS_HELP_STRING([--enable-gettimeofday-as-os-system-time], - [Force usage of gettimeofday() for OS system time]), -[ case "$enableval" in - yes) force_gettimeofday_os_system_time=yes ;; - *) force_gettimeofday_os_system_time=no ;; - esac ], force_gettimeofday_os_system_time=no) - -case "$with_clock_resolution" in - ""|no|yes) - with_clock_resolution=default;; - high|low|default) - ;; - *) - AC_MSG_ERROR([Invalid wanted clock resolution: $with_clock_resolution]) - ;; -esac - -if test "$force_gettimeofday_os_system_time" = "yes"; then - - AC_CHECK_FUNCS([gettimeofday]) - if test "$ac_cv_func_gettimeofday" = "yes"; then - AC_DEFINE(OS_SYSTEM_TIME_GETTIMEOFDAY, [1], [Define if you want to implement erts_os_system_time() using gettimeofday()]) - else - AC_MSG_ERROR([No gettimeofday() available]) - fi - -else # $force_gettimeofday_os_system_time != yes - -case "$with_clock_gettime_realtime_id" in - ""|no) - with_clock_gettime_realtime_id=no - ;; - CLOCK_*CPUTIME*) - AC_MSG_ERROR([Invalid clock_gettime() realtime clock id: Refusing to use the cputime clock id $with_clock_gettime_realtime_id as realtime clock id]) - ;; - CLOCK_MONOTONIC*|CLOCK_BOOTTIME*|CLOCK_UPTIME*|CLOCK_HIGHRES*) - AC_MSG_ERROR([Invalid clock_gettime() realtime clock id: Refusing to use the monotonic clock id $with_clock_gettime_realtime_id as realtime clock id]) - ;; - CLOCK_*) - ;; - *) - AC_MSG_ERROR([Invalid clock_gettime() clock id: $with_clock_gettime_realtime_id]) - ;; -esac - -case "$with_clock_resolution-$with_clock_gettime_realtime_id" in - high-no) - ERL_WALL_CLOCK(high_resolution);; - low-no) - ERL_WALL_CLOCK(low_resolution);; - default-no) - ERL_WALL_CLOCK(default_resolution);; - *) - ERL_WALL_CLOCK(custom_resolution, $with_clock_gettime_realtime_id);; -esac - -case "$erl_wall_clock_func-$erl_wall_clock_id-$with_clock_gettime_realtime_id" in - *-*-no) - ;; - clock_gettime-$with_clock_gettime_realtime_id-$with_clock_gettime_realtime_id) - ;; - *) - AC_MSG_ERROR([$with_clock_gettime_realtime_id as clock id to clock_gettime() doesn't compile]) - ;; -esac - -case $erl_wall_clock_func in - none) - AC_MSG_ERROR([No wall clock source found]) - ;; - mach_clock_get_time) - AC_DEFINE(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_system_time() using mach clock_get_time()]) - ;; - clock_gettime) - AC_DEFINE(OS_SYSTEM_TIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_system_time() using clock_gettime()]) - ;; - gettimeofday) - AC_DEFINE(OS_SYSTEM_TIME_GETTIMEOFDAY, [1], [Define if you want to implement erts_os_system_time() using gettimeofday()]) - ;; - *) - ;; -esac - -if test "x$erl_wall_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(WALL_CLOCK_ID_STR, ["$erl_wall_clock_id"], [Define as a string of wall clock id to use]) - AC_DEFINE_UNQUOTED(WALL_CLOCK_ID, [$erl_wall_clock_id], [Define to wall clock id to use]) -fi - -fi # $force_gettimeofday_os_system_time != yes - -case "$with_clock_gettime_monotonic_id" in - ""|no) - with_clock_gettime_monotonic_id=no - ;; - CLOCK_*CPUTIME*) - AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the cputime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) - ;; - CLOCK_REALTIME*|CLOCK_TAI*) - AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the realtime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) - ;; - CLOCK_*) - ;; - *) - AC_MSG_ERROR([Invalid clock_gettime() clock id: $with_clock_gettime_monotonic_id]) - ;; -esac - -case "$with_clock_resolution-$with_clock_gettime_monotonic_id" in - high-no) - ERL_MONOTONIC_CLOCK(high_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - low-no) - ERL_MONOTONIC_CLOCK(low_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - default-no) - ERL_MONOTONIC_CLOCK(default_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - *) - ERL_MONOTONIC_CLOCK(custom_resolution, $with_clock_gettime_monotonic_id, $prefer_elapsed_monotonic_time_during_suspend);; -esac - -case "$erl_monotonic_clock_func-$erl_monotonic_clock_id-$with_clock_gettime_monotonic_id" in - *-*-no) - ;; - clock_gettime-$with_clock_gettime_monotonic_id-$with_clock_gettime_monotonic_id) - ;; - *) - AC_MSG_ERROR([$with_clock_gettime_monotonic_id as clock id to clock_gettime() doesn't compile]) - ;; -esac - -case $erl_monotonic_clock_func in - times) - AC_DEFINE(OS_MONOTONIC_TIME_USING_TIMES, [1], [Define if you want to implement erts_os_monotonic_time() using times()]) - ;; - mach_clock_get_time) - AC_DEFINE(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_monotonic_time() using mach clock_get_time()]) - ;; - clock_gettime) - AC_DEFINE(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_monotonic_time() using clock_gettime()]) - ;; - gethrtime) - AC_DEFINE(OS_MONOTONIC_TIME_USING_GETHRTIME, [1], [Define if you want to implement erts_os_monotonic_time() using gethrtime()]) - ;; - *) - ;; -esac - -if test $erl_corrected_monotonic_clock = yes; then - AC_DEFINE(ERTS_HAVE_CORRECTED_OS_MONOTONIC_TIME, [1], [Define if OS monotonic clock is corrected]) -fi - -if test $erl_monotonic_clock_low_resolution = yes; then - AC_DEFINE(ERTS_HAVE_LOW_RESOLUTION_OS_MONOTONIC_LOW, [1], [Define if you have a low resolution OS monotonic clock]) -fi - -xrtlib="$erl_monotonic_clock_lib" -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(MONOTONIC_CLOCK_ID_STR, ["$erl_monotonic_clock_id"], [Define as a string of monotonic clock id to use]) - AC_DEFINE_UNQUOTED(MONOTONIC_CLOCK_ID, [$erl_monotonic_clock_id], [Define to monotonic clock id to use]) +[if test x$ac_cv_func_gethrtime = x; then + AC_CHECK_FUNC(gethrtime) fi - -if test $erl_cv_clock_gettime_monotonic_raw = yes; then - AC_DEFINE(HAVE_CLOCK_GETTIME_MONOTONIC_RAW, [1], [Define if you have clock_gettime(CLOCK_MONOTONIC_RAW, _)]) +if test x$clock_gettime_correction = xunknown; then + AC_TRY_COMPILE([#include ], + [struct timespec ts; + long long result; + clock_gettime(CLOCK_MONOTONIC,&ts); + result = ((long long) ts.tv_sec) * 1000000000LL + + ((long long) ts.tv_nsec);], + clock_gettime_compiles=yes, + clock_gettime_compiles=no) +else + clock_gettime_compiles=no fi + -ERL_MONOTONIC_CLOCK(high_resolution, undefined, no) +AC_CACHE_CHECK([how to correct for time adjustments], erl_cv_time_correction, +[ +case $clock_gettime_correction in + yes) + erl_cv_time_correction=clock_gettime;; + no|unknown) + case $ac_cv_func_gethrtime in + yes) + erl_cv_time_correction=hrtime ;; + no) + case $host_os in + linux*) + case $clock_gettime_correction in + unknown) + if test x$clock_gettime_compiles = xyes; then + if test X$cross_compiling != Xyes; then + linux_kernel_vsn_=`uname -r` + case $linux_kernel_vsn_ in + [[0-1]].*|2.[[0-5]]|2.[[0-5]].*) + erl_cv_time_correction=times ;; + *) + erl_cv_time_correction=clock_gettime;; + esac + else + case X$erl_xcomp_linux_clock_gettime_correction in + X) + erl_cv_time_correction=cross;; + Xyes|Xno) + if test $erl_xcomp_linux_clock_gettime_correction = yes; then + erl_cv_time_correction=clock_gettime + else + erl_cv_time_correction=times + fi;; + *) + AC_MSG_ERROR([Bad erl_xcomp_linux_clock_gettime_correction value: $erl_xcomp_linux_clock_gettime_correction]);; + esac + fi + else + erl_cv_time_correction=times + fi + ;; + *) + erl_cv_time_correction=times ;; + esac + ;; + *) + erl_cv_time_correction=none ;; + esac + ;; + esac + ;; +esac +]) -case $$erl_monotonic_clock_low_resolution-$erl_monotonic_clock_func in - no-mach_clock_get_time) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_hrtime() using mach clock_get_time()]) - ;; - no-clock_gettime) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_hrtime() using clock_gettime()]) - ;; - no-gethrtime) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_GETHRTIME, [1], [Define if you want to implement erts_os_hrtime() using gethrtime()]) +xrtlib="" +case $erl_cv_time_correction in + times) + AC_DEFINE(CORRECT_USING_TIMES,[], + [Define if you do not have a high-res. timer & want to use times() instead]) ;; - *) - monotonic_hrtime=no + clock_gettime|cross) + if test $erl_cv_time_correction = cross; then + erl_cv_time_correction=clock_gettime + AC_MSG_WARN([result clock_gettime guessed because of cross compilation]) + fi + xrtlib="-lrt" + AC_DEFINE(GETHRTIME_WITH_CLOCK_GETTIME,[1], + [Define if you want to use clock_gettime to simulate gethrtime]) ;; esac - -if test $monotonic_hrtime = yes; then - AC_DEFINE(HAVE_MONOTONIC_ERTS_SYS_HRTIME, [1], [Define if you have a monotonic erts_os_hrtime() implementation]) -fi - -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(HRTIME_CLOCK_ID_STR, ["$erl_monotonic_clock_id"], [Define as a string of monotonic clock id to use]) - AC_DEFINE_UNQUOTED(HRTIME_CLOCK_ID, [$erl_monotonic_clock_id], [Define to monotonic clock id to use]) -fi - - dnl dnl Check if gethrvtime is working, and if to use procfs ioctl dnl or (yet to be written) write to the procfs ctl file. @@ -2494,7 +1813,6 @@ esac ]) -LIBRT=$xrtlib case $erl_gethrvtime in procfs_ioctl) AC_DEFINE(HAVE_GETHRVTIME_PROCFS_IOCTL,[1], @@ -2541,33 +1859,43 @@ exit(0); return 0; } ], - erl_clock_gettime_cpu_time=yes, - erl_clock_gettime_cpu_time=no, + erl_clock_gettime=yes, + erl_clock_gettime=no, [ case X$erl_xcomp_clock_gettime_cpu_time in - X) erl_clock_gettime_cpu_time=cross;; - Xyes|Xno) erl_clock_gettime_cpu_time=$erl_xcomp_clock_gettime_cpu_time;; + X) erl_clock_gettime=cross;; + Xyes|Xno) erl_clock_gettime=$erl_xcomp_clock_gettime_cpu_time;; *) AC_MSG_ERROR([Bad erl_xcomp_clock_gettime_cpu_time value: $erl_xcomp_clock_gettime_cpu_time]);; esac ]) LIBS=$save_libs - AC_MSG_RESULT($erl_clock_gettime_cpu_time) - case $erl_clock_gettime_cpu_time in - yes) - AC_DEFINE(HAVE_CLOCK_GETTIME_CPU_TIME,[], - [define if clock_gettime() works for getting process time]) - LIBRT=-lrt - ;; - cross) - erl_clock_gettime_cpu_time=no - AC_MSG_WARN([result no guessed because of cross compilation]) + case $host_os in + linux*) + AC_MSG_RESULT([no; not stable]) + LIBRT=$xrtlib ;; *) + AC_MSG_RESULT($erl_clock_gettime) + case $erl_clock_gettime in + yes) + AC_DEFINE(HAVE_CLOCK_GETTIME,[], + [define if clock_gettime() works for getting process time]) + LIBRT=-lrt + ;; + cross) + erl_clock_gettime=no + AC_MSG_WARN([result no guessed because of cross compilation]) + LIBRT=$xrtlib + ;; + *) + LIBRT=$xrtlib + ;; + esac ;; esac + AC_SUBST(LIBRT) ;; esac -AC_SUBST(LIBRT) ])dnl dnl ---------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/erts/AUTHORS erlang-17.3-dfsg/erts/AUTHORS --- erlang-18.2-dfsg/erts/AUTHORS 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/AUTHORS 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ Copyright Ericsson AB 1999-2009. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/autoconf/config.guess erlang-17.3-dfsg/erts/autoconf/config.guess --- erlang-18.2-dfsg/erts/autoconf/config.guess 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/config.guess 2014-09-16 19:10:57.000000000 +0000 @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2015 Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2015-03-04' +timestamp='2013-02-12' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # -# Please send patches to . +# Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2015 Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -132,27 +132,6 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - ;; -esac - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -168,27 +147,20 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || \ - echo unknown)` + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown - ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in - arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) + arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ @@ -204,13 +176,6 @@ os=netbsd ;; esac - # Determine ABI tags. - case "${UNAME_MACHINE_ARCH}" in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` - ;; - esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -227,7 +192,7 @@ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}${abi}" + echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -593,9 +558,8 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -841,7 +805,7 @@ *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - *:MSYS*:*) + i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -889,21 +853,21 @@ exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -916,57 +880,59 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + echo ${UNAME_MACHINE}-unknown-linux-gnueabi else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - e2k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -985,63 +951,57 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} + echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} + echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} + echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} + echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} + echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1274,31 +1234,19 @@ exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1389,6 +1337,154 @@ exit ;; esac +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + cat >&2 <. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -68,7 +68,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2015 Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,7 +117,7 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os @@ -252,20 +252,19 @@ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arceb \ + | arc \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ - | c4x | c8051 | clipper \ + | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ + | epiphany \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ @@ -283,10 +282,8 @@ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ @@ -298,11 +295,11 @@ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ + | open8 \ + | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ @@ -313,7 +310,6 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -328,10 +324,7 @@ c6x) basic_machine=tic6x-unknown ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -373,22 +366,21 @@ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ + | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ @@ -408,10 +400,8 @@ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ @@ -423,7 +413,6 @@ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ - | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ @@ -441,7 +430,6 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ - | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -518,9 +506,6 @@ basic_machine=i386-pc os=-aros ;; - asmjs) - basic_machine=asmjs-unknown - ;; aux) basic_machine=m68k-apple os=-aux @@ -782,9 +767,6 @@ basic_machine=m68k-isi os=-sysv ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` - ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -812,7 +794,7 @@ os=-mingw64 ;; mingw32) - basic_machine=i686-pc + basic_machine=i386-pc os=-mingw32 ;; mingw32ce) @@ -840,10 +822,6 @@ basic_machine=powerpc-unknown os=-morphos ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; msdos) basic_machine=i386-pc os=-msdos @@ -852,7 +830,7 @@ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i686-pc + basic_machine=i386-pc os=-msys ;; mvs) @@ -1376,7 +1354,7 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* | -cloudabi* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ @@ -1389,14 +1367,14 @@ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1568,9 +1546,6 @@ c4x-* | tic4x-*) os=-coff ;; - c8051-*) - os=-elf - ;; hexagon-*) os=-elf ;; @@ -1614,6 +1589,9 @@ mips*-*) os=-elf ;; + or1k-*) + os=-elf + ;; or32-*) os=-coff ;; @@ -1808,3 +1786,4 @@ # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: + diff -Nru erlang-18.2-dfsg/erts/autoconf/configure.vxworks erlang-17.3-dfsg/erts/autoconf/configure.vxworks --- erlang-18.2-dfsg/erts/autoconf/configure.vxworks 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/configure.vxworks 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1997-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/autoconf/vxworks/sed.general erlang-17.3-dfsg/erts/autoconf/vxworks/sed.general --- erlang-18.2-dfsg/erts/autoconf/vxworks/sed.general 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/vxworks/sed.general 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -79,6 +78,8 @@ # HiPE s|@HIPE_ENABLED@|| +s|@PERFCTR_PATH@|| +s|@USE_PERFCTR@|| # m4 s|@OPSYS@|noopsys| diff -Nru erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_cpu32 erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_cpu32 --- erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_cpu32 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_cpu32 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc32 erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc32 --- erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc32 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc32 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2006-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc603 erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc603 --- erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc603 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc603 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc603_nolongcall erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc603_nolongcall --- erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc603_nolongcall 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc603_nolongcall 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc860 erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc860 --- erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc860 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_ppc860 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_simlinux erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_simlinux --- erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_simlinux 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_simlinux 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2008-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_simso erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_simso --- erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_simso 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_simso 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2005-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_sparc erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_sparc --- erlang-18.2-dfsg/erts/autoconf/vxworks/sed.vxworks_sparc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/vxworks/sed.vxworks_sparc 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/autoconf/win32.config.cache.static erlang-17.3-dfsg/erts/autoconf/win32.config.cache.static --- erlang-18.2-dfsg/erts/autoconf/win32.config.cache.static 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/win32.config.cache.static 2014-09-16 19:10:57.000000000 +0000 @@ -221,6 +221,7 @@ ac_cv_type_uid_t=${ac_cv_type_uid_t=no} ac_cv_type_void_p=${ac_cv_type_void_p=yes} ac_cv_working_alloca_h=${ac_cv_working_alloca_h=no} +erl_cv_time_correction=${erl_cv_time_correction=none} erts_cv___after_morecore_hook_can_track_malloc=${erts_cv___after_morecore_hook_can_track_malloc=no} erts_cv_fwrite_unlocked=${erts_cv_fwrite_unlocked=no} erts_cv_have__end_symbol=${erts_cv_have__end_symbol=no} diff -Nru erlang-18.2-dfsg/erts/autoconf/win64.config.cache.static erlang-17.3-dfsg/erts/autoconf/win64.config.cache.static --- erlang-18.2-dfsg/erts/autoconf/win64.config.cache.static 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/autoconf/win64.config.cache.static 2014-09-16 19:10:57.000000000 +0000 @@ -262,6 +262,7 @@ ac_cv_type_size_t=${ac_cv_type_size_t=yes} ac_cv_type_uid_t=${ac_cv_type_uid_t=no} ac_cv_working_alloca_h=${ac_cv_working_alloca_h=no} +erl_cv_time_correction=${erl_cv_time_correction=none} erts_cv___after_morecore_hook_can_track_malloc=${erts_cv___after_morecore_hook_can_track_malloc=no} erts_cv_fwrite_unlocked=${erts_cv_fwrite_unlocked=no} erts_cv_have__end_symbol=${erts_cv_have__end_symbol=no} diff -Nru erlang-18.2-dfsg/erts/config.h.in erlang-17.3-dfsg/erts/config.h.in --- erlang-18.2-dfsg/erts/config.h.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/config.h.in 2014-09-16 19:10:57.000000000 +0000 @@ -15,6 +15,10 @@ /* Define the brk() return type. */ #undef BRK_RET_TYPE +/* Define if you do not have a high-res. timer & want to use times() instead + */ +#undef CORRECT_USING_TIMES + /* Modern style mcontext_t in MacOSX */ #undef DARWIN_MODERN_MCONTEXT @@ -59,21 +63,12 @@ /* Define if you have kernel poll and want to use it */ #undef ERTS_ENABLE_KERNEL_POLL -/* Define if OS monotonic clock is corrected */ -#undef ERTS_HAVE_CORRECTED_OS_MONOTONIC_TIME - -/* Define if you have a low resolution OS monotonic clock */ -#undef ERTS_HAVE_LOW_RESOLUTION_OS_MONOTONIC_LOW - /* Define if the smp emulator is built */ #undef ERTS_HAVE_SMP_EMU /* Define if dlopen() needs to be called before first call to dlerror() */ #undef ERTS_NEED_DLOPEN_BEFORE_DLERROR -/* Save compile time? */ -#undef ERTS_SAVED_COMPILE_TIME - /* Define if poll() should be used instead of select() */ #undef ERTS_USE_POLL @@ -101,48 +96,21 @@ asm statements */ #undef ETHR_GCC_HAVE_SSE2_ASM_SUPPORT -/* Define if you have a clock_gettime() with a monotonic clock */ -#undef ETHR_HAVE_CLOCK_GETTIME_MONOTONIC - /* Define if you have all ethread defines */ #undef ETHR_HAVE_ETHREAD_DEFINES -/* Define as a boolean indicating whether you have a gcc compatible compiler - capable of generating the ARM DMB instruction, and are compiling for an ARM - processor with ARM DMB instruction support, or not */ -#undef ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION - -/* Define as a boolean indicating whether you have a gcc __atomic builtins or - not */ -#undef ETHR_HAVE_GCC___ATOMIC_BUILTINS - -/* Define if you have a monotonic gethrtime() */ -#undef ETHR_HAVE_GETHRTIME - /* Define if you have libatomic_ops atomic operations */ #undef ETHR_HAVE_LIBATOMIC_OPS /* Define if you have a linux futex implementation. */ #undef ETHR_HAVE_LINUX_FUTEX -/* Define if you have a mach clock_get_time() with a monotonic clock */ -#undef ETHR_HAVE_MACH_CLOCK_GET_TIME - /* Define if the pthread.h header file is in pthread/mit directory. */ #undef ETHR_HAVE_MIT_PTHREAD_H /* Define if you have the pthread_attr_setguardsize function. */ #undef ETHR_HAVE_PTHREAD_ATTR_SETGUARDSIZE -/* Define if pthread_cond_timedwait() can be used with a monotonic clock */ -#undef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC - -/* Define if you have ibm style pthread_getname_np */ -#undef ETHR_HAVE_PTHREAD_GETNAME_NP_2 - -/* Define if you have linux style pthread_getname_np */ -#undef ETHR_HAVE_PTHREAD_GETNAME_NP_3 - /* Define if you have the header file. */ #undef ETHR_HAVE_PTHREAD_H @@ -153,15 +121,6 @@ attribute. */ #undef ETHR_HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP -/* Define if you have darwin style pthread_setname_np */ -#undef ETHR_HAVE_PTHREAD_SETNAME_NP_1 - -/* Define if you have linux style pthread_setname_np */ -#undef ETHR_HAVE_PTHREAD_SETNAME_NP_2 - -/* Define if you have bsd style pthread_set_name_np */ -#undef ETHR_HAVE_PTHREAD_SET_NAME_NP_2 - /* Define if you have the pthread_spin_lock function. */ #undef ETHR_HAVE_PTHREAD_SPIN_LOCK @@ -252,56 +211,36 @@ /* Define if you have _InterlockedOr64() */ #undef ETHR_HAVE__INTERLOCKEDOR64 -/* Define as a bitmask corresponding to the word sizes that - __atomic_add_fetch() can handle on your system */ -#undef ETHR_HAVE___atomic_add_fetch - -/* Define as a bitmask corresponding to the word sizes that - __atomic_compare_exchange_n() can handle on your system */ -#undef ETHR_HAVE___atomic_compare_exchange_n - -/* Define as a bitmask corresponding to the word sizes that - __atomic_fetch_and() can handle on your system */ -#undef ETHR_HAVE___atomic_fetch_and - -/* Define as a bitmask corresponding to the word sizes that - __atomic_fetch_or() can handle on your system */ -#undef ETHR_HAVE___atomic_fetch_or - -/* Define as a bitmask corresponding to the word sizes that __atomic_load_n() - can handle on your system */ -#undef ETHR_HAVE___atomic_load_n - -/* Define as a bitmask corresponding to the word sizes that __atomic_store_n() - can handle on your system */ -#undef ETHR_HAVE___atomic_store_n - -/* Define as a bitmask corresponding to the word sizes that - __sync_add_and_fetch() can handle on your system */ -#undef ETHR_HAVE___sync_add_and_fetch - -/* Define as a bitmask corresponding to the word sizes that - __sync_fetch_and_and() can handle on your system */ -#undef ETHR_HAVE___sync_fetch_and_and - -/* Define as a bitmask corresponding to the word sizes that - __sync_fetch_and_or() can handle on your system */ -#undef ETHR_HAVE___sync_fetch_and_or - -/* Define as a bitmask corresponding to the word sizes that - __sync_synchronize() can handle on your system */ -#undef ETHR_HAVE___sync_synchronize - -/* Define as a bitmask corresponding to the word sizes that - __sync_val_compare_and_swap() can handle on your system */ -#undef ETHR_HAVE___sync_val_compare_and_swap +/* Define if you have __sync_add_and_fetch() for 32-bit integers */ +#undef ETHR_HAVE___SYNC_ADD_AND_FETCH32 + +/* Define if you have __sync_add_and_fetch() for 64-bit integers */ +#undef ETHR_HAVE___SYNC_ADD_AND_FETCH64 + +/* Define if you have __sync_fetch_and_and() for 32-bit integers */ +#undef ETHR_HAVE___SYNC_FETCH_AND_AND32 + +/* Define if you have __sync_fetch_and_and() for 64-bit integers */ +#undef ETHR_HAVE___SYNC_FETCH_AND_AND64 + +/* Define if you have __sync_fetch_and_or() for 32-bit integers */ +#undef ETHR_HAVE___SYNC_FETCH_AND_OR32 + +/* Define if you have __sync_fetch_and_or() for 64-bit integers */ +#undef ETHR_HAVE___SYNC_FETCH_AND_OR64 + +/* Define if you have __sync_val_compare_and_swap() for 128-bit integers */ +#undef ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP128 + +/* Define if you have __sync_val_compare_and_swap() for 32-bit integers */ +#undef ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32 + +/* Define if you have __sync_val_compare_and_swap() for 64-bit integers */ +#undef ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64 /* Define if you want to modify the default stack size */ #undef ETHR_MODIFIED_DEFAULT_STACK_SIZE -/* Define to the monotonic clock id to use */ -#undef ETHR_MONOTONIC_CLOCK_ID - /* Define if you need the header file. */ #undef ETHR_NEED_NPTL_PTHREAD_H @@ -359,16 +298,15 @@ /* Define if you can safely include both and . */ #undef ETHR_TIME_WITH_SYS_TIME -/* Define as a boolean indicating whether you trust gcc's __atomic_* builtins - memory barrier implementations, or not */ -#undef ETHR_TRUST_GCC_ATOMIC_BUILTINS_MEMORY_BARRIERS - /* Define if you have win32 threads */ #undef ETHR_WIN32_THREADS /* Define if x86/x86_64 out of order instructions should be synchronized */ #undef ETHR_X86_OUT_OF_ORDER +/* Define if you want to use clock_gettime to simulate gethrtime */ +#undef GETHRTIME_WITH_CLOCK_GETTIME + /* Define if building a halfword-heap 64bit emulator */ #undef HALFWORD_HEAP_EMULATOR @@ -378,17 +316,8 @@ /* Define to 1 if you have the `brk' function. */ #undef HAVE_BRK -/* Define to 1 if you have the `clock_getres' function. */ -#undef HAVE_CLOCK_GETRES - /* define if clock_gettime() works for getting process time */ -#undef HAVE_CLOCK_GETTIME_CPU_TIME - -/* Define if you have clock_gettime(CLOCK_MONOTONIC_RAW, _) */ -#undef HAVE_CLOCK_GETTIME_MONOTONIC_RAW - -/* Define to 1 if you have the `clock_get_attributes' function. */ -#undef HAVE_CLOCK_GET_ATTRIBUTES +#undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the `closefrom' function. */ #undef HAVE_CLOSEFROM @@ -534,10 +463,6 @@ if you don't. */ #undef HAVE_DECL_SCTP_SHUTDOWN_SENT -/* Define to 1 if you have the declaration of `SCTP_UNCONFIRMED', and to 0 if - you don't. */ -#undef HAVE_DECL_SCTP_UNCONFIRMED - /* Define to 1 if you have the declaration of `SCTP_UNORDERED', and to 0 if you don't. */ #undef HAVE_DECL_SCTP_UNORDERED @@ -620,9 +545,6 @@ /* Define to 1 if you have a good `getnameinfo' function. */ #undef HAVE_GETNAMEINFO -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - /* Define to 1 if you have the `gmtime_r' function. */ #undef HAVE_GMTIME_R @@ -653,9 +575,6 @@ /* Early linux used in_addr6 instead of in6_addr, define if you have this */ #undef HAVE_IN_ADDR6_STRUCT -/* Define to 1 if you have the `isfinite' function. */ -#undef HAVE_ISFINITE - /* Define to 1 if you have the `isinf' function. */ #undef HAVE_ISINF @@ -698,9 +617,6 @@ /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R -/* Define to 1 if you have the `log2' function. */ -#undef HAVE_LOG2 - /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H @@ -725,9 +641,6 @@ /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP -/* Define if you have a monotonic erts_os_hrtime() implementation */ -#undef HAVE_MONOTONIC_ERTS_SYS_HRTIME - /* Define to 1 if you have the `mremap' function. */ #undef HAVE_MREMAP @@ -776,9 +689,6 @@ /* Define to 1 if you have the `posix_memalign' function. */ #undef HAVE_POSIX_MEMALIGN -/* Define to 1 if you have the `ppoll' function. */ -#undef HAVE_PPOLL - /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD @@ -964,9 +874,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSCTL_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMERFD_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H @@ -1045,21 +952,9 @@ /* Define to enable HiPE */ #undef HIPE -/* Define to monotonic clock id to use */ -#undef HRTIME_CLOCK_ID - -/* Define as a string of monotonic clock id to use */ -#undef HRTIME_CLOCK_ID_STR - /* define if h_errno is declared (in some way) in a system header file */ #undef H_ERRNO_DECLARED -/* Define to monotonic clock id to use */ -#undef MONOTONIC_CLOCK_ID - -/* Define as a string of monotonic clock id to use */ -#undef MONOTONIC_CLOCK_ID_STR - /* Define if netdb.h needs struct sockaddr_in ans in.h CAN be included before */ #undef NETDB_H_NEEDS_IN_H @@ -1073,33 +968,6 @@ /* Define if you dont have salen */ #undef NO_SA_LEN -/* Define if you want to implement erts_os_monotonic_time() using - clock_gettime() */ -#undef OS_MONOTONIC_TIME_USING_CLOCK_GETTIME - -/* Define if you want to implement erts_os_monotonic_time() using gethrtime() - */ -#undef OS_MONOTONIC_TIME_USING_GETHRTIME - -/* Define if you want to implement erts_os_monotonic_time() using mach - clock_get_time() */ -#undef OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME - -/* Define if you want to implement erts_os_monotonic_time() using times() */ -#undef OS_MONOTONIC_TIME_USING_TIMES - -/* Define if you want to implement erts_os_system_time() using gettimeofday() - */ -#undef OS_SYSTEM_TIME_GETTIMEOFDAY - -/* Define if you want to implement erts_os_system_time() using clock_gettime() - */ -#undef OS_SYSTEM_TIME_USING_CLOCK_GETTIME - -/* Define if you want to implement erts_os_system_time() using mach - clock_get_time() */ -#undef OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME - /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT @@ -1170,16 +1038,6 @@ /* define if the variable sys_errlist is declared in a system header file */ #undef SYS_ERRLIST_DECLARED -/* Define if you want to implement erts_os_hrtime() using clock_gettime() */ -#undef SYS_HRTIME_USING_CLOCK_GETTIME - -/* Define if you want to implement erts_os_hrtime() using gethrtime() */ -#undef SYS_HRTIME_USING_GETHRTIME - -/* Define if you want to implement erts_os_hrtime() using mach - clock_get_time() */ -#undef SYS_HRTIME_USING_MACH_CLOCK_GET_TIME - /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME @@ -1195,6 +1053,9 @@ /* Define if you have matherr() function and struct exception type */ #undef USE_MATHERR +/* Define to enable hrvtime() on Linux systems with perfctr extension */ +#undef USE_PERFCTR + /* Define if select() should be used instead of poll() */ #undef USE_SELECT @@ -1204,12 +1065,6 @@ /* Define to enable VM dynamic trace probes */ #undef USE_VM_PROBES -/* Define to wall clock id to use */ -#undef WALL_CLOCK_ID - -/* Define as a string of wall clock id to use */ -#undef WALL_CLOCK_ID_STR - /* Define if windows.h includes winsock2.h */ #undef WINDOWS_H_INCLUDES_WINSOCK2_H @@ -1252,7 +1107,7 @@ #define HAVE_GETHRVTIME #endif -#if !defined(HAVE_ISFINITE) && !defined(HAVE_FINITE) +#ifndef HAVE_FINITE # if defined(HAVE_ISINF) && defined(HAVE_ISNAN) # define USE_ISINF_ISNAN # endif diff -Nru erlang-18.2-dfsg/erts/configure erlang-17.3-dfsg/erts/configure --- erlang-18.2-dfsg/erts/configure 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/configure 2014-09-16 19:10:57.000000000 +0000 @@ -309,7 +309,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS ERL_TOP CC CFLAGS STATIC_CFLAGS CFLAG_RUNTIME_LIBRARY_PATH CPP CPPFLAGS CXX CXXFLAGS LD LDFLAGS DED_LD DED_LDFLAGS DED_LD_FLAG_RUNTIME_LIBRARY_PATH LFS_CFLAGS LFS_LDFLAGS LFS_LIBS RANLIB AR GETCONF erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_double_middle_endian erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers erl_xcomp_ose_ldflags_pass1 erl_xcomp_ose_ldflags_pass2 erl_xcomp_ose_OSEROOT erl_xcomp_ose_STRIP erl_xcomp_ose_LM_POST_LINK erl_xcomp_ose_LM_SET_CONF erl_xcomp_ose_LM_ELF_SIZE erl_xcomp_ose_LM_LCF erl_xcomp_ose_BEAM_LM_CONF erl_xcomp_ose_EPMD_LM_CONF erl_xcomp_ose_RUN_ERL_LM_CONF erl_xcomp_ose_CONFD erl_xcomp_ose_CRT0_LM build build_cpu build_vendor build_os host host_cpu host_vendor host_os CROSS_COMPILING ac_ct_CC EXEEXT OBJEXT ENABLE_ALLOC_TYPE_VARS USE_VM_PROBES OTP_RELEASE SYSTEM_VSN OTP_VERSION STATIC_NIFS STATIC_DRIVERS GCC MIXED_CYGWIN_VC MIXED_MSYS_VC MIXED_VC MIXED_CYGWIN_MINGW MIXED_CYGWIN MIXED_MSYS ac_pt_GETCONF DEBUG_FLAGS DEBUG_CFLAGS WFLAGS WERRORFLAGS EGREP EXTERNAL_WORD_SIZE OPSYS ARCH LIBCARBON ac_ct_RANLIB YACC PERL LN_S ac_ct_AR RM MKDIR XSLTPROC FOP XMLLINT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA INSTALL_DIR HCC HCFLAGS vxworks_reclaim LDFLAG_RUNTIME_LIBRARY_PATH ERLANG_OSTYPE DEXPORT ERTS_INTERNAL_X_LIBS ETHR_X_LIBS ETHR_LIBS ETHR_LIB_NAME ETHR_DEFS ETHR_THR_LIB_BASE ETHR_THR_LIB_BASE_DIR ETHR_X86_SSE2_ASM ERTS_BUILD_SMP_EMU EMU_THR_LIB_NAME EMU_THR_X_LIBS EMU_THR_LIBS EMU_THR_DEFS EMU_LOCK_CHECKING THR_LIBS THR_DEFS TERMCAP_LIB Z_LIB SYSTEMD_DAEMON_LIBS LIBSCTP HAVE_VALGRIND BITS64 LIBRT M4 HIPE_HELPERS HIPE_ENABLED NATIVE_LIBS_ENABLED ERTS_ENABLE_KERNEL_POLL ac_ct_DED_LD DED_EXT DED_SYS_INCLUDE DED_CFLAGS DED_STATIC_CFLAGS DED_THR_DEFS DED_EMU_THR_DEFS EMU_CC DTRACE ac_ct_DTRACE DTRACE_CPP DTRACE_ENABLED DTRACE_ENABLED_2STEP SSL_INCLUDE SSL_INCDIR SSL_LIBDIR SSL_CRYPTO_LIBNAME SSL_SSL_LIBNAME SSL_CC_RUNTIME_LIBRARY_PATH SSL_LD_RUNTIME_LIBRARY_PATH SSL_DED_LD_RUNTIME_LIBRARY_PATH SSL_DYNAMIC_ONLY SSL_LINK_WITH_KERBEROS STATIC_KERBEROS_LIBS SSL_LINK_WITH_ZLIB STATIC_ZLIB_LIBS REGTOOL os_mon_programs CPU_SUP_LIBS JAVAC ac_ct_CXX CC32 CFLAGS32 LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS ERL_TOP CC CFLAGS STATIC_CFLAGS CFLAG_RUNTIME_LIBRARY_PATH CPP CPPFLAGS CXX CXXFLAGS LD LDFLAGS DED_LD DED_LDFLAGS DED_LD_FLAG_RUNTIME_LIBRARY_PATH LFS_CFLAGS LFS_LDFLAGS LFS_LIBS RANLIB AR GETCONF erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_double_middle_endian erl_xcomp_linux_clock_gettime_correction erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers erl_xcomp_ose_ldflags_pass1 erl_xcomp_ose_ldflags_pass2 erl_xcomp_ose_OSEROOT erl_xcomp_ose_STRIP erl_xcomp_ose_LM_POST_LINK erl_xcomp_ose_LM_SET_CONF erl_xcomp_ose_LM_ELF_SIZE erl_xcomp_ose_LM_LCF erl_xcomp_ose_BEAM_LM_CONF erl_xcomp_ose_EPMD_LM_CONF erl_xcomp_ose_RUN_ERL_LM_CONF erl_xcomp_ose_CONFD erl_xcomp_ose_CRT0_LM build build_cpu build_vendor build_os host host_cpu host_vendor host_os CROSS_COMPILING ac_ct_CC EXEEXT OBJEXT ENABLE_ALLOC_TYPE_VARS PERFCTR_PATH USE_VM_PROBES OTP_RELEASE SYSTEM_VSN OTP_VERSION STATIC_NIFS STATIC_DRIVERS GCC MIXED_CYGWIN_VC MIXED_MSYS_VC MIXED_VC MIXED_CYGWIN_MINGW MIXED_CYGWIN MIXED_MSYS ac_pt_GETCONF DEBUG_FLAGS DEBUG_CFLAGS WFLAGS WERRORFLAGS EGREP EXTERNAL_WORD_SIZE OPSYS ARCH LIBCARBON ac_ct_RANLIB YACC PERL LN_S ac_ct_AR RM MKDIR XSLTPROC FOP XMLLINT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA INSTALL_DIR HCC HCFLAGS vxworks_reclaim LDFLAG_RUNTIME_LIBRARY_PATH ERLANG_OSTYPE DEXPORT ERTS_INTERNAL_X_LIBS ETHR_X_LIBS ETHR_LIBS ETHR_LIB_NAME ETHR_DEFS ETHR_THR_LIB_BASE ETHR_THR_LIB_BASE_DIR ETHR_X86_SSE2_ASM ERTS_BUILD_SMP_EMU EMU_THR_LIB_NAME EMU_THR_X_LIBS EMU_THR_LIBS EMU_THR_DEFS EMU_LOCK_CHECKING THR_LIBS THR_DEFS TERMCAP_LIB Z_LIB SYSTEMD_DAEMON_LIBS LIBSCTP HAVE_VALGRIND BITS64 LIBRT M4 HIPE_HELPERS HIPE_ENABLED NATIVE_LIBS_ENABLED USE_PERFCTR ERTS_ENABLE_KERNEL_POLL ac_ct_DED_LD DED_EXT DED_SYS_INCLUDE DED_CFLAGS DED_STATIC_CFLAGS DED_THR_DEFS DED_EMU_THR_DEFS EMU_CC DTRACE ac_ct_DTRACE DTRACE_CPP DTRACE_ENABLED DTRACE_ENABLED_2STEP SSL_INCLUDE SSL_ROOT SSL_LIBDIR SSL_CRYPTO_LIBNAME SSL_SSL_LIBNAME SSL_CC_RUNTIME_LIBRARY_PATH SSL_LD_RUNTIME_LIBRARY_PATH SSL_DED_LD_RUNTIME_LIBRARY_PATH SSL_DYNAMIC_ONLY SSL_LINK_WITH_KERBEROS STATIC_KERBEROS_LIBS SSL_LINK_WITH_ZLIB STATIC_ZLIB_LIBS REGTOOL os_mon_programs CPU_SUP_LIBS JAVAC ac_ct_CXX CC32 CFLAGS32 LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -850,6 +850,10 @@ ac_env_erl_xcomp_double_middle_endian_value=$erl_xcomp_double_middle_endian ac_cv_env_erl_xcomp_double_middle_endian_set=${erl_xcomp_double_middle_endian+set} ac_cv_env_erl_xcomp_double_middle_endian_value=$erl_xcomp_double_middle_endian +ac_env_erl_xcomp_linux_clock_gettime_correction_set=${erl_xcomp_linux_clock_gettime_correction+set} +ac_env_erl_xcomp_linux_clock_gettime_correction_value=$erl_xcomp_linux_clock_gettime_correction +ac_cv_env_erl_xcomp_linux_clock_gettime_correction_set=${erl_xcomp_linux_clock_gettime_correction+set} +ac_cv_env_erl_xcomp_linux_clock_gettime_correction_value=$erl_xcomp_linux_clock_gettime_correction ac_env_erl_xcomp_linux_nptl_set=${erl_xcomp_linux_nptl+set} ac_env_erl_xcomp_linux_nptl_value=$erl_xcomp_linux_nptl ac_cv_env_erl_xcomp_linux_nptl_set=${erl_xcomp_linux_nptl+set} @@ -1057,9 +1061,8 @@ --enable-vm-probes add dynamic trace probes to the Beam VM (only possible if --with-dynamic-trace is enabled, and then default) + --enable-clock-gettime use clock-gettime for time correction --enable-systemd enable systemd support in epmd - --disable-saved-compile-time - disable saved compile time --enable-static-nifs link nifs statically. If yes then all nifs in all Erlang/OTP applications will be statically linked into the main binary. It is also possible to give a @@ -1084,17 +1087,7 @@ disabled) --enable-prefer-gcc-native-ethr-impls prefer gcc native ethread implementations - --enable-trust-gcc-atomic-builtins-memory-barriers - trust gcc atomic builtins memory barriers --enable-builtin-zlib force use of our own built-in zlib - --enable-prefer-elapsed-monotonic-time-during-suspend - Prefer an OS monotonic time source with elapsed time - during suspend - --disable-prefer-elapsed-monotonic-time-during-suspend - Do not prefer an OS monotonic time source with - elapsed time during suspend - --enable-gettimeofday-as-os-system-time - Force usage of gettimeofday() for OS system time --disable-dynamic-ssl-lib disable using dynamic openssl libraries --enable-sanitizers[=comma-separated list of sanitizers] @@ -1106,6 +1099,8 @@ --with-termcap use termcap (default) --without-termcap do not use any termcap libraries (ncurses,curses,termcap,termlib) + --with-perfctr=PATH specify location of perfctr include and lib + --without-perfctr don't use perfctr (default) --with-dynamic-trace={dtrace|systemtap} specify use of dynamic trace framework, dtrace or systemtap @@ -1125,28 +1120,12 @@ ethread library --with-sparc-memory-order=TSO|PSO|RMO specify sparc memory order (defaults to RMO) - --with-clock-resolution=high|low|default - specify wanted clock resolution - --with-clock-gettime-realtime-id=CLOCKID - specify clock id to use with clock_gettime() for - realtime time) - --with-clock-gettime-monotonic-id=CLOCKID - specify clock id to use with clock_gettime() for - monotonic time) --with-ssl-zlib=PATH specify location of ZLib to be used by OpenSSL --with-ssl-zlib link SSL with Zlib (default if found) --without-ssl-zlib don't link SSL with ZLib --with-ssl=PATH specify location of OpenSSL include and lib --with-ssl use SSL (default) --without-ssl don't use SSL - --with-ssl-incl=PATH location of OpenSSL include dir, if different than - specified by --with-ssl=PATH - --with-ssl-rpath=yes|no|PATHS - runtime library path for OpenSSL. Default is "yes", - which equates to a number of standard locations. If - "no", then no runtime library paths wil be used. - Anything else should be a comma separated list of - paths. --with-javac=JAVAC specify Java compiler to use --with-javac use a Java compiler if found (default) --without-javac don't use any Java compiler @@ -1192,6 +1171,9 @@ erl_xcomp_double_middle_endian double-middle-endian system: yes|no (only used when cross compiling) + erl_xcomp_linux_clock_gettime_correction + clock_gettime() can be used for time correction: yes|no (only + used when cross compiling) erl_xcomp_linux_nptl have Native POSIX Thread Library: yes|no (only used when cross compiling) @@ -1762,6 +1744,7 @@ + if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then # We do not want to use a common cache! cache_file=/dev/null @@ -3192,6 +3175,31 @@ fi; + +# Check whether --with-perfctr or --without-perfctr was given. +if test "${with_perfctr+set}" = set; then + withval="$with_perfctr" + +fi; + +if test "x$with_perfctr" = "xno" -o "x$with_perfctr" = "x" ; then + PERFCTR_PATH= +else + if test ! -f "$with_perfctr/usr.lib/libperfctr.a" ; then + { { echo "$as_me:$LINENO: error: Invalid path to option --with-perfctr=PATH" >&5 +echo "$as_me: error: Invalid path to option --with-perfctr=PATH" >&2;} + { (exit 1); exit 1; }; } + fi + PERFCTR_PATH="$with_perfctr" + +cat >>confdefs.h <<\_ACEOF +#define USE_PERFCTR 1 +_ACEOF + +fi + + + # Check whether --with-dynamic-trace or --without-dynamic-trace was given. if test "${with_dynamic_trace+set}" = set; then withval="$with_dynamic_trace" @@ -3265,6 +3273,18 @@ fi +# Check whether --enable-clock-gettime or --disable-clock-gettime was given. +if test "${enable_clock_gettime+set}" = set; then + enableval="$enable_clock_gettime" + case "$enableval" in + no) clock_gettime_correction=no ;; + *) clock_gettime_correction=yes ;; + esac +else + clock_gettime_correction=unknown +fi; + + # Check whether --with-assumed-cache-line-size or --without-assumed-cache-line-size was given. if test "${with_assumed_cache_line_size+set}" = set; then withval="$with_assumed_cache_line_size" @@ -3297,23 +3317,6 @@ enable_systemd=no fi; -# Check whether --enable-saved-compile-time or --disable-saved-compile-time was given. -if test "${enable_saved_compile_time+set}" = set; then - enableval="$enable_saved_compile_time" - case "$enableval" in - no) save_compile_time=0 ;; - *) save_compile_time=1 ;; - esac -else - save_compile_time=1 -fi; - - -cat >>confdefs.h <<_ACEOF -#define ERTS_SAVED_COMPILE_TIME $save_compile_time -_ACEOF - - OTP_RELEASE= if test "${ERLANG_COMMERCIAL_BUILD}" != ""; then OTP_EXTRA_FLAGS=-DOTP_RELEASE @@ -4186,20 +4189,20 @@ echo "$as_me:$LINENO: checking for mixed cygwin or msys and native VC++ environment" >&5 echo $ECHO_N "checking for mixed cygwin or msys and native VC++ environment... $ECHO_C" >&6 if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then - if test -x /usr/bin/msys-?.0.dll; then - CFLAGS="-O2" - MIXED_MSYS=yes - echo "$as_me:$LINENO: result: MSYS and VC" >&5 -echo "${ECHO_T}MSYS and VC" >&6 - MIXED_MSYS_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" - elif test -x /usr/bin/cygpath; then + if test -x /usr/bin/cygpath; then CFLAGS="-O2" MIXED_CYGWIN=yes echo "$as_me:$LINENO: result: Cygwin and VC" >&5 echo "${ECHO_T}Cygwin and VC" >&6 MIXED_CYGWIN_VC=yes CPPFLAGS="$CPPFLAGS -DERTS_MIXED_CYGWIN_VC" + elif test -x /usr/bin/msysinfo; then + CFLAGS="-O2" + MIXED_MSYS=yes + echo "$as_me:$LINENO: result: MSYS and VC" >&5 +echo "${ECHO_T}MSYS and VC" >&6 + MIXED_MSYS_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" else echo "$as_me:$LINENO: result: undeterminable" >&5 echo "${ECHO_T}undeterminable" >&6 @@ -5598,7 +5601,7 @@ case $chk_opsys_ in win32) OPSYS=win32;; solaris2.*|SunOS5.*) OPSYS=sol2;; - linux*|Linux) OPSYS=linux;; + linux|Linux) OPSYS=linux;; darwin|Darwin) OPSYS=darwin;; freebsd|FreeBSD) OPSYS=freebsd;; *) OPSYS=noopsys @@ -5625,7 +5628,6 @@ powerpc) ARCH=ppc;; ppc) ARCH=ppc;; ppc64) ARCH=ppc64;; - ppc64le) ARCH=ppc64;; "Power Macintosh") ARCH=ppc;; armv5b) ARCH=arm;; armv5teb) ARCH=arm;; @@ -7213,23 +7215,6 @@ _ACEOF -# Check whether --enable-trust-gcc-atomic-builtins-memory-barriers or --disable-trust-gcc-atomic-builtins-memory-barriers was given. -if test "${enable_trust_gcc_atomic_builtins_memory_barriers+set}" = set; then - enableval="$enable_trust_gcc_atomic_builtins_memory_barriers" - case "$enableval" in - yes) trust_gcc_atomic_builtins_mbs=1 ;; - *) trust_gcc_atomic_builtins_mbs=0 ;; - esac -else - trust_gcc_atomic_builtins_mbs=0 -fi; - - -cat >>confdefs.h <<_ACEOF -#define ETHR_TRUST_GCC_ATOMIC_BUILTINS_MEMORY_BARRIERS $trust_gcc_atomic_builtins_mbs -_ACEOF - - # Check whether --with-libatomic_ops or --without-libatomic_ops was given. if test "${with_libatomic_ops+set}" = set; then @@ -8496,509 +8481,12 @@ - - if test "no" = "yes"; then - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_BOOTTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_PRECISE" - else - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_UPTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_UPTIME_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_UPTIME_PRECISE" - fi - - case "try_find_pthread_compatible" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_monotonic="$high_resolution_clock_gettime_monotonic" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_monotonic="$low_resolution_clock_gettime_monotonic" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_MONOTONIC" - ;; - *) - check_msg="custom " - prefer_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_MONOTONIC" - ;; - esac - - echo "$as_me:$LINENO: checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)" >&5 -echo $ECHO_N "checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_raw+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include - -int -main () -{ - - struct timespec ts; - long long result; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_raw=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -erl_cv_clock_gettime_monotonic_raw=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_raw" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_raw" >&6 - - echo "$as_me:$LINENO: checking for clock_gettime() with ${check_msg}monotonic clock type" >&5 -echo $ECHO_N "checking for clock_gettime() with ${check_msg}monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_try_find_pthread_compatible+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include - -int -main () -{ - - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_try_find_pthread_compatible=$clock_type -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -erl_cv_clock_gettime_monotonic_try_find_pthread_compatible=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test $erl_cv_clock_gettime_monotonic_try_find_pthread_compatible = no || break - done - -fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_try_find_pthread_compatible" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_try_find_pthread_compatible" >&6 - - - - -for ac_func in clock_getres clock_get_attributes gethrtime -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - echo "$as_me:$LINENO: checking for mach clock_get_time() with monotonic clock type" >&5 -echo $ECHO_N "checking for mach clock_get_time() with monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_mach_clock_get_time_monotonic+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include - -int -main () -{ - - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - erl_cv_mach_clock_get_time_monotonic=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -erl_cv_mach_clock_get_time_monotonic=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $erl_cv_mach_clock_get_time_monotonic" >&5 -echo "${ECHO_T}$erl_cv_mach_clock_get_time_monotonic" >&6 - - erl_corrected_monotonic_clock=no - case $erl_cv_clock_gettime_monotonic_try_find_pthread_compatible-$ac_cv_func_gethrtime-$erl_cv_mach_clock_get_time_monotonic-$host_os in - *-*-*-win32) - erl_monotonic_clock_func=WindowsAPI - ;; - CLOCK_*-*-*-linux*) - case $erl_cv_clock_gettime_monotonic_try_find_pthread_compatible-$erl_cv_clock_gettime_monotonic_raw in - CLOCK_BOOTTIME-yes|CLOCK_MONOTONIC-yes) - erl_corrected_monotonic_clock=yes - ;; - *) - # We don't trust CLOCK_MONOTONIC to be NTP - # adjusted on linux systems that do not have - # CLOCK_MONOTONIC_RAW (although it seems to - # be...) - ;; - esac - erl_monotonic_clock_func=clock_gettime - ;; - no-no-no-linux*) - erl_monotonic_clock_func=times - ;; - CLOCK_*-*-*-*) - erl_monotonic_clock_func=clock_gettime - ;; - no-yes-*-*) - erl_monotonic_clock_func=gethrtime - ;; - no-no-yes-*) - erl_monotonic_clock_func=mach_clock_get_time - ;; - no-no-no-*) - erl_monotonic_clock_func=none - ;; - esac - - erl_monotonic_clock_low_resolution=no - erl_monotonic_clock_lib= - erl_monotonic_clock_id= - case $erl_monotonic_clock_func in - clock_gettime) - erl_monotonic_clock_id=$erl_cv_clock_gettime_monotonic_try_find_pthread_compatible - for low_res_id in $low_resolution_clock_gettime_monotonic; do - if test $erl_monotonic_clock_id = $low_res_id; then - erl_monotonic_clock_low_resolution=yes - break - fi - done - echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5 -echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6 -if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char clock_gettime (); -int -main () -{ -clock_gettime (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_rt_clock_gettime=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_rt_clock_gettime=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 -echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6 -if test $ac_cv_lib_rt_clock_gettime = yes; then - erl_monotonic_clock_lib="-lrt" -fi - - ;; - mach_clock_get_time) - erl_monotonic_clock_id=SYSTEM_CLOCK - ;; - times) - erl_monotonic_clock_low_resolution=yes - ;; - *) - ;; - esac - - - -case $erl_monotonic_clock_func in - clock_gettime) - -cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_CLOCK_GETTIME_MONOTONIC 1 -_ACEOF - - ;; - mach_clock_get_time) - -cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_MACH_CLOCK_GET_TIME 1 -_ACEOF - - ;; - gethrtime) - -cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_GETHRTIME 1 -_ACEOF - - ;; - *) - ;; -esac - -if test "x$erl_monotonic_clock_id" != "x"; then - -cat >>confdefs.h <<_ACEOF -#define ETHR_MONOTONIC_CLOCK_ID $erl_monotonic_clock_id -_ACEOF - -fi - -ethr_native_atomic_implementation=none ethr_have_native_atomics=no ethr_have_native_spinlock=no ETHR_THR_LIB_BASE="$THR_LIB_NAME" ETHR_THR_LIB_BASE_TYPE="$THR_LIB_TYPE" ETHR_DEFS="$THR_DEFS" -ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS $erl_monotonic_clock_lib" +ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS" ETHR_LIBS= ETHR_LIB_NAME= @@ -10907,10 +10395,7 @@ echo "${ECHO_T}$have_interlocked_op" >&6 fi - if test "$ethr_have_native_atomics" = "yes"; then - ethr_native_atomic_implementation=windows - ethr_have_native_spinlock=yes - fi + test "$ethr_have_native_atomics" = "yes" && ethr_have_native_spinlock=yes ;; pthread|ose_threads) @@ -12699,98 +12184,6 @@ fi - if test "x$erl_monotonic_clock_id" != "x"; then - echo "$as_me:$LINENO: checking whether pthread_cond_timedwait() can use the monotonic clock $erl_monotonic_clock_id for timeout" >&5 -echo $ECHO_N "checking whether pthread_cond_timedwait() can use the monotonic clock $erl_monotonic_clock_id for timeout... $ECHO_C" >&6 - pthread_cond_timedwait_monotonic=no - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - #if defined(ETHR_NEED_NPTL_PTHREAD_H) - # include - #elif defined(ETHR_HAVE_MIT_PTHREAD_H) - # include - #elif defined(ETHR_HAVE_PTHREAD_H) - # include - #endif - #ifdef ETHR_TIME_WITH_SYS_TIME - # include - # include - #else - # ifdef ETHR_HAVE_SYS_TIME_H - # include - # else - # include - # endif - #endif - #if defined(ETHR_HAVE_MACH_CLOCK_GET_TIME) - # include - # include - #endif - -int -main () -{ - - int res; - pthread_condattr_t attr; - pthread_cond_t cond; - struct timespec cond_timeout; - pthread_mutex_t mutex; - res = pthread_condattr_init(&attr); - res = pthread_condattr_setclock(&attr, ETHR_MONOTONIC_CLOCK_ID); - res = pthread_cond_init(&cond, &attr); - res = pthread_cond_timedwait(&cond, &mutex, &cond_timeout); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - pthread_cond_timedwait_monotonic=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - echo "$as_me:$LINENO: result: $pthread_cond_timedwait_monotonic" >&5 -echo "${ECHO_T}$pthread_cond_timedwait_monotonic" >&6 - if test $pthread_cond_timedwait_monotonic = yes; then - -cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC 1 -_ACEOF - - fi - fi - linux_futex=no echo "$as_me:$LINENO: checking for Linux futexes" >&5 echo $ECHO_N "checking for Linux futexes... $ECHO_C" >&6 @@ -12859,30 +12252,34 @@ _ACEOF - pthread_setname=no - echo "$as_me:$LINENO: checking for pthread_setname_np" >&5 -echo $ECHO_N "checking for pthread_setname_np... $ECHO_C" >&6 - old_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Werror" - cat >conftest.$ac_ext <<_ACEOF + fi + + echo "$as_me:$LINENO: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6 +if test "${ac_cv_type_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#define __USE_GNU - #include +$ac_includes_default int main () { -pthread_setname_np(pthread_self(), "name"); +if ((int *) 0) + return 0; +if (sizeof (int)) + return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -12896,317 +12293,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - pthread_setname=linux + ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __USE_GNU - #include -int -main () -{ -pthread_set_name_np(pthread_self(), "name"); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - pthread_setname=bsd -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define _DARWIN_C_SOURCE - #include -int -main () -{ -pthread_setname_np("name"); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - pthread_setname=darwin -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - echo "$as_me:$LINENO: result: $pthread_setname" >&5 -echo "${ECHO_T}$pthread_setname" >&6 - case $pthread_setname in - linux) -cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_PTHREAD_SETNAME_NP_2 1 -_ACEOF -;; - bsd) -cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_PTHREAD_SET_NAME_NP_2 1 -_ACEOF -;; - darwin) -cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_PTHREAD_SETNAME_NP_1 1 -_ACEOF -;; - *) ;; - esac - - pthread_getname=no - echo "$as_me:$LINENO: checking for pthread_getname_np" >&5 -echo $ECHO_N "checking for pthread_getname_np... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __USE_GNU - #define _DARWIN_C_SOURCE - #include -int -main () -{ -char buff[256]; pthread_getname_np(pthread_self(), buff, 256); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - pthread_getname=linux -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __USE_GNU - #define _DARWIN_C_SOURCE - #include -int -main () -{ -char buff[256]; pthread_getname_np(pthread_self(), buff); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - pthread_getname=ibm -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - echo "$as_me:$LINENO: result: $pthread_getname" >&5 -echo "${ECHO_T}$pthread_getname" >&6 - case $pthread_getname in - linux) -cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_PTHREAD_GETNAME_NP_3 1 -_ACEOF -;; - ibm) -cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_PTHREAD_GETNAME_NP_2 1 -_ACEOF -;; - *) ;; - esac - CFLAGS=$old_CFLAGS - - fi ## test "x$THR_LIB_NAME" = "xpthread" - - if test "X$disable_native_ethr_impls" = "Xyes"; then - ethr_have_native_atomics=no - else - - - echo "$as_me:$LINENO: checking for short" >&5 -echo $ECHO_N "checking for short... $ECHO_C" >&6 -if test "${ac_cv_type_short+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((short *) 0) - return 0; -if (sizeof (short)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_short=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_short=no +ac_cv_type_int=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 -echo "${ECHO_T}$ac_cv_type_short" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6 -echo "$as_me:$LINENO: checking size of short" >&5 -echo $ECHO_N "checking size of short... $ECHO_C" >&6 -if test "${ac_cv_sizeof_short+set}" = set; then +echo "$as_me:$LINENO: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6 +if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_short" = yes; then + if test "$ac_cv_type_int" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -13223,7 +12333,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; test_array [0] = 0 ; @@ -13264,7 +12374,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; @@ -13321,7 +12431,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; test_array [0] = 0 ; @@ -13362,7 +12472,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; test_array [0] = 0 ; @@ -13427,7 +12537,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; @@ -13466,10 +12576,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_short=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 +?*) ac_cv_sizeof_int=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (short), 77 +echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -13488,8 +12598,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (short)); } -unsigned long ulongval () { return (long) (sizeof (short)); } +long longval () { return (long) (sizeof (int)); } +unsigned long ulongval () { return (long) (sizeof (int)); } #include #include int @@ -13499,17 +12609,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (short))) < 0) + if (((long) (sizeof (int))) < 0) { long i = longval (); - if (i != ((long) (sizeof (short)))) + if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (short)))) + if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%lu\n", i); } @@ -13530,16 +12640,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_short=`cat conftest.val` + ac_cv_sizeof_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (short), 77 +echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -13548,19 +12658,19 @@ fi rm -f conftest.val else - ac_cv_sizeof_short=0 + ac_cv_sizeof_int=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 -echo "${ECHO_T}$ac_cv_sizeof_short" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_SHORT $ac_cv_sizeof_short +#define SIZEOF_INT $ac_cv_sizeof_int _ACEOF - echo "$as_me:$LINENO: checking for int" >&5 -echo $ECHO_N "checking for int... $ECHO_C" >&6 -if test "${ac_cv_type_int+set}" = set; then + echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6 +if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -13573,9 +12683,9 @@ int main () { -if ((int *) 0) +if ((long *) 0) return 0; -if (sizeof (int)) +if (sizeof (long)) return 0; ; return 0; @@ -13603,24 +12713,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_int=yes + ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_int=no +ac_cv_type_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 -echo "${ECHO_T}$ac_cv_type_int" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 -echo "$as_me:$LINENO: checking size of int" >&5 -echo $ECHO_N "checking size of int... $ECHO_C" >&6 -if test "${ac_cv_sizeof_int+set}" = set; then +echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_int" = yes; then + if test "$ac_cv_type_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -13637,7 +12747,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; test_array [0] = 0 ; @@ -13678,7 +12788,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; @@ -13735,7 +12845,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; test_array [0] = 0 ; @@ -13776,7 +12886,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; test_array [0] = 0 ; @@ -13841,7 +12951,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; @@ -13880,10 +12990,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_int=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +?*) ac_cv_sizeof_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (int), 77 +echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -13902,8 +13012,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (int)); } -unsigned long ulongval () { return (long) (sizeof (int)); } +long longval () { return (long) (sizeof (long)); } +unsigned long ulongval () { return (long) (sizeof (long)); } #include #include int @@ -13913,17 +13023,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (int))) < 0) + if (((long) (sizeof (long))) < 0) { long i = longval (); - if (i != ((long) (sizeof (int)))) + if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (int)))) + if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%lu\n", i); } @@ -13944,16 +13054,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_int=`cat conftest.val` + ac_cv_sizeof_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (int), 77 +echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -13962,19 +13072,19 @@ fi rm -f conftest.val else - ac_cv_sizeof_int=0 + ac_cv_sizeof_long=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 -echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT $ac_cv_sizeof_int +#define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF - echo "$as_me:$LINENO: checking for long" >&5 -echo $ECHO_N "checking for long... $ECHO_C" >&6 -if test "${ac_cv_type_long+set}" = set; then + echo "$as_me:$LINENO: checking for long long" >&5 +echo $ECHO_N "checking for long long... $ECHO_C" >&6 +if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -13987,9 +13097,9 @@ int main () { -if ((long *) 0) +if ((long long *) 0) return 0; -if (sizeof (long)) +if (sizeof (long long)) return 0; ; return 0; @@ -14017,24 +13127,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_long=yes + ac_cv_type_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_long=no +ac_cv_type_long_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 -echo "${ECHO_T}$ac_cv_type_long" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_long_long" >&6 -echo "$as_me:$LINENO: checking size of long" >&5 -echo $ECHO_N "checking size of long... $ECHO_C" >&6 -if test "${ac_cv_sizeof_long+set}" = set; then +echo "$as_me:$LINENO: checking size of long long" >&5 +echo $ECHO_N "checking size of long long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_long" = yes; then + if test "$ac_cv_type_long_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -14051,7 +13161,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; test_array [0] = 0 ; @@ -14092,7 +13202,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; @@ -14149,7 +13259,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; test_array [0] = 0 ; @@ -14190,7 +13300,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; test_array [0] = 0 ; @@ -14255,7 +13365,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; @@ -14294,10 +13404,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_long=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +?*) ac_cv_sizeof_long_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long), 77 +echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -14316,8 +13426,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (long)); } -unsigned long ulongval () { return (long) (sizeof (long)); } +long longval () { return (long) (sizeof (long long)); } +unsigned long ulongval () { return (long) (sizeof (long long)); } #include #include int @@ -14327,17 +13437,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (long))) < 0) + if (((long) (sizeof (long long))) < 0) { long i = longval (); - if (i != ((long) (sizeof (long)))) + if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (long)))) + if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%lu\n", i); } @@ -14358,16 +13468,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_long=`cat conftest.val` + ac_cv_sizeof_long_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long), 77 +echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -14376,19 +13486,19 @@ fi rm -f conftest.val else - ac_cv_sizeof_long=0 + ac_cv_sizeof_long_long=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 -echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG $ac_cv_sizeof_long +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF - echo "$as_me:$LINENO: checking for long long" >&5 -echo $ECHO_N "checking for long long... $ECHO_C" >&6 -if test "${ac_cv_type_long_long+set}" = set; then + echo "$as_me:$LINENO: checking for __int128_t" >&5 +echo $ECHO_N "checking for __int128_t... $ECHO_C" >&6 +if test "${ac_cv_type___int128_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -14401,9 +13511,9 @@ int main () { -if ((long long *) 0) +if ((__int128_t *) 0) return 0; -if (sizeof (long long)) +if (sizeof (__int128_t)) return 0; ; return 0; @@ -14431,24 +13541,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_long_long=yes + ac_cv_type___int128_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_long_long=no +ac_cv_type___int128_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 -echo "${ECHO_T}$ac_cv_type_long_long" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type___int128_t" >&5 +echo "${ECHO_T}$ac_cv_type___int128_t" >&6 -echo "$as_me:$LINENO: checking size of long long" >&5 -echo $ECHO_N "checking size of long long... $ECHO_C" >&6 -if test "${ac_cv_sizeof_long_long+set}" = set; then +echo "$as_me:$LINENO: checking size of __int128_t" >&5 +echo $ECHO_N "checking size of __int128_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof___int128_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_long_long" = yes; then + if test "$ac_cv_type___int128_t" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -14465,7 +13575,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) >= 0)]; test_array [0] = 0 ; @@ -14506,7 +13616,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -14563,7 +13673,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) < 0)]; test_array [0] = 0 ; @@ -14604,7 +13714,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) >= $ac_mid)]; test_array [0] = 0 ; @@ -14669,7 +13779,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -14708,10 +13818,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_long_long=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 +?*) ac_cv_sizeof___int128_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (__int128_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long long), 77 +echo "$as_me: error: cannot compute sizeof (__int128_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -14730,8 +13840,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (long long)); } -unsigned long ulongval () { return (long) (sizeof (long long)); } +long longval () { return (long) (sizeof (__int128_t)); } +unsigned long ulongval () { return (long) (sizeof (__int128_t)); } #include #include int @@ -14741,17 +13851,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (long long))) < 0) + if (((long) (sizeof (__int128_t))) < 0) { long i = longval (); - if (i != ((long) (sizeof (long long)))) + if (i != ((long) (sizeof (__int128_t)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (long long)))) + if (i != ((long) (sizeof (__int128_t)))) exit (1); fprintf (f, "%lu\n", i); } @@ -14772,16 +13882,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_long_long=`cat conftest.val` + ac_cv_sizeof___int128_t=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (__int128_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long long), 77 +echo "$as_me: error: cannot compute sizeof (__int128_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -14790,105 +13900,80 @@ fi rm -f conftest.val else - ac_cv_sizeof_long_long=0 + ac_cv_sizeof___int128_t=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 -echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof___int128_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof___int128_t" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long +#define SIZEOF___INT128_T $ac_cv_sizeof___int128_t _ACEOF - echo "$as_me:$LINENO: checking for __int128_t" >&5 -echo $ECHO_N "checking for __int128_t... $ECHO_C" >&6 -if test "${ac_cv_type___int128_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((__int128_t *) 0) - return 0; -if (sizeof (__int128_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type___int128_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type___int128_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type___int128_t" >&5 -echo "${ECHO_T}$ac_cv_type___int128_t" >&6 + if test "$ac_cv_sizeof_int" = "4"; then + int32="int" + elif test "$ac_cv_sizeof_long" = "4"; then + int32="long" + elif test "$ac_cv_sizeof_long_long" = "4"; then + int32="long long" + else + { { echo "$as_me:$LINENO: error: No 32-bit type found" >&5 +echo "$as_me: error: No 32-bit type found" >&2;} + { (exit 1); exit 1; }; } + fi -echo "$as_me:$LINENO: checking size of __int128_t" >&5 -echo $ECHO_N "checking size of __int128_t... $ECHO_C" >&6 -if test "${ac_cv_sizeof___int128_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$ac_cv_type___int128_t" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF + if test "$ac_cv_sizeof_int" = "8"; then + int64="int" + elif test "$ac_cv_sizeof_long" = "8"; then + int64="long" + elif test "$ac_cv_sizeof_long_long" = "8"; then + int64="long long" + else + { { echo "$as_me:$LINENO: error: No 64-bit type found" >&5 +echo "$as_me: error: No 64-bit type found" >&2;} + { (exit 1); exit 1; }; } + fi + + int128=no + if test "$ac_cv_sizeof___int128_t" = "16"; then + int128="__int128_t" + fi + + if test "X$disable_native_ethr_impls" = "Xyes"; then + ethr_have_native_atomics=no + else + + echo "$as_me:$LINENO: checking for 32-bit __sync_val_compare_and_swap()" >&5 +echo $ECHO_N "checking for 32-bit __sync_val_compare_and_swap()... $ECHO_C" >&6 + case "3" in + "1") sync_call="__sync_val_compare_and_swap(&var);";; + "2") sync_call="__sync_val_compare_and_swap(&var, ($int32) 0);";; + "3") sync_call="__sync_val_compare_and_swap(&var, ($int32) 0, ($int32) 0);";; + esac + have_sync_op=no + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) >= 0)]; -test_array [0] = 0 + + $int32 res; + volatile $int32 var; + res = $sync_call ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -14902,34 +13987,60 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do + have_sync_op=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + test $have_sync_op = yes && +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32 1 +_ACEOF + + echo "$as_me:$LINENO: result: $have_sync_op" >&5 +echo "${ECHO_T}$have_sync_op" >&6 + + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + + echo "$as_me:$LINENO: checking for 32-bit __sync_add_and_fetch()" >&5 +echo $ECHO_N "checking for 32-bit __sync_add_and_fetch()... $ECHO_C" >&6 + case "2" in + "1") sync_call="__sync_add_and_fetch(&var);";; + "2") sync_call="__sync_add_and_fetch(&var, ($int32) 0);";; + "3") sync_call="__sync_add_and_fetch(&var, ($int32) 0, ($int32) 0);";; + esac + have_sync_op=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) <= $ac_mid)]; -test_array [0] = 0 + + $int32 res; + volatile $int32 var; + res = $sync_call ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -14943,50 +14054,59 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid; break + have_sync_op=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + test $have_sync_op = yes && +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE___SYNC_ADD_AND_FETCH32 1 +_ACEOF -cat >conftest.$ac_ext <<_ACEOF + echo "$as_me:$LINENO: result: $have_sync_op" >&5 +echo "${ECHO_T}$have_sync_op" >&6 + + + echo "$as_me:$LINENO: checking for 32-bit __sync_fetch_and_and()" >&5 +echo $ECHO_N "checking for 32-bit __sync_fetch_and_and()... $ECHO_C" >&6 + case "2" in + "1") sync_call="__sync_fetch_and_and(&var);";; + "2") sync_call="__sync_fetch_and_and(&var, ($int32) 0);";; + "3") sync_call="__sync_fetch_and_and(&var, ($int32) 0, ($int32) 0);";; + esac + have_sync_op=no + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) < 0)]; -test_array [0] = 0 + + $int32 res; + volatile $int32 var; + res = $sync_call ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -15000,34 +14120,59 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do + have_sync_op=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + test $have_sync_op = yes && +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE___SYNC_FETCH_AND_AND32 1 +_ACEOF + + echo "$as_me:$LINENO: result: $have_sync_op" >&5 +echo "${ECHO_T}$have_sync_op" >&6 + + + echo "$as_me:$LINENO: checking for 32-bit __sync_fetch_and_or()" >&5 +echo $ECHO_N "checking for 32-bit __sync_fetch_and_or()... $ECHO_C" >&6 + case "2" in + "1") sync_call="__sync_fetch_and_or(&var);";; + "2") sync_call="__sync_fetch_and_or(&var, ($int32) 0);";; + "3") sync_call="__sync_fetch_and_or(&var, ($int32) 0, ($int32) 0);";; + esac + have_sync_op=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) >= $ac_mid)]; -test_array [0] = 0 + + $int32 res; + volatile $int32 var; + res = $sync_call ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -15041,58 +14186,60 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=$ac_mid; break + have_sync_op=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + test $have_sync_op = yes && +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE___SYNC_FETCH_AND_OR32 1 +_ACEOF -ac_lo= ac_hi= -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF + echo "$as_me:$LINENO: result: $have_sync_op" >&5 +echo "${ECHO_T}$have_sync_op" >&6 + + + + echo "$as_me:$LINENO: checking for 64-bit __sync_val_compare_and_swap()" >&5 +echo $ECHO_N "checking for 64-bit __sync_val_compare_and_swap()... $ECHO_C" >&6 + case "3" in + "1") sync_call="__sync_val_compare_and_swap(&var);";; + "2") sync_call="__sync_val_compare_and_swap(&var, ($int64) 0);";; + "3") sync_call="__sync_val_compare_and_swap(&var, ($int64) 0, ($int64) 0);";; + esac + have_sync_op=no + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) <= $ac_mid)]; -test_array [0] = 0 + + $int64 res; + volatile $int64 var; + res = $sync_call ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -15106,152 +14253,39 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid + have_sync_op=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr '(' $ac_mid ')' + 1` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof___int128_t=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (__int128_t), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (__int128_t), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (__int128_t)); } -unsigned long ulongval () { return (long) (sizeof (__int128_t)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (__int128_t))) < 0) - { - long i = longval (); - if (i != ((long) (sizeof (__int128_t)))) - exit (1); - fprintf (f, "%ld\n", i); - } - else - { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (__int128_t)))) - exit (1); - fprintf (f, "%lu\n", i); - } - exit (ferror (f) || fclose (f) != 0); - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof___int128_t=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (__int128_t), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (__int128_t), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -fi -rm -f conftest.val -else - ac_cv_sizeof___int128_t=0 -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof___int128_t" >&5 -echo "${ECHO_T}$ac_cv_sizeof___int128_t" >&6 -cat >>confdefs.h <<_ACEOF -#define SIZEOF___INT128_T $ac_cv_sizeof___int128_t +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + test $have_sync_op = yes && +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64 1 _ACEOF + echo "$as_me:$LINENO: result: $have_sync_op" >&5 +echo "${ECHO_T}$have_sync_op" >&6 + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes - if test "$ac_cv_sizeof_short" = "4"; then - gcc_atomic_type32="short" - elif test "$ac_cv_sizeof_int" = "4"; then - gcc_atomic_type32="int" - elif test "$ac_cv_sizeof_long" = "4"; then - gcc_atomic_type32="long" - else - { { echo "$as_me:$LINENO: error: No 32-bit type found" >&5 -echo "$as_me: error: No 32-bit type found" >&2;} - { (exit 1); exit 1; }; } - fi - - if test "$ac_cv_sizeof_int" = "8"; then - gcc_atomic_type64="int" - elif test "$ac_cv_sizeof_long" = "8"; then - gcc_atomic_type64="long" - elif test "$ac_cv_sizeof_long_long" = "8"; then - gcc_atomic_type64="long long" - else - { { echo "$as_me:$LINENO: error: No 64-bit type found" >&5 -echo "$as_me: error: No 64-bit type found" >&2;} - { (exit 1); exit 1; }; } - fi - - if test "$ac_cv_sizeof___int128_t" = "16"; then - gcc_atomic_type128="__int128_t" - else - gcc_atomic_type128="#error " - fi - echo "$as_me:$LINENO: checking for a working __sync_synchronize()" >&5 -echo $ECHO_N "checking for a working __sync_synchronize()... $ECHO_C" >&6 -if test "${ethr_cv___sync_synchronize+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv___sync_synchronize=no - cat >conftest.$ac_ext <<_ACEOF + echo "$as_me:$LINENO: checking for 64-bit __sync_add_and_fetch()" >&5 +echo $ECHO_N "checking for 64-bit __sync_add_and_fetch()... $ECHO_C" >&6 + case "2" in + "1") sync_call="__sync_add_and_fetch(&var);";; + "2") sync_call="__sync_add_and_fetch(&var, ($int64) 0);";; + "3") sync_call="__sync_add_and_fetch(&var, ($int64) 0, ($int64) 0);";; + esac + have_sync_op=no + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -15261,7 +14295,11 @@ int main () { - __sync_synchronize(); + + $int64 res; + volatile $int64 var; + res = $sync_call + ; return 0; } @@ -15288,7 +14326,7 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv___sync_synchronize=yes + have_sync_op=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -15296,109 +14334,24 @@ fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test $ethr_cv___sync_synchronize = yes; then - # - # Old gcc versions on at least x86 have a buggy - # __sync_synchronize() which does not emit a - # memory barrier. We try to detect this by - # compiling to assembly with and without - # __sync_synchronize() and compare the results. - # - - ethr_test_filename="chk_if___sync_synchronize_noop_config1test.$$" - cat > "${ethr_test_filename}.c" < "${ethr_test_filename}.c" </dev/null 2>&1; then - ethr___sync_synchronize_noop=yes - else - ethr___sync_synchronize_noop=no - fi - rm -f "${ethr_test_filename}.c" "${ethr_test_filename}1.o" "${ethr_test_filename}2.o" - - if test $ethr___sync_synchronize_noop = yes; then - # Got a buggy implementation of - # __sync_synchronize... - ethr_cv___sync_synchronize="no; buggy implementation" - fi - fi - -fi -echo "$as_me:$LINENO: result: $ethr_cv___sync_synchronize" >&5 -echo "${ECHO_T}$ethr_cv___sync_synchronize" >&6 - - if test "$ethr_cv___sync_synchronize" = "yes"; then - have_sync_synchronize_value="~0" - else - have_sync_synchronize_value="0" - fi - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___sync_synchronize $have_sync_synchronize_value + test $have_sync_op = yes && +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE___SYNC_ADD_AND_FETCH64 1 _ACEOF + echo "$as_me:$LINENO: result: $have_sync_op" >&5 +echo "${ECHO_T}$have_sync_op" >&6 - # __sync_add_and_fetch - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __sync_add_and_fetch in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, __ATOMIC_RELAXED); res = __sync_add_and_fetch(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_add_and_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_add_and_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - { { echo "$as_me:$LINENO: error: Internal error: missing implementation for __sync_add_and_fetch" >&5 -echo "$as_me: error: Internal error: missing implementation for __sync_add_and_fetch" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - echo "$as_me:$LINENO: checking for 32-bit __sync_add_and_fetch()" >&5 -echo $ECHO_N "checking for 32-bit __sync_add_and_fetch()... $ECHO_C" >&6 -if test "${ethr_cv_32bit___sync_add_and_fetch+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv_32bit___sync_add_and_fetch=no - cat >conftest.$ac_ext <<_ACEOF + echo "$as_me:$LINENO: checking for 64-bit __sync_fetch_and_and()" >&5 +echo $ECHO_N "checking for 64-bit __sync_fetch_and_and()... $ECHO_C" >&6 + case "2" in + "1") sync_call="__sync_fetch_and_and(&var);";; + "2") sync_call="__sync_fetch_and_and(&var, ($int64) 0);";; + "3") sync_call="__sync_fetch_and_and(&var, ($int64) 0, ($int64) 0);";; + esac + have_sync_op=no + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -15408,7 +14361,11 @@ int main () { -$atomic32_call + + $int64 res; + volatile $int64 var; + res = $sync_call + ; return 0; } @@ -15435,7 +14392,7 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_32bit___sync_add_and_fetch=yes + have_sync_op=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -15443,18 +14400,24 @@ fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + test $have_sync_op = yes && +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE___SYNC_FETCH_AND_AND64 1 +_ACEOF + + echo "$as_me:$LINENO: result: $have_sync_op" >&5 +echo "${ECHO_T}$have_sync_op" >&6 -fi -echo "$as_me:$LINENO: result: $ethr_cv_32bit___sync_add_and_fetch" >&5 -echo "${ECHO_T}$ethr_cv_32bit___sync_add_and_fetch" >&6 - echo "$as_me:$LINENO: checking for 64-bit __sync_add_and_fetch()" >&5 -echo $ECHO_N "checking for 64-bit __sync_add_and_fetch()... $ECHO_C" >&6 -if test "${ethr_cv_64bit___sync_add_and_fetch+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ethr_cv_64bit___sync_add_and_fetch=no - cat >conftest.$ac_ext <<_ACEOF + echo "$as_me:$LINENO: checking for 64-bit __sync_fetch_and_or()" >&5 +echo $ECHO_N "checking for 64-bit __sync_fetch_and_or()... $ECHO_C" >&6 + case "2" in + "1") sync_call="__sync_fetch_and_or(&var);";; + "2") sync_call="__sync_fetch_and_or(&var, ($int64) 0);";; + "3") sync_call="__sync_fetch_and_or(&var, ($int64) 0, ($int64) 0);";; + esac + have_sync_op=no + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -15464,7 +14427,11 @@ int main () { -$atomic64_call + + $int64 res; + volatile $int64 var; + res = $sync_call + ; return 0; } @@ -15491,7 +14458,7 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_64bit___sync_add_and_fetch=yes + have_sync_op=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -15499,18 +14466,26 @@ fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + test $have_sync_op = yes && +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE___SYNC_FETCH_AND_OR64 1 +_ACEOF -fi -echo "$as_me:$LINENO: result: $ethr_cv_64bit___sync_add_and_fetch" >&5 -echo "${ECHO_T}$ethr_cv_64bit___sync_add_and_fetch" >&6 - echo "$as_me:$LINENO: checking for 128-bit __sync_add_and_fetch()" >&5 -echo $ECHO_N "checking for 128-bit __sync_add_and_fetch()... $ECHO_C" >&6 -if test "${ethr_cv_128bit___sync_add_and_fetch+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + echo "$as_me:$LINENO: result: $have_sync_op" >&5 +echo "${ECHO_T}$have_sync_op" >&6 - ethr_cv_128bit___sync_add_and_fetch=no - cat >conftest.$ac_ext <<_ACEOF + + if test $int128 != no; then + + echo "$as_me:$LINENO: checking for 128-bit __sync_val_compare_and_swap()" >&5 +echo $ECHO_N "checking for 128-bit __sync_val_compare_and_swap()... $ECHO_C" >&6 + case "3" in + "1") sync_call="__sync_val_compare_and_swap(&var);";; + "2") sync_call="__sync_val_compare_and_swap(&var, ($int128) 0);";; + "3") sync_call="__sync_val_compare_and_swap(&var, ($int128) 0, ($int128) 0);";; + esac + have_sync_op=no + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -15520,7 +14495,11 @@ int main () { -$atomic128_call + + $int128 res; + volatile $int128 var; + res = $sync_call + ; return 0; } @@ -15547,7 +14526,7 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_128bit___sync_add_and_fetch=yes + have_sync_op=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -15555,91 +14534,53 @@ fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_128bit___sync_add_and_fetch" >&5 -echo "${ECHO_T}$ethr_cv_128bit___sync_add_and_fetch" >&6 - - case $ethr_cv_128bit___sync_add_and_fetch-$ethr_cv_64bit___sync_add_and_fetch-$ethr_cv_32bit___sync_add_and_fetch in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___sync_add_and_fetch $have_atomic_ops + test $have_sync_op = yes && +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP128 1 _ACEOF + echo "$as_me:$LINENO: result: $have_sync_op" >&5 +echo "${ECHO_T}$have_sync_op" >&6 + fi - # __sync_fetch_and_and - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __sync_fetch_and_and in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, __ATOMIC_RELAXED); res = __sync_fetch_and_and(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_fetch_and_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_fetch_and_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - { { echo "$as_me:$LINENO: error: Internal error: missing implementation for __sync_fetch_and_and" >&5 -echo "$as_me: error: Internal error: missing implementation for __sync_fetch_and_and" >&2;} + echo "$as_me:$LINENO: checking for a usable libatomic_ops implementation" >&5 +echo $ECHO_N "checking for a usable libatomic_ops implementation... $ECHO_C" >&6 + case "x$with_libatomic_ops" in + xno | xyes | x) + libatomic_ops_include= + ;; + *) + if test -d "${with_libatomic_ops}/include"; then + libatomic_ops_include="-I$with_libatomic_ops/include" + CPPFLAGS="$CPPFLAGS $libatomic_ops_include" + else + { { echo "$as_me:$LINENO: error: libatomic_ops include directory $with_libatomic_ops/include not found" >&5 +echo "$as_me: error: libatomic_ops include directory $with_libatomic_ops/include not found" >&2;} { (exit 1); exit 1; }; } - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - echo "$as_me:$LINENO: checking for 32-bit __sync_fetch_and_and()" >&5 -echo $ECHO_N "checking for 32-bit __sync_fetch_and_and()... $ECHO_C" >&6 -if test "${ethr_cv_32bit___sync_fetch_and_and+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv_32bit___sync_fetch_and_and=no - cat >conftest.$ac_ext <<_ACEOF + fi;; + esac + ethr_have_libatomic_ops=no + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +#include "atomic_ops.h" int main () { -$atomic32_call + + volatile AO_t x; + AO_t y; + int z; + + AO_nop_full(); + AO_store(&x, (AO_t) 0); + z = AO_load(&x); + z = AO_compare_and_swap_full(&x, (AO_t) 0, (AO_t) 1); + ; return 0; } @@ -15666,7 +14607,8 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_32bit___sync_fetch_and_and=yes + ethr_have_native_atomics=yes + ethr_have_libatomic_ops=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -15674,35 +14616,39 @@ fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_32bit___sync_fetch_and_and" >&5 -echo "${ECHO_T}$ethr_cv_32bit___sync_fetch_and_and" >&6 - echo "$as_me:$LINENO: checking for 64-bit __sync_fetch_and_and()" >&5 -echo $ECHO_N "checking for 64-bit __sync_fetch_and_and()... $ECHO_C" >&6 -if test "${ethr_cv_64bit___sync_fetch_and_and+set}" = set; then + echo "$as_me:$LINENO: result: $ethr_have_libatomic_ops" >&5 +echo "${ECHO_T}$ethr_have_libatomic_ops" >&6 + if test $ethr_have_libatomic_ops = yes; then + echo "$as_me:$LINENO: checking for AO_t" >&5 +echo $ECHO_N "checking for AO_t... $ECHO_C" >&6 +if test "${ac_cv_type_AO_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - ethr_cv_64bit___sync_fetch_and_and=no - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + #include + #include "atomic_ops.h" + + int main () { -$atomic64_call +if ((AO_t *) 0) + return 0; +if (sizeof (AO_t)) + return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -15716,49 +14662,60 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_64bit___sync_fetch_and_and=yes + ac_cv_type_AO_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_AO_t=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ethr_cv_64bit___sync_fetch_and_and" >&5 -echo "${ECHO_T}$ethr_cv_64bit___sync_fetch_and_and" >&6 - echo "$as_me:$LINENO: checking for 128-bit __sync_fetch_and_and()" >&5 -echo $ECHO_N "checking for 128-bit __sync_fetch_and_and()... $ECHO_C" >&6 -if test "${ethr_cv_128bit___sync_fetch_and_and+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else +echo "$as_me:$LINENO: result: $ac_cv_type_AO_t" >&5 +echo "${ECHO_T}$ac_cv_type_AO_t" >&6 - ethr_cv_128bit___sync_fetch_and_and=no - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking size of AO_t" >&5 +echo $ECHO_N "checking size of AO_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof_AO_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_AO_t" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + #include + #include "atomic_ops.h" + + int main () { -$atomic128_call +static int test_array [1 - 2 * !(((long) (sizeof (AO_t))) >= 0)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -15772,112 +14729,38 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_128bit___sync_fetch_and_and=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_128bit___sync_fetch_and_and" >&5 -echo "${ECHO_T}$ethr_cv_128bit___sync_fetch_and_and" >&6 - - case $ethr_cv_128bit___sync_fetch_and_and-$ethr_cv_64bit___sync_fetch_and_and-$ethr_cv_32bit___sync_fetch_and_and in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___sync_fetch_and_and $have_atomic_ops -_ACEOF - - - - # __sync_fetch_and_or - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __sync_fetch_and_or in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, __ATOMIC_RELAXED); res = __sync_fetch_and_or(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_fetch_and_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_fetch_and_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - { { echo "$as_me:$LINENO: error: Internal error: missing implementation for __sync_fetch_and_or" >&5 -echo "$as_me: error: Internal error: missing implementation for __sync_fetch_and_or" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - echo "$as_me:$LINENO: checking for 32-bit __sync_fetch_and_or()" >&5 -echo $ECHO_N "checking for 32-bit __sync_fetch_and_or()... $ECHO_C" >&6 -if test "${ethr_cv_32bit___sync_fetch_and_or+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv_32bit___sync_fetch_and_or=no - cat >conftest.$ac_ext <<_ACEOF + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + #include + #include "atomic_ops.h" + + int main () { -$atomic32_call +static int test_array [1 - 2 * !(((long) (sizeof (AO_t))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -15891,49 +14774,54 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_32bit___sync_fetch_and_or=yes + ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_32bit___sync_fetch_and_or" >&5 -echo "${ECHO_T}$ethr_cv_32bit___sync_fetch_and_or" >&6 - echo "$as_me:$LINENO: checking for 64-bit __sync_fetch_and_or()" >&5 -echo $ECHO_N "checking for 64-bit __sync_fetch_and_or()... $ECHO_C" >&6 -if test "${ethr_cv_64bit___sync_fetch_and_or+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ethr_cv_64bit___sync_fetch_and_or=no - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + #include + #include "atomic_ops.h" + + int main () { -$atomic64_call +static int test_array [1 - 2 * !(((long) (sizeof (AO_t))) < 0)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -15947,49 +14835,38 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_64bit___sync_fetch_and_or=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_64bit___sync_fetch_and_or" >&5 -echo "${ECHO_T}$ethr_cv_64bit___sync_fetch_and_or" >&6 - echo "$as_me:$LINENO: checking for 128-bit __sync_fetch_and_or()" >&5 -echo $ECHO_N "checking for 128-bit __sync_fetch_and_or()... $ECHO_C" >&6 -if test "${ethr_cv_128bit___sync_fetch_and_or+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv_128bit___sync_fetch_and_or=no - cat >conftest.$ac_ext <<_ACEOF + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + #include + #include "atomic_ops.h" + + int main () { -$atomic128_call +static int test_array [1 - 2 * !(((long) (sizeof (AO_t))) >= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16003,112 +14880,62 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_128bit___sync_fetch_and_or=yes + ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_128bit___sync_fetch_and_or" >&5 -echo "${ECHO_T}$ethr_cv_128bit___sync_fetch_and_or" >&6 - - case $ethr_cv_128bit___sync_fetch_and_or-$ethr_cv_64bit___sync_fetch_and_or-$ethr_cv_32bit___sync_fetch_and_or in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___sync_fetch_and_or $have_atomic_ops -_ACEOF - - - - # __sync_val_compare_and_swap - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __sync_val_compare_and_swap in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, __ATOMIC_RELAXED); res = __sync_val_compare_and_swap(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_val_compare_and_swap(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_val_compare_and_swap(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - { { echo "$as_me:$LINENO: error: Internal error: missing implementation for __sync_val_compare_and_swap" >&5 -echo "$as_me: error: Internal error: missing implementation for __sync_val_compare_and_swap" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - echo "$as_me:$LINENO: checking for 32-bit __sync_val_compare_and_swap()" >&5 -echo $ECHO_N "checking for 32-bit __sync_val_compare_and_swap()... $ECHO_C" >&6 -if test "${ethr_cv_32bit___sync_val_compare_and_swap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ethr_cv_32bit___sync_val_compare_and_swap=no - cat >conftest.$ac_ext <<_ACEOF +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + #include + #include "atomic_ops.h" + + int main () { -$atomic32_call +static int test_array [1 - 2 * !(((long) (sizeof (AO_t))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16122,105 +14949,246 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_32bit___sync_val_compare_and_swap=yes + ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo=`expr '(' $ac_mid ')' + 1` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_32bit___sync_val_compare_and_swap" >&5 -echo "${ECHO_T}$ethr_cv_32bit___sync_val_compare_and_swap" >&6 - echo "$as_me:$LINENO: checking for 64-bit __sync_val_compare_and_swap()" >&5 -echo $ECHO_N "checking for 64-bit __sync_val_compare_and_swap()... $ECHO_C" >&6 -if test "${ethr_cv_64bit___sync_val_compare_and_swap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_AO_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (AO_t), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (AO_t), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac else - - ethr_cv_64bit___sync_val_compare_and_swap=no - cat >conftest.$ac_ext <<_ACEOF + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + #include + #include "atomic_ops.h" + + +long longval () { return (long) (sizeof (AO_t)); } +unsigned long ulongval () { return (long) (sizeof (AO_t)); } +#include +#include int main () { -$atomic64_call + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (AO_t))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (AO_t)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (AO_t)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_64bit___sync_val_compare_and_swap=yes + ac_cv_sizeof_AO_t=`cat conftest.val` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (AO_t), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (AO_t), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_AO_t=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_AO_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_AO_t" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_AO_T $ac_cv_sizeof_AO_t +_ACEOF + + + +cat >>confdefs.h <<_ACEOF +#define ETHR_SIZEOF_AO_T $ac_cv_sizeof_AO_t +_ACEOF + + + +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE_LIBATOMIC_OPS 1 +_ACEOF + + if test "x$with_libatomic_ops" != "xno" && test "x$with_libatomic_ops" != "x"; then + +cat >>confdefs.h <<\_ACEOF +#define ETHR_PREFER_LIBATOMIC_OPS_NATIVE_IMPLS 1 +_ACEOF + + fi + ETHR_DEFS="$ETHR_DEFS $libatomic_ops_include" + elif test "x$with_libatomic_ops" != "xno" && test "x$with_libatomic_ops" != "x"; then + { { echo "$as_me:$LINENO: error: No usable libatomic_ops implementation found" >&5 +echo "$as_me: error: No usable libatomic_ops implementation found" >&2;} + { (exit 1); exit 1; }; } + fi + + case "$host_cpu" in + sparc | sun4u | sparc64 | sun4v) + case "$with_sparc_memory_order" in + "TSO") + +cat >>confdefs.h <<\_ACEOF +#define ETHR_SPARC_TSO 1 +_ACEOF +;; + "PSO") + +cat >>confdefs.h <<\_ACEOF +#define ETHR_SPARC_PSO 1 +_ACEOF +;; + "RMO"|"") + +cat >>confdefs.h <<\_ACEOF +#define ETHR_SPARC_RMO 1 +_ACEOF +;; + *) + { { echo "$as_me:$LINENO: error: Unsupported Sparc memory order: $with_sparc_memory_order" >&5 +echo "$as_me: error: Unsupported Sparc memory order: $with_sparc_memory_order" >&2;} + { (exit 1); exit 1; }; };; + esac + ethr_have_native_atomics=yes;; + i86pc | i*86 | x86_64 | amd64) + if test "$enable_x86_out_of_order" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define ETHR_X86_OUT_OF_ORDER 1 +_ACEOF + + fi + ethr_have_native_atomics=yes;; + macppc | ppc | powerpc | "Power Macintosh") + ethr_have_native_atomics=yes;; + tile) + ethr_have_native_atomics=yes;; + *) + ;; + esac + + fi + + test ethr_have_native_atomics = "yes" && ethr_have_native_spinlock=yes + + LIBS=$saved_libs + CPPFLAGS=$saved_cppflags + + ;; + *) + ;; +esac + +echo "$as_me:$LINENO: checking whether default stack size should be modified" >&5 +echo $ECHO_N "checking whether default stack size should be modified... $ECHO_C" >&6 +if test "x$ethr_modified_default_stack_size" != "x"; then + +cat >>confdefs.h <<_ACEOF +#define ETHR_MODIFIED_DEFAULT_STACK_SIZE $ethr_modified_default_stack_size +_ACEOF + + echo "$as_me:$LINENO: result: yes; to $ethr_modified_default_stack_size kilo words" >&5 +echo "${ECHO_T}yes; to $ethr_modified_default_stack_size kilo words" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +if test "x$ETHR_THR_LIB_BASE" != "x"; then + ETHR_DEFS="-DUSE_THREADS $ETHR_DEFS" + ETHR_LIBS="-l$ethr_lib_name -lerts_internal_r $ETHR_X_LIBS" + ETHR_LIB_NAME=$ethr_lib_name fi -echo "$as_me:$LINENO: result: $ethr_cv_64bit___sync_val_compare_and_swap" >&5 -echo "${ECHO_T}$ethr_cv_64bit___sync_val_compare_and_swap" >&6 - echo "$as_me:$LINENO: checking for 128-bit __sync_val_compare_and_swap()" >&5 -echo $ECHO_N "checking for 128-bit __sync_val_compare_and_swap()... $ECHO_C" >&6 -if test "${ethr_cv_128bit___sync_val_compare_and_swap+set}" = set; then + +echo "$as_me:$LINENO: checking for void *" >&5 +echo $ECHO_N "checking for void *... $ECHO_C" >&6 +if test "${ac_cv_type_void_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - ethr_cv_128bit___sync_val_compare_and_swap=no - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic128_call +if ((void * *) 0) + return 0; +if (sizeof (void *)) + return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16234,113 +15202,56 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_128bit___sync_val_compare_and_swap=yes + ac_cv_type_void_p=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_void_p=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ethr_cv_128bit___sync_val_compare_and_swap" >&5 -echo "${ECHO_T}$ethr_cv_128bit___sync_val_compare_and_swap" >&6 - - case $ethr_cv_128bit___sync_val_compare_and_swap-$ethr_cv_64bit___sync_val_compare_and_swap-$ethr_cv_32bit___sync_val_compare_and_swap in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___sync_val_compare_and_swap $have_atomic_ops -_ACEOF - - - - - # __atomic_store_n - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_store_n in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, __ATOMIC_RELAXED); res = __atomic_store_n(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_store_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_store_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - { { echo "$as_me:$LINENO: error: Internal error: missing implementation for __atomic_store_n" >&5 -echo "$as_me: error: Internal error: missing implementation for __atomic_store_n" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done +echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 +echo "${ECHO_T}$ac_cv_type_void_p" >&6 - echo "$as_me:$LINENO: checking for 32-bit __atomic_store_n()" >&5 -echo $ECHO_N "checking for 32-bit __atomic_store_n()... $ECHO_C" >&6 -if test "${ethr_cv_32bit___atomic_store_n+set}" = set; then +echo "$as_me:$LINENO: checking size of void *" >&5 +echo $ECHO_N "checking size of void *... $ECHO_C" >&6 +if test "${ac_cv_sizeof_void_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - ethr_cv_32bit___atomic_store_n=no - cat >conftest.$ac_ext <<_ACEOF + if test "$ac_cv_type_void_p" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic32_call +static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16354,49 +15265,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_32bit___atomic_store_n=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_32bit___atomic_store_n" >&5 -echo "${ECHO_T}$ethr_cv_32bit___atomic_store_n" >&6 - echo "$as_me:$LINENO: checking for 64-bit __atomic_store_n()" >&5 -echo $ECHO_N "checking for 64-bit __atomic_store_n()... $ECHO_C" >&6 -if test "${ethr_cv_64bit___atomic_store_n+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv_64bit___atomic_store_n=no - cat >conftest.$ac_ext <<_ACEOF + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic64_call +static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16410,49 +15306,50 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_64bit___atomic_store_n=yes + ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_64bit___atomic_store_n" >&5 -echo "${ECHO_T}$ethr_cv_64bit___atomic_store_n" >&6 - echo "$as_me:$LINENO: checking for 128-bit __atomic_store_n()" >&5 -echo $ECHO_N "checking for 128-bit __atomic_store_n()... $ECHO_C" >&6 -if test "${ethr_cv_128bit___atomic_store_n+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ethr_cv_128bit___atomic_store_n=no - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic128_call +static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16466,112 +15363,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_128bit___atomic_store_n=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_128bit___atomic_store_n" >&5 -echo "${ECHO_T}$ethr_cv_128bit___atomic_store_n" >&6 - - case $ethr_cv_128bit___atomic_store_n-$ethr_cv_64bit___atomic_store_n-$ethr_cv_32bit___atomic_store_n in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___atomic_store_n $have_atomic_ops -_ACEOF - - - - # __atomic_load_n - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_load_n in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, __ATOMIC_RELAXED); res = __atomic_load_n(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_load_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_load_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - { { echo "$as_me:$LINENO: error: Internal error: missing implementation for __atomic_load_n" >&5 -echo "$as_me: error: Internal error: missing implementation for __atomic_load_n" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - echo "$as_me:$LINENO: checking for 32-bit __atomic_load_n()" >&5 -echo $ECHO_N "checking for 32-bit __atomic_load_n()... $ECHO_C" >&6 -if test "${ethr_cv_32bit___atomic_load_n+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv_32bit___atomic_load_n=no - cat >conftest.$ac_ext <<_ACEOF + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic32_call +static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16585,49 +15404,58 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_32bit___atomic_load_n=yes + ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_32bit___atomic_load_n" >&5 -echo "${ECHO_T}$ethr_cv_32bit___atomic_load_n" >&6 - echo "$as_me:$LINENO: checking for 64-bit __atomic_load_n()" >&5 -echo $ECHO_N "checking for 64-bit __atomic_load_n()... $ECHO_C" >&6 -if test "${ethr_cv_64bit___atomic_load_n+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ethr_cv_64bit___atomic_load_n=no - cat >conftest.$ac_ext <<_ACEOF +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic64_call +static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16641,168 +15469,146 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_64bit___atomic_load_n=yes + ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo=`expr '(' $ac_mid ')' + 1` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_64bit___atomic_load_n" >&5 -echo "${ECHO_T}$ethr_cv_64bit___atomic_load_n" >&6 - echo "$as_me:$LINENO: checking for 128-bit __atomic_load_n()" >&5 -echo $ECHO_N "checking for 128-bit __atomic_load_n()... $ECHO_C" >&6 -if test "${ethr_cv_128bit___atomic_load_n+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_void_p=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac else - - ethr_cv_128bit___atomic_load_n=no - cat >conftest.$ac_ext <<_ACEOF + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default +long longval () { return (long) (sizeof (void *)); } +unsigned long ulongval () { return (long) (sizeof (void *)); } +#include +#include int main () { -$atomic128_call + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (void *))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (void *)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (void *)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_128bit___atomic_load_n=yes + ac_cv_sizeof_void_p=`cat conftest.val` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ethr_cv_128bit___atomic_load_n" >&5 -echo "${ECHO_T}$ethr_cv_128bit___atomic_load_n" >&6 - - case $ethr_cv_128bit___atomic_load_n-$ethr_cv_64bit___atomic_load_n-$ethr_cv_32bit___atomic_load_n in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - +fi +rm -f conftest.val +else + ac_cv_sizeof_void_p=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6 cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___atomic_load_n $have_atomic_ops +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p _ACEOF - # __atomic_add_fetch - atomic_op +cat >>confdefs.h <<_ACEOF +#define ETHR_SIZEOF_PTR $ac_cv_sizeof_void_p +_ACEOF - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_add_fetch in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, __ATOMIC_RELAXED); res = __atomic_add_fetch(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_add_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_add_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - { { echo "$as_me:$LINENO: error: Internal error: missing implementation for __atomic_add_fetch" >&5 -echo "$as_me: error: Internal error: missing implementation for __atomic_add_fetch" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - echo "$as_me:$LINENO: checking for 32-bit __atomic_add_fetch()" >&5 -echo $ECHO_N "checking for 32-bit __atomic_add_fetch()... $ECHO_C" >&6 -if test "${ethr_cv_32bit___atomic_add_fetch+set}" = set; then +echo "$as_me:$LINENO: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6 +if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - ethr_cv_32bit___atomic_add_fetch=no - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic32_call +if ((int *) 0) + return 0; +if (sizeof (int)) + return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16816,49 +15622,56 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_32bit___atomic_add_fetch=yes + ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_int=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ethr_cv_32bit___atomic_add_fetch" >&5 -echo "${ECHO_T}$ethr_cv_32bit___atomic_add_fetch" >&6 - echo "$as_me:$LINENO: checking for 64-bit __atomic_add_fetch()" >&5 -echo $ECHO_N "checking for 64-bit __atomic_add_fetch()... $ECHO_C" >&6 -if test "${ethr_cv_64bit___atomic_add_fetch+set}" = set; then +echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6 + +echo "$as_me:$LINENO: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6 +if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - ethr_cv_64bit___atomic_add_fetch=no - cat >conftest.$ac_ext <<_ACEOF + if test "$ac_cv_type_int" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic64_call +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16872,49 +15685,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_64bit___atomic_add_fetch=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_64bit___atomic_add_fetch" >&5 -echo "${ECHO_T}$ethr_cv_64bit___atomic_add_fetch" >&6 - echo "$as_me:$LINENO: checking for 128-bit __atomic_add_fetch()" >&5 -echo $ECHO_N "checking for 128-bit __atomic_add_fetch()... $ECHO_C" >&6 -if test "${ethr_cv_128bit___atomic_add_fetch+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv_128bit___atomic_add_fetch=no - cat >conftest.$ac_ext <<_ACEOF + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic128_call +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -16928,112 +15726,50 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_128bit___atomic_add_fetch=yes + ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_128bit___atomic_add_fetch" >&5 -echo "${ECHO_T}$ethr_cv_128bit___atomic_add_fetch" >&6 - - case $ethr_cv_128bit___atomic_add_fetch-$ethr_cv_64bit___atomic_add_fetch-$ethr_cv_32bit___atomic_add_fetch in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___atomic_add_fetch $have_atomic_ops -_ACEOF - - - - # __atomic_fetch_and - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_fetch_and in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, __ATOMIC_RELAXED); res = __atomic_fetch_and(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_fetch_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_fetch_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - { { echo "$as_me:$LINENO: error: Internal error: missing implementation for __atomic_fetch_and" >&5 -echo "$as_me: error: Internal error: missing implementation for __atomic_fetch_and" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - echo "$as_me:$LINENO: checking for 32-bit __atomic_fetch_and()" >&5 -echo $ECHO_N "checking for 32-bit __atomic_fetch_and()... $ECHO_C" >&6 -if test "${ethr_cv_32bit___atomic_fetch_and+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ethr_cv_32bit___atomic_fetch_and=no - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic32_call +static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -17047,49 +15783,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_32bit___atomic_fetch_and=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_32bit___atomic_fetch_and" >&5 -echo "${ECHO_T}$ethr_cv_32bit___atomic_fetch_and" >&6 - echo "$as_me:$LINENO: checking for 64-bit __atomic_fetch_and()" >&5 -echo $ECHO_N "checking for 64-bit __atomic_fetch_and()... $ECHO_C" >&6 -if test "${ethr_cv_64bit___atomic_fetch_and+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv_64bit___atomic_fetch_and=no - cat >conftest.$ac_ext <<_ACEOF + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic64_call +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -17103,49 +15824,58 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_64bit___atomic_fetch_and=yes + ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_64bit___atomic_fetch_and" >&5 -echo "${ECHO_T}$ethr_cv_64bit___atomic_fetch_and" >&6 - echo "$as_me:$LINENO: checking for 128-bit __atomic_fetch_and()" >&5 -echo $ECHO_N "checking for 128-bit __atomic_fetch_and()... $ECHO_C" >&6 -if test "${ethr_cv_128bit___atomic_fetch_and+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ethr_cv_128bit___atomic_fetch_and=no - cat >conftest.$ac_ext <<_ACEOF +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic128_call +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -17159,168 +15889,145 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_128bit___atomic_fetch_and=yes + ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo=`expr '(' $ac_mid ')' + 1` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_128bit___atomic_fetch_and" >&5 -echo "${ECHO_T}$ethr_cv_128bit___atomic_fetch_and" >&6 - - case $ethr_cv_128bit___atomic_fetch_and-$ethr_cv_64bit___atomic_fetch_and-$ethr_cv_32bit___atomic_fetch_and in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___atomic_fetch_and $have_atomic_ops -_ACEOF - - - - # __atomic_fetch_or - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_fetch_or in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, __ATOMIC_RELAXED); res = __atomic_fetch_or(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_fetch_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_fetch_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - { { echo "$as_me:$LINENO: error: Internal error: missing implementation for __atomic_fetch_or" >&5 -echo "$as_me: error: Internal error: missing implementation for __atomic_fetch_or" >&2;} +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_int=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - echo "$as_me:$LINENO: checking for 32-bit __atomic_fetch_or()" >&5 -echo $ECHO_N "checking for 32-bit __atomic_fetch_or()... $ECHO_C" >&6 -if test "${ethr_cv_32bit___atomic_fetch_or+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - - ethr_cv_32bit___atomic_fetch_or=no - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default +long longval () { return (long) (sizeof (int)); } +unsigned long ulongval () { return (long) (sizeof (int)); } +#include +#include int main () { -$atomic32_call + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (int))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 + (eval $ac_link) 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_32bit___atomic_fetch_or=yes + ac_cv_sizeof_int=`cat conftest.val` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ethr_cv_32bit___atomic_fetch_or" >&5 -echo "${ECHO_T}$ethr_cv_32bit___atomic_fetch_or" >&6 - echo "$as_me:$LINENO: checking for 64-bit __atomic_fetch_or()" >&5 -echo $ECHO_N "checking for 64-bit __atomic_fetch_or()... $ECHO_C" >&6 -if test "${ethr_cv_64bit___atomic_fetch_or+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +rm -f conftest.val else + ac_cv_sizeof_int=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + - ethr_cv_64bit___atomic_fetch_or=no - cat >conftest.$ac_ext <<_ACEOF + +cat >>confdefs.h <<_ACEOF +#define ETHR_SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + +echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6 +if test "${ac_cv_type_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic64_call +if ((long *) 0) + return 0; +if (sizeof (long)) + return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -17334,49 +16041,56 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_64bit___atomic_fetch_or=yes + ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_long=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ethr_cv_64bit___atomic_fetch_or" >&5 -echo "${ECHO_T}$ethr_cv_64bit___atomic_fetch_or" >&6 - echo "$as_me:$LINENO: checking for 128-bit __atomic_fetch_or()" >&5 -echo $ECHO_N "checking for 128-bit __atomic_fetch_or()... $ECHO_C" >&6 -if test "${ethr_cv_128bit___atomic_fetch_or+set}" = set; then +echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 + +echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - ethr_cv_128bit___atomic_fetch_or=no - cat >conftest.$ac_ext <<_ACEOF + if test "$ac_cv_type_long" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic128_call +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -17390,112 +16104,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_128bit___atomic_fetch_or=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_128bit___atomic_fetch_or" >&5 -echo "${ECHO_T}$ethr_cv_128bit___atomic_fetch_or" >&6 - - case $ethr_cv_128bit___atomic_fetch_or-$ethr_cv_64bit___atomic_fetch_or-$ethr_cv_32bit___atomic_fetch_or in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___atomic_fetch_or $have_atomic_ops -_ACEOF - - - - # __atomic_compare_exchange_n - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_compare_exchange_n in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, __ATOMIC_RELAXED); res = __atomic_compare_exchange_n(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_compare_exchange_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_compare_exchange_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - { { echo "$as_me:$LINENO: error: Internal error: missing implementation for __atomic_compare_exchange_n" >&5 -echo "$as_me: error: Internal error: missing implementation for __atomic_compare_exchange_n" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - echo "$as_me:$LINENO: checking for 32-bit __atomic_compare_exchange_n()" >&5 -echo $ECHO_N "checking for 32-bit __atomic_compare_exchange_n()... $ECHO_C" >&6 -if test "${ethr_cv_32bit___atomic_compare_exchange_n+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv_32bit___atomic_compare_exchange_n=no - cat >conftest.$ac_ext <<_ACEOF + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic32_call +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -17509,49 +16145,50 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_32bit___atomic_compare_exchange_n=yes + ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_32bit___atomic_compare_exchange_n" >&5 -echo "${ECHO_T}$ethr_cv_32bit___atomic_compare_exchange_n" >&6 - echo "$as_me:$LINENO: checking for 64-bit __atomic_compare_exchange_n()" >&5 -echo $ECHO_N "checking for 64-bit __atomic_compare_exchange_n()... $ECHO_C" >&6 -if test "${ethr_cv_64bit___atomic_compare_exchange_n+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ethr_cv_64bit___atomic_compare_exchange_n=no - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic64_call +static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -17565,49 +16202,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_64bit___atomic_compare_exchange_n=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_64bit___atomic_compare_exchange_n" >&5 -echo "${ECHO_T}$ethr_cv_64bit___atomic_compare_exchange_n" >&6 - echo "$as_me:$LINENO: checking for 128-bit __atomic_compare_exchange_n()" >&5 -echo $ECHO_N "checking for 128-bit __atomic_compare_exchange_n()... $ECHO_C" >&6 -if test "${ethr_cv_128bit___atomic_compare_exchange_n+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ethr_cv_128bit___atomic_compare_exchange_n=no - cat >conftest.$ac_ext <<_ACEOF + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -$atomic128_call +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -17621,82 +16243,58 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_128bit___atomic_compare_exchange_n=yes + ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_128bit___atomic_compare_exchange_n" >&5 -echo "${ECHO_T}$ethr_cv_128bit___atomic_compare_exchange_n" >&6 - - case $ethr_cv_128bit___atomic_compare_exchange_n-$ethr_cv_64bit___atomic_compare_exchange_n-$ethr_cv_32bit___atomic_compare_exchange_n in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE___atomic_compare_exchange_n $have_atomic_ops -_ACEOF - - - - ethr_have_gcc_native_atomics=no - ethr_arm_dbm_instr_val=0 - case "$GCC-$host_cpu" in - yes-arm*) - echo "$as_me:$LINENO: checking for ARM DMB instruction" >&5 -echo $ECHO_N "checking for ARM DMB instruction... $ECHO_C" >&6 -if test "${ethr_cv_arm_dbm_instr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ethr_cv_arm_dbm_instr=no - cat >conftest.$ac_ext <<_ACEOF +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { - - __asm__ __volatile__("dmb sy" : : : "memory"); - __asm__ __volatile__("dmb st" : : : "memory"); +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -17710,163 +16308,122 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_cv_arm_dbm_instr=yes + ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo=`expr '(' $ac_mid ')' + 1` fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ethr_cv_arm_dbm_instr" >&5 -echo "${ECHO_T}$ethr_cv_arm_dbm_instr" >&6 - if test $ethr_cv_arm_dbm_instr = yes; then - ethr_arm_dbm_instr_val=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi;; - *) - ;; - esac - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION $ethr_arm_dbm_instr_val -_ACEOF - - test $ethr_cv_32bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_64bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - if test "$ethr_cv___sync_synchronize" = "yes"; then - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi - ethr_have_gcc_atomic_builtins=0 - if test $ethr_have_gcc_native_atomics = yes; then - ethr_native_atomic_implementation=gcc_sync - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_have_gcc_atomic_builtins = 1 && ethr_native_atomic_implementation=gcc_atomic_sync - fi - -cat >>confdefs.h <<_ACEOF -#define ETHR_HAVE_GCC___ATOMIC_BUILTINS $ethr_have_gcc_atomic_builtins -_ACEOF - - test $ethr_have_gcc_native_atomics = yes && ethr_have_native_atomics=yes - - - echo "$as_me:$LINENO: checking for a usable libatomic_ops implementation" >&5 -echo $ECHO_N "checking for a usable libatomic_ops implementation... $ECHO_C" >&6 - case "x$with_libatomic_ops" in - xno | xyes | x) - libatomic_ops_include= - ;; - *) - if test -d "${with_libatomic_ops}/include"; then - libatomic_ops_include="-I$with_libatomic_ops/include" - CPPFLAGS="$CPPFLAGS $libatomic_ops_include" - else - { { echo "$as_me:$LINENO: error: libatomic_ops include directory $with_libatomic_ops/include not found" >&5 -echo "$as_me: error: libatomic_ops include directory $with_libatomic_ops/include not found" >&2;} +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } - fi;; - esac - ethr_have_libatomic_ops=no - cat >conftest.$ac_ext <<_ACEOF +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include "atomic_ops.h" +$ac_includes_default +long longval () { return (long) (sizeof (long)); } +unsigned long ulongval () { return (long) (sizeof (long)); } +#include +#include int main () { - volatile AO_t x; - AO_t y; - int z; - - AO_nop_full(); -#if defined(AO_HAVE_store) - AO_store(&x, (AO_t) 0); -#elif defined(AO_HAVE_store_release) - AO_store_release(&x, (AO_t) 0); -#else -#error No store -#endif -#if defined(AO_HAVE_load) - z = AO_load(&x); -#elif defined(AO_HAVE_load_acquire) - z = AO_load_acquire(&x); -#else -#error No load -#endif -#if defined(AO_HAVE_compare_and_swap_full) - z = AO_compare_and_swap_full(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap_release) - z = AO_compare_and_swap_release(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap_acquire) - z = AO_compare_and_swap_acquire(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap) - z = AO_compare_and_swap(&x, (AO_t) 0, (AO_t) 1); -#else -#error No compare_and_swap -#endif + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (long))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ethr_have_native_atomics=yes - ethr_native_atomic_implementation=libatomic_ops - ethr_have_libatomic_ops=yes + ac_cv_sizeof_long=`cat conftest.val` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - echo "$as_me:$LINENO: result: $ethr_have_libatomic_ops" >&5 -echo "${ECHO_T}$ethr_have_libatomic_ops" >&6 - if test $ethr_have_libatomic_ops = yes; then - echo "$as_me:$LINENO: checking for AO_t" >&5 -echo $ECHO_N "checking for AO_t... $ECHO_C" >&6 -if test "${ac_cv_type_AO_t+set}" = set; then +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_long=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + + +cat >>confdefs.h <<_ACEOF +#define ETHR_SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + +echo "$as_me:$LINENO: checking for long long" >&5 +echo $ECHO_N "checking for long long... $ECHO_C" >&6 +if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -17875,17 +16432,13 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - - #include - #include "atomic_ops.h" - - +$ac_includes_default int main () { -if ((AO_t *) 0) +if ((long long *) 0) return 0; -if (sizeof (AO_t)) +if (sizeof (long long)) return 0; ; return 0; @@ -17913,24 +16466,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_AO_t=yes + ac_cv_type_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_AO_t=no +ac_cv_type_long_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_AO_t" >&5 -echo "${ECHO_T}$ac_cv_type_AO_t" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_long_long" >&6 -echo "$as_me:$LINENO: checking size of AO_t" >&5 -echo $ECHO_N "checking size of AO_t... $ECHO_C" >&6 -if test "${ac_cv_sizeof_AO_t+set}" = set; then +echo "$as_me:$LINENO: checking size of long long" >&5 +echo $ECHO_N "checking size of long long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_AO_t" = yes; then + if test "$ac_cv_type_long_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -17943,15 +16496,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - - #include - #include "atomic_ops.h" - - +$ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (AO_t))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; test_array [0] = 0 ; @@ -17988,15 +16537,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - - #include - #include "atomic_ops.h" - - +$ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (AO_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; @@ -18049,15 +16594,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - - #include - #include "atomic_ops.h" - - +$ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (AO_t))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; test_array [0] = 0 ; @@ -18094,15 +16635,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - - #include - #include "atomic_ops.h" - - +$ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (AO_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; test_array [0] = 0 ; @@ -18163,15 +16700,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - - #include - #include "atomic_ops.h" - - +$ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (AO_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; @@ -18210,10 +16743,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_AO_t=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (AO_t), 77 +?*) ac_cv_sizeof_long_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (AO_t), 77 +echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -18231,13 +16764,9 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - - #include - #include "atomic_ops.h" - - -long longval () { return (long) (sizeof (AO_t)); } -unsigned long ulongval () { return (long) (sizeof (AO_t)); } +$ac_includes_default +long longval () { return (long) (sizeof (long long)); } +unsigned long ulongval () { return (long) (sizeof (long long)); } #include #include int @@ -18247,17 +16776,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (AO_t))) < 0) + if (((long) (sizeof (long long))) < 0) { long i = longval (); - if (i != ((long) (sizeof (AO_t)))) + if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (AO_t)))) + if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%lu\n", i); } @@ -18278,16 +16807,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_AO_t=`cat conftest.val` + ac_cv_sizeof_long_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (AO_t), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (AO_t), 77 +echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -18296,125 +16825,24 @@ fi rm -f conftest.val else - ac_cv_sizeof_AO_t=0 + ac_cv_sizeof_long_long=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_AO_t" >&5 -echo "${ECHO_T}$ac_cv_sizeof_AO_t" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_AO_T $ac_cv_sizeof_AO_t +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF cat >>confdefs.h <<_ACEOF -#define ETHR_SIZEOF_AO_T $ac_cv_sizeof_AO_t -_ACEOF - - - -cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_LIBATOMIC_OPS 1 +#define ETHR_SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF - if test "x$with_libatomic_ops" != "xno" && test "x$with_libatomic_ops" != "x"; then - -cat >>confdefs.h <<\_ACEOF -#define ETHR_PREFER_LIBATOMIC_OPS_NATIVE_IMPLS 1 -_ACEOF - - fi - ETHR_DEFS="$ETHR_DEFS $libatomic_ops_include" - elif test "x$with_libatomic_ops" != "xno" && test "x$with_libatomic_ops" != "x"; then - { { echo "$as_me:$LINENO: error: No usable libatomic_ops implementation found" >&5 -echo "$as_me: error: No usable libatomic_ops implementation found" >&2;} - { (exit 1); exit 1; }; } - fi - - case "$host_cpu" in - sparc | sun4u | sparc64 | sun4v) - case "$with_sparc_memory_order" in - "TSO") - -cat >>confdefs.h <<\_ACEOF -#define ETHR_SPARC_TSO 1 -_ACEOF -;; - "PSO") - -cat >>confdefs.h <<\_ACEOF -#define ETHR_SPARC_PSO 1 -_ACEOF -;; - "RMO"|"") - -cat >>confdefs.h <<\_ACEOF -#define ETHR_SPARC_RMO 1 -_ACEOF -;; - *) - { { echo "$as_me:$LINENO: error: Unsupported Sparc memory order: $with_sparc_memory_order" >&5 -echo "$as_me: error: Unsupported Sparc memory order: $with_sparc_memory_order" >&2;} - { (exit 1); exit 1; }; };; - esac - ethr_native_atomic_implementation=ethread - ethr_have_native_atomics=yes;; - i86pc | i*86 | x86_64 | amd64) - if test "$enable_x86_out_of_order" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define ETHR_X86_OUT_OF_ORDER 1 -_ACEOF - - fi - ethr_native_atomic_implementation=ethread - ethr_have_native_atomics=yes;; - macppc | ppc | powerpc | "Power Macintosh") - ethr_native_atomic_implementation=ethread - ethr_have_native_atomics=yes;; - tile) - ethr_native_atomic_implementation=ethread - ethr_have_native_atomics=yes;; - *) - ;; - esac - - fi - - test ethr_have_native_atomics = "yes" && ethr_have_native_spinlock=yes - - LIBS=$saved_libs - CPPFLAGS=$saved_cppflags - - ;; - *) - ;; -esac - -echo "$as_me:$LINENO: checking whether default stack size should be modified" >&5 -echo $ECHO_N "checking whether default stack size should be modified... $ECHO_C" >&6 -if test "x$ethr_modified_default_stack_size" != "x"; then - -cat >>confdefs.h <<_ACEOF -#define ETHR_MODIFIED_DEFAULT_STACK_SIZE $ethr_modified_default_stack_size -_ACEOF - - echo "$as_me:$LINENO: result: yes; to $ethr_modified_default_stack_size kilo words" >&5 -echo "${ECHO_T}yes; to $ethr_modified_default_stack_size kilo words" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test "x$ETHR_THR_LIB_BASE" != "x"; then - ETHR_DEFS="-DUSE_THREADS $ETHR_DEFS" - ETHR_LIBS="-l$ethr_lib_name -lerts_internal_r $ETHR_X_LIBS" - ETHR_LIB_NAME=$ethr_lib_name -fi - -echo "$as_me:$LINENO: checking for void *" >&5 -echo $ECHO_N "checking for void *... $ECHO_C" >&6 -if test "${ac_cv_type_void_p+set}" = set; then +echo "$as_me:$LINENO: checking for __int64" >&5 +echo $ECHO_N "checking for __int64... $ECHO_C" >&6 +if test "${ac_cv_type___int64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -18427,9 +16855,9 @@ int main () { -if ((void * *) 0) +if ((__int64 *) 0) return 0; -if (sizeof (void *)) +if (sizeof (__int64)) return 0; ; return 0; @@ -18457,24 +16885,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_void_p=yes + ac_cv_type___int64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_void_p=no +ac_cv_type___int64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 -echo "${ECHO_T}$ac_cv_type_void_p" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type___int64" >&5 +echo "${ECHO_T}$ac_cv_type___int64" >&6 -echo "$as_me:$LINENO: checking size of void *" >&5 -echo $ECHO_N "checking size of void *... $ECHO_C" >&6 -if test "${ac_cv_sizeof_void_p+set}" = set; then +echo "$as_me:$LINENO: checking size of __int64" >&5 +echo $ECHO_N "checking size of __int64... $ECHO_C" >&6 +if test "${ac_cv_sizeof___int64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_void_p" = yes; then + if test "$ac_cv_type___int64" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -18491,7 +16919,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int64))) >= 0)]; test_array [0] = 0 ; @@ -18532,7 +16960,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int64))) <= $ac_mid)]; test_array [0] = 0 ; @@ -18589,7 +17017,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int64))) < 0)]; test_array [0] = 0 ; @@ -18630,7 +17058,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int64))) >= $ac_mid)]; test_array [0] = 0 ; @@ -18695,7 +17123,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int64))) <= $ac_mid)]; test_array [0] = 0 ; @@ -18734,10 +17162,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_void_p=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 +?*) ac_cv_sizeof___int64=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (__int64), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (void *), 77 +echo "$as_me: error: cannot compute sizeof (__int64), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -18756,8 +17184,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (void *)); } -unsigned long ulongval () { return (long) (sizeof (void *)); } +long longval () { return (long) (sizeof (__int64)); } +unsigned long ulongval () { return (long) (sizeof (__int64)); } #include #include int @@ -18767,17 +17195,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (void *))) < 0) + if (((long) (sizeof (__int64))) < 0) { long i = longval (); - if (i != ((long) (sizeof (void *)))) + if (i != ((long) (sizeof (__int64)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (void *)))) + if (i != ((long) (sizeof (__int64)))) exit (1); fprintf (f, "%lu\n", i); } @@ -18798,16 +17226,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_void_p=`cat conftest.val` + ac_cv_sizeof___int64=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (__int64), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (void *), 77 +echo "$as_me: error: cannot compute sizeof (__int64), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -18816,25 +17244,24 @@ fi rm -f conftest.val else - ac_cv_sizeof_void_p=0 + ac_cv_sizeof___int64=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 -echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof___int64" >&5 +echo "${ECHO_T}$ac_cv_sizeof___int64" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_VOID_P $ac_cv_sizeof_void_p +#define SIZEOF___INT64 $ac_cv_sizeof___int64 _ACEOF cat >>confdefs.h <<_ACEOF -#define ETHR_SIZEOF_PTR $ac_cv_sizeof_void_p +#define ETHR_SIZEOF___INT64 $ac_cv_sizeof___int64 _ACEOF - -echo "$as_me:$LINENO: checking for int" >&5 -echo $ECHO_N "checking for int... $ECHO_C" >&6 -if test "${ac_cv_type_int+set}" = set; then +echo "$as_me:$LINENO: checking for __int128_t" >&5 +echo $ECHO_N "checking for __int128_t... $ECHO_C" >&6 +if test "${ac_cv_type___int128_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -18847,9 +17274,9 @@ int main () { -if ((int *) 0) +if ((__int128_t *) 0) return 0; -if (sizeof (int)) +if (sizeof (__int128_t)) return 0; ; return 0; @@ -18877,24 +17304,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_int=yes + ac_cv_type___int128_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_int=no +ac_cv_type___int128_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 -echo "${ECHO_T}$ac_cv_type_int" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type___int128_t" >&5 +echo "${ECHO_T}$ac_cv_type___int128_t" >&6 -echo "$as_me:$LINENO: checking size of int" >&5 -echo $ECHO_N "checking size of int... $ECHO_C" >&6 -if test "${ac_cv_sizeof_int+set}" = set; then +echo "$as_me:$LINENO: checking size of __int128_t" >&5 +echo $ECHO_N "checking size of __int128_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof___int128_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_int" = yes; then + if test "$ac_cv_type___int128_t" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -18911,7 +17338,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) >= 0)]; test_array [0] = 0 ; @@ -18952,7 +17379,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -19009,7 +17436,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) < 0)]; test_array [0] = 0 ; @@ -19050,7 +17477,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) >= $ac_mid)]; test_array [0] = 0 ; @@ -19115,7 +17542,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -19154,10 +17581,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_int=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +?*) ac_cv_sizeof___int128_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (__int128_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (int), 77 +echo "$as_me: error: cannot compute sizeof (__int128_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -19176,8 +17603,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (int)); } -unsigned long ulongval () { return (long) (sizeof (int)); } +long longval () { return (long) (sizeof (__int128_t)); } +unsigned long ulongval () { return (long) (sizeof (__int128_t)); } #include #include int @@ -19187,17 +17614,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (int))) < 0) + if (((long) (sizeof (__int128_t))) < 0) { long i = longval (); - if (i != ((long) (sizeof (int)))) + if (i != ((long) (sizeof (__int128_t)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (int)))) + if (i != ((long) (sizeof (__int128_t)))) exit (1); fprintf (f, "%lu\n", i); } @@ -19218,16 +17645,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_int=`cat conftest.val` + ac_cv_sizeof___int128_t=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (__int128_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (int), 77 +echo "$as_me: error: cannot compute sizeof (__int128_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -19236,102 +17663,52 @@ fi rm -f conftest.val else - ac_cv_sizeof_int=0 + ac_cv_sizeof___int128_t=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 -echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof___int128_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof___int128_t" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT $ac_cv_sizeof_int +#define SIZEOF___INT128_T $ac_cv_sizeof___int128_t _ACEOF cat >>confdefs.h <<_ACEOF -#define ETHR_SIZEOF_INT $ac_cv_sizeof_int +#define ETHR_SIZEOF___INT128_T $ac_cv_sizeof___int128_t _ACEOF -echo "$as_me:$LINENO: checking for long" >&5 -echo $ECHO_N "checking for long... $ECHO_C" >&6 -if test "${ac_cv_type_long+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((long *) 0) - return 0; -if (sizeof (long)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_long=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_long=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 -echo "${ECHO_T}$ac_cv_type_long" >&6 -echo "$as_me:$LINENO: checking size of long" >&5 -echo $ECHO_N "checking size of long... $ECHO_C" >&6 -if test "${ac_cv_sizeof_long+set}" = set; then +case X$erl_xcomp_bigendian in + X) ;; + Xyes|Xno) ac_cv_c_bigendian=$erl_xcomp_bigendian;; + *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian" >&5 +echo "$as_me: error: Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian" >&2;} + { (exit 1); exit 1; }; };; +esac + +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_long" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. + # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default +#include +#include + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; -test_array [0] = 0 +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif ; return 0; @@ -19359,20 +17736,22 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default +#include +#include + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; -test_array [0] = 0 +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif ; return 0; @@ -19400,78 +17779,38 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid; break + ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` +ac_cv_c_bigendian=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; -test_array [0] = 0 - + _ascii (); _ebcdic (); ; return 0; } @@ -19498,133 +17837,184 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` + 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 -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo= ac_hi= -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid + ac_cv_c_bigendian=no else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr '(' $ac_mid ')' + 1` +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_long=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long), 77 -See \`config.log' for more details." >&2;} +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac -else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + + +if test "$ac_cv_c_bigendian" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define ETHR_BIGENDIAN 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (long)); } -unsigned long ulongval () { return (long) (sizeof (long)); } -#include + +fi + +case X$erl_xcomp_double_middle_endian in + X) ;; + Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; + *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian" >&5 +echo "$as_me: error: Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian" >&2;} + { (exit 1); exit 1; }; };; +esac + +echo "$as_me:$LINENO: checking whether double word ordering is middle-endian" >&5 +echo $ECHO_N "checking whether double word ordering is middle-endian... $ECHO_C" >&6 +if test "${ac_cv_c_double_middle_endian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + ac_cv_c_double_middle=unknown +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include + int -main () +main(void) { + int i = 0; + int zero = 0; + int bigendian; + int zero_index = 0; - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (long))) < 0) + union + { + long int l; + char c[sizeof (long int)]; + } u; + + /* we'll use the one with 32-bit words */ + union + { + double d; + unsigned int c[2]; + } vint; + + union + { + double d; + unsigned long c[2]; + } vlong; + + union + { + double d; + unsigned short c[2]; + } vshort; + + + /* Are we little or big endian? From Harbison&Steele. */ + u.l = 1; + bigendian = (u.c[sizeof (long int) - 1] == 1); + + zero_index = bigendian ? 1 : 0; + + vint.d = 1.0; + vlong.d = 1.0; + vshort.d = 1.0; + + if (sizeof(unsigned int) == 4) { - long i = longval (); - if (i != ((long) (sizeof (long)))) - exit (1); - fprintf (f, "%ld\n", i); + if (vint.c[zero_index] != 0) + zero = 1; } - else + else if (sizeof(unsigned long) == 4) { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (long)))) - exit (1); - fprintf (f, "%lu\n", i); + if (vlong.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned short) == 4) + { + if (vshort.c[zero_index] != 0) + zero = 1; } - exit (ferror (f) || fclose (f) != 0); - ; - return 0; + exit (zero); } + _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 @@ -19637,58 +18027,59 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_long=`cat conftest.val` + ac_cv_c_double_middle_endian=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +ac_cv_c_double_middle_endian=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -rm -f conftest.val -else - ac_cv_sizeof_long=0 -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 -echo "${ECHO_T}$ac_cv_sizeof_long" >&6 -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG $ac_cv_sizeof_long -_ACEOF - - +echo "$as_me:$LINENO: result: $ac_cv_c_double_middle_endian" >&5 +echo "${ECHO_T}$ac_cv_c_double_middle_endian" >&6 +case $ac_cv_c_double_middle_endian in + yes) -cat >>confdefs.h <<_ACEOF -#define ETHR_SIZEOF_LONG $ac_cv_sizeof_long +cat >>confdefs.h <<\_ACEOF +#define DOUBLE_MIDDLE_ENDIAN 1 _ACEOF + ;; + no) + ;; + *) + { echo "$as_me:$LINENO: WARNING: unknown double endianness +presetting ac_cv_c_double_middle_endian=no (or yes) will help" >&5 +echo "$as_me: WARNING: unknown double endianness +presetting ac_cv_c_double_middle_endian=no (or yes) will help" >&2;} ;; +esac -echo "$as_me:$LINENO: checking for long long" >&5 -echo $ECHO_N "checking for long long... $ECHO_C" >&6 -if test "${ac_cv_type_long_long+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + +ETHR_X86_SSE2_ASM=no +case "$GCC-$ac_cv_sizeof_void_p-$host_cpu" in + yes-4-i86pc | yes-4-i*86 | yes-4-x86_64 | yes-4-amd64) + echo "$as_me:$LINENO: checking for gcc sse2 asm support" >&5 +echo $ECHO_N "checking for gcc sse2 asm support... $ECHO_C" >&6 + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -msse2" + gcc_sse2_asm=no + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + int main () { -if ((long long *) 0) - return 0; -if (sizeof (long long)) - return 0; + + long long x, *y; + __asm__ __volatile__("movq %1, %0\n\t" : "=x"(x) : "m"(*y) : "memory"); + ; return 0; } @@ -19715,83 +18106,70 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_long_long=yes + gcc_sse2_asm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_long_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 -echo "${ECHO_T}$ac_cv_type_long_long" >&6 + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $gcc_sse2_asm" >&5 +echo "${ECHO_T}$gcc_sse2_asm" >&6 + if test "$gcc_sse2_asm" = "yes"; then -echo "$as_me:$LINENO: checking size of long long" >&5 -echo $ECHO_N "checking size of long long... $ECHO_C" >&6 -if test "${ac_cv_sizeof_long_long+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$ac_cv_type_long_long" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +cat >>confdefs.h <<\_ACEOF +#define ETHR_GCC_HAVE_SSE2_ASM_SUPPORT 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; -test_array [0] = 0 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do + ETHR_X86_SSE2_ASM=yes + fi + ;; + *) + ;; +esac + +case "$GCC-$host_cpu" in + yes-i86pc | yes-i*86 | yes-x86_64 | yes-amd64) + gcc_dw_cmpxchg_asm=no + echo "$as_me:$LINENO: checking for gcc double word cmpxchg asm support" >&5 +echo $ECHO_N "checking for gcc double word cmpxchg asm support... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; -test_array [0] = 0 + + char xchgd; + long new[2], xchg[2], *p; + __asm__ __volatile__( +#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__ + "pushl %%ebx\n\t" + "movl %8, %%ebx\n\t" +#endif +#if ETHR_SIZEOF_PTR == 4 + "lock; cmpxchg8b %0\n\t" +#else + "lock; cmpxchg16b %0\n\t" +#endif + "setz %3\n\t" +#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__ + "popl %%ebx\n\t" +#endif + : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=c"(xchgd) + : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "3"(new[1]), +#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__ + "r"(new[0]) +#else + "b"(new[0]) +#endif + : "cc", "memory"); + ; return 0; @@ -19819,77 +18197,41 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid; break + gcc_dw_cmpxchg_asm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >conftest.$ac_ext <<_ACEOF + if test $gcc_dw_cmpxchg_asm = no && test $ac_cv_sizeof_void_p = 4; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; -test_array [0] = 0 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; -test_array [0] = 0 + + char xchgd; + long new[2], xchg[2], *p; +#if !defined(__PIC__) || !__PIC__ +# error nope +#endif + __asm__ __volatile__( + "pushl %%ebx\n\t" + "movl (%7), %%ebx\n\t" + "movl 4(%7), %%ecx\n\t" + "lock; cmpxchg8b %0\n\t" + "setz %3\n\t" + "popl %%ebx\n\t" + : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=c"(xchgd) + : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "3"(new) + : "cc", "memory"); + ; return 0; @@ -19917,44 +18259,86 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=$ac_mid; break + gcc_dw_cmpxchg_asm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + if test "$gcc_dw_cmpxchg_asm" = "yes"; then -ac_lo= ac_hi= -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +cat >>confdefs.h <<\_ACEOF +#define ETHR_CMPXCHG8B_REGISTER_SHORTAGE 1 +_ACEOF + + fi + fi + echo "$as_me:$LINENO: result: $gcc_dw_cmpxchg_asm" >&5 +echo "${ECHO_T}$gcc_dw_cmpxchg_asm" >&6 + if test "$gcc_dw_cmpxchg_asm" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define ETHR_GCC_HAVE_DW_CMPXCHG_ASM_SUPPORT 1 +_ACEOF + + fi;; + *) + ;; +esac + + +cat >>confdefs.h <<\_ACEOF +#define ETHR_HAVE_ETHREAD_DEFINES 1 +_ACEOF + + + + + + + + + + + + +if test "X$ETHR_LIB_NAME" = "X"; then + found_threads=no +else + found_threads=yes fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF + + +ERTS_BUILD_SMP_EMU=$enable_smp_support +echo "$as_me:$LINENO: checking whether an emulator with smp support should be built" >&5 +echo $ECHO_N "checking whether an emulator with smp support should be built... $ECHO_C" >&6 +case $ERTS_BUILD_SMP_EMU in + yes) + echo "$as_me:$LINENO: result: yes; enabled by user" >&5 +echo "${ECHO_T}yes; enabled by user" >&6 + ;; + no) + echo "$as_me:$LINENO: result: no; disabled by user" >&5 +echo "${ECHO_T}no; disabled by user" >&6 + ;; + unknown) + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; -test_array [0] = 0 + + #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) + ; + #else + #error old or no gcc + #endif ; return 0; @@ -19982,116 +18366,126 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid + gcc_smp=okgcc else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr '(' $ac_mid ')' + 1` +gcc_smp=oldornogcc fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_long_long=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long long), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } ;; + ERTS_BUILD_SMP_EMU=yes + case "$enable_threads-$gcc_smp-$found_threads-$host_os" in + + no-*) + echo "$as_me:$LINENO: result: no; threads disabled by user" >&5 +echo "${ECHO_T}no; threads disabled by user" >&6 + ERTS_BUILD_SMP_EMU=no + ;; + + *-okgcc-yes-*) + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + ERTS_BUILD_SMP_EMU=yes + ;; + + *-win32) + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + ERTS_BUILD_SMP_EMU=yes + ;; + + *-oldornogcc-*) + echo "$as_me:$LINENO: result: no; old gcc or no gcc found" >&5 +echo "${ECHO_T}no; old gcc or no gcc found" >&6 + ERTS_BUILD_SMP_EMU=no + ;; + + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ERTS_BUILD_SMP_EMU=no + ;; + esac + ;; esac -else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} + +if test $ERTS_BUILD_SMP_EMU = yes; then + + if test $found_threads = no; then + { { echo "$as_me:$LINENO: error: cannot build smp enabled emulator since no thread library was found" >&5 +echo "$as_me: error: cannot build smp enabled emulator since no thread library was found" >&2;} { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + fi + + +cat >>confdefs.h <<\_ACEOF +#define ERTS_HAVE_SMP_EMU 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (long long)); } -unsigned long ulongval () { return (long) (sizeof (long long)); } -#include -#include -int -main () -{ - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (long long))) < 0) - { - long i = longval (); - if (i != ((long) (sizeof (long long)))) - exit (1); - fprintf (f, "%ld\n", i); - } - else - { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (long long)))) - exit (1); - fprintf (f, "%lu\n", i); - } - exit (ferror (f) || fclose (f) != 0); - ; - return 0; -} + test "X$smp_require_native_atomics" = "Xyes" && + +cat >>confdefs.h <<\_ACEOF +#define ETHR_SMP_REQUIRE_NATIVE_IMPLS 1 _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_long_long=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long long), 77 -See \`config.log' for more details." >&2;} + + case "$ethr_have_native_atomics-$smp_require_native_atomics-$ethr_have_native_spinlock" in + yes-*) + ;; + + no-yes-*) + { { echo "$as_me:$LINENO: error: No native atomic implementation found. See Configuring section in INSTALL.md for more information." >&5 +echo "$as_me: error: No native atomic implementation found. See Configuring section in INSTALL.md for more information." >&2;} { (exit 1); exit 1; }; } + ;; + + no-no-yes) + + test -f "$ERL_TOP/erts/CONF_INFO" || + echo "" > "$ERL_TOP/erts/CONF_INFO" + cat >> $ERL_TOP/erts/CONF_INFO < "$ERL_TOP/erts/CONF_INFO" + cat >> "$ERL_TOP/erts/CONF_INFO" <&5 -echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long -_ACEOF -cat >>confdefs.h <<_ACEOF -#define ETHR_SIZEOF_LONG_LONG $ac_cv_sizeof_long_long -_ACEOF -echo "$as_me:$LINENO: checking for __int64" >&5 -echo $ECHO_N "checking for __int64... $ECHO_C" >&6 -if test "${ac_cv_type___int64+set}" = set; then + +for ac_func in posix_fadvise closefrom +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -20100,21 +18494,54 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + int main () { -if ((__int64 *) 0) - return 0; -if (sizeof (__int64)) - return 0; +return f != $ac_func; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -20128,36 +18555,48 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type___int64=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type___int64=no +eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type___int64" >&5 -echo "${ECHO_T}$ac_cv_type___int64" >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -echo "$as_me:$LINENO: checking size of __int64" >&5 -echo $ECHO_N "checking size of __int64... $ECHO_C" >&6 -if test "${ac_cv_sizeof___int64+set}" = set; then +fi +done + + +for ac_header in linux/falloc.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - if test "$ac_cv_type___int64" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -20165,15 +18604,7 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (__int64))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -20197,126 +18628,143 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (__int64))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} +#include <$ac_header> _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid; break + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (__int64))) < 0)]; -test_array [0] = 0 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do +fi + +done + +echo "$as_me:$LINENO: checking whether fallocate() works" >&5 +echo $ECHO_N "checking whether fallocate() works... $ECHO_C" >&6 +if test "${i_cv_fallocate_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + + #include + #include + #include + #include + #include + #include + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int64))) >= $ac_mid)]; -test_array [0] = 0 + + int fd = creat("conftest.temp", 0600); + fallocate(fd, FALLOC_FL_KEEP_SIZE,(off_t) 1024,(off_t) 1024); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -20330,210 +18778,391 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=$ac_mid; break + i_cv_fallocate_works=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` +i_cv_fallocate_works=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -ac_lo= ac_hi= fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $i_cv_fallocate_works" >&5 +echo "${ECHO_T}$i_cv_fallocate_works" >&6 +if test $i_cv_fallocate_works = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FALLOCATE 1 +_ACEOF + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + +echo "$as_me:$LINENO: checking whether posix_fallocate() works" >&5 +echo $ECHO_N "checking whether posix_fallocate() works... $ECHO_C" >&6 +if test "${i_cv_posix_fallocate_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + + i_cv_posix_fallocate_works=no + +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (__int64))) <= $ac_mid)]; -test_array [0] = 0 - ; - return 0; -} + #if !defined(__sun) && !defined(__sun__) + #define _XOPEN_SOURCE 600 + #endif + #include + #include + #include + #include + #if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7)) + possibly broken posix_fallocate + #endif + int main() { + int fd = creat("conftest.temp", 0600); + int ret; + if (-1 == fd) { + perror("creat()"); + return 2; + } + ret = posix_fallocate(fd, 1024, 1024) < 0 ? 1 : 0; + unlink("conftest.temp"); + return ret; + } + _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid + + i_cv_posix_fallocate_works=yes + else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr '(' $ac_mid ')' + 1` +( exit $ac_status ) + + i_cv_posix_fallocate_works=no + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof___int64=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (__int64), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (__int64), 77 -See \`config.log' for more details." >&2;} +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +fi +echo "$as_me:$LINENO: result: $i_cv_posix_fallocate_works" >&5 +echo "${ECHO_T}$i_cv_posix_fallocate_works" >&6 +if test $i_cv_posix_fallocate_works = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_POSIX_FALLOCATE +_ACEOF + +fi + +# +# Figure out if the emulator should use threads. The default is set above +# in the enable_threads variable. It can have the following values: +# +# no single-threaded emulator requested +# yes multi-threaded emulator requested +# force multi-threaded emulator required +# +# EMU_THR_LIB_NAME, EMU_THR_LIBS, EMU_THR_X_LIBS, and EMU_THR_DEFS is +# used by the emulator, and can (but should not) be used by applications +# that only require thread support when the emulator has thread support. +# Other applications should use ETHR_LIB_NAME, ETHR_LIBS, ETHR_X_LIBS, +# and ETHR_DEFS. +# +echo "$as_me:$LINENO: checking whether the emulator should use threads" >&5 +echo $ECHO_N "checking whether the emulator should use threads... $ECHO_C" >&6 + +EMU_THR_LIB_NAME= +EMU_THR_X_LIBS= +EMU_THR_LIBS= +EMU_THR_DEFS= +emu_threads=no + +case "$enable_threads"-"$host_os" in + *-win32) + # The windows erlang emulator can never run without threads. + # It has to be enabled or the emulator will crash. Until that + # is fixed we force threads on win32. + enable_threads=force ;; + yes-osf*) + # The emulator hang when threads are enabled on osf + { { echo "$as_me:$LINENO: error: unresolved problems exist with threads on this platform" >&5 +echo "$as_me: error: unresolved problems exist with threads on this platform" >&2;} { (exit 1); exit 1; }; } ;; + *) ;; esac -else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + +case "$enable_threads"-"$found_threads" in + force-yes) + emu_threads=yes + echo "$as_me:$LINENO: result: yes; thread support required and therefore forced" >&5 +echo "${ECHO_T}yes; thread support required and therefore forced" >&6 ;; + yes-yes) + emu_threads=yes + echo "$as_me:$LINENO: result: yes; enabled by user" >&5 +echo "${ECHO_T}yes; enabled by user" >&6 ;; + unknown-yes) + case $host_os in + solaris*|linux*|darwin*|win32|ose) + emu_threads=yes + echo "$as_me:$LINENO: result: yes; default on this platform" >&5 +echo "${ECHO_T}yes; default on this platform" >&6 + ;; + *) + echo "$as_me:$LINENO: result: no; default on this platform" >&5 +echo "${ECHO_T}no; default on this platform" >&6 + ;; + esac + ;; + no-yes) + echo "$as_me:$LINENO: result: no; thread support found but disabled by user" >&5 +echo "${ECHO_T}no; thread support found but disabled by user" >&6 ;; + unknown-no|no-no) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 ;; + force-no) + { { echo "$as_me:$LINENO: error: thread support required but not found" >&5 +echo "$as_me: error: thread support required but not found" >&2;} + { (exit 1); exit 1; }; } ;; + yes-no) + { { echo "$as_me:$LINENO: error: thread support enabled by user but not found" >&5 +echo "$as_me: error: thread support enabled by user but not found" >&2;} + { (exit 1); exit 1; }; } ;; + *) + { { echo "$as_me:$LINENO: error: internal error" >&5 +echo "$as_me: error: internal error" >&2;} + { (exit 1); exit 1; }; } ;; +esac + +if test $emu_threads != yes; then + enable_lock_check=no + enable_lock_count=no + echo "$as_me:$LINENO: checking whether dirty schedulers should be enabled" >&5 +echo $ECHO_N "checking whether dirty schedulers should be enabled... $ECHO_C" >&6 + if test "x$enable_dirty_schedulers" != "xno"; then + +cat >>confdefs.h <<\_ACEOF +#define ERL_NIF_DIRTY_SCHEDULER_SUPPORT 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (__int64)); } -unsigned long ulongval () { return (long) (sizeof (__int64)); } -#include -#include -int -main () -{ - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (__int64))) < 0) - { - long i = longval (); - if (i != ((long) (sizeof (__int64)))) - exit (1); - fprintf (f, "%ld\n", i); - } - else - { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (__int64)))) - exit (1); - fprintf (f, "%lu\n", i); - } - exit (ferror (f) || fclose (f) != 0); - ; - return 0; -} +cat >>confdefs.h <<\_ACEOF +#define ERL_DRV_DIRTY_SCHEDULER_SUPPORT 1 _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof___int64=`cat conftest.val` + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + # Threads enabled for emulator + EMU_THR_LIB_NAME=$ETHR_LIB_NAME + EMU_THR_X_LIBS=$ETHR_X_LIBS + EMU_THR_LIBS=$ETHR_LIBS + EMU_THR_DEFS=$ETHR_DEFS + ENABLE_ALLOC_TYPE_VARS="$ENABLE_ALLOC_TYPE_VARS threads" + echo "$as_me:$LINENO: checking whether lock checking should be enabled" >&5 +echo $ECHO_N "checking whether lock checking should be enabled... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $enable_lock_check" >&5 +echo "${ECHO_T}$enable_lock_check" >&6 + if test "x$enable_lock_check" != "xno"; then + EMU_THR_DEFS="$EMU_THR_DEFS -DERTS_ENABLE_LOCK_CHECK" + fi -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (__int64), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (__int64), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi + echo "$as_me:$LINENO: checking whether lock counters should be enabled" >&5 +echo $ECHO_N "checking whether lock counters should be enabled... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $enable_lock_count" >&5 +echo "${ECHO_T}$enable_lock_count" >&6 + if test "x$enable_lock_count" != "xno"; then + EMU_THR_DEFS="$EMU_THR_DEFS -DERTS_ENABLE_LOCK_COUNT" + fi + + echo "$as_me:$LINENO: checking whether dirty schedulers should be enabled" >&5 +echo $ECHO_N "checking whether dirty schedulers should be enabled... $ECHO_C" >&6 + if test "x$enable_dirty_schedulers" != "xno"; then + EMU_THR_DEFS="$EMU_THR_DEFS -DERTS_DIRTY_SCHEDULERS" + +cat >>confdefs.h <<\_ACEOF +#define ERTS_DIRTY_SCHEDULERS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define ERL_NIF_DIRTY_SCHEDULER_SUPPORT 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define ERL_DRV_DIRTY_SCHEDULER_SUPPORT 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + + disable_child_waiter_thread=no + case $host_os in + solaris*) + enable_child_waiter_thread=yes + ;; + linux*) + echo "$as_me:$LINENO: checking whether dlopen() needs to be called before first call to dlerror()" >&5 +echo $ECHO_N "checking whether dlopen() needs to be called before first call to dlerror()... $ECHO_C" >&6 + if test "x$ETHR_THR_LIB_BASE_TYPE" != "xposix_nptl"; then + +cat >>confdefs.h <<\_ACEOF +#define ERTS_NEED_DLOPEN_BEFORE_DLERROR 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + if test "x$ETHR_THR_LIB_BASE_TYPE" != "xposix_nptl"; then + # Child waiter thread cannot be enabled + disable_child_waiter_thread=yes + enable_child_waiter_thread=no + fi + ;; + win32|ose) + # Child waiter thread cannot be enabled + disable_child_waiter_thread=yes + enable_child_waiter_thread=no + ;; + *) + ;; + esac + + # Remove -D_WIN32_WINNT*, -DWINVER* and -D_GNU_SOURCE from EMU_THR_DEFS + # (defined in CFLAGS). Note that we want to keep these flags + # in ETHR_DEFS, but not in EMU_THR_DEFS. + new_emu_thr_defs= + for thr_def in $EMU_THR_DEFS; do + case $thr_def in + -D_GNU_SOURCE*|-D_WIN32_WINNT*|-DWINVER*) + ;; + *) + new_emu_thr_defs="$new_emu_thr_defs $thr_def" + ;; + esac + done + EMU_THR_DEFS=$new_emu_thr_defs + + echo "$as_me:$LINENO: checking whether the child waiter thread should be enabled" >&5 +echo $ECHO_N "checking whether the child waiter thread should be enabled... $ECHO_C" >&6 + if test $enable_child_waiter_thread = yes; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_CHILD_WAITER_THREAD 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + case $ERTS_BUILD_SMP_EMU-$disable_child_waiter_thread in + yes-no) + echo "$as_me:$LINENO: result: yes on SMP build, but not on non-SMP build" >&5 +echo "${ECHO_T}yes on SMP build, but not on non-SMP build" >&6;; + *-yes) + +cat >>confdefs.h <<\_ACEOF +#define DISABLE_CHILD_WAITER_THREAD 1 +_ACEOF + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6;; + esac + fi fi -rm -f conftest.val + + + + + + +if test "x$enable_lock_check" = "xno"; then + EMU_LOCK_CHECKING=no else - ac_cv_sizeof___int64=0 -fi + EMU_LOCK_CHECKING=yes fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof___int64" >&5 -echo "${ECHO_T}$ac_cv_sizeof___int64" >&6 -cat >>confdefs.h <<_ACEOF -#define SIZEOF___INT64 $ac_cv_sizeof___int64 -_ACEOF -cat >>confdefs.h <<_ACEOF -#define ETHR_SIZEOF___INT64 $ac_cv_sizeof___int64 -_ACEOF -echo "$as_me:$LINENO: checking for __int128_t" >&5 -echo $ECHO_N "checking for __int128_t... $ECHO_C" >&6 -if test "${ac_cv_type___int128_t+set}" = set; then + +ERTS_INTERNAL_X_LIBS= + +echo "$as_me:$LINENO: checking for kstat_open in -lkstat" >&5 +echo $ECHO_N "checking for kstat_open in -lkstat... $ECHO_C" >&6 +if test "${ac_cv_lib_kstat_kstat_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-lkstat $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char kstat_open (); int main () { -if ((__int128_t *) 0) - return 0; -if (sizeof (__int128_t)) - return 0; +kstat_open (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -20547,56 +19176,87 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type___int128_t=yes + ac_cv_lib_kstat_kstat_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type___int128_t=no +ac_cv_lib_kstat_kstat_open=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_type___int128_t" >&5 -echo "${ECHO_T}$ac_cv_type___int128_t" >&6 +echo "$as_me:$LINENO: result: $ac_cv_lib_kstat_kstat_open" >&5 +echo "${ECHO_T}$ac_cv_lib_kstat_kstat_open" >&6 +if test $ac_cv_lib_kstat_kstat_open = yes; then -echo "$as_me:$LINENO: checking size of __int128_t" >&5 -echo $ECHO_N "checking size of __int128_t... $ECHO_C" >&6 -if test "${ac_cv_sizeof___int128_t+set}" = set; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_KSTAT 1 +_ACEOF + +ERTS_INTERNAL_X_LIBS="$ERTS_INTERNAL_X_LIBS -lkstat" +fi + + + + + + +THR_LIBS=$ETHR_X_LIBS +THR_DEFS=$ETHR_DEFS + + + + + +TERMCAP_LIB= + +if test "x$with_termcap" != "xno" && + test "X$host" != "Xwin32"; then + # try these libs + termcap_libs="tinfo ncurses curses termcap termlib" + + for termcap_lib in $termcap_libs; do + as_ac_Lib=`echo "ac_cv_lib_$termcap_lib''_tgetent" | $as_tr_sh` +echo "$as_me:$LINENO: checking for tgetent in -l$termcap_lib" >&5 +echo $ECHO_N "checking for tgetent in -l$termcap_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type___int128_t" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$termcap_lib $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgetent (); int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) >= 0)]; -test_array [0] = 0 - +tgetent (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -20610,34 +19270,73 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Lib=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + TERMCAP_LIB="-l$termcap_lib" +fi + + if test "x$TERMCAP_LIB" != "x"; then + break + fi + done + + if test "x$TERMCAP_LIB" = "x"; then + { { echo "$as_me:$LINENO: error: No curses library functions found" >&5 +echo "$as_me: error: No curses library functions found" >&2;} + { (exit 1); exit 1; }; } + fi +fi + + + +if test "x$TERMCAP_LIB" != "x"; then + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TERMCAP 1 +_ACEOF + +fi + +if test "X$host" != "Xwin32"; then + echo "$as_me:$LINENO: checking for wcwidth" >&5 +echo $ECHO_N "checking for wcwidth... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default +#include int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) <= $ac_mid)]; -test_array [0] = 0 - +wcwidth(0); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -20651,50 +19350,83 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid; break + have_wcwidth=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` +have_wcwidth=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test $have_wcwidth = yes; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +cat >>confdefs.h <<\_ACEOF +#define HAVE_WCWIDTH 1 +_ACEOF + + fi +fi + + +# Check whether --enable-builtin-zlib or --disable-builtin-zlib was given. +if test "${enable_builtin_zlib+set}" = set; then + enableval="$enable_builtin_zlib" + case "$enableval" in + no) enable_builtin_zlib=no ;; + *) enable_builtin_zlib=yes ;; + esac +else + enable_builtin_zlib=no +fi; + +Z_LIB= + +if test "x$enable_builtin_zlib" = "xyes"; then + { echo "$as_me:$LINENO: Using our own built-in zlib source" >&5 +echo "$as_me: Using our own built-in zlib source" >&6;} +else +echo "$as_me:$LINENO: checking for zlib 1.2.5 or higher" >&5 +echo $ECHO_N "checking for zlib 1.2.5 or higher... $ECHO_C" >&6 +zlib_save_LIBS=$LIBS +LIBS="-lz $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + +#include "zlib.h" + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) < 0)]; -test_array [0] = 0 + +#if ZLIB_VERNUM >= 0x1250 + Bytef s[1]; + s[0] = 0; + (void) adler32((uLong)0, s, 1); +#else +#error "No zlib 1.2.5 or higher found" +error +#endif ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -20708,34 +19440,115 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF + + Z_LIB="-lz" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBZ 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$zlib_save_LIBS +fi + + +#-------------------------------------------------------------------- +# Check for the existence of the -lsocket and -lnsl libraries. +# The order here is important, so that they end up in the right +# order in the command line generated by make. Here are some +# special considerations: +# 1. Use "connect" and "accept" to check for -lsocket, and +# "gethostbyname" to check for -lnsl. +# 2. Use each function name only once: can't redo a check because +# autoconf caches the results of the last check and won't redo it. +# 3. Use -lnsl and -lsocket only if they supply procedures that +# aren't already present in the normal libraries. This is because +# IRIX 5.2 has libraries, but they aren't needed and they're +# bogus: they goof up name resolution if used. +# 4. On some SVR4 systems, can't use -lsocket without -lnsl too. +# To get around this problem, check for both libraries together +# if -lsocket doesn't work by itself. +#-------------------------------------------------------------------- + +erl_checkBoth=0 +echo "$as_me:$LINENO: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default +/* Define connect to an innocuous variant, in case declares connect. + For example, HP-UX 11i declares gettimeofday. */ +#define connect innocuous_connect + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef connect + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +/* 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_connect) || defined (__stub___connect) +choke me +#else +char (*f) () = connect; +#endif +#ifdef __cplusplus +} +#endif + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) >= $ac_mid)]; -test_array [0] = 0 - +return f != connect; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -20749,58 +19562,57 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=$ac_mid; break + ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` +ac_cv_func_connect=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo= ac_hi= +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 +if test $ac_cv_func_connect = yes; then + erl_checkSocket=0 +else + erl_checkSocket=1 fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF + +if test "$erl_checkSocket" = 1; then + echo "$as_me:$LINENO: checking for main in -lsocket" >&5 +echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + + int main () { -static int test_array [1 - 2 * !(((long) (sizeof (__int128_t))) <= $ac_mid)]; -test_array [0] = 0 - +main (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -20814,36 +19626,39 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid + ac_cv_lib_socket_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr '(' $ac_mid ')' + 1` +ac_cv_lib_socket_main=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof___int128_t=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (__int128_t), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (__int128_t), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } ;; -esac +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_main" >&6 +if test $ac_cv_lib_socket_main = yes; then + LIBS="$LIBS -lsocket" else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + erl_checkBoth=1 +fi + +fi +if test "$erl_checkBoth" = 1; then + tk_oldLibs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + echo "$as_me:$LINENO: checking for accept" >&5 +echo $ECHO_N "checking for accept... $ECHO_C" >&6 +if test "${ac_cv_func_accept+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20851,121 +19666,151 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (__int128_t)); } -unsigned long ulongval () { return (long) (sizeof (__int128_t)); } -#include -#include +/* Define accept to an innocuous variant, in case declares accept. + For example, HP-UX 11i declares gettimeofday. */ +#define accept innocuous_accept + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char accept (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef accept + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char accept (); +/* 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_accept) || defined (__stub___accept) +choke me +#else +char (*f) () = accept; +#endif +#ifdef __cplusplus +} +#endif + int main () { - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (__int128_t))) < 0) - { - long i = longval (); - if (i != ((long) (sizeof (__int128_t)))) - exit (1); - fprintf (f, "%ld\n", i); - } - else - { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (__int128_t)))) - exit (1); - fprintf (f, "%lu\n", i); - } - exit (ferror (f) || fclose (f) != 0); - +return f != accept; ; return 0; } _ACEOF -rm -f conftest$ac_exeext +rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof___int128_t=`cat conftest.val` + ac_cv_func_accept=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (__int128_t), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (__int128_t), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_cv_func_accept=no fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -rm -f conftest.val +echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5 +echo "${ECHO_T}$ac_cv_func_accept" >&6 +if test $ac_cv_func_accept = yes; then + erl_checkNsl=0 else - ac_cv_sizeof___int128_t=0 -fi + LIBS=$tk_oldLibs fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof___int128_t" >&5 -echo "${ECHO_T}$ac_cv_sizeof___int128_t" >&6 -cat >>confdefs.h <<_ACEOF -#define SIZEOF___INT128_T $ac_cv_sizeof___int128_t -_ACEOF - - - -cat >>confdefs.h <<_ACEOF -#define ETHR_SIZEOF___INT128_T $ac_cv_sizeof___int128_t -_ACEOF - - - -case X$erl_xcomp_bigendian in - X) ;; - Xyes|Xno) ac_cv_c_bigendian=$erl_xcomp_bigendian;; - *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian" >&5 -echo "$as_me: error: Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian" >&2;} - { (exit 1); exit 1; }; };; -esac -echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 -if test "${ac_cv_c_bigendian+set}" = set; then +fi +echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - # See if sys/param.h defines the BYTE_ORDER macro. -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +/* Define gethostbyname to an innocuous variant, in case declares gethostbyname. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname innocuous_gethostbyname -int -main () +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyname + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" { -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +/* 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_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +char (*f) () = gethostbyname; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != gethostbyname; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -20979,36 +19824,53 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - # It does; now see whether it defined to BIG_ENDIAN or not. + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gethostbyname=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 +if test $ac_cv_func_gethostbyname = yes; then + : +else + echo "$as_me:$LINENO: checking for main in -lnsl" >&5 +echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include + int main () { -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif - +main (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -21022,51 +19884,90 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_c_bigendian=yes + ac_cv_lib_nsl_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_c_bigendian=no +ac_cv_lib_nsl_main=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6 +if test $ac_cv_lib_nsl_main = yes; then + LIBS="$LIBS -lnsl" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -# It does not; compile a test program. -if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file - ac_cv_c_bigendian=unknown +fi + +echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 +echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; -void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } -int -main () -{ - _ascii (); _ebcdic (); +/* Define gethostbyname_r to an innocuous variant, in case declares gethostbyname_r. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname_r innocuous_gethostbyname_r + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyname_r + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname_r (); +/* 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_gethostbyname_r) || defined (__stub___gethostbyname_r) +choke me +#else +char (*f) () = gethostbyname_r; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gethostbyname_r; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -21080,255 +19981,215 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; 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 + ac_cv_func_gethostbyname_r=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_func_gethostbyname_r=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat >conftest.$ac_ext <<_ACEOF +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname_r" >&6 +if test $ac_cv_func_gethostbyname_r = yes; then + have_gethostbyname_r=yes +fi + + + +if test "$have_gethostbyname_r" = yes; then + # OK, so we have gethostbyname_r() - but do we know how to call it...? + # (if not, HAVE_GETHOSTBYNAME_R will not be defined at all) + case $host_os in + solaris2*) + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETHOSTBYNAME_R GHBN_R_SOLARIS +_ACEOF + + ;; + aix4*) + # AIX version also needs "struct hostent_data" defn + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include int main () { - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long l; - char c[sizeof (long)]; - } u; - u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); +struct hostent_data hd; + ; + return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_c_bigendian=no + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETHOSTBYNAME_R GHBN_R_AIX +_ACEOF + else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_c_bigendian=yes -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -echo "${ECHO_T}$ac_cv_c_bigendian" >&6 -case $ac_cv_c_bigendian in - yes) - -cat >>confdefs.h <<\_ACEOF -#define WORDS_BIGENDIAN 1 + ;; + *) + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF - ;; - no) - ;; - *) - { { echo "$as_me:$LINENO: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -echo "$as_me: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} - { (exit 1); exit 1; }; } ;; -esac - +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #ifdef __GLIBC__ + yes + #endif -if test "$ac_cv_c_bigendian" = "yes"; then +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then cat >>confdefs.h <<\_ACEOF -#define ETHR_BIGENDIAN 1 +#define HAVE_GETHOSTBYNAME_R GHBN_R_GLIBC _ACEOF fi +rm -f conftest* -case X$erl_xcomp_double_middle_endian in - X) ;; - Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; - *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian" >&5 -echo "$as_me: error: Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian" >&2;} - { (exit 1); exit 1; }; };; -esac + ;; + esac +fi -echo "$as_me:$LINENO: checking whether double word ordering is middle-endian" >&5 -echo $ECHO_N "checking whether double word ordering is middle-endian... $ECHO_C" >&6 -if test "${ac_cv_c_double_middle_endian+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # It does not; compile a test program. -if test "$cross_compiling" = yes; then - ac_cv_c_double_middle=unknown -else - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking for working posix_openpt implementation" >&5 +echo $ECHO_N "checking for working posix_openpt implementation... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + +#define _XOPEN_SOURCE 600 #include +#include int -main(void) +main () { - int i = 0; - int zero = 0; - int bigendian; - int zero_index = 0; - - union - { - long int l; - char c[sizeof (long int)]; - } u; - - /* we'll use the one with 32-bit words */ - union - { - double d; - unsigned int c[2]; - } vint; - - union - { - double d; - unsigned long c[2]; - } vlong; - - union - { - double d; - unsigned short c[2]; - } vshort; - - - /* Are we little or big endian? From Harbison&Steele. */ - u.l = 1; - bigendian = (u.c[sizeof (long int) - 1] == 1); - - zero_index = bigendian ? 1 : 0; - vint.d = 1.0; - vlong.d = 1.0; - vshort.d = 1.0; - - if (sizeof(unsigned int) == 4) - { - if (vint.c[zero_index] != 0) - zero = 1; - } - else if (sizeof(unsigned long) == 4) - { - if (vlong.c[zero_index] != 0) - zero = 1; - } - else if (sizeof(unsigned short) == 4) - { - if (vshort.c[zero_index] != 0) - zero = 1; - } + int mfd = posix_openpt(O_RDWR); + ptsname(mfd); + grantpt(mfd); + unlockpt(mfd); + return mfd; - exit (zero); + ; + return 0; } - _ACEOF -rm -f conftest$ac_exeext +rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_c_double_middle_endian=no + working_posix_openpt=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_c_double_middle_endian=yes -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi +working_posix_openpt=no fi -echo "$as_me:$LINENO: result: $ac_cv_c_double_middle_endian" >&5 -echo "${ECHO_T}$ac_cv_c_double_middle_endian" >&6 -case $ac_cv_c_double_middle_endian in - yes) +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +if test "X$working_posix_openpt" = "Xyes"; then cat >>confdefs.h <<\_ACEOF -#define DOUBLE_MIDDLE_ENDIAN 1 +#define HAVE_WORKING_POSIX_OPENPT 1 _ACEOF - ;; - no) - ;; - *) - { echo "$as_me:$LINENO: WARNING: unknown double endianness -presetting ac_cv_c_double_middle_endian=no (or yes) will help" >&5 -echo "$as_me: WARNING: unknown double endianness -presetting ac_cv_c_double_middle_endian=no (or yes) will help" >&2;} ;; -esac + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -ETHR_X86_SSE2_ASM=no -case "$GCC-$ac_cv_sizeof_void_p-$host_cpu" in - yes-4-i86pc | yes-4-i*86 | yes-4-x86_64 | yes-4-amd64) - echo "$as_me:$LINENO: checking for gcc sse2 asm support" >&5 -echo $ECHO_N "checking for gcc sse2 asm support... $ECHO_C" >&6 - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -msse2" - gcc_sse2_asm=no - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking if netdb.h requires netinet/in.h to be previously included" >&5 +echo $ECHO_N "checking if netdb.h requires netinet/in.h to be previously included... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sockaddr_in" >/dev/null 2>&1; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #include int main () { - - long long x, *y; - __asm__ __volatile__("movq %1, %0\n\t" : "=x"(x) : "m"(*y) : "memory"); - +return 0; ; return 0; } @@ -21355,71 +20216,46 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gcc_sse2_asm=yes + need_in_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +need_in_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - echo "$as_me:$LINENO: result: $gcc_sse2_asm" >&5 -echo "${ECHO_T}$gcc_sse2_asm" >&6 - if test "$gcc_sse2_asm" = "yes"; then +else + need_in_h=no +fi +rm -f conftest* + + +if test $need_in_h = yes; then cat >>confdefs.h <<\_ACEOF -#define ETHR_GCC_HAVE_SSE2_ASM_SUPPORT 1 +#define NETDB_H_NEEDS_IN_H 1 _ACEOF - ETHR_X86_SSE2_ASM=yes - fi - ;; - *) - ;; -esac + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -case "$GCC-$host_cpu" in - yes-i86pc | yes-i*86 | yes-x86_64 | yes-amd64) - gcc_dw_cmpxchg_asm=no - echo "$as_me:$LINENO: checking for gcc double word cmpxchg asm support" >&5 -echo $ECHO_N "checking for gcc double word cmpxchg asm support... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +#include int main () { - - char xchgd; - long new[2], xchg[2], *p; - __asm__ __volatile__( -#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__ - "pushl %%ebx\n\t" - "movl %8, %%ebx\n\t" -#endif -#if ETHR_SIZEOF_PTR == 4 - "lock; cmpxchg8b %0\n\t" -#else - "lock; cmpxchg16b %0\n\t" -#endif - "setz %3\n\t" -#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__ - "popl %%ebx\n\t" -#endif - : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=c"(xchgd) - : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "3"(new[1]), -#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__ - "r"(new[0]) -#else - "b"(new[0]) -#endif - : "cc", "memory"); - - +socklen_t test; ; return 0; } @@ -21446,42 +20282,45 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gcc_dw_cmpxchg_asm=yes + have_socklen_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +have_socklen_t=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - if test $gcc_dw_cmpxchg_asm = no && test $ac_cv_sizeof_void_p = 4; then - cat >conftest.$ac_ext <<_ACEOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext, + +if test $have_socklen_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SOCKLEN_T 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + +echo "$as_me:$LINENO: checking for h_errno declaration in netdb.h" >&5 +echo $ECHO_N "checking for h_errno declaration in netdb.h... $ECHO_C" >&6 +if test "${ac_cv_decl_h_errno+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +#include int main () { - - char xchgd; - long new[2], xchg[2], *p; -#if !defined(__PIC__) || !__PIC__ -# error nope -#endif - __asm__ __volatile__( - "pushl %%ebx\n\t" - "movl (%7), %%ebx\n\t" - "movl 4(%7), %%ecx\n\t" - "lock; cmpxchg8b %0\n\t" - "setz %3\n\t" - "popl %%ebx\n\t" - : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=c"(xchgd) - : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "3"(new) - : "cc", "memory"); - - +int err = h_errno; ; return 0; } @@ -21508,87 +20347,57 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gcc_dw_cmpxchg_asm=yes + ac_cv_decl_h_errno=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_decl_h_errno=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$gcc_dw_cmpxchg_asm" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define ETHR_CMPXCHG8B_REGISTER_SHORTAGE 1 -_ACEOF - - fi - fi - echo "$as_me:$LINENO: result: $gcc_dw_cmpxchg_asm" >&5 -echo "${ECHO_T}$gcc_dw_cmpxchg_asm" >&6 - if test "$gcc_dw_cmpxchg_asm" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define ETHR_GCC_HAVE_DW_CMPXCHG_ASM_SUPPORT 1 -_ACEOF - - fi;; - *) - ;; -esac - +fi +echo "$as_me:$LINENO: result: $ac_cv_decl_h_errno" >&5 +echo "${ECHO_T}$ac_cv_decl_h_errno" >&6 +if test $ac_cv_decl_h_errno = yes; then cat >>confdefs.h <<\_ACEOF -#define ETHR_HAVE_ETHREAD_DEFINES 1 +#define H_ERRNO_DECLARED 1 _ACEOF +fi +saved_cppflags=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $EMU_THR_DEFS" - - -if test "X$ETHR_LIB_NAME" = "X"; then - found_threads=no +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - found_threads=yes -fi - - -ERTS_BUILD_SMP_EMU=$enable_smp_support -echo "$as_me:$LINENO: checking whether an emulator with smp support should be built" >&5 -echo $ECHO_N "checking whether an emulator with smp support should be built... $ECHO_C" >&6 -case $ERTS_BUILD_SMP_EMU in - yes) - echo "$as_me:$LINENO: result: yes; enabled by user" >&5 -echo "${ECHO_T}yes; enabled by user" >&6 - ;; - no) - echo "$as_me:$LINENO: result: no; disabled by user" >&5 -echo "${ECHO_T}no; disabled by user" >&6 - ;; - unknown) - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include +#include <$ac_hdr> int main () { - - #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) - ; - #else - #error old or no gcc - #endif - +if ((DIR *) 0) +return 0; ; return 0; } @@ -21615,196 +20424,53 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gcc_smp=okgcc + eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -gcc_smp=oldornogcc +eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ERTS_BUILD_SMP_EMU=yes - case "$enable_threads-$gcc_smp-$found_threads-$host_os" in - - no-*) - echo "$as_me:$LINENO: result: no; threads disabled by user" >&5 -echo "${ECHO_T}no; threads disabled by user" >&6 - ERTS_BUILD_SMP_EMU=no - ;; - - *-okgcc-yes-*) - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - ERTS_BUILD_SMP_EMU=yes - ;; - - *-win32) - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - ERTS_BUILD_SMP_EMU=yes - ;; - - *-oldornogcc-*) - echo "$as_me:$LINENO: result: no; old gcc or no gcc found" >&5 -echo "${ECHO_T}no; old gcc or no gcc found" >&6 - ERTS_BUILD_SMP_EMU=no - ;; - - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ERTS_BUILD_SMP_EMU=no - ;; - esac - ;; -esac - -if test $ERTS_BUILD_SMP_EMU = yes; then - - if test $found_threads = no; then - { { echo "$as_me:$LINENO: error: cannot build smp enabled emulator since no thread library was found" >&5 -echo "$as_me: error: cannot build smp enabled emulator since no thread library was found" >&2;} - { (exit 1); exit 1; }; } - fi - - -cat >>confdefs.h <<\_ACEOF -#define ERTS_HAVE_SMP_EMU 1 -_ACEOF - - - test "X$smp_require_native_atomics" = "Xyes" && - -cat >>confdefs.h <<\_ACEOF -#define ETHR_SMP_REQUIRE_NATIVE_IMPLS 1 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF - - case "$ethr_have_native_atomics-$smp_require_native_atomics-$ethr_have_native_spinlock" in - yes-*) - if test "$ethr_native_atomic_implementation" = "gcc_sync"; then - test -f "$ERL_TOP/erts/CONF_INFO" || - echo "" > "$ERL_TOP/erts/CONF_INFO" - cat >> $ERL_TOP/erts/CONF_INFO <&5 -echo "$as_me: error: No native atomic implementation found. See the \\"Atomic Memory Operations and the VM\\" chapter of \$ERL_TOP/HOWTO/INSTALL.md for more information." >&2;} - { (exit 1); exit 1; }; } - ;; - - no-no-yes) - - test -f "$ERL_TOP/erts/CONF_INFO" || - echo "" > "$ERL_TOP/erts/CONF_INFO" - cat >> $ERL_TOP/erts/CONF_INFO < "$ERL_TOP/erts/CONF_INFO" - cat >> "$ERL_TOP/erts/CONF_INFO" <&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 +if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_func_search_save_LIBS=$LIBS +ac_cv_search_opendir=no +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - +char opendir (); int main () { -return f != $ac_func; +opendir (); ; return 0; } @@ -21831,54 +20497,42 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_search_opendir="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -for ac_header in linux/falloc.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF +if test "$ac_cv_search_opendir" = no; then + for ac_lib in dir; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -21892,121 +20546,95 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_search_opendir="-l$ac_lib" +break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6 +if test "$ac_cv_search_opendir" != no; then + test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +fi + +else + echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - fi - -done - -echo "$as_me:$LINENO: checking whether fallocate() works" >&5 -echo $ECHO_N "checking whether fallocate() works... $ECHO_C" >&6 -if test "${i_cv_fallocate_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_opendir" = no; then + for ac_lib in x; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -22014,20 +20642,17 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include - #include - #include - #include - #include - #include - +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); int main () { - - int fd = creat("conftest.temp", 0600); - fallocate(fd, FALLOC_FL_KEEP_SIZE,(off_t) 1024,(off_t) 1024); - +opendir (); ; return 0; } @@ -22054,479 +20679,227 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - i_cv_fallocate_works=yes + ac_cv_search_opendir="-l$ac_lib" +break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -i_cv_fallocate_works=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - + done fi -echo "$as_me:$LINENO: result: $i_cv_fallocate_works" >&5 -echo "${ECHO_T}$i_cv_fallocate_works" >&6 -if test $i_cv_fallocate_works = yes; then +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6 +if test "$ac_cv_search_opendir" != no; then + test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" -cat >>confdefs.h <<\_ACEOF -#define HAVE_FALLOCATE 1 -_ACEOF +fi fi -echo "$as_me:$LINENO: checking whether posix_fallocate() works" >&5 -echo $ECHO_N "checking whether posix_fallocate() works... $ECHO_C" >&6 -if test "${i_cv_posix_fallocate_works+set}" = set; then +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - if test "$cross_compiling" = yes; then - - i_cv_posix_fallocate_works=no - -else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include +#include +#include +#include - #if !defined(__sun) && !defined(__sun__) - #define _XOPEN_SOURCE 600 - #endif - #include - #include - #include - #include - #if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7)) - possibly broken posix_fallocate - #endif - int main() { - int fd = creat("conftest.temp", 0600); - int ret; - if (-1 == fd) { - perror("creat()"); - return 2; - } - ret = posix_fallocate(fd, 1024, 1024) < 0 ? 1 : 0; - unlink("conftest.temp"); - return ret; - } +int +main () +{ + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - - i_cv_posix_fallocate_works=yes - + ac_cv_header_stdc=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) - - i_cv_posix_fallocate_works=no - -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - +ac_cv_header_stdc=no fi -echo "$as_me:$LINENO: result: $i_cv_posix_fallocate_works" >&5 -echo "${ECHO_T}$i_cv_posix_fallocate_works" >&6 -if test $i_cv_posix_fallocate_works = yes; then +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -cat >>confdefs.h <<\_ACEOF -#define HAVE_POSIX_FALLOCATE -_ACEOF - -fi - -# -# Figure out if the emulator should use threads. The default is set above -# in the enable_threads variable. It can have the following values: -# -# no single-threaded emulator requested -# yes multi-threaded emulator requested -# force multi-threaded emulator required -# -# EMU_THR_LIB_NAME, EMU_THR_LIBS, EMU_THR_X_LIBS, and EMU_THR_DEFS is -# used by the emulator, and can (but should not) be used by applications -# that only require thread support when the emulator has thread support. -# Other applications should use ETHR_LIB_NAME, ETHR_LIBS, ETHR_X_LIBS, -# and ETHR_DEFS. -# -echo "$as_me:$LINENO: checking whether the emulator should use threads" >&5 -echo $ECHO_N "checking whether the emulator should use threads... $ECHO_C" >&6 - -EMU_THR_LIB_NAME= -EMU_THR_X_LIBS= -EMU_THR_LIBS= -EMU_THR_DEFS= -emu_threads=no - -case "$enable_threads"-"$host_os" in - *-win32) - # The windows erlang emulator can never run without threads. - # It has to be enabled or the emulator will crash. Until that - # is fixed we force threads on win32. - enable_threads=force ;; - yes-osf*) - # The emulator hang when threads are enabled on osf - { { echo "$as_me:$LINENO: error: unresolved problems exist with threads on this platform" >&5 -echo "$as_me: error: unresolved problems exist with threads on this platform" >&2;} - { (exit 1); exit 1; }; } ;; - *) ;; -esac - -case "$enable_threads"-"$found_threads" in - force-yes) - emu_threads=yes - echo "$as_me:$LINENO: result: yes; thread support required and therefore forced" >&5 -echo "${ECHO_T}yes; thread support required and therefore forced" >&6 ;; - yes-yes) - emu_threads=yes - echo "$as_me:$LINENO: result: yes; enabled by user" >&5 -echo "${ECHO_T}yes; enabled by user" >&6 ;; - unknown-yes) - case $host_os in - solaris*|linux*|darwin*|win32|ose) - emu_threads=yes - echo "$as_me:$LINENO: result: yes; default on this platform" >&5 -echo "${ECHO_T}yes; default on this platform" >&6 - ;; - *) - echo "$as_me:$LINENO: result: no; default on this platform" >&5 -echo "${ECHO_T}no; default on this platform" >&6 - ;; - esac - ;; - no-yes) - echo "$as_me:$LINENO: result: no; thread support found but disabled by user" >&5 -echo "${ECHO_T}no; thread support found but disabled by user" >&6 ;; - unknown-no|no-no) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 ;; - force-no) - { { echo "$as_me:$LINENO: error: thread support required but not found" >&5 -echo "$as_me: error: thread support required but not found" >&2;} - { (exit 1); exit 1; }; } ;; - yes-no) - { { echo "$as_me:$LINENO: error: thread support enabled by user but not found" >&5 -echo "$as_me: error: thread support enabled by user but not found" >&2;} - { (exit 1); exit 1; }; } ;; - *) - { { echo "$as_me:$LINENO: error: internal error" >&5 -echo "$as_me: error: internal error" >&2;} - { (exit 1); exit 1; }; } ;; -esac - -if test $emu_threads != yes; then - enable_lock_check=no - enable_lock_count=no - echo "$as_me:$LINENO: checking whether dirty schedulers should be enabled" >&5 -echo $ECHO_N "checking whether dirty schedulers should be enabled... $ECHO_C" >&6 - if test "x$enable_dirty_schedulers" != "xno"; then - -cat >>confdefs.h <<\_ACEOF -#define ERL_NIF_DIRTY_SCHEDULER_SUPPORT 1 +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include - -cat >>confdefs.h <<\_ACEOF -#define ERL_DRV_DIRTY_SCHEDULER_SUPPORT 1 _ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - fi +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : else - # Threads enabled for emulator - EMU_THR_LIB_NAME=$ETHR_LIB_NAME - EMU_THR_X_LIBS=$ETHR_X_LIBS - EMU_THR_LIBS=$ETHR_LIBS - EMU_THR_DEFS=$ETHR_DEFS - ENABLE_ALLOC_TYPE_VARS="$ENABLE_ALLOC_TYPE_VARS threads" - echo "$as_me:$LINENO: checking whether lock checking should be enabled" >&5 -echo $ECHO_N "checking whether lock checking should be enabled... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $enable_lock_check" >&5 -echo "${ECHO_T}$enable_lock_check" >&6 - if test "x$enable_lock_check" != "xno"; then - EMU_THR_DEFS="$EMU_THR_DEFS -DERTS_ENABLE_LOCK_CHECK" - fi - - echo "$as_me:$LINENO: checking whether lock counters should be enabled" >&5 -echo $ECHO_N "checking whether lock counters should be enabled... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $enable_lock_count" >&5 -echo "${ECHO_T}$enable_lock_count" >&6 - if test "x$enable_lock_count" != "xno"; then - EMU_THR_DEFS="$EMU_THR_DEFS -DERTS_ENABLE_LOCK_COUNT" - fi - - echo "$as_me:$LINENO: checking whether dirty schedulers should be enabled" >&5 -echo $ECHO_N "checking whether dirty schedulers should be enabled... $ECHO_C" >&6 - if test "x$enable_dirty_schedulers" != "xno"; then - EMU_THR_DEFS="$EMU_THR_DEFS -DERTS_DIRTY_SCHEDULERS" - -cat >>confdefs.h <<\_ACEOF -#define ERTS_DIRTY_SCHEDULERS 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define ERL_NIF_DIRTY_SCHEDULER_SUPPORT 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define ERL_DRV_DIRTY_SCHEDULER_SUPPORT 1 -_ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - fi - - disable_child_waiter_thread=no - case $host_os in - solaris*) - enable_child_waiter_thread=yes - ;; - linux*) - echo "$as_me:$LINENO: checking whether dlopen() needs to be called before first call to dlerror()" >&5 -echo $ECHO_N "checking whether dlopen() needs to be called before first call to dlerror()... $ECHO_C" >&6 - if test "x$ETHR_THR_LIB_BASE_TYPE" != "xposix_nptl"; then - -cat >>confdefs.h <<\_ACEOF -#define ERTS_NEED_DLOPEN_BEFORE_DLERROR 1 -_ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - fi - if test "x$ETHR_THR_LIB_BASE_TYPE" != "xposix_nptl"; then - # Child waiter thread cannot be enabled - disable_child_waiter_thread=yes - enable_child_waiter_thread=no - fi - ;; - win32|ose) - # Child waiter thread cannot be enabled - disable_child_waiter_thread=yes - enable_child_waiter_thread=no - ;; - *) - ;; - esac - - # Remove -D_WIN32_WINNT*, -DWINVER* and -D_GNU_SOURCE from EMU_THR_DEFS - # (defined in CFLAGS). Note that we want to keep these flags - # in ETHR_DEFS, but not in EMU_THR_DEFS. - new_emu_thr_defs= - for thr_def in $EMU_THR_DEFS; do - case $thr_def in - -D_GNU_SOURCE*|-D_WIN32_WINNT*|-DWINVER*) - ;; - *) - new_emu_thr_defs="$new_emu_thr_defs $thr_def" - ;; - esac - done - EMU_THR_DEFS=$new_emu_thr_defs + ac_cv_header_stdc=no +fi +rm -f conftest* - echo "$as_me:$LINENO: checking whether the child waiter thread should be enabled" >&5 -echo $ECHO_N "checking whether the child waiter thread should be enabled... $ECHO_C" >&6 - if test $enable_child_waiter_thread = yes; then +fi -cat >>confdefs.h <<\_ACEOF -#define ENABLE_CHILD_WAITER_THREAD 1 +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - case $ERTS_BUILD_SMP_EMU-$disable_child_waiter_thread in - yes-no) - echo "$as_me:$LINENO: result: yes on SMP build, but not on non-SMP build" >&5 -echo "${ECHO_T}yes on SMP build, but not on non-SMP build" >&6;; - *-yes) - -cat >>confdefs.h <<\_ACEOF -#define DISABLE_CHILD_WAITER_THREAD 1 _ACEOF - - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6;; - esac - fi -fi - - - - - - -if test "x$enable_lock_check" = "xno"; then - EMU_LOCK_CHECKING=no +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : else - EMU_LOCK_CHECKING=yes + ac_cv_header_stdc=no fi +rm -f conftest* +fi - - - -ERTS_INTERNAL_X_LIBS= - -echo "$as_me:$LINENO: checking for kstat_open in -lkstat" >&5 -echo $ECHO_N "checking for kstat_open in -lkstat... $ECHO_C" >&6 -if test "${ac_cv_lib_kstat_kstat_open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +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 - ac_check_lib_save_LIBS=$LIBS -LIBS="-lkstat $LIBS" -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" +#include +#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 -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char kstat_open (); + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { -kstat_open (); - ; - return 0; + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_kstat_kstat_open=yes + : else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_kstat_kstat_open=no +( exit $ac_status ) +ac_cv_header_stdc=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_lib_kstat_kstat_open" >&5 -echo "${ECHO_T}$ac_cv_lib_kstat_kstat_open" >&6 -if test $ac_cv_lib_kstat_kstat_open = yes; then +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_KSTAT 1 +#define STDC_HEADERS 1 _ACEOF -ERTS_INTERNAL_X_LIBS="$ERTS_INTERNAL_X_LIBS -lkstat" fi - - - - - -THR_LIBS=$ETHR_X_LIBS -THR_DEFS=$ETHR_DEFS - - - - - -TERMCAP_LIB= - -if test "x$with_termcap" != "xno" && - test "X$host" != "Xwin32"; then - # try these libs - termcap_libs="tinfo ncurses curses termcap termlib" - - for termcap_lib in $termcap_libs; do - as_ac_Lib=`echo "ac_cv_lib_$termcap_lib''_tgetent" | $as_tr_sh` -echo "$as_me:$LINENO: checking for tgetent in -l$termcap_lib" >&5 -echo $ECHO_N "checking for tgetent in -l$termcap_lib... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Lib+set}\" = set"; then +echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$termcap_lib $LIBS" -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char tgetent (); +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + int main () { -tgetent (); + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -22540,73 +20913,58 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_Lib=yes" + ac_cv_header_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_Lib=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 -if test `eval echo '${'$as_ac_Lib'}'` = yes; then - TERMCAP_LIB="-l$termcap_lib" +ac_cv_header_sys_wait_h=no fi - - if test "x$TERMCAP_LIB" != "x"; then - break - fi - done - - if test "x$TERMCAP_LIB" = "x"; then - { { echo "$as_me:$LINENO: error: No curses library functions found" >&5 -echo "$as_me: error: No curses library functions found" >&2;} - { (exit 1); exit 1; }; } - fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - - - -if test "x$TERMCAP_LIB" != "x"; then - +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_TERMCAP 1 +#define HAVE_SYS_WAIT_H 1 _ACEOF fi -if test "X$host" != "Xwin32"; then - echo "$as_me:$LINENO: checking for wcwidth" >&5 -echo $ECHO_N "checking for wcwidth... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include +#include +#include + int main () { -wcwidth(0); +if ((struct tm *) 0) +return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -22620,83 +20978,89 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - have_wcwidth=yes + ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -have_wcwidth=no +ac_cv_header_time=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test $have_wcwidth = yes; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 +if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_WCWIDTH 1 +#define TIME_WITH_SYS_TIME 1 _ACEOF - fi fi -# Check whether --enable-builtin-zlib or --disable-builtin-zlib was given. -if test "${enable_builtin_zlib+set}" = set; then - enableval="$enable_builtin_zlib" - case "$enableval" in - no) enable_builtin_zlib=no ;; - *) enable_builtin_zlib=yes ;; - esac -else - enable_builtin_zlib=no -fi; -Z_LIB= -if test "x$enable_builtin_zlib" = "xyes"; then - { echo "$as_me:$LINENO: Using our own built-in zlib source" >&5 -echo "$as_me: Using our own built-in zlib source" >&6;} -else -echo "$as_me:$LINENO: checking for zlib 1.2.5 or higher" >&5 -echo $ECHO_N "checking for zlib 1.2.5 or higher... $ECHO_C" >&6 -zlib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include "zlib.h" -int -main () -{ -#if ZLIB_VERNUM >= 0x1250 - Bytef s[1]; - s[0] = 0; - (void) adler32((uLong)0, s, 1); -#else -#error "No zlib 1.2.5 or higher found" -error -#endif - ; - return 0; -} + + + + + + + + + + + + + + + + + + + +for ac_header in fcntl.h limits.h unistd.h syslog.h dlfcn.h ieeefp.h \ + sys/types.h sys/stropts.h sys/sysctl.h \ + sys/ioctl.h sys/time.h sys/uio.h \ + sys/socket.h sys/sockio.h sys/socketio.h \ + net/errno.h malloc.h arpa/nameser.h libdlpi.h \ + pty.h util.h utmp.h langinfo.h poll.h sdkddkver.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -22710,59 +21074,119 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - Z_LIB="-lz" +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBZ 1 +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$zlib_save_LIBS +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + fi +done -#-------------------------------------------------------------------- -# Check for the existence of the -lsocket and -lnsl libraries. -# The order here is important, so that they end up in the right -# order in the command line generated by make. Here are some -# special considerations: -# 1. Use "connect" and "accept" to check for -lsocket, and -# "gethostbyname" to check for -lnsl. -# 2. Use each function name only once: can't redo a check because -# autoconf caches the results of the last check and won't redo it. -# 3. Use -lnsl and -lsocket only if they supply procedures that -# aren't already present in the normal libraries. This is because -# IRIX 5.2 has libraries, but they aren't needed and they're -# bogus: they goof up name resolution if used. -# 4. On some SVR4 systems, can't use -lsocket without -lnsl too. -# To get around this problem, check for both libraries together -# if -lsocket doesn't work by itself. -#-------------------------------------------------------------------- -erl_checkBoth=0 -echo "$as_me:$LINENO: checking for connect" >&5 -echo $ECHO_N "checking for connect... $ECHO_C" >&6 -if test "${ac_cv_func_connect+set}" = set; then +echo "$as_me:$LINENO: checking for struct ifreq.ifr_hwaddr" >&5 +echo $ECHO_N "checking for struct ifreq.ifr_hwaddr... $ECHO_C" >&6 +if test "${ac_cv_member_struct_ifreq_ifr_hwaddr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -22771,54 +21195,28 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define connect to an innocuous variant, in case declares connect. - For example, HP-UX 11i declares gettimeofday. */ -#define connect innocuous_connect - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char connect (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef connect +#ifdef __WIN32__ + #else + #ifdef VXWORKS + #else + #include + #endif + #endif -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char connect (); -/* 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_connect) || defined (__stub___connect) -choke me -#else -char (*f) () = connect; -#endif -#ifdef __cplusplus -} -#endif int main () { -return f != connect; +static struct ifreq ac_aggr; +if (ac_aggr.ifr_hwaddr) +return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -22832,57 +21230,45 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_connect=yes + ac_cv_member_struct_ifreq_ifr_hwaddr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_connect=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 -echo "${ECHO_T}$ac_cv_func_connect" >&6 -if test $ac_cv_func_connect = yes; then - erl_checkSocket=0 -else - erl_checkSocket=1 -fi - -if test "$erl_checkSocket" = 1; then - echo "$as_me:$LINENO: checking for main in -lsocket" >&5 -echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6 -if test "${ac_cv_lib_socket_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#ifdef __WIN32__ + #else + #ifdef VXWORKS + #else + #include + #endif + #endif int main () { -main (); +static struct ifreq ac_aggr; +if (sizeof ac_aggr.ifr_hwaddr) +return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -22896,38 +21282,38 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_socket_main=yes + ac_cv_member_struct_ifreq_ifr_hwaddr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_socket_main=no +ac_cv_member_struct_ifreq_ifr_hwaddr=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_main" >&6 -if test $ac_cv_lib_socket_main = yes; then - LIBS="$LIBS -lsocket" -else - erl_checkBoth=1 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_hwaddr" >&5 +echo "${ECHO_T}$ac_cv_member_struct_ifreq_ifr_hwaddr" >&6 +if test $ac_cv_member_struct_ifreq_ifr_hwaddr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IFREQ_IFR_HWADDR 1 +_ACEOF + fi -if test "$erl_checkBoth" = 1; then - tk_oldLibs=$LIBS - LIBS="$LIBS -lsocket -lnsl" - echo "$as_me:$LINENO: checking for accept" >&5 -echo $ECHO_N "checking for accept... $ECHO_C" >&6 -if test "${ac_cv_func_accept+set}" = set; then + + +echo "$as_me:$LINENO: checking for struct ifreq.ifr_enaddr" >&5 +echo $ECHO_N "checking for struct ifreq.ifr_enaddr... $ECHO_C" >&6 +if test "${ac_cv_member_struct_ifreq_ifr_enaddr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -22936,54 +21322,28 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define accept to an innocuous variant, in case declares accept. - For example, HP-UX 11i declares gettimeofday. */ -#define accept innocuous_accept - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char accept (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef accept +#ifdef __WIN32__ + #else + #ifdef VXWORKS + #else + #include + #endif + #endif -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char accept (); -/* 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_accept) || defined (__stub___accept) -choke me -#else -char (*f) () = accept; -#endif -#ifdef __cplusplus -} -#endif int main () { -return f != accept; +static struct ifreq ac_aggr; +if (ac_aggr.ifr_enaddr) +return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -22997,90 +21357,45 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_accept=yes + ac_cv_member_struct_ifreq_ifr_enaddr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_accept=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5 -echo "${ECHO_T}$ac_cv_func_accept" >&6 -if test $ac_cv_func_accept = yes; then - erl_checkNsl=0 -else - LIBS=$tk_oldLibs -fi - -fi -echo "$as_me:$LINENO: checking for gethostbyname" >&5 -echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 -if test "${ac_cv_func_gethostbyname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define gethostbyname to an innocuous variant, in case declares gethostbyname. - For example, HP-UX 11i declares gettimeofday. */ -#define gethostbyname innocuous_gethostbyname - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostbyname (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef gethostbyname +#ifdef __WIN32__ + #else + #ifdef VXWORKS + #else + #include + #endif + #endif -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostbyname (); -/* 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_gethostbyname) || defined (__stub___gethostbyname) -choke me -#else -char (*f) () = gethostbyname; -#endif -#ifdef __cplusplus -} -#endif int main () { -return f != gethostbyname; +static struct ifreq ac_aggr; +if (sizeof ac_aggr.ifr_enaddr) +return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -23094,34 +21409,46 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_gethostbyname=yes + ac_cv_member_struct_ifreq_ifr_enaddr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_gethostbyname=no +ac_cv_member_struct_ifreq_ifr_enaddr=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 -if test $ac_cv_func_gethostbyname = yes; then - : -else - echo "$as_me:$LINENO: checking for main in -lnsl" >&5 -echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6 -if test "${ac_cv_lib_nsl_main+set}" = set; then +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_enaddr" >&5 +echo "${ECHO_T}$ac_cv_member_struct_ifreq_ifr_enaddr" >&6 +if test $ac_cv_member_struct_ifreq_ifr_enaddr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IFREQ_IFR_ENADDR 1 +_ACEOF + + +fi + + +if test x"$enable_systemd" != x"no"; then + +systemd_daemon_save_LIBS=$LIBS +LIBS= +echo "$as_me:$LINENO: checking for library containing sd_listen_fds" >&5 +echo $ECHO_N "checking for library containing sd_listen_fds... $ECHO_C" >&6 +if test "${ac_cv_search_sd_listen_fds+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" + ac_func_search_save_LIBS=$LIBS +ac_cv_search_sd_listen_fds=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -23129,11 +21456,17 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sd_listen_fds (); int main () { -main (); +sd_listen_fds (); ; return 0; } @@ -23160,77 +21493,35 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_nsl_main=yes + ac_cv_search_sd_listen_fds="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_nsl_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5 -echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6 -if test $ac_cv_lib_nsl_main = yes; then - LIBS="$LIBS -lnsl" -fi - -fi - -echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 -echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6 -if test "${ac_cv_func_gethostbyname_r+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +if test "$ac_cv_search_sd_listen_fds" = no; then + for ac_lib in systemd systemd-daemon; do + LIBS="-l$ac_lib $systemd_daemon_save_LIBS $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define gethostbyname_r to an innocuous variant, in case declares gethostbyname_r. - For example, HP-UX 11i declares gettimeofday. */ -#define gethostbyname_r innocuous_gethostbyname_r - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostbyname_r (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef gethostbyname_r /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char gethostbyname_r (); -/* 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_gethostbyname_r) || defined (__stub___gethostbyname_r) -choke me -#else -char (*f) () = gethostbyname_r; -#endif -#ifdef __cplusplus -} -#endif - +char sd_listen_fds (); int main () { -return f != gethostbyname_r; +sd_listen_fds (); ; return 0; } @@ -23257,51 +21548,52 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_gethostbyname_r=yes + ac_cv_search_sd_listen_fds="-l$ac_lib" +break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_gethostbyname_r=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + done fi -echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5 -echo "${ECHO_T}$ac_cv_func_gethostbyname_r" >&6 -if test $ac_cv_func_gethostbyname_r = yes; then - have_gethostbyname_r=yes +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_sd_listen_fds" >&5 +echo "${ECHO_T}$ac_cv_search_sd_listen_fds" >&6 +if test "$ac_cv_search_sd_listen_fds" != no; then + test "$ac_cv_search_sd_listen_fds" = "none required" || LIBS="$ac_cv_search_sd_listen_fds $LIBS" + have_sd_listen_fds=yes +else + have_sd_listen_fds=no fi - -if test "$have_gethostbyname_r" = yes; then - # OK, so we have gethostbyname_r() - but do we know how to call it...? - # (if not, HAVE_GETHOSTBYNAME_R will not be defined at all) - case $host_os in - solaris2*) - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETHOSTBYNAME_R GHBN_R_SOLARIS -_ACEOF - - ;; - aix4*) - # AIX version also needs "struct hostent_data" defn - cat >conftest.$ac_ext <<_ACEOF +for ac_header in systemd/sd-daemon.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () -{ -struct hostent_data hd; - ; - return 0; -} +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -23325,48 +21617,140 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETHOSTBYNAME_R GHBN_R_AIX -_ACEOF - + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - *) - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -#include -#ifdef __GLIBC__ -yes -#endif + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "^yes$" >/dev/null 2>&1; then + have_systemd_sd_daemon_h=yes +else + have_systemd_sd_daemon_h=no +fi + +done + + +if test x"$have_sd_listen_fds" = x"yes" && \ + test x"$have_systemd_sd_daemon_h" = x"yes"; then cat >>confdefs.h <<\_ACEOF -#define HAVE_GETHOSTBYNAME_R GHBN_R_GLIBC +#define HAVE_SYSTEMD_DAEMON 1 _ACEOF + SYSTEMD_DAEMON_LIBS=$LIBS +elif test x"$enable_systemd" = x"yes"; then + { { echo "$as_me:$LINENO: error: --enable-systemd was given, but test for systemd failed +See \`config.log' for more details." >&5 +echo "$as_me: error: --enable-systemd was given, but test for systemd failed +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -rm -f conftest* - - ;; - esac +LIBS=$systemd_daemon_save_LIBS fi -echo "$as_me:$LINENO: checking for working posix_openpt implementation" >&5 -echo $ECHO_N "checking for working posix_openpt implementation... $ECHO_C" >&6 + + + +echo "$as_me:$LINENO: checking for dlpi_open in -ldlpi" >&5 +echo $ECHO_N "checking for dlpi_open in -ldlpi... $ECHO_C" >&6 +if test "${ac_cv_lib_dlpi_dlpi_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldlpi $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -23374,20 +21758,17 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#define _XOPEN_SOURCE 600 -#include -#include - +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlpi_open (); int main () { - - int mfd = posix_openpt(O_RDWR); - ptsname(mfd); - grantpt(mfd); - unlockpt(mfd); - return mfd; - +dlpi_open (); ; return 0; } @@ -23414,60 +21795,91 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - working_posix_openpt=yes + ac_cv_lib_dlpi_dlpi_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -working_posix_openpt=no +ac_cv_lib_dlpi_dlpi_open=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - -if test "X$working_posix_openpt" = "Xyes"; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WORKING_POSIX_OPENPT 1 +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dlpi_dlpi_open" >&5 +echo "${ECHO_T}$ac_cv_lib_dlpi_dlpi_open" >&6 +if test $ac_cv_lib_dlpi_dlpi_open = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBDLPI 1 _ACEOF - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + LIBS="-ldlpi $LIBS" + fi -echo "$as_me:$LINENO: checking if netdb.h requires netinet/in.h to be previously included" >&5 -echo $ECHO_N "checking if netdb.h requires netinet/in.h to be previously included... $ECHO_C" >&6 +if test x"$ac_cv_lib_dlpi_dlpi_open" = x"no"; then + unset -v ac_cv_lib_dlpi_dlpi_open + save_ldflags="$LDFLAGS" + try_dlpi_lib=/lib + if test x"$ac_cv_sizeof_void_p" = x"8"; then + if test -d /lib64; then + try_dlpi_lib=/lib64 + elif test -d /lib/64; then + try_dlpi_lib=/lib/64 + fi + fi + if test ! -f "$try_dlpi_lib/libdlpi.so" && \ + test -f "$try_dlpi_lib/libdlpi.so.1" + then + { { echo "$as_me:$LINENO: error: Your OS installation is missing a symbolic link. + Maybe it lacks some development package(s)... + It can anyhow be fixed with the following command: + # ln -s libdlpi.so.1 $try_dlpi_lib/libdlpi.so + " >&5 +echo "$as_me: error: Your OS installation is missing a symbolic link. + Maybe it lacks some development package(s)... + It can anyhow be fixed with the following command: + # ln -s libdlpi.so.1 $try_dlpi_lib/libdlpi.so + " >&2;} + { (exit 1); exit 1; }; } + fi + LDFLAGS="-L$try_dlpi_lib -R$try_dlpi_lib $LDFLAGS" + unset -v try_dlpi_lib + { echo "$as_me:$LINENO: Extending the search to include /lib" >&5 +echo "$as_me: Extending the search to include /lib" >&6;} + +echo "$as_me:$LINENO: checking for dlpi_open in -ldlpi" >&5 +echo $ECHO_N "checking for dlpi_open in -ldlpi... $ECHO_C" >&6 +if test "${ac_cv_lib_dlpi_dlpi_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldlpi $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "sockaddr_in" >/dev/null 2>&1; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - #include + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlpi_open (); int main () { -return 0; +dlpi_open (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -23481,55 +21893,60 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - need_in_h=yes + ac_cv_lib_dlpi_dlpi_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -need_in_h=no +ac_cv_lib_dlpi_dlpi_open=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -else - need_in_h=no +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -rm -f conftest* - +echo "$as_me:$LINENO: result: $ac_cv_lib_dlpi_dlpi_open" >&5 +echo "${ECHO_T}$ac_cv_lib_dlpi_dlpi_open" >&6 +if test $ac_cv_lib_dlpi_dlpi_open = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBDLPI 1 +_ACEOF -if test $need_in_h = yes; then + LIBS="-ldlpi $LIBS" -cat >>confdefs.h <<\_ACEOF -#define NETDB_H_NEEDS_IN_H 1 -_ACEOF +fi - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + if test x"$ac_cv_lib_dlpi_dlpi_open" = x"no"; then + LDFLAGS="$save_ldflags" + fi + unset -v save_ldflags fi -echo "$as_me:$LINENO: checking for socklen_t" >&5 -echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 +if test "${ac_cv_header_sys_resource_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/resource.h" >&5 +echo $ECHO_N "checking for sys/resource.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_resource_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_resource_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_resource_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/resource.h usability" >&5 +echo $ECHO_N "checking sys/resource.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () -{ -socklen_t test; - ; - return 0; -} +$ac_includes_default +#include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -23553,106 +21970,109 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - have_socklen_t=yes + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -have_socklen_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext, - -if test $have_socklen_t = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SOCKLEN_T 1 -_ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 - -echo "$as_me:$LINENO: checking for h_errno declaration in netdb.h" >&5 -echo $ECHO_N "checking for h_errno declaration in netdb.h... $ECHO_C" >&6 -if test "${ac_cv_decl_h_errno+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +# Is the header present? +echo "$as_me:$LINENO: checking sys/resource.h presence" >&5 +echo $ECHO_N "checking sys/resource.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () -{ -int err = h_errno; - ; - return 0; -} +#include _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_decl_h_errno=yes + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_decl_h_errno=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_decl_h_errno" >&5 -echo "${ECHO_T}$ac_cv_decl_h_errno" >&6 -if test $ac_cv_decl_h_errno = yes; then - -cat >>confdefs.h <<\_ACEOF -#define H_ERRNO_DECLARED 1 -_ACEOF - + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 - - -saved_cppflags=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $EMU_THR_DEFS" - - - - - - -ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 -echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sys/resource.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/resource.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/resource.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/resource.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sys/resource.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/resource.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/resource.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/resource.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/resource.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/resource.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/resource.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/resource.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/resource.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/resource.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/resource.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/resource.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for sys/resource.h" >&5 +echo $ECHO_N "checking for sys/resource.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_resource_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_resource_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_resource_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_resource_h" >&6 + +fi +if test $ac_cv_header_sys_resource_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SYS_RESOURCE_H 1 +_ACEOF + + echo "$as_me:$LINENO: checking whether getrlimit is declared" >&5 +echo $ECHO_N "checking whether getrlimit is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getrlimit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -23661,14 +22081,15 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include <$ac_hdr> +#include int main () { -if ((DIR *) 0) -return 0; +#ifndef getrlimit + char *p = (char *) getrlimit; +#endif + ; return 0; } @@ -23695,60 +22116,58 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" + ac_cv_have_decl_getrlimit=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_Header=no" +ac_cv_have_decl_getrlimit=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getrlimit" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getrlimit" >&6 +if test $ac_cv_have_decl_getrlimit = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETRLIMIT 1 +_ACEOF + + +else cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +#define HAVE_DECL_GETRLIMIT 0 _ACEOF -ac_header_dirent=$ac_hdr; break -fi -done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then - echo "$as_me:$LINENO: checking for library containing opendir" >&5 -echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 -if test "${ac_cv_search_opendir+set}" = set; then +fi +echo "$as_me:$LINENO: checking whether setrlimit is declared" >&5 +echo $ECHO_N "checking whether setrlimit is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_setrlimit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_opendir=no -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); int main () { -opendir (); +#ifndef setrlimit + char *p = (char *) setrlimit; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -23762,48 +22181,64 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_search_opendir="none required" + ac_cv_have_decl_setrlimit=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl_setrlimit=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_opendir" = no; then - for ac_lib in dir; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_setrlimit" >&5 +echo "${ECHO_T}$ac_cv_have_decl_setrlimit" >&6 +if test $ac_cv_have_decl_setrlimit = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SETRLIMIT 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SETRLIMIT 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether RLIMIT_STACK is declared" >&5 +echo $ECHO_N "checking whether RLIMIT_STACK is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_RLIMIT_STACK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); int main () { -opendir (); +#ifndef RLIMIT_STACK + char *p = (char *) RLIMIT_STACK; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -23817,65 +22252,68 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_search_opendir="-l$ac_lib" -break + ac_cv_have_decl_RLIMIT_STACK=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl_RLIMIT_STACK=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -LIBS=$ac_func_search_save_LIBS +echo "$as_me:$LINENO: result: $ac_cv_have_decl_RLIMIT_STACK" >&5 +echo "${ECHO_T}$ac_cv_have_decl_RLIMIT_STACK" >&6 +if test $ac_cv_have_decl_RLIMIT_STACK = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_RLIMIT_STACK 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_RLIMIT_STACK 0 +_ACEOF + + fi -echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -echo "${ECHO_T}$ac_cv_search_opendir" >&6 -if test "$ac_cv_search_opendir" != no; then - test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" + fi -else - echo "$as_me:$LINENO: checking for library containing opendir" >&5 -echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 -if test "${ac_cv_search_opendir+set}" = set; then + + +have_kernel_poll=no +if test "${ac_cv_header_sys_event_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/event.h" >&5 +echo $ECHO_N "checking for sys/event.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_event_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_event_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_event_h" >&6 else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_opendir=no + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/event.h usability" >&5 +echo $ECHO_N "checking sys/event.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} +$ac_includes_default +#include _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -23889,112 +22327,131 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_search_opendir="none required" + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_header_compiler=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_opendir" = no; then - for ac_lib in x; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking sys/event.h presence" >&5 +echo $ECHO_N "checking sys/event.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} +#include _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="-l$ac_lib" -break + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -echo "${ECHO_T}$ac_cv_search_opendir" >&6 -if test "$ac_cv_search_opendir" != no; then - test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sys/event.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/event.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/event.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/event.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sys/event.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/event.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/event.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/event.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/event.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/event.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/event.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/event.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/event.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/event.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/event.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/event.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for sys/event.h" >&5 +echo $ECHO_N "checking for sys/event.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_event_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_event_h=$ac_header_preproc fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_event_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_event_h" >&6 fi +if test $ac_cv_header_sys_event_h = yes; then + have_kernel_poll=kqueue +fi -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then + +if test "${ac_cv_header_sys_epoll_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/epoll.h" >&5 +echo $ECHO_N "checking for sys/epoll.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_epoll_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_epoll_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_epoll_h" >&6 else - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/epoll.h usability" >&5 +echo $ECHO_N "checking sys/epoll.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} +$ac_includes_default +#include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -24018,316 +22475,125 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_header_stdc=yes + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_header_stdc=no +ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF +# Is the header present? +echo "$as_me:$LINENO: checking sys/epoll.h presence" >&5 +echo $ECHO_N "checking sys/epoll.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - +#include _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi else - ac_cv_header_stdc=no + ac_cpp_err=yes fi -rm -f conftest* +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/epoll.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/epoll.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/epoll.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/epoll.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/epoll.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/epoll.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/epoll.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/epoll.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for sys/epoll.h" >&5 +echo $ECHO_N "checking for sys/epoll.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_epoll_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_epoll_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_epoll_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_epoll_h" >&6 + +fi +if test $ac_cv_header_sys_epoll_h = yes; then + have_kernel_poll=epoll +fi + + +if test "${ac_cv_header_sys_devpoll_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/devpoll.h" >&5 +echo $ECHO_N "checking for sys/devpoll.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_devpoll_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_devpoll_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_devpoll_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/devpoll.h usability" >&5 +echo $ECHO_N "checking sys/devpoll.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - -_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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#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)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 -echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 -if test "${ac_cv_header_sys_wait_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#ifndef WEXITSTATUS -# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) -#endif -#ifndef WIFEXITED -# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif - -int -main () -{ - int s; - wait (&s); - s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_sys_wait_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_sys_wait_h=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 -if test $ac_cv_header_sys_wait_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SYS_WAIT_H 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 -if test "${ac_cv_header_time+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_time=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_time=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -echo "${ECHO_T}$ac_cv_header_time" >&6 -if test $ac_cv_header_time = yes; then - -cat >>confdefs.h <<\_ACEOF -#define TIME_WITH_SYS_TIME 1 -_ACEOF - -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - -for ac_header in fcntl.h limits.h unistd.h syslog.h dlfcn.h ieeefp.h \ - sys/types.h sys/stropts.h sys/sysctl.h \ - sys/ioctl.h sys/time.h sys/uio.h \ - sys/socket.h sys/sockio.h sys/socketio.h \ - net/errno.h malloc.h arpa/nameser.h libdlpi.h \ - pty.h util.h utmp.h langinfo.h poll.h sdkddkver.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +$ac_includes_default +#include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -24363,15 +22629,15 @@ echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking sys/devpoll.h presence" >&5 +echo $ECHO_N "checking sys/devpoll.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> +#include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -24405,25 +22671,25 @@ # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/devpoll.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/devpoll.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/devpoll.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/devpoll.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/devpoll.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/devpoll.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/devpoll.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/devpoll.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## @@ -24434,30 +22700,28 @@ sed "s/^/$as_me: WARNING: /" >&2 ;; esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then +echo "$as_me:$LINENO: checking for sys/devpoll.h" >&5 +echo $ECHO_N "checking for sys/devpoll.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_devpoll_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=\$ac_header_preproc" + ac_cv_header_sys_devpoll_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +echo "$as_me:$LINENO: result: $ac_cv_header_sys_devpoll_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_devpoll_h" >&6 fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - +if test $ac_cv_header_sys_devpoll_h = yes; then + have_kernel_poll=/dev/poll fi -done -echo "$as_me:$LINENO: checking for struct ifreq.ifr_hwaddr" >&5 -echo $ECHO_N "checking for struct ifreq.ifr_hwaddr... $ECHO_C" >&6 -if test "${ac_cv_member_struct_ifreq_ifr_hwaddr+set}" = set; then + +if test "x$enable_sctp" != "xno" ; then + echo "$as_me:$LINENO: checking for netinet/sctp.h" >&5 +echo $ECHO_N "checking for netinet/sctp.h... $ECHO_C" >&6 +if test "${ac_cv_header_netinet_sctp_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -24466,24 +22730,12 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifdef __WIN32__ - #else - #ifdef VXWORKS - #else - #include - #endif +#if HAVE_SYS_SOCKET_H + #include #endif -int -main () -{ -static struct ifreq ac_aggr; -if (ac_aggr.ifr_hwaddr) -return 0; - ; - return 0; -} +#include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -24507,39 +22759,98 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_ifreq_ifr_hwaddr=yes + ac_cv_header_netinet_sctp_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF +ac_cv_header_netinet_sctp_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_netinet_sctp_h" >&5 +echo "${ECHO_T}$ac_cv_header_netinet_sctp_h" >&6 +if test $ac_cv_header_netinet_sctp_h = yes; then + LIBSCTP=libsctp.so.1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SCTP_H 1 +_ACEOF + +fi + + +fi + +if test x"$ac_cv_header_netinet_sctp_h" = x"yes"; then + + + + + + +for ac_func in sctp_bindx sctp_peeloff sctp_getladdrs sctp_freeladdrs sctp_getpaddrs sctp_freepaddrs +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifdef __WIN32__ - #else - #ifdef VXWORKS - #else - #include - #endif - #endif +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif int main () { -static struct ifreq ac_aggr; -if (sizeof ac_aggr.ifr_hwaddr) -return 0; +return f != $ac_func; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -24553,38 +22864,35 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_ifreq_ifr_hwaddr=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_ifreq_ifr_hwaddr=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_hwaddr" >&5 -echo "${ECHO_T}$ac_cv_member_struct_ifreq_ifr_hwaddr" >&6 -if test $ac_cv_member_struct_ifreq_ifr_hwaddr = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_IFREQ_IFR_HWADDR 1 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF - fi +done - -echo "$as_me:$LINENO: checking for struct ifreq.ifr_enaddr" >&5 -echo $ECHO_N "checking for struct ifreq.ifr_enaddr... $ECHO_C" >&6 -if test "${ac_cv_member_struct_ifreq_ifr_enaddr+set}" = set; then + echo "$as_me:$LINENO: checking whether SCTP_UNORDERED is declared" >&5 +echo $ECHO_N "checking whether SCTP_UNORDERED is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_UNORDERED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -24593,21 +22901,19 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifdef __WIN32__ - #else - #ifdef VXWORKS - #else - #include - #endif - #endif +#if HAVE_SYS_SOCKET_H + #include + #endif + #include int main () { -static struct ifreq ac_aggr; -if (ac_aggr.ifr_enaddr) -return 0; +#ifndef SCTP_UNORDERED + char *p = (char *) SCTP_UNORDERED; +#endif + ; return 0; } @@ -24634,32 +22940,55 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_ifreq_ifr_enaddr=yes + ac_cv_have_decl_SCTP_UNORDERED=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __WIN32__ - #else - #ifdef VXWORKS - #else - #include - #endif - #endif +ac_cv_have_decl_SCTP_UNORDERED=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_UNORDERED" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_UNORDERED" >&6 +if test $ac_cv_have_decl_SCTP_UNORDERED = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_UNORDERED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_UNORDERED 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether SCTP_ADDR_OVER is declared" >&5 +echo $ECHO_N "checking whether SCTP_ADDR_OVER is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_ADDR_OVER+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if HAVE_SYS_SOCKET_H + #include + #endif + #include int main () { -static struct ifreq ac_aggr; -if (sizeof ac_aggr.ifr_enaddr) -return 0; +#ifndef SCTP_ADDR_OVER + char *p = (char *) SCTP_ADDR_OVER; +#endif + ; return 0; } @@ -24686,65 +23015,62 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_ifreq_ifr_enaddr=yes + ac_cv_have_decl_SCTP_ADDR_OVER=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_ifreq_ifr_enaddr=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_have_decl_SCTP_ADDR_OVER=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_enaddr" >&5 -echo "${ECHO_T}$ac_cv_member_struct_ifreq_ifr_enaddr" >&6 -if test $ac_cv_member_struct_ifreq_ifr_enaddr = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_ADDR_OVER" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_ADDR_OVER" >&6 +if test $ac_cv_have_decl_SCTP_ADDR_OVER = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_IFREQ_IFR_ENADDR 1 +#define HAVE_DECL_SCTP_ADDR_OVER 1 _ACEOF -fi - +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_ADDR_OVER 0 +_ACEOF -if test x"$enable_systemd" != x"no"; then -systemd_daemon_save_LIBS=$LIBS -LIBS= -echo "$as_me:$LINENO: checking for library containing sd_listen_fds" >&5 -echo $ECHO_N "checking for library containing sd_listen_fds... $ECHO_C" >&6 -if test "${ac_cv_search_sd_listen_fds+set}" = set; then +fi +echo "$as_me:$LINENO: checking whether SCTP_ABORT is declared" >&5 +echo $ECHO_N "checking whether SCTP_ABORT is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_ABORT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_sd_listen_fds=no -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sd_listen_fds (); int main () { -sd_listen_fds (); +#ifndef SCTP_ABORT + char *p = (char *) SCTP_ABORT; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -24758,48 +23084,68 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_search_sd_listen_fds="none required" + ac_cv_have_decl_SCTP_ABORT=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl_SCTP_ABORT=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_sd_listen_fds" = no; then - for ac_lib in systemd systemd-daemon; do - LIBS="-l$ac_lib $systemd_daemon_save_LIBS $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_ABORT" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_ABORT" >&6 +if test $ac_cv_have_decl_SCTP_ABORT = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_ABORT 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_ABORT 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether SCTP_EOF is declared" >&5 +echo $ECHO_N "checking whether SCTP_EOF is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_EOF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sd_listen_fds (); int main () { -sd_listen_fds (); +#ifndef SCTP_EOF + char *p = (char *) SCTP_EOF; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -24813,66 +23159,68 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_search_sd_listen_fds="-l$ac_lib" -break + ac_cv_have_decl_SCTP_EOF=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl_SCTP_EOF=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_search_sd_listen_fds" >&5 -echo "${ECHO_T}$ac_cv_search_sd_listen_fds" >&6 -if test "$ac_cv_search_sd_listen_fds" != no; then - test "$ac_cv_search_sd_listen_fds" = "none required" || LIBS="$ac_cv_search_sd_listen_fds $LIBS" - have_sd_listen_fds=yes +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_EOF" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_EOF" >&6 +if test $ac_cv_have_decl_SCTP_EOF = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_EOF 1 +_ACEOF + + else - have_sd_listen_fds=no -fi + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_EOF 0 +_ACEOF + -echo "$as_me:$LINENO: checking for library containing sd_notify" >&5 -echo $ECHO_N "checking for library containing sd_notify... $ECHO_C" >&6 -if test "${ac_cv_search_sd_notify+set}" = set; then +fi +echo "$as_me:$LINENO: checking whether SCTP_SENDALL is declared" >&5 +echo $ECHO_N "checking whether SCTP_SENDALL is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_SENDALL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_sd_notify=no -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sd_notify (); int main () { -sd_notify (); +#ifndef SCTP_SENDALL + char *p = (char *) SCTP_SENDALL; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -24886,48 +23234,68 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_search_sd_notify="none required" + ac_cv_have_decl_SCTP_SENDALL=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl_SCTP_SENDALL=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_sd_notify" = no; then - for ac_lib in systemd systemd-daemon; do - LIBS="-l$ac_lib $systemd_daemon_save_LIBS $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_SENDALL" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_SENDALL" >&6 +if test $ac_cv_have_decl_SCTP_SENDALL = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_SENDALL 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_SENDALL 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether SCTP_ADDR_CONFIRMED is declared" >&5 +echo $ECHO_N "checking whether SCTP_ADDR_CONFIRMED is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_ADDR_CONFIRMED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sd_notify (); int main () { -sd_notify (); +#ifndef SCTP_ADDR_CONFIRMED + char *p = (char *) SCTP_ADDR_CONFIRMED; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -24941,58 +23309,64 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_search_sd_notify="-l$ac_lib" -break + ac_cv_have_decl_SCTP_ADDR_CONFIRMED=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl_SCTP_ADDR_CONFIRMED=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_search_sd_notify" >&5 -echo "${ECHO_T}$ac_cv_search_sd_notify" >&6 -if test "$ac_cv_search_sd_notify" != no; then - test "$ac_cv_search_sd_notify" = "none required" || LIBS="$ac_cv_search_sd_notify $LIBS" - have_sd_notify=yes +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_ADDR_CONFIRMED" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_ADDR_CONFIRMED" >&6 +if test $ac_cv_have_decl_SCTP_ADDR_CONFIRMED = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_ADDR_CONFIRMED 1 +_ACEOF + + else - have_sd_notify=no -fi + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_ADDR_CONFIRMED 0 +_ACEOF -for ac_header in systemd/sd-daemon.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +echo "$as_me:$LINENO: checking whether SCTP_DELAYED_ACK_TIME is declared" >&5 +echo $ECHO_N "checking whether SCTP_DELAYED_ACK_TIME is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_DELAYED_ACK_TIME+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + + +int +main () +{ +#ifndef SCTP_DELAYED_ACK_TIME + char *p = (char *) SCTP_DELAYED_ACK_TIME; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -25016,166 +23390,62 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_have_decl_SCTP_DELAYED_ACK_TIME=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_cv_have_decl_SCTP_DELAYED_ACK_TIME=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_DELAYED_ACK_TIME" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_DELAYED_ACK_TIME" >&6 +if test $ac_cv_have_decl_SCTP_DELAYED_ACK_TIME = yes; then -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_DELAYED_ACK_TIME 1 _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_DECL_SCTP_DELAYED_ACK_TIME 0 _ACEOF - have_systemd_sd_daemon_h=yes -else - have_systemd_sd_daemon_h=no -fi - -done - - -if test x"$have_sd_listen_fds" = x"yes" && \ - test x"$have_sd_notify" = x"yes" && \ - test x"$have_systemd_sd_daemon_h" = x"yes"; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_SYSTEMD_DAEMON 1 -_ACEOF - SYSTEMD_DAEMON_LIBS=$LIBS -elif test x"$enable_systemd" = x"yes"; then - { { echo "$as_me:$LINENO: error: --enable-systemd was given, but test for systemd failed -See \`config.log' for more details." >&5 -echo "$as_me: error: --enable-systemd was given, but test for systemd failed -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -LIBS=$systemd_daemon_save_LIBS fi - - - - -echo "$as_me:$LINENO: checking for dlpi_open in -ldlpi" >&5 -echo $ECHO_N "checking for dlpi_open in -ldlpi... $ECHO_C" >&6 -if test "${ac_cv_lib_dlpi_dlpi_open+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTP_EMPTY is declared" >&5 +echo $ECHO_N "checking whether SCTP_EMPTY is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_EMPTY+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldlpi $LIBS" -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlpi_open (); int main () { -dlpi_open (); +#ifndef SCTP_EMPTY + char *p = (char *) SCTP_EMPTY; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -25189,97 +23459,68 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_dlpi_dlpi_open=yes + ac_cv_have_decl_SCTP_EMPTY=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_dlpi_dlpi_open=no +ac_cv_have_decl_SCTP_EMPTY=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dlpi_dlpi_open" >&5 -echo "${ECHO_T}$ac_cv_lib_dlpi_dlpi_open" >&6 -if test $ac_cv_lib_dlpi_dlpi_open = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_EMPTY" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_EMPTY" >&6 +if test $ac_cv_have_decl_SCTP_EMPTY = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_EMPTY 1 +_ACEOF + + +else cat >>confdefs.h <<_ACEOF -#define HAVE_LIBDLPI 1 +#define HAVE_DECL_SCTP_EMPTY 0 _ACEOF - LIBS="-ldlpi $LIBS" fi - -if test x"$ac_cv_lib_dlpi_dlpi_open" = x"no"; then - unset -v ac_cv_lib_dlpi_dlpi_open - save_ldflags="$LDFLAGS" - try_dlpi_lib=/lib - if test x"$ac_cv_sizeof_void_p" = x"8"; then - if test -d /lib64; then - try_dlpi_lib=/lib64 - elif test -d /lib/64; then - try_dlpi_lib=/lib/64 - fi - fi - if test ! -f "$try_dlpi_lib/libdlpi.so" && \ - test -f "$try_dlpi_lib/libdlpi.so.1" - then - { { echo "$as_me:$LINENO: error: Your OS installation is missing a symbolic link. - Maybe it lacks some development package(s)... - It can anyhow be fixed with the following command: - # ln -s libdlpi.so.1 $try_dlpi_lib/libdlpi.so - " >&5 -echo "$as_me: error: Your OS installation is missing a symbolic link. - Maybe it lacks some development package(s)... - It can anyhow be fixed with the following command: - # ln -s libdlpi.so.1 $try_dlpi_lib/libdlpi.so - " >&2;} - { (exit 1); exit 1; }; } - fi - LDFLAGS="-L$try_dlpi_lib -R$try_dlpi_lib $LDFLAGS" - unset -v try_dlpi_lib - { echo "$as_me:$LINENO: Extending the search to include /lib" >&5 -echo "$as_me: Extending the search to include /lib" >&6;} - -echo "$as_me:$LINENO: checking for dlpi_open in -ldlpi" >&5 -echo $ECHO_N "checking for dlpi_open in -ldlpi... $ECHO_C" >&6 -if test "${ac_cv_lib_dlpi_dlpi_open+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTP_CLOSED is declared" >&5 +echo $ECHO_N "checking whether SCTP_CLOSED is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_CLOSED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldlpi $LIBS" -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlpi_open (); int main () { -dlpi_open (); +#ifndef SCTP_CLOSED + char *p = (char *) SCTP_CLOSED; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -25293,60 +23534,64 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_dlpi_dlpi_open=yes + ac_cv_have_decl_SCTP_CLOSED=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_dlpi_dlpi_open=no +ac_cv_have_decl_SCTP_CLOSED=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dlpi_dlpi_open" >&5 -echo "${ECHO_T}$ac_cv_lib_dlpi_dlpi_open" >&6 -if test $ac_cv_lib_dlpi_dlpi_open = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBDLPI 1 +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_CLOSED" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_CLOSED" >&6 +if test $ac_cv_have_decl_SCTP_CLOSED = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_CLOSED 1 _ACEOF - LIBS="-ldlpi $LIBS" -fi +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_CLOSED 0 +_ACEOF - if test x"$ac_cv_lib_dlpi_dlpi_open" = x"no"; then - LDFLAGS="$save_ldflags" - fi - unset -v save_ldflags -fi -if test "${ac_cv_header_sys_resource_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/resource.h" >&5 -echo $ECHO_N "checking for sys/resource.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_resource_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_resource_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_resource_h" >&6 +echo "$as_me:$LINENO: checking whether SCTPS_IDLE is declared" >&5 +echo $ECHO_N "checking whether SCTPS_IDLE is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTPS_IDLE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking sys/resource.h usability" >&5 -echo $ECHO_N "checking sys/resource.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + + +int +main () +{ +#ifndef SCTPS_IDLE + char *p = (char *) SCTPS_IDLE; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -25370,109 +23615,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_have_decl_SCTPS_IDLE=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_cv_have_decl_SCTPS_IDLE=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_IDLE" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTPS_IDLE" >&6 +if test $ac_cv_have_decl_SCTPS_IDLE = yes; then -# Is the header present? -echo "$as_me:$LINENO: checking sys/resource.h presence" >&5 -echo $ECHO_N "checking sys/resource.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTPS_IDLE 1 _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: sys/resource.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: sys/resource.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/resource.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: sys/resource.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: sys/resource.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: sys/resource.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/resource.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sys/resource.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/resource.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: sys/resource.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/resource.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: sys/resource.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/resource.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sys/resource.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/resource.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: sys/resource.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for sys/resource.h" >&5 -echo $ECHO_N "checking for sys/resource.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_resource_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_header_sys_resource_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_resource_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_resource_h" >&6 - -fi -if test $ac_cv_header_sys_resource_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SYS_RESOURCE_H 1 + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTPS_IDLE 0 _ACEOF - echo "$as_me:$LINENO: checking whether getrlimit is declared" >&5 -echo $ECHO_N "checking whether getrlimit is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_getrlimit+set}" = set; then + +fi +echo "$as_me:$LINENO: checking whether SCTP_BOUND is declared" >&5 +echo $ECHO_N "checking whether SCTP_BOUND is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_BOUND+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -25481,13 +23651,17 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + int main () { -#ifndef getrlimit - char *p = (char *) getrlimit; +#ifndef SCTP_BOUND + char *p = (char *) SCTP_BOUND; #endif ; @@ -25516,34 +23690,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_getrlimit=yes + ac_cv_have_decl_SCTP_BOUND=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_getrlimit=no +ac_cv_have_decl_SCTP_BOUND=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_getrlimit" >&5 -echo "${ECHO_T}$ac_cv_have_decl_getrlimit" >&6 -if test $ac_cv_have_decl_getrlimit = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_BOUND" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_BOUND" >&6 +if test $ac_cv_have_decl_SCTP_BOUND = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETRLIMIT 1 +#define HAVE_DECL_SCTP_BOUND 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETRLIMIT 0 +#define HAVE_DECL_SCTP_BOUND 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether setrlimit is declared" >&5 -echo $ECHO_N "checking whether setrlimit is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_setrlimit+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTPS_BOUND is declared" >&5 +echo $ECHO_N "checking whether SCTPS_BOUND is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTPS_BOUND+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -25552,13 +23726,17 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + int main () { -#ifndef setrlimit - char *p = (char *) setrlimit; +#ifndef SCTPS_BOUND + char *p = (char *) SCTPS_BOUND; #endif ; @@ -25587,34 +23765,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_setrlimit=yes + ac_cv_have_decl_SCTPS_BOUND=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_setrlimit=no +ac_cv_have_decl_SCTPS_BOUND=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_setrlimit" >&5 -echo "${ECHO_T}$ac_cv_have_decl_setrlimit" >&6 -if test $ac_cv_have_decl_setrlimit = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_BOUND" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTPS_BOUND" >&6 +if test $ac_cv_have_decl_SCTPS_BOUND = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SETRLIMIT 1 +#define HAVE_DECL_SCTPS_BOUND 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SETRLIMIT 0 +#define HAVE_DECL_SCTPS_BOUND 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether RLIMIT_STACK is declared" >&5 -echo $ECHO_N "checking whether RLIMIT_STACK is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_RLIMIT_STACK+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTP_LISTEN is declared" >&5 +echo $ECHO_N "checking whether SCTP_LISTEN is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_LISTEN+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -25623,13 +23801,17 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + int main () { -#ifndef RLIMIT_STACK - char *p = (char *) RLIMIT_STACK; +#ifndef SCTP_LISTEN + char *p = (char *) SCTP_LISTEN; #endif ; @@ -25658,58 +23840,58 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_RLIMIT_STACK=yes + ac_cv_have_decl_SCTP_LISTEN=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_RLIMIT_STACK=no +ac_cv_have_decl_SCTP_LISTEN=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_RLIMIT_STACK" >&5 -echo "${ECHO_T}$ac_cv_have_decl_RLIMIT_STACK" >&6 -if test $ac_cv_have_decl_RLIMIT_STACK = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_LISTEN" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_LISTEN" >&6 +if test $ac_cv_have_decl_SCTP_LISTEN = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_RLIMIT_STACK 1 +#define HAVE_DECL_SCTP_LISTEN 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_RLIMIT_STACK 0 +#define HAVE_DECL_SCTP_LISTEN 0 _ACEOF fi - - -fi - - - -have_kernel_poll=no -if test "${ac_cv_header_sys_event_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/event.h" >&5 -echo $ECHO_N "checking for sys/event.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_event_h+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTPS_LISTEN is declared" >&5 +echo $ECHO_N "checking whether SCTPS_LISTEN is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTPS_LISTEN+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_event_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_event_h" >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking sys/event.h usability" >&5 -echo $ECHO_N "checking sys/event.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + + +int +main () +{ +#ifndef SCTPS_LISTEN + char *p = (char *) SCTPS_LISTEN; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -25733,125 +23915,58 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_have_decl_SCTPS_LISTEN=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_cv_have_decl_SCTPS_LISTEN=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_LISTEN" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTPS_LISTEN" >&6 +if test $ac_cv_have_decl_SCTPS_LISTEN = yes; then -# Is the header present? -echo "$as_me:$LINENO: checking sys/event.h presence" >&5 -echo $ECHO_N "checking sys/event.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTPS_LISTEN 1 _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: sys/event.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: sys/event.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/event.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: sys/event.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: sys/event.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: sys/event.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/event.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sys/event.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/event.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: sys/event.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/event.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: sys/event.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/event.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sys/event.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/event.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: sys/event.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for sys/event.h" >&5 -echo $ECHO_N "checking for sys/event.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_event_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_header_sys_event_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_event_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_event_h" >&6 - -fi -if test $ac_cv_header_sys_event_h = yes; then - have_kernel_poll=kqueue -fi + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTPS_LISTEN 0 +_ACEOF -if test "${ac_cv_header_sys_epoll_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/epoll.h" >&5 -echo $ECHO_N "checking for sys/epoll.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_epoll_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_epoll_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_epoll_h" >&6 +echo "$as_me:$LINENO: checking whether SCTP_COOKIE_WAIT is declared" >&5 +echo $ECHO_N "checking whether SCTP_COOKIE_WAIT is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_COOKIE_WAIT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking sys/epoll.h usability" >&5 -echo $ECHO_N "checking sys/epoll.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + + +int +main () +{ +#ifndef SCTP_COOKIE_WAIT + char *p = (char *) SCTP_COOKIE_WAIT; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -25875,125 +23990,58 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_have_decl_SCTP_COOKIE_WAIT=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_cv_have_decl_SCTP_COOKIE_WAIT=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_COOKIE_WAIT" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_COOKIE_WAIT" >&6 +if test $ac_cv_have_decl_SCTP_COOKIE_WAIT = yes; then -# Is the header present? -echo "$as_me:$LINENO: checking sys/epoll.h presence" >&5 -echo $ECHO_N "checking sys/epoll.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_COOKIE_WAIT 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_COOKIE_WAIT 0 _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: sys/epoll.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: sys/epoll.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/epoll.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: sys/epoll.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: sys/epoll.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: sys/epoll.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/epoll.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sys/epoll.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/epoll.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: sys/epoll.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/epoll.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: sys/epoll.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/epoll.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sys/epoll.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/epoll.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: sys/epoll.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for sys/epoll.h" >&5 -echo $ECHO_N "checking for sys/epoll.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_epoll_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_sys_epoll_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_epoll_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_epoll_h" >&6 fi -if test $ac_cv_header_sys_epoll_h = yes; then - have_kernel_poll=epoll -fi - - -if test "${ac_cv_header_sys_devpoll_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/devpoll.h" >&5 -echo $ECHO_N "checking for sys/devpoll.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_devpoll_h+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTPS_COOKIE_WAIT is declared" >&5 +echo $ECHO_N "checking whether SCTPS_COOKIE_WAIT is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTPS_COOKIE_WAIT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_devpoll_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_devpoll_h" >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking sys/devpoll.h usability" >&5 -echo $ECHO_N "checking sys/devpoll.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + + +int +main () +{ +#ifndef SCTPS_COOKIE_WAIT + char *p = (char *) SCTPS_COOKIE_WAIT; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -26017,130 +24065,58 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_have_decl_SCTPS_COOKIE_WAIT=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_cv_have_decl_SCTPS_COOKIE_WAIT=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_COOKIE_WAIT" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTPS_COOKIE_WAIT" >&6 +if test $ac_cv_have_decl_SCTPS_COOKIE_WAIT = yes; then -# Is the header present? -echo "$as_me:$LINENO: checking sys/devpoll.h presence" >&5 -echo $ECHO_N "checking sys/devpoll.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTPS_COOKIE_WAIT 1 _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: sys/devpoll.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: sys/devpoll.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: sys/devpoll.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sys/devpoll.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: sys/devpoll.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: sys/devpoll.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sys/devpoll.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/devpoll.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: sys/devpoll.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for sys/devpoll.h" >&5 -echo $ECHO_N "checking for sys/devpoll.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_devpoll_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_header_sys_devpoll_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_devpoll_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_devpoll_h" >&6 - -fi -if test $ac_cv_header_sys_devpoll_h = yes; then - have_kernel_poll=/dev/poll -fi - - + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTPS_COOKIE_WAIT 0 +_ACEOF -for ac_header in sys/timerfd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +echo "$as_me:$LINENO: checking whether SCTP_COOKIE_ECHOED is declared" >&5 +echo $ECHO_N "checking whether SCTP_COOKIE_ECHOED is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_COOKIE_ECHOED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#if HAVE_SYS_SOCKET_H + #include + #endif + #include + + +int +main () +{ +#ifndef SCTP_COOKIE_ECHOED + char *p = (char *) SCTP_COOKIE_ECHOED; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -26164,115 +24140,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_have_decl_SCTP_COOKIE_ECHOED=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_cv_have_decl_SCTP_COOKIE_ECHOED=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_COOKIE_ECHOED" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_COOKIE_ECHOED" >&6 +if test $ac_cv_have_decl_SCTP_COOKIE_ECHOED = yes; then -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_COOKIE_ECHOED 1 _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_DECL_SCTP_COOKIE_ECHOED 0 _ACEOF -fi - -done - - -if test "x$enable_sctp" != "xno" ; then - echo "$as_me:$LINENO: checking for netinet/sctp.h" >&5 -echo $ECHO_N "checking for netinet/sctp.h... $ECHO_C" >&6 -if test "${ac_cv_header_netinet_sctp_h+set}" = set; then +fi +echo "$as_me:$LINENO: checking whether SCTPS_COOKIE_ECHOED is declared" >&5 +echo $ECHO_N "checking whether SCTPS_COOKIE_ECHOED is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTPS_COOKIE_ECHOED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -26282,11 +24177,21 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if HAVE_SYS_SOCKET_H - #include - #endif + #include + #endif + #include -#include +int +main () +{ +#ifndef SCTPS_COOKIE_ECHOED + char *p = (char *) SCTPS_COOKIE_ECHOED; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -26310,42 +24215,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_header_netinet_sctp_h=yes + ac_cv_have_decl_SCTPS_COOKIE_ECHOED=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_header_netinet_sctp_h=no +ac_cv_have_decl_SCTPS_COOKIE_ECHOED=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_header_netinet_sctp_h" >&5 -echo "${ECHO_T}$ac_cv_header_netinet_sctp_h" >&6 -if test $ac_cv_header_netinet_sctp_h = yes; then - LIBSCTP=libsctp.so.1 +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_COOKIE_ECHOED" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTPS_COOKIE_ECHOED" >&6 +if test $ac_cv_have_decl_SCTPS_COOKIE_ECHOED = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_SCTP_H 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTPS_COOKIE_ECHOED 1 _ACEOF -fi - - -fi - -if test x"$ac_cv_header_netinet_sctp_h" = x"yes"; then - - - +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTPS_COOKIE_ECHOED 0 +_ACEOF -for ac_func in sctp_bindx sctp_peeloff sctp_getladdrs sctp_freeladdrs sctp_getpaddrs sctp_freepaddrs -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +fi +echo "$as_me:$LINENO: checking whether SCTP_ESTABLISHED is declared" >&5 +echo $ECHO_N "checking whether SCTP_ESTABLISHED is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_ESTABLISHED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -26354,54 +24251,26 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func +#if HAVE_SYS_SOCKET_H + #include + #endif + #include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif int main () { -return f != $ac_func; +#ifndef SCTP_ESTABLISHED + char *p = (char *) SCTP_ESTABLISHED; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -26415,35 +24284,40 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_have_decl_SCTP_ESTABLISHED=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_have_decl_SCTP_ESTABLISHED=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_ESTABLISHED" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_ESTABLISHED" >&6 +if test $ac_cv_have_decl_SCTP_ESTABLISHED = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SCTP_ESTABLISHED 1 +_ACEOF + + +else cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE_DECL_SCTP_ESTABLISHED 0 _ACEOF -fi -done - echo "$as_me:$LINENO: checking whether SCTP_UNORDERED is declared" >&5 -echo $ECHO_N "checking whether SCTP_UNORDERED is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_UNORDERED+set}" = set; then +fi +echo "$as_me:$LINENO: checking whether SCTPS_ESTABLISHED is declared" >&5 +echo $ECHO_N "checking whether SCTPS_ESTABLISHED is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTPS_ESTABLISHED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -26461,8 +24335,8 @@ int main () { -#ifndef SCTP_UNORDERED - char *p = (char *) SCTP_UNORDERED; +#ifndef SCTPS_ESTABLISHED + char *p = (char *) SCTPS_ESTABLISHED; #endif ; @@ -26491,34 +24365,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_UNORDERED=yes + ac_cv_have_decl_SCTPS_ESTABLISHED=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_UNORDERED=no +ac_cv_have_decl_SCTPS_ESTABLISHED=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_UNORDERED" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_UNORDERED" >&6 -if test $ac_cv_have_decl_SCTP_UNORDERED = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_ESTABLISHED" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTPS_ESTABLISHED" >&6 +if test $ac_cv_have_decl_SCTPS_ESTABLISHED = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_UNORDERED 1 +#define HAVE_DECL_SCTPS_ESTABLISHED 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_UNORDERED 0 +#define HAVE_DECL_SCTPS_ESTABLISHED 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_ADDR_OVER is declared" >&5 -echo $ECHO_N "checking whether SCTP_ADDR_OVER is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_ADDR_OVER+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTP_SHUTDOWN_PENDING is declared" >&5 +echo $ECHO_N "checking whether SCTP_SHUTDOWN_PENDING is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_SHUTDOWN_PENDING+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -26536,8 +24410,8 @@ int main () { -#ifndef SCTP_ADDR_OVER - char *p = (char *) SCTP_ADDR_OVER; +#ifndef SCTP_SHUTDOWN_PENDING + char *p = (char *) SCTP_SHUTDOWN_PENDING; #endif ; @@ -26566,34 +24440,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_ADDR_OVER=yes + ac_cv_have_decl_SCTP_SHUTDOWN_PENDING=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_ADDR_OVER=no +ac_cv_have_decl_SCTP_SHUTDOWN_PENDING=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_ADDR_OVER" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_ADDR_OVER" >&6 -if test $ac_cv_have_decl_SCTP_ADDR_OVER = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_SHUTDOWN_PENDING" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_SHUTDOWN_PENDING" >&6 +if test $ac_cv_have_decl_SCTP_SHUTDOWN_PENDING = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_ADDR_OVER 1 +#define HAVE_DECL_SCTP_SHUTDOWN_PENDING 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_ADDR_OVER 0 +#define HAVE_DECL_SCTP_SHUTDOWN_PENDING 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_ABORT is declared" >&5 -echo $ECHO_N "checking whether SCTP_ABORT is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_ABORT+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTPS_SHUTDOWN_PENDING is declared" >&5 +echo $ECHO_N "checking whether SCTPS_SHUTDOWN_PENDING is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -26611,8 +24485,8 @@ int main () { -#ifndef SCTP_ABORT - char *p = (char *) SCTP_ABORT; +#ifndef SCTPS_SHUTDOWN_PENDING + char *p = (char *) SCTPS_SHUTDOWN_PENDING; #endif ; @@ -26641,34 +24515,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_ABORT=yes + ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_ABORT=no +ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_ABORT" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_ABORT" >&6 -if test $ac_cv_have_decl_SCTP_ABORT = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING" >&6 +if test $ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_ABORT 1 +#define HAVE_DECL_SCTPS_SHUTDOWN_PENDING 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_ABORT 0 +#define HAVE_DECL_SCTPS_SHUTDOWN_PENDING 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_EOF is declared" >&5 -echo $ECHO_N "checking whether SCTP_EOF is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_EOF+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTP_SHUTDOWN_SENT is declared" >&5 +echo $ECHO_N "checking whether SCTP_SHUTDOWN_SENT is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_SHUTDOWN_SENT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -26686,8 +24560,8 @@ int main () { -#ifndef SCTP_EOF - char *p = (char *) SCTP_EOF; +#ifndef SCTP_SHUTDOWN_SENT + char *p = (char *) SCTP_SHUTDOWN_SENT; #endif ; @@ -26716,34 +24590,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_EOF=yes + ac_cv_have_decl_SCTP_SHUTDOWN_SENT=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_EOF=no +ac_cv_have_decl_SCTP_SHUTDOWN_SENT=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_EOF" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_EOF" >&6 -if test $ac_cv_have_decl_SCTP_EOF = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_SHUTDOWN_SENT" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_SHUTDOWN_SENT" >&6 +if test $ac_cv_have_decl_SCTP_SHUTDOWN_SENT = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_EOF 1 +#define HAVE_DECL_SCTP_SHUTDOWN_SENT 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_EOF 0 +#define HAVE_DECL_SCTP_SHUTDOWN_SENT 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_SENDALL is declared" >&5 -echo $ECHO_N "checking whether SCTP_SENDALL is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_SENDALL+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTPS_SHUTDOWN_SENT is declared" >&5 +echo $ECHO_N "checking whether SCTPS_SHUTDOWN_SENT is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTPS_SHUTDOWN_SENT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -26761,8 +24635,8 @@ int main () { -#ifndef SCTP_SENDALL - char *p = (char *) SCTP_SENDALL; +#ifndef SCTPS_SHUTDOWN_SENT + char *p = (char *) SCTPS_SHUTDOWN_SENT; #endif ; @@ -26791,34 +24665,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_SENDALL=yes + ac_cv_have_decl_SCTPS_SHUTDOWN_SENT=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_SENDALL=no +ac_cv_have_decl_SCTPS_SHUTDOWN_SENT=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_SENDALL" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_SENDALL" >&6 -if test $ac_cv_have_decl_SCTP_SENDALL = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_SHUTDOWN_SENT" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTPS_SHUTDOWN_SENT" >&6 +if test $ac_cv_have_decl_SCTPS_SHUTDOWN_SENT = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_SENDALL 1 +#define HAVE_DECL_SCTPS_SHUTDOWN_SENT 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_SENDALL 0 +#define HAVE_DECL_SCTPS_SHUTDOWN_SENT 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_ADDR_CONFIRMED is declared" >&5 -echo $ECHO_N "checking whether SCTP_ADDR_CONFIRMED is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_ADDR_CONFIRMED+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTP_SHUTDOWN_RECEIVED is declared" >&5 +echo $ECHO_N "checking whether SCTP_SHUTDOWN_RECEIVED is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -26836,8 +24710,8 @@ int main () { -#ifndef SCTP_ADDR_CONFIRMED - char *p = (char *) SCTP_ADDR_CONFIRMED; +#ifndef SCTP_SHUTDOWN_RECEIVED + char *p = (char *) SCTP_SHUTDOWN_RECEIVED; #endif ; @@ -26866,34 +24740,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_ADDR_CONFIRMED=yes + ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_ADDR_CONFIRMED=no +ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_ADDR_CONFIRMED" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_ADDR_CONFIRMED" >&6 -if test $ac_cv_have_decl_SCTP_ADDR_CONFIRMED = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED" >&6 +if test $ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_ADDR_CONFIRMED 1 +#define HAVE_DECL_SCTP_SHUTDOWN_RECEIVED 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_ADDR_CONFIRMED 0 +#define HAVE_DECL_SCTP_SHUTDOWN_RECEIVED 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_DELAYED_ACK_TIME is declared" >&5 -echo $ECHO_N "checking whether SCTP_DELAYED_ACK_TIME is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_DELAYED_ACK_TIME+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTPS_SHUTDOWN_RECEIVED is declared" >&5 +echo $ECHO_N "checking whether SCTPS_SHUTDOWN_RECEIVED is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -26911,8 +24785,8 @@ int main () { -#ifndef SCTP_DELAYED_ACK_TIME - char *p = (char *) SCTP_DELAYED_ACK_TIME; +#ifndef SCTPS_SHUTDOWN_RECEIVED + char *p = (char *) SCTPS_SHUTDOWN_RECEIVED; #endif ; @@ -26941,34 +24815,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_DELAYED_ACK_TIME=yes + ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_DELAYED_ACK_TIME=no +ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_DELAYED_ACK_TIME" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_DELAYED_ACK_TIME" >&6 -if test $ac_cv_have_decl_SCTP_DELAYED_ACK_TIME = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED" >&6 +if test $ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_DELAYED_ACK_TIME 1 +#define HAVE_DECL_SCTPS_SHUTDOWN_RECEIVED 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_DELAYED_ACK_TIME 0 +#define HAVE_DECL_SCTPS_SHUTDOWN_RECEIVED 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_EMPTY is declared" >&5 -echo $ECHO_N "checking whether SCTP_EMPTY is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_EMPTY+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTP_SHUTDOWN_ACK_SENT is declared" >&5 +echo $ECHO_N "checking whether SCTP_SHUTDOWN_ACK_SENT is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -26986,8 +24860,8 @@ int main () { -#ifndef SCTP_EMPTY - char *p = (char *) SCTP_EMPTY; +#ifndef SCTP_SHUTDOWN_ACK_SENT + char *p = (char *) SCTP_SHUTDOWN_ACK_SENT; #endif ; @@ -27016,34 +24890,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_EMPTY=yes + ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_EMPTY=no +ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_EMPTY" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_EMPTY" >&6 -if test $ac_cv_have_decl_SCTP_EMPTY = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT" >&6 +if test $ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_EMPTY 1 +#define HAVE_DECL_SCTP_SHUTDOWN_ACK_SENT 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_EMPTY 0 +#define HAVE_DECL_SCTP_SHUTDOWN_ACK_SENT 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_UNCONFIRMED is declared" >&5 -echo $ECHO_N "checking whether SCTP_UNCONFIRMED is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_UNCONFIRMED+set}" = set; then +echo "$as_me:$LINENO: checking whether SCTPS_SHUTDOWN_ACK_SENT is declared" >&5 +echo $ECHO_N "checking whether SCTPS_SHUTDOWN_ACK_SENT is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -27061,8 +24935,8 @@ int main () { -#ifndef SCTP_UNCONFIRMED - char *p = (char *) SCTP_UNCONFIRMED; +#ifndef SCTPS_SHUTDOWN_ACK_SENT + char *p = (char *) SCTPS_SHUTDOWN_ACK_SENT; #endif ; @@ -27091,34 +24965,36 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_UNCONFIRMED=yes + ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_UNCONFIRMED=no +ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_UNCONFIRMED" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_UNCONFIRMED" >&6 -if test $ac_cv_have_decl_SCTP_UNCONFIRMED = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT" >&6 +if test $ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_UNCONFIRMED 1 +#define HAVE_DECL_SCTPS_SHUTDOWN_ACK_SENT 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_UNCONFIRMED 0 +#define HAVE_DECL_SCTPS_SHUTDOWN_ACK_SENT 0 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_CLOSED is declared" >&5 -echo $ECHO_N "checking whether SCTP_CLOSED is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_CLOSED+set}" = set; then + + + echo "$as_me:$LINENO: checking for struct sctp_paddrparams.spp_pathmtu" >&5 +echo $ECHO_N "checking for struct sctp_paddrparams.spp_pathmtu... $ECHO_C" >&6 +if test "${ac_cv_member_struct_sctp_paddrparams_spp_pathmtu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -27136,10 +25012,9 @@ int main () { -#ifndef SCTP_CLOSED - char *p = (char *) SCTP_CLOSED; -#endif - +static struct sctp_paddrparams ac_aggr; +if (ac_aggr.spp_pathmtu) +return 0; ; return 0; } @@ -27166,37 +25041,12 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_CLOSED=yes + ac_cv_member_struct_sctp_paddrparams_spp_pathmtu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_CLOSED=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_CLOSED" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_CLOSED" >&6 -if test $ac_cv_have_decl_SCTP_CLOSED = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_CLOSED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_CLOSED 0 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking whether SCTPS_IDLE is declared" >&5 -echo $ECHO_N "checking whether SCTPS_IDLE is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTPS_IDLE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -27211,10 +25061,9 @@ int main () { -#ifndef SCTPS_IDLE - char *p = (char *) SCTPS_IDLE; -#endif - +static struct sctp_paddrparams ac_aggr; +if (sizeof ac_aggr.spp_pathmtu) +return 0; ; return 0; } @@ -27241,34 +25090,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTPS_IDLE=yes + ac_cv_member_struct_sctp_paddrparams_spp_pathmtu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTPS_IDLE=no +ac_cv_member_struct_sctp_paddrparams_spp_pathmtu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_IDLE" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTPS_IDLE" >&6 -if test $ac_cv_have_decl_SCTPS_IDLE = yes; then +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_sctp_paddrparams_spp_pathmtu" >&5 +echo "${ECHO_T}$ac_cv_member_struct_sctp_paddrparams_spp_pathmtu" >&6 +if test $ac_cv_member_struct_sctp_paddrparams_spp_pathmtu = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_IDLE 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_IDLE 0 +#define HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_PATHMTU 1 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_BOUND is declared" >&5 -echo $ECHO_N "checking whether SCTP_BOUND is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_BOUND+set}" = set; then +echo "$as_me:$LINENO: checking for struct sctp_paddrparams.spp_sackdelay" >&5 +echo $ECHO_N "checking for struct sctp_paddrparams.spp_sackdelay... $ECHO_C" >&6 +if test "${ac_cv_member_struct_sctp_paddrparams_spp_sackdelay+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -27286,10 +25131,9 @@ int main () { -#ifndef SCTP_BOUND - char *p = (char *) SCTP_BOUND; -#endif - +static struct sctp_paddrparams ac_aggr; +if (ac_aggr.spp_sackdelay) +return 0; ; return 0; } @@ -27316,37 +25160,12 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_BOUND=yes + ac_cv_member_struct_sctp_paddrparams_spp_sackdelay=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_BOUND=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_BOUND" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_BOUND" >&6 -if test $ac_cv_have_decl_SCTP_BOUND = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_BOUND 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_BOUND 0 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking whether SCTPS_BOUND is declared" >&5 -echo $ECHO_N "checking whether SCTPS_BOUND is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTPS_BOUND+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -27361,10 +25180,9 @@ int main () { -#ifndef SCTPS_BOUND - char *p = (char *) SCTPS_BOUND; -#endif - +static struct sctp_paddrparams ac_aggr; +if (sizeof ac_aggr.spp_sackdelay) +return 0; ; return 0; } @@ -27391,34 +25209,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTPS_BOUND=yes + ac_cv_member_struct_sctp_paddrparams_spp_sackdelay=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTPS_BOUND=no +ac_cv_member_struct_sctp_paddrparams_spp_sackdelay=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_BOUND" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTPS_BOUND" >&6 -if test $ac_cv_have_decl_SCTPS_BOUND = yes; then +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_sctp_paddrparams_spp_sackdelay" >&5 +echo "${ECHO_T}$ac_cv_member_struct_sctp_paddrparams_spp_sackdelay" >&6 +if test $ac_cv_member_struct_sctp_paddrparams_spp_sackdelay = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_BOUND 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_BOUND 0 +#define HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_SACKDELAY 1 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_LISTEN is declared" >&5 -echo $ECHO_N "checking whether SCTP_LISTEN is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_LISTEN+set}" = set; then +echo "$as_me:$LINENO: checking for struct sctp_paddrparams.spp_flags" >&5 +echo $ECHO_N "checking for struct sctp_paddrparams.spp_flags... $ECHO_C" >&6 +if test "${ac_cv_member_struct_sctp_paddrparams_spp_flags+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -27436,10 +25250,9 @@ int main () { -#ifndef SCTP_LISTEN - char *p = (char *) SCTP_LISTEN; -#endif - +static struct sctp_paddrparams ac_aggr; +if (ac_aggr.spp_flags) +return 0; ; return 0; } @@ -27466,37 +25279,12 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_LISTEN=yes + ac_cv_member_struct_sctp_paddrparams_spp_flags=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_LISTEN=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_LISTEN" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_LISTEN" >&6 -if test $ac_cv_have_decl_SCTP_LISTEN = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_LISTEN 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_LISTEN 0 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking whether SCTPS_LISTEN is declared" >&5 -echo $ECHO_N "checking whether SCTPS_LISTEN is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTPS_LISTEN+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -27511,10 +25299,9 @@ int main () { -#ifndef SCTPS_LISTEN - char *p = (char *) SCTPS_LISTEN; -#endif - +static struct sctp_paddrparams ac_aggr; +if (sizeof ac_aggr.spp_flags) +return 0; ; return 0; } @@ -27541,34 +25328,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTPS_LISTEN=yes + ac_cv_member_struct_sctp_paddrparams_spp_flags=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTPS_LISTEN=no +ac_cv_member_struct_sctp_paddrparams_spp_flags=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_LISTEN" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTPS_LISTEN" >&6 -if test $ac_cv_have_decl_SCTPS_LISTEN = yes; then +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_sctp_paddrparams_spp_flags" >&5 +echo "${ECHO_T}$ac_cv_member_struct_sctp_paddrparams_spp_flags" >&6 +if test $ac_cv_member_struct_sctp_paddrparams_spp_flags = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_LISTEN 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_LISTEN 0 +#define HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_FLAGS 1 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_COOKIE_WAIT is declared" >&5 -echo $ECHO_N "checking whether SCTP_COOKIE_WAIT is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_COOKIE_WAIT+set}" = set; then +echo "$as_me:$LINENO: checking for struct sctp_remote_error.sre_data" >&5 +echo $ECHO_N "checking for struct sctp_remote_error.sre_data... $ECHO_C" >&6 +if test "${ac_cv_member_struct_sctp_remote_error_sre_data+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -27586,10 +25369,9 @@ int main () { -#ifndef SCTP_COOKIE_WAIT - char *p = (char *) SCTP_COOKIE_WAIT; -#endif - +static struct sctp_remote_error ac_aggr; +if (ac_aggr.sre_data) +return 0; ; return 0; } @@ -27616,37 +25398,12 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_COOKIE_WAIT=yes + ac_cv_member_struct_sctp_remote_error_sre_data=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_COOKIE_WAIT=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_COOKIE_WAIT" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_COOKIE_WAIT" >&6 -if test $ac_cv_have_decl_SCTP_COOKIE_WAIT = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_COOKIE_WAIT 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_COOKIE_WAIT 0 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking whether SCTPS_COOKIE_WAIT is declared" >&5 -echo $ECHO_N "checking whether SCTPS_COOKIE_WAIT is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTPS_COOKIE_WAIT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -27661,10 +25418,9 @@ int main () { -#ifndef SCTPS_COOKIE_WAIT - char *p = (char *) SCTPS_COOKIE_WAIT; -#endif - +static struct sctp_remote_error ac_aggr; +if (sizeof ac_aggr.sre_data) +return 0; ; return 0; } @@ -27691,34 +25447,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTPS_COOKIE_WAIT=yes + ac_cv_member_struct_sctp_remote_error_sre_data=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTPS_COOKIE_WAIT=no +ac_cv_member_struct_sctp_remote_error_sre_data=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_COOKIE_WAIT" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTPS_COOKIE_WAIT" >&6 -if test $ac_cv_have_decl_SCTPS_COOKIE_WAIT = yes; then +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_sctp_remote_error_sre_data" >&5 +echo "${ECHO_T}$ac_cv_member_struct_sctp_remote_error_sre_data" >&6 +if test $ac_cv_member_struct_sctp_remote_error_sre_data = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_COOKIE_WAIT 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_COOKIE_WAIT 0 +#define HAVE_STRUCT_SCTP_REMOTE_ERROR_SRE_DATA 1 _ACEOF fi -echo "$as_me:$LINENO: checking whether SCTP_COOKIE_ECHOED is declared" >&5 -echo $ECHO_N "checking whether SCTP_COOKIE_ECHOED is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_COOKIE_ECHOED+set}" = set; then +echo "$as_me:$LINENO: checking for struct sctp_send_failed.ssf_data" >&5 +echo $ECHO_N "checking for struct sctp_send_failed.ssf_data... $ECHO_C" >&6 +if test "${ac_cv_member_struct_sctp_send_failed_ssf_data+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -27736,10 +25488,9 @@ int main () { -#ifndef SCTP_COOKIE_ECHOED - char *p = (char *) SCTP_COOKIE_ECHOED; -#endif - +static struct sctp_send_failed ac_aggr; +if (ac_aggr.ssf_data) +return 0; ; return 0; } @@ -27766,37 +25517,12 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_COOKIE_ECHOED=yes + ac_cv_member_struct_sctp_send_failed_ssf_data=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_COOKIE_ECHOED=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_COOKIE_ECHOED" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_COOKIE_ECHOED" >&6 -if test $ac_cv_have_decl_SCTP_COOKIE_ECHOED = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_COOKIE_ECHOED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_COOKIE_ECHOED 0 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking whether SCTPS_COOKIE_ECHOED is declared" >&5 -echo $ECHO_N "checking whether SCTPS_COOKIE_ECHOED is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTPS_COOKIE_ECHOED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -27811,10 +25537,9 @@ int main () { -#ifndef SCTPS_COOKIE_ECHOED - char *p = (char *) SCTPS_COOKIE_ECHOED; -#endif - +static struct sctp_send_failed ac_aggr; +if (sizeof ac_aggr.ssf_data) +return 0; ; return 0; } @@ -27841,58 +25566,55 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTPS_COOKIE_ECHOED=yes + ac_cv_member_struct_sctp_send_failed_ssf_data=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTPS_COOKIE_ECHOED=no +ac_cv_member_struct_sctp_send_failed_ssf_data=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_COOKIE_ECHOED" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTPS_COOKIE_ECHOED" >&6 -if test $ac_cv_have_decl_SCTPS_COOKIE_ECHOED = yes; then +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_sctp_send_failed_ssf_data" >&5 +echo "${ECHO_T}$ac_cv_member_struct_sctp_send_failed_ssf_data" >&6 +if test $ac_cv_member_struct_sctp_send_failed_ssf_data = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_COOKIE_ECHOED 1 +#define HAVE_STRUCT_SCTP_SEND_FAILED_SSF_DATA 1 _ACEOF -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_COOKIE_ECHOED 0 -_ACEOF - +fi fi -echo "$as_me:$LINENO: checking whether SCTP_ESTABLISHED is declared" >&5 -echo $ECHO_N "checking whether SCTP_ESTABLISHED is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_ESTABLISHED+set}" = set; then + + + +for ac_header in sched.h setns.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - -int -main () -{ -#ifndef SCTP_ESTABLISHED - char *p = (char *) SCTP_ESTABLISHED; -#endif - - ; - return 0; -} +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -27916,34 +25638,116 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_ESTABLISHED=yes + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_ESTABLISHED=no +ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_ESTABLISHED" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_ESTABLISHED" >&6 -if test $ac_cv_have_decl_SCTP_ESTABLISHED = yes; then +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_ESTABLISHED 1 +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> _ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_ESTABLISHED 0 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - fi -echo "$as_me:$LINENO: checking whether SCTPS_ESTABLISHED is declared" >&5 -echo $ECHO_N "checking whether SCTPS_ESTABLISHED is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTPS_ESTABLISHED+set}" = set; then + +done + + +for ac_func in setns +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -27952,26 +25756,54 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif +#undef $ac_func -int -main () +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" { -#ifndef SCTPS_ESTABLISHED - char *p = (char *) SCTPS_ESTABLISHED; +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -27985,64 +25817,54 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTPS_ESTABLISHED=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTPS_ESTABLISHED=no +eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_ESTABLISHED" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTPS_ESTABLISHED" >&6 -if test $ac_cv_have_decl_SCTPS_ESTABLISHED = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_ESTABLISHED 1 -_ACEOF - - -else +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_ESTABLISHED 0 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF - fi -echo "$as_me:$LINENO: checking whether SCTP_SHUTDOWN_PENDING is declared" >&5 -echo $ECHO_N "checking whether SCTP_SHUTDOWN_PENDING is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_SHUTDOWN_PENDING+set}" = set; then +done + + +HAVE_VALGRIND=no +if test "${ac_cv_header_valgrind_valgrind_h+set}" = set; then + echo "$as_me:$LINENO: checking for valgrind/valgrind.h" >&5 +echo $ECHO_N "checking for valgrind/valgrind.h... $ECHO_C" >&6 +if test "${ac_cv_header_valgrind_valgrind_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_valgrind_valgrind_h" >&5 +echo "${ECHO_T}$ac_cv_header_valgrind_valgrind_h" >&6 else - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +echo "$as_me:$LINENO: checking valgrind/valgrind.h usability" >&5 +echo $ECHO_N "checking valgrind/valgrind.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - -int -main () -{ -#ifndef SCTP_SHUTDOWN_PENDING - char *p = (char *) SCTP_SHUTDOWN_PENDING; -#endif - - ; - return 0; -} +$ac_includes_default +#include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -28066,34 +25888,110 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_SHUTDOWN_PENDING=yes + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_SHUTDOWN_PENDING=no +ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_SHUTDOWN_PENDING" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_SHUTDOWN_PENDING" >&6 -if test $ac_cv_have_decl_SCTP_SHUTDOWN_PENDING = yes; then +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_SHUTDOWN_PENDING 1 +# Is the header present? +echo "$as_me:$LINENO: checking valgrind/valgrind.h presence" >&5 +echo $ECHO_N "checking valgrind/valgrind.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: valgrind/valgrind.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: valgrind/valgrind.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: valgrind/valgrind.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: valgrind/valgrind.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: valgrind/valgrind.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: valgrind/valgrind.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: valgrind/valgrind.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: valgrind/valgrind.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for valgrind/valgrind.h" >&5 +echo $ECHO_N "checking for valgrind/valgrind.h... $ECHO_C" >&6 +if test "${ac_cv_header_valgrind_valgrind_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_SHUTDOWN_PENDING 0 -_ACEOF - + ac_cv_header_valgrind_valgrind_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_valgrind_valgrind_h" >&5 +echo "${ECHO_T}$ac_cv_header_valgrind_valgrind_h" >&6 fi -echo "$as_me:$LINENO: checking whether SCTPS_SHUTDOWN_PENDING is declared" >&5 -echo $ECHO_N "checking whether SCTPS_SHUTDOWN_PENDING is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING+set}" = set; then +if test $ac_cv_header_valgrind_valgrind_h = yes; then + HAVE_VALGRIND=yes +fi + + + + +echo "$as_me:$LINENO: checking for SO_BSDCOMPAT declaration" >&5 +echo $ECHO_N "checking for SO_BSDCOMPAT declaration... $ECHO_C" >&6 +if test "${ac_cv_decl_so_bsdcompat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28102,19 +26000,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +#include int main () { -#ifndef SCTPS_SHUTDOWN_PENDING - char *p = (char *) SCTPS_SHUTDOWN_PENDING; -#endif - +int i = SO_BSDCOMPAT; ; return 0; } @@ -28141,34 +26031,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING=yes + ac_cv_decl_so_bsdcompat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING=no +ac_cv_decl_so_bsdcompat=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING" >&6 -if test $ac_cv_have_decl_SCTPS_SHUTDOWN_PENDING = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_SHUTDOWN_PENDING 1 -_ACEOF - +echo "$as_me:$LINENO: result: $ac_cv_decl_so_bsdcompat" >&5 +echo "${ECHO_T}$ac_cv_decl_so_bsdcompat" >&6 -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_SHUTDOWN_PENDING 0 +case "${ac_cv_decl_so_bsdcompat}" in + "yes" ) +cat >>confdefs.h <<\_ACEOF +#define HAVE_SO_BSDCOMPAT _ACEOF + ;; + * ) ;; +esac - -fi -echo "$as_me:$LINENO: checking whether SCTP_SHUTDOWN_SENT is declared" >&5 -echo $ECHO_N "checking whether SCTP_SHUTDOWN_SENT is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_SHUTDOWN_SENT+set}" = set; then +echo "$as_me:$LINENO: checking for INADDR_LOOPBACK in netinet/in.h" >&5 +echo $ECHO_N "checking for INADDR_LOOPBACK in netinet/in.h... $ECHO_C" >&6 +if test "${ac_cv_decl_inaddr_loopback+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28177,19 +26063,12 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +#include +#include int main () { -#ifndef SCTP_SHUTDOWN_SENT - char *p = (char *) SCTP_SHUTDOWN_SENT; -#endif - +int i = INADDR_LOOPBACK; ; return 0; } @@ -28216,34 +26095,23 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_SHUTDOWN_SENT=yes + ac_cv_decl_inaddr_loopback=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_SHUTDOWN_SENT=no +ac_cv_decl_inaddr_loopback=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_SHUTDOWN_SENT" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_SHUTDOWN_SENT" >&6 -if test $ac_cv_have_decl_SCTP_SHUTDOWN_SENT = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_SHUTDOWN_SENT 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_SHUTDOWN_SENT 0 -_ACEOF - fi -echo "$as_me:$LINENO: checking whether SCTPS_SHUTDOWN_SENT is declared" >&5 -echo $ECHO_N "checking whether SCTPS_SHUTDOWN_SENT is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTPS_SHUTDOWN_SENT+set}" = set; then +echo "$as_me:$LINENO: result: $ac_cv_decl_inaddr_loopback" >&5 +echo "${ECHO_T}$ac_cv_decl_inaddr_loopback" >&6 + +if test ${ac_cv_decl_inaddr_loopback} = no; then + echo "$as_me:$LINENO: checking for INADDR_LOOPBACK in rpc/types.h" >&5 +echo $ECHO_N "checking for INADDR_LOOPBACK in rpc/types.h... $ECHO_C" >&6 +if test "${ac_cv_decl_inaddr_loopback_rpc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28252,19 +26120,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +#include int main () { -#ifndef SCTPS_SHUTDOWN_SENT - char *p = (char *) SCTPS_SHUTDOWN_SENT; -#endif - +int i = INADDR_LOOPBACK; ; return 0; } @@ -28291,34 +26151,29 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTPS_SHUTDOWN_SENT=yes + ac_cv_decl_inaddr_loopback_rpc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTPS_SHUTDOWN_SENT=no +ac_cv_decl_inaddr_loopback_rpc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_SHUTDOWN_SENT" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTPS_SHUTDOWN_SENT" >&6 -if test $ac_cv_have_decl_SCTPS_SHUTDOWN_SENT = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_SHUTDOWN_SENT 1 -_ACEOF +echo "$as_me:$LINENO: result: $ac_cv_decl_inaddr_loopback_rpc" >&5 +echo "${ECHO_T}$ac_cv_decl_inaddr_loopback_rpc" >&6 + case "${ac_cv_decl_inaddr_loopback_rpc}" in + "yes" ) -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_SHUTDOWN_SENT 0 +cat >>confdefs.h <<\_ACEOF +#define DEF_INADDR_LOOPBACK_IN_RPC_TYPES_H _ACEOF - - -fi -echo "$as_me:$LINENO: checking whether SCTP_SHUTDOWN_RECEIVED is declared" >&5 -echo $ECHO_N "checking whether SCTP_SHUTDOWN_RECEIVED is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED+set}" = set; then + ;; + * ) + echo "$as_me:$LINENO: checking for INADDR_LOOPBACK in winsock2.h" >&5 +echo $ECHO_N "checking for INADDR_LOOPBACK in winsock2.h... $ECHO_C" >&6 +if test "${ac_cv_decl_inaddr_loopback_winsock2+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28327,19 +26182,12 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +#define WIN32_LEAN_AND_MEAN + #include int main () { -#ifndef SCTP_SHUTDOWN_RECEIVED - char *p = (char *) SCTP_SHUTDOWN_RECEIVED; -#endif - +int i = INADDR_LOOPBACK; ; return 0; } @@ -28366,34 +26214,38 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED=yes + ac_cv_decl_inaddr_loopback_winsock2=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED=no +ac_cv_decl_inaddr_loopback_winsock2=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED" >&6 -if test $ac_cv_have_decl_SCTP_SHUTDOWN_RECEIVED = yes; then +echo "$as_me:$LINENO: result: $ac_cv_decl_inaddr_loopback_winsock2" >&5 +echo "${ECHO_T}$ac_cv_decl_inaddr_loopback_winsock2" >&6 + case "${ac_cv_decl_inaddr_loopback_winsock2}" in + "yes" ) -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_SHUTDOWN_RECEIVED 1 +cat >>confdefs.h <<\_ACEOF +#define DEF_INADDR_LOOPBACK_IN_WINSOCK2_H _ACEOF + ;; + * ) + # couldn't find it anywhere - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_SHUTDOWN_RECEIVED 0 +cat >>confdefs.h <<\_ACEOF +#define HAVE_NO_INADDR_LOOPBACK _ACEOF - - + ;; + esac;; + esac fi -echo "$as_me:$LINENO: checking whether SCTPS_SHUTDOWN_RECEIVED is declared" >&5 -echo $ECHO_N "checking whether SCTPS_SHUTDOWN_RECEIVED is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED+set}" = set; then + +echo "$as_me:$LINENO: checking for sys_errlist declaration in stdio.h or errno.h" >&5 +echo $ECHO_N "checking for sys_errlist declaration in stdio.h or errno.h... $ECHO_C" >&6 +if test "${ac_cv_decl_sys_errlist+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28402,19 +26254,12 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +#include +#include int main () { -#ifndef SCTPS_SHUTDOWN_RECEIVED - char *p = (char *) SCTPS_SHUTDOWN_RECEIVED; -#endif - +char *msg = *(sys_errlist + 1); ; return 0; } @@ -28441,34 +26286,29 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED=yes + ac_cv_decl_sys_errlist=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED=no +ac_cv_decl_sys_errlist=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED" >&6 -if test $ac_cv_have_decl_SCTPS_SHUTDOWN_RECEIVED = yes; then +echo "$as_me:$LINENO: result: $ac_cv_decl_sys_errlist" >&5 +echo "${ECHO_T}$ac_cv_decl_sys_errlist" >&6 +if test $ac_cv_decl_sys_errlist = yes; then -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_SHUTDOWN_RECEIVED 1 +cat >>confdefs.h <<\_ACEOF +#define SYS_ERRLIST_DECLARED _ACEOF - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_SHUTDOWN_RECEIVED 0 -_ACEOF +fi -fi -echo "$as_me:$LINENO: checking whether SCTP_SHUTDOWN_ACK_SENT is declared" >&5 -echo $ECHO_N "checking whether SCTP_SHUTDOWN_ACK_SENT is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT+set}" = set; then +echo "$as_me:$LINENO: checking if windows.h includes winsock2.h" >&5 +echo $ECHO_N "checking if windows.h includes winsock2.h... $ECHO_C" >&6 +if test "${erts_cv_windows_h_includes_winsock2_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28477,18 +26317,15 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - +#include int main () { -#ifndef SCTP_SHUTDOWN_ACK_SENT - char *p = (char *) SCTP_SHUTDOWN_ACK_SENT; -#endif +#ifndef _WINSOCK2API_ + #error winsock2.h not included + #endif + int i = 1; ; return 0; @@ -28516,34 +26353,31 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT=yes + erts_cv_windows_h_includes_winsock2_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT=no +erts_cv_windows_h_includes_winsock2_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT" >&6 -if test $ac_cv_have_decl_SCTP_SHUTDOWN_ACK_SENT = yes; then +echo "$as_me:$LINENO: result: $erts_cv_windows_h_includes_winsock2_h" >&5 +echo "${ECHO_T}$erts_cv_windows_h_includes_winsock2_h" >&6 +if test $erts_cv_windows_h_includes_winsock2_h = yes; then -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_SHUTDOWN_ACK_SENT 1 +cat >>confdefs.h <<\_ACEOF +#define WINDOWS_H_INCLUDES_WINSOCK2_H 1 _ACEOF +fi -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTP_SHUTDOWN_ACK_SENT 0 -_ACEOF +CPPFLAGS=$saved_cppflags -fi -echo "$as_me:$LINENO: checking whether SCTPS_SHUTDOWN_ACK_SENT is declared" >&5 -echo $ECHO_N "checking whether SCTPS_SHUTDOWN_ACK_SENT is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT+set}" = set; then +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28552,17 +26386,55 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - int main () { -#ifndef SCTPS_SHUTDOWN_ACK_SENT - char *p = (char *) SCTPS_SHUTDOWN_ACK_SENT; +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } #endif ; @@ -28591,36 +26463,28 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT=yes + ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT=no +ac_cv_c_const=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT" >&5 -echo "${ECHO_T}$ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT" >&6 -if test $ac_cv_have_decl_SCTPS_SHUTDOWN_ACK_SENT = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_SHUTDOWN_ACK_SENT 1 -_ACEOF - +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SCTPS_SHUTDOWN_ACK_SENT 0 +cat >>confdefs.h <<\_ACEOF +#define const _ACEOF - fi - - echo "$as_me:$LINENO: checking for struct sctp_paddrparams.spp_pathmtu" >&5 -echo $ECHO_N "checking for struct sctp_paddrparams.spp_pathmtu... $ECHO_C" >&6 -if test "${ac_cv_member_struct_sctp_paddrparams_spp_pathmtu+set}" = set; then +echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28629,18 +26493,21 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - +#include +#include +#ifdef signal +# undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif int main () { -static struct sctp_paddrparams ac_aggr; -if (ac_aggr.spp_pathmtu) -return 0; +int i; ; return 0; } @@ -28667,29 +26534,42 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_sctp_paddrparams_spp_pathmtu=yes + ac_cv_type_signal=void else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF +ac_cv_type_signal=int +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + +echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +$ac_includes_default int main () { -static struct sctp_paddrparams ac_aggr; -if (sizeof ac_aggr.spp_pathmtu) -return 0; +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; ; return 0; } @@ -28716,30 +26596,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_sctp_paddrparams_spp_pathmtu=yes + ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_sctp_paddrparams_spp_pathmtu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_type_off_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_sctp_paddrparams_spp_pathmtu" >&5 -echo "${ECHO_T}$ac_cv_member_struct_sctp_paddrparams_spp_pathmtu" >&6 -if test $ac_cv_member_struct_sctp_paddrparams_spp_pathmtu = yes; then +echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : +else cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_PATHMTU 1 +#define off_t long _ACEOF - fi -echo "$as_me:$LINENO: checking for struct sctp_paddrparams.spp_sackdelay" >&5 -echo $ECHO_N "checking for struct sctp_paddrparams.spp_sackdelay... $ECHO_C" >&6 -if test "${ac_cv_member_struct_sctp_paddrparams_spp_sackdelay+set}" = set; then + +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28748,18 +26628,14 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +$ac_includes_default int main () { -static struct sctp_paddrparams ac_aggr; -if (ac_aggr.spp_sackdelay) -return 0; +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; ; return 0; } @@ -28786,29 +26662,46 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_sctp_paddrparams_spp_sackdelay=yes + ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF +ac_cv_type_pid_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +$ac_includes_default int main () { -static struct sctp_paddrparams ac_aggr; -if (sizeof ac_aggr.spp_sackdelay) -return 0; +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; ; return 0; } @@ -28835,30 +26728,31 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_sctp_paddrparams_spp_sackdelay=yes + ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_sctp_paddrparams_spp_sackdelay=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_type_size_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_sctp_paddrparams_spp_sackdelay" >&5 -echo "${ECHO_T}$ac_cv_member_struct_sctp_paddrparams_spp_sackdelay" >&6 -if test $ac_cv_member_struct_sctp_paddrparams_spp_sackdelay = yes; then +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_SACKDELAY 1 +#define size_t unsigned _ACEOF - fi -echo "$as_me:$LINENO: checking for struct sctp_paddrparams.spp_flags" >&5 -echo $ECHO_N "checking for struct sctp_paddrparams.spp_flags... $ECHO_C" >&6 -if test "${ac_cv_member_struct_sctp_paddrparams_spp_flags+set}" = set; then + + +echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 +echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 +if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28867,18 +26761,13 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - +#include +#include int main () { -static struct sctp_paddrparams ac_aggr; -if (ac_aggr.spp_flags) -return 0; +struct tm *tp; tp->tm_sec; ; return 0; } @@ -28905,29 +26794,42 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_sctp_paddrparams_spp_flags=yes + ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF +ac_cv_struct_tm=sys/time.h +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 +echo "${ECHO_T}$ac_cv_struct_tm" >&6 +if test $ac_cv_struct_tm = sys/time.h; then + +cat >>confdefs.h <<\_ACEOF +#define TM_IN_SYS_TIME 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking whether struct sockaddr has sa_len field" >&5 +echo $ECHO_N "checking whether struct sockaddr has sa_len field... $ECHO_C" >&6 +if test "${ac_cv_struct_sockaddr_sa_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +#include +#include int main () { -static struct sctp_paddrparams ac_aggr; -if (sizeof ac_aggr.spp_flags) -return 0; +struct sockaddr s; s.sa_len = 10; ; return 0; } @@ -28954,30 +26856,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_sctp_paddrparams_spp_flags=yes + ac_cv_struct_sockaddr_sa_len=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_sctp_paddrparams_spp_flags=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_struct_sockaddr_sa_len=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_sctp_paddrparams_spp_flags" >&5 -echo "${ECHO_T}$ac_cv_member_struct_sctp_paddrparams_spp_flags" >&6 -if test $ac_cv_member_struct_sctp_paddrparams_spp_flags = yes; then +echo "$as_me:$LINENO: result: $ac_cv_struct_sockaddr_sa_len" >&5 +echo "${ECHO_T}$ac_cv_struct_sockaddr_sa_len" >&6 -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_FLAGS 1 +case ${ac_cv_struct_sockaddr_sa_len} in + "no" ) +cat >>confdefs.h <<\_ACEOF +#define NO_SA_LEN 1 _ACEOF + ;; + *) ;; +esac - -fi -echo "$as_me:$LINENO: checking for struct sctp_remote_error.sre_data" >&5 -echo $ECHO_N "checking for struct sctp_remote_error.sre_data... $ECHO_C" >&6 -if test "${ac_cv_member_struct_sctp_remote_error_sre_data+set}" = set; then +echo "$as_me:$LINENO: checking for struct exception (and matherr function)" >&5 +echo $ECHO_N "checking for struct exception (and matherr function)... $ECHO_C" >&6 +if test "${ac_cv_struct_exception+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -28986,18 +26888,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +#include int main () { -static struct sctp_remote_error ac_aggr; -if (ac_aggr.sre_data) -return 0; +struct exception x; x.type = DOMAIN; x.type = SING; ; return 0; } @@ -29024,29 +26919,47 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_sctp_remote_error_sre_data=yes + ac_cv_struct_exception=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF +ac_cv_struct_exception=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_struct_exception" >&5 +echo "${ECHO_T}$ac_cv_struct_exception" >&6 + +case "${ac_cv_struct_exception}" in + "yes" ) +cat >>confdefs.h <<\_ACEOF +#define USE_MATHERR 1 +_ACEOF + ;; + * ) ;; +esac + + +echo "$as_me:$LINENO: checking for char" >&5 +echo $ECHO_N "checking for char... $ECHO_C" >&6 +if test "${ac_cv_type_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +$ac_includes_default int main () { -static struct sctp_remote_error ac_aggr; -if (sizeof ac_aggr.sre_data) -return 0; +if ((char *) 0) + return 0; +if (sizeof (char)) + return 0; ; return 0; } @@ -29073,50 +26986,43 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_sctp_remote_error_sre_data=yes + ac_cv_type_char=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_sctp_remote_error_sre_data=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_type_char=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_sctp_remote_error_sre_data" >&5 -echo "${ECHO_T}$ac_cv_member_struct_sctp_remote_error_sre_data" >&6 -if test $ac_cv_member_struct_sctp_remote_error_sre_data = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SCTP_REMOTE_ERROR_SRE_DATA 1 -_ACEOF - +echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5 +echo "${ECHO_T}$ac_cv_type_char" >&6 -fi -echo "$as_me:$LINENO: checking for struct sctp_send_failed.ssf_data" >&5 -echo $ECHO_N "checking for struct sctp_send_failed.ssf_data... $ECHO_C" >&6 -if test "${ac_cv_member_struct_sctp_send_failed_ssf_data+set}" = set; then +echo "$as_me:$LINENO: checking size of char" >&5 +echo $ECHO_N "checking size of char... $ECHO_C" >&6 +if test "${ac_cv_sizeof_char+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + if test "$ac_cv_type_char" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +$ac_includes_default int main () { -static struct sctp_send_failed ac_aggr; -if (ac_aggr.ssf_data) -return 0; +static int test_array [1 - 2 * !(((long) (sizeof (char))) >= 0)]; +test_array [0] = 0 + ; return 0; } @@ -29143,29 +27049,21 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_sctp_send_failed_ssf_data=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >conftest.$ac_ext <<_ACEOF + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H - #include - #endif - #include - - +$ac_includes_default int main () { -static struct sctp_send_failed ac_aggr; -if (sizeof ac_aggr.ssf_data) -return 0; +static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } @@ -29192,47 +27090,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_sctp_send_failed_ssf_data=yes + ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_sctp_send_failed_ssf_data=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_sctp_send_failed_ssf_data" >&5 -echo "${ECHO_T}$ac_cv_member_struct_sctp_send_failed_ssf_data" >&6 -if test $ac_cv_member_struct_sctp_send_failed_ssf_data = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SCTP_SEND_FAILED_SSF_DATA 1 -_ACEOF - - -fi - -fi - - - -for ac_header in sched.h setns.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + done else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -29240,7 +27115,15 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -#include <$ac_header> +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (char))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -29264,172 +27147,28 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_func in setns -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - +$ac_includes_default int main () { -return f != $ac_func; +static int test_array [1 - 2 * !(((long) (sizeof (char))) >= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -29443,54 +27182,54 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo= ac_hi= fi -done - - -HAVE_VALGRIND=no -if test "${ac_cv_header_valgrind_valgrind_h+set}" = set; then - echo "$as_me:$LINENO: checking for valgrind/valgrind.h" >&5 -echo $ECHO_N "checking for valgrind/valgrind.h... $ECHO_C" >&6 -if test "${ac_cv_header_valgrind_valgrind_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_header_valgrind_valgrind_h" >&5 -echo "${ECHO_T}$ac_cv_header_valgrind_valgrind_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking valgrind/valgrind.h usability" >&5 -echo $ECHO_N "checking valgrind/valgrind.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -#include +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -29514,110 +27253,111 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking valgrind/valgrind.h presence" >&5 -echo $ECHO_N "checking valgrind/valgrind.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF +done +case $ac_lo in +?*) ac_cv_sizeof_char=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (char), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +$ac_includes_default +long longval () { return (long) (sizeof (char)); } +unsigned long ulongval () { return (long) (sizeof (char)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (char))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (char)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (char)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_char=`cat conftest.val` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (char), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: valgrind/valgrind.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: valgrind/valgrind.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: valgrind/valgrind.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: valgrind/valgrind.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: valgrind/valgrind.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: valgrind/valgrind.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: valgrind/valgrind.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: valgrind/valgrind.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: valgrind/valgrind.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for valgrind/valgrind.h" >&5 -echo $ECHO_N "checking for valgrind/valgrind.h... $ECHO_C" >&6 -if test "${ac_cv_header_valgrind_valgrind_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_valgrind_valgrind_h=$ac_header_preproc +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_header_valgrind_valgrind_h" >&5 -echo "${ECHO_T}$ac_cv_header_valgrind_valgrind_h" >&6 - fi -if test $ac_cv_header_valgrind_valgrind_h = yes; then - HAVE_VALGRIND=yes +rm -f conftest.val +else + ac_cv_sizeof_char=0 fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5 +echo "${ECHO_T}$ac_cv_sizeof_char" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_CHAR $ac_cv_sizeof_char +_ACEOF - - -echo "$as_me:$LINENO: checking for SO_BSDCOMPAT declaration" >&5 -echo $ECHO_N "checking for SO_BSDCOMPAT declaration... $ECHO_C" >&6 -if test "${ac_cv_decl_so_bsdcompat+set}" = set; then +echo "$as_me:$LINENO: checking for short" >&5 +echo $ECHO_N "checking for short... $ECHO_C" >&6 +if test "${ac_cv_type_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -29626,11 +27366,14 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +$ac_includes_default int main () { -int i = SO_BSDCOMPAT; +if ((short *) 0) + return 0; +if (sizeof (short)) + return 0; ; return 0; } @@ -29657,44 +27400,43 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_decl_so_bsdcompat=yes + ac_cv_type_short=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_decl_so_bsdcompat=no +ac_cv_type_short=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_decl_so_bsdcompat" >&5 -echo "${ECHO_T}$ac_cv_decl_so_bsdcompat" >&6 - -case "${ac_cv_decl_so_bsdcompat}" in - "yes" ) -cat >>confdefs.h <<\_ACEOF -#define HAVE_SO_BSDCOMPAT -_ACEOF - ;; - * ) ;; -esac +echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 +echo "${ECHO_T}$ac_cv_type_short" >&6 -echo "$as_me:$LINENO: checking for INADDR_LOOPBACK in netinet/in.h" >&5 -echo $ECHO_N "checking for INADDR_LOOPBACK in netinet/in.h... $ECHO_C" >&6 -if test "${ac_cv_decl_inaddr_loopback+set}" = set; then +echo "$as_me:$LINENO: checking size of short" >&5 +echo $ECHO_N "checking size of short... $ECHO_C" >&6 +if test "${ac_cv_sizeof_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + if test "$ac_cv_type_short" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +$ac_includes_default int main () { -int i = INADDR_LOOPBACK; +static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)]; +test_array [0] = 0 + ; return 0; } @@ -29721,36 +27463,21 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_decl_inaddr_loopback=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_decl_inaddr_loopback=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ac_cv_decl_inaddr_loopback" >&5 -echo "${ECHO_T}$ac_cv_decl_inaddr_loopback" >&6 - -if test ${ac_cv_decl_inaddr_loopback} = no; then - echo "$as_me:$LINENO: checking for INADDR_LOOPBACK in rpc/types.h" >&5 -echo $ECHO_N "checking for INADDR_LOOPBACK in rpc/types.h... $ECHO_C" >&6 -if test "${ac_cv_decl_inaddr_loopback_rpc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +$ac_includes_default int main () { -int i = INADDR_LOOPBACK; +static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } @@ -29777,43 +27504,37 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_decl_inaddr_loopback_rpc=yes + ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_decl_inaddr_loopback_rpc=no +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_decl_inaddr_loopback_rpc" >&5 -echo "${ECHO_T}$ac_cv_decl_inaddr_loopback_rpc" >&6 - - case "${ac_cv_decl_inaddr_loopback_rpc}" in - "yes" ) - -cat >>confdefs.h <<\_ACEOF -#define DEF_INADDR_LOOPBACK_IN_RPC_TYPES_H -_ACEOF - ;; - * ) - echo "$as_me:$LINENO: checking for INADDR_LOOPBACK in winsock2.h" >&5 -echo $ECHO_N "checking for INADDR_LOOPBACK in winsock2.h... $ECHO_C" >&6 -if test "${ac_cv_decl_inaddr_loopback_winsock2+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + done else - cat >conftest.$ac_ext <<_ACEOF + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#define WIN32_LEAN_AND_MEAN - #include +$ac_includes_default int main () { -int i = INADDR_LOOPBACK; +static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)]; +test_array [0] = 0 + ; return 0; } @@ -29840,52 +27561,21 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_decl_inaddr_loopback_winsock2=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_decl_inaddr_loopback_winsock2=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_decl_inaddr_loopback_winsock2" >&5 -echo "${ECHO_T}$ac_cv_decl_inaddr_loopback_winsock2" >&6 - case "${ac_cv_decl_inaddr_loopback_winsock2}" in - "yes" ) - -cat >>confdefs.h <<\_ACEOF -#define DEF_INADDR_LOOPBACK_IN_WINSOCK2_H -_ACEOF - ;; - * ) - # couldn't find it anywhere - -cat >>confdefs.h <<\_ACEOF -#define HAVE_NO_INADDR_LOOPBACK -_ACEOF - ;; - esac;; - esac -fi - -echo "$as_me:$LINENO: checking for sys_errlist declaration in stdio.h or errno.h" >&5 -echo $ECHO_N "checking for sys_errlist declaration in stdio.h or errno.h... $ECHO_C" >&6 -if test "${ac_cv_decl_sys_errlist+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +$ac_includes_default int main () { -char *msg = *(sys_errlist + 1); +static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)]; +test_array [0] = 0 + ; return 0; } @@ -29912,46 +27602,44 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_decl_sys_errlist=yes + ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_decl_sys_errlist=no +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_decl_sys_errlist" >&5 -echo "${ECHO_T}$ac_cv_decl_sys_errlist" >&6 -if test $ac_cv_decl_sys_errlist = yes; then - -cat >>confdefs.h <<\_ACEOF -#define SYS_ERRLIST_DECLARED -_ACEOF + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo= ac_hi= fi - - -echo "$as_me:$LINENO: checking if windows.h includes winsock2.h" >&5 -echo $ECHO_N "checking if windows.h includes winsock2.h... $ECHO_C" >&6 -if test "${erts_cv_windows_h_includes_winsock2_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - +$ac_includes_default int main () { -#ifndef _WINSOCK2API_ - #error winsock2.h not included - #endif - int i = 1; +static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; +test_array [0] = 0 ; return 0; @@ -29979,32 +27667,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erts_cv_windows_h_includes_winsock2_h=yes + ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erts_cv_windows_h_includes_winsock2_h=no +ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $erts_cv_windows_h_includes_winsock2_h" >&5 -echo "${ECHO_T}$erts_cv_windows_h_includes_winsock2_h" >&6 -if test $erts_cv_windows_h_includes_winsock2_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define WINDOWS_H_INCLUDES_WINSOCK2_H 1 -_ACEOF - -fi - -CPPFLAGS=$saved_cppflags - - -echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +done +case $ac_lo in +?*) ac_cv_sizeof_short=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -30012,105 +27698,80 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default +long longval () { return (long) (sizeof (short)); } +unsigned long ulongval () { return (long) (sizeof (short)); } +#include +#include int main () { -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset x; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - ccp = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - *t++ = 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - } -#endif + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (short))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (short)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (short)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_c_const=yes + ac_cv_sizeof_short=`cat conftest.val` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_c_const=no +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6 -if test $ac_cv_c_const = no; then - -cat >>confdefs.h <<\_ACEOF -#define const +fi +rm -f conftest.val +else + ac_cv_sizeof_short=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 +echo "${ECHO_T}$ac_cv_sizeof_short" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF -fi -echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 -if test "${ac_cv_type_signal+set}" = set; then +echo "$as_me:$LINENO: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6 +if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -30119,21 +27780,14 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include -#ifdef signal -# undef signal -#endif -#ifdef __cplusplus -extern "C" void (*signal (int, void (*)(int)))(int); -#else -void (*signal ()) (); -#endif - +$ac_includes_default int main () { -int i; +if ((int *) 0) + return 0; +if (sizeof (int)) + return 0; ; return 0; } @@ -30160,29 +27814,31 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_signal=void + ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_signal=int +ac_cv_type_int=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 -echo "${ECHO_T}$ac_cv_type_signal" >&6 - -cat >>confdefs.h <<_ACEOF -#define RETSIGTYPE $ac_cv_type_signal -_ACEOF - +echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6 -echo "$as_me:$LINENO: checking for off_t" >&5 -echo $ECHO_N "checking for off_t... $ECHO_C" >&6 -if test "${ac_cv_type_off_t+set}" = set; then +echo "$as_me:$LINENO: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6 +if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + if test "$ac_cv_type_int" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -30192,10 +27848,9 @@ int main () { -if ((off_t *) 0) - return 0; -if (sizeof (off_t)) - return 0; +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; +test_array [0] = 0 + ; return 0; } @@ -30222,33 +27877,9 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_off_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_off_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 -echo "${ECHO_T}$ac_cv_type_off_t" >&6 -if test $ac_cv_type_off_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define off_t long -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for pid_t" >&5 -echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 -if test "${ac_cv_type_pid_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -30258,10 +27889,9 @@ int main () { -if ((pid_t *) 0) - return 0; -if (sizeof (pid_t)) - return 0; +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } @@ -30288,33 +27918,25 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_pid_t=yes + ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_pid_t=no +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -echo "${ECHO_T}$ac_cv_type_pid_t" >&6 -if test $ac_cv_type_pid_t = yes; then - : + done else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6 -if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -30324,10 +27946,9 @@ int main () { -if ((size_t *) 0) - return 0; -if (sizeof (size_t)) - return 0; +static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; +test_array [0] = 0 + ; return 0; } @@ -30354,46 +27975,21 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_size_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_size_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6 -if test $ac_cv_type_size_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned -_ACEOF - -fi - - -echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 -echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 -if test "${ac_cv_struct_tm+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include - +$ac_includes_default int main () { -struct tm *tp; tp->tm_sec; +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; +test_array [0] = 0 + ; return 0; } @@ -30420,42 +28016,45 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_struct_tm=time.h + ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_struct_tm=sys/time.h +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 -echo "${ECHO_T}$ac_cv_struct_tm" >&6 -if test $ac_cv_struct_tm = sys/time.h; then - -cat >>confdefs.h <<\_ACEOF -#define TM_IN_SYS_TIME 1 -_ACEOF + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_lo= ac_hi= fi - -echo "$as_me:$LINENO: checking whether struct sockaddr has sa_len field" >&5 -echo $ECHO_N "checking whether struct sockaddr has sa_len field... $ECHO_C" >&6 -if test "${ac_cv_struct_sockaddr_sa_len+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +$ac_includes_default int main () { -struct sockaddr s; s.sa_len = 10; +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } @@ -30482,31 +28081,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_struct_sockaddr_sa_len=yes + ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_struct_sockaddr_sa_len=no +ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_struct_sockaddr_sa_len" >&5 -echo "${ECHO_T}$ac_cv_struct_sockaddr_sa_len" >&6 - -case ${ac_cv_struct_sockaddr_sa_len} in - "no" ) -cat >>confdefs.h <<\_ACEOF -#define NO_SA_LEN 1 -_ACEOF - ;; - *) ;; +done +case $ac_lo in +?*) ac_cv_sizeof_int=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; esac - -echo "$as_me:$LINENO: checking for struct exception (and matherr function)" >&5 -echo $ECHO_N "checking for struct exception (and matherr function)... $ECHO_C" >&6 -if test "${ac_cv_struct_exception+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -30514,62 +28112,80 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +$ac_includes_default +long longval () { return (long) (sizeof (int)); } +unsigned long ulongval () { return (long) (sizeof (int)); } +#include +#include int main () { -struct exception x; x.type = DOMAIN; x.type = SING; + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (int))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_struct_exception=yes + ac_cv_sizeof_int=`cat conftest.val` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_struct_exception=no +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_struct_exception" >&5 -echo "${ECHO_T}$ac_cv_struct_exception" >&6 - -case "${ac_cv_struct_exception}" in - "yes" ) -cat >>confdefs.h <<\_ACEOF -#define USE_MATHERR 1 +fi +rm -f conftest.val +else + ac_cv_sizeof_int=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int _ACEOF - ;; - * ) ;; -esac -echo "$as_me:$LINENO: checking for char" >&5 -echo $ECHO_N "checking for char... $ECHO_C" >&6 -if test "${ac_cv_type_char+set}" = set; then +echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6 +if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -30582,9 +28198,9 @@ int main () { -if ((char *) 0) +if ((long *) 0) return 0; -if (sizeof (char)) +if (sizeof (long)) return 0; ; return 0; @@ -30612,24 +28228,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_char=yes + ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_char=no +ac_cv_type_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5 -echo "${ECHO_T}$ac_cv_type_char" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 -echo "$as_me:$LINENO: checking size of char" >&5 -echo $ECHO_N "checking size of char... $ECHO_C" >&6 -if test "${ac_cv_sizeof_char+set}" = set; then +echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_char" = yes; then + if test "$ac_cv_type_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -30646,7 +28262,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (char))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; test_array [0] = 0 ; @@ -30687,7 +28303,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; @@ -30744,7 +28360,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (char))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; test_array [0] = 0 ; @@ -30785,7 +28401,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (char))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; test_array [0] = 0 ; @@ -30850,7 +28466,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; @@ -30889,10 +28505,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_char=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77 +?*) ac_cv_sizeof_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (char), 77 +echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -30911,8 +28527,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (char)); } -unsigned long ulongval () { return (long) (sizeof (char)); } +long longval () { return (long) (sizeof (long)); } +unsigned long ulongval () { return (long) (sizeof (long)); } #include #include int @@ -30922,17 +28538,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (char))) < 0) + if (((long) (sizeof (long))) < 0) { long i = longval (); - if (i != ((long) (sizeof (char)))) + if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (char)))) + if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%lu\n", i); } @@ -30953,16 +28569,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_char=`cat conftest.val` + ac_cv_sizeof_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (char), 77 +echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -30971,19 +28587,19 @@ fi rm -f conftest.val else - ac_cv_sizeof_char=0 + ac_cv_sizeof_long=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5 -echo "${ECHO_T}$ac_cv_sizeof_char" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_CHAR $ac_cv_sizeof_char +#define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF -echo "$as_me:$LINENO: checking for short" >&5 -echo $ECHO_N "checking for short... $ECHO_C" >&6 -if test "${ac_cv_type_short+set}" = set; then +echo "$as_me:$LINENO: checking for void *" >&5 +echo $ECHO_N "checking for void *... $ECHO_C" >&6 +if test "${ac_cv_type_void_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -30996,9 +28612,9 @@ int main () { -if ((short *) 0) +if ((void * *) 0) return 0; -if (sizeof (short)) +if (sizeof (void *)) return 0; ; return 0; @@ -31026,24 +28642,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_short=yes + ac_cv_type_void_p=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_short=no +ac_cv_type_void_p=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 -echo "${ECHO_T}$ac_cv_type_short" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 +echo "${ECHO_T}$ac_cv_type_void_p" >&6 -echo "$as_me:$LINENO: checking size of short" >&5 -echo $ECHO_N "checking size of short... $ECHO_C" >&6 -if test "${ac_cv_sizeof_short+set}" = set; then +echo "$as_me:$LINENO: checking size of void *" >&5 +echo $ECHO_N "checking size of void *... $ECHO_C" >&6 +if test "${ac_cv_sizeof_void_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_short" = yes; then + if test "$ac_cv_type_void_p" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -31060,7 +28676,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)]; test_array [0] = 0 ; @@ -31101,7 +28717,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; test_array [0] = 0 ; @@ -31158,7 +28774,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)]; test_array [0] = 0 ; @@ -31199,7 +28815,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)]; test_array [0] = 0 ; @@ -31264,7 +28880,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; test_array [0] = 0 ; @@ -31303,10 +28919,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_short=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 +?*) ac_cv_sizeof_void_p=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (short), 77 +echo "$as_me: error: cannot compute sizeof (void *), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -31325,8 +28941,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (short)); } -unsigned long ulongval () { return (long) (sizeof (short)); } +long longval () { return (long) (sizeof (void *)); } +unsigned long ulongval () { return (long) (sizeof (void *)); } #include #include int @@ -31336,17 +28952,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (short))) < 0) + if (((long) (sizeof (void *))) < 0) { long i = longval (); - if (i != ((long) (sizeof (short)))) + if (i != ((long) (sizeof (void *)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (short)))) + if (i != ((long) (sizeof (void *)))) exit (1); fprintf (f, "%lu\n", i); } @@ -31367,16 +28983,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_short=`cat conftest.val` + ac_cv_sizeof_void_p=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (short), 77 +echo "$as_me: error: cannot compute sizeof (void *), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -31385,19 +29001,19 @@ fi rm -f conftest.val else - ac_cv_sizeof_short=0 + ac_cv_sizeof_void_p=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 -echo "${ECHO_T}$ac_cv_sizeof_short" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_SHORT $ac_cv_sizeof_short +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p _ACEOF -echo "$as_me:$LINENO: checking for int" >&5 -echo $ECHO_N "checking for int... $ECHO_C" >&6 -if test "${ac_cv_type_int+set}" = set; then +echo "$as_me:$LINENO: checking for long long" >&5 +echo $ECHO_N "checking for long long... $ECHO_C" >&6 +if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -31410,9 +29026,9 @@ int main () { -if ((int *) 0) +if ((long long *) 0) return 0; -if (sizeof (int)) +if (sizeof (long long)) return 0; ; return 0; @@ -31440,24 +29056,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_int=yes + ac_cv_type_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_int=no +ac_cv_type_long_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 -echo "${ECHO_T}$ac_cv_type_int" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_long_long" >&6 -echo "$as_me:$LINENO: checking size of int" >&5 -echo $ECHO_N "checking size of int... $ECHO_C" >&6 -if test "${ac_cv_sizeof_int+set}" = set; then +echo "$as_me:$LINENO: checking size of long long" >&5 +echo $ECHO_N "checking size of long long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_int" = yes; then + if test "$ac_cv_type_long_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -31474,7 +29090,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; test_array [0] = 0 ; @@ -31515,7 +29131,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; @@ -31572,7 +29188,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; test_array [0] = 0 ; @@ -31613,7 +29229,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; test_array [0] = 0 ; @@ -31678,7 +29294,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; @@ -31717,10 +29333,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_int=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +?*) ac_cv_sizeof_long_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (int), 77 +echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -31739,8 +29355,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (int)); } -unsigned long ulongval () { return (long) (sizeof (int)); } +long longval () { return (long) (sizeof (long long)); } +unsigned long ulongval () { return (long) (sizeof (long long)); } #include #include int @@ -31750,17 +29366,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (int))) < 0) + if (((long) (sizeof (long long))) < 0) { long i = longval (); - if (i != ((long) (sizeof (int)))) + if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (int)))) + if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%lu\n", i); } @@ -31781,16 +29397,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_int=`cat conftest.val` + ac_cv_sizeof_long_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (int), 77 +echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -31799,19 +29415,19 @@ fi rm -f conftest.val else - ac_cv_sizeof_int=0 + ac_cv_sizeof_long_long=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 -echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT $ac_cv_sizeof_int +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF -echo "$as_me:$LINENO: checking for long" >&5 -echo $ECHO_N "checking for long... $ECHO_C" >&6 -if test "${ac_cv_type_long+set}" = set; then +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -31824,9 +29440,9 @@ int main () { -if ((long *) 0) +if ((size_t *) 0) return 0; -if (sizeof (long)) +if (sizeof (size_t)) return 0; ; return 0; @@ -31854,24 +29470,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_long=yes + ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_long=no +ac_cv_type_size_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 -echo "${ECHO_T}$ac_cv_type_long" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 -echo "$as_me:$LINENO: checking size of long" >&5 -echo $ECHO_N "checking size of long... $ECHO_C" >&6 -if test "${ac_cv_sizeof_long+set}" = set; then +echo "$as_me:$LINENO: checking size of size_t" >&5 +echo $ECHO_N "checking size of size_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_long" = yes; then + if test "$ac_cv_type_size_t" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -31888,7 +29504,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) >= 0)]; test_array [0] = 0 ; @@ -31929,7 +29545,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -31986,7 +29602,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) < 0)]; test_array [0] = 0 ; @@ -32027,7 +29643,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) >= $ac_mid)]; test_array [0] = 0 ; @@ -32092,7 +29708,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -32131,10 +29747,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_long=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +?*) ac_cv_sizeof_size_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long), 77 +echo "$as_me: error: cannot compute sizeof (size_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -32153,8 +29769,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (long)); } -unsigned long ulongval () { return (long) (sizeof (long)); } +long longval () { return (long) (sizeof (size_t)); } +unsigned long ulongval () { return (long) (sizeof (size_t)); } #include #include int @@ -32164,17 +29780,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (long))) < 0) + if (((long) (sizeof (size_t))) < 0) { long i = longval (); - if (i != ((long) (sizeof (long)))) + if (i != ((long) (sizeof (size_t)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (long)))) + if (i != ((long) (sizeof (size_t)))) exit (1); fprintf (f, "%lu\n", i); } @@ -32195,16 +29811,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_long=`cat conftest.val` + ac_cv_sizeof_size_t=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long), 77 +echo "$as_me: error: cannot compute sizeof (size_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -32213,19 +29829,19 @@ fi rm -f conftest.val else - ac_cv_sizeof_long=0 + ac_cv_sizeof_size_t=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 -echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_size_t" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG $ac_cv_sizeof_long +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t _ACEOF -echo "$as_me:$LINENO: checking for void *" >&5 -echo $ECHO_N "checking for void *... $ECHO_C" >&6 -if test "${ac_cv_type_void_p+set}" = set; then +echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -32238,9 +29854,9 @@ int main () { -if ((void * *) 0) +if ((off_t *) 0) return 0; -if (sizeof (void *)) +if (sizeof (off_t)) return 0; ; return 0; @@ -32268,24 +29884,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_void_p=yes + ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_void_p=no +ac_cv_type_off_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 -echo "${ECHO_T}$ac_cv_type_void_p" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 -echo "$as_me:$LINENO: checking size of void *" >&5 -echo $ECHO_N "checking size of void *... $ECHO_C" >&6 -if test "${ac_cv_sizeof_void_p+set}" = set; then +echo "$as_me:$LINENO: checking size of off_t" >&5 +echo $ECHO_N "checking size of off_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_void_p" = yes; then + if test "$ac_cv_type_off_t" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -32302,7 +29918,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= 0)]; test_array [0] = 0 ; @@ -32343,7 +29959,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -32400,7 +30016,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) < 0)]; test_array [0] = 0 ; @@ -32441,7 +30057,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= $ac_mid)]; test_array [0] = 0 ; @@ -32506,7 +30122,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -32545,10 +30161,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_void_p=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 +?*) ac_cv_sizeof_off_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (void *), 77 +echo "$as_me: error: cannot compute sizeof (off_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -32567,8 +30183,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (void *)); } -unsigned long ulongval () { return (long) (sizeof (void *)); } +long longval () { return (long) (sizeof (off_t)); } +unsigned long ulongval () { return (long) (sizeof (off_t)); } #include #include int @@ -32578,17 +30194,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (void *))) < 0) + if (((long) (sizeof (off_t))) < 0) { long i = longval (); - if (i != ((long) (sizeof (void *)))) + if (i != ((long) (sizeof (off_t)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (void *)))) + if (i != ((long) (sizeof (off_t)))) exit (1); fprintf (f, "%lu\n", i); } @@ -32609,16 +30225,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_void_p=`cat conftest.val` + ac_cv_sizeof_off_t=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (void *), 77 +echo "$as_me: error: cannot compute sizeof (off_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -32627,19 +30243,19 @@ fi rm -f conftest.val else - ac_cv_sizeof_void_p=0 + ac_cv_sizeof_off_t=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 -echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_VOID_P $ac_cv_sizeof_void_p +#define SIZEOF_OFF_T $ac_cv_sizeof_off_t _ACEOF -echo "$as_me:$LINENO: checking for long long" >&5 -echo $ECHO_N "checking for long long... $ECHO_C" >&6 -if test "${ac_cv_type_long_long+set}" = set; then +echo "$as_me:$LINENO: checking for time_t" >&5 +echo $ECHO_N "checking for time_t... $ECHO_C" >&6 +if test "${ac_cv_type_time_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -32652,9 +30268,9 @@ int main () { -if ((long long *) 0) +if ((time_t *) 0) return 0; -if (sizeof (long long)) +if (sizeof (time_t)) return 0; ; return 0; @@ -32682,24 +30298,24 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_long_long=yes + ac_cv_type_time_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_long_long=no +ac_cv_type_time_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 -echo "${ECHO_T}$ac_cv_type_long_long" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_time_t" >&5 +echo "${ECHO_T}$ac_cv_type_time_t" >&6 -echo "$as_me:$LINENO: checking size of long long" >&5 -echo $ECHO_N "checking size of long long... $ECHO_C" >&6 -if test "${ac_cv_sizeof_long_long+set}" = set; then +echo "$as_me:$LINENO: checking size of time_t" >&5 +echo $ECHO_N "checking size of time_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof_time_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_long_long" = yes; then + if test "$ac_cv_type_time_t" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -32716,7 +30332,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (time_t))) >= 0)]; test_array [0] = 0 ; @@ -32757,7 +30373,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (time_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -32814,7 +30430,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (time_t))) < 0)]; test_array [0] = 0 ; @@ -32855,7 +30471,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (time_t))) >= $ac_mid)]; test_array [0] = 0 ; @@ -32920,7 +30536,7 @@ int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (time_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -32959,10 +30575,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_long_long=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 +?*) ac_cv_sizeof_time_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (time_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long long), 77 +echo "$as_me: error: cannot compute sizeof (time_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -32981,8 +30597,8 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (long long)); } -unsigned long ulongval () { return (long) (sizeof (long long)); } +long longval () { return (long) (sizeof (time_t)); } +unsigned long ulongval () { return (long) (sizeof (time_t)); } #include #include int @@ -32992,17 +30608,17 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (long long))) < 0) + if (((long) (sizeof (time_t))) < 0) { long i = longval (); - if (i != ((long) (sizeof (long long)))) + if (i != ((long) (sizeof (time_t)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (long long)))) + if (i != ((long) (sizeof (time_t)))) exit (1); fprintf (f, "%lu\n", i); } @@ -33023,16 +30639,16 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_long_long=`cat conftest.val` + ac_cv_sizeof_time_t=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (time_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long long), 77 +echo "$as_me: error: cannot compute sizeof (time_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -33041,4451 +30657,43 @@ fi rm -f conftest.val else - ac_cv_sizeof_long_long=0 + ac_cv_sizeof_time_t=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 -echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_time_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_time_t" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long -_ACEOF - - -echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6 -if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((size_t *) 0) - return 0; -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_size_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_size_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6 - -echo "$as_me:$LINENO: checking size of size_t" >&5 -echo $ECHO_N "checking size of size_t... $ECHO_C" >&6 -if test "${ac_cv_sizeof_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$ac_cv_type_size_t" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (size_t))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (size_t))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (size_t))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (size_t))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo= ac_hi= -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (size_t))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo=`expr '(' $ac_mid ')' + 1` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_size_t=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (size_t), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (size_t)); } -unsigned long ulongval () { return (long) (sizeof (size_t)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (size_t))) < 0) - { - long i = longval (); - if (i != ((long) (sizeof (size_t)))) - exit (1); - fprintf (f, "%ld\n", i); - } - else - { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (size_t)))) - exit (1); - fprintf (f, "%lu\n", i); - } - exit (ferror (f) || fclose (f) != 0); - - ; - return 0; -} +#define SIZEOF_TIME_T $ac_cv_sizeof_time_t _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_size_t=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (size_t), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -rm -f conftest.val -else - ac_cv_sizeof_size_t=0 -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 -echo "${ECHO_T}$ac_cv_sizeof_size_t" >&6 -cat >>confdefs.h <<_ACEOF -#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t -_ACEOF -echo "$as_me:$LINENO: checking for off_t" >&5 -echo $ECHO_N "checking for off_t... $ECHO_C" >&6 -if test "${ac_cv_type_off_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((off_t *) 0) - return 0; -if (sizeof (off_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_off_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +BITS64= -ac_cv_type_off_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +if test $ac_cv_sizeof_void_p = 8; then + BITS64=yes fi -echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 -echo "${ECHO_T}$ac_cv_type_off_t" >&6 -echo "$as_me:$LINENO: checking size of off_t" >&5 -echo $ECHO_N "checking size of off_t... $ECHO_C" >&6 -if test "${ac_cv_sizeof_off_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$ac_cv_type_off_t" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= 0)]; -test_array [0] = 0 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (off_t))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo= ac_hi= -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo=`expr '(' $ac_mid ')' + 1` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_off_t=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (off_t), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (off_t)); } -unsigned long ulongval () { return (long) (sizeof (off_t)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (off_t))) < 0) - { - long i = longval (); - if (i != ((long) (sizeof (off_t)))) - exit (1); - fprintf (f, "%ld\n", i); - } - else - { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (off_t)))) - exit (1); - fprintf (f, "%lu\n", i); - } - exit (ferror (f) || fclose (f) != 0); - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_off_t=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (off_t), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -rm -f conftest.val -else - ac_cv_sizeof_off_t=0 -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5 -echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6 -cat >>confdefs.h <<_ACEOF -#define SIZEOF_OFF_T $ac_cv_sizeof_off_t -_ACEOF - - -echo "$as_me:$LINENO: checking for time_t" >&5 -echo $ECHO_N "checking for time_t... $ECHO_C" >&6 -if test "${ac_cv_type_time_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((time_t *) 0) - return 0; -if (sizeof (time_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_time_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_time_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_time_t" >&5 -echo "${ECHO_T}$ac_cv_type_time_t" >&6 - -echo "$as_me:$LINENO: checking size of time_t" >&5 -echo $ECHO_N "checking size of time_t... $ECHO_C" >&6 -if test "${ac_cv_sizeof_time_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$ac_cv_type_time_t" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (time_t))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (time_t))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (time_t))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (time_t))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo= ac_hi= -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (time_t))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo=`expr '(' $ac_mid ')' + 1` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_time_t=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (time_t), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (time_t), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (time_t)); } -unsigned long ulongval () { return (long) (sizeof (time_t)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (time_t))) < 0) - { - long i = longval (); - if (i != ((long) (sizeof (time_t)))) - exit (1); - fprintf (f, "%ld\n", i); - } - else - { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (time_t)))) - exit (1); - fprintf (f, "%lu\n", i); - } - exit (ferror (f) || fclose (f) != 0); - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_time_t=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (time_t), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (time_t), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -rm -f conftest.val -else - ac_cv_sizeof_time_t=0 -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_time_t" >&5 -echo "${ECHO_T}$ac_cv_sizeof_time_t" >&6 -cat >>confdefs.h <<_ACEOF -#define SIZEOF_TIME_T $ac_cv_sizeof_time_t -_ACEOF - - - -BITS64= - -if test $ac_cv_sizeof_void_p = 8; then - BITS64=yes -fi - - -if test "x$ac_compiler_gnu" = "xyes"; then -echo "$as_me:$LINENO: checking if we should add -fno-tree-copyrename to CFLAGS for computed gotos to work properly" >&5 -echo $ECHO_N "checking if we should add -fno-tree-copyrename to CFLAGS for computed gotos to work properly... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - ; - #else - #error old and ok - #endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - no_tree_copyrename=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -no_tree_copyrename=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -if test "x$no_tree_copyrename" = "xyes"; then - CFLAGS="$CFLAGS -fno-tree-copyrename" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - -echo "$as_me:$LINENO: checking for broken gcc-4.3.0 compiler" >&5 -echo $ECHO_N "checking for broken gcc-4.3.0 compiler... $ECHO_C" >&6 -if test "$cross_compiling" = yes; then - gcc_4_3_0_bug=cross -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* pr36339.c */ -extern void abort (void); - -typedef unsigned long my_uintptr_t; - -int check_a(my_uintptr_t tagged_ptr); - -int __attribute__((noinline)) try_a(my_uintptr_t x) -{ - my_uintptr_t heap[2]; - my_uintptr_t *hp = heap; - - hp[0] = x; - hp[1] = 0; - return check_a((my_uintptr_t)(void*)((char*)hp + 1)); -} - -int __attribute__((noinline)) check_a(my_uintptr_t tagged_ptr) -{ - my_uintptr_t *hp = (my_uintptr_t*)(void*)((char*)tagged_ptr - 1); - - if (hp[0] == 42 && hp[1] == 0) - return 0; - return -1; -} - -int main(void) -{ - if (try_a(42) < 0) - abort (); - return 0; -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gcc_4_3_0_bug=no -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -gcc_4_3_0_bug=yes -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -case $gcc_4_3_0_bug in - yes|no) - gcc_4_3_0_bug_result=$gcc_4_3_0_bug;; - cross) - gcc_dumped_vsn=`$CC -dumpversion 2>/dev/null` - case gcc-$gcc_dumped_vsn in - gcc-4.3.0) gcc_4_3_0_bug=yes;; - *) gcc_4_3_0_bug=no;; - esac - gcc_4_3_0_bug_result="$gcc_4_3_0_bug; could not run test since cross compiling, checked version number ($gcc_dumped_vsn) instead";; -esac - -echo "$as_me:$LINENO: result: $gcc_4_3_0_bug_result" >&5 -echo "${ECHO_T}$gcc_4_3_0_bug_result" >&6 -if test $gcc_4_3_0_bug = yes; then - { { echo "$as_me:$LINENO: error: This gcc miscompiles the Erlang runtime system; please use a different version" >&5 -echo "$as_me: error: This gcc miscompiles the Erlang runtime system; please use a different version" >&2;} - { (exit 1); exit 1; }; } -fi - -fi - -case X$erl_xcomp_bigendian in - X) ;; - Xyes|Xno) ac_cv_c_bigendian=$erl_xcomp_bigendian;; - *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian" >&5 -echo "$as_me: error: Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian" >&2;} - { (exit 1); exit 1; }; };; -esac - -echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 -if test "${ac_cv_c_bigendian+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # See if sys/param.h defines the BYTE_ORDER macro. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - # It does; now see whether it defined to BIG_ENDIAN or not. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_bigendian=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c_bigendian=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -# It does not; compile a test program. -if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file - ac_cv_c_bigendian=unknown - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; -void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } -int -main () -{ - _ascii (); _ebcdic (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; 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 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -int -main () -{ - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long l; - char c[sizeof (long)]; - } u; - u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_bigendian=no -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_c_bigendian=yes -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -echo "${ECHO_T}$ac_cv_c_bigendian" >&6 -case $ac_cv_c_bigendian in - yes) - -cat >>confdefs.h <<\_ACEOF -#define WORDS_BIGENDIAN 1 -_ACEOF - ;; - no) - ;; - *) - { { echo "$as_me:$LINENO: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -echo "$as_me: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} - { (exit 1); exit 1; }; } ;; -esac - -echo "$as_me:$LINENO: checking whether double word ordering is middle-endian" >&5 -echo $ECHO_N "checking whether double word ordering is middle-endian... $ECHO_C" >&6 -if test "${ac_cv_c_double_middle_endian+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # It does not; compile a test program. -if test "$cross_compiling" = yes; then - ac_cv_c_double_middle=unknown -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -int -main(void) -{ - int i = 0; - int zero = 0; - int bigendian; - int zero_index = 0; - - union - { - long int l; - char c[sizeof (long int)]; - } u; - - /* we'll use the one with 32-bit words */ - union - { - double d; - unsigned int c[2]; - } vint; - - union - { - double d; - unsigned long c[2]; - } vlong; - - union - { - double d; - unsigned short c[2]; - } vshort; - - - /* Are we little or big endian? From Harbison&Steele. */ - u.l = 1; - bigendian = (u.c[sizeof (long int) - 1] == 1); - - zero_index = bigendian ? 1 : 0; - - vint.d = 1.0; - vlong.d = 1.0; - vshort.d = 1.0; - - if (sizeof(unsigned int) == 4) - { - if (vint.c[zero_index] != 0) - zero = 1; - } - else if (sizeof(unsigned long) == 4) - { - if (vlong.c[zero_index] != 0) - zero = 1; - } - else if (sizeof(unsigned short) == 4) - { - if (vshort.c[zero_index] != 0) - zero = 1; - } - - exit (zero); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_double_middle_endian=no -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_c_double_middle_endian=yes -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_c_double_middle_endian" >&5 -echo "${ECHO_T}$ac_cv_c_double_middle_endian" >&6 -case $ac_cv_c_double_middle_endian in - yes) - -cat >>confdefs.h <<\_ACEOF -#define DOUBLE_MIDDLE_ENDIAN 1 -_ACEOF - ;; - no) - ;; - *) - { echo "$as_me:$LINENO: WARNING: unknown double endianness -presetting ac_cv_c_double_middle_endian=no (or yes) will help" >&5 -echo "$as_me: WARNING: unknown double endianness -presetting ac_cv_c_double_middle_endian=no (or yes) will help" >&2;} ;; -esac - - - -for ac_func in fdatasync -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -echo "$as_me:$LINENO: checking for library containing fdatasync" >&5 -echo $ECHO_N "checking for library containing fdatasync... $ECHO_C" >&6 -if test "${ac_cv_search_fdatasync+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_fdatasync=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char fdatasync (); -int -main () -{ -fdatasync (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_fdatasync="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_fdatasync" = no; then - for ac_lib in rt; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char fdatasync (); -int -main () -{ -fdatasync (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_fdatasync="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_fdatasync" >&5 -echo "${ECHO_T}$ac_cv_search_fdatasync" >&6 -if test "$ac_cv_search_fdatasync" != no; then - test "$ac_cv_search_fdatasync" = "none required" || LIBS="$ac_cv_search_fdatasync $LIBS" - -fi - - - -case $host_os in - linux*|freebsd*|dragonfly*|darwin*) - -for ac_func in sendfile -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - ;; - solaris*) - echo "$as_me:$LINENO: checking for library containing sendfilev" >&5 -echo $ECHO_N "checking for library containing sendfilev... $ECHO_C" >&6 -if test "${ac_cv_search_sendfilev+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_sendfilev=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sendfilev (); -int -main () -{ -sendfilev (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_sendfilev="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_sendfilev" = no; then - for ac_lib in sendfile; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sendfilev (); -int -main () -{ -sendfilev (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_sendfilev="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_sendfilev" >&5 -echo "${ECHO_T}$ac_cv_search_sendfilev" >&6 -if test "$ac_cv_search_sendfilev" != no; then - test "$ac_cv_search_sendfilev" = "none required" || LIBS="$ac_cv_search_sendfilev $LIBS" - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SENDFILEV 1 -_ACEOF - -fi - - ;; - win32) - LIBS="$LIBS -lmswsock" - ;; - *) - ;; -esac - - -saved_cppflags=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $EMU_THR_DEFS" -saved_libs=$LIBS -LIBS="$LIBS $EMU_THR_X_LIBS" - - -for ac_header in windows.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in winsock2.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in ws2tcpip.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#ifdef HAVE_WINSOCK2_H -#include -#endif -#ifdef HAVE_WINDOWS_H -#include -#endif - - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -echo "$as_me:$LINENO: checking for getaddrinfo" >&5 -echo $ECHO_N "checking for getaddrinfo... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include -#ifdef HAVE_WINSOCK2_H -#include -#endif -#ifdef HAVE_WINDOWS_H -#include -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#ifndef __WIN32__ -#include -#include -#endif - -int -main () -{ - -getaddrinfo("","",NULL,NULL); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - have_getaddrinfo=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -have_getaddrinfo=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test $have_getaddrinfo = yes; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - echo "$as_me:$LINENO: checking whether getaddrinfo accepts enough flags" >&5 -echo $ECHO_N "checking whether getaddrinfo accepts enough flags... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include -#ifdef HAVE_WINSOCK2_H -#include -#endif -#ifdef HAVE_WINDOWS_H -#include -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#ifndef __WIN32__ -#include -#include -#endif - -int -main () -{ - - struct addrinfo hints, *ai; - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = AI_CANONNAME; - hints.ai_socktype = SOCK_STREAM; - hints.ai_family = AF_INET6; - if (getaddrinfo("::", NULL, &hints, &ai) == 0) { - freeaddrinfo(ai); - exit(0); - } else { - exit(1); - } - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -have_getaddrinfo=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - echo "$as_me:$LINENO: result: $have_getaddrinfo" >&5 -echo "${ECHO_T}$have_getaddrinfo" >&6 - case $have_getaddrinfo in - yes) - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETADDRINFO 1 -_ACEOF -;; - *) ;; - esac -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -echo "$as_me:$LINENO: checking for getnameinfo" >&5 -echo $ECHO_N "checking for getnameinfo... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include -#ifdef HAVE_WINSOCK2_H -#include -#endif -#ifdef HAVE_WINDOWS_H -#include -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#ifndef __WIN32__ -#include -#include -#endif - -int -main () -{ - -getnameinfo(NULL,0,NULL,0,NULL,0,0); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - have_getnameinfo=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -have_getnameinfo=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test $have_getnameinfo = yes; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETNAMEINFO 1 -_ACEOF - -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - - - -for ac_func in getipnodebyname getipnodebyaddr gethostbyname2 -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -for ac_func in ieee_handler fpsetmask finite isnan isinf res_gethostbyname dlopen \ - pread pwrite memmove strerror strerror_r strncasecmp \ - gethrtime localtime_r gmtime_r inet_pton \ - memcpy mallopt sbrk _sbrk __sbrk brk _brk __brk \ - flockfile fstat strlcpy strlcat setsid posix2time time2posix \ - setlocale nl_langinfo poll mlockall ppoll -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -echo "$as_me:$LINENO: checking for isfinite" >&5 -echo $ECHO_N "checking for isfinite... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -isfinite(0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - have_isfinite=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -have_isfinite=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext, - -if test $have_isfinite = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ISFINITE 1 -_ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -case X$erl_xcomp_posix_memalign in - Xno) ;; - Xyes) -cat >>confdefs.h <<\_ACEOF -#define HAVE_POSIX_MEMALIGN 1 -_ACEOF - ;; - *) - echo "$as_me:$LINENO: checking for posix_memalign" >&5 -echo $ECHO_N "checking for posix_memalign... $ECHO_C" >&6 -if test "${ac_cv_func_posix_memalign+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define posix_memalign to an innocuous variant, in case declares posix_memalign. - For example, HP-UX 11i declares gettimeofday. */ -#define posix_memalign innocuous_posix_memalign - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char posix_memalign (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef posix_memalign - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char posix_memalign (); -/* 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_posix_memalign) || defined (__stub___posix_memalign) -choke me -#else -char (*f) () = posix_memalign; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != posix_memalign; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_posix_memalign=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_posix_memalign=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_posix_memalign" >&5 -echo "${ECHO_T}$ac_cv_func_posix_memalign" >&6 -if test $ac_cv_func_posix_memalign = yes; then - if test "$cross_compiling" != yes; then -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -int main(void) { - void *ptr = NULL; - int error; - size_t alignment = 0x40000, size = 0x20028; - if ((error = posix_memalign(&ptr, alignment, size)) != 0 || ptr == NULL) - return error; - return 0; -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_POSIX_MEMALIGN 1 -_ACEOF - - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_POSIX_MEMALIGN 1 -_ACEOF - - fi -fi -;; -esac - -case $host_os in - darwin10.8.0) - echo "$as_me:$LINENO: checking for writev" >&5 -echo $ECHO_N "checking for writev... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 ;; - *) - -for ac_func in writev -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - ;; -esac - -case $host_os in - *ose) - echo "$as_me:$LINENO: checking for mmap" >&5 -echo $ECHO_N "checking for mmap... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: not using for OSE" >&5 -echo "${ECHO_T}not using for OSE" >&6 - echo "$as_me:$LINENO: checking for mremap" >&5 -echo $ECHO_N "checking for mremap... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: not using for OSE" >&5 -echo "${ECHO_T}not using for OSE" >&6 ;; - *) - - -for ac_func in mmap mremap -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - ;; -esac - - -echo "$as_me:$LINENO: checking whether posix2time is declared" >&5 -echo $ECHO_N "checking whether posix2time is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_posix2time+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -int -main () -{ -#ifndef posix2time - char *p = (char *) posix2time; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_posix2time=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_posix2time=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_posix2time" >&5 -echo "${ECHO_T}$ac_cv_have_decl_posix2time" >&6 -if test $ac_cv_have_decl_posix2time = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_POSIX2TIME 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_POSIX2TIME 0 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking whether time2posix is declared" >&5 -echo $ECHO_N "checking whether time2posix is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_time2posix+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -int -main () -{ -#ifndef time2posix - char *p = (char *) time2posix; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_time2posix=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_time2posix=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_time2posix" >&5 -echo "${ECHO_T}$ac_cv_have_decl_time2posix" >&6 -if test $ac_cv_have_decl_time2posix = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_TIME2POSIX 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_TIME2POSIX 0 -_ACEOF - - -fi - - - -disable_vfork=false -if test "x$EMU_THR_LIB_NAME" != "x"; then - echo "$as_me:$LINENO: checking if vfork is known to hang multithreaded applications" >&5 -echo $ECHO_N "checking if vfork is known to hang multithreaded applications... $ECHO_C" >&6 - case $host_os in - osf*) - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - disable_vfork=true;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6;; - esac -fi - -if test $disable_vfork = false; then - - -for ac_header in unistd.h vfork.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -for ac_func in fork vfork -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -if test "x$ac_cv_func_fork" = xyes; then - echo "$as_me:$LINENO: checking for working fork" >&5 -echo $ECHO_N "checking for working fork... $ECHO_C" >&6 -if test "${ac_cv_func_fork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_fork_works=cross -else - cat >conftest.$ac_ext <<_ACEOF -/* By Ruediger Kuhlmann. */ - #include - #if HAVE_UNISTD_H - # include - #endif - /* Some systems only have a dummy stub for fork() */ - int main () - { - if (fork() < 0) - exit (1); - exit (0); - } -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_fork_works=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_fork_works=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 -echo "${ECHO_T}$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 - { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 -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 - echo "$as_me:$LINENO: checking for working vfork" >&5 -echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 -if test "${ac_cv_func_vfork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_vfork_works=cross -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Thanks to Paul Eggert for this test. */ -#include -#include -#include -#include -#include -#if HAVE_UNISTD_H -# include -#endif -#if HAVE_VFORK_H -# include -#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 , but some compilers - (e.g. gcc -O) don't grok . 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) - ; - exit( - /* 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 -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_vfork_works=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_vfork_works=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 -echo "${ECHO_T}$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 - { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 -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 - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WORKING_VFORK 1 -_ACEOF - -else - -cat >>confdefs.h <<\_ACEOF -#define vfork fork -_ACEOF - -fi -if test "x$ac_cv_func_fork_works" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WORKING_FORK 1 -_ACEOF - -fi - - if test $ac_cv_func_vfork_works = no; then - disable_vfork=true - fi -fi - -if test $disable_vfork = true; then - -cat >>confdefs.h <<\_ACEOF -#define DISABLE_VFORK 1 -_ACEOF - -fi - - -for ac_func in vprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -echo "$as_me:$LINENO: checking for _doprnt" >&5 -echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 -if test "${ac_cv_func__doprnt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define _doprnt to an innocuous variant, in case declares _doprnt. - For example, HP-UX 11i declares gettimeofday. */ -#define _doprnt innocuous__doprnt - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef _doprnt - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char _doprnt (); -/* 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__doprnt) || defined (__stub____doprnt) -choke me -#else -char (*f) () = _doprnt; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != _doprnt; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func__doprnt=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func__doprnt=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 -echo "${ECHO_T}$ac_cv_func__doprnt" >&6 -if test $ac_cv_func__doprnt = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DOPRNT 1 -_ACEOF - -fi - -fi -done - - - -echo "$as_me:$LINENO: checking for conflicting declaration of fread" >&5 -echo $ECHO_N "checking for conflicting declaration of fread... $ECHO_C" >&6 -if test "${ac_cv_func_decl_fread+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +if test "x$ac_compiler_gnu" = "xyes"; then +echo "$as_me:$LINENO: checking if we should add -fno-tree-copyrename to CFLAGS for computed gotos to work properly" >&5 +echo $ECHO_N "checking if we should add -fno-tree-copyrename to CFLAGS for computed gotos to work properly... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include int main () { -extern int fread(); -char *c = (char *)fread; + + #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) + ; + #else + #error old and ok + #endif ; return 0; @@ -37513,34 +30721,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "ac_cv_func_decl_fread=no" + no_tree_copyrename=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "ac_cv_func_decl_fread=yes" +no_tree_copyrename=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -if eval "test \"`echo '$ac_cv_func_decl_'fread`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 +if test "x$no_tree_copyrename" = "xyes"; then + CFLAGS="$CFLAGS -fno-tree-copyrename" + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\_ACEOF -#define HAVE_CONFLICTING_FREAD_DECLARATION 1 -_ACEOF - else - echo "$as_me:$LINENO: result: no" >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -echo "$as_me:$LINENO: checking for putc_unlocked" >&5 -echo $ECHO_N "checking for putc_unlocked... $ECHO_C" >&6 -if test "${erts_cv_putc_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + +echo "$as_me:$LINENO: checking for broken gcc-4.3.0 compiler" >&5 +echo $ECHO_N "checking for broken gcc-4.3.0 compiler... $ECHO_C" >&6 +if test "$cross_compiling" = yes; then + gcc_4_3_0_bug=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -37548,80 +30752,123 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () + +/* pr36339.c */ +extern void abort (void); + +typedef unsigned long my_uintptr_t; + +int check_a(my_uintptr_t tagged_ptr); + +int __attribute__((noinline)) try_a(my_uintptr_t x) { -int res = putc_unlocked('x',stdout); - ; + my_uintptr_t heap[2]; + my_uintptr_t *hp = heap; + + hp[0] = x; + hp[1] = 0; + return check_a((my_uintptr_t)(void*)((char*)hp + 1)); +} + +int __attribute__((noinline)) check_a(my_uintptr_t tagged_ptr) +{ + my_uintptr_t *hp = (my_uintptr_t*)(void*)((char*)tagged_ptr - 1); + + if (hp[0] == 42 && hp[1] == 0) + return 0; + return -1; +} + +int main(void) +{ + if (try_a(42) < 0) + abort (); return 0; } + _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erts_cv_putc_unlocked=yes + gcc_4_3_0_bug=no else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erts_cv_putc_unlocked=no +( exit $ac_status ) +gcc_4_3_0_bug=yes fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $erts_cv_putc_unlocked" >&5 -echo "${ECHO_T}$erts_cv_putc_unlocked" >&6 -if test $erts_cv_putc_unlocked = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_PUTC_UNLOCKED 1 -_ACEOF +case $gcc_4_3_0_bug in + yes|no) + gcc_4_3_0_bug_result=$gcc_4_3_0_bug;; + cross) + gcc_dumped_vsn=`$CC -dumpversion 2>/dev/null` + case gcc-$gcc_dumped_vsn in + gcc-4.3.0) gcc_4_3_0_bug=yes;; + *) gcc_4_3_0_bug=no;; + esac + gcc_4_3_0_bug_result="$gcc_4_3_0_bug; could not run test since cross compiling, checked version number ($gcc_dumped_vsn) instead";; +esac +echo "$as_me:$LINENO: result: $gcc_4_3_0_bug_result" >&5 +echo "${ECHO_T}$gcc_4_3_0_bug_result" >&6 +if test $gcc_4_3_0_bug = yes; then + { { echo "$as_me:$LINENO: error: This gcc miscompiles the Erlang runtime system; please use a different version" >&5 +echo "$as_me: error: This gcc miscompiles the Erlang runtime system; please use a different version" >&2;} + { (exit 1); exit 1; }; } fi -echo "$as_me:$LINENO: checking for fwrite_unlocked" >&5 -echo $ECHO_N "checking for fwrite_unlocked... $ECHO_C" >&6 -if test "${erts_cv_fwrite_unlocked+set}" = set; then +fi + +case X$erl_xcomp_bigendian in + X) ;; + Xyes|Xno) ac_cv_c_bigendian=$erl_xcomp_bigendian;; + *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian" >&5 +echo "$as_me: error: Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian" >&2;} + { (exit 1); exit 1; }; };; +esac + +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include +#include + int main () { -size_t res = fwrite_unlocked(NULL,sizeof(char),0,stdout); +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -37635,95 +30882,36 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erts_cv_fwrite_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -erts_cv_fwrite_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $erts_cv_fwrite_unlocked" >&5 -echo "${ECHO_T}$erts_cv_fwrite_unlocked" >&6 -if test $erts_cv_fwrite_unlocked = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_FWRITE_UNLOCKED 1 -_ACEOF - -fi - - -for ac_func in openpty -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif +#include +#include int main () { -return f != $ac_func; +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -37737,59 +30925,47 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - - - -for ac_header in net/if_dl.h ifaddrs.h netpacket/packet.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +ac_cv_c_bigendian=no fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -37813,111 +30989,212 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + 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 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no +( exit $ac_status ) +ac_cv_c_bigendian=yes fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then + +echo "$as_me:$LINENO: checking whether double word ordering is middle-endian" >&5 +echo $ECHO_N "checking whether double word ordering is middle-endian... $ECHO_C" >&6 +if test "${ac_cv_c_double_middle_endian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + ac_cv_c_double_middle=unknown +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main(void) +{ + int i = 0; + int zero = 0; + int bigendian; + int zero_index = 0; + + union + { + long int l; + char c[sizeof (long int)]; + } u; + + /* we'll use the one with 32-bit words */ + union + { + double d; + unsigned int c[2]; + } vint; + + union + { + double d; + unsigned long c[2]; + } vlong; + + union + { + double d; + unsigned short c[2]; + } vshort; + + + /* Are we little or big endian? From Harbison&Steele. */ + u.l = 1; + bigendian = (u.c[sizeof (long int) - 1] == 1); + + zero_index = bigendian ? 1 : 0; + + vint.d = 1.0; + vlong.d = 1.0; + vshort.d = 1.0; + + if (sizeof(unsigned int) == 4) + { + if (vint.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned long) == 4) + { + if (vlong.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned short) == 4) + { + if (vshort.c[zero_index] != 0) + zero = 1; + } + + exit (zero); +} -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_double_middle_endian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_c_double_middle_endian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi fi +echo "$as_me:$LINENO: result: $ac_cv_c_double_middle_endian" >&5 +echo "${ECHO_T}$ac_cv_c_double_middle_endian" >&6 +case $ac_cv_c_double_middle_endian in + yes) -done +cat >>confdefs.h <<\_ACEOF +#define DOUBLE_MIDDLE_ENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { echo "$as_me:$LINENO: WARNING: unknown double endianness +presetting ac_cv_c_double_middle_endian=no (or yes) will help" >&5 +echo "$as_me: WARNING: unknown double endianness +presetting ac_cv_c_double_middle_endian=no (or yes) will help" >&2;} ;; +esac -for ac_func in getifaddrs + +for ac_func in fdatasync do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -38019,27 +31296,31 @@ done -echo "$as_me:$LINENO: checking whether in6addr_any is declared" >&5 -echo $ECHO_N "checking whether in6addr_any is declared... $ECHO_C" >&6 -if test "${erts_cv_have_in6addr_any+set}" = set; then +echo "$as_me:$LINENO: checking for library containing fdatasync" >&5 +echo $ECHO_N "checking for library containing fdatasync... $ECHO_C" >&6 +if test "${ac_cv_search_fdatasync+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_func_search_save_LIBS=$LIBS +ac_cv_search_fdatasync=no +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include - #include - #include - +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char fdatasync (); int main () { -printf("%d", in6addr_any.s6_addr[16]); - +fdatasync (); ; return 0; } @@ -38066,51 +31347,35 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erts_cv_have_in6addr_any=yes + ac_cv_search_fdatasync="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erts_cv_have_in6addr_any=no - fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $erts_cv_have_in6addr_any" >&5 -echo "${ECHO_T}$erts_cv_have_in6addr_any" >&6 - -case "$erts_cv_have_in6addr_any" in - yes) - -cat >>confdefs.h <<\_ACEOF -#define HAVE_IN6ADDR_ANY 1 -_ACEOF - -esac - -echo "$as_me:$LINENO: checking whether in6addr_loopback is declared" >&5 -echo $ECHO_N "checking whether in6addr_loopback is declared... $ECHO_C" >&6 -if test "${erts_cv_have_in6addr_loopback+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +if test "$ac_cv_search_fdatasync" = no; then + for ac_lib in rt; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include - #include - #include - +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char fdatasync (); int main () { -printf("%d", in6addr_loopback.s6_addr[16]); - +fdatasync (); ; return 0; } @@ -38137,33 +31402,37 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erts_cv_have_in6addr_loopback=yes + ac_cv_search_fdatasync="-l$ac_lib" +break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erts_cv_have_in6addr_loopback=no - fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_fdatasync" >&5 +echo "${ECHO_T}$ac_cv_search_fdatasync" >&6 +if test "$ac_cv_search_fdatasync" != no; then + test "$ac_cv_search_fdatasync" = "none required" || LIBS="$ac_cv_search_fdatasync $LIBS" fi -echo "$as_me:$LINENO: result: $erts_cv_have_in6addr_loopback" >&5 -echo "${ECHO_T}$erts_cv_have_in6addr_loopback" >&6 -case "$erts_cv_have_in6addr_loopback" in - yes) -cat >>confdefs.h <<\_ACEOF -#define HAVE_IN6ADDR_LOOPBACK 1 -_ACEOF -esac +case $host_os in + linux*|freebsd*|dragonfly*|darwin*) -echo "$as_me:$LINENO: checking whether IN6ADDR_ANY_INIT is declared" >&5 -echo $ECHO_N "checking whether IN6ADDR_ANY_INIT is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_IN6ADDR_ANY_INIT+set}" = set; then +for ac_func in sendfile +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -38172,101 +31441,54 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func - #include - #include - #include +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif -int -main () +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" { -#ifndef IN6ADDR_ANY_INIT - char *p = (char *) IN6ADDR_ANY_INIT; #endif - - ; - return 0; +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus } -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_IN6ADDR_ANY_INIT=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_IN6ADDR_ANY_INIT=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_IN6ADDR_ANY_INIT" >&5 -echo "${ECHO_T}$ac_cv_have_decl_IN6ADDR_ANY_INIT" >&6 -if test $ac_cv_have_decl_IN6ADDR_ANY_INIT = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_IN6ADDR_ANY_INIT 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_IN6ADDR_ANY_INIT 0 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking whether IN6ADDR_LOOPBACK_INIT is declared" >&5 -echo $ECHO_N "checking whether IN6ADDR_LOOPBACK_INIT is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - #include - #include - #include - +#endif int main () { -#ifndef IN6ADDR_LOOPBACK_INIT - char *p = (char *) IN6ADDR_LOOPBACK_INIT; -#endif - +return f != $ac_func; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -38280,68 +31502,66 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT=no +eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT" >&5 -echo "${ECHO_T}$ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT" >&6 -if test $ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_IN6ADDR_LOOPBACK_INIT 1 -_ACEOF - - -else +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_IN6ADDR_LOOPBACK_INIT 0 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF - fi -echo "$as_me:$LINENO: checking whether IPV6_V6ONLY is declared" >&5 -echo $ECHO_N "checking whether IPV6_V6ONLY is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_IPV6_V6ONLY+set}" = set; then +done + + ;; + solaris*) + echo "$as_me:$LINENO: checking for library containing sendfilev" >&5 +echo $ECHO_N "checking for library containing sendfilev... $ECHO_C" >&6 +if test "${ac_cv_search_sendfilev+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_func_search_save_LIBS=$LIBS +ac_cv_search_sendfilev=no +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include - #include - #include - - +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sendfilev (); int main () { -#ifndef IPV6_V6ONLY - char *p = (char *) IPV6_V6ONLY; -#endif - +sendfilev (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -38355,73 +31575,48 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_IPV6_V6ONLY=yes + ac_cv_search_sendfilev="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_IPV6_V6ONLY=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_IPV6_V6ONLY" >&5 -echo "${ECHO_T}$ac_cv_have_decl_IPV6_V6ONLY" >&6 -if test $ac_cv_have_decl_IPV6_V6ONLY = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_IPV6_V6ONLY 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_IPV6_V6ONLY 0 -_ACEOF - - fi - - - - -echo "$as_me:$LINENO: checking for sched_getaffinity/sched_setaffinity" >&5 -echo $ECHO_N "checking for sched_getaffinity/sched_setaffinity... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_sendfilev" = no; then + for ac_lib in sendfile; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sendfilev (); int main () { - -#ifndef CPU_SETSIZE -#error no CPU_SETSIZE -#endif - int res; - cpu_set_t cpuset; - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); - res = sched_setaffinity(0, sizeof(cpu_set_t), &cpuset); - res = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); - res = CPU_ISSET(1, &cpuset); - CPU_CLR(1, &cpuset); - +sendfilev (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -38435,118 +31630,74 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - sched_xetaffinity=yes + ac_cv_search_sendfilev="-l$ac_lib" +break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -sched_xetaffinity=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $sched_xetaffinity" >&5 -echo "${ECHO_T}$sched_xetaffinity" >&6 -if test $sched_xetaffinity = yes; then +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_sendfilev" >&5 +echo "${ECHO_T}$ac_cv_search_sendfilev" >&6 +if test "$ac_cv_search_sendfilev" != no; then + test "$ac_cv_search_sendfilev" = "none required" || LIBS="$ac_cv_search_sendfilev $LIBS" cat >>confdefs.h <<\_ACEOF -#define HAVE_SCHED_xETAFFINITY 1 +#define HAVE_SENDFILEV 1 _ACEOF fi + ;; + win32) + LIBS="$LIBS -lmswsock" + ;; + *) + ;; +esac -echo "$as_me:$LINENO: checking for pset functionality" >&5 -echo $ECHO_N "checking for pset functionality... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ - - int res; - psetid_t id = PS_MYID; - int type = PS_PRIVATE; - uint_t numcpus = 1024; - processorid_t cpulist[1024]; - - res = pset_info(id, &type, &numcpus, &cpulist[0]); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - pset_functionality=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -pset_functionality=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $pset_functionality" >&5 -echo "${ECHO_T}$pset_functionality" >&6 -if test $pset_functionality = yes; then +saved_cppflags=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $EMU_THR_DEFS" +saved_libs=$LIBS +LIBS="$LIBS $EMU_THR_X_LIBS" -cat >>confdefs.h <<\_ACEOF -#define HAVE_PSET 1 -_ACEOF +for ac_header in windows.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi - -echo "$as_me:$LINENO: checking for processor_bind functionality" >&5 -echo $ECHO_N "checking for processor_bind functionality... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include -#include - -int -main () -{ - - int res = processor_bind(P_LWPID, P_MYID, PBIND_NONE, NULL); - - ; - return 0; -} +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -38570,52 +31721,133 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - processor_bind_functionality=yes + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -processor_bind_functionality=no +ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $processor_bind_functionality" >&5 -echo "${ECHO_T}$processor_bind_functionality" >&6 -if test $processor_bind_functionality = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_PROCESSOR_BIND 1 -_ACEOF - -fi +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 -echo "$as_me:$LINENO: checking for cpuset_getaffinity/cpuset_setaffinity" >&5 -echo $ECHO_N "checking for cpuset_getaffinity/cpuset_setaffinity... $ECHO_C" >&6 +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -#include -#include + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 -int -main () -{ +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - int res; - cpuset_t cpuset; - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); - res = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset_t), &cpuset); - res = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset_t), &cpuset); - res = CPU_ISSET(1, &cpuset); - CPU_CLR(1, &cpuset); +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF - ; - return 0; -} +fi + +done + + +for ac_header in winsock2.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -38639,27 +31871,116 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cpuset_xetaffinity=yes + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cpuset_xetaffinity=no +ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $cpuset_xetaffinity" >&5 -echo "${ECHO_T}$cpuset_xetaffinity" >&6 -if test $cpuset_xetaffinity = yes; then +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_CPUSET_xETAFFINITY 1 +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> _ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 -echo "$as_me:$LINENO: checking for 'end' symbol" >&5 -echo $ECHO_N "checking for 'end' symbol... $ECHO_C" >&6 -if test "${erts_cv_have_end_symbol+set}" = set; then +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in ws2tcpip.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -38669,17 +31990,19 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -int -main () -{ -extern char end; {char *x = &end; *x= 0;} - ; - return 0; -} +#ifdef HAVE_WINSOCK2_H +#include +#endif +#ifdef HAVE_WINDOWS_H +#include +#endif + + +#include <$ac_header> _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -38693,48 +32016,63 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erts_cv_have_end_symbol=yes + eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erts_cv_have_end_symbol=no +eval "$as_ac_Header=no" fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $erts_cv_have_end_symbol" >&5 -echo "${ECHO_T}$erts_cv_have_end_symbol" >&6 -if test $erts_cv_have_end_symbol = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_END_SYMBOL 1 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi -echo "$as_me:$LINENO: checking for '_end' symbol" >&5 -echo $ECHO_N "checking for '_end' symbol... $ECHO_C" >&6 -if test "${erts_cv_have__end_symbol+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +done + +echo "$as_me:$LINENO: checking for getaddrinfo" >&5 +echo $ECHO_N "checking for getaddrinfo... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#ifdef HAVE_WINDOWS_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#ifndef __WIN32__ +#include +#include +#endif + int main () { -extern char _end; {char *x = &_end; *x= 0;} + +getaddrinfo("","",NULL,NULL); + ; return 0; } @@ -38761,44 +32099,21 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erts_cv_have__end_symbol=yes + have_getaddrinfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erts_cv_have__end_symbol=no +have_getaddrinfo=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $erts_cv_have__end_symbol" >&5 -echo "${ECHO_T}$erts_cv_have__end_symbol" >&6 -if test $erts_cv_have__end_symbol = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE__END_SYMBOL 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking if __after_morecore_hook can track malloc()s core memory use" >&5 -echo $ECHO_N "checking if __after_morecore_hook can track malloc()s core memory use... $ECHO_C" >&6 -if test "${erts_cv___after_morecore_hook_can_track_malloc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - - case X$erl_xcomp_after_morecore_hook in - X) erts_cv___after_morecore_hook_can_track_malloc=cross;; - Xyes|Xno) erts_cv___after_morecore_hook_can_track_malloc=$erl_xcomp_after_morecore_hook;; - *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_after_morecore_hook value: $erl_xcomp_after_morecore_hook" >&5 -echo "$as_me: error: Bad erl_xcomp_after_morecore_hook value: $erl_xcomp_after_morecore_hook" >&2;} - { (exit 1); exit 1; }; };; - esac - - -else - cat >conftest.$ac_ext <<_ACEOF +if test $have_getaddrinfo = yes; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + echo "$as_me:$LINENO: checking whether getaddrinfo accepts enough flags" >&5 +echo $ECHO_N "checking whether getaddrinfo accepts enough flags... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -38806,202 +32121,124 @@ /* end confdefs.h. */ #include -#ifdef HAVE_MALLOC_H -# include -#endif -#if defined(HAVE_END_SYMBOL) -extern char end; -#elif defined(HAVE__END_SYMBOL) -extern char _end; -#endif -#ifndef USE_THREADS -#undef ETHR_PTHREADS -#endif - -#ifdef ETHR_PTHREADS -# ifdef ETHR_HAVE_PTHREAD_H -# include -# else -# ifdef ETHR_HAVE_MIT_PTHREAD_H -# include -# endif -# endif -# define N_THR 5 -#else -# define N_THR 1 -#endif - -static char *heap_start = NULL; -static char *heap_end = NULL; - -void update_heap_size(void) -{ - heap_end = (char *) sbrk(0); -} - -void init_hook(void) -{ -#if defined(HAVE_END_SYMBOL) - heap_start = &end; -#elif defined(HAVE__END_SYMBOL) - heap_start = &_end; -#else - heap_start = sbrk(0); +#include +#ifdef HAVE_WINSOCK2_H +#include #endif - __after_morecore_hook = update_heap_size; -} - -void (*__malloc_initialize_hook) (void) = init_hook; - -static int -check_malloc(int size) -{ - char *p = (char *) malloc(size); - if (!heap_start || !heap_end) return 0; - if (!p) return 0; - if (p < heap_start || heap_end <= p) return 0; - if (p + size < heap_start || heap_end < p + size) return 0; - return 1; -} - -#ifdef ETHR_PTHREADS -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +#ifdef HAVE_WINDOWS_H +#include #endif - -static void * -do_tests(void *vresp) -{ - int i, ok = 0; -#ifdef ETHR_PTHREADS - if (pthread_mutex_lock(&mutex) != 0) - return NULL; +#ifdef HAVE_WS2TCPIP_H +#include #endif - - for (i = 0; i < 10; i++) - if (!check_malloc(1000)) - goto failed; - for (i = 0; i < 100; i++) - if (!check_malloc(1)) - goto failed; - if (!check_malloc(1024*1024+1)) - goto failed; - if (!check_malloc(10*1024*1024+1)) - goto failed; - ok = 1; - - failed: -#ifdef ETHR_PTHREADS - if (pthread_mutex_unlock(&mutex) != 0) - return NULL; +#ifndef __WIN32__ +#include +#include #endif - if (ok) - *((int *) vresp) = 0; - return NULL; -} - -int main(void) +int +main () { - int res[N_THR], i; -#ifdef ETHR_PTHREADS - pthread_t tid[N_THR]; -#endif -#if defined(HAVE_MALLOPT) && defined(M_MMAP_MAX) - (void) mallopt(M_MMAP_MAX, 0); -#endif + struct addrinfo hints, *ai; + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_CANONNAME; + hints.ai_socktype = SOCK_STREAM; + hints.ai_family = AF_INET6; + if (getaddrinfo("::", NULL, &hints, &ai) == 0) { + freeaddrinfo(ai); + exit(0); + } else { + exit(1); + } - for (i = 0; i < N_THR; i++) - res[i] = 1; -#ifdef ETHR_PTHREADS - for (i = 1; i < N_THR; i++) - if (pthread_create(&tid[i], NULL, do_tests, &res[i]) != 0) - return 1; -#endif - (void) do_tests(&res[0]); -#ifdef ETHR_PTHREADS - for (i = 1; i < N_THR; i++) - if (pthread_join(tid[i], NULL) != 0) - return 1; -#endif - for (i = 0; i < N_THR; i++) - if (res[i]) - return 1; - return 0; + ; + return 0; } - _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erts_cv___after_morecore_hook_can_track_malloc=yes + : else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -erts_cv___after_morecore_hook_can_track_malloc=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi +have_getaddrinfo=no fi -echo "$as_me:$LINENO: result: $erts_cv___after_morecore_hook_can_track_malloc" >&5 -echo "${ECHO_T}$erts_cv___after_morecore_hook_can_track_malloc" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $have_getaddrinfo" >&5 +echo "${ECHO_T}$have_getaddrinfo" >&6 + case $have_getaddrinfo in + yes) -case $erts_cv___after_morecore_hook_can_track_malloc in - yes) cat >>confdefs.h <<\_ACEOF -#define ERTS___AFTER_MORECORE_HOOK_CAN_TRACK_MALLOC 1 +#define HAVE_GETADDRINFO 1 _ACEOF ;; - cross) { echo "$as_me:$LINENO: WARNING: result no guessed because of cross compilation" >&5 -echo "$as_me: WARNING: result no guessed because of cross compilation" >&2;};; - *) ;; -esac - -if test "x$ac_cv_func_sbrk" = "xyes"; then - echo "$as_me:$LINENO: checking types of sbrk()s return value and argument" >&5 -echo $ECHO_N "checking types of sbrk()s return value and argument... $ECHO_C" >&6 -if test "${erts_cv_sbrk_ret_arg_types+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + *) ;; + esac else - - - erts_cv_sbrk_ret_arg_types=unknown - ret_types="void *,char *" - arg_types="intptr_t,ptrdiff_t,int,long" - save_ifs="$IFS"; IFS="," - for rtype in $ret_types; do - for atype in $arg_types; do - IFS=$save_ifs - cat >conftest.$ac_ext <<_ACEOF + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +echo "$as_me:$LINENO: checking for getnameinfo" >&5 +echo $ECHO_N "checking for getnameinfo... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - #include + +#include +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#ifdef HAVE_WINDOWS_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#ifndef __WIN32__ +#include +#include +#endif + int main () { -$rtype sbrk($atype incr); + +getnameinfo(NULL,0,NULL,0,NULL,0,0); + ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -39015,83 +32252,100 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erts_cv_sbrk_ret_arg_types="$rtype,$atype" + have_getnameinfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +have_getnameinfo=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - IFS="," - if test "$erts_cv_sbrk_ret_arg_types" != "unknown"; then - break 2 - fi - done - done - IFS=$save_ifs -fi -echo "$as_me:$LINENO: result: $erts_cv_sbrk_ret_arg_types" >&5 -echo "${ECHO_T}$erts_cv_sbrk_ret_arg_types" >&6 - - if test "$erts_cv_sbrk_ret_arg_types" != "unknown"; then - save_ifs="$IFS"; IFS="," - read ret_type arg_type <&5 +echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<_ACEOF -#define SBRK_RET_TYPE $ret_type +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETNAMEINFO 1 _ACEOF +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -cat >>confdefs.h <<_ACEOF -#define SBRK_ARG_TYPE $arg_type -_ACEOF - fi -fi -if test $ac_cv_func_brk = yes; then - echo "$as_me:$LINENO: checking types of brk()s return value and argument" >&5 -echo $ECHO_N "checking types of brk()s return value and argument... $ECHO_C" >&6 -if test "${erts_cv_brk_ret_arg_types+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - erts_cv_brk_ret_arg_types=unknown - ret_types="int,long,char *,void *" - arg_types="void *,const void *,char *,const char *" - save_ifs="$IFS"; IFS="," - for rtype in $ret_types; do - for atype in $arg_types; do - IFS=$save_ifs - cat >conftest.$ac_ext <<_ACEOF +for ac_func in getipnodebyname getipnodebyaddr gethostbyname2 +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - #include +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + int main () { -$rtype brk($atype endds); +return f != $ac_func; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -39105,319 +32359,136 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erts_cv_brk_ret_arg_types="$rtype,$atype" + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - IFS="," - if test "$erts_cv_brk_ret_arg_types" != "unknown"; then - break 2 - fi - done - done - IFS=$save_ifs +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $erts_cv_brk_ret_arg_types" >&5 -echo "${ECHO_T}$erts_cv_brk_ret_arg_types" >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF - if test "$erts_cv_brk_ret_arg_types" != "unknown"; then - save_ifs="$IFS"; IFS="," - read ret_type arg_type <>confdefs.h <<_ACEOF -#define BRK_RET_TYPE $ret_type -_ACEOF -cat >>confdefs.h <<_ACEOF -#define BRK_ARG_TYPE $arg_type -_ACEOF - fi -fi -if test $ac_cv_func_sbrk = yes; then - echo "$as_me:$LINENO: checking if sbrk()/brk() wrappers can track malloc()s core memory use" >&5 -echo $ECHO_N "checking if sbrk()/brk() wrappers can track malloc()s core memory use... $ECHO_C" >&6 -if test "${erts_cv_brk_wrappers_can_track_malloc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - case X$erl_xcomp_dlsym_brk_wrappers in - X) erts_cv_brk_wrappers_can_track_malloc=cross;; - Xyes|Xno) erts_cv_brk_wrappers_can_track_malloc=$erl_xcomp_dlsym_brk_wrappers;; - *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_dlsym_brk_wrappers value: $erl_xcomp_dlsym_brk_wrappers" >&5 -echo "$as_me: error: Bad erl_xcomp_dlsym_brk_wrappers value: $erl_xcomp_dlsym_brk_wrappers" >&2;} - { (exit 1); exit 1; }; };; - esac -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#ifdef HAVE_DLFCN_H -# include -#endif -/* - * Our implementation requires that we have sbrk(), and 'end' or '_end'. - */ -#if !defined(HAVE_SBRK) -# error no sbrk() -#endif -#if defined(HAVE_END_SYMBOL) -extern char end; -#elif defined(HAVE__END_SYMBOL) -extern char _end; -#else -# error no 'end' nor '_end' -#endif -#ifndef USE_THREADS -#undef ETHR_PTHREADS -#endif -#ifdef ETHR_PTHREADS -# ifdef ETHR_HAVE_PTHREAD_H -# include -# else -# ifdef ETHR_HAVE_MIT_PTHREAD_H -# include -# endif -# endif -# define N_THR 5 -#else -# define N_THR 1 -#endif -#define SBRK_IMPL(RET_TYPE, SBRK, ARG_TYPE) \ -RET_TYPE SBRK (ARG_TYPE); \ -static RET_TYPE (*real_ ## SBRK)(ARG_TYPE) = NULL; \ -RET_TYPE \ -SBRK (ARG_TYPE arg) \ -{ \ - RET_TYPE res; \ - if (!real_ ## SBRK) real_ ## SBRK = dlsym(RTLD_NEXT, #SBRK); \ - res = (*real_ ## SBRK)(arg); \ - if (res != (RET_TYPE) -1) heap_end = (char *) (*real_ ## SBRK)(0); \ - return res; \ -} -#define BRK_IMPL(RET_TYPE, BRK, ARG_TYPE) \ -RET_TYPE BRK (ARG_TYPE); \ -static RET_TYPE (*real_ ## BRK)(ARG_TYPE) = NULL; \ -RET_TYPE \ -BRK (ARG_TYPE arg) \ -{ \ - RET_TYPE res; \ - if (!real_ ## BRK) real_ ## BRK = dlsym(RTLD_NEXT, #BRK); \ - res = (*real_ ## BRK)(arg); \ - if (res != (RET_TYPE) -1) heap_end = (char *) arg; \ - return res; \ -} -static char *heap_start = NULL; -static char *heap_end = NULL; -SBRK_IMPL(SBRK_RET_TYPE, sbrk, SBRK_ARG_TYPE) -#ifdef HAVE_BRK - BRK_IMPL(BRK_RET_TYPE, brk, BRK_ARG_TYPE) -#endif -#ifdef HAVE__SBRK - SBRK_IMPL(SBRK_RET_TYPE, _sbrk, SBRK_ARG_TYPE) -#endif -#ifdef HAVE__BRK - BRK_IMPL(BRK_RET_TYPE, _brk, BRK_ARG_TYPE) -#endif -#ifdef HAVE___SBRK - SBRK_IMPL(SBRK_RET_TYPE, __sbrk, SBRK_ARG_TYPE) -#endif -#ifdef HAVE___BRK - BRK_IMPL(BRK_RET_TYPE, __brk, BRK_ARG_TYPE) -#endif -static int -check_malloc(int size) -{ - char *p = (char *) malloc(size); - if (!heap_start || !heap_end) return 0; - if (!p) return 0; - if (p < heap_start || heap_end <= p) return 0; - if (p + size < heap_start || heap_end < p + size) return 0; - return 1; -} -#ifdef ETHR_PTHREADS -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -#endif -static void * -do_tests(void *vresp) -{ - int i, ok = 0; -#ifdef ETHR_PTHREADS - if (pthread_mutex_lock(&mutex) != 0) - return NULL; -#endif - for (i = 0; i < 10; i++) - if (!check_malloc(1000)) - goto failed; - for (i = 0; i < 100; i++) - if (!check_malloc(1)) - goto failed; - if (!check_malloc(1024*1024+1)) - goto failed; - if (!check_malloc(10*1024*1024+1)) - goto failed; - ok = 1; - failed: -#ifdef ETHR_PTHREADS - if (pthread_mutex_unlock(&mutex) != 0) - return NULL; -#endif - if (ok) - *((int *) vresp) = 0; - return NULL; -} -int main(void) -{ - int res[N_THR], i; -#ifdef ETHR_PTHREADS - pthread_t tid[N_THR]; -#endif -#if defined(HAVE_END_SYMBOL) - heap_start = &end; -#elif defined(HAVE__END_SYMBOL) - heap_start = &_end; -#endif -#if defined(HAVE_MALLOPT) && defined(M_MMAP_MAX) - (void) mallopt(M_MMAP_MAX, 0); -#endif - for (i = 0; i < N_THR; i++) - res[i] = 1; -#ifdef ETHR_PTHREADS - for (i = 1; i < N_THR; i++) - if (pthread_create(&tid[i], NULL, do_tests, &res[i]) != 0) - return 1; -#endif - (void) do_tests(&res[0]); -#ifdef ETHR_PTHREADS - for (i = 1; i < N_THR; i++) - if (pthread_join(tid[i], NULL) != 0) - return 1; -#endif - for (i = 0; i < N_THR; i++) - if (res[i]) - return 1; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - erts_cv_brk_wrappers_can_track_malloc=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -erts_cv_brk_wrappers_can_track_malloc=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $erts_cv_brk_wrappers_can_track_malloc" >&5 -echo "${ECHO_T}$erts_cv_brk_wrappers_can_track_malloc" >&6 - case $erts_cv_brk_wrappers_can_track_malloc in - yes) -cat >>confdefs.h <<\_ACEOF -#define ERTS_BRK_WRAPPERS_CAN_TRACK_MALLOC 1 -_ACEOF -;; - cross) - { echo "$as_me:$LINENO: WARNING: result no guessed because of cross compilation" >&5 -echo "$as_me: WARNING: result no guessed because of cross compilation" >&2;};; - *) ;; - esac -fi -LIBS=$saved_libs -CPPFLAGS=$saved_cppflags -echo "$as_me:$LINENO: checking for IP version 6 support" >&5 -echo $ECHO_N "checking for IP version 6 support... $ECHO_C" >&6 -if test "${ac_cv_sys_ipv6_support+set}" = set; then + + + + +for ac_func in ieee_handler fpsetmask finite isnan isinf res_gethostbyname dlopen \ + pread pwrite memmove strerror strerror_r strncasecmp \ + gethrtime localtime_r gmtime_r inet_pton \ + memcpy mallopt sbrk _sbrk __sbrk brk _brk __brk \ + flockfile fstat strlcpy strlcat setsid posix2time time2posix \ + setlocale nl_langinfo poll mlockall +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ok_so_far=yes - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#ifdef __WIN32__ -#include -#include -#elif __OSE__ -#error "no ipv6" +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include #else -#include +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ #endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + int main () { -struct in6_addr a6; struct sockaddr_in6 s6; +return f != $ac_func; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -39431,23 +32502,46 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ok_so_far=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ok_so_far=no +eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if test $ok_so_far = yes; then - ac_cv_sys_ipv6_support=yes +fi +done + + + +case X$erl_xcomp_posix_memalign in + Xno) ;; + Xyes) +cat >>confdefs.h <<\_ACEOF +#define HAVE_POSIX_MEMALIGN 1 +_ACEOF + ;; + *) + echo "$as_me:$LINENO: checking for posix_memalign" >&5 +echo $ECHO_N "checking for posix_memalign... $ECHO_C" >&6 +if test "${ac_cv_func_posix_memalign+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -39455,26 +32549,54 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#ifdef __WIN32__ -#include -#include -#elif __OSE__ -#error "no ipv6" +/* Define posix_memalign to an innocuous variant, in case declares posix_memalign. + For example, HP-UX 11i declares gettimeofday. */ +#define posix_memalign innocuous_posix_memalign + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char posix_memalign (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include #else -#include +# include +#endif + +#undef posix_memalign + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char posix_memalign (); +/* 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_posix_memalign) || defined (__stub___posix_memalign) +choke me +#else +char (*f) () = posix_memalign; #endif +#ifdef __cplusplus +} +#endif + int main () { -struct in_addr6 a6; struct sockaddr_in6 s6; +return f != posix_memalign; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -39488,154 +32610,96 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sys_ipv6_support=in_addr6 + ac_cv_func_posix_memalign=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_sys_ipv6_support=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_func_posix_memalign=no fi - +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi - - -case ${ac_cv_sys_ipv6_support} in - yes) - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\_ACEOF -#define HAVE_IN6 1 +echo "$as_me:$LINENO: result: $ac_cv_func_posix_memalign" >&5 +echo "${ECHO_T}$ac_cv_func_posix_memalign" >&6 +if test $ac_cv_func_posix_memalign = yes; then + if test "$cross_compiling" != yes; then +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - ;; - in_addr6) - echo "$as_me:$LINENO: result: yes (but I am redefining in_addr6 to in6_addr)" >&5 -echo "${ECHO_T}yes (but I am redefining in_addr6 to in6_addr)" >&6 +#include +int main(void) { + void *ptr = NULL; + int error; + size_t alignment = 0x40000, size = 0x20028; + if ((error = posix_memalign(&ptr, alignment, size)) != 0 || ptr == NULL) + return error; + return 0; +} -cat >>confdefs.h <<\_ACEOF -#define HAVE_IN6 1 _ACEOF - +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF -#define HAVE_IN_ADDR6_STRUCT +#define HAVE_POSIX_MEMALIGN 1 _ACEOF - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; -esac -echo "$as_me:$LINENO: checking for multicast support" >&5 -echo $ECHO_N "checking for multicast support... $ECHO_C" >&6 -if test "${ac_cv_sys_multicast_support+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#if defined(IP_MULTICAST_TTL) && defined(IP_MULTICAST_LOOP) && defined(IP_MULTICAST_IF) && defined(IP_ADD_MEMBERSHIP) && defined(IP_DROP_MEMBERSHIP) -yes -#endif + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "^yes$" >/dev/null 2>&1; then - ac_cv_sys_multicast_support=yes -else - ac_cv_sys_multicast_support=no fi -rm -f conftest* - +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_sys_multicast_support" >&5 -echo "${ECHO_T}$ac_cv_sys_multicast_support" >&6 -if test $ac_cv_sys_multicast_support = yes; then + else cat >>confdefs.h <<\_ACEOF -#define HAVE_MULTICAST_SUPPORT 1 +#define HAVE_POSIX_MEMALIGN 1 _ACEOF + fi fi - - - - -# Check whether --with-clock-resolution or --without-clock-resolution was given. -if test "${with_clock_resolution+set}" = set; then - withval="$with_clock_resolution" - -fi; - - -# Check whether --with-clock-gettime-realtime-id or --without-clock-gettime-realtime-id was given. -if test "${with_clock_gettime_realtime_id+set}" = set; then - withval="$with_clock_gettime_realtime_id" - -fi; - - -# Check whether --with-clock-gettime-monotonic-id or --without-clock-gettime-monotonic-id was given. -if test "${with_clock_gettime_monotonic_id+set}" = set; then - withval="$with_clock_gettime_monotonic_id" - -fi; - -# Check whether --enable-prefer-elapsed-monotonic-time-during-suspend or --disable-prefer-elapsed-monotonic-time-during-suspend was given. -if test "${enable_prefer_elapsed_monotonic_time_during_suspend+set}" = set; then - enableval="$enable_prefer_elapsed_monotonic_time_during_suspend" - case "$enableval" in - yes) prefer_elapsed_monotonic_time_during_suspend=yes ;; - *) prefer_elapsed_monotonic_time_during_suspend=no ;; - esac -else - prefer_elapsed_monotonic_time_during_suspend=no -fi; - -# Check whether --enable-gettimeofday-as-os-system-time or --disable-gettimeofday-as-os-system-time was given. -if test "${enable_gettimeofday_as_os_system_time+set}" = set; then - enableval="$enable_gettimeofday_as_os_system_time" - case "$enableval" in - yes) force_gettimeofday_os_system_time=yes ;; - *) force_gettimeofday_os_system_time=no ;; - esac -else - force_gettimeofday_os_system_time=no -fi; - -case "$with_clock_resolution" in - ""|no|yes) - with_clock_resolution=default;; - high|low|default) - ;; - *) - { { echo "$as_me:$LINENO: error: Invalid wanted clock resolution: $with_clock_resolution" >&5 -echo "$as_me: error: Invalid wanted clock resolution: $with_clock_resolution" >&2;} - { (exit 1); exit 1; }; } - ;; +;; esac -if test "$force_gettimeofday_os_system_time" = "yes"; then - +case $host_os in + darwin10.8.0) + echo "$as_me:$LINENO: checking for writev" >&5 +echo $ECHO_N "checking for writev... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 ;; + *) -for ac_func in gettimeofday +for ac_func in writev do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -39735,141 +32799,23 @@ fi done - - if test "$ac_cv_func_gettimeofday" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define OS_SYSTEM_TIME_GETTIMEOFDAY 1 -_ACEOF - - else - { { echo "$as_me:$LINENO: error: No gettimeofday() available" >&5 -echo "$as_me: error: No gettimeofday() available" >&2;} - { (exit 1); exit 1; }; } - fi - -else # $force_gettimeofday_os_system_time != yes - -case "$with_clock_gettime_realtime_id" in - ""|no) - with_clock_gettime_realtime_id=no - ;; - CLOCK_*CPUTIME*) - { { echo "$as_me:$LINENO: error: Invalid clock_gettime() realtime clock id: Refusing to use the cputime clock id $with_clock_gettime_realtime_id as realtime clock id" >&5 -echo "$as_me: error: Invalid clock_gettime() realtime clock id: Refusing to use the cputime clock id $with_clock_gettime_realtime_id as realtime clock id" >&2;} - { (exit 1); exit 1; }; } - ;; - CLOCK_MONOTONIC*|CLOCK_BOOTTIME*|CLOCK_UPTIME*|CLOCK_HIGHRES*) - { { echo "$as_me:$LINENO: error: Invalid clock_gettime() realtime clock id: Refusing to use the monotonic clock id $with_clock_gettime_realtime_id as realtime clock id" >&5 -echo "$as_me: error: Invalid clock_gettime() realtime clock id: Refusing to use the monotonic clock id $with_clock_gettime_realtime_id as realtime clock id" >&2;} - { (exit 1); exit 1; }; } - ;; - CLOCK_*) - ;; - *) - { { echo "$as_me:$LINENO: error: Invalid clock_gettime() clock id: $with_clock_gettime_realtime_id" >&5 -echo "$as_me: error: Invalid clock_gettime() clock id: $with_clock_gettime_realtime_id" >&2;} - { (exit 1); exit 1; }; } - ;; + ;; esac -case "$with_clock_resolution-$with_clock_gettime_realtime_id" in - high-no) - - default_resolution_clock_gettime_wall="CLOCK_REALTIME" - low_resolution_clock_gettime_wall="CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST" - high_resolution_clock_gettime_wall="CLOCK_REALTIME_PRECISE" - - case "high_resolution" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_wall="$high_resolution_clock_gettime_wall" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_wall="$low_resolution_clock_gettime_wall" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_wall="" - ;; - *) - check_msg="" - prefer_resolution_clock_gettime_wall= - ;; - esac - - echo "$as_me:$LINENO: checking for clock_gettime() with ${check_msg}wall clock type" >&5 -echo $ECHO_N "checking for clock_gettime() with ${check_msg}wall clock type... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_wall_high_resolution+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - for clock_type in $prefer_resolution_clock_gettime_wall $default_resolution_clock_gettime_wall $high_resolution_clock_gettime_wall $low_resolution_clock_gettime_wall; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include - -int -main () -{ - - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - erl_cv_clock_gettime_wall_high_resolution=$clock_type -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -erl_cv_clock_gettime_wall_high_resolution=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test $erl_cv_clock_gettime_wall_high_resolution = no || break - done - -fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_wall_high_resolution" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_wall_high_resolution" >&6 - - +case $host_os in + *ose) + echo "$as_me:$LINENO: checking for mmap" >&5 +echo $ECHO_N "checking for mmap... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: not using for OSE" >&5 +echo "${ECHO_T}not using for OSE" >&6 + echo "$as_me:$LINENO: checking for mremap" >&5 +echo $ECHO_N "checking for mremap... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: not using for OSE" >&5 +echo "${ECHO_T}not using for OSE" >&6 ;; + *) -for ac_func in clock_getres clock_get_attributes gettimeofday +for ac_func in mmap mremap do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -39969,35 +32915,29 @@ fi done + ;; +esac - echo "$as_me:$LINENO: checking for mach clock_get_time() with wall clock type" >&5 -echo $ECHO_N "checking for mach clock_get_time() with wall clock type... $ECHO_C" >&6 -if test "${erl_cv_mach_clock_get_time_wall+set}" = set; then +echo "$as_me:$LINENO: checking whether posix2time is declared" >&5 +echo $ECHO_N "checking whether posix2time is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_posix2time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#include +#include int main () { - - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); +#ifndef posix2time + char *p = (char *) posix2time; +#endif ; return 0; @@ -40025,98 +32965,50 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_mach_clock_get_time_wall=yes + ac_cv_have_decl_posix2time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_mach_clock_get_time_wall=no +ac_cv_have_decl_posix2time=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi -echo "$as_me:$LINENO: result: $erl_cv_mach_clock_get_time_wall" >&5 -echo "${ECHO_T}$erl_cv_mach_clock_get_time_wall" >&6 +echo "$as_me:$LINENO: result: $ac_cv_have_decl_posix2time" >&5 +echo "${ECHO_T}$ac_cv_have_decl_posix2time" >&6 +if test $ac_cv_have_decl_posix2time = yes; then - erl_wall_clock_low_resolution=no - erl_wall_clock_id= - case high_resolution-$erl_cv_clock_gettime_wall_high_resolution-$erl_cv_mach_clock_get_time_wall-$ac_cv_func_gettimeofday-$host_os in - *-*-*-*-win32) - erl_wall_clock_func=WindowsAPI - erl_wall_clock_low_resolution=yes - ;; - high_resolution-no-yes-*-*) - erl_wall_clock_func=mach_clock_get_time - erl_wall_clock_id=CALENDAR_CLOCK - ;; - *-CLOCK_*-*-*-*) - erl_wall_clock_func=clock_gettime - erl_wall_clock_id=$erl_cv_clock_gettime_wall_high_resolution - for low_res_id in $low_resolution_clock_gettime_wall; do - if test $erl_wall_clock_id = $low_res_id; then - erl_wall_clock_low_resolution=yes - break - fi - done - ;; - *-no-*-yes-*) - erl_wall_clock_func=gettimeofday - ;; - *) - erl_wall_clock_func=none - ;; - esac -;; - low-no) +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_POSIX2TIME 1 +_ACEOF - default_resolution_clock_gettime_wall="CLOCK_REALTIME" - low_resolution_clock_gettime_wall="CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST" - high_resolution_clock_gettime_wall="CLOCK_REALTIME_PRECISE" - - case "low_resolution" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_wall="$high_resolution_clock_gettime_wall" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_wall="$low_resolution_clock_gettime_wall" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_wall="" - ;; - *) - check_msg="" - prefer_resolution_clock_gettime_wall= - ;; - esac - echo "$as_me:$LINENO: checking for clock_gettime() with ${check_msg}wall clock type" >&5 -echo $ECHO_N "checking for clock_gettime() with ${check_msg}wall clock type... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_wall_low_resolution+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_POSIX2TIME 0 +_ACEOF + - for clock_type in $prefer_resolution_clock_gettime_wall $default_resolution_clock_gettime_wall $high_resolution_clock_gettime_wall $low_resolution_clock_gettime_wall; do - cat >conftest.$ac_ext <<_ACEOF +fi +echo "$as_me:$LINENO: checking whether time2posix is declared" >&5 +echo $ECHO_N "checking whether time2posix is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_time2posix+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include int main () { - - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); +#ifndef time2posix + char *p = (char *) time2posix; +#endif ; return 0; @@ -40144,25 +33036,204 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_wall_low_resolution=$clock_type + ac_cv_have_decl_time2posix=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_time2posix=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_time2posix" >&5 +echo "${ECHO_T}$ac_cv_have_decl_time2posix" >&6 +if test $ac_cv_have_decl_time2posix = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_TIME2POSIX 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_TIME2POSIX 0 +_ACEOF + + +fi + + + +disable_vfork=false +if test "x$EMU_THR_LIB_NAME" != "x"; then + echo "$as_me:$LINENO: checking if vfork is known to hang multithreaded applications" >&5 +echo $ECHO_N "checking if vfork is known to hang multithreaded applications... $ECHO_C" >&6 + case $host_os in + osf*) + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + disable_vfork=true;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6;; + esac +fi + +if test $disable_vfork = false; then + + +for ac_header in unistd.h vfork.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_wall_low_resolution=no + ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test $erl_cv_clock_gettime_wall_low_resolution = no || break - done +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_wall_low_resolution" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_wall_low_resolution" >&6 +done -for ac_func in clock_getres clock_get_attributes gettimeofday +for ac_func in fork vfork do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -40263,199 +33334,252 @@ fi done - - echo "$as_me:$LINENO: checking for mach clock_get_time() with wall clock type" >&5 -echo $ECHO_N "checking for mach clock_get_time() with wall clock type... $ECHO_C" >&6 -if test "${erl_cv_mach_clock_get_time_wall+set}" = set; then +if test "x$ac_cv_func_fork" = xyes; then + echo "$as_me:$LINENO: checking for working fork" >&5 +echo $ECHO_N "checking for working fork... $ECHO_C" >&6 +if test "${ac_cv_func_fork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include - -int -main () -{ - - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - - ; - return 0; -} + if test "$cross_compiling" = yes; then + ac_cv_func_fork_works=cross +else + cat >conftest.$ac_ext <<_ACEOF +/* By Ruediger Kuhlmann. */ + #include + #if HAVE_UNISTD_H + # include + #endif + /* Some systems only have a dummy stub for fork() */ + int main () + { + if (fork() < 0) + exit (1); + exit (0); + } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_mach_clock_get_time_wall=yes + ac_cv_func_fork_works=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_mach_clock_get_time_wall=no +( exit $ac_status ) +ac_cv_func_fork_works=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi -echo "$as_me:$LINENO: result: $erl_cv_mach_clock_get_time_wall" >&5 -echo "${ECHO_T}$erl_cv_mach_clock_get_time_wall" >&6 +echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 +echo "${ECHO_T}$ac_cv_func_fork_works" >&6 - erl_wall_clock_low_resolution=no - erl_wall_clock_id= - case low_resolution-$erl_cv_clock_gettime_wall_low_resolution-$erl_cv_mach_clock_get_time_wall-$ac_cv_func_gettimeofday-$host_os in - *-*-*-*-win32) - erl_wall_clock_func=WindowsAPI - erl_wall_clock_low_resolution=yes - ;; - high_resolution-no-yes-*-*) - erl_wall_clock_func=mach_clock_get_time - erl_wall_clock_id=CALENDAR_CLOCK - ;; - *-CLOCK_*-*-*-*) - erl_wall_clock_func=clock_gettime - erl_wall_clock_id=$erl_cv_clock_gettime_wall_low_resolution - for low_res_id in $low_resolution_clock_gettime_wall; do - if test $erl_wall_clock_id = $low_res_id; then - erl_wall_clock_low_resolution=yes - break - fi - done - ;; - *-no-*-yes-*) - erl_wall_clock_func=gettimeofday +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 ;; *) - erl_wall_clock_func=none + ac_cv_func_fork_works=yes ;; esac -;; - default-no) - - default_resolution_clock_gettime_wall="CLOCK_REALTIME" - low_resolution_clock_gettime_wall="CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST" - high_resolution_clock_gettime_wall="CLOCK_REALTIME_PRECISE" - - case "default_resolution" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_wall="$high_resolution_clock_gettime_wall" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_wall="$low_resolution_clock_gettime_wall" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_wall="" - ;; - *) - check_msg="" - prefer_resolution_clock_gettime_wall= - ;; - esac - - echo "$as_me:$LINENO: checking for clock_gettime() with ${check_msg}wall clock type" >&5 -echo $ECHO_N "checking for clock_gettime() with ${check_msg}wall clock type... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_wall_default_resolution+set}" = set; then + { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +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 + echo "$as_me:$LINENO: checking for working vfork" >&5 +echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 +if test "${ac_cv_func_vfork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - for clock_type in $prefer_resolution_clock_gettime_wall $default_resolution_clock_gettime_wall $high_resolution_clock_gettime_wall $low_resolution_clock_gettime_wall; do - cat >conftest.$ac_ext <<_ACEOF + if test "$cross_compiling" = yes; then + ac_cv_func_vfork_works=cross +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include +/* Thanks to Paul Eggert for this test. */ +#include +#include +#include +#include +#include +#if HAVE_UNISTD_H +# include +#endif +#if HAVE_VFORK_H +# include +#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 , but some compilers + (e.g. gcc -O) don't grok . 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; - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); + sparc_address_test (0); - ; - return 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) + ; + exit( + /* 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 -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_wall_default_resolution=$clock_type + ac_cv_func_vfork_works=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_wall_default_resolution=no +( exit $ac_status ) +ac_cv_func_vfork_works=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 +echo "${ECHO_T}$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 + { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +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 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WORKING_VFORK 1 +_ACEOF + +else + +cat >>confdefs.h <<\_ACEOF +#define vfork fork +_ACEOF + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WORKING_FORK 1 +_ACEOF + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test $erl_cv_clock_gettime_wall_default_resolution = no || break - done + if test $ac_cv_func_vfork_works = no; then + disable_vfork=true + fi fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_wall_default_resolution" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_wall_default_resolution" >&6 +if test $disable_vfork = true; then + +cat >>confdefs.h <<\_ACEOF +#define DISABLE_VFORK 1 +_ACEOF +fi -for ac_func in clock_getres clock_get_attributes gettimeofday +for ac_func in vprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -40553,207 +33677,9 @@ #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -fi -done - - - echo "$as_me:$LINENO: checking for mach clock_get_time() with wall clock type" >&5 -echo $ECHO_N "checking for mach clock_get_time() with wall clock type... $ECHO_C" >&6 -if test "${erl_cv_mach_clock_get_time_wall+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include - -int -main () -{ - - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - erl_cv_mach_clock_get_time_wall=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -erl_cv_mach_clock_get_time_wall=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $erl_cv_mach_clock_get_time_wall" >&5 -echo "${ECHO_T}$erl_cv_mach_clock_get_time_wall" >&6 - - erl_wall_clock_low_resolution=no - erl_wall_clock_id= - case default_resolution-$erl_cv_clock_gettime_wall_default_resolution-$erl_cv_mach_clock_get_time_wall-$ac_cv_func_gettimeofday-$host_os in - *-*-*-*-win32) - erl_wall_clock_func=WindowsAPI - erl_wall_clock_low_resolution=yes - ;; - high_resolution-no-yes-*-*) - erl_wall_clock_func=mach_clock_get_time - erl_wall_clock_id=CALENDAR_CLOCK - ;; - *-CLOCK_*-*-*-*) - erl_wall_clock_func=clock_gettime - erl_wall_clock_id=$erl_cv_clock_gettime_wall_default_resolution - for low_res_id in $low_resolution_clock_gettime_wall; do - if test $erl_wall_clock_id = $low_res_id; then - erl_wall_clock_low_resolution=yes - break - fi - done - ;; - *-no-*-yes-*) - erl_wall_clock_func=gettimeofday - ;; - *) - erl_wall_clock_func=none - ;; - esac -;; - *) - - default_resolution_clock_gettime_wall="CLOCK_REALTIME" - low_resolution_clock_gettime_wall="CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST" - high_resolution_clock_gettime_wall="CLOCK_REALTIME_PRECISE" - - case "custom_resolution" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_wall="$high_resolution_clock_gettime_wall" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_wall="$low_resolution_clock_gettime_wall" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_wall="$with_clock_gettime_realtime_id" - ;; - *) - check_msg="" - prefer_resolution_clock_gettime_wall= - ;; - esac - - echo "$as_me:$LINENO: checking for clock_gettime() with ${check_msg}wall clock type" >&5 -echo $ECHO_N "checking for clock_gettime() with ${check_msg}wall clock type... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_wall_custom_resolution+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - for clock_type in $prefer_resolution_clock_gettime_wall $default_resolution_clock_gettime_wall $high_resolution_clock_gettime_wall $low_resolution_clock_gettime_wall; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include - -int -main () -{ - - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - erl_cv_clock_gettime_wall_custom_resolution=$clock_type -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -erl_cv_clock_gettime_wall_custom_resolution=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test $erl_cv_clock_gettime_wall_custom_resolution = no || break - done - -fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_wall_custom_resolution" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_wall_custom_resolution" >&6 - - - - -for ac_func in clock_getres clock_get_attributes gettimeofday -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +echo "$as_me:$LINENO: checking for _doprnt" >&5 +echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 +if test "${ac_cv_func__doprnt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -40762,12 +33688,12 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. +/* Define _doprnt to an innocuous variant, in case declares _doprnt. For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func +#define _doprnt innocuous__doprnt /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. + which can conflict with char _doprnt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ @@ -40777,7 +33703,7 @@ # include #endif -#undef $ac_func +#undef _doprnt /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -40786,14 +33712,14 @@ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func (); +char _doprnt (); /* 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_$ac_func) || defined (__stub___$ac_func) +#if defined (__stub__doprnt) || defined (__stub____doprnt) choke me #else -char (*f) () = $ac_func; +char (*f) () = _doprnt; #endif #ifdef __cplusplus } @@ -40802,7 +33728,7 @@ int main () { -return f != $ac_func; +return f != _doprnt; ; return 0; } @@ -40829,54 +33755,49 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_func__doprnt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_func__doprnt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 +echo "${ECHO_T}$ac_cv_func__doprnt" >&6 +if test $ac_cv_func__doprnt = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DOPRNT 1 _ACEOF fi + +fi done - echo "$as_me:$LINENO: checking for mach clock_get_time() with wall clock type" >&5 -echo $ECHO_N "checking for mach clock_get_time() with wall clock type... $ECHO_C" >&6 -if test "${erl_cv_mach_clock_get_time_wall+set}" = set; then + +echo "$as_me:$LINENO: checking for conflicting declaration of fread" >&5 +echo $ECHO_N "checking for conflicting declaration of fread... $ECHO_C" >&6 +if test "${ac_cv_func_decl_fread+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#include +#include int main () { - - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); +extern int fread(); +char *c = (char *)fread; ; return 0; @@ -40904,195 +33825,53 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_mach_clock_get_time_wall=yes + eval "ac_cv_func_decl_fread=no" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_mach_clock_get_time_wall=no +eval "ac_cv_func_decl_fread=yes" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi -echo "$as_me:$LINENO: result: $erl_cv_mach_clock_get_time_wall" >&5 -echo "${ECHO_T}$erl_cv_mach_clock_get_time_wall" >&6 - - erl_wall_clock_low_resolution=no - erl_wall_clock_id= - case custom_resolution-$erl_cv_clock_gettime_wall_custom_resolution-$erl_cv_mach_clock_get_time_wall-$ac_cv_func_gettimeofday-$host_os in - *-*-*-*-win32) - erl_wall_clock_func=WindowsAPI - erl_wall_clock_low_resolution=yes - ;; - high_resolution-no-yes-*-*) - erl_wall_clock_func=mach_clock_get_time - erl_wall_clock_id=CALENDAR_CLOCK - ;; - *-CLOCK_*-*-*-*) - erl_wall_clock_func=clock_gettime - erl_wall_clock_id=$erl_cv_clock_gettime_wall_custom_resolution - for low_res_id in $low_resolution_clock_gettime_wall; do - if test $erl_wall_clock_id = $low_res_id; then - erl_wall_clock_low_resolution=yes - break - fi - done - ;; - *-no-*-yes-*) - erl_wall_clock_func=gettimeofday - ;; - *) - erl_wall_clock_func=none - ;; - esac -;; -esac - -case "$erl_wall_clock_func-$erl_wall_clock_id-$with_clock_gettime_realtime_id" in - *-*-no) - ;; - clock_gettime-$with_clock_gettime_realtime_id-$with_clock_gettime_realtime_id) - ;; - *) - { { echo "$as_me:$LINENO: error: $with_clock_gettime_realtime_id as clock id to clock_gettime() doesn't compile" >&5 -echo "$as_me: error: $with_clock_gettime_realtime_id as clock id to clock_gettime() doesn't compile" >&2;} - { (exit 1); exit 1; }; } - ;; -esac - -case $erl_wall_clock_func in - none) - { { echo "$as_me:$LINENO: error: No wall clock source found" >&5 -echo "$as_me: error: No wall clock source found" >&2;} - { (exit 1); exit 1; }; } - ;; - mach_clock_get_time) - -cat >>confdefs.h <<\_ACEOF -#define OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME 1 -_ACEOF - - ;; - clock_gettime) - -cat >>confdefs.h <<\_ACEOF -#define OS_SYSTEM_TIME_USING_CLOCK_GETTIME 1 -_ACEOF - ;; - gettimeofday) +if eval "test \"`echo '$ac_cv_func_decl_'fread`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define OS_SYSTEM_TIME_GETTIMEOFDAY 1 -_ACEOF - - ;; - *) - ;; -esac - -if test "x$erl_wall_clock_id" != "x"; then - -cat >>confdefs.h <<_ACEOF -#define WALL_CLOCK_ID_STR "$erl_wall_clock_id" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define WALL_CLOCK_ID $erl_wall_clock_id +#define HAVE_CONFLICTING_FREAD_DECLARATION 1 _ACEOF +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -fi # $force_gettimeofday_os_system_time != yes - -case "$with_clock_gettime_monotonic_id" in - ""|no) - with_clock_gettime_monotonic_id=no - ;; - CLOCK_*CPUTIME*) - { { echo "$as_me:$LINENO: error: Invalid clock_gettime() monotonic clock id: Refusing to use the cputime clock id $with_clock_gettime_monotonic_id as monotonic clock id" >&5 -echo "$as_me: error: Invalid clock_gettime() monotonic clock id: Refusing to use the cputime clock id $with_clock_gettime_monotonic_id as monotonic clock id" >&2;} - { (exit 1); exit 1; }; } - ;; - CLOCK_REALTIME*|CLOCK_TAI*) - { { echo "$as_me:$LINENO: error: Invalid clock_gettime() monotonic clock id: Refusing to use the realtime clock id $with_clock_gettime_monotonic_id as monotonic clock id" >&5 -echo "$as_me: error: Invalid clock_gettime() monotonic clock id: Refusing to use the realtime clock id $with_clock_gettime_monotonic_id as monotonic clock id" >&2;} - { (exit 1); exit 1; }; } - ;; - CLOCK_*) - ;; - *) - { { echo "$as_me:$LINENO: error: Invalid clock_gettime() clock id: $with_clock_gettime_monotonic_id" >&5 -echo "$as_me: error: Invalid clock_gettime() clock id: $with_clock_gettime_monotonic_id" >&2;} - { (exit 1); exit 1; }; } - ;; -esac - -case "$with_clock_resolution-$with_clock_gettime_monotonic_id" in - high-no) - - if test "$prefer_elapsed_monotonic_time_during_suspend" = "yes"; then - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_BOOTTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_PRECISE" - else - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_UPTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_UPTIME_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_UPTIME_PRECISE" - fi - - case "high_resolution" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_monotonic="$high_resolution_clock_gettime_monotonic" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_monotonic="$low_resolution_clock_gettime_monotonic" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_monotonic="undefined" - ;; - *) - check_msg="custom " - prefer_resolution_clock_gettime_monotonic="undefined" - ;; - esac - echo "$as_me:$LINENO: checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)" >&5 -echo $ECHO_N "checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_raw+set}" = set; then +echo "$as_me:$LINENO: checking for putc_unlocked" >&5 +echo $ECHO_N "checking for putc_unlocked... $ECHO_C" >&6 +if test "${erts_cv_putc_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include - +#include int main () { - - struct timespec ts; - long long result; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - +int res = putc_unlocked('x',stdout); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -41106,58 +33885,55 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_raw=yes + erts_cv_putc_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_monotonic_raw=no +erts_cv_putc_unlocked=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $erts_cv_putc_unlocked" >&5 +echo "${ECHO_T}$erts_cv_putc_unlocked" >&6 +if test $erts_cv_putc_unlocked = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PUTC_UNLOCKED 1 +_ACEOF fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_raw" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_raw" >&6 - echo "$as_me:$LINENO: checking for clock_gettime() with ${check_msg}monotonic clock type" >&5 -echo $ECHO_N "checking for clock_gettime() with ${check_msg}monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_high_resolution+set}" = set; then +echo "$as_me:$LINENO: checking for fwrite_unlocked" >&5 +echo $ECHO_N "checking for fwrite_unlocked... $ECHO_C" >&6 +if test "${erts_cv_fwrite_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include - +#include int main () { - - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - +size_t res = fwrite_unlocked(NULL,sizeof(char),0,stdout); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -41171,31 +33947,34 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_high_resolution=$clock_type + erts_cv_fwrite_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_monotonic_high_resolution=no +erts_cv_fwrite_unlocked=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test $erl_cv_clock_gettime_monotonic_high_resolution = no || break - done - +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_high_resolution" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_high_resolution" >&6 +echo "$as_me:$LINENO: result: $erts_cv_fwrite_unlocked" >&5 +echo "${ECHO_T}$erts_cv_fwrite_unlocked" >&6 +if test $erts_cv_fwrite_unlocked = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_FWRITE_UNLOCKED 1 +_ACEOF +fi -for ac_func in clock_getres clock_get_attributes gethrtime +for ac_func in openpty do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -41297,37 +34076,32 @@ done - echo "$as_me:$LINENO: checking for mach clock_get_time() with monotonic clock type" >&5 -echo $ECHO_N "checking for mach clock_get_time() with monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_mach_clock_get_time_monotonic+set}" = set; then + + + +for ac_header in net/if_dl.h ifaddrs.h netpacket/packet.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#include - -int -main () -{ - - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - - ; - return 0; -} +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -41351,92 +34125,165 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_mach_clock_get_time_monotonic=yes + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_mach_clock_get_time_monotonic=no +ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes fi -echo "$as_me:$LINENO: result: $erl_cv_mach_clock_get_time_monotonic" >&5 -echo "${ECHO_T}$erl_cv_mach_clock_get_time_monotonic" >&6 +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - erl_corrected_monotonic_clock=no - case $erl_cv_clock_gettime_monotonic_high_resolution-$ac_cv_func_gethrtime-$erl_cv_mach_clock_get_time_monotonic-$host_os in - *-*-*-win32) - erl_monotonic_clock_func=WindowsAPI - ;; - CLOCK_*-*-*-linux*) - case $erl_cv_clock_gettime_monotonic_high_resolution-$erl_cv_clock_gettime_monotonic_raw in - CLOCK_BOOTTIME-yes|CLOCK_MONOTONIC-yes) - erl_corrected_monotonic_clock=yes - ;; - *) - # We don't trust CLOCK_MONOTONIC to be NTP - # adjusted on linux systems that do not have - # CLOCK_MONOTONIC_RAW (although it seems to - # be...) - ;; - esac - erl_monotonic_clock_func=clock_gettime - ;; - no-no-no-linux*) - erl_monotonic_clock_func=times - ;; - CLOCK_*-*-*-*) - erl_monotonic_clock_func=clock_gettime - ;; - no-yes-*-*) - erl_monotonic_clock_func=gethrtime - ;; - no-no-yes-*) - erl_monotonic_clock_func=mach_clock_get_time - ;; - no-no-no-*) - erl_monotonic_clock_func=none - ;; - esac + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 - erl_monotonic_clock_low_resolution=no - erl_monotonic_clock_lib= - erl_monotonic_clock_id= - case $erl_monotonic_clock_func in - clock_gettime) - erl_monotonic_clock_id=$erl_cv_clock_gettime_monotonic_high_resolution - for low_res_id in $low_resolution_clock_gettime_monotonic; do - if test $erl_monotonic_clock_id = $low_res_id; then - erl_monotonic_clock_low_resolution=yes - break - fi - done - echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5 -echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6 -if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat >conftest.$ac_ext <<_ACEOF + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in getifaddrs +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" +{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char clock_gettime (); +char $ac_func (); +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + int main () { -clock_gettime (); +return f != $ac_func; ; return 0; } @@ -41463,98 +34310,55 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_rt_clock_gettime=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_rt_clock_gettime=no +eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 -echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6 -if test $ac_cv_lib_rt_clock_gettime = yes; then - erl_monotonic_clock_lib="-lrt" -fi - - ;; - mach_clock_get_time) - erl_monotonic_clock_id=SYSTEM_CLOCK - ;; - times) - erl_monotonic_clock_low_resolution=yes - ;; - *) - ;; - esac - -;; - low-no) +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF - if test "$prefer_elapsed_monotonic_time_during_suspend" = "yes"; then - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_BOOTTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_PRECISE" - else - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_UPTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_UPTIME_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_UPTIME_PRECISE" - fi +fi +done - case "low_resolution" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_monotonic="$high_resolution_clock_gettime_monotonic" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_monotonic="$low_resolution_clock_gettime_monotonic" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_monotonic="undefined" - ;; - *) - check_msg="custom " - prefer_resolution_clock_gettime_monotonic="undefined" - ;; - esac - echo "$as_me:$LINENO: checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)" >&5 -echo $ECHO_N "checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_raw+set}" = set; then +echo "$as_me:$LINENO: checking whether in6addr_any is declared" >&5 +echo $ECHO_N "checking whether in6addr_any is declared... $ECHO_C" >&6 +if test "${erts_cv_have_in6addr_any+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + #include + #include + #include int main () { - - struct timespec ts; - long long result; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); +printf("%d", in6addr_any.s6_addr[16]); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -41568,58 +34372,64 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_raw=yes + erts_cv_have_in6addr_any=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_monotonic_raw=no +erts_cv_have_in6addr_any=no + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_raw" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_raw" >&6 +echo "$as_me:$LINENO: result: $erts_cv_have_in6addr_any" >&5 +echo "${ECHO_T}$erts_cv_have_in6addr_any" >&6 + +case "$erts_cv_have_in6addr_any" in + yes) - echo "$as_me:$LINENO: checking for clock_gettime() with ${check_msg}monotonic clock type" >&5 -echo $ECHO_N "checking for clock_gettime() with ${check_msg}monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_low_resolution+set}" = set; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_IN6ADDR_ANY 1 +_ACEOF + +esac + +echo "$as_me:$LINENO: checking whether in6addr_loopback is declared" >&5 +echo $ECHO_N "checking whether in6addr_loopback is declared... $ECHO_C" >&6 +if test "${erts_cv_have_in6addr_loopback+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + #include + #include + #include int main () { - - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); +printf("%d", in6addr_loopback.s6_addr[16]); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -41633,36 +34443,39 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_low_resolution=$clock_type + erts_cv_have_in6addr_loopback=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_monotonic_low_resolution=no +erts_cv_have_in6addr_loopback=no + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test $erl_cv_clock_gettime_monotonic_low_resolution = no || break - done +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_low_resolution" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_low_resolution" >&6 +echo "$as_me:$LINENO: result: $erts_cv_have_in6addr_loopback" >&5 +echo "${ECHO_T}$erts_cv_have_in6addr_loopback" >&6 +case "$erts_cv_have_in6addr_loopback" in + yes) +cat >>confdefs.h <<\_ACEOF +#define HAVE_IN6ADDR_LOOPBACK 1 +_ACEOF +esac -for ac_func in clock_getres clock_get_attributes gethrtime -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +echo "$as_me:$LINENO: checking whether IN6ADDR_ANY_INIT is declared" >&5 +echo $ECHO_N "checking whether IN6ADDR_ANY_INIT is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_IN6ADDR_ANY_INIT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -41671,54 +34484,26 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif -#undef $ac_func + #include + #include + #include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif int main () { -return f != $ac_func; +#ifndef IN6ADDR_ANY_INIT + char *p = (char *) IN6ADDR_ANY_INIT; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -41732,60 +34517,60 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_have_decl_IN6ADDR_ANY_INIT=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_have_decl_IN6ADDR_ANY_INIT=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +echo "$as_me:$LINENO: result: $ac_cv_have_decl_IN6ADDR_ANY_INIT" >&5 +echo "${ECHO_T}$ac_cv_have_decl_IN6ADDR_ANY_INIT" >&6 +if test $ac_cv_have_decl_IN6ADDR_ANY_INIT = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IN6ADDR_ANY_INIT 1 _ACEOF -fi -done + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IN6ADDR_ANY_INIT 0 +_ACEOF - echo "$as_me:$LINENO: checking for mach clock_get_time() with monotonic clock type" >&5 -echo $ECHO_N "checking for mach clock_get_time() with monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_mach_clock_get_time_monotonic+set}" = set; then +fi +echo "$as_me:$LINENO: checking whether IN6ADDR_LOOPBACK_INIT is declared" >&5 +echo $ECHO_N "checking whether IN6ADDR_LOOPBACK_INIT is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include + #include + #include + #include + int main () { - - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); +#ifndef IN6ADDR_LOOPBACK_INIT + char *p = (char *) IN6ADDR_LOOPBACK_INIT; +#endif ; return 0; @@ -41813,99 +34598,62 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_mach_clock_get_time_monotonic=yes + ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_mach_clock_get_time_monotonic=no +ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi -echo "$as_me:$LINENO: result: $erl_cv_mach_clock_get_time_monotonic" >&5 -echo "${ECHO_T}$erl_cv_mach_clock_get_time_monotonic" >&6 +echo "$as_me:$LINENO: result: $ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT" >&5 +echo "${ECHO_T}$ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT" >&6 +if test $ac_cv_have_decl_IN6ADDR_LOOPBACK_INIT = yes; then - erl_corrected_monotonic_clock=no - case $erl_cv_clock_gettime_monotonic_low_resolution-$ac_cv_func_gethrtime-$erl_cv_mach_clock_get_time_monotonic-$host_os in - *-*-*-win32) - erl_monotonic_clock_func=WindowsAPI - ;; - CLOCK_*-*-*-linux*) - case $erl_cv_clock_gettime_monotonic_low_resolution-$erl_cv_clock_gettime_monotonic_raw in - CLOCK_BOOTTIME-yes|CLOCK_MONOTONIC-yes) - erl_corrected_monotonic_clock=yes - ;; - *) - # We don't trust CLOCK_MONOTONIC to be NTP - # adjusted on linux systems that do not have - # CLOCK_MONOTONIC_RAW (although it seems to - # be...) - ;; - esac - erl_monotonic_clock_func=clock_gettime - ;; - no-no-no-linux*) - erl_monotonic_clock_func=times - ;; - CLOCK_*-*-*-*) - erl_monotonic_clock_func=clock_gettime - ;; - no-yes-*-*) - erl_monotonic_clock_func=gethrtime - ;; - no-no-yes-*) - erl_monotonic_clock_func=mach_clock_get_time - ;; - no-no-no-*) - erl_monotonic_clock_func=none - ;; - esac +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IN6ADDR_LOOPBACK_INIT 1 +_ACEOF - erl_monotonic_clock_low_resolution=no - erl_monotonic_clock_lib= - erl_monotonic_clock_id= - case $erl_monotonic_clock_func in - clock_gettime) - erl_monotonic_clock_id=$erl_cv_clock_gettime_monotonic_low_resolution - for low_res_id in $low_resolution_clock_gettime_monotonic; do - if test $erl_monotonic_clock_id = $low_res_id; then - erl_monotonic_clock_low_resolution=yes - break - fi - done - echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5 -echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6 -if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IN6ADDR_LOOPBACK_INIT 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether IPV6_V6ONLY is declared" >&5 +echo $ECHO_N "checking whether IPV6_V6ONLY is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_IPV6_V6ONLY+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char clock_gettime (); + #include + #include + #include + + int main () { -clock_gettime (); +#ifndef IPV6_V6ONLY + char *p = (char *) IPV6_V6ONLY; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -41919,96 +34667,65 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_rt_clock_gettime=yes + ac_cv_have_decl_IPV6_V6ONLY=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_rt_clock_gettime=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +ac_cv_have_decl_IPV6_V6ONLY=no fi -echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 -echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6 -if test $ac_cv_lib_rt_clock_gettime = yes; then - erl_monotonic_clock_lib="-lrt" +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_IPV6_V6ONLY" >&5 +echo "${ECHO_T}$ac_cv_have_decl_IPV6_V6ONLY" >&6 +if test $ac_cv_have_decl_IPV6_V6ONLY = yes; then - ;; - mach_clock_get_time) - erl_monotonic_clock_id=SYSTEM_CLOCK - ;; - times) - erl_monotonic_clock_low_resolution=yes - ;; - *) - ;; - esac +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IPV6_V6ONLY 1 +_ACEOF -;; - default-no) - if test "$prefer_elapsed_monotonic_time_during_suspend" = "yes"; then - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_BOOTTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_PRECISE" - else - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_UPTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_UPTIME_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_UPTIME_PRECISE" - fi +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IPV6_V6ONLY 0 +_ACEOF - case "default_resolution" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_monotonic="$high_resolution_clock_gettime_monotonic" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_monotonic="$low_resolution_clock_gettime_monotonic" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_monotonic="undefined" - ;; - *) - check_msg="custom " - prefer_resolution_clock_gettime_monotonic="undefined" - ;; - esac - echo "$as_me:$LINENO: checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)" >&5 -echo $ECHO_N "checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_raw+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else +fi - cat >conftest.$ac_ext <<_ACEOF + + + +echo "$as_me:$LINENO: checking for sched_getaffinity/sched_setaffinity" >&5 +echo $ECHO_N "checking for sched_getaffinity/sched_setaffinity... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include - +#include int main () { - struct timespec ts; - long long result; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); +#ifndef CPU_SETSIZE +#error no CPU_SETSIZE +#endif + int res; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(1, &cpuset); + res = sched_setaffinity(0, sizeof(cpu_set_t), &cpuset); + res = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); + res = CPU_ISSET(1, &cpuset); + CPU_CLR(1, &cpuset); ; return 0; @@ -42036,44 +34753,45 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_raw=yes + sched_xetaffinity=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_monotonic_raw=no +sched_xetaffinity=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $sched_xetaffinity" >&5 +echo "${ECHO_T}$sched_xetaffinity" >&6 +if test $sched_xetaffinity = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SCHED_xETAFFINITY 1 +_ACEOF fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_raw" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_raw" >&6 - echo "$as_me:$LINENO: checking for clock_gettime() with ${check_msg}monotonic clock type" >&5 -echo $ECHO_N "checking for clock_gettime() with ${check_msg}monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_default_resolution+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking for pset functionality" >&5 +echo $ECHO_N "checking for pset functionality... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include - +#include int main () { - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); + int res; + psetid_t id = PS_MYID; + int type = PS_PRIVATE; + uint_t numcpus = 1024; + processorid_t cpulist[1024]; + + res = pset_info(id, &type, &numcpus, &cpulist[0]); ; return 0; @@ -42101,86 +34819,50 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_default_resolution=$clock_type + pset_functionality=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_monotonic_default_resolution=no +pset_functionality=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test $erl_cv_clock_gettime_monotonic_default_resolution = no || break - done - -fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_default_resolution" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_default_resolution" >&6 - +echo "$as_me:$LINENO: result: $pset_functionality" >&5 +echo "${ECHO_T}$pset_functionality" >&6 +if test $pset_functionality = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_PSET 1 +_ACEOF +fi -for ac_func in clock_getres clock_get_attributes gethrtime -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking for processor_bind functionality" >&5 +echo $ECHO_N "checking for processor_bind functionality... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif +#include +#include +#include int main () { -return f != $ac_func; + + int res = processor_bind(P_LWPID, P_MYID, PBIND_NONE, NULL); + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -42194,60 +34876,54 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + processor_bind_functionality=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +processor_bind_functionality=no fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $processor_bind_functionality" >&5 +echo "${ECHO_T}$processor_bind_functionality" >&6 +if test $processor_bind_functionality = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PROCESSOR_BIND 1 _ACEOF fi -done - - echo "$as_me:$LINENO: checking for mach clock_get_time() with monotonic clock type" >&5 -echo $ECHO_N "checking for mach clock_get_time() with monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_mach_clock_get_time_monotonic+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking for cpuset_getaffinity/cpuset_setaffinity" >&5 +echo $ECHO_N "checking for cpuset_getaffinity/cpuset_setaffinity... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +#include +#include int main () { - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); + int res; + cpuset_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(1, &cpuset); + res = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset_t), &cpuset); + res = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset_t), &cpuset); + res = CPU_ISSET(1, &cpuset); + CPU_CLR(1, &cpuset); ; return 0; @@ -42275,92 +34951,40 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_mach_clock_get_time_monotonic=yes + cpuset_xetaffinity=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_mach_clock_get_time_monotonic=no +cpuset_xetaffinity=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $cpuset_xetaffinity" >&5 +echo "${ECHO_T}$cpuset_xetaffinity" >&6 +if test $cpuset_xetaffinity = yes; then -fi -echo "$as_me:$LINENO: result: $erl_cv_mach_clock_get_time_monotonic" >&5 -echo "${ECHO_T}$erl_cv_mach_clock_get_time_monotonic" >&6 +cat >>confdefs.h <<\_ACEOF +#define HAVE_CPUSET_xETAFFINITY 1 +_ACEOF - erl_corrected_monotonic_clock=no - case $erl_cv_clock_gettime_monotonic_default_resolution-$ac_cv_func_gethrtime-$erl_cv_mach_clock_get_time_monotonic-$host_os in - *-*-*-win32) - erl_monotonic_clock_func=WindowsAPI - ;; - CLOCK_*-*-*-linux*) - case $erl_cv_clock_gettime_monotonic_default_resolution-$erl_cv_clock_gettime_monotonic_raw in - CLOCK_BOOTTIME-yes|CLOCK_MONOTONIC-yes) - erl_corrected_monotonic_clock=yes - ;; - *) - # We don't trust CLOCK_MONOTONIC to be NTP - # adjusted on linux systems that do not have - # CLOCK_MONOTONIC_RAW (although it seems to - # be...) - ;; - esac - erl_monotonic_clock_func=clock_gettime - ;; - no-no-no-linux*) - erl_monotonic_clock_func=times - ;; - CLOCK_*-*-*-*) - erl_monotonic_clock_func=clock_gettime - ;; - no-yes-*-*) - erl_monotonic_clock_func=gethrtime - ;; - no-no-yes-*) - erl_monotonic_clock_func=mach_clock_get_time - ;; - no-no-no-*) - erl_monotonic_clock_func=none - ;; - esac +fi - erl_monotonic_clock_low_resolution=no - erl_monotonic_clock_lib= - erl_monotonic_clock_id= - case $erl_monotonic_clock_func in - clock_gettime) - erl_monotonic_clock_id=$erl_cv_clock_gettime_monotonic_default_resolution - for low_res_id in $low_resolution_clock_gettime_monotonic; do - if test $erl_monotonic_clock_id = $low_res_id; then - erl_monotonic_clock_low_resolution=yes - break - fi - done - echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5 -echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6 -if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then +echo "$as_me:$LINENO: checking for 'end' symbol" >&5 +echo $ECHO_N "checking for 'end' symbol... $ECHO_C" >&6 +if test "${erts_cv_have_end_symbol+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char clock_gettime (); int main () { -clock_gettime (); +extern char end; {char *x = &end; *x= 0;} ; return 0; } @@ -42387,98 +35011,49 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_rt_clock_gettime=yes + erts_cv_have_end_symbol=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_rt_clock_gettime=no +erts_cv_have_end_symbol=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 -echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6 -if test $ac_cv_lib_rt_clock_gettime = yes; then - erl_monotonic_clock_lib="-lrt" fi +echo "$as_me:$LINENO: result: $erts_cv_have_end_symbol" >&5 +echo "${ECHO_T}$erts_cv_have_end_symbol" >&6 +if test $erts_cv_have_end_symbol = yes; then - ;; - mach_clock_get_time) - erl_monotonic_clock_id=SYSTEM_CLOCK - ;; - times) - erl_monotonic_clock_low_resolution=yes - ;; - *) - ;; - esac - -;; - *) - - if test "$prefer_elapsed_monotonic_time_during_suspend" = "yes"; then - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_BOOTTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_PRECISE" - else - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_UPTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_UPTIME_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_UPTIME_PRECISE" - fi +cat >>confdefs.h <<\_ACEOF +#define HAVE_END_SYMBOL 1 +_ACEOF - case "custom_resolution" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_monotonic="$high_resolution_clock_gettime_monotonic" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_monotonic="$low_resolution_clock_gettime_monotonic" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_monotonic="$with_clock_gettime_monotonic_id" - ;; - *) - check_msg="custom " - prefer_resolution_clock_gettime_monotonic="$with_clock_gettime_monotonic_id" - ;; - esac +fi - echo "$as_me:$LINENO: checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)" >&5 -echo $ECHO_N "checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_raw+set}" = set; then +echo "$as_me:$LINENO: checking for '_end' symbol" >&5 +echo $ECHO_N "checking for '_end' symbol... $ECHO_C" >&6 +if test "${erts_cv_have__end_symbol+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - int main () { - - struct timespec ts; - long long result; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - +extern char _end; {char *x = &_end; *x= 0;} ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -42492,225 +35067,246 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_raw=yes + erts_cv_have__end_symbol=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_monotonic_raw=no +erts_cv_have__end_symbol=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $erts_cv_have__end_symbol" >&5 +echo "${ECHO_T}$erts_cv_have__end_symbol" >&6 +if test $erts_cv_have__end_symbol = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE__END_SYMBOL 1 +_ACEOF fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_raw" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_raw" >&6 - echo "$as_me:$LINENO: checking for clock_gettime() with ${check_msg}monotonic clock type" >&5 -echo $ECHO_N "checking for clock_gettime() with ${check_msg}monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_custom_resolution+set}" = set; then +echo "$as_me:$LINENO: checking if __after_morecore_hook can track malloc()s core memory use" >&5 +echo $ECHO_N "checking if __after_morecore_hook can track malloc()s core memory use... $ECHO_C" >&6 +if test "${erts_cv___after_morecore_hook_can_track_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + if test "$cross_compiling" = yes; then + + case X$erl_xcomp_after_morecore_hook in + X) erts_cv___after_morecore_hook_can_track_malloc=cross;; + Xyes|Xno) erts_cv___after_morecore_hook_can_track_malloc=$erl_xcomp_after_morecore_hook;; + *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_after_morecore_hook value: $erl_xcomp_after_morecore_hook" >&5 +echo "$as_me: error: Bad erl_xcomp_after_morecore_hook value: $erl_xcomp_after_morecore_hook" >&2;} + { (exit 1); exit 1; }; };; + esac - for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - cat >conftest.$ac_ext <<_ACEOF + +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include +#ifdef HAVE_MALLOC_H +# include +#endif +#if defined(HAVE_END_SYMBOL) +extern char end; +#elif defined(HAVE__END_SYMBOL) +extern char _end; +#endif +#ifndef USE_THREADS +#undef ETHR_PTHREADS +#endif -int -main () -{ +#ifdef ETHR_PTHREADS +# ifdef ETHR_HAVE_PTHREAD_H +# include +# else +# ifdef ETHR_HAVE_MIT_PTHREAD_H +# include +# endif +# endif +# define N_THR 5 +#else +# define N_THR 1 +#endif - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); +static char *heap_start = NULL; +static char *heap_end = NULL; - ; - return 0; +void update_heap_size(void) +{ + heap_end = (char *) sbrk(0); } -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_custom_resolution=$clock_type -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -erl_cv_clock_gettime_monotonic_custom_resolution=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test $erl_cv_clock_gettime_monotonic_custom_resolution = no || break - done -fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_custom_resolution" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_custom_resolution" >&6 +void init_hook(void) +{ +#if defined(HAVE_END_SYMBOL) + heap_start = &end; +#elif defined(HAVE__END_SYMBOL) + heap_start = &_end; +#else + heap_start = sbrk(0); +#endif + __after_morecore_hook = update_heap_size; +} +void (*__malloc_initialize_hook) (void) = init_hook; +static int +check_malloc(int size) +{ + char *p = (char *) malloc(size); + if (!heap_start || !heap_end) return 0; + if (!p) return 0; + if (p < heap_start || heap_end <= p) return 0; + if (p + size < heap_start || heap_end < p + size) return 0; + return 1; +} +#ifdef ETHR_PTHREADS +pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +#endif -for ac_func in clock_getres clock_get_attributes gethrtime -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func +static void * +do_tests(void *vresp) +{ + int i, ok = 0; +#ifdef ETHR_PTHREADS + if (pthread_mutex_lock(&mutex) != 0) + return NULL; +#endif -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ + for (i = 0; i < 10; i++) + if (!check_malloc(1000)) + goto failed; + for (i = 0; i < 100; i++) + if (!check_malloc(1)) + goto failed; + if (!check_malloc(1024*1024+1)) + goto failed; + if (!check_malloc(10*1024*1024+1)) + goto failed; + ok = 1; -#ifdef __STDC__ -# include -#else -# include + failed: +#ifdef ETHR_PTHREADS + if (pthread_mutex_unlock(&mutex) != 0) + return NULL; #endif + if (ok) + *((int *) vresp) = 0; + return NULL; +} -#undef $ac_func -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" +int main(void) { + int res[N_THR], i; +#ifdef ETHR_PTHREADS + pthread_t tid[N_THR]; #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} + +#if defined(HAVE_MALLOPT) && defined(M_MMAP_MAX) + (void) mallopt(M_MMAP_MAX, 0); #endif -int -main () -{ -return f != $ac_func; - ; - return 0; + for (i = 0; i < N_THR; i++) + res[i] = 1; +#ifdef ETHR_PTHREADS + for (i = 1; i < N_THR; i++) + if (pthread_create(&tid[i], NULL, do_tests, &res[i]) != 0) + return 1; +#endif + (void) do_tests(&res[0]); +#ifdef ETHR_PTHREADS + for (i = 1; i < N_THR; i++) + if (pthread_join(tid[i], NULL) != 0) + return 1; +#endif + for (i = 0; i < N_THR; i++) + if (res[i]) + return 1; + return 0; } + _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + erts_cv___after_morecore_hook_can_track_malloc=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +( exit $ac_status ) +erts_cv___after_morecore_hook_can_track_malloc=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - fi -done +echo "$as_me:$LINENO: result: $erts_cv___after_morecore_hook_can_track_malloc" >&5 +echo "${ECHO_T}$erts_cv___after_morecore_hook_can_track_malloc" >&6 +case $erts_cv___after_morecore_hook_can_track_malloc in + yes) +cat >>confdefs.h <<\_ACEOF +#define ERTS___AFTER_MORECORE_HOOK_CAN_TRACK_MALLOC 1 +_ACEOF +;; + cross) { echo "$as_me:$LINENO: WARNING: result no guessed because of cross compilation" >&5 +echo "$as_me: WARNING: result no guessed because of cross compilation" >&2;};; + *) ;; +esac - echo "$as_me:$LINENO: checking for mach clock_get_time() with monotonic clock type" >&5 -echo $ECHO_N "checking for mach clock_get_time() with monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_mach_clock_get_time_monotonic+set}" = set; then +if test "x$ac_cv_func_sbrk" = "xyes"; then + echo "$as_me:$LINENO: checking types of sbrk()s return value and argument" >&5 +echo $ECHO_N "checking types of sbrk()s return value and argument... $ECHO_C" >&6 +if test "${erts_cv_sbrk_ret_arg_types+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + + erts_cv_sbrk_ret_arg_types=unknown + ret_types="void *,char *" + arg_types="intptr_t,ptrdiff_t,int,long" + save_ifs="$IFS"; IFS="," + for rtype in $ret_types; do + for atype in $arg_types; do + IFS=$save_ifs + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#include - +#include + #include int main () { - - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - +$rtype sbrk($atype incr); ; return 0; } @@ -42737,99 +35333,77 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_mach_clock_get_time_monotonic=yes + erts_cv_sbrk_ret_arg_types="$rtype,$atype" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_mach_clock_get_time_monotonic=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - + IFS="," + if test "$erts_cv_sbrk_ret_arg_types" != "unknown"; then + break 2 + fi + done + done + IFS=$save_ifs fi -echo "$as_me:$LINENO: result: $erl_cv_mach_clock_get_time_monotonic" >&5 -echo "${ECHO_T}$erl_cv_mach_clock_get_time_monotonic" >&6 +echo "$as_me:$LINENO: result: $erts_cv_sbrk_ret_arg_types" >&5 +echo "${ECHO_T}$erts_cv_sbrk_ret_arg_types" >&6 - erl_corrected_monotonic_clock=no - case $erl_cv_clock_gettime_monotonic_custom_resolution-$ac_cv_func_gethrtime-$erl_cv_mach_clock_get_time_monotonic-$host_os in - *-*-*-win32) - erl_monotonic_clock_func=WindowsAPI - ;; - CLOCK_*-*-*-linux*) - case $erl_cv_clock_gettime_monotonic_custom_resolution-$erl_cv_clock_gettime_monotonic_raw in - CLOCK_BOOTTIME-yes|CLOCK_MONOTONIC-yes) - erl_corrected_monotonic_clock=yes - ;; - *) - # We don't trust CLOCK_MONOTONIC to be NTP - # adjusted on linux systems that do not have - # CLOCK_MONOTONIC_RAW (although it seems to - # be...) - ;; - esac - erl_monotonic_clock_func=clock_gettime - ;; - no-no-no-linux*) - erl_monotonic_clock_func=times - ;; - CLOCK_*-*-*-*) - erl_monotonic_clock_func=clock_gettime - ;; - no-yes-*-*) - erl_monotonic_clock_func=gethrtime - ;; - no-no-yes-*) - erl_monotonic_clock_func=mach_clock_get_time - ;; - no-no-no-*) - erl_monotonic_clock_func=none - ;; - esac + if test "$erts_cv_sbrk_ret_arg_types" != "unknown"; then + save_ifs="$IFS"; IFS="," + read ret_type arg_type <&5 -echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6 -if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then +cat >>confdefs.h <<_ACEOF +#define SBRK_RET_TYPE $ret_type +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SBRK_ARG_TYPE $arg_type +_ACEOF + + fi +fi + +if test $ac_cv_func_brk = yes; then + echo "$as_me:$LINENO: checking types of brk()s return value and argument" >&5 +echo $ECHO_N "checking types of brk()s return value and argument... $ECHO_C" >&6 +if test "${erts_cv_brk_ret_arg_types+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat >conftest.$ac_ext <<_ACEOF + + + erts_cv_brk_ret_arg_types=unknown + ret_types="int,long,char *,void *" + arg_types="void *,const void *,char *,const char *" + save_ifs="$IFS"; IFS="," + for rtype in $ret_types; do + for atype in $arg_types; do + IFS=$save_ifs + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char clock_gettime (); +#include + #include int main () { -clock_gettime (); +$rtype brk($atype endds); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -42843,181 +35417,312 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_rt_clock_gettime=yes + erts_cv_brk_ret_arg_types="$rtype,$atype" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_rt_clock_gettime=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 -echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6 -if test $ac_cv_lib_rt_clock_gettime = yes; then - erl_monotonic_clock_lib="-lrt" +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + IFS="," + if test "$erts_cv_brk_ret_arg_types" != "unknown"; then + break 2 + fi + done + done + IFS=$save_ifs fi +echo "$as_me:$LINENO: result: $erts_cv_brk_ret_arg_types" >&5 +echo "${ECHO_T}$erts_cv_brk_ret_arg_types" >&6 - ;; - mach_clock_get_time) - erl_monotonic_clock_id=SYSTEM_CLOCK - ;; - times) - erl_monotonic_clock_low_resolution=yes - ;; - *) - ;; - esac - -;; -esac + if test "$erts_cv_brk_ret_arg_types" != "unknown"; then + save_ifs="$IFS"; IFS="," + read ret_type arg_type <&5 -echo "$as_me: error: $with_clock_gettime_monotonic_id as clock id to clock_gettime() doesn't compile" >&2;} - { (exit 1); exit 1; }; } - ;; -esac +cat >>confdefs.h <<_ACEOF +#define BRK_RET_TYPE $ret_type +_ACEOF -case $erl_monotonic_clock_func in - times) -cat >>confdefs.h <<\_ACEOF -#define OS_MONOTONIC_TIME_USING_TIMES 1 +cat >>confdefs.h <<_ACEOF +#define BRK_ARG_TYPE $arg_type _ACEOF - ;; - mach_clock_get_time) + fi -cat >>confdefs.h <<\_ACEOF -#define OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME 1 -_ACEOF +fi - ;; - clock_gettime) +if test $ac_cv_func_sbrk = yes; then -cat >>confdefs.h <<\_ACEOF -#define OS_MONOTONIC_TIME_USING_CLOCK_GETTIME 1 -_ACEOF + echo "$as_me:$LINENO: checking if sbrk()/brk() wrappers can track malloc()s core memory use" >&5 +echo $ECHO_N "checking if sbrk()/brk() wrappers can track malloc()s core memory use... $ECHO_C" >&6 +if test "${erts_cv_brk_wrappers_can_track_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then - ;; - gethrtime) + case X$erl_xcomp_dlsym_brk_wrappers in + X) erts_cv_brk_wrappers_can_track_malloc=cross;; + Xyes|Xno) erts_cv_brk_wrappers_can_track_malloc=$erl_xcomp_dlsym_brk_wrappers;; + *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_dlsym_brk_wrappers value: $erl_xcomp_dlsym_brk_wrappers" >&5 +echo "$as_me: error: Bad erl_xcomp_dlsym_brk_wrappers value: $erl_xcomp_dlsym_brk_wrappers" >&2;} + { (exit 1); exit 1; }; };; + esac -cat >>confdefs.h <<\_ACEOF -#define OS_MONOTONIC_TIME_USING_GETHRTIME 1 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - ;; - *) - ;; -esac +#include +#include +#include +#ifdef HAVE_DLFCN_H +# include +#endif -if test $erl_corrected_monotonic_clock = yes; then +/* + * Our implementation requires that we have sbrk(), and 'end' or '_end'. + */ -cat >>confdefs.h <<\_ACEOF -#define ERTS_HAVE_CORRECTED_OS_MONOTONIC_TIME 1 -_ACEOF +#if !defined(HAVE_SBRK) +# error no sbrk() +#endif +#if defined(HAVE_END_SYMBOL) +extern char end; +#elif defined(HAVE__END_SYMBOL) +extern char _end; +#else +# error no 'end' nor '_end' +#endif -fi +#ifndef USE_THREADS +#undef ETHR_PTHREADS +#endif -if test $erl_monotonic_clock_low_resolution = yes; then +#ifdef ETHR_PTHREADS +# ifdef ETHR_HAVE_PTHREAD_H +# include +# else +# ifdef ETHR_HAVE_MIT_PTHREAD_H +# include +# endif +# endif +# define N_THR 5 +#else +# define N_THR 1 +#endif -cat >>confdefs.h <<\_ACEOF -#define ERTS_HAVE_LOW_RESOLUTION_OS_MONOTONIC_LOW 1 -_ACEOF +#define SBRK_IMPL(RET_TYPE, SBRK, ARG_TYPE) \ +RET_TYPE SBRK (ARG_TYPE); \ +static RET_TYPE (*real_ ## SBRK)(ARG_TYPE) = NULL; \ +RET_TYPE \ +SBRK (ARG_TYPE arg) \ +{ \ + RET_TYPE res; \ + if (!real_ ## SBRK) real_ ## SBRK = dlsym(RTLD_NEXT, #SBRK); \ + res = (*real_ ## SBRK)(arg); \ + if (res != (RET_TYPE) -1) heap_end = (char *) (*real_ ## SBRK)(0); \ + return res; \ +} -fi +#define BRK_IMPL(RET_TYPE, BRK, ARG_TYPE) \ +RET_TYPE BRK (ARG_TYPE); \ +static RET_TYPE (*real_ ## BRK)(ARG_TYPE) = NULL; \ +RET_TYPE \ +BRK (ARG_TYPE arg) \ +{ \ + RET_TYPE res; \ + if (!real_ ## BRK) real_ ## BRK = dlsym(RTLD_NEXT, #BRK); \ + res = (*real_ ## BRK)(arg); \ + if (res != (RET_TYPE) -1) heap_end = (char *) arg; \ + return res; \ +} -xrtlib="$erl_monotonic_clock_lib" -if test "x$erl_monotonic_clock_id" != "x"; then +static char *heap_start = NULL; +static char *heap_end = NULL; -cat >>confdefs.h <<_ACEOF -#define MONOTONIC_CLOCK_ID_STR "$erl_monotonic_clock_id" -_ACEOF +SBRK_IMPL(SBRK_RET_TYPE, sbrk, SBRK_ARG_TYPE) +#ifdef HAVE_BRK + BRK_IMPL(BRK_RET_TYPE, brk, BRK_ARG_TYPE) +#endif +#ifdef HAVE__SBRK + SBRK_IMPL(SBRK_RET_TYPE, _sbrk, SBRK_ARG_TYPE) +#endif +#ifdef HAVE__BRK + BRK_IMPL(BRK_RET_TYPE, _brk, BRK_ARG_TYPE) +#endif -cat >>confdefs.h <<_ACEOF -#define MONOTONIC_CLOCK_ID $erl_monotonic_clock_id -_ACEOF +#ifdef HAVE___SBRK + SBRK_IMPL(SBRK_RET_TYPE, __sbrk, SBRK_ARG_TYPE) +#endif +#ifdef HAVE___BRK + BRK_IMPL(BRK_RET_TYPE, __brk, BRK_ARG_TYPE) +#endif -fi +static int +check_malloc(int size) +{ + char *p = (char *) malloc(size); + if (!heap_start || !heap_end) return 0; + if (!p) return 0; + if (p < heap_start || heap_end <= p) return 0; + if (p + size < heap_start || heap_end < p + size) return 0; + return 1; +} -if test $erl_cv_clock_gettime_monotonic_raw = yes; then +#ifdef ETHR_PTHREADS +pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +#endif + +static void * +do_tests(void *vresp) +{ + int i, ok = 0; +#ifdef ETHR_PTHREADS + if (pthread_mutex_lock(&mutex) != 0) + return NULL; +#endif + + for (i = 0; i < 10; i++) + if (!check_malloc(1000)) + goto failed; + for (i = 0; i < 100; i++) + if (!check_malloc(1)) + goto failed; + if (!check_malloc(1024*1024+1)) + goto failed; + if (!check_malloc(10*1024*1024+1)) + goto failed; + ok = 1; + + failed: +#ifdef ETHR_PTHREADS + if (pthread_mutex_unlock(&mutex) != 0) + return NULL; +#endif + if (ok) + *((int *) vresp) = 0; + return NULL; +} + + +int main(void) +{ + int res[N_THR], i; +#ifdef ETHR_PTHREADS + pthread_t tid[N_THR]; +#endif +#if defined(HAVE_END_SYMBOL) + heap_start = &end; +#elif defined(HAVE__END_SYMBOL) + heap_start = &_end; +#endif + +#if defined(HAVE_MALLOPT) && defined(M_MMAP_MAX) + (void) mallopt(M_MMAP_MAX, 0); +#endif + + for (i = 0; i < N_THR; i++) + res[i] = 1; +#ifdef ETHR_PTHREADS + for (i = 1; i < N_THR; i++) + if (pthread_create(&tid[i], NULL, do_tests, &res[i]) != 0) + return 1; +#endif + (void) do_tests(&res[0]); +#ifdef ETHR_PTHREADS + for (i = 1; i < N_THR; i++) + if (pthread_join(tid[i], NULL) != 0) + return 1; +#endif + for (i = 0; i < N_THR; i++) + if (res[i]) + return 1; + return 0; +} -cat >>confdefs.h <<\_ACEOF -#define HAVE_CLOCK_GETTIME_MONOTONIC_RAW 1 _ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + erts_cv_brk_wrappers_can_track_malloc=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +erts_cv_brk_wrappers_can_track_malloc=no fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $erts_cv_brk_wrappers_can_track_malloc" >&5 +echo "${ECHO_T}$erts_cv_brk_wrappers_can_track_malloc" >&6 + case $erts_cv_brk_wrappers_can_track_malloc in + yes) +cat >>confdefs.h <<\_ACEOF +#define ERTS_BRK_WRAPPERS_CAN_TRACK_MALLOC 1 +_ACEOF +;; + cross) + { echo "$as_me:$LINENO: WARNING: result no guessed because of cross compilation" >&5 +echo "$as_me: WARNING: result no guessed because of cross compilation" >&2;};; + *) ;; + esac +fi - if test "no" = "yes"; then - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_BOOTTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_PRECISE" - else - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_UPTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_UPTIME_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_UPTIME_PRECISE" - fi - - case "high_resolution" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_monotonic="$high_resolution_clock_gettime_monotonic" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_monotonic="$low_resolution_clock_gettime_monotonic" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_monotonic="undefined" - ;; - *) - check_msg="custom " - prefer_resolution_clock_gettime_monotonic="undefined" - ;; - esac +LIBS=$saved_libs +CPPFLAGS=$saved_cppflags - echo "$as_me:$LINENO: checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)" >&5 -echo $ECHO_N "checking for clock_gettime(CLOCK_MONOTONIC_RAW, _)... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_raw+set}" = set; then +echo "$as_me:$LINENO: checking for IP version 6 support" >&5 +echo $ECHO_N "checking for IP version 6 support... $ECHO_C" >&6 +if test "${ac_cv_sys_ipv6_support+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + ok_so_far=yes + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include - +#include +#ifdef __WIN32__ +#include +#include +#elif __OSE__ +#error "no ipv6" +#else +#include +#endif int main () { - - struct timespec ts; - long long result; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - +struct in6_addr a6; struct sockaddr_in6 s6; ; return 0; } @@ -43044,45 +35749,37 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_raw=yes + ok_so_far=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_monotonic_raw=no +ok_so_far=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_raw" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_raw" >&6 - - echo "$as_me:$LINENO: checking for clock_gettime() with ${check_msg}monotonic clock type" >&5 -echo $ECHO_N "checking for clock_gettime() with ${check_msg}monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_clock_gettime_monotonic_high_resolution+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if test $ok_so_far = yes; then + ac_cv_sys_ipv6_support=yes else - - for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include - +#include +#ifdef __WIN32__ +#include +#include +#elif __OSE__ +#error "no ipv6" +#else +#include +#endif int main () { - - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - +struct in_addr6 a6; struct sockaddr_in6 s6; ; return 0; } @@ -43109,30 +35806,52 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_clock_gettime_monotonic_high_resolution=$clock_type + ac_cv_sys_ipv6_support=in_addr6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_clock_gettime_monotonic_high_resolution=no +ac_cv_sys_ipv6_support=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test $erl_cv_clock_gettime_monotonic_high_resolution = no || break - done +fi fi -echo "$as_me:$LINENO: result: $erl_cv_clock_gettime_monotonic_high_resolution" >&5 -echo "${ECHO_T}$erl_cv_clock_gettime_monotonic_high_resolution" >&6 +case ${ac_cv_sys_ipv6_support} in + yes) + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +cat >>confdefs.h <<\_ACEOF +#define HAVE_IN6 1 +_ACEOF -for ac_func in clock_getres clock_get_attributes gethrtime -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then + ;; + in_addr6) + echo "$as_me:$LINENO: result: yes (but I am redefining in_addr6 to in6_addr)" >&5 +echo "${ECHO_T}yes (but I am redefining in_addr6 to in6_addr)" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_IN6 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_IN_ADDR6_STRUCT +_ACEOF + + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; +esac + +echo "$as_me:$LINENO: checking for multicast support" >&5 +echo $ECHO_N "checking for multicast support... $ECHO_C" >&6 +if test "${ac_cv_sys_multicast_support+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -43141,12 +35860,51 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. +#include +#include +#include +#if defined(IP_MULTICAST_TTL) && defined(IP_MULTICAST_LOOP) && defined(IP_MULTICAST_IF) && defined(IP_ADD_MEMBERSHIP) && defined(IP_DROP_MEMBERSHIP) +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + ac_cv_sys_multicast_support=yes +else + ac_cv_sys_multicast_support=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_multicast_support" >&5 +echo "${ECHO_T}$ac_cv_sys_multicast_support" >&6 +if test $ac_cv_sys_multicast_support = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MULTICAST_SUPPORT 1 +_ACEOF + +fi + +if test x$ac_cv_func_gethrtime = x; then + echo "$as_me:$LINENO: checking for gethrtime" >&5 +echo $ECHO_N "checking for gethrtime... $ECHO_C" >&6 +if test "${ac_cv_func_gethrtime+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define gethrtime to an innocuous variant, in case declares gethrtime. For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func +#define gethrtime innocuous_gethrtime /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. + which can conflict with char gethrtime (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ @@ -43156,7 +35914,7 @@ # include #endif -#undef $ac_func +#undef gethrtime /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -43165,14 +35923,14 @@ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func (); +char gethrtime (); /* 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_$ac_func) || defined (__stub___$ac_func) +#if defined (__stub_gethrtime) || defined (__stub___gethrtime) choke me #else -char (*f) () = $ac_func; +char (*f) () = gethrtime; #endif #ifdef __cplusplus } @@ -43181,7 +35939,7 @@ int main () { -return f != $ac_func; +return f != gethrtime; ; return 0; } @@ -43208,55 +35966,36 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_func_gethrtime=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_func_gethrtime=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +echo "$as_me:$LINENO: result: $ac_cv_func_gethrtime" >&5 +echo "${ECHO_T}$ac_cv_func_gethrtime" >&6 fi -done - - - echo "$as_me:$LINENO: checking for mach clock_get_time() with monotonic clock type" >&5 -echo $ECHO_N "checking for mach clock_get_time() with monotonic clock type... $ECHO_C" >&6 -if test "${erl_cv_mach_clock_get_time_monotonic+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF +if test x$clock_gettime_correction = xunknown; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#include - +#include int main () { - - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - +struct timespec ts; + long long result; + clock_gettime(CLOCK_MONOTONIC,&ts); + result = ((long long) ts.tv_sec) * 1000000000LL + + ((long long) ts.tv_nsec); ; return 0; } @@ -43283,201 +36022,106 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_cv_mach_clock_get_time_monotonic=yes + clock_gettime_compiles=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -erl_cv_mach_clock_get_time_monotonic=no +clock_gettime_compiles=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - +else + clock_gettime_compiles=no fi -echo "$as_me:$LINENO: result: $erl_cv_mach_clock_get_time_monotonic" >&5 -echo "${ECHO_T}$erl_cv_mach_clock_get_time_monotonic" >&6 - erl_corrected_monotonic_clock=no - case $erl_cv_clock_gettime_monotonic_high_resolution-$ac_cv_func_gethrtime-$erl_cv_mach_clock_get_time_monotonic-$host_os in - *-*-*-win32) - erl_monotonic_clock_func=WindowsAPI - ;; - CLOCK_*-*-*-linux*) - case $erl_cv_clock_gettime_monotonic_high_resolution-$erl_cv_clock_gettime_monotonic_raw in - CLOCK_BOOTTIME-yes|CLOCK_MONOTONIC-yes) - erl_corrected_monotonic_clock=yes - ;; - *) - # We don't trust CLOCK_MONOTONIC to be NTP - # adjusted on linux systems that do not have - # CLOCK_MONOTONIC_RAW (although it seems to - # be...) - ;; - esac - erl_monotonic_clock_func=clock_gettime - ;; - no-no-no-linux*) - erl_monotonic_clock_func=times - ;; - CLOCK_*-*-*-*) - erl_monotonic_clock_func=clock_gettime - ;; - no-yes-*-*) - erl_monotonic_clock_func=gethrtime - ;; - no-no-yes-*) - erl_monotonic_clock_func=mach_clock_get_time - ;; - no-no-no-*) - erl_monotonic_clock_func=none - ;; - esac - erl_monotonic_clock_low_resolution=no - erl_monotonic_clock_lib= - erl_monotonic_clock_id= - case $erl_monotonic_clock_func in - clock_gettime) - erl_monotonic_clock_id=$erl_cv_clock_gettime_monotonic_high_resolution - for low_res_id in $low_resolution_clock_gettime_monotonic; do - if test $erl_monotonic_clock_id = $low_res_id; then - erl_monotonic_clock_low_resolution=yes - break - fi - done - echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5 -echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6 -if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then +echo "$as_me:$LINENO: checking how to correct for time adjustments" >&5 +echo $ECHO_N "checking how to correct for time adjustments... $ECHO_C" >&6 +if test "${erl_cv_time_correction+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char clock_gettime (); -int -main () -{ -clock_gettime (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_rt_clock_gettime=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +case $clock_gettime_correction in + yes) + erl_cv_time_correction=clock_gettime;; + no|unknown) + case $ac_cv_func_gethrtime in + yes) + erl_cv_time_correction=hrtime ;; + no) + case $host_os in + linux*) + case $clock_gettime_correction in + unknown) + if test x$clock_gettime_compiles = xyes; then + if test X$cross_compiling != Xyes; then + linux_kernel_vsn_=`uname -r` + case $linux_kernel_vsn_ in + [0-1].*|2.[0-5]|2.[0-5].*) + erl_cv_time_correction=times ;; + *) + erl_cv_time_correction=clock_gettime;; + esac + else + case X$erl_xcomp_linux_clock_gettime_correction in + X) + erl_cv_time_correction=cross;; + Xyes|Xno) + if test $erl_xcomp_linux_clock_gettime_correction = yes; then + erl_cv_time_correction=clock_gettime + else + erl_cv_time_correction=times + fi;; + *) + { { echo "$as_me:$LINENO: error: Bad erl_xcomp_linux_clock_gettime_correction value: $erl_xcomp_linux_clock_gettime_correction" >&5 +echo "$as_me: error: Bad erl_xcomp_linux_clock_gettime_correction value: $erl_xcomp_linux_clock_gettime_correction" >&2;} + { (exit 1); exit 1; }; };; + esac + fi + else + erl_cv_time_correction=times + fi + ;; + *) + erl_cv_time_correction=times ;; + esac + ;; + *) + erl_cv_time_correction=none ;; + esac + ;; + esac + ;; +esac -ac_cv_lib_rt_clock_gettime=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 -echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6 -if test $ac_cv_lib_rt_clock_gettime = yes; then - erl_monotonic_clock_lib="-lrt" fi +echo "$as_me:$LINENO: result: $erl_cv_time_correction" >&5 +echo "${ECHO_T}$erl_cv_time_correction" >&6 - ;; - mach_clock_get_time) - erl_monotonic_clock_id=SYSTEM_CLOCK - ;; - times) - erl_monotonic_clock_low_resolution=yes - ;; - *) - ;; - esac - - - -case $$erl_monotonic_clock_low_resolution-$erl_monotonic_clock_func in - no-mach_clock_get_time) - monotonic_hrtime=yes - -cat >>confdefs.h <<\_ACEOF -#define SYS_HRTIME_USING_MACH_CLOCK_GET_TIME 1 -_ACEOF - - ;; - no-clock_gettime) - monotonic_hrtime=yes +xrtlib="" +case $erl_cv_time_correction in + times) cat >>confdefs.h <<\_ACEOF -#define SYS_HRTIME_USING_CLOCK_GETTIME 1 +#define CORRECT_USING_TIMES _ACEOF ;; - no-gethrtime) - monotonic_hrtime=yes + clock_gettime|cross) + if test $erl_cv_time_correction = cross; then + erl_cv_time_correction=clock_gettime + { echo "$as_me:$LINENO: WARNING: result clock_gettime guessed because of cross compilation" >&5 +echo "$as_me: WARNING: result clock_gettime guessed because of cross compilation" >&2;} + fi + xrtlib="-lrt" cat >>confdefs.h <<\_ACEOF -#define SYS_HRTIME_USING_GETHRTIME 1 +#define GETHRTIME_WITH_CLOCK_GETTIME 1 _ACEOF ;; - *) - monotonic_hrtime=no - ;; esac -if test $monotonic_hrtime = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MONOTONIC_ERTS_SYS_HRTIME 1 -_ACEOF - -fi - -if test "x$erl_monotonic_clock_id" != "x"; then - -cat >>confdefs.h <<_ACEOF -#define HRTIME_CLOCK_ID_STR "$erl_monotonic_clock_id" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define HRTIME_CLOCK_ID $erl_monotonic_clock_id -_ACEOF - -fi - - - echo "$as_me:$LINENO: checking if gethrvtime works and how to use it" >&5 echo $ECHO_N "checking if gethrvtime works and how to use it... $ECHO_C" >&6 if test "$cross_compiling" = yes; then @@ -43577,7 +36221,6 @@ rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -LIBRT=$xrtlib case $erl_gethrvtime in procfs_ioctl) @@ -43608,8 +36251,8 @@ if test "$cross_compiling" = yes; then case X$erl_xcomp_clock_gettime_cpu_time in - X) erl_clock_gettime_cpu_time=cross;; - Xyes|Xno) erl_clock_gettime_cpu_time=$erl_xcomp_clock_gettime_cpu_time;; + X) erl_clock_gettime=cross;; + Xyes|Xno) erl_clock_gettime=$erl_xcomp_clock_gettime_cpu_time;; *) { { echo "$as_me:$LINENO: error: Bad erl_xcomp_clock_gettime_cpu_time value: $erl_xcomp_clock_gettime_cpu_time" >&5 echo "$as_me: error: Bad erl_xcomp_clock_gettime_cpu_time value: $erl_xcomp_clock_gettime_cpu_time" >&2;} { (exit 1); exit 1; }; };; @@ -43658,41 +36301,52 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - erl_clock_gettime_cpu_time=yes + erl_clock_gettime=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -erl_clock_gettime_cpu_time=no +erl_clock_gettime=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi LIBS=$save_libs - echo "$as_me:$LINENO: result: $erl_clock_gettime_cpu_time" >&5 -echo "${ECHO_T}$erl_clock_gettime_cpu_time" >&6 - case $erl_clock_gettime_cpu_time in - yes) + case $host_os in + linux*) + echo "$as_me:$LINENO: result: no; not stable" >&5 +echo "${ECHO_T}no; not stable" >&6 + LIBRT=$xrtlib + ;; + *) + echo "$as_me:$LINENO: result: $erl_clock_gettime" >&5 +echo "${ECHO_T}$erl_clock_gettime" >&6 + case $erl_clock_gettime in + yes) cat >>confdefs.h <<\_ACEOF -#define HAVE_CLOCK_GETTIME_CPU_TIME +#define HAVE_CLOCK_GETTIME _ACEOF - LIBRT=-lrt - ;; - cross) - erl_clock_gettime_cpu_time=no - { echo "$as_me:$LINENO: WARNING: result no guessed because of cross compilation" >&5 + LIBRT=-lrt + ;; + cross) + erl_clock_gettime=no + { echo "$as_me:$LINENO: WARNING: result no guessed because of cross compilation" >&5 echo "$as_me: WARNING: result no guessed because of cross compilation" >&2;} - ;; - *) + LIBRT=$xrtlib + ;; + *) + LIBRT=$xrtlib + ;; + esac ;; esac + ;; esac - # Extract the first word of "m4", so it can be a program name with args. set dummy m4; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -43900,10 +36554,6 @@ #include #include -#if defined(__clang__) || defined(__llvm__) -#error "Clang/LLVM generates broken code for FP exceptions" -#endif - volatile int erl_fp_exception; /* @@ -44511,6 +37161,90 @@ # +# Check if HiPE should use a standard installation of perfctr. +# + +if test "x$HIPE_ENABLED" = "xyes" ; then + if test "x$with_perfctr" = "x" ; then + echo "$as_me:$LINENO: checking for vperfctr_info in -lperfctr" >&5 +echo $ECHO_N "checking for vperfctr_info in -lperfctr... $ECHO_C" >&6 +if test "${ac_cv_lib_perfctr_vperfctr_info+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lperfctr $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vperfctr_info (); +int +main () +{ +vperfctr_info (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_perfctr_vperfctr_info=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_perfctr_vperfctr_info=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_perfctr_vperfctr_info" >&5 +echo "${ECHO_T}$ac_cv_lib_perfctr_vperfctr_info" >&6 +if test $ac_cv_lib_perfctr_vperfctr_info = yes; then + USE_PERFCTR=1 + +cat >>confdefs.h <<\_ACEOF +#define USE_PERFCTR 1 +_ACEOF + +fi + + elif test "x$with_perfctr" != "xno" ; then + USE_PERFCTR=1 + fi +fi + +# # Check for working poll(). # echo "$as_me:$LINENO: checking for working poll()" >&5 @@ -45238,7 +37972,7 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_prog_emu_cc="$CC" + ac_cv_prog_emu_cc=$CC else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -45247,29 +37981,29 @@ fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -if test "$ac_cv_prog_emu_cc" = no; then +if test $ac_cv_prog_emu_cc = no; then for ac_progname in emu_cc.sh gcc-4.2 gcc; do IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_progname"; then - ac_cv_prog_emu_cc="$ac_dir/$ac_progname" + if test -f $ac_dir/$ac_progname; then + ac_cv_prog_emu_cc=$ac_dir/$ac_progname break fi done IFS="$ac_save_ifs" - if test "$ac_cv_prog_emu_cc" != no; then + if test $ac_cv_prog_emu_cc != no; then break fi done fi -if test "$ac_cv_prog_emu_cc" != no; then - save_CC="$CC" +if test $ac_cv_prog_emu_cc != no; then + save_CC=$CC save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS - CC="$ac_cv_prog_emu_cc" + CC=$ac_cv_prog_emu_cc CFLAGS="" CPPFLAGS="" cat >conftest.$ac_ext <<_ACEOF @@ -45327,7 +38061,7 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_prog_emu_cc="$CC" + ac_cv_prog_emu_cc=$CC else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -45343,15 +38077,15 @@ fi echo "$as_me:$LINENO: result: $ac_cv_prog_emu_cc" >&5 echo "${ECHO_T}$ac_cv_prog_emu_cc" >&6 -if test "$ac_cv_prog_emu_cc" = no; then +if test $ac_cv_prog_emu_cc = no; then cat >>confdefs.h <<\_ACEOF #define NO_JUMP_TABLE _ACEOF - EMU_CC="$CC" + EMU_CC=$CC else - EMU_CC="$ac_cv_prog_emu_cc" + EMU_CC=$ac_cv_prog_emu_cc fi @@ -45681,7 +38415,6 @@ fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - $RM -f foo-dtrace.h if test "x$DTRACE_ENABLED_2STEP" = "xyes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 @@ -45813,37 +38546,6 @@ fi; - -# Check whether --with-ssl-incl or --without-ssl-incl was given. -if test "${with_ssl_incl+set}" = set; then - withval="$with_ssl_incl" - -case X$with_ssl in - X | Xyes | Xno) { { echo "$as_me:$LINENO: error: --with-ssl-incl=PATH set without --with-ssl=PATH" >&5 -echo "$as_me: error: --with-ssl-incl=PATH set without --with-ssl=PATH" >&2;} - { (exit 1); exit 1; }; };; -esac - -else - with_ssl_incl=$with_ssl -fi; #default - - -# Check whether --with-ssl-rpath or --without-ssl-rpath was given. -if test "${with_ssl_rpath+set}" = set; then - withval="$with_ssl_rpath" - -case X$with_ssl in - Xno) { { echo "$as_me:$LINENO: error: --with-ssl-rpath set without --with-ssl" >&5 -echo "$as_me: error: --with-ssl-rpath set without --with-ssl" >&2;} - { (exit 1); exit 1; }; };; -esac - -else - with_ssl_rpath=yes -fi; #default - - # Check whether --enable-dynamic-ssl-lib or --disable-dynamic-ssl-lib was given. if test "${enable_dynamic_ssl_lib+set}" = set; then enableval="$enable_dynamic_ssl_lib" @@ -46032,7 +38734,7 @@ dir="$erl_xcomp_sysroot$rdir" if test -f "$erl_xcomp_isysroot$rdir/include/openssl/opensslv.h"; then is_real_ssl=yes - SSL_INCDIR="$dir" + SSL_ROOT="$dir" if test "x$MIXED_CYGWIN" = "xyes" -o "x$MIXED_MSYS" = "xyes"; then if test -f "$dir/lib/VC/libeay32.lib"; then SSL_RUNTIME_LIBDIR="$rdir/lib/VC" @@ -46110,12 +38812,12 @@ #include #if OPENSSL_VERSION_NUMBER >= 0x0090700fL -yes + yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "^yes$" >/dev/null 2>&1; then + $EGREP "yes" >/dev/null 2>&1; then ssl_found=yes @@ -46217,9 +38919,9 @@ # Trust OpenBSD to have everything the in the correct locations. ssl_found=yes ssl_linkable=yes - SSL_INCDIR="$erl_xcomp_sysroot/usr" - echo "$as_me:$LINENO: result: $SSL_INCDIR" >&5 -echo "${ECHO_T}$SSL_INCDIR" >&6 + SSL_ROOT="$erl_xcomp_sysroot/usr" + echo "$as_me:$LINENO: result: $SSL_ROOT" >&5 +echo "${ECHO_T}$SSL_ROOT" >&6 SSL_RUNTIME_LIB="/usr/lib" SSL_LIB="$erl_xcomp_sysroot/usr/lib" SSL_BINDIR="/usr/sbin" @@ -46329,12 +39031,7 @@ echo "$as_me: error: Invalid path to option --with-ssl=PATH" >&2;} { (exit 1); exit 1; }; } fi - if test ! -d "$with_ssl_incl" ; then - { { echo "$as_me:$LINENO: error: Invalid path to option --with-ssl-incl=PATH" >&5 -echo "$as_me: error: Invalid path to option --with-ssl-incl=PATH" >&2;} - { (exit 1); exit 1; }; } - fi - SSL_INCDIR="$with_ssl_incl" + SSL_ROOT="$with_ssl" SSL_CRYPTO_LIBNAME=crypto SSL_SSL_LIBNAME=ssl if test "x$MIXED_CYGWIN" = "xyes" -o "x$MIXED_MSYS" = "xyes" && test -d "$with_ssl/lib/VC"; then @@ -46384,12 +39081,12 @@ elif test '!' -f ${SSL_LIBDIR}/lib${SSL_CRYPTO_LIBNAME}.so -a '!' -f "$SSL_LIBDIR/lib${SSL_CRYPTO_LIBNAME}.dylib"; then SSL_STATIC_ONLY=yes fi - SSL_INCLUDE="-I$with_ssl_incl/include" + SSL_INCLUDE="-I$with_ssl/include" SSL_APP=ssl CRYPTO_APP=crypto SSH_APP=ssh if test "$cross_compiling" = "yes"; then - SSL_RUNTIME_LIBDIR=`echo "$SSL_LIBDIR" | sed -n "s|^$erl_xcomp_sysroot\(/*\)\(.*\)\$|/\2|p"` + SSL_RUNTIME_LIBDIR=`echo "$SSL_LIBDIR" | sed -n "s|^$erl_xcomp_sysroot\(.*\)\$|\1|p"` else SSL_RUNTIME_LIBDIR="$SSL_LIBDIR" fi @@ -46409,12 +39106,12 @@ #include #ifndef OPENSSL_NO_KRB5 -yes + yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "^yes$" >/dev/null 2>&1; then + $EGREP "yes" >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 @@ -46467,8 +39164,8 @@ if test "x$ssl_krb5_enabled" = "xyes" ; then echo "$as_me:$LINENO: checking for krb5.h in standard locations" >&5 echo $ECHO_N "checking for krb5.h in standard locations... $ECHO_C" >&6 - for dir in $extra_dir "$SSL_INCDIR/include" "$SSL_INCDIR/include/openssl" \ - "$SSL_INCDIR/include/kerberos" \ + for dir in $extra_dir "$SSL_ROOT/include" "$SSL_ROOT/include/openssl" \ + "$SSL_ROOT/include/kerberos" \ "$erl_xcomp_isysroot/cygdrive/c/kerberos/include" \ "$erl_xcomp_isysroot/usr/local/kerberos/include" \ "$erl_xcomp_isysroot/usr/kerberos/include" \ @@ -46507,12 +39204,7 @@ ld_rflg="$LDFLAG_RUNTIME_LIBRARY_PATH" ded_ld_rflg="$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" - -case "$with_ssl_rpath" in - -yes) # Use standard lib locations for ssl runtime library path - - if test "$SSL_APP" != "" && test "$SSL_DYNAMIC_ONLY" = "yes" && \ +if test "$SSL_APP" != "" && test "$SSL_DYNAMIC_ONLY" = "yes" && \ { test "$cc_rflg" != "" || test "$ld_rflg" != "" || test "$ded_ld_rflg" != ""; } ; then echo "$as_me:$LINENO: checking for ssl runtime library path to use" >&5 @@ -46641,25 +39333,7 @@ echo "${ECHO_T}$rpath" >&6 test "$rpath" != "" || { echo "$as_me:$LINENO: WARNING: Cannot set run path during linking" >&5 echo "$as_me: WARNING: Cannot set run path during linking" >&2;} - fi - ;; - -no) # Use no ssl runtime library path - SSL_DED_LD_RUNTIME_LIBRARY_PATH= - ;; - -*) # Use ssl runtime library paths set by --with-ssl-rpath (without any check) - ded_ld_rpath= - delimit= - for dir in `echo $with_ssl_rpath | sed "s/,/ /g"`; do - ded_ld_rpath="$ded_ld_rpath$delimit$ded_ld_rflg$dir" - delimit=" " - done - SSL_DED_LD_RUNTIME_LIBRARY_PATH="$ded_ld_rpath" - ;; - -esac - +fi #-------------------------------------------------------------------- # Os mon stuff. @@ -46733,100 +39407,19 @@ echo "${ECHO_T}$ac_cv_lib_kstat_kstat_open" >&6 if test $ac_cv_lib_kstat_kstat_open = yes; then - use_cpu_sup=yes + os_mon_programs="$os_mon_programs cpu_sup" CPU_SUP_LIBS="$CPU_SUP_LIBS -lkstat" fi -echo "$as_me:$LINENO: checking for kvm_open in -lkvm" >&5 -echo $ECHO_N "checking for kvm_open in -lkvm... $ECHO_C" >&6 -if test "${ac_cv_lib_kvm_kvm_open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lkvm $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char kvm_open (); -int -main () -{ -kvm_open (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_kvm_kvm_open=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_kvm_kvm_open=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_kvm_kvm_open" >&5 -echo "${ECHO_T}$ac_cv_lib_kvm_kvm_open" >&6 -if test $ac_cv_lib_kvm_kvm_open = yes; then - - use_cpu_sup=yes - CPU_SUP_LIBS="$CPU_SUP_LIBS -lkvm" - -fi - - case $host_os in solaris2*) os_mon_programs="$os_mon_programs ferrule mod_syslog" ;; - darwin*) - use_cpu_sup=yes ;; - openbsd*) - use_cpu_sup=yes ;; linux*) - use_cpu_sup=yes ;; - freebsd*) - use_cpu_sup=yes ;; + os_mon_programs="$os_mon_programs cpu_sup" ;; esac -if test "$use_cpu_sup" = "yes"; then - os_mon_programs="$os_mon_programs cpu_sup" -fi # Check whether --with-javac or --without-javac was given. @@ -46896,9 +39489,9 @@ done if test -n "$JAVAC"; then - echo "$as_me:$LINENO: checking for JDK version 1.6" >&5 -echo $ECHO_N "checking for JDK version 1.6... $ECHO_C" >&6 -if test "${ac_cv_prog_javac_ver_1_6+set}" = set; then + echo "$as_me:$LINENO: checking for JDK version 1.5" >&5 +echo $ECHO_N "checking for JDK version 1.5... $ECHO_C" >&6 +if test "${ac_cv_prog_javac_ver_1_5+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else java_link='$JAVAC conftest.java 1>&5' @@ -46914,19 +39507,19 @@ echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest.class; then rm -rf conftest* - ac_cv_prog_javac_ver_1_6=yes + ac_cv_prog_javac_ver_1_5=yes else echo "configure: failed program was:" 1>&5 cat conftest.java 1>&5 echo "configure: PATH was $PATH" 1>&5 rm -rf conftest* - ac_cv_prog_javac_ver_1_6=no + ac_cv_prog_javac_ver_1_5=no fi rm -f conftest* fi -echo "$as_me:$LINENO: result: $ac_cv_prog_javac_ver_1_6" >&5 -echo "${ECHO_T}$ac_cv_prog_javac_ver_1_6" >&6 - if test $ac_cv_prog_javac_ver_1_6 = no; then +echo "$as_me:$LINENO: result: $ac_cv_prog_javac_ver_1_5" >&5 +echo "${ECHO_T}$ac_cv_prog_javac_ver_1_5" >&6 + if test $ac_cv_prog_javac_ver_1_5 = no; then unset -v JAVAC fi fi @@ -47119,109 +39712,6 @@ fi; -for ac_func in log2 -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - ac_config_files="$ac_config_files emulator/$host/Makefile:emulator/Makefile.in epmd/src/$host/Makefile:epmd/src/Makefile.in etc/common/$host/Makefile:etc/common/Makefile.in include/internal/$host/ethread.mk:include/internal/ethread.mk.in include/internal/$host/erts_internal.mk:include/internal/erts_internal.mk.in lib_src/$host/Makefile:lib_src/Makefile.in Makefile:Makefile.in ../make/$host/otp.mk:../make/otp.mk.in ../make/$host/otp_ded.mk:../make/otp_ded.mk.in ../make/$host/ose_lm.mk:../make/ose_lm.mk.in ../lib/ic/c_src/$host/Makefile:../lib/ic/c_src/Makefile.in ../lib/os_mon/c_src/$host/Makefile:../lib/os_mon/c_src/Makefile.in ../lib/crypto/c_src/$host/Makefile:../lib/crypto/c_src/Makefile.in ../lib/orber/c_src/$host/Makefile:../lib/orber/c_src/Makefile.in ../lib/runtime_tools/c_src/$host/Makefile:../lib/runtime_tools/c_src/Makefile.in ../lib/tools/c_src/$host/Makefile:../lib/tools/c_src/Makefile.in" cat >confcache <<\_ACEOF @@ -47877,6 +40367,7 @@ s,@erl_xcomp_isysroot@,$erl_xcomp_isysroot,;t t s,@erl_xcomp_bigendian@,$erl_xcomp_bigendian,;t t s,@erl_xcomp_double_middle_endian@,$erl_xcomp_double_middle_endian,;t t +s,@erl_xcomp_linux_clock_gettime_correction@,$erl_xcomp_linux_clock_gettime_correction,;t t s,@erl_xcomp_linux_nptl@,$erl_xcomp_linux_nptl,;t t s,@erl_xcomp_linux_usable_sigusrx@,$erl_xcomp_linux_usable_sigusrx,;t t s,@erl_xcomp_linux_usable_sigaltstack@,$erl_xcomp_linux_usable_sigaltstack,;t t @@ -47915,6 +40406,7 @@ s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@ENABLE_ALLOC_TYPE_VARS@,$ENABLE_ALLOC_TYPE_VARS,;t t +s,@PERFCTR_PATH@,$PERFCTR_PATH,;t t s,@USE_VM_PROBES@,$USE_VM_PROBES,;t t s,@OTP_RELEASE@,$OTP_RELEASE,;t t s,@SYSTEM_VSN@,$SYSTEM_VSN,;t t @@ -47985,6 +40477,7 @@ s,@HIPE_HELPERS@,$HIPE_HELPERS,;t t s,@HIPE_ENABLED@,$HIPE_ENABLED,;t t s,@NATIVE_LIBS_ENABLED@,$NATIVE_LIBS_ENABLED,;t t +s,@USE_PERFCTR@,$USE_PERFCTR,;t t s,@ERTS_ENABLE_KERNEL_POLL@,$ERTS_ENABLE_KERNEL_POLL,;t t s,@ac_ct_DED_LD@,$ac_ct_DED_LD,;t t s,@DED_EXT@,$DED_EXT,;t t @@ -48000,7 +40493,7 @@ s,@DTRACE_ENABLED@,$DTRACE_ENABLED,;t t s,@DTRACE_ENABLED_2STEP@,$DTRACE_ENABLED_2STEP,;t t s,@SSL_INCLUDE@,$SSL_INCLUDE,;t t -s,@SSL_INCDIR@,$SSL_INCDIR,;t t +s,@SSL_ROOT@,$SSL_ROOT,;t t s,@SSL_LIBDIR@,$SSL_LIBDIR,;t t s,@SSL_CRYPTO_LIBNAME@,$SSL_CRYPTO_LIBNAME,;t t s,@SSL_SSL_LIBNAME@,$SSL_SSL_LIBNAME,;t t diff -Nru erlang-18.2-dfsg/erts/configure.in erlang-17.3-dfsg/erts/configure.in --- erlang-18.2-dfsg/erts/configure.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/configure.in 2014-09-16 19:10:57.000000000 +0000 @@ -2,19 +2,18 @@ dnl %CopyrightBegin% dnl -dnl Copyright Ericsson AB 1997-2015. All Rights Reserved. +dnl Copyright Ericsson AB 1997-2014. All Rights Reserved. dnl -dnl Licensed under the Apache License, Version 2.0 (the "License"); -dnl you may not use this file except in compliance with the License. -dnl You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. +dnl +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. dnl dnl %CopyrightEnd% @@ -265,6 +264,24 @@ esac ],enable_m32_build=no) +AC_SUBST(PERFCTR_PATH) +AC_ARG_WITH(perfctr, +AS_HELP_STRING([--with-perfctr=PATH], + [specify location of perfctr include and lib]) +AS_HELP_STRING([--without-perfctr], [don't use perfctr (default)])) + +if test "x$with_perfctr" = "xno" -o "x$with_perfctr" = "x" ; then + PERFCTR_PATH= +else + if test ! -f "$with_perfctr/usr.lib/libperfctr.a" ; then + AC_MSG_ERROR(Invalid path to option --with-perfctr=PATH) + fi + PERFCTR_PATH="$with_perfctr" + AC_DEFINE(USE_PERFCTR,[1], + [Define to enable hrvtime() on Linux systems with perfctr extension]) +fi + + AC_ARG_WITH(dynamic-trace, AS_HELP_STRING([--with-dynamic-trace={dtrace|systemtap}], [specify use of dynamic trace framework, dtrace or systemtap]) @@ -318,6 +335,15 @@ [Define to enable VM dynamic trace probes]) fi + +AC_ARG_ENABLE(clock-gettime, +AS_HELP_STRING([--enable-clock-gettime], + [use clock-gettime for time correction]), +[ case "$enableval" in + no) clock_gettime_correction=no ;; + *) clock_gettime_correction=yes ;; + esac ], clock_gettime_correction=unknown) + AC_ARG_WITH(assumed-cache-line-size, AS_HELP_STRING([--with-assumed-cache-line-size=SIZE], [specify assumed cache line size in bytes (valid values are powers of two between and including 16 and 8192; default is 64)])) @@ -342,15 +368,6 @@ [], [enable_systemd=no]) -AC_ARG_ENABLE(saved-compile-time, -AS_HELP_STRING([--disable-saved-compile-time], [disable saved compile time]), -[ case "$enableval" in - no) save_compile_time=0 ;; - *) save_compile_time=1 ;; - esac ], save_compile_time=1) - -AC_DEFINE_UNQUOTED(ERTS_SAVED_COMPILE_TIME, $save_compile_time, [Save compile time?]) - dnl Magic test for clearcase. OTP_RELEASE= if test "${ERLANG_COMMERCIAL_BUILD}" != ""; then @@ -632,7 +649,7 @@ case $chk_opsys_ in win32) OPSYS=win32;; solaris2.*|SunOS5.*) OPSYS=sol2;; - linux*|Linux) OPSYS=linux;; + linux|Linux) OPSYS=linux;; darwin|Darwin) OPSYS=darwin;; freebsd|FreeBSD) OPSYS=freebsd;; *) OPSYS=noopsys @@ -659,7 +676,6 @@ powerpc) ARCH=ppc;; ppc) ARCH=ppc;; ppc64) ARCH=ppc64;; - ppc64le) ARCH=ppc64;; "Power Macintosh") ARCH=ppc;; armv5b) ARCH=arm;; armv5teb) ARCH=arm;; @@ -1107,31 +1123,10 @@ case "$ethr_have_native_atomics-$smp_require_native_atomics-$ethr_have_native_spinlock" in yes-*) - if test "$ethr_native_atomic_implementation" = "gcc_sync"; then - test -f "$ERL_TOP/erts/CONF_INFO" || - echo "" > "$ERL_TOP/erts/CONF_INFO" - cat >> $ERL_TOP/erts/CONF_INFO < -#ifdef __GLIBC__ -yes -#endif + AC_EGREP_CPP(yes,[#include + #ifdef __GLIBC__ + yes + #endif ], AC_DEFINE(HAVE_GETHOSTBYNAME_R, GHBN_R_GLIBC, [Define to flavour of gethostbyname_r])) ;; @@ -1697,13 +1691,10 @@ LIBS= AC_SEARCH_LIBS(sd_listen_fds,[systemd systemd-daemon], [have_sd_listen_fds=yes],[have_sd_listen_fds=no],$systemd_daemon_save_LIBS) -AC_SEARCH_LIBS(sd_notify,[systemd systemd-daemon], - [have_sd_notify=yes],[have_sd_notify=no],$systemd_daemon_save_LIBS) AC_CHECK_HEADERS(systemd/sd-daemon.h, [have_systemd_sd_daemon_h=yes],[have_systemd_sd_daemon_h=no]) if test x"$have_sd_listen_fds" = x"yes" && \ - test x"$have_sd_notify" = x"yes" && \ test x"$have_systemd_sd_daemon_h" = x"yes"; then AC_DEFINE([HAVE_SYSTEMD_DAEMON],[1],[Define if you have systemd daemon]) SYSTEMD_DAEMON_LIBS=$LIBS @@ -1771,10 +1762,6 @@ AC_CHECK_HEADER(sys/epoll.h, have_kernel_poll=epoll) AC_CHECK_HEADER(sys/devpoll.h, have_kernel_poll=/dev/poll) -dnl Check if we have timerfds to be used for high accuracy -dnl epoll_wait timeouts -AC_CHECK_HEADERS([sys/timerfd.h]) - dnl Check for kernel SCTP support AC_SUBST(LIBSCTP) if test "x$enable_sctp" != "xno" ; then @@ -1794,7 +1781,7 @@ AC_CHECK_DECLS([SCTP_UNORDERED, SCTP_ADDR_OVER, SCTP_ABORT, SCTP_EOF, SCTP_SENDALL, SCTP_ADDR_CONFIRMED, SCTP_DELAYED_ACK_TIME, - SCTP_EMPTY, SCTP_UNCONFIRMED, + SCTP_EMPTY, SCTP_CLOSED, SCTPS_IDLE, SCTP_BOUND, SCTPS_BOUND, SCTP_LISTEN, SCTPS_LISTEN, @@ -2120,19 +2107,8 @@ gethrtime localtime_r gmtime_r inet_pton \ memcpy mallopt sbrk _sbrk __sbrk brk _brk __brk \ flockfile fstat strlcpy strlcat setsid posix2time time2posix \ - setlocale nl_langinfo poll mlockall ppoll]) + setlocale nl_langinfo poll mlockall]) -AC_MSG_CHECKING([for isfinite]) -AC_TRY_LINK([#include ], - [isfinite(0);], have_isfinite=yes, have_isfinite=no), - -if test $have_isfinite = yes; then - AC_DEFINE(HAVE_ISFINITE,[1], - [Define to 1 if you have the `isfinite' function.]) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi case X$erl_xcomp_posix_memalign in Xno) ;; @@ -2923,10 +2899,6 @@ #include #include -#if defined(__clang__) || defined(__llvm__) -#error "Clang/LLVM generates broken code for FP exceptions" -#endif - volatile int erl_fp_exception; /* @@ -3517,6 +3489,19 @@ AC_SUBST(NATIVE_LIBS_ENABLED) # +# Check if HiPE should use a standard installation of perfctr. +# +AC_SUBST(USE_PERFCTR) +if test "x$HIPE_ENABLED" = "xyes" ; then + if test "x$with_perfctr" = "x" ; then + AC_CHECK_LIB(perfctr, vperfctr_info, [USE_PERFCTR=1 + AC_DEFINE(USE_PERFCTR,[1],[Define to enable hrvtime() on Linux systems with perfctr extension])]) + elif test "x$with_perfctr" != "xno" ; then + USE_PERFCTR=1 + fi +fi + +# # Check for working poll(). # AC_MSG_CHECKING([for working poll()]) @@ -3971,7 +3956,6 @@ DTRACE_ENABLED_2STEP=yes fi], []) - $RM -f foo-dtrace.h AS_IF([test "x$DTRACE_ENABLED_2STEP" = "xyes"], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) @@ -4004,7 +3988,7 @@ dnl use "PATH/include" and "PATH/lib". AC_SUBST(SSL_INCLUDE) -AC_SUBST(SSL_INCDIR) +AC_SUBST(SSL_ROOT) AC_SUBST(SSL_LIBDIR) AC_SUBST(SSL_CRYPTO_LIBNAME) AC_SUBST(SSL_SSL_LIBNAME) @@ -4098,29 +4082,6 @@ AS_HELP_STRING([--with-ssl], [use SSL (default)]) AS_HELP_STRING([--without-ssl], [don't use SSL])) -AC_ARG_WITH(ssl-incl, -AS_HELP_STRING([--with-ssl-incl=PATH], [location of OpenSSL include dir, if different than specified by --with-ssl=PATH]), -[ -case X$with_ssl in - X | Xyes | Xno) AC_MSG_ERROR([--with-ssl-incl=PATH set without --with-ssl=PATH]);; -esac -], -[with_ssl_incl=$with_ssl]) #default - -AC_ARG_WITH(ssl-rpath, -AS_HELP_STRING([--with-ssl-rpath=yes|no|PATHS], - [runtime library path for OpenSSL. Default is "yes", which equates to a - number of standard locations. If "no", then no runtime - library paths wil be used. Anything else should be a - comma separated list of paths.]), -[ -case X$with_ssl in - Xno) AC_MSG_ERROR([--with-ssl-rpath set without --with-ssl]);; -esac -], -[with_ssl_rpath=yes]) #default - - AC_ARG_ENABLE(dynamic-ssl-lib, AS_HELP_STRING([--disable-dynamic-ssl-lib], [disable using dynamic openssl libraries]), @@ -4235,7 +4196,7 @@ dir="$erl_xcomp_sysroot$rdir" if test -f "$erl_xcomp_isysroot$rdir/include/openssl/opensslv.h"; then is_real_ssl=yes - SSL_INCDIR="$dir" + SSL_ROOT="$dir" if test "x$MIXED_CYGWIN" = "xyes" -o "x$MIXED_MSYS" = "xyes"; then if test -f "$dir/lib/VC/libeay32.lib"; then SSL_RUNTIME_LIBDIR="$rdir/lib/VC" @@ -4304,10 +4265,10 @@ SSL_INCLUDE="-I$dir/include" old_CPPFLAGS=$CPPFLAGS CPPFLAGS=$SSL_INCLUDE - AC_EGREP_CPP(^yes$,[ + AC_EGREP_CPP(yes,[ #include #if OPENSSL_VERSION_NUMBER >= 0x0090700fL -yes + yes #endif ],[ ssl_found=yes @@ -4365,8 +4326,8 @@ # Trust OpenBSD to have everything the in the correct locations. ssl_found=yes ssl_linkable=yes - SSL_INCDIR="$erl_xcomp_sysroot/usr" - AC_MSG_RESULT([$SSL_INCDIR]) + SSL_ROOT="$erl_xcomp_sysroot/usr" + AC_MSG_RESULT([$SSL_ROOT]) SSL_RUNTIME_LIB="/usr/lib" SSL_LIB="$erl_xcomp_sysroot/usr/lib" SSL_BINDIR="/usr/sbin" @@ -4433,10 +4394,7 @@ if test ! -d "$with_ssl" ; then AC_MSG_ERROR(Invalid path to option --with-ssl=PATH) fi - if test ! -d "$with_ssl_incl" ; then - AC_MSG_ERROR(Invalid path to option --with-ssl-incl=PATH) - fi - SSL_INCDIR="$with_ssl_incl" + SSL_ROOT="$with_ssl" SSL_CRYPTO_LIBNAME=crypto SSL_SSL_LIBNAME=ssl if test "x$MIXED_CYGWIN" = "xyes" -o "x$MIXED_MSYS" = "xyes" && test -d "$with_ssl/lib/VC"; then @@ -4486,12 +4444,12 @@ elif test '!' -f ${SSL_LIBDIR}/lib${SSL_CRYPTO_LIBNAME}.so -a '!' -f "$SSL_LIBDIR/lib${SSL_CRYPTO_LIBNAME}.dylib"; then SSL_STATIC_ONLY=yes fi - SSL_INCLUDE="-I$with_ssl_incl/include" + SSL_INCLUDE="-I$with_ssl/include" SSL_APP=ssl CRYPTO_APP=crypto SSH_APP=ssh if test "$cross_compiling" = "yes"; then - SSL_RUNTIME_LIBDIR=`echo "$SSL_LIBDIR" | sed -n "s|^$erl_xcomp_sysroot\(/*\)\(.*\)\$|/\2|p"` + SSL_RUNTIME_LIBDIR=`echo "$SSL_LIBDIR" | sed -n "s|^$erl_xcomp_sysroot\(.*\)\$|\1|p"` else SSL_RUNTIME_LIBDIR="$SSL_LIBDIR" fi @@ -4502,10 +4460,10 @@ AC_MSG_CHECKING(for OpenSSL kerberos 5 support) old_CPPFLAGS=$CPPFLAGS CPPFLAGS=$SSL_INCLUDE - AC_EGREP_CPP(^yes$,[ + AC_EGREP_CPP(yes,[ #include #ifndef OPENSSL_NO_KRB5 -yes + yes #endif ],[ AC_MSG_RESULT([yes]) @@ -4549,8 +4507,8 @@ SSL_KRB5_INCLUDE= if test "x$ssl_krb5_enabled" = "xyes" ; then AC_MSG_CHECKING(for krb5.h in standard locations) - for dir in $extra_dir "$SSL_INCDIR/include" "$SSL_INCDIR/include/openssl" \ - "$SSL_INCDIR/include/kerberos" \ + for dir in $extra_dir "$SSL_ROOT/include" "$SSL_ROOT/include/openssl" \ + "$SSL_ROOT/include/kerberos" \ "$erl_xcomp_isysroot/cygdrive/c/kerberos/include" \ "$erl_xcomp_isysroot/usr/local/kerberos/include" \ "$erl_xcomp_isysroot/usr/kerberos/include" \ @@ -4586,12 +4544,7 @@ ld_rflg="$LDFLAG_RUNTIME_LIBRARY_PATH" ded_ld_rflg="$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" - -case "$with_ssl_rpath" in - -yes) # Use standard lib locations for ssl runtime library path - - if test "$SSL_APP" != "" && test "$SSL_DYNAMIC_ONLY" = "yes" && \ +if test "$SSL_APP" != "" && test "$SSL_DYNAMIC_ONLY" = "yes" && \ { test "$cc_rflg" != "" || test "$ld_rflg" != "" || test "$ded_ld_rflg" != ""; } ; then AC_MSG_CHECKING(for ssl runtime library path to use) @@ -4675,25 +4628,7 @@ AC_MSG_RESULT([$rpath]) test "$rpath" != "" || AC_MSG_WARN([Cannot set run path during linking]) - fi - ;; - -no) # Use no ssl runtime library path - SSL_DED_LD_RUNTIME_LIBRARY_PATH= - ;; - -*) # Use ssl runtime library paths set by --with-ssl-rpath (without any check) - ded_ld_rpath= - delimit= - for dir in `echo $with_ssl_rpath | sed "s/,/ /g"`; do - ded_ld_rpath="$ded_ld_rpath$delimit$ded_ld_rflg$dir" - delimit=" " - done - SSL_DED_LD_RUNTIME_LIBRARY_PATH="$ded_ld_rpath" - ;; - -esac - +fi #-------------------------------------------------------------------- # Os mon stuff. @@ -4702,32 +4637,18 @@ AC_SUBST(CPU_SUP_LIBS) AC_CHECK_LIB(kstat, kstat_open, [ - use_cpu_sup=yes + os_mon_programs="$os_mon_programs cpu_sup" CPU_SUP_LIBS="$CPU_SUP_LIBS -lkstat" ]) -AC_CHECK_LIB(kvm, kvm_open, [ - use_cpu_sup=yes - CPU_SUP_LIBS="$CPU_SUP_LIBS -lkvm" - ]) - case $host_os in solaris2*) os_mon_programs="$os_mon_programs ferrule mod_syslog" ;; - darwin*) - use_cpu_sup=yes ;; - openbsd*) - use_cpu_sup=yes ;; linux*) - use_cpu_sup=yes ;; - freebsd*) - use_cpu_sup=yes ;; + os_mon_programs="$os_mon_programs cpu_sup" ;; esac -if test "$use_cpu_sup" = "yes"; then - os_mon_programs="$os_mon_programs cpu_sup" -fi - + AC_ARG_WITH(javac, AS_HELP_STRING([--with-javac=JAVAC], [specify Java compiler to use]) AS_HELP_STRING([--with-javac], [use a Java compiler if found (default)]) @@ -4758,12 +4679,12 @@ AC_CHECK_PROGS(JAVAC, $check_javac) if test -n "$JAVAC"; then - dnl Make sure it's at least JDK 1.6 - AC_CACHE_CHECK(for JDK version 1.6, - ac_cv_prog_javac_ver_1_6, + dnl Make sure it's at least JDK 1.5 + AC_CACHE_CHECK(for JDK version 1.5, + ac_cv_prog_javac_ver_1_5, [ERL_TRY_LINK_JAVA([], [for (String i : args);], - ac_cv_prog_javac_ver_1_6=yes, ac_cv_prog_javac_ver_1_6=no)]) - if test $ac_cv_prog_javac_ver_1_6 = no; then + ac_cv_prog_javac_ver_1_5=yes, ac_cv_prog_javac_ver_1_5=no)]) + if test $ac_cv_prog_javac_ver_1_5 = no; then unset -v JAVAC fi fi @@ -4884,7 +4805,7 @@ #define HAVE_GETHRVTIME #endif -#if !defined(HAVE_ISFINITE) && !defined(HAVE_FINITE) +#ifndef HAVE_FINITE # if defined(HAVE_ISINF) && defined(HAVE_ISNAN) # define USE_ISINF_ISNAN # endif @@ -4920,11 +4841,6 @@ ]) dnl ---------------------------------------------------------------------- -dnl Check for log2 -dnl ---------------------------------------------------------------------- -AC_CHECK_FUNCS([log2]) - -dnl ---------------------------------------------------------------------- dnl Output the result. dnl ---------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/erts/doc/Makefile erlang-17.3-dfsg/erts/doc/Makefile --- erlang-18.2-dfsg/erts/doc/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/doc/src/absform.xml erlang-17.3-dfsg/erts/doc/src/absform.xml --- erlang-18.2-dfsg/erts/doc/src/absform.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/absform.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,22 +4,21 @@
- 20012015 + 20012013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + The Abstract Format @@ -35,24 +34,24 @@

This document describes the standard representation of parse trees for Erlang programs as Erlang terms. This representation is known as the abstract format. - Functions dealing with such parse trees are compile:forms/[1,2] + Functions dealing with such parse trees are and functions in the modules - epp, - erl_eval, - erl_lint, - erl_pp, - erl_parse, + , + , + , + , + , and - io. + . They are also used as input and output for parse transforms (see the module - compile).

-

We use the function Rep to denote the mapping from an Erlang source - construct C to its abstract format representation R, and write - R = Rep(C). + ).

+

We use the function to denote the mapping from an Erlang source + construct to its abstract format representation , and write + .

-

The word LINE below represents an integer, and denotes the +

The word below represents an integer, and denotes the number of the line in the source file where the construction occurred. - Several instances of LINE in the same construction may denote + Several instances of in the same construction may denote different lines.

Since operators are not terms in their own right, when operators are mentioned below, the representation of an operator should be taken to @@ -61,116 +60,71 @@

- Module Declarations and Forms + Module declarations and forms

A module declaration consists of a sequence of forms that are either function declarations or attributes.

If D is a module declaration consisting of the forms - F_1, ..., F_k, then - Rep(D) = [Rep(F_1), ..., Rep(F_k)]. - If F is an attribute -module(Mod), then - Rep(F) = {attribute,LINE,module,Mod}. - If F is an attribute -behavior(Behavior), then - Rep(F) = {attribute,LINE,behavior,Behavior}. - If F is an attribute -behaviour(Behaviour), then - Rep(F) = {attribute,LINE,behaviour,Behaviour}. - If F is an attribute -export([Fun_1/A_1, ..., Fun_k/A_k]), then - Rep(F) = {attribute,LINE,export,[{Fun_1,A_1}, ..., {Fun_k,A_k}]}. - If F is an attribute -import(Mod,[Fun_1/A_1, ..., Fun_k/A_k]), then - Rep(F) = {attribute,LINE,import,{Mod,[{Fun_1,A_1}, ..., {Fun_k,A_k}]}}. - If F is an attribute -export_type([Type_1/A_1, ..., Type_k/A_k]), then - Rep(F) = {attribute,LINE,export_type,[{Type_1,A_1}, ..., {Type_k,A_k}]}. - If F is an attribute -compile(Options), then - Rep(F) = {attribute,LINE,compile,Options}. - If F is an attribute -file(File,Line), then - Rep(F) = {attribute,LINE,file,{File,Line}}. - If F is a record declaration - -record(Name,{V_1, ..., V_k}), then Rep(F) = - {attribute,LINE,record,{Name,[Rep(V_1), ..., Rep(V_k)]}}. - For Rep(V), see below. - If F is a type declaration - -Type Name(V_1, ..., V_k) :: T, where - Type is either the atom type or the atom opaque, - each V_i is a variable, and T is a type, then Rep(F) = - {attribute,LINE,Type,{Name,Rep(T),[Rep(V_1), ..., Rep(V_k)]}}. - - If F is a function specification - -Spec Name Ft_1; ...; Ft_k, - where Spec is either the atom spec or the atom - callback, and each Ft_i is a possibly constrained - function type with an argument sequence of the same length - Arity, then Rep(F) = - {attribute,Line,Spec,{{Name,Arity},[Rep(Ft_1), ..., Rep(Ft_k)]}}. - - If F is a function specification - -spec Mod:Name Ft_1; ...; Ft_k, - where each Ft_i is a possibly constrained - function type with an argument sequence of the same length - Arity, then Rep(F) = - {attribute,Line,spec,{{Mod,Name,Arity},[Rep(Ft_1), ..., Rep(Ft_k)]}}. - - If F is a wild attribute -A(T), then - Rep(F) = {attribute,LINE,A,T}. + , ..., , then + Rep(D) = . + If F is an attribute , then + Rep(F) = . + If F is an attribute , then + Rep(F) = . + If F is an attribute , then + Rep(F) = . + If F is an attribute , then + Rep(F) = . + If F is an attribute , then + Rep(F) = . + If F is a record declaration , then + Rep(F) = + . For Rep(V), see below. + If F is a wild attribute , then + Rep(F) = .

- If F is a function declaration - Name Fc_1 ; ... ; Name Fc_k, - where each Fc_i is a function clause with a - pattern sequence of the same length Arity, then - Rep(F) = {function,LINE,Name,Arity,[Rep(Fc_1), ...,Rep(Fc_k)]}. - + If F is a function declaration , + where each is a function clause with a + pattern sequence of the same length , then + Rep(F) = .
- Record Fields + Record fields

Each field in a record declaration may have an optional - explicit default initializer expression, as well as an - optional type.

+ explicit default initializer expression

- If V is A, then - Rep(V) = {record_field,LINE,Rep(A)}. - If V is A = E, - where E is an expression, then - Rep(V) = {record_field,LINE,Rep(A),Rep(E)}. - If V is A :: T, where T is a - type and it does not contain - undefined syntactically, then Rep(V) = - {typed_record_field,{record_field,LINE,Rep(A)},Rep(undefined | T)}. - - If V is A :: T, where T is a type, then Rep(V) = - {typed_record_field,{record_field,LINE,Rep(A)},Rep(T)}. - - If V is A = E :: T, where - E is an expression and T is a type, then Rep(V) = - {typed_record_field,{record_field,LINE,Rep(A),Rep(E)},Rep(T)}. - + If V is , then + Rep(V) = . + If V is , then + Rep(V) = .
- Representation of Parse Errors and End-of-file + Representation of parse errors and end of file

In addition to the representations of forms, the list that represents - a module declaration (as returned by functions in erl_parse and - epp) may contain tuples {error,E} and - {warning,W}, denoting syntactically incorrect forms and - warnings, and {eof,LINE}, denoting an end-of-stream - encountered before a complete form had been parsed.

+ a module declaration (as returned by functions in and + ) may contain tuples and , denoting + syntactically incorrect forms and warnings, and , denoting an end + of stream encountered before a complete form had been parsed.

- Atomic Literals + Atomic literals

There are five kinds of atomic literals, which are represented in the same way in patterns, expressions and guards:

If L is an integer or character literal, then - Rep(L) = {integer,LINE,L}. + Rep(L) = . If L is a float literal, then - Rep(L) = {float,LINE,L}. + Rep(L) = . If L is a string literal consisting of the characters - C_1, ..., C_k, then - Rep(L) = {string,LINE,[C_1, ..., C_k]}. + , ..., , then + Rep(L) = . If L is an atom literal, then - Rep(L) = {atom,LINE,L}. + Rep(L) = .

Note that negative integer and float literals do not occur as such; they are parsed as an application of the unary negation operator.

@@ -178,47 +132,47 @@
Patterns -

If Ps is a sequence of patterns P_1, ..., P_k, then - Rep(Ps) = [Rep(P_1), ..., Rep(P_k)]. Such sequences occur as the +

If is a sequence of patterns , then + Rep(Ps) = . Such sequences occur as the list of arguments to a function or fun.

Individual patterns are represented as follows:

If P is an atomic literal L, then Rep(P) = Rep(L). - If P is a compound pattern P_1 = P_2, then - Rep(P) = {match,LINE,Rep(P_1),Rep(P_2)}. - If P is a variable pattern V, then - Rep(P) = {var,LINE,A}, + If P is a compound pattern , then + Rep(P) = . + If P is a variable pattern , then + Rep(P) = , where A is an atom with a printname consisting of the same characters as - V. - If P is a universal pattern _, then - Rep(P) = {var,LINE,'_'}. - If P is a tuple pattern {P_1, ..., P_k}, then - Rep(P) = {tuple,LINE,[Rep(P_1), ..., Rep(P_k)]}. - If P is a nil pattern [], then - Rep(P) = {nil,LINE}. - If P is a cons pattern [P_h | P_t], then - Rep(P) = {cons,LINE,Rep(P_h),Rep(P_t)}. - If E is a binary pattern <<P_1:Size_1/TSL_1, ..., P_k:Size_k/TSL_k>>, then - Rep(E) = {bin,LINE,[{bin_element,LINE,Rep(P_1),Rep(Size_1),Rep(TSL_1)}, ..., {bin_element,LINE,Rep(P_k),Rep(Size_k),Rep(TSL_k)}]}. + . + If P is a universal pattern , then + Rep(P) = . + If P is a tuple pattern , then + Rep(P) = . + If P is a nil pattern , then + Rep(P) = . + If P is a cons pattern , then + Rep(P) = . + If E is a binary pattern >]]>, then + Rep(E) = . For Rep(TSL), see below. - An omitted Size is represented by default. An omitted TSL - (type specifier list) is represented by default. - If P is P_1 Op P_2, where Op is a binary operator (this - is either an occurrence of ++ applied to a literal string or character + An omitted is represented by . An omitted + (type specifier list) is represented by . + If P is , where is a binary operator (this + is either an occurrence of applied to a literal string or character list, or an occurrence of an expression that can be evaluated to a number at compile time), - then Rep(P) = {op,LINE,Op,Rep(P_1),Rep(P_2)}. - If P is Op P_0, where Op is a unary operator (this is an + then Rep(P) = . + If P is , where is a unary operator (this is an occurrence of an expression that can be evaluated to a number at compile - time), then Rep(P) = {op,LINE,Op,Rep(P_0)}. - If P is a record pattern #Name{Field_1=P_1, ..., Field_k=P_k}, + time), then Rep(P) = . + If P is a record pattern , then Rep(P) = - {record,LINE,Name,[{record_field,LINE,Rep(Field_1),Rep(P_1)}, ..., {record_field,LINE,Rep(Field_k),Rep(P_k)}]}. - If P is #Name.Field, then - Rep(P) = {record_index,LINE,Name,Rep(Field)}. - If P is ( P_0 ), then - Rep(P) = Rep(P_0), - that is, patterns cannot be distinguished from their bodies. + . + If P is , then + Rep(P) = . + If P is , then + Rep(P) = , + i.e., patterns cannot be distinguished from their bodies.

Note that every pattern has the same source form as some expression, and is represented the same way as the corresponding expression.

@@ -226,167 +180,180 @@
Expressions -

A body B is a sequence of expressions E_1, ..., E_k, and - Rep(B) = [Rep(E_1), ..., Rep(E_k)].

+

A body B is a sequence of expressions , and + Rep(B) = .

An expression E is one of the following alternatives:

- If P is an atomic literal L, then Rep(P) = Rep(L). - If E is P = E_0, then - Rep(E) = {match,LINE,Rep(P),Rep(E_0)}. - If E is a variable V, then Rep(E) = {var,LINE,A}, - where A is an atom with a printname consisting of the same - characters as V. - If E is a tuple skeleton {E_1, ..., E_k}, then - Rep(E) = {tuple,LINE,[Rep(E_1), ..., Rep(E_k)]}. - If E is [], then - Rep(E) = {nil,LINE}. - If E is a cons skeleton [E_h | E_t], then - Rep(E) = {cons,LINE,Rep(E_h),Rep(E_t)}. - If E is a binary constructor <<V_1:Size_1/TSL_1, ..., V_k:Size_k/TSL_k>>, then Rep(E) = - {bin,LINE,[{bin_element,LINE,Rep(V_1),Rep(Size_1),Rep(TSL_1)}, ..., {bin_element,LINE,Rep(V_k),Rep(Size_k),Rep(TSL_k)}]}. + If P is an atomic literal , then + Rep(P) = Rep(L). + If E is , then + Rep(E) = . + If E is a variable , then + Rep(E) = , + where is an atom with a printname consisting of the same + characters as . + If E is a tuple skeleton , then + Rep(E) = . + If E is , then + Rep(E) = . + If E is a cons skeleton , then + Rep(E) = . + If E is a binary constructor >]]>, then + Rep(E) = . For Rep(TSL), see below. - An omitted Size is represented by default. An omitted TSL - (type specifier list) is represented by default. - If E is E_1 Op E_2, where Op is a binary operator, - then Rep(E) = {op,LINE,Op,Rep(E_1),Rep(E_2)}. - If E is Op E_0, where Op is a unary operator, then - Rep(E) = {op,LINE,Op,Rep(E_0)}. - If E is #Name{Field_1=E_1, ..., Field_k=E_k}, - then Rep(E) = - {record,LINE,Name,[{record_field,LINE,Rep(Field_1),Rep(E_1)}, ..., {record_field,LINE,Rep(Field_k),Rep(E_k)}]}. - If E is E_0#Name{Field_1=E_1, ..., Field_k=E_k}, then - Rep(E) = - {record,LINE,Rep(E_0),Name,[{record_field,LINE,Rep(Field_1),Rep(E_1)}, ..., {record_field,LINE,Rep(Field_k),Rep(E_k)}]}. - If E is #Name.Field, then - Rep(E) = {record_index,LINE,Name,Rep(Field)}. - If E is E_0#Name.Field, then - Rep(E) = {record_field,LINE,Rep(E_0),Name,Rep(Field)}. - If E is #{W_1, ..., W_k} where each - W_i is a map assoc or exact field, then Rep(E) = - {map,LINE,[Rep(W_1), ..., Rep(W_k)]}. For Rep(W), see + An omitted is represented by . An omitted + (type specifier list) is represented by . + If E is , where is a binary operator, + then Rep(E) = . + If E is , where is a unary operator, then + Rep(E) = . + If E is , then + Rep(E) = + . + If E is , then + Rep(E) = + . + If E is , then + Rep(E) = . + If E is , then + Rep(E) = . + If E is where each + is a map assoc or exact field, then Rep(E) = + . For Rep(W), see below. - If E is E_0#{W_1, ..., W_k} where - W_i is a map assoc or exact field, then Rep(E) = - {map,LINE,Rep(E_0),[Rep(W_1), ..., Rep(W_k)]}. - For Rep(W), see below. - If E is catch E_0, then - Rep(E) = {'catch',LINE,Rep(E_0)}. - If E is E_0(E_1, ..., E_k), then - Rep(E) = {call,LINE,Rep(E_0),[Rep(E_1), ..., Rep(E_k)]}. - If E is E_m:E_0(E_1, ..., E_k), then Rep(E) = - {call,LINE,{remote,LINE,Rep(E_m),Rep(E_0)},[Rep(E_1), ..., Rep(E_k)]}. - - If E is a list comprehension [E_0 || W_1, ..., W_k], - where each W_i is a generator or a filter, then Rep(E) = - {lc,LINE,Rep(E_0),[Rep(W_1), ..., Rep(W_k)]}. For Rep(W), see + If E is where + is a map assoc or exact field, then Rep(E) = + . For + Rep(W), see below. + If E is , then + Rep(E) = . + If E is , then + Rep(E) = . + If E is , then + Rep(E) = + . + If E is a list comprehension , + where each is a generator or a filter, then + Rep(E) = . For Rep(W), see below. - If E is a binary comprehension - <<E_0 || W_1, ..., W_k>>, - where each W_i is a generator or a filter, then - Rep(E) = {bc,LINE,Rep(E_0),[Rep(W_1), ..., Rep(W_k)]}. - For Rep(W), see below. - If E is begin B end, where B is a body, then - Rep(E) = {block,LINE,Rep(B)}. - If E is if Ic_1 ; ... ; Ic_k end, - where each Ic_i is an if clause then Rep(E) = - {'if',LINE,[Rep(Ic_1), ..., Rep(Ic_k)]}. - If E is case E_0 of Cc_1 ; ... ; Cc_k end, - where E_0 is an expression and each Cc_i is a - case clause then Rep(E) = - {'case',LINE,Rep(E_0),[Rep(Cc_1), ..., Rep(Cc_k)]}. - If E is try B catch Tc_1 ; ... ; Tc_k end, - where B is a body and each Tc_i is a catch clause then - Rep(E) = - {'try',LINE,Rep(B),[],[Rep(Tc_1), ..., Rep(Tc_k)],[]}. - If E is try B of Cc_1 ; ... ; Cc_k catch Tc_1 ; ... ; Tc_n end, - where B is a body, - each Cc_i is a case clause and - each Tc_j is a catch clause then Rep(E) = - {'try',LINE,Rep(B),[Rep(Cc_1), ..., Rep(Cc_k)],[Rep(Tc_1), ..., Rep(Tc_n)],[]}. - If E is try B after A end, - where B and A are bodies then Rep(E) = - {'try',LINE,Rep(B),[],[],Rep(A)}. - If E is try B of Cc_1 ; ... ; Cc_k after A end, - where B and A are a bodies and - each Cc_i is a case clause then Rep(E) = - {'try',LINE,Rep(B),[Rep(Cc_1), ..., Rep(Cc_k)],[],Rep(A)}. - If E is try B catch Tc_1 ; ... ; Tc_k after A end, - where B and A are bodies and - each Tc_i is a catch clause then Rep(E) = - {'try',LINE,Rep(B),[],[Rep(Tc_1), ..., Rep(Tc_k)],Rep(A)}. - If E is try B of Cc_1 ; ... ; Cc_k catch Tc_1 ; ... ; Tc_n after A end, - where B and A are a bodies, - each Cc_i is a case clause and - each Tc_j is a catch clause then - Rep(E) = - {'try',LINE,Rep(B),[Rep(Cc_1), ..., Rep(Cc_k)],[Rep(Tc_1), ..., Rep(Tc_n)],Rep(A)}. - If E is receive Cc_1 ; ... ; Cc_k end, - where each Cc_i is a case clause then Rep(E) = - {'receive',LINE,[Rep(Cc_1), ..., Rep(Cc_k)]}. - If E is receive Cc_1 ; ... ; Cc_k after E_0 -> B_t end, - where each Cc_i is a case clause, - E_0 is an expression and B_t is a body, then Rep(E) = - {'receive',LINE,[Rep(Cc_1), ..., Rep(Cc_k)],Rep(E_0),Rep(B_t)}. - If E is fun Name / Arity, then - Rep(E) = {'fun',LINE,{function,Name,Arity}}. - If E is fun Module:Name/Arity, then Rep(E) = - {'fun',LINE,{function,Rep(Module),Rep(Name),Rep(Arity)}}. - (Before the R15 release: Rep(E) = - {'fun',LINE,{function,Module,Name,Arity}}.) - If E is fun Fc_1 ; ... ; Fc_k end - where each Fc_i is a function clause then Rep(E) = - {'fun',LINE,{clauses,[Rep(Fc_1), ..., Rep(Fc_k)]}}. - If E is fun Name Fc_1 ; ... ; Name Fc_k end - where Name is a variable and each - Fc_i is a function clause then Rep(E) = - {named_fun,LINE,Name,[Rep(Fc_1), ..., Rep(Fc_k)]}. + If E is a binary comprehension >]]>, + where each is a generator or a filter, then + Rep(E) = . For Rep(W), see + below. + If E is , where is a body, then + Rep(E) = . + If E is , + where each is an if clause then + Rep(E) = + . + If E is , + where is an expression and each is a + case clause then + Rep(E) = + . + If E is , + where is a body and each is a catch clause then + Rep(E) = + . + If E is , + where is a body, + each is a case clause and + each is a catch clause then + Rep(E) = + . + If E is , + where and are bodies then + Rep(E) = + . + If E is , + where and are a bodies and + each is a case clause then + Rep(E) = + . + If E is , + where and are bodies and + each is a catch clause then + Rep(E) = + . + If E is , + where and are a bodies, + each is a case clause and + each is a catch clause then + Rep(E) = + . + If E is , + where each is a case clause then + Rep(E) = + . + If E is B_t end]]>, + where each is a case clause, + is an expression and is a body, then + Rep(E) = + . + If E is , then + Rep(E) = . + If E is , then + Rep(E) = . + (Before the R15 release: Rep(E) = .) + If E is + where each is a function clause then Rep(E) = + . + If E is + where is a variable and each + is a function clause then Rep(E) = + . - If E is ( E_0 ), then - Rep(E) = Rep(E_0), that is, parenthesized - expressions cannot be distinguished from their bodies. + If E is , + where each is a generator or a filter, then + Rep(E) = . + For Rep(W), see below. + If E is , a Mnesia record access + inside a query, then + Rep(E) = . + If E is , then + Rep(E) = , + i.e., parenthesized expressions cannot be distinguished from their bodies.
- Generators and Filters -

When W is a generator or a filter (in the body of a list or - binary comprehension), then:

+ Generators and filters +

When W is a generator or a filter (in the body of a list or binary comprehension), then:

- If W is a generator P <- E, where P is - a pattern and E is an expression, then - Rep(W) = {generate,LINE,Rep(P),Rep(E)}. - If W is a generator P <= E, where P is - a pattern and E is an expression, then - Rep(W) = {b_generate,LINE,Rep(P),Rep(E)}. - If W is a filter E, which is an expression, then - Rep(W) = Rep(E). + If W is a generator , where is a pattern and + is an expression, then + Rep(W) = . + If W is a generator , where is a pattern and + is an expression, then + Rep(W) = . + If W is a filter , which is an expression, then + Rep(W) = .
- Binary Element Type Specifiers + Binary element type specifiers

A type specifier list TSL for a binary element is a sequence of type - specifiers TS_1 - ... - TS_k. - Rep(TSL) = [Rep(TS_1), ..., Rep(TS_k)].

+ specifiers . + Rep(TSL) = .

When TS is a type specifier for a binary element, then:

- If TS is an atom A, then Rep(TS) = A. - If TS is a couple A:Value where A is an atom - and Value is an integer, then Rep(TS) = - {A,Value}. + If TS is an atom , Rep(TS) = . + If TS is a couple where is an atom and + is an integer, Rep(TS) = .
- Map Assoc and Exact Fields + Map assoc and exact fields

When W is an assoc or exact field (in the body of a map), then:

- If W is an assoc field K => V, where - K and V are both expressions, - then Rep(W) = {map_field_assoc,LINE,Rep(K),Rep(V)}. + If W is an assoc field V]]>, where + and are both expressions, + then Rep(W) = . - If W is an exact field K := V, where - K and V are both expressions, - then Rep(W) = {map_field_exact,LINE,Rep(K),Rep(V)}. + If W is an exact field , where + and are both expressions, + then Rep(W) = .
@@ -394,220 +361,112 @@
Clauses -

There are function clauses, if clauses, case clauses +

There are function clauses, if clauses, case clauses and catch clauses.

-

A clause C is one of the following alternatives:

+

A clause is one of the following alternatives:

- If C is a function clause ( Ps ) -> B - where Ps is a pattern sequence and B is a body, then - Rep(C) = {clause,LINE,Rep(Ps),[],Rep(B)}. - If C is a function clause ( Ps ) when Gs -> B - where Ps is a pattern sequence, - Gs is a guard sequence and B is a body, then - Rep(C) = {clause,LINE,Rep(Ps),Rep(Gs),Rep(B)}. - If C is an if clause Gs -> B - where Gs is a guard sequence and B is a body, then - Rep(C) = {clause,LINE,[],Rep(Gs),Rep(B)}. - If C is a case clause P -> B - where P is a pattern and B is a body, then - Rep(C) = {clause,LINE,[Rep(P)],[],Rep(B)}. - If C is a case clause P when Gs -> B - where P is a pattern, - Gs is a guard sequence and B is a body, then - Rep(C) = {clause,LINE,[Rep(P)],Rep(Gs),Rep(B)}. - If C is a catch clause P -> B - where P is a pattern and B is a body, then - Rep(C) = {clause,LINE,[Rep({throw,P,_})],[],Rep(B)}. - If C is a catch clause X : P -> B - where X is an atomic literal or a variable pattern, - P is a pattern and B is a body, then - Rep(C) = {clause,LINE,[Rep({X,P,_})],[],Rep(B)}. - If C is a catch clause P when Gs -> B - where P is a pattern, Gs is a guard sequence - and B is a body, then - Rep(C) = {clause,LINE,[Rep({throw,P,_})],Rep(Gs),Rep(B)}. - If C is a catch clause X : P when Gs -> B - where X is an atomic literal or a variable pattern, - P is a pattern, Gs is a guard sequence - and B is a body, then - Rep(C) = {clause,LINE,[Rep({X,P,_})],Rep(Gs),Rep(B)}. + If C is a function clause B]]> + where is a pattern sequence and is a body, then + Rep(C) = . + If C is a function clause B]]> + where is a pattern sequence, + is a guard sequence and is a body, then + Rep(C) = . + If C is an if clause B]]> + where is a guard sequence and is a body, then + Rep(C) = . + If C is a case clause B]]> + where is a pattern and is a body, then + Rep(C) = . + If C is a case clause B]]> + where is a pattern, + is a guard sequence and is a body, then + Rep(C) = . + If C is a catch clause B]]> + where is a pattern and is a body, then + Rep(C) = . + If C is a catch clause B]]> + where is an atomic literal or a variable pattern, + is a pattern and is a body, then + Rep(C) = . + If C is a catch clause B]]> + where is a pattern, is a guard sequence + and is a body, then + Rep(C) = . + If C is a catch clause B]]> + where is an atomic literal or a variable pattern, + is a pattern, is a guard sequence + and is a body, then + Rep(C) = .
Guards -

A guard sequence Gs is a sequence of guards G_1; ...; G_k, and - Rep(Gs) = [Rep(G_1), ..., Rep(G_k)]. If the guard sequence is - empty, Rep(Gs) = [].

-

A guard G is a nonempty sequence of guard tests - Gt_1, ..., Gt_k, and Rep(G) = - [Rep(Gt_1), ..., Rep(Gt_k)].

-

A guard test Gt is one of the following alternatives:

+

A guard sequence Gs is a sequence of guards , and + Rep(Gs) = . If the guard sequence is + empty, Rep(Gs) = .

+

A guard G is a nonempty sequence of guard tests , and + Rep(G) = .

+

A guard test is one of the following alternatives:

If Gt is an atomic literal L, then Rep(Gt) = Rep(L). - If Gt is a variable pattern V, then - Rep(Gt) = {var,LINE,A}, where A is an atom with - a printname consisting of the same characters as V. - If Gt is a tuple skeleton {Gt_1, ..., Gt_k}, then - Rep(Gt) = {tuple,LINE,[Rep(Gt_1), ..., Rep(Gt_k)]}. - If Gt is [], then Rep(Gt) = {nil,LINE}. - If Gt is a cons skeleton [Gt_h | Gt_t], then - Rep(Gt) = {cons,LINE,Rep(Gt_h),Rep(Gt_t)}. - If Gt is a binary constructor - <<Gt_1:Size_1/TSL_1, ..., Gt_k:Size_k/TSL_k>>, then - Rep(Gt) = {bin,LINE,[{bin_element,LINE,Rep(Gt_1),Rep(Size_1),Rep(TSL_1)}, ..., {bin_element,LINE,Rep(Gt_k),Rep(Size_k),Rep(TSL_k)}]}. + If Gt is a variable pattern , then + Rep(Gt) = , + where A is an atom with a printname consisting of the same characters as + . + If Gt is a tuple skeleton , then + Rep(Gt) = . + If Gt is , then + Rep(Gt) = . + If Gt is a cons skeleton , then + Rep(Gt) = . + If Gt is a binary constructor >]]>, then + Rep(Gt) = . For Rep(TSL), see above. - An omitted Size is represented by default. - An omitted TSL (type specifier list) is represented - by default. - If Gt is Gt_1 Op Gt_2, where Op - is a binary operator, then Rep(Gt) = - {op,LINE,Op,Rep(Gt_1),Rep(Gt_2)}. - If Gt is Op Gt_0, where Op is a unary operator, then - Rep(Gt) = {op,LINE,Op,Rep(Gt_0)}. - If Gt is #Name{Field_1=Gt_1, ..., Field_k=Gt_k}, then - Rep(E) = - {record,LINE,Name,[{record_field,LINE,Rep(Field_1),Rep(Gt_1)}, ..., {record_field,LINE,Rep(Field_k),Rep(Gt_k)}]}. - If Gt is #Name.Field, then - Rep(Gt) = {record_index,LINE,Name,Rep(Field)}. - If Gt is Gt_0#Name.Field, then - Rep(Gt) = {record_field,LINE,Rep(Gt_0),Name,Rep(Field)}. - If Gt is A(Gt_1, ..., Gt_k), where A is an atom, then - Rep(Gt) = {call,LINE,Rep(A),[Rep(Gt_1), ..., Rep(Gt_k)]}. - If Gt is A_m:A(Gt_1, ..., Gt_k), where A_m is - the atom erlang and A is an atom or an operator, then - Rep(Gt) = {call,LINE,{remote,LINE,Rep(A_m),Rep(A)},[Rep(Gt_1), ..., Rep(Gt_k)]}. - If Gt is {A_m,A}(Gt_1, ..., Gt_k), where A_m is - the atom erlang and A is an atom or an operator, then - Rep(Gt) = {call,LINE,Rep({A_m,A}),[Rep(Gt_1), ..., Rep(Gt_k)]}. - - If Gt is ( Gt_0 ), then - Rep(Gt) = Rep(Gt_0), that is, parenthesized - guard tests cannot be distinguished from their bodies. + An omitted is represented by . An omitted + (type specifier list) is represented by . + If Gt is , where + is a binary operator, then Rep(Gt) = . + If Gt is , where is a unary operator, then + Rep(Gt) = . + If Gt is , then + Rep(E) = + . + If Gt is , then + Rep(Gt) = . + If Gt is , then + Rep(Gt) = . + If Gt is , where is an atom, then + Rep(Gt) = . + If Gt is , where is + the atom and is an atom or an operator, then + Rep(Gt) = . + If Gt is , where is + the atom and is an atom or an operator, then + Rep(Gt) = . + If Gt is , then + Rep(Gt) = , + i.e., parenthesized guard tests cannot be distinguished from their bodies.

Note that every guard test has the same source form as some expression, and is represented the same way as the corresponding expression.

- Types - - If T is an annotated type Anno :: Type, - where Anno is a variable and - Type is a type, then Rep(T) = - {ann_type,LINE,[Rep(Anno),Rep(Type)]}. - If T is an atom or integer literal L, then Rep(T) = Rep(L). - - If T is L Op R, - where Op is a binary operator and L and R - are types (this is an occurrence of an expression that can be - evaluated to an integer at compile time), then - Rep(T) = {op,LINE,Op,Rep(L),Rep(R)}. - If T is Op A, where Op is a - unary operator and A is a type (this is an occurrence of - an expression that can be evaluated to an integer at compile time), - then Rep(T) = {op,LINE,Op,Rep(A)}. - If T is a bitstring type <<_:M,_:_*N>>, - where M and N are singleton integer types, then Rep(T) = - {type,LINE,binary,[Rep(M),Rep(N)]}. - If T is the empty list type [], then Rep(T) = - {type,Line,nil,[]}. - If T is a fun type fun(), then Rep(T) = - {type,LINE,'fun',[]}. - If T is a fun type fun((...) -> B), - where B is a type, then - Rep(T) = {type,LINE,'fun',[{type,LINE,any},Rep(B)]}. - - If T is a fun type fun(Ft), where - Ft is a function type, - then Rep(T) = Rep(Ft). - If T is an integer range type L .. H, - where L and H are singleton integer types, then - Rep(T) = {type,LINE,range,[Rep(L),Rep(H)]}. - If T is a map type map(), then Rep(T) = - {type,LINE,map,any}. - If T is a map type #{P_1, ..., P_k}, where each - P_i is a map pair type, then Rep(T) = - {type,LINE,map,[Rep(P_1), ..., Rep(P_k)]}. - If T is a map pair type K => V, where - K and V are types, then Rep(T) = - {type,LINE,map_field_assoc,[Rep(K),Rep(V)]}. - If T is a predefined (or built-in) type N(A_1, ..., A_k), - where each A_i is a type, then Rep(T) = - {type,LINE,N,[Rep(A_1), ..., Rep(A_k)]}. - If T is a record type #Name{F_1, ..., F_k}, - where each F_i is a record field type, then Rep(T) = - {type,LINE,record,[Rep(Name),Rep(F_1), ..., Rep(F_k)]}. - - If T is a record field type Name :: Type, - where Type is a type, then Rep(T) = - {type,LINE,field_type,[Rep(Name),Rep(Type)]}. - If T is a remote type M:N(A_1, ..., A_k), where - each A_i is a type, then Rep(T) = - {remote_type,LINE,[Rep(M),Rep(N),[Rep(A_1), ..., Rep(A_k)]]}. - - If T is a tuple type tuple(), then Rep(T) = - {type,LINE,tuple,any}. - If T is a tuple type {A_1, ..., A_k}, where - each A_i is a type, then Rep(T) = - {type,LINE,tuple,[Rep(A_1), ..., Rep(A_k)]}. - If T is a type union T_1 | ... | T_k, - where each T_i is a type, then Rep(T) = - {type,LINE,union,[Rep(T_1), ..., Rep(T_k)]}. - If T is a type variable V, then Rep(T) = - {var,LINE,A}, where A is an atom with a printname - consisting of the same characters as V. A type variable - is any variable except underscore (_). - If T is a user-defined type N(A_1, ..., A_k), - where each A_i is a type, then Rep(T) = - {user_type,LINE,N,[Rep(A_1), ..., Rep(A_k)]}. - If T is ( T_0 ), then Rep(T) = Rep(T_0), - that is, parenthesized types cannot be distinguished from their - bodies. - - -
- Function Types - - If Ft is a constrained function type Ft_1 when Fc, - where Ft_1 is a function type and - Fc is a function constraint, then Rep(T) = - {type,LINE,bounded_fun,[Rep(Ft_1),Rep(Fc)]}. - If Ft is a function type (A_1, ..., A_n) -> B, - where each A_i and B are types, then - Rep(Ft) = {type,LINE,'fun',[{type,LINE,product,[Rep(A_1), - ..., Rep(A_n)]},Rep(B)]}. - -
- -
- Function Constraints -

A function constraint Fc is a nonempty sequence of constraints - C_1, ..., C_k, and - Rep(Fc) = [Rep(C_1), ..., Rep(C_k)].

- - If C is a constraint is_subtype(V, T) or V :: T, - where V is a type variable and T is a type, then - Rep(C) = {type,LINE,constraint,[{atom,LINE,is_subtype},[Rep(V),Rep(T)]]}. - - -
-
- -
- The Abstract Format After Preprocessing -

The compilation option debug_info can be given to the - compiler to have the abstract code stored in - the abstract_code chunk in the BEAM file + The abstract format after preprocessing +

The compilation option can be given to the + compiler to have the abstract code stored in + the chunk in the BEAM file (for debugging purposes).

-

In OTP R9C and later, the abstract_code chunk will +

In OTP R9C and later, the chunk will contain

-

{raw_abstract_v1,AbstractCode}

-

where AbstractCode is the abstract code as described +

+

where is the abstract code as described in this document.

In releases of OTP prior to R9C, the abstract code after some more processing was stored in the BEAM file. The first element of the - tuple would be either abstract_v1 (R7B) or abstract_v2 + tuple would be either (R7B) or (R8B).

diff -Nru erlang-18.2-dfsg/erts/doc/src/alt_dist.xml erlang-17.3-dfsg/erts/doc/src/alt_dist.xml --- erlang-18.2-dfsg/erts/doc/src/alt_dist.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/alt_dist.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/book.xml erlang-17.3-dfsg/erts/doc/src/book.xml --- erlang-18.2-dfsg/erts/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/communication.xml erlang-17.3-dfsg/erts/doc/src/communication.xml --- erlang-18.2-dfsg/erts/doc/src/communication.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/communication.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/crash_dump.xml erlang-17.3-dfsg/erts/doc/src/crash_dump.xml --- erlang-18.2-dfsg/erts/doc/src/crash_dump.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/crash_dump.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -56,12 +55,10 @@ emulator or the operating system can be reconfigured to avoid the crash, which is why interpreting the crash dump correctly is important.

-

On systems that support OS signals, it is also possible to stop - the runtime system and generate a crash dump by sending the SIGUSR1.

The erlang crash dump is a readable text file, but it might not be very easy to read. Using the Crashdump Viewer tool in the application will simplify the task. This is an - wx-widget based tool for browsing Erlang crash dumps.

+ HTML based tool for browsing Erlang crash dumps.

@@ -69,9 +66,8 @@

The first part of the dump shows the creation time for the dump, a slogan indicating the reason for the dump, the system version, of the node from which the dump originates, the compile time of - the emulator running the originating node, the number of - atoms in the atom table and the runtime system thread that caused - the crash dump to happen. + the emulator running the originating node and the number of + atoms in the atom table.

@@ -89,20 +85,22 @@ operating system.

"<A>: Cannot allocate <N> - bytes of memory (of type "<T>")." - The system - has run out of memory. <A> is the allocator that failed - to allocate memory, <N> is the number of bytes that - <A> tried to allocate, and <T> is the memory block - type that the memory was needed for. The most common case is - that a process stores huge amounts of data. In this case - <T> is most often , , - , or . For more information on - allocators see - erts_alloc(3). + bytes of memory (of type "<T>", thread + <I>em>)." - The system has run out of memory. <A> + is the allocator that failed to allocate memory, <N> is the + number of bytes that <A> tried to allocate, <T> is the + memory block type that the memory was needed for, and <I> is the + thread identifier. The most common case is that a process stores huge + amounts of data. In this case <T> is most often + , , + , or . + For more information on allocators see + erts_alloc(3). "<A>: Cannot reallocate <N> - bytes of memory (of type "<T>")." - Same as - above with the exception that memory was being reallocated - instead of being allocated when the system ran out of memory. + bytes of memory (of type "<T>", thread + <I>em>)." - Same as above with the exception that memory + was being reallocated instead of being allocated when the system ran + out of memory. "Unexpected op code N" - Error in compiled code, file damaged or error in the compiler. "Module Name undefined" "Function @@ -117,9 +115,8 @@ sockets/pipes can be used simultaneously by Erlang (due to limitations in the Unix call). The number of open regular files is not affected by this. - "Received SIGUSR1" - Sending the SIGUSR1 signal to a - Erlang machine (Unix only) forces a crash dump. This slogan reflects - that the Erlang machine crash-dumped due to receiving that signal. + "Received SIGUSR1" - The SIGUSR1 signal was sent to the + Erlang machine (Unix only). "Kernel pid terminated (Who) (Exit-reason)" - The kernel supervisor has detected a failure, usually that the @@ -172,60 +169,6 @@
- - Scheduler information -

Under the tag =scheduler information about the current state - and statistics of the schedulers in the runtime system is displayed. - On OSs that do allow instant suspension of other threads, the data within - this section will reflect what the runtime system looks like at the moment - when the crash happens.

-

The following fields can exist for a process:

- - =scheduler:id - Header, states the scheduler identifier. - Scheduler Sleep Info Flags - If empty the scheduler was doing some work. - If not empty the scheduler is either in some state of sleep, - or suspended. This entry is only present in a SMP enabled emulator - Scheduler Sleep Info Aux Work - If not empty, a scheduler internal auxiliary work is scheduled - to be done. - Current Port - The port identifier of the port that is currently being - executed by the scheduler. - Current Process - The process identifier of the process that is currently being - executed by the scheduler. If there is such a process this entry is - followed by the State,Internal State, - Program Counter, CP of that same process. See - Process Information for a - description what the different entries mean. Keep in mind that - this is a snapshot of what the entries are exactly when the crash - dump is starting to be generated. Therefore they will most likely - be different (and more telling) then the entries for the same - processes found in the =proc section. If there is no currently - running process, only the Current Process entry will be printed. - - Current Process Limited Stack Trace - This entry only shows up if there is a current process. It is very - similar to =proc_stack, - except that only the function frames are printed (i.e. the stack variables - are omited). It is also limited to only print the top and bottom part - of the stack. If the stack is small (less that 512 slots) then the - entire stack will be printed. If not, an entry stating - skipping ## slots will be printed where ## is - replaced by the number of slots that has been skipped. - Run Queue - Displays statistics about how many processes and ports - of different priorities are scheduled on this scheduler. - ** crashed ** - This entry is normally not printed. It signifies that getting - the rest of the information about this scheduler failed for some reason. - - -
- -
Memory information

Under the tag =memory you will find information similar @@ -305,6 +248,9 @@ Last scheduled in for | Current call The current function of the process. These fields will not always exist. + Run queue + The identifier of the scheduler run queue in which the process is + running. Spawned by The parent of the process, i.e. the process which executed or . @@ -367,9 +313,6 @@ The number of live argument registers. The argument registers, if any are live, will follow. These may contain the arguments of the function if they are not yet moved to the stack. - Internal State - A more detailed internal represantation of the state of - this process.

See also the section about process data.

@@ -395,38 +338,18 @@ Name The name of the table, regardless of whether it is a or not. - Hash table, Buckets + Buckets This occurs if the table is a hash table, i.e. if it is not an . - Hash table, Chain Length - Only applicable for hash tables. Contains statistics about the - hash table, such as the max, min and avg chain length. Having a max much - larger than the avg, and a std dev much larger that - the expected std dev is a sign that the hashing of the terms is - behaving badly for some reason. Ordered set (AVL tree), Elements This occurs only if the table is an . (The number of elements is the same as the number of objects in the table.) - Fixed - If the table is fixed using ets:safe_fixtable or some internal - mechanism. Objects The number of objects in the table Words The number of words (usually 4 bytes/word) allocated to data in the table. - Type - The type of the table, i.e. set, bag, - dublicate_bag or ordered_set. - Compressed - If this table was compressed. - Protection - The protection of this table. - Write Concurrency - If write_concurrency was enabled for this table. - Read Concurrency - If read_concurrency was enabled for this table.
diff -Nru erlang-18.2-dfsg/erts/doc/src/driver_entry.xml erlang-17.3-dfsg/erts/doc/src/driver_entry.xml --- erlang-18.2-dfsg/erts/doc/src/driver_entry.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/driver_entry.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
- 20012015 + 20012013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -126,7 +125,7 @@
DATA TYPES - ErlDrvEntry + ErlDrvEntry

@@ -211,7 +210,7 @@ number >= 0 or a pointer, or if the driver can't be started, one of three error codes should be returned:

ERL_DRV_ERROR_GENERAL - general error, no error code

-

ERL_DRV_ERROR_ERRNO - error with error code in errno

+

ERL_DRV_ERROR_ERRNO - error with error code in erl_errno

ERL_DRV_ERROR_BADARG - error, badarg

If an error code is returned, the port isn't started.

@@ -235,7 +234,6 @@ void (*ready_input)(ErlDrvData drv_data, ErlDrvEvent event) - void (*ready_output)(ErlDrvData drv_data, ErlDrvEvent event)

This is called when a driver event (given in the diff -Nru erlang-18.2-dfsg/erts/doc/src/driver.xml erlang-17.3-dfsg/erts/doc/src/driver.xml --- erlang-18.2-dfsg/erts/doc/src/driver.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/driver.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/epmd.xml erlang-17.3-dfsg/erts/doc/src/epmd.xml --- erlang-18.2-dfsg/erts/doc/src/epmd.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/epmd.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/erlang.xml erlang-17.3-dfsg/erts/doc/src/erlang.xml --- erlang-18.2-dfsg/erts/doc/src/erlang.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/erlang.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@

- 19962015 + 19962013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -30,107 +29,36 @@ erlang.xml
erlang - The Erlang BIFs. + The Erlang BIFs -

By convention, most Built-In Functions (BIFs) are seen as being - in this module. Some of the BIFs are viewed more +

By convention, most built-in functions (BIFs) are seen as being + in the module erlang. A number of the BIFs are viewed more or less as part of the Erlang programming language and are - auto-imported. Thus, it is not necessary to specify the - module name. For example, the calls atom_to_list(Erlang) - and erlang:atom_to_list(Erlang) are identical.

-

Auto-imported BIFs are listed without module prefix. + auto-imported. Thus, it is not necessary to specify + the module name and both the calls atom_to_list(Erlang) and + erlang:atom_to_list(Erlang) are identical.

+

In the text, auto-imported BIFs are listed without module prefix. BIFs listed with module prefix are not auto-imported.

-

BIFs can fail for various reasons. All BIFs fail with +

BIFs may fail for a variety of reasons. All BIFs fail with reason badarg if they are called with arguments of an - incorrect type. The other reasons are described in the - description of each individual BIF.

-

Some BIFs can be used in guard tests and are marked with + incorrect type. The other reasons that may make BIFs fail are + described in connection with the description of each individual + BIF.

+

Some BIFs may be used in guard tests, these are marked with "Allowed in guard tests".

- ext_binary() + ext_binary() -

A binary data object, structured according to the Erlang external term format.

- -

See erlang:timestamp/0.

-
-
- - -

- Supported time unit representations:

- - PartsPerSecond :: integer() >= 1 -

Time unit expressed in parts per second. That is, - the time unit equals 1/PartsPerSecond second.

- - seconds -

Symbolic representation of the time unit - represented by the integer 1.

- - milli_seconds -

Symbolic representation of the time unit - represented by the integer 1000.

- - micro_seconds -

Symbolic representation of the time unit - represented by the integer 1000000.

- - nano_seconds -

Symbolic representation of the time unit - represented by the integer 1000000000.

- - native -

Symbolic representation of the native time unit - used by the Erlang runtime system.

- -

The native time unit is determined at - runtime system start, and remains the same until - the runtime system terminates. If a runtime system - is stopped and then started again (even on the same - machine), the native time unit of the new - runtime system instance can differ from the - native time unit of the old runtime system - instance.

- -

One can get an approximation of the native - time unit by calling erlang:convert_time_unit(1, - seconds, native). The result equals the number - of whole native time units per second. In case - the number of native time units per second does - not add up to a whole number, the result is rounded downwards.

- - -

The value of the native time unit gives - you more or less no information at all about the - quality of time values. It sets a limit for - the - resolution - as well as for the - precision - of time values, - but it gives absolutely no information at all about the - accuracy - of time values. The resolution of the native time - unit and the resolution of time values can differ - significantly.

-
-
- -
- -

The time_unit/0 type may be extended. Use - erlang:convert_time_unit/3 - in order to convert time values between time units.

- +

See now/0.

@@ -139,15 +67,12 @@ - Arithmetical absolute value. - - Float = float() - Int = integer() - - -

Returns an integer or float that is the arithmetical - absolute value of Float or - Int, for example:

+ + + Arithmetical absolute value + +

Returns an integer or float which is the arithmetical + absolute value of Float or Int.

 > abs(-3.33).
 3.33
@@ -156,214 +81,206 @@
         

Allowed in guard tests.

- - Computes adler32 checksum. + Compute adler32 checksum -

Computes and returns the adler32 checksum for - Data.

+

Computes and returns the adler32 checksum for Data.

- - Computes adler32 checksum. + Compute adler32 checksum -

Continues computing the adler32 checksum by combining - the previous checksum, OldAdler, with - the checksum of Data.

-

The following code:

- - X = erlang:adler32(Data1), - Y = erlang:adler32(X,Data2). -

assigns the same value to Y as this:

- - Y = erlang:adler32([Data1,Data2]). +

Continue computing the adler32 checksum by combining + the previous checksum, OldAdler, with the checksum of + Data.

+

The following code:

+ + X = erlang:adler32(Data1), + Y = erlang:adler32(X,Data2). + +

- would assign the same value to Y as this would:

+ + Y = erlang:adler32([Data1,Data2]). +
- - Combines two adler32 checksums. + Combine two adler32 checksums -

Combines two previously computed adler32 checksums. - This computation requires the size of the data object for - the second checksum to be known.

-

The following code:

- - Y = erlang:adler32(Data1), - Z = erlang:adler32(Y,Data2). -

assigns the same value to Z as this:

- - X = erlang:adler32(Data1), - Y = erlang:adler32(Data2), - Z = erlang:adler32_combine(X,Y,iolist_size(Data2)). +

Combines two previously computed adler32 checksums. + This computation requires the size of the data object for + the second checksum to be known.

+

The following code:

+ + Y = erlang:adler32(Data1), + Z = erlang:adler32(Y,Data2). + +

- would assign the same value to Z as this would:

+ + X = erlang:adler32(Data1), + Y = erlang:adler32(Data2), + Z = erlang:adler32_combine(X,Y,iolist_size(Data2)). +
- - Appends an extra element to a tuple. + Append an extra element to a tuple -

Returns a new tuple that has one element more than - Tuple1, and contains the elements in - Tuple1 - followed by Term as the last element. - Semantically equivalent to - list_to_tuple(tuple_to_list(Tuple1) ++ - [Term]), but much faster.

-

Example:

+

Returns a new tuple which has one element more than + Tuple1, and contains the elements in Tuple1 + followed by Term as the last element. Semantically + equivalent to + list_to_tuple(tuple_to_list(Tuple1) ++ [Term]), but much + faster.

 > erlang:append_element({one, two}, three).
 {one,two,three}
- - Applies a function to an argument list. + Apply a function to an argument list -

Calls a fun, passing the elements in Args - as arguments.

-

If the number of elements in the arguments are known at - compile time, the call is better written as +

Call a fun, passing the elements in Args as + arguments.

+

Note: If the number of elements in the arguments are known at + compile-time, the call is better written as Fun(Arg1, Arg2, ... ArgN).

Earlier, Fun could also be given as {Module, Function}, equivalent to - apply(Module, Function, Args). This use is - deprecated and will stop working in a future release.

+ apply(Module, Function, Args). This usage is + deprecated and will stop working in a future release of + Erlang/OTP.

- - Applies a function to an argument list. + Apply a function to an argument list

Returns the result of applying Function in - Module to Args. - The applied function must + Module to Args. The applied function must be exported from Module. The arity of the function is the length of Args.

-

Example:

 > apply(lists, reverse, [[a, b, c]]).
-[c,b,a]
+[c,b,a]
+

apply can be used to evaluate BIFs by using + the module name erlang.

+
 > apply(erlang, atom_to_list, ['Erlang']).
 "Erlang"
-

If the number of arguments are known at compile time, +

Note: If the number of arguments are known at compile-time, the call is better written as Module:Function(Arg1, Arg2, ..., ArgN).

Failure: error_handler:undefined_function/3 is called if the applied function is not exported. The error handler can be redefined (see process_flag/2). - If error_handler is undefined, or if the user has + If the error_handler is undefined, or if the user has redefined the default error_handler so the replacement module is undefined, an error with the reason undef is generated.

- - Returns the binary representation of an atom. + Return the binary representation of an atom -

Returns a binary corresponding to the text - representation of Atom. - If Encoding - is latin1, there is one byte for each character - in the text representation. If Encoding is - utf8 or - unicode, the characters are encoded using UTF-8 - (that is, characters from 128 through 255 are - encoded in two bytes).

-

atom_to_binary(Atom, latin1) never - fails because the text representation of an atom can only - contain characters from 0 through 255. In a future release, - the text representation - of atoms can be allowed to contain any Unicode character and - atom_to_binary(Atom, latin1) will then fail if the - text representation for Atom contains a Unicode - character greater than 255.

-

Example:

+

Returns a binary which corresponds to the text + representation of Atom. If Encoding + is latin1, there will be one byte for each character + in the text representation. If Encoding is + utf8 or + unicode, the characters will be encoded using UTF-8 + (meaning that characters from 16#80 up to 0xFF will be + encoded in two bytes).

+ +

Currently, atom_to_binary(Atom, latin1) can + never fail because the text representation of an atom can only contain + characters from 0 to 16#FF. In a future release, the text representation + of atoms might be allowed to contain any Unicode character + and atom_to_binary(Atom, latin1) will fail if the + text representation for the Atom contains a Unicode + character greater than 16#FF.

+
 > atom_to_binary('Erlang', latin1).
 <<"Erlang">>
- - Text representation of an atom. + Text representation of an atom -

Returns a string corresponding to the text - representation of Atom, for example:

+

Returns a string which corresponds to the text + representation of Atom.

 > atom_to_list('Erlang').
 "Erlang"
- - Extracts a part of a binary. + Extracts a part of a binary -

Extracts the part of the binary described by - PosLen.

-

Negative length can be used to extract bytes at the end - of a binary, for example:

+

Extracts the part of the binary described by PosLen.

+ +

Negative length can be used to extract bytes at the end of a binary:

+ 1> Bin = <<1,2,3,4,5,6,7,8,9,10>>. 2> binary_part(Bin,{byte_size(Bin), -5}). -<<6,7,8,9,10>> -

Failure: badarg if PosLen in any way - references outside the binary.

-

Start is zero-based, that is:

+<<6,7,8,9,10>> +
+ +

If PosLen in any way references outside the binary, a badarg exception is raised.

+ +

Start is zero-based, i.e.:

1> Bin = <<1,2,3>> 2> binary_part(Bin,{0,2}). -<<1,2>> -

For details about the PosLen semantics, see the - binary - manual page in STDLIB.

+<<1,2>> + + +

See the STDLIB module binary for details about the PosLen semantics.

+

Allowed in guard tests.

- - Extracts a part of a binary. + Extracts a part of a binary -

The same as binary_part(Subject, - {Start, Length}).

+

The same as binary_part(Subject, {Start, Length}).

+

Allowed in guard tests.

- - Converts from text representation to an atom. + Convert from text representation to an atom

Returns the atom whose text representation is - Binary. - If Encoding is latin1, no - translation of bytes in the binary is done. - If Encoding - is utf8 or unicode, the binary must contain - valid UTF-8 sequences. Only Unicode characters up - to 255 are allowed.

-

binary_to_atom(Binary, utf8) fails if - the binary contains Unicode characters greater than 255. - In a future release, such Unicode characters can be allowed - and binary_to_atom(Binary, utf8) does then not fail. - For more information on Unicode support in atoms, see the - note on UTF-8 - encoded atoms - in Section "External Term Format" in the User's Guide.

-

Examples:

+ Binary. If Encoding is latin1, no + translation of bytes in the binary is done. If Encoding + is utf8 or unicode, the binary must contain + valid UTF-8 sequences; furthermore, only Unicode characters up + to 0xFF are allowed.

+ +

binary_to_atom(Binary, utf8) will fail if + the binary contains Unicode characters greater than 16#FF. + In a future release, such Unicode characters might be allowed + and binary_to_atom(Binary, utf8) + will not fail in that case. For more information on Unicode support in atoms + see note on UTF-8 encoded atoms + in the chapter about the external term format in the ERTS User's Guide.

+
 > binary_to_atom(<<"Erlang">>, latin1).
 'Erlang'
@@ -373,24 +290,20 @@
         called as binary_to_atom(<<208,128>>,utf8)
- - Converts from text representation to an atom. + Convert from text representation to an atom -

As - binary_to_atom/2, - but the atom must exist.

-

Failure: badarg if the atom does not exist.

+

Works like binary_to_atom/2, + but the atom must already exist.

+

Failure: badarg if the atom does not already exist.

- - Converts from text representation to a float. + Convert from text representation to a float -

Returns the float whose text representation is - Binary, for example:

+

Returns the float whose text representation is Binary.

 > binary_to_float(<<"2.2017764e+0">>).
 2.2017764
@@ -398,13 +311,12 @@ representation of a float.

- - Converts from text representation to an integer. + Convert from text representation to an integer

Returns an integer whose text representation is - Binary, for example:

+ Binary.

 > binary_to_integer(<<"123">>).
 123
@@ -412,13 +324,12 @@ representation of an integer.

- - Converts from text representation to an integer. + Convert from text representation to an integer

Returns an integer whose text representation in base - Base is Binary, for example:

+ Base is Binary.

 > binary_to_integer(<<"3FF">>, 16).
 1023
@@ -426,101 +337,93 @@ representation of an integer.

- - Converts a binary to a list. + Convert a binary to a list -

Returns a list of integers corresponding to the bytes of +

Returns a list of integers which correspond to the bytes of Binary.

- - Converts part of a binary to a list. - 1..byte_size(Binary) + Convert part of a binary to a list + 1..byte_size(Binary)

As binary_to_list/1, but returns a list of integers corresponding to the bytes from position Start to - position Stop in Binary. - The positions in the + position Stop in Binary. Positions in the binary are numbered starting from 1.

-

The one-based indexing for binaries used by - this function is deprecated. New code is to use - binary:bin_to_list/3 - in STDLIB instead. All functions in module - binary consistently use zero-based indexing.

+ +

This function's indexing style of using one-based indices for + binaries is deprecated. New code should use the functions in + the STDLIB module binary instead. They consequently + use the same (zero-based) style of indexing.

- - Converts a bitstring to a list. + Convert a bitstring to a list -

Returns a list of integers corresponding to the bytes of - Bitstring. If the number of bits in the binary - is not divisible by 8, the last element of the list is a bitstring - containing the remaining 1-7 bits.

+

Returns a list of integers which correspond to the bytes of + Bitstring. If the number of bits in the binary is not + divisible by 8, the last element of the list will be a bitstring + containing the remaining bits (1 up to 7 bits).

- - Decodes an Erlang external term format binary. + Decode an Erlang external term format binary -

Returns an Erlang term that is the result of decoding - binary object Binary, which must be encoded +

Returns an Erlang term which is the result of decoding + the binary object Binary, which must be encoded according to the Erlang external term format.

-

When decoding binaries from untrusted sources, - consider using binary_to_term/2 to prevent Denial - of Service attacks.

-

See also - term_to_binary/1 - and - binary_to_term/2.

+ +

When decoding binaries from untrusted sources, consider using + binary_to_term/2 to prevent denial of service attacks.

+
+

See also + term_to_binary/1 + and + binary_to_term/2.

- - Decodes an Erlang external term format binary. + Decode an Erlang external term format binary

As binary_to_term/1, but takes options that affect decoding of the binary.

safe -

Use this option when receiving binaries from an untrusted +

Use this option when receiving binaries from an untrusted source.

-

When enabled, it prevents decoding data that can be used to - attack the Erlang system. In the event of receiving unsafe - data, decoding fails with a badarg error.

-

This prevents creation of new atoms directly, - creation of new atoms indirectly (as they are embedded in - certain structures, such as process identifiers, - refs, and funs), and - creation of new external function references. - None of those resources are garbage collected, so unchecked - creation of them can exhaust available memory.

+

When enabled, it prevents decoding data that may be used to + attack the Erlang system. In the event of receiving unsafe + data, decoding fails with a badarg error.

+

Currently, this prevents creation of new atoms directly, + creation of new atoms indirectly (as they are embedded in + certain structures like pids, refs, funs, etc.), and creation of + new external function references. None of those resources are + currently garbage collected, so unchecked creation of them can + exhaust available memory.

-

Failure: badarg if safe is specified and unsafe - data is decoded.

+

Failure: badarg if safe is specified and unsafe data + is decoded.

See also term_to_binary/1, binary_to_term/1, - and - list_to_existing_atom/1.

+ and + list_to_existing_atom/1.

- - Returns the size of a bitstring. + Return the size of a bitstring -

Returns an integer that is the size in bits of - Bitstring, for example:

+

Returns an integer which is the size in bits of Bitstring.

 > bit_size(<<433:16,3:3>>).
 19
@@ -529,34 +432,30 @@
         

Allowed in guard tests.

- - Increments the reduction counter. + Increment the reduction counter

This implementation-dependent function increments the reduction counter for the calling process. In the Beam emulator, the reduction counter is normally incremented by - one for each function and BIF call. A context switch is - forced when the counter reaches the maximum number of - reductions for a process (2000 reductions in OTP R12B).

+ one for each function and BIF call, and a context switch is + forced when the counter reaches the maximum number of reductions + for a process (2000 reductions in R12B).

-

This BIF can be removed in a future version of the Beam +

This BIF might be removed in a future version of the Beam machine without prior warning. It is unlikely to be implemented in other Erlang implementations.

- - Returns the size of a bitstring (or binary). + Return the size of a bitstring (or binary) -

Returns an integer that is the number of bytes needed to - contain Bitstring. That is, if the number of bits - in Bitstring is not divisible by 8, the resulting - number of bytes is rounded up.

-

Examples:

+

Returns an integer which is the number of bytes needed to contain + Bitstring. (That is, if the number of bits in Bitstring is not + divisible by 8, the resulting number of bytes will be rounded up.)

 > byte_size(<<433:16,3:3>>).
 3
@@ -565,319 +464,222 @@
         

Allowed in guard tests.

- - - Cancels a timer. + + Cancel a timer -

- Cancels a timer that has been created by - erlang:start_timer(), - or erlang:send_after(). - TimerRef identifies the timer, and - was returned by the BIF that created the timer. -

-

Available Options:

- - {async, Async} - -

- Asynchronous request for cancellation. Async - defaults to false which will cause the - cancellation to be performed synchronously. When - Async is set to true, the cancel - operation is performed asynchronously. That is, - erlang:cancel_timer() will send an asynchronous - request for cancellation to the timer service that - manages the timer, and then return ok. -

-
- {info, Info} - -

- Request information about the Result - of the cancellation. Info defaults to true - which means the Result is - given. When Info is set to false, no - information about the result of the cancellation - is given. When the operation is performed

- - synchronously - -

- If Info is true, the Result is - returned by erlang:cancel_timer(); otherwise, - ok is returned. -

-
- asynchronously - -

- If Info is true, a message on the form - {cancel_timer, TimerRef, - Result} is sent to the - caller of erlang:cancel_timer() when the - cancellation operation has been performed; otherwise, - no message is sent. -

-
-
-
-
-

- More Options may be added in the future. -

-

If Result is an integer, it represents - the time in milli-seconds left until the canceled timer would - have expired.

-

- If Result is false, a - timer corresponding to TimerRef could not - be found. This can be either because the timer had expired, - already had been canceled, or because TimerRef - never corresponded to a timer. Even if the timer had expired, - it does not tell you whether or not the timeout message has - arrived at its destination yet. -

- -

- The timer service that manages the timer may be co-located - with another scheduler than the scheduler that the calling - process is executing on. If this is the case, communication - with the timer service takes much longer time than if it - is located locally. If the calling process is in critical - path, and can do other things while waiting for the result - of this operation, or is not interested in the result of - the operation, you want to use option {async, true}. - If using option {async, false}, the calling - process blocks until the operation has been performed. -

-
+

Cancels a timer, where TimerRef was returned by + either + erlang:send_after/3 + or + erlang:start_timer/3. + If the timer is there to be removed, the function returns + the time in milliseconds left until the timer would have expired, + otherwise false (which means that TimerRef was + never a timer, that it has already been cancelled, or that it + has already delivered its message).

See also - erlang:send_after/4, - erlang:start_timer/4, + erlang:send_after/3, + erlang:start_timer/3, and - erlang:read_timer/2.

-
-
- - - Cancels a timer. - -

Cancels a timer. The same as calling - erlang:cancel_timer(TimerRef, - []).

+ erlang:read_timer/1.

+

Note: Cancelling a timer does not guarantee that the message + has not already been delivered to the message queue.

+ - Checks if a module has old code. + Check if a module has old code -

Returns true if Module has old code, - otherwise false.

+

Returns true if the Module has old code, + and false otherwise.

See also code(3).

- - Checks if a process executes old code for a module. + Check if a process is executing old code for a module

The same as - erlang:check_process_code(Pid, Module, []).

+ erlang:check_process_code(Pid, + Module, []).

- - Checks if a process executes old code for a module. + Check if a process is executing old code for a module -

Checks if the node local process identified by Pid - executes old code for Module.

-

The available Options are as follows:

+

Check if the node local process identified by Pid + is executing old code for Module.

+

Currently available Options:

{allow_gc, boolean()} -

Determines if garbage collection is allowed when performing - the operation. If {allow_gc, false} is passed, and - a garbage collection is needed to determine the - result of the operation, the operation is aborted (see - information on CheckResult in the following). - The default is to allow garbage collection, that is, - {allow_gc, true}.

+ Determines if garbage collection is allowed when performing + the operation. If {allow_gc, false} is passed, and + a garbage collection is needed in order to determine the + result of the operation, the operation will be aborted + (see information on CheckResult below). + The default is to allow garbage collection, i.e., + {allow_gc, true}.
{async, RequestId} -

The function check_process_code/3 returns - the value async immediately after the request - has been sent. When the request has been processed, the - process that called this function is passed a - message on the form - {check_process_code, RequestId, CheckResult}.

-
-
-

If Pid equals self(), and - no async option has been passed, the operation - is performed at once. Otherwise a request for - the operation is sent to the process identified by - Pid, and is handled when - appropriate. If no async option has been passed, - the caller blocks until CheckResult - is available and can be returned.

-

CheckResult informs about the result of - the request as follows:

+ The check_process_code/3 function will return + the value async immediately after the request + has been sent. When the request has been processed, the + process that called this function will be passed a + message on the form:
+ {check_process_code, RequestId, CheckResult}. + + +

If Pid equals self(), and + no async option has been passed, the operation will + be performed at once. In all other cases a request for + the operation will be sent to the process identified by + Pid, and will be handled when + appropriate. If no async option has been passed, + the caller will block until CheckResult + is available and can be returned.

+

CheckResult informs about the result of + the request:

true -

The process identified by Pid - executes old code for Module. - That is, the current call of the process executes old - code for this module, or the process has references - to old code for this module, or the process contains - funs that references old code for this module.

+ The process identified by Pid is + executing old code for Module. + That is, the current call of the process executes old + code for this module, or the process has references + to old code for this module, or the process contains + funs that references old code for this module.
false -

The process identified by Pid does - not execute old code for Module.

+ The process identified by Pid is + not executing old code for Module.
aborted -

The operation was aborted, as the process needed to - be garbage collected to determine the operation result, - and the operation was requested - by passing option {allow_gc, false}.

+ The operation was aborted since the process needed to + be garbage collected in order to determine the result + of the operation, and the operation was requested + by passing the {allow_gc, false} option.

See also code(3).

Failures:

badarg - If Pid is not a node local process identifier. + + If Pid is not a node local process identifier. badarg - If Module is not an atom. + + If Module is not an atom. badarg - If OptionList is an invalid list of options. + + If OptionList is not a valid list of options.
- - - - Converts time unit of a time value. - -

Converts the Time value of time unit - FromUnit to the corresponding - ConvertedTime value of time unit - ToUnit. The result is rounded - using the floor function.

- -

You may lose accuracy and precision when converting - between time units. In order to minimize such loss, collect all - data at native time unit and do the conversion on the end - result.

-
-
- Computes crc32 (IEEE 802.3) checksum. + Compute crc32 (IEEE 802.3) checksum -

Computes and returns the crc32 (IEEE 802.3 style) checksum - for Data.

+

Computes and returns the crc32 (IEEE 802.3 style) checksum for Data.

- - Computes crc32 (IEEE 802.3) checksum. + Compute crc32 (IEEE 802.3) checksum -

Continues computing the crc32 checksum by combining - the previous checksum, OldCrc, with the checksum of - Data.

-

The following code:

- - X = erlang:crc32(Data1), - Y = erlang:crc32(X,Data2). -

assigns the same value to Y as this:

- - Y = erlang:crc32([Data1,Data2]). +

Continue computing the crc32 checksum by combining + the previous checksum, OldCrc, with the checksum of + Data.

+

The following code:

+ + X = erlang:crc32(Data1), + Y = erlang:crc32(X,Data2). + +

- would assign the same value to Y as this would:

+ + Y = erlang:crc32([Data1,Data2]). +
- - Combines two crc32 (IEEE 802.3) checksums. + Combine two crc32 (IEEE 802.3) checksums -

Combines two previously computed crc32 checksums. - This computation requires the size of the data object for - the second checksum to be known.

-

The following code:

- - Y = erlang:crc32(Data1), - Z = erlang:crc32(Y,Data2). -

assigns the same value to Z as this:

+

Combines two previously computed crc32 checksums. + This computation requires the size of the data object for + the second checksum to be known.

+

The following code:

- X = erlang:crc32(Data1), - Y = erlang:crc32(Data2), - Z = erlang:crc32_combine(X,Y,iolist_size(Data2)). + Y = erlang:crc32(Data1), + Z = erlang:crc32(Y,Data2). + +

- would assign the same value to Z as this would:

+ + X = erlang:crc32(Data1), + Y = erlang:crc32(Data2), + Z = erlang:crc32_combine(X,Y,iolist_size(Data2)). +
- - Current date. + Current date

Returns the current date as {Year, Month, Day}.

-

The time zone and Daylight Saving Time correction depend on +

The time zone and daylight saving time correction depend on the underlying OS.

-

Example:

 > date().
 {1995,2,19}
- - Extracts a protocol packet from a binary. + Extracts a protocol packet from a binary +

Decodes the binary Bin according to the packet - protocol specified by Type. Similar to the packet - handling done by sockets with option {packet,Type}.

-

If an entire packet is contained in Bin, it is + protocol specified by Type. Very similar to the packet + handling done by sockets with the option {packet,Type}.

+

If an entire packet is contained in Bin it is returned together with the remainder of the binary as {ok,Packet,Rest}.

If Bin does not contain the entire packet, - {more,Length} is returned. - Length is either the - expected total size of the packet, or undefined - if the expected packet size is unknown. decode_packet + {more,Length} is returned. Length is either the + expected total size of the packet or undefined + if the expected packet size is not known. decode_packet can then be called again with more data added.

-

If the packet does not conform to the protocol format, +

If the packet does not conform to the protocol format {error,Reason} is returned.

-

The following Types are valid:

+

The following values of Type are valid:

raw | 0 -

No packet handling is done. The entire binary is +

No packet handling is done. Entire binary is returned unless it is empty.

1 | 2 | 4

Packets consist of a header specifying the number of bytes in the packet, followed by that number of bytes. - The length of the header can be one, two, or four bytes; + The length of header can be one, two, or four bytes; the order of the bytes is big-endian. The header - is stripped off when the packet is returned.

+ will be stripped off when the packet is returned.

line -

A packet is a line terminated by a delimiter byte, - default is the latin1 newline character. The delimiter - byte is included in the returned packet unless the line - was truncated according to option line_length.

+

A packet is a line terminated with newline. The + newline character is included in the returned packet + unless the line was truncated according to the option + line_length.

asn1 | cdr | sunrm | fcgi | tpkt @@ -895,50 +697,41 @@

The Hypertext Transfer Protocol. The packets are returned with the format according to - HttpPacket described earlier. - A packet is either a - request, a response, a header, or an end of header - mark. Invalid lines are returned as - HttpError.

-

Recognized request methods and header fields are returned - as atoms. Others are returned as strings. Strings of - unrecognized header fields are formatted with only - capital letters first and after hyphen characters, for - example, "Sec-Websocket-Key".

-

The protocol type http is only to be used for - the first line when an HttpRequest or an - HttpResponse is expected. - The following calls are to use httph to get - HttpHeaders until - http_eoh is returned, which marks the end of the + HttpPacket described above. A packet is either a + request, a response, a header or an end of header + mark. Invalid lines are returned as HttpError.

+

Recognized request methods and header fields are returned as atoms. + Others are returned as strings. Strings of unrecognized header fields + are formatted with only capital letters first and after hyphen characters + (like "Sec-Websocket-Key").

+

The protocol type http should only be used for + the first line when a HttpRequest or a + HttpResponse is expected. The following calls + should use httph to get HttpHeader's until + http_eoh is returned that marks the end of the headers and the beginning of any following message body.

-

The variants http_bin and httph_bin return +

The variants http_bin and httph_bin will return strings (HttpString) as binaries instead of lists.

The following options are available:

{packet_size, integer() >= 0} -

Sets the maximum allowed size of the packet body. - If the packet header indicates that the length of the - packet is longer than the maximum allowed length, the - packet is considered invalid. Default is 0, which means - no size limit.

+

Sets the max allowed size of the packet body. If + the packet header indicates that the length of the + packet is longer than the max allowed length, the packet + is considered invalid. Default is 0 which means no + size limit.

{line_length, integer() >= 0} -

For packet type line, lines longer than - the indicated length are truncated.

-

Option line_length also applies to http* - packet types as an alias for option packet_size - if packet_size itself is not set. This use is - only intended for backward compatibility.

-
- {line_delimiter, 0 =< byte() =< 255} -

For packet type line, sets the delimiting byte. - Default is the latin1 character $\n.

+

For packet type line, truncate lines longer + than the indicated length.

+

Option line_length also applies to http* + packet types as an alias for option packet_size in the + case when packet_size itself is not set. This usage is + only intended for backward compatibility.

-

Examples:

 > erlang:decode_packet(1,<<3,"abcd">>,[]).
 {ok,<<"abc">>,<<"d">>}
@@ -949,11 +742,13 @@
 
     
       
-      Deletes element at index in a tuple.
+      Delete element at index in a tuple
       1..tuple_size(Tuple1)
       
-        

Returns a new tuple with element at Index - removed from tuple Tuple1, for example:

+

+ Returns a new tuple with element at Index removed from + tuple Tuple1. +

 > erlang:delete_element(2, {one, two, three}).
 {one,three}
@@ -962,49 +757,45 @@ - Makes the current code for a module old. + Make the current code for a module old -

Makes the current code for Module become old code, - and deletes all references for this module from the export table. +

Makes the current code for Module become old code, and + deletes all references for this module from the export table. Returns undefined if the module does not exist, otherwise true.

This BIF is intended for the code server (see - code(3)) and is not - to be used elsewhere.

+ code(3)) and should not be + used elsewhere.

-

Failure: badarg if there already is an old version of +

Failure: badarg if there is already an old version of Module.

- - Stops monitoring. + Stop monitoring -

If MonitorRef is a reference that the - calling process obtained by calling +

If MonitorRef is a reference which the calling process + obtained by calling monitor/2, this monitoring is turned off. If the monitoring is already turned off, nothing happens.

-

Once demonitor(MonitorRef) has returned, it is - guaranteed that no {'DOWN', - MonitorRef, _, _, _} message, - because of the monitor, will be placed in the caller message queue - in the future. A {'DOWN', - MonitorRef, _, _, _} message - can have been placed in the caller message queue before - the call, though. It is therefore usually advisable +

Once demonitor(MonitorRef) has returned it is + guaranteed that no {'DOWN', MonitorRef, _, _, _} message + due to the monitor will be placed in the caller's message queue + in the future. A {'DOWN', MonitorRef, _, _, _} message + might have been placed in the caller's message queue prior to + the call, though. Therefore, in most cases, it is advisable to remove such a 'DOWN' message from the message queue - after monitoring has been stopped. - demonitor(MonitorRef, [flush]) - can be used instead of + after monitoring has been stopped. + demonitor(MonitorRef, [flush]) can be used instead of demonitor(MonitorRef) if this cleanup is wanted.

-

Prior to OTP release R11B (ERTS version 5.5) demonitor/1 - behaved completely asynchronously, i.e., the monitor was active +

Prior to OTP release R11B (erts version 5.5) demonitor/1 + behaved completely asynchronous, i.e., the monitor was active until the "demonitor signal" reached the monitored entity. This - had one undesirable effect. You could never know when + had one undesirable effect, though. You could never know when you were guaranteed not to receive a DOWN message due to the monitor.

Current behavior can be viewed as two combined operations: @@ -1013,31 +804,31 @@

Failure: It is an error if MonitorRef refers to a monitoring started by another process. Not all such cases are - cheap to check. If checking is cheap, the call fails with - badarg for example, if MonitorRef is a - remote reference.

+ cheap to check; if checking is cheap, the call fails with + badarg (for example if MonitorRef is a remote + reference).

- - Stops monitoring. + Stop monitoring

The returned value is true unless info is part - of OptionList.

+ of OptionList. +

demonitor(MonitorRef, []) is equivalent to - demonitor(MonitorRef).

-

The available Options are as follows:

+ demonitor(MonitorRef).

+

Currently the following Options are valid:

flush -

Removes (one) {_, - MonitorRef, _, _, _} message, - if there is one, from the caller message queue after +

Remove (one) {_, MonitorRef, _, _, _} message, + if there is one, from the caller's message queue after monitoring has been stopped.

Calling demonitor(MonitorRef, [flush]) is equivalent to the following, but more efficient:

+ demonitor(MonitorRef), receive {_, MonitorRef, _, _, _} -> @@ -1048,90 +839,78 @@
info -

The returned value is one of the following:

- - true - The monitor was found and removed. In this case, - no 'DOWN' message corresponding to this - monitor has been delivered and will not be delivered. - - false - The monitor was not found and could not be removed. - This probably because someone already has placed a - 'DOWN' message corresponding to this monitor - in the caller message queue. - - -

If option info is combined with option flush, - false is returned if a flush was needed, - otherwise true.

+

The returned value is one of the following:

+ + true +

The monitor was found and removed. In this case + no 'DOWN' message due to this monitor have + been nor will be placed in the message queue + of the caller. +

+
+ false +

The monitor was not found and could not be removed. + This probably because someone already has placed a + 'DOWN' message corresponding to this monitor + in the caller's message queue. +

+
+
+

If the info option is combined with the flush + option, false will be returned if a flush was needed; + otherwise, true. +

-

More options can be added in a future release.

+

More options may be added in the future.

-

Failures:

- - badarg - If OptionList is not a list. - - badarg - If Option is an invalid option. - - badarg - The same failure as for - demonitor/1. - - +

Failure: badarg if OptionList is not a list, or + if Option is not a valid option, or the same failure as for + demonitor/1

- - Forces the disconnection of a node. + Force the disconnection of a node -

Forces the disconnection of a node. This appears to - the node Node as if the local node has crashed. - This BIF is mainly used in the Erlang network authentication - protocols.

-

Returns true if disconnection succeeds, +

Forces the disconnection of a node. This will appear to + the node Node as if the local node has crashed. This + BIF is mainly used in the Erlang network authentication + protocols. Returns true if disconnection succeeds, otherwise false. If the local node is not alive, - ignored is returned.

+ the function returns ignored.

- - Prints a term on standard output. + Print a term on standard output -

Prints a text representation of Term on the - standard output. On OSE, the term is printed to the ramlog.

+

Prints a text representation of Term on the standard + output. On OSE the term is printed to the ramlog.

This BIF is intended for debugging only.

- - Returns the Nth element of a tuple. 1..tuple_size(Tuple) + Get Nth element of a tuple

Returns the Nth element (numbering from 1) of - Tuple, for example:

+ Tuple.

 > element(2, {a, b, c}).
 b

Allowed in guard tests.

- - Returns and deletes the process dictionary. + Return and delete the process dictionary -

Returns the process dictionary and deletes it, for - example:

+

Returns the process dictionary and deletes it.

 > put(key1, {1, 2, 3}),
 put(key2, [a, b, c]),
@@ -1139,16 +918,13 @@
 [{key1,{1,2,3}},{key2,[a,b,c]}]
- - Returns and deletes a value from the process dictionary. + Return and delete a value from the process dictionary -

Returns the value Val associated with - Key and deletes it from the process dictionary. - Returns undefined if no value is associated with - Key.

-

Example:

+

Returns the value Val associated with Key and + deletes it from the process dictionary. Returns + undefined if no value is associated with Key.

 > put(key1, {merry, lambs, are, playing}),
 X = erase(key1),
@@ -1156,19 +932,16 @@
 {{merry,lambs,are,playing},undefined}
- - Stops execution with a given reason. + Stop execution with a given reason

Stops the execution of the calling process with the reason - Reason, where Reason - is any term. The exit reason is - {Reason, Where}, where Where + Reason, where Reason is any term. The actual + exit reason will be {Reason, Where}, where Where is a list of the functions most recently called (the current function first). Since evaluating this function causes the process to terminate, it has no return value.

-

Example:

 > catch error(foobar).
 {'EXIT',{foobar,[{erl_eval,do_apply,5},
@@ -1178,34 +951,29 @@
                  {shell,eval_loop,3}]}}
- - Stops execution with a given reason. + Stop execution with a given reason

Stops the execution of the calling process with the reason - Reason, where Reason - is any term. The exit reason is - {Reason, Where}, where Where + Reason, where Reason is any term. The actual + exit reason will be {Reason, Where}, where Where is a list of the functions most recently called (the current - function first). Args is expected to be the - list of arguments for the current function; in Beam it is used - to provide the arguments for the current function in - the term Where. Since evaluating this function causes + function first). Args is expected to be the list of + arguments for the current function; in Beam it will be used + to provide the actual arguments for the current function in + the Where term. Since evaluating this function causes the process to terminate, it has no return value.

- - Stops execution with a given reason. + Stop execution with a given reason -

Stops the execution of the calling process with exit reason - Reason, where Reason - is any term. Since +

Stops the execution of the calling process with the exit + reason Reason, where Reason is any term. Since evaluating this function causes the process to terminate, it has no return value.

-

Example:

 > exit(foobar).
 ** exception exit: foobar
@@ -1213,117 +981,110 @@
 {'EXIT',foobar}
- - Sends an exit signal to a process or a port. + Send an exit signal to a process or a port

Sends an exit signal with exit reason Reason to the process or port identified by Pid.

-

The following behavior applies if Reason - is any term, except normal or kill:

- - If Pid is not trapping exits, - Pid - itself exits with exit reason Reason. - - If Pid is trapping exits, the exit - signal is transformed into a message - {'EXIT', From, Reason} - and delivered to the message queue of Pid. - - From is the process identifier of the process - that sent the exit signal. See also - process_flag/2. - - -

If Reason is the atom normal, - Pid - does not exit. If it is trapping exits, the exit signal is - transformed into a message {'EXIT', From, normal} - and delivered to its message queue.

-

If Reason is the atom kill, - that is, if exit(Pid, kill) is called, - an untrappable exit signal is sent to Pid, - which unconditionally exits with exit reason killed. -

+

The following behavior apply if Reason is any term + except normal or kill:

+

If Pid is not trapping exits, Pid itself will + exit with exit reason Reason. If Pid is trapping + exits, the exit signal is transformed into a message + {'EXIT', From, Reason} and delivered to the message + queue of Pid. From is the pid of the process + which sent the exit signal. See also + process_flag/2.

+

If Reason is the atom normal, Pid will + not exit. If it is trapping exits, the exit signal is + transformed into a message {'EXIT', From, normal} + and delivered to its message queue.

+

If Reason is the atom kill, that is if + exit(Pid, kill) is called, an untrappable exit signal + is sent to Pid which will unconditionally exit with + exit reason killed.

- - Calculates the maximum size for a term encoded in the Erlang external term format. + Calculate the maximum size for a term encoded in the Erlang + external term format

Calculates, without doing the encoding, the maximum byte size for a term encoded in the Erlang external term format. The following condition applies always:

+

 > Size1 = byte_size(term_to_binary(Term)),
 > Size2 = erlang:external_size(Term),
 > true = Size1 =< Size2.
-true
-

This is equivalent to a call to:

-erlang:external_size(Term, []) +true +
+

+

This is equivalent to a call to: erlang:external_size(Term, []) +

- - Calculates the maximum size for a term encoded in the Erlang external term format. + Calculate the maximum size for a term encoded in the Erlang + external term format

Calculates, without doing the encoding, the maximum byte size for a term encoded in the Erlang external term format. The following condition applies always:

+

 > Size1 = byte_size(term_to_binary(Term, Options)),
 > Size2 = erlang:external_size(Term, Options),
 > true = Size1 =< Size2.
-true
-

Option {minor_version, Version} specifies how - floats are encoded. For a detailed description, see - term_to_binary/2.

+true +
+

+

The option {minor_version, Version} specifies how floats + are encoded. See + term_to_binary/2 for + a more detailed description. +

- - Converts a number to a float. + Convert a number to a float -

Returns a float by converting Number to a float, - for example:

+

Returns a float by converting Number to a float.

 > float(55).
 55.0

Allowed in guard tests.

-

If used on the top level in a guard, it tests whether the - argument is a floating point number; for clarity, use +

Note that if used on the top-level in a guard, it will + test whether the argument is a floating point number; for + clarity, use is_float/1 instead.

When float/1 is used in an expression in a guard, such as 'float(A) == 4.0', it converts a number as - described earlier.

+ described above.

- - Text representation of a float. + Text representation of a float -

The same as - float_to_binary(Float,[{scientific,20}]).

+

The same as float_to_binary(Float,[{scientific,20}]).

- - Text representation of a float formatted using given options. + Text representation of a float formatted using given options -

Returns a binary corresponding to the text +

Returns a binary which corresponds to the text representation of Float using fixed decimal - point formatting. Options behaves in the same - way as float_to_list/2.

-

Examples:

+ point formatting. The Options behave in the same + way as float_to_list/2. +

 > float_to_binary(7.12, [{decimals, 4}]).
 <<"7.1200">>
@@ -1331,42 +1092,31 @@
 <<"7.12">>
- - Text representation of a float. + Text representation of a float -

The same as - float_to_list(Float,[{scientific,20}]).

+

The same as float_to_list(Float,[{scientific,20}]).

- - Text representation of a float formatted using given options. + Text representation of a float formatted using given options -

Returns a string corresponding to the text representation - of Float using fixed decimal point formatting. The - options are as follows:

- - If option decimals is specified, the returned value - contains at most Decimals number of digits past the - decimal point. If the number does not fit in the internal - static buffer of 256 bytes, the function throws badarg. - - If option compact is provided, the trailing zeros - at the end of the list are truncated. This option is only - meaningful together with option decimals. - - If option scientific is provided, the float is - formatted using scientific notation with Decimals - digits of precision. - - If Options is [], the function behaves as - float_to_list/1. - - -

Examples:

+

Returns a string which corresponds to the text + representation of Float using fixed decimal point formatting. + When decimals option is specified + the returned value will contain at most Decimals number of + digits past the decimal point. If the number doesn't fit in the + internal static buffer of 256 bytes, the function throws badarg. + When compact option is provided + the trailing zeros at the end of the list are truncated (this option is + only meaningful together with the decimals option). When + scientific option is provided, the float will be formatted using + scientific notation with Decimals digits of precision. If + Options is [] the function behaves like + float_to_list/1. +

 > float_to_list(7.12, [{decimals, 4}]).
 "7.1200"
@@ -1374,40 +1124,36 @@
 "7.12"
- - Information about a fun. + Information about a fun -

Returns a list with information about the fun - Fun. Each list element is a tuple. The order - of the tuples is undefined, and more tuples can be added in a +

Returns a list containing information about the fun + Fun. Each element of the list is a tuple. The order of + the tuples is not defined, and more tuples may be added in a future release.

This BIF is mainly intended for debugging, but it can - sometimes be useful in library functions that need - to verify, for example, the arity of a fun.

+ occasionally be useful in library functions that might need + to verify, for instance, the arity of a fun.

-

Two types of funs have slightly different semantics:

- - A fun created by fun M:F/A is called an - external fun. Calling it will always call the - function F with arity A in the latest code for - module M. Notice that module M does not even - need to be loaded when the fun fun M:F/A is created. - - All other funs are called local. When a local fun - is called, the same version of the code that created the fun - is called (even if a newer version of the module has been - loaded). - - -

The following elements are always present in the list +

There are two types of funs with slightly different + semantics:

+

A fun created by fun M:F/A is called an + external fun. Calling it will always call the + function F with arity A in the latest code for + module M. Note that module M does not even need + to be loaded when the fun fun M:F/A is created.

+

All other funs are called local. When a local fun + is called, the same version of the code that created the fun + will be called (even if newer version of the module has been + loaded).

+

The following elements will always be present in the list for both local and external funs:

{type, Type} -

Type is local or external.

+

Type is either local or external.

{module, Module} @@ -1422,154 +1168,147 @@

Name (an atom) is a function name.

If Fun is a local fun, Name is the name of the local function that implements the fun. - (This name was generated by the compiler, and is + (This name was generated by the compiler, and is generally only of informational use. As it is a local function, it - cannot be called directly.) + is not possible to call it directly.) If no code is currently loaded for the fun, [] - is returned instead of an atom.

+ will be returned instead of an atom.

If Fun is an external fun, Name is the name of the exported function that the fun refers to.

{arity, Arity}

Arity is the number of arguments that the fun - is to be called with.

+ should be called with.

{env, Env}

Env (a list) is the environment or free variables - for the fun. For external funs, the returned list is - always empty.

+ for the fun. (For external funs, the returned list is + always empty.)

-

The following elements are only present in the list if +

The following elements will only be present in the list if Fun is local:

{pid, Pid} -

Pid is the process identifier of the process - that originally created the fun.

+

Pid is the pid of the process that originally + created the fun.

{index, Index} -

Index (an integer) is an index into the module +

Index (an integer) is an index into the module's fun table.

{new_index, Index} -

Index (an integer) is an index into the module +

Index (an integer) is an index into the module's fun table.

{new_uniq, Uniq} -

Uniq (a binary) is a unique value for this fun. It - is calculated from the compiled code for the entire module.

+

Uniq (a binary) is a unique value for this fun. + It is calculated from the compiled code for the entire module.

{uniq, Uniq}

Uniq (an integer) is a unique value for this fun. - As from OTP R15, this integer is calculated from the - compiled code for the entire module. Before OTP R15, this - integer was based on only the body of the fun.

+ Starting in the R15 release, this integer is calculated from + the compiled code for the entire module. Before R15, this + integer was based on only the body of the fun. +

- - Information about a fun. + Information about a fun

Returns information about Fun as specified by - Item, in the form - {Item,Info}.

+ Item, in the form {Item,Info}.

For any fun, Item can be any of the atoms - module, name, arity, env, or - type.

-

For a local fun, Item can also be any of the - atoms index, new_index, new_uniq, + module, name, arity, env, or type.

+

For a local fun, Item can also be any of the atoms + index, new_index, new_uniq, uniq, and pid. For an external fun, the value of any of these items is always the atom undefined.

See erlang:fun_info/1.

- - Text representation of a fun. + Text representation of a fun -

Returns a string corresponding to the text +

Returns a string which corresponds to the text representation of Fun.

- - Checks if a function is exported and loaded. + Check if a function is exported and loaded

Returns true if the module Module is loaded - and contains an exported function Function/Arity, - or if there is a BIF (a built-in function implemented in C) - with the given name, otherwise returns false.

-

This function used to return false for built-in - functions before the 18.0 release.

+ and contains an exported function Function/Arity; + otherwise false.

+

Returns false for any BIF (functions implemented in C + rather than in Erlang).

- - Forces an immediate garbage collection of the calling process. + Force an immediate garbage collection of the calling process -

Forces an immediate garbage collection of the - executing process. The function is not to be used unless - it has been noticed (or there are good reasons to suspect) +

Forces an immediate garbage collection of the currently + executing process. The function should not be used, unless + it has been noticed -- or there are good reasons to suspect -- that the spontaneous garbage collection will occur too late - or not at all.

- -

Improper use can seriously degrade system performance.

-
+ or not at all. Improper use may seriously degrade system + performance.

- - Garbage collects a process. + Garbage collect a process

The same as garbage_collect(Pid, []).

- - Garbage collects a process. + Garbage collect a process -

Garbage collects the node local process identified by - Pid.

-

The available Options are as follows:

+

Garbage collect the node local process identified by + Pid.

+

Currently available Options:

{async, RequestId} - The function garbage_collect/2 returns + + The garbage_collect/2 function will return the value async immediately after the request has been sent. When the request has been processed, the - process that called this function is passed a message on - the form {garbage_collect, - RequestId, GCResult}. - + process that called this function will be passed a + message on the form:
+ {garbage_collect, RequestId, GCResult}. +

If Pid equals self(), and no async option has been passed, the garbage - collection is performed at once, that is, the same as calling + collection will be performed at once, i.e. the same as + calling garbage_collect/0. - Otherwise a request for garbage collection - is sent to the process identified by Pid, + In all other cases a request for garbage collection will + be sent to the process identified by Pid, and will be handled when appropriate. If no async - option has been passed, the caller blocks until - GCResult is available and can be returned.

+ option has been passed, the caller will block until + GCResult is available and can be + returned.

GCResult informs about the result of - the garbage collection request as follows:

+ the garbage collection request:

true @@ -1578,13 +1317,14 @@ false - No garbage collection was performed, as + No garbage collection was performed. This since the the process identified by Pid terminated before the request could be satisfied. -

Notice that the same caveats apply as for - garbage_collect/0.

+

Note that the same caveats as for + garbage_collect/0 + apply.

Failures:

badarg @@ -1593,18 +1333,17 @@ badarg - If OptionList is an invalid list of options. + If OptionList is not a valid list of options.
- - Returns the process dictionary. + Return the process dictionary

Returns the process dictionary as a list of - {Key, Val} tuples, for example:

+ {Key, Val} tuples.

 > put(key1, merry),
 put(key2, lambs),
@@ -1613,15 +1352,13 @@
 [{key1,merry},{key2,lambs},{key3,{are,playing}}]
- - Returns a value from the process dictionary. + Return a value from the process dictionary -

Returns the value Val associated with Key in +

Returns the value Valassociated with Key in the process dictionary, or undefined if Key does not exist.

-

Example:

 > put(key1, merry),
 put(key2, lambs),
@@ -1630,35 +1367,20 @@
 {are,playing}
- - Gets the magic cookie of the local node. + Get the magic cookie of the local node -

Returns the magic cookie of the local node if the node is - alive, otherwise the atom nocookie.

-
-
- - - - Return a list of all keys from the process dictionary - -

Returns a list of keys all keys present in the process dictionary.

-
-> put(dog, {animal,1}),
-put(cow, {animal,2}),
-put(lamb, {animal,3}),
-get_keys().
-[dog,cow,lamb]
+

Returns the magic cookie of the local node, if the node is + alive; otherwise the atom nocookie.

- Returns a list of keys from the process dictionary. + Return a list of keys from the process dictionary -

Returns a list of keys that are associated with the value - Val in the process dictionary, for example:

+

Returns a list of keys which are associated with the value + Val in the process dictionary.

 > put(mary, {1, 2}),
 put(had, {1, 2}),
@@ -1670,40 +1392,40 @@
 [mary,had,a,little,lamb]
- - Gets the call stack back-trace of the last exception. + Get the call stack back-trace of the last exception -

Gets the call stack back-trace (stacktrace) of the - last exception in the calling process as a list of +

Get the call stack back-trace (stacktrace) of the last + exception in the calling process as a list of {Module,Function,Arity,Location} tuples. - Field Arity in the first tuple can be the - argument list of that function call instead of an arity integer, + The Arity field in the first tuple may be the argument + list of that function call instead of an arity integer, depending on the exception.

If there has not been any exceptions in a process, the stacktrace is []. After a code change for the process, - the stacktrace can also be reset to [].

+ the stacktrace may also be reset to [].

The stacktrace is the same data as the catch operator returns, for example:

{'EXIT',{badarg,Stacktrace}} = catch abs(x)

-

Location is a (possibly empty) list - of two-tuples that - can indicate the location in the source code of the function. - The first element is an atom describing the type of - information in the second element. The following - items can occur:

+

Location is a (possibly empty) list of two-tuples that + may indicate the location in the source code of the function. + The first element is an atom that describes the type of + information in the second element. Currently the following + items may occur:

file - The second element of the tuple is a string (list of - characters) representing the file name of the source file - of the function. + +

The second element of the tuple is a string (list of + characters) representing the filename of the source file + of the function.

line - The second element of the tuple is the line number + +

The second element of the tuple is the line number (an integer greater than zero) in the source file - where the exception occurred or the function was called. + where the exception occurred or the function was called.

See also @@ -1711,56 +1433,49 @@ erlang:error/2.

- - Gets the group leader for the calling process. + Get the group leader for the calling process -

Returns the process identifier of the group leader for the - process evaluating the function.

+

Returns the pid of the group leader for the process which + evaluates the function.

Every process is a member of some process group and all - groups have a group leader. All I/O from the group + groups have a group leader. All IO from the group is channeled to the group leader. When a new process is spawned, it gets the same group leader as the spawning process. Initially, at system start-up, init is both its own group leader and the group leader of all processes.

- - Sets the group leader for a process. + Set the group leader for a process -

Sets the group leader of Pid - to GroupLeader. - Typically, this is used when a process started from a - certain shell is to have another group leader than +

Sets the group leader of Pid to GroupLeader. + Typically, this is used when a processes started from a + certain shell should have another group leader than init.

See also group_leader/0.

- - Halts the Erlang runtime system and indicates normal exit to the calling environment. + Halt the Erlang runtime system and indicate normal exit to the calling environment

The same as halt(0, []).

-

Example:

 > halt().
 os_prompt% 
- - Halts the Erlang runtime system. + Halt the Erlang runtime system

The same as halt(Status, []).

-

Example:

 > halt(17).
 os_prompt% echo $?
@@ -1768,188 +1483,178 @@
 os_prompt% 
- - Halts the Erlang runtime system. + Halt the Erlang runtime system

Status must be a non-negative integer, a string, or the atom abort. Halts the Erlang runtime system. Has no return value. - Depending on Status, the following occurs:

+ Depending on Status: +

integer() - The runtime system exits with integer value - Status - as status code to the calling environment (OS). + The runtime system exits with the integer value Status + as status code to the calling environment (operating system). string() - An Erlang crash dump is produced with Status - as slogan. Then the runtime system exits with status code 1. + An erlang crash dump is produced with Status as slogan, + and then the runtime system exits with status code 1. abort The runtime system aborts producing a core dump, if that is - enabled in the OS. + enabled in the operating system. -

On many platforms, the OS supports only status - codes 0-255.

-

For integer Status, the Erlang runtime system - closes all ports and allows async threads to finish their - operations before exiting. To exit without such flushing, use - Option as {flush,false}.

-

For statuses string() and abort, option - flush is ignored and flushing is not done.

+

Note that on many platforms, only the status codes 0-255 are + supported by the operating system. +

+

For integer Status the Erlang runtime system closes all ports + and allows async threads to finish their operations before exiting. + To exit without such flushing use + Option as {flush,false}. +

+

For statuses string() and abort the flush + option is ignored and flushing is not done. +

- - Hash function (deprecated). + Hash function (deprecated)

Returns a hash value for Term within the range - 1..Range. The maximum range is 1..2^27-1.

+ 1..Range. The allowed range is 1..2^27-1.

-

This BIF is deprecated, as the hash value can differ on - different architectures. The hash values for integer - terms higher than 2^27 and large binaries are +

This BIF is deprecated as the hash value may differ on + different architectures. Also the hash values for integer + terms larger than 2^27 as well as large binaries are very poor. The BIF is retained for backward compatibility - reasons (it can have been used to hash records into a file), - but all new code is to use one of the BIFs + reasons (it may have been used to hash records into a file), + but all new code should use one of the BIFs erlang:phash/2 or erlang:phash2/1,2 instead.

- - Head of a list. + Head of a list -

Returns the head of List, that is, - the first element, for example:

+

Returns the head of List, that is, the first element.

 > hd([1,2,3,4,5]).
 1

Allowed in guard tests.

-

Failure: badarg if List is the empty - list [].

+

Failure: badarg if List is the empty list [].

- - Hibernates a process until a message is sent to it. + Hibernate a process until a message is sent to it

Puts the calling process into a wait state where its memory - allocation has been reduced as much as possible. This is + allocation has been reduced as much as possible, which is useful if the process does not expect to receive any messages - soon.

-

The process is awaken when a message is sent to it, and control - resumes in Module:Function with - the arguments given by Args with the call - stack emptied, meaning that the process terminates when that - function returns. Thus erlang:hibernate/3 never - returns to its caller.

+ in the near future.

+

The process will be awaken when a message is sent to it, and + control will resume in Module:Function with + the arguments given by Args with the call stack + emptied, meaning that the process will terminate when that + function returns. Thus erlang:hibernate/3 will never + return to its caller.

If the process has any message in its message queue, - the process is awakened immediately in the same way as - described earlier.

+ the process will be awaken immediately in the same way as + described above.

In more technical terms, what erlang:hibernate/3 does - is the following. It discards the call stack for the process, - and then garbage collects the process. After this, - all live data is in one continuous heap. The heap + is the following. It discards the call stack for the process. + Then it garbage collects the process. After the garbage + collection, all live data is in one continuous heap. The heap is then shrunken to the exact same size as the live data - that it holds (even if that size is less than the minimum + which it holds (even if that size is less than the minimum heap size for the process).

If the size of the live data in the process is less than the minimum heap size, the first garbage collection occurring - after the process is awakened ensures that the heap + after the process has been awaken will ensure that the heap size is changed to a size not smaller than the minimum heap size.

-

Notice that emptying the call stack means that any surrounding - catch is removed and must be reinserted after +

Note that emptying the call stack means that any surrounding + catch is removed and has to be re-inserted after hibernation. One effect of this is that processes started using proc_lib (also indirectly, such as - gen_server processes), are to use + gen_server processes), should use proc_lib:hibernate/3 - instead, to ensure that the exception handler continues to work + instead to ensure that the exception handler continues to work when the process wakes up.

- Inserts an element at index in a tuple. + Insert an element at index in a tuple 1..tuple_size(Tuple1) + 1 -

Returns a new tuple with element Term - inserted at position - Index in tuple Tuple1. - All elements from position Index and upwards are - pushed one step higher in the new tuple Tuple2.

-

Example:

+

+ Returns a new tuple with element Term insert at position + Index in tuple Tuple1. + All elements from position Index and upwards are subsequently + pushed one step higher in the new tuple Tuple2. +

 > erlang:insert_element(2, {one, two, three}, new).
 {one,new,two,three}
- - Text representation of an integer. + Text representation of an integer -

Returns a binary corresponding to the text - representation of Integer, for example:

+

Returns a binary which corresponds to the text + representation of Integer.

 > integer_to_binary(77).
 <<"77">>
- - Text representation of an integer. + Text representation of an integer -

Returns a binary corresponding to the text - representation of Integer in base - Base, for example:

+

Returns a binary which corresponds to the text + representation of Integer in base Base.

 > integer_to_binary(1023, 16).
 <<"3FF">>
- - Text representation of an integer. + Text representation of an integer -

Returns a string corresponding to the text - representation of Integer, for example:

+

Returns a string which corresponds to the text + representation of Integer.

 > integer_to_list(77).
 "77"
- - Text representation of an integer. + Text representation of an integer -

Returns a string corresponding to the text - representation of Integer in base - Base, for example:

+

Returns a string which corresponds to the text + representation of Integer in base Base.

 > integer_to_list(1023, 16).
 "3FF"
- - Converts an iolist to a binary. + Convert an iolist to a binary -

Returns a binary that is made from the integers and - binaries in IoListOrBinary, for example:

+

Returns a binary which is made from the integers and + binaries in IoListOrBinary.

 > Bin1 = <<1,2,3>>.
 <<1,2,3>>
@@ -1961,311 +1666,278 @@
 <<1,2,3,1,2,3,4,5,4,6>>
- - Size of an iolist. + Size of an iolist -

Returns an integer that is the size in bytes - of the binary that would be the result of - iolist_to_binary(Item), for example:

+

Returns an integer which is the size in bytes + of the binary that would be the result of + iolist_to_binary(Item).

 > iolist_size([1,2|<<3,4>>]).
 4
- - Checks whether the local node is alive. + Check whether the local node is alive -

Returns true if the local node is alive (that is, if - the node can be part of a distributed system), otherwise - false.

+

Returns true if the local node is alive; that is, if + the node can be part of a distributed system. Otherwise, it + returns false.

- - Checks whether a term is an atom. + Check whether a term is an atom -

Returns true if Term is an atom, - otherwise false.

+

Returns true if Term is an atom; + otherwise returns false.

Allowed in guard tests.

- - Checks whether a term is a binary. + Check whether a term is a binary -

Returns true if Term is a binary, - otherwise false.

+

Returns true if Term is a binary; + otherwise returns false.

+

A binary always contains a complete number of bytes.

+

Allowed in guard tests.

- - Checks whether a term is a bitstring. + Check whether a term is a bitstring -

Returns true if Term is a - bitstring (including a binary), otherwise false.

+

Returns true if Term is a bitstring (including a binary); + otherwise returns false.

+

Allowed in guard tests.

- - Checks whether a term is a boolean. + Check whether a term is a boolean -

Returns true if Term is the - atom true or the atom false (that is, a boolean). - Otherwise returns false.

+

Returns true if Term is + either the atom true or the atom false + (i.e. a boolean); otherwise returns false.

Allowed in guard tests.

- - Checks if a function is a BIF implemented in C. + Check if a function is a BIF implemented in C -

This BIF is useful for builders of cross-reference tools.

-

Returns true if - Module:Function/Arity - is a BIF implemented in C, otherwise false.

+

Returns true if Module:Function/Arity is + a BIF implemented in C; otherwise returns false. + This BIF is useful for builders of cross reference tools.

- - Checks whether a term is a float. + Check whether a term is a float

Returns true if Term is a floating point - number, otherwise false.

+ number; otherwise returns false.

Allowed in guard tests.

- - Checks whether a term is a fun. + Check whether a term is a fun -

Returns true if Term is a fun, otherwise - false.

+

Returns true if Term is a fun; otherwise + returns false.

Allowed in guard tests.

- - Checks whether a term is a fun with a given arity. + Check whether a term is a fun with a given arity

Returns true if Term is a fun that can be - applied with Arity number of arguments, otherwise - false.

+ applied with Arity number of arguments; otherwise + returns false.

Allowed in guard tests.

- - Checks whether a term is an integer. + Check whether a term is an integer -

Returns true if Term is an integer, - otherwise false.

+

Returns true if Term is an integer; + otherwise returns false.

Allowed in guard tests.

- - Checks whether a term is a list. + Check whether a term is a list

Returns true if Term is a list with - zero or more elements, otherwise false.

+ zero or more elements; otherwise returns false.

Allowed in guard tests.

- - Checks whether a term is a map. + Check whether a term is a map -

Returns true if Term is a map, - otherwise false.

+

Returns true if Term is a map; + otherwise returns false.

Allowed in guard tests.

- - Checks whether a term is a number. + Check whether a term is a number -

Returns true if Term is an integer or a - floating point number. Otherwise returns false.

+

Returns true if Term is either an integer or a + floating point number; otherwise returns false.

Allowed in guard tests.

- - Checks whether a term is a process identifier. + Check whether a term is a pid -

Returns true if Term is a process - identifier, otherwise false.

+

Returns true if Term is a pid (process + identifier); otherwise returns false.

Allowed in guard tests.

- - Checks whether a term is a port. + Check whether a term is a port -

Returns true if Term is a port identifier, - otherwise false.

+

Returns true if Term is a port identifier; + otherwise returns false.

Allowed in guard tests.

- - Checks whether a process is alive. + Check whether a process is alive -

Pid must refer to a process at the local node.

-

Returns true if the process exists and is alive, that - is, is not exiting and has not exited. Otherwise returns +

+ Pid must refer to a process at the local node. + Returns true if the process exists and is alive, that + is, is not exiting and has not exited. Otherwise, returns false.

- - Checks whether a term appears to be a record. + Check whether a term appears to be a record -

Returns true if Term is a tuple and its - first element is RecordTag. - Otherwise returns false.

+

Returns true if Term is a tuple and its first + element is RecordTag. Otherwise, returns false.

Normally the compiler treats calls to is_record/2 - specially. It emits code to verify that Term - is a tuple, that its first element is - RecordTag, and that the - size is correct. However, if RecordTag is - not a literal atom, the BIF is_record/2 is called - instead and the size of the tuple is not verified.

+ specially. It emits code to verify that Term is a + tuple, that its first element is RecordTag, and that + the size is correct. However, if the RecordTag is + not a literal atom, the is_record/2 BIF will be + called instead and the size of the tuple will not be + verified.

-

Allowed in guard tests, if RecordTag is - a literal atom.

+

Allowed in guard tests, if RecordTag is a literal + atom.

- - Checks whether a term appears to be a record. + Check whether a term appears to be a record -

RecordTag must be an atom.

-

Returns true if - Term is a tuple, - its first element is RecordTag, - and its size is Size. - Otherwise returns false.

-

Allowed in guard tests if RecordTag is +

RecordTag must be an atom. Returns true if + Term is a tuple, its first element is RecordTag, + and its size is Size. Otherwise, returns false.

+

Allowed in guard tests, provided that RecordTag is a literal atom and Size is a literal integer.

-

This BIF is documented for completeness. Usually - is_record/2 is to be used.

+

This BIF is documented for completeness. In most cases + is_record/2 should be used.

- - Checks whether a term is a reference. + Check whether a term is a reference -

Returns true if Term is a reference, - otherwise false.

+

Returns true if Term is a reference; + otherwise returns false.

Allowed in guard tests.

- - Checks whether a term is a tuple. + Check whether a term is a tuple -

Returns true if Term is a tuple, - otherwise false.

+

Returns true if Term is a tuple; + otherwise returns false.

Allowed in guard tests.

- - Length of a list. + Length of a list -

Returns the length of List, for example:

+

Returns the length of List.

 > length([1,2,3,4,5,6,7,8,9]).
 9

Allowed in guard tests.

- - Creates a link to another process (or port). + Create a link to another process (or port)

Creates a link between the calling process and another - process (or port) PidOrPort, if there is - not such a link + process (or port) PidOrPort, if there is not such a link already. If a process attempts to create a link to itself, nothing is done. Returns true.

-

If PidOrPort does not exist, the behavior - of the BIF - depends on if the calling process is trapping exits or not (see +

If PidOrPort does not exist, the behavior of the BIF depends + on if the calling process is trapping exits or not (see process_flag/2):

If the calling process is not trapping exits, and - checking PidOrPort is cheap - (that is, if PidOrPort - is local), link/1 fails with reason noproc. + checking PidOrPort is cheap -- that is, if PidOrPort is + local -- link/1 fails with reason noproc. Otherwise, if the calling process is trapping exits, - and/or PidOrPort is remote, link/1 - returns true, but an exit signal with reason noproc + and/or PidOrPort is remote, link/1 returns + true, but an exit signal with reason noproc is sent to the calling process.
- - Converts from text representation to an atom. + Convert from text representation to an atom -

Returns the atom whose text representation is - String.

-

String can only contain ISO-latin-1 - characters (that is, - numbers less than 256) as the implementation does not - allow unicode characters equal to or above 256 in atoms. - For more information on Unicode support in atoms, see - note on UTF-8 - encoded atoms - in Section "External Term Format" in the User's Guide.

-

Example:

+

Returns the atom whose text representation is String.

+

String may only contain ISO-latin-1 + characters (i.e. numbers below 256) as the current + implementation does not allow unicode characters >= 256 in + atoms. For more information on Unicode support in atoms + see note on UTF-8 encoded atoms + in the chapter about the external term format in the ERTS User's Guide.

 > list_to_atom("Erlang").
 'Erlang'
- - Converts a list to a binary. + Convert a list to a binary -

Returns a binary that is made from the integers and - binaries in IoList, for example:

+

Returns a binary which is made from the integers and + binaries in IoList.

 > Bin1 = <<1,2,3>>.
 <<1,2,3>>
@@ -2277,46 +1949,40 @@
 <<1,2,3,1,2,3,4,5,4,6>>
- - Converts a list to a bitstring. + Convert a list to a bitstring -

Returns a bitstring that is made from the integers and - bitstrings in BitstringList. (The last tail in - BitstringList is allowed to be a bitstring.)

-

Example:

+

Returns a bitstring which is made from the integers and + bitstrings in BitstringList. (The last tail in BitstringList + is allowed to be a bitstring.)

 > Bin1 = <<1,2,3>>.
 <<1,2,3>>
 > Bin2 = <<4,5>>.
 <<4,5>>
-> Bin3 = <<6,7:4>>.
-<<6,7:4>>
+> Bin3 = <<6,7:4,>>.
+<<6>>
 > list_to_bitstring([Bin1,1,[2,3,Bin2],4|Bin3]).
-<<1,2,3,1,2,3,4,5,4,6,7:4>>
+<<1,2,3,1,2,3,4,5,4,6,7:46>>
- - Converts from text representation to an atom. + Convert from text representation to an atom -

Returns the atom whose text representation is - String, +

Returns the atom whose text representation is String, but only if there already exists such atom.

Failure: badarg if there does not already exist an atom whose text representation is String.

- - Converts from text representation to a float. + Convert from text representation to a float -

Returns the float whose text representation is - String, for example:

+

Returns the float whose text representation is String.

 > list_to_float("2.2017764e+0").
 2.2017764
@@ -2324,13 +1990,12 @@ representation of a float.

- - Converts from text representation to an integer. + Convert from text representation to an integer

Returns an integer whose text representation is - String, for example:

+ String.

 > list_to_integer("123").
 123
@@ -2338,14 +2003,12 @@ representation of an integer.

- - Converts from text representation to an integer. + Convert from text representation to an integer

Returns an integer whose text representation in base - Base is String, - for example:

+ Base is String.

 > list_to_integer("3FF", 16).
 1023
@@ -2353,52 +2016,47 @@ representation of an integer.

- - Converts from text representation to a pid. + Convert from text representation to a pid -

Returns a process identifier whose text representation is a - String, for example:

+

Returns a pid whose text representation is String.

+ +

This BIF is intended for debugging and for use in + the Erlang operating system. It should not be used in + application programs.

+
 > list_to_pid("<0.4.1>").
 <0.4.1>

Failure: badarg if String contains a bad - representation of a process identifier.

- -

This BIF is intended for debugging and is not to be used - in application programs.

-
+ representation of a pid.

- - Converts a list to a tuple. + Convert a list to a tuple -

Returns a tuple corresponding to List, - for example

+

Returns a tuple which corresponds to List. List + can contain any Erlang terms.

 > list_to_tuple([share, ['Ericsson_B', 163]]).
 {share, ['Ericsson_B', 163]}
-

List can contain any Erlang terms.

- - Loads object code for a module. + Load object code for a module -

If Binary contains the object code for module - Module, this BIF loads that object code. If - the code for module Module already exists, all +

If Binary contains the object code for the module + Module, this BIF loads that object code. Also, if + the code for the module Module already exists, all export references are replaced so they point to the newly loaded code. The previously loaded code is kept in the system - as old code, as there can still be processes executing - that code.

-

Returns either {module, Module}, or - {error, Reason} if loading fails. - Reason is any of the following:

+ as old code, as there may still be processes which are + executing that code. It returns either + {module, Module}, or {error, Reason} if loading + fails. Reason is one of the following:

badfile @@ -2408,122 +2066,118 @@ not_purged -

Binary contains a module that cannot be - loaded because old code for this module already exists.

+

Binary contains a module which cannot be loaded + because old code for this module already exists.

This BIF is intended for the code server (see - code(3)) - and is not to be used elsewhere.

+ code(3)) and should not be + used elsewhere.

- - Loads NIF library. + Load NIF library -

Before OTP R14B, NIFs were an - experimental feature. Versions before OTP R14B can +

In releases older than OTP R14B, NIFs were an + experimental feature. Versions of OTP older than R14B might have different and possibly incompatible NIF semantics and - interfaces. For example, in OTP R13B03 the return value on - failure was {error,Reason,Text}.

+ interfaces. For example, in R13B03 the return value on + failure was + {error,Reason,Text}.

Loads and links a dynamic library containing native - implemented functions (NIFs) for a module. Path - is a file path to the shareable object/dynamic library file minus - the OS-dependent file extension (.so for Unix and - .dll for Windows. For information on how to - implement a NIF library, see - erl_nif.

-

LoadInfo can be any term. It is passed on to + implemented functions (NIFs) for a module. Path is a + file path to the sharable object/dynamic library file minus + the OS-dependent file extension (.so for Unix and .dll for + Windows). See erl_nif + on how to implement a NIF library.

+

LoadInfo can be any term. It will be passed on to the library as part of the initialization. A good practice is to include a module version number to support future code upgrade scenarios.

The call to load_nif/2 must be made directly from the Erlang code of the module that the - NIF library belongs to. It returns either ok, or - {error,{Reason,Text}} if loading fails. - Reason is one of the following atoms - while Text is a human readable string that - can give more information about the failure:

+ NIF library belongs to.

+

It returns either ok, or {error,{Reason,Text}} + if loading fails. Reason is one of the atoms below, + while Text is a human readable string that may give + some more information about the failure.

load_failed - The OS failed to load the NIF library. + +

The OS failed to load the NIF library.

bad_lib - The library did not fulfill the requirements as a NIF - library of the calling module. + +

The library did not fulfil the requirements as a NIF + library of the calling module.

load | reload | upgrade - The corresponding library callback was unsuccessful. + +

The corresponding library callback was not successful.

old_code - The call to load_nif/2 was made from the old - code of a module that has been upgraded; this is not - allowed. + +

The call to load_nif/2 was made from the old + code of a module that has been upgraded. This is not + allowed.

- - Lists all loaded modules. + List of all loaded modules -

Returns a list of all loaded Erlang modules (current and +

Returns a list of all loaded Erlang modules (current and/or old code), including preloaded modules.

See also code(3).

- - Current local date and time. + Current local date and time -

Returns the current local date and time, - {{Year, Month, Day}, {Hour, Minute, Second}}, - for example:

+

Returns the current local date and time + {{Year, Month, Day}, {Hour, Minute, Second}}.

+

The time zone and daylight saving time correction depend + on the underlying OS.

 > erlang:localtime().
 {{1996,11,6},{14,45,17}}
-

The time zone and Daylight Saving Time correction depend - on the underlying OS.

- - Converts from local to Universal Time Coordinated (UTC) date and time. + Convert from local to Universal Time Coordinated (UTC) date and time

Converts local date and time to Universal Time Coordinated - (UTC), if supported by the underlying OS. Otherwise - no conversion is done and Localtime - is returned.

-

Example:

+ (UTC), if this is supported by the underlying OS. Otherwise, + no conversion is done and Localtime is returned.

 > erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}).
 {{1996,11,6},{13,45,17}}
-

Failure: badarg if Localtime denotes an - invalid date and time.

+

Failure: badarg if Localtime does not denote + a valid date and time.

- - Converts from local to Universal Time Coordinated (UTC) date and time. + Convert from local to Universal Time Coordinated (UTC) date and time

Converts local date and time to Universal Time Coordinated - (UTC) as erlang:localtime_to_universaltime/1, - but the caller decides if Daylight Saving Time is active.

-

If IsDst == true, Localtime is - during Daylight Saving Time, if IsDst == false it is - not. If IsDst == undefined, the underlying OS can + (UTC) just like erlang:localtime_to_universaltime/1, + but the caller decides if daylight saving time is active or + not.

+

If IsDst == true the Localtime is during + daylight saving time, if IsDst == false it is not, + and if IsDst == undefined the underlying OS may guess, which is the same as calling erlang:localtime_to_universaltime(Localtime).

-

Examples:

 > erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, true).
 {{1996,11,6},{12,45,17}}
@@ -2531,227 +2185,216 @@
 {{1996,11,6},{13,45,17}}
 > erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, undefined).
 {{1996,11,6},{13,45,17}}
-

Failure: badarg if Localtime denotes an - invalid date and time.

+

Failure: badarg if Localtime does not denote + a valid date and time.

- - Returns a unique reference. + Return an almost unique reference -

Returns a unique - reference. The reference is unique among - connected nodes.

-

Known issue: When a node is restarted multiple - times with the same node name, references created - on a newer node can be mistaken for a reference - created on an older node with the same node name.

+

Returns an almost unique reference.

+

The returned reference will re-occur after approximately 2^82 + calls; therefore it is unique enough for practical purposes.

+
+> make_ref().
+#Ref<0.0.0.135>
- - Creates a new tuple of a given arity. + Create a new tuple of a given arity -

Creates a new tuple of the given Arity, where all - elements are InitialValue, for example:

+

Returns a new tuple of the given Arity, where all + elements are InitialValue.

 > erlang:make_tuple(4, []).
 {[],[],[],[]}
- - Creates a new tuple with given arity and contents. + Create a new tuple with given arity and contents -

Creates a tuple of size Arity, where each element - has value DefaultValue, and then fills in - values from InitList. - Each list element in InitList - must be a two-tuple, where the first element is a position in the - newly created tuple and the second element is any term. If a - position occurs more than once in the list, the term corresponding - to the last occurrence is used.

-

Example:

+

erlang:make_tuple first creates a tuple of size Arity + where each element has the value DefaultValue. It then fills + in values from InitList. Each list element in InitList + must be a two-tuple where the first element is a position in the + newly created tuple and the second element is any term. If a position + occurs more than once in the list, the term corresponding to + last occurrence will be used.

 > erlang:make_tuple(5, [], [{2,ignored},{5,zz},{2,aa}]).
 {{[],aa,[],[],zz}
- - Returns the size of a map. + Return the size of a map -

Returns an integer, which is the number of key-value pairs - in Map, for example:

+

Returns an integer which is the number of key-value pairs in Map.

 > map_size(#{a=>1, b=>2, c=>3}).
 3

Allowed in guard tests.

- - Returns the largest of two terms. + Return the largest of two term -

Returns the largest of Term1 and - Term2. - If the terms are equal, Term1 is returned.

+

Return the largest of Term1 and Term2; + if the terms compare equal, Term1 will be returned.

- - Computes an MD5 message digest. + Compute an MD5 message digest -

Computes an MD5 message digest from Data, where - the length of the digest is 128 bits (16 bytes). - Data +

Computes an MD5 message digest from Data, where + the length of the digest is 128 bits (16 bytes). Data is a binary or a list of small integers and binaries.

-

For more information about MD5, see RFC 1321 - The - MD5 Message-Digest Algorithm.

-

The MD5 Message-Digest Algorithm is not considered - safe for code-signing or software-integrity purposes.

+

See The MD5 Message Digest Algorithm (RFC 1321) for more + information about MD5.

+

The MD5 Message Digest Algorithm is not considered + safe for code-signing or software integrity purposes.

- - Finishes the update of an MD5 context and returns the computed MD5 message digest. + Finish the update of an MD5 context and return the computed MD5 message digest

Finishes the update of an MD5 Context and returns the computed MD5 message digest.

- - Creates an MD5 context. + Create an MD5 context

Creates an MD5 context, to be used in subsequent calls to md5_update/2.

- - Updates an MD5 context with data and returns a new context. + Update an MD5 context with data, and return a new context -

Updates an MD5 Context with - Data and returns a - NewContext.

+

Updates an MD5 Context with Data, and returns + a NewContext.

- - Information about dynamically allocated memory. + Information about dynamically allocated memory -

Returns a list with information about memory - dynamically allocated by the Erlang emulator. Each list - element is a tuple {Type, Size}. The first element - Type is an atom describing memory type. The second - element Size is the memory size in bytes.

-

The memory types are as follows:

+

Returns a list containing information about memory + dynamically allocated by the Erlang emulator. Each element of + the list is a tuple {Type, Size}. The first element + Typeis an atom describing memory type. The second + element Sizeis memory size in bytes. A description of + each memory type follows:

total -

The total amount of memory currently allocated. This is - the same as the sum of the memory size for processes +

The total amount of memory currently allocated, which is + the same as the sum of memory size for processes and system.

processes -

The total amount of memory currently allocated for +

The total amount of memory currently allocated by the Erlang processes.

processes_used

The total amount of memory currently used by the Erlang - processes. This is part of the memory presented as + processes.

+

This memory is part of the memory presented as processes memory.

system -

The total amount of memory currently allocated for +

The total amount of memory currently allocated by the emulator that is not directly related to any Erlang - process. Memory presented as processes is not - included in this memory.

+ process.

+

Memory presented as processes is not included in + this memory.

atom -

The total amount of memory currently allocated for atoms. - This memory is part of the memory presented as +

The total amount of memory currently allocated for atoms.

+

This memory is part of the memory presented as system memory.

atom_used -

The total amount of memory currently used for atoms. - This memory is part of the memory presented as +

The total amount of memory currently used for atoms.

+

This memory is part of the memory presented as atom memory.

binary

The total amount of memory currently allocated for - binaries. This memory is part of the memory presented - as system memory.

+ binaries.

+

This memory is part of the memory presented as + system memory.

code

The total amount of memory currently allocated for - Erlang code. This memory is part of the memory presented - as system memory.

+ Erlang code.

+

This memory is part of the memory presented as + system memory.

ets

The total amount of memory currently allocated for ets - tables. This memory is part of the memory presented as + tables.

+

This memory is part of the memory presented as system memory.

low -

Only on 64-bit halfword emulator. - The total amount of memory allocated in low memory areas - that are restricted to less than 4 GB, although - the system can have more memory.

-

Can be removed in a future release of the halfword - emulator.

+

Only on 64-bit halfword emulator.

+

The total amount of memory allocated in low memory areas + that are restricted to less than 4 Gb even though + the system may have more physical memory.

+

May be removed in future releases of halfword emulator.

maximum

The maximum total amount of memory allocated since - the emulator was started. This tuple is only present - when the emulator is run with instrumentation.

+ the emulator was started.

+

This tuple is only present when the emulator is run with + instrumentation.

For information on how to run the emulator with - instrumentation, see + instrumentation see instrument(3) and/or erl(1).

The system value is not complete. Some allocated - memory that is to be part of this value is not.

+ memory that should be part of the system value are + not.

When the emulator is run with instrumentation, the system value is more accurate, but memory - directly allocated for malloc (and friends) is still + directly allocated by malloc (and friends) are still not part of the system value. Direct calls to - malloc are only done from OS-specific runtime - libraries and perhaps from user-implemented Erlang drivers + malloc are only done from OS specific runtime + libraries and perhaps from user implemented Erlang drivers that do not use the memory allocation functions in the driver interface.

-

As the total value is the sum of processes - and system, the error in system propagates +

Since the total value is the sum of processes + and system the error in system will propagate to the total value.

The different amounts of memory that are summed are - not gathered atomically, which introduces + not gathered atomically which also introduce an error in the result.

-

The different values have the following relation to each +

The different values has the following relation to each other. Values beginning with an uppercase letter is not part of the result.

@@ -2759,62 +2402,69 @@ processes = processes_used + ProcessesNotUsed system = atom + binary + code + ets + OtherSystem atom = atom_used + AtomNotUsed + RealTotal = processes + RealSystem RealSystem = system + MissedSystem -

More tuples in the returned list can be added in a - future release.

+

More tuples in the returned list may be added in the future.

The total value is supposed to be the total amount of memory dynamically allocated by the emulator. Shared libraries, the code of the emulator itself, and - the emulator stacks are not supposed to be included. That + the emulator stack(s) are not supposed to be included. That is, the total value is not supposed to be - equal to the total size of all pages mapped to the emulator.

-

Furthermore, because of fragmentation and prereservation of - memory areas, the size of the memory segments containing - the dynamically allocated memory blocks can be much + equal to the total size of all pages mapped to the emulator. + Furthermore, due to fragmentation and pre-reservation of + memory areas, the size of the memory segments which contain + the dynamically allocated memory blocks can be substantially larger than the total size of the dynamically allocated memory blocks.

-

As from ERTS 5.6.4, erlang:memory/0 requires that +

+ Since erts version 5.6.4 erlang:memory/0 requires that all erts_alloc(3) - allocators are enabled (default behavior).

+ allocators are enabled (default behaviour). +

-

Failure: notsup if an - erts_alloc(3) - allocator has been disabled.

+

Failure:

+ + notsup + + If an erts_alloc(3) + allocator has been disabled. + +
- - Information about dynamically allocated memory. + Information about dynamically allocated memory

Returns the memory size in bytes allocated for memory of type Type. The argument can also be given as a list of memory_type() atoms, in which case a corresponding list of {memory_type(), Size :: integer >= 0} tuples is returned.

-

As from ERTS version 5.6.4, - erlang:memory/1 requires that +

+ Since erts version 5.6.4 erlang:memory/1 requires that all erts_alloc(3) - allocators are enabled (default behavior).

+ allocators are enabled (default behaviour). +

Failures:

badarg - If Type is not one of the memory types - listed in the description of + If Type is not one of the memory types listed in the + documentation of erlang:memory/0. badarg - If maximum is passed as Type and - the emulator is not run in instrumented mode. + If maximum is passed as Type and the emulator + is not run in instrumented mode. notsup @@ -2826,367 +2476,226 @@ erlang:memory/0.

- - Returns the smallest of two terms. + Return the smallest of two term -

Returns the smallest of Term1 and - Term2. - If the terms are equal, Term1 is returned.

+

Return the smallest of Term1 and Term2; + if the terms compare equal, Term1 will be returned.

- - Checks if a module is loaded. + Check if a module is loaded -

Returns true if the module Module - is loaded, otherwise false. It does not attempt to load +

Returns true if the module Module is loaded, + otherwise returns false. It does not attempt to load the module.

This BIF is intended for the code server (see - code(3)) and is not to be + code(3)) and should not be used elsewhere.

- - - - Starts monitoring. - - - - -

Send a monitor request of type Type to the - entity identified by Item. The caller of - monitor/2 will later be notified by a monitor message on the - following format if the monitored state is changed:

- {Tag, MonitorRef, Type, Object, Info} -

The monitor request is an asynchronous signal. That is, it - takes time before the signal reaches its destination.

-

Valid Types:

- - process - -

Monitor the existence of the process identified by - Item. Valid - Items in combination with the - process Type can be any of the following:

- - pid() - -

The process identifier of the process to monitor.

-
- {RegisteredName, Node} - -

A tuple consisting of a registered name of a process and - a node name. The process residing on the node Node - with the registered name {RegisteredName, Node} will - be monitored.

-
- RegisteredName - -

The process locally registered as RegisteredName - will become monitored.

-
-
-

When a registered name is used, the - process that has the registered name when the - monitor request reach its destination will be monitored. - The monitor is not effected if the registered name is - unregistered, or unregistered and later registered on another - process.

-

The monitor is triggered either when the monitored process - terminates, is non existing, or if the connection to it is - lost. In the case the connection to it is lost, we do not know - if it still exist or not. After this type of monitor has been - triggered, the monitor is automatically removed.

-

When the monitor is triggered a 'DOWN' message is - sent to the monitoring process. A 'DOWN' message has - the following pattern:

- {'DOWN', MonitorRef, Type, Object, Info} -

Here MonitorRef and Type are the same as - described earlier, and:

- - Object - -

equals:

- - Item - If Item is specified by a - process identifier. - {RegisteredName, Node} - If Item is specified as - RegisteredName, or {RegisteredName, Node} - where Node corresponds to the node that the - monitored process resides on. - -
- Info - -

Either the exit reason of the process, noproc - (non-existing process), or noconnection (no - connection to the node where the monitored process - resides).

-
-

The monitoring is turned off when the 'DOWN' - message is sent or when - demonitor/1 - is called.

-

If an attempt is made to monitor a process on an older node - (where remote process monitoring is not implemented or - where remote process monitoring by registered name is not - implemented), the call fails with badarg.

- -

The format of the 'DOWN' message changed in ERTS - version 5.2 (OTP R9B) for monitoring - by registered name. Element Object of - the 'DOWN' message could in earlier versions - sometimes be the process identifier of the monitored process and sometimes - be the registered name. Now element Object is - always a tuple consisting of the registered name and - the node name. Processes on new nodes (ERTS version 5.2 - or higher) always get 'DOWN' messages on - the new format even if they are monitoring processes on old - nodes. Processes on old nodes always get 'DOWN' - messages on the old format.

-
-
- time_offset - -

Monitor changes in - time offset - between - Erlang - monotonic time and - Erlang - system time. There is only one valid - Item in combination with the - time_offset Type, namely the atom - clock_service. Note that the atom clock_service is - not the registered name of a process. In this specific - case it serves as an identifier of the runtime system internal - clock service at current runtime system instance.

- -

The monitor is triggered when the time offset is changed. - This either if the time offset value is changed, or if the - offset is changed from preliminary to final during - finalization - of the time offset when the - single - time warp mode is used. When a change from preliminary - to final time offset is made, the monitor will be triggered once - regardless of whether the time offset value was actually changed - or not.

- -

If the runtime system is in - multi - time warp mode, the time offset will be changed when - the runtime system detects that the - OS system - time has changed. The runtime system will, however, - not detect this immediately when it happens. A task checking - the time offset is scheduled to execute at least once a minute, - so under normal operation this should be detected within a - minute, but during heavy load it might take longer time.

- -

The monitor will not be automatically removed - after it has been triggered. That is, repeated changes of - the time offset will trigger the monitor repeatedly.

- -

When the monitor is triggered a 'CHANGE' message will - be sent to the monitoring process. A 'CHANGE' message has - the following pattern:

- {'CHANGE', MonitorRef, Type, Item, NewTimeOffset} -

where MonitorRef, Type, and - Item are the same as described above, and - NewTimeOffset is the new time offset.

- -

When the 'CHANGE' message has been received you are - guaranteed not to retrieve the old time offset when calling - erlang:time_offset(). - Note that you can observe the change of the time offset - when calling erlang:time_offset() before you - get the 'CHANGE' message.

- -
-
-

Making several calls to monitor/2 for the same - Item and/or Type is not - an error; it results in as many independent monitoring instances.

-

The monitor functionality is expected to be extended. That is, - other Types and Items - are expected to be supported in a future release.

+ + Start monitoring + +

The calling process starts monitoring Item which is + an object of type Type.

+

Currently only processes can be monitored, i.e. the only + allowed Type is process, but other types may be + allowed in the future.

+

Item can be:

+ + pid() + +

The pid of the process to monitor.

+
+ {RegName, Node} + +

A tuple consisting of a registered name of a process and + a node name. The process residing on the node Node + with the registered name RegName will be monitored.

+
+ RegName + +

The process locally registered as RegName will be + monitored.

+
+
-

If or when monitor/2 is extended, other - possible values for Tag, Object and - Info in the monitor message will be introduced.

+

When a process is monitored by registered name, the process + that has the registered name at the time when + monitor/2 is called will be monitored. + The monitor will not be effected, if the registered name is + unregistered.

+
+

A 'DOWN' message will be sent to the monitoring + process if Item dies, if Item does not exist, + or if the connection is lost to the node which Item + resides on. A 'DOWN' message has the following pattern:

+ +{'DOWN', MonitorRef, Type, Object, Info} +

where MonitorRef and Type are the same as + described above, and:

+ + Object + +

A reference to the monitored object:

+ + the pid of the monitored process, if Item was + specified as a pid. + {RegName, Node}, if Item was specified as + {RegName, Node}. + {RegName, Node}, if Item was specified as + RegName. Node will in this case be the + name of the local node (node()). + +
+ Info + +

Either the exit reason of the process, noproc + (non-existing process), or noconnection (no + connection to Node).

+
+
+ +

If/when monitor/2 is extended (e.g. to + handle other item types than process), other + possible values for Object, and Info in the + 'DOWN' message will be introduced.

+
+

The monitoring is turned off either when the 'DOWN' + message is sent, or when + demonitor/1 + is called.

+

If an attempt is made to monitor a process on an older node + (where remote process monitoring is not implemented or one + where remote process monitoring by registered name is not + implemented), the call fails with badarg.

+

Making several calls to monitor/2 for the same + Item is not an error; it results in as many, completely + independent, monitorings.

+ +

The format of the 'DOWN' message changed in the 5.2 + version of the emulator (OTP release R9B) for monitor by registered name. The Object element of + the 'DOWN' message could in earlier versions + sometimes be the pid of the monitored process and sometimes + be the registered name. Now the Object element is + always a tuple consisting of the registered name and + the node name. Processes on new nodes (emulator version 5.2 + or greater) will always get 'DOWN' messages on + the new format even if they are monitoring processes on old + nodes. Processes on old nodes will always get 'DOWN' + messages on the old format.

- - Monitors the status of a node. + Monitor the status of a node -

Monitors the status of the node Node. - If Flag - is true, monitoring is turned on. If Flag - is false, monitoring is turned off.

+

Monitors the status of the node Node. If Flag + is true, monitoring is turned on; if Flag is + false, monitoring is turned off.

Making several calls to monitor_node(Node, true) for - the same Node is not an error; it results - in as many independent monitoring instances.

+ the same Node is not an error; it results in as many, + completely independent, monitorings.

If Node fails or does not exist, the message {nodedown, Node} is delivered to the process. If a process has made two calls to monitor_node(Node, true) - and Node terminates, two nodedown messages - are delivered to the process. If there is no connection to - Node, an attempt is made to create one. - If this fails, a nodedown message is delivered.

+ and Node terminates, two nodedown messages are + delivered to the process. If there is no connection to + Node, there will be an attempt to create one. If this + fails, a nodedown message is delivered.

Nodes connected through hidden connections can be monitored - as any other nodes.

+ as any other node.

Failure: badarg if the local node is not alive.

- - Monitors the status of a node. + Monitor the status of a node -

Behaves as - monitor_node/2 - except that it allows an +

Behaves as monitor_node/2 except that it allows an extra option to be given, namely allow_passive_connect. - This option allows the BIF to wait the normal network connection - time-out for the monitored node to connect itself, + The option allows the BIF to wait the normal net connection + timeout for the monitored node to connect itself, even if it cannot be actively connected from this node - (that is, it is blocked). The state where this can be useful - can only be achieved by using the Kernel option - dist_auto_connect once. If that option is not - used, option allow_passive_connect has no effect.

+ (i.e. it is blocked). The state where this might be useful can + only be achieved by using the kernel option + dist_auto_connect once. If that kernel option is not + used, the allow_passive_connect option has no + effect.

-

Option allow_passive_connect is used +

The allow_passive_connect option is used internally and is seldom needed in applications where the - network topology and the Kernel options in effect - are known in advance.

+ network topology and the kernel options in effect is known in + advance.

Failure: badarg if the local node is not alive or the option list is malformed.

- - - - Current Erlang monotonic time. - -

Returns the current - Erlang - monotonic time in native - time unit. This - is a monotonically increasing time since some unspecified point in - time.

- -

This is a - monotonically increasing time, but not a - strictly monotonically increasing - time. That is, consecutive calls to - erlang:monotonic_time/0 can produce the same result.

- -

Different runtime system instances will use different - unspecified points in time as base for their Erlang monotonic clocks. - That is, it is pointless comparing monotonic times from - different runtime system instances. Different runtime system instances - may also place this unspecified point in time different relative - runtime system start. It may be placed in the future (time at start - is a negative value), the past (time at start is a - positive value), or the runtime system start (time at start is - zero). The monotonic time at runtime system start can be - retrieved by calling - erlang:system_info(start_time).

-
-
- - - Current Erlang monotonic time - -

Returns the current - Erlang - monotonic time converted - into the Unit passed as argument.

- -

Same as calling - erlang:convert_time_unit(erlang:monotonic_time(), - native, Unit) - however optimized for commonly used Units.

-
-
- Stops execution with a given reason. + Stop execution with a given reason

Works exactly like - erlang:error/1, but - Dialyzer thinks that this BIF will return an arbitrary - term. When used in a stub function for a NIF to generate an - exception when the NIF library is not loaded, Dialyzer - does not generate false warnings.

+ erlang:error/1, + but Dialyzer thinks that this BIF will return an arbitrary term. + When used in a stub function for a NIF to generate an + exception when the NIF library is not loaded, Dialyzer + will not generate false warnings.

- - Stops execution with a given reason. + Stop execution with a given reason

Works exactly like - erlang:error/2, but - Dialyzer thinks that this BIF will return an arbitrary - term. When used in a stub function for a NIF to generate an - exception when the NIF library is not loaded, Dialyzer - does not generate false warnings.

+ erlang:error/2, + but Dialyzer thinks that this BIF will return an arbitrary term. + When used in a stub function for a NIF to generate an + exception when the NIF library is not loaded, Dialyzer + will not generate false warnings.

- - Name of the local node. + Name of the local node

Returns the name of the local node. If the node is not alive, nonode@nohost is returned instead.

Allowed in guard tests.

- - At which node a pid, port, or reference originates. + At which node is a pid, port or reference located -

Returns the node where Arg originates. - Arg can - be a process identifier, a reference, or a port. - If the local node is not +

Returns the node where Arg is located. Arg can + be a pid, a reference, or a port. If the local node is not alive, nonode@nohost is returned.

Allowed in guard tests.

- - All visible nodes in the system. + All visible nodes in the system -

Returns a list of all visible nodes in the system, except +

Returns a list of all visible nodes in the system, excluding the local node. Same as nodes(visible).

- - All nodes of a certain type in the system. + All nodes of a certain type in the system -

Returns a list of nodes according to the argument given. - The returned result when the argument is a list, is the list +

Returns a list of nodes according to argument given. + The result returned when the argument is a list, is the list of nodes satisfying the disjunction(s) of the list elements.

NodeType can be any of the following:

@@ -3208,131 +2717,130 @@ known -

Nodes that are known to this node. That is, connected - nodes and nodes referred to by process identifiers, port - identifiers and references located on this node. - The set of known nodes is garbage collected. Notice that - this garbage collection can be delayed. For more - information, see - delayed_node_table_gc. -

+

Nodes which are known to this node, i.e., connected, + previously connected, etc.

Some equalities: [node()] = nodes(this), nodes(connected) = nodes([visible, hidden]), and nodes() = nodes(visible).

+

If the local node is not alive, + nodes(this) == nodes(known) == [nonode@nohost], for + any other Arg the empty list [] is returned.

- - Elapsed time since 00:00 GMT. + Elapsed time since 00:00 GMT -

This function is deprecated! Do not use it! - See the users guide chapter - Time and Time Correction - for more information. Specifically the - Dos and Dont's - section for information on what to use instead of erlang:now/0. -

Returns the tuple {MegaSecs, Secs, MicroSecs} which is - the elapsed time since 00:00 GMT, January 1, 1970 (zero hour), + the elapsed time since 00:00 GMT, January 1, 1970 (zero hour) on the assumption that the underlying OS supports this. - Otherwise some other point in time is chosen. It is also - guaranteed that subsequent calls to this BIF return + Otherwise, some other point in time is chosen. It is also + guaranteed that subsequent calls to this BIF returns continuously increasing values. Hence, the return value from - now() can be used to generate unique time-stamps. - If it is called in a tight loop on a fast machine, + now() can be used to generate unique time-stamps, + and if it is called in a tight loop on a fast machine the time of the node can become skewed.

-

Can only be used to check the local time of day if - the time-zone information of the underlying OS is +

It can only be used to check the local time of day if + the time-zone info of the underlying operating system is properly configured.

+

If you do not need the return value to be unique and + monotonically increasing, use + os:timestamp/0 + instead to avoid some overhead.

- - Opens a port. + Open a port

Returns a port identifier as the result of opening a new Erlang port. A port can be seen as an external Erlang - process.

+ process. +

The name of the executable as well as the arguments - given in cd, env, args, and arg0 are - subject to Unicode file name translation if the system is running + given in cd, env, args and arg0 is subject to + Unicode file name translation if the system is running in Unicode file name mode. To avoid - translation or to force, for example UTF-8, supply the executable + translation or force i.e. UTF-8, supply the executable and/or arguments as a binary in the correct - encoding. For details, see the module - file, the function - file:native_name_encoding/0, and the - STDLIB - User's Guide.

-

The characters in the name (if given as a list) can - only be higher than 255 if the Erlang Virtual Machine is started - in Unicode file name translation mode. Otherwise the name + encoding. See the file module, the + + file:native_name_encoding/0 function and the + stdlib users guide + for details.

+ +

The characters in the name (if given as a list) + can only be > 255 if the Erlang VM is started in + Unicode file name translation mode, otherwise the name of the executable is limited to the ISO-latin-1 character set.

-

PortName can be any of the following:

+ +

PortName is one of the following:

{spawn, Command} -

Starts an external program. Command - is the name of the external program to be run. - Command +

Starts an external program. Command is the name + of the external program which will be run. Command runs outside the Erlang work space unless an Erlang - driver with the name Command is found. - If found, that driver is started. A driver runs in the Erlang - work space, which means that it is linked with the Erlang + driver with the name Command is found. If found, + that driver will be started. A driver runs in the Erlang + workspace, which means that it is linked with the Erlang runtime system.

When starting external programs on Solaris, the system call vfork is used in preference to fork for performance reasons, although it has a history of - being less robust. If there are problems using - vfork, setting environment variable - ERL_NO_VFORK to any value causes fork + being less robust. If there are problems with using + vfork, setting the environment variable + ERL_NO_VFORK to any value will cause fork to be used instead.

-

For external programs, PATH is searched + +

For external programs, the PATH is searched (or an equivalent method is used to find programs, - depending on OS). This is done by invoking - the shell on certain platforms. The first space-separated - token of the command is considered as the + depending on operating system). This is done by invoking + the shell on certain platforms. The first space + separated token of the command will be considered as the name of the executable (or driver). This (among other things) makes this option unsuitable for running - programs having spaces in file names or directory names. - If spaces in executable file names are desired, use - {spawn_executable, Command} instead.

+ programs having spaces in file or directory names. Use + {spawn_executable, Command} instead if spaces in executable + file names is desired.

{spawn_driver, Command}

Works like {spawn, Command}, but demands the - first (space-separated) token of the command to be the name of a + first (space separated) token of the command to be the name of a loaded driver. If no driver with that name is loaded, a badarg error is raised.

{spawn_executable, FileName} +

Works like {spawn, FileName}, but only runs - external executables. FileName in its whole - is used as the name of the executable, including any spaces. - If arguments are to be passed, the PortSettings - args and arg0 can be used.

-

The shell is usually not invoked to start the - program, it is executed directly. PATH (or - equivalent) is not searched. To find a program - in PATH to execute, use - os:find_executable/1.

+ external executables. The FileName in its whole + is used as the name of the executable, including any + spaces. If arguments are to be passed, the + args and arg0 PortSettings can be used.

+ +

The shell is not usually invoked to start the + program, it's executed directly. Neither is the + PATH (or equivalent) searched. To find a program + in the PATH to execute, use os:find_executable/1.

Only if a shell script or .bat file is - executed, the appropriate command interpreter is - invoked implicitly, but there is still no - command argument expansion or implicit PATH search.

-

If FileName cannot be run, an error - exception is raised, with the POSIX error code as the reason. - The error reason can differ between OSs. - Typically the error enoent is raised when an - attempt is made to run a program that is not found and - eacces is raised when the given file is not + executed, the appropriate command interpreter will + implicitly be invoked, but there will still be no + command argument expansion or implicit PATH search.

+ +

If the FileName cannot be run, an error + exception, with the posix error code as the reason, is + raised. The error reason may differ between operating + systems. Typically the error enoent is raised + when one tries to run a program that is not found and + eaccess is raised when the given file is not executable.

{fd, In, Out} @@ -3341,18 +2849,19 @@ file descriptors used by Erlang. The file descriptor In can be used for standard input, and the file descriptor Out for standard output. It is only - used for various servers in the Erlang OS (shell - and user). Hence, its use is limited.

+ used for various servers in the Erlang operating system + (shell and user). Hence, its use is very + limited.

PortSettings is a list of settings for the port. - The valid settings are as follows:

+ Valid settings are:

{packet, N}

Messages are preceded by their length, sent in N - bytes, with the most significant byte first. The valid values - for N are 1, 2, and 4.

+ bytes, with the most significant byte first. Valid values + for N are 1, 2, or 4.

stream @@ -3363,108 +2872,116 @@ {line, L}

Messages are delivered on a per line basis. Each line - (delimited by the OS-dependent new line sequence) is - delivered in a single message. The message data format - is {Flag, Line}, where Flag is - eol or noeol, and Line is the - data delivered (without the new line sequence).

+ (delimited by the OS-dependent newline sequence) is + delivered in one single message. The message data format + is {Flag, Line}, where Flag is either + eol or noeol and Line is the actual + data delivered (without the newline sequence).

L specifies the maximum line length in bytes. - Lines longer than this are delivered in more than one - message, with Flag set to noeol for all + Lines longer than this will be delivered in more than one + message, with the Flag set to noeol for all but the last message. If end of file is encountered - anywhere else than immediately following a new line - sequence, the last line is also delivered with - Flag set to noeol. Otherwise + anywhere else than immediately following a newline + sequence, the last line will also be delivered with + the Flag set to noeol. In all other cases, lines are delivered with Flag set to eol.

-

The {packet, N} and {line, - L} settings are mutually exclusive.

+

The {packet, N} and {line, L} settings are + mutually exclusive.

{cd, Dir} -

Only valid for {spawn, Command} and - {spawn_executable, FileName}. +

This is only valid for {spawn, Command} and + {spawn_executable, FileName}. The external program starts using Dir as its - working directory. Dir must be a string.

+ working directory. Dir must be a string. +

{env, Env} -

Only valid for {spawn, Command} and +

This is only valid for {spawn, Command} and {spawn_executable, FileName}. The environment of the started process is extended using the environment specifications in Env.

-

Env is to be a list of tuples - {Name, Val}, - where Name is the name of an - environment variable, and Val is the - value it is to have in the spawned - port process. Both Name and - Val must be strings. The one - exception is Val being the atom +

Env should be a list of tuples {Name, Val}, + where Name is the name of an environment variable, + and Val is the value it is to have in the spawned + port process. Both Name and Val must be + strings. The one exception is Val being the atom false (in analogy with os:getenv/1), which - removes the environment variable.

+ removes the environment variable. +

{args, [ string() | binary() ]} -

Only valid for {spawn_executable, FileName} + +

This option is only valid for {spawn_executable, FileName} and specifies arguments to the executable. Each argument is given as a separate string and (on Unix) eventually ends up as one element each in the argument vector. On - other platforms, a similar behavior is mimicked.

-

The arguments are not expanded by the shell before - being supplied to the executable. Most notably this - means that file wild card expansion does not happen. - To expand wild cards for the arguments, use - filelib:wildcard/1. - Notice that even if + other platforms, similar behavior is mimicked.

+ +

The arguments are not expanded by the shell prior to + being supplied to the executable, most notably this + means that file wildcard expansion will not happen. Use + filelib:wildcard/1 + to expand wildcards for the arguments. Note that even if the program is a Unix shell script, meaning that the - shell ultimately is invoked, wild card expansion - does not happen, and the script is provided with the - untouched arguments. On Windows, wild card expansion - is always up to the program itself, therefore this is - not an issue issue.

-

The executable name (also known as argv[0]) - is not to be given in this list. The proper executable name - is automatically used as argv[0], where applicable.

-

If you explicitly want to set the - program name in the argument vector, option arg0 - can be used.

+ shell will ultimately be invoked, wildcard expansion + will not happen and the script will be provided with the + untouched arguments. On Windows®, wildcard expansion + is always up to the program itself, why this isn't an + issue.

+ +

Note also that the actual executable name (a.k.a. argv[0]) + should not be given in this list. The proper executable name will + automatically be used as argv[0] where applicable.

+ +

If one, for any reason, wants to explicitly set the + program name in the argument vector, the arg0 + option can be used.

+
{arg0, string() | binary()} -

Only valid for {spawn_executable, FileName} + +

This option is only valid for {spawn_executable, FileName} and explicitly specifies the program name argument when - running an executable. This can in some circumstances, - on some OSs, be desirable. How the program - responds to this is highly system-dependent and no specific + running an executable. This might in some circumstances, + on some operating systems, be desirable. How the program + responds to this is highly system dependent and no specific effect is guaranteed.

+
+ exit_status -

Only valid for {spawn, Command}, where - Command refers to an external program, and - for {spawn_executable, FileName}.

+

This is only valid for {spawn, Command} where + Command refers to an external program, and for + {spawn_executable, FileName}.

When the external process connected to the port exits, a message of the form {Port,{exit_status,Status}} is sent to the connected process, where Status is the exit status of the external process. If the program - aborts on Unix, the same convention is used as the shells - do (that is, 128+signal).

-

If option eof is also given, the messages eof - and exit_status appear in an unspecified order.

-

If the port program closes its stdout without exiting, - option exit_status does not work.

+ aborts, on Unix the same convention is used as the shells + do (i.e., 128+signal).

+

If the eof option has been given as well, + the eof message and the exit_status message + appear in an unspecified order.

+

If the port program closes its stdout without exiting, + the exit_status option will not work.

use_stdio -

Only valid for {spawn, Command} and +

This is only valid for {spawn, Command} and {spawn_executable, FileName}. It allows the standard input and output (file descriptors 0 - and 1) of the spawned (Unix) process for communication + and 1) of the spawned (UNIX) process for communication with Erlang.

nouse_stdio -

The opposite of use_stdio. It uses file descriptors +

The opposite of use_stdio. Uses file descriptors 3 and 4 for communication with Erlang.

stderr_to_stdout @@ -3476,15 +2993,14 @@
overlapped_io -

Affects ports to external programs on Windows only. The - standard input and standard output handles of the port program - are, if this option is supplied, opened with flag - FILE_FLAG_OVERLAPPED, so that the port program can - (and must) do +

Affects ports to external programs on Windows® only. + The standard input and standard output handles of the port program + will, if this option is supplied, be opened with the flag + FILE_FLAG_OVERLAPPED, so that the port program can (and has to) do overlapped I/O on its standard handles. This is not normally the case for simple port programs, but an option of value for the - experienced Windows programmer. On all other platforms, this - option is silently discarded.

+ experienced Windows programmer. On all other platforms, this + option is silently discarded.

in @@ -3496,354 +3012,345 @@ binary -

All I/O from the port is binary data objects as opposed +

All IO from the port are binary data objects as opposed to lists of bytes.

eof -

The port is not closed at the end of the file and does not - produce an exit signal. Instead, it remains open and - a {Port, eof} message is sent to the process +

The port will not be closed at the end of the file and + produce an exit signal. Instead, it will remain open and + a {Port, eof} message will be sent to the process holding the port.

hide -

When running on Windows, suppresses creation of a new +

When running on Windows, suppress creation of a new console window when spawning the port program. (This option has no effect on other platforms.)

- {parallelism, Boolean} + {parallelism, Boolean} - -

Sets scheduler hint for port parallelism. If set to - true, the Virtual Machine schedules port tasks; - when doing so, it improves parallelism in the system. If set - to false, the Virtual Machine tries to - perform port tasks immediately, improving latency at the - expense of parallelism. The default can be set at system startup - by passing command-line argument - +spp to erl(1).

+

Set scheduler hint for port parallelism. If set to true, + the VM will schedule port tasks when doing so will improve + parallelism in the system. If set to false, the VM will + try to perform port tasks immediately, improving latency at the + expense of parallelism. The default can be set on system startup + by passing the + +spp command line argument + to erl(1). +

-

Default is stream for all port types and +

The default is stream for all types of port and use_stdio for spawned ports.

Failure: If the port cannot be opened, the exit reason is - badarg, system_limit, or the POSIX error code that - most closely describes the error, or einval if no POSIX - code is appropriate:

+ badarg, system_limit, or the Posix error code which + most closely describes the error, or einval if no Posix code + is appropriate:

badarg - Bad input arguments to open_port. + +

Bad input arguments to open_port.

system_limit - All available ports in the Erlang emulator are in use. + +

All available ports in the Erlang emulator are in use.

enomem - Not enough memory to create the port. + +

There was not enough memory to create the port.

eagain - No more available OS processes. + +

There are no more available operating system processes.

enametoolong - Too long external command. + +

The external command given was too long.

emfile - No more available file descriptors (for the - OS process that the Erlang emulator runs in). + +

There are no more available file descriptors (for the operating system process + that the Erlang emulator runs in).

enfile - Full file table (for the entire OS). + +

The file table is full (for the entire operating system).

eacces - Command given in {spawn_executable, Command} - does not point out an executable file. + +

The Command given in {spawn_executable, Command} does not point out an executable file.

enoent - FileName given in - {spawn_executable, FileName} - does not point out an existing file. + +

The FileName given in {spawn_executable, FileName} does not point out an existing file.

During use of a port opened using {spawn, Name}, - {spawn_driver, Name}, or {spawn_executable, Name}, + {spawn_driver, Name} or {spawn_executable, Name}, errors arising when sending messages to it are reported to the owning process using signals of the form - {'EXIT', Port, PosixCode}. For the possible values of - PosixCode, see the - file(3) - manual page in Kernel.

+ {'EXIT', Port, PosixCode}. See file(3) for + possible values of PosixCode.

The maximum number of ports that can be open at the same - time can be configured by passing command-line flag - +Q to - erl(1).

+ time can be configured by passing the + +Q + command line flag to + erl(1).

- - Portable hash function. Range = 1..2^32, Hash = 1..Range + Portable hash function -

Portable hash function that gives the same hash for +

Portable hash function that will give the same hash for the same Erlang term regardless of machine architecture and - ERTS version (the BIF was introduced in ERTS 4.9.1.1). - The function returns a hash value for - Term within the range - 1..Range. The maximum value for - Range is 2^32.

-

This BIF can be used instead of the old deprecated BIF - erlang:hash/2, as it calculates better hashes for - all data types, but consider using phash2/1,2 instead.

+ ERTS version (the BIF was introduced in ERTS 4.9.1.1). Range + can be between 1 and 2^32, the function returns a hash value + for Term within the range 1..Range.

+

This BIF could be used instead of the old deprecated + erlang:hash/2 BIF, as it calculates better hashes for + all data-types, but consider using phash2/1,2 instead.

- - Portable hash function. 1..2^32 0..Range-1 + Portable hash function -

Portable hash function that gives the same hash for +

Portable hash function that will give the same hash for the same Erlang term regardless of machine architecture and - ERTS version (the BIF was introduced in ERTS 5.2). - The function returns a hash value for - Term within the range - 0..Range-1. The maximum value for - Range is 2^32. When without argument - Range, a value in the range - 0..2^27-1 is returned.

-

This BIF is always to be used for hashing terms. It + ERTS version (the BIF was introduced in ERTS 5.2). Range can + be between 1 and 2^32, the function returns a hash value for + Term within the range 0..Range-1. When called + without the Range argument, a value in the range + 0..2^27-1 is returned.

+

This BIF should always be used for hashing terms. It distributes small integers better than phash/2, and it is faster for bignums and binaries.

-

Notice that the range 0..Range-1 is - different from the range of phash/2, which is - 1..Range.

+

Note that the range 0..Range-1 is different from + the range of phash/2 (1..Range).

- - Text representation of a pid. + Text representation of a pid -

Returns a string corresponding to the text +

Returns a string which corresponds to the text representation of Pid.

-

This BIF is intended for debugging and is not to be used - in application programs.

+

This BIF is intended for debugging and for use in + the Erlang operating system. It should not be used in + application programs.

- - Closes an open port. + Close an open port

Closes an open port. Roughly the same as - Port ! {self(), close} except for the error behavior - (see the following), being synchronous, and that the port does - not reply with {Port, closed}. Any process can + Port ! {self(), close} except for the error behaviour + (see below), being synchronous, and that the port does + not reply with {Port, closed}. Any process may close a port with port_close/1, not only the port owner (the connected process). If the calling process is linked to - the port identified by Port, the exit - signal from the port is guaranteed to be delivered before - port_close/1 returns.

-

For comparison: Port ! {self(), close} - only fails with badarg if Port does - not refer to a port or a process. If Port - is a closed port, nothing happens. If Port + port identified by Port, an exit signal due + to that link will be received by the process prior to the return + from port_close/1.

+

For comparison: Port ! {self(), close} fails with + badarg if Port cannot be sent to (i.e., + Port refers neither to a port nor to a process). If + Port is a closed port nothing happens. If Port is an open port and the calling process is the port owner, - the port replies with {Port, closed} when all buffers - have been flushed and the port really closes. If the calling - process is not the port owner, the port owner fails - with badsig.

-

Notice that any process can close a port using - Port ! {PortOwner, close} as if it itself was + the port replies with {Port, closed} when all buffers + have been flushed and the port really closes, but if + the calling process is not the port owner the port owner fails with badsig.

+ +

Note that any process can close a port using + Port ! {PortOwner, close} just as if it itself was the port owner, but the reply always goes to the port owner.

-

As from OTP R16, Port ! {PortOwner, close} is truly - asynchronous. Notice that this operation has always been +

As of OTP-R16 Port ! {PortOwner, close} is truly + asynchronous. Note that this operation has always been documented as an asynchronous operation, while the underlying implementation has been synchronous. port_close/1 is - however still fully synchronous. This because of its error + however still fully synchronous. This due to its error behavior.

-

Failure: badarg if Port is not an identifier - of an open port, or the registered name of an open port. - If the calling process was previously linked to the closed - port, identified by Port, the exit - signal from the port is guaranteed to be delivered before - this badarg exception occurs.

+

Failure:

+ + badarg + + If Port is not an identifier of an open + port, or the registered name of an open port. If the calling + process was linked to the previously open port identified by + Port, an exit signal due to this link + was received by the process prior to this exception. + +
- - Sends data to a port. + Send data to a port

Sends data to a port. Same as - Port ! {PortOwner, {command, Data}} except - for the error - behavior and being synchronous (see the following). Any process - can send data to a port with port_command/2, not only the + Port ! {PortOwner, {command, Data}} except for the error + behaviour and being synchronous (see below). Any process may + send data to a port with port_command/2, not only the port owner (the connected process).

For comparison: Port ! {PortOwner, {command, Data}} - only fails with badarg if Port - does not refer to a port or a process. If - Port is a closed port, the data message - disappears + fails with badarg if Port cannot be sent to + (i.e., Port refers neither to a port nor to a process). + If Port is a closed port the data message disappears without a sound. If Port is open and the calling process is not the port owner, the port owner fails with badsig. The port owner fails with badsig - also if Data is an invalid I/O list.

-

Notice that any process can send to a port using - Port ! {PortOwner, {command, Data}} - as if it itself was the port owner.

-

If the port is busy, the calling process is suspended - until the port is not busy any more.

-

As from OTP-R16, Port ! {PortOwner, {command, Data}} - is truly asynchronous. Notice that this operation has always been + also if Data is not a valid IO list.

+

Note that any process can send to a port using + Port ! {PortOwner, {command, Data}} just as if it + itself was the port owner.

+

If the port is busy, the calling process will be suspended + until the port is not busy anymore.

+

As of OTP-R16 Port ! {PortOwner, {command, Data}} is + truly asynchronous. Note that this operation has always been documented as an asynchronous operation, while the underlying implementation has been synchronous. port_command/2 is - however still fully synchronous. This because of its error + however still fully synchronous. This due to its error behavior.

Failures:

badarg If Port is not an identifier of an open - port, or the registered name of an open port. If the - calling process was previously linked to the closed port, - identified by Port, the exit signal - from the port is guaranteed to be delivered before this - badarg exception occurs. + port, or the registered name of an open port. If the calling + process was linked to the previously open port identified by + Port, an exit signal due to this link + was received by the process prior to this exception. badarg - If Data is an invalid I/O list. + If Data is not a valid io list.
- - Sends data to a port. + Send data to a port

Sends data to a port. port_command(Port, Data, []) equals port_command(Port, Data).

-

If the port command is aborted, false is returned, - otherwise true.

-

If the port is busy, the calling process is suspended - until the port is not busy any more.

-

The following Options are valid:

+

If the port command is aborted false is returned; + otherwise, true is returned.

+

If the port is busy, the calling process will be suspended + until the port is not busy anymore.

+

Currently the following Options are valid:

force - The calling process is not suspended if the port is - busy, instead the port command is forced through. The - call fails with a notsup exception if the + The calling process will not be suspended if the port is + busy; instead, the port command is forced through. The + call will fail with a notsup exception if the driver of the port does not support this. For more - information, see driver flag - . + information see the + + driver flag. nosuspend - The calling process is not suspended if the port is - busy, instead the port command is aborted and + The calling process will not be suspended if the port is + busy; instead, the port command is aborted and false is returned. -

More options can be added in a future release.

+

More options may be added in the future.

Failures:

badarg If Port is not an identifier of an open - port, or the registered name of an open port. If the - calling process was previously linked to the closed port, - identified by Port, the exit signal - from the port is guaranteed to be delivered before this - badarg exception occurs. + port, or the registered name of an open port. If the calling + process was linked to the previously open port identified by + Port, an exit signal due to this link + was received by the process prior to this exception. badarg - If Data is an invalid I/O list. + If Data is not a valid io list. badarg - If OptionList is an invalid option list. + If OptionList is not a valid option list. notsup - If option force has been passed, but the + If the force option has been passed, but the driver of the port does not allow forcing through a busy port.
- - Sets the owner of a port. + Set the owner of a port

Sets the port owner (the connected port) to Pid. - Roughly the same as - Port ! {Owner, {connect, Pid}} + Roughly the same as Port ! {Owner, {connect, Pid}} except for the following:

-

The error behavior differs, see the following.

+

The error behavior differs, see below.

The port does not reply with {Port,connected}.

-

port_connect/1 is synchronous, see the following.

+

port_connect/1 is synchronous, see below.

The new port owner gets linked to the port.

-

The old port owner stays linked to the port and must call - unlink(Port) if this is not desired. Any process can +

The old port owner stays linked to the port and have to call + unlink(Port) if this is not desired. Any process may set the port owner to be any process with port_connect/2.

-

For comparison: - Port ! {self(), {connect, Pid}} - only fails with badarg if Port - does not refer to a port or a process. If - Port is a closed port, nothing happens. - If Port +

For comparison: Port ! {self(), {connect, Pid}} fails + with badarg if Port cannot be sent to (i.e., + Port refers neither to a port nor to a process). If + Port is a closed port nothing happens. If Port is an open port and the calling process is the port owner, the port replies with {Port, connected} to the old - port owner. Notice that the old port owner is still linked to - the port, while the new is not. If Port is an open + port owner. Note that the old port owner is still linked to + the port, and that the new is not. If Port is an open port and the calling process is not the port owner, the port owner fails with badsig. The port owner fails with badsig also if Pid is not an - existing local process identifier.

-

Notice that any process can set the port owner using - Port ! {PortOwner, {connect, Pid}} - as if it itself was the port owner, but the reply always goes to + existing local pid.

+

Note that any process can set the port owner using + Port ! {PortOwner, {connect, Pid}} just as if it + itself was the port owner, but the reply always goes to the port owner.

-

As from OTP-R16, - Port ! {PortOwner, {connect, Pid}} is - truly asynchronous. Notice that this operation has always been +

As of OTP-R16 Port ! {PortOwner, {connect, Pid}} is + truly asynchronous. Note that this operation has always been documented as an asynchronous operation, while the underlying implementation has been synchronous. port_connect/2 is - however still fully synchronous. This because of its error + however still fully synchronous. This due to its error behavior.

Failures:

badarg - If Port is not an identifier of an open port, or - the registered name of an open port. If the calling - process was previously linked to the closed port, - identified by Port, the exit signal - from the port is guaranteed to be delivered before this - badarg exception occurs. + If Port is not an identifier of an open + port, or the registered name of an open port. If the calling + process was linked to the previously open port identified by + Port, an exit signal due to this link + was received by the process prior to this exception. badarg If process identified by Pid is not an existing @@ -3851,75 +3358,53 @@
- - Performs a synchronous control operation on a port. + Perform a synchronous control operation on a port

Performs a synchronous control operation on a port. - The meaning of Operation and - Data depends on - the port, that is, on the port driver. Not all port drivers + The meaning of Operation and Data depends on + the port, i.e., on the port driver. Not all port drivers support this control feature.

-

Returns a list of integers in the range 0..255, or a +

Returns: a list of integers in the range 0 through 255, or a binary, depending on the port driver. The meaning of the returned data also depends on the port driver.

-

Failures:

- - badarg - - If Port is not an open port or the registered - name of an open port. - - badarg - - If Operation cannot fit in a 32-bit integer. - - badarg - - If the port driver does not support synchronous control - operations. - - badarg - - If the port driver so decides for any reason (probably - something wrong with Operation or - Data). - - +

Failure: badarg if Port is not an open port or + the registered name of an open port, if Operation + cannot fit in a 32-bit integer, if the port driver does not + support synchronous control operations, or if the port driver + so decides for any reason (probably something wrong with + Operation or Data).

- - Performs a synchronous call to a port with term data. + Synchronous call to a port with term data

Performs a synchronous call to a port. The meaning of - Operation and Data - depends on the port, that is, + Operation and Data depends on the port, i.e., on the port driver. Not all port drivers support this feature.

-

Port is a port identifier, - referring to a driver.

+

Port is a port identifier, referring to a driver.

Operation is an integer, which is passed on to the driver.

-

Data is any Erlang term. This data is converted - to binary term format and sent to the port.

-

Returns a term from the driver. The meaning of the returned +

Data is any Erlang term. This data is converted to + binary term format and sent to the port.

+

Returns: a term from the driver. The meaning of the returned data also depends on the port driver.

Failures:

badarg - If Port is not an identifier of an open port, - or the registered name of an open port. If the calling - process was previously linked to the closed port, - identified by Port, the exit signal - from the port is guaranteed to be delivered before this - badarg exception occurs. + If Port is not an identifier of an open + port, or the registered name of an open port. If the calling + process was linked to the previously open port identified by + Port, an exit signal due to this link + was received by the process prior to this exception. badarg - If Operation does not fit in a 32-bit integer. + If Operation does not fit in a + 32-bit integer. badarg @@ -3929,183 +3414,171 @@ badarg If the port driver so decides for any reason (probably - something wrong with Operation - or Data). + something wrong with Operation, or + Data).
- - Information about a port. + Information about a port

Returns a list containing tuples with information about - Port, or undefined if the port is not open. - The order of the tuples is undefined, and all the - tuples are not mandatory. - If the port is closed and the calling process - was previously linked to the port, the exit signal from the - port is guaranteed to be delivered before port_info/1 - returns undefined.

-

The result contains information about the following - Items:

- - registered_name (if the port has a registered - name) - id - connected - links - name - input - output - -

For more information about the different Items, see + the Port, or undefined if the port is not open. + The order of the tuples is not defined, nor are all the + tuples mandatory. + If undefined is returned and the calling process + was linked to a previously open port identified by + Port, an exit signal due to this link + was received by the process prior to the return from + port_info/1.

+

Currently the result will containt information about the + following Items: registered_name (if the port has + a registered name), id, connected, links, + name, input, and output. For more information + about the different Items, see port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the connected process of a port. + Information about the connected process of a port

Pid is the process identifier of the process connected to the port.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the internal index of a port. + Information about the internal index of a port

Index is the internal index of the port. This - index can be used to separate ports.

+ index may be used to separate ports.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the input of a port. + Information about the input of a port

Bytes is the total number of bytes read from the port.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the links of a port. + Information about the links of a port

Pids is a list of the process identifiers of the processes that the port is linked to.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the locking of a port. + Information about the locking of a port -

Locking is one of the following:

- - false (emulator without SMP support) - port_level (port-specific locking) - driver_level (driver-specific locking) - -

Notice that these results are highly implementation-specific - and can change in a future release.

+

Locking is currently either false + (emulator without SMP support), port_level (port specific + locking), or driver_level (driver specific locking). Note + that these results are highly implementation specific and might + change in the future.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the memory size of a port. + Information about the memory size of a port -

Bytes is the total number of - bytes allocated for this port by the runtime system. The - port itself can have allocated memory that is not +

Bytes is the total amount of memory, + in bytes, allocated for this port by the runtime system. Note + that the port itself might have allocated memory which is not included in Bytes.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the monitors of a port. + Information about the monitors of a port

Monitors represent processes that this port - monitors.

+ is monitoring.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the name of a port. + Information about the name of a port

Name is the command name set by open_port/2.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the OS pid of a port. + Information about the OS pid of a port

OsPid is the process identifier (or equivalent) of an OS process created with @@ -4113,464 +3586,432 @@ Command}, Options). If the port is not the result of spawning an OS process, the value is undefined.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the output of a port. + Information about the output of a port

Bytes is the total number of bytes written - to the port from Erlang processes using + to the port from Erlang processes using either port_command/2, port_command/3, - or Port ! {Owner, {command, Data}.

+ or Port ! {Owner, {command, Data}. +

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the parallelism hint of a port. + Information about the parallelism hint of a port

Boolean corresponds to the port parallelism - hint being used by this port. For more information, see option - parallelism - of open_port/2.

+ hint being used by this port. For more information see + the parallelism + option of open_port/2.

- - Information about the queue size of a port. + Information about the queue size of a port -

Bytes is the total number - of bytes queued by the port using the ERTS driver queue +

Bytes is the total amount of data, + in bytes, queued by the port using the ERTS driver queue implementation.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Information about the registered name of a port. + Information about the registered name of a port

RegisteredName is the registered name of the port. If the port has no registered name, [] is returned.

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+ undefined is returned. If undefined is returned and + the calling process was linked to a previously open port identified + by Port, an exit signal due to this link + was received by the process prior to the return from + port_info/2.

Failure: badarg if Port is not a local port identifier, or an atom.

- - Text representation of a port identifier. + Text representation of a port identifier -

Returns a string corresponding to the text +

Returns a string which corresponds to the text representation of the port identifier Port.

-

This BIF is intended for debugging. It is not to be used - in application programs.

+

This BIF is intended for debugging and for use in + the Erlang operating system. It should not be used in + application programs.

- - Lists all existing ports. + All open ports

Returns a list of port identifiers corresponding to all the - ports existing on the local node.

-

Notice that an exiting port exists, but is not open.

+ ports currently existing on the local node.

+ +

Note that a port that is exiting, exists but is not open.

- - Lists all pre-loaded modules. + List of all pre-loaded modules -

Returns a list of Erlang modules that are preloaded in +

Returns a list of Erlang modules which are pre-loaded in the system. As all loading of code is done through the file system, the file system must have been loaded previously. - Hence, at least the module init must be preloaded.

+ Hence, at least the module init must be pre-loaded.

- - Writes information about a local process on standard error. + Write information about a local process on standard error

Writes information about the local process Pid on - standard error. The only allowed value for the atom + standard error. The currently allowed value for the atom Type is backtrace, which shows the contents of the call stack, including information about the call chain, with the current function printed first. The format of the output is not further defined.

- - Sets process flag trap_exit for the calling process. + Set process flag trap_exit for the calling process

When trap_exit is set to true, exit signals - arriving to a process are converted to {'EXIT', From, Reason} - messages, which can be received as ordinary + arriving to a process are converted to {'EXIT', From, Reason} messages, which can be received as ordinary messages. If trap_exit is set to false, the process exits if it receives an exit signal other than normal and the exit signal is propagated to its - linked processes. Application processes are normally - not to trap exits.

+ linked processes. Application processes should normally + not trap exits.

Returns the old value of the flag.

See also exit/2.

- - Sets process flag error_handler for the calling process. + Set process flag error_handler for the calling process -

Used by a process to redefine the error handler +

This is used by a process to redefine the error handler for undefined function calls and undefined registered - processes. Inexperienced users are not to use this flag, - as code auto-loading depends on the correct + processes. Inexperienced users should not use this flag + since code auto-loading is dependent on the correct operation of the error handling module.

Returns the old value of the flag.

- - Sets process flag min_heap_size for the calling process. + Set process flag min_heap_size for the calling process -

Changes the minimum heap size for the calling process.

+

This changes the minimum heap size for the calling + process.

Returns the old value of the flag.

- - Sets process flag min_bin_vheap_size for the calling process. + Set process flag min_bin_vheap_size for the calling process -

Changes the minimum binary virtual heap size for the calling +

This changes the minimum binary virtual heap size for the calling process.

-

Returns the old value of the flag.

-
+

Returns the old value of the flag.

- - Sets process flag priority for the calling process. + Set process flag priority for the calling process

- Sets the process priority. Level is an atom. - There are four priority levels: low, - normal, high, and max. Default - is normal.

- -

Priority level max is reserved for internal use in - the Erlang runtime system, and is not to be used - by others.

-
-

Internally in each priority level, processes are scheduled - in a round robin fashion.

+ This sets the process priority. Level is an atom. + There are currently four priority levels: low, + normal, high, and max. The default + priority level is normal. NOTE: The + max priority level is reserved for internal use in + the Erlang runtime system, and should not be used + by others. +

+

Internally in each priority level processes are scheduled + in a round robin fashion. +

Execution of processes on priority normal and - low are interleaved. Processes on priority - low are selected for execution less - frequently than processes on priority normal.

-

When there are runnable processes on priority high, - no processes on priority low or normal are - selected for execution. Notice however, that this does - not mean that no processes on priority low - or normal can run when there are processes - running on priority high. On the runtime - system with SMP support, more processes can be running - in parallel than processes on priority high, that is, - a low and a high priority process can - execute at the same time.

-

When there are runnable processes on priority max, + priority low will be interleaved. Processes on + priority low will be selected for execution less + frequently than processes on priority normal. +

+

When there are runnable processes on priority high + no processes on priority low, or normal will + be selected for execution. Note, however, that this does + not mean that no processes on priority low, + or normal will be able to run when there are + processes on priority high running. On the runtime + system with SMP support there might be more processes running + in parallel than processes on priority high, i.e., + a low, and a high priority process might + execute at the same time. +

+

When there are runnable processes on priority max no processes on priority low, normal, or - high are selected for execution. As with priority - high, processes on lower priorities can - execute in parallel with processes on priority max.

+ high will be selected for execution. As with the + high priority, processes on lower priorities might + execute in parallel with processes on priority max. +

Scheduling is preemptive. Regardless of priority, a process - is preempted when it has consumed more than a certain number + is preempted when it has consumed more than a certain amount of reductions since the last time it was selected for - execution.

- -

Do not depend on the scheduling + execution. +

+

NOTE: You should not depend on the scheduling to remain exactly as it is today. Scheduling, at least on - the runtime system with SMP support, is likely to be - changed in a future release to use available - processor cores better.

-
-

There is no automatic mechanism for - avoiding priority inversion, such as priority inheritance - or priority ceilings. When using priorities, - take this into account and handle such scenarios by - yourself.

+ the runtime system with SMP support, is very likely to be + modified in the future in order to better utilize available + processor cores. +

+

There is currently no automatic mechanism for + avoiding priority inversion, such as priority inheritance, + or priority ceilings. When using priorities you have + to take this into account and handle such scenarios by + yourself. +

Making calls from a high priority process into code - that you have no control over can cause the high - priority process to wait for a process with lower - priority. That is, effectively decreasing the priority of the + that you don't have control over may cause the high + priority process to wait for a processes with lower + priority, i.e., effectively decreasing the priority of the high priority process during the call. Even if this - is not the case with one version of the code that you have no - control over, it can be the case in a future - version of it. This can, for example, occur if a - high priority process triggers code loading, as - the code server runs on priority normal.

+ isn't the case with one version of the code that you don't + have under your control, it might be the case in a future + version of it. This might, for example, happen if a + high priority process triggers code loading, since + the code server runs on priority normal. +

Other priorities than normal are normally not needed. - When other priorities are used, use them with care, - especially priority high. A - process on priority high is only - to perform work for short periods. Busy looping for - long periods in a high priority process does - most likely cause problems, as important OTP servers - run on priority normal.

+ When other priorities are used, they need to be used + with care, especially the high priority must + be used with care. A process on high priority should + only perform work for short periods of time. Busy looping for + long periods of time in a high priority process will + most likely cause problems, since there are important servers + in OTP running on priority normal. +

Returns the old value of the flag.

- - Sets process flag save_calls for the calling process. + Set process flag save_calls for the calling process

N must be an integer in the interval 0..10000. - If N is greater than 0, call saving is made - active for the - process. This means that information about the N - most recent global function calls, BIF calls, sends, and + If N > 0, call saving is made active for the + process, which means that information about the N + most recent global function calls, BIF calls, sends and receives made by the process are saved in a list, which can be retrieved with process_info(Pid, last_calls). A global function call is one in which the module of the function is explicitly mentioned. Only a fixed amount of information - is saved, as follows:

- - A tuple {Module, Function, Arity} for - function calls - The atoms send, 'receive', and - timeout for sends and receives ('receive' - when a message is received and timeout when a - receive times out) - -

If N = 0, + is saved: a tuple {Module, Function, Arity} for + function calls, and the mere atoms send, + 'receive' and timeout for sends and receives + ('receive' when a message is received and + timeout when a receive times out). If N = 0, call saving is disabled for the process, which is the default. Whenever the size of the call saving list is set, its contents are reset.

Returns the old value of the flag.

- - Sets process flag sensitive for the calling process. + Set process flag sensitive for the calling process -

Sets or clears flag sensitive for the current process. +

Set or clear the sensitive flag for the current process. When a process has been marked as sensitive by calling - process_flag(sensitive, true), features in the runtime - system that can be used for examining the data or inner working + process_flag(sensitive, true), features in the run-time + system that can be used for examining the data and/or inner working of the process are silently disabled.

Features that are disabled include (but are not limited to) the following:

- - Tracing: Trace flags can still be set for the process, - but no trace messages of any kind are generated. (If flag - sensitive is turned off, trace messages are again - generated if any trace flags are set.) - Sequential tracing: The sequential trace token is - propagated as usual, but no sequential trace messages are - generated. - -

process_info/1,2 cannot be used to read out the - message queue or the process dictionary (both are returned - as empty lists).

+

Tracing: Trace flags can still be set for the process, but no + trace messages of any kind will be generated. + (If the sensitive flag is turned off, trace messages will + again be generated if there are any trace flags set.)

+

Sequential tracing: The sequential trace token will be propagated + as usual, but no sequential trace messages will be generated.

+

process_info/1,2 cannot be used to read out the message + queue or the process dictionary (both will be returned as empty lists).

Stack back-traces cannot be displayed for the process.

In crash dumps, the stack, messages, and the process dictionary - are omitted.

+ will be omitted.

If {save_calls,N} has been set for the process, no - function calls are saved to the call saving list. - (The call saving list is not cleared. Furthermore, send, receive, - and timeout events are still added to the list.)

+ function calls will be saved to the call saving list. + (The call saving list will not be cleared; furthermore, send, receive, + and timeout events will still be added to the list.)

Returns the old value of the flag.

- - Sets process flags for a process. + Set process flags for a process -

Sets certain flags for the process Pid, - in the same manner as +

Sets certain flags for the process Pid, in the same + manner as process_flag/2. - Returns the old value of the flag. The valid values for + Returns the old value of the flag. The allowed values for Flag are only a subset of those allowed in - process_flag/2, namely save_calls.

-

Failure: badarg if Pid - is not a local process.

+ process_flag/2, namely: save_calls.

+

Failure: badarg if Pid is not a local process.

- - Information about a process. + Information about a process

Returns a list containing InfoTuples with miscellaneous information about the process identified by - Pid, or undefined if the process is not alive.

-

The order of the InfoTuples is undefined and - all InfoTuples are not mandatory. - The InfoTuples - part of the result can be changed without prior notice.

-

The InfoTuples with the following items - are part of the result:

- - current_function - initial_call - status - message_queue_len - messages - links - dictionary - trap_exit - error_handler - priority - group_leader - total_heap_size - heap_size - stack_size - reductions - garbage_collection - -

If the process identified by Pid has a - registered name, - also an InfoTuple with item registered_name - appears.

-

For information about specific InfoTuples, see - process_info/2.

+ Pid, or undefined if the process is not alive. +

+

+ The order of the InfoTuples is not defined, nor + are all the InfoTuples mandatory. The InfoTuples + part of the result may be changed without prior notice. + Currently InfoTuples with the following items + are part of the result: + current_function, initial_call, status, + message_queue_len, messages, links, + dictionary, trap_exit, error_handler, + priority, group_leader, total_heap_size, + heap_size, stack_size, reductions, and + garbage_collection. + If the process identified by Pid has a registered name + also an InfoTuple with the item registered_name + will appear. +

+

See process_info/2 + for information about specific InfoTuples.

-

This BIF is intended for debugging only. For - all other purposes, use - process_info/2.

+

This BIF is intended for debugging only, use + process_info/2 + for all other purposes. +

-

Failure: badarg if Pid is not a - local process.

+

Failure: badarg if Pid is not a local process.

- - Information about a process. + Information about a process -

Returns information about the process identified by - Pid, as specified by - Item or ItemList. - Returns undefined if the process is not alive.

-

If the process is alive and a single Item - is given, the returned value is the corresponding - InfoTuple, unless Item =:= registered_name - and the process has no registered name. In this case, - [] is returned. This strange behavior is because of - historical reasons, and is kept for backward compatibility.

-

If ItemList is given, the result is - InfoTupleList. - The InfoTuples in - InfoTupleList appear with the corresponding - Items in the same order as the - Items appeared - in ItemList. Valid Items can - appear multiple times in ItemList.

-

If registered_name is part of ItemList +

Returns information about the process identified by Pid + as specified by the Item or the ItemList, or undefined if the + process is not alive. +

+

If the process is alive and a single Item is given, + the returned value is the corresponding + InfoTuple unless Item =:= registered_name + and the process has no registered name. In this case + [] is returned. This strange behavior is due to + historical reasons, and is kept for backward compatibility. +

+

If an ItemList is given, the result is an + InfoTupleList. The InfoTuples in the + InfoTupleList will appear with the corresponding + Items in the same order as the Items appeared + in the ItemList. Valid Items may appear multiple + times in the ItemList. +

+

If registered_name is part of an ItemList and the process has no name registered a - {registered_name, []}, InfoTuple - will appear in the resulting - InfoTupleList. This - behavior is different when a single - Item =:= registered_name is given, and when - process_info/1 is used.

-
-

The following InfoTuples with corresponding + {registered_name, []} InfoTuple will + appear in the resulting InfoTupleList. This + behavior is different than when a single + Item =:= registered_name is given, and than when + process_info/1 is used. +

+

Currently the following InfoTuples with corresponding Items are valid:

{backtrace, Bin} -

Binary Bin contains the same information - as the output from +

The binary Bin contains the same information as + the output from erlang:process_display(Pid, backtrace). Use binary_to_list/1 to obtain the string of characters from the binary.

{binary, BinInfo} -

BinInfo is a list containing miscellaneous - information about binaries currently being referred to by this - process. This InfoTuple can be changed or - removed without prior notice.

+

BinInfo is a list containing miscellaneous information + about binaries currently being referred to by this process. + This InfoTuple may be changed or removed without prior + notice.

{catchlevel, CatchLevel}

CatchLevel is the number of currently active - catches in this process. This InfoTuple can be + catches in this process. This InfoTuple may be changed or removed without prior notice.

- {current_function, {Module, - Function, Arity}} + {current_function, {Module, Function, Arity}} -

Module, Function, - Arity is +

Module, Function, Arity is the current function call of the process.

- {current_location, {Module, - Function, Arity, - Location}} + {current_location, {Module, Function, Arity, Location}} -

Module, Function, - Arity is +

Module, Function, Arity is the current function call of the process. - Location is a list of two-tuples describing the - location in the source code.

+ Location is a list of two-tuples that describes the + location in the source code. +

{current_stacktrace, Stack} -

Returns the current call stack back-trace (stacktrace) +

Return the current call stack back-trace (stacktrace) of the process. The stack has the same format as returned by - erlang:get_stacktrace/0.

+ erlang:get_stacktrace/0. +

{dictionary, Dictionary} -

Dictionary is the process dictionary.

+

Dictionary is the dictionary of the process.

{error_handler, Module} @@ -4579,36 +4020,34 @@ {garbage_collection, GCInfo} -

GCInfo is a list containing miscellaneous +

GCInfo is a list which contains miscellaneous information about garbage collection for this process. - The content of GCInfo can be changed without + The content of GCInfo may be changed without prior notice.

{group_leader, GroupLeader} -

GroupLeader is group leader for the I/O of +

GroupLeader is group leader for the IO of the process.

{heap_size, Size} -

Size is the size in words of the youngest heap - generation of the process. This generation includes - the process stack. This information is highly - implementation-dependent, and can change if the - implementation changes.

+

Size is the size in words of youngest heap generation + of the process. This generation currently include the stack + of the process. This information is highly implementation + dependent, and may change if the implementation change. +

- {initial_call, {Module, Function, - Arity}} + {initial_call, {Module, Function, Arity}} -

Module, Function, - Arity is +

Module, Function, Arity is the initial function call with which the process was spawned.

{links, PidsAndPorts} -

PidsAndPorts is a list of process identifiers - and port identifiers, with processes or ports to which the process +

PidsAndPorts is a list of pids and + port identifiers, with processes or ports to which the process has a link.

{last_calls, false|Calls} @@ -4622,14 +4061,14 @@ {memory, Size}

Size is the size in bytes of the process. This - includes call stack, heap, and internal structures.

+ includes call stack, heap and internal structures.

{message_queue_len, MessageQueueLen}

MessageQueueLen is the number of messages currently in the message queue of the process. This is the length of the list MessageQueue returned as - the information item messages (see the following).

+ the info item messages (see below).

{messages, MessageQueue} @@ -4638,35 +4077,31 @@ {min_heap_size, MinHeapSize} -

MinHeapSize is the minimum heap size - for the process.

+

MinHeapSize is the minimum heap size for the process.

{min_bin_vheap_size, MinBinVHeapSize} -

MinBinVHeapSize is the minimum binary virtual - heap size for the process.

+

MinBinVHeapSize is the minimum binary virtual heap size for the process.

{monitored_by, Pids} -

A list of process identifiers monitoring the process (with +

A list of pids that are monitoring the process (with monitor/2).

{monitors, Monitors}

A list of monitors (started by monitor/2) that are active for the process. For a local process - monitor or a remote process monitor by a process - identifier, the list item is {process, Pid}. - For a remote process + monitor or a remote process monitor by pid, the list item + is {process, Pid}, and for a remote process monitor by name, the list item is {process, {RegName, Node}}.

- {priority, Level} + {priority, Level}

Level is the current priority level for - the process. For more information on priorities, see - process_flag(priority, - Level).

+ the process. For more information on priorities see + process_flag(priority, Level).

{reductions, Number} @@ -4681,346 +4116,240 @@ {sequential_trace_token, [] | SequentialTraceToken} -

SequentialTraceToken is the sequential trace - token for the process. This InfoTuple can be - changed or removed without prior notice.

+

SequentialTraceToken the sequential trace token for + the process. This InfoTuple may be changed or removed + without prior notice.

{stack_size, Size} -

Size is the stack size, in words, - of the process.

+

Size is the stack size of the process in words.

{status, Status} -

Status is the status of the process and is one - of the following:

- - exiting - garbage_collecting - waiting (for a message) - running - runnable (ready to run, but another process is - running) - suspended (suspended on a "busy" port - or by the BIF erlang:suspend_process/[1,2]) - +

Status is the status of the process. Status + is exiting, garbage_collecting, + waiting (for a message), running, + runnable (ready to run, but another process is + running), or suspended (suspended on a "busy" port + or by the erlang:suspend_process/[1,2] BIF).

{suspending, SuspendeeList} -

SuspendeeList is a list of - {Suspendee, ActiveSuspendCount, - OutstandingSuspendCount} tuples. - Suspendee is the process identifier of a - process that has been, or is to be, - suspended by the process identified by Pid - through one of the following BIFs:

- - - erlang:suspend_process/2 - - - erlang:suspend_process/1 - - -

ActiveSuspendCount is the number of - times Suspendee has been suspended by - Pid. +

SuspendeeList is a list of {Suspendee, + ActiveSuspendCount, OutstandingSuspendCount} tuples. + Suspendee is the pid of a process that have been or is to + be suspended by the process identified by Pid via the + erlang:suspend_process/2 + BIF, or the + erlang:suspend_process/1 + BIF. ActiveSuspendCount is the number of times the + Suspendee has been suspended by Pid. OutstandingSuspendCount is the number of not yet - completed suspend requests sent by Pid, that is:

- - If ActiveSuspendCount =/= 0, - Suspendee is - currently in the suspended state. - - If OutstandingSuspendCount =/= 0, option - asynchronous of erlang:suspend_process/2 - has been used and the suspendee has not yet been - suspended by Pid. - - -

Notice that ActiveSuspendCount and - OutstandingSuspendCount are not the - total suspend count on Suspendee, - only the parts contributed by Pid.

+ completed suspend requests sent by Pid. That is, + if ActiveSuspendCount =/= 0, Suspendee is + currently in the suspended state, and if + OutstandingSuspendCount =/= 0 the asynchronous + option of erlang:suspend_process/2 has been used and + the suspendee has not yet been suspended by Pid. + Note that the ActiveSuspendCount and + OutstandingSuspendCount are not the total suspend count + on Suspendee, only the parts contributed by Pid. +

{total_heap_size, Size} -

Size is the total size, in words, of all heap - fragments of the process. This includes the process stack.

+

Size is the total size in words of all heap + fragments of the process. This currently include the stack + of the process. +

{trace, InternalTraceFlags} -

InternalTraceFlags is an integer - representing the internal trace flag for this process. - This InfoTuple - can be changed or removed without prior notice.

+

InternalTraceFlags is an integer representing + internal trace flag for this process. This InfoTuple + may be changed or removed without prior notice.

{trap_exit, Boolean} -

Boolean is true if the process - is trapping exits, otherwise false.

+

Boolean is true if the process is trapping + exits, otherwise it is false.

-

Notice that not all implementations support all - these Items.

-

Failures:

- - badarg - If Pid is not a local process. - badarg - If Item is an invalid item. - +

Note however, that not all implementations support every one + of the above Items.

+

Failure: badarg if Pid is not a local process, + or if Item is not a valid Item.

- - All processes. + All processes

Returns a list of process identifiers corresponding to - all the processes currently existing on the local node.

-

Notice that an exiting process exists, but is not alive. - That is, is_process_alive/1 returns false - for an exiting process, but its process identifier is part - of the result returned from processes/0.

-

Example:

+ all the processes currently existing on the local node. +

+

Note that a process that is exiting, exists but is not alive, i.e., + is_process_alive/1 will return false for a process + that is exiting, but its process identifier will be part + of the result returned from processes/0. +

 > processes().
 [<0.0.0>,<0.2.0>,<0.4.0>,<0.5.0>,<0.7.0>,<0.8.0>]
- - Removes old code for a module. + Remove old code for a module -

Removes old code for Module. - Before this BIF is used, - erlang:check_process_code/2 is to be called to check - that no processes execute old code in the module.

+

Removes old code for Module. Before this BIF is used, + erlang:check_process_code/2 should be called to check + that no processes are executing old code in the module.

This BIF is intended for the code server (see - code(3)) - and is not to be used elsewhere.

+ code(3)) and should not be + used elsewhere.

Failure: badarg if there is no old code for Module.

- - Adds a new value to the process dictionary. + Add a new value to the process dictionary -

Adds a new Key to the process dictionary, - associated with the value Val, and returns - undefined. If Key exists, the old - value is deleted and replaced by Val, and - the function returns the old value.

-

Example:

+

Adds a new Key to the process dictionary, associated + with the value Val, and returns undefined. If + Key already exists, the old value is deleted and + replaced by Val and the function returns the old value.

+ +

The values stored when put is evaluated within + the scope of a catch will not be retracted if a + throw is evaluated, or if an error occurs.

+
 > X = put(name, walrus), Y = put(name, carpenter),
 Z = get(name),
 {X, Y, Z}.
 {undefined,walrus,carpenter}
- -

The values stored when put is evaluated within - the scope of a catch are not retracted if a - throw is evaluated, or if an error occurs.

-
- - Stops execution with an exception of given class, reason, and call stack backtrace. + Stop execution with an exception of given class, reason and call stack backtrace

Stops the execution of the calling process with an - exception of given class, reason, and call stack backtrace + exception of given class, reason and call stack backtrace (stacktrace).

-

This BIF is intended for debugging. Avoid to use it in applications, - unless you really know what you are doing.

+

This BIF is intended for debugging and for use in + the Erlang operating system. In general, it should + be avoided in applications, unless you know + very well what you are doing.

-

Class is error, exit, or - throw. So, if it were not for the stacktrace, - erlang:raise(Class, Reason, - Stacktrace) is - equivalent to erlang:Class(Reason).

-

Reason is any term. - Stacktrace is a list as - returned from get_stacktrace(), that is, a list of - four-tuples {Module, Function, Arity | Args, - Location}, where Module and Function - are atoms, and the third element is an integer arity or an - argument list. The stacktrace can also contain {Fun, - Args, Location} tuples, where Fun is a local - fun and Args is an argument list.

-

Element Location at the end is optional. +

Class is one of error, exit or + throw, so if it were not for the stacktrace + erlang:raise(Class, Reason, Stacktrace) is + equivalent to erlang:Class(Reason). + Reason is any term and Stacktrace is a list as + returned from get_stacktrace(), that is a list of + 4-tuples {Module, Function, Arity | Args, + Location} where Module and Function + are atoms and the third element is an integer arity or an + argument list. The stacktrace may also contain {Fun, + Args, Location} tuples where + Fun is a local fun and Args is an argument list.

+

The Location element at the end is optional. Omitting it is equivalent to specifying an empty list.

The stacktrace is used as the exception stacktrace for the - calling process; it is truncated to the current + calling process; it will be truncated to the current maximum stacktrace depth.

-

Since evaluating this function causes the process to - terminate, it has no return value unless the arguments are - invalid, in which case the function returns the error - reason badarg. If you want to be - sure not to return, you can call - error(erlang:raise(Class, Reason, - Stacktrace)) +

Because evaluating this function causes the process to + terminate, it has no return value - unless the arguments are + invalid, in which case the function returns the error reason, that is badarg. If you want to be + really sure not to return you can call + error(erlang:raise(Class, Reason, Stacktrace)) and hope to distinguish exceptions later.

- - - Reads the state of a timer. + + Number of milliseconds remaining for a timer -

- Read the state of a timer that has been created by either - erlang:start_timer(), - or erlang:send_after(). - TimerRef identifies the timer, and - was returned by the BIF that created the timer. -

-

Available Options:

- - {async, Async} - -

- Asynchronous request for state information. Async - defaults to false which will cause the operation - to be performed synchronously. In this case, the Result - is returned by erlang:read_timer(). When - Async is true, erlang:read_timer() - sends an asynchronous request for the state information - to the timer service that manages the timer, and then returns - ok. A message on the format {read_timer, - TimerRef, Result} is - sent to the caller of erlang:read_timer() when the - operation has been processed. -

-
-
-

- More Options may be added in the future. -

-

- If Result is an integer, it represents the - time in milli-seconds left until the timer expires.

-

- If Result is false, a - timer corresponding to TimerRef could not - be found. This can be because the timer had expired, - it had been canceled, or because TimerRef - never has corresponded to a timer. Even if the timer has expired, - it does not tell you whether or not the timeout message has - arrived at its destination yet. -

- -

- The timer service that manages the timer may be co-located - with another scheduler than the scheduler that the calling - process is executing on. If this is the case, communication - with the timer service takes much longer time than if it - is located locally. If the calling process is in critical - path, and can do other things while waiting for the result - of this operation, you want to use option {async, true}. - If using option {async, false}, the calling - process will be blocked until the operation has been - performed. -

-
+

TimerRef is a timer reference returned by + erlang:send_after/3 + or + erlang:start_timer/3. + If the timer is active, the function returns the time in + milliseconds left until the timer will expire, otherwise + false (which means that TimerRef was never a + timer, that it has been cancelled, or that it has already + delivered its message).

See also - erlang:send_after/4, - erlang:start_timer/4, + erlang:send_after/3, + erlang:start_timer/3, and - erlang:cancel_timer/2.

+ erlang:cancel_timer/1.

- - Reads the state of a timer. - -

Read the state of a timer. The same as calling - erlang:read_timer(TimerRef, - []).

-
-
- - - Text representation of a reference. + Text representation of a reference -

Returns a string corresponding to the text +

Returns a string which corresponds to the text representation of Ref.

-

This BIF is intended for debugging and is not to be used - in application programs.

+

This BIF is intended for debugging and for use in + the Erlang operating system. It should not be used in + application programs.

- - Registers a name for a pid (or port). + Register a name for a pid (or port) -

Associates the name RegName with a process - identifier (pid) or a port identifier. - RegName, which must be an atom, can be used - instead of the pid or port identifier in send operator +

Associates the name RegName with a pid or a port + identifier. RegName, which must be an atom, can be used + instead of the pid / port identifier in the send operator (RegName ! Message).

-

Example:

 > register(db, Pid).
 true
-

Failures:

- - badarg - If PidOrPort is not an existing local - process or port. - badarg - If RegName is already in use. - badarg - If the process or port is already registered - (already has a name). - badarg - If RegName is the atom - undefined. - +

Failure: badarg if PidOrPort is not an existing, + local process or port, if RegName is already in use, + if the process or port is already registered (already has a + name), or if RegName is the atom undefined.

- - All registered names. + All registered names -

Returns a list of names that have been registered using - register/2, for - example:

+

Returns a list of names which have been registered using + register/2.

 > registered().
 [code_server, file_server, init, user, my_db]
- - Resumes a suspended process. + Resume a suspended process

Decreases the suspend count on the process identified by - Suspendee. Suspendee - is previously to have been suspended through - erlang:suspend_process/2 + Suspendee. Suspendee should previously have been + suspended via + erlang:suspend_process/2, or erlang:suspend_process/1 - by the process calling - erlang:resume_process(Suspendee). When the - suspend count on Suspendee reaches zero, - Suspendee is resumed, that is, its state - is changed from suspended into the state it had before it was - suspended.

+ by the process calling erlang:resume_process(Suspendee). When + the suspend count on Suspendee reach zero, Suspendee + will be resumed, i.e., the state of the Suspendee is changed + from suspended into the state Suspendee was in before it was + suspended. +

This BIF is intended for debugging only.

@@ -5028,7 +4357,7 @@ badarg - If Suspendee is not a process identifier. + If Suspendee isn't a process identifier. badarg @@ -5038,65 +4367,58 @@ badarg - If the process identified by Suspendee - is not alive. + If the process identified by Suspendee is not alive.
- - Returns an integer by rounding a number. + Return an integer by rounding a number -

Returns an integer by rounding Number, - for example:

+

Returns an integer by rounding Number.

-round(5.5).
+> round(5.5).
 6

Allowed in guard tests.

- - Returns pid of the calling process. + Pid of the calling process -

Returns the process identifier of the calling process, for - example:

+

Returns the pid (process identifier) of the calling process.

 > self().
 <0.26.0>

Allowed in guard tests.

- - Sends a message. + Send a message -

Sends a message and returns Msg. This - is the same as Dest ! Msg.

-

Dest can be a remote or local process identifier, - a (local) port, a locally registered name, or a tuple - {RegName, Node} +

Sends a message and returns Msg. This is the same as + Dest ! Msg.

+

Dest may be a remote or local pid, a (local) port, a + locally registered name, or a tuple {RegName, Node} for a registered name at another node.

- - Sends a message conditionally. + Send a message conditionally -

Either sends a message and returns ok, or does not send - the message but returns something else (see the following). - Otherwise the same as - erlang:send/2. - For more detailed explanation and warnings, see - erlang:send_nosuspend/2,3.

-

The options are as follows:

+

Sends a message and returns ok, or does not send + the message but returns something else (see below). Otherwise + the same as + erlang:send/2. See + also + erlang:send_nosuspend/2,3. + for more detailed explanation and warnings.

+

The possible options are:

nosuspend @@ -5106,366 +4428,319 @@ noconnect

If the destination node would have to be auto-connected - to do the send, noconnect is returned + before doing the send, noconnect is returned instead.

-

As with erlang:send_nosuspend/2,3: use with extreme - care.

+

As with erlang:send_nosuspend/2,3: Use with extreme + care!

- - - - Start a timer - -

- Starts a timer. When the timer expires, the message - Msg is sent to the process - identified by Dest. Apart from - the format of the timeout message, - erlang:send_after/4 works exactly as - erlang:start_timer/4.

-
-
- Starts a timer. + 0 <= Time <= 4294967295 + Start a timer -

Starts a timer. The same as calling - erlang:send_after(Time, - Dest, Msg, []).

+

Starts a timer which will send the message Msg + to Dest after Time milliseconds.

+

If Dest is a pid() it has to be a pid() of a local process, dead or alive.

+

The Time value can, in the current implementation, not be greater than 4294967295.

+

If Dest is an atom(), it is supposed to be the name of + a registered process. The process referred to by the name is + looked up at the time of delivery. No error is given if + the name does not refer to a process.

+ +

If Dest is a pid(), the timer will be automatically + canceled if the process referred to by the pid() is not alive, + or when the process exits. This feature was introduced in + erts version 5.4.11. Note that timers will not be + automatically canceled when Dest is an atom.

+

See also + erlang:start_timer/3, + erlang:cancel_timer/1, + and + erlang:read_timer/1.

+

Failure: badarg if the arguments does not satisfy + the requirements specified above.

- - Tries to send a message without ever blocking. + Try to send a message without ever blocking

The same as - erlang:send(Dest, - Msg, [nosuspend]), - but returns true if + erlang:send(Dest, Msg, [nosuspend]), but returns true if the message was sent and false if the message was not sent because the sender would have had to be suspended.

-

This function is intended for send operations to an +

This function is intended for send operations towards an unreliable remote node without ever blocking the sending (Erlang) process. If the connection to the remote node (usually not a real Erlang node, but a node written in C or - Java) is overloaded, this function does not send the message - and returns false.

-

The same occurs if Dest refers to a local port - that is busy. For all other destinations (allowed for the ordinary - send operator '!'), this function sends the message and + Java) is overloaded, this function will not send the message but return false instead.

+

The same happens, if Dest refers to a local port that + is busy. For all other destinations (allowed for the ordinary + send operator '!') this function sends the message and returns true.

-

This function is only to be used in rare circumstances +

This function is only to be used in very rare circumstances where a process communicates with Erlang nodes that can - disappear without any trace, causing the TCP buffers and - the drivers queue to be over-full before the node is - shut down (because of tick time-outs) by net_kernel. - The normal reaction to take when this occurs is some kind of + disappear without any trace causing the TCP buffers and + the drivers queue to be over-full before the node will actually + be shut down (due to tick timeouts) by net_kernel. The + normal reaction to take when this happens is some kind of premature shutdown of the other node.

-

Notice that ignoring the return value from this function would - result in an unreliable message passing, which is +

Note that ignoring the return value from this function would + result in unreliable message passing, which is contradictory to the Erlang programming model. The message is not sent if this function returns false.

-

In many systems, transient states of +

Note also that in many systems, transient states of overloaded queues are normal. The fact that this function - returns false does not mean that the other + returns false does not in any way mean that the other node is guaranteed to be non-responsive, it could be a - temporary overload. Also, a return value of true does - only mean that the message can be sent on the (TCP) channel - without blocking, the message is not guaranteed to - arrive at the remote node. For a disconnected + temporary overload. Also a return value of true does + only mean that the message could be sent on the (TCP) channel + without blocking, the message is not guaranteed to have + arrived at the remote node. Also in the case of a disconnected non-responsive node, the return value is true (mimics - the behavior of operator !). The expected - behavior and the actions to take when the function - returns false are application- and hardware-specific.

+ the behaviour of the ! operator). The expected + behaviour as well as the actions to take when the function + returns false are application and hardware specific.

-

Use with extreme care.

+

Use with extreme care!

- - Tries to send a message without ever blocking. + Try to send a message without ever blocking

The same as - erlang:send(Dest, - Msg, [nosuspend | Options]), - but with a Boolean return value.

+ erlang:send(Dest, Msg, [nosuspend | Options]), + but with boolean return value.

This function behaves like - erlang:send_nosuspend/2, - but takes a third parameter, a list of options. - The only option is noconnect, which - makes the function return false if + erlang:send_nosuspend/2), + but takes a third parameter, a list of options. The only + currently implemented option is noconnect. The option + noconnect makes the function return false if the remote node is not currently reachable by the local - node. The normal behavior is to try to connect to the node, - which can stall the process during a short period. The use of - option noconnect makes it possible to be - sure not to get the slightest delay when + node. The normal behaviour is to try to connect to the node, + which may stall the process for a shorter period. The use of + the noconnect option makes it possible to be + absolutely sure not to get even the slightest delay when sending to a remote process. This is especially useful when - communicating with nodes that expect to always be - the connecting part (that is, nodes written in C or Java).

+ communicating with nodes who expect to always be + the connecting part (i.e. nodes written in C or Java).

Whenever the function returns false (either when a suspend would occur or when noconnect was specified and the node was not already connected), the message is guaranteed not to have been sent.

-

Use with extreme care.

+

Use with extreme care!

- - Sets the magic cookie of a node. + Set the magic cookie of a node

Sets the magic cookie of Node to the atom - Cookie. If Node is the - local node, the function + Cookie. If Node is the local node, the function also sets the cookie of all other unknown nodes to - Cookie (see Section - Distributed Erlang - in the Erlang Reference Manual in System Documentation).

+ Cookie (see + Distributed Erlang in the Erlang Reference Manual).

Failure: function_clause if the local node is not alive.

- - Sets the Nth element of a tuple. - 1..tuple_size(Tuple1 + 1..tuple_size(Tuple1) + Set Nth element of a tuple -

Returns a tuple that is a copy of argument - Tuple1 - with the element given by integer argument - Index +

Returns a tuple which is a copy of the argument Tuple1 + with the element given by the integer argument Index (the first element is the element with index 1) replaced by - argument Value, for example:

+ the argument Value.

 > setelement(2, {10, green, bottles}, red).
 {10,red,bottles}
- - Size of a tuple or binary. + Size of a tuple or binary -

Returns the number of elements in a tuple or the number of - bytes in a binary or bitstring, for example:

+

Returns an integer which is the size of the argument + Item, which must be either a tuple or a binary.

 > size({morni, mulle, bwange}).
-3
-> size(<<11, 22, 33>>).
-3
-
-

For bitstrings the number of whole bytes is returned. That is, if the number of bits - in the bitstring is not divisible by 8, the resulting - number of bytes is rounded down.

+3

Allowed in guard tests.

-

See also - tuple_size/1, - byte_size/1 - and - bit_size/1.

- - Creates a new process with a fun as entry point. + Create a new process with a fun as entry point -

Returns the process identifier of a new process started by the - application of Fun to the empty list - []. Otherwise - works like spawn/3.

+

Returns the pid of a new process started by the application + of Fun to the empty list []. Otherwise works + like spawn/3.

- - Creates a new process with a fun as entry point on a given node. + Create a new process with a fun as entry point on a given node -

Returns the process identifier of a new process started - by the application of Fun to the - empty list [] on Node. If - Node does not exist, a useless pid is - returned. Otherwise works like +

Returns the pid of a new process started by the application + of Fun to the empty list [] on Node. If + Node does not exist, a useless pid is returned. + Otherwise works like spawn/3.

- - Creates a new process with a function as entry point. + Create a new process with a function as entry point -

Returns the process identifier of a new process started by - the application of Module:Function - to Args.

-

error_handler:undefined_function(Module, - Function, Args) - is evaluated by the new process if - Module:Function/Arity - does not exist (where Arity is the length of - Args). The error handler +

Returns the pid of a new process started by the application + of Module:Function to Args. The new process + created will be placed in the system scheduler queue and be + run some time later.

+

error_handler:undefined_function(Module, Function, Args) is evaluated by the new process if + Module:Function/Arity does not exist (where + Arity is the length of Args). The error handler can be redefined (see process_flag/2). If error_handler is undefined, or the user has - redefined the default error_handler and its replacement is - undefined, a failure with reason undef occurs.

-

Example:

+ redefined the default error_handler its replacement is + undefined, a failure with the reason undef will occur.

 > spawn(speed, regulator, [high_speed, thin_cut]).
 <0.13.1>
- - Creates a new process with a function as entry point on a given node. + Create a new process with a function as entry point on a given node -

Returns the process identifier (pid) of a new process started - by the application - of Module:Function - to Args on Node. If - Node does not exist, a useless pid is returned. +

Returns the pid of a new process started by the application + of Module:Function to Args on Node. If + Node does not exists, a useless pid is returned. Otherwise works like spawn/3.

- - Creates and links to a new process with a fun as entry point. + Create and link to a new process with a fun as entry point -

Returns the process identifier of a new process started by - the application of Fun to the empty list - []. A link is created between +

Returns the pid of a new process started by the application + of Fun to the empty list []. A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

- - Creates and links to a new process with a fun as entry point on a specified node. + Create and link to a new process with a fun as entry point on a specified node -

Returns the process identifier (pid) of a new process started - by the application of Fun to the empty - list [] on Node. A link is +

Returns the pid of a new process started by the application + of Fun to the empty list [] on Node. A link is created between the calling process and the new process, - atomically. If Node does not exist, - a useless pid is returned and an exit signal with - reason noconnection is sent to the calling - process. Otherwise works like spawn/3.

+ atomically. If Node does not exist, a useless pid is + returned (and due to the link, an exit signal with exit + reason noconnection will be received). Otherwise works + like spawn/3.

- - Creates and links to a new process with a function as entry point. + Create and link to a new process with a function as entry point -

Returns the process identifier of a new process started by - the application of Module:Function - to Args. A link is created +

Returns the pid of a new process started by the application + of Module:Function to Args. A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

- - Creates and links to a new process with a function as entry point on a given node. + Create and link to a new process with a function as entry point on a given node -

Returns the process identifier (pid) of a new process - started by the application - of Module:Function - to Args on Node. A +

Returns the pid of a new process started by the application + of Module:Function to Args on Node. A link is created between the calling process and the new - process, atomically. If Node does - not exist, a useless pid is returned and an exit signal with - reason noconnection is sent to the calling - process. Otherwise works like spawn/3.

+ process, atomically. If Node does not exist, a useless + pid is returned (and due to the link, an exit signal with exit + reason noconnection will be received). Otherwise works + like spawn/3.

- - Creates and monitors a new process with a fun as entry point. + Create and monitor a new process with a fun as entry point -

Returns the process identifier of a new process, started by - the application of Fun to the empty list - [], - and a reference for a monitor created to the new process. +

Returns the pid of a new process started by the application + of Fun to the empty list [] and reference for a monitor + created to the new process. Otherwise works like spawn/3.

- - Creates and monitors a new process with a function as entry point. + Create and monitor a new process with a function as entry point

A new process is started by the application - of Module:Function - to Args. The process is - monitored at the same time. Returns the process identifier - and a reference for the monitor. Otherwise works like + of Module:Function to Args, and the process is + monitored at the same time. Returns the pid and a reference + for the monitor. + Otherwise works like spawn/3.

- - Creates a new process with a fun as entry point. - + + Create a new process with a fun as entry point -

Returns the process identifier (pid) of a new process - started by the application of Fun - to the empty list []. Otherwise works like +

Returns the pid of a new process started by the application + of Fun to the empty list []. Otherwise + works like spawn_opt/4.

-

If option monitor is given, the newly created - process is monitored, and both the pid and reference for - the monitor is returned.

+

If the option monitor is given, the newly created + process will be monitored and both the pid and reference for + the monitor will be returned.

- - Creates a new process with a fun as entry point on a given node. - + + Create a new process with a fun as entry point on a given node -

Returns the process identifier (pid) of a new process started - by the application of Fun to the - empty list [] on Node. If - Node does not exist, a useless pid is - returned. Otherwise works like +

Returns the pid of a new process started by the application + of Fun to the empty list [] on Node. If + Node does not exist, a useless pid is returned. + Otherwise works like spawn_opt/4.

- - Creates a new process with a function as entry point. - + + Create a new process with a function as entry point -

Works as +

Works exactly like spawn/3, except that an extra option list is given when creating the process.

-

If option monitor is given, the newly created - process is monitored, and both the pid and reference for - the monitor is returned.

-

The options are as follows:

+

If the option monitor is given, the newly created + process will be monitored and both the pid and reference for + the monitor will be returned.

link @@ -5474,123 +4749,112 @@ monitor -

Monitors the new process (like +

Monitor the new process (just like monitor/2 does).

- {priority, Level + {priority, Level}

Sets the priority of the new process. Equivalent to executing - process_flag(priority, - Level) - in the start function of the new process, - except that the priority is set before the process is - selected for execution for the first time. For more - information on priorities, see - process_flag(priority, - Level).

+ process_flag(priority, Level) in the start function of the new process, + except that the priority will be set before the process is + selected for execution for the first time. For more information + on priorities see + process_flag(priority, Level).

{fullsweep_after, Number} -

Useful only for performance tuning. Do not use this - option unless you - know that there is problem with execution times or - memory consumption, and ensure - that the option improves matters.

+

This option is only useful for performance tuning. + In general, you should not use this option unless you + know that there is problem with execution times and/or + memory consumption, and you should measure to make sure + that the option improved matters. +

The Erlang runtime system uses a generational garbage collection scheme, using an "old heap" for data that has survived at least one garbage collection. When there is no more room on the old heap, a fullsweep garbage - collection is done.

-

Option fullsweep_after makes it possible to + collection will be done.

+

The fullsweep_after option makes it possible to specify the maximum number of generational collections - before forcing a fullsweep, even if there is room on - the old heap. Setting the number to zero - disables the general collection algorithm, that is, + before forcing a fullsweep even if there is still room on + the old heap. Setting the number to zero effectively + disables the general collection algorithm, meaning that all live data is copied at every garbage collection.

-

A few cases when it can be useful to change - fullsweep_after:

- - If binaries that are no longer used are to be - thrown away as soon as possible. (Set - Number to zero.) - - A process that mostly have short-lived data is - fullsweeped seldom or never, that is, the old heap - contains mostly garbage. To ensure a fullsweep - occasionally, set Number to a - suitable value, such as 10 or 20. - - In embedded systems with a limited amount of RAM - and no virtual memory, you might want to preserve memory - by setting Number to zero. - (The value can be set globally, see - erlang:system_flag/2.) - - +

Here are a few cases when it could be useful to change + fullsweep_after. Firstly, if binaries that are no + longer used should be thrown away as soon as possible. + (Set Number to zero.) Secondly, a process that + mostly have short-lived data will be fullsweeped seldom + or never, meaning that the old heap will contain mostly + garbage. To ensure a fullsweep once in a while, set + Number to a suitable value such as 10 or 20. + Thirdly, in embedded systems with limited amount of RAM + and no virtual memory, one might want to preserve memory + by setting Number to zero. (The value may be set + globally, see + erlang:system_flag/2.)

{min_heap_size, Size} -

Useful only for performance tuning. Do not use this - option unless you know that there is problem with - execution times or memory consumption, and - ensure that the option improves matters.

-

Gives a minimum heap size, in words. Setting this value - higher than the system default can speed up some +

This option is only useful for performance tuning. + In general, you should not use this option unless you + know that there is problem with execution times and/or + memory consumption, and you should measure to make sure + that the option improved matters. +

+

Gives a minimum heap size in words. Setting this value + higher than the system default might speed up some processes because less garbage collection is done. - However, setting a too high value can waste memory and - slow down the system because of worse data locality. - Therefore, use this option only for + Setting too high value, however, might waste memory and + slow down the system due to worse data locality. + Therefore, it is recommended to use this option only for fine-tuning an application and to measure the execution time with various Size values.

{min_bin_vheap_size, VSize} -

Useful only for performance tuning. Do not use this - option unless you know that there is problem with - execution times or memory consumption, and - ensure that the option improves matters.

-

Gives a minimum binary virtual heap size, in words. - Setting this value - higher than the system default can speed up some +

This option is only useful for performance tuning. + In general, you should not use this option unless you + know that there is problem with execution times and/or + memory consumption, and you should measure to make sure + that the option improved matters. +

+

Gives a minimum binary virtual heap size in words. Setting this value + higher than the system default might speed up some processes because less garbage collection is done. - However, setting a too high value can waste memory. - Therefore, use this option only for + Setting too high value, however, might waste memory. + Therefore, it is recommended to use this option only for fine-tuning an application and to measure the execution time with various VSize values.

+
- - Creates a new process with a function as entry point on a given node. - + + Create a new process with a function as entry point on a given node -

Returns the process identifier (pid) of a new process started - by the application - of Module:Function to - Args on Node. If +

Returns the pid of a new process started by the application + of Module:Function to Args on Node. If Node does not exist, a useless pid is returned. Otherwise works like spawn_opt/4.

-

Option monitor is not supported by +

The monitor option is currently not supported by spawn_opt/5.

- - Splits a binary into two. 0..byte_size(Bin) + Split a binary into two -

Returns a tuple containing the binaries that are the result - of splitting Bin into two parts at - position Pos. +

Returns a tuple containing the binaries which are the result + of splitting Bin into two parts at position Pos. This is not a destructive operation. After the operation, - there are three binaries altogether.

-

Example:

+ there will be three binaries altogether.

 > B = list_to_binary("0123456789").
 <<"0123456789">>
@@ -5604,219 +4868,156 @@
 7
- - - Starts a timer. + + 0 <= Time <= 4294967295 + Start a timer -

- Starts a timer. When the timer expires, the message - {timeout, TimerRef, Msg} - is sent to the process identified by - Dest. -

-

Available Options:

- - {abs, false} - -

- This is the default. It means the - Time value is interpreted - as a time in milli-seconds relative current - Erlang - monotonic time. -

-
- {abs, true} - -

- Absolute Time value. The - Time value is interpreted as an - absolute Erlang monotonic time in milli-seconds. -

-
-
-

- More Options may be added in the future. -

-

- The absolute point in time, the timer is set to expire on, - has to be in the interval - [erlang:system_info(start_time), - erlang:system_info(end_time)]. - Further, if a relative time is specified, the Time value - is not allowed to be negative. -

-

- If Dest is a pid(), it must - be a pid() of a process created on the current - runtime system instance. This process may or may not - have terminated. If Dest is an - atom(), it is interpreted as the name of a - locally registered process. The process referred to by the - name is looked up at the time of timer expiration. No error - is given if the name does not refer to a process. -

-

- If Dest is a pid(), the timer is - automatically canceled if the process referred to by the - pid() is not alive, or if the process exits. This - feature was introduced in ERTS version 5.4.11. Notice that - timers are not automatically canceled when - Dest is an atom(). -

+

Starts a timer which will send the message + {timeout, TimerRef, Msg} to Dest + after Time milliseconds.

+

If Dest is a pid() it has to be a pid() of a local process, dead or alive.

+

The Time value can, in the current implementation, not be greater than 4294967295.

+

If Dest is an atom(), it is supposed to be the name of + a registered process. The process referred to by the name is + looked up at the time of delivery. No error is given if + the name does not refer to a process.

+

If Dest is a pid(), the timer will be automatically + canceled if the process referred to by the pid() is not alive, + or when the process exits. This feature was introduced in + erts version 5.4.11. Note that timers will not be + automatically canceled when Dest is an atom().

See also - erlang:send_after/4, - erlang:cancel_timer/2, + erlang:send_after/3, + erlang:cancel_timer/1, and - erlang:read_timer/2.

-

Failure: badarg if the arguments do not satisfy - the requirements specified here.

-
-
- - - - Starts a timer. - -

Starts a timer. The same as calling - erlang:start_timer(Time, - Dest, Msg, []).

+ erlang:read_timer/1.

+

Failure: badarg if the arguments does not satisfy + the requirements specified above.

- Information about context switches. + Information about context switches -

Returns the total number of context switches since the - system started.

+

ContextSwitches is the total number of context + switches since the system started.

- - Information about exact reductions. + Information about exact reductions -

Returns the number of exact reductions.

-

statistics(exact_reductions) is - a more expensive operation than - statistics(reductions), - especially on an Erlang machine with SMP support.

-
+

statistics(exact_reductions) is + a more expensive operation than + statistics(reductions) + especially on an Erlang machine with SMP support.

+
- - Information about garbage collection. + Information about garbage collection -

Returns information about garbage collection, for example:

+

This information may not be valid for all implementations.

 > statistics(garbage_collection).
-{85,23961,0}
-

This information can be invalid for some implementations.

+{85,23961,0} +
- - Information about I/O. + Information about io -

Returns Input, - which is the total number of bytes - received through ports, and Output, - which is the total number of bytes output to ports.

+

Input is the total number of bytes received + through ports, and Output is the total number of + bytes output to ports.

- - Information about reductions. + Information about reductions -

Returns information about reductions, for example:

+ +

Since erts-5.5 (OTP release R11B) + this value does not include reductions performed in current + time slices of currently scheduled processes. If an + exact value is wanted, use + statistics(exact_reductions).

+
 > statistics(reductions).
-{2046,11}
-

As from ERTS 5.5 (OTP R11B), - this value does not include reductions performed in current - time slices of currently scheduled processes. If an - exact value is wanted, use - statistics(exact_reductions).

-
+{2046,11} +
- - Information about the run-queue. + Information about the run-queue -

Returns the total length of run-queues, that is, the number - of processes that are ready to run on all available run-queues.

+

Returns the total length of the run queues, that is, the number + of processes that are ready to run on all available run queues.

- - Information about runtime. + Information about run-time -

Returns information about runtime, in milliseconds.

-

This is the sum of the runtime for all threads - in the Erlang runtime system and can therefore be greater - than the wall clock time.

-

Example:

+

Note that the run-time is the sum of the run-time for all + threads in the Erlang run-time system and may therefore be greater + than the wall-clock time. The time is returned in milliseconds.

 > statistics(runtime).
-{1690,1620}
+{1690,1620} +
- - Information about each schedulers work time. + Information about each schedulers work time - -

Returns a list of tuples with - {SchedulerId, ActiveTime, - TotalTime}, where - SchedulerId is an integer ID of the scheduler, - ActiveTime is - the duration the scheduler has been busy, and - TotalTime is the total time duration since - scheduler_wall_time - activation. The time unit is undefined and can be subject - to change between releases, OSs, and system restarts. - scheduler_wall_time is only to be used to - calculate relative values for scheduler-utilization. - ActiveTime can never exceed - TotalTime.

-

The definition of a busy scheduler is when it is not idle - and is not scheduling (selecting) a process or port, - that is:

- - Executing process code - Executing linked-in-driver or NIF code - Executing built-in-functions, or any other runtime - handling - Garbage collecting - Handling any other memory management - -

Notice that a scheduler can also be busy even if the - OS has scheduled out the scheduler thread.

-

Returns undefined if system flag - scheduler_wall_time - is turned off.

-

The list of scheduler information is unsorted and can - appear in different order between calls.

-

Using scheduler_wall_time to calculate scheduler-utilization:

+ +

+ Returns a list of tuples with {SchedulerId, + ActiveTime, TotalTime}, where + SchedulerId is an integer id of the scheduler, ActiveTime is + the duration the scheduler has been busy, TotalTime is the total time duration since + scheduler_wall_time + activation. The time unit is not defined and may be subject to change + between releases, operating systems and system restarts. + scheduler_wall_time should only be used to calculate relative + values for scheduler-utilization. ActiveTime can never exceed TotalTime. +

+ +

The definition of a busy scheduler is when it is not idle or not + scheduling (selecting) a process or port, meaning; executing process + code, executing linked-in-driver or NIF code, executing + built-in-functions or any other runtime handling, garbage collecting + or handling any other memory management. Note, a scheduler may also be + busy even if the operating system has scheduled out the scheduler + thread. +

+ +

+ Returns undefined if the system flag + scheduler_wall_time + is turned off. +

+ +

The list of scheduler information is unsorted and may appear in different order + between calls. +

+

Using scheduler_wall_time to calculate scheduler utilization.

 > erlang:system_flag(scheduler_wall_time, true).
 false
 > Ts0 = lists:sort(erlang:statistics(scheduler_wall_time)), ok.
-ok
-

Some time later the user takes another snapshot and calculates - scheduler-utilization per scheduler, for example:

+ok + +

Some time later we will take another snapshot and calculate scheduler-utilization per scheduler.

 > Ts1 = lists:sort(erlang:statistics(scheduler_wall_time)), ok.
 ok
@@ -5829,90 +5030,86 @@
  {5,0.9717956667018103},
  {6,0.9739235846420741},
  {7,0.973237033077876},
- {8,0.9741297293248656}]
-

Using the same snapshots to calculate a total scheduler-utilization:

+ {8,0.9741297293248656}] + +

Using the same snapshots to calculate a total scheduler-utilization.

 > {A, T} = lists:foldl(fun({{_, A0, T0}, {_, A1, T1}}, {Ai,Ti}) ->
 	{Ai + (A1 - A0), Ti + (T1 - T0)} end, {0, 0}, lists:zip(Ts0,Ts1)), A/T.
-0.9769136803764825
+0.9769136803764825 + -

scheduler_wall_time is by default disabled. To - enable it, use - erlang:system_flag(scheduler_wall_time, true).

+

scheduler_wall_time is by default disabled. Use erlang:system_flag(scheduler_wall_time, true) to enable it.

- - Information about wall clock. + Information about wall-clock -

Returns information about wall clock. wall_clock can - be used in the same manner as +

wall_clock can be used in the same manner as runtime, except that real time is measured as opposed to runtime or CPU time.

- - Suspends a process. + Suspend a process

Increases the suspend count on the process identified by - Suspendee and puts it in the suspended - state if it is not - already in that state. A suspended process will not be - scheduled for execution until the process has been resumed.

+ Suspendee and puts it in the suspended state if it isn't + already in the suspended state. A suspended process will not be + scheduled for execution until the process has been resumed. +

+

A process can be suspended by multiple processes and can be suspended multiple times by a single process. A suspended - process does not leave the suspended state until its suspend - count reaches zero. The suspend count of - Suspendee is decreased when + process will not leave the suspended state until its suspend + count reach zero. The suspend count of Suspendee + is decreased when erlang:resume_process(Suspendee) is called by the same process that called - erlang:suspend_process(Suspendee). - All increased suspend - counts on other processes acquired by a process are automatically + erlang:suspend_process(Suspendee). All increased suspend + counts on other processes acquired by a process will automatically be decreased when the process terminates.

-

The options (Opts) are as follows:

+ +

Currently the following options (Opts) are available:

asynchronous A suspend request is sent to the process identified by - Suspendee. Suspendee - eventually suspends - unless it is resumed before it could suspend. The caller - of erlang:suspend_process/2 returns immediately, - regardless of whether Suspendee has - suspended yet or not. The point in time when - Suspendee suspends cannot be deduced - from other events in the system. It is only guaranteed that - Suspendee eventually suspends - (unless it - is resumed). If option asynchronous has not - been passed, the caller of erlang:suspend_process/2 is - blocked until Suspendee has suspended. + Suspendee. Suspendee will eventually suspend + unless it is resumed before it was able to suspend. The caller + of erlang:suspend_process/2 will return immediately, + regardless of whether the Suspendee has suspended yet + or not. Note that the point in time when the Suspendee + will actually suspend cannot be deduced from other events + in the system. The only guarantee given is that the + Suspendee will eventually suspend (unless it + is resumed). If the asynchronous option has not + been passed, the caller of erlang:suspend_process/2 will + be blocked until the Suspendee has actually suspended. unless_suspending - The process identified by Suspendee is - suspended unless the calling process already is suspending - Suspendee. - If unless_suspending is combined - with option asynchronous, a suspend request is - sent unless the calling process already is suspending - Suspendee or if a suspend request - already has been sent and is in transit. If the calling - process already is suspending Suspendee, - or if combined with option asynchronous - and a send request already is in transit, - false is returned and the suspend count on - Suspendee remains unchanged. + The process identified by Suspendee will be suspended + unless the calling process already is suspending the + Suspendee. If unless_suspending is combined + with the asynchronous option, a suspend request will be + sent unless the calling process already is suspending the + Suspendee or if a suspend request already has been sent + and is in transit. If the calling process already is suspending + the Suspendee, or if combined with the asynchronous + option and a send request already is in transit, + false is returned and the suspend count on Suspendee + will remain unchanged. +

If the suspend count on the process identified by - Suspendee is increased, true - is returned, otherwise false.

+ Suspendee was increased, true is returned; otherwise, + false is returned.

+

This BIF is intended for debugging only.

@@ -5920,322 +5117,310 @@ badarg - If Suspendee is not a process identifier. + If Suspendee isn't a process identifier. badarg - If the process identified by Suspendee - is the same process - as the process calling erlang:suspend_process/2. + If the process identified by Suspendee is same the process as + the process calling erlang:suspend_process/2. badarg - If the process identified by Suspendee - is not alive. + If the process identified by Suspendee is not alive. badarg - If the process identified by Suspendee - resides on another node. + If the process identified by Suspendee resides on another node. badarg - If OptList is not a proper list of valid - Opts. + If OptList isn't a proper list of valid Opts. system_limit - If the process identified by Suspendee - has been suspended - more times by the calling process than can be represented by the - currently used internal data structures. The system limit is - higher than 2,000,000,000 suspends and will never be lower. + If the process identified by Suspendee has been suspended more + times by the calling process than can be represented by the + currently used internal data structures. The current system limit + is larger than 2 000 000 000 suspends, and it will never be less + than that.
- - Suspends a process. + Suspend a process -

Suspends the process identified by - Suspendee. The same as calling - erlang:suspend_process(Suspendee, - []).

+

Suspends the process identified by Suspendee. The + same as calling + erlang:suspend_process(Suspendee, []). For more information see the documentation of erlang:suspend_process/2. +

This BIF is intended for debugging only.

- - Sets system flag backtrace_depth. + Set system flag backtrace_depth

Sets the maximum depth of call stack back-traces in the exit reason element of 'EXIT' tuples.

Returns the old value of the flag.

- - Sets system flag cpu_topology. + Set system flag cpu_topology

- This argument is deprecated and scheduled for - removal in ERTS 5.10/OTP R16. Instead of using this - argument, use command-line argument - +sct in - erl(1).

-

When this argument is removed, a final CPU topology - to use is determined at emulator boot time.

+ This argument is deprecated and + scheduled for removal in erts-5.10/OTP-R16. Instead of using + this argument you are advised to use the erl command + line argument +sct. + When this argument has been removed a final CPU topology to use + will be determined at emulator boot time.

-

Sets the user-defined CpuTopology. - The user-defined - CPU topology overrides any automatically detected - CPU topology. By passing undefined as - CpuTopology, - the system reverts to the CPU topology automatically +

Sets the user defined CpuTopology. The user defined + CPU topology will override any automatically detected + CPU topology. By passing undefined as CpuTopology + the system will revert back to the CPU topology automatically detected. The returned value equals the value returned from erlang:system_info(cpu_topology) before the - change was made.

+ change was made. +

Returns the old value of the flag.

The CPU topology is used when binding schedulers to logical processors. If schedulers are already bound when the CPU - topology is changed, the schedulers are sent a request - to rebind according to the new CPU topology.

-

The user-defined CPU topology can also be set by passing - command-line argument - +sct to - erl(1).

-

For information on type CpuTopology - and more, see - erlang:system_info(cpu_topology) - as well as the command-line flags - +sct and - +sbt in - erl(1).

+ topology is changed, the schedulers will be sent a request + to rebind according to the new CPU topology. +

+

The user defined CPU topology can also be set by passing + the +sct command + line argument to erl. +

+

For information on the CpuTopology type + and more, see the documentation of + erlang:system_info(cpu_topology), + and the erl +sct + and +sbt + command line flags. +

- - Sets system_flag_dirty_cpu_schedulers_online. + Set system flag dirty CPU schedulers online

- Sets the number of dirty CPU schedulers online. Range is - , where N - is the smallest of the return values of - erlang:system_info(dirty_cpu_schedulers) and - erlang:system_info(schedulers_online).

+ Sets the amount of dirty CPU schedulers online. Valid range is + where N is the + lesser of the return values of erlang:system_info(dirty_cpu_schedulers) and + erlang:system_info(schedulers_online). +

Returns the old value of the flag.

-

The number of dirty CPU schedulers online can change if the - number of schedulers online changes. For example, if 12 - schedulers and 6 dirty CPU schedulers are online, and - system_flag/2 is used to set the number of - schedulers online to 6, then the number of dirty CPU - schedulers online is automatically decreased by half as well, - down to 3. Similarly, the number of dirty CPU schedulers - online increases proportionally to increases in the number of - schedulers online.

-

The dirty schedulers functionality is experimental. - Enable support for dirty schedulers when building OTP to - try out the functionality.

-
-

For more information, see +

Note that the number of dirty CPU schedulers online may change if the number of + schedulers online changes. For example, if there are 12 schedulers and all are + online, and 6 dirty CPU schedulers, all online as well, and system_flag/2 + is used to set the number of schedulers online to 6, then the number of dirty + CPU schedulers online is automatically decreased by half as well, down to 3. + Similarly, the number of dirty CPU schedulers online increases proportionally + to increases in the number of schedulers online.

+

Note that the dirty schedulers functionality is experimental, and + that you have to enable support for dirty schedulers when building OTP in order + to try out the functionality.

+

For more information see erlang:system_info(dirty_cpu_schedulers) and - erlang:system_info(dirty_cpu_schedulers_online).

+ erlang:system_info(dirty_cpu_schedulers_online). +

- - Sets system flag fullsweep_after. + Set system flag fullsweep_after -

Sets system flag fullsweep_after. - Number is a non-negative integer indicating +

Number is a non-negative integer which indicates how many times generational garbage collections can be done without forcing a fullsweep collection. The value - applies to new processes, while processes already running are + applies to new processes; processes already running are not affected.

Returns the old value of the flag.

In low-memory systems (especially without virtual - memory), setting the value to 0 can help to conserve + memory), setting the value to 0 can help to conserve memory.

-

This value can also be set through (OS) - environment variable ERL_FULLSWEEP_AFTER.

+

An alternative way to set this value is through the + (operating system) environment variable + ERL_FULLSWEEP_AFTER.

- - Sets system flag min_heap_size. + Set system flag min_heap_size -

Sets the default minimum heap size for processes. The size - is given in words. The new min_heap_size effects - only processes spawned after the change of - min_heap_size has been made. min_heap_size - can be set for individual processes by using +

Sets the default minimum heap size for processes. The + size is given in words. The new min_heap_size only + effects processes spawned after the change of + min_heap_size has been made. + The min_heap_size can be set for individual + processes by use of spawn_opt/N or - process_flag/2.

+ process_flag/2.

Returns the old value of the flag.

- - Sets system flag min_bin_vheap_size. + Set system flag min_bin_vheap_size -

Sets the default minimum binary virtual heap size for - processes. The size is given in words. - The new min_bin_vhheap_size effects only - processes spawned after the change of +

Sets the default minimum binary virtual heap size for processes. The + size is given in words. The new min_bin_vhheap_size only + effects processes spawned after the change of min_bin_vhheap_size has been made. - min_bin_vheap_size can be set for individual - processes by using + The min_bin_vheap_size can be set for individual + processes by use of spawn_opt/N or - process_flag/2.

+ process_flag/2.

Returns the old value of the flag.

- - Sets system flag multi_scheduling. + Set system flag multi_scheduling

If multi-scheduling is enabled, more than one scheduler thread is used by the emulator. Multi-scheduling can be - blocked. When multi-scheduling is blocked, only - one scheduler thread schedules Erlang processes.

-

If BlockState =:= block, multi-scheduling is - blocked. If BlockState =:= unblock and no one - else blocks multi-scheduling, and this process has - blocked only once, multi-scheduling is unblocked.

-

One process can block multi-scheduling multiple times. - If a process has blocked multiple times, it must + blocked. When multi-scheduling has been blocked, only + one scheduler thread will schedule Erlang processes.

+

If BlockState =:= block, multi-scheduling will + be blocked. If BlockState =:= unblock and no-one + else is blocking multi-scheduling and this process has + only blocked one time, multi-scheduling will be unblocked. + One process can block multi-scheduling multiple times. + If a process has blocked multiple times, it has to unblock exactly as many times as it has blocked before it has released its multi-scheduling block. If a process that - has blocked multi-scheduling exits, it releases its + has blocked multi-scheduling exits, it will release its blocking of multi-scheduling.

The return values are disabled, blocked, or enabled. The returned value describes the state just after the call to erlang:system_flag(multi_scheduling, BlockState) - has been made. For information about the return values, see - erlang:system_info(multi_scheduling).

-

Blocking of multi-scheduling is normally not needed. - If you feel that you need to block multi-scheduling, - consider it a few more times again. Blocking multi-scheduling - is only to be used as a last resort, as it is most likely - a very inefficient way to solve the problem.

-
-

See also - erlang:system_info(multi_scheduling), + has been made. The return values are described in the + documentation of erlang:system_info(multi_scheduling).

+

NOTE: Blocking of multi-scheduling should normally + not be needed. If you feel that you need to + block multi-scheduling, think through the + problem at least a couple of times again. + Blocking multi-scheduling should only be used + as a last resort since it will most likely be + a very inefficient way to solve the + problem.

+

See also erlang:system_info(multi_scheduling), erlang:system_info(multi_scheduling_blockers), and erlang:system_info(schedulers).

- - Sets system flag scheduler_bind_type. + Set system flag scheduler_bind_type

- This argument is deprecated and scheduled for - removal in ERTS 5.10/OTP R16. Instead of using this - argument, use command-line argument - +sbt in erl(1). - When this argument is removed, a final scheduler bind - type to use is determined at emulator boot time.

+ This argument is deprecated and + scheduled for removal in erts-5.10/OTP-R16. Instead of using + this argument you are advised to use the erl command + line argument +sbt. + When this argument has been removed a final scheduler bind type + to use will be determined at emulator boot time.

Controls if and how schedulers are bound to logical processors.

-

When erlang:system_flag(scheduler_bind_type, How) - is called, an asynchronous signal is sent to all schedulers - online, causing them to try to bind or unbind as requested.

-

If a scheduler fails to bind, this is often silently - ignored, as it is not always possible to verify valid - logical processor identifiers. If an error is reported, - it is reported to error_logger. To verify that the - schedulers have bound as requested, call - erlang:system_info(scheduler_bindings).

-
-

Schedulers can be bound on newer Linux, +

When erlang:system_flag(scheduler_bind_type, How) is + called, an asynchronous signal is sent to all schedulers + online which causes them to try to bind or unbind as requested. + NOTE: If a scheduler fails to bind, this + will often be silently ignored. This since it isn't always + possible to verify valid logical processor identifiers. If + an error is reported, it will be reported to the + error_logger. If you want to verify that the + schedulers actually have bound as requested, call + erlang:system_info(scheduler_bindings). +

+

Schedulers can currently only be bound on newer Linux, Solaris, FreeBSD, and Windows systems, but more systems will be - supported in future releases.

+ supported in the future. +

In order for the runtime system to be able to bind schedulers, - the CPU topology must be known. If the runtime system fails - to detect the CPU topology automatically, it can be defined. + the CPU topology needs to be known. If the runtime system fails + to automatically detect the CPU topology, it can be defined. For more information on how to define the CPU topology, see - command-line flag +sct - in erl(1).

-

The runtime system does by default not bind schedulers - to logical processors.

-

If the Erlang runtime system is the only OS - process binding threads to logical processors, this - improves the performance of the runtime system. However, - if other OS processes (for example, another Erlang - runtime system) also bind threads to logical processors, - there can be a performance penalty instead. Sometimes this - performance penalty can be severe. If so, it is recommended - to not bind the schedulers.

-
-

Schedulers can be bound in different ways. Argument - How determines how schedulers are - bound and can be any of the following:

+ the erl +sct command + line flag. +

+

The runtime system will by default not bind schedulers + to logical processors. +

+

NOTE: If the Erlang runtime system is the only + operating system process that binds threads to logical processors, + this improves the performance of the runtime system. However, + if other operating system processes (as for example another Erlang + runtime system) also bind threads to logical processors, there + might be a performance penalty instead. In some cases this + performance penalty might be severe. If this is the case, you + are advised to not bind the schedulers.

+

Schedulers can be bound in different ways. The How + argument determines how schedulers are bound. How can + currently be one of:

unbound -

Same as command-line argument - +sbt u in erl(1). +

Same as the erl command line argument + +sbt u.

no_spread -

Same as command-line argument - +sbt ns in erl(1). +

Same as the erl command line argument + +sbt ns.

thread_spread -

Same as command-line argument - +sbt ts in erl(1). +

Same as the erl command line argument + +sbt ts.

processor_spread -

Same as command-line argument - +sbt ps in erl(1). +

Same as the erl command line argument + +sbt ps.

spread -

Same as command-line argument - +sbt s in erl(1). +

Same as the erl command line argument + +sbt s.

no_node_thread_spread -

Same as command-line argument - +sbt nnts in erl(1). +

Same as the erl command line argument + +sbt nnts.

no_node_processor_spread -

Same as command-line argument - +sbt nnps in erl(1). +

Same as the erl command line argument + +sbt nnps.

thread_no_node_processor_spread -

Same as command-line argument - +sbt tnnps in erl(1). +

Same as the erl command line argument + +sbt tnnps.

default_bind -

Same as command-line argument - +sbt db in erl(1). +

Same as the erl command line argument + +sbt db.

-

The returned value equals How before flag - scheduler_bind_type was changed.

-

Failures:

+

The value returned equals How before the + scheduler_bind_type flag was changed.

+

Failure:

notsup @@ -6243,171 +5428,139 @@ badarg -

If How is not one of the documented - alternatives.

+

If How isn't one of the documented alternatives.

badarg -

If CPU topology information is unavailable.

+

If no CPU topology information is available.

The scheduler bind type can also be set by passing - command-line argument - +sbt to erl(1).

+ the +sbt command + line argument to erl. +

For more information, see erlang:system_info(scheduler_bind_type), erlang:system_info(scheduler_bindings), - as well as command-line flags - +sbt - and +sct - in erl(1).

+ the erl +sbt + and +sct command line + flags. +

- - Sets system flag scheduler_wall_time. + Set system flag scheduler_wall_time

- Turns on or off scheduler wall time measurements.

-

For more information, see - erlang:statistics(scheduler_wall_time).

+ Turns on/off scheduler wall time measurements.

+

For more information see, + erlang:statistics(scheduler_wall_time). +

- - Sets system flag schedulers_online. + Set system flag schedulers_online

- Sets the number of schedulers online. Range is - .

+ Sets the amount of schedulers online. Valid range is + . +

Returns the old value of the flag.

-

If the emulator was built with support for - dirty schedulers, - changing the number of schedulers online can also change the - number of dirty CPU schedulers online. For example, if 12 - schedulers and 6 dirty CPU schedulers are online, and - system_flag/2 is used to set the number of schedulers - online to 6, then the number of dirty CPU schedulers online - is automatically decreased by half as well, down to 3. - Similarly, the number of dirty CPU schedulers online increases - proportionally to increases in the number of schedulers online.

-

For more information, see - erlang:system_info(schedulers) +

Note that if the emulator was built with support for dirty schedulers, + changing the number of schedulers online can also change the number of dirty + CPU schedulers online. For example, if there are 12 schedulers and all are + online, and 6 dirty CPU schedulers, all online as well, and system_flag/2 + is used to set the number of schedulers online to 6, then the number of dirty + CPU schedulers online is automatically decreased by half as well, down to 3. + Similarly, the number of dirty CPU schedulers online increases proportionally + to increases in the number of schedulers online.

+

For more information see, + erlang:system_info(schedulers), and - erlang:system_info(schedulers_online).

+ erlang:system_info(schedulers_online). +

- - Sets system flag trace_control_word. + Set system flag trace_control_word -

Sets the value of the node trace control word to - TCW, which is to be an unsigned integer. - For more information, see the function +

Sets the value of the node's trace control word to + TCW. TCW should be an unsigned integer. For + more information see documentation of the set_tcw - in Section "Match Specifications in Erlang" in the - User's Guide.

+ function in the match specification documentation in the + ERTS User's Guide.

Returns the old value of the flag.

- - - - Finalize the Time Offset - -

- Finalizes the time offset - when single - time warp mode is used. If another time warp mode - is used, the time offset state is left unchanged.

-

Returns the old state identifier. That is:

- -

If preliminary is returned, finalization was - performed and the time offset is now final.

- -

If final is returned, the time offset was - already in the final state. This either because another - erlang:system_flag(time_offset, finalize) call, or - because no - time warp mode is used.

- -

If volatile is returned, the time offset - cannot be finalized because - multi - time warp mode is used.

-
-
-
- - Information about the system allocators. + Information about the allocators of the system - -

Returns various information about the allocators of the +

+ Returns various information about the + allocators of the current system (emulator) as specified by Item:

- - allocated_areas + allocated_areas

Returns a list of tuples with information about miscellaneous allocated memory areas.

-

Each tuple contains an atom describing the type of - memory as first element and the amount of allocated - memory in bytes as second element. When information - about allocated and used memory is present, also a - third element is present, containing the amount of +

Each tuple contains an atom describing type of memory as + first element and amount of allocated memory in bytes as + second element. In those cases when there is information + present about allocated and used memory, a third element + is present. This third element contains the amount of used memory in bytes.

erlang:system_info(allocated_areas) is intended - for debugging, and the content is highly - implementation-dependent. The content of the results - therefore changes when needed without prior notice.

-

Notice that the sum of these values is not + for debugging, and the content is highly implementation + dependent. The content of the results will therefore + change when needed without prior notice.

+

Note: The sum of these values is not the total amount of memory allocated by the emulator. Some values are part of other values, and some memory - areas are not part of the result. For information about - the total amount of memory allocated by the emulator, see - erlang:memory/0,1.

-
- allocator - - -

Returns {Allocator, Version, - Features, Settings, where:

+ areas are not part of the result. If you are interested + in the total amount of memory allocated by the emulator + see erlang:memory/0,1.

+
+ allocator + +

Returns {Allocator, Version, Features, Settings}.

+

Explanation:

-

Allocator corresponds to the - malloc() implementation used. If - Allocator equals +

Allocator corresponds to the malloc() + implementation used. If Allocator equals undefined, the malloc() implementation - used cannot be identified. glibc can be - identified.

+ used could not be identified. Currently + glibc can be identified.

-

Version is a list of integers - (but not a string) representing the version of +

Version is a list of integers (but not a + string) representing the version of the malloc() implementation used.

-

Features is a list of atoms - representing the allocation features used.

+

Features is a list of atoms representing + allocation features used.

-

Settings is a list of subsystems, - their configurable parameters, and used values. Settings - can differ between different combinations of +

Settings is a list of subsystems, their + configurable parameters, and used values. Settings + may differ between different combinations of platforms, allocators, and allocation features. Memory sizes are given in bytes.

@@ -6415,169 +5568,165 @@

See also "System Flags Effecting erts_alloc" in erts_alloc(3).

- alloc_util_allocators + alloc_util_allocators - -

Returns a list of the names of all allocators using - the ERTS internal alloc_util framework - as atoms. For more information, see Section - "The - alloc_util framework" in erts_alloc(3).

+

Returns a list of the names of all allocators + using the ERTS internal alloc_util framework + as atoms. For more information see the + "the + alloc_util framework" section in the + erts_alloc(3) documentation. +

- {allocator, Alloc} + {allocator, Alloc} -

Returns information about the specified allocator. - As from ERTS 5.6.1, the return value is a list - of {instance, InstanceNo, InstanceInfo} tuples, + As of erts version 5.6.1 the return value is a list + of {instance, InstanceNo, InstanceInfo} tuples where InstanceInfo contains information about - a specific instance of the allocator. As from - ERTS 5.10.4, the returned list when calling + a specific instance of the allocator. As of erts version + 5.10.4 the returned list when calling erlang:system_info({allocator, mseg_alloc}) also - includes an {erts_mmap, _} tuple as one element - in the list. If Alloc is not a - recognized allocator, undefined is returned. - If Alloc is disabled, + include an {erts_mmap, _} tuple as one element + in the list. + If Alloc is not a recognized allocator, + undefined is returned. If Alloc is disabled, false is returned.

-

Notice that the information returned is highly - implementation-dependent and can be changed or removed +

Note: The information returned is highly + implementation dependent and may be changed, or removed at any time without prior notice. It was initially intended as a tool when developing new allocators, but - as it can be of interest for others it has been + since it might be of interest for others it has been briefly documented.

The recognized allocators are listed in erts_alloc(3). After reading the erts_alloc(3) documentation, the returned information - more or less speaks for itself, but it can be worth + should more or less speak for itself. But it can be worth explaining some things. Call counts are presented by two - values, the first value is giga calls, and the second - value is calls. mbcs and sbcs denote - multi-block carriers, and single-block carriers, - respectively. Sizes are presented in bytes. When a - size is not presented, it is the amount of something. - Sizes and amounts are often presented by three values:

- - The first is the current value. - The second is the maximum value since the last call - to erlang:system_info({allocator, Alloc}). - The third is the maximum value since the emulator - was started. - -

If only one value is present, it is the current value. + values. The first value is giga calls, and the second + value is calls. mbcs, and sbcs are + abbreviations for, respectively, multi-block carriers, and + single-block carriers. Sizes are presented in bytes. When + it is not a size that is presented, it is the amount of + something. Sizes and amounts are often presented by three + values, the first is current value, the second is maximum + value since the last call to + erlang:system_info({allocator, Alloc}), and + the third is maximum value since the emulator was started. + If only one value is present, it is the current value. fix_alloc memory block types are presented by two - values. The first value is the memory pool size and - the second value is the used memory size.

+ values. The first value is memory pool size and + the second value used memory size.

- {allocator_sizes, Alloc} + {allocator_sizes, Alloc} -

Returns various size information for the specified allocator. The information returned is a subset of the information returned by - erlang:system_info({allocator, Alloc}). + erlang:system_info({allocator, Alloc}).

- - Information about the CPU topology of the system. + All LevelEntrys of a list must contain the same LevelTag, except on the top level where both node and - processor LevelTags can coexist. + processor LevelTags may co-exist. - {LevelTag, - SubLevel} == {LevelTag, [], - SubLevel} + {LevelTag, SubLevel} == {LevelTag, [], SubLevel} - More LevelTags can be introduced in a - future release. + More LevelTags may be introduced in the future. - The info_list() can be extended in a future release. + The info_list() may be extended in the future. + Information about the CPU topology of the system - - -

Returns various information about the CPU topology of - the current system (emulator) as specified by - Item:

+

Returns various information about the + CPU topology + of the current system + (emulator) as specified by Item:

cpu_topology -

Returns the CpuTopology currently used by - the emulator. The CPU topology is used when binding schedulers +

Returns the CpuTopology which currently is used by the + emulator. The CPU topology is used when binding schedulers to logical processors. The CPU topology used is the - user-defined CPU topology, - if such exists, otherwise the - automatically detected CPU topology, - if such exists. If no CPU topology + user + defined CPU topology if such exists; otherwise, the + automatically + detected CPU topology if such exists. If no CPU topology exists, undefined is returned.

-

node refers to Non-Uniform Memory Access (NUMA) - nodes. thread refers to hardware threads - (for example, Intel hyper-threads).

-

A level in term CpuTopology can be - omitted if only one entry exists and - InfoList is empty.

+

node refers to NUMA (non-uniform memory access) + nodes, and thread refers to hardware threads + (e.g. Intels hyper-threads).

+

A level in the CpuTopology term can be omitted if + only one entry exists and the InfoList is empty. +

thread can only be a sub level to core. - core can be a sub level to processor - or node. processor can be on the + core can be a sub level to either processor + or node. processor can either be on the top level or a sub level to node. node - can be on the top level or a sub level to + can either be on the top level or a sub level to processor. That is, NUMA nodes can be processor internal or processor external. A CPU topology can consist of a mix of processor internal and external - NUMA nodes, as long as each logical CPU belongs to - one NUMA node. Cache hierarchy is not part of - the CpuTopology type, but will be in a - future release. Other things can also make it into the CPU - topology in a future release. In other words, expect the - CpuTopology type to change.

-
- {cpu_topology, defined} - - -

Returns the user-defined CpuTopology. - For more information, see command-line flag - +sct in - erl(1) and argument - cpu_topology.

-
- {cpu_topology, detected} - - -

Returns the automatically detected - CpuTopologyy. The - emulator detects the CPU topology on some newer - Linux, Solaris, FreeBSD, and Windows systems. - On Windows system with more than 32 logical processors, - the CPU topology is not detected.

-

For more information, see argument - cpu_topology.

+ NUMA nodes, as long as each logical CPU belongs to one + and only one NUMA node. Cache hierarchy is not part of + the CpuTopology type yet, but will be in the + future. Other things may also make it into the CPU + topology in the future. In other words, expect the + CpuTopology type to change. +

+
+ {cpu_topology, defined} + +

Returns the user defined CpuTopology. For more + information see the documentation of + the erl +sct command + line flag, and the documentation of the + cpu_topology + argument. +

+
+ {cpu_topology, detected} + +

Returns the automatically detected CpuTopology. The + emulator currently only detects the CPU topology on some newer + Linux, Solaris, FreeBSD, and Windows systems. On Windows system with + more than 32 logical processors the CPU topology is not detected. +

+

For more information see the documentation of the + cpu_topology + argument. +

{cpu_topology, used} -

Returns CpuTopology used by the emulator. - For more information, see argument - cpu_topology.

+

Returns the CpuTopology which is used by the + emulator. For more information see the + documentation of the + cpu_topology + argument. +

- @@ -6626,20 +5775,7 @@ - - - - - - - - - - - - - - Information about the system. + Information about the system

Returns various information about the current system (emulator) as specified by Item:

@@ -6656,7 +5792,8 @@ Other possible return values are debug, purify, quantify, purecov, gcov, valgrind, gprof, and lcnt. Possible return values - can be added or removed at any time without prior notice.

+ may be added and/or removed at any time without prior notice. +

c_compiler_used @@ -6664,25 +5801,26 @@ compiling the runtime system. The first element is an atom describing the name of the compiler, or undefined if unknown. The second element is a term describing the - version of the compiler, or undefined if unknown.

+ version of the compiler, or undefined if unknown. +

check_io

Returns a list containing miscellaneous information - about the emulators internal I/O checking. Notice that - the content of the returned list can vary between - platforms and over time. It is only guaranteed + regarding the emulators internal I/O checking. Note, + the content of the returned list may vary between + platforms and over time. The only thing guaranteed is that a list is returned.

compat_rel

Returns the compatibility mode of the local node as an integer. The integer returned represents the - Erlang/OTP release that the current emulator has been + Erlang/OTP release which the current emulator has been set to be backward compatible with. The compatibility - mode can be configured at startup by using command-line flag - +R in - erl(1).

+ mode can be configured at startup by using the command + line flag +R, see + erl(1).

cpu_topology @@ -6695,200 +5833,166 @@ creation of a node is stored in process identifiers, port identifiers, and references. This makes it (to some extent) possible to distinguish between identifiers from - different incarnations of a node. The valid - creations are integers in the range 1..3, but this will - probably change in a future release. If the node is not - alive, 0 is returned.

+ different incarnations of a node. Currently valid + creations are integers in the range 1..3, but this may + (probably will) change in the future. If the node is not + alive, 0 is returned.

debug_compiled

Returns true if the emulator has been debug - compiled, otherwise false.

-
- delayed_node_table_gc - - -

Returns the amount of time in seconds garbage collection - of an entry in a node table is delayed. This limit can be set - on startup by passing the command line flag - +zdntgc - to erl. For more information see the documentation of the - command line flag.

+ compiled; otherwise, false. +

- dirty_cpu_schedulers + dirty_cpu_schedulers -

Returns the number of dirty CPU scheduler threads used by the emulator. Dirty CPU schedulers execute CPU-bound - native functions, such as NIFs, linked-in driver code, - and BIFs that cannot be managed cleanly by the normal - emulator schedulers.

-

The number of dirty CPU scheduler threads is determined - at emulator boot time and cannot be changed after that. - However, the number of dirty CPU scheduler threads online - can be changed at any time. The number of dirty CPU - schedulers can be set at startup by passing - command-line flag - +SDcpu or - +SDPcpu in - erl(1).

-

Notice that the dirty schedulers functionality is - experimental. Enable support for dirty schedulers when - building OTP to try out the functionality.

-

See also - erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline), + native functions such as NIFs, linked-in driver code, and BIFs + that cannot be managed cleanly by the emulator's normal schedulers. +

+

The number of dirty CPU scheduler threads is determined at emulator + boot time and cannot be changed after that. The number of dirty CPU + scheduler threads online can however be changed at any time. The number of + dirty CPU schedulers can be set on startup by passing + the +SDcpu or + +SDPcpu command line flags, + see erl(1). +

+

Note that the dirty schedulers functionality is experimental, and + that you have to enable support for dirty schedulers when building OTP in + order to try out the functionality.

+

See also erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline), erlang:system_info(dirty_cpu_schedulers_online), erlang:system_info(dirty_io_schedulers), erlang:system_info(schedulers), erlang:system_info(schedulers_online), and erlang:system_flag(schedulers_online, SchedulersOnline).

- dirty_cpu_schedulers_online + dirty_cpu_schedulers_online - -

Returns the number of dirty CPU schedulers online. - The return value satisfies - , - where N is the smallest of the return values of - erlang:system_info(dirty_cpu_schedulers) and - erlang:system_info(schedulers_online).

-

The number of dirty CPU schedulers online can be set at - startup by passing command-line flag - +SDcpu in - erl(1).

-

Notice that the dirty schedulers functionality is - experimental. Enable support for dirty schedulers when - building OTP to try out the functionality.

+

Returns the number of dirty CPU schedulers online. The return value + satisfies the following relationship: + , where N is + the lesser of the return values of erlang:system_info(dirty_cpu_schedulers) and + erlang:system_info(schedulers_online). +

+

The number of dirty CPU schedulers online can be set on startup by passing + the +SDcpu command line flag, see + erl(1). +

+

Note that the dirty schedulers functionality is experimental, and + that you have to enable support for dirty schedulers when building OTP in + order to try out the functionality.

For more information, see erlang:system_info(dirty_cpu_schedulers), erlang:system_info(dirty_io_schedulers), erlang:system_info(schedulers_online), and - erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline).

+ erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline). +

- dirty_io_schedulers + dirty_io_schedulers - -

Returns the number of dirty I/O schedulers as an integer. - Dirty I/O schedulers execute I/O-bound native functions, - such as NIFs and linked-in driver code, which cannot be - managed cleanly by the normal emulator schedulers.

-

This value can be set at startup by passing command-line - argument +SDio - in erl(1).

-

Notice that the dirty schedulers functionality is - experimental. Enable support for dirty schedulers when - building OTP to try out the functionality.

+

Returns the number of dirty I/O schedulers as an integer. Dirty I/O schedulers + execute I/O-bound native functions such as NIFs and linked-in driver code that + cannot be managed cleanly by the emulator's normal schedulers. +

+

This value can be set on startup by passing + the +SDio command line flag, see + erl(1). +

+

Note that the dirty schedulers functionality is experimental, and + that you have to enable support for dirty schedulers when building OTP in + order to try out the functionality.

For more information, see erlang:system_info(dirty_cpu_schedulers), erlang:system_info(dirty_cpu_schedulers_online), and - erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline).

+ erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline). +

dist

Returns a binary containing a string of distribution information formatted as in Erlang crash dumps. For more - information, see Section - "How to interpret the Erlang crash dumps" - in the User's Guide.

+ information see the "How to interpret the Erlang crash dumps" + chapter in the ERTS User's Guide.

- dist_buf_busy_limit + dist_buf_busy_limit -

Returns the value of the distribution buffer busy limit - in bytes. This limit can be set at startup by passing - command-line flag - +zdbbl - to erl.

+ in bytes. This limit can be set on startup by passing the + +zdbbl command line + flag to erl.

dist_ctrl

Returns a list of tuples - {Node, ControllingEntity}, - one entry for each connected remote node. - Node is the node name - and ControllingEntity is the port or process - identifier responsible for the communication to that node. - More specifically, ControllingEntity for - nodes connected through TCP/IP (the normal case) is the socket - used in communication with the specific node.

+ {Node, ControllingEntity}, one entry for each + connected remote node. The Node is the name of the + node and the ControllingEntity is the port or pid + responsible for the communication to that node. More + specifically, the ControllingEntity for nodes + connected via TCP/IP (the normal case) is the socket + actually used in communication with the specific node.

driver_version -

Returns a string containing the Erlang driver version - used by the runtime system. It has the form +

Returns a string containing the erlang driver version + used by the runtime system. It will be on the form "<major ver>.<minor ver>".

dynamic_trace

Returns an atom describing the dynamic trace framework - compiled into the virtual machine. It can be - dtrace, systemtap, or none. For a - commercial or standard build, it is always none. - The other return values indicate a custom configuration - (for example, ./configure --with-dynamic-trace=dtrace). - For more information about dynamic tracing, see the - dyntrace - manual page and the + compiled into the virtual machine. It can currently be either + dtrace, systemtap or none. For a + commercial or standard build, this is always none, + the other return values indicate a custom configuration + (e.g. ./configure --with-dynamic-trace=dtrace). See + the dyntrace + manual page and the README.dtrace/README.systemtap files in the - Erlang source code top directory.

+ Erlang source code top directory for more information + about dynamic tracing.

dynamic_trace_probes -

Returns a boolean() indicating if dynamic trace - probes (dtrace or systemtap) are built into - the emulator. This can only be true if the Virtual - Machine was built for dynamic tracing (that is, - system_info(dynamic_trace) returns +

Returns a boolean() indicating if dynamic trace probes + (either dtrace or systemtap) are built into the + emulator. This can only be true if the virtual + machine was built for dynamic tracing + (i.e. system_info(dynamic_trace) returns dtrace or systemtap).

- end_time -

The last Erlang monotonic - time in native - time unit that - can be represented internally in the current Erlang runtime system - instance. The time between the - start time and - the end time is at least a quarter of a millennium.

elib_malloc

This option will be removed in a future release. - The return value will always be false, as the - elib_malloc allocator has been removed.

-
- eager_check_io - -

- Returns the value of the erl command line flag - +secio - which is either true or false. See the - documentation of the command line flag for information about - the different values. -

+ The return value will always be false since + the elib_malloc allocator has been removed.

ets_limit -

Returns the maximum number of ETS tables allowed. This - limit can be increased at startup by passing - command-line flag - +e to - erl(1) or by setting environment variable - ERL_MAX_ETS_TABLES before starting the Erlang - runtime system.

+

Returns the maximum number of ETS tables allowed. This limit + can be increased on startup by passing the +e command line flag to + erl or by setting the environment variable + ERL_MAX_ETS_TABLES before starting the Erlang runtime + system.

fullsweep_after -

Returns {fullsweep_after, integer() >= 0}, which is - the fullsweep_after garbage collection setting used - by default. For more information, see - garbage_collection described in the following.

+

Returns {fullsweep_after, integer() >= 0} which is the + fullsweep_after garbage collection setting used + by default. For more information see + garbage_collection described below.

garbage_collection

Returns a list describing the default garbage collection settings. A process spawned on the local node by a - spawn or spawn_link uses these + spawn or spawn_link will use these garbage collection settings. The default settings can be - changed by using + changed by use of system_flag/2. spawn_opt/4 can spawn a process that does not use the default @@ -6902,8 +6006,8 @@ heap_type -

Returns the heap type used by the current emulator. One - heap type exists:

+

Returns the heap type used by the current emulator. + Currently only the following heap type exists:

private @@ -6918,51 +6022,51 @@

Returns a binary containing a string of miscellaneous system information formatted as in Erlang crash dumps. - For more information, see Section - "How to interpret the Erlang crash dumps" - in the User's Guide.

+ For more information see the + "How to interpret the Erlang crash dumps" chapter in the ERTS + User's Guide.

kernel_poll

Returns true if the emulator uses some kind of - kernel-poll implementation, otherwise false.

+ kernel-poll implementation; otherwise, false.

loaded

Returns a binary containing a string of loaded module information formatted as in Erlang crash dumps. For more - information, see Section - "How to interpret the Erlang crash dumps" - in the User's Guide.

+ information see the "How to interpret the Erlang crash dumps" chapter + in the ERTS User's Guide.

- logical_processors + logical_processors -

Returns the detected number of logical processors configured - in the system. The return value is either an integer, or - the atom unknown if the emulator cannot - detect the configured logical processors.

-
- logical_processors_available - - -

Returns the detected number of logical processors available - to the Erlang runtime system. The return value is either an - integer, or the atom unknown if the emulator - cannot detect the available logical processors. The number - of available logical processors is less than or equal to - the number of - logical processors online.

+ on the system. The return value is either an integer, or + the atom unknown if the emulator wasn't able to + detect logical processors configured. +

+
+ logical_processors_available + +

Returns the detected number of logical processors available to + the Erlang runtime system. The return value is either an + integer, or the atom unknown if the emulator wasn't + able to detect logical processors available. The number + of logical processors available is less than or equal to + the number of logical + processors online. +

- logical_processors_online + logical_processors_online -

Returns the detected number of logical processors online on the system. The return value is either an integer, - or the atom unknown if the emulator cannot + or the atom unknown if the emulator wasn't able to detect logical processors online. The number of logical processors online is less than or equal to the number of - logical processors configured.

+ logical processors + configured. +

machine @@ -6970,30 +6074,27 @@ min_heap_size -

Returns {min_heap_size, MinHeapSize}, - where MinHeapSize is the current - system-wide minimum heap size for spawned processes.

+

Returns {min_heap_size, MinHeapSize} where MinHeapSize is the current system wide + minimum heap size for spawned processes.

min_bin_vheap_size -

Returns {min_bin_vheap_size, - MinBinVHeapSize}, where - MinBinVHeapSize is the current system-wide +

Returns {min_bin_vheap_size, MinBinVHeapSize} where MinBinVHeapSize is the current system wide minimum binary virtual heap size for spawned processes.

modified_timing_level -

Returns the modified timing-level (an integer) if - modified timing is enabled, otherwise, undefined. - For more information about modified timing, see - command-line flag - +T - in erl(1)

+

Returns the modified timing level (an integer) if + modified timing has been enabled; otherwise, + undefined. See the +T command line flag + in the documentation of the + erl(1) + command for more information on modified timing.

- multi_scheduling + multi_scheduling - -

Returns disabled, blocked, or enabled:

+

Returns disabled, blocked, or enabled. + A description of the return values:

disabled @@ -7004,317 +6105,177 @@ blocked

The emulator has more than one scheduler thread, - but all scheduler threads except one are blocked, - that is, only one scheduler thread schedules - Erlang processes and executes Erlang code.

+ but all scheduler threads but one have been blocked, + i.e., only one scheduler thread will schedule + Erlang processes and execute Erlang code.

enabled

The emulator has more than one scheduler thread, - and no scheduler threads are blocked, that is, - all available scheduler threads schedule + and no scheduler threads have been blocked, i.e., + all available scheduler threads will schedule Erlang processes and execute Erlang code.

-

See also - erlang:system_flag(multi_scheduling, BlockState), - erlang:system_info(multi_scheduling_blockers), - and +

See also erlang:system_flag(multi_scheduling, BlockState), + erlang:system_info(multi_scheduling_blockers), and erlang:system_info(schedulers).

- multi_scheduling_blockers + multi_scheduling_blockers - -

Returns a list of Pids when - multi-scheduling is blocked, otherwise the empty list is - returned. The Pids in the list - represent all the processes currently - blocking multi-scheduling. A Pid occurs - only once in the list, even if the corresponding +

Returns a list of PIDs when multi-scheduling + is blocked; otherwise, the empty list. The PIDs + in the list is PIDs of the processes currently + blocking multi-scheduling. A PID will only be + present once in the list, even if the corresponding process has blocked multiple times.

-

See also - erlang:system_flag(multi_scheduling, BlockState), - erlang:system_info(multi_scheduling), - and +

See also erlang:system_flag(multi_scheduling, BlockState), + erlang:system_info(multi_scheduling), and erlang:system_info(schedulers).

- nif_version + otp_release -

Returns a string containing the version of the Erlang NIF interface - used by the runtime system. It is on the form - "<major ver>.<minor ver>".

-
- otp_release - -

Returns a string containing the OTP release number of the - OTP release that the currently executing ERTS application is + OTP release that the currently executing ERTS application is part of.

-

As from OTP 17, the OTP release number corresponds to - the major OTP version number. No - erlang:system_info() argument gives the exact OTP - version. This is because the exact OTP version in the general case - is difficult to determine. For more information, see the description - of versions in - System principles in System Documentation.

-
- os_monotonic_time_source - -

Returns a list containing information about the source of - OS - monotonic time that is used by the runtime system.

-

If [] is returned, no OS monotonic time is - available. The list contains two-tuples with Keys - as first element, and Values as second element. The - order of these tuples is undefined. The following - tuples can be part of the list, but more tuples can be - introduced in the future:

- - {function, Function} -

Function is the name of the function - used. This tuple always exist if OS monotonic time is - available to the runtime system.

- - {clock_id, ClockId} -

This tuple only exist if Function - can be used with different clocks. ClockId - corresponds to the clock identifier used when calling - Function.

- - {resolution, OsMonotonicTimeResolution} -

Highest possible - resolution - of current OS monotonic time source as parts per - second. If no resolution information can be retrieved - from the OS, OsMonotonicTimeResolution is - set to the resolution of the time unit of - Functions return value. That is, the actual - resolution can be lower than - OsMonotonicTimeResolution. Also note that - the resolution does not say anything about the - accuracy, - and whether the - precision - do align with the resolution. You do, - however, know that the precision is not better than - OsMonotonicTimeResolution.

- - {extended, Extended} -

Extended equals yes if - the range of time values has been extended; - otherwise, Extended equals no. The - range needs to be extended if Function - returns values that wrap fast. This typically - is the case when the return value is a 32-bit - value.

- - {parallel, Parallel} -

Parallel equals yes if - Function is called in parallel from multiple - threads. If it is not called in parallel, because - calls needs to be serialized, Parallel equals - no.

- - {time, OsMonotonicTime} -

OsMonotonicTime equals current OS - monotonic time in native - time unit.

-
-
- os_system_time_source - -

Returns a list containing information about the source of - OS - system time that is used by the runtime system.

-

The list contains two-tuples with Keys - as first element, and Values as second element. The - order if these tuples is undefined. The following - tuples can be part of the list, but more tuples can be - introduced in the future:

- - {function, Function} -

Function is the name of the funcion - used.

- - {clock_id, ClockId} -

This tuple only exist if Function - can be used with different clocks. ClockId - corresponds to the clock identifier used when calling - Function.

- - {resolution, OsSystemTimeResolution} -

Highest possible - resolution - of current OS system time source as parts per - second. If no resolution information can be retrieved - from the OS, OsSystemTimeResolution is - set to the resolution of the time unit of - Functions return value. That is, the actual - resolution may be lower than - OsSystemTimeResolution. Also note that - the resolution does not say anything about the - accuracy, - and whether the - precision - do align with the resolution. You do, - however, know that the precision is not better than - OsSystemTimeResolution.

- - {parallel, Parallel} -

Parallel equals yes if - Function is called in parallel from multiple - threads. If it is not called in parallel, because - calls needs to be serialized, Parallel equals - no.

- - {time, OsSystemTime} -

OsSystemTime equals current OS - system time in native - time unit.

-
-
- port_parallelism - - -

Returns the default port parallelism scheduling hint used. - For more information, see command-line argument - +spp in erl(1).

+

As of OTP release 17, the OTP release number corresponds to + the major OTP version number. There is no + erlang:system_info() argument giving the exact OTP + version. This since the exact OTP version in the general case + is hard to determine. For more information see + the + documentation of versions in the system principles + guide.

+
+ port_parallelism +

Returns the default port parallelism scheduling hint used. + For more information see the + +spp command line argument + of erl(1).

port_count -

Returns the number of ports currently existing at the - local node. The value is given as an integer. This is - the same value as returned by - length(erlang:ports()), but more efficient.

+

Returns the number of ports currently existing at + the local node as an integer. The same value as + length(erlang:ports()) returns, but more efficient.

- port_limit + port_limit -

Returns the maximum number of simultaneously existing - ports at the local node as an integer. This limit can be - configured at startup by using command-line flag - +Q in erl(1).

+ ports at the local node as an integer. This limit + can be configured at startup by using the + +Q + command line flag of + erl(1).

process_count -

Returns the number of processes currently existing at the - local node. The value is given as an integer. This is - the same value as returned by - length(processes()), but more efficient.

+

Returns the number of processes currently existing at + the local node as an integer. The same value as + length(processes()) returns, but more efficient.

- process_limit + process_limit -

Returns the maximum number of simultaneously existing - processes at the local node. The value is given as an - integer. This limit can be configured at startup by using - command-line flag +P - in erl(1).

+ processes at the local node as an integer. This limit + can be configured at startup by using the + +P + command line flag of + erl(1).

procs

Returns a binary containing a string of process and port information formatted as in Erlang crash dumps. For more - information, see Section - "How to interpret the Erlang crash dumps" - in the User's Guide.

+ information see the "How to interpret the Erlang crash dumps" chapter + in the ERTS User's Guide.

- scheduler_bind_type + scheduler_bind_type - -

Returns information about how the user has requested +

Returns information on how user has requested schedulers to be bound or not bound.

-

Notice that even though a user has requested - schedulers to be bound, they can silently have failed - to bind. To inspect the scheduler bindings, call - erlang:system_info(scheduler_bindings).

-

For more information, see command-line argument - +sbt - in erl(1) and - erlang:system_info(scheduler_bindings).

+

NOTE: Even though user has requested + schedulers to be bound, they might have silently failed + to bind. In order to inspect actual scheduler bindings call + erlang:system_info(scheduler_bindings). +

+

For more information, see + the erl +sbt + command line argument, and + erlang:system_info(scheduler_bindings). +

- scheduler_bindings + scheduler_bindings - -

Returns information about the currently used scheduler +

Returns information on currently used scheduler bindings.

A tuple of a size equal to - erlang:system_info(schedulers) - is returned. The tuple elements are integers + erlang:system_info(schedulers) is returned. The elements of the tuple are integers or the atom unbound. Logical processor identifiers are represented as integers. The Nth element of the tuple equals the current binding for the scheduler with the scheduler identifier equal to - N. For example, if the schedulers are bound, + N. E.g., if the schedulers have been bound, element(erlang:system_info(scheduler_id), - erlang:system_info(scheduler_bindings)) returns + erlang:system_info(scheduler_bindings)) will return the identifier of the logical processor that the calling - process is executing on.

-

Notice that only schedulers online can be bound to logical + process is executing on. +

+

Note that only schedulers online can be bound to logical processors.

-

For more information, see command-line argument - +sbt - in erl(1) and +

For more information, see + the erl +sbt + command line argument, erlang:system_info(schedulers_online).

- scheduler_id + scheduler_id - -

Returns the scheduler ID (SchedulerId) of the +

Returns the scheduler id (SchedulerId) of the scheduler thread that the calling process is executing - on. SchedulerId is a positive integer, - where - . - See also + on. SchedulerId is a positive integer; where + . See also erlang:system_info(schedulers).

- schedulers + schedulers -

Returns the number of scheduler threads used by the emulator. Scheduler threads online schedules Erlang processes and Erlang ports, and execute Erlang code - and Erlang linked-in driver code.

+ and Erlang linked in driver code.

The number of scheduler threads is determined at - emulator boot time and cannot be changed later. - However, the number of schedulers online can - be changed at any time.

-

See also - erlang:system_flag(schedulers_online, SchedulersOnline), + emulator boot time and cannot be changed after + that. The amount of schedulers online can + however be changed at any time.

+

See also erlang:system_flag(schedulers_online, SchedulersOnline), erlang:system_info(schedulers_online), erlang:system_info(scheduler_id), erlang:system_flag(multi_scheduling, BlockState), - erlang:system_info(multi_scheduling), - and - erlang:system_info(multi_scheduling_blockers).

-
- schedulers_online - - -

Returns the number of schedulers online. The scheduler - identifiers of schedulers online satisfy the relationship - .

+ erlang:system_info(multi_scheduling), and + and erlang:system_info(multi_scheduling_blockers).

+
+ schedulers_online + +

Returns the amount of schedulers online. The scheduler + identifiers of schedulers online satisfy the following + relationship: + . +

For more information, see - erlang:system_info(schedulers) + erlang:system_info(schedulers), and - erlang:system_flag(schedulers_online, SchedulersOnline).

+ erlang:system_flag(schedulers_online, SchedulersOnline). +

+
smp_support

Returns true if the emulator has been compiled - with SMP support, otherwise false is returned.

+ with smp support; otherwise, false.

- start_time -

The Erlang monotonic - time in native - time unit at the - time when current Erlang runtime system instance started. See also - erlang:system_info(end_time). -

system_version

Returns a string containing version number and - some important properties, such as the number of schedulers.

+ some important properties such as the number of schedulers.

system_architecture @@ -7324,168 +6285,109 @@ threads

Returns true if the emulator has been compiled - with thread support, otherwise false is returned.

+ with thread support; otherwise, false is + returned.

- thread_pool_size + thread_pool_size -

Returns the number of async threads in the async thread pool used for asynchronous driver calls - (driver_async()). - The value is given as an integer.

+ (driver_async()) + as an integer.

- - time_correction - - -

Returns a boolean value indicating whether - time correction - is enabled or not. -

- time_offset - - -

Returns the state of the time offset:

- - preliminary -

The time offset is preliminary, and will be changed - at a later time when being finalized. The preliminary time offset - is used during the preliminary phase of the - single - time warp mode.

- - final -

The time offset is final. This either because - no - time warp mode is used, or because the time - offset have been finalized when - single - time warp mode is used.

- - volatile -

The time offset is volatile. That is, it can - change at any time. This is because - multi - time warp mode is used.

-
-
- time_warp_mode -

Returns a value identifying the - time warp - mode being used:

- - no_time_warp -

The no - time warp mode is used.

- - single_time_warp -

The single - time warp mode is used.

- - multi_time_warp -

The multi - time warp mode is used.

-
-
- tolerant_timeofday - - -

Returns whether a pre erts-7.0 backwards compatible compensation - for sudden changes of system time is enabled or disabled. - Such compensation is enabled when the - time offset is - final, and - time correction - is enabled.

+ tolerant_timeofday + +

Returns whether compensation for sudden changes of system + time is enabled or disabled.

+

See also +c + command line flag.

trace_control_word -

Returns the value of the node trace control word. For - more information, see function get_tcw in Section - Match Specifications in Erlang in the User's Guide.

-
- update_cpu_info - - -

The runtime system rereads the CPU information available - and updates its internally stored information about the - detected - CPU topology and the number of logical processors +

Returns the value of the node's trace control word. + For more information see documentation of the function + get_tcw in "Match Specifications in Erlang", + ERTS User's Guide.

+
+ update_cpu_info + +

The runtime system rereads the CPU information available and + updates its internally stored information about the + detected CPU + topology and the amount of logical processors configured, online, and - available.

-

If the CPU information has changed since the last time - it was read, the atom changed is returned, otherwise - the atom unchanged. If the CPU information has changed, + available. + If the CPU information has changed since the last time it was read, + the atom changed is returned; otherwise, the atom + unchanged is returned. If the CPU information has changed you probably want to - adjust the - number of schedulers online. You typically want - to have as many schedulers online as - logical - processors available.

+ adjust the amount + of schedulers online. You typically want to have as + many schedulers online as + logical processors + available. +

- version + version -

Returns a string containing the version number of the emulator.

wordsize -

Same as {wordsize, internal}.

+

Same as {wordsize, internal}.

{wordsize, internal}

Returns the size of Erlang term words in bytes as an - integer, that is, 4 is returned on a 32-bit architecture, - and 8 is returned on a pure 64-bit architecture. On a + integer, i.e. on a 32-bit architecture 4 is returned, + and on a pure 64-bit architecture 8 is returned. On a halfword 64-bit emulator, 4 is returned, as the Erlang - terms are stored using a virtual word size of half the - system word size.

+ terms are stored using a virtual wordsize of half the + system's wordsize.

{wordsize, external} -

Returns the true word size of the emulator, that is, - the size of a pointer. The value is given in bytes - as an integer. On a pure 32-bit architecture, 4 is - returned. On both a half word and on a pure +

Returns the true wordsize of the emulator, i.e. the size + of a pointer, in bytes as an integer. On a pure 32-bit + architecture 4 is returned, on both a halfword and pure 64-bit architecture, 8 is returned.

-

Argument scheduler has changed name to - scheduler_id to avoid mix up with argument - schedulers. Argument scheduler was - introduced in ERTS 5.5 and renamed in - ERTS 5.5.1.

+

The scheduler argument has changed name to + scheduler_id. This in order to avoid mixup with + the schedulers argument. The scheduler + argument was introduced in ERTS version 5.5 and renamed + in ERTS version 5.5.1.

- Current system performance monitoring settings. + Current system performance monitoring settings

Returns the current system monitoring settings set by erlang:system_monitor/2 - as {MonitorPid, Options}, - or undefined if there - are no settings. The order of the options can be different + as {MonitorPid, Options}, or undefined if there + are no settings. The order of the options may be different from the one that was set.

- Sets or clears system performance monitoring options. + Set or clear system performance monitoring options -

When called with argument undefined, all +

When called with the argument undefined, all system performance monitoring settings are cleared.

-

Calling the function with {MonitorPid, - Options} as argument is the same as calling - erlang:system_monitor(MonitorPid, Options).

+

Calling the function with {MonitorPid, Options} as + argument, is the same as calling + erlang:system_monitor(MonitorPid, Options).

Returns the previous system monitor settings just like erlang:system_monitor/0.

@@ -7493,101 +6395,102 @@ - Sets system performance monitoring options. + Set system performance monitoring options -

Sets the system performance monitoring options. - MonitorPid is a local process identifier (pid) - receiving system monitor messages. The - second argument is a list of monitoring options:

+

Sets system performance monitoring options. MonitorPid + is a local pid that will receive system monitor messages, and + the second argument is a list of monitoring options:

{long_gc, Time}

If a garbage collection in the system takes at least - Time wall clock milliseconds, a message + Time wallclock milliseconds, a message {monitor, GcPid, long_gc, Info} is sent to - MonitorPid. GcPid is the pid that - was garbage collected. Info is a list of two-element - tuples describing the result of the garbage collection.

-

One of the tuples is {timeout, GcTime}, where - GcTime is the time for the garbage + MonitorPid. GcPid is the pid that was + garbage collected and Info is a list of two-element + tuples describing the result of the garbage collection. + One of the tuples is {timeout, GcTime} where + GcTime is the actual time for the garbage collection in milliseconds. The other tuples are - tagged with heap_size, heap_block_size - stack_size, mbuf_size, old_heap_size, - and old_heap_block_size. These tuples are - explained in the description of trace message - gc_start (see - erlang:trace/3). - New tuples can be added, and the order of the tuples in - the Info list can be changed at any time without - prior notice.

+ tagged with heap_size, heap_block_size, + stack_size, mbuf_size, old_heap_size, + and old_heap_block_size. These tuples are + explained in the documentation of the + gc_start + trace message (see + erlang:trace/3). + New tuples may be added, and the order of the tuples in + the Info list may be changed at any time without prior + notice. +

{long_schedule, Time} -

If a process or port in the system runs uninterrupted +

If a process or port in the system runs uninterrupted for at least Time wall clock milliseconds, a message {monitor, PidOrPort, long_schedule, Info} is sent to MonitorPid. PidOrPort is the - process or port that was running. Info is a - list of two-element tuples describing the event.

-

If a pid(), the tuples {timeout, Millis}, - {in, Location}, and {out, Location} are + process or port that was running and Info is a + list of two-element tuples describing the event. In case + of a pid(), the tuples {timeout, Millis}, + {in, Location} and {out, Location} will be present, where Location is either an MFA ({Module, Function, Arity}) describing the function where the process was scheduled in/out, or the - atom undefined.

-

If a port(), the + atom undefined. In case of a port(), the tuples {timeout, Millis} and {port_op,Op} - are present. Op is one of proc_sig, + will be present. Op will be one of proc_sig, timeout, input, output, - event, or dist_cmd, depending on which - driver callback was executing.

-

proc_sig is an - internal operation and is never to appear, while the + event or dist_cmd, depending on which + driver callback was executing. proc_sig is an + internal operation and should never appear, while the others represent the corresponding driver callbacks timeout, ready_input, ready_output, - event, and outputv (when the port - is used by distribution). Value Millis in - the timeout tuple informs about the - uninterrupted execution time of the process or port, which - always is equal to or higher than the Time value - supplied when starting the trace. New tuples can be - added to the Info list in a future release. The - order of the tuples in the list can be changed at any - time without prior notice.

-

This can be used to detect problems with NIFs or - drivers that take too long to execute. 1 ms is - considered a good maximum time for a driver callback - or a NIF. However, a time-sharing system is usually to - consider everything below 100 ms as "possible" and - fairly "normal". However, longer schedule times can - indicate swapping or a misbehaving NIF/driver. - Misbehaving NIFs and drivers can cause bad resource - utilization and bad overall system performance.

+ event and finally outputv (when the port + is used by distribution). The Millis value in + the timeout tuple will tell you the actual + uninterrupted execution time of the process or port, + which will always be >= the Time value + supplied when starting the trace. New tuples may be + added to the Info list in the future, and the + order of the tuples in the list may be changed at any + time without prior notice. +

+

This can be used to detect problems with NIF's or + drivers that take too long to execute. Generally, 1 ms + is considered a good maximum time for a driver callback + or a NIF. However, a time sharing system should usually + consider everything below 100 ms as "possible" and + fairly "normal". Schedule times above that might however + indicate swapping or a NIF/driver that is + misbehaving. Misbehaving NIF's and drivers could cause + bad resource utilization and bad overall performance of + the system.

{large_heap, Size}

If a garbage collection in the system results in the allocated size of a heap being at least Size words, a message {monitor, GcPid, large_heap, Info} - is sent to MonitorPid. - GcPid and Info - are the same as for long_gc earlier, except that - the tuple tagged with timeout is not present.

-

As of ERTS 5.6, the monitor message is sent - if the sum of the sizes of all memory blocks allocated - for all heap generations is equal to or higher than Size. - Previously the monitor message was sent if the memory block - allocated for the youngest generation was equal to or higher - than Size.

+ is sent to MonitorPid. GcPid and Info + are the same as for long_gc above, except that + the tuple tagged with timeout is not present. + Note: As of erts version 5.6 the monitor message + is sent if the sum of the sizes of all memory blocks allocated + for all heap generations is equal to or larger than Size. + Previously the monitor message was sent if the memory block + allocated for the youngest generation was equal to or larger + than Size. +

busy_port

If a process in the system gets suspended because it sends to a busy port, a message {monitor, SusPid, busy_port, Port} is sent to - MonitorPid. SusPid is the pid - that got suspended when sending to Port.

+ MonitorPid. SusPid is the pid that got + suspended when sending to Port.

busy_dist_port @@ -7595,8 +6498,8 @@ sends to a process on a remote node whose inter-node communication was handled by a busy port, a message {monitor, SusPid, busy_dist_port, Port} is sent to - MonitorPid. SusPid is the pid - that got suspended when sending through the inter-node + MonitorPid. SusPid is the pid that got + suspended when sending through the inter-node communication port Port.

@@ -7605,125 +6508,85 @@

If a monitoring process gets so large that it itself starts to cause system monitor messages when garbage - collecting, the messages enlarge the process + collecting, the messages will enlarge the process's message queue and probably make the problem worse.

Keep the monitoring process neat and do not set the system monitor limits too tight.

-

Failures:

- - badarg - If MonitorPid does not exist. - badarg - If MonitorPid is not a local process. - +

Failure: badarg if MonitorPid does not exist or is not a local process.

- Current system profiling settings. + Current system profiling settings

Returns the current system profiling settings set by erlang:system_profile/2 - as {ProfilerPid, Options}, - or undefined if there - are no settings. The order of the options can be different + as {ProfilerPid, Options}, or undefined if there + are no settings. The order of the options may be different from the one that was set.

- Current system profiling settings. + Current system profiling settings

Sets system profiler options. ProfilerPid - is a local process identifier (pid) or port receiving profiling - messages. The receiver is excluded from all profiling. + is a local pid or port that will receive profiling messages. The + receiver is excluded from all profiling. The second argument is a list of profiling options:

exclusive -

If a synchronous call to a port from a process is done, the +

+ If a synchronous call to a port from a process is done, the calling process is considered not runnable during the call runtime to the port. The calling process is notified as - inactive, and later active when the port - callback returns.

+ inactive and subsequently active when the port + callback returns. +

runnable_procs -

If a process is put into or removed from the run queue, a - message, {profile, Pid, State, Mfa, Ts}, is sent to - ProfilerPid. Running processes that - are reinserted into the run queue after having been - preempted do not trigger this message.

+

If a process is put into or removed from the run queue a message, + {profile, Pid, State, Mfa, Ts}, is sent to + ProfilerPid. Running processes that is reinserted into the + run queue after having been preemptively scheduled out will not trigger this + message. +

runnable_ports -

If a port is put into or removed from the run queue, a - message, {profile, Port, State, 0, Ts}, is sent to - ProfilerPid.

+

If a port is put into or removed from the run queue a message, + {profile, Port, State, 0, Ts}, is sent to + ProfilerPid. +

scheduler -

If a scheduler is put to sleep or awoken, a message, - {profile, scheduler, Id, State, NoScheds, Ts}, is - sent to ProfilerPid.

+

If a scheduler is put to sleep or awoken a message, + {profile, scheduler, Id, State, NoScheds, Ts}, is sent + to ProfilerPid. +

-

erlang:system_profile is considered experimental - and its behavior can change in a future release.

+

erlang:system_profile is considered experimental and + its behaviour may change in the future.

- - - Current Erlang system time - -

Returns current - Erlang system time - in native - time unit.

- -

Calling erlang:system_time() is equivalent to: - erlang:monotonic_time() - + - erlang:time_offset().

- -

This time is not a monotonically increasing time - in the general case. For more information, see the documentation of - time warp modes in the - ERTS User's Guide.

-
-
- - - Current Erlang system time - -

Returns current - Erlang system time - converted into the Unit passed as argument.

- -

Calling erlang:system_time(Unit) is equivalent to: - erlang:convert_time_unit(erlang:system_time(), - native, Unit).

-

This time is not a monotonically increasing time - in the general case. For more information, see the documentation of - time warp modes in the - ERTS User's Guide.

-
-
- Encodes a term to an Erlang external term format binary. + Encode a term to an Erlang external term format binary -

Returns a binary data object that is the result of encoding - Term according to the Erlang external - term format.

-

This can be used for various purposes, for example, +

Returns a binary data object which is the result of encoding + Term according to the Erlang external term format.

+

This can be used for a variety of purposes, for example writing a term to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed Erlang.

@@ -7731,349 +6594,247 @@ binary_to_term/1.

- - Encodes a term to en Erlang external term format binary. + Encode a term to en Erlang external term format binary -

Returns a binary data object that is the result of encoding - Term according to the Erlang external - term format.

-

If option compressed is provided, the external term - format is compressed. The compressed format is automatically - recognized by binary_to_term/1 as from Erlang R7B.

-

A compression level can be specified by giving option - {compressed, Level}. - Level is an integer - with range 0..9, where:

- - 0 - No compression is done (it is the same as - giving no compressed option). - 1 - Takes least time but may not compress - as well as the higher levels. - 6 - Default level when option compressed - is provided. - 9 - Takes most time and tries to produce a smaller - result. Notice "tries" in the preceding sentence; depending - on the input term, level 9 compression either does or does - not produce a smaller result than level 1 compression. - -

Option {minor_version, Version} - can be used to control - some encoding details. This option was introduced in OTP R11B-4. - The valid values for Version are - 0 and 1.

-

As from OTP 17.0, {minor_version, 1} is the default. It - forces any floats in the term to be encoded in a more - space-efficient and exact way (namely in the 64-bit IEEE format, - rather than converted to a textual representation).

-

As from OTP R11B-4, binary_to_term/1 can decode this - representation.

-

{minor_version, 0} means that floats are encoded - using a textual representation. This option is useful to - ensure that releases before OTP R11B-4 can decode resulting +

Returns a binary data object which is the result of encoding + Term according to the Erlang external term format.

+

If the option compressed is provided, the external + term format will be compressed. The compressed format is + automatically recognized by binary_to_term/1 in R7B and later.

+

It is also possible to specify a compression level by giving + the option {compressed, Level}, where Level is an + integer from 0 through 9. 0 means that no compression + will be done (it is the same as not giving any compressed option); + 1 will take the least time but may not compress as well as + the higher levels; 9 will take the most time and may produce + a smaller result. Note the "mays" in the preceding sentence; depending + on the input term, level 9 compression may or may not produce a smaller + result than level 1 compression.

+

Currently, compressed gives the same result as + {compressed, 6}.

+

The option {minor_version, Version} can be use to control + some details of the encoding. This option was + introduced in R11B-4. Currently, the allowed values for Version + are 0 and 1.

+

{minor_version, 1} is since 17.0 the default, it forces any floats in + the term to be encoded + in a more space-efficient and exact way (namely in the 64-bit IEEE format, + rather than converted to a textual representation). binary_to_term/1 + in R11B-4 and later is able decode this representation.

+

{minor_version, 0} meaning that floats + will be encoded using a textual representation; this option is useful if + you want to ensure that releases prior to R11B-4 can decode resulting binary.

See also binary_to_term/1.

- - Throws an exception. + Throw an exception

A non-local return from a function. If evaluated within a - catch, catch returns value Any.

-

Example:

+ catch, catch will return the value Any.

 > catch throw({hello, there}).
 {hello,there}

Failure: nocatch if not evaluated within a catch.

- - Current time. + Current time

Returns the current time as {Hour, Minute, Second}.

-

The time zone and Daylight Saving Time correction depend on +

The time zone and daylight saving time correction depend on the underlying OS.

-

Example:

 > time().
 {9,42,44}
- - - - Current time offset - -

Returns the current time offset between - Erlang monotonic time - and - Erlang system time in - native time unit. - Current time offset added to an Erlang monotonic time gives - corresponding Erlang system time.

- -

The time offset may or may not change during operation depending - on the time - warp mode used.

- - -

A change in time offset may be observed at slightly - different points in time by different processes.

- -

If the runtime system is in - multi - time warp mode, the time offset will be changed when - the runtime system detects that the - OS system - time has changed. The runtime system will, however, - not detect this immediately when it happens. A task checking - the time offset is scheduled to execute at least once a minute, - so under normal operation this should be detected within a - minute, but during heavy load it might take longer time.

-
-
-
- - - Current time offset - -

Returns the current time offset between - Erlang monotonic time - and - Erlang system time - converted into the Unit passed as argument.

- -

Same as calling - erlang:convert_time_unit(erlang:time_offset(), native, Unit) - however optimized for commonly used Units.

-
-
- - - Current Erlang System time - - -

Returns current - Erlang system time - on the format {MegaSecs, Secs, MicroSecs}. This format is - the same as os:timestamp/0 - and the deprecated erlang:now/0 - uses. The reason for the existence of erlang:timestamp() is - purely to simplify usage for existing code that assumes this timestamp - format. Current Erlang system time can more efficiently be retrieved in - the time unit of your choice using - erlang:system_time/1.

- -

The erlang:timestamp() BIF is equivalent to:

-timestamp() -> - ErlangSystemTime = erlang:system_time(micro_seconds), - MegaSecs = ErlangSystemTime div 1000000000000, - Secs = ErlangSystemTime div 1000000 - MegaSecs*1000000, - MicroSecs = ErlangSystemTime rem 1000000, - {MegaSecs, Secs, MicroSecs}. -

It, however, uses a native implementation which does - not build garbage on the heap and with slightly better - performance.

- -

This time is not a monotonically increasing time - in the general case. For more information, see the documentation of - time warp modes in the - ERTS User's Guide.

-
- -
- Tail of a list. + Tail of a list -

Returns the tail of List, that is, - the list minus the first element, for example:

+

Returns the tail of List, that is, the list minus + the first element.

 > tl([geesties, guilies, beasties]).
 [guilies, beasties]

Allowed in guard tests.

-

Failure: badarg if List - is the empty list [].

+

Failure: badarg if List is the empty list [].

- - Sets trace flags for a process or processes. + Set trace flags for a process or processes

Turns on (if How == true) or off (if - How == false) the trace flags in - FlagList for - the process or processes represented by - PidSpec.

-

PidSpec is either a process identifier - (pid) for a local process, or one of the following atoms:

+ How == false) the trace flags in FlagList for + the process or processes represented by PidSpec.

+

PidSpec is either a pid for a local process, or one of + the following atoms:

existing -

All currently existing processes.

+

All processes currently existing.

new -

All processes that are created in the future.

+

All processes that will be created in the future.

all

All currently existing processes and all processes that - are created in the future.

+ will be created in the future.

-

FlagList can contain any number of the - following flags (the "message tags" refers to the list of - trace messages):

+

FlagList can contain any number of the following + flags (the "message tags" refers to the list of messages + following below):

all -

Sets all trace flags except {tracer, Tracer} and - cpu_timestamp, which are in their nature different +

Set all trace flags except {tracer, Tracer} and + cpu_timestamp that are in their nature different than the others.

send -

Traces sending of messages.

-

Message tags: send and +

Trace sending of messages.

+

Message tags: send, send_to_non_existing_process.

'receive' -

Traces receiving of messages.

+

Trace receiving of messages.

Message tags: 'receive'.

procs -

Traces process-related events.

+

Trace process related events.

Message tags: spawn, exit, register, unregister, link, - unlink, getting_linked, and + unlink, getting_linked, getting_unlinked.

call -

Traces certain function calls. Specify which function +

Trace certain function calls. Specify which function calls to trace by calling erlang:trace_pattern/3.

-

Message tags: call and return_from.

+

Message tags: call, return_from.

silent -

Used with the call trace flag. - The call, return_from, and return_to - trace messages are inhibited if this flag is set, but they - are executed as normal if there are match specifications.

+

Used in conjunction with the call trace flag. + The call, return_from and return_to + trace messages are inhibited if this flag is set, + but if there are match specs they are executed as normal.

Silent mode is inhibited by executing erlang:trace(_, false, [silent|_]), - or by a match specification executing the function - {silent, false}.

+ or by a match spec executing the {silent, false} + function.

The silent trace flag facilitates setting up a trace on many or even all processes in the system. - The trace can then be activated and deactivated using the match - specification function {silent,Bool}, giving - a high degree of control of which functions with which - arguments that trigger the trace.

-

Message tags: call, return_from, and + Then the interesting trace can be activated and + deactivated using the {silent,Bool} + match spec function, giving a high degree + of control of which functions with which + arguments that triggers the trace.

+

Message tags: call, return_from, return_to. Or rather, the absence of.

return_to -

Used with the call trace flag. - Traces the return from a traced function back to +

Used in conjunction with the call trace flag. + Trace the actual return from a traced function back to its caller. Only works for functions traced with - option local to + the local option to erlang:trace_pattern/3.

The semantics is that a trace message is sent when a - call traced function returns, that is, when a - chain of tail recursive calls ends. Only one trace - message is sent per chain of tail recursive calls, - so the properties of tail recursiveness for + call traced function actually returns, that is, when a + chain of tail recursive calls is ended. There will be + only one trace message sent per chain of tail recursive + calls, why the properties of tail recursiveness for function calls are kept while tracing with this flag. Using call and return_to trace together makes it possible to know exactly in which function a process executes at any time.

To get trace messages containing return values from - functions, use the {return_trace} match - specification action instead.

+ functions, use the {return_trace} match_spec + action instead.

Message tags: return_to.

running -

Traces scheduling of processes.

-

Message tags: in and out.

+

Trace scheduling of processes.

+

Message tags: in, and out.

exiting -

Traces scheduling of exiting processes.

+

Trace scheduling of an exiting processes.

Message tags: in_exiting, out_exiting, and out_exited.

garbage_collection -

Traces garbage collections of processes.

-

Message tags: gc_start and gc_end.

+

Trace garbage collections of processes.

+

Message tags: gc_start, gc_end.

timestamp -

Includes a time-stamp in all trace messages. The - time-stamp (Ts) has the same form as returned by +

Include a time stamp in all trace messages. The time + stamp (Ts) is of the same form as returned by erlang:now().

cpu_timestamp

A global trace flag for the Erlang node that makes all - trace time-stamps to be in CPU time, not wall clock time. - Only allowed with PidSpec==all. If the host - machine OS does not support high-resolution + trace timestamps be in CPU time, not wallclock. It is + only allowed with PidSpec==all. If the host + machine operating system does not support high resolution CPU time measurements, trace/3 exits with - badarg. Notice that most OS do - not synchronize this value across cores, so be prepared - that time might seem to go backwards when using this option.

+ badarg.

arity -

Used with the call trace flag. - {M, F, Arity} is specified instead of +

Used in conjunction with the call trace flag. + {M, F, Arity} will be specified instead of {M, F, Args} in call trace messages.

set_on_spawn

Makes any process created by a traced process inherit - its trace flags, including flag set_on_spawn.

+ its trace flags, including the set_on_spawn flag.

set_on_first_spawn

Makes the first process created by a traced process - inherit its trace flags, excluding flag - set_on_first_spawn.

+ inherit its trace flags, excluding + the set_on_first_spawn flag.

set_on_link

Makes any process linked by a traced process inherit its - trace flags, including flag set_on_link.

+ trace flags, including the set_on_link flag.

set_on_first_link

Makes the first process linked to by a traced process - inherit its trace flags, excluding flag - set_on_first_link.

+ inherit its trace flags, excluding + the set_on_first_link flag.

{tracer, Tracer} -

Specifies where to send the trace messages. Tracer - must be the process identifier of a local process - or the port identifier +

Specify where to send the trace messages. Tracer + must be the pid of a local process or the port identifier of a local port. If this flag is not given, trace - messages are sent to the process that called + messages will be sent to the process that called erlang:trace/3.

@@ -8081,27 +6842,27 @@ set_on_link is the same as having set_on_first_link alone. Likewise for set_on_spawn and set_on_first_spawn.

-

The tracing process receives the trace messages described - in the following list. Pid is the process identifier of the - traced process in which the traced event has occurred. The - third tuple element is the message tag.

-

If flag timestamp is given, the first tuple - element is trace_ts instead, and the time-stamp - is added last in the message tuple.

- +

If the timestamp flag is not given, the tracing + process will receive the trace messages described below. + Pid is the pid of the traced process in which + the traced event has occurred. The third element of the tuple + is the message tag.

+

If the timestamp flag is given, the first element of + the tuple will be trace_ts instead and the timestamp + is added last in the tuple.

{trace, Pid, 'receive', Msg} -

When Pid receives message Msg.

+

When Pid receives the message Msg.

{trace, Pid, send, Msg, To} -

When Pid sends message Msg to - process To.

+

When Pid sends the message Msg to + the process To.

{trace, Pid, send_to_non_existing_process, Msg, To} -

When Pid sends message Msg to +

When Pid sends the message Msg to the non-existing process To.

{trace, Pid, call, {M, F, Args}} @@ -8109,7 +6870,7 @@

When Pid calls a traced function. The return values of calls are never supplied, only the call and its arguments.

-

Trace flag arity can be used to +

Note that the trace flag arity can be used to change the contents of this message, so that Arity is specified instead of Args.

@@ -8117,34 +6878,35 @@

When Pid returns to the specified function. This trace message is sent if both - the flags call and return_to are set, + the call and the return_to flags are set, and the function is set to be traced on local function calls. The message is only sent when returning - from a chain of tail recursive function calls, where at + from a chain of tail recursive function calls where at least one call generated a call trace message - (that is, the functions match specification matched, and + (that is, the functions match specification matched and {message, false} was not an action).

{trace, Pid, return_from, {M, F, Arity}, ReturnValue}

When Pid returns from the specified - function. This trace message is sent if flag call - is set, and the function has a match specification + function. This trace message is sent if the call + flag is set, and the function has a match specification with a return_trace or exception_trace action.

{trace, Pid, exception_from, {M, F, Arity}, {Class, Value}}

When Pid exits from the specified - function because of an exception. This trace message is - sent if flag call is set, and the function has + function due to an exception. This trace message is sent + if the call flag is set, and the function has a match specification with an exception_trace action.

{trace, Pid, spawn, Pid2, {M, F, Args}}

When Pid spawns a new process Pid2 with the specified function call as entry point.

-

Args is supposed to be the argument list, - but can be any term if the spawn is erroneous.

+

Note that Args is supposed to be the argument + list, but may be any term in the case of an erroneous + spawn.

{trace, Pid, exit, Reason} @@ -8174,158 +6936,148 @@ {trace, Pid, unregister, RegName}

When Pid gets the name RegName unregistered. - This is done automatically when a registered + Note that this is done automatically when a registered process exits.

{trace, Pid, in, {M, F, Arity} | 0} -

When Pid is scheduled to run. The process - runs in function {M, F, Arity}. On some rare - occasions, the current function cannot be determined, - then the last element Arity is 0.

+

When Pid is scheduled to run. The process will + run in function {M, F, Arity}. On some rare + occasions the current function cannot be determined, then + the last element Arity is 0.

{trace, Pid, out, {M, F, Arity} | 0}

When Pid is scheduled out. The process was - running in function {M, F, Arity}. On some rare occasions, + running in function {M, F, Arity}. On some rare occasions the current function cannot be determined, then the last - element Arity is 0.

+ element Arity is 0.

- {trace, Pid, gc_start, Info} + {trace, Pid, gc_start, Info} -

Sent when garbage collection is about to be started. Info is a list of two-element tuples, where the first element is a key, and the second is the value. - Do not depend on any order of the tuples. - The following keys are defined:

+ You should not depend on the tuples have any defined + order. Currently, the following keys are defined:

heap_size The size of the used part of the heap. heap_block_size The size of the memory block used for storing - the heap and the stack. + the heap and the stack.
old_heap_size The size of the used part of the old heap. old_heap_block_size The size of the memory block used for storing - the old heap. + the old heap.
stack_size - The size of the stack. + The actual size of the stack. recent_size The size of the data that survived the previous garbage - collection. + collection. mbuf_size The combined size of message buffers associated with - the process. + the process. + bin_vheap_size - The total size of unique off-heap binaries referenced - from the process heap. + The total size of unique off-heap binaries referenced from the process heap. bin_vheap_block_size - The total size of binaries allowed in the virtual - heap in the process before doing a garbage collection. + The total size of binaries, in words, allowed in the virtual + heap in the process before doing a garbage collection. bin_old_vheap_size - The total size of unique off-heap binaries referenced - from the process old heap. - bin_old_vheap_block_size - The total size of binaries allowed in the virtual - old heap in the process before doing a garbage collection. + The total size of unique off-heap binaries referenced from the process old heap. + bin_vheap_block_size + The total size of binaries, in words, allowed in the virtual + old heap in the process before doing a garbage collection. + +

All sizes are in words.

{trace, Pid, gc_end, Info}

Sent when garbage collection is finished. Info - contains the same kind of list as in message gc_start, - but the sizes reflect the new sizes after + contains the same kind of list as in the gc_start + message, but the sizes reflect the new sizes after garbage collection.

-

If the tracing process dies, the flags are silently +

If the tracing process dies, the flags will be silently removed.

-

Only one process can trace a particular process. Therefore, - attempts to trace an already traced process fail.

+

Only one process can trace a particular process. For this + reason, attempts to trace an already traced process will fail.

Returns: A number indicating the number of processes that - matched PidSpec. - If PidSpec is a process - identifier, the return value is 1. - If PidSpec - is all or existing, the return value is + matched PidSpec. If PidSpec is a pid, + the return value will be 1. If PidSpec is + all or existing the return value will be the number of processes running, excluding tracer processes. - If PidSpec is new, the return value is + If PidSpec is new, the return value will be 0.

-

Failure: badarg if the specified arguments are - not supported. For example, cpu_timestamp is not - supported on all platforms.

+

Failure: If specified arguments are not supported. For + example cpu_timestamp is not supported on all + platforms.

- - Notification when trace has been delivered. + Notification when trace has been delivered

The delivery of trace messages is dislocated on the time-line - compared to other events in the system. If you know that - Tracee has passed some specific point - in its execution, + compared to other events in the system. If you know that the + Tracee has passed some specific point in its execution, and you want to know when at least all trace messages - corresponding to events up to this point have reached the - tracer, use erlang:trace_delivered(Tracee). A + corresponding to events up to this point have reached the tracer + you can use erlang:trace_delivered(Tracee). A {trace_delivered, Tracee, Ref} message is sent to the caller of erlang:trace_delivered(Tracee) when it - is guaranteed that all trace messages are delivered to - the tracer up to the point that Tracee reached + is guaranteed that all trace messages have been delivered to + the tracer up to the point that the Tracee had reached at the time of the call to erlang:trace_delivered(Tracee).

-

Notice that message trace_delivered does not - imply that trace messages have been delivered. - Instead it implies that all trace messages that - are to be delivered have been delivered. - It is not an error if Tracee is not, and - has not been traced by someone, but if this is the case, - no trace messages have been delivered when the +

Note that the trace_delivered message does not + imply that trace messages have been delivered; instead, it implies + that all trace messages that should be delivered have + been delivered. It is not an error if Tracee isn't, and + hasn't been traced by someone, but if this is the case, + no trace messages will have been delivered when the trace_delivered message arrives.

-

Notice that that Tracee must refer - to a process currently, +

Note that Tracee has to refer to a process currently, or previously existing on the same node as the caller of erlang:trace_delivered(Tracee) resides on. - The special Tracee atom all - denotes all processes + The special Tracee atom all denotes all processes that currently are traced in the node.

-

Example: Process A is Tracee, - port B is tracer, and process C is the port - owner of B. C wants to close B when - A exits. To ensure that the trace is not truncated, - C can call erlang:trace_delivered(A), when - A exits, and wait for message {trace_delivered, A, - Ref} before closing B.

-

Failure: badarg if Tracee - does not refer to a +

An example: Process A is Tracee, port B is + tracer, and process C is the port owner of B. + C wants to close B when A exits. C + can ensure that the trace isn't truncated by calling + erlang:trace_delivered(A) when A exits and wait + for the {trace_delivered, A, Ref} message before closing + B.

+

Failure: badarg if Tracee does not refer to a process (dead or alive) on the same node as the caller of erlang:trace_delivered(Tracee) resides on.

- - Trace information about a process or function. + Trace information about a process or function

Returns trace information about a process or function.

-

To get information about a process, - PidOrFunc is to - be a process identifier (pid) or the atom new. - The atom new means that the default trace state for - processes to be created is returned.

-

The following Items are valid:

+

To get information about a process, PidOrFunc should + be a pid or the atom new. The atom new means + that the default trace state for processes to be created will + be returned. Item must have one of the following + values:

flags -

Returns a list of atoms indicating what kind of traces is - enabled for the process. The list is empty if no +

Return a list of atoms indicating what kind of traces is + enabled for the process. The list will be empty if no traces are enabled, and one or more of the followings atoms if traces are enabled: send, 'receive', set_on_spawn, call, @@ -8336,474 +7088,358 @@ tracer -

Returns the identifier for process or port tracing this +

Return the identifier for process or port tracing this process. If this process is not being traced, the return - value is [].

+ value will be [].

-

To get information about a function, PidOrFunc is to - be the three-element tuple {Module, Function, Arity} or - the atom on_load. No wild cards are allowed. Returns - undefined if the function does not exist, or - false if the function is not traced.

-

The following Items are valid::

+

To get information about a function, PidOrFunc should + be a three-element tuple: {Module, Function, Arity} or + the atom on_load. No wildcards are allowed. Returns + undefined if the function does not exist or + false if the function is not traced at all. Item + must have one of the following values:

traced -

Returns global if this function is traced on +

Return global if this function is traced on global function calls, local if this function is - traced on local function calls (that is, local and global - function calls), and false if local or - global function calls are not traced.

+ traced on local function calls (i.e local and global + function calls), and false if neither local nor + global function calls are traced.

match_spec -

Returns the match specification for this function, if it +

Return the match specification for this function, if it has one. If the function is locally or globally traced but has no match specification defined, the returned value is [].

meta -

Returns the meta-trace tracer process or port for this - function, if it has one. If the function is not - meta-traced, the returned value is false. If - the function is meta-traced but has once detected that - the tracer process is invalid, the returned value is [].

+

Return the meta trace tracer process or port for this + function, if it has one. If the function is not meta + traced the returned value is false, and if + the function is meta traced but has once detected that + the tracer proc is invalid, the returned value is [].

meta_match_spec -

Returns the meta-trace match specification for this - function, if it has one. If the function is meta-traced +

Return the meta trace match specification for this + function, if it has one. If the function is meta traced but has no match specification defined, the returned value is [].

call_count -

Returns the call count value for this function or +

Return the call count value for this function or true for the pseudo function on_load if call - count tracing is active. Otherwise false is returned. + count tracing is active. Return false otherwise. See also erlang:trace_pattern/3.

call_time -

Returns the call time values for this function or +

Return the call time values for this function or true for the pseudo function on_load if call - time tracing is active. Otherwise false is returned. + time tracing is active. Returns false otherwise. The call time values returned, [{Pid, Count, S, Us}], - is a list of each process that executed the function - and its specific counters. See also + is a list of each process that has executed the function and its specific counters. + See also erlang:trace_pattern/3.

all -

Returns a list containing the - {Item, Value} tuples - for all other items, or returns false if no tracing +

Return a list containing the {Item, Value} tuples + for all other items, or return false if no tracing is active for this function.

-

The return value is {Item, Value}, where - Value is the requested information as described earlier. +

The actual return value will be {Item, Value}, where + Value is the requested information as described above. If a pid for a dead process was given, or the name of a - non-existing function, Value is undefined.

-

If PidOrFunc is on_load, the information + non-existing function, Value will be undefined.

+

If PidOrFunc is the on_load, the information returned refers to the default value for code that will be loaded.

- - Sets trace patterns for global call tracing. + Set trace patterns for global call tracing

The same as erlang:trace_pattern(MFA, MatchSpec, []), retained for backward compatibility.

- - Sets trace patterns for tracing of function calls. + Set trace patterns for tracing of function calls -

Enables or disables call tracing for - one or more functions. Must be combined with +

This BIF is used to enable or disable call tracing for + exported functions. It must be combined with erlang:trace/3 to set the call trace flag for one or more processes.

-

Conceptually, call tracing works as follows. Inside - the Erlang Virtual Machine, a set of processes and - a set of functions are to be traced. If a traced process - calls a traced function, the trace action is taken. - Otherwise, nothing happens.

-

To add or remove one or more processes to the set of traced - processes, use - erlang:trace/3.

-

To add or remove functions to the set of traced - functions, use erlang:trace_pattern/3.

-

The BIF erlang:trace_pattern/3 can also add match - specifications to a function. A match specification - comprises a pattern that the function arguments must - match, a guard expression that must evaluate to true, +

Conceptually, call tracing works like this: Inside + the Erlang virtual machine there is a set of processes to be + traced and a set of functions to be traced. Tracing will be + enabled on the intersection of the set. That is, if a process + included in the traced process set calls a function included + in the traced function set, the trace action will be taken. + Otherwise, nothing will happen.

+

Use + erlang:trace/3 to + add or remove one or more processes to the set of traced + processes. Use erlang:trace_pattern/2 to add or remove + exported functions to the set of traced functions.

+

The erlang:trace_pattern/3 BIF can also add match + specifications to an exported function. A match specification + comprises a pattern that the arguments to the function must + match, a guard expression which must evaluate to true and an action to be performed. The default action is to send a trace message. If the pattern does not match or the guard - fails, the action is not executed.

-

Argument MFA is to be a tuple, such as - {Module, Function, Arity}, or the atom on_load - (described in the following). It can be the module, function, - and arity for a function (or a BIF in any module). - The atom '_' can be used as a wild card in any of the - following ways:

+ fails, the action will not be executed.

+

The MFA argument should be a tuple like + {Module, Function, Arity} or the atom on_load + (described below). It can be the module, function, and arity + for an exported function (or a BIF in any module). + The '_' atom can be used to mean any of that kind. + Wildcards can be used in any of the following ways:

{Module,Function,'_'} -

All functions of any arity named Function +

All exported functions of any arity named Function in module Module.

{Module,'_','_'} -

All functions in module Module.

+

All exported functions in module Module.

{'_','_','_'} -

All functions in all loaded modules.

+

All exported functions in all loaded modules.

Other combinations, such as {Module,'_',Arity}, are - not allowed. Local functions match wild cards only if - option local is in FlagList.

-

If argument MFA is the atom on_load, - the match specification and flag list are used on all + not allowed. Local functions will match wildcards only if + the local option is in the FlagList.

+

If the MFA argument is the atom on_load, + the match specification and flag list will be used on all modules that are newly loaded.

-

Argument MatchSpec can take the - following forms:

+

The MatchSpec argument can take any of the following + forms:

false -

Disables tracing for the matching functions. - Any match specification is removed.

+

Disable tracing for the matching function(s). Any match + specification will be removed.

true -

Enables tracing for the matching functions.

+

Enable tracing for the matching function(s).

MatchSpecList

A list of match specifications. An empty list is - equivalent to true. For a description of match - specifications, see the User's Guide.

+ equivalent to true. See the ERTS User's Guide + for a description of match specifications.

restart -

For the FlagList options call_count - and call_time: restarts - the existing counters. The behavior is undefined +

For the FlagList option call_count and call_time: + restart the existing counters. The behaviour is undefined for other FlagList options.

pause -

For the FlagList options - call_count and call_time: pauses - the existing counters. The behavior is undefined for - other FlagList options.

+

For the FlagList option call_count and call_time: pause + the existing counters. The behaviour is undefined for + other FlagList options.

-

Parameter FlagList is a list of options. - The following are the valid options:

+

The FlagList parameter is a list of options. + The following options are allowed:

global -

Turns on or off call tracing for global function calls +

Turn on or off call tracing for global function calls (that is, calls specifying the module explicitly). Only - exported functions match and only global calls - generate trace messages. This is the default.

+ exported functions will match and only global calls will + generate trace messages. This is the default.

local -

Turns on or off call tracing for all types of function - calls. Trace messages are sent whenever any of +

Turn on or off call tracing for all types of function + calls. Trace messages will be sent whenever any of the specified functions are called, regardless of how they - are called. If flag return_to is set for - the process, a return_to message is also sent + are called. If the return_to flag is set for + the process, a return_to message will also be sent when this function returns to its caller.

meta | {meta, Pid} -

Turns on or off meta-tracing for all types of function - calls. Trace messages are sent to the tracer process +

Turn on or off meta tracing for all types of function + calls. Trace messages will be sent to the tracer process or port Pid whenever any of the specified functions are called, regardless of how they are called. - If no Pid is specified, - self() is used as a default tracer process.

-

Meta-tracing traces all processes and does not care + If no Pid is specified, self() is used as a + default tracer process.

+

Meta tracing traces all processes and does not care about the process trace flags set by trace/3, the trace flags are instead fixed to [call, timestamp].

-

The match specification function {return_trace} - works with meta-trace and sends its trace message to the - same tracer process.

+

The match spec function {return_trace} works with + meta trace and send its trace message to the same tracer + process.

call_count

Starts (MatchSpec == true) or stops - (MatchSpec == false) - call count tracing for all - types of function calls. For every function, a counter is + (MatchSpec == false) call count tracing for all + types of function calls. For every function a counter is incremented when the function is called, in any process. No process trace flags need to be activated.

If call count tracing is started while already running, - the count is restarted from zero. To pause running - counters, use MatchSpec == pause. - Paused and running counters can be restarted from zero with + the count is restarted from zero. Running counters can be + paused with MatchSpec == pause. Paused and running + counters can be restarted from zero with MatchSpec == restart.

-

To read the counter value, use +

The counter value can be read with erlang:trace_info/2.

call_time

Starts (MatchSpec == true) or stops - (MatchSpec == false) call time - tracing for all - types of function calls. For every function, a counter is - incremented when the function is called. - Time spent in the function is accumulated in - two other counters, seconds and microseconds. + (MatchSpec == false) call time tracing for all + types of function calls. For every function a counter is + incremented when the function is called. Time spent in the function + is accumulated in two other counters, seconds and micro-seconds. The counters are stored for each call traced process.

If call time tracing is started while already running, - the count and time is restarted from zero. To pause - running counters, use MatchSpec == pause. - Paused and running counters can be restarted from zero with + the count and time is restarted from zero. Running counters can be + paused with MatchSpec == pause. Paused and running + counters can be restarted from zero with MatchSpec == restart.

-

To read the counter value, use +

The counter value can be read with erlang:trace_info/2.

+
-

The options global and local are mutually - exclusive, and global is the default (if no options are - specified). The options call_count and meta - perform a kind of local tracing, and cannot be combined - with global. A function can be globally or +

The global and local options are mutually + exclusive and global is the default (if no options are + specified). The call_count and meta options + perform a kind of local tracing, and can also not be combined + with global. A function can be either globally or locally traced. If global tracing is specified for a - set of functions, then local, meta, call time, and call count - tracing for the matching set of local functions is - disabled, and conversely.

+ specified set of functions; local, meta, call time and call count + tracing for the matching set of local functions will be + disabled, and vice versa.

When disabling trace, the option must match the type of trace - set on the function. That is, local tracing must be - disabled with option local and global tracing with - option global (or no option), and so forth.

-

Part of a match specification list cannot be changed directly. - If a function has a match specification, it can be replaced - with a new one. To change an existing match specification, - use the BIF + that is set on the function, so that local tracing must be + disabled with the local option and global tracing with + the global option (or no option at all), and so forth.

+

There is no way to directly change part of a match + specification list. If a function has a match specification, + you can replace it with a completely new one. If you need to + change an existing match specification, use the erlang:trace_info/2 - to retrieve the existing match specification.

-

Returns the number of functions matching - argument MFA. This is zero if none matched.

+ BIF to retrieve the existing match specification.

+

Returns the number of exported functions that matched + the MFA argument. This will be zero if none matched at + all.

- - Returns an integer by truncating a number + Return an integer by the truncating a number -

Returns an integer by truncating Number, - for example:

+

Returns an integer by the truncating Number.

 > trunc(5.5).
 5

Allowed in guard tests.

- - Returns the size of a tuple. + Return the size of a tuple -

Returns an integer that is the number of elements in - Tuple, for example:

+

Returns an integer which is the number of elements in Tuple.

 > tuple_size({morni, mulle, bwange}).
 3

Allowed in guard tests.

- - Converts a tuple to a list. + Convert a tuple to a list -

Returns a list corresponding to Tuple. - Tuple can contain any Erlang terms.

-

Example:

+

Returns a list which corresponds to Tuple. + Tuple may contain any Erlang terms.

 > tuple_to_list({share, {'Ericsson_B', 163}}).
 [share,{'Ericsson_B',163}]
- - Current date and time according to Universal Time Coordinated (UTC). + Current date and time according to Universal Time Coordinated (UTC)

Returns the current date and time according to Universal - Time Coordinated (UTC) in the form + Time Coordinated (UTC), also called GMT, in the form {{Year, Month, Day}, {Hour, Minute, Second}} if - supported by the underlying OS. - Otherwise erlang:universaltime() is equivalent to + supported by the underlying operating system. If not, + erlang:universaltime() is equivalent to erlang:localtime().

-

Example:

 > erlang:universaltime().
 {{1996,11,6},{14,18,43}}
- - Converts from Universal Time Coordinated (UTC) to local date and time. + Convert from Universal Time Coordinated (UTC) to local date and time

Converts Universal Time Coordinated (UTC) date and time to - local date and time in the form - {{Year, Month, Day}, {Hour, Minute, Second}} if - supported by the underlying OS. - Otherwise no conversion is done, and + local date and time, if this is supported by the underlying + OS. Otherwise, no conversion is done, and Universaltime is returned.

-

Example:

 > erlang:universaltime_to_localtime({{1996,11,6},{14,18,43}}).
 {{1996,11,7},{15,18,43}}
-

Failure: badarg if Universaltime denotes - an invalid date and time.

-
-
- - - - Get a unique integer value - -

Generates and returns an - integer - unique on current runtime system instance. The same as calling - erlang:unique_integer([]).

-
-
- - - Get a unique integer value - -

Generates and returns an - integer - unique on current runtime system - instance. The integer is unique in the - sense that this BIF, using the same set of - modifiers, will not return the same integer more - than once on the current runtime system instance. - Each integer value can of course be constructed - by other means.

- -

By default, when [] is passed as - ModifierList, both negative and - positive integers can be returned. This in order - to utilize the range of integers that do - not need heap memory allocation as much as possible. - By default the returned integers are also only - guaranteed to be unique, that is, any returned integer - can be smaller or larger than previously - returned integers.

- -

Valid Modifiers:

- - - positive -

Return only positive integers.

-

Note that by passing the positive modifier - you will get heap allocated integers (bignums) - quicker.

-
- - monotonic -

Return - strictly - monotonically increasing integers - corresponding to creation time. That is, the integer - returned will always be larger than previously - returned integers on the current runtime system - instance.

-

These values can be used to determine order between events - on the runtime system instance. That is, if both - X = erlang:unique_integer([monotonic]) and - Y = erlang:unique_integer([monotonic]) are - executed by different processes (or the same - process) on the same runtime system instance and - X < Y we know that X was created - before Y.

-

Strictly monotonically increasing values - are inherently quite expensive to generate and scales - poorly. This is because the values need to be - synchronized between cpu cores. That is, do not pass the monotonic - modifier unless you really need strictly monotonically - increasing values.

-
- -
- -

All valid Modifiers - can be combined. Repeated (valid) - Modifiers in the ModifierList - are ignored.

- -

Note that the set of integers returned by - unique_integer/1 using different sets of - Modifiers will overlap. - For example, by calling unique_integer([monotonic]), - and unique_integer([positive, monotonic]) - repeatedly, you will eventually see some integers being - returned by both calls.

- -

Failures:

- - badarg - if ModifierList is not a - proper list. - badarg - if Modifier is not a - valid modifier. - +

Failure: badarg if Universaltime does not denote + a valid date and time.

- Removes a link to another process or port. + Remove a link, if there is one, to another process or port

Removes the link, if there is one, between the calling - process and the process or port referred to by - Id.

+ process and the process or port referred to by Id.

Returns true and does not fail, even if there is no - link to Id, or if Id - does not exist.

-

Once unlink(Id) has returned, - it is guaranteed that + link to Id, or if Id does not exist.

+

Once unlink(Id) has returned it is guaranteed that the link between the caller and the entity referred to by - Id has no effect on the caller - in the future (unless - the link is setup again). If the caller is trapping exits, an - {'EXIT', Id, _} message from the link - can have been placed in the caller's message queue before - the call.

-

Notice that the {'EXIT', Id, _} - message can be the - result of the link, but can also be the result of Id - calling exit/2. Therefore, it can be - appropriate to clean up the message queue when trapping exits - after the call to unlink(Id), as follows:

+ Id has no effect on the caller in the future (unless + the link is setup again). If caller is trapping exits, an + {'EXIT', Id, _} message due to the link might have + been placed in the caller's message queue prior to the call, + though. Note, the {'EXIT', Id, _} message can be the + result of the link, but can also be the result of Id + calling exit/2. Therefore, it may be + appropriate to cleanup the message queue when trapping exits + after the call to unlink(Id), as follow:

+ unlink(Id), receive {'EXIT', Id, _} -> @@ -8812,25 +7448,23 @@ true end -

Prior to OTP release R11B (ERTS version 5.5) unlink/1 - behaved completely asynchronously, i.e., the link was active +

Prior to OTP release R11B (erts version 5.5) unlink/1 + behaved completely asynchronous, i.e., the link was active until the "unlink signal" reached the linked entity. This - had an undesirable effect, as you could never know when + had one undesirable effect, though. You could never know when you were guaranteed not to be effected by the link.

-

The current behavior can be viewed as two combined operations: +

Current behavior can be viewed as two combined operations: asynchronously send an "unlink signal" to the linked entity and ignore any future results of the link.

- - Removes the registered name for a process (or port). + Remove the registered name for a process (or port) -

Removes the registered name RegName - associated with a - process identifier or a port identifier, for example:

+

Removes the registered name RegName, associated with a + pid or a port identifier.

 > unregister(db).
 true
@@ -8839,34 +7473,31 @@ name.

- - Gets the pid (or port) with a given registered name. + Get the pid (or port) with a given registered name -

Returns the process identifier or port identifier with - the registered name RegName. Returns undefined - if the name is not registered.

-

Example:

+

Returns the pid or port identifier with the registered name + RegName. Returns undefined if the name is not + registered.

 > whereis(db).
 <0.43.0>
- - Lets other processes get a chance to execute. + Let other processes get a chance to execute -

Voluntarily lets other processes (if any) get a chance to +

Voluntarily let other processes (if any) get a chance to execute. Using erlang:yield() is similar to receive after 1 -> ok end, except that yield() is faster.

There is seldom or never any need to use this BIF, - especially in the SMP emulator, as other processes have a - chance to run in another scheduler thread anyway. - Using this BIF without a thorough grasp of how the scheduler - works can cause performance degradation.

+ especially in the SMP-emulator as other processes will have a + chance to run in another scheduler thread anyway. + Using this BIF without a thorough grasp of how the scheduler + works may cause performance degradation.

diff -Nru erlang-18.2-dfsg/erts/doc/src/erlc.xml erlang-17.3-dfsg/erts/doc/src/erlc.xml --- erlang-18.2-dfsg/erts/doc/src/erlc.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/erlc.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/erl_dist_protocol.xml erlang-17.3-dfsg/erts/doc/src/erl_dist_protocol.xml --- erlang-18.2-dfsg/erts/doc/src/erl_dist_protocol.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/erl_dist_protocol.xml 2014-09-16 19:10:57.000000000 +0000 @@ -5,21 +5,20 @@
2007 - 2015 + 2013 Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -549,10 +548,10 @@ -->
+
Distribution Handshake

- This section describes the distribution handshake protocol introduced in the OTP-R6 release of Erlang/OTP. This description was previously located in diff -Nru erlang-18.2-dfsg/erts/doc/src/erl_driver.xml erlang-17.3-dfsg/erts/doc/src/erl_driver.xml --- erlang-18.2-dfsg/erts/doc/src/erl_driver.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/erl_driver.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@

- 20012015 + 20012014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -223,7 +222,7 @@ asynchronous function calls, using a thread pool provided by Erlang. There is also a select call, that can be used for asynchronous drivers. - Multi-threading + Multi-threading

A POSIX thread like API for multi-threading is provided. The Erlang driver thread API only provide a subset of the functionality @@ -297,7 +296,7 @@

A driver can add and later remove drivers.

Monitoring processes

A driver can monitor a process that does not own a port.

- Version management + Version management

Version management is enabled for drivers that have set the extended_marker @@ -384,12 +383,12 @@

Rewrite driver callback - control + control to use return type ErlDrvSSizeT instead of int.

Rewrite driver callback - call + call to use return type ErlDrvSSizeT instead of int.

@@ -407,19 +406,19 @@

Driver callback - output + output now gets ErlDrvSizeT as 3rd argument instead of previously int.

Driver callback - control + control now gets ErlDrvSizeT as 4th and 6th arguments instead of previously int.

Driver callback - call + call now gets ErlDrvSizeT as 4th and 6th arguments instead of previously int.

@@ -2034,8 +2033,7 @@ entry function is called. If ready_async is null in the driver entry, the async_free function is called instead.

-

The return value is -1 if the driver_async call - fails.

+

The return value is a handle to the asynchronous task.

As of erts version 5.5.4.3 the default stack size for threads in the async-thread pool is 16 kilowords, @@ -2811,7 +2809,7 @@ - interl_drv_putenv(const char *key, char *value) + interl_drv_putenv(char *key, char *value) Set the value of an environment variable @@ -2840,7 +2838,7 @@ - interl_drv_getenv(const char *key, char *value, size_t *value_size) + interl_drv_getenv(char *key, char *value, size_t *value_size) Get the value of an environment variable diff -Nru erlang-18.2-dfsg/erts/doc/src/erl_ext_dist.xml erlang-17.3-dfsg/erts/doc/src/erl_ext_dist.xml --- erlang-18.2-dfsg/erts/doc/src/erl_ext_dist.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/erl_ext_dist.xml 2014-09-16 19:10:57.000000000 +0000 @@ -5,21 +5,20 @@

2007 - 2015 + 2014 Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -127,8 +126,9 @@ However, only characters that can be encoded using Latin1 (ISO-8859-1) are currently supported in atoms. The support for UTF-8 encoded atoms in the external format has been implemented in order to be able to support - all Unicode characters in atoms in some future release. - Until full Unicode support for + all Unicode characters in atoms in some future release. Full + support for Unicode atoms will not happen before OTP-R18, and might + be introduced even later than that. Until full Unicode support for atoms has been introduced, it is an error to pass atoms containing characters that cannot be encoded in Latin1, and the behavior is undefined.

@@ -150,10 +150,10 @@
+
Distribution header

- As of erts version 5.7.2 the old atom cache protocol was dropped and a new one was introduced. This atom cache protocol introduced the distribution header. Nodes with erts versions diff -Nru erlang-18.2-dfsg/erts/doc/src/erl_nif.xml erlang-17.3-dfsg/erts/doc/src/erl_nif.xml --- erlang-18.2-dfsg/erts/doc/src/erl_nif.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/erl_nif.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@

- 20012015 + 20012013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -67,6 +66,34 @@ +

The NIF concept is officially supported from R14B. NIF source code + written for earlier experimental versions might need adaption to run on R14B + or later versions:

+ + No incompatible changes between R14B and R14A. + Incompatible changes between R14A and R13B04: + + Environment argument removed for enif_alloc, + enif_realloc, enif_free, enif_alloc_binary, + enif_realloc_binary, enif_release_binary, + enif_alloc_resource, enif_release_resource, + enif_is_identical and enif_compare. + Character encoding argument added to enif_get_atom + and enif_make_existing_atom. + Module argument added to enif_open_resource_type + while changing name spaces of resource types from global to module local. + + + Incompatible changes between R13B04 and R13B03: + + The function prototypes of the NIFs have changed to expect argc and argv + arguments. The arity of a NIF is by that no longer limited to 3. + enif_get_data renamed as enif_priv_data. + enif_make_string got a third argument for character encoding. + + + +

A minimal example of a NIF library can look like this:

@@ -462,9 +489,8 @@ independent environment with all its terms is valid until you explicitly invalidates it with enif_free_env or enif_send.

-

All contained terms of a list/tuple/map must belong to the same - environment as the list/tuple/map itself. Terms can be copied between - environments with +

All elements of a list/tuple must belong to the same environment as the + list/tuple itself. Terms can be copied between environments with enif_make_copy.

ErlNifFunc @@ -566,11 +592,11 @@ void *enif_alloc(size_t size) - Allocate dynamic memory + Allocate dynamic memory.

Allocate memory of size bytes. Return NULL if allocation failed.

intenif_alloc_binary(size_t size, ErlNifBinary* bin) - Create a new binary + Create a new binary.

Allocate a new binary of size size bytes. Initialize the structure pointed to by bin to refer to the allocated binary. The binary must either be released by @@ -597,7 +623,7 @@

Allocate a memory managed resource object of type type and size size bytes.

voidenif_clear_env(ErlNifEnv* env) - Clear an environment for reuse + Clear an environment for reuse.

Free all terms in an environment and clear it for reuse. The environment must have been allocated with enif_alloc_env.

@@ -685,14 +711,14 @@ size-1.

intenif_get_atom_length(ErlNifEnv* env, ERL_NIF_TERM term, unsigned* len, ErlNifCharEncoding encode) - Get the length of atom term + Get the length of atom term.

Set *len to the length (number of bytes excluding terminating null character) of the atom term with encoding encode. Return true on success or false if term is not an atom.

intenif_get_double(ErlNifEnv* env, ERL_NIF_TERM term, double* dp) - Read a floating-point number term + Read a floating-point number term.

Set *dp to the floating point value of term. Return true on success or false if term is not a float.

@@ -721,28 +747,17 @@ non-empty list.

intenif_get_list_length(ErlNifEnv* env, ERL_NIF_TERM term, unsigned* len) - Get the length of list term + Get the length of list term.

Set *len to the length of list term and return true, or return false if term is not a list.

intenif_get_long(ErlNifEnv* env, ERL_NIF_TERM term, long int* ip) - Read an long integer term + Read an long integer term.

Set *ip to the long integer value of term and return true, or return false if term is not an integer or is outside the bounds of type long int.

- intenif_get_map_size(ErlNifEnv* env, ERL_NIF_TERM term, size_t *size) - Read the size of a map term -

Set *size to the number of key-value pairs in the map term and - return true, or return false if term is not a map.

-
- intenif_get_map_value(ErlNifEnv* env, ERL_NIF_TERM map, ERL_NIF_TERM key, ERL_NIF_TERM* value) - Get the value of a key in a map -

Set *value to the value associated with key in the - map map and return true. Return false if map is not a map - or if map does not contain key.

-
- intenif_get_resource(ErlNifEnv* env, ERL_NIF_TERM term, ErlNifResourceType* type, void** objp) + intenif_get_resource(ErlNifEnv* env, ERL_NIF_TERM term, ErlNifResourceType* type, void** objp) Get the pointer to a resource object

Set *objp to point to the resource object referred to by term.

Return true on success or false if term is not a handle to a resource object @@ -751,7 +766,7 @@ intenif_get_string(ErlNifEnv* env, ERL_NIF_TERM list, char* buf, unsigned size, ErlNifCharEncoding encode) - Get a C-string from a list + Get a C-string from a list.

Write a null-terminated string, in the buffer pointed to by buf with size size, consisting of the characters in the string list. The characters are written using encoding @@ -764,7 +779,7 @@ size is less than 1.

intenif_get_tuple(ErlNifEnv* env, ERL_NIF_TERM term, int* arity, const ERL_NIF_TERM** array) - Inspect the elements of a tuple + Inspect the elements of a tuple.

If term is a tuple, set *array to point to an array containing the elements of the tuple and set *arity to the number of elements. Note that the array @@ -774,40 +789,23 @@ tuple.

intenif_get_uint(ErlNifEnv* env, ERL_NIF_TERM term, unsigned int* ip) - Read an unsigned integer term + Read an unsigned integer term.

Set *ip to the unsigned integer value of term and return true, or return false if term is not an unsigned integer or is outside the bounds of type unsigned int.

intenif_get_uint64(ErlNifEnv* env, ERL_NIF_TERM term, ErlNifUInt64* ip) - Read an unsigned 64-bit integer term + Read an unsigned 64-bit integer term.

Set *ip to the unsigned integer value of term and return true, or return false if term is not an unsigned integer or is outside the bounds of an unsigned 64-bit integer.

intenif_get_ulong(ErlNifEnv* env, ERL_NIF_TERM term, unsigned long* ip) - Read an unsigned integer term + Read an unsigned integer term.

Set *ip to the unsigned long integer value of term and return true, or return false if term is not an unsigned integer or is outside the bounds of type unsigned long.

- intenif_getenv(const char* key, char* value, size_t *value_size) - Get the value of an environment variable -

Same as erl_drv_getenv.

-
- intenif_has_pending_exception(ErlNifEnv* env, ERL_NIF_TERM* reason) - Check if an exception has been raised -

Return true if a pending exception is associated - with the environment env. If reason is a null pointer, ignore it. - Otherwise, if there's a pending exception associated with env, set the ERL_NIF_TERM - to which reason points to the value of the exception's term. For example, if - enif_make_badarg is called to set a - pending badarg exception, a subsequent call to enif_has_pending_exception(env, &reason) - will set reason to the atom badarg, then return true.

-

See also: enif_make_badarg - and enif_raise_exception.

-
-
intenif_inspect_binary(ErlNifEnv* env, ERL_NIF_TERM bin_term, ErlNifBinary* bin) Inspect the content of a binary

Initialize the structure pointed to by bin with @@ -837,14 +835,9 @@ Determine if a term is an empty list

Return true if term is an empty list.

- intenif_is_exception(ErlNifEnv* env, ERL_NIF_TERM term) + intenif_is_exception(ErlNifEnv* env, ERL_NIF_TERM term) Determine if a term is an exception - -

Return true if term is an exception.

-
- intenif_is_map(ErlNifEnv* env, ERL_NIF_TERM term) - Determine if a term is a map -

Return true if term is a map, false otherwise.

+

Return true if term is an exception.

intenif_is_number(ErlNifEnv* env, ERL_NIF_TERM term) Determine if a term is a number (integer or float) @@ -905,58 +898,40 @@ ERL_NIF_TERMenif_make_atom(ErlNifEnv* env, const char* name) Create an atom term

Create an atom term from the null-terminated C-string name - with iso-latin-1 encoding. If the length of name exceeds the maximum length - allowed for an atom (255 characters), enif_make_atom invokes - enif_make_badarg. -

+ with iso-latin-1 encoding.

ERL_NIF_TERMenif_make_atom_len(ErlNifEnv* env, const char* name, size_t len) Create an atom term

Create an atom term from the string name with length len. - Null-characters are treated as any other characters. If len is greater than the maximum length - allowed for an atom (255 characters), enif_make_atom invokes - enif_make_badarg. -

+ Null-characters are treated as any other characters.

ERL_NIF_TERMenif_make_badarg(ErlNifEnv* env) - Make a badarg exception -

Make a badarg exception to be returned from a NIF, and associate - it with the environment env. Once a NIF or any function - it calls invokes enif_make_badarg, the runtime ensures that a - badarg exception is raised when the NIF returns, even if the NIF - attempts to return a non-exception term instead. - The return value from enif_make_badarg may be used only as the - return value from the NIF that invoked it (directly or indirectly) - or be passed to - enif_is_exception, but - not to any other NIF API function.

-

See also: enif_has_pending_exception - and enif_raise_exception -

-

In earlier versions (older than erts-7.0, OTP 18) the return value - from enif_make_badarg had to be returned from the NIF. This - requirement is now lifted as the return value from the NIF is ignored - if enif_make_badarg has been invoked.

+ Make a badarg exception. +

Make a badarg exception to be returned from a NIF, and set + an associated exception reason in env. If + enif_make_badarg is called, the term it returns must + be returned from the function that called it. No other return value + is allowed. Also, the term returned from enif_make_badarg may + be passed only to + enif_is_exception and + not to any other NIF API function.

ERL_NIF_TERMenif_make_binary(ErlNifEnv* env, ErlNifBinary* bin) - Make a binary term + Make a binary term.

Make a binary term from bin. Any ownership of the binary data will be transferred to the created term and bin should be considered read-only for the rest of the NIF call and then as released.

ERL_NIF_TERMenif_make_copy(ErlNifEnv* dst_env, ERL_NIF_TERM src_term) - Make a copy of a term + Make a copy of a term.

Make a copy of term src_term. The copy will be created in environment dst_env. The source term may be located in any environment.

ERL_NIF_TERMenif_make_double(ErlNifEnv* env, double d) Create a floating-point term -

Create a floating-point term from a double. If the double argument is - not finite or is NaN, enif_make_double invokes - enif_make_badarg. -

+

Create a floating-point term from a double.

intenif_make_existing_atom(ErlNifEnv* env, const char* name, ERL_NIF_TERM* atom, ErlNifCharEncoding encode) Create an existing atom term @@ -964,9 +939,7 @@ the null-terminated C-string name with encoding encode. If the atom already exists store the term in *atom and return true, otherwise - return false. If the length of name exceeds the maximum length - allowed for an atom (255 characters), enif_make_existing_atom - returns false.

+ return false.

intenif_make_existing_atom_len(ErlNifEnv* env, const char* name, size_t len, ERL_NIF_TERM* atom, ErlNifCharEncoding encoding) Create an existing atom term @@ -974,9 +947,7 @@ string name with length len and encoding encode. Null-characters are treated as any other characters. If the atom already exists store the term - in *atom and return true, otherwise return false. If len is greater - than the maximum length allowed for an atom (255 characters), - enif_make_existing_atom_len returns false.

+ in *atom and return true, otherwise return false.

ERL_NIF_TERMenif_make_int(ErlNifEnv* env, int i) Create an integer term @@ -987,7 +958,7 @@

Create an integer term from a signed 64-bit integer.

ERL_NIF_TERMenif_make_list(ErlNifEnv* env, unsigned cnt, ...) - Create a list term + Create a list term.

Create an ordinary list term of length cnt. Expects cnt number of arguments (after cnt) of type ERL_NIF_TERM as the elements of the list. An empty list is returned if cnt is 0.

@@ -1001,21 +972,28 @@ ERL_NIF_TERMenif_make_list7(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e7) ERL_NIF_TERMenif_make_list8(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e8) ERL_NIF_TERMenif_make_list9(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e9) - Create a list term + Create a list term.

Create an ordinary list term with length indicated by the function name. Prefer these functions (macros) over the variadic enif_make_list to get a compile time error if the number of arguments does not match.

ERL_NIF_TERMenif_make_list_cell(ErlNifEnv* env, ERL_NIF_TERM head, ERL_NIF_TERM tail) - Create a list cell + Create a list cell.

Create a list cell [head | tail].

ERL_NIF_TERMenif_make_list_from_array(ErlNifEnv* env, const ERL_NIF_TERM arr[], unsigned cnt) - Create a list term from an array + Create a list term from an array.

Create an ordinary list containing the elements of array arr of length cnt. An empty list is returned if cnt is 0.

+ intenif_make_reverse_list(ErlNifEnv* env, ERL_NIF_TERM term, ERL_NIF_TERM *list) + Create the reverse list of the list term. +

Set *list to the reverse list of the list term and return true, + or return false if term is not a list. This function should only be used on + short lists as a copy will be created of the list which will not be released until after the + nif returns.

+
ERL_NIF_TERMenif_make_long(ErlNifEnv* env, long int i) Create an integer term from a long int

Create an integer term from a long int.

@@ -1030,42 +1008,12 @@ reallocated.

Return a pointer to the raw binary data and set *termp to the binary term.

- ERL_NIF_TERMenif_make_new_map(ErlNifEnv* env) - Make an empty map term -

Make an empty map term.

-
- intenif_make_map_put(ErlNifEnv* env, ERL_NIF_TERM map_in, ERL_NIF_TERM key, ERL_NIF_TERM value, ERL_NIF_TERM* map_out) - Insert key-value pair in map -

Make a copy of map map_in and insert key with - value. If key already exists in map_in, the old - associated value is replaced by value. If successful set - *map_out to the new map and return true. Return false if - map_in is not a map.

-

The map_in term must belong to the environment env.

-
- intenif_make_map_update(ErlNifEnv* env, ERL_NIF_TERM map_in, ERL_NIF_TERM key, ERL_NIF_TERM new_value, ERL_NIF_TERM* map_out) - Replace value for key in map -

Make a copy of map map_in and replace the old associated - value for key with new_value. If successful set - *map_out to the new map and return true. Return false if - map_in is not a map or if it does no contain key.

-

The map_in term must belong to the environment env.

-
- intenif_make_map_remove(ErlNifEnv* env, ERL_NIF_TERM map_in, ERL_NIF_TERM key, ERL_NIF_TERM* map_out) - Remove key from map -

If map map_in contains key, make a copy of - map_in in *map_out and remove key and associated - value. If map map_in does not contain key, set - *map_out to map_in. Return true for success or false if - map_in is not a map.

-

The map_in term must belong to the environment env.

-
ERL_NIF_TERMenif_make_pid(ErlNifEnv* env, const ErlNifPid* pid) Make a pid term

Make a pid term from *pid.

ERL_NIF_TERMenif_make_ref(ErlNifEnv* env) - Create a reference + Create a reference.

Create a reference like erlang:make_ref/0.

ERL_NIF_TERMenif_make_resource(ErlNifEnv* env, void* obj) @@ -1103,28 +1051,20 @@ enif_release_resource.

- intenif_make_reverse_list(ErlNifEnv* env, ERL_NIF_TERM list_in, ERL_NIF_TERM *list_out) - Create the reverse of a list -

Set *list_out to the reverse list of the list list_in and return true, - or return false if list_in is not a list. This function should only be used on - short lists as a copy will be created of the list which will not be released until after the - nif returns.

-

The list_in term must belong to the environment env.

-
ERL_NIF_TERMenif_make_string(ErlNifEnv* env, const char* string, ErlNifCharEncoding encoding) - Create a string + Create a string.

Create a list containing the characters of the null-terminated string string with encoding encoding.

ERL_NIF_TERMenif_make_string_len(ErlNifEnv* env, const char* string, size_t len, ErlNifCharEncoding encoding) - Create a string + Create a string.

Create a list containing the characters of the string string with length len and encoding encoding. Null-characters are treated as any other characters.

ERL_NIF_TERMenif_make_sub_binary(ErlNifEnv* env, ERL_NIF_TERM bin_term, size_t pos, size_t size) - Make a subbinary term + Make a subbinary term.

Make a subbinary of binary bin_term, starting at zero-based position pos with a length of size bytes. bin_term must be a binary or bitstring and @@ -1132,7 +1072,7 @@ bytes in bin_term.

ERL_NIF_TERMenif_make_tuple(ErlNifEnv* env, unsigned cnt, ...) - Create a tuple term + Create a tuple term.

Create a tuple term of arity cnt. Expects cnt number of arguments (after cnt) of type ERL_NIF_TERM as the elements of the tuple.

@@ -1146,14 +1086,14 @@ ERL_NIF_TERMenif_make_tuple7(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e7) ERL_NIF_TERMenif_make_tuple8(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e8) ERL_NIF_TERMenif_make_tuple9(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e9) - Create a tuple term + Create a tuple term.

Create a tuple term with length indicated by the function name. Prefer these functions (macros) over the variadic enif_make_tuple to get a compile time error if the number of arguments does not match.

ERL_NIF_TERMenif_make_tuple_from_array(ErlNifEnv* env, const ERL_NIF_TERM arr[], unsigned cnt) - Create a tuple term from an array + Create a tuple term from an array.

Create a tuple containing the elements of array arr of length cnt.

@@ -1169,72 +1109,6 @@ Create an integer term from an unsigned long int

Create an integer term from an unsigned long int.

- intenif_map_iterator_create(ErlNifEnv *env, ERL_NIF_TERM map, ErlNifMapIterator *iter, ErlNifMapIteratorEntry entry) - Create a map iterator -

Create an iterator for the map map by initializing the - structure pointed to by iter. The entry argument determines - the start position of the iterator: ERL_NIF_MAP_ITERATOR_FIRST or - ERL_NIF_MAP_ITERATOR_LAST. Return true on success or false if - map is not a map.

-

A map iterator is only useful during the lifetime of the environment - env that the map belongs to. The iterator must be destroyed by - calling - enif_map_iterator_destroy.

- -ERL_NIF_TERM key, value; -ErlNifMapIterator iter; -enif_map_iterator_create(env, my_map, &iter, ERL_NIF_MAP_ITERATOR_FIRST); - -while (enif_map_iterator_get_pair(env, &iter, &key, &value)) { - do_something(key,value); - enif_map_iterator_next(env, &iter); -} -enif_map_iterator_destroy(env, &iter); - -

The key-value pairs of a map have no defined iteration - order. The only guarantee is that the iteration order of a single map - instance is preserved during the lifetime of the environment that the map - belongs to.

-
-
-
- voidenif_map_iterator_destroy(ErlNifEnv *env, ErlNifMapIterator *iter) - Destroy a map iterator -

Destroy a map iterator created by - enif_map_iterator_create. -

-
- intenif_map_iterator_get_pair(ErlNifEnv *env, ErlNifMapIterator *iter, ERL_NIF_TERM *key, ERL_NIF_TERM *value) - Get key and value at current map iterator position -

Get key and value terms at current map iterator position. - On success set *key and *value and return true. - Return false if the iterator is positioned at head (before first entry) - or tail (beyond last entry).

-
- intenif_map_iterator_is_head(ErlNifEnv *env, ErlNifMapIterator *iter) - Check if map iterator is positioned before first -

Return true if map iterator iter is positioned - before first entry.

-
- intenif_map_iterator_is_tail(ErlNifEnv *env, ErlNifMapIterator *iter) - Check if map iterator is positioned after last -

Return true if map iterator iter is positioned - after last entry.

-
- intenif_map_iterator_next(ErlNifEnv *env, ErlNifMapIterator *iter) - Increment map iterator to point to next entry -

Increment map iterator to point to next key-value entry. - Return true if the iterator is now positioned at a valid key-value entry, - or false if the iterator is positioned at the tail (beyond the last - entry).

-
- intenif_map_iterator_prev(ErlNifEnv *env, ErlNifMapIterator *iter) - Decrement map iterator to point to previous entry -

Decrement map iterator to point to previous key-value entry. - Return true if the iterator is now positioned at a valid key-value entry, - or false if the iterator is positioned at the head (before the first - entry).

-
ErlNifMutex *enif_mutex_create(char *name)

Same as erl_drv_mutex_create. @@ -1295,32 +1169,19 @@ reload or upgrade.

Was previously named enif_get_data.

- ERL_NIF_TERMenif_raise_exception(ErlNifEnv* env, ERL_NIF_TERM reason) - Raise a NIF error exception -

Create an error exception with the term reason to be returned from a NIF, - and associate it with the environment env. Once a NIF or any function it calls - invokes enif_raise_exception, the runtime ensures that the exception it creates - is raised when the NIF returns, even if the NIF attempts to return a non-exception - term instead. The return value from enif_raise_exception may be used only as - the return value from the NIF that invoked it (directly or indirectly) or be passed - to enif_is_exception, but - not to any other NIF API function.

-

See also: enif_has_pending_exception - and enif_make_badarg.

-
intenif_realloc_binary(ErlNifBinary* bin, size_t size) - Change the size of a binary + Change the size of a binary.

Change the size of a binary bin. The source binary may be read-only, in which case it will be left untouched and a mutable copy is allocated and assigned to *bin. Return true on success, false if memory allocation failed.

voidenif_release_binary(ErlNifBinary* bin) - Release a binary + Release a binary.

Release a binary obtained from enif_alloc_binary.

voidenif_release_resource(void* obj) - Release a resource object + Release a resource object.

Remove a reference to resource object objobtained from enif_alloc_resource. The resource object will be destructed when the last reference is removed. @@ -1396,12 +1257,12 @@ ErlNifPid *enif_self(ErlNifEnv* caller_env, ErlNifPid* pid) - Get the pid of the calling process + Get the pid of the calling process.

Initialize the pid variable *pid to represent the calling process. Return pid.

intenif_send(ErlNifEnv* env, ErlNifPid* to_pid, ErlNifEnv* msg_env, ERL_NIF_TERM msg) - Send a message to a process + Send a message to a process.

Send a message to a process.

env diff -Nru erlang-18.2-dfsg/erts/doc/src/erl_prim_loader.xml erlang-17.3-dfsg/erts/doc/src/erl_prim_loader.xml --- erlang-18.2-dfsg/erts/doc/src/erl_prim_loader.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/erl_prim_loader.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -36,11 +35,17 @@ the system. The start script is also fetched with this low level loader.

erl_prim_loader knows about the environment and how to - fetch modules.

+ fetch modules. The loader could, for example, fetch files using + the file system (with absolute file names as input), or a + database (where the binary format of a module is stored).

The -loader Loader command line flag can be used to choose the method used by the erl_prim_loader. Two Loader methods are supported by the Erlang runtime system: - efile and inet.

+ efile and inet. If another loader is required, then + it has to be implemented by the user. The Loader provided + by the user must fulfill the protocol defined below, and it is + started with the erl_prim_loader by evaluating + open_port({spawn,Loader},[binary]).

The support for loading of code from archive files is experimental. The sole purpose of releasing it before it is ready @@ -77,6 +82,9 @@ started on each of hosts given in Hosts in order to answer the requests. See erl_boot_server(3).

+

If -loader is something else, the given port program + is started. The port program is supposed to follow + the protocol specified below.

@@ -166,6 +174,22 @@
+ Protocol +

The following protocol must be followed if a user provided + loader port program is used. The Loader port program is + started with the command + open_port({spawn,Loader},[binary]). The protocol is as + follows:

+
+Function          Send               Receive
+-------------------------------------------------------------
+get_file          [102 | FileName]   [121 | BinaryFile] (on success)
+                                     [122]              (failure)
+
+stop              eof                terminate
+
+ +
Command Line Flags

The erl_prim_loader module interprets the following command line flags:

@@ -174,8 +198,10 @@

Specifies the name of the loader used by erl_prim_loader. Loader can be efile - (use the local file system) or inet (load using - the boot_server on another Erlang node).

+ (use the local file system), or inet (load using + the boot_server on another Erlang node). If + Loader is user defined, the defined Loader port + program is started.

If the -loader flag is omitted, it defaults to efile.

diff -Nru erlang-18.2-dfsg/erts/doc/src/erlsrv.xml erlang-17.3-dfsg/erts/doc/src/erlsrv.xml --- erlang-18.2-dfsg/erts/doc/src/erlsrv.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/erlsrv.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/erl.xml erlang-17.3-dfsg/erts/doc/src/erl.xml --- erlang-18.2-dfsg/erts/doc/src/erl.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/erl.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
- 19962015 + 19962013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -138,7 +137,7 @@ see app(4) and application(3).

- +

Command line arguments are read from the file . The arguments read from the file replace the @@ -203,7 +202,7 @@ app(4) and application(3).

- +

If this flag is present, will not maintain a fully connected network of distributed Erlang nodes, and then @@ -288,7 +287,7 @@

Makes write some debug information while interpreting the boot script.

- (emulator flag) + (emulator flag)

Selects an instrumented Erlang runtime system (virtual machine) to run, instead of the ordinary one. When running an @@ -371,7 +370,7 @@ path, similar to . See code(3). As an alternative to -pa, if several directories are - to be prepended to the code path and the directories have a + to be prepended to the code and the directories have a common parent directory, that parent directory could be specified in the ERL_LIBS environment variable. See code(3).

@@ -436,7 +435,7 @@ flag and those running with the flag, as node names must be unique in distributed Erlang systems.

- +

-smp enable and -smp starts the Erlang runtime system with SMP support enabled. This may fail if no runtime @@ -462,7 +461,7 @@

invokes the code for the Erlang emulator (virtual machine), which supports the following flags:

- +

Suggested stack size, in kilowords, for threads in the async-thread pool. Valid range is 16-8192 kilowords. The @@ -477,7 +476,7 @@ suggestion, and it might even be ignored on some platforms.

- +

Sets the number of threads in async thread pool, valid range is 0-1024. If thread support is available, the default is 10.

@@ -496,35 +495,24 @@ , not (). Note also that is used instead of on Windows.

- + -

Enable or disable - time correction:

- - true -

Enable time correction. This is the default if - time correction is supported on the specific platform.

- - false -

Disable time correction.

-
-

For backwards compatibility, the boolean value can be omitted. - This is interpreted as +c false. -

-
- - -

Set - time warp mode: -

- - no_time_warp -

No Time Warp Mode (the default)

- single_time_warp -

Single Time Warp Mode

- multi_time_warp -

Multi Time Warp Mode

-
+

Disable compensation for sudden changes of system time.

+

Normally, will not immediately reflect + sudden changes in the system time, in order to keep timers + (including ) working. Instead, the time + maintained by is slowly adjusted towards + the new system time. (Slowly means in one percent adjustments; + if the time is off by one minute, the time will be adjusted + in 100 minutes.)

+

When the option is given, this slow adjustment + will not take place. Instead will always + reflect the current system time. Note that timers are based + on . If the system time jumps, timers + then time out at the wrong time.

+

NOTE: You can check whether the adjustment is enabled or + disabled by calling + erlang:system_info(tolerant_timeofday).

@@ -537,10 +525,9 @@ core dump and no crash dump if an internal error is detected.

Calling erlang:halt/1 with a string argument will still - produce a crash dump. On Unix systems, sending an emulator process - a SIGUSR1 signal will also force a crash dump.

+ produce a crash dump.

- +

Set max number of ETS tables.

@@ -600,11 +587,6 @@

Sets the default binary virtual heap size of processes to the size .

- - -

Sets the initial process dictionary size of processes to the size - .

-

Enables or disables the kernel poll functionality if @@ -625,7 +607,7 @@ information about the file names and line numbers.

- +

Memory allocator specific flags, see erts_alloc(3) for @@ -664,10 +646,10 @@ debugging. - +

Sets the range of characters that the system will consider printable in heuristic detection of strings. This typically affects the shell, debugger and io:format functions (when ~tp is used in the format string).

-

Currently two values for the Range are supported:

+

Currently two values for the Range are supported: latin1 The default. Only characters in the ISO-latin-1 range can be considered printable, which means @@ -682,10 +664,11 @@ example your font does not cover all Unicode characters. +

Se also io:printable_range/0.

- +

Sets the maximum number of simultaneously existing processes for this system if a Number is passed as value. Valid range for @@ -705,7 +688,7 @@ circumstances be extremely expensive. The legacy algoritm is deprecated, and the legacy option is scheduled for removal in OTP-R18.

- +

Sets the maximum number of simultaneously existing ports for this system if a Number is passed as value. Valid range for Number @@ -736,7 +719,7 @@ circumstances be extremely expensive. The legacy algoritm is deprecated, and the legacy option is scheduled for removal in OTP-R18.

- +

Sets the compatibility mode.

The distribution mechanism is not backwards compatible by @@ -756,7 +739,7 @@

Force ets memory block to be moved on realloc.

- +

Limits the amount of reader groups used by read/write locks optimized for read operations in the Erlang runtime system. By @@ -774,7 +757,7 @@ schedulers to logical processors, since the reader groups are distributed better between schedulers.

- +

Sets the number of scheduler threads to create and scheduler threads to set online when SMP support has been enabled. The maximum for @@ -799,7 +782,7 @@ SMP support enabled (see the -smp flag).

- +

Similar to +S but uses percentages to set the number of scheduler threads to create, based on logical processors configured, @@ -820,7 +803,7 @@ SMP support enabled (see the -smp flag).

- +

Sets the number of dirty CPU scheduler threads to create and dirty CPU scheduler threads to set online when threading support has been @@ -844,7 +827,7 @@ enabled (it's disabled by default).

- +

Similar to +SDcpu but uses percentages to set the number of dirty CPU scheduler threads to create and number of dirty CPU scheduler threads @@ -867,7 +850,7 @@ enabled (it's disabled by default).

- +

Sets the number of dirty I/O scheduler threads to create when threading support has been enabled. The valid range is 0-1024. By default, the number @@ -885,7 +868,7 @@

Scheduling specific flags.

- +sbt BindType + +sbt BindType

Set scheduler bind type.

Schedulers can also be bound using the @@ -1009,7 +992,7 @@ erlang:system_info(scheduler_bindings).

- +sbwt none|very_short|short|medium|long|very_long + +sbwt none|very_short|short|medium|long|very_long

Set scheduler busy wait threshold. Default is medium. The threshold determines how long schedulers should busy @@ -1019,7 +1002,7 @@ without prior notice.

- +scl true|false + +scl true|false

Enable or disable scheduler compaction of load. By default scheduler compaction of load is enabled. When enabled, load @@ -1036,7 +1019,7 @@ between schedulers.

- +sct CpuTopology + +sct CpuTopology = integer(); when 0 =< =< 65535]]> @@ -1158,24 +1141,7 @@

For more information, see erlang:system_info(cpu_topology).

- +secio true|false - -

Enable or disable eager check I/O scheduling. The default - is currently true. The default was changed from false - to true as of erts version 7.0. The behaviour before this - flag was introduced corresponds to +secio false.

-

The flag effects when schedulers will check for I/O - operations possible to execute, and when such I/O operations - will execute. As the name of the parameter implies, - schedulers will be more eager to check for I/O when - true is passed. This however also implies that - execution of outstanding I/O operation will not be - prioritized to the same extent as when false is - passed.

-

erlang:system_info(eager_check_io) - returns the value of this parameter used when starting the VM.

-
- +sfwi Interval + +sfwi Interval

Set scheduler forced wakeup interval. All run queues will be scanned each Interval milliseconds. While there are @@ -1184,12 +1150,12 @@ disables this feature, which also is the default.

This feature has been introduced as a temporary workaround - for long-executing native code, and native code that does not + for lengthy executing native code, and native code that do not bump reductions properly in OTP. When these bugs have be fixed the +sfwi flag will be removed.

- +stbt BindType + +stbt BindType

Try to set scheduler bind type. The same as the +sbt flag with the exception of @@ -1197,7 +1163,7 @@ documentation of the +sbt flag.

- +sub true|false + +sub true|false

Enable or disable scheduler @@ -1210,7 +1176,7 @@ balance scheduler utilization between schedulers. That is, strive for equal scheduler utilization on all schedulers.
   +sub true is only supported on - systems where the runtime system detects and uses a monotonically + systems where the runtime system detects and use a monotonically increasing high resolution clock. On other systems, the runtime system will fail to start.
   +sub true implies @@ -1220,7 +1186,7 @@ utilization.

- +swct very_eager|eager|medium|lazy|very_lazy + +swct very_eager|eager|medium|lazy|very_lazy

Set scheduler wake cleanup threshold. Default is medium. @@ -1234,7 +1200,7 @@

NOTE: This flag may be removed or changed at any time without prior notice.

- +sws default|legacy + +sws default|legacy

Set scheduler wakeup strategy. Default strategy changed in erts-5.10/OTP-R16A. This strategy was previously known as proposal in OTP-R15. The legacy strategy was used as default from R13 up to and including R15. @@ -1242,7 +1208,7 @@

NOTE: This flag may be removed or changed at any time without prior notice.

- +swt very_low|low|medium|high|very_high + +swt very_low|low|medium|high|very_high

Set scheduler wakeup threshold. Default is medium. The threshold determines when to wake up sleeping schedulers @@ -1256,7 +1222,7 @@ without prior notice.

- +spp Bool + +spp Bool

Set default scheduler hint for port parallelism. If set to true, the VM will schedule port tasks when doing so will @@ -1272,7 +1238,7 @@ option to open_port/2

.
- +

Suggested stack size, in kilowords, for scheduler threads. Valid range is 4-8192 kilowords. The default stack size @@ -1280,11 +1246,11 @@ - +

Set the maximum number of atoms the VM can handle. Default is 1048576.

- +

Enables modified timing and sets the modified timing level. Currently valid range is 0-9. The timing of the runtime system @@ -1322,14 +1288,13 @@

Verbose.

- +

Sets the mapping of warning messages for . Messages sent to the error logger using one of the warning - routines can be mapped either to errors (), - warnings (), or info reports - (). The default is warnings. - The current mapping can be retrieved using + routines can be mapped either to errors (default), warnings + (), or info reports (). The current + mapping can be retrieved using . See error_logger(3) for further information.

@@ -1338,7 +1303,7 @@

Miscellaneous flags.

- +zdbbl size + +zdbbl size

Set the distribution buffer busy limit (dist_buf_busy_limit) @@ -1351,18 +1316,6 @@ give lower latency and higher throughput at the expense of higher memory usage.

- +zdntgc time - -

Set the delayed node table garbage collection time - (delayed_node_table_gc) - in seconds. Valid values are either infinity or - an integer in the range [0-100000000]. Default is 60.

-

Node table entries that are not referred will linger - in the table for at least the amount of time that this - parameter determines. The lingering prevents repeated - deletions and insertions in the tables from occurring. -

-
@@ -1425,7 +1378,7 @@
- +

The content of this environment variable will be added to the beginning of the command line for .

@@ -1435,7 +1388,7 @@ the section, i.e. the end of the command line following after an flag.

- and + and

The content of these environment variables will be added to the end of the command line for .

diff -Nru erlang-18.2-dfsg/erts/doc/src/erts_alloc.xml erlang-17.3-dfsg/erts/doc/src/erts_alloc.xml --- erlang-18.2-dfsg/erts/doc/src/erts_alloc.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/erts_alloc.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
- 20022015 + 20022014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -260,19 +259,19 @@

The following flags are available for configuration of mseg_alloc:

- ]]> + ]]> Absolute max cache bad fit (in kilobytes). A segment in the memory segment cache is not reused if its size exceeds the requested size with more than the value of this parameter. Default value is 4096. - ]]> + ]]> Relative max cache bad fit (in percent). A segment in the memory segment cache is not reused if its size exceeds the requested size with more than relative max cache bad fit percent of the requested size. Default value is 20. - + Set super carrier only flag. This flag defaults to true. When a super carrier is used and this @@ -292,7 +291,7 @@ disabled on halfword heap systems. This flag will be ignored on halfword heap systems. - ]]> + ]]> Set super carrier reserved free segment descriptors. This parameter defaults to 65536. @@ -305,7 +304,7 @@ erts_mmap tuple part of the result from calling erlang:system_info({allocator, mseg_alloc}). - + Set super carrier reserve physical memory flag. This flag defaults to true. When this flag is @@ -328,7 +327,7 @@ disabled on halfword heap systems. This flag will be ignored on halfword heap systems. - ]]> + ]]> Set super carrier size (in MB). The super carrier size defaults to zero; i.e, the super carrier is by default disabled. The super @@ -343,7 +342,7 @@ disabled on halfword heap systems. This flag will be ignored on halfword heap systems. - ]]> + ]]> Max cached segments. The maximum number of memory segments stored in the memory segment cache. Valid range is @@ -352,15 +351,15 @@

The following flags are available for configuration of sys_alloc:

- +MYe true + +MYe true Enable sys_alloc. Note: sys_alloc cannot be disabled. - +MYm libc + +MYm libc malloc library to use. Currently only libc is available. libc enables the standard libc malloc implementation. By default libc is used. - ]]> + ]]> Trim threshold size (in kilobytes). This is the maximum amount of free memory at the top of the heap (allocated by @@ -372,7 +371,7 @@ trim threshold is 128. Note: This flag will only have any effect when the emulator has been linked with the GNU C library, and uses its malloc implementation. - ]]> + ]]> Top pad size (in kilobytes). This is the amount of extra memory that will be allocated by malloc when @@ -390,7 +389,7 @@ subsystem identifier, only the specific allocator identified will be effected:

- acul |de]]> + acul |de]]> Abandon carrier utilization limit. A valid ]]> is an integer in the range @@ -422,7 +421,7 @@ allocators based on the alloc_util framework with the exception of temp_alloc (which would be pointless). - as bf|aobf|aoff|aoffcbf|aoffcaobf|gf|af]]> + as bf|aobf|aoff|aoffcbf|aoffcaobf|gf|af]]> Allocation strategy. Valid strategies are bf (best fit), aobf (address order best fit), aoff (address order first fit), @@ -430,7 +429,7 @@ aoffcaobf (address order first fit carrier address order best fit), gf (good fit), and af (a fit). See the description of allocation strategies in "the alloc_util framework" section. - asbcst ]]> + asbcst ]]> Absolute singleblock carrier shrink threshold (in kilobytes). When a block located in an @@ -438,23 +437,23 @@ will be left unchanged if the amount of unused memory is less than this threshold; otherwise, the carrier will be shrunk. See also rsbcst. - e true|false]]> + e true|false]]> Enable allocator ]]>. - lmbcs ]]> + lmbcs ]]> Largest (mseg_alloc) multiblock carrier size (in kilobytes). See the description on how sizes for mseg_alloc multiblock carriers are decided in "the alloc_util framework" section. On 32-bit Unix style OS this limit can not be set higher than 128 megabyte. - mbcgs ]]> + mbcgs ]]> (mseg_alloc) multiblock carrier growth stages. See the description on how sizes for mseg_alloc multiblock carriers are decided in "the alloc_util framework" section. - mbsd ]]> + mbsd ]]> Max block search depth. This flag has effect only if the good fit strategy has been selected for allocator @@ -464,40 +463,40 @@ search depth sets a limit on the maximum number of blocks to inspect in a free list during a search for suitable block satisfying the request. - mmbcs ]]> + mmbcs ]]> Main multiblock carrier size. Sets the size of the main multiblock carrier for allocator ]]>. The main multiblock carrier is allocated via and is never deallocated. - mmmbc ]]> + mmmbc ]]> Max mseg_alloc multiblock carriers. Maximum number of multiblock carriers allocated via mseg_alloc by allocator ]]>. When this limit has been reached, new multiblock carriers will be allocated via sys_alloc. - mmsbc ]]> + mmsbc ]]> Max mseg_alloc singleblock carriers. Maximum number of singleblock carriers allocated via mseg_alloc by allocator ]]>. When this limit has been reached, new singleblock carriers will be allocated via sys_alloc. - ramv ]]> + ramv ]]> Realloc always moves. When enabled, reallocate operations will more or less be translated into an allocate, copy, free sequence. This often reduce memory fragmentation, but costs performance. - rmbcmt ]]> + rmbcmt ]]> Relative multiblock carrier move threshold (in percent). When a block located in a multiblock carrier is shrunk, the block will be moved if the ratio of the size of the returned memory compared to the previous size is more than this threshold; otherwise, the block will be shrunk at current location. - rsbcmt ]]> + rsbcmt ]]> Relative singleblock carrier move threshold (in percent). When a block located in a singleblock carrier is shrunk to @@ -506,7 +505,7 @@ the block will be left unchanged in the singleblock carrier if the ratio of unused memory is less than this threshold; otherwise, it will be moved into a multiblock carrier. - rsbcst ]]> + rsbcst ]]> Relative singleblock carrier shrink threshold (in percent). When a block located in an mseg_alloc @@ -514,20 +513,20 @@ unchanged if the ratio of unused memory is less than this threshold; otherwise, the carrier will be shrunk. See also asbcst. - sbct ]]> + sbct ]]> Singleblock carrier threshold. Blocks larger than this threshold will be placed in singleblock carriers. Blocks smaller than this threshold will be placed in multiblock carriers. On 32-bit Unix style OS this threshold can not be set higher than 8 megabytes. - smbcs ]]> + smbcs ]]> Smallest (mseg_alloc) multiblock carrier size (in kilobytes). See the description on how sizes for mseg_alloc multiblock carriers are decided in "the alloc_util framework" section. - t true|false]]> + t true|false]]>

Multiple, thread specific instances of the allocator. This option will only have any effect on the runtime system @@ -544,20 +543,20 @@ alloc_util, i.e. all allocators based on alloc_util will be effected:

- ]]> + ]]> sys_alloc carrier size. Carriers allocated via sys_alloc will be allocated in sizes which are multiples of the sys_alloc carrier size. This is not true for main multiblock carriers and carriers allocated during a memory shortage, though. - ]]> + ]]> Max mseg_alloc carriers. Maximum number of carriers placed in separate memory segments. When this limit has been reached, new carriers will be placed in memory retrieved from sys_alloc. - ]]> + ]]> Allow sys_alloc carriers. By default true. If set to false, sys_alloc carriers will never be @@ -565,19 +564,19 @@

Instrumentation flags:

- +Mim true|false + +Mim true|false A map over current allocations is kept by the emulator. The allocation map can be retrieved via the instrument module. +Mim true implies +Mis true. +Mim true is the same as -instr. - +Mis true|false + +Mis true|false Status over allocated memory is kept by the emulator. The allocation status can be retrieved via the instrument module. - +Mit X + +Mit X Reserved for future use. Do not use this flag. @@ -587,7 +586,7 @@

Other flags:

- +Mea min|max|r9c|r10b|r11b|config + +Mea min|max|r9c|r10b|r11b|config min @@ -617,7 +616,7 @@
- +Mlpm all|no + +Mlpm all|no Lock physical memory. The default value is no, i.e., no physical memory will be locked. If set to all, all memory mappings made by the runtime system, will be locked into diff -Nru erlang-18.2-dfsg/erts/doc/src/escript.xml erlang-17.3-dfsg/erts/doc/src/escript.xml --- erlang-18.2-dfsg/erts/doc/src/escript.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/escript.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
- 20072015 + 20072014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -96,8 +95,8 @@

The encoding specified by the above mentioned comment applies to the script itself. The encoding of the - I/O-server, however, has to be set explicitly like this:

-io:setopts([{encoding, unicode}]) + I/O-server, however, has to be set explicitly like this: +io:setopts([{encoding, unicode}])

The default encoding of the I/O-server for standard_io is latin1 since the script runs in a non-interactive terminal diff -Nru erlang-18.2-dfsg/erts/doc/src/inet_cfg.xml erlang-17.3-dfsg/erts/doc/src/inet_cfg.xml --- erlang-18.2-dfsg/erts/doc/src/inet_cfg.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/inet_cfg.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/init.xml erlang-17.3-dfsg/erts/doc/src/init.xml --- erlang-18.2-dfsg/erts/doc/src/init.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/init.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -249,7 +248,7 @@ evaluation), Erlang stops with an error message. Here is an example that seeds the random number generator:

-% erl -eval '{X,Y,Z} = now(), random:seed(X,Y,Z).'
+% erl -eval '{X,Y,Z}' = now(), random:seed(X,Y,Z).'

This example uses Erlang as a hexadecimal calculator:

 % erl -noshell -eval 'R = 16#1F+16#A0, io:format("~.16B~n", [R])' \\
diff -Nru erlang-18.2-dfsg/erts/doc/src/Makefile erlang-17.3-dfsg/erts/doc/src/Makefile
--- erlang-18.2-dfsg/erts/doc/src/Makefile	2015-12-15 20:10:35.000000000 +0000
+++ erlang-17.3-dfsg/erts/doc/src/Makefile	2014-09-16 19:10:57.000000000 +0000
@@ -3,17 +3,16 @@
 #
 # Copyright Ericsson AB 1997-2012. All Rights Reserved.
 #
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# The contents of this file are subject to the Erlang Public License,
+# Version 1.1, (the "License"); you may not use this file except in
+# compliance with the License. You should have received a copy of the
+# Erlang Public License along with this software. If not, it can be
+# retrieved online at http://www.erlang.org/.
 #
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+# the License for the specific language governing rights and limitations
+# under the License.
 #
 # %CopyrightEnd%
 # 
@@ -178,8 +177,6 @@
 	$(INSTALL_DIR) "$(RELSYSDIR)/doc/html"
 	$(INSTALL_DATA) $(HTMLDIR)/* \
 		"$(RELSYSDIR)/doc/html"
-	$(INSTALL_DATA) $(ERL_TOP)/erts/example/time_compat.erl \
-		"$(RELSYSDIR)/doc/html"
 	$(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)"
 	$(INSTALL_DIR) "$(RELEASE_PATH)/man/man3"
 	$(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3"
diff -Nru erlang-18.2-dfsg/erts/doc/src/match_spec.xml erlang-17.3-dfsg/erts/doc/src/match_spec.xml
--- erlang-18.2-dfsg/erts/doc/src/match_spec.xml	2015-12-15 20:10:35.000000000 +0000
+++ erlang-17.3-dfsg/erts/doc/src/match_spec.xml	2014-09-16 19:10:57.000000000 +0000
@@ -8,17 +8,16 @@
       Ericsson AB. All Rights Reserved.
     
     
-      Licensed under the Apache License, Version 2.0 (the "License");
-      you may not use this file except in compliance with the License.
-      You may obtain a copy of the License at
- 
-          http://www.apache.org/licenses/LICENSE-2.0
-
-      Unless required by applicable law or agreed to in writing, software
-      distributed under the License is distributed on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-      See the License for the specific language governing permissions and
-      limitations under the License.
+      The contents of this file are subject to the Erlang Public License,
+      Version 1.1, (the "License"); you may not use this file except in
+      compliance with the License. You should have received a copy of the
+      Erlang Public License along with this software. If not, it can be
+      retrieved online at http://www.erlang.org/.
+
+      Software distributed under the License is distributed on an "AS IS"
+      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+      the License for the specific language governing rights and limitations
+      under the License.
 
     
 
@@ -77,26 +76,22 @@
        { GuardFunction, ConditionExpression, ... }
       
       BoolFunction ::=  |
-         |  |
-         |  |
-         |  |
-         |  |
-         |  |
-         |  |
-         |  |
-         |  |
-         |  |
-        
+       |  |  |
+       |  |  |
+       |  |  |
+       |  |  |
+       |  |  |  | 
+       | 
       ConditionExpression ::= ExprMatchVariable | { GuardFunction } |
        { GuardFunction, ConditionExpression, ... } | TermConstruct
       
       ExprMatchVariable ::= MatchVariable (bound in the MatchHead) | 
        | 
-      TermConstruct = {{}} | {{ ConditionExpression, ... }} |
-         | [ConditionExpression, ...] |
-         | #{term() => ConditionExpression, ...} |
-        NonCompositeTerm | Constant
-      NonCompositeTerm ::= term() (not list or tuple or map)
+      TermConstruct = {{}} | {{ ConditionExpression, ... }} | 
+       | [ConditionExpression, ...] | NonCompositeTerm | Constant
+      
+      NonCompositeTerm ::= term() (not list or tuple)
+      
       Constant ::= {, term()}
       
       GuardFunction ::= BoolFunction |  |
@@ -139,26 +134,22 @@
        { GuardFunction, ConditionExpression, ... }
       
       BoolFunction ::=  |
-         |  |
-         |  |
-         |  |
-         |  |
-         |  |
-         |  |
-         |  |
-         |  |
-         |  |
-        
+       |  |  |
+       |  |  |
+       |  |  |
+       |  |  |
+       |  |  |  |
+       | 
       ConditionExpression ::= ExprMatchVariable | { GuardFunction } |
        { GuardFunction, ConditionExpression, ... } | TermConstruct
       
       ExprMatchVariable ::= MatchVariable (bound in the MatchHead) |
        | 
       TermConstruct = {{}} | {{ ConditionExpression, ... }} |
-         | [ConditionExpression, ...] | #{} |
-        #{term() => ConditionExpression, ...} | NonCompositeTerm |
-        Constant
-      NonCompositeTerm ::= term() (not list or tuple or map)
+       | [ConditionExpression, ...] | NonCompositeTerm | Constant
+      
+      NonCompositeTerm ::= term() (not list or tuple)
+      
       Constant ::= {, term()}
       
       GuardFunction ::= BoolFunction |  |
@@ -181,10 +172,9 @@
       Functions allowed in all types of match specifications
       

The different functions allowed in work like this:

-

is_atom, is_float, is_integer, is_list, is_number, is_pid, is_port, - is_reference, is_tuple, is_map, is_binary, is_function: Like the - corresponding guard tests in Erlang, return or - .

+

is_atom, is_float, is_integer, is_list, is_number, is_pid, is_port, is_reference, is_tuple, is_binary, is_function: Like the corresponding guard tests in + Erlang, return or . +

is_record: Takes an additional parameter, which SHALL be the result of )]]>, like in . diff -Nru erlang-18.2-dfsg/erts/doc/src/notes_history.xml erlang-17.3-dfsg/erts/doc/src/notes_history.xml --- erlang-18.2-dfsg/erts/doc/src/notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/notes.xml erlang-17.3-dfsg/erts/doc/src/notes.xml --- erlang-18.2-dfsg/erts/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@

- 20042015 + 20042013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,1541 +30,6 @@

This document describes the changes made to the ERTS application.

- -
Erts 7.2 - -
Fixed Bugs and Malfunctions - - -

- Small documentation fixes

-

- Own Id: OTP-13017

-
- -

- Fix memory corruption bug caused by disabling - distribution and then re-enable distribution with a node - name that has previously been used by a remote node.

-

- Own Id: OTP-13076 Aux Id: seq12959

-
- -

- Renamed variables with name bool as Visual Studio 2015 - now treats this is a keyword.

-

- Own Id: OTP-13079

-
- -

erl_prim_loader has not supported custom - loaders for several releases. In the documentation for - erl_prim_loader, all references to custom loaders - have now been removed.

-

- Own Id: OTP-13102

-
- -

- Fixed compilation of erts together with libc versions - that do not define __uint32_t.

-

- Own Id: OTP-13105

-
- -

- erl -make now returns non-zero exit codes on failure

-

- Own Id: OTP-13107

-
- -

- Fix crash on init:restart in embedded mode caused by - on_load handler process not being relaunched leading to - load failure for modules such as crypto and asn1rt_nif - that need it to be present for correct NIF loading.

-

- Own Id: OTP-13115

-
- -

- Fix maps decode in erlang:binary_to_term/1

-

Decoding a term with a large (HAMT) map in an small - (FLAT) map could cause a critical error if the external - format was not produced by beam.

-

- Own Id: OTP-13125

-
- -

- Fix very rare bug in GC when big maps with a lot of hash - collisions from a remote node are waiting in inner - message queue.

-

- Own Id: OTP-13146

-
- -

- Fixed a bug that could cause a crash dump to become - almost empty.

-

- Own Id: OTP-13150

-
-
-
- - -
Improvements and New Features - - -

Updated the xmllint target to just check the xml - files with real documentation content.
Corrected - some errors and added some missing target in the DTD's. -

-

- Own Id: OTP-13026

-
- -

- Add function enif_getenv to read OS environment variables - in a portable way from NIFs.

-

- Own Id: OTP-13147

-
-
-
- -
- -
Erts 7.1 -
Fixed Bugs and Malfunctions - - -

- Fix bug in ETS that could cause stray objects marked for - deletion to occasionally be missed by the cleanup done by - safe_fixtable(_,false).

-

- Own Id: OTP-12870

-
- -

- Fixed VM crash that could occur if a trace port was - linked to a process, and the trace port terminated - abnormally while handling a trace message. This bug has - always existed in the runtime system with SMP support.

-

- Own Id: OTP-12901

-
- -

- Instead of aborting, the vm now creates a crash dump when - a system process is terminated.

-

- Own Id: OTP-12934

-
- -

- Fixed a rare emulator dead lock that occurred when - erlang:process_flag(priority,...) was called by a process - that was also scheduled for an internal system activity.

-

- Own Id: OTP-12943

-
- -

- The runtime system on various posix platforms (except for - Linux and Solaris) could crash when large amounts of - file-descriptors were in use.

-

- Own Id: OTP-12954

-
- -

- A beam file compiled by hipe for an incompatible runtime - system was sometimes not rejected by the loader, which - could lead to vm crash. This fix will also allow the same - hipe compiler to be used by both normal and debug-built - vm.

-

- Own Id: OTP-12962

-
- -

- Fix bug in maps:merge/2 when called by hipe - compiled code that could cause vm crash. Bug exists since - erts-7.0 (OTP 18.0).

-

- Own Id: OTP-12965

-
- -

- When tracing with process_dump option, the VM - could abort if there was an ongoing binary match - somewhere in the call stack of the traced process.

-

- Own Id: OTP-12968

-
- -

- Fixed possible output deadlock in tty driver when hitting - "CTRL-C" in a non-smp emulator shell on unix.

-

- Own Id: OTP-12987 Aux Id: Seq12947

-
- -

- Fix binary_to_integer to throw badarg for "+" and - "-" similar to list_to_integer.

-

- Own Id: OTP-12988

-
- -

- Suppress warning of unused argument when using macro - enif_make_pid.

-

- Own Id: OTP-12989

-
-
-
- - -
Improvements and New Features - - -

- Changed default clock source used for OS system time on - MacOS X to gettimeofday() in order to improve - performance. The system can be configured during build to - use the previously used higher resolution clock source by - passing the switch --with-clock-resolution=high - when configuring the build.

-

- Own Id: OTP-12945 Aux Id: OTP-12892

-
- -

- Added the configure option --disable-saved-compile-time - which disables saving of compile date and time in the - emulator binary.

-

- Own Id: OTP-12971

-
-
-
- -
- -
Erts 7.0.3 - -
Fixed Bugs and Malfunctions - - -

- Fixed a binary memory leak when printing to shell using - the tty driver (i.e. not -oldshell).

-

- Own Id: OTP-12941

-
- -

- Fix a bug where the standard error port sometimes crashes - with eagain as the reason.

-

- Own Id: OTP-12942

-
- -

- When tracing with process_dump option, the VM - could abort if there was an ongoing binary match - somewhere in the call stack of the traced process./

-

- Own Id: OTP-12968

-
-
-
- -
- -
Erts 7.0.2 - -
Fixed Bugs and Malfunctions - - -

- A process could end up in an inconsistent half exited - state in the runtime system without SMP support. This - could occur if the processes was traced by a port that it - also was linked to, and the port terminated abnormally - while handling a trace message for the process.

-

- This bug has always existed in the runtime system without - SMP support, but never in the runtime system with SMP - support.

-

- Own Id: OTP-12889 Aux Id: seq12885

-
- -

- Removed unnecessary copying of data when retrieving - corrected Erlang monotonic time.

-

- Own Id: OTP-12894

-
- -

- Changed default OS monotonic clock source chosen at build - time. This in order to improve performance. The behavior - will now on most systems be that (both OS and Erlang) - monotonic time stops when the system is suspended.

-

- If you prefer that monotonic time elapse during suspend - of the machine, you can pass the command line argument - --enable-prefer-elapsed-monotonic-time-during-suspend - to configure when building Erlang/OTP. The - configuration stage will try to find such a clock source, - but might not be able to find it. Note that there might - be a performance penalty associated with such a clock - source.

-

- *** POTENTIAL INCOMPATIBILITY ***

-

- Own Id: OTP-12895

-
- -

- erlang:system_info(end_time) returned a faulty - value on 32-bit architectures.

-

- Own Id: OTP-12896

-
-
-
- - -
Improvements and New Features - - -

- The configure command line argument - --enable-gettimeofday-as-os-system-time has been - added which force usage of gettimeofday() for OS - system time. This will improve performance of - os:system_time() and os:timestamp() on - MacOS X, at the expense of worse accuracy, resolution and - precision of Erlang monotonic time, Erlang system time, - and OS system time.

-

- Own Id: OTP-12892

-
-
-
- -
- -
Erts 7.0.1 - -
Fixed Bugs and Malfunctions - - -

- Fix a rare hanging of the VM seen to happen just after - emulator start. Bug exists since R14.

-

- Own Id: OTP-12859 Aux Id: seq12882

-
-
-
- -
- -
Erts 7.0 - -
Fixed Bugs and Malfunctions - - -

- Fix issuing with spaces and quoting in the arguments when - using erlang:open_port spawn_executable on windows. The - behavior now mimics how unix works. This change implies a - backwards incompatibility for how spawn_executable works - on windows.

-

- *** POTENTIAL INCOMPATIBILITY ***

-

- Own Id: OTP-11905

-
- -

- Fix global call trace when hipe compiled code call beam - compiled functions. Tracing of beam functions should now - alway work regardless who the caller is.

-

- Own Id: OTP-11939

-
- -

- Correct cache alignment for ETS write_concurrency - locks to improve performance by reduced false sharing. - May increase memory footprint for tables with - write_concurrency.

-

- Own Id: OTP-11974

-
- -

- All possibly blocking operations in the fd/spawn and - terminal driver have been converted to non-blocking - operations. Before this fix it was possible for the VM to - be blocked for a long time if the entity consuming - stdout/stderr did not consume it fast enough.

-

- Own Id: OTP-12239

-
- -

- Add missing overhead for offheap binaries created from - external format. This fix can improve the garbage - collection of large binaries originating from - binary_to_term or messages from remote nodes.

-

- Own Id: OTP-12554

-
- -

- Ensure hashing of zero is consistent

-

Erlang treats positive and negative zero as - equal:

-

- true = 0.0 =:= 0.0/-1

-

However, Erlangs hash functions: hash, phash and - phash2 did not reflect this behaviour. The hash values - produced by the different hash functions would not be - identical for positive and negative zero.

This - change ensures that hash value of positive zero is always - produced regardless of the signedness of the zero float, - i.e.,

-

- true = erlang:phash2(0.0) =:= - erlang:phash2(0.0/-1)

-

- Own Id: OTP-12641

-
- -

- Ensure NIF term creation disallows illegal floating point - values and too long atoms. Such values will cause a NIF - to throw badarg exception when it returns.

-

- Own Id: OTP-12655

-
- -

- Fixed building of Map results from match_specs

-

- A faulty "box-value" entered into the heap which could - cause a segmentation fault in the garbage collector if it - was written on a heap fragment.

-

- Own Id: OTP-12656

-
- -

- Fix hipe bug when matching a "writable" binary. The bug - has been seen to sometimes cause a failed binary matching - of a correct utf8 character, but other symptoms are also - possible.

-

- Own Id: OTP-12667

-
- -

- Keep dirty schedulers from waking other schedulers.

-

- Own Id: OTP-12685

-
- -

- Disable floating point exceptions if the VM is compiled - by clang/llvm. This is a known long-standing problem in - clang/llvm.

-

- Own Id: OTP-12717

-
- -

- Fix bug in file:sendfile for FreeBSD causing not - the entire file to be sent.

-

- Own Id: OTP-12720

-
- -

- Fix the broken Android support in erl_child_setup.c

-

- Own Id: OTP-12751

-
- -

- Faulty statistics reported by the fix_alloc - allocator.

-

- Own Id: OTP-12766

-
- -

- Fix two erts_snprintf() calls to correct sizes.

-

- - run_erl.c (ose): Use the size of the signal type, not - its pointer. - erl_node_tables.c: Use the size of the - _BUFFER in erts_snprintf() to make sure we can use the - full space.

-

- Own Id: OTP-12771

-
- -

- Delayed memory allocations could be delayed an - unnecessarily long time.

-

- Own Id: OTP-12812

-
- -

- Make sure that timeouts on a pool of acceptors are - released in the correct order.

-

- Own Id: OTP-12817

-
- -

- Fix segmentation fault in module_info for deleted modules

-

- Own Id: OTP-12820

-
- -

Fix garbage collection of literals in code purge

-

During code purging and check_process_code, the - checking of the binary reference embedded in the match - binary state was omitted for the tracing tests. This - would cause the binary match state to reference - deallocated memory.

-

- Own Id: OTP-12821

-
- -

- A bug has been corrected for gen_tcp:close so when - {linger,{true,0}} is in effect it does not wait for data - in the driver queue to transfer out before closing the - port. Bug fix by Rory Byrne.

-

- Own Id: OTP-12840

-
- -

- The documentation of the driver callback start() - erroneously stated that a return value of - ERL_DRV_ERROR_ERRNO caused the error value to be - passed via erl_errno when it should have been - errno.

-

- Own Id: OTP-12855

-
-
-
- - -
Improvements and New Features - - -

- Add md5 and module entries to - ?MODULE:module_info/0/1 and remove obsolete entry - 'import'.

-

- *** POTENTIAL INCOMPATIBILITY ***

-

- Own Id: OTP-11940

-
- -

- Debug function erlang:display/1 shows content of - binaries and bitstrings, not only the length.

-

- Own Id: OTP-11941

-
- -

The time functionality of Erlang has been extended. - This both includes a new - API for time, as well as time warp - modes which alters the behavior of the system - when system time changes. You are strongly encouraged - to use the new API instead of the old API based on - erlang:now/0. - erlang:now/0 has been deprecated since it is and - forever will be a scalability bottleneck. For more - information see the Time and Time - Correction chapter of the ERTS User's - Guide.

-

Besides the API changes and time warp modes a lot of - scalability and performance improvements regarding time - management has been made internally in the runtime - system. Examples of such improvements are scheduler - specific timer wheels, scheduler specific BIF timer - management, parallel retrieval of monotonic time and - system time on systems with primitives that are not - buggy.

-

- Own Id: OTP-11997

-
- -

erlang:function_exported(M, F, A) will now - return true if M:F/A refers to a BIF.

-

- *** POTENTIAL INCOMPATIBILITY ***

-

- Own Id: OTP-12099

-
- -

- New BIF: erlang:get_keys/0, lists all keys - associated with the process dictionary. Note: - erlang:get_keys/0 is auto-imported.

-

- *** POTENTIAL INCOMPATIBILITY ***

-

- Own Id: OTP-12151 Aux Id: seq12521

-
- -

- Make distributed send of large messages yield to improve - real-time characteristics.

-

- Own Id: OTP-12232

-
- -

- Use high accuracy poll timeouts

-

- Where available, use poll/select API's that can handle - time resolutions less than 1ms. In the cases where such - API's are not available the timeout is rounded up to the - nearest ms.

-

- Own Id: OTP-12236

-
- -

- The internal group to user_drv protocol has been changed - to be synchronous in order to guarantee that output sent - to a process implementing the user_drv protocol is - printed before replying. This protocol is used by the - standard_output device and the ssh application when - acting as a client.

-

- This change changes the previous unlimited buffer when - printing to standard_io and other devices that end up in - user_drv to 1KB.

-

- *** POTENTIAL INCOMPATIBILITY ***

-

- Own Id: OTP-12240

-
- -

The previously introduced "eager check I/O" feature is - now enabled by default.

-

Eager check I/O can be disabled using the erl - command line argument: +secio false

-

Characteristics impact compared to previous - default:

Lower latency and smoother - management of externally triggered I/O operations. - A slightly reduced priority of externally triggered - I/O operations. -

- Own Id: OTP-12254 Aux Id: OTP-12117

-
- -

- Properly support maps in match_specs

-

- Own Id: OTP-12270

-
- -

- The notice that a crashdump has been written has been - moved to be printed before the crashdump is generated - instead of afterwords. The wording of the notice has also - been changed.

-

- *** POTENTIAL INCOMPATIBILITY ***

-

- Own Id: OTP-12292

-
- -

- New function ets:take/2. Works the same as - ets:delete/2 but also returns the deleted - object(s).

-

- Own Id: OTP-12309

-
- -

- Tracing with cpu_timestamp option has been enabled on - Linux.

-

- Own Id: OTP-12366

-
- -

- ets:info/1,2 now contains information about whether - write_concurrency or read_concurrency is enabled.

-

- Own Id: OTP-12376

-
- -

- Improved usage of gcc's builtins for atomic memory - access. These are used when no other implementation of - atomic memory operations is available. For example, when - compiling for ARM when libatomic_ops is not - available.

-

- The largest improvement will be seen when compiling with - a gcc with support for the __atomic_* - builtins (using a gcc of at least version 4.7), - but also when only the legacy __sync_* builtins - are available (using a gcc of at least version - 4.1) an improvement can be seen.

-

- For more information see the "Atomic - Memory Operations and the VM" section of - $ERL_TOP/HOWTO/INSTALL.md.

-

- Own Id: OTP-12383

-
- -

- Introduce math:log2/1 function to math module.

-

- Own Id: OTP-12411

-
- -

The documentation of the Abstract Format (in the ERTS - User's Guide) has been updated with types and - specification. (Thanks to Anthony Ramine.)

The - explicit representation of parentheses used in types of - the abstract format has been removed. Instead the new - functions erl_parse:type_inop_prec() and - erl_parse:type_preop_prec() can be used for - inserting parentheses where needed.

-

- Own Id: OTP-12492

-
- -

- Remove perfctr support

-

- Development of perfctr in the linux kernel ceased in - 2010. The perfctr support code in the Erlang VM is thus - effectively dead code and therefor removed.

-

- Own Id: OTP-12508

-
- -

zlib:inflateChunk/2 has been added. It works - like zlib:inflate/2, but decompresses no more data - than will fit in the buffer configured by - zlib:setBufSize/2.

-

- Own Id: OTP-12548

-
- -

- Use linear search for small select_val arrays

-

- Own Id: OTP-12555

-
- -

- New BIF ets:update_counter/4 with a default object as - argument, which will be inserted in the table if the key - was not found.

-

- Own Id: OTP-12563

-
- -

- Export missing types from zlib module

-

- Own Id: OTP-12584

-
- -

- Use persistent hashmaps for large Maps

-

Maps will use a - persistent hashmap implementation when the number of - pairs in a Map becomes sufficiently large. The change - will occur when a Map reaches 33 pairs in size but this - limit might change in the future.

-

The most significant impact for the user by this - change is speed, and to a lesser degree memory - consumption and introspection of Maps. Memory consumption - size is probalistic but lesser than gb_trees or - dict for instance. Any other impacts will be - transparent for the user except for the following - changes.

-

Semantics of Maps have changed in two incompatible - ways compared to the experimental implementation in OTP - 17:

Hashing of maps is done different by - erlang:phash2/1,2, erlang:phash/1 and - erlang:hash/2. Comparing two maps - with ==, /=, =<, <, >= and >, is done - different if the keys contain floating point - numbers. -

- *** POTENTIAL INCOMPATIBILITY ***

-

- Own Id: OTP-12585

-
- -

- Scalability improvement for erlang:make_ref/0, - and other functionality that create references. Each - scheduler now manage its own set of references. By this - no communication at all is needed when creating - references.

-

- Previous implementation generated a strictly - monotonically increasing sequence of references - corresponding to creation time on the runtime system - instance. This is not the case with current - implementation. You can only expect reference to be - unique. The Erlang/OTP documentation has never mentioned - anything else but the uniqueness property, so this change - is fully compatible. The only reason we've - marked this as a potential incompatibility is since an - early draft for an Erlang specification mentions strict - monotonicity as a property.

-

- If you need to create data with a strict monotonicity - property use erlang:unique_integer([monotonic]). - Do not use the deprecated erlang:now().

-

- *** POTENTIAL INCOMPATIBILITY ***

-

- Own Id: OTP-12610

-
- -

- Enable different abort signal from heart

-

By using environment variable HEART_KILL_SIGNAL, heart - can now use a different signal to kill the old running - Erlang.

-

By default the signal is SIGKILL but SIGABRT may also - be used by setting environment variable: - HEART_KILL_SIGNAL=SIGABRT

-

- Own Id: OTP-12613 Aux Id: seq12826

-
- -

- Update autconf to latest version 2015-03-04

-

- Own Id: OTP-12646

-
- -

- Optimization of timers internally in the VM. This include - process timers (receive ... after), port timers - (driver_set_timer()) as well as BIF timers - (erlang:send_after()/erlang:start_timer()).

-

- Each scheduler thread now has its own lock-free timer - service instead of one locked central service. This - dramatically improves performance of timer management on - systems with a large amount of schedulers and timers.

-

- The timer service internal data structure has also been - optimized to be able to handle more timers than before. - That is, each timer service is by its self able to handle - more timers without dramatic performance loss than the - old centralized timer service.

-

- The API of BIF timers has also been extended. Timeout - values are for example no longer limited to 32-bit - integers. For more information see the documentation of - erlang:start_timer/4, - erlang:send_after/4, - erlang:cancel_timer/2, - and erlang:read_timer/2.

-

- Characteristics impact: Calls to the synchronous versions - of erlang:cancel_timer(), and - erlang:read_timer() may take substantially longer - time to complete than before. This occur when the timer - that is accessed is managed by a remote scheduler. You - typically want to use the new asynchronous option in - order to avoid blocking the calling process.

-

- Own Id: OTP-12650 Aux Id: OTP-11997

-
- -

- Specialize instructions from common assembler patterns

-

Specialize common instructions of rem, - band, minus and plus in the beam - loader. This will reduce the number of fetches and thus - lessen the instruction dispatch pressure during runtime - and speed up those operations in some common cases.

-

Specialize move patterns from x-registers to the stack - with a new move_window instruction. This change - will reduce instruction dispatch pressure.

-

- Own Id: OTP-12690

-
- -

- Fix cross compilation for Android.

-

- Own Id: OTP-12693

-
- -

- Fix incorrect use of autoconf macro AC_EGREP_CPP, which - could cause faulty configuration if run from a path - containing the string 'yes'.

-

- Own Id: OTP-12706

-
- -

- Minimal Java version is now 1.6

-

- Own Id: OTP-12715

-
- -

- Send format and args on process exit to error_logger

-

- Previously, the emulator would generate a whole string - with values and call the error_logger passing - "~s~n". This changes it to a format string - containing ~p with the respective values as - arguments.

-

- Own Id: OTP-12735

-
- -

- Map error logger warnings to warning messages by default.

-

- Own Id: OTP-12755

-
- -

- Configure architecture ppc64le architecture as a ppc64

-

- Own Id: OTP-12761

-
- -

- Add function enif_raise_exception to allow a NIF - to raise an error exception with any type of reason.

-

- Own Id: OTP-12770

-
- -

- Optimized node table statistics retrieval.

-

- Own Id: OTP-12777

-
- -

- Map beam error logger warnings to warning messages by - default. Previously these messages were mapped to the - error channel by default.

-

- Own Id: OTP-12781

-
- -

- gen_tcp:shutdown/2 is now asynchronous

-

- This solves the following problems with the old - implementation:

-

- It doesn't block when the TCP peer is idle or slow. This - is the expected behaviour when shutdown() is called: the - caller needs to be able to continue reading from the - socket, not be prevented from doing so.

-

- It doesn't truncate the output. The current version of - gen_tcp:shutdown/2 will truncate any outbound data in the - driver queue after about 10 seconds if the TCP peer is - idle of slow. Worse yet, it doesn't even inform anyone - that the data has been truncated: 'ok' is returned to the - caller; and a FIN rather than an RST is sent to the TCP - peer.

-

- *** POTENTIAL INCOMPATIBILITY ***

-

- Own Id: OTP-12797

-
- -

- Introduced delayed node table GC. This in order to avoid - oscillation of entries in and out of the tables. The - oscillation caused unnecessary lock contention on the - table locks. The delay length can be set by passing the - +zdntgc - command line argument.

-

- Characteristics impact: The tables can grow to very large - sizes with unused entries if the node is get huge amounts - of short lived connections from other nodes. This problem - can be alleviated by shortening the length of the delay - using the +zdntgc command line argument.

-

- Own Id: OTP-12802

-
- -

Improved implementation of erlang:statistics(io) - in order to reduce contention between schedulers.

-

Characteristics impact: The actual call to - erlang:statistics(io) takes longer time to - complete, but the overall impact on the system is - improved.

-

- Own Id: OTP-12842

-
- -

- There are many cases where user code needs to be able to - distinguish between a socket that was closed normally and - one that was aborted. Setting the option - {show_econnreset, true} enables the user to receive - ECONNRESET errors on both active and passive sockets.

-

- Own Id: OTP-12843

-
- -

- Do not preallocate too large event pool

-

- A default pool size of 4000 is too excessive for the - common case. This corresponds directly to the number of - threads in the system. Change - ERTS_TS_EV_ALLOC_DEFAULT_POOL_SIZE to 2048. Change - ERTS_TS_EV_ALLOC_POOL_SIZE to 32.

-

- Own Id: OTP-12849

-
-
-
- -
- -
Erts 6.4.1.5 - -
Fixed Bugs and Malfunctions - - -

- Fixed a bug that could cause a crash dump to become - almost empty.

-

- Own Id: OTP-13150

-
-
-
- -
- -
Erts 6.4.1.4 - -
Fixed Bugs and Malfunctions - - -

- The 'raw' socket option could not be used multiple times - in one call to any e.g gen_tcp function because only one - of the occurrences were used. This bug has been fixed, - and also a small bug concerning propagating error codes - from within inet:setopts/2.

-

- Own Id: OTP-11482 Aux Id: seq12872

-
-
-
- -
- - -
Erts 6.4.1 - -
Fixed Bugs and Malfunctions - - -

- The VTS mode in Common Test has been modified to use a - private version of the Webtool application (ct_webtool).

-

- Own Id: OTP-12704 Aux Id: OTP-10922

-
-
-
- -
- -
Erts 6.4 - -
Fixed Bugs and Malfunctions - - -

- Fix missing quotation in the LM_FIND_EMU_CC - autoconf macro which could cause build failures.

-

- Own Id: OTP-12388

-
- -

- Fix erroneous printout of monitors in crashdump file.

-

- Own Id: OTP-12537

-
- -

- The runtime system without SMP support could crash in the - BIF port_control/3 if the port that was being - accessed died during the call to the BIF.

-

- Own Id: OTP-12544 Aux Id: Seq12777

-
- -

- Avoid corrupt oversized integer to be created from binary - matching. Instead throw system_limit exception which is - the correct behavior. A peculiar symptom of this bug was - that bitwise operations (band, bor, bxor) on such - oversized integers could return the empty list []. - Credit: Mikael Pettersson, Nico Kruber

-

- Own Id: OTP-12556

-
- -

- A race condition when calling port_info/1 could - cause a memory fault has been fixed.

-

- Own Id: OTP-12587

-
- -

- Fix comparison of exact terms. An overflow that could - cause faulty comparisons has been fixed. Comparison of - exact terms is exclusively used within Maps.

-

- Own Id: OTP-12623

-
- -

- Fix bug in list_to_integer/1 for very long lists - that could cause VM crash.

-

- Own Id: OTP-12624

-
-
-
- - -
Improvements and New Features - - -

- Introduced a runtime system internal 64-bit API for - atomic memory operations.

-

- Own Id: OTP-12351

-
- -

- Add command line argument option for the initial size of - process dictionaries.

-

- Use '+hpds <size>' to set initial process - dictionary size for spawned processes.

-

- Own Id: OTP-12535 Aux Id: seq12809

-
- -

- Fix documentation on $char for Unicode

-

- Own Id: OTP-12545

-
-
-
- -
- -
Erts 6.3.1 - -
Fixed Bugs and Malfunctions - - -

- Fix getifaddrs realloc pointer error

-

- When a buffer was exhausted and subsequently reallocated, - we could get an unsafe pointer pointing to faulty memory.

-

- For this to occur we would need to have a large number of - interfaces and a reallocation of memory to a lower - addresses.

-

- The symptom would be garbage returned from - erlang:port_control(Port, 25, []) - (prim_inet:getifaddrs(Port) resulting in a badarg) or a - segmentation fault.

-

- Own Id: OTP-12445

-
- -

- Don't close all file descriptors twice in child_setup

-

- The commit c2b4eab25c907f453a394d382c04cd04e6c06b49 - introduced an error in which child_setup erroneously - tried to close all file descriptors twice.

-

- Use closefrom() if available when closing all file - descriptors.

-

- The function closefrom() was only used in the vfork() - case before but is now also used in the fork() case if - available.

-

- Own Id: OTP-12446

-
- -

- During a crashdump all file descriptors are closed to - ensure the closing of the epmd port and to reserve a file - descriptor for the crashdump file.

-

- If a driver (third party library) cannot handle closing - of sockets this could result in a segmentation fault in - which case a crashdump would not be produced. This is now - fixed by only closing inets sockets via an emergency - close callback to the driver and thus closing the epmd - socket.

-

- Own Id: OTP-12447

-
-
-
- -
- -
Erts 6.3 - -
Fixed Bugs and Malfunctions - - -

- Fix HiPE debug lock checking on OS X 64bit

-

- Position-independent code is mandatory on OS X. We use - r11 as an intermediate register to fill - BIF_P->hipe.bif_callee. This fixes the following error - when doing `make debug FLAVOR=smp`:

-

- clang -cc1as: fatal error: error in backend: 32-bit - absolute addressing is not supported in 64-bit mode

-

- Own Id: OTP-12188

-
- -

- Fix race bug that could cause VM crash in - erlang:port_get_data/1 if the port was closed by a - concurrent process. Also fix fatal bug if - port_set_data/2 is called with a non-immediate - data term. Both bugs exist since R16B01.

-

- Own Id: OTP-12208

-
- -

- Correct make variable SSL_DED_LD_RUNTIME_LIBRARY_PATH - when erl_xcomp_sysroot ends with a slash.

-

- Own Id: OTP-12216 Aux Id: seq12700

-
- -

- Fix two cases of unreachable code caused by false use of - assigment operators.

-

- Own Id: OTP-12222

-
- -

- Fix bug when hipe compiled code makes tail call to a BIF - that disables GC while trapping (sush as binary_to_list, - list_to_binary, binary_to_term, term_to_binary).

-

- Own Id: OTP-12231

-
- -

- Fix bug when a migrated empty memory carrier is reused - just before it should be destroyed by the thread that - created it.

-

- Own Id: OTP-12249

-
- -

- Prevents compile-time errors in NIFs, when the compiler - is instructed to treat missing field initializers as - errors, by adding an initializer for the new options - field which was added to ErlNifEntry for 17.3.

-

- Own Id: OTP-12266

-
- -

- Fixed CPU topology detection on FreeBSD systems where - Erlang/OTP is compiled by new C compilers (including, but - possibly not limited to, gcc 4.9 and clang).

-

- Own Id: OTP-12267

-
- -

- Use C99 function isfinite() instead of finite() when - available on non GCC compilers.

-

- Own Id: OTP-12268

-
- -

- Fix bug on windows where an incorrect number of links - could be returned when doing file:read_file_info on a - directory.

-

- Own Id: OTP-12269

-
- -

- Fix rare bug when purging module on VM started with - +Meamin.

-

- Own Id: OTP-12273

-
- -

- Repair run_erl terminal window size adjustment sent from - to_erl. This was broken in OTP 17.0 which could lead to - strange cursor behaviour in the to_erl shell.

-

- Own Id: OTP-12275 Aux Id: seq12739

-
- -

- Fixed bug on windows causing gen_tcp/udp to return an - error when given an fd to work with.

-

- Own Id: OTP-12289

-
- -

- Fix various internal erts issues where negating a signed - integer in C would trigger undefined behavior. This fixes - issues when dividing with bignums and list_to_integer.

-

- Own Id: OTP-12290

-
- -

- When flushing output to stdout on windows, the emulator - could sometimes hang indefinitely waiting for the flush - to complete. This has been fixed.

-

- Own Id: OTP-12291

-
- -

- Fix so that non-smp emulators with dirty scheduler - support shows the correct number of dirty schedulers when - calling erlang:system_info(system_version).

-

- Own Id: OTP-12295

-
- -

- Add nif_version to erlang:system_info/1 in - order to get the NIF API version of the runtime system in - a way similar to driver_version.

-

- Own Id: OTP-12298

-
- -

- Fix bug that could cause the return value from dirty NIF - with zero arity to be treated as garbage, leading to VM - crash.

-

- Own Id: OTP-12300

-
- -

- Improve allocation carrier migration search logic. This - will reduce the risk of failed migrations that could lead - to excess memory consumption. It will also improve smp - performance due to reduced memory contention on the - migration pool.

-

- Own Id: OTP-12323

-
-
-
- - -
Improvements and New Features - - -

Introduced support for eager check I/O.

-

By default eager check I/O will be disabled, but this - will most likely be changed in OTP 18. When eager check - I/O is enabled, schedulers will more frequently check for - I/O work. Outstanding I/O operations will however not be - prioritized to the same extent as when eager check I/O is - disabled.

-

Eager check I/O can be enabled using the erl - command line argument: +secio true

-

Characteristics impact when enabled:

- Lower latency and smoother management of externally - triggered I/O operations. A slightly reduced - priority of externally triggered I/O operations. - -

- Own Id: OTP-12117

-
- -

- Fix erts .app-file

-

- Own Id: OTP-12189

-
- -

- Add configure option --with-ssl-incl=PATH to support - OpenSSL installations with headers and libraries at - different places.

-

- Own Id: OTP-12215 Aux Id: seq12700

-
- -

- Optimization of atomic memory operations with release - barrier semantics on 32-bit PowerPC when using the - implementation included in OTP.

-

- Own Id: OTP-12250

-
- -

- Minor adjustment of scheduler activation code making sure - that an activation of a scheduler is not prevented by its - run-queue being non-empty. (Thanks to Songlu Cai)

-

- Own Id: OTP-12287

-
- -

- Improved support for atomic memory operations provided by - the libatomic_ops - library. Most importantly support for use of native - double word atomics when implemented by - libatomic_ops (for example, implemented for ARM).

-

- The $ERL_TOP/HOWTO/INSTALL.md - document now also more clearly describes when you want to - build together with a libatomic_ops installation.

-

- Own Id: OTP-12302

-
- -

- Add configure option --with-ssl-rpath to control which - runtime library path to use for dynamic linkage toward - OpenSSL.

-

- Own Id: OTP-12316 Aux Id: seq12753

-
- -

- Added systemd notify support to epmd

-

- Own Id: OTP-12321

-
-
-
- -
- -
Erts 6.2.1 - -
Fixed Bugs and Malfunctions - - -

- Fix bug when an migrated empty memory carrier is reused - just before it should be destroyed by the thread that - created it.

-

- Own Id: OTP-12249

-
- -

- Repair run_erl terminal window size adjustment sent from - to_erl. This was broken in OTP 17.0 which could lead to - strange cursor behaviour in the to_erl shell.

-

- Own Id: OTP-12275 Aux Id: seq12739

-
-
-
- -
-
Erts 6.2
Fixed Bugs and Malfunctions @@ -2477,28 +941,22 @@

EEP43: New data type - Maps

- With Maps you may for instance:

- - M0 = #{ a => 1, b => 2}, % create - associations - M1 = M0#{ a := 10 }, % update values - M2 = M1#{ "hi" => - "hello"}, % add new associations - #{ "hi" := V1, a := V2, b := V3} = M2. - % match keys with values - + With Maps you may for instance: M0 = + #{ a => 1, b => 2}, % create + associations M1 = M0#{ a := 10 }, % + update values M2 = M1#{ "hi" => + "hello"}, % add new associations #{ + "hi" := V1, a := V2, b := V3} = M2. % match keys with + values

For information on how to use Maps please see Map Expressions in the Reference Manual.

The current implementation is without the following - features:

- - No variable keys - No single value access - No map comprehensions - + features: No variable keys + No single value access No map + comprehensions

Note that Maps is experimental during OTP 17.0.

@@ -4658,7 +3116,8 @@

Fix erl_prim_loader errors in handling of primary archive. The following errors have been corrected:

- If primary archive was named "xxx", then a +

+ If primary archive was named "xxx", then a file in the same directory named "xxxyyy" would be interpreted as a file named "yyy" inside the archive. erl_prim_loader did not correctly create @@ -4673,8 +3132,7 @@ erl_prim_loader:list_dir/1 would sometimes return an empty string inside the file list. This was a virtual element representing the top directory of the archive. - This has been removed. - + This has been removed.

Thanks to Tuncer Ayaz and Shunichi Shinohara for reporting and co-authoring corrections.

@@ -7117,12 +5575,12 @@ Own Id: OTP-8726 Aux Id: seq11617

-

Fix libm linking with --as-needed flag

+

Fix libm linking with --as-needed flag

When building with "--as-needed" linker flags on Linux the build will fail. This has now been fixed.

- (Thanks to Christian Faulhammer)

+ (Thanks to Christian Faulhammer)

Own Id: OTP-8728

diff -Nru erlang-18.2-dfsg/erts/doc/src/part_notes_history.xml erlang-17.3-dfsg/erts/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/erts/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/part_notes.xml erlang-17.3-dfsg/erts/doc/src/part_notes.xml --- erlang-18.2-dfsg/erts/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/part.xml erlang-17.3-dfsg/erts/doc/src/part.xml --- erlang-18.2-dfsg/erts/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/ref_man.xml erlang-17.3-dfsg/erts/doc/src/ref_man.xml --- erlang-18.2-dfsg/erts/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/run_erl.xml erlang-17.3-dfsg/erts/doc/src/run_erl.xml --- erlang-18.2-dfsg/erts/doc/src/run_erl.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/run_erl.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/start_erl.xml erlang-17.3-dfsg/erts/doc/src/start_erl.xml --- erlang-18.2-dfsg/erts/doc/src/start_erl.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/start_erl.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/start.xml erlang-17.3-dfsg/erts/doc/src/start.xml --- erlang-18.2-dfsg/erts/doc/src/start.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/start.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/time_correction.xml erlang-17.3-dfsg/erts/doc/src/time_correction.xml --- erlang-18.2-dfsg/erts/doc/src/time_correction.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/time_correction.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,26 +4,25 @@
- 19992015 + 19992014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. - Time and Time Correction in Erlang - + Time and time correction in Erlang + Patrik Nyblom @@ -32,871 +31,244 @@ PA1 time_correction.xml
- -
- New Extended Time Functionality -

As of OTP 18 (ERTS version 7.0) the time functionality of - Erlang has been extended. This includes a - new API - for time and - time warp - modes that alter the system behavior when - system time changes.

- -

The default - time warp mode has the same behavior as before, and the - old API still works. Thus, you are not required to change - anything unless you want to. However, you are strongly - encouraged to use the new API instead of the old API based - on erlang:now/0. - erlang:now/0 is deprecated, as it is and - will be a scalability bottleneck.

- -

By using the new API, you - automatically get scalability and performance improvements. This - also enables you to use the - multi-time warp mode - that improves accuracy and precision of time measurements.

-
-
- -
- Terminology -

To make it easier to understand this section, some terms - are defined. This is a mix of our own terminology - (Erlang/OS system time, Erlang/OS monotonic time, time warp) - and globally accepted terminology.

- - -
- Monotonically Increasing -

In a monotonically increasing sequence of values, all values - that have a predecessor are either larger than or equal to its - predecessor.

-
- - -
- Strictly Monotonically Increasing -

In a strictly monotonically increasing sequence of values, - all values that have a predecessor are larger than its - predecessor.

-
- - -
- UT1 -

Universal Time. UT1 is based on the rotation of the earth - and conceptually means solar time at 0° longitude.

-
- - -
- UTC -

Coordinated Universal Time. UTC almost aligns with - UT1. However, UTC uses the - SI definition of a second, which has not exactly the same length - as the second used by UT1. This means that UTC slowly drifts from - UT1. To keep UTC relatively in sync with UT1, leap seconds - are inserted, and potentially also deleted. That is, an UTC day can - be 86400, 86401, or 86399 seconds long.

-
- - -
- POSIX Time -

Time since - Epoch. - Epoch is defined to be 00:00:00 UTC, - 1970-01-01. - A day in POSIX time - is defined to be exactly 86400 seconds long. Strangely enough - Epoch is defined to be a time in UTC, and UTC has another - definition of how long a day is. Quoting the Open Group - "POSIX time is therefore not necessarily UTC, despite its appearance". - The effect of this is that when an UTC leap second is - inserted, POSIX time either stops for a second, or repeats the - last second. If an UTC leap second would be deleted (which has not - happened yet), POSIX time would make a one second leap forward.

-
- - -
- Time Resolution -

The shortest time interval that can be distinguished when - reading time values.

-
- - -
- Time Precision -

The shortest time interval that can be distinguished - repeatedly and reliably when reading time values. Precision - is limited by the - resolution, but - resolution and precision can differ significantly.

-
- - -
- Time Accuracy -

The correctness of time values.

-
- - -
- Time Warp -

A time warp is a leap forwards or backwards in time. That - is, the difference of time values taken before and after the - time warp does not correspond to the actual elapsed time.

-
- - -
- OS System Time -

The operating systems view of - POSIX time. To - retrieve it, call - os:system_time(). - This may or may not be an accurate view of POSIX time. This time - may typically be adjusted both backwards and forwards without - limitation. That is, time warps - may be observed.

- -

To get information about the Erlang runtime - system's source of OS system time, call - erlang:system_info(os_system_time_source).

-
- - -
- OS Monotonic Time -

A monotonically increasing time provided by the operating - system. This time does not leap and has a relatively steady - frequency although not completely correct. However, it is not - uncommon that OS monotonic time stops if the system is - suspended. This time typically increases since some - unspecified point in time that is not connected to - OS system time. - This type of time is not necessarily provided by all - operating systems.

- -

To get information about the Erlang - runtime system's source of OS monotonic time, call - erlang:system_info(os_monotonic_time_source).

-
- - -
- Erlang System Time -

The Erlang runtime systems view of - POSIX time. To - retrieve it, call - erlang:system_time().

- -

This time may or may not be an accurate view of POSIX time, - and may - or may not align with OS system - time. The runtime system works towards aligning the two - system times. Depending on the - time warp mode used, - this can be achieved by letting Erlang - system time perform a time - warp.

-
- - -
- Erlang Monotonic Time -

A monotonically increasing time provided by the - Erlang runtime system. Erlang monotonic time increases since - some unspecified point in time. To retrieve it, call - erlang:monotonic_time(). -

- -

The accuracy and - precision of Erlang - monotonic time heavily depends on the following:

- - - Accuracy and precision of - OS monotonic time - - Accuracy and precision of - OS system time - - time warp mode used - - - -

On a system without OS monotonic time, Erlang monotonic - time guarantees monotonicity, but cannot give - other guarantees. The frequency adjustments made to - Erlang monotonic time depend on the time warp mode used.

- -

Internally in the runtime system, Erlang monotonic - time is the "time engine" that is used for more or less - everything that has anything to do with time. All timers, - regardless of it is a receive ... after timer, BIF timer, - or a timer in the timer module, are triggered - relative Erlang monotonic time. Even - Erlang system - time is based on Erlang monotonic time. - By adding current Erlang monotonic time with current time - offset, you get current Erlang system time.

- -

To retrieve current time offset, call - erlang:time_offset/0. -

-
- -
- -
- Introduction

Time is vital to an Erlang program and, more importantly, correct time is vital to an Erlang program. As Erlang is a language with - soft real-time properties and we can express - time in our programs, the Virtual Machine and the language must be - careful about what is considered a correct time and in + soft real time properties and we have the possibility to express + time in our programs, the Virtual Machine and the language has to be + very careful about what is considered a correct point in time and in how time functions behave.

-

When Erlang was designed, it was assumed that the wall +

In the beginning, Erlang was constructed assuming that the wall clock time in the system showed a monotonic time moving forward at - exactly the same pace as the definition of time. This more or less meant - that an atomic clock (or better time source) was expected to be attached + exactly the same pace as the definition of time. That more or less + meant that an atomic clock (or better) was expected to be attached to your hardware and that the hardware was then expected to be - locked away from any human tinkering forever. While this can be a - compelling thought, it is simply never the case.

- -

A "normal" modern computer cannot keep time, not on itself and - not unless you have a chip-level atomic clock wired to it. Time, - as perceived by your computer, must normally be corrected. Hence - the Network Time Protocol (NTP) protocol, together with the ntpd - process, does its best to keep your computer time in sync with - the correct time. Between NTP corrections, usually a + locked away from any human (or unearthly) tinkering for all + eternity. While this might be a compelling thought, it's simply + never the case.

+ +

A "normal" modern computer can not keep time. Not on itself and + not unless you actually have a chip level atomic clock wired to + it. Time, as perceived by your computer, will normally need to be + corrected. Hence the NTP protocol that together with the ntpd + process will do it's best to keep your computers time in sync with + the "real" time in the universe. Between NTP corrections, usually a less potent time-keeper than an atomic clock is used.

-

However, NTP is not fail-safe. The NTP server can be unavailable, - ntp.conf can be wrongly configured, or your computer may - sometimes be disconnected from Internet. Furthermore, you can have a - user (or even system administrator) who thinks the correct - way to handle Daylight Saving Time is to adjust the clock one - hour two times a year (which is the incorrect way to do it). - To complicate things further, this user fetched your - software from Internet and has not considered what - the correct time is as perceived by a computer. The user does - not care about keeping the wall clock in sync with the correct - time. The user expects your program to have unlimited knowledge +

But NTP is not fail safe. The NTP server can be unavailable, the + ntp.conf can be wrongly configured or your computer may from time to + time be disconnected from the internet. Furthermore you can have a + user (or even system administrator) on your system that thinks the + right way to handle daylight saving time is to adjust the clock one + hour two times a year (a tip, that is not the right way to do + it...). To further complicate things, this user fetched your + software from the internet and has never ever thought about what's + the correct time as perceived by a computer. The user simply does + not care about keeping the wall clock in sync with the rest of the + universe. The user expects your program to have omnipotent knowledge about the time.

Most programmers also expect time to be reliable, at least until - they realize that the wall clock time on their workstation is off by - a minute. Then they set it to the correct time, but most probably - not in a smooth way.

+ they realize that the wall clock time on their workstation is of by + a minute. Then they simply set it to the correct time, maybe or + maybe not in a smooth way. Most probably not in a smooth way.

-

The number of problems that arise when you always expect the wall clock - time on the system to be correct can be immense. Erlang therefore +

The amount of problems that arise when you expect the wall clock + time on the system to always be correct may be immense. Therefore Erlang introduced the "corrected estimate of time", or the "time - correction", many years ago. The time correction relies on the fact + correction" many years ago. The time correction relies on the fact that most operating systems have some kind of monotonic clock, - either a real-time extension or some built-in "tick counter" that is - independent of the wall clock settings. This counter can have - microsecond resolution or much less, but it has a drift that cannot - be ignored.

-
+ either a real time extension or some built in "tick counter" that is + independent of the wall clock settings. This counter may have + microsecond resolution or much less, but generally it has a drift + that is not to be ignored.

+ +

So we have this monotonic ticking and we have the wall clock + time. Two unreliable times that together can give us an estimate of + an actual wall clock time that does not jump around and that + monotonically moves forward. If the tick counter has a high + resolution, this is fairly easy to do, if the counter has a low + resolution, it's more expensive, but still doable down to + frequencies of 50-60 Hz (of the tick counter).

+ +

So the corrected time is the nearest approximation of an atomic + clock that is available on the computer. We want it to have the + following properties:

+ + Monotonic + The clock should not move backwards + Intervals should be near the truth + We want the actual time (as measured by an atomic clock or + an astronomer) that passes between two time stamps, T1 and T2, to be as + near to T2 - T1 as possible. + Tight coupling to the wall clock + We want a timer that is to be fired when the wall clock + reaches a time in the future, to fire as near to that point in + time as possible + +

To meet all the criteria, we have to utilize both times in such a + way that Erlangs "corrected time" moves slightly slower or slightly + faster than the wall clock to get in sync with it. The word + "slightly" means a maximum of 1% difference to the wall clock time, + meaning that a sudden change in the wall clock of one minute, takes + 100 minutes to fix, by letting all "corrected time" move 1% slower + or faster.

+ +

Needless to say, correcting for a faulty handling of daylight + saving time may be disturbing to a user comparing wall clock + time to for example calendar:now_to_local_time(erlang:now()). But + calendar:now_to_local_time/1 is not supposed to be used for presenting wall + clock time to the user.

+ +

Time correction is not perfect, but it saves you from the havoc + of clocks jumping around, which would make timers in your program + fire far to late or far to early and could bring your whole system + to it's knees (or worse) just because someone detected a small error + in the wall clock time of the server where your program runs. So + while it might be confusing, it is still a really good feature of + Erlang and you should not throw it away using time functions which + may give you higher benchmark results, not unless you really know + what you're doing.

- - Time Correction -

If time correction is enabled, the Erlang runtime system - makes use of both - OS system time - and OS monotonic time, - to adjust the frequency of the Erlang - monotonic clock. Time correction ensures that - Erlang monotonic time - does not warp and that the frequency is relatively accurate. - The type of frequency adjustments depends on the time warp mode used. - Section Time Warp Modes - provides more details.

- -

By default time correction is enabled if support for - it exists on the specific platform. Support for it includes - both OS monotonic time, provided by the OS, and an - implementation in the Erlang runtime system using - OS monotonic time. To check if your system has support - for OS monotonic time, call - erlang:system_info(os_monotonic_time_source). - To check if time correction is enabled on your system, call - erlang:system_info(time_correction).

- -

To enable or disable time correction, pass command-line argument - +c [true|false] - to erl.

- -

If time correction is disabled, Erlang monotonic time - may warp forwards or stop, or even freeze for extended - periods of time. There are then no guarantees that the frequency - of the Erlang monotonic clock is accurate or stable.

- -

You typically never want to disable time correction. - Previously a performance penalty was associated with time - correction, but nowadays it is usually the other way around. - If time correction is disabled, you probably get bad scalability, - bad performance, and bad time measurements.

+ What does time correction mean in my system? +

Time correction means that Erlang estimates a time from current + and previous settings of the wall clock, and it uses a fairly + exact tick counter to detect when the wall clock time has jumped + for some reason, slowly adjusting to the new value.

+ +

In practice, this means that the difference between two calls + to time corrected functions, like erlang:now(), might differ up to + one percent from the corresponding calls to non time corrected + functions (like os:timestamp()). Furthermore, if comparing + calendar:local_time/0 to calendar:now_to_local_time(erlang:now()), + you might temporarily see a difference, depending on how well kept your + system is.

+ +

It is important to understand that it is (to the program) + always unknown if it is the wall clock time that moves in the + wrong pace or the Erlang corrected time. The only way to determine + that, is to have an external source of universally correct time. If + some such source is available, the wall clock time can be kept + nearly perfect at all times, and no significant difference will be + detected between erlang:now/0's pace and the wall clock's.

+ +

Still, the time correction will mean that your system keeps + it's real time characteristics very well, even when the wall clock + is unreliable.

-
- - Time Warp Safe Code -

Time warp safe code can handle - a time warp of - Erlang system time.

- -

erlang:now/0 - behaves bad when Erlang system time warps. When Erlang - system time does a time warp backwards, the values returned - from erlang:now/0 freeze (if you disregard the - microsecond increments made because of the actual call) until - OS system time reaches the point of the last value returned by - erlang:now/0. This freeze can continue for a long time. It - can take years, decades, and even longer until the freeze stops.

- -

All uses of erlang:now/0 are not necessarily - time warp unsafe. If you do not use it to get time, it - is time warp safe. However, all uses of - erlang:now/0 are suboptimal from a performance - and scalability perspective. So you really want to replace - the use of it with other functionality. For examples - of how to replace the use of erlang:now/0, see Section - How to Work with the New - API.

+ Where does Erlang use corrected time? +

For all functionality where real time characteristics are + desirable, time correction is used. This basically means:

+ + erlang:now/0 + The infamous erlang:now/0 function uses time correction so + that differences between two "now-timestamps" will correspond to + other timeouts in the system. erlang:now/0 also holds other + properties, discussed later. + receive ... after + Timeouts on receive uses time correction to determine a + stable timeout interval. + The timer module + As the timer module uses other built in functions which + deliver corrected time, the timer module itself works with + corrected time. + erlang:start_timer/3 and erlang:send_after/3 + The timer BIF's work with corrected time, so that they + will not fire prematurely or too late due to changes in the wall + clock time. + + +

All other functionality in the system where erlang:now/0 or any + other time corrected functionality is used, will of course + automatically benefit from it, as long as it's not "optimized" to + use some other time stamp function (like os:timestamp/0).

+ +

Modules like calendar and functions like erlang:localtime/0 use + the wall clock time as it is currently set on the system. They + will not use corrected time. However, if you use a now-value and + convert it to local time, you will get a corrected local time + value, which may or may not be what you want. Typically older code + tend to use erlang:now/0 as a wall clock time, which is usually + correct (at least when testing), but might surprise you when + compared to other times in the system.

-
- Time Warp Modes - -

Current Erlang system - time is determined by adding current - Erlang monotonic time - with current - time offset. The - time offset is managed differently depending on which time - warp mode you use.

- -

To set the time warp mode, pass command-line argument - +C - [no_time_warp|single_time_warp|multi_time_warp] - to erl.

- - -
- No Time Warp Mode -

The time offset is determined at runtime system start - and does not change later. This is the default behavior, but - not because it is the best mode (which it is not). It is - default only because this is how the runtime system - behaved until ERTS 7.0. - Ensure that your Erlang code that may execute during a time - warp is time warp - safe before enabling other modes.

- -

As the time offset is not allowed to change, time - correction must adjust the frequency of the Erlang - monotonic clock to align Erlang system time with OS - system time smoothly. A significant downside of this approach - is that we on purpose will use a faulty frequency on the - Erlang monotonic clock if adjustments are needed. This - error can be as large as 1%. This error will show up in all - time measurements in the runtime system.

- -

If time correction is not enabled, Erlang monotonic - time freezes when OS system time leaps backwards. - The freeze of monotonic time continues until - OS system time catches up. The freeze can continue for - a long time. When OS system time leaps forwards, - Erlang monotonic time also leaps forward.

-
- - -
- Single Time Warp Mode -

This mode is more or less a backwards compatibility mode - as of its introduction.

- -

On an embedded system it is not uncommon that the system - has no power supply, not even a battery, when it is - shut off. The system clock on such a system is typically - way off when the system boots. If - no time warp mode - is used, and the Erlang runtime system is started before - OS system time has been corrected, Erlang system time - can be wrong for a long time, centuries or even longer.

- -

If you need to use Erlang code that is not - time warp safe, - and you need to start the Erlang runtime system before OS - system time has been corrected, you may want to use the single - time warp mode.

- -

There are limitations to when you can - execute time warp unsafe code using this mode. If it is possible - to use time warp safe code only, it is much better - to use the multi-time - warp mode instead.

- -

Using the single time warp mode, the time offset is - handled in two phases:

- - - Preliminary Phase - -

This phase starts when the runtime - system starts. A preliminary time offset based on - current OS system time is determined. This offset is from - now on to be fixed during the whole preliminary phase.

- -

If time correction is enabled, adjustments to the - Erlang monotonic clock are made to keep its - frequency as correct as possible. However, no - adjustments are made trying to align Erlang system - time and OS system time. That is, during the preliminary phase - Erlang system time and OS system time can diverge - from each other, and no attempt is made to prevent this.

- -

If time correction is disabled, changes in OS system - time affects the monotonic clock the same way as - when the no time warp - mode is used.

-
- - Final Phase - -

This phase begins when the user finalizes the time - offset by calling - erlang:system_flag(time_offset, finalize). - The finalization can only be performed once.

- -

During finalization, the time offset is adjusted and - fixated so that current Erlang system time aligns with - current OS system time. As the time offset can - change during the finalization, Erlang system time - can do a time warp at this point. The time offset is - from now on fixed until the runtime system terminates. - If time correction has been enabled, the time - correction from now on also makes adjustments - to align Erlang system time with OS system - time. When the system is in the final phase, it behaves - exactly as in the no - time warp mode.

-
-
- -

In order for this to work properly, the user must ensure - that the following two requirements are satisfied:

- - - Forward Time Warp -

The time warp made when finalizing the time offset - can only be done forwards without encountering problems. - This implies that the user must ensure that OS - system time is set to a time earlier or equal to actual - POSIX time before starting the Erlang runtime system.

- -

If you are not sure that OS system time is correct, - set it to a time that is guaranteed to be earlier than - actual POSIX time before starting the Erlang runtime - system, just to be safe.

-
- - Finalize Correct OS System Time -

OS system time must be correct when - the user finalizes the time offset.

-
-
- -

If these requirements are not fulfilled, the system - may behave very bad.

- -

Assuming that these requirements are fulfilled, - time correction is enabled, and that OS system time - is adjusted using a time adjustment protocol such as NTP, - only small adjustments of Erlang monotonic - time are needed to keep system times - aligned after finalization. As long as the system is not - suspended, the largest adjustments needed are for - inserted (or deleted) leap seconds.

- -

To use this mode, ensure that - all Erlang code that will execute in both phases are - time warp - safe.

-

Code executing only in the final phase does not have - to be able to cope with the time warp.

-
- - -
- Multi-Time Warp Mode -

Multi-time warp mode in combination with time - correction is the preferred configuration. This as - the Erlang runtime system have better performance, scale - better, and behave better on almost all platforms. In - addition, the accuracy and precision of time measurements - are better. Only Erlang runtime systems executing on - ancient platforms benefit from another configuration.

- -

The time offset may change at any time without limitations. - That is, Erlang system time may perform time warps both - forwards and backwards at any time. As we align - Erlang system time with OS system time by changing - the time offset, we can enable a time correction that tries - to adjust the frequency of the Erlang monotonic clock to be as - correct as possible. This makes time measurements using - Erlang monotonic time more accurate and precise.

- -

If time correction is disabled, Erlang monotonic time - leaps forward if OS system time leaps forward. If - OS system time leaps backwards, Erlang monotonic time - stops briefly, but it does not freeze for extended periods - of time. This as the time offset is changed to - align Erlang system time with OS system time.

- -

To use this mode, ensure that all - Erlang code that will execute on the runtime system is - time warp - safe.

-
+ What is erlang:now/0 really? +

erlang:now/0 is a function designed to serve multiple purposes + (or a multi-headed beast if you're a VM designer). It is expected + to hold the following properties:

+ + Monotonic + erlang:now() never jumps backwards - it always moves + forward + Interval correct + The interval between two erlang:now() calls is expected to + correspond to the correct time in real life (as defined by an + atomic clock, or better) + Absolute correctness + The erlang:now/0 value should be possible to convert to an + absolute and correct date-time, corresponding to the real world + date and time (the wall clock) + System correspondence + The erlang:now/0 value converted to a date-time is + expected to correspond to times given by other programs on the + system (or by functions like os:timestamp/0) + Unique + No two calls to erlang:now on one Erlang node should + return the same value + +

All these requirements are possible to uphold at the same + time if (and only if):

+ + The wall clock time of the system is perfect + The system (Operating System) time needs to be perfectly + in sync with the actual time as defined by an atomic clock or + a better time source. A good installation using NTP, and that is + up to date before Erlang starts, will have properties that for + most users and programs will be near indistinguishable from the + perfect time. Note that any larger corrections to the time done + by hand, or after Erlang has started, will partly (or + temporarily) invalidate some of the properties, as the time is + no longer perfect. + Less than one call per microsecond to erlang:now/0 is + done + This means that at any microsecond interval in + time, there can be no more than one call to erlang:now/0 in the + system. However, for the system not to loose it's properties + completely, it's enough that it on average is no more than one + call per microsecond (in one Erlang node). + +

The uniqueness property of erlang:now/0 is the most limiting + property. It means that erlang:now() maintains a global state and + that there is a hard-to-check property of the system that needs to + be maintained. For most applications this is still not a problem, + but a future system might very well manage to violate the + frequency limit on the calls globally. The uniqueness property is + also quite useless, as there are globally unique references that + provide a much better unique value to programs. However the + property will need to be maintained unless a really subtle + backward compatibility issue is to be introduced.

-
- New Time API - -

The old time API is based on - erlang:now/0. - erlang:now/0 was intended to be used for many unrelated - things. This tied these unrelated operations together and - caused issues with performance, scalability, accuracy, and - precision for operations that did not need to have - such issues. To improve this, the new API spreads different - functionality over multiple functions.

- -

To be backwards compatible, erlang:now/0 - remains as is, but you are strongly discouraged from using - it. Many use cases of erlang:now/0 - prevents you from using the new - multi-time warp - mode, which is an important part of this - new time functionality improvement.

- -

Some of the new BIFs on some systems, perhaps surprisingly, - return negative integer values on a newly started runtime - system. This is not a bug, but a memory use optimization.

- -

The new API consists of the following new BIFs:

- - -

erlang:convert_time_unit/3

-

erlang:monotonic_time/0

-

erlang:monotonic_time/1

-

erlang:system_time/0

-

erlang:system_time/1

-

erlang:time_offset/0

-

erlang:time_offset/1

-

erlang:timestamp/0

-

erlang:unique_integer/0

-

erlang:unique_integer/1

-

os:system_time/0

-

os:system_time/1

-
- -

The new API also consists of extensions of the following existing BIFs:

- - -

erlang:monitor(time_offset, clock_service)

-

erlang:system_flag(time_offset, finalize)

-

erlang:system_info(os_monotonic_time_source)

-

erlang:system_info(os_system_time_source)

-

erlang:system_info(time_offset)

-

erlang:system_info(time_warp_mode)

-

erlang:system_info(time_correction)

-

erlang:system_info(start_time)

-

erlang:system_info(end_time)

-
- - -
- New Erlang Monotonic Time -

Erlang monotonic time as such is new as of ERTS 7.0. - It is introduced to detach time measurements, such as elapsed - time from calendar time. In many use cases there is a need to - measure elapsed time or specify a time relative to another point - in time without the need to know the involved times in UTC or - any other globally defined time scale. By introducing a time - scale with a local definition of where it starts, time that do - not concern calendar time can be managed on that time - scale. Erlang monotonic time uses such a time scale with a - locally defined start.

- -

The introduction of Erlang monotonic time allows - us to adjust the two Erlang times (Erlang - monotonic time and Erlang system time) separately. By - doing this, the accuracy of elapsed time does not have to - suffer just because the system time happened to be - wrong at some point in time. Separate adjustments - of the two times are only performed in the time warp - modes, and only fully separated in the - multi-time - warp mode. All other modes than the - multi-time warp mode are for backwards - compatibility reasons. When using these modes, the - accuracy of Erlang monotonic time suffer, as - the adjustments of Erlang monotonic time in these - modes are more or less tied to Erlang system time.

- -

The adjustment of system time could have been made - smother than using a time warp approach, but we think - that would be a bad choice. As we can - express and measure time that is not connected to - calendar time by the use of Erlang monotonic time, it - is better to expose the change in Erlang system time - immediately. This as the Erlang applications - executing on the system can react on the change in - system time as soon as possible. This is also more or - less exactly how most operating systems handle this - (OS monotonic time and OS system time). By adjusting - system time smoothly, we would just hide the fact that - system time changed and make it harder for the Erlang - applications to react to the change in a sensible way.

- -

To be able to react to a change in Erlang - system time, you must be able to detect that it - happened. The change in Erlang system time occurs when - current time offset is changed. We have therefore - introduced the possibility to monitor the time offset using - erlang:monitor(time_offset, clock_service). - A process monitoring the time - offset is sent a message on the following format - when the time offset is changed:

- - {'CHANGE', MonitorReference, time_offset, clock_service, NewTimeOffset} -
- - -
- Unique Values -

Besides reporting time, erlang:now/0 also - produces unique and strictly monotonically increasing - values. To detach this functionality from - time measurements, we have introduced - erlang:unique_integer(). -

-
- - -
- How to Work with the New API -

Previously erlang:now/0 was the only option for doing - many things. This section deals with some things that - erlang:now/0 can be used for, and how you are to - these using the new API.

- - -
- Retrieve Erlang System Time - -

- Use erlang:now/0 to retrieve current Erlang system time. -

-
- -

- Use - erlang:system_time/1 - to retrieve current Erlang system time on the - time unit - of your choice.

-

If you want the same format as returned by erlang:now/0, use - erlang:timestamp/0. -

-
-
- - -
- Measure Elapsed Time - -

- Take timestamps with erlang:now/0 and calculate - the difference in time with - timer:now_diff/2. -

-
- -

- Take timestamps with - erlang:monotonic_time/0 - and calculate the time difference using ordinary subtraction. - The result will be in native - time unit. - If you want to convert the - result to another time unit, you can use - erlang:convert_time_unit/3. -

- -

An easier way to do this is to use - erlang:monotonic_time/1 - with the desired time unit. However, you can then lose accuracy - and precision. -

-
-
- - -
- Determine Order of Events - -

- Determine the order of events by saving a timestamp - with erlang:now/0 when the event occurs. -

-
- -

- Determine the order of events by saving the integer - returned by - erlang:unique_integer([monotonic]) - when the event occurs. These integers will be strictly - monotonically ordered on current runtime system instance - corresponding to creation time. -

-
-
- - -
- Determine Order of Events with Time of the Event - -

- Determine the order of events by saving a timestamp - with erlang:now/0 when the event occurs. -

-
- -

- Determine the order of events by saving a tuple containing - monotonic time - and a strictly - monotonically increasing integer as follows:

- - -Time = erlang:monotonic_time(), -UMI = erlang:unique_integer([monotonic]), -EventTag = {Time, UMI} - -

These tuples will be strictly monotonically ordered - on current runtime system instance according to - creation time. It is important that the - monotonic time is in the first element (the most - significant element when comparing 2-tuples). Using - the monotonic time in the tuples, you can calculate time - between events.

- -

If you are interested in Erlang system time at the - time when the event occurred, you can also save the time - offset before or after saving the events using - erlang:time_offset/0. - Erlang monotonic time added with the time - offset corresponds to Erlang system time.

- -

If you are executing in a mode where time offset - can change, and you want to get the actual - Erlang system time when the event occurred, you can - save the time offset as a third element in the tuple - (the least significant element when comparing 3-tuples).

-
-
- - -
- Create a Unique Name - -

- Use the values returned from erlang:now/0 - to create a name unique on the current runtime system instance. -

-
- -

- Use the value returned from - erlang:unique_integer/0 - to create a name unique on the current runtime system - instance. If you only want positive integers, you can use - erlang:unique_integer([positive]). -

-
-
- - -
- Seed Random Number Generation with a Unique Value - -

- Seed random number generation using erlang:now(). -

-
- -

- Seed random number generation using a combination of - erlang:monotonic_time(), - erlang:time_offset(), - erlang:unique_integer(), - and other functionality. -

-
-
- -

To sum up this section: Do not use erlang:now/0.

-
+ Should I use erlang:now/0 or os:timestamp/0 +

The simple answer is to use erlang:now/0 for everything where + you want to keep real time characteristics, but use os:timestamp + for things like logs, user communication and debugging (typically + timer:ts uses os:timestamp, as it is a test tool, not a real world + application API). The benefit of using os:timestamp/0 is that it's + faster and does not involve any global state (unless the operating + system has one). The downside is that it will be vulnerable to wall + clock time changes.

-
- - Support of Both New and Old OTP Releases -

It can be required that your code must run on a variety - of OTP installations of different OTP releases. If so, you - cannot use the new API out of the box, as it will - not be available on old pre OTP 18 releases. The solution - is not to avoid using the new API, as your - code then would not benefit from the scalability - and accuracy improvements made. Instead, use the - new API when available, and fall back on erlang:now/0 - when the new API is unavailable.

- -

Fortunately most of the new API can easily be - implemented using existing primitives, except for:

- - - - erlang:system_info(start_time) - - - erlang:system_info(end_time) - - - erlang:system_info(os_monotonic_time_source) - - - erlang:system_info(os_system_time_source)) - - - -

By wrapping the API with functions that fall back on - erlang:now/0 when the new API is unavailable, - and using these wrappers instead of using the API directly, - the problem is solved. These wrappers can, for example, - be implemented as in - $ERL_TOP/erts/example/time_compat.erl.

+ Turning off time correction +

If, for some reason, time correction causes trouble and you are + absolutely confident that the wall clock on the system is nearly + perfect, you can turn off time correction completely by giving the + +c option to erl. The probability for this being a + good idea, is very low.

+ diff -Nru erlang-18.2-dfsg/erts/doc/src/tty.xml erlang-17.3-dfsg/erts/doc/src/tty.xml --- erlang-18.2-dfsg/erts/doc/src/tty.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/tty.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/werl.xml erlang-17.3-dfsg/erts/doc/src/werl.xml --- erlang-18.2-dfsg/erts/doc/src/werl.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/werl.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/erts/doc/src/zlib.xml erlang-17.3-dfsg/erts/doc/src/zlib.xml --- erlang-18.2-dfsg/erts/doc/src/zlib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/doc/src/zlib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -100,7 +99,7 @@ -

Normally in the range -15..-8 | 8..15.

+

Normally in the range -15..-9 | 9..15.

@@ -150,7 +149,7 @@ currently the only supported method is deflated.

The WindowBits parameter is the base two logarithm of the window size (the size of the history buffer). It - should be in the range 8 through 15. Larger values + should be in the range 9 through 15. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if deflateInit/2. A negative WindowBits @@ -289,7 +288,7 @@

Initialize decompression session on zlib stream.

The WindowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). - It should be in the range 8 through 15. + It should be in the range 9 through 15. The default value is 15 if inflateInit/1 is used. If a compressed stream with a larger window size is given as input, inflate() will throw the data_error @@ -303,7 +302,7 @@ Decompress data

inflate/2 decompresses as much data as possible. - It may introduce some output latency (reading + It may some introduce some output latency (reading input without producing any output).

If a preset dictionary is needed at this point (see inflateSetDictionary below), inflate/2 throws a @@ -313,53 +312,6 @@ - - Decompress data with limited output size - -

Like inflate/2, but decompress no more data than - will fit in the buffer configured via setBufSize/2. - Is is useful when decompressing a stream with a high compression - ratio such that a small amount of compressed input may expand up to - 1000 times. - It returns {more, Decompressed}, when there is more output - available, and inflateChunk/1 should be used to read it. - It may introduce some output latency (reading - input without producing any output).

-

If a preset dictionary is needed at this point (see - inflateSetDictionary below), inflateChunk/2 throws a - {need_dictionary,Adler} exception where Adler is - the adler32 checksum of the dictionary chosen by the - compressor.

- -
-walk(Compressed, Handler) ->
-    Z = zlib:open(),
-    zlib:inflateInit(Z),
-    % Limit single uncompressed chunk size to 512kb
-    zlib:setBufSize(Z, 512 * 1024),
-    loop(Z, Handler, zlib:inflateChunk(Z, Compressed)),
-    zlib:inflateEnd(Z),
-    zlib:close(Z).
-
-loop(Z, Handler, {more, Uncompressed}) ->
-    Handler(Uncompressed),
-    loop(Z, Handler, zlib:inflateChunk(Z));
-loop(Z, Handler, Uncompressed) ->
-    Handler(Uncompressed).
-        
- - - - - Read next uncompressed chunk - -

Read next chunk of uncompressed data, initialized by - inflateChunk/2.

-

This function should be repeatedly called, while it returns - {more, Decompressed}.

-
-
- Initialize the decompression dictionary diff -Nru erlang-18.2-dfsg/erts/emulator/beam/atom.c erlang-17.3-dfsg/erts/emulator/beam/atom.c --- erlang-18.2-dfsg/erts/emulator/beam/atom.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/atom.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/atom.h erlang-17.3-dfsg/erts/emulator/beam/atom.h --- erlang-18.2-dfsg/erts/emulator/beam/atom.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/atom.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/atom.names erlang-17.3-dfsg/erts/emulator/beam/atom.names --- erlang-18.2-dfsg/erts/emulator/beam/atom.names 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/atom.names 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -69,7 +68,6 @@ atom abs_path atom absoluteURI atom ac -atom accessor atom active atom all atom all_but_first @@ -96,24 +94,21 @@ atom arg0 atom arity atom asn1 -atom async atom asynchronous atom atom atom atom_used atom attributes atom await_port_send_result atom await_proc_exit -atom await_result atom await_sched_wall_time_modifications atom awaiting_load atom awaiting_unload atom backtrace backtrace_depth -atom badarg badarith badarity badfile badfun badkey badmap badmatch badsig +atom badarg badarith badarity badfile badmatch badsig badfun atom bag atom band atom big atom bif_return_trap -atom bif_timer_server atom binary atom binary_bin_to_list_trap atom binary_copy_trap @@ -149,11 +144,9 @@ atom cd atom cdr atom cflags -atom CHANGE='CHANGE' atom characters_to_binary_int atom characters_to_list_int atom clear -atom clock_service atom close atom closed atom code @@ -163,7 +156,6 @@ atom compile atom compressed atom config_h -atom convert_time_unit atom connect atom connected atom connection_closed @@ -206,7 +198,6 @@ atom driver atom driver_options atom dsend -atom dsend_continue_trap atom dunlink atom duplicate_bag atom dupnames @@ -245,7 +236,7 @@ atom firstline atom flags atom flush -atom flush_monitor_messages +atom flush_monitor_message atom force atom format_cpu_topology atom free @@ -266,7 +257,6 @@ atom get_tcw atom getenv atom gather_gc_info_result -atom gather_io_bytes atom gather_sched_wall_time_result atom getting_linked atom getting_unlinked @@ -289,6 +279,7 @@ atom id atom if_clause atom ignore +atom imports atom in atom in_exiting atom inactive @@ -321,7 +312,6 @@ atom Le='=<' atom lf atom line -atom line_delimiter atom line_length atom linked_in_driver atom links @@ -345,7 +335,6 @@ atom maximum atom max_tables max_processes atom mbuf_size -atom md5 atom memory atom memory_internal atom memory_types @@ -353,11 +342,8 @@ atom message_binary atom message_queue_len atom messages -atom merge_trap atom meta atom meta_match_spec -atom micro_seconds -atom milli_seconds atom min_heap_size atom min_bin_vheap_size atom minor_version @@ -368,15 +354,12 @@ atom monitor atom monitor_nodes atom monitors -atom monotonic atom more atom multi_scheduling atom multiline -atom nano_seconds atom name atom named_table atom namelist -atom native atom native_addresses atom Neq='=/=' atom Neqeq='/=' @@ -467,7 +450,6 @@ atom port_count atom port_limit atom port_op -atom positive atom print atom priority atom private @@ -527,7 +509,6 @@ atom scheme atom scientific atom scope -atom seconds atom sensitive atom sequential_tracer atom sequential_trace_token @@ -573,7 +554,6 @@ atom this atom thread_pool_size atom threads -atom time_offset atom timeout atom timeout_value atom Times='*' diff -Nru erlang-18.2-dfsg/erts/emulator/beam/beam_bif_load.c erlang-17.3-dfsg/erts/emulator/beam/beam_bif_load.c --- erlang-18.2-dfsg/erts/emulator/beam/beam_bif_load.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/beam_bif_load.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -34,16 +33,18 @@ #include "beam_catches.h" #include "erl_binary.h" #include "erl_nif.h" -#include "erl_bits.h" #include "erl_thr_progress.h" static void set_default_trace_pattern(Eterm module); static Eterm check_process_code(Process* rp, Module* modp, int allow_gc, int *redsp); static void delete_code(Module* modp); static void decrement_refc(BeamInstr* code); +static int is_native(BeamInstr* code); static int any_heap_ref_ptrs(Eterm* start, Eterm* end, char* mod_start, Uint mod_size); static int any_heap_refs(Eterm* start, Eterm* end, char* mod_start, Uint mod_size); + + BIF_RETTYPE code_is_module_native_1(BIF_ALIST_1) { Module* modp; @@ -58,8 +59,8 @@ return am_undefined; } erts_rlock_old_code(code_ix); - res = (erts_is_module_native(modp->curr.code) || - erts_is_module_native(modp->old.code)) ? + res = ((modp->curr.code && is_native(modp->curr.code)) || + (modp->old.code != 0 && is_native(modp->old.code))) ? am_true : am_false; erts_runlock_old_code(code_ix); return res; @@ -370,7 +371,7 @@ ASSERT(commiter_state.stager == NULL); commiter_state.stager = c_p; erts_schedule_thr_prgr_later_op(smp_code_ix_commiter, NULL, &commiter_state.lop); - erts_proc_inc_refc(c_p); + erts_smp_proc_inc_refc(c_p); erts_suspend(c_p, ERTS_PROC_LOCK_MAIN, NULL); /* * smp_code_ix_commiter() will do the rest "later" @@ -397,7 +398,7 @@ erts_resume(p, ERTS_PROC_LOCK_STATUS); } erts_smp_proc_unlock(p, ERTS_PROC_LOCK_STATUS); - erts_proc_dec_refc(p); + erts_smp_proc_dec_refc(p); } #endif /* ERTS_SMP */ @@ -939,15 +940,7 @@ break; case TAG_PRIMARY_HEADER: if (!header_is_transparent(val)) { - Eterm* new_p; - if (header_is_bin_matchstate(val)) { - ErlBinMatchState *ms = (ErlBinMatchState*) p; - ErlBinMatchBuffer *mb = &(ms->mb); - if (in_area(EXPAND_POINTER(mb->orig), mod_start, mod_size)) { - return 1; - } - } - new_p = p + thing_arityval(val); + Eterm* new_p = p + thing_arityval(val); ASSERT(start <= new_p && new_p < end); p = new_p; } @@ -1113,3 +1106,25 @@ } return NIL; } + +static int +is_native(BeamInstr* code) +{ + Uint i, num_functions = code[MI_NUM_FUNCTIONS]; + + /* Check NativeAdress of first real function in module + */ + for (i=0; i 0) { + erts_print(to, to_arg, "%T f(" HEXF ") ", (Eterm) ap[0], ap[1]); + ap += 2; + size += 2; + n--; } } break; - case op_i_select_val_bins_rfI: - case op_i_select_val_bins_xfI: - case op_i_select_val_bins_yfI: + case op_i_select_tuple_arity_rfI: + case op_i_select_tuple_arity_xfI: + case op_i_select_tuple_arity_yfI: { int n = ap[-1]; while (n > 0) { - erts_print(to, to_arg, "%T f(" HEXF ") ", (Eterm) ap[0], ap[1]); + Uint arity = arityval(ap[0]); + erts_print(to, to_arg, " {%d} f(" HEXF ")", arity, ap[1]); ap += 2; size += 2; n--; } } break; - case op_i_select_tuple_arity_rfI: - case op_i_select_tuple_arity_xfI: - case op_i_select_tuple_arity_yfI: - { - int n = ap[-1]; - int ix = n - 1; /* without sentinel */ - - while (ix--) { - Uint arity = arityval(ap[0]); - erts_print(to, to_arg, "{%d} ", arity, ap[1]); - ap++; - size++; - } - /* print sentinel */ - erts_print(to, to_arg, "{%T} ", ap[0], ap[1]); - ap++; - size++; - ix = n; - while (ix--) { - erts_print(to, to_arg, "f(" HEXF ") ", ap[0]); - ap++; - size++; - } - } - break; case op_i_jump_on_val_rfII: case op_i_jump_on_val_xfII: case op_i_jump_on_val_yfII: @@ -666,40 +635,16 @@ case op_i_put_tuple_rI: case op_i_put_tuple_xI: case op_i_put_tuple_yI: - case op_new_map_dII: + case op_new_map_jdII: case op_update_map_assoc_jsdII: case op_update_map_exact_jsdII: - { - int n = unpacked[-1]; - - while (n > 0) { - if (!is_header(ap[0])) { - erts_print(to, to_arg, " %T", (Eterm) ap[0]); - } else { - switch ((ap[0] >> 2) & 0x03) { - case R_REG_DEF: - erts_print(to, to_arg, " x(0)"); - break; - case X_REG_DEF: - erts_print(to, to_arg, " x(%d)", ap[0] >> 4); - break; - case Y_REG_DEF: - erts_print(to, to_arg, " y(%d)", ap[0] >> 4); - break; - } - } - ap++, size++, n--; - } - } - break; + case op_i_has_map_fields_fsI: case op_i_get_map_elements_fsI: { int n = unpacked[-1]; while (n > 0) { - if (n % 3 == 1) { - erts_print(to, to_arg, " %X", ap[0]); - } else if (!is_header(ap[0])) { + if (!is_header(ap[0])) { erts_print(to, to_arg, " %T", (Eterm) ap[0]); } else { switch ((ap[0] >> 2) & 0x03) { diff -Nru erlang-18.2-dfsg/erts/emulator/beam/beam_emu.c erlang-17.3-dfsg/erts/emulator/beam/beam_emu.c --- erlang-18.2-dfsg/erts/emulator/beam/beam_emu.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/beam_emu.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -242,6 +241,10 @@ void** beam_ops; #endif +#ifndef ERTS_SMP /* Not supported with smp emulator */ +extern int count_instructions; +#endif + #define SWAPIN \ HTOP = HEAP_TOP(c_p); \ E = c_p->stop @@ -563,8 +566,7 @@ Store(term, Dst); \ } while (0) -#define Move2(S1, D1, S2, D2) D1 = (S1); D2 = (S2) -#define Move3(S1, D1, S2, D2, S3, D3) D1 = (S1); D2 = (S2); D3 = (S3) +#define Move2(src1, dst1, src2, dst2) dst1 = (src1); dst2 = (src2) #define MoveGenDest(src, dstp) \ if ((dstp) == NULL) { r(0) = (src); } else { *(dstp) = src; } @@ -664,9 +666,6 @@ #define EqualImmed(X, Y, Action) if (X != Y) { Action; } #define NotEqualImmed(X, Y, Action) if (X == Y) { Action; } -#define EqualExact(X, Y, Action) if (!EQ(X,Y)) { Action; } -#define IsLessThan(X, Y, Action) if (CMP_GE(X, Y)) { Action; } -#define IsGreaterEqual(X, Y, Action) if (CMP_LT(X, Y)) { Action; } #define IsFloat(Src, Fail) if (is_not_float(Src)) { Fail; } @@ -704,7 +703,9 @@ Fail; \ } -#define IsMap(Src, Fail) if (!is_map(Src)) { Fail; } +#define IsMap(Src, Fail) if (is_not_map(Src)) { Fail; } + +#define HasMapField(Src, Key, Fail) if (has_not_map_field(Src, Key)) { Fail; } #define GetMapElement(Src, Key, Dst, Fail) \ do { \ @@ -715,15 +716,6 @@ Dst = _res; \ } while (0) -#define GetMapElementHash(Src, Key, Hx, Dst, Fail) \ - do { \ - Eterm _res = get_map_element_hash(Src, Key, Hx); \ - if (is_non_value(_res)) { \ - Fail; \ - } \ - Dst = _res; \ - } while (0) - #define IsFunction(X, Action) \ do { \ if ( !(is_any_fun(X)) ) { \ @@ -972,8 +964,8 @@ Eterm map, BeamInstr* I) NOINLINE; static Eterm update_map_exact(Process* p, Eterm* reg, Eterm map, BeamInstr* I) NOINLINE; +static int has_not_map_field(Eterm map, Eterm key); static Eterm get_map_element(Eterm map, Eterm key); -static Eterm get_map_element_hash(Eterm map, Eterm key, Uint32 hx); /* * Functions not directly called by process_main(). OK to inline. @@ -1089,32 +1081,16 @@ DTRACE2(nif_return, process_name, mfa); \ } -#define DTRACE_GLOBAL_CALL_FROM_EXPORT(p,e) \ - do { \ - if (DTRACE_ENABLED(global_function_entry)) { \ - BeamInstr* fp = (BeamInstr *) (((Export *) (e))->addressv[erts_active_code_ix()]); \ - DTRACE_GLOBAL_CALL((p), (Eterm)fp[-3], (Eterm)fp[-2], fp[-1]); \ - } \ - } while(0) - -#define DTRACE_RETURN_FROM_PC(p) \ - do { \ - BeamInstr* fp; \ - if (DTRACE_ENABLED(function_return) && (fp = find_function_from_pc((p)->cp))) { \ - DTRACE_RETURN((p), (Eterm)fp[0], (Eterm)fp[1], (Uint)fp[2]); \ - } \ - } while(0) - #else /* USE_VM_PROBES */ -#define DTRACE_LOCAL_CALL(p, m, f, a) do {} while (0) -#define DTRACE_GLOBAL_CALL(p, m, f, a) do {} while (0) -#define DTRACE_GLOBAL_CALL_FROM_EXPORT(p, e) do {} while (0) -#define DTRACE_RETURN(p, m, f, a) do {} while (0) -#define DTRACE_RETURN_FROM_PC(p) do {} while (0) -#define DTRACE_BIF_ENTRY(p, m, f, a) do {} while (0) -#define DTRACE_BIF_RETURN(p, m, f, a) do {} while (0) -#define DTRACE_NIF_ENTRY(p, m, f, a) do {} while (0) -#define DTRACE_NIF_RETURN(p, m, f, a) do {} while (0) + +#define DTRACE_LOCAL_CALL(p, m, f, a) do {} while (0) +#define DTRACE_GLOBAL_CALL(p, m, f, a) do {} while (0) +#define DTRACE_RETURN(p, m, f, a) do {} while (0) +#define DTRACE_BIF_ENTRY(p, m, f, a) do {} while (0) +#define DTRACE_BIF_RETURN(p, m, f, a) do {} while (0) +#define DTRACE_NIF_ENTRY(p, m, f, a) do {} while (0) +#define DTRACE_NIF_RETURN(p, m, f, a) do {} while (0) + #endif /* USE_VM_PROBES */ /* @@ -1187,15 +1163,14 @@ Eterm (*arith_func)(Process* p, Eterm* reg, Uint live); -#ifdef ERTS_OPCODE_COUNTER_SUPPORT - static void* counting_opcodes[] = { DEFINE_COUNTING_OPCODES }; -#else #ifndef NO_JUMP_TABLE static void* opcodes[] = { DEFINE_OPCODES }; +#ifdef ERTS_OPCODE_COUNTER_SUPPORT + static void* counting_opcodes[] = { DEFINE_COUNTING_OPCODES }; +#endif #else int Go; #endif -#endif Uint temp_bits; /* Temporary used by BsSkipBits2 & BsGetInteger2 */ @@ -1394,39 +1369,7 @@ ASSERT(c_p->freason != BADMATCH || is_value(c_p->fvalue)); goto find_func_info; } - -#define DO_BIG_ARITH(Func,Arg1,Arg2) \ - do { \ - Uint live = Arg(1); \ - SWAPOUT; \ - reg[0] = r(0); \ - reg[live] = (Arg1); \ - reg[live+1] = (Arg2); \ - result = (Func)(c_p, reg, live); \ - r(0) = reg[0]; \ - SWAPIN; \ - ERTS_HOLE_CHECK(c_p); \ - if (is_value(result)) { \ - StoreBifResult(4,result); \ - } \ - goto lb_Cl_error; \ - } while(0) - - OpCase(i_plus_jIxxd): - { - Eterm result; - - if (is_both_small(xb(Arg(2)), xb(Arg(3)))) { - Sint i = signed_val(xb(Arg(2))) + signed_val(xb(Arg(3))); - ASSERT(MY_IS_SSMALL(i) == IS_SSMALL(i)); - if (MY_IS_SSMALL(i)) { - result = make_small(i); - StoreBifResult(4, result); - } - } - DO_BIG_ARITH(ARITH_FUNC(mixed_plus), xb(Arg(2)), xb(Arg(3))); - } - + OpCase(i_plus_jId): { Eterm result; @@ -1438,26 +1381,12 @@ result = make_small(i); STORE_ARITH_RESULT(result); } + } arith_func = ARITH_FUNC(mixed_plus); goto do_big_arith2; } - OpCase(i_minus_jIxxd): - { - Eterm result; - - if (is_both_small(xb(Arg(2)), xb(Arg(3)))) { - Sint i = signed_val(xb(Arg(2))) - signed_val(xb(Arg(3))); - ASSERT(MY_IS_SSMALL(i) == IS_SSMALL(i)); - if (MY_IS_SSMALL(i)) { - result = make_small(i); - StoreBifResult(4, result); - } - } - DO_BIG_ARITH(ARITH_FUNC(mixed_minus), xb(Arg(2)), xb(Arg(3))); - } - OpCase(i_minus_jId): { Eterm result; @@ -1550,52 +1479,6 @@ Next(2); } - OpCase(move_window3_xxxy): { - BeamInstr *next; - Eterm xt0, xt1, xt2; - Eterm *y = (Eterm *)(((unsigned char *)E) + (Arg(3))); - PreFetch(4, next); - xt0 = xb(Arg(0)); - xt1 = xb(Arg(1)); - xt2 = xb(Arg(2)); - y[0] = xt0; - y[1] = xt1; - y[2] = xt2; - NextPF(4, next); - } - OpCase(move_window4_xxxxy): { - BeamInstr *next; - Eterm xt0, xt1, xt2, xt3; - Eterm *y = (Eterm *)(((unsigned char *)E) + (Arg(4))); - PreFetch(5, next); - xt0 = xb(Arg(0)); - xt1 = xb(Arg(1)); - xt2 = xb(Arg(2)); - xt3 = xb(Arg(3)); - y[0] = xt0; - y[1] = xt1; - y[2] = xt2; - y[3] = xt3; - NextPF(5, next); - } - OpCase(move_window5_xxxxxy): { - BeamInstr *next; - Eterm xt0, xt1, xt2, xt3, xt4; - Eterm *y = (Eterm *)(((unsigned char *)E) + (Arg(5))); - PreFetch(6, next); - xt0 = xb(Arg(0)); - xt1 = xb(Arg(1)); - xt2 = xb(Arg(2)); - xt3 = xb(Arg(3)); - xt4 = xb(Arg(4)); - y[0] = xt0; - y[1] = xt1; - y[2] = xt2; - y[3] = xt3; - y[4] = xt4; - NextPF(6, next); - } - OpCase(i_move_call_only_fcr): { r(0) = Arg(1); } @@ -1643,7 +1526,12 @@ * is not loaded, it points to code which will invoke the error handler * (see lb_call_error_handler below). */ - DTRACE_GLOBAL_CALL_FROM_EXPORT(c_p, Arg(0)); +#ifdef USE_VM_CALL_PROBES + if (DTRACE_ENABLED(global_function_entry)) { + BeamInstr* fp = (BeamInstr *) (((Export *) Arg(0))->addressv[erts_active_code_ix()]); + DTRACE_GLOBAL_CALL(c_p, (Eterm)fp[-3], (Eterm)fp[-2], fp[-1]); + } +#endif Dispatchx(); OpCase(i_move_call_ext_cre): { @@ -1653,7 +1541,12 @@ /* FALL THROUGH */ OpCase(i_call_ext_e): SET_CP(c_p, I+2); - DTRACE_GLOBAL_CALL_FROM_EXPORT(c_p, Arg(0)); +#ifdef USE_VM_CALL_PROBES + if (DTRACE_ENABLED(global_function_entry)) { + BeamInstr* fp = (BeamInstr *) (((Export *) Arg(0))->addressv[erts_active_code_ix()]); + DTRACE_GLOBAL_CALL(c_p, (Eterm)fp[-3], (Eterm)fp[-2], fp[-1]); + } +#endif Dispatchx(); OpCase(i_move_call_ext_only_ecr): { @@ -1661,7 +1554,12 @@ } /* FALL THROUGH */ OpCase(i_call_ext_only_e): - DTRACE_GLOBAL_CALL_FROM_EXPORT(c_p, Arg(0)); +#ifdef USE_VM_CALL_PROBES + if (DTRACE_ENABLED(global_function_entry)) { + BeamInstr* fp = (BeamInstr *) (((Export *) Arg(0))->addressv[erts_active_code_ix()]); + DTRACE_GLOBAL_CALL(c_p, (Eterm)fp[-3], (Eterm)fp[-2], fp[-1]); + } +#endif Dispatchx(); OpCase(init_y): { @@ -1695,9 +1593,18 @@ Next(1); } + OpCase(return): { +#ifdef USE_VM_CALL_PROBES + BeamInstr* fptr; +#endif SET_I(c_p->cp); - DTRACE_RETURN_FROM_PC(c_p); + +#ifdef USE_VM_CALL_PROBES + if (DTRACE_ENABLED(function_return) && (fptr = find_function_from_pc(c_p->cp))) { + DTRACE_RETURN(c_p, (Eterm)fptr[0], (Eterm)fptr[1], (Uint)fptr[2]); + } +#endif /* * We must clear the CP to make sure that a stale value do not * create a false module dependcy preventing code upgrading. @@ -2120,32 +2027,44 @@ } GetArg1(1, timeout_value); if (timeout_value != make_small(0)) { +#if !defined(ARCH_64) || HALFWORD_HEAP + Uint time_val; +#endif - if (timeout_value == am_infinity) + if (is_small(timeout_value) && signed_val(timeout_value) > 0 && +#if defined(ARCH_64) && !HALFWORD_HEAP + ((unsigned_val(timeout_value) >> 32) == 0) +#else + 1 +#endif + ) { + /* + * The timer routiner will set c_p->i to the value in + * c_p->def_arg_reg[0]. Note that it is safe to use this + * location because there are no living x registers in + * a receive statement. + * Note that for the halfword emulator, the two first elements + * of the array are used. + */ + BeamInstr** pi = (BeamInstr**) c_p->def_arg_reg; + *pi = I+3; + set_timer(c_p, unsigned_val(timeout_value)); + } else if (timeout_value == am_infinity) { c_p->flags |= F_TIMO; - else { - int tres = erts_set_proc_timer_term(c_p, timeout_value); - if (tres == 0) { - /* - * The timer routiner will set c_p->i to the value in - * c_p->def_arg_reg[0]. Note that it is safe to use this - * location because there are no living x registers in - * a receive statement. - * Note that for the halfword emulator, the two first elements - * of the array are used. - */ - BeamInstr** pi = (BeamInstr**) c_p->def_arg_reg; - *pi = I+3; - } - else { /* Wrong time */ +#if !defined(ARCH_64) || HALFWORD_HEAP + } else if (term_to_Uint(timeout_value, &time_val)) { + BeamInstr** pi = (BeamInstr**) c_p->def_arg_reg; + *pi = I+3; + set_timer(c_p, time_val); +#endif + } else { /* Wrong time */ OpCase(i_wait_error_locked): { - erts_smp_proc_unlock(c_p, ERTS_PROC_LOCKS_MSG_RECEIVE); - /* Fall through */ - } + erts_smp_proc_unlock(c_p, ERTS_PROC_LOCKS_MSG_RECEIVE); + /* Fall through */ + } OpCase(i_wait_error): { - c_p->freason = EXC_TIMEOUT_VALUE; - goto find_func_info; - } + c_p->freason = EXC_TIMEOUT_VALUE; + goto find_func_info; } } @@ -2163,22 +2082,6 @@ OpCase(wait_f): wait2: { -#ifndef ERTS_SMP - if (ERTS_PROC_IS_EXITING(c_p)) { - /* - * I non smp case: - * - * Currently executing process might be sent an exit - * signal if it is traced by a port that it also is - * linked to, and the port terminates during the - * trace. In this case we do *not* want to clear - * the active flag, which will make the process hang - * in limbo forever. - */ - SWAPOUT; - goto do_schedule; - } -#endif c_p->i = (BeamInstr *) Arg(0); /* L1 */ SWAPOUT; c_p->arity = 0; @@ -2210,7 +2113,7 @@ if ((c_p->flags & (F_INSLPQUEUE | F_TIMO)) == 0) { BeamInstr** p = (BeamInstr **) c_p->def_arg_reg; *p = I+3; - erts_set_proc_timer_uword(c_p, Arg(1)); + set_timer(c_p, Arg(1)); } goto wait2; } @@ -2238,18 +2141,19 @@ NextPF(0, next); } + { Eterm select_val2; - OpCase(i_select_tuple_arity2_yfAAff): + OpCase(i_select_tuple_arity2_yfAfAf): select_val2 = yb(Arg(0)); goto do_select_tuple_arity2; - OpCase(i_select_tuple_arity2_xfAAff): + OpCase(i_select_tuple_arity2_xfAfAf): select_val2 = xb(Arg(0)); goto do_select_tuple_arity2; - OpCase(i_select_tuple_arity2_rfAAff): + OpCase(i_select_tuple_arity2_rfAfAf): select_val2 = r(0); I--; @@ -2260,22 +2164,22 @@ select_val2 = *tuple_val(select_val2); goto do_select_val2; - OpCase(i_select_val2_yfccff): + OpCase(i_select_val2_yfcfcf): select_val2 = yb(Arg(0)); goto do_select_val2; - OpCase(i_select_val2_xfccff): + OpCase(i_select_val2_xfcfcf): select_val2 = xb(Arg(0)); goto do_select_val2; - OpCase(i_select_val2_rfccff): + OpCase(i_select_val2_rfcfcf): select_val2 = r(0); I--; do_select_val2: if (select_val2 == Arg(2)) { - I += 3; - } else if (select_val2 == Arg(3)) { + I += 2; + } else if (select_val2 == Arg(4)) { I += 4; } @@ -2302,50 +2206,20 @@ do_select_tuple_arity: if (is_tuple(select_val)) { select_val = *tuple_val(select_val); - goto do_linear_search; + goto do_binary_search; } SET_I((BeamInstr *) Arg(1)); Goto(*I); - OpCase(i_select_val_lins_xfI): - select_val = xb(Arg(0)); - goto do_linear_search; - - OpCase(i_select_val_lins_yfI): - select_val = yb(Arg(0)); - goto do_linear_search; - - OpCase(i_select_val_lins_rfI): - select_val = r(0); - I--; - - do_linear_search: { - BeamInstr *vs = &Arg(3); - int ix = 0; - - for(;;) { - if (vs[ix+0] >= select_val) { ix += 0; break; } - if (vs[ix+1] >= select_val) { ix += 1; break; } - ix += 2; - } - - if (vs[ix] == select_val) { - I += ix + Arg(2) + 2; - } - - SET_I((BeamInstr *) Arg(1)); - Goto(*I); - } - - OpCase(i_select_val_bins_xfI): + OpCase(i_select_val_xfI): select_val = xb(Arg(0)); goto do_binary_search; - OpCase(i_select_val_bins_yfI): + OpCase(i_select_val_yfI): select_val = yb(Arg(0)); goto do_binary_search; - OpCase(i_select_val_bins_rfI): + OpCase(i_select_val_rfI): select_val = r(0); I--; @@ -2479,16 +2353,65 @@ Goto(*I); } - OpCase(new_map_dII): { + OpCase(new_map_jdII): { Eterm res; x(0) = r(0); SWAPOUT; - res = new_map(c_p, reg, I-1); + res = new_map(c_p, reg, I); SWAPIN; r(0) = x(0); - StoreResult(res, Arg(0)); - Next(3+Arg(2)); + StoreResult(res, Arg(1)); + Next(4+Arg(3)); + } + + OpCase(i_has_map_fields_fsI): { + map_t* mp; + Eterm map; + Eterm field; + Eterm *ks; + BeamInstr* fs; + Uint sz,n; + + GetArg1(1, map); + + /* this instruction assumes Arg1 is a map, + * i.e. that it follows a test is_map if needed. + */ + + mp = (map_t *)map_val(map); + sz = map_get_size(mp); + + if (sz == 0) { + SET_I((BeamInstr *) Arg(0)); + goto has_map_fields_fail; + } + + ks = map_get_keys(mp); + n = (Uint)Arg(2); + fs = &Arg(3); /* pattern fields */ + + ASSERT(n>0); + + while(sz) { + field = (Eterm)*fs; + if (EQ(field,*ks)) { + n--; + fs++; + if (n == 0) break; + } + ks++; sz--; + } + + if (n) { + SET_I((BeamInstr *) Arg(0)); + goto has_map_fields_fail; + } + + I += 4 + Arg(2); +has_map_fields_fail: + ASSERT(VALID_INSTR(*I)); + Goto(*I); } #define PUT_TERM_REG(term, desc) \ @@ -2511,8 +2434,12 @@ OpCase(i_get_map_elements_fsI): { Eterm map; + map_t *mp; + Eterm field; + Eterm *ks; + Eterm *vs; BeamInstr *fs; - Uint sz, n; + Uint sz,n; GetArg1(1, map); @@ -2520,55 +2447,41 @@ * i.e. that it follows a test is_map if needed. */ - n = (Uint)Arg(2) / 3; - fs = &Arg(3); /* pattern fields and target registers */ + mp = (map_t *)map_val(map); + sz = map_get_size(mp); - if (is_flatmap(map)) { - flatmap_t *mp; - Eterm *ks; - Eterm *vs; - - mp = (flatmap_t *)flatmap_val(map); - sz = flatmap_get_size(mp); - - if (sz == 0) { - ClauseFail(); - } + if (sz == 0) { + SET_I((BeamInstr *) Arg(0)); + goto get_map_elements_fail; + } - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); + n = (Uint)Arg(2) / 2; + fs = &Arg(3); /* pattern fields and target registers */ + ks = map_get_keys(mp); + vs = map_get_values(mp); - while(sz) { - if (EQ((Eterm) fs[0], *ks)) { - PUT_TERM_REG(*vs, fs[1]); - n--; - fs += 3; - /* no more values to fetch, we are done */ - if (n == 0) { - I = fs; - Next(-1); - } - } - ks++, sz--, vs++; + while(sz) { + field = (Eterm)*fs; + if (EQ(field,*ks)) { + PUT_TERM_REG(*vs, fs[1]); + n--; + fs += 2; + /* no more values to fetch, we are done */ + if (n == 0) break; } + ks++; sz--; + vs++; + } - ClauseFail(); - } else { - const Eterm *v; - Uint32 hx; - ASSERT(is_hashmap(map)); - while(n--) { - hx = fs[2]; - ASSERT(hx == hashmap_make_hash((Eterm)fs[0])); - if ((v = erts_hashmap_get(hx, (Eterm)fs[0], map)) == NULL) { - ClauseFail(); - } - PUT_TERM_REG(*v, fs[1]); - fs += 3; - } - I = fs; - Next(-1); + if (n) { + SET_I((BeamInstr *) Arg(0)); + goto get_map_elements_fail; } + + I += 4 + Arg(2); +get_map_elements_fail: + ASSERT(VALID_INSTR(*I)); + Goto(*I); } #undef PUT_TERM_REG @@ -2586,13 +2499,7 @@ StoreResult(res, Arg(2)); Next(5+Arg(4)); } else { - /* - * This can only happen if the code was compiled - * with the compiler in OTP 17. - */ - c_p->freason = BADMAP; - c_p->fvalue = map; - goto lb_Cl_error; + goto badarg; } } @@ -2610,7 +2517,7 @@ StoreResult(res, Arg(2)); Next(5+Arg(4)); } else { - goto lb_Cl_error; + goto badarg; } } @@ -2868,7 +2775,6 @@ } PreFetch(1, next); ASSERT(!ERTS_PROC_IS_EXITING(c_p)); - ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p); reg[0] = r(0); result = (*bf)(c_p, reg, I); ASSERT(!ERTS_PROC_IS_EXITING(c_p) || is_non_value(result)); @@ -2936,19 +2842,6 @@ goto do_big_arith2; } - OpCase(i_rem_jIxxd): - { - Eterm result; - - if (xb(Arg(3)) == SMALL_ZERO) { - goto badarith; - } else if (is_both_small(xb(Arg(2)), xb(Arg(3)))) { - result = make_small(signed_val(xb(Arg(2))) % signed_val(xb(Arg(3)))); - StoreBifResult(4, result); - } - DO_BIG_ARITH(ARITH_FUNC(int_rem),xb(Arg(2)),xb(Arg(3))); - } - OpCase(i_rem_jId): { Eterm result; @@ -2964,20 +2857,6 @@ } } - OpCase(i_band_jIxcd): - { - Eterm result; - - if (is_both_small(xb(Arg(2)), Arg(3))) { - /* - * No need to untag -- TAG & TAG == TAG. - */ - result = xb(Arg(2)) & Arg(3); - StoreBifResult(4, result); - } - DO_BIG_ARITH(ARITH_FUNC(band),xb(Arg(2)),Arg(3)); - } - OpCase(i_band_jId): { Eterm result; @@ -2993,8 +2872,6 @@ goto do_big_arith2; } -#undef DO_BIG_ARITH - do_big_arith2: { Eterm result; @@ -3646,8 +3523,6 @@ erts_pre_nif(&env, c_p, (struct erl_module_nif*)I[2]); reg[0] = r(0); nif_bif_result = (*fp)(&env, bif_nif_arity, reg); - if (env.exception_thrown) - nif_bif_result = THE_NON_VALUE; erts_post_nif(&env); } ASSERT(!ERTS_PROC_IS_EXITING(c_p) || is_non_value(nif_bif_result)); @@ -3681,7 +3556,7 @@ vbf = (BifFunction) Arg(0); PROCESS_MAIN_CHK_LOCKS(c_p); bif_nif_arity = I[-1]; - ASSERT(bif_nif_arity <= 4); + ASSERT(bif_nif_arity <= 3); ERTS_SMP_UNREQ_PROC_MAIN_LOCK(c_p); reg[0] = r(0); { @@ -3907,6 +3782,8 @@ * Allocate the binary struct itself. */ bptr = erts_bin_nrml_alloc(num_bytes); + bptr->flags = 0; + bptr->orig_size = num_bytes; erts_refc_init(&bptr->refc, 1); erts_current_bin = (byte *) bptr->orig_bytes; @@ -4006,6 +3883,8 @@ * Allocate the binary struct itself. */ bptr = erts_bin_nrml_alloc(tmp_arg1); + bptr->flags = 0; + bptr->orig_size = tmp_arg1; erts_refc_init(&bptr->refc, 1); erts_current_bin = (byte *) bptr->orig_bytes; @@ -5108,14 +4987,14 @@ * ... remainder of original BEAM code */ ASSERT(I[-5] == (Uint) OpCode(i_func_info_IaaI)); - c_p->hipe.u.ncallee = (void(*)(void)) I[-4]; + c_p->hipe.ncallee = (void(*)(void)) I[-4]; cmd = HIPE_MODE_SWITCH_CMD_CALL | (I[-1] << 8); ++hipe_trap_count; goto L_hipe_mode_switch; } OpCase(hipe_trap_call_closure): { ASSERT(I[-5] == (Uint) OpCode(i_func_info_IaaI)); - c_p->hipe.u.ncallee = (void(*)(void)) I[-4]; + c_p->hipe.ncallee = (void(*)(void)) I[-4]; cmd = HIPE_MODE_SWITCH_CMD_CALL_CLOSURE | (I[-1] << 8); ++hipe_trap_count; goto L_hipe_mode_switch; @@ -5149,10 +5028,7 @@ case HIPE_MODE_SWITCH_RES_RETURN: ASSERT(is_value(reg[0])); MoveReturn(reg[0], r(0)); - case HIPE_MODE_SWITCH_RES_CALL_EXPORTED: - c_p->i = c_p->hipe.u.callee_exp->addressv[erts_active_code_ix()]; - /*fall through*/ - case HIPE_MODE_SWITCH_RES_CALL_BEAM: + case HIPE_MODE_SWITCH_RES_CALL: SET_I(c_p->i); r(0) = reg[0]; Dispatch(); @@ -5269,14 +5145,22 @@ #ifndef NO_JUMP_TABLE #ifdef ERTS_OPCODE_COUNTER_SUPPORT + + /* Are tables correctly generated by beam_makeops? */ + ASSERT(sizeof(counting_opcodes) == sizeof(opcodes)); + + if (count_instructions) { #ifdef DEBUG - counting_opcodes[op_catch_end_y] = LabelAddr(lb_catch_end_y); + counting_opcodes[op_catch_end_y] = LabelAddr(lb_catch_end_y); #endif - counting_opcodes[op_i_func_info_IaaI] = LabelAddr(lb_i_func_info_IaaI); - beam_ops = counting_opcodes; -#else /* #ifndef ERTS_OPCODE_COUNTER_SUPPORT */ - beam_ops = opcodes; -#endif /* ERTS_OPCODE_COUNTER_SUPPORT */ + counting_opcodes[op_i_func_info_IaaI] = LabelAddr(lb_i_func_info_IaaI); + beam_ops = counting_opcodes; + } + else +#endif /* #ifndef ERTS_OPCODE_COUNTER_SUPPORT */ + { + beam_ops = opcodes; + } #endif /* NO_JUMP_TABLE */ em_call_error_handler = OpCode(call_error_handler); @@ -5389,9 +5273,7 @@ am_notalive, /* 14 */ am_system_limit, /* 15 */ am_try_clause, /* 16 */ - am_notsup, /* 17 */ - am_badmap, /* 18 */ - am_badkey, /* 19 */ + am_notsup /* 17 */ }; /* @@ -5594,35 +5476,18 @@ static void terminate_proc(Process* c_p, Eterm Value) { - Eterm *hp; - Eterm Args = NIL; - /* Add a stacktrace if this is an error. */ if (GET_EXC_CLASS(c_p->freason) == EXTAG_ERROR) { Value = add_stacktrace(c_p, Value, c_p->ftrace); } /* EXF_LOG is a primary exception flag */ if (c_p->freason & EXF_LOG) { - int alive = erts_is_alive; erts_dsprintf_buf_t *dsbufp = erts_create_logger_dsbuf(); - - /* Build the format message */ - erts_dsprintf(dsbufp, "Error in process ~p "); - if (alive) - erts_dsprintf(dsbufp, "on node ~p "); - erts_dsprintf(dsbufp, "with exit value:~n~p~n"); - - /* Build the args in reverse order */ - hp = HAlloc(c_p, 2); - Args = CONS(hp, Value, Args); - if (alive) { - hp = HAlloc(c_p, 2); - Args = CONS(hp, erts_this_node->sysname, Args); - } - hp = HAlloc(c_p, 2); - Args = CONS(hp, c_p->common.id, Args); - - erts_send_error_term_to_logger(c_p->group_leader, dsbufp, Args); + erts_dsprintf(dsbufp, "Error in process %T ", c_p->common.id); + if (erts_is_alive) + erts_dsprintf(dsbufp, "on node %T ", erts_this_node->sysname); + erts_dsprintf(dsbufp,"with exit value: %0.*T\n", display_items, Value); + erts_send_error_to_logger(c_p->group_leader, dsbufp); } /* * If we use a shared heap, the process will be garbage-collected. @@ -5664,8 +5529,6 @@ case (GET_EXC_INDEX(EXC_TRY_CLAUSE)): case (GET_EXC_INDEX(EXC_BADFUN)): case (GET_EXC_INDEX(EXC_BADARITY)): - case (GET_EXC_INDEX(EXC_BADMAP)): - case (GET_EXC_INDEX(EXC_BADKEY)): /* Some common exceptions: value -> {atom, value} */ ASSERT(is_value(Value)); hp = HAlloc(c_p, 3); @@ -5968,7 +5831,7 @@ * (e.g. spawn_link(erlang, abs, [1])). */ if (fi.current == NULL) { - erts_set_current_function(&fi, c_p->u.initial); + erts_set_current_function(&fi, c_p->initial); args = am_true; /* Just in case */ } else { args = get_args_from_exc(exc); @@ -6176,7 +6039,13 @@ } else if (ERTS_PROC_GET_SAVED_CALLS_BUF(p)) { save_calls(p, ep); } - DTRACE_GLOBAL_CALL_FROM_EXPORT(p, ep); + +#ifdef USE_VM_CALL_PROBES + if (DTRACE_ENABLED(global_function_entry)) { + BeamInstr *fptr = (BeamInstr *) ep->addressv[erts_active_code_ix()]; + DTRACE_GLOBAL_CALL(p, (Eterm)fptr[-3], (Eterm)fptr[-2], (Uint)fptr[-1]); + } +#endif return ep->addressv[erts_active_code_ix()]; } @@ -6225,7 +6094,13 @@ } else if (ERTS_PROC_GET_SAVED_CALLS_BUF(p)) { save_calls(p, ep); } - DTRACE_GLOBAL_CALL_FROM_EXPORT(p, ep); + +#ifdef USE_VM_CALL_PROBES + if (DTRACE_ENABLED(global_function_entry)) { + BeamInstr *fptr = (BeamInstr *) ep->addressv[erts_active_code_ix()]; + DTRACE_GLOBAL_CALL(p, (Eterm)fptr[-3], (Eterm)fptr[-2], (Uint)fptr[-1]); + } +#endif return ep->addressv[erts_active_code_ix()]; } @@ -6235,23 +6110,6 @@ int arity; Eterm tmp; -#ifndef ERTS_SMP - if (ERTS_PROC_IS_EXITING(c_p)) { - /* - * I non smp case: - * - * Currently executing process might be sent an exit - * signal if it is traced by a port that it also is - * linked to, and the port terminates during the - * trace. In this case we do *not* want to clear - * the active flag, which will make the process hang - * in limbo forever. Get out of here and terminate - * the process... - */ - return -1; - } -#endif - if (is_not_atom(module) || is_not_atom(function)) { /* * No need to test args here -- done below. @@ -6328,16 +6186,7 @@ ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p); PROCESS_MAIN_CHK_LOCKS(c_p); erts_smp_proc_lock(c_p, ERTS_PROC_LOCK_MSGQ|ERTS_PROC_LOCK_STATUS); -#ifndef ERTS_SMP - if (ERTS_PROC_IS_EXITING(c_p)) { - /* - * See comment in the begining of the function... - * - * This second test is needed since gc might be traced. - */ - return -1; - } -#else /* ERTS_SMP */ +#ifdef ERTS_SMP ERTS_SMP_MSGQ_MV_INQ2PRIVQ(c_p); if (!c_p->msg.len) #endif @@ -6573,75 +6422,57 @@ return make_fun(funp); } -static Eterm get_map_element(Eterm map, Eterm key) +static int has_not_map_field(Eterm map, Eterm key) { - Uint32 hx; - const Eterm *vs; - if (is_flatmap(map)) { - flatmap_t *mp; - Eterm *ks; - Uint i; - Uint n; - - mp = (flatmap_t *)flatmap_val(map); - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); - n = flatmap_get_size(mp); - if (is_immed(key)) { - for (i = 0; i < n; i++) { - if (ks[i] == key) { - return vs[i]; - } + map_t* mp; + Eterm* keys; + Uint i; + Uint n; + + mp = (map_t *)map_val(map); + keys = map_get_keys(mp); + n = map_get_size(mp); + if (is_immed(key)) { + for (i = 0; i < n; i++) { + if (keys[i] == key) { + return 0; } - } else { - for (i = 0; i < n; i++) { - if (EQ(ks[i], key)) { - return vs[i]; - } + } + } else { + for (i = 0; i < n; i++) { + if (EQ(keys[i], key)) { + return 0; } } - return THE_NON_VALUE; } - ASSERT(is_hashmap(map)); - hx = hashmap_make_hash(key); - vs = erts_hashmap_get(hx,key,map); - return vs ? *vs : THE_NON_VALUE; + return 1; } -static Eterm get_map_element_hash(Eterm map, Eterm key, Uint32 hx) +static Eterm get_map_element(Eterm map, Eterm key) { - const Eterm *vs; + map_t *mp; + Eterm* ks, *vs; + Uint i; + Uint n; - if (is_flatmap(map)) { - flatmap_t *mp; - Eterm *ks; - Uint i; - Uint n; - - mp = (flatmap_t *)flatmap_val(map); - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); - n = flatmap_get_size(mp); - if (is_immed(key)) { - for (i = 0; i < n; i++) { - if (ks[i] == key) { - return vs[i]; - } + mp = (map_t *)map_val(map); + ks = map_get_keys(mp); + vs = map_get_values(mp); + n = map_get_size(mp); + if (is_immed(key)) { + for (i = 0; i < n; i++) { + if (ks[i] == key) { + return vs[i]; } - } else { - for (i = 0; i < n; i++) { - if (EQ(ks[i], key)) { - return vs[i]; - } + } + } else { + for (i = 0; i < n; i++) { + if (EQ(ks[i], key)) { + return vs[i]; } } - return THE_NON_VALUE; } - - ASSERT(is_hashmap(map)); - ASSERT(hx == hashmap_make_hash(key)); - vs = erts_hashmap_get(hx, key, map); - return vs ? *vs : THE_NON_VALUE; + return THE_NON_VALUE; } #define GET_TERM(term, dest) \ @@ -6674,40 +6505,7 @@ Eterm *mhp,*thp; Eterm *E; BeamInstr *ptr; - flatmap_t *mp; - ErtsHeapFactory factory; - - ptr = &Arg(4); - - if (n > 2*MAP_SMALL_MAP_LIMIT) { - Eterm res; - if (HeapWordsLeft(p) < n) { - erts_garbage_collect(p, n, reg, Arg(2)); - } - - mhp = p->htop; - thp = p->htop; - E = p->stop; - - for (i = 0; i < n/2; i++) { - GET_TERM(*ptr++, *mhp++); - GET_TERM(*ptr++, *mhp++); - } - - p->htop = mhp; - - erts_factory_proc_init(&factory, p); - res = erts_hashmap_from_array(&factory, thp, n/2, 0); - erts_factory_close(&factory); - if (p->mbuf) { - Uint live = Arg(2); - reg[live] = res; - erts_garbage_collect(p, 0, reg, live+1); - res = reg[live]; - E = p->stop; - } - return res; - } + map_t *mp; if (HeapWordsLeft(p) < need) { erts_garbage_collect(p, need, reg, Arg(2)); @@ -6716,11 +6514,12 @@ thp = p->htop; mhp = thp + 1 + n/2; E = p->stop; + ptr = &Arg(4); keys = make_tuple(thp); *thp++ = make_arityval(n/2); - mp = (flatmap_t *)mhp; mhp += MAP_HEADER_FLATMAP_SZ; - mp->thing_word = MAP_HEADER_FLATMAP; + mp = (map_t *)mhp; mhp += MAP_HEADER_SIZE; + mp->thing_word = MAP_HEADER; mp->size = n/2; mp->keys = keys; @@ -6729,7 +6528,7 @@ GET_TERM(*ptr++, *mhp++); } p->htop = mhp; - return make_flatmap(mp); + return make_map(mp); } static Eterm @@ -6739,7 +6538,7 @@ Uint num_old; Uint num_updates; Uint need; - flatmap_t *old_mp, *mp; + map_t *old_mp, *mp; Eterm res; Eterm* hp; Eterm* E; @@ -6749,43 +6548,12 @@ Eterm new_key; Eterm* kp; - new_p = &Arg(5); - num_updates = Arg(4) / 2; - - if (is_not_flatmap(map)) { - Uint32 hx; - Eterm val; - - /* apparently the compiler does not emit is_map instructions, - * bad compiler */ - - if (is_not_hashmap(map)) - return THE_NON_VALUE; - - res = map; - E = p->stop; - while(num_updates--) { - /* assoc can't fail */ - GET_TERM(new_p[0], new_key); - GET_TERM(new_p[1], val); - hx = hashmap_make_hash(new_key); - - res = erts_hashmap_insert(p, hx, new_key, val, res, 0); - if (p->mbuf) { - Uint live = Arg(3); - reg[live] = res; - erts_garbage_collect(p, 0, reg, live+1); - res = reg[live]; - E = p->stop; - } - - new_p += 2; - } - return res; + if (is_not_map(map)) { + return THE_NON_VALUE; } - old_mp = (flatmap_t *) flatmap_val(map); - num_old = flatmap_get_size(old_mp); + old_mp = (map_t *) map_val(map); + num_old = map_get_size(old_mp); /* * If the old map is empty, create a new map. @@ -6800,13 +6568,14 @@ * update list are new). */ - need = 2*(num_old+num_updates) + 1 + MAP_HEADER_FLATMAP_SZ; + num_updates = Arg(4) / 2; + need = 2*(num_old+num_updates) + 1 + MAP_HEADER_SIZE; if (HeapWordsLeft(p) < need) { Uint live = Arg(3); reg[live] = map; erts_garbage_collect(p, need, reg, live+1); map = reg[live]; - old_mp = (flatmap_t *)flatmap_val(map); + old_mp = (map_t *)map_val(map); } /* @@ -6837,15 +6606,16 @@ kp = p->htop + 1; /* Point to first key */ hp = kp + num_old + num_updates; - res = make_flatmap(hp); - mp = (flatmap_t *)hp; - hp += MAP_HEADER_FLATMAP_SZ; - mp->thing_word = MAP_HEADER_FLATMAP; + res = make_map(hp); + mp = (map_t *)hp; + hp += MAP_HEADER_SIZE; + mp->thing_word = MAP_HEADER; mp->keys = make_tuple(kp-1); - old_vals = flatmap_get_values(old_mp); - old_keys = flatmap_get_keys(old_mp); + old_vals = map_get_values(old_mp); + old_keys = map_get_keys(old_mp); + new_p = &Arg(5); GET_TERM(*new_p, new_key); n = num_updates; @@ -6931,19 +6701,8 @@ n = kp - p->htop - 1; /* Actual number of keys/values */ *p->htop = make_arityval(n); - p->htop = hp; mp->size = n; - - /* The expensive case, need to build a hashmap */ - if (n > MAP_SMALL_MAP_LIMIT) { - res = erts_hashmap_from_ks_and_vs(p,flatmap_get_keys(mp),flatmap_get_values(mp),n); - if (p->mbuf) { - Uint live = Arg(3); - reg[live] = res; - erts_garbage_collect(p, 0, reg, live+1); - res = reg[live]; - } - } + p->htop = hp; return res; } @@ -6958,7 +6717,7 @@ Uint i; Uint num_old; Uint need; - flatmap_t *old_mp, *mp; + map_t *old_mp, *mp; Eterm res; Eterm* hp; Eterm* E; @@ -6967,61 +6726,18 @@ BeamInstr* new_p; Eterm new_key; - new_p = &Arg(5); - n = Arg(4) / 2; /* Number of values to be updated */ - ASSERT(n > 0); - - if (is_not_flatmap(map)) { - Uint32 hx; - Eterm val; - - /* apparently the compiler does not emit is_map instructions, - * bad compiler */ - - if (is_not_hashmap(map)) { - p->freason = BADMAP; - p->fvalue = map; - return THE_NON_VALUE; - } - - res = map; - E = p->stop; - while(n--) { - GET_TERM(new_p[0], new_key); - GET_TERM(new_p[1], val); - hx = hashmap_make_hash(new_key); - - res = erts_hashmap_insert(p, hx, new_key, val, res, 1); - if (is_non_value(res)) { - p->fvalue = new_key; - p->freason = BADKEY; - return res; - } - - if (p->mbuf) { - Uint live = Arg(3); - reg[live] = res; - erts_garbage_collect(p, 0, reg, live+1); - res = reg[live]; - E = p->stop; - } - - new_p += 2; - } - return res; + if (is_not_map(map)) { + return THE_NON_VALUE; } - old_mp = (flatmap_t *) flatmap_val(map); - num_old = flatmap_get_size(old_mp); + old_mp = (map_t *) map_val(map); + num_old = map_get_size(old_mp); /* - * If the old map is empty, fail. + * If the old map is empty, create a new map. */ if (num_old == 0) { - E = p->stop; - p->freason = BADKEY; - GET_TERM(new_p[0], p->fvalue); return THE_NON_VALUE; } @@ -7029,13 +6745,13 @@ * Allocate the exact heap space needed. */ - need = num_old + MAP_HEADER_FLATMAP_SZ; + need = num_old + MAP_HEADER_SIZE; if (HeapWordsLeft(p) < need) { Uint live = Arg(3); reg[live] = map; erts_garbage_collect(p, need, reg, live+1); map = reg[live]; - old_mp = (flatmap_t *)flatmap_val(map); + old_mp = (map_t *)map_val(map); } /* @@ -7045,20 +6761,23 @@ hp = p->htop; E = p->stop; - old_vals = flatmap_get_values(old_mp); - old_keys = flatmap_get_keys(old_mp); + old_vals = map_get_values(old_mp); + old_keys = map_get_keys(old_mp); - res = make_flatmap(hp); - mp = (flatmap_t *)hp; - hp += MAP_HEADER_FLATMAP_SZ; - mp->thing_word = MAP_HEADER_FLATMAP; + res = make_map(hp); + mp = (map_t *)hp; + hp += MAP_HEADER_SIZE; + mp->thing_word = MAP_HEADER; mp->size = num_old; mp->keys = old_mp->keys; /* Get array of key/value pairs to be updated */ + new_p = &Arg(5); GET_TERM(*new_p, new_key); /* Update all values */ + n = Arg(4) / 2; /* Number of values to be updated */ + ASSERT(n > 0); for (i = 0; i < num_old; i++) { if (!EQ(*old_keys, new_key)) { /* Not same keys */ @@ -7091,8 +6810,6 @@ * update list did not previously exist. */ ASSERT(hp == p->htop + need); - p->freason = BADKEY; - p->fvalue = new_key; return THE_NON_VALUE; } #undef GET_TERM diff -Nru erlang-18.2-dfsg/erts/emulator/beam/beam_load.c erlang-17.3-dfsg/erts/emulator/beam/beam_load.c --- erlang-18.2-dfsg/erts/emulator/beam/beam_load.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/beam_load.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -37,7 +36,6 @@ #include "beam_catches.h" #include "erl_binary.h" #include "erl_zlib.h" -#include "erl_map.h" #ifdef HIPE #include "hipe_bif0.h" @@ -206,7 +204,10 @@ typedef struct { Eterm term; /* The tagged term (in the heap). */ - ErlHeapFragment* heap_frags; + Uint heap_size; /* (Exact) size on the heap. */ + SWord offset; /* Offset from temporary location to final. */ + ErlOffHeap off_heap; /* Start of linked list of ProcBins. */ + Eterm* heap; /* Heap for term. */ } Literal; /* @@ -244,7 +245,7 @@ /* * This structure contains all information about the module being loaded. */ -#define MD5_SIZE 16 + typedef struct LoaderState { /* * The current logical file within the binary. @@ -291,7 +292,7 @@ StringPatch* string_patches; /* Linked list of position into string table to patch. */ BeamInstr catches; /* Linked list of catch_yf instructions. */ unsigned loaded_size; /* Final size of code when loaded. */ - byte mod_md5[MD5_SIZE]; /* MD5 for module code. */ + byte mod_md5[16]; /* MD5 for module code. */ int may_load_nif; /* true if NIFs may later be loaded for this module */ int on_load; /* Index in the code for the on_load function * (or 0 if there is no on_load function) @@ -475,8 +476,6 @@ static void free_loader_state(Binary* magic); -static ErlHeapFragment* new_literal_fragment(Uint size); -static void free_literal_fragment(ErlHeapFragment*); static void loader_state_dtor(Binary* magic); static Eterm insert_new_code(Process *c_p, ErtsProcLocks c_p_locks, Eterm group_leader, Eterm module, @@ -525,16 +524,11 @@ static void new_string_patch(LoaderState* stp, int pos); static Uint new_literal(LoaderState* stp, Eterm** hpp, Uint heap_size); static int genopargcompare(GenOpArg* a, GenOpArg* b); -static Eterm get_module_info(Process* p, ErtsCodeIndex code_ix, - BeamInstr* code, Eterm module, Eterm what); -static Eterm exported_from_module(Process* p, ErtsCodeIndex code_ix, - Eterm mod); -static Eterm functions_in_module(Process* p, BeamInstr* code); -static Eterm attributes_for_module(Process* p, BeamInstr* code); -static Eterm compilation_info_for_module(Process* p, BeamInstr* code); -static Eterm md5_of_module(Process* p, BeamInstr* code); -static Eterm has_native(BeamInstr* code); -static Eterm native_addresses(Process* p, BeamInstr* code); +static Eterm exported_from_module(Process* p, Eterm mod); +static Eterm functions_in_module(Process* p, Eterm mod); +static Eterm attributes_for_module(Process* p, Eterm mod); +static Eterm compilation_info_for_module(Process* p, Eterm mod); +static Eterm native_addresses(Process* p, Eterm mod); int patch_funentries(Eterm Patchlist); int patch(Eterm Addresses, Uint fe); static int safe_mul(UWord a, UWord b, UWord* resp); @@ -654,7 +648,6 @@ stp->code[MI_COMPILE_PTR] = 0; stp->code[MI_COMPILE_SIZE] = 0; stp->code[MI_COMPILE_SIZE_ON_HEAP] = 0; - stp->code[MI_MD5_PTR] = 0; /* * Read the atom table. @@ -886,28 +879,6 @@ } } -static ErlHeapFragment* new_literal_fragment(Uint size) -{ - ErlHeapFragment* bp; - bp = (ErlHeapFragment*) ERTS_HEAP_ALLOC(ERTS_ALC_T_PREPARED_CODE, - ERTS_HEAP_FRAG_SIZE(size)); - ERTS_INIT_HEAP_FRAG(bp, size); - return bp; -} - -static void free_literal_fragment(ErlHeapFragment* bp) -{ - ASSERT(bp != NULL); - do { - ErlHeapFragment* next_bp = bp->next; - - erts_cleanup_offheap(&bp->off_heap); - ERTS_HEAP_FREE(ERTS_ALC_T_PREPARED_CODE, (void *) bp, - ERTS_HEAP_FRAG_SIZE(bp->size)); - bp = next_bp; - }while (bp != NULL); -} - /* * This destructor function can safely be called multiple times. */ @@ -947,9 +918,10 @@ if (stp->literals != 0) { int i; for (i = 0; i < stp->num_literals; i++) { - if (stp->literals[i].heap_frags != 0) { - free_literal_fragment(stp->literals[i].heap_frags); - stp->literals[i].heap_frags = 0; + if (stp->literals[i].heap != 0) { + erts_free(ERTS_ALC_T_PREPARED_CODE, + (void *) stp->literals[i].heap); + stp->literals[i].heap = 0; } } erts_free(ERTS_ALC_T_PREPARED_CODE, (void *) stp->literals); @@ -1474,7 +1446,6 @@ return 0; } - static int read_literal_table(LoaderState* stp) { @@ -1496,7 +1467,7 @@ stp->allocated_literals = stp->num_literals; for (i = 0; i < stp->num_literals; i++) { - stp->literals[i].heap_frags = 0; + stp->literals[i].heap = 0; } for (i = 0; i < stp->num_literals; i++) { @@ -1504,38 +1475,28 @@ Sint heap_size; byte* p; Eterm val; - ErtsHeapFactory factory; + Eterm* hp; GetInt(stp, 4, sz); /* Size of external term format. */ GetString(stp, p, sz); if ((heap_size = erts_decode_ext_size(p, sz)) < 0) { LoadError1(stp, "literal %d: bad external format", i); } - - if (heap_size > 0) { - erts_factory_message_init(&factory, NULL, NULL, - new_literal_fragment(heap_size)); - factory.alloc_type = ERTS_ALC_T_PREPARED_CODE; - val = erts_decode_ext(&factory, &p); - - if (is_non_value(val)) { - LoadError1(stp, "literal %d: bad external format", i); - } - erts_factory_close(&factory); - stp->literals[i].heap_frags = factory.heap_frags; - stp->total_literal_size += erts_used_frag_sz(factory.heap_frags); - } - else { - erts_factory_dummy_init(&factory); - val = erts_decode_ext(&factory, &p); - if (is_non_value(val)) { - LoadError1(stp, "literal %d: bad external format", i); - } - ASSERT(is_immed(val)); - stp->literals[i].heap_frags = NULL; - } - stp->literals[i].term = val; - + hp = stp->literals[i].heap = erts_alloc(ERTS_ALC_T_PREPARED_CODE, + heap_size*sizeof(Eterm)); + stp->literals[i].off_heap.first = 0; + stp->literals[i].off_heap.overhead = 0; + val = erts_decode_ext(&hp, &stp->literals[i].off_heap, &p); + stp->literals[i].heap_size = hp - stp->literals[i].heap; + if (stp->literals[i].heap_size > heap_size) { + erl_exit(1, "overrun by %d word(s) for literal heap, term %d", + stp->literals[i].heap_size - heap_size, i); + } + if (is_non_value(val)) { + LoadError1(stp, "literal %d: bad external format", i); + } + stp->literals[i].term = val; + stp->total_literal_size += stp->literals[i].heap_size; } erts_free(ERTS_ALC_T_TMP, uncompressed); return 1; @@ -3208,11 +3169,7 @@ static int negation_is_small(LoaderState* stp, GenOpArg Int) { - /* Check for the rare case of overflow in BeamInstr (UWord) -> Sint - * Cast to the correct type before using IS_SSMALL (Sint) */ - return Int.type == TAG_i && - !(Int.val & ~((((BeamInstr)1) << ((sizeof(Sint)*8)-1))-1)) && - IS_SSMALL(-((Sint)Int.val)); + return Int.type == TAG_i && IS_SSMALL(-Int.val); } @@ -3362,10 +3319,9 @@ { GenOp* op; - GenOpArg *tmp; int arity = Size.val + 3; int size = Size.val / 2; - int i, j, align = 0; + int i; /* * Verify the validity of the list. @@ -3380,37 +3336,9 @@ } /* - * Use a special-cased instruction if there are only two values. - */ - if (size == 2) { - NEW_GENOP(stp, op); - op->next = NULL; - op->op = genop_i_select_tuple_arity2_6; - GENOP_ARITY(op, arity - 1); - op->a[0] = S; - op->a[1] = Fail; - op->a[2].type = TAG_u; - op->a[2].val = Rest[0].val; - op->a[3].type = TAG_u; - op->a[3].val = Rest[2].val; - op->a[4] = Rest[1]; - op->a[5] = Rest[3]; - - return op; - } - - /* * Generate the generic instruction. - * Assumption: - * Few different tuple arities to select on (fewer than 20). - * Use linear scan approach. */ - align = 1; - - arity += 2*align; - size += align; - NEW_GENOP(stp, op); op->next = NULL; op->op = genop_i_select_tuple_arity_3; @@ -3418,35 +3346,38 @@ op->a[0] = S; op->a[1] = Fail; op->a[2].type = TAG_u; - op->a[2].val = size; - - tmp = (GenOpArg *) erts_alloc(ERTS_ALC_T_LOADER_TMP, sizeof(GenOpArg)*(arity-2*align)); - - for (i = 3; i < arity - 2*align; i+=2) { - tmp[i-3].type = TAG_v; - tmp[i-3].val = make_arityval(Rest[i-3].val); - tmp[i-2] = Rest[i-2]; + op->a[2].val = Size.val / 2; + for (i = 0; i < Size.val; i += 2) { + op->a[i+3].type = TAG_v; + op->a[i+3].val = make_arityval(Rest[i].val); + op->a[i+4] = Rest[i+1]; } /* - * Sort the values to make them useful for a sentinel search + * Sort the values to make them useful for a binary search. */ - qsort(tmp, size - align, 2*sizeof(GenOpArg), - (int (*)(const void *, const void *)) genopargcompare); - - j = 3; - for (i = 3; i < arity - 2*align; i += 2) { - op->a[j] = tmp[i-3]; - op->a[j + size] = tmp[i-2]; - j++; + qsort(op->a+3, size, 2*sizeof(GenOpArg), + (int (*)(const void *, const void *)) genopargcompare); +#ifdef DEBUG + for (i = 3; i < arity-2; i += 2) { + ASSERT(op->a[i].val < op->a[i+2].val); } +#endif - erts_free(ERTS_ALC_T_LOADER_TMP, (void *) tmp); - - op->a[j].type = TAG_u; - op->a[j].val = ~((BeamInstr)0); - op->a[j+size] = Fail; + /* + * Use a special-cased instruction if there are only two values. + */ + if (size == 2) { + op->op = genop_i_select_tuple_arity2_6; + op->arity--; + op->a[2].type = TAG_u; + op->a[2].val = arityval(op->a[3].val); + op->a[3] = op->a[4]; + op->a[4].type = TAG_u; + op->a[4].val = arityval(op->a[5].val); + op->a[5] = op->a[6]; + } return op; } @@ -3669,110 +3600,46 @@ GenOpArg Size, GenOpArg* Rest) { GenOp* op; - GenOpArg *tmp; int arity = Size.val + 3; int size = Size.val / 2; - int i, j, align = 0; - - if (size == 2) { - - /* - * Use a special-cased instruction if there are only two values. - */ - - NEW_GENOP(stp, op); - op->next = NULL; - op->op = genop_i_select_val2_6; - GENOP_ARITY(op, arity - 1); - op->a[0] = S; - op->a[1] = Fail; - op->a[2] = Rest[0]; - op->a[3] = Rest[2]; - op->a[4] = Rest[1]; - op->a[5] = Rest[3]; - - return op; - - } else if (size > 10) { - - /* binary search instruction */ - - NEW_GENOP(stp, op); - op->next = NULL; - op->op = genop_i_select_val_bins_3; - GENOP_ARITY(op, arity); - op->a[0] = S; - op->a[1] = Fail; - op->a[2].type = TAG_u; - op->a[2].val = size; - for (i = 3; i < arity; i++) { - op->a[i] = Rest[i-3]; - } - - /* - * Sort the values to make them useful for a binary search. - */ - - qsort(op->a+3, size, 2*sizeof(GenOpArg), - (int (*)(const void *, const void *)) genopargcompare); -#ifdef DEBUG - for (i = 3; i < arity-2; i += 2) { - ASSERT(op->a[i].val < op->a[i+2].val); - } -#endif - return op; - } - - /* linear search instruction */ - - align = 1; - - arity += 2*align; - size += align; + int i; NEW_GENOP(stp, op); op->next = NULL; - op->op = genop_i_select_val_lins_3; + op->op = genop_i_select_val_3; GENOP_ARITY(op, arity); op->a[0] = S; op->a[1] = Fail; op->a[2].type = TAG_u; op->a[2].val = size; - - tmp = (GenOpArg *) erts_alloc(ERTS_ALC_T_LOADER_TMP, sizeof(GenOpArg)*(arity-2*align)); - - for (i = 3; i < arity - 2*align; i++) { - tmp[i-3] = Rest[i-3]; + for (i = 3; i < arity; i++) { + op->a[i] = Rest[i-3]; } /* - * Sort the values to make them useful for a sentinel search + * Sort the values to make them useful for a binary search. */ - qsort(tmp, size - align, 2*sizeof(GenOpArg), - (int (*)(const void *, const void *)) genopargcompare); - - j = 3; - for (i = 3; i < arity - 2*align; i += 2) { - op->a[j] = tmp[i-3]; - op->a[j+size] = tmp[i-2]; - j++; - } - - erts_free(ERTS_ALC_T_LOADER_TMP, (void *) tmp); - - /* add sentinel */ - - op->a[j].type = TAG_u; - op->a[j].val = ~((BeamInstr)0); - op->a[j+size] = Fail; - + qsort(op->a+3, size, 2*sizeof(GenOpArg), + (int (*)(const void *, const void *)) genopargcompare); #ifdef DEBUG - for (i = 0; i < size - 1; i++) { - ASSERT(op->a[i+3].val <= op->a[i+4].val); + for (i = 3; i < arity-2; i += 2) { + ASSERT(op->a[i].val < op->a[i+2].val); } #endif + /* + * Use a special-cased instruction if there are only two values. + */ + if (size == 2) { + op->op = genop_i_select_val2_6; + op->arity--; + op->a[2] = op->a[3]; + op->a[3] = op->a[4]; + op->a[4] = op->a[5]; + op->a[5] = op->a[6]; + } + return op; } @@ -4092,139 +3959,8 @@ } /* - * Predicate to test whether the given literal is a map. - */ - -static int -literal_is_map(LoaderState* stp, GenOpArg Lit) -{ - Eterm term; - - ASSERT(Lit.type == TAG_q); - term = stp->literals[Lit.val].term; - return is_map(term); -} - -/* - * Predicate to test whether the given literal is an empty map. - */ - -static int -is_empty_map(LoaderState* stp, GenOpArg Lit) -{ - Eterm term; - - if (Lit.type != TAG_q) { - return 0; - } - term = stp->literals[Lit.val].term; - return is_flatmap(term) && flatmap_get_size(flatmap_val(term)) == 0; -} - -/* - * Pseudo predicate map_key_sort that will sort the Rest operand for - * map instructions as a side effect. - */ - -typedef struct SortGenOpArg { - Eterm term; /* Term to use for comparing */ - GenOpArg arg; /* Original data */ -} SortGenOpArg; - -static int -genopargtermcompare(SortGenOpArg* a, SortGenOpArg* b) -{ - return CMP_TERM(a->term, b->term); -} - -static int -map_key_sort(LoaderState* stp, GenOpArg Size, GenOpArg* Rest) -{ - SortGenOpArg* t; - unsigned size = Size.val; - unsigned i; - - if (size == 2) { - return 1; /* Already sorted. */ - } - - - t = (SortGenOpArg *) erts_alloc(ERTS_ALC_T_TMP, size*sizeof(SortGenOpArg)); - - /* - * Copy original data and sort keys to a temporary array. - */ - for (i = 0; i < size; i += 2) { - t[i].arg = Rest[i]; - switch (Rest[i].type) { - case TAG_a: - t[i].term = Rest[i].val; - ASSERT(is_atom(t[i].term)); - break; - case TAG_i: - t[i].term = make_small(Rest[i].val); - break; - case TAG_n: - t[i].term = NIL; - break; - case TAG_q: - t[i].term = stp->literals[Rest[i].val].term; - break; - default: - /* - * Not a literal key. Not allowed. Only a single - * variable key is allowed in each map instruction. - */ - erts_free(ERTS_ALC_T_TMP, (void *) t); - return 0; - } -#ifdef DEBUG - t[i+1].term = THE_NON_VALUE; -#endif - t[i+1].arg = Rest[i+1]; - } - - /* - * Sort the temporary array. - */ - qsort((void *) t, size / 2, 2 * sizeof(SortGenOpArg), - (int (*)(const void *, const void *)) genopargtermcompare); - - /* - * Copy back the sorted, original data. - */ - for (i = 0; i < size; i++) { - Rest[i] = t[i].arg; - } - - erts_free(ERTS_ALC_T_TMP, (void *) t); - return 1; -} - -static int -hash_genop_arg(LoaderState* stp, GenOpArg Key, Uint32* hx) -{ - switch (Key.type) { - case TAG_a: - *hx = hashmap_make_hash(Key.val); - return 1; - case TAG_i: - *hx = hashmap_make_hash(make_small(Key.val)); - return 1; - case TAG_n: - *hx = hashmap_make_hash(NIL); - return 1; - case TAG_q: - *hx = hashmap_make_hash(stp->literals[Key.val].term); - return 1; - default: - return 0; - } -} - -/* * Replace a get_map_elements with one key to an instruction with one - * element. + * element */ static GenOp* @@ -4232,99 +3968,37 @@ GenOpArg Size, GenOpArg* Rest) { GenOp* op; - GenOpArg Key; - Uint32 hx = 0; ASSERT(Size.type == TAG_u); NEW_GENOP(stp, op); op->next = NULL; - op->a[0] = Fail; - op->a[1] = Src; - op->a[2] = Rest[0]; - - Key = Rest[0]; - if (hash_genop_arg(stp, Key, &hx)) { - op->arity = 5; - op->op = genop_i_get_map_element_hash_5; - op->a[3].type = TAG_u; - op->a[3].val = (BeamInstr) hx; - op->a[4] = Rest[1]; - } else { - op->arity = 4; - op->op = genop_i_get_map_element_4; - op->a[3] = Rest[1]; - } - return op; -} - -static GenOp* -gen_get_map_elements(LoaderState* stp, GenOpArg Fail, GenOpArg Src, - GenOpArg Size, GenOpArg* Rest) -{ - GenOp* op; - Uint32 hx; - Uint i; - GenOpArg* dst; -#ifdef DEBUG - int good_hash; -#endif - - ASSERT(Size.type == TAG_u); + op->op = genop_get_map_element_4; + op->arity = 4; - NEW_GENOP(stp, op); - op->op = genop_i_get_map_elements_3; - GENOP_ARITY(op, 3 + 3*(Size.val/2)); - op->next = NULL; op->a[0] = Fail; op->a[1] = Src; - op->a[2].type = TAG_u; - op->a[2].val = 3*(Size.val/2); - - dst = op->a+3; - for (i = 0; i < Size.val / 2; i++) { - dst[0] = Rest[2*i]; - dst[1] = Rest[2*i+1]; -#ifdef DEBUG - good_hash = -#endif - hash_genop_arg(stp, dst[0], &hx); -#ifdef DEBUG - ASSERT(good_hash); -#endif - dst[2].type = TAG_u; - dst[2].val = (BeamInstr) hx; - dst += 3; - } + op->a[2] = Rest[0]; + op->a[3] = Rest[1]; return op; } static GenOp* -gen_has_map_fields(LoaderState* stp, GenOpArg Fail, GenOpArg Src, - GenOpArg Size, GenOpArg* Rest) +gen_has_map_field(LoaderState* stp, GenOpArg Fail, GenOpArg Src, + GenOpArg Size, GenOpArg* Rest) { GenOp* op; - Uint i; - Uint n; ASSERT(Size.type == TAG_u); - n = Size.val; NEW_GENOP(stp, op); - GENOP_ARITY(op, 3 + 2*n); op->next = NULL; - op->op = genop_get_map_elements_3; + op->op = genop_has_map_field_3; + op->arity = 4; op->a[0] = Fail; op->a[1] = Src; - op->a[2].type = TAG_u; - op->a[2].val = 2*n; - - for (i = 0; i < n; i++) { - op->a[3+2*i] = Rest[i]; - op->a[3+2*i+1].type = TAG_x; - op->a[3+2*i+1].val = 0; /* x(0); normally not used */ - } + op->a[2] = Rest[0]; return op; } @@ -4368,7 +4042,7 @@ } size = (stp->ci * sizeof(BeamInstr)) + (stp->total_literal_size * sizeof(Eterm)) + - strtab_size + attr_size + compile_size + MD5_SIZE + line_size; + strtab_size + attr_size + compile_size + line_size; /* * Move the code to its final location. @@ -4405,9 +4079,8 @@ Uint* low; Uint* high; LiteralPatch* lp; - ErlOffHeap code_off_heap; - - ERTS_INIT_OFF_HEAP(&code_off_heap); + struct erl_off_heap_header* off_heap = 0; + struct erl_off_heap_header** off_heap_last = &off_heap; low = (Uint *) (code+stp->ci); high = low + stp->total_literal_size; @@ -4415,21 +4088,73 @@ code[MI_LITERALS_END] = (BeamInstr) high; ptr = low; for (i = 0; i < stp->num_literals; i++) { - if (stp->literals[i].heap_frags) { - move_multi_frags(&ptr, &code_off_heap, stp->literals[i].heap_frags, - &stp->literals[i].term, 1); - } - else ASSERT(is_immed(stp->literals[i].term)); + SWord offset; + struct erl_off_heap_header* t_off_heap; + + sys_memcpy(ptr, stp->literals[i].heap, + stp->literals[i].heap_size*sizeof(Eterm)); + offset = ptr - stp->literals[i].heap; + stp->literals[i].offset = offset; + high = ptr + stp->literals[i].heap_size; + while (ptr < high) { + Eterm val = *ptr; + switch (primary_tag(val)) { + case TAG_PRIMARY_LIST: + case TAG_PRIMARY_BOXED: + *ptr++ = offset_ptr(val, offset); + break; + case TAG_PRIMARY_HEADER: + if (header_is_transparent(val)) { + ptr++; + } else { + if (thing_subtag(val) == REFC_BINARY_SUBTAG) { + struct erl_off_heap_header* oh; + + oh = (struct erl_off_heap_header*) ptr; + if (oh->next) { + Eterm** uptr = (Eterm **) (void *) &oh->next; + *uptr += offset; + } + } + ptr += 1 + thing_arityval(val); + } + break; + default: + ptr++; + break; + } + } + ASSERT(ptr == high); + + /* + * Re-link the off_heap list for this term onto the + * off_heap list for the entire module. + */ + t_off_heap = stp->literals[i].off_heap.first; + if (t_off_heap) { + t_off_heap = (struct erl_off_heap_header *) + offset_ptr((UWord) t_off_heap, offset); + while (t_off_heap) { + *off_heap_last = t_off_heap; + off_heap_last = &t_off_heap->next; + t_off_heap = t_off_heap->next; + } + } } - code[MI_LITERALS_OFF_HEAP] = (BeamInstr) code_off_heap.first; + code[MI_LITERALS_OFF_HEAP] = (BeamInstr) off_heap; lp = stp->literal_patches; while (lp != 0) { BeamInstr* op_ptr; + Uint literal; Literal* lit; op_ptr = code + lp->pos; lit = &stp->literals[op_ptr[0]]; - op_ptr[0] = lit->term; + literal = lit->term; + if (is_boxed(literal) || is_list(literal)) { + literal = offset_ptr(literal, lit->offset); + } + op_ptr[0] = literal; lp = lp->next; } literal_end += stp->total_literal_size; @@ -4526,20 +4251,11 @@ code[MI_COMPILE_SIZE_ON_HEAP] = decoded_size; } CHKBLK(ERTS_ALC_T_CODE,code); - { - byte* md5_sum = str_table + strtab_size + attr_size + compile_size; - CHKBLK(ERTS_ALC_T_CODE,code); - sys_memcpy(md5_sum, stp->mod_md5, MD5_SIZE); - CHKBLK(ERTS_ALC_T_CODE,code); - code[MI_MD5_PTR] = (BeamInstr) md5_sum; - CHKBLK(ERTS_ALC_T_CODE,code); - } - CHKBLK(ERTS_ALC_T_CODE,code); /* * Make sure that we have not overflowed the allocated code space. */ - ASSERT(str_table + strtab_size + attr_size + compile_size + MD5_SIZE == + ASSERT(str_table + strtab_size + attr_size + compile_size == ((byte *) code) + size); /* @@ -5255,8 +4971,7 @@ arity = count/sizeof(Eterm); *result = new_literal(stp, &hp, arity+1); - if (is_nil(bytes_to_big(bigbuf, count, neg, hp))) - goto load_error; + (void) bytes_to_big(bigbuf, count, neg, hp); if (bigbuf != default_buf) { erts_free(ERTS_ALC_T_LOADER_TMP, (void *) bigbuf); @@ -5360,18 +5075,19 @@ stp->total_literal_size += heap_size; lit = stp->literals + stp->num_literals; - lit->heap_frags = new_literal_fragment(heap_size); - lit->term = make_boxed(lit->heap_frags->mem); - *hpp = lit->heap_frags->mem; + lit->offset = 0; + lit->heap_size = heap_size; + lit->heap = erts_alloc(ERTS_ALC_T_PREPARED_CODE, heap_size*sizeof(Eterm)); + lit->term = make_boxed(lit->heap); + lit->off_heap.first = 0; + lit->off_heap.overhead = 0; + *hpp = lit->heap; return stp->num_literals++; } Eterm erts_module_info_0(Process* p, Eterm module) { - Module* modp; - ErtsCodeIndex code_ix = erts_active_code_ix(); - BeamInstr* code; Eterm *hp; Eterm list = NIL; Eterm tup; @@ -5380,31 +5096,21 @@ return THE_NON_VALUE; } - modp = erts_get_module(module, code_ix); - if (modp == NULL) { + if (erts_get_module(module, erts_active_code_ix()) == NULL) { return THE_NON_VALUE; } - code = modp->curr.code; - if (code == NULL) { - return THE_NON_VALUE; - } - #define BUILD_INFO(What) \ - tup = get_module_info(p, code_ix, code, module, What); \ + tup = erts_module_info_1(p, module, What); \ hp = HAlloc(p, 5); \ tup = TUPLE2(hp, What, tup); \ hp += 3; \ list = CONS(hp, tup, list) - BUILD_INFO(am_md5); -#ifdef HIPE - BUILD_INFO(am_native); -#endif BUILD_INFO(am_compile); BUILD_INFO(am_attributes); + BUILD_INFO(am_imports); BUILD_INFO(am_exports); - BUILD_INFO(am_module); #undef BUILD_INFO return list; } @@ -5412,47 +5118,20 @@ Eterm erts_module_info_1(Process* p, Eterm module, Eterm what) { - Module* modp; - ErtsCodeIndex code_ix = erts_active_code_ix(); - BeamInstr* code; - - if (is_not_atom(module)) { - return THE_NON_VALUE; - } - - modp = erts_get_module(module, code_ix); - if (modp == NULL) { - return THE_NON_VALUE; - } - - code = modp->curr.code; - if (code == NULL) { - return THE_NON_VALUE; - } - - return get_module_info(p, code_ix, code, module, what); -} - -static Eterm -get_module_info(Process* p, ErtsCodeIndex code_ix, BeamInstr* code, - Eterm module, Eterm what) -{ if (what == am_module) { return module; - } else if (what == am_md5) { - return md5_of_module(p, code); + } else if (what == am_imports) { + return NIL; } else if (what == am_exports) { - return exported_from_module(p, code_ix, module); + return exported_from_module(p, module); } else if (what == am_functions) { - return functions_in_module(p, code); + return functions_in_module(p, module); } else if (what == am_attributes) { - return attributes_for_module(p, code); + return attributes_for_module(p, module); } else if (what == am_compile) { - return compilation_info_for_module(p, code); + return compilation_info_for_module(p, module); } else if (what == am_native_addresses) { - return native_addresses(p, code); - } else if (what == am_native) { - return has_native(code); + return native_addresses(p, module); } return THE_NON_VALUE; } @@ -5460,12 +5139,16 @@ /* * Builds a list of all functions in the given module: * [{Name, Arity},...] + * + * Returns a tagged term, or 0 on error. */ Eterm functions_in_module(Process* p, /* Process whose heap to use. */ - BeamInstr* code) + Eterm mod) /* Tagged atom for module. */ { + Module* modp; + BeamInstr* code; int i; Uint num_functions; Uint need; @@ -5473,6 +5156,15 @@ Eterm* hp_end; Eterm result = NIL; + if (is_not_atom(mod)) { + return THE_NON_VALUE; + } + + modp = erts_get_module(mod, erts_active_code_ix()); + if (modp == NULL) { + return THE_NON_VALUE; + } + code = modp->curr.code; num_functions = code[MI_NUM_FUNCTIONS]; need = 5*num_functions; hp = HAlloc(p, need); @@ -5500,49 +5192,17 @@ } /* - * Returns 'true' if mod has any native compiled functions, otherwise 'false' - */ - -static Eterm -has_native(BeamInstr *code) -{ - Eterm result = am_false; -#ifdef HIPE - if (erts_is_module_native(code)) { - result = am_true; - } -#endif - return result; -} - -int -erts_is_module_native(BeamInstr* code) -{ - Uint i, num_functions; - - /* Check NativeAdress of first real function in module */ - if (code != NULL) { - num_functions = code[MI_NUM_FUNCTIONS]; - for (i=0; icurr.code; num_functions = code[MI_NUM_FUNCTIONS]; need = (6+BIG_UINT_HEAP_SIZE)*num_functions; hp = HAlloc(p, need); @@ -5576,18 +5246,25 @@ /* * Builds a list of all exported functions in the given module: * [{Name, Arity},...] + * + * Returns a tagged term, or 0 on error. */ Eterm exported_from_module(Process* p, /* Process whose heap to use. */ - ErtsCodeIndex code_ix, Eterm mod) /* Tagged atom for module. */ { int i; Eterm* hp = NULL; Eterm* hend = NULL; Eterm result = NIL; + ErtsCodeIndex code_ix; + + if (is_not_atom(mod)) { + return THE_NON_VALUE; + } + code_ix = erts_active_code_ix(); for (i = 0; i < export_list_size(code_ix); i++) { Export* ep = export_list(i,code_ix); @@ -5617,62 +5294,84 @@ /* * Returns a list of all attributes for the module. + * + * Returns a tagged term, or 0 on error. */ Eterm attributes_for_module(Process* p, /* Process whose heap to use. */ - BeamInstr* code) + Eterm mod) /* Tagged atom for module. */ + { + Module* modp; + BeamInstr* code; + Eterm* hp; byte* ext; Eterm result = NIL; + Eterm* end; + if (is_not_atom(mod) || (is_not_list(result) && is_not_nil(result))) { + return THE_NON_VALUE; + } + + modp = erts_get_module(mod, erts_active_code_ix()); + if (modp == NULL) { + return THE_NON_VALUE; + } + code = modp->curr.code; ext = (byte *) code[MI_ATTR_PTR]; if (ext != NULL) { - ErtsHeapFactory factory; - erts_factory_proc_prealloc_init(&factory, p, code[MI_ATTR_SIZE_ON_HEAP]); - result = erts_decode_ext(&factory, &ext); + hp = HAlloc(p, code[MI_ATTR_SIZE_ON_HEAP]); + end = hp + code[MI_ATTR_SIZE_ON_HEAP]; + result = erts_decode_ext(&hp, &MSO(p), &ext); if (is_value(result)) { - erts_factory_close(&factory); + ASSERT(hp <= end); } + HRelease(p,end,hp); } return result; } /* * Returns a list containing compilation information. + * + * Returns a tagged term, or 0 on error. */ Eterm compilation_info_for_module(Process* p, /* Process whose heap to use. */ - BeamInstr* code) + Eterm mod) /* Tagged atom for module. */ { + Module* modp; + BeamInstr* code; + Eterm* hp; byte* ext; Eterm result = NIL; + Eterm* end; + if (is_not_atom(mod) || (is_not_list(result) && is_not_nil(result))) { + return THE_NON_VALUE; + } + + modp = erts_get_module(mod, erts_active_code_ix()); + if (modp == NULL) { + return THE_NON_VALUE; + } + code = modp->curr.code; ext = (byte *) code[MI_COMPILE_PTR]; if (ext != NULL) { - ErtsHeapFactory factory; - erts_factory_proc_prealloc_init(&factory, p, code[MI_COMPILE_SIZE_ON_HEAP]); - result = erts_decode_ext(&factory, &ext); + hp = HAlloc(p, code[MI_COMPILE_SIZE_ON_HEAP]); + end = hp + code[MI_COMPILE_SIZE_ON_HEAP]; + result = erts_decode_ext(&hp, &MSO(p), &ext); if (is_value(result)) { - erts_factory_close(&factory); + ASSERT(hp <= end); } + HRelease(p,end,hp); } return result; } /* - * Returns the MD5 checksum for a module - */ - -Eterm -md5_of_module(Process* p, /* Process whose heap to use. */ - BeamInstr* code) -{ - return new_binary(p, (byte *) code[MI_MD5_PTR], MD5_SIZE); -} - -/* * Build a single {M,F,A,Loction} item to be part of * a stack trace. */ @@ -5848,7 +5547,7 @@ res = am_undefined; goto done; } - res = new_binary(p, stp->mod_md5, MD5_SIZE); + res = new_binary(p, stp->mod_md5, sizeof(stp->mod_md5)); done: erts_free_aligned_binary_bytes(temp_alloc); @@ -6141,7 +5840,6 @@ LoaderState* stp; BeamInstr Funcs; BeamInstr Patchlist; - Eterm MD5Bin; Eterm* tp; BeamInstr* code = NULL; BeamInstr* ptrs; @@ -6170,15 +5868,12 @@ goto error; } tp = tuple_val(Info); - if (tp[0] != make_arityval(3)) { + if (tp[0] != make_arityval(2)) { goto error; } Funcs = tp[1]; - Patchlist = tp[2]; - MD5Bin = tp[3]; - if (is_not_binary(MD5Bin) || (binary_size(MD5Bin) != MD5_SIZE)) { - goto error; - } + Patchlist = tp[2]; + if ((n = erts_list_length(Funcs)) < 0) { goto error; } @@ -6228,7 +5923,6 @@ code_size = ((WORDS_PER_FUNCTION+1)*n + MI_FUNCTIONS + 2) * sizeof(BeamInstr); code_size += stp->chunks[ATTR_CHUNK].size; code_size += stp->chunks[COMPILE_CHUNK].size; - code_size += MD5_SIZE; code = erts_alloc_fnf(ERTS_ALC_T_CODE, code_size); if (!code) { goto error; @@ -6249,7 +5943,6 @@ code[MI_LITERALS_END] = 0; code[MI_LITERALS_OFF_HEAP] = 0; code[MI_ON_LOAD_FUNCTION_PTR] = 0; - code[MI_MD5_PTR] = 0; ci = MI_FUNCTIONS + n + 1; /* @@ -6335,15 +6028,6 @@ if (info == NULL) { goto error; } - { - byte *tmp = NULL; - byte *md5 = NULL; - if ((md5 = erts_get_aligned_binary_bytes(MD5Bin, &tmp)) != NULL) { - sys_memcpy(info, md5, MD5_SIZE); - code[MI_MD5_PTR] = (BeamInstr) info; - } - erts_free_aligned_binary_bytes(tmp); - } /* * Insert the module in the module table. diff -Nru erlang-18.2-dfsg/erts/emulator/beam/beam_load.h erlang-17.3-dfsg/erts/emulator/beam/beam_load.h --- erlang-18.2-dfsg/erts/emulator/beam/beam_load.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/beam_load.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -24,10 +23,10 @@ #include "beam_opcodes.h" #include "erl_process.h" -int erts_is_module_native(BeamInstr* code); Eterm beam_make_current_old(Process *c_p, ErtsProcLocks c_p_locks, Eterm module); + typedef struct gen_op_entry { char* name; int arity; @@ -92,6 +91,7 @@ #define MI_LITERALS_END 8 #define MI_LITERALS_OFF_HEAP 9 + /* * Pointer to the on_load function (or NULL if none). */ @@ -103,11 +103,6 @@ #define MI_LINE_TABLE 11 /* - * Pointer to the module MD5 sum (16 bytes) - */ -#define MI_MD5_PTR 12 - -/* * Start of function pointer table. This table contains pointers to * all functions in the module plus an additional pointer just beyond * the end of the last function. @@ -116,7 +111,7 @@ * this table. */ -#define MI_FUNCTIONS 13 +#define MI_FUNCTIONS 12 /* * Layout of the line table. diff -Nru erlang-18.2-dfsg/erts/emulator/beam/beam_ranges.c erlang-17.3-dfsg/erts/emulator/beam/beam_ranges.c --- erlang-18.2-dfsg/erts/emulator/beam/beam_ranges.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/beam_ranges.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -283,7 +282,7 @@ while (low < high) { if (pc < mid->start) { high = mid; - } else if (pc >= RANGE_END(mid)) { + } else if (pc > RANGE_END(mid)) { low = mid + 1; } else { erts_smp_atomic_set_nob(&r[active].mid, (erts_aint_t) mid); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/benchmark.c erlang-17.3-dfsg/erts/emulator/beam/benchmark.c --- erlang-18.2-dfsg/erts/emulator/beam/benchmark.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/benchmark.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -38,9 +37,37 @@ #ifdef BM_TIMERS -/* assuming Solaris */ +#if (defined(__i386__) || defined(__x86_64__)) && USE_PERFCTR + +#include "libperfctr.h" +struct vperfctr *system_clock; +double cpu_khz; +BM_NEW_TIMER(start); + +static double get_hrvtime(void) +{ + unsigned long long ticks; + double milli_seconds; + + ticks = vperfctr_read_tsc(system_clock); + milli_seconds = (double)ticks / cpu_khz; + return milli_seconds; +} + +static void stop_hrvtime(void) +{ + if(system_clock) + { + vperfctr_stop(system_clock); + vperfctr_close(system_clock); + system_clock = NULL; + } +} + +#else /* not perfctr, asuming Solaris */ #include BM_TIMER_T system_clock; +#endif unsigned long local_pause_times[MAX_PAUSE_TIME]; unsigned long pause_times[MAX_PAUSE_TIME]; @@ -90,6 +117,40 @@ void init_benchmarking() { #ifdef BM_TIMERS +#if (defined(__i386__) || defined(__x86_64__)) && USE_PERFCTR + /* pass `--with-perfctr=/path/to/perfctr' when configuring */ + struct perfctr_info info; + struct vperfctr_control control; + int i; + + system_clock = vperfctr_open(); + if (system_clock != NULL) + { + if (vperfctr_info(system_clock,&info) >= 0) + { + cpu_khz = (double)info.cpu_khz; + if (info.cpu_features & PERFCTR_FEATURE_RDTSC) + { + memset(&control,0,sizeof control); + control.cpu_control.tsc_on = 1; + } + } + if (vperfctr_control(system_clock,&control) < 0) + { + vperfctr_close(system_clock); + system_clock = NULL; + } + } + + for (i = 0; i < 1000; i++) + { + BM_START_TIMER(system); + BM_STOP_TIMER(system); + } + + timer_time = system_time / 1000; + start_time = 0; +#else int i; for (i = 0; i < 1000; i++) { @@ -97,6 +158,7 @@ BM_STOP_TIMER(system); } timer_time = system_time / 1000; +#endif for (i = 0; i < MAX_PAUSE_TIME; i++) { local_pause_times[i] = 0; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/benchmark.h erlang-17.3-dfsg/erts/emulator/beam/benchmark.h --- erlang-18.2-dfsg/erts/emulator/beam/benchmark.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/benchmark.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -38,7 +37,10 @@ /* BM_TIMERS keeps track of the time spent in diferent parts of the * system. It only measures accual active time, not time spent in idle - * mode. Currently, the Solaris hrtime_t will be used. + * mode. These timers requires hardware support. For Linux, use the + * package perfctr from user.it.uu.se/~mikpe/linux/perfctr. If this + * package is not specified when configuring the system + * (--with-perfctr=PATH), the Solaris hrtime_t will be used. * To add new timers look below. */ #define BM_TIMERS @@ -140,12 +142,43 @@ * meassure (send time in shared heap for instance). */ -/* (Assuming Solaris) */ +#if (defined(__i386__) || defined(__x86_64__)) && USE_PERFCTR +#include "libperfctr.h" + +#define BM_TIMER_T double + +extern struct vperfctr *system_clock; +extern double cpu_khz; +extern BM_TIMER_T start_time; + +#define BM_START_TIMER(t) start_time = \ + (BM_TIMER_T)vperfctr_read_tsc(system_clock) / \ + cpu_khz; + +#define BM_STOP_TIMER(t) do { \ + BM_TIMER_T tmp = ((BM_TIMER_T)vperfctr_read_tsc(system_clock) / cpu_khz); \ + tmp -= (start_time + timer_time); \ + t##_time += (tmp > 0 ? tmp : 0); \ +} while(0) + +#define BM_TIME_PRINTER(str,time) do { \ + int min,sec,milli,micro; \ + BM_TIMER_T tmp = (time) * 1000; \ + micro = (uint)(tmp - ((int)(tmp / 1000)) * 1000); \ + tmp /= 1000; \ + milli = (uint)(tmp - ((int)(tmp / 1000)) * 1000); \ + tmp /= 1000; \ + sec = (uint)(tmp - ((int)(tmp / 60)) * 60); \ + min = (uint)tmp / 60; \ + erts_fprintf(file,str": %d:%02d.%03d %03d\n",min,sec,milli,micro); \ +} while(0) + +#else /* !USE_PERFCTR (Assuming Solaris) */ -#define BM_TIMER_T ErtsMonotonicTime -#define BM_START_TIMER(t) system_clock = ERTS_MONOTONIC_TO_NSEC(erts_os_monotonic_time()) +#define BM_TIMER_T hrtime_t +#define BM_START_TIMER(t) system_clock = sys_gethrtime() #define BM_STOP_TIMER(t) do { \ - BM_TIMER_T tmp = (ERTS_MONOTONIC_TO_NSEC(erts_os_monotonic_time()) - system_clock) - timer_time; \ + BM_TIMER_T tmp = (sys_gethrtime() - system_clock) - timer_time; \ t##_time += (tmp > 0 ? tmp : 0); \ } while(0) @@ -163,6 +196,7 @@ } while(0) extern BM_TIMER_T system_clock; +#endif /* USE_PERFCTR */ extern BM_TIMER_T timer_time; extern BM_TIMER_T system_time; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/bif.c erlang-17.3-dfsg/erts/emulator/beam/bif.c --- erlang-18.2-dfsg/erts/emulator/beam/bif.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/bif.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -29,9 +28,7 @@ #include "global.h" #include "erl_process.h" #include "error.h" -#define ERL_WANT_HIPE_BIF_WRAPPER__ #include "bif.h" -#undef ERL_WANT_HIPE_BIF_WRAPPER__ #include "big.h" #include "dist.h" #include "erl_version.h" @@ -43,23 +40,16 @@ #define ERTS_PTAB_WANT_BIF_IMPL__ #include "erl_ptab.h" #include "erl_bits.h" -#include "erl_bif_unique.h" -Export *erts_await_result; -static Export* flush_monitor_messages_trap = NULL; +static Export* flush_monitor_message_trap = NULL; static Export* set_cpu_topology_trap = NULL; static Export* await_proc_exit_trap = NULL; static Export* await_port_send_result_trap = NULL; Export* erts_format_cpu_topology_trap = NULL; -static Export dsend_continue_trap_export; -Export *erts_convert_time_unit_trap = NULL; static Export *await_sched_wall_time_mod_trap; static erts_smp_atomic32_t sched_wall_time; -static erts_smp_mtx_t ports_snapshot_mtx; -erts_smp_atomic_t erts_dead_ports_ptr; /* To store dying ports during snapshot */ - #define DECL_AM(S) Eterm AM_ ## S = am_atom_put(#S, sizeof(#S) - 1) /* @@ -401,7 +391,7 @@ return res; } -static int demonitor(Process *c_p, Eterm ref, Eterm *multip) +static int demonitor(Process *c_p, Eterm ref) { ErtsMonitor *mon = NULL; /* The monitor entry to delete */ Process *rp; /* Local target process */ @@ -425,73 +415,65 @@ goto done; } - switch (mon->type) { - case MON_TIME_OFFSET: - *multip = am_true; - erts_demonitor_time_offset(ref); - res = ERTS_DEMONITOR_TRUE; - break; - case MON_ORIGIN: - to = mon->pid; - *multip = am_false; - if (is_atom(to)) { - /* Monitoring a name at node to */ - ASSERT(is_node_name_atom(to)); - dep = erts_sysname_to_connected_dist_entry(to); - ASSERT(dep != erts_this_dist_entry); - if (dep) - deref_de = 1; - } else { - ASSERT(is_pid(to)); - dep = pid_dist_entry(to); - } - if (dep != erts_this_dist_entry) { - res = remote_demonitor(c_p, dep, ref, to); - /* remote_demonitor() unlocks link lock on c_p */ - unlock_link = 0; + if (mon->type != MON_ORIGIN) { + res = ERTS_DEMONITOR_BADARG; + goto done; + } + to = mon->pid; + + if (is_atom(to)) { + /* Monitoring a name at node to */ + ASSERT(is_node_name_atom(to)); + dep = erts_sysname_to_connected_dist_entry(to); + ASSERT(dep != erts_this_dist_entry); + if (dep) + deref_de = 1; + } else { + ASSERT(is_pid(to)); + dep = pid_dist_entry(to); + } + if (dep != erts_this_dist_entry) { + res = remote_demonitor(c_p, dep, ref, to); + /* remote_demonitor() unlocks link lock on c_p */ + unlock_link = 0; + } + else { /* Local monitor */ + if (deref_de) { + deref_de = 0; + erts_deref_dist_entry(dep); } - else { /* Local monitor */ - if (deref_de) { - deref_de = 0; - erts_deref_dist_entry(dep); - } - dep = NULL; - rp = erts_pid2proc_opt(c_p, - ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_LINK, - to, - ERTS_PROC_LOCK_LINK, - ERTS_P2P_FLG_ALLOW_OTHER_X); - mon = erts_remove_monitor(&ERTS_P_MONITORS(c_p), ref); + dep = NULL; + rp = erts_pid2proc_opt(c_p, + ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_LINK, + to, + ERTS_PROC_LOCK_LINK, + ERTS_P2P_FLG_ALLOW_OTHER_X); + mon = erts_remove_monitor(&ERTS_P_MONITORS(c_p), ref); #ifndef ERTS_SMP - ASSERT(mon); + ASSERT(mon); #else - if (!mon) - res = ERTS_DEMONITOR_FALSE; - else + if (!mon) + res = ERTS_DEMONITOR_FALSE; + else #endif - { - res = ERTS_DEMONITOR_TRUE; - erts_destroy_monitor(mon); - } - if (rp) { - ErtsMonitor *rmon; - rmon = erts_remove_monitor(&ERTS_P_MONITORS(rp), ref); - if (rp != c_p) - erts_smp_proc_unlock(rp, ERTS_PROC_LOCK_LINK); - if (rmon != NULL) - erts_destroy_monitor(rmon); - } - else { - ERTS_SMP_ASSERT_IS_NOT_EXITING(c_p); - } - + { + res = ERTS_DEMONITOR_TRUE; + erts_destroy_monitor(mon); } - break; - default: - res = ERTS_DEMONITOR_BADARG; - *multip = am_false; - break; + if (rp) { + ErtsMonitor *rmon; + rmon = erts_remove_monitor(&ERTS_P_MONITORS(rp), ref); + if (rp != c_p) + erts_smp_proc_unlock(rp, ERTS_PROC_LOCK_LINK); + if (rmon != NULL) + erts_destroy_monitor(rmon); + } + else { + ERTS_SMP_ASSERT_IS_NOT_EXITING(c_p); + } + } + done: if (unlock_link) @@ -508,8 +490,7 @@ BIF_RETTYPE demonitor_1(BIF_ALIST_1) { - Eterm multi; - switch (demonitor(BIF_P, BIF_ARG_1, &multi)) { + switch (demonitor(BIF_P, BIF_ARG_1)) { case ERTS_DEMONITOR_FALSE: case ERTS_DEMONITOR_TRUE: BIF_RET(am_true); @@ -527,7 +508,6 @@ BIF_RETTYPE demonitor_2(BIF_ALIST_2) { Eterm res = am_true; - Eterm multi = am_false; int info = 0; int flush = 0; Eterm list = BIF_ARG_2; @@ -550,18 +530,13 @@ if (is_not_nil(list)) goto badarg; - switch (demonitor(BIF_P, BIF_ARG_1, &multi)) { + switch (demonitor(BIF_P, BIF_ARG_1)) { case ERTS_DEMONITOR_FALSE: if (info) res = am_false; - if (flush) { - flush_messages: - BIF_TRAP3(flush_monitor_messages_trap, BIF_P, - BIF_ARG_1, multi, res); - } + if (flush) + BIF_TRAP2(flush_monitor_message_trap, BIF_P, BIF_ARG_1, res); case ERTS_DEMONITOR_TRUE: - if (multi == am_true && flush) - goto flush_messages; BIF_RET(res); case ERTS_DEMONITOR_YIELD_TRUE: ERTS_BIF_YIELD_RETURN(BIF_P, am_true); @@ -612,16 +587,22 @@ ref_copy = copy_struct(ref, ref_size, &hp, ohp); tup = TUPLE5(hp, am_DOWN, ref_copy, type, item_copy, reason_copy); - erts_queue_message(p, p_locksp, bp, tup, NIL); + erts_queue_message(p, p_locksp, bp, tup, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); } static BIF_RETTYPE -local_pid_monitor(Process *p, Eterm target, Eterm mon_ref, int boolean) +local_pid_monitor(Process *p, Eterm target) { BIF_RETTYPE ret; + Eterm mon_ref; Process *rp; ErtsProcLocks p_locks = ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_LINK; + mon_ref = erts_make_ref(p); ERTS_BIF_PREP_RET(ret, mon_ref); if (target == p->common.id) { return ret; @@ -634,18 +615,12 @@ if (!rp) { erts_smp_proc_unlock(p, ERTS_PROC_LOCK_LINK); p_locks &= ~ERTS_PROC_LOCK_LINK; - if (boolean) - ret = am_false; - else - erts_queue_monitor_message(p, &p_locks, - mon_ref, am_process, target, am_noproc); + erts_queue_monitor_message(p, &p_locks, + mon_ref, am_process, target, am_noproc); } else { ASSERT(rp != p); - if (boolean) - ret = am_true; - erts_add_monitor(&ERTS_P_MONITORS(p), MON_ORIGIN, mon_ref, target, NIL); erts_add_monitor(&ERTS_P_MONITORS(rp), MON_TARGET, mon_ref, p->common.id, NIL); @@ -769,28 +744,13 @@ int deref_de = 0; /* Only process monitors are implemented */ - switch (BIF_ARG_1) { - case am_time_offset: { - Eterm ref; - if (BIF_ARG_2 != am_clock_service) - goto error; - ref = erts_make_ref(BIF_P); - erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_LINK); - erts_add_monitor(&ERTS_P_MONITORS(BIF_P), MON_TIME_OFFSET, - ref, am_clock_service, NIL); - erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_LINK); - erts_monitor_time_offset(BIF_P->common.id, ref); - BIF_RET(ref); - } - case am_process: - break; - default: + if (BIF_ARG_1 != am_process) { goto error; } if (is_internal_pid(target)) { local_pid: - ret = local_pid_monitor(BIF_P, target, erts_make_ref(BIF_P), 0); + ret = local_pid_monitor(BIF_P, target); } else if (is_external_pid(target)) { dep = external_pid_dist_entry(target); if (dep == erts_this_dist_entry) @@ -833,6 +793,7 @@ return ret; } + /**********************************************************************/ /* this is a combination of the spawn and link BIFs */ @@ -1816,8 +1777,6 @@ * erlang:'!'/2 */ -HIPE_WRAPPER_BIF_DISABLE_GC(ebif_bang, 2) - BIF_RETTYPE ebif_bang_2(BIF_ALIST_2) { @@ -1836,36 +1795,34 @@ #define SEND_USER_ERROR (-5) #define SEND_INTERNAL_ERROR (-6) #define SEND_AWAIT_RESULT (-7) -#define SEND_YIELD_CONTINUE (-8) - -Sint do_send(Process *p, Eterm to, Eterm msg, Eterm *refp, ErtsSendContext*); +Sint do_send(Process *p, Eterm to, Eterm msg, int suspend, Eterm *refp); static Sint remote_send(Process *p, DistEntry *dep, - Eterm to, Eterm full_to, Eterm msg, - ErtsSendContext* ctx) + Eterm to, Eterm full_to, Eterm msg, int suspend) { Sint res; int code; + ErtsDSigData dsd; ASSERT(is_atom(to) || is_external_pid(to)); - code = erts_dsig_prepare(&ctx->dsd, dep, p, ERTS_DSP_NO_LOCK, !ctx->suspend); + code = erts_dsig_prepare(&dsd, dep, p, ERTS_DSP_NO_LOCK, !suspend); switch (code) { case ERTS_DSIG_PREP_NOT_ALIVE: case ERTS_DSIG_PREP_NOT_CONNECTED: res = SEND_TRAP; break; case ERTS_DSIG_PREP_WOULD_SUSPEND: - ASSERT(!ctx->suspend); + ASSERT(!suspend); res = SEND_YIELD; break; case ERTS_DSIG_PREP_CONNECTED: { if (is_atom(to)) - code = erts_dsig_send_reg_msg(to, msg, ctx); + code = erts_dsig_send_reg_msg(&dsd, to, msg); else - code = erts_dsig_send_msg(to, msg, ctx); + code = erts_dsig_send_msg(&dsd, to, msg); /* * Note that reductions have been bumped on calling * process by erts_dsig_send_reg_msg() or @@ -1873,8 +1830,6 @@ */ if (code == ERTS_DSIG_SEND_YIELD) res = SEND_YIELD_RETURN; - else if (code == ERTS_DSIG_SEND_CONTINUE) - res = SEND_YIELD_CONTINUE; else res = 0; break; @@ -1895,8 +1850,7 @@ } Sint -do_send(Process *p, Eterm to, Eterm msg, Eterm *refp, ErtsSendContext* ctx) -{ +do_send(Process *p, Eterm to, Eterm msg, int suspend, Eterm *refp) { Eterm portid; Port *pt; Process* rp; @@ -1915,6 +1869,7 @@ } else if (is_external_pid(to)) { dep = external_pid_dist_entry(to); if(dep == erts_this_dist_entry) { +#if DEBUG erts_dsprintf_buf_t *dsbufp = erts_create_logger_dsbuf(); erts_dsprintf(dsbufp, "Discarding message %T from %T to %T in an old " @@ -1925,9 +1880,10 @@ external_pid_creation(to), erts_this_node->creation); erts_send_error_to_logger(p->group_leader, dsbufp); +#endif return 0; } - return remote_send(p, dep, to, to, msg, ctx); + return remote_send(p, dep, to, to, msg, suspend); } else if (is_atom(to)) { Eterm id = erts_whereis_name_to_id(p, to); @@ -1958,6 +1914,7 @@ } else if (is_external_port(to) && (external_port_dist_entry(to) == erts_this_dist_entry)) { +#if DEBUG erts_dsprintf_buf_t *dsbufp = erts_create_logger_dsbuf(); erts_dsprintf(dsbufp, "Discarding message %T from %T to %T in an old " @@ -1968,6 +1925,7 @@ external_port_creation(to), erts_this_node->creation); erts_send_error_to_logger(p->group_leader, dsbufp); +#endif return 0; } else if (is_internal_port(to)) { int ret_val; @@ -1982,7 +1940,7 @@ ret_val = 0; if (pt) { - int ps_flags = ctx->suspend ? 0 : ERTS_PORT_SIG_FLG_NOSUSPEND; + int ps_flags = suspend ? 0 : ERTS_PORT_SIG_FLG_NOSUSPEND; *refp = NIL; switch (erts_port_command(p, ps_flags, pt, msg, refp)) { @@ -1991,12 +1949,12 @@ return SEND_USER_ERROR; case ERTS_PORT_OP_BUSY: /* Nothing has been sent */ - if (ctx->suspend) + if (suspend) erts_suspend(p, ERTS_PROC_LOCK_MAIN, pt); return SEND_YIELD; case ERTS_PORT_OP_BUSY_SCHEDULED: /* Message was sent */ - if (ctx->suspend) { + if (suspend) { erts_suspend(p, ERTS_PROC_LOCK_MAIN, pt); ret_val = SEND_YIELD_RETURN; break; @@ -2076,14 +2034,9 @@ return 0; } - ret = remote_send(p, dep, tp[1], to, msg, ctx); - if (ret != SEND_YIELD_CONTINUE) { - if (dep) { - erts_deref_dist_entry(dep); - } - } else { - ctx->dep_to_deref = dep; - } + ret = remote_send(p, dep, tp[1], to, msg, suspend); + if (dep) + erts_deref_dist_entry(dep); return ret; } else { if (IS_TRACED(p)) /* XXX Is this really neccessary ??? */ @@ -2114,11 +2067,9 @@ } } -HIPE_WRAPPER_BIF_DISABLE_GC(send, 3) BIF_RETTYPE send_3(BIF_ALIST_3) { - BIF_RETTYPE retval; Eterm ref; Process *p = BIF_P; Eterm to = BIF_ARG_1; @@ -2126,44 +2077,34 @@ Eterm opts = BIF_ARG_3; int connect = !0; + int suspend = !0; Eterm l = opts; Sint result; - DeclareTypedTmpHeap(ErtsSendContext, ctx, BIF_P); - UseTmpHeap(sizeof(ErtsSendContext)/sizeof(Eterm), BIF_P); - - ctx->suspend = !0; - ctx->dep_to_deref = NULL; - ctx->return_term = am_ok; - ctx->dss.reds = (Sint) (ERTS_BIF_REDS_LEFT(p) * TERM_TO_BINARY_LOOP_FACTOR); - ctx->dss.phase = ERTS_DSIG_SEND_PHASE_INIT; - + while (is_list(l)) { if (CAR(list_val(l)) == am_noconnect) { connect = 0; } else if (CAR(list_val(l)) == am_nosuspend) { - ctx->suspend = 0; + suspend = 0; } else { - ERTS_BIF_PREP_ERROR(retval, p, BADARG); - goto done; + BIF_ERROR(p, BADARG); } l = CDR(list_val(l)); } if(!is_nil(l)) { - ERTS_BIF_PREP_ERROR(retval, p, BADARG); - goto done; + BIF_ERROR(p, BADARG); } #ifdef DEBUG ref = NIL; #endif - result = do_send(p, to, msg, &ref, ctx); + result = do_send(p, to, msg, suspend, &ref); if (result > 0) { ERTS_VBUMP_REDS(p, result); if (ERTS_IS_PROC_OUT_OF_REDS(p)) goto yield_return; - ERTS_BIF_PREP_RET(retval, am_ok); - goto done; + BIF_RET(am_ok); } switch (result) { @@ -2171,127 +2112,68 @@ /* May need to yield even though we do not bump reds here... */ if (ERTS_IS_PROC_OUT_OF_REDS(p)) goto yield_return; - ERTS_BIF_PREP_RET(retval, am_ok); + BIF_RET(am_ok); break; case SEND_TRAP: if (connect) { - ERTS_BIF_PREP_TRAP3(retval, dsend3_trap, p, to, msg, opts); + BIF_TRAP3(dsend3_trap, p, to, msg, opts); } else { - ERTS_BIF_PREP_RET(retval, am_noconnect); + BIF_RET(am_noconnect); } break; case SEND_YIELD: - if (ctx->suspend) { - ERTS_BIF_PREP_YIELD3(retval, - bif_export[BIF_send_3], p, to, msg, opts); + if (suspend) { + ERTS_BIF_YIELD3(bif_export[BIF_send_3], p, to, msg, opts); } else { - ERTS_BIF_PREP_RET(retval, am_nosuspend); + BIF_RET(am_nosuspend); } break; case SEND_YIELD_RETURN: - if (!ctx->suspend) { - ERTS_BIF_PREP_RET(retval, am_nosuspend); - break; - } + if (!suspend) + BIF_RET(am_nosuspend); yield_return: - ERTS_BIF_PREP_YIELD_RETURN(retval, p, am_ok); - break; + ERTS_BIF_YIELD_RETURN(p, am_ok); case SEND_AWAIT_RESULT: ASSERT(is_internal_ref(ref)); - ERTS_BIF_PREP_TRAP3(retval, await_port_send_result_trap, p, ref, am_nosuspend, am_ok); - break; + BIF_TRAP3(await_port_send_result_trap, p, ref, am_nosuspend, am_ok); case SEND_BADARG: - ERTS_BIF_PREP_ERROR(retval, p, BADARG); + BIF_ERROR(p, BADARG); break; case SEND_USER_ERROR: - ERTS_BIF_PREP_ERROR(retval, p, EXC_ERROR); + BIF_ERROR(p, EXC_ERROR); break; case SEND_INTERNAL_ERROR: - ERTS_BIF_PREP_ERROR(retval, p, EXC_INTERNAL_ERROR); - break; - case SEND_YIELD_CONTINUE: - BUMP_ALL_REDS(p); - erts_set_gc_state(p, 0); - ERTS_BIF_PREP_TRAP1(retval, &dsend_continue_trap_export, p, - erts_dsend_export_trap_context(p, ctx)); + BIF_ERROR(p, EXC_INTERNAL_ERROR); break; default: - erl_exit(ERTS_ABORT_EXIT, "send_3 invalid result %d\n", (int)result); + ASSERT(! "Illegal send result"); break; } - -done: - UnUseTmpHeap(sizeof(ErtsSendContext)/sizeof(Eterm), BIF_P); - return retval; + ASSERT(! "Can not arrive here"); + BIF_ERROR(p, BADARG); } -HIPE_WRAPPER_BIF_DISABLE_GC(send, 2) - BIF_RETTYPE send_2(BIF_ALIST_2) { return erl_send(BIF_P, BIF_ARG_1, BIF_ARG_2); } -static BIF_RETTYPE dsend_continue_trap_1(BIF_ALIST_1) -{ - Binary* bin = ((ProcBin*) binary_val(BIF_ARG_1))->val; - ErtsSendContext* ctx = (ErtsSendContext*) ERTS_MAGIC_BIN_DATA(bin); - Sint initial_reds = (Sint) (ERTS_BIF_REDS_LEFT(BIF_P) * TERM_TO_BINARY_LOOP_FACTOR); - int result; - - ASSERT(ERTS_MAGIC_BIN_DESTRUCTOR(bin) == erts_dsend_context_dtor); - - ctx->dss.reds = initial_reds; - result = erts_dsig_send(&ctx->dsd, &ctx->dss); - - switch (result) { - case ERTS_DSIG_SEND_OK: - erts_set_gc_state(BIF_P, 1); - BIF_RET(ctx->return_term); - break; - case ERTS_DSIG_SEND_YIELD: /*SEND_YIELD_RETURN*/ - erts_set_gc_state(BIF_P, 1); - if (!ctx->suspend) - BIF_RET(am_nosuspend); - ERTS_BIF_YIELD_RETURN(BIF_P, ctx->return_term); - - case ERTS_DSIG_SEND_CONTINUE: { /*SEND_YIELD_CONTINUE*/ - BUMP_ALL_REDS(BIF_P); - BIF_TRAP1(&dsend_continue_trap_export, BIF_P, BIF_ARG_1); - } - default: - erl_exit(ERTS_ABORT_EXIT, "dsend_continue_trap invalid result %d\n", (int)result); - break; - } - ASSERT(! "Can not arrive here"); - BIF_ERROR(BIF_P, BADARG); -} - Eterm erl_send(Process *p, Eterm to, Eterm msg) { - Eterm retval; Eterm ref; Sint result; - DeclareTypedTmpHeap(ErtsSendContext, ctx, p); - UseTmpHeap(sizeof(ErtsSendContext)/sizeof(Eterm), p); #ifdef DEBUG ref = NIL; #endif - ctx->suspend = !0; - ctx->dep_to_deref = NULL; - ctx->return_term = msg; - ctx->dss.reds = (Sint) (ERTS_BIF_REDS_LEFT(p) * TERM_TO_BINARY_LOOP_FACTOR); - ctx->dss.phase = ERTS_DSIG_SEND_PHASE_INIT; - result = do_send(p, to, msg, &ref, ctx); + result = do_send(p, to, msg, !0, &ref); if (result > 0) { ERTS_VBUMP_REDS(p, result); if (ERTS_IS_PROC_OUT_OF_REDS(p)) goto yield_return; - ERTS_BIF_PREP_RET(retval, msg); - goto done; + BIF_RET(msg); } switch (result) { @@ -2299,46 +2181,35 @@ /* May need to yield even though we do not bump reds here... */ if (ERTS_IS_PROC_OUT_OF_REDS(p)) goto yield_return; - ERTS_BIF_PREP_RET(retval, msg); + BIF_RET(msg); break; case SEND_TRAP: - ERTS_BIF_PREP_TRAP2(retval, dsend2_trap, p, to, msg); + BIF_TRAP2(dsend2_trap, p, to, msg); break; case SEND_YIELD: - ERTS_BIF_PREP_YIELD2(retval, bif_export[BIF_send_2], p, to, msg); + ERTS_BIF_YIELD2(bif_export[BIF_send_2], p, to, msg); break; case SEND_YIELD_RETURN: yield_return: - ERTS_BIF_PREP_YIELD_RETURN(retval, p, msg); - break; + ERTS_BIF_YIELD_RETURN(p, msg); case SEND_AWAIT_RESULT: ASSERT(is_internal_ref(ref)); - ERTS_BIF_PREP_TRAP3(retval, - await_port_send_result_trap, p, ref, msg, msg); - break; + BIF_TRAP3(await_port_send_result_trap, p, ref, msg, msg); case SEND_BADARG: - ERTS_BIF_PREP_ERROR(retval, p, BADARG); + BIF_ERROR(p, BADARG); break; case SEND_USER_ERROR: - ERTS_BIF_PREP_ERROR(retval, p, EXC_ERROR); + BIF_ERROR(p, EXC_ERROR); break; case SEND_INTERNAL_ERROR: - ERTS_BIF_PREP_ERROR(retval, p, EXC_INTERNAL_ERROR); - break; - case SEND_YIELD_CONTINUE: - BUMP_ALL_REDS(p); - erts_set_gc_state(p, 0); - ERTS_BIF_PREP_TRAP1(retval, &dsend_continue_trap_export, p, - erts_dsend_export_trap_context(p, ctx)); + BIF_ERROR(p, EXC_INTERNAL_ERROR); break; default: - erl_exit(ERTS_ABORT_EXIT, "invalid send result %d\n", (int)result); + ASSERT(! "Illegal send result"); break; } - -done: - UnUseTmpHeap(sizeof(ErtsSendContext)/sizeof(Eterm), p); - return retval; + ASSERT(! "Can not arrive here"); + BIF_ERROR(p, BADARG); } /**********************************************************************/ @@ -2901,10 +2772,9 @@ Eterm *integer, Eterm *rest) { Sint i = 0; - Uint ui = 0; int skip = 0; int neg = 0; - Sint n = 0; + int n = 0; int m; int lg2; Eterm res; @@ -2955,8 +2825,8 @@ unsigned_val(CAR(list_val(lst))) > '9') { break; } - ui = ui * 10; - ui = ui + unsigned_val(CAR(list_val(lst))) - '0'; + i = i * 10; + i = i + unsigned_val(CAR(list_val(lst))) - '0'; n++; lst = CDR(list_val(lst)); if (is_nil(lst)) { @@ -2980,13 +2850,10 @@ */ if (n <= SMALL_DIGITS) { /* It must be small */ - if (neg) i = -(Sint)ui; - else i = (Sint)ui; + if (neg) i = -i; res = make_small(i); } else { - /* Convert from log10 to log2 by multiplying with 1/log10(2)=3.3219 - which we round up to (3 + 1/3) */ - lg2 = (n+1)*3 + (n+1)/3 + 1; + lg2 = (n+1)*230/69+1; m = (lg2+D_EXP-1)/D_EXP; /* number of digits */ m = BIG_NEED_SIZE(m); /* number of words + thing */ @@ -3577,6 +3444,91 @@ /**********************************************************************/ +/* + New representation of refs in R9, see erl_term.h + + In the first data word, only the usual 18 bits are used. Ordinarily, + in "long refs" all words are used (in other words, practically never + wrap around), but for compatibility with older nodes, "short refs" + exist. Short refs come into being by being converted from the old + external format for refs (tag REFERENCE_EXT). Short refs are + converted back to the old external format. + + When converting a long ref to the external format in the case of + preparing for sending to an older node, the ref is truncated by only + using the first word (with 18 significant bits), and using the old tag + REFERENCE_EXT. + + When comparing refs or different size, only the parts up to the length + of the shorter operand are used. This has the desirable effect that a + long ref sent to an old node and back will be treated as equal to + the original, although some of the bits have been lost. + + The hash value for a ref always considers only the first word, since + in the above scenario, the original and the copy should have the same + hash value. +*/ + +static Uint32 reference0; /* Initialized in erts_init_bif */ +static Uint32 reference1; +static Uint32 reference2; +static erts_smp_spinlock_t make_ref_lock; +static erts_smp_mtx_t ports_snapshot_mtx; +erts_smp_atomic_t erts_dead_ports_ptr; /* To store dying ports during snapshot */ + +void +erts_make_ref_in_array(Uint32 ref[ERTS_MAX_REF_NUMBERS]) +{ + erts_smp_spin_lock(&make_ref_lock); + + reference0++; + if (reference0 >= MAX_REFERENCE) { + reference0 = 0; + reference1++; + if (reference1 == 0) { + reference2++; + } + } + + ref[0] = reference0; + ref[1] = reference1; + ref[2] = reference2; + + erts_smp_spin_unlock(&make_ref_lock); +} + +Eterm erts_make_ref_in_buffer(Eterm buffer[REF_THING_SIZE]) +{ + Eterm* hp = buffer; + Uint32 ref[ERTS_MAX_REF_NUMBERS]; + + erts_make_ref_in_array(ref); + write_ref_thing(hp, ref[0], ref[1], ref[2]); + return make_internal_ref(hp); +} + +Eterm erts_make_ref(Process *p) +{ + Eterm* hp; + Uint32 ref[ERTS_MAX_REF_NUMBERS]; + + ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(p)); + + hp = HAlloc(p, REF_THING_SIZE); + + erts_make_ref_in_array(ref); + write_ref_thing(hp, ref[0], ref[1], ref[2]); + + return make_internal_ref(hp); +} + +BIF_RETTYPE make_ref_0(BIF_ALIST_0) +{ + return erts_make_ref(BIF_P); +} + +/**********************************************************************/ + /* return the time of day */ BIF_RETTYPE time_0(BIF_ALIST_0) @@ -4042,19 +3994,16 @@ BIF_RETTYPE function_exported_3(BIF_ALIST_3) { - int arity; if (is_not_atom(BIF_ARG_1) || is_not_atom(BIF_ARG_2) || is_not_small(BIF_ARG_3)) { BIF_ERROR(BIF_P, BADARG); } - arity = signed_val(BIF_ARG_3); - if (erts_find_function(BIF_ARG_1, BIF_ARG_2, arity, - erts_active_code_ix()) != NULL || - erts_is_builtin(BIF_ARG_1, BIF_ARG_2, arity)) { - BIF_RET(am_true); + if (erts_find_function(BIF_ARG_1, BIF_ARG_2, signed_val(BIF_ARG_3), + erts_active_code_ix()) == NULL) { + BIF_RET(am_false); } - BIF_RET(am_false); + BIF_RET(am_true); } /**********************************************************************/ @@ -4231,7 +4180,6 @@ goto bad; enp = erts_find_or_insert_node(dep->sysname, dep->creation); - ASSERT(enp != erts_this_node); etp = (ExternalThing *) HAlloc(BIF_P, EXTERNAL_THING_HEAD_SIZE + 1); etp->header = make_external_pid_header(1); @@ -4558,28 +4506,6 @@ break; } #endif - } else if (BIF_ARG_1 == am_time_offset - && ERTS_IS_ATOM_STR("finalize", BIF_ARG_2)) { - ErtsTimeOffsetState res; - erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN); - res = erts_finalize_time_offset(); - erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN); - switch (res) { - case ERTS_TIME_OFFSET_PRELIMINARY: { - DECL_AM(preliminary); - BIF_RET(AM_preliminary); - } - case ERTS_TIME_OFFSET_FINAL: { - DECL_AM(final); - BIF_RET(AM_final); - } - case ERTS_TIME_OFFSET_VOLATILE: { - DECL_AM(volatile); - BIF_RET(AM_volatile); - } - default: - ERTS_INTERNAL_ERROR("Unknown state"); - } } else if (ERTS_IS_ATOM_STR("scheduling_statistics", BIF_ARG_1)) { int what; if (ERTS_IS_ATOM_STR("disable", BIF_ARG_2)) @@ -4731,7 +4657,7 @@ } BIF_RETTYPE erts_internal_cmp_term_2(BIF_ALIST_2) { - Sint res = CMP_TERM(BIF_ARG_1,BIF_ARG_2); + int res = CMP_TERM(BIF_ARG_1,BIF_ARG_2); /* ensure -1, 0, 1 result */ if (res < 0) { @@ -4867,6 +4793,11 @@ void erts_init_bif(void) { + reference0 = 0; + reference1 = 0; + reference2 = 0; + + erts_smp_spinlock_init(&make_ref_lock, "make_ref"); erts_smp_mtx_init(&ports_snapshot_mtx, "ports_snapshot"); erts_smp_atomic_init_nob(&erts_dead_ports_ptr, (erts_aint_t) NULL); @@ -4883,21 +4814,9 @@ #endif , &bif_return_trap); - erts_await_result = erts_export_put(am_erts_internal, - am_await_result, - 1); - - erts_init_trap_export(&dsend_continue_trap_export, - am_erts_internal, am_dsend_continue_trap, 1, - dsend_continue_trap_1); - - flush_monitor_messages_trap = erts_export_put(am_erts_internal, - am_flush_monitor_messages, - 3); - - erts_convert_time_unit_trap = erts_export_put(am_erlang, - am_convert_time_unit, - 3); + flush_monitor_message_trap = erts_export_put(am_erlang, + am_flush_monitor_message, + 2); set_cpu_topology_trap = erts_export_put(am_erlang, am_set_cpu_topology, diff -Nru erlang-18.2-dfsg/erts/emulator/beam/bif.h erlang-17.3-dfsg/erts/emulator/beam/bif.h --- erlang-18.2-dfsg/erts/emulator/beam/bif.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/bif.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -21,9 +20,7 @@ #ifndef __BIF_H__ #define __BIF_H__ -extern Export *erts_await_result; extern Export* erts_format_cpu_topology_trap; -extern Export *erts_convert_time_unit_trap; #define BIF_RETTYPE Eterm @@ -33,12 +30,10 @@ #define BIF_ALIST_1 Process* A__p, Eterm* BIF__ARGS #define BIF_ALIST_2 Process* A__p, Eterm* BIF__ARGS #define BIF_ALIST_3 Process* A__p, Eterm* BIF__ARGS -#define BIF_ALIST_4 Process* A__p, Eterm* BIF__ARGS #define BIF_ARG_1 (BIF__ARGS[0]) #define BIF_ARG_2 (BIF__ARGS[1]) #define BIF_ARG_3 (BIF__ARGS[2]) -#define BIF_ARG_4 (BIF__ARGS[3]) #define ERTS_IS_PROC_OUT_OF_REDS(p) \ ((p)->fcalls > 0 \ @@ -470,8 +465,6 @@ Eterm args[], int nargs); -#ifdef ERL_WANT_HIPE_BIF_WRAPPER__ - #ifndef HIPE #define HIPE_WRAPPER_BIF_DISABLE_GC(BIF_NAME, ARITY) @@ -516,7 +509,6 @@ #endif -#endif /* ERL_WANT_HIPE_BIF_WRAPPER__ */ #include "erl_bif_table.h" diff -Nru erlang-18.2-dfsg/erts/emulator/beam/bif.tab erlang-17.3-dfsg/erts/emulator/beam/bif.tab --- erlang-18.2-dfsg/erts/emulator/beam/bif.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/bif.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -93,8 +92,6 @@ bif erlang:localtime/0 bif erlang:localtime_to_universaltime/2 bif erlang:make_ref/0 -bif erlang:unique_integer/0 -bif erlang:unique_integer/1 bif erlang:md5/1 bif erlang:md5_init/0 bif erlang:md5_update/2 @@ -107,13 +104,6 @@ ubif erlang:node/0 bif erlang:nodes/1 bif erlang:now/0 -bif erlang:monotonic_time/0 -bif erlang:monotonic_time/1 -bif erlang:system_time/0 -bif erlang:system_time/1 -bif erlang:time_offset/0 -bif erlang:time_offset/1 -bif erlang:timestamp/0 bif erlang:open_port/2 @@ -167,12 +157,6 @@ bif erts_internal:check_process_code/2 bif erts_internal:map_to_tuple_keys/1 -bif erts_internal:map_type/1 -bif erts_internal:map_hashmap_children/1 - -bif erts_internal:time_unit/0 - -bif erts_internal:is_system_process/1 # inet_db support bif erlang:port_set_data/2 @@ -210,20 +194,15 @@ bif math:erfc/1 bif math:exp/1 bif math:log/1 -bif math:log2/1 bif math:log10/1 bif math:sqrt/1 bif math:atan2/2 bif math:pow/2 bif erlang:start_timer/3 -bif erlang:start_timer/4 bif erlang:send_after/3 -bif erlang:send_after/4 bif erlang:cancel_timer/1 -bif erlang:cancel_timer/2 bif erlang:read_timer/1 -bif erlang:read_timer/2 bif erlang:make_tuple/2 bif erlang:append_element/2 @@ -368,8 +347,6 @@ bif os:getenv/1 bif os:getpid/0 bif os:timestamp/0 -bif os:system_time/0 -bif os:system_time/1 # # Bifs in the erl_ddll module (the module actually does not exist) @@ -601,7 +578,7 @@ bif os:unsetenv/1 # -# New in 17.0 +# New in R17A # bif re:inspect/2 @@ -623,21 +600,10 @@ bif erts_internal:cmp_term/2 -bif ets:take/2 - # -# New in 17.1 +# New in 17.1. # - bif erlang:fun_info_mfa/1 - -# New in 18.0 -# - -bif erlang:get_keys/0 -bif ets:update_counter/4 -bif erts_debug:map_info/1 - # # Obsolete # diff -Nru erlang-18.2-dfsg/erts/emulator/beam/big.c erlang-17.3-dfsg/erts/emulator/beam/big.c --- erlang-18.2-dfsg/erts/emulator/beam/big.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/big.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -275,9 +274,10 @@ _b = _b << _s; \ _vn1 = _b >> H_EXP; \ _vn0 = _b & LO_MASK; \ - /* If needed to avoid undefined behaviour */ \ - if (_s) _un32 = (_a1 << _s) | ((_a0>>(D_EXP-_s)) & (-_s >> (D_EXP-1))); \ - else _un32 = _a1; \ + /* Sometimes _s is 0 which triggers undefined behaviour for the \ + (_a0>>(D_EXP-_s)) shift, but this is ok because the \ + & -s will make it all to 0 later anyways. */ \ + _un32 = (_a1 << _s) | ((_a0>>(D_EXP-_s)) & (-_s >> (D_EXP-1))); \ _un10 = _a0 << _s; \ _un1 = _un10 >> H_EXP; \ _un0 = _un10 & LO_MASK; \ @@ -1578,46 +1578,6 @@ return make_big(hp); } -Eterm -erts_uint64_array_to_big(Uint **hpp, int neg, int len, Uint64 *array) -{ - Uint *headerp; - int i, pot_digits, digits; - - headerp = *hpp; - - pot_digits = digits = 0; - for (i = 0; i < len; i++) { -#if defined(ARCH_32) || HALFWORD_HEAP - Uint low_val = array[i] & ((Uint) 0xffffffff); - Uint high_val = (array[i] >> 32) & ((Uint) 0xffffffff); - BIG_DIGIT(headerp, pot_digits) = low_val; - pot_digits++; - if (low_val) - digits = pot_digits; - BIG_DIGIT(headerp, pot_digits) = high_val; - pot_digits++; - if (high_val) - digits = pot_digits; -#else - Uint val = array[i]; - BIG_DIGIT(headerp, pot_digits) = val; - pot_digits++; - if (val) - digits = pot_digits; -#endif - } - - if (neg) - *headerp = make_neg_bignum_header(digits); - else - *headerp = make_pos_bignum_header(digits); - - *hpp = headerp + 1 + digits; - - return make_big(headerp); -} - /* ** Convert a bignum to a double float */ @@ -1941,8 +1901,6 @@ *rwp = d; rwp++; } - if (rsz > BIG_ARITY_MAX) - return NIL; if (xsgn) { *r = make_neg_bignum_header(rsz); } @@ -2618,9 +2576,6 @@ size--; } - if (size == 0) - goto bytebuf_to_integer_1_error; - if (size < SMALL_DIGITS && base <= 10) { /* * * Take shortcut if we know that all chars are '0' < b < '9' and diff -Nru erlang-18.2-dfsg/erts/emulator/beam/big.h erlang-17.3-dfsg/erts/emulator/beam/big.h --- erlang-18.2-dfsg/erts/emulator/beam/big.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/big.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -86,7 +85,6 @@ /* The heap size needed for a bignum */ #define BIG_NEED_SIZE(x) ((x) + 1) -#define BIG_NEED_FOR_BITS(bits) BIG_NEED_SIZE(((bits)-1)/D_EXP + 1) #define BIG_UINT_HEAP_SIZE (1 + 1) /* always, since sizeof(Uint) <= sizeof(Eterm) */ @@ -106,9 +104,6 @@ : ERTS_UINT64_BIG_HEAP_SIZE__((X) >= 0 ? (X) : -(Uint64)(X))) #define ERTS_UINT64_HEAP_SIZE(X) \ (IS_USMALL(0, (X)) ? 0 : ERTS_UINT64_BIG_HEAP_SIZE__((X))) -#define ERTS_MAX_SINT64_HEAP_SIZE (1 + 2) -#define ERTS_MAX_UINT64_HEAP_SIZE (1 + 2) -#define ERTS_UINT64_ARRAY_TO_BIG_MAX_HEAP_SZ(LEN) (2*(LEN)+1) #else @@ -116,9 +111,6 @@ (IS_SSMALL((X)) ? 0 : (1 + 1)) #define ERTS_UINT64_HEAP_SIZE(X) \ (IS_USMALL(0, (X)) ? 0 : (1 + 1)) -#define ERTS_MAX_SINT64_HEAP_SIZE (1 + 1) -#define ERTS_MAX_UINT64_HEAP_SIZE (1 + 1) -#define ERTS_UINT64_ARRAY_TO_BIG_MAX_HEAP_SZ(LEN) ((LEN)+1) #endif @@ -164,7 +156,6 @@ int term_to_UWord(Eterm, UWord*); int term_to_Sint(Eterm, Sint*); #if HAVE_INT64 -Eterm erts_uint64_array_to_big(Uint **, int, int, Uint64 *); int term_to_Uint64(Eterm, Uint64*); int term_to_Sint64(Eterm, Sint64*); #endif diff -Nru erlang-18.2-dfsg/erts/emulator/beam/binary.c erlang-17.3-dfsg/erts/emulator/beam/binary.c --- erlang-18.2-dfsg/erts/emulator/beam/binary.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/binary.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -27,9 +26,7 @@ #include "global.h" #include "erl_process.h" #include "error.h" -#define ERL_WANT_HIPE_BIF_WRAPPER__ #include "bif.h" -#undef ERL_WANT_HIPE_BIF_WRAPPER__ #include "big.h" #include "erl_binary.h" #include "erl_bits.h" @@ -86,6 +83,8 @@ * Allocate the binary struct itself. */ bptr = erts_bin_nrml_alloc(len); + bptr->flags = 0; + bptr->orig_size = len; erts_refc_init(&bptr->refc, 1); if (buf != NULL) { sys_memcpy(bptr->orig_bytes, buf, len); @@ -123,6 +122,8 @@ * Allocate the binary struct itself. */ bptr = erts_bin_nrml_alloc(len); + bptr->flags = 0; + bptr->orig_size = len; erts_refc_init(&bptr->refc, 1); if (buf != NULL) { sys_memcpy(bptr->orig_bytes, buf, len); @@ -176,6 +177,7 @@ } else { /* REFC */ ProcBin* pb = (ProcBin *) bval; Binary* newbin = erts_bin_realloc(pb->val, size); + newbin->orig_size = size; pb->val = newbin; pb->size = size; pb->bytes = (byte*) newbin->orig_bytes; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/break.c erlang-17.3-dfsg/erts/emulator/beam/break.c --- erlang-18.2-dfsg/erts/emulator/beam/break.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/break.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -37,7 +36,7 @@ #include "atom.h" #include "beam_load.h" #include "erl_instrument.h" -#include "erl_hl_timer.h" +#include "erl_bif_timer.h" #include "erl_thr_progress.h" /* Forward declarations -- should really appear somewhere else */ @@ -109,7 +108,7 @@ case 'k': { ErtsProcLocks rp_locks = ERTS_PROC_LOCKS_XSIG_SEND; erts_aint32_t state; - erts_proc_inc_refc(rp); + erts_smp_proc_inc_refc(rp); erts_smp_proc_lock(rp, rp_locks); state = erts_smp_atomic32_read_acqb(&rp->state); if (state & (ERTS_PSFLG_FREE @@ -132,7 +131,7 @@ 0); } erts_smp_proc_unlock(rp, rp_locks); - erts_proc_dec_refc(rp); + erts_smp_proc_dec_refc(rp); } case 'n': br = 1; break; case 'r': return; @@ -182,6 +181,7 @@ ASSERT(is_node_name_atom(mon->pid)); erts_print(to, to_arg, "%s{to,{%T,%T},%T}", prefix, mon->name, mon->pid, mon->ref); + erts_print(to, to_arg,"}"); } else if (is_atom(mon->name)){ /* local by name */ erts_print(to, to_arg, "%s{to,{%T,%T},%T}", prefix, mon->name, erts_this_dist_entry->sysname, mon->ref); @@ -210,12 +210,25 @@ erts_print(to, to_arg, "State: "); state = erts_smp_atomic32_read_acqb(&p->state); - erts_dump_process_state(to, to_arg, state); - if (state & ERTS_PSFLG_GC) { - garbing = 1; - running = 1; - } else if (state & ERTS_PSFLG_RUNNING) - running = 1; + if (state & ERTS_PSFLG_FREE) + erts_print(to, to_arg, "Non Existing\n"); /* Should never happen */ + else if (state & ERTS_PSFLG_EXITING) + erts_print(to, to_arg, "Exiting\n"); + else if (state & ERTS_PSFLG_GC) { + garbing = 1; + running = 1; + erts_print(to, to_arg, "Garbing\n"); + } + else if (state & ERTS_PSFLG_SUSPENDED) + erts_print(to, to_arg, "Suspended\n"); + else if (state & ERTS_PSFLG_RUNNING) { + running = 1; + erts_print(to, to_arg, "Running\n"); + } + else if (state & ERTS_PSFLG_ACTIVE) + erts_print(to, to_arg, "Scheduled\n"); + else + erts_print(to, to_arg, "Waiting\n"); /* * If the process is registered as a global process, display the @@ -228,9 +241,9 @@ * Display the initial function name */ erts_print(to, to_arg, "Spawned as: %T:%T/%bpu\n", - p->u.initial[INITIAL_MOD], - p->u.initial[INITIAL_FUN], - p->u.initial[INITIAL_ARI]); + p->initial[INITIAL_MOD], + p->initial[INITIAL_FUN], + p->initial[INITIAL_ARI]); if (p->current != NULL) { if (running) { @@ -243,6 +256,7 @@ p->current[1], p->current[2]); } + erts_print(to, to_arg, "Run queue: %d\n", erts_get_runq_proc(p)->ix); erts_print(to, to_arg, "Spawned by: %T\n", p->parent); approx_started = (time_t) p->approx_started; @@ -338,10 +352,6 @@ #endif erts_stack_dump(to, to_arg, p); } - - /* Display all states */ - erts_print(to, to_arg, "Internal State: "); - erts_dump_extended_process_state(to, to_arg, state); } static void @@ -536,9 +546,7 @@ erts_printf("Erlang (%s) emulator version " ERLANG_VERSION "\n", EMULATOR); -#if ERTS_SAVED_COMPILE_TIME erts_printf("Compiled on " ERLANG_COMPILE_DATE "\n"); -#endif return; case 'd': distribution_info(ERTS_PRINT_STDOUT, NULL); @@ -673,39 +681,27 @@ char* dumpname; int secs; int env_erl_crash_dump_seconds_set = 1; - int i; if (ERTS_SOMEONE_IS_CRASH_DUMPING) return; #ifdef ERTS_SMP - /* Order all managed threads to block, this has to be done - first to guarantee that this is the only thread to generate - crash dump. */ - erts_thr_progress_fatal_error_block(&tpd_buf); - -#ifdef ERTS_THR_HAVE_SIG_FUNCS /* - * We suspend all scheduler threads so that we can dump some - * data about the currently running processes and scheduler data. - * We have to be very very careful when doing this as the schedulers - * could be anywhere. + * Wait for all managed threads to block. If all threads haven't blocked + * after a minute, we go anyway and hope for the best... + * + * We do not release system again. We expect an exit() or abort() after + * dump has been written. */ - for (i = 0; i < erts_no_schedulers; i++) { - erts_tid_t tid = ERTS_SCHEDULER_IX(i)->tid; - if (!erts_equal_tids(tid,erts_thr_self())) - sys_thr_suspend(tid); - } - -#endif + erts_thr_progress_fatal_error_block(60000, &tpd_buf); + /* Either worked or not... */ /* Allow us to pass certain places without locking... */ erts_smp_atomic32_set_mb(&erts_writing_erl_crash_dump, 1); erts_smp_tsd_set(erts_is_crash_dumping_key, (void *) 1); - -#else /* !ERTS_SMP */ +#else erts_writing_erl_crash_dump = 1; -#endif /* ERTS_SMP */ +#endif envsz = sizeof(env); /* ERL_CRASH_DUMP_SECONDS not set @@ -758,12 +754,11 @@ dumpname = "erl_crash.dump"; else dumpname = &dumpnamebuf[0]; - - erts_fprintf(stderr,"\nCrash dump is being written to: %s...", dumpname); fd = open(dumpname,O_WRONLY | O_CREAT | O_TRUNC,0640); - if (fd < 0) + if (fd < 0) return; /* Can't create the crash dump, skip it */ + time(&now); erts_fdprintf(fd, "=erl_crash_dump:0.3\n%s", ctime(&now)); @@ -776,77 +771,10 @@ } erts_fdprintf(fd, "System version: "); erts_print_system_version(fd, NULL, NULL); -#if ERTS_SAVED_COMPILE_TIME erts_fdprintf(fd, "%s\n", "Compiled: " ERLANG_COMPILE_DATE); -#endif - erts_fdprintf(fd, "Taints: "); erts_print_nif_taints(fd, NULL); erts_fdprintf(fd, "Atoms: %d\n", atom_table_size()); - -#ifdef USE_THREADS - /* We want to note which thread it was that called erl_exit */ - if (erts_get_scheduler_data()) { - erts_fdprintf(fd, "Calling Thread: scheduler:%d\n", - erts_get_scheduler_data()->no); - } else { - if (!erts_thr_getname(erts_thr_self(), dumpnamebuf, MAXPATHLEN)) - erts_fdprintf(fd, "Calling Thread: %s\n", dumpnamebuf); - else - erts_fdprintf(fd, "Calling Thread: %p\n", erts_thr_self()); - } -#else - erts_fdprintf(fd, "Calling Thread: scheduler:1\n"); -#endif - -#if defined(ERTS_HAVE_TRY_CATCH) - - /* - * erts_print_scheduler_info is not guaranteed to be safe to call - * here for all schedulers as we may have suspended a scheduler - * in the middle of updating the STACK_TOP and STACK_START - * variables and thus when scanning the stack we could get - * segmentation faults. We protect against this very unlikely - * scenario by using the ERTS_SYS_TRY_CATCH. - */ - for (i = 0; i < erts_no_schedulers; i++) { - ERTS_SYS_TRY_CATCH( - erts_print_scheduler_info(fd, NULL, ERTS_SCHEDULER_IX(i)), - erts_fdprintf(fd, "** crashed **\n")); - } -#endif - -#ifdef ERTS_SMP - -#if defined(ERTS_THR_HAVE_SIG_FUNCS) - - /* We resume all schedulers so that we are in a known safe state - when we write the rest of the crash dump */ - for (i = 0; i < erts_no_schedulers; i++) { - erts_tid_t tid = ERTS_SCHEDULER_IX(i)->tid; - if (!erts_equal_tids(tid,erts_thr_self())) - sys_thr_resume(tid); - } -#endif - - /* - * Wait for all managed threads to block. If all threads haven't blocked - * after a minute, we go anyway and hope for the best... - * - * We do not release system again. We expect an exit() or abort() after - * dump has been written. - */ - erts_thr_progress_fatal_error_wait(60000); - /* Either worked or not... */ -#endif - -#ifndef ERTS_HAVE_TRY_CATCH - /* This is safe to call here, as all schedulers are blocked */ - for (i = 0; i < erts_no_schedulers; i++) { - erts_print_scheduler_info(fd, NULL, ERTS_SCHEDULER_IX(i)); - } -#endif - info(fd, NULL); /* General system info */ if (erts_ptab_initialized(&erts_proc)) process_info(fd, NULL); /* Info about each process and port */ @@ -876,7 +804,7 @@ erts_fdprintf(fd, "=end\n"); close(fd); - erts_fprintf(stderr,"done\n"); + erts_fprintf(stderr,"\nCrash dump was written to: %s\n", dumpname); } void diff -Nru erlang-18.2-dfsg/erts/emulator/beam/code_ix.c erlang-17.3-dfsg/erts/emulator/beam/code_ix.c --- erlang-18.2-dfsg/erts/emulator/beam/code_ix.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/code_ix.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -131,7 +130,7 @@ ASSERT(code_writing_process != c_p); qitem = erts_alloc(ERTS_ALC_T_CODE_IX_LOCK_Q, sizeof(*qitem)); qitem->p = c_p; - erts_proc_inc_refc(c_p); + erts_smp_proc_inc_refc(c_p); qitem->next = code_write_queue; code_write_queue = qitem; erts_suspend(c_p, ERTS_PROC_LOCK_MAIN, NULL); @@ -152,7 +151,7 @@ } erts_smp_proc_unlock(qitem->p, ERTS_PROC_LOCK_STATUS); code_write_queue = qitem->next; - erts_proc_dec_refc(qitem->p); + erts_smp_proc_dec_refc(qitem->p); erts_free(ERTS_ALC_T_CODE_IX_LOCK_Q, qitem); } code_writing_process = NULL; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/code_ix.h erlang-17.3-dfsg/erts/emulator/beam/code_ix.h --- erlang-18.2-dfsg/erts/emulator/beam/code_ix.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/code_ix.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2012-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/copy.c erlang-17.3-dfsg/erts/emulator/beam/copy.c --- erlang-18.2-dfsg/erts/emulator/beam/copy.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/copy.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -22,8 +21,6 @@ # include "config.h" #endif -#define ERL_WANT_GC_INTERNALS__ - #include "sys.h" #include "erl_vm.h" #include "global.h" @@ -35,7 +32,7 @@ #include "erl_bits.h" #include "dtrace-wrapper.h" -static void move_one_frag(Eterm** hpp, ErlHeapFragment*, ErlOffHeap*); +static void move_one_frag(Eterm** hpp, Eterm* src, Uint src_sz, ErlOffHeap*); /* * Copy object "obj" to process p. @@ -128,52 +125,6 @@ obj = *bptr; break; } - case MAP_SUBTAG: - switch (MAP_HEADER_TYPE(hdr)) { - case MAP_HEADER_TAG_FLATMAP_HEAD : - { - Uint n; - flatmap_t *mp; - mp = (flatmap_t*)flatmap_val_rel(obj,base); - ptr = (Eterm *)mp; - n = flatmap_get_size(mp) + 1; - sum += n + 2; - ptr += 2; /* hdr + size words */ - while (n--) { - obj = *ptr++; - if (!IS_CONST(obj)) { - ESTACK_PUSH(s, obj); - } - } - goto pop_next; - } - case MAP_HEADER_TAG_HAMT_HEAD_BITMAP : - case MAP_HEADER_TAG_HAMT_HEAD_ARRAY : - case MAP_HEADER_TAG_HAMT_NODE_BITMAP : - { - Eterm *head; - Uint sz; - head = hashmap_val_rel(obj, base); - sz = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - sum += 1 + sz + header_arity(hdr); - head += 1 + header_arity(hdr); - - if (sz == 0) { - goto pop_next; - } - while(sz-- > 1) { - obj = head[sz]; - if (!IS_CONST(obj)) { - ESTACK_PUSH(s, obj); - } - } - obj = head[0]; - } - break; - default: - erl_exit(ERTS_ABORT_EXIT, "size_object: bad hashmap type %d\n", MAP_HEADER_TYPE(hdr)); - } - break; case SUB_BINARY_SUBTAG: { Eterm real_bin; @@ -201,7 +152,25 @@ goto pop_next; } break; - case BIN_MATCHSTATE_SUBTAG: + case MAP_SUBTAG: + { + Uint n; + map_t *mp; + mp = (map_t*)map_val_rel(obj,base); + ptr = (Eterm *)mp; + n = map_get_size(mp) + 1; + sum += n + 2; + ptr += 2; /* hdr + size words */ + while (n--) { + obj = *ptr++; + if (!IS_CONST(obj)) { + ESTACK_PUSH(s, obj); + } + } + goto pop_next; + } + break; + case BIN_MATCHSTATE_SUBTAG: erl_exit(ERTS_ABORT_EXIT, "size_object: matchstate term not allowed"); default: @@ -369,6 +338,15 @@ } } break; + case MAP_SUBTAG: + { + i = map_get_size(objp) + 3; + *argp = make_map_rel(htop, dst_base); + while (i--) { + *htop++ = *objp++; + } + } + break; case REFC_BINARY_SUBTAG: { ProcBin* pb; @@ -479,7 +457,7 @@ { ExternalThing *etp = (ExternalThing *) htop; - i = thing_arityval(hdr) + 1; + i = thing_arityval(hdr) + 1; tp = htop; while (i--) { @@ -493,28 +471,6 @@ *argp = make_external_rel(tp, dst_base); } break; - case MAP_SUBTAG: - tp = htop; - switch (MAP_HEADER_TYPE(hdr)) { - case MAP_HEADER_TAG_FLATMAP_HEAD : - i = flatmap_get_size(objp) + 3; - *argp = make_flatmap_rel(htop, dst_base); - while (i--) { - *htop++ = *objp++; - } - break; - case MAP_HEADER_TAG_HAMT_HEAD_BITMAP : - case MAP_HEADER_TAG_HAMT_HEAD_ARRAY : - *htop++ = *objp++; - case MAP_HEADER_TAG_HAMT_NODE_BITMAP : - i = 1 + hashmap_bitcount(MAP_HEADER_VAL(hdr)); - while (i--) { *htop++ = *objp++; } - *argp = make_hashmap_rel(tp, dst_base); - break; - default: - erl_exit(ERTS_ABORT_EXIT, "copy_struct: bad hashmap type %d\n", MAP_HEADER_TYPE(hdr)); - } - break; case BIN_MATCHSTATE_SUBTAG: erl_exit(ERTS_ABORT_EXIT, "copy_struct: matchstate term not allowed"); @@ -609,6 +565,11 @@ erts_refc_inc(&funp->fe->refc, 2); } goto off_heap_common; + + case MAP_SUBTAG: + *hp++ = *tp++; + sz--; + break; case EXTERNAL_PID_SUBTAG: case EXTERNAL_PORT_SUBTAG: case EXTERNAL_REF_SUBTAG: @@ -644,6 +605,7 @@ } } *hpp = hp; + return res; } @@ -662,7 +624,8 @@ unsigned i; for (bp=first; bp!=NULL; bp=bp->next) { - move_one_frag(hpp, bp, off_heap); + move_one_frag(hpp, bp->mem, bp->used_size, off_heap); + OH_OVERHEAD(off_heap, bp->off_heap.overhead); } hp_end = *hpp; for (hp=hp_start; hpmem; - Eterm* end = ptr + frag->used_size; + Eterm* ptr = src; + Eterm* end = ptr + src_sz; Eterm dummy_ref; Eterm* hp = *hpp; @@ -732,7 +695,5 @@ } } *hpp = hp; - OH_OVERHEAD(off_heap, frag->off_heap.overhead); - frag->off_heap.first = NULL; } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/dist.c erlang-17.3-dfsg/erts/emulator/beam/dist.c --- erlang-18.2-dfsg/erts/emulator/beam/dist.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/dist.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 1996-2014. All Rights Reserved. + * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -45,8 +44,6 @@ #include "erl_thr_progress.h" #include "dtrace-wrapper.h" -#define DIST_CTL_DEFAULT_SIZE 64 - /* Turn this on to get printouts of all distribution messages * which go on the line */ @@ -68,13 +65,9 @@ static void dist_msg_dbg(ErtsDistExternal *edep, char *what, byte *buf, int sz) { - ErtsHeapFactory factory; - DeclareTmpHeapNoproc(ctl_default,DIST_CTL_DEFAULT_SIZE); - Eterm* ctl = ctl_default; byte *extp = edep->extp; Eterm msg; - Sint ctl_len; - Sint size = ctl_len = erts_decode_dist_ext_size(edep); + Sint size = erts_decode_dist_ext_size(edep); if (size < 0) { erts_fprintf(stderr, "DIST MSG DEBUG: erts_decode_dist_ext_size(%s) failed:\n", @@ -82,9 +75,10 @@ bw(buf, sz); } else { + Eterm *hp; ErlHeapFragment *mbuf = new_message_buffer(size); - erts_factory_static_init(&factory, ctl, ctl_len, &mbuf->off_heap); - msg = erts_decode_dist_ext(&factory, edep); + hp = mbuf->mem; + msg = erts_decode_dist_ext(&hp, &mbuf->off_heap, edep); if (is_value(msg)) erts_fprintf(stderr, " %s: %T\n", what, msg); else { @@ -125,7 +119,7 @@ /* forward declarations */ static void clear_dist_entry(DistEntry*); -static int dsig_send_ctl(ErtsDSigData* dsdp, Eterm ctl, int force_busy); +static int dsig_send(ErtsDSigData *, Eterm, Eterm, int); static void send_nodes_mon_msgs(Process *, Eterm, Eterm, Eterm, Eterm); static void init_nodes_monitors(void); @@ -394,7 +388,11 @@ Eterm tup; Eterm *hp = erts_alloc_message_heap(3,&bp,&ohp,rp,&rp_locks); tup = TUPLE2(hp, am_nodedown, name); - erts_queue_message(rp, &rp_locks, bp, tup, NIL); + erts_queue_message(rp, &rp_locks, bp, tup, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); } erts_smp_proc_unlock(rp, rp_locks); } @@ -624,7 +622,9 @@ ErtsDistOutputBuf *obuf; Uint obuf_size = sizeof(ErtsDistOutputBuf)+sizeof(byte)*(size-1); Binary *bin = erts_bin_drv_alloc(obuf_size); + bin->flags = BIN_FLAG_DRV; erts_refc_init(&bin->refc, 1); + bin->orig_size = (SWord) obuf_size; obuf = (ErtsDistOutputBuf *) &bin->orig_bytes[0]; #ifdef DEBUG obuf->dbg_pattern = ERTS_DIST_OUTPUT_BUF_DBG_PATTERN; @@ -709,55 +709,6 @@ } } -void erts_dsend_context_dtor(Binary* ctx_bin) -{ - ErtsSendContext* ctx = ERTS_MAGIC_BIN_DATA(ctx_bin); - switch (ctx->dss.phase) { - case ERTS_DSIG_SEND_PHASE_MSG_SIZE: - DESTROY_SAVED_WSTACK(&ctx->dss.u.sc.wstack); - break; - case ERTS_DSIG_SEND_PHASE_MSG_ENCODE: - DESTROY_SAVED_WSTACK(&ctx->dss.u.ec.wstack); - break; - default:; - } - if (ctx->dss.phase >= ERTS_DSIG_SEND_PHASE_ALLOC && ctx->dss.obuf) { - free_dist_obuf(ctx->dss.obuf); - } - if (ctx->dep_to_deref) - erts_deref_dist_entry(ctx->dep_to_deref); -} - -Eterm erts_dsend_export_trap_context(Process* p, ErtsSendContext* ctx) -{ - struct exported_ctx { - ErtsSendContext ctx; - ErtsAtomCacheMap acm; - }; - Binary* ctx_bin = erts_create_magic_binary(sizeof(struct exported_ctx), - erts_dsend_context_dtor); - struct exported_ctx* dst = ERTS_MAGIC_BIN_DATA(ctx_bin); - Uint ctl_size = !HALFWORD_HEAP ? 0 : (arityval(ctx->ctl_heap[0]) + 1); - Eterm* hp = HAlloc(p, ctl_size + PROC_BIN_SIZE); - - sys_memcpy(&dst->ctx, ctx, sizeof(ErtsSendContext)); - ASSERT(ctx->dss.ctl == make_tuple(ctx->ctl_heap)); -#if !HALFWORD_HEAP - dst->ctx.dss.ctl = make_tuple(dst->ctx.ctl_heap); -#else - /* Must put control tuple in low mem */ - sys_memcpy(hp, ctx->ctl_heap, ctl_size*sizeof(Eterm)); - dst->ctx.dss.ctl = make_tuple(hp); - hp += ctl_size; -#endif - if (ctx->dss.acmp) { - sys_memcpy(&dst->acm, ctx->dss.acmp, sizeof(ErtsAtomCacheMap)); - dst->ctx.dss.acmp = &dst->acm; - } - return erts_mk_magic_binary_term(&hp, &MSO(p), ctx_bin); -} - - /* * The erts_dsig_send_*() functions implemented below, sends asynchronous * distributed signals to other Erlang nodes. Before sending a distributed @@ -780,7 +731,7 @@ int res; UseTmpHeapNoproc(4); - res = dsig_send_ctl(dsdp, ctl, 0); + res = dsig_send(dsdp, ctl, THE_NON_VALUE, 0); UnUseTmpHeapNoproc(4); return res; } @@ -793,7 +744,7 @@ int res; UseTmpHeapNoproc(4); - res = dsig_send_ctl(dsdp, ctl, 0); + res = dsig_send(dsdp, ctl, THE_NON_VALUE, 0); UnUseTmpHeapNoproc(4); return res; } @@ -821,7 +772,7 @@ erts_smp_de_links_unlock(dsdp->dep); #endif - res = dsig_send_ctl(dsdp, ctl, 1); + res = dsig_send(dsdp, ctl, THE_NON_VALUE, 1); UnUseTmpHeapNoproc(6); return res; } @@ -842,7 +793,7 @@ make_small(DOP_MONITOR_P), watcher, watched, ref); - res = dsig_send_ctl(dsdp, ctl, 0); + res = dsig_send(dsdp, ctl, THE_NON_VALUE, 0); UnUseTmpHeapNoproc(5); return res; } @@ -864,17 +815,18 @@ make_small(DOP_DEMONITOR_P), watcher, watched, ref); - res = dsig_send_ctl(dsdp, ctl, force); + res = dsig_send(dsdp, ctl, THE_NON_VALUE, force); UnUseTmpHeapNoproc(5); return res; } int -erts_dsig_send_msg(Eterm remote, Eterm message, ErtsSendContext* ctx) +erts_dsig_send_msg(ErtsDSigData *dsdp, Eterm remote, Eterm message) { Eterm ctl; + DeclareTmpHeapNoproc(ctl_heap,5); Eterm token = NIL; - Process *sender = ctx->dsd.proc; + Process *sender = dsdp->proc; int res; #ifdef USE_VM_PROBES Sint tok_label = 0; @@ -886,7 +838,8 @@ DTRACE_CHARBUF(receiver_name, 64); #endif - if (SEQ_TRACE_TOKEN(sender) != NIL + UseTmpHeapNoproc(5); + if (SEQ_TRACE_TOKEN(sender) != NIL #ifdef USE_VM_PROBES && SEQ_TRACE_TOKEN(sender) != am_have_dt_utag #endif @@ -899,7 +852,7 @@ *node_name = *sender_name = *receiver_name = '\0'; if (DTRACE_ENABLED(message_send) || DTRACE_ENABLED(message_send_remote)) { erts_snprintf(node_name, sizeof(DTRACE_CHARBUF_NAME(node_name)), - "%T", ctx->dsd.dep->sysname); + "%T", dsdp->dep->sysname); erts_snprintf(sender_name, sizeof(DTRACE_CHARBUF_NAME(sender_name)), "%T", sender->common.id); erts_snprintf(receiver_name, sizeof(DTRACE_CHARBUF_NAME(receiver_name)), @@ -914,28 +867,26 @@ #endif if (token != NIL) - ctl = TUPLE4(&ctx->ctl_heap[0], + ctl = TUPLE4(&ctl_heap[0], make_small(DOP_SEND_TT), am_Cookie, remote, token); else - ctl = TUPLE3(&ctx->ctl_heap[0], make_small(DOP_SEND), am_Cookie, remote); + ctl = TUPLE3(&ctl_heap[0], make_small(DOP_SEND), am_Cookie, remote); DTRACE6(message_send, sender_name, receiver_name, msize, tok_label, tok_lastcnt, tok_serial); DTRACE7(message_send_remote, sender_name, node_name, receiver_name, msize, tok_label, tok_lastcnt, tok_serial); - ctx->dss.ctl = ctl; - ctx->dss.msg = message; - ctx->dss.force_busy = 0; - res = erts_dsig_send(&ctx->dsd, &ctx->dss); + res = dsig_send(dsdp, ctl, message, 0); + UnUseTmpHeapNoproc(5); return res; } int -erts_dsig_send_reg_msg(Eterm remote_name, Eterm message, - ErtsSendContext* ctx) +erts_dsig_send_reg_msg(ErtsDSigData *dsdp, Eterm remote_name, Eterm message) { Eterm ctl; + DeclareTmpHeapNoproc(ctl_heap,6); Eterm token = NIL; - Process *sender = ctx->dsd.proc; + Process *sender = dsdp->proc; int res; #ifdef USE_VM_PROBES Sint tok_label = 0; @@ -947,6 +898,7 @@ DTRACE_CHARBUF(receiver_name, 128); #endif + UseTmpHeapNoproc(6); if (SEQ_TRACE_TOKEN(sender) != NIL #ifdef USE_VM_PROBES && SEQ_TRACE_TOKEN(sender) != am_have_dt_utag @@ -960,7 +912,7 @@ *node_name = *sender_name = *receiver_name = '\0'; if (DTRACE_ENABLED(message_send) || DTRACE_ENABLED(message_send_remote)) { erts_snprintf(node_name, sizeof(DTRACE_CHARBUF_NAME(node_name)), - "%T", ctx->dsd.dep->sysname); + "%T", dsdp->dep->sysname); erts_snprintf(sender_name, sizeof(DTRACE_CHARBUF_NAME(sender_name)), "%T", sender->common.id); erts_snprintf(receiver_name, sizeof(DTRACE_CHARBUF_NAME(receiver_name)), @@ -975,19 +927,17 @@ #endif if (token != NIL) - ctl = TUPLE5(&ctx->ctl_heap[0], make_small(DOP_REG_SEND_TT), + ctl = TUPLE5(&ctl_heap[0], make_small(DOP_REG_SEND_TT), sender->common.id, am_Cookie, remote_name, token); else - ctl = TUPLE4(&ctx->ctl_heap[0], make_small(DOP_REG_SEND), + ctl = TUPLE4(&ctl_heap[0], make_small(DOP_REG_SEND), sender->common.id, am_Cookie, remote_name); DTRACE6(message_send, sender_name, receiver_name, msize, tok_label, tok_lastcnt, tok_serial); DTRACE7(message_send_remote, sender_name, node_name, receiver_name, msize, tok_label, tok_lastcnt, tok_serial); - ctx->dss.ctl = ctl; - ctx->dss.msg = message; - ctx->dss.force_busy = 0; - res = erts_dsig_send(&ctx->dsd, &ctx->dss); + res = dsig_send(dsdp, ctl, message, 0); + UnUseTmpHeapNoproc(6); return res; } @@ -1044,7 +994,7 @@ DTRACE7(process_exit_signal_remote, sender_name, node_name, remote_name, reason_str, tok_label, tok_lastcnt, tok_serial); /* forced, i.e ignore busy */ - res = dsig_send_ctl(dsdp, ctl, 1); + res = dsig_send(dsdp, ctl, THE_NON_VALUE, 1); UnUseTmpHeapNoproc(6); return res; } @@ -1060,7 +1010,7 @@ ctl = TUPLE4(&ctl_heap[0], make_small(DOP_EXIT), local, remote, reason); /* forced, i.e ignore busy */ - res = dsig_send_ctl(dsdp, ctl, 1); + res = dsig_send(dsdp, ctl, THE_NON_VALUE, 1); UnUseTmpHeapNoproc(5); return res; } @@ -1076,7 +1026,7 @@ ctl = TUPLE4(&ctl_heap[0], make_small(DOP_EXIT2), local, remote, reason); - res = dsig_send_ctl(dsdp, ctl, 0); + res = dsig_send(dsdp, ctl, THE_NON_VALUE, 0); UnUseTmpHeapNoproc(5); return res; } @@ -1093,7 +1043,7 @@ ctl = TUPLE3(&ctl_heap[0], make_small(DOP_GROUP_LEADER), leader, remote); - res = dsig_send_ctl(dsdp, ctl, 0); + res = dsig_send(dsdp, ctl, THE_NON_VALUE, 0); UnUseTmpHeapNoproc(4); return res; } @@ -1141,6 +1091,7 @@ byte *buf, ErlDrvSizeT len) { +#define DIST_CTL_DEFAULT_SIZE 64 ErtsDistExternal ede; byte *t; Sint ctl_len; @@ -1153,7 +1104,7 @@ Process* rp; DeclareTmpHeapNoproc(ctl_default,DIST_CTL_DEFAULT_SIZE); Eterm* ctl = ctl_default; - ErtsHeapFactory factory; + ErlOffHeap off_heap; Eterm* hp; Sint type; Eterm token; @@ -1167,6 +1118,9 @@ #endif UseTmpHeapNoproc(DIST_CTL_DEFAULT_SIZE); + /* Thanks to Luke Gorrie */ + off_heap.first = NULL; + off_heap.overhead = 0; ERTS_SMP_CHK_NO_PROC_LOCKS; @@ -1227,15 +1181,14 @@ } hp = ctl; - erts_factory_tmp_init(&factory, ctl, ctl_len, ERTS_ALC_T_DCTRL_BUF); - arg = erts_decode_dist_ext(&factory, &ede); + arg = erts_decode_dist_ext(&hp, &off_heap, &ede); if (is_non_value(arg)) { #ifdef ERTS_DIST_MSG_DBG - erts_fprintf(stderr, "DIST MSG DEBUG: erts_decode_dist_ext(CTL) failed:\n"); + erts_fprintf(stderr, "DIST MSG DEBUG: erts_dist_ext_size(CTL) failed:\n"); bw(buf, orig_len); #endif PURIFY_MSG("data error"); - goto decode_error; + goto data_error; } ctl_len = t - buf; @@ -1715,7 +1668,7 @@ goto invalid_message; } - erts_factory_close(&factory); + erts_cleanup_offheap(&off_heap); if (ctl != ctl_default) { erts_free(ERTS_ALC_T_DCTRL_BUF, (void *) ctl); } @@ -1728,248 +1681,206 @@ erts_dsprintf(dsbufp, "Invalid distribution message: %.200T", arg); erts_send_error_to_logger_nogl(dsbufp); } -decode_error: + data_error: PURIFY_MSG("data error"); - erts_factory_close(&factory); + erts_cleanup_offheap(&off_heap); if (ctl != ctl_default) { erts_free(ERTS_ALC_T_DCTRL_BUF, (void *) ctl); } -data_error: UnUseTmpHeapNoproc(DIST_CTL_DEFAULT_SIZE); erts_deliver_port_exit(prt, dep->cid, am_killed, 0); ERTS_SMP_CHK_NO_PROC_LOCKS; return -1; } -static int dsig_send_ctl(ErtsDSigData* dsdp, Eterm ctl, int force_busy) -{ - struct erts_dsig_send_context ctx; - int ret; - ctx.ctl = ctl; - ctx.msg = THE_NON_VALUE; - ctx.force_busy = force_busy; - ctx.phase = ERTS_DSIG_SEND_PHASE_INIT; -#ifdef DEBUG - ctx.reds = 1; /* provoke assert below (no reduction count without msg) */ -#endif - ret = erts_dsig_send(dsdp, &ctx); - ASSERT(ret != ERTS_DSIG_SEND_CONTINUE); - return ret; -} - -int -erts_dsig_send(ErtsDSigData *dsdp, struct erts_dsig_send_context* ctx) +static int +dsig_send(ErtsDSigData *dsdp, Eterm ctl, Eterm msg, int force_busy) { - int retval; - Sint initial_reds = ctx->reds; Eterm cid; + int suspended = 0; + int resume = 0; + Uint32 pass_through_size; + Uint data_size, dhdr_ext_size; + ErtsAtomCacheMap *acmp; + ErtsDistOutputBuf *obuf; + DistEntry *dep = dsdp->dep; + Uint32 flags = dep->flags; + Process *c_p = dsdp->proc; + + if (!c_p || dsdp->no_suspend) + force_busy = 1; + + ERTS_SMP_LC_ASSERT(!c_p + || (ERTS_PROC_LOCK_MAIN + == erts_proc_lc_my_proc_locks(c_p))); + + if (!erts_is_alive) + return ERTS_DSIG_SEND_OK; + + if (flags & DFLAG_DIST_HDR_ATOM_CACHE) { + acmp = erts_get_atom_cache_map(c_p); + pass_through_size = 0; + } + else { + acmp = NULL; + pass_through_size = 1; + } - while (1) { - switch (ctx->phase) { - case ERTS_DSIG_SEND_PHASE_INIT: - ctx->flags = dsdp->dep->flags; - ctx->c_p = dsdp->proc; - - if (!ctx->c_p || dsdp->no_suspend) - ctx->force_busy = 1; - - ERTS_SMP_LC_ASSERT(!ctx->c_p - || (ERTS_PROC_LOCK_MAIN - == erts_proc_lc_my_proc_locks(ctx->c_p))); - - if (!erts_is_alive) - return ERTS_DSIG_SEND_OK; - - if (ctx->flags & DFLAG_DIST_HDR_ATOM_CACHE) { - ctx->acmp = erts_get_atom_cache_map(ctx->c_p); - ctx->pass_through_size = 0; - } - else { - ctx->acmp = NULL; - ctx->pass_through_size = 1; - } +#ifdef ERTS_DIST_MSG_DBG + erts_fprintf(stderr, ">>%s CTL: %T\n", pass_through_size ? "P" : " ", ctl); + if (is_value(msg)) + erts_fprintf(stderr, " MSG: %T\n", msg); +#endif + + data_size = pass_through_size; + erts_reset_atom_cache_map(acmp); + data_size += erts_encode_dist_ext_size(ctl, flags, acmp); + if (is_value(msg)) + data_size += erts_encode_dist_ext_size(msg, flags, acmp); + erts_finalize_atom_cache_map(acmp, flags); + + dhdr_ext_size = erts_encode_ext_dist_header_size(acmp); + data_size += dhdr_ext_size; + + obuf = alloc_dist_obuf(data_size); + obuf->ext_endp = &obuf->data[0] + pass_through_size + dhdr_ext_size; + + /* Encode internal version of dist header */ + obuf->extp = erts_encode_ext_dist_header_setup(obuf->ext_endp, acmp); + /* Encode control message */ + erts_encode_dist_ext(ctl, &obuf->ext_endp, flags, acmp); + if (is_value(msg)) { + /* Encode message */ + erts_encode_dist_ext(msg, &obuf->ext_endp, flags, acmp); + } + + ASSERT(obuf->extp < obuf->ext_endp); + ASSERT(&obuf->data[0] <= obuf->extp - pass_through_size); + ASSERT(obuf->ext_endp <= &obuf->data[0] + data_size); - #ifdef ERTS_DIST_MSG_DBG - erts_fprintf(stderr, ">>%s CTL: %T\n", ctx->pass_through_size ? "P" : " ", ctx->ctl); - if (is_value(ctx->msg)) - erts_fprintf(stderr, " MSG: %T\n", ctx->msg); - #endif - - ctx->data_size = ctx->pass_through_size; - erts_reset_atom_cache_map(ctx->acmp); - erts_encode_dist_ext_size(ctx->ctl, ctx->flags, ctx->acmp, &ctx->data_size); - - if (is_value(ctx->msg)) { - ctx->u.sc.wstack.wstart = NULL; - ctx->u.sc.flags = ctx->flags; - ctx->u.sc.level = 0; - ctx->phase = ERTS_DSIG_SEND_PHASE_MSG_SIZE; - } else { - ctx->phase = ERTS_DSIG_SEND_PHASE_ALLOC; - } - break; + data_size = obuf->ext_endp - obuf->extp; - case ERTS_DSIG_SEND_PHASE_MSG_SIZE: - if (erts_encode_dist_ext_size_int(ctx->msg, ctx, &ctx->data_size)) { - retval = ERTS_DSIG_SEND_CONTINUE; - goto done; - } - - ctx->phase = ERTS_DSIG_SEND_PHASE_ALLOC; - case ERTS_DSIG_SEND_PHASE_ALLOC: - erts_finalize_atom_cache_map(ctx->acmp, ctx->flags); - - ctx->dhdr_ext_size = erts_encode_ext_dist_header_size(ctx->acmp); - ctx->data_size += ctx->dhdr_ext_size; - - ctx->obuf = alloc_dist_obuf(ctx->data_size); - ctx->obuf->ext_endp = &ctx->obuf->data[0] + ctx->pass_through_size + ctx->dhdr_ext_size; - - /* Encode internal version of dist header */ - ctx->obuf->extp = erts_encode_ext_dist_header_setup(ctx->obuf->ext_endp, ctx->acmp); - /* Encode control message */ - erts_encode_dist_ext(ctx->ctl, &ctx->obuf->ext_endp, ctx->flags, ctx->acmp, NULL, NULL); - if (is_value(ctx->msg)) { - ctx->u.ec.flags = ctx->flags; - ctx->u.ec.level = 0; - ctx->u.ec.wstack.wstart = NULL; - ctx->phase = ERTS_DSIG_SEND_PHASE_MSG_ENCODE; - } else { - ctx->phase = ERTS_DSIG_SEND_PHASE_FIN; - } - break; + /* + * Signal encoded; now verify that the connection still exists, + * and if so enqueue the signal and schedule it for send. + */ + obuf->next = NULL; + erts_smp_de_rlock(dep); + cid = dep->cid; + if (cid != dsdp->cid + || dep->connection_id != dsdp->connection_id + || dep->status & ERTS_DE_SFLG_EXITING) { + /* Not the same connection as when we started; drop message... */ + erts_smp_de_runlock(dep); + free_dist_obuf(obuf); + } + else { + ErtsProcList *plp = NULL; + erts_smp_mtx_lock(&dep->qlock); + dep->qsize += size_obuf(obuf); + if (dep->qsize >= erts_dist_buf_busy_limit) + dep->qflgs |= ERTS_DE_QFLG_BUSY; + if (!force_busy && (dep->qflgs & ERTS_DE_QFLG_BUSY)) { + erts_smp_mtx_unlock(&dep->qlock); - case ERTS_DSIG_SEND_PHASE_MSG_ENCODE: - if (erts_encode_dist_ext(ctx->msg, &ctx->obuf->ext_endp, ctx->flags, ctx->acmp, &ctx->u.ec, &ctx->reds)) { - retval = ERTS_DSIG_SEND_CONTINUE; - goto done; - } - - ctx->phase = ERTS_DSIG_SEND_PHASE_FIN; - case ERTS_DSIG_SEND_PHASE_FIN: { - DistEntry *dep = dsdp->dep; - int suspended = 0; - int resume = 0; - - ASSERT(ctx->obuf->extp < ctx->obuf->ext_endp); - ASSERT(&ctx->obuf->data[0] <= ctx->obuf->extp - ctx->pass_through_size); - ASSERT(ctx->obuf->ext_endp <= &ctx->obuf->data[0] + ctx->data_size); + plp = erts_proclist_create(c_p); + erts_suspend(c_p, ERTS_PROC_LOCK_MAIN, NULL); + suspended = 1; + erts_smp_mtx_lock(&dep->qlock); + } - ctx->data_size = ctx->obuf->ext_endp - ctx->obuf->extp; + /* Enqueue obuf on dist entry */ + if (dep->out_queue.last) + dep->out_queue.last->next = obuf; + else + dep->out_queue.first = obuf; + dep->out_queue.last = obuf; - /* - * Signal encoded; now verify that the connection still exists, - * and if so enqueue the signal and schedule it for send. - */ - ctx->obuf->next = NULL; - erts_smp_de_rlock(dep); - cid = dep->cid; - if (cid != dsdp->cid - || dep->connection_id != dsdp->connection_id - || dep->status & ERTS_DE_SFLG_EXITING) { - /* Not the same connection as when we started; drop message... */ - erts_smp_de_runlock(dep); - free_dist_obuf(ctx->obuf); + if (!force_busy) { + if (!(dep->qflgs & ERTS_DE_QFLG_BUSY)) { + if (suspended) + resume = 1; /* was busy when we started, but isn't now */ +#ifdef USE_VM_PROBES + if (resume && DTRACE_ENABLED(dist_port_not_busy)) { + DTRACE_CHARBUF(port_str, 64); + DTRACE_CHARBUF(remote_str, 64); + + erts_snprintf(port_str, sizeof(DTRACE_CHARBUF_NAME(port_str)), + "%T", cid); + erts_snprintf(remote_str, sizeof(DTRACE_CHARBUF_NAME(remote_str)), + "%T", dep->sysname); + DTRACE3(dist_port_not_busy, erts_this_node_sysname, + port_str, remote_str); + } +#endif } else { - ErtsProcList *plp = NULL; - erts_smp_mtx_lock(&dep->qlock); - dep->qsize += size_obuf(ctx->obuf); - if (dep->qsize >= erts_dist_buf_busy_limit) - dep->qflgs |= ERTS_DE_QFLG_BUSY; - if (!ctx->force_busy && (dep->qflgs & ERTS_DE_QFLG_BUSY)) { - erts_smp_mtx_unlock(&dep->qlock); - - plp = erts_proclist_create(ctx->c_p); - erts_suspend(ctx->c_p, ERTS_PROC_LOCK_MAIN, NULL); - suspended = 1; - erts_smp_mtx_lock(&dep->qlock); - } - - /* Enqueue obuf on dist entry */ - if (dep->out_queue.last) - dep->out_queue.last->next = ctx->obuf; - else - dep->out_queue.first = ctx->obuf; - dep->out_queue.last = ctx->obuf; - - if (!ctx->force_busy) { - if (!(dep->qflgs & ERTS_DE_QFLG_BUSY)) { - if (suspended) - resume = 1; /* was busy when we started, but isn't now */ - #ifdef USE_VM_PROBES - if (resume && DTRACE_ENABLED(dist_port_not_busy)) { - DTRACE_CHARBUF(port_str, 64); - DTRACE_CHARBUF(remote_str, 64); - - erts_snprintf(port_str, sizeof(DTRACE_CHARBUF_NAME(port_str)), - "%T", cid); - erts_snprintf(remote_str, sizeof(DTRACE_CHARBUF_NAME(remote_str)), - "%T", dep->sysname); - DTRACE3(dist_port_not_busy, erts_this_node_sysname, - port_str, remote_str); - } - #endif - } - else { - /* Enqueue suspended process on dist entry */ - ASSERT(plp); - erts_proclist_store_last(&dep->suspended, plp); - } - } - - erts_smp_mtx_unlock(&dep->qlock); - erts_schedule_dist_command(NULL, dep); - erts_smp_de_runlock(dep); - - if (resume) { - erts_resume(ctx->c_p, ERTS_PROC_LOCK_MAIN); - erts_proclist_destroy(plp); - /* - * Note that the calling process still have to yield as if it - * suspended. If not, the calling process could later be - * erroneously scheduled when it shouldn't be. - */ - } - } - ctx->obuf = NULL; - - if (suspended) { - #ifdef USE_VM_PROBES - if (!resume && DTRACE_ENABLED(dist_port_busy)) { - DTRACE_CHARBUF(port_str, 64); - DTRACE_CHARBUF(remote_str, 64); - DTRACE_CHARBUF(pid_str, 16); - - erts_snprintf(port_str, sizeof(DTRACE_CHARBUF_NAME(port_str)), "%T", cid); - erts_snprintf(remote_str, sizeof(DTRACE_CHARBUF_NAME(remote_str)), - "%T", dep->sysname); - erts_snprintf(pid_str, sizeof(DTRACE_CHARBUF_NAME(pid_str)), - "%T", ctx->c_p->common.id); - DTRACE4(dist_port_busy, erts_this_node_sysname, - port_str, remote_str, pid_str); - } - #endif - if (!resume && erts_system_monitor_flags.busy_dist_port) - monitor_generic(ctx->c_p, am_busy_dist_port, cid); - retval = ERTS_DSIG_SEND_YIELD; - } else { - retval = ERTS_DSIG_SEND_OK; + /* Enqueue suspended process on dist entry */ + ASSERT(plp); + erts_proclist_store_last(&dep->suspended, plp); } - goto done; } - default: - erl_exit(ERTS_ABORT_EXIT, "dsig_send invalid phase (%d)\n", (int)ctx->phase); + + erts_smp_mtx_unlock(&dep->qlock); + erts_schedule_dist_command(NULL, dep); + erts_smp_de_runlock(dep); + + if (resume) { + erts_resume(c_p, ERTS_PROC_LOCK_MAIN); + erts_proclist_destroy(plp); + /* + * Note that the calling process still have to yield as if it + * suspended. If not, the calling process could later be + * erroneously scheduled when it shouldn't be. + */ } } -done: - if (ctx->msg && ctx->c_p) { - BUMP_REDS(ctx->c_p, (initial_reds - ctx->reds) / TERM_TO_BINARY_LOOP_FACTOR); + if (c_p) { + int reds; + /* + * Bump reductions on calling process. + * + * This is the reduction cost: Always a base cost of 8 reductions + * plus 16 reductions per kilobyte generated external data. + */ + + data_size >>= (10-4); +#if defined(ARCH_64) && !HALFWORD_HEAP + data_size &= 0x003fffffffffffff; +#elif defined(ARCH_32) || HALFWORD_HEAP + data_size &= 0x003fffff; +#else +# error "Ohh come on ... !?!" +#endif + reds = 8 + ((int) data_size > 1000000 ? 1000000 : (int) data_size); + BUMP_REDS(c_p, reds); + } + + if (suspended) { +#ifdef USE_VM_PROBES + if (!resume && DTRACE_ENABLED(dist_port_busy)) { + DTRACE_CHARBUF(port_str, 64); + DTRACE_CHARBUF(remote_str, 64); + DTRACE_CHARBUF(pid_str, 16); + + erts_snprintf(port_str, sizeof(DTRACE_CHARBUF_NAME(port_str)), "%T", cid); + erts_snprintf(remote_str, sizeof(DTRACE_CHARBUF_NAME(remote_str)), + "%T", dep->sysname); + erts_snprintf(pid_str, sizeof(DTRACE_CHARBUF_NAME(pid_str)), + "%T", c_p->common.id); + DTRACE4(dist_port_busy, erts_this_node_sysname, + port_str, remote_str, pid_str); + } +#endif + if (!resume && erts_system_monitor_flags.busy_dist_port) + monitor_generic(c_p, am_busy_dist_port, cid); + return ERTS_DSIG_SEND_YIELD; } - return retval; + return ERTS_DSIG_SEND_OK; } + static Uint dist_port_command(Port *prt, ErtsDistOutputBuf *obuf) { @@ -2090,7 +2001,6 @@ DistEntry *dep = prt->dist_entry; Uint (*send)(Port *prt, ErtsDistOutputBuf *obuf); erts_aint32_t sched_flags; - ErtsSchedulerData *esdp = erts_get_scheduler_data(); ERTS_SMP_LC_ASSERT(erts_lc_is_port_locked(prt)); @@ -2145,12 +2055,12 @@ ErtsDistOutputBuf *fob; size = (*send)(prt, foq.first); - esdp->io.out += (Uint64) size; #ifdef ERTS_RAW_DIST_MSG_DBG erts_fprintf(stderr, ">> "); bw(foq.first->extp, size); #endif reds += ERTS_PORT_REDS_DIST_CMD_DATA(size); + erts_smp_atomic_add_nob(&erts_bytes_out, size); fob = foq.first; obufsize += size_obuf(fob); foq.first = foq.first->next; @@ -2230,12 +2140,12 @@ ASSERT(&oq.first->data[0] <= oq.first->extp && oq.first->extp < oq.first->ext_endp); size = (*send)(prt, oq.first); - esdp->io.out += (Uint64) size; #ifdef ERTS_RAW_DIST_MSG_DBG erts_fprintf(stderr, ">> "); bw(oq.first->extp, size); #endif reds += ERTS_PORT_REDS_DIST_CMD_DATA(size); + erts_smp_atomic_add_nob(&erts_bytes_out, size); fob = oq.first; obufsize += size_obuf(fob); oq.first = oq.first->next; @@ -2527,7 +2437,7 @@ erts_print(to, arg, "Name: %T", dep->sysname); #ifdef DEBUG - erts_print(to, arg, " (refc=%d)", erts_refc_read(&dep->refc, 0)); + erts_print(to, arg, " (refc=%d)", erts_refc_read(&dep->refc, 1)); #endif erts_print(to, arg, "\n"); if (!connected && is_nil(dep->cid)) { @@ -2573,9 +2483,7 @@ } for (dep = erts_not_connected_dist_entries; dep; dep = dep->next) { - if (dep != erts_this_dist_entry) { - info_dist_entry(to, arg, dep, 0, 0); - } + info_dist_entry(to, arg, dep, 0, 0); } return(0); @@ -2653,8 +2561,13 @@ if (!net_kernel) goto error; - /* By setting F_DISTRIBUTION on net_kernel, - * do_net_exist will be called when net_kernel is terminated !! */ + /* By setting dist_entry==erts_this_dist_entry and DISTRIBUTION on + net_kernel do_net_exist will be called when net_kernel + is terminated !! */ + (void) ERTS_PROC_SET_DIST_ENTRY(net_kernel, + ERTS_PROC_LOCK_MAIN, + erts_this_dist_entry); + erts_refc_inc(&erts_this_dist_entry->refc, 2); net_kernel->flags |= F_DISTRIBUTION; if (net_kernel != BIF_P) @@ -3015,11 +2928,11 @@ erts_smp_rwmtx_rlock(&erts_dist_table_rwmtx); - ASSERT(erts_no_of_not_connected_dist_entries > 0); + ASSERT(erts_no_of_not_connected_dist_entries >= 0); ASSERT(erts_no_of_hidden_dist_entries >= 0); ASSERT(erts_no_of_visible_dist_entries >= 0); if(not_connected) - length += (erts_no_of_not_connected_dist_entries - 1); + length += erts_no_of_not_connected_dist_entries; if(hidden) length += erts_no_of_hidden_dist_entries; if(visible) @@ -3041,10 +2954,8 @@ #endif if(not_connected) for(dep = erts_not_connected_dist_entries; dep; dep = dep->next) { - if (dep != erts_this_dist_entry) { - result = CONS(hp, dep->sysname, result); - hp += 2; - } + result = CONS(hp, dep->sysname, result); + hp += 2; } if(hidden) for(dep = erts_hidden_dist_entries; dep; dep = dep->next) { @@ -3325,7 +3236,11 @@ } ASSERT(hend == hp); - erts_queue_message(rp, rp_locksp, bp, msg, NIL); + erts_queue_message(rp, rp_locksp, bp, msg, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); } static void diff -Nru erlang-18.2-dfsg/erts/emulator/beam/dist.h erlang-17.3-dfsg/erts/emulator/beam/dist.h --- erlang-18.2-dfsg/erts/emulator/beam/dist.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/dist.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -23,7 +22,6 @@ #include "erl_process.h" #include "erl_node_tables.h" -#include "zlib.h" #define DFLAG_PUBLISHED 0x01 #define DFLAG_ATOM_CACHE 0x02 @@ -266,105 +264,17 @@ #endif - - -/* Define for testing */ -/* #define EXTREME_TTB_TRAPPING 1 */ - -#ifndef EXTREME_TTB_TRAPPING -#define TERM_TO_BINARY_LOOP_FACTOR 32 -#else -#define TERM_TO_BINARY_LOOP_FACTOR 1 -#endif - -typedef enum { TTBSize, TTBEncode, TTBCompress } TTBState; -typedef struct TTBSizeContext_ { - Uint flags; - int level; - Uint result; - Eterm obj; - ErtsWStack wstack; -} TTBSizeContext; - -typedef struct TTBEncodeContext_ { - Uint flags; - int level; - byte* ep; - Eterm obj; - ErtsWStack wstack; - Binary *result_bin; -} TTBEncodeContext; - -typedef struct { - Uint real_size; - Uint dest_len; - byte *dbytes; - Binary *result_bin; - Binary *destination_bin; - z_stream stream; -} TTBCompressContext; - -typedef struct { - int alive; - TTBState state; - union { - TTBSizeContext sc; - TTBEncodeContext ec; - TTBCompressContext cc; - } s; -} TTBContext; - -enum erts_dsig_send_phase { - ERTS_DSIG_SEND_PHASE_INIT, - ERTS_DSIG_SEND_PHASE_MSG_SIZE, - ERTS_DSIG_SEND_PHASE_ALLOC, - ERTS_DSIG_SEND_PHASE_MSG_ENCODE, - ERTS_DSIG_SEND_PHASE_FIN -}; - -struct erts_dsig_send_context { - enum erts_dsig_send_phase phase; - Sint reds; - - Eterm ctl; - Eterm msg; - int force_busy; - Uint32 pass_through_size; - Uint data_size, dhdr_ext_size; - ErtsAtomCacheMap *acmp; - ErtsDistOutputBuf *obuf; - Uint32 flags; - Process *c_p; - union { - TTBSizeContext sc; - TTBEncodeContext ec; - }u; -}; - -typedef struct { - int suspend; - - Eterm ctl_heap[6]; - ErtsDSigData dsd; - DistEntry* dep_to_deref; - struct erts_dsig_send_context dss; - - Eterm return_term; -}ErtsSendContext; - - /* * erts_dsig_send_* return values. */ #define ERTS_DSIG_SEND_OK 0 #define ERTS_DSIG_SEND_YIELD 1 -#define ERTS_DSIG_SEND_CONTINUE 2 extern int erts_dsig_send_link(ErtsDSigData *, Eterm, Eterm); -extern int erts_dsig_send_msg(Eterm, Eterm, ErtsSendContext*); +extern int erts_dsig_send_msg(ErtsDSigData *, Eterm, Eterm); extern int erts_dsig_send_exit_tt(ErtsDSigData *, Eterm, Eterm, Eterm, Eterm); extern int erts_dsig_send_unlink(ErtsDSigData *, Eterm, Eterm); -extern int erts_dsig_send_reg_msg(Eterm, Eterm, ErtsSendContext*); +extern int erts_dsig_send_reg_msg(ErtsDSigData *, Eterm, Eterm); extern int erts_dsig_send_group_leader(ErtsDSigData *, Eterm, Eterm); extern int erts_dsig_send_exit(ErtsDSigData *, Eterm, Eterm, Eterm); extern int erts_dsig_send_exit2(ErtsDSigData *, Eterm, Eterm, Eterm); @@ -372,10 +282,6 @@ extern int erts_dsig_send_monitor(ErtsDSigData *, Eterm, Eterm, Eterm); extern int erts_dsig_send_m_exit(ErtsDSigData *, Eterm, Eterm, Eterm, Eterm); -extern int erts_dsig_send(ErtsDSigData *dsdp, struct erts_dsig_send_context* ctx); -extern void erts_dsend_context_dtor(Binary*); -extern Eterm erts_dsend_export_trap_context(Process* p, ErtsSendContext* ctx); - extern int erts_dist_command(Port *prt, int reds); extern void erts_dist_port_not_busy(Port *prt); extern void erts_kill_dist_connection(DistEntry *dep, Uint32); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/dtrace-wrapper.h erlang-17.3-dfsg/erts/emulator/beam/dtrace-wrapper.h --- erlang-18.2-dfsg/erts/emulator/beam/dtrace-wrapper.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/dtrace-wrapper.h 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * Copyright Dustin Sallings, Michal Ptaszek, Scott Lystig Fritchie 2011-2012. * All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/elib_memmove.c erlang-17.3-dfsg/erts/emulator/beam/elib_memmove.c --- erlang-18.2-dfsg/erts/emulator/beam/elib_memmove.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/elib_memmove.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_afit_alloc.c erlang-17.3-dfsg/erts/emulator/beam/erl_afit_alloc.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_afit_alloc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_afit_alloc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_afit_alloc.h erlang-17.3-dfsg/erts/emulator/beam/erl_afit_alloc.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_afit_alloc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_afit_alloc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_alloc.c erlang-17.3-dfsg/erts/emulator/beam/erl_alloc.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_alloc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_alloc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -40,7 +39,7 @@ #include "erl_instrument.h" #include "erl_mseg.h" #include "erl_monitors.h" -#include "erl_hl_timer.h" +#include "erl_bif_timer.h" #include "erl_cpu_topology.h" #include "erl_thr_queue.h" #if defined(ERTS_ALC_T_DRV_SEL_D_STATE) || defined(ERTS_ALC_T_DRV_EV_D_STATE) @@ -134,7 +133,6 @@ static ErtsAllocatorState_t ets_alloc_state; static ErtsAllocatorState_t driver_alloc_state; static ErtsAllocatorState_t fix_alloc_state; -static ErtsAllocatorState_t test_alloc_state; typedef struct { erts_smp_atomic32_t refc; @@ -234,7 +232,6 @@ struct au_init std_low_alloc; struct au_init ll_low_alloc; #endif - struct au_init test_alloc; } erts_alc_hndl_args_init_t; #define ERTS_AU_INIT__ {0, 0, 1, GOODFIT, DEFAULT_ALLCTR_INIT, {1,1,1,1}} @@ -434,33 +431,6 @@ ip->init.util.acul = ERTS_ALC_DEFAULT_ACUL; } -static void -set_default_test_alloc_opts(struct au_init *ip) -{ - SET_DEFAULT_ALLOC_OPTS(ip); - ip->enable = 0; /* Disabled by default */ - ip->thr_spec = -1 * erts_no_schedulers; - ip->atype = AOFIRSTFIT; - ip->init.aoff.flavor = AOFF_BF; - ip->init.util.name_prefix = "test_"; - ip->init.util.alloc_no = ERTS_ALC_A_TEST; - ip->init.util.mmbcs = 0; /* Main carrier size */ - ip->init.util.ts = ERTS_ALC_MTA_TEST; - ip->init.util.acul = ERTS_ALC_DEFAULT_ACUL; - - /* Use a constant minimal MBC size */ -#if ERTS_SA_MB_CARRIERS - ip->init.util.smbcs = ERTS_SACRR_UNIT_SZ; - ip->init.util.lmbcs = ERTS_SACRR_UNIT_SZ; - ip->init.util.sbct = ERTS_SACRR_UNIT_SZ; -#else - ip->init.util.smbcs = 1 << 12; - ip->init.util.lmbcs = 1 << 12; - ip->init.util.sbct = 1 << 12; -#endif -} - - #ifdef ERTS_SMP static void @@ -605,17 +575,6 @@ fix_type_sizes[ERTS_ALC_FIX_TYPE_IX(ERTS_ALC_T_THR_Q_EL_SL)] = sizeof(ErtsThrQElement_t); #endif - fix_type_sizes[ERTS_ALC_FIX_TYPE_IX(ERTS_ALC_T_LL_PTIMER)] - = erts_timer_type_size(ERTS_ALC_T_LL_PTIMER); - fix_type_sizes[ERTS_ALC_FIX_TYPE_IX(ERTS_ALC_T_HL_PTIMER)] - = erts_timer_type_size(ERTS_ALC_T_HL_PTIMER); - fix_type_sizes[ERTS_ALC_FIX_TYPE_IX(ERTS_ALC_T_BIF_TIMER)] - = erts_timer_type_size(ERTS_ALC_T_BIF_TIMER); -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - fix_type_sizes[ERTS_ALC_FIX_TYPE_IX(ERTS_ALC_T_ABIF_TIMER)] - = erts_timer_type_size(ERTS_ALC_T_ABIF_TIMER); -#endif - #ifdef HARD_DEBUG hdbg_init(); #endif @@ -642,7 +601,6 @@ set_default_driver_alloc_opts(&init.driver_alloc); set_default_fix_alloc_opts(&init.fix_alloc, fix_type_sizes); - set_default_test_alloc_opts(&init.test_alloc); if (argc && argv) handle_args(argc, argv, &init); @@ -802,7 +760,6 @@ set_au_allocator(ERTS_ALC_A_ETS, &init.ets_alloc, ncpu); set_au_allocator(ERTS_ALC_A_DRIVER, &init.driver_alloc, ncpu); set_au_allocator(ERTS_ALC_A_FIXED_SIZE, &init.fix_alloc, ncpu); - set_au_allocator(ERTS_ALC_A_TEST, &init.test_alloc, ncpu); for (i = ERTS_ALC_A_MIN; i <= ERTS_ALC_A_MAX; i++) { if (!erts_allctrs[i].alloc) @@ -864,10 +821,6 @@ &init.fix_alloc, &fix_alloc_state); - start_au_allocator(ERTS_ALC_A_TEST, - &init.test_alloc, - &test_alloc_state); - erts_mtrace_install_wrapper_functions(); extra_block_size += erts_instr_init(init.instr.stat, init.instr.map); @@ -1453,7 +1406,6 @@ &init->fix_alloc, &init->sl_alloc, &init->temp_alloc - /* test_alloc not affected by +Mea??? or +Mu??? */ }; int aui_sz = (int) sizeof(aui)/sizeof(aui[0]); char *arg; @@ -1544,9 +1496,6 @@ case 'T': handle_au_arg(&init->temp_alloc, &argv[i][3], argv, &i, 0); break; - case 'Z': - handle_au_arg(&init->test_alloc, &argv[i][3], argv, &i, 0); - break; case 'Y': { /* sys_alloc */ if (has_prefix("tt", param+2)) { /* set trim threshold */ @@ -1924,8 +1873,8 @@ size = va_arg(argp, Uint); va_end(argp); erl_exit(1, - "%s: Cannot %s %lu bytes of memory (of type \"%s\").\n", - allctr_str, op, size, t_str); + "%s: Cannot %s %lu bytes of memory (of type \"%s\", thread %d).\n", + allctr_str, op, size, t_str, ERTS_ALC_GET_THR_IX()); break; } case ERTS_ALC_E_NOALLCTR: @@ -2261,12 +2210,11 @@ return am_badarg; } - /* All alloc_util allocators *have* to be enabled, except test_alloc */ + /* All alloc_util allocators *have* to be enabled */ for (ai = ERTS_ALC_A_MIN; ai <= ERTS_ALC_A_MAX; ai++) { switch (ai) { case ERTS_ALC_A_SYSTEM: - case ERTS_ALC_A_TEST: break; default: if (!erts_allctrs_info[ai].enabled @@ -2307,8 +2255,6 @@ * contain any allocated memory. */ continue; - case ERTS_ALC_A_TEST: - continue; case ERTS_ALC_A_EHEAP: save = &size.processes; break; @@ -2376,24 +2322,6 @@ &size.processes_used, fi, ERTS_ALC_T_MSG_REF); - add_fix_values(&size.processes, - &size.processes_used, - fi, - ERTS_ALC_T_LL_PTIMER); - add_fix_values(&size.processes, - &size.processes_used, - fi, - ERTS_ALC_T_HL_PTIMER); - add_fix_values(&size.processes, - &size.processes_used, - fi, - ERTS_ALC_T_BIF_TIMER); -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - add_fix_values(&size.processes, - &size.processes_used, - fi, - ERTS_ALC_T_ABIF_TIMER); -#endif } if (want.atom || want.atom_used) { @@ -2717,17 +2645,14 @@ /* * Currently all allocators except sys_alloc are * alloc_util allocators. - * Also hide test_alloc which is disabled by default - * and only intended for our own testing. */ - sz = ((ERTS_ALC_A_MAX + 1 - ERTS_ALC_A_MIN) - 2)*2; + sz = ((ERTS_ALC_A_MAX + 1 - ERTS_ALC_A_MIN) - 1)*2; ASSERT(sz > 0); hp = HAlloc((Process *) proc, sz); res = NIL; for (i = ERTS_ALC_A_MAX; i >= ERTS_ALC_A_MIN; i--) { switch (i) { case ERTS_ALC_A_SYSTEM: - case ERTS_ALC_A_TEST: break; default: { char *alc_str = (char *) ERTS_ALC_A2AD(i); @@ -3255,13 +3180,17 @@ HRelease(rp, hp_end, hp); } - erts_queue_message(rp, &rp_locks, bp, msg, NIL); + erts_queue_message(rp, &rp_locks, bp, msg, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); if (air->req_sched == sched_id) rp_locks &= ~ERTS_PROC_LOCK_MAIN; erts_smp_proc_unlock(rp, rp_locks); - erts_proc_dec_refc(rp); + erts_smp_proc_dec_refc(rp); if (erts_smp_atomic32_dec_read_nob(&air->refc) == 0) aireq_free(air); @@ -3335,7 +3264,7 @@ erts_smp_atomic32_init_nob(&air->refc, (erts_aint32_t) erts_no_schedulers); - erts_proc_add_refc(c_p, (Sint) erts_no_schedulers); + erts_smp_proc_add_refc(c_p, (Sint32) erts_no_schedulers); #ifdef ERTS_SMP if (erts_no_schedulers > 1) @@ -3611,41 +3540,6 @@ #else case 0xf13: return (UWord) 0; #endif - case 0xf14: return (UWord) erts_alloc(ERTS_ALC_T_TEST, (Uint)a1); - - case 0xf15: erts_free(ERTS_ALC_T_TEST, (void*)a1); return 0; - - case 0xf16: { - Uint extra_hdr_sz = UNIT_CEILING((Uint)a1); - ErtsAllocatorThrSpec_t* ts = &erts_allctr_thr_spec[ERTS_ALC_A_TEST]; - Uint offset = ts->allctr[0]->mbc_header_size; - void* orig_creating_mbc = ts->allctr[0]->creating_mbc; - void* orig_destroying_mbc = ts->allctr[0]->destroying_mbc; - void* new_creating_mbc = *(void**)a2; /* inout arg */ - void* new_destroying_mbc = *(void**)a3; /* inout arg */ - int i; - - for (i=0; i < ts->size; i++) { - Allctr_t* ap = ts->allctr[i]; - if (ap->mbc_header_size != offset - || ap->creating_mbc != orig_creating_mbc - || ap->destroying_mbc != orig_destroying_mbc - || ap->mbc_list.first != NULL) - return -1; - } - for (i=0; i < ts->size; i++) { - ts->allctr[i]->mbc_header_size += extra_hdr_sz; - ts->allctr[i]->creating_mbc = new_creating_mbc; - ts->allctr[i]->destroying_mbc = new_destroying_mbc; - } - *(void**)a2 = orig_creating_mbc; - *(void**)a3 = orig_destroying_mbc; - return offset; - } - case 0xf17: { - ErtsAllocatorThrSpec_t* ts = &erts_allctr_thr_spec[ERTS_ALC_A_TEST]; - return ts->allctr[0]->largest_mbc_size; - } default: break; } @@ -4045,7 +3939,7 @@ install_debug_functions(void) { int i; - ERTS_CT_ASSERT(sizeof(erts_allctrs) == sizeof(real_allctrs)); + ASSERT(sizeof(erts_allctrs) == sizeof(real_allctrs)); sys_memcpy((void *)real_allctrs,(void *)erts_allctrs,sizeof(erts_allctrs)); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_alloc.h erlang-17.3-dfsg/erts/emulator/beam/erl_alloc.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_alloc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_alloc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_alloc.types erlang-17.3-dfsg/erts/emulator/beam/erl_alloc.types --- erlang-18.2-dfsg/erts/emulator/beam/erl_alloc.types 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_alloc.types 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2003-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -112,7 +111,7 @@ allocator BINARY true binary_alloc allocator DRIVER true driver_alloc -allocator TEST true test_alloc + # --- Class declarations ----------------------------------------------------- # @@ -164,13 +163,9 @@ type ROOTSET TEMPORARY PROCESSES root_set type LOADER_TMP TEMPORARY CODE loader_tmp type PREPARED_CODE SHORT_LIVED CODE prepared_code -type TIMER_SERVICE LONG_LIVED SYSTEM timer_service -type LL_PTIMER FIXED_SIZE PROCESSES ll_ptimer -type HL_PTIMER FIXED_SIZE PROCESSES hl_ptimer -type BIF_TIMER FIXED_SIZE PROCESSES bif_timer -# type ABIF_TIMER FIXED_SIZE PROCESSES accessor_bif_timer -type TIMER_REQUEST SHORT_LIVED PROCESSES timer_request -type BTM_YIELD_STATE SHORT_LIVED PROCESSES btm_yield_state +type BIF_TIMER_TABLE LONG_LIVED SYSTEM bif_timer_table +type SL_BIF_TIMER SHORT_LIVED PROCESSES bif_timer_sl +type LL_BIF_TIMER STANDARD PROCESSES bif_timer_ll type REG_TABLE STANDARD SYSTEM reg_tab type FUN_TABLE STANDARD CODE fun_tab type DIST_TABLE STANDARD SYSTEM dist_tab @@ -272,10 +267,9 @@ type PROC_INTERVAL LONG_LIVED SYSTEM process_interval type BUSY_CALLER_TAB SHORT_LIVED SYSTEM busy_caller_table type BUSY_CALLER SHORT_LIVED SYSTEM busy_caller +type PORT_DATA_HEAP STANDARD SYSTEM port_data_heap type PROC_SYS_TSK SHORT_LIVED PROCESSES proc_sys_task type PROC_SYS_TSK_QS SHORT_LIVED PROCESSES proc_sys_task_queues -type NEW_TIME_OFFSET SHORT_LIVED SYSTEM new_time_offset -type IOB_REQ SHORT_LIVED SYSTEM io_bytes_request +if threads_no_smp # Need thread safe allocs, but std_alloc and fix_alloc are not; @@ -330,6 +324,8 @@ +endif +if smp +type SL_PTIMER SHORT_LIVED SYSTEM ptimer_sl +type LL_PTIMER STANDARD SYSTEM ptimer_ll type SYS_MSG_Q SHORT_LIVED PROCESSES system_messages_queue type FP_EXCEPTION LONG_LIVED SYSTEM fp_exception type LL_MPATHS LONG_LIVED SYSTEM ll_migration_paths @@ -368,7 +364,6 @@ type AINFO_REQ STANDARD_LOW SYSTEM alloc_info_request type SCHED_WTIME_REQ STANDARD_LOW SYSTEM sched_wall_time_request type GC_INFO_REQ STANDARD_LOW SYSTEM gc_info_request -type PORT_DATA_HEAP STANDARD_LOW SYSTEM port_data_heap +else # "fullword" @@ -388,7 +383,6 @@ type AINFO_REQ SHORT_LIVED SYSTEM alloc_info_request type SCHED_WTIME_REQ SHORT_LIVED SYSTEM sched_wall_time_request type GC_INFO_REQ SHORT_LIVED SYSTEM gc_info_request -type PORT_DATA_HEAP STANDARD SYSTEM port_data_heap +endif @@ -403,7 +397,6 @@ type DRV_EV_D_STATE FIXED_SIZE SYSTEM driver_event_data_state type DRV_SEL_D_STATE FIXED_SIZE SYSTEM driver_select_data_state type FD_LIST SHORT_LIVED SYSTEM fd_list -type ACTIVE_FD_ARR SHORT_LIVED SYSTEM active_fd_array type POLLSET LONG_LIVED SYSTEM pollset type POLLSET_UPDREQ SHORT_LIVED SYSTEM pollset_update_req type POLL_FDS LONG_LIVED SYSTEM poll_fds @@ -420,13 +413,6 @@ type ENVIRONMENT TEMPORARY SYSTEM environment type PUTENV_STR SYSTEM SYSTEM putenv_string type PRT_REP_EXIT STANDARD SYSTEM port_report_exit -type SYS_BLOCKING STANDARD SYSTEM sys_blocking - -+if smp -type SYS_WRITE_BUF TEMPORARY SYSTEM sys_write_buf -+else -type SYS_WRITE_BUF BINARY SYSTEM sys_write_buf -+endif +endif @@ -456,7 +442,4 @@ +endif -# This type should only be used for test -type TEST TEST SYSTEM testing - # ---------------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_alloc_util.c erlang-17.3-dfsg/erts/emulator/beam/erl_alloc_util.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_alloc_util.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_alloc_util.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -206,7 +205,7 @@ ASSERT(((UWord)(F) & (~FLG_MASK|THIS_FREE_BLK_HDR_FLG|PREV_FREE_BLK_HDR_FLG)) == THIS_FREE_BLK_HDR_FLG), \ (B)->bhdr = ((Sz) | (F)), \ (B)->u.carrier = (C)) - + # define IS_MBC_FIRST_ABLK(AP,B) \ ((((UWord)(B) & ~ERTS_SACRR_UNIT_MASK) == MBC_HEADER_SIZE(AP)) \ && ((B)->bhdr & MBC_ABLK_OFFSET_MASK) == 0) @@ -379,8 +378,9 @@ #ifdef ERTS_SMP #define SBC_HEADER_SIZE \ - (UNIT_CEILING(offsetof(Carrier_t, cpool) \ - + ABLK_HDR_SZ) \ + (UNIT_CEILING(sizeof(Carrier_t) \ + - sizeof(ErtsAlcCPoolData_t) \ + + ABLK_HDR_SZ) \ - ABLK_HDR_SZ) #else #define SBC_HEADER_SIZE \ @@ -719,7 +719,7 @@ static Block_t *create_carrier(Allctr_t *, Uint, UWord); static void destroy_carrier(Allctr_t *, Block_t *, Carrier_t **); static void mbc_free(Allctr_t *allctr, void *p, Carrier_t **busy_pcrr_pp); -static void dealloc_block(Allctr_t *, void *, ErtsAlcFixList_t *, int); +static void dealloc_block(Allctr_t *, void *, int); /* internal data... */ @@ -929,88 +929,6 @@ #ifdef ERTS_SMP -#ifdef DEBUG -static int is_in_list(ErtsDoubleLink_t* sentinel, ErtsDoubleLink_t* node) -{ - ErtsDoubleLink_t* p; - - ASSERT(node != sentinel); - for (p = sentinel->next; p != sentinel; p = p->next) { - if (p == node) - return 1; - } - return 0; -} -#endif /* DEBUG */ - -static ERTS_INLINE void -link_edl_after(ErtsDoubleLink_t* after_me, ErtsDoubleLink_t* node) -{ - ErtsDoubleLink_t* before_me = after_me->next; - ASSERT(node != after_me && node != before_me); - node->next = before_me; - node->prev = after_me; - before_me->prev = node; - after_me->next = node; -} - -static ERTS_INLINE void -link_edl_before(ErtsDoubleLink_t* before_me, ErtsDoubleLink_t* node) -{ - ErtsDoubleLink_t* after_me = before_me->prev; - ASSERT(node != before_me && node != after_me); - node->next = before_me; - node->prev = after_me; - before_me->prev = node; - after_me->next = node; -} - -static ERTS_INLINE void -unlink_edl(ErtsDoubleLink_t* node) -{ - node->next->prev = node->prev; - node->prev->next = node->next; -} - -static ERTS_INLINE void -relink_edl_before(ErtsDoubleLink_t* before_me, ErtsDoubleLink_t* node) -{ - if (node != before_me && node != before_me->prev) { - unlink_edl(node); - link_edl_before(before_me, node); - } -} - -static ERTS_INLINE int is_abandoned(Carrier_t *crr) -{ - return crr->cpool.abandoned.next != NULL; -} - -static ERTS_INLINE void -link_abandoned_carrier(ErtsDoubleLink_t* list, Carrier_t *crr) -{ - ASSERT(!is_abandoned(crr)); - - link_edl_after(list, &crr->cpool.abandoned); - - ASSERT(crr->cpool.abandoned.next != &crr->cpool.abandoned); - ASSERT(crr->cpool.abandoned.prev != &crr->cpool.abandoned); -} - -static ERTS_INLINE void -unlink_abandoned_carrier(Carrier_t *crr) -{ - ASSERT(is_in_list(&crr->cpool.orig_allctr->cpool.pooled_list, - &crr->cpool.abandoned) || - is_in_list(&crr->cpool.orig_allctr->cpool.traitor_list, - &crr->cpool.abandoned)); - - unlink_edl(&crr->cpool.abandoned); - - crr->cpool.abandoned.next = NULL; - crr->cpool.abandoned.prev = NULL; -} - static ERTS_INLINE void clear_busy_pool_carrier(Allctr_t *allctr, Carrier_t *crr) { @@ -1037,7 +955,7 @@ } } -#endif /* ERTS_SMP */ +#endif #if 0 #define ERTS_DBG_CHK_FIX_LIST(A, FIX, IX, B) \ @@ -1068,21 +986,17 @@ } ErtsAllctrFixDDBlock_t; #endif -#define ERTS_ALC_FIX_NO_UNUSE (((ErtsAlcType_t) 1) << ERTS_ALC_N_BITS) - static ERTS_INLINE void dealloc_fix_block(Allctr_t *allctr, ErtsAlcType_t type, void *ptr, - ErtsAlcFixList_t *fix, int dec_cc_on_redirect) { #ifdef ERTS_SMP /* May be redirected... */ - ASSERT((type & ERTS_ALC_FIX_NO_UNUSE) == 0); - ((ErtsAllctrFixDDBlock_t *) ptr)->fix_type = type | ERTS_ALC_FIX_NO_UNUSE; + ((ErtsAllctrFixDDBlock_t *) ptr)->fix_type = type; #endif - dealloc_block(allctr, ptr, fix, dec_cc_on_redirect); + dealloc_block(allctr, ptr, dec_cc_on_redirect); } static ERTS_INLINE void @@ -1128,7 +1042,8 @@ if (fix->u.cpool.min_list_size > fix->list_size) fix->u.cpool.min_list_size = fix->list_size; - dealloc_fix_block(allctr, type, p, fix, 0); + fix->u.cpool.allocated--; + dealloc_fix_block(allctr, type, p, 0); } } } @@ -1174,8 +1089,7 @@ fix_cpool_free(Allctr_t *allctr, ErtsAlcType_t type, void *p, - Carrier_t **busy_pcrr_pp, - int unuse) + Carrier_t **busy_pcrr_pp) { ErtsAlcFixList_t *fix; @@ -1183,9 +1097,8 @@ && type <= ERTS_ALC_N_MAX_A_FIXED_SIZE); fix = &allctr->fix[type - ERTS_ALC_N_MIN_A_FIXED_SIZE]; - - if (unuse) - fix->u.cpool.used--; + + fix->u.cpool.used--; if ((!busy_pcrr_pp || !*busy_pcrr_pp) && !fix->u.cpool.shrink_list @@ -1243,7 +1156,8 @@ fix->list = *((void **) ptr); fix->list_size--; fix->u.cpool.shrink_list--; - dealloc_fix_block(allctr, type, ptr, fix, 0); + fix->u.cpool.allocated--; + dealloc_fix_block(allctr, type, ptr, 0); } if (fix->u.cpool.min_list_size > fix->list_size) fix->u.cpool.min_list_size = fix->list_size; @@ -1404,7 +1318,7 @@ ptr = fix->list; fix->list = *((void **) ptr); fix->list_size--; - dealloc_block(allctr, ptr, NULL, 0); + dealloc_block(allctr, ptr, 0); fix->u.nocpool.allocated--; } if (fix->list_size != 0) { @@ -1437,16 +1351,6 @@ static void dealloc_carrier(Allctr_t *allctr, Carrier_t *crr, int superaligned); -static ERTS_INLINE void -dealloc_mbc(Allctr_t *allctr, Carrier_t *crr) -{ - ASSERT(IS_MB_CARRIER(crr)); - if (allctr->destroying_mbc) - allctr->destroying_mbc(allctr, crr); - - dealloc_carrier(allctr, crr, 1); -} - #ifdef ERTS_SMP static ERTS_INLINE Allctr_t* @@ -1457,7 +1361,7 @@ pref_ix = ERTS_ALC_GET_THR_IX(); - ERTS_CT_ASSERT(sizeof(UWord) == sizeof(Allctr_t *)); + ASSERT(sizeof(UWord) == sizeof(Allctr_t *)); ASSERT(0 <= pref_ix && pref_ix < tspec->size); return tspec->allctr[pref_ix]; @@ -1761,13 +1665,11 @@ type = ((ErtsAllctrFixDDBlock_t *) ptr)->fix_type; - ASSERT(ERTS_ALC_N_MIN_A_FIXED_SIZE - <= (type & ~ERTS_ALC_FIX_NO_UNUSE)); - ASSERT((type & ~ERTS_ALC_FIX_NO_UNUSE) - <= ERTS_ALC_N_MAX_A_FIXED_SIZE); + ASSERT(ERTS_ALC_N_MIN_A_FIXED_SIZE <= type + && type <= ERTS_ALC_N_MAX_A_FIXED_SIZE); if (!ERTS_ALC_IS_CPOOL_ENABLED(allctr)) - fix_nocpool_free(allctr, (type & ~ERTS_ALC_FIX_NO_UNUSE), ptr); + fix_nocpool_free(allctr, type, ptr); else { Block_t *blk = UMEM2BLK(ptr); Carrier_t *busy_pcrr_p; @@ -1782,9 +1684,7 @@ NULL, &busy_pcrr_p); if (used_allctr == allctr) { doit: - fix_cpool_free(allctr, (type & ~ERTS_ALC_FIX_NO_UNUSE), - ptr, &busy_pcrr_p, - !(type & ERTS_ALC_FIX_NO_UNUSE)); + fix_cpool_free(allctr, type, ptr, &busy_pcrr_p); clear_busy_pool_carrier(allctr, busy_pcrr_p); } else { @@ -1875,18 +1775,6 @@ * data has been overwritten by the queue. */ Carrier_t *crr = FIRST_BLK_TO_MBC(allctr, blk); - - /* Restore word overwritten by the dd-queue as it will be read - * if this carrier is pulled from dc_list by cpool_fetch() - */ - ERTS_ALC_CPOOL_ASSERT(FBLK_TO_MBC(blk) != crr); - ERTS_CT_ASSERT(sizeof(ErtsAllctrDDBlock_t) == sizeof(void*)); -#ifdef MBC_ABLK_OFFSET_BITS - blk->u.carrier = crr; -#else - blk->carrier = crr; -#endif - ERTS_ALC_CPOOL_ASSERT(ERTS_ALC_IS_CPOOL_ENABLED(allctr)); ERTS_ALC_CPOOL_ASSERT(allctr == crr->cpool.orig_allctr); ERTS_ALC_CPOOL_ASSERT(((erts_aint_t) allctr) @@ -1904,7 +1792,7 @@ if (fix) handle_delayed_fix_dealloc(allctr, ptr); else - dealloc_block(allctr, ptr, NULL, 1); + dealloc_block(allctr, ptr, 1); } } @@ -2010,24 +1898,15 @@ ERTS_ALCU_DD_OPS_LIM_LOW, NULL, NULL, NULL) static void -dealloc_block(Allctr_t *allctr, void *ptr, ErtsAlcFixList_t *fix, int dec_cc_on_redirect) +dealloc_block(Allctr_t *allctr, void *ptr, int dec_cc_on_redirect) { Block_t *blk = UMEM2BLK(ptr); ERTS_SMP_LC_ASSERT(!allctr->thread_safe || erts_lc_mtx_is_locked(&allctr->mutex)); - if (IS_SBC_BLK(blk)) { + if (IS_SBC_BLK(blk)) destroy_carrier(allctr, blk, NULL); -#ifdef ERTS_SMP - if (fix && ERTS_ALC_IS_CPOOL_ENABLED(allctr)) { - ErtsAlcType_t type = ((ErtsAllctrFixDDBlock_t *) ptr)->fix_type; - if (!(type & ERTS_ALC_FIX_NO_UNUSE)) - fix->u.cpool.used--; - fix->u.cpool.allocated--; - } -#endif - } #ifndef ERTS_SMP else mbc_free(allctr, ptr, NULL); @@ -2040,12 +1919,6 @@ used_allctr = get_used_allctr(allctr, ERTS_ALC_TS_PREF_LOCK_NO, ptr, NULL, &busy_pcrr_p); if (used_allctr == allctr) { - if (fix) { - ErtsAlcType_t type = ((ErtsAllctrFixDDBlock_t *) ptr)->fix_type; - if (!(type & ERTS_ALC_FIX_NO_UNUSE)) - fix->u.cpool.used--; - fix->u.cpool.allocated--; - } mbc_free(allctr, ptr, &busy_pcrr_p); clear_busy_pool_carrier(allctr, busy_pcrr_p); } @@ -2690,9 +2563,10 @@ #ifdef ERTS_SMP #define ERTS_ALC_MAX_DEALLOC_CARRIER 10 -#define ERTS_ALC_CPOOL_MAX_FETCH_INSPECT 20 -#define ERTS_ALC_CPOOL_MAX_TRAITOR_INSPECT 10 +#define ERTS_ALC_CPOOL_MAX_FETCH_INSPECT 10 #define ERTS_ALC_CPOOL_CHECK_LIMIT_COUNT 100 +#define ERTS_ALC_CPOOL_MAX_NO_CARRIERS 5 +#define ERTS_ALC_CPOOL_INSERT_ALLOWED_OFFSET 100 #define ERTS_ALC_CPOOL_MAX_FAILED_STAT_READS 3 #define ERTS_ALC_CPOOL_PTR_MOD_MRK (((erts_aint_t) 1) << 0) @@ -2869,6 +2743,9 @@ (erts_aint_t) CARRIER_SZ(crr)); erts_atomic_inc_nob(&allctr->cpool.stat.no_carriers); + erts_smp_atomic_set_nob(&crr->allctr, + ((erts_aint_t) allctr)|ERTS_CRR_ALCTR_FLG_IN_POOL); + /* * We search in 'next' direction and begin by passing * one element before trying to insert. This in order to @@ -2927,9 +2804,6 @@ cpool_set_mod_marked(&cpd2p->prev, (erts_aint_t) &crr->cpool, (erts_aint_t) cpd1p); - - erts_smp_atomic_set_wb(&crr->allctr, - ((erts_aint_t) allctr)|ERTS_CRR_ALCTR_FLG_IN_POOL); } static void @@ -3030,163 +2904,59 @@ static Carrier_t * cpool_fetch(Allctr_t *allctr, UWord size) { - int i, i_stop, has_passed_sentinel; + int i; Carrier_t *crr; ErtsAlcCPoolData_t *cpdp; - ErtsAlcCPoolData_t *cpool_entrance; - ErtsAlcCPoolData_t *sentinel; - ErtsDoubleLink_t* dl; - ErtsDoubleLink_t* first_old_traitor; + ErtsAlcCPoolData_t *sentinel = &carrier_pool[allctr->alloc_no].sentinel; ERTS_ALC_CPOOL_ASSERT(allctr->alloc_no == ERTS_ALC_A_INVALID /* testcase */ || erts_thr_progress_is_managed_thread()); - i = ERTS_ALC_CPOOL_MAX_FETCH_INSPECT; - first_old_traitor = allctr->cpool.traitor_list.next; - cpool_entrance = NULL; - - /* - * Search my own pooled_list, - * i.e my abandoned carriers that were in the pool last time I checked. - */ - - dl = allctr->cpool.pooled_list.next; - while(dl != &allctr->cpool.pooled_list) { - erts_aint_t exp, act; - crr = (Carrier_t *) (((char *) dl) - offsetof(Carrier_t, cpool.abandoned)); - - ASSERT(!is_in_list(&allctr->cpool.traitor_list, dl)); - ASSERT(crr->cpool.orig_allctr == allctr); - dl = dl->next; - exp = erts_smp_atomic_read_rb(&crr->allctr); - if ((exp & ERTS_CRR_ALCTR_FLG_MASK) == ERTS_CRR_ALCTR_FLG_IN_POOL - && erts_atomic_read_nob(&crr->cpool.max_size) >= size) { - /* Try to fetch it... */ - act = erts_smp_atomic_cmpxchg_mb(&crr->allctr, - (erts_aint_t) allctr, - exp); - if (act == exp) { - cpool_delete(allctr, ((Allctr_t *) (act & ~ERTS_CRR_ALCTR_FLG_MASK)), crr); - unlink_abandoned_carrier(crr); + i = 0; - /* Move sentinel to continue next search from here */ - relink_edl_before(dl, &allctr->cpool.pooled_list); - return crr; - } - exp = act; - } - if (exp & ERTS_CRR_ALCTR_FLG_IN_POOL) { - if (!cpool_entrance) - cpool_entrance = &crr->cpool; - } - else { /* Not in pool, move to traitor_list */ - unlink_abandoned_carrier(crr); - link_abandoned_carrier(&allctr->cpool.traitor_list, crr); - } - if (--i <= 0) { - /* Move sentinel to continue next search from here */ - relink_edl_before(dl, &allctr->cpool.pooled_list); - return NULL; + /* First; check our own pending dealloc carrier list... */ + crr = allctr->cpool.dc_list.last; + while (crr && i < ERTS_ALC_CPOOL_MAX_FETCH_INSPECT) { + if (erts_atomic_read_nob(&crr->cpool.max_size) >= size) { + unlink_carrier(&allctr->cpool.dc_list, crr); +#ifdef ERTS_ALC_CPOOL_DEBUG + ERTS_ALC_CPOOL_ASSERT(erts_smp_atomic_xchg_nob(&crr->allctr, + ((erts_aint_t) allctr)) + == (((erts_aint_t) allctr) & ~ERTS_CRR_ALCTR_FLG_MASK)); +#else + erts_smp_atomic_set_nob(&crr->allctr, ((erts_aint_t) allctr)); +#endif + return crr; } + crr = crr->prev; + i++; } - /* Now search traitor_list. - * i.e carriers employed by other allocators last time I checked. - * They might have been abandoned since then. - */ - - i_stop = (i < ERTS_ALC_CPOOL_MAX_TRAITOR_INSPECT ? - 0 : i - ERTS_ALC_CPOOL_MAX_TRAITOR_INSPECT); - dl = first_old_traitor; - while(dl != &allctr->cpool.traitor_list) { - erts_aint_t exp, act; - crr = (Carrier_t *) (((char *) dl) - offsetof(Carrier_t, cpool.abandoned)); - ASSERT(dl != &allctr->cpool.pooled_list); - ASSERT(crr->cpool.orig_allctr == allctr); - dl = dl->next; - exp = erts_smp_atomic_read_rb(&crr->allctr); - if (exp & ERTS_CRR_ALCTR_FLG_IN_POOL) { - if (!(exp & ERTS_CRR_ALCTR_FLG_BUSY) - && erts_atomic_read_nob(&crr->cpool.max_size) >= size) { - /* Try to fetch it... */ - act = erts_smp_atomic_cmpxchg_mb(&crr->allctr, - (erts_aint_t) allctr, - exp); - if (act == exp) { - cpool_delete(allctr, ((Allctr_t *) (act & ~ERTS_CRR_ALCTR_FLG_MASK)), crr); - unlink_abandoned_carrier(crr); - - /* Move sentinel to continue next search from here */ - relink_edl_before(dl, &allctr->cpool.traitor_list); - return crr; - } - exp = act; - } - if (exp & ERTS_CRR_ALCTR_FLG_IN_POOL) { - if (!cpool_entrance) - cpool_entrance = &crr->cpool; - - /* Move to pooled_list */ - unlink_abandoned_carrier(crr); - link_abandoned_carrier(&allctr->cpool.pooled_list, crr); - } - } - if (--i <= i_stop) { - /* Move sentinel to continue next search from here */ - relink_edl_before(dl, &allctr->cpool.traitor_list); - if (i > 0) - break; - else - return NULL; - } - } + /* ... then the pool ... */ /* - * Finally search the shared pool and try employ foreign carriers + * We search in 'prev' direction and begin by passing + * one element before trying to fetch. This in order to + * avoid contention with threads inserting elements. */ - sentinel = &carrier_pool[allctr->alloc_no].sentinel; - if (cpool_entrance) { - /* We saw a pooled carried above, use it as entrance into the pool - */ - cpdp = cpool_entrance; - } - else { - /* No pooled carried seen above. Start search at cpool sentinel, - * but begin by passing one element before trying to fetch. - * This in order to avoid contention with threads inserting elements. - */ - cpool_entrance = sentinel; - cpdp = cpool_aint2cpd(cpool_read(&cpool_entrance->prev)); - if (cpdp == sentinel) - goto check_dc_list; - } + cpdp = cpool_aint2cpd(cpool_read(&sentinel->prev)); + if (cpdp == sentinel) + return NULL; - has_passed_sentinel = 0; - while (1) { + while (i < ERTS_ALC_CPOOL_MAX_FETCH_INSPECT) { erts_aint_t exp; cpdp = cpool_aint2cpd(cpool_read(&cpdp->prev)); - if (cpdp == cpool_entrance) { - if (cpool_entrance == sentinel) { - cpdp = cpool_aint2cpd(cpool_read(&cpdp->prev)); - if (cpdp == sentinel) - break; - } - i = 0; /* Last one to inspect */ - } - else if (cpdp == sentinel) { - if (has_passed_sentinel) { - /* We been here before. cpool_entrance must have been removed */ - break; - } + if (cpdp == sentinel) { cpdp = cpool_aint2cpd(cpool_read(&cpdp->prev)); if (cpdp == sentinel) - break; - has_passed_sentinel = 1; + return NULL; + i = ERTS_ALC_CPOOL_MAX_FETCH_INSPECT; /* Last one to inspect */ } - crr = (Carrier_t *)(((char *)cpdp) - offsetof(Carrier_t, cpool)); + crr = (Carrier_t *) (((char *) cpdp) - offsetof(Carrier_t, cpool)); exp = erts_smp_atomic_read_rb(&crr->allctr); - if (((exp & (ERTS_CRR_ALCTR_FLG_MASK)) == ERTS_CRR_ALCTR_FLG_IN_POOL) + if (((exp & (ERTS_CRR_ALCTR_FLG_IN_POOL|ERTS_CRR_ALCTR_FLG_BUSY)) + == ERTS_CRR_ALCTR_FLG_IN_POOL) && (erts_atomic_read_nob(&cpdp->max_size) >= size)) { erts_aint_t act; /* Try to fetch it... */ @@ -3195,40 +2965,11 @@ exp); if (act == exp) { cpool_delete(allctr, ((Allctr_t *) (act & ~ERTS_CRR_ALCTR_FLG_MASK)), crr); - if (crr->cpool.orig_allctr == allctr) { - unlink_abandoned_carrier(crr); - } return crr; } } - if (--i <= 0) - return NULL; - } - -check_dc_list: - /* Last; check our own pending dealloc carrier list... */ - crr = allctr->cpool.dc_list.last; - while (crr) { - if (erts_atomic_read_nob(&crr->cpool.max_size) >= size) { - Block_t* blk; - unlink_carrier(&allctr->cpool.dc_list, crr); -#ifdef ERTS_ALC_CPOOL_DEBUG - ERTS_ALC_CPOOL_ASSERT(erts_smp_atomic_xchg_nob(&crr->allctr, - ((erts_aint_t) allctr)) - == (((erts_aint_t) allctr) & ~ERTS_CRR_ALCTR_FLG_MASK)); -#else - erts_smp_atomic_set_nob(&crr->allctr, ((erts_aint_t) allctr)); -#endif - blk = MBC_TO_FIRST_BLK(allctr, crr); - ASSERT(FBLK_TO_MBC(blk) == crr); - allctr->link_free_block(allctr, blk); - return crr; - } - crr = crr->prev; - if (--i <= 0) - return NULL; + i++; } - return NULL; } @@ -3252,7 +2993,7 @@ dcrr = crr; crr = crr->next; - dealloc_mbc(allctr, dcrr); + dealloc_carrier(allctr, dcrr, 1); i++; } while (crr && i < ERTS_ALC_MAX_DEALLOC_CARRIER); @@ -3283,20 +3024,18 @@ schedule_dealloc_carrier(Allctr_t *allctr, Carrier_t *crr) { Allctr_t *orig_allctr; - Block_t *blk; int check_pending_dealloc; erts_aint_t max_size; - ASSERT(IS_MB_CARRIER(crr)); - if (!ERTS_ALC_IS_CPOOL_ENABLED(allctr)) { - dealloc_mbc(allctr, crr); + dealloc_carrier(allctr, crr, 1); return; } orig_allctr = crr->cpool.orig_allctr; if (allctr != orig_allctr) { + Block_t *blk = MBC_TO_FIRST_BLK(allctr, crr); int cinit = orig_allctr->dd.ix - allctr->dd.ix; /* @@ -3313,7 +3052,6 @@ * since the block is an mbc block that is free and last * in the carrier. */ - blk = MBC_TO_FIRST_BLK(allctr, crr); ERTS_ALC_CPOOL_ASSERT(IS_FREE_LAST_MBC_BLK(blk)); ERTS_ALC_CPOOL_ASSERT(IS_MBC_FIRST_ABLK(allctr, blk)); @@ -3328,18 +3066,13 @@ return; } - if (is_abandoned(crr)) - unlink_abandoned_carrier(crr); - if (crr->cpool.thr_prgr == ERTS_THR_PRGR_INVALID || erts_thr_progress_has_reached(crr->cpool.thr_prgr)) { - dealloc_mbc(allctr, crr); + dealloc_carrier(allctr, crr, 1); return; } - blk = MBC_TO_FIRST_BLK(allctr, crr); - ASSERT(IS_FREE_LAST_MBC_BLK(blk)); - max_size = (erts_aint_t) MBC_FBLK_SZ(blk); + max_size = (erts_aint_t) allctr->largest_fblk_in_mbc(allctr, crr); erts_atomic_set_nob(&crr->cpool.max_size, max_size); crr->next = NULL; @@ -3379,8 +3112,6 @@ limit = (csz/100)*allctr->cpool.util_limit; crr->cpool.abandon_limit = limit; } - crr->cpool.abandoned.next = NULL; - crr->cpool.abandoned.prev = NULL; } static void @@ -3411,9 +3142,6 @@ STAT_MBC_CPOOL_INSERT(allctr, crr); unlink_carrier(&allctr->mbc_list, crr); - if (crr->cpool.orig_allctr == allctr) { - link_abandoned_carrier(&allctr->cpool.pooled_list, crr); - } allctr->remove_mbc(allctr, crr); @@ -3914,15 +3642,13 @@ } #endif + if (allctr->destroying_mbc) + (*allctr->destroying_mbc)(allctr, crr); + #ifdef ERTS_SMP if (busy_pcrr_pp && *busy_pcrr_pp) { ERTS_ALC_CPOOL_ASSERT(*busy_pcrr_pp == crr); *busy_pcrr_pp = NULL; - ERTS_ALC_CPOOL_ASSERT(erts_smp_atomic_read_nob(&crr->allctr) - == (((erts_aint_t) allctr) - | ERTS_CRR_ALCTR_FLG_IN_POOL - | ERTS_CRR_ALCTR_FLG_BUSY)); - erts_smp_atomic_set_nob(&crr->allctr, ((erts_aint_t) allctr)); cpool_delete(allctr, allctr, crr); } else @@ -3937,15 +3663,12 @@ else #endif STAT_SYS_ALLOC_MBC_FREE(allctr, crr_sz); - - if (allctr->remove_mbc) - allctr->remove_mbc(allctr, crr); } #ifdef ERTS_SMP schedule_dealloc_carrier(allctr, crr); #else - dealloc_mbc(allctr, crr); + dealloc_carrier(allctr, crr, 1); #endif } } @@ -5259,7 +4982,7 @@ if (allctr->fix) { if (ERTS_ALC_IS_CPOOL_ENABLED(allctr)) - fix_cpool_free(allctr, type, p, busy_pcrr_pp, 1); + fix_cpool_free(allctr, type, p, busy_pcrr_pp); else fix_nocpool_free(allctr, type, p); } @@ -5805,10 +5528,6 @@ allctr->min_block_size = sz; } - allctr->cpool.pooled_list.next = &allctr->cpool.pooled_list; - allctr->cpool.pooled_list.prev = &allctr->cpool.pooled_list; - allctr->cpool.traitor_list.next = &allctr->cpool.traitor_list; - allctr->cpool.traitor_list.prev = &allctr->cpool.traitor_list; allctr->cpool.dc_list.first = NULL; allctr->cpool.dc_list.last = NULL; allctr->cpool.abandon_limit = 0; @@ -5986,7 +5705,7 @@ erts_atomic_init_nob(&sentinel->prev, (erts_aint_t) sentinel); } #endif - ERTS_CT_ASSERT(SBC_BLK_SZ_MASK == MBC_FBLK_SZ_MASK); /* see BLK_SZ */ + ASSERT(SBC_BLK_SZ_MASK == MBC_FBLK_SZ_MASK); /* see BLK_SZ */ #if HAVE_ERTS_MSEG ASSERT(erts_mseg_unit_size() == ERTS_SACRR_UNIT_SZ); max_mseg_carriers = init->mmc; @@ -6074,16 +5793,6 @@ case 0x023: return (UWord) 0; case 0x024: return (UWord) 0; #endif - case 0x025: /* UMEM2BLK_TEST*/ -#ifdef DEBUG -# ifdef HARD_DEBUG - return (UWord)UMEM2BLK(a1-3*sizeof(UWord)); -# else - return (UWord)UMEM2BLK(a1-2*sizeof(UWord)); -# endif -#else - return (UWord)UMEM2BLK(a1); -#endif default: ASSERT(0); return ~((UWord) 0); } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_alloc_util.h erlang-17.3-dfsg/erts/emulator/beam/erl_alloc_util.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_alloc_util.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_alloc_util.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -269,21 +268,15 @@ #ifdef ERTS_SMP -typedef struct ErtsDoubleLink_t_ { - struct ErtsDoubleLink_t_ *next; - struct ErtsDoubleLink_t_ *prev; -}ErtsDoubleLink_t; - typedef struct { erts_atomic_t next; erts_atomic_t prev; - Allctr_t *orig_allctr; /* read-only while carrier is alive */ + Allctr_t *orig_allctr; ErtsThrPrgrVal thr_prgr; erts_atomic_t max_size; UWord abandon_limit; UWord blocks; UWord blocks_size; - ErtsDoubleLink_t abandoned; /* node in pooled_list or traitor_list */ } ErtsAlcCPoolData_t; #endif @@ -507,12 +500,7 @@ CarrierList_t sbc_list; #ifdef ERTS_SMP struct { - /* pooled_list, traitor list and dc_list contain only - carriers _created_ by this allocator */ - ErtsDoubleLink_t pooled_list; - ErtsDoubleLink_t traitor_list; - CarrierList_t dc_list; - + CarrierList_t dc_list; UWord abandon_limit; int disable_abandon; int check_limit_count; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erlang_dtrace.d erlang-17.3-dfsg/erts/emulator/beam/erlang_dtrace.d --- erlang-18.2-dfsg/erts/emulator/beam/erlang_dtrace.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erlang_dtrace.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * Copyright Dustin Sallings, Michal Ptaszek, Scott Lystig Fritchie 2011-2012. * All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_ao_firstfit_alloc.c erlang-17.3-dfsg/erts/emulator/beam/erl_ao_firstfit_alloc.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_ao_firstfit_alloc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_ao_firstfit_alloc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -209,9 +208,7 @@ static void aoff_link_free_block(Allctr_t *, Block_t*); static void aoff_unlink_free_block(Allctr_t *allctr, Block_t *del); static void aoff_creating_mbc(Allctr_t*, Carrier_t*); -#ifdef DEBUG static void aoff_destroying_mbc(Allctr_t*, Carrier_t*); -#endif static void aoff_add_mbc(Allctr_t*, Carrier_t*); static void aoff_remove_mbc(Allctr_t*, Carrier_t*); static UWord aoff_largest_fblk_in_mbc(Allctr_t*, Carrier_t*); @@ -273,11 +270,7 @@ allctr->get_next_mbc_size = NULL; allctr->creating_mbc = aoff_creating_mbc; -#ifdef DEBUG allctr->destroying_mbc = aoff_destroying_mbc; -#else - allctr->destroying_mbc = NULL; -#endif allctr->add_mbc = aoff_add_mbc; allctr->remove_mbc = aoff_remove_mbc; allctr->largest_fblk_in_mbc = aoff_largest_fblk_in_mbc; @@ -891,18 +884,17 @@ HARD_CHECK_TREE(NULL, 0, *root, 0); } -#define IS_CRR_IN_TREE(CRR,ROOT) \ - ((CRR)->rbt_node.parent || (ROOT) == &(CRR)->rbt_node) - -#ifdef DEBUG static void aoff_destroying_mbc(Allctr_t *allctr, Carrier_t *carrier) { AOFFAllctr_t *alc = (AOFFAllctr_t *) allctr; AOFF_Carrier_t *crr = (AOFF_Carrier_t*) carrier; + AOFF_RBTree_t *root = alc->mbc_root; - ASSERT(!IS_CRR_IN_TREE(crr, alc->mbc_root)); + if (crr->rbt_node.parent || &crr->rbt_node == root) { + aoff_remove_mbc(allctr, carrier); + } + /*else already removed */ } -#endif static void aoff_add_mbc(Allctr_t *allctr, Carrier_t *carrier) { @@ -910,7 +902,6 @@ AOFF_Carrier_t *crr = (AOFF_Carrier_t*) carrier; AOFF_RBTree_t **root = &alc->mbc_root; - ASSERT(!IS_CRR_IN_TREE(crr, *root)); HARD_CHECK_TREE(NULL, 0, *root, 0); /* Link carrier in address order tree @@ -927,10 +918,6 @@ AOFF_RBTree_t **root = &alc->mbc_root; ASSERT(allctr == ERTS_ALC_CARRIER_TO_ALLCTR(carrier)); - - if (!IS_CRR_IN_TREE(crr,*root)) - return; - HARD_CHECK_TREE(NULL, 0, *root, 0); rbt_delete(root, &crr->rbt_node); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_ao_firstfit_alloc.h erlang-17.3-dfsg/erts/emulator/beam/erl_ao_firstfit_alloc.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_ao_firstfit_alloc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_ao_firstfit_alloc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_arith.c erlang-17.3-dfsg/erts/emulator/beam/erl_arith.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_arith.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_arith.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -2049,8 +2048,3 @@ } return result; } - -/* Needed to remove compiler optimization */ -double erts_get_positive_zero_float() { - return 0.0f; -} diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_async.c erlang-17.3-dfsg/erts/emulator/beam/erl_async.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_async.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_async.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -177,7 +176,7 @@ ErtsThrQInit_t qinit = ERTS_THR_Q_INIT_DEFAULT; #endif erts_thr_opts_t thr_opts = ERTS_THR_OPTS_DEFAULT_INITER; - char *ptr, thr_name[16]; + char *ptr; size_t tot_size = 0; int i; @@ -228,16 +227,23 @@ thr_opts.suggested_stack_size = erts_async_thread_suggested_stack_size; - thr_opts.name = thr_name; +#ifdef ETHR_HAVE_THREAD_NAMES + thr_opts.name = malloc(sizeof(char)*(strlen("async_XXXX")+1)); +#endif for (i = 0; i < erts_async_max_threads; i++) { ErtsAsyncQ *aq = async_q(i); - erts_snprintf(thr_opts.name, 16, "async_%d", i+1); +#ifdef ETHR_HAVE_THREAD_NAMES + sprintf(thr_opts.name, "async_%d", i+1); +#endif erts_thr_create(&aq->thr_id, async_main, (void*) aq, &thr_opts); } +#ifdef ETHR_HAVE_THREAD_NAMES + free(thr_opts.name); +#endif /* Wait for async threads to initialize... */ erts_mtx_lock(&async->init.data.mtx); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_async.h erlang-17.3-dfsg/erts/emulator/beam/erl_async.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_async.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_async.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bestfit_alloc.c erlang-17.3-dfsg/erts/emulator/beam/erl_bestfit_alloc.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bestfit_alloc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bestfit_alloc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bestfit_alloc.h erlang-17.3-dfsg/erts/emulator/beam/erl_bestfit_alloc.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_bestfit_alloc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bestfit_alloc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_binary.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_binary.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_binary.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_binary.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -33,13 +32,10 @@ #include "global.h" #include "erl_process.h" #include "error.h" -#define ERL_WANT_HIPE_BIF_WRAPPER__ #include "bif.h" -#undef ERL_WANT_HIPE_BIF_WRAPPER__ #include "big.h" #include "erl_binary.h" #include "erl_bits.h" -#include "erl_bif_unique.h" /* @@ -2428,6 +2424,8 @@ } cbs->result = erts_bin_nrml_alloc(target_size); /* Always offheap if trapping */ + cbs->result->flags = 0; + cbs->result->orig_size = target_size; erts_refc_init(&(cbs->result->refc), 1); t = (byte *) cbs->result->orig_bytes; /* No offset or anything */ pos = 0; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_chksum.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_chksum.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_chksum.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_chksum.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_ddll.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_ddll.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_ddll.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_ddll.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -46,7 +45,6 @@ #include "big.h" #include "dist.h" #include "erl_version.h" -#include "erl_bif_unique.h" #include "dtrace-wrapper.h" #ifdef ERTS_SMP @@ -1732,7 +1730,11 @@ hp += REF_THING_SIZE; mess = TUPLE5(hp,type,r,am_driver,driver_name,tag); } - erts_queue_message(proc, &rp_locks, bp, mess, am_undefined); + erts_queue_message(proc, &rp_locks, bp, mess, am_undefined +#ifdef USE_VM_PROBES + , NIL +#endif + ); erts_smp_proc_unlock(proc, rp_locks); ERTS_SMP_CHK_NO_PROC_LOCKS; } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_guard.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_guard.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_guard.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_guard.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -460,25 +459,23 @@ Eterm erts_gc_map_size_1(Process* p, Eterm* reg, Uint live) { Eterm arg = reg[live]; - if (is_flatmap(arg)) { - flatmap_t *mp = (flatmap_t*)flatmap_val(arg); - return make_small(flatmap_get_size(mp)); - } else if (is_hashmap(arg)) { - Eterm* hp; - Uint size; - size = hashmap_size(arg); - if (IS_USMALL(0, size)) { - return make_small(size); - } - if (ERTS_NEED_GC(p, BIG_UINT_HEAP_SIZE)) { - erts_garbage_collect(p, BIG_UINT_HEAP_SIZE, reg, live); - } - hp = p->htop; - p->htop += BIG_UINT_HEAP_SIZE; - return uint_to_big(size, hp); + if (is_map(arg)) { + map_t *mp = (map_t*)map_val(arg); + Uint size = map_get_size(mp); + if (IS_USMALL(0, size)) { + return make_small(size); + } else { + Eterm* hp; + if (ERTS_NEED_GC(p, BIG_UINT_HEAP_SIZE)) { + erts_garbage_collect(p, BIG_UINT_HEAP_SIZE, reg, live); + } + hp = p->htop; + p->htop += BIG_UINT_HEAP_SIZE; + return uint_to_big(size, hp); + } + } else { + BIF_ERROR(p, BADARG); } - p->fvalue = arg; - BIF_ERROR(p, BADMAP); } Eterm erts_gc_abs_1(Process* p, Eterm* reg, Uint live) diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_info.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_info.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_info.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_info.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -28,7 +27,6 @@ #include "erl_process.h" #include "error.h" #include "erl_driver.h" -#include "erl_nif.h" #include "bif.h" #include "big.h" #include "erl_version.h" @@ -43,7 +41,6 @@ #include "erl_cpu_topology.h" #include "erl_async.h" #include "erl_thr_progress.h" -#include "erl_bif_unique.h" #define ERTS_PTAB_WANT_DEBUG_FUNCS__ #include "erl_ptab.h" #ifdef HIPE @@ -61,7 +58,6 @@ static Export* alloc_info_trap = NULL; static Export* alloc_sizes_trap = NULL; -static Export* gather_io_bytes_trap = NULL; static Export *gather_sched_wall_time_res_trap; static Export *gather_gc_info_res_trap; @@ -94,7 +90,7 @@ " [smp:%beu:%beu]" #endif #ifdef USE_THREADS -#if defined(ERTS_DIRTY_SCHEDULERS) && defined(ERTS_SMP) +#ifdef ERTS_DIRTY_SCHEDULERS " [ds:%beu:%beu:%beu]" #endif " [async-threads:%d]" @@ -119,9 +115,6 @@ #ifdef ERTS_ENABLE_LOCK_COUNT " [lock-counting]" #endif -#ifdef ERTS_OPCODE_COUNTER_SUPPORT - " [instruction-counting]" -#endif #ifdef PURIFY " [purify-compiled]" #endif @@ -543,7 +536,6 @@ switch (info) { case am_status: case am_priority: - case am_trap_exit: return ERTS_PROC_LOCK_STATUS; case am_links: case am_monitors: @@ -596,7 +588,7 @@ am_min_bin_vheap_size, am_current_location, am_current_stacktrace, -}; +}; #define ERTS_PI_ARGS ((int) (sizeof(pi_args)/sizeof(Eterm))) @@ -1056,9 +1048,9 @@ case am_initial_call: hp = HAlloc(BIF_P, 3+4); res = TUPLE3(hp, - rp->u.initial[INITIAL_MOD], - rp->u.initial[INITIAL_FUN], - make_small(rp->u.initial[INITIAL_ARI])); + rp->initial[INITIAL_MOD], + rp->initial[INITIAL_FUN], + make_small(rp->initial[INITIAL_ARI])); hp += 4; break; @@ -1108,18 +1100,19 @@ heap_need += mq[i].copy_struct_size; } else { - mq[i].copy_struct_size = mp->data.attached ? - erts_msg_attached_data_size(mp) : 0; + mq[i].copy_struct_size = 0; + if (mp->data.attached) + heap_need += erts_msg_attached_data_size(mp); } i++; } - if (rp != BIF_P) { - hp = HAlloc(BIF_P, heap_need); - hp_end = hp + heap_need; - ASSERT(i == n); - for (i--; i >= 0; i--) { - Eterm msg = ERL_MESSAGE_TERM(mq[i].msgp); + hp = HAlloc(BIF_P, heap_need); + hp_end = hp + heap_need; + ASSERT(i == n); + for (i--; i >= 0; i--) { + Eterm msg = ERL_MESSAGE_TERM(mq[i].msgp); + if (rp != BIF_P) { if (is_value(msg)) { if (mq[i].copy_struct_size) msg = copy_struct(msg, @@ -1153,9 +1146,9 @@ } else { /* Make our copy of the message */ - ASSERT(size_object(msg) == erts_used_frag_sz(hfp)); + ASSERT(size_object(msg) == hfp->used_size); msg = copy_struct(msg, - erts_used_frag_sz(hfp), + hfp->used_size, &hp, &MSO(BIF_P)); } @@ -1165,38 +1158,27 @@ remove_bad_messages = 1; continue; } - res = CONS(hp, msg, res); - hp += 2; } - HRelease(BIF_P, hp_end, hp+3); - } - else { - for (i--; i >= 0; i--) { - ErtsHeapFactory factory; - Eterm msg = ERL_MESSAGE_TERM(mq[i].msgp); - - erts_factory_proc_prealloc_init(&factory, BIF_P, - mq[i].copy_struct_size+2); + else { if (mq[i].msgp->data.attached) { /* Decode it on the heap */ - erts_move_msg_attached_data_to_heap(&factory, + erts_move_msg_attached_data_to_heap(&hp, + &MSO(BIF_P), mq[i].msgp); msg = ERL_MESSAGE_TERM(mq[i].msgp); ASSERT(!mq[i].msgp->data.attached); - } - if (is_value(msg)) { - hp = erts_produce_heap(&factory, 2, 0); - res = CONS(hp, msg, res); - } - else { - /* Bad distribution message; ignore */ - remove_bad_messages = 1; - continue; - } - erts_factory_close(&factory); + if (is_non_value(msg)) { + /* Bad distribution message; ignore */ + remove_bad_messages = 1; + continue; + } + } } - hp = HAlloc(BIF_P, 3); + + res = CONS(hp, msg, res); + hp += 2; } + HRelease(BIF_P, hp_end, hp+3); erts_free(ERTS_ALC_T_TMP, mq); if (remove_bad_messages) { ErlMessage **mpp; @@ -2116,50 +2098,6 @@ BIF_RET(am_opt); #endif BIF_RET(res); - } else if (BIF_ARG_1 == am_time_offset) { - switch (erts_time_offset_state()) { - case ERTS_TIME_OFFSET_PRELIMINARY: { - ERTS_DECL_AM(preliminary); - BIF_RET(AM_preliminary); - } - case ERTS_TIME_OFFSET_FINAL: { - ERTS_DECL_AM(final); - BIF_RET(AM_final); - } - case ERTS_TIME_OFFSET_VOLATILE: { - ERTS_DECL_AM(volatile); - BIF_RET(AM_volatile); - } - default: - ERTS_INTERNAL_ERROR("Invalid time offset state"); - } - } else if (ERTS_IS_ATOM_STR("os_monotonic_time_source", BIF_ARG_1)) { - BIF_RET(erts_monotonic_time_source(BIF_P)); - } else if (ERTS_IS_ATOM_STR("os_system_time_source", BIF_ARG_1)) { - BIF_RET(erts_system_time_source(BIF_P)); - } else if (ERTS_IS_ATOM_STR("time_correction", BIF_ARG_1)) { - BIF_RET(erts_has_time_correction() ? am_true : am_false); - } else if (ERTS_IS_ATOM_STR("start_time", BIF_ARG_1)) { - BIF_RET(erts_get_monotonic_start_time(BIF_P)); - } else if (ERTS_IS_ATOM_STR("end_time", BIF_ARG_1)) { - BIF_RET(erts_get_monotonic_end_time(BIF_P)); - } else if (ERTS_IS_ATOM_STR("time_warp_mode", BIF_ARG_1)) { - switch (erts_time_warp_mode()) { - case ERTS_NO_TIME_WARP_MODE: { - ERTS_DECL_AM(no_time_warp); - BIF_RET(AM_no_time_warp); - } - case ERTS_SINGLE_TIME_WARP_MODE: { - ERTS_DECL_AM(single_time_warp); - BIF_RET(AM_single_time_warp); - } - case ERTS_MULTI_TIME_WARP_MODE: { - ERTS_DECL_AM(multi_time_warp); - BIF_RET(AM_multi_time_warp); - } - default: - ERTS_INTERNAL_ERROR("Invalid time warp mode"); - } } else if (BIF_ARG_1 == am_allocated_areas) { res = erts_allocated_areas(NULL, NULL, BIF_P); BIF_RET(res); @@ -2362,7 +2300,7 @@ for (i = num_instructions-1; i >= 0; i--) { res = erts_bld_cons(hpp, hszp, erts_bld_tuple(hpp, hszp, 2, - erts_atom_put((byte *)opc[i].name, + erts_atom_put(opc[i].name, strlen(opc[i].name), ERTS_ATOM_ENC_LATIN1, 1), @@ -2521,13 +2459,6 @@ ERL_DRV_EXTENDED_MINOR_VERSION); hp = HAlloc(BIF_P, 2*n); BIF_RET(buf_to_intlist(&hp, buf, n, NIL)); - } else if (ERTS_IS_ATOM_STR("nif_version", BIF_ARG_1)) { - char buf[42]; - int n = erts_snprintf(buf, 42, "%d.%d", - ERL_NIF_MAJOR_VERSION, - ERL_NIF_MINOR_VERSION); - hp = HAlloc(BIF_P, 2*n); - BIF_RET(buf_to_intlist(&hp, buf, n, NIL)); } else if (ERTS_IS_ATOM_STR("smp_support", BIF_ARG_1)) { #ifdef ERTS_SMP BIF_RET(am_true); @@ -2699,15 +2630,6 @@ hp = hsz ? HAlloc(BIF_P, hsz) : NULL; res = erts_bld_uint(&hp, NULL, erts_dist_buf_busy_limit); BIF_RET(res); - } else if (ERTS_IS_ATOM_STR("delayed_node_table_gc", BIF_ARG_1)) { - Uint hsz = 0; - Uint dntgc = erts_delayed_node_table_gc(); - if (dntgc == ERTS_NODE_TAB_DELAY_GC_INFINITY) - BIF_RET(am_infinity); - (void) erts_bld_uint(NULL, &hsz, dntgc); - hp = hsz ? HAlloc(BIF_P, hsz) : NULL; - res = erts_bld_uint(&hp, NULL, dntgc); - BIF_RET(res); } else if (ERTS_IS_ATOM_STR("ethread_info", BIF_ARG_1)) { BIF_RET(erts_get_ethread_info(BIF_P)); } @@ -2770,14 +2692,9 @@ BIF_RET(make_small(erts_db_get_max_tabs())); } else if (ERTS_IS_ATOM_STR("tolerant_timeofday",BIF_ARG_1)) { - if (erts_has_time_correction() - && erts_time_offset_state() == ERTS_TIME_OFFSET_FINAL) { - BIF_RET(am_enabled); - } - BIF_RET(am_disabled); - } - else if (ERTS_IS_ATOM_STR("eager_check_io",BIF_ARG_1)) { - BIF_RET(erts_eager_check_io ? am_true : am_false); + BIF_RET(erts_disable_tolerant_timeofday + ? am_disabled + : am_enabled); } BIF_ERROR(BIF_P, BADARG); @@ -3222,6 +3139,7 @@ BIF_RET(am_true); } + /* this is a general call which return some possibly useful information */ BIF_RETTYPE statistics_1(BIF_ALIST_1) @@ -3294,8 +3212,23 @@ res = TUPLE2(hp, b1, b2); BIF_RET(res); } else if (BIF_ARG_1 == am_io) { - Eterm ref = erts_request_io_bytes(BIF_P); - BIF_TRAP2(gather_io_bytes_trap, BIF_P, ref, make_small(erts_no_schedulers)); + Eterm r1, r2; + Eterm in, out; + Uint hsz = 9; + Uint bytes_in = (Uint) erts_smp_atomic_read_nob(&erts_bytes_in); + Uint bytes_out = (Uint) erts_smp_atomic_read_nob(&erts_bytes_out); + + (void) erts_bld_uint(NULL, &hsz, bytes_in); + (void) erts_bld_uint(NULL, &hsz, bytes_out); + hp = HAlloc(BIF_P, hsz); + in = erts_bld_uint(&hp, NULL, bytes_in); + out = erts_bld_uint(&hp, NULL, bytes_out); + + r1 = TUPLE2(hp, am_input, in); + hp += 3; + r2 = TUPLE2(hp, am_output, out); + hp += 3; + BIF_RET(TUPLE2(hp, r1, r2)); } else if (ERTS_IS_ATOM_STR("run_queues", BIF_ARG_1)) { Eterm res, *hp, **hpp; @@ -3371,38 +3304,17 @@ BIF_RET(make_small((Uint) words)); } else if (ERTS_IS_ATOM_STR("check_io_debug", BIF_ARG_1)) { - /* Used by driver_SUITE (emulator) */ - Uint sz, *szp; - Eterm res, *hp, **hpp; - int no_errors; - ErtsCheckIoDebugInfo ciodi = {0}; + /* Used by (emulator) */ + int res; #ifdef HAVE_ERTS_CHECK_IO_DEBUG erts_smp_proc_unlock(BIF_P,ERTS_PROC_LOCK_MAIN); - no_errors = erts_check_io_debug(&ciodi); + res = erts_check_io_debug(); erts_smp_proc_lock(BIF_P,ERTS_PROC_LOCK_MAIN); #else - no_errors = 0; + res = 0; #endif - sz = 0; - szp = &sz; - hpp = NULL; - while (1) { - res = erts_bld_tuple(hpp, szp, 4, - erts_bld_uint(hpp, szp, - (Uint) no_errors), - erts_bld_uint(hpp, szp, - (Uint) ciodi.no_used_fds), - erts_bld_uint(hpp, szp, - (Uint) ciodi.no_driver_select_structs), - erts_bld_uint(hpp, szp, - (Uint) ciodi.no_driver_event_structs)); - if (hpp) - break; - hp = HAlloc(BIF_P, sz); - szp = NULL; - hpp = &hp; - } - BIF_RET(res); + ASSERT(res >= 0); + BIF_RET(erts_make_integer((Uint) res, BIF_P)); } else if (ERTS_IS_ATOM_STR("process_info_args", BIF_ARG_1)) { /* Used by process_SUITE (emulator) */ @@ -3456,29 +3368,6 @@ else if (ERTS_IS_ATOM_STR("mmap", BIF_ARG_1)) { BIF_RET(erts_mmap_debug_info(BIF_P)); } - else if (ERTS_IS_ATOM_STR("unique_monotonic_integer_state", BIF_ARG_1)) { - BIF_RET(erts_debug_get_unique_monotonic_integer_state(BIF_P)); - } - else if (ERTS_IS_ATOM_STR("min_unique_monotonic_integer", BIF_ARG_1)) { - Sint64 value = erts_get_min_unique_monotonic_integer(); - if (IS_SSMALL(value)) - BIF_RET(make_small(value)); - else { - Uint hsz = ERTS_SINT64_HEAP_SIZE(value); - Eterm *hp = HAlloc(BIF_P, hsz); - BIF_RET(erts_sint64_to_big(value, &hp)); - } - } - else if (ERTS_IS_ATOM_STR("min_unique_integer", BIF_ARG_1)) { - Sint64 value = erts_get_min_unique_integer(); - if (IS_SSMALL(value)) - BIF_RET(make_small(value)); - else { - Uint hsz = ERTS_SINT64_HEAP_SIZE(value); - Eterm *hp = HAlloc(BIF_P, hsz); - BIF_RET(erts_sint64_to_big(value, &hp)); - } - } } else if (is_tuple(BIF_ARG_1)) { Eterm* tp = tuple_val(BIF_ARG_1); @@ -3673,58 +3562,6 @@ BIF_RET(erts_debug_reader_groups_map(BIF_P, (int) groups)); } - else if (ERTS_IS_ATOM_STR("internal_hash", tp[1])) { - Uint hash = (Uint) make_internal_hash(tp[2]); - Uint hsz = 0; - Eterm* hp; - erts_bld_uint(NULL, &hsz, hash); - hp = HAlloc(BIF_P,hsz); - return erts_bld_uint(&hp, NULL, hash); - } - else if (ERTS_IS_ATOM_STR("atom", tp[1])) { - Uint ix; - if (!term_to_Uint(tp[2], &ix)) - BIF_ERROR(BIF_P, BADARG); - while (ix >= atom_table_size()) { - char tmp[20]; - erts_snprintf(tmp, sizeof(tmp), "am%x", atom_table_size()); - erts_atom_put((byte *) tmp, strlen(tmp), ERTS_ATOM_ENC_LATIN1, 1); - } - return make_atom(ix); - } - - break; - } - case 3: { - if (ERTS_IS_ATOM_STR("check_time_config", tp[1])) { - int res, time_correction; - ErtsTimeWarpMode time_warp_mode; - if (tp[2] == am_true) - time_correction = !0; - else if (tp[2] == am_false) - time_correction = 0; - else - break; - if (ERTS_IS_ATOM_STR("no_time_warp", tp[3])) - time_warp_mode = ERTS_NO_TIME_WARP_MODE; - else if (ERTS_IS_ATOM_STR("single_time_warp", tp[3])) - time_warp_mode = ERTS_SINGLE_TIME_WARP_MODE; - else if (ERTS_IS_ATOM_STR("multi_time_warp", tp[3])) - time_warp_mode = ERTS_MULTI_TIME_WARP_MODE; - else - break; - res = erts_check_time_adj_support(time_correction, - time_warp_mode); - BIF_RET(res ? am_true : am_false); - } - else if (ERTS_IS_ATOM_STR("make_unique_integer", tp[1])) { - Eterm res = erts_debug_make_unique_integer(BIF_P, - tp[2], - tp[3]); - if (is_non_value(res)) - break; - BIF_RET(res); - } break; } default: @@ -3734,40 +3571,8 @@ BIF_ERROR(BIF_P, BADARG); } -BIF_RETTYPE erts_internal_is_system_process_1(BIF_ALIST_1) -{ - if (is_internal_pid(BIF_ARG_1)) { - Process *rp = erts_proc_lookup(BIF_ARG_1); - if (rp && (rp->static_flags & ERTS_STC_FLG_SYSTEM_PROC)) - BIF_RET(am_true); - BIF_RET(am_false); - } - - if (is_external_pid(BIF_ARG_1) - && external_pid_dist_entry(BIF_ARG_1) == erts_this_dist_entry) { - BIF_RET(am_false); - } - - BIF_ERROR(BIF_P, BADARG); -} - - static erts_smp_atomic_t hipe_test_reschedule_flag; -#if defined(VALGRIND) && defined(__GNUC__) -/* Force noinline for valgrind suppression */ -static void broken_halt_test(Eterm bif_arg_2) __attribute__((noinline)); -#endif - -static void broken_halt_test(Eterm bif_arg_2) -{ - /* Ugly ugly code used by bif_SUITE:erlang_halt/1 */ -#if defined(ERTS_HAVE_TRY_CATCH) - erts_get_scheduler_data()->run_queue = NULL; -#endif - erl_exit(ERTS_DUMP_EXIT, "%T", bif_arg_2); -} - BIF_RETTYPE erts_debug_set_internal_state_2(BIF_ALIST_2) { @@ -4055,36 +3860,11 @@ } else if (ERTS_IS_ATOM_STR("wait", BIF_ARG_1)) { if (ERTS_IS_ATOM_STR("deallocations", BIF_ARG_2)) { - int flag = ERTS_DEBUG_WAIT_COMPLETED_DEALLOCATIONS; - if (erts_debug_wait_completed(BIF_P, flag)) { - ERTS_BIF_YIELD_RETURN(BIF_P, am_ok); - } - } - if (ERTS_IS_ATOM_STR("timer_cancellations", BIF_ARG_2)) { - int flag = ERTS_DEBUG_WAIT_COMPLETED_TIMER_CANCELLATIONS; - if (erts_debug_wait_completed(BIF_P, flag)) { + if (erts_debug_wait_deallocations(BIF_P)) { ERTS_BIF_YIELD_RETURN(BIF_P, am_ok); } } } - else if (ERTS_IS_ATOM_STR("broken_halt", BIF_ARG_1)) { - broken_halt_test(BIF_ARG_2); - } - else if (ERTS_IS_ATOM_STR("unique_monotonic_integer_state", BIF_ARG_1)) { - int res = erts_debug_set_unique_monotonic_integer_state(BIF_ARG_2); - BIF_RET(res ? am_true : am_false); - } - else if (ERTS_IS_ATOM_STR("node_tab_delayed_delete", BIF_ARG_1)) { - /* node_container_SUITE */ - Sint64 msecs; - if (term_to_Sint64(BIF_ARG_2, &msecs)) { - /* Negative value restore original value... */ - erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN); - erts_debug_test_node_tab_delayed_delete(msecs); - erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN); - BIF_RET(am_ok); - } - } } BIF_ERROR(BIF_P, BADARG); @@ -4282,41 +4062,59 @@ BIF_RET(am_ok); } else if (is_tuple(BIF_ARG_1)) { - Eterm* ptr = tuple_val(BIF_ARG_1); + Eterm* tp = tuple_val(BIF_ARG_1); - if ((arityval(ptr[0]) == 2) && (ptr[2] == am_false || ptr[2] == am_true)) { - int lock_opt = 0, enable = (ptr[2] == am_true) ? 1 : 0; - if (ERTS_IS_ATOM_STR("copy_save", ptr[1])) { - lock_opt = ERTS_LCNT_OPT_COPYSAVE; - } else if (ERTS_IS_ATOM_STR("process_locks", ptr[1])) { - lock_opt = ERTS_LCNT_OPT_PROCLOCK; - } else if (ERTS_IS_ATOM_STR("port_locks", ptr[1])) { - lock_opt = ERTS_LCNT_OPT_PORTLOCK; - } else if (ERTS_IS_ATOM_STR("suspend", ptr[1])) { - lock_opt = ERTS_LCNT_OPT_SUSPEND; - } else if (ERTS_IS_ATOM_STR("location", ptr[1])) { - lock_opt = ERTS_LCNT_OPT_LOCATION; - } else { - BIF_ERROR(BIF_P, BADARG); - } - - erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN); - erts_smp_thr_progress_block(); - - if (enable) res = erts_lcnt_set_rt_opt(lock_opt) ? am_true : am_false; - else res = erts_lcnt_clear_rt_opt(lock_opt) ? am_true : am_false; - + switch (arityval(tp[0])) { + case 2: { + int opt = 0; + int val = 0; + if (ERTS_IS_ATOM_STR("copy_save", tp[1])) { + opt = ERTS_LCNT_OPT_COPYSAVE; + } else if (ERTS_IS_ATOM_STR("process_locks", tp[1])) { + opt = ERTS_LCNT_OPT_PROCLOCK; + } else if (ERTS_IS_ATOM_STR("port_locks", tp[1])) { + opt = ERTS_LCNT_OPT_PORTLOCK; + } else if (ERTS_IS_ATOM_STR("suspend", tp[1])) { + opt = ERTS_LCNT_OPT_SUSPEND; + } else if (ERTS_IS_ATOM_STR("location", tp[1])) { + opt = ERTS_LCNT_OPT_LOCATION; + } else { + BIF_ERROR(BIF_P, BADARG); + } + if (tp[2] == am_true) { + val = 1; + } else if (tp[2] == am_false) { + val = 0; + } else { + BIF_ERROR(BIF_P, BADARG); + } + + erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN); + erts_smp_thr_progress_block(); + + if (val) { + res = erts_lcnt_set_rt_opt(opt) ? am_true : am_false; + } else { + res = erts_lcnt_clear_rt_opt(opt) ? am_true : am_false; + } #ifdef ERTS_SMP - if (res != ptr[2] && lock_opt == ERTS_LCNT_OPT_PORTLOCK) { - erts_lcnt_enable_io_lock_count(enable); - } else if (res != ptr[2] && lock_opt == ERTS_LCNT_OPT_PROCLOCK) { - erts_lcnt_enable_proc_lock_count(enable); - } -#endif - erts_smp_thr_progress_unblock(); - erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN); - BIF_RET(res); - } + if (res != tp[2]) { + if (opt == ERTS_LCNT_OPT_PORTLOCK) { + erts_lcnt_enable_io_lock_count(val); + } else if (opt == ERTS_LCNT_OPT_PROCLOCK) { + erts_lcnt_enable_proc_lock_count(val); + } + } +#endif + erts_smp_thr_progress_unblock(); + erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN); + BIF_RET(res); + break; + } + + default: + break; + } } #endif @@ -4356,8 +4154,6 @@ = erts_export_put(am_erlang, am_gather_sched_wall_time_result, 1); gather_gc_info_res_trap = erts_export_put(am_erlang, am_gather_gc_info_result, 1); - gather_io_bytes_trap - = erts_export_put(am_erts_internal, am_gather_io_bytes, 2); process_info_init(); os_info_init(); } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_lists.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_lists.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_lists.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_lists.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -391,7 +390,7 @@ Eterm *tuple_ptr = tuple_val(term); if (pos <= arityval(*tuple_ptr)) { Eterm element = tuple_ptr[pos]; - if (CMP_EQ(Key, element)) { + if (CMP(Key, element) == 0) { return term; } } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_op.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_op.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_op.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_op.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_os.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_os.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_os.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_os.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_port.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_port.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_port.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_port.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -473,7 +472,7 @@ ErtsPortDataHeap *pdhp = (ErtsPortDataHeap *) data; size_t size; ERTS_SMP_DATA_DEPENDENCY_READ_MEMORY_BARRIER; - size = sizeof(ErtsPortDataHeap) + (pdhp->hsize-1)*sizeof(Eterm); + size = sizeof(ErtsPortDataHeap) + pdhp->hsize*(sizeof(Eterm) - 1); erts_schedule_thr_prgr_later_cleanup_op(free_port_data_heap, (void *) pdhp, &pdhp->later_op, @@ -494,8 +493,8 @@ erts_cleanup_port_data(Port *prt) { ASSERT(erts_atomic32_read_nob(&prt->state) & ERTS_PORT_SFLGS_INVALID_LOOKUP); - cleanup_old_port_data(erts_smp_atomic_xchg_nob(&prt->data, - (erts_aint_t) NULL)); + cleanup_old_port_data(erts_smp_atomic_read_nob(&prt->data)); + erts_smp_atomic_set_nob(&prt->data, (erts_aint_t) THE_NON_VALUE); } Uint @@ -509,7 +508,7 @@ } else { ErtsPortDataHeap *pdhp = (ErtsPortDataHeap *) data; - return (Uint) sizeof(ErtsPortDataHeap) + (pdhp->hsize-1)*sizeof(Eterm); + return (Uint) sizeof(ErtsPortDataHeap) + pdhp->hsize*(sizeof(Eterm)-1); } } @@ -551,11 +550,10 @@ hsize = size_object(BIF_ARG_2); pdhp = erts_alloc(ERTS_ALC_T_PORT_DATA_HEAP, - sizeof(ErtsPortDataHeap) + (hsize-1)*sizeof(Eterm)); + sizeof(ErtsPortDataHeap) + hsize*(sizeof(Eterm)-1)); hp = &pdhp->heap[0]; pdhp->off_heap.first = NULL; pdhp->off_heap.overhead = 0; - pdhp->hsize = hsize; pdhp->data = copy_struct(BIF_ARG_2, hsize, &hp, &pdhp->off_heap); data = (erts_aint_t) pdhp; ASSERT((data & 0x3) == 0); @@ -563,14 +561,8 @@ data = erts_smp_atomic_xchg_wb(&prt->data, data); - if (data == (erts_aint_t)NULL) { - /* Port terminated by racing thread */ - data = erts_smp_atomic_xchg_wb(&prt->data, data); - ASSERT(data != (erts_aint_t)NULL); - cleanup_old_port_data(data); - BIF_ERROR(BIF_P, BADARG); - } cleanup_old_port_data(data); + BIF_RET(am_true); } @@ -589,8 +581,6 @@ BIF_ERROR(BIF_P, BADARG); data = erts_smp_atomic_read_ddrb(&prt->data); - if (data == (erts_aint_t)NULL) - BIF_ERROR(BIF_P, BADARG); /* Port terminated by racing thread */ if ((data & 0x3) != 0) { res = (Eterm) (UWord) data; @@ -1329,8 +1319,7 @@ ErlSubBin* rest; Eterm res; Eterm options; - int code; - char delimiter = '\n'; + int code; if (!is_binary(BIF_ARG_2) || (!is_list(BIF_ARG_3) && !is_nil(BIF_ARG_3))) { @@ -1371,11 +1360,6 @@ case am_line_length: trunc_len = val; goto next_option; - case am_line_delimiter: - if (type == TCP_PB_LINE_LF && val >= 0 && val <= 255) { - delimiter = (char)val; - goto next_option; - } } } } @@ -1396,7 +1380,7 @@ pca.aligned_ptr = bin_ptr; } packet_sz = packet_get_length(type, (char*)pca.aligned_ptr, pca.bin_sz, - max_plen, trunc_len, delimiter, &http_state); + max_plen, trunc_len, &http_state); if (!(packet_sz > 0 && packet_sz <= pca.bin_sz)) { if (packet_sz < 0) { goto error; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_re.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_re.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_re.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_re.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_timer.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_timer.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_timer.c 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_timer.c 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,705 @@ +/* + * %CopyrightBegin% + * + * Copyright Ericsson AB 2005-2012. All Rights Reserved. + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "erl_bif_timer.h" +#include "global.h" +#include "bif.h" +#include "error.h" +#include "big.h" +#include "erl_thr_progress.h" + +/**************************************************************************** +** BIF Timer support +****************************************************************************/ + +#define BTM_FLG_SL_TIMER (((Uint32) 1) << 0) +#define BTM_FLG_CANCELED (((Uint32) 1) << 1) +#define BTM_FLG_HEAD (((Uint32) 1) << 2) +#define BTM_FLG_BYNAME (((Uint32) 1) << 3) +#define BTM_FLG_WRAP (((Uint32) 1) << 4) + +struct ErtsBifTimer_ { + struct { + union { + ErtsBifTimer **head; + ErtsBifTimer *prev; + } u; + ErtsBifTimer *next; + } tab; + union { + Eterm name; + struct { + ErtsBifTimer *prev; + ErtsBifTimer *next; + Process *ess; + } proc; + } receiver; + ErlTimer tm; + ErlHeapFragment* bp; + Uint32 flags; + Eterm message; + Uint32 ref_numbers[ERTS_REF_NUMBERS]; +}; + +#ifdef SMALL_MEMORY +#define TIMER_HASH_VEC_SZ 3331 +#define BTM_PREALC_SZ 10 +#else +#define TIMER_HASH_VEC_SZ 10007 +#define BTM_PREALC_SZ 100 +#endif +static ErtsBifTimer **bif_timer_tab; +static Uint no_bif_timers; + + +static erts_smp_rwmtx_t bif_timer_lock; + +#define erts_smp_safe_btm_rwlock(P, L) \ + safe_btm_lock((P), (L), 1) +#define erts_smp_safe_btm_rlock(P, L) \ + safe_btm_lock((P), (L), 0) +#define erts_smp_btm_rwlock() \ + erts_smp_rwmtx_rwlock(&bif_timer_lock) +#define erts_smp_btm_tryrwlock() \ + erts_smp_rwmtx_tryrwlock(&bif_timer_lock) +#define erts_smp_btm_rwunlock() \ + erts_smp_rwmtx_rwunlock(&bif_timer_lock) +#define erts_smp_btm_rlock() \ + erts_smp_rwmtx_rlock(&bif_timer_lock) +#define erts_smp_btm_tryrlock() \ + erts_smp_rwmtx_tryrlock(&bif_timer_lock) +#define erts_smp_btm_runlock() \ + erts_smp_rwmtx_runlock(&bif_timer_lock) +#define erts_smp_btm_lock_init() \ + erts_smp_rwmtx_init(&bif_timer_lock, "bif_timers") + + +static ERTS_INLINE int +safe_btm_lock(Process *c_p, ErtsProcLocks c_p_locks, int rw_lock) +{ + ASSERT(c_p && c_p_locks); +#ifdef ERTS_SMP + if ((rw_lock ? erts_smp_btm_tryrwlock() : erts_smp_btm_tryrlock()) != EBUSY) + return 0; + erts_smp_proc_unlock(c_p, c_p_locks); + if (rw_lock) + erts_smp_btm_rwlock(); + else + erts_smp_btm_rlock(); + erts_smp_proc_lock(c_p, c_p_locks); + if (ERTS_PROC_IS_EXITING(c_p)) { + if (rw_lock) + erts_smp_btm_rwunlock(); + else + erts_smp_btm_runlock(); + return 1; + } +#endif + return 0; +} + +ERTS_SCHED_PREF_PALLOC_IMPL(btm_pre, ErtsBifTimer, BTM_PREALC_SZ) + +static ERTS_INLINE int +get_index(Uint32 *ref_numbers, Uint32 len) +{ + Uint32 hash; + /* len can potentially be larger than ERTS_REF_NUMBERS + if it has visited another node... */ + if (len > ERTS_REF_NUMBERS) + len = ERTS_REF_NUMBERS; + +#if ERTS_REF_NUMBERS != 3 +#error "ERTS_REF_NUMBERS changed. Update me..." +#endif + switch (len) { + case 3: if (!ref_numbers[2]) len = 2; + case 2: if (!ref_numbers[1]) len = 1; + default: break; + } + + ASSERT(1 <= len && len <= ERTS_REF_NUMBERS); + + hash = block_hash((byte *) ref_numbers, len * sizeof(Uint32), 0x08d12e65); + return (int) (hash % ((Uint32) TIMER_HASH_VEC_SZ)); +} + +static Eterm +create_ref(Uint *hp, Uint32 *ref_numbers, Uint32 len) +{ + Uint32 *datap; + int i; + + + if (len > ERTS_MAX_REF_NUMBERS) { + /* Such large refs should no be able to appear in the emulator */ + erl_exit(1, "%s:%d: Internal error\n", __FILE__, __LINE__); + } + +#if defined(ARCH_64) && !HALFWORD_HEAP + hp[0] = make_ref_thing_header(len/2 + 1); + datap = (Uint32 *) &hp[1]; + *(datap++) = len; +#else + hp[0] = make_ref_thing_header(len); + datap = (Uint32 *) &hp[1]; +#endif + + for (i = 0; i < len; i++) + datap[i] = ref_numbers[i]; + + return make_internal_ref(hp); +} + +static int +eq_non_standard_ref_numbers(Uint32 *rn1, Uint32 len1, Uint32 *rn2, Uint32 len2) +{ +#if defined(ARCH_64) && !HALFWORD_HEAP +#define MAX_REF_HEAP_SZ (1+(ERTS_MAX_REF_NUMBERS/2+1)) +#else +#define MAX_REF_HEAP_SZ (1+ERTS_MAX_REF_NUMBERS) +#endif + DeclareTmpHeapNoproc(r1_hp,(MAX_REF_HEAP_SZ * 2)); + Eterm *r2_hp = r1_hp +MAX_REF_HEAP_SZ; + + return eq(create_ref(r1_hp, rn1, len1), create_ref(r2_hp, rn2, len2)); +#undef MAX_REF_HEAP_SZ +} + +static ERTS_INLINE int +eq_ref_numbers(Uint32 *rn1, Uint32 len1, Uint32 *rn2, Uint32 len2) +{ + int res; + if (len1 != ERTS_REF_NUMBERS || len2 != ERTS_REF_NUMBERS) { + /* Can potentially happen, but will never... */ + return eq_non_standard_ref_numbers(rn1, len1, rn2, len2); + } + +#if ERTS_REF_NUMBERS != 3 +#error "ERTS_REF_NUMBERS changed. Update me..." +#endif + res = rn1[0] == rn2[0] && rn1[1] == rn2[1] && rn1[2] == rn2[2]; + + ASSERT(res + ? eq_non_standard_ref_numbers(rn1, len1, rn2, len2) + : !eq_non_standard_ref_numbers(rn1, len1, rn2, len2)); + + return res; +} + +static ERTS_INLINE ErtsBifTimer * +tab_find(Eterm ref) +{ + Uint32 *ref_numbers = internal_ref_numbers(ref); + Uint32 ref_numbers_len = internal_ref_no_of_numbers(ref); + int ix = get_index(ref_numbers, ref_numbers_len); + ErtsBifTimer* btm; + + for (btm = bif_timer_tab[ix]; btm; btm = btm->tab.next) + if (eq_ref_numbers(ref_numbers, ref_numbers_len, + btm->ref_numbers, ERTS_REF_NUMBERS)) + return btm; + return NULL; +} + +static ERTS_INLINE void +tab_remove(ErtsBifTimer* btm) +{ + if (btm->flags & BTM_FLG_HEAD) { + *btm->tab.u.head = btm->tab.next; + if (btm->tab.next) { + btm->tab.next->flags |= BTM_FLG_HEAD; + btm->tab.next->tab.u.head = btm->tab.u.head; + } + } + else { + btm->tab.u.prev->tab.next = btm->tab.next; + if (btm->tab.next) + btm->tab.next->tab.u.prev = btm->tab.u.prev; + } + btm->flags |= BTM_FLG_CANCELED; + ASSERT(no_bif_timers > 0); + no_bif_timers--; +} + +static ERTS_INLINE void +tab_insert(ErtsBifTimer* btm) +{ + int ix = get_index(btm->ref_numbers, ERTS_REF_NUMBERS); + ErtsBifTimer* btm_list = bif_timer_tab[ix]; + + if (btm_list) { + btm_list->flags &= ~BTM_FLG_HEAD; + btm_list->tab.u.prev = btm; + } + + btm->flags |= BTM_FLG_HEAD; + btm->tab.u.head = &bif_timer_tab[ix]; + btm->tab.next = btm_list; + bif_timer_tab[ix] = btm; + no_bif_timers++; +} + +static ERTS_INLINE void +link_proc(Process *p, ErtsBifTimer* btm) +{ + btm->receiver.proc.ess = p; + btm->receiver.proc.prev = NULL; + btm->receiver.proc.next = p->u.bif_timers; + if (p->u.bif_timers) + p->u.bif_timers->receiver.proc.prev = btm; + p->u.bif_timers = btm; +} + +static ERTS_INLINE void +unlink_proc(ErtsBifTimer* btm) +{ + if (btm->receiver.proc.prev) + btm->receiver.proc.prev->receiver.proc.next = btm->receiver.proc.next; + else + btm->receiver.proc.ess->u.bif_timers = btm->receiver.proc.next; + if (btm->receiver.proc.next) + btm->receiver.proc.next->receiver.proc.prev = btm->receiver.proc.prev; +} + +static void +bif_timer_cleanup(ErtsBifTimer* btm) +{ + ASSERT(btm); + + if (btm->bp) + free_message_buffer(btm->bp); + + if (!btm_pre_free(btm)) { + if (btm->flags & BTM_FLG_SL_TIMER) + erts_free(ERTS_ALC_T_SL_BIF_TIMER, (void *) btm); + else + erts_free(ERTS_ALC_T_LL_BIF_TIMER, (void *) btm); + } +} + +static void +bif_timer_timeout(ErtsBifTimer* btm) +{ + ASSERT(btm); + + + erts_smp_btm_rwlock(); + + if (btm->flags & BTM_FLG_CANCELED) { + /* + * A concurrent cancel is ongoing. Do not send the timeout message, + * but cleanup here since the cancel call-back won't be called. + */ +#ifndef ERTS_SMP + ASSERT(0); +#endif + } + else { + ErtsProcLocks rp_locks = 0; + Process* rp; + + tab_remove(btm); + + ASSERT(!erts_get_current_process()); + + if (btm->flags & BTM_FLG_BYNAME) + rp = erts_whereis_process(NULL, 0, btm->receiver.name, 0, 0); + else { + rp = btm->receiver.proc.ess; + unlink_proc(btm); + } + + if (rp) { + Eterm message; + ErlHeapFragment *bp; + + bp = btm->bp; + btm->bp = NULL; /* Prevent cleanup of message buffer... */ + + if (!(btm->flags & BTM_FLG_WRAP)) + message = btm->message; + else { +#if ERTS_REF_NUMBERS != 3 +#error "ERTS_REF_NUMBERS changed. Update me..." +#endif + Eterm ref; + Uint *hp; + Uint wrap_size = REF_THING_SIZE + 4; + message = btm->message; + + if (!bp) { + ErlOffHeap *ohp; + ASSERT(is_immed(message)); + hp = erts_alloc_message_heap(wrap_size, + &bp, + &ohp, + rp, + &rp_locks); + } else { + Eterm old_size = bp->used_size; + bp = erts_resize_message_buffer(bp, old_size + wrap_size, + &message, 1); + hp = &bp->mem[0] + old_size; + } + + write_ref_thing(hp, + btm->ref_numbers[0], + btm->ref_numbers[1], + btm->ref_numbers[2]); + ref = make_internal_ref(hp); + hp += REF_THING_SIZE; + message = TUPLE3(hp, am_timeout, ref, message); + } + + erts_queue_message(rp, &rp_locks, bp, message, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); + erts_smp_proc_unlock(rp, rp_locks); + } + } + + erts_smp_btm_rwunlock(); + + bif_timer_cleanup(btm); +} + +static Eterm +setup_bif_timer(Uint32 xflags, + Process *c_p, + Eterm time, + Eterm receiver, + Eterm message) +{ + Process *rp; + ErtsBifTimer* btm; + Uint timeout; + Eterm ref; + Uint32 *ref_numbers; + + if (!term_to_Uint(time, &timeout)) + return THE_NON_VALUE; +#if defined(ARCH_64) && !HALFWORD_HEAP + if ((timeout >> 32) != 0) + return THE_NON_VALUE; +#endif + if (is_not_internal_pid(receiver) && is_not_atom(receiver)) + return THE_NON_VALUE; + + ref = erts_make_ref(c_p); + + if (is_atom(receiver)) + rp = NULL; + else { + rp = erts_pid2proc(c_p, ERTS_PROC_LOCK_MAIN, + receiver, ERTS_PROC_LOCK_MSGQ); + if (!rp) + return ref; + } + + if (timeout < ERTS_ALC_MIN_LONG_LIVED_TIME) { + if (timeout < 1000) { + btm = btm_pre_alloc(); + if (!btm) + goto sl_timer_alloc; + btm->flags = 0; + } + else { + sl_timer_alloc: + btm = (ErtsBifTimer *) erts_alloc(ERTS_ALC_T_SL_BIF_TIMER, + sizeof(ErtsBifTimer)); + btm->flags = BTM_FLG_SL_TIMER; + } + } + else { + btm = (ErtsBifTimer *) erts_alloc(ERTS_ALC_T_LL_BIF_TIMER, + sizeof(ErtsBifTimer)); + btm->flags = 0; + } + + if (rp) { + link_proc(rp, btm); + erts_smp_proc_unlock(rp, ERTS_PROC_LOCK_MSGQ); + } + else { + ASSERT(is_atom(receiver)); + btm->receiver.name = receiver; + btm->flags |= BTM_FLG_BYNAME; + } + + btm->flags |= xflags; + + ref_numbers = internal_ref_numbers(ref); + ASSERT(internal_ref_no_of_numbers(ref) == 3); +#if ERTS_REF_NUMBERS != 3 +#error "ERTS_REF_NUMBERS changed. Update me..." +#endif + btm->ref_numbers[0] = ref_numbers[0]; + btm->ref_numbers[1] = ref_numbers[1]; + btm->ref_numbers[2] = ref_numbers[2]; + + ASSERT(eq_ref_numbers(btm->ref_numbers, ERTS_REF_NUMBERS, + ref_numbers, ERTS_REF_NUMBERS)); + + if (is_immed(message)) { + btm->bp = NULL; + btm->message = message; + } + else { + ErlHeapFragment* bp; + Eterm* hp; + Uint size; + + size = size_object(message); + btm->bp = bp = new_message_buffer(size); + hp = bp->mem; + btm->message = copy_struct(message, size, &hp, &bp->off_heap); + } + + tab_insert(btm); + ASSERT(btm == tab_find(ref)); + btm->tm.active = 0; /* MUST be initalized */ + erts_set_timer(&btm->tm, + (ErlTimeoutProc) bif_timer_timeout, + (ErlCancelProc) bif_timer_cleanup, + (void *) btm, + timeout); + return ref; +} + +/* send_after(Time, Pid, Message) -> Ref */ +BIF_RETTYPE send_after_3(BIF_ALIST_3) +{ + Eterm res; + + if (erts_smp_safe_btm_rwlock(BIF_P, ERTS_PROC_LOCK_MAIN)) + ERTS_BIF_EXITED(BIF_P); + + res = setup_bif_timer(0, BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3); + + erts_smp_btm_rwunlock(); + + if (is_non_value(res)) { + BIF_ERROR(BIF_P, BADARG); + } + else { + ASSERT(is_internal_ref(res)); + BIF_RET(res); + } +} + +/* start_timer(Time, Pid, Message) -> Ref */ +BIF_RETTYPE start_timer_3(BIF_ALIST_3) +{ + Eterm res; + + if (erts_smp_safe_btm_rwlock(BIF_P, ERTS_PROC_LOCK_MAIN)) + ERTS_BIF_EXITED(BIF_P); + + res = setup_bif_timer(BTM_FLG_WRAP, BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3); + + erts_smp_btm_rwunlock(); + + if (is_non_value(res)) { + BIF_ERROR(BIF_P, BADARG); + } + else { + ASSERT(is_internal_ref(res)); + BIF_RET(res); + } +} + +/* cancel_timer(Ref) -> false | RemainingTime */ +BIF_RETTYPE cancel_timer_1(BIF_ALIST_1) +{ + Eterm res; + ErtsBifTimer *btm; + + if (is_not_internal_ref(BIF_ARG_1)) { + if (is_ref(BIF_ARG_1)) { + BIF_RET(am_false); + } + BIF_ERROR(BIF_P, BADARG); + } + + if (erts_smp_safe_btm_rwlock(BIF_P, ERTS_PROC_LOCK_MAIN)) + ERTS_BIF_EXITED(BIF_P); + + btm = tab_find(BIF_ARG_1); + if (!btm || btm->flags & BTM_FLG_CANCELED) { + erts_smp_btm_rwunlock(); + res = am_false; + } + else { + Uint left = erts_time_left(&btm->tm); + if (!(btm->flags & BTM_FLG_BYNAME)) { + erts_smp_proc_lock(btm->receiver.proc.ess, ERTS_PROC_LOCK_MSGQ); + unlink_proc(btm); + erts_smp_proc_unlock(btm->receiver.proc.ess, ERTS_PROC_LOCK_MSGQ); + } + tab_remove(btm); + ASSERT(!tab_find(BIF_ARG_1)); + erts_cancel_timer(&btm->tm); + erts_smp_btm_rwunlock(); + res = erts_make_integer(left, BIF_P); + } + + BIF_RET(res); +} + +/* read_timer(Ref) -> false | RemainingTime */ +BIF_RETTYPE read_timer_1(BIF_ALIST_1) +{ + Eterm res; + ErtsBifTimer *btm; + + if (is_not_internal_ref(BIF_ARG_1)) { + if (is_ref(BIF_ARG_1)) { + BIF_RET(am_false); + } + BIF_ERROR(BIF_P, BADARG); + } + + if (erts_smp_safe_btm_rlock(BIF_P, ERTS_PROC_LOCK_MAIN)) + ERTS_BIF_EXITED(BIF_P); + + btm = tab_find(BIF_ARG_1); + if (!btm || btm->flags & BTM_FLG_CANCELED) { + res = am_false; + } + else { + Uint left = erts_time_left(&btm->tm); + res = erts_make_integer(left, BIF_P); + } + + erts_smp_btm_runlock(); + + BIF_RET(res); +} + +void +erts_print_bif_timer_info(int to, void *to_arg) +{ + int i; + int lock = !ERTS_IS_CRASH_DUMPING; + + if (lock) + erts_smp_btm_rlock(); + + for (i = 0; i < TIMER_HASH_VEC_SZ; i++) { + ErtsBifTimer *btm; + for (btm = bif_timer_tab[i]; btm; btm = btm->tab.next) { + Eterm receiver = (btm->flags & BTM_FLG_BYNAME + ? btm->receiver.name + : btm->receiver.proc.ess->common.id); + erts_print(to, to_arg, "=timer:%T\n", receiver); + erts_print(to, to_arg, "Message: %T\n", btm->message); + erts_print(to, to_arg, "Time left: %u\n", + erts_time_left(&btm->tm)); + } + } + + if (lock) + erts_smp_btm_runlock(); +} + + +void +erts_cancel_bif_timers(Process *p, ErtsProcLocks plocks) +{ + ErtsBifTimer *btm; + + if (erts_smp_btm_tryrwlock() == EBUSY) { + erts_smp_proc_unlock(p, plocks); + erts_smp_btm_rwlock(); + erts_smp_proc_lock(p, plocks); + } + + btm = p->u.bif_timers; + while (btm) { + ErtsBifTimer *tmp_btm; + ASSERT(!(btm->flags & BTM_FLG_CANCELED)); + tab_remove(btm); + tmp_btm = btm; + btm = btm->receiver.proc.next; + erts_cancel_timer(&tmp_btm->tm); + } + + p->u.bif_timers = NULL; + + erts_smp_btm_rwunlock(); +} + +void erts_bif_timer_init(void) +{ + int i; + no_bif_timers = 0; + init_btm_pre_alloc(); + erts_smp_btm_lock_init(); + bif_timer_tab = erts_alloc(ERTS_ALC_T_BIF_TIMER_TABLE, + sizeof(ErtsBifTimer *)*TIMER_HASH_VEC_SZ); + for (i = 0; i < TIMER_HASH_VEC_SZ; ++i) + bif_timer_tab[i] = NULL; +} + +Uint +erts_bif_timer_memory_size(void) +{ + Uint res; + int lock = !ERTS_IS_CRASH_DUMPING; + + if (lock) + erts_smp_btm_rlock(); + + res = (sizeof(ErtsBifTimer *)*TIMER_HASH_VEC_SZ + + no_bif_timers*sizeof(ErtsBifTimer)); + + if (lock) + erts_smp_btm_runlock(); + + return res; +} + + +void +erts_bif_timer_foreach(void (*func)(Eterm, Eterm, ErlHeapFragment *, void *), + void *arg) +{ + int i; + + ERTS_SMP_LC_ASSERT(erts_smp_thr_progress_is_blocking()); + + for (i = 0; i < TIMER_HASH_VEC_SZ; i++) { + ErtsBifTimer *btm; + for (btm = bif_timer_tab[i]; btm; btm = btm->tab.next) { + (*func)((btm->flags & BTM_FLG_BYNAME + ? btm->receiver.name + : btm->receiver.proc.ess->common.id), + btm->message, + btm->bp, + arg); + } + } +} diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_timer.h erlang-17.3-dfsg/erts/emulator/beam/erl_bif_timer.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_timer.h 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_timer.h 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * %CopyrightBegin% + * + * Copyright Ericsson AB 2005-2009. All Rights Reserved. + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% + */ + + +#ifndef ERL_BIF_TIMER_H__ +#define ERL_BIF_TIMER_H__ + +typedef struct ErtsBifTimer_ ErtsBifTimer; + +#include "sys.h" +#include "erl_process.h" +#include "erl_message.h" + +Uint erts_bif_timer_memory_size(void); +void erts_print_bif_timer_info(int to, void *to_arg); +void erts_cancel_bif_timers(Process *p, ErtsProcLocks plocks); +void erts_bif_timer_init(void); +void erts_bif_timer_foreach(void (*func)(Eterm,Eterm,ErlHeapFragment *,void *), + void *arg); +#endif diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_trace.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_trace.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_trace.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_trace.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -39,7 +38,6 @@ #include "beam_bp.h" #include "erl_binary.h" #include "erl_thr_progress.h" -#include "erl_bif_unique.h" #define DECL_AM(S) Eterm AM_ ## S = am_atom_put(#S, sizeof(#S) - 1) @@ -360,7 +358,7 @@ ASSERT(finish_bp.stager == NULL); finish_bp.stager = p; erts_schedule_thr_prgr_later_op(smp_bp_finisher, NULL, &finish_bp.lop); - erts_proc_inc_refc(p); + erts_smp_proc_inc_refc(p); erts_suspend(p, ERTS_PROC_LOCK_MAIN, NULL); ERTS_BIF_YIELD_RETURN(p, make_small(matches)); } @@ -394,7 +392,7 @@ erts_resume(p, ERTS_PROC_LOCK_STATUS); } erts_smp_proc_unlock(p, ERTS_PROC_LOCK_STATUS); - erts_proc_dec_refc(p); + erts_smp_proc_dec_refc(p); } } #endif /* ERTS_SMP */ @@ -653,7 +651,7 @@ if (pid_spec == am_all) { if (on) { if (!erts_cpu_timestamp) { -#ifdef HAVE_CLOCK_GETTIME_CPU_TIME +#ifdef HAVE_CLOCK_GETTIME /* Perhaps clock_gettime was found during config on a different machine than this. We check @@ -680,7 +678,7 @@ if (erts_start_now_cpu() < 0) { goto error; } -#endif /* HAVE_CLOCK_GETTIME_CPU_TIME */ +#endif /* HAVE_CLOCK_GETTIME */ erts_cpu_timestamp = !0; } } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_unique.c erlang-17.3-dfsg/erts/emulator/beam/erl_bif_unique.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_unique.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_unique.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,557 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2014. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "sys.h" -#include "erl_vm.h" -#include "erl_alloc.h" -#include "export.h" -#include "bif.h" -#include "erl_bif_unique.h" - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * Reference * -\* */ - -static union { - erts_atomic64_t count; - char align__[ERTS_CACHE_LINE_SIZE]; -} global_reference erts_align_attribute(ERTS_CACHE_LINE_SIZE); - - -/* - * ref[0] indicate thread creating reference as follows: - * - * - ref[0] == 0 => Non-scheduler thread; - * - else; ref[0] <= erts_no_schedulers => - * ordinary scheduler with id == ref[0]; - * - else; ref[0] <= erts_no_schedulers - * + erts_no_dirty_cpu_schedulers => - * dirty cpu scheduler with id == 'ref[0] - erts_no_schedulers'; - * - else => - * dirty io scheduler with id == 'ref[0] - * - erts_no_schedulers - * - erts_no_dirty_cpu_schedulers' - */ - -#ifdef DEBUG -static Uint32 max_thr_id; -#endif - -static void -init_reference(void) -{ -#ifdef DEBUG - max_thr_id = (Uint32) erts_no_schedulers; -#ifdef ERTS_DIRTY_SCHEDULERS - max_thr_id += (Uint32) erts_no_dirty_cpu_schedulers; - max_thr_id += (Uint32) erts_no_dirty_io_schedulers; -#endif -#endif - erts_atomic64_init_nob(&global_reference.count, 0); -} - -static ERTS_INLINE void -global_make_ref_in_array(Uint32 thr_id, Uint32 ref[ERTS_MAX_REF_NUMBERS]) -{ - Uint64 value; - - value = (Uint64) erts_atomic64_inc_read_mb(&global_reference.count); - - erts_set_ref_numbers(ref, thr_id, value); -} - -static ERTS_INLINE void -make_ref_in_array(Uint32 ref[ERTS_MAX_REF_NUMBERS]) -{ - ErtsSchedulerData *esdp = erts_get_scheduler_data(); - if (esdp) - erts_sched_make_ref_in_array(esdp, ref); - else - global_make_ref_in_array(0, ref); -} - -void -erts_make_ref_in_array(Uint32 ref[ERTS_MAX_REF_NUMBERS]) -{ - make_ref_in_array(ref); -} - -Eterm erts_make_ref_in_buffer(Eterm buffer[REF_THING_SIZE]) -{ - Eterm* hp = buffer; - Uint32 ref[ERTS_MAX_REF_NUMBERS]; - - make_ref_in_array(ref); - write_ref_thing(hp, ref[0], ref[1], ref[2]); - return make_internal_ref(hp); -} - -Eterm erts_make_ref(Process *c_p) -{ - Eterm* hp; - Uint32 ref[ERTS_MAX_REF_NUMBERS]; - - ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(c_p)); - - hp = HAlloc(c_p, REF_THING_SIZE); - - make_ref_in_array(ref); - write_ref_thing(hp, ref[0], ref[1], ref[2]); - - return make_internal_ref(hp); -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * Unique Integer * -\* */ - -static struct { - union { - struct { - int left_shift; - int right_shift; - Uint64 mask; - Uint64 val0_max; - } o; - char align__[ERTS_CACHE_LINE_SIZE]; - } r; - union { - erts_atomic64_t val1; - char align__[ERTS_CACHE_LINE_SIZE]; - } w; -} unique_data erts_align_attribute(ERTS_CACHE_LINE_SIZE); - -static void -init_unique_integer(void) -{ - int bits; - unique_data.r.o.val0_max = (Uint64) erts_no_schedulers; -#ifdef ERTS_DIRTY_SCHEDULERS - unique_data.r.o.val0_max += (Uint64) erts_no_dirty_cpu_schedulers; - unique_data.r.o.val0_max += (Uint64) erts_no_dirty_io_schedulers; -#endif - bits = erts_fit_in_bits_int64(unique_data.r.o.val0_max); - unique_data.r.o.left_shift = bits; - unique_data.r.o.right_shift = 64 - bits; - unique_data.r.o.mask = (((Uint64) 1) << bits) - 1; - erts_atomic64_init_nob(&unique_data.w.val1, -1); -} - -#define ERTS_MAX_UNIQUE_INT_HEAP_SIZE ERTS_UINT64_ARRAY_TO_BIG_MAX_HEAP_SZ(2) - -static ERTS_INLINE Eterm -bld_unique_integer_term(Eterm **hpp, Uint *szp, - Uint64 val0, Uint64 val1, - int positive) -{ - Uint hsz; - Uint64 unique_val[2]; - - unique_val[0] = ((Uint64) val0); - unique_val[0] |= ((Uint64) val1) << unique_data.r.o.left_shift; - unique_val[1] = ((Uint64) val1) >> unique_data.r.o.right_shift; - unique_val[1] &= unique_data.r.o.mask; - - if (positive) { - unique_val[0]++; - if (unique_val[0] == 0) - unique_val[1]++; - } - else { - ASSERT(MIN_SMALL < 0); - if (unique_val[1] == 0 - && unique_val[0] < ((Uint64) -1*((Sint64) MIN_SMALL))) { - Sint64 s_unique_val = (Sint64) unique_val[0]; - s_unique_val += MIN_SMALL; - ASSERT(MIN_SMALL <= s_unique_val && s_unique_val < 0); - if (szp) - *szp = 0; - if (!hpp) - return THE_NON_VALUE; - return make_small((Sint) s_unique_val); - } - if (unique_val[0] < ((Uint64) -1*((Sint64) MIN_SMALL))) { - ASSERT(unique_val[1] != 0); - unique_val[1] -= 1; - } - unique_val[0] += MIN_SMALL; - } - - if (!unique_val[1]) { - if (unique_val[0] <= MAX_SMALL) { - if (szp) - *szp = 0; - if (!hpp) - return THE_NON_VALUE; - return make_small((Uint) unique_val[0]); - } - - if (szp) - *szp = ERTS_UINT64_HEAP_SIZE(unique_val[0]); - if (!hpp) - return THE_NON_VALUE; - return erts_uint64_to_big(unique_val[0], hpp); - } - else { - Eterm tmp, *tmp_hp, res; - DeclareTmpHeapNoproc(local_heap, 2*ERTS_MAX_UNIQUE_INT_HEAP_SIZE); - - UseTmpHeapNoproc(2*ERTS_MAX_UNIQUE_INT_HEAP_SIZE); - - tmp_hp = local_heap; - - tmp = erts_uint64_array_to_big(&tmp_hp, 0, 2, unique_val); - ASSERT(is_big(tmp)); - - hsz = big_arity(tmp) + 1; - - ASSERT(hsz <= ERTS_MAX_UNIQUE_INT_HEAP_SIZE); - - if (szp) - *szp = hsz; - - if (!hpp) - res = THE_NON_VALUE; - else { - int hix; - Eterm *hp = *hpp; - tmp_hp = big_val(tmp); - for (hix = 0; hix < hsz; hix++) - hp[hix] = tmp_hp[hix]; - - *hpp = hp + hsz; - res = make_big(hp); - } - - UnUseTmpHeapNoproc(2*ERTS_MAX_UNIQUE_INT_HEAP_SIZE); - - return res; - } -} - -static ERTS_INLINE Eterm unique_integer_bif(Process *c_p, int positive) -{ - ErtsSchedulerData *esdp; - Uint64 thr_id, unique; - Uint hsz; - Eterm *hp; - - esdp = ERTS_PROC_GET_SCHDATA(c_p); - thr_id = (Uint64) esdp->thr_id; - unique = esdp->unique++; - bld_unique_integer_term(NULL, &hsz, thr_id, unique, positive); - hp = hsz ? HAlloc(c_p, hsz) : NULL; - return bld_unique_integer_term(&hp, NULL, thr_id, unique, positive); -} - -Uint -erts_raw_unique_integer_heap_size(Uint64 val[ERTS_UNIQUE_INT_RAW_VALUES]) -{ - Uint sz; - bld_unique_integer_term(NULL, &sz, val[0], val[1], 0); - return sz; -} - -Eterm -erts_raw_make_unique_integer(Eterm **hpp, Uint64 val[ERTS_UNIQUE_INT_RAW_VALUES]) -{ - return bld_unique_integer_term(hpp, NULL, val[0], val[1], 0); -} - -void -erts_raw_get_unique_integer(Uint64 val[ERTS_UNIQUE_INT_RAW_VALUES]) -{ - ErtsSchedulerData *esdp = erts_get_scheduler_data(); - if (esdp) { - val[0] = (Uint64) esdp->thr_id; - val[1] = esdp->unique++; - } - else { - val[0] = (Uint64) 0; - val[1] = (Uint64) erts_atomic64_inc_read_nob(&unique_data.w.val1); - } -} - - -Sint64 -erts_get_min_unique_integer(void) -{ - return (Sint64) MIN_SMALL; -} - -/* --- Debug --- */ - -Eterm -erts_debug_make_unique_integer(Process *c_p, Eterm etval0, Eterm etval1) -{ - Uint64 val0, val1; - Uint hsz; - Eterm res, *hp, *end_hp; - - if (!term_to_Uint64(etval0, &val0)) - return THE_NON_VALUE; - - if (!term_to_Uint64(etval1, &val1)) - return THE_NON_VALUE; - - bld_unique_integer_term(NULL, &hsz, val0, val1, 0); - - hp = HAlloc(c_p, hsz); - end_hp = hp + hsz; - - res = bld_unique_integer_term(&hp, NULL, val0, val1, 0); - if (hp != end_hp) - ERTS_INTERNAL_ERROR("Heap allocation error"); - - return res; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * Strict Monotonic Counter * -\* */ - -static struct { - union { - erts_atomic64_t value; - char align__[ERTS_CACHE_LINE_SIZE]; - } w; -} raw_unique_monotonic_integer erts_align_attribute(ERTS_CACHE_LINE_SIZE); - -#if defined(ARCH_32) || HALFWORD_HEAP -# define ERTS_UNIQUE_MONOTONIC_OFFSET ERTS_SINT64_MIN -#else -# define ERTS_UNIQUE_MONOTONIC_OFFSET MIN_SMALL -#endif - -static void -init_unique_monotonic_integer(void) -{ - erts_atomic64_init_nob(&raw_unique_monotonic_integer.w.value, - (erts_aint64_t) -1); -} - -static ERTS_INLINE Uint64 -get_raw_unique_monotonic_integer(void) -{ - return (Uint64) erts_atomic64_inc_read_mb(&raw_unique_monotonic_integer.w.value); -} - -static ERTS_INLINE Uint -get_unique_monotonic_integer_heap_size(Uint64 raw, int positive) -{ - if (positive) { - Uint64 value = raw+1; - return ERTS_UINT64_HEAP_SIZE(value); - } - else { - Sint64 value = ((Sint64) raw) + ERTS_UNIQUE_MONOTONIC_OFFSET; - if (IS_SSMALL(value)) - return 0; -#if defined(ARCH_32) || HALFWORD_HEAP - return ERTS_SINT64_HEAP_SIZE(value); -#else - return ERTS_UINT64_HEAP_SIZE((Uint64) value); -#endif - } -} - -static ERTS_INLINE Eterm -make_unique_monotonic_integer_value(Eterm *hp, Uint hsz, Uint64 raw, int positive) -{ - Eterm res; -#ifdef DEBUG - Eterm *end_hp = hp + hsz; -#endif - - if (positive) { - Uint64 value = raw+1; - res = hsz ? erts_uint64_to_big(value, &hp) : make_small(value); - } - else { - Sint64 value = ((Sint64) raw) + ERTS_UNIQUE_MONOTONIC_OFFSET; - if (hsz == 0) - res = make_small(value); - else { -#if defined(ARCH_32) || HALFWORD_HEAP - res = erts_sint64_to_big(value, &hp); -#else - res = erts_uint64_to_big((Uint64) value, &hp); -#endif - } - } - - ASSERT(end_hp == hp); - - return res; -} - -static ERTS_INLINE Eterm -unique_monotonic_integer_bif(Process *c_p, int positive) -{ - Uint64 raw; - Uint hsz; - Eterm *hp; - - raw = get_raw_unique_monotonic_integer(); - hsz = get_unique_monotonic_integer_heap_size(raw, positive); - hp = hsz ? HAlloc(c_p, hsz) : NULL; - return make_unique_monotonic_integer_value(hp, hsz, raw, positive); -} - -Sint64 -erts_raw_get_unique_monotonic_integer(void) -{ - return get_raw_unique_monotonic_integer(); -} - -Uint -erts_raw_unique_monotonic_integer_heap_size(Sint64 raw) -{ - return get_unique_monotonic_integer_heap_size(raw, 0); -} - -Eterm -erts_raw_make_unique_monotonic_integer_value(Eterm **hpp, Sint64 raw) -{ - Uint hsz = get_unique_monotonic_integer_heap_size(raw, 0); - Eterm res = make_unique_monotonic_integer_value(*hpp, hsz, raw, 0); - *hpp += hsz; - return res; -} - -Sint64 -erts_get_min_unique_monotonic_integer(void) -{ - return ERTS_UNIQUE_MONOTONIC_OFFSET; -} - -/* --- Debug --- */ - -int -erts_debug_set_unique_monotonic_integer_state(Eterm et_value) -{ - Sint64 value; - - if (!term_to_Sint64(et_value, &value)) { - Uint64 uvalue; - if (!term_to_Uint64(et_value, &uvalue)) - return 0; - value = (Sint64) uvalue; - } - - erts_atomic64_set_mb(&raw_unique_monotonic_integer.w.value, - (erts_aint64_t) value); - return 1; -} - -Eterm -erts_debug_get_unique_monotonic_integer_state(Process *c_p) -{ - Uint64 value; - Eterm hsz, *hp; - - value = (Uint64) erts_atomic64_read_mb(&raw_unique_monotonic_integer.w.value); - - if (IS_USMALL(0, value)) - return make_small(value); - hsz = ERTS_UINT64_HEAP_SIZE(value); - hp = HAlloc(c_p, hsz); - return erts_uint64_to_big(value, &hp); -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * Initilazation * -\* */ - -void -erts_bif_unique_init(void) -{ - init_reference(); - init_unique_monotonic_integer(); - init_unique_integer(); -} - -void -erts_sched_bif_unique_init(ErtsSchedulerData *esdp) -{ - esdp->unique = (Uint64) 0; - esdp->ref = (Uint64) 0; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * The BIFs * -\* */ - - -BIF_RETTYPE make_ref_0(BIF_ALIST_0) -{ - BIF_RETTYPE res; - Eterm* hp; - - ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(BIF_P)); - - hp = HAlloc(BIF_P, REF_THING_SIZE); - - res = erts_sched_make_ref_in_buffer(ERTS_PROC_GET_SCHDATA(BIF_P), hp); - - BIF_RET(res); -} - -BIF_RETTYPE unique_integer_0(BIF_ALIST_0) -{ - BIF_RET(unique_integer_bif(BIF_P, 0)); -} - -BIF_RETTYPE unique_integer_1(BIF_ALIST_1) -{ - Eterm modlist = BIF_ARG_1; - int monotonic = 0; - int positive = 0; - BIF_RETTYPE res; - - while (is_list(modlist)) { - Eterm *consp = list_val(modlist); - switch (CAR(consp)) { - case am_monotonic: - monotonic = 1; - break; - case am_positive: - positive = 1; - break; - default: - BIF_ERROR(BIF_P, BADARG); - } - modlist = CDR(consp); - } - - if (is_not_nil(modlist)) - BIF_ERROR(BIF_P, BADARG); - - if (monotonic) - res = unique_monotonic_integer_bif(BIF_P, positive); - else - res = unique_integer_bif(BIF_P, positive); - - BIF_RET(res); -} diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bif_unique.h erlang-17.3-dfsg/erts/emulator/beam/erl_bif_unique.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_bif_unique.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bif_unique.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2014. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -#ifndef ERTS_BIF_UNIQUE_H__ -#define ERTS_BIF_UNIQUE_H__ - -#include "erl_process.h" -#include "big.h" - -void erts_bif_unique_init(void); -void erts_sched_bif_unique_init(ErtsSchedulerData *esdp); - -/* reference */ -Eterm erts_make_ref(Process *); -Eterm erts_make_ref_in_buffer(Eterm buffer[REF_THING_SIZE]); -void erts_make_ref_in_array(Uint32 ref[ERTS_MAX_REF_NUMBERS]); - -/* strict monotonic counter */ - -#define ERTS_MAX_UNIQUE_MONOTONIC_INTEGER_HEAP_SIZE ERTS_MAX_UINT64_HEAP_SIZE - -/* - * Note that a raw value is an intermediate value that - * not necessarily correspond to the end result. - */ -Sint64 erts_raw_get_unique_monotonic_integer(void); -Uint erts_raw_unique_monotonic_integer_heap_size(Sint64 raw); -Eterm erts_raw_make_unique_monotonic_integer_value(Eterm **hpp, Sint64 raw); - -Sint64 erts_get_min_unique_monotonic_integer(void); - -int erts_debug_set_unique_monotonic_integer_state(Eterm et_value); -Eterm erts_debug_get_unique_monotonic_integer_state(Process *c_p); - -/* unique integer */ -#define ERTS_UNIQUE_INT_RAW_VALUES 2 -#define ERTS_MAX_UNIQUE_INT_HEAP_SIZE ERTS_UINT64_ARRAY_TO_BIG_MAX_HEAP_SZ(2) - -Uint erts_raw_unique_integer_heap_size(Uint64 val[ERTS_UNIQUE_INT_RAW_VALUES]); -Eterm erts_raw_make_unique_integer(Eterm **hpp, Uint64 val[ERTS_UNIQUE_INT_RAW_VALUES]); -void erts_raw_get_unique_integer(Uint64 val[ERTS_UNIQUE_INT_RAW_VALUES]); -Sint64 erts_get_min_unique_integer(void); - -Eterm erts_debug_make_unique_integer(Process *c_p, - Eterm etval0, - Eterm etval1); - - -ERTS_GLB_INLINE void erts_set_ref_numbers(Uint32 ref[ERTS_MAX_REF_NUMBERS], - Uint32 thr_id, Uint64 value); -ERTS_GLB_INLINE Uint32 erts_get_ref_numbers_thr_id(Uint32 ref[ERTS_MAX_REF_NUMBERS]); -ERTS_GLB_INLINE Uint64 erts_get_ref_numbers_value(Uint32 ref[ERTS_MAX_REF_NUMBERS]); -ERTS_GLB_INLINE void erts_sched_make_ref_in_array(ErtsSchedulerData *esdp, - Uint32 ref[ERTS_MAX_REF_NUMBERS]); -ERTS_GLB_INLINE Eterm erts_sched_make_ref_in_buffer(ErtsSchedulerData *esdp, - Eterm buffer[REF_THING_SIZE]); - -#if ERTS_GLB_INLINE_INCL_FUNC_DEF - -ERTS_GLB_INLINE void -erts_set_ref_numbers(Uint32 ref[ERTS_MAX_REF_NUMBERS], Uint32 thr_id, Uint64 value) -{ - /* - * We cannot use thread id in the first 18-bit word since - * the hash/phash/phash2 BIFs only hash on this word. If - * we did, we would get really poor hash values. Instead - * we have to shuffle the bits a bit. - */ - ASSERT(thr_id == (thr_id & ((Uint32) 0x3ffff))); - ref[0] = (Uint32) (value & ((Uint64) 0x3ffff)); - ref[1] = (((Uint32) (value & ((Uint64) 0xfffc0000))) - | (thr_id & ((Uint32) 0x3ffff))); - ref[2] = (Uint32) ((value >> 32) & ((Uint64) 0xffffffff)); -} - -ERTS_GLB_INLINE Uint32 -erts_get_ref_numbers_thr_id(Uint32 ref[ERTS_MAX_REF_NUMBERS]) -{ - return ref[1] & ((Uint32) 0x3ffff); -} - -ERTS_GLB_INLINE Uint64 -erts_get_ref_numbers_value(Uint32 ref[ERTS_MAX_REF_NUMBERS]) -{ - return (((((Uint64) ref[2]) & ((Uint64) 0xffffffff)) << 32) - | (((Uint64) ref[1]) & ((Uint64) 0xfffc0000)) - | (((Uint64) ref[0]) & ((Uint64) 0x3ffff))); -} - -ERTS_GLB_INLINE void -erts_sched_make_ref_in_array(ErtsSchedulerData *esdp, - Uint32 ref[ERTS_MAX_REF_NUMBERS]) -{ - Uint64 value; - - ASSERT(esdp); - value = esdp->ref++; - erts_set_ref_numbers(ref, (Uint32) esdp->thr_id, value); -} - -ERTS_GLB_INLINE Eterm -erts_sched_make_ref_in_buffer(ErtsSchedulerData *esdp, - Eterm buffer[REF_THING_SIZE]) -{ - Eterm* hp = buffer; - Uint32 ref[ERTS_MAX_REF_NUMBERS]; - - erts_sched_make_ref_in_array(esdp, ref); - write_ref_thing(hp, ref[0], ref[1], ref[2]); - return make_internal_ref(hp); -} - -#endif /* ERTS_GLB_INLINE_INCL_FUNC_DEF */ - -#endif /* ERTS_BIF_UNIQUE_H__ */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_binary.h erlang-17.3-dfsg/erts/emulator/beam/erl_binary.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_binary.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_binary.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -195,9 +194,6 @@ ERTS_GLB_INLINE Binary *erts_bin_realloc_fnf(Binary *bp, Uint size); ERTS_GLB_INLINE Binary *erts_bin_realloc(Binary *bp, Uint size); ERTS_GLB_INLINE void erts_bin_free(Binary *bp); -ERTS_GLB_INLINE Binary *erts_create_magic_binary_x(Uint size, - void (*destructor)(Binary *), - int unaligned); ERTS_GLB_INLINE Binary *erts_create_magic_binary(Uint size, void (*destructor)(Binary *)); @@ -235,58 +231,41 @@ # define CHICKEN_PAD (sizeof(void*) - 1) #endif -/* Caller must initialize 'refc' -*/ ERTS_GLB_INLINE Binary * erts_bin_drv_alloc_fnf(Uint size) { Uint bsize = ERTS_SIZEOF_Binary(size) + CHICKEN_PAD; - Binary *res; - + void *res; if (bsize < size) /* overflow */ return NULL; res = erts_alloc_fnf(ERTS_ALC_T_DRV_BINARY, bsize); ERTS_CHK_BIN_ALIGNMENT(res); - if (res) { - res->orig_size = size; - res->flags = BIN_FLAG_DRV; - } - return res; + return (Binary *) res; } -/* Caller must initialize 'refc' -*/ ERTS_GLB_INLINE Binary * erts_bin_drv_alloc(Uint size) { Uint bsize = ERTS_SIZEOF_Binary(size) + CHICKEN_PAD; - Binary *res; - + void *res; if (bsize < size) /* overflow */ erts_alloc_enomem(ERTS_ALC_T_DRV_BINARY, size); res = erts_alloc(ERTS_ALC_T_DRV_BINARY, bsize); ERTS_CHK_BIN_ALIGNMENT(res); - res->orig_size = size; - res->flags = BIN_FLAG_DRV; - return res; + return (Binary *) res; } -/* Caller must initialize 'refc' -*/ ERTS_GLB_INLINE Binary * erts_bin_nrml_alloc(Uint size) { Uint bsize = ERTS_SIZEOF_Binary(size) + CHICKEN_PAD; - Binary *res; - + void *res; if (bsize < size) /* overflow */ erts_alloc_enomem(ERTS_ALC_T_BINARY, size); res = erts_alloc(ERTS_ALC_T_BINARY, bsize); ERTS_CHK_BIN_ALIGNMENT(res); - res->orig_size = size; - res->flags = 0; - return res; + return (Binary *) res; } ERTS_GLB_INLINE Binary * @@ -301,8 +280,6 @@ return NULL; nbp = erts_realloc_fnf(type, (void *) bp, bsize); ERTS_CHK_BIN_ALIGNMENT(nbp); - if (nbp) - nbp->orig_size = size; return nbp; } @@ -320,7 +297,6 @@ if (!nbp) erts_realloc_enomem(type, bp, bsize); ERTS_CHK_BIN_ALIGNMENT(nbp); - nbp->orig_size = size; return nbp; } @@ -336,30 +312,21 @@ } ERTS_GLB_INLINE Binary * -erts_create_magic_binary_x(Uint size, void (*destructor)(Binary *), - int unaligned) +erts_create_magic_binary(Uint size, void (*destructor)(Binary *)) { - Uint bsize = unaligned ? ERTS_MAGIC_BIN_UNALIGNED_SIZE(size) - : ERTS_MAGIC_BIN_SIZE(size); + Uint bsize = ERTS_MAGIC_BIN_SIZE(size); Binary* bptr = erts_alloc_fnf(ERTS_ALC_T_BINARY, bsize); ASSERT(bsize > size); if (!bptr) erts_alloc_n_enomem(ERTS_ALC_T2N(ERTS_ALC_T_BINARY), bsize); ERTS_CHK_BIN_ALIGNMENT(bptr); bptr->flags = BIN_FLAG_MAGIC; - bptr->orig_size = unaligned ? ERTS_MAGIC_BIN_UNALIGNED_ORIG_SIZE(size) - : ERTS_MAGIC_BIN_ORIG_SIZE(size); + bptr->orig_size = ERTS_MAGIC_BIN_ORIG_SIZE(size); erts_refc_init(&bptr->refc, 0); ERTS_MAGIC_BIN_DESTRUCTOR(bptr) = destructor; return bptr; } -ERTS_GLB_INLINE Binary * -erts_create_magic_binary(Uint size, void (*destructor)(Binary *)) -{ - return erts_create_magic_binary_x(size, destructor, 0); -} - #endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */ -#endif /* !__ERL_BINARY_H */ +#endif diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bits.c erlang-17.3-dfsg/erts/emulator/beam/erl_bits.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_bits.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bits.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -108,14 +107,6 @@ void erts_init_bits(void) { - ERTS_CT_ASSERT(offsetof(Binary,orig_bytes) % 8 == 0); - ERTS_CT_ASSERT(offsetof(ErtsMagicBinary,u.aligned.data) % 8 == 0); - ERTS_CT_ASSERT(ERTS_MAGIC_BIN_BYTES_TO_ALIGN == - (offsetof(ErtsMagicBinary,u.aligned.data) - - offsetof(ErtsMagicBinary,u.unaligned.data))); - ERTS_CT_ASSERT(offsetof(ErtsBinary,driver.binary.orig_bytes) - == offsetof(Binary,orig_bytes)); - erts_smp_atomic_init_nob(&bits_bufs_size, 0); #if defined(ERTS_SMP) /* erl_process.c calls erts_bits_init_state() on all state instances */ @@ -174,26 +165,6 @@ return make_matchstate(ms); } -#ifdef DEBUG -# define CHECK_MATCH_BUFFER(MB) check_match_buffer(MB) - -static void check_match_buffer(ErlBinMatchBuffer* mb) -{ - Eterm realbin; - Uint byteoffs; - byte* bytes, bitoffs, bitsz; - ProcBin* pb; - ERTS_GET_REAL_BIN(mb->orig, realbin, byteoffs, bitoffs, bitsz); - bytes = binary_bytes(realbin) + byteoffs; - ERTS_ASSERT(mb->base >= bytes && mb->base <= (bytes + binary_size(mb->orig))); - pb = (ProcBin *) boxed_val(realbin); - if (pb->thing_word == HEADER_PROC_BIN) - ERTS_ASSERT(pb->flags == 0); -} -#else -# define CHECK_MATCH_BUFFER(MB) -#endif - Eterm erts_bs_get_integer_2(Process *p, Uint num_bits, unsigned flags, ErlBinMatchBuffer* mb) { @@ -214,7 +185,6 @@ return SMALL_ZERO; } - CHECK_MATCH_BUFFER(mb); if (mb->size - mb->offset < num_bits) { /* Asked for too many bits. */ return THE_NON_VALUE; } @@ -433,10 +403,7 @@ words_needed = 1+WSIZE(bytes); hp = HeapOnlyAlloc(p, words_needed); res = bytes_to_big(LSB, bytes, sgn, hp); - if (is_nil(res)) { - p->htop = hp; - res = THE_NON_VALUE; - } else if (is_small(res)) { + if (is_small(res)) { p->htop = hp; } else if ((actual = bignum_header_arity(*hp)+1) < words_needed) { p->htop = hp + actual; @@ -455,7 +422,6 @@ { ErlSubBin* sb; - CHECK_MATCH_BUFFER(mb); if (mb->size - mb->offset < num_bits) { /* Asked for too many bits. */ return THE_NON_VALUE; } @@ -487,7 +453,6 @@ byte* fptr; FloatDef f; - CHECK_MATCH_BUFFER(mb); if (num_bits == 0) { f.fd = 0.0; hp = HeapOnlyAlloc(p, FLOAT_SIZE_OBJECT); @@ -541,8 +506,6 @@ { ErlSubBin* sb; Uint size; - - CHECK_MATCH_BUFFER(mb); size = mb->size-mb->offset; sb = (ErlSubBin *) HeapOnlyAlloc(p, ERL_SUB_BIN_SIZE); sb->thing_word = HEADER_SUB_BIN; @@ -1336,6 +1299,7 @@ if (binp->orig_size < pb->size) { Uint new_size = 2*pb->size; binp = erts_bin_realloc(binp, new_size); + binp->orig_size = new_size; pb->val = binp; pb->bytes = (byte *) binp->orig_bytes; } @@ -1407,6 +1371,8 @@ * Allocate the binary data struct itself. */ bptr = erts_bin_nrml_alloc(bin_size); + bptr->flags = 0; + bptr->orig_size = bin_size; erts_refc_init(&bptr->refc, 1); erts_current_bin = (byte *) bptr->orig_bytes; @@ -1509,6 +1475,7 @@ * is safe to reallocate it. */ binp = erts_bin_realloc(binp, new_size); + binp->orig_size = new_size; pb->val = binp; pb->bytes = (byte *) binp->orig_bytes; } else { @@ -1521,6 +1488,8 @@ * binary and copy the contents of the old binary into it. */ Binary* bptr = erts_bin_nrml_alloc(new_size); + bptr->flags = 0; + bptr->orig_size = new_size; erts_refc_init(&bptr->refc, 1); sys_memcpy(bptr->orig_bytes, binp->orig_bytes, binp->orig_size); pb->flags |= PB_IS_WRITABLE | PB_ACTIVE_WRITER; @@ -1568,6 +1537,8 @@ * Allocate the binary data struct itself. */ bptr = erts_bin_nrml_alloc(bin_size); + bptr->flags = 0; + bptr->orig_size = bin_size; erts_refc_init(&bptr->refc, 1); /* @@ -1614,7 +1585,9 @@ /* Our allocators are 8 byte aligned, i.e., shrinking with less than 8 bytes will have no real effect */ if (unused >= 8) { + Uint new_size = pb->size; binp = erts_bin_realloc(binp, pb->size); + binp->orig_size = new_size; pb->val = binp; pb->bytes = (byte *) binp->orig_bytes; } @@ -1629,7 +1602,6 @@ byte* LSB; byte* MSB; - CHECK_MATCH_BUFFER(mb); ASSERT((mb->offset & 7) != 0); ASSERT(mb->size - mb->offset >= 32); @@ -1689,8 +1661,6 @@ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,9,9,9,9,9,9,9,9 }; - CHECK_MATCH_BUFFER(mb); - if ((remaining_bits = mb->size - mb->offset) < 8) { return THE_NON_VALUE; } @@ -1775,7 +1745,6 @@ return THE_NON_VALUE; } - CHECK_MATCH_BUFFER(mb); /* * Set up the pointer to the source bytes. */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_bits.h erlang-17.3-dfsg/erts/emulator/beam/erl_bits.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_bits.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_bits.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_cpu_topology.c erlang-17.3-dfsg/erts/emulator/beam/erl_cpu_topology.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_cpu_topology.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_cpu_topology.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_cpu_topology.h erlang-17.3-dfsg/erts/emulator/beam/erl_cpu_topology.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_cpu_topology.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_cpu_topology.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_db.c erlang-17.3-dfsg/erts/emulator/beam/erl_db.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_db.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_db.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -280,8 +279,6 @@ erts_smp_rwmtx_opt_t rwmtx_opt = ERTS_SMP_RWMTX_OPT_DEFAULT_INITER; if (use_frequent_read_lock) rwmtx_opt.type = ERTS_SMP_RWMTX_TYPE_FREQUENT_READ; - if (erts_ets_rwmtx_spin_count >= 0) - rwmtx_opt.main_spincount = erts_ets_rwmtx_spin_count; #endif #ifdef ERTS_SMP erts_smp_rwmtx_init_opt_x(&tb->common.rwlock, &rwmtx_opt, @@ -623,7 +620,7 @@ erts_fprintf(stderr, "ets:safe_fixtable(%T,%T); Process: %T, initial: %T:%T/%bpu\n", BIF_ARG_1, BIF_ARG_2, BIF_P->common.id, - BIF_P->u.initial[0], BIF_P->u.initial[1], BIF_P->u.initial[2]); + BIF_P->initial[0], BIF_P->initial[1], BIF_P->initial[2]); #endif kind = (BIF_ARG_2 == am_true) ? LCK_READ : LCK_WRITE_REC; @@ -756,31 +753,6 @@ BIF_RET(ret); } -/* -** take(Tab, Key) -*/ -BIF_RETTYPE ets_take_2(BIF_ALIST_2) -{ - DbTable* tb; -#ifdef DEBUG - int cret; -#endif - Eterm ret; - CHECK_TABLES(); - - tb = db_get_table(BIF_P, BIF_ARG_1, DB_WRITE, LCK_WRITE_REC); - if (!tb) { - BIF_ERROR(BIF_P, BADARG); - } -#ifdef DEBUG - cret = -#endif - tb->common.meth->db_take(BIF_P, tb, BIF_ARG_2, &ret); - ASSERT(cret == DB_ERROR_NONE); - db_unlock(tb, LCK_WRITE_REC); - BIF_RET(ret); -} - /* ** update_element(Tab, Key, {Pos, Value}) ** update_element(Tab, Key, [{Pos, Value}]) @@ -808,7 +780,7 @@ list = BIF_ARG_3; } - if (!tb->common.meth->db_lookup_dbterm(BIF_P, tb, BIF_ARG_2, THE_NON_VALUE, &handle)) { + if (!tb->common.meth->db_lookup_dbterm(tb, BIF_ARG_2, &handle)) { cret = DB_ERROR_BADKEY; goto bail_out; } @@ -847,7 +819,7 @@ } finalize: - tb->common.meth->db_finalize_dbterm(cret, &handle); + tb->common.meth->db_finalize_dbterm(&handle); bail_out: UnUseTmpHeap(2,BIF_P); @@ -866,8 +838,14 @@ } } -static BIF_RETTYPE -do_update_counter(Process *p, Eterm arg1, Eterm arg2, Eterm arg3, Eterm arg4) +/* +** update_counter(Tab, Key, Incr) +** update_counter(Tab, Key, {Upop}) +** update_counter(Tab, Key, [{Upop}]) +** Upop = {Pos,Incr} | {Pos,Incr,Threshold,WarpTo} +** Returns new value(s) (integer or [integer]) +*/ +BIF_RETTYPE ets_update_counter_3(BIF_ALIST_3) { DbTable* tb; int cret = DB_ERROR_BADITEM; @@ -877,7 +855,7 @@ Eterm* ret_list_currp = NULL; Eterm* ret_list_prevp = NULL; Eterm iter; - DeclareTmpHeap(cell, 5, p); + DeclareTmpHeap(cell,5,BIF_P); Eterm *tuple = cell+2; DbUpdateHandle handle; Uint halloc_size = 0; /* overestimated heap usage */ @@ -885,29 +863,28 @@ Eterm* hstart; Eterm* hend; - if ((tb = db_get_table(p, arg1, DB_WRITE, LCK_WRITE_REC)) == NULL) { - BIF_ERROR(p, BADARG); + if ((tb = db_get_table(BIF_P, BIF_ARG_1, DB_WRITE, LCK_WRITE_REC)) == NULL) { + BIF_ERROR(BIF_P, BADARG); } - UseTmpHeap(5, p); + UseTmpHeap(5,BIF_P); if (!(tb->common.status & (DB_SET | DB_ORDERED_SET))) { goto bail_out; } - if (is_integer(arg3)) { /* Incr */ - upop_list = CONS(cell, - TUPLE2(tuple, make_small(tb->common.keypos+1), arg3), - NIL); + if (is_integer(BIF_ARG_3)) { /* Incr */ + upop_list = CONS(cell, TUPLE2(tuple, make_small(tb->common.keypos+1), + BIF_ARG_3), NIL); } - else if (is_tuple(arg3)) { /* {Upop} */ - upop_list = CONS(cell, arg3, NIL); + else if (is_tuple(BIF_ARG_3)) { /* {Upop} */ + upop_list = CONS(cell, BIF_ARG_3, NIL); } else { /* [{Upop}] (probably) */ - upop_list = arg3; + upop_list = BIF_ARG_3; ret_list_prevp = &ret; } - if (!tb->common.meth->db_lookup_dbterm(p, tb, arg2, arg4, &handle)) { + if (!tb->common.meth->db_lookup_dbterm(tb, BIF_ARG_2, &handle)) { goto bail_out; /* key not found */ } @@ -980,13 +957,13 @@ if (ret_list_prevp) { /* Prepare to return a list */ ret = NIL; halloc_size += list_size; - hstart = HAlloc(p, halloc_size); + hstart = HAlloc(BIF_P, halloc_size); ret_list_currp = hstart; htop = hstart + list_size; hend = hstart + halloc_size; } else { - hstart = htop = HAlloc(p, halloc_size); + hstart = htop = HAlloc(BIF_P, halloc_size); } hend = hstart + halloc_size; @@ -1033,54 +1010,26 @@ (is_list(ret) && (list_val(ret)+list_size)==ret_list_currp)); ASSERT(htop <= hend); - HRelease(p, hend, htop); + HRelease(BIF_P,hend,htop); finalize: - tb->common.meth->db_finalize_dbterm(cret, &handle); + tb->common.meth->db_finalize_dbterm(&handle); bail_out: - UnUseTmpHeap(5, p); + UnUseTmpHeap(5,BIF_P); db_unlock(tb, LCK_WRITE_REC); switch (cret) { case DB_ERROR_NONE: BIF_RET(ret); case DB_ERROR_SYSRES: - BIF_ERROR(p, SYSTEM_LIMIT); + BIF_ERROR(BIF_P, SYSTEM_LIMIT); default: - BIF_ERROR(p, BADARG); + BIF_ERROR(BIF_P, BADARG); break; } } -/* -** update_counter(Tab, Key, Incr) -** update_counter(Tab, Key, Upop) -** update_counter(Tab, Key, [{Upop}]) -** Upop = {Pos,Incr} | {Pos,Incr,Threshold,WarpTo} -** Returns new value(s) (integer or [integer]) -*/ -BIF_RETTYPE ets_update_counter_3(BIF_ALIST_3) -{ - return do_update_counter(BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3, THE_NON_VALUE); -} - -/* -** update_counter(Tab, Key, Incr, Default) -** update_counter(Tab, Key, Upop, Default) -** update_counter(Tab, Key, [{Upop}], Default) -** Upop = {Pos,Incr} | {Pos,Incr,Threshold,WarpTo} -** Returns new value(s) (integer or [integer]) -*/ -BIF_RETTYPE ets_update_counter_4(BIF_ALIST_4) -{ - if (is_not_tuple(BIF_ARG_4)) { - BIF_ERROR(BIF_P, BADARG); - } - return do_update_counter(BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3, BIF_ARG_4); -} - - /* ** The put BIF */ @@ -1250,7 +1199,7 @@ erts_fprintf(stderr, "ets:rename(%T,%T); Process: %T, initial: %T:%T/%bpu\n", BIF_ARG_1, BIF_ARG_2, BIF_P->common.id, - BIF_P->u.initial[0], BIF_P->u.initial[1], BIF_P->u.initial[2]); + BIF_P->initial[0], BIF_P->initial[1], BIF_P->initial[2]); #endif @@ -1566,7 +1515,7 @@ erts_fprintf(stderr, "ets:new(%T,%T)=%T; Process: %T, initial: %T:%T/%bpu\n", BIF_ARG_1, BIF_ARG_2, ret, BIF_P->common.id, - BIF_P->u.initial[0], BIF_P->u.initial[1], BIF_P->u.initial[2]); + BIF_P->initial[0], BIF_P->initial[1], BIF_P->initial[2]); erts_fprintf(stderr, "ets: new: meta_pid_to_tab common.memory_size = %ld\n", erts_smp_atomic_read_nob(&meta_pid_to_tab->common.memory_size)); erts_fprintf(stderr, "ets: new: meta_pid_to_fixed_tab common.memory_size = %ld\n", @@ -1699,7 +1648,7 @@ erts_fprintf(stderr, "ets:delete(%T); Process: %T, initial: %T:%T/%bpu\n", BIF_ARG_1, BIF_P->common.id, - BIF_P->u.initial[0], BIF_P->u.initial[1], BIF_P->u.initial[2]); + BIF_P->initial[0], BIF_P->initial[1], BIF_P->initial[2]); #endif CHECK_TABLES(); @@ -2694,9 +2643,7 @@ BIF_RETTYPE ets_info_1(BIF_ALIST_1) { static Eterm fields[] = {am_protection, am_keypos, am_type, am_named_table, - am_node, am_size, am_name, am_heir, am_owner, am_memory, am_compressed, - am_write_concurrency, - am_read_concurrency}; + am_node, am_size, am_name, am_heir, am_owner, am_memory, am_compressed}; Eterm results[sizeof(fields)/sizeof(Eterm)]; DbTable* tb; Eterm res; @@ -2859,11 +2806,10 @@ ** External interface (NOT BIF's) */ -int erts_ets_rwmtx_spin_count = -1; /* Init the db */ -void init_db(ErtsDbSpinCount db_spin_count) +void init_db(void) { DbTable init_tb; int i; @@ -2872,48 +2818,10 @@ size_t size; #ifdef ERTS_SMP - int max_spin_count = (1 << 15) - 1; /* internal limit */ erts_smp_rwmtx_opt_t rwmtx_opt = ERTS_SMP_RWMTX_OPT_DEFAULT_INITER; rwmtx_opt.type = ERTS_SMP_RWMTX_TYPE_FREQUENT_READ; rwmtx_opt.lived = ERTS_SMP_RWMTX_LONG_LIVED; - switch (db_spin_count) { - case ERTS_DB_SPNCNT_NONE: - erts_ets_rwmtx_spin_count = 0; - break; - case ERTS_DB_SPNCNT_VERY_LOW: - erts_ets_rwmtx_spin_count = 100; - break; - case ERTS_DB_SPNCNT_LOW: - erts_ets_rwmtx_spin_count = 200; - erts_ets_rwmtx_spin_count += erts_no_schedulers * 50; - if (erts_ets_rwmtx_spin_count > 1000) - erts_ets_rwmtx_spin_count = 1000; - break; - case ERTS_DB_SPNCNT_HIGH: - erts_ets_rwmtx_spin_count = 2000; - erts_ets_rwmtx_spin_count += erts_no_schedulers * 100; - if (erts_ets_rwmtx_spin_count > 15000) - erts_ets_rwmtx_spin_count = 15000; - break; - case ERTS_DB_SPNCNT_VERY_HIGH: - erts_ets_rwmtx_spin_count = 15000; - erts_ets_rwmtx_spin_count += erts_no_schedulers * 500; - if (erts_ets_rwmtx_spin_count > max_spin_count) - erts_ets_rwmtx_spin_count = max_spin_count; - break; - case ERTS_DB_SPNCNT_EXTREMELY_HIGH: - erts_ets_rwmtx_spin_count = max_spin_count; - break; - case ERTS_DB_SPNCNT_NORMAL: - default: - erts_ets_rwmtx_spin_count = -1; - break; - } - - if (erts_ets_rwmtx_spin_count >= 0) - rwmtx_opt.main_spincount = erts_ets_rwmtx_spin_count; - meta_main_tab_locks = erts_alloc_permanent_cache_aligned(ERTS_ALC_T_DB_TABLES, sizeof(erts_meta_main_tab_lock_t) @@ -3762,10 +3670,6 @@ ret = am_protected; else if (tb->common.status & DB_PUBLIC) ret = am_public; - } else if (What == am_write_concurrency) { - ret = tb->common.status & DB_FINE_LOCKED ? am_true : am_false; - } else if (What == am_read_concurrency) { - ret = tb->common.status & DB_FREQ_READ ? am_true : am_false; } else if (What == am_name) { ret = tb->common.the_name; } else if (What == am_keypos) { @@ -3848,7 +3752,7 @@ avg, std_dev_real, std_dev_exp, make_small(stats.min_chain_len), make_small(stats.max_chain_len), - make_small(stats.kept_items)); + make_small(db_kept_items_hash(&tb->hash))); } else { ret = am_false; @@ -3870,11 +3774,6 @@ + sizeof(Uint) - 1) / sizeof(Uint))); - erts_print(to, to_arg, "Type: %T\n", table_info(NULL, tb, am_type)); - erts_print(to, to_arg, "Protection: %T\n", table_info(NULL, tb, am_protection)); - erts_print(to, to_arg, "Compressed: %T\n", table_info(NULL, tb, am_compressed)); - erts_print(to, to_arg, "Write Concurrency: %T\n", table_info(NULL, tb, am_write_concurrency)); - erts_print(to, to_arg, "Read Concurrency: %T\n", table_info(NULL, tb, am_read_concurrency)); } void db_info(int to, void *to_arg, int show) /* Called by break handler */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_db.h erlang-17.3-dfsg/erts/emulator/beam/erl_db.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_db.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_db.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -62,17 +61,7 @@ "ERL_MAX_ETS_TABLES" */ #define ERL_MAX_ETS_TABLES_ENV "ERL_MAX_ETS_TABLES" -typedef enum { - ERTS_DB_SPNCNT_NONE, - ERTS_DB_SPNCNT_VERY_LOW, - ERTS_DB_SPNCNT_LOW, - ERTS_DB_SPNCNT_NORMAL, - ERTS_DB_SPNCNT_HIGH, - ERTS_DB_SPNCNT_VERY_HIGH, - ERTS_DB_SPNCNT_EXTREMELY_HIGH -} ErtsDbSpinCount; - -void init_db(ErtsDbSpinCount); +void init_db(void); int erts_db_process_exiting(Process *, ErtsProcLocks); void db_info(int, void *, int); void erts_db_foreach_table(void (*)(DbTable *, void *), void *); @@ -80,7 +69,6 @@ void (*func)(ErlOffHeap *, void *), void *); -extern int erts_ets_rwmtx_spin_count; extern int user_requested_db_max_tabs; /* set in erl_init */ extern int erts_ets_realloc_always_moves; /* set in erl_init */ extern int erts_ets_always_compress; /* set in erl_init */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_db_hash.c erlang-17.3-dfsg/erts/emulator/beam/erl_db_hash.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_db_hash.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_db_hash.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -148,11 +147,8 @@ } /* Remember a slot containing a pseudo-deleted item (INVALID_HASH) - * Return false if we got raced by unfixing thread - * and the object should be deleted for real. - */ -static ERTS_INLINE int add_fixed_deletion(DbTableHash* tb, int ix, - erts_aint_t fixated_by_me) +*/ +static ERTS_INLINE void add_fixed_deletion(DbTableHash* tb, int ix) { erts_aint_t was_next; erts_aint_t exp_next; @@ -163,18 +159,12 @@ fixd->slot = ix; was_next = erts_smp_atomic_read_acqb(&tb->fixdel); do { /* Lockless atomic insertion in linked list: */ - if (NFIXED(tb) <= fixated_by_me) { - erts_db_free(ERTS_ALC_T_DB_FIX_DEL, (DbTable*)tb, - fixd, sizeof(FixedDeletion)); - return 0; /* raced by unfixer */ - } - exp_next = was_next; + exp_next = was_next; fixd->next = (FixedDeletion*) exp_next; - was_next = erts_smp_atomic_cmpxchg_mb(&tb->fixdel, - (erts_aint_t) fixd, - exp_next); + was_next = erts_smp_atomic_cmpxchg_relb(&tb->fixdel, + (erts_aint_t) fixd, + exp_next); }while (was_next != exp_next); - return 1; } @@ -184,7 +174,7 @@ /* optimised version of make_hash (normal case? atomic key) */ #define MAKE_HASH(term) \ ((is_atom(term) ? (atom_tab(atom_val(term))->slot.bucket.hvalue) : \ - make_internal_hash(term)) % MAX_HASH) + make_hash2(term)) % MAX_HASH) #ifdef ERTS_SMP # define DB_HASH_LOCK_MASK (DB_HASH_LOCK_CNT-1) @@ -392,7 +382,7 @@ static void shrink(DbTableHash* tb, int nactive); static void grow(DbTableHash* tb, int nactive); static Eterm build_term_list(Process* p, HashDbTerm* ptr1, HashDbTerm* ptr2, - Uint sz, DbTableHash*); + DbTableHash*); static int analyze_pattern(DbTableHash *tb, Eterm pattern, struct mp_info *mpi); @@ -436,7 +426,6 @@ static int db_select_delete_continue_hash(Process *p, DbTable *tbl, Eterm continuation, Eterm *ret); -static int db_take_hash(Process *, DbTable *, Eterm, Eterm *); static void db_print_hash(int to, void *to_arg, int show, @@ -454,11 +443,8 @@ #ifdef HARDDEBUG static void db_check_table_hash(DbTableHash *tb); #endif -static int -db_lookup_dbterm_hash(Process *p, DbTable *tbl, Eterm key, Eterm obj, - DbUpdateHandle* handle); -static void -db_finalize_dbterm_hash(int cret, DbUpdateHandle* handle); +static int db_lookup_dbterm_hash(DbTable *tbl, Eterm key, DbUpdateHandle* handle); +static void db_finalize_dbterm_hash(DbUpdateHandle* handle); static ERTS_INLINE void try_shrink(DbTableHash* tb) { @@ -550,7 +536,6 @@ db_select_delete_continue_hash, db_select_count_hash, db_select_count_continue_hash, - db_take_hash, db_delete_all_objects_hash, db_free_table_hash, db_free_table_continue_hash, @@ -616,8 +601,8 @@ || (erts_smp_lc_rwmtx_is_rlocked(&tb->common.rwlock) && !tb->common.is_thread_safe)); restart: - fixdel = (FixedDeletion*) erts_smp_atomic_xchg_mb(&tb->fixdel, - (erts_aint_t) NULL); + fixdel = (FixedDeletion*) erts_smp_atomic_xchg_acqb(&tb->fixdel, + (erts_aint_t) NULL); while (fixdel != NULL) { FixedDeletion *fx = fixdel; int ix = fx->slot; @@ -661,6 +646,25 @@ /* ToDo: Maybe try grow/shrink the table as well */ } +/* Only used by tests +*/ +Uint db_kept_items_hash(DbTableHash *tb) +{ + Uint kept_items = 0; + Uint ix = 0; + erts_smp_rwmtx_t* lck = RLOCK_HASH(tb,ix); + HashDbTerm* b; + do { + for (b = BUCKET(tb, ix); b != NULL; b = b->next) { + if (b->hvalue == INVALID_HASH) { + ++kept_items; + } + } + ix = next_slot(tb, ix, &lck); + }while (ix); + return kept_items; +} + int db_create_hash(Process *p, DbTable *tbl) { DbTableHash *tb = &tbl->hash; @@ -680,8 +684,6 @@ int i; if (tb->common.type & DB_FREQ_READ) rwmtx_opt.type = ERTS_SMP_RWMTX_TYPE_FREQUENT_READ; - if (erts_ets_rwmtx_spin_count >= 0) - rwmtx_opt.main_spincount = erts_ets_rwmtx_spin_count; tb->locks = (DbTableHashFineLocks*) erts_db_alloc_fnf(ERTS_ALC_T_DB_SEG, /* Other type maybe? */ (DbTable *) tb, sizeof(DbTableHashFineLocks)); @@ -877,49 +879,34 @@ return ret; } -static Eterm -get_term_list(Process *p, DbTableHash *tb, Eterm key, HashValue hval, - HashDbTerm *b1, HashDbTerm **bend) -{ - HashDbTerm* b2 = b1->next; - Eterm copy; - Uint sz = b1->dbterm.size + 2; - - if (tb->common.status & (DB_BAG | DB_DUPLICATE_BAG)) { - while (b2 && has_key(tb, b2, key, hval)) { - if (b2->hvalue != INVALID_HASH) - sz += b2->dbterm.size + 2; - - b2 = b2->next; - } - } - copy = build_term_list(p, b1, b2, sz, tb); - CHECK_TABLES(); - if (bend) { - *bend = b2; - } - return copy; -} - int db_get_hash(Process *p, DbTable *tbl, Eterm key, Eterm *ret) { DbTableHash *tb = &tbl->hash; HashValue hval; int ix; - HashDbTerm* b; + HashDbTerm* b1; erts_smp_rwmtx_t* lck; hval = MAKE_HASH(key); lck = RLOCK_HASH(tb,hval); ix = hash_to_ix(tb, hval); - b = BUCKET(tb, ix); + b1 = BUCKET(tb, ix); - while(b != 0) { - if (has_live_key(tb, b, key, hval)) { - *ret = get_term_list(p, tb, key, hval, b, NULL); + while(b1 != 0) { + if (has_live_key(tb,b1,key,hval)) { + HashDbTerm* b2 = b1->next; + Eterm copy; + + if (tb->common.status & (DB_BAG | DB_DUPLICATE_BAG)) { + while(b2 != NULL && has_key(tb,b2,key,hval)) + b2 = b2->next; + } + copy = build_term_list(p, b1, b2, tb); + CHECK_TABLES(); + *ret = copy; goto done; } - b = b->next; + b1 = b1->next; } *ret = NIL; done: @@ -1061,6 +1048,7 @@ Eterm copy = db_copy_element_from_ets(&tb->common, p, &b->dbterm, ndex, &hp, 2); elem_list = CONS(hp, copy, elem_list); + hp += 2; } b = b->next; } @@ -1151,9 +1139,9 @@ while(b != 0) { if (has_live_key(tb,b,key,hval)) { --nitems_diff; - if (nitems_diff == -1 && IS_FIXED(tb) - && add_fixed_deletion(tb, ix, 0)) { + if (nitems_diff == -1 && IS_FIXED(tb)) { /* Pseudo remove (no need to keep several of same key) */ + add_fixed_deletion(tb, ix); b->hvalue = INVALID_HASH; } else { *bp = b->next; @@ -1205,8 +1193,9 @@ ++nkeys; if (db_eq(&tb->common,object, &b->dbterm)) { --nitems_diff; - if (nkeys==1 && IS_FIXED(tb) && add_fixed_deletion(tb,ix,0)) { - b->hvalue = INVALID_HASH; /* Pseudo remove */ + if (nkeys==1 && IS_FIXED(tb)) { /* Pseudo remove */ + add_fixed_deletion(tb,ix); + b->hvalue = INVALID_HASH; bp = &b->next; b = b->next; } else { @@ -1251,7 +1240,7 @@ lck = RLOCK_HASH(tb, slot); nactive = NACTIVE(tb); if (slot < nactive) { - *ret = build_term_list(p, BUCKET(tb, slot), NULL, 0, tb); + *ret = build_term_list(p, BUCKET(tb, slot), 0, tb); retval = DB_ERROR_NONE; } else if (slot == nactive) { @@ -1828,17 +1817,14 @@ int did_erase = 0; if (db_match_dbterm(&tb->common, p, mpi.mp, 0, &(*current)->dbterm, NULL, 0) == am_true) { - HashDbTerm *del; if (NFIXED(tb) > fixated_by_me) { /* fixated by others? */ if (slot_ix != last_pseudo_delete) { - if (!add_fixed_deletion(tb, slot_ix, fixated_by_me)) - goto do_erase; - last_pseudo_delete = slot_ix; + add_fixed_deletion(tb, slot_ix); + last_pseudo_delete = slot_ix; } (*current)->hvalue = INVALID_HASH; } else { - do_erase: - del = *current; + HashDbTerm *del = *current; *current = (*current)->next; free_term(tb, del); did_erase = 1; @@ -1942,17 +1928,14 @@ int did_erase = 0; if (db_match_dbterm(&tb->common, p, mp, 0, &(*current)->dbterm, NULL, 0) == am_true) { - HashDbTerm *del; if (NFIXED(tb) > fixated_by_me) { /* fixated by others? */ if (slot_ix != last_pseudo_delete) { - if (!add_fixed_deletion(tb, slot_ix, fixated_by_me)) - goto do_erase; + add_fixed_deletion(tb, slot_ix); last_pseudo_delete = slot_ix; } (*current)->hvalue = INVALID_HASH; } else { - do_erase: - del = *current; + HashDbTerm *del = *current; *current = (*current)->next; free_term(tb, del); did_erase = 1; @@ -2086,46 +2069,6 @@ } -static int db_take_hash(Process *p, DbTable *tbl, Eterm key, Eterm *ret) -{ - DbTableHash *tb = &tbl->hash; - HashDbTerm **bp, *b; - HashValue hval = MAKE_HASH(key); - erts_smp_rwmtx_t *lck = WLOCK_HASH(tb, hval); - int ix = hash_to_ix(tb, hval); - int nitems_diff = 0; - - *ret = NIL; - for (bp = &BUCKET(tb, ix), b = *bp; b; bp = &b->next, b = b->next) { - if (has_live_key(tb, b, key, hval)) { - HashDbTerm *bend; - - *ret = get_term_list(p, tb, key, hval, b, &bend); - while (b != bend) { - --nitems_diff; - if (nitems_diff == -1 && IS_FIXED(tb) - && add_fixed_deletion(tb, ix, 0)) { - /* Pseudo remove (no need to keep several of same key) */ - bp = &b->next; - b->hvalue = INVALID_HASH; - b = b->next; - } else { - *bp = b->next; - free_term(tb, b); - b = *bp; - } - } - break; - } - } - WUNLOCK_HASH(lck); - if (nitems_diff) { - erts_smp_atomic_add_nob(&tb->common.nitems, nitems_diff); - try_shrink(tb); - } - return DB_ERROR_NONE; -} - /* ** Other interface routines (not directly coupled to one bif) */ @@ -2145,7 +2088,7 @@ for (i = 0; i < NACTIVE(tb); i++) { if ((list = BUCKET(tb,i)) != NULL) { - add_fixed_deletion(tb, i, 0); + add_fixed_deletion(tb, i); do { list->hvalue = INVALID_HASH; list = list->next; @@ -2161,38 +2104,10 @@ static void db_print_hash(int to, void *to_arg, int show, DbTable *tbl) { DbTableHash *tb = &tbl->hash; - DbHashStats stats; int i; erts_print(to, to_arg, "Buckets: %d\n", NACTIVE(tb)); - -#ifdef ERTS_SMP - i = tbl->common.is_thread_safe; - /* If crash dumping we set table to thread safe in order to - avoid taking any locks */ - if (ERTS_IS_CRASH_DUMPING) - tbl->common.is_thread_safe = 1; - - db_calc_stats_hash(&tbl->hash, &stats); - - tbl->common.is_thread_safe = i; -#else - db_calc_stats_hash(&tbl->hash, &stats); -#endif - - erts_print(to, to_arg, "Chain Length Avg: %f\n", stats.avg_chain_len); - erts_print(to, to_arg, "Chain Length Max: %d\n", stats.max_chain_len); - erts_print(to, to_arg, "Chain Length Min: %d\n", stats.min_chain_len); - erts_print(to, to_arg, "Chain Length Std Dev: %f\n", - stats.std_dev_chain_len); - erts_print(to, to_arg, "Chain Length Expected Std Dev: %f\n", - stats.std_dev_expected); - - if (IS_FIXED(tb)) - erts_print(to, to_arg, "Fixed: %d\n", stats.kept_items); - else - erts_print(to, to_arg, "Fixed: false\n"); - + if (show) { for (i = 0; i < NACTIVE(tb); i++) { HashDbTerm* list = BUCKET(tb,i); @@ -2487,10 +2402,10 @@ */ static int free_seg(DbTableHash *tb, int free_records) { - const int seg_ix = (tb->nslots >> SEGSZ_EXP) - 1; - struct segment** const segtab = SEGTAB(tb); - struct ext_segment* const top = (struct ext_segment*) segtab[seg_ix]; + int seg_ix = (tb->nslots >> SEGSZ_EXP) - 1; int bytes; + struct segment** segtab = SEGTAB(tb); + struct ext_segment* top = (struct ext_segment*) segtab[seg_ix]; int nrecords = 0; ASSERT(top != NULL); @@ -2553,7 +2468,7 @@ (void*)top, bytes); #ifdef DEBUG if (seg_ix > 0) { - segtab[seg_ix] = NULL; + if (seg_ix < tb->nsegs) SEGTAB(tb)[seg_ix] = NULL; } else { SET_SEGTAB(tb, NULL); } @@ -2568,23 +2483,23 @@ ** Copy terms from ptr1 until ptr2 ** works for ptr1 == ptr2 == 0 => [] ** or ptr2 == 0 -** sz is either precalculated heap size or 0 if not known */ static Eterm build_term_list(Process* p, HashDbTerm* ptr1, HashDbTerm* ptr2, - Uint sz, DbTableHash* tb) + DbTableHash* tb) { + int sz = 0; HashDbTerm* ptr; Eterm list = NIL; Eterm copy; Eterm *hp, *hend; - if (!sz) { - ptr = ptr1; - while(ptr != ptr2) { - if (ptr->hvalue != INVALID_HASH) - sz += ptr->dbterm.size + 2; - ptr = ptr->next; - } + ptr = ptr1; + while(ptr != ptr2) { + + if (ptr->hvalue != INVALID_HASH) + sz += ptr->dbterm.size + 2; + + ptr = ptr->next; } hp = HAlloc(p, sz); @@ -2815,129 +2730,59 @@ return NULL; } -static int -db_lookup_dbterm_hash(Process *p, DbTable *tbl, Eterm key, Eterm obj, - DbUpdateHandle* handle) +static int db_lookup_dbterm_hash(DbTable *tbl, Eterm key, DbUpdateHandle* handle) { DbTableHash *tb = &tbl->hash; + HashDbTerm* b; + HashDbTerm** prevp; + int ix; HashValue hval; - HashDbTerm **bp, *b; erts_smp_rwmtx_t* lck; - int flags = 0; - - ASSERT(tb->common.status & DB_SET); hval = MAKE_HASH(key); - lck = WLOCK_HASH(tb, hval); - bp = &BUCKET(tb, hash_to_ix(tb, hval)); - b = *bp; - - for (;;) { - if (b == NULL) { - break; - } - if (has_key(tb, b, key, hval)) { - if (b->hvalue != INVALID_HASH) { - goto Ldone; - } - break; - } - bp = &b->next; - b = *bp; - } - - if (obj == THE_NON_VALUE) { - WUNLOCK_HASH(lck); - return 0; - } - - { - Eterm *objp = tuple_val(obj); - int arity = arityval(*objp); - Eterm *htop, *hend; - - ASSERT(arity >= tb->common.keypos); - htop = HAlloc(p, arity + 1); - hend = htop + arity + 1; - sys_memcpy(htop, objp, sizeof(Eterm) * (arity + 1)); - htop[tb->common.keypos] = key; - obj = make_tuple(htop); - - if (b == NULL) { - HashDbTerm *q = new_dbterm(tb, obj); - - q->hvalue = hval; - q->next = NULL; - *bp = b = q; - - { - int nitems = erts_smp_atomic_inc_read_nob(&tb->common.nitems); - int nactive = NACTIVE(tb); - - if (nitems > nactive * (CHAIN_LEN + 1) && !IS_FIXED(tb)) { - grow(tb, nactive); - } - } - } else { - HashDbTerm *q, *next = b->next; - - ASSERT(b->hvalue == INVALID_HASH); - q = replace_dbterm(tb, b, obj); - q->next = next; - q->hvalue = hval; - *bp = b = q; - erts_smp_atomic_inc_nob(&tb->common.nitems); - } + lck = WLOCK_HASH(tb,hval); + ix = hash_to_ix(tb, hval); + prevp = &BUCKET(tb, ix); + b = *prevp; - HRelease(p, hend, htop); - flags |= DB_NEW_OBJECT; + while (b != 0) { + if (has_live_key(tb,b,key,hval)) { + handle->tb = tbl; + handle->bp = (void**) prevp; + handle->dbterm = &b->dbterm; + handle->mustResize = 0; + handle->new_size = b->dbterm.size; + #if HALFWORD_HEAP + handle->abs_vec = NULL; + #endif + handle->lck = lck; + /* KEEP hval WLOCKED, db_finalize_dbterm_hash will WUNLOCK */ + return 1; + } + prevp = &b->next; + b = *prevp; } - -Ldone: - handle->tb = tbl; - handle->bp = (void **)bp; - handle->dbterm = &b->dbterm; - handle->flags = flags; - handle->new_size = b->dbterm.size; -#if HALFWORD_HEAP - handle->abs_vec = NULL; -#endif - handle->lck = lck; - return 1; + WUNLOCK_HASH(lck); + return 0; } /* Must be called after call to db_lookup_dbterm */ -static void -db_finalize_dbterm_hash(int cret, DbUpdateHandle* handle) +static void db_finalize_dbterm_hash(DbUpdateHandle* handle) { DbTable* tbl = handle->tb; - DbTableHash *tb = &tbl->hash; - HashDbTerm **bp = (HashDbTerm **) handle->bp; - HashDbTerm *b = *bp; + HashDbTerm* oldp = (HashDbTerm*) *(handle->bp); erts_smp_rwmtx_t* lck = (erts_smp_rwmtx_t*) handle->lck; - ERTS_SMP_LC_ASSERT(IS_HASH_WLOCKED(tb, lck)); /* locked by db_lookup_dbterm_hash */ - - ASSERT((&b->dbterm == handle->dbterm) == !(tb->common.compress && handle->flags & DB_MUST_RESIZE)); + ERTS_SMP_LC_ASSERT(IS_HASH_WLOCKED(&tbl->hash,lck)); /* locked by db_lookup_dbterm_hash */ - if (handle->flags & DB_NEW_OBJECT && cret != DB_ERROR_NONE) { - if (IS_FIXED(tb) && add_fixed_deletion(tb, hash_to_ix(tb, b->hvalue), - 0)) { - b->hvalue = INVALID_HASH; - } else { - *bp = b->next; - free_term(tb, b); - } + ASSERT((&oldp->dbterm == handle->dbterm) == !(tbl->common.compress && handle->mustResize)); - WUNLOCK_HASH(lck); - erts_smp_atomic_dec_nob(&tb->common.nitems); - try_shrink(tb); - } else if (handle->flags & DB_MUST_RESIZE) { + if (handle->mustResize) { db_finalize_resize(handle, offsetof(HashDbTerm,dbterm)); WUNLOCK_HASH(lck); - free_term(tb, b); + free_term(&tbl->hash, oldp); } else { WUNLOCK_HASH(lck); @@ -2988,7 +2833,6 @@ erts_smp_rwmtx_t* lck; int sum = 0; int sq_sum = 0; - int kept_items = 0; int ix; int len; @@ -3000,8 +2844,6 @@ len = 0; for (b = BUCKET(tb,ix); b!=NULL; b=b->next) { len++; - if (b->hvalue == INVALID_HASH) - ++kept_items; } sum += len; sq_sum += len*len; @@ -3013,8 +2855,7 @@ stats->std_dev_chain_len = sqrt((sq_sum - stats->avg_chain_len*sum) / NACTIVE(tb)); /* Expected standard deviation from a good uniform hash function, ie binomial distribution (not taking the linear hashing into acount) */ - stats->std_dev_expected = sqrt(stats->avg_chain_len * (1 - 1.0/NACTIVE(tb))); - stats->kept_items = kept_items; + stats->std_dev_expected = sqrt(stats->avg_chain_len * (1 - 1.0/NACTIVE(tb))); } #ifdef HARDDEBUG diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_db_hash.h erlang-17.3-dfsg/erts/emulator/beam/erl_db_hash.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_db_hash.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_db_hash.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 1998-2014. All Rights Reserved. + * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -43,7 +42,7 @@ typedef struct db_table_hash_fine_locks { union { erts_smp_rwmtx_t lck; - byte _cache_line_alignment[ERTS_ALC_CACHE_LINE_ALIGN_SIZE(sizeof(erts_smp_rwmtx_t))]; + byte _cache_line_alignment[64]; }lck_vec[DB_HASH_LOCK_CNT]; } DbTableHashFineLocks; @@ -105,7 +104,6 @@ float std_dev_expected; int max_chain_len; int min_chain_len; - int kept_items; }DbHashStats; void db_calc_stats_hash(DbTableHash* tb, DbHashStats*); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_db_tree.c erlang-17.3-dfsg/erts/emulator/beam/erl_db_tree.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_db_tree.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_db_tree.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -384,7 +383,6 @@ Eterm pattern, Eterm *ret); static int db_select_delete_continue_tree(Process *p, DbTable *tbl, Eterm continuation, Eterm *ret); -static int db_take_tree(Process *, DbTable *, Eterm, Eterm *); static void db_print_tree(int to, void *to_arg, int show, DbTable *tbl); static int db_free_table_tree(DbTable *tbl); @@ -400,11 +398,8 @@ #ifdef HARDDEBUG static void db_check_table_tree(DbTable *tbl); #endif -static int -db_lookup_dbterm_tree(Process *, DbTable *, Eterm key, Eterm obj, - DbUpdateHandle*); -static void -db_finalize_dbterm_tree(int cret, DbUpdateHandle *); +static int db_lookup_dbterm_tree(DbTable *, Eterm key, DbUpdateHandle*); +static void db_finalize_dbterm_tree(DbUpdateHandle*); /* ** Static variables @@ -436,7 +431,6 @@ db_select_delete_continue_tree, db_select_count_tree, db_select_count_continue_tree, - db_take_tree, db_delete_all_objects_tree, db_free_table_tree, db_free_table_continue_tree, @@ -1117,7 +1111,7 @@ sc.all_objects = mpi.all_objects; if (!mpi.got_partial && mpi.some_limitation && - CMP_EQ(mpi.least,mpi.most)) { + CMP(mpi.least,mpi.most) == 0) { doit_select(tb,mpi.save_term,&sc,0 /* direction doesn't matter */); RET_TO_BIF(sc.accum,DB_ERROR_NONE); } @@ -1325,7 +1319,7 @@ sc.all_objects = mpi.all_objects; if (!mpi.got_partial && mpi.some_limitation && - CMP_EQ(mpi.least,mpi.most)) { + CMP(mpi.least,mpi.most) == 0) { doit_select_count(tb,mpi.save_term,&sc,0 /* dummy */); RET_TO_BIF(erts_make_integer(sc.got,p),DB_ERROR_NONE); } @@ -1430,7 +1424,7 @@ sc.all_objects = mpi.all_objects; if (!mpi.got_partial && mpi.some_limitation && - CMP_EQ(mpi.least,mpi.most)) { + CMP(mpi.least,mpi.most) == 0) { doit_select(tb,mpi.save_term,&sc, 0 /* direction doesn't matter */); if (sc.accum != NIL) { hp=HAlloc(p, 3); @@ -1674,7 +1668,7 @@ sc.mp = mpi.mp; if (!mpi.got_partial && mpi.some_limitation && - CMP_EQ(mpi.least,mpi.most)) { + CMP(mpi.least,mpi.most) == 0) { doit_select_delete(tb,mpi.save_term,&sc, 0 /* direction doesn't matter */); RET_TO_BIF(erts_make_integer(sc.accum,p),DB_ERROR_NONE); @@ -1728,28 +1722,6 @@ } -static int db_take_tree(Process *p, DbTable *tbl, Eterm key, Eterm *ret) -{ - DbTableTree *tb = &tbl->tree; - TreeDbTerm *this; - - *ret = NIL; - this = linkout_tree(tb, key, NULL); - if (this) { - Eterm copy, *hp, *hend; - - hp = HAlloc(p, this->dbterm.size + 2); - hend = hp + this->dbterm.size + 2; - copy = db_copy_object_from_ets(&tb->common, - &this->dbterm, &hp, &MSO(p)); - *ret = CONS(hp, copy, NIL); - hp += 2; - HRelease(p, hend, hp); - free_term(tb, this); - } - return DB_ERROR_NONE; -} - /* ** Other interface routines (not directly coupled to one bif) */ @@ -2550,43 +2522,16 @@ return this; } -static int -db_lookup_dbterm_tree(Process *p, DbTable *tbl, Eterm key, Eterm obj, - DbUpdateHandle* handle) +static int db_lookup_dbterm_tree(DbTable *tbl, Eterm key, DbUpdateHandle* handle) { DbTableTree *tb = &tbl->tree; TreeDbTerm **pp = find_node2(tb, key); - int flags = 0; - if (pp == NULL) { - if (obj == THE_NON_VALUE) { - return 0; - } else { - Eterm *objp = tuple_val(obj); - int arity = arityval(*objp); - Eterm *htop, *hend; - - ASSERT(arity >= tb->common.keypos); - htop = HAlloc(p, arity + 1); - hend = htop + arity + 1; - sys_memcpy(htop, objp, sizeof(Eterm) * (arity + 1)); - htop[tb->common.keypos] = key; - obj = make_tuple(htop); - - if (db_put_tree(tbl, obj, 1) != DB_ERROR_NONE) { - return 0; - } - - pp = find_node2(tb, key); - ASSERT(pp != NULL); - HRelease(p, hend, htop); - flags |= DB_NEW_OBJECT; - } - } + if (pp == NULL) return 0; handle->tb = tbl; handle->dbterm = &(*pp)->dbterm; - handle->flags = flags; + handle->mustResize = 0; handle->bp = (void**) pp; handle->new_size = (*pp)->dbterm.size; #if HALFWORD_HEAP @@ -2595,21 +2540,15 @@ return 1; } -static void -db_finalize_dbterm_tree(int cret, DbUpdateHandle *handle) +static void db_finalize_dbterm_tree(DbUpdateHandle* handle) { - DbTable *tbl = handle->tb; - DbTableTree *tb = &tbl->tree; - TreeDbTerm *bp = (TreeDbTerm *) *handle->bp; + if (handle->mustResize) { + TreeDbTerm* oldp = (TreeDbTerm*) *handle->bp; - if (handle->flags & DB_NEW_OBJECT && cret != DB_ERROR_NONE) { - Eterm ret; - db_erase_tree(tbl, GETKEY(tb, bp->dbterm.tpl), &ret); - } else if (handle->flags & DB_MUST_RESIZE) { db_finalize_resize(handle, offsetof(TreeDbTerm,dbterm)); - reset_static_stack(tb); + reset_static_stack(&handle->tb->tree); - free_term(tb, bp); + free_term(&handle->tb->tree, oldp); } #ifdef DEBUG handle->dbterm = 0; @@ -2717,7 +2656,7 @@ *ret = this; return 1; } else if (partly_bound != NULL && key != am_Underscore && - db_is_variable(key) < 0 && !db_has_map(key)) + db_is_variable(key) < 0) *partly_bound = key; return 0; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_db_tree.h erlang-17.3-dfsg/erts/emulator/beam/erl_db_tree.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_db_tree.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_db_tree.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_db_util.c erlang-17.3-dfsg/erts/emulator/beam/erl_db_util.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_db_util.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_db_util.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -199,6 +198,11 @@ return ret; } + +/* Type checking... */ + +#define BOXED_IS_TUPLE(Boxed) is_arity_value(*boxed_val((Boxed))) + /* ** ** Types and enum's (compiled matches) @@ -214,9 +218,7 @@ matchTuple, matchPushT, matchPushL, - matchPushM, matchPop, - matchSwap, matchBind, matchCmp, matchEqBin, @@ -225,15 +227,11 @@ matchEqRef, matchEq, matchList, - matchMap, - matchKey, matchSkip, matchPushC, matchConsA, /* Car is below Cdr */ matchConsB, /* Cdr is below Car (unusual) */ matchMkTuple, - matchMkFlatMap, - matchMkHashMap, matchCall0, matchCall1, matchCall2, @@ -858,13 +856,6 @@ static Uint my_size_object(Eterm t); static Eterm my_copy_struct(Eterm t, Eterm **hp, ErlOffHeap* off_heap); -/* Guard subroutines */ -static void -dmc_rearrange_constants(DMCContext *context, DMC_STACK_TYPE(UWord) *text, - int textpos, Eterm *p, Uint nelems); -static DMCRet -dmc_array(DMCContext *context, DMCHeap *heap, DMC_STACK_TYPE(UWord) *text, - Eterm *p, Uint nelems, int *constant); /* Guard compilation */ static void do_emit_constant(DMCContext *context, DMC_STACK_TYPE(UWord) *text, Eterm t); @@ -878,9 +869,6 @@ DMC_STACK_TYPE(UWord) *text, Eterm t, int *constant); -static DMCRet -dmc_map(DMCContext *context, DMCHeap *heap, DMC_STACK_TYPE(UWord) *text, - Eterm t, int *constant); static DMCRet dmc_variable(DMCContext *context, DMCHeap *heap, DMC_STACK_TYPE(UWord) *text, @@ -900,14 +888,12 @@ DMCHeap *heap, DMC_STACK_TYPE(UWord) *text, Eterm t); -/* match expression subroutines */ +/* match expression subroutine */ static DMCRet dmc_one_term(DMCContext *context, DMCHeap *heap, DMC_STACK_TYPE(Eterm) *stack, DMC_STACK_TYPE(UWord) *text, Eterm c); -static Eterm -dmc_private_copy(DMCContext *context, Eterm c); #ifdef DMC_DEBUG @@ -1378,112 +1364,7 @@ for (;;) { switch (t & _TAG_PRIMARY_MASK) { case TAG_PRIMARY_BOXED: - if (is_flatmap(t)) { - num_iters = flatmap_get_size(flatmap_val(t)); - if (!structure_checked) { - DMC_PUSH(text, matchMap); - DMC_PUSH(text, num_iters); - } - structure_checked = 0; - for (i = 0; i < num_iters; ++i) { - Eterm key = flatmap_get_keys(flatmap_val(t))[i]; - if (db_is_variable(key) >= 0) { - if (context.err_info) { - add_dmc_err(context.err_info, - "Variable found in map key.", - -1, 0UL, dmcError); - } - goto error; - } else if (key == am_Underscore) { - if (context.err_info) { - add_dmc_err(context.err_info, - "Underscore found in map key.", - -1, 0UL, dmcError); - } - goto error; - } - DMC_PUSH(text, matchKey); - DMC_PUSH(text, dmc_private_copy(&context, key)); - { - int old_stack = ++(context.stack_used); - Eterm value = flatmap_get_values(flatmap_val(t))[i]; - res = dmc_one_term(&context, &heap, &stack, &text, - value); - ASSERT(res != retFail); - if (res == retRestart) { - goto restart; - } - if (old_stack != context.stack_used) { - ASSERT(old_stack + 1 == context.stack_used); - DMC_PUSH(text, matchSwap); - } - if (context.stack_used > context.stack_need) { - context.stack_need = context.stack_used; - } - DMC_PUSH(text, matchPop); - --(context.stack_used); - } - } - break; - } - if (is_hashmap(t)) { - DECLARE_WSTACK(wstack); - Eterm *kv; - num_iters = hashmap_size(t); - if (!structure_checked) { - DMC_PUSH(text, matchMap); - DMC_PUSH(text, num_iters); - } - structure_checked = 0; - - hashmap_iterator_init(&wstack, t, 0); - - while ((kv=hashmap_iterator_next(&wstack)) != NULL) { - Eterm key = CAR(kv); - Eterm value = CDR(kv); - if (db_is_variable(key) >= 0) { - if (context.err_info) { - add_dmc_err(context.err_info, - "Variable found in map key.", - -1, 0UL, dmcError); - } - DESTROY_WSTACK(wstack); - goto error; - } else if (key == am_Underscore) { - if (context.err_info) { - add_dmc_err(context.err_info, - "Underscore found in map key.", - -1, 0UL, dmcError); - } - DESTROY_WSTACK(wstack); - goto error; - } - DMC_PUSH(text, matchKey); - DMC_PUSH(text, dmc_private_copy(&context, key)); - { - int old_stack = ++(context.stack_used); - res = dmc_one_term(&context, &heap, &stack, &text, - value); - ASSERT(res != retFail); - if (res == retRestart) { - DESTROY_WSTACK(wstack); - goto restart; - } - if (old_stack != context.stack_used) { - ASSERT(old_stack + 1 == context.stack_used); - DMC_PUSH(text, matchSwap); - } - if (context.stack_used > context.stack_need) { - context.stack_need = context.stack_used; - } - DMC_PUSH(text, matchPop); - --(context.stack_used); - } - } - DESTROY_WSTACK(wstack); - break; - } - if (!is_tuple(t)) { + if (!BOXED_IS_TUPLE(t)) { goto simple_term; } num_iters = arityval(*tuple_val(t)); @@ -1834,8 +1715,10 @@ Uint32 *return_flags) { MatchProg *prog = Binary2MatchProg(bprog); - const Eterm *ep, *tp, **sp; + Eterm *ep; + Eterm *tp; Eterm t; + Eterm **sp; Eterm *esp; MatchVariable* variables; BeamInstr *cp; @@ -1925,7 +1808,7 @@ restart: ep = &term; esp = (Eterm*)((char*)mpsp->u.heap + prog->stack_offset); - sp = (const Eterm **)esp; + sp = (Eterm **) esp; ret = am_true; do_catch = 0; fail_label = -1; @@ -2004,57 +1887,9 @@ *sp++ = list_val_rel(*ep,base); ++ep; break; - case matchMap: - if (!is_map_rel(*ep, base)) { - FAIL(); - } - n = *pc++; - if (is_flatmap_rel(*ep,base)) { - if (flatmap_get_size(flatmap_val_rel(*ep, base)) < n) { - FAIL(); - } - } else { - ASSERT(is_hashmap_rel(*ep,base)); - if (hashmap_size_rel(*ep, base) < n) { - FAIL(); - } - } - ep = flatmap_val_rel(*ep, base); - break; - case matchPushM: - if (!is_map_rel(*ep, base)) { - FAIL(); - } - n = *pc++; - if (is_flatmap_rel(*ep,base)) { - if (flatmap_get_size(flatmap_val_rel(*ep, base)) < n) { - FAIL(); - } - } else { - ASSERT(is_hashmap_rel(*ep,base)); - if (hashmap_size_rel(*ep, base) < n) { - FAIL(); - } - } - *sp++ = flatmap_val_rel(*ep++, base); - break; - case matchKey: - t = (Eterm) *pc++; - tp = erts_maps_get_rel(t, make_boxed_rel(ep, base), base); - if (!tp) { - FAIL(); - } - *sp++ = ep; - ep = tp; - break; case matchPop: ep = *(--sp); break; - case matchSwap: - tp = sp[-1]; - sp[-1] = sp[-2]; - sp[-2] = tp; - break; case matchBind: n = *pc++; variables[n].term = *ep++; @@ -2152,39 +1987,6 @@ } *esp++ = t; break; - case matchMkFlatMap: - n = *pc++; - ehp = HAllocX(build_proc, MAP_HEADER_FLATMAP_SZ + n, HEAP_XTRA); - t = *--esp; - { - flatmap_t *m = (flatmap_t *)ehp; - m->thing_word = MAP_HEADER_FLATMAP; - m->size = n; - m->keys = t; - } - t = make_flatmap(ehp); - ehp += MAP_HEADER_FLATMAP_SZ; - while (n--) { - *ehp++ = *--esp; - } - *esp++ = t; - break; - case matchMkHashMap: - n = *pc++; - esp -= 2*n; - ehp = HAllocX(build_proc, 2*n, HEAP_XTRA); - { - ErtsHeapFactory factory; - Uint ix; - for (ix = 0; ix < 2*n; ix++){ - ehp[ix] = esp[ix]; - } - erts_factory_proc_init(&factory, build_proc); - t = erts_hashmap_from_array(&factory, ehp, n, 0); - erts_factory_close(&factory); - } - *esp++ = t; - break; case matchCall0: bif = (Eterm (*)(Process*, ...)) *pc++; t = (*bif)(build_proc, bif_args); @@ -2799,10 +2601,10 @@ } ASSERT(((DbTableCommon*)handle->tb)->compress); - ASSERT(!(handle->flags & DB_MUST_RESIZE)); + ASSERT(!handle->mustResize); handle->dbterm = db_alloc_tmp_uncompressed(&handle->tb->common, handle->dbterm); - handle->flags |= DB_MUST_RESIZE; + handle->mustResize = 1; return handle->dbterm->tpl[position]; } @@ -2835,11 +2637,11 @@ #endif return; } - if (!(handle->flags & DB_MUST_RESIZE)) { + if (!handle->mustResize) { if (handle->tb->common.compress) { handle->dbterm = db_alloc_tmp_uncompressed(&handle->tb->common, handle->dbterm); - handle->flags |= DB_MUST_RESIZE; + handle->mustResize = 1; oldval = handle->dbterm->tpl[position]; #if HALFWORD_HEAP old_base = NULL; @@ -2899,7 +2701,7 @@ /* write new value in old dbterm, finalize will make a flat copy */ handle->dbterm->tpl[position] = newval; - handle->flags |= DB_MUST_RESIZE; + handle->mustResize = 1; #if HALFWORD_HEAP if (old_base && newval_sz > 0) { @@ -3194,7 +2996,6 @@ { Eterm* hp = *hpp; int i, arity = arityval(bp->tpl[0]); - ErtsHeapFactory factory; hp[0] = bp->tpl[0]; *hpp += arity + 1; @@ -3202,23 +3003,17 @@ hp[tb->keypos] = copy_struct_rel(bp->tpl[tb->keypos], size_object_rel(bp->tpl[tb->keypos], bp->tpl), hpp, off_heap, bp->tpl, NULL); - - erts_factory_static_init(&factory, *hpp, bp->size - (arity+1), off_heap); - for (i=arity; i>0; i--) { if (i != tb->keypos) { if (is_immed(bp->tpl[i])) { hp[i] = bp->tpl[i]; } else { - hp[i] = erts_decode_ext_ets(&factory, + hp[i] = erts_decode_ext_ets(hpp, off_heap, elem2ext(bp->tpl, i)); } } } - *hpp = factory.hp; - erts_factory_close(&factory); - ASSERT((*hpp - hp) <= bp->size); #ifdef DEBUG_CLONE ASSERT(eq_rel(make_tuple(hp),NULL,make_tuple(bp->debug_clone),bp->debug_clone)); @@ -3237,13 +3032,12 @@ if (tb->compress && pos != tb->keypos) { byte* ext = elem2ext(obj->tpl, pos); Sint sz = erts_decode_ext_size_ets(ext, db_alloced_size_comp(obj)) + extra; - Eterm copy; - ErtsHeapFactory factory; - - erts_factory_proc_prealloc_init(&factory, p, sz); - copy = erts_decode_ext_ets(&factory, ext); - *hpp = erts_produce_heap(&factory, extra, 0); - erts_factory_close(&factory); + Eterm* hp = HAlloc(p, sz); + Eterm* endp = hp + sz; + Eterm copy = erts_decode_ext_ets(&hp, &MSO(p), ext); + *hpp = hp; + hp += extra; + HRelease(p, endp, hp); #ifdef DEBUG_CLONE ASSERT(eq_rel(copy, NULL, obj->debug_clone[pos], obj->debug_clone)); #endif @@ -3357,86 +3151,39 @@ return N; } -/* check if node is (or contains) a map - * return 1 if node contains a map - * return 0 otherwise - */ - -int db_has_map(Eterm node) { - DECLARE_ESTACK(s); - - ESTACK_PUSH(s,node); - while (!ESTACK_ISEMPTY(s)) { - node = ESTACK_POP(s); - if (is_list(node)) { - while (is_list(node)) { - ESTACK_PUSH(s,CAR(list_val(node))); - node = CDR(list_val(node)); - } - ESTACK_PUSH(s,node); /* Non wellformed list or [] */ - } else if (is_tuple(node)) { - Eterm *tuple = tuple_val(node); - int arity = arityval(*tuple); - while(arity--) { - ESTACK_PUSH(s,*(++tuple)); - } - } else if is_map(node) { - DESTROY_ESTACK(s); - return 1; - } - } - DESTROY_ESTACK(s); - return 0; -} /* check if obj is (or contains) a variable */ /* return 1 if obj contains a variable or underscore */ /* return 0 if obj is fully ground */ -int db_has_variable(Eterm node) { - DECLARE_ESTACK(s); - - ESTACK_PUSH(s,node); - while (!ESTACK_ISEMPTY(s)) { - node = ESTACK_POP(s); - switch(node & _TAG_PRIMARY_MASK) { - case TAG_PRIMARY_LIST: - while (is_list(node)) { - ESTACK_PUSH(s,CAR(list_val(node))); - node = CDR(list_val(node)); - } - ESTACK_PUSH(s,node); /* Non wellformed list or [] */ - break; - case TAG_PRIMARY_BOXED: - if (is_tuple(node)) { - Eterm *tuple = tuple_val(node); - int arity = arityval(*tuple); - while(arity--) { - ESTACK_PUSH(s,*(++tuple)); - } - } else if (is_flatmap(node)) { - Eterm *values = flatmap_get_values(flatmap_val(node)); - Uint size = flatmap_get_size(flatmap_val(node)); - ESTACK_PUSH(s, ((flatmap_t *) flatmap_val(node))->keys); - while (size--) { - ESTACK_PUSH(s, *(values++)); - } - } else if (is_map(node)) { /* other map-nodes or map-heads */ - Eterm *ptr = hashmap_val(node); - int i = hashmap_bitcount(MAP_HEADER_VAL(*ptr)); - ptr += MAP_HEADER_ARITY(*ptr); - while(i--) { ESTACK_PUSH(s, *++ptr); } - } - break; - case TAG_PRIMARY_IMMED1: - if (node == am_Underscore || db_is_variable(node) >= 0) { - DESTROY_ESTACK(s); +int db_has_variable(Eterm obj) +{ + switch(obj & _TAG_PRIMARY_MASK) { + case TAG_PRIMARY_LIST: { + while (is_list(obj)) { + if (db_has_variable(CAR(list_val(obj)))) return 1; + obj = CDR(list_val(obj)); + } + return(db_has_variable(obj)); /* Non wellformed list or [] */ + } + case TAG_PRIMARY_BOXED: + if (!BOXED_IS_TUPLE(obj)) { + return 0; + } else { + Eterm *tuple = tuple_val(obj); + int arity = arityval(*tuple++); + while(arity--) { + if (db_has_variable(*tuple)) + return 1; + tuple++; } - break; + return(0); } + case TAG_PRIMARY_IMMED1: + if (obj == am_Underscore || db_is_variable(obj) >= 0) + return 1; } - DESTROY_ESTACK(s); return 0; } @@ -3496,9 +3243,11 @@ { Sint n; Eterm *hp; + ErlHeapFragment *tmp_mb; Uint sz, sz2, sz3; Uint i, j; + switch (c & _TAG_PRIMARY_MASK) { case TAG_PRIMARY_IMMED1: if ((n = db_is_variable(c)) >= 0) { /* variable */ @@ -3585,16 +3334,6 @@ DMC_PUSH(*text, n); DMC_PUSH(*stack, c); break; - case (_TAG_HEADER_MAP >> _TAG_PRIMARY_SIZE): - if (is_flatmap(c)) - n = flatmap_get_size(flatmap_val(c)); - else - n = hashmap_size(c); - DMC_PUSH(*text, matchPushM); - ++(context->stack_used); - DMC_PUSH(*text, n); - DMC_PUSH(*stack, c); - break; case (_TAG_HEADER_REF >> _TAG_PRIMARY_SIZE): { Eterm* ref_val = internal_ref_val(c); @@ -3676,8 +3415,16 @@ #endif break; default: /* BINARY, FUN, VECTOR, or EXTERNAL */ + /* + ** Make a private copy... + */ + n = size_object(c); + tmp_mb = new_message_buffer(n); + hp = tmp_mb->mem; DMC_PUSH(*text, matchEqBin); - DMC_PUSH(*text, dmc_private_copy(context, c)); + DMC_PUSH(*text, copy_struct(c, n, &hp, &(tmp_mb->off_heap))); + tmp_mb->next = context->save; + context->save = tmp_mb; break; } break; @@ -3690,22 +3437,6 @@ } /* -** Make a private copy of a term in a context. -*/ - -static Eterm -dmc_private_copy(DMCContext *context, Eterm c) -{ - Uint n = size_object(c); - ErlHeapFragment *tmp_mb = new_message_buffer(n); - Eterm *hp = tmp_mb->mem; - Eterm copy = copy_struct(c, n, &hp, &(tmp_mb->off_heap)); - tmp_mb->next = context->save; - context->save = tmp_mb; - return copy; -} - -/* ** Match guard compilation */ @@ -3796,78 +3527,57 @@ return retOk; } -static void -dmc_rearrange_constants(DMCContext *context, DMC_STACK_TYPE(UWord) *text, - int textpos, Eterm *p, Uint nelems) +static DMCRet dmc_tuple(DMCContext *context, + DMCHeap *heap, + DMC_STACK_TYPE(UWord) *text, + Eterm t, + int *constant) { DMC_STACK_TYPE(UWord) instr_save; - Uint i; - - DMC_INIT_STACK(instr_save); - while (DMC_STACK_NUM(*text) > textpos) { - DMC_PUSH(instr_save, DMC_POP(*text)); - } - for (i = nelems; i--;) { - do_emit_constant(context, text, p[i]); - } - while(!DMC_EMPTY(instr_save)) { - DMC_PUSH(*text, DMC_POP(instr_save)); - } - DMC_FREE(instr_save); -} - -static DMCRet -dmc_array(DMCContext *context, DMCHeap *heap, DMC_STACK_TYPE(UWord) *text, - Eterm *p, Uint nelems, int *constant) -{ int all_constant = 1; int textpos = DMC_STACK_NUM(*text); + Eterm *p = tuple_val(t); + Uint nelems = arityval(*p); Uint i; + int c; + DMCRet ret; /* - ** We remember where we started to layout code, + ** We remember where we started to layout code, ** assume all is constant and back up and restart if not so. - ** The array should be laid out with the last element first, - ** so we can memcpy it to the eheap. + ** The tuple should be laid out with the last element first, + ** so we can memcpy the tuple to the eheap. */ - for (i = nelems; i--;) { - DMCRet ret; - int c; - - ret = dmc_expr(context, heap, text, p[i], &c); - if (ret != retOk) { - return ret; - } - if (!c && all_constant) { - all_constant = 0; - if (i < nelems - 1) { - dmc_rearrange_constants(context, text, textpos, - p + i + 1, nelems - i - 1); - } - } else if (c && !all_constant) { - do_emit_constant(context, text, p[i]); - } - } - *constant = all_constant; - return retOk; -} - -static DMCRet -dmc_tuple(DMCContext *context, DMCHeap *heap, DMC_STACK_TYPE(UWord) *text, - Eterm t, int *constant) -{ - int all_constant; - Eterm *p = tuple_val(t); - Uint nelems = arityval(*p); - DMCRet ret; + for (i = nelems; i > 0; --i) { + if ((ret = dmc_expr(context, heap, text, p[i], &c)) != retOk) + return ret; + if (!c && all_constant) { + all_constant = 0; + if (i < nelems) { + Uint j; - ret = dmc_array(context, heap, text, p + 1, nelems, &all_constant); - if (ret != retOk) { - return ret; + /* + * Oops, we need to relayout the constants. + * Save the already laid out instructions. + */ + DMC_INIT_STACK(instr_save); + while (DMC_STACK_NUM(*text) > textpos) + DMC_PUSH(instr_save, DMC_POP(*text)); + for (j = nelems; j > i; --j) + do_emit_constant(context, text, p[j]); + while(!DMC_EMPTY(instr_save)) + DMC_PUSH(*text, DMC_POP(instr_save)); + DMC_FREE(instr_save); + } + } else if (c && !all_constant) { + /* push a constant */ + do_emit_constant(context, text, p[i]); + } } + if (all_constant) { - *constant = 1; - return retOk; + *constant = 1; + return retOk; } DMC_PUSH(*text, matchMkTuple); DMC_PUSH(*text, nelems); @@ -3876,93 +3586,6 @@ return retOk; } -static DMCRet -dmc_map(DMCContext *context, DMCHeap *heap, DMC_STACK_TYPE(UWord) *text, - Eterm t, int *constant) -{ - int nelems; - int constant_values; - DMCRet ret; - if (is_flatmap(t)) { - flatmap_t *m = (flatmap_t *)flatmap_val(t); - Eterm *values = flatmap_get_values(m); - - nelems = flatmap_get_size(m); - ret = dmc_array(context, heap, text, values, nelems, &constant_values); - - if (ret != retOk) { - return ret; - } - if (constant_values) { - *constant = 1; - return retOk; - } - DMC_PUSH(*text, matchPushC); - DMC_PUSH(*text, dmc_private_copy(context, m->keys)); - if (++context->stack_used > context->stack_need) { - context->stack_need = context->stack_used; - } - DMC_PUSH(*text, matchMkFlatMap); - DMC_PUSH(*text, nelems); - context->stack_used -= nelems; - *constant = 0; - return retOk; - } else { - DECLARE_WSTACK(wstack); - Eterm *kv; - int c; - - ASSERT(is_hashmap(t)); - - hashmap_iterator_init(&wstack, t, 1); - constant_values = 1; - nelems = hashmap_size(t); - - while ((kv=hashmap_iterator_prev(&wstack)) != NULL) { - if ((ret = dmc_expr(context, heap, text, CDR(kv), &c)) != retOk) { - DESTROY_WSTACK(wstack); - return ret; - } - if (!c) - constant_values = 0; - } - - if (constant_values) { - *constant = 1; - DESTROY_WSTACK(wstack); - return retOk; - } - - *constant = 0; - - hashmap_iterator_init(&wstack, t, 1); - - while ((kv=hashmap_iterator_prev(&wstack)) != NULL) { - /* push key */ - if ((ret = dmc_expr(context, heap, text, CAR(kv), &c)) != retOk) { - DESTROY_WSTACK(wstack); - return ret; - } - if (c) { - do_emit_constant(context, text, CAR(kv)); - } - /* push value */ - if ((ret = dmc_expr(context, heap, text, CDR(kv), &c)) != retOk) { - DESTROY_WSTACK(wstack); - return ret; - } - if (c) { - do_emit_constant(context, text, CDR(kv)); - } - } - DMC_PUSH(*text, matchMkHashMap); - DMC_PUSH(*text, nelems); - context->stack_used -= nelems; - DESTROY_WSTACK(wstack); - return retOk; - } -} - static DMCRet dmc_whole_expression(DMCContext *context, DMCHeap *heap, DMC_STACK_TYPE(UWord) *text, @@ -4957,10 +4580,7 @@ return ret; break; case TAG_PRIMARY_BOXED: - if (is_map(t)) { - return dmc_map(context, heap, text, t, constant); - } - if (!is_tuple(t)) { + if (!BOXED_IS_TUPLE(t)) { goto simple_term; } p = tuple_val(t); @@ -5235,7 +4855,7 @@ *hp += 2; break; case TAG_PRIMARY_BOXED: - if (is_tuple(t)) { + if (BOXED_IS_TUPLE(t)) { if (arityval(*tuple_val(t)) == 1 && is_tuple(a = tuple_val(t)[1])) { Uint i,n; @@ -5506,18 +5126,6 @@ ++t; erts_printf("Tuple\t%beu\n", n); break; - case matchMap: - ++t; - n = *t; - ++t; - erts_printf("Map\t%beu\n", n); - break; - case matchKey: - ++t; - p = (Eterm) *t; - ++t; - erts_printf("Key\t%p (%T)\n", t, p); - break; case matchPushT: ++t; n = *t; @@ -5528,20 +5136,10 @@ ++t; erts_printf("PushL\n"); break; - case matchPushM: - ++t; - n = *t; - ++t; - erts_printf("PushM\t%beu\n", n); - break; case matchPop: ++t; erts_printf("Pop\n"); break; - case matchSwap: - ++t; - erts_printf("Swap\n"); - break; case matchBind: ++t; n = *t; @@ -5654,18 +5252,6 @@ ++t; erts_printf("MkTuple\t%beu\n", n); break; - case matchMkFlatMap: - ++t; - n = *t; - ++t; - erts_printf("MkFlatMap\t%beu\n", n); - break; - case matchMkHashMap: - ++t; - n = *t; - ++t; - erts_printf("MkHashMap\t%beu\n", n); - break; case matchOr: ++t; n = *t; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_db_util.h erlang-17.3-dfsg/erts/emulator/beam/erl_db_util.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_db_util.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_db_util.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -77,9 +76,6 @@ union db_table; typedef union db_table DbTable; -#define DB_MUST_RESIZE 1 -#define DB_NEW_OBJECT 2 - /* Info about a database entry while it's being updated * (by update_counter or update_element) */ @@ -88,7 +84,7 @@ DbTerm* dbterm; void** bp; /* {Hash|Tree}DbTerm** */ Uint new_size; - int flags; + int mustResize; void* lck; #if HALFWORD_HEAP unsigned char* abs_vec; /* [i] true if dbterm->tpl[i] is absolute Eterm */ @@ -169,7 +165,6 @@ DbTable* tb, /* [in out] */ Eterm continuation, Eterm* ret); - int (*db_take)(Process *, DbTable *, Eterm, Eterm *); int (*db_delete_all_objects)(Process* p, DbTable* db /* [in out] */ ); @@ -187,14 +182,15 @@ void *arg); void (*db_check_table)(DbTable* tb); - /* Lookup a dbterm for updating. Return false if not found. */ - int (*db_lookup_dbterm)(Process *, DbTable *, Eterm key, Eterm obj, - DbUpdateHandle* handle); - - /* Must be called for each db_lookup_dbterm that returned true, even if - ** dbterm was not updated. If the handle was of a new object and cret is - ** not DB_ERROR_NONE, the object is removed from the table. */ - void (*db_finalize_dbterm)(int cret, DbUpdateHandle* handle); + /* Lookup a dbterm for updating. Return false if not found. + */ + int (*db_lookup_dbterm)(DbTable*, Eterm key, + DbUpdateHandle* handle); /* [out] */ + + /* Must be called for each db_lookup_dbterm that returned true, + ** even if dbterm was not updated. + */ + void (*db_finalize_dbterm)(DbUpdateHandle* handle); } DbTableMethod; @@ -343,7 +339,6 @@ void* db_store_term_comp(DbTableCommon *tb, DbTerm* old, Uint offset, Eterm obj); Eterm db_copy_element_from_ets(DbTableCommon* tb, Process* p, DbTerm* obj, Uint pos, Eterm** hpp, Uint extra); -int db_has_map(Eterm obj); int db_has_variable(Eterm obj); int db_is_variable(Eterm obj); void db_do_update_element(DbUpdateHandle* handle, diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_debug.c erlang-17.3-dfsg/erts/emulator/beam/erl_debug.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_debug.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_debug.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -189,9 +188,6 @@ case BINARY_DEF: erts_print(to, to_arg, "#Bin"); break; - case MATCHSTATE_DEF: - erts_print(to, to_arg, "#Matchstate"); - break; default: erts_print(to, to_arg, "unknown object %x", obj); } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_debug.h erlang-17.3-dfsg/erts/emulator/beam/erl_debug.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_debug.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_debug.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_driver.h erlang-17.3-dfsg/erts/emulator/beam/erl_driver.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_driver.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_driver.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -134,7 +133,7 @@ #define ERL_DRV_EXTENDED_MARKER (0xfeeeeeed) #define ERL_DRV_EXTENDED_MAJOR_VERSION 3 -#define ERL_DRV_EXTENDED_MINOR_VERSION 2 +#define ERL_DRV_EXTENDED_MINOR_VERSION 1 /* * The emulator will refuse to load a driver with a major version @@ -362,9 +361,6 @@ /* Called on behalf of driver_select when it is safe to release 'event'. A typical unix driver would call close(event) */ - void (*emergency_close)(ErlDrvData drv_data); - /* called when the port is closed abruptly. - specifically when erl_crash_dump is called. */ /* When adding entries here, dont forget to pad in obsolete/driver.h */ } ErlDrvEntry; @@ -696,8 +692,8 @@ EXTERN char *driver_dl_error(void); /* environment */ -EXTERN int erl_drv_putenv(const char *key, char *value); -EXTERN int erl_drv_getenv(const char *key, char *value, size_t *value_size); +EXTERN int erl_drv_putenv(char *key, char *value); +EXTERN int erl_drv_getenv(char *key, char *value, size_t *value_size); #ifdef __OSE__ typedef ErlDrvUInt ErlDrvOseEventId; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_drv_nif.h erlang-17.3-dfsg/erts/emulator/beam/erl_drv_nif.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_drv_nif.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_drv_nif.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_drv_thread.c erlang-17.3-dfsg/erts/emulator/beam/erl_drv_thread.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_drv_thread.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_drv_thread.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -602,16 +601,17 @@ #ifdef USE_THREADS int res; struct ErlDrvTid_ *dtid; - ethr_thr_opts ethr_opts = ETHR_THR_OPTS_DEFAULT_INITER; + ethr_thr_opts ethr_opts; ethr_thr_opts *use_opts; + ethr_thr_opts def_ethr_opts = ETHR_THR_OPTS_DEFAULT_INITER; - if (!opts && !name) + if (!opts) use_opts = NULL; else { - if(opts) - ethr_opts.suggested_stack_size = opts->suggested_stack_size; - - ethr_opts.name = name; + sys_memcpy((void *) ðr_opts, + (void *) &def_ethr_opts, + sizeof(ethr_thr_opts)); + ethr_opts.suggested_stack_size = opts->suggested_stack_size; use_opts = ðr_opts; } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_fun.c erlang-17.3-dfsg/erts/emulator/beam/erl_fun.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_fun.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_fun.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_fun.h erlang-17.3-dfsg/erts/emulator/beam/erl_fun.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_fun.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_fun.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_gc.c erlang-17.3-dfsg/erts/emulator/beam/erl_gc.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_gc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_gc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -21,8 +20,6 @@ # include "config.h" #endif -#define ERL_WANT_GC_INTERNALS__ - #include "sys.h" #include "erl_vm.h" #include "global.h" @@ -40,7 +37,6 @@ #include "hipe_mode_switch.h" #endif #include "dtrace-wrapper.h" -#include "erl_bif_unique.h" #define ERTS_INACT_WR_PB_LEAVE_MUCH_LIMIT 1 #define ERTS_INACT_WR_PB_LEAVE_MUCH_PERCENTAGE 20 @@ -109,7 +105,8 @@ char* src, Uint src_size); static Eterm* collect_heap_frags(Process* p, Eterm* heap, Eterm* htop, Eterm* objv, int nobj); -static void adjust_after_fullsweep(Process *p, int need, Eterm *objv, int nobj); +static Uint adjust_after_fullsweep(Process *p, Uint size_before, + int need, Eterm *objv, int nobj); static void shrink_new_heap(Process *p, Uint new_sz, Eterm *objv, int nobj); static void grow_new_heap(Process *p, Uint new_sz, Eterm* objv, int nobj); static void sweep_off_heap(Process *p, int fullsweep); @@ -176,15 +173,15 @@ int i = 0, ix; Sint max_heap_size = 0; - ERTS_CT_ASSERT(offsetof(ProcBin,thing_word) == offsetof(struct erl_off_heap_header,thing_word)); - ERTS_CT_ASSERT(offsetof(ProcBin,thing_word) == offsetof(ErlFunThing,thing_word)); - ERTS_CT_ASSERT(offsetof(ProcBin,thing_word) == offsetof(ExternalThing,header)); - ERTS_CT_ASSERT(offsetof(ProcBin,size) == offsetof(struct erl_off_heap_header,size)); - ERTS_CT_ASSERT(offsetof(ProcBin,size) == offsetof(ErlSubBin,size)); - ERTS_CT_ASSERT(offsetof(ProcBin,size) == offsetof(ErlHeapBin,size)); - ERTS_CT_ASSERT(offsetof(ProcBin,next) == offsetof(struct erl_off_heap_header,next)); - ERTS_CT_ASSERT(offsetof(ProcBin,next) == offsetof(ErlFunThing,next)); - ERTS_CT_ASSERT(offsetof(ProcBin,next) == offsetof(ExternalThing,next)); + ASSERT(offsetof(ProcBin,thing_word) == offsetof(struct erl_off_heap_header,thing_word)); + ASSERT(offsetof(ProcBin,thing_word) == offsetof(ErlFunThing,thing_word)); + ASSERT(offsetof(ProcBin,thing_word) == offsetof(ExternalThing,header)); + ASSERT(offsetof(ProcBin,size) == offsetof(struct erl_off_heap_header,size)); + ASSERT(offsetof(ProcBin,size) == offsetof(ErlSubBin,size)); + ASSERT(offsetof(ProcBin,size) == offsetof(ErlHeapBin,size)); + ASSERT(offsetof(ProcBin,next) == offsetof(struct erl_off_heap_header,next)); + ASSERT(offsetof(ProcBin,next) == offsetof(ErlFunThing,next)); + ASSERT(offsetof(ProcBin,next) == offsetof(ExternalThing,next)); erts_test_long_gc_sleep = 0; @@ -403,7 +400,7 @@ { Uint reclaimed_now = 0; int done = 0; - ErtsMonotonicTime start_time = 0; /* Shut up faulty warning... */ + Uint ms1, s1, us1; ErtsSchedulerData *esdp; #ifdef USE_VM_PROBES DTRACE_CHARBUF(pidbuf, DTRACE_TERM_BUF_SIZE); @@ -420,9 +417,10 @@ trace_gc(p, am_gc_start); } - (void) erts_smp_atomic32_read_bor_nob(&p->state, ERTS_PSFLG_GC); - if (erts_system_monitor_long_gc != 0) - start_time = erts_get_monotonic_time(esdp); + erts_smp_atomic32_read_bor_nob(&p->state, ERTS_PSFLG_GC); + if (erts_system_monitor_long_gc != 0) { + get_now(&ms1, &s1, &us1); + } ERTS_CHK_OFFHEAP(p); @@ -470,14 +468,16 @@ } if (erts_system_monitor_long_gc != 0) { - ErtsMonotonicTime end_time; - Uint gc_time; + Uint ms2, s2, us2; + Sint t; if (erts_test_long_gc_sleep) while (0 != erts_milli_sleep(erts_test_long_gc_sleep)); - end_time = erts_get_monotonic_time(esdp); - gc_time = (Uint) ERTS_MONOTONIC_TO_MSEC(end_time - start_time); - if (gc_time && gc_time > erts_system_monitor_long_gc) { - monitor_long_gc(p, gc_time); + get_now(&ms2, &s2, &us2); + t = ms2 - ms1; + t = t*1000000 + s2 - s1; + t = t*1000 + ((Sint) (us2 - us1))/1000; + if (t > 0 && (Uint)t > erts_system_monitor_long_gc) { + monitor_long_gc(p, t); } } if (erts_system_monitor_large_heap != 0) { @@ -677,7 +677,7 @@ Uint area_size; Eterm* old_htop; Uint n; - struct erl_off_heap_header** prev = NULL; + struct erl_off_heap_header** prev; if (p->flags & F_DISABLE_GC) return; @@ -786,10 +786,10 @@ */ if (oh) { - prev = &MSO(p).first; - while (*prev) { - prev = &(*prev)->next; - } + prev = &MSO(p).first; + while (*prev) { + prev = &(*prev)->next; + } } /* @@ -818,10 +818,6 @@ oh = oh->next; } - if (prev) { - *prev = NULL; - } - /* * We no longer need this temporary area. */ @@ -872,37 +868,29 @@ ErlMessage *msgp; Uint size_after; Uint need_after; - const Uint stack_size = STACK_SZ_ON_HEAP(p); - const Uint size_before = MBUF_SIZE(p) + (HEAP_TOP(p) - HEAP_START(p)); - Uint new_sz = HEAP_SIZE(p) + MBUF_SIZE(p) + combined_message_size(p); - new_sz = next_heap_size(p, new_sz, 0); + Uint stack_size = STACK_SZ_ON_HEAP(p); + Uint fragments = MBUF_SIZE(p) + combined_message_size(p); + Uint size_before = fragments + (HEAP_TOP(p) - HEAP_START(p)); + Uint new_sz = next_heap_size(p, HEAP_SIZE(p) + fragments, 0); do_minor(p, new_sz, objv, nobj); - size_after = HEAP_TOP(p) - HEAP_START(p); - *recl += (size_before - size_after); - - /* + /* * Copy newly received message onto the end of the new heap. */ - ErtsGcQuickSanityCheck(p); - for (msgp = p->msg.first; msgp; msgp = msgp->next) { - if (msgp->data.attached) { - ErtsHeapFactory factory; - erts_factory_proc_prealloc_init(&factory, p, - erts_msg_attached_data_size(msgp)); - erts_move_msg_attached_data_to_heap(&factory, msgp); - erts_factory_close(&factory); - ErtsGcQuickSanityCheck(p); - } - } + ErtsGcQuickSanityCheck(p); + for (msgp = p->msg.first; msgp; msgp = msgp->next) { + if (msgp->data.attached) { + erts_move_msg_attached_data_to_heap(&p->htop, &p->off_heap, msgp); + ErtsGcQuickSanityCheck(p); + } + } ErtsGcQuickSanityCheck(p); GEN_GCS(p)++; - need_after = ((HEAP_TOP(p) - HEAP_START(p)) - + erts_used_frag_sz(MBUF(p)) - + need - + stack_size); + size_after = HEAP_TOP(p) - HEAP_START(p); + need_after = size_after + need + stack_size; + *recl += (size_before - size_after); /* * Excessively large heaps should be shrunk, but @@ -937,7 +925,6 @@ } ASSERT(HEAP_SIZE(p) == next_heap_size(p, HEAP_SIZE(p), 0)); - ASSERT(MBUF(p) == NULL); return 1; /* We are done. */ } @@ -946,7 +933,6 @@ * The heap size turned out to be just right. We are done. */ ASSERT(HEAP_SIZE(p) == next_heap_size(p, HEAP_SIZE(p), 0)); - ASSERT(MBUF(p) == NULL); return 1; } } @@ -1226,9 +1212,7 @@ { Rootset rootset; Roots* roots; - const Uint size_before = ((HEAP_TOP(p) - HEAP_START(p)) - + (OLD_HTOP(p) - OLD_HEAP(p)) - + MBUF_SIZE(p)); + Uint size_before; Eterm* n_heap; Eterm* n_htop; char* src = (char *) HEAP_START(p); @@ -1237,16 +1221,25 @@ Uint oh_size = (char *) OLD_HTOP(p) - oh; Uint n; Uint new_sz; - int done; + Uint fragments = MBUF_SIZE(p) + combined_message_size(p); + ErlMessage *msgp; + + size_before = fragments + (HEAP_TOP(p) - HEAP_START(p)); /* * Do a fullsweep GC. First figure out the size of the heap * to receive all live data. */ - new_sz = (HEAP_SIZE(p) + MBUF_SIZE(p) - + combined_message_size(p) - + (OLD_HTOP(p) - OLD_HEAP(p))); + new_sz = HEAP_SIZE(p) + fragments + (OLD_HTOP(p) - OLD_HEAP(p)); + /* + * We used to do + * + * new_sz += STACK_SZ_ON_HEAP(p); + * + * here for no obvious reason. (The stack size is already counted once + * in HEAP_SIZE(p).) + */ new_sz = next_heap_size(p, new_sz, 0); /* @@ -1439,56 +1432,42 @@ ErtsGcQuickSanityCheck(p); - *recl += size_before - (HEAP_TOP(p) - HEAP_START(p)); - - remove_message_buffers(p); - - { - ErlMessage *msgp; - - /* - * Copy newly received message onto the end of the new heap. - */ - for (msgp = p->msg.first; msgp; msgp = msgp->next) { - if (msgp->data.attached) { - ErtsHeapFactory factory; - erts_factory_proc_prealloc_init(&factory, p, - erts_msg_attached_data_size(msgp)); - erts_move_msg_attached_data_to_heap(&factory, msgp); - erts_factory_close(&factory); - ErtsGcQuickSanityCheck(p); - } + /* + * Copy newly received message onto the end of the new heap. + */ + for (msgp = p->msg.first; msgp; msgp = msgp->next) { + if (msgp->data.attached) { + erts_move_msg_attached_data_to_heap(&p->htop, &p->off_heap, msgp); + ErtsGcQuickSanityCheck(p); } } - if (MBUF(p)) { - /* This is a very rare case when distributed messages copied above - * contained maps so big they did not fit on the heap causing the - * factory to create heap frags. - * Solution: Trigger a minor gc (without tenuring) - */ - HIGH_WATER(p) = HEAP_START(p); - done = 0; - } else { - adjust_after_fullsweep(p, need, objv, nobj); - done = 1; - } + *recl += adjust_after_fullsweep(p, size_before, need, objv, nobj); + +#ifdef HARDDEBUG + disallow_heap_frag_ref_in_heap(p); +#endif + remove_message_buffers(p); ErtsGcQuickSanityCheck(p); - return done; + return 1; /* We are done. */ } -static void -adjust_after_fullsweep(Process *p, int need, Eterm *objv, int nobj) +static Uint +adjust_after_fullsweep(Process *p, Uint size_before, int need, Eterm *objv, int nobj) { - Uint wanted, sz, need_after; + Uint wanted, sz, size_after, need_after; Uint stack_size = STACK_SZ_ON_HEAP(p); + Uint reclaimed_now; + + size_after = (HEAP_TOP(p) - HEAP_START(p)); + reclaimed_now = (size_before - size_after); /* * Resize the heap if needed. */ - need_after = (HEAP_TOP(p) - HEAP_START(p)) + need + stack_size; + need_after = size_after + need + stack_size; if (HEAP_SIZE(p) < need_after) { /* Too small - grow to match requested need */ sz = next_heap_size(p, need_after, 0); @@ -1511,6 +1490,8 @@ shrink_new_heap(p, sz, objv, nobj); } } + + return reclaimed_now; } /* @@ -1520,12 +1501,13 @@ static Uint combined_message_size(Process* p) { - Uint sz; + Uint sz = 0; ErlMessage *msgp; - for (sz = 0, msgp = p->msg.first; msgp; msgp = msgp->next) { - if (msgp->data.attached) + for (msgp = p->msg.first; msgp; msgp = msgp->next) { + if (msgp->data.attached) { sz += erts_msg_attached_data_size(msgp); + } } return sz; } @@ -1887,21 +1869,6 @@ if (!header_is_thing(gval)) { heap_ptr++; } else { - if (header_is_bin_matchstate(gval)) { - ErlBinMatchState *ms = (ErlBinMatchState*) heap_ptr; - ErlBinMatchBuffer *mb = &(ms->mb); - Eterm* origptr; - origptr = &(mb->orig); - ptr = boxed_val(*origptr); - val = *ptr; - if (IS_MOVED_BOXED(val)) { - *origptr = val; - mb->base = binary_bytes(*origptr); - } else if (in_area(ptr, src, src_size)) { - MOVE_BOXED(ptr,val,htop,origptr); - mb->base = binary_bytes(*origptr); - } - } heap_ptr += (thing_arityval(gval)+1); } break; @@ -1964,18 +1931,7 @@ if (p->dictionary != NULL) { disallow_heap_frag_ref(p, n_htop, p->dictionary->data, p->dictionary->used); } - /* OTP-18: Actually we do allow references from heap to heap fragments now. - This can happen when doing "binary_to_term" with a "fat" map contained - in another term. A "fat" map is a hashmap with higher heap demand than - first estimated by "binary_to_term" causing the factory to allocate - additional heap (fragments) for the hashmap tree nodes. - Run map_SUITE:t_gc_rare_map_overflow to provoke this. - - Inverted references like this does not matter however. The copy done - below by move_one_area() with move markers in the fragments and the - sweeping done later by the GC should make everything ok in the end. - */ - /***disallow_heap_frag_ref_in_heap(p);***/ + disallow_heap_frag_ref_in_heap(p); #endif /* @@ -1984,8 +1940,7 @@ * until next GC. */ qb = MBUF(p); - while (qb != NULL) { - ASSERT(!qb->off_heap.first); /* process fragments use the MSO(p) list */ + while (qb != NULL) { frag_size = qb->used_size * sizeof(Eterm); if (frag_size != 0) { frag_begin = (char *) qb->mem; @@ -2445,6 +2400,7 @@ } pb->val = erts_bin_realloc(pb->val, new_size); + pb->val->orig_size = new_size; pb->bytes = (byte *) pb->val->orig_bytes; } } @@ -2690,7 +2646,11 @@ hpp = &hp; } - erts_queue_message(rp, &rp_locks, bp, msg, NIL); + erts_queue_message(rp, &rp_locks, bp, msg, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); if (gcirp->req_sched == esdp->no) rp_locks &= ~ERTS_PROC_LOCK_MAIN; @@ -2698,7 +2658,7 @@ if (rp_locks) erts_smp_proc_unlock(rp, rp_locks); - erts_proc_dec_refc(rp); + erts_smp_proc_dec_refc(rp); if (erts_smp_atomic32_dec_read_nob(&gcirp->refc) == 0) gcireq_free(vgcirp); @@ -2722,7 +2682,7 @@ erts_smp_atomic32_init_nob(&gcirp->refc, (erts_aint32_t) erts_no_schedulers); - erts_proc_add_refc(c_p, (Sint) erts_no_schedulers); + erts_smp_proc_add_refc(c_p, (Sint32) erts_no_schedulers); #ifdef ERTS_SMP if (erts_no_schedulers > 1) diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_gc.h erlang-17.3-dfsg/erts/emulator/beam/erl_gc.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_gc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_gc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -21,12 +20,10 @@ #ifndef __ERL_GC_H__ #define __ERL_GC_H__ -#if defined(ERL_WANT_GC_INTERNALS__) || defined(ERTS_DO_INCL_GLB_INLINE_FUNC_DEF) +#include "erl_map.h" /* GC declarations shared by beam/erl_gc.c and hipe/hipe_gc.c */ -#include "erl_map.h" - #if defined(DEBUG) && !ERTS_GLB_INLINE_INCL_FUNC_DEF # define HARDDEBUG 1 #endif @@ -56,10 +53,7 @@ nelts = header_arity(HDR); \ switch ((HDR) & _HEADER_SUBTAG_MASK) { \ case SUB_BINARY_SUBTAG: nelts++; break; \ - case MAP_SUBTAG: \ - if (is_flatmap_header(HDR)) nelts+=flatmap_get_size(PTR) + 1; \ - else nelts += hashmap_bitcount(MAP_HEADER_VAL(HDR)); \ - break; \ + case MAP_SUBTAG: nelts+=map_get_size(PTR) + 1; break; \ case FUN_SUBTAG: nelts+=((ErlFunThing*)(PTR))->num_free+1; break; \ } \ gval = make_boxed(HTOP); \ @@ -67,11 +61,14 @@ *HTOP++ = HDR; \ *PTR++ = gval; \ while (nelts--) *HTOP++ = *PTR++; \ + \ } while(0) #define in_area(ptr,start,nbytes) \ ((UWord)((char*)(ptr) - (char*)(start)) < (nbytes)) +extern Uint erts_test_long_gc_sleep; + #if defined(DEBUG) || defined(ERTS_OFFHEAP_DEBUG) int within(Eterm *ptr, Process *p); #endif @@ -100,33 +97,4 @@ } #endif -#endif /* ERL_GC_C__ || HIPE_GC_C__ */ - -/* - * Global exported - */ - -extern Uint erts_test_long_gc_sleep; - -typedef struct { - Uint64 reclaimed; - Uint64 garbage_cols; -} ErtsGCInfo; - -void erts_gc_info(ErtsGCInfo *gcip); -void erts_init_gc(void); -int erts_garbage_collect(struct process*, int, Eterm*, int); -void erts_garbage_collect_hibernate(struct process* p); -Eterm erts_gc_after_bif_call(struct process* p, Eterm result, Eterm* regs, Uint arity); -void erts_garbage_collect_literals(struct process* p, Eterm* literals, - Uint lit_size, - struct erl_off_heap_header* oh); -Uint erts_next_heap_size(Uint, Uint); -Eterm erts_heap_sizes(struct process* p); - -void erts_offset_off_heap(struct erl_off_heap*, Sint, Eterm*, Eterm*); -void erts_offset_heap_ptr(Eterm*, Uint, Sint, Eterm*, Eterm*); -void erts_offset_heap(Eterm*, Uint, Sint, Eterm*, Eterm*); -void erts_free_heap_frags(struct process* p); - #endif /* __ERL_GC_H__ */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_goodfit_alloc.c erlang-17.3-dfsg/erts/emulator/beam/erl_goodfit_alloc.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_goodfit_alloc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_goodfit_alloc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_goodfit_alloc.h erlang-17.3-dfsg/erts/emulator/beam/erl_goodfit_alloc.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_goodfit_alloc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_goodfit_alloc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_hl_timer.c erlang-17.3-dfsg/erts/emulator/beam/erl_hl_timer.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_hl_timer.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_hl_timer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3178 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -/* - * Description: High level timers implementing BIF timers - * as well as process and port timers. - * - * Author: Rickard Green - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "sys.h" -#include "global.h" -#include "bif.h" -#include "erl_bif_unique.h" -#define ERTS_WANT_TIMER_WHEEL_API -#include "erl_time.h" -#include "erl_hl_timer.h" - -#define ERTS_TMR_CHECK_CANCEL_ON_CREATE 0 - -#if 0 -# define ERTS_HLT_HARD_DEBUG -#endif -#if 0 -# define ERTS_HLT_DEBUG -#endif - -#if defined(ERTS_HLT_HARD_DEBUG) || defined(DEBUG) -# if defined(ERTS_HLT_HARD_DEBUG) -# undef ERTS_RBT_HARD_DEBUG -# define ERTS_RBT_HARD_DEBUG 1 -# endif -# ifndef ERTS_HLT_DEBUG -# define ERTS_HLT_DEBUG 1 -# endif -#endif - -#undef ERTS_HLT_ASSERT -#if defined(ERTS_HLT_DEBUG) -# define ERTS_HLT_ASSERT(E) ERTS_ASSERT(E) -# undef ERTS_RBT_DEBUG -# define ERTS_RBT_DEBUG -#else -# define ERTS_HLT_ASSERT(E) ((void) 1) -#endif - -#if defined(ERTS_HLT_HARD_DEBUG) && defined(__GNUC__) -#warning "* * * * * * * * * * * * * * * * * *" -#warning "* ERTS_HLT_HARD_DEBUG IS ENABLED! *" -#warning "* * * * * * * * * * * * * * * * * *" -#endif - -#ifdef ERTS_HLT_HARD_DEBUG -# define ERTS_HLT_HDBG_CHK_SRV(SRV) hdbg_chk_srv((SRV)) -static void hdbg_chk_srv(ErtsHLTimerService *srv); -#else -# define ERTS_HLT_HDBG_CHK_SRV(SRV) ((void) 1) -#endif - -#if ERTS_REF_NUMBERS != 3 -#error "ERTS_REF_NUMBERS changed. Update me..." -#endif - -typedef enum { - ERTS_TMR_BIF, - ERTS_TMR_PROC, - ERTS_TMR_PORT, - ERTS_TMR_CALLBACK -} ErtsTmrType; - -#define ERTS_BIF_TIMER_SHORT_TIME 5000 - -#ifdef ERTS_SMP -# define ERTS_HLT_SMP_MEMBAR_LoadLoad_LoadStore \ - ETHR_MEMBAR(ETHR_LoadLoad|ETHR_LoadStore) -#else -# define ERTS_HLT_SMP_MEMBAR_LoadLoad_LoadStore -#endif - -/* Bit 0 to 9 contains scheduler id (see mask below) */ -#define ERTS_TMR_ROFLG_HLT (((Uint32) 1) << 10) -#define ERTS_TMR_ROFLG_BIF_TMR (((Uint32) 1) << 11) -#define ERTS_TMR_ROFLG_PRE_ALC (((Uint32) 1) << 12) -#define ERTS_TMR_ROFLG_REG_NAME (((Uint32) 1) << 13) -#define ERTS_TMR_ROFLG_PROC (((Uint32) 1) << 14) -#define ERTS_TMR_ROFLG_PORT (((Uint32) 1) << 15) -#define ERTS_TMR_ROFLG_CALLBACK (((Uint32) 1) << 16) -#ifdef ERTS_BTM_ACCESSOR_SUPPORT -#define ERTS_TMR_ROFLG_ABIF_TMR (((Uint32) 1) << 17) -#endif - -#define ERTS_TMR_ROFLG_SID_MASK \ - (ERTS_TMR_ROFLG_HLT - (Uint32) 1) - -#define ERTS_TMR_STATE_ACTIVE ((erts_aint32_t) 0) -#define ERTS_TMR_STATE_CANCELED ((erts_aint32_t) 1) -#define ERTS_TMR_STATE_TIMED_OUT ((erts_aint32_t) 2) - -typedef struct ErtsHLTimer_ ErtsHLTimer; - -#define ERTS_HLT_PFLG_RED (((UWord) 1) << 0) -#define ERTS_HLT_PFLG_SAME_TIME (((UWord) 1) << 1) - -#define ERTS_HLT_PFLGS_MASK \ - (ERTS_HLT_PFLG_RED|ERTS_HLT_PFLG_SAME_TIME) - -#define ERTS_HLT_PFIELD_NOT_IN_TABLE (~((UWord) 0)) - -typedef struct { - UWord parent; /* parent pointer and flags... */ - union { - struct { - ErtsHLTimer *right; - ErtsHLTimer *left; - } t; - struct { - ErtsHLTimer *prev; - ErtsHLTimer *next; - } l; - } u; - ErtsHLTimer *same_time; -} ErtsHLTimerTimeTree; - -typedef struct { - UWord parent; /* parent pointer and flags... */ - ErtsHLTimer *right; - ErtsHLTimer *left; -} ErtsHLTimerTree; - -typedef struct { - Uint32 roflgs; - erts_smp_atomic32_t refc; - union { - void *arg; - erts_atomic_t next; - } u; -} ErtsTmrHead; - -struct ErtsHLTimer_ { - ErtsTmrHead head; /* NEED to be first! */ - union { - ErtsThrPrgrLaterOp cleanup; - ErtsHLTimerTimeTree tree; - } time; - ErtsMonotonicTime timeout; - union { - Process *proc; - Port *port; - Eterm name; - void (*callback)(void *); - } receiver; - -#ifdef ERTS_HLT_HARD_DEBUG - int pending_timeout; -#endif - - erts_smp_atomic32_t state; - - /* BIF timer only fields follow... */ - struct { - Uint32 refn[ERTS_REF_NUMBERS]; - ErtsHLTimerTree proc_tree; - ErtsHLTimerTree tree; - Eterm message; - ErlHeapFragment *bp; - } btm; -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - struct { - Eterm accessor; - ErtsHLTimerTree tree; - } abtm; -#endif -}; - -#define ERTS_HL_PTIMER_SIZE offsetof(ErtsHLTimer, btm) -#ifdef ERTS_BTM_ACCESSOR_SUPPORT -#define ERTS_BIF_TIMER_SIZE offsetof(ErtsHLTimer, abtm) -#define ERTS_ABIF_TIMER_SIZE sizeof(ErtsHLTimer) -#else -#define ERTS_BIF_TIMER_SIZE sizeof(ErtsHLTimer) -#endif - -typedef struct { - ErtsTmrHead head; /* NEED to be first! */ - union { - void *p; - void (*callback)(void *); - } u; - ErtsTWheelTimer tw_tmr; -} ErtsTWTimer; - -typedef union { - ErtsTmrHead head; - ErtsHLTimer hlt; - ErtsTWTimer twt; -} ErtsTimer; - -#ifdef SMALL_MEMORY -#define BIF_TIMER_PREALC_SZ 10 -#define PTIMER_PREALC_SZ 10 -#else -#define BIF_TIMER_PREALC_SZ 100 -#define PTIMER_PREALC_SZ 100 -#endif - -ERTS_SCHED_PREF_PALLOC_IMPL(bif_timer_pre, - ErtsHLTimer, - BIF_TIMER_PREALC_SZ) - -ERTS_SCHED_PREF_QUICK_ALLOC_IMPL(tw_timer, - ErtsTWTimer, - PTIMER_PREALC_SZ, - ERTS_ALC_T_LL_PTIMER) - -#ifdef ERTS_HLT_DEBUG -#define ERTS_TMR_TIMEOUT_YIELD_LIMIT 5 -#else -#define ERTS_TMR_TIMEOUT_YIELD_LIMIT 100 -#endif -#define ERTS_TMR_CANCELED_TIMER_LIMIT 100 -#define ERTS_TMR_CANCELED_TIMER_SMALL_LIMIT 5 - -#define ERTS_TMR_TIMEOUT_YIELD_STATE_T same_time_list_yield_state_t -#define ERTS_TMR_YIELDING_TIMEOUT_STATE_INITER {NULL, {0}} -typedef struct { - int dummy; -} ERTS_TMR_TIMEOUT_YIELD_STATE_T; - -typedef struct { - ErtsTmrHead marker; - erts_atomic_t last; -} ErtsHLTCncldTmrQTail; - -#ifdef ERTS_SMP - -typedef struct { - /* - * This structure needs to be cache line aligned for best - * performance. - */ - union { - /* - * Modified by threads returning canceled - * timers to this timer service. - */ - ErtsHLTCncldTmrQTail data; - char align__[ERTS_ALC_CACHE_LINE_ALIGN_SIZE( - sizeof(ErtsHLTCncldTmrQTail))]; - } tail; - /* - * Everything below this point is *only* accessed by the - * thread managing this timer service. - */ - struct { - ErtsTimer *first; - ErtsTimer *unref_end; - struct { - ErtsThrPrgrVal thr_progress; - int thr_progress_reached; - ErtsTimer *unref_end; - } next; - int used_marker; - } head; -} ErtsHLTCncldTmrQ; - -#endif /* ERTS_SMP */ - -typedef struct { - ErtsHLTimer *root; - ERTS_TMR_TIMEOUT_YIELD_STATE_T state; -} ErtsYieldingTimeoutState; - -struct ErtsHLTimerService_ { -#ifdef ERTS_SMP - ErtsHLTCncldTmrQ canceled_queue; -#endif - ErtsHLTimer *time_tree; - ErtsHLTimer *btm_tree; - ErtsHLTimer *next_timeout; - ErtsYieldingTimeoutState yield; - ErtsTWheelTimer service_timer; -}; - -static ERTS_INLINE int -refn_is_lt(Uint32 *x, Uint32 *y) -{ - /* !0 if x < y */ - if (x[2] < y[2]) - return 1; - if (x[2] != y[2]) - return 0; - if (x[1] < y[1]) - return 1; - if (x[1] != y[1]) - return 0; - return x[0] < y[0]; -} - -#define ERTS_RBT_PREFIX time -#define ERTS_RBT_T ErtsHLTimer -#define ERTS_RBT_KEY_T ErtsMonotonicTime -#define ERTS_RBT_FLAGS_T UWord -#define ERTS_RBT_INIT_EMPTY_TNODE(T) \ - do { \ - (T)->time.tree.parent = (UWord) NULL; \ - (T)->time.tree.u.t.right = NULL; \ - (T)->time.tree.u.t.left = NULL; \ - } while (0) -#define ERTS_RBT_IS_RED(T) \ - ((int) ((T)->time.tree.parent & ERTS_HLT_PFLG_RED)) -#define ERTS_RBT_SET_RED(T) \ - ((T)->time.tree.parent |= ERTS_HLT_PFLG_RED) -#define ERTS_RBT_IS_BLACK(T) \ - (!ERTS_RBT_IS_RED((T))) -#define ERTS_RBT_SET_BLACK(T) \ - ((T)->time.tree.parent &= ~ERTS_HLT_PFLG_RED) -#define ERTS_RBT_GET_FLAGS(T) \ - ((T)->time.tree.parent & ERTS_HLT_PFLGS_MASK) -#define ERTS_RBT_SET_FLAGS(T, F) \ - do { \ - ERTS_HLT_ASSERT((((UWord) (F)) & ~ERTS_HLT_PFLGS_MASK) == 0); \ - (T)->time.tree.parent &= ~ERTS_HLT_PFLGS_MASK; \ - (T)->time.tree.parent |= (F); \ - } while (0) -#define ERTS_RBT_GET_PARENT(T) \ - ((ErtsHLTimer *) ((T)->time.tree.parent & ~ERTS_HLT_PFLGS_MASK)) -#define ERTS_RBT_SET_PARENT(T, P) \ - do { \ - ERTS_HLT_ASSERT((((UWord) (P)) & ERTS_HLT_PFLGS_MASK) == 0); \ - (T)->time.tree.parent &= ERTS_HLT_PFLGS_MASK; \ - (T)->time.tree.parent |= (UWord) (P); \ - } while (0) -#define ERTS_RBT_GET_RIGHT(T) ((T)->time.tree.u.t.right) -#define ERTS_RBT_SET_RIGHT(T, R) ((T)->time.tree.u.t.right = (R)) -#define ERTS_RBT_GET_LEFT(T) ((T)->time.tree.u.t.left) -#define ERTS_RBT_SET_LEFT(T, L) ((T)->time.tree.u.t.left = (L)) -#define ERTS_RBT_GET_KEY(T) ((T)->timeout) -#define ERTS_RBT_IS_LT(KX, KY) ((KX) < (KY)) -#define ERTS_RBT_IS_EQ(KX, KY) ((KX) == (KY)) -#define ERTS_RBT_WANT_DELETE -#define ERTS_RBT_WANT_SMALLEST -#define ERTS_RBT_WANT_LOOKUP_INSERT -#define ERTS_RBT_WANT_REPLACE -#define ERTS_RBT_WANT_FOREACH -#ifdef ERTS_HLT_HARD_DEBUG -# define ERTS_RBT_WANT_LOOKUP -#endif -#define ERTS_RBT_UNDEF - -#include "erl_rbtree.h" - -/* Use circular list for timers at same time */ - -static ERTS_INLINE void -same_time_list_insert(ErtsHLTimer **root, ErtsHLTimer *tmr) -{ - ErtsHLTimer *first = *root; - if (!first) { - ERTS_HLT_ASSERT((((UWord) root) & ERTS_HLT_PFLG_SAME_TIME) == 0); - tmr->time.tree.parent = ((UWord) root) | ERTS_HLT_PFLG_SAME_TIME; - tmr->time.tree.u.l.next = tmr; - tmr->time.tree.u.l.prev = tmr; - *root = tmr; - } - else { - tmr->time.tree.parent = ERTS_HLT_PFLG_SAME_TIME; - tmr->time.tree.u.l.next = first; - tmr->time.tree.u.l.prev = first->time.tree.u.l.prev; - first->time.tree.u.l.prev = tmr; - tmr->time.tree.u.l.prev->time.tree.u.l.next = tmr; - } -} - -static ERTS_INLINE void -same_time_list_delete(ErtsHLTimer *tmr) -{ - ErtsHLTimer **root, *next; - - root = (ErtsHLTimer **) (tmr->time.tree.parent & ~ERTS_HLT_PFLG_SAME_TIME); - next = tmr->time.tree.u.l.next; - - ERTS_HLT_ASSERT((tmr->time.tree.parent - == (((UWord) root) | ERTS_HLT_PFLG_SAME_TIME)) - || (tmr->time.tree.parent - == ERTS_HLT_PFLG_SAME_TIME)); - - if (next == tmr) { - ERTS_HLT_ASSERT(root && *root == tmr); - ERTS_HLT_ASSERT(tmr->time.tree.u.l.prev == tmr); - *root = NULL; - } - else { - if (root) { - ERTS_HLT_ASSERT(*root == tmr); - *root = next; - next->time.tree.parent = ((UWord) root) | ERTS_HLT_PFLG_SAME_TIME; - } - tmr->time.tree.u.l.next->time.tree.u.l.prev = tmr->time.tree.u.l.prev; - tmr->time.tree.u.l.prev->time.tree.u.l.next = next; - } -} - -static ERTS_INLINE void -same_time_list_new_root(ErtsHLTimer **root) -{ - ErtsHLTimer *tmr = *root; - if (tmr) { - ERTS_HLT_ASSERT(root); - tmr->time.tree.parent = ((UWord) root) | ERTS_HLT_PFLG_SAME_TIME; - } -} - -static ERTS_INLINE int -same_time_list_foreach_destroy_yielding(ErtsHLTimer **root, - void (*op)(ErtsHLTimer *, void *), - void *arg, - ERTS_TMR_TIMEOUT_YIELD_STATE_T *ys, - Sint ylimit) -{ - Sint ycnt = ylimit; - ErtsHLTimer *end, *tmr = *root; - if (!tmr) - return 0; - - ERTS_HLT_ASSERT(tmr->time.tree.parent - == (((UWord) root) | ERTS_HLT_PFLG_SAME_TIME)); - - end = tmr->time.tree.u.l.prev; - end->time.tree.u.l.next = NULL; - - while (1) { - ErtsHLTimer *op_tmr = tmr; - - ERTS_HLT_ASSERT((tmr->time.tree.parent - == (((UWord) root) | ERTS_HLT_PFLG_SAME_TIME)) - || (tmr->time.tree.parent - == ERTS_HLT_PFLG_SAME_TIME)); - - tmr = tmr->time.tree.u.l.next; - (*op)(op_tmr, arg); - if (!tmr) { - *root = NULL; - return 0; - } - if (--ycnt <= 0) { - /* Make new circle of timers left to process... */ - *root = tmr; - end->time.tree.u.l.next = tmr; - tmr->time.tree.u.l.prev = end; - tmr->time.tree.parent = ((UWord) root) | ERTS_HLT_PFLG_SAME_TIME; - return 1; - } - } -} - -static ERTS_INLINE void -same_time_list_foreach(ErtsHLTimer *root, - void (*op)(ErtsHLTimer *, void *), - void *arg) -{ - if (root) { - ErtsHLTimer *tmr = root; - do { - (*op)(tmr, arg); - tmr = tmr->time.tree.u.l.next; - } while (root != tmr); - } -} - -#ifdef ERTS_HLT_HARD_DEBUG - -static ERTS_INLINE ErtsHLTimer * -same_time_list_lookup(ErtsHLTimer *root, ErtsHLTimer *x) -{ - if (root) { - ErtsHLTimer *tmr = root; - do { - if (tmr == x) - return tmr; - tmr = tmr->time.tree.u.l.next; - } while (root != tmr); - } - return NULL; -} - -#endif /* ERTS_HLT_HARD_DEBUG */ - -#define ERTS_RBT_PREFIX btm -#define ERTS_RBT_T ErtsHLTimer -#define ERTS_RBT_KEY_T Uint32 * -#define ERTS_RBT_FLAGS_T UWord -#define ERTS_RBT_INIT_EMPTY_TNODE(T) \ - do { \ - (T)->btm.tree.parent = (UWord) NULL; \ - (T)->btm.tree.right = NULL; \ - (T)->btm.tree.left = NULL; \ - } while (0) -#define ERTS_RBT_IS_RED(T) \ - ((int) ((T)->btm.tree.parent & ERTS_HLT_PFLG_RED)) -#define ERTS_RBT_SET_RED(T) \ - ((T)->btm.tree.parent |= ERTS_HLT_PFLG_RED) -#define ERTS_RBT_IS_BLACK(T) \ - (!ERTS_RBT_IS_RED((T))) -#define ERTS_RBT_SET_BLACK(T) \ - ((T)->btm.tree.parent &= ~ERTS_HLT_PFLG_RED) -#define ERTS_RBT_GET_FLAGS(T) \ - ((T)->btm.tree.parent & ERTS_HLT_PFLGS_MASK) -#define ERTS_RBT_SET_FLAGS(T, F) \ - do { \ - ERTS_HLT_ASSERT((((UWord) (F)) & ~ERTS_HLT_PFLGS_MASK) == 0); \ - (T)->btm.tree.parent &= ~ERTS_HLT_PFLGS_MASK; \ - (T)->btm.tree.parent |= (F); \ - } while (0) -#define ERTS_RBT_GET_PARENT(T) \ - ((ErtsHLTimer *) ((T)->btm.tree.parent & ~ERTS_HLT_PFLGS_MASK)) -#define ERTS_RBT_SET_PARENT(T, P) \ - do { \ - ERTS_HLT_ASSERT((((UWord) (P)) & ERTS_HLT_PFLGS_MASK) == 0); \ - (T)->btm.tree.parent &= ERTS_HLT_PFLGS_MASK; \ - (T)->btm.tree.parent |= (UWord) (P); \ - } while (0) -#define ERTS_RBT_GET_RIGHT(T) ((T)->btm.tree.right) -#define ERTS_RBT_SET_RIGHT(T, R) ((T)->btm.tree.right = (R)) -#define ERTS_RBT_GET_LEFT(T) ((T)->btm.tree.left) -#define ERTS_RBT_SET_LEFT(T, L) ((T)->btm.tree.left = (L)) -#define ERTS_RBT_GET_KEY(T) ((T)->btm.refn) -#define ERTS_RBT_IS_LT(KX, KY) refn_is_lt((KX), (KY)) -#define ERTS_RBT_IS_EQ(KX, KY) \ - (((KX)[0] == (KY)[0]) & ((KX)[1] == (KY)[1]) & ((KX)[2] == (KY)[2])) -#define ERTS_RBT_WANT_DELETE -#define ERTS_RBT_WANT_INSERT -#define ERTS_RBT_WANT_LOOKUP -#define ERTS_RBT_WANT_FOREACH -#define ERTS_RBT_UNDEF - -#include "erl_rbtree.h" - -#define ERTS_RBT_PREFIX proc_btm -#define ERTS_RBT_T ErtsHLTimer -#define ERTS_RBT_KEY_T Uint32 * -#define ERTS_RBT_FLAGS_T UWord -#define ERTS_RBT_INIT_EMPTY_TNODE(T) \ - do { \ - (T)->btm.proc_tree.parent = (UWord) NULL; \ - (T)->btm.proc_tree.right = NULL; \ - (T)->btm.proc_tree.left = NULL; \ - } while (0) -#define ERTS_RBT_IS_RED(T) \ - ((int) ((T)->btm.proc_tree.parent & ERTS_HLT_PFLG_RED)) -#define ERTS_RBT_SET_RED(T) \ - ((T)->btm.proc_tree.parent |= ERTS_HLT_PFLG_RED) -#define ERTS_RBT_IS_BLACK(T) \ - (!ERTS_RBT_IS_RED((T))) -#define ERTS_RBT_SET_BLACK(T) \ - ((T)->btm.proc_tree.parent &= ~ERTS_HLT_PFLG_RED) -#define ERTS_RBT_GET_FLAGS(T) \ - ((T)->btm.proc_tree.parent & ERTS_HLT_PFLGS_MASK) -#define ERTS_RBT_SET_FLAGS(T, F) \ - do { \ - ERTS_HLT_ASSERT((((UWord) (F)) & ~ERTS_HLT_PFLGS_MASK) == 0); \ - (T)->btm.proc_tree.parent &= ~ERTS_HLT_PFLGS_MASK; \ - (T)->btm.proc_tree.parent |= (F); \ - } while (0) -#define ERTS_RBT_GET_PARENT(T) \ - ((ErtsHLTimer *) ((T)->btm.proc_tree.parent & ~ERTS_HLT_PFLGS_MASK)) -#define ERTS_RBT_SET_PARENT(T, P) \ - do { \ - ERTS_HLT_ASSERT((((UWord) (P)) & ERTS_HLT_PFLGS_MASK) == 0); \ - (T)->btm.proc_tree.parent &= ERTS_HLT_PFLGS_MASK; \ - (T)->btm.proc_tree.parent |= (UWord) (P); \ - } while (0) -#define ERTS_RBT_GET_RIGHT(T) ((T)->btm.proc_tree.right) -#define ERTS_RBT_SET_RIGHT(T, R) ((T)->btm.proc_tree.right = (R)) -#define ERTS_RBT_GET_LEFT(T) ((T)->btm.proc_tree.left) -#define ERTS_RBT_SET_LEFT(T, L) ((T)->btm.proc_tree.left = (L)) -#define ERTS_RBT_GET_KEY(T) ((T)->btm.refn) -#define ERTS_RBT_IS_LT(KX, KY) refn_is_lt((KX), (KY)) -#define ERTS_RBT_IS_EQ(KX, KY) \ - (((KX)[0] == (KY)[0]) & ((KX)[1] == (KY)[1]) & ((KX)[2] == (KY)[2])) -#define ERTS_RBT_WANT_DELETE -#define ERTS_RBT_WANT_INSERT -#define ERTS_RBT_WANT_LOOKUP -#define ERTS_RBT_WANT_FOREACH_DESTROY_YIELDING -#define ERTS_RBT_UNDEF - -#include "erl_rbtree.h" - -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - -#define ERTS_RBT_PREFIX abtm -#define ERTS_RBT_T ErtsHLTimer -#define ERTS_RBT_KEY_T Uint32 * -#define ERTS_RBT_FLAGS_T UWord -#define ERTS_RBT_INIT_EMPTY_TNODE(T) \ - do { \ - (T)->abtm.tree.parent = (UWord) NULL; \ - (T)->abtm.tree.right = NULL; \ - (T)->abtm.tree.left = NULL; \ - } while (0) -#define ERTS_RBT_IS_RED(T) \ - ((int) ((T)->abtm.tree.parent & ERTS_HLT_PFLG_RED)) -#define ERTS_RBT_SET_RED(T) \ - ((T)->abtm.tree.parent |= ERTS_HLT_PFLG_RED) -#define ERTS_RBT_IS_BLACK(T) \ - (!ERTS_RBT_IS_RED((T))) -#define ERTS_RBT_SET_BLACK(T) \ - ((T)->abtm.tree.parent &= ~ERTS_HLT_PFLG_RED) -#define ERTS_RBT_GET_FLAGS(T) \ - ((T)->abtm.tree.parent & ERTS_HLT_PFLGS_MASK) -#define ERTS_RBT_SET_FLAGS(T, F) \ - do { \ - ERTS_HLT_ASSERT((((UWord) (F)) & ~ERTS_HLT_PFLGS_MASK) == 0); \ - (T)->abtm.tree.parent &= ~ERTS_HLT_PFLGS_MASK; \ - (T)->abtm.tree.parent |= (F); \ - } while (0) -#define ERTS_RBT_GET_PARENT(T) \ - ((ErtsHLTimer *) ((T)->abtm.tree.parent & ~ERTS_HLT_PFLGS_MASK)) -#define ERTS_RBT_SET_PARENT(T, P) \ - do { \ - ERTS_HLT_ASSERT((((UWord) (P)) & ERTS_HLT_PFLGS_MASK) == 0); \ - (T)->abtm.tree.parent &= ERTS_HLT_PFLGS_MASK; \ - (T)->abtm.tree.parent |= (UWord) (P); \ - } while (0) -#define ERTS_RBT_GET_RIGHT(T) ((T)->abtm.tree.right) -#define ERTS_RBT_SET_RIGHT(T, R) ((T)->abtm.tree.right = (R)) -#define ERTS_RBT_GET_LEFT(T) ((T)->abtm.tree.left) -#define ERTS_RBT_SET_LEFT(T, L) ((T)->abtm.tree.left = (L)) -#define ERTS_RBT_GET_KEY(T) ((T)->btm.refn) -#define ERTS_RBT_IS_LT(KX, KY) refn_is_lt((KX), (KY)) -#define ERTS_RBT_IS_EQ(KX, KY) \ - (((KX)[0] == (KY)[0]) & ((KX)[1] == (KY)[1]) & ((KX)[2] == (KY)[2])) -#define ERTS_RBT_WANT_DELETE -#define ERTS_RBT_WANT_INSERT -#define ERTS_RBT_WANT_LOOKUP -#define ERTS_RBT_WANT_FOREACH_DESTROY_YIELDING -#define ERTS_RBT_UNDEF - -#include "erl_rbtree.h" - -#endif /* ERTS_BTM_ACCESSOR_SUPPORT */ - -#ifdef ERTS_SMP -static void init_canceled_queue(ErtsHLTCncldTmrQ *cq); -#endif - -void -erts_hl_timer_init(void) -{ - init_tw_timer_alloc(); - init_bif_timer_pre_alloc(); -} - -ErtsHLTimerService * -erts_create_timer_service(void) -{ - ErtsYieldingTimeoutState init_yield = ERTS_TMR_YIELDING_TIMEOUT_STATE_INITER; - ErtsHLTimerService *srv; - - srv = erts_alloc_permanent_cache_aligned(ERTS_ALC_T_TIMER_SERVICE, - sizeof(ErtsHLTimerService)); - srv->time_tree = NULL; - srv->btm_tree = NULL; - srv->next_timeout = NULL; - srv->yield = init_yield; - erts_twheel_init_timer(&srv->service_timer); - -#ifdef ERTS_SMP - init_canceled_queue(&srv->canceled_queue); -#endif - - return srv; -} - -size_t -erts_timer_type_size(ErtsAlcType_t type) -{ - switch (type) { - case ERTS_ALC_T_LL_PTIMER: return sizeof(ErtsTWTimer); - case ERTS_ALC_T_HL_PTIMER: return ERTS_HL_PTIMER_SIZE; - case ERTS_ALC_T_BIF_TIMER: return ERTS_BIF_TIMER_SIZE; -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - case ERTS_ALC_T_ABIF_TIMER: return ERTS_ABIF_TIMER_SIZE; -#endif - default: ERTS_INTERNAL_ERROR("Unknown type"); - } - return 0; -} - -static ERTS_INLINE ErtsMonotonicTime -get_timeout_pos(ErtsMonotonicTime now, ErtsMonotonicTime msec) -{ - ErtsMonotonicTime timeout_pos; - if (msec <= 0) - return ERTS_MONOTONIC_TO_CLKTCKS(now); - timeout_pos = ERTS_MONOTONIC_TO_CLKTCKS(now-1); - timeout_pos += ERTS_MSEC_TO_CLKTCKS(msec) + 1; - return timeout_pos; -} - -static ERTS_INLINE Sint64 -get_time_left(ErtsSchedulerData *esdp, ErtsMonotonicTime timeout_pos) -{ - ErtsMonotonicTime now = erts_get_monotonic_time(esdp); - - now = ERTS_MONOTONIC_TO_CLKTCKS(now-1)+1; - if (timeout_pos <= now) - return (Sint64) 0; - return (Sint64) ERTS_CLKTCKS_TO_MSEC(timeout_pos - now); -} - -static ERTS_INLINE int -proc_timeout_common(Process *proc, void *tmr) -{ - if (tmr == (void *) erts_smp_atomic_cmpxchg_mb(&proc->common.timer, - ERTS_PTMR_TIMEDOUT, - (erts_aint_t) tmr)) { - erts_aint32_t state = erts_smp_atomic32_read_acqb(&proc->state); - if (!(state & (ERTS_PSFLG_ACTIVE|ERTS_PSFLG_EXITING))) - erts_schedule_process(proc, state, 0); - return 1; - } - return 0; -} - -static ERTS_INLINE int -port_timeout_common(Port *port, void *tmr) -{ - if (tmr == (void *) erts_smp_atomic_cmpxchg_mb(&port->common.timer, - ERTS_PTMR_TIMEDOUT, - (erts_aint_t) tmr)) { - erts_port_task_schedule(port->common.id, - &port->timeout_task, - ERTS_PORT_TASK_TIMEOUT); - return 1; - } - return 0; -} - -/* - * Basic timer wheel timer stuff - */ - -static void -scheduled_tw_timer_destroy(void *vtmr) -{ - tw_timer_free((ErtsTWTimer *) vtmr); -} - -static void -schedule_tw_timer_destroy(ErtsTWTimer *tmr) -{ - /* - * Reference to process/port can be - * dropped at once... - */ - if (tmr->head.roflgs & ERTS_TMR_ROFLG_PROC) - erts_proc_dec_refc((Process *) tmr->u.p); - else if (tmr->head.roflgs & ERTS_TMR_ROFLG_PORT) - erts_port_dec_refc((Port *) tmr->u.p); - - erts_schedule_thr_prgr_later_cleanup_op( - scheduled_tw_timer_destroy, - (void *) tmr, - &tmr->tw_tmr.u.cleanup, - sizeof(ErtsTWTimer)); -} - -static ERTS_INLINE void -tw_timer_dec_refc(ErtsTWTimer *tmr) -{ - if (erts_smp_atomic32_dec_read_relb(&tmr->head.refc) == 0) { - ERTS_HLT_SMP_MEMBAR_LoadLoad_LoadStore; - schedule_tw_timer_destroy(tmr); - } -} - -static void -tw_proc_timeout(void *vtwtp) -{ - ErtsTWTimer *twtp = (ErtsTWTimer *) vtwtp; - Process *proc = (Process *) twtp->u.p; - if (proc_timeout_common(proc, vtwtp)) - tw_timer_dec_refc(twtp); - tw_timer_dec_refc(twtp); -} - -static void -tw_port_timeout(void *vtwtp) -{ - ErtsTWTimer *twtp = (ErtsTWTimer *) vtwtp; - Port *port = (Port *) twtp->u.p; - if (port_timeout_common(port, vtwtp)) - tw_timer_dec_refc(twtp); - tw_timer_dec_refc(twtp); -} - -static void -tw_ptimer_cancel(void *vtwtp) -{ - tw_timer_dec_refc((ErtsTWTimer *) vtwtp); -} - -static void -cancel_tw_timer(ErtsSchedulerData *esdp, ErtsTWTimer *tmr) -{ - ERTS_HLT_ASSERT((tmr->head.roflgs & ERTS_TMR_ROFLG_SID_MASK) - == (Uint32) esdp->no); - erts_twheel_cancel_timer(esdp->timer_wheel, &tmr->tw_tmr); -} - -static void -tw_callback_timeout(void *vtwtp) -{ - ErtsTWTimer *twtp = (ErtsTWTimer *) vtwtp; - void (*callback)(void *) = twtp->u.callback; - void *arg = twtp->head.u.arg; - tw_timer_dec_refc(twtp); - (*callback)(arg); -} - -static ErtsTWTimer * -create_tw_timer(ErtsSchedulerData *esdp, - ErtsTmrType type, void *p, - void (*callback)(void *), void *arg, - ErtsMonotonicTime timeout_pos) -{ - ErtsTWTimer *tmr; - void (*timeout_func)(void *); - void (*cancel_func)(void *); - erts_aint32_t refc; - - tmr = tw_timer_alloc(); - erts_twheel_init_timer(&tmr->tw_tmr); - - tmr->head.roflgs = (Uint32) esdp->no; - ERTS_HLT_ASSERT((tmr->head.roflgs - & ~ERTS_TMR_ROFLG_SID_MASK) == 0); - - switch (type) { - - case ERTS_TMR_PROC: - tmr->u.p = p; - tmr->head.roflgs |= ERTS_TMR_ROFLG_PROC; - timeout_func = tw_proc_timeout; - cancel_func = tw_ptimer_cancel; - erts_proc_inc_refc((Process *) p); - refc = 2; - break; - - case ERTS_TMR_PORT: - tmr->u.p = p; - tmr->head.roflgs |= ERTS_TMR_ROFLG_PORT; - timeout_func = tw_port_timeout; - cancel_func = tw_ptimer_cancel; - erts_port_inc_refc((Port *) p); - refc = 2; - break; - - case ERTS_TMR_CALLBACK: - tmr->head.u.arg = arg; - tmr->u.callback = callback; - - tmr->head.roflgs |= ERTS_TMR_ROFLG_CALLBACK; - timeout_func = tw_callback_timeout; - cancel_func = NULL; - refc = 1; - break; - - default: - ERTS_INTERNAL_ERROR("Unsupported timer type"); - return NULL; - } - - erts_smp_atomic32_init_nob(&tmr->head.refc, refc); - - erts_twheel_set_timer(esdp->timer_wheel, - &tmr->tw_tmr, - timeout_func, - cancel_func, - tmr, - timeout_pos); - - return tmr; -} - -/* - * Basic high level timer stuff - */ - -static ERTS_INLINE void -hl_timer_destroy(ErtsHLTimer *tmr) -{ - Uint32 roflgs = tmr->head.roflgs; - if (!(roflgs & ERTS_TMR_ROFLG_BIF_TMR)) - erts_free(ERTS_ALC_T_HL_PTIMER, tmr); - else { - if (roflgs & ERTS_TMR_ROFLG_PRE_ALC) - bif_timer_pre_free(tmr); -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - else if (roflgs & ERTS_TMR_ROFLG_ABIF_TMR) - erts_free(ERTS_ALC_T_ABIF_TIMER, tmr); -#endif - else - erts_free(ERTS_ALC_T_BIF_TIMER, tmr); - } -} - -static void -scheduled_hl_timer_destroy(void *vtmr) -{ - hl_timer_destroy((ErtsHLTimer *) vtmr); -} - -static void -schedule_hl_timer_destroy(ErtsHLTimer *tmr, Uint32 roflgs) -{ - UWord size; - - /* - * Reference to process/port can be dropped - * at once... - */ - - ERTS_HLT_ASSERT(erts_smp_atomic32_read_nob(&tmr->head.refc) == 0); - - if (roflgs & ERTS_TMR_ROFLG_REG_NAME) { - ERTS_HLT_ASSERT(is_atom(tmr->receiver.name)); - } - else if (roflgs & ERTS_TMR_ROFLG_PROC) { - ERTS_HLT_ASSERT(tmr->receiver.proc); - erts_proc_dec_refc(tmr->receiver.proc); - } - else if (roflgs & ERTS_TMR_ROFLG_PORT) { - ERTS_HLT_ASSERT(tmr->receiver.port); - erts_port_dec_refc(tmr->receiver.port); - } - - if (!(roflgs & ERTS_TMR_ROFLG_BIF_TMR)) - size = ERTS_HL_PTIMER_SIZE; - else { - /* - * Message buffer can be dropped at - * once... - */ - size = sizeof(ErtsHLTimer); - } - - erts_schedule_thr_prgr_later_cleanup_op( - scheduled_hl_timer_destroy, tmr, - &tmr->time.cleanup, size); -} - -static ERTS_INLINE void -hl_timer_pre_dec_refc(ErtsHLTimer *tmr) -{ -#ifdef ERTS_HLT_DEBUG - erts_aint_t refc; - refc = erts_smp_atomic32_dec_read_nob(&tmr->head.refc); - ERTS_HLT_ASSERT(refc > 0); -#else - erts_smp_atomic32_dec_nob(&tmr->head.refc); -#endif -} - -static ERTS_INLINE void -hl_timer_dec_refc(ErtsHLTimer *tmr, Uint32 roflgs) -{ - if (erts_smp_atomic32_dec_read_relb(&tmr->head.refc) == 0) { - ERTS_HLT_SMP_MEMBAR_LoadLoad_LoadStore; - schedule_hl_timer_destroy(tmr, roflgs); - } -} - -static void hlt_service_timeout(void *vesdp); -#ifdef ERTS_SMP -static void handle_canceled_queue(ErtsSchedulerData *esdp, - ErtsHLTCncldTmrQ *cq, - int use_limit, - int ops_limit, - int *need_thr_progress, - ErtsThrPrgrVal *thr_prgr_p, - int *need_more_work); -#endif - -static ERTS_INLINE void -check_canceled_queue(ErtsSchedulerData *esdp, ErtsHLTimerService *srv) -{ -#if defined(ERTS_SMP) && ERTS_TMR_CHECK_CANCEL_ON_CREATE - ErtsHLTCncldTmrQ *cq = &srv->canceled_queue; - if (cq->head.first != cq->head.unref_end) - handle_canceled_queue(esdp, cq, 1, - ERTS_TMR_CANCELED_TIMER_SMALL_LIMIT, - NULL, NULL, NULL); -#endif -} - -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - -static void -hlt_delete_abtm(ErtsHLTimer *tmr) -{ - Process *proc; - - ERTS_HLT_ASSERT(tmr->head.roflgs & ERTS_TMR_ROFLG_ABIF_TMR); - - proc = erts_proc_lookup(tmr->abtm.accessor); - - if (proc) { - int deref = 0; - erts_smp_proc_lock(proc, ERTS_PROC_LOCK_BTM); - if (tmr->abtm.tree.parent != ERTS_HLT_PFIELD_NOT_IN_TABLE) { - abtm_rbt_delete(&proc->accessor_bif_timers, tmr); - deref = 1; - tmr->abtm.tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - } - erts_smp_proc_unlock(proc, ERTS_PROC_LOCK_BTM); - if (deref) - hl_timer_pre_dec_refc(tmr); - } -} - -#endif - -static ErtsHLTimer * -create_hl_timer(ErtsSchedulerData *esdp, - ErtsMonotonicTime timeout_pos, - int short_time, ErtsTmrType type, - void *rcvrp, Eterm rcvr, Eterm acsr, - Eterm msg, Uint32 *refn, - void (*callback)(void *), void *arg) -{ - ErtsHLTimerService *srv = esdp->timer_service; - ErtsHLTimer *tmr, *st_tmr; - erts_aint32_t refc; - Uint32 roflgs; - - check_canceled_queue(esdp, srv); - - ERTS_HLT_ASSERT((esdp->no & ~ERTS_TMR_ROFLG_SID_MASK) == 0); - - roflgs = ((Uint32) esdp->no) | ERTS_TMR_ROFLG_HLT; - - if (type != ERTS_TMR_BIF) { - - tmr = erts_alloc(ERTS_ALC_T_HL_PTIMER, - ERTS_HL_PTIMER_SIZE); - tmr->timeout = timeout_pos; - - switch (type) { - - case ERTS_TMR_PROC: - ERTS_HLT_ASSERT(is_internal_pid(rcvr)); - - erts_proc_inc_refc((Process *) rcvrp); - tmr->receiver.proc = (Process *) rcvrp; - roflgs |= ERTS_TMR_ROFLG_PROC; - refc = 2; - break; - - case ERTS_TMR_PORT: - ERTS_HLT_ASSERT(is_internal_port(rcvr)); - erts_port_inc_refc((Port *) rcvrp); - tmr->receiver.port = (Port *) rcvrp; - roflgs |= ERTS_TMR_ROFLG_PORT; - refc = 2; - break; - - case ERTS_TMR_CALLBACK: - roflgs |= ERTS_TMR_ROFLG_CALLBACK; - tmr->receiver.callback = callback; - tmr->head.u.arg = arg; - refc = 1; - break; - - default: - ERTS_INTERNAL_ERROR("Unsupported timer type"); - return NULL; - } - - } - else { /* ERTS_TMR_BIF */ - Uint hsz; -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - int is_abif_tmr = is_value(acsr) && acsr != rcvr; -#endif - - if (short_time) { - tmr = bif_timer_pre_alloc(); - if (!tmr) - goto alloc_bif_timer; - roflgs |= ERTS_TMR_ROFLG_PRE_ALC; - } - else { - alloc_bif_timer: -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - if (is_abif_tmr) - tmr = erts_alloc(ERTS_ALC_T_ABIF_TIMER, - ERTS_ABIF_TIMER_SIZE); - else -#endif - tmr = erts_alloc(ERTS_ALC_T_BIF_TIMER, - ERTS_BIF_TIMER_SIZE); - } - - tmr->timeout = timeout_pos; - - roflgs |= ERTS_TMR_ROFLG_BIF_TMR; - if (is_internal_pid(rcvr)) { - roflgs |= ERTS_TMR_ROFLG_PROC; - tmr->receiver.proc = (Process *) rcvrp; - refc = 2; - } - else { - ERTS_HLT_ASSERT(is_atom(rcvr)); - roflgs |= ERTS_TMR_ROFLG_REG_NAME; - tmr->receiver.name = rcvr; - refc = 1; - } - - hsz = is_immed(msg) ? ((Uint) 0) : size_object(msg); - if (!hsz) { - tmr->btm.message = msg; - tmr->btm.bp = NULL; - } - else { - ErlHeapFragment *bp = new_message_buffer(hsz); - Eterm *hp = bp->mem; - tmr->btm.message = copy_struct(msg, hsz, &hp, &bp->off_heap); - tmr->btm.bp = bp; - } - tmr->btm.refn[0] = refn[0]; - tmr->btm.refn[1] = refn[1]; - tmr->btm.refn[2] = refn[2]; - - tmr->btm.proc_tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - if (is_abif_tmr) { - Process *aproc; - roflgs |= ERTS_TMR_ROFLG_ABIF_TMR; - tmr->abtm.accessor = acsr; - aproc = erts_proc_lookup(acsr); - if (!aproc) - tmr->abtm.tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - else { - refc++; - erts_smp_proc_lock(aproc, ERTS_PROC_LOCK_BTM); - abtm_rbt_insert(&aproc->accessor_bif_timers, tmr); - erts_smp_proc_unlock(aproc, ERTS_PROC_LOCK_BTM); - } - } -#endif - - btm_rbt_insert(&srv->btm_tree, tmr); - } - - tmr->head.roflgs = roflgs; - erts_smp_atomic32_init_nob(&tmr->head.refc, refc); - erts_smp_atomic32_init_nob(&tmr->state, ERTS_TMR_STATE_ACTIVE); - - ERTS_HLT_HDBG_CHK_SRV(srv); - - if (!srv->next_timeout - || tmr->timeout < srv->next_timeout->timeout) { - if (srv->next_timeout) - erts_twheel_cancel_timer(esdp->timer_wheel, - &srv->service_timer); - erts_twheel_set_timer(esdp->timer_wheel, - &srv->service_timer, - hlt_service_timeout, - NULL, - (void *) esdp, - tmr->timeout); - srv->next_timeout = tmr; - } - - st_tmr = time_rbt_lookup_insert(&srv->time_tree, tmr); - tmr->time.tree.same_time = st_tmr; - if (st_tmr) - same_time_list_insert(&st_tmr->time.tree.same_time, tmr); - -#ifdef ERTS_HLT_HARD_DEBUG - tmr->pending_timeout = 0; -#endif - - ERTS_HLT_HDBG_CHK_SRV(srv); - - return tmr; -} - -static ERTS_INLINE void -hlt_bif_timer_timeout(ErtsHLTimer *tmr, Uint32 roflgs) -{ - ErtsProcLocks proc_locks = ERTS_PROC_LOCKS_MSG_SEND; - Process *proc; - int queued_message = 0; - int dec_refc = 0; - Uint32 is_reg_name = (roflgs & ERTS_TMR_ROFLG_REG_NAME); - ERTS_HLT_ASSERT(roflgs & ERTS_TMR_ROFLG_BIF_TMR); - -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - if (tmr->head.roflgs & ERTS_TMR_ROFLG_ABIF_TMR) - hlt_delete_abtm(tmr); -#endif - - if (is_reg_name) { - Eterm pid; - ERTS_HLT_ASSERT(is_atom(tmr->receiver.name)); - pid = erts_whereis_name_to_id(NULL, tmr->receiver.name); - proc = erts_proc_lookup(pid); - } - else { - ERTS_HLT_ASSERT(roflgs & ERTS_TMR_ROFLG_PROC); - ERTS_HLT_ASSERT(tmr->receiver.proc); - - proc = tmr->receiver.proc; - proc_locks |= ERTS_PROC_LOCK_BTM; - } - if (proc) { - erts_smp_proc_lock(proc, proc_locks); - /* - * If process is exiting, let it clean up - * the btm tree by itself (it may be in - * the middle of tree destruction). - */ - if (!ERTS_PROC_IS_EXITING(proc)) { - erts_queue_message(proc, &proc_locks, tmr->btm.bp, - tmr->btm.message, NIL); - erts_smp_proc_unlock(proc, ERTS_PROC_LOCKS_MSG_SEND); - queued_message = 1; - proc_locks &= ~ERTS_PROC_LOCKS_MSG_SEND; - tmr->btm.bp = NULL; - if (tmr->btm.proc_tree.parent != ERTS_HLT_PFIELD_NOT_IN_TABLE) { - proc_btm_rbt_delete(&proc->bif_timers, tmr); - tmr->btm.proc_tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - dec_refc = 1; - } - } - if (proc_locks) - erts_smp_proc_unlock(proc, proc_locks); - if (dec_refc) - hl_timer_pre_dec_refc(tmr); - } - if (!queued_message && tmr->btm.bp) - free_message_buffer(tmr->btm.bp); -} - -static ERTS_INLINE void -hlt_proc_timeout(ErtsHLTimer *tmr) -{ - if (proc_timeout_common(tmr->receiver.proc, (void *) tmr)) - hl_timer_dec_refc(tmr, tmr->head.roflgs); -} - -static ERTS_INLINE void -hlt_port_timeout(ErtsHLTimer *tmr) -{ - if (port_timeout_common(tmr->receiver.port, (void *) tmr)) - hl_timer_dec_refc(tmr, tmr->head.roflgs); -} - -static void hlt_timeout(ErtsHLTimer *tmr, void *vsrv) -{ - ErtsHLTimerService *srv = (ErtsHLTimerService *) vsrv; - Uint32 roflgs; - erts_aint32_t state; - - ERTS_HLT_HDBG_CHK_SRV(srv); - - roflgs = tmr->head.roflgs; - ERTS_HLT_ASSERT(roflgs & ERTS_TMR_ROFLG_HLT); - - state = erts_smp_atomic32_cmpxchg_acqb(&tmr->state, - ERTS_TMR_STATE_TIMED_OUT, - ERTS_TMR_STATE_ACTIVE); - - ERTS_HLT_ASSERT(state == ERTS_TMR_STATE_CANCELED - || state == ERTS_TMR_STATE_ACTIVE); - - if (state == ERTS_TMR_STATE_ACTIVE) { - - if (roflgs & ERTS_TMR_ROFLG_BIF_TMR) - hlt_bif_timer_timeout(tmr, roflgs); - else if (roflgs & ERTS_TMR_ROFLG_PROC) - hlt_proc_timeout(tmr); - else if (roflgs & ERTS_TMR_ROFLG_PORT) - hlt_port_timeout(tmr); - else { - ERTS_HLT_ASSERT(roflgs & ERTS_TMR_ROFLG_CALLBACK); - (*tmr->receiver.callback)(tmr->head.u.arg); - } - - } - - tmr->time.tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - if ((roflgs & ERTS_TMR_ROFLG_BIF_TMR) - && tmr->btm.tree.parent != ERTS_HLT_PFIELD_NOT_IN_TABLE) { - btm_rbt_delete(&srv->btm_tree, tmr); - tmr->btm.tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - } - - ERTS_HLT_HDBG_CHK_SRV(srv); - - hl_timer_dec_refc(tmr, roflgs); -} - -#ifdef ERTS_HLT_HARD_DEBUG -static void -set_pending_timeout(ErtsHLTimer *tmr, void *unused) -{ - tmr->pending_timeout = -1; -} -#endif - -static void -hlt_service_timeout(void *vesdp) -{ - ErtsSchedulerData *esdp = (ErtsSchedulerData *) vesdp; - ErtsHLTimerService *srv = esdp->timer_service; - ErtsHLTimer *tmr = srv->next_timeout; - int yield; - - ERTS_HLT_HDBG_CHK_SRV(srv); - - ERTS_HLT_ASSERT(esdp == erts_get_scheduler_data()); - - ERTS_HLT_ASSERT(!srv->yield.root || srv->yield.root == tmr); - ERTS_HLT_ASSERT(tmr); - ERTS_HLT_ASSERT(tmr->timeout <= erts_get_monotonic_time(esdp)); - - if (!srv->yield.root) { - ERTS_HLT_ASSERT(tmr->time.tree.parent - != ERTS_HLT_PFIELD_NOT_IN_TABLE); - time_rbt_delete(&srv->time_tree, tmr); - tmr->time.tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; -#ifdef ERTS_HLT_HARD_DEBUG - tmr->pending_timeout = 1; - if (tmr->time.tree.same_time) - same_time_list_foreach(tmr->time.tree.same_time, set_pending_timeout, NULL); -#endif - } - - if (!tmr->time.tree.same_time && !srv->yield.root) - yield = 0; - else { - yield = same_time_list_foreach_destroy_yielding( - &tmr->time.tree.same_time, hlt_timeout, (void *) srv, - &srv->yield.state, ERTS_TMR_TIMEOUT_YIELD_LIMIT); - } - - if (yield) - srv->yield.root = tmr; - else { - srv->yield.root = NULL; - hlt_timeout(tmr, (void *) srv); - - tmr = time_rbt_smallest(srv->time_tree); - srv->next_timeout = tmr; - } - - ERTS_HLT_HDBG_CHK_SRV(srv); - - if (tmr) - erts_twheel_set_timer(esdp->timer_wheel, - &srv->service_timer, - hlt_service_timeout, - NULL, - vesdp, - tmr->timeout); -} - -static void -hlt_delete_timer(ErtsSchedulerData *esdp, ErtsHLTimer *tmr) -{ - ErtsHLTimerService *srv = esdp->timer_service; - - ERTS_HLT_HDBG_CHK_SRV(srv); - - if (tmr->head.roflgs & ERTS_TMR_ROFLG_BIF_TMR) { - - if (tmr->btm.tree.parent != ERTS_HLT_PFIELD_NOT_IN_TABLE) { - btm_rbt_delete(&srv->btm_tree, tmr); - tmr->btm.tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - } - -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - if (tmr->head.roflgs & ERTS_TMR_ROFLG_ABIF_TMR) - hlt_delete_abtm(tmr); -#endif - } - - if (tmr->time.tree.parent == ERTS_HLT_PFIELD_NOT_IN_TABLE) { - /* Already removed... */ - ERTS_HLT_HDBG_CHK_SRV(srv); - return; - } - - if (tmr->time.tree.parent & ERTS_HLT_PFLG_SAME_TIME) { - same_time_list_delete(tmr); - } - else if (tmr->time.tree.same_time) { - ErtsHLTimer *st_container; - - ERTS_HLT_ASSERT((tmr->time.tree.parent & ERTS_HLT_PFLG_SAME_TIME) == 0); - st_container = tmr->time.tree.same_time->time.tree.u.l.prev; - - ERTS_HLT_ASSERT(st_container); - ERTS_HLT_ASSERT(st_container->time.tree.parent - & ERTS_HLT_PFLG_SAME_TIME); - ERTS_HLT_ASSERT(tmr->timeout == st_container->timeout); - - same_time_list_delete(st_container); - st_container->time.tree.same_time = tmr->time.tree.same_time; - same_time_list_new_root(&st_container->time.tree.same_time); - - time_rbt_replace(&srv->time_tree, tmr, st_container); - ERTS_HLT_ASSERT((st_container->time.tree.parent - & ERTS_HLT_PFLG_SAME_TIME) == 0); - - if (srv->next_timeout == tmr) - srv->next_timeout = st_container; - } - else { - ERTS_HLT_ASSERT((tmr->time.tree.parent & ERTS_HLT_PFLG_SAME_TIME) == 0); - time_rbt_delete(&srv->time_tree, tmr); - if (tmr == srv->next_timeout) { - ErtsHLTimer *smlst; - erts_twheel_cancel_timer(esdp->timer_wheel, - &srv->service_timer); - smlst = time_rbt_smallest(srv->time_tree); - srv->next_timeout = smlst; - if (smlst) { - ERTS_HLT_ASSERT(smlst->timeout > tmr->timeout); - erts_twheel_set_timer(esdp->timer_wheel, - &srv->service_timer, - hlt_service_timeout, - NULL, - (void *) esdp, - smlst->timeout); - } - } - } - tmr->time.tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - - hl_timer_dec_refc(tmr, tmr->head.roflgs); - - ERTS_HLT_HDBG_CHK_SRV(srv); -} - -/* - * Pass canceled timers back to originating scheduler - */ - -static ERTS_INLINE void -cleanup_sched_local_canceled_timer(ErtsSchedulerData *esdp, - ErtsTimer *tmr) -{ - Uint32 roflgs = tmr->head.roflgs; - ERTS_HLT_ASSERT(esdp == erts_get_scheduler_data()); - ERTS_HLT_ASSERT((tmr->head.roflgs & ERTS_TMR_ROFLG_SID_MASK) - == (Uint32) esdp->no); - if (roflgs & ERTS_TMR_ROFLG_HLT) { - hlt_delete_timer(esdp, &tmr->hlt); - hl_timer_dec_refc(&tmr->hlt, roflgs); - } - else { - cancel_tw_timer(esdp, &tmr->twt); - tw_timer_dec_refc(&tmr->twt); - } -} - -#ifdef ERTS_SMP - -static void -init_canceled_queue(ErtsHLTCncldTmrQ *cq) -{ - erts_atomic_init_nob(&cq->tail.data.marker.u.next, ERTS_AINT_NULL); - erts_atomic_init_nob(&cq->tail.data.last, - (erts_aint_t) &cq->tail.data.marker); - cq->head.first = (ErtsTimer *) &cq->tail.data.marker; - cq->head.unref_end = (ErtsTimer *) &cq->tail.data.marker; - cq->head.next.thr_progress = erts_thr_progress_current(); - cq->head.next.thr_progress_reached = 1; - cq->head.next.unref_end = (ErtsTimer *) &cq->tail.data.marker; - cq->head.used_marker = 1; -} - -static ERTS_INLINE int -cq_enqueue(ErtsHLTCncldTmrQ *cq, ErtsTimer *tmr, int cinit) -{ - erts_aint_t itmp; - ErtsTimer *enq, *this = tmr; - - erts_atomic_init_nob(&this->head.u.next, ERTS_AINT_NULL); - /* Enqueue at end of list... */ - - enq = (ErtsTimer *) erts_atomic_read_nob(&cq->tail.data.last); - itmp = erts_atomic_cmpxchg_relb(&enq->head.u.next, - (erts_aint_t) this, - ERTS_AINT_NULL); - if (itmp == ERTS_AINT_NULL) { - /* We are required to move last pointer */ -#ifdef DEBUG - ASSERT(ERTS_AINT_NULL == erts_atomic_read_nob(&this->head.u.next)); - ASSERT(((erts_aint_t) enq) - == erts_atomic_xchg_relb(&cq->tail.data.last, - (erts_aint_t) this)); -#else - erts_atomic_set_relb(&cq->tail.data.last, (erts_aint_t) this); -#endif - return 1; - } - else { - /* - * We *need* to insert element somewhere in between the - * last element we read earlier and the actual last element. - */ - int i = cinit; - - while (1) { - erts_aint_t itmp2; - erts_atomic_set_nob(&this->head.u.next, itmp); - itmp2 = erts_atomic_cmpxchg_relb(&enq->head.u.next, - (erts_aint_t) this, - itmp); - if (itmp == itmp2) - return 0; /* inserted this */ - if ((i & 1) == 0) - itmp = itmp2; - else { - enq = (ErtsTimer *) itmp2; - itmp = erts_atomic_read_acqb(&enq->head.u.next); - ASSERT(itmp != ERTS_AINT_NULL); - } - i++; - } - } -} - -static ERTS_INLINE erts_aint_t -check_insert_marker(ErtsHLTCncldTmrQ *cq, erts_aint_t ilast) -{ - if (!cq->head.used_marker - && cq->head.unref_end == (ErtsTimer *) ilast) { - erts_aint_t itmp; - ErtsTimer *last = (ErtsTimer *) ilast; - - erts_atomic_init_nob(&cq->tail.data.marker.u.next, ERTS_AINT_NULL); - itmp = erts_atomic_cmpxchg_relb(&last->head.u.next, - (erts_aint_t) &cq->tail.data.marker, - ERTS_AINT_NULL); - if (itmp == ERTS_AINT_NULL) { - ilast = (erts_aint_t) &cq->tail.data.marker; - cq->head.used_marker = !0; - erts_atomic_set_relb(&cq->tail.data.last, ilast); - } - } - return ilast; -} - -static ERTS_INLINE ErtsTimer * -cq_dequeue(ErtsHLTCncldTmrQ *cq) -{ - ErtsTimer *tmr; - - if (cq->head.first == cq->head.unref_end) - return NULL; - - tmr = cq->head.first; - if (tmr == (ErtsTimer *) &cq->tail.data.marker) { - ASSERT(cq->head.used_marker); - cq->head.used_marker = 0; - tmr = (ErtsTimer *) erts_atomic_read_nob(&tmr->head.u.next); - if (tmr == cq->head.unref_end) { - cq->head.first = tmr; - return NULL; - } - } - - cq->head.first = (ErtsTimer *) erts_atomic_read_nob(&tmr->head.u.next); - - ASSERT(cq->head.first); - - return tmr; -} - -static int -cq_check_incoming(ErtsSchedulerData *esdp, ErtsHLTCncldTmrQ *cq) -{ - erts_aint_t ilast = erts_atomic_read_nob(&cq->tail.data.last); - if (((ErtsTimer *) ilast) == (ErtsTimer *) &cq->tail.data.marker - && cq->head.first == (ErtsTimer *) &cq->tail.data.marker) { - /* Nothing more to do... */ - return 0; - } - - if (cq->head.next.thr_progress_reached - || erts_thr_progress_has_reached(cq->head.next.thr_progress)) { - cq->head.next.thr_progress_reached = 1; - /* Move unreferenced end pointer forward... */ - - ERTS_HLT_SMP_MEMBAR_LoadLoad_LoadStore; - - cq->head.unref_end = cq->head.next.unref_end; - - ilast = check_insert_marker(cq, ilast); - - if (cq->head.unref_end != (ErtsTimer *) ilast) { - cq->head.next.unref_end = (ErtsTimer *) ilast; - cq->head.next.thr_progress = erts_thr_progress_later(esdp); - cq->head.next.thr_progress_reached = 0; - } - } - return 1; -} - -static ERTS_INLINE void -store_earliest_thr_prgr(ErtsThrPrgrVal *prev_val, ErtsHLTCncldTmrQ *cq) -{ - if (!cq->head.next.thr_progress_reached - && (*prev_val == ERTS_THR_PRGR_INVALID - || erts_thr_progress_cmp(cq->head.next.thr_progress, - *prev_val) < 0)) { - *prev_val = cq->head.next.thr_progress; - } -} - -static void -handle_canceled_queue(ErtsSchedulerData *esdp, - ErtsHLTCncldTmrQ *cq, - int use_limit, - int ops_limit, - int *need_thr_progress, - ErtsThrPrgrVal *thr_prgr_p, - int *need_more_work) -{ - int need_thr_prgr = 0; - int need_mr_wrk = 0; - int have_checked_incoming = 0; - int ops = 0; - - ERTS_HLT_ASSERT(cq == &esdp->timer_service->canceled_queue); - - while (1) { - ErtsTimer *tmr = cq_dequeue(cq); - - if (tmr) - cleanup_sched_local_canceled_timer(esdp, tmr); - else { - if (have_checked_incoming) - break; - need_thr_prgr = cq_check_incoming(esdp, cq); - if (need_thr_progress) { - *need_thr_progress |= need_thr_prgr; - if (need_thr_prgr) - store_earliest_thr_prgr(thr_prgr_p, cq); - } - have_checked_incoming = 1; - continue; - } - - if (use_limit && ++ops >= ops_limit) { - if (cq->head.first != cq->head.unref_end) { - need_mr_wrk = 1; - if (need_more_work) - *need_more_work |= 1; - } - break; - } - } - - if (need_thr_progress && !(need_thr_prgr | need_mr_wrk)) { - need_thr_prgr = cq_check_incoming(esdp, cq); - *need_thr_progress |= need_thr_prgr; - if (need_thr_prgr) - store_earliest_thr_prgr(thr_prgr_p, cq); - } -} - -void -erts_handle_canceled_timers(void *vesdp, - int *need_thr_progress, - ErtsThrPrgrVal *thr_prgr_p, - int *need_more_work) -{ - ErtsSchedulerData *esdp = (ErtsSchedulerData *) vesdp; - ERTS_HLT_ASSERT(esdp == erts_get_scheduler_data()); - - handle_canceled_queue(esdp, &esdp->timer_service->canceled_queue, - 1, ERTS_TMR_CANCELED_TIMER_LIMIT, - need_thr_progress, thr_prgr_p, - need_more_work); -} - -#endif /* ERTS_SMP */ - -static void -queue_canceled_timer(ErtsSchedulerData *esdp, int rsched_id, ErtsTimer *tmr) -{ -#ifdef ERTS_SMP - ErtsHLTCncldTmrQ *cq; - cq = &ERTS_SCHEDULER_IX(rsched_id-1)->timer_service->canceled_queue; - if (cq_enqueue(cq, tmr, rsched_id - (int) esdp->no)) - erts_notify_canceled_timer(esdp, rsched_id); -#else - ERTS_INTERNAL_ERROR("Unexpected enqueue of canceled timer"); -#endif -} - -static void -continue_cancel_ptimer(ErtsSchedulerData *esdp, ErtsTimer *tmr) -{ -#ifdef ERTS_SMP - Uint32 sid = (tmr->head.roflgs & ERTS_TMR_ROFLG_SID_MASK); - - if (esdp->no != sid) - queue_canceled_timer(esdp, sid, tmr); - else -#endif - cleanup_sched_local_canceled_timer(esdp, tmr); -} - -/* - * BIF timer specific - */ - -Uint erts_bif_timer_memory_size(void) -{ - return (Uint) 0; -} - -static BIF_RETTYPE -setup_bif_timer(Process *c_p, ErtsMonotonicTime timeout_pos, - int short_time, Eterm rcvr, Eterm acsr, - Eterm msg, int wrap) -{ - BIF_RETTYPE ret; - Eterm ref, tmo_msg, *hp; - ErtsHLTimer *tmr; - ErtsSchedulerData *esdp; - DeclareTmpHeap(tmp_hp, 4, c_p); - - if (is_not_internal_pid(rcvr) && is_not_atom(rcvr)) - goto badarg; - - esdp = ERTS_PROC_GET_SCHDATA(c_p); - - hp = HAlloc(c_p, REF_THING_SIZE); - ref = erts_sched_make_ref_in_buffer(esdp, hp); - - ASSERT(erts_get_ref_numbers_thr_id( - internal_ref_numbers(ref)) == (Uint32) esdp->no); - - UseTmpHeap(4, c_p); - - tmo_msg = wrap ? TUPLE3(tmp_hp, am_timeout, ref, msg) : msg; - - tmr = create_hl_timer(esdp, timeout_pos, short_time, - ERTS_TMR_BIF, NULL, rcvr, acsr, tmo_msg, - internal_ref_numbers(ref), NULL, NULL); - - UnUseTmpHeap(4, c_p); - - if (is_internal_pid(rcvr)) { - Process *proc = erts_pid2proc_opt(c_p, ERTS_PROC_LOCK_MAIN, - rcvr, ERTS_PROC_LOCK_BTM, - ERTS_P2P_FLG_INC_REFC); - if (!proc) { - if (tmr->btm.bp) - free_message_buffer(tmr->btm.bp); - hlt_delete_timer(esdp, tmr); - hl_timer_destroy(tmr); - } - else { - proc_btm_rbt_insert(&proc->bif_timers, tmr); - erts_smp_proc_unlock(proc, ERTS_PROC_LOCK_BTM); - tmr->receiver.proc = proc; - } - } - - ERTS_BIF_PREP_RET(ret, ref); - return ret; - -badarg: - - ERTS_BIF_PREP_ERROR(ret, c_p, BADARG); - return ret; -} - -static int -cancel_bif_timer(ErtsHLTimer *tmr) -{ - erts_aint_t state; - Uint32 roflgs; - int res; - - state = erts_smp_atomic32_cmpxchg_acqb(&tmr->state, - ERTS_TMR_STATE_CANCELED, - ERTS_TMR_STATE_ACTIVE); - if (state != ERTS_TMR_STATE_ACTIVE) - return 0; - - if (tmr->btm.bp) - free_message_buffer(tmr->btm.bp); - - res = -1; - - roflgs = tmr->head.roflgs; - if (roflgs & ERTS_TMR_ROFLG_PROC) { - Process *proc = tmr->receiver.proc; - ERTS_HLT_ASSERT(!(tmr->head.roflgs & ERTS_TMR_ROFLG_REG_NAME)); - - erts_smp_proc_lock(proc, ERTS_PROC_LOCK_BTM); - /* - * If process is exiting, let it clean up - * the btm tree by itself (it may be in - * the middle of tree destruction). - */ - if (!ERTS_PROC_IS_EXITING(proc) - && tmr->btm.proc_tree.parent != ERTS_HLT_PFIELD_NOT_IN_TABLE) { - proc_btm_rbt_delete(&proc->bif_timers, tmr); - tmr->btm.proc_tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - res = 1; - } - erts_smp_proc_unlock(proc, ERTS_PROC_LOCK_BTM); - } - - return res; -} - -static ERTS_INLINE Eterm -access_sched_local_btm(Process *c_p, Eterm pid, - Eterm tref, Uint32 *trefn, - Uint32 *rrefn, - int async, int cancel, - int return_res, - int info) -{ - ErtsSchedulerData *esdp; - ErtsHLTimerService *srv; - ErtsHLTimer *tmr; - Sint64 time_left; - Process *proc; - ErtsProcLocks proc_locks; - - time_left = -1; - - if (!c_p) - esdp = erts_get_scheduler_data(); - else { - esdp = ERTS_PROC_GET_SCHDATA(c_p); - ERTS_HLT_ASSERT(esdp == erts_get_scheduler_data()); - } - - ERTS_HLT_ASSERT(erts_get_ref_numbers_thr_id(trefn) - == (Uint32) esdp->no); - - srv = esdp->timer_service; - - tmr = btm_rbt_lookup(srv->btm_tree, trefn); - if (tmr) { - if (!cancel) { - erts_aint32_t state = erts_smp_atomic32_read_acqb(&tmr->state); - if (state == ERTS_TMR_STATE_ACTIVE) - time_left = get_time_left(esdp, tmr->timeout); - } - else { - int cncl_res = cancel_bif_timer(tmr); - if (cncl_res) { - - time_left = get_time_left(esdp, tmr->timeout); - - if (cncl_res > 0) - hl_timer_dec_refc(tmr, tmr->head.roflgs); - - hlt_delete_timer(esdp, tmr); - } - } - } - - if (!info) - return am_ok; - - if (return_res) { - ERTS_HLT_ASSERT(c_p); - if (time_left < 0) - return am_false; - else if (time_left <= (Sint64) MAX_SMALL) - return make_small((Sint) time_left); - else { - Uint hsz = ERTS_SINT64_HEAP_SIZE(time_left); - Eterm *hp = HAlloc(c_p, hsz); - return erts_sint64_to_big(time_left, &hp); - } - } - - if (c_p) { - proc = c_p; - proc_locks = ERTS_PROC_LOCK_MAIN; - } - else { - proc = erts_proc_lookup(pid); - proc_locks = 0; - } - - if (proc) { - Uint hsz; - ErlOffHeap *ohp; - ErlHeapFragment* bp; - Eterm *hp, msg, ref, result; -#ifdef ERTS_HLT_DEBUG - Eterm *hp_end; -#endif - - hsz = 3; /* 2-tuple */ - if (!async) - hsz += REF_THING_SIZE; - else { - if (is_non_value(tref) || proc != c_p) - hsz += REF_THING_SIZE; - hsz += 1; /* upgrade to 3-tuple */ - } - if (time_left > (Sint64) MAX_SMALL) - hsz += ERTS_SINT64_HEAP_SIZE(time_left); - - if (proc == c_p) { - bp = NULL; - ohp = NULL; - hp = HAlloc(c_p, hsz); - } - else { - hp = erts_alloc_message_heap(hsz, - &bp, - &ohp, - proc, - &proc_locks); - } - -#ifdef ERTS_HLT_DEBUG - hp_end = hp + hsz; -#endif - - if (time_left < 0) - result = am_false; - else if (time_left <= (Sint64) MAX_SMALL) - result = make_small((Sint) time_left); - else - result = erts_sint64_to_big(time_left, &hp); - - if (!async) { - write_ref_thing(hp, - rrefn[0], - rrefn[1], - rrefn[2]); - ref = make_internal_ref(hp); - hp += REF_THING_SIZE; - msg = TUPLE2(hp, ref, result); - - ERTS_HLT_ASSERT(hp + 3 == hp_end); - } - else { - Eterm tag = cancel ? am_cancel_timer : am_read_timer; - if (is_value(tref) && proc == c_p) - ref = tref; - else { - write_ref_thing(hp, - trefn[0], - trefn[1], - trefn[2]); - ref = make_internal_ref(hp); - hp += REF_THING_SIZE; - } - msg = TUPLE3(hp, tag, ref, result); - - ERTS_HLT_ASSERT(hp + 4 == hp_end); - - } - erts_queue_message(proc, &proc_locks, bp, msg, NIL); - - if (c_p) - proc_locks &= ~ERTS_PROC_LOCK_MAIN; - if (proc_locks) - erts_smp_proc_unlock(proc, proc_locks); - } - - return am_ok; -} - -#define ERTS_BTM_REQ_FLG_ASYNC (((Uint32) 1) << 0) -#define ERTS_BTM_REQ_FLG_CANCEL (((Uint32) 1) << 1) -#define ERTS_BTM_REQ_FLG_INFO (((Uint32) 1) << 2) - -typedef struct { - Eterm pid; - Uint32 trefn[ERTS_REF_NUMBERS]; - Uint32 rrefn[ERTS_REF_NUMBERS]; - Uint32 flags; -} ErtsBifTimerRequest; - -static void -bif_timer_access_request(void *vreq) -{ - ErtsBifTimerRequest *req = (ErtsBifTimerRequest *) vreq; - int async = (int) (req->flags & ERTS_BTM_REQ_FLG_ASYNC); - int cancel = (int) (req->flags & ERTS_BTM_REQ_FLG_CANCEL); - int info = (int) (req->flags & ERTS_BTM_REQ_FLG_INFO); - (void) access_sched_local_btm(NULL, req->pid, THE_NON_VALUE, - req->trefn, req->rrefn, async, - cancel, 0, info); - erts_free(ERTS_ALC_T_TIMER_REQUEST, vreq); -} - -static int -try_access_sched_remote_btm(ErtsSchedulerData *esdp, - Process *c_p, Uint32 sid, - Eterm tref, Uint32 *trefn, - int async, int cancel, - int info, Eterm *resp) -{ - ErtsHLTimer *tmr; - Sint64 time_left; - - ERTS_HLT_ASSERT(c_p); - - /* - * Check if the timer is aimed at current - * process of if this process is an accessor - * of the timer... - */ - erts_smp_proc_lock(c_p, ERTS_PROC_LOCK_BTM); - tmr = proc_btm_rbt_lookup(c_p->bif_timers, trefn); -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - if (!tmr) - tmr = abtm_rbt_lookup(c_p->accessor_bif_timers, trefn); -#endif - erts_smp_proc_unlock(c_p, ERTS_PROC_LOCK_BTM); - if (!tmr) - return 0; - - if (!cancel) { - erts_aint32_t state = erts_smp_atomic32_read_acqb(&tmr->state); - if (state == ERTS_TMR_STATE_ACTIVE) - time_left = get_time_left(esdp, tmr->timeout); - else - time_left = -1; - } - else { - int cncl_res = cancel_bif_timer(tmr); - if (!cncl_res) - time_left = -1; - else { - time_left = get_time_left(esdp, tmr->timeout); - if (cncl_res > 0) - queue_canceled_timer(esdp, sid, (ErtsTimer *) tmr); - } - } - - if (!info) { - *resp = am_ok; - return 1; - } - - if (!async) { - if (time_left < 0) - *resp = am_false; - else if (time_left <= (Sint64) MAX_SMALL) - *resp = make_small((Sint) time_left); - else { - Uint hsz = ERTS_SINT64_HEAP_SIZE(time_left); - Eterm *hp = HAlloc(c_p, hsz); - *resp = erts_sint64_to_big(time_left, &hp); - } - } - else { - Eterm tag, res, msg; - Uint hsz; - Eterm *hp; - ErtsProcLocks proc_locks = ERTS_PROC_LOCK_MAIN; - - hsz = 4; - if (time_left > (Sint64) MAX_SMALL) - hsz += ERTS_SINT64_HEAP_SIZE(time_left); - - hp = HAlloc(c_p, hsz); - if (cancel) - tag = am_cancel_timer; - else - tag = am_read_timer; - - if (time_left < 0) - res = am_false; - else if (time_left <= (Sint64) MAX_SMALL) - res = make_small((Sint) time_left); - else - res = erts_sint64_to_big(time_left, &hp); - - msg = TUPLE3(hp, tag, tref, res); - - erts_queue_message(c_p, &proc_locks, NULL, msg, NIL); - - proc_locks &= ~ERTS_PROC_LOCK_MAIN; - if (proc_locks) - erts_smp_proc_unlock(c_p, proc_locks); - - *resp = am_ok; - } - return 1; -} - -static BIF_RETTYPE -access_bif_timer(Process *c_p, Eterm tref, int cancel, int async, int info) -{ - BIF_RETTYPE ret; - ErtsSchedulerData *esdp; - Uint32 sid; - Uint32 *trefn; - Eterm res; - - if (is_not_internal_ref(tref)) { - if (is_not_ref(tref)) - goto badarg; - else - goto no_timer; - } - - esdp = ERTS_PROC_GET_SCHDATA(c_p); - - trefn = internal_ref_numbers(tref); - sid = erts_get_ref_numbers_thr_id(trefn); - if (sid < 1 || erts_no_schedulers < sid) - goto no_timer; - - if (sid == (Uint32) esdp->no) { - res = access_sched_local_btm(c_p, c_p->common.id, - tref, trefn, NULL, - async, cancel, !async, - info); - ERTS_BIF_PREP_RET(ret, res); - } - else if (try_access_sched_remote_btm(esdp, c_p, sid, - tref, trefn, - async, cancel, - info, &res)) { - ERTS_BIF_PREP_RET(ret, res); - } - else { - /* - * Schedule access for execution on - * remote scheduler... - */ - ErtsBifTimerRequest *req = erts_alloc(ERTS_ALC_T_TIMER_REQUEST, - sizeof(ErtsBifTimerRequest)); - - req->flags = 0; - if (cancel) - req->flags |= ERTS_BTM_REQ_FLG_CANCEL; - if (async) - req->flags |= ERTS_BTM_REQ_FLG_ASYNC; - if (info) - req->flags |= ERTS_BTM_REQ_FLG_INFO; - - req->pid = c_p->common.id; - - req->trefn[0] = trefn[0]; - req->trefn[1] = trefn[1]; - req->trefn[2] = trefn[2]; - - if (async) - ERTS_BIF_PREP_RET(ret, am_ok); - else { - Eterm *hp, rref; - Uint32 *rrefn; - - hp = HAlloc(c_p, REF_THING_SIZE); - rref = erts_sched_make_ref_in_buffer(esdp, hp); - rrefn = internal_ref_numbers(rref); - - req->rrefn[0] = rrefn[0]; - req->rrefn[1] = rrefn[1]; - req->rrefn[2] = rrefn[2]; - - erts_smp_proc_lock(c_p, ERTS_PROC_LOCKS_MSG_RECEIVE); - - if (ERTS_PROC_PENDING_EXIT(c_p)) - ERTS_VBUMP_ALL_REDS(c_p); - else { - /* - * Caller needs to wait for a message containing - * the ref that we just created. No such message - * can exist in callers message queue at this time. - * We therefore move the save pointer of the - * callers message queue to the end of the queue. - * - * NOTE: It is of vital importance that the caller - * immediately do a receive unconditionaly - * waiting for the message with the reference; - * otherwise, next receive will *not* work - * as expected! - */ - ERTS_SMP_MSGQ_MV_INQ2PRIVQ(c_p); - c_p->msg.save = c_p->msg.last; - } - erts_smp_proc_unlock(c_p, ERTS_PROC_LOCKS_MSG_RECEIVE); - - ERTS_BIF_PREP_TRAP1(ret, erts_await_result, c_p, rref); - } - - erts_schedule_misc_aux_work(sid, - bif_timer_access_request, - (void *) req); - } - - return ret; - -badarg: - ERTS_BIF_PREP_ERROR(ret, c_p, BADARG); - return ret; - -no_timer: - ERTS_BIF_PREP_RET(ret, am_false); - return ret; - -} - -static ERTS_INLINE int -bool_arg(Eterm val, int *argp) -{ - switch (val) { - case am_true: *argp = 1; return 1; - case am_false: *argp = 0; return 1; - default: return 0; - } -} - -static ERTS_INLINE int -parse_bif_timer_options(Eterm option_list, int *async, int *info, - int *abs, Eterm *accessor) -{ - Eterm list = option_list; - - if (async) - *async = 0; - if (info) - *info = 1; - if (abs) - *abs = 0; - if (accessor) - *accessor = THE_NON_VALUE; - - while (is_list(list)) { - Eterm *consp, *tp, opt; - - consp = list_val(list); - opt = CAR(consp); - if (is_not_tuple(opt)) - return 0; - - tp = tuple_val(opt); - if (arityval(tp[0]) != 2) - return 0; - - switch (tp[1]) { - case am_async: - if (!async || !bool_arg(tp[2], async)) - return 0; - break; - case am_info: - if (!info || !bool_arg(tp[2], info)) - return 0; - break; - case am_abs: - if (!abs || !bool_arg(tp[2], abs)) - return 0; - break; -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - case am_accessor: - if (!accessor || is_not_internal_pid(tp[2])) - return 0; - *accessor = tp[2]; - break; -#endif - default: - return 0; - } - - list = CDR(consp); - } - - if (is_not_nil(list)) - return 0; - return 1; -} - -static void -exit_cancel_bif_timer(ErtsHLTimer *tmr, void *vesdp) -{ - ErtsSchedulerData *esdp = (ErtsSchedulerData *) vesdp; - Uint32 sid, roflgs; - erts_aint_t state; - - state = erts_smp_atomic32_cmpxchg_acqb(&tmr->state, - ERTS_TMR_STATE_CANCELED, - ERTS_TMR_STATE_ACTIVE); - - roflgs = tmr->head.roflgs; - sid = roflgs & ERTS_TMR_ROFLG_SID_MASK; - - ERTS_HLT_ASSERT(sid == erts_get_ref_numbers_thr_id(tmr->btm.refn)); - ERTS_HLT_ASSERT(tmr->btm.proc_tree.parent - != ERTS_HLT_PFIELD_NOT_IN_TABLE); - - tmr->btm.proc_tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - - if (sid == (Uint32) esdp->no) { - if (state == ERTS_TMR_STATE_ACTIVE) { - if (tmr->btm.bp) - free_message_buffer(tmr->btm.bp); - hlt_delete_timer(esdp, tmr); - } - hl_timer_dec_refc(tmr, roflgs); - } - else { - if (state == ERTS_TMR_STATE_ACTIVE) { - if (tmr->btm.bp) - free_message_buffer(tmr->btm.bp); - queue_canceled_timer(esdp, sid, (ErtsTimer *) tmr); - } - else - hl_timer_dec_refc(tmr, roflgs); - } -} - -#ifdef ERTS_HLT_DEBUG -# define ERTS_BTM_MAX_DESTROY_LIMIT 2 -#else -# define ERTS_BTM_MAX_DESTROY_LIMIT 50 -#endif - -typedef struct { - ErtsBifTimers *bif_timers; - union { - proc_btm_rbt_yield_state_t proc_btm_yield_state; -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - abtm_rbt_yield_state_t abtm_yield_state; -#endif - } u; -} ErtsBifTimerYieldState; - -int erts_cancel_bif_timers(Process *p, ErtsBifTimers *btm, void **vyspp) -{ - ErtsSchedulerData *esdp = ERTS_PROC_GET_SCHDATA(p); - ErtsBifTimerYieldState ys = {btm, {ERTS_RBT_YIELD_STAT_INITER}}; - ErtsBifTimerYieldState *ysp; - int res; - - ysp = (ErtsBifTimerYieldState *) *vyspp; - if (!ysp) - ysp = &ys; - - res = proc_btm_rbt_foreach_destroy_yielding(&ysp->bif_timers, - exit_cancel_bif_timer, - (void *) esdp, - &ysp->u.proc_btm_yield_state, - ERTS_BTM_MAX_DESTROY_LIMIT); - - if (res == 0) { - if (ysp != &ys) - erts_free(ERTS_ALC_T_BTM_YIELD_STATE, ysp); - *vyspp = NULL; - } - else { - - if (ysp == &ys) { - ysp = erts_alloc(ERTS_ALC_T_BTM_YIELD_STATE, - sizeof(ErtsBifTimerYieldState)); - sys_memcpy((void *) ysp, (void *) &ys, - sizeof(ErtsBifTimerYieldState)); - } - - *vyspp = (void *) ysp; - } - - return res; -} - -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - -static void -detach_bif_timer(ErtsHLTimer *tmr, void *vesdp) -{ - tmr->abtm.tree.parent = ERTS_HLT_PFIELD_NOT_IN_TABLE; - hl_timer_dec_refc(tmr, tmr->head.roflgs); -} - -int erts_detach_accessor_bif_timers(Process *p, ErtsBifTimers *btm, void **vyspp) -{ - ErtsSchedulerData *esdp = ERTS_PROC_GET_SCHDATA(p); - ErtsBifTimerYieldState ys = {btm, {ERTS_RBT_YIELD_STAT_INITER}}; - ErtsBifTimerYieldState *ysp; - int res; - - ysp = (ErtsBifTimerYieldState *) *vyspp; - if (!ysp) - ysp = &ys; - - res = abtm_rbt_foreach_destroy_yielding(&ysp->bif_timers, - detach_bif_timer, - (void *) esdp, - &ysp->u.abtm_yield_state, - ERTS_BTM_MAX_DESTROY_LIMIT); - - if (res == 0) { - if (ysp != &ys) - erts_free(ERTS_ALC_T_BTM_YIELD_STATE, ysp); - *vyspp = NULL; - } - else { - - if (ysp == &ys) { - ysp = erts_alloc(ERTS_ALC_T_BTM_YIELD_STATE, - sizeof(ErtsBifTimerYieldState)); - sys_memcpy((void *) ysp, (void *) &ys, - sizeof(ErtsBifTimerYieldState)); - } - - *vyspp = (void *) ysp; - } - - return res; -} - -#endif /* ERTS_BTM_ACCESSOR_SUPPORT */ - -static ERTS_INLINE int -parse_timeout_pos(ErtsSchedulerData *esdp, Eterm arg, - ErtsMonotonicTime *conv_arg, int abs, - ErtsMonotonicTime *tposp, int *stimep) -{ - ErtsMonotonicTime t; - - if (!term_to_Sint64(arg, &t)) { - ERTS_HLT_ASSERT(!is_small(arg)); - if (!is_big(arg)) - return -1; - - if (abs || !big_sign(arg)) - return 1; - - return -1; - } - - if (conv_arg) - *conv_arg = t; - - if (abs) { - t += -1*ERTS_MONOTONIC_OFFSET_MSEC; /* external to internal */ - if (t < ERTS_MONOTONIC_TO_MSEC(ERTS_MONOTONIC_BEGIN)) - return 1; - if (t > ERTS_MONOTONIC_TO_MSEC(ERTS_MONOTONIC_END)) - return 1; - *stimep = (t - ERTS_MONOTONIC_TO_MSEC(esdp->last_monotonic_time) - < ERTS_BIF_TIMER_SHORT_TIME); - *tposp = ERTS_MSEC_TO_CLKTCKS(t); - } - else { - ErtsMonotonicTime now, ticks; - - if (t < 0) - return -1; - - ticks = ERTS_MSEC_TO_CLKTCKS(t); - - if (ERTS_CLKTCK_RESOLUTION > 1000 && ticks < 0) - return 1; - - ERTS_HLT_ASSERT(ticks >= 0); - - now = erts_get_monotonic_time(esdp); - ticks += ERTS_MONOTONIC_TO_CLKTCKS(now-1); - ticks += 1; - - if (ticks < ERTS_MONOTONIC_TO_CLKTCKS(ERTS_MONOTONIC_BEGIN)) - return 1; - if (ticks > ERTS_MONOTONIC_TO_CLKTCKS(ERTS_MONOTONIC_END)) - return 1; - - *stimep = (t < ERTS_BIF_TIMER_SHORT_TIME); - *tposp = ticks; - } - - return 0; -} - -/* - * - * The BIF timer BIFs... - */ - -BIF_RETTYPE send_after_3(BIF_ALIST_3) -{ - ErtsMonotonicTime timeout_pos; - int short_time, tres; - - tres = parse_timeout_pos(ERTS_PROC_GET_SCHDATA(BIF_P), BIF_ARG_1, NULL, - 0, &timeout_pos, &short_time); - if (tres != 0) - BIF_ERROR(BIF_P, BADARG); - - return setup_bif_timer(BIF_P, timeout_pos, short_time, - BIF_ARG_2, BIF_ARG_2, BIF_ARG_3, 0); -} - -BIF_RETTYPE send_after_4(BIF_ALIST_4) -{ - ErtsMonotonicTime timeout_pos; - Eterm accessor; - int short_time, abs, tres; - - if (!parse_bif_timer_options(BIF_ARG_4, NULL, NULL, &abs, &accessor)) - BIF_ERROR(BIF_P, BADARG); - - tres = parse_timeout_pos(ERTS_PROC_GET_SCHDATA(BIF_P), BIF_ARG_1, NULL, - abs, &timeout_pos, &short_time); - if (tres != 0) - BIF_ERROR(BIF_P, BADARG); - - return setup_bif_timer(BIF_P, timeout_pos, short_time, - BIF_ARG_2, accessor, BIF_ARG_3, 0); -} - -BIF_RETTYPE start_timer_3(BIF_ALIST_3) -{ - ErtsMonotonicTime timeout_pos; - int short_time, tres; - - tres = parse_timeout_pos(ERTS_PROC_GET_SCHDATA(BIF_P), BIF_ARG_1, NULL, - 0, &timeout_pos, &short_time); - if (tres != 0) - BIF_ERROR(BIF_P, BADARG); - - return setup_bif_timer(BIF_P, timeout_pos, short_time, - BIF_ARG_2, BIF_ARG_2, BIF_ARG_3, !0); -} - -BIF_RETTYPE start_timer_4(BIF_ALIST_4) -{ - ErtsMonotonicTime timeout_pos; - Eterm accessor; - int short_time, abs, tres; - - if (!parse_bif_timer_options(BIF_ARG_4, NULL, NULL, &abs, &accessor)) - BIF_ERROR(BIF_P, BADARG); - - tres = parse_timeout_pos(ERTS_PROC_GET_SCHDATA(BIF_P), BIF_ARG_1, NULL, - abs, &timeout_pos, &short_time); - if (tres != 0) - BIF_ERROR(BIF_P, BADARG); - - return setup_bif_timer(BIF_P, timeout_pos, short_time, - BIF_ARG_2, accessor, BIF_ARG_3, !0); -} - -BIF_RETTYPE cancel_timer_1(BIF_ALIST_1) -{ - return access_bif_timer(BIF_P, BIF_ARG_1, 1, 0, 1); -} - -BIF_RETTYPE cancel_timer_2(BIF_ALIST_2) -{ - BIF_RETTYPE ret; - int async, info; - - if (parse_bif_timer_options(BIF_ARG_2, &async, &info, NULL, NULL)) - return access_bif_timer(BIF_P, BIF_ARG_1, 1, async, info); - - ERTS_BIF_PREP_ERROR(ret, BIF_P, BADARG); - return ret; -} - -BIF_RETTYPE read_timer_1(BIF_ALIST_1) -{ - return access_bif_timer(BIF_P, BIF_ARG_1, 0, 0, 1); -} - -BIF_RETTYPE read_timer_2(BIF_ALIST_2) -{ - BIF_RETTYPE ret; - int async; - - if (parse_bif_timer_options(BIF_ARG_2, &async, NULL, NULL, NULL)) - return access_bif_timer(BIF_P, BIF_ARG_1, 0, async, 1); - - ERTS_BIF_PREP_ERROR(ret, BIF_P, BADARG); - return ret; -} - -static void -start_callback_timer(ErtsSchedulerData *esdp, - int twt, - ErtsMonotonicTime timeout_pos, - void (*callback)(void *), - void *arg) - -{ - if (twt) - create_tw_timer(esdp, ERTS_TMR_CALLBACK, NULL, - callback, arg, timeout_pos); - else - create_hl_timer(esdp, timeout_pos, 0, - ERTS_TMR_CALLBACK, NULL, - NIL, THE_NON_VALUE, NIL, - NULL, callback, arg); -} - -typedef struct { - int twt; - ErtsMonotonicTime timeout_pos; - void (*callback)(void *); - void *arg; -} ErtsStartCallbackTimerRequest; - -static void -scheduled_start_callback_timer(void *vsctr) -{ - ErtsStartCallbackTimerRequest *sctr - = (ErtsStartCallbackTimerRequest *) vsctr; - - start_callback_timer(erts_get_scheduler_data(), - sctr->twt, - sctr->timeout_pos, - sctr->callback, - sctr->arg); - - erts_free(ERTS_ALC_T_TIMER_REQUEST, vsctr); -} - -void -erts_start_timer_callback(ErtsMonotonicTime tmo, - void (*callback)(void *), - void *arg) -{ - ErtsSchedulerData *esdp; - ErtsMonotonicTime timeout_pos; - int twt; - - esdp = erts_get_scheduler_data(); - timeout_pos = get_timeout_pos(erts_get_monotonic_time(esdp), - tmo); - twt = tmo < ERTS_TIMER_WHEEL_MSEC; - - if (esdp) - start_callback_timer(esdp, - twt, - timeout_pos, - callback, - arg); - else { - ErtsStartCallbackTimerRequest *sctr; - sctr = erts_alloc(ERTS_ALC_T_TIMER_REQUEST, - sizeof(ErtsStartCallbackTimerRequest)); - sctr->twt = twt; - sctr->timeout_pos = timeout_pos; - sctr->callback = callback; - sctr->arg = arg; - erts_schedule_misc_aux_work(1, - scheduled_start_callback_timer, - (void *) sctr); - } -} - -/* - * Process and Port timer functionality. - * - * NOTE! These are only allowed to be called by a - * scheduler thread that currently is - * executing the process or port. - */ - -static ERTS_INLINE void -set_proc_timer_common(Process *c_p, ErtsSchedulerData *esdp, Sint64 tmo, - ErtsMonotonicTime timeout_pos, int short_time) -{ - void *tmr; - check_canceled_queue(esdp, esdp->timer_service); - - if (tmo == 0) - c_p->flags |= F_TIMO; - else { - - c_p->flags |= F_INSLPQUEUE; - c_p->flags &= ~F_TIMO; - - if (tmo < ERTS_TIMER_WHEEL_MSEC) - tmr = (void *) create_tw_timer(esdp, ERTS_TMR_PROC, (void *) c_p, - NULL, NULL, timeout_pos); - else - tmr = (void *) create_hl_timer(esdp, timeout_pos, short_time, - ERTS_TMR_PROC, (void *) c_p, - c_p->common.id, THE_NON_VALUE, - NIL, NULL, NULL, NULL); - erts_smp_atomic_set_relb(&c_p->common.timer, (erts_aint_t) tmr); - } -} - -int -erts_set_proc_timer_term(Process *c_p, Eterm etmo) -{ - ErtsSchedulerData *esdp = ERTS_PROC_GET_SCHDATA(c_p); - ErtsMonotonicTime tmo, timeout_pos; - int short_time, tres; - - ERTS_HLT_ASSERT(erts_smp_atomic_read_nob(&c_p->common.timer) - == ERTS_PTMR_NONE); - - tres = parse_timeout_pos(esdp, etmo, &tmo, 0, - &timeout_pos, &short_time); - if (tres != 0) - return tres; - - if ((tmo >> 32) != 0) - return 1; - - set_proc_timer_common(c_p, esdp, tmo, timeout_pos, short_time); - return 0; -} - -void -erts_set_proc_timer_uword(Process *c_p, UWord tmo) -{ - ErtsSchedulerData *esdp = ERTS_PROC_GET_SCHDATA(c_p); - - ERTS_HLT_ASSERT(erts_smp_atomic_read_nob(&c_p->common.timer) - == ERTS_PTMR_NONE); - -#ifndef ARCH_32 - ERTS_HLT_ASSERT((tmo >> 32) == (UWord) 0); -#endif - - if (tmo == 0) - c_p->flags |= F_TIMO; - else { - ErtsMonotonicTime timeout_pos; - timeout_pos = get_timeout_pos(erts_get_monotonic_time(esdp), - (ErtsMonotonicTime) tmo); - set_proc_timer_common(c_p, esdp, (ErtsMonotonicTime) tmo, - timeout_pos, - tmo < ERTS_BIF_TIMER_SHORT_TIME); - } -} - -void -erts_cancel_proc_timer(Process *c_p) -{ - erts_aint_t tval; - tval = erts_smp_atomic_xchg_acqb(&c_p->common.timer, - ERTS_PTMR_NONE); - c_p->flags &= ~(F_INSLPQUEUE|F_TIMO); - if (tval == ERTS_PTMR_NONE) - return; - if (tval == ERTS_PTMR_TIMEDOUT) { - erts_smp_atomic_set_nob(&c_p->common.timer, ERTS_PTMR_NONE); - return; - } - continue_cancel_ptimer(ERTS_PROC_GET_SCHDATA(c_p), - (ErtsTimer *) tval); -} - -void -erts_set_port_timer(Port *c_prt, Sint64 tmo) -{ - void *tmr; - ErtsSchedulerData *esdp = erts_get_scheduler_data(); - ErtsMonotonicTime timeout_pos; - - if (erts_smp_atomic_read_nob(&c_prt->common.timer) != ERTS_PTMR_NONE) - erts_cancel_port_timer(c_prt); - - check_canceled_queue(esdp, esdp->timer_service); - - timeout_pos = get_timeout_pos(erts_get_monotonic_time(esdp), tmo); - - if (tmo < ERTS_TIMER_WHEEL_MSEC) - tmr = (void *) create_tw_timer(esdp, ERTS_TMR_PORT, (void *) c_prt, - NULL, NULL, timeout_pos); - else - tmr = (void *) create_hl_timer(esdp, timeout_pos, 0, ERTS_TMR_PORT, - (void *) c_prt, c_prt->common.id, - THE_NON_VALUE, NIL, NULL, NULL, NULL); - erts_smp_atomic_set_relb(&c_prt->common.timer, (erts_aint_t) tmr); -} - -void -erts_cancel_port_timer(Port *c_prt) -{ - erts_aint_t tval; - tval = erts_smp_atomic_xchg_acqb(&c_prt->common.timer, - ERTS_PTMR_NONE); - if (tval == ERTS_PTMR_NONE) - return; - if (tval == ERTS_PTMR_TIMEDOUT) { - while (!erts_port_task_is_scheduled(&c_prt->timeout_task)) - erts_thr_yield(); - erts_port_task_abort(&c_prt->timeout_task); - erts_smp_atomic_set_nob(&c_prt->common.timer, ERTS_PTMR_NONE); - return; - } - continue_cancel_ptimer(erts_get_scheduler_data(), - (ErtsTimer *) tval); -} - -Sint64 -erts_read_port_timer(Port *c_prt) -{ - ErtsTimer *tmr; - erts_aint_t itmr; - ErtsMonotonicTime timeout_pos; - - itmr = erts_smp_atomic_read_acqb(&c_prt->common.timer); - if (itmr == ERTS_PTMR_NONE) - return (Sint64) -1; - if (itmr == ERTS_PTMR_TIMEDOUT) - return (Sint64) 0; - tmr = (ErtsTimer *) itmr; - if (tmr->head.roflgs & ERTS_TMR_ROFLG_HLT) - timeout_pos = tmr->hlt.timeout; - else - timeout_pos = tmr->twt.tw_tmr.timeout_pos; - return get_time_left(NULL, timeout_pos); -} - -/* - * Debug stuff... - */ - -typedef struct { - int to; - void *to_arg; - ErtsMonotonicTime now; -} ErtsBTMPrint; - -static void -btm_print(ErtsHLTimer *tmr, void *vbtmp) -{ - ErtsBTMPrint *btmp = (ErtsBTMPrint *) vbtmp; - ErtsMonotonicTime left; - Eterm receiver; - - if (tmr->timeout <= btmp->now) - left = 0; - left = ERTS_CLKTCKS_TO_MSEC(tmr->timeout - btmp->now); - - receiver = ((tmr->head.roflgs & ERTS_TMR_ROFLG_REG_NAME) - ? tmr->receiver.name - : tmr->receiver.proc->common.id); - - erts_print(btmp->to, btmp->to_arg, - "=timer:%T\n" - "Message: %T\n" - "Time left: %b64d\n", - receiver, - tmr->btm.message, - (Sint64) left); -} - -void -erts_print_bif_timer_info(int to, void *to_arg) -{ - ErtsBTMPrint btmp; - int six; - - if (!ERTS_IS_CRASH_DUMPING) - ERTS_INTERNAL_ERROR("Not crash dumping"); - - btmp.to = to; - btmp.to_arg = to_arg; - btmp.now = erts_get_monotonic_time(NULL); - btmp.now = ERTS_MONOTONIC_TO_CLKTCKS(btmp.now); - - for (six = 0; six < erts_no_schedulers; six++) { - ErtsHLTimerService *srv = - erts_aligned_scheduler_data[six].esd.timer_service; - btm_rbt_foreach(srv->btm_tree, btm_print, (void *) &btmp); - } -} - -typedef struct { - void (*func)(Eterm, - Eterm, - ErlHeapFragment *, - void *); - void *arg; -} ErtsBTMForeachDebug; - -static void -debug_btm_foreach(ErtsHLTimer *tmr, void *vbtmfd) -{ - if (erts_smp_atomic32_read_nob(&tmr->state) == ERTS_TMR_STATE_ACTIVE) { - ErtsBTMForeachDebug *btmfd = (ErtsBTMForeachDebug *) vbtmfd; - (*btmfd->func)(((tmr->head.roflgs & ERTS_TMR_ROFLG_REG_NAME) - ? tmr->receiver.name - : tmr->receiver.proc->common.id), - tmr->btm.message, - tmr->btm.bp, - btmfd->arg); - } -} - -void -erts_debug_bif_timer_foreach(void (*func)(Eterm, - Eterm, - ErlHeapFragment *, - void *), - void *arg) -{ - ErtsBTMForeachDebug btmfd; - int six; - - btmfd.func = func; - btmfd.arg = arg; - - if (!erts_smp_thr_progress_is_blocking()) - ERTS_INTERNAL_ERROR("Not blocking thread progress"); - - for (six = 0; six < erts_no_schedulers; six++) { - ErtsHLTimerService *srv = - erts_aligned_scheduler_data[six].esd.timer_service; - btm_rbt_foreach(srv->btm_tree, - debug_btm_foreach, - (void *) &btmfd); - } -} - -typedef struct { - void (*tclbk)(void *); - void (*func)(void *, - ErtsMonotonicTime, - void *); - void *arg; -} ErtsDebugForeachCallbackTimer; - -static void -debug_callback_timer_foreach_list(ErtsHLTimer *tmr, void *vdfct) -{ - ErtsDebugForeachCallbackTimer *dfct - = (ErtsDebugForeachCallbackTimer *) vdfct; - - if ((tmr->head.roflgs & ERTS_TMR_ROFLG_CALLBACK) - && (tmr->receiver.callback == dfct->tclbk)) - (*dfct->func)(dfct->arg, - tmr->timeout, - tmr->head.u.arg); -} - -static void -debug_callback_timer_foreach(ErtsHLTimer *tmr, void *vdfct) -{ - ErtsDebugForeachCallbackTimer *dfct - = (ErtsDebugForeachCallbackTimer *) vdfct; - - if (tmr->time.tree.same_time) - same_time_list_foreach(tmr->time.tree.same_time, - debug_callback_timer_foreach_list, - vdfct); - - if ((tmr->head.roflgs & ERTS_TMR_ROFLG_CALLBACK) - && (tmr->receiver.callback == dfct->tclbk)) - (*dfct->func)(dfct->arg, - tmr->timeout, - tmr->head.u.arg); -} - -static void -debug_tw_callback_timer(void *vdfct, - ErtsMonotonicTime timeout_pos, - void *vtwtp) -{ - ErtsTWTimer *twtp = (ErtsTWTimer *) vtwtp; - ErtsDebugForeachCallbackTimer *dfct - = (ErtsDebugForeachCallbackTimer *) vdfct; - - if (twtp->u.callback == dfct->tclbk) - (*dfct->func)(dfct->arg, - timeout_pos, - twtp->head.u.arg); -} - -void -erts_debug_callback_timer_foreach(void (*tclbk)(void *), - void (*func)(void *, - ErtsMonotonicTime, - void *), - void *arg) -{ - int six; - ErtsDebugForeachCallbackTimer dfct; - - dfct.tclbk = tclbk; - dfct.func = func; - dfct.arg = arg; - - if (!erts_smp_thr_progress_is_blocking()) - ERTS_INTERNAL_ERROR("Not blocking thread progress"); - - for (six = 0; six < erts_no_schedulers; six++) { - ErtsHLTimerService *srv = - erts_aligned_scheduler_data[six].esd.timer_service; - ErtsTimerWheel *twheel = - erts_aligned_scheduler_data[six].esd.timer_wheel; - - erts_twheel_debug_foreach(twheel, - tw_callback_timeout, - debug_tw_callback_timer, - (void *) &dfct); - - if (srv->yield.root) - debug_callback_timer_foreach(srv->yield.root, - (void *) &dfct); - - time_rbt_foreach(srv->time_tree, - debug_callback_timer_foreach, - (void *) &dfct); - } -} - -#ifdef ERTS_HLT_HARD_DEBUG - -typedef struct { - ErtsHLTimerService *srv; - int found_root; - ErtsHLTimer **rootpp; -} ErtsHdbgHLT; - -static void -st_hdbg_func(ErtsHLTimer *tmr, void *vhdbg) -{ - ErtsHdbgHLT *hdbg = (ErtsHdbgHLT *) vhdbg; - ErtsHLTimer **rootpp; - ERTS_HLT_ASSERT(tmr->time.tree.parent & ERTS_HLT_PFLG_SAME_TIME); - if (tmr->time.tree.parent == ERTS_HLT_PFLG_SAME_TIME) { - ERTS_HLT_ASSERT(tmr != *hdbg->rootpp); - } - else { - rootpp = (ErtsHLTimer **) (tmr->time.tree.parent - & ~ERTS_HLT_PFLG_SAME_TIME); - ERTS_HLT_ASSERT(rootpp == hdbg->rootpp); - ERTS_HLT_ASSERT(tmr == *rootpp); - ERTS_HLT_ASSERT(!hdbg->found_root); - hdbg->found_root = 1; - } - ERTS_HLT_ASSERT(tmr->time.tree.u.l.next->time.tree.u.l.prev == tmr); - ERTS_HLT_ASSERT(tmr->time.tree.u.l.prev->time.tree.u.l.next == tmr); - ERTS_HLT_ASSERT(btm_rbt_lookup(hdbg->srv->btm_tree, tmr->btm.refn) == tmr); -} - -static void -tt_hdbg_func(ErtsHLTimer *tmr, void *vhdbg) -{ - ErtsHdbgHLT *hdbg = (ErtsHdbgHLT *) vhdbg; - ErtsHLTimer *prnt; - ERTS_HLT_ASSERT((tmr->time.tree.parent & ERTS_HLT_PFLG_SAME_TIME) == 0); - prnt = (ErtsHLTimer *) (tmr->time.tree.parent & ~ERTS_HLT_PFLGS_MASK); - if (prnt) { - ERTS_HLT_ASSERT(prnt->time.tree.u.t.left == tmr - || prnt->time.tree.u.t.right == tmr); - } - else { - ERTS_HLT_ASSERT(!hdbg->found_root); - hdbg->found_root = 1; - ERTS_HLT_ASSERT(tmr == *hdbg->rootpp); - } - if (tmr->time.tree.u.t.left) { - prnt = (ErtsHLTimer *) (tmr->time.tree.u.t.left->time.tree.parent - & ~ERTS_HLT_PFLGS_MASK); - ERTS_HLT_ASSERT(tmr == prnt); - } - if (tmr->time.tree.u.t.right) { - prnt = (ErtsHLTimer *) (tmr->time.tree.u.t.right->time.tree.parent - & ~ERTS_HLT_PFLGS_MASK); - ERTS_HLT_ASSERT(tmr == prnt); - } - ERTS_HLT_ASSERT(btm_rbt_lookup(hdbg->srv->btm_tree, tmr->btm.refn) == tmr); - if (tmr->time.tree.same_time) { - ErtsHdbgHLT st_hdbg; - st_hdbg.srv = hdbg->srv; - st_hdbg.found_root = 0; - st_hdbg.rootpp = &tmr->time.tree.same_time; - same_time_list_foreach(tmr->time.tree.same_time, st_hdbg_func, (void *) &st_hdbg); - ERTS_HLT_ASSERT(st_hdbg.found_root); - } -} - -static void -bt_hdbg_func(ErtsHLTimer *tmr, void *vhdbg) -{ - ErtsHdbgHLT *hdbg = (ErtsHdbgHLT *) vhdbg; - ErtsHLTimer *prnt; - ERTS_HLT_ASSERT((tmr->btm.tree.parent & ERTS_HLT_PFLG_SAME_TIME) == 0); - prnt = (ErtsHLTimer *) (tmr->btm.tree.parent & ~ERTS_HLT_PFLGS_MASK); - if (prnt) { - ERTS_HLT_ASSERT(prnt->btm.tree.left == tmr - || prnt->btm.tree.right == tmr); - } - else { - ERTS_HLT_ASSERT(!hdbg->found_root); - hdbg->found_root = 1; - ERTS_HLT_ASSERT(tmr == *hdbg->rootpp); - } - if (tmr->btm.tree.left) { - prnt = (ErtsHLTimer *) (tmr->btm.tree.left->btm.tree.parent - & ~ERTS_HLT_PFLGS_MASK); - ERTS_HLT_ASSERT(tmr == prnt); - } - if (tmr->btm.tree.right) { - prnt = (ErtsHLTimer *) (tmr->btm.tree.right->btm.tree.parent - & ~ERTS_HLT_PFLGS_MASK); - ERTS_HLT_ASSERT(tmr == prnt); - } - if (tmr->pending_timeout) { - if (tmr->pending_timeout > 0) /* container > 0 */ - ERTS_HLT_ASSERT(tmr->time.tree.parent == ERTS_HLT_PFIELD_NOT_IN_TABLE); - else { - ERTS_HLT_ASSERT(tmr->time.tree.parent != ERTS_HLT_PFIELD_NOT_IN_TABLE); - ERTS_HLT_ASSERT(tmr->time.tree.parent & ERTS_HLT_PFLG_SAME_TIME); - } - } - else { - ErtsHLTimer *ttmr = time_rbt_lookup(hdbg->srv->time_tree, tmr->timeout); - ERTS_HLT_ASSERT(ttmr); - if (ttmr != tmr) { - ERTS_HLT_ASSERT(ttmr->time.tree.same_time); - ERTS_HLT_ASSERT(tmr == same_time_list_lookup(ttmr->time.tree.same_time, tmr)); - } - } -} - -static void -hdbg_chk_srv(ErtsHLTimerService *srv) -{ - if (srv->time_tree) { - ErtsHdbgHLT hdbg; - hdbg.srv = srv; - hdbg.found_root = 0; - hdbg.rootpp = &srv->time_tree; - time_rbt_foreach(srv->time_tree, tt_hdbg_func, (void *) &hdbg); - ERTS_HLT_ASSERT(hdbg.found_root); - } - if (srv->btm_tree) { - ErtsHdbgHLT hdbg; - hdbg.srv = srv; - hdbg.found_root = 0; - hdbg.rootpp = &srv->btm_tree; - btm_rbt_foreach(srv->btm_tree, bt_hdbg_func, (void *) &hdbg); - ERTS_HLT_ASSERT(hdbg.found_root); - } -} - -#endif /* ERTS_HLT_HARD_DEBUG */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_hl_timer.h erlang-17.3-dfsg/erts/emulator/beam/erl_hl_timer.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_hl_timer.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_hl_timer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -#ifndef ERL_HL_TIMER_H__ -#define ERL_HL_TIMER_H__ - -typedef struct ErtsHLTimer_ ErtsBifTimers; -typedef struct ErtsHLTimerService_ ErtsHLTimerService; - -#include "sys.h" -#include "erl_process.h" -#define ERL_PORT_GET_PORT_TYPE_ONLY__ -#include "erl_port.h" -#undef ERL_PORT_GET_PORT_TYPE_ONLY__ -#include "erl_message.h" -#include "erl_alloc_types.h" - -#define ERTS_PTMR_NONE ((erts_aint_t) NULL) -#define ERTS_PTMR_TIMEDOUT (ERTS_PTMR_NONE + ((erts_aint_t) 1)) - -#define ERTS_PTMR_INIT(P) \ - erts_smp_atomic_init_nob(&(P)->common.timer, ERTS_PTMR_NONE) -#define ERTS_PTMR_IS_SET(P) \ - (ERTS_PTMR_NONE != erts_smp_atomic_read_nob(&(P)->common.timer)) -#define ERTS_PTMR_IS_TIMED_OUT(P) \ - (ERTS_PTMR_TIMEDOUT == erts_smp_atomic_read_nob(&(P)->common.timer)) - -#define ERTS_PTMR_CLEAR(P) \ - do { \ - ASSERT(ERTS_PTMR_IS_TIMED_OUT((P))); \ - erts_smp_atomic_set_nob(&(P)->common.timer, \ - ERTS_PTMR_NONE); \ - } while (0) - -size_t erts_timer_type_size(ErtsAlcType_t type); -int erts_set_proc_timer_term(Process *, Eterm); -void erts_set_proc_timer_uword(Process *, UWord); -void erts_cancel_proc_timer(Process *); -void erts_set_port_timer(Port *, Sint64); -void erts_cancel_port_timer(Port *); -Sint64 erts_read_port_timer(Port *); -int erts_cancel_bif_timers(Process *, ErtsBifTimers *, void **); -int erts_detach_accessor_bif_timers(Process *, ErtsBifTimers *, void **); -ErtsHLTimerService *erts_create_timer_service(void); -void erts_hl_timer_init(void); -void erts_start_timer_callback(ErtsMonotonicTime, - void (*)(void *), - void *); -#ifdef ERTS_SMP -void -erts_handle_canceled_timers(void *vesdp, - int *need_thr_progress, - ErtsThrPrgrVal *thr_prgr_p, - int *need_more_work); -#endif - -Uint erts_bif_timer_memory_size(void); -void erts_print_bif_timer_info(int to, void *to_arg); - -void erts_debug_bif_timer_foreach(void (*func)(Eterm, - Eterm, - ErlHeapFragment *, - void *), - void *arg); -void -erts_debug_callback_timer_foreach(void (*tclbk)(void *), - void (*func)(void *, - ErtsMonotonicTime, - void *), - void *arg); -#endif /* ERL_HL_TIMER_H__ */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_init.c erlang-17.3-dfsg/erts/emulator/beam/erl_init.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_init.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_init.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -36,7 +35,7 @@ #include "dist.h" #include "erl_mseg.h" #include "erl_threads.h" -#include "erl_hl_timer.h" +#include "erl_bif_timer.h" #include "erl_instrument.h" #include "erl_printf_term.h" #include "erl_misc_utils.h" @@ -46,9 +45,6 @@ #include "erl_thr_queue.h" #include "erl_async.h" #include "erl_ptab.h" -#include "erl_bif_unique.h" -#define ERTS_WANT_TIMER_WHEEL_API -#include "erl_time.h" #ifdef HIPE #include "hipe_mode_switch.h" /* for hipe_mode_switch_init() */ @@ -121,8 +117,6 @@ #else const int etp_big_endian = 0; #endif -const Eterm etp_the_non_value = THE_NON_VALUE; - /* * Note about VxWorks: All variables must be initialized by executable code, * not by an initializer. Otherwise a new instance of the emulator will @@ -140,11 +134,7 @@ int legacy_proc_tab, int port_tab_sz, int port_tab_sz_ignore_files, - int legacy_port_tab, - int time_correction, - ErtsTimeWarpMode time_warp_mode, - int node_tab_delete_delay, - ErtsDbSpinCount db_spin_count); + int legacy_port_tab); static erts_atomic_t exiting; @@ -171,6 +161,9 @@ int BIN_VH_MIN_SIZE; /* The minimum binary virtual*/ Uint32 erts_debug_flags; /* Debug flags. */ +#ifdef ERTS_OPCODE_COUNTER_SUPPORT +int count_instructions; +#endif int erts_backtrace_depth; /* How many functions to show in a backtrace * in error codes. */ @@ -195,9 +188,11 @@ Uint32 verbose; /* See erl_debug.h for information about verbose */ #endif -int erts_atom_table_size = ATOM_LIMIT; /* Maximum number of atoms */ +int erts_disable_tolerant_timeofday; /* Time correction can be disabled it is + * not and/or it is too slow. + */ -int erts_pd_initial_size = 10; +int erts_atom_table_size = ATOM_LIMIT; /* Maximum number of atoms */ int erts_modified_timing_level; @@ -274,19 +269,6 @@ return this_rel; } -static ERTS_INLINE void -set_default_time_adj(int *time_correction_p, ErtsTimeWarpMode *time_warp_mode_p) -{ - *time_correction_p = 1; - *time_warp_mode_p = ERTS_NO_TIME_WARP_MODE; - if (!erts_check_time_adj_support(*time_correction_p, - *time_warp_mode_p)) { - *time_correction_p = 0; - ASSERT(erts_check_time_adj_support(*time_correction_p, - *time_warp_mode_p)); - } -} - /* * Common error printout function, all error messages * that don't go to the error logger go through here. @@ -302,24 +284,13 @@ void erts_short_init(void) { - - int ncpu; - int time_correction; - ErtsTimeWarpMode time_warp_mode; - - set_default_time_adj(&time_correction, - &time_warp_mode); - ncpu = early_init(NULL, NULL); + int ncpu = early_init(NULL, NULL); erl_init(ncpu, ERTS_DEFAULT_MAX_PROCESSES, 0, ERTS_DEFAULT_MAX_PORTS, 0, - 0, - time_correction, - time_warp_mode, - ERTS_NODE_TAB_DELAY_GC_DEFAULT, - ERTS_DB_SPNCNT_NORMAL); + 0); erts_initialized = 1; } @@ -329,17 +300,12 @@ int legacy_proc_tab, int port_tab_sz, int port_tab_sz_ignore_files, - int legacy_port_tab, - int time_correction, - ErtsTimeWarpMode time_warp_mode, - int node_tab_delete_delay, - ErtsDbSpinCount db_spin_count) + int legacy_port_tab) { init_benchmarking(); - erts_bif_unique_init(); erts_init_monitors(); - erts_init_time(time_correction, time_warp_mode); + erts_init_time(); erts_init_sys_common_misc(); erts_init_process(ncpu, proc_tab_sz, legacy_proc_tab); erts_init_scheduling(no_schedulers, @@ -350,7 +316,6 @@ no_dirty_io_schedulers #endif ); - erts_late_init_time_sup(); erts_init_cpu_topology(); /* Must be after init_scheduling */ erts_init_gc(); /* Must be after init_scheduling */ erts_alloc_late_init(); @@ -373,8 +338,9 @@ erts_ptab_init(); /* Must be after init_emulator() */ erts_init_binary(); /* Must be after init_emulator() */ erts_bp_init(); - init_db(db_spin_count); /* Must be after init_emulator */ - erts_init_node_tables(node_tab_delete_delay); + init_db(); /* Must be after init_emulator */ + erts_bif_timer_init(); + erts_init_node_tables(); init_dist(); erl_drv_thr_init(); erts_init_async(); @@ -386,7 +352,6 @@ erts_init_bif_re(); erts_init_unicode(); /* after RE to get access to PCRE unicode */ erts_init_external(); - erts_init_map(); erts_delay_trap = erts_export_put(am_erlang, am_delay_trap, 2); erts_late_init_process(); #if HAVE_ERTS_MSEG @@ -400,13 +365,12 @@ erl_nif_init(); } -static Eterm +static void erl_first_process_otp(char* modname, void* code, unsigned size, int argc, char** argv) { int i; Eterm start_mod; Eterm args; - Eterm res; Eterm* hp; Process parent; ErlSpawnOpts so; @@ -436,11 +400,10 @@ hp += 2; args = CONS(hp, env, args); - so.flags = SPO_SYSTEM_PROC; - res = erl_create_process(&parent, start_mod, am_start, args, &so); + so.flags = 0; + (void) erl_create_process(&parent, start_mod, am_start, args, &so); erts_smp_proc_unlock(&parent, ERTS_PROC_LOCK_MAIN); erts_cleanup_empty_process(&parent); - return res; } Eterm @@ -546,9 +509,9 @@ /* erts_fprintf(stderr, "-b func set the boot function (default boot)\n"); */ - erts_fprintf(stderr, "-c bool enable or disable time correction\n"); - erts_fprintf(stderr, "-C mode set time warp mode; valid modes are:\n"); - erts_fprintf(stderr, " no_time_warp|single_time_warp|multi_time_warp\n"); + erts_fprintf(stderr, "-c disable continuous date/time correction with\n"); + erts_fprintf(stderr, " respect to uptime\n"); + erts_fprintf(stderr, "-d don't write a crash dump for internally detected errors\n"); erts_fprintf(stderr, " (halt(String) will still produce a crash dump)\n"); erts_fprintf(stderr, "-fn[u|a|l] Control how filenames are interpreted\n"); @@ -556,8 +519,6 @@ H_DEFAULT_SIZE); erts_fprintf(stderr, "-hmbs size set minimum binary virtual heap size in words (default %d)\n", VH_DEFAULT_SIZE); - erts_fprintf(stderr, "-hpds size initial process dictionary size (default %d)\n", - erts_pd_initial_size); /* erts_fprintf(stderr, "-i module set the boot module (default init)\n"); */ @@ -587,8 +548,6 @@ erts_fprintf(stderr, " see the erl(1) documentation for more info.\n"); erts_fprintf(stderr, "-sct cput set cpu topology,\n"); erts_fprintf(stderr, " see the erl(1) documentation for more info.\n"); - erts_fprintf(stderr, "-secio bool enable/disable eager check I/O scheduling,\n"); - erts_fprintf(stderr, " see the erl(1) documentation for more info.\n"); #if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT_OPT erts_fprintf(stderr, "-sub bool enable/disable scheduler utilization balancing,\n"); #else @@ -633,17 +592,10 @@ erts_fprintf(stderr, "-v turn on chatty mode (GCs will be reported etc)\n"); - erts_fprintf(stderr, "-W set error logger warnings mapping,\n"); + erts_fprintf(stderr, "-W set error logger warnings mapping,\n"); erts_fprintf(stderr, " see error_logger documentation for details\n"); erts_fprintf(stderr, "-zdbbl size set the distribution buffer busy limit in kilobytes\n"); erts_fprintf(stderr, " valid range is [1-%d]\n", INT_MAX/1024); - erts_fprintf(stderr, "-zdntgc time set delayed node table gc in seconds\n"); - erts_fprintf(stderr, " valid values are infinity or intergers in the range [0-%d]\n", - ERTS_NODE_TAB_DELAY_GC_MAX); -#if 0 - erts_fprintf(stderr, "-zebwt val set ets busy wait threshold, valid values are:\n"); - erts_fprintf(stderr, " none|very_short|short|medium|long|very_long|extremely_long\n"); -#endif erts_fprintf(stderr, "\n"); erts_fprintf(stderr, "Note that if the emulator is started with erlexec (typically\n"); erts_fprintf(stderr, "from the erl script), these flags should be specified with +.\n"); @@ -727,6 +679,7 @@ erts_sched_compact_load = 1; erts_printf_eterm_func = erts_printf_term; + erts_disable_tolerant_timeofday = 0; display_items = 200; erts_backtrace_depth = DEFAULT_BACKTRACE_SIZE; erts_async_max_threads = ERTS_DEFAULT_NO_ASYNC_THREADS; @@ -1232,13 +1185,7 @@ int port_tab_sz_ignore_files = 0; int legacy_proc_tab = 0; int legacy_port_tab = 0; - int time_correction; - ErtsTimeWarpMode time_warp_mode; - int node_tab_delete_delay = ERTS_NODE_TAB_DELAY_GC_DEFAULT; - ErtsDbSpinCount db_spin_count = ERTS_DB_SPNCNT_NORMAL; - set_default_time_adj(&time_correction, - &time_warp_mode); envbufsz = sizeof(envbuf); if (erts_sys_getenv_raw(ERL_MAX_ETS_TABLES_ENV, envbuf, &envbufsz) == 0) @@ -1270,7 +1217,7 @@ verbose = DEBUG_DEFAULT; #endif - erts_error_logger_warnings = am_warning; + erts_error_logger_warnings = am_error; while (i < argc) { if (argv[i][0] != '-') { @@ -1459,7 +1406,6 @@ * * h|ms - min_heap_size * h|mbs - min_bin_vheap_size - * h|pds - erts_pd_initial_size * */ if (has_prefix("mbs", sub_param)) { @@ -1477,14 +1423,6 @@ erts_usage(); } VERBOSE(DEBUG_SYSTEM, ("using minimum heap size %d\n", H_MIN_SIZE)); - } else if (has_prefix("pds", sub_param)) { - arg = get_arg(sub_param+3, argv[i+1], &i); - if ((erts_pd_initial_size = atoi(arg)) <= 0) { - erts_fprintf(stderr, "bad initial process dictionary size %s\n", arg); - erts_usage(); - } - VERBOSE(DEBUG_SYSTEM, ("using initial process dictionary size %d\n", - erts_pd_initial_size)); } else { /* backward compatibility */ arg = get_arg(argv[i]+2, argv[i+1], &i); @@ -1736,22 +1674,6 @@ erts_usage(); } } - else if (has_prefix("ecio", sub_param)) { - arg = get_arg(sub_param+4, argv[i+1], &i); -#ifndef __OSE__ - if (sys_strcmp("true", arg) == 0) - erts_eager_check_io = 1; - else -#endif - if (sys_strcmp("false", arg) == 0) - erts_eager_check_io = 0; - else { - erts_fprintf(stderr, - "bad schedule eager check I/O value '%s'\n", - arg); - erts_usage(); - } - } else if (has_prefix("pp", sub_param)) { arg = get_arg(sub_param+2, argv[i+1], &i); if (sys_strcmp(arg, "true") == 0) @@ -1956,51 +1878,15 @@ } break; } - case 'C': - arg = get_arg(argv[i]+2, argv[i+1], &i); - if (sys_strcmp(arg, "no_time_warp") == 0) - time_warp_mode = ERTS_NO_TIME_WARP_MODE; - else if (sys_strcmp(arg, "single_time_warp") == 0) - time_warp_mode = ERTS_SINGLE_TIME_WARP_MODE; - else if (sys_strcmp(arg, "multi_time_warp") == 0) - time_warp_mode = ERTS_MULTI_TIME_WARP_MODE; - else { - erts_fprintf(stderr, - "Invalid time warp mode: %s\n", arg); - erts_usage(); - } - break; case 'c': - if (sys_strcmp(argv[i]+2, "false") == 0) - goto time_correction_false; - else if (sys_strcmp(argv[i]+2, "true") == 0) - goto time_correction_true; - else if (argv[i][2] == '\0') { - if (i + 1 >= argc) - goto time_correction_false; - else { - if (sys_strcmp(argv[i+1], "false") == 0) { - (void) get_arg(argv[i]+2, argv[i+1], &i); - goto time_correction_false; - } - else if (sys_strcmp(argv[i+1], "true") == 0) { - (void) get_arg(argv[i]+2, argv[i+1], &i); - time_correction_true: - time_correction = 1; - break; - } - else { - time_correction_false: - time_correction = 0; - break; - } - } + if (argv[i][2] == 0) { /* -c: documented option */ + erts_disable_tolerant_timeofday = 1; } - else { - arg = get_arg(argv[i]+2, argv[i+1], &i); - erts_fprintf(stderr, "Invalid time correnction value: %s\n", arg); - erts_usage(); +#ifdef ERTS_OPCODE_COUNTER_SUPPORT + else if (argv[i][2] == 'i') { /* -ci: undcoumented option*/ + count_instructions = 1; } +#endif break; case 'W': arg = get_arg(argv[i]+2, argv[i+1], &i); @@ -2008,12 +1894,11 @@ case 'i': erts_error_logger_warnings = am_info; break; - case 'e': - erts_error_logger_warnings = am_error; - break; case 'w': erts_error_logger_warnings = am_warning; break; + case 'e': /* The default */ + erts_error_logger_warnings = am_error; default: erts_fprintf(stderr, "unrecognized warning_map option %s\n", arg); erts_usage(); @@ -2022,9 +1907,9 @@ case 'z': { char *sub_param = argv[i]+2; + int new_limit; if (has_prefix("dbbl", sub_param)) { - int new_limit; arg = get_arg(sub_param+4, argv[i+1], &i); new_limit = atoi(arg); if (new_limit < 1 || INT_MAX/1024 < new_limit) { @@ -2033,46 +1918,6 @@ } else { erts_dist_buf_busy_limit = new_limit*1024; } - } - else if (has_prefix("dntgc", sub_param)) { - long secs; - - arg = get_arg(sub_param+5, argv[i+1], &i); - if (sys_strcmp(arg, "infinity") == 0) - secs = ERTS_NODE_TAB_DELAY_GC_INFINITY; - else { - char *endptr; - errno = 0; - secs = strtol(arg, &endptr, 10); - if (errno != 0 || *arg == '\0' || *endptr != '\0' - || secs < 0 || ERTS_NODE_TAB_DELAY_GC_MAX < secs) { - erts_fprintf(stderr, "Invalid delayed node table gc: %s\n", arg); - erts_usage(); - } - } - node_tab_delete_delay = (int) secs; - } - else if (has_prefix("ebwt", sub_param)) { - arg = get_arg(sub_param+4, argv[i+1], &i); - if (sys_strcmp(arg, "none") == 0) - db_spin_count = ERTS_DB_SPNCNT_NONE; - else if (sys_strcmp(arg, "very_short") == 0) - db_spin_count = ERTS_DB_SPNCNT_VERY_LOW; - else if (sys_strcmp(arg, "short") == 0) - db_spin_count = ERTS_DB_SPNCNT_LOW; - else if (sys_strcmp(arg, "medium") == 0) - db_spin_count = ERTS_DB_SPNCNT_NORMAL; - else if (sys_strcmp(arg, "long") == 0) - db_spin_count = ERTS_DB_SPNCNT_HIGH; - else if (sys_strcmp(arg, "very_long") == 0) - db_spin_count = ERTS_DB_SPNCNT_VERY_HIGH; - else if (sys_strcmp(arg, "extremely_long") == 0) - db_spin_count = ERTS_DB_SPNCNT_EXTREMELY_HIGH; - else { - erts_fprintf(stderr, - "Invalid ets busy wait threshold: %s\n", arg); - erts_usage(); - } } else { erts_fprintf(stderr, "bad -z option %s\n", argv[i]); erts_usage(); @@ -2087,30 +1932,6 @@ i++; } - if (!erts_check_time_adj_support(time_correction, time_warp_mode)) { - char *time_correction_str = time_correction ? "Enabled" : "Disabled"; - char *time_warp_str = "undefined"; - switch (time_warp_mode) { - case ERTS_NO_TIME_WARP_MODE: - time_warp_str = "no"; - break; - case ERTS_SINGLE_TIME_WARP_MODE: - time_warp_str = "single"; - break; - case ERTS_MULTI_TIME_WARP_MODE: - time_warp_str = "multi"; - break; - default: - time_warp_str = "undefined"; - break; - } - erts_fprintf(stderr, "%s time correction with %s time warp mode " - "is not supported on this platform\n", - time_correction_str, - time_warp_str); - erts_usage(); - } - /* Output format on windows for sprintf defaults to three exponents. * We use two-exponent to mimic normal sprintf behaviour. */ @@ -2144,11 +1965,7 @@ legacy_proc_tab, port_tab_sz, port_tab_sz_ignore_files, - legacy_port_tab, - time_correction, - time_warp_mode, - node_tab_delete_delay, - db_spin_count); + legacy_port_tab); load_preloaded(); erts_end_staging_code_ix(); @@ -2156,8 +1973,7 @@ erts_initialized = 1; - (void) erl_first_process_otp("otp_ring0", NULL, 0, - boot_argc, boot_argv); + erl_first_process_otp("otp_ring0", NULL, 0, boot_argc, boot_argv); #ifdef ERTS_SMP erts_start_schedulers(); @@ -2165,17 +1981,13 @@ erts_sys_main_thread(); /* May or may not return! */ #else - { - ErtsSchedulerData *esdp = erts_get_scheduler_data(); - erts_thr_set_main_status(1, 1); + erts_thr_set_main_status(1, 1); #if ERTS_USE_ASYNC_READY_Q - esdp->aux_work_data.async_ready.queue - = erts_get_async_ready_queue(1); + erts_get_scheduler_data()->aux_work_data.async_ready.queue + = erts_get_async_ready_queue(1); #endif - set_main_stack_size(); - erts_sched_init_time_sup(esdp); - process_main(); - } + set_main_stack_size(); + process_main(); #endif } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_instrument.c erlang-17.3-dfsg/erts/emulator/beam/erl_instrument.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_instrument.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_instrument.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -1227,7 +1226,7 @@ mem_anchor = NULL; /* Install instrumentation functions */ - ERTS_CT_ASSERT(sizeof(erts_allctrs) == sizeof(real_allctrs)); + ASSERT(sizeof(erts_allctrs) == sizeof(real_allctrs)); sys_memcpy((void *)real_allctrs,(void *)erts_allctrs,sizeof(erts_allctrs)); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_instrument.h erlang-17.3-dfsg/erts/emulator/beam/erl_instrument.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_instrument.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_instrument.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_lock_check.c erlang-17.3-dfsg/erts/emulator/beam/erl_lock_check.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_lock_check.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_lock_check.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -92,7 +91,6 @@ { "driver_list", NULL }, { "proc_link", "pid" }, { "proc_msgq", "pid" }, - { "proc_btm", "pid" }, { "dist_entry", "address" }, { "dist_entry_links", "address" }, { "code_write_permission", NULL }, @@ -142,6 +140,7 @@ { "async_enq_mtx", NULL }, #ifdef ERTS_SMP { "atom_tab", NULL }, + { "make_ref", NULL }, { "misc_op_list_pre_alloc_lock", "address" }, { "message_pre_alloc_lock", "address" }, { "ptimer_pre_alloc_lock", "address", }, @@ -169,8 +168,6 @@ { "timer_wheel", NULL }, { "system_block", NULL }, { "timeofday", NULL }, - { "get_time", NULL }, - { "get_corrected_time", NULL }, { "breakpoints", NULL }, { "pollsets_lock", NULL }, { "pix_lock", "address" }, @@ -187,8 +184,10 @@ { "efile_drv dtrace mutex", NULL }, #endif { "mtrace_buf", NULL }, +#ifdef __WIN32__ #ifdef ERTS_SMP - { "os_monotonic_time", NULL }, + { "sys_gethrtime", NULL }, +#endif #endif { "erts_alloc_hard_debug", NULL }, { "hard_dbg_mseg", NULL }, diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_lock_check.h erlang-17.3-dfsg/erts/emulator/beam/erl_lock_check.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_lock_check.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_lock_check.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_lock_count.c erlang-17.3-dfsg/erts/emulator/beam/erl_lock_count.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_lock_count.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_lock_count.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -21,7 +20,7 @@ /* * Description: Statistics for locks. * - * Author: Björn-Egil Dahlberg + * Author: Björn-Egil Dahlberg * Date: 2008-07-03 */ @@ -50,7 +49,7 @@ static ethr_tsd_key lcnt_thr_data_key; static int lcnt_n_thr; -static erts_lcnt_thread_data_t *lcnt_thread_data[2048]; +static erts_lcnt_thread_data_t *lcnt_thread_data[4096]; /* local functions */ @@ -84,12 +83,12 @@ static char* lcnt_lock_type(Uint16 flag) { switch(flag & ERTS_LCNT_LT_ALL) { - case ERTS_LCNT_LT_SPINLOCK: return "spinlock"; - case ERTS_LCNT_LT_RWSPINLOCK: return "rw_spinlock"; - case ERTS_LCNT_LT_MUTEX: return "mutex"; - case ERTS_LCNT_LT_RWMUTEX: return "rw_mutex"; - case ERTS_LCNT_LT_PROCLOCK: return "proclock"; - default: return ""; + case ERTS_LCNT_LT_SPINLOCK: return "spinlock"; + case ERTS_LCNT_LT_RWSPINLOCK: return "rw_spinlock"; + case ERTS_LCNT_LT_MUTEX: return "mutex"; + case ERTS_LCNT_LT_RWMUTEX: return "rw_mutex"; + case ERTS_LCNT_LT_PROCLOCK: return "proclock"; + default: return ""; } } @@ -105,27 +104,31 @@ } static void lcnt_time(erts_lcnt_time_t *time) { - /* - * erts_sys_hrtime() is the highest resolution - * we could find, it may or may not be monotonic... - */ - ErtsMonotonicTime mtime = erts_sys_hrtime(); - time->s = (unsigned long) (mtime / 1000000000LL); - time->ns = (unsigned long) (mtime - 1000000000LL*time->s); +#if 0 || defined(HAVE_GETHRTIME) + SysHrTime hr_time; + hr_time = sys_gethrtime(); + time->s = (unsigned long)(hr_time / 1000000000LL); + time->ns = (unsigned long)(hr_time - 1000000000LL*time->s); +#else + SysTimeval tv; + sys_gettimeofday(&tv); + time->s = tv.tv_sec; + time->ns = tv.tv_usec*1000LL; +#endif } static void lcnt_time_diff(erts_lcnt_time_t *d, erts_lcnt_time_t *t1, erts_lcnt_time_t *t0) { long ds; long dns; - + ds = t1->s - t0->s; dns = t1->ns - t0->ns; - + /* the difference should not be able to get bigger than 1 sec in ns*/ - + if (dns < 0) { - ds -= 1; - dns += 1000000000LL; + ds -= 1; + dns += 1000000000LL; } ASSERT(ds >= 0); @@ -146,7 +149,7 @@ static erts_lcnt_thread_data_t *lcnt_thread_data_alloc(void) { erts_lcnt_thread_data_t *eltd; - + eltd = (erts_lcnt_thread_data_t*)malloc(sizeof(erts_lcnt_thread_data_t)); if (!eltd) { ERTS_INTERNAL_ERROR("Lock counter failed to allocate memory!"); @@ -165,6 +168,7 @@ return (erts_lcnt_thread_data_t *)ethr_tsd_get(lcnt_thr_data_key); } + /* debug */ #if 0 @@ -183,15 +187,15 @@ type = lcnt_lock_type(lock->flag); r_state = ethr_atomic_read(&lock->r_state); w_state = ethr_atomic_read(&lock->w_state); - + if (lock->flag & flag) { erts_fprintf(stderr,"%10s [%24s] [r/w state %4ld/%4ld] %2s id %T\r\n", - action, - lock->name, - r_state, - w_state, - type, - lock->id); + action, + lock->name, + r_state, + w_state, + type, + lock->id); } } #endif @@ -201,18 +205,18 @@ erts_lcnt_lock_stats_t *stats = NULL; if (erts_lcnt_rt_options & ERTS_LCNT_OPT_LOCATION) { - for (i = 0; i < lock->n_stats; i++) { - if ((lock->stats[i].file == file) && (lock->stats[i].line == line)) { - return &(lock->stats[i]); - } - } - if (lock->n_stats < ERTS_LCNT_MAX_LOCK_LOCATIONS) { - stats = &lock->stats[lock->n_stats]; - lock->n_stats++; - stats->file = file; - stats->line = line; - return stats; - } + for (i = 0; i < lock->n_stats; i++) { + if ((lock->stats[i].file == file) && (lock->stats[i].line == line)) { + return &(lock->stats[i]); + } + } + if (lock->n_stats < ERTS_LCNT_MAX_LOCK_LOCATIONS) { + stats = &lock->stats[lock->n_stats]; + lock->n_stats++; + stats->file = file; + stats->line = line; + return stats; + } } return &lock->stats[0]; } @@ -222,48 +226,53 @@ unsigned long r; if (time_wait->s > 0 || time_wait->ns > ERTS_LCNT_HISTOGRAM_MAX_NS) { - idx = ERTS_LCNT_HISTOGRAM_SLOT_SIZE - 1; + idx = ERTS_LCNT_HISTOGRAM_SLOT_SIZE - 1; } else { - r = time_wait->ns >> ERTS_LCNT_HISTOGRAM_RSHIFT; - if (r) idx = lcnt_log2(r); - else idx = 0; + r = time_wait->ns >> ERTS_LCNT_HISTOGRAM_RSHIFT; + if (r) idx = lcnt_log2(r); + else idx = 0; } hist->ns[idx]++; } static void lcnt_update_stats(erts_lcnt_lock_stats_t *stats, int lock_in_conflict, - erts_lcnt_time_t *time_wait) { - + erts_lcnt_time_t *time_wait) { + ethr_atomic_inc(&stats->tries); if (lock_in_conflict) - ethr_atomic_inc(&stats->colls); + ethr_atomic_inc(&stats->colls); if (time_wait) { - lcnt_time_add(&(stats->timer), time_wait); - stats->timer_n++; - lcnt_update_stats_hist(&stats->hist,time_wait); + lcnt_time_add(&(stats->timer), time_wait); + stats->timer_n++; + lcnt_update_stats_hist(&stats->hist,time_wait); } } -/* interface */ +/* + * interface + */ void erts_lcnt_init() { erts_lcnt_thread_data_t *eltd = NULL; - + /* init lock */ if (ethr_mutex_init(&lcnt_data_lock) != 0) abort(); /* init tsd */ lcnt_n_thr = 0; + ethr_tsd_key_create(&lcnt_thr_data_key,"lcnt_data"); lcnt_lock(); - erts_lcnt_rt_options = ERTS_LCNT_OPT_LOCATION | ERTS_LCNT_OPT_PROCLOCK; + erts_lcnt_rt_options = ERTS_LCNT_OPT_PROCLOCK | ERTS_LCNT_OPT_LOCATION; + eltd = lcnt_thread_data_alloc(); - ethr_tsd_set(lcnt_thr_data_key, eltd); + ethr_tsd_set(lcnt_thr_data_key, eltd); + /* init lcnt structure */ erts_lcnt_data = (erts_lcnt_data_t*)malloc(sizeof(erts_lcnt_data_t)); if (!erts_lcnt_data) { @@ -288,7 +297,7 @@ erts_lcnt_lock_list_t *erts_lcnt_list_init(void) { erts_lcnt_lock_list_t *list; - + list = (erts_lcnt_lock_list_t*)malloc(sizeof(erts_lcnt_lock_list_t)); if (!list) { ERTS_INTERNAL_ERROR("Lock counter failed to allocate memory!"); @@ -302,14 +311,14 @@ /* only do this on the list with the deleted locks! */ void erts_lcnt_list_clear(erts_lcnt_lock_list_t *list) { erts_lcnt_lock_t *lock = NULL, - *next = NULL; + *next = NULL; lock = list->head; - + while(lock != NULL) { - next = lock->next; - free(lock); - lock = next; + next = lock->next; + free(lock); + lock = next; } list->head = NULL; @@ -322,25 +331,26 @@ tail = list->tail; if (tail) { - tail->next = lock; - lock->prev = tail; + tail->next = lock; + lock->prev = tail; } else { - list->head = lock; - lock->prev = NULL; - ASSERT(!lock->next); + list->head = lock; + lock->prev = NULL; + ASSERT(!lock->next); } lock->next = NULL; list->tail = lock; - + list->n++; } void erts_lcnt_list_delete(erts_lcnt_lock_list_t *list, erts_lcnt_lock_t *lock) { + if (lock->next) lock->next->prev = lock->prev; if (lock->prev) lock->prev->next = lock->next; if (list->head == lock) list->head = lock->next; if (list->tail == lock) list->tail = lock->prev; - + lock->prev = NULL; lock->next = NULL; list->n--; @@ -358,9 +368,12 @@ void erts_lcnt_init_lock_x(erts_lcnt_lock_t *lock, char *name, Uint16 flag, Eterm id) { int i; - if (name == NULL) { ERTS_LCNT_CLEAR_FLAG(lock); return; } + if (!name) { + lock->flag = 0; + return; + } lcnt_lock(); - + lock->next = NULL; lock->prev = NULL; lock->flag = flag; @@ -369,55 +382,46 @@ ethr_atomic_init(&lock->r_state, 0); ethr_atomic_init(&lock->w_state, 0); + #ifdef DEBUG ethr_atomic_init(&lock->flowstate, 0); #endif - + lock->n_stats = 1; for (i = 0; i < ERTS_LCNT_MAX_LOCK_LOCATIONS; i++) { - lcnt_clear_stats(&lock->stats[i]); + lcnt_clear_stats(&lock->stats[i]); } erts_lcnt_list_insert(erts_lcnt_data->current_locks, lock); lcnt_unlock(); } -/* init empty, instead of zero struct */ -void erts_lcnt_init_lock_empty(erts_lcnt_lock_t *lock) { - lock->next = NULL; - lock->prev = NULL; - lock->flag = 0; - lock->name = NULL; - lock->id = NIL; - ethr_atomic_init(&lock->r_state, 0); - ethr_atomic_init(&lock->w_state, 0); -#ifdef DEBUG - ethr_atomic_init(&lock->flowstate, 0); -#endif - lock->n_stats = 0; - sys_memzero(lock->stats, sizeof(lock->stats)); -} -/* destroy lock */ + void erts_lcnt_destroy_lock(erts_lcnt_lock_t *lock) { - if (ERTS_LCNT_IS_LOCK_INVALID(lock)) return; + erts_lcnt_lock_t *deleted_lock; + + if (!ERTS_LCNT_LOCK_TYPE(lock)) return; + lcnt_lock(); if (erts_lcnt_rt_options & ERTS_LCNT_OPT_COPYSAVE) { - erts_lcnt_lock_t *deleted_lock; - /* copy structure and insert the copy */ - deleted_lock = (erts_lcnt_lock_t*)malloc(sizeof(erts_lcnt_lock_t)); + /* copy structure and insert the copy */ + + deleted_lock = (erts_lcnt_lock_t*)malloc(sizeof(erts_lcnt_lock_t)); if (!deleted_lock) { ERTS_INTERNAL_ERROR("Lock counter failed to allocate memory!"); } - memcpy(deleted_lock, lock, sizeof(erts_lcnt_lock_t)); - deleted_lock->next = NULL; - deleted_lock->prev = NULL; - erts_lcnt_list_insert(erts_lcnt_data->deleted_locks, deleted_lock); + memcpy(deleted_lock, lock, sizeof(erts_lcnt_lock_t)); + + deleted_lock->next = NULL; + deleted_lock->prev = NULL; + + erts_lcnt_list_insert(erts_lcnt_data->deleted_locks, deleted_lock); } /* delete original */ erts_lcnt_list_delete(erts_lcnt_data->current_locks, lock); - ERTS_LCNT_CLEAR_FLAG(lock); - + lock->flag = 0; + lcnt_unlock(); } @@ -426,15 +430,16 @@ void erts_lcnt_lock_opt(erts_lcnt_lock_t *lock, Uint16 option) { erts_aint_t r_state = 0, w_state = 0; erts_lcnt_thread_data_t *eltd; - + if (erts_lcnt_rt_options & ERTS_LCNT_OPT_SUSPEND) return; - if (ERTS_LCNT_IS_LOCK_INVALID(lock)) return; + if (!ERTS_LCNT_LOCK_TYPE(lock)) return; eltd = lcnt_get_thread_data(); - ASSERT(eltd); + ASSERT(eltd); + w_state = ethr_atomic_read(&lock->w_state); - + if (option & ERTS_LCNT_LO_WRITE) { r_state = ethr_atomic_read(&lock->r_state); ethr_atomic_inc( &lock->w_state); @@ -442,47 +447,48 @@ if (option & ERTS_LCNT_LO_READ) { ethr_atomic_inc( &lock->r_state); } - + /* we cannot acquire w_lock if either w or r are taken */ /* we cannot acquire r_lock if w_lock is taken */ - + if ((w_state > 0) || (r_state > 0)) { - eltd->lock_in_conflict = 1; - if (eltd->timer_set == 0) { - lcnt_time(&eltd->timer); - } - eltd->timer_set++; + eltd->lock_in_conflict = 1; + if (eltd->timer_set == 0) { + lcnt_time(&eltd->timer); + } + eltd->timer_set++; } else { - eltd->lock_in_conflict = 0; + eltd->lock_in_conflict = 0; } } void erts_lcnt_lock(erts_lcnt_lock_t *lock) { erts_aint_t w_state; erts_lcnt_thread_data_t *eltd; - + if (erts_lcnt_rt_options & ERTS_LCNT_OPT_SUSPEND) return; - if (ERTS_LCNT_IS_LOCK_INVALID(lock)) return; + if (!ERTS_LCNT_LOCK_TYPE(lock)) return; w_state = ethr_atomic_read(&lock->w_state); ethr_atomic_inc(&lock->w_state); + eltd = lcnt_get_thread_data(); ASSERT(eltd); if (w_state > 0) { - eltd->lock_in_conflict = 1; - /* only set the timer if nobody else has it - * This should only happen when proc_locks aquires several locks - * 'atomicly'. All other locks will block the thread if w_state > 0 - * i.e. locked. - */ - if (eltd->timer_set == 0) { - lcnt_time(&eltd->timer); - } - eltd->timer_set++; + eltd->lock_in_conflict = 1; + /* only set the timer if nobody else has it + * This should only happen when proc_locks aquires several locks + * 'atomicly'. All other locks will block the thread if w_state > 0 + * i.e. locked. + */ + if (eltd->timer_set == 0) { + lcnt_time(&eltd->timer); + } + eltd->timer_set++; } else { - eltd->lock_in_conflict = 0; + eltd->lock_in_conflict = 0; } } @@ -491,19 +497,16 @@ void erts_lcnt_lock_unaquire(erts_lcnt_lock_t *lock) { /* should check if this thread was "waiting" */ if (erts_lcnt_rt_options & ERTS_LCNT_OPT_SUSPEND) return; - if (ERTS_LCNT_IS_LOCK_INVALID(lock)) return; + if (!ERTS_LCNT_LOCK_TYPE(lock)) return; ethr_atomic_dec(&lock->w_state); } -/* - * erts_lcnt_lock_post - * - * Used when we get a lock (i.e. directly after a lock operation) +/* erts_lcnt_lock_post + * used when we get a lock (i.e. directly after a lock operation) * if the timer was set then we had to wait for the lock * lock_post will calculate the wait time. */ - void erts_lcnt_lock_post(erts_lcnt_lock_t *lock) { erts_lcnt_lock_post_x(lock, (char*)str_undefined, 0); } @@ -518,31 +521,31 @@ #endif if (erts_lcnt_rt_options & ERTS_LCNT_OPT_SUSPEND) return; - if (ERTS_LCNT_IS_LOCK_INVALID(lock)) return; - + if (!ERTS_LCNT_LOCK_TYPE(lock)) return; + #ifdef DEBUG if (!(lock->flag & (ERTS_LCNT_LT_RWMUTEX | ERTS_LCNT_LT_RWSPINLOCK))) { - flowstate = ethr_atomic_read(&lock->flowstate); - ASSERT(flowstate == 0); - ethr_atomic_inc(&lock->flowstate); + flowstate = ethr_atomic_read(&lock->flowstate); + ASSERT(flowstate == 0); + ethr_atomic_inc(&lock->flowstate); } #endif - + eltd = lcnt_get_thread_data(); - + ASSERT(eltd); /* if lock was in conflict, time it */ stats = lcnt_get_lock_stats(lock, file, line); if (eltd->timer_set) { - lcnt_time(&timer); - - lcnt_time_diff(&time_wait, &timer, &(eltd->timer)); - lcnt_update_stats(stats, eltd->lock_in_conflict, &time_wait); - eltd->timer_set--; - ASSERT(eltd->timer_set >= 0); + lcnt_time(&timer); + + lcnt_time_diff(&time_wait, &timer, &(eltd->timer)); + lcnt_update_stats(stats, eltd->lock_in_conflict, &time_wait); + eltd->timer_set--; + ASSERT(eltd->timer_set >= 0); } else { - lcnt_update_stats(stats, eltd->lock_in_conflict, NULL); + lcnt_update_stats(stats, eltd->lock_in_conflict, NULL); } } @@ -551,28 +554,27 @@ void erts_lcnt_unlock_opt(erts_lcnt_lock_t *lock, Uint16 option) { if (erts_lcnt_rt_options & ERTS_LCNT_OPT_SUSPEND) return; - if (ERTS_LCNT_IS_LOCK_INVALID(lock)) return; + if (!ERTS_LCNT_LOCK_TYPE(lock)) return; if (option & ERTS_LCNT_LO_WRITE) ethr_atomic_dec(&lock->w_state); if (option & ERTS_LCNT_LO_READ ) ethr_atomic_dec(&lock->r_state); } void erts_lcnt_unlock(erts_lcnt_lock_t *lock) { +#ifdef DEBUG + erts_aint_t w_state; + erts_aint_t flowstate; +#endif if (erts_lcnt_rt_options & ERTS_LCNT_OPT_SUSPEND) return; - if (ERTS_LCNT_IS_LOCK_INVALID(lock)) return; + if (!ERTS_LCNT_LOCK_TYPE(lock)) return; #ifdef DEBUG - { - erts_aint_t w_state; - erts_aint_t flowstate; - - /* flowstate */ - flowstate = ethr_atomic_read(&lock->flowstate); - ASSERT(flowstate == 1); - ethr_atomic_dec(&lock->flowstate); - - /* write state */ - w_state = ethr_atomic_read(&lock->w_state); - ASSERT(w_state > 0); - } + /* flowstate */ + flowstate = ethr_atomic_read(&lock->flowstate); + ASSERT(flowstate == 1); + ethr_atomic_dec(&lock->flowstate); + + /* write state */ + w_state = ethr_atomic_read(&lock->w_state); + ASSERT(w_state > 0); #endif ethr_atomic_dec(&lock->w_state); } @@ -581,34 +583,35 @@ void erts_lcnt_trylock_opt(erts_lcnt_lock_t *lock, int res, Uint16 option) { if (erts_lcnt_rt_options & ERTS_LCNT_OPT_SUSPEND) return; - if (ERTS_LCNT_IS_LOCK_INVALID(lock)) return; + if (!ERTS_LCNT_LOCK_TYPE(lock)) return; /* Determine lock_state via res instead of state */ if (res != EBUSY) { - if (option & ERTS_LCNT_LO_WRITE) ethr_atomic_inc(&lock->w_state); - if (option & ERTS_LCNT_LO_READ ) ethr_atomic_inc(&lock->r_state); - lcnt_update_stats(&(lock->stats[0]), 0, NULL); + if (option & ERTS_LCNT_LO_WRITE) ethr_atomic_inc(&lock->w_state); + if (option & ERTS_LCNT_LO_READ ) ethr_atomic_inc(&lock->r_state); + lcnt_update_stats(&(lock->stats[0]), 0, NULL); } else { ethr_atomic_inc(&lock->stats[0].tries); ethr_atomic_inc(&lock->stats[0].colls); } } - + void erts_lcnt_trylock(erts_lcnt_lock_t *lock, int res) { /* Determine lock_state via res instead of state */ +#ifdef DEBUG + erts_aint_t flowstate; +#endif if (erts_lcnt_rt_options & ERTS_LCNT_OPT_SUSPEND) return; - if (ERTS_LCNT_IS_LOCK_INVALID(lock)) return; + if (!ERTS_LCNT_LOCK_TYPE(lock)) return; if (res != EBUSY) { + #ifdef DEBUG - { - erts_aint_t flowstate; - flowstate = ethr_atomic_read(&lock->flowstate); - ASSERT(flowstate == 0); - ethr_atomic_inc( &lock->flowstate); - } + flowstate = ethr_atomic_read(&lock->flowstate); + ASSERT(flowstate == 0); + ethr_atomic_inc( &lock->flowstate); #endif - ethr_atomic_inc(&lock->w_state); - lcnt_update_stats(&(lock->stats[0]), 0, NULL); + ethr_atomic_inc(&lock->w_state); + lcnt_update_stats(&(lock->stats[0]), 0, NULL); } else { ethr_atomic_inc(&lock->stats[0].tries); ethr_atomic_inc(&lock->stats[0].colls); @@ -663,13 +666,13 @@ lcnt_lock(); list = erts_lcnt_data->current_locks; - + for (lock = list->head; lock != NULL; lock = lock->next) { - for( i = 0; i < ERTS_LCNT_MAX_LOCK_LOCATIONS; i++) { - stats = &lock->stats[i]; - lcnt_clear_stats(stats); - } - lock->n_stats = 1; + for( i = 0; i < ERTS_LCNT_MAX_LOCK_LOCATIONS; i++) { + stats = &lock->stats[i]; + lcnt_clear_stats(stats); + } + lock->n_stats = 1; } /* empty deleted locks in lock list */ @@ -682,14 +685,14 @@ erts_lcnt_data_t *erts_lcnt_get_data(void) { erts_lcnt_time_t timer_stop; - + lcnt_lock(); - + lcnt_time(&timer_stop); lcnt_time_diff(&(erts_lcnt_data->duration), &timer_stop, &timer_start); - + lcnt_unlock(); - + return erts_lcnt_data; } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_lock_count.h erlang-17.3-dfsg/erts/emulator/beam/erl_lock_count.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_lock_count.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_lock_count.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -21,7 +20,7 @@ /* * Description: Statistics for locks. * - * Author: Björn-Egil Dahlberg + * Author: Björn-Egil Dahlberg * Date: 2008-07-03 * Abstract: * Locks statistics internal representation. @@ -77,7 +76,7 @@ /* histogram */ #define ERTS_LCNT_HISTOGRAM_MAX_NS (((unsigned long)1LL << 28) - 1) -#if 0 || defined(ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT) +#if 0 || defined(HAVE_GETHRTIME) #define ERTS_LCNT_HISTOGRAM_SLOT_SIZE (30) #define ERTS_LCNT_HISTOGRAM_RSHIFT (0) #else @@ -96,35 +95,30 @@ #define ERTS_LCNT_LO_WRITE (((Uint16) 1) << 7) #define ERTS_LCNT_LO_READ_WRITE ( ERTS_LCNT_LO_READ \ - | ERTS_LCNT_LO_WRITE ) + | ERTS_LCNT_LO_WRITE ) #define ERTS_LCNT_LT_ALL ( ERTS_LCNT_LT_SPINLOCK \ - | ERTS_LCNT_LT_RWSPINLOCK \ - | ERTS_LCNT_LT_MUTEX \ - | ERTS_LCNT_LT_RWMUTEX \ - | ERTS_LCNT_LT_PROCLOCK ) - -#define ERTS_LCNT_LOCK_TYPE(lock) ((lock)->flag & ERTS_LCNT_LT_ALL) -#define ERTS_LCNT_IS_LOCK_INVALID(lock) (!((lock)->flag & ERTS_LCNT_LT_ALL)) -#define ERTS_LCNT_CLEAR_FLAG(lock) ((lock)->flag = 0) - + | ERTS_LCNT_LT_RWSPINLOCK \ + | ERTS_LCNT_LT_MUTEX \ + | ERTS_LCNT_LT_RWMUTEX \ + | ERTS_LCNT_LT_PROCLOCK ) /* runtime options */ -#define ERTS_LCNT_OPT_SUSPEND (((Uint16) 1) << 0) -#define ERTS_LCNT_OPT_LOCATION (((Uint16) 1) << 1) -#define ERTS_LCNT_OPT_PROCLOCK (((Uint16) 1) << 2) -#define ERTS_LCNT_OPT_PORTLOCK (((Uint16) 1) << 3) -#define ERTS_LCNT_OPT_COPYSAVE (((Uint16) 1) << 4) +#define ERTS_LCNT_OPT_SUSPEND (((Uint16) 1) << 0) +#define ERTS_LCNT_OPT_LOCATION (((Uint16) 1) << 1) +#define ERTS_LCNT_OPT_PROCLOCK (((Uint16) 1) << 2) +#define ERTS_LCNT_OPT_COPYSAVE (((Uint16) 1) << 3) +#define ERTS_LCNT_OPT_PORTLOCK (((Uint16) 1) << 4) typedef struct { unsigned long s; unsigned long ns; } erts_lcnt_time_t; - + extern erts_lcnt_time_t timer_start; typedef struct { - Uint32 ns[ERTS_LCNT_HISTOGRAM_SLOT_SIZE]; /* log2 array of nano seconds occurences */ + Uint32 ns[ERTS_LCNT_HISTOGRAM_SLOT_SIZE]; /* log2 array of nano seconds occurences */ } erts_lcnt_hist_t; typedef struct erts_lcnt_lock_stats_s { @@ -135,10 +129,10 @@ char *file; /* which file the lock was taken */ unsigned int line; /* line number in file */ - + ethr_atomic_t tries; /* n tries to get lock */ ethr_atomic_t colls; /* n collisions of tries to get lock */ - + unsigned long timer_n; /* #times waited for lock */ erts_lcnt_time_t timer; /* total wait time for lock */ erts_lcnt_hist_t hist; @@ -161,7 +155,7 @@ /* statistics */ unsigned int n_stats; erts_lcnt_lock_stats_t stats[ERTS_LCNT_MAX_LOCK_LOCATIONS]; /* first entry is "undefined"*/ - + /* chains for list handling */ /* data is hold by lcnt_lock */ struct erts_lcnt_lock_s *prev; @@ -173,7 +167,7 @@ erts_lcnt_lock_t *tail; unsigned long n; } erts_lcnt_lock_list_t; - + typedef struct { erts_lcnt_time_t duration; /* time since last clear */ erts_lcnt_lock_list_t *current_locks; @@ -211,7 +205,6 @@ /* lock operations (global) */ void erts_lcnt_init_lock(erts_lcnt_lock_t *lock, char *name, Uint16 flag); void erts_lcnt_init_lock_x(erts_lcnt_lock_t *lock, char *name, Uint16 flag, Eterm id); -void erts_lcnt_init_lock_empty(erts_lcnt_lock_t *lock); void erts_lcnt_destroy_lock(erts_lcnt_lock_t *lock); void erts_lcnt_lock(erts_lcnt_lock_t *lock); @@ -233,5 +226,7 @@ char *erts_lcnt_lock_type(Uint16 type); erts_lcnt_data_t *erts_lcnt_get_data(void); +#define ERTS_LCNT_LOCK_TYPE(lockp) ((lockp)->flag & ERTS_LCNT_LT_ALL) + #endif /* ifdef ERTS_ENABLE_LOCK_COUNT */ #endif /* ifndef ERTS_LOCK_COUNT_H__ */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_map.c erlang-17.3-dfsg/erts/emulator/beam/erl_map.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_map.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_map.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,23 +3,19 @@ * * Copyright Ericsson AB 2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * - * hashmaps are an adaption of Rich Hickeys Persistent HashMaps - * which were an adaption of Phil Bagwells - Hash Array Mapped Tries - * * Author: Björn-Egil Dahlberg */ @@ -32,10 +28,7 @@ #include "global.h" #include "erl_process.h" #include "error.h" -#define ERL_WANT_HIPE_BIF_WRAPPER__ #include "bif.h" -#undef ERL_WANT_HIPE_BIF_WRAPPER__ -#include "erl_binary.h" #include "erl_map.h" @@ -69,87 +62,39 @@ * - erts_internal:map_to_tuple_keys/1 */ -#ifndef DECL_AM -#define DECL_AM(S) Eterm AM_ ## S = am_atom_put(#S, sizeof(#S) - 1) -#endif - -/* for hashmap_from_list/1 */ -typedef struct { - Uint32 hx; - Uint32 skip; - Uint i; - Eterm val; -} hxnode_t; - - -static Eterm flatmap_merge(Process *p, Eterm nodeA, Eterm nodeB); -static BIF_RETTYPE map_merge_mixed(Process *p, Eterm flat, Eterm tree, int swap_args); -struct HashmapMergeContext_; -static BIF_RETTYPE hashmap_merge(Process *p, Eterm nodeA, Eterm nodeB, int swap_args, - struct HashmapMergeContext_*); -static Export hashmap_merge_trap_export; -static BIF_RETTYPE maps_merge_trap_1(BIF_ALIST_1); -static Uint hashmap_subtree_size(Eterm node); -static Eterm hashmap_to_list(Process *p, Eterm map); -static Eterm hashmap_keys(Process *p, Eterm map); -static Eterm hashmap_values(Process *p, Eterm map); -static Eterm hashmap_delete(Process *p, Uint32 hx, Eterm key, Eterm node); -static Eterm flatmap_from_validated_list(Process *p, Eterm list, Uint size); -static Eterm hashmap_from_validated_list(Process *p, Eterm list, Uint size); -static Eterm hashmap_from_unsorted_array(ErtsHeapFactory*, hxnode_t *hxns, Uint n, int reject_dupkeys); -static Eterm hashmap_from_sorted_unique_array(ErtsHeapFactory*, hxnode_t *hxns, Uint n, int is_root); -static Eterm hashmap_from_chunked_array(ErtsHeapFactory*, hxnode_t *hxns, Uint n, Uint size, int is_root); -static Eterm hashmap_info(Process *p, Eterm node); -static Eterm hashmap_bld_tuple_uint(Uint **hpp, Uint *szp, Uint n, Uint nums[]); -static int hxnodecmp(hxnode_t* a, hxnode_t* b); -static int hxnodecmpkey(hxnode_t* a, hxnode_t* b); - - -void erts_init_map(void) { - erts_init_trap_export(&hashmap_merge_trap_export, - am_maps, am_merge_trap, 1, - &maps_merge_trap_1); - return; -} - - /* erlang:map_size/1 * the corresponding instruction is implemented in: * beam/erl_bif_guard.c */ BIF_RETTYPE map_size_1(BIF_ALIST_1) { - if (is_flatmap(BIF_ARG_1)) { - flatmap_t *mp = (flatmap_t*)flatmap_val(BIF_ARG_1); - BIF_RET(make_small(flatmap_get_size(mp))); - } else if (is_hashmap(BIF_ARG_1)) { - Eterm *head, *hp, res; - Uint size, hsz=0; - - head = hashmap_val(BIF_ARG_1); - size = head[1]; - (void) erts_bld_uint(NULL, &hsz, size); + if (is_map(BIF_ARG_1)) { + Eterm *hp; + Uint hsz = 0; + map_t *mp = (map_t*)map_val(BIF_ARG_1); + Uint n = map_get_size(mp); + + erts_bld_uint(NULL, &hsz, n); hp = HAlloc(BIF_P, hsz); - res = erts_bld_uint(&hp, NULL, size); - BIF_RET(res); + BIF_RET(erts_bld_uint(&hp, NULL, n)); } - BIF_P->fvalue = BIF_ARG_1; - BIF_ERROR(BIF_P, BADMAP); + BIF_ERROR(BIF_P, BADARG); } -/* maps:to_list/1 */ +/* maps:to_list/1 + */ BIF_RETTYPE maps_to_list_1(BIF_ALIST_1) { - if (is_flatmap(BIF_ARG_1)) { + if (is_map(BIF_ARG_1)) { Uint n; Eterm* hp; Eterm *ks,*vs, res, tup; - flatmap_t *mp = (flatmap_t*)flatmap_val(BIF_ARG_1); + map_t *mp = (map_t*)map_val(BIF_ARG_1); - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); - n = flatmap_get_size(mp); + ks = map_get_keys(mp); + vs = map_get_values(mp); + n = map_get_size(mp); hp = HAlloc(BIF_P, (2 + 3) * n); res = NIL; @@ -159,101 +104,108 @@ } BIF_RET(res); - } else if (is_hashmap(BIF_ARG_1)) { - return hashmap_to_list(BIF_P, BIF_ARG_1); } - BIF_P->fvalue = BIF_ARG_1; - BIF_ERROR(BIF_P, BADMAP); + BIF_ERROR(BIF_P, BADARG); } /* maps:find/2 * return value if key *matches* a key in the map */ -const Eterm * -#if HALFWORD_HEAP -erts_maps_get_rel(Eterm key, Eterm map, Eterm *map_base) -#else -erts_maps_get(Eterm key, Eterm map) -#endif -{ - Uint32 hx; - if (is_flatmap_rel(map, map_base)) { - Eterm *ks, *vs; - flatmap_t *mp; - Uint n, i; - - mp = (flatmap_t *)flatmap_val_rel(map, map_base); - n = flatmap_get_size(mp); - - if (n == 0) { - return NULL; - } - - ks = (Eterm *)tuple_val_rel(mp->keys, map_base) + 1; - vs = flatmap_get_values(mp); - - if (is_immed(key)) { - for (i = 0; i < n; i++) { - if (ks[i] == key) { - return &vs[i]; - } - } - } +int erts_maps_find(Eterm key, Eterm map, Eterm *value) { - for (i = 0; i < n; i++) { - if (eq_rel(ks[i], map_base, key, NULL)) { - return &vs[i]; - } + Eterm *ks,*vs; + map_t *mp; + Uint n,i; + + mp = (map_t*)map_val(map); + n = map_get_size(mp); + ks = map_get_keys(mp); + vs = map_get_values(mp); + + for( i = 0; i < n; i++) { + if (EQ(ks[i], key)) { + *value = vs[i]; + return 1; } - return NULL; } - ASSERT(is_hashmap_rel(map, map_base)); - hx = hashmap_make_hash(key); - - return erts_hashmap_get_rel(hx, key, map, map_base); + return 0; } BIF_RETTYPE maps_find_2(BIF_ALIST_2) { if (is_map(BIF_ARG_2)) { - Eterm *hp, res; - const Eterm *value; + Eterm *hp, value,res; - value = erts_maps_get(BIF_ARG_1, BIF_ARG_2); - if (value) { + if (erts_maps_find(BIF_ARG_1, BIF_ARG_2, &value)) { hp = HAlloc(BIF_P, 3); res = make_tuple(hp); *hp++ = make_arityval(2); *hp++ = am_ok; - *hp++ = *value; + *hp++ = value; BIF_RET(res); } + BIF_RET(am_error); } - BIF_P->fvalue = BIF_ARG_2; - BIF_ERROR(BIF_P, BADMAP); + BIF_ERROR(BIF_P, BADARG); } - /* maps:get/2 * return value if key *matches* a key in the map - * exception badkey if none matches + * exception bad_key if none matches */ + +int erts_maps_get(Eterm key, Eterm map, Eterm *value) { + Eterm *ks,*vs; + map_t *mp; + Uint n,i; + + mp = (map_t*)map_val(map); + n = map_get_size(mp); + + if (n == 0) + return 0; + + ks = map_get_keys(mp); + vs = map_get_values(mp); + + if (is_immed(key)) { + for( i = 0; i < n; i++) { + if (ks[i] == key) { + *value = vs[i]; + return 1; + } + } + } + + for( i = 0; i < n; i++) { + if (EQ(ks[i], key)) { + *value = vs[i]; + return 1; + } + } + return 0; +} + BIF_RETTYPE maps_get_2(BIF_ALIST_2) { if (is_map(BIF_ARG_2)) { - const Eterm *value; + Eterm *hp; + Eterm value, error; + char *s_error; - value = erts_maps_get(BIF_ARG_1, BIF_ARG_2); - if (value) { - BIF_RET(*value); + if (erts_maps_get(BIF_ARG_1, BIF_ARG_2, &value)) { + BIF_RET(value); } - BIF_P->fvalue = BIF_ARG_1; - BIF_ERROR(BIF_P, BADKEY); + s_error = "bad_key"; + error = am_atom_put(s_error, sys_strlen(s_error)); + + hp = HAlloc(BIF_P, 3); + BIF_P->fvalue = TUPLE2(hp, error, BIF_ARG_1); + BIF_ERROR(BIF_P, EXC_ERROR_2); } - BIF_P->fvalue = BIF_ARG_2; - BIF_ERROR(BIF_P, BADMAP); + BIF_ERROR(BIF_P, BADARG); } /* maps:from_list/1 @@ -261,8 +213,13 @@ */ BIF_RETTYPE maps_from_list_1(BIF_ALIST_1) { - Eterm item = BIF_ARG_1, res, *kv; - Uint size = 0; + Eterm *kv, item = BIF_ARG_1; + Eterm *hp, *thp,*vs, *ks, keys, res; + map_t *mp; + Uint size = 0, unused_size = 0; + Sint c = 0; + Sint idx = 0; + if (is_list(item) || is_nil(item)) { /* Calculate size and check validity */ @@ -283,1365 +240,486 @@ if (is_not_nil(item)) goto error; - if (size > MAP_SMALL_MAP_LIMIT) { - BIF_RET(hashmap_from_validated_list(BIF_P, BIF_ARG_1, size)); - } else { - BIF_RET(flatmap_from_validated_list(BIF_P, BIF_ARG_1, size)); - } - } + hp = HAlloc(BIF_P, 3 + 1 + (2 * size)); + thp = hp; + keys = make_tuple(hp); + *hp++ = make_arityval(size); + ks = hp; + hp += size; + mp = (map_t*)hp; + res = make_map(mp); + hp += MAP_HEADER_SIZE; + vs = hp; -error: + mp->thing_word = MAP_HEADER; + mp->size = size; /* set later, might shrink*/ + mp->keys = keys; - BIF_ERROR(BIF_P, BADARG); -} + if (size == 0) + BIF_RET(res); -static Eterm flatmap_from_validated_list(Process *p, Eterm list, Uint size) { - Eterm *kv, item = list; - Eterm *hp, *thp,*vs, *ks, keys, res; - flatmap_t *mp; - Uint unused_size = 0; - Sint c = 0; - Sint idx = 0; + item = BIF_ARG_1; + /* first entry */ + kv = tuple_val(CAR(list_val(item))); + ks[0] = kv[1]; + vs[0] = kv[2]; + size = 1; + item = CDR(list_val(item)); - hp = HAlloc(p, 3 + 1 + (2 * size)); - thp = hp; - keys = make_tuple(hp); - *hp++ = make_arityval(size); - ks = hp; - hp += size; - mp = (flatmap_t*)hp; - res = make_flatmap(mp); - hp += MAP_HEADER_FLATMAP_SZ; - vs = hp; - - mp->thing_word = MAP_HEADER_FLATMAP; - mp->size = size; /* set later, might shrink*/ - mp->keys = keys; + /* insert sort key/value pairs */ + while(is_list(item)) { - if (size == 0) - return res; + kv = tuple_val(CAR(list_val(item))); - /* first entry */ - kv = tuple_val(CAR(list_val(item))); - ks[0] = kv[1]; - vs[0] = kv[2]; - size = 1; - item = CDR(list_val(item)); - - /* insert sort key/value pairs */ - while(is_list(item)) { - - kv = tuple_val(CAR(list_val(item))); - - /* compare ks backwards - * idx represent word index to be written (hole position). - * We cannot copy the elements when searching since we might - * have an equal key. So we search for just the index first =( - * - * It is perhaps faster to move the values in the first pass. - * Check for uniqueness during insert phase and then have a - * second phace compacting the map if duplicates are found - * during insert. .. or do someother sort .. shell-sort perhaps. - */ + /* compare ks backwards + * idx represent word index to be written (hole position). + * We cannot copy the elements when searching since we might + * have an equal key. So we search for just the index first =( + * + * It is perhaps faster to move the values in the first pass. + * Check for uniqueness during insert phase and then have a + * second phace compacting the map if duplicates are found + * during insert. .. or do someother sort .. shell-sort perhaps. + */ - idx = size; + idx = size; - while(idx > 0 && (c = CMP_TERM(kv[1],ks[idx-1])) < 0) { idx--; } + while(idx > 0 && (c = CMP_TERM(kv[1],ks[idx-1])) < 0) { idx--; } - if (c == 0) { - /* last compare was equal, - * i.e. we have to release memory - * and overwrite that key/value - */ - ks[idx-1] = kv[1]; - vs[idx-1] = kv[2]; - unused_size++; - } else { - Uint i = size; - while(i > idx) { - ks[i] = ks[i-1]; - vs[i] = vs[i-1]; - i--; + if (c == 0) { + /* last compare was equal, + * i.e. we have to release memory + * and overwrite that key/value + */ + ks[idx-1] = kv[1]; + vs[idx-1] = kv[2]; + unused_size++; + } else { + Uint i = size; + while(i > idx) { + ks[i] = ks[i-1]; + vs[i] = vs[i-1]; + i--; + } + ks[idx] = kv[1]; + vs[idx] = kv[2]; + size++; } - ks[idx] = kv[1]; - vs[idx] = kv[2]; - size++; + item = CDR(list_val(item)); } - item = CDR(list_val(item)); - } - if (unused_size) { - /* the key tuple is embedded in the heap - * write a bignum to clear it. - */ - /* release values as normal since they are on the top of the heap */ + if (unused_size) { + /* the key tuple is embedded in the heap + * write a bignum to clear it. + */ + /* release values as normal since they are on the top of the heap */ + + ks[size] = make_pos_bignum_header(unused_size - 1); + HRelease(BIF_P, vs + size + unused_size, vs + size); + } - ks[size] = make_pos_bignum_header(unused_size - 1); - HRelease(p, vs + size + unused_size, vs + size); + *thp = make_arityval(size); + mp->size = size; + BIF_RET(res); } - *thp = make_arityval(size); - mp->size = size; - return res; -} +error: -#define swizzle32(D,S) \ - do { \ - (D) = ((S) & 0x0000000f) << 28 | ((S) & 0x000000f0) << 20 \ - | ((S) & 0x00000f00) << 12 | ((S) & 0x0000f000) << 4 \ - | ((S) & 0x000f0000) >> 4 | ((S) & 0x00f00000) >> 12 \ - | ((S) & 0x0f000000) >> 20 | ((S) & 0xf0000000) >> 28; \ - } while(0) - -#define maskval(V,L) (((V) >> ((7 - (L))*4)) & 0xf) -#define cdepth(V1,V2) (hashmap_clz((V1) ^ (V2)) >> 2) - -static Eterm hashmap_from_validated_list(Process *p, Eterm list, Uint size) { - Eterm item = list; - Eterm *hp; - Eterm *kv, res; - Uint32 sw, hx; - Uint ix = 0; - hxnode_t *hxns; - ErtsHeapFactory factory; - DeclareTmpHeap(tmp,2,p); - ASSERT(size > 0); - - hp = HAlloc(p, (2 * size)); - - /* create tmp hx values and leaf ptrs */ - hxns = (hxnode_t *)erts_alloc(ERTS_ALC_T_TMP, size * sizeof(hxnode_t)); - - UseTmpHeap(2,p); - while(is_list(item)) { - res = CAR(list_val(item)); - kv = tuple_val(res); - hx = hashmap_restore_hash(tmp,0,kv[1]); - swizzle32(sw,hx); - hxns[ix].hx = sw; - hxns[ix].val = CONS(hp, kv[1], kv[2]); hp += 2; - hxns[ix].skip = 1; /* will be reassigned in from_array */ - hxns[ix].i = ix; - ix++; - item = CDR(list_val(item)); - } - UnUseTmpHeap(2,p); - - erts_factory_proc_init(&factory, p); - res = hashmap_from_unsorted_array(&factory, hxns, size, 0); - erts_factory_close(&factory); - - erts_free(ERTS_ALC_T_TMP, (void *) hxns); - ERTS_VERIFY_UNUSED_TEMP_ALLOC(p); - - if (hashmap_size(res) <= MAP_SMALL_MAP_LIMIT) { - DECLARE_WSTACK(wstack); - Eterm *kv, *ks, *vs; - flatmap_t *mp; - Eterm keys; - Uint n = hashmap_size(res); + BIF_ERROR(BIF_P, BADARG); +} - /* build flat structure */ - hp = HAlloc(p, 3 + 1 + (2 * n)); - keys = make_tuple(hp); - *hp++ = make_arityval(n); - ks = hp; - hp += n; - mp = (flatmap_t*)hp; - hp += MAP_HEADER_FLATMAP_SZ; - vs = hp; +/* maps:is_key/2 + */ - mp->thing_word = MAP_HEADER_FLATMAP; - mp->size = n; - mp->keys = keys; +BIF_RETTYPE maps_is_key_2(BIF_ALIST_2) { + if (is_map(BIF_ARG_2)) { + Eterm *ks, key; + map_t *mp; + Uint n,i; + + mp = (map_t*)map_val(BIF_ARG_2); + key = BIF_ARG_1; + n = map_get_size(mp); + ks = map_get_keys(mp); - hashmap_iterator_init(&wstack, res, 0); + if (n == 0) + BIF_RET(am_false); - while ((kv=hashmap_iterator_next(&wstack)) != NULL) { - *ks++ = CAR(kv); - *vs++ = CDR(kv); + if (is_immed(key)) { + for( i = 0; i < n; i++) { + if (ks[i] == key) { + BIF_RET(am_true); + } + } } - /* it cannot have multiple keys */ - erts_validate_and_sort_flatmap(mp); - - DESTROY_WSTACK(wstack); - return make_flatmap(mp); + for( i = 0; i < n; i++) { + if (EQ(ks[i], key)) { + BIF_RET(am_true); + } + } + BIF_RET(am_false); } - - return res; + BIF_ERROR(BIF_P, BADARG); } -Eterm erts_hashmap_from_array(ErtsHeapFactory* factory, Eterm *leafs, Uint n, - int reject_dupkeys) { - Uint32 sw, hx; - Uint ix; - hxnode_t *hxns; - Eterm res; - - /* create tmp hx values and leaf ptrs */ - hxns = (hxnode_t *)erts_alloc(ERTS_ALC_T_TMP, n * sizeof(hxnode_t)); - - for (ix = 0; ix < n; ix++) { - hx = hashmap_make_hash(*leafs); - swizzle32(sw,hx); - hxns[ix].hx = sw; - hxns[ix].val = make_list(leafs); - hxns[ix].skip = 1; - hxns[ix].i = ix; - leafs += 2; - } - - res = hashmap_from_unsorted_array(factory, hxns, n, reject_dupkeys); +/* maps:keys/1 + */ - erts_free(ERTS_ALC_T_TMP, (void *) hxns); +BIF_RETTYPE maps_keys_1(BIF_ALIST_1) { + if (is_map(BIF_ARG_1)) { + Eterm *hp, *ks, res = NIL; + map_t *mp; + Uint n; - return res; -} + mp = (map_t*)map_val(BIF_ARG_1); + n = map_get_size(mp); + if (n == 0) + BIF_RET(res); -Eterm erts_hashmap_from_ks_and_vs_extra(Process *p, Eterm *ks, Eterm *vs, Uint n, - Eterm key, Eterm value) { - Uint32 sw, hx; - Uint i,sz; - hxnode_t *hxns; - ErtsHeapFactory factory; - Eterm *hp, res; - - sz = (key == THE_NON_VALUE) ? n : (n + 1); - ASSERT(sz > MAP_SMALL_MAP_LIMIT); - hp = HAlloc(p, 2 * sz); - - /* create tmp hx values and leaf ptrs */ - hxns = (hxnode_t *)erts_alloc(ERTS_ALC_T_TMP, sz * sizeof(hxnode_t)); - - for(i = 0; i < n; i++) { - hx = hashmap_make_hash(ks[i]); - swizzle32(sw,hx); - hxns[i].hx = sw; - hxns[i].val = CONS(hp, ks[i], vs[i]); hp += 2; - hxns[i].skip = 1; /* will be reassigned in from_array */ - hxns[i].i = i; - } - - if (key != THE_NON_VALUE) { - hx = hashmap_make_hash(key); - swizzle32(sw,hx); - hxns[i].hx = sw; - hxns[i].val = CONS(hp, key, value); hp += 2; - hxns[i].skip = 1; - hxns[i].i = i; - } - - erts_factory_proc_init(&factory, p); - res = hashmap_from_unsorted_array(&factory, hxns, sz, 0); - erts_factory_close(&factory); + hp = HAlloc(BIF_P, (2 * n)); + ks = map_get_keys(mp); - erts_free(ERTS_ALC_T_TMP, (void *) hxns); - ERTS_VERIFY_UNUSED_TEMP_ALLOC(p); + while(n--) { + res = CONS(hp, ks[n], res); hp += 2; + } - return res; + BIF_RET(res); + } + BIF_ERROR(BIF_P, BADARG); } +/* maps:merge/2 + */ -static Eterm hashmap_from_unsorted_array(ErtsHeapFactory* factory, - hxnode_t *hxns, Uint n, - int reject_dupkeys) { - Uint jx = 0, ix = 0, lx, cx; - Eterm res; - - if (n == 0) { - Eterm *hp; - hp = erts_produce_heap(factory, 2, 0); - hp[0] = MAP_HEADER_HAMT_HEAD_BITMAP(0); - hp[1] = 0; +BIF_RETTYPE maps_merge_2(BIF_ALIST_2) { + if (is_map(BIF_ARG_1) && is_map(BIF_ARG_2)) { + Eterm *hp,*thp; + Eterm tup; + Eterm *ks,*vs,*ks1,*vs1,*ks2,*vs2; + map_t *mp1,*mp2,*mp_new; + Uint n1,n2,i1,i2,need,unused_size=0; + int c = 0; + + mp1 = (map_t*)map_val(BIF_ARG_1); + mp2 = (map_t*)map_val(BIF_ARG_2); + n1 = map_get_size(mp1); + n2 = map_get_size(mp2); - return make_hashmap(hp); - } + need = MAP_HEADER_SIZE + 1 + 2*(n1 + n2); - /* sort and compact array (remove non-unique entries) */ - qsort(hxns, n, sizeof(hxnode_t), (int (*)(const void *, const void *)) hxnodecmp); + hp = HAlloc(BIF_P, need); + thp = hp; + tup = make_tuple(thp); + ks = hp + 1; hp += 1 + n1 + n2; + mp_new = (map_t*)hp; hp += MAP_HEADER_SIZE; + vs = hp; hp += n1 + n2; + + mp_new->thing_word = MAP_HEADER; + mp_new->size = 0; + mp_new->keys = tup; + + i1 = 0; i2 = 0; + ks1 = map_get_keys(mp1); + vs1 = map_get_values(mp1); + ks2 = map_get_keys(mp2); + vs2 = map_get_values(mp2); + + while(i1 < n1 && i2 < n2) { + c = CMP_TERM(ks1[i1],ks2[i2]); + if ( c == 0) { + /* use righthand side arguments map value, + * but advance both maps */ + *ks++ = ks2[i2]; + *vs++ = vs2[i2]; + i1++, i2++, unused_size++; + } else if ( c < 0) { + *ks++ = ks1[i1]; + *vs++ = vs1[i1]; + i1++; + } else { + *ks++ = ks2[i2]; + *vs++ = vs2[i2]; + i2++; + } + } - ix = 0, cx = 0; - while(ix < n - 1) { - if (hxns[ix].hx == hxns[ix+1].hx) { + /* copy remaining */ + while (i1 < n1) { + *ks++ = ks1[i1]; + *vs++ = vs1[i1]; + i1++; + } - /* find region of equal hash values */ - jx = ix + 1; - while(jx < n && hxns[ix].hx == hxns[jx].hx) { jx++; } - /* find all correct keys from region - * (last in list but now hash sorted so we check highest id instead) */ + while (i2 < n2) { + *ks++ = ks2[i2]; + *vs++ = vs2[i2]; + i2++; + } - /* resort with keys instead of hash value within region */ + if (unused_size) { + /* the key tuple is embedded in the heap, write a bignum to clear it. + * + * release values as normal since they are on the top of the heap + * size = n1 + n1 - unused_size + */ - qsort(&hxns[ix], jx - ix, sizeof(hxnode_t), - (int (*)(const void *, const void *)) hxnodecmpkey); + *ks = make_pos_bignum_header(unused_size - 1); + HRelease(BIF_P, vs + unused_size, vs); + } - while(ix < jx) { - lx = ix; - while(++ix < jx && EQ(CAR(list_val(hxns[ix].val)), - CAR(list_val(hxns[lx].val)))) { - if (reject_dupkeys) - return THE_NON_VALUE; + mp_new->size = n1 + n2 - unused_size; + *thp = make_arityval(n1 + n2 - unused_size); - if (hxns[ix].i > hxns[lx].i) { - lx = ix; - } - } - hxns[cx].hx = hxns[lx].hx; - hxns[cx].val = hxns[lx].val; - cx++; - } - ix = jx; - continue; - } - if (ix > cx) { - hxns[cx].hx = hxns[ix].hx; - hxns[cx].val = hxns[ix].val; - } - cx++; - ix++; + BIF_RET(make_map(mp_new)); } + BIF_ERROR(BIF_P, BADARG); +} +/* maps:new/2 + */ - if (ix < n) { - hxns[cx].hx = hxns[ix].hx; - hxns[cx].val = hxns[ix].val; - cx++; - } +BIF_RETTYPE maps_new_0(BIF_ALIST_0) { + Eterm* hp; + Eterm tup; + map_t *mp; - if (cx > 1) { - /* recursive decompose array */ - res = hashmap_from_sorted_unique_array(factory, hxns, cx, 0); - } else { - Eterm *hp; + hp = HAlloc(BIF_P, (MAP_HEADER_SIZE + 1)); + tup = make_tuple(hp); + *hp++ = make_arityval(0); - /* we only have one item, either because n was 1 or - * because we hade multiples of the same key. - * - * hash value has been swizzled, need to drag it down to get the - * correct slot. */ - - hp = erts_produce_heap(factory, HAMT_HEAD_BITMAP_SZ(1), 0); - hp[0] = MAP_HEADER_HAMT_HEAD_BITMAP(1 << ((hxns[0].hx >> 0x1c) & 0xf)); - hp[1] = 1; - hp[2] = hxns[0].val; - res = make_hashmap(hp); - } + mp = (map_t*)hp; + mp->thing_word = MAP_HEADER; + mp->size = 0; + mp->keys = tup; - return res; + BIF_RET(make_map(mp)); } -static Eterm hashmap_from_sorted_unique_array(ErtsHeapFactory* factory, - hxnode_t *hxns, Uint n, int lvl) { - Eterm res = NIL; - Uint i,ix,jx,elems; - Uint32 sw, hx; - Eterm val; - hxnode_t *tmp; - DeclareTmpHeapNoproc(th,2); - UseTmpHeapNoproc(2); - ASSERT(lvl < 32); - ix = 0; - elems = 1; - while (ix < n - 1) { - if (hxns[ix].hx == hxns[ix+1].hx) { - jx = ix + 1; - while (jx < n && hxns[ix].hx == hxns[jx].hx) { jx++; } - tmp = (hxnode_t *)erts_alloc(ERTS_ALC_T_TMP, ((jx - ix)) * sizeof(hxnode_t)); - - for(i = 0; i < jx - ix; i++) { - val = hxns[i + ix].val; - hx = hashmap_restore_hash(th, lvl + 8, CAR(list_val(val))); - swizzle32(sw,hx); - tmp[i].hx = sw; - tmp[i].val = val; - tmp[i].i = i; - tmp[i].skip = 1; - } - - qsort(tmp, jx - ix, sizeof(hxnode_t), (int (*)(const void *, const void *)) hxnodecmp); - - hxns[ix].skip = jx - ix; - hxns[ix].val = hashmap_from_sorted_unique_array(factory, tmp, jx - ix, lvl + 8); - erts_free(ERTS_ALC_T_TMP, (void *) tmp); - ix = jx; - if (ix < n) { elems++; } - continue; - } - hxns[ix].skip = 1; - elems++; - ix++; - } +/* maps:put/3 + */ - res = hashmap_from_chunked_array(factory, hxns, elems, n, !lvl); +Eterm erts_maps_put(Process *p, Eterm key, Eterm value, Eterm map) { + Sint n,i; + Sint c = 0; + Eterm* hp, *shp; + Eterm *ks,*vs, res, tup; + map_t *mp = (map_t*)map_val(map); - ERTS_FACTORY_HOLE_CHECK(factory); + n = map_get_size(mp); - UnUseTmpHeapNoproc(2); - return res; -} + if (n == 0) { + hp = HAlloc(p, MAP_HEADER_SIZE + 1 + 2); + tup = make_tuple(hp); + *hp++ = make_arityval(1); + *hp++ = key; + res = make_map(hp); + *hp++ = MAP_HEADER; + *hp++ = 1; + *hp++ = tup; + *hp++ = value; -#define HALLOC_EXTRA 200 -static Eterm hashmap_from_chunked_array(ErtsHeapFactory *factory, hxnode_t *hxns, Uint n, - Uint size, int is_root) { - Uint ix, d, dn, dc, slot, elems; - Uint32 v, vp, vn, hdr; - Uint bp, sz; - DECLARE_ESTACK(stack); - Eterm res = NIL, *hp = NULL, *nhp; + return res; + } + ks = map_get_keys(mp); + vs = map_get_values(mp); - /* if we get here with only one element then - * we have eight levels of collisions + /* only allocate for values, + * assume key-tuple will be intact */ - if (n == 1) { - res = hxns[0].val; - v = hxns[0].hx; - for (d = 7; d > 0; d--) { - slot = maskval(v,d); - hp = erts_produce_heap(factory, HAMT_NODE_BITMAP_SZ(1), HALLOC_EXTRA); - hp[0] = MAP_HEADER_HAMT_NODE_BITMAP(1 << slot); - hp[1] = res; - res = make_hashmap(hp); - } - - slot = maskval(v,0); - hp = erts_produce_heap(factory, (is_root ? 3 : 2), 0); - - if (is_root) { - hp[0] = MAP_HEADER_HAMT_HEAD_BITMAP(1 << slot); - hp[1] = size; - hp[2] = res; - } else { - hp[0] = MAP_HEADER_HAMT_NODE_BITMAP(1 << slot); - hp[1] = res; + hp = HAlloc(p, MAP_HEADER_SIZE + n); + shp = hp; /* save hp, used if optimistic update fails */ + res = make_map(hp); + *hp++ = MAP_HEADER; + *hp++ = n; + *hp++ = mp->keys; + + if (is_immed(key)) { + for( i = 0; i < n; i ++) { + if (ks[i] == key) { + *hp++ = value; + vs++; + c = 1; + } else { + *hp++ = *vs++; + } + } + } else { + for( i = 0; i < n; i ++) { + if (EQ(ks[i], key)) { + *hp++ = value; + vs++; + c = 1; + } else { + *hp++ = *vs++; + } } - return make_hashmap(hp); } - /* push initial nodes on the stack, - * this is the starting depth */ + if (c) + return res; - ix = 0; - d = 0; - vp = hxns[ix].hx; - v = hxns[ix + hxns[ix].skip].hx; + /* need to make a new tuple, + * use old hp since it needs to be recreated anyway. + */ + tup = make_tuple(shp); + *shp++ = make_arityval(n+1); - ASSERT(vp > v); - slot = maskval(vp,d); + hp = HAlloc(p, 3 + n + 1); + res = make_map(hp); + *hp++ = MAP_HEADER; + *hp++ = n + 1; + *hp++ = tup; - while(slot == maskval(v,d)) { - ESTACK_PUSH(stack, 1 << slot); - d++; - slot = maskval(vp,d); - } + ks = map_get_keys(mp); + vs = map_get_values(mp); - res = hxns[ix].val; + ASSERT(n >= 0); - if (hxns[ix].skip > 1) { - dc = 7; - /* build collision nodes */ - while (dc > d) { - hp = erts_produce_heap(factory, HAMT_NODE_BITMAP_SZ(1), HALLOC_EXTRA); - hp[0] = MAP_HEADER_HAMT_NODE_BITMAP(1 << maskval(vp,dc)); - hp[1] = res; - res = make_hashmap(hp); - dc--; - } + /* copy map in order */ + while (n && ((c = CMP_TERM(*ks, key)) < 0)) { + *shp++ = *ks++; + *hp++ = *vs++; + n--; } - ESTACK_PUSH2(stack,res,1 << slot); + *shp++ = key; + *hp++ = value; - /* all of the other nodes .. */ - elems = n - 2; /* remove first and last elements */ - while(elems--) { - hdr = ESTACK_POP(stack); - ix = ix + hxns[ix].skip; + ASSERT(n >= 0); - /* determine if node or subtree should be built by looking - * at the next value. */ + while(n--) { + *shp++ = *ks++; + *hp++ = *vs++; + } + /* we have one word remaining + * this will work out fine once we get the size word + * in the header. + */ + *shp = make_pos_bignum_header(0); + return res; +} - vn = hxns[ix + hxns[ix].skip].hx; - dn = cdepth(v,vn); - ASSERT(v > vn); +BIF_RETTYPE maps_put_3(BIF_ALIST_3) { + if (is_map(BIF_ARG_3)) { + BIF_RET(erts_maps_put(BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3)); + } + BIF_ERROR(BIF_P, BADARG); +} - res = hxns[ix].val; +/* maps:remove/3 + */ - if (hxns[ix].skip > 1) { - int wat = (d > dn) ? d : dn; - dc = 7; - /* build collision nodes */ - while (dc > wat) { - hp = erts_produce_heap(factory, HAMT_NODE_BITMAP_SZ(1), HALLOC_EXTRA); - hp[0] = MAP_HEADER_HAMT_NODE_BITMAP(1 << maskval(v,dc)); - hp[1] = res; - res = make_hashmap(hp); - dc--; - } - } +int erts_maps_remove(Process *p, Eterm key, Eterm map, Eterm *res) { + Sint n; + Uint need; + Eterm *hp_start; + Eterm *thp, *mhp; + Eterm *ks, *vs, tup; + map_t *mp = (map_t*)map_val(map); - /* next depth is higher (implies collision) */ - if (d < dn) { - /* hdr is the popped one initially */ - while(d < dn) { - slot = maskval(v, d); - bp = 1 << slot; - ESTACK_PUSH(stack, hdr | bp); - d++; - hdr = 0; /* clear hdr for all other collisions */ - } + n = map_get_size(mp); - slot = maskval(v, d); - bp = 1 << slot; - /* no more collisions */ - ESTACK_PUSH2(stack,res,bp); - } else if (d == dn) { - /* no collisions at all */ - slot = maskval(v, d); - bp = 1 << slot; - ESTACK_PUSH2(stack,res,hdr | bp); - } else { - /* dn < n, we have a drop and we are done - * build nodes and subtree */ - while (dn != d) { - slot = maskval(v, d); - bp = 1 << slot; - /* OR bitposition before sz calculation to handle - * redundant collisions */ - hdr |= bp; - sz = hashmap_bitcount(hdr); - hp = erts_produce_heap(factory, HAMT_NODE_BITMAP_SZ(sz), HALLOC_EXTRA); - nhp = hp; - *hp++ = MAP_HEADER_HAMT_NODE_BITMAP(hdr); - *hp++ = res; sz--; - while (sz--) { *hp++ = ESTACK_POP(stack); } - ASSERT((hp - nhp) < 18); - res = make_hashmap(nhp); + if (n == 0) { + *res = map; + return 1; + } - /* we need to pop the next hdr and push if we don't need it */ + ks = map_get_keys(mp); + vs = map_get_values(mp); - hdr = ESTACK_POP(stack); - d--; - } - ESTACK_PUSH2(stack,res,hdr); - } + /* Assume key exists. + * Release allocated if it didn't. + * Allocate key tuple first. + */ - vp = v; - v = vn; - d = dn; - ERTS_FACTORY_HOLE_CHECK(factory); - } - - /* v and vp are reused from above */ - dn = cdepth(vp,v); - ix = ix + hxns[ix].skip; - res = hxns[ix].val; - - if (hxns[ix].skip > 1) { - dc = 7; - /* build collision nodes */ - while (dc > dn) { - hp = erts_produce_heap(factory, HAMT_NODE_BITMAP_SZ(1), HALLOC_EXTRA); - hp[0] = MAP_HEADER_HAMT_NODE_BITMAP(1 << maskval(v,dc)); - hp[1] = res; - res = make_hashmap(hp); - dc--; - } - } + need = n + 1 - 1 + 3 + n - 1; /* tuple - 1 + map - 1 */ + hp_start = HAlloc(p, need); + thp = hp_start; + mhp = thp + n; /* offset with tuple heap size */ + + tup = make_tuple(thp); + *thp++ = make_arityval(n - 1); - hdr = ESTACK_POP(stack); - /* pop remaining subtree if any */ - while (dn) { - slot = maskval(v, dn); - bp = 1 << slot; - /* OR bitposition before sz calculation to handle - * redundant collisions */ - hdr |= bp; - sz = hashmap_bitcount(hdr); - hp = erts_produce_heap(factory, HAMT_NODE_BITMAP_SZ(sz), HALLOC_EXTRA); - nhp = hp; - *hp++ = MAP_HEADER_HAMT_NODE_BITMAP(hdr); - *hp++ = res; sz--; - - while (sz--) { *hp++ = ESTACK_POP(stack); } - res = make_hashmap(nhp); - hdr = ESTACK_POP(stack); - dn--; - } - - /* and finally the root .. */ - - slot = maskval(v, dn); - bp = 1 << slot; - hdr |= bp; - sz = hashmap_bitcount(hdr); - hp = erts_produce_heap(factory, sz + /* hdr + item */ (is_root ? 2 : 1), 0); - nhp = hp; - - if (is_root) { - *hp++ = (hdr == 0xffff) ? MAP_HEADER_HAMT_HEAD_ARRAY : MAP_HEADER_HAMT_HEAD_BITMAP(hdr); - *hp++ = size; + *res = make_map(mhp); + *mhp++ = MAP_HEADER; + *mhp++ = n - 1; + *mhp++ = tup; + + if (is_immed(key)) { + while (1) { + if (*ks == key) { + goto found_key; + } else if (--n) { + *mhp++ = *vs++; + *thp++ = *ks++; + } else + break; + } } else { - *hp++ = MAP_HEADER_HAMT_NODE_BITMAP(hdr); + while(1) { + if (EQ(*ks, key)) { + goto found_key; + } else if (--n) { + *mhp++ = *vs++; + *thp++ = *ks++; + } else + break; + } } - *hp++ = res; sz--; - while (sz--) { *hp++ = ESTACK_POP(stack); } - - res = make_hashmap(nhp); - - ASSERT(ESTACK_COUNT(stack) == 0); - DESTROY_ESTACK(stack); - ERTS_FACTORY_HOLE_CHECK(factory); - return res; -} -#undef HALLOC_EXTRA + /* Not found, remove allocated memory + * and return previous map. + */ + HRelease(p, hp_start + need, hp_start); -static int hxnodecmpkey(hxnode_t *a, hxnode_t *b) { - Sint c = CMP_TERM(CAR(list_val(a->val)), CAR(list_val(b->val))); -#if ERTS_SIZEOF_ETERM <= SIZEOF_INT - return c; -#else - return c > 0 ? 1 : (c < 0 ? -1 : 0); -#endif -} + *res = map; + return 1; -static int hxnodecmp(hxnode_t *a, hxnode_t *b) { - if (a->hx < b->hx) - return 1; - else if (a->hx == b->hx) - return 0; - else - return -1; +found_key: + /* Copy rest of keys and values */ + if (--n) { + sys_memcpy(mhp, vs+1, n*sizeof(Eterm)); + sys_memcpy(thp, ks+1, n*sizeof(Eterm)); + } + return 1; } -/* maps:is_key/2 */ - -BIF_RETTYPE maps_is_key_2(BIF_ALIST_2) { +BIF_RETTYPE maps_remove_2(BIF_ALIST_2) { if (is_map(BIF_ARG_2)) { - BIF_RET(erts_maps_get(BIF_ARG_1, BIF_ARG_2) ? am_true : am_false); + Eterm res; + if (erts_maps_remove(BIF_P, BIF_ARG_1, BIF_ARG_2, &res)) { + BIF_RET(res); + } } - BIF_P->fvalue = BIF_ARG_2; - BIF_ERROR(BIF_P, BADMAP); + BIF_ERROR(BIF_P, BADARG); } -/* maps:keys/1 */ +/* maps:update/3 + */ -BIF_RETTYPE maps_keys_1(BIF_ALIST_1) { - if (is_flatmap(BIF_ARG_1)) { - Eterm *hp, *ks, res = NIL; - flatmap_t *mp; - Uint n; +int erts_maps_update(Process *p, Eterm key, Eterm value, Eterm map, Eterm *res) { + Sint n,i; + Eterm* hp,*shp; + Eterm *ks,*vs; + map_t *mp = (map_t*)map_val(map); - mp = (flatmap_t*)flatmap_val(BIF_ARG_1); - n = flatmap_get_size(mp); - - if (n == 0) - BIF_RET(res); - - hp = HAlloc(BIF_P, (2 * n)); - ks = flatmap_get_keys(mp); - - while(n--) { - res = CONS(hp, ks[n], res); hp += 2; - } - - BIF_RET(res); - } else if (is_hashmap(BIF_ARG_1)) { - BIF_RET(hashmap_keys(BIF_P, BIF_ARG_1)); - } - BIF_P->fvalue = BIF_ARG_1; - BIF_ERROR(BIF_P, BADMAP); -} - -/* maps:merge/2 */ - -HIPE_WRAPPER_BIF_DISABLE_GC(maps_merge, 2) - -BIF_RETTYPE maps_merge_2(BIF_ALIST_2) { - if (is_flatmap(BIF_ARG_1)) { - if (is_flatmap(BIF_ARG_2)) { - BIF_RET(flatmap_merge(BIF_P, BIF_ARG_1, BIF_ARG_2)); - } else if (is_hashmap(BIF_ARG_2)) { - /* Will always become a tree */ - return map_merge_mixed(BIF_P, BIF_ARG_1, BIF_ARG_2, 0); - } - BIF_P->fvalue = BIF_ARG_2; - } else if (is_hashmap(BIF_ARG_1)) { - if (is_hashmap(BIF_ARG_2)) { - return hashmap_merge(BIF_P, BIF_ARG_1, BIF_ARG_2, 0, NULL); - } else if (is_flatmap(BIF_ARG_2)) { - /* Will always become a tree */ - return map_merge_mixed(BIF_P, BIF_ARG_2, BIF_ARG_1, 1); - } - BIF_P->fvalue = BIF_ARG_2; - } else { - BIF_P->fvalue = BIF_ARG_1; - } - BIF_ERROR(BIF_P, BADMAP); -} - -static Eterm flatmap_merge(Process *p, Eterm nodeA, Eterm nodeB) { - Eterm *hp,*thp; - Eterm tup; - Eterm *ks,*vs,*ks1,*vs1,*ks2,*vs2; - flatmap_t *mp1,*mp2,*mp_new; - Uint n,n1,n2,i1,i2,need,unused_size=0; - Sint c = 0; - - mp1 = (flatmap_t*)flatmap_val(nodeA); - mp2 = (flatmap_t*)flatmap_val(nodeB); - n1 = flatmap_get_size(mp1); - n2 = flatmap_get_size(mp2); - - need = MAP_HEADER_FLATMAP_SZ + 1 + 2 * (n1 + n2); - - hp = HAlloc(p, need); - thp = hp; - tup = make_tuple(thp); - ks = hp + 1; hp += 1 + n1 + n2; - mp_new = (flatmap_t*)hp; hp += MAP_HEADER_FLATMAP_SZ; - vs = hp; hp += n1 + n2; - - mp_new->thing_word = MAP_HEADER_FLATMAP; - mp_new->size = 0; - mp_new->keys = tup; - - i1 = 0; i2 = 0; - ks1 = flatmap_get_keys(mp1); - vs1 = flatmap_get_values(mp1); - ks2 = flatmap_get_keys(mp2); - vs2 = flatmap_get_values(mp2); - - while(i1 < n1 && i2 < n2) { - c = CMP_TERM(ks1[i1],ks2[i2]); - if (c == 0) { - /* use righthand side arguments map value, - * but advance both maps */ - *ks++ = ks2[i2]; - *vs++ = vs2[i2]; - i1++, i2++, unused_size++; - } else if (c < 0) { - *ks++ = ks1[i1]; - *vs++ = vs1[i1]; - i1++; - } else { - *ks++ = ks2[i2]; - *vs++ = vs2[i2]; - i2++; - } - } - - /* copy remaining */ - while (i1 < n1) { - *ks++ = ks1[i1]; - *vs++ = vs1[i1]; - i1++; - } - - while (i2 < n2) { - *ks++ = ks2[i2]; - *vs++ = vs2[i2]; - i2++; - } - - if (unused_size) { - /* the key tuple is embedded in the heap, write a bignum to clear it. - * - * release values as normal since they are on the top of the heap - * size = n1 + n1 - unused_size - */ - - *ks = make_pos_bignum_header(unused_size - 1); - HRelease(p, vs + unused_size, vs); - } - - n = n1 + n2 - unused_size; - *thp = make_arityval(n); - mp_new->size = n; - - /* Reshape map to a hashmap if the map exceeds the limit */ - - if (n > MAP_SMALL_MAP_LIMIT) { - Uint32 hx,sw; - Uint i; - Eterm res; - hxnode_t *hxns; - ErtsHeapFactory factory; - - ks = flatmap_get_keys(mp_new); - vs = flatmap_get_values(mp_new); - - hp = HAlloc(p, 2 * n); - - hxns = (hxnode_t *)erts_alloc(ERTS_ALC_T_TMP,n * sizeof(hxnode_t)); - - for (i = 0; i < n; i++) { - hx = hashmap_make_hash(ks[i]); - swizzle32(sw,hx); - hxns[i].hx = sw; - hxns[i].val = CONS(hp, ks[i], vs[i]); hp += 2; - hxns[i].skip = 1; - hxns[i].i = i; - } - - erts_factory_proc_init(&factory, p); - res = hashmap_from_unsorted_array(&factory, hxns, n, 0); - erts_factory_close(&factory); - - erts_free(ERTS_ALC_T_TMP, (void *) hxns); - ERTS_VERIFY_UNUSED_TEMP_ALLOC(p); - - return res; - } - - return make_flatmap(mp_new); -} - -static Eterm map_merge_mixed(Process *p, Eterm flat, Eterm tree, int swap_args) { - Eterm *ks, *vs, *hp, res; - flatmap_t *mp; - Uint n, i; - hxnode_t *hxns; - Uint32 sw, hx; - ErtsHeapFactory factory; - - /* convert flat to tree */ - - ASSERT(is_flatmap(flat)); - ASSERT(is_hashmap(tree)); - - mp = (flatmap_t*)flatmap_val(flat); - n = flatmap_get_size(mp); - - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); - - hp = HAlloc(p, 2 * n); - - hxns = (hxnode_t *)erts_alloc(ERTS_ALC_T_TMP, n * sizeof(hxnode_t)); - - for (i = 0; i < n; i++) { - hx = hashmap_make_hash(ks[i]); - swizzle32(sw,hx); - hxns[i].hx = sw; - hxns[i].val = CONS(hp, ks[i], vs[i]); hp += 2; - hxns[i].skip = 1; - hxns[i].i = i; - } - - erts_factory_proc_init(&factory, p); - res = hashmap_from_unsorted_array(&factory, hxns, n, 0); - erts_factory_close(&factory); - - erts_free(ERTS_ALC_T_TMP, (void *) hxns); - ERTS_VERIFY_UNUSED_TEMP_ALLOC(p); - - return hashmap_merge(p, res, tree, swap_args, NULL); -} - -#define PSTACK_TYPE struct HashmapMergePStackType -struct HashmapMergePStackType { - Eterm nodeA, nodeB; - Eterm *srcA, *srcB; - Uint32 abm, bbm, rbm; /* node bitmaps */ - int mix; /* &1: there are unique A stuff in node - * &2: there are unique B stuff in node */ - int ix; - Eterm array[16]; /* temp node construction area */ -}; - -typedef struct HashmapMergeContext_ { - Uint size; /* total key-value counter */ - unsigned int lvl; - Eterm trap_bin; - ErtsPStack pstack; -#ifdef DEBUG - Eterm dbg_map_A, dbg_map_B; -#endif -} HashmapMergeContext; - -static void hashmap_merge_ctx_destructor(Binary* ctx_bin) -{ - HashmapMergeContext* ctx = (HashmapMergeContext*) ERTS_MAGIC_BIN_DATA(ctx_bin); - ASSERT(ERTS_MAGIC_BIN_DESTRUCTOR(ctx_bin) == hashmap_merge_ctx_destructor); - - PSTACK_DESTROY_SAVED(&ctx->pstack); -} - -BIF_RETTYPE maps_merge_trap_1(BIF_ALIST_1) { - Binary* ctx_bin = ((ProcBin *) binary_val(BIF_ARG_1))->val; - - ASSERT(ERTS_MAGIC_BIN_DESTRUCTOR(ctx_bin) == hashmap_merge_ctx_destructor); - - return hashmap_merge(BIF_P, NIL, NIL, 0, - (HashmapMergeContext*) ERTS_MAGIC_BIN_DATA(ctx_bin)); -} - -#define HALLOC_EXTRA 200 -#define MAP_MERGE_LOOP_FACTOR 8 - -static BIF_RETTYPE hashmap_merge(Process *p, Eterm map_A, Eterm map_B, - int swap_args, HashmapMergeContext* ctx) { -#define PSTACK_TYPE struct HashmapMergePStackType - PSTACK_DECLARE(s, 4); - HashmapMergeContext local_ctx; - struct HashmapMergePStackType* sp; - Uint32 hx; - Eterm res = THE_NON_VALUE; - Eterm hdrA, hdrB; - Eterm *hp, *nhp; - Eterm trap_ret; - Sint initial_reds = (Sint) (ERTS_BIF_REDS_LEFT(p) * MAP_MERGE_LOOP_FACTOR); - Sint reds = initial_reds; - DeclareTmpHeap(th,2,p); - UseTmpHeap(2,p); - - /* - * Strategy: Do depth-first traversal of both trees (at the same time) - * and merge each pair of nodes. - */ - - PSTACK_CHANGE_ALLOCATOR(s, ERTS_ALC_T_SAVED_ESTACK); - - if (ctx == NULL) { /* first call */ - hashmap_head_t* a = (hashmap_head_t*) hashmap_val(map_A); - hashmap_head_t* b = (hashmap_head_t*) hashmap_val(map_B); - - sp = PSTACK_PUSH(s); - sp->srcA = swap_args ? &map_B : &map_A; - sp->srcB = swap_args ? &map_A : &map_B; - sp->mix = 0; - local_ctx.size = a->size + b->size; - local_ctx.lvl = 0; - #ifdef DEBUG - local_ctx.dbg_map_A = map_A; - local_ctx.dbg_map_B = map_B; - local_ctx.trap_bin = THE_NON_VALUE; - #endif - ctx = &local_ctx; - } - else { - PSTACK_RESTORE(s, &ctx->pstack); - sp = PSTACK_TOP(s); - goto resume_from_trap; - } - -recurse: - - sp->nodeA = *sp->srcA; - sp->nodeB = *sp->srcB; - - if (sp->nodeA == sp->nodeB) { - res = sp->nodeA; - ctx->size -= is_list(sp->nodeB) ? 1 : hashmap_subtree_size(sp->nodeB); - } - else { - if (is_list(sp->nodeA)) { /* A is LEAF */ - Eterm keyA = CAR(list_val(sp->nodeA)); - - if (is_list(sp->nodeB)) { /* LEAF + LEAF */ - Eterm keyB = CAR(list_val(sp->nodeB)); - - if (EQ(keyA, keyB)) { - --ctx->size; - res = sp->nodeB; - sp->mix = 2; /* We assume values differ. - + Don't spend time comparing big values. - - Might waste some heap space for internal - nodes that could otherwise be reused. */ - goto merge_nodes; - } - } - hx = hashmap_restore_hash(th, ctx->lvl, keyA); - sp->abm = 1 << hashmap_index(hx); - /* keep srcA pointing at the leaf */ - } - else { /* A is NODE */ - sp->srcA = boxed_val(sp->nodeA); - hdrA = *sp->srcA++; - ASSERT(is_header(hdrA)); - switch (hdrA & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: { - sp->srcA++; - sp->abm = 0xffff; - break; - } - case HAMT_SUBTAG_HEAD_BITMAP: sp->srcA++; - case HAMT_SUBTAG_NODE_BITMAP: { - sp->abm = MAP_HEADER_VAL(hdrA); - break; - } - default: - erl_exit(ERTS_ABORT_EXIT, "bad header %ld\r\n", hdrA); - } - } - - if (is_list(sp->nodeB)) { /* B is LEAF */ - Eterm keyB = CAR(list_val(sp->nodeB)); - - hx = hashmap_restore_hash(th, ctx->lvl, keyB); - sp->bbm = 1 << hashmap_index(hx); - /* keep srcB pointing at the leaf */ - } - else { /* B is NODE */ - sp->srcB = boxed_val(sp->nodeB); - hdrB = *sp->srcB++; - ASSERT(is_header(hdrB)); - switch (hdrB & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: { - sp->srcB++; - sp->bbm = 0xffff; - break; - } - case HAMT_SUBTAG_HEAD_BITMAP: sp->srcB++; - case HAMT_SUBTAG_NODE_BITMAP: { - sp->bbm = MAP_HEADER_VAL(hdrB); - break; - } - default: - erl_exit(ERTS_ABORT_EXIT, "bad header %ld\r\n", hdrB); - } - } - } - -merge_nodes: - - for (;;) { - if (is_value(res)) { /* We have a complete (sub-)tree or leaf */ - int child_mix; - if (ctx->lvl == 0) - break; - - /* Pop from stack and continue build parent node */ - ctx->lvl--; - child_mix = sp->mix; - sp = PSTACK_POP(s); - sp->array[sp->ix++] = res; - sp->mix |= child_mix; - res = THE_NON_VALUE; - if (sp->rbm) { - sp->srcA++; - sp->srcB++; - } - } else { /* Start build a node */ - sp->ix = 0; - sp->rbm = sp->abm | sp->bbm; - ASSERT(!(sp->rbm == 0 && ctx->lvl > 0)); - } - - if (--reds <= 0) { - goto trap; - } -resume_from_trap: - - while (sp->rbm) { - Uint32 next = sp->rbm & (sp->rbm-1); - Uint32 bit = sp->rbm ^ next; - sp->rbm = next; - if (sp->abm & bit) { - if (sp->bbm & bit) { - /* Bit clash. Push and resolve by recursive merge */ - Eterm* srcA = sp->srcA; - Eterm* srcB = sp->srcB; - ctx->lvl++; - sp = PSTACK_PUSH(s); - sp->srcA = srcA; - sp->srcB = srcB; - sp->mix = 0; - goto recurse; - } else { - sp->array[sp->ix++] = *sp->srcA++; - sp->mix |= 1; - } - } else { - ASSERT(sp->bbm & bit); - sp->array[sp->ix++] = *sp->srcB++; - sp->mix |= 2; - } - } - - switch (sp->mix) { - case 0: /* Nodes A and B contain the *EXACT* same sub-trees - => fall through and reuse nodeA */ - - case 1: /* Only unique A stuff => reuse nodeA */ - res = sp->nodeA; - break; - - case 2: /* Only unique B stuff => reuse nodeB */ - res = sp->nodeB; - break; - - case 3: /* We have a mix => must build new node */ - ASSERT(sp->ix == hashmap_bitcount(sp->abm | sp->bbm)); - if (ctx->lvl == 0) { - nhp = HAllocX(p, HAMT_HEAD_BITMAP_SZ(sp->ix), HALLOC_EXTRA); - hp = nhp; - *hp++ = (sp->ix == 16 ? MAP_HEADER_HAMT_HEAD_ARRAY - : MAP_HEADER_HAMT_HEAD_BITMAP(sp->abm | sp->bbm)); - *hp++ = ctx->size; - } else { - nhp = HAllocX(p, HAMT_NODE_BITMAP_SZ(sp->ix), HALLOC_EXTRA); - hp = nhp; - *hp++ = MAP_HEADER_HAMT_NODE_BITMAP(sp->abm | sp->bbm); - } - sys_memcpy(hp, sp->array, sp->ix * sizeof(Eterm)); - res = make_boxed(nhp); - break; - default: - erl_exit(ERTS_ABORT_EXIT, "strange mix %d\r\n", sp->mix); - } - } - - /* Done */ - -#ifdef DEBUG - { - Eterm *head = hashmap_val(res); - Uint size = head[1]; - Uint real_size = hashmap_subtree_size(res); - ASSERT(size == real_size); - } -#endif - - if (ctx != &local_ctx) { - ASSERT(ctx->trap_bin != THE_NON_VALUE); - ASSERT(p->flags & F_DISABLE_GC); - erts_set_gc_state(p, 1); - } - else { - ASSERT(ctx->trap_bin == THE_NON_VALUE); - ASSERT(!(p->flags & F_DISABLE_GC)); - } - PSTACK_DESTROY(s); - UnUseTmpHeap(2,p); - BUMP_REDS(p, (initial_reds - reds) / MAP_MERGE_LOOP_FACTOR); - return res; - -trap: /* Yield */ - - if (ctx == &local_ctx) { - Binary* ctx_b = erts_create_magic_binary(sizeof(HashmapMergeContext), - hashmap_merge_ctx_destructor); - ctx = ERTS_MAGIC_BIN_DATA(ctx_b); - sys_memcpy(ctx, &local_ctx, sizeof(HashmapMergeContext)); - hp = HAlloc(p, PROC_BIN_SIZE); - ASSERT(ctx->trap_bin == THE_NON_VALUE); - ctx->trap_bin = erts_mk_magic_binary_term(&hp, &MSO(p), ctx_b); - - erts_set_gc_state(p, 0); - } - else { - ASSERT(ctx->trap_bin != THE_NON_VALUE); - ASSERT(p->flags & F_DISABLE_GC); - } - - PSTACK_SAVE(s, &ctx->pstack); - - BUMP_ALL_REDS(p); - ERTS_BIF_PREP_TRAP1(trap_ret, &hashmap_merge_trap_export, - p, ctx->trap_bin); - UnUseTmpHeap(2,p); - return trap_ret; -} - -static Uint hashmap_subtree_size(Eterm node) { - DECLARE_WSTACK(stack); - Uint size = 0; - - hashmap_iterator_init(&stack, node, 0); - while (hashmap_iterator_next(&stack)) { - size++; - } - DESTROY_WSTACK(stack); - return size; -} - - -static int hash_cmp(Uint32 ha, Uint32 hb) -{ - int i; - for (i=0; i<8; i++) { - int cmp = (int)(ha & 0xF) - (int)(hb & 0xF); - if (cmp) - return cmp; - ha >>= 4; - hb >>= 4; - } - return 0; -} - -int hashmap_key_hash_cmp(Eterm* ap, Eterm* bp) -{ - unsigned int lvl = 0; - DeclareTmpHeapNoproc(th,2); - UseTmpHeapNoproc(2); - - if (ap && bp) { - ASSERT(CMP_TERM(CAR(ap), CAR(bp)) != 0); - for (;;) { - Uint32 ha = hashmap_restore_hash(th, lvl, CAR(ap)); - Uint32 hb = hashmap_restore_hash(th, lvl, CAR(bp)); - int cmp = hash_cmp(ha, hb); - if (cmp) { - UnUseTmpHeapNoproc(2); - return cmp; - } - lvl += 8; - } - } - UnUseTmpHeapNoproc(2); - return ap ? -1 : 1; -} - -/* maps:new/0 */ - -BIF_RETTYPE maps_new_0(BIF_ALIST_0) { - Eterm* hp; - Eterm tup; - flatmap_t *mp; - - hp = HAlloc(BIF_P, (MAP_HEADER_FLATMAP_SZ + 1)); - tup = make_tuple(hp); - *hp++ = make_arityval(0); - - mp = (flatmap_t*)hp; - mp->thing_word = MAP_HEADER_FLATMAP; - mp->size = 0; - mp->keys = tup; - - BIF_RET(make_flatmap(mp)); -} - -/* maps:put/3 */ - -BIF_RETTYPE maps_put_3(BIF_ALIST_3) { - if (is_map(BIF_ARG_3)) { - BIF_RET(erts_maps_put(BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3)); - } - BIF_P->fvalue = BIF_ARG_3; - BIF_ERROR(BIF_P, BADMAP); -} - -/* maps:remove/3 */ - -int erts_maps_remove(Process *p, Eterm key, Eterm map, Eterm *res) { - Uint32 hx; - if (is_flatmap(map)) { - Sint n; - Uint need; - Eterm *hp_start; - Eterm *thp, *mhp; - Eterm *ks, *vs, tup; - flatmap_t *mp = (flatmap_t*)flatmap_val(map); - - n = flatmap_get_size(mp); - - if (n == 0) { - *res = map; - return 1; - } - - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); - - /* Assume key exists. - * Release allocated if it didn't. - * Allocate key tuple first. - */ - - need = n + 1 - 1 + 3 + n - 1; /* tuple - 1 + map - 1 */ - hp_start = HAlloc(p, need); - thp = hp_start; - mhp = thp + n; /* offset with tuple heap size */ - - tup = make_tuple(thp); - *thp++ = make_arityval(n - 1); - - *res = make_flatmap(mhp); - *mhp++ = MAP_HEADER_FLATMAP; - *mhp++ = n - 1; - *mhp++ = tup; - - if (is_immed(key)) { - while (1) { - if (*ks == key) { - goto found_key; - } else if (--n) { - *mhp++ = *vs++; - *thp++ = *ks++; - } else - break; - } - } else { - while(1) { - if (EQ(*ks, key)) { - goto found_key; - } else if (--n) { - *mhp++ = *vs++; - *thp++ = *ks++; - } else - break; - } - } - - /* Not found, remove allocated memory - * and return previous map. - */ - HRelease(p, hp_start + need, hp_start); - - *res = map; - return 1; - -found_key: - /* Copy rest of keys and values */ - if (--n) { - sys_memcpy(mhp, vs+1, n*sizeof(Eterm)); - sys_memcpy(thp, ks+1, n*sizeof(Eterm)); - } - return 1; - } - ASSERT(is_hashmap(map)); - hx = hashmap_make_hash(key); - *res = hashmap_delete(p, hx, key, map); - return 1; -} - -BIF_RETTYPE maps_remove_2(BIF_ALIST_2) { - if (is_map(BIF_ARG_2)) { - Eterm res; - if (erts_maps_remove(BIF_P, BIF_ARG_1, BIF_ARG_2, &res)) { - BIF_RET(res); - } - } - BIF_P->fvalue = BIF_ARG_2; - BIF_ERROR(BIF_P, BADMAP); -} - -int erts_maps_update(Process *p, Eterm key, Eterm value, Eterm map, Eterm *res) { - Uint32 hx; - if (is_flatmap(map)) { - Sint n,i; - Eterm* hp,*shp; - Eterm *ks,*vs; - flatmap_t *mp = (flatmap_t*)flatmap_val(map); - - if ((n = flatmap_get_size(mp)) == 0) { + if ((n = map_get_size(mp)) == 0) { return 0; } - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); + ks = map_get_keys(mp); + vs = map_get_values(mp); /* only allocate for values, * assume key-tuple will be intact */ - hp = HAlloc(p, MAP_HEADER_FLATMAP_SZ + n); + hp = HAlloc(p, MAP_HEADER_SIZE + n); shp = hp; - *hp++ = MAP_HEADER_FLATMAP; + *hp++ = MAP_HEADER; *hp++ = n; *hp++ = mp->keys; @@ -1663,7 +741,7 @@ } } - HRelease(p, shp + MAP_HEADER_FLATMAP_SZ + n, shp); + HRelease(p, shp + MAP_HEADER_SIZE + n, shp); return 0; found_key: @@ -1671,943 +749,56 @@ vs++; if (++i < n) sys_memcpy(hp, vs, (n - i)*sizeof(Eterm)); - *res = make_flatmap(shp); + *res = make_map(shp); return 1; - } - - ASSERT(is_hashmap(map)); - hx = hashmap_make_hash(key); - *res = erts_hashmap_insert(p, hx, key, value, map, 1); - if (is_value(*res)) - return 1; - - return 0; -} - -Eterm erts_maps_put(Process *p, Eterm key, Eterm value, Eterm map) { - Uint32 hx; - Eterm res; - if (is_flatmap(map)) { - Sint n,i; - Sint c = 0; - Eterm* hp, *shp; - Eterm *ks, *vs, tup; - flatmap_t *mp = (flatmap_t*)flatmap_val(map); - - n = flatmap_get_size(mp); - - if (n == 0) { - hp = HAlloc(p, MAP_HEADER_FLATMAP_SZ + 1 + 2); - tup = make_tuple(hp); - *hp++ = make_arityval(1); - *hp++ = key; - res = make_flatmap(hp); - *hp++ = MAP_HEADER_FLATMAP; - *hp++ = 1; - *hp++ = tup; - *hp++ = value; - - return res; - } - - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); - - /* only allocate for values, - * assume key-tuple will be intact - */ - - hp = HAlloc(p, MAP_HEADER_FLATMAP_SZ + n); - shp = hp; /* save hp, used if optimistic update fails */ - res = make_flatmap(hp); - *hp++ = MAP_HEADER_FLATMAP; - *hp++ = n; - *hp++ = mp->keys; - - if (is_immed(key)) { - for( i = 0; i < n; i ++) { - if (ks[i] == key) { - *hp++ = value; - vs++; - c = 1; - } else { - *hp++ = *vs++; - } - } - } else { - for( i = 0; i < n; i ++) { - if (EQ(ks[i], key)) { - *hp++ = value; - vs++; - c = 1; - } else { - *hp++ = *vs++; - } - } - } - - if (c) - return res; - - /* the map will grow */ - - if (n >= MAP_SMALL_MAP_LIMIT) { - HRelease(p, shp + MAP_HEADER_FLATMAP_SZ + n, shp); - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); - - res = erts_hashmap_from_ks_and_vs_extra(p,ks,vs,n,key,value); - - return res; - } - - /* still a small map. need to make a new tuple, - * use old hp since it needs to be recreated anyway. */ - - tup = make_tuple(shp); - *shp++ = make_arityval(n+1); - - hp = HAlloc(p, 3 + n + 1); - res = make_flatmap(hp); - *hp++ = MAP_HEADER_FLATMAP; - *hp++ = n + 1; - *hp++ = tup; - - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); - - ASSERT(n >= 0); - - /* copy map in order */ - while (n && ((c = CMP_TERM(*ks, key)) < 0)) { - *shp++ = *ks++; - *hp++ = *vs++; - n--; - } - - *shp++ = key; - *hp++ = value; - - ASSERT(n >= 0); - - while(n--) { - *shp++ = *ks++; - *hp++ = *vs++; - } - /* we have one word remaining - * this will work out fine once we get the size word - * in the header. - */ - *shp = make_pos_bignum_header(0); - return res; - } - ASSERT(is_hashmap(map)); - - hx = hashmap_make_hash(key); - res = erts_hashmap_insert(p, hx, key, value, map, 0); - ASSERT(is_hashmap(res)); - - return res; } -/* maps:update/3 */ - BIF_RETTYPE maps_update_3(BIF_ALIST_3) { - if (is_not_map(BIF_ARG_3)) { - BIF_P->fvalue = BIF_ARG_3; - BIF_ERROR(BIF_P, BADMAP); - } else { + if (is_map(BIF_ARG_3)) { Eterm res; if (erts_maps_update(BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3, &res)) { BIF_RET(res); } - BIF_P->fvalue = BIF_ARG_1; - BIF_ERROR(BIF_P, BADKEY); } + BIF_ERROR(BIF_P, BADARG); } -/* maps:values/1 */ +/* maps:values/1 + */ BIF_RETTYPE maps_values_1(BIF_ALIST_1) { - if (is_flatmap(BIF_ARG_1)) { + if (is_map(BIF_ARG_1)) { Eterm *hp, *vs, res = NIL; - flatmap_t *mp; + map_t *mp; Uint n; - mp = (flatmap_t*)flatmap_val(BIF_ARG_1); - n = flatmap_get_size(mp); + mp = (map_t*)map_val(BIF_ARG_1); + n = map_get_size(mp); if (n == 0) BIF_RET(res); hp = HAlloc(BIF_P, (2 * n)); - vs = flatmap_get_values(mp); + vs = map_get_values(mp); while(n--) { res = CONS(hp, vs[n], res); hp += 2; } BIF_RET(res); - } else if (is_hashmap(BIF_ARG_1)) { - BIF_RET(hashmap_values(BIF_P, BIF_ARG_1)); - } - BIF_P->fvalue = BIF_ARG_1; - BIF_ERROR(BIF_P, BADMAP); -} - -static Eterm hashmap_to_list(Process *p, Eterm node) { - DECLARE_WSTACK(stack); - Eterm *hp, *kv; - Eterm res = NIL; - - hp = HAlloc(p, hashmap_size(node) * (2 + 3)); - hashmap_iterator_init(&stack, node, 0); - while ((kv=hashmap_iterator_next(&stack)) != NULL) { - Eterm tup = TUPLE2(hp, CAR(kv), CDR(kv)); - hp += 3; - res = CONS(hp, tup, res); - hp += 2; - } - DESTROY_WSTACK(stack); - return res; -} - -void hashmap_iterator_init(ErtsWStack* s, Eterm node, int reverse) { - Eterm hdr = *hashmap_val(node); - Uint sz; - - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - sz = 16; - break; - case HAMT_SUBTAG_HEAD_BITMAP: - case HAMT_SUBTAG_NODE_BITMAP: - sz = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - break; - default: - erl_exit(ERTS_ABORT_EXIT, "bad header"); - } - - WSTACK_PUSH3((*s), (UWord)THE_NON_VALUE, /* end marker */ - (UWord)(!reverse ? 0 : sz+1), - (UWord)node); -} - -Eterm* hashmap_iterator_next(ErtsWStack* s) { - Eterm node, *ptr, hdr; - Uint32 sz; - Uint idx; - - for (;;) { - ASSERT(!WSTACK_ISEMPTY((*s))); - node = (Eterm) WSTACK_POP((*s)); - if (is_non_value(node)) { - return NULL; - } - idx = (Uint) WSTACK_POP((*s)); - for (;;) { - ASSERT(is_boxed(node)); - ptr = boxed_val(node); - hdr = *ptr; - ASSERT(is_header(hdr)); - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - ptr++; - sz = 16; - break; - case HAMT_SUBTAG_HEAD_BITMAP: - ptr++; - case HAMT_SUBTAG_NODE_BITMAP: - sz = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - ASSERT(sz < 17); - break; - default: - erl_exit(ERTS_ABORT_EXIT, "bad header"); - } - - idx++; - - if (idx <= sz) { - WSTACK_PUSH2((*s), (UWord)idx, (UWord)node); - - if (is_list(ptr[idx])) { - return list_val(ptr[idx]); - } - ASSERT(is_boxed(ptr[idx])); - node = ptr[idx]; - idx = 0; - } - else - break; /* and pop parent node */ - } - } -} - -Eterm* hashmap_iterator_prev(ErtsWStack* s) { - Eterm node, *ptr, hdr; - Uint32 sz; - Uint idx; - - for (;;) { - ASSERT(!WSTACK_ISEMPTY((*s))); - node = (Eterm) WSTACK_POP((*s)); - if (is_non_value(node)) { - return NULL; - } - idx = (Uint) WSTACK_POP((*s)); - for (;;) { - ASSERT(is_boxed(node)); - ptr = boxed_val(node); - hdr = *ptr; - ASSERT(is_header(hdr)); - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - ptr++; - sz = 16; - break; - case HAMT_SUBTAG_HEAD_BITMAP: - ptr++; - case HAMT_SUBTAG_NODE_BITMAP: - sz = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - ASSERT(sz < 17); - break; - default: - erl_exit(1, "bad header"); - } - - if (idx > sz) - idx = sz; - else - idx--; - - if (idx >= 1) { - WSTACK_PUSH2((*s), (UWord)idx, (UWord)node); - - if (is_list(ptr[idx])) { - return list_val(ptr[idx]); - } - ASSERT(is_boxed(ptr[idx])); - node = ptr[idx]; - idx = 17; - } - else - break; /* and pop parent node */ - } - } -} - -const Eterm * -#if HALFWORD_HEAP -erts_hashmap_get_rel(Uint32 hx, Eterm key, Eterm node, Eterm *map_base) -#else -erts_hashmap_get(Uint32 hx, Eterm key, Eterm node) -#endif -{ - Eterm *ptr, hdr, *res; - Uint ix, lvl = 0; - Uint32 hval,bp; - DeclareTmpHeapNoproc(th,2); - UseTmpHeapNoproc(2); - - ASSERT(is_boxed(node)); - ptr = boxed_val_rel(node, map_base); - hdr = *ptr; - ASSERT(is_header(hdr)); - ASSERT(is_hashmap_header_head(hdr)); - ptr++; - - for (;;) { - hval = MAP_HEADER_VAL(hdr); - ix = hashmap_index(hx); - if (hval != 0xffff) { - bp = 1 << ix; - if (!(bp & hval)) { - /* not occupied */ - res = NULL; - break; - } - ix = hashmap_bitcount(hval & (bp - 1)); - } - node = ptr[ix+1]; - - if (is_list(node)) { /* LEAF NODE [K|V] */ - ptr = list_val_rel(node,map_base); - res = eq_rel(CAR(ptr), map_base, key, NULL) ? &(CDR(ptr)) : NULL; - break; - } - - hx = hashmap_shift_hash(th,hx,lvl,key); - - ASSERT(is_boxed(node)); - ptr = boxed_val_rel(node, map_base); - hdr = *ptr; - ASSERT(is_header(hdr)); - ASSERT(!is_hashmap_header_head(hdr)); - } - - UnUseTmpHeapNoproc(2); - return res; -} - -Eterm erts_hashmap_insert(Process *p, Uint32 hx, Eterm key, Eterm value, - Eterm map, int is_update) { - Uint size, upsz; - Eterm *hp, res = THE_NON_VALUE; - DECLARE_ESTACK(stack); - if (erts_hashmap_insert_down(hx, key, map, &size, &upsz, &stack, is_update)) { - hp = HAlloc(p, size); - res = erts_hashmap_insert_up(hp, key, value, &upsz, &stack); - } - - DESTROY_ESTACK(stack); - ERTS_VERIFY_UNUSED_TEMP_ALLOC(p); - ERTS_HOLE_CHECK(p); - - return res; -} - - -int erts_hashmap_insert_down(Uint32 hx, Eterm key, Eterm node, Uint *sz, - Uint *update_size, ErtsEStack *sp, int is_update) { - Eterm *ptr; - Eterm hdr, ckey; - Uint32 ix, cix, bp, hval, chx; - Uint slot, lvl = 0, clvl; - Uint size = 0, n = 0; - DeclareTmpHeapNoproc(th,2); - - *update_size = 1; - - UseTmpHeapNoproc(2); - for (;;) { - switch(primary_tag(node)) { - case TAG_PRIMARY_LIST: /* LEAF NODE [K|V] */ - ptr = list_val(node); - ckey = CAR(ptr); - if (EQ(ckey, key)) { - *update_size = 0; - goto unroll; - } - if (is_update) { - UnUseTmpHeapNoproc(2); - return 0; - } - goto insert_subnodes; - case TAG_PRIMARY_BOXED: - ptr = boxed_val(node); - hdr = *ptr; - ASSERT(is_header(hdr)); - - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - ix = hashmap_index(hx); - hx = hashmap_shift_hash(th,hx,lvl,key); - size += HAMT_HEAD_ARRAY_SZ; - ESTACK_PUSH2(*sp, ix, node); - node = ptr[ix+2]; - break; - case HAMT_SUBTAG_NODE_BITMAP: - hval = MAP_HEADER_VAL(hdr); - ix = hashmap_index(hx); - bp = 1 << ix; - if (hval == 0xffff) { - slot = ix; - n = 16; - } else { - slot = hashmap_bitcount(hval & (bp - 1)); - n = hashmap_bitcount(hval); - } - - ESTACK_PUSH4(*sp, n, bp, slot, node); - - if (!(bp & hval)) { /* not occupied */ - if (is_update) { - UnUseTmpHeapNoproc(2); - return 0; - } - size += HAMT_NODE_BITMAP_SZ(n+1); - goto unroll; - } - - hx = hashmap_shift_hash(th,hx,lvl,key); - node = ptr[slot+1]; - ASSERT(HAMT_NODE_BITMAP_SZ(n) <= 17); - size += HAMT_NODE_BITMAP_SZ(n); - break; - - case HAMT_SUBTAG_HEAD_BITMAP: - hval = MAP_HEADER_VAL(hdr); - ix = hashmap_index(hx); - bp = 1 << ix; - slot = hashmap_bitcount(hval & (bp - 1)); - n = hashmap_bitcount(hval); - - ESTACK_PUSH4(*sp, n, bp, slot, node); - - /* occupied */ - if (bp & hval) { - hx = hashmap_shift_hash(th,hx,lvl,key); - node = ptr[slot+2]; - ASSERT(HAMT_HEAD_BITMAP_SZ(n) <= 18); - size += HAMT_HEAD_BITMAP_SZ(n); - break; - } - /* not occupied */ - if (is_update) { - UnUseTmpHeapNoproc(2); - return 0; - } - size += HAMT_HEAD_BITMAP_SZ(n+1); - goto unroll; - default: - erl_exit(1, "bad header tag %ld\r\n", hdr & _HEADER_MAP_SUBTAG_MASK); - break; - } - break; - default: - erl_exit(1, "bad primary tag %p\r\n", node); - break; - } - } -insert_subnodes: - clvl = lvl; - chx = hashmap_restore_hash(th,clvl,ckey); - size += HAMT_NODE_BITMAP_SZ(2); - ix = hashmap_index(hx); - cix = hashmap_index(chx); - - while (cix == ix) { - ESTACK_PUSH4(*sp, 0, 1 << ix, 0, MAP_HEADER_HAMT_NODE_BITMAP(0)); - size += HAMT_NODE_BITMAP_SZ(1); - hx = hashmap_shift_hash(th,hx,lvl,key); - chx = hashmap_shift_hash(th,chx,clvl,ckey); - ix = hashmap_index(hx); - cix = hashmap_index(chx); - } - ESTACK_PUSH3(*sp, cix, ix, node); - -unroll: - *sz = size + /* res cons */ 2; - UnUseTmpHeapNoproc(2); - return 1; -} - -Eterm erts_hashmap_insert_up(Eterm *hp, Eterm key, Eterm value, - Uint *update_size, ErtsEStack *sp) { - Eterm node, *ptr, hdr; - Eterm res; - Eterm *nhp = NULL; - Uint32 ix, cix, bp, hval; - Uint slot, n; - /* Needed for halfword */ - DeclareTmpHeapNoproc(fake,1); - UseTmpHeapNoproc(1); - - res = CONS(hp, key, value); hp += 2; - - do { - node = ESTACK_POP(*sp); - switch(primary_tag(node)) { - case TAG_PRIMARY_LIST: - ix = (Uint32) ESTACK_POP(*sp); - cix = (Uint32) ESTACK_POP(*sp); - - nhp = hp; - *hp++ = MAP_HEADER_HAMT_NODE_BITMAP((1 << ix) | (1 << cix)); - if (ix < cix) { - *hp++ = res; - *hp++ = node; - } else { - *hp++ = node; - *hp++ = res; - } - res = make_hashmap(nhp); - break; - case TAG_PRIMARY_HEADER: - /* subnodes, fake it */ - *fake = node; - node = make_boxed(fake); - case TAG_PRIMARY_BOXED: - ptr = boxed_val(node); - hdr = *ptr; - ASSERT(is_header(hdr)); - - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - slot = (Uint) ESTACK_POP(*sp); - nhp = hp; - n = HAMT_HEAD_ARRAY_SZ - 2; - *hp++ = MAP_HEADER_HAMT_HEAD_ARRAY; ptr++; - *hp++ = (*ptr++) + *update_size; - while(n--) { *hp++ = *ptr++; } - nhp[slot+2] = res; - res = make_hashmap(nhp); - break; - case HAMT_SUBTAG_NODE_BITMAP: - slot = (Uint) ESTACK_POP(*sp); - bp = (Uint32) ESTACK_POP(*sp); - n = (Uint32) ESTACK_POP(*sp); - hval = MAP_HEADER_VAL(hdr); - nhp = hp; - *hp++ = MAP_HEADER_HAMT_NODE_BITMAP(hval | bp); ptr++; - - n -= slot; - while(slot--) { *hp++ = *ptr++; } - *hp++ = res; - if (hval & bp) { ptr++; n--; } - while(n--) { *hp++ = *ptr++; } - - res = make_hashmap(nhp); - break; - case HAMT_SUBTAG_HEAD_BITMAP: - slot = (Uint) ESTACK_POP(*sp); - bp = (Uint32) ESTACK_POP(*sp); - n = (Uint32) ESTACK_POP(*sp); - hval = MAP_HEADER_VAL(hdr); - nhp = hp; - *hp++ = MAP_HEADER_HAMT_HEAD_BITMAP(hval | bp); ptr++; - *hp++ = (*ptr++) + *update_size; - - n -= slot; - while(slot--) { *hp++ = *ptr++; } - *hp++ = res; - if (hval & bp) { ptr++; n--; } - while(n--) { *hp++ = *ptr++; } - - if ((hval | bp) == 0xffff) { - *nhp = MAP_HEADER_HAMT_HEAD_ARRAY; - } - res = make_hashmap(nhp); - break; - default: - erl_exit(1, "bad header tag %x\r\n", hdr & _HEADER_MAP_SUBTAG_MASK); - break; - } - break; - default: - erl_exit(1, "bad primary tag %x\r\n", primary_tag(node)); - break; - } - - } while(!ESTACK_ISEMPTY(*sp)); - - UnUseTmpHeapNoproc(1); - return res; -} - -static Eterm hashmap_keys(Process* p, Eterm node) { - DECLARE_WSTACK(stack); - hashmap_head_t* root; - Eterm *hp, *kv; - Eterm res = NIL; - - root = (hashmap_head_t*) boxed_val(node); - hp = HAlloc(p, root->size * 2); - hashmap_iterator_init(&stack, node, 0); - while ((kv=hashmap_iterator_next(&stack)) != NULL) { - res = CONS(hp, CAR(kv), res); - hp += 2; } - DESTROY_WSTACK(stack); - return res; -} - -static Eterm hashmap_values(Process* p, Eterm node) { - DECLARE_WSTACK(stack); - hashmap_head_t* root; - Eterm *hp, *kv; - Eterm res = NIL; - - root = (hashmap_head_t*) boxed_val(node); - hp = HAlloc(p, root->size * 2); - hashmap_iterator_init(&stack, node, 0); - while ((kv=hashmap_iterator_next(&stack)) != NULL) { - res = CONS(hp, CDR(kv), res); - hp += 2; - } - DESTROY_WSTACK(stack); - return res; -} - -static Eterm hashmap_delete(Process *p, Uint32 hx, Eterm key, Eterm map) { - Eterm *hp = NULL, *nhp = NULL, *hp_end = NULL; - Eterm *ptr; - Eterm hdr, res = map, node = map; - Uint32 ix, bp, hval; - Uint slot, lvl = 0; - Uint size = 0, n = 0; - DECLARE_ESTACK(stack); - DeclareTmpHeapNoproc(th,2); - UseTmpHeapNoproc(2); - - for (;;) { - switch(primary_tag(node)) { - case TAG_PRIMARY_LIST: - if (EQ(CAR(list_val(node)), key)) { - goto unroll; - } - goto not_found; - case TAG_PRIMARY_BOXED: - ptr = boxed_val(node); - hdr = *ptr; - ASSERT(is_header(hdr)); - - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - ix = hashmap_index(hx); - hx = hashmap_shift_hash(th,hx,lvl,key); - size += HAMT_HEAD_ARRAY_SZ; - ESTACK_PUSH2(stack, ix, node); - node = ptr[ix+2]; - break; - case HAMT_SUBTAG_NODE_BITMAP: - hval = MAP_HEADER_VAL(hdr); - ix = hashmap_index(hx); - bp = 1 << ix; - if (hval == 0xffff) { - slot = ix; - n = 16; - } else if (bp & hval) { - slot = hashmap_bitcount(hval & (bp - 1)); - n = hashmap_bitcount(hval); - } else { - /* not occupied */ - goto not_found; - } - - ESTACK_PUSH4(stack, n, bp, slot, node); - - hx = hashmap_shift_hash(th,hx,lvl,key); - node = ptr[slot+1]; - ASSERT(HAMT_NODE_BITMAP_SZ(n) <= 17); - size += HAMT_NODE_BITMAP_SZ(n); - break; - - case HAMT_SUBTAG_HEAD_BITMAP: - hval = MAP_HEADER_VAL(hdr); - ix = hashmap_index(hx); - bp = 1 << ix; - slot = hashmap_bitcount(hval & (bp - 1)); - n = hashmap_bitcount(hval); - - ESTACK_PUSH4(stack, n, bp, slot, node); - - /* occupied */ - if (bp & hval) { - hx = hashmap_shift_hash(th,hx,lvl,key); - node = ptr[slot+2]; - ASSERT(HAMT_HEAD_BITMAP_SZ(n) <= 18); - size += HAMT_HEAD_BITMAP_SZ(n); - break; - } - /* not occupied */ - goto not_found; - default: - erl_exit(1, "bad header tag %ld\r\n", hdr & _HEADER_MAP_SUBTAG_MASK); - break; - } - break; - default: - erl_exit(1, "bad primary tag %p\r\n", node); - break; - } - } - -unroll: - /* the size is bounded and atleast one less than the previous size */ - size -= 1; - n = hashmap_size(map) - 1; - - if (n <= MAP_SMALL_MAP_LIMIT) { - DECLARE_WSTACK(wstack); - Eterm *kv, *ks, *vs; - flatmap_t *mp; - Eterm keys; - - DESTROY_ESTACK(stack); - - /* build flat structure */ - hp = HAlloc(p, 3 + 1 + (2 * n)); - keys = make_tuple(hp); - *hp++ = make_arityval(n); - ks = hp; - hp += n; - mp = (flatmap_t*)hp; - hp += MAP_HEADER_FLATMAP_SZ; - vs = hp; - - mp->thing_word = MAP_HEADER_FLATMAP; - mp->size = n; - mp->keys = keys; - - hashmap_iterator_init(&wstack, map, 0); - - while ((kv=hashmap_iterator_next(&wstack)) != NULL) { - if (EQ(CAR(kv),key)) - continue; - *ks++ = CAR(kv); - *vs++ = CDR(kv); - } - - /* it cannot have multiple keys */ - erts_validate_and_sort_flatmap(mp); - - DESTROY_WSTACK(wstack); - UnUseTmpHeapNoproc(2); - return make_flatmap(mp); - } - - hp = HAlloc(p, size); - hp_end = hp + size; - res = THE_NON_VALUE; - - do { - node = ESTACK_POP(stack); - - /* all nodes are things */ - ptr = boxed_val(node); - hdr = *ptr; - ASSERT(is_header(hdr)); - - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - ix = (Uint) ESTACK_POP(stack); - nhp = hp; - if (res == THE_NON_VALUE) { - n = 16; - n -= ix; - *hp++ = MAP_HEADER_HAMT_HEAD_BITMAP(0xffff ^ (1 << ix)); ptr++; - *hp++ = (*ptr++) - 1; - while(ix--) { *hp++ = *ptr++; } - ptr++; n--; - while(n--) { *hp++ = *ptr++; } - res = make_hashmap(nhp); - } else { - n = 16; - *hp++ = MAP_HEADER_HAMT_HEAD_ARRAY; ptr++; - *hp++ = (*ptr++) - 1; - while(n--) { *hp++ = *ptr++; } - nhp[ix+2] = res; - res = make_hashmap(nhp); - } - break; - case HAMT_SUBTAG_NODE_BITMAP: - slot = (Uint) ESTACK_POP(stack); - bp = (Uint32) ESTACK_POP(stack); - n = (Uint32) ESTACK_POP(stack); - nhp = hp; - - /* bitmap change matrix - * res | none leaf bitmap - * ---------------------------- - * n=1 | remove remove keep - * n=2 | other keep keep - * n>2 | shrink keep keep - * - * other: (remember, n is 2) - * shrink if the other bitmap value is a bitmap node - * remove if the other bitmap value is a leaf - * - * remove: - * this bitmap node is removed, res is moved up in tree (could be none) - * this is a special case of shrink - * - * keep: - * the current path index is still used down in the tree, need to keep it - * copy as usual with the updated res - * - * shrink: - * the current path index is no longer used down in the tree, remove it (shrink) - */ - if (res == THE_NON_VALUE) { - if (n == 1) { - break; - } else if (n == 2) { - if (slot == 0) { - ix = 2; /* off by one 'cause hdr */ - } else { - ix = 1; /* off by one 'cause hdr */ - } - if (primary_tag(ptr[ix]) == TAG_PRIMARY_LIST) { - res = ptr[ix]; - } else { - hval = MAP_HEADER_VAL(hdr); - *hp++ = MAP_HEADER_HAMT_NODE_BITMAP(hval ^ bp); - *hp++ = ptr[ix]; - res = make_hashmap(nhp); - } - } else { - /* n > 2 */ - hval = MAP_HEADER_VAL(hdr); - *hp++ = MAP_HEADER_HAMT_NODE_BITMAP(hval ^ bp); ptr++; - n -= slot; - while(slot--) { *hp++ = *ptr++; } - ptr++; n--; - while(n--) { *hp++ = *ptr++; } - res = make_hashmap(nhp); - } - } else if (primary_tag(res) == TAG_PRIMARY_LIST && n == 1) { - break; - } else { - /* res is bitmap or leaf && n > 1, keep */ - n -= slot; - *hp++ = *ptr++; - while(slot--) { *hp++ = *ptr++; } - *hp++ = res; - ptr++; n--; - while(n--) { *hp++ = *ptr++; } - res = make_hashmap(nhp); - } - break; - case HAMT_SUBTAG_HEAD_BITMAP: - slot = (Uint) ESTACK_POP(stack); - bp = (Uint32) ESTACK_POP(stack); - n = (Uint32) ESTACK_POP(stack); - nhp = hp; - - if (res != THE_NON_VALUE) { - *hp++ = *ptr++; - *hp++ = (*ptr++) - 1; - n -= slot; - while(slot--) { *hp++ = *ptr++; } - *hp++ = res; - ptr++; n--; - while(n--) { *hp++ = *ptr++; } - } else { - hval = MAP_HEADER_VAL(hdr); - *hp++ = MAP_HEADER_HAMT_HEAD_BITMAP(hval ^ bp); ptr++; - *hp++ = (*ptr++) - 1; - n -= slot; - while(slot--) { *hp++ = *ptr++; } - ptr++; n--; - while(n--) { *hp++ = *ptr++; } - } - res = make_hashmap(nhp); - break; - default: - erl_exit(1, "bad header tag %x\r\n", hdr & _HEADER_MAP_SUBTAG_MASK); - break; - } - } while(!ESTACK_ISEMPTY(stack)); - HRelease(p, hp_end, hp); -not_found: - DESTROY_ESTACK(stack); - ERTS_VERIFY_UNUSED_TEMP_ALLOC(p); - ERTS_HOLE_CHECK(p); - UnUseTmpHeapNoproc(2); - return res; + BIF_ERROR(BIF_P, BADARG); } - -int erts_validate_and_sort_flatmap(flatmap_t* mp) +int erts_validate_and_sort_map(map_t* mp) { - Eterm *ks = flatmap_get_keys(mp); - Eterm *vs = flatmap_get_values(mp); - Uint sz = flatmap_get_size(mp); + Eterm *ks = map_get_keys(mp); + Eterm *vs = map_get_values(mp); + Uint sz = map_get_size(mp); Uint ix,jx; Eterm tmp; - Sint c; + int c; /* sort */ @@ -2631,62 +822,6 @@ return 1; } -#if 0 /* Can't get myself to remove this beautiful piece of code - for probabilistic overestimation of nr of nodes in a hashmap */ - -/* Really rough estimate of sqrt(x) - * Guaranteed not to be less than sqrt(x) - */ -static int int_sqrt_ceiling(Uint x) -{ - int n; - - if (x <= 2) - return x; - - n = erts_fit_in_bits_uint(x-1); - if (n & 1) { - /* Calc: sqrt(2^n) = 2^(n/2) * sqrt(2) ~= 2^(n/2) * 3 / 2 */ - return (1 << (n/2 - 1)) * 3; - } - else { - /* Calc: sqrt(2^n) = 2^(n/2) */ - return 1 << (n / 2); - } -} - -/* May not be enough if hashing is broken (not uniform) - * or if hell freezes over. - */ -Uint hashmap_overestimated_node_count(Uint k) -{ - /* k is nr of key-value pairs. - N(k) is expected nr of nodes in hamt. - - Observation: - For uniformly distributed hash values, average of N varies between - 0.3*k and 0.4*k (with a beautiful sine curve) - and standard deviation of N is about sqrt(k)/3. - - Assuming normal probability distribution, we overestimate nr of nodes - by 15 std.devs above the average, which gives a probability for overrun - less than 1.0e-49 (same magnitude as a git SHA1 collision). - */ - return 2*k/5 + 1 + (15/3)*int_sqrt_ceiling(k); -} -#endif - -BIF_RETTYPE erts_debug_map_info_1(BIF_ALIST_1) { - if (is_hashmap(BIF_ARG_1)) { - BIF_RET(hashmap_info(BIF_P,BIF_ARG_1)); - } else if (is_flatmap(BIF_ARG_1)) { - BIF_ERROR(BIF_P, BADARG); - } else { - BIF_P->fvalue = BIF_ARG_1; - BIF_ERROR(BIF_P, BADMAP); - } -} - /* * erts_internal:map_to_tuple_keys/1 * @@ -2694,225 +829,9 @@ */ BIF_RETTYPE erts_internal_map_to_tuple_keys_1(BIF_ALIST_1) { - if (is_flatmap(BIF_ARG_1)) { - flatmap_t *mp = (flatmap_t*)flatmap_val(BIF_ARG_1); - BIF_RET(mp->keys); - } else if (is_hashmap(BIF_ARG_1)) { - BIF_ERROR(BIF_P, BADARG); - } else { - BIF_P->fvalue = BIF_ARG_1; - BIF_ERROR(BIF_P, BADMAP); - } -} - -/* - * erts_internal:map_type/1 - * - * Used in erts_debug:size/1 - */ - -BIF_RETTYPE erts_internal_map_type_1(BIF_ALIST_1) { - DECL_AM(hashmap); - DECL_AM(hashmap_node); - DECL_AM(flatmap); if (is_map(BIF_ARG_1)) { - Eterm hdr = *(boxed_val(BIF_ARG_1)); - ASSERT(is_header(hdr)); - switch (hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_FLATMAP: - BIF_RET(AM_flatmap); - case HAMT_SUBTAG_HEAD_ARRAY: - case HAMT_SUBTAG_HEAD_BITMAP: - BIF_RET(AM_hashmap); - case HAMT_SUBTAG_NODE_BITMAP: - BIF_RET(AM_hashmap_node); - default: - erl_exit(1, "bad header"); - } - } - BIF_P->fvalue = BIF_ARG_1; - BIF_ERROR(BIF_P, BADMAP); -} - -/* - * erts_internal:map_hashmap_children/1 - * - * Used in erts_debug:size/1 - */ - -BIF_RETTYPE erts_internal_map_hashmap_children_1(BIF_ALIST_1) { - if (is_map(BIF_ARG_1)) { - Eterm node = BIF_ARG_1; - Eterm *ptr, hdr, *hp, res = NIL; - Uint sz = 0; - ptr = boxed_val(node); - hdr = *ptr; - ASSERT(is_header(hdr)); - - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_FLATMAP: - BIF_ERROR(BIF_P, BADARG); - case HAMT_SUBTAG_HEAD_BITMAP: - ptr++; - case HAMT_SUBTAG_NODE_BITMAP: - ptr++; - sz = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - break; - case HAMT_SUBTAG_HEAD_ARRAY: - sz = 16; - ptr += 2; - break; - default: - erl_exit(1, "bad header\r\n"); - break; - } - ASSERT(sz < 17); - hp = HAlloc(BIF_P, 2*sz); - while(sz--) { res = CONS(hp, *ptr++, res); hp += 2; } - BIF_RET(res); - } - BIF_P->fvalue = BIF_ARG_1; - BIF_ERROR(BIF_P, BADMAP); -} - - -static Eterm hashmap_info(Process *p, Eterm node) { - Eterm *hp; - Eterm res = NIL, info = NIL; - Eterm *ptr, tup, hdr; - Uint sz; - DECL_AM(depth); - DECL_AM(leafs); - DECL_AM(bitmaps); - DECL_AM(arrays); - Uint nleaf=0, nbitmap=0, narray=0; - Uint bitmap_usage[16], leaf_usage[16]; - Uint lvl = 0, clvl; - DECLARE_ESTACK(stack); - - for (sz = 0; sz < 16; sz++) { - bitmap_usage[sz] = 0; - leaf_usage[sz] = 0; - } - - ptr = boxed_val(node); - ESTACK_PUSH(stack, 0); - ESTACK_PUSH(stack, node); - do { - node = ESTACK_POP(stack); - clvl = ESTACK_POP(stack); - if (lvl < clvl) - lvl = clvl; - switch(primary_tag(node)) { - case TAG_PRIMARY_LIST: - nleaf++; - leaf_usage[clvl] += 1; - break; - case TAG_PRIMARY_BOXED: - ptr = boxed_val(node); - hdr = *ptr; - ASSERT(is_header(hdr)); - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_NODE_BITMAP: - nbitmap++; - sz = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - ASSERT(sz < 17); - bitmap_usage[sz-1] += 1; - while(sz--) { - ESTACK_PUSH(stack, clvl + 1); - ESTACK_PUSH(stack, ptr[sz+1]); - } - break; - case HAMT_SUBTAG_HEAD_BITMAP: - nbitmap++; - sz = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - bitmap_usage[sz-1] += 1; - while(sz--) { - ESTACK_PUSH(stack, clvl + 1); - ESTACK_PUSH(stack, ptr[sz+2]); - } - break; - case HAMT_SUBTAG_HEAD_ARRAY: - narray++; - sz = 16; - while(sz--) { - ESTACK_PUSH(stack, clvl + 1); - ESTACK_PUSH(stack, ptr[sz+2]); - } - break; - default: - erl_exit(1, "bad header\r\n"); - break; - } - } - } while(!ESTACK_ISEMPTY(stack)); - - - /* size */ - sz = 0; - hashmap_bld_tuple_uint(NULL,&sz,16,leaf_usage); - hashmap_bld_tuple_uint(NULL,&sz,16,bitmap_usage); - - /* alloc */ - hp = HAlloc(p, 2+3 + 3*(2+4) + sz); - - info = hashmap_bld_tuple_uint(&hp,NULL,16,leaf_usage); - tup = TUPLE3(hp, AM_leafs, make_small(nleaf),info); hp += 4; - res = CONS(hp, tup, res); hp += 2; - - info = hashmap_bld_tuple_uint(&hp,NULL,16,bitmap_usage); - tup = TUPLE3(hp, AM_bitmaps, make_small(nbitmap), info); hp += 4; - res = CONS(hp, tup, res); hp += 2; - - tup = TUPLE3(hp, AM_arrays, make_small(narray),NIL); hp += 4; - res = CONS(hp, tup, res); hp += 2; - - tup = TUPLE2(hp, AM_depth, make_small(lvl)); hp += 3; - res = CONS(hp, tup, res); hp += 2; - - DESTROY_ESTACK(stack); - ERTS_HOLE_CHECK(p); - return res; -} - -static Eterm hashmap_bld_tuple_uint(Uint **hpp, Uint *szp, Uint n, Uint nums[]) { - Eterm res = THE_NON_VALUE; - Eterm *ts = (Eterm *)erts_alloc(ERTS_ALC_T_TMP, n * sizeof(Eterm)); - Uint i; - - for (i = 0; i < n; i++) { - ts[i] = erts_bld_uint(hpp, szp, nums[i]); + map_t *mp = (map_t*)map_val(BIF_ARG_1); + BIF_RET(mp->keys); } - res = erts_bld_tuplev(hpp, szp, n, ts); - erts_free(ERTS_ALC_T_TMP, (void *) ts); - return res; -} - - -/* implementation of builtin emulations */ - -#if !ERTS_AT_LEAST_GCC_VSN__(3, 4, 0) -/* Count leading zeros emulation */ -Uint32 hashmap_clz(Uint32 x) { - Uint32 y; - int n = 32; - y = x >>16; if (y != 0) {n = n -16; x = y;} - y = x >> 8; if (y != 0) {n = n - 8; x = y;} - y = x >> 4; if (y != 0) {n = n - 4; x = y;} - y = x >> 2; if (y != 0) {n = n - 2; x = y;} - y = x >> 1; if (y != 0) return n - 2; - return n - x; -} - -const Uint32 SK5 = 0x55555555, SK3 = 0x33333333; -const Uint32 SKF0 = 0xF0F0F0F, SKFF = 0xFF00FF; - -/* CTPOP emulation */ -Uint32 hashmap_bitcount(Uint32 x) { - x -= ((x >> 1 ) & SK5); - x = (x & SK3 ) + ((x >> 2 ) & SK3 ); - x = (x & SKF0) + ((x >> 4 ) & SKF0); - x += x >> 8; - return (x + (x >> 16)) & 0x3F; + BIF_ERROR(BIF_P, BADARG); } -#endif diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_map.h erlang-17.3-dfsg/erts/emulator/beam/erl_map.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_map.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_map.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -23,23 +22,13 @@ #define __ERL_MAP_H__ #include "sys.h" - -/* instrinsic wrappers */ -#if ERTS_AT_LEAST_GCC_VSN__(3, 4, 0) -#define hashmap_clz(x) ((Uint32) __builtin_clz((unsigned int)(x))) -#define hashmap_bitcount(x) ((Uint32) __builtin_popcount((unsigned int) (x))) -#else -Uint32 hashmap_clz(Uint32 x); -Uint32 hashmap_bitcount(Uint32 x); -#endif - /* MAP */ -typedef struct flatmap_s { +typedef struct map_s { Eterm thing_word; Uint size; Eterm keys; /* tuple */ -} flatmap_t; +} map_t; /* map node * * ----------- @@ -53,159 +42,31 @@ * ----------- */ -/* the head-node is a bitmap or array with an untagged size */ - - -#define hashmap_size(x) (((hashmap_head_t*) hashmap_val(x))->size) -#define hashmap_size_rel(RTERM, BASE) hashmap_size(rterm2wterm(RTERM, BASE)) -#define hashmap_make_hash(Key) make_internal_hash(Key) - -#define hashmap_restore_hash(Heap,Lvl,Key) \ - (((Lvl) < 8) ? hashmap_make_hash(Key) >> (4*(Lvl)) : hashmap_make_hash(CONS(Heap, make_small((Lvl)>>3), (Key))) >> (4*((Lvl) & 7))) -#define hashmap_shift_hash(Heap,Hx,Lvl,Key) \ - (((++(Lvl)) & 7) ? (Hx) >> 4 : hashmap_make_hash(CONS(Heap, make_small((Lvl)>>3), Key))) /* erl_term.h stuff */ -#define flatmap_get_values(x) (((Eterm *)(x)) + 3) -#define flatmap_get_keys(x) (((Eterm *)tuple_val(((flatmap_t *)(x))->keys)) + 1) -#define flatmap_get_size(x) (((flatmap_t*)(x))->size) - -#ifdef DEBUG -#define MAP_SMALL_MAP_LIMIT (3) -#else -#define MAP_SMALL_MAP_LIMIT (32) -#endif - -struct ErtsWStack_; -struct ErtsEStack_; - -Eterm erts_maps_put(Process *p, Eterm key, Eterm value, Eterm map); -int erts_maps_update(Process *p, Eterm key, Eterm value, Eterm map, Eterm *res); -int erts_maps_remove(Process *p, Eterm key, Eterm map, Eterm *res); - -Eterm erts_hashmap_insert(Process *p, Uint32 hx, Eterm key, Eterm value, - Eterm node, int is_update); -int erts_hashmap_insert_down(Uint32 hx, Eterm key, Eterm node, Uint *sz, - Uint *upsz, struct ErtsEStack_ *sp, int is_update); -Eterm erts_hashmap_insert_up(Eterm *hp, Eterm key, Eterm value, - Uint *upsz, struct ErtsEStack_ *sp); - -int erts_validate_and_sort_flatmap(flatmap_t* map); -void hashmap_iterator_init(struct ErtsWStack_* s, Eterm node, int reverse); -Eterm* hashmap_iterator_next(struct ErtsWStack_* s); -Eterm* hashmap_iterator_prev(struct ErtsWStack_* s); -int hashmap_key_hash_cmp(Eterm* ap, Eterm* bp); -Eterm erts_hashmap_from_array(ErtsHeapFactory*, Eterm *leafs, Uint n, int reject_dupkeys); - -#define erts_hashmap_from_ks_and_vs(P, KS, VS, N) \ - erts_hashmap_from_ks_and_vs_extra((P), (KS), (VS), (N), THE_NON_VALUE, THE_NON_VALUE); - -Eterm erts_hashmap_from_ks_and_vs_extra(Process *p, Eterm *ks, Eterm *vs, Uint n, - Eterm k, Eterm v); - -const Eterm * -#if HALFWORD_HEAP -erts_maps_get_rel(Eterm key, Eterm map, Eterm *map_base); -# define erts_maps_get(A, B) erts_maps_get_rel(A, B, NULL) -#else -erts_maps_get(Eterm key, Eterm map); -# define erts_maps_get_rel(A, B, B_BASE) erts_maps_get(A, B) +#define make_map(x) make_boxed((Eterm*)(x)) +#define make_map_rel(x, BASE) make_boxed_rel((Eterm*)(x),(BASE)) +#define is_map(x) (is_boxed((x)) && is_map_header(*boxed_val((x)))) +#define is_map_rel(RTERM,BASE) is_map(rterm2wterm(RTERM,BASE)) +#define is_not_map(x) (!is_map((x))) +#define is_map_header(x) (((x) & (_TAG_HEADER_MASK)) == _TAG_HEADER_MAP) +#define header_is_map(x) ((((x) & (_HEADER_SUBTAG_MASK)) == MAP_SUBTAG)) +#define map_val(x) (_unchecked_boxed_val((x))) +#define map_val_rel(RTERM, BASE) map_val(rterm2wterm(RTERM, BASE)) + +#define map_get_values(x) (((Eterm *)(x)) + 3) +#define map_get_keys(x) (((Eterm *)tuple_val(((map_t *)(x))->keys)) + 1) +#define map_get_size(x) (((map_t*)(x))->size) + +#define MAP_HEADER _make_header(1,_TAG_HEADER_MAP) +#define MAP_HEADER_SIZE (sizeof(map_t) / sizeof(Eterm)) + +Eterm erts_maps_put(Process *p, Eterm key, Eterm value, Eterm map); +int erts_maps_update(Process *p, Eterm key, Eterm value, Eterm map, Eterm *res); +int erts_maps_find(Eterm key, Eterm map, Eterm *value); +int erts_maps_get(Eterm key, Eterm map, Eterm *value); +int erts_maps_remove(Process *p, Eterm key, Eterm map, Eterm *res); +int erts_validate_and_sort_map(map_t* map); #endif -const Eterm * -#if HALFWORD_HEAP -erts_hashmap_get_rel(Uint32 hx, Eterm key, Eterm node, Eterm *map_base); -# define erts_hashmap_get(Hx, K, M) erts_hashmap_get_rel(Hx, K, M, NULL) -#else -erts_hashmap_get(Uint32 hx, Eterm key, Eterm map); -# define erts_hashmap_get_rel(Hx, K, M, M_BASE) erts_hashmap_get(Hx, K, M) -#endif - -/* hamt nodes v2.0 - * - * node :: leaf | array | bitmap - * head - */ -typedef struct hashmap_head_s { - Eterm thing_word; - Uint size; - Eterm items[1]; -} hashmap_head_t; - -/* thing_word tagscheme - * Need two bits for map subtags - * - * Original HEADER representation: - * - * aaaaaaaaaaaaaaaa aaaaaaaaaatttt00 arity:26, tag:4 - * - * For maps we have: - * - * vvvvvvvvvvvvvvvv aaaaaaaamm111100 val:16, arity:8, mtype:2 - * - * unsure about trailing zeros - * - * map-tag: - * 00 - flat map tag (non-hamt) -> val:16 = #items - * 01 - map-node bitmap tag -> val:16 = bitmap - * 10 - map-head (array-node) -> val:16 = 0xffff - * 11 - map-head (bitmap-node) -> val:16 = bitmap - */ - -/* erl_map.h stuff */ - -#define is_hashmap_header_head(x) ((MAP_HEADER_TYPE(x) & (0x2))) - -#define MAKE_MAP_HEADER(Type,Arity,Val) \ - (_make_header(((((Uint16)(Val)) << MAP_HEADER_ARITY_SZ) | (Arity)) << MAP_HEADER_TAG_SZ | (Type) , _TAG_HEADER_MAP)) - -#define MAP_HEADER_FLATMAP \ - MAKE_MAP_HEADER(MAP_HEADER_TAG_FLATMAP_HEAD,0x1,0x0) - -#define MAP_HEADER_HAMT_HEAD_ARRAY \ - MAKE_MAP_HEADER(MAP_HEADER_TAG_HAMT_HEAD_ARRAY,0x1,0xffff) - -#define MAP_HEADER_HAMT_HEAD_BITMAP(Bmp) \ - MAKE_MAP_HEADER(MAP_HEADER_TAG_HAMT_HEAD_BITMAP,0x1,Bmp) - -#define MAP_HEADER_HAMT_NODE_BITMAP(Bmp) \ - MAKE_MAP_HEADER(MAP_HEADER_TAG_HAMT_NODE_BITMAP,0x0,Bmp) - -#define MAP_HEADER_FLATMAP_SZ (sizeof(flatmap_t) / sizeof(Eterm)) - -#define HAMT_NODE_ARRAY_SZ (17) -#define HAMT_HEAD_ARRAY_SZ (18) -#define HAMT_NODE_BITMAP_SZ(n) (1 + n) -#define HAMT_HEAD_BITMAP_SZ(n) (2 + n) - -/* 2 bits maps tag + 4 bits subtag + 2 ignore bits */ -#define _HEADER_MAP_SUBTAG_MASK (0xfc) -/* 1 bit map tag + 1 ignore bit + 4 bits subtag + 2 ignore bits */ -#define _HEADER_MAP_HASHMAP_HEAD_MASK (0xbc) - -#define HAMT_SUBTAG_NODE_BITMAP ((MAP_HEADER_TAG_HAMT_NODE_BITMAP << _HEADER_ARITY_OFFS) | MAP_SUBTAG) -#define HAMT_SUBTAG_HEAD_ARRAY ((MAP_HEADER_TAG_HAMT_HEAD_ARRAY << _HEADER_ARITY_OFFS) | MAP_SUBTAG) -#define HAMT_SUBTAG_HEAD_BITMAP ((MAP_HEADER_TAG_HAMT_HEAD_BITMAP << _HEADER_ARITY_OFFS) | MAP_SUBTAG) -#define HAMT_SUBTAG_HEAD_FLATMAP ((MAP_HEADER_TAG_FLATMAP_HEAD << _HEADER_ARITY_OFFS) | MAP_SUBTAG) - -#define hashmap_index(hash) (((Uint32)hash) & 0xf) - -/* hashmap heap size: - [one cons cell + one list term in parent node] per key - [one header + one boxed term in parent node] per inner node - [one header + one size word] for root node - Observed average number of nodes per key is about 0.35. -*/ -#define HASHMAP_WORDS_PER_KEY 3 -#define HASHMAP_WORDS_PER_NODE 2 -#ifdef DEBUG -# define HASHMAP_ESTIMATED_TOT_NODE_SIZE(KEYS) \ - (HASHMAP_WORDS_PER_NODE * (KEYS) * 3/10) /* slightly under estimated */ -#else -# define HASHMAP_ESTIMATED_TOT_NODE_SIZE(KEYS) \ - (HASHMAP_WORDS_PER_NODE * (KEYS) * 4/10) /* slightly over estimated */ -#endif -#define HASHMAP_ESTIMATED_HEAP_SIZE(KEYS) \ - ((KEYS)*HASHMAP_WORDS_PER_KEY + HASHMAP_ESTIMATED_TOT_NODE_SIZE(KEYS)) -#endif diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_math.c erlang-17.3-dfsg/erts/emulator/beam/erl_math.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_math.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_math.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -208,24 +207,6 @@ return math_call_1(BIF_P, log, BIF_ARG_1); } -#ifdef HAVE_LOG2 -static double -log2_wrapper(double x) -{ - return log2(x); -} -#else -static double -log2_wrapper(double x) -{ - return log(x) / 0.6931471805599453; /* log(2.0); */ -} -#endif - -BIF_RETTYPE math_log2_1(BIF_ALIST_1) -{ - return math_call_1(BIF_P, log2_wrapper, BIF_ARG_1); -} BIF_RETTYPE math_log10_1(BIF_ALIST_1) { diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_message.c erlang-17.3-dfsg/erts/emulator/beam/erl_message.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_message.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_message.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -94,6 +93,9 @@ #endif ErlHeapFragment* nbp; + /* ToDo: Make use of 'used_size' to avoid realloc + when shrinking just a few words */ + #ifdef DEBUG { Uint off_sz = size < bp->used_size ? size : bp->used_size; @@ -108,10 +110,8 @@ } #endif - if (size >= (bp->used_size - bp->used_size / 16)) { - bp->used_size = size; + if (size == bp->used_size) return bp; - } #ifdef HARD_DEBUG dbg_brefs = erts_alloc(ERTS_ALC_T_UNDEF, sizeof(Eterm *)*brefs_size); @@ -237,7 +237,8 @@ Eterm msg; Uint tok_sz = 0; Eterm *hp = NULL; - ErtsHeapFactory factory; + Eterm *hp_end = NULL; + ErlOffHeap *ohp; Sint sz; *bpp = NULL; @@ -249,26 +250,36 @@ tok_sz = heap_frag->used_size; sz += tok_sz; } - if (pp) { - ErlOffHeap *ohp; + if (pp) hp = erts_alloc_message_heap(sz, bpp, &ohp, pp, plcksp); - } else { *bpp = new_message_buffer(sz); hp = (*bpp)->mem; + ohp = &(*bpp)->off_heap; } - erts_factory_message_init(&factory, pp, hp, *bpp); - msg = erts_decode_dist_ext(&factory, dist_extp); + hp_end = hp + sz; + msg = erts_decode_dist_ext(&hp, ohp, dist_extp); if (is_non_value(msg)) goto decode_error; if (is_not_nil(*tokenp)) { ErlHeapFragment *heap_frag = erts_dist_ext_trailer(dist_extp); - hp = erts_produce_heap(&factory, tok_sz, 0); - *tokenp = copy_struct(*tokenp, tok_sz, &hp, factory.off_heap); + *tokenp = copy_struct(*tokenp, tok_sz, &hp, ohp); erts_cleanup_offheap(&heap_frag->off_heap); } erts_free_dist_ext_copy(dist_extp); - erts_factory_close(&factory); + if (hp_end != hp) { + if (!(*bpp)) { + HRelease(pp, hp_end, hp); + } + else { + Uint final_size = hp - &(*bpp)->mem[0]; + Eterm brefs[2] = {msg, *tokenp}; + ASSERT(sz - (hp_end - hp) == final_size); + *bpp = erts_resize_message_buffer(*bpp, final_size, &brefs[0], 2); + msg = brefs[0]; + *tokenp = brefs[1]; + } + } return msg; decode_error: @@ -277,7 +288,13 @@ erts_cleanup_offheap(&heap_frag->off_heap); } erts_free_dist_ext_copy(dist_extp); - *bpp = NULL; + if (*bpp) { + free_message_buffer(*bpp); + *bpp = NULL; + } + else if (hp) { + HRelease(pp, hp_end, hp); + } return THE_NON_VALUE; } @@ -352,7 +369,11 @@ tok_label, tok_lastcnt, tok_serial); } #endif - erts_queue_message(rcvr, rcvr_locks, mbuf, msg, token); + erts_queue_message(rcvr, rcvr_locks, mbuf, msg, token +#ifdef USE_VM_PROBES + , NIL +#endif + ); } else { /* Enqueue message on external format */ @@ -542,15 +563,15 @@ } void +erts_queue_message(Process* receiver, + ErtsProcLocks *receiver_locks, + ErlHeapFragment* bp, + Eterm message, + Eterm seq_trace_token #ifdef USE_VM_PROBES -erts_queue_message_probe(Process* receiver, ErtsProcLocks *receiver_locks, - ErlHeapFragment* bp, - Eterm message, Eterm seq_trace_token, Eterm dt_utag) -#else -erts_queue_message(Process* receiver, ErtsProcLocks *receiver_locks, - ErlHeapFragment* bp, - Eterm message, Eterm seq_trace_token) + , Eterm dt_utag #endif + ) { queue_message(NULL, receiver, @@ -834,11 +855,10 @@ } void -erts_move_msg_attached_data_to_heap(ErtsHeapFactory* factory, - ErlMessage *msg) +erts_move_msg_attached_data_to_heap(Eterm **hpp, ErlOffHeap *ohp, ErlMessage *msg) { if (is_value(ERL_MESSAGE_TERM(msg))) - erts_move_msg_mbuf_to_heap(&factory->hp, factory->off_heap, msg); + erts_move_msg_mbuf_to_heap(hpp, ohp, msg); else if (msg->data.dist_ext) { ASSERT(msg->data.dist_ext->heap_size >= 0); if (is_not_nil(ERL_MESSAGE_TOKEN(msg))) { @@ -846,11 +866,12 @@ heap_frag = erts_dist_ext_trailer(msg->data.dist_ext); ERL_MESSAGE_TOKEN(msg) = copy_struct(ERL_MESSAGE_TOKEN(msg), heap_frag->used_size, - &factory->hp, - factory->off_heap); + hpp, + ohp); erts_cleanup_offheap(&heap_frag->off_heap); } - ERL_MESSAGE_TERM(msg) = erts_decode_dist_ext(factory, + ERL_MESSAGE_TERM(msg) = erts_decode_dist_ext(hpp, + ohp, msg->data.dist_ext); erts_free_dist_ext_copy(msg->data.dist_ext); msg->data.dist_ext = NULL; @@ -1096,7 +1117,11 @@ /* the trace token must in this case be updated by the caller */ seq_trace_output(token, save, SEQ_TRACE_SEND, to->common.id, NULL); temptoken = copy_struct(token, sz_token, &hp, &bp->off_heap); - erts_queue_message(to, to_locksp, bp, save, temptoken); + erts_queue_message(to, to_locksp, bp, save, temptoken +#ifdef USE_VM_PROBES + , NIL +#endif + ); } else { ErlOffHeap *ohp; sz_reason = size_object(reason); @@ -1113,313 +1138,11 @@ ? from : copy_struct(from, sz_from, &hp, ohp)); save = TUPLE3(hp, am_EXIT, from_copy, mess); - erts_queue_message(to, to_locksp, bp, save, NIL); - } -} - -void erts_factory_proc_init(ErtsHeapFactory* factory, - Process* p) -{ - erts_factory_proc_prealloc_init(factory, p, HEAP_LIMIT(p) - HEAP_TOP(p)); -} - -void erts_factory_proc_prealloc_init(ErtsHeapFactory* factory, - Process* p, - Sint size) -{ - factory->mode = FACTORY_HALLOC; - factory->p = p; - factory->hp_start = HAlloc(p, size); - factory->hp = factory->hp_start; - factory->hp_end = factory->hp_start + size; - factory->off_heap = &p->off_heap; - factory->off_heap_saved.first = p->off_heap.first; - factory->off_heap_saved.overhead = p->off_heap.overhead; - factory->heap_frags_saved = p->mbuf; - factory->heap_frags = NULL; /* not used */ - factory->alloc_type = 0; /* not used */ -} - -void erts_factory_message_init(ErtsHeapFactory* factory, - Process* rp, - Eterm* hp, - ErlHeapFragment* bp) -{ - if (bp) { - factory->mode = FACTORY_HEAP_FRAGS; - factory->p = NULL; - factory->hp_start = bp->mem; - factory->hp = hp ? hp : bp->mem; - factory->hp_end = bp->mem + bp->alloc_size; - factory->off_heap = &bp->off_heap; - factory->heap_frags = bp; - factory->heap_frags_saved = bp; - factory->alloc_type = ERTS_ALC_T_HEAP_FRAG; - ASSERT(!bp->next); - } - else { - factory->mode = FACTORY_HALLOC; - factory->p = rp; - factory->hp_start = hp; - factory->hp = hp; - factory->hp_end = HEAP_TOP(rp); - factory->off_heap = &rp->off_heap; - factory->heap_frags_saved = rp->mbuf; - factory->heap_frags = NULL; /* not used */ - factory->alloc_type = 0; /* not used */ - } - factory->off_heap_saved.first = factory->off_heap->first; - factory->off_heap_saved.overhead = factory->off_heap->overhead; - - ASSERT(factory->hp >= factory->hp_start && factory->hp <= factory->hp_end); -} - -/* One static sized heap that must suffice. - No extra heap fragments will be allocated. -*/ -void erts_factory_static_init(ErtsHeapFactory* factory, - Eterm* hp, - Uint size, - ErlOffHeap* off_heap) -{ - factory->mode = FACTORY_STATIC; - factory->hp_start = hp; - factory->hp = hp; - factory->hp_end = hp + size; - factory->off_heap = off_heap; - factory->off_heap_saved.first = factory->off_heap->first; - factory->off_heap_saved.overhead = factory->off_heap->overhead; -} - -/* A temporary heap with default buffer allocated/freed by client. - * factory_close is same as factory_undo - */ -void erts_factory_tmp_init(ErtsHeapFactory* factory, Eterm* hp, Uint size, - Uint32 atype) -{ - factory->mode = FACTORY_TMP; - factory->hp_start = hp; - factory->hp = hp; - factory->hp_end = hp + size; - factory->heap_frags = NULL; - factory->off_heap_saved.first = NULL; - factory->off_heap_saved.overhead = 0; - factory->off_heap = &factory->off_heap_saved; - factory->alloc_type = atype; -} - -/* When we know the term is an immediate and need no heap. -*/ -void erts_factory_dummy_init(ErtsHeapFactory* factory) -{ - factory->mode = FACTORY_CLOSED; -} - -static void reserve_heap(ErtsHeapFactory*, Uint need, Uint xtra); - -Eterm* erts_produce_heap(ErtsHeapFactory* factory, Uint need, Uint xtra) -{ - Eterm* res; - - ASSERT((unsigned int)factory->mode > (unsigned int)FACTORY_CLOSED); - if (factory->hp + need > factory->hp_end) { - reserve_heap(factory, need, xtra); - } - res = factory->hp; - factory->hp += need; - return res; -} - -Eterm* erts_reserve_heap(ErtsHeapFactory* factory, Uint need) -{ - ASSERT((unsigned int)factory->mode > (unsigned int)FACTORY_CLOSED); - if (factory->hp + need > factory->hp_end) { - reserve_heap(factory, need, 200); - } - return factory->hp; -} - -static void reserve_heap(ErtsHeapFactory* factory, Uint need, Uint xtra) -{ - ErlHeapFragment* bp; - - switch (factory->mode) { - case FACTORY_HALLOC: - HRelease(factory->p, factory->hp_end, factory->hp); - factory->hp = HAllocX(factory->p, need, xtra); - factory->hp_end = factory->hp + need; - return; - - case FACTORY_HEAP_FRAGS: - case FACTORY_TMP: - bp = factory->heap_frags; - - if (bp) { - ASSERT(factory->hp > bp->mem); - ASSERT(factory->hp <= factory->hp_end); - ASSERT(factory->hp_end == bp->mem + bp->alloc_size); - - bp->used_size = factory->hp - bp->mem; - } - bp = (ErlHeapFragment*) ERTS_HEAP_ALLOC(factory->alloc_type, - ERTS_HEAP_FRAG_SIZE(need+xtra)); - bp->next = factory->heap_frags; - factory->heap_frags = bp; - bp->alloc_size = need + xtra; - bp->used_size = need; - bp->off_heap.first = NULL; - bp->off_heap.overhead = 0; - - factory->hp = bp->mem; - factory->hp_end = bp->mem + bp->alloc_size; - return; - - case FACTORY_STATIC: - case FACTORY_CLOSED: - default: - ASSERT(!"Invalid factory mode"); - } -} - -void erts_factory_close(ErtsHeapFactory* factory) -{ - ErlHeapFragment* bp; - - switch (factory->mode) { - case FACTORY_HALLOC: - HRelease(factory->p, factory->hp_end, factory->hp); - break; - - case FACTORY_HEAP_FRAGS: - bp = factory->heap_frags; - - if (bp) { - ASSERT(factory->hp >= bp->mem); - ASSERT(factory->hp <= factory->hp_end); - ASSERT(factory->hp_end == bp->mem + bp->alloc_size); - - bp->used_size = factory->hp - bp->mem; - } - break; - case FACTORY_TMP: - erts_factory_undo(factory); - break; - case FACTORY_STATIC: break; - case FACTORY_CLOSED: break; - default: - ASSERT(!"Invalid factory mode"); - } - factory->mode = FACTORY_CLOSED; -} - -void erts_factory_trim_and_close(ErtsHeapFactory* factory, - Eterm *brefs, Uint brefs_size) -{ - if (factory->mode == FACTORY_HEAP_FRAGS) { - ErlHeapFragment* bp = factory->heap_frags; - if (bp->next == NULL) { - Uint used_sz = factory->hp - bp->mem; - ASSERT(used_sz <= bp->alloc_size); - factory->heap_frags = erts_resize_message_buffer(bp, used_sz, - brefs, brefs_size); - factory->mode = FACTORY_CLOSED; - return; - } - /*else we don't trim multi fragmented messages for now */ - } - erts_factory_close(factory); -} - -void erts_factory_undo(ErtsHeapFactory* factory) -{ - ErlHeapFragment* bp; - struct erl_off_heap_header *hdr, **hdr_nextp; - - switch (factory->mode) { - case FACTORY_HALLOC: - case FACTORY_STATIC: - /* Cleanup off-heap - */ - hdr_nextp = NULL; - for (hdr = factory->off_heap->first; - hdr != factory->off_heap_saved.first; - hdr = hdr->next) { - - hdr_nextp = &hdr->next; - } - - if (hdr_nextp != NULL) { - *hdr_nextp = NULL; - erts_cleanup_offheap(factory->off_heap); - factory->off_heap->first = factory->off_heap_saved.first; - factory->off_heap->overhead = factory->off_heap_saved.overhead; - } - - if (factory->mode == FACTORY_HALLOC) { - /* Free heap frags - */ - bp = factory->p->mbuf; - if (bp != factory->heap_frags_saved) { - do { - ErlHeapFragment *next_bp = bp->next; - ASSERT(bp->off_heap.first == NULL); - ERTS_HEAP_FREE(ERTS_ALC_T_HEAP_FRAG, (void *) bp, - ERTS_HEAP_FRAG_SIZE(bp->alloc_size)); - bp = next_bp; - } while (bp != factory->heap_frags_saved); - - factory->p->mbuf = bp; - } - - /* Rollback heap top - */ - if (factory->heap_frags_saved == NULL) { /* No heap frags when we started */ - ASSERT(factory->hp_start >= HEAP_START(factory->p)); - ASSERT(factory->hp_start <= HEAP_LIMIT(factory->p)); - - HEAP_TOP(factory->p) = factory->hp_start; - } - else { - ASSERT(factory->heap_frags_saved == factory->p->mbuf); - if (factory->hp_start == factory->heap_frags_saved->mem) { - factory->p->mbuf = factory->p->mbuf->next; - ERTS_HEAP_FREE(ERTS_ALC_T_HEAP_FRAG, factory->heap_frags_saved, - ERTS_HEAP_FRAG_SIZE(factory->heap_frags_saved->alloc_size)); - } - else if (factory->hp_start != factory->hp_end) { - unsigned remains = factory->hp_start - factory->heap_frags_saved->mem; - ASSERT(remains > 0 && remains < factory->heap_frags_saved->used_size); - factory->heap_frags_saved->used_size = remains; - } - } - } - break; - - case FACTORY_TMP: - case FACTORY_HEAP_FRAGS: - erts_cleanup_offheap(factory->off_heap); - factory->off_heap->first = NULL; - - bp = factory->heap_frags; - while (bp != NULL) { - ErlHeapFragment* next_bp = bp->next; - - ASSERT(bp->off_heap.first == NULL); - ERTS_HEAP_FREE(factory->alloc_type, (void *) bp, - ERTS_HEAP_FRAG_SIZE(bp->alloc_size)); - bp = next_bp; - } - break; - - case FACTORY_CLOSED: break; - default: - ASSERT(!"Invalid factory mode"); - } - factory->mode = FACTORY_CLOSED; -#ifdef DEBUG - factory->p = NULL; - factory->hp = NULL; - factory->heap_frags = NULL; + erts_queue_message(to, to_locksp, bp, save, NIL +#ifdef USE_VM_PROBES + , NIL #endif + ); + } } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_message.h erlang-17.3-dfsg/erts/emulator/beam/erl_message.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_message.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_message.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -52,47 +51,6 @@ (OHP)->first = NULL; \ (OHP)->overhead = 0; \ } while (0) - -typedef struct { - enum { - FACTORY_CLOSED = 0, - FACTORY_HALLOC, - FACTORY_HEAP_FRAGS, - FACTORY_STATIC, - FACTORY_TMP - } mode; - Process* p; - Eterm* hp_start; - Eterm* hp; - Eterm* hp_end; - struct erl_heap_fragment* heap_frags; - struct erl_heap_fragment* heap_frags_saved; - ErlOffHeap* off_heap; - ErlOffHeap off_heap_saved; - Uint32 alloc_type; -} ErtsHeapFactory; - -void erts_factory_proc_init(ErtsHeapFactory*, Process*); -void erts_factory_proc_prealloc_init(ErtsHeapFactory*, Process*, Sint size); -void erts_factory_message_init(ErtsHeapFactory*, Process*, Eterm* hp, struct erl_heap_fragment*); -void erts_factory_static_init(ErtsHeapFactory*, Eterm* hp, Uint size, ErlOffHeap*); -void erts_factory_tmp_init(ErtsHeapFactory*, Eterm* hp, Uint size, Uint32 atype); -void erts_factory_dummy_init(ErtsHeapFactory*); - -Eterm* erts_produce_heap(ErtsHeapFactory*, Uint need, Uint xtra); -Eterm* erts_reserve_heap(ErtsHeapFactory*, Uint need); -void erts_factory_close(ErtsHeapFactory*); -void erts_factory_trim_and_close(ErtsHeapFactory*,Eterm *brefs, Uint brefs_size); -void erts_factory_undo(ErtsHeapFactory*); - -#ifdef CHECK_FOR_HOLES -# define ERTS_FACTORY_HOLE_CHECK(f) do { \ - /*if ((f)->p) erts_check_for_holes((f)->p);*/ \ - } while (0) -#else -# define ERTS_FACTORY_HOLE_CHECK(p) -#endif - #include "external.h" #include "erl_process.h" @@ -166,7 +124,7 @@ *(p)->msg.last = (mp); \ (p)->msg.last = &(mp)->next; \ (p)->msg.len++; \ -} while (0) +} while(0) #ifdef ERTS_SMP @@ -239,23 +197,17 @@ do { \ if ((M)->data.attached) { \ Uint need__ = erts_msg_attached_data_size((M)); \ - { SWPO ; } \ if ((ST) - (HT) >= need__) { \ - ErtsHeapFactory factory__; \ - erts_factory_proc_prealloc_init(&factory__, (P), need__); \ - erts_move_msg_attached_data_to_heap(&factory__, (M)); \ - erts_factory_close(&factory__); \ - if ((P)->mbuf != NULL) { \ - /* Heap was exhausted by messages. This is a rare case */ \ - /* that can currently (OTP 18) only happen if hamts are */ \ - /* far exceeding the estimated heap size. Do GC. */ \ - (FC) -= erts_garbage_collect((P), 0, NULL, 0); \ - } \ + Uint *htop__ = (HT); \ + erts_move_msg_attached_data_to_heap(&htop__, &MSO((P)), (M));\ + ASSERT(htop__ - (HT) <= need__); \ + (HT) = htop__; \ } \ else { \ + { SWPO ; } \ (FC) -= erts_garbage_collect((P), 0, NULL, 0); \ + { SWPI ; } \ } \ - { SWPI ; } \ ASSERT(!(M)->data.attached); \ } \ } while (0) @@ -281,17 +233,11 @@ Eterm *, Uint); void free_message_buffer(ErlHeapFragment *); void erts_queue_dist_message(Process*, ErtsProcLocks*, ErtsDistExternal *, Eterm); +void erts_queue_message(Process*, ErtsProcLocks*, ErlHeapFragment*, Eterm, Eterm #ifdef USE_VM_PROBES -void erts_queue_message_probe(Process*, ErtsProcLocks*, ErlHeapFragment*, - Eterm message, Eterm seq_trace_token, Eterm dt_utag); -#define erts_queue_message(RP,RL,BP,Msg,SEQ) \ - erts_queue_message_probe((RP),(RL),(BP),(Msg),(SEQ),NIL) -#else -void erts_queue_message(Process*, ErtsProcLocks*, ErlHeapFragment*, - Eterm message, Eterm seq_trace_token); -#define erts_queue_message_probe(RP,RL,BP,Msg,SEQ,TAG) \ - erts_queue_message((RP),(RL),(BP),(Msg),(SEQ)) + , Eterm dt_utag #endif +); void erts_deliver_exit_message(Eterm, Process*, ErtsProcLocks *, Eterm, Eterm); Sint erts_send_message(Process*, Process*, ErtsProcLocks*, Eterm, unsigned); void erts_link_mbuf_to_proc(Process *proc, ErlHeapFragment *bp); @@ -299,21 +245,23 @@ void erts_move_msg_mbuf_to_heap(Eterm**, ErlOffHeap*, ErlMessage *); Uint erts_msg_attached_data_size_aux(ErlMessage *msg); -void erts_move_msg_attached_data_to_heap(ErtsHeapFactory*, ErlMessage *); +void erts_move_msg_attached_data_to_heap(Eterm **, ErlOffHeap *, ErlMessage *); + Eterm erts_msg_distext2heap(Process *, ErtsProcLocks *, ErlHeapFragment **, Eterm *, ErtsDistExternal *); void erts_cleanup_offheap(ErlOffHeap *offheap); -ERTS_GLB_INLINE Uint erts_used_frag_sz(const ErlHeapFragment*); +ERTS_GLB_INLINE Uint erts_msg_used_frag_sz(const ErlMessage *msg); ERTS_GLB_INLINE Uint erts_msg_attached_data_size(ErlMessage *msg); #if ERTS_GLB_INLINE_INCL_FUNC_DEF -ERTS_GLB_INLINE Uint erts_used_frag_sz(const ErlHeapFragment* bp) +ERTS_GLB_INLINE Uint erts_msg_used_frag_sz(const ErlMessage *msg) { + const ErlHeapFragment *bp; Uint sz = 0; - for ( ; bp!=NULL; bp=bp->next) { + for (bp = msg->data.heap_frag; bp!=NULL; bp=bp->next) { sz += bp->used_size; } return sz; @@ -323,7 +271,7 @@ { ASSERT(msg->data.attached); if (is_value(ERL_MESSAGE_TERM(msg))) - return erts_used_frag_sz(msg->data.heap_frag); + return erts_msg_used_frag_sz(msg); else if (msg->data.dist_ext->heap_size < 0) return erts_msg_attached_data_size_aux(msg); else { diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_monitors.c erlang-17.3-dfsg/erts/emulator/beam/erl_monitors.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_monitors.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_monitors.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_monitors.h erlang-17.3-dfsg/erts/emulator/beam/erl_monitors.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_monitors.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_monitors.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -83,7 +82,6 @@ /* Type tags for monitors */ #define MON_ORIGIN 1 #define MON_TARGET 3 -#define MON_TIME_OFFSET 7 /* Type tags for links */ #define LINK_PID 1 /* ...Or port */ @@ -105,7 +103,7 @@ typedef struct erts_monitor { struct erts_monitor *left, *right; Sint16 balance; - Uint16 type; /* MON_ORIGIN | MON_TARGET | MON_TIME_OFFSET */ + Uint16 type; /* MON_ORIGIN | MON_TARGET */ Eterm ref; Eterm pid; /* In case of distributed named monitor, this is the nodename atom in MON_ORIGIN process, otherwise a pid or diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_mtrace.c erlang-17.3-dfsg/erts/emulator/beam/erl_mtrace.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_mtrace.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_mtrace.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -628,7 +627,7 @@ if (erts_mtrace_enabled) { int i; /* Install trace functions */ - ERTS_CT_ASSERT(sizeof(erts_allctrs) == sizeof(real_allctrs)); + ASSERT(sizeof(erts_allctrs) == sizeof(real_allctrs)); sys_memcpy((void *) real_allctrs, (void *) erts_allctrs, diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_mtrace.h erlang-17.3-dfsg/erts/emulator/beam/erl_mtrace.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_mtrace.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_mtrace.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_nif_api_funcs.h erlang-17.3-dfsg/erts/emulator/beam/erl_nif_api_funcs.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_nif_api_funcs.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_nif_api_funcs.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -157,9 +156,6 @@ ERL_NIF_API_FUNC_DECL(int, enif_map_iterator_prev, (ErlNifEnv *env, ErlNifMapIterator *iter)); ERL_NIF_API_FUNC_DECL(int, enif_map_iterator_get_pair, (ErlNifEnv *env, ErlNifMapIterator *iter, ERL_NIF_TERM *key, ERL_NIF_TERM *value)); ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_schedule_nif,(ErlNifEnv*,const char*,int,ERL_NIF_TERM (*)(ErlNifEnv*,int,const ERL_NIF_TERM[]),int,const ERL_NIF_TERM[])); -ERL_NIF_API_FUNC_DECL(int, enif_has_pending_exception, (ErlNifEnv *env, ERL_NIF_TERM* reason)); -ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM, enif_raise_exception, (ErlNifEnv *env, ERL_NIF_TERM reason)); -ERL_NIF_API_FUNC_DECL(int,enif_getenv,(const char* key, char* value, size_t* value_size)); /* ** ADD NEW ENTRIES HERE (before this comment) !!! @@ -309,9 +305,6 @@ # define enif_map_iterator_prev ERL_NIF_API_FUNC_MACRO(enif_map_iterator_prev) # define enif_map_iterator_get_pair ERL_NIF_API_FUNC_MACRO(enif_map_iterator_get_pair) # define enif_schedule_nif ERL_NIF_API_FUNC_MACRO(enif_schedule_nif) -# define enif_has_pending_exception ERL_NIF_API_FUNC_MACRO(enif_has_pending_exception) -# define enif_raise_exception ERL_NIF_API_FUNC_MACRO(enif_raise_exception) -# define enif_getenv ERL_NIF_API_FUNC_MACRO(enif_getenv) /* ** ADD NEW ENTRIES HERE (before this comment) @@ -545,7 +538,7 @@ #ifndef enif_make_pid -# define enif_make_pid(ENV, PID) ((void)(ENV),(const ERL_NIF_TERM)((PID)->pid)) +# define enif_make_pid(ENV, PID) ((const ERL_NIF_TERM)((PID)->pid)) #if SIZEOF_LONG == 8 # define enif_get_int64 enif_get_long diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_nif.c erlang-17.3-dfsg/erts/emulator/beam/erl_nif.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_nif.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_nif.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -37,7 +36,6 @@ #include "erl_thr_progress.h" #include "dtrace-wrapper.h" #include "erl_process.h" -#include "erl_bif_unique.h" #if defined(USE_DYNAMIC_TRACE) && (defined(USE_DTRACE) || defined(USE_SYSTEMTAP)) #define HAVE_USE_DTRACE 1 #endif @@ -129,7 +127,6 @@ env->heap_frag = NULL; env->fpe_was_unmasked = erts_block_fpe(); env->tmp_obj_list = NULL; - env->exception_thrown = 0; } static void pre_nif_noproc(ErlNifEnv* env, struct erl_module_nif* mod_nif) @@ -337,7 +334,7 @@ rp = (scheduler ? erts_proc_lookup(receiver) : erts_pid2proc_opt(c_p, ERTS_PROC_LOCK_MAIN, - receiver, rp_locks, ERTS_P2P_FLG_INC_REFC)); + receiver, rp_locks, ERTS_P2P_FLG_SMP_INC_REFC)); if (rp == NULL) { ASSERT(env == NULL || receiver != c_p->common.id); return 0; @@ -359,13 +356,17 @@ if (flush_me) { flush_env(env); /* Needed for ERTS_HOLE_CHECK */ } - erts_queue_message(rp, &rp_locks, frags, msg, am_undefined); + erts_queue_message(rp, &rp_locks, frags, msg, am_undefined +#ifdef USE_VM_PROBES + , NIL +#endif + ); if (c_p == rp) rp_locks &= ~ERTS_PROC_LOCK_MAIN; if (rp_locks) erts_smp_proc_unlock(rp, rp_locks); if (!scheduler) - erts_proc_dec_refc(rp); + erts_smp_proc_dec_refc(rp); if (flush_me) { cache_env(env); } @@ -446,7 +447,7 @@ int enif_is_exception(ErlNifEnv* env, ERL_NIF_TERM term) { - return env->exception_thrown && term == THE_NON_VALUE; + return term == THE_NON_VALUE; } int enif_is_number(ErlNifEnv* env, ERL_NIF_TERM term) @@ -550,7 +551,9 @@ if (refbin == NULL) { return 0; /* The NIF must take action */ } + refbin->flags = BIN_FLAG_DRV; /* BUGBUG: Flag? */ erts_refc_init(&refbin->refc, 1); + refbin->orig_size = (SWord) size; bin->size = size; bin->data = (unsigned char*) refbin->orig_bytes; @@ -570,6 +573,7 @@ if (!newbin) { return 0; } + newbin->orig_size = size; bin->ref_bin = newbin; bin->data = (unsigned char*) newbin->orig_bytes; bin->size = size; @@ -738,22 +742,7 @@ Eterm enif_make_badarg(ErlNifEnv* env) { - return enif_raise_exception(env, am_badarg); -} - -Eterm enif_raise_exception(ErlNifEnv* env, ERL_NIF_TERM reason) -{ - env->exception_thrown = 1; - env->proc->fvalue = reason; - BIF_ERROR(env->proc, EXC_ERROR); -} - -int enif_has_pending_exception(ErlNifEnv* env, ERL_NIF_TERM* reason) -{ - if (env->exception_thrown && reason != NULL) { - *reason = env->proc->fvalue; - } - return env->exception_thrown; + BIF_ERROR(env->proc, BADARG); } int enif_get_atom(ErlNifEnv* env, Eterm atom, char* buf, unsigned len, @@ -975,12 +964,8 @@ ERL_NIF_TERM enif_make_double(ErlNifEnv* env, double d) { - Eterm* hp; + Eterm* hp = alloc_heap(env,FLOAT_SIZE_OBJECT); FloatDef f; - - if (!erts_isfinite(d)) - return enif_make_badarg(env); - hp = alloc_heap(env,FLOAT_SIZE_OBJECT); f.fd = d; PUT_DOUBLE(f, hp); return make_float(hp); @@ -993,8 +978,6 @@ ERL_NIF_TERM enif_make_atom_len(ErlNifEnv* env, const char* name, size_t len) { - if (len > MAX_ATOM_CHARACTERS) - return enif_make_badarg(env); return erts_atom_put((byte*)name, len, ERTS_ATOM_ENC_LATIN1, 1); } @@ -1008,8 +991,6 @@ ERL_NIF_TERM* atom, ErlNifCharEncoding encoding) { ASSERT(encoding == ERL_NIF_LATIN1); - if (len > MAX_ATOM_CHARACTERS) - return 0; return erts_atom_get(name, len, atom, ERTS_ATOM_ENC_LATIN1); } @@ -1173,7 +1154,6 @@ int enif_equal_tids(ErlNifTid tid1, ErlNifTid tid2) { return erl_drv_equal_tids(tid1,tid2); } void enif_thread_exit(void *resp) { erl_drv_thread_exit(resp); } int enif_thread_join(ErlNifTid tid, void **respp) { return erl_drv_thread_join(tid,respp); } -int enif_getenv(const char *key, char *value, size_t *value_size) { return erl_drv_getenv(key, value, value_size); } int enif_fprintf(void* filep, const char* format, ...) { @@ -1210,11 +1190,7 @@ struct enif_resource_type_t* type; #ifdef DEBUG erts_refc_t nif_refc; -# ifdef ARCH_32 - byte align__[4]; -# endif #endif - char data[1]; }ErlNifResource; @@ -1390,7 +1366,7 @@ static void nif_resource_dtor(Binary* bin) { - ErlNifResource* resource = (ErlNifResource*) ERTS_MAGIC_BIN_UNALIGNED_DATA(bin); + ErlNifResource* resource = (ErlNifResource*) ERTS_MAGIC_BIN_DATA(bin); ErlNifResourceType* type = resource->type; ASSERT(ERTS_MAGIC_BIN_DESTRUCTOR(bin) == &nif_resource_dtor); @@ -1411,10 +1387,8 @@ void* enif_alloc_resource(ErlNifResourceType* type, size_t size) { - Binary* bin = erts_create_magic_binary_x(SIZEOF_ErlNifResource(size), - &nif_resource_dtor, - 1); /* unaligned */ - ErlNifResource* resource = ERTS_MAGIC_BIN_UNALIGNED_DATA(bin); + Binary* bin = erts_create_magic_binary(SIZEOF_ErlNifResource(size), &nif_resource_dtor); + ErlNifResource* resource = ERTS_MAGIC_BIN_DATA(bin); ASSERT(type->owner && type->next && type->prev); /* not allowed in load/upgrade */ resource->type = type; @@ -1429,7 +1403,7 @@ void enif_release_resource(void* obj) { ErlNifResource* resource = DATA_TO_RESOURCE(obj); - ErtsBinary* bin = ERTS_MAGIC_BIN_FROM_UNALIGNED_DATA(resource); + ErtsBinary* bin = ERTS_MAGIC_BIN_FROM_DATA(resource); ASSERT(ERTS_MAGIC_BIN_DESTRUCTOR(bin) == &nif_resource_dtor); #ifdef DEBUG @@ -1443,7 +1417,7 @@ void enif_keep_resource(void* obj) { ErlNifResource* resource = DATA_TO_RESOURCE(obj); - ErtsBinary* bin = ERTS_MAGIC_BIN_FROM_UNALIGNED_DATA(resource); + ErtsBinary* bin = ERTS_MAGIC_BIN_FROM_DATA(resource); ASSERT(ERTS_MAGIC_BIN_DESTRUCTOR(bin) == &nif_resource_dtor); #ifdef DEBUG @@ -1455,7 +1429,7 @@ ERL_NIF_TERM enif_make_resource(ErlNifEnv* env, void* obj) { ErlNifResource* resource = DATA_TO_RESOURCE(obj); - ErtsBinary* bin = ERTS_MAGIC_BIN_FROM_UNALIGNED_DATA(resource); + ErtsBinary* bin = ERTS_MAGIC_BIN_FROM_DATA(resource); Eterm* hp = alloc_heap(env,PROC_BIN_SIZE); return erts_mk_magic_binary_term(&hp, &MSO(env->proc), &bin->binary); } @@ -1484,7 +1458,7 @@ return 0; / * Or should we allow "resource binaries" as handles? * / }*/ mbin = pb->val; - resource = (ErlNifResource*) ERTS_MAGIC_BIN_UNALIGNED_DATA(mbin); + resource = (ErlNifResource*) ERTS_MAGIC_BIN_DATA(mbin); if (ERTS_MAGIC_BIN_DESTRUCTOR(mbin) != &nif_resource_dtor || resource->type != type) { return 0; @@ -1496,8 +1470,8 @@ size_t enif_sizeof_resource(void* obj) { ErlNifResource* resource = DATA_TO_RESOURCE(obj); - Binary* bin = &ERTS_MAGIC_BIN_FROM_UNALIGNED_DATA(resource)->binary; - return ERTS_MAGIC_BIN_UNALIGNED_DATA_SIZE(bin) - offsetof(ErlNifResource,data); + Binary* bin = &ERTS_MAGIC_BIN_FROM_DATA(resource)->binary; + return ERTS_MAGIC_BIN_DATA_SIZE(bin) - offsetof(ErlNifResource,data); } @@ -1555,13 +1529,12 @@ * NIF exports need a few more items than the Export struct provides, * including the erl_module_nif* and a NIF function pointer, so the * NifExport below adds those. The Export member must be first in the - * struct. The saved_mfa, exception_thrown, saved_argc, rootset_extra, and - * rootset members are used to track the MFA, any pending exception, and - * arguments of the top NIF in case a chain of one or more - * enif_schedule_nif() calls results in an exception, since in that case - * the original MFA and registers have to be restored before returning to - * Erlang to ensure stacktrace information associated with the exception is - * correct. + * struct. The saved_mfa, saved_argc, nif_level, alloced_argv_sz and argv + * members are used to track the MFA and arguments of the top NIF in case a + * chain of one or more enif_schedule_nif() calls results in an exception, + * since in that case the original MFA and registers have to be restored + * before returning to Erlang to ensure stacktrace information associated + * with the exception is correct. */ typedef ERL_NIF_TERM (*NativeFunPtr)(ErlNifEnv*, int, const ERL_NIF_TERM[]); @@ -1570,28 +1543,25 @@ struct erl_module_nif* m; NativeFunPtr fp; Eterm saved_mfa[3]; - int exception_thrown; int saved_argc; - int rootset_extra; - Eterm rootset[1]; + int alloced_argv_sz; + Eterm argv[1]; } NifExport; /* * If a process has saved arguments, they need to be part of the GC * rootset. The function below is called from setup_rootset() in - * erl_gc.c. This function is declared in erl_process.h. Any exception term - * saved in the NifExport is also made part of the GC rootset here; it - * always resides in rootset[0]. + * erl_gc.c. This function is declared in erl_process.h. */ int erts_setup_nif_gc(Process* proc, Eterm** objv, int* nobj) { NifExport* ep = (NifExport*) ERTS_PROC_GET_NIF_TRAP_EXPORT(proc); - int gc = ep && (ep->saved_argc > 0 || ep->rootset[0] != NIL); + int gc = (ep && ep->saved_argc > 0); if (gc) { - *objv = ep->rootset; - *nobj = 1 + ep->saved_argc; + *objv = ep->argv; + *nobj = ep->saved_argc; } return gc; } @@ -1603,14 +1573,14 @@ allocate_nif_sched_data(Process* proc, int argc) { NifExport* ep; - size_t total; + size_t argv_extra, total; int i; - total = sizeof(NifExport) + argc*sizeof(Eterm); + argv_extra = argc > 1 ? sizeof(Eterm)*(argc-1) : 0; + total = sizeof(NifExport) + argv_extra; ep = erts_alloc(ERTS_ALC_T_NIF_TRAP_EXPORT, total); sys_memset((void*) ep, 0, total); - ep->rootset_extra = argc; - ep->rootset[0] = NIL; + ep->alloced_argv_sz = argc; for (i=0; iexp.addressv[i] = &ep->exp.code[3]; } @@ -1651,22 +1621,15 @@ ep = (NifExport*) ERTS_PROC_GET_NIF_TRAP_EXPORT(proc); if (!ep) ep = allocate_nif_sched_data(proc, argc); - else if (need_save && ep->rootset_extra < argc) { + else if (need_save && ep->alloced_argv_sz < argc) { NifExport* new_ep = allocate_nif_sched_data(proc, argc); destroy_nif_export(ep); ep = new_ep; } - if (env->exception_thrown) { - ep->exception_thrown = 1; - ep->rootset[0] = env->proc->fvalue; - } else { - ep->exception_thrown = 0; - ep->rootset[0] = NIL; - } ERTS_VBUMP_ALL_REDS(proc); for (i = 0; i < argc; i++) { if (need_save) - ep->rootset[i+1] = reg[i]; + ep->argv[i] = reg[i]; reg[i] = (Eterm) argv[i]; } if (need_save) { @@ -1683,7 +1646,6 @@ ep->m = env->mod_nif; ep->fp = indirect_fp; proc->freason = TRAP; - proc->arity = argc; return THE_NON_VALUE; } @@ -1702,7 +1664,7 @@ proc->current[2] = ep->saved_mfa[2]; if (exception) for (i = 0; i < ep->saved_argc; i++) - reg[i] = ep->rootset[i+1]; + reg[i] = ep->argv[i]; ep->saved_argc = 0; ep->saved_mfa[0] = THE_NON_VALUE; } @@ -1727,7 +1689,6 @@ ASSERT(!ERTS_SCHEDULER_IS_DIRTY(env->proc->scheduler_data)); ep = (NifExport*) ERTS_PROC_GET_NIF_TRAP_EXPORT(proc); ASSERT(ep); - ASSERT(!ep->exception_thrown); if (ep->fp) restore_nif_mfa(proc, ep, 0); return argv[0]; @@ -1745,10 +1706,9 @@ ASSERT(!ERTS_SCHEDULER_IS_DIRTY(env->proc->scheduler_data)); ep = (NifExport*) ERTS_PROC_GET_NIF_TRAP_EXPORT(proc); ASSERT(ep); - ASSERT(ep->exception_thrown); if (ep->fp) restore_nif_mfa(proc, ep, 1); - return enif_raise_exception(env, ep->rootset[0]); + return enif_make_badarg(env); } /* @@ -1793,13 +1753,14 @@ ASSERT(ep); if (ep->fp) fp = NULL; - if (is_non_value(result) || env->exception_thrown) { + if (is_non_value(result)) { if (proc->freason != TRAP) { + ASSERT(proc->freason == BADARG); return init_nif_sched_data(env, dirty_nif_exception, fp, 0, argc, argv); } else { if (ep->fp == NULL) restore_nif_mfa(proc, ep, 1); - return THE_NON_VALUE; + return result; } } else @@ -1873,7 +1834,6 @@ NifExport* ep; ERL_NIF_TERM result; - ASSERT(!env->exception_thrown); ep = (NifExport*) ERTS_PROC_GET_NIF_TRAP_EXPORT(proc); ASSERT(ep); ep->fp = NULL; @@ -1886,7 +1846,7 @@ * which case we need to restore the original NIF MFA. */ if (ep->fp == NULL) - restore_nif_mfa(proc, ep, env->exception_thrown); + restore_nif_mfa(proc, ep, is_non_value(result) && proc->freason != TRAP); return result; } @@ -1952,33 +1912,29 @@ int enif_get_map_size(ErlNifEnv* env, ERL_NIF_TERM term, size_t *size) { - if (is_flatmap(term)) { - flatmap_t *mp; - mp = (flatmap_t*)flatmap_val(term); - *size = flatmap_get_size(mp); + if (is_map(term)) { + map_t *mp; + mp = (map_t*)map_val(term); + *size = map_get_size(mp); return 1; } - else if (is_hashmap(term)) { - *size = hashmap_size(term); - return 1; - } return 0; } ERL_NIF_TERM enif_make_new_map(ErlNifEnv* env) { - Eterm* hp = alloc_heap(env,MAP_HEADER_FLATMAP_SZ+1); + Eterm* hp = alloc_heap(env,MAP_HEADER_SIZE+1); Eterm tup; - flatmap_t *mp; + map_t *mp; tup = make_tuple(hp); *hp++ = make_arityval(0); - mp = (flatmap_t*)hp; - mp->thing_word = MAP_HEADER_FLATMAP; + mp = (map_t*)hp; + mp->thing_word = MAP_HEADER; mp->size = 0; mp->keys = tup; - return make_flatmap(mp); + return make_map(mp); } int enif_make_map_put(ErlNifEnv* env, @@ -1987,7 +1943,7 @@ Eterm value, Eterm *map_out) { - if (!is_map(map_in)) { + if (is_not_map(map_in)) { return 0; } flush_env(env); @@ -2001,16 +1957,10 @@ Eterm key, Eterm *value) { - const Eterm *ret; - if (!is_map(map)) { + if (is_not_map(map)) { return 0; } - ret = erts_maps_get(key, map); - if (ret) { - *value = *ret; - return 1; - } - return 0; + return erts_maps_get(key, map, value); } int enif_make_map_update(ErlNifEnv* env, @@ -2020,7 +1970,7 @@ Eterm *map_out) { int res; - if (!is_map(map_in)) { + if (is_not_map(map_in)) { return 0; } @@ -2036,7 +1986,7 @@ Eterm *map_out) { int res; - if (!is_map(map_in)) { + if (is_not_map(map_in)) { return 0; } flush_env(env); @@ -2050,13 +2000,13 @@ ErlNifMapIterator *iter, ErlNifMapIteratorEntry entry) { - if (is_flatmap(map)) { - flatmap_t *mp = (flatmap_t*)flatmap_val(map); + if (is_map(map)) { + map_t *mp = (map_t*)map_val(map); size_t offset; switch (entry) { - case ERL_NIF_MAP_ITERATOR_FIRST: offset = 0; break; - case ERL_NIF_MAP_ITERATOR_LAST: offset = flatmap_get_size(mp) - 1; break; + case ERL_NIF_MAP_ITERATOR_HEAD: offset = 0; break; + case ERL_NIF_MAP_ITERATOR_TAIL: offset = map_get_size(mp) - 1; break; default: goto error; } @@ -2065,37 +2015,14 @@ */ iter->map = map; - iter->u.flat.ks = ((Eterm *)flatmap_get_keys(mp)) + offset; - iter->u.flat.vs = ((Eterm *)flatmap_get_values(mp)) + offset; - iter->size = flatmap_get_size(mp); + iter->ks = ((Eterm *)map_get_keys(mp)) + offset; + iter->vs = ((Eterm *)map_get_values(mp)) + offset; + iter->t_limit = map_get_size(mp) + 1; iter->idx = offset + 1; return 1; } - else if (is_hashmap(map)) { - iter->map = map; - iter->size = hashmap_size(map); - iter->u.hash.wstack = erts_alloc(ERTS_ALC_T_NIF, sizeof(ErtsDynamicWStack)); - WSTACK_INIT(iter->u.hash.wstack, ERTS_ALC_T_NIF); - - switch (entry) { - case ERL_NIF_MAP_ITERATOR_FIRST: - iter->idx = 1; - hashmap_iterator_init(&iter->u.hash.wstack->ws, map, 0); - iter->u.hash.kv = hashmap_iterator_next(&iter->u.hash.wstack->ws); - break; - case ERL_NIF_MAP_ITERATOR_LAST: - iter->idx = hashmap_size(map); - hashmap_iterator_init(&iter->u.hash.wstack->ws, map, 1); - iter->u.hash.kv = hashmap_iterator_prev(&iter->u.hash.wstack->ws); - break; - default: - goto error; - } - ASSERT(!!iter->u.hash.kv == (iter->idx >= 1 && - iter->idx <= iter->size)); - return 1; - } + error: #ifdef DEBUG iter->map = THE_NON_VALUE; @@ -2105,97 +2032,48 @@ void enif_map_iterator_destroy(ErlNifEnv *env, ErlNifMapIterator *iter) { - if (is_hashmap(iter->map)) { - WSTACK_DESTROY(iter->u.hash.wstack->ws); - erts_free(ERTS_ALC_T_NIF, iter->u.hash.wstack); - } - else - ASSERT(is_flatmap(iter->map)); - + /* not used */ #ifdef DEBUG iter->map = THE_NON_VALUE; #endif + } int enif_map_iterator_is_tail(ErlNifEnv *env, ErlNifMapIterator *iter) { - ASSERT(iter); - if (is_flatmap(iter->map)) { - ASSERT(iter->idx >= 0); - ASSERT(iter->idx <= flatmap_get_size(flatmap_val(iter->map)) + 1); - return (iter->size == 0 || iter->idx > iter->size); - } - else { - ASSERT(is_hashmap(iter->map)); - return iter->idx > iter->size; - } + ASSERT(iter && is_map(iter->map)); + ASSERT(iter->idx >= 0 && (iter->idx <= map_get_size(map_val(iter->map)) + 1)); + return (iter->t_limit == 1 || iter->idx == iter->t_limit); } int enif_map_iterator_is_head(ErlNifEnv *env, ErlNifMapIterator *iter) { - ASSERT(iter); - if (is_flatmap(iter->map)) { - ASSERT(iter->idx >= 0); - ASSERT(iter->idx <= flatmap_get_size(flatmap_val(iter->map)) + 1); - return (iter->size == 0 || iter->idx == 0); - } - else { - ASSERT(is_hashmap(iter->map)); - return iter->idx == 0; - } + ASSERT(iter && is_map(iter->map)); + ASSERT(iter->idx >= 0 && (iter->idx <= map_get_size(map_val(iter->map)) + 1)); + return (iter->t_limit == 1 || iter->idx == 0); } int enif_map_iterator_next(ErlNifEnv *env, ErlNifMapIterator *iter) { - ASSERT(iter); - if (is_flatmap(iter->map)) { - if (iter->idx <= iter->size) { - iter->idx++; - iter->u.flat.ks++; - iter->u.flat.vs++; - } - return (iter->idx <= iter->size); - } - else { - ASSERT(is_hashmap(iter->map)); - - if (iter->idx <= hashmap_size(iter->map)) { - if (iter->idx < 1) { - hashmap_iterator_init(&iter->u.hash.wstack->ws, iter->map, 0); - } - iter->u.hash.kv = hashmap_iterator_next(&iter->u.hash.wstack->ws); - iter->idx++; - ASSERT(!!iter->u.hash.kv == (iter->idx <= iter->size)); - } - return iter->idx <= iter->size; + ASSERT(iter && is_map(iter->map)); + if (iter->idx < iter->t_limit) { + iter->idx++; + iter->ks++; + iter->vs++; } + return (iter->idx != iter->t_limit); } int enif_map_iterator_prev(ErlNifEnv *env, ErlNifMapIterator *iter) { - ASSERT(iter); - if (is_flatmap(iter->map)) { - if (iter->idx > 0) { - iter->idx--; - iter->u.flat.ks--; - iter->u.flat.vs--; - } - return iter->idx > 0; - } - else { - ASSERT(is_hashmap(iter->map)); - - if (iter->idx > 0) { - if (iter->idx > iter->size) { - hashmap_iterator_init(&iter->u.hash.wstack->ws, iter->map, 1); - } - iter->u.hash.kv = hashmap_iterator_prev(&iter->u.hash.wstack->ws); - iter->idx--; - ASSERT(!!iter->u.hash.kv == (iter->idx > 0)); - } - return iter->idx > 0; + ASSERT(iter && is_map(iter->map)); + if (iter->idx > 0) { + iter->idx--; + iter->ks--; + iter->vs--; } + return (iter->idx > 0); } int enif_map_iterator_get_pair(ErlNifEnv *env, @@ -2203,25 +2081,15 @@ Eterm *key, Eterm *value) { - ASSERT(iter); - if (is_flatmap(iter->map)) { - if (iter->idx > 0 && iter->idx <= iter->size) { - ASSERT(iter->u.flat.ks >= flatmap_get_keys(flatmap_val(iter->map)) && - iter->u.flat.ks < (flatmap_get_keys(flatmap_val(iter->map)) + flatmap_get_size(flatmap_val(iter->map)))); - ASSERT(iter->u.flat.vs >= flatmap_get_values(flatmap_val(iter->map)) && - iter->u.flat.vs < (flatmap_get_values(flatmap_val(iter->map)) + flatmap_get_size(flatmap_val(iter->map)))); - *key = *(iter->u.flat.ks); - *value = *(iter->u.flat.vs); - return 1; - } - } - else { - ASSERT(is_hashmap(iter->map)); - if (iter->idx > 0 && iter->idx <= iter->size) { - *key = CAR(iter->u.hash.kv); - *value = CDR(iter->u.hash.kv); - return 1; - } + ASSERT(iter && is_map(iter->map)); + if (iter->idx > 0 && iter->idx < iter->t_limit) { + ASSERT(iter->ks >= map_get_keys(map_val(iter->map)) && + iter->ks < (map_get_keys(map_val(iter->map)) + map_get_size(map_val(iter->map)))); + ASSERT(iter->vs >= map_get_values(map_val(iter->map)) && + iter->vs < (map_get_values(map_val(iter->map)) + map_get_size(map_val(iter->map)))); + *key = *(iter->ks); + *value = *(iter->vs); + return 1; } return 0; } @@ -2720,8 +2588,6 @@ void erl_nif_init() { - ERTS_CT_ASSERT((offsetof(ErlNifResource,data) % 8) == ERTS_MAGIC_BIN_BYTES_TO_ALIGN); - resource_type_list.next = &resource_type_list; resource_type_list.prev = &resource_type_list; resource_type_list.dtor = NULL; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_nif.h erlang-17.3-dfsg/erts/emulator/beam/erl_nif.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_nif.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_nif.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -47,11 +46,9 @@ ** remove enif_schedule_dirty_nif, enif_schedule_dirty_nif_finalizer, enif_dirty_nif_finalizer ** add ErlNifEntry options ** add ErlNifFunc flags -** 2.8: 18.0 add enif_has_pending_exception -** 2.9: 18.2 enif_getenv */ #define ERL_NIF_MAJOR_VERSION 2 -#define ERL_NIF_MINOR_VERSION 9 +#define ERL_NIF_MINOR_VERSION 7 /* * The emulator will refuse to load a nif-lib with a major version @@ -204,35 +201,22 @@ typedef struct /* All fields all internal and may change */ { ERL_NIF_TERM map; - ERL_NIF_UINT size; + ERL_NIF_UINT t_limit; ERL_NIF_UINT idx; - union { - struct { - ERL_NIF_TERM *ks; - ERL_NIF_TERM *vs; - }flat; - struct { - struct ErtsDynamicWStack_* wstack; - ERL_NIF_TERM* kv; - }hash; - }u; + ERL_NIF_TERM *ks; + ERL_NIF_TERM *vs; void* __spare__[2]; /* for future additions to be ABI compatible (same struct size) */ } ErlNifMapIterator; typedef enum { - ERL_NIF_MAP_ITERATOR_FIRST = 1, - ERL_NIF_MAP_ITERATOR_LAST = 2, - - /* deprecated synonyms (undocumented in 17 and 18-rc) */ - ERL_NIF_MAP_ITERATOR_HEAD = ERL_NIF_MAP_ITERATOR_FIRST, - ERL_NIF_MAP_ITERATOR_TAIL = ERL_NIF_MAP_ITERATOR_LAST + ERL_NIF_MAP_ITERATOR_HEAD = 1, + ERL_NIF_MAP_ITERATOR_TAIL = 2 } ErlNifMapIteratorEntry; #if (defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_)) # define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) RET_TYPE (*NAME) ARGS typedef struct { # include "erl_nif_api_funcs.h" - void* erts_alc_test; } TWinDynNifCallbacks; extern TWinDynNifCallbacks WinDynNifCallbacks; # undef ERL_NIF_API_FUNC_DECL @@ -257,10 +241,21 @@ # else # define ERL_NIF_INIT_DECL(MODNAME) __declspec(dllexport) ErlNifEntry* nif_init(TWinDynNifCallbacks* callbacks) # endif -# define ERL_NIF_INIT_BODY memcpy(&WinDynNifCallbacks,callbacks,sizeof(TWinDynNifCallbacks)) +# ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT +# define ERL_NIF_INIT_BODY do { \ + memcpy(&WinDynNifCallbacks,callbacks,sizeof(TWinDynNifCallbacks)); \ + entry.options = ERL_NIF_DIRTY_NIF_OPTION; \ + } while(0) +# else +# define ERL_NIF_INIT_BODY memcpy(&WinDynNifCallbacks,callbacks,sizeof(TWinDynNifCallbacks)) +# endif #else # define ERL_NIF_INIT_GLOB -# define ERL_NIF_INIT_BODY +# ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT +# define ERL_NIF_INIT_BODY entry.options = ERL_NIF_DIRTY_NIF_OPTION +# else +# define ERL_NIF_INIT_BODY +# endif # ifdef STATIC_ERLANG_NIF # define ERL_NIF_INIT_DECL(MODNAME) ErlNifEntry* MODNAME ## _nif_init(void) # else @@ -268,11 +263,6 @@ # endif #endif -#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT -# define ERL_NIF_ENTRY_OPTIONS ERL_NIF_DIRTY_NIF_OPTION -#else -# define ERL_NIF_ENTRY_OPTIONS 0 -#endif #ifdef __cplusplus } @@ -298,8 +288,7 @@ sizeof(FUNCS) / sizeof(*FUNCS), \ FUNCS, \ LOAD, RELOAD, UPGRADE, UNLOAD, \ - ERL_NIF_VM_VARIANT, \ - ERL_NIF_ENTRY_OPTIONS \ + ERL_NIF_VM_VARIANT \ }; \ ERL_NIF_INIT_BODY; \ return &entry; \ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_node_container_utils.h erlang-17.3-dfsg/erts/emulator/beam/erl_node_container_utils.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_node_container_utils.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_node_container_utils.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_node_tables.c erlang-17.3-dfsg/erts/emulator/beam/erl_node_tables.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_node_tables.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_node_tables.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -37,24 +36,21 @@ DistEntry *erts_hidden_dist_entries; DistEntry *erts_visible_dist_entries; -DistEntry *erts_not_connected_dist_entries; /* including erts_this_dist_entry */ +DistEntry *erts_not_connected_dist_entries; Sint erts_no_of_hidden_dist_entries; Sint erts_no_of_visible_dist_entries; -Sint erts_no_of_not_connected_dist_entries; /* including erts_this_dist_entry */ +Sint erts_no_of_not_connected_dist_entries; DistEntry *erts_this_dist_entry; ErlNode *erts_this_node; char erts_this_node_sysname_BUFFER[256], *erts_this_node_sysname = "uninitialized yet"; -static Uint node_entries = 0; -static Uint dist_entries = 0; +static Uint node_entries; +static Uint dist_entries; static int references_atoms_need_init = 1; -static ErtsMonotonicTime orig_node_tab_delete_delay; -static ErtsMonotonicTime node_tab_delete_delay; - /* -- The distribution table ---------------------------------------------- */ #ifdef DEBUG @@ -91,6 +87,9 @@ erts_smp_rwmtx_opt_t rwmtx_opt = ERTS_SMP_RWMTX_OPT_DEFAULT_INITER; rwmtx_opt.type = ERTS_SMP_RWMTX_TYPE_FREQUENT_READ; + if(((DistEntry *) dep_tmpl) == erts_this_dist_entry) + return dep_tmpl; + sysname = ((DistEntry *) dep_tmpl)->sysname; chnl_nr = make_small((Uint) atom_val(sysname)); dep = (DistEntry *) erts_alloc(ERTS_ALC_T_DIST_ENTRY, sizeof(DistEntry)); @@ -129,9 +128,7 @@ /* Link in */ - /* All new dist entries are "not connected". - * erts_this_dist_entry is also always included among "not connected" - */ + /* All new dist entries are "not connected" */ dep->next = erts_not_connected_dist_entries; if(erts_not_connected_dist_entries) { ASSERT(erts_not_connected_dist_entries->prev == NULL); @@ -148,6 +145,9 @@ { DistEntry *dep = (DistEntry *) vdep; + if(dep == erts_this_dist_entry) + return; + ASSERT(is_nil(dep->cid)); ASSERT(dep->nlinks == NULL); ASSERT(dep->node_links == NULL); @@ -182,7 +182,7 @@ #endif erts_free(ERTS_ALC_T_DIST_ENTRY, (void *) dep); - ASSERT(dist_entries > 0); + ASSERT(dist_entries > 1); dist_entries--; } @@ -290,46 +290,21 @@ return res; } -static void try_delete_dist_entry(void *vdep) -{ - DistEntry *dep = (DistEntry *) vdep; - erts_aint_t refc; - - erts_smp_rwmtx_rwlock(&erts_dist_table_rwmtx); - /* - * Another thread might have looked up this dist entry after - * we decided to delete it (refc became zero). If so, the other - * thread incremented refc twice. Once for the new reference - * and once for this thread. - * - * If refc reach -1, no one has used the entry since we - * set up the timer. Delete the entry. - * - * If refc reach 0, the entry is currently not in use - * but has been used since we set up the timer. Set up a - * new timer. - * - * If refc > 0, the entry is in use. Keep the entry. - */ - refc = erts_refc_dectest(&dep->refc, -1); - if (refc == -1) - (void) hash_erase(&erts_dist_table, (void *) dep); - erts_smp_rwmtx_rwunlock(&erts_dist_table_rwmtx); - - if (refc == 0) - erts_schedule_delete_dist_entry(dep); -} - -void erts_schedule_delete_dist_entry(DistEntry *dep) +void erts_delete_dist_entry(DistEntry *dep) { ASSERT(dep != erts_this_dist_entry); - if (dep != erts_this_dist_entry) { - if (node_tab_delete_delay == 0) - try_delete_dist_entry((void *) dep); - else if (node_tab_delete_delay > 0) - erts_start_timer_callback(node_tab_delete_delay, - try_delete_dist_entry, - (void *) dep); + if(dep != erts_this_dist_entry) { + erts_smp_rwmtx_rwlock(&erts_dist_table_rwmtx); + /* + * Another thread might have looked up this dist entry after + * we decided to delete it (refc became zero). If so, the other + * thread incremented refc twice. Once for the new reference + * and once for this thread. Therefore, delete dist entry if + * refc is 0 or -1 after a decrement. + */ + if (erts_refc_dectest(&dep->refc, -1) <= 0) + (void) hash_erase(&erts_dist_table, (void *) dep); + erts_smp_rwmtx_rwunlock(&erts_dist_table_rwmtx); } } @@ -365,7 +340,8 @@ ASSERT(dist_entries == (erts_no_of_visible_dist_entries + erts_no_of_hidden_dist_entries - + erts_no_of_not_connected_dist_entries)); + + erts_no_of_not_connected_dist_entries + + 1 /* erts_this_dist_entry */)); #endif res = (hash_table_sz(&erts_dist_table) @@ -538,6 +514,9 @@ { ErlNode *enp; + if(((ErlNode *) venp_tmpl) == erts_this_node) + return venp_tmpl; + enp = (ErlNode *) erts_alloc(ERTS_ALC_T_NODE_ENTRY, sizeof(ErlNode)); node_entries++; @@ -555,7 +534,8 @@ { ErlNode *enp = (ErlNode *) venp; - ERTS_SMP_LC_ASSERT(enp != erts_this_node || erts_thr_progress_is_blocking()); + if(enp == erts_this_node) + return; erts_deref_dist_entry(enp->dist_entry); #ifdef DEBUG @@ -563,7 +543,7 @@ #endif erts_free(ERTS_ALC_T_NODE_ENTRY, venp); - ASSERT(node_entries > 0); + ASSERT(node_entries > 1); node_entries--; } @@ -576,14 +556,14 @@ #endif int lock = !ERTS_IS_CRASH_DUMPING; if (lock) - erts_smp_rwmtx_rlock(&erts_node_table_rwmtx); + erts_smp_rwmtx_rwlock(&erts_node_table_rwmtx); #ifdef DEBUG hash_get_info(&hi, &erts_node_table); ASSERT(node_entries == hi.objs); #endif res = hash_table_sz(&erts_node_table) + node_entries*sizeof(ErlNode); if (lock) - erts_smp_rwmtx_runlock(&erts_node_table_rwmtx); + erts_smp_rwmtx_rwunlock(&erts_node_table_rwmtx); return res; } @@ -592,10 +572,10 @@ { int lock = !ERTS_IS_CRASH_DUMPING; if (lock) - erts_smp_rwmtx_rlock(&erts_node_table_rwmtx); + erts_smp_rwmtx_rwlock(&erts_node_table_rwmtx); hash_info(to, to_arg, &erts_node_table); if (lock) - erts_smp_rwmtx_runlock(&erts_node_table_rwmtx); + erts_smp_rwmtx_rwunlock(&erts_node_table_rwmtx); } @@ -629,46 +609,21 @@ return res; } -static void try_delete_node(void *venp) -{ - ErlNode *enp = (ErlNode *) venp; - erts_aint_t refc; - - erts_smp_rwmtx_rwlock(&erts_node_table_rwmtx); - /* - * Another thread might have looked up this node after we - * decided to delete it (refc became zero). If so, the other - * thread incremented refc twice. Once for the new reference - * and once for this thread. - * - * If refc reach -1, no one has used the entry since we - * set up the timer. Delete the entry. - * - * If refc reach 0, the entry is currently not in use - * but has been used since we set up the timer. Set up a - * new timer. - * - * If refc > 0, the entry is in use. Keep the entry. - */ - refc = erts_refc_dectest(&enp->refc, -1); - if (refc == -1) - (void) hash_erase(&erts_node_table, (void *) enp); - erts_smp_rwmtx_rwunlock(&erts_node_table_rwmtx); - - if (refc == 0) - erts_schedule_delete_node(enp); -} - -void erts_schedule_delete_node(ErlNode *enp) +void erts_delete_node(ErlNode *enp) { ASSERT(enp != erts_this_node); - if (enp != erts_this_node) { - if (node_tab_delete_delay == 0) - try_delete_node((void *) enp); - else if (node_tab_delete_delay > 0) - erts_start_timer_callback(node_tab_delete_delay, - try_delete_node, - (void *) enp); + if(enp != erts_this_node) { + erts_smp_rwmtx_rwlock(&erts_node_table_rwmtx); + /* + * Another thread might have looked up this node after we + * decided to delete it (refc became zero). If so, the other + * thread incremented refc twice. Once for the new reference + * and once for this thread. Therefore, delete node if refc + * is 0 or -1 after a decrement. + */ + if (erts_refc_dectest(&enp->refc, -1) <= 0) + (void) hash_erase(&erts_node_table, (void *) enp); + erts_smp_rwmtx_rwunlock(&erts_node_table_rwmtx); } } @@ -696,7 +651,7 @@ erts_print(pndp->to, pndp->to_arg, " %d", enp->creation); #ifdef DEBUG erts_print(pndp->to, pndp->to_arg, " (refc=%ld)", - erts_refc_read(&enp->refc, 0)); + erts_refc_read(&enp->refc, 1)); #endif pndp->no_sysname++; } @@ -719,13 +674,13 @@ pnd.no_total = 0; if (lock) - erts_smp_rwmtx_rlock(&erts_node_table_rwmtx); + erts_smp_rwmtx_rwlock(&erts_node_table_rwmtx); hash_foreach(&erts_node_table, print_node, (void *) &pnd); if (pnd.no_sysname != 0) { erts_print(to, to_arg, "\n"); } if (lock) - erts_smp_rwmtx_runlock(&erts_node_table_rwmtx); + erts_smp_rwmtx_rwunlock(&erts_node_table_rwmtx); if(no_sysname) *no_sysname = pnd.no_sysname; @@ -738,66 +693,44 @@ void erts_set_this_node(Eterm sysname, Uint creation) { - ERTS_SMP_LC_ASSERT(erts_thr_progress_is_blocking()); - ASSERT(erts_refc_read(&erts_this_dist_entry->refc, 2)); - - if (erts_refc_dectest(&erts_this_node->refc, 0) == 0) - try_delete_node(erts_this_node); - - if (erts_refc_dectest(&erts_this_dist_entry->refc, 0) == 0) - try_delete_dist_entry(erts_this_dist_entry); - - erts_this_node = NULL; /* to make sure refc is bumped for this node */ - erts_this_node = erts_find_or_insert_node(sysname, creation); - erts_this_dist_entry = erts_this_node->dist_entry; - - erts_refc_inc(&erts_this_dist_entry->refc, 2); + erts_smp_rwmtx_rwlock(&erts_node_table_rwmtx); + erts_smp_rwmtx_rwlock(&erts_dist_table_rwmtx); + (void) hash_erase(&erts_dist_table, (void *) erts_this_dist_entry); + erts_this_dist_entry->sysname = sysname; + erts_this_dist_entry->creation = creation; + (void) hash_put(&erts_dist_table, (void *) erts_this_dist_entry); + + (void) hash_erase(&erts_node_table, (void *) erts_this_node); + erts_this_node->sysname = sysname; + erts_this_node->creation = creation; erts_this_node_sysname = erts_this_node_sysname_BUFFER; - erts_snprintf(erts_this_node_sysname, sizeof(erts_this_node_sysname_BUFFER), - "%T", sysname); -} + erts_snprintf(erts_this_node_sysname, sizeof(erts_this_node_sysname), + "%T", sysname); + (void) hash_put(&erts_node_table, (void *) erts_this_node); + + erts_smp_rwmtx_rwunlock(&erts_dist_table_rwmtx); + erts_smp_rwmtx_rwunlock(&erts_node_table_rwmtx); -Uint -erts_delayed_node_table_gc(void) -{ - if (node_tab_delete_delay < 0) - return (Uint) ERTS_NODE_TAB_DELAY_GC_INFINITY; - if (node_tab_delete_delay == 0) - return (Uint) 0; - return (Uint) ((node_tab_delete_delay-1)/1000 + 1); } -void erts_init_node_tables(int dd_sec) +void erts_init_node_tables(void) { erts_smp_rwmtx_opt_t rwmtx_opt = ERTS_SMP_RWMTX_OPT_DEFAULT_INITER; HashFunctions f; - ErlNode node_tmpl; - - if (dd_sec == ERTS_NODE_TAB_DELAY_GC_INFINITY) - node_tab_delete_delay = (ErtsMonotonicTime) -1; - else - node_tab_delete_delay = ((ErtsMonotonicTime) dd_sec)*1000; - - orig_node_tab_delete_delay = node_tab_delete_delay; rwmtx_opt.type = ERTS_SMP_RWMTX_TYPE_FREQUENT_READ; rwmtx_opt.lived = ERTS_SMP_RWMTX_LONG_LIVED; - erts_smp_rwmtx_init_opt(&erts_node_table_rwmtx, &rwmtx_opt, "node_table"); - erts_smp_rwmtx_init_opt(&erts_dist_table_rwmtx, &rwmtx_opt, "dist_table"); - f.hash = (H_FUN) dist_table_hash; f.cmp = (HCMP_FUN) dist_table_cmp; f.alloc = (HALLOC_FUN) dist_table_alloc; f.free = (HFREE_FUN) dist_table_free; - hash_init(ERTS_ALC_T_DIST_TABLE, &erts_dist_table, "dist_table", 11, f); - f.hash = (H_FUN) node_table_hash; - f.cmp = (HCMP_FUN) node_table_cmp; - f.alloc = (HALLOC_FUN) node_table_alloc; - f.free = (HFREE_FUN) node_table_free; - hash_init(ERTS_ALC_T_NODE_TABLE, &erts_node_table, "node_table", 11, f); + erts_this_dist_entry = erts_alloc(ERTS_ALC_T_DIST_ENTRY, sizeof(DistEntry)); + dist_entries = 1; + + hash_init(ERTS_ALC_T_DIST_TABLE, &erts_dist_table, "dist_table", 11, f); erts_hidden_dist_entries = NULL; erts_visible_dist_entries = NULL; @@ -806,23 +739,69 @@ erts_no_of_visible_dist_entries = 0; erts_no_of_not_connected_dist_entries = 0; - node_tmpl.sysname = am_Noname; - node_tmpl.creation = 0; - erts_this_node = hash_put(&erts_node_table, &node_tmpl); - /* +1 for erts_this_node */ - erts_refc_init(&erts_this_node->refc, 1); - - ASSERT(erts_this_node->dist_entry != NULL); - erts_this_dist_entry = erts_this_node->dist_entry; - /* +1 for erts_this_dist_entry */ - /* +1 for erts_this_node->dist_entry */ - erts_refc_init(&erts_this_dist_entry->refc, 2); + erts_this_dist_entry->next = NULL; + erts_this_dist_entry->prev = NULL; + erts_refc_init(&erts_this_dist_entry->refc, 1); /* erts_this_node */ + + erts_smp_rwmtx_init_opt_x(&erts_this_dist_entry->rwmtx, + &rwmtx_opt, + "dist_entry", + make_small(ERST_INTERNAL_CHANNEL_NO)); + erts_this_dist_entry->sysname = am_Noname; + erts_this_dist_entry->cid = NIL; + erts_this_dist_entry->connection_id = 0; + erts_this_dist_entry->status = 0; + erts_this_dist_entry->flags = 0; + erts_this_dist_entry->version = 0; + + erts_smp_mtx_init_x(&erts_this_dist_entry->lnk_mtx, + "dist_entry_links", + make_small(ERST_INTERNAL_CHANNEL_NO)); + erts_this_dist_entry->node_links = NULL; + erts_this_dist_entry->nlinks = NULL; + erts_this_dist_entry->monitors = NULL; + + erts_smp_mtx_init_x(&erts_this_dist_entry->qlock, + "dist_entry_out_queue", + make_small(ERST_INTERNAL_CHANNEL_NO)); + erts_this_dist_entry->qflgs = 0; + erts_this_dist_entry->qsize = 0; + erts_this_dist_entry->out_queue.first = NULL; + erts_this_dist_entry->out_queue.last = NULL; + erts_this_dist_entry->suspended = NULL; + + erts_this_dist_entry->finalized_out_queue.first = NULL; + erts_this_dist_entry->finalized_out_queue.last = NULL; + erts_smp_atomic_init_nob(&erts_this_dist_entry->dist_cmd_scheduled, 0); + erts_port_task_handle_init(&erts_this_dist_entry->dist_cmd); + erts_this_dist_entry->send = NULL; + erts_this_dist_entry->cache = NULL; + (void) hash_put(&erts_dist_table, (void *) erts_this_dist_entry); + f.hash = (H_FUN) node_table_hash; + f.cmp = (HCMP_FUN) node_table_cmp; + f.alloc = (HALLOC_FUN) node_table_alloc; + f.free = (HFREE_FUN) node_table_free; + + hash_init(ERTS_ALC_T_NODE_TABLE, &erts_node_table, "node_table", 11, f); + + erts_this_node = erts_alloc(ERTS_ALC_T_NODE_ENTRY, sizeof(ErlNode)); + node_entries = 1; + + erts_refc_init(&erts_this_node->refc, 1); /* The system itself */ + erts_this_node->sysname = am_Noname; + erts_this_node->creation = 0; + erts_this_node->dist_entry = erts_this_dist_entry; erts_this_node_sysname = erts_this_node_sysname_BUFFER; - erts_snprintf(erts_this_node_sysname, sizeof(erts_this_node_sysname_BUFFER), + erts_snprintf(erts_this_node_sysname, sizeof(erts_this_node_sysname), "%T", erts_this_node->sysname); + (void) hash_put(&erts_node_table, (void *) erts_this_node); + + erts_smp_rwmtx_init_opt(&erts_node_table_rwmtx, &rwmtx_opt, "node_table"); + erts_smp_rwmtx_init_opt(&erts_dist_table_rwmtx, &rwmtx_opt, "dist_table"); + references_atoms_need_init = 1; } @@ -868,7 +847,6 @@ static Eterm AM_node_references; static Eterm AM_system; static Eterm AM_timer; -static Eterm AM_delayed_delete_timer; static void setup_reference_table(void); static Eterm reference_table_term(Uint **hpp, Uint *szp); @@ -903,10 +881,8 @@ int heap_ref; int node_ref; int ctrl_ref; - int system_ref; Eterm id; Uint creation; - Uint id_heap[ID_HEAP_SIZE]; } DistReferrer; typedef struct { @@ -955,7 +931,6 @@ INIT_AM(node_references); INIT_AM(timer); INIT_AM(system); - INIT_AM(delayed_delete_timer); references_atoms_need_init = 0; } @@ -1013,25 +988,17 @@ sizeof(DistReferrer)); drp->next = referred_dist->referrers; referred_dist->referrers = drp; - if(IS_CONST(id)) - drp->id = id; - else { - Uint *hp = &drp->id_heap[0]; - ASSERT(is_tuple(id)); - drp->id = copy_struct(id, size_object(id), &hp, NULL); - } + drp->id = id; drp->creation = creation; drp->heap_ref = 0; drp->node_ref = 0; drp->ctrl_ref = 0; - drp->system_ref = 0; } switch (type) { case NODE_REF: drp->node_ref++; break; case CTRL_REF: drp->ctrl_ref++; break; case HEAP_REF: drp->heap_ref++; break; - case SYSTEM_REF: drp->system_ref++; break; default: ASSERT(0); } } @@ -1294,33 +1261,6 @@ #endif static void -insert_delayed_delete_node(void *state, - ErtsMonotonicTime timeout_pos, - void *vnp) -{ - DeclareTmpHeapNoproc(heap,3); - UseTmpHeapNoproc(3); - insert_node((ErlNode *) vnp, - SYSTEM_REF, - TUPLE2(&heap[0], AM_system, AM_delayed_delete_timer)); - UnUseTmpHeapNoproc(3); -} - -static void -insert_delayed_delete_dist_entry(void *state, - ErtsMonotonicTime timeout_pos, - void *vdep) -{ - DeclareTmpHeapNoproc(heap,3); - UseTmpHeapNoproc(3); - insert_dist_entry((DistEntry *) vdep, - SYSTEM_REF, - TUPLE2(&heap[0], AM_system, AM_delayed_delete_timer), - 0); - UnUseTmpHeapNoproc(3); -} - -static void setup_reference_table(void) { ErlHeapFragment *hfp; @@ -1348,22 +1288,11 @@ /* Go through the hole system, and build a table of all references to ErlNode and DistEntry structures */ - erts_debug_callback_timer_foreach(try_delete_node, - insert_delayed_delete_node, - NULL); - erts_debug_callback_timer_foreach(try_delete_dist_entry, - insert_delayed_delete_dist_entry, - NULL); - UseTmpHeapNoproc(3); insert_node(erts_this_node, SYSTEM_REF, TUPLE2(&heap[0], AM_system, am_undefined)); - insert_dist_entry(erts_this_dist_entry, - SYSTEM_REF, - TUPLE2(&heap[0], AM_system, am_undefined), - erts_this_node->creation); UnUseTmpHeapNoproc(3); max = erts_ptab_max(&erts_proc); @@ -1426,6 +1355,12 @@ insert_links(ERTS_P_LINKS(proc), proc->common.id); if (ERTS_P_MONITORS(proc)) insert_monitors(ERTS_P_MONITORS(proc), proc->common.id); + /* Insert controller */ + { + DistEntry *dep = ERTS_PROC_GET_DIST_ENTRY(proc); + if (dep) + insert_dist_entry(dep, CTRL_REF, proc->common.id, 0); + } } } @@ -1534,7 +1469,7 @@ erts_db_foreach_table(insert_ets_table, NULL); /* Insert all bif timers */ - erts_debug_bif_timer_foreach(insert_bif_timer, NULL); + erts_bif_timer_foreach(insert_bif_timer, NULL); /* Insert node table (references to dist) */ hash_foreach(&erts_node_table, insert_erl_node, NULL); @@ -1666,7 +1601,7 @@ tup = MK_2TUP(referred_nodes[i].node->sysname, MK_UINT(referred_nodes[i].node->creation)); - tup = MK_3TUP(tup, MK_UINT(erts_refc_read(&referred_nodes[i].node->refc, 0)), nril); + tup = MK_3TUP(tup, MK_UINT(erts_refc_read(&referred_nodes[i].node->refc, 1)), nril); nl = MK_CONS(tup, nl); } @@ -1689,10 +1624,6 @@ tup = MK_2TUP(AM_heap, MK_UINT(drp->heap_ref)); drl = MK_CONS(tup, drl); } - if(drp->system_ref) { - tup = MK_2TUP(AM_system, MK_UINT(drp->system_ref)); - drl = MK_CONS(tup, drl); - } if (is_internal_pid(drp->id)) { ASSERT(!drp->node_ref); @@ -1702,14 +1633,6 @@ ASSERT(drp->ctrl_ref && !drp->node_ref); tup = MK_2TUP(AM_port, drp->id); } - else if (is_tuple(drp->id)) { - Eterm *t; - ASSERT(drp->system_ref && !drp->node_ref - && !drp->ctrl_ref && !drp->heap_ref); - t = tuple_val(drp->id); - ASSERT(2 == arityval(t[0])); - tup = MK_2TUP(t[1], t[2]); - } else { ASSERT(!drp->ctrl_ref && drp->node_ref); ASSERT(is_atom(drp->id)); @@ -1727,7 +1650,7 @@ /* DistList = [{Dist, Refc, ReferenceIdList}] */ tup = MK_3TUP(referred_dists[i].dist->sysname, - MK_UINT(erts_refc_read(&referred_dists[i].dist->refc, 0)), + MK_UINT(erts_refc_read(&referred_dists[i].dist->refc, 1)), dril); dl = MK_CONS(tup, dl); } @@ -1782,15 +1705,3 @@ } } -void -erts_debug_test_node_tab_delayed_delete(Sint64 millisecs) -{ - erts_smp_thr_progress_block(); - - if (millisecs < 0) - node_tab_delete_delay = orig_node_tab_delete_delay; - else - node_tab_delete_delay = millisecs; - - erts_smp_thr_progress_unblock(); -} diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_node_tables.h erlang-17.3-dfsg/erts/emulator/beam/erl_node_tables.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_node_tables.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_node_tables.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -47,10 +46,6 @@ #define ERTS_PORT_TASK_ONLY_BASIC_TYPES__ #include "erl_port_task.h" #undef ERTS_PORT_TASK_ONLY_BASIC_TYPES__ - -#define ERTS_NODE_TAB_DELAY_GC_DEFAULT (60) -#define ERTS_NODE_TAB_DELAY_GC_MAX (100*1000*1000) -#define ERTS_NODE_TAB_DELAY_GC_INFINITY (ERTS_NODE_TAB_DELAY_GC_MAX+1) #define ERST_INTERNAL_CHANNEL_NO 0 @@ -171,21 +166,20 @@ extern ErlNode *erts_this_node; extern char *erts_this_node_sysname; /* must match erl_node_tables.c */ -Uint erts_delayed_node_table_gc(void); DistEntry *erts_channel_no_to_dist_entry(Uint); DistEntry *erts_sysname_to_connected_dist_entry(Eterm); DistEntry *erts_find_or_insert_dist_entry(Eterm); DistEntry *erts_find_dist_entry(Eterm); -void erts_schedule_delete_dist_entry(DistEntry *); +void erts_delete_dist_entry(DistEntry *); Uint erts_dist_table_size(void); void erts_dist_table_info(int, void *); void erts_set_dist_entry_not_connected(DistEntry *); void erts_set_dist_entry_connected(DistEntry *, Eterm, Uint); ErlNode *erts_find_or_insert_node(Eterm, Uint); -void erts_schedule_delete_node(ErlNode *); +void erts_delete_node(ErlNode *); void erts_set_this_node(Eterm, Uint); Uint erts_node_table_size(void); -void erts_init_node_tables(int); +void erts_init_node_tables(void); void erts_node_table_info(int, void *); void erts_print_node_info(int, void *, Eterm, int*, int*); Eterm erts_get_node_and_dist_references(struct process *); @@ -210,7 +204,7 @@ { ASSERT(dep); if (erts_refc_dectest(&dep->refc, 0) == 0) - erts_schedule_delete_dist_entry(dep); + erts_delete_dist_entry(dep); } ERTS_GLB_INLINE void @@ -218,7 +212,7 @@ { ASSERT(np); if (erts_refc_dectest(&np->refc, 0) == 0) - erts_schedule_delete_node(np); + erts_delete_node(np); } ERTS_GLB_INLINE void @@ -259,6 +253,5 @@ #endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */ -void erts_debug_test_node_tab_delayed_delete(Sint64 millisecs); #endif diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_port.h erlang-17.3-dfsg/erts/emulator/beam/erl_port.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_port.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_port.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2012-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -267,7 +266,8 @@ #endif -Eterm erts_request_io_bytes(Process *c_p); +extern erts_smp_atomic_t erts_bytes_out; /* no bytes written out */ +extern erts_smp_atomic_t erts_bytes_in; /* no bytes sent into the system */ /* port status flags */ @@ -350,7 +350,6 @@ ERTS_GLB_INLINE void erts_port_inc_refc(Port *prt); ERTS_GLB_INLINE void erts_port_dec_refc(Port *prt); ERTS_GLB_INLINE void erts_port_add_refc(Port *prt, Sint32 add_refc); -ERTS_GLB_INLINE Sint erts_port_read_refc(Port *prt); ERTS_GLB_INLINE int erts_smp_port_trylock(Port *prt); ERTS_GLB_INLINE void erts_smp_port_lock(Port *prt); @@ -360,26 +359,37 @@ ERTS_GLB_INLINE void erts_port_inc_refc(Port *prt) { - erts_ptab_atmc_inc_refc(&prt->common); +#ifdef ERTS_SMP + erts_ptab_inc_refc(&prt->common); +#else + erts_atomic32_inc_nob(&prt->refc); +#endif } ERTS_GLB_INLINE void erts_port_dec_refc(Port *prt) { - int referred = erts_ptab_atmc_dec_test_refc(&prt->common); +#ifdef ERTS_SMP + int referred = erts_ptab_dec_test_refc(&prt->common); if (!referred) erts_port_free(prt); +#else + int refc = erts_atomic32_dec_read_nob(&prt->refc); + if (refc == 0) + erts_port_free(prt); +#endif } ERTS_GLB_INLINE void erts_port_add_refc(Port *prt, Sint32 add_refc) { - int referred = erts_ptab_atmc_add_test_refc(&prt->common, add_refc); +#ifdef ERTS_SMP + int referred = erts_ptab_add_test_refc(&prt->common, add_refc); if (!referred) erts_port_free(prt); -} - -ERTS_GLB_INLINE Sint erts_port_read_refc(Port *prt) -{ - return erts_ptab_atmc_read_refc(&prt->common); +#else + int refc = erts_atomic32_add_read_nob(&prt->refc, add_refc); + if (refc == 0) + erts_port_free(prt); +#endif } ERTS_GLB_INLINE int diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_port_task.c erlang-17.3-dfsg/erts/emulator/beam/erl_port_task.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_port_task.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_port_task.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -33,7 +32,6 @@ #include "global.h" #include "erl_port_task.h" #include "dist.h" -#include "erl_check_io.h" #include "dtrace-wrapper.h" #include @@ -552,16 +550,6 @@ } static ERTS_INLINE void -reset_executed_io_task_handle(ErtsPortTask *ptp) -{ - if (ptp->u.alive.handle) { - ASSERT(ptp == handle2task(ptp->u.alive.handle)); - erts_io_notify_port_task_executed(ptp->u.alive.handle); - reset_port_task_handle(ptp->u.alive.handle); - } -} - -static ERTS_INLINE void set_handle(ErtsPortTask *ptp, ErtsPortTaskHandle *pthp) { ptp->u.alive.handle = pthp; @@ -1408,7 +1396,10 @@ erts_aint32_t act, add_flags; unsigned int prof_runnable_ports; - ERTS_LC_ASSERT(!pthp || !erts_port_task_is_scheduled(pthp)); + if (pthp && erts_port_task_is_scheduled(pthp)) { + ASSERT(0); + erts_port_task_abort(pthp); + } ASSERT(is_internal_port(id)); @@ -1647,7 +1638,6 @@ erts_aint32_t state; int active; Uint64 start_time = 0; - ErtsSchedulerData *esdp = runq->scheduler; ERTS_SMP_LC_ASSERT(erts_smp_lc_runq_is_locked(runq)); @@ -1664,6 +1654,7 @@ *curr_port_pp = pp; if (erts_sched_stat.enabled) { + ErtsSchedulerData *esdp = erts_get_scheduler_data(); Uint old = ERTS_PORT_SCHED_ID(pp, esdp->no); int migrated = old && old != esdp->no; @@ -1708,6 +1699,8 @@ goto aborted_port_task; } + reset_handle(ptp); + if (erts_system_monitor_long_schedule != 0) { start_time = erts_timestamp_millis(); } @@ -1718,17 +1711,11 @@ switch (ptp->type) { case ERTS_PORT_TASK_TIMEOUT: - reset_handle(ptp); - if (!ERTS_PTMR_IS_TIMED_OUT(pp)) - reds = 0; - else { - ERTS_PTMR_CLEAR(pp); - reds = ERTS_PORT_REDS_TIMEOUT; - if (!(state & ERTS_PORT_SFLGS_DEAD)) { - DTRACE_DRIVER(driver_timeout, pp); - (*pp->drv_ptr->timeout)((ErlDrvData) pp->drv_data); - } - } + reds = ERTS_PORT_REDS_TIMEOUT; + if (!(state & ERTS_PORT_SFLGS_DEAD)) { + DTRACE_DRIVER(driver_timeout, pp); + (*pp->drv_ptr->timeout)((ErlDrvData) pp->drv_data); + } break; case ERTS_PORT_TASK_INPUT: reds = ERTS_PORT_REDS_INPUT; @@ -1738,7 +1725,6 @@ for input and output */ (*pp->drv_ptr->ready_input)((ErlDrvData) pp->drv_data, ptp->u.alive.td.io.event); - reset_executed_io_task_handle(ptp); io_tasks_executed++; break; case ERTS_PORT_TASK_OUTPUT: @@ -1747,7 +1733,6 @@ DTRACE_DRIVER(driver_ready_output, pp); (*pp->drv_ptr->ready_output)((ErlDrvData) pp->drv_data, ptp->u.alive.td.io.event); - reset_executed_io_task_handle(ptp); io_tasks_executed++; break; case ERTS_PORT_TASK_EVENT: @@ -1757,12 +1742,10 @@ (*pp->drv_ptr->event)((ErlDrvData) pp->drv_data, ptp->u.alive.td.io.event, ptp->u.alive.td.io.event_data); - reset_executed_io_task_handle(ptp); io_tasks_executed++; break; case ERTS_PORT_TASK_PROC_SIG: { ErtsProc2PortSigData *sigdp = &ptp->u.alive.td.psig.data; - reset_handle(ptp); ASSERT((state & ERTS_PORT_SFLGS_DEAD) == 0); if (!pp->sched.taskq.bpq) reds = ptp->u.alive.td.psig.callback(pp, @@ -1780,7 +1763,6 @@ break; } case ERTS_PORT_TASK_DIST_CMD: - reset_handle(ptp); reds = erts_dist_command(pp, CONTEXT_REDS - pp->reds); break; default: @@ -1885,7 +1867,7 @@ runq->scheduler->reductions += reds; ERTS_SMP_LC_ASSERT(erts_smp_lc_runq_is_locked(runq)); - ERTS_PORT_REDUCTIONS_EXECUTED(esdp, runq, reds); + ERTS_PORT_REDUCTIONS_EXECUTED(runq, reds); return res; } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_port_task.h erlang-17.3-dfsg/erts/emulator/beam/erl_port_task.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_port_task.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_port_task.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -157,7 +156,7 @@ ERTS_GLB_INLINE int erts_port_task_is_scheduled(ErtsPortTaskHandle *pthp) { - return ((void *) erts_smp_atomic_read_acqb(pthp)) != NULL; + return ((void *) erts_smp_atomic_read_nob(pthp)) != NULL; } ERTS_GLB_INLINE void erts_port_task_pre_init_sched(ErtsPortTaskSched *ptsp, diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_printf_term.c erlang-17.3-dfsg/erts/emulator/beam/erl_printf_term.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_printf_term.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_printf_term.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2005-2014. All Rights Reserved. + * Copyright Ericsson AB 2005-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -26,7 +25,6 @@ #include "sys.h" #include "big.h" #include "erl_map.h" -#include "erl_binary.h" #define PRINT_CHAR(CNT, FN, ARG, C) \ do { \ @@ -140,25 +138,6 @@ return 0; } -static int is_printable_ascii(byte* bytep, Uint bytesize, Uint bitoffs) -{ - if (!bitoffs) { - while (bytesize--) { - if (*bytep < ' ' || *bytep >= 127) - return 0; - bytep++; - } - } else { - while (bytesize--) { - byte octet = (bytep[0] << bitoffs) | (bytep[1] >> (8-bitoffs)); - if (octet < ' ' || octet >= 127) - return 0; - bytep++; - } - } - return 1; -} - /* print a atom doing what quoting is necessary */ static int print_atom_name(fmtfn_t fn, void* arg, Eterm atom, long *dcount) { @@ -248,17 +227,6 @@ #define PRT_PATCH_FUN_SIZE ((Eterm) 7) #define PRT_LAST_ARRAY_ELEMENT ((Eterm) 8) /* Note! Must be last... */ -#if 0 -static char *format_binary(Uint16 x, char *b) { - int z; - b[16] = '\0'; - for (z = 0; z < 16; z++) { - b[15-z] = ((x>>z) & 0x1) ? '1' : '0'; - } - return b; -} -#endif - static int print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount, Eterm* obj_base) /* ignored if !HALFWORD_HEAP */ @@ -315,9 +283,13 @@ tl = CDR(cons); if (is_not_nil(tl)) { if (is_list(tl)) { - WSTACK_PUSH3(s, tl, PRT_ONE_CONS, PRT_COMMA); + WSTACK_PUSH(s, tl); + WSTACK_PUSH(s, PRT_ONE_CONS); + WSTACK_PUSH(s, PRT_COMMA); } else { - WSTACK_PUSH3(s, tl, PRT_TERM, PRT_BAR); + WSTACK_PUSH(s, tl); + WSTACK_PUSH(s, PRT_TERM); + WSTACK_PUSH(s, PRT_BAR); } } } @@ -327,7 +299,9 @@ break; default: /* PRT_LAST_ARRAY_ELEMENT+1 and upwards */ obj = *popped.ptr; - WSTACK_PUSH3(s, (UWord) (popped.ptr + 1), val-1, PRT_COMMA); + WSTACK_PUSH(s, (UWord) (popped.ptr + 1)); + WSTACK_PUSH(s, val-1); + WSTACK_PUSH(s, PRT_COMMA); break; } break; @@ -457,7 +431,8 @@ WSTACK_PUSH(s,PRT_CLOSE_TUPLE); ++nobj; if (i > 0) { - WSTACK_PUSH2(s, (UWord) nobj, PRT_LAST_ARRAY_ELEMENT+i-1); + WSTACK_PUSH(s, (UWord) nobj); + WSTACK_PUSH(s, PRT_LAST_ARRAY_ELEMENT+i-1); } break; case FLOAT_DEF: { @@ -467,66 +442,17 @@ } break; case BINARY_DEF: - { - byte* bytep; - Uint bytesize = binary_size_rel(obj,obj_base); - Uint bitoffs; - Uint bitsize; - byte octet; - ERTS_GET_BINARY_BYTES_REL(obj, bytep, bitoffs, bitsize, obj_base); - - if (bitsize || !bytesize - || !is_printable_ascii(bytep, bytesize, bitoffs)) { - int is_first = 1; - PRINT_STRING(res, fn, arg, "<<"); - while (bytesize) { - if (is_first) - is_first = 0; - else - PRINT_CHAR(res, fn, arg, ','); - if (bitoffs) - octet = (bytep[0] << bitoffs) | (bytep[1] >> (8-bitoffs)); - else - octet = bytep[0]; - PRINT_UWORD(res, fn, arg, 'u', 0, 1, octet); - ++bytep; - --bytesize; - } - if (bitsize) { - Uint bits = bitoffs + bitsize; - octet = bytep[0]; - if (bits < 8) - octet >>= 8 - bits; - else if (bits > 8) { - bits -= 8; /* bits in last byte */ - octet <<= bits; - octet |= bytep[1] >> (8 - bits); - } - octet &= (1 << bitsize) - 1; - if (is_first) - is_first = 0; - else - PRINT_CHAR(res, fn, arg, ','); - PRINT_UWORD(res, fn, arg, 'u', 0, 1, octet); - PRINT_CHAR(res, fn, arg, ':'); - PRINT_UWORD(res, fn, arg, 'u', 0, 1, bitsize); - } - PRINT_STRING(res, fn, arg, ">>"); - } + if (header_is_bin_matchstate(*boxed_val(wobj))) { + PRINT_STRING(res, fn, arg, "#MatchState"); + } + else { + ProcBin* pb = (ProcBin *) binary_val(wobj); + if (pb->size == 1) + PRINT_STRING(res, fn, arg, "<<1 byte>>"); else { - PRINT_STRING(res, fn, arg, "<<\""); - while (bytesize) { - if (bitoffs) - octet = (bytep[0] << bitoffs) | (bytep[1] >> (8-bitoffs)); - else - octet = bytep[0]; - if (octet == '"') - PRINT_CHAR(res, fn, arg, '\\'); - PRINT_CHAR(res, fn, arg, octet); - ++bytep; - --bytesize; - } - PRINT_STRING(res, fn, arg, "\">>"); + PRINT_STRING(res, fn, arg, "<<"); + PRINT_UWORD(res, fn, arg, 'u', 0, 1, (ErlPfUWord) pb->size); + PRINT_STRING(res, fn, arg, " bytes>>"); } } break; @@ -563,77 +489,37 @@ } break; case MAP_DEF: - if (is_flatmap(wobj)) { - Uint n; - Eterm *ks, *vs; - flatmap_t *mp = (flatmap_t *)flatmap_val(wobj); - n = flatmap_get_size(mp); - ks = flatmap_get_keys(mp); - vs = flatmap_get_values(mp); - - PRINT_CHAR(res, fn, arg, '#'); - PRINT_CHAR(res, fn, arg, '{'); - WSTACK_PUSH(s, PRT_CLOSE_TUPLE); - if (n > 0) { - n--; - WSTACK_PUSH5(s, vs[n], PRT_TERM, PRT_ASSOC, ks[n], PRT_TERM); - while (n--) { - WSTACK_PUSH6(s, PRT_COMMA, vs[n], PRT_TERM, PRT_ASSOC, - ks[n], PRT_TERM); - } - } - } else { - Uint n, mapval; - Eterm *head; - head = hashmap_val(wobj); - mapval = MAP_HEADER_VAL(*head); - switch (MAP_HEADER_TYPE(*head)) { - case MAP_HEADER_TAG_HAMT_HEAD_ARRAY: - case MAP_HEADER_TAG_HAMT_HEAD_BITMAP: - PRINT_STRING(res, fn, arg, "#<"); - PRINT_UWORD(res, fn, arg, 'x', 0, 1, mapval); - PRINT_STRING(res, fn, arg, ">{"); - WSTACK_PUSH(s,PRT_CLOSE_TUPLE); - n = hashmap_bitcount(mapval); - ASSERT(n < 17); - head += 2; - if (n > 0) { - n--; - WSTACK_PUSH(s, head[n]); - WSTACK_PUSH(s, PRT_TERM); - while (n--) { - WSTACK_PUSH(s, PRT_COMMA); - WSTACK_PUSH(s, head[n]); - WSTACK_PUSH(s, PRT_TERM); - } - } - break; - case MAP_HEADER_TAG_HAMT_NODE_BITMAP: - n = hashmap_bitcount(mapval); - head++; - PRINT_CHAR(res, fn, arg, '<'); - PRINT_UWORD(res, fn, arg, 'x', 0, 1, mapval); - PRINT_STRING(res, fn, arg, ">{"); - WSTACK_PUSH(s,PRT_CLOSE_TUPLE); - ASSERT(n < 17); - if (n > 0) { - n--; - WSTACK_PUSH(s, head[n]); - WSTACK_PUSH(s, PRT_TERM); - while (n--) { - WSTACK_PUSH(s, PRT_COMMA); - WSTACK_PUSH(s, head[n]); - WSTACK_PUSH(s, PRT_TERM); - } - } - break; - } - } - break; - case MATCHSTATE_DEF: - PRINT_STRING(res, fn, arg, "#MatchState"); + { + Uint n; + Eterm *ks, *vs; + map_t *mp = (map_t *)map_val(wobj); + n = map_get_size(mp); + ks = map_get_keys(mp); + vs = map_get_values(mp); + + PRINT_CHAR(res, fn, arg, '#'); + PRINT_CHAR(res, fn, arg, '{'); + WSTACK_PUSH(s, PRT_CLOSE_TUPLE); + if (n > 0) { + n--; + WSTACK_PUSH(s, vs[n]); + WSTACK_PUSH(s, PRT_TERM); + WSTACK_PUSH(s, PRT_ASSOC); + WSTACK_PUSH(s, ks[n]); + WSTACK_PUSH(s, PRT_TERM); + + while (n--) { + WSTACK_PUSH(s, PRT_COMMA); + WSTACK_PUSH(s, vs[n]); + WSTACK_PUSH(s, PRT_TERM); + WSTACK_PUSH(s, PRT_ASSOC); + WSTACK_PUSH(s, ks[n]); + WSTACK_PUSH(s, PRT_TERM); + } + } + } break; - default: + default: PRINT_STRING(res, fn, arg, "'); @@ -642,17 +528,17 @@ } L_done: + DESTROY_WSTACK(s); return res; } - int erts_printf_term(fmtfn_t fn, void* arg, ErlPfEterm term, long precision, ErlPfEterm* term_base) { int res; - ERTS_CT_ASSERT(sizeof(ErlPfEterm) == sizeof(Eterm)); + ASSERT(sizeof(ErlPfEterm) == sizeof(Eterm)); res = print_term(fn, arg, (Eterm)term, &precision, (Eterm*)term_base); if (res < 0) diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_printf_term.h erlang-17.3-dfsg/erts/emulator/beam/erl_printf_term.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_printf_term.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_printf_term.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_process.c erlang-17.3-dfsg/erts/emulator/beam/erl_process.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_process.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_process.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -44,11 +43,8 @@ #include "erl_async.h" #include "dtrace-wrapper.h" #include "erl_ptab.h" -#include "erl_bif_unique.h" -#define ERTS_WANT_TIMER_WHEEL_API -#include "erl_time.h" -#define ERTS_CHECK_TIME_REDS CONTEXT_REDS + #define ERTS_DELAYED_WAKEUP_INFINITY (~(Uint64) 0) #define ERTS_DELAYED_WAKEUP_REDUCTIONS ((Uint64) CONTEXT_REDS/2) @@ -152,12 +148,6 @@ extern BeamInstr beam_exit[]; extern BeamInstr beam_continue_exit[]; -#ifdef __OSE__ -/* Eager check I/O not supported on OSE yet. */ -int erts_eager_check_io = 0; -#else -int erts_eager_check_io = 1; -#endif int erts_sched_compact_load; int erts_sched_balance_util = 0; Uint erts_no_schedulers; @@ -166,9 +156,6 @@ Uint erts_no_dirty_io_schedulers; #endif -static char *erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_NO_FLAGS] = {0}; -int erts_aux_work_no_flags = ERTS_SSI_AUX_WORK_NO_FLAGS; - #define ERTS_THR_PRGR_LATER_CLEANUP_OP_THRESHOLD_VERY_LAZY (4*1024*1024) #define ERTS_THR_PRGR_LATER_CLEANUP_OP_THRESHOLD_LAZY (512*1024) #define ERTS_THR_PRGR_LATER_CLEANUP_OP_THRESHOLD_MEDIUM (64*1024) @@ -464,12 +451,13 @@ static void exec_misc_ops(ErtsRunQueue *); static void print_function_from_pc(int to, void *to_arg, BeamInstr* x); -static int stack_element_dump(int to, void *to_arg, Eterm* sp, int yreg); +static int stack_element_dump(int to, void *to_arg, Process* p, Eterm* sp, + int yreg); static void aux_work_timeout(void *unused); static void aux_work_timeout_early_init(int no_schedulers); static void aux_work_timeout_late_init(void); -static void setup_aux_work_timer(ErtsSchedulerData *esdp); +static void setup_aux_work_timer(void); static int execute_sys_tasks(Process *c_p, erts_aint32_t *statep, @@ -499,8 +487,6 @@ valid |= ERTS_SSI_AUX_WORK_MISC_THR_PRGR; valid |= ERTS_SSI_AUX_WORK_DD; valid |= ERTS_SSI_AUX_WORK_DD_THR_PRGR; - valid |= ERTS_SSI_AUX_WORK_CNCLD_TMRS; - valid |= ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR; valid |= ERTS_SSI_AUX_WORK_THR_PRGR_LATER_OP; #endif #if HAVE_ERTS_MSEG @@ -512,7 +498,6 @@ #ifdef ERTS_SSI_AUX_WORK_REAP_PORTS valid |= ERTS_SSI_AUX_WORK_REAP_PORTS; #endif - valid |= ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED; if (~valid & value) erl_exit(ERTS_ABORT_EXIT, @@ -571,41 +556,6 @@ erts_tsd_key_create(&sched_data_key, "erts_sched_data_key"); #endif - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_DELAYED_AW_WAKEUP_IX] - = "DELAYED_AW_WAKEUP"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_DD_IX] - = "DD"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_DD_THR_PRGR_IX] - = "DD_THR_PRGR"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_FIX_ALLOC_DEALLOC_IX] - = "FIX_ALLOC_DEALLOC"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_FIX_ALLOC_LOWER_LIM_IX] - = "FIX_ALLOC_LOWER_LIM"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_THR_PRGR_LATER_OP_IX] - = "THR_PRGR_LATER_OP"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_CNCLD_TMRS_IX] - = "CNCLD_TMRS"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR_IX] - = "CNCLD_TMRS_THR_PRGR"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_ASYNC_READY_IX] - = "ASYNC_READY"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_ASYNC_READY_CLEAN_IX] - = "ASYNC_READY_CLEAN"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_MISC_THR_PRGR_IX] - = "MISC_THR_PRGR"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_MISC_IX] - = "MISC"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_CHECK_CHILDREN_IX] - = "CHECK_CHILDREN"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_SET_TMO_IX] - = "SET_TMO"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_MSEG_CACHE_CHECK_IX] - = "MSEG_CACHE_CHECK"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_REAP_PORTS_IX] - = "REAP_PORTS"; - erts_aux_work_flag_descr[ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED_IX] - = "DEBUG_WAIT_COMPLETED"; - #ifdef ERTS_ENABLE_LOCK_CHECK { int ix; @@ -625,6 +575,11 @@ erts_psd_required_locks[ERTS_PSD_SCHED_ID].set_locks = ERTS_PSD_SCHED_ID_SET_LOCKS; + erts_psd_required_locks[ERTS_PSD_DIST_ENTRY].get_locks + = ERTS_PSD_DIST_ENTRY_GET_LOCKS; + erts_psd_required_locks[ERTS_PSD_DIST_ENTRY].set_locks + = ERTS_PSD_DIST_ENTRY_SET_LOCKS; + erts_psd_required_locks[ERTS_PSD_CALL_TIME_BP].get_locks = ERTS_PSD_CALL_TIME_BP_GET_LOCKS; erts_psd_required_locks[ERTS_PSD_CALL_TIME_BP].set_locks @@ -649,11 +604,13 @@ #endif } +#ifdef ERTS_SMP static void release_process(void *vproc) { - erts_proc_dec_refc((Process *) vproc); + erts_smp_proc_dec_refc((Process *) vproc); } +#endif /* initialize the scheduler */ void @@ -669,18 +626,16 @@ erts_ptab_init_table(&erts_proc, ERTS_ALC_T_PROC_TABLE, +#ifdef ERTS_SMP release_process, +#else + NULL, +#endif (ErtsPTabElementCommon *) &erts_invalid_process.common, proc_tab_size, sizeof(Process), "process_table", - legacy_proc_tab, -#ifdef ERTS_SMP - 1 -#else - 0 -#endif - ); + legacy_proc_tab); last_reductions = 0; last_exact_reductions = 0; @@ -741,8 +696,8 @@ static ERTS_INLINE Uint64 sched_wall_time_ts(void) { -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - return (Uint64) erts_os_monotonic_time(); +#ifdef HAVE_GETHRTIME + return (Uint64) sys_gethrtime(); #else Uint64 res; SysTimeval tv; @@ -755,24 +710,72 @@ #if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT +#ifdef ARCH_64 + +static ERTS_INLINE Uint64 +aschedtime_read(ErtsAtomicSchedTime *var) +{ + return (Uint64) erts_atomic_read_nob((erts_atomic_t *) var); +} + +static ERTS_INLINE void +aschedtime_set(ErtsAtomicSchedTime *var, Uint64 val) +{ + erts_atomic_set_nob((erts_atomic_t *) var, (erts_aint_t) val); +} + +static ERTS_INLINE void +aschedtime_init(ErtsAtomicSchedTime *var) +{ + erts_atomic_init_nob((erts_atomic_t *) var, (erts_aint_t) 0); +} + +#elif defined(ARCH_32) + static ERTS_INLINE Uint64 aschedtime_read(ErtsAtomicSchedTime *var) { - return (Uint64) erts_atomic64_read_nob((erts_atomic64_t *) var); + erts_dw_aint_t dw; + erts_dw_atomic_read_nob((erts_dw_atomic_t *) var, &dw); +#ifdef ETHR_SU_DW_NAINT_T__ + return (Uint64) dw.dw_sint; +#else + { + Uint64 res; + res = (Uint64) ((Uint32) dw.sint[ERTS_DW_AINT_HIGH_WORD]); + res <<= 32; + res |= (Uint64) ((Uint32) dw.sint[ERTS_DW_AINT_LOW_WORD]); + return res; + } +#endif } static ERTS_INLINE void aschedtime_set(ErtsAtomicSchedTime *var, Uint64 val) { - erts_atomic64_set_nob((erts_atomic64_t *) var, (erts_aint64_t) val); + erts_dw_aint_t dw; +#ifdef ETHR_SU_DW_NAINT_T__ + dw.dw_sint = (ETHR_SU_DW_NAINT_T__) val; +#else + dw.sint[ERTS_DW_AINT_LOW_WORD] = (erts_aint_t) (val & 0xffffffff); + dw.sint[ERTS_DW_AINT_HIGH_WORD] = (erts_aint_t) ((val >> 32) & 0xffffffff); +#endif + erts_dw_atomic_set_nob((erts_dw_atomic_t *) var, &dw); } static ERTS_INLINE void aschedtime_init(ErtsAtomicSchedTime *var) { - erts_atomic64_init_nob((erts_atomic64_t *) var, (erts_aint64_t) 0); + erts_dw_aint_t dw; + dw.sint[ERTS_DW_AINT_LOW_WORD] = (erts_aint_t) 0; + dw.sint[ERTS_DW_AINT_HIGH_WORD] = (erts_aint_t) 0; + erts_dw_atomic_init_nob((erts_dw_atomic_t *) var, &dw); } +#else +# error :-/ +#endif + #define ERTS_GET_AVG_MAX_UNLOCKED_TRY 50 #define ERTS_SCHED_AVG_UTIL_WRITE_MARKER (~((Uint64) 0)) @@ -1062,7 +1065,11 @@ hpp = &hp; } - erts_queue_message(rp, &rp_locks, bp, msg, NIL); + erts_queue_message(rp, &rp_locks, bp, msg, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); if (swtrp->req_sched == esdp->no) rp_locks &= ~ERTS_PROC_LOCK_MAIN; @@ -1070,7 +1077,7 @@ if (rp_locks) erts_smp_proc_unlock(rp, rp_locks); - erts_proc_dec_refc(rp); + erts_smp_proc_dec_refc(rp); if (erts_smp_atomic32_dec_read_nob(&swtrp->refc) == 0) swtreq_free(vswtrp); @@ -1102,7 +1109,7 @@ erts_smp_atomic32_init_nob(&swtrp->refc, (erts_aint32_t) erts_no_schedulers); - erts_proc_add_refc(c_p, (Sint32) erts_no_schedulers); + erts_smp_proc_add_refc(c_p, (Sint32) erts_no_schedulers); #ifdef ERTS_SMP if (erts_no_schedulers > 1) @@ -1163,7 +1170,7 @@ xplocks &= ~plocks; if (xplocks && erts_smp_proc_trylock(p, xplocks) == EBUSY) { if (xplocks & ERTS_PROC_LOCK_MAIN) { - erts_proc_inc_refc(p); + erts_smp_proc_inc_refc(p); erts_smp_proc_unlock(p, plocks); erts_smp_proc_lock(p, ERTS_PROC_LOCKS_ALL); refc = 1; @@ -1179,7 +1186,7 @@ if (xplocks) erts_smp_proc_unlock(p, xplocks); if (refc) - erts_proc_dec_refc(p); + erts_smp_proc_dec_refc(p); ASSERT(p->psd); if (p->psd != psd) erts_free(ERTS_ALC_T_PSD, psd); @@ -1228,11 +1235,11 @@ ERTS_DBG_CHK_SSI_AUX_WORK(ssi); old_flgs = erts_atomic32_read_nob(&ssi->aux_work); - if ((old_flgs & flgs) != flgs) { + if ((old_flgs & flgs) == 0) { old_flgs = erts_atomic32_read_bor_nob(&ssi->aux_work, flgs); - if ((old_flgs & flgs) != flgs) { + if ((old_flgs & flgs) == 0) { #ifdef ERTS_SMP erts_sched_poke(ssi); #else @@ -1252,7 +1259,7 @@ old_flgs = erts_atomic32_read_bor_relb(&ssi->aux_work, flgs); - if ((old_flgs & flgs) != flgs) { + if ((old_flgs & flgs) == 0) { #ifdef ERTS_SMP erts_sched_poke(ssi); #else @@ -1750,6 +1757,11 @@ awdp->dd.thr_prgr = wakeup; haw_thr_prgr_soft_wakeup(awdp, wakeup); } + else if (awdp->dd.completed_callback) { + awdp->dd.completed_callback(awdp->dd.completed_arg); + awdp->dd.completed_callback = NULL; + awdp->dd.completed_arg = NULL; + } return aux_work & ~ERTS_SSI_AUX_WORK_DD; } @@ -1791,104 +1803,14 @@ } else { unset_aux_work_flags(ssi, ERTS_SSI_AUX_WORK_DD_THR_PRGR); - } - - return aux_work & ~ERTS_SSI_AUX_WORK_DD_THR_PRGR; -} - -/* - * Canceled timers - */ - -void -erts_notify_canceled_timer(ErtsSchedulerData *esdp, int rsid) -{ - ASSERT(esdp && esdp == erts_get_scheduler_data()); - if (esdp && !ERTS_SCHEDULER_IS_DIRTY(esdp)) - schedule_aux_work_wakeup(&esdp->aux_work_data, - rsid, - ERTS_SSI_AUX_WORK_CNCLD_TMRS); - else - set_aux_work_flags_wakeup_relb(ERTS_SCHED_SLEEP_INFO_IX(rsid-1), - ERTS_SSI_AUX_WORK_CNCLD_TMRS); -} - -static ERTS_INLINE erts_aint32_t -handle_canceled_timers(ErtsAuxWorkData *awdp, erts_aint32_t aux_work, int waiting) -{ - ErtsSchedulerSleepInfo *ssi = awdp->ssi; - int need_thr_progress = 0; - ErtsThrPrgrVal wakeup = ERTS_THR_PRGR_INVALID; - int more_work = 0; - -#ifdef ERTS_DIRTY_SCHEDULERS - ASSERT(!awdp->esdp || !ERTS_SCHEDULER_IS_DIRTY(awdp->esdp)); -#endif - unset_aux_work_flags(ssi, ERTS_SSI_AUX_WORK_CNCLD_TMRS); - erts_handle_canceled_timers((void *) awdp->esdp, - &need_thr_progress, - &wakeup, - &more_work); - if (more_work) { - if (set_aux_work_flags(ssi, ERTS_SSI_AUX_WORK_CNCLD_TMRS) - & ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR) { - unset_aux_work_flags(ssi, ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR); - aux_work &= ~ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR; + if (awdp->dd.completed_callback) { + awdp->dd.completed_callback(awdp->dd.completed_arg); + awdp->dd.completed_callback = NULL; + awdp->dd.completed_arg = NULL; } - return aux_work; - } - - if (need_thr_progress) { - if (wakeup == ERTS_THR_PRGR_INVALID) - wakeup = erts_thr_progress_later(awdp->esdp); - awdp->cncld_tmrs.thr_prgr = wakeup; - set_aux_work_flags(ssi, ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR); - haw_thr_prgr_soft_wakeup(awdp, wakeup); - } - return aux_work & ~ERTS_SSI_AUX_WORK_CNCLD_TMRS; -} - -static ERTS_INLINE erts_aint32_t -handle_canceled_timers_thr_prgr(ErtsAuxWorkData *awdp, erts_aint32_t aux_work, int waiting) -{ - ErtsSchedulerSleepInfo *ssi; - int need_thr_progress; - int more_work; - ErtsThrPrgrVal wakeup = ERTS_THR_PRGR_INVALID; - ErtsThrPrgrVal current = haw_thr_prgr_current(awdp); - -#ifdef ERTS_DIRTY_SCHEDULERS - ASSERT(!awdp->esdp || !ERTS_SCHEDULER_IS_DIRTY(awdp->esdp)); -#endif - if (!erts_thr_progress_has_reached_this(current, awdp->cncld_tmrs.thr_prgr)) - return aux_work & ~ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR; - - ssi = awdp->ssi; - need_thr_progress = 0; - more_work = 0; - - erts_handle_canceled_timers((void *) awdp->esdp, - &need_thr_progress, - &wakeup, - &more_work); - if (more_work) { - set_aux_work_flags(ssi, ERTS_SSI_AUX_WORK_CNCLD_TMRS); - unset_aux_work_flags(ssi, ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR); - return ((aux_work & ~ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR) - | ERTS_SSI_AUX_WORK_CNCLD_TMRS); } - if (need_thr_progress) { - if (wakeup == ERTS_THR_PRGR_INVALID) - wakeup = erts_thr_progress_later(awdp->esdp); - awdp->cncld_tmrs.thr_prgr = wakeup; - haw_thr_prgr_soft_wakeup(awdp, wakeup); - } - else { - unset_aux_work_flags(ssi, ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR); - } - - return aux_work & ~ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR; + return aux_work & ~ERTS_SSI_AUX_WORK_DD_THR_PRGR; } /* @@ -1980,142 +1902,78 @@ #endif } -static ERTS_INLINE erts_aint32_t -handle_debug_wait_completed(ErtsAuxWorkData *awdp, erts_aint32_t aux_work, int waiting) -{ - ErtsSchedulerSleepInfo *ssi = awdp->ssi; - erts_aint32_t saved_aux_work, flags; - -#ifdef ERTS_DIRTY_SCHEDULERS - ASSERT(!awdp->esdp || !ERTS_SCHEDULER_IS_DIRTY(awdp->esdp)); -#endif - - flags = awdp->debug.wait_completed.flags; - - if (aux_work & flags) - return aux_work; - - saved_aux_work = erts_atomic32_read_acqb(&ssi->aux_work); - - if (saved_aux_work & flags) - return aux_work & ~ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED; - - awdp->debug.wait_completed.callback(awdp->debug.wait_completed.arg); - - awdp->debug.wait_completed.flags = 0; - awdp->debug.wait_completed.callback = NULL; - awdp->debug.wait_completed.arg = NULL; - - unset_aux_work_flags(ssi, ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED); - - return aux_work & ~ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED; -} +#ifdef ERTS_SMP -static erts_atomic32_t debug_wait_completed_count; -static int debug_wait_completed_flags; +static erts_atomic32_t completed_dealloc_count; static void -thr_debug_wait_completed(void *vproc) +completed_dealloc(void *vproc) { - if (erts_atomic32_dec_read_mb(&debug_wait_completed_count) == 0) { + if (erts_atomic32_dec_read_mb(&completed_dealloc_count) == 0) { erts_resume((Process *) vproc, (ErtsProcLocks) 0); - erts_proc_dec_refc((Process *) vproc); + erts_smp_proc_dec_refc((Process *) vproc); } } static void -setup_thr_debug_wait_completed(void *vproc) +setup_completed_dealloc(void *vproc) { ErtsSchedulerData *esdp = erts_get_scheduler_data(); - ErtsAuxWorkData *awdp; - erts_aint32_t wait_flags, aux_work_flags; -#ifdef ERTS_SMP - awdp = esdp ? &esdp->aux_work_data : aux_thread_aux_work_data; -#else - awdp = &esdp->aux_work_data; -#endif - - wait_flags = 0; - aux_work_flags = ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED; - - if (debug_wait_completed_flags & ERTS_DEBUG_WAIT_COMPLETED_DEALLOCATIONS) { - erts_alloc_fix_alloc_shrink(awdp->sched_id, 0); - wait_flags |= (ERTS_SSI_AUX_WORK_DD - | ERTS_SSI_AUX_WORK_DD_THR_PRGR - | ERTS_SSI_AUX_WORK_THR_PRGR_LATER_OP); -#ifdef ERTS_SMP - aux_work_flags |= ERTS_SSI_AUX_WORK_DD; -#endif - } - - if (debug_wait_completed_flags & ERTS_DEBUG_WAIT_COMPLETED_TIMER_CANCELLATIONS) { - wait_flags |= (ERTS_SSI_AUX_WORK_CNCLD_TMRS - | ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR - | ERTS_SSI_AUX_WORK_THR_PRGR_LATER_OP); -#ifdef ERTS_SMP - if (awdp->esdp && !ERTS_SCHEDULER_IS_DIRTY(awdp->esdp)) - aux_work_flags |= ERTS_SSI_AUX_WORK_CNCLD_TMRS; -#endif - } - - set_aux_work_flags_wakeup_nob(awdp->ssi, aux_work_flags); - - awdp->debug.wait_completed.flags = wait_flags; - awdp->debug.wait_completed.callback = thr_debug_wait_completed; - awdp->debug.wait_completed.arg = vproc; + ErtsAuxWorkData *awdp = (esdp + ? &esdp->aux_work_data + : aux_thread_aux_work_data); + erts_alloc_fix_alloc_shrink(awdp->sched_id, 0); + set_aux_work_flags_wakeup_nob(awdp->ssi, ERTS_SSI_AUX_WORK_DD); + awdp->dd.completed_callback = completed_dealloc; + awdp->dd.completed_arg = vproc; } static void -prep_setup_thr_debug_wait_completed(void *vproc) +prep_setup_completed_dealloc(void *vproc) { - erts_aint32_t count = (erts_aint32_t) erts_no_schedulers; -#ifdef ERTS_SMP - count += 1; /* aux thread */ -#endif - if (erts_atomic32_dec_read_mb(&debug_wait_completed_count) == count) { + erts_aint32_t count = (erts_aint32_t) (erts_no_schedulers+1); + if (erts_atomic32_dec_read_mb(&completed_dealloc_count) == count) { /* scheduler threads */ erts_schedule_multi_misc_aux_work(0, erts_no_schedulers, - setup_thr_debug_wait_completed, + setup_completed_dealloc, vproc); -#ifdef ERTS_SMP /* aux_thread */ erts_schedule_misc_aux_work(0, - setup_thr_debug_wait_completed, + setup_completed_dealloc, vproc); -#endif } } +#endif /* ERTS_SMP */ int -erts_debug_wait_completed(Process *c_p, int flags) +erts_debug_wait_deallocations(Process *c_p) { +#ifndef ERTS_SMP + erts_alloc_fix_alloc_shrink(1, 0); + return 1; +#else /* Only one process at a time can do this */ - erts_aint32_t count = (erts_aint32_t) (2*erts_no_schedulers); -#ifdef ERTS_SMP - count += 2; /* aux thread */ -#endif - if (0 == erts_atomic32_cmpxchg_mb(&debug_wait_completed_count, + erts_aint32_t count = (erts_aint32_t) (2*(erts_no_schedulers+1)); + if (0 == erts_atomic32_cmpxchg_mb(&completed_dealloc_count, count, 0)) { - debug_wait_completed_flags = flags; erts_suspend(c_p, ERTS_PROC_LOCK_MAIN, NULL); - erts_proc_inc_refc(c_p); + erts_smp_proc_inc_refc(c_p); /* scheduler threads */ erts_schedule_multi_misc_aux_work(0, erts_no_schedulers, - prep_setup_thr_debug_wait_completed, + prep_setup_completed_dealloc, (void *) c_p); -#ifdef ERTS_SMP /* aux_thread */ erts_schedule_misc_aux_work(0, - prep_setup_thr_debug_wait_completed, + prep_setup_completed_dealloc, (void *) c_p); -#endif return 1; } return 0; +#endif } @@ -2217,7 +2075,7 @@ handle_setup_aux_work_timer(ErtsAuxWorkData *awdp, erts_aint32_t aux_work, int waiting) { unset_aux_work_flags(awdp->ssi, ERTS_SSI_AUX_WORK_SET_TMO); - setup_aux_work_timer(awdp->esdp); + setup_aux_work_timer(); return aux_work & ~ERTS_SSI_AUX_WORK_SET_TMO; } @@ -2277,11 +2135,6 @@ #ifdef ERTS_SMP HANDLE_AUX_WORK(ERTS_SSI_AUX_WORK_THR_PRGR_LATER_OP, handle_thr_prgr_later_op); - HANDLE_AUX_WORK(ERTS_SSI_AUX_WORK_CNCLD_TMRS, - handle_canceled_timers); - /* CNCLD_TMRS must be before CNCLD_TMRS_THR_PRGR */ - HANDLE_AUX_WORK(ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR, - handle_canceled_timers_thr_prgr); #endif #if ERTS_USE_ASYNC_READY_Q @@ -2316,14 +2169,6 @@ HANDLE_AUX_WORK(ERTS_SSI_AUX_WORK_REAP_PORTS, handle_reap_ports); - /* - * ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED *need* to be - * the last flag checked! - */ - - HANDLE_AUX_WORK(ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED, - handle_debug_wait_completed); - ERTS_DBG_CHK_AUX_WORK_VAL(aux_work); #ifdef ERTS_SMP @@ -2339,8 +2184,8 @@ typedef struct { union { - ErtsTWheelTimer data; - char align__[ERTS_ALC_CACHE_LINE_ALIGN_SIZE(sizeof(ErtsTWheelTimer))]; + ErlTimer data; + char align__[ERTS_ALC_CACHE_LINE_ALIGN_SIZE(sizeof(ErlTimer))]; } timer; int initialized; @@ -2350,22 +2195,6 @@ static ErtsAuxWorkTmo *aux_work_tmo; -static ERTS_INLINE void -start_aux_work_timer(ErtsSchedulerData *esdp) -{ - ErtsMonotonicTime tmo = erts_get_monotonic_time(esdp); - tmo = ERTS_MONOTONIC_TO_CLKTCKS(tmo-1); - tmo += ERTS_MSEC_TO_CLKTCKS(1000) + 1; - erts_twheel_init_timer(&aux_work_tmo->timer.data); - ASSERT(esdp); - erts_twheel_set_timer(esdp->timer_wheel, - &aux_work_tmo->timer.data, - aux_work_timeout, - NULL, - (void *) esdp, - tmo); -} - static void aux_work_timeout_early_init(int no_schedulers) { @@ -2398,12 +2227,18 @@ aux_work_timeout_late_init(void) { aux_work_tmo->initialized = 1; - if (erts_atomic32_read_nob(&aux_work_tmo->refc)) - start_aux_work_timer(erts_get_scheduler_data()); + if (erts_atomic32_read_nob(&aux_work_tmo->refc)) { + aux_work_tmo->timer.data.active = 0; + erts_set_timer(&aux_work_tmo->timer.data, + aux_work_timeout, + NULL, + NULL, + 1000); + } } static void -aux_work_timeout(void *vesdp) +aux_work_timeout(void *unused) { erts_aint32_t refc; int i; @@ -2426,18 +2261,32 @@ if (refc != 1 || 1 != erts_atomic32_cmpxchg_relb(&aux_work_tmo->refc, 0, 1)) { /* Setup next timeout... */ - start_aux_work_timer((ErtsSchedulerData *) vesdp); + aux_work_tmo->timer.data.active = 0; + erts_set_timer(&aux_work_tmo->timer.data, + aux_work_timeout, + NULL, + NULL, + 1000); } } static void -setup_aux_work_timer(ErtsSchedulerData *esdp) +setup_aux_work_timer(void) { - if (!esdp || !esdp->timer_wheel) +#ifndef ERTS_SMP + if (!erts_get_scheduler_data()) set_aux_work_flags_wakeup_nob(ERTS_SCHED_SLEEP_INFO_IX(0), ERTS_SSI_AUX_WORK_SET_TMO); else - start_aux_work_timer(esdp); +#endif + { + aux_work_tmo->timer.data.active = 0; + erts_set_timer(&aux_work_tmo->timer.data, + aux_work_timeout, + NULL, + NULL, + 1000); + } } erts_aint32_t @@ -2468,7 +2317,7 @@ if (refc == 1) { erts_atomic32_inc_acqb(&aux_work_tmo->refc); if (aux_work_tmo->initialized) - setup_aux_work_timer(erts_get_scheduler_data()); + setup_aux_work_timer(); } } return old; @@ -2511,6 +2360,7 @@ ERTS_ATOMIC_FOREACH_RUNQ(rq, as -= abs(rq->waiting)); + ASSERT(as >= 0); return as; } @@ -2531,47 +2381,29 @@ #endif static ERTS_INLINE int -prepare_for_sys_schedule(ErtsSchedulerData *esdp, int non_blocking) +prepare_for_sys_schedule(ErtsSchedulerData *esdp) { - if (non_blocking && erts_eager_check_io) { #ifdef ERTS_SMP + while (!erts_port_task_have_outstanding_io_tasks() + && try_set_sys_scheduling()) { #ifdef ERTS_SCHED_ONLY_POLL_SCHED_1 - if (esdp->no != 1) { - /* If we are not scheduler 1 and ERTS_SCHED_ONLY_POLL_SCHED_1 is used - then we make sure to wake scheduler 1 */ - ErtsRunQueue *rq = ERTS_RUNQ_IX(0); - wake_scheduler(rq); - return 0; - } + if (esdp->no != 1) { + /* If we are not scheduler 1 and ERTS_SCHED_ONLY_POLL_SCHED_1 is used + then we make sure to wake scheduler 1 */ + ErtsRunQueue *rq = ERTS_RUNQ_IX(0); + clear_sys_scheduling(); + wake_scheduler(rq); + return 0; + } #endif - return try_set_sys_scheduling(); -#else + if (!erts_port_task_have_outstanding_io_tasks()) return 1; -#endif + clear_sys_scheduling(); } - else { -#ifdef ERTS_SMP - while (!erts_port_task_have_outstanding_io_tasks() - && try_set_sys_scheduling()) { -#ifdef ERTS_SCHED_ONLY_POLL_SCHED_1 - if (esdp->no != 1) { - /* If we are not scheduler 1 and ERTS_SCHED_ONLY_POLL_SCHED_1 is used - then we make sure to wake scheduler 1 */ - ErtsRunQueue *rq = ERTS_RUNQ_IX(0); - clear_sys_scheduling(); - wake_scheduler(rq); - return 0; - } -#endif - if (!erts_port_task_have_outstanding_io_tasks()) - return 1; - clear_sys_scheduling(); - } - return 0; + return 0; #else - return !erts_port_task_have_outstanding_io_tasks(); + return !erts_port_task_have_outstanding_io_tasks(); #endif - } } #ifdef ERTS_SMP @@ -2832,13 +2664,6 @@ static void init_aux_work_data(ErtsAuxWorkData *awdp, ErtsSchedulerData *esdp, char *dawwp); -void -erts_interupt_aux_thread_timed(ErtsMonotonicTime timeout_time) -{ - /* TODO only poke when needed (based on timeout_time) */ - erts_sched_poke(ERTS_SCHED_SLEEP_INFO_IX(-1)); -} - static void * aux_thread(void *unused) { @@ -2955,7 +2780,7 @@ * be waiting in erl_sys_schedule() */ - if (ERTS_SCHEDULER_IS_DIRTY(esdp) || !prepare_for_sys_schedule(esdp, 0)) { + if (ERTS_SCHEDULER_IS_DIRTY(esdp) || !prepare_for_sys_schedule(esdp)) { sched_waiting(esdp->no, rq); @@ -2969,7 +2794,6 @@ sched_wall_time_change(esdp, thr_prgr_active); while (1) { - ErtsMonotonicTime current_time; aux_work = erts_atomic32_read_acqb(&ssi->aux_work); if (aux_work) { @@ -2983,76 +2807,34 @@ erts_thr_progress_leader_update(esdp); } - if (aux_work) { - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - flgs = erts_smp_atomic32_read_acqb(&ssi->flags); - current_time = erts_get_monotonic_time(esdp); - if (current_time >= erts_next_timeout_time(esdp->next_tmo_ref)) { - if (!thr_prgr_active) { - erts_thr_progress_active(esdp, thr_prgr_active = 1); - sched_wall_time_change(esdp, 1); - } - erts_bump_timers(esdp->timer_wheel, current_time); - } - } - } + if (aux_work) + flgs = erts_smp_atomic32_read_acqb(&ssi->flags); else { - ErtsMonotonicTime timeout_time; - int do_timeout = 0; if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - timeout_time = erts_check_next_timeout_time(esdp); - current_time = erts_get_monotonic_time(esdp); - do_timeout = (current_time >= timeout_time); - } else - timeout_time = ERTS_MONOTONIC_TIME_MAX; - if (do_timeout) { - if (!thr_prgr_active) { - erts_thr_progress_active(esdp, thr_prgr_active = 1); - sched_wall_time_change(esdp, 1); + if (thr_prgr_active) { + erts_thr_progress_active(esdp, thr_prgr_active = 0); + sched_wall_time_change(esdp, 0); } + erts_thr_progress_prepare_wait(esdp); } - else { - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - if (thr_prgr_active) { - erts_thr_progress_active(esdp, thr_prgr_active = 0); - sched_wall_time_change(esdp, 0); - } - erts_thr_progress_prepare_wait(esdp); - } - ERTS_SCHED_FAIR_YIELD(); + ERTS_SCHED_FAIR_YIELD(); - flgs = sched_spin_wait(ssi, spincount); + flgs = sched_spin_wait(ssi, spincount); + if (flgs & ERTS_SSI_FLG_SLEEPING) { + ASSERT(flgs & ERTS_SSI_FLG_WAITING); + flgs = sched_set_sleeptype(ssi, ERTS_SSI_FLG_TSE_SLEEPING); if (flgs & ERTS_SSI_FLG_SLEEPING) { + int res; + ASSERT(flgs & ERTS_SSI_FLG_TSE_SLEEPING); ASSERT(flgs & ERTS_SSI_FLG_WAITING); - flgs = sched_set_sleeptype(ssi, ERTS_SSI_FLG_TSE_SLEEPING); - if (flgs & ERTS_SSI_FLG_SLEEPING) { - int res; - ASSERT(flgs & ERTS_SSI_FLG_TSE_SLEEPING); - ASSERT(flgs & ERTS_SSI_FLG_WAITING); - current_time = ERTS_SCHEDULER_IS_DIRTY(esdp) ? 0 : - erts_get_monotonic_time(esdp); - do { - Sint64 timeout; - if (current_time >= timeout_time) - break; - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - timeout = ERTS_MONOTONIC_TO_NSEC(timeout_time - - current_time - - 1) + 1; - } else - timeout = -1; - res = erts_tse_twait(ssi->event, timeout); - current_time = ERTS_SCHEDULER_IS_DIRTY(esdp) ? 0 : - erts_get_monotonic_time(esdp); - } while (res == EINTR); - } + do { + res = erts_tse_wait(ssi->event); + } while (res == EINTR); } - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) - erts_thr_progress_finalize_wait(esdp); } - if (!ERTS_SCHEDULER_IS_DIRTY(esdp) && current_time >= timeout_time) - erts_bump_timers(esdp->timer_wheel, current_time); + if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) + erts_thr_progress_finalize_wait(esdp); } if (!(flgs & ERTS_SSI_FLG_WAITING)) { @@ -3085,6 +2867,7 @@ else #endif { + erts_aint_t dt; erts_smp_atomic32_set_relb(&function_calls, 0); *fcalls = 0; @@ -3109,7 +2892,6 @@ goto sys_aux_work; while (spincount-- > 0) { - ErtsMonotonicTime current_time; sys_poll_aux_work: @@ -3119,11 +2901,8 @@ ASSERT(!erts_port_task_have_outstanding_io_tasks()); erl_sys_schedule(1); /* Might give us something to do */ - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - current_time = erts_get_monotonic_time(esdp); - if (current_time >= erts_next_timeout_time(esdp->next_tmo_ref)) - erts_bump_timers(esdp->timer_wheel, current_time); - } + dt = erts_do_time_read_and_reset(); + if (dt) erts_bump_timer(dt); sys_aux_work: #ifndef ERTS_SMP @@ -3132,18 +2911,15 @@ aux_work = erts_atomic32_read_acqb(&ssi->aux_work); if (aux_work) { - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - if (!working) - sched_wall_time_change(esdp, working = 1); + if (!working) + sched_wall_time_change(esdp, working = 1); #ifdef ERTS_SMP - if (!thr_prgr_active) - erts_thr_progress_active(esdp, thr_prgr_active = 1); + if (!thr_prgr_active) + erts_thr_progress_active(esdp, thr_prgr_active = 1); #endif - } aux_work = handle_aux_work(&esdp->aux_work_data, aux_work, 1); #ifdef ERTS_SMP - if (!ERTS_SCHEDULER_IS_DIRTY(esdp) && aux_work && - erts_thr_progress_update(esdp)) + if (aux_work && erts_thr_progress_update(esdp)) erts_thr_progress_leader_update(esdp); #endif } @@ -3168,7 +2944,7 @@ * Got to check that we still got I/O tasks; otherwise * we have to continue checking for I/O... */ - if (!prepare_for_sys_schedule(esdp, 0)) { + if (!prepare_for_sys_schedule(esdp)) { spincount *= ERTS_SCHED_TSE_SLEEP_SPINCOUNT_FACT; goto tse_wait; } @@ -3190,7 +2966,7 @@ * Got to check that we still got I/O tasks; otherwise * we have to wait in erl_sys_schedule() after all... */ - if (!prepare_for_sys_schedule(esdp, 0)) { + if (!prepare_for_sys_schedule(esdp)) { /* * Not allowed to wait in erl_sys_schedule; * do tse wait instead... @@ -3241,11 +3017,8 @@ erl_sys_schedule(0); - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - ErtsMonotonicTime current_time = erts_get_monotonic_time(esdp); - if (current_time >= erts_next_timeout_time(esdp->next_tmo_ref)) - erts_bump_timers(esdp->timer_wheel, current_time); - } + dt = erts_do_time_read_and_reset(); + if (dt) erts_bump_timer(dt); #ifndef ERTS_SMP if (rq->len == 0 && !rq->misc.start) @@ -3447,11 +3220,11 @@ return 0; wrq = ERTS_RUNQ_IX(ix); flags = ERTS_RUNQ_FLGS_GET(wrq); - if (activate && !(flags & ERTS_RUNQ_FLG_SUSPENDED)) { - if (try_inc_no_active_runqs(ix+1)) - (void) ERTS_RUNQ_FLGS_UNSET(wrq, ERTS_RUNQ_FLG_INACTIVE); - } if (!(flags & (ERTS_RUNQ_FLG_SUSPENDED|ERTS_RUNQ_FLG_NONEMPTY))) { + if (activate) { + if (try_inc_no_active_runqs(ix+1)) + (void) ERTS_RUNQ_FLGS_UNSET(wrq, ERTS_RUNQ_FLG_INACTIVE); + } wake_scheduler(wrq); return 1; } @@ -5136,11 +4909,9 @@ + ERTS_WAKEUP_OTHER_FIXED_INC); if (rq->wakeup_other > wakeup_other.limit) { #ifdef ERTS_DIRTY_SCHEDULERS - if (ERTS_RUNQ_IX_IS_DIRTY(rq->ix)) { - if (rq->waiting) { - wake_dirty_schedulers(rq, 1); - } - } else + if (ERTS_RUNQ_IX_IS_DIRTY(rq->ix) && rq->waiting) + wake_dirty_schedulers(rq, 1); + else #endif { int empty_rqs = @@ -5451,7 +5222,8 @@ awdp->latest_wakeup = ERTS_THR_PRGR_VAL_FIRST; awdp->misc.thr_prgr = ERTS_THR_PRGR_VAL_WAITING; awdp->dd.thr_prgr = ERTS_THR_PRGR_VAL_WAITING; - awdp->cncld_tmrs.thr_prgr = ERTS_THR_PRGR_VAL_WAITING; + awdp->dd.completed_callback = NULL; + awdp->dd.completed_arg = NULL; awdp->later_op.thr_prgr = ERTS_THR_PRGR_VAL_FIRST; awdp->later_op.size = 0; awdp->later_op.first = NULL; @@ -5481,9 +5253,6 @@ awdp->delayed_wakeup.sched2jix[i] = -1; } #endif - awdp->debug.wait_completed.flags = 0; - awdp->debug.wait_completed.callback = NULL; - awdp->debug.wait_completed.arg = NULL; } static void @@ -5492,7 +5261,6 @@ ErtsRunQueue* runq, char** daww_ptr, size_t daww_sz) { - esdp->timer_wheel = NULL; #ifdef ERTS_SMP erts_bits_init_state(&esdp->erl_bits_state); esdp->match_pseudo_process = NULL; @@ -5520,7 +5288,6 @@ #else esdp->no = (Uint) num; #endif - esdp->ssi = ssi; esdp->current_process = NULL; esdp->current_port = NULL; @@ -5533,15 +5300,6 @@ esdp->run_queue = runq; esdp->run_queue->scheduler = esdp; - esdp->last_monotonic_time = 0; - esdp->check_time_reds = 0; - - esdp->thr_id = (Uint32) num; - erts_sched_bif_unique_init(esdp); - - esdp->io.out = (Uint64) 0; - esdp->io.in = (Uint64) 0; - if (daww_ptr) { init_aux_work_data(&esdp->aux_work_data, esdp, *daww_ptr); #ifdef ERTS_SMP @@ -5796,11 +5554,11 @@ init_swtreq_alloc(); #endif - erts_atomic32_init_nob(&debug_wait_completed_count, 0); /* debug only */ - debug_wait_completed_flags = 0; #ifdef ERTS_SMP + erts_atomic32_init_nob(&completed_dealloc_count, 0); /* debug only */ + aux_thread_aux_work_data = erts_alloc_permanent_cache_aligned(ERTS_ALC_T_SCHDLR_DATA, sizeof(ErtsAuxWorkData)); @@ -6140,7 +5898,6 @@ free_proxy_proc(proxy); erts_smp_runq_lock(c_rq); - return 0; #ifdef ERTS_DIRTY_SCHEDULERS @@ -6853,7 +6610,7 @@ int res; do { - res = erts_tse_twait(ssi->event, -1); + res = erts_tse_wait(ssi->event); } while (res == EINTR); } } @@ -6909,8 +6666,6 @@ } } - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) - (void) erts_get_monotonic_time(esdp); erts_smp_runq_lock(esdp->run_queue); non_empty_runq(esdp->run_queue); @@ -7018,7 +6773,6 @@ erts_smp_mtx_unlock(&schdlr_sspnd.mtx); while (1) { - ErtsMonotonicTime current_time; erts_aint32_t qmask; erts_aint32_t flgs; @@ -7026,7 +6780,7 @@ & ERTS_RUNQ_FLGS_QMASK); aux_work = erts_atomic32_read_acqb(&ssi->aux_work); if (aux_work|qmask) { - if (!ERTS_SCHEDULER_IS_DIRTY(esdp) && !thr_prgr_active) { + if (!thr_prgr_active) { erts_thr_progress_active(esdp, thr_prgr_active = 1); sched_wall_time_change(esdp, 1); } @@ -7034,8 +6788,7 @@ aux_work = handle_aux_work(&esdp->aux_work_data, aux_work, 1); - if (!ERTS_SCHEDULER_IS_DIRTY(esdp) && aux_work && - erts_thr_progress_update(esdp)) + if (aux_work && erts_thr_progress_update(esdp)) erts_thr_progress_leader_update(esdp); if (qmask) { erts_smp_runq_lock(esdp->run_queue); @@ -7044,77 +6797,30 @@ } } - if (aux_work) { - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - current_time = erts_get_monotonic_time(esdp); - if (current_time >= erts_next_timeout_time(esdp->next_tmo_ref)) { - if (!thr_prgr_active) { - erts_thr_progress_active(esdp, thr_prgr_active = 1); - sched_wall_time_change(esdp, 1); - } - erts_bump_timers(esdp->timer_wheel, current_time); - } - } - } - else { - ErtsMonotonicTime timeout_time; - int do_timeout = 0; - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - timeout_time = erts_check_next_timeout_time(esdp); - current_time = erts_get_monotonic_time(esdp); - do_timeout = (current_time >= timeout_time); - } else - timeout_time = ERTS_MONOTONIC_TIME_MAX; - if (do_timeout) { - if (!thr_prgr_active) { - erts_thr_progress_active(esdp, thr_prgr_active = 1); - sched_wall_time_change(esdp, 1); - } + if (!aux_work) { + if (thr_prgr_active) { + erts_thr_progress_active(esdp, thr_prgr_active = 0); + sched_wall_time_change(esdp, 0); } - else { - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - if (thr_prgr_active) { - erts_thr_progress_active(esdp, thr_prgr_active = 0); - sched_wall_time_change(esdp, 0); - } - erts_thr_progress_prepare_wait(esdp); - } - flgs = sched_spin_suspended(ssi, - ERTS_SCHED_SUSPEND_SLEEP_SPINCOUNT); + erts_thr_progress_prepare_wait(esdp); + flgs = sched_spin_suspended(ssi, + ERTS_SCHED_SUSPEND_SLEEP_SPINCOUNT); + if (flgs == (ERTS_SSI_FLG_SLEEPING + | ERTS_SSI_FLG_WAITING + | ERTS_SSI_FLG_SUSPENDED)) { + flgs = sched_set_suspended_sleeptype(ssi); if (flgs == (ERTS_SSI_FLG_SLEEPING + | ERTS_SSI_FLG_TSE_SLEEPING | ERTS_SSI_FLG_WAITING | ERTS_SSI_FLG_SUSPENDED)) { - flgs = sched_set_suspended_sleeptype(ssi); - if (flgs == (ERTS_SSI_FLG_SLEEPING - | ERTS_SSI_FLG_TSE_SLEEPING - | ERTS_SSI_FLG_WAITING - | ERTS_SSI_FLG_SUSPENDED)) { - int res; - - current_time = ERTS_SCHEDULER_IS_DIRTY(esdp) ? 0 : - erts_get_monotonic_time(esdp); - do { - Sint64 timeout; - if (current_time >= timeout_time) - break; - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - timeout = ERTS_MONOTONIC_TO_NSEC(timeout_time - - current_time - - 1) + 1; - } else - timeout = -1; - res = erts_tse_twait(ssi->event, timeout); - current_time = ERTS_SCHEDULER_IS_DIRTY(esdp) ? 0 : - erts_get_monotonic_time(esdp); - } while (res == EINTR); - } + int res; + + do { + res = erts_tse_wait(ssi->event); + } while (res == EINTR); } - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) - erts_thr_progress_finalize_wait(esdp); } - - if (!ERTS_SCHEDULER_IS_DIRTY(esdp) && current_time >= timeout_time) - erts_bump_timers(esdp->timer_wheel, current_time); + erts_thr_progress_finalize_wait(esdp); } flgs = sched_prep_spin_suspended(ssi, (ERTS_SSI_FLG_WAITING @@ -7934,15 +7640,7 @@ ErtsSchedulerData *esdp = vesdp; Uint no = esdp->no; #ifdef ERTS_SMP - erts_tse_t *tse; -#endif - - erts_sched_init_time_sup(esdp); - -#ifdef ERTS_SMP - tse = erts_tse_fetch(); - erts_tse_prepare_timed(tse); - ERTS_SCHED_SLEEP_INFO_IX(no - 1)->event = tse; + ERTS_SCHED_SLEEP_INFO_IX(no - 1)->event = erts_tse_fetch(); callbacks.arg = (void *) esdp->ssi; callbacks.wakeup = thr_prgr_wakeup; callbacks.prepare_wait = thr_prgr_prep_wait; @@ -8043,8 +7741,6 @@ callbacks.wait = NULL; callbacks.finalize_wait = NULL; - esdp->thr_id += erts_no_schedulers; - erts_thr_progress_register_unmanaged_thread(&callbacks); #ifdef ERTS_ENABLE_LOCK_CHECK { @@ -8106,8 +7802,6 @@ callbacks.wait = NULL; callbacks.finalize_wait = NULL; - esdp->thr_id += erts_no_schedulers + erts_no_dirty_cpu_schedulers; - erts_thr_progress_register_unmanaged_thread(&callbacks); #ifdef ERTS_ENABLE_LOCK_CHECK { @@ -8165,17 +7859,23 @@ Uint actual; Uint wanted = erts_no_schedulers; Uint wanted_no_schedulers = erts_no_schedulers; - char name[16]; ethr_thr_opts opts = ETHR_THR_OPTS_DEFAULT_INITER; opts.detached = 1; - opts.name = name; +#ifdef ETHR_HAVE_THREAD_NAMES + opts.name = malloc(80); + if (!opts.name) { + ERTS_INTERNAL_ERROR("malloc failed to allocate memory!"); + } +#endif #ifdef ERTS_SMP if (erts_runq_supervision_interval) { opts.suggested_stack_size = 16; - erts_snprintf(opts.name, 16, "runq_supervisor"); +#ifdef ETHR_HAVE_THREAD_NAMES + sprintf(opts.name, "runq_supervisor"); +#endif erts_atomic_init_nob(&runq_supervisor_sleeping, 0); if (0 != ethr_event_init(&runq_supervision_event)) erl_exit(1, "Failed to create run-queue supervision event\n"); @@ -8202,7 +7902,9 @@ ASSERT(actual == esdp->no - 1); - erts_snprintf(opts.name, 16, "%lu_scheduler", actual + 1); +#ifdef ETHR_HAVE_THREAD_NAMES + sprintf(opts.name, "scheduler_%d", actual + 1); +#endif #ifdef __OSE__ /* This should be done in the bind strategy */ @@ -8224,14 +7926,18 @@ int ix; for (ix = 0; ix < erts_no_dirty_cpu_schedulers; ix++) { ErtsSchedulerData *esdp = ERTS_DIRTY_CPU_SCHEDULER_IX(ix); - erts_snprintf(opts.name, 16, "%d_dirty_cpu_scheduler", ix + 1); +#ifdef ETHR_HAVE_THREAD_NAMES + sprintf(opts.name,"dirty_cpu_scheduler_%d", ix + 1); +#endif res = ethr_thr_create(&esdp->tid,sched_dirty_cpu_thread_func,(void*)esdp,&opts); if (res != 0) erl_exit(1, "Failed to create dirty cpu scheduler thread %d\n", ix); } for (ix = 0; ix < erts_no_dirty_io_schedulers; ix++) { ErtsSchedulerData *esdp = ERTS_DIRTY_IO_SCHEDULER_IX(ix); - erts_snprintf(opts.name, 16, "%d_dirty_io_scheduler", ix + 1); +#ifdef ETHR_HAVE_THREAD_NAMES + sprintf(opts.name,"dirty_io_scheduler_%d", ix + 1); +#endif res = ethr_thr_create(&esdp->tid,sched_dirty_io_thread_func,(void*)esdp,&opts); if (res != 0) erl_exit(1, "Failed to create dirty io scheduler thread %d\n", ix); @@ -8242,7 +7948,9 @@ ERTS_THR_MEMORY_BARRIER; - erts_snprintf(opts.name, 16, "aux"); +#ifdef ETHR_HAVE_THREAD_NAMES + sprintf(opts.name, "aux"); +#endif #ifdef __OSE__ opts.coreNo = 0; @@ -8268,6 +7976,9 @@ erts_send_error_to_logger_nogl(dsbufp); } +#ifdef ETHR_HAVE_THREAD_NAMES + free(opts.name); +#endif } #endif /* ERTS_SMP */ @@ -9177,10 +8888,6 @@ a = erts_smp_atomic32_cmpxchg_mb(&p->state, n, e); } while (a != e); - - if (slocked) - erts_smp_proc_unlock(p, ERTS_PROC_LOCK_STATUS); - } switch (oprio) { @@ -9214,6 +8921,7 @@ { Process *proxy_p = NULL; ErtsRunQueue *rq; + erts_aint_t dt; ErtsSchedulerData *esdp; int context_reds; int fcalls; @@ -9313,7 +9021,7 @@ schedule_out_process(rq, state, p, proxy_p); /* Returns with rq locked! */ proxy_p = NULL; - ERTS_PROC_REDUCTIONS_EXECUTED(esdp, rq, + ERTS_PROC_REDUCTIONS_EXECUTED(rq, (int) ERTS_PSFLGS_GET_USR_PRIO(state), reds, actual_reds); @@ -9330,9 +9038,12 @@ ASSERT(esdp->free_process == p); esdp->free_process = NULL; #else - erts_proc_dec_refc(p); + state = erts_smp_atomic32_read_nob(&p->state); + if (!(state & ERTS_PSFLG_IN_RUNQ)) + erts_free_proc(p); #endif } + #ifdef ERTS_SMP ASSERT(!esdp->free_process); #endif @@ -9340,15 +9051,11 @@ ERTS_SMP_CHK_NO_PROC_LOCKS; - if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) { - if (esdp->check_time_reds >= ERTS_CHECK_TIME_REDS) - (void) erts_get_monotonic_time(esdp); - - if (esdp->last_monotonic_time >= erts_next_timeout_time(esdp->next_tmo_ref)) { - erts_smp_runq_unlock(rq); - erts_bump_timers(esdp->timer_wheel, esdp->last_monotonic_time); - erts_smp_runq_lock(rq); - } + dt = erts_do_time_read_and_reset(); + if (dt) { + erts_smp_runq_unlock(rq); + erts_bump_timer(dt); + erts_smp_runq_lock(rq); } BM_STOP_TIMER(system); @@ -9493,8 +9200,7 @@ } else if (!ERTS_SCHEDULER_IS_DIRTY(esdp) && (fcalls > input_reductions && - prepare_for_sys_schedule(esdp, !0))) { - ErtsMonotonicTime current_time; + prepare_for_sys_schedule(esdp))) { /* * Schedule system-level activities. */ @@ -9502,15 +9208,15 @@ erts_smp_atomic32_set_relb(&function_calls, 0); fcalls = 0; + ASSERT(!erts_port_task_have_outstanding_io_tasks()); + #if 0 /* Not needed since we wont wait in sys schedule */ erts_sys_schedule_interrupt(0); #endif erts_smp_runq_unlock(rq); erl_sys_schedule(1); - - current_time = erts_get_monotonic_time(esdp); - if (current_time >= erts_next_timeout_time(esdp->next_tmo_ref)) - erts_bump_timers(esdp->timer_wheel, current_time); + dt = erts_do_time_read_and_reset(); + if (dt) erts_bump_timer(dt); #ifdef ERTS_SMP erts_smp_runq_lock(rq); @@ -9535,9 +9241,7 @@ if (RUNQ_READ_LEN(&rq->ports.info.len)) { int have_outstanding_io; have_outstanding_io = erts_port_task_execute(rq, &esdp->current_port); - if ((!erts_eager_check_io - && have_outstanding_io - && fcalls > 2*input_reductions) + if ((have_outstanding_io && fcalls > 2*input_reductions) || rq->halt_in_progress) { /* * If we have performed more than 2*INPUT_REDUCTIONS since @@ -9649,8 +9353,13 @@ | ERTS_PSFLG_PENDING_EXIT | ERTS_PSFLG_ACTIVE_SYS)) == ERTS_PSFLG_SUSPENDED)) { - if (state & ERTS_PSFLG_FREE) - erts_proc_dec_refc(p); + if (state & ERTS_PSFLG_FREE) { +#ifdef ERTS_SMP + erts_smp_proc_dec_refc(p); +#else + erts_free_proc(p); +#endif + } if (proxy_p) { free_proxy_proc(proxy_p); proxy_p = NULL; @@ -9793,20 +9502,6 @@ /* Never run a suspended process */ ASSERT(!(ERTS_PSFLG_SUSPENDED & erts_smp_atomic32_read_nob(&p->state))); - ASSERT(erts_proc_read_refc(p) > 0); - - if (!(state & ERTS_PSFLG_EXITING) && ERTS_PTMR_IS_TIMED_OUT(p)) { - BeamInstr** pi; -#ifdef ERTS_SMP - ETHR_MEMBAR(ETHR_LoadLoad|ETHR_LoadStore); -#endif - pi = (BeamInstr **) p->def_arg_reg; - p->i = *pi; - p->flags &= ~F_INSLPQUEUE; - p->flags |= F_TIMO; - ERTS_PTMR_CLEAR(p); - } - return p; } } @@ -9859,7 +9554,15 @@ ASSERT(hp_start + hsz == hp); #endif - erts_queue_message(rp, &rp_locks, bp, msg, NIL); + erts_queue_message(rp, + &rp_locks, + bp, + msg, + NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); if (c_p == rp) rp_locks &= ~ERTS_PROC_LOCK_MAIN; @@ -10715,8 +10418,6 @@ #ifdef ERTS_SMP erts_proc_lock_fin(p); #endif - ASSERT(erts_smp_atomic32_read_nob(&p->state) & ERTS_PSFLG_FREE); - ASSERT(0 == erts_proc_read_refc(p)); erts_free(ERTS_ALC_T_PROC, (void *) p); } @@ -10759,7 +10460,7 @@ init_arg.run_queue = rq; init_arg.state = state; - ERTS_CT_ASSERT(offsetof(Process,common) == 0); + ASSERT(((char *) p) == ((char *) &p->common)); if (!erts_ptab_new_element(&erts_proc, &p->common, @@ -10769,8 +10470,6 @@ return NULL; } - ASSERT(erts_proc_read_refc(p) > 0); - ASSERT(internal_pid_serial(p->common.id) <= ERTS_MAX_PID_SERIAL); p->approx_started = erts_get_approx_time(); @@ -10820,7 +10519,6 @@ int ix = so->scheduler-1; ASSERT(0 <= ix && ix < erts_no_run_queues); rq = ERTS_RUNQ_IX(ix); - /* Unsupported feature... */ state |= ERTS_PSFLG_BOUND; } prio = (erts_aint32_t) so->priority; @@ -10853,9 +10551,6 @@ p->flags = erts_default_process_flags; - p->static_flags = 0; - if (so->flags & SPO_SYSTEM_PROC) - p->static_flags |= ERTS_STC_FLG_SYSTEM_PROC; if (so->flags & SPO_USE_ARGS) { p->min_heap_size = so->min_heap_size; p->min_vheap_size = so->min_vheap_size; @@ -10868,9 +10563,9 @@ p->schedule_count = 0; ASSERT(p->min_heap_size == erts_next_heap_size(p->min_heap_size, 0)); - p->u.initial[INITIAL_MOD] = mod; - p->u.initial[INITIAL_FUN] = func; - p->u.initial[INITIAL_ARI] = (Uint) arity; + p->initial[INITIAL_MOD] = mod; + p->initial[INITIAL_FUN] = func; + p->initial[INITIAL_ARI] = (Uint) arity; /* * Must initialize binary lists here before copying binaries to process. @@ -10911,7 +10606,7 @@ /* No need to initialize p->fcalls. */ - p->current = p->u.initial+INITIAL_MOD; + p->current = p->initial+INITIAL_MOD; p->i = (BeamInstr *) beam_apply; p->cp = (BeamInstr *) beam_apply+1; @@ -10934,7 +10629,11 @@ p->ftrace = NIL; p->reds = 0; - ERTS_PTMR_INIT(p); +#ifdef ERTS_SMP + p->common.u.alive.ptimer = NULL; +#else + sys_memset(&p->common.u.alive.tm, 0, sizeof(ErlTimer)); +#endif p->common.u.alive.reg = NULL; ERTS_P_LINKS(p) = NULL; @@ -10965,10 +10664,7 @@ p->msg_inq.last = &p->msg_inq.first; p->msg_inq.len = 0; #endif - p->bif_timers = NULL; -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - p->accessor_bif_timers = NULL; -#endif + p->u.bif_timers = NULL; p->mbuf = NULL; p->mbuf_sz = 0; p->psd = NULL; @@ -11126,7 +10822,11 @@ p->bin_old_vheap = 0; p->sys_task_qs = NULL; p->bin_vheap_mature = 0; - ERTS_PTMR_INIT(p); +#ifdef ERTS_SMP + p->common.u.alive.ptimer = NULL; +#else + memset(&(p->common.u.alive.tm), 0, sizeof(ErlTimer)); +#endif p->next = NULL; p->off_heap.first = NULL; p->off_heap.overhead = 0; @@ -11147,17 +10847,14 @@ p->msg.last = &p->msg.first; p->msg.save = &p->msg.first; p->msg.len = 0; - p->bif_timers = NULL; -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - p->accessor_bif_timers = NULL; -#endif + p->u.bif_timers = NULL; p->dictionary = NULL; p->seq_trace_clock = 0; p->seq_trace_lastcnt = 0; p->seq_trace_token = NIL; - p->u.initial[0] = 0; - p->u.initial[1] = 0; - p->u.initial[2] = 0; + p->initial[0] = 0; + p->initial[1] = 0; + p->initial[2] = 0; p->catches = 0; p->cp = NULL; p->i = NULL; @@ -11178,8 +10875,6 @@ p->parent = NIL; p->approx_started = 0; - p->static_flags = 0; - p->common.u.alive.started_interval = 0; #ifdef HIPE @@ -11244,10 +10939,7 @@ ASSERT(p->suspend_monitors == NULL); ASSERT(p->msg.first == NULL); ASSERT(p->msg.len == 0); - ASSERT(p->bif_timers == NULL); -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - ASSERT(p->accessor_bif_timers == NULL); -#endif + ASSERT(p->u.bif_timers == NULL); ASSERT(p->dictionary == NULL); ASSERT(p->catches == 0); ASSERT(p->cp == NULL); @@ -11411,24 +11103,9 @@ */ p->freason = EXTAG_EXIT; KILL_CATCHES(p); + cancel_timer(p); p->i = (BeamInstr *) beam_exit; -#ifndef ERTS_SMP - if (state & (ERTS_PSFLG_RUNNING|ERTS_PSFLG_RUNNING_SYS)) { - /* - * I non smp case: - * - * Currently executing process might be sent an exit - * signal if it is traced by a port that it also is - * linked to, and the port terminates during the - * trace. In this case we want schedule out the - * process as quickly as possible in order to detect - * the event as fast as possible. - */ - ERTS_VBUMP_ALL_REDS(p); - } -#endif - if (enqueue) add2runq(enqueue > 0 ? p : make_proxy_proc(NULL, p, enq_prio), state, @@ -11526,14 +11203,10 @@ { ErtsProcList *plp; ErtsRunQueue *rq; - ErtsSchedulerData *esdp = erts_get_scheduler_data(); ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_STATUS & erts_proc_lc_my_proc_locks(p)); - if (!esdp) - rq = RUNQ_READ_RQ(&p->run_queue); - else - rq = esdp->run_queue; + rq = erts_get_runq_current(NULL); plp = proclist_create(p); @@ -11550,7 +11223,6 @@ else #endif wake_scheduler(rq); - } #endif @@ -11576,7 +11248,11 @@ hp = erts_alloc_message_heap(term_size, &bp, &ohp, to, to_locksp); mess = copy_struct(exit_term, term_size, &hp, ohp); - erts_queue_message(to, to_locksp, bp, mess, NIL); + erts_queue_message(to, to_locksp, bp, mess, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); } else { ErlHeapFragment* bp; Eterm* hp; @@ -11592,7 +11268,11 @@ /* the trace token must in this case be updated by the caller */ seq_trace_output(token, mess, SEQ_TRACE_SEND, to->common.id, NULL); temp_token = copy_struct(token, sz_token, &hp, &bp->off_heap); - erts_queue_message(to, to_locksp, bp, mess, temp_token); + erts_queue_message(to, to_locksp, bp, mess, temp_token +#ifdef USE_VM_PROBES + , NIL +#endif + ); } } @@ -11739,21 +11419,23 @@ if (need_locks && erts_smp_proc_trylock(rp, need_locks) == EBUSY) { /* ... but we havn't got all locks on it ... */ - save_pending_exiter(rp); + save_pending_exiter(rp); /* * The pending exit will be discovered when next * process is scheduled in */ - goto set_pending_exit; + goto set_pending_exit; + } + else { + /* ...and we have all locks on it... */ + *rp_locks = ERTS_PROC_LOCKS_ALL; + set_proc_exiting(rp, + state, + (is_immed(rsn) + ? rsn + : copy_object(rsn, rp)), + NULL); } - /* ...and we have all locks on it... */ - *rp_locks = ERTS_PROC_LOCKS_ALL; - set_proc_exiting(rp, - state, - (is_immed(rsn) - ? rsn - : copy_object(rsn, rp)), - NULL); } else { /* Process running... */ @@ -11843,8 +11525,7 @@ ErtsMonitor *rmon; Process *rp; - switch (mon->type) { - case MON_ORIGIN: + if (mon->type == MON_ORIGIN) { /* We are monitoring someone else, we need to demonitor that one.. */ if (is_atom(mon->pid)) { /* remote by name */ ASSERT(is_node_name_atom(mon->pid)); @@ -11907,8 +11588,7 @@ } } } - break; - case MON_TARGET: + } else { /* type == MON_TARGET */ ASSERT(mon->type == MON_TARGET); ASSERT(is_pid(mon->pid) || is_internal_port(mon->pid)); if (is_internal_port(mon->pid)) { @@ -11967,12 +11647,6 @@ } } } - break; - case MON_TIME_OFFSET: - erts_demonitor_time_offset(mon->ref); - break; - default: - ERTS_INTERNAL_ERROR("Invalid monitor type"); } done: /* As the monitors are previously removed from the process, @@ -12119,7 +11793,6 @@ { p->arity = 0; /* No live registers */ p->fvalue = reason; - #ifdef USE_VM_PROBES if (DTRACE_ENABLED(process_exit)) { @@ -12132,10 +11805,6 @@ } #endif - if (p->static_flags & ERTS_STC_FLG_SYSTEM_PROC) - erl_exit(ERTS_DUMP_EXIT, "System process %T terminated: %T\n", - p->common.id, reason); - #ifdef ERTS_SMP ERTS_SMP_CHK_HAVE_ONLY_MAIN_PROC_LOCK(p); /* By locking all locks (main lock is already locked) when going @@ -12175,20 +11844,20 @@ ASSERT((ERTS_TRACE_FLAGS(p) & F_INITIAL_TRACE_FLAGS) == F_INITIAL_TRACE_FLAGS); - ASSERT(erts_proc_read_refc(p) > 0); - if (ERTS_PTMR_IS_SET(p)) { - erts_cancel_proc_timer(p); - ASSERT(erts_proc_read_refc(p) > 0); - } + cancel_timer(p); /* Always cancel timer just in case */ + + if (p->u.bif_timers) + erts_cancel_bif_timers(p, ERTS_PROC_LOCKS_ALL); erts_smp_proc_unlock(p, ERTS_PROC_LOCKS_ALL_MINOR); /* - * p->u.initial of this process can *not* be used anymore; + * The p->u.bif_timers of this process can *not* be used anymore; * will be overwritten by misc termination data. */ p->u.terminate = NULL; + erts_continue_exit_process(p); } @@ -12213,29 +11882,6 @@ ASSERT(ERTS_PROC_IS_EXITING(p)); - ASSERT(erts_proc_read_refc(p) > 0); - if (p->bif_timers) { - if (erts_cancel_bif_timers(p, p->bif_timers, &p->u.terminate)) { - ASSERT(erts_proc_read_refc(p) > 0); - goto yield; - } - ASSERT(erts_proc_read_refc(p) > 0); - p->bif_timers = NULL; - } - -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - if (p->accessor_bif_timers) { - if (erts_detach_accessor_bif_timers(p, - p->accessor_bif_timers, - &p->u.terminate)) { - ASSERT(erts_proc_read_refc(p) > 0); - goto yield; - } - ASSERT(erts_proc_read_refc(p) > 0); - p->accessor_bif_timers = NULL; - } -#endif - #ifdef ERTS_SMP if (p->flags & F_HAVE_BLCKD_MSCHED) { ErtsSchedSuspendResult ssr; @@ -12329,8 +11975,6 @@ p->scheduler_data->current_process = NULL; p->scheduler_data->free_process = p; -#else - erts_proc_inc_refc(p); /* Decremented in schedule() */ #endif /* Time of death! */ @@ -12349,26 +11993,34 @@ { /* Inactivate and notify free */ erts_aint32_t n, e, a = erts_smp_atomic32_read_nob(&p->state); +#ifdef ERTS_SMP int refc_inced = 0; +#endif while (1) { n = e = a; ASSERT(a & ERTS_PSFLG_EXITING); n |= ERTS_PSFLG_FREE; n &= ~ERTS_PSFLG_ACTIVE; +#ifdef ERTS_SMP if ((n & ERTS_PSFLG_IN_RUNQ) && !refc_inced) { - erts_proc_inc_refc(p); + erts_smp_proc_inc_refc(p); refc_inced = 1; } +#endif a = erts_smp_atomic32_cmpxchg_mb(&p->state, n, e); if (a == e) break; } +#ifdef ERTS_SMP if (refc_inced && !(n & ERTS_PSFLG_IN_RUNQ)) - erts_proc_dec_refc(p); + erts_smp_proc_dec_refc(p); +#endif } - dep = (p->flags & F_DISTRIBUTION) ? erts_this_dist_entry : NULL; + dep = ((p->flags & F_DISTRIBUTION) + ? ERTS_PROC_SET_DIST_ENTRY(p, ERTS_PROC_LOCKS_ALL, NULL) + : NULL); scb = ERTS_PROC_SET_SAVED_CALLS_BUF(p, ERTS_PROC_LOCKS_ALL, NULL); pbt = ERTS_PROC_SET_CALL_TIME(p, ERTS_PROC_LOCKS_ALL, NULL); nif_export = ERTS_PROC_SET_NIF_TRAP_EXPORT(p, ERTS_PROC_LOCKS_ALL, NULL); @@ -12380,6 +12032,8 @@ if (dep) { erts_do_net_exits(dep, reason); + if(dep) + erts_deref_dist_entry(dep); } /* @@ -12452,6 +12106,64 @@ } +/* Callback for process timeout */ +static void +timeout_proc(Process* p) +{ + erts_aint32_t state; + BeamInstr** pi = (BeamInstr **) p->def_arg_reg; + p->i = *pi; + p->flags |= F_TIMO; + p->flags &= ~F_INSLPQUEUE; + + state = erts_smp_atomic32_read_acqb(&p->state); + if (!(state & ERTS_PSFLG_ACTIVE)) + schedule_process(p, state, ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS); +} + + +void +cancel_timer(Process* p) +{ + ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(p)); + p->flags &= ~(F_INSLPQUEUE|F_TIMO); +#ifdef ERTS_SMP + erts_cancel_smp_ptimer(p->common.u.alive.ptimer); +#else + erts_cancel_timer(&p->common.u.alive.tm); +#endif +} + +/* + * Insert a process into the time queue, with a timeout 'timeout' in ms. + */ +void +set_timer(Process* p, Uint timeout) +{ + ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(p)); + + /* check for special case timeout=0 DONT ADD TO time queue */ + if (timeout == 0) { + p->flags |= F_TIMO; + return; + } + p->flags |= F_INSLPQUEUE; + p->flags &= ~F_TIMO; + +#ifdef ERTS_SMP + erts_create_smp_ptimer(&p->common.u.alive.ptimer, + p->common.id, + (ErlTimeoutProc) timeout_proc, + timeout); +#else + erts_set_timer(&p->common.u.alive.tm, + (ErlTimeoutProc) timeout_proc, + NULL, + (void*) p, + timeout); +#endif +} + /* * Stack dump functions follow. */ @@ -12467,7 +12179,7 @@ } erts_program_counter_info(to, to_arg, p); for (sp = p->stop; sp < STACK_START(p); sp++) { - yreg = stack_element_dump(to, to_arg, sp, yreg); + yreg = stack_element_dump(to, to_arg, p, sp, yreg); } } @@ -12524,7 +12236,7 @@ } static int -stack_element_dump(int to, void *to_arg, Eterm* sp, int yreg) +stack_element_dump(int to, void *to_arg, Process* p, Eterm* sp, int yreg) { Eterm x = *sp; @@ -12553,188 +12265,6 @@ } /* - * Print scheduler information - */ -void -erts_print_scheduler_info(int to, void *to_arg, ErtsSchedulerData *esdp) { - int i; - erts_aint32_t flg; - Process *p; - - erts_print(to, to_arg, "=scheduler:%u\n", esdp->no); - -#ifdef ERTS_SMP - flg = erts_smp_atomic32_read_dirty(&esdp->ssi->flags); - erts_print(to, to_arg, "Scheduler Sleep Info Flags: "); - for (i = 0; i < ERTS_SSI_FLGS_MAX && flg; i++) { - erts_aint32_t chk = (1 << i); - if (flg & chk) { - switch (chk) { - case ERTS_SSI_FLG_SLEEPING: - erts_print(to, to_arg, "SLEEPING"); break; - case ERTS_SSI_FLG_POLL_SLEEPING: - erts_print(to, to_arg, "POLL_SLEEPING"); break; - case ERTS_SSI_FLG_TSE_SLEEPING: - erts_print(to, to_arg, "TSE_SLEEPING"); break; - case ERTS_SSI_FLG_WAITING: - erts_print(to, to_arg, "WAITING"); break; - case ERTS_SSI_FLG_SUSPENDED: - erts_print(to, to_arg, "SUSPENDED"); break; - default: - erts_print(to, to_arg, "UNKNOWN(%d)", flg); break; - } - if (flg > chk) - erts_print(to, to_arg, " | "); - flg -= chk; - } - } - erts_print(to, to_arg, "\n"); -#endif - - flg = erts_atomic32_read_dirty(&esdp->ssi->aux_work); - erts_print(to, to_arg, "Scheduler Sleep Info Aux Work: "); - for (i = 0; i < ERTS_SSI_AUX_WORK_NO_FLAGS && flg; i++) { - erts_aint32_t chk = (1 << i); - if (flg & chk) { - if (erts_aux_work_flag_descr[i]) - erts_print(to, to_arg, "%s", erts_aux_work_flag_descr[i]); - else - erts_print(to, to_arg, "1<<%d", i); - if (flg > chk) - erts_print(to, to_arg, " | "); - flg -= chk; - } - } - erts_print(to, to_arg, "\n"); - - erts_print(to, to_arg, "Current Port: "); - if (esdp->current_port) - erts_print(to, to_arg, "%T", esdp->current_port->common.id); - erts_print(to, to_arg, "\n"); - - for (i = 0; i < ERTS_NO_PROC_PRIO_LEVELS; i++) { - erts_print(to, to_arg, "Run Queue "); - switch (i) { - case PRIORITY_MAX: - erts_print(to, to_arg, "Max "); - break; - case PRIORITY_HIGH: - erts_print(to, to_arg, "High "); - break; - case PRIORITY_NORMAL: - erts_print(to, to_arg, "Normal "); - break; - case PRIORITY_LOW: - erts_print(to, to_arg, "Low "); - break; - default: - erts_print(to, to_arg, "Unknown "); - break; - } - erts_print(to, to_arg, "Length: %d\n", - erts_smp_atomic32_read_dirty(&esdp->run_queue->procs.prio_info[i].len)); - } - erts_print(to, to_arg, "Run Queue Port Length: %d\n", - erts_smp_atomic32_read_dirty(&esdp->run_queue->ports.info.len)); - - flg = erts_smp_atomic32_read_dirty(&esdp->run_queue->flags); - erts_print(to, to_arg, "Run Queue Flags: "); - for (i = 0; i < ERTS_RUNQ_FLG_MAX && flg; i++) { - erts_aint32_t chk = (1 << i); - if (flg & chk) { - switch (chk) { - case (1 << PRIORITY_MAX): - erts_print(to, to_arg, "NONEMPTY_MAX"); break; - case (1 << PRIORITY_HIGH): - erts_print(to, to_arg, "NONEMPTY_HIGH"); break; - case (1 << PRIORITY_NORMAL): - erts_print(to, to_arg, "NONEMPTY_NORMAL"); break; - case (1 << PRIORITY_LOW): - erts_print(to, to_arg, "NONEMPTY_LOW"); break; - case (1 << (PRIORITY_MAX + ERTS_RUNQ_FLGS_EMIGRATE_SHFT)): - erts_print(to, to_arg, "EMIGRATE_MAX"); break; - case (1 << (PRIORITY_HIGH + ERTS_RUNQ_FLGS_EMIGRATE_SHFT)): - erts_print(to, to_arg, "EMIGRATE_HIGH"); break; - case (1 << (PRIORITY_NORMAL + ERTS_RUNQ_FLGS_EMIGRATE_SHFT)): - erts_print(to, to_arg, "EMIGRATE_NORMAL"); break; - case (1 << (PRIORITY_LOW + ERTS_RUNQ_FLGS_EMIGRATE_SHFT)): - erts_print(to, to_arg, "EMIGRATE_LOW"); break; - case (1 << (PRIORITY_MAX + ERTS_RUNQ_FLGS_IMMIGRATE_SHFT)): - erts_print(to, to_arg, "IMMIGRATE_MAX"); break; - case (1 << (PRIORITY_HIGH + ERTS_RUNQ_FLGS_IMMIGRATE_SHFT)): - erts_print(to, to_arg, "IMMIGRATE_HIGH"); break; - case (1 << (PRIORITY_NORMAL + ERTS_RUNQ_FLGS_IMMIGRATE_SHFT)): - erts_print(to, to_arg, "IMMIGRATE_NORMAL"); break; - case (1 << (PRIORITY_LOW + ERTS_RUNQ_FLGS_IMMIGRATE_SHFT)): - erts_print(to, to_arg, "IMMIGRATE_LOW"); break; - case (1 << (PRIORITY_MAX + ERTS_RUNQ_FLGS_EVACUATE_SHFT)): - erts_print(to, to_arg, "EVACUATE_MAX"); break; - case (1 << (PRIORITY_HIGH + ERTS_RUNQ_FLGS_EVACUATE_SHFT)): - erts_print(to, to_arg, "EVACUATE_HIGH"); break; - case (1 << (PRIORITY_NORMAL + ERTS_RUNQ_FLGS_EVACUATE_SHFT)): - erts_print(to, to_arg, "EVACUATE_NORMAL"); break; - case (1 << (PRIORITY_LOW + ERTS_RUNQ_FLGS_EVACUATE_SHFT)): - erts_print(to, to_arg, "EVACUATE_LOW"); break; - case ERTS_RUNQ_FLG_OUT_OF_WORK: - erts_print(to, to_arg, "OUT_OF_WORK"); break; - case ERTS_RUNQ_FLG_HALFTIME_OUT_OF_WORK: - erts_print(to, to_arg, "HALFTIME_OUT_OF_WORK"); break; - case ERTS_RUNQ_FLG_SUSPENDED: - erts_print(to, to_arg, "SUSPENDED"); break; - case ERTS_RUNQ_FLG_CHK_CPU_BIND: - erts_print(to, to_arg, "CHK_CPU_BIND"); break; - case ERTS_RUNQ_FLG_INACTIVE: - erts_print(to, to_arg, "INACTIVE"); break; - case ERTS_RUNQ_FLG_NONEMPTY: - erts_print(to, to_arg, "NONEMPTY"); break; - case ERTS_RUNQ_FLG_PROTECTED: - erts_print(to, to_arg, "PROTECTED"); break; - default: - erts_print(to, to_arg, "UNKNOWN(%d)", flg); break; - } - if (flg > chk) - erts_print(to, to_arg, " | "); - flg -= chk; - } - } - erts_print(to, to_arg, "\n"); - - /* This *MUST* to be the last information in scheduler block */ - p = esdp->current_process; - erts_print(to, to_arg, "Current Process: "); - if (esdp->current_process && !(ERTS_TRACE_FLAGS(p) & F_SENSITIVE)) { - flg = erts_smp_atomic32_read_dirty(&p->state); - erts_print(to, to_arg, "%T\n", p->common.id); - - erts_print(to, to_arg, "Current Process State: "); - erts_dump_process_state(to, to_arg, flg); - - erts_print(to, to_arg, "Current Process Internal State: "); - erts_dump_extended_process_state(to, to_arg, flg); - - erts_print(to, to_arg, "Current Process Program counter: %p (", p->i); - print_function_from_pc(to, to_arg, p->i); - erts_print(to, to_arg, ")\n"); - erts_print(to, to_arg, "Current Process CP: %p (", p->cp); - print_function_from_pc(to, to_arg, p->cp); - erts_print(to, to_arg, ")\n"); - - /* Getting this stacktrace can segfault if we are very very - unlucky if called while a process is being garbage collected. - Therefore we only call this on other schedulers if we either - have protection against segfaults, or we know that the process - is not garbage collecting. It *should* always be safe to call - on a process owned by us, even if it is currently being garbage - collected. - */ - erts_print(to, to_arg, "Current Process Limited Stack Trace:\n"); - erts_limited_stack_trace(to, to_arg, p); - } else - erts_print(to, to_arg, "\n"); - -} - -/* * A nice system halt closing all open port goes as follows: * 1) This function schedules the aux work ERTS_SSI_AUX_WORK_REAP_PORTS * on all schedulers, then schedules itself out. diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_process_dict.c erlang-17.3-dfsg/erts/emulator/beam/erl_process_dict.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_process_dict.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_process_dict.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -48,7 +47,7 @@ /* Hash constant macros */ #define MAX_HASH 1342177280UL -#define INITIAL_SIZE (erts_pd_initial_size) +#define INITIAL_SIZE 10 /* Hash utility macros */ #define HASH_RANGE(PDict) ((PDict)->homeSize + (PDict)->splitPosition) @@ -83,7 +82,6 @@ static void pd_hash_erase(Process *p, Eterm id, Eterm *ret); static void pd_hash_erase_all(Process *p); static Eterm pd_hash_get_keys(Process *p, Eterm value); -static Eterm pd_hash_get_all_keys(Process *p, ProcDict *pd); static Eterm pd_hash_get_all(Process *p, ProcDict *pd); static Eterm pd_hash_put(Process *p, Eterm id, Eterm value); @@ -277,16 +275,6 @@ BIF_RET(ret); } -BIF_RETTYPE get_keys_0(BIF_ALIST_0) -{ - Eterm ret; - - PD_CHECK(BIF_P->dictionary); - ret = pd_hash_get_all_keys(BIF_P,BIF_P->dictionary); - PD_CHECK(BIF_P->dictionary); - BIF_RET(ret); -} - BIF_RETTYPE get_keys_1(BIF_ALIST_1) { Eterm ret; @@ -424,47 +412,6 @@ return am_undefined; } -#define PD_GET_TKEY(Dst,Src) \ -do { \ - ASSERT(is_tuple((Src))); \ - ASSERT(arityval(*((Eterm*)tuple_val((Src)))) == 2); \ - (Dst) = ((Eterm*)tuple_val((Src)))[1]; \ -} while(0) - -static Eterm pd_hash_get_all_keys(Process *p, ProcDict *pd) { - Eterm* hp; - Eterm res = NIL; - Eterm tmp, tmp2; - unsigned int i; - unsigned int num; - - if (pd == NULL) { - return res; - } - - num = HASH_RANGE(pd); - hp = HAlloc(p, pd->numElements * 2); - - for (i = 0; i < num; ++i) { - tmp = ARRAY_GET(pd, i); - if (is_boxed(tmp)) { - PD_GET_TKEY(tmp,tmp); - res = CONS(hp, tmp, res); - hp += 2; - } else if (is_list(tmp)) { - while (tmp != NIL) { - tmp2 = TCAR(tmp); - PD_GET_TKEY(tmp2,tmp2); - res = CONS(hp, tmp2, res); - hp += 2; - tmp = TCDR(tmp); - } - } - } - return res; -} -#undef PD_GET_TKEY - static Eterm pd_hash_get_keys(Process *p, Eterm value) { Eterm *hp; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_process_dict.h erlang-17.3-dfsg/erts/emulator/beam/erl_process_dict.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_process_dict.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_process_dict.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_process_dump.c erlang-17.3-dfsg/erts/emulator/beam/erl_process_dump.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_process_dump.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_process_dump.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -44,9 +43,8 @@ static void dump_element(int to, void *to_arg, Eterm x); static void dump_dist_ext(int to, void *to_arg, ErtsDistExternal *edep); static void dump_element_nl(int to, void *to_arg, Eterm x); -static int stack_element_dump(int to, void *to_arg, Eterm* sp, +static int stack_element_dump(int to, void *to_arg, Process* p, Eterm* sp, int yreg); -static void stack_trace_dump(int to, void *to_arg, Eterm* sp); static void print_function_from_pc(int to, void *to_arg, BeamInstr* x); static void heap_dump(int to, void *to_arg, Eterm x); static void dump_binaries(int to, void *to_arg, Binary* root); @@ -150,7 +148,7 @@ if ((ERTS_TRACE_FLAGS(p) & F_SENSITIVE) == 0) { erts_print(to, to_arg, "=proc_stack:%T\n", p->common.id); for (sp = p->stop; sp < STACK_START(p); sp++) { - yreg = stack_element_dump(to, to_arg, sp, yreg); + yreg = stack_element_dump(to, to_arg, p, sp, yreg); } erts_print(to, to_arg, "=proc_heap:%T\n", p->common.id); @@ -245,65 +243,9 @@ erts_putc(to, to_arg, '\n'); } -static void -stack_trace_dump(int to, void *to_arg, Eterm *sp) { - Eterm x = *sp; - if (is_CP(x)) { - erts_print(to, to_arg, "%p:", sp); - erts_print(to, to_arg, "SReturn addr 0x%X (", cp_val(x)); - print_function_from_pc(to, to_arg, cp_val(x)); - erts_print(to, to_arg, ")\n"); - } -} - -void -erts_limited_stack_trace(int to, void *to_arg, Process *p) -{ - Eterm* sp; - - - if (ERTS_TRACE_FLAGS(p) & F_SENSITIVE) { - return; - } - - if (STACK_START(p) < STACK_TOP(p)) { - return; - } - - if ((STACK_START(p) - STACK_TOP(p)) < 512) { - if (erts_sys_is_area_readable((char*)STACK_TOP(p), - (char*)STACK_START(p))) - for (sp = STACK_TOP(p); sp < STACK_START(p); sp++) - stack_trace_dump(to, to_arg, sp); - else - erts_print(to, to_arg, "Could not read from stack memory: %p - %p\n", - STACK_TOP(p), STACK_START(p)); - } else { - sp = STACK_TOP(p); - if (erts_sys_is_area_readable((char*)STACK_TOP(p), - (char*)(STACK_TOP(p) + 25))) - for (; sp < (STACK_TOP(p) + 256); sp++) - stack_trace_dump(to, to_arg, sp); - else - erts_print(to, to_arg, "Could not read from stack memory: %p - %p\n", - STACK_TOP(p), STACK_TOP(p) + 256); - - erts_print(to, to_arg, "%p: skipping %d frames\n", - sp, STACK_START(p) - STACK_TOP(p) - 512); - - if (erts_sys_is_area_readable((char*)(STACK_START(p) - 256), - (char*)STACK_START(p))) - for (sp = STACK_START(p) - 256; sp < STACK_START(p); sp++) - stack_trace_dump(to, to_arg, sp); - else - erts_print(to, to_arg, "Could not read from stack memory: %p - %p\n", - STACK_START(p) - 256, STACK_START(p)); - } - -} static int -stack_element_dump(int to, void *to_arg, Eterm* sp, int yreg) +stack_element_dump(int to, void *to_arg, Process* p, Eterm* sp, int yreg) { Eterm x = *sp; @@ -566,114 +508,3 @@ erts_print(to, to_arg, "%02X", *s++); } } - -void erts_dump_process_state(int to, void *to_arg, erts_aint32_t psflg) { - if (psflg & ERTS_PSFLG_FREE) - erts_print(to, to_arg, "Non Existing\n"); /* Should never happen */ - else if (psflg & ERTS_PSFLG_EXITING) - erts_print(to, to_arg, "Exiting\n"); - else if (psflg & ERTS_PSFLG_GC) { - erts_print(to, to_arg, "Garbing\n"); - } - else if (psflg & ERTS_PSFLG_SUSPENDED) - erts_print(to, to_arg, "Suspended\n"); - else if (psflg & ERTS_PSFLG_RUNNING) { - erts_print(to, to_arg, "Running\n"); - } - else if (psflg & ERTS_PSFLG_ACTIVE) - erts_print(to, to_arg, "Scheduled\n"); - else - erts_print(to, to_arg, "Waiting\n"); -} - -void -erts_dump_extended_process_state(int to, void *to_arg, erts_aint32_t psflg) { - - int i; - - switch (ERTS_PSFLGS_GET_ACT_PRIO(psflg)) { - case PRIORITY_MAX: erts_print(to, to_arg, "ACT_PRIO_MAX | "); break; - case PRIORITY_HIGH: erts_print(to, to_arg, "ACT_PRIO_HIGH | "); break; - case PRIORITY_NORMAL: erts_print(to, to_arg, "ACT_PRIO_NORMAL | "); break; - case PRIORITY_LOW: erts_print(to, to_arg, "ACT_PRIO_LOW | "); break; - } - switch (ERTS_PSFLGS_GET_USR_PRIO(psflg)) { - case PRIORITY_MAX: erts_print(to, to_arg, "USR_PRIO_MAX | "); break; - case PRIORITY_HIGH: erts_print(to, to_arg, "USR_PRIO_HIGH | "); break; - case PRIORITY_NORMAL: erts_print(to, to_arg, "USR_PRIO_NORMAL | "); break; - case PRIORITY_LOW: erts_print(to, to_arg, "USR_PRIO_LOW | "); break; - } - switch (ERTS_PSFLGS_GET_PRQ_PRIO(psflg)) { - case PRIORITY_MAX: erts_print(to, to_arg, "PRQ_PRIO_MAX"); break; - case PRIORITY_HIGH: erts_print(to, to_arg, "PRQ_PRIO_HIGH"); break; - case PRIORITY_NORMAL: erts_print(to, to_arg, "PRQ_PRIO_NORMAL"); break; - case PRIORITY_LOW: erts_print(to, to_arg, "PRQ_PRIO_LOW"); break; - } - - psflg &= ~(ERTS_PSFLGS_ACT_PRIO_MASK | - ERTS_PSFLGS_USR_PRIO_MASK | - ERTS_PSFLGS_PRQ_PRIO_MASK); - - if (psflg) - erts_print(to, to_arg, " | "); - - for (i = 0; i < ERTS_PSFLG_MAX && psflg; i++) { - erts_aint32_t chk = (1 << i); - if (psflg & chk) { - switch (chk) { - case ERTS_PSFLG_IN_PRQ_MAX: - erts_print(to, to_arg, "IN_PRQ_MAX"); break; - case ERTS_PSFLG_IN_PRQ_HIGH: - erts_print(to, to_arg, "IN_PRQ_HIGH"); break; - case ERTS_PSFLG_IN_PRQ_NORMAL: - erts_print(to, to_arg, "IN_PRQ_NORMAL"); break; - case ERTS_PSFLG_IN_PRQ_LOW: - erts_print(to, to_arg, "IN_PRQ_LOW"); break; - case ERTS_PSFLG_FREE: - erts_print(to, to_arg, "FREE"); break; - case ERTS_PSFLG_EXITING: - erts_print(to, to_arg, "EXITING"); break; - case ERTS_PSFLG_PENDING_EXIT: - erts_print(to, to_arg, "PENDING_EXIT"); break; - case ERTS_PSFLG_ACTIVE: - erts_print(to, to_arg, "ACTIVE"); break; - case ERTS_PSFLG_IN_RUNQ: - erts_print(to, to_arg, "IN_RUNQ"); break; - case ERTS_PSFLG_RUNNING: - erts_print(to, to_arg, "RUNNING"); break; - case ERTS_PSFLG_SUSPENDED: - erts_print(to, to_arg, "SUSPENDED"); break; - case ERTS_PSFLG_GC: - erts_print(to, to_arg, "GC"); break; - case ERTS_PSFLG_BOUND: - erts_print(to, to_arg, "BOUND"); break; - case ERTS_PSFLG_TRAP_EXIT: - erts_print(to, to_arg, "TRAP_EXIT"); break; - case ERTS_PSFLG_ACTIVE_SYS: - erts_print(to, to_arg, "ACTIVE_SYS"); break; - case ERTS_PSFLG_RUNNING_SYS: - erts_print(to, to_arg, "RUNNING_SYS"); break; - case ERTS_PSFLG_PROXY: - erts_print(to, to_arg, "PROXY"); break; - case ERTS_PSFLG_DELAYED_SYS: - erts_print(to, to_arg, "DELAYED_SYS"); break; -#ifdef ERTS_DIRTY_SCHEDULERS - case ERTS_PSFLG_DIRTY_CPU_PROC: - erts_print(to, to_arg, "DIRTY_CPU_PROC"); break; - case ERTS_PSFLG_DIRTY_IO_PROC: - erts_print(to, to_arg, "DIRTY_IO_PROC"); break; - case ERTS_PSFLG_DIRTY_CPU_PROC_IN_Q: - erts_print(to, to_arg, "DIRTY_CPU_PROC_IN_Q"); break; - case ERTS_PSFLG_DIRTY_IO_PROC_IN_Q: - erts_print(to, to_arg, "DIRTY_IO_PROC_IN_Q"); break; -#endif - default: - erts_print(to, to_arg, "UNKNOWN(%d)", chk); break; - } - if (psflg > chk) - erts_print(to, to_arg, " | "); - psflg -= chk; - } - } - erts_print(to, to_arg, "\n"); -} diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_process.h erlang-17.3-dfsg/erts/emulator/beam/erl_process.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_process.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_process.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -53,13 +52,12 @@ #include "erl_node_container_utils.h" #include "erl_node_tables.h" #include "erl_monitors.h" -#include "erl_hl_timer.h" +#include "erl_bif_timer.h" #include "erl_time.h" #include "erl_atom_table.h" #include "external.h" #include "erl_mseg.h" #include "erl_async.h" -#include "erl_gc.h" #ifdef HIPE #include "hipe_process.h" @@ -106,7 +104,6 @@ }; extern Export exp_send, exp_receive, exp_timeout; -extern int erts_eager_check_io; extern int erts_sched_compact_load; extern int erts_sched_balance_util; extern Uint erts_no_schedulers; @@ -171,8 +168,6 @@ #define ERTS_RUNQ_FLG_PROTECTED \ (((Uint32) 1) << (ERTS_RUNQ_FLG_BASE2 + 6)) -#define ERTS_RUNQ_FLG_MAX (ERTS_RUNQ_FLG_BASE2 + 7) - #define ERTS_RUNQ_FLGS_MIGRATION_QMASKS \ (ERTS_RUNQ_FLGS_EMIGRATE_QMASK \ | ERTS_RUNQ_FLGS_IMMIGRATE_QMASK \ @@ -255,8 +250,6 @@ #define ERTS_SSI_FLG_WAITING (((erts_aint32_t) 1) << 3) #define ERTS_SSI_FLG_SUSPENDED (((erts_aint32_t) 1) << 4) -#define ERTS_SSI_FLGS_MAX 5 - #define ERTS_SSI_FLGS_SLEEP_TYPE \ (ERTS_SSI_FLG_TSE_SLEEPING|ERTS_SSI_FLG_POLL_SLEEPING) @@ -269,73 +262,24 @@ | ERTS_SSI_FLG_SUSPENDED) /* - * Keep ERTS_SSI_AUX_WORK flags ordered in expected frequency - * order relative eachother. Most frequent at lowest at lowest - * index. - * - * ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED_IX *need* to be - * highest index... - * - * Remember to update description in erts_pre_init_process() - * when adding new flags... + * Keep ERTS_SSI_AUX_WORK flags in expected frequency order relative + * eachother. Most frequent - lowest bit number. */ -typedef enum { - ERTS_SSI_AUX_WORK_DELAYED_AW_WAKEUP_IX, - ERTS_SSI_AUX_WORK_DD_IX, - ERTS_SSI_AUX_WORK_DD_THR_PRGR_IX, - ERTS_SSI_AUX_WORK_FIX_ALLOC_DEALLOC_IX, - ERTS_SSI_AUX_WORK_FIX_ALLOC_LOWER_LIM_IX, - ERTS_SSI_AUX_WORK_THR_PRGR_LATER_OP_IX, - ERTS_SSI_AUX_WORK_CNCLD_TMRS_IX, - ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR_IX, - ERTS_SSI_AUX_WORK_ASYNC_READY_IX, - ERTS_SSI_AUX_WORK_ASYNC_READY_CLEAN_IX, - ERTS_SSI_AUX_WORK_MISC_THR_PRGR_IX, - ERTS_SSI_AUX_WORK_MISC_IX, - ERTS_SSI_AUX_WORK_CHECK_CHILDREN_IX, - ERTS_SSI_AUX_WORK_SET_TMO_IX, - ERTS_SSI_AUX_WORK_MSEG_CACHE_CHECK_IX, - ERTS_SSI_AUX_WORK_REAP_PORTS_IX, - ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED_IX, /* SHOULD be last flag index */ - - ERTS_SSI_AUX_WORK_NO_FLAGS /* Not a flag index... */ -} ErtsSsiAuxWorkFlagIndex; - -#define ERTS_SSI_AUX_WORK_DELAYED_AW_WAKEUP \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_DELAYED_AW_WAKEUP_IX) -#define ERTS_SSI_AUX_WORK_DD \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_DD_IX) -#define ERTS_SSI_AUX_WORK_DD_THR_PRGR \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_DD_THR_PRGR_IX) -#define ERTS_SSI_AUX_WORK_FIX_ALLOC_DEALLOC \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_FIX_ALLOC_DEALLOC_IX) -#define ERTS_SSI_AUX_WORK_FIX_ALLOC_LOWER_LIM \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_FIX_ALLOC_LOWER_LIM_IX) -#define ERTS_SSI_AUX_WORK_THR_PRGR_LATER_OP \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_THR_PRGR_LATER_OP_IX) -#define ERTS_SSI_AUX_WORK_CNCLD_TMRS \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_CNCLD_TMRS_IX) -#define ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_CNCLD_TMRS_THR_PRGR_IX) -#define ERTS_SSI_AUX_WORK_ASYNC_READY \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_ASYNC_READY_IX) -#define ERTS_SSI_AUX_WORK_ASYNC_READY_CLEAN \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_ASYNC_READY_CLEAN_IX) -#define ERTS_SSI_AUX_WORK_MISC_THR_PRGR \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_MISC_THR_PRGR_IX) -#define ERTS_SSI_AUX_WORK_MISC \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_MISC_IX) -#define ERTS_SSI_AUX_WORK_CHECK_CHILDREN \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_CHECK_CHILDREN_IX) -#define ERTS_SSI_AUX_WORK_SET_TMO \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_SET_TMO_IX) -#define ERTS_SSI_AUX_WORK_MSEG_CACHE_CHECK \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_MSEG_CACHE_CHECK_IX) -#define ERTS_SSI_AUX_WORK_REAP_PORTS \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_REAP_PORTS_IX) -#define ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED \ - (((erts_aint32_t) 1) << ERTS_SSI_AUX_WORK_DEBUG_WAIT_COMPLETED_IX) +#define ERTS_SSI_AUX_WORK_DELAYED_AW_WAKEUP (((erts_aint32_t) 1) << 0) +#define ERTS_SSI_AUX_WORK_DD (((erts_aint32_t) 1) << 1) +#define ERTS_SSI_AUX_WORK_DD_THR_PRGR (((erts_aint32_t) 1) << 2) +#define ERTS_SSI_AUX_WORK_FIX_ALLOC_DEALLOC (((erts_aint32_t) 1) << 3) +#define ERTS_SSI_AUX_WORK_FIX_ALLOC_LOWER_LIM (((erts_aint32_t) 1) << 4) +#define ERTS_SSI_AUX_WORK_THR_PRGR_LATER_OP (((erts_aint32_t) 1) << 5) +#define ERTS_SSI_AUX_WORK_ASYNC_READY (((erts_aint32_t) 1) << 6) +#define ERTS_SSI_AUX_WORK_ASYNC_READY_CLEAN (((erts_aint32_t) 1) << 7) +#define ERTS_SSI_AUX_WORK_MISC_THR_PRGR (((erts_aint32_t) 1) << 8) +#define ERTS_SSI_AUX_WORK_MISC (((erts_aint32_t) 1) << 9) +#define ERTS_SSI_AUX_WORK_CHECK_CHILDREN (((erts_aint32_t) 1) << 10) +#define ERTS_SSI_AUX_WORK_SET_TMO (((erts_aint32_t) 1) << 11) +#define ERTS_SSI_AUX_WORK_MSEG_CACHE_CHECK (((erts_aint32_t) 1) << 12) +#define ERTS_SSI_AUX_WORK_REAP_PORTS (((erts_aint32_t) 1) << 13) typedef struct ErtsSchedulerSleepInfo_ ErtsSchedulerSleepInfo; @@ -396,7 +340,7 @@ } ErtsRunQueueInfo; -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT +#ifdef HAVE_GETHRTIME # undef ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT_OPT # define ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT_OPT 1 #endif @@ -406,7 +350,13 @@ #undef ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT #define ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT_OPT -typedef erts_atomic64_t ErtsAtomicSchedTime; +#ifdef ARCH_64 +typedef erts_atomic_t ErtsAtomicSchedTime; +#elif defined(ARCH_32) +typedef erts_dw_atomic_t ErtsAtomicSchedTime; +#else +# error :-/ +#endif #if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT typedef struct { @@ -511,21 +461,19 @@ extern ErtsAlignedRunQueue *erts_aligned_run_queues; -#define ERTS_PROC_REDUCTIONS_EXECUTED(SD, RQ, PRIO, REDS, AREDS)\ +#define ERTS_PROC_REDUCTIONS_EXECUTED(RQ, PRIO, REDS, AREDS) \ do { \ (RQ)->procs.reductions += (AREDS); \ (RQ)->procs.prio_info[(PRIO)].reds += (REDS); \ (RQ)->check_balance_reds -= (REDS); \ (RQ)->wakeup_other_reds += (AREDS); \ - (SD)->check_time_reds += (AREDS); \ } while (0) -#define ERTS_PORT_REDUCTIONS_EXECUTED(SD, RQ, REDS) \ +#define ERTS_PORT_REDUCTIONS_EXECUTED(RQ, REDS) \ do { \ (RQ)->ports.info.reds += (REDS); \ (RQ)->check_balance_reds -= (REDS); \ (RQ)->wakeup_other_reds += (REDS); \ - (SD)->check_time_reds += (REDS); \ } while (0) typedef struct { @@ -540,6 +488,11 @@ } ErtsSchedWallTime; typedef struct { + Uint64 reclaimed; + Uint64 garbage_cols; +} ErtsGCInfo; + +typedef struct { int sched; erts_aint32_t aux_work; } ErtsDelayedAuxWorkWakeupJob; @@ -561,12 +514,11 @@ #ifdef ERTS_SMP struct { ErtsThrPrgrVal thr_prgr; + void (*completed_callback)(void *); + void (*completed_arg)(void *); } dd; struct { ErtsThrPrgrVal thr_prgr; - } cncld_tmrs; - struct { - ErtsThrPrgrVal thr_prgr; UWord size; ErtsThrPrgrLaterOp *first; ErtsThrPrgrLaterOp *last; @@ -589,13 +541,6 @@ ErtsDelayedAuxWorkWakeupJob *job; } delayed_wakeup; #endif - struct { - struct { - erts_aint32_t flags; - void (*callback)(void *); - void *arg; - } wait_completed; - } debug; } ErtsAuxWorkData; #ifdef ERTS_DIRTY_SCHEDULERS @@ -622,9 +567,6 @@ Eterm* x_reg_array; /* X registers */ FloatDef* f_reg_array; /* Floating point registers. */ - ErtsTimerWheel *timer_wheel; - ErtsNextTimeoutRef next_tmo_ref; - ErtsHLTimerService *timer_service; #ifdef ERTS_SMP ethr_tid tid; /* Thread id */ struct erl_bits_state erl_bits_state; /* erl_bits.c state */ @@ -651,20 +593,8 @@ ErtsAuxWorkData aux_work_data; ErtsAtomCacheMap atom_cache_map; - ErtsMonotonicTime last_monotonic_time; - int check_time_reds; - - Uint32 thr_id; - Uint64 unique; - Uint64 ref; - ErtsSchedAllocData alloc_data; - struct { - Uint64 out; - Uint64 in; - } io; - Uint64 reductions; ErtsSchedWallTime sched_wall_time; ErtsGCInfo gc_info; @@ -801,11 +731,12 @@ #define ERTS_PSD_ERROR_HANDLER 0 #define ERTS_PSD_SAVED_CALLS_BUF 1 #define ERTS_PSD_SCHED_ID 2 -#define ERTS_PSD_CALL_TIME_BP 3 -#define ERTS_PSD_DELAYED_GC_TASK_QS 4 -#define ERTS_PSD_NIF_TRAP_EXPORT 5 +#define ERTS_PSD_DIST_ENTRY 3 +#define ERTS_PSD_CALL_TIME_BP 4 +#define ERTS_PSD_DELAYED_GC_TASK_QS 5 +#define ERTS_PSD_NIF_TRAP_EXPORT 6 -#define ERTS_PSD_SIZE 6 +#define ERTS_PSD_SIZE 7 typedef struct { void *data[ERTS_PSD_SIZE]; @@ -823,6 +754,9 @@ #define ERTS_PSD_SCHED_ID_GET_LOCKS ERTS_PROC_LOCK_STATUS #define ERTS_PSD_SCHED_ID_SET_LOCKS ERTS_PROC_LOCK_STATUS +#define ERTS_PSD_DIST_ENTRY_GET_LOCKS ERTS_PROC_LOCK_MAIN +#define ERTS_PSD_DIST_ENTRY_SET_LOCKS ERTS_PROC_LOCK_MAIN + #define ERTS_PSD_CALL_TIME_BP_GET_LOCKS ERTS_PROC_LOCK_MAIN #define ERTS_PSD_CALL_TIME_BP_SET_LOCKS ERTS_PROC_LOCK_MAIN @@ -976,10 +910,10 @@ ErlMessageQueue msg; /* Message queue */ - ErtsBifTimers *bif_timers; /* Bif timers aiming at this process */ -#ifdef ERTS_BTM_ACCESSOR_SUPPORT - ErtsBifTimers *accessor_bif_timers; /* Accessor bif timers */ -#endif + union { + ErtsBifTimer *bif_timers; /* Bif timers aiming at this process */ + void *terminate; + } u; ProcDict *dictionary; /* Process dictionary, may be NULL */ @@ -990,12 +924,9 @@ #ifdef USE_VM_PROBES Eterm dt_utag; /* Place to store the dynamc trace user tag */ Uint dt_utag_flags; /* flag field for the dt_utag */ -#endif - union { - void *terminate; - BeamInstr initial[3]; /* Initial module(0), function(1), arity(2), often used instead +#endif + BeamInstr initial[3]; /* Initial module(0), function(1), arity(2), often used instead of pointer to funcinfo instruction, hence the BeamInstr datatype */ - } u; BeamInstr* current; /* Current Erlang function, part of the funcinfo: * module(0), function(1), arity(2) * (module and functions are tagged atoms; @@ -1008,8 +939,6 @@ Eterm parent; /* Pid of process that created this process. */ erts_approx_time_t approx_started; /* Time when started. */ - Uint32 static_flags; /* Flags that do *not* change */ - /* This is the place, where all fields that differs between memory * architectures, have gone to. */ @@ -1155,9 +1084,6 @@ #define ERTS_PSFLG_DIRTY_IO_PROC ERTS_PSFLG_BIT(19) #define ERTS_PSFLG_DIRTY_CPU_PROC_IN_Q ERTS_PSFLG_BIT(20) #define ERTS_PSFLG_DIRTY_IO_PROC_IN_Q ERTS_PSFLG_BIT(21) -#define ERTS_PSFLG_MAX (ERTS_PSFLGS_ZERO_BIT_OFFSET + 22) -#else -#define ERTS_PSFLG_MAX (ERTS_PSFLGS_ZERO_BIT_OFFSET + 18) #endif #define ERTS_PSFLGS_IN_PRQ_MASK (ERTS_PSFLG_IN_PRQ_MAX \ @@ -1172,11 +1098,6 @@ #define ERTS_PSFLGS_GET_PRQ_PRIO(PSFLGS) \ (((PSFLGS) >> ERTS_PSFLGS_USR_PRIO_OFFSET) & ERTS_PSFLGS_PRIO_MASK) -/* - * Static flags that do not change after process creation. - */ -#define ERTS_STC_FLG_SYSTEM_PROC (((Uint32) 1) << 0) - /* The sequential tracing token is a tuple of size 5: * * {Flags, Label, Serial, Sender} @@ -1204,7 +1125,6 @@ #define SPO_LINK 1 #define SPO_USE_ARGS 2 #define SPO_MONITOR 4 -#define SPO_SYSTEM_PROC 8 /* * The following struct contains options for a process to be spawned. @@ -1327,6 +1247,8 @@ # define F_INITIAL_TRACE_FLAGS 0 #endif + + #define TRACEE_FLAGS ( F_TRACE_PROCS | F_TRACE_CALLS \ | F_TRACE_SOS | F_TRACE_SOS1| F_TRACE_RECEIVE \ | F_TRACE_SOL | F_TRACE_SOL1 | F_TRACE_SEND \ @@ -1360,14 +1282,12 @@ #define ERTS_XSIG_FLG_IGN_KILL (((Uint32) 1) << 0) #define ERTS_XSIG_FLG_NO_IGN_NORMAL (((Uint32) 1) << 1) -#define CANCEL_TIMER(P) \ - do { \ - if ((P)->flags & (F_INSLPQUEUE|F_TIMO)) { \ - if ((P)->flags & F_INSLPQUEUE) \ - erts_cancel_proc_timer((P)); \ - else \ - (P)->flags &= ~F_TIMO; \ - } \ +#define CANCEL_TIMER(p) \ + do { \ + if ((p)->flags & (F_INSLPQUEUE)) \ + cancel_timer(p); \ + else \ + (p)->flags &= ~F_TIMO; \ } while (0) #if defined(ERTS_DIRTY_SCHEDULERS) && defined(ERTS_SMP) @@ -1654,9 +1574,6 @@ void erts_start_schedulers(void); void erts_alloc_notify_delayed_dealloc(int); void erts_alloc_ensure_handle_delayed_dealloc_call(int); -#ifdef ERTS_SMP -void erts_notify_canceled_timer(ErtsSchedulerData *, int); -#endif void erts_smp_notify_check_children_needed(void); #endif #if ERTS_USE_ASYNC_READY_Q @@ -1691,6 +1608,8 @@ Eterm erl_create_process(Process*, Eterm, Eterm, Eterm, ErlSpawnOpts*); void erts_do_exit_process(Process*, Eterm); void erts_continue_exit_process(Process *); +void set_timer(Process*, Uint); +void cancel_timer(Process*); /* Begin System profile */ Uint erts_runnable_process_count(void); /* End System profile */ @@ -1700,11 +1619,7 @@ void erts_debug_verify_clean_empty_process(Process* p); #endif void erts_stack_dump(int to, void *to_arg, Process *); -void erts_limited_stack_trace(int to, void *to_arg, Process *); void erts_program_counter_info(int to, void *to_arg, Process *); -void erts_print_scheduler_info(int to, void *to_arg, ErtsSchedulerData *esdp); -void erts_dump_extended_process_state(int to, void *to_arg, erts_aint32_t psflg); -void erts_dump_process_state(int to, void *to_arg, erts_aint32_t psflg); Eterm erts_get_process_priority(Process *p); Eterm erts_set_process_priority(Process *p, Eterm prio); @@ -1746,11 +1661,7 @@ Eterm erts_debug_reader_groups_map(Process *c_p, int groups); Uint erts_debug_nbalance(void); - -#define ERTS_DEBUG_WAIT_COMPLETED_DEALLOCATIONS (1 << 0) -#define ERTS_DEBUG_WAIT_COMPLETED_TIMER_CANCELLATIONS (1 << 1) - -int erts_debug_wait_completed(Process *c_p, int flags); +int erts_debug_wait_deallocations(Process *c_p); Uint erts_process_memory(Process *c_p); @@ -1883,6 +1794,11 @@ #define ERTS_PROC_SCHED_ID(P, L, ID) \ ((UWord) erts_psd_set((P), (L), ERTS_PSD_SCHED_ID, (void *) (ID))) +#define ERTS_PROC_GET_DIST_ENTRY(P) \ + ((DistEntry *) erts_psd_get((P), ERTS_PSD_DIST_ENTRY)) +#define ERTS_PROC_SET_DIST_ENTRY(P, L, D) \ + ((DistEntry *) erts_psd_set((P), (L), ERTS_PSD_DIST_ENTRY, (void *) (D))) + #define ERTS_PROC_GET_SAVED_CALLS_BUF(P) \ ((struct saved_calls *) erts_psd_get((P), ERTS_PSD_SAVED_CALLS_BUF)) #define ERTS_PROC_SET_SAVED_CALLS_BUF(P, L, SCB) \ @@ -2054,10 +1970,14 @@ ERTS_GLB_INLINE Uint erts_get_scheduler_id(void); ERTS_GLB_INLINE ErtsRunQueue *erts_get_runq_proc(Process *p); ERTS_GLB_INLINE ErtsRunQueue *erts_get_runq_current(ErtsSchedulerData *esdp); +#ifndef ERTS_ENABLE_LOCK_COUNT ERTS_GLB_INLINE void erts_smp_runq_lock(ErtsRunQueue *rq); +#endif ERTS_GLB_INLINE int erts_smp_runq_trylock(ErtsRunQueue *rq); ERTS_GLB_INLINE void erts_smp_runq_unlock(ErtsRunQueue *rq); +#ifndef ERTS_ENABLE_LOCK_COUNT ERTS_GLB_INLINE void erts_smp_xrunq_lock(ErtsRunQueue *rq, ErtsRunQueue *xrq); +#endif ERTS_GLB_INLINE void erts_smp_xrunq_unlock(ErtsRunQueue *rq, ErtsRunQueue *xrq); ERTS_GLB_INLINE void erts_smp_runqs_lock(ErtsRunQueue *rq1, ErtsRunQueue *rq2); ERTS_GLB_INLINE void erts_smp_runqs_unlock(ErtsRunQueue *rq1, ErtsRunQueue *rq2); @@ -2135,6 +2055,12 @@ #endif } +#ifdef ERTS_ENABLE_LOCK_COUNT + +#define erts_smp_runq_lock(rq) erts_smp_mtx_lock_x(&(rq)->mtx, __FILE__, __LINE__) + +#endif + ERTS_GLB_INLINE int erts_smp_runq_trylock(ErtsRunQueue *rq) { @@ -2153,6 +2079,31 @@ #endif } +#ifdef ERTS_ENABLE_LOCK_COUNT + +#define erts_smp_xrunq_lock(rq, xrq) erts_smp_xrunq_lock_x((rq), (xrq), __FILE__, __LINE__) + +ERTS_GLB_INLINE void +erts_smp_xrunq_lock_x(ErtsRunQueue *rq, ErtsRunQueue *xrq, char* file, int line) +{ +#ifdef ERTS_SMP + ERTS_SMP_LC_ASSERT(erts_smp_lc_mtx_is_locked(&rq->mtx)); + if (xrq != rq) { + if (erts_smp_mtx_trylock(&xrq->mtx) == EBUSY) { + if (rq < xrq) + erts_smp_mtx_lock_x(&xrq->mtx, file, line); + else { + erts_smp_mtx_unlock(&rq->mtx); + erts_smp_mtx_lock_x(&xrq->mtx, file, line); + erts_smp_mtx_lock_x(&rq->mtx, file, line); + } + } + } +#endif +} + +#else + ERTS_GLB_INLINE void erts_smp_xrunq_lock(ErtsRunQueue *rq, ErtsRunQueue *xrq) { @@ -2172,6 +2123,8 @@ #endif } +#endif + ERTS_GLB_INLINE void erts_smp_xrunq_unlock(ErtsRunQueue *rq, ErtsRunQueue *xrq) { @@ -2271,8 +2224,6 @@ void erts_smp_notify_inc_runq(ErtsRunQueue *runq); -void erts_interupt_aux_thread_timed(ErtsMonotonicTime timeout_time); - #ifdef ERTS_SMP void erts_sched_finish_poke(ErtsSchedulerSleepInfo *, erts_aint32_t); ERTS_GLB_INLINE void erts_sched_poke(ErtsSchedulerSleepInfo *ssi); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_process_lock.c erlang-17.3-dfsg/erts/emulator/beam/erl_process_lock.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_process_lock.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_process_lock.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -104,16 +103,12 @@ Sint16 proc_lock_main; Sint16 proc_lock_link; Sint16 proc_lock_msgq; - Sint16 proc_lock_btm; Sint16 proc_lock_status; } lc_id; #endif erts_pix_lock_t erts_pix_locks[ERTS_NO_OF_PIX_LOCKS]; -#ifdef ERTS_ENABLE_LOCK_COUNT -static void lcnt_enable_proc_lock_count(Process *proc, int enable); -#endif void erts_init_proc_lock(int cpus) @@ -150,7 +145,6 @@ lc_id.proc_lock_main = erts_lc_get_lock_order_id("proc_main"); lc_id.proc_lock_link = erts_lc_get_lock_order_id("proc_link"); lc_id.proc_lock_msgq = erts_lc_get_lock_order_id("proc_msgq"); - lc_id.proc_lock_btm = erts_lc_get_lock_order_id("proc_btm"); lc_id.proc_lock_status = erts_lc_get_lock_order_id("proc_status"); #endif } @@ -713,7 +707,7 @@ need_locks1 |= unlock_locks; if (!is_managed && !have_locks1) { refc1 = 1; - erts_proc_inc_refc(p1); + erts_smp_proc_inc_refc(p1); } erts_smp_proc_unlock(p1, unlock_locks); } @@ -723,7 +717,7 @@ need_locks2 |= unlock_locks; if (!is_managed && !have_locks2) { refc2 = 1; - erts_proc_inc_refc(p2); + erts_smp_proc_inc_refc(p2); } erts_smp_proc_unlock(p2, unlock_locks); } @@ -804,9 +798,9 @@ if (!is_managed) { if (refc1) - erts_proc_dec_refc(p1); + erts_smp_proc_dec_refc(p1); if (refc2) - erts_proc_dec_refc(p2); + erts_smp_proc_dec_refc(p2); } } @@ -867,8 +861,8 @@ return NULL; need_locks &= ~c_p_have_locks; if (!need_locks) { - if (flags & ERTS_P2P_FLG_INC_REFC) - erts_proc_inc_refc(c_p); + if (flags & ERTS_P2P_FLG_SMP_INC_REFC) + erts_smp_proc_inc_refc(c_p); return c_p; } } @@ -881,8 +875,8 @@ if (proc->common.id != pid) proc = NULL; else if (!need_locks) { - if (flags & ERTS_P2P_FLG_INC_REFC) - erts_proc_inc_refc(proc); + if (flags & ERTS_P2P_FLG_SMP_INC_REFC) + erts_smp_proc_inc_refc(proc); } else { int busy; @@ -922,8 +916,8 @@ #endif if (!busy) { - if (flags & ERTS_P2P_FLG_INC_REFC) - erts_proc_inc_refc(proc); + if (flags & ERTS_P2P_FLG_SMP_INC_REFC) + erts_smp_proc_inc_refc(proc); #if ERTS_PROC_LOCK_OWN_IMPL && defined(ERTS_ENABLE_LOCK_COUNT) /* all is great */ @@ -938,8 +932,8 @@ proc = ERTS_PROC_LOCK_BUSY; else { int managed; - if (flags & ERTS_P2P_FLG_INC_REFC) - erts_proc_inc_refc(proc); + if (flags & ERTS_P2P_FLG_SMP_INC_REFC) + erts_smp_proc_inc_refc(proc); #if ERTS_PROC_LOCK_OWN_IMPL && defined(ERTS_ENABLE_LOCK_COUNT) erts_lcnt_proc_lock_unaquire(&proc->lock, lcnt_locks); @@ -947,7 +941,7 @@ managed = dhndl == ERTS_THR_PRGR_DHANDLE_MANAGED; if (!managed) { - erts_proc_inc_refc(proc); + erts_smp_proc_inc_refc(proc); erts_thr_progress_unmanaged_continue(dhndl); dec_refc_proc = proc; @@ -984,14 +978,14 @@ erts_smp_proc_unlock(proc, need_locks); - if (flags & ERTS_P2P_FLG_INC_REFC) + if (flags & ERTS_P2P_FLG_SMP_INC_REFC) dec_refc_proc = proc; proc = NULL; } if (dec_refc_proc) - erts_proc_dec_refc(dec_refc_proc); + erts_smp_proc_dec_refc(dec_refc_proc); #if ERTS_PROC_LOCK_OWN_IMPL && defined(ERTS_PROC_LOCK_DEBUG) ERTS_LC_ASSERT(!proc @@ -1007,9 +1001,7 @@ void erts_proc_lock_init(Process *p) { -#if ERTS_PROC_LOCK_OWN_IMPL || defined(ERTS_PROC_LOCK_DEBUG) int i; -#endif #if ERTS_PROC_LOCK_OWN_IMPL /* We always start with all locks locked */ #if ERTS_PROC_LOCK_ATOMIC_IMPL @@ -1046,11 +1038,6 @@ #ifdef ERTS_ENABLE_LOCK_CHECK erts_lc_trylock(1, &p->lock.msgq.lc); #endif - erts_mtx_init_x(&p->lock.btm, "proc_btm", p->common.id, do_lock_count); - ethr_mutex_lock(&p->lock.btm.mtx); -#ifdef ERTS_ENABLE_LOCK_CHECK - erts_lc_trylock(1, &p->lock.btm.lc); -#endif erts_mtx_init_x(&p->lock.status, "proc_status", p->common.id, do_lock_count); ethr_mutex_lock(&p->lock.status.mtx); @@ -1058,6 +1045,7 @@ erts_lc_trylock(1, &p->lock.status.lc); #endif #endif + erts_atomic32_init_nob(&p->lock.refc, 1); #ifdef ERTS_PROC_LOCK_DEBUG for (i = 0; i <= ERTS_PROC_LOCK_MAX_BIT; i++) erts_smp_atomic32_init_nob(&p->lock.locked[i], (erts_aint32_t) 1); @@ -1076,7 +1064,6 @@ erts_mtx_destroy(&p->lock.main); erts_mtx_destroy(&p->lock.link); erts_mtx_destroy(&p->lock.msgq); - erts_mtx_destroy(&p->lock.btm); erts_mtx_destroy(&p->lock.status); #endif #if defined(ERTS_ENABLE_LOCK_COUNT) && defined(ERTS_SMP) @@ -1087,109 +1074,141 @@ /* --- Process lock counting ----------------------------------------------- */ #if ERTS_PROC_LOCK_OWN_IMPL && defined(ERTS_ENABLE_LOCK_COUNT) - -void erts_lcnt_enable_proc_lock_count(int enable) { - int ix, max = erts_ptab_max(&erts_proc); - Process *proc = NULL; - for (ix = 0; ix < max; ++ix) { - if ((proc = erts_pix2proc(ix)) != NULL) - lcnt_enable_proc_lock_count(proc, enable); - } /* for all processes */ -} - void erts_lcnt_proc_lock_init(Process *p) { - if (!(erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK)) { - erts_lcnt_init_lock_empty(&(p->lock.lcnt_main)); - erts_lcnt_init_lock_empty(&(p->lock.lcnt_msgq)); - erts_lcnt_init_lock_empty(&(p->lock.lcnt_btm)); - erts_lcnt_init_lock_empty(&(p->lock.lcnt_link)); - erts_lcnt_init_lock_empty(&(p->lock.lcnt_status)); - } else { /* now the common case */ - Eterm pid = (p->common.id != ERTS_INVALID_PID) ? p->common.id : NIL; - erts_lcnt_init_lock_x(&(p->lock.lcnt_main), "proc_main", ERTS_LCNT_LT_PROCLOCK, pid); - erts_lcnt_init_lock_x(&(p->lock.lcnt_msgq), "proc_msgq", ERTS_LCNT_LT_PROCLOCK, pid); - erts_lcnt_init_lock_x(&(p->lock.lcnt_btm), "proc_btm", ERTS_LCNT_LT_PROCLOCK, pid); - erts_lcnt_init_lock_x(&(p->lock.lcnt_link), "proc_link", ERTS_LCNT_LT_PROCLOCK, pid); - erts_lcnt_init_lock_x(&(p->lock.lcnt_status),"proc_status",ERTS_LCNT_LT_PROCLOCK, pid); - } /* the lock names should really be aligned to four characters */ -} /* logic reversed */ + if (erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK) { + if (p->common.id != ERTS_INVALID_PID) { + erts_lcnt_init_lock_x(&(p->lock.lcnt_main), "proc_main", ERTS_LCNT_LT_PROCLOCK, p->common.id); + erts_lcnt_init_lock_x(&(p->lock.lcnt_msgq), "proc_msgq", ERTS_LCNT_LT_PROCLOCK, p->common.id); + erts_lcnt_init_lock_x(&(p->lock.lcnt_link), "proc_link", ERTS_LCNT_LT_PROCLOCK, p->common.id); + erts_lcnt_init_lock_x(&(p->lock.lcnt_status), "proc_status", ERTS_LCNT_LT_PROCLOCK, p->common.id); + } else { + erts_lcnt_init_lock(&(p->lock.lcnt_main), "proc_main", ERTS_LCNT_LT_PROCLOCK); + erts_lcnt_init_lock(&(p->lock.lcnt_msgq), "proc_msgq", ERTS_LCNT_LT_PROCLOCK); + erts_lcnt_init_lock(&(p->lock.lcnt_link), "proc_link", ERTS_LCNT_LT_PROCLOCK); + erts_lcnt_init_lock(&(p->lock.lcnt_status), "proc_status", ERTS_LCNT_LT_PROCLOCK); + } + } else { + sys_memzero(&(p->lock.lcnt_main), sizeof(p->lock.lcnt_main)); + sys_memzero(&(p->lock.lcnt_msgq), sizeof(p->lock.lcnt_msgq)); + sys_memzero(&(p->lock.lcnt_link), sizeof(p->lock.lcnt_link)); + sys_memzero(&(p->lock.lcnt_status), sizeof(p->lock.lcnt_status)); + } +} + void erts_lcnt_proc_lock_destroy(Process *p) { erts_lcnt_destroy_lock(&(p->lock.lcnt_main)); erts_lcnt_destroy_lock(&(p->lock.lcnt_msgq)); - erts_lcnt_destroy_lock(&(p->lock.lcnt_btm)); erts_lcnt_destroy_lock(&(p->lock.lcnt_link)); erts_lcnt_destroy_lock(&(p->lock.lcnt_status)); } -static void lcnt_enable_proc_lock_count(Process *proc, int enable) { - if (enable) { - if (!ERTS_LCNT_LOCK_TYPE(&(proc->lock.lcnt_main))) { - erts_lcnt_proc_lock_init(proc); - } +void erts_lcnt_proc_lock(erts_proc_lock_t *lock, ErtsProcLocks locks) { + if (erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK) { + if (locks & ERTS_PROC_LOCK_MAIN) { + erts_lcnt_lock(&(lock->lcnt_main)); + } + if (locks & ERTS_PROC_LOCK_MSGQ) { + erts_lcnt_lock(&(lock->lcnt_msgq)); + } + if (locks & ERTS_PROC_LOCK_LINK) { + erts_lcnt_lock(&(lock->lcnt_link)); + } + if (locks & ERTS_PROC_LOCK_STATUS) { + erts_lcnt_lock(&(lock->lcnt_status)); } - else { - if (ERTS_LCNT_LOCK_TYPE(&(proc->lock.lcnt_main))) { - erts_lcnt_proc_lock_destroy(proc); - } } } -void erts_lcnt_proc_lock(erts_proc_lock_t *lock, ErtsProcLocks locks) { - if (!(erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK)) return; - if (locks & ERTS_PROC_LOCK_MAIN) { erts_lcnt_lock(&(lock->lcnt_main)); } - if (locks & ERTS_PROC_LOCK_MSGQ) { erts_lcnt_lock(&(lock->lcnt_msgq)); } - if (locks & ERTS_PROC_LOCK_BTM) { erts_lcnt_lock(&(lock->lcnt_btm)); } - if (locks & ERTS_PROC_LOCK_LINK) { erts_lcnt_lock(&(lock->lcnt_link)); } - if (locks & ERTS_PROC_LOCK_STATUS) { erts_lcnt_lock(&(lock->lcnt_status)); } -} - -void erts_lcnt_proc_lock_post_x(erts_proc_lock_t *lock, ErtsProcLocks locks, - char *file, unsigned int line) { - if (!(erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK)) return; +void erts_lcnt_proc_lock_post_x(erts_proc_lock_t *lock, ErtsProcLocks locks, char *file, unsigned int line) { + if (erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK) { if (locks & ERTS_PROC_LOCK_MAIN) { erts_lcnt_lock_post_x(&(lock->lcnt_main), file, line); } if (locks & ERTS_PROC_LOCK_MSGQ) { erts_lcnt_lock_post_x(&(lock->lcnt_msgq), file, line); } - if (locks & ERTS_PROC_LOCK_BTM) { - erts_lcnt_lock_post_x(&(lock->lcnt_btm), file, line); - } if (locks & ERTS_PROC_LOCK_LINK) { erts_lcnt_lock_post_x(&(lock->lcnt_link), file, line); } if (locks & ERTS_PROC_LOCK_STATUS) { erts_lcnt_lock_post_x(&(lock->lcnt_status), file, line); } + } } void erts_lcnt_proc_lock_unaquire(erts_proc_lock_t *lock, ErtsProcLocks locks) { - if (!(erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK)) return; - if (locks & ERTS_PROC_LOCK_MAIN) { erts_lcnt_lock_unaquire(&(lock->lcnt_main)); } - if (locks & ERTS_PROC_LOCK_MSGQ) { erts_lcnt_lock_unaquire(&(lock->lcnt_msgq)); } - if (locks & ERTS_PROC_LOCK_BTM) { erts_lcnt_lock_unaquire(&(lock->lcnt_btm)); } - if (locks & ERTS_PROC_LOCK_LINK) { erts_lcnt_lock_unaquire(&(lock->lcnt_link)); } - if (locks & ERTS_PROC_LOCK_STATUS) { erts_lcnt_lock_unaquire(&(lock->lcnt_status)); } + if (erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK) { + if (locks & ERTS_PROC_LOCK_MAIN) { + erts_lcnt_lock_unaquire(&(lock->lcnt_main)); + } + if (locks & ERTS_PROC_LOCK_MSGQ) { + erts_lcnt_lock_unaquire(&(lock->lcnt_msgq)); + } + if (locks & ERTS_PROC_LOCK_LINK) { + erts_lcnt_lock_unaquire(&(lock->lcnt_link)); + } + if (locks & ERTS_PROC_LOCK_STATUS) { + erts_lcnt_lock_unaquire(&(lock->lcnt_status)); + } + } } void erts_lcnt_proc_unlock(erts_proc_lock_t *lock, ErtsProcLocks locks) { - if (!(erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK)) return; - if (locks & ERTS_PROC_LOCK_MAIN) { erts_lcnt_unlock(&(lock->lcnt_main)); } - if (locks & ERTS_PROC_LOCK_MSGQ) { erts_lcnt_unlock(&(lock->lcnt_msgq)); } - if (locks & ERTS_PROC_LOCK_BTM) { erts_lcnt_unlock(&(lock->lcnt_btm)); } - if (locks & ERTS_PROC_LOCK_LINK) { erts_lcnt_unlock(&(lock->lcnt_link)); } - if (locks & ERTS_PROC_LOCK_STATUS) { erts_lcnt_unlock(&(lock->lcnt_status)); } + if (erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK) { + if (locks & ERTS_PROC_LOCK_MAIN) { + erts_lcnt_unlock(&(lock->lcnt_main)); + } + if (locks & ERTS_PROC_LOCK_MSGQ) { + erts_lcnt_unlock(&(lock->lcnt_msgq)); + } + if (locks & ERTS_PROC_LOCK_LINK) { + erts_lcnt_unlock(&(lock->lcnt_link)); + } + if (locks & ERTS_PROC_LOCK_STATUS) { + erts_lcnt_unlock(&(lock->lcnt_status)); + } + } } void erts_lcnt_proc_trylock(erts_proc_lock_t *lock, ErtsProcLocks locks, int res) { - if (!(erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK)) return; - if (locks & ERTS_PROC_LOCK_MAIN) { erts_lcnt_trylock(&(lock->lcnt_main), res); } - if (locks & ERTS_PROC_LOCK_MSGQ) { erts_lcnt_trylock(&(lock->lcnt_msgq), res); } - if (locks & ERTS_PROC_LOCK_BTM) { erts_lcnt_trylock(&(lock->lcnt_btm), res); } - if (locks & ERTS_PROC_LOCK_LINK) { erts_lcnt_trylock(&(lock->lcnt_link), res); } - if (locks & ERTS_PROC_LOCK_STATUS) { erts_lcnt_trylock(&(lock->lcnt_status), res); } -} /* reversed logic */ -#endif /* ERTS_ENABLE_LOCK_COUNT */ + if (erts_lcnt_rt_options & ERTS_LCNT_OPT_PROCLOCK) { + if (locks & ERTS_PROC_LOCK_MAIN) { + erts_lcnt_trylock(&(lock->lcnt_main), res); + } + if (locks & ERTS_PROC_LOCK_MSGQ) { + erts_lcnt_trylock(&(lock->lcnt_msgq), res); + } + if (locks & ERTS_PROC_LOCK_LINK) { + erts_lcnt_trylock(&(lock->lcnt_link), res); + } + if (locks & ERTS_PROC_LOCK_STATUS) { + erts_lcnt_trylock(&(lock->lcnt_status), res); + } + } +} + + +void erts_lcnt_enable_proc_lock_count(int enable) +{ + int i, max = erts_ptab_max(&erts_proc); + + for (i = 0; i < max; ++i) { + Process* p = erts_pix2proc(i); + if (p) { + if (enable) { + if (!ERTS_LCNT_LOCK_TYPE(&(p->lock.lcnt_main))) { + erts_lcnt_proc_lock_init(p); + } + } else { + if (ERTS_LCNT_LOCK_TYPE(&(p->lock.lcnt_main))) { + erts_lcnt_proc_lock_destroy(p); + } + } + } + } +} + +#endif /* ifdef ERTS_ENABLE_LOCK_COUNT */ /* --- Process lock checking ----------------------------------------------- */ @@ -1216,10 +1235,6 @@ lck.id = lc_id.proc_lock_msgq; erts_lc_lock_x(&lck,file,line); } - if (locks & ERTS_PROC_LOCK_BTM) { - lck.id = lc_id.proc_lock_btm; - erts_lc_lock_x(&lck,file,line); - } if (locks & ERTS_PROC_LOCK_STATUS) { lck.id = lc_id.proc_lock_status; erts_lc_lock_x(&lck,file,line); @@ -1245,10 +1260,6 @@ lck.id = lc_id.proc_lock_msgq; erts_lc_trylock_x(locked, &lck, file, line); } - if (locks & ERTS_PROC_LOCK_BTM) { - lck.id = lc_id.proc_lock_btm; - erts_lc_trylock_x(locked, &lck, file, line); - } if (locks & ERTS_PROC_LOCK_STATUS) { lck.id = lc_id.proc_lock_status; erts_lc_trylock_x(locked, &lck, file, line); @@ -1265,10 +1276,6 @@ lck.id = lc_id.proc_lock_status; erts_lc_unlock(&lck); } - if (locks & ERTS_PROC_LOCK_BTM) { - lck.id = lc_id.proc_lock_btm; - erts_lc_unlock(&lck); - } if (locks & ERTS_PROC_LOCK_MSGQ) { lck.id = lc_id.proc_lock_msgq; erts_lc_unlock(&lck); @@ -1296,10 +1303,6 @@ lck.id = lc_id.proc_lock_status; erts_lc_might_unlock(&lck); } - if (locks & ERTS_PROC_LOCK_BTM) { - lck.id = lc_id.proc_lock_btm; - erts_lc_might_unlock(&lck); - } if (locks & ERTS_PROC_LOCK_MSGQ) { lck.id = lc_id.proc_lock_msgq; erts_lc_might_unlock(&lck); @@ -1319,8 +1322,6 @@ erts_lc_might_unlock(&p->lock.link.lc); if (locks & ERTS_PROC_LOCK_MSGQ) erts_lc_might_unlock(&p->lock.msgq.lc); - if (locks & ERTS_PROC_LOCK_BTM) - erts_lc_might_unlock(&p->lock.btm.lc); if (locks & ERTS_PROC_LOCK_STATUS) erts_lc_might_unlock(&p->lock.status.lc); #endif @@ -1346,10 +1347,6 @@ lck.id = lc_id.proc_lock_msgq; erts_lc_require_lock(&lck, file, line); } - if (locks & ERTS_PROC_LOCK_BTM) { - lck.id = lc_id.proc_lock_btm; - erts_lc_require_lock(&lck, file, line); - } if (locks & ERTS_PROC_LOCK_STATUS) { lck.id = lc_id.proc_lock_status; erts_lc_require_lock(&lck, file, line); @@ -1361,8 +1358,6 @@ erts_lc_require_lock(&p->lock.link.lc, file, line); if (locks & ERTS_PROC_LOCK_MSGQ) erts_lc_require_lock(&p->lock.msgq.lc, file, line); - if (locks & ERTS_PROC_LOCK_BTM) - erts_lc_require_lock(&p->lock.btm.lc, file, line); if (locks & ERTS_PROC_LOCK_STATUS) erts_lc_require_lock(&p->lock.status.lc, file, line); #endif @@ -1379,10 +1374,6 @@ lck.id = lc_id.proc_lock_status; erts_lc_unrequire_lock(&lck); } - if (locks & ERTS_PROC_LOCK_BTM) { - lck.id = lc_id.proc_lock_btm; - erts_lc_unrequire_lock(&lck); - } if (locks & ERTS_PROC_LOCK_MSGQ) { lck.id = lc_id.proc_lock_msgq; erts_lc_unrequire_lock(&lck); @@ -1402,8 +1393,6 @@ erts_lc_unrequire_lock(&p->lock.link.lc); if (locks & ERTS_PROC_LOCK_MSGQ) erts_lc_unrequire_lock(&p->lock.msgq.lc); - if (locks & ERTS_PROC_LOCK_BTM) - erts_lc_unrequire_lock(&p->lock.btm.lc); if (locks & ERTS_PROC_LOCK_STATUS) erts_lc_unrequire_lock(&p->lock.status.lc); #endif @@ -1425,8 +1414,6 @@ lck.id = lc_id.proc_lock_link; else if (locks & ERTS_PROC_LOCK_MSGQ) lck.id = lc_id.proc_lock_msgq; - else if (locks & ERTS_PROC_LOCK_BTM) - lck.id = lc_id.proc_lock_btm; else if (locks & ERTS_PROC_LOCK_STATUS) lck.id = lc_id.proc_lock_status; else @@ -1461,8 +1448,7 @@ { int have_locks_len = 0; #if ERTS_PROC_LOCK_OWN_IMPL - erts_lc_lock_t have_locks[5] = {ERTS_PROC_LC_EMPTY_LOCK_INIT, - ERTS_PROC_LC_EMPTY_LOCK_INIT, + erts_lc_lock_t have_locks[4] = {ERTS_PROC_LC_EMPTY_LOCK_INIT, ERTS_PROC_LC_EMPTY_LOCK_INIT, ERTS_PROC_LC_EMPTY_LOCK_INIT, ERTS_PROC_LC_EMPTY_LOCK_INIT}; @@ -1478,24 +1464,18 @@ have_locks[have_locks_len].id = lc_id.proc_lock_msgq; have_locks[have_locks_len++].extra = p->common.id; } - if (locks & ERTS_PROC_LOCK_BTM) { - have_locks[have_locks_len].id = lc_id.proc_lock_btm; - have_locks[have_locks_len++].extra = p->common.id; - } if (locks & ERTS_PROC_LOCK_STATUS) { have_locks[have_locks_len].id = lc_id.proc_lock_status; have_locks[have_locks_len++].extra = p->common.id; } #elif ERTS_PROC_LOCK_RAW_MUTEX_IMPL - erts_lc_lock_t have_locks[5]; + erts_lc_lock_t have_locks[4]; if (locks & ERTS_PROC_LOCK_MAIN) have_locks[have_locks_len++] = p->lock.main.lc; if (locks & ERTS_PROC_LOCK_LINK) have_locks[have_locks_len++] = p->lock.link.lc; if (locks & ERTS_PROC_LOCK_MSGQ) have_locks[have_locks_len++] = p->lock.msgq.lc; - if (locks & ERTS_PROC_LOCK_BTM) - have_locks[have_locks_len++] = p->lock.btm.lc; if (locks & ERTS_PROC_LOCK_STATUS) have_locks[have_locks_len++] = p->lock.status.lc; #endif @@ -1508,11 +1488,11 @@ int have_locks_len = 0; int have_not_locks_len = 0; #if ERTS_PROC_LOCK_OWN_IMPL - erts_lc_lock_t have_locks[5] = {ERTS_PROC_LC_EMPTY_LOCK_INIT, + erts_lc_lock_t have_locks[4] = {ERTS_PROC_LC_EMPTY_LOCK_INIT, ERTS_PROC_LC_EMPTY_LOCK_INIT, ERTS_PROC_LC_EMPTY_LOCK_INIT, ERTS_PROC_LC_EMPTY_LOCK_INIT}; - erts_lc_lock_t have_not_locks[5] = {ERTS_PROC_LC_EMPTY_LOCK_INIT, + erts_lc_lock_t have_not_locks[4] = {ERTS_PROC_LC_EMPTY_LOCK_INIT, ERTS_PROC_LC_EMPTY_LOCK_INIT, ERTS_PROC_LC_EMPTY_LOCK_INIT, ERTS_PROC_LC_EMPTY_LOCK_INIT}; @@ -1541,14 +1521,6 @@ have_not_locks[have_not_locks_len].id = lc_id.proc_lock_msgq; have_not_locks[have_not_locks_len++].extra = p->common.id; } - if (locks & ERTS_PROC_LOCK_BTM) { - have_locks[have_locks_len].id = lc_id.proc_lock_btm; - have_locks[have_locks_len++].extra = p->common.id; - } - else { - have_not_locks[have_not_locks_len].id = lc_id.proc_lock_btm; - have_not_locks[have_not_locks_len++].extra = p->common.id; - } if (locks & ERTS_PROC_LOCK_STATUS) { have_locks[have_locks_len].id = lc_id.proc_lock_status; have_locks[have_locks_len++].extra = p->common.id; @@ -1558,8 +1530,8 @@ have_not_locks[have_not_locks_len++].extra = p->common.id; } #elif ERTS_PROC_LOCK_RAW_MUTEX_IMPL - erts_lc_lock_t have_locks[5]; - erts_lc_lock_t have_not_locks[5]; + erts_lc_lock_t have_locks[4]; + erts_lc_lock_t have_not_locks[4]; if (locks & ERTS_PROC_LOCK_MAIN) have_locks[have_locks_len++] = p->lock.main.lc; @@ -1573,10 +1545,6 @@ have_locks[have_locks_len++] = p->lock.msgq.lc; else have_not_locks[have_not_locks_len++] = p->lock.msgq.lc; - if (locks & ERTS_PROC_LOCK_BTM) - have_locks[have_locks_len++] = p->lock.btm.lc; - else - have_not_locks[have_not_locks_len++] = p->lock.btm.lc; if (locks & ERTS_PROC_LOCK_STATUS) have_locks[have_locks_len++] = p->lock.status.lc; else @@ -1590,10 +1558,10 @@ ErtsProcLocks erts_proc_lc_my_proc_locks(Process *p) { - int resv[5]; + int resv[4]; ErtsProcLocks res = 0; #if ERTS_PROC_LOCK_OWN_IMPL - erts_lc_lock_t locks[5] = {ERTS_LC_LOCK_INIT(lc_id.proc_lock_main, + erts_lc_lock_t locks[4] = {ERTS_LC_LOCK_INIT(lc_id.proc_lock_main, p->common.id, ERTS_LC_FLG_LT_PROCLOCK), ERTS_LC_LOCK_INIT(lc_id.proc_lock_link, @@ -1602,21 +1570,17 @@ ERTS_LC_LOCK_INIT(lc_id.proc_lock_msgq, p->common.id, ERTS_LC_FLG_LT_PROCLOCK), - ERTS_LC_LOCK_INIT(lc_id.proc_lock_btm, - p->common.id, - ERTS_LC_FLG_LT_PROCLOCK), ERTS_LC_LOCK_INIT(lc_id.proc_lock_status, p->common.id, ERTS_LC_FLG_LT_PROCLOCK)}; #elif ERTS_PROC_LOCK_RAW_MUTEX_IMPL - erts_lc_lock_t locks[5] = {p->lock.main.lc, + erts_lc_lock_t locks[4] = {p->lock.main.lc, p->lock.link.lc, p->lock.msgq.lc, - p->lock.btm.lc, p->lock.status.lc}; #endif - erts_lc_have_locks(resv, locks, 5); + erts_lc_have_locks(resv, locks, 4); if (resv[0]) res |= ERTS_PROC_LOCK_MAIN; if (resv[1]) @@ -1624,8 +1588,6 @@ if (resv[2]) res |= ERTS_PROC_LOCK_MSGQ; if (resv[3]) - res |= ERTS_PROC_LOCK_BTM; - if (resv[4]) res |= ERTS_PROC_LOCK_STATUS; return res; @@ -1634,14 +1596,13 @@ void erts_proc_lc_chk_no_proc_locks(char *file, int line) { - int resv[5]; - int ids[5] = {lc_id.proc_lock_main, + int resv[4]; + int ids[4] = {lc_id.proc_lock_main, lc_id.proc_lock_link, lc_id.proc_lock_msgq, - lc_id.proc_lock_btm, lc_id.proc_lock_status}; - erts_lc_have_lock_ids(resv, ids, 5); - if (!ERTS_IS_CRASH_DUMPING && (resv[0] || resv[1] || resv[2] || resv[3] || resv[4])) { + erts_lc_have_lock_ids(resv, ids, 4); + if (!ERTS_IS_CRASH_DUMPING && (resv[0] || resv[1] || resv[2] || resv[3])) { erts_lc_fail("%s:%d: Thread has process locks locked when expected " "not to have any process locks locked", file, line); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_process_lock.h erlang-17.3-dfsg/erts/emulator/beam/erl_process_lock.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_process_lock.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_process_lock.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -66,7 +65,7 @@ #endif -#define ERTS_PROC_LOCK_MAX_BIT 4 +#define ERTS_PROC_LOCK_MAX_BIT 3 typedef erts_aint32_t ErtsProcLocks; @@ -82,18 +81,17 @@ erts_lcnt_lock_t lcnt_main; erts_lcnt_lock_t lcnt_link; erts_lcnt_lock_t lcnt_msgq; - erts_lcnt_lock_t lcnt_btm; erts_lcnt_lock_t lcnt_status; #endif #elif ERTS_PROC_LOCK_RAW_MUTEX_IMPL erts_mtx_t main; erts_mtx_t link; erts_mtx_t msgq; - erts_mtx_t btm; erts_mtx_t status; #else # error "no implementation" #endif + erts_atomic32_t refc; #ifdef ERTS_PROC_LOCK_DEBUG erts_smp_atomic32_t locked[ERTS_PROC_LOCK_MAX_BIT+1]; #endif @@ -122,15 +120,9 @@ * Message queue lock: * Protects the following fields in the process structure: * * msg_inq - */ -#define ERTS_PROC_LOCK_MSGQ (((ErtsProcLocks) 1) << 2) - -/* - * Bif timer lock: - * Protects the following fields in the process structure: * * bif_timers */ -#define ERTS_PROC_LOCK_BTM (((ErtsProcLocks) 1) << 3) +#define ERTS_PROC_LOCK_MSGQ (((ErtsProcLocks) 1) << 2) /* * Status lock: @@ -471,9 +463,6 @@ if (locks & ERTS_PROC_LOCK_MSGQ) if (erts_mtx_trylock(&p->lock.msgq) == EBUSY) goto busy_msgq; - if (locks & ERTS_PROC_LOCK_BTM) - if (erts_mtx_trylock(&p->lock.btm) == EBUSY) - goto busy_btm; if (locks & ERTS_PROC_LOCK_STATUS) if (erts_mtx_trylock(&p->lock.status) == EBUSY) goto busy_status; @@ -481,9 +470,6 @@ return 0; busy_status: - if (locks & ERTS_PROC_LOCK_BTM) - erts_mtx_unlock(&p->lock.btm); -busy_btm: if (locks & ERTS_PROC_LOCK_MSGQ) erts_mtx_unlock(&p->lock.msgq); busy_msgq: @@ -563,8 +549,6 @@ erts_mtx_lock(&p->lock.link); if (locks & ERTS_PROC_LOCK_MSGQ) erts_mtx_lock(&p->lock.msgq); - if (locks & ERTS_PROC_LOCK_BTM) - erts_mtx_lock(&p->lock.btm); if (locks & ERTS_PROC_LOCK_STATUS) erts_mtx_lock(&p->lock.status); @@ -654,8 +638,6 @@ if (locks & ERTS_PROC_LOCK_STATUS) erts_mtx_unlock(&p->lock.status); - if (locks & ERTS_PROC_LOCK_BTM) - erts_mtx_unlock(&p->lock.btm); if (locks & ERTS_PROC_LOCK_MSGQ) erts_mtx_unlock(&p->lock.msgq); if (locks & ERTS_PROC_LOCK_LINK) @@ -770,10 +752,9 @@ ERTS_GLB_INLINE void erts_smp_proc_unlock(Process *, ErtsProcLocks); ERTS_GLB_INLINE int erts_smp_proc_trylock(Process *, ErtsProcLocks); -ERTS_GLB_INLINE void erts_proc_inc_refc(Process *); -ERTS_GLB_INLINE void erts_proc_dec_refc(Process *); -ERTS_GLB_INLINE void erts_proc_add_refc(Process *, Sint); -ERTS_GLB_INLINE Sint erts_proc_read_refc(Process *); +ERTS_GLB_INLINE void erts_smp_proc_inc_refc(Process *); +ERTS_GLB_INLINE void erts_smp_proc_dec_refc(Process *); +ERTS_GLB_INLINE void erts_smp_proc_add_refc(Process *, Sint32); #if ERTS_GLB_INLINE_INCL_FUNC_DEF @@ -833,53 +814,28 @@ #endif } -ERTS_GLB_INLINE void erts_proc_inc_refc(Process *p) +ERTS_GLB_INLINE void erts_smp_proc_inc_refc(Process *p) { - ASSERT(!(erts_smp_atomic32_read_nob(&p->state) & ERTS_PSFLG_PROXY)); #ifdef ERTS_SMP - erts_ptab_atmc_inc_refc(&p->common); -#else erts_ptab_inc_refc(&p->common); #endif } -ERTS_GLB_INLINE void erts_proc_dec_refc(Process *p) +ERTS_GLB_INLINE void erts_smp_proc_dec_refc(Process *p) { - Sint referred; - ASSERT(!(erts_smp_atomic32_read_nob(&p->state) & ERTS_PSFLG_PROXY)); #ifdef ERTS_SMP - referred = erts_ptab_atmc_dec_test_refc(&p->common); -#else - referred = erts_ptab_dec_test_refc(&p->common); -#endif - if (!referred) { - ASSERT(ERTS_PROC_IS_EXITING(p)); + int referred = erts_ptab_dec_test_refc(&p->common); + if (!referred) erts_free_proc(p); - } -} - -ERTS_GLB_INLINE void erts_proc_add_refc(Process *p, Sint add_refc) -{ - Sint referred; - ASSERT(!(erts_smp_atomic32_read_nob(&p->state) & ERTS_PSFLG_PROXY)); -#ifdef ERTS_SMP - referred = erts_ptab_atmc_add_test_refc(&p->common, add_refc); -#else - referred = erts_ptab_add_test_refc(&p->common, add_refc); #endif - if (!referred) { - ASSERT(ERTS_PROC_IS_EXITING(p)); - erts_free_proc(p); - } } -ERTS_GLB_INLINE Sint erts_proc_read_refc(Process *p) +ERTS_GLB_INLINE void erts_smp_proc_add_refc(Process *p, Sint32 add_refc) { - ASSERT(!(erts_smp_atomic32_read_nob(&p->state) & ERTS_PSFLG_PROXY)); #ifdef ERTS_SMP - return erts_ptab_atmc_read_refc(&p->common); -#else - return erts_ptab_read_refc(&p->common); + int referred = erts_ptab_add_test_refc(&p->common, add_refc); + if (!referred) + erts_free_proc(p); #endif } @@ -912,7 +868,7 @@ #define ERTS_P2P_FLG_ALLOW_OTHER_X (1 << 0) #define ERTS_P2P_FLG_TRY_LOCK (1 << 1) -#define ERTS_P2P_FLG_INC_REFC (1 << 2) +#define ERTS_P2P_FLG_SMP_INC_REFC (1 << 2) #define ERTS_PROC_LOCK_BUSY ((Process *) &erts_invalid_process) @@ -972,14 +928,11 @@ int flags) { Process *proc = erts_proc_lookup_raw(pid); - if (!proc) - return NULL; - if (!(flags & ERTS_P2P_FLG_ALLOW_OTHER_X) - && ERTS_PROC_IS_EXITING(proc)) - return NULL; - if (flags & ERTS_P2P_FLG_INC_REFC) - erts_proc_inc_refc(proc); - return proc; + return ((!(flags & ERTS_P2P_FLG_ALLOW_OTHER_X) + && proc + && ERTS_PROC_IS_EXITING(proc)) + ? NULL + : proc); } #endif /* !ERTS_SMP */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_ptab.c erlang-17.3-dfsg/erts/emulator/beam/erl_ptab.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_ptab.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_ptab.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2012-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -281,38 +280,124 @@ }; +#ifdef ARCH_32 + +static ERTS_INLINE Uint64 +dw_aint_to_uint64(erts_dw_aint_t *dw) +{ +#ifdef ETHR_SU_DW_NAINT_T__ + return (Uint64) dw->dw_sint; +#else + Uint64 res; + res = (Uint64) ((Uint32) dw->sint[ERTS_DW_AINT_HIGH_WORD]); + res <<= 32; + res |= (Uint64) ((Uint32) dw->sint[ERTS_DW_AINT_LOW_WORD]); + return res; +#endif +} + +static void +unint64_to_dw_aint(erts_dw_aint_t *dw, Uint64 val) +{ +#ifdef ETHR_SU_DW_NAINT_T__ + dw->dw_sint = (ETHR_SU_DW_NAINT_T__) val; +#else + dw->sint[ERTS_DW_AINT_LOW_WORD] = (erts_aint_t) (val & 0xffffffff); + dw->sint[ERTS_DW_AINT_HIGH_WORD] = (erts_aint_t) ((val >> 32) & 0xffffffff); +#endif +} + static ERTS_INLINE void last_data_init_nob(ErtsPTab *ptab, Uint64 val) { - erts_smp_atomic64_init_nob(&ptab->vola.tile.last_data, (erts_aint64_t) val); + erts_dw_aint_t dw; + unint64_to_dw_aint(&dw, val); + erts_smp_dw_atomic_init_nob(&ptab->vola.tile.last_data, &dw); } static ERTS_INLINE void last_data_set_relb(ErtsPTab *ptab, Uint64 val) { - erts_smp_atomic64_set_relb(&ptab->vola.tile.last_data, (erts_aint64_t) val); + erts_dw_aint_t dw; + unint64_to_dw_aint(&dw, val); + erts_smp_dw_atomic_set_relb(&ptab->vola.tile.last_data, &dw); } static ERTS_INLINE Uint64 last_data_read_nob(ErtsPTab *ptab) { - return (Uint64) erts_smp_atomic64_read_nob(&ptab->vola.tile.last_data); + erts_dw_aint_t dw; + erts_smp_dw_atomic_read_nob(&ptab->vola.tile.last_data, &dw); + return dw_aint_to_uint64(&dw); } static ERTS_INLINE Uint64 last_data_read_acqb(ErtsPTab *ptab) { - return (Uint64) erts_smp_atomic64_read_acqb(&ptab->vola.tile.last_data); + erts_dw_aint_t dw; + erts_smp_dw_atomic_read_acqb(&ptab->vola.tile.last_data, &dw); + return dw_aint_to_uint64(&dw); } static ERTS_INLINE Uint64 last_data_cmpxchg_relb(ErtsPTab *ptab, Uint64 new, Uint64 exp) { - return (Uint64) erts_smp_atomic64_cmpxchg_relb(&ptab->vola.tile.last_data, - (erts_aint64_t) new, - (erts_aint64_t) exp); + erts_dw_aint_t dw_new, dw_xchg; + + unint64_to_dw_aint(&dw_new, new); + unint64_to_dw_aint(&dw_xchg, exp); + + if (erts_smp_dw_atomic_cmpxchg_relb(&ptab->vola.tile.last_data, + &dw_new, + &dw_xchg)) + return exp; + else + return dw_aint_to_uint64(&dw_xchg); +} + +#elif defined(ARCH_64) + +union { + erts_smp_atomic_t pid_data; + char align[ERTS_CACHE_LINE_SIZE]; +} last erts_align_attribute(ERTS_CACHE_LINE_SIZE); + +static ERTS_INLINE void +last_data_init_nob(ErtsPTab *ptab, Uint64 val) +{ + erts_smp_atomic_init_nob(&ptab->vola.tile.last_data, (erts_aint_t) val); } +static ERTS_INLINE void +last_data_set_relb(ErtsPTab *ptab, Uint64 val) +{ + erts_smp_atomic_set_relb(&ptab->vola.tile.last_data, (erts_aint_t) val); +} + +static ERTS_INLINE Uint64 +last_data_read_nob(ErtsPTab *ptab) +{ + return (Uint64) erts_smp_atomic_read_nob(&ptab->vola.tile.last_data); +} + +static ERTS_INLINE Uint64 +last_data_read_acqb(ErtsPTab *ptab) +{ + return (Uint64) erts_smp_atomic_read_acqb(&ptab->vola.tile.last_data); +} + +static ERTS_INLINE Uint64 +last_data_cmpxchg_relb(ErtsPTab *ptab, Uint64 new, Uint64 exp) +{ + return (Uint64) erts_smp_atomic_cmpxchg_relb(&ptab->vola.tile.last_data, + (erts_aint_t) new, + (erts_aint_t) exp); +} + +#else +# error "Not 64-bit, nor 32-bit architecture..." +#endif + static ERTS_INLINE int last_data_cmp(Uint64 ld1, Uint64 ld2) { @@ -361,8 +446,7 @@ int size, UWord element_size, char *name, - int legacy, - int atomic_refc) + int legacy) { size_t tab_sz, alloc_sz; Uint32 bits, cl, cli, ix, ix_per_cache_line, tab_cache_lines; @@ -417,8 +501,6 @@ ptab->r.o.invalid_data = erts_ptab_id2data(ptab, invalid_element->id); ptab->r.o.release_element = release_element; - ptab->r.o.atomic_refc = atomic_refc; - if (legacy) { ptab->r.o.free_id_data = NULL; ptab->r.o.dix_cl_mask = 0; @@ -537,10 +619,9 @@ init_ptab_el(init_arg, (Eterm) data); - if (ptab->r.o.atomic_refc) - erts_atomic_init_nob(&ptab_el->refc.atmc, 1); - else - ptab_el->refc.sint = 1; +#ifdef ERTS_SMP + erts_smp_atomic32_init_nob(&ptab_el->refc, 1); +#endif pix = erts_ptab_data2pix(ptab, (Eterm) data); @@ -613,10 +694,9 @@ init_ptab_el(init_arg, data); - if (ptab->r.o.atomic_refc) - erts_atomic_init_nob(&ptab_el->refc.atmc, 1); - else - ptab_el->refc.sint = 1; +#ifdef ERTS_SMP + erts_smp_atomic32_init_nob(&ptab_el->refc, 1); +#endif /* Move into slot reserved */ #ifdef DEBUG diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_ptab.h erlang-17.3-dfsg/erts/emulator/beam/erl_ptab.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_ptab.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_ptab.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2012-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -52,13 +51,11 @@ typedef struct { Eterm id; - union { - erts_atomic_t atmc; - Sint sint; - } refc; +#ifdef ERTS_SMP + erts_atomic32_t refc; +#endif Eterm tracer_proc; Uint trace_flags; - erts_smp_atomic_t timer; union { /* --- While being alive --- */ struct { @@ -66,6 +63,11 @@ struct reg_proc *reg; ErtsLink *links; ErtsMonitor *monitors; +#ifdef ERTS_SMP + ErtsSmpPTimer *ptimer; +#else + ErlTimer tm; +#endif } alive; /* --- While being released --- */ @@ -86,7 +88,11 @@ } ErtsPTabListData; typedef struct { - erts_smp_atomic64_t last_data; +#ifdef ARCH_32 + erts_smp_dw_atomic_t last_data; +#else + erts_smp_atomic_t last_data; +#endif erts_smp_atomic32_t count; erts_smp_atomic32_t aid_ix; erts_smp_atomic32_t fid_ix; @@ -109,7 +115,6 @@ Eterm invalid_data; void (*release_element)(void *); UWord element_size; - int atomic_refc; } ErtsPTabReadOnlyData; typedef struct { @@ -180,8 +185,7 @@ int size, UWord element_size, char *name, - int legacy, - int atomic_refc); + int legacy); int erts_ptab_new_element(ErtsPTab *ptab, ErtsPTabElementCommon *ptab_el, void *init_arg, @@ -206,15 +210,9 @@ ERTS_GLB_INLINE erts_aint_t erts_ptab_pix2intptr_rb(ErtsPTab *ptab, int ix); ERTS_GLB_INLINE erts_aint_t erts_ptab_pix2intptr_acqb(ErtsPTab *ptab, int ix); ERTS_GLB_INLINE void erts_ptab_inc_refc(ErtsPTabElementCommon *ptab_el); -ERTS_GLB_INLINE Sint erts_ptab_dec_test_refc(ErtsPTabElementCommon *ptab_el); -ERTS_GLB_INLINE Sint erts_ptab_add_test_refc(ErtsPTabElementCommon *ptab_el, - Sint add_refc); -ERTS_GLB_INLINE Sint erts_ptab_read_refc(ErtsPTabElementCommon *ptab_el); -ERTS_GLB_INLINE void erts_ptab_atmc_inc_refc(ErtsPTabElementCommon *ptab_el); -ERTS_GLB_INLINE Sint erts_ptab_atmc_dec_test_refc(ErtsPTabElementCommon *ptab_el); -ERTS_GLB_INLINE Sint erts_ptab_atmc_add_test_refc(ErtsPTabElementCommon *ptab_el, - Sint add_refc); -ERTS_GLB_INLINE Sint erts_ptab_atmc_read_refc(ErtsPTabElementCommon *ptab_el); +ERTS_GLB_INLINE int erts_ptab_dec_test_refc(ErtsPTabElementCommon *ptab_el); +ERTS_GLB_INLINE int erts_ptab_add_test_refc(ErtsPTabElementCommon *ptab_el, + Sint32 add_refc); ERTS_GLB_INLINE void erts_ptab_rlock(ErtsPTab *ptab); ERTS_GLB_INLINE int erts_ptab_tryrlock(ErtsPTab *ptab); ERTS_GLB_INLINE void erts_ptab_runlock(ErtsPTab *ptab); @@ -371,65 +369,50 @@ return erts_smp_atomic_read_acqb(&ptab->r.o.tab[ix]); } -ERTS_GLB_INLINE void erts_ptab_atmc_inc_refc(ErtsPTabElementCommon *ptab_el) +ERTS_GLB_INLINE void erts_ptab_inc_refc(ErtsPTabElementCommon *ptab_el) { +#ifdef ERTS_SMP #ifdef ERTS_ENABLE_LOCK_CHECK - erts_aint_t refc = erts_atomic_inc_read_nob(&ptab_el->refc.atmc); - ERTS_LC_ASSERT(refc > 1); + erts_aint32_t refc = erts_atomic32_inc_read_nob(&ptab_el->refc); + ERTS_SMP_LC_ASSERT(refc > 1); #else - erts_atomic_inc_nob(&ptab_el->refc.atmc); + erts_atomic32_inc_nob(&ptab_el->refc); #endif -} - -ERTS_GLB_INLINE Sint erts_ptab_atmc_dec_test_refc(ErtsPTabElementCommon *ptab_el) -{ - erts_aint_t refc = erts_atomic_dec_read_relb(&ptab_el->refc.atmc); - ERTS_SMP_LC_ASSERT(refc >= 0); -#ifdef ERTS_SMP - if (refc == 0) - ETHR_MEMBAR(ETHR_LoadLoad|ETHR_LoadStore); #endif - return (Sint) refc; } -ERTS_GLB_INLINE Sint erts_ptab_atmc_add_test_refc(ErtsPTabElementCommon *ptab_el, - Sint add_refc) +ERTS_GLB_INLINE int erts_ptab_dec_test_refc(ErtsPTabElementCommon *ptab_el) { - erts_aint_t refc = erts_atomic_add_read_mb(&ptab_el->refc.atmc, - (erts_aint_t) add_refc); +#ifdef ERTS_SMP + erts_aint32_t refc = erts_atomic32_dec_read_nob(&ptab_el->refc); ERTS_SMP_LC_ASSERT(refc >= 0); - return (Sint) refc; + return (int) refc; +#else + return 0; +#endif } -ERTS_GLB_INLINE Sint erts_ptab_atmc_read_refc(ErtsPTabElementCommon *ptab_el) +ERTS_GLB_INLINE int erts_ptab_add_test_refc(ErtsPTabElementCommon *ptab_el, + Sint32 add_refc) { - return (Sint) erts_atomic_read_nob(&ptab_el->refc.atmc); -} +#ifdef ERTS_SMP + erts_aint32_t refc; -ERTS_GLB_INLINE void erts_ptab_inc_refc(ErtsPTabElementCommon *ptab_el) -{ - ptab_el->refc.sint++; - ASSERT(ptab_el->refc.sint > 1); -} +#ifndef ERTS_ENABLE_LOCK_CHECK + if (add_refc >= 0) { + erts_atomic32_add_nob(&ptab_el->refc, + (erts_aint32_t) add_refc); + return 1; + } +#endif -ERTS_GLB_INLINE Sint erts_ptab_dec_test_refc(ErtsPTabElementCommon *ptab_el) -{ - Sint refc = --ptab_el->refc.sint; + refc = erts_atomic32_add_read_nob(&ptab_el->refc, + (erts_aint32_t) add_refc); ERTS_SMP_LC_ASSERT(refc >= 0); - return refc; -} - -ERTS_GLB_INLINE Sint erts_ptab_add_test_refc(ErtsPTabElementCommon *ptab_el, - Sint add_refc) -{ - ptab_el->refc.sint += add_refc; - ERTS_SMP_LC_ASSERT(ptab_el->refc.sint >= 0); - return (Sint) ptab_el->refc.sint; -} - -ERTS_GLB_INLINE Sint erts_ptab_read_refc(ErtsPTabElementCommon *ptab_el) -{ - return ptab_el->refc.sint; + return (int) refc; +#else + return 0; +#endif } ERTS_GLB_INLINE void erts_ptab_rlock(ErtsPTab *ptab) diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_rbtree.h erlang-17.3-dfsg/erts/emulator/beam/erl_rbtree.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_rbtree.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_rbtree.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1741 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -/* - * Description: A Red-Black (binary search) Tree implementation. The search, - * insert, and delete operations are all O(log n) operations - * on a Red-Black Tree. Red-Black Trees are described in - * "Introduction to Algorithms", by Thomas H. Cormen, Charles - * E. Leiserson, and Ronald L. Riverest. - * - * Use by defining mandatory defines as well as defines for - * API functions wanted, and include this header. - * - * Author: Rickard Green - * - * - * Mandatory defines: - * - ERTS_RBT_PREFIX - Prefix to use on functions. - * - ERTS_RBT_T - Type of a tree node. - * - ERTS_RBT_KEY_T - Type of key for a tree node. - * - ERTS_RBT_FLAGS_T - Type of flags for a tree node. - * - ERTS_RBT_INIT_EMPTY_TNODE(T) -Initialize an empty tree node. - * - ERTS_RBT_IS_RED(T) - Is tree node red? - * - ERTS_RBT_SET_RED(T) - Set tree node red. - * - ERTS_RBT_IS_BLACK(T) - Is tree node back? - * - ERTS_RBT_SET_BLACK(T) - Set tree node black. - * - ERTS_RBT_GET_FLAGS(T) - Get flags of tree node (incl colors). - * - ERTS_RBT_SET_FLAGS(T, F) - Set flags of tree note. - * - ERTS_RBT_GET_PARENT(T) - Get parent node. - * - ERTS_RBT_SET_PARENT(T, P) - Set parent node. - * - ERTS_RBT_GET_RIGHT(T) - Get right child node. - * - ERTS_RBT_SET_RIGHT(T, R) - Set right child node. - * - ERTS_RBT_GET_LEFT(T) - Get left child node. - * - ERTS_RBT_SET_LEFT(T, L) - Set left child node. - * - ERTS_RBT_GET_KEY(T) - Get key of node. - * - ERTS_RBT_IS_LT(KX, KY) - Is key KX less than key KY? - * - ERTS_RBT_IS_EQ(KX, KY) - Is key KX equal to key KY? - * - * Optional defines: - * - * - ERTS_RBT_UNDEF - Undefine all user defined ERTS_RBT_* - * defines after use. - * - * - ERTS_RBT_NO_API_INLINE - Do not inline API functions. - * - * Attached data management: - * - ERTS_RBT_UPDATE_ATTACHED_DATA_ROTATE(L, OP, NP) - Called - * when a rotate operation has been performed. If L (in int) - * is a non zero, a left rotation was performed; otherwise, - * a right rotation was performed. OR points to the old - * parent node and NP points to the new parent node. - * - ERTS_RBT_UPDATE_ATTACHED_DATA_DMOD(F, T) - Called when - * a delete operation modifies a tree node. A delete - * modification is either a removal or replacement of a - * node. F points to the parent of the tree node that was - * modified. T points to the next ancestor that will be - * modified. If T is NULL, no more removal and/or - * replacements will be made. One typically wants to update - * the attached data of each node between F and T. If T is - * NULL all the way up to the root. - * - ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT(OR, NR) - Called - * when the root node changes. OR points to the old - * root node and NP points to the new root node. - * - * Request implementation of API functions: - * - ERTS_RBT_WANT_DELETE - * - ERTS_RBT_WANT_INSERT - * - ERTS_RBT_WANT_LOOKUP_INSERT - * - ERTS_RBT_WANT_REPLACE - * - ERTS_RBT_WANT_LOOKUP - * - ERTS_RBT_WANT_SMALLEST - * - ERTS_RBT_WANT_LARGEST - * - ERTS_RBT_WANT_FOREACH - * - ERTS_RBT_WANT_FOREACH_DESTROY - * - ERTS_RBT_WANT_FOREACH_YIELDING - * - ERTS_RBT_WANT_FOREACH_DESTROY_YIELDING - * - ERTS_RBT_WANT_FOREACH_SMALL - * - ERTS_RBT_WANT_FOREACH_LARGE - * - ERTS_RBT_WANT_FOREACH_SMALL_DESTROY - * - ERTS_RBT_WANT_FOREACH_LARGE_DESTROY - * - ERTS_RBT_WANT_FOREACH_SMALL_YIELDING - * - ERTS_RBT_WANT_FOREACH_LARGE_YIELDING - * - ERTS_RBT_WANT_FOREACH_SMALL_DESTROY_YIELDING - * - ERTS_RBT_WANT_FOREACH_LARGE_DESTROY_YIELDING - * - ERTS_RBT_WANT_DEBUG_PRINT - * - * The yield state data type will equal - * _rbt_yield_state_t. - * - * The yield state should be statically initialized by - * ERTS_RBT_YIELD_STAT_INITER. - * - * - * The following API functions are implemented if corresponding - * ERTS_RBT_WANT_ is defined: - * - * - void _rbt_delete( - * ERTS_RBT_T **tree, - * ERTS_RBT_T *element); - * Delete element from tree. - * - * - void _rbt_insert( - * ERTS_RBT_T **tree, - * ERTS_RBT_T *element); - * Insert element into tree. - * - * - ERTS_RBT_T * _rbt_lookup_insert( - * ERTS_RBT_T **tree, - * ERTS_RBT_T *element); - * Look up an element in the tree that compares as equal to the - * element passed as argument, and return the looked up element. - * If no element compared as equal, insert the element passed as - * argument into the tree, and return NULL. - * - * - void _rbt_replace( - * ERTS_RBT_T **tree, - * ERTS_RBT_T *old_element, - * ERTS_RBT_T *new_element); - * Replace old_element in the tree with new_element. Both elements - * *should* compare as equal. - * - * - ERTS_RBT_T * _rbt_lookup( - * ERTS_RBT_T *tree, - * ERTS_RBT_KEY_T key); - * Look up an element with a key that compares as equal to - * the key passed as argument. - * - * - ERTS_RBT_T * _rbt_smallest( - * ERTS_RBT_T *tree); - * Look up the element with the smallest key. - * - * - ERTS_RBT_T * _rbt_largest( - * ERTS_RBT_T *tree); - * Look up the element with the largest key. - * - * - void _rbt_foreach( - * ERTS_RBT_T *tree, - * void (*op)(ERTS_RBT_T *, void *), - * void *arg); - * Operate by calling the operator 'op' on each element. - * Order is undefined. - * - * 'arg' is passed as argument to 'op'. - * - * - void _rbt_foreach_destroy( - * ERTS_RBT_T *tree, - * void (*op)(ERTS_RBT_T *, void *), - * void *arg); - * Operate by calling the operator 'op' on each element. - * Order is undefined. Each element should be destroyed - * by 'op'. - * - * 'arg' is passed as argument to 'op'. - * - * - int _rbt_foreach_yielding( - * ERTS_RBT_T *tree, - * void (*op)(ERTS_RBT_T *, void *), - * void *arg, - * _rbt_yield_state_t *ystate, - * Sint ylimit); - * Operate by calling the operator 'op' on each element. - * Order is undefined. - * - * Yield when 'ylimit' elements has been processed. Zero is - * returned when yielding, and a non-zero value is returned when - * the whole tree has been processed. The tree should not be - * modified until all of it has been processed. - * - * 'arg' is passed as argument to 'op'. - * - * - int _rbt_foreach_destroy_yielding( - * ERTS_RBT_T *tree, - * void (*op)(ERTS_RBT_T *, void *), - * void *arg, - * _rbt_yield_state_t *ystate, - * Sint ylimit); - * Operate by calling the operator 'op' on each element. - * Order is undefined. Each element should be destroyed - * by 'op'. - * - * Yield when 'ylimit' elements has been processed. Zero is - * returned when yielding, and a non-zero value is returned when - * the whole tree has been processed. - * - * 'arg' is passed as argument to 'op'. - * - * - void _rbt_foreach_small( - * ERTS_RBT_T *tree, - * void (*op)(ERTS_RBT_T *, void *), - * void *arg); - * Operate by calling the operator 'op' on each element from - * smallest towards larger elements. - * - * 'arg' is passed as argument to 'op'. - * - * - void _rbt_foreach_large( - * ERTS_RBT_T *tree, - * void (*op)(ERTS_RBT_T *, void *), - * void *arg); - * Operate by calling the operator 'op' on each element from - * largest towards smaller elements. - * - * 'arg' is passed as argument to 'op'. - * - * - int _rbt_foreach_small_yielding( - * ERTS_RBT_T *tree, - * void (*op)(ERTS_RBT_T *, void *), - * void *arg, - * _rbt_yield_state_t *ystate, - * Sint ylimit); - * Operate by calling the operator 'op' on each element from - * smallest towards larger elements. - * - * Yield when 'ylimit' elements has been processed. Zero is - * returned when yielding, and a non-zero value is returned when - * the whole tree has been processed. The tree should not be - * modified until all of it has been processed. - * - * 'arg' is passed as argument to 'op'. - * - * - int _rbt_foreach_large_yielding( - * ERTS_RBT_T *tree, - * void (*op)(ERTS_RBT_T *, void *), - * void *arg, - * _rbt_yield_state_t *ystate, - * Sint ylimit); - * Operate by calling the operator 'op' on each element from - * largest towards smaller elements. - * - * Yield when 'ylimit' elements has been processed. Zero is - * returned when yielding, and a non-zero value is returned when - * the whole tree has been processed. The tree should not be - * modified until all of it has been processed. - * - * 'arg' is passed as argument to 'op'. - * - * - void _rbt_foreach_small_destroy( - * ERTS_RBT_T **tree, - * void (*op)(ERTS_RBT_T *, void *), - * void (*destr)(ERTS_RBT_T *, void *), - * void *arg); - * Operate by calling the operator 'op' on each element from - * smallest towards larger elements. - * - * Destroy elements by calling the destructor 'destr'. Elements - * are destroyed when not needed by the tree structure anymore. - * Note that elements are often *not* destroyed in another order - * than the order that the elements are operated on. - * - * 'arg' is passed as argument to 'op' and 'destroy'. - * - * - void _rbt_foreach_large_destroy( - * ERTS_RBT_T **tree, - * void (*op)(ERTS_RBT_T *, void *), - * void (*destr)(ERTS_RBT_T *, void *), - * void *arg); - * Operate by calling the operator 'op' on each element from - * largest towards smaller elements. - * - * Destroy elements by calling the destructor 'destr'. Elements - * are destroyed when not needed by the tree structure anymore. - * Note that elements are often destroyed in another order - * than the order that the elements are operated on. - * - * 'arg' is passed as argument to 'op' and 'destroy'. - * - * - int _rbt_foreach_small_destroy_yielding( - * ERTS_RBT_T **tree, - * void (*op)(ERTS_RBT_T *, void *), - * void (*destr)(ERTS_RBT_T *, void *), - * void *arg, - * _rbt_yield_state_t *ystate, - * Sint ylimit); - * Operate by calling the operator 'op' on each element from - * smallest towards larger elements. - * - * Destroy elements by calling the destructor 'destr'. Elements - * are destroyed when not needed by the tree structure anymore. - * Note that elements are often destroyed in another order - * than the order that the elements are operated on. - * - * Yield when 'ylimit' elements has been processed. Zero is - * returned when yielding, and a non-zero value is returned when - * the whole tree has been processed. The tree should not be - * modified until all of it has been processed. - * - * 'arg' is passed as argument to 'op' and 'destroy'. - * - * - int _rbt_foreach_large_destroy_yielding( - * ERTS_RBT_T **tree, - * void (*op)(ERTS_RBT_T *, void *), - * void (*destr)(ERTS_RBT_T *, void *), - * void *arg, - * _rbt_yield_state_t *ystate, - * Sint ylimit); - * Operate by calling the operator 'op' on each element from - * largest towards smaller elements. - * - * Destroy elements by calling the destructor 'destr'. Elements - * are destroyed when not needed by the tree structure anymore. - * Note that elements are often destroyed in another order - * than the order that the elements are operated on. - * - * Yield when 'ylimit' elements has been processed. Zero is - * returned when yielding, and a non-zero value is returned when - * the whole tree has been processed. The tree should not be - * modified until all of it has been processed. - * - * 'arg' is passed as argument to 'op' and 'destroy'. - * - * - void _rbt_debug_print( - * FILE *filep, - * ERTS_RBT_T *x, - * int indent, - * (void)(*print_node)(ERTS_RBT_T *)); - * Prints the tree. Note that this function is recursive. - * Should only be used for debuging. - */ - - -/* - * Check that we have all mandatory defines - */ -#ifndef ERTS_RBT_PREFIX -# error Missing definition of ERTS_RBT_PREFIX -#endif -#ifndef ERTS_RBT_T -# error Missing definition of ERTS_RBT_T -#endif -#ifndef ERTS_RBT_KEY_T -# error Missing definition of ERTS_RBT_KEY_T -#endif -#ifndef ERTS_RBT_FLAGS_T -# error Missing definition of ERTS_RBT_FLAGS_T -#endif -#ifndef ERTS_RBT_INIT_EMPTY_TNODE -# error Missing definition of ERTS_RBT_INIT_EMPTY_TNODE -#endif -#ifndef ERTS_RBT_IS_RED -# error Missing definition of ERTS_RBT_IS_RED -#endif -#ifndef ERTS_RBT_SET_RED -# error Missing definition of ERTS_RBT_SET_RED -#endif -#ifndef ERTS_RBT_IS_BLACK -# error Missing definition of ERTS_RBT_IS_BLACK -#endif -#ifndef ERTS_RBT_SET_BLACK -# error Missing definition of ERTS_RBT_SET_BLACK -#endif -#ifndef ERTS_RBT_GET_FLAGS -# error Missing definition of ERTS_RBT_GET_FLAGS -#endif -#ifndef ERTS_RBT_SET_FLAGS -# error Missing definition of ERTS_RBT_SET_FLAGS -#endif -#ifndef ERTS_RBT_GET_PARENT -# error Missing definition of ERTS_RBT_GET_PARENT -#endif -#ifndef ERTS_RBT_SET_PARENT -# error Missing definition of ERTS_RBT_SET_PARENT -#endif -#ifndef ERTS_RBT_GET_RIGHT -# error Missing definition of ERTS_RBT_GET_RIGHT -#endif -#ifndef ERTS_RBT_GET_LEFT -# error Missing definition of ERTS_RBT_GET_LEFT -#endif -#ifndef ERTS_RBT_IS_LT -# error Missing definition of ERTS_RBT_IS_LT -#endif -#ifndef ERTS_RBT_GET_KEY -# error Missing definition of ERTS_RBT_GET_KEY -#endif -#ifndef ERTS_RBT_IS_EQ -# error Missing definition of ERTS_RBT_IS_EQ -#endif - -#if defined(ERTS_RBT_HARD_DEBUG) || defined(DEBUG) -# ifndef ERTS_RBT_DEBUG -# define ERTS_RBT_DEBUG 1 -# endif -#endif - -#if defined(ERTS_RBT_HARD_DEBUG) && defined(__GNUC__) -#warning "* * * * * * * * * * * * * * * * * *" -#warning "* ERTS_RBT_HARD_DEBUG IS ENABLED! *" -#warning "* * * * * * * * * * * * * * * * * *" -#endif - -#undef ERTS_RBT_ASSERT -#if defined(ERTS_RBT_DEBUG) -#define ERTS_RBT_ASSERT(E) ERTS_ASSERT(E) -#else -#define ERTS_RBT_ASSERT(E) ((void) 1) -#endif - -#undef ERTS_RBT_API_INLINE__ -#if defined(ERTS_RBT_NO_API_INLINE) || defined(ERTS_RBT_DEBUG) -# define ERTS_RBT_API_INLINE__ -#else -# define ERTS_RBT_API_INLINE__ ERTS_INLINE -#endif - -#ifndef ERTS_RBT_YIELD_STAT_INITER -# define ERTS_RBT_YIELD_STAT_INITER {NULL, 0} -#endif - -#define ERTS_RBT_CONCAT_MACRO_VALUES___(X, Y) \ - X ## Y -#define ERTS_RBT_CONCAT_MACRO_VALUES__(X, Y) \ - ERTS_RBT_CONCAT_MACRO_VALUES___(X, Y) - -#undef ERTS_RBT_YIELD_STATE_T__ -#define ERTS_RBT_YIELD_STATE_T__ \ - ERTS_RBT_CONCAT_MACRO_VALUES__(ERTS_RBT_PREFIX, _rbt_yield_state_t) - -typedef struct { - ERTS_RBT_T *x; - int up; -} ERTS_RBT_YIELD_STATE_T__; - -#define ERTS_RBT_FUNC__(Name) \ - ERTS_RBT_CONCAT_MACRO_VALUES__(ERTS_RBT_PREFIX, _rbt_ ## Name) - -#undef ERTS_RBT_NEED_REPLACE__ -#undef ERTS_RBT_NEED_INSERT__ -#undef ERTS_RBT_NEED_ROTATE__ -#undef ERTS_RBT_NEED_FOREACH_UNORDERED__ -#undef ERTS_RBT_NEED_FOREACH_ORDERED__ -#undef ERTS_RBT_NEED_HDBG_CHECK_TREE__ -#undef ERTS_RBT_HDBG_CHECK_TREE__ - -#if defined(ERTS_RBT_WANT_REPLACE) || defined(ERTS_RBT_WANT_DELETE) -# define ERTS_RBT_NEED_REPLACE__ -#endif -#if defined(ERTS_RBT_WANT_INSERT) || defined(ERTS_RBT_WANT_LOOKUP_INSERT) -# define ERTS_RBT_NEED_INSERT__ -#endif -#if defined(ERTS_RBT_WANT_DELETE) || defined(ERTS_RBT_NEED_INSERT__) -# define ERTS_RBT_NEED_ROTATE__ -#endif -#if defined(ERTS_RBT_WANT_FOREACH) \ - || defined(ERTS_RBT_WANT_FOREACH_YIELDING) \ - || defined(ERTS_RBT_WANT_FOREACH_DESTROY) \ - || defined(ERTS_RBT_WANT_FOREACH_DESTROY_YIELDING) -# define ERTS_RBT_NEED_FOREACH_UNORDERED__ -#endif -#if defined(ERTS_RBT_WANT_FOREACH_SMALL) \ - || defined(ERTS_RBT_WANT_FOREACH_LARGE) \ - || defined(ERTS_RBT_WANT_FOREACH_SMALL_YIELDING) \ - || defined(ERTS_RBT_WANT_FOREACH_LARGE_YIELDING) \ - || defined(ERTS_RBT_WANT_FOREACH_SMALL_DESTROY) \ - || defined(ERTS_RBT_WANT_FOREACH_LARGE_DESTROY) \ - || defined(ERTS_RBT_WANT_FOREACH_SMALL_DESTROY_YIELDING) \ - || defined(ERTS_RBT_WANT_FOREACH_LARGE_DESTROY_YIELDING) -# define ERTS_RBT_NEED_FOREACH_ORDERED__ -#endif -#if defined(ERTS_RBT_HARD_DEBUG) \ - && (defined(ERTS_RBT_WANT_DELETE) \ - || defined(ERTS_RBT_NEED_INSERT__)) -static void ERTS_RBT_FUNC__(hdbg_check_tree)(ERTS_RBT_T *root); -# define ERTS_RBT_NEED_HDBG_CHECK_TREE__ -# define ERTS_RBT_HDBG_CHECK_TREE__(R) \ - ERTS_RBT_FUNC__(hdbg_check_tree)((R)) -#else -# define ERTS_RBT_HDBG_CHECK_TREE__(R) ((void) 1) -#endif - -#ifdef ERTS_RBT_NEED_ROTATE__ - -static ERTS_INLINE void -ERTS_RBT_FUNC__(left_rotate__)(ERTS_RBT_T **root, ERTS_RBT_T *x) -{ - ERTS_RBT_T *y, *l, *p; - - y = ERTS_RBT_GET_RIGHT(x); - l = ERTS_RBT_GET_LEFT(y); - ERTS_RBT_SET_RIGHT(x, l); - - if (l) - ERTS_RBT_SET_PARENT(l, x); - - p = ERTS_RBT_GET_PARENT(x); - ERTS_RBT_SET_PARENT(y, p); - - if (!p) { - ERTS_RBT_ASSERT(*root == x); - *root = y; -#ifdef ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT - ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT(x, y); -#endif - } - else if (x == ERTS_RBT_GET_LEFT(p)) - ERTS_RBT_SET_LEFT(p, y); - else { - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_RIGHT(p)); - ERTS_RBT_SET_RIGHT(p, y); - } - ERTS_RBT_SET_LEFT(y, x); - ERTS_RBT_SET_PARENT(x, y); - -#ifdef ERTS_RBT_UPDATE_ATTACHED_DATA_ROTATE - ERTS_RBT_UPDATE_ATTACHED_DATA_ROTATE(!0, x, y); -#endif - -} - -static ERTS_INLINE void -ERTS_RBT_FUNC__(right_rotate__)(ERTS_RBT_T **root, ERTS_RBT_T *x) -{ - ERTS_RBT_T *y, *r, *p; - - y = ERTS_RBT_GET_LEFT(x); - r = ERTS_RBT_GET_RIGHT(y); - ERTS_RBT_SET_LEFT(x, r); - - if (r) - ERTS_RBT_SET_PARENT(r, x); - - p = ERTS_RBT_GET_PARENT(x); - ERTS_RBT_SET_PARENT(y, p); - - if (!p) { - ERTS_RBT_ASSERT(*root == x); - *root = y; -#ifdef ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT - ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT(x, y); -#endif - } - else if (x == ERTS_RBT_GET_RIGHT(p)) - ERTS_RBT_SET_RIGHT(p, y); - else { - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_LEFT(p)); - ERTS_RBT_SET_LEFT(p, y); - } - - ERTS_RBT_SET_RIGHT(y, x); - ERTS_RBT_SET_PARENT(x, y); - -#ifdef ERTS_RBT_UPDATE_ATTACHED_DATA_ROTATE - ERTS_RBT_UPDATE_ATTACHED_DATA_ROTATE(0, x, y); -#endif - -} - -#endif /* ERTS_RBT_NEED_ROTATE__ */ - -#ifdef ERTS_RBT_NEED_REPLACE__ - -/* - * Replace node x with node y - */ -static ERTS_INLINE void -ERTS_RBT_FUNC__(replace__)(ERTS_RBT_T **root, ERTS_RBT_T *x, ERTS_RBT_T *y) -{ - ERTS_RBT_T *p, *r, *l; - ERTS_RBT_FLAGS_T f; - - p = ERTS_RBT_GET_PARENT(x); - if (!p) { - ERTS_RBT_ASSERT(*root == x); - *root = y; -#ifdef ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT - ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT(x, y); -#endif - } - else if (x == ERTS_RBT_GET_LEFT(p)) - ERTS_RBT_SET_LEFT(p, y); - else { - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_RIGHT(p)); - ERTS_RBT_SET_RIGHT(p, y); - } - l = ERTS_RBT_GET_LEFT(x); - if (l) { - ERTS_RBT_ASSERT(ERTS_RBT_GET_PARENT(l) == x); - ERTS_RBT_SET_PARENT(l, y); - } - r = ERTS_RBT_GET_RIGHT(x); - if (r) { - ERTS_RBT_ASSERT(ERTS_RBT_GET_PARENT(r) == x); - ERTS_RBT_SET_PARENT(r, y); - } - - f = ERTS_RBT_GET_FLAGS(x); - ERTS_RBT_SET_FLAGS(y, f); - ERTS_RBT_SET_PARENT(y, p); - ERTS_RBT_SET_RIGHT(y, r); - ERTS_RBT_SET_LEFT(y, l); -} - -#endif /* ERTS_RBT_NEED_REPLACE__ */ - -#ifdef ERTS_RBT_WANT_REPLACE - -static ERTS_RBT_API_INLINE__ void -ERTS_RBT_FUNC__(replace)(ERTS_RBT_T **root, ERTS_RBT_T *x, ERTS_RBT_T *y) -{ - ERTS_RBT_ASSERT(ERTS_RBT_IS_EQ(ERTS_RBT_GET_KEY(x), - ERTS_RBT_GET_KEY(y))); - - ERTS_RBT_FUNC__(replace__)(root, x, y); -} - -#endif /* ERTS_RBT_WANT_REPLACE */ - -#ifdef ERTS_RBT_WANT_DELETE - -/* - * Delete a node. - */ -static ERTS_RBT_API_INLINE__ void -ERTS_RBT_FUNC__(delete)(ERTS_RBT_T **root, ERTS_RBT_T *n) -{ - int spliced_is_black; - ERTS_RBT_T *p, *x, *y, *z = n; - ERTS_RBT_T null_x; /* null_x is used to get the fixup started when we - splice out a node without children. */ - - ERTS_RBT_HDBG_CHECK_TREE__(*root); - - ERTS_RBT_INIT_EMPTY_TNODE(&null_x); - - /* Remove node from tree... */ - - /* Find node to splice out */ - if (!ERTS_RBT_GET_LEFT(z) || !ERTS_RBT_GET_RIGHT(z)) - y = z; - else { - /* Set y to z:s successor */ - y = ERTS_RBT_GET_RIGHT(z); - while (1) { - ERTS_RBT_T *t = ERTS_RBT_GET_LEFT(y); - if (!t) - break; - y = t; - } - } - /* splice out y */ - x = ERTS_RBT_GET_LEFT(y); - if (!x) - x = ERTS_RBT_GET_RIGHT(y); - spliced_is_black = ERTS_RBT_IS_BLACK(y); - p = ERTS_RBT_GET_PARENT(y); - if (x) - ERTS_RBT_SET_PARENT(x, p); - else if (spliced_is_black) { - x = &null_x; - ERTS_RBT_SET_BLACK(x); - ERTS_RBT_SET_PARENT(x, p); - ERTS_RBT_SET_LEFT(y, x); - } - - if (!p) { - ERTS_RBT_ASSERT(*root == y); - *root = x; -#ifdef ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT - ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT(y, x); -#endif - } - else { - if (y == ERTS_RBT_GET_LEFT(p)) - ERTS_RBT_SET_LEFT(p, x); - else { - ERTS_RBT_ASSERT(y == ERTS_RBT_GET_RIGHT(p)); - ERTS_RBT_SET_RIGHT(p, x); - } -#ifdef ERTS_RBT_UPDATE_ATTACHED_DATA_DMOD - if (p != z) - ERTS_RBT_UPDATE_ATTACHED_DATA_DMOD(p, y == z ? NULL : z); -#endif - } - if (y != z) { - /* We spliced out the successor of z; replace z by the successor */ - ERTS_RBT_FUNC__(replace__)(root, z, y); -#ifdef ERTS_RBT_UPDATE_ATTACHED_DATA_DMOD - ERTS_RBT_UPDATE_ATTACHED_DATA_DMOD(y, NULL); -#endif - } - - if (spliced_is_black) { - /* We removed a black node which makes the resulting tree - violate the Red-Black Tree properties. Fixup tree... */ - - p = ERTS_RBT_GET_PARENT(x); - while (ERTS_RBT_IS_BLACK(x) && p) { - ERTS_RBT_T *r, *l; - - /* - * x has an "extra black" which we move up the tree - * until we reach the root or until we can get rid of it. - * - * y is the sibbling of x, and p is their parent - */ - - if (x == ERTS_RBT_GET_LEFT(p)) { - y = ERTS_RBT_GET_RIGHT(p); - - ERTS_RBT_ASSERT(y); - - if (ERTS_RBT_IS_RED(y)) { - ERTS_RBT_ASSERT(ERTS_RBT_GET_RIGHT(y)); - ERTS_RBT_ASSERT(ERTS_RBT_GET_LEFT(y)); - - ERTS_RBT_SET_BLACK(y); - - ERTS_RBT_ASSERT(ERTS_RBT_IS_BLACK(p)); - - ERTS_RBT_SET_RED(p); - ERTS_RBT_FUNC__(left_rotate__)(root, p); - p = ERTS_RBT_GET_PARENT(x); - y = ERTS_RBT_GET_RIGHT(p); - } - - ERTS_RBT_ASSERT(y); - ERTS_RBT_ASSERT(ERTS_RBT_IS_BLACK(y)); - - l = ERTS_RBT_GET_LEFT(y); - r = ERTS_RBT_GET_RIGHT(y); - if ((!l || ERTS_RBT_IS_BLACK(l)) - && (!r || ERTS_RBT_IS_BLACK(r))) { - ERTS_RBT_SET_RED(y); - x = p; - p = ERTS_RBT_GET_PARENT(x); - } - else { - if (!r || ERTS_RBT_IS_BLACK(r)) { - ERTS_RBT_SET_BLACK(l); - ERTS_RBT_SET_RED(y); - ERTS_RBT_FUNC__(right_rotate__)(root, y); - p = ERTS_RBT_GET_PARENT(x); - y = ERTS_RBT_GET_RIGHT(p); - } - - ERTS_RBT_ASSERT(y); - - if (p && ERTS_RBT_IS_RED(p)) { - - ERTS_RBT_SET_BLACK(p); - ERTS_RBT_SET_RED(y); - } - - ERTS_RBT_ASSERT(ERTS_RBT_GET_RIGHT(y)); - - ERTS_RBT_SET_BLACK(ERTS_RBT_GET_RIGHT(y)); - ERTS_RBT_FUNC__(left_rotate__)(root, p); - x = *root; - break; - } - } - else { - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_RIGHT(p)); - - y = ERTS_RBT_GET_LEFT(p); - - ERTS_RBT_ASSERT(y); - - if (ERTS_RBT_IS_RED(y)) { - ERTS_RBT_ASSERT(ERTS_RBT_GET_RIGHT(y)); - ERTS_RBT_ASSERT(ERTS_RBT_GET_LEFT(y)); - - ERTS_RBT_SET_BLACK(y); - ERTS_RBT_ASSERT(ERTS_RBT_IS_BLACK(p)); - ERTS_RBT_SET_RED(p); - ERTS_RBT_FUNC__(right_rotate__)(root, p); - - p = ERTS_RBT_GET_PARENT(x); - y = ERTS_RBT_GET_LEFT(p); - } - - ERTS_RBT_ASSERT(y); - ERTS_RBT_ASSERT(ERTS_RBT_IS_BLACK(y)); - - l = ERTS_RBT_GET_LEFT(y); - r = ERTS_RBT_GET_RIGHT(y); - - if ((!r || ERTS_RBT_IS_BLACK(r)) - && (!l || ERTS_RBT_IS_BLACK(l))) { - ERTS_RBT_SET_RED(y); - x = p; - p = ERTS_RBT_GET_PARENT(x); - } - else { - if (!l || ERTS_RBT_IS_BLACK(l)) { - ERTS_RBT_SET_BLACK(r); - ERTS_RBT_SET_RED(y); - ERTS_RBT_FUNC__(left_rotate__)(root, y); - - p = ERTS_RBT_GET_PARENT(x); - y = ERTS_RBT_GET_LEFT(p); - } - - ERTS_RBT_ASSERT(y); - - if (p && ERTS_RBT_IS_RED(p)) { - ERTS_RBT_SET_BLACK(p); - ERTS_RBT_SET_RED(y); - } - - ERTS_RBT_ASSERT(ERTS_RBT_GET_LEFT(y)); - - ERTS_RBT_SET_BLACK(ERTS_RBT_GET_LEFT(y)); - ERTS_RBT_FUNC__(right_rotate__)(root, p); - x = *root; - break; - } - } - } - - ERTS_RBT_SET_BLACK(x); - - x = &null_x; - p = ERTS_RBT_GET_PARENT(x); - - if (p) { - if (ERTS_RBT_GET_LEFT(p) == x) - ERTS_RBT_SET_LEFT(p, NULL); - else { - ERTS_RBT_ASSERT(ERTS_RBT_GET_RIGHT(p) == x); - ERTS_RBT_SET_RIGHT(p, NULL); - } - - ERTS_RBT_ASSERT(!ERTS_RBT_GET_LEFT(x)); - ERTS_RBT_ASSERT(!ERTS_RBT_GET_RIGHT(x)); - } - else if (*root == x) { - *root = NULL; - -#ifdef ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT - ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT(x, NULL); -#endif - - ERTS_RBT_ASSERT(!ERTS_RBT_GET_LEFT(x)); - ERTS_RBT_ASSERT(!ERTS_RBT_GET_RIGHT(x)); - } - } - - ERTS_RBT_HDBG_CHECK_TREE__(*root); - -} - -#endif /* ERTS_RBT_WANT_DELETE */ - -#ifdef ERTS_RBT_NEED_INSERT__ - -static void -ERTS_RBT_FUNC__(insert_fixup__)(ERTS_RBT_T **root, ERTS_RBT_T *n) -{ - ERTS_RBT_T *x, *y; - - x = n; - - /* - * Rearrange the tree so that it satisfies the Red-Black Tree properties - */ - - ERTS_RBT_ASSERT(x != *root && ERTS_RBT_IS_RED(ERTS_RBT_GET_PARENT(x))); - do { - ERTS_RBT_T *p, *pp; - - /* - * x and its parent are both red. Move the red pair up the tree - * until we get to the root or until we can separate them. - */ - - p = ERTS_RBT_GET_PARENT(x); - pp = ERTS_RBT_GET_PARENT(p); - - ERTS_RBT_ASSERT(p && pp); - ERTS_RBT_ASSERT(ERTS_RBT_IS_RED(x)); - ERTS_RBT_ASSERT(ERTS_RBT_IS_BLACK(pp)); - - if (p == ERTS_RBT_GET_LEFT(pp)) { - y = ERTS_RBT_GET_RIGHT(pp); - if (y && ERTS_RBT_IS_RED(y)) { - ERTS_RBT_SET_BLACK(y); - ERTS_RBT_SET_BLACK(p); - ERTS_RBT_SET_RED(pp); - x = pp; - } - else { - - if (x == ERTS_RBT_GET_RIGHT(p)) { - x = p; - ERTS_RBT_FUNC__(left_rotate__)(root, x); - p = ERTS_RBT_GET_PARENT(x); - pp = ERTS_RBT_GET_PARENT(p); - - ERTS_RBT_ASSERT(p && pp); - } - - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_LEFT(ERTS_RBT_GET_LEFT(pp))); - ERTS_RBT_ASSERT(ERTS_RBT_IS_RED(x)); - ERTS_RBT_ASSERT(ERTS_RBT_IS_RED(p)); - ERTS_RBT_ASSERT(ERTS_RBT_IS_BLACK(pp)); - ERTS_RBT_ASSERT(!y || ERTS_RBT_IS_BLACK(y)); - - - ERTS_RBT_SET_BLACK(p); - ERTS_RBT_SET_RED(pp); - ERTS_RBT_FUNC__(right_rotate__)(root, pp); - - - ERTS_RBT_ASSERT(ERTS_RBT_GET_LEFT(ERTS_RBT_GET_PARENT(x)) == x); - ERTS_RBT_ASSERT(ERTS_RBT_IS_RED(x)); - ERTS_RBT_ASSERT(ERTS_RBT_IS_RED( - ERTS_RBT_GET_RIGHT( - ERTS_RBT_GET_PARENT(x)))); - ERTS_RBT_ASSERT(!ERTS_RBT_GET_PARENT(x) - || ERTS_RBT_IS_BLACK(ERTS_RBT_GET_PARENT(x))); - break; - } - } - else { - ERTS_RBT_ASSERT(p == ERTS_RBT_GET_RIGHT(pp)); - - y = ERTS_RBT_GET_LEFT(pp); - if (y && ERTS_RBT_IS_RED(y)) { - ERTS_RBT_SET_BLACK(y); - ERTS_RBT_SET_BLACK(p); - ERTS_RBT_SET_RED(pp); - x = pp; - } - else { - - if (x == ERTS_RBT_GET_LEFT(p)) { - x = p; - ERTS_RBT_FUNC__(right_rotate__)(root, x); - p = ERTS_RBT_GET_PARENT(x); - pp = ERTS_RBT_GET_PARENT(p); - - ERTS_RBT_ASSERT(p && pp); - } - - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_RIGHT(ERTS_RBT_GET_RIGHT(pp))); - ERTS_RBT_ASSERT(ERTS_RBT_IS_RED(x)); - ERTS_RBT_ASSERT(ERTS_RBT_IS_RED(p)); - ERTS_RBT_ASSERT(ERTS_RBT_IS_BLACK(pp)); - ERTS_RBT_ASSERT(!y || ERTS_RBT_IS_BLACK(y)); - - - ERTS_RBT_SET_BLACK(p); - ERTS_RBT_SET_RED(pp); - ERTS_RBT_FUNC__(left_rotate__)(root, pp); - - - ERTS_RBT_ASSERT(ERTS_RBT_GET_RIGHT(ERTS_RBT_GET_PARENT(x)) == x); - ERTS_RBT_ASSERT(ERTS_RBT_IS_RED(x)); - ERTS_RBT_ASSERT(ERTS_RBT_IS_RED( - ERTS_RBT_GET_LEFT( - ERTS_RBT_GET_PARENT(x)))); - ERTS_RBT_ASSERT(!ERTS_RBT_GET_PARENT(x) - || ERTS_RBT_IS_BLACK(ERTS_RBT_GET_PARENT(x))); - break; - } - } - } while (x != *root && ERTS_RBT_IS_RED(ERTS_RBT_GET_PARENT(x))); - - ERTS_RBT_SET_BLACK(*root); - -} - -static ERTS_INLINE ERTS_RBT_T * -ERTS_RBT_FUNC__(insert_aux__)(ERTS_RBT_T **root, ERTS_RBT_T *n, int lookup) -{ - ERTS_RBT_KEY_T kn = ERTS_RBT_GET_KEY(n); - - ERTS_RBT_HDBG_CHECK_TREE__(*root); - - ERTS_RBT_INIT_EMPTY_TNODE(n); - - if (!*root) { - ERTS_RBT_SET_BLACK(n); - *root = n; -#ifdef ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT - ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT(NULL, n); -#endif - } - else { - ERTS_RBT_T *p, *x = *root; - - while (1) { - ERTS_RBT_KEY_T kx; - ERTS_RBT_T *c; - - kx = ERTS_RBT_GET_KEY(x); - - if (lookup && ERTS_RBT_IS_EQ(kn, kx)) { - - ERTS_RBT_HDBG_CHECK_TREE__(*root); - - return x; - } - - if (ERTS_RBT_IS_LT(kn, kx)) { - c = ERTS_RBT_GET_LEFT(x); - if (!c) { - ERTS_RBT_SET_PARENT(n, x); - ERTS_RBT_SET_LEFT(x, n); - p = x; - break; - } - } - else { - c = ERTS_RBT_GET_RIGHT(x); - if (!c) { - ERTS_RBT_SET_PARENT(n, x); - ERTS_RBT_SET_RIGHT(x, n); - p = x; - break; - } - } - - x = c; - } - - ERTS_RBT_ASSERT(p); - - ERTS_RBT_SET_RED(n); - if (ERTS_RBT_IS_RED(p)) - ERTS_RBT_FUNC__(insert_fixup__)(root, n); - } - - ERTS_RBT_HDBG_CHECK_TREE__(*root); - - return NULL; -} - -#endif /* ERTS_RBT_NEED_INSERT__ */ - -#ifdef ERTS_RBT_WANT_LOOKUP_INSERT - -static ERTS_RBT_API_INLINE__ ERTS_RBT_T * -ERTS_RBT_FUNC__(lookup_insert)(ERTS_RBT_T **root, ERTS_RBT_T *n) -{ - return ERTS_RBT_FUNC__(insert_aux__)(root, n, !0); -} - -#endif /* ERTS_RBT_WANT_LOOKUP_INSERT */ - -#ifdef ERTS_RBT_WANT_INSERT - -static ERTS_RBT_API_INLINE__ void -ERTS_RBT_FUNC__(insert)(ERTS_RBT_T **root, ERTS_RBT_T *n) -{ - (void) ERTS_RBT_FUNC__(insert_aux__)(root, n, 0); -} - -#endif /* ERTS_RBT_WANT_INSERT */ - -#ifdef ERTS_RBT_WANT_LOOKUP - -static ERTS_RBT_API_INLINE__ ERTS_RBT_T * -ERTS_RBT_FUNC__(lookup)(ERTS_RBT_T *root, ERTS_RBT_KEY_T key) -{ - ERTS_RBT_T *x = root; - - if (!x) - return NULL; - - while (1) { - ERTS_RBT_KEY_T kx = ERTS_RBT_GET_KEY(x); - ERTS_RBT_T *c; - - if (ERTS_RBT_IS_EQ(key, kx)) - return x; - - if (ERTS_RBT_IS_LT(key, kx)) { - c = ERTS_RBT_GET_LEFT(x); - if (!c) - return NULL; - } - else { - c = ERTS_RBT_GET_RIGHT(x); - if (!c) - return NULL; - } - - x = c; - } -} - -#endif /* ERTS_RBT_WANT_LOOKUP */ - -#ifdef ERTS_RBT_WANT_SMALLEST - -static ERTS_RBT_API_INLINE__ ERTS_RBT_T * -ERTS_RBT_FUNC__(smallest)(ERTS_RBT_T *root) -{ - ERTS_RBT_T *x = root; - - if (!x) - return NULL; - - while (1) { - ERTS_RBT_T *c = ERTS_RBT_GET_LEFT(x); - if (!c) - break; - x = c; - } - - return x; -} - -#endif /* ERTS_RBT_WANT_SMALLEST */ - -#ifdef ERTS_RBT_WANT_LARGEST - -static ERTS_RBT_API_INLINE__ ERTS_RBT_T * -ERTS_RBT_FUNC__(largest)(ERTS_RBT_T *root) -{ - ERTS_RBT_T *x = root; - - if (!x) - return NULL; - - while (1) { - ERTS_RBT_T *c = ERTS_RBT_GET_RIGHT(x); - if (!c) - break; - x = c; - } - - return x; -} - -#endif /* ERTS_RBT_WANT_LARGEST */ - -#ifdef ERTS_RBT_NEED_FOREACH_UNORDERED__ - -static ERTS_INLINE int -ERTS_RBT_FUNC__(foreach_unordered__)(ERTS_RBT_T **root, - int destroying, - void (*op)(ERTS_RBT_T *, void *), - void *arg, - int yielding, - ERTS_RBT_YIELD_STATE_T__ *ystate, - Sint ylimit) -{ - ERTS_RBT_T *c, *p, *x; - - ERTS_RBT_ASSERT(!yielding || ystate); - - if (yielding && ystate->x) { - x = ystate->x; - ERTS_RBT_ASSERT(ystate->up); - goto restart_up; - } - else { - x = *root; - if (!x) - return 0; - if (destroying) - *root = NULL; - } - - while (1) { - - while (1) { - - while (1) { - c = ERTS_RBT_GET_LEFT(x); - if (!c) - break; - x = c; - } - - c = ERTS_RBT_GET_RIGHT(x); - if (!c) - break; - x = c; - } - - while (1) { -#ifdef ERTS_RBT_DEBUG - int cdir; -#endif - if (yielding && ylimit-- <= 0) { - ystate->x = x; - ystate->up = 1; - return 1; - } - - restart_up: - - p = ERTS_RBT_GET_PARENT(x); - -#ifdef ERTS_RBT_DEBUG - ERTS_RBT_ASSERT(!destroying || !ERTS_RBT_GET_LEFT(x)); - ERTS_RBT_ASSERT(!destroying || !ERTS_RBT_GET_RIGHT(x)); - - if (p) { - if (x == ERTS_RBT_GET_LEFT(p)) { - cdir = -1; - if (destroying) - ERTS_RBT_SET_LEFT(p, NULL); - } - else { - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_RIGHT(p)); - cdir = 1; - if (destroying) - ERTS_RBT_SET_RIGHT(p, NULL); - } - } -#endif - - (*op)(x, arg); - - if (!p) { - if (yielding) { - ystate->x = NULL; - ystate->up = 0; - } - return 0; /* Done */ - } - - c = ERTS_RBT_GET_RIGHT(p); - if (c && c != x) { - ERTS_RBT_ASSERT(cdir < 0); - - /* Go down tree of x's sibling... */ - x = c; - break; - } - - x = p; - } - } -} - -#endif /* ERTS_RBT_NEED_FOREACH_UNORDERED__ */ - -#ifdef ERTS_RBT_NEED_FOREACH_ORDERED__ - -static ERTS_INLINE int -ERTS_RBT_FUNC__(foreach_ordered__)(ERTS_RBT_T **root, - int from_small, - int destroying, - void (*op)(ERTS_RBT_T *, void *), - void (*destroy)(ERTS_RBT_T *, void *), - void *arg, - int yielding, - ERTS_RBT_YIELD_STATE_T__ *ystate, - Sint ylimit) -{ - ERTS_RBT_T *c, *p, *x; - - ERTS_RBT_ASSERT(!yielding || ystate); - ERTS_RBT_ASSERT(!destroying || destroy); - - if (yielding && ystate->x) { - x = ystate->x; - if (ystate->up) - goto restart_up; - else - goto restart_down; - } - else { - x = *root; - if (!x) - return 0; - if (destroying) - *root = NULL; - } - - while (1) { - - while (1) { - - while (1) { - c = from_small ? ERTS_RBT_GET_LEFT(x) : ERTS_RBT_GET_RIGHT(x); - if (!c) - break; - x = c; - } - - (*op)(x, arg); - - if (yielding && --ylimit <= 0) { - ystate->x = x; - ystate->up = 0; - return 1; - } - - restart_down: - - c = from_small ? ERTS_RBT_GET_RIGHT(x) : ERTS_RBT_GET_LEFT(x); - if (!c) - break; - x = c; - } - - while (1) { - p = ERTS_RBT_GET_PARENT(x); - - if (p) { - - c = from_small ? ERTS_RBT_GET_RIGHT(p) : ERTS_RBT_GET_LEFT(p); - if (!c || c != x) { - ERTS_RBT_ASSERT((from_small - ? ERTS_RBT_GET_LEFT(p) - : ERTS_RBT_GET_RIGHT(p)) == x); - - (*op)(p, arg); - - if (yielding && --ylimit <= 0) { - ystate->x = x; - ystate->up = 1; - return 1; - restart_up: - p = ERTS_RBT_GET_PARENT(x); - } - } - - if (c && c != x) { - ERTS_RBT_ASSERT((from_small - ? ERTS_RBT_GET_LEFT(p) - : ERTS_RBT_GET_RIGHT(p)) == x); - - /* Go down tree of x's sibling... */ - x = c; - break; - } - } - - if (destroying) { - -#ifdef ERTS_RBT_DEBUG - ERTS_RBT_ASSERT(!ERTS_RBT_GET_LEFT(x) - && !ERTS_RBT_GET_RIGHT(x)); - - if (p) { - if (x == ERTS_RBT_GET_LEFT(p)) - ERTS_RBT_SET_LEFT(p, NULL); - else { - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_RIGHT(p)); - ERTS_RBT_SET_RIGHT(p, NULL); - } - } -#endif - - (*destroy)(x, arg); - } - - if (!p) { - if (yielding) { - ystate->x = NULL; - ystate->up = 0; - } - return 1; /* Done */ - } - x = p; - } - } -} - -#endif /* ERTS_RBT_NEED_FOREACH_ORDERED__ */ - -#ifdef ERTS_RBT_WANT_FOREACH - -static ERTS_RBT_API_INLINE__ void -ERTS_RBT_FUNC__(foreach)(ERTS_RBT_T *root, - void (*op)(ERTS_RBT_T *, void *), - void *arg) -{ - (void) ERTS_RBT_FUNC__(foreach_unordered__)(&root, 0, op, arg, - 0, NULL, 0); -} - -#endif /* ERTS_RBT_WANT_FOREACH */ - -#ifdef ERTS_RBT_WANT_FOREACH_SMALL - -static ERTS_RBT_API_INLINE__ void -ERTS_RBT_FUNC__(foreach_small)(ERTS_RBT_T *root, - void (*op)(ERTS_RBT_T *, void *), - void *arg) -{ - (void) ERTS_RBT_FUNC__(foreach_ordered__)(&root, 1, 0, - op, NULL, arg, - 0, NULL, 0); -} - -#endif /* ERTS_RBT_WANT_FOREACH_SMALL */ - -#ifdef ERTS_RBT_WANT_FOREACH_LARGE - -static ERTS_RBT_API_INLINE__ void -ERTS_RBT_FUNC__(foreach_large)(ERTS_RBT_T *root, - void (*op)(ERTS_RBT_T *, void *), - void *arg) -{ - (void) ERTS_RBT_FUNC__(foreach_ordered__)(&root, 0, 0, - op, NULL, arg, - 0, NULL, 0); -} - -#endif /* ERTS_RBT_WANT_FOREACH_LARGE */ - -#ifdef ERTS_RBT_WANT_FOREACH_YIELDING - -static ERTS_RBT_API_INLINE__ void -ERTS_RBT_FUNC__(foreach_yielding)(ERTS_RBT_T *root, - void (*op)(ERTS_RBT_T *, void *), - void *arg, - ERTS_RBT_YIELD_STATE_T__ *ystate, - Sint ylimit) -{ - (void) ERTS_RBT_FUNC__(foreach_unordered__)(*root, 0, op, arg, - 1, ystate, ylimit); -} - -#endif /* ERTS_RBT_WANT_FOREACH_YIELDING */ - -#ifdef ERTS_RBT_WANT_FOREACH_SMALL_YIELDING - -static ERTS_RBT_API_INLINE__ int -ERTS_RBT_FUNC__(foreach_small_yielding)(ERTS_RBT_T *root, - void (*op)(ERTS_RBT_T *, void *), - void *arg, - ERTS_RBT_YIELD_STATE_T__ *ystate, - Sint ylimit) -{ - return ERTS_RBT_FUNC__(foreach_ordered__)(&root, 1, 0, - op, NULL, arg, - 1, ystate, ylimit); -} - -#endif /* ERTS_RBT_WANT_FOREACH_SMALL_YIELDING */ - -#ifdef ERTS_RBT_WANT_FOREACH_LARGE_YIELDING - -static ERTS_RBT_API_INLINE__ int -ERTS_RBT_FUNC__(foreach_large_yielding)(ERTS_RBT_T *root, - void (*op)(ERTS_RBT_T *, void *), - void *arg, - ERTS_RBT_YIELD_STATE_T__ *ystate, - Sint ylimit) -{ - return ERTS_RBT_FUNC__(foreach_ordered__)(&root, 0, 0, - op, NULL, arg, - 1, ystate, ylimit); -} - -#endif /* ERTS_RBT_WANT_FOREACH_LARGE_YIELDING */ - -#ifdef ERTS_RBT_WANT_FOREACH_DESTROY - -static ERTS_RBT_API_INLINE__ void -ERTS_RBT_FUNC__(foreach_destroy)(ERTS_RBT_T **root, - void (*op)(ERTS_RBT_T *, void *), - void *arg) -{ - (void) ERTS_RBT_FUNC__(foreach_unordered__)(root, 1, op, arg, - 0, NULL, 0); -} - -#endif /* ERTS_RBT_WANT_FOREACH_DESTROY */ - -#ifdef ERTS_RBT_WANT_FOREACH_SMALL_DESTROY - -static ERTS_RBT_API_INLINE__ void -ERTS_RBT_FUNC__(foreach_small_destroy)(ERTS_RBT_T **root, - void (*op)(ERTS_RBT_T *, void *), - void (*destr)(ERTS_RBT_T *, void *), - void *arg) -{ - (void) ERTS_RBT_FUNC__(foreach_ordered__)(root, 1, 1, - op, destr, arg, - 0, NULL, 0); -} - -#endif /* ERTS_RBT_WANT_FOREACH_SMALL_DESTROY */ - -#ifdef ERTS_RBT_WANT_FOREACH_LARGE_DESTROY - -static ERTS_RBT_API_INLINE__ void -ERTS_RBT_FUNC__(foreach_large_destroy)(ERTS_RBT_T **root, - void (*op)(ERTS_RBT_T *, void *), - void (*destr)(ERTS_RBT_T *, void *), - void *arg) -{ - (void) ERTS_RBT_FUNC__(foreach_ordered__)(root, 0, 1, - op, destr, arg, - 0, NULL, 0); -} - -#endif /* ERTS_RBT_WANT_FOREACH_LARGE_DESTROY */ - -#ifdef ERTS_RBT_WANT_FOREACH_DESTROY_YIELDING - -static ERTS_RBT_API_INLINE__ int -ERTS_RBT_FUNC__(foreach_destroy_yielding)(ERTS_RBT_T **root, - void (*op)(ERTS_RBT_T *, void *), - void *arg, - ERTS_RBT_YIELD_STATE_T__ *ystate, - Sint ylimit) -{ - return ERTS_RBT_FUNC__(foreach_unordered__)(root, 1, op, arg, - 1, ystate, ylimit); -} - -#endif /* ERTS_RBT_WANT_FOREACH_DESTROY_YIELDING */ - -#ifdef ERTS_RBT_WANT_FOREACH_SMALL_DESTROY_YIELDING - -static ERTS_RBT_API_INLINE__ int -ERTS_RBT_FUNC__(foreach_small_destroy_yielding)(ERTS_RBT_T **root, - void (*op)(ERTS_RBT_T *, void *), - void (*destr)(ERTS_RBT_T *, void *), - void *arg, - ERTS_RBT_YIELD_STATE_T__ *ystate, - Sint ylimit) -{ - return ERTS_RBT_FUNC__(foreach_ordered__)(root, 1, 1, - op, destr, arg, - 1, ystate, ylimit); -} - -#endif /* ERTS_RBT_WANT_FOREACH_SMALL_DESTROY_YIELDING */ - -#ifdef ERTS_RBT_WANT_FOREACH_LARGE_DESTROY_YIELDING - -static ERTS_RBT_API_INLINE__ int -ERTS_RBT_FUNC__(foreach_large_destroy_yielding)(ERTS_RBT_T **root, - void (*op)(ERTS_RBT_T *, void *), - void (*destr)(ERTS_RBT_T *, void *), - void *arg, - ERTS_RBT_YIELD_STATE_T__ *ystate, - Sint ylimit) -{ - return ERTS_RBT_FUNC__(foreach_ordered__)(root, 0, 1, - op, destr, arg, - 1, ystate, ylimit); -} - -#endif /* ERTS_RBT_WANT_FOREACH_LARGE_DESTROY_YIELDING */ - -#ifdef ERTS_RBT_WANT_DEBUG_PRINT - -static void -ERTS_RBT_FUNC__(debug_print)(FILE *filep, ERTS_RBT_T *x, int indent, - void (*print_node)(ERTS_RBT_T *)) -{ - if (x) { - ERTS_RBT_FUNC__(debug_print)(filep, ERTS_RBT_GET_RIGHT(x), - indent+2, print_node); - erts_fprintf(filep, - "%*s[%s:%p:", - indent, "", - ERTS_RBT_IS_BLACK(x) ? "Black" : "Red", - x); - (*print_node)(x); - erts_fprintf(filep, "]\n"); - ERTS_RBT_FUNC__(debug_print)(filep, ERTS_RBT_GET_LEFT(x), - indent+2, print_node); - } -} - -#endif /* ERTS_RBT_WANT_DEBUG_PRINT */ - -#ifdef ERTS_RBT_NEED_HDBG_CHECK_TREE__ - -static void -ERTS_RBT_FUNC__(hdbg_check_tree)(ERTS_RBT_T *root) -{ - int black_depth = -1, no_black = 0; - ERTS_RBT_T *c, *p, *x = root; - ERTS_RBT_KEY_T kx; - ERTS_RBT_KEY_T kc; - - if (!x) - return; - - ERTS_RBT_ASSERT(!ERTS_RBT_GET_PARENT(x)); - - while (1) { - - while (1) { - - while (1) { - - if (ERTS_RBT_IS_BLACK(x)) - no_black++; - else { - c = ERTS_RBT_GET_RIGHT(x); - ERTS_RBT_ASSERT(!c || ERTS_RBT_IS_BLACK(c)); - c = ERTS_RBT_GET_LEFT(x); - ERTS_RBT_ASSERT(!c || ERTS_RBT_IS_BLACK(c)); - } - - c = ERTS_RBT_GET_LEFT(x); - if (!c) - break; - - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_PARENT(c)); - - kx = ERTS_RBT_GET_KEY(x); - kc = ERTS_RBT_GET_KEY(c); - - ERTS_RBT_ASSERT(ERTS_RBT_IS_LT(kc, kx) - || ERTS_RBT_IS_EQ(kc, kx)); - - x = c; - } - - c = ERTS_RBT_GET_RIGHT(x); - if (!c) { - if (black_depth < 0) - black_depth = no_black; - ERTS_RBT_ASSERT(black_depth == no_black); - break; - } - - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_PARENT(c)); - - kx = ERTS_RBT_GET_KEY(x); - kc = ERTS_RBT_GET_KEY(c); - - ERTS_RBT_ASSERT(ERTS_RBT_IS_LT(kx, kc) - || ERTS_RBT_IS_EQ(kx, kc)); - x = c; - } - - while (1) { - p = ERTS_RBT_GET_PARENT(x); - - if (ERTS_RBT_IS_BLACK(x)) - no_black--; - - if (p) { - - ERTS_RBT_ASSERT(x == ERTS_RBT_GET_LEFT(p) - || x == ERTS_RBT_GET_RIGHT(p)); - - c = ERTS_RBT_GET_RIGHT(p); - if (c && c != x) { - ERTS_RBT_ASSERT(ERTS_RBT_GET_LEFT(p) == x); - - kx = ERTS_RBT_GET_KEY(x); - kc = ERTS_RBT_GET_KEY(c); - - ERTS_RBT_ASSERT(ERTS_RBT_IS_LT(kx, kc) - || ERTS_RBT_IS_EQ(kx, kc)); - /* Go down tree of x's sibling... */ - x = c; - break; - } - } - - if (!p) { - ERTS_RBT_ASSERT(root == x); - ERTS_RBT_ASSERT(no_black == 0); - return; /* Done */ - } - - x = p; - } - } -} - -#undef ERTS_RBT_PRINT_TREE__ - -#endif /* ERTS_RBT_NEED_HDBG_CHECK_TREE__ */ - -#undef ERTS_RBT_ASSERT -#undef ERTS_RBT_DEBUG -#undef ERTS_RBT_API_INLINE__ -#undef ERTS_RBT_YIELD_STATE_T__ -#undef ERTS_RBT_NEED_REPLACE__ -#undef ERTS_RBT_NEED_INSERT__ -#undef ERTS_RBT_NEED_ROTATE__ -#undef ERTS_RBT_NEED_FOREACH_UNORDERED__ -#undef ERTS_RBT_NEED_FOREACH_ORDERED__ -#undef ERTS_RBT_NEED_HDBG_CHECK_TREE__ -#undef ERTS_RBT_HDBG_CHECK_TREE__ - -#ifdef ERTS_RBT_UNDEF -# undef ERTS_RBT_PREFIX -# undef ERTS_RBT_T -# undef ERTS_RBT_KEY_T -# undef ERTS_RBT_FLAGS_T -# undef ERTS_RBT_INIT_EMPTY_TNODE -# undef ERTS_RBT_IS_RED -# undef ERTS_RBT_SET_RED -# undef ERTS_RBT_IS_BLACK -# undef ERTS_RBT_SET_BLACK -# undef ERTS_RBT_GET_FLAGS -# undef ERTS_RBT_SET_FLAGS -# undef ERTS_RBT_GET_PARENT -# undef ERTS_RBT_SET_PARENT -# undef ERTS_RBT_GET_RIGHT -# undef ERTS_RBT_SET_RIGHT -# undef ERTS_RBT_GET_LEFT -# undef ERTS_RBT_SET_LEFT -# undef ERTS_RBT_GET_KEY -# undef ERTS_RBT_IS_LT -# undef ERTS_RBT_IS_EQ -# undef ERTS_RBT_UNDEF -# undef ERTS_RBT_NO_API_INLINE -# undef ERTS_RBT_UPDATE_ATTACHED_DATA_ROTATE -# undef ERTS_RBT_UPDATE_ATTACHED_DATA_DMOD -# undef ERTS_RBT_UPDATE_ATTACHED_DATA_CHGROOT -# undef ERTS_RBT_WANT_DELETE -# undef ERTS_RBT_WANT_INSERT -# undef ERTS_RBT_WANT_LOOKUP_INSERT -# undef ERTS_RBT_WANT_REPLACE -# undef ERTS_RBT_WANT_LOOKUP -# undef ERTS_RBT_WANT_SMALLEST -# undef ERTS_RBT_WANT_LARGEST -# undef ERTS_RBT_WANT_FOREACH -# undef ERTS_RBT_WANT_FOREACH_DESTROY -# undef ERTS_RBT_WANT_FOREACH_YIELDING -# undef ERTS_RBT_WANT_FOREACH_DESTROY_YIELDING -# undef ERTS_RBT_WANT_FOREACH_SMALL -# undef ERTS_RBT_WANT_FOREACH_LARGE -# undef ERTS_RBT_WANT_FOREACH_SMALL_DESTROY -# undef ERTS_RBT_WANT_FOREACH_LARGE_DESTROY -# undef ERTS_RBT_WANT_FOREACH_SMALL_YIELDING -# undef ERTS_RBT_WANT_FOREACH_LARGE_YIELDING -# undef ERTS_RBT_WANT_FOREACH_SMALL_DESTROY_YIELDING -# undef ERTS_RBT_WANT_FOREACH_LARGE_DESTROY_YIELDING -# undef ERTS_RBT_WANT_DEBUG_PRINT -#endif diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_sched_spec_pre_alloc.c erlang-17.3-dfsg/erts/emulator/beam/erl_sched_spec_pre_alloc.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_sched_spec_pre_alloc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_sched_spec_pre_alloc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_sched_spec_pre_alloc.h erlang-17.3-dfsg/erts/emulator/beam/erl_sched_spec_pre_alloc.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_sched_spec_pre_alloc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_sched_spec_pre_alloc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_smp.h erlang-17.3-dfsg/erts/emulator/beam/erl_smp.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_smp.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_smp.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -61,7 +60,6 @@ #define erts_smp_dw_atomic_t erts_dw_atomic_t #define erts_smp_atomic_t erts_atomic_t #define erts_smp_atomic32_t erts_atomic32_t -#define erts_smp_atomic64_t erts_atomic64_t typedef erts_spinlock_t erts_smp_spinlock_t; typedef erts_rwlock_t erts_smp_rwlock_t; void erts_thr_fatal_error(int, char *); /* implemented in erl_init.c */ @@ -97,7 +95,6 @@ #define erts_smp_dw_atomic_t erts_no_dw_atomic_t #define erts_smp_atomic_t erts_no_atomic_t #define erts_smp_atomic32_t erts_no_atomic32_t -#define erts_smp_atomic64_t erts_no_atomic64_t #if __GNUC__ > 2 typedef struct { } erts_smp_spinlock_t; typedef struct { } erts_smp_rwlock_t; @@ -492,116 +489,6 @@ #define erts_smp_atomic32_set_dirty erts_atomic32_set_dirty #define erts_smp_atomic32_read_dirty erts_atomic32_read_dirty -/* 64-bit atomics */ - -#define erts_smp_atomic64_init_nob erts_atomic64_init_nob -#define erts_smp_atomic64_set_nob erts_atomic64_set_nob -#define erts_smp_atomic64_read_nob erts_atomic64_read_nob -#define erts_smp_atomic64_inc_read_nob erts_atomic64_inc_read_nob -#define erts_smp_atomic64_dec_read_nob erts_atomic64_dec_read_nob -#define erts_smp_atomic64_inc_nob erts_atomic64_inc_nob -#define erts_smp_atomic64_dec_nob erts_atomic64_dec_nob -#define erts_smp_atomic64_add_read_nob erts_atomic64_add_read_nob -#define erts_smp_atomic64_add_nob erts_atomic64_add_nob -#define erts_smp_atomic64_read_bor_nob erts_atomic64_read_bor_nob -#define erts_smp_atomic64_read_band_nob erts_atomic64_read_band_nob -#define erts_smp_atomic64_xchg_nob erts_atomic64_xchg_nob -#define erts_smp_atomic64_cmpxchg_nob erts_atomic64_cmpxchg_nob -#define erts_smp_atomic64_read_bset_nob erts_atomic64_read_bset_nob - -#define erts_smp_atomic64_init_mb erts_atomic64_init_mb -#define erts_smp_atomic64_set_mb erts_atomic64_set_mb -#define erts_smp_atomic64_read_mb erts_atomic64_read_mb -#define erts_smp_atomic64_inc_read_mb erts_atomic64_inc_read_mb -#define erts_smp_atomic64_dec_read_mb erts_atomic64_dec_read_mb -#define erts_smp_atomic64_inc_mb erts_atomic64_inc_mb -#define erts_smp_atomic64_dec_mb erts_atomic64_dec_mb -#define erts_smp_atomic64_add_read_mb erts_atomic64_add_read_mb -#define erts_smp_atomic64_add_mb erts_atomic64_add_mb -#define erts_smp_atomic64_read_bor_mb erts_atomic64_read_bor_mb -#define erts_smp_atomic64_read_band_mb erts_atomic64_read_band_mb -#define erts_smp_atomic64_xchg_mb erts_atomic64_xchg_mb -#define erts_smp_atomic64_cmpxchg_mb erts_atomic64_cmpxchg_mb -#define erts_smp_atomic64_read_bset_mb erts_atomic64_read_bset_mb - -#define erts_smp_atomic64_init_acqb erts_atomic64_init_acqb -#define erts_smp_atomic64_set_acqb erts_atomic64_set_acqb -#define erts_smp_atomic64_read_acqb erts_atomic64_read_acqb -#define erts_smp_atomic64_inc_read_acqb erts_atomic64_inc_read_acqb -#define erts_smp_atomic64_dec_read_acqb erts_atomic64_dec_read_acqb -#define erts_smp_atomic64_inc_acqb erts_atomic64_inc_acqb -#define erts_smp_atomic64_dec_acqb erts_atomic64_dec_acqb -#define erts_smp_atomic64_add_read_acqb erts_atomic64_add_read_acqb -#define erts_smp_atomic64_add_acqb erts_atomic64_add_acqb -#define erts_smp_atomic64_read_bor_acqb erts_atomic64_read_bor_acqb -#define erts_smp_atomic64_read_band_acqb erts_atomic64_read_band_acqb -#define erts_smp_atomic64_xchg_acqb erts_atomic64_xchg_acqb -#define erts_smp_atomic64_cmpxchg_acqb erts_atomic64_cmpxchg_acqb -#define erts_smp_atomic64_read_bset_acqb erts_atomic64_read_bset_acqb - -#define erts_smp_atomic64_init_relb erts_atomic64_init_relb -#define erts_smp_atomic64_set_relb erts_atomic64_set_relb -#define erts_smp_atomic64_read_relb erts_atomic64_read_relb -#define erts_smp_atomic64_inc_read_relb erts_atomic64_inc_read_relb -#define erts_smp_atomic64_dec_read_relb erts_atomic64_dec_read_relb -#define erts_smp_atomic64_inc_relb erts_atomic64_inc_relb -#define erts_smp_atomic64_dec_relb erts_atomic64_dec_relb -#define erts_smp_atomic64_add_read_relb erts_atomic64_add_read_relb -#define erts_smp_atomic64_add_relb erts_atomic64_add_relb -#define erts_smp_atomic64_read_bor_relb erts_atomic64_read_bor_relb -#define erts_smp_atomic64_read_band_relb erts_atomic64_read_band_relb -#define erts_smp_atomic64_xchg_relb erts_atomic64_xchg_relb -#define erts_smp_atomic64_cmpxchg_relb erts_atomic64_cmpxchg_relb -#define erts_smp_atomic64_read_bset_relb erts_atomic64_read_bset_relb - -#define erts_smp_atomic64_init_ddrb erts_atomic64_init_ddrb -#define erts_smp_atomic64_set_ddrb erts_atomic64_set_ddrb -#define erts_smp_atomic64_read_ddrb erts_atomic64_read_ddrb -#define erts_smp_atomic64_inc_read_ddrb erts_atomic64_inc_read_ddrb -#define erts_smp_atomic64_dec_read_ddrb erts_atomic64_dec_read_ddrb -#define erts_smp_atomic64_inc_ddrb erts_atomic64_inc_ddrb -#define erts_smp_atomic64_dec_ddrb erts_atomic64_dec_ddrb -#define erts_smp_atomic64_add_read_ddrb erts_atomic64_add_read_ddrb -#define erts_smp_atomic64_add_ddrb erts_atomic64_add_ddrb -#define erts_smp_atomic64_read_bor_ddrb erts_atomic64_read_bor_ddrb -#define erts_smp_atomic64_read_band_ddrb erts_atomic64_read_band_ddrb -#define erts_smp_atomic64_xchg_ddrb erts_atomic64_xchg_ddrb -#define erts_smp_atomic64_cmpxchg_ddrb erts_atomic64_cmpxchg_ddrb -#define erts_smp_atomic64_read_bset_ddrb erts_atomic64_read_bset_ddrb - -#define erts_smp_atomic64_init_rb erts_atomic64_init_rb -#define erts_smp_atomic64_set_rb erts_atomic64_set_rb -#define erts_smp_atomic64_read_rb erts_atomic64_read_rb -#define erts_smp_atomic64_inc_read_rb erts_atomic64_inc_read_rb -#define erts_smp_atomic64_dec_read_rb erts_atomic64_dec_read_rb -#define erts_smp_atomic64_inc_rb erts_atomic64_inc_rb -#define erts_smp_atomic64_dec_rb erts_atomic64_dec_rb -#define erts_smp_atomic64_add_read_rb erts_atomic64_add_read_rb -#define erts_smp_atomic64_add_rb erts_atomic64_add_rb -#define erts_smp_atomic64_read_bor_rb erts_atomic64_read_bor_rb -#define erts_smp_atomic64_read_band_rb erts_atomic64_read_band_rb -#define erts_smp_atomic64_xchg_rb erts_atomic64_xchg_rb -#define erts_smp_atomic64_cmpxchg_rb erts_atomic64_cmpxchg_rb -#define erts_smp_atomic64_read_bset_rb erts_atomic64_read_bset_rb - -#define erts_smp_atomic64_init_wb erts_atomic64_init_wb -#define erts_smp_atomic64_set_wb erts_atomic64_set_wb -#define erts_smp_atomic64_read_wb erts_atomic64_read_wb -#define erts_smp_atomic64_inc_read_wb erts_atomic64_inc_read_wb -#define erts_smp_atomic64_dec_read_wb erts_atomic64_dec_read_wb -#define erts_smp_atomic64_inc_wb erts_atomic64_inc_wb -#define erts_smp_atomic64_dec_wb erts_atomic64_dec_wb -#define erts_smp_atomic64_add_read_wb erts_atomic64_add_read_wb -#define erts_smp_atomic64_add_wb erts_atomic64_add_wb -#define erts_smp_atomic64_read_bor_wb erts_atomic64_read_bor_wb -#define erts_smp_atomic64_read_band_wb erts_atomic64_read_band_wb -#define erts_smp_atomic64_xchg_wb erts_atomic64_xchg_wb -#define erts_smp_atomic64_cmpxchg_wb erts_atomic64_cmpxchg_wb -#define erts_smp_atomic64_read_bset_wb erts_atomic64_read_bset_wb - -#define erts_smp_atomic64_set_dirty erts_atomic64_set_dirty -#define erts_smp_atomic64_read_dirty erts_atomic64_read_dirty - #else /* !ERTS_SMP */ /* Double word size atomics */ @@ -864,116 +751,6 @@ #define erts_smp_atomic32_set_dirty erts_no_atomic32_set #define erts_smp_atomic32_read_dirty erts_no_atomic32_read -/* 64-bit atomics */ - -#define erts_smp_atomic64_init_nob erts_no_atomic64_set -#define erts_smp_atomic64_set_nob erts_no_atomic64_set -#define erts_smp_atomic64_read_nob erts_no_atomic64_read -#define erts_smp_atomic64_inc_read_nob erts_no_atomic64_inc_read -#define erts_smp_atomic64_dec_read_nob erts_no_atomic64_dec_read -#define erts_smp_atomic64_inc_nob erts_no_atomic64_inc -#define erts_smp_atomic64_dec_nob erts_no_atomic64_dec -#define erts_smp_atomic64_add_read_nob erts_no_atomic64_add_read -#define erts_smp_atomic64_add_nob erts_no_atomic64_add -#define erts_smp_atomic64_read_bor_nob erts_no_atomic64_read_bor -#define erts_smp_atomic64_read_band_nob erts_no_atomic64_read_band -#define erts_smp_atomic64_xchg_nob erts_no_atomic64_xchg -#define erts_smp_atomic64_cmpxchg_nob erts_no_atomic64_cmpxchg -#define erts_smp_atomic64_read_bset_nob erts_no_atomic64_read_bset - -#define erts_smp_atomic64_init_mb erts_no_atomic64_set -#define erts_smp_atomic64_set_mb erts_no_atomic64_set -#define erts_smp_atomic64_read_mb erts_no_atomic64_read -#define erts_smp_atomic64_inc_read_mb erts_no_atomic64_inc_read -#define erts_smp_atomic64_dec_read_mb erts_no_atomic64_dec_read -#define erts_smp_atomic64_inc_mb erts_no_atomic64_inc -#define erts_smp_atomic64_dec_mb erts_no_atomic64_dec -#define erts_smp_atomic64_add_read_mb erts_no_atomic64_add_read -#define erts_smp_atomic64_add_mb erts_no_atomic64_add -#define erts_smp_atomic64_read_bor_mb erts_no_atomic64_read_bor -#define erts_smp_atomic64_read_band_mb erts_no_atomic64_read_band -#define erts_smp_atomic64_xchg_mb erts_no_atomic64_xchg -#define erts_smp_atomic64_cmpxchg_mb erts_no_atomic64_cmpxchg -#define erts_smp_atomic64_read_bset_mb erts_no_atomic64_read_bset - -#define erts_smp_atomic64_init_acqb erts_no_atomic64_set -#define erts_smp_atomic64_set_acqb erts_no_atomic64_set -#define erts_smp_atomic64_read_acqb erts_no_atomic64_read -#define erts_smp_atomic64_inc_read_acqb erts_no_atomic64_inc_read -#define erts_smp_atomic64_dec_read_acqb erts_no_atomic64_dec_read -#define erts_smp_atomic64_inc_acqb erts_no_atomic64_inc -#define erts_smp_atomic64_dec_acqb erts_no_atomic64_dec -#define erts_smp_atomic64_add_read_acqb erts_no_atomic64_add_read -#define erts_smp_atomic64_add_acqb erts_no_atomic64_add -#define erts_smp_atomic64_read_bor_acqb erts_no_atomic64_read_bor -#define erts_smp_atomic64_read_band_acqb erts_no_atomic64_read_band -#define erts_smp_atomic64_xchg_acqb erts_no_atomic64_xchg -#define erts_smp_atomic64_cmpxchg_acqb erts_no_atomic64_cmpxchg -#define erts_smp_atomic64_read_bset_acqb erts_no_atomic64_read_bset - -#define erts_smp_atomic64_init_relb erts_no_atomic64_set -#define erts_smp_atomic64_set_relb erts_no_atomic64_set -#define erts_smp_atomic64_read_relb erts_no_atomic64_read -#define erts_smp_atomic64_inc_read_relb erts_no_atomic64_inc_read -#define erts_smp_atomic64_dec_read_relb erts_no_atomic64_dec_read -#define erts_smp_atomic64_inc_relb erts_no_atomic64_inc -#define erts_smp_atomic64_dec_relb erts_no_atomic64_dec -#define erts_smp_atomic64_add_read_relb erts_no_atomic64_add_read -#define erts_smp_atomic64_add_relb erts_no_atomic64_add -#define erts_smp_atomic64_read_bor_relb erts_no_atomic64_read_bor -#define erts_smp_atomic64_read_band_relb erts_no_atomic64_read_band -#define erts_smp_atomic64_xchg_relb erts_no_atomic64_xchg -#define erts_smp_atomic64_cmpxchg_relb erts_no_atomic64_cmpxchg -#define erts_smp_atomic64_read_bset_relb erts_no_atomic64_read_bset - -#define erts_smp_atomic64_init_ddrb erts_no_atomic64_set -#define erts_smp_atomic64_set_ddrb erts_no_atomic64_set -#define erts_smp_atomic64_read_ddrb erts_no_atomic64_read -#define erts_smp_atomic64_inc_read_ddrb erts_no_atomic64_inc_read -#define erts_smp_atomic64_dec_read_ddrb erts_no_atomic64_dec_read -#define erts_smp_atomic64_inc_ddrb erts_no_atomic64_inc -#define erts_smp_atomic64_dec_ddrb erts_no_atomic64_dec -#define erts_smp_atomic64_add_read_ddrb erts_no_atomic64_add_read -#define erts_smp_atomic64_add_ddrb erts_no_atomic64_add -#define erts_smp_atomic64_read_bor_ddrb erts_no_atomic64_read_bor -#define erts_smp_atomic64_read_band_ddrb erts_no_atomic64_read_band -#define erts_smp_atomic64_xchg_ddrb erts_no_atomic64_xchg -#define erts_smp_atomic64_cmpxchg_ddrb erts_no_atomic64_cmpxchg -#define erts_smp_atomic64_read_bset_ddrb erts_no_atomic64_read_bset - -#define erts_smp_atomic64_init_rb erts_no_atomic64_set -#define erts_smp_atomic64_set_rb erts_no_atomic64_set -#define erts_smp_atomic64_read_rb erts_no_atomic64_read -#define erts_smp_atomic64_inc_read_rb erts_no_atomic64_inc_read -#define erts_smp_atomic64_dec_read_rb erts_no_atomic64_dec_read -#define erts_smp_atomic64_inc_rb erts_no_atomic64_inc -#define erts_smp_atomic64_dec_rb erts_no_atomic64_dec -#define erts_smp_atomic64_add_read_rb erts_no_atomic64_add_read -#define erts_smp_atomic64_add_rb erts_no_atomic64_add -#define erts_smp_atomic64_read_bor_rb erts_no_atomic64_read_bor -#define erts_smp_atomic64_read_band_rb erts_no_atomic64_read_band -#define erts_smp_atomic64_xchg_rb erts_no_atomic64_xchg -#define erts_smp_atomic64_cmpxchg_rb erts_no_atomic64_cmpxchg -#define erts_smp_atomic64_read_bset_rb erts_no_atomic64_read_bset - -#define erts_smp_atomic64_init_wb erts_no_atomic64_set -#define erts_smp_atomic64_set_wb erts_no_atomic64_set -#define erts_smp_atomic64_read_wb erts_no_atomic64_read -#define erts_smp_atomic64_inc_read_wb erts_no_atomic64_inc_read -#define erts_smp_atomic64_dec_read_wb erts_no_atomic64_dec_read -#define erts_smp_atomic64_inc_wb erts_no_atomic64_inc -#define erts_smp_atomic64_dec_wb erts_no_atomic64_dec -#define erts_smp_atomic64_add_read_wb erts_no_atomic64_add_read -#define erts_smp_atomic64_add_wb erts_no_atomic64_add -#define erts_smp_atomic64_read_bor_wb erts_no_atomic64_read_bor -#define erts_smp_atomic64_read_band_wb erts_no_atomic64_read_band -#define erts_smp_atomic64_xchg_wb erts_no_atomic64_xchg -#define erts_smp_atomic64_cmpxchg_wb erts_no_atomic64_cmpxchg -#define erts_smp_atomic64_read_bset_wb erts_no_atomic64_read_bset - -#define erts_smp_atomic64_set_dirty erts_no_atomic64_set -#define erts_smp_atomic64_read_dirty erts_no_atomic64_read - #endif /* !ERTS_SMP */ #if ERTS_GLB_INLINE_INCL_FUNC_DEF diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_sock.h erlang-17.3-dfsg/erts/emulator/beam/erl_sock.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_sock.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_sock.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_sys_driver.h erlang-17.3-dfsg/erts/emulator/beam/erl_sys_driver.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_sys_driver.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_sys_driver.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_term.c erlang-17.3-dfsg/erts/emulator/beam/erl_term.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_term.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_term.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -87,13 +86,11 @@ case (_TAG_HEADER_EXTERNAL_PID >> _TAG_PRIMARY_SIZE): return EXTERNAL_PID_DEF; case (_TAG_HEADER_EXTERNAL_PORT >> _TAG_PRIMARY_SIZE): return EXTERNAL_PORT_DEF; case (_TAG_HEADER_EXTERNAL_REF >> _TAG_PRIMARY_SIZE): return EXTERNAL_REF_DEF; - case (_TAG_HEADER_MAP >> _TAG_PRIMARY_SIZE): return MAP_DEF; case (_TAG_HEADER_REFC_BIN >> _TAG_PRIMARY_SIZE): return BINARY_DEF; case (_TAG_HEADER_HEAP_BIN >> _TAG_PRIMARY_SIZE): return BINARY_DEF; case (_TAG_HEADER_SUB_BIN >> _TAG_PRIMARY_SIZE): return BINARY_DEF; - case (_TAG_HEADER_BIN_MATCHSTATE >> _TAG_PRIMARY_SIZE): return MATCHSTATE_DEF; + case (_TAG_HEADER_MAP >> _TAG_PRIMARY_SIZE): return MAP_DEF; } - break; } case TAG_PRIMARY_IMMED1: { @@ -130,10 +127,10 @@ return _unchecked_##FUN(x); \ } -ET_DEFINE_CHECKED(Eterm,make_boxed,const Eterm*,_is_taggable_pointer); +ET_DEFINE_CHECKED(Eterm,make_boxed,Eterm*,_is_taggable_pointer); ET_DEFINE_CHECKED(int,is_boxed,Eterm,!is_header); ET_DEFINE_CHECKED(Eterm*,boxed_val,Wterm,_boxed_precond); -ET_DEFINE_CHECKED(Eterm,make_list,const Eterm*,_is_taggable_pointer); +ET_DEFINE_CHECKED(Eterm,make_list,Eterm*,_is_taggable_pointer); ET_DEFINE_CHECKED(int,is_not_list,Eterm,!is_header); ET_DEFINE_CHECKED(Eterm*,list_val,Wterm,_list_precond); ET_DEFINE_CHECKED(Uint,unsigned_val,Eterm,is_small); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_term.h erlang-17.3-dfsg/erts/emulator/beam/erl_term.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_term.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_term.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -148,21 +147,21 @@ #define MAP_SUBTAG (0xF << _TAG_PRIMARY_SIZE) /* MAP */ -#define _TAG_HEADER_ARITYVAL (TAG_PRIMARY_HEADER|ARITYVAL_SUBTAG) -#define _TAG_HEADER_FUN (TAG_PRIMARY_HEADER|FUN_SUBTAG) -#define _TAG_HEADER_POS_BIG (TAG_PRIMARY_HEADER|POS_BIG_SUBTAG) -#define _TAG_HEADER_NEG_BIG (TAG_PRIMARY_HEADER|NEG_BIG_SUBTAG) -#define _TAG_HEADER_FLOAT (TAG_PRIMARY_HEADER|FLOAT_SUBTAG) -#define _TAG_HEADER_EXPORT (TAG_PRIMARY_HEADER|EXPORT_SUBTAG) -#define _TAG_HEADER_REF (TAG_PRIMARY_HEADER|REF_SUBTAG) -#define _TAG_HEADER_REFC_BIN (TAG_PRIMARY_HEADER|REFC_BINARY_SUBTAG) -#define _TAG_HEADER_HEAP_BIN (TAG_PRIMARY_HEADER|HEAP_BINARY_SUBTAG) -#define _TAG_HEADER_SUB_BIN (TAG_PRIMARY_HEADER|SUB_BINARY_SUBTAG) -#define _TAG_HEADER_EXTERNAL_PID (TAG_PRIMARY_HEADER|EXTERNAL_PID_SUBTAG) -#define _TAG_HEADER_EXTERNAL_PORT (TAG_PRIMARY_HEADER|EXTERNAL_PORT_SUBTAG) -#define _TAG_HEADER_EXTERNAL_REF (TAG_PRIMARY_HEADER|EXTERNAL_REF_SUBTAG) +#define _TAG_HEADER_ARITYVAL (TAG_PRIMARY_HEADER|ARITYVAL_SUBTAG) +#define _TAG_HEADER_FUN (TAG_PRIMARY_HEADER|FUN_SUBTAG) +#define _TAG_HEADER_POS_BIG (TAG_PRIMARY_HEADER|POS_BIG_SUBTAG) +#define _TAG_HEADER_NEG_BIG (TAG_PRIMARY_HEADER|NEG_BIG_SUBTAG) +#define _TAG_HEADER_FLOAT (TAG_PRIMARY_HEADER|FLOAT_SUBTAG) +#define _TAG_HEADER_EXPORT (TAG_PRIMARY_HEADER|EXPORT_SUBTAG) +#define _TAG_HEADER_REF (TAG_PRIMARY_HEADER|REF_SUBTAG) +#define _TAG_HEADER_REFC_BIN (TAG_PRIMARY_HEADER|REFC_BINARY_SUBTAG) +#define _TAG_HEADER_HEAP_BIN (TAG_PRIMARY_HEADER|HEAP_BINARY_SUBTAG) +#define _TAG_HEADER_SUB_BIN (TAG_PRIMARY_HEADER|SUB_BINARY_SUBTAG) +#define _TAG_HEADER_EXTERNAL_PID (TAG_PRIMARY_HEADER|EXTERNAL_PID_SUBTAG) +#define _TAG_HEADER_EXTERNAL_PORT (TAG_PRIMARY_HEADER|EXTERNAL_PORT_SUBTAG) +#define _TAG_HEADER_EXTERNAL_REF (TAG_PRIMARY_HEADER|EXTERNAL_REF_SUBTAG) #define _TAG_HEADER_BIN_MATCHSTATE (TAG_PRIMARY_HEADER|BIN_MATCHSTATE_SUBTAG) -#define _TAG_HEADER_MAP (TAG_PRIMARY_HEADER|MAP_SUBTAG) +#define _TAG_HEADER_MAP (TAG_PRIMARY_HEADER|MAP_SUBTAG) #define _TAG_HEADER_MASK 0x3F @@ -199,7 +198,7 @@ #endif #define _is_aligned(x) (((Uint)(x) & 0x3) == 0) #define _unchecked_make_boxed(x) ((Uint) COMPRESS_POINTER(x) + TAG_PRIMARY_BOXED) -_ET_DECLARE_CHECKED(Eterm,make_boxed,const Eterm*) +_ET_DECLARE_CHECKED(Eterm,make_boxed,Eterm*) #define make_boxed(x) _ET_APPLY(make_boxed,(x)) #if 1 #define _is_not_boxed(x) ((x) & (_TAG_PRIMARY_MASK-TAG_PRIMARY_BOXED)) @@ -215,7 +214,7 @@ /* cons cell ("list") access methods */ #define _unchecked_make_list(x) ((Uint) COMPRESS_POINTER(x) + TAG_PRIMARY_LIST) -_ET_DECLARE_CHECKED(Eterm,make_list,const Eterm*) +_ET_DECLARE_CHECKED(Eterm,make_list,Eterm*) #define make_list(x) _ET_APPLY(make_list,(x)) #if 1 #define _unchecked_is_not_list(x) ((x) & (_TAG_PRIMARY_MASK-TAG_PRIMARY_LIST)) @@ -297,10 +296,9 @@ #define atom_val(x) _ET_APPLY(atom_val,(x)) /* header (arityval or thing) access methods */ -#define _make_header(sz,tag) ((Uint)(((Uint)(sz) << _HEADER_ARITY_OFFS) + (tag))) +#define _make_header(sz,tag) ((Uint)(((sz) << _HEADER_ARITY_OFFS) + (tag))) #define is_header(x) (((x) & _TAG_PRIMARY_MASK) == TAG_PRIMARY_HEADER) -#define _unchecked_header_arity(x) \ - (is_map_header(x) ? MAP_HEADER_ARITY(x) : ((x) >> _HEADER_ARITY_OFFS)) +#define _unchecked_header_arity(x) ((x) >> _HEADER_ARITY_OFFS) _ET_DECLARE_CHECKED(Uint,header_arity,Eterm) #define header_arity(x) _ET_APPLY(header_arity,(x)) @@ -363,7 +361,6 @@ ((((x) & (_TAG_HEADER_MASK)) == _TAG_HEADER_REFC_BIN) || \ (((x) & (_TAG_HEADER_MASK)) == _TAG_HEADER_HEAP_BIN) || \ (((x) & (_TAG_HEADER_MASK)) == _TAG_HEADER_SUB_BIN)) - #define make_binary(x) make_boxed((Eterm*)(x)) #define is_binary(x) (is_boxed((x)) && is_binary_header(*boxed_val((x)))) #define is_not_binary(x) (!is_binary((x))) @@ -993,44 +990,6 @@ _ET_DECLARE_CHECKED(struct erl_node_*,external_ref_node,Eterm) #define external_ref_node(x) _ET_APPLY(external_ref_node,(x)) -/* maps */ - -#define MAP_HEADER_TAG_SZ (2) -#define MAP_HEADER_ARITY_SZ (8) -#define MAP_HEADER_VAL_SZ (16) - -#define MAP_HEADER_TAG_FLATMAP_HEAD (0x0) -#define MAP_HEADER_TAG_HAMT_NODE_BITMAP (0x1) -#define MAP_HEADER_TAG_HAMT_HEAD_ARRAY (0x2) -#define MAP_HEADER_TAG_HAMT_HEAD_BITMAP (0x3) - -#define MAP_HEADER_TYPE(Hdr) (((Hdr) >> (_HEADER_ARITY_OFFS)) & (0x3)) -#define MAP_HEADER_ARITY(Hdr) (((Hdr) >> (_HEADER_ARITY_OFFS + MAP_HEADER_TAG_SZ)) & (0xff)) -#define MAP_HEADER_VAL(Hdr) (((Hdr) >> (_HEADER_ARITY_OFFS + MAP_HEADER_TAG_SZ + MAP_HEADER_ARITY_SZ)) & (0xffff)) - -#define make_hashmap(x) make_boxed((Eterm*)(x)) -#define make_hashmap_rel make_boxed_rel -#define is_hashmap(x) (is_boxed((x)) && is_hashmap_header(*boxed_val((x)))) -#define is_not_hashmap(x) (!is_hashmap(x)) -#define is_hashmap_rel(RTERM,BASE) is_hashmap(rterm2wterm(RTERM,BASE)) -#define is_hashmap_header(x) (((x) & (_HEADER_MAP_HASHMAP_HEAD_MASK)) == HAMT_SUBTAG_HEAD_ARRAY) -#define hashmap_val(x) _unchecked_boxed_val((x)) -#define hashmap_val_rel(RTERM, BASE) hashmap_val(rterm2wterm(RTERM, BASE)) - -#define make_flatmap(x) make_boxed((Eterm*)(x)) -#define make_flatmap_rel(x, BASE) make_boxed_rel((Eterm*)(x),(BASE)) -#define is_flatmap(x) (is_boxed((x)) && is_flatmap_header(*boxed_val((x)))) -#define is_flatmap_rel(RTERM,BASE) is_flatmap(rterm2wterm(RTERM,BASE)) -#define is_not_flatmap(x) (!is_flatmap((x))) -#define is_flatmap_header(x) (((x) & (_HEADER_MAP_SUBTAG_MASK)) == HAMT_SUBTAG_HEAD_FLATMAP) -#define flatmap_val(x) (_unchecked_boxed_val((x))) -#define flatmap_val_rel(RTERM, BASE) flatmap_val(rterm2wterm(RTERM, BASE)) - -#define is_map_header(x) (((x) & (_TAG_HEADER_MASK)) == _TAG_HEADER_MAP) -#define is_map(x) (is_boxed((x)) && is_map_header(*boxed_val(x))) -#define is_not_map(x) (!is_map(x)) -#define is_map_rel(RTERM,BASE) is_map(rterm2wterm(RTERM,BASE)) - /* number tests */ #define is_integer(x) (is_small(x) || is_big(x)) @@ -1136,9 +1095,6 @@ #define FLOAT_DEF 0xe #define BIG_DEF 0xf #define SMALL_DEF 0x10 -#define MATCHSTATE_DEF 0x11 /* not a "real" term */ - -#define FIRST_VACANT_TAG_DEF 0x12 #if ET_DEBUG extern unsigned tag_val_def_debug(Wterm, const char*, unsigned); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_threads.h erlang-17.3-dfsg/erts/emulator/beam/erl_threads.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_threads.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_threads.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -345,16 +344,6 @@ #define erts_aint32_t ethr_sint32_t #define erts_atomic32_t ethr_atomic32_t -#if defined(ARCH_32) -# define erts_atomic64_t ethr_dw_atomic_t -# define erts_aint64_t ethr_sint64_t -#elif defined(ARCH_64) -# define erts_atomic64_t ethr_atomic_t -# define erts_aint64_t ethr_sint_t -#else -# error "Not supported architecture" -#endif - #define ERTS_DW_AINT_HIGH_WORD ETHR_DW_SINT_HIGH_WORD #define ERTS_DW_AINT_LOW_WORD ETHR_DW_SINT_LOW_WORD @@ -425,12 +414,10 @@ typedef struct { SWord sint[2]; } erts_dw_aint_t; typedef SWord erts_aint_t; typedef Sint32 erts_aint32_t; -typedef Sint64 erts_aint64_t; #define erts_dw_atomic_t erts_dw_aint_t #define erts_atomic_t erts_aint_t #define erts_atomic32_t erts_aint32_t -#define erts_atomic64_t erts_aint64_t #if __GNUC__ > 2 typedef struct { } erts_spinlock_t; @@ -459,7 +446,6 @@ #define erts_no_dw_atomic_t erts_dw_aint_t #define erts_no_atomic_t erts_aint_t #define erts_no_atomic32_t erts_aint32_t -#define erts_no_atomic64_t erts_aint64_t #define ERTS_AINT_NULL ((erts_aint_t) NULL) @@ -477,7 +463,6 @@ ERTS_GLB_INLINE void erts_thr_exit(void *res); ERTS_GLB_INLINE void erts_thr_install_exit_handler(void (*exit_handler)(void)); ERTS_GLB_INLINE erts_tid_t erts_thr_self(void); -ERTS_GLB_INLINE int erts_thr_getname(erts_tid_t tid, char *buf, size_t len); ERTS_GLB_INLINE int erts_equal_tids(erts_tid_t x, erts_tid_t y); ERTS_GLB_INLINE void erts_mtx_init_x(erts_mtx_t *mtx, char *name, Eterm extra, int enable_lcnt); @@ -585,29 +570,6 @@ ERTS_GLB_INLINE erts_aint32_t erts_no_atomic32_read_bset(erts_no_atomic32_t *var, erts_aint32_t mask, erts_aint32_t set); -ERTS_GLB_INLINE void erts_no_atomic64_set(erts_no_atomic64_t *var, - erts_aint64_t i); -ERTS_GLB_INLINE erts_aint64_t erts_no_atomic64_read(erts_no_atomic64_t *var); -ERTS_GLB_INLINE erts_aint64_t erts_no_atomic64_inc_read(erts_no_atomic64_t *incp); -ERTS_GLB_INLINE erts_aint64_t erts_no_atomic64_dec_read(erts_no_atomic64_t *decp); -ERTS_GLB_INLINE void erts_no_atomic64_inc(erts_no_atomic64_t *incp); -ERTS_GLB_INLINE void erts_no_atomic64_dec(erts_no_atomic64_t *decp); -ERTS_GLB_INLINE erts_aint64_t erts_no_atomic64_add_read(erts_no_atomic64_t *addp, - erts_aint64_t i); -ERTS_GLB_INLINE void erts_no_atomic64_add(erts_no_atomic64_t *addp, - erts_aint64_t i); -ERTS_GLB_INLINE erts_aint64_t erts_no_atomic64_read_bor(erts_no_atomic64_t *var, - erts_aint64_t mask); -ERTS_GLB_INLINE erts_aint64_t erts_no_atomic64_read_band(erts_no_atomic64_t *var, - erts_aint64_t mask); -ERTS_GLB_INLINE erts_aint64_t erts_no_atomic64_xchg(erts_no_atomic64_t *xchgp, - erts_aint64_t new); -ERTS_GLB_INLINE erts_aint64_t erts_no_atomic64_cmpxchg(erts_no_atomic64_t *xchgp, - erts_aint64_t new, - erts_aint64_t expected); -ERTS_GLB_INLINE erts_aint64_t erts_no_atomic64_read_bset(erts_no_atomic64_t *var, - erts_aint64_t mask, - erts_aint64_t set); ERTS_GLB_INLINE void erts_spinlock_init_x_opt(erts_spinlock_t *lock, char *name, @@ -649,29 +611,20 @@ ERTS_GLB_INLINE void * erts_tsd_get(erts_tsd_key_t key); ERTS_GLB_INLINE erts_tse_t *erts_tse_fetch(void); ERTS_GLB_INLINE void erts_tse_return(erts_tse_t *ep); -ERTS_GLB_INLINE void erts_tse_prepare_timed(erts_tse_t *ep); ERTS_GLB_INLINE void erts_tse_set(erts_tse_t *ep); ERTS_GLB_INLINE void erts_tse_reset(erts_tse_t *ep); ERTS_GLB_INLINE int erts_tse_wait(erts_tse_t *ep); ERTS_GLB_INLINE int erts_tse_swait(erts_tse_t *ep, int spincount); -ERTS_GLB_INLINE int erts_tse_twait(erts_tse_t *ep, Sint64 tmo); -ERTS_GLB_INLINE int erts_tse_stwait(erts_tse_t *ep, int spincount, Sint64 tmo); ERTS_GLB_INLINE int erts_tse_is_tmp(erts_tse_t *ep); ERTS_GLB_INLINE void erts_thr_set_main_status(int, int); ERTS_GLB_INLINE int erts_thr_get_main_status(void); ERTS_GLB_INLINE void erts_thr_yield(void); - #ifdef ETHR_HAVE_ETHR_SIG_FUNCS #define ERTS_THR_HAVE_SIG_FUNCS 1 ERTS_GLB_INLINE void erts_thr_sigmask(int how, const sigset_t *set, sigset_t *oset); ERTS_GLB_INLINE void erts_thr_sigwait(const sigset_t *set, int *sig); - -#ifdef USE_THREADS -ERTS_GLB_INLINE void erts_thr_kill(erts_tid_t tid, int sig); -#endif - #endif /* #ifdef HAVE_ETHR_SIG_FUNCS */ #ifdef USE_THREADS @@ -1247,441 +1200,6 @@ #endif -/* 64-bit atomics */ - -#if defined(ARCH_64) - -#define erts_atomic64_init_nob ethr_atomic_init -#define erts_atomic64_set_nob ethr_atomic_set -#define erts_atomic64_read_nob ethr_atomic_read -#define erts_atomic64_inc_read_nob ethr_atomic_inc_read -#define erts_atomic64_dec_read_nob ethr_atomic_dec_read -#define erts_atomic64_inc_nob ethr_atomic_inc -#define erts_atomic64_dec_nob ethr_atomic_dec -#define erts_atomic64_add_read_nob ethr_atomic_add_read -#define erts_atomic64_add_nob ethr_atomic_add -#define erts_atomic64_read_bor_nob ethr_atomic_read_bor -#define erts_atomic64_read_band_nob ethr_atomic_read_band -#define erts_atomic64_xchg_nob ethr_atomic_xchg -#define erts_atomic64_cmpxchg_nob ethr_atomic_cmpxchg -#define erts_atomic64_read_bset_nob erts_atomic_read_bset_nob - -#define erts_atomic64_init_mb ethr_atomic_init_mb -#define erts_atomic64_set_mb ethr_atomic_set_mb -#define erts_atomic64_read_mb ethr_atomic_read_mb -#define erts_atomic64_inc_read_mb ethr_atomic_inc_read_mb -#define erts_atomic64_dec_read_mb ethr_atomic_dec_read_mb -#define erts_atomic64_inc_mb ethr_atomic_inc_mb -#define erts_atomic64_dec_mb ethr_atomic_dec_mb -#define erts_atomic64_add_read_mb ethr_atomic_add_read_mb -#define erts_atomic64_add_mb ethr_atomic_add_mb -#define erts_atomic64_read_bor_mb ethr_atomic_read_bor_mb -#define erts_atomic64_read_band_mb ethr_atomic_read_band_mb -#define erts_atomic64_xchg_mb ethr_atomic_xchg_mb -#define erts_atomic64_cmpxchg_mb ethr_atomic_cmpxchg_mb -#define erts_atomic64_read_bset_mb erts_atomic_read_bset_mb - -#define erts_atomic64_init_acqb ethr_atomic_init_acqb -#define erts_atomic64_set_acqb ethr_atomic_set_acqb -#define erts_atomic64_read_acqb ethr_atomic_read_acqb -#define erts_atomic64_inc_read_acqb ethr_atomic_inc_read_acqb -#define erts_atomic64_dec_read_acqb ethr_atomic_dec_read_acqb -#define erts_atomic64_inc_acqb ethr_atomic_inc_acqb -#define erts_atomic64_dec_acqb ethr_atomic_dec_acqb -#define erts_atomic64_add_read_acqb ethr_atomic_add_read_acqb -#define erts_atomic64_add_acqb ethr_atomic_add_acqb -#define erts_atomic64_read_bor_acqb ethr_atomic_read_bor_acqb -#define erts_atomic64_read_band_acqb ethr_atomic_read_band_acqb -#define erts_atomic64_xchg_acqb ethr_atomic_xchg_acqb -#define erts_atomic64_cmpxchg_acqb ethr_atomic_cmpxchg_acqb -#define erts_atomic64_read_bset_acqb erts_atomic_read_bset_acqb - -#define erts_atomic64_init_relb ethr_atomic_init_relb -#define erts_atomic64_set_relb ethr_atomic_set_relb -#define erts_atomic64_read_relb ethr_atomic_read_relb -#define erts_atomic64_inc_read_relb ethr_atomic_inc_read_relb -#define erts_atomic64_dec_read_relb ethr_atomic_dec_read_relb -#define erts_atomic64_inc_relb ethr_atomic_inc_relb -#define erts_atomic64_dec_relb ethr_atomic_dec_relb -#define erts_atomic64_add_read_relb ethr_atomic_add_read_relb -#define erts_atomic64_add_relb ethr_atomic_add_relb -#define erts_atomic64_read_bor_relb ethr_atomic_read_bor_relb -#define erts_atomic64_read_band_relb ethr_atomic_read_band_relb -#define erts_atomic64_xchg_relb ethr_atomic_xchg_relb -#define erts_atomic64_cmpxchg_relb ethr_atomic_cmpxchg_relb -#define erts_atomic64_read_bset_relb erts_atomic_read_bset_relb - -#define erts_atomic64_init_ddrb ethr_atomic_init_ddrb -#define erts_atomic64_set_ddrb ethr_atomic_set_ddrb -#define erts_atomic64_read_ddrb ethr_atomic_read_ddrb -#define erts_atomic64_inc_read_ddrb ethr_atomic_inc_read_ddrb -#define erts_atomic64_dec_read_ddrb ethr_atomic_dec_read_ddrb -#define erts_atomic64_inc_ddrb ethr_atomic_inc_ddrb -#define erts_atomic64_dec_ddrb ethr_atomic_dec_ddrb -#define erts_atomic64_add_read_ddrb ethr_atomic_add_read_ddrb -#define erts_atomic64_add_ddrb ethr_atomic_add_ddrb -#define erts_atomic64_read_bor_ddrb ethr_atomic_read_bor_ddrb -#define erts_atomic64_read_band_ddrb ethr_atomic_read_band_ddrb -#define erts_atomic64_xchg_ddrb ethr_atomic_xchg_ddrb -#define erts_atomic64_cmpxchg_ddrb ethr_atomic_cmpxchg_ddrb -#define erts_atomic64_read_bset_ddrb erts_atomic_read_bset_ddrb - -#define erts_atomic64_init_rb ethr_atomic_init_rb -#define erts_atomic64_set_rb ethr_atomic_set_rb -#define erts_atomic64_read_rb ethr_atomic_read_rb -#define erts_atomic64_inc_read_rb ethr_atomic_inc_read_rb -#define erts_atomic64_dec_read_rb ethr_atomic_dec_read_rb -#define erts_atomic64_inc_rb ethr_atomic_inc_rb -#define erts_atomic64_dec_rb ethr_atomic_dec_rb -#define erts_atomic64_add_read_rb ethr_atomic_add_read_rb -#define erts_atomic64_add_rb ethr_atomic_add_rb -#define erts_atomic64_read_bor_rb ethr_atomic_read_bor_rb -#define erts_atomic64_read_band_rb ethr_atomic_read_band_rb -#define erts_atomic64_xchg_rb ethr_atomic_xchg_rb -#define erts_atomic64_cmpxchg_rb ethr_atomic_cmpxchg_rb -#define erts_atomic64_read_bset_rb erts_atomic_read_bset_rb - -#define erts_atomic64_init_wb ethr_atomic_init_wb -#define erts_atomic64_set_wb ethr_atomic_set_wb -#define erts_atomic64_read_wb ethr_atomic_read_wb -#define erts_atomic64_inc_read_wb ethr_atomic_inc_read_wb -#define erts_atomic64_dec_read_wb ethr_atomic_dec_read_wb -#define erts_atomic64_inc_wb ethr_atomic_inc_wb -#define erts_atomic64_dec_wb ethr_atomic_dec_wb -#define erts_atomic64_add_read_wb ethr_atomic_add_read_wb -#define erts_atomic64_add_wb ethr_atomic_add_wb -#define erts_atomic64_read_bor_wb ethr_atomic_read_bor_wb -#define erts_atomic64_read_band_wb ethr_atomic_read_band_wb -#define erts_atomic64_xchg_wb ethr_atomic_xchg_wb -#define erts_atomic64_cmpxchg_wb ethr_atomic_cmpxchg_wb -#define erts_atomic64_read_bset_wb erts_atomic_read_bset_wb - -#define erts_atomic64_set_dirty erts_atomic_set_dirty -#define erts_atomic64_read_dirty erts_atomic_read_dirty - -#elif defined(ARCH_32) - -#undef ERTS_ATOMIC64_OPS_DECL__ - -#define ERTS_ATOMIC64_OPS_DECL__(BARRIER) \ -ERTS_GLB_INLINE void \ -erts_atomic64_init_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val); \ -ERTS_GLB_INLINE void \ -erts_atomic64_set_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val); \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_read_ ## BARRIER(erts_atomic64_t *var); \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_inc_read_ ## BARRIER(erts_atomic64_t *var); \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_dec_read_ ## BARRIER(erts_atomic64_t *var); \ -ERTS_GLB_INLINE void \ -erts_atomic64_inc_ ## BARRIER(erts_atomic64_t *var); \ -ERTS_GLB_INLINE void \ -erts_atomic64_dec_ ## BARRIER(erts_atomic64_t *var); \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_add_read_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val); \ -ERTS_GLB_INLINE void \ -erts_atomic64_add_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val); \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_read_bor_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val); \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_read_band_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val); \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_xchg_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val); \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_cmpxchg_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t new, \ - erts_aint64_t exp); \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_read_bset_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t mask, \ - erts_aint64_t set) - -ERTS_ATOMIC64_OPS_DECL__(nob); -ERTS_ATOMIC64_OPS_DECL__(mb); -ERTS_ATOMIC64_OPS_DECL__(acqb); -ERTS_ATOMIC64_OPS_DECL__(relb); -ERTS_ATOMIC64_OPS_DECL__(ddrb); -ERTS_ATOMIC64_OPS_DECL__(rb); -ERTS_ATOMIC64_OPS_DECL__(wb); - -#undef ERTS_ATOMIC64_OPS_DECL__ - -ERTS_GLB_INLINE void -erts_atomic64_set_dirty(erts_atomic64_t *var, erts_aint64_t val); -ERTS_GLB_INLINE erts_aint64_t -erts_atomic64_read_dirty(erts_atomic64_t *var); - -#if ERTS_GLB_INLINE_INCL_FUNC_DEF - -/* - * The ethr_dw_atomic_*_nob() functions below - * are here to make it possible for the - * ERTS_ATOMIC64_OPS_IMPL__() to map erts - * barriers to ethread barriers... - */ -static ERTS_INLINE void -ethr_dw_atomic_init_nob(ethr_dw_atomic_t *var, - ethr_dw_sint_t *val) -{ - ethr_dw_atomic_init(var, val); -} - -static ERTS_INLINE void -ethr_dw_atomic_set_nob(ethr_dw_atomic_t *var, - ethr_dw_sint_t *val) -{ - ethr_dw_atomic_set(var, val); -} - -static ERTS_INLINE void -ethr_dw_atomic_read_nob(ethr_dw_atomic_t *var, - ethr_dw_sint_t *val) -{ - ethr_dw_atomic_read(var, val); -} - -static ERTS_INLINE int -ethr_dw_atomic_cmpxchg_nob(ethr_dw_atomic_t *var, - ethr_dw_sint_t *new, - ethr_dw_sint_t *xchg) -{ - return ethr_dw_atomic_cmpxchg(var, new, xchg); -} - -#undef ERTS_ATOMIC64_OPS_IMPL__ -#undef ERTS_ATOMIC64_DW_CMPXCHG_IMPL__ -#undef ERTS_DW_SINT_TO_AINT64__ -#undef ERTS_AINT64_TO_DW_SINT__ - -#ifdef ETHR_SU_DW_NAINT_T__ -#define ERTS_DW_SINT_TO_AINT64__(DW) \ - ((erts_aint64_t) DW.dw_sint) -#define ERTS_AINT64_TO_DW_SINT__(DW, AINT64) \ - (DW.dw_sint = (ETHR_SU_DW_NAINT_T__) AINT64) -#else /* !ETHR_SU_DW_NAINT_T__ */ -#define ERTS_DW_SINT_TO_AINT64__(DW) \ - ((((erts_aint64_t) DW.sint[ETHR_DW_SINT_HIGH_WORD]) << 32) \ - | (((erts_aint64_t) DW.sint[ETHR_DW_SINT_LOW_WORD]) \ - & ((erts_aint64_t) 0xffffffff))) -#define ERTS_AINT64_TO_DW_SINT__(DW, AINT64) \ - do { \ - DW.sint[ETHR_DW_SINT_LOW_WORD] = \ - (ethr_sint_t) (AINT64 & 0xffffffff); \ - DW.sint[ETHR_DW_SINT_HIGH_WORD] = \ - (ethr_sint_t) ((AINT64 >> 32) & 0xffffffff); \ - } while (0) -#endif /* !ETHR_SU_DW_NAINT_T__ */ - -#define ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(CmpXchgOp, \ - AVarP, XchgVar, NewVar, \ - ModificationCode) \ -do { \ - ethr_dw_sint_t dw_xchg__, dw_new__; \ - ethr_dw_atomic_read(AVarP, &dw_xchg__); \ - do { \ - XchgVar = ERTS_DW_SINT_TO_AINT64__(dw_xchg__); \ - { \ - ModificationCode; \ - } \ - ERTS_AINT64_TO_DW_SINT__(dw_new__, NewVar); \ - } while (!CmpXchgOp((AVarP), &dw_new__, &dw_xchg__)); \ -} while (0) - -#define ERTS_ATOMIC64_OPS_IMPL__(BARRIER) \ - \ -ERTS_GLB_INLINE void \ -erts_atomic64_init_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val) \ -{ \ - ethr_dw_sint_t dw; \ - ERTS_AINT64_TO_DW_SINT__(dw, val); \ - ethr_dw_atomic_init_ ## BARRIER(var, &dw); \ -} \ - \ -ERTS_GLB_INLINE void \ -erts_atomic64_set_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val) \ -{ \ - ethr_dw_sint_t dw; \ - ERTS_AINT64_TO_DW_SINT__(dw, val); \ - ethr_dw_atomic_set_ ## BARRIER(var, &dw); \ -} \ - \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_read_ ## BARRIER(erts_atomic64_t *var) \ -{ \ - ethr_dw_sint_t dw; \ - ethr_dw_atomic_read_ ## BARRIER(var, &dw); \ - return ERTS_DW_SINT_TO_AINT64__(dw); \ -} \ - \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_inc_read_ ## BARRIER(erts_atomic64_t *var) \ -{ \ - erts_aint64_t xchg, new; \ - ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg + 1); \ - return new; \ -} \ - \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_dec_read_ ## BARRIER(erts_atomic64_t *var) \ -{ \ - erts_aint64_t xchg, new; \ - ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg - 1); \ - return new; \ -} \ - \ -ERTS_GLB_INLINE void \ -erts_atomic64_inc_ ## BARRIER(erts_atomic64_t *var) \ -{ \ - erts_aint64_t xchg, new; \ - ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg + 1); \ -} \ - \ -ERTS_GLB_INLINE void \ -erts_atomic64_dec_ ## BARRIER(erts_atomic64_t *var) \ -{ \ - erts_aint64_t xchg, new; \ - ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg - 1); \ -} \ - \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_add_read_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val) \ -{ \ - erts_aint64_t xchg, new; \ - ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg + val); \ - return new; \ -} \ - \ -ERTS_GLB_INLINE void \ -erts_atomic64_add_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val) \ -{ \ - erts_aint64_t xchg, new; \ - ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg + val); \ -} \ - \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_read_bor_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val) \ -{ \ - erts_aint64_t xchg, new; \ - ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg | val); \ - return xchg; \ -} \ - \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_read_band_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val) \ -{ \ - erts_aint64_t xchg, new; \ - ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg & val); \ - return xchg; \ -} \ - \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_xchg_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t val) \ -{ \ - erts_aint64_t xchg, new; \ - ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = val); \ - return xchg; \ -} \ - \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_cmpxchg_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t new, \ - erts_aint64_t exp) \ -{ \ - ethr_dw_sint_t dw_xchg, dw_new; \ - ERTS_AINT64_TO_DW_SINT__(dw_xchg, exp); \ - ERTS_AINT64_TO_DW_SINT__(dw_new, new); \ - if (ethr_dw_atomic_cmpxchg_ ## BARRIER(var, &dw_new, &dw_xchg)) \ - return exp; \ - return ERTS_DW_SINT_TO_AINT64__(dw_xchg); \ -} \ - \ -ERTS_GLB_INLINE erts_aint64_t \ -erts_atomic64_read_bset_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t mask, \ - erts_aint64_t set) \ -{ \ - erts_aint64_t xchg, new; \ - ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - { \ - new = xchg & ~mask; \ - new |= mask & set; \ - }); \ - return xchg; \ -} - -ERTS_ATOMIC64_OPS_IMPL__(nob) -ERTS_ATOMIC64_OPS_IMPL__(mb) -ERTS_ATOMIC64_OPS_IMPL__(acqb) -ERTS_ATOMIC64_OPS_IMPL__(relb) -ERTS_ATOMIC64_OPS_IMPL__(ddrb) -ERTS_ATOMIC64_OPS_IMPL__(rb) -ERTS_ATOMIC64_OPS_IMPL__(wb) - -#undef ERTS_ATOMIC64_OPS_IMPL__ -#undef ERTS_ATOMIC64_DW_CMPXCHG_IMPL__ - -ERTS_GLB_INLINE void -erts_atomic64_set_dirty(erts_atomic64_t *var, erts_aint64_t val) -{ - ethr_sint_t *sint = ethr_dw_atomic_addr(var); - ethr_dw_sint_t dw; - ERTS_AINT64_TO_DW_SINT__(dw, val); - sint[0] = dw.sint[0]; - sint[1] = dw.sint[1]; -} - -ERTS_GLB_INLINE erts_aint64_t -erts_atomic64_read_dirty(erts_atomic64_t *var) -{ - ethr_sint_t *sint; - ethr_dw_sint_t dw; - sint = ethr_dw_atomic_addr(var); - dw.sint[0] = sint[0]; - dw.sint[1] = sint[1]; - return ERTS_DW_SINT_TO_AINT64__(dw); -} - -#undef ERTS_DW_SINT_TO_AINT64__ -#undef ERTS_AINT64_TO_DW_SINT__ - -#endif /* ERTS_GLB_INLINE_INCL_FUNC_DEF */ - -#endif /* ARCH_32 */ - #else /* !USE_THREADS */ /* Double word size atomics */ @@ -1944,116 +1462,6 @@ #define erts_atomic32_set_dirty erts_no_atomic32_set #define erts_atomic32_read_dirty erts_no_atomic32_read -/* 64-bit atomics */ - -#define erts_atomic64_init_nob erts_no_atomic64_set -#define erts_atomic64_set_nob erts_no_atomic64_set -#define erts_atomic64_read_nob erts_no_atomic64_read -#define erts_atomic64_inc_read_nob erts_no_atomic64_inc_read -#define erts_atomic64_dec_read_nob erts_no_atomic64_dec_read -#define erts_atomic64_inc_nob erts_no_atomic64_inc -#define erts_atomic64_dec_nob erts_no_atomic64_dec -#define erts_atomic64_add_read_nob erts_no_atomic64_add_read -#define erts_atomic64_add_nob erts_no_atomic64_add -#define erts_atomic64_read_bor_nob erts_no_atomic64_read_bor -#define erts_atomic64_read_band_nob erts_no_atomic64_read_band -#define erts_atomic64_xchg_nob erts_no_atomic64_xchg -#define erts_atomic64_cmpxchg_nob erts_no_atomic64_cmpxchg -#define erts_atomic64_read_bset_nob erts_no_atomic64_read_bset - -#define erts_atomic64_init_mb erts_no_atomic64_set -#define erts_atomic64_set_mb erts_no_atomic64_set -#define erts_atomic64_read_mb erts_no_atomic64_read -#define erts_atomic64_inc_read_mb erts_no_atomic64_inc_read -#define erts_atomic64_dec_read_mb erts_no_atomic64_dec_read -#define erts_atomic64_inc_mb erts_no_atomic64_inc -#define erts_atomic64_dec_mb erts_no_atomic64_dec -#define erts_atomic64_add_read_mb erts_no_atomic64_add_read -#define erts_atomic64_add_mb erts_no_atomic64_add -#define erts_atomic64_read_bor_mb erts_no_atomic64_read_bor -#define erts_atomic64_read_band_mb erts_no_atomic64_read_band -#define erts_atomic64_xchg_mb erts_no_atomic64_xchg -#define erts_atomic64_cmpxchg_mb erts_no_atomic64_cmpxchg -#define erts_atomic64_read_bset_mb erts_no_atomic64_read_bset - -#define erts_atomic64_init_acqb erts_no_atomic64_set -#define erts_atomic64_set_acqb erts_no_atomic64_set -#define erts_atomic64_read_acqb erts_no_atomic64_read -#define erts_atomic64_inc_read_acqb erts_no_atomic64_inc_read -#define erts_atomic64_dec_read_acqb erts_no_atomic64_dec_read -#define erts_atomic64_inc_acqb erts_no_atomic64_inc -#define erts_atomic64_dec_acqb erts_no_atomic64_dec -#define erts_atomic64_add_read_acqb erts_no_atomic64_add_read -#define erts_atomic64_add_acqb erts_no_atomic64_add -#define erts_atomic64_read_bor_acqb erts_no_atomic64_read_bor -#define erts_atomic64_read_band_acqb erts_no_atomic64_read_band -#define erts_atomic64_xchg_acqb erts_no_atomic64_xchg -#define erts_atomic64_cmpxchg_acqb erts_no_atomic64_cmpxchg -#define erts_atomic64_read_bset_acqb erts_no_atomic64_read_bset - -#define erts_atomic64_init_relb erts_no_atomic64_set -#define erts_atomic64_set_relb erts_no_atomic64_set -#define erts_atomic64_read_relb erts_no_atomic64_read -#define erts_atomic64_inc_read_relb erts_no_atomic64_inc_read -#define erts_atomic64_dec_read_relb erts_no_atomic64_dec_read -#define erts_atomic64_inc_relb erts_no_atomic64_inc -#define erts_atomic64_dec_relb erts_no_atomic64_dec -#define erts_atomic64_add_read_relb erts_no_atomic64_add_read -#define erts_atomic64_add_relb erts_no_atomic64_add -#define erts_atomic64_read_bor_relb erts_no_atomic64_read_bor -#define erts_atomic64_read_band_relb erts_no_atomic64_read_band -#define erts_atomic64_xchg_relb erts_no_atomic64_xchg -#define erts_atomic64_cmpxchg_relb erts_no_atomic64_cmpxchg -#define erts_atomic64_read_bset_relb erts_no_atomic64_read_bset - -#define erts_atomic64_init_ddrb erts_no_atomic64_set -#define erts_atomic64_set_ddrb erts_no_atomic64_set -#define erts_atomic64_read_ddrb erts_no_atomic64_read -#define erts_atomic64_inc_read_ddrb erts_no_atomic64_inc_read -#define erts_atomic64_dec_read_ddrb erts_no_atomic64_dec_read -#define erts_atomic64_inc_ddrb erts_no_atomic64_inc -#define erts_atomic64_dec_ddrb erts_no_atomic64_dec -#define erts_atomic64_add_read_ddrb erts_no_atomic64_add_read -#define erts_atomic64_add_ddrb erts_no_atomic64_add -#define erts_atomic64_read_bor_ddrb erts_no_atomic64_read_bor -#define erts_atomic64_read_band_ddrb erts_no_atomic64_read_band -#define erts_atomic64_xchg_ddrb erts_no_atomic64_xchg -#define erts_atomic64_cmpxchg_ddrb erts_no_atomic64_cmpxchg -#define erts_atomic64_read_bset_ddrb erts_no_atomic64_read_bset - -#define erts_atomic64_init_rb erts_no_atomic64_set -#define erts_atomic64_set_rb erts_no_atomic64_set -#define erts_atomic64_read_rb erts_no_atomic64_read -#define erts_atomic64_inc_read_rb erts_no_atomic64_inc_read -#define erts_atomic64_dec_read_rb erts_no_atomic64_dec_read -#define erts_atomic64_inc_rb erts_no_atomic64_inc -#define erts_atomic64_dec_rb erts_no_atomic64_dec -#define erts_atomic64_add_read_rb erts_no_atomic64_add_read -#define erts_atomic64_add_rb erts_no_atomic64_add -#define erts_atomic64_read_bor_rb erts_no_atomic64_read_bor -#define erts_atomic64_read_band_rb erts_no_atomic64_read_band -#define erts_atomic64_xchg_rb erts_no_atomic64_xchg -#define erts_atomic64_cmpxchg_rb erts_no_atomic64_cmpxchg -#define erts_atomic64_read_bset_rb erts_no_atomic64_read_bset - -#define erts_atomic64_init_wb erts_no_atomic64_set -#define erts_atomic64_set_wb erts_no_atomic64_set -#define erts_atomic64_read_wb erts_no_atomic64_read -#define erts_atomic64_inc_read_wb erts_no_atomic64_inc_read -#define erts_atomic64_dec_read_wb erts_no_atomic64_dec_read -#define erts_atomic64_inc_wb erts_no_atomic64_inc -#define erts_atomic64_dec_wb erts_no_atomic64_dec -#define erts_atomic64_add_read_wb erts_no_atomic64_add_read -#define erts_atomic64_add_wb erts_no_atomic64_add -#define erts_atomic64_read_bor_wb erts_no_atomic64_read_bor -#define erts_atomic64_read_band_wb erts_no_atomic64_read_band -#define erts_atomic64_xchg_wb erts_no_atomic64_xchg -#define erts_atomic64_cmpxchg_wb erts_no_atomic64_cmpxchg -#define erts_atomic64_read_bset_wb erts_no_atomic64_read_bset - -#define erts_atomic64_set_dirty erts_no_atomic64_set -#define erts_atomic64_read_dirty erts_no_atomic64_read - #endif /* !USE_THREADS */ #if ERTS_GLB_INLINE_INCL_FUNC_DEF @@ -2140,16 +1548,6 @@ #endif } -ERTS_GLB_INLINE int -erts_thr_getname(erts_tid_t tid, char *buf, size_t len) -{ -#ifdef USE_THREADS - return ethr_getname(tid, buf, len); -#else - return -1; -#endif -} - ERTS_GLB_INLINE int erts_equal_tids(erts_tid_t x, erts_tid_t y) @@ -2985,104 +2383,6 @@ return old; } -/* atomic64 */ - -ERTS_GLB_INLINE void -erts_no_atomic64_set(erts_no_atomic64_t *var, erts_aint64_t i) -{ - *var = i; -} - -ERTS_GLB_INLINE erts_aint64_t -erts_no_atomic64_read(erts_no_atomic64_t *var) -{ - return *var; -} - -ERTS_GLB_INLINE erts_aint64_t -erts_no_atomic64_inc_read(erts_no_atomic64_t *incp) -{ - return ++(*incp); -} - -ERTS_GLB_INLINE erts_aint64_t -erts_no_atomic64_dec_read(erts_no_atomic64_t *decp) -{ - return --(*decp); -} - -ERTS_GLB_INLINE void -erts_no_atomic64_inc(erts_no_atomic64_t *incp) -{ - ++(*incp); -} - -ERTS_GLB_INLINE void -erts_no_atomic64_dec(erts_no_atomic64_t *decp) -{ - --(*decp); -} - -ERTS_GLB_INLINE erts_aint64_t -erts_no_atomic64_add_read(erts_no_atomic64_t *addp, erts_aint64_t i) -{ - return *addp += i; -} - -ERTS_GLB_INLINE void -erts_no_atomic64_add(erts_no_atomic64_t *addp, erts_aint64_t i) -{ - *addp += i; -} - -ERTS_GLB_INLINE erts_aint64_t -erts_no_atomic64_read_bor(erts_no_atomic64_t *var, erts_aint64_t mask) -{ - erts_aint64_t old; - old = *var; - *var |= mask; - return old; -} - -ERTS_GLB_INLINE erts_aint64_t -erts_no_atomic64_read_band(erts_no_atomic64_t *var, erts_aint64_t mask) -{ - erts_aint64_t old; - old = *var; - *var &= mask; - return old; -} - -ERTS_GLB_INLINE erts_aint64_t -erts_no_atomic64_xchg(erts_no_atomic64_t *xchgp, erts_aint64_t new) -{ - erts_aint64_t old = *xchgp; - *xchgp = new; - return old; -} - -ERTS_GLB_INLINE erts_aint64_t -erts_no_atomic64_cmpxchg(erts_no_atomic64_t *xchgp, - erts_aint64_t new, - erts_aint64_t expected) -{ - erts_aint64_t old = *xchgp; - if (old == expected) - *xchgp = new; - return old; -} - -ERTS_GLB_INLINE erts_aint64_t -erts_no_atomic64_read_bset(erts_no_atomic64_t *var, - erts_aint64_t mask, - erts_aint64_t set) -{ - erts_aint64_t old = *var; - *var &= ~mask; - *var |= (mask & set); - return old; -} - /* spinlock */ ERTS_GLB_INLINE void @@ -3462,15 +2762,6 @@ #endif } -ERTS_GLB_INLINE void erts_tse_prepare_timed(erts_tse_t *ep) -{ -#ifdef USE_THREADS - int res = ethr_event_prepare_timed(&((ethr_ts_event *) ep)->event); - if (res != 0) - erts_thr_fatal_error(res, "prepare timed"); -#endif -} - ERTS_GLB_INLINE void erts_tse_set(erts_tse_t *ep) { #ifdef USE_THREADS @@ -3503,27 +2794,6 @@ #endif } -ERTS_GLB_INLINE int erts_tse_twait(erts_tse_t *ep, Sint64 tmo) -{ -#ifdef USE_THREADS - return ethr_event_twait(&((ethr_ts_event *) ep)->event, - (ethr_sint64_t) tmo); -#else - return ENOTSUP; -#endif -} - -ERTS_GLB_INLINE int erts_tse_stwait(erts_tse_t *ep, int spincount, Sint64 tmo) -{ -#ifdef USE_THREADS - return ethr_event_stwait(&((ethr_ts_event *) ep)->event, - spincount, - (ethr_sint64_t) tmo); -#else - return ENOTSUP; -#endif -} - ERTS_GLB_INLINE int erts_tse_is_tmp(erts_tse_t *ep) { #ifdef USE_THREADS @@ -3568,15 +2838,6 @@ #ifdef ETHR_HAVE_ETHR_SIG_FUNCS ERTS_GLB_INLINE void -erts_thr_kill(erts_tid_t tid, int sig) { -#ifdef USE_THREADS - int res = ethr_kill((ethr_tid)tid, sig); - if (res) - erts_thr_fatal_error(res, "killing thread"); -#endif -} - -ERTS_GLB_INLINE void erts_thr_sigmask(int how, const sigset_t *set, sigset_t *oset) { #ifdef USE_THREADS diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_thr_progress.c erlang-17.3-dfsg/erts/emulator/beam/erl_thr_progress.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_thr_progress.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_thr_progress.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -116,24 +115,70 @@ #undef read_nob #define read_nob erts_thr_prgr_read_nob__ +#ifdef ARCH_64 + +static ERTS_INLINE void +set_mb(ERTS_THR_PRGR_ATOMIC *atmc, ErtsThrPrgrVal val) +{ + erts_atomic_set_mb(atmc, val); +} + +static ERTS_INLINE void +set_nob(ERTS_THR_PRGR_ATOMIC *atmc, ErtsThrPrgrVal val) +{ + erts_atomic_set_nob(atmc, val); +} + +static ERTS_INLINE void +init_nob(ERTS_THR_PRGR_ATOMIC *atmc, ErtsThrPrgrVal val) +{ + erts_atomic_init_nob(atmc, val); +} + +#else + +#undef dw_aint_to_val +#define dw_aint_to_val erts_thr_prgr_dw_aint_to_val__ + +static void +val_to_dw_aint(erts_dw_aint_t *dw_aint, ErtsThrPrgrVal val) +{ +#ifdef ETHR_SU_DW_NAINT_T__ + dw_aint->dw_sint = (ETHR_SU_DW_NAINT_T__) val; +#else + dw_aint->sint[ERTS_DW_AINT_LOW_WORD] + = (erts_aint_t) (val & 0xffffffff); + dw_aint->sint[ERTS_DW_AINT_HIGH_WORD] + = (erts_aint_t) ((val >> 32) & 0xffffffff); +#endif +} + static ERTS_INLINE void set_mb(ERTS_THR_PRGR_ATOMIC *atmc, ErtsThrPrgrVal val) { - erts_atomic64_set_mb(atmc, (erts_aint64_t) val); + erts_dw_aint_t dw_aint; + val_to_dw_aint(&dw_aint, val); + erts_dw_atomic_set_mb(atmc, &dw_aint); } static ERTS_INLINE void set_nob(ERTS_THR_PRGR_ATOMIC *atmc, ErtsThrPrgrVal val) { - erts_atomic64_set_nob(atmc, (erts_aint64_t) val); + erts_dw_aint_t dw_aint; + val_to_dw_aint(&dw_aint, val); + erts_dw_atomic_set_nob(atmc, &dw_aint); } static ERTS_INLINE void init_nob(ERTS_THR_PRGR_ATOMIC *atmc, ErtsThrPrgrVal val) { - erts_atomic64_init_nob(atmc, (erts_aint64_t) val); + erts_dw_aint_t dw_aint; + val_to_dw_aint(&dw_aint, val); + erts_dw_atomic_init_nob(atmc, &dw_aint); } +#endif + /* #define ERTS_THR_PROGRESS_STATE_DEBUG */ #ifdef ERTS_THR_PROGRESS_STATE_DEBUG @@ -1336,10 +1381,25 @@ thr_progress_block(tmp_thr_prgr_data(NULL), 1); } -int -erts_thr_progress_fatal_error_block(ErtsThrPrgrData *tmp_tpd_bufp) +void +erts_thr_progress_fatal_error_block(SWord timeout, + ErtsThrPrgrData *tmp_tpd_bufp) { ErtsThrPrgrData *tpd = perhaps_thr_prgr_data(NULL); + erts_aint32_t bc; + SWord time_left = timeout; + SysTimeval to; + + /* + * Counting poll intervals may give us a too long timeout + * if cpu is busy. If we got tolerant time of day we use it + * to prevent this. + */ + if (!erts_disable_tolerant_timeofday) { + erts_get_timeval(&to); + to.tv_sec += timeout / 1000; + to.tv_sec += timeout % 1000; + } if (!tpd) { /* @@ -1352,25 +1412,9 @@ init_tmp_thr_prgr_data(tpd); } - /* Returns number of threads that have not yes been blocked */ - return thr_progress_block(tpd, 0); -} - -void -erts_thr_progress_fatal_error_wait(SWord timeout) { - erts_aint32_t bc; - SWord time_left = timeout; - ErtsMonotonicTime timeout_time; - ErtsSchedulerData *esdp = erts_get_scheduler_data(); - - /* - * Counting poll intervals may give us a too long timeout - * if cpu is busy. We use timeout time to try to prevent - * this. In case we havn't got time correction this may - * however fail too... - */ - timeout_time = erts_get_monotonic_time(esdp); - timeout_time += ERTS_MSEC_TO_MONOTONIC((ErtsMonotonicTime) timeout); + bc = thr_progress_block(tpd, 0); + if (bc == 0) + return; /* Succefully blocked all managed threads */ while (1) { if (erts_milli_sleep(ERTS_THR_PRGR_FTL_ERR_BLCK_POLL_INTERVAL) == 0) @@ -1380,8 +1424,14 @@ break; /* Succefully blocked all managed threads */ if (time_left <= 0) break; /* Timeout */ - if (timeout_time <= erts_get_monotonic_time(esdp)) - break; /* Timeout */ + if (!erts_disable_tolerant_timeofday) { + SysTimeval now; + erts_get_timeval(&now); + if (now.tv_sec > to.tv_sec) + break; /* Timeout */ + if (now.tv_sec == to.tv_sec && now.tv_usec >= to.tv_usec) + break; /* Timeout */ + } } } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_thr_progress.h erlang-17.3-dfsg/erts/emulator/beam/erl_thr_progress.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_thr_progress.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_thr_progress.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -84,8 +83,8 @@ ErtsThrPrgrLeaderState leader_state; } ErtsThrPrgrData; -int erts_thr_progress_fatal_error_block(ErtsThrPrgrData *tmp_tpd_bufp); -void erts_thr_progress_fatal_error_wait(SWord timeout); +void erts_thr_progress_fatal_error_block(SWord timeout, + ErtsThrPrgrData *tmp_tpd_bufp); #endif /* ERTS_SMP */ @@ -116,7 +115,11 @@ extern erts_tsd_key_t erts_thr_prgr_data_key__; -#define ERTS_THR_PRGR_ATOMIC erts_atomic64_t +#ifdef ARCH_64 +# define ERTS_THR_PRGR_ATOMIC erts_atomic_t +#else /* ARCH_32 */ +# define ERTS_THR_PRGR_ATOMIC erts_dw_atomic_t +#endif typedef struct { void *arg; @@ -155,6 +158,10 @@ void erts_thr_progress_dbg_print_state(void); +#ifdef ARCH_32 +#define ERTS_THR_PRGR_ATOMIC erts_dw_atomic_t +ERTS_GLB_INLINE ErtsThrPrgrVal erts_thr_prgr_dw_aint_to_val__(erts_dw_aint_t *dw_aint); +#endif ERTS_GLB_INLINE ErtsThrPrgrVal erts_thr_prgr_read_nob__(ERTS_THR_PRGR_ATOMIC *atmc); ERTS_GLB_INLINE ErtsThrPrgrVal erts_thr_prgr_read_acqb__(ERTS_THR_PRGR_ATOMIC *atmc); ERTS_GLB_INLINE ErtsThrPrgrVal erts_thr_prgr_read_mb__(ERTS_THR_PRGR_ATOMIC *atmc); @@ -177,24 +184,68 @@ #if ERTS_GLB_INLINE_INCL_FUNC_DEF +#ifdef ARCH_64 + +ERTS_GLB_INLINE ErtsThrPrgrVal +erts_thr_prgr_read_nob__(ERTS_THR_PRGR_ATOMIC *atmc) +{ + return (ErtsThrPrgrVal) erts_atomic_read_nob(atmc); +} + +ERTS_GLB_INLINE ErtsThrPrgrVal +erts_thr_prgr_read_acqb__(ERTS_THR_PRGR_ATOMIC *atmc) +{ + return (ErtsThrPrgrVal) erts_atomic_read_acqb(atmc); +} + +ERTS_GLB_INLINE ErtsThrPrgrVal +erts_thr_prgr_read_mb__(ERTS_THR_PRGR_ATOMIC *atmc) +{ + return (ErtsThrPrgrVal) erts_atomic_read_mb(atmc); +} + +#else /* ARCH_32 */ + +ERTS_GLB_INLINE ErtsThrPrgrVal +erts_thr_prgr_dw_aint_to_val__(erts_dw_aint_t *dw_aint) +{ +#ifdef ETHR_SU_DW_NAINT_T__ + return (ErtsThrPrgrVal) dw_aint->dw_sint; +#else + ErtsThrPrgrVal res; + res = (ErtsThrPrgrVal) ((Uint32) dw_aint->sint[ERTS_DW_AINT_HIGH_WORD]); + res <<= 32; + res |= (ErtsThrPrgrVal) ((Uint32) dw_aint->sint[ERTS_DW_AINT_LOW_WORD]); + return res; +#endif +} + ERTS_GLB_INLINE ErtsThrPrgrVal erts_thr_prgr_read_nob__(ERTS_THR_PRGR_ATOMIC *atmc) { - return (ErtsThrPrgrVal) erts_atomic64_read_nob(atmc); + erts_dw_aint_t dw_aint; + erts_dw_atomic_read_nob(atmc, &dw_aint); + return erts_thr_prgr_dw_aint_to_val__(&dw_aint); } ERTS_GLB_INLINE ErtsThrPrgrVal erts_thr_prgr_read_acqb__(ERTS_THR_PRGR_ATOMIC *atmc) { - return (ErtsThrPrgrVal) erts_atomic64_read_acqb(atmc); + erts_dw_aint_t dw_aint; + erts_dw_atomic_read_acqb(atmc, &dw_aint); + return erts_thr_prgr_dw_aint_to_val__(&dw_aint); } ERTS_GLB_INLINE ErtsThrPrgrVal erts_thr_prgr_read_mb__(ERTS_THR_PRGR_ATOMIC *atmc) { - return (ErtsThrPrgrVal) erts_atomic64_read_mb(atmc); + erts_dw_aint_t dw_aint; + erts_dw_atomic_read_mb(atmc, &dw_aint); + return erts_thr_prgr_dw_aint_to_val__(&dw_aint); } +#endif + ERTS_GLB_INLINE int erts_thr_progress_is_managed_thread(void) { diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_thr_queue.c erlang-17.3-dfsg/erts/emulator/beam/erl_thr_queue.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_thr_queue.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_thr_queue.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_thr_queue.h erlang-17.3-dfsg/erts/emulator/beam/erl_thr_queue.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_thr_queue.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_thr_queue.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_time.h erlang-17.3-dfsg/erts/emulator/beam/erl_time.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_time.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_time.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -21,49 +20,94 @@ #ifndef ERL_TIME_H__ #define ERL_TIME_H__ -/* timer wheel size NEED to be a power of 2 */ -#ifdef SMALL_MEMORY -#define ERTS_TIW_SIZE (1 << 13) -#else -#define ERTS_TIW_SIZE (1 << 16) -#endif +#define ERTS_SHORT_TIME_T_MAX ERTS_AINT32_T_MAX +#define ERTS_SHORT_TIME_T_MIN ERTS_AINT32_T_MIN +typedef erts_aint32_t erts_short_time_t; -#if defined(DEBUG) || 0 -#define ERTS_TIME_ASSERT(B) ERTS_ASSERT(B) -#else -#define ERTS_TIME_ASSERT(B) ((void) 1) -#endif +extern erts_smp_atomic32_t do_time; /* set at clock interrupt */ +extern SysTimeval erts_first_emu_time; -typedef enum { - ERTS_NO_TIME_WARP_MODE, - ERTS_SINGLE_TIME_WARP_MODE, - ERTS_MULTI_TIME_WARP_MODE -} ErtsTimeWarpMode; +/* +** Timer entry: +*/ +typedef struct erl_timer { + struct erl_timer* next; /* next entry tiw slot or chain */ + struct erl_timer* prev; /* prev entry tiw slot or chain */ + Uint slot; /* slot in timer wheel */ + Uint count; /* number of loops remaining */ + int active; /* 1=activated, 0=deactivated */ + /* called when timeout */ + void (*timeout)(void*); + /* called when cancel (may be NULL) */ + void (*cancel)(void*); + void* arg; /* argument to timeout/cancel procs */ +} ErlTimer; -typedef struct ErtsTimerWheel_ ErtsTimerWheel; -typedef ErtsMonotonicTime * ErtsNextTimeoutRef; +typedef void (*ErlTimeoutProc)(void*); +typedef void (*ErlCancelProc)(void*); -extern SysTimeval erts_first_emu_time; +#ifdef ERTS_SMP +/* + * Process and port timer + */ +typedef union ErtsSmpPTimer_ ErtsSmpPTimer; +union ErtsSmpPTimer_ { + struct { + ErlTimer tm; + Eterm id; + void (*timeout_func)(void*); + ErtsSmpPTimer **timer_ref; + Uint32 flags; + } timer; + ErtsSmpPTimer *next; +}; -void erts_monitor_time_offset(Eterm id, Eterm ref); -int erts_demonitor_time_offset(Eterm ref); +void erts_create_smp_ptimer(ErtsSmpPTimer **timer_ref, + Eterm id, + ErlTimeoutProc timeout_func, + Uint timeout); +void erts_cancel_smp_ptimer(ErtsSmpPTimer *ptimer); +#endif -int erts_init_time_sup(int, ErtsTimeWarpMode); -void erts_late_init_time_sup(void); +/* timer-wheel api */ -ErtsNextTimeoutRef erts_get_next_timeout_reference(ErtsTimerWheel *); -void erts_init_time(int time_correction, ErtsTimeWarpMode time_warp_mode); -void erts_bump_timers(ErtsTimerWheel *, ErtsMonotonicTime); +void erts_init_time(void); +void erts_set_timer(ErlTimer*, ErlTimeoutProc, ErlCancelProc, void*, Uint); +void erts_cancel_timer(ErlTimer*); +void erts_bump_timer(erts_short_time_t); Uint erts_timer_wheel_memory_size(void); +Uint erts_time_left(ErlTimer *); +erts_short_time_t erts_next_time(void); #ifdef DEBUG void erts_p_slpq(void); #endif +ERTS_GLB_INLINE erts_short_time_t erts_do_time_read_and_reset(void); +ERTS_GLB_INLINE void erts_do_time_add(erts_short_time_t); + +#if ERTS_GLB_INLINE_INCL_FUNC_DEF + +ERTS_GLB_INLINE erts_short_time_t erts_do_time_read_and_reset(void) +{ + erts_short_time_t time = erts_smp_atomic32_xchg_acqb(&do_time, 0); + if (time < 0) + erl_exit(ERTS_ABORT_EXIT, "Internal time management error\n"); + return time; +} + +ERTS_GLB_INLINE void erts_do_time_add(erts_short_time_t elapsed) +{ + erts_smp_atomic32_add_relb(&do_time, elapsed); +} + +#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */ + + /* time_sup */ -#if (defined(HAVE_GETHRVTIME) || defined(HAVE_CLOCK_GETTIME_CPU_TIME)) +#if (defined(HAVE_GETHRVTIME) || defined(HAVE_CLOCK_GETTIME)) # ifndef HAVE_ERTS_NOW_CPU # define HAVE_ERTS_NOW_CPU # ifdef HAVE_GETHRVTIME @@ -77,391 +121,25 @@ typedef UWord erts_approx_time_t; erts_approx_time_t erts_get_approx_time(void); -int erts_has_time_correction(void); -int erts_check_time_adj_support(int time_correction, - ErtsTimeWarpMode time_warp_mode); - -ErtsTimeWarpMode erts_time_warp_mode(void); - -typedef enum { - ERTS_TIME_OFFSET_PRELIMINARY, - ERTS_TIME_OFFSET_FINAL, - ERTS_TIME_OFFSET_VOLATILE -} ErtsTimeOffsetState; - -ErtsTimeOffsetState erts_time_offset_state(void); -ErtsTimeOffsetState erts_finalize_time_offset(void); -struct process; -Eterm erts_get_monotonic_start_time(struct process *c_p); -Eterm erts_get_monotonic_end_time(struct process *c_p); -Eterm erts_monotonic_time_source(struct process*c_p); -Eterm erts_system_time_source(struct process*c_p); - -#ifdef SYS_CLOCK_RESOLUTION -#define ERTS_CLKTCK_RESOLUTION ((ErtsMonotonicTime) (SYS_CLOCK_RESOLUTION*1000)) -#else -#define ERTS_CLKTCK_RESOLUTION (erts_time_sup__.r.o.clktck_resolution) -#endif - -#define ERTS_TIMER_WHEEL_MSEC (ERTS_TIW_SIZE/(ERTS_CLKTCK_RESOLUTION/1000)) - -struct erts_time_sup_read_only__ { - ErtsMonotonicTime monotonic_time_unit; -#if !ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT - ErtsMonotonicTime start; - struct { - ErtsMonotonicTime native; - ErtsMonotonicTime nsec; - ErtsMonotonicTime usec; - ErtsMonotonicTime msec; - ErtsMonotonicTime sec; - } start_offset; -#endif -#ifndef SYS_CLOCK_RESOLUTION - ErtsMonotonicTime clktck_resolution; -#endif -}; +void erts_get_timeval(SysTimeval *tv); +erts_time_t erts_get_time(void); -typedef struct { - union { - struct erts_time_sup_read_only__ o; - char align__[(((sizeof(struct erts_time_sup_read_only__) - 1) - / ASSUMED_CACHE_LINE_SIZE) + 1) - * ASSUMED_CACHE_LINE_SIZE]; - } r; -} ErtsTimeSupData; - -extern ErtsTimeSupData erts_time_sup__; - -ERTS_GLB_INLINE Uint64 -erts_time_unit_conversion(Uint64 value, - Uint32 from_time_unit, - Uint32 to_time_unit); +ERTS_GLB_INLINE int erts_cmp_timeval(SysTimeval *t1p, SysTimeval *t2p); #if ERTS_GLB_INLINE_INCL_FUNC_DEF -ERTS_GLB_INLINE Uint64 -erts_time_unit_conversion(Uint64 value, - Uint32 from_time_unit, - Uint32 to_time_unit) +ERTS_GLB_INLINE int +erts_cmp_timeval(SysTimeval *t1p, SysTimeval *t2p) { - Uint64 high, low, result; - if (value <= ~((Uint64) 0)/to_time_unit) - return (value*to_time_unit)/from_time_unit; - - low = value & ((Uint64) 0xffffffff); - high = (value >> 32) & ((Uint64) 0xffffffff); - - low *= to_time_unit; - high *= to_time_unit; - - high += (low >> 32) & ((Uint64) 0xffffffff); - low &= ((Uint64) 0xffffffff); - - result = high % from_time_unit; - high /= from_time_unit; - high <<= 32; - - result <<= 32; - result += low; - result /= from_time_unit; - result += high; - - return result; + if (t1p->tv_sec == t2p->tv_sec) { + if (t1p->tv_usec < t2p->tv_usec) + return -1; + else if (t1p->tv_usec > t2p->tv_usec) + return 1; + return 0; + } + return t1p->tv_sec < t2p->tv_sec ? -1 : 1; } -#endif /* ERTS_GLB_INLINE_INCL_FUNC_DEF */ - -/* - * Range of monotonic time internally - */ - -#define ERTS_MONOTONIC_BEGIN \ - ERTS_MONOTONIC_TIME_UNIT -#define ERTS_MONOTONIC_END \ - ((ERTS_MONOTONIC_TIME_MAX / ERTS_MONOTONIC_TIME_UNIT) \ - * ERTS_MONOTONIC_TIME_UNIT) - -#if ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT - -/* - * If the monotonic time unit is a compile time constant, - * it is assumed (and need) to be a power of 10. - */ - -#if ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT < 1000*1000 -# error Compile time time unit needs to be at least 1000000 -#endif - -#if ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT == 1000*1000*1000 -/* Nano-second time unit */ - -#define ERTS_MONOTONIC_TO_SEC__(NSEC) ((NSEC) / (1000*1000*1000)) -#define ERTS_MONOTONIC_TO_MSEC__(NSEC) ((NSEC) / (1000*1000)) -#define ERTS_MONOTONIC_TO_USEC__(NSEC) ((NSEC) / 1000) -#define ERTS_MONOTONIC_TO_NSEC__(NSEC) (NSEC) - -#define ERTS_SEC_TO_MONOTONIC__(SEC) (((ErtsMonotonicTime) (SEC))*(1000*1000*1000)) -#define ERTS_MSEC_TO_MONOTONIC__(MSEC) (((ErtsMonotonicTime) (MSEC))*(1000*1000)) -#define ERTS_USEC_TO_MONOTONIC__(USEC) (((ErtsMonotonicTime) (USEC))*1000) -#define ERTS_NSEC_TO_MONOTONIC__(NSEC) ((ErtsMonotonicTime) (NSEC)) - -#elif ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT == 1000*1000 -/* Micro-second time unit */ - -#define ERTS_MONOTONIC_TO_SEC__(USEC) ((USEC) / (1000*1000)) -#define ERTS_MONOTONIC_TO_MSEC__(USEC) ((USEC) / 1000) -#define ERTS_MONOTONIC_TO_USEC__(USEC) (USEC) -#define ERTS_MONOTONIC_TO_NSEC__(USEC) ((USEC)*1000) - -#define ERTS_SEC_TO_MONOTONIC__(SEC) (((ErtsMonotonicTime) (SEC))*(1000*1000)) -#define ERTS_MSEC_TO_MONOTONIC__(MSEC) (((ErtsMonotonicTime) (MSEC))*1000) -#define ERTS_USEC_TO_MONOTONIC__(USEC) ((ErtsMonotonicTime) (USEC)) -#define ERTS_NSEC_TO_MONOTONIC__(NSEC) (((ErtsMonotonicTime) (NSEC))/1000) - -#else -#error Missing implementation for monotonic time unit -#endif - -#define ERTS_MONOTONIC_TIME_UNIT \ - ((ErtsMonotonicTime) ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT) - -/* - * NOTE! ERTS_MONOTONIC_TIME_START_EXTERNAL *need* to be a multiple - * of ERTS_MONOTONIC_TIME_UNIT. - */ - -#ifdef ARCH_32 -/* - * Want to use a big-num of arity 2 as long as possible (584 years - * in the nano-second time unit case). - */ -#define ERTS_MONOTONIC_TIME_START_EXTERNAL \ - (((((((ErtsMonotonicTime) 1) << 32)-1) \ - / ERTS_MONOTONIC_TIME_UNIT) \ - * ERTS_MONOTONIC_TIME_UNIT) \ - + ERTS_MONOTONIC_TIME_UNIT) - -#else /* ARCH_64 */ - -#if ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT <= 10*1000*1000 - -/* - * Using micro second time unit or lower. Start at zero since - * time will remain an immediate for a very long time anyway - * (1827 years in the 10 micro second case)... - */ -#define ERTS_MONOTONIC_TIME_START_EXTERNAL ((ErtsMonotonicTime) 0) - -#else /* ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT > 10*1000*1000 */ - -/* - * Want to use an immediate as long as possible (36 years in the - * nano-second time unit case). -*/ -#define ERTS_MONOTONIC_TIME_START_EXTERNAL \ - ((((ErtsMonotonicTime) MIN_SMALL) \ - / ERTS_MONOTONIC_TIME_UNIT) \ - * ERTS_MONOTONIC_TIME_UNIT) - -#endif /* ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT > 1000*1000 */ - -#endif /* ARCH_64 */ - -/* - * Offsets from internal monotonic time to external monotonic time - */ - -#define ERTS_MONOTONIC_OFFSET_NATIVE \ - (ERTS_MONOTONIC_TIME_START_EXTERNAL - ERTS_MONOTONIC_BEGIN) -#define ERTS_MONOTONIC_OFFSET_NSEC \ - ERTS_MONOTONIC_TO_NSEC__(ERTS_MONOTONIC_OFFSET_NATIVE) -#define ERTS_MONOTONIC_OFFSET_USEC \ - ERTS_MONOTONIC_TO_USEC__(ERTS_MONOTONIC_OFFSET_NATIVE) -#define ERTS_MONOTONIC_OFFSET_MSEC \ - ERTS_MONOTONIC_TO_MSEC__(ERTS_MONOTONIC_OFFSET_NATIVE) -#define ERTS_MONOTONIC_OFFSET_SEC \ - ERTS_MONOTONIC_TO_SEC__(ERTS_MONOTONIC_OFFSET_NATIVE) - -#define ERTS_MONOTONIC_TO_CLKTCKS__(MON) \ - ((MON) / (ERTS_MONOTONIC_TIME_UNIT/ERTS_CLKTCK_RESOLUTION)) -#define ERTS_CLKTCKS_TO_MONOTONIC__(TCKS) \ - ((TCKS) * (ERTS_MONOTONIC_TIME_UNIT/ERTS_CLKTCK_RESOLUTION)) - -#else /* !ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT */ - -/* - * Initialized in erts_init_sys_time_sup() - */ -#define ERTS_MONOTONIC_TIME_UNIT (erts_time_sup__.r.o.monotonic_time_unit) - -/* - * Offsets from internal monotonic time to external monotonic time - * - * Initialized in erts_init_time_sup()... - */ -#define ERTS_MONOTONIC_TIME_START_EXTERNAL (erts_time_sup__.r.o.start) -#define ERTS_MONOTONIC_OFFSET_NATIVE (erts_time_sup__.r.o.start_offset.native) -#define ERTS_MONOTONIC_OFFSET_NSEC (erts_time_sup__.r.o.start_offset.nsec) -#define ERTS_MONOTONIC_OFFSET_USEC (erts_time_sup__.r.o.start_offset.usec) -#define ERTS_MONOTONIC_OFFSET_MSEC (erts_time_sup__.r.o.start_offset.msec) -#define ERTS_MONOTONIC_OFFSET_SEC (erts_time_sup__.r.o.start_offset.sec) - -#define ERTS_CONV_FROM_MON_UNIT___(M, TO) \ - ((ErtsMonotonicTime) \ - erts_time_unit_conversion((Uint64) (M), \ - (Uint32) ERTS_MONOTONIC_TIME_UNIT, \ - (Uint32) (TO))) - -#define ERTS_CONV_TO_MON_UNIT___(M, FROM) \ - ((ErtsMonotonicTime) \ - erts_time_unit_conversion((Uint64) (M), \ - (Uint32) (FROM), \ - (Uint32) ERTS_MONOTONIC_TIME_UNIT)) \ - -#define ERTS_MONOTONIC_TO_SEC__(M) \ - ERTS_CONV_FROM_MON_UNIT___((M), 1) -#define ERTS_MONOTONIC_TO_MSEC__(M) \ - ERTS_CONV_FROM_MON_UNIT___((M), 1000) -#define ERTS_MONOTONIC_TO_USEC__(M) \ - ERTS_CONV_FROM_MON_UNIT___((M), 1000*1000) -#define ERTS_MONOTONIC_TO_NSEC__(M) \ - ERTS_CONV_FROM_MON_UNIT___((M), 1000*1000*1000) - -#define ERTS_SEC_TO_MONOTONIC__(SEC) \ - ERTS_CONV_TO_MON_UNIT___((SEC), 1) -#define ERTS_MSEC_TO_MONOTONIC__(MSEC) \ - ERTS_CONV_TO_MON_UNIT___((MSEC), 1000) -#define ERTS_USEC_TO_MONOTONIC__(USEC) \ - ERTS_CONV_TO_MON_UNIT___((USEC), 1000*1000) -#define ERTS_NSEC_TO_MONOTONIC__(NSEC) \ - ERTS_CONV_TO_MON_UNIT___((NSEC), 1000*1000*1000) - -#define ERTS_MONOTONIC_TO_CLKTCKS__(MON) \ - ERTS_CONV_FROM_MON_UNIT___((MON), ERTS_CLKTCK_RESOLUTION) -#define ERTS_CLKTCKS_TO_MONOTONIC__(TCKS) \ - ERTS_CONV_TO_MON_UNIT___((TCKS), ERTS_CLKTCK_RESOLUTION) - -#endif /* !ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT */ - -#define ERTS_MONOTONIC_TIME_END_EXTERNAL \ - (ERTS_MONOTONIC_TIME_START_EXTERNAL < 0 \ - ? (ERTS_MONOTONIC_TIME_START_EXTERNAL \ - + (ERTS_MONOTONIC_END - ERTS_MONOTONIC_BEGIN)) \ - : (ERTS_MONOTONIC_END - ERTS_MONOTONIC_TIME_START_EXTERNAL)) - -#define ERTS_MSEC_TO_CLKTCKS__(MON) \ - ((MON) * (ERTS_CLKTCK_RESOLUTION/1000)) -#define ERTS_CLKTCKS_TO_MSEC__(TCKS) \ - ((TCKS) / (ERTS_CLKTCK_RESOLUTION/1000)) - -#define ERTS_MONOTONIC_TO_SEC(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_MONOTONIC_TO_SEC__((X))) -#define ERTS_MONOTONIC_TO_MSEC(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_MONOTONIC_TO_MSEC__((X))) -#define ERTS_MONOTONIC_TO_USEC(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_MONOTONIC_TO_USEC__((X))) -#define ERTS_MONOTONIC_TO_NSEC(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_MONOTONIC_TO_NSEC__((X))) -#define ERTS_SEC_TO_MONOTONIC(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_SEC_TO_MONOTONIC__((X))) -#define ERTS_MSEC_TO_MONOTONIC(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_MSEC_TO_MONOTONIC__((X))) -#define ERTS_USEC_TO_MONOTONIC(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_USEC_TO_MONOTONIC__((X))) -#define ERTS_NSEC_TO_MONOTONIC(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_NSEC_TO_MONOTONIC__((X))) - -#define ERTS_MONOTONIC_TO_CLKTCKS(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_MONOTONIC_TO_CLKTCKS__((X))) -#define ERTS_CLKTCKS_TO_MONOTONIC(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_CLKTCKS_TO_MONOTONIC__((X))) - -#define ERTS_MSEC_TO_CLKTCKS(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_MSEC_TO_CLKTCKS__((X))) -#define ERTS_CLKTCKS_TO_MSEC(X) \ - (ERTS_TIME_ASSERT((X) >= 0), \ - ERTS_CLKTCKS_TO_MSEC__((X))) - +#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */ #endif /* ERL_TIME_H__ */ - -/* timer-wheel api */ -#if defined(ERTS_WANT_TIMER_WHEEL_API) && !defined(ERTS_GOT_TIMER_WHEEL_API) -#define ERTS_GOT_TIMER_WHEEL_API - -#include "erl_thr_progress.h" -#include "erl_process.h" - -void erts_sched_init_time_sup(ErtsSchedulerData *esdp); - - -#define ERTS_TWHEEL_SLOT_AT_ONCE -1 -#define ERTS_TWHEEL_SLOT_INACTIVE -2 - -/* -** Timer entry: -*/ -typedef struct erl_timer { - struct erl_timer* next; /* next entry tiw slot or chain */ - struct erl_timer* prev; /* prev entry tiw slot or chain */ - union { - struct { - void (*timeout)(void*); /* called when timeout */ - void (*cancel)(void*); /* called when cancel (may be NULL) */ - void* arg; /* argument to timeout/cancel procs */ - } func; - ErtsThrPrgrLaterOp cleanup; - } u; - ErtsMonotonicTime timeout_pos; /* Timeout in absolute clock ticks */ - int slot; -} ErtsTWheelTimer; - -typedef void (*ErlTimeoutProc)(void*); -typedef void (*ErlCancelProc)(void*); - -void erts_twheel_set_timer(ErtsTimerWheel *tiw, - ErtsTWheelTimer *p, ErlTimeoutProc timeout, - ErlCancelProc cancel, void *arg, - ErtsMonotonicTime timeout_pos); -void erts_twheel_cancel_timer(ErtsTimerWheel *tiw, ErtsTWheelTimer *p); -ErtsTimerWheel *erts_create_timer_wheel(ErtsSchedulerData *esdp); - -ErtsMonotonicTime erts_check_next_timeout_time(ErtsSchedulerData *); - -ERTS_GLB_INLINE void erts_twheel_init_timer(ErtsTWheelTimer *p); -ERTS_GLB_INLINE ErtsMonotonicTime erts_next_timeout_time(ErtsNextTimeoutRef); - -#if ERTS_GLB_INLINE_INCL_FUNC_DEF - -ERTS_GLB_INLINE void erts_twheel_init_timer(ErtsTWheelTimer *p) -{ - p->slot = ERTS_TWHEEL_SLOT_INACTIVE; -} - -ERTS_GLB_INLINE ErtsMonotonicTime erts_next_timeout_time(ErtsNextTimeoutRef nxt_tmo_ref) -{ - return *((ErtsMonotonicTime *) nxt_tmo_ref); -} - -#endif /* ERTS_GLB_INLINE_INCL_FUNC_DEF */ - -void -erts_twheel_debug_foreach(ErtsTimerWheel *tiw, - void (*tclbk)(void *), - void (*func)(void *, - ErtsMonotonicTime, - void *), - void *arg); - -#endif /* timer wheel api */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_time_sup.c erlang-17.3-dfsg/erts/emulator/beam/erl_time_sup.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_time_sup.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_time_sup.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,28 +1,77 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 1999-2015. All Rights Reserved. + * Copyright Ericsson AB 1999-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ /* - * Support routines for the time - */ - -/* #define ERTS_TIME_CORRECTION_PRINT */ +** Support routines for the timer wheel +** +** This code contains two strategies for dealing with +** date/time changes in the system. +** If the system has some kind of high resolution timer (HAVE_GETHRTIME), +** the high resolution timer is used to correct the time-of-day and the +** timeouts, the base source is the hrtimer, but at certain intervals the +** OS time-of-day is checked and if it is not within certain bounds, the +** delivered time gets slowly adjusted for each call until +** it corresponds to the system time (built-in adjtime...). +** The call gethrtime() is detected by autoconf on Unix, but other +** platforms may define it in erl_*_sys.h and implement +** their own high resolution timer. The high resolution timer +** strategy is (probably) best on all systems where the timer have +** a resolution higher or equal to gettimeofday (or what's implemented +** is sys_gettimeofday()). The actual resolution is the interesting thing, +** not the unit's thats used (i.e. on VxWorks, nanoseconds can be +** retrieved in terms of units, but the actual resolution is the same as +** for the clock ticks). +** If the systems best timer routine is kernel ticks returned from +** sys_times(), and the actual resolution of sys_gettimeofday() is +** better (like most unixes that does not have any realtime extensions), +** another strategy is used. The tolerant gettimeofday() corrects +** the value with respect to uptime (sys_times() return value) and checks +** for correction both when delivering timeticks and delivering nowtime. +** this strategy is slower, but accurate on systems without better timer +** routines. The kernel tick resolution is not enough to implement +** a gethrtime routine. On Linux and other non solaris unix-boxes the second +** strategy is used, on all other platforms we use the first. +** +** The following is expected (from sys.[ch] and erl_*_sys.h): +** +** 64 bit integers. So it is, and so it will be. +** +** sys_init_time(), will return the clock resolution in MS and +** that's about it. More could be added of course +** If the clock-rate is constant (i.e. 1 ms) one can define +** SYS_CLOCK_RESOLUTION (to 1), +** which makes erts_deliver_time/erts_time_remaining a bit faster. +** +** if HAVE_GETHRTIME is defined: +** sys_gethrtime() will return a SysHrTime (long long) representing +** nanoseconds, sys_init_hrtime() will do any initialization. +** else +** a long (64bit) integer type called Sint64 should be defined. +** +** sys_times() will return clock_ticks since start and +** fill in a SysTimes structure (struct tms). Instead of CLK_TCK, +** SYS_CLK_TCK is used to determine the resolution of kernel ticks. +** +** sys_gettimeofday() will take a SysTimeval (a struct timeval) as parameter +** and fill it in as gettimeofday(X,NULL). +** +*/ #ifdef HAVE_CONFIG_H # include "config.h" @@ -31,1256 +80,384 @@ #include "sys.h" #include "erl_vm.h" #include "global.h" -#define ERTS_WANT_TIMER_WHEEL_API -#include "erl_time.h" - -static erts_smp_mtx_t erts_timeofday_mtx; -static erts_smp_mtx_t erts_get_time_mtx; - -static SysTimes t_start; /* Used in elapsed_time_both */ -static ErtsMonotonicTime prev_wall_clock_elapsed; /* Used in wall_clock_elapsed_time_both */ -static ErtsMonotonicTime previous_now; /* Used in get_now */ -static ErtsMonitor *time_offset_monitors = NULL; -static Uint no_time_offset_monitors = 0; +static erts_smp_mtx_t erts_timeofday_mtx; -#ifdef DEBUG -static int time_sup_initialized = 0; -#endif +static SysTimeval inittv; /* Used everywhere, the initial time-of-day */ -#define ERTS_MONOTONIC_TIME_KILO \ - ((ErtsMonotonicTime) 1000) -#define ERTS_MONOTONIC_TIME_MEGA \ - (ERTS_MONOTONIC_TIME_KILO*ERTS_MONOTONIC_TIME_KILO) -#define ERTS_MONOTONIC_TIME_GIGA \ - (ERTS_MONOTONIC_TIME_MEGA*ERTS_MONOTONIC_TIME_KILO) -#define ERTS_MONOTONIC_TIME_TERA \ - (ERTS_MONOTONIC_TIME_GIGA*ERTS_MONOTONIC_TIME_KILO) +static SysTimes t_start; /* Used in elapsed_time_both */ +static SysTimeval gtv; /* Used in wall_clock_elapsed_time_both */ +static SysTimeval then; /* Used in get_now */ +static SysTimeval last_emu_time; /* Used in erts_get_emu_time() */ +SysTimeval erts_first_emu_time; /* Used in erts_get_emu_time() */ + +union { + erts_smp_atomic_t time; + char align[ERTS_CACHE_LINE_SIZE]; +} approx erts_align_attribute(ERTS_CACHE_LINE_SIZE); static void -schedule_send_time_offset_changed_notifications(ErtsMonotonicTime new_offset); - -struct time_sup_read_only__ { - ErtsMonotonicTime (*get_time)(void); - int correction; - ErtsTimeWarpMode warp_mode; -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - ErtsMonotonicTime moffset; - int os_corrected_monotonic_time; - int os_monotonic_time_disable; - char *os_monotonic_time_func; - char *os_monotonic_time_clock_id; - int os_monotonic_time_locked; - Uint64 os_monotonic_time_resolution; - Uint64 os_monotonic_time_extended; -#endif - char *os_system_time_func; - char *os_system_time_clock_id; - int os_system_time_locked; - Uint64 os_system_time_resolution; - Uint64 os_system_time_extended; - struct { - ErtsMonotonicTime large_diff; - ErtsMonotonicTime small_diff; - } adj; - struct { - ErtsMonotonicTime error; - ErtsMonotonicTime resolution; - int intervals; - int use_avg; - } drift_adj; -}; - -typedef struct { - ErtsMonotonicTime drift; /* Correction for os monotonic drift */ - ErtsMonotonicTime error; /* Correction for error between system times */ -} ErtsMonotonicCorrection; - -typedef struct { - ErtsMonotonicTime erl_mtime; - ErtsMonotonicTime os_mtime; - ErtsMonotonicCorrection correction; -} ErtsMonotonicCorrectionInstance; - -#define ERTS_MAX_DRIFT_INTERVALS 50 -typedef struct { - struct { - struct { - ErtsMonotonicTime sys; - ErtsMonotonicTime mon; - } diff; - struct { - ErtsMonotonicTime sys; - ErtsMonotonicTime mon; - } time; - } intervals[ERTS_MAX_DRIFT_INTERVALS]; - struct { - ErtsMonotonicTime sys; - ErtsMonotonicTime mon; - } acc; - int ix; - int dirty_counter; -} ErtsMonotonicDriftData; - -typedef struct { - ErtsMonotonicCorrectionInstance prev; - ErtsMonotonicCorrectionInstance curr; -} ErtsMonotonicCorrectionInstances; - -typedef struct { - ErtsMonotonicCorrectionInstances insts; - ErtsMonotonicDriftData drift; - ErtsMonotonicTime last_check; - int short_check_interval; -} ErtsMonotonicCorrectionData; - -struct time_sup_infrequently_changed__ { -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - struct { - erts_smp_rwmtx_t rwmtx; - ErtsTWheelTimer timer; - ErtsMonotonicCorrectionData cdata; - } parmon; - ErtsMonotonicTime minit; -#endif - ErtsSystemTime sinit; - ErtsMonotonicTime not_corrected_moffset; - erts_smp_atomic64_t offset; - ErtsMonotonicTime shadow_offset; - erts_smp_atomic32_t preliminary_offset; -}; - -struct time_sup_frequently_changed__ { - ErtsMonotonicTime last_not_corrected_time; -}; - -static struct { - union { - struct time_sup_read_only__ o; - char align__[ERTS_ALC_CACHE_LINE_ALIGN_SIZE(sizeof(struct time_sup_read_only__))]; - } r; - union { - struct time_sup_infrequently_changed__ c; - char align__[ERTS_ALC_CACHE_LINE_ALIGN_SIZE(sizeof(struct time_sup_infrequently_changed__))]; - } inf; - union { - struct time_sup_frequently_changed__ c; - char align__[ERTS_ALC_CACHE_LINE_ALIGN_SIZE(sizeof(struct time_sup_frequently_changed__))]; - } f; -} time_sup erts_align_attribute(ERTS_CACHE_LINE_SIZE); - -ErtsTimeSupData erts_time_sup__ erts_align_attribute(ERTS_CACHE_LINE_SIZE); - -/* - * erts_get_approx_time() returns an *approximate* time - * in seconds. NOTE that this time may jump backwards!!! - */ -erts_approx_time_t -erts_get_approx_time(void) +init_approx_time(void) { - ErtsSystemTime stime = erts_os_system_time(); - return (erts_approx_time_t) ERTS_MONOTONIC_TO_SEC(stime); + erts_smp_atomic_init_nob(&approx.time, 0); } -static ERTS_INLINE void -init_time_offset(ErtsMonotonicTime offset) +static ERTS_INLINE erts_approx_time_t +get_approx_time(void) { - erts_smp_atomic64_init_nob(&time_sup.inf.c.offset, (erts_aint64_t) offset); + return (erts_approx_time_t) erts_smp_atomic_read_nob(&approx.time); } static ERTS_INLINE void -set_time_offset(ErtsMonotonicTime offset) -{ - erts_smp_atomic64_set_relb(&time_sup.inf.c.offset, (erts_aint64_t) offset); -} - -static ERTS_INLINE ErtsMonotonicTime -get_time_offset(void) +update_approx_time(SysTimeval *tv) { - return (ErtsMonotonicTime) erts_smp_atomic64_read_acqb(&time_sup.inf.c.offset); + erts_approx_time_t new_secs = (erts_approx_time_t) tv->tv_sec; + erts_approx_time_t old_secs = get_approx_time(); + if (old_secs != new_secs) + erts_smp_atomic_set_nob(&approx.time, new_secs); } -static ERTS_INLINE void -update_last_mtime(ErtsSchedulerData *esdp, ErtsMonotonicTime mtime) -{ - if (!esdp) - esdp = erts_get_scheduler_data(); - if (esdp) { - ASSERT(mtime >= esdp->last_monotonic_time); - esdp->last_monotonic_time = mtime; - esdp->check_time_reds = 0; - } -} - -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - -/* - * Time correction adjustments made due to - * error between Erlang system time and OS - * system time: - * - Large adjustment ~1% - * - Small adjustment ~0.05% - */ -#define ERTS_TCORR_ERR_UNIT 2048 -#define ERTS_TCORR_ERR_LARGE_ADJ 20 -#define ERTS_TCORR_ERR_SMALL_ADJ 1 - -#define ERTS_INIT_SHORT_INTERVAL_COUNTER 10 -#define ERTS_LONG_TIME_CORRECTION_CHECK ERTS_SEC_TO_MONOTONIC(60) -#define ERTS_SHORT_TIME_CORRECTION_CHECK ERTS_SEC_TO_MONOTONIC(15) - -#define ERTS_TIME_DRIFT_MAX_ADJ_DIFF ERTS_USEC_TO_MONOTONIC(50) -#define ERTS_TIME_DRIFT_MIN_ADJ_DIFF ERTS_USEC_TO_MONOTONIC(5) - -/* - * Maximum drift of the OS monotonic clock expected. - * - * We use 1 milli second per second. If the monotonic - * clock drifts more than this we will fail to adjust for - * drift, and error correction will kick in instead. - * If it is larger than this, one could argue that the - * primitive is to poor to be used... - */ -#define ERTS_MAX_MONOTONIC_DRIFT ERTS_MSEC_TO_MONOTONIC(1) - /* - * We assume that precision is 32 times worse than the - * resolution. This is a wild guess, but there are no - * practical way to determine actual precision. + * erts_get_approx_time() returns an *approximate* time + * in seconds. NOTE that this time may jump backwards!!! */ -#define ERTS_ASSUMED_PRECISION_DROP 32 - -#define ERTS_MIN_MONOTONIC_DRIFT_MEASUREMENT \ - (ERTS_SHORT_TIME_CORRECTION_CHECK - 2*ERTS_MAX_MONOTONIC_DRIFT) - - -static ERTS_INLINE ErtsMonotonicTime -calc_corrected_erl_mtime(ErtsMonotonicTime os_mtime, - ErtsMonotonicCorrectionInstance *cip, - ErtsMonotonicTime *os_mdiff_p, - int os_drift_corrected) +erts_approx_time_t +erts_get_approx_time(void) { - ErtsMonotonicTime erl_mtime, diff = os_mtime - cip->os_mtime; - ERTS_TIME_ASSERT(diff >= 0); - if (!os_drift_corrected) - diff += (cip->correction.drift*diff)/ERTS_MONOTONIC_TIME_UNIT; - erl_mtime = cip->erl_mtime; - erl_mtime += diff; - erl_mtime += cip->correction.error*(diff/ERTS_TCORR_ERR_UNIT); - if (os_mdiff_p) - *os_mdiff_p = diff; - return erl_mtime; + return get_approx_time(); } -static ERTS_INLINE ErtsMonotonicTime -read_corrected_time(int os_drift_corrected) -{ - ErtsMonotonicTime os_mtime; - ErtsMonotonicCorrectionInstance ci; - - erts_smp_rwmtx_rlock(&time_sup.inf.c.parmon.rwmtx); - - os_mtime = erts_os_monotonic_time(); - - if (os_mtime >= time_sup.inf.c.parmon.cdata.insts.curr.os_mtime) - ci = time_sup.inf.c.parmon.cdata.insts.curr; - else { - if (os_mtime < time_sup.inf.c.parmon.cdata.insts.prev.os_mtime) - erl_exit(ERTS_ABORT_EXIT, - "OS monotonic time stepped backwards\n"); - ci = time_sup.inf.c.parmon.cdata.insts.prev; - } - - erts_smp_rwmtx_runlock(&time_sup.inf.c.parmon.rwmtx); +#ifdef HAVE_GETHRTIME - return calc_corrected_erl_mtime(os_mtime, &ci, NULL, - os_drift_corrected); -} +int erts_disable_tolerant_timeofday; -static ErtsMonotonicTime get_os_drift_corrected_time(void) -{ - return read_corrected_time(!0); -} +static SysHrTime hr_init_time, hr_last_correction_check, + hr_correction, hr_last_time; -static ErtsMonotonicTime get_corrected_time(void) +static void init_tolerant_timeofday(void) { - return read_corrected_time(0); -} - -#ifdef ERTS_TIME_CORRECTION_PRINT - -static ERTS_INLINE void -print_correction(int change, - ErtsMonotonicTime sdiff, - ErtsMonotonicTime old_ecorr, - ErtsMonotonicTime old_dcorr, - ErtsMonotonicTime new_ecorr, - ErtsMonotonicTime new_dcorr, - Uint tmo) -{ - ErtsMonotonicTime usec_sdiff; - if (sdiff < 0) - usec_sdiff = -1*ERTS_MONOTONIC_TO_USEC(-1*sdiff); - else - usec_sdiff = ERTS_MONOTONIC_TO_USEC(sdiff); - - if (!change) - erts_fprintf(stderr, - "sdiff = %b64d usec : [ec=%b64d ppm, dc=%b64d ppb] : " - "tmo = %bpu msec\r\n", - usec_sdiff, - (1000000*old_ecorr) / ERTS_TCORR_ERR_UNIT, - (1000000000*old_dcorr) / ERTS_MONOTONIC_TIME_UNIT, - tmo); - else - erts_fprintf(stderr, - "sdiff = %b64d usec : [ec=%b64d ppm, dc=%b64d ppb] " - "-> [ec=%b64d ppm, dc=%b64d ppb] : tmo = %bpu msec\r\n", - usec_sdiff, - (1000000*old_ecorr) / ERTS_TCORR_ERR_UNIT, - (1000000000*old_dcorr) / ERTS_MONOTONIC_TIME_UNIT, - (1000000*new_ecorr) / ERTS_TCORR_ERR_UNIT, - (1000000000*new_dcorr) / ERTS_MONOTONIC_TIME_UNIT, - tmo); -} - + /* Should be in sys.c */ +#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF) + if (sysconf(_SC_NPROCESSORS_CONF) > 1) { + char b[1024]; + int maj,min,build; + os_flavor(b,1024); + os_version(&maj,&min,&build); + if (!strcmp(b,"sunos") && maj <= 5 && min <= 7) { + erts_disable_tolerant_timeofday = 1; + } + } #endif - -static ERTS_INLINE ErtsMonotonicTime -get_timeout_pos(ErtsMonotonicTime now, ErtsMonotonicTime tmo) -{ - ErtsMonotonicTime tpos; - tpos = ERTS_MONOTONIC_TO_CLKTCKS(now - 1); - tpos += ERTS_MSEC_TO_CLKTCKS(tmo); - tpos += 1; - return tpos; + hr_init_time = sys_gethrtime(); + hr_last_correction_check = hr_last_time = hr_init_time; + hr_correction = 0; } -static void -check_time_correction(void *vesdp) +static void get_tolerant_timeofday(SysTimeval *tv) { - int init_drift_adj = !vesdp; - ErtsSchedulerData *esdp = (ErtsSchedulerData *) vesdp; - ErtsMonotonicCorrection new_correction; - ErtsMonotonicCorrectionInstance ci; - ErtsMonotonicTime mdiff, sdiff, os_mtime, erl_mtime, os_stime, - erl_stime, time_offset, timeout_pos; - Uint timeout; - int os_drift_corrected = time_sup.r.o.os_corrected_monotonic_time; - int set_new_correction = 0, begin_short_intervals = 0; - - erts_smp_rwmtx_rlock(&time_sup.inf.c.parmon.rwmtx); - - erts_os_times(&os_mtime, &os_stime); - - ci = time_sup.inf.c.parmon.cdata.insts.curr; - - erts_smp_rwmtx_runlock(&time_sup.inf.c.parmon.rwmtx); - - if (os_mtime < ci.os_mtime) - erl_exit(ERTS_ABORT_EXIT, - "OS monotonic time stepped backwards\n"); - - erl_mtime = calc_corrected_erl_mtime(os_mtime, &ci, &mdiff, - os_drift_corrected); - time_offset = get_time_offset(); - erl_stime = erl_mtime + time_offset; - - sdiff = erl_stime - os_stime; - - if (time_sup.inf.c.shadow_offset) { - ERTS_TIME_ASSERT(time_sup.r.o.warp_mode == ERTS_SINGLE_TIME_WARP_MODE); - if (erts_smp_atomic32_read_nob(&time_sup.inf.c.preliminary_offset)) - sdiff += time_sup.inf.c.shadow_offset; - else - time_sup.inf.c.shadow_offset = 0; - } - - new_correction = ci.correction; - - if (time_sup.r.o.warp_mode == ERTS_MULTI_TIME_WARP_MODE - && (sdiff < -2*time_sup.r.o.adj.small_diff - || 2*time_sup.r.o.adj.small_diff < sdiff)) { - /* System time diff exeeded limits; change time offset... */ - time_offset -= sdiff; - sdiff = 0; - set_time_offset(time_offset); - schedule_send_time_offset_changed_notifications(time_offset); - begin_short_intervals = 1; - if (ci.correction.error != 0) { - set_new_correction = 1; - new_correction.error = 0; - } - } - else if ((time_sup.r.o.warp_mode == ERTS_SINGLE_TIME_WARP_MODE - && erts_smp_atomic32_read_nob(&time_sup.inf.c.preliminary_offset)) - && (sdiff < -2*time_sup.r.o.adj.small_diff - || 2*time_sup.r.o.adj.small_diff < sdiff)) { - /* - * System time diff exeeded limits; change shadow offset - * and let OS system time leap away from Erlang system - * time. - */ - time_sup.inf.c.shadow_offset -= sdiff; - sdiff = 0; - begin_short_intervals = 1; - if (ci.correction.error != 0) { - set_new_correction = 1; - new_correction.error = 0; - } - } - else if (ci.correction.error == 0) { - if (sdiff < -time_sup.r.o.adj.small_diff) { - set_new_correction = 1; - if (sdiff < -time_sup.r.o.adj.large_diff) - new_correction.error = ERTS_TCORR_ERR_LARGE_ADJ; - else - new_correction.error = ERTS_TCORR_ERR_SMALL_ADJ; - } - else if (sdiff > time_sup.r.o.adj.small_diff) { - set_new_correction = 1; - if (sdiff > time_sup.r.o.adj.large_diff) - new_correction.error = -ERTS_TCORR_ERR_LARGE_ADJ; - else - new_correction.error = -ERTS_TCORR_ERR_SMALL_ADJ; - } - } - else if (ci.correction.error > 0) { - if (sdiff < 0) { - if (ci.correction.error != ERTS_TCORR_ERR_LARGE_ADJ - && sdiff < -time_sup.r.o.adj.large_diff) { - new_correction.error = ERTS_TCORR_ERR_LARGE_ADJ; - set_new_correction = 1; - } - } - else if (sdiff > time_sup.r.o.adj.small_diff) { - set_new_correction = 1; - if (sdiff > time_sup.r.o.adj.large_diff) - new_correction.error = -ERTS_TCORR_ERR_LARGE_ADJ; - else - new_correction.error = -ERTS_TCORR_ERR_SMALL_ADJ; - } - else { - set_new_correction = 1; - new_correction.error = 0; - } + SysHrTime diff_time, curr; + + if (erts_disable_tolerant_timeofday) { + sys_gettimeofday(tv); + return; } - else /* if (ci.correction.error < 0) */ { - if (0 < sdiff) { - if (ci.correction.error != -ERTS_TCORR_ERR_LARGE_ADJ - && time_sup.r.o.adj.large_diff < sdiff) { - new_correction.error = -ERTS_TCORR_ERR_LARGE_ADJ; - set_new_correction = 1; - } - } - else if (sdiff < -time_sup.r.o.adj.small_diff) { - set_new_correction = 1; - if (sdiff < -time_sup.r.o.adj.large_diff) - new_correction.error = ERTS_TCORR_ERR_LARGE_ADJ; - else - new_correction.error = ERTS_TCORR_ERR_SMALL_ADJ; - } - else { - set_new_correction = 1; - new_correction.error = 0; - } + *tv = inittv; + diff_time = ((curr = sys_gethrtime()) + hr_correction - hr_init_time) / 1000; + + if (curr < hr_init_time) { + erl_exit(1,"Unexpected behaviour from operating system high " + "resolution timer"); } - if (!os_drift_corrected) { - ErtsMonotonicDriftData *ddp = &time_sup.inf.c.parmon.cdata.drift; - int ix = ddp->ix; - ErtsMonotonicTime mtime_diff, old_os_mtime; - - old_os_mtime = ddp->intervals[ix].time.mon; - mtime_diff = os_mtime - old_os_mtime; - - if ((mtime_diff >= ERTS_MIN_MONOTONIC_DRIFT_MEASUREMENT) - | init_drift_adj) { - ErtsMonotonicTime drift_adj, drift_adj_diff, old_os_stime, - smtime_diff, stime_diff, mtime_acc, stime_acc, - avg_drift_adj, max_drift; - - old_os_stime = ddp->intervals[ix].time.sys; - - mtime_acc = ddp->acc.mon; - stime_acc = ddp->acc.sys; - - avg_drift_adj = (((stime_acc - mtime_acc) - * ERTS_MONOTONIC_TIME_UNIT) - / mtime_acc); - - mtime_diff = os_mtime - old_os_mtime; - stime_diff = os_stime - old_os_stime; - smtime_diff = stime_diff - mtime_diff; - ix++; - if (ix >= time_sup.r.o.drift_adj.intervals) - ix = 0; - mtime_acc -= ddp->intervals[ix].diff.mon; - mtime_acc += mtime_diff; - stime_acc -= ddp->intervals[ix].diff.sys; - stime_acc += stime_diff; - - ddp->intervals[ix].diff.mon = mtime_diff; - ddp->intervals[ix].diff.sys = stime_diff; - ddp->intervals[ix].time.mon = os_mtime; - ddp->intervals[ix].time.sys = os_stime; - - ddp->ix = ix; - ddp->acc.mon = mtime_acc; - ddp->acc.sys = stime_acc; - - max_drift = ERTS_MAX_MONOTONIC_DRIFT; - max_drift *= ERTS_MONOTONIC_TO_SEC(mtime_diff); - - if (smtime_diff > time_sup.r.o.drift_adj.error + max_drift - || smtime_diff < -1*time_sup.r.o.drift_adj.error - max_drift) { - dirty_intervals: - /* - * We had a leap in system time. Mark array as - * dirty to ensure that dirty values are rotated - * out before we use it again... - */ - ddp->dirty_counter = time_sup.r.o.drift_adj.intervals; - begin_short_intervals = 1; - } - else if (ddp->dirty_counter > 0) { - if (init_drift_adj) { - new_correction.drift = ((smtime_diff - * ERTS_MONOTONIC_TIME_UNIT) - / mtime_diff); - set_new_correction = 1; - } - ddp->dirty_counter--; + if ((curr - hr_last_correction_check) / 1000 > 1000000) { + /* Check the correction need */ + SysHrTime tv_diff, diffdiff; + SysTimeval tmp; + int done = 0; + + sys_gettimeofday(&tmp); + tv_diff = ((SysHrTime) tmp.tv_sec) * 1000000 + tmp.tv_usec; + tv_diff -= ((SysHrTime) inittv.tv_sec) * 1000000 + inittv.tv_usec; + diffdiff = diff_time - tv_diff; + if (diffdiff > 10000) { + SysHrTime corr = (curr - hr_last_time) / 100; + if (corr / 1000 >= diffdiff) { + ++done; + hr_correction -= ((SysHrTime)diffdiff) * 1000; + } else { + hr_correction -= corr; } - else { - if (ddp->dirty_counter == 0) { - /* Force set new drift correction... */ - set_new_correction = 1; - ddp->dirty_counter--; - } - - if (time_sup.r.o.drift_adj.use_avg) - drift_adj = (((stime_acc - mtime_acc) - * ERTS_MONOTONIC_TIME_UNIT) - / mtime_acc); - else - drift_adj = ((smtime_diff - * ERTS_MONOTONIC_TIME_UNIT) - / mtime_diff); - - drift_adj_diff = avg_drift_adj - drift_adj; - if (drift_adj_diff < -ERTS_TIME_DRIFT_MAX_ADJ_DIFF - || ERTS_TIME_DRIFT_MAX_ADJ_DIFF < drift_adj_diff) - goto dirty_intervals; - - drift_adj_diff = drift_adj - new_correction.drift; - if (drift_adj_diff) { - if (drift_adj_diff > ERTS_TIME_DRIFT_MAX_ADJ_DIFF) - drift_adj_diff = ERTS_TIME_DRIFT_MAX_ADJ_DIFF; - else if (drift_adj_diff < -ERTS_TIME_DRIFT_MAX_ADJ_DIFF) - drift_adj_diff = -ERTS_TIME_DRIFT_MAX_ADJ_DIFF; - new_correction.drift += drift_adj_diff; - if (drift_adj_diff < -ERTS_TIME_DRIFT_MIN_ADJ_DIFF - || ERTS_TIME_DRIFT_MIN_ADJ_DIFF < drift_adj_diff) { - set_new_correction = 1; - } - } + diff_time = (curr + hr_correction - hr_init_time) / 1000; + } else if (diffdiff < -10000) { + SysHrTime corr = (curr - hr_last_time) / 100; + if (corr / 1000 >= -diffdiff) { + ++done; + hr_correction -= ((SysHrTime)diffdiff) * 1000; + } else { + hr_correction += corr; } + diff_time = (curr + hr_correction - hr_init_time) / 1000; + } else { + ++done; } - } - - begin_short_intervals |= set_new_correction; - - if (begin_short_intervals) { - time_sup.inf.c.parmon.cdata.short_check_interval - = ERTS_INIT_SHORT_INTERVAL_COUNTER; - } - else if ((os_mtime - time_sup.inf.c.parmon.cdata.last_check - >= ERTS_SHORT_TIME_CORRECTION_CHECK - ERTS_MONOTONIC_TIME_UNIT) - && time_sup.inf.c.parmon.cdata.short_check_interval > 0) { - time_sup.inf.c.parmon.cdata.short_check_interval--; - } - time_sup.inf.c.parmon.cdata.last_check = os_mtime; - - if (new_correction.error == 0) - timeout = ERTS_MONOTONIC_TO_MSEC(ERTS_LONG_TIME_CORRECTION_CHECK); - else { - ErtsMonotonicTime ecorr = new_correction.error; - ErtsMonotonicTime abs_sdiff; - abs_sdiff = (sdiff < 0) ? -1*sdiff : sdiff; - if (ecorr < 0) - ecorr = -1*ecorr; - if (abs_sdiff > ecorr*(ERTS_LONG_TIME_CORRECTION_CHECK/ERTS_TCORR_ERR_UNIT)) - timeout = ERTS_MONOTONIC_TO_MSEC(ERTS_LONG_TIME_CORRECTION_CHECK); - else { - timeout = ERTS_MONOTONIC_TO_MSEC((ERTS_TCORR_ERR_UNIT*abs_sdiff)/ecorr); - if (timeout < 10) - timeout = 10; + if (done) { + hr_last_correction_check = curr; } } - - if (timeout > ERTS_MONOTONIC_TO_MSEC(ERTS_SHORT_TIME_CORRECTION_CHECK) - && (time_sup.inf.c.parmon.cdata.short_check_interval - || time_sup.inf.c.parmon.cdata.drift.dirty_counter >= 0)) { - timeout = ERTS_MONOTONIC_TO_MSEC(ERTS_SHORT_TIME_CORRECTION_CHECK); + tv->tv_sec += (int) (diff_time / ((SysHrTime) 1000000)); + tv->tv_usec += (int) (diff_time % ((SysHrTime) 1000000)); + if (tv->tv_usec >= 1000000) { + tv->tv_usec -= 1000000; + tv->tv_sec += 1; } - - timeout_pos = get_timeout_pos(erl_mtime, timeout); - -#ifdef ERTS_TIME_CORRECTION_PRINT - print_correction(set_new_correction, - sdiff, - ci.correction.error, - ci.correction.drift, - new_correction.error, - new_correction.drift, - timeout); -#endif - - if (set_new_correction) { - erts_smp_rwmtx_rwlock(&time_sup.inf.c.parmon.rwmtx); - - os_mtime = erts_os_monotonic_time(); - - /* Save previous correction instance */ - time_sup.inf.c.parmon.cdata.insts.prev = ci; - - /* - * Current correction instance begin when - * OS monotonic time has increased two units. - */ - os_mtime += 2; - - /* - * Erlang monotonic time corresponding to - * next OS monotonic time using previous - * correction. - */ - erl_mtime = calc_corrected_erl_mtime(os_mtime, &ci, NULL, - os_drift_corrected); - - /* - * Save new current correction instance. - */ - time_sup.inf.c.parmon.cdata.insts.curr.erl_mtime = erl_mtime; - time_sup.inf.c.parmon.cdata.insts.curr.os_mtime = os_mtime; - time_sup.inf.c.parmon.cdata.insts.curr.correction = new_correction; - - erts_smp_rwmtx_rwunlock(&time_sup.inf.c.parmon.rwmtx); - } - - if (!esdp) - esdp = erts_get_scheduler_data(); - - erts_twheel_set_timer(esdp->timer_wheel, - &time_sup.inf.c.parmon.timer, - check_time_correction, - NULL, - (void *) esdp, - timeout_pos); + hr_last_time = curr; } -static ErtsMonotonicTime get_os_corrected_time(void) -{ - ASSERT(time_sup.r.o.warp_mode == ERTS_MULTI_TIME_WARP_MODE); - return erts_os_monotonic_time() + time_sup.r.o.moffset; -} +#define correction (hr_correction/1000000) -static void -check_time_offset(void *vesdp) -{ - ErtsSchedulerData *esdp = (ErtsSchedulerData *) vesdp; - ErtsMonotonicTime sdiff, os_mtime, erl_mtime, os_stime, - erl_stime, time_offset, timeout, timeout_pos; - - ASSERT(time_sup.r.o.warp_mode == ERTS_MULTI_TIME_WARP_MODE); +#else /* !HAVE_GETHRTIME */ +#if !defined(CORRECT_USING_TIMES) +#define init_tolerant_timeofday() +#define get_tolerant_timeofday(tvp) sys_gettimeofday(tvp) +#else - erts_os_times(&os_mtime, &os_stime); +typedef Sint64 Milli; - erl_mtime = os_mtime + time_sup.r.o.moffset; - time_offset = get_time_offset(); - erl_stime = erl_mtime + time_offset; +static clock_t init_ct; +static Sint64 ct_wrap; +static Milli init_tv_m; +static Milli correction_supress; +static Milli last_ct_diff; +static Milli last_cc; +static clock_t last_ct; + +/* sys_times() might need to be wrapped and the values shifted (right) + a bit to cope with newer linux (2.5.*) kernels, this has to be taken care + of dynamically to start with, a special version that uses + the times() return value as a high resolution timer can be made + to fully utilize the faster ticks, like on windows, but for now, we'll + settle with this silly workaround */ +#ifdef ERTS_WRAP_SYS_TIMES +#define KERNEL_TICKS() (sys_times_wrap() & \ + ((1UL << ((sizeof(clock_t) * 8) - 1)) - 1)) +#else +SysTimes dummy_tms; - sdiff = erl_stime - os_stime; +#define KERNEL_TICKS() (sys_times(&dummy_tms) & \ + ((1UL << ((sizeof(clock_t) * 8) - 1)) - 1)) - if ((sdiff < -2*time_sup.r.o.adj.small_diff - || 2*time_sup.r.o.adj.small_diff < sdiff)) { - /* System time diff exeeded limits; change time offset... */ -#ifdef ERTS_TIME_CORRECTION_PRINT - erts_fprintf(stderr, "sdiff = %b64d nsec -> 0 nsec\n", - ERTS_MONOTONIC_TO_NSEC(sdiff)); -#endif - time_offset -= sdiff; - sdiff = 0; - set_time_offset(time_offset); - schedule_send_time_offset_changed_notifications(time_offset); - } -#ifdef ERTS_TIME_CORRECTION_PRINT - else erts_fprintf(stderr, "sdiff = %b64d nsec\n", - ERTS_MONOTONIC_TO_NSEC(sdiff)); #endif - timeout = ERTS_MONOTONIC_TO_MSEC(ERTS_LONG_TIME_CORRECTION_CHECK); - timeout_pos = get_timeout_pos(erl_mtime, timeout); - - erts_twheel_set_timer(esdp->timer_wheel, - &time_sup.inf.c.parmon.timer, - check_time_offset, - NULL, - vesdp, - timeout_pos); -} - -static void -init_check_time_correction(void *vesdp) +static void init_tolerant_timeofday(void) { - ErtsMonotonicDriftData *ddp; - ErtsMonotonicTime old_mtime, old_stime, mtime, stime, mtime_diff, - stime_diff, smtime_diff, max_drift; - int ix; - - ddp = &time_sup.inf.c.parmon.cdata.drift; - ix = ddp->ix; - old_mtime = ddp->intervals[0].time.mon; - old_stime = ddp->intervals[0].time.sys; - - erts_os_times(&mtime, &stime); - - mtime_diff = mtime - old_mtime; - stime_diff = stime - old_stime; - smtime_diff = stime_diff - mtime_diff; - - max_drift = ERTS_MAX_MONOTONIC_DRIFT; - max_drift *= ERTS_MONOTONIC_TO_SEC(mtime_diff); - - if (smtime_diff > time_sup.r.o.drift_adj.error + max_drift - || smtime_diff < -1*time_sup.r.o.drift_adj.error - max_drift) { - /* Had a system time leap... pretend no drift... */ - stime_diff = mtime_diff; - } - - /* - * We use old time values in order to trigger - * a drift adjustment, and repeat this interval - * in all slots... - */ - for (ix = 0; ix < time_sup.r.o.drift_adj.intervals; ix++) { - ddp->intervals[ix].diff.mon = mtime_diff; - ddp->intervals[ix].diff.sys = stime_diff; - ddp->intervals[ix].time.mon = old_mtime; - ddp->intervals[ix].time.sys = old_stime; - } - - ddp->acc.sys = stime_diff*time_sup.r.o.drift_adj.intervals; - ddp->acc.mon = mtime_diff*time_sup.r.o.drift_adj.intervals; - ddp->ix = 0; - ddp->dirty_counter = time_sup.r.o.drift_adj.intervals; - - check_time_correction(vesdp); + last_ct = init_ct = KERNEL_TICKS(); + last_cc = 0; + init_tv_m = (((Milli) inittv.tv_sec) * 1000) + + (inittv.tv_usec / 1000); + ct_wrap = 0; + correction_supress = 0; } -static ErtsMonotonicTime -finalize_corrected_time_offset(ErtsSystemTime *stimep) -{ - ErtsMonotonicTime os_mtime; - ErtsMonotonicCorrectionInstance ci; - int os_drift_corrected = time_sup.r.o.os_corrected_monotonic_time; - - erts_smp_rwmtx_rlock(&time_sup.inf.c.parmon.rwmtx); - - erts_os_times(&os_mtime, stimep); - - ci = time_sup.inf.c.parmon.cdata.insts.curr; - - erts_smp_rwmtx_runlock(&time_sup.inf.c.parmon.rwmtx); - - if (os_mtime < ci.os_mtime) - erl_exit(ERTS_ABORT_EXIT, - "OS monotonic time stepped backwards\n"); - - return calc_corrected_erl_mtime(os_mtime, &ci, NULL, - os_drift_corrected); -} -static void -late_init_time_correction(ErtsSchedulerData *esdp) +static void get_tolerant_timeofday(SysTimeval *tvp) { - int quick_init_drift_adj; - void (*check_func)(void *); - ErtsMonotonicTime timeout, timeout_pos; - - quick_init_drift_adj = - ERTS_MONOTONIC_TO_USEC(time_sup.r.o.drift_adj.error) == 0; + clock_t current_ct; + SysTimeval current_tv; + Milli ct_diff; + Milli tv_diff; + Milli current_correction; + Milli act_correction; /* long shown to be too small */ + Milli max_adjust; - if (quick_init_drift_adj) - timeout = ERTS_MONOTONIC_TO_MSEC(ERTS_SHORT_TIME_CORRECTION_CHECK/10); - else - timeout = ERTS_MONOTONIC_TO_MSEC(ERTS_SHORT_TIME_CORRECTION_CHECK); - - if (!time_sup.r.o.os_corrected_monotonic_time) - check_func = init_check_time_correction; - else if (time_sup.r.o.get_time == get_os_corrected_time) { - quick_init_drift_adj = 0; - check_func = check_time_offset; + if (erts_disable_tolerant_timeofday) { + sys_gettimeofday(tvp); + return; } - else - check_func = check_time_correction; - - timeout_pos = get_timeout_pos(erts_get_monotonic_time(esdp), - timeout); - - erts_twheel_init_timer(&time_sup.inf.c.parmon.timer); - erts_twheel_set_timer(esdp->timer_wheel, - &time_sup.inf.c.parmon.timer, - check_func, - NULL, - (quick_init_drift_adj - ? NULL - : esdp), - timeout_pos); -} - -#endif /* ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT */ -static ErtsMonotonicTime get_not_corrected_time(void) -{ - ErtsMonotonicTime stime, mtime; +#ifdef ERTS_WRAP_SYS_TIMES +#define TICK_MS (1000 / SYS_CLK_TCK_WRAP) +#else +#define TICK_MS (1000 / SYS_CLK_TCK) +#endif + current_ct = KERNEL_TICKS(); + sys_gettimeofday(¤t_tv); - erts_smp_mtx_lock(&erts_get_time_mtx); + /* I dont know if uptime can move some units backwards + on some systems, but I allow for small backward + jumps to avoid such problems if they exist...*/ + if (last_ct > 100 && current_ct < (last_ct - 100)) { + ct_wrap += ((Sint64) 1) << ((sizeof(clock_t) * 8) - 1); + } + last_ct = current_ct; + ct_diff = ((ct_wrap + current_ct) - init_ct) * TICK_MS; - stime = erts_os_system_time(); + /* + * We will adjust the time in milliseconds and we allow for 1% + * adjustments, but if this function is called more often then every 100 + * millisecond (which is obviously possible), we will never adjust, so + * we accumulate small times by setting last_ct_diff iff max_adjust > 0 + */ + if ((max_adjust = (ct_diff - last_ct_diff)/100) > 0) + last_ct_diff = ct_diff; - mtime = stime - time_sup.inf.c.not_corrected_moffset; + tv_diff = ((((Milli) current_tv.tv_sec) * 1000) + + (current_tv.tv_usec / 1000)) - init_tv_m; - if (mtime >= time_sup.f.c.last_not_corrected_time) - time_sup.f.c.last_not_corrected_time = mtime; - else { - mtime = time_sup.f.c.last_not_corrected_time; + current_correction = ((ct_diff - tv_diff) / TICK_MS) * TICK_MS; /* trunc */ - if (time_sup.r.o.warp_mode == ERTS_MULTI_TIME_WARP_MODE) { - ErtsMonotonicTime new_offset = stime - mtime; - new_offset = ERTS_MONOTONIC_TO_USEC(new_offset); - new_offset = ERTS_USEC_TO_MONOTONIC(new_offset); - if (time_sup.inf.c.not_corrected_moffset != new_offset) { - time_sup.inf.c.not_corrected_moffset = new_offset; - set_time_offset(new_offset); - schedule_send_time_offset_changed_notifications(new_offset); + /* + * We allow the current_correction value to wobble a little, as it + * suffers from the low resolution of the kernel ticks. + * if it hasn't changed more than one tick in either direction, + * we will keep the old value. + */ + if ((last_cc > current_correction + TICK_MS) || + (last_cc < current_correction - TICK_MS)) { + last_cc = current_correction; + } else { + current_correction = last_cc; + } + + /* + * As time goes, we try to get the actual correction to 0, + * that is, make erlangs time correspond to the systems dito. + * The act correction is what we seem to need (current_correction) + * minus the correction suppression. The correction supression + * will change slowly (max 1% of elapsed time) but in millisecond steps. + */ + act_correction = current_correction - correction_supress; + if (max_adjust > 0) { + /* + * Here we slowly adjust erlangs time to correspond with the + * system time by changing the correction_supress variable. + * It can change max_adjust milliseconds which is 1% of elapsed time + */ + if (act_correction > 0) { + if (current_correction - correction_supress > max_adjust) { + correction_supress += max_adjust; + } else { + correction_supress = current_correction; } + act_correction = current_correction - correction_supress; + } else if (act_correction < 0) { + if (correction_supress - current_correction > max_adjust) { + correction_supress -= max_adjust; + } else { + correction_supress = current_correction; + } + act_correction = current_correction - correction_supress; } - } + /* + * The actual correction will correct the timeval so that system + * time warps gets smothed down. + */ + current_tv.tv_sec += act_correction / 1000; + current_tv.tv_usec += (act_correction % 1000) * 1000; - ASSERT(stime == mtime + time_sup.inf.c.not_corrected_moffset); - - erts_smp_mtx_unlock(&erts_get_time_mtx); - - return mtime; + if (current_tv.tv_usec >= 1000000) { + ++current_tv.tv_sec ; + current_tv.tv_usec -= 1000000; + } else if (current_tv.tv_usec < 0) { + --current_tv.tv_sec; + current_tv.tv_usec += 1000000; + } + *tvp = current_tv; +#undef TICK_MS } -int erts_check_time_adj_support(int time_correction, - ErtsTimeWarpMode time_warp_mode) -{ - if (!time_correction) - return 1; - - /* User wants time correction */ +#endif /* CORRECT_USING_TIMES */ +#endif /* !HAVE_GETHRTIME */ -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - return !time_sup.r.o.os_monotonic_time_disable; +/* +** Why this? Well, most platforms have a constant clock resolution of 1, +** we dont want the deliver_time/time_remaining routines to waste +** time dividing and multiplying by/with a variable that's always one. +** so the return value of sys_init_time is ignored on those platforms. +*/ + +#ifndef SYS_CLOCK_RESOLUTION +static int clock_resolution; +#define CLOCK_RESOLUTION clock_resolution #else - return 0; +#define CLOCK_RESOLUTION SYS_CLOCK_RESOLUTION #endif -} -int -erts_has_time_correction(void) +/* +** The clock resolution should really be the resolution of the +** time function in use, which on most platforms +** is 1. On VxWorks the resolution should be +** the number of ticks per second (or 1, which would work nicely to). +** +** Setting lower resolutions is mostly interesting when timers are used +** instead of something like select. +*/ + +static SysTimeval last_delivered; + +static void init_erts_deliver_time(const SysTimeval *inittv) { - return time_sup.r.o.correction; + /* We set the initial values for deliver_time here */ + last_delivered = *inittv; + last_delivered.tv_usec = 1000 * (last_delivered.tv_usec / 1000); + /* ms resolution */ } -void erts_init_sys_time_sup(void) +static void do_erts_deliver_time(const SysTimeval *current) { - ErtsSysInitTimeResult sys_init_time_res - = ERTS_SYS_INIT_TIME_RESULT_INITER; + SysTimeval cur_time; + erts_time_t elapsed; + + /* calculate and deliver appropriate number of ticks */ + cur_time = *current; + cur_time.tv_usec = 1000 * (cur_time.tv_usec / 1000); /* ms resolution */ + elapsed = (1000 * (cur_time.tv_sec - last_delivered.tv_sec) + + (cur_time.tv_usec - last_delivered.tv_usec) / 1000) / + CLOCK_RESOLUTION; + + /* Sometimes the time jump backwards, + resulting in a negative elapsed time. We compensate for + this by simply pretend as if the time stood still. :) */ - sys_init_time(&sys_init_time_res); + if (elapsed > 0) { - erts_time_sup__.r.o.monotonic_time_unit - = sys_init_time_res.os_monotonic_time_unit; + ASSERT(elapsed < ((erts_time_t) ERTS_SHORT_TIME_T_MAX)); -#ifndef SYS_CLOCK_RESOLUTION - erts_time_sup__.r.o.clktck_resolution - = sys_init_time_res.sys_clock_resolution; - erts_time_sup__.r.o.clktck_resolution *= 1000; -#endif - -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - time_sup.r.o.os_monotonic_time_disable - = !sys_init_time_res.have_os_monotonic_time; - time_sup.r.o.os_corrected_monotonic_time = - sys_init_time_res.have_corrected_os_monotonic_time; - time_sup.r.o.os_monotonic_time_func - = sys_init_time_res.os_monotonic_time_info.func; - time_sup.r.o.os_monotonic_time_clock_id - = sys_init_time_res.os_monotonic_time_info.clock_id; - time_sup.r.o.os_monotonic_time_locked - = sys_init_time_res.os_monotonic_time_info.locked_use; - time_sup.r.o.os_monotonic_time_resolution - = sys_init_time_res.os_monotonic_time_info.resolution; - time_sup.r.o.os_monotonic_time_extended - = sys_init_time_res.os_monotonic_time_info.extended; -#endif - time_sup.r.o.os_system_time_func - = sys_init_time_res.os_system_time_info.func; - time_sup.r.o.os_system_time_clock_id - = sys_init_time_res.os_system_time_info.clock_id; - time_sup.r.o.os_system_time_locked - = sys_init_time_res.os_system_time_info.locked_use; - time_sup.r.o.os_system_time_resolution - = sys_init_time_res.os_system_time_info.resolution; + erts_do_time_add((erts_short_time_t) elapsed); + last_delivered = cur_time; + } } int -erts_init_time_sup(int time_correction, ErtsTimeWarpMode time_warp_mode) +erts_init_time_sup(void) { - ErtsMonotonicTime resolution, ilength, intervals, short_isecs; -#if !ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT - ErtsMonotonicTime abs_native_offset, native_offset; -#endif - - erts_hl_timer_init(); - - ASSERT(ERTS_MONOTONIC_TIME_MIN < ERTS_MONOTONIC_TIME_MAX); - erts_smp_mtx_init(&erts_timeofday_mtx, "timeofday"); - erts_smp_mtx_init(&erts_get_time_mtx, "get_time"); - - time_sup.r.o.correction = time_correction; - time_sup.r.o.warp_mode = time_warp_mode; - - if (time_warp_mode == ERTS_SINGLE_TIME_WARP_MODE) - erts_smp_atomic32_init_nob(&time_sup.inf.c.preliminary_offset, 1); - else - erts_smp_atomic32_init_nob(&time_sup.inf.c.preliminary_offset, 0); - time_sup.inf.c.shadow_offset = 0; - -#if !ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT - - /* - * NOTE! erts_time_sup__.r.o.start *need* to be a multiple - * of ERTS_MONOTONIC_TIME_UNIT. - */ - -#ifdef ARCH_32 - erts_time_sup__.r.o.start = ((((ErtsMonotonicTime) 1) << 32)-1); - erts_time_sup__.r.o.start /= ERTS_MONOTONIC_TIME_UNIT; - erts_time_sup__.r.o.start *= ERTS_MONOTONIC_TIME_UNIT; - erts_time_sup__.r.o.start += ERTS_MONOTONIC_TIME_UNIT; - native_offset = erts_time_sup__.r.o.start - ERTS_MONOTONIC_BEGIN; - abs_native_offset = native_offset; -#else /* ARCH_64 */ - if (ERTS_MONOTONIC_TIME_UNIT <= 10*1000*1000) { - erts_time_sup__.r.o.start = 0; - native_offset = -ERTS_MONOTONIC_BEGIN; - abs_native_offset = ERTS_MONOTONIC_BEGIN; - } - else { - erts_time_sup__.r.o.start = ((ErtsMonotonicTime) MIN_SMALL); - erts_time_sup__.r.o.start /= ERTS_MONOTONIC_TIME_UNIT; - erts_time_sup__.r.o.start *= ERTS_MONOTONIC_TIME_UNIT; - native_offset = erts_time_sup__.r.o.start - ERTS_MONOTONIC_BEGIN; - abs_native_offset = -1*native_offset; - } -#endif - - erts_time_sup__.r.o.start_offset.native = native_offset; - erts_time_sup__.r.o.start_offset.nsec = (ErtsMonotonicTime) - erts_time_unit_conversion((Uint64) abs_native_offset, - (Uint32) ERTS_MONOTONIC_TIME_UNIT, - (Uint32) 1000*1000*1000); - erts_time_sup__.r.o.start_offset.usec = (ErtsMonotonicTime) - erts_time_unit_conversion((Uint64) abs_native_offset, - (Uint32) ERTS_MONOTONIC_TIME_UNIT, - (Uint32) 1000*1000); - erts_time_sup__.r.o.start_offset.msec = (ErtsMonotonicTime) - erts_time_unit_conversion((Uint64) abs_native_offset, - (Uint32) ERTS_MONOTONIC_TIME_UNIT, - (Uint32) 1000); - erts_time_sup__.r.o.start_offset.sec = (ErtsMonotonicTime) - erts_time_unit_conversion((Uint64) abs_native_offset, - (Uint32) ERTS_MONOTONIC_TIME_UNIT, - (Uint32) 1); - if (native_offset < 0) { - erts_time_sup__.r.o.start_offset.nsec *= -1; - erts_time_sup__.r.o.start_offset.usec *= -1; - erts_time_sup__.r.o.start_offset.msec *= -1; - erts_time_sup__.r.o.start_offset.sec *= -1; - } - -#endif - - resolution = time_sup.r.o.os_system_time_resolution; -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - if (resolution > time_sup.r.o.os_monotonic_time_resolution) - resolution = time_sup.r.o.os_monotonic_time_resolution; -#endif - - time_sup.r.o.adj.large_diff = erts_time_sup__.r.o.monotonic_time_unit; - time_sup.r.o.adj.large_diff *= 50; - time_sup.r.o.adj.large_diff /= resolution; - if (time_sup.r.o.adj.large_diff < ERTS_USEC_TO_MONOTONIC(500)) - time_sup.r.o.adj.large_diff = ERTS_USEC_TO_MONOTONIC(500); - time_sup.r.o.adj.small_diff = time_sup.r.o.adj.large_diff/10; - - time_sup.r.o.drift_adj.resolution = resolution; - - if (time_sup.r.o.os_corrected_monotonic_time) { - time_sup.r.o.drift_adj.use_avg = 0; - time_sup.r.o.drift_adj.intervals = 0; - time_sup.r.o.drift_adj.error = 0; - time_sup.inf.c.parmon.cdata.drift.dirty_counter = -1; - } - else { - /* - * Calculate length of the interval in seconds needed - * in order to get an error that is at most 1 micro second. - * If this interval is longer than the short time correction - * check interval we use the average of all values instead - * of the latest value. - */ - short_isecs = ERTS_MONOTONIC_TO_SEC(ERTS_SHORT_TIME_CORRECTION_CHECK); - ilength = ERTS_ASSUMED_PRECISION_DROP * ERTS_MONOTONIC_TIME_UNIT; - ilength /= (resolution * ERTS_USEC_TO_MONOTONIC(1)); - time_sup.r.o.drift_adj.use_avg = ilength > short_isecs; - - if (ilength == 0) - intervals = 5; - else { - intervals = ilength / short_isecs; - if (intervals > ERTS_MAX_DRIFT_INTERVALS) - intervals = ERTS_MAX_DRIFT_INTERVALS; - else if (intervals < 5) - intervals = 5; - } - time_sup.r.o.drift_adj.intervals = (int) intervals; - - /* - * drift_adj.error equals maximum assumed error - * over a short time interval. We use this value also - * when examining a large interval. In this case the - * error will be smaller, but we do not want to - * recalculate this over and over again. - */ - time_sup.r.o.drift_adj.error = ERTS_MONOTONIC_TIME_UNIT; - time_sup.r.o.drift_adj.error *= ERTS_ASSUMED_PRECISION_DROP; - time_sup.r.o.drift_adj.error /= resolution * short_isecs; - } -#ifdef ERTS_TIME_CORRECTION_PRINT - erts_fprintf(stderr, "resolution = %b64d\n", resolution); - erts_fprintf(stderr, "adj large diff = %b64d usec\n", - ERTS_MONOTONIC_TO_USEC(time_sup.r.o.adj.large_diff)); - erts_fprintf(stderr, "adj small diff = %b64d usec\n", - ERTS_MONOTONIC_TO_USEC(time_sup.r.o.adj.small_diff)); - if (!time_sup.r.o.os_corrected_monotonic_time) { - erts_fprintf(stderr, "drift intervals = %d\n", - time_sup.r.o.drift_adj.intervals); - erts_fprintf(stderr, "drift adj error = %b64d usec\n", - ERTS_MONOTONIC_TO_USEC(time_sup.r.o.drift_adj.error)); - erts_fprintf(stderr, "drift adj max diff = %b64d nsec\n", - ERTS_MONOTONIC_TO_NSEC(ERTS_TIME_DRIFT_MAX_ADJ_DIFF)); - erts_fprintf(stderr, "drift adj min diff = %b64d nsec\n", - ERTS_MONOTONIC_TO_NSEC(ERTS_TIME_DRIFT_MIN_ADJ_DIFF)); - } -#endif + init_approx_time(); - if (ERTS_MONOTONIC_TIME_UNIT < ERTS_CLKTCK_RESOLUTION) - ERTS_INTERNAL_ERROR("Too small monotonic time time unit"); + last_emu_time.tv_sec = 0; + last_emu_time.tv_usec = 0; -#ifndef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - time_sup.r.o.correction = 0; +#ifndef SYS_CLOCK_RESOLUTION + clock_resolution = sys_init_time(); #else - if (time_sup.r.o.os_monotonic_time_disable) - time_sup.r.o.correction = 0; - - if (time_sup.r.o.correction) { - ErtsMonotonicCorrectionData *cdatap; - erts_smp_rwmtx_opt_t rwmtx_opts = ERTS_SMP_RWMTX_OPT_DEFAULT_INITER; - ErtsMonotonicTime offset; - erts_os_times(&time_sup.inf.c.minit, - &time_sup.inf.c.sinit); - time_sup.r.o.moffset = -1*time_sup.inf.c.minit; - time_sup.r.o.moffset += ERTS_MONOTONIC_BEGIN; - offset = time_sup.inf.c.sinit; - offset -= ERTS_MONOTONIC_BEGIN; - init_time_offset(offset); - - rwmtx_opts.type = ERTS_SMP_RWMTX_TYPE_EXTREMELY_FREQUENT_READ; - rwmtx_opts.lived = ERTS_SMP_RWMTX_LONG_LIVED; - - erts_smp_rwmtx_init_opt(&time_sup.inf.c.parmon.rwmtx, - &rwmtx_opts, "get_corrected_time"); - - cdatap = &time_sup.inf.c.parmon.cdata; - - cdatap->drift.intervals[0].time.sys = time_sup.inf.c.sinit; - cdatap->drift.intervals[0].time.mon = time_sup.inf.c.minit; - cdatap->insts.curr.correction.drift = 0; - cdatap->insts.curr.correction.error = 0; - cdatap->insts.curr.erl_mtime = ERTS_MONOTONIC_BEGIN; - cdatap->insts.curr.os_mtime = time_sup.inf.c.minit; - cdatap->last_check = time_sup.inf.c.minit; - cdatap->short_check_interval = ERTS_INIT_SHORT_INTERVAL_COUNTER; - cdatap->insts.prev = cdatap->insts.curr; - - if (!time_sup.r.o.os_corrected_monotonic_time) - time_sup.r.o.get_time = get_corrected_time; - else if (time_sup.r.o.warp_mode == ERTS_MULTI_TIME_WARP_MODE) - time_sup.r.o.get_time = get_os_corrected_time; - else - time_sup.r.o.get_time = get_os_drift_corrected_time; - } - else -#endif - { - ErtsMonotonicTime stime, offset; - time_sup.r.o.get_time = get_not_corrected_time; - stime = time_sup.inf.c.sinit = erts_os_system_time(); - offset = stime - ERTS_MONOTONIC_BEGIN; - time_sup.inf.c.not_corrected_moffset = offset; - init_time_offset(offset); - time_sup.f.c.last_not_corrected_time = 0; - } - - prev_wall_clock_elapsed = 0; - - previous_now = ERTS_MONOTONIC_TO_USEC(get_time_offset()); - -#ifdef DEBUG - time_sup_initialized = 1; + (void) sys_init_time(); #endif - - return ERTS_CLKTCK_RESOLUTION/1000; -} - -void -erts_late_init_time_sup(void) -{ - erts_late_sys_init_time(); -} - -void -erts_sched_init_time_sup(ErtsSchedulerData *esdp) -{ - esdp->timer_wheel = erts_create_timer_wheel(esdp); - esdp->next_tmo_ref = erts_get_next_timeout_reference(esdp->timer_wheel); - esdp->timer_service = erts_create_timer_service(); -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - if (esdp->no == 1) { - /* A timer wheel to use must have beeen initialized */ - if (time_sup.r.o.get_time != get_not_corrected_time) - late_init_time_correction(esdp); - } -#endif -} - -ErtsTimeWarpMode erts_time_warp_mode(void) -{ - return time_sup.r.o.warp_mode; -} - -ErtsTimeOffsetState erts_time_offset_state(void) -{ - switch (time_sup.r.o.warp_mode) { - case ERTS_NO_TIME_WARP_MODE: - return ERTS_TIME_OFFSET_FINAL; - case ERTS_SINGLE_TIME_WARP_MODE: - if (erts_smp_atomic32_read_nob(&time_sup.inf.c.preliminary_offset)) - return ERTS_TIME_OFFSET_PRELIMINARY; - return ERTS_TIME_OFFSET_FINAL; - case ERTS_MULTI_TIME_WARP_MODE: - return ERTS_TIME_OFFSET_VOLATILE; - default: - ERTS_INTERNAL_ERROR("Invalid time warp mode"); - return ERTS_TIME_OFFSET_VOLATILE; - } -} - -/* - * erts_finalize_time_offset() will only change time offset - * the first time it is called when the emulator has been - * started in "single time warp" mode. Returns previous - * state: - * * ERTS_TIME_OFFSET_PRELIMINARY - Finalization performed - * * ERTS_TIME_OFFSET_FINAL - Already finialized; nothing changed - * * ERTS_TIME_OFFSET_VOLATILE - Not supported, either in - * * no correction mode (or multi time warp mode; not yet implemented). - */ - -ErtsTimeOffsetState -erts_finalize_time_offset(void) -{ - switch (time_sup.r.o.warp_mode) { - case ERTS_NO_TIME_WARP_MODE: - return ERTS_TIME_OFFSET_FINAL; - case ERTS_MULTI_TIME_WARP_MODE: - return ERTS_TIME_OFFSET_VOLATILE; - case ERTS_SINGLE_TIME_WARP_MODE: { - ErtsTimeOffsetState res = ERTS_TIME_OFFSET_FINAL; - - erts_smp_mtx_lock(&erts_get_time_mtx); - - if (erts_smp_atomic32_read_nob(&time_sup.inf.c.preliminary_offset)) { - ErtsMonotonicTime mtime, new_offset; - -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - if (!time_sup.r.o.correction) -#endif - { - ErtsMonotonicTime stime = erts_os_system_time(); - - mtime = stime - time_sup.inf.c.not_corrected_moffset; - - if (mtime >= time_sup.f.c.last_not_corrected_time) { - time_sup.f.c.last_not_corrected_time = mtime; - new_offset = time_sup.inf.c.not_corrected_moffset; - } - else { - mtime = time_sup.f.c.last_not_corrected_time; - - ASSERT(time_sup.inf.c.not_corrected_moffset != stime - mtime); - new_offset = stime - mtime; - time_sup.inf.c.not_corrected_moffset = new_offset; - } - - } -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - else { - ErtsSystemTime stime; - mtime = finalize_corrected_time_offset(&stime); - new_offset = stime - mtime; - } + sys_gettimeofday(&inittv); + +#ifdef HAVE_GETHRTIME + sys_init_hrtime(); #endif - new_offset = ERTS_MONOTONIC_TO_USEC(new_offset); - new_offset = ERTS_USEC_TO_MONOTONIC(new_offset); - - set_time_offset(new_offset); - schedule_send_time_offset_changed_notifications(new_offset); - - erts_smp_atomic32_set_nob(&time_sup.inf.c.preliminary_offset, 0); - res = ERTS_TIME_OFFSET_PRELIMINARY; - } + init_tolerant_timeofday(); - erts_smp_mtx_unlock(&erts_get_time_mtx); + init_erts_deliver_time(&inittv); + gtv = inittv; + then.tv_sec = then.tv_usec = 0; - return res; - } - default: - ERTS_INTERNAL_ERROR("Invalid time warp mode"); - return ERTS_TIME_OFFSET_VOLATILE; - } -} + erts_deliver_time(); + return CLOCK_RESOLUTION; +} /* info functions */ void @@ -1321,17 +498,23 @@ void wall_clock_elapsed_time_both(UWord *ms_total, UWord *ms_diff) { - ErtsMonotonicTime now, elapsed; + UWord prev_total; + SysTimeval tv; erts_smp_mtx_lock(&erts_timeofday_mtx); - now = time_sup.r.o.get_time(); - update_last_mtime(NULL, now); + get_tolerant_timeofday(&tv); + + *ms_total = 1000 * (tv.tv_sec - inittv.tv_sec) + + (tv.tv_usec - inittv.tv_usec) / 1000; - elapsed = ERTS_MONOTONIC_TO_MSEC(now); - *ms_total = (UWord) elapsed; - *ms_diff = (UWord) (elapsed - prev_wall_clock_elapsed); - prev_wall_clock_elapsed = elapsed; + prev_total = 1000 * (gtv.tv_sec - inittv.tv_sec) + + (gtv.tv_usec - inittv.tv_usec) / 1000; + *ms_diff = *ms_total - prev_total; + gtv = tv; + + /* must sync the machine's idea of time here */ + do_erts_deliver_time(&tv); erts_smp_mtx_unlock(&erts_timeofday_mtx); } @@ -1707,566 +890,146 @@ return 0; } + /* get a timestamp */ void get_now(Uint* megasec, Uint* sec, Uint* microsec) { - ErtsMonotonicTime now_megasec, now_sec, now, mtime, time_offset; + SysTimeval now; - mtime = time_sup.r.o.get_time(); - time_offset = get_time_offset(); - update_last_mtime(NULL, mtime); - now = ERTS_MONOTONIC_TO_USEC(mtime + time_offset); - erts_smp_mtx_lock(&erts_timeofday_mtx); + + get_tolerant_timeofday(&now); + do_erts_deliver_time(&now); - /* Make sure now time is later than last time */ - if (now <= previous_now) - now = previous_now + 1; - - previous_now = now; + /* Make sure time is later than last */ + if (then.tv_sec > now.tv_sec || + (then.tv_sec == now.tv_sec && then.tv_usec >= now.tv_usec)) { + now = then; + now.tv_usec++; + } + /* Check for carry from above + general reasonability */ + if (now.tv_usec >= 1000000) { + now.tv_usec = 0; + now.tv_sec++; + } + then = now; erts_smp_mtx_unlock(&erts_timeofday_mtx); + + *megasec = (Uint) (now.tv_sec / 1000000); + *sec = (Uint) (now.tv_sec % 1000000); + *microsec = (Uint) (now.tv_usec); - now_megasec = now / ERTS_MONOTONIC_TIME_TERA; - now_sec = now / ERTS_MONOTONIC_TIME_MEGA; - *megasec = (Uint) now_megasec; - *sec = (Uint) (now_sec - now_megasec*ERTS_MONOTONIC_TIME_MEGA); - *microsec = (Uint) (now - now_sec*ERTS_MONOTONIC_TIME_MEGA); - - ASSERT(((ErtsMonotonicTime) *megasec)*ERTS_MONOTONIC_TIME_TERA - + ((ErtsMonotonicTime) *sec)*ERTS_MONOTONIC_TIME_MEGA - + ((ErtsMonotonicTime) *microsec) == now); -} - -ErtsMonotonicTime -erts_get_monotonic_time(ErtsSchedulerData *esdp) -{ - ErtsMonotonicTime mtime = time_sup.r.o.get_time(); - update_last_mtime(esdp, mtime); - return mtime; + update_approx_time(&now); } void get_sys_now(Uint* megasec, Uint* sec, Uint* microsec) { - ErtsSystemTime stime = erts_os_system_time(); - ErtsSystemTime ms, s, us; - - us = ERTS_MONOTONIC_TO_USEC(stime); - s = us / (1000*1000); - ms = s / (1000*1000); - - *megasec = (Uint) ms; - *sec = (Uint) (s - ms*(1000*1000)); - *microsec = (Uint) (us - s*(1000*1000)); -} - -#ifdef HAVE_ERTS_NOW_CPU -void erts_get_now_cpu(Uint* megasec, Uint* sec, Uint* microsec) { - SysCpuTime t; - SysTimespec tp; + SysTimeval now; + + sys_gettimeofday(&now); + + *megasec = (Uint) (now.tv_sec / 1000000); + *sec = (Uint) (now.tv_sec % 1000000); + *microsec = (Uint) (now.tv_usec); - sys_get_proc_cputime(t, tp); - *microsec = (Uint)(tp.tv_nsec / 1000); - t = (tp.tv_sec / 1000000); - *megasec = (Uint)(t % 1000000); - *sec = (Uint)(tp.tv_sec % 1000000); + update_approx_time(&now); } -#endif -#include "big.h" - -void -erts_monitor_time_offset(Eterm id, Eterm ref) -{ - erts_smp_mtx_lock(&erts_get_time_mtx); - erts_add_monitor(&time_offset_monitors, MON_TIME_OFFSET, ref, id, NIL); - no_time_offset_monitors++; - erts_smp_mtx_unlock(&erts_get_time_mtx); -} - -int -erts_demonitor_time_offset(Eterm ref) -{ - int res; - ErtsMonitor *mon; - ASSERT(is_internal_ref(ref)); - erts_smp_mtx_lock(&erts_get_time_mtx); - mon = erts_remove_monitor(&time_offset_monitors, ref); - if (!mon) - res = 0; - else { - ASSERT(no_time_offset_monitors > 0); - no_time_offset_monitors--; - res = 1; - } - erts_smp_mtx_unlock(&erts_get_time_mtx); - if (res) - erts_destroy_monitor(mon); - return res; -} - -typedef struct { - Eterm pid; - Eterm ref; - Eterm heap[REF_THING_SIZE]; -} ErtsTimeOffsetMonitorInfo; - -typedef struct { - Uint ix; - ErtsTimeOffsetMonitorInfo *to_mon_info; -} ErtsTimeOffsetMonitorContext; - -static void -save_time_offset_monitor(ErtsMonitor *mon, void *vcntxt) -{ - ErtsTimeOffsetMonitorContext *cntxt; - Eterm *from_hp, *to_hp; - Uint mix; - int hix; - - cntxt = (ErtsTimeOffsetMonitorContext *) vcntxt; - mix = (cntxt->ix)++; - cntxt->to_mon_info[mix].pid = mon->pid; - to_hp = &cntxt->to_mon_info[mix].heap[0]; - - ASSERT(is_internal_ref(mon->ref)); - from_hp = internal_ref_val(mon->ref); - ASSERT(thing_arityval(*from_hp) + 1 == REF_THING_SIZE); - for (hix = 0; hix < REF_THING_SIZE; hix++) - to_hp[hix] = from_hp[hix]; +/* deliver elapsed *ticks* to the machine - takes a pointer + to a struct timeval representing current time (to save + a gettimeofday() where possible) or NULL */ - cntxt->to_mon_info[mix].ref - = make_internal_ref(&cntxt->to_mon_info[mix].heap[0]); +void erts_deliver_time(void) { + SysTimeval now; + + erts_smp_mtx_lock(&erts_timeofday_mtx); + + get_tolerant_timeofday(&now); + do_erts_deliver_time(&now); + + erts_smp_mtx_unlock(&erts_timeofday_mtx); + update_approx_time(&now); } -static void -send_time_offset_changed_notifications(void *new_offsetp) -{ - ErtsMonotonicTime new_offset; - ErtsTimeOffsetMonitorInfo *to_mon_info = NULL; /* Shut up faulty warning */ - Uint no_monitors; - char *tmp = NULL; - -#ifdef ARCH_64 - new_offset = (ErtsMonotonicTime) new_offsetp; -#else - new_offset = *((ErtsMonotonicTime *) new_offsetp); - erts_free(ERTS_ALC_T_NEW_TIME_OFFSET, new_offsetp); -#endif - new_offset -= ERTS_MONOTONIC_OFFSET_NATIVE; - - erts_smp_mtx_lock(&erts_get_time_mtx); - - no_monitors = no_time_offset_monitors; - if (no_monitors) { - ErtsTimeOffsetMonitorContext cntxt; - Uint alloc_sz; +/* get *real* time (not ticks) remaining until next timeout - if there + isn't one, give a "long" time, that is guaranteed + to not cause overflow when we report elapsed time later on */ + +void erts_time_remaining(SysTimeval *rem_time) +{ + erts_time_t ticks; + SysTimeval cur_time; + erts_time_t elapsed; + + /* erts_next_time() returns no of ticks to next timeout or -1 if none */ + + ticks = (erts_time_t) erts_next_time(); + if (ticks == (erts_time_t) -1) { + /* timer queue empty */ + /* this will cause at most 100000000 ticks */ + rem_time->tv_sec = 100000; + rem_time->tv_usec = 0; + } else { + /* next timeout after ticks ticks */ + ticks *= CLOCK_RESOLUTION; - /* Monitor info array size */ - alloc_sz = no_monitors*sizeof(ErtsTimeOffsetMonitorInfo); - /* + template max size */ - alloc_sz += 6*sizeof(Eterm); /* 5-tuple */ - alloc_sz += ERTS_MAX_SINT64_HEAP_SIZE*sizeof(Eterm); /* max offset size */ - tmp = erts_alloc(ERTS_ALC_T_TMP, alloc_sz); - - to_mon_info = (ErtsTimeOffsetMonitorInfo *) tmp; - cntxt.ix = 0; - cntxt.to_mon_info = to_mon_info; - - erts_doforall_monitors(time_offset_monitors, - save_time_offset_monitor, - &cntxt); - - ASSERT(cntxt.ix == no_monitors); - } - - erts_smp_mtx_unlock(&erts_get_time_mtx); - - if (no_monitors) { - Eterm *hp, *patch_refp, new_offset_term, message_template; - Uint mix, hsz; - - /* Make message template */ - - hp = (Eterm *) (tmp + no_monitors*sizeof(ErtsTimeOffsetMonitorInfo)); - - hsz = 6; /* 5-tuple */ - hsz += REF_THING_SIZE; - hsz += ERTS_SINT64_HEAP_SIZE(new_offset); - - if (IS_SSMALL(new_offset)) - new_offset_term = make_small(new_offset); - else - new_offset_term = erts_sint64_to_big(new_offset, &hp); - message_template = TUPLE5(hp, - am_CHANGE, - THE_NON_VALUE, /* Patch point for ref */ - am_time_offset, - am_clock_service, - new_offset_term); - patch_refp = &hp[2]; - - ASSERT(*patch_refp == THE_NON_VALUE); - - for (mix = 0; mix < no_monitors; mix++) { - Process *rp = erts_proc_lookup(to_mon_info[mix].pid); - if (rp) { - Eterm ref = to_mon_info[mix].ref; - ErtsProcLocks rp_locks = ERTS_PROC_LOCK_LINK; - erts_smp_proc_lock(rp, ERTS_PROC_LOCK_LINK); - if (erts_lookup_monitor(ERTS_P_MONITORS(rp), ref)) { - ErlHeapFragment *bp; - ErlOffHeap *ohp; - Eterm message; - - hp = erts_alloc_message_heap(hsz, &bp, &ohp, rp, &rp_locks); - *patch_refp = ref; - ASSERT(hsz == size_object(message_template)); - message = copy_struct(message_template, hsz, &hp, ohp); - erts_queue_message(rp, &rp_locks, bp, message, NIL); - } - erts_smp_proc_unlock(rp, rp_locks); - } + erts_smp_mtx_lock(&erts_timeofday_mtx); + + get_tolerant_timeofday(&cur_time); + cur_time.tv_usec = 1000 * + (cur_time.tv_usec / 1000);/* ms resolution*/ + elapsed = 1000 * (cur_time.tv_sec - last_delivered.tv_sec) + + (cur_time.tv_usec - last_delivered.tv_usec) / 1000; + + erts_smp_mtx_unlock(&erts_timeofday_mtx); + + if (ticks <= elapsed) { /* Ooops, better hurry */ + rem_time->tv_sec = rem_time->tv_usec = 0; + return; } - - erts_free(ERTS_ALC_T_TMP, tmp); + rem_time->tv_sec = (ticks - elapsed) / 1000; + rem_time->tv_usec = 1000 * ((ticks - elapsed) % 1000); } } -static void -schedule_send_time_offset_changed_notifications(ErtsMonotonicTime new_offset) -{ -#ifdef ARCH_64 - void *new_offsetp = (void *) new_offset; - ASSERT(sizeof(void *) == sizeof(ErtsMonotonicTime)); -#else - void *new_offsetp = erts_alloc(ERTS_ALC_T_NEW_TIME_OFFSET, - sizeof(ErtsMonotonicTime)); - *((ErtsMonotonicTime *) new_offsetp) = new_offset; -#endif - erts_schedule_misc_aux_work(1, - send_time_offset_changed_notifications, - new_offsetp); -} - -static ERTS_INLINE Eterm -make_time_val(Process *c_p, ErtsMonotonicTime time_val) -{ - Sint64 val = (Sint64) time_val; - Eterm *hp; - Uint sz; - - if (IS_SSMALL(val)) - return make_small(val); - - sz = ERTS_SINT64_HEAP_SIZE(val); - hp = HAlloc(c_p, sz); - return erts_sint64_to_big(val, &hp); -} - -Eterm -erts_get_monotonic_start_time(struct process *c_p) -{ - return make_time_val(c_p, ERTS_MONOTONIC_TIME_START_EXTERNAL); -} - -Eterm -erts_get_monotonic_end_time(struct process *c_p) -{ - return make_time_val(c_p, ERTS_MONOTONIC_TIME_END_EXTERNAL); -} - -static Eterm -bld_monotonic_time_source(Uint **hpp, Uint *szp, Sint64 os_mtime) +void erts_get_timeval(SysTimeval *tv) { -#ifndef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - return NIL; -#else - int i = 0; - Eterm k[6]; - Eterm v[6]; - - if (time_sup.r.o.os_monotonic_time_disable) - return NIL; - - k[i] = erts_bld_atom(hpp, szp, "function"); - v[i++] = erts_bld_atom(hpp, szp, - time_sup.r.o.os_monotonic_time_func); - - if (time_sup.r.o.os_monotonic_time_clock_id) { - k[i] = erts_bld_atom(hpp, szp, "clock_id"); - v[i++] = erts_bld_atom(hpp, szp, - time_sup.r.o.os_monotonic_time_clock_id); - } - - k[i] = erts_bld_atom(hpp, szp, "resolution"); - v[i++] = erts_bld_uint64(hpp, szp, - time_sup.r.o.os_monotonic_time_resolution); - - k[i] = erts_bld_atom(hpp, szp, "extended"); - v[i++] = time_sup.r.o.os_monotonic_time_extended ? am_yes : am_no; - - k[i] = erts_bld_atom(hpp, szp, "parallel"); - v[i++] = time_sup.r.o.os_monotonic_time_locked ? am_no : am_yes; - - k[i] = erts_bld_atom(hpp, szp, "time"); - v[i++] = erts_bld_sint64(hpp, szp, os_mtime); - - return erts_bld_2tup_list(hpp, szp, (Sint) i, k, v); -#endif -} - -Eterm -erts_monotonic_time_source(struct process *c_p) -{ - Uint hsz = 0; - Eterm *hp = NULL; - Sint64 os_mtime = 0; -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - if (!time_sup.r.o.os_monotonic_time_disable) - os_mtime = (Sint64) erts_os_monotonic_time(); -#endif - - bld_monotonic_time_source(NULL, &hsz, os_mtime); - if (hsz) - hp = HAlloc(c_p, hsz); - return bld_monotonic_time_source(&hp, NULL, os_mtime); + erts_smp_mtx_lock(&erts_timeofday_mtx); + get_tolerant_timeofday(tv); + erts_smp_mtx_unlock(&erts_timeofday_mtx); + update_approx_time(tv); } -static Eterm -bld_system_time_source(Uint **hpp, Uint *szp, Sint64 os_stime) +erts_time_t +erts_get_time(void) { - int i = 0; - Eterm k[5]; - Eterm v[5]; - - k[i] = erts_bld_atom(hpp, szp, "function"); - v[i++] = erts_bld_atom(hpp, szp, - time_sup.r.o.os_system_time_func); - - if (time_sup.r.o.os_system_time_clock_id) { - k[i] = erts_bld_atom(hpp, szp, "clock_id"); - v[i++] = erts_bld_atom(hpp, szp, - time_sup.r.o.os_system_time_clock_id); - } - - k[i] = erts_bld_atom(hpp, szp, "resolution"); - v[i++] = erts_bld_uint64(hpp, szp, - time_sup.r.o.os_system_time_resolution); - - k[i] = erts_bld_atom(hpp, szp, "parallel"); - v[i++] = am_yes; + SysTimeval sys_tv; + + erts_smp_mtx_lock(&erts_timeofday_mtx); + + get_tolerant_timeofday(&sys_tv); + + erts_smp_mtx_unlock(&erts_timeofday_mtx); - k[i] = erts_bld_atom(hpp, szp, "time"); - v[i++] = erts_bld_sint64(hpp, szp, os_stime); + update_approx_time(&sys_tv); - return erts_bld_2tup_list(hpp, szp, (Sint) i, k, v); + return sys_tv.tv_sec; } -Eterm -erts_system_time_source(struct process *c_p) -{ - Uint hsz = 0; - Eterm *hp = NULL; - Sint64 os_stime = (Sint64) erts_os_system_time(); +#ifdef HAVE_ERTS_NOW_CPU +void erts_get_now_cpu(Uint* megasec, Uint* sec, Uint* microsec) { + SysCpuTime t; + SysTimespec tp; - bld_system_time_source(NULL, &hsz, os_stime); - if (hsz) - hp = HAlloc(c_p, hsz); - return bld_system_time_source(&hp, NULL, os_stime); + sys_get_proc_cputime(t, tp); + *microsec = (Uint)(tp.tv_nsec / 1000); + t = (tp.tv_sec / 1000000); + *megasec = (Uint)(t % 1000000); + *sec = (Uint)(tp.tv_sec % 1000000); } - - -#include "bif.h" - -static ERTS_INLINE Eterm -time_unit_conversion(Process *c_p, Eterm term, ErtsMonotonicTime val, ErtsMonotonicTime muloff) -{ - ErtsMonotonicTime result; - BIF_RETTYPE ret; - - if (val < 0) - goto trap_to_erlang_code; - - /* Convert to common user specified time units */ - switch (term) { - case am_seconds: - case make_small(1): - result = ERTS_MONOTONIC_TO_SEC(val) + muloff*ERTS_MONOTONIC_OFFSET_SEC; - ERTS_BIF_PREP_RET(ret, make_time_val(c_p, result)); - break; - case am_milli_seconds: - case make_small(1000): - result = ERTS_MONOTONIC_TO_MSEC(val) + muloff*ERTS_MONOTONIC_OFFSET_MSEC; - ERTS_BIF_PREP_RET(ret, make_time_val(c_p, result)); - break; - case am_micro_seconds: - case make_small(1000*1000): - result = ERTS_MONOTONIC_TO_USEC(val) + muloff*ERTS_MONOTONIC_OFFSET_USEC; - ERTS_BIF_PREP_RET(ret, make_time_val(c_p, result)); - break; -#ifdef ARCH_64 - case am_nano_seconds: - case make_small(1000*1000*1000): - result = ERTS_MONOTONIC_TO_NSEC(val) + muloff*ERTS_MONOTONIC_OFFSET_NSEC; - ERTS_BIF_PREP_RET(ret, make_time_val(c_p, result)); - break; -#endif - default: { - Eterm value, native_res; -#ifndef ARCH_64 - Sint user_res; - if (term == am_nano_seconds) - goto to_nano_seconds; - if (term_to_Sint(term, &user_res)) { - if (user_res == 1000*1000*1000) { - to_nano_seconds: - result = (ERTS_MONOTONIC_TO_NSEC(val) - + muloff*ERTS_MONOTONIC_OFFSET_NSEC); - ERTS_BIF_PREP_RET(ret, make_time_val(c_p, result)); - break; - } - if (user_res <= 0) - goto badarg; - } -#else - if (is_small(term)) { - if (signed_val(term) <= 0) - goto badarg; - } #endif - else if (is_big(term)) { - if (big_sign(term)) - goto badarg; - } - else { - badarg: - ERTS_BIF_PREP_ERROR(ret, c_p, BADARG); - break; - } - - trap_to_erlang_code: - /* Do it in erlang code instead; pass along values to use... */ - value = make_time_val(c_p, val + muloff*ERTS_MONOTONIC_OFFSET_NATIVE); - native_res = make_time_val(c_p, ERTS_MONOTONIC_TIME_UNIT); - - ERTS_BIF_PREP_TRAP3(ret, erts_convert_time_unit_trap, c_p, - value, native_res, term); - - break; - } - } - - return ret; -} - -/* Built in functions */ - -BIF_RETTYPE monotonic_time_0(BIF_ALIST_0) -{ - ErtsMonotonicTime mtime = time_sup.r.o.get_time(); - update_last_mtime(ERTS_PROC_GET_SCHDATA(BIF_P), mtime); - mtime += ERTS_MONOTONIC_OFFSET_NATIVE; - BIF_RET(make_time_val(BIF_P, mtime)); -} - -BIF_RETTYPE monotonic_time_1(BIF_ALIST_1) -{ - ErtsMonotonicTime mtime = time_sup.r.o.get_time(); - update_last_mtime(ERTS_PROC_GET_SCHDATA(BIF_P), mtime); - BIF_RET(time_unit_conversion(BIF_P, BIF_ARG_1, mtime, 1)); -} - -BIF_RETTYPE system_time_0(BIF_ALIST_0) -{ - ErtsMonotonicTime mtime, offset; - mtime = time_sup.r.o.get_time(); - offset = get_time_offset(); - update_last_mtime(ERTS_PROC_GET_SCHDATA(BIF_P), mtime); - BIF_RET(make_time_val(BIF_P, mtime + offset)); -} - -BIF_RETTYPE system_time_1(BIF_ALIST_0) -{ - ErtsMonotonicTime mtime, offset; - mtime = time_sup.r.o.get_time(); - offset = get_time_offset(); - update_last_mtime(ERTS_PROC_GET_SCHDATA(BIF_P), mtime); - BIF_RET(time_unit_conversion(BIF_P, BIF_ARG_1, mtime + offset, 0)); -} - -BIF_RETTYPE erts_internal_time_unit_0(BIF_ALIST_0) -{ - BIF_RET(make_time_val(BIF_P, ERTS_MONOTONIC_TIME_UNIT)); -} - -BIF_RETTYPE time_offset_0(BIF_ALIST_0) -{ - ErtsMonotonicTime time_offset = get_time_offset(); - time_offset -= ERTS_MONOTONIC_OFFSET_NATIVE; - BIF_RET(make_time_val(BIF_P, time_offset)); -} - -BIF_RETTYPE time_offset_1(BIF_ALIST_1) -{ - BIF_RET(time_unit_conversion(BIF_P, BIF_ARG_1, get_time_offset(), -1)); -} - - -BIF_RETTYPE timestamp_0(BIF_ALIST_0) -{ - Eterm *hp, res; - ErtsMonotonicTime stime, mtime, all_sec, offset; - Uint mega_sec, sec, micro_sec; - - mtime = time_sup.r.o.get_time(); - offset = get_time_offset(); - update_last_mtime(ERTS_PROC_GET_SCHDATA(BIF_P), mtime); - stime = ERTS_MONOTONIC_TO_USEC(mtime + offset); - all_sec = stime / ERTS_MONOTONIC_TIME_MEGA; - mega_sec = (Uint) (stime / ERTS_MONOTONIC_TIME_TERA); - sec = (Uint) (all_sec - (((ErtsMonotonicTime) mega_sec) - * ERTS_MONOTONIC_TIME_MEGA)); - micro_sec = (Uint) (stime - all_sec*ERTS_MONOTONIC_TIME_MEGA); - - ASSERT(((ErtsMonotonicTime) mega_sec)*ERTS_MONOTONIC_TIME_TERA - + ((ErtsMonotonicTime) sec)*ERTS_MONOTONIC_TIME_MEGA - + micro_sec == stime); - - /* - * Mega seconds is the only value that potentially - * ever could be a bignum. However, that wont happen - * during at least the next 4 million years... - * - * (System time will also have wrapped in the - * 64-bit integer before we get there...) - */ - - ASSERT(IS_USMALL(0, mega_sec)); - ASSERT(IS_USMALL(0, sec)); - ASSERT(IS_USMALL(0, micro_sec)); - - hp = HAlloc(BIF_P, 4); - res = TUPLE3(hp, - make_small(mega_sec), - make_small(sec), - make_small(micro_sec)); - BIF_RET(res); -} - -BIF_RETTYPE os_system_time_0(BIF_ALIST_0) -{ - ErtsSystemTime stime = erts_os_system_time(); - BIF_RET(make_time_val(BIF_P, stime)); -} - -BIF_RETTYPE os_system_time_1(BIF_ALIST_0) -{ - ErtsSystemTime stime = erts_os_system_time(); - BIF_RET(time_unit_conversion(BIF_P, BIF_ARG_1, stime, 0)); -} - diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_trace.c erlang-17.3-dfsg/erts/emulator/beam/erl_trace.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_trace.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_trace.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -131,9 +130,14 @@ enqueue_sys_msg_unlocked(SYS_MSG_TYPE_TRACE, (FPID), (TPID), (MSG), (BP)); \ } while(0) #else +#ifdef USE_VM_PROBES +#define ERTS_ENQ_TRACE_MSG(FPID, TPROC, MSG, BP) \ + erts_queue_message((TPROC), NULL, (BP), (MSG), NIL, NIL) +#else #define ERTS_ENQ_TRACE_MSG(FPID, TPROC, MSG, BP) \ erts_queue_message((TPROC), NULL, (BP), (MSG), NIL) #endif +#endif /* * NOTE that the ERTS_GET_TRACER_REF() returns from the function (!!!) @@ -632,7 +636,11 @@ hp = erts_alloc_message_heap(sz, &bp, &off_heap, profile_p, 0); msg = copy_struct(message, sz, &hp, &bp->off_heap); - erts_queue_message(profile_p, NULL, bp, msg, NIL); + erts_queue_message(profile_p, NULL, bp, msg, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); } } @@ -1232,8 +1240,11 @@ enqueue_sys_msg_unlocked(SYS_MSG_TYPE_SEQTRACE, NIL, NIL, mess, bp); erts_smp_mtx_unlock(&smq_mtx); #else - /* trace_token must be NIL here */ - erts_queue_message(tracer, NULL, bp, mess, NIL); + erts_queue_message(tracer, NULL, bp, mess, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); /* trace_token must be NIL here */ #endif } } @@ -2214,7 +2225,7 @@ Eterm* limit; #endif - ERTS_CT_ASSERT(sizeof(values)/sizeof(*values) == sizeof(tags)/sizeof(Eterm)); + ASSERT(sizeof(values)/sizeof(*values) == sizeof(tags)/sizeof(Eterm)); UseTmpHeap(LOCAL_HEAP_SIZE,p); @@ -2332,7 +2343,11 @@ #ifdef ERTS_SMP enqueue_sys_msg(SYS_MSG_TYPE_SYSMON, p->common.id, NIL, msg, bp); #else - erts_queue_message(monitor_p, NULL, bp, msg, NIL); + erts_queue_message(monitor_p, NULL, bp, msg, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); #endif } void @@ -2393,7 +2408,11 @@ #ifdef ERTS_SMP enqueue_sys_msg(SYS_MSG_TYPE_SYSMON, pp->common.id, NIL, msg, bp); #else - erts_queue_message(monitor_p, NULL, bp, msg, NIL); + erts_queue_message(monitor_p, NULL, bp, msg, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); #endif } @@ -2464,7 +2483,11 @@ #ifdef ERTS_SMP enqueue_sys_msg(SYS_MSG_TYPE_SYSMON, p->common.id, NIL, msg, bp); #else - erts_queue_message(monitor_p, NULL, bp, msg, NIL); + erts_queue_message(monitor_p, NULL, bp, msg, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); #endif } @@ -2535,7 +2558,11 @@ #ifdef ERTS_SMP enqueue_sys_msg(SYS_MSG_TYPE_SYSMON, p->common.id, NIL, msg, bp); #else - erts_queue_message(monitor_p, NULL, bp, msg, NIL); + erts_queue_message(monitor_p, NULL, bp, msg, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); #endif } @@ -2563,7 +2590,11 @@ #ifdef ERTS_SMP enqueue_sys_msg(SYS_MSG_TYPE_SYSMON, p->common.id, NIL, msg, bp); #else - erts_queue_message(monitor_p, NULL, bp, msg, NIL); + erts_queue_message(monitor_p, NULL, bp, msg, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); #endif } @@ -3358,7 +3389,11 @@ } else { queue_proc_msg: - erts_queue_message(proc,&proc_locks,smqp->bp,smqp->msg,NIL); + erts_queue_message(proc,&proc_locks,smqp->bp,smqp->msg,NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); #ifdef DEBUG_PRINTOUTS erts_fprintf(stderr, "delivered\n"); #endif @@ -3457,13 +3492,16 @@ thr_opts.coreNo = 0; #endif thr_opts.detached = 1; - thr_opts.name = "sys_msg_dispatcher"; init_smq_element_alloc(); sys_message_queue = NULL; sys_message_queue_end = NULL; erts_smp_cnd_init(&smq_cnd); erts_smp_mtx_init(&smq_mtx, "sys_msg_q"); +#ifdef ETHR_HAVE_THREAD_NAMES + thr_opts.name = "sys_msg_dispatcher"; +#endif + erts_smp_thr_create(&sys_msg_dispatcher_tid, sys_msg_dispatcher_func, NULL, diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_trace.h erlang-17.3-dfsg/erts/emulator/beam/erl_trace.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_trace.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_trace.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2012-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_unicode.c erlang-17.3-dfsg/erts/emulator/beam/erl_unicode.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_unicode.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_unicode.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_unicode.h erlang-17.3-dfsg/erts/emulator/beam/erl_unicode.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_unicode.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_unicode.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_unicode_normalize.h erlang-17.3-dfsg/erts/emulator/beam/erl_unicode_normalize.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_unicode_normalize.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_unicode_normalize.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,22 +1,21 @@ /* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2010. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ +* %CopyrightBegin% +* +* Copyright Ericsson AB 1999-2010. All Rights Reserved. +* +* The contents of this file are subject to the Erlang Public License, +* Version 1.1, (the "License"); you may not use this file except in +* compliance with the License. You should have received a copy of the +* Erlang Public License along with this software. If not, it can be +* retrieved online at http://www.erlang.org/. +* +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +* the License for the specific language governing rights and limitations +* under the License. +* +* %CopyrightEnd% +*/ /* * This file is automatically generated by dec.erl, do not edit manually */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_utils.h erlang-17.3-dfsg/erts/emulator/beam/erl_utils.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_utils.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_utils.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2012-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -33,7 +32,11 @@ #endif union { Uint64 not_atomic; - erts_atomic64_t atomic; +#ifdef ARCH_64 + erts_atomic_t atomic; +#else + erts_dw_atomic_t atomic; +#endif } counter; } erts_interval_t; @@ -47,6 +50,9 @@ Uint64 erts_ensure_later_interval_acqb(erts_interval_t *, Uint64); Uint64 erts_smp_ensure_later_interval_nob(erts_interval_t *, Uint64); Uint64 erts_smp_ensure_later_interval_acqb(erts_interval_t *, Uint64); +#ifdef ARCH_32 +ERTS_GLB_INLINE Uint64 erts_interval_dw_aint_to_val__(erts_dw_aint_t *); +#endif ERTS_GLB_INLINE Uint64 erts_current_interval_nob__(erts_interval_t *); ERTS_GLB_INLINE Uint64 erts_current_interval_acqb__(erts_interval_t *); ERTS_GLB_INLINE Uint64 erts_current_interval_nob(erts_interval_t *); @@ -56,16 +62,46 @@ #if ERTS_GLB_INLINE_INCL_FUNC_DEF +#ifdef ARCH_32 + +ERTS_GLB_INLINE Uint64 +erts_interval_dw_aint_to_val__(erts_dw_aint_t *dw) +{ +#ifdef ETHR_SU_DW_NAINT_T__ + return (Uint64) dw->dw_sint; +#else + Uint64 res; + res = (Uint64) ((Uint32) dw->sint[ERTS_DW_AINT_HIGH_WORD]); + res <<= 32; + res |= (Uint64) ((Uint32) dw->sint[ERTS_DW_AINT_LOW_WORD]); + return res; +#endif +} + +#endif + ERTS_GLB_INLINE Uint64 erts_current_interval_nob__(erts_interval_t *icp) { - return (Uint64) erts_atomic64_read_nob(&icp->counter.atomic); +#ifdef ARCH_64 + return (Uint64) erts_atomic_read_nob(&icp->counter.atomic); +#else + erts_dw_aint_t dw; + erts_dw_atomic_read_nob(&icp->counter.atomic, &dw); + return erts_interval_dw_aint_to_val__(&dw); +#endif } ERTS_GLB_INLINE Uint64 erts_current_interval_acqb__(erts_interval_t *icp) { - return (Uint64) erts_atomic64_read_acqb(&icp->counter.atomic); +#ifdef ARCH_64 + return (Uint64) erts_atomic_read_acqb(&icp->counter.atomic); +#else + erts_dw_aint_t dw; + erts_dw_atomic_read_acqb(&icp->counter.atomic, &dw); + return erts_interval_dw_aint_to_val__(&dw); +#endif } ERTS_GLB_INLINE Uint64 @@ -114,14 +150,12 @@ int erts_fit_in_bits_int64(Sint64); int erts_fit_in_bits_int32(Sint32); -int erts_fit_in_bits_uint(Uint); int erts_list_length(Eterm); int erts_is_builtin(Eterm, Eterm, int); Uint32 make_broken_hash(Eterm); Uint32 block_hash(byte *, unsigned, Uint32); Uint32 make_hash2(Eterm); Uint32 make_hash(Eterm); -Uint32 make_internal_hash(Eterm); void erts_save_emu_args(int argc, char **argv); Eterm erts_get_emu_args(struct process *c_p); @@ -168,26 +202,24 @@ #define EQ(x,y) (((x) == (y)) || (is_not_both_immed((x),(y)) && eq((x),(y)))) #if HALFWORD_HEAP -Sint erts_cmp_rel_opt(Eterm, Eterm*, Eterm, Eterm*, int, int); -#define cmp_rel(A,A_BASE,B,B_BASE) erts_cmp_rel_opt(A,A_BASE,B,B_BASE,0,0) -#define cmp_rel_term(A,A_BASE,B,B_BASE) erts_cmp_rel_opt(A,A_BASE,B,B_BASE,1,0) -#define CMP(A,B) erts_cmp_rel_opt(A,NULL,B,NULL,0,0) -#define CMP_TERM(A,B) erts_cmp_rel_opt(A,NULL,B,NULL,1,0) -#define CMP_EQ_ONLY(A,B) erts_cmp_rel_opt(A,NULL,B,NULL,0,1) -#else -Sint erts_cmp(Eterm, Eterm, int, int); -Sint cmp(Eterm a, Eterm b); -#define cmp_rel(A,A_BASE,B,B_BASE) erts_cmp(A,B,0,0) -#define cmp_rel_term(A,A_BASE,B,B_BASE) erts_cmp(A,B,1,0) -#define CMP(A,B) erts_cmp(A,B,0,0) -#define CMP_TERM(A,B) erts_cmp(A,B,1,0) -#define CMP_EQ_ONLY(A,B) erts_cmp(A,B,0,1) +Sint erts_cmp_rel_opt(Eterm, Eterm*, Eterm, Eterm*, int); +#define cmp_rel(A,A_BASE,B,B_BASE) erts_cmp_rel_opt(A,A_BASE,B,B_BASE,0) +#define cmp_rel_term(A,A_BASE,B,B_BASE) erts_cmp_rel_opt(A,A_BASE,B,B_BASE,1) +#define CMP(A,B) erts_cmp_rel_opt(A,NULL,B,NULL,0) +#define CMP_TERM(A,B) erts_cmp_rel_opt(A,NULL,B,NULL,1) +#else +Sint cmp(Eterm, Eterm); +Sint erts_cmp(Eterm, Eterm, int); +#define cmp_rel(A,A_BASE,B,B_BASE) erts_cmp(A,B,0) +#define cmp_rel_term(A,A_BASE,B,B_BASE) erts_cmp(A,B,1) +#define CMP(A,B) erts_cmp(A,B,0) +#define CMP_TERM(A,B) erts_cmp(A,B,1) #endif #define cmp_lt(a,b) (CMP((a),(b)) < 0) #define cmp_le(a,b) (CMP((a),(b)) <= 0) -#define cmp_eq(a,b) (CMP_EQ_ONLY((a),(b)) == 0) -#define cmp_ne(a,b) (CMP_EQ_ONLY((a),(b)) != 0) +#define cmp_eq(a,b) (CMP((a),(b)) == 0) +#define cmp_ne(a,b) (CMP((a),(b)) != 0) #define cmp_ge(a,b) (CMP((a),(b)) >= 0) #define cmp_gt(a,b) (CMP((a),(b)) > 0) diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_vm.h erlang-17.3-dfsg/erts/emulator/beam/erl_vm.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_vm.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_vm.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -21,6 +20,8 @@ #ifndef __ERL_VM_H__ #define __ERL_VM_H__ +/* #define ERTS_OPCODE_COUNTER_SUPPORT */ + /* FORCE_HEAP_FRAGS: * Debug provocation to make HAlloc always create heap fragments (if allowed) * even if there is room on heap. @@ -118,9 +119,9 @@ #if defined(DEBUG) || defined(CHECK_FOR_HOLES) #if HALFWORD_HEAP -# define ERTS_HOLE_MARKER (0xdeadbeef) +# define ERTS_HOLE_MARKER (0xaf5e78ccU) #else -# define ERTS_HOLE_MARKER (((0xdeadbeef << 24) << 8) | 0xdeadbeef) +# define ERTS_HOLE_MARKER (((0xaf5e78ccUL << 24) << 8) | 0xaf5e78ccUL) #endif #endif @@ -173,7 +174,6 @@ extern int BIN_VH_MIN_SIZE; /* minimum virtual (bin) heap */ extern int erts_atom_table_size;/* Atom table size */ -extern int erts_pd_initial_size;/* Initial Process dictionary table size */ #define ORIG_CREATION 0 #define INTERNAL_CREATION 255 diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_zlib.c erlang-17.3-dfsg/erts/emulator/beam/erl_zlib.c --- erlang-18.2-dfsg/erts/emulator/beam/erl_zlib.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_zlib.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/erl_zlib.h erlang-17.3-dfsg/erts/emulator/beam/erl_zlib.h --- erlang-18.2-dfsg/erts/emulator/beam/erl_zlib.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/erl_zlib.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/error.h erlang-17.3-dfsg/erts/emulator/beam/error.h --- erlang-18.2-dfsg/erts/emulator/beam/error.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/error.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -141,13 +140,7 @@ #define EXC_NOTSUP ((17 << 8) | EXC_ERROR) /* Not supported */ -#define EXC_BADMAP ((18 << 8) | EXC_ERROR) - /* Bad map */ - -#define EXC_BADKEY ((19 << 8) | EXC_ERROR) - /* Bad key in map */ - -#define NUMBER_EXIT_CODES 20 /* The number of exit code indices */ +#define NUMBER_EXIT_CODES 18 /* The number of exit code indices */ /* * Internal pseudo-error codes. @@ -159,8 +152,6 @@ */ #define BADARG EXC_BADARG #define BADARITH EXC_BADARITH -#define BADKEY EXC_BADKEY -#define BADMAP EXC_BADMAP #define BADMATCH EXC_BADMATCH #define SYSTEM_LIMIT EXC_SYSTEM_LIMIT diff -Nru erlang-18.2-dfsg/erts/emulator/beam/export.c erlang-17.3-dfsg/erts/emulator/beam/export.c --- erlang-18.2-dfsg/erts/emulator/beam/export.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/export.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/export.h erlang-17.3-dfsg/erts/emulator/beam/export.h --- erlang-18.2-dfsg/erts/emulator/beam/export.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/export.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/external.c erlang-17.3-dfsg/erts/emulator/beam/external.c --- erlang-18.2-dfsg/erts/emulator/beam/external.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/external.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -37,9 +36,7 @@ #include "erl_process.h" #include "error.h" #include "external.h" -#define ERL_WANT_HIPE_BIF_WRAPPER__ #include "bif.h" -#undef ERL_WANT_HIPE_BIF_WRAPPER__ #include "big.h" #include "dist.h" #include "erl_binary.h" @@ -95,9 +92,9 @@ static byte* enc_atom(ErtsAtomCacheMap *, Eterm, byte*, Uint32); static byte* enc_pid(ErtsAtomCacheMap *, Eterm, byte*, Uint32); struct B2TContext_t; -static byte* dec_term(ErtsDistExternal*, ErtsHeapFactory*, byte*, Eterm*, struct B2TContext_t*); +static byte* dec_term(ErtsDistExternal *, Eterm**, byte*, ErlOffHeap*, Eterm*, struct B2TContext_t*); static byte* dec_atom(ErtsDistExternal *, byte*, Eterm*); -static byte* dec_pid(ErtsDistExternal *, ErtsHeapFactory*, byte*, Eterm*); +static byte* dec_pid(ErtsDistExternal *, Eterm**, byte*, ErlOffHeap*, Eterm*); static Sint decoded_size(byte *ep, byte* endp, int internal_tags, struct B2TContext_t*); static BIF_RETTYPE term_to_binary_trap_1(BIF_ALIST_1); @@ -501,37 +498,15 @@ return ep; } -int erts_encode_dist_ext_size(Eterm term, Uint32 flags, ErtsAtomCacheMap *acmp, - Uint* szp) -{ - Uint sz; - if (encode_size_struct_int(NULL, acmp, term, flags, NULL, &sz)) { - return -1; - } else { -#ifndef ERTS_DEBUG_USE_DIST_SEP - if (!(flags & DFLAG_DIST_HDR_ATOM_CACHE)) -#endif - sz++ /* VERSION_MAGIC */; - - *szp += sz; - return 0; - } -} - -int erts_encode_dist_ext_size_int(Eterm term, struct erts_dsig_send_context* ctx, Uint* szp) +Uint erts_encode_dist_ext_size(Eterm term, Uint32 flags, ErtsAtomCacheMap *acmp) { - Uint sz; - if (encode_size_struct_int(&ctx->u.sc, ctx->acmp, term, ctx->flags, &ctx->reds, &sz)) { - return -1; - } else { + Uint sz = 0; #ifndef ERTS_DEBUG_USE_DIST_SEP - if (!(ctx->flags & DFLAG_DIST_HDR_ATOM_CACHE)) + if (!(flags & DFLAG_DIST_HDR_ATOM_CACHE)) #endif - sz++ /* VERSION_MAGIC */; - - *szp += sz; - return 0; - } + sz++ /* VERSION_MAGIC */; + sz += encode_size_struct2(acmp, term, flags); + return sz; } Uint erts_encode_ext_size(Eterm term) @@ -552,16 +527,19 @@ } -int erts_encode_dist_ext(Eterm term, byte **ext, Uint32 flags, ErtsAtomCacheMap *acmp, - TTBEncodeContext* ctx, Sint* reds) +void erts_encode_dist_ext(Eterm term, byte **ext, Uint32 flags, ErtsAtomCacheMap *acmp) { - if (!ctx || !ctx->wstack.wstart) { - #ifndef ERTS_DEBUG_USE_DIST_SEP - if (!(flags & DFLAG_DIST_HDR_ATOM_CACHE)) - #endif - *(*ext)++ = VERSION_MAGIC; - } - return enc_term_int(ctx, acmp, term, *ext, flags, NULL, reds, ext); + byte *ep = *ext; +#ifndef ERTS_DEBUG_USE_DIST_SEP + if (!(flags & DFLAG_DIST_HDR_ATOM_CACHE)) +#endif + *ep++ = VERSION_MAGIC; + ep = enc_term(acmp, term, ep, flags, NULL); + if (!ep) + erl_exit(ERTS_ABORT_EXIT, + "%s:%d:erts_encode_dist_ext(): Internal data structure error\n", + __FILE__, __LINE__); + *ext = ep; } void erts_encode_ext(Eterm term, byte **ext) @@ -931,7 +909,8 @@ ** on return hpp is updated to point after allocated data */ Eterm -erts_decode_dist_ext(ErtsHeapFactory* factory, +erts_decode_dist_ext(Eterm** hpp, + ErlOffHeap* off_heap, ErtsDistExternal *edep) { Eterm obj; @@ -951,7 +930,7 @@ goto error; ep++; } - ep = dec_term(edep, factory, ep, &obj, NULL); + ep = dec_term(edep, hpp, ep, off_heap, &obj, NULL); if (!ep) goto error; @@ -960,22 +939,19 @@ return obj; error: - erts_factory_undo(factory); bad_dist_ext(edep); return THE_NON_VALUE; } -Eterm erts_decode_ext(ErtsHeapFactory* factory, byte **ext) +Eterm erts_decode_ext(Eterm **hpp, ErlOffHeap *off_heap, byte **ext) { Eterm obj; byte *ep = *ext; - if (*ep++ != VERSION_MAGIC) { - erts_factory_undo(factory); + if (*ep++ != VERSION_MAGIC) return THE_NON_VALUE; - } - ep = dec_term(NULL, factory, ep, &obj, NULL); + ep = dec_term(NULL, hpp, ep, off_heap, &obj, NULL); if (!ep) { #ifdef DEBUG bin_write(ERTS_PRINT_STDERR,NULL,*ext,500); @@ -986,10 +962,10 @@ return obj; } -Eterm erts_decode_ext_ets(ErtsHeapFactory* factory, byte *ext) +Eterm erts_decode_ext_ets(Eterm **hpp, ErlOffHeap *off_heap, byte *ext) { Eterm obj; - ext = dec_term(NULL, factory, ext, &obj, NULL); + ext = dec_term(NULL, hpp, ext, off_heap, &obj, NULL); ASSERT(ext); return obj; } @@ -998,8 +974,9 @@ BIF_RETTYPE erts_debug_dist_ext_to_term_2(BIF_ALIST_2) { - ErtsHeapFactory factory; Eterm res; + Eterm *hp; + Eterm *hendp; Sint hsz; ErtsDistExternal ede; Eterm *tp; @@ -1046,9 +1023,12 @@ if (hsz < 0) goto badarg; - erts_factory_proc_prealloc_init(&factory, BIF_P, hsz); - res = erts_decode_dist_ext(&factory, &ede); - erts_factory_close(&factory); + hp = HAlloc(BIF_P, (Uint) hsz); + hendp = hp + hsz; + + res = erts_decode_dist_ext(&hp, &MSO(BIF_P), &ede); + + HRelease(BIF_P, hendp, hp); if (is_value(res)) BIF_RET(res); @@ -1176,11 +1156,12 @@ byte* ep; Eterm res; Eterm* next; - ErtsHeapFactory factory; + Eterm* hp_start; + Eterm* hp; + Eterm* hp_end; int remaining_n; char* remaining_bytes; - ErtsWStack flat_maps; - ErtsPStack hamt_array; + Eterm* maps_head; } B2TDecodeContext; typedef struct { @@ -1304,12 +1285,10 @@ } static ERTS_INLINE Eterm -binary2term_create(ErtsDistExternal *edep, ErtsBinary2TermState *state, - ErtsHeapFactory* factory) +binary2term_create(ErtsDistExternal *edep, ErtsBinary2TermState *state, Eterm **hpp, ErlOffHeap *ohp) { Eterm res; - - if (!dec_term(edep, factory, state->extp, &res, NULL)) + if (!dec_term(edep, hpp, state->extp, ohp, &res, NULL)) res = THE_NON_VALUE; if (state->exttmp) { state->exttmp = 0; @@ -1342,9 +1321,9 @@ } Eterm -erts_binary2term_create(ErtsBinary2TermState *state, ErtsHeapFactory* factory) +erts_binary2term_create(ErtsBinary2TermState *state, Eterm **hpp, ErlOffHeap *ohp) { - return binary2term_create(NULL,state, factory); + return binary2term_create(NULL,state, hpp, ohp); } static void b2t_destroy_context(B2TContext* context) @@ -1353,21 +1332,8 @@ ERTS_ALC_T_EXT_TERM_DATA); context->aligned_alloc = NULL; binary2term_abort(&context->b2ts); - switch (context->state) { - case B2TUncompressChunk: + if (context->state == B2TUncompressChunk) { erl_zlib_inflate_finish(&context->u.uc.stream); - break; - case B2TDecode: - case B2TDecodeList: - case B2TDecodeTuple: - case B2TDecodeString: - case B2TDecodeBinary: - if (context->u.dc.hamt_array.pstart) { - erts_free(context->u.dc.hamt_array.alloc_type, - context->u.dc.hamt_array.pstart); - } - break; - default:; } } @@ -1518,9 +1484,10 @@ ctx->u.dc.ep = ctx->b2ts.extp; ctx->u.dc.res = (Eterm) (UWord) NULL; ctx->u.dc.next = &ctx->u.dc.res; - erts_factory_proc_prealloc_init(&ctx->u.dc.factory, p, ctx->heap_size); - ctx->u.dc.flat_maps.wstart = NULL; - ctx->u.dc.hamt_array.pstart = NULL; + ctx->u.dc.hp_start = HAlloc(p, ctx->heap_size); + ctx->u.dc.hp = ctx->u.dc.hp_start; + ctx->u.dc.hp_end = ctx->u.dc.hp_start + ctx->heap_size; + ctx->u.dc.maps_head = NULL; ctx->state = B2TDecode; /*fall through*/ case B2TDecode: @@ -1530,10 +1497,11 @@ case B2TDecodeBinary: { ErtsDistExternal fakedep; fakedep.flags = ctx->flags; - dec_term(&fakedep, NULL, NULL, NULL, ctx); + dec_term(&fakedep, NULL, NULL, &MSO(p), NULL, ctx); break; } case B2TDecodeFail: + HRelease(p, ctx->u.dc.hp_end, ctx->u.dc.hp_start); /*fall through*/ case B2TBadArg: BUMP_REDS(p, (initial_reds - ctx->reds) / B2T_BYTES_PER_REDUCTION); @@ -1558,11 +1526,11 @@ case B2TDone: b2t_destroy_context(ctx); - if (ctx->u.dc.factory.hp > ctx->u.dc.factory.hp_end) { + if (ctx->u.dc.hp > ctx->u.dc.hp_end) { erl_exit(1, ":%s, line %d: heap overrun by %d words(s)\n", - __FILE__, __LINE__, ctx->u.dc.factory.hp - ctx->u.dc.factory.hp_end); + __FILE__, __LINE__, ctx->u.dc.hp - ctx->u.dc.hp_end); } - erts_factory_close(&ctx->u.dc.factory); + HRelease(p, ctx->u.dc.hp_end, ctx->u.dc.hp); if (!is_first_call) { erts_set_gc_state(p, 1); @@ -1772,14 +1740,54 @@ return erts_term_to_binary_simple(p, Term, size, level, flags); } -/* Define EXTREME_TTB_TRAPPING for testing in dist.h */ +/* Define for testing */ +/* #define EXTREME_TTB_TRAPPING 1 */ #ifndef EXTREME_TTB_TRAPPING +#define TERM_TO_BINARY_LOOP_FACTOR 32 #define TERM_TO_BINARY_COMPRESS_CHUNK (1 << 18) #else +#define TERM_TO_BINARY_LOOP_FACTOR 1 #define TERM_TO_BINARY_COMPRESS_CHUNK 10 #endif -#define TERM_TO_BINARY_MEMCPY_FACTOR 8 + + +typedef enum { TTBSize, TTBEncode, TTBCompress } TTBState; +typedef struct TTBSizeContext_ { + Uint flags; + int level; + Uint result; + Eterm obj; + ErtsEStack estack; +} TTBSizeContext; + +typedef struct TTBEncodeContext_ { + Uint flags; + int level; + byte* ep; + Eterm obj; + ErtsWStack wstack; + Binary *result_bin; +} TTBEncodeContext; + +typedef struct { + Uint real_size; + Uint dest_len; + byte *dbytes; + Binary *result_bin; + Binary *destination_bin; + z_stream stream; +} TTBCompressContext; + +typedef struct { + int alive; + TTBState state; + union { + TTBSizeContext sc; + TTBEncodeContext ec; + TTBCompressContext cc; + } s; +} TTBContext; static void ttb_context_destructor(Binary *context_bin) { @@ -1788,7 +1796,7 @@ context->alive = 0; switch (context->state) { case TTBSize: - DESTROY_SAVED_WSTACK(&context->s.sc.wstack); + DESTROY_SAVED_ESTACK(&context->s.sc.estack); break; case TTBEncode: DESTROY_SAVED_WSTACK(&context->s.ec.wstack); @@ -1856,7 +1864,7 @@ /* Setup enough to get started */ context->state = TTBSize; context->alive = 1; - context->s.sc.wstack.wstart = NULL; + context->s.sc.estack.start = NULL; context->s.sc.flags = flags; context->s.sc.level = level; } else { @@ -1891,6 +1899,8 @@ } result_bin = erts_bin_nrml_alloc(size); + result_bin->flags = 0; + result_bin->orig_size = size; erts_refc_init(&result_bin->refc, 0); result_bin->orig_bytes[0] = VERSION_MAGIC; /* Next state immediately, no need to export context */ @@ -1915,6 +1925,7 @@ } real_size = endp - bytes; result_bin = erts_bin_realloc(context->s.ec.result_bin,real_size); + result_bin->orig_size = real_size; level = context->s.ec.level; BUMP_REDS(p, (initial_reds - reds) / TERM_TO_BINARY_LOOP_FACTOR); if (level == 0 || real_size < 6) { /* We are done */ @@ -1951,6 +1962,8 @@ context->s.cc.result_bin = result_bin; result_bin = erts_bin_nrml_alloc(real_size); + result_bin->flags = 0; + result_bin->orig_size = real_size; erts_refc_init(&result_bin->refc, 0); result_bin->orig_bytes[0] = VERSION_MAGIC; @@ -1992,6 +2005,7 @@ erl_zlib_deflate_finish(&(context->s.cc.stream)); result_bin = erts_bin_realloc(context->s.cc.destination_bin, context->s.cc.dest_len+6); + result_bin->orig_size = context->s.cc.dest_len+6; context->s.cc.destination_bin = NULL; pb = (ProcBin *) HAlloc(p, PROC_BIN_SIZE); pb->thing_word = HEADER_PROC_BIN; @@ -2256,7 +2270,7 @@ } static byte* -dec_pid(ErtsDistExternal *edep, ErtsHeapFactory* factory, byte* ep, Eterm* objp) +dec_pid(ErtsDistExternal *edep, Eterm** hpp, byte* ep, ErlOffHeap* off_heap, Eterm* objp) { Eterm sysname; Uint data; @@ -2295,15 +2309,15 @@ if(node == erts_this_node) { *objp = make_internal_pid(data); } else { - ExternalThing *etp = (ExternalThing *) factory->hp; - factory->hp += EXTERNAL_THING_HEAD_SIZE + 1; + ExternalThing *etp = (ExternalThing *) *hpp; + *hpp += EXTERNAL_THING_HEAD_SIZE + 1; etp->header = make_external_pid_header(1); - etp->next = factory->off_heap->first; + etp->next = off_heap->first; etp->node = node; etp->data.ui[0] = data; - factory->off_heap->first = (struct erl_off_heap_header*) etp; + off_heap->first = (struct erl_off_heap_header*) etp; *objp = make_external_pid(etp); } return ep; @@ -2313,10 +2327,8 @@ #define ENC_TERM ((Eterm) 0) #define ENC_ONE_CONS ((Eterm) 1) #define ENC_PATCH_FUN_SIZE ((Eterm) 2) -#define ENC_BIN_COPY ((Eterm) 3) -#define ENC_MAP_PAIR ((Eterm) 4) -#define ENC_HASHMAP_NODE ((Eterm) 5) -#define ENC_LAST_ARRAY_ELEMENT ((Eterm) 6) +#define ENC_LAST_ARRAY_ELEMENT ((Eterm) 3) + static byte* enc_term(ErtsAtomCacheMap *acmp, Eterm obj, byte* ep, Uint32 dflags, @@ -2352,9 +2364,6 @@ WSTACK_RESTORE(s, &ctx->wstack); ep = ctx->ep; obj = ctx->obj; - if (is_non_value(obj)) { - goto outer_loop; - } } } @@ -2378,8 +2387,8 @@ obj = CAR(cons); tl = CDR(cons); - WSTACK_PUSH2(s, (is_list(tl) ? ENC_ONE_CONS : ENC_TERM), - tl); + WSTACK_PUSH(s, is_list(tl) ? ENC_ONE_CONS : ENC_TERM); + WSTACK_PUSH(s, tl); } break; case ENC_PATCH_FUN_SIZE: @@ -2392,46 +2401,6 @@ put_int32(ep - size_p, size_p); } goto outer_loop; - case ENC_BIN_COPY: { - Uint bits = (Uint)obj; - Uint bitoffs = WSTACK_POP(s); - byte* bytes = (byte*) WSTACK_POP(s); - byte* dst = (byte*) WSTACK_POP(s); - if (bits > r * (TERM_TO_BINARY_MEMCPY_FACTOR * 8)) { - Uint n = r * TERM_TO_BINARY_MEMCPY_FACTOR; - WSTACK_PUSH5(s, (UWord)(dst + n), (UWord)(bytes + n), bitoffs, - ENC_BIN_COPY, bits - 8*n); - bits = 8*n; - copy_binary_to_buffer(dst, 0, bytes, bitoffs, bits); - obj = THE_NON_VALUE; - r = 0; /* yield */ - break; - } else { - copy_binary_to_buffer(dst, 0, bytes, bitoffs, bits); - r -= bits / (TERM_TO_BINARY_MEMCPY_FACTOR * 8); - goto outer_loop; - } - } - case ENC_MAP_PAIR: { - Uint pairs_left = obj; - Eterm *vptr = (Eterm*) WSTACK_POP(s); - Eterm *kptr = (Eterm*) WSTACK_POP(s); - - obj = *kptr; - if (--pairs_left > 0) { - WSTACK_PUSH4(s, (UWord)(kptr+1), (UWord)(vptr+1), - ENC_MAP_PAIR, pairs_left); - } - WSTACK_PUSH2(s, ENC_TERM, *vptr); - break; - } - case ENC_HASHMAP_NODE: - if (is_list(obj)) { /* leaf node [K|V] */ - ptr = list_val(obj); - WSTACK_PUSH2(s, ENC_TERM, CDR(ptr)); - obj = CAR(ptr); - } - break; case ENC_LAST_ARRAY_ELEMENT: /* obj is the tuple */ { @@ -2450,16 +2419,17 @@ #else Eterm* ptr = (Eterm *) obj; #endif + WSTACK_PUSH(s, val-1); obj = *ptr++; - WSTACK_PUSH2(s, val-1, (UWord)ptr); + WSTACK_PUSH(s, (UWord)ptr); } break; } L_jump_start: - if (ctx && --r <= 0) { - *reds = 0; + if (ctx && --r == 0) { + *reds = r; ctx->obj = obj; ctx->ep = ep; WSTACK_SAVE(s, &ctx->wstack); @@ -2608,59 +2578,39 @@ ep += 4; } if (i > 0) { - WSTACK_PUSH2(s, ENC_LAST_ARRAY_ELEMENT+i-1, (UWord)ptr); + WSTACK_PUSH(s, ENC_LAST_ARRAY_ELEMENT+i-1); + WSTACK_PUSH(s, (UWord)ptr); } break; case MAP_DEF: - if (is_flatmap(obj)) { - flatmap_t *mp = (flatmap_t*)flatmap_val(obj); - Uint size = flatmap_get_size(mp); + { + map_t *mp = (map_t*)map_val(obj); + Uint size = map_get_size(mp); *ep++ = MAP_EXT; put_int32(size, ep); ep += 4; if (size > 0) { - Eterm *kptr = flatmap_get_keys(mp); - Eterm *vptr = flatmap_get_values(mp); + Eterm *kptr = map_get_keys(mp); + Eterm *vptr = map_get_values(mp); - WSTACK_PUSH4(s, (UWord)kptr, (UWord)vptr, - ENC_MAP_PAIR, size); - } - } else { - Eterm hdr; - Uint node_sz; - ptr = boxed_val(obj); - hdr = *ptr; - ASSERT(is_header(hdr)); - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - *ep++ = MAP_EXT; - ptr++; - put_int32(*ptr, ep); ep += 4; - node_sz = 16; - break; - case HAMT_SUBTAG_HEAD_BITMAP: - *ep++ = MAP_EXT; - ptr++; - put_int32(*ptr, ep); ep += 4; - /*fall through*/ - case HAMT_SUBTAG_NODE_BITMAP: - node_sz = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - ASSERT(node_sz < 17); - break; - default: - erl_exit(1, "bad header\r\n"); - } + for (i = size-1; i >= 1; i--) { + WSTACK_PUSH(s, ENC_TERM); + WSTACK_PUSH(s, (UWord) vptr[i]); + WSTACK_PUSH(s, ENC_TERM); + WSTACK_PUSH(s, (UWord) kptr[i]); + } + + WSTACK_PUSH(s, ENC_TERM); + WSTACK_PUSH(s, (UWord) vptr[0]); - ptr++; - WSTACK_RESERVE(s, node_sz*2); - while(node_sz--) { - WSTACK_FAST_PUSH(s, ENC_HASHMAP_NODE); - WSTACK_FAST_PUSH(s, *ptr++); + obj = kptr[0]; + goto L_jump_start; } } break; + case FLOAT_DEF: GET_DOUBLE(obj, f); if (dflags & DFLAG_NEW_FLOATS) { @@ -2694,7 +2644,6 @@ Uint bitoffs; Uint bitsize; byte* bytes; - byte* data_dst; ERTS_GET_BINARY_BYTES(obj, bytes, bitoffs, bitsize); if (dflags & DFLAG_INTERNAL_TAGS) { @@ -2740,7 +2689,7 @@ j = binary_size(obj); put_int32(j, ep); ep += 4; - data_dst = ep; + copy_binary_to_buffer(ep, 0, bytes, bitoffs, 8*j); ep += j; } else if (dflags & DFLAG_BIT_BINARIES) { /* Bit-level binary. */ @@ -2750,7 +2699,7 @@ ep += 4; *ep++ = bitsize; ep[j] = 0; /* Zero unused bits at end of binary */ - data_dst = ep; + copy_binary_to_buffer(ep, 0, bytes, bitoffs, 8*j+bitsize); ep += j + 1; } else { /* @@ -2764,18 +2713,11 @@ put_int32((j+1), ep); ep += 4; ep[j] = 0; /* Zero unused bits at end of binary */ - data_dst = ep; + copy_binary_to_buffer(ep, 0, bytes, bitoffs, 8*j+bitsize); ep += j+1; *ep++ = SMALL_INTEGER_EXT; *ep++ = bitsize; } - if (ctx && j > r * TERM_TO_BINARY_MEMCPY_FACTOR) { - WSTACK_PUSH5(s, (UWord)data_dst, (UWord)bytes, bitoffs, - ENC_BIN_COPY, 8*j + bitsize); - } else { - copy_binary_to_buffer(data_dst, 0, bytes, bitoffs, - 8 * j + bitsize); - } } break; case EXPORT_DEF: @@ -2804,12 +2746,13 @@ case FUN_DEF: { ErlFunThing* funp = (ErlFunThing *) fun_val(obj); - int ei; if ((dflags & DFLAG_NEW_FUN_TAGS) != 0) { + int ei; + *ep++ = NEW_FUN_EXT; - WSTACK_PUSH2(s, ENC_PATCH_FUN_SIZE, - (UWord) ep); /* Position for patching in size */ + WSTACK_PUSH(s, ENC_PATCH_FUN_SIZE); + WSTACK_PUSH(s, (UWord) ep); /* Position for patching in size */ ep += 4; *ep = funp->arity; ep += 1; @@ -2823,6 +2766,16 @@ ep = enc_term(acmp, make_small(funp->fe->old_index), ep, dflags, off_heap); ep = enc_term(acmp, make_small(funp->fe->old_uniq), ep, dflags, off_heap); ep = enc_pid(acmp, funp->creator, ep, dflags); + + fun_env: + for (ei = funp->num_free-1; ei > 0; ei--) { + WSTACK_PUSH(s, ENC_TERM); + WSTACK_PUSH(s, (UWord) funp->env[ei]); + } + if (funp->num_free != 0) { + obj = funp->env[0]; + goto L_jump_start; + } } else { /* * Communicating with an obsolete erl_interface or @@ -2854,13 +2807,7 @@ *ep++ = SMALL_TUPLE_EXT; put_int8(funp->num_free, ep); ep += 1; - } - for (ei = funp->num_free-1; ei > 0; ei--) { - WSTACK_PUSH2(s, ENC_TERM, (UWord) funp->env[ei]); - } - if (funp->num_free != 0) { - obj = funp->env[0]; - goto L_jump_start; + goto fun_env; } } break; @@ -2914,42 +2861,57 @@ return len; } - -struct dec_term_hamt +/* Assumes that the ones to undo are preluding the list. */ +static void +undo_offheap_in_area(ErlOffHeap* off_heap, Eterm* start, Eterm* end) { - Eterm* objp; /* write result here */ - Uint size; /* nr of leafs */ - Eterm* leaf_array; -}; + const Uint area_sz = (end - start) * sizeof(Eterm); + struct erl_off_heap_header* hdr; + struct erl_off_heap_header** hdr_nextp = NULL; + + for (hdr = off_heap->first; ; hdr=hdr->next) { + if (!in_area(hdr, start, area_sz)) { + if (hdr_nextp != NULL) { + *hdr_nextp = NULL; + erts_cleanup_offheap(off_heap); + off_heap->first = hdr; + } + break; + } + hdr_nextp = &hdr->next; + } + + /* Assert that the ones to undo were indeed preluding the list. */ +#ifdef DEBUG + for (hdr = off_heap->first; hdr != NULL; hdr = hdr->next) { + ASSERT(!in_area(hdr, start, area_sz)); + } +#endif /* DEBUG */ +} /* Decode term from external format into *objp. -** On failure calls erts_factory_undo() and returns NULL +** On failure return NULL and (R13B04) *hpp will be unchanged. */ static byte* -dec_term(ErtsDistExternal *edep, - ErtsHeapFactory* factory, - byte* ep, - Eterm* objp, - B2TContext* ctx) +dec_term(ErtsDistExternal *edep, Eterm** hpp, byte* ep, ErlOffHeap* off_heap, + Eterm* objp, B2TContext* ctx) { -#define PSTACK_TYPE struct dec_term_hamt - PSTACK_DECLARE(hamt_array, 5); + Eterm* hp_saved; int n; ErtsAtomEncoding char_enc; register Eterm* hp; /* Please don't take the address of hp */ - DECLARE_WSTACK(flat_maps); /* for preprocessing of small maps */ + Eterm *maps_head; /* for validation of maps */ Eterm* next; SWord reds; -#ifdef DEBUG - Eterm* dbg_resultp = ctx ? &ctx->u.dc.res : objp; -#endif if (ctx) { + hp_saved = ctx->u.dc.hp_start; reds = ctx->reds; next = ctx->u.dc.next; ep = ctx->u.dc.ep; - factory = &ctx->u.dc.factory; + hpp = &ctx->u.dc.hp; + maps_head = ctx->u.dc.maps_head; if (ctx->state != B2TDecode) { int n_limit = reds; @@ -2994,7 +2956,7 @@ break; case B2TDecodeString: - hp = factory->hp; + hp = *hpp; hp[-1] = make_list(hp); /* overwrite the premature NIL */ while (n-- > 0) { hp[0] = make_small(*ep++); @@ -3002,7 +2964,7 @@ hp += 2; } hp[-1] = NIL; - factory->hp = hp; + *hpp = hp; break; case B2TDecodeBinary: @@ -3024,21 +2986,15 @@ return NULL; } } - PSTACK_CHANGE_ALLOCATOR(hamt_array, ERTS_ALC_T_SAVED_ESTACK); - WSTACK_CHANGE_ALLOCATOR(flat_maps, ERTS_ALC_T_SAVED_ESTACK); - if (ctx->u.dc.hamt_array.pstart) { - PSTACK_RESTORE(hamt_array, &ctx->u.dc.hamt_array); - } - if (ctx->u.dc.flat_maps.wstart) { - WSTACK_RESTORE(flat_maps, &ctx->u.dc.flat_maps); - } } else { + hp_saved = *hpp; reds = ERTS_SWORD_MAX; next = objp; *next = (Eterm) (UWord) NULL; + maps_head = NULL; } - hp = factory->hp; + hp = *hpp; while (next != NULL) { @@ -3100,8 +3056,6 @@ big = make_small(0); } else { big = bytes_to_big(first, n, neg, hp); - if (is_nil(big)) - goto error; if (is_big(big)) { hp += big_arity(big) + 1; } @@ -3275,9 +3229,9 @@ break; } case PID_EXT: - factory->hp = hp; - ep = dec_pid(edep, factory, ep, objp); - hp = factory->hp; + *hpp = hp; + ep = dec_pid(edep, hpp, ep, off_heap, objp); + hp = *hpp; if (ep == NULL) { goto error; } @@ -3311,11 +3265,11 @@ hp += EXTERNAL_THING_HEAD_SIZE + 1; etp->header = make_external_port_header(1); - etp->next = factory->off_heap->first; + etp->next = off_heap->first; etp->node = node; etp->data.ui[0] = num; - factory->off_heap->first = (struct erl_off_heap_header*)etp; + off_heap->first = (struct erl_off_heap_header*)etp; *objp = make_external_port(etp); } @@ -3395,10 +3349,10 @@ #else etp->header = make_external_ref_header(ref_words); #endif - etp->next = factory->off_heap->first; + etp->next = off_heap->first; etp->node = node; - factory->off_heap->first = (struct erl_off_heap_header*)etp; + off_heap->first = (struct erl_off_heap_header*)etp; *objp = make_external_ref(etp); ref_num = &(etp->data.ui32[0]); } @@ -3433,14 +3387,15 @@ } else { Binary* dbin = erts_bin_nrml_alloc(n); ProcBin* pb; + dbin->flags = 0; + dbin->orig_size = n; erts_refc_init(&dbin->refc, 1); pb = (ProcBin *) hp; hp += PROC_BIN_SIZE; pb->thing_word = HEADER_PROC_BIN; pb->size = n; - pb->next = factory->off_heap->first; - factory->off_heap->first = (struct erl_off_heap_header*)pb; - OH_OVERHEAD(factory->off_heap, pb->size / sizeof(Eterm)); + pb->next = off_heap->first; + off_heap->first = (struct erl_off_heap_header*)pb; pb->val = dbin; pb->bytes = (byte*) dbin->orig_bytes; pb->flags = 0; @@ -3486,13 +3441,14 @@ Binary* dbin = erts_bin_nrml_alloc(n); ProcBin* pb; + dbin->flags = 0; + dbin->orig_size = n; erts_refc_init(&dbin->refc, 1); pb = (ProcBin *) hp; pb->thing_word = HEADER_PROC_BIN; pb->size = n; - pb->next = factory->off_heap->first; - factory->off_heap->first = (struct erl_off_heap_header*)pb; - OH_OVERHEAD(factory->off_heap, pb->size / sizeof(Eterm)); + pb->next = off_heap->first; + off_heap->first = (struct erl_off_heap_header*)pb; pb->val = dbin; pb->bytes = (byte*) dbin->orig_bytes; pb->flags = 0; @@ -3544,9 +3500,9 @@ if ((ep = dec_atom(edep, ep, &name)) == NULL) { goto error; } - factory->hp = hp; - ep = dec_term(edep, factory, ep, &temp, NULL); - hp = factory->hp; + *hpp = hp; + ep = dec_term(edep, hpp, ep, off_heap, &temp, NULL); + hp = *hpp; if (ep == NULL) { goto error; } @@ -3574,57 +3530,46 @@ break; case MAP_EXT: { + map_t *mp; Uint32 size,n; Eterm *kptr,*vptr; Eterm keys; size = get_int32(ep); ep += 4; - if (size <= MAP_SMALL_MAP_LIMIT) { - flatmap_t *mp; + keys = make_tuple(hp); + *hp++ = make_arityval(size); + hp += size; + kptr = hp - 1; + + mp = (map_t*)hp; + hp += MAP_HEADER_SIZE; + hp += size; + vptr = hp - 1; - keys = make_tuple(hp); - *hp++ = make_arityval(size); - hp += size; - kptr = hp - 1; - - mp = (flatmap_t*)hp; - hp += MAP_HEADER_FLATMAP_SZ; - hp += size; - vptr = hp - 1; - - /* kptr, last word for keys - * vptr, last word for values - */ - - WSTACK_PUSH(flat_maps, (UWord)mp); - mp->thing_word = MAP_HEADER_FLATMAP; - mp->size = size; - mp->keys = keys; - *objp = make_flatmap(mp); - - for (n = size; n; n--) { - *vptr = (Eterm) COMPRESS_POINTER(next); - *kptr = (Eterm) COMPRESS_POINTER(vptr); - next = kptr; - vptr--; - kptr--; - } - } - else { /* Make hamt */ - struct dec_term_hamt* hamt = PSTACK_PUSH(hamt_array); + /* kptr, last word for keys + * vptr, last word for values + */ - hamt->objp = objp; - hamt->size = size; - hamt->leaf_array = hp; - - for (n = size; n; n--) { - CDR(hp) = (Eterm) COMPRESS_POINTER(next); - CAR(hp) = (Eterm) COMPRESS_POINTER(&CDR(hp)); - next = &CAR(hp); - hp += 2; - } - } + /* + * Use thing_word to link through decoded maps. + * The list of maps is for later validation. + */ + + mp->thing_word = (Eterm) COMPRESS_POINTER(maps_head); + maps_head = (Eterm *) mp; + + mp->size = size; + mp->keys = keys; + *objp = make_map(mp); + + for (n = size; n; n--) { + *vptr = (Eterm) COMPRESS_POINTER(next); + *kptr = (Eterm) COMPRESS_POINTER(vptr); + next = kptr; + vptr--; + kptr--; + } } break; case NEW_FUN_EXT: @@ -3658,9 +3603,9 @@ if ((ep = dec_atom(edep, ep, &module)) == NULL) { goto error; } - factory->hp = hp; + *hpp = hp; /* Index */ - if ((ep = dec_term(edep, factory, ep, &temp, NULL)) == NULL) { + if ((ep = dec_term(edep, hpp, ep, off_heap, &temp, NULL)) == NULL) { goto error; } if (!is_small(temp)) { @@ -3669,7 +3614,7 @@ old_index = unsigned_val(temp); /* Uniq */ - if ((ep = dec_term(edep, factory, ep, &temp, NULL)) == NULL) { + if ((ep = dec_term(edep, hpp, ep, off_heap, &temp, NULL)) == NULL) { goto error; } if (!is_small(temp)) { @@ -3681,8 +3626,8 @@ * It is safe to link the fun into the fun list only when * no more validity tests can fail. */ - funp->next = factory->off_heap->first; - factory->off_heap->first = (struct erl_off_heap_header*)funp; + funp->next = off_heap->first; + off_heap->first = (struct erl_off_heap_header*)funp; funp->fe = erts_put_fun_entry2(module, old_uniq, old_index, uniq, index, arity); @@ -3693,7 +3638,7 @@ } funp->native_address = funp->fe->native_address; #endif - hp = factory->hp; + hp = *hpp; /* Environment */ for (i = num_free-1; i >= 0; i--) { @@ -3719,14 +3664,14 @@ ep += 4; hp += ERL_FUN_SIZE; hp += num_free; - factory->hp = hp; + *hpp = hp; funp->thing_word = HEADER_FUN; funp->num_free = num_free; *objp = make_fun(funp); /* Creator pid */ if (*ep != PID_EXT - || (ep = dec_pid(edep, factory, ++ep, + || (ep = dec_pid(edep, hpp, ++ep, off_heap, &funp->creator))==NULL) { goto error; } @@ -3737,7 +3682,7 @@ } /* Index */ - if ((ep = dec_term(edep, factory, ep, &temp, NULL)) == NULL) { + if ((ep = dec_term(edep, hpp, ep, off_heap, &temp, NULL)) == NULL) { goto error; } if (!is_small(temp)) { @@ -3746,7 +3691,7 @@ old_index = unsigned_val(temp); /* Uniq */ - if ((ep = dec_term(edep, factory, ep, &temp, NULL)) == NULL) { + if ((ep = dec_term(edep, hpp, ep, off_heap, &temp, NULL)) == NULL) { goto error; } if (!is_small(temp)) { @@ -3757,8 +3702,8 @@ * It is safe to link the fun into the fun list only when * no more validity tests can fail. */ - funp->next = factory->off_heap->first; - factory->off_heap->first = (struct erl_off_heap_header*)funp; + funp->next = off_heap->first; + off_heap->first = (struct erl_off_heap_header*)funp; old_uniq = unsigned_val(temp); funp->fe = erts_put_fun_entry(module, old_uniq, old_index); @@ -3766,7 +3711,7 @@ #ifdef HIPE funp->native_address = funp->fe->native_address; #endif - hp = factory->hp; + hp = *hpp; /* Environment */ for (i = num_free-1; i >= 0; i--) { @@ -3800,9 +3745,8 @@ erts_refc_inc(&pb->val->refc, 1); hp += PROC_BIN_SIZE; - pb->next = factory->off_heap->first; - factory->off_heap->first = (struct erl_off_heap_header*)pb; - OH_OVERHEAD(factory->off_heap, pb->size / sizeof(Eterm)); + pb->next = off_heap->first; + off_heap->first = (struct erl_off_heap_header*)pb; pb->flags = 0; *objp = make_binary(pb); break; @@ -3818,9 +3762,8 @@ erts_refc_inc(&pb->val->refc, 1); hp += PROC_BIN_SIZE; - pb->next = factory->off_heap->first; - factory->off_heap->first = (struct erl_off_heap_header*)pb; - OH_OVERHEAD(factory->off_heap, pb->size / sizeof(Eterm)); + pb->next = off_heap->first; + off_heap->first = (struct erl_off_heap_header*)pb; pb->flags = 0; sub = (ErlSubBin*)hp; @@ -3846,13 +3789,8 @@ if (next || ctx->state != B2TDecode) { ctx->u.dc.ep = ep; ctx->u.dc.next = next; - ctx->u.dc.factory.hp = hp; - if (!WSTACK_ISEMPTY(flat_maps)) { - WSTACK_SAVE(flat_maps, &ctx->u.dc.flat_maps); - } - if (!PSTACK_IS_EMPTY(hamt_array)) { - PSTACK_SAVE(hamt_array, &ctx->u.dc.hamt_array); - } + ctx->u.dc.hp = hp; + ctx->u.dc.maps_head = maps_head; ctx->reds = 0; return NULL; } @@ -3863,47 +3801,24 @@ } } - ASSERT(hp <= factory->hp_end - || (factory->mode == FACTORY_CLOSED && is_immed(*dbg_resultp))); - factory->hp = hp; - /* - * From here on factory may produce (more) heap fragments - */ - - if (!PSTACK_IS_EMPTY(hamt_array)) { - do { - struct dec_term_hamt* hamt = PSTACK_TOP(hamt_array); - - *hamt->objp = erts_hashmap_from_array(factory, - hamt->leaf_array, - hamt->size, - 1); - if (is_non_value(*hamt->objp)) - goto error_hamt; - - (void) PSTACK_POP(hamt_array); - } while (!PSTACK_IS_EMPTY(hamt_array)); - PSTACK_DESTROY(hamt_array); - } - - /* Iterate through all the (flat)maps and check for validity and sort keys + /* Iterate through all the maps and check for validity and sort keys * - done here for when we know it is complete. */ - while(!WSTACK_ISEMPTY(flat_maps)) { - next = (Eterm *)WSTACK_POP(flat_maps); - if (!erts_validate_and_sort_flatmap((flatmap_t*)next)) - goto error; + while (maps_head) { + next = (Eterm *)(EXPAND_POINTER(*maps_head)); + *maps_head = MAP_HEADER; + if (!erts_validate_and_sort_map((map_t*)maps_head)) + goto error; + maps_head = next; } - WSTACK_DESTROY(flat_maps); - - ASSERT((Eterm*)EXPAND_POINTER(*dbg_resultp) != NULL); if (ctx) { ctx->state = B2TDone; ctx->reds = reds; } + *hpp = hp; return ep; error: @@ -3911,17 +3826,15 @@ * Must unlink all off-heap objects that may have been * linked into the process. */ - if (factory->hp < hp) { /* Sometimes we used hp and sometimes factory->hp */ - factory->hp = hp; /* the largest must be the freshest */ + if (hp < *hpp) { /* Sometimes we used hp and sometimes *hpp */ + hp = *hpp; /* the largest must be the freshest */ } -error_hamt: - erts_factory_undo(factory); - PSTACK_DESTROY(hamt_array); + undo_offheap_in_area(off_heap, hp_saved, hp); + *hpp = hp_saved; if (ctx) { ctx->state = B2TDecodeFail; ctx->reds = reds; } - WSTACK_DESTROY(flat_maps); return NULL; } @@ -3940,35 +3853,51 @@ encode_size_struct_int(TTBSizeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, unsigned dflags, Sint *reds, Uint *res) { - DECLARE_WSTACK(s); + DECLARE_ESTACK(s); Uint m, i, arity; Uint result = 0; Sint r = 0; if (ctx) { - WSTACK_CHANGE_ALLOCATOR(s, ERTS_ALC_T_SAVED_ESTACK); + ESTACK_CHANGE_ALLOCATOR(s, ERTS_ALC_T_SAVED_ESTACK); r = *reds; - if (ctx->wstack.wstart) { /* restore saved stack */ - WSTACK_RESTORE(s, &ctx->wstack); + if (ctx->estack.start) { /* restore saved stack */ + ESTACK_RESTORE(s, &ctx->estack); result = ctx->result; obj = ctx->obj; } } -#define LIST_TAIL_OP ((0 << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER) -#define TERM_ARRAY_OP(N) (((N) << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER) -#define TERM_ARRAY_OP_DEC(OP) ((OP) - (1 << _TAG_PRIMARY_SIZE)) - - - for (;;) { - ASSERT(!is_header(obj)); + goto L_jump_start; + outer_loop: + while (!ESTACK_ISEMPTY(s)) { + obj = ESTACK_POP(s); + handle_popped_obj: + if (is_list(obj)) { + Eterm* cons = list_val(obj); + Eterm tl; + + tl = CDR(cons); + obj = CAR(cons); + ESTACK_PUSH(s, tl); + } else if (is_nil(obj)) { + result++; + goto outer_loop; + } else { + /* + * Other term (in the tail of a non-proper list or + * in a fun's environment). + */ + } + + L_jump_start: if (ctx && --r == 0) { *reds = r; ctx->obj = obj; ctx->result = result; - WSTACK_SAVE(s, &ctx->wstack); + ESTACK_SAVE(s, &ctx->estack); return -1; } switch (tag_val_def(obj)) { @@ -4051,79 +3980,70 @@ result += m + 2 + 1; } else { result += 5; - WSTACK_PUSH2(s, (UWord)CDR(list_val(obj)), (UWord)LIST_TAIL_OP); - obj = CAR(list_val(obj)); - continue; /* big loop */ + goto handle_popped_obj; } break; case TUPLE_DEF: { Eterm* ptr = tuple_val(obj); + Uint i; arity = arityval(*ptr); if (arity <= 0xff) { result += 1 + 1; } else { result += 1 + 4; } - if (arity > 1) { - WSTACK_PUSH2(s, (UWord) (ptr + 2), - (UWord) TERM_ARRAY_OP(arity-1)); + for (i = 1; i <= arity; ++i) { + if (is_list(ptr[i])) { + if ((m = is_string(obj)) && (m < MAX_STRING_LEN)) { + result += m + 2 + 1; + } else { + result += 5; + } + } + ESTACK_PUSH(s,ptr[i]); } - else if (arity == 0) { - break; - } - obj = ptr[1]; - continue; /* big loop */ + goto outer_loop; } + break; case MAP_DEF: - if (is_flatmap(obj)) { - flatmap_t *mp = (flatmap_t*)flatmap_val(obj); - Uint size = flatmap_get_size(mp); + { + map_t *mp = (map_t*)map_val(obj); + Uint size = map_get_size(mp); + Uint i; + Eterm *ptr; result += 1 + 4; /* tag + 4 bytes size */ - if (size) { - WSTACK_PUSH4(s, (UWord) flatmap_get_values(mp), - (UWord) TERM_ARRAY_OP(size), - (UWord) flatmap_get_keys(mp), - (UWord) TERM_ARRAY_OP(size)); - } - } else { - Eterm *ptr; - Eterm hdr; - Uint node_sz; - ptr = boxed_val(obj); - hdr = *ptr; - ASSERT(is_header(hdr)); - switch(hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - ptr++; - node_sz = 16; - result += 1 + 4; /* tag + 4 bytes size */ - break; - case HAMT_SUBTAG_HEAD_BITMAP: - ptr++; - result += 1 + 4; /* tag + 4 bytes size */ - /*fall through*/ - case HAMT_SUBTAG_NODE_BITMAP: - node_sz = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - ASSERT(node_sz < 17); - break; - default: - erl_exit(1, "bad header\r\n"); + /* push values first */ + ptr = map_get_values(mp); + i = size; + while(i--) { + if (is_list(*ptr)) { + if ((m = is_string(*ptr)) && (m < MAX_STRING_LEN)) { + result += m + 2 + 1; + } else { + result += 5; + } + } + ESTACK_PUSH(s,*ptr); + ++ptr; } - ptr++; - WSTACK_RESERVE(s, node_sz*2); - while(node_sz--) { - if (is_list(*ptr)) { - WSTACK_FAST_PUSH(s, CAR(list_val(*ptr))); - WSTACK_FAST_PUSH(s, CDR(list_val(*ptr))); - } else { - WSTACK_FAST_PUSH(s, *ptr); + ptr = map_get_keys(mp); + i = size; + while(i--) { + if (is_list(*ptr)) { + if ((m = is_string(*ptr)) && (m < MAX_STRING_LEN)) { + result += m + 2 + 1; + } else { + result += 5; + } } - ptr++; + ESTACK_PUSH(s,*ptr); + ++ptr; } + goto outer_loop; } break; case FLOAT_DEF: @@ -4176,13 +4096,25 @@ result += 2 * (1 + 4); /* Index + Uniq */ result += 1 + (funp->num_free < 0x100 ? 1 : 4); } - if (funp->num_free > 1) { - WSTACK_PUSH2(s, (UWord) (funp->env + 1), - (UWord) TERM_ARRAY_OP(funp->num_free-1)); + for (i = 1; i < funp->num_free; i++) { + obj = funp->env[i]; + + if (is_not_list(obj)) { + /* Push any non-list terms on the stack */ + ESTACK_PUSH(s, obj); + } else { + /* Lists must be handled specially. */ + if ((m = is_string(obj)) && (m < MAX_STRING_LEN)) { + result += m + 2 + 1; + } else { + result += 5; + ESTACK_PUSH(s, obj); + } + } } if (funp->num_free != 0) { obj = funp->env[0]; - continue; /* big loop */ + goto L_jump_start; } break; } @@ -4205,48 +4137,17 @@ erl_exit(1,"Internal data structure error (in encode_size_struct2)%x\n", obj); } - - if (WSTACK_ISEMPTY(s)) { - break; - } - obj = (Eterm) WSTACK_POP(s); - - if (is_header(obj)) { - switch (obj) { - case LIST_TAIL_OP: - obj = (Eterm) WSTACK_POP(s); - if (is_list(obj)) { - Eterm* cons = list_val(obj); - - WSTACK_PUSH2(s, (UWord)CDR(cons), (UWord)LIST_TAIL_OP); - obj = CAR(cons); - } - break; - - case TERM_ARRAY_OP(1): - obj = *(Eterm*)WSTACK_POP(s); - break; - default: { /* TERM_ARRAY_OP(N) when N > 1 */ - Eterm* ptr = (Eterm*) WSTACK_POP(s); - WSTACK_PUSH2(s, (UWord) (ptr+1), - (UWord) TERM_ARRAY_OP_DEC(obj)); - obj = *ptr; - } - } - } } - WSTACK_DESTROY(s); + DESTROY_ESTACK(s); if (ctx) { - ASSERT(ctx->wstack.wstart == NULL); + ASSERT(ctx->estack.start == NULL); *reds = r; } *res = result; return 0; } - - static Sint decoded_size(byte *ep, byte* endp, int internal_tags, B2TContext* ctx) { @@ -4440,11 +4341,7 @@ n = get_int32(ep); ep += 4; ADDTERMS(2*n); - if (n <= MAP_SMALL_MAP_LIMIT) { - heap_size += 3 + n + 1 + n; - } else { - heap_size += HASHMAP_ESTIMATED_HEAP_SIZE(n); - } + heap_size += 3 + n + 1 + n; break; case STRING_EXT: CHKSIZE(2); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/external.h erlang-17.3-dfsg/erts/emulator/beam/external.h --- erlang-18.2-dfsg/erts/emulator/beam/external.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/external.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 1996-2014. All Rights Reserved. + * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -149,26 +148,21 @@ byte *extp; int exttmp; Uint extsize; - Uint heap_size; } ErtsBinary2TermState; - /* -------------------------------------------------------------------------- */ void erts_init_atom_cache_map(ErtsAtomCacheMap *); void erts_reset_atom_cache_map(ErtsAtomCacheMap *); void erts_destroy_atom_cache_map(ErtsAtomCacheMap *); void erts_finalize_atom_cache_map(ErtsAtomCacheMap *, Uint32); +Uint erts_encode_ext_dist_header_size(ErtsAtomCacheMap *); Uint erts_encode_ext_dist_header_size(ErtsAtomCacheMap *); byte *erts_encode_ext_dist_header_setup(byte *, ErtsAtomCacheMap *); byte *erts_encode_ext_dist_header_finalize(byte *, ErtsAtomCache *, Uint32); -struct erts_dsig_send_context; -int erts_encode_dist_ext_size(Eterm, Uint32, ErtsAtomCacheMap*, Uint* szp); -int erts_encode_dist_ext_size_int(Eterm term, struct erts_dsig_send_context* ctx, Uint* szp); -struct TTBEncodeContext_; -int erts_encode_dist_ext(Eterm, byte **, Uint32, ErtsAtomCacheMap *, - struct TTBEncodeContext_ *, Sint* reds); +Uint erts_encode_dist_ext_size(Eterm, Uint32, ErtsAtomCacheMap *); +void erts_encode_dist_ext(Eterm, byte **, Uint32, ErtsAtomCacheMap *); Uint erts_encode_ext_size(Eterm); Uint erts_encode_ext_size_2(Eterm, unsigned); @@ -187,18 +181,18 @@ int erts_prepare_dist_ext(ErtsDistExternal *, byte *, Uint, DistEntry *, ErtsAtomCache *); Sint erts_decode_dist_ext_size(ErtsDistExternal *); -Eterm erts_decode_dist_ext(ErtsHeapFactory* factory, ErtsDistExternal *); +Eterm erts_decode_dist_ext(Eterm **, ErlOffHeap *, ErtsDistExternal *); Sint erts_decode_ext_size(byte*, Uint); Sint erts_decode_ext_size_ets(byte*, Uint); -Eterm erts_decode_ext(ErtsHeapFactory*, byte**); -Eterm erts_decode_ext_ets(ErtsHeapFactory*, byte*); +Eterm erts_decode_ext(Eterm **, ErlOffHeap *, byte**); +Eterm erts_decode_ext_ets(Eterm **, ErlOffHeap *, byte*); Eterm erts_term_to_binary(Process* p, Eterm Term, int level, Uint flags); Sint erts_binary2term_prepare(ErtsBinary2TermState *, byte *, Sint); void erts_binary2term_abort(ErtsBinary2TermState *); -Eterm erts_binary2term_create(ErtsBinary2TermState *, ErtsHeapFactory*); +Eterm erts_binary2term_create(ErtsBinary2TermState *, Eterm **hpp, ErlOffHeap *); int erts_debug_max_atom_out_cache_index(void); int erts_debug_atom_to_out_cache_index(Eterm); diff -Nru erlang-18.2-dfsg/erts/emulator/beam/global.h erlang-17.3-dfsg/erts/emulator/beam/global.h --- erlang-18.2-dfsg/erts/emulator/beam/global.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/global.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -42,7 +41,6 @@ #include "error.h" #include "erl_utils.h" #include "erl_port.h" -#include "erl_gc.h" struct enif_environment_t /* ErlNifEnv */ { @@ -53,7 +51,6 @@ ErlHeapFragment* heap_frag; int fpe_was_unmasked; struct enif_tmp_obj_t* tmp_obj_list; - int exception_thrown; /* boolean */ }; extern void erts_pre_nif(struct enif_environment_t*, Process*, struct erl_module_nif*); @@ -163,7 +160,6 @@ void (*ready_async)(ErlDrvData drv_data, ErlDrvThreadData thread_data); /* Might be NULL */ void (*process_exit)(ErlDrvData drv_data, ErlDrvMonitor *monitor); void (*stop_select)(ErlDrvEvent event, void*); /* Might be NULL */ - void (*emergency_close)(ErlDrvData drv_data); /* Might be NULL */ }; extern erts_driver_t *driver_list; @@ -231,23 +227,9 @@ ERTS_INTERNAL_BINARY_FIELDS SWord orig_size; void (*destructor)(Binary *); - union { - struct { - ERTS_BINARY_STRUCT_ALIGNMENT - char data[1]; - } aligned; - struct { - char data[1]; - } unaligned; - } u; + char magic_bin_data[1]; } ErtsMagicBinary; -#ifdef ARCH_32 -#define ERTS_MAGIC_BIN_BYTES_TO_ALIGN 4 -#else -#define ERTS_MAGIC_BIN_BYTES_TO_ALIGN 0 -#endif - typedef union { Binary binary; ErtsMagicBinary magic_binary; @@ -267,30 +249,15 @@ #define ERTS_MAGIC_BIN_DESTRUCTOR(BP) \ ((ErtsBinary *) (BP))->magic_binary.destructor #define ERTS_MAGIC_BIN_DATA(BP) \ - ((void *) ((ErtsBinary *) (BP))->magic_binary.u.aligned.data) -#define ERTS_MAGIC_DATA_OFFSET \ - (offsetof(ErtsMagicBinary,u.aligned.data) - offsetof(Binary,orig_bytes)) + ((void *) ((ErtsBinary *) (BP))->magic_binary.magic_bin_data) +#define ERTS_MAGIC_BIN_DATA_SIZE(BP) \ + ((BP)->orig_size - sizeof(void (*)(Binary *))) #define ERTS_MAGIC_BIN_ORIG_SIZE(Sz) \ - (ERTS_MAGIC_DATA_OFFSET + (Sz)) + (sizeof(void (*)(Binary *)) + (Sz)) #define ERTS_MAGIC_BIN_SIZE(Sz) \ - (offsetof(ErtsMagicBinary,u.aligned.data) + (Sz)) - -/* On 32-bit arch these macro variants will save memory - by not forcing 8-byte alignment for the magic payload. -*/ -#define ERTS_MAGIC_BIN_UNALIGNED_DATA(BP) \ - ((void *) ((ErtsBinary *) (BP))->magic_binary.u.unaligned.data) -#define ERTS_MAGIC_UNALIGNED_DATA_OFFSET \ - (offsetof(ErtsMagicBinary,u.unaligned.data) - offsetof(Binary,orig_bytes)) -#define ERTS_MAGIC_BIN_UNALIGNED_DATA_SIZE(BP) \ - ((BP)->orig_size - ERTS_MAGIC_UNALIGNED_DATA_OFFSET) -#define ERTS_MAGIC_BIN_UNALIGNED_ORIG_SIZE(Sz) \ - (ERTS_MAGIC_UNALIGNED_DATA_OFFSET + (Sz)) -#define ERTS_MAGIC_BIN_UNALIGNED_SIZE(Sz) \ - (offsetof(ErtsMagicBinary,u.unaligned.data) + (Sz)) -#define ERTS_MAGIC_BIN_FROM_UNALIGNED_DATA(DATA) \ - ((ErtsBinary*)((char*)(DATA) - offsetof(ErtsMagicBinary,u.unaligned.data))) - + (offsetof(ErtsMagicBinary,magic_bin_data) + (Sz)) +#define ERTS_MAGIC_BIN_FROM_DATA(DATA) \ + ((ErtsBinary*)((char*)(DATA) - offsetof(ErtsMagicBinary,magic_bin_data))) #define Binary2ErlDrvBinary(B) (&((ErtsBinary *) (B))->driver.binary) #define ErlDrvBinary2Binary(D) ((Binary *) \ @@ -379,6 +346,8 @@ extern int erts_backtrace_depth; extern erts_smp_atomic32_t erts_max_gen_gcs; +extern int erts_disable_tolerant_timeofday; + extern int bif_reductions; /* reductions + fcalls (when doing call_bif) */ extern int stackdump_on_exit; @@ -401,17 +370,16 @@ * DESTROY_ESTACK(Stack) */ -typedef struct ErtsEStack_ { +typedef struct { Eterm* start; Eterm* sp; Eterm* end; - Eterm* edefault; ErtsAlcType_t alloc_type; }ErtsEStack; #define DEF_ESTACK_SIZE (16) -void erl_grow_estack(ErtsEStack*, Uint need); +void erl_grow_estack(ErtsEStack*, Eterm* def_stack); #define ESTK_CONCAT(a,b) a##b #define ESTK_DEF_STACK(s) ESTK_CONCAT(s,_default_estack) @@ -421,23 +389,22 @@ ESTK_DEF_STACK(s), /* start */ \ ESTK_DEF_STACK(s), /* sp */ \ ESTK_DEF_STACK(s) + DEF_ESTACK_SIZE, /* end */ \ - ESTK_DEF_STACK(s), /* default */ \ ERTS_ALC_T_ESTACK /* alloc_type */ \ } #define ESTACK_CHANGE_ALLOCATOR(s,t) \ do { \ - if ((s).start != ESTK_DEF_STACK(s)) { \ + if (s.start != ESTK_DEF_STACK(s)) { \ erl_exit(1, "Internal error - trying to change allocator " \ "type of active estack\n"); \ } \ - (s).alloc_type = (t); \ + s.alloc_type = (t); \ } while (0) #define DESTROY_ESTACK(s) \ do { \ - if ((s).start != ESTK_DEF_STACK(s)) { \ - erts_free((s).alloc_type, (s).start); \ + if (s.start != ESTK_DEF_STACK(s)) { \ + erts_free(s.alloc_type, s.start); \ } \ } while(0) @@ -448,17 +415,16 @@ */ #define ESTACK_SAVE(s,dst)\ do {\ - if ((s).start == ESTK_DEF_STACK(s)) {\ + if (s.start == ESTK_DEF_STACK(s)) {\ UWord _wsz = ESTACK_COUNT(s);\ - (dst)->start = erts_alloc((s).alloc_type,\ + (dst)->start = erts_alloc(s.alloc_type,\ DEF_ESTACK_SIZE * sizeof(Eterm));\ - memcpy((dst)->start, (s).start,_wsz*sizeof(Eterm));\ + memcpy((dst)->start, s.start,_wsz*sizeof(Eterm));\ (dst)->sp = (dst)->start + _wsz;\ (dst)->end = (dst)->start + DEF_ESTACK_SIZE;\ - (dst)->edefault = NULL;\ - (dst)->alloc_type = (s).alloc_type;\ + (dst)->alloc_type = s.alloc_type;\ } else\ - *(dst) = (s);\ + *(dst) = s;\ } while (0) #define DESTROY_SAVED_ESTACK(estack)\ @@ -477,114 +443,72 @@ */ #define ESTACK_RESTORE(s, src) \ do { \ - ASSERT((s).start == ESTK_DEF_STACK(s)); \ - (s) = *(src); /* struct copy */ \ + ASSERT(s.start == ESTK_DEF_STACK(s)); \ + s = *(src); /* struct copy */ \ (src)->start = NULL; \ - ASSERT((s).sp >= (s).start); \ - ASSERT((s).sp <= (s).end); \ + ASSERT(s.sp >= s.start); \ + ASSERT(s.sp <= s.end); \ } while (0) -#define ESTACK_IS_STATIC(s) ((s).start == ESTK_DEF_STACK(s)) +#define ESTACK_IS_STATIC(s) (s.start == ESTK_DEF_STACK(s))) -#define ESTACK_PUSH(s, x) \ -do { \ - if ((s).sp == (s).end) { \ - erl_grow_estack(&(s), 1); \ - } \ - *(s).sp++ = (x); \ +#define ESTACK_PUSH(s, x) \ +do { \ + if (s.sp == s.end) { \ + erl_grow_estack(&s, ESTK_DEF_STACK(s)); \ + } \ + *s.sp++ = (x); \ } while(0) #define ESTACK_PUSH2(s, x, y) \ do { \ - if ((s).sp > (s).end - 2) { \ - erl_grow_estack(&(s), 2); \ + if (s.sp > s.end - 2) { \ + erl_grow_estack(&s, ESTK_DEF_STACK(s)); \ } \ - *(s).sp++ = (x); \ - *(s).sp++ = (y); \ + *s.sp++ = (x); \ + *s.sp++ = (y); \ } while(0) #define ESTACK_PUSH3(s, x, y, z) \ do { \ - if ((s).sp > (s).end - 3) { \ - erl_grow_estack(&s, 3); \ + if (s.sp > s.end - 3) { \ + erl_grow_estack(&s, ESTK_DEF_STACK(s)); \ } \ - *(s).sp++ = (x); \ - *(s).sp++ = (y); \ - *(s).sp++ = (z); \ -} while(0) - -#define ESTACK_PUSH4(s, E1, E2, E3, E4) \ -do { \ - if ((s).sp > (s).end - 4) { \ - erl_grow_estack(&s, 4); \ - } \ - *(s).sp++ = (E1); \ - *(s).sp++ = (E2); \ - *(s).sp++ = (E3); \ - *(s).sp++ = (E4); \ -} while(0) - -#define ESTACK_RESERVE(s, push_cnt) \ -do { \ - if ((s).sp > (s).end - (push_cnt)) { \ - erl_grow_estack(&(s), (push_cnt)); \ - } \ + *s.sp++ = (x); \ + *s.sp++ = (y); \ + *s.sp++ = (z); \ } while(0) -/* Must be preceded by ESTACK_RESERVE */ -#define ESTACK_FAST_PUSH(s, x) \ -do { \ - ASSERT((s).sp < (s).end); \ - *s.sp++ = (x); \ -} while(0) - -#define ESTACK_COUNT(s) ((s).sp - (s).start) -#define ESTACK_ISEMPTY(s) ((s).sp == (s).start) -#define ESTACK_POP(s) (*(--(s).sp)) +#define ESTACK_COUNT(s) (s.sp - s.start) +#define ESTACK_ISEMPTY(s) (s.sp == s.start) +#define ESTACK_POP(s) (*(--s.sp)) /* * WSTACK: same as ESTACK but with UWord instead of Eterm */ -typedef struct ErtsWStack_ { +typedef struct { UWord* wstart; UWord* wsp; UWord* wend; - UWord* wdefault; ErtsAlcType_t alloc_type; }ErtsWStack; #define DEF_WSTACK_SIZE (16) -void erl_grow_wstack(ErtsWStack*, Uint need); +void erl_grow_wstack(ErtsWStack*, UWord* def_stack); #define WSTK_CONCAT(a,b) a##b #define WSTK_DEF_STACK(s) WSTK_CONCAT(s,_default_wstack) -#define WSTACK_DECLARE(s) \ +#define DECLARE_WSTACK(s) \ UWord WSTK_DEF_STACK(s)[DEF_WSTACK_SIZE]; \ ErtsWStack s = { \ WSTK_DEF_STACK(s), /* wstart */ \ WSTK_DEF_STACK(s), /* wsp */ \ WSTK_DEF_STACK(s) + DEF_WSTACK_SIZE, /* wend */ \ - WSTK_DEF_STACK(s), /* wdflt */ \ ERTS_ALC_T_ESTACK /* alloc_type */ \ } -#define DECLARE_WSTACK WSTACK_DECLARE - -typedef struct ErtsDynamicWStack_ { - UWord default_stack[DEF_WSTACK_SIZE]; - ErtsWStack ws; -}ErtsDynamicWStack; - -#define WSTACK_INIT(dwsp, ALC_TYPE) \ -do { \ - (dwsp)->ws.wstart = (dwsp)->default_stack; \ - (dwsp)->ws.wsp = (dwsp)->default_stack; \ - (dwsp)->ws.wend = (dwsp)->default_stack + DEF_WSTACK_SIZE;\ - (dwsp)->ws.wdefault = (dwsp)->default_stack; \ - (dwsp)->ws.alloc_type = ALC_TYPE; \ -} while (0) #define WSTACK_CHANGE_ALLOCATOR(s,t) \ do { \ @@ -595,20 +519,13 @@ s.alloc_type = (t); \ } while (0) -#define WSTACK_DESTROY(s) \ +#define DESTROY_WSTACK(s) \ do { \ - if (s.wstart != s.wdefault) { \ + if (s.wstart != WSTK_DEF_STACK(s)) { \ erts_free(s.alloc_type, s.wstart); \ } \ } while(0) -#define DESTROY_WSTACK WSTACK_DESTROY -#define WSTACK_DEBUG(s) \ - do { \ - fprintf(stderr, "wstack size = %ld\r\n", s.wsp - s.wstart); \ - fprintf(stderr, "wstack wstart = %p\r\n", s.wstart); \ - fprintf(stderr, "wstack wsp = %p\r\n", s.wsp); \ - } while(0) /* * Do not free the stack after this, it may have pointers into what @@ -623,7 +540,6 @@ memcpy((dst)->wstart, s.wstart,_wsz*sizeof(UWord));\ (dst)->wsp = (dst)->wstart + _wsz;\ (dst)->wend = (dst)->wstart + DEF_WSTACK_SIZE;\ - (dst)->wdefault = NULL;\ (dst)->alloc_type = s.alloc_type;\ } else\ *(dst) = s;\ @@ -652,12 +568,12 @@ ASSERT(s.wsp <= s.wend); \ } while (0) -#define WSTACK_IS_STATIC(s) (s.wstart == WSTK_DEF_STACK(s)) +#define WSTACK_IS_STATIC(s) (s.wstart == WSTK_DEF_STACK(s))) #define WSTACK_PUSH(s, x) \ do { \ if (s.wsp == s.wend) { \ - erl_grow_wstack(&s, 1); \ + erl_grow_wstack(&s, WSTK_DEF_STACK(s)); \ } \ *s.wsp++ = (x); \ } while(0) @@ -665,7 +581,7 @@ #define WSTACK_PUSH2(s, x, y) \ do { \ if (s.wsp > s.wend - 2) { \ - erl_grow_wstack(&s, 2); \ + erl_grow_wstack(&s, WSTK_DEF_STACK(s)); \ } \ *s.wsp++ = (x); \ *s.wsp++ = (y); \ @@ -673,179 +589,17 @@ #define WSTACK_PUSH3(s, x, y, z) \ do { \ - if (s.wsp > s.wend - 3) { \ - erl_grow_wstack(&s, 3); \ + if (s.wsp > s.wend - 3) { \ + erl_grow_wstack(&s, WSTK_DEF_STACK(s)); \ } \ *s.wsp++ = (x); \ *s.wsp++ = (y); \ *s.wsp++ = (z); \ } while(0) -#define WSTACK_PUSH4(s, A1, A2, A3, A4) \ -do { \ - if (s.wsp > s.wend - 4) { \ - erl_grow_wstack(&s, 4); \ - } \ - *s.wsp++ = (A1); \ - *s.wsp++ = (A2); \ - *s.wsp++ = (A3); \ - *s.wsp++ = (A4); \ -} while(0) - -#define WSTACK_PUSH5(s, A1, A2, A3, A4, A5) \ -do { \ - if (s.wsp > s.wend - 5) { \ - erl_grow_wstack(&s, 5); \ - } \ - *s.wsp++ = (A1); \ - *s.wsp++ = (A2); \ - *s.wsp++ = (A3); \ - *s.wsp++ = (A4); \ - *s.wsp++ = (A5); \ -} while(0) - -#define WSTACK_PUSH6(s, A1, A2, A3, A4, A5, A6) \ -do { \ - if (s.wsp > s.wend - 6) { \ - erl_grow_wstack(&s, 6); \ - } \ - *s.wsp++ = (A1); \ - *s.wsp++ = (A2); \ - *s.wsp++ = (A3); \ - *s.wsp++ = (A4); \ - *s.wsp++ = (A5); \ - *s.wsp++ = (A6); \ -} while(0) - -#define WSTACK_RESERVE(s, push_cnt) \ -do { \ - if (s.wsp > s.wend - (push_cnt)) { \ - erl_grow_wstack(&s, (push_cnt)); \ - } \ -} while(0) - -/* Must be preceded by WSTACK_RESERVE */ -#define WSTACK_FAST_PUSH(s, x) \ -do { \ - ASSERT(s.wsp < s.wend); \ - *s.wsp++ = (x); \ -} while(0) - #define WSTACK_COUNT(s) (s.wsp - s.wstart) #define WSTACK_ISEMPTY(s) (s.wsp == s.wstart) -#define WSTACK_POP(s) ((ASSERT(s.wsp > s.wstart)),*(--s.wsp)) - -#define WSTACK_ROLLBACK(s, count) (ASSERT(WSTACK_COUNT(s) >= (count)), \ - s.wsp = s.wstart + (count)) - -/* PSTACK - Stack of any type. - * Usage: - * { - * #define PSTACK_TYPE MyType - * PSTACK_DECLARE(s,16); - * MyType *sp = PSTACK_PUSH(s); - * - * sp->x = .... - * sp->y = .... - * sp = PSTACK_PUSH(s); - * ... - * sp = PSTACK_POP(s); - * if (PSTACK_IS_EMPTY(s)) { - * // sp is invalid when stack is empty after pop - * } - * - * PSTACK_DESTROY(s); - * } - */ - - -typedef struct ErtsPStack_ { - byte* pstart; - byte* psp; - byte* pend; - ErtsAlcType_t alloc_type; -}ErtsPStack; - -void erl_grow_pstack(ErtsPStack* s, void* default_pstack, unsigned need_bytes); -#define PSTK_CONCAT(a,b) a##b -#define PSTK_DEF_STACK(s) PSTK_CONCAT(s,_default_pstack) - -#define PSTACK_DECLARE(s, DEF_PSTACK_SIZE) \ -PSTACK_TYPE PSTK_DEF_STACK(s)[DEF_PSTACK_SIZE]; \ -ErtsPStack s = { (byte*)PSTK_DEF_STACK(s), /* pstart */ \ - (byte*)(PSTK_DEF_STACK(s) - 1), /* psp */ \ - (byte*)(PSTK_DEF_STACK(s) + (DEF_PSTACK_SIZE)), /* pend */\ - ERTS_ALC_T_ESTACK /* alloc_type */ \ -} - -#define PSTACK_CHANGE_ALLOCATOR(s,t) \ -do { \ - if (s.pstart != (byte*)PSTK_DEF_STACK(s)) { \ - erl_exit(1, "Internal error - trying to change allocator " \ - "type of active pstack\n"); \ - } \ - s.alloc_type = (t); \ - } while (0) - -#define PSTACK_DESTROY(s) \ -do { \ - if (s.pstart != (byte*)PSTK_DEF_STACK(s)) { \ - erts_free(s.alloc_type, s.pstart); \ - } \ -} while(0) - -#define PSTACK_IS_EMPTY(s) (s.psp < s.pstart) - -#define PSTACK_COUNT(s) (((PSTACK_TYPE*)s.psp + 1) - (PSTACK_TYPE*)s.pstart) - -#define PSTACK_TOP(s) (ASSERT(!PSTACK_IS_EMPTY(s)), (PSTACK_TYPE*)(s.psp)) - -#define PSTACK_PUSH(s) \ - (s.psp += sizeof(PSTACK_TYPE), \ - ((s.psp == s.pend) ? erl_grow_pstack(&s, PSTK_DEF_STACK(s), \ - sizeof(PSTACK_TYPE)) : (void)0), \ - ((PSTACK_TYPE*) s.psp)) - -#define PSTACK_POP(s) ((PSTACK_TYPE*) (s.psp -= sizeof(PSTACK_TYPE))) - -/* - * Do not free the stack after this, it may have pointers into what - * was saved in 'dst'. - */ -#define PSTACK_SAVE(s,dst)\ -do {\ - if (s.pstart == (byte*)PSTK_DEF_STACK(s)) {\ - UWord _pbytes = PSTACK_COUNT(s) * sizeof(PSTACK_TYPE);\ - (dst)->pstart = erts_alloc(s.alloc_type,\ - sizeof(PSTK_DEF_STACK(s)));\ - sys_memcpy((dst)->pstart, s.pstart, _pbytes);\ - (dst)->psp = (dst)->pstart + _pbytes - sizeof(PSTACK_TYPE);\ - (dst)->pend = (dst)->pstart + sizeof(PSTK_DEF_STACK(s));\ - (dst)->alloc_type = s.alloc_type;\ - } else\ - *(dst) = s;\ - } while (0) - -/* - * Use on empty stack, only the allocator can be changed before this. - * The src stack is reset to NULL. - */ -#define PSTACK_RESTORE(s, src) \ -do { \ - ASSERT(s.pstart == (byte*)PSTK_DEF_STACK(s)); \ - s = *(src); /* struct copy */ \ - (src)->pstart = NULL; \ - ASSERT(s.psp >= (s.pstart - sizeof(PSTACK_TYPE))); \ - ASSERT(s.psp < s.pend); \ -} while (0) - -#define PSTACK_DESTROY_SAVED(pstack)\ -do {\ - if ((pstack)->pstart) {\ - erts_free((pstack)->alloc_type, (pstack)->pstart);\ - (pstack)->pstart = NULL;\ - }\ -} while(0) +#define WSTACK_POP(s) (*(--s.wsp)) /* binary.c */ @@ -868,6 +622,9 @@ void erts_bif_info_init(void); /* bif.c */ +Eterm erts_make_ref(Process *); +Eterm erts_make_ref_in_buffer(Eterm buffer[REF_THING_SIZE]); +void erts_make_ref_in_array(Uint32 ref[ERTS_MAX_REF_NUMBERS]); ERTS_GLB_INLINE Eterm erts_proc_store_ref(Process *c_p, Uint32 ref[ERTS_MAX_REF_NUMBERS]); @@ -947,9 +704,6 @@ void info(int, void *); void loaded(int, void *); -/* erl_arith.c */ -double erts_get_positive_zero_float(void); - /* config.c */ __decl_noreturn void __noreturn erl_exit(int n, char*, ...); @@ -1055,6 +809,23 @@ void MD5Update(MD5_CTX *, unsigned char *, unsigned int); void MD5Final(unsigned char [16], MD5_CTX *); +/* ggc.c */ + +void erts_gc_info(ErtsGCInfo *gcip); +void erts_init_gc(void); +int erts_garbage_collect(Process*, int, Eterm*, int); +void erts_garbage_collect_hibernate(Process* p); +Eterm erts_gc_after_bif_call(Process* p, Eterm result, Eterm* regs, Uint arity); +void erts_garbage_collect_literals(Process* p, Eterm* literals, + Uint lit_size, + struct erl_off_heap_header* oh); +Uint erts_next_heap_size(Uint, Uint); +Eterm erts_heap_sizes(Process* p); + +void erts_offset_off_heap(ErlOffHeap *, Sint, Eterm*, Eterm*); +void erts_offset_heap_ptr(Eterm*, Uint, Sint, Eterm*, Eterm*); +void erts_offset_heap(Eterm*, Uint, Sint, Eterm*, Eterm*); +void erts_free_heap_frags(Process* p); /* io.c */ @@ -1081,7 +852,6 @@ void erts_stale_drv_select(Eterm, ErlDrvPort, ErlDrvEvent, int, int); Port *erts_get_heart_port(void); -void erts_emergency_close_ports(void); #if defined(ERTS_SMP) && defined(ERTS_ENABLE_LOCK_COUNT) void erts_lcnt_enable_io_lock_count(int enable); @@ -1135,9 +905,6 @@ /* external.c */ void erts_init_external(void); -/* erl_map.c */ -void erts_init_map(void); - /* erl_unicode.c */ void erts_init_unicode(void); Sint erts_unicode_set_loop_limit(Sint limit); @@ -1392,8 +1159,7 @@ state = erts_smp_atomic32_read_acqb(&receiver->state); if (statep) *statep = state; - if (state & (ERTS_PSFLG_EXITING - | ERTS_PSFLG_PENDING_EXIT)) + if (state & (ERTS_PSFLG_EXITING|ERTS_PSFLG_PENDING_EXIT)) goto allocate_in_mbuf; #endif @@ -1413,8 +1179,7 @@ state = erts_smp_atomic32_read_nob(&receiver->state); if (statep) *statep = state; - if ((state & (ERTS_PSFLG_EXITING - | ERTS_PSFLG_PENDING_EXIT)) + if ((state & (ERTS_PSFLG_EXITING|ERTS_PSFLG_PENDING_EXIT)) || (receiver->flags & F_DISABLE_GC) || HEAP_LIMIT(receiver) - HEAP_TOP(receiver) <= size) { /* diff -Nru erlang-18.2-dfsg/erts/emulator/beam/hash.c erlang-17.3-dfsg/erts/emulator/beam/hash.c --- erlang-18.2-dfsg/erts/emulator/beam/hash.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/hash.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/hash.h erlang-17.3-dfsg/erts/emulator/beam/hash.h --- erlang-18.2-dfsg/erts/emulator/beam/hash.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/hash.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/index.c erlang-17.3-dfsg/erts/emulator/beam/index.c --- erlang-18.2-dfsg/erts/emulator/beam/index.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/index.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/index.h erlang-17.3-dfsg/erts/emulator/beam/index.h --- erlang-18.2-dfsg/erts/emulator/beam/index.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/index.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/io.c erlang-17.3-dfsg/erts/emulator/beam/io.c --- erlang-18.2-dfsg/erts/emulator/beam/io.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/io.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -48,8 +47,6 @@ #include "external.h" #include "dtrace-wrapper.h" #include "erl_map.h" -#include "erl_bif_unique.h" -#include "erl_hl_timer.h" extern ErlDrvEntry fd_driver_entry; #ifndef __OSE__ @@ -66,6 +63,8 @@ per thread basis (for BC interfaces) */ ErtsPTab erts_port erts_align_attribute(ERTS_CACHE_LINE_SIZE); /* The port table */ +erts_smp_atomic_t erts_bytes_out; /* No bytes sent out of the system */ +erts_smp_atomic_t erts_bytes_in; /* No bytes gotten into the system */ const ErlDrvTermData driver_term_nil = (ErlDrvTermData)NIL; @@ -79,9 +78,6 @@ int erts_port_schedule_all_ops = 0; int erts_port_parallelism = 0; -static erts_atomic64_t bytes_in; -static erts_atomic64_t bytes_out; - static void deliver_result(Eterm sender, Eterm pid, Eterm res); static int init_driver(erts_driver_t *, ErlDrvEntry *, DE_Handle *); static void terminate_port(Port *p); @@ -382,7 +378,11 @@ prt->dist_entry = NULL; ERTS_PORT_INIT_CONNECTED(prt, pid); prt->common.u.alive.reg = NULL; - ERTS_PTMR_INIT(prt); +#ifdef ERTS_SMP + prt->common.u.alive.ptimer = NULL; +#else + sys_memset(&prt->common.u.alive.tm, 0, sizeof(ErlTimer)); +#endif erts_port_task_handle_init(&prt->timeout_task); prt->psd = NULL; prt->drv_data = (SWord) 0; @@ -391,7 +391,7 @@ /* Set default tracing */ erts_get_default_tracing(&ERTS_TRACE_FLAGS(prt), &ERTS_TRACER_PROC(prt)); - ERTS_CT_ASSERT(offsetof(Port,common) == 0); + ASSERT(((char *) prt) == ((char *) &prt->common)); #if !ERTS_PORT_INIT_INSTR_NEED_ID /* @@ -462,7 +462,11 @@ | ERTS_PORT_SFLG_FREE)); ASSERT(state & ERTS_PORT_SFLG_PORT_DEBUG); - ERTS_LC_ASSERT(erts_atomic_read_nob(&prt->common.refc.atmc) == 0); +#ifdef ERTS_SMP + ERTS_LC_ASSERT(erts_atomic32_read_nob(&prt->common.refc) == 0); +#else + ERTS_LC_ASSERT(erts_atomic32_read_nob(&prt->refc) == 0); +#endif erts_port_task_fini_sched(&prt->sched); @@ -731,7 +735,11 @@ /* * Must clean up the port. */ - erts_cancel_port_timer(port); +#ifdef ERTS_SMP + erts_cancel_smp_ptimer(port->common.u.alive.ptimer); +#else + erts_cancel_timer(&(port->common.u.alive.tm)); +#endif stopq(port); if (port->linebuf != NULL) { erts_free(ERTS_ALC_T_LINEBUF, @@ -1397,22 +1405,39 @@ static ERTS_INLINE void queue_port_sched_op_reply(Process *rp, ErtsProcLocks *rp_locksp, - ErtsHeapFactory* factory, + Eterm *hp_start, + Eterm *hp, + Uint h_size, + ErlHeapFragment* bp, Uint32 *ref_num, Eterm msg) { - Eterm* hp = erts_produce_heap(factory, ERTS_QUEUE_PORT_SCHED_OP_REPLY_SIZE, 0); - Eterm ref; - - ref= make_internal_ref(hp); + Eterm ref = make_internal_ref(hp); write_ref_thing(hp, ref_num[0], ref_num[1], ref_num[2]); hp += REF_THING_SIZE; msg = TUPLE2(hp, ref, msg); + hp += 3; - erts_factory_trim_and_close(factory, &msg, 1); + if (!bp) { + HRelease(rp, hp_start + h_size, hp); + } + else { + Uint used_h_size = hp - hp_start; + ASSERT(h_size >= used_h_size); + if (h_size > used_h_size) + bp = erts_resize_message_buffer(bp, used_h_size, &msg, 1); + } - erts_queue_message(rp, rp_locksp, factory->heap_frags, msg, NIL); + erts_queue_message(rp, + rp_locksp, + bp, + msg, + NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); } static void @@ -1422,10 +1447,9 @@ if (rp) { ErlOffHeap *ohp; ErlHeapFragment* bp; - ErtsHeapFactory factory; Eterm msg_copy; Uint hsz, msg_sz; - Eterm *hp; + Eterm *hp, *hp_start; ErtsProcLocks rp_locks = 0; hsz = ERTS_QUEUE_PORT_SCHED_OP_REPLY_SIZE; @@ -1436,22 +1460,22 @@ hsz += msg_sz; } - hp = erts_alloc_message_heap(hsz, + hp_start = hp = erts_alloc_message_heap(hsz, &bp, &ohp, rp, &rp_locks); - erts_factory_message_init(&factory, rp, hp, bp); if (is_immed(msg)) msg_copy = msg; - else { + else msg_copy = copy_struct(msg, msg_sz, &hp, ohp); - factory.hp = hp; - } queue_port_sched_op_reply(rp, &rp_locks, - &factory, + hp_start, + hp, + hsz, + bp, ref_num, msg_copy); @@ -1536,10 +1560,12 @@ } static ERTS_INLINE void -send_badsig(Port *prt) { +send_badsig(Port *prt) +{ ErtsProcLocks rp_locks = ERTS_PROC_LOCKS_XSIG_SEND; Process* rp; Eterm connected = ERTS_PORT_GET_CONNECTED(prt); + ERTS_SMP_CHK_NO_PROC_LOCKS; ERTS_LC_ASSERT(erts_get_scheduler_id()); @@ -1559,13 +1585,15 @@ 0); if (rp_locks) erts_smp_proc_unlock(rp, rp_locks); - } /* exit sent */ -} /* send_badsig */ + } +} static void -badsig_received(int bang_op, Port *prt, +badsig_received(int bang_op, + Port *prt, erts_aint32_t state, - int bad_output_value) { + int bad_output_value) +{ /* * if (bang_op) * we are part of a "Prt ! Something" operation @@ -1581,12 +1609,12 @@ } if (bang_op) send_badsig(prt); - } /* not invalid */ -} /* behaved accordingly */ + } +} static int -port_badsig(Port *prt, erts_aint32_t state, int op, - ErtsProc2PortSigData *sigdp) { +port_badsig(Port *prt, erts_aint32_t state, int op, ErtsProc2PortSigData *sigdp) +{ if (op == ERTS_PROC2PORT_SIG_EXEC) badsig_received(sigdp->flags & ERTS_P2P_SIG_DATA_FLG_BANG_OP, prt, @@ -1595,14 +1623,16 @@ if (sigdp->flags & ERTS_P2P_SIG_DATA_FLG_REPLY) port_sched_op_reply(sigdp->caller, sigdp->ref, am_badarg); return ERTS_PORT_REDS_BADSIG; -} /* port_badsig */ -/* bad_port_signal() will +} + + +/* + * bad_port_signal() will * - preserve signal order of signals. * - send a 'badsig' exit signal to connected process if 'from' is an * internal pid and the port is alive when the bad signal reaches * it. */ - static ErtsPortOpResult bad_port_signal(Process *c_p, int flags, @@ -1677,7 +1707,6 @@ if (bang_op && from != ERTS_PORT_GET_CONNECTED(prt)) send_badsig(prt); else { - ErtsSchedulerData *esdp = erts_get_scheduler_data(); ErlDrvSizeT size = evp->size; ERTS_SMP_LC_ASSERT(erts_lc_is_port_locked(prt) @@ -1695,10 +1724,7 @@ prt->caller = NIL; prt->bytes_out += size; - if (esdp) - esdp->io.out += (Uint64) size; - else - erts_atomic64_add_nob(&bytes_out, (erts_aint64_t) size); + erts_smp_atomic_add_nob(&erts_bytes_out, size); } } @@ -1778,7 +1804,7 @@ if (bang_op && from != ERTS_PORT_GET_CONNECTED(prt)) send_badsig(prt); else { - ErtsSchedulerData *esdp = erts_get_scheduler_data(); + ERTS_SMP_LC_ASSERT(erts_lc_is_port_locked(prt) || ERTS_IS_CRASH_DUMPING); @@ -1794,10 +1820,7 @@ prt->caller = NIL; prt->bytes_out += size; - if (esdp) - esdp->io.out += (Uint64) size; - else - erts_atomic64_add_nob(&bytes_out, (erts_aint64_t) size); + erts_smp_atomic_add_nob(&erts_bytes_out, size); } } @@ -2744,9 +2767,6 @@ drv_list_rwmtx_opts.type = ERTS_SMP_RWMTX_TYPE_EXTREMELY_FREQUENT_READ; drv_list_rwmtx_opts.lived = ERTS_SMP_RWMTX_LONG_LIVED; - erts_atomic64_init_nob(&bytes_in, 0); - erts_atomic64_init_nob(&bytes_out, 0); - common_element_size = ERTS_ALC_DATA_ALIGN_SIZE(sizeof(Port)); common_element_size += ERTS_ALC_DATA_ALIGN_SIZE(sizeof(ErtsPortTaskBusyPortQ)); common_element_size += 10; /* name */ @@ -2785,8 +2805,10 @@ port_tab_size, common_element_size, /* Doesn't need to be excact */ "port_table", - legacy_port_tab, - 1); + legacy_port_tab); + + erts_smp_atomic_init_nob(&erts_bytes_out, 0); + erts_smp_atomic_init_nob(&erts_bytes_in, 0); sys_init_io(); @@ -2807,6 +2829,7 @@ } #if defined(ERTS_ENABLE_LOCK_COUNT) && defined(ERTS_SMP) + static ERTS_INLINE void lcnt_enable_drv_lock_count(erts_driver_t *dp, int enable) { if (dp->lock) { @@ -2846,26 +2869,25 @@ } } -void erts_lcnt_enable_io_lock_count(int enable) { +void erts_lcnt_enable_io_lock_count(int enable) +{ erts_driver_t *dp; - int ix, max = erts_ptab_max(&erts_port); - Port *prt; + int i, max = erts_ptab_max(&erts_port); - for (ix = 0; ix < max; ix++) { - if ((prt = erts_pix2port(ix)) != NULL) { + for (i = 0; i < max; i++) { + Port *prt = erts_pix2port(i); + if (prt) lcnt_enable_port_lock_count(prt, enable); - } - } /* for all ports */ + } lcnt_enable_drv_lock_count(&vanilla_driver, enable); lcnt_enable_drv_lock_count(&spawn_driver, enable); lcnt_enable_drv_lock_count(&fd_driver, enable); - /* enable lock counting in all drivers */ - for (dp = driver_list; dp; dp = dp->next) { + for (dp = driver_list; dp; dp = dp->next) lcnt_enable_drv_lock_count(dp, enable); - } -} /* enable/disable lock counting of ports */ -#endif /* defined(ERTS_ENABLE_LOCK_COUNT) && defined(ERTS_SMP) */ +} +#endif + /* * Buffering of data when using line oriented I/O on ports */ @@ -3050,7 +3072,7 @@ rp = (scheduler ? erts_proc_lookup(pid) - : erts_pid2proc_opt(NULL, 0, pid, 0, ERTS_P2P_FLG_INC_REFC)); + : erts_pid2proc_opt(NULL, 0, pid, 0, ERTS_P2P_FLG_SMP_INC_REFC)); if (rp) { Eterm tuple; @@ -3063,12 +3085,16 @@ hp = erts_alloc_message_heap(sz_res + 3, &bp, &ohp, rp, &rp_locks); res = copy_struct(res, sz_res, &hp, ohp); tuple = TUPLE2(hp, sender, res); - erts_queue_message(rp, &rp_locks, bp, tuple, NIL); + erts_queue_message(rp, &rp_locks, bp, tuple, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); if (rp_locks) erts_smp_proc_unlock(rp, rp_locks); if (!scheduler) - erts_proc_dec_refc(rp); + erts_smp_proc_dec_refc(rp); } } @@ -3112,7 +3138,7 @@ rp = (scheduler ? erts_proc_lookup(to) - : erts_pid2proc_opt(NULL, 0, to, 0, ERTS_P2P_FLG_INC_REFC)); + : erts_pid2proc_opt(NULL, 0, to, 0, ERTS_P2P_FLG_SMP_INC_REFC)); if (!rp) return; @@ -3127,6 +3153,8 @@ Binary* bptr; bptr = erts_bin_nrml_alloc(len); + bptr->flags = 0; + bptr->orig_size = len; erts_refc_init(&bptr->refc, 1); sys_memcpy(bptr->orig_bytes, buf, len); @@ -3159,11 +3187,15 @@ tuple = TUPLE2(hp, prt->common.id, tuple); hp += 3; - erts_queue_message(rp, &rp_locks, bp, tuple, am_undefined); + erts_queue_message(rp, &rp_locks, bp, tuple, am_undefined +#ifdef USE_VM_PROBES + , NIL +#endif + ); if (rp_locks) erts_smp_proc_unlock(rp, rp_locks); if (!scheduler) - erts_proc_dec_refc(rp); + erts_smp_proc_dec_refc(rp); } /* @@ -3249,7 +3281,7 @@ rp = (scheduler ? erts_proc_lookup(to) - : erts_pid2proc_opt(NULL, 0, to, 0, ERTS_P2P_FLG_INC_REFC)); + : erts_pid2proc_opt(NULL, 0, to, 0, ERTS_P2P_FLG_SMP_INC_REFC)); if (!rp) return; @@ -3326,10 +3358,14 @@ tuple = TUPLE2(hp, prt->common.id, tuple); hp += 3; - erts_queue_message(rp, &rp_locks, bp, tuple, am_undefined); + erts_queue_message(rp, &rp_locks, bp, tuple, am_undefined +#ifdef USE_VM_PROBES + , NIL +#endif + ); erts_smp_proc_unlock(rp, rp_locks); if (!scheduler) - erts_proc_dec_refc(rp); + erts_smp_proc_dec_refc(rp); } @@ -3419,8 +3455,11 @@ send_closed_port_id = NIL; } - if (ERTS_PTMR_IS_SET(prt)) - erts_cancel_port_timer(prt); +#ifdef ERTS_SMP + erts_cancel_smp_ptimer(prt->common.u.alive.ptimer); +#else + erts_cancel_timer(&prt->common.u.alive.tm); +#endif drv = prt->drv_ptr; if ((drv != NULL) && (drv->stop != NULL)) { @@ -3891,13 +3930,12 @@ if (res == ERTS_PORT_OP_DONE) { Eterm msg; - Eterm *hp; + Eterm *hp, *hp_start; ErlHeapFragment *bp; ErlOffHeap *ohp; - ErtsHeapFactory factory; Process *rp; ErtsProcLocks rp_locks = 0; - Uint hsz, rsz; + Uint hsz; int control_flags; rp = erts_proc_lookup_raw(sigdp->caller); @@ -3906,19 +3944,17 @@ control_flags = prt->control_flags; - rsz = port_control_result_size(control_flags, + hsz = ERTS_QUEUE_PORT_SCHED_OP_REPLY_SIZE; + hsz += port_control_result_size(control_flags, resp_bufp, &resp_size, &resp_buf[0]); - hsz = rsz + ERTS_QUEUE_PORT_SCHED_OP_REPLY_SIZE; - - hp = erts_alloc_message_heap(hsz, + hp_start = hp = erts_alloc_message_heap(hsz, &bp, &ohp, rp, &rp_locks); - erts_factory_message_init(&factory, rp, hp, bp); msg = write_port_control_result(control_flags, resp_bufp, @@ -3927,11 +3963,13 @@ &hp, bp, ohp); - factory.hp = hp; queue_port_sched_op_reply(rp, &rp_locks, - &factory, + hp_start, + hp, + hsz, + bp, sigdp->ref, msg); @@ -4049,9 +4087,6 @@ size, &resp_bufp, &resp_size); - - control_flags = prt->control_flags; - finalize_imm_drv_call(&try_call_state); if (tmp_alloced) erts_free(ERTS_ALC_T_TMP, bufp); @@ -4059,6 +4094,8 @@ return ERTS_PORT_OP_BADARG; } + control_flags = prt->control_flags; + hsz = port_control_result_size(control_flags, resp_bufp, &resp_size, @@ -4218,6 +4255,8 @@ if (res == ERTS_PORT_OP_DONE) { Eterm msg; Eterm *hp; + ErlHeapFragment *bp; + ErlOffHeap *ohp; Process *rp; ErtsProcLocks rp_locks = 0; Sint hsz; @@ -4228,31 +4267,29 @@ hsz = erts_decode_ext_size((byte *) resp_bufp, resp_size); if (hsz >= 0) { - ErlHeapFragment* bp; - ErlOffHeap* ohp; - ErtsHeapFactory factory; + Eterm *hp_start; byte *endp; hsz += 3; /* ok tuple */ hsz += ERTS_QUEUE_PORT_SCHED_OP_REPLY_SIZE; - hp = erts_alloc_message_heap(hsz, - &bp, - &ohp, - rp, - &rp_locks); + hp_start = hp = erts_alloc_message_heap(hsz, + &bp, + &ohp, + rp, + &rp_locks); endp = (byte *) resp_bufp; - erts_factory_message_init(&factory, rp, hp, bp); - msg = erts_decode_ext(&factory, &endp); + msg = erts_decode_ext(&hp, ohp, &endp); if (is_value(msg)) { - hp = erts_produce_heap(&factory, - 3, - ERTS_QUEUE_PORT_SCHED_OP_REPLY_SIZE); msg = TUPLE2(hp, am_ok, msg); + hp += 3; queue_port_sched_op_reply(rp, &rp_locks, - &factory, + hp_start, + hp, + hsz, + bp, sigdp->ref, msg); @@ -4260,6 +4297,8 @@ erts_smp_proc_unlock(rp, rp_locks); goto done; } + if (bp) + free_message_buffer(bp); if (rp_locks) erts_smp_proc_unlock(rp, rp_locks); } @@ -4336,11 +4375,10 @@ try_call_res = try_imm_drv_call(&try_call_state); switch (try_call_res) { case ERTS_TRY_IMM_DRV_CALL_OK: { - ErtsHeapFactory factory; + Eterm *hp, *hp_end; Sint hsz; unsigned ret_flags = 0U; Eterm term; - Eterm* hp; res = call_driver_call(c_p->common.id, prt, @@ -4360,14 +4398,15 @@ if (hsz < 0) return ERTS_PORT_OP_BADARG; hsz += 3; - erts_factory_proc_prealloc_init(&factory, c_p, hsz); + hp = HAlloc(c_p, hsz); + hp_end = hp + hsz; endp = (byte *) resp_bufp; - term = erts_decode_ext(&factory, &endp); + term = erts_decode_ext(&hp, &MSO(c_p), &endp); if (term == THE_NON_VALUE) return ERTS_PORT_OP_BADARG; - hp = erts_produce_heap(&factory,3,0); *retvalp = TUPLE2(hp, am_ok, term); - erts_factory_close(&factory); + hp += 3; + HRelease(c_p, hp_end, hp); if (resp_bufp != &resp_buf[0] && !(ret_flags & DRIVER_CALL_KEEP_BUFFER)) driver_free(resp_bufp); @@ -4445,7 +4484,7 @@ int len; int start; static Eterm item[] = ERTS_PORT_INFO_1_ITEMS; - Eterm value[sizeof(item)/sizeof(item[0])]; + static Eterm value[sizeof(item)/sizeof(item[0])]; start = 0; len = sizeof(item)/sizeof(item[0]); @@ -4502,11 +4541,12 @@ prt, sigdp->u.info.item); if (is_value(value)) { - ErtsHeapFactory factory; - erts_factory_message_init(&factory, NULL, hp, bp); queue_port_sched_op_reply(rp, &rp_locks, - &factory, + hp_start, + hp, + hsz, + bp, sigdp->ref, value); } @@ -4577,102 +4617,6 @@ } typedef struct { - Uint sched_id; - Eterm pid; - Uint32 refn[ERTS_REF_NUMBERS]; - erts_smp_atomic32_t refc; -} ErtsIOBytesReq; - -static void -reply_io_bytes(void *vreq) -{ - ErtsIOBytesReq *req = (ErtsIOBytesReq *) vreq; - Process *rp; - - rp = erts_proc_lookup(req->pid); - if (rp) { - ErlOffHeap *ohp = NULL; - ErlHeapFragment *bp = NULL; - ErtsProcLocks rp_locks; - Eterm ref, msg, ein, eout, *hp; - Uint64 in, out; - Uint hsz; - ErtsSchedulerData *esdp = erts_get_scheduler_data(); - Uint sched_id = esdp->no; - in = esdp->io.in; - out = esdp->io.out; - if (req->sched_id != sched_id) - rp_locks = 0; - else { - in += (Uint64) erts_atomic64_read_nob(&bytes_in); - out += (Uint64) erts_atomic64_read_nob(&bytes_out); - rp_locks = ERTS_PROC_LOCK_MAIN; - } - - hsz = 5 /* 4-tuple */ + REF_THING_SIZE; - - erts_bld_uint64(NULL, &hsz, in); - erts_bld_uint64(NULL, &hsz, out); - - hp = erts_alloc_message_heap(hsz, &bp, &ohp, rp, &rp_locks); - - ref = make_internal_ref(hp); - write_ref_thing(hp, req->refn[0], req->refn[1], req->refn[2]); - hp += REF_THING_SIZE; - - ein = erts_bld_uint64(&hp, NULL, in); - eout = erts_bld_uint64(&hp, NULL, out); - - msg = TUPLE4(hp, ref, make_small(sched_id), ein, eout); - erts_queue_message(rp, &rp_locks, bp, msg, NIL); - - if (req->sched_id == sched_id) - rp_locks &= ~ERTS_PROC_LOCK_MAIN; - if (rp_locks) - erts_smp_proc_unlock(rp, rp_locks); - } - - if (erts_smp_atomic32_dec_read_nob(&req->refc) == 0) - erts_free(ERTS_ALC_T_IOB_REQ, req); -} - -Eterm -erts_request_io_bytes(Process *c_p) -{ - Uint *hp; - Eterm ref; - Uint32 *refn; - ErtsSchedulerData *esdp = ERTS_PROC_GET_SCHDATA(c_p); - ErtsIOBytesReq *req = erts_alloc(ERTS_ALC_T_IOB_REQ, - sizeof(ErtsIOBytesReq)); - - hp = HAlloc(c_p, REF_THING_SIZE); - ref = erts_sched_make_ref_in_buffer(esdp, hp); - refn = internal_ref_numbers(ref); - - req->sched_id = esdp->no; - req->pid = c_p->common.id; - req->refn[0] = refn[0]; - req->refn[1] = refn[1]; - req->refn[2] = refn[2]; - erts_smp_atomic32_init_nob(&req->refc, - (erts_aint32_t) erts_no_schedulers); - -#ifdef ERTS_SMP - if (erts_no_schedulers > 1) - erts_schedule_multi_misc_aux_work(1, - erts_no_schedulers, - reply_io_bytes, - (void *) req); -#endif - - reply_io_bytes((void *) req); - - return ref; -} - - -typedef struct { int to; void *arg; } prt_one_lnk_data; @@ -5061,6 +5005,24 @@ erts_free(ERTS_ALC_T_PORT_NAMES, pnp); } +static void schedule_port_timeout(Port *p) +{ + /* + * Scheduling of port timeouts can be done without port locking, but + * since the task handle is stored in the port structure and the ptimer + * structure is protected by the port lock we require the port to be + * locked for now... + * + * TODO: Implement scheduling of port timeouts without locking + * the port. + * /Rickard + */ + ERTS_SMP_LC_ASSERT(erts_lc_is_port_locked(p)); + erts_port_task_schedule(p->common.id, + &p->timeout_task, + ERTS_PORT_TASK_TIMEOUT); +} + ErlDrvTermData driver_mk_term_nil(void) { return driver_term_nil; @@ -5089,7 +5051,7 @@ rp = (scheduler ? erts_proc_lookup(pid) - : erts_pid2proc_opt(NULL, 0, pid, 0, ERTS_P2P_FLG_INC_REFC)); + : erts_pid2proc_opt(NULL, 0, pid, 0, ERTS_P2P_FLG_SMP_INC_REFC)); if (!rp) return; @@ -5099,11 +5061,15 @@ hp += 3; tuple = TUPLE2(hp, prt->common.id, tuple); - erts_queue_message(rp, &rp_locks, bp, tuple, am_undefined); + erts_queue_message(rp, &rp_locks, bp, tuple, am_undefined +#ifdef USE_VM_PROBES + , NIL +#endif + ); erts_smp_proc_unlock(rp, rp_locks); if (!scheduler) - erts_proc_dec_refc(rp); + erts_smp_proc_dec_refc(rp); } #define ERTS_B2T_STATES_DEF_STATES_SZ 5 @@ -5195,27 +5161,22 @@ static int driver_deliver_term(Eterm to, ErlDrvTermData* data, int len) { -#define HEAP_EXTRA 200 #define ERTS_DDT_FAIL do { res = -1; goto done; } while (0) Uint need = 0; int depth = 0; int res; + Eterm *hp = NULL, *hp_start = NULL, *hp_end = NULL; ErlDrvTermData* ptr; ErlDrvTermData* ptr_end; DECLARE_ESTACK(stack); - Eterm mess; + Eterm mess = NIL; /* keeps compiler happy */ Process* rp = NULL; - ErtsHeapFactory factory; + ErlHeapFragment *bp = NULL; + ErlOffHeap *ohp; ErtsProcLocks rp_locks = 0; struct b2t_states__ b2t; - int scheduler; - int is_heap_need_limited = 1; - ErtsSchedulerData *esdp = erts_get_scheduler_data(); - - ERTS_UNDEF(mess,NIL); - ERTS_UNDEF(scheduler,1); + int scheduler = 1; /* Silence erroneous warning... */ - factory.mode = FACTORY_CLOSED; init_b2t_states(&b2t); /* @@ -5379,27 +5340,18 @@ #ifdef DEBUG b2t.org_ext[b2t.ix] = ext; #endif - hsz = erts_binary2term_prepare(&b2t.state[b2t.ix], ext, size); + hsz = erts_binary2term_prepare(&b2t.state[b2t.ix++], ext, size); if (hsz < 0) ERTS_DDT_FAIL; /* Invalid data */ - b2t.state[b2t.ix++].heap_size = hsz; need += hsz; ptr += 2; depth++; - if (size > MAP_SMALL_MAP_LIMIT*3) { /* may contain big map */ - is_heap_need_limited = 0; - } break; } case ERL_DRV_MAP: { /* int */ ERTS_DDT_CHK_ENOUGH_ARGS(1); if ((int) ptr[0] < 0) ERTS_DDT_FAIL; - if (ptr[0] > MAP_SMALL_MAP_LIMIT) { - need += HASHMAP_ESTIMATED_HEAP_SIZE(ptr[0]); - is_heap_need_limited = 0; - } else { - need += MAP_HEADER_FLATMAP_SZ + 1 + 2*ptr[0]; - } + need += MAP_HEADER_SIZE + 1 + 2*ptr[0]; depth -= 2*ptr[0]; if (depth < 0) ERTS_DDT_FAIL; ptr++; @@ -5429,23 +5381,14 @@ scheduler = erts_get_scheduler_id() != 0; rp = (scheduler ? erts_proc_lookup(to) - : erts_pid2proc_opt(NULL, 0, to, 0, ERTS_P2P_FLG_INC_REFC)); + : erts_pid2proc_opt(NULL, 0, to, 0, ERTS_P2P_FLG_SMP_INC_REFC)); if (!rp) { res = 0; goto done; } - /* Try copy directly to destination heap if we know there are no big maps */ - if (is_heap_need_limited) { - ErlOffHeap *ohp; - ErlHeapFragment* bp; - Eterm* hp = erts_alloc_message_heap(need, &bp, &ohp, rp, &rp_locks); - erts_factory_message_init(&factory, rp, hp, bp); - } - else { - erts_factory_message_init(&factory, NULL, NULL, - new_message_buffer(need)); - } + hp_start = hp = erts_alloc_message_heap(need, &bp, &ohp, rp, &rp_locks); + hp_end = hp + need; /* * Interpret the instructions and build the term. @@ -5466,15 +5409,13 @@ case ERL_DRV_INT: /* signed int argument */ #if HALFWORD_HEAP - erts_reserve_heap(&factory, BIG_NEED_SIZE(2)); - mess = erts_bld_sint64(&factory.hp, NULL, (Sint64)ptr[0]); + mess = erts_bld_sint64(&hp, NULL, (Sint64)ptr[0]); #else - erts_reserve_heap(&factory, BIG_UINT_HEAP_SIZE); if (IS_SSMALL((Sint)ptr[0])) mess = make_small((Sint)ptr[0]); else { - mess = small_to_big((Sint)ptr[0], factory.hp); - factory.hp += BIG_UINT_HEAP_SIZE; + mess = small_to_big((Sint)ptr[0], hp); + hp += BIG_UINT_HEAP_SIZE; } #endif ptr++; @@ -5482,29 +5423,25 @@ case ERL_DRV_UINT: /* unsigned int argument */ #if HALFWORD_HEAP - erts_reserve_heap(&factory, BIG_NEED_FOR_BITS(64)); - mess = erts_bld_uint64(&factory.hp, NULL, (Uint64)ptr[0]); + mess = erts_bld_uint64(&hp, NULL, (Uint64)ptr[0]); #else - erts_reserve_heap(&factory, BIG_UINT_HEAP_SIZE); if (IS_USMALL(0, (Uint)ptr[0])) mess = make_small((Uint)ptr[0]); else { - mess = uint_to_big((Uint)ptr[0], factory.hp); - factory.hp += BIG_UINT_HEAP_SIZE; + mess = uint_to_big((Uint)ptr[0], hp); + hp += BIG_UINT_HEAP_SIZE; } #endif ptr++; break; case ERL_DRV_INT64: /* pointer to unsigned 64-bit int argument */ - erts_reserve_heap(&factory, BIG_NEED_FOR_BITS(64)); - mess = erts_bld_sint64(&factory.hp, NULL, *((Sint64 *) ptr[0])); + mess = erts_bld_sint64(&hp, NULL, *((Sint64 *) ptr[0])); ptr++; break; case ERL_DRV_UINT64: /* pointer to unsigned 64-bit int argument */ - erts_reserve_heap(&factory, BIG_NEED_FOR_BITS(64)); - mess = erts_bld_uint64(&factory.hp, NULL, *((Uint64 *) ptr[0])); + mess = erts_bld_uint64(&hp, NULL, *((Uint64 *) ptr[0])); ptr++; break; @@ -5518,14 +5455,11 @@ Uint size = ptr[1]; Uint offset = ptr[2]; - if (esdp) - esdp->io.in += (Uint64) size; - else - erts_atomic64_add_nob(&bytes_in, (erts_aint64_t) size); + erts_smp_atomic_add_nob(&erts_bytes_in, (erts_aint_t) size); if (size <= ERL_ONHEAP_BIN_LIMIT) { - ErlHeapBin* hbp = (ErlHeapBin *) erts_produce_heap(&factory, - heap_bin_size(size), HEAP_EXTRA); + ErlHeapBin* hbp = (ErlHeapBin *) hp; + hp += heap_bin_size(size); hbp->thing_word = header_heap_bin(size); hbp->size = size; if (size > 0) { @@ -5534,18 +5468,18 @@ mess = make_binary(hbp); } else { - ProcBin* pb = (ProcBin *) erts_produce_heap(&factory, - PROC_BIN_SIZE, HEAP_EXTRA); + ProcBin* pb = (ProcBin *) hp; driver_binary_inc_refc(b); /* caller will free binary */ pb->thing_word = HEADER_PROC_BIN; pb->size = size; - pb->next = factory.off_heap->first; - factory.off_heap->first = (struct erl_off_heap_header*)pb; + pb->next = ohp->first; + ohp->first = (struct erl_off_heap_header*)pb; pb->val = ErlDrvBinary2Binary(b); pb->bytes = ((byte*) b->orig_bytes) + offset; pb->flags = 0; mess = make_binary(pb); - OH_OVERHEAD(factory.off_heap, pb->size / sizeof(Eterm)); + hp += PROC_BIN_SIZE; + OH_OVERHEAD(ohp, pb->size / sizeof(Eterm)); } ptr += 3; break; @@ -5555,15 +5489,11 @@ byte *bufp = (byte *) ptr[0]; Uint size = (Uint) ptr[1]; - if (esdp) - esdp->io.in += (Uint64) size; - else - erts_atomic64_add_nob(&bytes_in, (erts_aint64_t) size); + erts_smp_atomic_add_nob(&erts_bytes_in, (erts_aint_t) size); if (size <= ERL_ONHEAP_BIN_LIMIT) { - ErlHeapBin* hbp = (ErlHeapBin *) erts_produce_heap(&factory, - heap_bin_size(size), - HEAP_EXTRA); + ErlHeapBin* hbp = (ErlHeapBin *) hp; + hp += heap_bin_size(size); hbp->thing_word = header_heap_bin(size); hbp->size = size; if (size > 0) { @@ -5576,18 +5506,20 @@ ProcBin* pbp; Binary* bp = erts_bin_nrml_alloc(size); ASSERT(bufp); + bp->flags = 0; + bp->orig_size = (SWord) size; erts_refc_init(&bp->refc, 1); sys_memcpy((void *) bp->orig_bytes, (void *) bufp, size); - pbp = (ProcBin *) erts_produce_heap(&factory, - PROC_BIN_SIZE, HEAP_EXTRA); + pbp = (ProcBin *) hp; + hp += PROC_BIN_SIZE; pbp->thing_word = HEADER_PROC_BIN; pbp->size = size; - pbp->next = factory.off_heap->first; - factory.off_heap->first = (struct erl_off_heap_header*)pbp; + pbp->next = ohp->first; + ohp->first = (struct erl_off_heap_header*)pbp; pbp->val = bp; pbp->bytes = (byte*) bp->orig_bytes; pbp->flags = 0; - OH_OVERHEAD(factory.off_heap, pbp->size / sizeof(Eterm)); + OH_OVERHEAD(ohp, pbp->size / sizeof(Eterm)); mess = make_binary(pbp); } ptr += 2; @@ -5595,19 +5527,14 @@ } case ERL_DRV_STRING: /* char*, length */ - if (esdp) - esdp->io.in += (Uint64) ptr[1]; - else - erts_atomic64_add_nob(&bytes_in, (erts_aint64_t) ptr[1]); - erts_reserve_heap(&factory, 2*ptr[1]); - mess = buf_to_intlist(&factory.hp, (char*)ptr[0], ptr[1], NIL); + erts_smp_atomic_add_nob(&erts_bytes_in, (erts_aint_t) ptr[1]); + mess = buf_to_intlist(&hp, (char*)ptr[0], ptr[1], NIL); ptr += 2; break; case ERL_DRV_STRING_CONS: /* char*, length */ mess = ESTACK_POP(stack); - erts_reserve_heap(&factory, 2*ptr[1]); - mess = buf_to_intlist(&factory.hp, (char*)ptr[0], ptr[1], mess); + mess = buf_to_intlist(&hp, (char*)ptr[0], ptr[1], mess); ptr += 2; break; @@ -5616,12 +5543,11 @@ mess = ESTACK_POP(stack); i--; - erts_reserve_heap(&factory, 2*i); while(i > 0) { Eterm hd = ESTACK_POP(stack); - mess = CONS(factory.hp, hd, mess); - factory.hp += 2; + mess = CONS(hp, hd, mess); + hp += 2; i--; } ptr++; @@ -5630,12 +5556,13 @@ case ERL_DRV_TUPLE: { /* int */ int size = (int)ptr[0]; - Eterm* tp = erts_produce_heap(&factory, size+1, HEAP_EXTRA); + Eterm* tp = hp; *tp = make_arityval(size); mess = make_tuple(tp); tp += size; /* point at last element */ + hp = tp+1; /* advance "heap" pointer */ while(size--) { *tp-- = ESTACK_POP(stack); @@ -5651,22 +5578,18 @@ case ERL_DRV_FLOAT: { /* double * */ FloatDef f; - Eterm* fp = erts_produce_heap(&factory, FLOAT_SIZE_OBJECT, HEAP_EXTRA); - mess = make_float(fp); + mess = make_float(hp); f.fd = *((double *) ptr[0]); - if (!erts_isfinite(f.fd)) - ERTS_DDT_FAIL; - PUT_DOUBLE(f, fp); + PUT_DOUBLE(f, hp); + hp += FLOAT_SIZE_OBJECT; ptr++; break; } case ERL_DRV_EXT2TERM: /* char *ext, int size */ ASSERT(b2t.org_ext[b2t.ix] == (byte *) ptr[0]); - - erts_reserve_heap(&factory, b2t.state[b2t.ix].heap_size); - mess = erts_binary2term_create(&b2t.state[b2t.ix++], &factory); + mess = erts_binary2term_create(&b2t.state[b2t.ix++], &hp, ohp); if (mess == THE_NON_VALUE) ERTS_DDT_FAIL; ptr += 2; @@ -5674,43 +5597,31 @@ case ERL_DRV_MAP: { /* int */ int size = (int)ptr[0]; - if (size > MAP_SMALL_MAP_LIMIT) { - int ix = 2*size; - Eterm* leafs; - - erts_produce_heap(&factory, ix, HEAP_EXTRA); - leafs = factory.hp; - while(ix--) { *--leafs = ESTACK_POP(stack); } - - mess = erts_hashmap_from_array(&factory, leafs, size, 1); - if (is_non_value(mess)) - ERTS_DDT_FAIL; - } else { - Eterm* vp; - flatmap_t *mp; - Eterm* tp = erts_produce_heap(&factory, - 2*size + 1 + MAP_HEADER_FLATMAP_SZ, - HEAP_EXTRA); - - *tp = make_arityval(size); - - mp = (flatmap_t*) (tp + 1 + size); - mp->thing_word = MAP_HEADER_FLATMAP; - mp->size = size; - mp->keys = make_tuple(tp); - mess = make_flatmap(mp); - - tp += size; /* point at last key */ - vp = factory.hp - 1; /* point at last value */ - - while(size--) { - *vp-- = ESTACK_POP(stack); - *tp-- = ESTACK_POP(stack); - } - if (!erts_validate_and_sort_flatmap(mp)) - ERTS_DDT_FAIL; - } - ptr++; + Eterm* tp = hp; + Eterm* vp; + map_t *mp; + + *tp = make_arityval(size); + + hp += 1 + size; + mp = (map_t*)hp; + mp->thing_word = MAP_HEADER; + mp->size = size; + mp->keys = make_tuple(tp); + mess = make_map(mp); + + hp += MAP_HEADER_SIZE + size; /* advance "heap" pointer */ + + tp += size; /* point at last key */ + vp = hp - 1; /* point at last value */ + + while(size--) { + *vp-- = ESTACK_POP(stack); + *tp-- = ESTACK_POP(stack); + } + if (!erts_validate_and_sort_map(mp)) + ERTS_DDT_FAIL; + ptr++; break; } @@ -5724,28 +5635,42 @@ if (res > 0) { mess = ESTACK_POP(stack); /* get resulting value */ - erts_factory_close(&factory); + if (bp) + bp = erts_resize_message_buffer(bp, hp - hp_start, &mess, 1); + else { + ASSERT(hp); + HRelease(rp, hp_end, hp); + } /* send message */ - erts_queue_message(rp, &rp_locks, factory.heap_frags, mess, am_undefined); + erts_queue_message(rp, &rp_locks, bp, mess, am_undefined +#ifdef USE_VM_PROBES + , NIL +#endif + ); } else { if (b2t.ix > b2t.used) b2t.used = b2t.ix; for (b2t.ix = 0; b2t.ix < b2t.used; b2t.ix++) erts_binary2term_abort(&b2t.state[b2t.ix]); - erts_factory_undo(&factory); + if (bp) + free_message_buffer(bp); + else if (hp) { + HRelease(rp, hp_end, hp); + } } +#ifdef ERTS_SMP if (rp) { if (rp_locks) erts_smp_proc_unlock(rp, rp_locks); if (!scheduler) - erts_proc_dec_refc(rp); + erts_smp_proc_dec_refc(rp); } +#endif cleanup_b2t_states(&b2t); DESTROY_ESTACK(stack); return res; #undef ERTS_DDT_FAIL -#undef HEAP_EXTRA } static ERTS_INLINE int @@ -5874,7 +5799,6 @@ { erts_aint32_t state; Port* prt = erts_drvport2port_state(ix, &state); - ErtsSchedulerData *esdp = erts_get_scheduler_data(); ERTS_SMP_CHK_NO_PROC_LOCKS; @@ -5885,10 +5809,7 @@ return 0; prt->bytes_in += (hlen + len); - if (esdp) - esdp->io.in += (Uint64) (hlen + len); - else - erts_atomic64_add_nob(&bytes_in, (erts_aint64_t) (hlen + len)); + erts_smp_atomic_add_nob(&erts_bytes_in, (erts_aint_t) (hlen + len)); if (state & ERTS_PORT_SFLG_DISTRIBUTION) { return erts_net_message(prt, prt->dist_entry, @@ -5913,7 +5834,6 @@ { erts_aint32_t state; Port* prt = erts_drvport2port_state(ix, &state); - ErtsSchedulerData *esdp = erts_get_scheduler_data(); ERTS_SMP_CHK_NO_PROC_LOCKS; @@ -5925,10 +5845,7 @@ return 0; prt->bytes_in += (hlen + len); - if (esdp) - esdp->io.in += (Uint64) (hlen + len); - else - erts_atomic64_add_nob(&bytes_in, (erts_aint64_t) (hlen + len)); + erts_smp_atomic_add_nob(&erts_bytes_in, (erts_aint_t) (hlen + len)); if (state & ERTS_PORT_SFLG_DISTRIBUTION) { if (len == 0) return erts_net_message(prt, @@ -5968,7 +5885,6 @@ ErlDrvBinary** binv; Port* prt; erts_aint32_t state; - ErtsSchedulerData *esdp = erts_get_scheduler_data(); ERTS_SMP_CHK_NO_PROC_LOCKS; @@ -6007,10 +5923,7 @@ /* XXX handle distribution !!! */ prt->bytes_in += (hlen + size); - if (esdp) - esdp->io.in += (Uint64) (hlen + size); - else - erts_atomic64_add_nob(&bytes_in, (erts_aint64_t) (hlen + size)); + erts_smp_atomic_add_nob(&erts_bytes_in, (erts_aint_t) (hlen + size)); deliver_vec_message(prt, ERTS_PORT_GET_CONNECTED(prt), hbuf, hlen, binv, iov, n, size); return 0; @@ -6086,7 +5999,9 @@ bin = erts_bin_drv_alloc_fnf((Uint) size); if (!bin) return NULL; /* The driver write must take action */ + bin->flags = BIN_FLAG_DRV; erts_refc_init(&bin->refc, 1); + bin->orig_size = (SWord) size; return Binary2ErlDrvBinary(bin); } @@ -6116,6 +6031,7 @@ if (!newbin) return NULL; + newbin->orig_size = size; return Binary2ErlDrvBinary(newbin); } @@ -6699,6 +6615,18 @@ return code; } +static ERTS_INLINE void +drv_cancel_timer(Port *prt) +{ +#ifdef ERTS_SMP + erts_cancel_smp_ptimer(prt->common.u.alive.ptimer); +#else + erts_cancel_timer(&prt->common.u.alive.tm); +#endif + if (erts_port_task_is_scheduled(&prt->timeout_task)) + erts_port_task_abort(&prt->timeout_task); +} + int driver_set_timer(ErlDrvPort ix, unsigned long t) { Port* prt = erts_drvport2port(ix); @@ -6710,8 +6638,19 @@ if (prt->drv_ptr->timeout == NULL) return -1; - - erts_set_port_timer(prt, (Sint64) t); + drv_cancel_timer(prt); +#ifdef ERTS_SMP + erts_create_smp_ptimer(&prt->common.u.alive.ptimer, + prt->common.id, + (ErlTimeoutProc) schedule_port_timeout, + t); +#else + erts_set_timer(&prt->common.u.alive.tm, + (ErlTimeoutProc) schedule_port_timeout, + NULL, + prt, + t); +#endif return 0; } @@ -6721,28 +6660,28 @@ if (prt == ERTS_INVALID_ERL_DRV_PORT) return -1; ERTS_SMP_LC_ASSERT(erts_lc_is_port_locked(prt)); - erts_cancel_port_timer(prt); + drv_cancel_timer(prt); return 0; } + int driver_read_timer(ErlDrvPort ix, unsigned long* t) { Port* prt = erts_drvport2port(ix); - Sint64 left; ERTS_SMP_CHK_NO_PROC_LOCKS; if (prt == ERTS_INVALID_ERL_DRV_PORT) return -1; ERTS_SMP_LC_ASSERT(erts_lc_is_port_locked(prt)); - - left = erts_read_port_timer(prt); - if (left < 0) - left = 0; - - *t = (unsigned long) left; - +#ifdef ERTS_SMP + *t = (prt->common.u.alive.ptimer + ? erts_time_left(&prt->common.u.alive.ptimer->timer.tm) + : 0); +#else + *t = erts_time_left(&prt->common.u.alive.tm); +#endif return 0; } @@ -6766,7 +6705,7 @@ { RefThing *refp; ASSERT(is_internal_ref(ref)); - ERTS_CT_ASSERT(sizeof(RefThing) <= sizeof(ErlDrvMonitor)); + ASSERT(sizeof(RefThing) <= sizeof(ErlDrvMonitor)); refp = ref_thing_ptr(ref); memset(mon,0,sizeof(ErlDrvMonitor)); memcpy(mon,refp,sizeof(RefThing)); @@ -7410,8 +7349,6 @@ erts_send_error_to_logger_nogl(dsbufp); } -#define IS_DRIVER_VERSION_GE(DE,MAJOR,MINOR) \ - ((DE)->major_version >= (MAJOR) && (DE)->minor_version >= (MINOR)) static int init_driver(erts_driver_t *drv, ErlDrvEntry *de, DE_Handle *handle) @@ -7459,7 +7396,6 @@ drv->timeout = de->timeout ? de->timeout : no_timeout_callback; drv->ready_async = de->ready_async; drv->process_exit = de->process_exit; - drv->emergency_close = IS_DRIVER_VERSION_GE(de,3,2) ? de->emergency_close : NULL; if (de->stop_select) drv->stop_select = de->stop_select; else @@ -7478,8 +7414,6 @@ } } -#undef IS_DRIVER_VERSION_GE - void erts_destroy_driver(erts_driver_t *drv) { @@ -7596,15 +7530,15 @@ } int -erl_drv_putenv(const char *key, char *value) +erl_drv_putenv(char *key, char *value) { - return erts_sys_putenv_raw((char*)key, value); + return erts_sys_putenv_raw(key, value); } int -erl_drv_getenv(const char *key, char *value, size_t *value_size) +erl_drv_getenv(char *key, char *value, size_t *value_size) { - return erts_sys_getenv_raw((char*)key, value, value_size); + return erts_sys_getenv_raw(key, value, value_size); } /* get heart_port @@ -7623,7 +7557,7 @@ if (!port) continue; /* only examine undead or alive ports */ - if (erts_atomic32_read_nob(&port->state) & ERTS_PORT_SFLGS_INVALID_DRIVER_LOOKUP) + if (erts_atomic32_read_nob(&port->state) & ERTS_PORT_SFLGS_DEAD) continue; /* immediate atom compare */ reg = port->common.u.alive.reg; @@ -7634,23 +7568,3 @@ return NULL; } - -void erts_emergency_close_ports(void) -{ - int ix, max = erts_ptab_max(&erts_port); - - for (ix = 0; ix < max; ix++) { - Port *port = erts_pix2port(ix); - - if (!port) - continue; - /* only examine undead or alive ports */ - if (erts_atomic32_read_nob(&port->state) & ERTS_PORT_SFLGS_INVALID_DRIVER_LOOKUP) - continue; - - /* emergency close socket */ - if (port->drv_ptr->emergency_close) { - port->drv_ptr->emergency_close((ErlDrvData) port->drv_data); - } - } -} diff -Nru erlang-18.2-dfsg/erts/emulator/beam/module.c erlang-17.3-dfsg/erts/emulator/beam/module.c --- erlang-18.2-dfsg/erts/emulator/beam/module.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/module.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/module.h erlang-17.3-dfsg/erts/emulator/beam/module.h --- erlang-18.2-dfsg/erts/emulator/beam/module.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/module.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/ops.tab erlang-17.3-dfsg/erts/emulator/beam/ops.tab --- erlang-18.2-dfsg/erts/emulator/beam/ops.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/ops.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -167,26 +166,22 @@ select_tuple_arity S=d Fail=f Size=u Rest=* => \ gen_select_tuple_arity(S, Fail, Size, Rest) -i_select_val_bins r f I -i_select_val_bins x f I -i_select_val_bins y f I - -i_select_val_lins r f I -i_select_val_lins x f I -i_select_val_lins y f I - -i_select_val2 r f c c f f -i_select_val2 x f c c f f -i_select_val2 y f c c f f +i_select_val r f I +i_select_val x f I +i_select_val y f I + +i_select_val2 r f c f c f +i_select_val2 x f c f c f +i_select_val2 y f c f c f + +i_select_tuple_arity2 r f A f A f +i_select_tuple_arity2 x f A f A f +i_select_tuple_arity2 y f A f A f i_select_tuple_arity r f I i_select_tuple_arity x f I i_select_tuple_arity y f I -i_select_tuple_arity2 r f A A f f -i_select_tuple_arity2 x f A A f f -i_select_tuple_arity2 y f A A f f - i_jump_on_val_zero r f I i_jump_on_val_zero x f I i_jump_on_val_zero y f I @@ -299,49 +294,10 @@ move_jump f x move_jump f y - -# Movement to and from the stack is common -# Try to pack as much as we can into one instruction - -# Window move -move_window/5 -move_window/6 - -# x -> y - -move S1=r S2=y | move X1=x Y1=y => move2 S1 S2 X1 Y1 - -move X1=x Y1=y | move X2=x Y2=y | move X3=x Y3=y | succ(Y1,Y2) | succ(Y2,Y3) => \ - move_window X1 X2 X3 Y1 Y3 - -move_window X1=x X2=x X3=x Y1=y Y3=y | move X4=x Y4=y | succ(Y3,Y4) => \ - move_window X1 X2 X3 X4 Y1 Y4 - -move_window X1=x X2=x X3=x X4=x Y1=y Y4=y | move X5=x Y5=y | succ(Y4,Y5) => \ - move_window5 X1 X2 X3 X4 X5 Y1 - -move_window X1=x X2=x X3=x Y1=y Y3=y => move_window3 X1 X2 X3 Y1 -move_window X1=x X2=x X3=x X4=x Y1=y Y4=y => move_window4 X1 X2 X3 X4 Y1 - -move_window3 x x x y -move_window4 x x x x y -move_window5 x x x x x y - move X1=x Y1=y | move X2=x Y2=y => move2 X1 Y1 X2 Y2 move Y1=y X1=x | move Y2=y X2=x => move2 Y1 X1 Y2 X2 move X1=x X2=x | move X3=x X4=x => move2 X1 X2 X3 X4 -move S1=x S2=r | move S3=x S4=x => move2 S1 S2 S3 S4 -move S1=x S2=r | move X1=x Y1=y => move2 S1 S2 X1 Y1 -move S1=y S2=r | move X1=x Y1=y => move2 S1 S2 X1 Y1 - -move Y1=y X1=x | move S1=r D1=x => move2 Y1 X1 S1 D1 -move S1=r D1=x | move Y1=y X1=x => move2 S1 D1 Y1 X1 - -move2 X1=x Y1=y X2=x Y2=y | move X3=x Y3=y => move3 X1 Y1 X2 Y2 X3 Y3 -move2 Y1=y X1=x Y2=y X2=x | move Y3=y X3=x => move3 Y1 X1 Y2 X2 Y3 X3 -move2 X1=x X2=x X3=x X4=x | move X5=x X6=x => move3 X1 X2 X3 X4 X5 X6 - move C=aiq X=x==1 => move_x1 C move C=aiq X=x==2 => move_x2 C @@ -353,20 +309,6 @@ move2 y x y x move2 x x x x -move2 x r x x - -move2 x r x y -move2 r y x y -move2 y r x y - -move2 r x y x -move2 y x r x - -%macro: move3 Move3 -move3 x y x y x y -move3 y x y x y x -move3 x x x x x x - # The compiler almost never generates a "move Literal y(Y)" instruction, # so let's cheat if we encounter one. move S=n D=y => init D @@ -446,59 +388,14 @@ i_is_ne_exact_literal y f c # -# Common Compare Specializations -# We don't do all of them since we want -# to keep the instruction set small-ish -# - -is_eq_exact Lbl S1=xy S2=r => is_eq_exact Lbl S2 S1 -is_eq_exact Lbl S1=rx S2=xy => i_is_eq_exact_spec Lbl S1 S2 -%macro: i_is_eq_exact_spec EqualExact -fail_action - -i_is_eq_exact_spec f x x -i_is_eq_exact_spec f x y -i_is_eq_exact_spec f r x -i_is_eq_exact_spec f r y -%cold -i_is_eq_exact_spec f r r -%hot - -is_lt Lbl S1=rxc S2=rxc => i_is_lt_spec Lbl S1 S2 - -%macro: i_is_lt_spec IsLessThan -fail_action - -i_is_lt_spec f x x -i_is_lt_spec f x r -i_is_lt_spec f x c -i_is_lt_spec f r x -i_is_lt_spec f r c -i_is_lt_spec f c x -i_is_lt_spec f c r -%cold -i_is_lt_spec f r r -i_is_lt_spec f c c -%hot - -is_ge Lbl S1=xc S2=xc => i_is_ge_spec Lbl S1 S2 - -%macro: i_is_ge_spec IsGreaterEqual -fail_action - -i_is_ge_spec f x x -i_is_ge_spec f x c -i_is_ge_spec f c x -%cold -i_is_ge_spec f c c -%hot - -# # All other comparisons. # is_eq_exact Lbl S1 S2 => i_fetch S1 S2 | i_is_eq_exact Lbl is_ne_exact Lbl S1 S2 => i_fetch S1 S2 | i_is_ne_exact Lbl -is_lt Lbl S1 S2 => i_fetch S1 S2 | i_is_lt Lbl is_ge Lbl S1 S2 => i_fetch S1 S2 | i_is_ge Lbl +is_lt Lbl S1 S2 => i_fetch S1 S2 | i_is_lt Lbl is_eq Lbl S1 S2 => i_fetch S1 S2 | i_is_eq Lbl is_ne Lbl S1 S2 => i_fetch S1 S2 | i_is_ne Lbl @@ -592,6 +489,7 @@ %hot %macro: i_fetch FetchArgs -pack +i_fetch c c i_fetch c r i_fetch c x i_fetch c y @@ -608,7 +506,6 @@ i_fetch y y %cold -i_fetch c c i_fetch s s %hot @@ -1572,67 +1469,79 @@ # Map instructions in R17. # -sorted_put_map_assoc/5 -put_map_assoc F Map Dst Live Size Rest=* | map_key_sort(Size, Rest) => \ - sorted_put_map_assoc F Map Dst Live Size Rest - -sorted_put_map_exact/5 -put_map_exact F Map Dst Live Size Rest=* | map_key_sort(Size, Rest) => \ - sorted_put_map_exact F Map Dst Live Size Rest - -sorted_put_map_assoc j Map Dst Live Size Rest=* | is_empty_map(Map) => \ - new_map Dst Live Size Rest -sorted_put_map_assoc F Src=s Dst Live Size Rest=* => \ +put_map_assoc F n Dst Live Size Rest=* => new_map F Dst Live Size Rest +put_map_assoc F Src=s Dst Live Size Rest=* => \ update_map_assoc F Src Dst Live Size Rest -sorted_put_map_assoc F Src Dst Live Size Rest=* => \ +put_map_assoc F Src Dst Live Size Rest=* => \ move Src x | update_map_assoc F x Dst Live Size Rest - -sorted_put_map_exact F Src=s Dst Live Size Rest=* => \ +put_map_exact F n Dst Live Size Rest=* => new_map F Dst Live Size Rest +put_map_exact F Src=s Dst Live Size Rest=* => \ update_map_exact F Src Dst Live Size Rest -sorted_put_map_exact F Src Dst Live Size Rest=* => \ +put_map_exact F Src Dst Live Size Rest=* => \ move Src x | update_map_exact F x Dst Live Size Rest -new_map d I I +new_map j d I I update_map_assoc j s d I I update_map_exact j s d I I -is_map Fail Lit=q | literal_is_map(Lit) => -is_map Fail cq => jump Fail +is_map Fail Literal=q => move Literal x | is_map Fail x +is_map Fail c => jump Fail %macro: is_map IsMap -fail_action is_map f r is_map f x is_map f y -## Transform has_map_fields #{ K1 := _, K2 := _ } to has_map_elements +## Transform has_map_field(s) #{ K1 := _, K2 := _ } -has_map_fields Fail Src Size Rest=* => \ - gen_has_map_fields(Fail, Src, Size, Rest) +has_map_field/3 + +has_map_fields Fail Src Size=u==1 Rest=* => gen_has_map_field(Fail,Src,Size,Rest) +has_map_fields Fail Src Size Rest=* => i_has_map_fields Fail Src Size Rest + +i_has_map_fields f s I + +has_map_field Fail Src=rxy Key=arxy => i_has_map_field Fail Src Key +has_map_field Fail Src Key => move Key x | i_has_map_field Fail Src x + +%macro: i_has_map_field HasMapField -fail_action +i_has_map_field f r a +i_has_map_field f x a +i_has_map_field f y a +i_has_map_field f r r +i_has_map_field f x r +i_has_map_field f y r +i_has_map_field f r x +i_has_map_field f x x +i_has_map_field f y x +i_has_map_field f r y +i_has_map_field f x y +i_has_map_field f y y ## Transform get_map_elements(s) #{ K1 := V1, K2 := V2 } -get_map_elements Fail Src=rxy Size=u==2 Rest=* => \ - gen_get_map_element(Fail, Src, Size, Rest) -get_map_elements Fail Src Size Rest=* | map_key_sort(Size, Rest) => \ - gen_get_map_elements(Fail, Src, Size, Rest) +get_map_element/4 + +get_map_elements Fail Src=rxy Size=u==2 Rest=* => gen_get_map_element(Fail,Src,Size,Rest) +get_map_elements Fail Src Size Rest=* => i_get_map_elements Fail Src Size Rest i_get_map_elements f s I -i_get_map_element Fail Src=rxy Key=ry Dst => \ +get_map_element Fail Src=rxy Key=ax Dst => i_get_map_element Fail Src Key Dst +get_map_element Fail Src=rxy Key=rycq Dst => \ move Key x | i_get_map_element Fail Src x Dst - -%macro: i_get_map_element_hash GetMapElementHash -fail_action -i_get_map_element_hash f r c I r -i_get_map_element_hash f x c I r -i_get_map_element_hash f y c I r -i_get_map_element_hash f r c I x -i_get_map_element_hash f x c I x -i_get_map_element_hash f y c I x -i_get_map_element_hash f r c I y -i_get_map_element_hash f x c I y -i_get_map_element_hash f y c I y +get_map_element Fail Src Key Dst => jump Fail %macro: i_get_map_element GetMapElement -fail_action +i_get_map_element f r a r +i_get_map_element f x a r +i_get_map_element f y a r +i_get_map_element f r a x +i_get_map_element f x a x +i_get_map_element f y a x +i_get_map_element f r a y +i_get_map_element f x a y +i_get_map_element f y a y i_get_map_element f r x r i_get_map_element f x x r i_get_map_element f y x r @@ -1661,21 +1570,17 @@ # GCing arithmetic instructions. # -gc_bif2 Fail I u$bif:erlang:splus/2 S1=x S2=x Dst=d => i_plus Fail I S1 S2 Dst gc_bif2 Fail I u$bif:erlang:splus/2 S1 S2 Dst=d => i_fetch S1 S2 | i_plus Fail I Dst -gc_bif2 Fail I u$bif:erlang:sminus/2 S1=x S2=x Dst=d => i_minus Fail I S1 S2 Dst gc_bif2 Fail I u$bif:erlang:sminus/2 S1 S2 Dst=d => i_fetch S1 S2 | i_minus Fail I Dst gc_bif2 Fail I u$bif:erlang:stimes/2 S1 S2 Dst=d => i_fetch S1 S2 | i_times Fail I Dst gc_bif2 Fail I u$bif:erlang:div/2 S1 S2 Dst=d => i_fetch S1 S2 | i_m_div Fail I Dst gc_bif2 Fail I u$bif:erlang:intdiv/2 S1 S2 Dst=d => i_fetch S1 S2 | i_int_div Fail I Dst -gc_bif2 Fail I u$bif:erlang:rem/2 S1=x S2=x Dst=d => i_rem Fail I S1 S2 Dst gc_bif2 Fail I u$bif:erlang:rem/2 S1 S2 Dst=d => i_fetch S1 S2 | i_rem Fail I Dst gc_bif2 Fail I u$bif:erlang:bsl/2 S1 S2 Dst=d => i_fetch S1 S2 | i_bsl Fail I Dst gc_bif2 Fail I u$bif:erlang:bsr/2 S1 S2 Dst=d => i_fetch S1 S2 | i_bsr Fail I Dst -gc_bif2 Fail I u$bif:erlang:band/2 S1=x S2=c Dst=d => i_band Fail I S1 S2 Dst gc_bif2 Fail I u$bif:erlang:band/2 S1 S2 Dst=d => i_fetch S1 S2 | i_band Fail I Dst gc_bif2 Fail I u$bif:erlang:bor/2 S1 S2 Dst=d => i_fetch S1 S2 | i_bor Fail I Dst gc_bif2 Fail I u$bif:erlang:bxor/2 S1 S2 Dst=d => i_fetch S1 S2 | i_bxor Fail I Dst @@ -1689,20 +1594,16 @@ i_increment x I I d i_increment y I I d -i_plus j I x x d i_plus j I d -i_minus j I x x d i_minus j I d i_times j I d i_m_div j I d i_int_div j I d -i_rem j I x x d i_rem j I d i_bsl j I d i_bsr j I d -i_band j I x c d i_band j I d i_bor j I d i_bxor j I d diff -Nru erlang-18.2-dfsg/erts/emulator/beam/packet_parser.c erlang-17.3-dfsg/erts/emulator/beam/packet_parser.c --- erlang-18.2-dfsg/erts/emulator/beam/packet_parser.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/packet_parser.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -256,7 +255,6 @@ const char* ptr, unsigned n, /* Bytes read so far */ unsigned max_plen, /* Max packet length, 0=no limit */ unsigned trunc_len, /* Truncate (lines) if longer, 0=no limit */ - char delimiter, /* Line delimiting character */ int* statep) /* Protocol specific state */ { unsigned hlen, plen; @@ -300,9 +298,9 @@ goto remain; case TCP_PB_LINE_LF: { - /* TCP_PB_LINE_LF: [Data ... Delimiter] */ + /* TCP_PB_LINE_LF: [Data ... \n] */ const char* ptr2; - if ((ptr2 = memchr(ptr, delimiter, n)) == NULL) { + if ((ptr2 = memchr(ptr, '\n', n)) == NULL) { if (n > max_plen && max_plen != 0) { /* packet full */ DEBUGF((" => packet full (no NL)=%d\r\n", n)); goto error; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/packet_parser.h erlang-17.3-dfsg/erts/emulator/beam/packet_parser.h --- erlang-18.2-dfsg/erts/emulator/beam/packet_parser.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/packet_parser.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -105,8 +104,7 @@ const char* ptr, unsigned n, /* Bytes read so far */ unsigned max_plen, /* Packet max length, 0=no limit */ unsigned trunc_len, /* Truncate (lines) if longer, 0=no limit */ - char delimiter, /* Line delimiting character */ - int* statep); /* Internal protocol state */ + int* statep); /* Internal protocol state */ ERTS_GLB_INLINE void packet_get_body(enum PacketParseType htype, diff -Nru erlang-18.2-dfsg/erts/emulator/beam/register.c erlang-17.3-dfsg/erts/emulator/beam/register.c --- erlang-18.2-dfsg/erts/emulator/beam/register.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/register.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -270,10 +269,7 @@ #ifdef ERTS_SMP ErtsProcLocks c_p_locks = c_p ? ERTS_PROC_LOCK_MAIN : 0; -#ifdef ERTS_ENABLE_LOCK_CHECK - if (c_p) ERTS_SMP_CHK_HAVE_ONLY_MAIN_PROC_LOCK(c_p); -#endif - + ERTS_SMP_CHK_HAVE_ONLY_MAIN_PROC_LOCK(c_p); reg_safe_read_lock(c_p, &c_p_locks); if (c_p && !c_p_locks) erts_smp_proc_lock(c_p, ERTS_PROC_LOCK_MAIN); @@ -384,6 +380,8 @@ erts_smp_proc_unlock(rp->p, need_locks); *proc = NULL; } + if (*proc && (flags & ERTS_P2P_FLG_SMP_INC_REFC)) + erts_smp_proc_inc_refc(rp->p); } #else if (rp->p @@ -392,8 +390,6 @@ else *proc = NULL; #endif - if (*proc && (flags & ERTS_P2P_FLG_INC_REFC)) - erts_proc_inc_refc(*proc); } } diff -Nru erlang-18.2-dfsg/erts/emulator/beam/register.h erlang-17.3-dfsg/erts/emulator/beam/register.h --- erlang-18.2-dfsg/erts/emulator/beam/register.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/register.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/safe_hash.c erlang-17.3-dfsg/erts/emulator/beam/safe_hash.c --- erlang-18.2-dfsg/erts/emulator/beam/safe_hash.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/safe_hash.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/safe_hash.h erlang-17.3-dfsg/erts/emulator/beam/safe_hash.h --- erlang-18.2-dfsg/erts/emulator/beam/safe_hash.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/safe_hash.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/sys.h erlang-17.3-dfsg/erts/emulator/beam/sys.h --- erlang-18.2-dfsg/erts/emulator/beam/sys.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/sys.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -21,41 +20,6 @@ #ifndef __SYS_H__ #define __SYS_H__ -#ifdef ERTS_INLINE -# ifndef ERTS_CAN_INLINE -# define ERTS_CAN_INLINE 1 -# endif -#else -# if defined(__GNUC__) -# define ERTS_CAN_INLINE 1 -# define ERTS_INLINE __inline__ -# elif defined(__WIN32__) -# define ERTS_CAN_INLINE 1 -# define ERTS_INLINE __inline -# else -# define ERTS_CAN_INLINE 0 -# define ERTS_INLINE -# endif -#endif - -#if defined(DEBUG) || defined(ERTS_ENABLE_LOCK_CHECK) -# undef ERTS_CAN_INLINE -# define ERTS_CAN_INLINE 0 -# undef ERTS_INLINE -# define ERTS_INLINE -#endif - -#if ERTS_CAN_INLINE -#define ERTS_GLB_INLINE static ERTS_INLINE -#else -#define ERTS_GLB_INLINE -#endif - -#if ERTS_CAN_INLINE || defined(ERTS_DO_INCL_GLB_INLINE_FUNC_DEF) -# define ERTS_GLB_INLINE_INCL_FUNC_DEF 1 -#else -# define ERTS_GLB_INLINE_INCL_FUNC_DEF 0 -#endif #if defined(VALGRIND) && !defined(NO_FPE_SIGNALS) # define NO_FPE_SIGNALS @@ -102,15 +66,28 @@ */ #ifndef ERTS_SYS_FD_TYPE -#define ERTS_SYS_FD_INVALID ((ErtsSysFdType) -1) typedef int ErtsSysFdType; #else -#ifndef ERTS_SYS_FD_INVALID -# error missing ERTS_SYS_FD_INVALID -#endif typedef ERTS_SYS_FD_TYPE ErtsSysFdType; #endif +#ifdef ERTS_INLINE +# ifndef ERTS_CAN_INLINE +# define ERTS_CAN_INLINE 1 +# endif +#else +# if defined(__GNUC__) +# define ERTS_CAN_INLINE 1 +# define ERTS_INLINE __inline__ +# elif defined(__WIN32__) +# define ERTS_CAN_INLINE 1 +# define ERTS_INLINE __inline +# else +# define ERTS_CAN_INLINE 0 +# define ERTS_INLINE +# endif +#endif + #if !defined(__GNUC__) # define ERTS_AT_LEAST_GCC_VSN__(MAJ, MIN, PL) 0 #elif !defined(__GNUC_MINOR__) @@ -151,8 +128,24 @@ # endif #endif -#define ERTS_MK_VSN_INT(Major, Minor, Build) \ - ((((Major) & 0x3ff) << 20) | (((Minor) & 0x3ff) << 10) | ((Build) & 0x3ff)) +#if defined(DEBUG) || defined(ERTS_ENABLE_LOCK_CHECK) +# undef ERTS_CAN_INLINE +# define ERTS_CAN_INLINE 0 +# undef ERTS_INLINE +# define ERTS_INLINE +#endif + +#if ERTS_CAN_INLINE +#define ERTS_GLB_INLINE static ERTS_INLINE +#else +#define ERTS_GLB_INLINE +#endif + +#if ERTS_CAN_INLINE || defined(ERTS_DO_INCL_GLB_INLINE_FUNC_DEF) +# define ERTS_GLB_INLINE_INCL_FUNC_DEF 1 +#else +# define ERTS_GLB_INLINE_INCL_FUNC_DEF 0 +#endif #ifndef ERTS_EXIT_AFTER_DUMP # define ERTS_EXIT_AFTER_DUMP exit @@ -191,32 +184,6 @@ # define ASSERT(e) ((void) 1) #endif -/* ERTS_UNDEF can be used to silence false warnings about - * "variable may be used uninitialized" while keeping the variable - * marked as undefined by valgrind. - */ -#ifdef VALGRIND -# define ERTS_UNDEF(V,I) -#else -# define ERTS_UNDEF(V,I) V = I -#endif - -/* - * Compile time assert - * (the actual compiler error msg can be a bit confusing) - */ -#if ERTS_AT_LEAST_GCC_VSN__(3,1,1) -# define ERTS_CT_ASSERT(e) \ - do { \ - enum { compile_time_assert__ = __builtin_choose_expr((e),0,(void)0) }; \ - } while(0) -#else -# define ERTS_CT_ASSERT(e) \ - do { \ - enum { compile_time_assert__ = 1/(e) }; \ - } while (0) -#endif - /* * Microsoft C/C++: We certainly want to use stdarg.h and prototypes. * But MSC doesn't define __STDC__, unless we compile with the -Za @@ -388,45 +355,17 @@ typedef UWord BeamInstr; #ifndef HAVE_INT64 -# if SIZEOF_LONG == 8 -# define HAVE_INT64 1 +#if SIZEOF_LONG == 8 +#define HAVE_INT64 1 typedef unsigned long Uint64; typedef long Sint64; -# ifdef ULONG_MAX -# define ERTS_UINT64_MAX ULONG_MAX -# endif -# ifdef LONG_MAX -# define ERTS_SINT64_MAX LONG_MAX -# endif -# ifdef LONG_MIN -# define ERTS_SINT64_MIN LONG_MIN -# endif -# elif SIZEOF_LONG_LONG == 8 -# define HAVE_INT64 1 +#elif SIZEOF_LONG_LONG == 8 +#define HAVE_INT64 1 typedef unsigned long long Uint64; typedef long long Sint64; -# ifdef ULLONG_MAX -# define ERTS_UINT64_MAX ULLONG_MAX -# endif -# ifdef LLONG_MAX -# define ERTS_SINT64_MAX LLONG_MAX -# endif -# ifdef LLONG_MIN -# define ERTS_SINT64_MIN LLONG_MIN -# endif -# else -# error "No 64-bit integer type found" -# endif -#endif - -#ifndef ERTS_UINT64_MAX -# define ERTS_UINT64_MAX (~((Uint64) 0)) -#endif -#ifndef ERTS_SINT64_MAX -# define ERTS_SINT64_MAX ((Sint64) ((((Uint64) 1) << 63)-1)) +#else +#define HAVE_INT64 0 #endif -#ifndef ERTS_SINT64_MIN -# define ERTS_SINT64_MIN (-1*(((Sint64) 1) << 63)) #endif #if SIZEOF_LONG == 4 @@ -562,7 +501,7 @@ # define NO_ERF # define NO_ERFC /* This definition doesn't take NaN into account, but matherr() gets those */ -# define isfinite(x) (fabs(x) != HUGE_VAL) +# define finite(x) (fabs(x) != HUGE_VAL) # define USE_MATHERR # define HAVE_FINITE #endif @@ -634,6 +573,7 @@ /* Io constants to erts_print and erts_putc */ #define ERTS_PRINT_STDERR (2) #define ERTS_PRINT_STDOUT (1) +#define ERTS_PRINT_INVALID (0) /* Don't want to use 0 since CBUF was 0 */ #define ERTS_PRINT_FILE (-1) #define ERTS_PRINT_SBUF (-2) #define ERTS_PRINT_SNBUF (-3) @@ -656,7 +596,6 @@ int erts_send_info_to_logger(Eterm, erts_dsprintf_buf_t *); int erts_send_warning_to_logger(Eterm, erts_dsprintf_buf_t *); int erts_send_error_to_logger(Eterm, erts_dsprintf_buf_t *); -int erts_send_error_term_to_logger(Eterm, erts_dsprintf_buf_t *, Eterm); int erts_send_info_to_logger_str(Eterm, char *); int erts_send_warning_to_logger_str(Eterm, char *); int erts_send_error_to_logger_str(Eterm, char *); @@ -703,37 +642,14 @@ extern char os_type[]; -typedef struct { - int have_os_monotonic_time; - int have_corrected_os_monotonic_time; - ErtsMonotonicTime os_monotonic_time_unit; - ErtsMonotonicTime sys_clock_resolution; - struct { - Uint64 resolution; - char *func; - char *clock_id; - int locked_use; - int extended; - } os_monotonic_time_info; - struct { - Uint64 resolution; - char *func; - char *clock_id; - int locked_use; - } os_system_time_info; -} ErtsSysInitTimeResult; - -#define ERTS_SYS_INIT_TIME_RESULT_INITER \ - {0, 0, (ErtsMonotonicTime) -1, (ErtsMonotonicTime) 1} - -extern void erts_init_sys_time_sup(void); -extern void sys_init_time(ErtsSysInitTimeResult *); -extern void erts_late_sys_init_time(void); +extern int sys_init_time(void); extern void erts_deliver_time(void); extern void erts_time_remaining(SysTimeval *); +extern int erts_init_time_sup(void); extern void erts_sys_init_float(void); extern void erts_thread_init_float(void); extern void erts_thread_disable_fpe(void); + ERTS_GLB_INLINE int erts_block_fpe(void); ERTS_GLB_INLINE void erts_unblock_fpe(int); @@ -776,9 +692,11 @@ /* * System interfaces for startup. */ +#include "erl_time.h" + void erts_sys_schedule_interrupt(int set); #ifdef ERTS_SMP -void erts_sys_schedule_interrupt_timed(int, ErtsMonotonicTime); +void erts_sys_schedule_interrupt_timed(int set, erts_short_time_t msec); void erts_sys_main_thread(void); #endif @@ -817,8 +735,6 @@ int local_to_univ(Sint *year, Sint *month, Sint *day, Sint *hour, Sint *minute, Sint *second, int isdst); void get_now(Uint*, Uint*, Uint*); -struct ErtsSchedulerData_; -ErtsMonotonicTime erts_get_monotonic_time(struct ErtsSchedulerData_ *); void get_sys_now(Uint*, Uint*, Uint*); void set_break_quit(void (*)(void), void (*)(void)); @@ -828,16 +744,6 @@ char * getenv_string(GETENV_STATE *); void fini_getenv_state(GETENV_STATE *); -#define HAVE_ERTS_CHECK_IO_DEBUG -typedef struct { - int no_used_fds; - int no_driver_select_structs; - int no_driver_event_structs; -} ErtsCheckIoDebugInfo; -int erts_check_io_debug(ErtsCheckIoDebugInfo *ip); - -int erts_sys_is_area_readable(char *start, char *stop); - /* xxxP */ #define SYS_DEFAULT_FLOAT_DECIMALS 20 void init_sys_float(void); @@ -866,11 +772,6 @@ char *erts_read_env(char *key); void erts_free_read_env(void *value); -#if defined(ERTS_THR_HAVE_SIG_FUNCS) && !defined(ETHR_UNUSABLE_SIGUSRX) -extern void sys_thr_resume(erts_tid_t tid); -extern void sys_thr_suspend(erts_tid_t tid); -#endif - /* utils.c */ /* Options to sys_alloc_opt */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/time.c erlang-17.3-dfsg/erts/emulator/beam/time.c --- erlang-18.2-dfsg/erts/emulator/beam/time.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/time.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -77,11 +76,6 @@ #include "sys.h" #include "erl_vm.h" #include "global.h" -#define ERTS_WANT_TIMER_WHEEL_API -#include "erl_time.h" - -#define ERTS_MONOTONIC_DAY ERTS_SEC_TO_MONOTONIC(60*60*24) -#define ERTS_CLKTCKS_DAY ERTS_MONOTONIC_TO_CLKTCKS(ERTS_MONOTONIC_DAY) #ifdef ERTS_ENABLE_LOCK_CHECK #define ASSERT_NO_LOCKED_LOCKS erts_lc_check_exact(NULL, 0) @@ -89,25 +83,26 @@ #define ASSERT_NO_LOCKED_LOCKS #endif -#if 0 -# define ERTS_TW_DEBUG -#endif -#if defined(DEBUG) && !defined(ERTS_TW_DEBUG) -# define ERTS_TW_DEBUG -#endif +static erts_smp_mtx_t tiw_lock; -#undef ERTS_TW_ASSERT -#if defined(ERTS_TW_DEBUG) -# define ERTS_TW_ASSERT(E) ERTS_ASSERT(E) -#else -# define ERTS_TW_ASSERT(E) ((void) 1) -#endif -#ifdef ERTS_TW_DEBUG -# define ERTS_TWHEEL_BUMP_YIELD_LIMIT 5 +/* BEGIN tiw_lock protected variables +** +** The individual timer cells in tiw are also protected by the same mutex. +*/ + +#ifdef SMALL_MEMORY +#define TIW_SIZE 8192 #else -# define ERTS_TWHEEL_BUMP_YIELD_LIMIT 100 +#define TIW_SIZE 65536 /* timing wheel size (should be a power of 2) */ #endif +static ErlTimer** tiw; /* the timing wheel, allocated in init_time() */ +static Uint tiw_pos; /* current position in wheel */ +static Uint tiw_nto; /* number of timeouts in wheel */ +static Uint tiw_min; +static ErlTimer *tiw_min_ptr; + +/* END tiw_lock protected variables */ /* Actual interval time chosen by sys_init_time() */ @@ -119,440 +114,209 @@ # define TIW_ITIME tiw_itime #endif -struct ErtsTimerWheel_ { - ErtsTWheelTimer *w[ERTS_TIW_SIZE]; - ErtsMonotonicTime pos; - Uint nto; - struct { - ErtsTWheelTimer *head; - ErtsTWheelTimer *tail; - Uint nto; - } at_once; - int yield_slot; - int yield_slots_left; - int yield_start_pos; - ErtsTWheelTimer sentinel; - int true_next_timeout_time; - ErtsMonotonicTime next_timeout_time; -}; - -static ERTS_INLINE ErtsMonotonicTime -find_next_timeout(ErtsSchedulerData *esdp, - ErtsTimerWheel *tiw, - int search_all, - ErtsMonotonicTime curr_time, /* When !search_all */ - ErtsMonotonicTime max_search_time) /* When !search_all */ -{ - int start_ix, tiw_pos_ix; - ErtsTWheelTimer *p; - int true_min_timeout = 0; - ErtsMonotonicTime min_timeout, min_timeout_pos, slot_timeout_pos; - - if (tiw->nto == 0) { /* no timeouts in wheel */ - if (!search_all) - min_timeout_pos = tiw->pos; - else { - curr_time = erts_get_monotonic_time(esdp); - tiw->pos = min_timeout_pos = ERTS_MONOTONIC_TO_CLKTCKS(curr_time); - } - min_timeout_pos += ERTS_MONOTONIC_TO_CLKTCKS(ERTS_MONOTONIC_DAY); - goto found_next; - } - - slot_timeout_pos = min_timeout_pos = tiw->pos; - if (search_all) - min_timeout_pos += ERTS_MONOTONIC_TO_CLKTCKS(ERTS_MONOTONIC_DAY); - else - min_timeout_pos = ERTS_MONOTONIC_TO_CLKTCKS(curr_time + max_search_time); - - start_ix = tiw_pos_ix = (int) (tiw->pos & (ERTS_TIW_SIZE-1)); - - do { - if (++slot_timeout_pos >= min_timeout_pos) - break; - - p = tiw->w[tiw_pos_ix]; - - if (p) { - ErtsTWheelTimer *end = p; - - do { - ErtsMonotonicTime timeout_pos; - timeout_pos = p->timeout_pos; - if (min_timeout_pos > timeout_pos) { - true_min_timeout = 1; - min_timeout_pos = timeout_pos; - if (min_timeout_pos <= slot_timeout_pos) - goto found_next; - } - p = p->next; - } while (p != end); - } - - tiw_pos_ix++; - if (tiw_pos_ix == ERTS_TIW_SIZE) - tiw_pos_ix = 0; - } while (start_ix != tiw_pos_ix); - -found_next: - - min_timeout = ERTS_CLKTCKS_TO_MONOTONIC(min_timeout_pos); - tiw->next_timeout_time = min_timeout; - tiw->true_next_timeout_time = true_min_timeout; - - return min_timeout; +erts_smp_atomic32_t do_time; /* set at clock interrupt */ +static ERTS_INLINE erts_short_time_t do_time_read(void) +{ + return erts_smp_atomic32_read_acqb(&do_time); } -static ERTS_INLINE void -insert_timer_into_slot(ErtsTimerWheel *tiw, int slot, ErtsTWheelTimer *p) +static ERTS_INLINE erts_short_time_t do_time_update(void) { - ERTS_TW_ASSERT(slot >= 0); - ERTS_TW_ASSERT(slot < ERTS_TIW_SIZE); - p->slot = slot; - if (!tiw->w[slot]) { - tiw->w[slot] = p; - p->next = p; - p->prev = p; - } - else { - ErtsTWheelTimer *next, *prev; - next = tiw->w[slot]; - prev = next->prev; - p->next = next; - p->prev = prev; - prev->next = p; - next->prev = p; - } + return do_time_read(); } -static ERTS_INLINE void -remove_timer(ErtsTimerWheel *tiw, ErtsTWheelTimer *p) +static ERTS_INLINE void do_time_init(void) { - int slot = p->slot; - ERTS_TW_ASSERT(slot != ERTS_TWHEEL_SLOT_INACTIVE); + erts_smp_atomic32_init_nob(&do_time, 0); +} - if (slot >= 0) { - /* - * Timer in wheel or in circular - * list of timers currently beeing - * triggered (referred by sentinel). - */ - ERTS_TW_ASSERT(slot < ERTS_TIW_SIZE); +/* get the time (in units of TIW_ITIME) to the next timeout, + or -1 if there are no timeouts */ - if (p->next == p) { - ERTS_TW_ASSERT(tiw->w[slot] == p); - tiw->w[slot] = NULL; - } - else { - if (tiw->w[slot] == p) - tiw->w[slot] = p->next; - p->prev->next = p->next; - p->next->prev = p->prev; - } +static erts_short_time_t next_time_internal(void) /* PRE: tiw_lock taken by caller */ +{ + int i, tm, nto; + Uint32 min; + ErlTimer* p; + erts_short_time_t dt; + + if (tiw_nto == 0) + return -1; /* no timeouts in wheel */ + + if (tiw_min_ptr) { + min = tiw_min; + dt = do_time_read(); + return ((min >= dt) ? (min - dt) : 0); } - else { - /* Timer in "at once" queue... */ - ERTS_TW_ASSERT(slot == ERTS_TWHEEL_SLOT_AT_ONCE); - if (p->prev) - p->prev->next = p->next; - else { - ERTS_TW_ASSERT(tiw->at_once.head == p); - tiw->at_once.head = p->next; - } - if (p->next) - p->next->prev = p->prev; - else { - ERTS_TW_ASSERT(tiw->at_once.tail == p); - tiw->at_once.tail = p->prev; + + /* start going through wheel to find next timeout */ + tm = nto = 0; + min = (Uint32) -1; /* max Uint32 */ + i = tiw_pos; + do { + p = tiw[i]; + while (p != NULL) { + nto++; + if (p->count == 0) { + /* found next timeout */ + dt = do_time_read(); + /* p->count is zero */ + tiw_min_ptr = p; + tiw_min = tm; + return ((tm >= dt) ? (tm - dt) : 0); + } else { + /* keep shortest time in 'min' */ + if (tm + p->count*TIW_SIZE < min) { + min = tm + p->count*TIW_SIZE; + tiw_min_ptr = p; + tiw_min = min; + } + } + p = p->next; } - ERTS_TW_ASSERT(tiw->at_once.nto > 0); - tiw->at_once.nto--; + /* when we have found all timeouts the shortest time will be in min */ + if (nto == tiw_nto) break; + tm++; + i = (i + 1) % TIW_SIZE; + } while (i != tiw_pos); + dt = do_time_read(); + if (min <= (Uint32) dt) + return 0; + if ((min - (Uint32) dt) > (Uint32) ERTS_SHORT_TIME_T_MAX) + return ERTS_SHORT_TIME_T_MAX; + return (erts_short_time_t) (min - (Uint32) dt); +} + +static void remove_timer(ErlTimer *p) { + /* first */ + if (!p->prev) { + tiw[p->slot] = p->next; + if(p->next) + p->next->prev = NULL; + } else { + p->prev->next = p->next; } - p->slot = ERTS_TWHEEL_SLOT_INACTIVE; - - tiw->nto--; -} + /* last */ + if (!p->next) { + if (p->prev) + p->prev->next = NULL; + } else { + p->next->prev = p->prev; + } -ErtsMonotonicTime -erts_check_next_timeout_time(ErtsSchedulerData *esdp) -{ - ErtsTimerWheel *tiw = esdp->timer_wheel; - if (tiw->true_next_timeout_time) - return tiw->next_timeout_time; - return find_next_timeout(esdp, tiw, 1, 0, 0); + p->next = NULL; + p->prev = NULL; + /* Make sure cancel callback isn't called */ + p->active = 0; + tiw_nto--; } -#ifndef ERTS_TW_DEBUG -#define ERTS_DBG_CHK_SAFE_TO_SKIP_TO(TIW, TO) ((void) 0) -#else -#define ERTS_DBG_CHK_SAFE_TO_SKIP_TO(TIW, TO) debug_check_safe_to_skip_to((TIW), (TO)) -static void -debug_check_safe_to_skip_to(ErtsTimerWheel *tiw, ErtsMonotonicTime skip_to_pos) +/* Private export to erl_time_sup.c */ +erts_short_time_t erts_next_time(void) { - int slots, ix; - ErtsTWheelTimer *tmr; - ErtsMonotonicTime tmp; - - ix = (int) (tiw->pos & (ERTS_TIW_SIZE-1)); - tmp = skip_to_pos - tiw->pos; - ERTS_TW_ASSERT(tmp >= 0); - if (tmp < (ErtsMonotonicTime) ERTS_TIW_SIZE) - slots = (int) tmp; - else - slots = ERTS_TIW_SIZE; - - while (slots > 0) { - tmr = tiw->w[ix]; - if (tmr) { - ErtsTWheelTimer *end = tmr; - do { - ERTS_TW_ASSERT(tmr->timeout_pos > skip_to_pos); - tmr = tmr->next; - } while (tmr != end); - } - ix++; - if (ix == ERTS_TIW_SIZE) - ix = 0; - slots--; - } -} -#endif + erts_short_time_t ret; -static ERTS_INLINE void -timeout_timer(ErtsTWheelTimer *p) -{ - ErlTimeoutProc timeout; - void *arg; - p->slot = ERTS_TWHEEL_SLOT_INACTIVE; - timeout = p->u.func.timeout; - arg = p->u.func.arg; - (*timeout)(arg); - ASSERT_NO_LOCKED_LOCKS; + erts_smp_mtx_lock(&tiw_lock); + (void)do_time_update(); + ret = next_time_internal(); + erts_smp_mtx_unlock(&tiw_lock); + return ret; } -void -erts_bump_timers(ErtsTimerWheel *tiw, ErtsMonotonicTime curr_time) +static ERTS_INLINE void bump_timer_internal(erts_short_time_t dt) /* PRE: tiw_lock is write-locked */ { - int tiw_pos_ix, slots, yielded_slot_restarted, yield_count; - ErtsMonotonicTime bump_to, tmp_slots, old_pos; + Uint keep_pos; + Uint count; + ErlTimer *p, **prev, *timeout_head, **timeout_tail; + Uint dtime = (Uint) dt; - yield_count = ERTS_TWHEEL_BUMP_YIELD_LIMIT; - - /* - * In order to be fair we always continue with work - * where we left off when restarting after a yield. - */ - - if (tiw->yield_slot >= 0) { - yielded_slot_restarted = 1; - tiw_pos_ix = tiw->yield_slot; - slots = tiw->yield_slots_left; - bump_to = tiw->pos; - old_pos = tiw->yield_start_pos; - goto restart_yielded_slot; + /* no need to bump the position if there aren't any timeouts */ + if (tiw_nto == 0) { + erts_smp_mtx_unlock(&tiw_lock); + return; } - do { - - yielded_slot_restarted = 0; - - bump_to = ERTS_MONOTONIC_TO_CLKTCKS(curr_time); - - while (1) { - ErtsTWheelTimer *p; - - old_pos = tiw->pos; - - if (tiw->nto == 0) { - empty_wheel: - ERTS_DBG_CHK_SAFE_TO_SKIP_TO(tiw, bump_to); - tiw->true_next_timeout_time = 0; - tiw->next_timeout_time = curr_time + ERTS_MONOTONIC_DAY; - tiw->pos = bump_to; - tiw->yield_slot = ERTS_TWHEEL_SLOT_INACTIVE; - return; - } - - p = tiw->at_once.head; - while (p) { - if (--yield_count <= 0) { - ERTS_TW_ASSERT(tiw->nto > 0); - ERTS_TW_ASSERT(tiw->at_once.nto > 0); - tiw->yield_slot = ERTS_TWHEEL_SLOT_AT_ONCE; - tiw->true_next_timeout_time = 1; - tiw->next_timeout_time = ERTS_CLKTCKS_TO_MONOTONIC(old_pos); - return; + /* if do_time > TIW_SIZE we want to go around just once */ + count = (Uint)(dtime / TIW_SIZE) + 1; + keep_pos = (tiw_pos + dtime) % TIW_SIZE; + if (dtime > TIW_SIZE) dtime = TIW_SIZE; + + timeout_head = NULL; + timeout_tail = &timeout_head; + while (dtime > 0) { + /* this is to decrease the counters with the right amount */ + /* when dtime >= TIW_SIZE */ + if (tiw_pos == keep_pos) count--; + prev = &tiw[tiw_pos]; + while ((p = *prev) != NULL) { + ASSERT( p != p->next); + if (p->count < count) { /* we have a timeout */ + /* remove min time */ + if (tiw_min_ptr == p) { + tiw_min_ptr = NULL; + tiw_min = 0; } - ERTS_TW_ASSERT(tiw->nto > 0); - ERTS_TW_ASSERT(tiw->at_once.nto > 0); - tiw->nto--; - tiw->at_once.nto--; - tiw->at_once.head = p->next; - if (p->next) - p->next->prev = NULL; - else - tiw->at_once.tail = NULL; - - timeout_timer(p); - - p = tiw->at_once.head; + /* Remove from list */ + remove_timer(p); + *timeout_tail = p; /* Insert in timeout queue */ + timeout_tail = &p->next; } - - if (tiw->pos >= bump_to) - break; - - if (tiw->nto == 0) - goto empty_wheel; - - if (tiw->true_next_timeout_time) { - ErtsMonotonicTime skip_until_pos; - /* - * No need inspecting slots where we know no timeouts - * to trigger should reside. - */ - - skip_until_pos = ERTS_MONOTONIC_TO_CLKTCKS(tiw->next_timeout_time); - if (skip_until_pos > bump_to) - skip_until_pos = bump_to; - - skip_until_pos--; - - if (skip_until_pos > tiw->pos) { - ERTS_DBG_CHK_SAFE_TO_SKIP_TO(tiw, skip_until_pos); - - tiw->pos = skip_until_pos; - } - } - - tiw_pos_ix = (int) ((tiw->pos+1) & (ERTS_TIW_SIZE-1)); - tmp_slots = (bump_to - tiw->pos); - if (tmp_slots < (ErtsMonotonicTime) ERTS_TIW_SIZE) - slots = (int) tmp_slots; - else - slots = ERTS_TIW_SIZE; - - tiw->pos = bump_to; - - while (slots > 0) { - - p = tiw->w[tiw_pos_ix]; - if (p) { - if (p->next == p) { - ERTS_TW_ASSERT(tiw->sentinel.next == &tiw->sentinel); - ERTS_TW_ASSERT(tiw->sentinel.prev == &tiw->sentinel); - } - else { - tiw->sentinel.next = p->next; - tiw->sentinel.prev = p->prev; - tiw->sentinel.next->prev = &tiw->sentinel; - tiw->sentinel.prev->next = &tiw->sentinel; - } - tiw->w[tiw_pos_ix] = NULL; - - while (1) { - - if (p->timeout_pos > bump_to) { - /* Very unusual case... */ - ++yield_count; - insert_timer_into_slot(tiw, tiw_pos_ix, p); - } - else { - /* Normal case... */ - timeout_timer(p); - tiw->nto--; - } - - restart_yielded_slot: - - p = tiw->sentinel.next; - if (p == &tiw->sentinel) { - ERTS_TW_ASSERT(tiw->sentinel.prev == &tiw->sentinel); - break; - } - - if (--yield_count <= 0) { - tiw->true_next_timeout_time = 1; - tiw->next_timeout_time = ERTS_CLKTCKS_TO_MONOTONIC(old_pos); - tiw->yield_slot = tiw_pos_ix; - tiw->yield_slots_left = slots; - tiw->yield_start_pos = old_pos; - return; /* Yield! */ - } - - tiw->sentinel.next = p->next; - p->next->prev = &tiw->sentinel; - } - } - tiw_pos_ix++; - if (tiw_pos_ix == ERTS_TIW_SIZE) - tiw_pos_ix = 0; - slots--; + else { + /* no timeout, just decrease counter */ + p->count -= count; + prev = &p->next; } } - - } while (yielded_slot_restarted); - - tiw->yield_slot = ERTS_TWHEEL_SLOT_INACTIVE; - tiw->true_next_timeout_time = 0; - tiw->next_timeout_time = curr_time + ERTS_MONOTONIC_DAY; - - /* Search at most two seconds ahead... */ - (void) find_next_timeout(NULL, tiw, 0, curr_time, ERTS_SEC_TO_MONOTONIC(2)); -} - -Uint -erts_timer_wheel_memory_size(void) -{ - return sizeof(ErtsTimerWheel)*erts_no_schedulers; + tiw_pos = (tiw_pos + 1) % TIW_SIZE; + dtime--; + } + tiw_pos = keep_pos; + if (tiw_min_ptr) + tiw_min -= dt; + + erts_smp_mtx_unlock(&tiw_lock); + + /* Call timedout timers callbacks */ + while (timeout_head) { + p = timeout_head; + timeout_head = p->next; + /* Here comes hairy use of the timer fields! + * They are reset without having the lock. + * It is assumed that no code but this will + * accesses any field until the ->timeout + * callback is called. + */ + p->next = NULL; + p->prev = NULL; + p->slot = 0; + (*p->timeout)(p->arg); + } } -ErtsTimerWheel * -erts_create_timer_wheel(ErtsSchedulerData *esdp) +void erts_bump_timer(erts_short_time_t dt) /* dt is value from do_time */ { - ErtsMonotonicTime mtime; - int i; - ErtsTimerWheel *tiw; - tiw = erts_alloc_permanent_cache_aligned(ERTS_ALC_T_TIMER_WHEEL, - sizeof(ErtsTimerWheel)); - for(i = 0; i < ERTS_TIW_SIZE; i++) - tiw->w[i] = NULL; - - mtime = erts_get_monotonic_time(esdp); - tiw->pos = ERTS_MONOTONIC_TO_CLKTCKS(mtime); - tiw->nto = 0; - tiw->at_once.head = NULL; - tiw->at_once.tail = NULL; - tiw->at_once.nto = 0; - tiw->yield_slot = ERTS_TWHEEL_SLOT_INACTIVE; - tiw->true_next_timeout_time = 0; - tiw->next_timeout_time = mtime + ERTS_MONOTONIC_DAY; - tiw->sentinel.next = &tiw->sentinel; - tiw->sentinel.prev = &tiw->sentinel; - tiw->sentinel.u.func.timeout = NULL; - tiw->sentinel.u.func.cancel = NULL; - tiw->sentinel.u.func.arg = NULL; - return tiw; + erts_smp_mtx_lock(&tiw_lock); + bump_timer_internal(dt); } -ErtsNextTimeoutRef -erts_get_next_timeout_reference(ErtsTimerWheel *tiw) +Uint +erts_timer_wheel_memory_size(void) { - return (ErtsNextTimeoutRef) &tiw->next_timeout_time; + return (Uint) TIW_SIZE * sizeof(ErlTimer*); } - /* this routine links the time cells into a free list at the start and sets the time queue as empty */ void -erts_init_time(int time_correction, ErtsTimeWarpMode time_warp_mode) +erts_init_time(void) { - int itime; + int i, itime; /* system dependent init; must be done before do_time_init() if timer thread is enabled */ - itime = erts_init_time_sup(time_correction, time_warp_mode); + itime = erts_init_time_sup(); #ifdef TIW_ITIME_IS_CONSTANT if (itime != TIW_ITIME) { erl_exit(ERTS_ABORT_EXIT, "timer resolution mismatch %d != %d", itime, TIW_ITIME); @@ -560,139 +324,182 @@ #else tiw_itime = itime; #endif + + erts_smp_mtx_init(&tiw_lock, "timer_wheel"); + + tiw = (ErlTimer**) erts_alloc(ERTS_ALC_T_TIMER_WHEEL, + TIW_SIZE * sizeof(ErlTimer*)); + for(i = 0; i < TIW_SIZE; i++) + tiw[i] = NULL; + do_time_init(); + tiw_pos = tiw_nto = 0; + tiw_min_ptr = NULL; + tiw_min = 0; } -void -erts_twheel_set_timer(ErtsTimerWheel *tiw, - ErtsTWheelTimer *p, ErlTimeoutProc timeout, - ErlCancelProc cancel, void *arg, - ErtsMonotonicTime timeout_pos) -{ - ErtsMonotonicTime timeout_time; - - p->u.func.timeout = timeout; - p->u.func.cancel = cancel; - p->u.func.arg = arg; - - ERTS_TW_ASSERT(p->slot == ERTS_TWHEEL_SLOT_INACTIVE); - - if (timeout_pos <= tiw->pos) { - tiw->nto++; - tiw->at_once.nto++; - p->next = NULL; - p->prev = tiw->at_once.tail; - if (tiw->at_once.tail) { - ERTS_TW_ASSERT(tiw->at_once.head); - tiw->at_once.tail->next = p; - } - else { - ERTS_TW_ASSERT(!tiw->at_once.head); - tiw->at_once.head = p; - } - tiw->at_once.tail = p; - p->timeout_pos = tiw->pos; - p->slot = ERTS_TWHEEL_SLOT_AT_ONCE; - timeout_time = ERTS_CLKTCKS_TO_MONOTONIC(tiw->pos); - } - else { - int slot; - /* calculate slot */ - slot = (int) (timeout_pos & (ERTS_TIW_SIZE-1)); - insert_timer_into_slot(tiw, slot, p); - tiw->nto++; +/* +** Insert a process into the time queue, with a timeout 't' +*/ +static void +insert_timer(ErlTimer* p, Uint t) +{ + Uint tm; + Uint64 ticks; - timeout_time = ERTS_CLKTCKS_TO_MONOTONIC(timeout_pos); - p->timeout_pos = timeout_pos; - } + /* The current slot (tiw_pos) in timing wheel is the next slot to be + * be processed. Hence no extra time tick is needed. + * + * (x + y - 1)/y is precisely the "number of bins" formula. + */ + ticks = (t + (TIW_ITIME - 1)) / TIW_ITIME; - if (timeout_time < tiw->next_timeout_time) { - tiw->true_next_timeout_time = 1; - tiw->next_timeout_time = timeout_time; + /* + * Ticks must be a Uint64, or the addition may overflow here, + * resulting in an incorrect value for p->count below. + */ + ticks += do_time_update(); /* Add backlog of unprocessed time */ + + /* calculate slot */ + tm = (ticks + tiw_pos) % TIW_SIZE; + p->slot = (Uint) tm; + p->count = (Uint) (ticks / TIW_SIZE); + + /* insert at head of list at slot */ + p->next = tiw[tm]; + p->prev = NULL; + if (p->next != NULL) + p->next->prev = p; + tiw[tm] = p; + + + /* insert min time */ + if ((tiw_nto == 0) || ((tiw_min_ptr != NULL) && (ticks < tiw_min))) { + tiw_min = ticks; + tiw_min_ptr = p; + } + if ((tiw_min_ptr == p) && (ticks > tiw_min)) { + /* some other timer might be 'min' now */ + tiw_min = 0; + tiw_min_ptr = NULL; } + + tiw_nto++; } void -erts_twheel_cancel_timer(ErtsTimerWheel *tiw, ErtsTWheelTimer *p) +erts_set_timer(ErlTimer* p, ErlTimeoutProc timeout, ErlCancelProc cancel, + void* arg, Uint t) { - if (p->slot != ERTS_TWHEEL_SLOT_INACTIVE) { - ErlCancelProc cancel; - void *arg; - remove_timer(tiw, p); - cancel = p->u.func.cancel; - arg = p->u.func.arg; - if (cancel) - (*cancel)(arg); - } + + erts_deliver_time(); + erts_smp_mtx_lock(&tiw_lock); + if (p->active) { /* XXX assert ? */ + erts_smp_mtx_unlock(&tiw_lock); + return; + } + p->timeout = timeout; + p->cancel = cancel; + p->arg = arg; + p->active = 1; + insert_timer(p, t); + erts_smp_mtx_unlock(&tiw_lock); +#if defined(ERTS_SMP) + if (t <= (Uint) ERTS_SHORT_TIME_T_MAX) + erts_sys_schedule_interrupt_timed(1, (erts_short_time_t) t); +#endif } void -erts_twheel_debug_foreach(ErtsTimerWheel *tiw, - void (*tclbk)(void *), - void (*func)(void *, - ErtsMonotonicTime, - void *), - void *arg) -{ - ErtsTWheelTimer *tmr; - int ix; - - tmr = tiw->sentinel.next; - while (tmr != &tiw->sentinel) { - if (tmr->u.func.timeout == tclbk) - (*func)(arg, tmr->timeout_pos, tmr->u.func.arg); - tmr = tmr->next; - } - - for (tmr = tiw->at_once.head; tmr; tmr = tmr->next) { - if (tmr->u.func.timeout == tclbk) - (*func)(arg, tmr->timeout_pos, tmr->u.func.arg); - } - - for (ix = 0; ix < ERTS_TIW_SIZE; ix++) { - tmr = tiw->w[ix]; - if (tmr) { - do { - if (tmr->u.func.timeout == tclbk) - (*func)(arg, tmr->timeout_pos, tmr->u.func.arg); - tmr = tmr->next; - } while (tmr != tiw->w[ix]); - } +erts_cancel_timer(ErlTimer* p) +{ + erts_smp_mtx_lock(&tiw_lock); + if (!p->active) { /* allow repeated cancel (drivers) */ + erts_smp_mtx_unlock(&tiw_lock); + return; + } + + /* is it the 'min' timer, remove min */ + if (p == tiw_min_ptr) { + tiw_min_ptr = NULL; + tiw_min = 0; + } + + remove_timer(p); + p->slot = p->count = 0; + + if (p->cancel != NULL) { + erts_smp_mtx_unlock(&tiw_lock); + (*p->cancel)(p->arg); + return; } + erts_smp_mtx_unlock(&tiw_lock); } -#ifdef ERTS_TW_DEBUG +/* + Returns the amount of time left in ms until the timer 'p' is triggered. + 0 is returned if 'p' isn't active. + 0 is returned also if the timer is overdue (i.e., would have triggered + immediately if it hadn't been cancelled). +*/ +Uint +erts_time_left(ErlTimer *p) +{ + Uint left; + erts_short_time_t dt; + + erts_smp_mtx_lock(&tiw_lock); + + if (!p->active) { + erts_smp_mtx_unlock(&tiw_lock); + return 0; + } + + if (p->slot < tiw_pos) + left = (p->count + 1) * TIW_SIZE + p->slot - tiw_pos; + else + left = p->count * TIW_SIZE + p->slot - tiw_pos; + dt = do_time_read(); + if (left < dt) + left = 0; + else + left -= dt; + + erts_smp_mtx_unlock(&tiw_lock); + + return (Uint) left * TIW_ITIME; +} + +#ifdef DEBUG void erts_p_slpq(void) { - erts_printf("Not yet implemented...\n"); -#if 0 - ErtsMonotonicTime current_time = erts_get_monotonic_time(NULL); int i; - ErtsTWheelTimer* p; + ErlTimer* p; + erts_smp_mtx_lock(&tiw_lock); + /* print the whole wheel, starting at the current position */ - erts_printf("\ncurrent time = %bps tiw_pos = %d tiw_nto %d\n", - current_time, tiw->pos, tiw->nto); - i = tiw->pos; - if (tiw->w[i] != NULL) { + erts_printf("\ntiw_pos = %d tiw_nto %d\n", tiw_pos, tiw_nto); + i = tiw_pos; + if (tiw[i] != NULL) { erts_printf("%d:\n", i); - for(p = tiw->w[i]; p != NULL; p = p->next) { - erts_printf(" (timeout time %bps, slot %d)\n", - ERTS_CLKTCKS_TO_MONOTONIC(p->timeout_pos), - p->slot); + for(p = tiw[i]; p != NULL; p = p->next) { + erts_printf(" (count %d, slot %d)\n", + p->count, p->slot); } } - for(i = ((i+1) & (ERTS_TIW_SIZE-1)); i != (tiw->pos & (ERTS_TIW_SIZE-1)); i = ((i+1) & (ERTS_TIW_SIZE-1))) { - if (tiw->w[i] != NULL) { + for(i = (i+1)%TIW_SIZE; i != tiw_pos; i = (i+1)%TIW_SIZE) { + if (tiw[i] != NULL) { erts_printf("%d:\n", i); - for(p = tiw->w[i]; p != NULL; p = p->next) { - erts_printf(" (timeout time %bps, slot %d)\n", - ERTS_CLKTCKS_TO_MONOTONIC(p->timeout_pos), p->slot); + for(p = tiw[i]; p != NULL; p = p->next) { + erts_printf(" (count %d, slot %d)\n", + p->count, p->slot); } } } -#endif + + erts_smp_mtx_unlock(&tiw_lock); } -#endif /* ERTS_TW_DEBUG */ +#endif /* DEBUG */ diff -Nru erlang-18.2-dfsg/erts/emulator/beam/utils.c erlang-17.3-dfsg/erts/emulator/beam/utils.c --- erlang-18.2-dfsg/erts/emulator/beam/utils.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/utils.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -49,13 +48,6 @@ #include "erl_sched_spec_pre_alloc.h" #include "beam_bp.h" #include "erl_ptab.h" -#include "erl_check_io.h" -#include "erl_bif_unique.h" -#define ERTS_WANT_TIMER_WHEEL_API -#include "erl_time.h" -#ifdef HIPE -# include "hipe_mode_switch.h" -#endif #undef M_TRIM_THRESHOLD #undef M_TOP_PAD @@ -194,18 +186,12 @@ * Helper function for the ESTACK macros defined in global.h. */ void -erl_grow_estack(ErtsEStack* s, Uint need) +erl_grow_estack(ErtsEStack* s, Eterm* default_estack) { Uint old_size = (s->end - s->start); - Uint new_size; + Uint new_size = old_size * 2; Uint sp_offs = s->sp - s->start; - - if (need < old_size) - new_size = 2*old_size; - else - new_size = ((need / old_size) + 2) * old_size; - - if (s->start != s->edefault) { + if (s->start != default_estack) { s->start = erts_realloc(s->alloc_type, s->start, new_size*sizeof(Eterm)); } else { @@ -220,18 +206,12 @@ * Helper function for the WSTACK macros defined in global.h. */ void -erl_grow_wstack(ErtsWStack* s, Uint need) +erl_grow_wstack(ErtsWStack* s, UWord* default_wstack) { Uint old_size = (s->wend - s->wstart); - Uint new_size; + Uint new_size = old_size * 2; Uint sp_offs = s->wsp - s->wstart; - - if (need < old_size) - new_size = 2 * old_size; - else - new_size = ((need / old_size) + 2) * old_size; - - if (s->wstart != s->wdefault) { + if (s->wstart != default_wstack) { s->wstart = erts_realloc(s->alloc_type, s->wstart, new_size*sizeof(UWord)); } else { @@ -243,32 +223,6 @@ s->wsp = s->wstart + sp_offs; } -/* - * Helper function for the PSTACK macros defined in global.h. - */ -void -erl_grow_pstack(ErtsPStack* s, void* default_pstack, unsigned need_bytes) -{ - Uint old_size = s->pend - s->pstart; - Uint new_size; - Uint sp_offs = s->psp - s->pstart; - - if (need_bytes < old_size) - new_size = 2 * old_size; - else - new_size = ((need_bytes / old_size) + 2) * old_size; - - if (s->pstart != default_pstack) { - s->pstart = erts_realloc(s->alloc_type, s->pstart, new_size); - } else { - byte* new_ptr = erts_alloc(s->alloc_type, new_size); - sys_memcpy(new_ptr, s->pstart, old_size); - s->pstart = new_ptr; - } - s->pend = s->pstart + new_size; - s->psp = s->pstart + sp_offs; -} - /* CTYPE macros */ #define LATIN1 @@ -356,17 +310,6 @@ return fit_in_bits((Sint64) (Uint32) value, 4); } -int erts_fit_in_bits_uint(Uint value) -{ -#if ERTS_SIZEOF_ETERM == 4 - return fit_in_bits((Sint64) (Uint32) value, 4); -#elif ERTS_SIZEOF_ETERM == 8 - return fit_in_bits(value, 5); -#else -# error "No way, Jose" -#endif -} - int erts_print(int to, void *arg, char *format, ...) { @@ -399,6 +342,9 @@ case ERTS_PRINT_DSBUF: res = erts_vdsprintf((erts_dsprintf_buf_t *) arg, format, arg_list); break; + case ERTS_PRINT_INVALID: + res = -EINVAL; + break; default: res = erts_vfdprintf((int) to, format, arg_list); break; @@ -760,7 +706,7 @@ ** If N < 0, Y = FUNNY_NUMBER4 else Y = FUNNY_NUMBER3. ** The hash value is Y*h(J) mod 2^32 where h(J) is calculated like ** h(0) = -** h(i) = h(i-1)*X + B(i-1) +** h(i) = h(i-i)*X + B(i-1) ** The above should hold regardless of internal representation. ** Pids are hashed like small numbers but with differrent constants, as are ** ports. @@ -841,10 +787,11 @@ Eterm hash = 0; unsigned op; -#define MAKE_HASH_TUPLE_OP (FIRST_VACANT_TAG_DEF) -#define MAKE_HASH_TERM_ARRAY_OP (FIRST_VACANT_TAG_DEF+1) -#define MAKE_HASH_CDR_PRE_OP (FIRST_VACANT_TAG_DEF+2) -#define MAKE_HASH_CDR_POST_OP (FIRST_VACANT_TAG_DEF+3) + /* Must not collide with the real tag_val_def's: */ +#define MAKE_HASH_TUPLE_OP 0x11 +#define MAKE_HASH_TERM_ARRAY_OP 0x12 +#define MAKE_HASH_CDR_PRE_OP 0x13 +#define MAKE_HASH_CDR_POST_OP 0x14 /* ** Convenience macro for calculating a bytewise hash on an unsigned 32 bit @@ -954,15 +901,12 @@ UINT32_HASH_RET(external_ref_numbers(term)[0],FUNNY_NUMBER9,FUNNY_NUMBER10); case FLOAT_DEF: { - FloatDef ff; - GET_DOUBLE(term, ff); - if (ff.fd == 0.0f) { - /* ensure positive 0.0 */ - ff.fd = erts_get_positive_zero_float(); - } - hash = hash*FUNNY_NUMBER6 + (ff.fw[0] ^ ff.fw[1]); - break; + FloatDef ff; + GET_DOUBLE(term, ff); + hash = hash*FUNNY_NUMBER6 + (ff.fw[0] ^ ff.fw[1]); + break; } + case MAKE_HASH_CDR_PRE_OP: term = (Eterm) WSTACK_POP(stack); if (is_not_list(term)) { @@ -1027,8 +971,23 @@ break; } case MAP_DEF: - hash = hash*FUNNY_NUMBER13 + FUNNY_NUMBER14 + make_hash2(term); - break; + { + map_t *mp = (map_t *)map_val(term); + int size = map_get_size(mp); + Eterm *ks = map_get_keys(mp); + Eterm *vs = map_get_values(mp); + + /* Use a prime with size to remedy some of + * the {} and <<>> hash problems */ + hash = hash*FUNNY_NUMBER13 + FUNNY_NUMBER14 + size; + if (size == 0) + break; + + /* push values first */ + WSTACK_PUSH3(stack, (UWord)vs, (UWord) size, MAKE_HASH_TERM_ARRAY_OP); + WSTACK_PUSH3(stack, (UWord)ks, (UWord) size, MAKE_HASH_TERM_ARRAY_OP); + break; + } case TUPLE_DEF: { Eterm* ptr = tuple_val(term); @@ -1132,12 +1091,11 @@ make_hash2(Eterm term) { Uint32 hash; - Uint32 hash_xor_pairs; + Uint32 hash_xor_keys = 0; + Uint32 hash_xor_values = 0; DeclareTmpHeapNoproc(tmp_big,2); - ERTS_UNDEF(hash_xor_pairs, 0); - -/* (HCONST * {2, ..., 22}) mod 2^32 */ +/* (HCONST * {2, ..., 16}) mod 2^32 */ #define HCONST_2 0x3c6ef372UL #define HCONST_3 0xdaa66d2bUL #define HCONST_4 0x78dde6e4UL @@ -1153,16 +1111,10 @@ #define HCONST_14 0xa708a81eUL #define HCONST_15 0x454021d7UL #define HCONST_16 0xe3779b90UL -#define HCONST_17 0x81af1549UL -#define HCONST_18 0x1fe68f02UL -#define HCONST_19 0xbe1e08bbUL -#define HCONST_20 0x5c558274UL -#define HCONST_21 0xfa8cfc2dUL -#define HCONST_22 0x98c475e6UL #define HASH_MAP_TAIL (_make_header(1,_TAG_HEADER_REF)) -#define HASH_MAP_PAIR (_make_header(2,_TAG_HEADER_REF)) -#define HASH_CDR (_make_header(3,_TAG_HEADER_REF)) +#define HASH_MAP_KEY (_make_header(2,_TAG_HEADER_REF)) +#define HASH_MAP_VAL (_make_header(3,_TAG_HEADER_REF)) #define UINT32_HASH_2(Expr1, Expr2, AConst) \ do { \ @@ -1185,13 +1137,6 @@ } while(0) #define IS_SSMALL28(x) (((Uint) (((x) >> (28-1)) + 1)) < 2) - -#ifdef ARCH_64 -# define POINTER_HASH(Ptr, AConst) UINT32_HASH_2((Uint32)(UWord)(Ptr), (((UWord)(Ptr)) >> 32), AConst) -#else -# define POINTER_HASH(Ptr, AConst) UINT32_HASH(Ptr, AConst) -#endif - /* Optimization. Simple cases before declaration of estack. */ if (primary_tag(term) == TAG_PRIMARY_IMMED1) { switch (term & _TAG_IMMED1_MASK) { @@ -1246,9 +1191,9 @@ if (c > 0) UINT32_HASH(sh, HCONST_4); if (is_list(term)) { - tmp = CDR(ptr); - ESTACK_PUSH(s, tmp); - term = CAR(ptr); + term = *ptr; + tmp = *++ptr; + ESTACK_PUSH(s, tmp); } } break; @@ -1265,90 +1210,51 @@ UINT32_HASH(arity, HCONST_9); if (arity == 0) /* Empty tuple */ goto hash2_common; - for (i = arity; ; i--) { - term = elem[i]; - if (i == 1) - break; - ESTACK_PUSH(s, term); + for (i = arity; i >= 1; i--) { + tmp = elem[i]; + ESTACK_PUSH(s, tmp); } + goto hash2_common; + } + break; + case MAP_SUBTAG: + { + map_t *mp = (map_t *)map_val(term); + int i; + int size = map_get_size(mp); + Eterm *ks = map_get_keys(mp); + Eterm *vs = map_get_values(mp); + UINT32_HASH(size, HCONST_16); + if (size == 0) { + goto hash2_common; + } + ESTACK_PUSH(s, hash_xor_values); + ESTACK_PUSH(s, hash_xor_keys); + ESTACK_PUSH(s, hash); + ESTACK_PUSH(s, HASH_MAP_TAIL); + hash = 0; + hash_xor_keys = 0; + hash_xor_values = 0; + for (i = size - 1; i >= 0; i--) { + tmp = vs[i]; + ESTACK_PUSH(s, HASH_MAP_VAL); + ESTACK_PUSH(s, tmp); + } + /* We do not want to expose the tuple representation. + * Do not push the keys as a tuple. + */ + for (i = size - 1; i >= 0; i--) { + tmp = ks[i]; + ESTACK_PUSH(s, HASH_MAP_KEY); + ESTACK_PUSH(s, tmp); + } + goto hash2_common; } break; - case MAP_SUBTAG: - { - Eterm* ptr = boxed_val(term) + 1; - Uint size; - int i; - switch (hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_FLATMAP: - { - flatmap_t *mp = (flatmap_t *)flatmap_val(term); - Eterm *ks = flatmap_get_keys(mp); - Eterm *vs = flatmap_get_values(mp); - size = flatmap_get_size(mp); - UINT32_HASH(size, HCONST_16); - if (size == 0) - goto hash2_common; - - /* We want a portable hash function that is *independent* of - * the order in which keys and values are encountered. - * We therefore calculate context independent hashes for all . - * key-value pairs and then xor them together. - */ - ESTACK_PUSH(s, hash_xor_pairs); - ESTACK_PUSH(s, hash); - ESTACK_PUSH(s, HASH_MAP_TAIL); - hash = 0; - hash_xor_pairs = 0; - for (i = size - 1; i >= 0; i--) { - ESTACK_PUSH(s, HASH_MAP_PAIR); - ESTACK_PUSH(s, vs[i]); - ESTACK_PUSH(s, ks[i]); - } - goto hash2_common; - } - - case HAMT_SUBTAG_HEAD_ARRAY: - case HAMT_SUBTAG_HEAD_BITMAP: - size = *ptr++; - UINT32_HASH(size, HCONST_16); - if (size == 0) - goto hash2_common; - ESTACK_PUSH(s, hash_xor_pairs); - ESTACK_PUSH(s, hash); - ESTACK_PUSH(s, HASH_MAP_TAIL); - hash = 0; - hash_xor_pairs = 0; - } - switch (hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - i = 16; - break; - case HAMT_SUBTAG_HEAD_BITMAP: - case HAMT_SUBTAG_NODE_BITMAP: - i = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - break; - default: - erl_exit(1, "bad header"); - } - while (i) { - if (is_list(*ptr)) { - Eterm* cons = list_val(*ptr); - ESTACK_PUSH(s, HASH_MAP_PAIR); - ESTACK_PUSH(s, CDR(cons)); - ESTACK_PUSH(s, CAR(cons)); - } - else { - ASSERT(is_boxed(*ptr)); - ESTACK_PUSH(s, *ptr); - } - i--; ptr++; - } - goto hash2_common; - } - break; case EXPORT_SUBTAG: { Export* ep = *((Export **) (export_val(term) + 1)); + UINT32_HASH_2 (ep->code[2], atom_tab(atom_val(ep->code[0]))->slot.bucket.hvalue, @@ -1363,6 +1269,7 @@ { ErlFunThing* funp = (ErlFunThing *) fun_val(term); Uint num_free = funp->num_free; + UINT32_HASH_2 (num_free, atom_tab(atom_val(funp->fe->module))->slot.bucket.hvalue, @@ -1443,8 +1350,7 @@ do { Uint t; Uint32 x, y; - ASSERT(i < n); - t = BIG_DIGIT(ptr, i++); + t = i < n ? BIG_DIGIT(ptr, i++) : 0; x = t & 0xffffffff; y = t >> 32; UINT32_HASH_2(x, y, con); @@ -1477,10 +1383,6 @@ { FloatDef ff; GET_DOUBLE(term, ff); - if (ff.fd == 0.0f) { - /* ensure positive 0.0 */ - ff.fd = erts_get_positive_zero_float(); - } #if defined(WORDS_BIGENDIAN) || defined(DOUBLE_MIDDLE_ENDIAN) UINT32_HASH_2(ff.fw[0], ff.fw[1], HCONST_12); #else @@ -1556,397 +1458,20 @@ switch (term) { case HASH_MAP_TAIL: { hash = (Uint32) ESTACK_POP(s); - UINT32_HASH(hash_xor_pairs, HCONST_19); - hash_xor_pairs = (Uint32) ESTACK_POP(s); + UINT32_HASH(hash_xor_keys, HCONST_16); + UINT32_HASH(hash_xor_values, HCONST_16); + hash_xor_keys = (Uint32) ESTACK_POP(s); + hash_xor_values = (Uint32) ESTACK_POP(s); goto hash2_common; } - case HASH_MAP_PAIR: - hash_xor_pairs ^= hash; + case HASH_MAP_KEY: + hash_xor_keys ^= hash; hash = 0; goto hash2_common; - default: - break; - } - } - } - } -} - -/* Term hash function for internal use. - * - * Limitation #1: Is not "portable" in any way between different VM instances. - * - * Limitation #2: The hash value is only valid as long as the term exists - * somewhere in the VM. Why? Because external pids, ports and refs are hashed - * by mixing the node *pointer* value. If a node disappears and later reappears - * with a new ErlNode struct, externals from that node will hash different than - * before. - * - * One IMPORTANT property must hold (for hamt). - * EVERY BIT of the term that is significant for equality (see EQ) - * MUST BE USED AS INPUT FOR THE HASH. Two different terms must always have a - * chance of hashing different when salted: hash([Salt|A]) vs hash([Salt|B]). - * - * This is why we can not use cached hash values for atoms for example. - * - */ - -#define CONST_HASH(AConst) \ -do { /* Lightweight mixing of constant (type info) */ \ - hash ^= AConst; \ - hash = (hash << 17) ^ (hash >> (32-17)); \ -} while (0) - -Uint32 -make_internal_hash(Eterm term) -{ - Uint32 hash; - Uint32 hash_xor_pairs; - - ERTS_UNDEF(hash_xor_pairs, 0); - - /* Optimization. Simple cases before declaration of estack. */ - if (primary_tag(term) == TAG_PRIMARY_IMMED1) { - hash = 0; - #if ERTS_SIZEOF_ETERM == 8 - UINT32_HASH_2((Uint32)term, (Uint32)(term >> 32), HCONST); - #elif ERTS_SIZEOF_ETERM == 4 - UINT32_HASH(term, HCONST); - #else - # error "No you don't" - #endif - return hash; - } - { - Eterm tmp; - DECLARE_ESTACK(s); - - hash = 0; - for (;;) { - switch (primary_tag(term)) { - case TAG_PRIMARY_LIST: - { - int c = 0; - Uint32 sh = 0; - Eterm* ptr = list_val(term); - while (is_byte(*ptr)) { - /* Optimization for strings. */ - sh = (sh << 8) + unsigned_val(*ptr); - if (c == 3) { - UINT32_HASH(sh, HCONST_4); - c = sh = 0; - } else { - c++; - } - term = CDR(ptr); - if (is_not_list(term)) - break; - ptr = list_val(term); - } - if (c > 0) - UINT32_HASH_2(sh, (Uint32)c, HCONST_22); - - if (is_list(term)) { - tmp = CDR(ptr); - CONST_HASH(HCONST_17); /* Hash CAR in cons cell */ - ESTACK_PUSH(s, tmp); - if (is_not_list(tmp)) { - ESTACK_PUSH(s, HASH_CDR); - } - term = CAR(ptr); - } - } - break; - case TAG_PRIMARY_BOXED: - { - Eterm hdr = *boxed_val(term); - ASSERT(is_header(hdr)); - switch (hdr & _TAG_HEADER_MASK) { - case ARITYVAL_SUBTAG: - { - int i; - int arity = header_arity(hdr); - Eterm* elem = tuple_val(term); - UINT32_HASH(arity, HCONST_9); - if (arity == 0) /* Empty tuple */ - goto pop_next; - for (i = arity; ; i--) { - term = elem[i]; - if (i == 1) - break; - ESTACK_PUSH(s, term); - } - } - break; - - case MAP_SUBTAG: - { - Eterm* ptr = boxed_val(term) + 1; - Uint size; - int i; - switch (hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_FLATMAP: - { - flatmap_t *mp = (flatmap_t *)flatmap_val(term); - Eterm *ks = flatmap_get_keys(mp); - Eterm *vs = flatmap_get_values(mp); - size = flatmap_get_size(mp); - UINT32_HASH(size, HCONST_16); - if (size == 0) - goto pop_next; - - /* We want a hash function that is *independent* of - * the order in which keys and values are encountered. - * We therefore calculate context independent hashes for all . - * key-value pairs and then xor them together. - */ - ESTACK_PUSH(s, hash_xor_pairs); - ESTACK_PUSH(s, hash); - ESTACK_PUSH(s, HASH_MAP_TAIL); - hash = 0; - hash_xor_pairs = 0; - for (i = size - 1; i >= 0; i--) { - ESTACK_PUSH(s, HASH_MAP_PAIR); - ESTACK_PUSH(s, vs[i]); - ESTACK_PUSH(s, ks[i]); - } - goto pop_next; - } - case HAMT_SUBTAG_HEAD_ARRAY: - case HAMT_SUBTAG_HEAD_BITMAP: - size = *ptr++; - UINT32_HASH(size, HCONST_16); - if (size == 0) - goto pop_next; - ESTACK_PUSH(s, hash_xor_pairs); - ESTACK_PUSH(s, hash); - ESTACK_PUSH(s, HASH_MAP_TAIL); - hash = 0; - hash_xor_pairs = 0; - } - switch (hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - i = 16; - break; - case HAMT_SUBTAG_HEAD_BITMAP: - case HAMT_SUBTAG_NODE_BITMAP: - i = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - break; - default: - erl_exit(1, "bad header"); - } - while (i) { - if (is_list(*ptr)) { - Eterm* cons = list_val(*ptr); - ESTACK_PUSH(s, HASH_MAP_PAIR); - ESTACK_PUSH(s, CDR(cons)); - ESTACK_PUSH(s, CAR(cons)); - } - else { - ASSERT(is_boxed(*ptr)); - ESTACK_PUSH(s, *ptr); - } - i--; ptr++; - } - goto pop_next; - } - break; - case EXPORT_SUBTAG: - { - Export* ep = *((Export **) (export_val(term) + 1)); - /* Assumes Export entries never moves */ - POINTER_HASH(ep, HCONST_14); - goto pop_next; - } - - case FUN_SUBTAG: - { - ErlFunThing* funp = (ErlFunThing *) fun_val(term); - Uint num_free = funp->num_free; - UINT32_HASH_2(num_free, funp->fe->module, HCONST_20); - UINT32_HASH_2(funp->fe->old_index, funp->fe->old_uniq, HCONST_21); - if (num_free == 0) { - goto pop_next; - } else { - Eterm* bptr = funp->env + num_free - 1; - while (num_free-- > 1) { - term = *bptr--; - ESTACK_PUSH(s, term); - } - term = *bptr; - } - } - break; - case REFC_BINARY_SUBTAG: - case HEAP_BINARY_SUBTAG: - case SUB_BINARY_SUBTAG: - { - byte* bptr; - unsigned sz = binary_size(term); - Uint32 con = HCONST_13 + hash; - Uint bitoffs; - Uint bitsize; - - ERTS_GET_BINARY_BYTES(term, bptr, bitoffs, bitsize); - if (sz == 0 && bitsize == 0) { - hash = con; - } else { - if (bitoffs == 0) { - hash = block_hash(bptr, sz, con); - if (bitsize > 0) { - UINT32_HASH_2(bitsize, (bptr[sz] >> (8 - bitsize)), - HCONST_15); - } - } else { - byte* buf = (byte *) erts_alloc(ERTS_ALC_T_TMP, - sz + (bitsize != 0)); - erts_copy_bits(bptr, bitoffs, 1, buf, 0, 1, sz*8+bitsize); - hash = block_hash(buf, sz, con); - if (bitsize > 0) { - UINT32_HASH_2(bitsize, (buf[sz] >> (8 - bitsize)), - HCONST_15); - } - erts_free(ERTS_ALC_T_TMP, (void *) buf); - } - } - goto pop_next; - } - break; - case POS_BIG_SUBTAG: - case NEG_BIG_SUBTAG: - { - Eterm* ptr = big_val(term); - Uint i = 0; - Uint n = BIG_SIZE(ptr); - Uint32 con = BIG_SIGN(ptr) ? HCONST_10 : HCONST_11; -#if D_EXP == 16 - do { - Uint32 x, y; - x = i < n ? BIG_DIGIT(ptr, i++) : 0; - x += (Uint32)(i < n ? BIG_DIGIT(ptr, i++) : 0) << 16; - y = i < n ? BIG_DIGIT(ptr, i++) : 0; - y += (Uint32)(i < n ? BIG_DIGIT(ptr, i++) : 0) << 16; - UINT32_HASH_2(x, y, con); - } while (i < n); -#elif D_EXP == 32 - do { - Uint32 x, y; - x = i < n ? BIG_DIGIT(ptr, i++) : 0; - y = i < n ? BIG_DIGIT(ptr, i++) : 0; - UINT32_HASH_2(x, y, con); - } while (i < n); -#elif D_EXP == 64 - do { - Uint t; - Uint32 x, y; - ASSERT(i < n); - t = BIG_DIGIT(ptr, i++); - x = t & 0xffffffff; - y = t >> 32; - UINT32_HASH_2(x, y, con); - } while (i < n); -#else -#error "unsupported D_EXP size" -#endif - goto pop_next; - } - break; - case REF_SUBTAG: - UINT32_HASH(internal_ref_numbers(term)[0], HCONST_7); - ASSERT(internal_ref_no_of_numbers(term) == 3); - UINT32_HASH_2(internal_ref_numbers(term)[1], - internal_ref_numbers(term)[2], HCONST_8); - goto pop_next; - - case EXTERNAL_REF_SUBTAG: - { - ExternalThing* thing = external_thing_ptr(term); - - ASSERT(external_thing_ref_no_of_numbers(thing) == 3); - /* See limitation #2 */ - #ifdef ARCH_64 - POINTER_HASH(thing->node, HCONST_7); - UINT32_HASH(external_thing_ref_numbers(thing)[0], HCONST_7); - #else - UINT32_HASH_2(thing->node, - external_thing_ref_numbers(thing)[0], HCONST_7); - #endif - UINT32_HASH_2(external_thing_ref_numbers(thing)[1], - external_thing_ref_numbers(thing)[2], HCONST_8); - goto pop_next; - } - case EXTERNAL_PID_SUBTAG: { - ExternalThing* thing = external_thing_ptr(term); - /* See limitation #2 */ - #ifdef ARCH_64 - POINTER_HASH(thing->node, HCONST_5); - UINT32_HASH(thing->data.ui[0], HCONST_5); - #else - UINT32_HASH_2(thing->node, thing->data.ui[0], HCONST_5); - #endif - goto pop_next; - } - case EXTERNAL_PORT_SUBTAG: { - ExternalThing* thing = external_thing_ptr(term); - /* See limitation #2 */ - #ifdef ARCH_64 - POINTER_HASH(thing->node, HCONST_6); - UINT32_HASH(thing->data.ui[0], HCONST_6); - #else - UINT32_HASH_2(thing->node, thing->data.ui[0], HCONST_6); - #endif - goto pop_next; - } - case FLOAT_SUBTAG: - { - FloatDef ff; - GET_DOUBLE(term, ff); - if (ff.fd == 0.0f) { - /* ensure positive 0.0 */ - ff.fd = erts_get_positive_zero_float(); - } - UINT32_HASH_2(ff.fw[0], ff.fw[1], HCONST_12); - goto pop_next; - } - default: - erl_exit(1, "Invalid tag in make_hash2(0x%X)\n", term); - } - } - break; - case TAG_PRIMARY_IMMED1: - #if ERTS_SIZEOF_ETERM == 8 - UINT32_HASH_2((Uint32)term, (Uint32)(term >> 32), HCONST); - #else - UINT32_HASH(term, HCONST); - #endif - goto pop_next; - - default: - erl_exit(1, "Invalid tag in make_hash2(0x%X)\n", term); - - pop_next: - if (ESTACK_ISEMPTY(s)) { - DESTROY_ESTACK(s); - return hash; - } - - term = ESTACK_POP(s); - - switch (term) { - case HASH_MAP_TAIL: { - hash = (Uint32) ESTACK_POP(s); - UINT32_HASH(hash_xor_pairs, HCONST_19); - hash_xor_pairs = (Uint32) ESTACK_POP(s); - goto pop_next; - } - case HASH_MAP_PAIR: - hash_xor_pairs ^= hash; + case HASH_MAP_VAL: + hash_xor_values ^= hash; hash = 0; - goto pop_next; - - case HASH_CDR: - CONST_HASH(HCONST_18); /* Hash CDR i cons cell */ - goto pop_next; + goto hash2_common; default: break; } @@ -1954,10 +1479,9 @@ } } -#undef CONST_HASH #undef HASH_MAP_TAIL -#undef HASH_MAP_PAIR -#undef HASH_CDR +#undef HASH_MAP_KEY +#undef HASH_MAP_VAL #undef UINT32_HASH_2 #undef UINT32_HASH @@ -2088,15 +1612,12 @@ break; case FLOAT_DEF: { - FloatDef ff; - GET_DOUBLE(term, ff); - if (ff.fd == 0.0f) { - /* ensure positive 0.0 */ - ff.fd = erts_get_positive_zero_float(); - } - hash = hash*FUNNY_NUMBER6 + (ff.fw[0] ^ ff.fw[1]); + FloatDef ff; + GET_DOUBLE(term, ff); + hash = hash*FUNNY_NUMBER6 + (ff.fw[0] ^ ff.fw[1]); } break; + case MAKE_HASH_CDR_PRE_OP: term = (Eterm) WSTACK_POP(stack); if (is_not_list(term)) { @@ -2177,8 +1698,23 @@ break; case MAP_DEF: - hash = hash*FUNNY_NUMBER13 + FUNNY_NUMBER14 + make_hash2(term); - break; + { + map_t *mp = (map_t *)map_val(term); + int size = map_get_size(mp); + Eterm *ks = map_get_keys(mp); + Eterm *vs = map_get_values(mp); + + /* Use a prime with size to remedy some of + * the {} and <<>> hash problems */ + hash = hash*FUNNY_NUMBER13 + FUNNY_NUMBER14 + size; + if (size == 0) + break; + + /* push values first */ + WSTACK_PUSH3(stack, (UWord)vs, (UWord) size, MAKE_HASH_TERM_ARRAY_OP); + WSTACK_PUSH3(stack, (UWord)ks, (UWord) size, MAKE_HASH_TERM_ARRAY_OP); + break; + } case TUPLE_DEF: { Eterm* ptr = tuple_val(term); @@ -2221,157 +1757,101 @@ #undef MAKE_HASH_CDR_POST_OP } -static Eterm -do_allocate_logger_message(Eterm gleader, Eterm **hp, ErlOffHeap **ohp, - ErlHeapFragment **bp, Process **p, Uint sz) -{ - Uint gl_sz; - gl_sz = IS_CONST(gleader) ? 0 : size_object(gleader); - sz = sz + gl_sz; +static int do_send_to_logger(Eterm tag, Eterm gleader, char *buf, int len) +{ + /* error_logger ! + {notify,{info_msg,gleader,{emulator,"~s~n",[]}}} | + {notify,{error,gleader,{emulator,"~s~n",[]}}} | + {notify,{warning_msg,gleader,{emulator,"~s~n",[}]}} */ + Eterm* hp; + Uint sz; + Uint gl_sz; + Eterm gl; + Eterm list,plist,format,tuple1,tuple2,tuple3; + ErlOffHeap *ohp; + ErlHeapFragment *bp = NULL; +#if !defined(ERTS_SMP) + Process *p; +#endif + + ASSERT(is_atom(tag)); + + if (len <= 0) { + return -1; + } #ifndef ERTS_SMP #ifdef USE_THREADS + p = NULL; if (erts_get_scheduler_data()) /* Must be scheduler thread */ #endif { - *p = erts_whereis_process(NULL, 0, am_error_logger, 0, 0); - if (*p) { - erts_aint32_t state = erts_smp_atomic32_read_acqb(&(*p)->state); + p = erts_whereis_process(NULL, 0, am_error_logger, 0, 0); + if (p) { + erts_aint32_t state = erts_smp_atomic32_read_acqb(&p->state); if (state & (ERTS_PSFLG_RUNNING|ERTS_PSFLG_RUNNING_SYS)) - *p = NULL; + p = NULL; } } - if (!*p) { - return NIL; + if (!p) { + /* buf *always* points to a null terminated string */ + erts_fprintf(stderr, "(no error logger present) %T: \"%s\"\n", + tag, buf); + return 0; } - /* So we have an error logger, lets build the message */ - if (sz <= HeapWordsLeft(*p)) { - *ohp = &MSO(*p); - *hp = HEAP_TOP(*p); - HEAP_TOP(*p) += sz; +#endif + gl_sz = IS_CONST(gleader) ? 0 : size_object(gleader); + sz = len * 2 /* message list */+ 2 /* cons surrounding message list */ + + gl_sz + + 3 /*outer 2-tuple*/ + 4 /* middle 3-tuple */ + 4 /*inner 3-tuple */ + + 8 /* "~s~n" */; + +#ifndef ERTS_SMP + if (sz <= HeapWordsLeft(p)) { + ohp = &MSO(p); + hp = HEAP_TOP(p); + HEAP_TOP(p) += sz; } else { #endif - *bp = new_message_buffer(sz); - *ohp = &(*bp)->off_heap; - *hp = (*bp)->mem; + bp = new_message_buffer(sz); + ohp = &bp->off_heap; + hp = bp->mem; #ifndef ERTS_SMP } #endif - - return (is_nil(gleader) + gl = (is_nil(gleader) ? am_noproc : (IS_CONST(gleader) ? gleader - : copy_struct(gleader,gl_sz,hp,*ohp))); -} - -static void do_send_logger_message(Eterm *hp, ErlOffHeap *ohp, ErlHeapFragment *bp, - Process *p, Eterm message) -{ + : copy_struct(gleader,gl_sz,&hp,ohp))); + list = buf_to_intlist(&hp, buf, len, NIL); + plist = CONS(hp,list,NIL); + hp += 2; + format = buf_to_intlist(&hp, "~s~n", 4, NIL); + tuple1 = TUPLE3(hp, am_emulator, format, plist); + hp += 4; + tuple2 = TUPLE3(hp, tag, gl, tuple1); + hp += 4; + tuple3 = TUPLE2(hp, am_notify, tuple2); #ifdef HARDDEBUG - erts_fprintf(stderr, "%T\n", message); + erts_fprintf(stderr, "%T\n", tuple3); #endif #ifdef ERTS_SMP { Eterm from = erts_get_current_pid(); if (is_not_internal_pid(from)) from = NIL; - erts_queue_error_logger_message(from, message, bp); + erts_queue_error_logger_message(from, tuple3, bp); } #else - erts_queue_message(p, NULL /* only used for smp build */, bp, message, NIL); + erts_queue_message(p, NULL /* only used for smp build */, bp, tuple3, NIL +#ifdef USE_VM_PROBES + , NIL +#endif + ); #endif -} - -/* error_logger ! - {notify,{info_msg,gleader,{emulator,format,[args]}}} | - {notify,{error,gleader,{emulator,format,[args]}}} | - {notify,{warning_msg,gleader,{emulator,format,[args}]}} */ -static int do_send_to_logger(Eterm tag, Eterm gleader, char *buf, int len) -{ - Uint sz; - Eterm gl; - Eterm list,args,format,tuple1,tuple2,tuple3; - - Eterm *hp = NULL; - ErlOffHeap *ohp = NULL; - ErlHeapFragment *bp = NULL; - Process *p = NULL; - - ASSERT(is_atom(tag)); - - if (len <= 0) { - return -1; - } - - sz = len * 2 /* message list */ + 2 /* cons surrounding message list */ - + 3 /*outer 2-tuple*/ + 4 /* middle 3-tuple */ + 4 /*inner 3-tuple */ - + 8 /* "~s~n" */; - - /* gleader size is accounted and allocated next */ - gl = do_allocate_logger_message(gleader, &hp, &ohp, &bp, &p, sz); - - if(is_nil(gl)) { - /* buf *always* points to a null terminated string */ - erts_fprintf(stderr, "(no error logger present) %T: \"%s\"\n", - tag, buf); - return 0; - } - - list = buf_to_intlist(&hp, buf, len, NIL); - args = CONS(hp,list,NIL); - hp += 2; - format = buf_to_intlist(&hp, "~s~n", 4, NIL); - tuple1 = TUPLE3(hp, am_emulator, format, args); - hp += 4; - tuple2 = TUPLE3(hp, tag, gl, tuple1); - hp += 4; - tuple3 = TUPLE2(hp, am_notify, tuple2); - - do_send_logger_message(hp, ohp, bp, p, tuple3); - return 0; -} - -static int do_send_term_to_logger(Eterm tag, Eterm gleader, - char *buf, int len, Eterm args) -{ - Uint sz; - Eterm gl; - Uint args_sz; - Eterm format,tuple1,tuple2,tuple3; - - Eterm *hp = NULL; - ErlOffHeap *ohp = NULL; - ErlHeapFragment *bp = NULL; - Process *p = NULL; - - ASSERT(is_atom(tag)); - - args_sz = size_object(args); - sz = len * 2 /* format */ + args_sz - + 3 /*outer 2-tuple*/ + 4 /* middle 3-tuple */ + 4 /*inner 3-tuple */; - - /* gleader size is accounted and allocated next */ - gl = do_allocate_logger_message(gleader, &hp, &ohp, &bp, &p, sz); - - if(is_nil(gl)) { - /* buf *always* points to a null terminated string */ - erts_fprintf(stderr, "(no error logger present) %T: \"%s\" %T\n", - tag, buf, args); - return 0; - } - - format = buf_to_intlist(&hp, buf, len, NIL); - args = copy_struct(args, args_sz, &hp, ohp); - tuple1 = TUPLE3(hp, am_emulator, format, args); - hp += 4; - tuple2 = TUPLE3(hp, tag, gl, tuple1); - hp += 4; - tuple3 = TUPLE2(hp, am_notify, tuple2); - - do_send_logger_message(hp, ohp, bp, p, tuple3); return 0; } @@ -2399,12 +1879,6 @@ return do_send_to_logger(am_error, gleader, buf, len); } -static ERTS_INLINE int -send_error_term_to_logger(Eterm gleader, char *buf, int len, Eterm args) -{ - return do_send_term_to_logger(am_error, gleader, buf, len, args); -} - #define LOGGER_DSBUF_INC_SZ 256 static erts_dsprintf_buf_t * @@ -2480,15 +1954,6 @@ } int -erts_send_error_term_to_logger(Eterm gleader, erts_dsprintf_buf_t *dsbufp, Eterm args) -{ - int res; - res = send_error_term_to_logger(gleader, dsbufp->str, dsbufp->str_len, args); - destroy_logger_dsbuf(dsbufp); - return res; -} - -int erts_send_info_to_logger_str(Eterm gleader, char *str) { return send_info_to_logger(gleader, str, sys_strlen(str)); @@ -2654,6 +2119,22 @@ ++bb; goto term_array; } + case MAP_SUBTAG: + { + aa = map_val_rel(a, a_base); + if (!is_boxed(b) || *boxed_val_rel(b,b_base) != *aa) + goto not_equal; + bb = map_val_rel(b,b_base); + sz = map_get_size((map_t*)aa); + + if (sz != map_get_size((map_t*)bb)) goto not_equal; + if (sz == 0) goto pop_next; + + aa += 2; + bb += 2; + sz += 1; /* increment for tuple-keys */ + goto term_array; + } case REFC_BINARY_SUBTAG: case HEAP_BINARY_SUBTAG: case SUB_BINARY_SUBTAG: @@ -2845,46 +2326,6 @@ } break; /* not equal */ } - case MAP_SUBTAG: - if (is_flatmap_rel(a, a_base)) { - aa = flatmap_val_rel(a, a_base); - if (!is_boxed(b) || *boxed_val_rel(b,b_base) != *aa) - goto not_equal; - bb = flatmap_val_rel(b,b_base); - sz = flatmap_get_size((flatmap_t*)aa); - - if (sz != flatmap_get_size((flatmap_t*)bb)) goto not_equal; - if (sz == 0) goto pop_next; - - aa += 2; - bb += 2; - sz += 1; /* increment for tuple-keys */ - goto term_array; - - } else { - if (!is_boxed(b) || *boxed_val_rel(b,b_base) != hdr) - goto not_equal; - - aa = hashmap_val_rel(a, a_base) + 1; - bb = hashmap_val_rel(b, b_base) + 1; - switch (hdr & _HEADER_MAP_SUBTAG_MASK) { - case HAMT_SUBTAG_HEAD_ARRAY: - aa++; bb++; - sz = 16; - break; - case HAMT_SUBTAG_HEAD_BITMAP: - aa++; bb++; - case HAMT_SUBTAG_NODE_BITMAP: - sz = hashmap_bitcount(MAP_HEADER_VAL(hdr)); - ASSERT(sz > 0 && sz < 17); - break; - default: - erl_exit(1, "Unknown hashmap subsubtag\n"); - } - goto term_array; - } - default: - ASSERT(!"Unknown boxed subtab in EQ"); } break; } @@ -2994,68 +2435,21 @@ */ Sint cmp(Eterm a, Eterm b) { - return erts_cmp(a, b, 0, 0); + return erts_cmp(a, b, 0); } #endif -#if HALFWORD_HEAP -static Sint erts_cmp_compound_rel_opt(Eterm a, Eterm* a_base, - Eterm b, Eterm* b_base, - int exact, int eq_only); -#else -static Sint erts_cmp_compound(Eterm a, Eterm b, int exact, int eq_only); -#endif - -#if HALFWORD_HEAP -Sint erts_cmp_rel_opt(Eterm a, Eterm* a_base, - Eterm b, Eterm* b_base, - int exact, int eq_only) -#else -Sint erts_cmp(Eterm a, Eterm b, int exact, int eq_only) -#endif -{ - if (is_atom(a) && is_atom(b)) { - return cmp_atoms(a, b); - } else if (is_both_small(a, b)) { - return (signed_val(a) - signed_val(b)); - } else if (is_float_rel(a, a_base) && is_float_rel(b, b_base)) { - FloatDef af, bf; - GET_DOUBLE_REL(a, af, a_base); - GET_DOUBLE_REL(b, bf, b_base); - return float_comp(af.fd, bf.fd); - } -#if HALFWORD_HEAP - return erts_cmp_compound_rel_opt(a,a_base,b,b_base,exact,eq_only); -#else - return erts_cmp_compound(a,b,exact,eq_only); -#endif -} - - /* erts_cmp(Eterm a, Eterm b, int exact) * exact = 1 -> term-based compare * exact = 0 -> arith-based compare */ #if HALFWORD_HEAP -static Sint erts_cmp_compound_rel_opt(Eterm a, Eterm* a_base, - Eterm b, Eterm* b_base, - int exact, int eq_only) -#else -static Sint erts_cmp_compound(Eterm a, Eterm b, int exact, int eq_only) +Sint erts_cmp_rel_opt(Eterm a, Eterm* a_base, Eterm b, Eterm* b_base, int exact) +#else +Sint erts_cmp(Eterm a, Eterm b, int exact) #endif { -#define PSTACK_TYPE struct erts_cmp_hashmap_state - struct erts_cmp_hashmap_state { - Sint wstack_rollback; - int was_exact; - Eterm *ap; - Eterm *bp; - Eterm min_key; - Sint cmp_res; /* result so far -1,0,+1 */ - }; - PSTACK_DECLARE(hmap_stack, 1); - WSTACK_DECLARE(stack); - WSTACK_DECLARE(b_stack); /* only used by hashmaps */ + DECLARE_WSTACK(stack); Eterm* aa; Eterm* bb; int i; @@ -3071,26 +2465,6 @@ Uint32 *anum; Uint32 *bnum; -/* The WSTACK contains naked Eterms and Operations marked with header-tags */ -#define OP_BITS 4 -#define OP_MASK 0xF -#define TERM_ARRAY_OP 0 -#define SWITCH_EXACT_OFF_OP 1 -#define HASHMAP_PHASE1_ARE_KEYS_EQUAL 2 -#define HASHMAP_PHASE1_IS_MIN_KEY 3 -#define HASHMAP_PHASE1_CMP_VALUES 4 -#define HASHMAP_PHASE2_ARE_KEYS_EQUAL 5 -#define HASHMAP_PHASE2_IS_MIN_KEY_A 6 -#define HASHMAP_PHASE2_IS_MIN_KEY_B 7 - - -#define OP_WORD(OP) (((OP) << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER) -#define TERM_ARRAY_OP_WORD(SZ) OP_WORD(((SZ) << OP_BITS) | TERM_ARRAY_OP) - -#define GET_OP(WORD) (ASSERT(is_header(WORD)), ((WORD) >> _TAG_PRIMARY_SIZE) & OP_MASK) -#define GET_OP_ARG(WORD) (ASSERT(is_header(WORD)), ((WORD) >> (OP_BITS + _TAG_PRIMARY_SIZE))) - - #define RETURN_NEQ(cmp) { j=(cmp); ASSERT(j != 0); goto not_equal; } #define ON_CMP_GOTO(cmp) if ((j=(cmp)) == 0) goto pop_next; else goto not_equal @@ -3106,8 +2480,6 @@ } while (0) -bodyrecur: - j = 0; tailrecur: if (is_same(a,a_base,b,b_base)) { /* Equal values or pointers. */ goto pop_next; @@ -3234,96 +2606,25 @@ ++aa; ++bb; goto term_array; - case (_TAG_HEADER_MAP >> _TAG_PRIMARY_SIZE) : - { - struct erts_cmp_hashmap_state* sp; - if (is_flatmap_header(ahdr)) { - if (!is_flatmap_rel(b,b_base)) { - if (is_hashmap_rel(b,b_base)) { - aa = (Eterm *)flatmap_val_rel(a,a_base); - i = flatmap_get_size((flatmap_t*)aa) - hashmap_size_rel(b,b_base); - ASSERT(i != 0); - RETURN_NEQ(i); - } - a_tag = MAP_DEF; - goto mixed_types; - } - aa = (Eterm *)flatmap_val_rel(a,a_base); - bb = (Eterm *)flatmap_val_rel(b,b_base); - - i = flatmap_get_size((flatmap_t*)aa); - if (i != flatmap_get_size((flatmap_t*)bb)) { - RETURN_NEQ((int)(i - flatmap_get_size((flatmap_t*)bb))); - } - if (i == 0) { - goto pop_next; - } - aa += 2; - bb += 2; - if (exact) { - i += 1; /* increment for tuple-keys */ - goto term_array; - } - else { - /* Value array */ - WSTACK_PUSH3(stack,(UWord)(bb+1),(UWord)(aa+1),TERM_ARRAY_OP_WORD(i)); - /* Switch back from 'exact' key compare */ - WSTACK_PUSH(stack,OP_WORD(SWITCH_EXACT_OFF_OP)); - /* Now do 'exact' compare of key tuples */ - a = *aa; - b = *bb; - exact = 1; - goto bodyrecur; - } - } - if (!is_hashmap_rel(b,b_base)) { - if (is_flatmap_rel(b,b_base)) { - bb = (Eterm *)flatmap_val_rel(b,b_base); - i = hashmap_size_rel(a,a_base) - flatmap_get_size((flatmap_t*)bb); - ASSERT(i != 0); - RETURN_NEQ(i); - } - a_tag = MAP_DEF; - goto mixed_types; - } - i = hashmap_size_rel(a,a_base) - hashmap_size_rel(b,b_base); - if (i) { - RETURN_NEQ(i); - } - if (hashmap_size_rel(a,a_base) == 0) { - goto pop_next; - } - - /* Hashmap compare strategy: - Phase 1. While keys are identical - Do synchronous stepping through leafs of both trees in hash - order. Maintain value compare result of minimal key. - - Phase 2. If key diff was found in phase 1 - Ignore values from now on. - Continue iterate trees by always advancing the one - lagging behind hash-wise. Identical keys are skipped. - A minimal key can only be candidate as tie-breaker if we - have passed that hash value in the other tree (which means - the key did not exist in the other tree). - */ - - sp = PSTACK_PUSH(hmap_stack); - hashmap_iterator_init(&stack, a, 0); - hashmap_iterator_init(&b_stack, b, 0); - sp->ap = hashmap_iterator_next(&stack); - sp->bp = hashmap_iterator_next(&b_stack); - sp->cmp_res = 0; - ASSERT(sp->ap && sp->bp); - - a = CAR(sp->ap); - b = CAR(sp->bp); - sp->was_exact = exact; - exact = 1; - WSTACK_PUSH(stack, OP_WORD(HASHMAP_PHASE1_ARE_KEYS_EQUAL)); - sp->wstack_rollback = WSTACK_COUNT(stack); - goto bodyrecur; + case (_TAG_HEADER_MAP >> _TAG_PRIMARY_SIZE) : + if (!is_map_rel(b,b_base)) { + a_tag = MAP_DEF; + goto mixed_types; + } + aa = (Eterm *)map_val_rel(a,a_base); + bb = (Eterm *)map_val_rel(b,b_base); + + i = map_get_size((map_t*)aa); + if (i != map_get_size((map_t*)bb)) { + RETURN_NEQ((int)(i - map_get_size((map_t*)bb))); + } + if (i == 0) { + goto pop_next; } + aa += 2; + bb += 2; + i += 1; /* increment for tuple-keys */ + goto term_array; case (_TAG_HEADER_FLOAT >> _TAG_PRIMARY_SIZE): if (!is_float_rel(b,b_base)) { a_tag = FLOAT_DEF; @@ -3683,7 +2984,8 @@ goto not_equal; } } else { - WSTACK_PUSH3(stack, (UWord)bb, (UWord)aa, TERM_ARRAY_OP_WORD(i)); + /* (ab)Use TAG_PRIMARY_HEADER to recognize a term_array */ + WSTACK_PUSH3(stack, i, (UWord)bb, (UWord)aa | TAG_PRIMARY_HEADER); goto tailrecur_ne; } } @@ -3695,179 +2997,22 @@ pop_next: if (!WSTACK_ISEMPTY(stack)) { UWord something = WSTACK_POP(stack); - struct erts_cmp_hashmap_state* sp; - if (primary_tag((Eterm) something) == TAG_PRIMARY_HEADER) { /* an operation */ - switch (GET_OP(something)) { - case TERM_ARRAY_OP: - i = GET_OP_ARG(something); - aa = (Eterm*)WSTACK_POP(stack); - bb = (Eterm*) WSTACK_POP(stack); - goto term_array; - - case SWITCH_EXACT_OFF_OP: - /* Done with exact compare of map keys, switch back */ - ASSERT(exact); - exact = 0; - goto pop_next; - - case HASHMAP_PHASE1_ARE_KEYS_EQUAL: { - sp = PSTACK_TOP(hmap_stack); - if (j) { - /* Key diff found, enter phase 2 */ - if (hashmap_key_hash_cmp(sp->ap, sp->bp) < 0) { - sp->min_key = CAR(sp->ap); - sp->cmp_res = -1; - sp->ap = hashmap_iterator_next(&stack); - } - else { - sp->min_key = CAR(sp->bp); - sp->cmp_res = 1; - sp->bp = hashmap_iterator_next(&b_stack); - } - exact = 1; /* only exact key compares in phase 2 */ - goto case_HASHMAP_PHASE2_LOOP; - } - - /* No key diff found so far, compare values if min key */ - - if (sp->cmp_res) { - a = CAR(sp->ap); - b = sp->min_key; - exact = 1; - WSTACK_PUSH(stack, OP_WORD(HASHMAP_PHASE1_IS_MIN_KEY)); - sp->wstack_rollback = WSTACK_COUNT(stack); - goto bodyrecur; - } - /* no min key-value found yet */ - a = CDR(sp->ap); - b = CDR(sp->bp); - exact = sp->was_exact; - WSTACK_PUSH(stack, OP_WORD(HASHMAP_PHASE1_CMP_VALUES)); - sp->wstack_rollback = WSTACK_COUNT(stack); - goto bodyrecur; - } - case HASHMAP_PHASE1_IS_MIN_KEY: - sp = PSTACK_TOP(hmap_stack); - if (j < 0) { - a = CDR(sp->ap); - b = CDR(sp->bp); - exact = sp->was_exact; - WSTACK_PUSH(stack, OP_WORD(HASHMAP_PHASE1_CMP_VALUES)); - sp->wstack_rollback = WSTACK_COUNT(stack); - goto bodyrecur; - } - goto case_HASHMAP_PHASE1_LOOP; - - case HASHMAP_PHASE1_CMP_VALUES: - sp = PSTACK_TOP(hmap_stack); - if (j) { - sp->cmp_res = j; - sp->min_key = CAR(sp->ap); - } - case_HASHMAP_PHASE1_LOOP: - sp->ap = hashmap_iterator_next(&stack); - sp->bp = hashmap_iterator_next(&b_stack); - if (!sp->ap) { - /* end of maps with identical keys */ - ASSERT(!sp->bp); - j = sp->cmp_res; - exact = sp->was_exact; - (void) PSTACK_POP(hmap_stack); - ON_CMP_GOTO(j); - } - a = CAR(sp->ap); - b = CAR(sp->bp); - exact = 1; - WSTACK_PUSH(stack, OP_WORD(HASHMAP_PHASE1_ARE_KEYS_EQUAL)); - sp->wstack_rollback = WSTACK_COUNT(stack); - goto bodyrecur; - - case_HASHMAP_PHASE2_LOOP: - if (sp->ap && sp->bp) { - a = CAR(sp->ap); - b = CAR(sp->bp); - ASSERT(exact); - WSTACK_PUSH(stack, OP_WORD(HASHMAP_PHASE2_ARE_KEYS_EQUAL)); - sp->wstack_rollback = WSTACK_COUNT(stack); - goto bodyrecur; - } - goto case_HASHMAP_PHASE2_NEXT_STEP; - - case HASHMAP_PHASE2_ARE_KEYS_EQUAL: - sp = PSTACK_TOP(hmap_stack); - if (j == 0) { - /* keys are equal, skip them */ - sp->ap = hashmap_iterator_next(&stack); - sp->bp = hashmap_iterator_next(&b_stack); - goto case_HASHMAP_PHASE2_LOOP; - } - /* fall through */ - case_HASHMAP_PHASE2_NEXT_STEP: - if (sp->ap || sp->bp) { - if (hashmap_key_hash_cmp(sp->ap, sp->bp) < 0) { - ASSERT(sp->ap); - a = CAR(sp->ap); - b = sp->min_key; - ASSERT(exact); - WSTACK_PUSH(stack, OP_WORD(HASHMAP_PHASE2_IS_MIN_KEY_A)); - } - else { /* hash_cmp > 0 */ - ASSERT(sp->bp); - a = CAR(sp->bp); - b = sp->min_key; - ASSERT(exact); - WSTACK_PUSH(stack, OP_WORD(HASHMAP_PHASE2_IS_MIN_KEY_B)); - } - sp->wstack_rollback = WSTACK_COUNT(stack); - goto bodyrecur; - } - /* End of both maps */ - j = sp->cmp_res; - exact = sp->was_exact; - (void) PSTACK_POP(hmap_stack); - ON_CMP_GOTO(j); - - case HASHMAP_PHASE2_IS_MIN_KEY_A: - sp = PSTACK_TOP(hmap_stack); - if (j < 0) { - sp->min_key = CAR(sp->ap); - sp->cmp_res = -1; - } - sp->ap = hashmap_iterator_next(&stack); - goto case_HASHMAP_PHASE2_LOOP; - - case HASHMAP_PHASE2_IS_MIN_KEY_B: - sp = PSTACK_TOP(hmap_stack); - if (j < 0) { - sp->min_key = CAR(sp->bp); - sp->cmp_res = 1; - } - sp->bp = hashmap_iterator_next(&b_stack); - goto case_HASHMAP_PHASE2_LOOP; - - default: - ASSERT(!"Invalid cmp op"); - } /* switch */ + if (primary_tag((Eterm) something) == TAG_PRIMARY_HEADER) { /* a term_array */ + aa = (Eterm*) something; + bb = (Eterm*) WSTACK_POP(stack); + i = WSTACK_POP(stack); + goto term_array; } a = (Eterm) something; b = (Eterm) WSTACK_POP(stack); goto tailrecur; } - ASSERT(PSTACK_IS_EMPTY(hmap_stack)); - PSTACK_DESTROY(hmap_stack); - WSTACK_DESTROY(stack); - WSTACK_DESTROY(b_stack); + DESTROY_WSTACK(stack); return 0; not_equal: - if (!PSTACK_IS_EMPTY(hmap_stack) && !eq_only) { - WSTACK_ROLLBACK(stack, PSTACK_TOP(hmap_stack)->wstack_rollback); - goto pop_next; - } - PSTACK_DESTROY(hmap_stack); - WSTACK_DESTROY(stack); - WSTACK_DESTROY(b_stack); + DESTROY_WSTACK(stack); return j; #undef CMP_NODES @@ -4517,6 +3662,145 @@ return 0; } +#ifdef ERTS_SMP + +/* + * Process and Port timers in smp case + */ + +ERTS_SCHED_PREF_PRE_ALLOC_IMPL(ptimer_pre, ErtsSmpPTimer, 1000) + +#define ERTS_PTMR_FLGS_ALLCD_SIZE \ + 2 +#define ERTS_PTMR_FLGS_ALLCD_MASK \ + ((((Uint32) 1) << ERTS_PTMR_FLGS_ALLCD_SIZE) - 1) + +#define ERTS_PTMR_FLGS_PREALLCD ((Uint32) 1) +#define ERTS_PTMR_FLGS_SLALLCD ((Uint32) 2) +#define ERTS_PTMR_FLGS_LLALLCD ((Uint32) 3) +#define ERTS_PTMR_FLG_CANCELLED (((Uint32) 1) << (ERTS_PTMR_FLGS_ALLCD_SIZE+0)) + +static void +init_ptimers(void) +{ + init_ptimer_pre_alloc(); +} + +static ERTS_INLINE void +free_ptimer(ErtsSmpPTimer *ptimer) +{ + switch (ptimer->timer.flags & ERTS_PTMR_FLGS_ALLCD_MASK) { + case ERTS_PTMR_FLGS_PREALLCD: + (void) ptimer_pre_free(ptimer); + break; + case ERTS_PTMR_FLGS_SLALLCD: + erts_free(ERTS_ALC_T_SL_PTIMER, (void *) ptimer); + break; + case ERTS_PTMR_FLGS_LLALLCD: + erts_free(ERTS_ALC_T_LL_PTIMER, (void *) ptimer); + break; + default: + erl_exit(ERTS_ABORT_EXIT, + "Internal error: Bad ptimer alloc type\n"); + break; + } +} + +/* Callback for process timeout cancelled */ +static void +ptimer_cancelled(ErtsSmpPTimer *ptimer) +{ + free_ptimer(ptimer); +} + +/* Callback for process timeout */ +static void +ptimer_timeout(ErtsSmpPTimer *ptimer) +{ + if (is_internal_pid(ptimer->timer.id)) { + Process *p; + p = erts_pid2proc_opt(NULL, + 0, + ptimer->timer.id, + ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS, + ERTS_P2P_FLG_ALLOW_OTHER_X); + if (p) { + if (!ERTS_PROC_IS_EXITING(p) + && !(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) { + ASSERT(*ptimer->timer.timer_ref == ptimer); + *ptimer->timer.timer_ref = NULL; + (*ptimer->timer.timeout_func)(p); + } + erts_smp_proc_unlock(p, ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS); + } + } + else { + Port *p; + ASSERT(is_internal_port(ptimer->timer.id)); + p = erts_id2port_sflgs(ptimer->timer.id, + NULL, + 0, + ERTS_PORT_SFLGS_DEAD); + if (p) { + if (!(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) { + ASSERT(*ptimer->timer.timer_ref == ptimer); + *ptimer->timer.timer_ref = NULL; + (*ptimer->timer.timeout_func)(p); + } + erts_port_release(p); + } + } + free_ptimer(ptimer); +} + +void +erts_create_smp_ptimer(ErtsSmpPTimer **timer_ref, + Eterm id, + ErlTimeoutProc timeout_func, + Uint timeout) +{ + ErtsSmpPTimer *res = ptimer_pre_alloc(); + if (res) + res->timer.flags = ERTS_PTMR_FLGS_PREALLCD; + else { + if (timeout < ERTS_ALC_MIN_LONG_LIVED_TIME) { + res = erts_alloc(ERTS_ALC_T_SL_PTIMER, sizeof(ErtsSmpPTimer)); + res->timer.flags = ERTS_PTMR_FLGS_SLALLCD; + } + else { + res = erts_alloc(ERTS_ALC_T_LL_PTIMER, sizeof(ErtsSmpPTimer)); + res->timer.flags = ERTS_PTMR_FLGS_LLALLCD; + } + } + res->timer.timeout_func = timeout_func; + res->timer.timer_ref = timer_ref; + res->timer.id = id; + res->timer.tm.active = 0; /* MUST be initalized */ + + ASSERT(!*timer_ref); + + *timer_ref = res; + + erts_set_timer(&res->timer.tm, + (ErlTimeoutProc) ptimer_timeout, + (ErlCancelProc) ptimer_cancelled, + (void*) res, + timeout); +} + +void +erts_cancel_smp_ptimer(ErtsSmpPTimer *ptimer) +{ + if (ptimer) { + ASSERT(*ptimer->timer.timer_ref == ptimer); + *ptimer->timer.timer_ref = NULL; + ptimer->timer.flags |= ERTS_PTMR_FLG_CANCELLED; + erts_cancel_timer(&ptimer->timer.tm); + } +} + +#endif + static int trim_threshold; static int top_pad; static int mmap_threshold; @@ -4526,7 +3810,9 @@ void erts_init_utils(void) { - +#ifdef ERTS_SMP + init_ptimers(); +#endif } void erts_init_utils_mem(void) @@ -4929,7 +4215,19 @@ void erts_interval_init(erts_interval_t *icp) { - erts_atomic64_init_nob(&icp->counter.atomic, 0); +#ifdef ARCH_64 + erts_atomic_init_nob(&icp->counter.atomic, 0); +#else + erts_dw_aint_t dw; +#ifdef ETHR_SU_DW_NAINT_T__ + dw.dw_sint = 0; +#else + dw.sint[ERTS_DW_AINT_HIGH_WORD] = 0; + dw.sint[ERTS_DW_AINT_LOW_WORD] = 0; +#endif + erts_dw_atomic_init_nob(&icp->counter.atomic, &dw); + +#endif #ifdef DEBUG icp->smp_api = 0; #endif @@ -4951,13 +4249,55 @@ static ERTS_INLINE Uint64 step_interval_nob(erts_interval_t *icp) { - return (Uint64) erts_atomic64_inc_read_nob(&icp->counter.atomic); +#ifdef ARCH_64 + return (Uint64) erts_atomic_inc_read_nob(&icp->counter.atomic); +#else + erts_dw_aint_t exp; + + erts_dw_atomic_read_nob(&icp->counter.atomic, &exp); + while (1) { + erts_dw_aint_t new = exp; + +#ifdef ETHR_SU_DW_NAINT_T__ + new.dw_sint++; +#else + new.sint[ERTS_DW_AINT_LOW_WORD]++; + if (new.sint[ERTS_DW_AINT_LOW_WORD] == 0) + new.sint[ERTS_DW_AINT_HIGH_WORD]++; +#endif + + if (erts_dw_atomic_cmpxchg_nob(&icp->counter.atomic, &new, &exp)) + return erts_interval_dw_aint_to_val__(&new); + + } +#endif } static ERTS_INLINE Uint64 step_interval_relb(erts_interval_t *icp) { - return (Uint64) erts_atomic64_inc_read_relb(&icp->counter.atomic); +#ifdef ARCH_64 + return (Uint64) erts_atomic_inc_read_relb(&icp->counter.atomic); +#else + erts_dw_aint_t exp; + + erts_dw_atomic_read_nob(&icp->counter.atomic, &exp); + while (1) { + erts_dw_aint_t new = exp; + +#ifdef ETHR_SU_DW_NAINT_T__ + new.dw_sint++; +#else + new.sint[ERTS_DW_AINT_LOW_WORD]++; + if (new.sint[ERTS_DW_AINT_LOW_WORD] == 0) + new.sint[ERTS_DW_AINT_HIGH_WORD]++; +#endif + + if (erts_dw_atomic_cmpxchg_relb(&icp->counter.atomic, &new, &exp)) + return erts_interval_dw_aint_to_val__(&new); + + } +#endif } @@ -4965,10 +4305,38 @@ ensure_later_interval_nob(erts_interval_t *icp, Uint64 ic) { Uint64 curr_ic; - curr_ic = (Uint64) erts_atomic64_read_nob(&icp->counter.atomic); +#ifdef ARCH_64 + curr_ic = (Uint64) erts_atomic_read_nob(&icp->counter.atomic); + if (curr_ic > ic) + return curr_ic; + return (Uint64) erts_atomic_inc_read_nob(&icp->counter.atomic); +#else + erts_dw_aint_t exp; + + erts_dw_atomic_read_nob(&icp->counter.atomic, &exp); + curr_ic = erts_interval_dw_aint_to_val__(&exp); if (curr_ic > ic) return curr_ic; - return (Uint64) erts_atomic64_inc_read_nob(&icp->counter.atomic); + + while (1) { + erts_dw_aint_t new = exp; + +#ifdef ETHR_SU_DW_NAINT_T__ + new.dw_sint++; +#else + new.sint[ERTS_DW_AINT_LOW_WORD]++; + if (new.sint[ERTS_DW_AINT_LOW_WORD] == 0) + new.sint[ERTS_DW_AINT_HIGH_WORD]++; +#endif + + if (erts_dw_atomic_cmpxchg_nob(&icp->counter.atomic, &new, &exp)) + return erts_interval_dw_aint_to_val__(&new); + + curr_ic = erts_interval_dw_aint_to_val__(&exp); + if (curr_ic > ic) + return curr_ic; + } +#endif } @@ -4976,10 +4344,38 @@ ensure_later_interval_acqb(erts_interval_t *icp, Uint64 ic) { Uint64 curr_ic; - curr_ic = (Uint64) erts_atomic64_read_acqb(&icp->counter.atomic); +#ifdef ARCH_64 + curr_ic = (Uint64) erts_atomic_read_acqb(&icp->counter.atomic); + if (curr_ic > ic) + return curr_ic; + return (Uint64) erts_atomic_inc_read_acqb(&icp->counter.atomic); +#else + erts_dw_aint_t exp; + + erts_dw_atomic_read_acqb(&icp->counter.atomic, &exp); + curr_ic = erts_interval_dw_aint_to_val__(&exp); if (curr_ic > ic) return curr_ic; - return (Uint64) erts_atomic64_inc_read_acqb(&icp->counter.atomic); + + while (1) { + erts_dw_aint_t new = exp; + +#ifdef ETHR_SU_DW_NAINT_T__ + new.dw_sint++; +#else + new.sint[ERTS_DW_AINT_LOW_WORD]++; + if (new.sint[ERTS_DW_AINT_LOW_WORD] == 0) + new.sint[ERTS_DW_AINT_HIGH_WORD]++; +#endif + + if (erts_dw_atomic_cmpxchg_acqb(&icp->counter.atomic, &new, &exp)) + return erts_interval_dw_aint_to_val__(&new); + + curr_ic = erts_interval_dw_aint_to_val__(&exp); + if (curr_ic > ic) + return curr_ic; + } +#endif } Uint64 @@ -5066,8 +4462,8 @@ */ Uint64 erts_timestamp_millis(void) { -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - return ERTS_MONOTONIC_TO_MSEC(erts_os_monotonic_time()); +#ifdef HAVE_GETHRTIME + return (Uint64) (sys_gethrtime() / 1000000); #else Uint64 res; SysTimeval tv; diff -Nru erlang-18.2-dfsg/erts/emulator/beam/version.h erlang-17.3-dfsg/erts/emulator/beam/version.h --- erlang-18.2-dfsg/erts/emulator/beam/version.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/beam/version.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/common/efile_drv.c erlang-17.3-dfsg/erts/emulator/drivers/common/efile_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/common/efile_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/common/efile_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -265,6 +264,23 @@ +#define GET_TIME(i, b) \ + (i).year = get_int32((b) + 0 * 4); \ + (i).month = get_int32((b) + 1 * 4); \ + (i).day = get_int32((b) + 2 * 4); \ + (i).hour = get_int32((b) + 3 * 4); \ + (i).minute = get_int32((b) + 4 * 4); \ + (i).second = get_int32((b) + 5 * 4) + +#define PUT_TIME(i, b) \ + put_int32((i).year, (b) + 0 * 4); \ + put_int32((i).month, (b) + 1 * 4); \ + put_int32((i).day, (b) + 2 * 4); \ + put_int32((i).hour, (b) + 3 * 4); \ + put_int32((i).minute,(b) + 4 * 4); \ + put_int32((i).second,(b) + 5 * 4) + + #if ALWAYS_READ_LINE_AHEAD #define DEFAULT_LINEBUF_SIZE 2048 #else @@ -1617,12 +1633,12 @@ } static void invoke_pwritev(void *data) { - struct t_data* const d = (struct t_data *) data; - struct t_pwritev * const c = &d->c.pwritev; + struct t_data *d = (struct t_data *) data; SysIOVec *iov0; SysIOVec *iov; int iovlen; int iovcnt; + struct t_pwritev *c = &d->c.pwritev; size_t p; int segment; size_t size, write_size, written; @@ -1696,9 +1712,9 @@ d->result_ok = 0; d->again = 0; deq_error: - MUTEX_LOCK(c->q_mtx); - driver_deq(c->port, c->size); - MUTEX_UNLOCK(c->q_mtx); + MUTEX_LOCK(d->c.writev.q_mtx); + driver_deq(d->c.pwritev.port, c->size); + MUTEX_UNLOCK(d->c.writev.q_mtx); goto done; } else { @@ -1709,9 +1725,9 @@ ASSERT(written >= FILE_SEGMENT_WRITE); } - MUTEX_LOCK(c->q_mtx); - driver_deq(c->port, written); - MUTEX_UNLOCK(c->q_mtx); + MUTEX_LOCK(d->c.writev.q_mtx); + driver_deq(d->c.pwritev.port, written); + MUTEX_UNLOCK(d->c.writev.q_mtx); done: EF_FREE(iov); /* Free our copy of the vector, nothing to restore */ @@ -1939,8 +1955,6 @@ d->result_ok = 1; if (d->c.sendfile.nbytes != 0) d->c.sendfile.nbytes -= nbytes; - } else if (nbytes == 0 && d->c.sendfile.nbytes == 0) { - d->result_ok = 1; } else d->result_ok = 0; } else { @@ -2581,6 +2595,7 @@ case FILE_CLOSE_ON_PORT_EXIT: /* See file_stop. However this is never invoked after the port is killed. */ free_data(data); + EF_FREE(desc); desc = NULL; /* This is it for this port, so just send dtrace and return, avoid doing anything to the freed data */ DTRACE6(efile_drv_return, sched_i1, sched_i2, sched_utag, diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/common/erl_efile.h erlang-17.3-dfsg/erts/emulator/drivers/common/erl_efile.h --- erlang-18.2-dfsg/erts/emulator/drivers/common/erl_efile.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/common/erl_efile.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/common/gzio.h erlang-17.3-dfsg/erts/emulator/drivers/common/gzio.h --- erlang-18.2-dfsg/erts/emulator/drivers/common/gzio.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/common/gzio.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/common/gzio_zutil.h erlang-17.3-dfsg/erts/emulator/drivers/common/gzio_zutil.h --- erlang-18.2-dfsg/erts/emulator/drivers/common/gzio_zutil.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/common/gzio_zutil.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/common/inet_drv.c erlang-17.3-dfsg/erts/emulator/drivers/common/inet_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/common/inet_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/common/inet_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 1997-2015. All Rights Reserved. + * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -269,13 +268,14 @@ #define sock_htonl(x) htonl((x)) #define sock_send(s,buf,len,flag) send((s),(buf),(len),(flag)) #define sock_sendv(s, vec, size, np, flag) \ - WSASend((s),(WSABUF*)(vec),(size),(np),(flag),NULL,NULL) + WSASend((s),(WSABUF*)(vec),\ + (size),(np),(flag),NULL,NULL) #define sock_recv(s,buf,len,flag) recv((s),(buf),(len),(flag)) #define sock_recvfrom(s,buf,blen,flag,addr,alen) \ - recvfrom((s),(buf),(blen),(flag),(addr),(alen)) + recvfrom((s),(buf),(blen),(flag),(addr),(alen)) #define sock_sendto(s,buf,blen,flag,addr,alen) \ - sendto((s),(buf),(blen),(flag),(addr),(alen)) + sendto((s),(buf),(blen),(flag),(addr),(alen)) #define sock_hostname(buf, len) gethostname((buf), (len)) #define sock_getservbyname(name,proto) getservbyname((name),(proto)) @@ -294,10 +294,6 @@ static unsigned long zero_value = 0; static unsigned long one_value = 1; -#define TCP_SHUT_WR SD_SEND -#define TCP_SHUT_RD SD_RECEIVE -#define TCP_SHUT_RDWR SD_BOTH - #elif defined (__OSE__) /* @@ -364,9 +360,9 @@ #define sock_accept(s, addr, len) accept((s), (addr), (len)) #define sock_send(s,buf,len,flag) inet_send((s),(buf),(len),(flag)) #define sock_sendto(s,buf,blen,flag,addr,alen) \ - sendto((s),(buf),(blen),(flag),(addr),(alen)) + sendto((s),(buf),(blen),(flag),(addr),(alen)) #define sock_sendv(s, vec, size, np, flag) \ - (*(np) = writev_fallback((s), (struct iovec*)(vec), (size), (*(np)))) + (*(np) = writev_fallback((s), (struct iovec*)(vec), (size), (*(np)))) #define sock_sendmsg(s,msghdr,flag) sendmsg((s),(msghdr),(flag)) #define sock_open(af, type, proto) socket((af), (type), (proto)) @@ -426,10 +422,6 @@ inet_driver_select((d), (flags), (onoff)); \ } while(0) -#define TCP_SHUT_WR SHUT_WR -#define TCP_SHUT_RD SHUT_RD -#define TCP_SHUT_RDWR SHUT_RDWR - #else /* !__OSE__ && !__WIN32__ */ #include @@ -700,9 +692,6 @@ inet_driver_select((d)->port, (ErlDrvEvent)(long)(d)->event, (flags), (onoff)); \ } while(0) -#define TCP_SHUT_WR SHUT_WR -#define TCP_SHUT_RD SHUT_RD -#define TCP_SHUT_RDWR SHUT_RDWR #endif /* !__WIN32__ && !__OSE__ */ @@ -832,14 +821,6 @@ #define TCP_ADDF_CLOSE_SENT 2 /* Close sent (active mode only) */ #define TCP_ADDF_DELAYED_CLOSE_RECV 4 /* If receive fails, report {error,closed} (passive mode) */ #define TCP_ADDF_DELAYED_CLOSE_SEND 8 /* If send fails, report {error,closed} (passive mode) */ -#define TCP_ADDF_PENDING_SHUT_WR 16 /* Call shutdown(sock, SHUT_WR) when queue empties */ -#define TCP_ADDF_PENDING_SHUT_RDWR 32 /* Call shutdown(sock, SHUT_RDWR) when queue empties */ -#define TCP_ADDF_PENDING_SHUTDOWN \ - (TCP_ADDF_PENDING_SHUT_WR | TCP_ADDF_PENDING_SHUT_RDWR) -#define TCP_ADDF_SHOW_ECONNRESET 64 /* Tell user about incoming RST */ -#define TCP_ADDF_DELAYED_ECONNRESET 128 /* An ECONNRESET error occured on send or shutdown */ -#define TCP_ADDF_SHUTDOWN_WR_DONE 256 /* A shutdown(sock, SHUT_WR) or SHUT_RDWR was made */ -#define TCP_ADDF_LINGER_ZERO 512 /* Discard driver queue on port close */ /* *_REQ_* replies */ #define INET_REP_ERROR 0 @@ -884,8 +865,6 @@ #define INET_LOPT_MSGQ_HIWTRMRK 36 /* set local msgq high watermark */ #define INET_LOPT_MSGQ_LOWTRMRK 37 /* set local msgq low watermark */ #define INET_LOPT_NETNS 38 /* Network namespace pathname */ -#define INET_LOPT_TCP_SHOW_ECONNRESET 39 /* tell user about incoming RST */ -#define INET_LOPT_LINE_DELIM 40 /* Line delimiting char */ /* SCTP options: a separate range, from 100: */ #define SCTP_OPT_RTOINFO 100 #define SCTP_OPT_ASSOCINFO 101 @@ -1155,7 +1134,6 @@ #else Uint32 send_oct[2]; /* number of octets sent, 64 bits */ #endif - char delimiter; /* Line delimiting character (def: '\n') */ unsigned long send_cnt; /* number of packets sent */ unsigned long send_max; /* maximum packet send */ double send_avg; /* average packet size sent */ @@ -1200,7 +1178,6 @@ static void tcp_inet_timeout(ErlDrvData); static void tcp_inet_process_exit(ErlDrvData, ErlDrvMonitor *); static void inet_stop_select(ErlDrvEvent, void*); -static void inet_emergency_close(ErlDrvData); #ifdef __WIN32__ static void tcp_inet_event(ErlDrvData, ErlDrvEvent); static void find_dynamic_functions(void); @@ -1311,8 +1288,7 @@ ERL_DRV_FLAG_USE_PORT_LOCKING|ERL_DRV_FLAG_SOFT_BUSY, NULL, tcp_inet_process_exit, - inet_stop_select, - inet_emergency_close + inet_stop_select }; @@ -1365,8 +1341,7 @@ ERL_DRV_FLAG_USE_PORT_LOCKING, NULL, NULL, - inet_stop_select, - inet_emergency_close + inet_stop_select }; #endif @@ -1400,8 +1375,7 @@ ERL_DRV_FLAG_USE_PORT_LOCKING, NULL, NULL, /* process_exit */ - inet_stop_select, - inet_emergency_close + inet_stop_select }; #endif @@ -1430,8 +1404,6 @@ static int tcp_recv(tcp_descriptor* desc, int request_len); static int tcp_deliver(tcp_descriptor* desc, int len); -static int tcp_shutdown_error(tcp_descriptor* desc, int err); - static int tcp_inet_output(tcp_descriptor* desc, HANDLE event); static int tcp_inet_input(tcp_descriptor* desc, HANDLE event); @@ -1449,7 +1421,7 @@ static int packet_inet_output(udp_descriptor* udesc, HANDLE event); #endif -/* convert descriptor pointer to inet_descriptor pointer */ +/* convert descriptor poiner to inet_descriptor pointer */ #define INETP(d) (&(d)->inet) #ifdef __OSE__ @@ -2751,7 +2723,7 @@ { tcp_descriptor* desc = (tcp_descriptor*) arg; int i = 0; - ErlDrvTermData spec[30]; + ErlDrvTermData spec[28]; ErlDrvTermData caller = ERL_DRV_NIL; ErlDrvBinary* bin; int ret; @@ -2792,11 +2764,11 @@ if (desc->inet.active == INET_PASSIVE) { i = LOAD_TUPLE(spec, i, 2); i = LOAD_TUPLE(spec, i, 4); - ASSERT(i <= sizeof(spec)/sizeof(*spec)); + ASSERT(i <= 28); ret = erl_drv_send_term(desc->inet.dport, caller, spec, i); } else { - ASSERT(i <= sizeof(spec)/sizeof(*spec)); + ASSERT(i <= 28); ret = erl_drv_output_term(desc->inet.dport, spec, i); } done: @@ -2918,9 +2890,6 @@ /* For #sctp_paddrinfo{}: */ am_active, am_inactive, -# if HAVE_DECL_SCTP_UNCONFIRMED - am_unconfirmed, -# endif /* For #sctp_status{}: */ # if HAVE_DECL_SCTP_EMPTY @@ -3950,10 +3919,7 @@ /* For #sctp_paddrinfo{}: */ INIT_ATOM(active); INIT_ATOM(inactive); -# if HAVE_DECL_SCTP_UNCONFIRMED - INIT_ATOM(unconfirmed); -# endif - + /* For #sctp_status{}: */ # if HAVE_DECL_SCTP_EMPTY INIT_ATOM(empty); @@ -3982,9 +3948,9 @@ if (0 != erl_drv_tsd_key_create("inet_buffer_stack_key", &buffer_stack_key)) goto error; - ERTS_CT_ASSERT(sizeof(struct in_addr) == 4); + ASSERT(sizeof(struct in_addr) == 4); # if defined(HAVE_IN6) && defined(AF_INET6) - ERTS_CT_ASSERT(sizeof(struct in6_addr) == 16); + ASSERT(sizeof(struct in6_addr) == 16); # endif INIT_ATOM(ok); @@ -4030,7 +3996,7 @@ #ifdef HAVE_SCTP /* Check the size of SCTP AssocID -- currently both this driver and the Erlang part require 32 bit: */ - ERTS_CT_ASSERT(sizeof(sctp_assoc_t)==ASSOC_ID_LEN); + ASSERT(sizeof(sctp_assoc_t)==ASSOC_ID_LEN); # if defined(HAVE_SCTP_BINDX) p_sctp_bindx = sctp_bindx; # if defined(HAVE_SCTP_PEELOFF) @@ -4576,13 +4542,11 @@ inet_address name; unsigned int sz = sizeof(name); - if (bound) { - /* check that it is a socket and that the socket is bound */ - if (IS_SOCKET_ERROR(sock_name(s, (struct sockaddr*) &name, &sz))) - return ctl_error(sock_errno(), rbuf, rsize); - if (name.sa.sa_family != domain) - return ctl_error(EINVAL, rbuf, rsize); - } + /* check that it is a socket and that the socket is bound */ + if (IS_SOCKET_ERROR(sock_name(s, (struct sockaddr*) &name, &sz))) + return ctl_error(sock_errno(), rbuf, rsize); + if (name.sa.sa_family != domain) + return ctl_error(EINVAL, rbuf, rsize); #ifdef __OSE__ /* for fdopen duplicating the sd will allow to uniquely identify the signal from OSE with erlang port */ @@ -4755,36 +4719,6 @@ return NULL; } -/* sockaddr_bufsz_need - * Returns the number of bytes needed to store the information - * through sockaddr_to_buf - */ - -static size_t sockaddr_bufsz_need(struct sockaddr* addr) -{ - if (addr->sa_family == AF_INET || addr->sa_family == 0) { - return 1 + sizeof(struct in_addr); - } -#if defined(HAVE_IN6) && defined(AF_INET6) - else if (addr->sa_family == AF_INET6) { - return 1 + sizeof(struct in6_addr); - } -#endif -#if defined(AF_LINK) - if (addr->sa_family == AF_LINK) { - struct sockaddr_dl *sdl_p = (struct sockaddr_dl*) addr; - return 2 + sdl_p->sdl_alen; - } -#endif -#if defined(AF_PACKET) && defined(HAVE_NETPACKET_PACKET_H) - else if(addr->sa_family == AF_PACKET) { - struct sockaddr_ll *sll_p = (struct sockaddr_ll*) addr; - return 2 + sll_p->sll_halen; - } -#endif - return 0; -} - static char* buf_to_sockaddr(char* ptr, char* end, struct sockaddr* addr) { buf_check(ptr,end,1); @@ -5863,11 +5797,6 @@ } #elif defined(HAVE_GETIFADDRS) -#ifdef DEBUG -#define GETIFADDRS_BUFSZ (1) -#else -#define GETIFADDRS_BUFSZ (512) -#endif static ErlDrvSSizeT inet_ctl_getifaddrs(inet_descriptor* desc_p, char **rbuf_pp, ErlDrvSizeT rsize) @@ -5878,15 +5807,15 @@ char *buf_p; char *buf_alloc_p; - buf_size = GETIFADDRS_BUFSZ; - buf_alloc_p = ALLOC(GETIFADDRS_BUFSZ); + buf_size = 512; + buf_alloc_p = ALLOC(buf_size); buf_p = buf_alloc_p; # define BUF_ENSURE(Size) \ do { \ int NEED_, GOT_ = buf_p - buf_alloc_p; \ NEED_ = GOT_ + (Size); \ if (NEED_ > buf_size) { \ - buf_size = NEED_ + GETIFADDRS_BUFSZ; \ + buf_size = NEED_ + 512; \ buf_alloc_p = REALLOC(buf_alloc_p, buf_size); \ buf_p = buf_alloc_p + GOT_; \ } \ @@ -5899,7 +5828,7 @@ while (! (P_ = sockaddr_to_buf((sa), buf_p, \ buf_alloc_p+buf_size))) { \ int GOT_ = buf_p - buf_alloc_p; \ - buf_size += GETIFADDRS_BUFSZ; \ + buf_size += 512; \ buf_alloc_p = REALLOC(buf_alloc_p, buf_size); \ buf_p = buf_alloc_p + GOT_; \ } \ @@ -5956,11 +5885,10 @@ || ifa_p->ifa_addr->sa_family == AF_PACKET #endif ) { - size_t need = sockaddr_bufsz_need(ifa_p->ifa_addr); - if (need > 3) { - BUF_ENSURE(1 + need); - SOCKADDR_TO_BUF(INET_IFOPT_HWADDR, ifa_p->ifa_addr); - } + char *bp = buf_p; + BUF_ENSURE(1); + SOCKADDR_TO_BUF(INET_IFOPT_HWADDR, ifa_p->ifa_addr); + if (buf_p - bp < 4) buf_p = bp; /* Empty hwaddr */ } #endif } @@ -5975,7 +5903,6 @@ return buf_size; # undef BUF_ENSURE } -#undef GETIFADDRS_BUFSZ #else @@ -6076,9 +6003,9 @@ int arg_sz; enum PacketParseType old_htype = desc->htype; int old_active = desc->active; - int propagate; /* Set to 1 if failure to set this option - should be propagated to erlang (not all - errors can be propagated for BC reasons) */ + int propagate = 0; /* Set to 1 if failure to set this option + should be propagated to erlang (not all + errors can be propagated for BC reasons) */ int res; #ifdef HAVE_SCTP /* SCTP sockets are treated completely separately: */ @@ -6095,7 +6022,6 @@ arg_ptr = (char*) &ival; arg_sz = sizeof(ival); proto = SOL_SOCKET; - propagate = 0; switch(opt) { case INET_LOPT_HEADER: @@ -6147,12 +6073,7 @@ desc->active_count = 0; if ((desc->stype == SOCK_STREAM) && (desc->active != INET_PASSIVE) && (desc->state == INET_STATE_CLOSED)) { - tcp_descriptor *tdesc = (tcp_descriptor *) desc; - if (tdesc->tcp_add_flags & TCP_ADDF_DELAYED_ECONNRESET) { - tdesc->tcp_add_flags &= ~TCP_ADDF_DELAYED_ECONNRESET; - tcp_error_message(tdesc, ECONNRESET); - } - tcp_closed_message(tdesc); + tcp_closed_message((tcp_descriptor *) desc); if (desc->exitf) { driver_exit(desc->port, 0); return 0; /* Give up on this socket, descriptor lost */ @@ -6269,22 +6190,6 @@ continue; #endif - case INET_LOPT_TCP_SHOW_ECONNRESET: - if (desc->sprotocol == IPPROTO_TCP) { - tcp_descriptor* tdesc = (tcp_descriptor*) desc; - if (ival) - tdesc->tcp_add_flags |= TCP_ADDF_SHOW_ECONNRESET; - else - tdesc->tcp_add_flags &= ~TCP_ADDF_SHOW_ECONNRESET; - } - continue; - - case INET_LOPT_LINE_DELIM: - DEBUGF(("inet_set_opts(%ld): s=%d, LINE_DELIM=%d\r\n", - (long)desc->port, desc->s, ival)); - desc->delimiter = (char)ival; - continue; - case INET_OPT_REUSEADDR: #ifdef __WIN32__ continue; /* Bjorn says */ @@ -6329,13 +6234,6 @@ arg_sz = sizeof(li_val); DEBUGF(("inet_set_opts(%ld): s=%d, SO_LINGER=%d,%d", (long)desc->port, desc->s, li_val.l_onoff,li_val.l_linger)); - if (desc->sprotocol == IPPROTO_TCP) { - tcp_descriptor* tdesc = (tcp_descriptor*) desc; - if (li_val.l_onoff && li_val.l_linger == 0) - tdesc->tcp_add_flags |= TCP_ADDF_LINGER_ZERO; - else - tdesc->tcp_add_flags &= ~TCP_ADDF_LINGER_ZERO; - } break; case INET_OPT_PRIORITY: @@ -7271,17 +7169,6 @@ continue; #endif - case INET_LOPT_TCP_SHOW_ECONNRESET: - if (desc->sprotocol == IPPROTO_TCP) { - tcp_descriptor* tdesc = (tcp_descriptor*) desc; - *ptr++ = opt; - ival = !!(tdesc->tcp_add_flags & TCP_ADDF_SHOW_ECONNRESET); - put_int32(ival, ptr); - } else { - TRUNCATE_TO(0,ptr); - } - continue; - case INET_OPT_PRIORITY: #ifdef SO_PRIORITY type = SO_PRIORITY; @@ -7449,13 +7336,8 @@ case SCTP_INACTIVE: i = LOAD_ATOM (spec, i, am_inactive); break; -# if HAVE_DECL_SCTP_UNCONFIRMED - case SCTP_UNCONFIRMED: - i = LOAD_ATOM (spec, i, am_unconfirmed); - break; -# endif default: - i = LOAD_ATOM (spec, i, am_undefined); + ASSERT(0); /* NB: SCTP_UNCONFIRMED modifier not yet supported */ } i = LOAD_INT (spec, i, pai->spinfo_cwnd); i = LOAD_INT (spec, i, pai->spinfo_srtt); @@ -8320,19 +8202,6 @@ FREE(desc); } -static void inet_emergency_close(ErlDrvData data) -{ - /* valid for any (UDP, TCP or SCTP) descriptor */ - tcp_descriptor* tcp_desc = (tcp_descriptor*)data; - inet_descriptor* desc = INETP(tcp_desc); - DEBUGF(("inet_emergency_close(%ld) {s=%d\r\n", - (long)desc->port, desc->s)); - if (desc->s != INVALID_SOCKET) { - sock_close(desc->s); - } -} - - static void set_default_msgq_limits(ErlDrvPort port) { ErlDrvSizeT q_high = INET_HIGH_MSGQ_WATERMARK; @@ -8380,7 +8249,6 @@ desc->deliver = INET_DELIVER_TERM; /* standard term format */ desc->active = INET_PASSIVE; /* start passive */ desc->active_count = 0; - desc->delimiter = '\n'; /* line delimiting char */ desc->oph = NULL; desc->opt = NULL; @@ -9126,11 +8994,6 @@ copy_desc->low = desc->low; copy_desc->send_timeout = desc->send_timeout; copy_desc->send_timeout_close = desc->send_timeout_close; - - if (desc->tcp_add_flags & TCP_ADDF_SHOW_ECONNRESET) - copy_desc->tcp_add_flags |= TCP_ADDF_SHOW_ECONNRESET; - else - copy_desc->tcp_add_flags &= ~TCP_ADDF_SHOW_ECONNRESET; /* The new port will be linked and connected to the original caller */ port = driver_create_port(port, owner, "tcp_inet", (ErlDrvData) copy_desc); @@ -9492,11 +9355,7 @@ if (desc->tcp_add_flags & TCP_ADDF_DELAYED_CLOSE_RECV) { desc->tcp_add_flags &= ~(TCP_ADDF_DELAYED_CLOSE_RECV| TCP_ADDF_DELAYED_CLOSE_SEND); - if (desc->tcp_add_flags & TCP_ADDF_DELAYED_ECONNRESET) { - desc->tcp_add_flags &= ~TCP_ADDF_DELAYED_ECONNRESET; - return ctl_reply(INET_REP_ERROR, "econnreset", 10, rbuf, rsize); - } else - return ctl_reply(INET_REP_ERROR, "closed", 6, rbuf, rsize); + return ctl_reply(INET_REP_ERROR, "closed", 6, rbuf, rsize); } return ctl_error(ENOTCONN, rbuf, rsize); } @@ -9548,20 +9407,10 @@ return ctl_error(EINVAL, rbuf, rsize); } how = buf[0]; - if (how != TCP_SHUT_RD && driver_sizeq(desc->inet.port) > 0) { - if (how == TCP_SHUT_WR) { - desc->tcp_add_flags |= TCP_ADDF_PENDING_SHUT_WR; - } else if (how == TCP_SHUT_RDWR) { - desc->tcp_add_flags |= TCP_ADDF_PENDING_SHUT_RDWR; - } + if (sock_shutdown(INETP(desc)->s, how) == 0) { return ctl_reply(INET_REP_OK, NULL, 0, rbuf, rsize); - } - if (IS_SOCKET_ERROR(sock_shutdown(INETP(desc)->s, how))) { - if (how != TCP_SHUT_RD) - desc->tcp_add_flags |= TCP_ADDF_SHUTDOWN_WR_DONE; - return ctl_error(sock_errno(), rbuf, rsize); } else { - return ctl_reply(INET_REP_OK, NULL, 0, rbuf, rsize); + return ctl_error(sock_errno(), rbuf, rsize); } } default: @@ -9693,19 +9542,11 @@ if (!IS_CONNECTED(INETP(desc))) { if (desc->tcp_add_flags & TCP_ADDF_DELAYED_CLOSE_SEND) { desc->tcp_add_flags &= ~TCP_ADDF_DELAYED_CLOSE_SEND; - if (desc->tcp_add_flags & TCP_ADDF_DELAYED_ECONNRESET) { - /* Don't clear flag. Leave it enabled for the next receive - * operation. - */ - inet_reply_error(INETP(desc), ECONNRESET); - } else - inet_reply_error_am(INETP(desc), am_closed); + inet_reply_error_am(INETP(desc), am_closed); } else inet_reply_error(INETP(desc), ENOTCONN); } - else if (desc->tcp_add_flags & TCP_ADDF_PENDING_SHUTDOWN) - tcp_shutdown_error(desc, EPIPE); else if (tcp_sendv(desc, ev) == 0) inet_reply_ok(INETP(desc)); DEBUGF(("tcp_inet_commandv(%ld) }\r\n", (long)desc->inet.port)); @@ -9718,8 +9559,6 @@ /* Discard send queue to avoid hanging port (OTP-7615) */ tcp_clear_output(desc); } - if (desc->tcp_add_flags & TCP_ADDF_LINGER_ZERO) - tcp_clear_output(desc); } static void tcp_inet_process_exit(ErlDrvData e, ErlDrvMonitor *monitorp) @@ -9892,7 +9731,7 @@ tlen = packet_get_length(desc->inet.htype, ptr, n, desc->inet.psize, desc->i_bufsz, - desc->inet.delimiter, &desc->http_state); + &desc->http_state); DEBUGF(("tcp_remain(%ld): s=%d, n=%d, nfill=%d nsz=%d, tlen %d\r\n", (long)desc->inet.port, desc->inet.s, n, nfill, nsz, tlen)); @@ -10082,10 +9921,7 @@ int err = sock_errno(); if (err == ECONNRESET) { DEBUGF((" => detected close (connreset)\r\n")); - if (desc->tcp_add_flags & TCP_ADDF_SHOW_ECONNRESET) - return tcp_recv_error(desc, err); - else - return tcp_recv_closed(desc); + return tcp_recv_closed(desc); } if (err == ERRNO_BLOCK) { DEBUGF((" => would block\r\n")); @@ -10297,19 +10133,7 @@ if (netEv.lNetworkEvents & FD_CLOSE) { /* error in err = netEv.iErrorCode[FD_CLOSE_BIT] */ DEBUGF(("Detected close in %s, line %d\r\n", __FILE__, __LINE__)); - if (desc->tcp_add_flags & TCP_ADDF_SHOW_ECONNRESET) { - err = netEv.iErrorCode[FD_CLOSE_BIT]; - if (err == ECONNRESET) - tcp_recv_error(desc, err); - else if (err == ECONNABORTED && IS_CONNECTED(INETP(desc))) { - /* translate this error to ECONNRESET */ - tcp_recv_error(desc, ECONNRESET); - } - else - tcp_recv_closed(desc); - } - else - tcp_recv_closed(desc); + tcp_recv_closed(desc); } DEBUGF(("tcp_inet_event(%ld) }\r\n", (long)desc->inet.port)); return; @@ -10616,11 +10440,8 @@ return ret; } -static int tcp_send_or_shutdown_error(tcp_descriptor* desc, int err) +static int tcp_send_error(tcp_descriptor* desc, int err) { - int show_econnreset = (err == ECONNRESET - && desc->tcp_add_flags & TCP_ADDF_SHOW_ECONNRESET); - /* * If the port is busy, we must do some clean-up before proceeding. */ @@ -10636,21 +10457,14 @@ /* * We used to handle "expected errors" differently from unexpected ones. - * Now we handle all errors in the same way (unless the show_econnreset - * socket option is enabled). We just have to distinguish between passive - * and active sockets. + * Now we handle all errors in the same way. We just have to distinguish + * between passive and active sockets. */ DEBUGF(("driver_failure_eof(%ld) in %s, line %d\r\n", (long)desc->inet.port, __FILE__, __LINE__)); if (desc->inet.active) { - if (show_econnreset) { - tcp_error_message(desc, err); - tcp_closed_message(desc); - inet_reply_error(INETP(desc), err); - } else { - tcp_closed_message(desc); - inet_reply_error_am(INETP(desc), am_closed); - } + tcp_closed_message(desc); + inet_reply_error_am(INETP(desc), am_closed); if (desc->inet.exitf) driver_exit(desc->inet.port, 0); else @@ -10662,10 +10476,7 @@ erl_inet_close(INETP(desc)); if (desc->inet.caller) { - if (show_econnreset) - inet_reply_error(INETP(desc), err); - else - inet_reply_error_am(INETP(desc), am_closed); + inet_reply_error_am(INETP(desc), am_closed); } else { /* No blocking send op to reply to right now. @@ -10682,54 +10493,10 @@ * in the receive operation. */ desc->tcp_add_flags |= TCP_ADDF_DELAYED_CLOSE_RECV; - - if (show_econnreset) { - /* Return {error, econnreset} instead of {error, closed} - * on send or receive operations. - */ - desc->tcp_add_flags |= TCP_ADDF_DELAYED_ECONNRESET; - } } return -1; } -static int tcp_send_error(tcp_descriptor* desc, int err) -{ - /* EPIPE errors usually occur in one of three ways: - * 1. We write to a socket when we've already shutdown() the write side. On - * Windows the error returned for this is ESHUTDOWN rather than EPIPE. - * 2. The TCP peer sends us an RST through no fault of our own (perhaps - * by aborting the connection using SO_LINGER) and we then attempt - * to write to the socket. On Linux and Windows we would actually - * receive an ECONNRESET error for this, but on the BSDs, Darwin, - * Illumos and presumably Solaris, it's an EPIPE. - * 3. We cause the TCP peer to send us an RST by writing to a socket - * after we receive a FIN from them. Our first write will be - * successful, but if the they have closed the connection (rather - * than just shutting down the write side of it) this will cause their - * OS to send us an RST. Then, when we attempt to write to the socket - * a second time, we will get an EPIPE error. On Windows we get an - * ECONNABORTED. - * - * What we are going to do here is to treat all EPIPE messages that aren't - * of type 1 as ECONNRESET errors. This will allow users who have the - * show_econnreset socket option enabled to receive {error, econnreset} on - * both send and recv operations to indicate that an RST has been received. - */ -#ifdef __WIN_32__ - if (err == ECONNABORTED) - err = ECONNRESET; -#endif - if (err == EPIPE && !(desc->tcp_add_flags & TCP_ADDF_SHUTDOWN_WR_DONE)) - err = ECONNRESET; - return tcp_send_or_shutdown_error(desc, err); -} - -static int tcp_shutdown_error(tcp_descriptor* desc, int err) -{ - return tcp_send_or_shutdown_error(desc, err); -} - /* ** Send non-blocking vector data */ @@ -10930,21 +10697,6 @@ return 0; } -/* shutdown on the socket: -** Assume caller has confirmed TCP_ADDF_PENDING_SHUTDOWN is set. -*/ -static void tcp_shutdown_async(tcp_descriptor* desc) -{ - int how; - - how = (desc->tcp_add_flags & TCP_ADDF_PENDING_SHUT_WR) ? - TCP_SHUT_WR : TCP_SHUT_RDWR; - if (IS_SOCKET_ERROR(sock_shutdown(INETP(desc)->s, how))) - tcp_shutdown_error(desc, sock_errno()); - else - desc->tcp_add_flags |= TCP_ADDF_SHUTDOWN_WR_DONE; -} - #ifdef __OSE__ static void tcp_inet_drv_output_ose(ErlDrvData data, ErlDrvEvent event) @@ -11073,8 +10825,6 @@ if ((iov = driver_peekq(ix, &vsize)) == NULL) { sock_select(INETP(desc), FD_WRITE, 0); send_empty_out_q_msgs(INETP(desc)); - if (desc->tcp_add_flags & TCP_ADDF_PENDING_SHUTDOWN) - tcp_shutdown_async(desc); goto done; } vsize = vsize > MAX_VSIZE ? MAX_VSIZE : vsize; @@ -12304,8 +12054,6 @@ void (*timeout_fun)(ErlDrvData drv_data, ErlDrvTermData caller)) { -#define eq_mega(a, b) ((a)->when.megasecs == (b)->when.megasecs) -#define eq_sec(a, b) ((a)->when.secs == (b)->when.secs) MultiTimerData *mtd, *p, *s; mtd = ALLOC(sizeof(MultiTimerData)); absolute_timeout(timeout, &(mtd->when)); @@ -12317,17 +12065,23 @@ break; } } - for (; p!= NULL && eq_mega(p, mtd); s = p, p = p->next) { + if (!p || p->when.megasecs > mtd->when.megasecs) { + goto found; + } + for (; p!= NULL; s = p, p = p->next) { if (p->when.secs >= mtd->when.secs) { break; } } - for (; p!= NULL && eq_mega(p, mtd) && eq_sec(p, mtd); s = p, p = p->next) { + if (!p || p->when.secs > mtd->when.secs) { + goto found; + } + for (; p!= NULL; s = p, p = p->next) { if (p->when.microsecs >= mtd->when.microsecs) { break; } } - + found: if (!p) { if (!s) { *first = mtd; @@ -12353,8 +12107,6 @@ } return mtd; } -#undef eq_mega -#undef eq_sec diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/common/ram_file_drv.c erlang-17.3-dfsg/erts/emulator/drivers/common/ram_file_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/common/ram_file_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/common/ram_file_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/common/zlib_drv.c erlang-17.3-dfsg/erts/emulator/drivers/common/zlib_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/common/zlib_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/common/zlib_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -63,17 +62,8 @@ #define CRC32_COMBINE 23 #define ADLER32_COMBINE 24 -#define INFLATE_CHUNK 25 - - #define DEFAULT_BUFSZ 4000 -/* This flag is used in the same places, where zlib return codes - * (Z_OK, Z_STREAM_END, Z_NEED_DICT) are. So, we need to set it to - * relatively large value to avoid possible value clashes in future. - * */ -#define INFLATE_HAS_MORE 100 - static int zlib_init(void); static ErlDrvData zlib_start(ErlDrvPort port, char* buf); static void zlib_stop(ErlDrvData e); @@ -305,58 +295,6 @@ return res; } -static int zlib_inflate_chunk(ZLibData* d) -{ - int res = Z_OK; - - if ((d->bin == NULL) && (zlib_output_init(d) < 0)) { - errno = ENOMEM; - return Z_ERRNO; - } - - while ((driver_sizeq(d->port) > 0) && (d->s.avail_out > 0) && - (res != Z_STREAM_END)) { - int vlen; - SysIOVec* iov = driver_peekq(d->port, &vlen); - int len; - - d->s.next_in = iov[0].iov_base; - d->s.avail_in = iov[0].iov_len; - while((d->s.avail_in > 0) && (d->s.avail_out > 0) && (res != Z_STREAM_END)) { - res = inflate(&d->s, Z_NO_FLUSH); - if (res == Z_NEED_DICT) { - /* Essential to eat the header bytes that zlib has looked at */ - len = iov[0].iov_len - d->s.avail_in; - driver_deq(d->port, len); - return res; - } - if (res == Z_BUF_ERROR) { - /* Was possible more output, but actually not */ - res = Z_OK; - } - else if (res < 0) { - return res; - } - } - len = iov[0].iov_len - d->s.avail_in; - driver_deq(d->port, len); - } - - /* We are here because all input was consumed or EOS reached or output - * buffer is full */ - if (d->want_crc) { - d->crc = crc32(d->crc, (unsigned char*) d->bin->orig_bytes, - d->binsz - d->s.avail_out); - } - zlib_output(d); - if ((res == Z_OK) && (d->s.avail_in > 0)) - res = INFLATE_HAS_MORE; - else if (res == Z_STREAM_END) { - d->inflate_eos_seen = 1; - } - return res; -} - static int zlib_deflate(ZLibData* d, int flush) { int res = Z_OK; @@ -628,18 +566,6 @@ return zlib_value2(3, d->s.adler, rbuf, rlen); } else { return zlib_return(res, rbuf, rlen); - } - - case INFLATE_CHUNK: - if (d->state != ST_INFLATE) goto badarg; - if (len != 0) goto badarg; - res = zlib_inflate_chunk(d); - if (res == INFLATE_HAS_MORE) { - return zlib_value2(4, 0, rbuf, rlen); - } else if (res == Z_NEED_DICT) { - return zlib_value2(3, d->s.adler, rbuf, rlen); - } else { - return zlib_return(res, rbuf, rlen); } case GET_QSIZE: diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/ose/ose_efile.c erlang-17.3-dfsg/erts/emulator/drivers/ose/ose_efile.c --- erlang-18.2-dfsg/erts/emulator/drivers/ose/ose_efile.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/ose/ose_efile.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/ose/ose_signal_drv.c erlang-17.3-dfsg/erts/emulator/drivers/ose/ose_signal_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/ose/ose_signal_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/ose/ose_signal_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2013-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/ose/ttsl_drv.c erlang-17.3-dfsg/erts/emulator/drivers/ose/ttsl_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/ose/ttsl_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/ose/ttsl_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/unix/bin_drv.c erlang-17.3-dfsg/erts/emulator/drivers/unix/bin_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/unix/bin_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/unix/bin_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/unix/multi_drv.c erlang-17.3-dfsg/erts/emulator/drivers/unix/multi_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/unix/multi_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/unix/multi_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/unix/sig_drv.c erlang-17.3-dfsg/erts/emulator/drivers/unix/sig_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/unix/sig_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/unix/sig_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/unix/ttsl_drv.c erlang-17.3-dfsg/erts/emulator/drivers/unix/ttsl_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/unix/ttsl_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/unix/ttsl_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -33,10 +32,6 @@ #ifdef HAVE_TERMCAP /* else make an empty driver that can not be opened */ -#ifndef WANT_NONBLOCKING -#define WANT_NONBLOCKING -#endif - #include "sys.h" #include #include @@ -44,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -63,14 +57,6 @@ #include #endif -#if defined IOV_MAX -#define MAXIOV IOV_MAX -#elif defined UIO_MAXIOV -#define MAXIOV UIO_MAXIOV -#else -#define MAXIOV 16 -#endif - #define TRUE 1 #define FALSE 0 @@ -94,15 +80,12 @@ #define OP_INSC 2 #define OP_DELC 3 #define OP_BEEP 4 -#define OP_PUTC_SYNC 5 /* Control op */ #define CTRL_OP_GET_WINSIZE 100 #define CTRL_OP_GET_UNICODE_STATE 101 #define CTRL_OP_SET_UNICODE_STATE 102 -/* We use 1024 as the buf size as that was the default buf size of FILE streams - on all platforms that I checked. */ -#define TTY_BUFFSIZE 1024 + static int lbuf_size = BUFSIZ; static Uint32 *lbuf; /* The current line buffer */ @@ -130,19 +113,13 @@ /* Main interface functions. */ static void ttysl_stop(ErlDrvData); static void ttysl_from_erlang(ErlDrvData, char*, ErlDrvSizeT); -static void ttysl_to_tty(ErlDrvData, ErlDrvEvent); -static void ttysl_flush_tty(ErlDrvData); static void ttysl_from_tty(ErlDrvData, ErlDrvEvent); static void ttysl_stop_select(ErlDrvEvent, void*); static Sint16 get_sint16(char*); static ErlDrvPort ttysl_port; static int ttysl_fd; -static int ttysl_terminate = 0; -static int ttysl_send_ok = 0; -static ErlDrvBinary *putcbuf; -static int putcpos; -static int putclen; +static FILE *ttysl_out; /* Functions that work on the line buffer. */ static int start_lbuf(void); @@ -224,22 +201,22 @@ IF_IMPL(ttysl_stop), IF_IMPL(ttysl_from_erlang), IF_IMPL(ttysl_from_tty), - IF_IMPL(ttysl_to_tty), - "tty_sl", /* driver_name */ - NULL, /* finish */ - NULL, /* handle */ + NULL, + "tty_sl", + NULL, + NULL, IF_IMPL(ttysl_control), NULL, /* timeout */ NULL, /* outputv */ NULL, /* ready_async */ - IF_IMPL(ttysl_flush_tty), + NULL, /* flush */ NULL, /* call */ NULL, /* event */ ERL_DRV_EXTENDED_MARKER, ERL_DRV_EXTENDED_MAJOR_VERSION, ERL_DRV_EXTENDED_MINOR_VERSION, 0, /* ERL_DRV_FLAGs */ - NULL, /* handle2 */ + NULL, NULL, /* process_exit */ IF_IMPL(ttysl_stop_select) }; @@ -319,7 +296,8 @@ return ERL_DRV_ERROR_GENERAL; } - SET_NONBLOCKING(ttysl_fd); + /* Open the terminal and set the terminal */ + ttysl_out = fdopen(ttysl_fd, "w"); #ifdef PRIMITIVE_UTF8_CHECK setlocale(LC_CTYPE, ""); /* Set international environment, @@ -339,8 +317,8 @@ } #endif DEBUGLOG(("utf8_mode is %s\n",(utf8_mode) ? "on" : "off")); - sys_signal(SIGCONT, cont); - sys_signal(SIGWINCH, winch); + sys_sigset(SIGCONT, cont); + sys_sigset(SIGWINCH, winch); driver_select(port, (ErlDrvEvent)(UWord)ttysl_fd, ERL_DRV_READ|ERL_DRV_USE, 1); ttysl_port = port; @@ -422,14 +400,12 @@ stop_lbuf(); stop_termcap(); tty_reset(ttysl_fd); - driver_select(ttysl_port, (ErlDrvEvent)(UWord)ttysl_fd, - ERL_DRV_WRITE|ERL_DRV_READ|ERL_DRV_USE, 0); - sys_signal(SIGCONT, SIG_DFL); - sys_signal(SIGWINCH, SIG_DFL); + driver_select(ttysl_port, (ErlDrvEvent)(UWord)ttysl_fd, ERL_DRV_READ|ERL_DRV_USE, 0); + sys_sigset(SIGCONT, SIG_DFL); + sys_sigset(SIGWINCH, SIG_DFL); } ttysl_port = (ErlDrvPort)-1; ttysl_fd = -1; - ttysl_terminate = 0; /* return TRUE; */ } @@ -674,26 +650,10 @@ static void ttysl_from_erlang(ErlDrvData ttysl_data, char* buf, ErlDrvSizeT count) { - ErlDrvSizeT sz; - - sz = driver_sizeq(ttysl_port); - - putclen = count > TTY_BUFFSIZE ? TTY_BUFFSIZE : count; - putcbuf = driver_alloc_binary(putclen); - putcpos = 0; - if (lpos > MAXSIZE) put_chars((byte*)"\n", 1); switch (buf[0]) { - case OP_PUTC_SYNC: - /* Using sync means that we have to send an ok to the - controlling process for each command call. We delay - sending ok if the driver queue exceeds a certain size. - We do not set ourselves as a busy port, as this - could be very bad for user_drv, if it gets blocked on - the port_command. */ - /* fall through */ case OP_PUTC: DEBUGLOG(("OP: Putc(%lu)",(unsigned long) count-1)); if (check_buf_size((byte*)buf+1, count-1) == 0) @@ -718,106 +678,10 @@ /* Unknown op, just ignore. */ break; } - - driver_enq_bin(ttysl_port,putcbuf,0,putcpos); - driver_free_binary(putcbuf); - - if (sz == 0) { - for (;;) { - int written, qlen; - SysIOVec *iov; - - iov = driver_peekq(ttysl_port,&qlen); - if (iov) - written = writev(ttysl_fd, iov, qlen > MAXIOV ? MAXIOV : qlen); - else - written = 0; - if (written < 0) { - if (errno == ERRNO_BLOCK || errno == EINTR) { - driver_select(ttysl_port,(ErlDrvEvent)(long)ttysl_fd, - ERL_DRV_USE|ERL_DRV_WRITE,1); - break; - } else { - driver_failure_posix(ttysl_port, errno); - return; - } - } else { - if (driver_deq(ttysl_port, written) == 0) - break; - } - } - } - - if (buf[0] == OP_PUTC_SYNC) { - if (driver_sizeq(ttysl_port) > TTY_BUFFSIZE && !ttysl_terminate) { - /* We delay sending the ack until the buffer has been consumed */ - ttysl_send_ok = 1; - } else { - ErlDrvTermData spec[] = { - ERL_DRV_PORT, driver_mk_port(ttysl_port), - ERL_DRV_ATOM, driver_mk_atom("ok"), - ERL_DRV_TUPLE, 2 - }; - ASSERT(ttysl_send_ok == 0); - erl_drv_output_term(driver_mk_port(ttysl_port), spec, - sizeof(spec) / sizeof(spec[0])); - } - } - + fflush(ttysl_out); return; /* TRUE; */ } -static void ttysl_to_tty(ErlDrvData ttysl_data, ErlDrvEvent fd) { - for (;;) { - int written, qlen; - SysIOVec *iov; - ErlDrvSizeT sz; - - iov = driver_peekq(ttysl_port,&qlen); - if (iov) - written = writev(ttysl_fd, iov, qlen > MAXIOV ? MAXIOV : qlen); - else - written = 0; - if (written < 0) { - if (errno == EINTR) { - continue; - } else if (errno != ERRNO_BLOCK){ - driver_failure_posix(ttysl_port, errno); - } - break; - } else { - sz = driver_deq(ttysl_port, written); - if (sz < TTY_BUFFSIZE && ttysl_send_ok) { - ErlDrvTermData spec[] = { - ERL_DRV_PORT, driver_mk_port(ttysl_port), - ERL_DRV_ATOM, driver_mk_atom("ok"), - ERL_DRV_TUPLE, 2 - }; - ttysl_send_ok = 0; - erl_drv_output_term(driver_mk_port(ttysl_port), spec, - sizeof(spec) / sizeof(spec[0])); - } - if (sz == 0) { - driver_select(ttysl_port,(ErlDrvEvent)(long)ttysl_fd, - ERL_DRV_WRITE,0); - if (ttysl_terminate) - /* flush has been called, which means we should terminate - when queue is empty. This will not send any exit - message */ - driver_failure_atom(ttysl_port, "normal"); - break; - } - } - } - - return; -} - -static void ttysl_flush_tty(ErlDrvData ttysl_data) { - ttysl_terminate = 1; - return; -} - static void ttysl_from_tty(ErlDrvData ttysl_data, ErlDrvEvent fd) { byte b[1024]; @@ -1206,15 +1070,7 @@ /* The basic procedure for outputting one character. */ static int outc(int c) { - putcbuf->orig_bytes[putcpos++] = c; - if (putcpos == putclen) { - driver_enq_bin(ttysl_port,putcbuf,0,putclen); - driver_free_binary(putcbuf); - putcpos = 0; - putclen = TTY_BUFFSIZE; - putcbuf = driver_alloc_binary(BUFSIZ); - } - return 1; + return (int)putc(c, ttysl_out); } static int move_cursor(int from, int to) @@ -1462,11 +1318,11 @@ exit(1); } - sys_signal(sig, SIG_DFL); /* Set signal handler to default */ + sys_sigset(sig, SIG_DFL); /* Set signal handler to default */ sys_sigrelease(sig); /* Allow 'sig' to come through */ kill(getpid(), sig); /* Send ourselves the signal */ sys_sigblock(sig); /* Reset to old mask */ - sys_signal(sig, suspend); /* Reset signal handler */ + sys_sigset(sig, suspend); /* Reset signal handler */ if (tty_set(ttysl_fd) < 0) { fprintf(stderr,"Can't set tty raw \n"); diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/unix/unix_efile.c erlang-17.3-dfsg/erts/emulator/drivers/unix/unix_efile.c --- erlang-18.2-dfsg/erts/emulator/drivers/unix/unix_efile.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/unix/unix_efile.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -45,10 +44,10 @@ #endif #if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__) -#define __DARWIN__ 1 +#define DARWIN 1 #endif -#if defined(__DARWIN__) || defined(HAVE_LINUX_FALLOC_H) || defined(HAVE_POSIX_FALLOCATE) +#if defined(DARWIN) || defined(HAVE_LINUX_FALLOC_H) || defined(HAVE_POSIX_FALLOCATE) #include #endif @@ -476,11 +475,11 @@ #ifdef NO_FSYNC undefined fsync /* XXX: Really? */ #else -#if defined(__DARWIN__) && defined(F_FULLFSYNC) +#if defined(DARWIN) && defined(F_FULLFSYNC) return check_error(fcntl(fd, F_FULLFSYNC), errInfo); #else return check_error(fsync(fd), errInfo); -#endif /* __DARWIN__ */ +#endif /* DARWIN */ #endif /* NO_FSYNC */ } @@ -962,7 +961,7 @@ retval = len; } } while (len == SENDFILE_CHUNK_SIZE); -#elif defined(__DARWIN__) +#elif defined(DARWIN) int retval; off_t len; do { diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/vxworks/vxworks_resolv.c erlang-17.3-dfsg/erts/emulator/drivers/vxworks/vxworks_resolv.c --- erlang-18.2-dfsg/erts/emulator/drivers/vxworks/vxworks_resolv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/vxworks/vxworks_resolv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/win32/registry_drv.c erlang-17.3-dfsg/erts/emulator/drivers/win32/registry_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/win32/registry_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/win32/registry_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/win32/ttsl_drv.c erlang-17.3-dfsg/erts/emulator/drivers/win32/ttsl_drv.c --- erlang-18.2-dfsg/erts/emulator/drivers/win32/ttsl_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/win32/ttsl_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -47,7 +46,6 @@ #define OP_INSC 2 #define OP_DELC 3 #define OP_BEEP 4 -#define OP_PUTC_SYNC 5 /* Control op */ #define CTRL_OP_GET_WINSIZE 100 @@ -460,7 +458,6 @@ switch (buf[0]) { case OP_PUTC: - case OP_PUTC_SYNC: DEBUGLOG(("OP: Putc(%I64u)",(unsigned long long)count-1)); if (check_buf_size((byte*)buf+1, count-1) == 0) return; @@ -484,20 +481,6 @@ /* Unknown op, just ignore. */ break; } - - if (buf[0] == OP_PUTC_SYNC) { - /* On windows we do a blocking write to the tty so we just - send the ack immidiately. If at some point in the future - someone has a problem with tty output being blocking - this has to be changed. */ - ErlDrvTermData spec[] = { - ERL_DRV_PORT, driver_mk_port(ttysl_port), - ERL_DRV_ATOM, driver_mk_atom("ok"), - ERL_DRV_TUPLE, 2 - }; - erl_drv_output_term(driver_mk_port(ttysl_port), spec, - sizeof(spec) / sizeof(spec[0])); - } return; } diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/win32/win_con.c erlang-17.3-dfsg/erts/emulator/drivers/win32/win_con.c --- erlang-18.2-dfsg/erts/emulator/drivers/win32/win_con.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/win32/win_con.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/win32/win_con.h erlang-17.3-dfsg/erts/emulator/drivers/win32/win_con.h --- erlang-18.2-dfsg/erts/emulator/drivers/win32/win_con.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/win32/win_con.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/drivers/win32/win_efile.c erlang-17.3-dfsg/erts/emulator/drivers/win32/win_efile.c --- erlang-18.2-dfsg/erts/emulator/drivers/win32/win_efile.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/drivers/win32/win_efile.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -1289,10 +1288,6 @@ { HANDLE handle; /* Handle returned by CreateFile() */ BY_HANDLE_FILE_INFORMATION fileInfo; /* from CreateFile() */ - - /* We initialise nNumberOfLinks as GetFileInformationByHandle - does not always initialise this field */ - fileInfo.nNumberOfLinks = 1; if (handle = CreateFileW(name, GENERIC_READ, FILE_SHARE_FLAGS, NULL, OPEN_EXISTING, 0, NULL)) { GetFileInformationByHandle(handle, &fileInfo); diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/elf64ppc.x erlang-17.3-dfsg/erts/emulator/hipe/elf64ppc.x --- erlang-18.2-dfsg/erts/emulator/hipe/elf64ppc.x 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/elf64ppc.x 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_abi.txt erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_abi.txt --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_abi.txt 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_abi.txt 2014-09-16 19:10:57.000000000 +0000 @@ -45,7 +45,7 @@ (if any) is placed in %rdx. Notes: -- Currently, NR_ARG_REGS == 4. +- Currently, NR_ARG_REGS==0. - C BIFs expect P in C parameter register 1: %rdi. By making Erlang parameter registers 1-5 coincide with C parameter registers 2-6, our BIF wrappers can simply move P to %rdi without having to shift diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_asm.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_asm.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_asm.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_asm.m4 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -34,35 +33,7 @@ define(SIMULATE_NSP,0)dnl change to 1 to simulate call/ret insns `#define AMD64_LEAF_WORDS 'LEAF_WORDS -`#define LEAF_WORDS 'LEAF_WORDS -`#define AMD64_NR_ARG_REGS 'NR_ARG_REGS -`#define NR_ARG_REGS 'NR_ARG_REGS - -`#define AMD64_HP_IN_REGISTER 'HP_IN_REGISTER -`#if AMD64_HP_IN_REGISTER' -`#define AMD64_HEAP_POINTER 15' -define(HP,%r15)dnl Only change this together with above -`#endif' - -`#define AMD64_FCALLS_IN_REGISTER 'FCALLS_IN_REGISTER -`#if AMD64_FCALLS_IN_REGISTER' -`#define AMD64_FCALLS_REGISTER 11' -define(FCALLS,%r11)dnl This goes together with line above -`#endif' - -`#define AMD64_HEAP_LIMIT_IN_REGISTER 'HEAP_LIMIT_IN_REGISTER -`#if AMD64_HEAP_LIMIT_IN_REGISTER' -`#define AMD64_HEAP_LIMIT_REGISTER 12' -define(HEAP_LIMIT,%r12)dnl Change this together with line above -`#endif' - -`#define AMD64_SIMULATE_NSP 'SIMULATE_NSP - - -`#ifdef ASM' -/* - * Only assembler stuff from here on (when included from *.S) - */ +`#define LEAF_WORDS 'LEAF_WORDS /* * Workarounds for Darwin. @@ -92,24 +63,33 @@ */ `#define P %rbp' +`#define AMD64_HP_IN_REGISTER 'HP_IN_REGISTER `#if AMD64_HP_IN_REGISTER -#define SAVE_HP movq 'HP`, P_HP(P) +#define AMD64_HEAP_POINTER 15' +define(HP,%r15)dnl Only change this together with above +`#define SAVE_HP movq 'HP`, P_HP(P) #define RESTORE_HP movq P_HP(P), 'HP` #else #define SAVE_HP /*empty*/ #define RESTORE_HP /*empty*/ #endif' +`#define AMD64_FCALLS_IN_REGISTER 'FCALLS_IN_REGISTER `#if AMD64_FCALLS_IN_REGISTER -#define SAVE_FCALLS movq 'FCALLS`, P_FCALLS(P) +#define AMD64_FCALLS_REGISTER 11' +define(FCALLS,%r11)dnl This goes together with line above +`#define SAVE_FCALLS movq 'FCALLS`, P_FCALLS(P) #define RESTORE_FCALLS movq P_FCALLS(P), 'FCALLS` #else #define SAVE_FCALLS /*empty*/ #define RESTORE_FCALLS /*empty*/ #endif' +`#define AMD64_HEAP_LIMIT_IN_REGISTER 'HEAP_LIMIT_IN_REGISTER `#if AMD64_HEAP_LIMIT_IN_REGISTER -#define RESTORE_HEAP_LIMIT movq P_HP_LIMIT(P), 'HEAP_LIMIT` +#define AMD64_HEAP_LIMIT_REGISTER 12' +define(HEAP_LIMIT,%r12)dnl Change this together with line above +`#define RESTORE_HEAP_LIMIT movq P_HP_LIMIT(P), 'HEAP_LIMIT` #else #define RESTORE_HEAP_LIMIT /*empty*/ #endif' @@ -119,6 +99,7 @@ `#define SAVE_CSP movq %rsp, P_CSP(P) #define RESTORE_CSP movq P_CSP(P), %rsp' +`#define AMD64_SIMULATE_NSP 'SIMULATE_NSP /* * Context switching macros. @@ -151,6 +132,8 @@ /* * Argument (parameter) registers. */ +`#define AMD64_NR_ARG_REGS 'NR_ARG_REGS +`#define NR_ARG_REGS 'NR_ARG_REGS define(defarg,`define(ARG$1,`$2')dnl #`define ARG'$1 $2' @@ -254,10 +237,6 @@ `/* #define NBIF_ARG_3_0 'NBIF_ARG(%rsi,3,0)` */' `/* #define NBIF_ARG_3_1 'NBIF_ARG(%rdx,3,1)` */' `/* #define NBIF_ARG_3_2 'NBIF_ARG(%rcx,3,2)` */' -`/* #define NBIF_ARG_4_0 'NBIF_ARG(%rsi,4,0)` */' -`/* #define NBIF_ARG_4_1 'NBIF_ARG(%rdx,4,1)` */' -`/* #define NBIF_ARG_4_2 'NBIF_ARG(%rcx,4,2)` */' -`/* #define NBIF_ARG_4_3 'NBIF_ARG(%r8,4,3)` */' `/* #define NBIF_ARG_5_0 'NBIF_ARG(%rsi,5,0)` */' `/* #define NBIF_ARG_5_1 'NBIF_ARG(%rdx,5,1)` */' `/* #define NBIF_ARG_5_2 'NBIF_ARG(%rcx,5,2)` */' @@ -282,9 +261,6 @@ `/* #define NBIF_RET_1 'NBIF_RET(1)` */' `/* #define NBIF_RET_2 'NBIF_RET(2)` */' `/* #define NBIF_RET_3 'NBIF_RET(3)` */' -`/* #define NBIF_RET_4 'NBIF_RET(4)` */' `/* #define NBIF_RET_5 'NBIF_RET(5)` */' -`#endif /* ASM */' - `#endif /* HIPE_AMD64_ASM_H */' diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_bifs.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_bifs.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_bifs.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_bifs.m4 2014-09-16 19:10:57.000000000 +0000 @@ -4,22 +4,21 @@ * * Copyright Ericsson AB 2004-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -#`define ASM' + include(`hipe/hipe_amd64_asm.m4') #`include' "config.h" #`include' "hipe_literals.h" @@ -40,10 +39,7 @@ jmp 2b') `#if defined(ERTS_ENABLE_LOCK_CHECK) && defined(ERTS_SMP) -# define CALL_BIF(F) \ - movq CSYM(F)@GOTPCREL(%rip), %r11; \ - movq %r11, P_BIF_CALLEE(P); \ - call CSYM(hipe_debug_bif_wrapper) +# define CALL_BIF(F) movq $CSYM(F), P_BIF_CALLEE(P); call CSYM(hipe_debug_bif_wrapper) #else # define CALL_BIF(F) call CSYM(F) #endif' @@ -52,10 +48,9 @@ * standard_bif_interface_1(nbif_name, cbif_name) * standard_bif_interface_2(nbif_name, cbif_name) * standard_bif_interface_3(nbif_name, cbif_name) - * standard_bif_interface_4(nbif_name, cbif_name) * standard_bif_interface_0(nbif_name, cbif_name) * - * Generate native interface for a BIF with 0-4 parameters and + * Generate native interface for a BIF with 0-3 parameters and * standard failure mode. */ define(standard_bif_interface_1, @@ -155,42 +150,6 @@ SET_SIZE(ASYM($1)) TYPE_FUNCTION(ASYM($1)) #endif') - -define(standard_bif_interface_4, -` -#ifndef HAVE_$1 -#`define' HAVE_$1 - TEXT - .align 4 - GLOBAL(ASYM($1)) -ASYM($1): - /* set up the parameters */ - movq P, %rdi - NBIF_ARG(%rsi,4,0) - NBIF_ARG(%rdx,4,1) - NBIF_ARG(%rcx,4,2) - NBIF_ARG(%r8,4,3) - - /* make the call on the C stack */ - SWITCH_ERLANG_TO_C - pushq %r8 - pushq %rcx - pushq %rdx - pushq %rsi - movq %rsp, %rsi /* Eterm* BIF__ARGS */ - CALL_BIF($2) - add $(4*8), %rsp - TEST_GOT_MBUF - SWITCH_C_TO_ERLANG - - /* throw exception if failure, otherwise return */ - TEST_GOT_EXN - jz nbif_4_simple_exception - NBIF_RET(4) - HANDLE_GOT_MBUF(4) - SET_SIZE(ASYM($1)) - TYPE_FUNCTION(ASYM($1)) -#endif') define(standard_bif_interface_0, ` diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -126,7 +125,7 @@ #define MAP_ANONYMOUS MAP_ANON #endif -static int morecore(unsigned int alloc_bytes) +static void morecore(unsigned int alloc_bytes) { unsigned int map_bytes; char *map_hint, *map_start; @@ -175,9 +174,10 @@ abort(); } #endif - if (map_start == MAP_FAILED) - return -1; - + if (map_start == MAP_FAILED) { + perror("mmap"); + abort(); + } ALLOC_CODE_STATS(total_mapped += map_bytes); /* Merge adjacent mappings, so the trailing portion of the previous @@ -197,8 +197,6 @@ } ALLOC_CODE_STATS(atexit_alloc_code_stats()); - - return 0; } static void *alloc_code(unsigned int alloc_bytes) @@ -208,8 +206,8 @@ /* Align function entries. */ alloc_bytes = (alloc_bytes + 3) & ~3; - if (code_bytes < alloc_bytes && morecore(alloc_bytes) != 0) - return NULL; + if (code_bytes < alloc_bytes) + morecore(alloc_bytes); ALLOC_CODE_STATS(++nr_allocs); ALLOC_CODE_STATS(total_alloc += alloc_bytes); res = code_next; @@ -226,18 +224,18 @@ return alloc_code(nrbytes); } -/* Make stub for native code calling exported beam function. -*/ -void *hipe_make_native_stub(void *callee_exp, unsigned int beamArity) +/* called from hipe_bif0.c:hipe_bifs_make_native_stub_2() + and hipe_bif0.c:hipe_make_stub() */ +void *hipe_make_native_stub(void *beamAddress, unsigned int beamArity) { /* * This creates a native code stub with the following contents: * - * movq $Address, P_CALLEE_EXP(%ebp) %% Actually two movl + * movq $Address, P_BEAM_IP(%ebp) %% Actually two movl * movb $Arity, P_ARITY(%ebp) * jmp callemu * - * The stub has variable size, depending on whether the P_CALLEE_EXP + * The stub has variable size, depending on whether the P_BEAM_IP * and P_ARITY offsets fit in 8-bit signed displacements or not. * The rel32 offset in the final jmp depends on its actual location, * which also depends on the size of the previous instructions. @@ -250,51 +248,49 @@ codeSize = /* 23, 26, 29, or 32 bytes */ 23 + /* 23 when all offsets are 8-bit */ - (P_CALLEE_EXP >= 128 ? 3 : 0) + - ((P_CALLEE_EXP + 4) >= 128 ? 3 : 0) + + (P_BEAM_IP >= 128 ? 3 : 0) + + ((P_BEAM_IP + 4) >= 128 ? 3 : 0) + (P_ARITY >= 128 ? 3 : 0); codep = code = alloc_code(codeSize); - if (!code) - return NULL; - /* movl $callee_exp, P_CALLEE_EXP(%ebp); 3 or 6 bytes, plus 4 */ + /* movl $beamAddress, P_BEAM_IP(%ebp); 3 or 6 bytes, plus 4 */ codep[0] = 0xc7; -#if P_CALLEE_EXP >= 128 +#if P_BEAM_IP >= 128 codep[1] = 0x85; /* disp32[EBP] */ - codep[2] = P_CALLEE_EXP & 0xFF; - codep[3] = (P_CALLEE_EXP >> 8) & 0xFF; - codep[4] = (P_CALLEE_EXP >> 16) & 0xFF; - codep[5] = (P_CALLEE_EXP >> 24) & 0xFF; + codep[2] = P_BEAM_IP & 0xFF; + codep[3] = (P_BEAM_IP >> 8) & 0xFF; + codep[4] = (P_BEAM_IP >> 16) & 0xFF; + codep[5] = (P_BEAM_IP >> 24) & 0xFF; codep += 6; #else codep[1] = 0x45; /* disp8[EBP] */ - codep[2] = P_CALLEE_EXP; + codep[2] = P_BEAM_IP; codep += 3; #endif - codep[0] = ((unsigned long)callee_exp ) & 0xFF; - codep[1] = ((unsigned long)callee_exp >> 8) & 0xFF; - codep[2] = ((unsigned long)callee_exp >> 16) & 0xFF; - codep[3] = ((unsigned long)callee_exp >> 24) & 0xFF; + codep[0] = ((unsigned long)beamAddress ) & 0xFF; + codep[1] = ((unsigned long)beamAddress >> 8) & 0xFF; + codep[2] = ((unsigned long)beamAddress >> 16) & 0xFF; + codep[3] = ((unsigned long)beamAddress >> 24) & 0xFF; codep += 4; - /* movl (shl 32 $callee_exp), P_CALLEE_EXP+4(%ebp); 3 or 6 bytes, plus 4 */ + /* movl (shl 32 $beamAddress), P_BEAM_IP+4(%ebp); 3 or 6 bytes, plus 4 */ codep[0] = 0xc7; -#if P_CALLEE_EXP+4 >= 128 +#if P_BEAM_IP+4 >= 128 codep[1] = 0x85; /* disp32[EBP] */ - codep[2] = (P_CALLEE_EXP+4) & 0xFF; - codep[3] = ((P_CALLEE_EXP+4) >> 8) & 0xFF; - codep[4] = ((P_CALLEE_EXP+4) >> 16) & 0xFF; - codep[5] = ((P_CALLEE_EXP+4) >> 24) & 0xFF; + codep[2] = (P_BEAM_IP+4) & 0xFF; + codep[3] = ((P_BEAM_IP+4) >> 8) & 0xFF; + codep[4] = ((P_BEAM_IP+4) >> 16) & 0xFF; + codep[5] = ((P_BEAM_IP+4) >> 24) & 0xFF; codep += 6; #else codep[1] = 0x45; /* disp8[EBP] */ - codep[2] = (P_CALLEE_EXP+4); + codep[2] = (P_BEAM_IP+4); codep += 3; #endif - codep[0] = ((unsigned long)callee_exp >> 32) & 0xFF; - codep[1] = ((unsigned long)callee_exp >> 40) & 0xFF; - codep[2] = ((unsigned long)callee_exp >> 48) & 0xFF; - codep[3] = ((unsigned long)callee_exp >> 56) & 0xFF; + codep[0] = ((unsigned long)beamAddress >> 32) & 0xFF; + codep[1] = ((unsigned long)beamAddress >> 40) & 0xFF; + codep[2] = ((unsigned long)beamAddress >> 48) & 0xFF; + codep[3] = ((unsigned long)beamAddress >> 56) & 0xFF; codep += 4; /* movb $beamArity, P_ARITY(%ebp); 3 or 6 bytes */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_gc.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_gc.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_gc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_gc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_glue.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_glue.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_glue.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_glue.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_glue.S erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_glue.S --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_glue.S 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_glue.S 2014-09-16 19:10:57.000000000 +0000 @@ -3,24 +3,24 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -#define ASM + #include "hipe_amd64_asm.h" #include "hipe_literals.h" +#define ASM #include "hipe_mode_switch.h" /* @@ -109,7 +109,7 @@ * stub (hipe_x86_loader.erl) which should look as follows: * * stub for f/N: - * movq $, P_CALLEE_EXP(P) + * movq $, P_BEAM_IP(P) * movb $, P_ARITY(P) * jmp nbif_callemu * @@ -119,7 +119,7 @@ GLOBAL(ASYM(nbif_callemu)) ASYM(nbif_callemu): STORE_ARG_REGS - movl $HIPE_MODE_SWITCH_RES_CALL_EXPORTED, %eax + movl $HIPE_MODE_SWITCH_RES_CALL, %eax jmp .suspend_exit /* @@ -322,7 +322,6 @@ GLOBAL(nbif_1_gc_after_bif) GLOBAL(nbif_2_gc_after_bif) GLOBAL(nbif_3_gc_after_bif) - GLOBAL(nbif_4_gc_after_bif) .align 4 nbif_0_gc_after_bif: xorl %edx, %edx @@ -338,10 +337,6 @@ .align 4 nbif_3_gc_after_bif: movl $3, %edx - jmp .gc_after_bif - .align 4 -nbif_4_gc_after_bif: - movl $4, %edx /*FALLTHROUGH*/ .align 4 .gc_after_bif: @@ -365,7 +360,6 @@ GLOBAL(nbif_1_simple_exception) GLOBAL(nbif_2_simple_exception) GLOBAL(nbif_3_simple_exception) - GLOBAL(nbif_4_simple_exception) .align 4 nbif_0_simple_exception: xorl %eax, %eax @@ -381,10 +375,6 @@ .align 4 nbif_3_simple_exception: movl $3, %eax - jmp .nbif_simple_exception - .align 4 -nbif_4_simple_exception: - movl $4, %eax /*FALLTHROUGH*/ .align 4 .nbif_simple_exception: diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_primops.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_primops.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64_primops.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64_primops.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_amd64.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_amd64.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_arch.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_arch.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_arch.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_arch.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -30,7 +29,6 @@ extern int hipe_patch_insn(void *address, Uint value, Eterm type); extern int hipe_patch_call(void *callAddress, void *destAddress, void *trampoline); -extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); extern void *hipe_make_native_stub(void *beamAddress, unsigned int beamArity); #if defined(__sparc__) diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_asm.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_asm.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_asm.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_asm.m4 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -30,14 +29,6 @@ define(NR_ARG_REGS,3)dnl admissible values are 0 to 6, inclusive `#define ARM_LEAF_WORDS 'LEAF_WORDS -`#define ARM_NR_ARG_REGS 'NR_ARG_REGS -`#define NR_ARG_REGS 'NR_ARG_REGS - - -`#ifdef ASM' -/* - * Only assembler stuff from here on (when included from *.S) - */ /* * Reserved registers. @@ -86,6 +77,8 @@ /* * Argument (parameter) registers. */ +`#define ARM_NR_ARG_REGS 'NR_ARG_REGS +`#define NR_ARG_REGS 'NR_ARG_REGS define(defarg,`define(ARG$1,`$2')dnl #`define ARG'$1 $2' @@ -164,10 +157,6 @@ `/* #define NBIF_ARG_3_0 'NBIF_ARG(r1,3,0)` */' `/* #define NBIF_ARG_3_1 'NBIF_ARG(r2,3,1)` */' `/* #define NBIF_ARG_3_2 'NBIF_ARG(r3,3,2)` */' -`/* #define NBIF_ARG_4_0 'NBIF_ARG(r1,4,0)` */' -`/* #define NBIF_ARG_4_1 'NBIF_ARG(r2,4,1)` */' -`/* #define NBIF_ARG_4_2 'NBIF_ARG(r3,4,2)` */' -`/* #define NBIF_ARG_4_3 'NBIF_ARG(r4,4,3)` */' `/* #define NBIF_ARG_5_0 'NBIF_ARG(r1,5,0)` */' `/* #define NBIF_ARG_5_1 'NBIF_ARG(r2,5,1)` */' `/* #define NBIF_ARG_5_2 'NBIF_ARG(r3,5,2)` */' @@ -191,7 +180,6 @@ `/* #define NBIF_RET_1 'NBIF_RET(1)` */' `/* #define NBIF_RET_2 'NBIF_RET(2)` */' `/* #define NBIF_RET_3 'NBIF_RET(3)` */' -`/* #define NBIF_RET_4 'NBIF_RET(4)` */' `/* #define NBIF_RET_5 'NBIF_RET(5)` */' dnl @@ -207,6 +195,4 @@ `/* #define QUICK_CALL_RET_F_3 'QUICK_CALL_RET(F,3)` */' `/* #define QUICK_CALL_RET_F_5 'QUICK_CALL_RET(F,5)` */' -`#endif /* ASM */' - `#endif /* HIPE_ARM_ASM_H */' diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_bifs.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_bifs.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_bifs.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_bifs.m4 2014-09-16 19:10:57.000000000 +0000 @@ -4,30 +4,27 @@ * * Copyright Ericsson AB 2005-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -#`define ASM' include(`hipe/hipe_arm_asm.m4') #`include' "config.h" #`include' "hipe_literals.h" .text .p2align 2 - .arm `#if defined(ERTS_ENABLE_LOCK_CHECK) && defined(ERTS_SMP) # define CALL_BIF(F) ldr r14, =F; str r14, [r0, #P_BIF_CALLEE]; bl hipe_debug_bif_wrapper @@ -43,10 +40,9 @@ * standard_bif_interface_1(nbif_name, cbif_name) * standard_bif_interface_2(nbif_name, cbif_name) * standard_bif_interface_3(nbif_name, cbif_name) - * standard_bif_interface_4(nbif_name, cbif_name) * standard_bif_interface_0(nbif_name, cbif_name) * - * Generate native interface for a BIF with 0-4 parameters and + * Generate native interface for a BIF with 1-3 parameters and * standard failure mode. */ define(standard_bif_interface_1, @@ -136,39 +132,6 @@ .type $1, %function #endif') -define(standard_bif_interface_4, -` -#ifndef HAVE_$1 -#`define' HAVE_$1 - .global $1 -$1: - /* Set up C argument registers. */ - mov r0, P - NBIF_ARG(r1,4,0) - NBIF_ARG(r2,4,1) - NBIF_ARG(r3,4,2) - NBIF_ARG(r4,4,3) - - /* Save caller-save registers and call the C function. */ - SAVE_CONTEXT_BIF - str r1, [r0, #P_ARG0] /* Store BIF__ARGS in def_arg_reg[] */ - str r2, [r0, #P_ARG1] - str r3, [r0, #P_ARG2] - str r4, [r0, #P_ARG3] - add r1, r0, #P_ARG0 - CALL_BIF($2) - TEST_GOT_MBUF(4) - - /* Restore registers. Check for exception. */ - cmp r0, #THE_NON_VALUE - RESTORE_CONTEXT_BIF - beq nbif_4_simple_exception - NBIF_RET(4) - .ltorg - .size $1, .-$1 - .type $1, %function -#endif') - define(standard_bif_interface_0, ` #ifndef HAVE_$1 @@ -428,14 +391,7 @@ mov r0, P /* Perform a quick save;call;restore;ret sequence. */ -#ifdef __thumb__ - SAVE_CONTEXT_QUICK - bl $2 - RESTORE_CONTEXT_QUICK - NBIF_RET(0) -#else QUICK_CALL_RET($2,0) -#endif .size $1, .-$1 .type $1, %function #endif') @@ -451,14 +407,7 @@ NBIF_ARG(r1,1,0) /* Perform a quick save;call;restore;ret sequence. */ -#ifdef __thumb__ - SAVE_CONTEXT_QUICK - bl $2 - RESTORE_CONTEXT_QUICK - NBIF_RET(1) -#else QUICK_CALL_RET($2,1) -#endif .size $1, .-$1 .type $1, %function #endif') @@ -475,14 +424,7 @@ NBIF_ARG(r2,2,1) /* Perform a quick save;call;restore;ret sequence. */ -#ifdef __thumb__ - SAVE_CONTEXT_QUICK - bl $2 - RESTORE_CONTEXT_QUICK - NBIF_RET(2) -#else QUICK_CALL_RET($2,2) -#endif .size $1, .-$1 .type $1, %function #endif') @@ -500,14 +442,7 @@ NBIF_ARG(r3,3,2) /* Perform a quick save;call;restore;ret sequence. */ -#ifdef __thumb__ - SAVE_CONTEXT_QUICK - bl $2 - RESTORE_CONTEXT_QUICK - NBIF_RET(3) -#else QUICK_CALL_RET($2,3) -#endif .size $1, .-$1 .type $1, %function #endif') @@ -531,14 +466,7 @@ NBIF_ARG(r3,5,2) /* Perform a quick save;call;restore;ret sequence. */ -#ifdef __thumb__ - SAVE_CONTEXT_QUICK - bl $2 - RESTORE_CONTEXT_QUICK - NBIF_RET(5) -#else QUICK_CALL_RET($2,5) -#endif .size $1, .-$1 .type $1, %function #endif') @@ -560,16 +488,9 @@ #`define' HAVE_$1 .global $1 $1: - /* Perform a quick save;call;restore;ret sequence. */ -#ifdef __thumb__ - SAVE_CONTEXT_QUICK - bl $2 - RESTORE_CONTEXT_QUICK - NBIF_RET(0) -#else /* XXX: this case is always trivial; how to suppress the branch? */ + /* Perform a quick save;call;restore;ret sequence. */ QUICK_CALL_RET($2,0) -#endif .size $1, .-$1 .type $1, %function #endif') @@ -584,14 +505,7 @@ NBIF_ARG(r0,1,0) /* Perform a quick save;call;restore;ret sequence. */ -#ifdef __thumb__ - SAVE_CONTEXT_QUICK - bl $2 - RESTORE_CONTEXT_QUICK - NBIF_RET(1) -#else QUICK_CALL_RET($2,1) -#endif .size $1, .-$1 .type $1, %function #endif') @@ -607,14 +521,7 @@ NBIF_ARG(r1,2,1) /* Perform a quick save;call;restore;ret sequence. */ -#ifdef __thumb__ - SAVE_CONTEXT_QUICK - bl $2 - RESTORE_CONTEXT_QUICK - NBIF_RET(2) -#else QUICK_CALL_RET($2,2) -#endif .size $1, .-$1 .type $1, %function #endif') @@ -631,14 +538,7 @@ NBIF_ARG(r2,3,2) /* Perform a quick save;call;restore;ret sequence. */ -#ifdef __thumb__ - SAVE_CONTEXT_QUICK - bl $2 - RESTORE_CONTEXT_QUICK - NBIF_RET(3) -#else QUICK_CALL_RET($2,3) -#endif .size $1, .-$1 .type $1, %function #endif') @@ -658,14 +558,7 @@ str r4, [sp, #0] /* Perform a quick save;call;restore;ret sequence. */ -#ifdef __thumb__ - SAVE_CONTEXT_QUICK - bl $2 - RESTORE_CONTEXT_QUICK - NBIF_RET(5) -#else QUICK_CALL_RET($2,5) -#endif .size $1, .-$1 .type $1, %function #endif') diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -261,9 +260,9 @@ return 0; } -/* Make stub for native code calling exported beam function -*/ -void *hipe_make_native_stub(void *callee_exp, unsigned int beamArity) +/* called from hipe_bif0.c:hipe_bifs_make_native_stub_2() + and hipe_bif0.c:hipe_make_stub() */ +void *hipe_make_native_stub(void *beamAddress, unsigned int beamArity) { unsigned int *code; unsigned int *tramp_callemu; @@ -273,9 +272,9 @@ * Native code calls BEAM via a stub looking as follows: * * mov r0, #beamArity - * ldr r8, [pc,#0] // callee_exp + * ldr r8, [pc,#0] // beamAddress * b nbif_callemu - * .long callee_exp + * .long beamAddress * * I'm using r0 and r8 since they aren't used for * parameter passing in native code. The branch to @@ -284,8 +283,6 @@ */ code = alloc_stub(4, &tramp_callemu); - if (!code) - return NULL; callemu_offset = ((int)&nbif_callemu - ((int)&code[2] + 8)) >> 2; if (!(callemu_offset >= -0x00800000 && callemu_offset <= 0x007FFFFF)) { callemu_offset = ((int)tramp_callemu - ((int)&code[2] + 8)) >> 2; @@ -295,12 +292,12 @@ /* mov r0, #beamArity */ code[0] = 0xE3A00000 | (beamArity & 0xFF); - /* ldr r8, [pc,#0] // callee_exp */ + /* ldr r8, [pc,#0] // beamAddress */ code[1] = 0xE59F8000; /* b nbif_callemu */ code[2] = 0xEA000000 | (callemu_offset & 0x00FFFFFF); - /* .long callee_exp */ - code[3] = (unsigned int)callee_exp; + /* .long beamAddress */ + code[3] = (unsigned int)beamAddress; hipe_flush_icache_range(code, 4*sizeof(int)); diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_gc.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_gc.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_gc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_gc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_glue.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_glue.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_glue.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_glue.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_glue.S erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_glue.S --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_glue.S 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_glue.S 2014-09-16 19:10:57.000000000 +0000 @@ -3,29 +3,28 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -#define ASM + #include "hipe_arm_asm.h" #include "hipe_literals.h" +#define ASM #include "hipe_mode_switch.h" .text .p2align 2 - .arm /* * Enter Erlang from C. @@ -71,7 +70,6 @@ * Emulated code recursively calls native code. */ .global hipe_arm_call_to_native - .type hipe_arm_call_to_native, %function hipe_arm_call_to_native: ENTER_FROM_C /* get argument registers */ @@ -87,7 +85,6 @@ * This is where native code returns to emulated code. */ .global nbif_return - .type nbif_return, %function nbif_return: str r0, [P, #P_ARG0] /* save retval */ mov r0, #HIPE_MODE_SWITCH_RES_RETURN @@ -98,7 +95,6 @@ * Emulated code returns to its native code caller. */ .global hipe_arm_return_to_native - .type hipe_arm_return_to_native, %function hipe_arm_return_to_native: ENTER_FROM_C /* get return value */ @@ -115,7 +111,6 @@ * Emulated code tailcalls native code. */ .global hipe_arm_tailcall_to_native - .type hipe_arm_tailcall_to_native, %function hipe_arm_tailcall_to_native: ENTER_FROM_C /* get argument registers */ @@ -130,7 +125,6 @@ * Emulated code throws an exception to its native code caller. */ .global hipe_arm_throw_to_native - .type hipe_arm_throw_to_native, %function hipe_arm_throw_to_native: ENTER_FROM_C /* invoke the handler */ @@ -141,26 +135,24 @@ * which should look as follows: * * stub for f/N: - * + * * * b nbif_callemu * * XXX: Different stubs for different number of register parameters? */ .global nbif_callemu - .type nbif_callemu, %function nbif_callemu: - str r8, [P, #P_CALLEE_EXP] + str r8, [P, #P_BEAM_IP] str r0, [P, #P_ARITY] STORE_ARG_REGS - mov r0, #HIPE_MODE_SWITCH_RES_CALL_EXPORTED + mov r0, #HIPE_MODE_SWITCH_RES_CALL b .suspend_exit /* * nbif_apply */ .global nbif_apply - .type nbif_apply, %function nbif_apply: STORE_ARG_REGS mov r0, #HIPE_MODE_SWITCH_RES_APPLY @@ -177,7 +169,6 @@ */ #if NR_ARG_REGS >= 6 .global nbif_ccallemu6 - .type nbif_ccallemu6, %function nbif_ccallemu6: str ARG5, [P, #P_ARG5] #if NR_ARG_REGS > 6 @@ -190,7 +181,6 @@ #if NR_ARG_REGS >= 5 .global nbif_ccallemu5 - .type nbif_ccallemu5, %function nbif_ccallemu5: str ARG4, [P, #P_ARG4] #if NR_ARG_REGS > 5 @@ -203,7 +193,6 @@ #if NR_ARG_REGS >= 4 .global nbif_ccallemu4 - .type nbif_ccallemu4, %function nbif_ccallemu4: str ARG3, [P, #P_ARG3] #if NR_ARG_REGS > 4 @@ -216,7 +205,6 @@ #if NR_ARG_REGS >= 3 .global nbif_ccallemu3 - .type nbif_ccallemu3, %function nbif_ccallemu3: str ARG2, [P, #P_ARG2] #if NR_ARG_REGS > 3 @@ -229,7 +217,6 @@ #if NR_ARG_REGS >= 2 .global nbif_ccallemu2 - .type nbif_ccallemu2, %function nbif_ccallemu2: str ARG1, [P, #P_ARG1] #if NR_ARG_REGS > 2 @@ -242,7 +229,6 @@ #if NR_ARG_REGS >= 1 .global nbif_ccallemu1 - .type nbif_ccallemu1, %function nbif_ccallemu1: str ARG0, [P, #P_ARG0] #if NR_ARG_REGS > 1 @@ -254,7 +240,6 @@ #endif .global nbif_ccallemu0 - .type nbif_ccallemu0, %function nbif_ccallemu0: /* We use r1 not ARG0 here because ARG0 is not defined when NR_ARG_REGS == 0. */ @@ -269,7 +254,6 @@ * This is where native code suspends. */ .global nbif_suspend_0 - .type nbif_suspend_0, %function nbif_suspend_0: mov r0, #HIPE_MODE_SWITCH_RES_SUSPEND b .suspend_exit @@ -278,7 +262,6 @@ * Suspend from a receive (waiting for a message) */ .global nbif_suspend_msg - .type nbif_suspend_msg, %function nbif_suspend_msg: mov r0, #HIPE_MODE_SWITCH_RES_WAIT b .suspend_exit @@ -289,7 +272,6 @@ * else { return 0; } */ .global nbif_suspend_msg_timeout - .type nbif_suspend_msg_timeout, %function nbif_suspend_msg_timeout: ldr r1, [P, #P_FLAGS] mov r0, #HIPE_MODE_SWITCH_RES_WAIT_TIMEOUT @@ -304,39 +286,25 @@ * This is the default exception handler for native code. */ .global nbif_fail - .type nbif_fail, %function nbif_fail: mov r0, #HIPE_MODE_SWITCH_RES_THROW b .flush_exit /* no need to save RA */ .global nbif_0_gc_after_bif - .type nbif_0_gc_after_bif, %function + .global nbif_1_gc_after_bif + .global nbif_2_gc_after_bif + .global nbif_3_gc_after_bif nbif_0_gc_after_bif: mov r1, #0 b .gc_after_bif - - .global nbif_1_gc_after_bif - .type nbif_1_gc_after_bif, %function nbif_1_gc_after_bif: mov r1, #1 b .gc_after_bif - - .global nbif_2_gc_after_bif - .type nbif_2_gc_after_bif, %function nbif_2_gc_after_bif: mov r1, #2 b .gc_after_bif - - .global nbif_3_gc_after_bif - .type nbif_3_gc_after_bif, %function nbif_3_gc_after_bif: mov r1, #3 - b .gc_after_bif - - .global nbif_4_gc_after_bif - .type nbif_4_gc_after_bif, %function -nbif_4_gc_after_bif: - mov r1, #4 /*FALLTHROUGH*/ .gc_after_bif: str r1, [P, #P_NARITY] @@ -362,33 +330,20 @@ * TEMP_LR contains a copy of LR */ .global nbif_0_simple_exception - .type nbif_0_simple_exception, %function nbif_0_simple_exception: mov r1, #0 b .nbif_simple_exception - .global nbif_1_simple_exception - .type nbif_1_simple_exception, %function nbif_1_simple_exception: mov r1, #1 b .nbif_simple_exception - .global nbif_2_simple_exception - .type nbif_2_simple_exception, %function nbif_2_simple_exception: mov r1, #2 b .nbif_simple_exception - .global nbif_3_simple_exception - .type nbif_3_simple_exception, %function nbif_3_simple_exception: mov r1, #3 - b .nbif_simple_exception - - .global nbif_4_simple_exception - .type nbif_4_simple_exception, %function -nbif_4_simple_exception: - mov r1, #4 /*FALLTHROUGH*/ .nbif_simple_exception: ldr r0, [P, #P_FREASON] @@ -430,7 +385,6 @@ * the gray/white stack boundary */ .global nbif_stack_trap_ra - .type nbif_stack_trap_ra, %function nbif_stack_trap_ra: /* a return address, not a function */ # This only handles a single return value. # If we have more, we need to save them in the PCB. @@ -447,7 +401,6 @@ * Caller saved its LR in TEMP_LR (== TEMP1) before calling us. */ .global hipe_arm_inc_stack - .type hipe_arm_inc_stack, %function hipe_arm_inc_stack: STORE_ARG_REGS mov TEMP_ARG0, lr diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -41,4 +40,8 @@ extern void hipe_arm_inc_stack(void); +/* for hipe_bifs_enter_code_2 */ +extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); +#define HIPE_ALLOC_CODE(n,c,t,p) hipe_alloc_code((n),(c),(t),(p)) + #endif /* HIPE_ARM_H */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_primops.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_primops.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm_primops.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm_primops.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_arm.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_arm.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2005-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif0.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif0.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif0.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif0.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -90,6 +89,25 @@ /* * BIFs for reading and writing memory. Used internally by HiPE. */ +#if 0 /* XXX: unused */ +BIF_RETTYPE hipe_bifs_read_u8_1(BIF_ALIST_1) +{ + unsigned char *address = term_to_address(BIF_ARG_1); + if (!address) + BIF_ERROR(BIF_P, BADARG); + BIF_RET(make_small(*address)); +} +#endif + +#if 0 /* XXX: unused */ +BIF_RETTYPE hipe_bifs_read_u32_1(BIF_ALIST_1) +{ + Uint32 *address = term_to_address(BIF_ARG_1); + if (!address || !hipe_word32_address_ok(address)) + BIF_ERROR(BIF_P, BADARG); + BIF_RET(Uint_to_term(*address, BIF_P)); +} +#endif BIF_RETTYPE hipe_bifs_write_u8_2(BIF_ALIST_2) { @@ -102,6 +120,22 @@ BIF_RET(NIL); } +#if 0 /* XXX: unused */ +BIF_RETTYPE hipe_bifs_write_s32_2(BIF_ALIST_2) +{ + Sint32 *address; + Sint value; + + address = term_to_address(BIF_ARG_1); + if (!address || !hipe_word32_address_ok(address)) + BIF_ERROR(BIF_P, BADARG); + if (!term_to_Sint32(BIF_ARG_2, &value)) + BIF_ERROR(BIF_P, BADARG); + *address = value; + BIF_RET(NIL); +} +#endif + BIF_RETTYPE hipe_bifs_write_u32_2(BIF_ALIST_2) { Uint32 *address; @@ -398,17 +432,15 @@ ASSERT(bitoffs == 0); ASSERT(bitsize == 0); trampolines = NIL; - address = hipe_alloc_code(nrbytes, BIF_ARG_2, &trampolines, BIF_P); - if (!address) { - Uint nrcallees; - - if (is_tuple(BIF_ARG_2)) - nrcallees = arityval(tuple_val(BIF_ARG_2)[0]); - else - nrcallees = 0; - erl_exit(1, "%s: failed to allocate %lu bytes and %lu trampolines\r\n", - __func__, (unsigned long)nrbytes, (unsigned long)nrcallees); - } +#ifdef HIPE_ALLOC_CODE + address = HIPE_ALLOC_CODE(nrbytes, BIF_ARG_2, &trampolines, BIF_P); + if (!address) + BIF_ERROR(BIF_P, BADARG); +#else + if (is_not_nil(BIF_ARG_2)) + BIF_ERROR(BIF_P, BADARG); + address = erts_alloc(ERTS_ALC_T_HIPE, nrbytes); +#endif memcpy(address, bytes, nrbytes); hipe_flush_icache_range(address, nrbytes); hp = HAlloc(BIF_P, 3); @@ -607,6 +639,33 @@ BIF_RET(address_to_term(pc, BIF_P)); } +static void *hipe_get_emu_address(Eterm m, Eterm f, unsigned int arity, int is_remote) +{ + void *address = NULL; + if (!is_remote) + address = hipe_find_emu_address(m, f, arity); + if (!address) { + /* if not found, stub it via the export entry */ + /* no lock needed around erts_export_get_or_make_stub() */ + Export *export_entry = erts_export_get_or_make_stub(m, f, arity); + address = export_entry->addressv[erts_active_code_ix()]; + } + return address; +} + +#if 0 /* XXX: unused */ +BIF_RETTYPE hipe_bifs_get_emu_address_1(BIF_ALIST_1) +{ + struct mfa mfa; + void *address; + + if (!term_to_mfa(BIF_ARG_1, &mfa)) + BIF_ERROR(BIF_P, BADARG); + address = hipe_get_emu_address(mfa.mod, mfa.fun, mfa.ari); + BIF_RET(address_to_term(address, BIF_P)); +} +#endif + BIF_RETTYPE hipe_bifs_set_native_address_3(BIF_ALIST_3) { Eterm *pc; @@ -654,6 +713,33 @@ BIF_RET(am_false); } +#if 0 /* XXX: unused */ +/* + * hipe_bifs_address_to_fun(Address) + * - Address is the address of the start of a emu function's code + * - returns {Module, Function, Arity} + */ +BIF_RETTYPE hipe_bifs_address_to_fun_1(BIF_ALIST_1) +{ + Eterm *pc; + Eterm *funcinfo; + Eterm *hp; + + pc = term_to_address(BIF_ARG_1); + if (!pc) + BIF_ERROR(BIF_P, BADARG); + funcinfo = find_function_from_pc(pc); + if (!funcinfo) + BIF_RET(am_false); + hp = HAlloc(BIF_P, 4); + hp[0] = make_arityval(3); + hp[1] = funcinfo[0]; + hp[2] = funcinfo[1]; + hp[3] = make_small(funcinfo[2]); + BIF_RET(make_tuple(hp)); +} +#endif + BIF_RETTYPE hipe_bifs_enter_sdesc_1(BIF_ALIST_1) { struct sdesc *sdesc; @@ -862,6 +948,37 @@ BIF_RET(address_to_term(primop->address, BIF_P)); } +#if 0 /* XXX: unused */ +/* + * hipe_bifs_gbif_address(F,A) -> address or false + */ +#define GBIF_LIST(ATOM,ARY,CFUN) extern Eterm gbif_##CFUN(void); +#include "hipe_gbif_list.h" +#undef GBIF_LIST + +BIF_RETTYPE hipe_bifs_gbif_address_2(BIF_ALIST_2) +{ + Uint arity; + void *address; + + if (is_not_atom(BIF_ARG_1) || is_not_small(BIF_ARG_2)) + BIF_RET(am_false); /* error or false, does it matter? */ + arity = signed_val(BIF_ARG_2); + /* XXX: replace with a hash table later */ + do { /* trick to let us use 'break' instead of 'goto' */ +#define GBIF_LIST(ATOM,ARY,CFUN) if (BIF_ARG_1 == ATOM && arity == ARY) { address = CFUN; break; } +#include "hipe_gbif_list.h" +#undef GBIF_LIST + printf("\r\n%s: guard BIF ", __FUNCTION__); + fflush(stdout); + erts_printf("%T", BIF_ARG_1); + printf("/%lu isn't listed in hipe_gbif_list.h\r\n", arity); + BIF_RET(am_false); + } while (0); + BIF_RET(address_to_term(address, BIF_P)); +} +#endif + BIF_RETTYPE hipe_bifs_atom_to_word_1(BIF_ALIST_1) { if (is_not_atom(BIF_ARG_1)) @@ -905,19 +1022,83 @@ */ void hipe_emulate_fpe(Process* p) { - if (!isfinite(p->hipe.float_result)) { + if (!finite(p->hipe.float_result)) { p->fp_exception = 1; } } #endif -void hipe_emasculate_binary(Eterm bin) +#if 0 /* XXX: unused */ +/* + * At least parts of this should be inlined in native code. + * The rest could be made a primop used by both the emulator and + * native code... + */ +BIF_RETTYPE hipe_bifs_make_fun_3(BIF_ALIST_3) { - ProcBin* pb = (ProcBin *) boxed_val(bin); - ASSERT(pb->thing_word == HEADER_PROC_BIN); - ASSERT(pb->flags != 0); - erts_emasculate_writable_binary(pb); + Eterm free_vars; + Eterm mod; + Eterm *tp; + Uint index; + Uint uniq; + Uint num_free; + Eterm tmp_var; + Uint *tmp_ptr; + unsigned needed; + ErlFunThing *funp; + Eterm *hp; + int i; + + if (is_not_list(BIF_ARG_1) && is_not_nil(BIF_ARG_1)) + BIF_ERROR(BIF_P, BADARG); + free_vars = BIF_ARG_1; + + if (is_not_atom(BIF_ARG_2)) + BIF_ERROR(BIF_P, BADARG); + mod = BIF_ARG_2; + + if (is_not_tuple(BIF_ARG_3) || + (arityval(*tuple_val(BIF_ARG_3)) != 3)) + BIF_ERROR(BIF_P, BADARG); + tp = tuple_val(BIF_ARG_3); + + if (term_to_Uint(tp[1], &index) == 0) + BIF_ERROR(BIF_P, BADARG); + if (term_to_Uint(tp[2], &uniq) == 0) + BIF_ERROR(BIF_P, BADARG); + if (term_to_Uint(tp[3], &num_free) == 0) + BIF_ERROR(BIF_P, BADARG); + + needed = ERL_FUN_SIZE + num_free; + funp = (ErlFunThing *) HAlloc(BIF_P, needed); + hp = funp->env; + + funp->thing_word = HEADER_FUN; + + /* Need a ErlFunEntry *fe + * fe->refc++; + * funp->fe = fe; + */ + + funp->num_free = num_free; + funp->creator = BIF_P->id; + for (i = 0; i < num_free; i++) { + if (is_nil(free_vars)) + BIF_ERROR(BIF_P, BADARG); + tmp_ptr = list_val(free_vars); + tmp_var = CAR(tmp_ptr); + free_vars = CDR(tmp_ptr); + *hp++ = tmp_var; + } + if (is_not_nil(free_vars)) + BIF_ERROR(BIF_P, BADARG); + + funp->next = MSO(BIF_P).funs; + MSO(BIF_P).funs = funp; + + BIF_RET(make_fun(funp)); } +#endif /* * args: Module, {Uniq, Index, BeamAddress} @@ -982,6 +1163,22 @@ BIF_RET(am_true); } +#if 0 /* XXX: unused */ +BIF_RETTYPE hipe_bifs_make_native_stub_2(BIF_ALIST_2) +{ + void *beamAddress; + Uint beamArity; + void *stubAddress; + + if ((beamAddress = term_to_address(BIF_ARG_1)) == 0 || + is_not_small(BIF_ARG_2) || + (beamArity = unsigned_val(BIF_ARG_2)) >= 256) + BIF_ERROR(BIF_P, BADARG); + stubAddress = hipe_make_native_stub(beamAddress, beamArity); + BIF_RET(address_to_term(stubAddress, BIF_P)); +} +#endif + /* * MFA info hash table: * - maps MFA to native code entry point @@ -1020,32 +1217,22 @@ * they create a new stub for the mfa, which forces locking. * XXX: Redesign apply et al to avoid those updates. */ - erts_smp_rwmtx_t lock; + erts_smp_mtx_t lock; } hipe_mfa_info_table; static inline void hipe_mfa_info_table_init_lock(void) { - erts_smp_rwmtx_init(&hipe_mfa_info_table.lock, "hipe_mfait_lock"); -} - -static inline void hipe_mfa_info_table_rlock(void) -{ - erts_smp_rwmtx_rlock(&hipe_mfa_info_table.lock); + erts_smp_mtx_init(&hipe_mfa_info_table.lock, "hipe_mfait_lock"); } -static inline void hipe_mfa_info_table_runlock(void) +static inline void hipe_mfa_info_table_lock(void) { - erts_smp_rwmtx_runlock(&hipe_mfa_info_table.lock); + erts_smp_mtx_lock(&hipe_mfa_info_table.lock); } -static inline void hipe_mfa_info_table_rwlock(void) +static inline void hipe_mfa_info_table_unlock(void) { - erts_smp_rwmtx_rwlock(&hipe_mfa_info_table.lock); -} - -static inline void hipe_mfa_info_table_rwunlock(void) -{ - erts_smp_rwmtx_rwunlock(&hipe_mfa_info_table.lock); + erts_smp_mtx_unlock(&hipe_mfa_info_table.lock); } #define HIPE_MFA_HASH(M,F,A) ((M) * (F) + (A)) @@ -1146,7 +1333,7 @@ } #endif -static struct hipe_mfa_info *hipe_mfa_info_table_put_rwlocked(Eterm m, Eterm f, unsigned int arity) +static struct hipe_mfa_info *hipe_mfa_info_table_put_locked(Eterm m, Eterm f, unsigned int arity) { unsigned long h; unsigned int i; @@ -1175,8 +1362,8 @@ { struct hipe_mfa_info *p; - hipe_mfa_info_table_rwlock(); - p = hipe_mfa_info_table_put_rwlocked(m, f, arity); + hipe_mfa_info_table_lock(); + p = hipe_mfa_info_table_put_locked(m, f, arity); #ifdef DEBUG_LINKER printf("%s: ", __FUNCTION__); print_mfa(m, f, arity); @@ -1185,7 +1372,7 @@ p->local_address = address; if (is_exported) p->remote_address = address; - hipe_mfa_info_table_rwunlock(); + hipe_mfa_info_table_unlock(); } #if defined(__powerpc__) || defined(__ppc__) || defined(__powerpc64__) || defined(__arm__) @@ -1194,10 +1381,10 @@ struct hipe_mfa_info *p; void *trampoline; - hipe_mfa_info_table_rlock(); - p = hipe_mfa_info_table_get_locked(m, f, arity); - trampoline = p ? p->trampoline : NULL; - hipe_mfa_info_table_runlock(); + hipe_mfa_info_table_lock(); + p = hipe_mfa_info_table_put_locked(m, f, arity); + trampoline = p->trampoline; + hipe_mfa_info_table_unlock(); return trampoline; } @@ -1205,10 +1392,10 @@ { struct hipe_mfa_info *p; - hipe_mfa_info_table_rwlock(); - p = hipe_mfa_info_table_put_rwlocked(m, f, arity); + hipe_mfa_info_table_lock(); + p = hipe_mfa_info_table_put_locked(m, f, arity); p->trampoline = trampoline; - hipe_mfa_info_table_rwunlock(); + hipe_mfa_info_table_unlock(); } #endif @@ -1239,7 +1426,7 @@ struct mfa mfa; struct hipe_mfa_info *p; - hipe_mfa_info_table_rwlock(); + hipe_mfa_info_table_lock(); lst = BIF_ARG_1; while (is_list(lst)) { if (!term_to_mfa(CAR(list_val(lst)), &mfa)) @@ -1268,7 +1455,7 @@ } } } - hipe_mfa_info_table_rwunlock(); + hipe_mfa_info_table_unlock(); if (is_not_nil(lst)) BIF_ERROR(BIF_P, BADARG); BIF_RET(NIL); @@ -1282,8 +1469,8 @@ orig_beam_op = pc[0]; if (orig_beam_op != BeamOpCode(op_hipe_trap_call_closure) && orig_beam_op != BeamOpCode(op_hipe_trap_call)) { - hipe_mfa_info_table_rwlock(); - p = hipe_mfa_info_table_put_rwlocked(mod, fun, ari); + hipe_mfa_info_table_lock(); + p = hipe_mfa_info_table_put_locked(mod, fun, ari); #ifdef DEBUG_LINKER printf("%s: ", __FUNCTION__); print_mfa(mod, fun, ari); @@ -1291,7 +1478,7 @@ #endif p->beam_code = pc; p->orig_beam_op = orig_beam_op; - hipe_mfa_info_table_rwunlock(); + hipe_mfa_info_table_unlock(); } else { #ifdef DEBUG_LINKER printf("%s: ", __FUNCTION__); @@ -1303,19 +1490,22 @@ static void *hipe_make_stub(Eterm m, Eterm f, unsigned int arity, int is_remote) { - Export *export_entry; + void *BEAMAddress; void *StubAddress; - ASSERT(is_remote); - - export_entry = erts_export_get_or_make_stub(m, f, arity); - StubAddress = hipe_make_native_stub(export_entry, arity); - if (!StubAddress) - erl_exit(1, "hipe_make_stub: code allocation failed\r\n"); +#if 0 + if (is_not_atom(m) || is_not_atom(f) || arity > 255) + return NULL; +#endif + BEAMAddress = hipe_get_emu_address(m, f, arity, is_remote); + StubAddress = hipe_make_native_stub(BEAMAddress, arity); +#if 0 + hipe_mfa_set_na(m, f, arity, StubAddress); +#endif return StubAddress; } -static void *hipe_get_na_try_locked(Eterm m, Eterm f, unsigned int a, int is_remote, struct hipe_mfa_info **pp) +static void *hipe_get_na_nofail_locked(Eterm m, Eterm f, unsigned int a, int is_remote) { struct hipe_mfa_info *p; void *address; @@ -1333,53 +1523,22 @@ address = p->remote_address; if (address) return address; - } - /* Caller must take the slow path with the write lock held, but allow - it to avoid some work if it already holds the write lock. */ - if (pp) - *pp = p; - return NULL; -} - -static void *hipe_get_na_slow_rwlocked(Eterm m, Eterm f, unsigned int a, int is_remote, struct hipe_mfa_info *p) -{ - void *address; - - if (!p) - p = hipe_mfa_info_table_put_rwlocked(m, f, a); + } else + p = hipe_mfa_info_table_put_locked(m, f, a); address = hipe_make_stub(m, f, a, is_remote); /* XXX: how to tell if a BEAM MFA is exported or not? */ p->remote_address = address; return address; } -static void *hipe_get_na_nofail_rwlocked(Eterm m, Eterm f, unsigned int a, int is_remote) -{ - struct hipe_mfa_info *p; - void *address; - - address = hipe_get_na_try_locked(m, f, a, is_remote, &p); - if (address) - return address; - - address = hipe_get_na_slow_rwlocked(m, f, a, is_remote, p); - return address; -} - static void *hipe_get_na_nofail(Eterm m, Eterm f, unsigned int a, int is_remote) { - void *address; - - hipe_mfa_info_table_rlock(); - address = hipe_get_na_try_locked(m, f, a, is_remote, NULL); - hipe_mfa_info_table_runlock(); - if (address) - return address; + void *p; - hipe_mfa_info_table_rwlock(); - address = hipe_get_na_slow_rwlocked(m, f, a, is_remote, NULL); - hipe_mfa_info_table_rwunlock(); - return address; + hipe_mfa_info_table_lock(); + p = hipe_get_na_nofail_locked(m, f, a, is_remote); + hipe_mfa_info_table_unlock(); + return p; } /* used for apply/3 in hipe_mode_switch */ @@ -1458,7 +1617,7 @@ /* Note about locking: the table is only updated from the loader, which runs with the rest of the system suspended. */ /* XXX: alas not true; see comment at hipe_mfa_info_table.lock */ - hipe_mfa_info_table_rlock(); + hipe_mfa_info_table_lock(); bucket = hipe_mfa_info_table.bucket; nrbuckets = 1 << hipe_mfa_info_table.log2size; mfa = NULL; @@ -1479,7 +1638,7 @@ *f = mfa->f; *a = mfa->a; } - hipe_mfa_info_table_runlock(); + hipe_mfa_info_table_unlock(); return mfa ? 1 : 0; } @@ -1556,9 +1715,9 @@ default: goto badarg; } - hipe_mfa_info_table_rwlock(); - callee_mfa = hipe_mfa_info_table_put_rwlocked(callee.mod, callee.fun, callee.ari); - caller_mfa = hipe_mfa_info_table_put_rwlocked(caller.mod, caller.fun, caller.ari); + hipe_mfa_info_table_lock(); + callee_mfa = hipe_mfa_info_table_put_locked(callee.mod, callee.fun, callee.ari); + caller_mfa = hipe_mfa_info_table_put_locked(caller.mod, caller.fun, caller.ari); refers_to = erts_alloc(ERTS_ALC_T_HIPE, sizeof(*refers_to)); refers_to->mfa = callee_mfa; @@ -1572,7 +1731,7 @@ ref->flags = flags; ref->next = callee_mfa->referred_from; callee_mfa->referred_from = ref; - hipe_mfa_info_table_rwunlock(); + hipe_mfa_info_table_unlock(); BIF_RET(NIL); @@ -1592,12 +1751,12 @@ if (!term_to_mfa(BIF_ARG_1, &mfa)) BIF_ERROR(BIF_P, BADARG); - hipe_mfa_info_table_rwlock(); + hipe_mfa_info_table_lock(); p = hipe_mfa_info_table_get_locked(mfa.mod, mfa.fun, mfa.ari); if (p) for (ref = p->referred_from; ref != NULL; ref = ref->next) ref->flags |= REF_FLAG_PENDING_REDIRECT; - hipe_mfa_info_table_rwunlock(); + hipe_mfa_info_table_unlock(); BIF_RET(NIL); } @@ -1611,7 +1770,7 @@ struct hipe_mfa_info **bucket; unsigned int i, nrbuckets; - hipe_mfa_info_table_rwlock(); + hipe_mfa_info_table_lock(); bucket = hipe_mfa_info_table.bucket; nrbuckets = 1 << hipe_mfa_info_table.log2size; @@ -1633,7 +1792,7 @@ erts_free(ERTS_ALC_T_HIPE, mfa); } } - hipe_mfa_info_table_rwunlock(); + hipe_mfa_info_table_unlock(); } BIF_RETTYPE hipe_bifs_remove_refs_from_1(BIF_ALIST_1) @@ -1650,7 +1809,7 @@ if (!term_to_mfa(BIF_ARG_1, &mfa)) BIF_ERROR(BIF_P, BADARG); - hipe_mfa_info_table_rwlock(); + hipe_mfa_info_table_lock(); caller_mfa = hipe_mfa_info_table_get_locked(mfa.mod, mfa.fun, mfa.ari); if (caller_mfa) { refers_to = caller_mfa->refers_to; @@ -1681,7 +1840,7 @@ } caller_mfa->refers_to = NULL; } - hipe_mfa_info_table_rwunlock(); + hipe_mfa_info_table_unlock(); BIF_RET(am_ok); } @@ -1700,7 +1859,7 @@ if (!term_to_mfa(BIF_ARG_1, &mfa)) BIF_ERROR(BIF_P, BADARG); - hipe_mfa_info_table_rwlock(); + hipe_mfa_info_table_lock(); p = hipe_mfa_info_table_get_locked(mfa.mod, mfa.fun, mfa.ari); if (p) { prev = &p->referred_from; @@ -1708,7 +1867,7 @@ while (ref) { if (ref->flags & REF_FLAG_PENDING_REDIRECT) { is_remote = ref->flags & REF_FLAG_IS_REMOTE; - new_address = hipe_get_na_nofail_rwlocked(p->m, p->f, p->a, is_remote); + new_address = hipe_get_na_nofail_locked(p->m, p->f, p->a, is_remote); if (ref->flags & REF_FLAG_IS_LOAD_MFA) res = hipe_patch_insn(ref->address, (Uint)new_address, am_load_mfa); else @@ -1731,7 +1890,7 @@ } } } - hipe_mfa_info_table_rwunlock(); + hipe_mfa_info_table_unlock(); BIF_RET(NIL); } @@ -1741,16 +1900,18 @@ if (!term_to_Uint(BIF_ARG_1, &crc)) BIF_ERROR(BIF_P, BADARG); - if (crc == HIPE_ERTS_CHECKSUM) + if (crc == HIPE_SYSTEM_CRC) BIF_RET(am_true); BIF_RET(am_false); } -BIF_RETTYPE hipe_bifs_system_crc_0(BIF_ALIST_0) +BIF_RETTYPE hipe_bifs_system_crc_1(BIF_ALIST_1) { Uint crc; - crc = HIPE_SYSTEM_CRC; + if (!term_to_Uint(BIF_ARG_1, &crc)) + BIF_ERROR(BIF_P, BADARG); + crc ^= (HIPE_SYSTEM_CRC ^ HIPE_LITERALS_CRC); BIF_RET(Uint_to_term(crc, BIF_P)); } diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif0.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif0.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif0.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif0.h 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif0.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif0.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif0.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif0.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -50,6 +49,7 @@ bif hipe_bifs:merge_term/1 bif hipe_bifs:fun_to_address/1 +#bif hipe_bifs:get_emu_address/1 bif hipe_bifs:set_native_address/3 #bif hipe_bifs:address_to_fun/1 @@ -72,10 +72,11 @@ bif hipe_bifs:get_fe/2 bif hipe_bifs:set_native_address_in_fe/2 +#bif hipe_bifs:make_native_stub/2 bif hipe_bifs:find_na_or_make_stub/2 bif hipe_bifs:check_crc/1 -bif hipe_bifs:system_crc/0 +bif hipe_bifs:system_crc/1 bif hipe_bifs:get_rts_param/1 #bif hipe_bifs:tuple_to_float/1 @@ -141,5 +142,4 @@ atom bs_validate_unicode atom bs_validate_unicode_retract atom emulate_fpe -atom emasculate_binary diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif1.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif1.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif1.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif1.c 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 2001-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -575,6 +574,22 @@ /* XXX: these macros have free variables */ #ifdef BM_TIMERS +#if USE_PERFCTR +#define MAKE_TIME(_timer_) { \ + BM_TIMER_T tmp = _timer_##_time; \ + milli = (uint)(tmp - ((int)(tmp / 1000)) * 1000); \ + tmp /= 1000; \ + sec = (uint)(tmp - ((int)(tmp / 60)) * 60); \ + min = (uint)tmp / 60; } + +#define MAKE_MICRO_TIME(_timer_) { \ + BM_TIMER_T tmp = _timer_##_time * 1000; \ + micro = (uint)(tmp - ((int)(tmp / 1000)) * 1000); \ + tmp /= 1000; \ + milli = (uint)(tmp - ((int)(tmp / 1000)) * 1000); \ + sec = (uint)tmp / 1000; } + +#else #define MAKE_TIME(_timer_) { \ BM_TIMER_T tmp = _timer_##_time / 1000000; \ milli = tmp % 1000; \ @@ -589,6 +604,7 @@ milli = tmp % 1000; \ sec = tmp / 1000; } +#endif #else #define MAKE_TIME(_timer_) #define MAKE_MICRO_TIME(_timer_) @@ -836,6 +852,9 @@ /* * HiPE hrvtime(). * These implementations are currently available: + * + On Linux with the perfctr extension we can use the process' + * virtualised time-stamp counter. To enable this mode you must + * pass `--with-perfctr=/path/to/perfctr' when configuring. * + The fallback, which is the same as {X,_} = runtime(statistics). */ @@ -847,6 +866,37 @@ return (double)ms_user; } +#if USE_PERFCTR + +#include "hipe_perfctr.h" +static int hrvtime_started; /* 0: closed, +1: perfctr, -1: fallback */ +#define hrvtime_is_started() (hrvtime_started != 0) + +static void start_hrvtime(void) +{ + if (hipe_perfctr_hrvtime_open() >= 0) + hrvtime_started = 1; + else + hrvtime_started = -1; +} + +static void stop_hrvtime(void) +{ + if (hrvtime_started > 0) + hipe_perfctr_hrvtime_close(); + hrvtime_started = 0; +} + +static double get_hrvtime(void) +{ + if (hrvtime_started > 0) + return hipe_perfctr_hrvtime_get(); + else + return fallback_get_hrvtime(); +} + +#else /* !USE_PERFCTR */ + /* * Fallback, if nothing better exists. * This is the same as {X,_} = statistics(runtime), which uses @@ -858,6 +908,8 @@ #define stop_hrvtime() do{}while(0) #define get_hrvtime() fallback_get_hrvtime() +#endif /* !USE_PERFCTR */ + BIF_RETTYPE hipe_bifs_get_hrvtime_0(BIF_ALIST_0) { Eterm *hp; diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif1.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif1.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif1.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif1.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif1.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif1.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif1.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif1.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif2.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif2.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif2.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif2.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif2.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif2.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif2.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif2.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif64.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif64.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif64.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif64.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif64.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif64.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif64.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif64.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif64.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif64.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif64.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif64.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif_list.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif_list.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_bif_list.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_bif_list.m4 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -251,8 +250,6 @@ nocons_nofail_primop_interface_0(nbif_emulate_fpe, hipe_emulate_fpe) #endif -noproc_primop_interface_1(nbif_emasculate_binary, hipe_emasculate_binary) - /* * SMP-specific stuff */ @@ -269,23 +266,18 @@ /* BIFs that disable GC while trapping are called via a wrapper * to reserve stack space for the "trap frame". */ -define(CFUN,`ifelse( -$1, term_to_binary_1, hipe_wrapper_$1, -$1, term_to_binary_2, hipe_wrapper_$1, -$1, binary_to_term_1, hipe_wrapper_$1, -$1, binary_to_term_2, hipe_wrapper_$1, -$1, binary_to_list_1, hipe_wrapper_$1, -$1, binary_to_list_3, hipe_wrapper_$1, -$1, bitstring_to_list_1, hipe_wrapper_$1, -$1, list_to_binary_1, hipe_wrapper_$1, -$1, iolist_to_binary_1, hipe_wrapper_$1, -$1, binary_list_to_bin_1, hipe_wrapper_$1, -$1, list_to_bitstring_1, hipe_wrapper_$1, -$1, send_2, hipe_wrapper_$1, -$1, send_3, hipe_wrapper_$1, -$1, ebif_bang_2, hipe_wrapper_$1, -$1, maps_merge_2, hipe_wrapper_$1, -$1)') +define(CFUN,`ifelse($1,term_to_binary_1,hipe_wrapper_term_to_binary_1, +ifelse($1,term_to_binary_2,hipe_wrapper_term_to_binary_2, +ifelse($1,binary_to_term_1,hipe_wrapper_binary_to_term_1, +ifelse($1,binary_to_term_2,hipe_wrapper_binary_to_term_2, +ifelse($1,binary_to_list_1,hipe_wrapper_binary_to_list_1, +ifelse($1,binary_to_list_3,hipe_wrapper_binary_to_list_3, +ifelse($1,bitstring_to_list_1,hipe_wrapper_bitstring_to_list_1, +ifelse($1,list_to_binary_1,hipe_wrapper_list_to_binary_1, +ifelse($1,iolist_to_binary_1,hipe_wrapper_iolist_to_binary_1, +ifelse($1,binary_list_to_bin_1,hipe_wrapper_binary_list_to_bin_1, +ifelse($1,list_to_bitstring_1,hipe_wrapper_list_to_bitstring_1, +$1)))))))))))') define(BIF_LIST,`standard_bif_interface_$3(nbif_$4, CFUN($4))') include(TARGET/`erl_bif_list.h') diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_debug.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_debug.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_debug.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_debug.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -173,10 +172,8 @@ printf("P: 0x%0*lx\r\n", 2*(int)sizeof(long), (unsigned long)p); printf("-----------------------------------------------\r\n"); printf("Offset| Name | Value | *Value |\r\n"); -#undef U #define U(n,x) \ printf(" % 4d | %s | 0x%0*lx | |\r\n", (int)offsetof(Process,x), n, 2*(int)sizeof(long), (unsigned long)p->x) -#undef P #define P(n,x) \ printf(" % 4d | %s | 0x%0*lx | 0x%0*lx |\r\n", (int)offsetof(Process,x), n, 2*(int)sizeof(long), (unsigned long)p->x, 2*(int)sizeof(long), p->x ? (unsigned long)*(p->x) : -1UL) @@ -214,9 +211,9 @@ U("seq..clock ", seq_trace_clock); U("seq..astcnt", seq_trace_lastcnt); U("seq..token ", seq_trace_token); - U("intial[0] ", u.initial[0]); - U("intial[1] ", u.initial[1]); - U("intial[2] ", u.initial[2]); + U("intial[0] ", initial[0]); + U("intial[1] ", initial[1]); + U("intial[2] ", initial[2]); P("current ", current); P("cp ", cp); P("i ", i); @@ -234,7 +231,7 @@ U("nsp ", hipe.nsp); U("nstack ", hipe.nstack); U("nstend ", hipe.nstend); - U("ncallee ", hipe.u.ncallee); + U("ncallee ", hipe.ncallee); hipe_arch_print_pcb(&p->hipe); #endif /* HIPE */ #undef U diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_debug.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_debug.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_debug.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_debug.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_gbif_list.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_gbif_list.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_gbif_list.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_gbif_list.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_gc.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_gc.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_gc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_gc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -23,9 +22,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - -#define ERL_WANT_GC_INTERNALS__ - #include "global.h" #include "erl_gc.h" diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_gc.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_gc.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_gc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_gc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_mkliterals.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_mkliterals.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_mkliterals.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_mkliterals.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -269,6 +268,9 @@ /* freason codes */ { "FREASON_TRAP", TRAP }, + /* special Erlang constants */ + { "THE_NON_VALUE", (int)THE_NON_VALUE }, + /* funs */ #ifdef HIPE { "EFE_NATIVE_ADDRESS", offsetof(struct erl_fun_entry, native_address) }, @@ -496,8 +498,8 @@ { 38, "P_ARG4", 1, offsetof(struct process, def_arg_reg[4]) }, { 39, "P_ARG5", 1, offsetof(struct process, def_arg_reg[5]) }, { 40, "P_NSP", 1, offsetof(struct process, hipe.nsp) }, - { 41, "P_NCALLEE", 1, offsetof(struct process, hipe.u.ncallee) }, - { 42, "P_CLOSURE", 1, offsetof(struct process, hipe.u.closure) }, + { 41, "P_NCALLEE", 1, offsetof(struct process, hipe.ncallee) }, + { 42, "P_CLOSURE", 1, offsetof(struct process, hipe.closure) }, { 43, "P_NSP_LIMIT", 1, offsetof(struct process, hipe.nstack) }, { 44, "P_CSP", #if defined(__i386__) || defined(__x86_64__) @@ -522,9 +524,6 @@ }, { 49, "P_MSG_FIRST", 1, offsetof(struct process, msg.first) }, { 50, "P_MSG_SAVE", 1, offsetof(struct process, msg.save) }, - { 51, "P_CALLEE_EXP", 1, offsetof(struct process, hipe.u.callee_exp) }, - - { 52, "THE_NON_VALUE", 1, (int)THE_NON_VALUE }, }; #define NR_PARAMS ARRAY_SIZE(rts_params) @@ -542,8 +541,6 @@ crc_value = crc_update_int(crc_value, &literals[i].value); crc_value &= 0x07FFFFFF; literals_crc = crc_value; - - crc_value = crc_init(); for (i = 0; i < NR_PARAMS; ++i) if (rts_params[i].is_defined) crc_value = crc_update_int(crc_value, &rts_params[i].value); @@ -629,7 +626,6 @@ print_params(fp, c_define_param); fprintf(fp, "#define HIPE_LITERALS_CRC %uU\n", literals_crc); fprintf(fp, "#define HIPE_SYSTEM_CRC %uU\n", system_crc); - fprintf(fp, "#define HIPE_ERTS_CHECKSUM (HIPE_LITERALS_CRC ^ HIPE_SYSTEM_CRC)\n"); fprintf(fp, "\n"); fprintf(fp, "#define RTS_PARAMS_CASES"); print_params(fp, c_case_param); @@ -647,14 +643,13 @@ fprintf(fp, "\n"); print_params(fp, e_define_param); fprintf(fp, "\n"); - fprintf(fp, "-define(HIPE_LITERALS_CRC, %u).\n", literals_crc); if (is_xcomp) { fprintf(fp, "-define(HIPE_SYSTEM_CRC, %u).\n", system_crc); } else { - fprintf(fp, "-define(HIPE_SYSTEM_CRC, hipe_bifs:system_crc()).\n"); + fprintf(fp, "-define(HIPE_SYSTEM_CRC, hipe_bifs:system_crc(%u)).\n", + literals_crc); } - fprintf(fp, "-define(HIPE_ERTS_CHECKSUM, (?HIPE_LITERALS_CRC bxor ?HIPE_SYSTEM_CRC)).\n"); return 0; } diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_mode_switch.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_mode_switch.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_mode_switch.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_mode_switch.c 2014-09-16 19:10:57.000000000 +0000 @@ -2,19 +2,18 @@ * %CopyrightBegin% * - * Copyright Ericsson AB 2001-2014. All Rights Reserved. + * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -141,6 +140,7 @@ #endif /* HIPE_DEBUG > 0 */ /* ensure that at least nwords words are available on the native stack */ +static void hipe_check_nstack(Process *p, unsigned nwords); #if defined(__sparc__) #include "hipe_sparc_glue.h" @@ -159,7 +159,7 @@ Uint hipe_beam_pc_return[1]; /* needed in hipe_debug.c */ Uint hipe_beam_pc_throw[1]; /* needed in hipe_debug.c */ Uint hipe_beam_pc_resume[1]; /* needed by hipe_set_timeout() */ -Eterm hipe_beam_catch_throw; +static Eterm hipe_beam_catch_throw; void hipe_mode_switch_init(void) { @@ -185,31 +185,48 @@ bfun[-4] = (Uint)nfun; } +void hipe_reserve_beam_trap_frame(Process *p, Eterm reg[], unsigned arity) +{ + /* ensure that at least 2 words are available on the BEAM stack */ + if ((p->stop - 2) < p->htop) { + DPRINTF("calling gc to reserve BEAM stack size"); + p->fcalls -= erts_garbage_collect(p, 2, reg, arity); + ASSERT(!((p->stop - 2) < p->htop)); + } + p->stop -= 2; + p->stop[0] = NIL; + p->stop[1] = NIL; +} + static __inline__ void hipe_push_beam_trap_frame(Process *p, Eterm reg[], unsigned arity) { - if (&p->stop[1] < p->hend && p->stop[1] == hipe_beam_catch_throw) { + if (p->flags & F_DISABLE_GC) { /* Trap frame already reserved */ - ASSERT(p->stop[0] == NIL); + ASSERT(p->stop[0] == NIL && p->stop[1] == NIL); } else { - ASSERT(!(p->flags & F_DISABLE_GC)); if ((p->stop - 2) < p->htop) { DPRINTF("calling gc to increase BEAM stack size"); p->fcalls -= erts_garbage_collect(p, 2, reg, arity); ASSERT(!((p->stop - 2) < p->htop)); } p->stop -= 2; - p->stop[1] = hipe_beam_catch_throw; } + p->stop[1] = hipe_beam_catch_throw; p->stop[0] = make_cp(p->cp); ++p->catches; p->cp = hipe_beam_pc_return; } +void hipe_unreserve_beam_trap_frame(Process *p) +{ + ASSERT(p->stop[0] == NIL && p->stop[1] == NIL); + p->stop += 2; +} + static __inline__ void hipe_pop_beam_trap_frame(Process *p) { - ASSERT(p->stop[1] == hipe_beam_catch_throw); p->cp = cp_val(p->stop[0]); --p->catches; p->stop += 2; @@ -240,14 +257,14 @@ /* BEAM calls a native code function */ unsigned arity = cmd >> 8; - /* p->hipe.u.ncallee set in beam_emu */ + /* p->hipe.ncallee set in beam_emu */ if (p->cp == hipe_beam_pc_return) { /* Native called BEAM, which now tailcalls native. */ hipe_pop_beam_trap_frame(p); result = hipe_tailcall_to_native(p, arity, reg); break; } - DPRINTF("calling %#lx/%u", (long)p->hipe.u.ncallee, arity); + DPRINTF("calling %#lx/%u", (long)p->hipe.ncallee, arity); result = hipe_call_to_native(p, arity, reg); break; } @@ -265,18 +282,18 @@ arity -= funp->num_free; /* arity == #formals */ reg[arity] = fun; ++arity; /* correct for having added the closure */ - /* HIPE_ASSERT(p->hipe.u.ncallee == (void(*)(void))funp->native_address); */ + /* HIPE_ASSERT(p->hipe.ncallee == (void(*)(void))funp->native_address); */ /* just like a normal call from now on */ - /* p->hipe.u.ncallee set in beam_emu */ + /* p->hipe.ncallee set in beam_emu */ if (p->cp == hipe_beam_pc_return) { /* Native called BEAM, which now tailcalls native. */ hipe_pop_beam_trap_frame(p); result = hipe_tailcall_to_native(p, arity, reg); break; } - DPRINTF("calling %#lx/%u", (long)p->hipe.u.ncallee, arity); + DPRINTF("calling %#lx/%u", (long)p->hipe.ncallee, arity); result = hipe_call_to_native(p, arity, reg); break; } @@ -379,13 +396,13 @@ if (is_recursive) hipe_push_beam_trap_frame(p, reg, p->arity); - result = HIPE_MODE_SWITCH_RES_CALL_BEAM; + result = HIPE_MODE_SWITCH_RES_CALL; break; } - case HIPE_MODE_SWITCH_RES_CALL_EXPORTED: { + case HIPE_MODE_SWITCH_RES_CALL: { /* Native code calls or tailcalls BEAM. * - * p->hipe.u.callee_exp is the callee's export entry + * p->i is the callee's BEAM code * p->arity is the callee's arity * p->def_arg_reg[] contains the register parameters * p->hipe.nsp[] contains the stacked parameters @@ -405,15 +422,15 @@ * F(A1, ..., AN, FV1, ..., FVM, Closure) * (Where Ai is argument i and FVj is free variable j) * - * p->hipe.u.closure contains the closure + * p->hipe.closure contains the closure * p->def_arg_reg[] contains the register parameters * p->hipe.nsp[] contains the stacked parameters */ ErlFunThing *closure; unsigned num_free, arity, i, is_recursive; - HIPE_ASSERT(is_fun(p->hipe.u.closure)); - closure = (ErlFunThing*)fun_val(p->hipe.u.closure); + HIPE_ASSERT(is_fun(p->hipe.closure)); + closure = (ErlFunThing*)fun_val(p->hipe.closure); num_free = closure->num_free; arity = closure->fe->arity; @@ -443,10 +460,10 @@ p->i = closure->fe->address; /* Change result code to the faster plain CALL type. */ - result = HIPE_MODE_SWITCH_RES_CALL_BEAM; + result = HIPE_MODE_SWITCH_RES_CALL; } /* Append the closure as the last parameter. Don't increment arity. */ - reg[arity] = p->hipe.u.closure; + reg[arity] = p->hipe.closure; if (is_recursive) { /* BEAM called native, which now calls BEAM. @@ -524,7 +541,7 @@ } } HIPE_CHECK_PCB(p); - result = HIPE_MODE_SWITCH_RES_CALL_BEAM; + result = HIPE_MODE_SWITCH_RES_CALL; p->def_arg_reg[3] = result; return p; } @@ -552,7 +569,7 @@ address = hipe_get_remote_na(mfa[0], mfa[1], arity); if (!address) goto do_apply_fail; - p->hipe.u.ncallee = (void(*)(void)) address; + p->hipe.ncallee = (void(*)(void)) address; result = hipe_tailcall_to_native(p, arity, reg); goto do_return_from_native; do_apply_fail: @@ -582,6 +599,7 @@ } #if 0 && defined(HIPE_NSTACK_GROWS_UP) +#define hipe_nstack_avail(p) ((p)->hipe.nstend - (p)->hipe.nsp) void hipe_inc_nstack(Process *p) { Eterm *old_nstack = p->hipe.nstack; @@ -605,6 +623,7 @@ #endif #if defined(HIPE_NSTACK_GROWS_DOWN) +#define hipe_nstack_avail(p) ((unsigned)((p)->hipe.nsp - (p)->hipe.nstack)) void hipe_inc_nstack(Process *p) { unsigned old_size = p->hipe.nstend - p->hipe.nstack; @@ -636,6 +655,12 @@ p->hipe.nstend = NULL; } +static void hipe_check_nstack(Process *p, unsigned nwords) +{ + while (hipe_nstack_avail(p) < nwords) + hipe_inc_nstack(p); +} + void hipe_set_closure_stub(ErlFunEntry *fe, unsigned num_free) { unsigned arity; diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_mode_switch.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_mode_switch.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_mode_switch.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_mode_switch.h 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -32,7 +31,7 @@ /* result codes for beam_emu <- hipe_mode_switch() return */ #define HIPE_MODE_SWITCH_RES_RETURN 4 -#define HIPE_MODE_SWITCH_RES_CALL_EXPORTED 5 +#define HIPE_MODE_SWITCH_RES_CALL 5 #define HIPE_MODE_SWITCH_RES_THROW 6 /* additional result codes for hipe_mode_switch() <- native return */ @@ -46,8 +45,6 @@ #define HIPE_MODE_SWITCH_RES_APPLY 13 /* mode_switch <- native */ -#define HIPE_MODE_SWITCH_RES_CALL_BEAM 14 - #ifndef ASM #include "error.h" @@ -62,58 +59,13 @@ void hipe_set_closure_stub(ErlFunEntry *fe, unsigned num_free); Eterm hipe_build_stacktrace(Process *p, struct StackTrace *s); -ERTS_GLB_INLINE void hipe_reserve_beam_trap_frame(Process*, Eterm reg[], unsigned arity); -ERTS_GLB_INLINE void hipe_unreserve_beam_trap_frame(Process*); +void hipe_reserve_beam_trap_frame(Process*, Eterm reg[], unsigned arity); +void hipe_unreserve_beam_trap_frame(Process*); extern Uint hipe_beam_pc_return[]; extern Uint hipe_beam_pc_throw[]; extern Uint hipe_beam_pc_resume[]; -#if ERTS_GLB_INLINE_INCL_FUNC_DEF - -#include "erl_gc.h" -#include "hipe_stack.h" - -#if defined(__sparc__) -#include "hipe_sparc_glue.h" -#elif defined(__i386__) -#include "hipe_x86_glue.h" -#elif defined(__x86_64__) -#include "hipe_amd64_glue.h" -#elif defined(__powerpc__) || defined(__ppc__) || defined(__powerpc64__) -#include "hipe_ppc_glue.h" -#elif defined(__arm__) -#include "hipe_arm_glue.h" -#endif - -extern Eterm hipe_beam_catch_throw; - -ERTS_GLB_INLINE void hipe_reserve_beam_trap_frame(Process *p, Eterm reg[], unsigned arity) -{ - if (!hipe_bifcall_from_native_is_recursive(p)) - return; - - /* ensure that at least 2 words are available on the BEAM stack */ - if ((p->stop - 2) < p->htop) { - p->fcalls -= erts_garbage_collect(p, 2, reg, arity); - ASSERT(!((p->stop - 2) < p->htop)); - } - p->stop -= 2; - p->stop[0] = NIL; - p->stop[1] = hipe_beam_catch_throw; -} - -ERTS_GLB_INLINE void hipe_unreserve_beam_trap_frame(Process *p) -{ - if (!hipe_bifcall_from_native_is_recursive(p)) - return; - - ASSERT(p->stop[0] == NIL && p->stop[1] == hipe_beam_catch_throw); - p->stop += 2; -} - -#endif /* ERTS_GLB_INLINE_INCL_FUNC_DEF */ - #endif /* ASM */ #endif /* HIPE_MODE_SWITCH_H */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_native_bif.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_native_bif.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_native_bif.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_native_bif.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -93,6 +92,9 @@ { Process* p = BIF_P; Eterm timeout_value = BIF_ARG_1; +#if !defined(ARCH_64) + Uint time_val; +#endif /* XXX: This should be converted to follow BEAM conventions, * but that requires some compiler changes. * @@ -100,8 +102,7 @@ * p->def_arg_reg[0] and p->i are both defined and used. * If a message arrives, BEAM resumes at p->i. * If a timeout fires, BEAM resumes at p->def_arg_reg[0]. - * (See erts_set_proc_timer() and proc_timeout_common() in - * erl_hl_timer.c.) + * (See set_timer() and timeout_proc() in erl_process.c.) * * Here we set p->def_arg_reg[0] to hipe_beam_pc_resume. * Assuming our caller invokes suspend immediately after @@ -134,21 +135,28 @@ */ if (p->flags & (F_INSLPQUEUE | F_TIMO)) return NIL; /* caller had better call nbif_suspend ASAP! */ - - if (timeout_value == am_infinity) { + if (is_small(timeout_value) && signed_val(timeout_value) >= 0 && +#if defined(ARCH_64) + (unsigned_val(timeout_value) >> 32) == 0 +#else + 1 +#endif + ) { + set_timer(p, unsigned_val(timeout_value)); + } else if (timeout_value == am_infinity) { /* p->flags |= F_TIMO; */ /* XXX: nbif_suspend_msg_timeout */ - } - else { - int tres = erts_set_proc_timer_term(p, timeout_value); - if (tres != 0) { /* Wrong time */ -#ifdef ERTS_SMP - if (p->hipe_smp.have_receive_locks) { - p->hipe_smp.have_receive_locks = 0; - erts_smp_proc_unlock(p, ERTS_PROC_LOCKS_MSG_RECEIVE); - } +#if !defined(ARCH_64) + } else if (term_to_Uint(timeout_value, &time_val)) { + set_timer(p, time_val); #endif - BIF_ERROR(p, EXC_TIMEOUT_VALUE); + } else { +#ifdef ERTS_SMP + if (p->hipe_smp.have_receive_locks) { + p->hipe_smp.have_receive_locks = 0; + erts_smp_proc_unlock(p, ERTS_PROC_LOCKS_MSG_RECEIVE); } +#endif + BIF_ERROR(p, EXC_TIMEOUT_VALUE); } return NIL; /* caller had better call nbif_suspend ASAP! */ } @@ -162,7 +170,7 @@ msgp = PEEK_MESSAGE(p); UNLINK_MESSAGE(p, msgp); /* decrements global 'erts_proc_tot_mem' variable */ JOIN_MESSAGE(p); - CANCEL_TIMER(p); /* calls erts_cancel_proc_timer() */ + CANCEL_TIMER(p); /* calls erl_cancel_timer() */ free_message(msgp); } @@ -322,6 +330,8 @@ Binary *bptr; bptr = erts_bin_nrml_alloc(len); + bptr->flags = 0; + bptr->orig_size = len; erts_smp_atomic_init_nob(&bptr->refc, 1); return bptr->orig_bytes; } @@ -331,6 +341,7 @@ Binary *bptr; bptr = erts_bin_realloc(oldbptr, newsize); + bptr->orig_size = newsize; return bptr; } diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_native_bif.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_native_bif.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_native_bif.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_native_bif.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -99,9 +98,6 @@ void hipe_emulate_fpe(Process*); #endif -AEXTERN(void,nbif_emasculate_binary,(Eterm)); -void hipe_emasculate_binary(Eterm); - /* * Stuff that is different in SMP and non-SMP. */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ops.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_ops.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ops.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ops.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_perfctr.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_perfctr.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_perfctr.c 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_perfctr.c 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,229 @@ +/* + * %CopyrightBegin% + * + * Copyright Ericsson AB 2004-2011. All Rights Reserved. + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "sys.h" +#include "error.h" +#include "global.h" +#include "bif.h" +#include "big.h" +#include "erl_binary.h" +#include "hipe_perfctr.h" +#include "libperfctr.h" + +static struct vperfctr *vperfctr; +static unsigned int have_rdtsc; +static double tsc_to_ms; +static unsigned int tsc_on; /* control calls must set tsc_on if have_rdtsc is true */ +static unsigned int nractrs; +static unsigned int users; +#define USER_BIFS (1<<0) +#define USER_HRVTIME (1<<1) + +static int hipe_perfctr_open(unsigned int user) +{ + struct perfctr_info info; + + if (!vperfctr) { + vperfctr = vperfctr_open(); + if (!vperfctr) + return -1; + if (vperfctr_info(vperfctr, &info) >= 0) { + tsc_to_ms = (double)(info.tsc_to_cpu_mult ? : 1) / (double)info.cpu_khz; + have_rdtsc = (info.cpu_features & PERFCTR_FEATURE_RDTSC) ? 1 : 0; + } + tsc_on = 0; + nractrs = 0; + } + users |= user; + return 0; +} + +static void hipe_perfctr_reset(void) +{ + struct vperfctr_control control; + + memset(&control, 0, sizeof control); + if (have_rdtsc) + control.cpu_control.tsc_on = 1; + nractrs = 0; + if (vperfctr_control(vperfctr, &control) >= 0) + tsc_on = 1; +} + +static void hipe_perfctr_close(unsigned int user) +{ + if (!vperfctr) + return; + users &= ~user; + switch (users) { + case 0: + vperfctr_unlink(vperfctr); + vperfctr_close(vperfctr); + vperfctr = NULL; + tsc_on = 0; + nractrs = 0; + break; + case USER_HRVTIME: + hipe_perfctr_reset(); + } +} + +/* + * Interface for HiPE's hrvtime code. + */ + +int hipe_perfctr_hrvtime_open(void) +{ + if (hipe_perfctr_open(USER_HRVTIME) < 0) + return -1; + if (have_rdtsc) { + if (!tsc_on) + hipe_perfctr_reset(); /* note: updates tsc_on */ + if (tsc_on) + return 0; + } + hipe_perfctr_hrvtime_close(); + return -1; +} + +void hipe_perfctr_hrvtime_close(void) +{ + hipe_perfctr_close(USER_HRVTIME); +} + +double hipe_perfctr_hrvtime_get(void) +{ + return (double)vperfctr_read_tsc(vperfctr) * tsc_to_ms; +} + +/* + * BIF interface for user-programmable performance counters. + */ + +BIF_RETTYPE hipe_bifs_vperfctr_open_0(BIF_ALIST_0) +{ + if (hipe_perfctr_open(USER_BIFS) < 0) + BIF_RET(am_false); /* arity 0 BIFs can't fail :-( */ + BIF_RET(am_true); +} + +BIF_RETTYPE hipe_bifs_vperfctr_close_0(BIF_ALIST_0) +{ + hipe_perfctr_close(USER_BIFS); + BIF_RET(NIL); +} + +static Eterm ull_to_integer(unsigned long long x, Process *p) +{ + unsigned long long tmpx; + unsigned int ds, i; + size_t sz; + Eterm *hp; + ErtsDigit *xp; + + if (x <= (unsigned long long)MAX_SMALL) + return make_small(x); + + /* Calculate number of digits. */ + ds = 0; + tmpx = x; + do { + ++ds; + tmpx = (tmpx >> (D_EXP / 2)) >> (D_EXP / 2); + } while (tmpx != 0); + + sz = BIG_NEED_SIZE(ds); /* number of words including arity */ + hp = HAlloc(p, sz); + *hp = make_pos_bignum_header(sz-1); + + xp = (ErtsDigit*)(hp+1); + i = 0; + do { + xp[i++] = (ErtsDigit)x; + x = (x >> (D_EXP / 2)) >> (D_EXP / 2); + } while (i < ds); + while (i & (BIG_DIGITS_PER_WORD-1)) + xp[i++] = 0; + + return make_big(hp); +} + +BIF_RETTYPE hipe_bifs_vperfctr_info_0(BIF_ALIST_0) +{ + struct perfctr_info info; + + if (!vperfctr || vperfctr_info(vperfctr, &info) < 0) + BIF_RET(am_false); /* arity 0 BIFs can't fail :-( */ + BIF_RET(new_binary(BIF_P, (void*)&info, sizeof info)); +} + +BIF_RETTYPE hipe_bifs_vperfctr_read_tsc_0(BIF_ALIST_0) +{ + unsigned long long val; + + if (!vperfctr || !tsc_on) + BIF_RET(am_false); /* arity 0 BIFs can't fail :-( */ + val = vperfctr_read_tsc(vperfctr); + BIF_RET(ull_to_integer(val, BIF_P)); +} + +BIF_RETTYPE hipe_bifs_vperfctr_read_pmc_1(BIF_ALIST_1) +{ + Uint pmc; + unsigned long long val; + + if (!vperfctr || + is_not_small(BIF_ARG_1) || + (pmc = unsigned_val(BIF_ARG_1), pmc >= nractrs)) + BIF_RET(am_false); /* for consistency with the arity 0 BIFs */ + val = vperfctr_read_pmc(vperfctr, pmc); + BIF_RET(ull_to_integer(val, BIF_P)); +} + +BIF_RETTYPE hipe_bifs_vperfctr_control_1(BIF_ALIST_1) +{ + void *bytes; + struct vperfctr_control control; + Uint bitoffs; + Uint bitsize; + + if (!vperfctr) + BIF_ERROR(BIF_P, BADARG); + if (is_not_binary(BIF_ARG_1)) + BIF_ERROR(BIF_P, BADARG); + if (binary_size(BIF_ARG_1) != sizeof control) + BIF_ERROR(BIF_P, BADARG); + ERTS_GET_BINARY_BYTES(BIF_ARG_1, bytes, bitoffs, bitsize); + ASSERT(bitoffs == 0); + ASSERT(bitsize == 0); + memcpy(&control, bytes, sizeof control); + if (have_rdtsc) + control.cpu_control.tsc_on = 1; + if (vperfctr_control(vperfctr, &control) < 0) { + hipe_perfctr_reset(); + BIF_ERROR(BIF_P, BADARG); + } + tsc_on = control.cpu_control.tsc_on; + nractrs = control.cpu_control.nractrs; + BIF_RET(NIL); +} diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_perfctr.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_perfctr.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_perfctr.h 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_perfctr.h 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,23 @@ +/* + * %CopyrightBegin% + * + * Copyright Ericsson AB 2004-2011. All Rights Reserved. + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% + */ + + +extern int hipe_perfctr_hrvtime_open(void); +extern void hipe_perfctr_hrvtime_close(void); +extern double hipe_perfctr_hrvtime_get(void); diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_perfctr.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_perfctr.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_perfctr.tab 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_perfctr.tab 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,25 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2004-2011. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# + +bif hipe_bifs:vperfctr_open/0 +bif hipe_bifs:vperfctr_close/0 +bif hipe_bifs:vperfctr_info/0 +bif hipe_bifs:vperfctr_read_tsc/0 +bif hipe_bifs:vperfctr_read_pmc/1 +bif hipe_bifs:vperfctr_control/1 diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc64.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc64.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc64.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc64.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2005-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_asm.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_asm.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_asm.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_asm.m4 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -24,22 +23,6 @@ #define HIPE_PPC_ASM_H' /* - * Tunables. - */ -define(LEAF_WORDS,16)dnl number of stack words for leaf functions -define(NR_ARG_REGS,4)dnl admissible values are 0 to 6, inclusive - -`#define PPC_LEAF_WORDS 'LEAF_WORDS -`#define PPC_NR_ARG_REGS 'NR_ARG_REGS -`#define NR_ARG_REGS 'NR_ARG_REGS - - -`#ifdef ASM' -/* - * Only assembler stuff from here on (when included from *.S) - */ - -/* * Handle 32 vs 64-bit. */ ifelse(ARCH,ppc64,` @@ -70,6 +53,13 @@ `#define STORE 'STORE `#define CMPI 'CMPI +/* + * Tunables. + */ +define(LEAF_WORDS,16)dnl number of stack words for leaf functions +define(NR_ARG_REGS,4)dnl admissible values are 0 to 6, inclusive + +`#define PPC_LEAF_WORDS 'LEAF_WORDS /* * Workarounds for Darwin. @@ -203,6 +193,8 @@ /* * Argument (parameter) registers. */ +`#define PPC_NR_ARG_REGS 'NR_ARG_REGS +`#define NR_ARG_REGS 'NR_ARG_REGS define(defarg,`define(ARG$1,`$2')dnl #`define ARG'$1 $2' @@ -281,10 +273,6 @@ `/* #define NBIF_ARG_3_0 'NBIF_ARG(r3,3,0)` */' `/* #define NBIF_ARG_3_1 'NBIF_ARG(r3,3,1)` */' `/* #define NBIF_ARG_3_2 'NBIF_ARG(r3,3,2)` */' -`/* #define NBIF_ARG_4_0 'NBIF_ARG(r3,4,0)` */' -`/* #define NBIF_ARG_4_1 'NBIF_ARG(r3,4,1)` */' -`/* #define NBIF_ARG_4_2 'NBIF_ARG(r3,4,2)` */' -`/* #define NBIF_ARG_4_3 'NBIF_ARG(r3,4,3)` */' `/* #define NBIF_ARG_5_0 'NBIF_ARG(r3,5,0)` */' `/* #define NBIF_ARG_5_1 'NBIF_ARG(r3,5,1)` */' `/* #define NBIF_ARG_5_2 'NBIF_ARG(r3,5,2)` */' @@ -306,7 +294,6 @@ `/* #define NBIF_RET_1 'NBIF_RET(1)` */' `/* #define NBIF_RET_2 'NBIF_RET(2)` */' `/* #define NBIF_RET_3 'NBIF_RET(3)` */' -`/* #define NBIF_RET_4 'NBIF_RET(4)` */' `/* #define NBIF_RET_5 'NBIF_RET(5)` */' dnl @@ -322,6 +309,4 @@ `/* #define QUICK_CALL_RET_F_3 'QUICK_CALL_RET(F,3)` */' `/* #define QUICK_CALL_RET_F_5 'QUICK_CALL_RET(F,5)` */' -`#endif /* ASM */' - `#endif /* HIPE_PPC_ASM_H */' diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_bifs.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_bifs.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_bifs.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_bifs.m4 2014-09-16 19:10:57.000000000 +0000 @@ -4,23 +4,21 @@ * * Copyright Ericsson AB 2004-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -#`define ASM' include(`hipe/hipe_ppc_asm.m4') #`include' "config.h" #`include' "hipe_literals.h" @@ -47,10 +45,9 @@ * standard_bif_interface_1(nbif_name, cbif_name) * standard_bif_interface_2(nbif_name, cbif_name) * standard_bif_interface_3(nbif_name, cbif_name) - * standard_bif_interface_4(nbif_name, cbif_name) * standard_bif_interface_0(nbif_name, cbif_name) * - * Generate native interface for a BIF with 0-4 parameters and + * Generate native interface for a BIF with 0-3 parameters and * standard failure mode. */ define(standard_bif_interface_1, @@ -145,41 +142,6 @@ SET_SIZE(ASYM($1)) TYPE_FUNCTION(ASYM($1)) #endif') - -define(standard_bif_interface_4, -` -#ifndef HAVE_$1 -#`define' HAVE_$1 - GLOBAL(ASYM($1)) -ASYM($1): - /* Set up C argument registers. */ - mr r3, P - NBIF_ARG(r4,4,0) - NBIF_ARG(r5,4,1) - NBIF_ARG(r6,4,2) - NBIF_ARG(r7,4,3) - - /* Save caller-save registers and call the C function. */ - SAVE_CONTEXT_BIF - STORE r4, P_ARG0(r3) /* Store BIF__ARGS in def_arg_reg[] */ - STORE r5, P_ARG1(r3) - STORE r6, P_ARG2(r3) - STORE r7, P_ARG3(r3) - addi r4, r3, P_ARG0 - CALL_BIF($2) - TEST_GOT_MBUF - - /* Restore registers. Check for exception. */ - CMPI r3, THE_NON_VALUE - RESTORE_CONTEXT_BIF - beq- 1f - NBIF_RET(4) -1: /* workaround for bc:s small offset operand */ - b CSYM(nbif_4_simple_exception) - HANDLE_GOT_MBUF(4) - SET_SIZE(ASYM($1)) - TYPE_FUNCTION(ASYM($1)) -#endif') define(standard_bif_interface_0, ` diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -286,7 +285,7 @@ } } -void *hipe_make_native_stub(void *callee_exp, unsigned int beamArity) +void *hipe_make_native_stub(void *beamAddress, unsigned int beamArity) { unsigned int *code; @@ -294,19 +293,17 @@ abort(); code = alloc_stub(7); - if (!code) - return NULL; - /* addis r12,0,callee_exp@highest */ - code[0] = 0x3d800000 | (((unsigned long)callee_exp >> 48) & 0xffff); - /* ori r12,r12,callee_exp@higher */ - code[1] = 0x618c0000 | (((unsigned long)callee_exp >> 32) & 0xffff); + /* addis r12,0,beamAddress@highest */ + code[0] = 0x3d800000 | (((unsigned long)beamAddress >> 48) & 0xffff); + /* ori r12,r12,beamAddress@higher */ + code[1] = 0x618c0000 | (((unsigned long)beamAddress >> 32) & 0xffff); /* sldi r12,r12,32 (rldicr r12,r12,32,31) */ code[2] = 0x798c07c6; - /* oris r12,r12,callee_exp@h */ - code[3] = 0x658c0000 | (((unsigned long)callee_exp >> 16) & 0xffff); - /* ori r12,r12,callee_exp@l */ - code[4] = 0x618c0000 | ((unsigned long)callee_exp & 0xffff); + /* oris r12,r12,beamAddress@h */ + code[3] = 0x658c0000 | (((unsigned long)beamAddress >> 16) & 0xffff); + /* ori r12,r12,beamAddress@l */ + code[4] = 0x618c0000 | ((unsigned long)beamAddress & 0xffff); /* addi r0,0,beamArity */ code[5] = 0x38000000 | (beamArity & 0x7FFF); /* ba nbif_callemu */ @@ -358,16 +355,18 @@ return 0; } -void *hipe_make_native_stub(void *callee_exp, unsigned int beamArity) +/* called from hipe_bif0.c:hipe_bifs_make_native_stub_2() + and hipe_bif0.c:hipe_make_stub() */ +void *hipe_make_native_stub(void *beamAddress, unsigned int beamArity) { unsigned int *code; /* * Native code calls BEAM via a stub looking as follows: * - * addi r12,0,callee_exp@l + * addi r12,0,beamAddress@l * addi r0,0,beamArity - * addis r12,r12,callee_exp@ha + * addis r12,r12,beamAddress@ha * ba nbif_callemu * * I'm using r0 and r12 since the standard SVR4 ABI allows @@ -384,15 +383,13 @@ abort(); code = alloc_stub(4); - if (!code) - return NULL; - /* addi r12,0,callee_exp@l */ - code[0] = 0x39800000 | ((unsigned long)callee_exp & 0xFFFF); + /* addi r12,0,beamAddress@l */ + code[0] = 0x39800000 | ((unsigned long)beamAddress & 0xFFFF); /* addi r0,0,beamArity */ code[1] = 0x38000000 | (beamArity & 0x7FFF); - /* addis r12,r12,callee_exp@ha */ - code[2] = 0x3D8C0000 | at_ha((unsigned long)callee_exp); + /* addis r12,r12,beamAddress@ha */ + code[2] = 0x3D8C0000 | at_ha((unsigned long)beamAddress); /* ba nbif_callemu */ code[3] = 0x48000002 | (unsigned long)&nbif_callemu; diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_gc.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_gc.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_gc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_gc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_glue.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_glue.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_glue.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_glue.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_glue.S erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_glue.S --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_glue.S 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_glue.S 2014-09-16 19:10:57.000000000 +0000 @@ -3,24 +3,24 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -#define ASM + #include "hipe_ppc_asm.h" #include "hipe_literals.h" +#define ASM #include "hipe_mode_switch.h" .text @@ -296,7 +296,7 @@ * which should look as follows: * * stub for f/N: - * + * * * b nbif_callemu * @@ -312,10 +312,10 @@ */ GLOBAL(ASYM(nbif_callemu)) ASYM(nbif_callemu): - STORE r12, P_CALLEE_EXP(P) + STORE r12, P_BEAM_IP(P) STORE r0, P_ARITY(P) STORE_ARG_REGS - li r3, HIPE_MODE_SWITCH_RES_CALL_EXPORTED + li r3, HIPE_MODE_SWITCH_RES_CALL b .suspend_exit /* @@ -463,12 +463,10 @@ OPD(nbif_1_gc_after_bif) OPD(nbif_2_gc_after_bif) OPD(nbif_3_gc_after_bif) - OPD(nbif_4_gc_after_bif) GLOBAL(CSYM(nbif_0_gc_after_bif)) GLOBAL(CSYM(nbif_1_gc_after_bif)) GLOBAL(CSYM(nbif_2_gc_after_bif)) GLOBAL(CSYM(nbif_3_gc_after_bif)) - GLOBAL(CSYM(nbif_4_gc_after_bif)) CSYM(nbif_0_gc_after_bif): li r4, 0 b .gc_after_bif @@ -480,9 +478,6 @@ b .gc_after_bif CSYM(nbif_3_gc_after_bif): li r4, 3 - b .gc_after_bif -CSYM(nbif_4_gc_after_bif): - li r4, 4 /*FALLTHROUGH*/ .gc_after_bif: stw r4, P_NARITY(P) /* Note: narity is a 32-bit field */ @@ -511,29 +506,20 @@ CSYM(nbif_0_simple_exception): li r4, 0 b .nbif_simple_exception - OPD(nbif_1_simple_exception) GLOBAL(CSYM(nbif_1_simple_exception)) CSYM(nbif_1_simple_exception): li r4, 1 b .nbif_simple_exception - OPD(nbif_2_simple_exception) GLOBAL(CSYM(nbif_2_simple_exception)) CSYM(nbif_2_simple_exception): li r4, 2 b .nbif_simple_exception - OPD(nbif_3_simple_exception) GLOBAL(CSYM(nbif_3_simple_exception)) CSYM(nbif_3_simple_exception): li r4, 3 - b .nbif_simple_exception - - OPD(nbif_4_simple_exception) - GLOBAL(CSYM(nbif_4_simple_exception)) -CSYM(nbif_4_simple_exception): - li r4, 4 /*FALLTHROUGH*/ .nbif_simple_exception: LOAD r3, P_FREASON(P) diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -65,6 +64,10 @@ extern void hipe_ppc_inc_stack(void); /* we don't have the AEXTERN() fallback :-( */ #endif +/* for hipe_bifs_enter_code_2 */ +extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); +#define HIPE_ALLOC_CODE(n,c,t,p) hipe_alloc_code((n),(c),(t),(p)) + #if !defined(__powerpc64__) extern const unsigned int fconv_constant[]; #endif diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_primops.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_primops.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc_primops.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc_primops.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_ppc.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_ppc.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_primops.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_primops.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_primops.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_primops.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -81,7 +80,6 @@ #ifdef NO_FPE_SIGNALS PRIMOP_LIST(am_emulate_fpe, &nbif_emulate_fpe) #endif -PRIMOP_LIST(am_emasculate_binary, &nbif_emasculate_binary) PRIMOP_LIST(am_debug_native_called, &nbif_hipe_bifs_debug_native_called) #if defined(__sparc__) diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_process.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_process.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_process.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_process.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -24,17 +23,14 @@ #define HIPE_PROCESS_H #include "erl_alloc.h" -#include "export.h" struct hipe_process_state { Eterm *nsp; /* Native stack pointer. */ Eterm *nstack; /* Native stack block start. */ Eterm *nstend; /* Native stack block end (start+size). */ - union { - void (*ncallee)(void); /* Native code callee (label) to invoke. */ - Eterm closure; /* Used to pass a closure from native code. */ - Export* callee_exp; /* Used to pass export entry from native code */ - }u; + /* XXX: ncallee and closure could share space in a union */ + void (*ncallee)(void); /* Native code callee (label) to invoke. */ + Eterm closure; /* Used to pass a closure from native code. */ Eterm *nstgraylim; /* Gray/white stack boundary. */ Eterm *nstblacklim; /* Black/gray stack boundary. Must exist if graylim exists. Ignored if no graylim. */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_risc_gc.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_risc_gc.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_risc_gc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_risc_gc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_risc_glue.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_risc_glue.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_risc_glue.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_risc_glue.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -215,14 +214,6 @@ return 0; } -/* Native called BIF. Is it a recursive call? - i.e should we return back to native when BIF is done? */ -static __inline__ int -hipe_bifcall_from_native_is_recursive(Process *p) -{ - return (p->hipe.nra != (void(*)(void))&nbif_return); -} - /* Native makes a call which needs to unload the parameters. This differs from hipe_call_from_native_is_recursive() in diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_risc_stack.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_risc_stack.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_risc_stack.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_risc_stack.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -227,7 +226,7 @@ * The native stack MUST contain a stack frame as it appears on * entry to a function (actuals, caller's frame, caller's return address). * p->hipe.narity MUST contain the arity (number of actuals). - * On exit, p->hipe.u.ncallee is set to the handler's PC and p->hipe.nsp + * On exit, p->hipe.ncallee is set to the handler's PC and p->hipe.nsp * is set to its SP (low address of its stack frame). */ void hipe_find_handler(Process *p) @@ -255,7 +254,7 @@ if ((exnra = sdesc_exnra(sdesc)) != 0 && (p->catches >= 0 || exnra == (unsigned long)&nbif_fail)) { - p->hipe.u.ncallee = (void(*)(void)) exnra; + p->hipe.ncallee = (void(*)(void)) exnra; p->hipe.nsp = nsp; p->hipe.narity = 0; /* update the gray/white boundary if we threw past it */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_signal.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_signal.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_signal.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_signal.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_asm.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_asm.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_asm.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_asm.m4 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 2007-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -30,14 +29,6 @@ define(NR_ARG_REGS,4)dnl admissible values are 0 to 6, inclusive `#define SPARC_LEAF_WORDS 'LEAF_WORDS -`#define SPARC_NR_ARG_REGS 'NR_ARG_REGS -`#define NR_ARG_REGS 'NR_ARG_REGS - - -`#ifdef ASM' -/* - * Only assembler stuff from here on (when included from *.S) - */ /* * Reserved registers. @@ -89,6 +80,9 @@ /* * Argument (parameter) registers. */ +`#define SPARC_NR_ARG_REGS 'NR_ARG_REGS +`#define NR_ARG_REGS 'NR_ARG_REGS + define(defarg,`define(ARG$1,`$2')dnl #`define ARG'$1 $2' )dnl @@ -177,10 +171,6 @@ `/* #define NBIF_ARG_3_0 'NBIF_ARG(r1,3,0)` */' `/* #define NBIF_ARG_3_1 'NBIF_ARG(r2,3,1)` */' `/* #define NBIF_ARG_3_2 'NBIF_ARG(r3,3,2)` */' -`/* #define NBIF_ARG_4_0 'NBIF_ARG(r1,4,0)` */' -`/* #define NBIF_ARG_4_1 'NBIF_ARG(r2,4,1)` */' -`/* #define NBIF_ARG_4_2 'NBIF_ARG(r3,4,2)` */' -`/* #define NBIF_ARG_4_3 'NBIF_ARG(r3,4,3)` */' `/* #define NBIF_ARG_5_0 'NBIF_ARG(r1,5,0)` */' `/* #define NBIF_ARG_5_1 'NBIF_ARG(r2,5,1)` */' `/* #define NBIF_ARG_5_2 'NBIF_ARG(r3,5,2)` */' @@ -205,7 +195,6 @@ `/* #define NBIF_RET_1 'NBIF_RET(1)` */' `/* #define NBIF_RET_2 'NBIF_RET(2)` */' `/* #define NBIF_RET_3 'NBIF_RET(3)` */' -`/* #define NBIF_RET_4 'NBIF_RET(4)` */' `/* #define NBIF_RET_5 'NBIF_RET(5)` */' dnl @@ -221,6 +210,4 @@ `/* #define QUICK_CALL_RET_F_3 'QUICK_CALL_RET(F,3)` */' `/* #define QUICK_CALL_RET_F_5 'QUICK_CALL_RET(F,5)` */' -`#endif /* ASM */' - `#endif /* HIPE_SPARC_ASM_H */' diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_bifs.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_bifs.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_bifs.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_bifs.m4 2014-09-16 19:10:57.000000000 +0000 @@ -4,23 +4,21 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -#`define ASM' include(`hipe/hipe_sparc_asm.m4') #`include' "config.h" #`include' "hipe_literals.h" @@ -55,10 +53,9 @@ * standard_bif_interface_1(nbif_name, cbif_name) * standard_bif_interface_2(nbif_name, cbif_name) * standard_bif_interface_3(nbif_name, cbif_name) - * standard_bif_interface_4(nbif_name, cbif_name) * standard_bif_interface_0(nbif_name, cbif_name) * - * Generate native interface for a BIF with 0-4 parameters and + * Generate native interface for a BIF with 0-3 parameters and * standard failure mode. */ define(standard_bif_interface_1, @@ -147,39 +144,6 @@ .size $1, .-$1 .type $1, #function #endif') - -define(standard_bif_interface_4, -` -#ifndef HAVE_$1 -#`define' HAVE_$1 - .global $1 -$1: - /* Set up C argument registers. */ - mov P, %o0 - NBIF_ARG(%o1,4,0) - NBIF_ARG(%o2,4,1) - NBIF_ARG(%o3,4,2) - NBIF_ARG(%o4,4,3) - - /* Save caller-save registers and call the C function. */ - SAVE_CONTEXT_BIF - st %o1, [%o0+P_ARG0] ! Store BIF__ARGS in def_arg_reg - st %o2, [%o0+P_ARG1] - st %o3, [%o0+P_ARG2] - st %o4, [%o0+P_ARG3] - add %o0, P_ARG0, %o1 - CALL_BIF($2) - nop - TEST_GOT_MBUF - - /* Restore registers. Check for exception. */ - TEST_GOT_EXN(4) - RESTORE_CONTEXT_BIF - NBIF_RET(4) - HANDLE_GOT_MBUF(4) - .size $1, .-$1 - .type $1, #function -#endif') define(standard_bif_interface_0, ` diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -131,7 +130,7 @@ #define ALLOC_CODE_STATS(X) do{}while(0) #endif -static int morecore(unsigned int alloc_bytes) +static void morecore(unsigned int alloc_bytes) { unsigned int map_bytes; char *map_hint, *map_start; @@ -159,9 +158,10 @@ #endif , -1, 0); - if (map_start == MAP_FAILED) - return -1; - + if (map_start == MAP_FAILED) { + perror("mmap"); + abort(); + } ALLOC_CODE_STATS(total_mapped += map_bytes); /* Merge adjacent mappings, so the trailing portion of the previous @@ -177,8 +177,6 @@ } ALLOC_CODE_STATS(atexit_alloc_code_stats()); - - return 0; } static void *alloc_code(unsigned int alloc_bytes) @@ -188,8 +186,8 @@ /* Align function entries. */ alloc_bytes = (alloc_bytes + 3) & ~3; - if (code_bytes < alloc_bytes && morecore(alloc_bytes) != 0) - return NULL; + if (code_bytes < alloc_bytes) + morecore(alloc_bytes); ALLOC_CODE_STATS(++nr_allocs); ALLOC_CODE_STATS(total_alloc += alloc_bytes); res = code_next; @@ -206,22 +204,22 @@ return alloc_code(nrbytes); } -void *hipe_make_native_stub(void *callee_exp, unsigned int beamArity) +/* called from hipe_bif0.c:hipe_bifs_make_native_stub_2() + and hipe_bif0.c:hipe_make_stub() */ +void *hipe_make_native_stub(void *beamAddress, unsigned int beamArity) { unsigned int *code; unsigned int callEmuOffset; int i; code = alloc_code(5*sizeof(int)); - if (!code) - return NULL; /* sethi %hi(Address), %i4 */ - code[0] = 0x39000000 | (((unsigned int)callee_exp >> 10) & 0x3FFFFF); + code[0] = 0x39000000 | (((unsigned int)beamAddress >> 10) & 0x3FFFFF); /* or %g0, %o7, %i3 ! mov %o7, %i3 */ code[1] = 0xB610000F; /* or %i4, %lo(Address), %i4 */ - code[2] = 0xB8172000 | ((unsigned int)callee_exp & 0x3FF); + code[2] = 0xB8172000 | ((unsigned int)beamAddress & 0x3FF); /* call callemu */ callEmuOffset = (char*)nbif_callemu - (char*)&code[3]; code[3] = (1 << 30) | ((callEmuOffset >> 2) & 0x3FFFFFFF); diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_gc.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_gc.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_gc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_gc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_glue.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_glue.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_glue.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_glue.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_glue.S erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_glue.S --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_glue.S 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_glue.S 2014-09-16 19:10:57.000000000 +0000 @@ -4,24 +4,24 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -#define ASM + #include "hipe_sparc_asm.h" #include "hipe_literals.h" +#define ASM #include "hipe_mode_switch.h" .section ".text" @@ -155,9 +155,9 @@ * which should look as follows: * * stub for f/N: - * sethi %hi(f's export entry address), TEMP_ARG0 + * sethi %hi(f's BEAM code address), TEMP_ARG0 * mov RA, TEMP_RA ! because the call below clobbers RA (%o7) - * or TEMP_ARG0, %lo(f's export entry address), TEMP_ARG0 + * or TEMP_ARG0, %lo(f's BEAM code address), TEMP_ARG0 * call nbif_callemu ! clobbers RA! * mov N, TEMP_ARG1 ! delay slot: TEMP_ARG1 := ARITY * @@ -165,12 +165,12 @@ */ .global nbif_callemu nbif_callemu: - st TEMP_ARG0, [P+P_CALLEE_EXP] + st TEMP_ARG0, [P+P_BEAM_IP] st TEMP_ARG1, [P+P_ARITY] st TEMP_RA, [P+P_NRA] STORE_ARG_REGS ba .flush_exit - mov HIPE_MODE_SWITCH_RES_CALL_EXPORTED, %o0 + mov HIPE_MODE_SWITCH_RES_CALL, %o0 /* * nbif_apply @@ -317,7 +317,6 @@ .global nbif_1_gc_after_bif .global nbif_2_gc_after_bif .global nbif_3_gc_after_bif - .global nbif_4_gc_after_bif nbif_0_gc_after_bif: ba .gc_after_bif mov 0, %o1 /* delay slot */ @@ -328,10 +327,7 @@ ba .gc_after_bif mov 2, %o1 /* delay slot */ nbif_3_gc_after_bif: - ba .gc_after_bif - mov 3, %o1 /* delay slot */ -nbif_4_gc_after_bif: - mov 4, %o1 + mov 3, %o1 /*FALLTHROUGH*/ .gc_after_bif: st %o1, [P+P_NARITY] @@ -369,11 +365,7 @@ mov 2, %o1 /* delay slot */ .global nbif_3_simple_exception nbif_3_simple_exception: - ba .nbif_simple_exception - mov 3, %o1 /* delay slot */ - .global nbif_4_simple_exception -nbif_4_simple_exception: - mov 4, %o1 + mov 3, %o1 /*FALLTHROUGH*/ .nbif_simple_exception: ld [P+P_FREASON], %o0 diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -48,4 +47,8 @@ extern void hipe_sparc_inc_stack(void); +/* for hipe_bifs_enter_code_2 */ +extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); +#define HIPE_ALLOC_CODE(n,c,t,p) hipe_alloc_code((n),(c),(t),(p)) + #endif /* HIPE_SPARC_H */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_primops.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_primops.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc_primops.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc_primops.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_sparc.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_sparc.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_stack.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_stack.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_stack.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_stack.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_stack.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_stack.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_stack.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_stack.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -109,23 +108,12 @@ #if 0 && defined(HIPE_NSTACK_GROWS_UP) #define hipe_nstack_start(p) ((p)->hipe.nstack) #define hipe_nstack_used(p) ((p)->hipe.nsp - (p)->hipe.nstack) -#define hipe_nstack_avail(p) ((p)->hipe.nstend - (p)->hipe.nsp) #endif #if defined(HIPE_NSTACK_GROWS_DOWN) #define hipe_nstack_start(p) ((p)->hipe.nsp) #define hipe_nstack_used(p) ((p)->hipe.nstend - (p)->hipe.nsp) -#define hipe_nstack_avail(p) ((unsigned)((p)->hipe.nsp - (p)->hipe.nstack)) #endif -/* ensure that at least nwords words are available on the native stack */ -static __inline__ void hipe_check_nstack(Process *p, unsigned nwords) -{ - extern void hipe_inc_nstack(Process *p); - - while (hipe_nstack_avail(p) < nwords) - hipe_inc_nstack(p); -} - /* * GC support procedures */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_abi.txt erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_abi.txt --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_abi.txt 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_abi.txt 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ Copyright Ericsson AB 2001-2011. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_asm.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_asm.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_asm.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_asm.m4 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 2002-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -34,18 +33,6 @@ `#define X86_LEAF_WORDS 'LEAF_WORDS `#define LEAF_WORDS 'LEAF_WORDS -`#define X86_NR_ARG_REGS 'NR_ARG_REGS -`#define NR_ARG_REGS 'NR_ARG_REGS - -`#define X86_HP_IN_ESI 'HP_IN_ESI -`#define X86_SIMULATE_NSP 'SIMULATE_NSP - - -`#ifdef ASM' -/* - * Only assembler stuff from here on (when included from *.S) - */ - /* * Workarounds for Darwin. */ @@ -73,6 +60,7 @@ */ `#define P %ebp' +`#define X86_HP_IN_ESI 'HP_IN_ESI `#if X86_HP_IN_ESI #define SAVE_HP movl %esi, P_HP(P) #define RESTORE_HP movl P_HP(P), %esi @@ -85,6 +73,7 @@ #define SAVE_CSP movl %esp, P_CSP(P) #define RESTORE_CSP movl P_CSP(P), %esp' +`#define X86_SIMULATE_NSP 'SIMULATE_NSP /* * Context switching macros. @@ -111,10 +100,12 @@ SAVE_CACHED_STATE; \ SWITCH_ERLANG_TO_C_QUICK' - /* * Argument (parameter) registers. */ +`#define X86_NR_ARG_REGS 'NR_ARG_REGS +`#define NR_ARG_REGS 'NR_ARG_REGS + ifelse(eval(NR_ARG_REGS >= 1),0,, ``#define ARG0 %eax '')dnl @@ -213,7 +204,6 @@ `/* #define NBIF_COPY_NSP_1 'NBIF_COPY_NSP(1)` */' `/* #define NBIF_COPY_NSP_2 'NBIF_COPY_NSP(2)` */' `/* #define NBIF_COPY_NSP_3 'NBIF_COPY_NSP(3)` */' -`/* #define NBIF_COPY_NSP_4 'NBIF_COPY_NSP(4)` */' `/* #define NBIF_COPY_NSP_5 'NBIF_COPY_NSP(5)` */' dnl @@ -237,10 +227,6 @@ `/* #define NBIF_ARG_OPND_3_0 'NBIF_ARG_OPND(3,0)` */' `/* #define NBIF_ARG_OPND_3_1 'NBIF_ARG_OPND(3,1)` */' `/* #define NBIF_ARG_OPND_3_2 'NBIF_ARG_OPND(3,2)` */' -`/* #define NBIF_ARG_OPND_4_0 'NBIF_ARG_OPND(4,0)` */' -`/* #define NBIF_ARG_OPND_4_1 'NBIF_ARG_OPND(4,1)` */' -`/* #define NBIF_ARG_OPND_4_2 'NBIF_ARG_OPND(4,2)` */' -`/* #define NBIF_ARG_OPND_4_3 'NBIF_ARG_OPND(4,3)` */' `/* #define NBIF_ARG_OPND_5_0 'NBIF_ARG_OPND(5,0)` */' `/* #define NBIF_ARG_OPND_5_1 'NBIF_ARG_OPND(5,1)` */' `/* #define NBIF_ARG_OPND_5_2 'NBIF_ARG_OPND(5,2)` */' @@ -280,7 +266,6 @@ `/* #define NBIF_RET_1 'NBIF_RET(1)` */' `/* #define NBIF_RET_2 'NBIF_RET(2)` */' `/* #define NBIF_RET_3 'NBIF_RET(3)` */' -`/* #define NBIF_RET_4 'NBIF_RET(4)` */' `/* #define NBIF_RET_5 'NBIF_RET(5)` */' dnl @@ -297,6 +282,4 @@ `#define STORE_CALLER_SAVE 'STORE_CALLER_SAVE `#define LOAD_CALLER_SAVE 'LOAD_CALLER_SAVE -`#endif /* ASM */' - `#endif /* HIPE_X86_ASM_H */' diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_bifs.m4 erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_bifs.m4 --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_bifs.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_bifs.m4 2014-09-16 19:10:57.000000000 +0000 @@ -4,23 +4,21 @@ * * Copyright Ericsson AB 2001-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -#`define ASM' include(`hipe/hipe_x86_asm.m4') #`include' "config.h" #`include' "hipe_literals.h" @@ -49,10 +47,9 @@ * standard_bif_interface_1(nbif_name, cbif_name) * standard_bif_interface_2(nbif_name, cbif_name) * standard_bif_interface_3(nbif_name, cbif_name) - * standard_bif_interface_4(nbif_name, cbif_name) * standard_bif_interface_0(nbif_name, cbif_name) * - * Generate native interface for a BIF with 0-4 parameters and + * Generate native interface for a BIF with 0-3 parameters and * standard failure mode. */ define(standard_bif_interface_1, @@ -159,43 +156,6 @@ SET_SIZE(ASYM($1)) TYPE_FUNCTION(ASYM($1)) #endif') - -define(standard_bif_interface_4, -` -#ifndef HAVE_$1 -#`define' HAVE_$1 - TEXT - .align 4 - GLOBAL(ASYM($1)) -ASYM($1): - /* copy native stack pointer */ - NBIF_COPY_NSP(4) - - /* switch to C stack */ - SWITCH_ERLANG_TO_C - - /* make the call on the C stack */ - NBIF_ARG_REG(0,P) - NBIF_ARG(2,4,0) - NBIF_ARG(3,4,1) - NBIF_ARG(4,4,2) - NBIF_ARG(5,4,3) - lea 8(%esp), %eax - NBIF_ARG_REG(1,%eax) /* BIF__ARGS */ - CALL_BIF($2) - TEST_GOT_MBUF - - /* switch to native stack */ - SWITCH_C_TO_ERLANG - - /* throw exception if failure, otherwise return */ - TEST_GOT_EXN - jz nbif_4_simple_exception - NBIF_RET(4) - HANDLE_GOT_MBUF(4) - SET_SIZE(ASYM($1)) - TYPE_FUNCTION(ASYM($1)) -#endif') define(standard_bif_interface_0, ` diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -109,7 +108,7 @@ #define MAP_ANONYMOUS MAP_ANON #endif -static int morecore(unsigned int alloc_bytes) +static void morecore(unsigned int alloc_bytes) { unsigned int map_bytes; char *map_hint, *map_start; @@ -137,9 +136,10 @@ #endif , -1, 0); - if (map_start == MAP_FAILED) - return -1; - + if (map_start == MAP_FAILED) { + perror("mmap"); + abort(); + } ALLOC_CODE_STATS(total_mapped += map_bytes); /* Merge adjacent mappings, so the trailing portion of the previous @@ -155,8 +155,6 @@ } ALLOC_CODE_STATS(atexit_alloc_code_stats()); - - return 0; } static void *alloc_code(unsigned int alloc_bytes) @@ -166,8 +164,8 @@ /* Align function entries. */ alloc_bytes = (alloc_bytes + 3) & ~3; - if (code_bytes < alloc_bytes && morecore(alloc_bytes) != 0) - return NULL; + if (code_bytes < alloc_bytes) + morecore(alloc_bytes); ALLOC_CODE_STATS(++nr_allocs); ALLOC_CODE_STATS(total_alloc += alloc_bytes); res = code_next; @@ -184,16 +182,18 @@ return alloc_code(nrbytes); } -void *hipe_make_native_stub(void *callee_exp, unsigned int beamArity) +/* called from hipe_bif0.c:hipe_bifs_make_native_stub_2() + and hipe_bif0.c:hipe_make_stub() */ +void *hipe_make_native_stub(void *beamAddress, unsigned int beamArity) { /* * This creates a native code stub with the following contents: * - * movl $Address, P_CALLEE_EXP(%ebp) + * movl $Address, P_BEAM_IP(%ebp) * movb $Arity, P_ARITY(%ebp) * jmp callemu * - * The stub has variable size, depending on whether the P_CALLEE_EXP + * The stub has variable size, depending on whether the P_BEAM_IP * and P_ARITY offsets fit in 8-bit signed displacements or not. * The rel32 offset in the final jmp depends on its actual location, * which also depends on the size of the previous instructions. @@ -206,30 +206,28 @@ codeSize = /* 16, 19, or 22 bytes */ 16 + /* 16 when both offsets are 8-bit */ - (P_CALLEE_EXP >= 128 ? 3 : 0) + + (P_BEAM_IP >= 128 ? 3 : 0) + (P_ARITY >= 128 ? 3 : 0); codep = code = alloc_code(codeSize); - if (!code) - return NULL; - /* movl $beamAddress, P_CALLEE_EXP(%ebp); 3 or 6 bytes, plus 4 */ + /* movl $beamAddress, P_BEAM_IP(%ebp); 3 or 6 bytes, plus 4 */ codep[0] = 0xc7; -#if P_CALLEE_EXP >= 128 +#if P_BEAM_IP >= 128 codep[1] = 0x85; /* disp32[EBP] */ - codep[2] = P_CALLEE_EXP & 0xFF; - codep[3] = (P_CALLEE_EXP >> 8) & 0xFF; - codep[4] = (P_CALLEE_EXP >> 16) & 0xFF; - codep[5] = (P_CALLEE_EXP >> 24) & 0xFF; + codep[2] = P_BEAM_IP & 0xFF; + codep[3] = (P_BEAM_IP >> 8) & 0xFF; + codep[4] = (P_BEAM_IP >> 16) & 0xFF; + codep[5] = (P_BEAM_IP >> 24) & 0xFF; codep += 6; #else codep[1] = 0x45; /* disp8[EBP] */ - codep[2] = P_CALLEE_EXP; + codep[2] = P_BEAM_IP; codep += 3; #endif - codep[0] = ((unsigned int)callee_exp) & 0xFF; - codep[1] = ((unsigned int)callee_exp >> 8) & 0xFF; - codep[2] = ((unsigned int)callee_exp >> 16) & 0xFF; - codep[3] = ((unsigned int)callee_exp >> 24) & 0xFF; + codep[0] = ((unsigned int)beamAddress) & 0xFF; + codep[1] = ((unsigned int)beamAddress >> 8) & 0xFF; + codep[2] = ((unsigned int)beamAddress >> 16) & 0xFF; + codep[3] = ((unsigned int)beamAddress >> 24) & 0xFF; codep += 4; /* movb $beamArity, P_ARITY(%ebp); 3 or 6 bytes */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_gc.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_gc.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_gc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_gc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_glue.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_glue.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_glue.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_glue.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -208,14 +207,6 @@ return 0; } -/* Native called BIF. Is it a recursive call? - i.e should we return back to native when BIF is done? */ -static __inline__ int -hipe_bifcall_from_native_is_recursive(Process *p) -{ - return (*p->hipe.nsp != (Eterm)nbif_return); -} - /* Native makes a call which needs to unload the parameters. This differs from hipe_call_from_native_is_recursive() in diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_glue.S erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_glue.S --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_glue.S 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_glue.S 2014-09-16 19:10:57.000000000 +0000 @@ -4,24 +4,24 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -#define ASM + #include "hipe_x86_asm.h" #include "hipe_literals.h" +#define ASM #include "hipe_mode_switch.h" /* @@ -104,7 +104,7 @@ * stub (hipe_x86_loader.erl) which should look as follows: * * stub for f/N: - * movl $, P_CALLEE_EXP(P) + * movl $, P_BEAM_IP(P) * movb $, P_ARITY(P) * jmp nbif_callemu * @@ -114,7 +114,7 @@ GLOBAL(ASYM(nbif_callemu)) ASYM(nbif_callemu): STORE_ARG_REGS - movl $HIPE_MODE_SWITCH_RES_CALL_EXPORTED, %eax + movl $HIPE_MODE_SWITCH_RES_CALL, %eax jmp .suspend_exit /* @@ -300,7 +300,6 @@ GLOBAL(nbif_1_gc_after_bif) GLOBAL(nbif_2_gc_after_bif) GLOBAL(nbif_3_gc_after_bif) - GLOBAL(nbif_4_gc_after_bif) .align 4 nbif_0_gc_after_bif: xorl %edx, %edx @@ -316,10 +315,6 @@ .align 4 nbif_3_gc_after_bif: movl $3, %edx - jmp .gc_after_bif - .align 4 -nbif_4_gc_after_bif: - movl $4, %edx /*FALLTHROUGH*/ .align 4 .gc_after_bif: @@ -343,7 +338,6 @@ GLOBAL(nbif_1_simple_exception) GLOBAL(nbif_2_simple_exception) GLOBAL(nbif_3_simple_exception) - GLOBAL(nbif_4_simple_exception) .align 4 nbif_0_simple_exception: xorl %eax, %eax @@ -359,10 +353,6 @@ .align 4 nbif_3_simple_exception: movl $3, %eax - jmp .nbif_simple_exception - .align 4 -nbif_4_simple_exception: - movl $4, %eax /*FALLTHROUGH*/ .align 4 .nbif_simple_exception: diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -54,4 +53,8 @@ extern void nbif_handle_fp_exception(void); #endif +/* for hipe_bifs_enter_code_2 */ +extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); +#define HIPE_ALLOC_CODE(n,c,t,p) hipe_alloc_code((n),(c),(t),(p)) + #endif /* HIPE_X86_H */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_primops.h erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_primops.h --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_primops.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_primops.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_signal.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_signal.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_signal.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_signal.c 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 2001-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -198,7 +197,7 @@ #define INIT() do { if (!init_done()) do_init(); } while (0) #endif /* __DARWIN__ */ -#if defined(__sun__) +#if !defined(__GLIBC__) && !defined(__DARWIN__) && !defined(__NetBSD__) /* * Assume Solaris/x86 2.8. * There is a number of sigaction() procedures in libc: @@ -232,34 +231,7 @@ } #define _NSIG NSIG #define INIT() do { if (!init_done()) do_init(); } while (0) -#endif /* __sun__ */ - -#if !(defined(__GLIBC__) || defined(__DARWIN__) || defined(__NetBSD__) || defined(__sun__)) -/* - * Unknown libc -- assume musl. Note: musl deliberately does not provide a musl-specific - * feature test macro, so we cannot check for it. - * - * sigaction is a weak alias for __sigaction, which is a wrapper for __libc_sigaction. - * There are libc-internal calls to __libc_sigaction which install handlers, so we must - * override __libc_sigaction rather than __sigaction. - */ -#include -static int (*__next_sigaction)(int, const struct sigaction*, struct sigaction*); -#define init_done() (__next_sigaction != 0) -#define __SIGACTION __libc_sigaction -static void do_init(void) -{ - __next_sigaction = dlsym(RTLD_NEXT, "__libc_sigaction"); - if (__next_sigaction != 0) - return; - perror("dlsym"); - abort(); -} -#ifndef _NSIG -#define _NSIG NSIG -#endif -#define INIT() do { if (!init_done()) do_init(); } while (0) -#endif /* !(__GLIBC__ || __DARWIN__ || __NetBSD__ || __sun__) */ +#endif /* not glibc or darwin */ #if !defined(__NetBSD__) /* diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_stack.c erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_stack.c --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86_stack.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86_stack.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -210,7 +209,7 @@ * The native stack MUST contain a stack frame as it appears on * entry to a function (return address, actuals, caller's frame). * p->hipe.narity MUST contain the arity (number of actuals). - * On exit, p->hipe.u.ncallee is set to the handler's PC and p->hipe.nsp + * On exit, p->hipe.ncallee is set to the handler's PC and p->hipe.nsp * is set to its SP (low address of its stack frame). */ void hipe_find_handler(Process *p) @@ -241,7 +240,7 @@ if ((exnra = sdesc_exnra(sdesc)) != 0 && (p->catches >= 0 || exnra == (unsigned long)nbif_fail)) { - p->hipe.u.ncallee = (void(*)(void)) exnra; + p->hipe.ncallee = (void(*)(void)) exnra; p->hipe.nsp = nsp; p->hipe.narity = 0; /* update the gray/white boundary if we threw past it */ diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86.tab erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86.tab --- erlang-18.2-dfsg/erts/emulator/hipe/hipe_x86.tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/hipe_x86.tab 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/hipe/TODO erlang-17.3-dfsg/erts/emulator/hipe/TODO --- erlang-18.2-dfsg/erts/emulator/hipe/TODO 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/hipe/TODO 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ Copyright Ericsson AB 2004-2009. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/emulator/internal_doc/CarrierMigration.md erlang-17.3-dfsg/erts/emulator/internal_doc/CarrierMigration.md --- erlang-18.2-dfsg/erts/emulator/internal_doc/CarrierMigration.md 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/internal_doc/CarrierMigration.md 2014-09-16 19:10:57.000000000 +0000 @@ -16,12 +16,12 @@ is deallocated. Since multiblock carriers can contain both allocated blocks and free blocks at the same time, an allocator instance might be stuck with a large amount of poorly utilized carriers if the memory -load decreases. After a peak in memory usage it is expected that not -all memory can be returned since the blocks still allocated are likely +load decrease. After a peak in memory usage it is expected that not +all memory can be returned since the blocks still allocated is likely to be dispersed over multiple carriers. Such poorly utilized carriers -can usually be reused if the memory load increases again. However, +can usually be reused if the memory load increase again. However, since each scheduler thread manages its own set of allocator -instances, and memory load is not necessarily correlated to CPU load, we +instances, and memory load is not necessarily connected to CPU load we might get into a situation where there are lots of poorly utilized multiblock carriers on some allocator instances while we need to allocate new multiblock carriers on other allocator instances. In @@ -50,13 +50,13 @@ can be referred to from potentially every other carrier that is managed, and the amount of such references can be huge. That is, the work of removing the free blocks of such a carrier from the search -tree will be huge. One way of solving this could be not to migrate +tree will be huge. One way of solving this could be to not migrate carriers that contain lots of free blocks, but this would prevent us -from migrating carriers that potentially need to be migrated in order +from migrating carriers that potentially needs to be migrated in order to solve the problem we set out to solve. By using one data structure of free blocks in each carrier and an -allocator instance-wide data structure of carriers managed by the +allocator instance wide data structure of carriers managed by the allocator instance, the work needed in order to remove and add carriers can be kept to a minimum. When migration of carriers is enabled on a specific allocator type, we require that an allocation @@ -76,9 +76,9 @@ complete, one scheduler needs to move the carrier into the pool, and another scheduler needs to take the carrier out of the pool. -The pool is implemented as a lock-free, circular, double linked, +The pool is implemented as a lock free, circular, double linked, list. The list contains a sentinel which is used as the starting point -when inserting to, or fetching from, the pool. Carriers in the pool are +when inserting to, or fetching from the pool. Carriers in the pool are elements in this list. The list can be modified by all scheduler threads @@ -108,19 +108,19 @@ were to modify the sentinel, the cache line containing the sentinel would unnecessarily be bounced between processors. -The `prev` and `next` fields in the elements of the list contain the +The `prev`, and `next` fields in the elements of the list contains the value of the pointer, a modification marker, and a deleted marker. Memory operations on these fields are done using atomic memory operations. When a thread has set the modification marker in a field, no-one except the thread that set the marker is allowed to modify the -field. If multiple modification markers need to be set, we always +field. If multiple modification markers needs to be set, we always begin with `next` fields followed by `prev` fields in the order following the actual pointers. This guarantees that no deadlocks will occur. When a carrier is being removed from a pool, we mark it with a thread progress value that needs to be reached before we are allowed to -modify the `next` and `prev` fields. That is, until we reach this +modify the `next`, and `prev` fields. That is, until we reach this thread progress we are not allowed to insert the carrier into the pool again, and we are not allowed to deallocate the carrier. This ensures that threads inspecting the pool always will be able to traverse the @@ -130,12 +130,12 @@ ### Migration ### -There exists one pool for each allocator type enabling migration of +There exist one pool for each allocator type enabling migration of carriers between scheduler specific allocator instances of the same allocator type. Each allocator instance keeps track of the current utilization of its -multiblock carriers. When the total utilization falls below the "abandon +multiblock carriers. When the utilization falls below the "abandon carrier utilization limit" it starts to inspect the utilization of the current carrier when deallocations are made. If also the utilization of the carrier falls below the "abandon carrier utilization limit" it @@ -146,53 +146,28 @@ available free blocks, no more allocations will be made in the carrier. The allocator instance putting the carrier into the pool, however, still has the responsibility of performing deallocations in -it while it remains in the pool. The allocator instance with this -deallocation responsibility is here called the **employer**. +it while it remains in the pool. -Each carrier has a flag field containing information about the -employing allocator instance, a flag indicating if the carrier is in +Each carrier has a flag field containing information about allocator +instance owning the carrier, a flag indicating if the carrier is in the pool or not, and a flag indicating if it is busy or not. When the -carrier is in the pool, the employing allocator instance needs to mark it +carrier is in the pool, the owning allocator instance needs to mark it as busy while operating on it. If another thread inspects it in order -to try to fetch it from the pool, it will skip it if it is busy. When -fetching the carrier from the pool, employment will change and further -deallocations in the carrier will be redirected to the new -employer using the delayed dealloc functionality. +to try to fetch it from the pool, it will abort the fetch if it is +busy. When fetching the carrier from the pool, ownership will changed +and further deallocations in the carrier will be redirected to the new +owner using the delayed dealloc functionality. If a carrier in the pool becomes empty, it will be withdrawn from the pool. All carriers that become empty are also always passed to its -**owning** allocator instance for deallocation using the delayed +originating allocator instance for deallocation using the delayed dealloc functionality. Since carriers this way always will be -deallocated by the owner that allocated the carrier, the +deallocated by the allocator instance that allocated the carrier the underlying functionality of allocating and deallocating carriers can remain simple and doesn't have to bother about multiple threads. In a NUMA system we will also not mix carriers originating from multiple NUMA nodes. -In short: - -* The allocator instance that created a carrier **owns** it. -* An empty carrier is always deallocated by its **owner**. -* **Ownership** never changes. -* The allocator instance that uses a carrier **employs** it. -* An **employer** can abandon a carrier into the pool. -* Pooled carriers are not allocated from. -* Deallocation in a pooled carrier is still performed by its **employer**. -* **Employment** can only change when a carrier is fetched from the pool. - -### Searching the pool ### - -To harbor real time characteristics, searching the pool is -limited. We only inspect a limited number of carriers. If none of -those carriers had a free block large enough to satisfy the allocation -request, the search will fail. A carrier in the pool can also be busy -if another thread is currently doing block deallocation work on the -carrier. A busy carrier will also be skipped by the search as it can -not satisfy the request. The pool is lock-free and we do not want to -block, waiting for the other thread to finish. - -#### Before OTP 17.4 #### - When an allocator instance needs more carrier space, it always begins by inspecting its own carriers that are waiting for thread progress before they can be deallocated. If no such carrier could be found, it @@ -201,69 +176,10 @@ instance gets the carrier from it the just links in the carrier into its data structure of free blocks. -#### After OTP 17.4 #### - -The old search algorithm had a problem as the search always started at -the same position in the pool, the sentinel. This could lead to -contention from concurrent searching processes. But even worse, it -could lead to a "bad" state when searches fail with a high rate -leading to new carriers instead being allocated. These new carriers -may later be inserted into the pool due to bad utilization. If the -frequency of insertions into the pool is higher than successful -fetching from the pool, memory will eventually get exhausted. - -This "bad" state consists of a cluster of small and/or highly -fragmented carriers located at the sentinel in the pool. The largest free -block in such a "bad" carrier is rather small, making it unable to satisfy -most allocation requests. As the search always started at the -sentinel, any such "bad" carriers that had been left in the pool would -eventually cluster together at the sentinel. All searches first -have to skip past this cluster of "bad" carriers to reach a "good" -carrier. When the cluster gets to the same size as the search limit, -all searches will essentially fail. - -To counter the "bad cluster" problem and also ease the contention, the -search will now always start by first looking at the allocators **own** -carriers. That is, carriers that were initially created by the -allocator itself and later had been abandoned to the pool. If none of -our own abandoned carrier would do, then the search continues into the -pool, as before, to look for carriers created by other -allocators. However, if we have at least one abandoned carrier of our -own that could not satisfy the request, we can use that as entry point -into the pool. - -The result is that we prefer carriers created by the thread itself, -which is good for NUMA performance. And we get more entry points when -searching the pool, which will ease contention and clustering. - -To do the first search among own carriers, every allocator instance -has two new lists: `pooled_list` and `traitor_list`. These lists are only -accessed by the allocator itself and they only contain the allocator's -own carriers. When an owned carrier is abandoned and put in the -pool, it is also linked into `pooled_list`. When we search our -`pooled_list` and find a carrier that is no longer in the pool, we -move that carrier from `pooled_list` to `traitor_list` as it is now -employed by another allocator. If searching `pooled_list` fails, we -also do a limited search of `traitor_list`. When finding an abandoned -carrier in `traitor_list` it is either employed or moved back to -`pooled_list` if it could not satisfy the allocation request. - -When searching `pooled_list` and `traitor_list` we always start at the -point where the last search ended. This to avoid clustering -problems and increase the probability to find a "good" carrier. As -`pooled_list` and `traitor_list` are only accessed by the owning -allocator instance, they need no thread synchronization at all. - -Furthermore, the search for own carriers that are scheduled -for deallocation is now done as the last search option. The idea is -that it is better to reuse a poorly utilized carrier than to -resurrect an empty carrier that was just about to be released back to -the OS. - ### Result ### The use of this strategy of abandoning carriers with poor utilization -and reusing them in allocator instances with an increased carrier +and reusing these in allocator instances with an increased carrier demand is extremely effective and completely eliminates the problems that otherwise sometimes occurred when CPU load dropped while memory load did not. diff -Nru erlang-18.2-dfsg/erts/emulator/internal_doc/dec.erl erlang-17.3-dfsg/erts/emulator/internal_doc/dec.erl --- erlang-18.2-dfsg/erts/emulator/internal_doc/dec.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/internal_doc/dec.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -65,17 +64,18 @@ "*~n" "* Copyright Ericsson AB 1999-2010. All Rights Reserved.~n" "*~n" - "* Licensed under the Apache License, Version 2.0 (the \"License\");~n" - "* you may not use this file except in compliance with the License.~n" - "* You may obtain a copy of the License at~n" - "*~n" - "* http://www.apache.org/licenses/LICENSE-2.0~n" + "* The contents of this file are subject to the Erlang Public License,~n" + "* Version 1.1, (the \"License\"); you may not use this file except in~n" + "* compliance with the License. You should have received a copy of the~n" + "* Erlang Public License along with this software. If not, it can be~n" + "* retrieved online at http://www.erlang.org/.~n" "*~n" - "* Unless required by applicable law or agreed to in writing, software~n" - "* distributed under the License is distributed on an \"AS IS\" BASIS,~n" - "* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.~n" - "* See the License for the specific language governing permissions and~n" - "* limitations under the License.~n" + "* Software distributed under the License is distributed on an " + "\"AS IS\"~n" + "* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See~n" + "* the License for the specific language governing rights and " + "limitations~n" + "* under the License.~n" "*~n" "* %CopyrightEnd%~n" "*/~n" diff -Nru erlang-18.2-dfsg/erts/emulator/internal_doc/erl_ext_dist.txt erlang-17.3-dfsg/erts/emulator/internal_doc/erl_ext_dist.txt --- erlang-18.2-dfsg/erts/emulator/internal_doc/erl_ext_dist.txt 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/internal_doc/erl_ext_dist.txt 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ Copyright Ericsson AB 1997-2009. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/emulator/internal_doc/SuperCarrier.md erlang-17.3-dfsg/erts/emulator/internal_doc/SuperCarrier.md --- erlang-18.2-dfsg/erts/emulator/internal_doc/SuperCarrier.md 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/internal_doc/SuperCarrier.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,191 +0,0 @@ -Super Carrier -============= - -A super carrier is large memory area, allocated at VM start, which can -be used during runtime to allocate normal carriers from. - -The super carrier feature was introduced in OTP R16B03. It is -enabled with command line option +MMscs -and can be configured with other options. - -Problem -------- - -The initial motivation for this feature was customers asking for a way -to pre-allocate physcial memory at VM start for it to use. - -Other problems were different experienced limitations of the OS -implementation of mmap: - -* Increasingly bad performance of mmap/munmap as the number of mmap'ed areas grow. -* Fragmentation problem between mmap'ed areas. - -A third problem was management of low memory in the halfword -emulator. The implementation used a naive linear search structure to -hold free segments which would lead to poor performance when -fragmentation increased. - - -Solution --------- - -Allocate one large continious area of address space at VM start and -then use that area to satisfy our dynamic memory need during -runtime. In other words: implement our own mmap. - -### Use cases ### - -If command line option +MMscrpm (Reserve Physical Memory) is set to -false, only virtual space is allocated for the super carrier from -start. The super carrier then acts as an "alternative mmap" implementation -without changing the consumption of physical memory pages. Physical -pages will be reserved on demand when an allocation is done from the super -carrier and be unreserved when the memory is released back to the -super carrier. - -If +MMscrpm is set to true, which is default, the initial allocation -will reserve physical memory for the entire super carrier. This can be -used by users that want to ensure a certain *minimum* amount of -physical memory for the VM. - -However, what reservation of physical memory actually means highly -depends on the operating system, and how it is configured. For -example, different memory overcommit settings on Linux drastically -change the behaviour. - -A third feature is to have the super carrier limit the *maximum* -amount of memory used by the VM. If +MMsco (Super Carrier Only) is set -to true, which is default, allocations will only be done from the -super carrier. When the super carrier gets full, the VM will fail due -to out of memory. -If +MMsco is false, allocations will use mmap directly if the super -carrier is full. - - - -### Implementation ### - -The entire super carrier implementation is kept in erl_mmap.c. The -name suggest that it can be viewed as our own mmap implementation. - -A super carrier needs to satisfy two slightly different kinds of -allocation requests; multi block carriers (MBC) and single block -carriers (SBC). They are both rather large blocks of continious -memory, but MBCs and SBCs have different demands on alignment and -size. - -SBCs can have arbitrary size and do only need minimum 8-byte -alignment. - -MBCs are more restricted. They can only have a number of fixed -sizes that are powers of 2. The start address need to have a very -large aligment (currently 256 kb, called "super alignment"). This is a -design choice that allows very low overhead per allocated block in the -MBC. - -To reduce fragmentation within the super carrier, it is good to keep SBCs -and MBCs apart. MBCs with their uniform alignment and sizes can be -packed very efficiently together. SBCs without demand for aligment can -also be allocated quite efficiently together. But mixing them can lead -to a lot of memory wasted when we need to create large holes of -padding to the next alignment limit. - -The super carrier thus contains two areas. One area for MBCs growing from -the bottom and up. And one area for SBCs growing from the top and -down. Like a process with a heap and a stack growing towards each -other. - - -### Data structures ### - -The MBC area is called **sa** as in super aligned and the SBC area is -called **sua** as in super un-aligned. - -Note that the "super" in super alignment and the "super" in super -carrier has nothing to do with each other. We could have choosen -another naming to avoid confusion, such as "meta" carrier or "giant" -aligment. - - +-------+ <---- sua.top - | sua | - | | - |-------| <---- sua.bot - | | - | | - | | - |-------| <---- sa.top - | | - | sa | - | | - +-------+ <---- sa.bot - - -When a carrier is deallocated a free memory segment will be created -inside the corresponding area, unless the carrier was at the very top -(in `sa`) or bottom (in `sua`) in which case the area will just shrink -down or up. - -We need to keep track of all the free segments in order to reuse them -for new carrier allocations. One initial idea was to use the same -mechanism that is used to keep track of free blocks within MBCs -(alloc_util and the different strategies). However, that would not be -as straight forward as one can think and can also waste quite a lot of -memory as it uses prepended block headers. The granularity of the -super carrier is one memory page (usually 4kb). We want to allocate -and free entire pages and we don't want to waste an entire page just -to hold the block header of the following pages. - -Instead we store the meta information about all the free segments in a -dedicated area apart from the `sa` and `sua` areas. Every free segment is -represented by a descriptor struct (`ErtsFreeSegDesc`). - - typedef struct { - RBTNode snode; /* node in 'stree' */ - RBTNode anode; /* node in 'atree' */ - char* start; - char* end; - }ErtsFreeSegDesc; - -To find the smallest free segment that will satisfy a carrier allocation -(best fit), the free segments are organized in a tree sorted by -size (`stree`). We search in this tree at allocation. If no free segment of -sufficient size was found, the area (`sa` or `sua`) is instead expanded. -If two or more free segments with equal size exist, the one at lowest -address is choosen for `sa` and highest address for `sua`. - -At carrier deallocation, we want to coalesce with any adjacent free -segments, to form one large free segment. To do that, all free -segments are also organized in a tree sorted in address order (`atree`). - -So, in total we keep four trees of free descriptors for the super -carrier; two for `sa` and two for `sua`. They all use the same -red-black-tree implementation that support the different sorting -orders used. - -When allocating a new MBC we first search after a free segment in `sa`, -then try to raise `sa.top`, and then as a fallback try to search after a -free segment in `sua`. When an MBC is allocated in `sua`, a larger segment -is allocated which is then trimmed to obtain the right -alignment. Allocation search for an SBC is done in reverse order. When -an SBC is allocated in `sa`, the size is aligned up to super aligned -size. - -### The free descriptor area ### - -As mentioned above, the descriptors for the free segments are -allocated in a separate area. This area has a constant configurable -size (+MMscrfsd) that defaults to 65536 descriptors. This should be -more than enough in most cases. If the descriptors area should fill up, -new descriptor areas will be allocated first directly from the OS, and -then from `sua` and `sa` in the super carrier, and lastly from the memory -segment itself which is being deallocated. Allocating free descriptor -areas from the super carrier is only a last resort, and should be -avoided, as it creates fragmentation. - -### Halfword emulator ### - -The halfword emulator uses the super carrier implementation to manage -its low memory mappings thar are needed for all term storage. The -super carrier can here not be configured by command line options. One -could imagine a second configurable instance of the super carrier used -by high memory allocation, but that has not been implemented. diff -Nru erlang-18.2-dfsg/erts/emulator/Makefile erlang-17.3-dfsg/erts/emulator/Makefile --- erlang-18.2-dfsg/erts/emulator/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/Makefile.in erlang-17.3-dfsg/erts/emulator/Makefile.in --- erlang-18.2-dfsg/erts/emulator/Makefile.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/Makefile.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -113,24 +112,18 @@ else ifeq ($(TYPE),lcnt) -PURIFY = +PURIFY = TYPEMARKER = .lcnt TYPE_FLAGS = @CFLAGS@ -DERTS_ENABLE_LOCK_COUNT else ifeq ($(TYPE),frmptr) -PURIFY = +PURIFY = OMIT_OMIT_FP=yes TYPEMARKER = .frmptr TYPE_FLAGS = @CFLAGS@ -DERTS_FRMPTR else -ifeq ($(TYPE),icount) -PURIFY = -TYPEMARKER = .icount -TYPE_FLAGS = @CFLAGS@ -DERTS_OPCODE_COUNTER_SUPPORT -else - # If type isn't one of the above, it *is* opt type... override TYPE=opt PURIFY = @@ -145,7 +138,6 @@ endif endif endif -endif comma:=, space:= @@ -350,6 +342,16 @@ EPCRE_LIB = $(ERL_TOP)/erts/emulator/pcre/obj/$(TARGET)/$(TYPE)/$(LIB_PREFIX)epcre$(LIB_SUFFIX) DEPLIBS += $(EPCRE_LIB) +PERFCTR_PATH=@PERFCTR_PATH@ +USE_PERFCTR=@USE_PERFCTR@ +ifdef PERFCTR_PATH +LIBS += $(PERFCTR_PATH)/usr.lib/libperfctr.a +else +ifdef USE_PERFCTR +LIBS += -lperfctr +endif +endif + LIBSCTP = @LIBSCTP@ ORG_THR_LIBS=@EMU_THR_LIBS@ @@ -557,6 +559,9 @@ HIPE_arm_TAB=hipe/hipe_arm.tab HIPE_ARCH_TAB=$(HIPE_$(ARCH)_TAB) BIFS += hipe/hipe_bif0.tab hipe/hipe_bif1.tab hipe/hipe_bif2.tab $(HIPE_ARCH_TAB) +ifdef USE_PERFCTR +BIFS += hipe/hipe_perfctr.tab +endif endif $(TARGET)/erl_bif_table.c \ @@ -652,6 +657,10 @@ INCLUDES = -I$(TTF_DIR) $(COMMON_INCLUDES) +ifdef PERFCTR_PATH +INCLUDES += -I$(PERFCTR_PATH)/usr.lib -I$(PERFCTR_PATH)/linux/include +endif + ifeq ($(TARGET),win32) $(OBJDIR)/dll_sys.o: sys/$(ERLANG_OSTYPE)/sys.c $(V_CC) $(CFLAGS) -DERL_RUN_SHARED_LIB=1 $(INCLUDES) -c $< -o $@ @@ -755,8 +764,7 @@ $(OBJDIR)/erl_bif_ddll.o $(OBJDIR)/erl_bif_guard.o \ $(OBJDIR)/erl_bif_info.o $(OBJDIR)/erl_bif_op.o \ $(OBJDIR)/erl_bif_os.o $(OBJDIR)/erl_bif_lists.o \ - $(OBJDIR)/erl_bif_trace.o $(OBJDIR)/erl_bif_unique.o \ - $(OBJDIR)/erl_bif_wrap.o \ + $(OBJDIR)/erl_bif_trace.o $(OBJDIR)/erl_bif_wrap.o \ $(OBJDIR)/erl_trace.o $(OBJDIR)/copy.o \ $(OBJDIR)/utils.o $(OBJDIR)/bif.o \ $(OBJDIR)/io.o $(OBJDIR)/erl_printf_term.o\ @@ -780,7 +788,7 @@ $(OBJDIR)/erl_fun.o $(OBJDIR)/erl_bif_port.o \ $(OBJDIR)/erl_term.o $(OBJDIR)/erl_node_tables.o \ $(OBJDIR)/erl_monitors.o $(OBJDIR)/erl_process_dump.o \ - $(OBJDIR)/erl_hl_timer.o $(OBJDIR)/erl_cpu_topology.o \ + $(OBJDIR)/erl_bif_timer.o $(OBJDIR)/erl_cpu_topology.o \ $(OBJDIR)/erl_drv_thread.o $(OBJDIR)/erl_bif_chksum.o \ $(OBJDIR)/erl_bif_re.o $(OBJDIR)/erl_unicode.o \ $(OBJDIR)/packet_parser.o $(OBJDIR)/safe_hash.o \ @@ -889,8 +897,7 @@ $(OBJDIR)/erl_mmap.o \ $(OBJDIR)/erl_$(ERLANG_OSTYPE)_sys_ddll.o \ $(OBJDIR)/erl_mtrace_sys_wrap.o \ - $(OBJDIR)/erl_sys_common_misc.o \ - $(OBJDIR)/erl_os_monotonic_time_extender.o + $(OBJDIR)/erl_sys_common_misc.o HIPE_ARCH64_OBJS=$(OBJDIR)/hipe_bif64.o @@ -913,11 +920,14 @@ $(OBJDIR)/hipe_mode_switch.o \ $(OBJDIR)/hipe_native_bif.o \ $(OBJDIR)/hipe_stack.o $(HIPE_ARCH_OBJS) +ifdef USE_PERFCTR +HIPE_OBJS += $(OBJDIR)/hipe_perfctr.o +endif ifdef HIPE_ENABLED EXTRA_BASE_OBJS += $(HIPE_OBJS) endif -BASE_OBJS = $(EMU_OBJS) $(RUN_OBJS) $(OS_OBJS) $(EXTRA_BASE_OBJS) +BASE_OBJS = $(RUN_OBJS) $(EMU_OBJS) $(OS_OBJS) $(EXTRA_BASE_OBJS) before_DTrace_OBJS = $(BASE_OBJS) $(DRV_OBJS) diff -Nru erlang-18.2-dfsg/erts/emulator/pcre/pcre.mk erlang-17.3-dfsg/erts/emulator/pcre/pcre.mk --- erlang-18.2-dfsg/erts/emulator/pcre/pcre.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/pcre/pcre.mk 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_check_io.c erlang-17.3-dfsg/erts/emulator/sys/common/erl_check_io.c --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_check_io.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_check_io.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -39,10 +38,9 @@ #include "erl_check_io.h" #include "erl_thr_progress.h" #include "dtrace-wrapper.h" -#define ERTS_WANT_TIMER_WHEEL_API -#include "erl_time.h" -#ifndef ERTS_SYS_CONTINOUS_FD_NUMBERS +#ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS +#else # include "safe_hash.h" # define DRV_EV_STATE_HTAB_SIZE 1024 #endif @@ -54,17 +52,8 @@ #define ERTS_EV_TYPE_STOP_USE ((EventStateType) 3) /* pending stop_select */ typedef char EventStateFlags; -#define ERTS_EV_FLAG_USED ((EventStateFlags) 1) /* ERL_DRV_USE has been turned on */ -#define ERTS_EV_FLAG_DEFER_IN_EV ((EventStateFlags) 2) -#define ERTS_EV_FLAG_DEFER_OUT_EV ((EventStateFlags) 4) +#define ERTS_EV_FLAG_USED ((EventStateFlags) 1) /* ERL_DRV_USE has been turned on */ -#ifdef DEBUG -# define ERTS_ACTIVE_FD_INC 2 -#else -# define ERTS_ACTIVE_FD_INC 128 -#endif - -#define ERTS_CHECK_IO_POLL_RES_LEN 512 #if defined(ERTS_KERNEL_POLL_VERSION) # define ERTS_CIO_EXPORT(FUNC) FUNC ## _kp @@ -78,7 +67,6 @@ (ERTS_POLL_USE_POLL && !ERTS_POLL_USE_KERNEL_POLL) #define ERTS_CIO_POLL_CTL ERTS_POLL_EXPORT(erts_poll_control) -#define ERTS_CIO_POLL_CTLV ERTS_POLL_EXPORT(erts_poll_controlv) #define ERTS_CIO_POLL_WAIT ERTS_POLL_EXPORT(erts_poll_wait) #ifdef ERTS_POLL_NEED_ASYNC_INTERRUPT_SUPPORT #define ERTS_CIO_POLL_AS_INTR ERTS_POLL_EXPORT(erts_poll_async_sig_interrupt) @@ -97,13 +85,6 @@ { ErtsPollSet ps; erts_smp_atomic_t in_poll_wait; /* set while doing poll */ - struct { - int six; /* start index */ - int eix; /* end index */ - erts_smp_atomic32_t no; - int size; - ErtsSysFdType *array; - } active_fd; #ifdef ERTS_SMP struct removed_fd* removed_list; /* list of deselected fd's*/ erts_smp_spinlock_t removed_list_lock; @@ -116,11 +97,9 @@ SafeHashBucket hb; #endif ErtsSysFdType fd; - struct { - ErtsDrvSelectDataState *select; /* ERTS_EV_TYPE_DRV_SEL */ -#if ERTS_CIO_HAVE_DRV_EVENT + union { ErtsDrvEventDataState *event; /* ERTS_EV_TYPE_DRV_EV */ -#endif + ErtsDrvSelectDataState *select; /* ERTS_EV_TYPE_DRV_SEL */ erts_driver_t* drv_ptr; /* ERTS_EV_TYPE_STOP_USE */ } driver; ErtsPollEvents events; @@ -190,10 +169,6 @@ ErtsDrvEventState tmpl; tmpl.fd = fd; tmpl.driver.select = NULL; -#if ERTS_CIO_HAVE_DRV_EVENT - tmpl.driver.event = NULL; -#endif - tmpl.driver.drv_ptr = NULL; tmpl.events = 0; tmpl.remove_cnt = 0; tmpl.type = ERTS_EV_TYPE_NONE; @@ -234,69 +209,6 @@ #endif static ERTS_INLINE void -init_iotask(ErtsIoTask *io_task) -{ - erts_port_task_handle_init(&io_task->task); - erts_smp_atomic_init_nob(&io_task->executed_time, ~((erts_aint_t) 0)); -} - -static ERTS_INLINE int -is_iotask_active(ErtsIoTask *io_task, erts_aint_t current_cio_time) -{ - if (erts_port_task_is_scheduled(&io_task->task)) - return 1; - if (erts_smp_atomic_read_nob(&io_task->executed_time) == current_cio_time) - return 1; - return 0; -} - -static ERTS_INLINE ErtsDrvSelectDataState * -alloc_drv_select_data(void) -{ - ErtsDrvSelectDataState *dsp = erts_alloc(ERTS_ALC_T_DRV_SEL_D_STATE, - sizeof(ErtsDrvSelectDataState)); - dsp->inport = NIL; - dsp->outport = NIL; - init_iotask(&dsp->iniotask); - init_iotask(&dsp->outiotask); - return dsp; -} - -static ERTS_INLINE void -free_drv_select_data(ErtsDrvSelectDataState *dsp) -{ - ASSERT(!erts_port_task_is_scheduled(&dsp->iniotask.task)); - ASSERT(!erts_port_task_is_scheduled(&dsp->outiotask.task)); - erts_free(ERTS_ALC_T_DRV_SEL_D_STATE, dsp); -} - -#if ERTS_CIO_HAVE_DRV_EVENT - -static ERTS_INLINE ErtsDrvEventDataState * -alloc_drv_event_data(void) -{ - ErtsDrvEventDataState *dep = erts_alloc(ERTS_ALC_T_DRV_EV_D_STATE, - sizeof(ErtsDrvEventDataState)); - dep->port = NIL; - dep->data = NULL; - dep->removed_events = 0; -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - dep->deferred_events = 0; -#endif - init_iotask(&dep->iotask); - return dep; -} - -static ERTS_INLINE void -free_drv_event_data(ErtsDrvEventDataState *dep) -{ - ASSERT(!erts_port_task_is_scheduled(&dep->iotask.task)); - erts_free(ERTS_ALC_T_DRV_EV_D_STATE, dep); -} - -#endif /* ERTS_CIO_HAVE_DRV_EVENT */ - -static ERTS_INLINE void remember_removed(ErtsDrvEventState *state, struct pollset_info* psi) { #ifdef ERTS_SMP @@ -376,7 +288,7 @@ drv_ptr = state->driver.drv_ptr; ASSERT(drv_ptr); state->type = ERTS_EV_TYPE_NONE; - state->flags &= ~ERTS_EV_FLAG_USED; + state->flags = 0; state->driver.drv_ptr = NULL; /* Fall through */ case ERTS_EV_TYPE_NONE: @@ -413,16 +325,14 @@ grow_drv_ev_state(int min_ix) { int i; - int old_len; int new_len; - erts_smp_mtx_lock(&drv_ev_state_grow_lock); - old_len = erts_smp_atomic_read_nob(&drv_ev_state_len); - if (min_ix >= old_len) { - new_len = erts_poll_new_table_len(old_len, min_ix + 1); - if (new_len > max_fds) - new_len = max_fds; + new_len = ERTS_POLL_EXPORT(erts_poll_get_table_len)(min_ix + 1); + if (new_len > max_fds) + new_len = max_fds; + erts_smp_mtx_lock(&drv_ev_state_grow_lock); + if (erts_smp_atomic_read_nob(&drv_ev_state_len) <= min_ix) { for (i=0; idriver.event->port, - &state->driver.event->iotask.task, + &state->driver.event->task, ERTS_EV_TYPE_DRV_EV); return; #endif @@ -488,14 +398,14 @@ case ERL_DRV_WRITE: ASSERT(state->type == ERTS_EV_TYPE_DRV_SEL); abort_task(state->driver.select->outport, - &state->driver.select->outiotask.task, + &state->driver.select->outtask, state->type); if (mode == ERL_DRV_WRITE) break; case ERL_DRV_READ: ASSERT(state->type == ERTS_EV_TYPE_DRV_SEL); abort_task(state->driver.select->inport, - &state->driver.select->iniotask.task, + &state->driver.select->intask, state->type); break; default: @@ -533,14 +443,16 @@ if (!(state->events)) { switch (state->type) { case ERTS_EV_TYPE_DRV_SEL: - state->driver.select->inport = NIL; - state->driver.select->outport = NIL; + ASSERT(!erts_port_task_is_scheduled(&state->driver.select->intask)); + ASSERT(!erts_port_task_is_scheduled(&state->driver.select->outtask)); + erts_free(ERTS_ALC_T_DRV_SEL_D_STATE, + state->driver.select); break; #if ERTS_CIO_HAVE_DRV_EVENT case ERTS_EV_TYPE_DRV_EV: - state->driver.event->port = NIL; - state->driver.event->data = NULL; - state->driver.event->removed_events = (ErtsPollEvents) 0; + ASSERT(!erts_port_task_is_scheduled(&state->driver.event->task)); + erts_free(ERTS_ALC_T_DRV_EV_D_STATE, + state->driver.event); break; #endif case ERTS_EV_TYPE_NONE: @@ -550,297 +462,20 @@ break; } + state->driver.select = NULL; state->type = ERTS_EV_TYPE_NONE; - state->flags &= ~ERTS_EV_FLAG_USED; + state->flags = 0; remember_removed(state, &pollset); } } + #ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS # define IS_FD_UNKNOWN(state) ((state)->type == ERTS_EV_TYPE_NONE && (state)->remove_cnt == 0) #else # define IS_FD_UNKNOWN(state) ((state) == NULL) #endif -static ERTS_INLINE void -check_fd_cleanup(ErtsDrvEventState *state, -#if ERTS_CIO_HAVE_DRV_EVENT - ErtsDrvEventDataState **free_event, -#endif - ErtsDrvSelectDataState **free_select) -{ - erts_aint_t current_cio_time; - - ERTS_SMP_LC_ASSERT(erts_smp_lc_mtx_is_locked(fd_mtx(state->fd))); - - current_cio_time = erts_smp_atomic_read_acqb(&erts_check_io_time); - *free_select = NULL; - if (state->driver.select - && (state->type != ERTS_EV_TYPE_DRV_SEL) - && !is_iotask_active(&state->driver.select->iniotask, current_cio_time) - && !is_iotask_active(&state->driver.select->outiotask, current_cio_time)) { - - *free_select = state->driver.select; - state->driver.select = NULL; - } - -#if ERTS_CIO_HAVE_DRV_EVENT - *free_event = NULL; - if (state->driver.event - && (state->type != ERTS_EV_TYPE_DRV_EV) - && !is_iotask_active(&state->driver.event->iotask, current_cio_time)) { - - *free_event = state->driver.event; - state->driver.event = NULL; - } -#endif - -#ifndef ERTS_SYS_CONTINOUS_FD_NUMBERS - if (((state->type != ERTS_EV_TYPE_NONE) - | state->remove_cnt -#if ERTS_CIO_HAVE_DRV_EVENT - | (state->driver.event != NULL) -#endif - | (state->driver.select != NULL)) == 0) { - - hash_erase_drv_ev_state(state); - - } -#endif -} - -static ERTS_INLINE int -check_cleanup_active_fd(ErtsSysFdType fd, -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - ErtsPollControlEntry *pce, - int *pce_ix, -#endif - erts_aint_t current_cio_time) -{ - ErtsDrvEventState *state; - int active = 0; - erts_smp_mtx_t *mtx = fd_mtx(fd); - void *free_select = NULL; -#if ERTS_CIO_HAVE_DRV_EVENT - void *free_event = NULL; -#endif -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - ErtsPollEvents evon = 0, evoff = 0; -#endif - - erts_smp_mtx_lock(mtx); - -#ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS - state = &drv_ev_state[(int) fd]; -#else - state = hash_get_drv_ev_state(fd); /* may be NULL! */ - if (state) -#endif - { - if (state->driver.select) { -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - if (is_iotask_active(&state->driver.select->iniotask, current_cio_time)) { - active = 1; - if ((state->events & ERTS_POLL_EV_IN) - && !(state->flags & ERTS_EV_FLAG_DEFER_IN_EV)) { - evoff |= ERTS_POLL_EV_IN; - state->flags |= ERTS_EV_FLAG_DEFER_IN_EV; - } - } - else if (state->flags & ERTS_EV_FLAG_DEFER_IN_EV) { - if (state->events & ERTS_POLL_EV_IN) - evon |= ERTS_POLL_EV_IN; - state->flags &= ~ERTS_EV_FLAG_DEFER_IN_EV; - } - if (is_iotask_active(&state->driver.select->outiotask, current_cio_time)) { - active = 1; - if ((state->events & ERTS_POLL_EV_OUT) - && !(state->flags & ERTS_EV_FLAG_DEFER_OUT_EV)) { - evoff |= ERTS_POLL_EV_OUT; - state->flags |= ERTS_EV_FLAG_DEFER_OUT_EV; - } - } - else if (state->flags & ERTS_EV_FLAG_DEFER_OUT_EV) { - if (state->events & ERTS_POLL_EV_OUT) - evon |= ERTS_POLL_EV_OUT; - state->flags &= ~ERTS_EV_FLAG_DEFER_OUT_EV; - } - if (active) - (void) 0; - else -#else - if (is_iotask_active(&state->driver.select->iniotask, current_cio_time) - || is_iotask_active(&state->driver.select->outiotask, current_cio_time)) - active = 1; - else -#endif - if (state->type != ERTS_EV_TYPE_DRV_SEL) { - free_select = state->driver.select; - state->driver.select = NULL; - } - } - -#if ERTS_CIO_HAVE_DRV_EVENT - if (state->driver.event) { - if (is_iotask_active(&state->driver.event->iotask, current_cio_time)) { -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - ErtsPollEvents evs = state->events & ~state->driver.event->deferred_events; - if (evs) { - evoff |= evs; - state->driver.event->deferred_events |= evs; - } -#endif - active = 1; - } - else if (state->type != ERTS_EV_TYPE_DRV_EV) { - free_event = state->driver.event; - state->driver.event = NULL; - } -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - else { - ErtsPollEvents evs = state->events & state->driver.event->deferred_events; - if (evs) { - evon |= evs; - state->driver.event->deferred_events = 0; - } - } -#endif - - } -#endif - -#ifndef ERTS_SYS_CONTINOUS_FD_NUMBERS - if (((state->type != ERTS_EV_TYPE_NONE) | state->remove_cnt | active) == 0) - hash_erase_drv_ev_state(state); -#endif - - } - - erts_smp_mtx_unlock(mtx); - - if (free_select) - free_drv_select_data(free_select); -#if ERTS_CIO_HAVE_DRV_EVENT - if (free_event) - free_drv_event_data(free_event); -#endif - -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - if (evoff) { - ErtsPollControlEntry *pcep = &pce[(*pce_ix)++]; - pcep->fd = fd; - pcep->events = evoff; - pcep->on = 0; - } - if (evon) { - ErtsPollControlEntry *pcep = &pce[(*pce_ix)++]; - pcep->fd = fd; - pcep->events = evon; - pcep->on = 1; - } -#endif - - return active; -} - -static void -check_cleanup_active_fds(erts_aint_t current_cio_time) -{ - int six = pollset.active_fd.six; - int eix = pollset.active_fd.eix; - erts_aint32_t no = erts_smp_atomic32_read_dirty(&pollset.active_fd.no); - int size = pollset.active_fd.size; - int ix = six; -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - /* every fd might add two entries */ - Uint pce_sz = 2*sizeof(ErtsPollControlEntry)*no; - ErtsPollControlEntry *pctrl_entries = (pce_sz - ? erts_alloc(ERTS_ALC_T_TMP, pce_sz) - : NULL); - int pctrl_ix = 0; -#endif - - while (ix != eix) { - ErtsSysFdType fd = pollset.active_fd.array[ix]; - int nix = ix + 1; - if (nix >= size) - nix = 0; - ASSERT(fd != ERTS_SYS_FD_INVALID); - if (!check_cleanup_active_fd(fd, -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - pctrl_entries, - &pctrl_ix, -#endif - current_cio_time)) { - no--; - if (ix == six) { -#ifdef DEBUG - pollset.active_fd.array[ix] = ERTS_SYS_FD_INVALID; -#endif - six = nix; - } - else { - pollset.active_fd.array[ix] = pollset.active_fd.array[six]; -#ifdef DEBUG - pollset.active_fd.array[six] = ERTS_SYS_FD_INVALID; -#endif - six++; - if (six >= size) - six = 0; - } - } - ix = nix; - } - -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - ASSERT(pctrl_ix <= pce_sz/sizeof(ErtsPollControlEntry)); - if (pctrl_ix) - ERTS_CIO_POLL_CTLV(pollset.ps, pctrl_entries, pctrl_ix); - if (pctrl_entries) - erts_free(ERTS_ALC_T_TMP, pctrl_entries); -#endif - - pollset.active_fd.six = six; - pollset.active_fd.eix = eix; - erts_smp_atomic32_set_relb(&pollset.active_fd.no, no); -} - -static ERTS_INLINE void -add_active_fd(ErtsSysFdType fd) -{ - int eix = pollset.active_fd.eix; - int size = pollset.active_fd.size; - - - pollset.active_fd.array[eix] = fd; - - erts_smp_atomic32_set_relb(&pollset.active_fd.no, - (erts_smp_atomic32_read_dirty(&pollset.active_fd.no) - + 1)); - - eix++; - if (eix >= size) - eix = 0; - if (pollset.active_fd.six == eix) { - pollset.active_fd.six = 0; - eix = size; - size += ERTS_ACTIVE_FD_INC; - pollset.active_fd.array = erts_realloc(ERTS_ALC_T_ACTIVE_FD_ARR, - pollset.active_fd.array, - sizeof(ErtsSysFdType)*size); - pollset.active_fd.size = size; -#ifdef DEBUG - { - int i; - for (i = eix + 1; i < size; i++) - pollset.active_fd.array[i] = ERTS_SYS_FD_INVALID; - } -#endif - - } - - pollset.active_fd.eix = eix; -} int ERTS_CIO_EXPORT(driver_select)(ErlDrvPort ix, @@ -857,10 +492,6 @@ ErtsDrvEventState *state; int wake_poller; int ret; -#if ERTS_CIO_HAVE_DRV_EVENT - ErtsDrvEventDataState *free_event = NULL; -#endif - ErtsDrvSelectDataState *free_select = NULL; #ifdef USE_VM_PROBES DTRACE_CHARBUF(name, 64); #endif @@ -962,9 +593,9 @@ if (new_events & (ERTS_POLL_EV_ERR|ERTS_POLL_EV_NVAL)) { if (state->type == ERTS_EV_TYPE_DRV_SEL && !state->events) { state->type = ERTS_EV_TYPE_NONE; - state->flags &= ~ERTS_EV_FLAG_USED; - state->driver.select->inport = NIL; - state->driver.select->outport = NIL; + state->flags = 0; + erts_free(ERTS_ALC_T_DRV_SEL_D_STATE, state->driver.select); + state->driver.select = NULL; } ret = -1; goto done; @@ -982,10 +613,18 @@ state->events = new_events; if (ctl_events) { if (on) { - if (!state->driver.select) - state->driver.select = alloc_drv_select_data(); - if (state->type == ERTS_EV_TYPE_NONE) + if (state->type == ERTS_EV_TYPE_NONE) { + ErtsDrvSelectDataState *dsdsp + = erts_alloc(ERTS_ALC_T_DRV_SEL_D_STATE, + sizeof(ErtsDrvSelectDataState)); + dsdsp->inport = NIL; + dsdsp->outport = NIL; + erts_port_task_handle_init(&dsdsp->intask); + erts_port_task_handle_init(&dsdsp->outtask); + ASSERT(state->driver.select == NULL); + state->driver.select = dsdsp; state->type = ERTS_EV_TYPE_DRV_SEL; + } ASSERT(state->type == ERTS_EV_TYPE_DRV_SEL); if (ctl_events & ERTS_POLL_EV_IN) state->driver.select->inport = id; @@ -1006,12 +645,17 @@ state->driver.select->outport = NIL; } if (new_events == 0) { + ASSERT(!erts_port_task_is_scheduled(&state->driver.select->intask)); + ASSERT(!erts_port_task_is_scheduled(&state->driver.select->outtask)); if (old_events != 0) { remember_removed(state, &pollset); } if ((mode & ERL_DRV_USE) || !(state->flags & ERTS_EV_FLAG_USED)) { state->type = ERTS_EV_TYPE_NONE; - state->flags &= ~ERTS_EV_FLAG_USED; + state->flags = 0; + erts_free(ERTS_ALC_T_DRV_SEL_D_STATE, + state->driver.select); + state->driver.select = NULL; } /*else keep it, as fd will probably be selected upon again */ } @@ -1042,15 +686,13 @@ ret = 0; -done: - - check_fd_cleanup(state, -#if ERTS_CIO_HAVE_DRV_EVENT - &free_event, +done:; +#ifndef ERTS_SYS_CONTINOUS_FD_NUMBERS + if (state->type == ERTS_EV_TYPE_NONE && state->remove_cnt == 0) { + hash_erase_drv_ev_state(state); + } #endif - &free_select); - -done_unknown: +done_unknown: erts_smp_mtx_unlock(fd_mtx(fd)); if (stop_select_fn) { int was_unmasked = erts_block_fpe(); @@ -1058,12 +700,6 @@ (*stop_select_fn)(e, NULL); erts_unblock_fpe(was_unmasked); } - if (free_select) - free_drv_select_data(free_select); -#if ERTS_CIO_HAVE_DRV_EVENT - if (free_event) - free_drv_event_data(free_event); -#endif return ret; } @@ -1083,10 +719,6 @@ ErtsDrvEventState *state; int do_wake = 0; int ret; -#if ERTS_CIO_HAVE_DRV_EVENT - ErtsDrvEventDataState *free_event; -#endif - ErtsDrvSelectDataState *free_select; Port *prt = erts_drvport2port(ix); if (prt == ERTS_INVALID_ERL_DRV_PORT) @@ -1167,8 +799,10 @@ state->driver.event->removed_events |= remove_events; } else { - if (!state->driver.event) - state->driver.event = alloc_drv_event_data(); + state->driver.event + = erts_alloc(ERTS_ALC_T_DRV_EV_D_STATE, + sizeof(ErtsDrvEventDataState)); + erts_port_task_handle_init(&state->driver.event->task); state->driver.event->port = id; state->driver.event->removed_events = (ErtsPollEvents) 0; state->type = ERTS_EV_TYPE_DRV_EV; @@ -1178,10 +812,10 @@ else { if (state->type == ERTS_EV_TYPE_DRV_EV) { abort_tasks(state, 0); - state->driver.event->port = NIL; - state->driver.event->data = NULL; - state->driver.event->removed_events = (ErtsPollEvents) 0; + erts_free(ERTS_ALC_T_DRV_EV_D_STATE, + state->driver.event); } + state->driver.select = NULL; state->type = ERTS_EV_TYPE_NONE; remember_removed(state, &pollset); } @@ -1191,22 +825,12 @@ ret = 0; done: - - check_fd_cleanup(state, -#if ERTS_CIO_HAVE_DRV_EVENT - &free_event, +#ifndef ERTS_SYS_CONTINOUS_FD_NUMBERS + if (state->type == ERTS_EV_TYPE_NONE && state->remove_cnt == 0) { + hash_erase_drv_ev_state(state); + } #endif - &free_select); - erts_smp_mtx_unlock(fd_mtx(fd)); - - if (free_select) - free_drv_select_data(free_select); -#if ERTS_CIO_HAVE_DRV_EVENT - if (free_event) - free_drv_event_data(free_event); -#endif - return ret; #endif } @@ -1403,7 +1027,7 @@ * In either case stop_select should not be called. */ state->type = ERTS_EV_TYPE_NONE; - state->flags &= ~ERTS_EV_FLAG_USED; + state->flags = 0; if (state->driver.drv_ptr->handle) { erts_ddll_dereference_driver(state->driver.drv_ptr->handle); } @@ -1475,103 +1099,38 @@ #endif #endif -static ERTS_INLINE int -io_task_schedule_allowed(ErtsDrvEventState *state, - ErtsPortTaskType type, - erts_aint_t current_cio_time) -{ - ErtsIoTask *io_task; - - switch (type) { - case ERTS_PORT_TASK_INPUT: - if (!state->driver.select) - return 0; -#if ERTS_CIO_HAVE_DRV_EVENT - if (state->driver.event) - return 0; -#endif - io_task = &state->driver.select->iniotask; - break; - case ERTS_PORT_TASK_OUTPUT: - if (!state->driver.select) - return 0; -#if ERTS_CIO_HAVE_DRV_EVENT - if (state->driver.event) - return 0; -#endif - io_task = &state->driver.select->outiotask; - break; -#if ERTS_CIO_HAVE_DRV_EVENT - case ERTS_PORT_TASK_EVENT: - if (!state->driver.event) - return 0; - if (state->driver.select) - return 0; - io_task = &state->driver.event->iotask; - break; -#endif - default: - ERTS_INTERNAL_ERROR("Invalid I/O-task type"); - return 0; - } - - return !is_iotask_active(io_task, current_cio_time); -} - static ERTS_INLINE void -iready(Eterm id, ErtsDrvEventState *state, erts_aint_t current_cio_time) +iready(Eterm id, ErtsDrvEventState *state) { - if (io_task_schedule_allowed(state, - ERTS_PORT_TASK_INPUT, - current_cio_time)) { - ErtsIoTask *iotask = &state->driver.select->iniotask; - erts_smp_atomic_set_nob(&iotask->executed_time, current_cio_time); - if (erts_port_task_schedule(id, - &iotask->task, - ERTS_PORT_TASK_INPUT, - (ErlDrvEvent) state->fd) != 0) { - stale_drv_select(id, state, ERL_DRV_READ); - } - add_active_fd(state->fd); + if (erts_port_task_schedule(id, + &state->driver.select->intask, + ERTS_PORT_TASK_INPUT, + (ErlDrvEvent) state->fd) != 0) { + stale_drv_select(id, state, ERL_DRV_READ); } } static ERTS_INLINE void -oready(Eterm id, ErtsDrvEventState *state, erts_aint_t current_cio_time) +oready(Eterm id, ErtsDrvEventState *state) { - if (io_task_schedule_allowed(state, - ERTS_PORT_TASK_OUTPUT, - current_cio_time)) { - ErtsIoTask *iotask = &state->driver.select->outiotask; - erts_smp_atomic_set_nob(&iotask->executed_time, current_cio_time); - if (erts_port_task_schedule(id, - &iotask->task, - ERTS_PORT_TASK_OUTPUT, - (ErlDrvEvent) state->fd) != 0) { - stale_drv_select(id, state, ERL_DRV_WRITE); - } - add_active_fd(state->fd); + if (erts_port_task_schedule(id, + &state->driver.select->outtask, + ERTS_PORT_TASK_OUTPUT, + (ErlDrvEvent) state->fd) != 0) { + stale_drv_select(id, state, ERL_DRV_WRITE); } } #if ERTS_CIO_HAVE_DRV_EVENT static ERTS_INLINE void -eready(Eterm id, ErtsDrvEventState *state, ErlDrvEventData event_data, - erts_aint_t current_cio_time) +eready(Eterm id, ErtsDrvEventState *state, ErlDrvEventData event_data) { - if (io_task_schedule_allowed(state, - ERTS_PORT_TASK_EVENT, - current_cio_time)) { - ErtsIoTask *iotask = &state->driver.event->iotask; - erts_smp_atomic_set_nob(&iotask->executed_time, current_cio_time); - if (erts_port_task_schedule(id, - &iotask->task, - ERTS_PORT_TASK_EVENT, - (ErlDrvEvent) state->fd, - event_data) != 0) { - stale_drv_select(id, state, 0); - } - add_active_fd(state->fd); + if (erts_port_task_schedule(id, + &state->driver.event->task, + ERTS_PORT_TASK_EVENT, + (ErlDrvEvent) state->fd, + event_data) != 0) { + stale_drv_select(id, state, 0); } } #endif @@ -1594,22 +1153,18 @@ void ERTS_CIO_EXPORT(erts_check_io_interrupt_timed)(int set, - ErtsMonotonicTime timeout_time) + erts_short_time_t msec) { - ERTS_CIO_POLL_INTR_TMD(pollset.ps, set, timeout_time); + ERTS_CIO_POLL_INTR_TMD(pollset.ps, set, msec); } void ERTS_CIO_EXPORT(erts_check_io)(int do_wait) { - ErtsPollResFd *pollres; + ErtsPollResFd pollres[256]; int pollres_len; - ErtsMonotonicTime timeout_time; + SysTimeval wait_time; int poll_ret, i; - erts_aint_t current_cio_time; - ErtsSchedulerData *esdp = erts_get_scheduler_data(); - - ASSERT(esdp); restart: @@ -1619,37 +1174,28 @@ #endif /* Figure out timeout value */ - timeout_time = (do_wait - ? erts_check_next_timeout_time(esdp) - : ERTS_POLL_NO_TIMEOUT /* poll only */); - - /* - * No need for an atomic inc op when incrementing - * erts_check_io_time, since only one thread can - * check io at a time. - */ - current_cio_time = erts_smp_atomic_read_dirty(&erts_check_io_time); - current_cio_time++; - erts_smp_atomic_set_relb(&erts_check_io_time, current_cio_time); - - check_cleanup_active_fds(current_cio_time); + if (do_wait) { + erts_time_remaining(&wait_time); + } else { /* poll only */ + wait_time.tv_sec = 0; + wait_time.tv_usec = 0; + } #ifdef ERTS_ENABLE_LOCK_CHECK erts_lc_check_exact(NULL, 0); /* No locks should be locked */ #endif - - pollres_len = erts_smp_atomic32_read_dirty(&pollset.active_fd.no) + ERTS_CHECK_IO_POLL_RES_LEN; - - pollres = erts_alloc(ERTS_ALC_T_TMP, sizeof(ErtsPollResFd)*pollres_len); + pollres_len = sizeof(pollres)/sizeof(ErtsPollResFd); erts_smp_atomic_set_nob(&pollset.in_poll_wait, 1); - poll_ret = ERTS_CIO_POLL_WAIT(pollset.ps, pollres, &pollres_len, timeout_time); + poll_ret = ERTS_CIO_POLL_WAIT(pollset.ps, pollres, &pollres_len, &wait_time); #ifdef ERTS_ENABLE_LOCK_CHECK erts_lc_check_exact(NULL, 0); /* No locks should be locked */ #endif + erts_deliver_time(); /* sync the machine's idea of time */ + #ifdef ERTS_BREAK_REQUESTED if (ERTS_BREAK_REQUESTED) erts_do_break_handling(); @@ -1658,7 +1204,6 @@ if (poll_ret != 0) { erts_smp_atomic_set_nob(&pollset.in_poll_wait, 0); forget_removed(&pollset); - erts_free(ERTS_ALC_T_TMP, pollres); if (poll_ret == EAGAIN) { goto restart; } @@ -1718,15 +1263,15 @@ if ((revents & ERTS_POLL_EV_IN) || (!(revents & ERTS_POLL_EV_OUT) && state->events & ERTS_POLL_EV_IN)) { - iready(state->driver.select->inport, state, current_cio_time); + iready(state->driver.select->inport, state); } else if (state->events & ERTS_POLL_EV_OUT) { - oready(state->driver.select->outport, state, current_cio_time); + oready(state->driver.select->outport, state); } } else if (revents & (ERTS_POLL_EV_IN|ERTS_POLL_EV_OUT)) { if (revents & ERTS_POLL_EV_OUT) { - oready(state->driver.select->outport, state, current_cio_time); + oready(state->driver.select->outport, state); } /* Someone might have deselected input since revents was read (true also on the non-smp emulator since @@ -1734,7 +1279,7 @@ revents... */ revents &= ~(~state->events & ERTS_POLL_EV_IN); if (revents & ERTS_POLL_EV_IN) { - iready(state->driver.select->inport, state, current_cio_time); + iready(state->driver.select->inport, state); } } else if (revents & ERTS_POLL_EV_NVAL) { @@ -1742,7 +1287,6 @@ state->driver.select->inport, state->driver.select->outport, state->events); - add_active_fd(state->fd); } break; } @@ -1760,7 +1304,8 @@ if (revents) { event_data->events = state->events; event_data->revents = revents; - eready(state->driver.event->port, state, event_data, current_cio_time); + + eready(state->driver.event->port, state, event_data); } break; } @@ -1778,7 +1323,6 @@ (int) state->type); ASSERT(0); deselect(state, 0); - add_active_fd(state->fd); break; } } @@ -1790,7 +1334,6 @@ } erts_smp_atomic_set_nob(&pollset.in_poll_wait, 0); - erts_free(ERTS_ALC_T_TMP, pollres); forget_removed(&pollset); } @@ -1926,27 +1469,10 @@ void ERTS_CIO_EXPORT(erts_init_check_io)(void) { - erts_smp_atomic_init_nob(&erts_check_io_time, 0); erts_smp_atomic_init_nob(&pollset.in_poll_wait, 0); - ERTS_CIO_POLL_INIT(); pollset.ps = ERTS_CIO_NEW_POLLSET(); - pollset.active_fd.six = 0; - pollset.active_fd.eix = 0; - erts_smp_atomic32_init_nob(&pollset.active_fd.no, 0); - pollset.active_fd.size = ERTS_ACTIVE_FD_INC; - pollset.active_fd.array = erts_alloc(ERTS_ALC_T_ACTIVE_FD_ARR, - sizeof(ErtsSysFdType)*ERTS_ACTIVE_FD_INC); -#ifdef DEBUG - { - int i; - for (i = 0; i < ERTS_ACTIVE_FD_INC; i++) - pollset.active_fd.array[i] = ERTS_SYS_FD_INVALID; - } -#endif - - #ifdef ERTS_SMP init_removed_fd_alloc(); pollset.removed_list = NULL; @@ -2022,27 +1548,12 @@ ERTS_CIO_EXPORT(erts_check_io_info)(void *proc) { Process *p = (Process *) proc; - Eterm tags[16], values[16], res; + Eterm tags[15], values[15], res; Uint sz, *szp, *hp, **hpp, memory_size; Sint i; ErtsPollInfo pi; - erts_aint_t cio_time = erts_smp_atomic_read_acqb(&erts_check_io_time); - int active_fds = (int) erts_smp_atomic32_read_acqb(&pollset.active_fd.no); - - while (1) { - erts_aint_t post_cio_time; - int post_active_fds; - - ERTS_CIO_POLL_INFO(pollset.ps, &pi); - - post_cio_time = erts_smp_atomic_read_mb(&erts_check_io_time); - post_active_fds = (int) erts_smp_atomic32_read_acqb(&pollset.active_fd.no); - if (cio_time == post_cio_time && active_fds == post_active_fds) - break; - cio_time = post_cio_time; - active_fds = post_active_fds; - } - + + ERTS_CIO_POLL_INFO(pollset.ps, &pi); memory_size = pi.memory_size; #ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS memory_size += sizeof(ErtsDrvEventState) * erts_smp_atomic_read_nob(&drv_ev_state_len); @@ -2106,9 +1617,6 @@ tags[i] = erts_bld_atom(hpp, szp, "max_fds"); values[i++] = erts_bld_uint(hpp, szp, (Uint) pi.max_fds); - tags[i] = erts_bld_atom(hpp, szp, "active_fds"); - values[i++] = erts_bld_uint(hpp, szp, (Uint) active_fds); - #ifdef ERTS_POLL_COUNT_AVOIDED_WAKEUPS tags[i] = erts_bld_atom(hpp, szp, "no_avoided_wakeups"); values[i++] = erts_bld_uint(hpp, szp, (Uint) pi.no_avoided_wakeups); @@ -2163,8 +1671,6 @@ typedef struct { int used_fds; int num_errors; - int no_driver_select_structs; - int no_driver_event_structs; #ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS int internal_fds; ErtsPollEvents *epep; @@ -2187,13 +1693,6 @@ struct stat stat_buf; #endif - if (state->driver.select) - counters->no_driver_select_structs++; -#if ERTS_CIO_HAVE_DRV_EVENT - if (state->driver.event) - counters->no_driver_event_structs++; -#endif - #ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS if (state->events || ep_events) { if (ep_events & ERTS_POLL_EV_NVAL) { @@ -2332,7 +1831,6 @@ } } } -#if ERTS_CIO_HAVE_DRV_EVENT else if (state->type == ERTS_EV_TYPE_DRV_EV) { Eterm id; erts_printf("driver_event "); @@ -2368,7 +1866,6 @@ erts_free_port_names(pnp); } } -#endif #ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS else if (internal) { erts_printf("internal "); @@ -2408,7 +1905,7 @@ } int -ERTS_CIO_EXPORT(erts_check_io_debug)(ErtsCheckIoDebugInfo *ciodip) +ERTS_CIO_EXPORT(erts_check_io_debug)(void) { #ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS int fd, len; @@ -2418,10 +1915,6 @@ ErtsDrvEventState null_des; null_des.driver.select = NULL; -#if ERTS_CIO_HAVE_DRV_EVENT - null_des.driver.event = NULL; -#endif - null_des.driver.drv_ptr = NULL; null_des.events = 0; null_des.remove_cnt = 0; null_des.type = ERTS_EV_TYPE_NONE; @@ -2442,8 +1935,6 @@ #endif counters.used_fds = 0; counters.num_errors = 0; - counters.no_driver_select_structs = 0; - counters.no_driver_event_structs = 0; #ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS len = erts_smp_atomic_read_nob(&drv_ev_state_len); @@ -2460,16 +1951,8 @@ erts_smp_thr_progress_unblock(); - ciodip->no_used_fds = counters.used_fds; - ciodip->no_driver_select_structs = counters.no_driver_select_structs; - ciodip->no_driver_event_structs = counters.no_driver_event_structs; - erts_printf("\n"); erts_printf("used fds=%d\n", counters.used_fds); - erts_printf("Number of driver_select() structures=%d\n", counters.no_driver_select_structs); -#if ERTS_CIO_HAVE_DRV_EVENT - erts_printf("Number of driver_event() structures=%d\n", counters.no_driver_event_structs); -#endif #ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS erts_printf("internal fds=%d\n", counters.internal_fds); #endif @@ -2478,7 +1961,6 @@ #ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS erts_free(ERTS_ALC_T_TMP, (void *) counters.epep); #endif - return counters.num_errors; } diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_check_io.h erlang-17.3-dfsg/erts/emulator/sys/common/erl_check_io.h --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_check_io.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_check_io.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -27,7 +26,6 @@ #ifndef ERL_CHECK_IO_H__ #define ERL_CHECK_IO_H__ -#include "sys.h" #include "erl_sys_driver.h" #ifdef ERTS_ENABLE_KERNEL_POLL @@ -48,14 +46,14 @@ #endif void erts_check_io_interrupt_kp(int); void erts_check_io_interrupt_nkp(int); -void erts_check_io_interrupt_timed_kp(int, ErtsMonotonicTime); -void erts_check_io_interrupt_timed_nkp(int, ErtsMonotonicTime); +void erts_check_io_interrupt_timed_kp(int, erts_short_time_t); +void erts_check_io_interrupt_timed_nkp(int, erts_short_time_t); void erts_check_io_kp(int); void erts_check_io_nkp(int); void erts_init_check_io_kp(void); void erts_init_check_io_nkp(void); -int erts_check_io_debug_kp(ErtsCheckIoDebugInfo *); -int erts_check_io_debug_nkp(ErtsCheckIoDebugInfo *); +int erts_check_io_debug_kp(void); +int erts_check_io_debug_nkp(void); #else /* !ERTS_ENABLE_KERNEL_POLL */ @@ -66,33 +64,12 @@ void erts_check_io_async_sig_interrupt(void); #endif void erts_check_io_interrupt(int); -void erts_check_io_interrupt_timed(int, ErtsMonotonicTime); +void erts_check_io_interrupt_timed(int, erts_short_time_t); void erts_check_io(int); void erts_init_check_io(void); #endif -extern erts_smp_atomic_t erts_check_io_time; - -typedef struct { - ErtsPortTaskHandle task; - erts_smp_atomic_t executed_time; -} ErtsIoTask; - -ERTS_GLB_INLINE void erts_io_notify_port_task_executed(ErtsPortTaskHandle *pthp); - -#if ERTS_GLB_INLINE_INCL_FUNC_DEF - -ERTS_GLB_INLINE void -erts_io_notify_port_task_executed(ErtsPortTaskHandle *pthp) -{ - ErtsIoTask *itp = (ErtsIoTask *) (((char *) pthp) - offsetof(ErtsIoTask, task)); - erts_aint_t ci_time = erts_smp_atomic_read_acqb(&erts_check_io_time); - erts_smp_atomic_set_relb(&itp->executed_time, ci_time); -} - -#endif - #endif /* ERL_CHECK_IO_H__ */ #if !defined(ERL_CHECK_IO_C__) && !defined(ERTS_ALLOC_C__) @@ -104,16 +81,6 @@ #include "erl_poll.h" #include "erl_port_task.h" -#ifdef __WIN32__ -/* - * Current erts_poll implementation for Windows cannot handle - * active events in the set of events polled. - */ -# define ERTS_CIO_DEFER_ACTIVE_EVENTS 1 -#else -# define ERTS_CIO_DEFER_ACTIVE_EVENTS 0 -#endif - /* * ErtsDrvEventDataState is used by driver_event() which is almost never * used. We allocate ErtsDrvEventDataState separate since we dont wan't @@ -124,16 +91,13 @@ Eterm port; ErlDrvEventData data; ErtsPollEvents removed_events; -#if ERTS_CIO_DEFER_ACTIVE_EVENTS - ErtsPollEvents deferred_events; -#endif - ErtsIoTask iotask; + ErtsPortTaskHandle task; } ErtsDrvEventDataState; typedef struct { Eterm inport; Eterm outport; - ErtsIoTask iniotask; - ErtsIoTask outiotask; + ErtsPortTaskHandle intask; + ErtsPortTaskHandle outtask; } ErtsDrvSelectDataState; #endif /* #ifndef ERL_CHECK_IO_INTERNAL__ */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_mmap.c erlang-17.3-dfsg/erts/emulator/sys/common/erl_mmap.c --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_mmap.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_mmap.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_mmap.h erlang-17.3-dfsg/erts/emulator/sys/common/erl_mmap.h --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_mmap.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_mmap.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_mseg.c erlang-17.3-dfsg/erts/emulator/sys/common/erl_mseg.c --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_mseg.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_mseg.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_mseg.h erlang-17.3-dfsg/erts/emulator/sys/common/erl_mseg.h --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_mseg.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_mseg.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_mtrace_sys_wrap.c erlang-17.3-dfsg/erts/emulator/sys/common/erl_mtrace_sys_wrap.c --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_mtrace_sys_wrap.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_mtrace_sys_wrap.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_os_monotonic_time_extender.c erlang-17.3-dfsg/erts/emulator/sys/common/erl_os_monotonic_time_extender.c --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_os_monotonic_time_extender.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_os_monotonic_time_extender.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif -#include "erl_os_monotonic_time_extender.h" - -#ifdef USE_THREADS - -static void *os_monotonic_time_extender(void *vstatep) -{ - ErtsOsMonotonicTimeExtendState *state = (ErtsOsMonotonicTimeExtendState *) vstatep; - long sleep_time = state->check_interval*1000; - Uint32 (*raw_os_mtime)(void) = state->raw_os_monotonic_time; - Uint32 last_msb = 0; - - while (1) { - Uint32 msb = (*raw_os_mtime)() & (((Uint32) 1) << 31); - - if (msb != last_msb) { - int ix = ((int) (last_msb >> 31)) & 1; - Uint32 xtnd = (Uint32) erts_atomic32_read_nob(&state->extend[ix]); - erts_atomic32_set_nob(&state->extend[ix], (erts_aint32_t) (xtnd + 1)); - last_msb = msb; - } - erts_milli_sleep(sleep_time); - } - - erl_exit(ERTS_ABORT_EXIT, "os_monotonic_time_extender thread terminating"); - return NULL; -} - -static erts_tid_t os_monotonic_extender_tid; -#endif - -void -erts_init_os_monotonic_time_extender(ErtsOsMonotonicTimeExtendState *statep, - Uint32 (*raw_os_monotonic_time)(void), - int check_seconds) -{ -#ifdef USE_THREADS - statep->raw_os_monotonic_time = raw_os_monotonic_time; - erts_atomic32_init_nob(&statep->extend[0], (erts_aint32_t) 0); - erts_atomic32_init_nob(&statep->extend[1], (erts_aint32_t) 0); - statep->check_interval = check_seconds; - -#else - statep->extend[0] = (Uint32) 0; - statep->extend[1] = (Uint32) 0; - statep->last_msb = (ErtsMonotonicTime) 0; -#endif -} - -void -erts_late_init_os_monotonic_time_extender(ErtsOsMonotonicTimeExtendState *statep) -{ -#ifdef USE_THREADS - erts_thr_opts_t thr_opts = ERTS_THR_OPTS_DEFAULT_INITER; - thr_opts.detached = 1; - thr_opts.suggested_stack_size = 4; - -#if 0 - thr_opts.name = "os_monotonic_time_extender"; -#endif - - erts_thr_create(&os_monotonic_extender_tid, - os_monotonic_time_extender, - (void*) statep, - &thr_opts); -#endif -} diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_os_monotonic_time_extender.h erlang-17.3-dfsg/erts/emulator/sys/common/erl_os_monotonic_time_extender.h --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_os_monotonic_time_extender.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_os_monotonic_time_extender.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -#ifndef ERL_OS_MONOTONIC_TIME_EXTENDER_H__ -#define ERL_OS_MONOTONIC_TIME_EXTENDER_H__ - -#include "sys.h" -#include "erl_threads.h" - -typedef struct { -#ifdef USE_THREADS - Uint32 (*raw_os_monotonic_time)(void); - erts_atomic32_t extend[2]; - int check_interval; -#else - Uint32 extend[2]; - ErtsMonotonicTime last_msb; -#endif -} ErtsOsMonotonicTimeExtendState; - -#ifdef USE_THREADS -# define ERTS_CHK_EXTEND_OS_MONOTONIC_TIME(S, RT) ((void) 1) -# define ERTS_EXTEND_OS_MONOTONIC_TIME(S, RT) \ - ((((ErtsMonotonicTime) \ - erts_atomic32_read_nob(&((S)->extend[((int) ((RT) >> 31)) & 1]))) \ - << 32) \ - + (RT)) -#else -# define ERTS_CHK_EXTEND_OS_MONOTONIC_TIME(S, RT) \ - do { \ - Uint32 msb__ = (RT) & (((Uint32) 1) << 31); \ - if (msb__ != (S)->last_msb) { \ - int ix__ = ((int) ((S)->last_msb >> 31)) & 1; \ - (S)->extend[ix__]++; \ - (S)->last_msb = msb; \ - } \ - } while (0) -# define ERTS_EXTEND_OS_MONOTONIC_TIME(S, RT) \ - ((((ErtsMonotonicTime) (S)->extend[((int) ((RT) >> 31)) & 1]) << 32) + (RT)) -#endif - -void -erts_init_os_monotonic_time_extender(ErtsOsMonotonicTimeExtendState *statep, - Uint32 (*raw_os_monotonic_time)(void), - int check_seconds); -void -erts_late_init_os_monotonic_time_extender(ErtsOsMonotonicTimeExtendState *statep); - -#endif diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_poll.c erlang-17.3-dfsg/erts/emulator/sys/common/erl_poll.c --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_poll.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_poll.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -154,6 +153,9 @@ #define ERTS_POLL_COALESCE_KP_RES (ERTS_POLL_USE_KQUEUE || ERTS_POLL_USE_EPOLL) +#define ERTS_EV_TABLE_MIN_LENGTH 1024 +#define ERTS_EV_TABLE_EXP_THRESHOLD (2048*1024) + #ifdef ERTS_POLL_NEED_ASYNC_INTERRUPT_SUPPORT # define ERTS_POLL_ASYNC_INTERRUPT_SUPPORT 1 #else @@ -312,16 +314,13 @@ #if ERTS_POLL_USE_WAKEUP_PIPE int wake_fds[2]; #endif -#if ERTS_POLL_USE_TIMERFD - int timer_fd; -#endif #if ERTS_POLL_USE_FALLBACK int fallback_used; #endif #if defined(USE_THREADS) || ERTS_POLL_ASYNC_INTERRUPT_SUPPORT erts_atomic32_t wakeup_state; #endif - erts_atomic64_t timeout_time; + erts_smp_atomic32_t timeout; #ifdef ERTS_POLL_COUNT_AVOIDED_WAKEUPS erts_smp_atomic_t no_avoided_wakeups; erts_smp_atomic_t no_avoided_interrupts; @@ -385,26 +384,6 @@ static void print_misc_debug_info(void); #endif -static ERTS_INLINE void -init_timeout_time(ErtsPollSet ps) -{ - erts_atomic64_init_nob(&ps->timeout_time, - (erts_aint64_t) ERTS_MONOTONIC_TIME_MAX); -} - -static ERTS_INLINE void -set_timeout_time(ErtsPollSet ps, ErtsMonotonicTime time) -{ - erts_atomic64_set_relb(&ps->timeout_time, - (erts_aint64_t) time); -} - -static ERTS_INLINE ErtsMonotonicTime -get_timeout_time(ErtsPollSet ps) -{ - return (ErtsMonotonicTime) erts_atomic64_read_acqb(&ps->timeout_time); -} - #define ERTS_POLL_NOT_WOKEN 0 #define ERTS_POLL_WOKEN -1 #define ERTS_POLL_WOKEN_INTR 1 @@ -431,7 +410,7 @@ is_interrupted_reset(ErtsPollSet ps) { #if defined(USE_THREADS) || ERTS_POLL_ASYNC_INTERRUPT_SUPPORT - return (erts_atomic32_xchg_acqb(&ps->wakeup_state, ERTS_POLL_NOT_WOKEN) + return (erts_atomic32_xchg_nob(&ps->wakeup_state, ERTS_POLL_NOT_WOKEN) == ERTS_POLL_WOKEN_INTR); #else return 0; @@ -442,7 +421,7 @@ woke_up(ErtsPollSet ps) { #if defined(USE_THREADS) || ERTS_POLL_ASYNC_INTERRUPT_SUPPORT - erts_aint32_t wakeup_state = erts_atomic32_read_acqb(&ps->wakeup_state); + erts_aint32_t wakeup_state = erts_atomic32_read_nob(&ps->wakeup_state); if (wakeup_state == ERTS_POLL_NOT_WOKEN) (void) erts_atomic32_cmpxchg_nob(&ps->wakeup_state, ERTS_POLL_WOKEN, @@ -469,9 +448,14 @@ wakeup_state = erts_atomic32_cmpxchg_relb(&ps->wakeup_state, ERTS_POLL_WOKEN, ERTS_POLL_NOT_WOKEN); - else - wakeup_state = erts_atomic32_xchg_relb(&ps->wakeup_state, - ERTS_POLL_WOKEN_INTR); + else { + /* + * We might unnecessarily write to the pipe, however, + * that isn't problematic. + */ + wakeup_state = erts_atomic32_read_nob(&ps->wakeup_state); + erts_atomic32_set_relb(&ps->wakeup_state, ERTS_POLL_WOKEN_INTR); + } wake = wakeup_state == ERTS_POLL_NOT_WOKEN; } /* @@ -576,75 +560,6 @@ #endif /* ERTS_POLL_USE_WAKEUP_PIPE */ /* - * --- timer fd ----------------------------------------------------------- - */ - -#if ERTS_POLL_USE_TIMERFD - -/* We use the timerfd when using epoll_wait to get high accuracy - timeouts, i.e. we want to sleep with < ms accuracy. */ - -static void -create_timerfd(ErtsPollSet ps) -{ - int do_wake = 0; - int timer_fd; - timer_fd = timerfd_create(CLOCK_MONOTONIC,0); - ERTS_POLL_EXPORT(erts_poll_control)(ps, - timer_fd, - ERTS_POLL_EV_IN, - 1, &do_wake); -#if ERTS_POLL_USE_FALLBACK - /* We depend on the wakeup pipe being handled by kernel poll */ - if (ps->fds_status[timer_fd].flags & ERTS_POLL_FD_FLG_INFLBCK) - fatal_error("%s:%d:create_wakeup_pipe(): Internal error\n", - __FILE__, __LINE__); -#endif - if (ps->internal_fd_limit <= timer_fd) - ps->internal_fd_limit = timer_fd + 1; - ps->timer_fd = timer_fd; -} - -static ERTS_INLINE void -timerfd_set(ErtsPollSet ps, struct itimerspec *its) -{ -#ifdef DEBUG - struct itimerspec old_its; - int res; - res = timerfd_settime(ps->timer_fd, 0, its, &old_its); - ASSERT(res == 0); - ASSERT(old_its.it_interval.tv_sec == 0 && - old_its.it_interval.tv_nsec == 0 && - old_its.it_value.tv_sec == 0 && - old_its.it_value.tv_nsec == 0); - -#else - timerfd_settime(ps->timer_fd, 0, its, NULL); -#endif -} - -static ERTS_INLINE int -timerfd_clear(ErtsPollSet ps, int res, int max_res) { - - struct itimerspec its; - /* we always have to clear the timer */ - its.it_interval.tv_sec = 0; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = 0; - its.it_value.tv_nsec = 0; - timerfd_settime(ps->timer_fd, 0, &its, NULL); - - /* only timeout fd triggered */ - if (res == 1 && ps->res_events[0].data.fd == ps->timer_fd) - return 0; - - return res; -} - -#endif /* ERTS_POLL_USE_TIMERFD */ - - -/* * --- Poll set update requests ---------------------------------------------- */ #if ERTS_POLL_USE_UPDATE_REQUESTS_QUEUE @@ -696,33 +611,27 @@ * --- Growing poll set structures ------------------------------------------- */ -#ifndef ERTS_KERNEL_POLL_VERSION /* only one shared implementation */ - -#define ERTS_FD_TABLE_MIN_LENGTH 1024 -#define ERTS_FD_TABLE_EXP_THRESHOLD (2048*1024) - -int erts_poll_new_table_len (int old_len, int need_len) +int +ERTS_POLL_EXPORT(erts_poll_get_table_len) (int new_len) { - int new_len; - - ASSERT(need_len > old_len); - if (need_len < ERTS_FD_TABLE_MIN_LENGTH) { - new_len = ERTS_FD_TABLE_MIN_LENGTH; + if (new_len < ERTS_EV_TABLE_MIN_LENGTH) { + new_len = ERTS_EV_TABLE_MIN_LENGTH; + } else if (new_len < ERTS_EV_TABLE_EXP_THRESHOLD) { + /* find next power of 2 */ + --new_len; + new_len |= new_len >> 1; + new_len |= new_len >> 2; + new_len |= new_len >> 4; + new_len |= new_len >> 8; + new_len |= new_len >> 16; + ++new_len; + } else { + /* grow incrementally */ + new_len += ERTS_EV_TABLE_EXP_THRESHOLD; } - else { - new_len = old_len; - do { - if (new_len < ERTS_FD_TABLE_EXP_THRESHOLD) - new_len *= 2; - else - new_len += ERTS_FD_TABLE_EXP_THRESHOLD; - - } while (new_len < need_len); - } - ASSERT(new_len >= need_len); return new_len; } -#endif + #if ERTS_POLL_USE_KERNEL_POLL static void @@ -736,7 +645,7 @@ #elif ERTS_POLL_USE_KQUEUE struct kevent #endif - ) * erts_poll_new_table_len(ps->res_events_len, new_len); + ) * ERTS_POLL_EXPORT(erts_poll_get_table_len)(new_len); /* We do not need to save previously stored data */ if (ps->res_events) erts_free(ERTS_ALC_T_POLL_RES_EVS, ps->res_events); @@ -750,7 +659,7 @@ grow_poll_fds(ErtsPollSet ps, int min_ix) { int i; - int new_len = erts_poll_new_table_len(ps->poll_fds_len, min_ix + 1); + int new_len = ERTS_POLL_EXPORT(erts_poll_get_table_len)(min_ix + 1); if (new_len > max_fds) new_len = max_fds; ps->poll_fds = (ps->poll_fds_len @@ -772,7 +681,7 @@ static void grow_select_fds(int fd, ERTS_fd_set* fds) { - int new_len = erts_poll_new_table_len(fds->sz, fd + 1); + int new_len = ERTS_POLL_EXPORT(erts_poll_get_table_len)(fd + 1); if (new_len > max_fds) new_len = max_fds; new_len = ERTS_FD_SIZE(new_len); @@ -799,7 +708,7 @@ grow_fds_status(ErtsPollSet ps, int min_fd) { int i; - int new_len = erts_poll_new_table_len(ps->fds_status_len, min_fd + 1); + int new_len = ERTS_POLL_EXPORT(erts_poll_get_table_len)(min_fd + 1); ASSERT(min_fd < max_fds); if (new_len > max_fds) new_len = max_fds; @@ -1588,12 +1497,6 @@ goto done; } #endif -#if ERTS_POLL_USE_TIMERFD - if (fd == ps->timer_fd) { - new_events = ERTS_POLL_EV_NVAL; - goto done; - } -#endif } if (fd >= ps->fds_status_len) @@ -1741,9 +1644,6 @@ #if ERTS_POLL_USE_WAKEUP_PIPE int wake_fd = ps->wake_fds[0]; #endif -#if ERTS_POLL_USE_TIMERFD - int timer_fd = ps->timer_fd; -#endif for (i = 0; i < n; i++) { @@ -1759,11 +1659,6 @@ continue; } #endif -#if ERTS_POLL_USE_TIMERFD - if (fd == timer_fd) { - continue; - } -#endif ASSERT(!(ps->fds_status[fd].flags & ERTS_POLL_FD_FLG_INFLBCK)); /* epoll_wait() can repeat the same fd in result array... */ ix = (int) ps->fds_status[fd].res_ev_ix; @@ -1838,11 +1733,6 @@ continue; } #endif -#if ERTS_POLL_USE_TIMERFD - if (fd == timer_fd) { - continue; - } -#endif revents = ERTS_POLL_EV_N2E(ps->res_events[i].events); pr[res].fd = fd; pr[res].events = revents; @@ -2103,186 +1993,44 @@ } } -static ERTS_INLINE ErtsMonotonicTime -get_timeout(ErtsPollSet ps, - int resolution, - ErtsMonotonicTime timeout_time) -{ - ErtsMonotonicTime timeout, save_timeout_time; - - if (timeout_time == ERTS_POLL_NO_TIMEOUT) { - save_timeout_time = ERTS_MONOTONIC_TIME_MIN; - timeout = 0; - } - else { - ErtsMonotonicTime diff_time, current_time; - current_time = erts_get_monotonic_time(NULL); - diff_time = timeout_time - current_time; - if (diff_time <= 0) { - save_timeout_time = ERTS_MONOTONIC_TIME_MIN; - timeout = 0; - } - else { - save_timeout_time = current_time; - switch (resolution) { - case 1000: - /* Round up to nearest even milli second */ - timeout = ERTS_MONOTONIC_TO_MSEC(diff_time - 1) + 1; - if (timeout > (ErtsMonotonicTime) INT_MAX) - timeout = (ErtsMonotonicTime) INT_MAX; - save_timeout_time += ERTS_MSEC_TO_MONOTONIC(timeout); - break; - case 1000000: - /* Round up to nearest even micro second */ - timeout = ERTS_MONOTONIC_TO_USEC(diff_time - 1) + 1; - save_timeout_time += ERTS_USEC_TO_MONOTONIC(timeout); - break; - case 1000000000: - /* Round up to nearest even nano second */ - timeout = ERTS_MONOTONIC_TO_NSEC(diff_time - 1) + 1; - save_timeout_time += ERTS_NSEC_TO_MONOTONIC(timeout); - break; - default: - ERTS_INTERNAL_ERROR("Invalid resolution"); - timeout = 0; - save_timeout_time = 0; - break; - } - } - } - set_timeout_time(ps, save_timeout_time); - return timeout; -} - -#if ERTS_POLL_USE_SELECT - -static ERTS_INLINE int -get_timeout_timeval(ErtsPollSet ps, - SysTimeval *tvp, - ErtsMonotonicTime timeout_time) -{ - ErtsMonotonicTime timeout = get_timeout(ps, - 1000*1000, - timeout_time); - - if (!timeout) { - tvp->tv_sec = 0; - tvp->tv_usec = 0; - - return 0; - } - else { - ErtsMonotonicTime sec = timeout/(1000*1000); - tvp->tv_sec = sec; - tvp->tv_usec = timeout - sec*(1000*1000); - - ASSERT(tvp->tv_sec >= 0); - ASSERT(tvp->tv_usec >= 0); - ASSERT(tvp->tv_usec < 1000*1000); - - return !0; - } - -} - -#endif - -#if ERTS_POLL_USE_KQUEUE || (ERTS_POLL_USE_POLL && defined(HAVE_PPOLL)) || ERTS_POLL_USE_TIMERFD - static ERTS_INLINE int -get_timeout_timespec(ErtsPollSet ps, - struct timespec *tsp, - ErtsMonotonicTime timeout_time) -{ - ErtsMonotonicTime timeout = get_timeout(ps, - 1000*1000*1000, - timeout_time); - - if (!timeout) { - tsp->tv_sec = 0; - tsp->tv_nsec = 0; - return 0; - } - else { - ErtsMonotonicTime sec = timeout/(1000*1000*1000); - tsp->tv_sec = sec; - tsp->tv_nsec = timeout - sec*(1000*1000*1000); - - ASSERT(tsp->tv_sec >= 0); - ASSERT(tsp->tv_nsec >= 0); - ASSERT(tsp->tv_nsec < 1000*1000*1000); - - return !0; - } -} - -#endif - -#if ERTS_POLL_USE_TIMERFD - -static ERTS_INLINE int -get_timeout_itimerspec(ErtsPollSet ps, - struct itimerspec *itsp, - ErtsMonotonicTime timeout_time) -{ - - itsp->it_interval.tv_sec = 0; - itsp->it_interval.tv_nsec = 0; - - return get_timeout_timespec(ps, &itsp->it_value, timeout_time); -} - -#endif - -static ERTS_INLINE int -check_fd_events(ErtsPollSet ps, ErtsMonotonicTime timeout_time, int max_res) +check_fd_events(ErtsPollSet ps, SysTimeval *tv, int max_res) { int res; if (erts_smp_atomic_read_nob(&ps->no_of_user_fds) == 0 - && timeout_time == ERTS_POLL_NO_TIMEOUT) { + && tv->tv_usec == 0 && tv->tv_sec == 0) { /* Nothing to poll and zero timeout; done... */ return 0; } else { - int timeout; + long timeout = tv->tv_sec*1000 + tv->tv_usec/1000; + if (timeout > ERTS_AINT32_T_MAX) + timeout = ERTS_AINT32_T_MAX; + ASSERT(timeout >= 0); + erts_smp_atomic32_set_relb(&ps->timeout, (erts_aint32_t) timeout); #if ERTS_POLL_USE_FALLBACK if (!(ps->fallback_used = ERTS_POLL_NEED_FALLBACK(ps))) { #if ERTS_POLL_USE_EPOLL /* --- epoll ------------------------------- */ + if (timeout > INT_MAX) + timeout = INT_MAX; if (max_res > ps->res_events_len) grow_res_events(ps, max_res); -#if ERTS_POLL_USE_TIMERFD - { - struct itimerspec its; - timeout = get_timeout_itimerspec(ps, &its, timeout_time); - if (timeout) { -#ifdef ERTS_SMP - erts_thr_progress_prepare_wait(NULL); -#endif - timerfd_set(ps, &its); - res = epoll_wait(ps->kp_fd, ps->res_events, max_res, -1); - res = timerfd_clear(ps, res, max_res); - } else { - res = epoll_wait(ps->kp_fd, ps->res_events, max_res, 0); - } - } -#else /* !ERTS_POLL_USE_TIMERFD */ - timeout = (int) get_timeout(ps, 1000, timeout_time); #ifdef ERTS_SMP if (timeout) erts_thr_progress_prepare_wait(NULL); #endif - res = epoll_wait(ps->kp_fd, ps->res_events, max_res, timeout); -#endif /* !ERTS_POLL_USE_TIMERFD */ + res = epoll_wait(ps->kp_fd, ps->res_events, max_res, (int)timeout); #elif ERTS_POLL_USE_KQUEUE /* --- kqueue ------------------------------ */ struct timespec ts; if (max_res > ps->res_events_len) grow_res_events(ps, max_res); - timeout = get_timeout_timespec(ps, &ts, timeout_time); #ifdef ERTS_SMP if (timeout) erts_thr_progress_prepare_wait(NULL); #endif + ts.tv_sec = tv->tv_sec; + ts.tv_nsec = tv->tv_usec*1000; res = kevent(ps->kp_fd, NULL, 0, ps->res_events, max_res, &ts); #endif /* ----------------------------------------- */ } @@ -2301,7 +2049,8 @@ #if ERTS_POLL_USE_WAKEUP_PIPE nfds++; /* Wakeup pipe */ #endif - timeout = (int) get_timeout(ps, 1000, timeout_time); + if (timeout > INT_MAX) + timeout = INT_MAX; poll_res.dp_nfds = nfds < max_res ? nfds : max_res; if (poll_res.dp_nfds > ps->res_events_len) grow_res_events(ps, poll_res.dp_nfds); @@ -2310,41 +2059,33 @@ if (timeout) erts_thr_progress_prepare_wait(NULL); #endif - poll_res.dp_timeout = timeout; + poll_res.dp_timeout = (int) timeout; res = ioctl(ps->kp_fd, DP_POLL, &poll_res); -#elif ERTS_POLL_USE_POLL && defined(HAVE_PPOLL) /* --- ppoll ---------------- */ - struct timespec ts; - timeout = get_timeout_timespec(ps, &ts, timeout_time); -#ifdef ERTS_SMP - if (timeout) - erts_thr_progress_prepare_wait(NULL); -#endif - res = ppoll(ps->poll_fds, ps->no_poll_fds, &ts, NULL); -#elif ERTS_POLL_USE_POLL /* --- poll --------------------------------- */ - timeout = (int) get_timeout(ps, 1000, timeout_time); +#elif ERTS_POLL_USE_POLL /* --- poll -------------------------------- */ + if (timeout > INT_MAX) + timeout = INT_MAX; #ifdef ERTS_SMP if (timeout) erts_thr_progress_prepare_wait(NULL); #endif - res = poll(ps->poll_fds, ps->no_poll_fds, timeout); + res = poll(ps->poll_fds, ps->no_poll_fds, (int) timeout); #elif ERTS_POLL_USE_SELECT /* --- select ------------------------------ */ - SysTimeval to; - timeout = get_timeout_timeval(ps, &to, timeout_time); + SysTimeval to = *tv; ERTS_FD_COPY(&ps->input_fds, &ps->res_input_fds); ERTS_FD_COPY(&ps->output_fds, &ps->res_output_fds); - + #ifdef ERTS_SMP - if (timeout) + if (to.tv_sec || to.tv_usec) erts_thr_progress_prepare_wait(NULL); #endif res = ERTS_SELECT(ps->max_fd + 1, - &ps->res_input_fds, - &ps->res_output_fds, - NULL, - &to); + &ps->res_input_fds, + &ps->res_output_fds, + NULL, + &to); #ifdef ERTS_SMP - if (timeout) + if (to.tv_sec || to.tv_usec) erts_thr_progress_finalize_wait(NULL); if (res < 0 && errno == EBADF @@ -2367,10 +2108,10 @@ handle_update_requests(ps); ERTS_POLLSET_UNLOCK(ps); res = ERTS_SELECT(ps->max_fd + 1, - &ps->res_input_fds, - &ps->res_output_fds, - NULL, - &to); + &ps->res_input_fds, + &ps->res_output_fds, + NULL, + &to); if (res == 0) { errno = EAGAIN; res = -1; @@ -2392,14 +2133,15 @@ ERTS_POLL_EXPORT(erts_poll_wait)(ErtsPollSet ps, ErtsPollResFd pr[], int *len, - ErtsMonotonicTime timeout_time) + SysTimeval *utvp) { - ErtsMonotonicTime to; int res, no_fds; int ebadf = 0; #ifdef ERTS_SMP int ps_locked = 0; #endif + SysTimeval *tvp; + SysTimeval itv; no_fds = *len; #ifdef ERTS_POLL_MAX_RES @@ -2409,9 +2151,13 @@ *len = 0; + ASSERT(utvp); + + tvp = utvp; + #ifdef ERTS_POLL_DEBUG_PRINT - erts_printf("Entering erts_poll_wait(), timeout_time=%bps\n", - timeout_time); + erts_printf("Entering erts_poll_wait(), timeout=%d\n", + (int) tvp->tv_sec*1000 + tvp->tv_usec/1000); #endif if (ERTS_POLLSET_SET_POLLED_CHK(ps)) { @@ -2420,9 +2166,12 @@ goto done; } - to = (is_woken(ps) - ? ERTS_POLL_NO_TIMEOUT /* Use zero timeout */ - : timeout_time); + if (is_woken(ps)) { + /* Use zero timeout */ + itv.tv_sec = 0; + itv.tv_usec = 0; + tvp = &itv; + } #if ERTS_POLL_USE_UPDATE_REQUESTS_QUEUE if (ERTS_POLLSET_HAVE_UPDATE_REQUESTS(ps)) { @@ -2432,7 +2181,7 @@ } #endif - res = check_fd_events(ps, to, no_fds); + res = check_fd_events(ps, tvp, no_fds); woke_up(ps); @@ -2475,7 +2224,7 @@ #endif done: - set_timeout_time(ps, ERTS_MONOTONIC_TIME_MAX); + erts_smp_atomic32_set_relb(&ps->timeout, ERTS_AINT32_T_MAX); #ifdef ERTS_POLL_DEBUG_PRINT erts_printf("Leaving %s = erts_poll_wait()\n", res == 0 ? "0" : erl_errno_id(res)); @@ -2519,14 +2268,13 @@ void ERTS_POLL_EXPORT(erts_poll_interrupt_timed)(ErtsPollSet ps, int set, - ErtsMonotonicTime timeout_time) + erts_short_time_t msec) { #if ERTS_POLL_ASYNC_INTERRUPT_SUPPORT || defined(ERTS_SMP) if (!set) reset_wakeup_state(ps); else { - ErtsMonotonicTime max_wait_time = get_timeout_time(ps); - if (max_wait_time > timeout_time) + if (erts_smp_atomic32_read_acqb(&ps->timeout) > (erts_aint32_t) msec) wake_poller(ps, 1, 0); #ifdef ERTS_POLL_COUNT_AVOIDED_WAKEUPS else { @@ -2666,9 +2414,6 @@ #if ERTS_POLL_USE_WAKEUP_PIPE create_wakeup_pipe(ps); #endif -#if ERTS_POLL_USE_TIMERFD - create_timerfd(ps); -#endif #if ERTS_POLL_USE_FALLBACK if (kp_fd >= ps->fds_status_len) grow_fds_status(ps, kp_fd); @@ -2686,7 +2431,7 @@ ps->internal_fd_limit = kp_fd + 1; ps->kp_fd = kp_fd; #endif - init_timeout_time(ps); + erts_smp_atomic32_init_nob(&ps->timeout, ERTS_AINT32_T_MAX); #ifdef ERTS_POLL_COUNT_AVOIDED_WAKEUPS erts_smp_atomic_init_nob(&ps->no_avoided_wakeups, 0); erts_smp_atomic_init_nob(&ps->no_avoided_interrupts, 0); @@ -2759,10 +2504,6 @@ if (ps->wake_fds[1] >= 0) close(ps->wake_fds[1]); #endif -#if ERTS_POLL_USE_TIMERFD - if (ps->timer_fd >= 0) - close(ps->timer_fd); -#endif erts_smp_spin_lock(&pollsets_lock); if (ps == pollsets) @@ -2867,9 +2608,6 @@ #if ERTS_POLL_USE_WAKEUP_PIPE pip->poll_set_size++; /* Wakeup pipe */ #endif -#if ERTS_POLL_USE_TIMERFD - pip->poll_set_size++; /* timerfd */ -#endif pip->fallback_poll_set_size = #if !ERTS_POLL_USE_FALLBACK @@ -2998,18 +2736,14 @@ ev[fd] = 0; else { ev[fd] = ps->fds_status[fd].events; - if ( #if ERTS_POLL_USE_WAKEUP_PIPE - fd == ps->wake_fds[0] || fd == ps->wake_fds[1] || -#endif -#if ERTS_POLL_USE_TIMERFD - fd == ps->timer_fd || + if (fd == ps->wake_fds[0] || fd == ps->wake_fds[1]) + ev[fd] |= ERTS_POLL_EV_NVAL; #endif #if ERTS_POLL_USE_KERNEL_POLL - fd == ps->kp_fd || + if (fd == ps->kp_fd) + ev[fd] |= ERTS_POLL_EV_NVAL; #endif - 0) - ev[fd] |= ERTS_POLL_EV_NVAL; } } ERTS_POLLSET_UNLOCK(ps); diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_poll.h erlang-17.3-dfsg/erts/emulator/sys/common/erl_poll.h --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_poll.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_poll.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -30,8 +29,6 @@ #include "sys.h" -#define ERTS_POLL_NO_TIMEOUT ERTS_MONOTONIC_TIME_MIN - #if 0 #define ERTS_POLL_COUNT_AVOIDED_WAKEUPS #endif @@ -99,8 +96,6 @@ # endif #endif -#define ERTS_POLL_USE_TIMERFD 0 - typedef Uint32 ErtsPollEvents; #undef ERTS_POLL_EV_E2N @@ -133,14 +128,8 @@ #include -#ifdef HAVE_SYS_TIMERFD_H -#include -#undef ERTS_POLL_USE_TIMERFD -#define ERTS_POLL_USE_TIMERFD 1 -#endif - #define ERTS_POLL_EV_E2N(EV) \ - ((uint32_t) (EV)) + ((__uint32_t) (EV)) #define ERTS_POLL_EV_N2E(EV) \ ((ErtsPollEvents) (EV)) @@ -252,7 +241,7 @@ int); void ERTS_POLL_EXPORT(erts_poll_interrupt_timed)(ErtsPollSet, int, - ErtsMonotonicTime); + erts_short_time_t); ErtsPollEvents ERTS_POLL_EXPORT(erts_poll_control)(ErtsPollSet, ErtsSysFdType, ErtsPollEvents, @@ -265,7 +254,7 @@ int ERTS_POLL_EXPORT(erts_poll_wait)(ErtsPollSet, ErtsPollResFd [], int *, - ErtsMonotonicTime); + SysTimeval *); int ERTS_POLL_EXPORT(erts_poll_max_fds)(void); void ERTS_POLL_EXPORT(erts_poll_info)(ErtsPollSet, ErtsPollInfo *); @@ -276,6 +265,6 @@ ErtsPollEvents [], int); -int erts_poll_new_table_len(int old_len, int need_len); +int ERTS_POLL_EXPORT(erts_poll_get_table_len)(int); #endif /* #ifndef ERL_POLL_H__ */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_sys_common_misc.c erlang-17.3-dfsg/erts/emulator/sys/common/erl_sys_common_misc.c --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_sys_common_misc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_sys_common_misc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -45,14 +44,6 @@ #endif #endif -/* - * erts_check_io_time is used by the erl_check_io implementation. The - * global erts_check_io_time variable is declared here since there - * (often) exist two versions of erl_check_io (kernel-poll and - * non-kernel-poll), and we dont want two versions of this variable. - */ -erts_smp_atomic_t erts_check_io_time; - /* Written once and only once */ static int filename_encoding = ERL_FILENAME_UNKNOWN; diff -Nru erlang-18.2-dfsg/erts/emulator/sys/common/erl_util_queue.h erlang-17.3-dfsg/erts/emulator/sys/common/erl_util_queue.h --- erlang-18.2-dfsg/erts/emulator/sys/common/erl_util_queue.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/common/erl_util_queue.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/ose/driver_int.h erlang-17.3-dfsg/erts/emulator/sys/ose/driver_int.h --- erlang-18.2-dfsg/erts/emulator/sys/ose/driver_int.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/ose/driver_int.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/ose/erl_main.c erlang-17.3-dfsg/erts/emulator/sys/ose/erl_main.c --- erlang-18.2-dfsg/erts/emulator/sys/ose/erl_main.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/ose/erl_main.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/ose/erl_ose_sys_ddll.c erlang-17.3-dfsg/erts/emulator/sys/ose/erl_ose_sys_ddll.c --- erlang-18.2-dfsg/erts/emulator/sys/ose/erl_ose_sys_ddll.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/ose/erl_ose_sys_ddll.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/ose/erl_ose_sys.h erlang-17.3-dfsg/erts/emulator/sys/ose/erl_ose_sys.h --- erlang-18.2-dfsg/erts/emulator/sys/ose/erl_ose_sys.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/ose/erl_ose_sys.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * @@ -113,8 +112,6 @@ /* No use in having other resolutions than 1 Ms. */ #define SYS_CLOCK_RESOLUTION 1 -#define erts_isfinite finite - #ifdef NO_FPE_SIGNALS #define erts_get_current_fp_exception() NULL diff -Nru erlang-18.2-dfsg/erts/emulator/sys/ose/erl_poll.c erlang-17.3-dfsg/erts/emulator/sys/ose/erl_poll.c --- erlang-18.2-dfsg/erts/emulator/sys/ose/erl_poll.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/ose/erl_poll.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -115,7 +114,7 @@ Uint item_count; PROCESS interrupt; erts_atomic32_t wakeup_state; - erts_atomic64_t timeout_time; + erts_smp_atomic32_t timeout; #ifdef ERTS_SMP erts_smp_mtx_t mtx; #endif @@ -123,26 +122,6 @@ static int max_fds = -1; -static ERTS_INLINE void -init_timeout_time(ErtsPollSet ps) -{ - erts_atomic64_init_nob(&ps->timeout_time, - (erts_aint64_t) ERTS_MONOTONIC_TIME_MAX); -} - -static ERTS_INLINE void -set_timeout_time(ErtsPollSet ps, ErtsMonotonicTime time) -{ - erts_atomic64_set_relb(&ps->timeout_time, - (erts_aint64_t) time); -} - -static ERTS_INLINE ErtsMonotonicTime -get_timeout_time(ErtsPollSet ps) -{ - return (ErtsMonotonicTime) erts_atomic64_read_acqb(&ps->timeout_time); -} - #define ERTS_POLL_NOT_WOKEN ((erts_aint32_t) (1 << 0)) #define ERTS_POLL_WOKEN_INTR ((erts_aint32_t) (1 << 1)) #define ERTS_POLL_WOKEN_TIMEDOUT ((erts_aint32_t) (1 << 2)) @@ -407,14 +386,12 @@ } -void erts_poll_interrupt_timed(ErtsPollSet ps, - int set, - ErtsTimeoutTime timeout_time) { +void erts_poll_interrupt_timed(ErtsPollSet ps,int set,erts_short_time_t msec) { HARDTRACEF("erts_poll_interrupt_timed called!\n"); if (!set) reset_interrupt(ps); - else if (get_timeout_time(ps) > timeout_time) + else if (erts_smp_atomic32_read_acqb(&ps->timeout) > (erts_aint32_t) msec) set_interrupt(ps); } @@ -476,14 +453,12 @@ } int erts_poll_wait(ErtsPollSet ps, - ErtsPollResFd pr[], - int *len, - ErtsMonotonicTime timeout_time) -{ + ErtsPollResFd pr[], + int *len, + SysTimeval *utvp) { int res = ETIMEDOUT, no_fds, currid = 0; OSTIME timeout; union SIGNAL *sig; - ErtsMonotonicTime current_time, diff_time, timeout; // HARDTRACEF("%ux: In erts_poll_wait",ps); if (ps->interrupt == (PROCESS)0) ps->interrupt = current_process(); @@ -497,29 +472,16 @@ *len = 0; - /* erts_printf("Entering erts_poll_wait(), timeout_time=%bps\n", - timeout_time); */ + ASSERT(utvp); - if (timeout_time == ERTS_POLL_NO_TIMEOUT) { - no_timeout: - timeout = (OSTIME) 0; - save_timeout_time = ERTS_MONOTONIC_TIME_MIN; - } - else { - ErtsMonotonicTime current_time, diff_time; - current_time = erts_get_monotonic_time(NULL); - diff_time = timeout_time - current_time; - if (diff_time <= 0) - goto no_timeout; - diff_time = (ERTS_MONOTONIC_TO_MSEC(diff_time - 1) + 1); - if (diff_time > INT_MAX) - diff_time = INT_MAX; - timeout = (OSTIME) diff_time; - save_timeout_time = current_time; - save_timeout_time += ERTS_MSEC_TO_MONOTONIC(diff_time); - } + /* erts_printf("Entering erts_poll_wait(), timeout=%d\n", + (int) utvp->tv_sec*1000 + utvp->tv_usec/1000); */ + + timeout = utvp->tv_sec*1000 + utvp->tv_usec/1000; - set_timeout_time(ps, save_timeout_time); + if (timeout > ((time_t) ERTS_AINT32_T_MAX)) + timeout = ERTS_AINT32_T_MAX; + erts_smp_atomic32_set_relb(&ps->timeout, (erts_aint32_t) timeout); while (currid < no_fds) { if (timeout > 0) { @@ -665,7 +627,7 @@ } erts_atomic32_set_nob(&ps->wakeup_state, ERTS_POLL_NOT_WOKEN); - set_timeout_time(ps, ERTS_MONOTONIC_TIME_MAX); + erts_smp_atomic32_set_nob(&ps->timeout, ERTS_AINT32_T_MAX); *len = currid; @@ -728,7 +690,7 @@ ps->info = NULL; ps->interrupt = (PROCESS)0; erts_atomic32_init_nob(&ps->wakeup_state, ERTS_POLL_NOT_WOKEN); - init_timeout_time(ps); + erts_smp_atomic32_init_nob(&ps->timeout, ERTS_AINT32_T_MAX); #ifdef ERTS_SMP erts_smp_mtx_init(&ps->mtx, "pollset"); #endif diff -Nru erlang-18.2-dfsg/erts/emulator/sys/ose/sys.c erlang-17.3-dfsg/erts/emulator/sys/ose/sys.c --- erlang-18.2-dfsg/erts/emulator/sys/ose/sys.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/ose/sys.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -299,9 +298,9 @@ #ifdef ERTS_SMP void -erts_sys_schedule_interrupt_timed(int set, ErtsMonotonicTime timeout_time) +erts_sys_schedule_interrupt_timed(int set, erts_short_time_t msec) { - ERTS_CHK_IO_INTR_TMD(set, timeout_time); + ERTS_CHK_IO_INTR_TMD(set, msec); } #endif diff -Nru erlang-18.2-dfsg/erts/emulator/sys/ose/sys_float.c erlang-17.3-dfsg/erts/emulator/sys/ose/sys_float.c --- erlang-18.2-dfsg/erts/emulator/sys/ose/sys_float.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/ose/sys_float.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/ose/sys_time.c erlang-17.3-dfsg/erts/emulator/sys/ose/sys_time.c --- erlang-18.2-dfsg/erts/emulator/sys/ose/sys_time.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/ose/sys_time.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/unix/driver_int.h erlang-17.3-dfsg/erts/emulator/sys/unix/driver_int.h --- erlang-18.2-dfsg/erts/emulator/sys/unix/driver_int.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/unix/driver_int.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/unix/erl_child_setup.c erlang-17.3-dfsg/erts/emulator/sys/unix/erl_child_setup.c --- erlang-18.2-dfsg/erts/emulator/sys/unix/erl_child_setup.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/unix/erl_child_setup.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -56,7 +55,7 @@ #endif /* !SIG_SIGSET */ #if defined(__ANDROID__) -static int system_properties_fd(void); +int __system_properties_fd(void); #endif /* __ANDROID__ */ #if defined(__ANDROID__) @@ -102,22 +101,22 @@ if (sscanf(argv[CS_ARGV_FD_CR_IX], "%d:%d", &from, &to) != 2) return 1; +#if defined(__ANDROID__) + for (i = from; i <= to; i++) { + if (i!=__system_properties_fd) + (void) close(i); + } +#else + for (i = from; i <= to; i++) + (void) close(i); +#endif /* __ANDROID__ */ + #if defined(HAVE_CLOSEFROM) closefrom(from); -#elif defined(__ANDROID__) - if (from <= to) { - int spfd = system_properties_fd(); - for (i = from; i <= to; i++) { - if (i != spfd) { - (void) close(i); - } - } - } -#else /* !__ANDROID__ */ - for (i = from; i <= to; i++) { +#else + for (i = from; i <= to; i++) (void) close(i); - } -#endif /* HAVE_CLOSEFROM */ +#endif if (!(argv[CS_ARGV_WD_IX][0] == '.' && argv[CS_ARGV_WD_IX][1] == '\0') && chdir(argv[CS_ARGV_WD_IX]) < 0) @@ -148,10 +147,12 @@ return 1; } + + #if defined(__ANDROID__) -static int system_properties_fd(void) +int __system_properties_fd(void) { - int fd; + int s, fd; char *env; env = getenv("ANDROID_PROPERTY_WORKSPACE"); @@ -162,3 +163,4 @@ return fd; } #endif /* __ANDROID__ */ + diff -Nru erlang-18.2-dfsg/erts/emulator/sys/unix/erl_main.c erlang-17.3-dfsg/erts/emulator/sys/unix/erl_main.c --- erlang-18.2-dfsg/erts/emulator/sys/unix/erl_main.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/unix/erl_main.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/unix/erl_unix_sys_ddll.c erlang-17.3-dfsg/erts/emulator/sys/unix/erl_unix_sys_ddll.c --- erlang-18.2-dfsg/erts/emulator/sys/unix/erl_unix_sys_ddll.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/unix/erl_unix_sys_ddll.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/unix/erl_unix_sys.h erlang-17.3-dfsg/erts/emulator/sys/unix/erl_unix_sys.h --- erlang-18.2-dfsg/erts/emulator/sys/unix/erl_unix_sys.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/unix/erl_unix_sys.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * @@ -46,7 +45,7 @@ #include #include "erl_errno.h" #include -#include + #if HAVE_SYS_SOCKETIO_H # include @@ -115,6 +114,11 @@ /* * Make sure that MAXPATHLEN is defined. */ +#ifdef GETHRTIME_WITH_CLOCK_GETTIME +#undef HAVE_GETHRTIME +#define HAVE_GETHRTIME 1 +#endif + #ifndef MAXPATHLEN # ifdef PATH_MAX # define MAXPATHLEN PATH_MAX @@ -131,6 +135,9 @@ /* File descriptors are numbers anc consecutively allocated on Unix */ #define ERTS_SYS_CONTINOUS_FD_NUMBERS +#define HAVE_ERTS_CHECK_IO_DEBUG +int erts_check_io_debug(void); + #ifndef ERTS_SMP # undef ERTS_POLL_NEED_ASYNC_INTERRUPT_SUPPORT # define ERTS_POLL_NEED_ASYNC_INTERRUPT_SUPPORT @@ -156,134 +163,35 @@ typedef struct tms SysTimes; -#define SYS_CLK_TCK (erts_sys_time_data__.r.o.ticks_per_sec) - -#define sys_times(Arg) times(Arg) - -#if SIZEOF_LONG == 8 -typedef long ErtsMonotonicTime; -typedef long ErtsSysHrTime; -#elif SIZEOF_LONG_LONG == 8 -typedef long long ErtsMonotonicTime; -typedef long long ErtsSysHrTime; -#else -#error No signed 64-bit type found... -#endif - -typedef ErtsMonotonicTime ErtsSystemTime; - -#define ERTS_MONOTONIC_TIME_MIN (((ErtsMonotonicTime) 1) << 63) -#define ERTS_MONOTONIC_TIME_MAX (~ERTS_MONOTONIC_TIME_MIN) - -/* - * OS monotonic time and OS system time - */ -#undef ERTS_OS_TIMES_INLINE_FUNC_PTR_CALL__ - -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) \ - && defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) -# if defined(__linux__) -# define ERTS_OS_TIMES_INLINE_FUNC_PTR_CALL__ 1 -# endif -#endif - -ErtsSystemTime erts_os_system_time(void); - -#undef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT -#undef ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT -#undef ERTS_OS_MONOTONIC_INLINE_FUNC_PTR_CALL__ - -#if defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) -# define ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT 1 -# define ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT (1000*1000*1000) -# if defined(__linux__) -# define ERTS_OS_MONOTONIC_INLINE_FUNC_PTR_CALL__ 1 -# endif -#elif defined(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME) -# define ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT 1 -# define ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT (1000*1000*1000) -#elif defined(OS_MONOTONIC_TIME_USING_GETHRTIME) -# define ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT 1 -# define ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT (1000*1000*1000) -#elif defined(OS_MONOTONIC_TIME_USING_TIMES) -# define ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT 1 -/* Time unit determined at runtime... */ -# define ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT 0 -#else /* No OS monotonic available... */ -# define ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT (1000*1000) -#endif - -/* - * erts_sys_hrtime() is the highest resolution - * time function found. Time unit is nano-seconds. - * It may or may not be monotonic. - */ -ErtsSysHrTime erts_sys_hrtime(void); - -struct erts_sys_time_read_only_data__ { -#ifdef ERTS_OS_MONOTONIC_INLINE_FUNC_PTR_CALL__ - ErtsMonotonicTime (*os_monotonic_time)(void); -#endif -#ifdef ERTS_OS_TIMES_INLINE_FUNC_PTR_CALL__ - void (*os_times)(ErtsMonotonicTime *, ErtsSystemTime *); -#endif - int ticks_per_sec; -}; - -typedef struct { - union { - struct erts_sys_time_read_only_data__ o; - char align__[(((sizeof(struct erts_sys_time_read_only_data__) - 1) - / ASSUMED_CACHE_LINE_SIZE) + 1) - * ASSUMED_CACHE_LINE_SIZE]; - } r; -} ErtsSysTimeData__; - -extern ErtsSysTimeData__ erts_sys_time_data__; - -#ifdef ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT - -#ifdef ERTS_OS_MONOTONIC_INLINE_FUNC_PTR_CALL__ -ERTS_GLB_INLINE -#endif -ErtsMonotonicTime erts_os_monotonic_time(void); +extern int erts_ticks_per_sec; -#ifdef ERTS_OS_TIMES_INLINE_FUNC_PTR_CALL__ -ERTS_GLB_INLINE -#endif -void erts_os_times(ErtsMonotonicTime *, ErtsSystemTime *); +#define SYS_CLK_TCK (erts_ticks_per_sec) -#if ERTS_GLB_INLINE_INCL_FUNC_DEF +#define sys_times(Arg) times(Arg) -#ifdef ERTS_OS_MONOTONIC_INLINE_FUNC_PTR_CALL__ +#define ERTS_WRAP_SYS_TIMES 1 +extern int erts_ticks_per_sec_wrap; +#define SYS_CLK_TCK_WRAP (erts_ticks_per_sec_wrap) +extern clock_t sys_times_wrap(void); -ERTS_GLB_INLINE ErtsMonotonicTime -erts_os_monotonic_time(void) -{ - return (*erts_sys_time_data__.r.o.os_monotonic_time)(); -} +#ifdef HAVE_GETHRTIME +#ifdef GETHRTIME_WITH_CLOCK_GETTIME +typedef long long SysHrTime; -#endif /* ERTS_OS_MONOTONIC_INLINE_FUNC_PTR_CALL__ */ +extern SysHrTime sys_gethrtime(void); +#define sys_init_hrtime() /* Nothing */ -#ifdef ERTS_OS_TIMES_INLINE_FUNC_PTR_CALL__ +#else /* Real gethrtime (Solaris) */ -ERTS_GLB_INLINE void -erts_os_times(ErtsMonotonicTime *mtimep, ErtsSystemTime *stimep) -{ - return (*erts_sys_time_data__.r.o.os_times)(mtimep, stimep); -} +typedef hrtime_t SysHrTime; -#endif /* ERTS_OS_TIMES_INLINE_FUNC_PTR_CALL__ */ +#define sys_gethrtime() gethrtime() +#define sys_init_hrtime() /* Nothing */ -#endif /* ERTS_GLB_INLINE_INCL_FUNC_DEF */ +#endif /* GETHRTIME_WITH_CLOCK_GETTIME */ +#endif /* HAVE_GETHRTIME */ -#endif /* ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT */ - -/* - * - */ - -#if (defined(HAVE_GETHRVTIME) || defined(HAVE_CLOCK_GETTIME_CPU_TIME)) +#if (defined(HAVE_GETHRVTIME) || defined(HAVE_CLOCK_GETTIME)) typedef long long SysCpuTime; typedef struct timespec SysTimespec; @@ -295,7 +203,7 @@ int sys_start_hrvtime(void); int sys_stop_hrvtime(void); -#elif defined(HAVE_CLOCK_GETTIME_CPU_TIME) +#elif defined(HAVE_CLOCK_GETTIME) #define sys_clock_gettime(cid,tp) clock_gettime((cid),&(tp)) #define sys_get_proc_cputime(t,tp) sys_clock_gettime(CLOCK_PROCESS_CPUTIME_ID,(tp)) @@ -306,8 +214,13 @@ #define SYS_CLOCK_RESOLUTION 1 /* These are defined in sys.c */ -typedef void (*SIGFUNC)(int); -extern SIGFUNC sys_signal(int, SIGFUNC); +#if defined(SIG_SIGSET) /* Old SysV */ +RETSIGTYPE (*sys_sigset())(); +#elif defined(SIG_SIGNAL) /* Old BSD */ +RETSIGTYPE (*sys_sigset())(); +#else +RETSIGTYPE (*sys_sigset(int, RETSIGTYPE (*func)(int)))(int); +#endif extern void sys_sigrelease(int); extern void sys_sigblock(int); extern void sys_stop_cat(void); @@ -317,28 +230,10 @@ */ #ifdef USE_ISINF_ISNAN /* simulate finite() */ -# define isfinite(f) (!isinf(f) && !isnan(f)) -# define HAVE_ISFINITE -#elif (defined(__GNUC__) && !defined(__llvm__)) && defined(HAVE_FINITE) -/* We use finite in gcc as it emits assembler instead of - the function call that isfinite emits. The assembler is - significantly faster. */ -# ifdef isfinite -# undef isfinite -# endif -# define isfinite finite -# ifndef HAVE_ISFINITE -# define HAVE_ISFINITE -# endif -#elif defined(isfinite) && !defined(HAVE_ISFINITE) -# define HAVE_ISFINITE -#elif !defined(HAVE_ISFINITE) && defined(HAVE_FINITE) -# define isfinite finite -# define HAVE_ISFINITE +# define finite(f) (!isinf(f) && !isnan(f)) +# define HAVE_FINITE #endif -#define erts_isfinite isfinite - #ifdef NO_FPE_SIGNALS #define erts_get_current_fp_exception() NULL @@ -346,7 +241,7 @@ #define erts_thread_init_fp_exception() do{}while(0) #endif # define __ERTS_FP_CHECK_INIT(fpexnp) do {} while (0) -# define __ERTS_FP_ERROR(fpexnp, f, Action) if (!isfinite(f)) { Action; } else {} +# define __ERTS_FP_ERROR(fpexnp, f, Action) if (!finite(f)) { Action; } else {} # define __ERTS_FP_ERROR_THOROUGH(fpexnp, f, Action) __ERTS_FP_ERROR(fpexnp, f, Action) # define __ERTS_SAVE_FP_EXCEPTION(fpexnp) # define __ERTS_RESTORE_FP_EXCEPTION(fpexnp) @@ -410,7 +305,7 @@ code to always throw floating-point exceptions on errors. */ static __inline__ int erts_check_fpe_thorough(volatile unsigned long *fp_exception, double f) { - return erts_check_fpe(fp_exception, f) || !isfinite(f); + return erts_check_fpe(fp_exception, f) || !finite(f); } # define __ERTS_FP_ERROR_THOROUGH(fpexnp, f, Action) \ do { if (erts_check_fpe_thorough((fpexnp),(f))) { Action; } } while (0) @@ -446,28 +341,4 @@ #define ERTS_EXIT_AFTER_DUMP _exit -#if !defined(__APPLE__) && !defined(__MACH__) -/* Some OS X versions do not allow (ab)using signal handlers like this */ -#define ERTS_HAVE_TRY_CATCH 1 - -/* We try to simulate a try catch in C with the help of signal handlers. - * Only use this as a very last resort, as it is not very portable and - * quite unstable. It is also not thread safe, so make sure that only - * one thread can call this at a time! - */ -extern void erts_sys_sigsegv_handler(int); -extern jmp_buf erts_sys_sigsegv_jmp; -#define ERTS_SYS_TRY_CATCH(EXPR,CATCH) \ - do { \ - SIGFUNC prev_handler = sys_signal(SIGSEGV, \ - erts_sys_sigsegv_handler); \ - if (!setjmp(erts_sys_sigsegv_jmp)) { \ - EXPR; \ - } else { \ - CATCH; \ - } \ - sys_signal(SIGSEGV,prev_handler); \ - } while(0) -#endif - #endif /* #ifndef _ERL_UNIX_SYS_H */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/unix/sys.c erlang-17.3-dfsg/erts/emulator/sys/unix/sys.c --- erlang-18.2-dfsg/erts/emulator/sys/unix/sys.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/unix/sys.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -35,7 +34,6 @@ #include #include #include -#include #ifdef ISC32 #include @@ -87,24 +85,14 @@ #define DISABLE_VFORK 0 #endif -#if defined IOV_MAX -#define MAXIOV IOV_MAX -#elif defined UIO_MAXIOV -#define MAXIOV UIO_MAXIOV -#else -#define MAXIOV 16 -#endif - #ifdef USE_THREADS # ifdef ENABLE_CHILD_WAITER_THREAD # define CHLDWTHR ENABLE_CHILD_WAITER_THREAD # else # define CHLDWTHR 0 # endif -# define FDBLOCK 1 #else # define CHLDWTHR 0 -# define FDBLOCK 0 #endif /* * [OTP-3906] @@ -133,15 +121,6 @@ #endif }; -/* Used by the fd driver iff the fd could not be set to non-blocking */ -typedef struct ErtsSysBlocking_ { - ErlDrvPDL pdl; - int res; - int err; - unsigned int pkey; -} ErtsSysBlocking; - - /* This data is shared by these drivers - initialized by spawn_init() */ static struct driver_data { ErlDrvPort port_num; @@ -150,8 +129,6 @@ int pid; int alive; int status; - int terminating; - ErtsSysBlocking *blocking; } *driver_data; /* indexed by fd */ static ErtsSysReportExit *report_exit_list; @@ -225,14 +202,10 @@ #if defined(ERTS_SMP) static void smp_sig_notify(char c); static int sig_notify_fds[2] = {-1, -1}; - -static int sig_suspend_fds[2] = {-1, -1}; -#define ERTS_SYS_SUSPEND_SIGNAL SIGUSR2 - +#elif defined(USE_THREADS) +static int async_fd[2]; #endif -jmp_buf erts_sys_sigsegv_jmp; - #if CHLDWTHR || defined(ERTS_SMP) erts_mtx_t chld_stat_mtx; #endif @@ -273,8 +246,6 @@ static void* child_waiter(void *); #endif -static int crashdump_companion_cube_fd = -1; - /********************* General functions ****************************/ /* This is used by both the drivers and general I/O, must be set early */ @@ -309,11 +280,11 @@ int (*event)(ErlDrvPort, ErlDrvEvent, ErlDrvEventData); void (*check_io_as_interrupt)(void); void (*check_io_interrupt)(int); - void (*check_io_interrupt_tmd)(int, ErtsMonotonicTime); + void (*check_io_interrupt_tmd)(int, erts_short_time_t); void (*check_io)(int); Uint (*size)(void); Eterm (*info)(void *); - int (*check_io_debug)(ErtsCheckIoDebugInfo *); + int (*check_io_debug)(void); } io_func = {0}; @@ -335,9 +306,9 @@ } int -erts_check_io_debug(ErtsCheckIoDebugInfo *ip) +erts_check_io_debug(void) { - return (*io_func.check_io_debug)(ip); + return (*io_func.check_io_debug)(); } @@ -415,9 +386,9 @@ #ifdef ERTS_SMP void -erts_sys_schedule_interrupt_timed(int set, ErtsMonotonicTime timeout_time) +erts_sys_schedule_interrupt_timed(int set, erts_short_time_t msec) { - ERTS_CHK_IO_INTR_TMD(set, timeout_time); + ERTS_CHK_IO_INTR_TMD(set, msec); } #endif @@ -533,14 +504,11 @@ void erts_sys_pre_init(void) { -#ifdef USE_THREADS - erts_thr_init_data_t eid = ERTS_THR_INIT_DATA_DEF_INITER; -#endif - erts_printf_add_cr_to_stdout = 1; erts_printf_add_cr_to_stderr = 1; - #ifdef USE_THREADS + { + erts_thr_init_data_t eid = ERTS_THR_INIT_DATA_DEF_INITER; eid.thread_create_child_func = thr_create_prepare_child; /* Before creation in parent */ @@ -563,12 +531,6 @@ erts_lcnt_init(); #endif -#endif /* USE_THREADS */ - - erts_init_sys_time_sup(); - -#ifdef USE_THREADS - #if CHLDWTHR || defined(ERTS_SMP) erts_mtx_init(&chld_stat_mtx, "child_status"); #endif @@ -579,7 +541,7 @@ erts_cnd_init(&chld_stat_cnd); children_alive = 0; #endif - + } #ifdef ERTS_SMP erts_smp_atomic32_init_nob(&erts_break_requested, 0); erts_smp_atomic32_init_nob(&erts_got_sigusr1, 0); @@ -592,9 +554,7 @@ #if !CHLDWTHR && !defined(ERTS_SMP) children_died = 0; #endif - #endif /* USE_THREADS */ - erts_smp_atomic_init_nob(&sys_misc_mem_sz, 0); { @@ -615,14 +575,6 @@ close(fd); } - /* We need a file descriptor to close in the crashdump creation. - * We close this one to be sure we can get a fd for our real file ... - * so, we create one here ... a stone to carry all the way home. - */ - - crashdump_companion_cube_fd = open("/dev/null", O_RDONLY); - - /* don't lose it, there will be cake */ } void @@ -680,7 +632,39 @@ /* signal handling */ -SIGFUNC sys_signal(int sig, SIGFUNC func) +#ifdef SIG_SIGSET /* Old SysV */ +RETSIGTYPE (*sys_sigset(sig, func))() +int sig; +RETSIGTYPE (*func)(); +{ + return(sigset(sig, func)); +} +void sys_sigblock(int sig) +{ + sighold(sig); +} +void sys_sigrelease(int sig) +{ + sigrelse(sig); +} +#else /* !SIG_SIGSET */ +#ifdef SIG_SIGNAL /* Old BSD */ +RETSIGTYPE (*sys_sigset(sig, func))(int, int) +int sig; +RETSIGTYPE (*func)(); +{ + return(signal(sig, func)); +} +sys_sigblock(int sig) +{ + sigblock(sig); +} +sys_sigrelease(int sig) +{ + sigsetmask(sigblock(0) & ~sigmask(sig)); +} +#else /* !SIG_SIGNAL */ /* The True Way - POSIX!:-) */ +RETSIGTYPE (*sys_sigset(int sig, RETSIGTYPE (*func)(int)))(int) { struct sigaction act, oact; @@ -713,47 +697,36 @@ sigaddset(&mask, sig); sigprocmask(SIG_UNBLOCK, &mask, (sigset_t *)NULL); } +#endif /* !SIG_SIGNAL */ +#endif /* !SIG_SIGSET */ -void erts_sys_sigsegv_handler(int signo) { - if (signo == SIGSEGV) { - longjmp(erts_sys_sigsegv_jmp, 1); - } -} - -/* - * Function returns 1 if we can read from all values in between - * start and stop. - */ -int -erts_sys_is_area_readable(char *start, char *stop) { - int fds[2]; - if (!pipe(fds)) { - /* We let write try to figure out if the pointers are readable */ - int res = write(fds[1], start, (char*)stop - (char*)start); - if (res == -1) { - close(fds[0]); - close(fds[1]); - return 0; - } - close(fds[0]); - close(fds[1]); - return 1; - } - return 0; - +#if (0) /* not used? -- gordon */ +static void (*break_func)(); +static RETSIGTYPE break_handler(int sig) +{ +#ifdef QNX + /* Turn off SIGCHLD during break processing */ + sys_sigblock(SIGCHLD); +#endif + (*break_func)(); +#ifdef QNX + sys_sigrelease(SIGCHLD); +#endif } +#endif /* 0 */ static ERTS_INLINE int prepare_crash_dump(int secs) { #define NUFBUF (3) - int i; + int i, max; char env[21]; /* enough to hold any 64-bit integer */ size_t envsz; DeclareTmpHeapNoproc(heap,NUFBUF); Port *heart_port; Eterm *hp = heap; Eterm list = NIL; + int heart_fd[2] = {-1,-1}; int has_heart = 0; UseTmpHeapNoproc(NUFBUF); @@ -776,22 +749,43 @@ alarm((unsigned int)secs); } - /* close all viable sockets via emergency close callbacks. - * Specifically we want to close epmd sockets. - */ - - erts_emergency_close_ports(); - if (heart_port) { - has_heart = 1; + /* hearts input fd + * We "know" drv_data is the in_fd since the port is started with read|write + */ + heart_fd[0] = (int)heart_port->drv_data; + heart_fd[1] = (int)driver_data[heart_fd[0]].ofd; + has_heart = 1; + list = CONS(hp, make_small(8), list); hp += 2; + /* send to heart port, CMD = 8, i.e. prepare crash dump =o */ erts_port_output(NULL, ERTS_PORT_SIG_FLG_FORCE_IMM_CALL, heart_port, heart_port->common.id, list, NULL); } - /* Make sure we have a fd for our crashdump file. */ - close(crashdump_companion_cube_fd); + /* Make sure we unregister at epmd (unknown fd) and get at least + one free filedescriptor (for erl_crash.dump) */ + + max = max_files; + if (max < 1024) + max = 1024; + for (i = 3; i < max; i++) { +#if defined(ERTS_SMP) + /* We don't want to close the signal notification pipe... */ + if (i == sig_notify_fds[0] || i == sig_notify_fds[1]) + continue; +#elif defined(USE_THREADS) + /* We don't want to close the async notification pipe... */ + if (i == async_fd[0] || i == async_fd[1]) + continue; +#endif + /* We don't want to close our heart yet ... */ + if (i == heart_fd[0] || i == heart_fd[1]) + continue; + + close(i); + } envsz = sizeof(env); i = erts_sys_getenv__("ERL_CRASH_DUMP_NICE", env, &envsz); @@ -869,24 +863,10 @@ #ifdef ETHR_UNUSABLE_SIGUSRX #warning "Unusable SIGUSR1 & SIGUSR2. Disabling use of these signals" - -#else - -#ifdef ERTS_SMP -void -sys_thr_suspend(erts_tid_t tid) { - erts_thr_kill(tid, ERTS_SYS_SUSPEND_SIGNAL); -} - -void -sys_thr_resume(erts_tid_t tid) { - int i = 0, res; - do { - res = write(sig_suspend_fds[1],&i,sizeof(i)); - } while (res < 0 && errno == EAGAIN); -} #endif +#ifndef ETHR_UNUSABLE_SIGUSRX + #if (defined(SIG_SIGSET) || defined(SIG_SIGNAL)) static RETSIGTYPE user_signal1(void) #else @@ -900,20 +880,20 @@ #endif } -#ifdef ERTS_SMP +#ifdef QUANTIFY #if (defined(SIG_SIGSET) || defined(SIG_SIGNAL)) -static RETSIGTYPE suspend_signal(void) +static RETSIGTYPE user_signal2(void) #else -static RETSIGTYPE suspend_signal(int signum) +static RETSIGTYPE user_signal2(int signum) #endif { - int res; - int buf[1]; - do { - res = read(sig_suspend_fds[0], buf, sizeof(int)); - } while (res < 0 && errno == EINTR); +#ifdef ERTS_SMP + smp_sig_notify('2'); +#else + quantify_save_data(); +#endif } -#endif /* #ifdef ERTS_SMP */ +#endif #endif /* #ifndef ETHR_UNUSABLE_SIGUSRX */ @@ -938,9 +918,9 @@ /* Disable break */ void erts_set_ignore_break(void) { - sys_signal(SIGINT, SIG_IGN); - sys_signal(SIGQUIT, SIG_IGN); - sys_signal(SIGTSTP, SIG_IGN); + sys_sigset(SIGINT, SIG_IGN); + sys_sigset(SIGQUIT, SIG_IGN); + sys_sigset(SIGTSTP, SIG_IGN); } /* Don't use ctrl-c for break handler but let it be @@ -963,14 +943,14 @@ void init_break_handler(void) { - sys_signal(SIGINT, request_break); + sys_sigset(SIGINT, request_break); #ifndef ETHR_UNUSABLE_SIGUSRX - sys_signal(SIGUSR1, user_signal1); -#ifdef ERTS_SMP - sys_signal(ERTS_SYS_SUSPEND_SIGNAL, suspend_signal); -#endif /* #ifdef ERTS_SMP */ + sys_sigset(SIGUSR1, user_signal1); +#ifdef QUANTIFY + sys_sigset(SIGUSR2, user_signal2); +#endif #endif /* #ifndef ETHR_UNUSABLE_SIGUSRX */ - sys_signal(SIGQUIT, do_quit); + sys_sigset(SIGQUIT, do_quit); } int sys_max_files(void) @@ -987,13 +967,8 @@ sys_sigblock(SIGINT); #ifndef ETHR_UNUSABLE_SIGUSRX sys_sigblock(SIGUSR1); -#endif /* #ifndef ETHR_UNUSABLE_SIGUSRX */ -#endif /* #ifndef ERTS_SMP */ - -#if defined(ERTS_SMP) && !defined(ETHR_UNUSABLE_SIGUSRX) - sys_sigblock(ERTS_SYS_SUSPEND_SIGNAL); #endif - +#endif } static void unblock_signals(void) @@ -1007,13 +982,26 @@ #ifndef ETHR_UNUSABLE_SIGUSRX sys_sigrelease(SIGUSR1); #endif /* #ifndef ETHR_UNUSABLE_SIGUSRX */ -#endif /* #ifndef ERTS_SMP */ - -#if defined(ERTS_SMP) && !defined(ETHR_UNUSABLE_SIGUSRX) - sys_sigrelease(ERTS_SYS_SUSPEND_SIGNAL); #endif - } +/************************** Time stuff **************************/ +#ifdef HAVE_GETHRTIME +#ifdef GETHRTIME_WITH_CLOCK_GETTIME + +SysHrTime sys_gethrtime(void) +{ + struct timespec ts; + long long result; + if (clock_gettime(CLOCK_MONOTONIC,&ts) != 0) { + erl_exit(1,"Fatal, could not get clock_monotonic value!, " + "errno = %d\n", errno); + } + result = ((long long) ts.tv_sec) * 1000000000LL + + ((long long) ts.tv_nsec); + return (SysHrTime) result; +} +#endif +#endif /************************** OS info *******************************/ @@ -1120,16 +1108,11 @@ /* Driver interfaces */ static ErlDrvData spawn_start(ErlDrvPort, char*, SysDriverOpts*); static ErlDrvData fd_start(ErlDrvPort, char*, SysDriverOpts*); -#if FDBLOCK -static void fd_async(void *); -static void fd_ready_async(ErlDrvData drv_data, ErlDrvThreadData thread_data); -#endif static ErlDrvSSizeT fd_control(ErlDrvData, unsigned int, char *, ErlDrvSizeT, char **, ErlDrvSizeT); static ErlDrvData vanilla_start(ErlDrvPort, char*, SysDriverOpts*); static int spawn_init(void); static void fd_stop(ErlDrvData); -static void fd_flush(ErlDrvData); static void stop(ErlDrvData); static void ready_input(ErlDrvData, ErlDrvEvent); static void ready_output(ErlDrvData, ErlDrvEvent); @@ -1174,12 +1157,8 @@ fd_control, NULL, outputv, -#if FDBLOCK - fd_ready_async, /* ready_async */ -#else - NULL, -#endif - fd_flush, /* flush */ + NULL, /* ready_async */ + NULL, /* flush */ NULL, /* call */ NULL, /* event */ ERL_DRV_EXTENDED_MARKER, @@ -1233,28 +1212,13 @@ #endif } -static int set_blocking_data(struct driver_data *dd) { - - dd->blocking = erts_alloc(ERTS_ALC_T_SYS_BLOCKING, sizeof(ErtsSysBlocking)); - - erts_smp_atomic_add_nob(&sys_misc_mem_sz, sizeof(ErtsSysBlocking)); - - dd->blocking->pdl = driver_pdl_create(dd->port_num); - dd->blocking->res = 0; - dd->blocking->err = 0; - dd->blocking->pkey = driver_async_port_key(dd->port_num); - - return 1; -} - static int set_driver_data(ErlDrvPort port_num, int ifd, int ofd, int packet_bytes, int read_write, int exit_status, - int pid, - int is_blocking) + int pid) { Port *prt; ErtsSysReportExit *report_exit; @@ -1286,13 +1250,8 @@ driver_data[ifd].pid = pid; driver_data[ifd].alive = 1; driver_data[ifd].status = 0; - driver_data[ifd].terminating = 0; - driver_data[ifd].blocking = NULL; if (read_write & DO_WRITE) { driver_data[ifd].ofd = ofd; - if (is_blocking && FDBLOCK) - if (!set_blocking_data(driver_data+ifd)) - return -1; if (ifd != ofd) driver_data[ofd] = driver_data[ifd]; /* structure copy */ } else { /* DO_READ only */ @@ -1308,11 +1267,6 @@ driver_data[ofd].pid = pid; driver_data[ofd].alive = 1; driver_data[ofd].status = 0; - driver_data[ofd].terminating = 0; - driver_data[ofd].blocking = NULL; - if (is_blocking && FDBLOCK) - if (!set_blocking_data(driver_data+ofd)) - return -1; return(ofd); } } @@ -1322,13 +1276,11 @@ int i; #if CHLDWTHR erts_thr_opts_t thr_opts = ERTS_THR_OPTS_DEFAULT_INITER; - thr_opts.detached = 0; thr_opts.suggested_stack_size = 0; /* Smallest possible */ - thr_opts.name = "child_waiter"; #endif - sys_signal(SIGPIPE, SIG_IGN); /* Ignore - we'll handle the write failure */ + sys_sigset(SIGPIPE, SIG_IGN); /* Ignore - we'll handle the write failure */ driver_data = (struct driver_data *) erts_alloc(ERTS_ALC_T_DRV_TAB, max_files * sizeof(struct driver_data)); erts_smp_atomic_add_nob(&sys_misc_mem_sz, @@ -1341,7 +1293,7 @@ sys_sigblock(SIGCHLD); #endif - sys_signal(SIGCHLD, onchld); /* Reap children */ + sys_sigset(SIGCHLD, onchld); /* Reap children */ #if CHLDWTHR erts_thr_create(&child_waiter_tid, child_waiter, NULL, &thr_opts); @@ -1622,13 +1574,9 @@ goto child_error; } -#if defined(HAVE_CLOSEFROM) - closefrom(opts->use_stdio ? 3 : 5); -#else for (i = opts->use_stdio ? 3 : 5; i < max_files; i++) (void) close(i); -#endif - + if (opts->wd && chdir(opts->wd) < 0) goto child_error; @@ -1807,7 +1755,7 @@ } res = set_driver_data(port_num, ifd[0], ofd[1], opts->packet_bytes, - opts->read_write, opts->exit_status, pid, 0); + opts->read_write, opts->exit_status, pid); /* Don't unblock SIGCHLD until now, since the call above must first complete putting away the info about our new subprocess. */ unblock_signals(); @@ -1892,7 +1840,6 @@ SysDriverOpts* opts) { ErlDrvData res; - int non_blocking = 0; if (((opts->read_write & DO_READ) && opts->ifd >= max_files) || ((opts->read_write & DO_WRITE) && opts->ofd >= max_files)) @@ -1965,20 +1912,6 @@ * case - it can be called with any old pre-existing file descriptors, * the relations between which (if they're even two) we can only guess * at - still, we try our best... - * - * Added note OTP 18: Some systems seem to use stdout/stderr to log data - * using unix pipes, so we cannot allow the system to block on a write. - * Therefore we use an async thread to write the data to fd's that could - * not be set to non-blocking. When no async threads are available we - * fall back on the old behaviour. - * - * Also the guarantee about what is delivered to the OS has changed. - * Pre 18 the fd driver did no flushing of data before terminating. - * Now it does. This is because we want to be able to guarantee that things - * such as escripts and friends really have outputted all data before - * terminating. This could potentially block the termination of the system - * for a very long time, but if the user wants to terminate fast she should - * use erlang:halt with flush=false. */ if (opts->read_write & DO_READ) { @@ -2001,7 +1934,6 @@ imagine a scenario where setting non-blocking mode here would cause problems - go ahead and do it. */ - non_blocking = 1; SET_NONBLOCKING(opts->ofd); } else { /* output fd is a tty, input fd isn't */ @@ -2044,7 +1976,6 @@ (nfd = open(tty, O_WRONLY)) != -1) { dup2(nfd, opts->ofd); close(nfd); - non_blocking = 1; SET_NONBLOCKING(opts->ofd); } } @@ -2053,9 +1984,8 @@ } CHLD_STAT_LOCK; res = (ErlDrvData)(long)set_driver_data(port_num, opts->ifd, opts->ofd, - opts->packet_bytes, - opts->read_write, 0, -1, - !non_blocking); + opts->packet_bytes, + opts->read_write, 0, -1); CHLD_STAT_UNLOCK; return res; } @@ -2081,30 +2011,14 @@ SET_BLOCKING(fd); } -static void fd_stop(ErlDrvData ev) /* Does not close the fds */ +static void fd_stop(ErlDrvData fd) /* Does not close the fds */ { int ofd; - int fd = (int)(long)ev; - ErlDrvPort prt = driver_data[fd].port_num; -#if FDBLOCK - if (driver_data[fd].blocking) { - erts_free(ERTS_ALC_T_SYS_BLOCKING,driver_data[fd].blocking); - driver_data[fd].blocking = NULL; - erts_smp_atomic_add_nob(&sys_misc_mem_sz, -1*sizeof(ErtsSysBlocking)); - } -#endif - - nbio_stop_fd(prt, fd); - ofd = driver_data[fd].ofd; - if (ofd != fd && ofd != -1) - nbio_stop_fd(prt, ofd); -} - -static void fd_flush(ErlDrvData fd) -{ - if (!driver_data[(int)(long)fd].terminating) - driver_data[(int)(long)fd].terminating = 1; + nbio_stop_fd(driver_data[(int)(long)fd].port_num, (int)(long)fd); + ofd = driver_data[(int)(long)fd].ofd; + if (ofd != (int)(long)fd && ofd != -1) + nbio_stop_fd(driver_data[(int)(long)fd].port_num, (int)(long)ofd); } static ErlDrvData vanilla_start(ErlDrvPort port_num, char* name, @@ -2127,8 +2041,8 @@ CHLD_STAT_LOCK; res = (ErlDrvData)(long)set_driver_data(port_num, fd, fd, - opts->packet_bytes, - opts->read_write, 0, -1, 0); + opts->packet_bytes, + opts->read_write, 0, -1); CHLD_STAT_UNLOCK; return res; } @@ -2165,7 +2079,6 @@ } } -/* used by fd_driver */ static void outputv(ErlDrvData e, ErlIOVec* ev) { int fd = (int)(long)e; @@ -2191,21 +2104,12 @@ ev->iov[0].iov_base = lbp; ev->iov[0].iov_len = pb; ev->size += pb; - - if (driver_data[fd].blocking && FDBLOCK) - driver_pdl_lock(driver_data[fd].blocking->pdl); - if ((sz = driver_sizeq(ix)) > 0) { driver_enqv(ix, ev, 0); - - if (driver_data[fd].blocking && FDBLOCK) - driver_pdl_unlock(driver_data[fd].blocking->pdl); - if (sz + ev->size >= (1 << 13)) set_busy_port(ix, 1); } - else if (!driver_data[fd].blocking || !FDBLOCK) { - /* We try to write directly if the fd in non-blocking */ + else { int vsize = ev->vsize > MAX_VSIZE ? MAX_VSIZE : ev->vsize; n = writev(ofd, (const void *) (ev->iov), vsize); @@ -2221,22 +2125,10 @@ driver_enqv(ix, ev, n); /* n is the skip value */ driver_select(ix, ofd, ERL_DRV_WRITE|ERL_DRV_USE, 1); } -#if FDBLOCK - else { - if (ev->size != 0) { - driver_enqv(ix, ev, 0); - driver_pdl_unlock(driver_data[fd].blocking->pdl); - driver_async(ix, &driver_data[fd].blocking->pkey, - fd_async, driver_data+fd, NULL); - } else { - driver_pdl_unlock(driver_data[fd].blocking->pdl); - } - } -#endif /* return 0;*/ } -/* Used by spawn_driver and vanilla driver */ + static void output(ErlDrvData e, char* buf, ErlDrvSizeT len) { int fd = (int)(long)e; @@ -2299,23 +2191,6 @@ ASSERT(res <= 0); (void) driver_select(port_num, ready_fd, ERL_DRV_READ|ERL_DRV_WRITE, 0); clear_fd_data(ready_fd); - - if (driver_data[ready_fd].blocking && FDBLOCK) { - driver_pdl_lock(driver_data[ready_fd].blocking->pdl); - if (driver_sizeq(driver_data[ready_fd].port_num) > 0) { - driver_pdl_unlock(driver_data[ready_fd].blocking->pdl); - /* We have stuff in the output queue, so we just - set the state to terminating and wait for fd_async_ready - to terminate the port */ - if (res == 0) - driver_data[ready_fd].terminating = 2; - else - driver_data[ready_fd].terminating = -err; - return 0; - } - driver_pdl_unlock(driver_data[ready_fd].blocking->pdl); - } - if (res == 0) { if (driver_data[ready_fd].report_exit) { CHLD_STAT_LOCK; @@ -2366,7 +2241,6 @@ port_num = driver_data[fd].port_num; packet_bytes = driver_data[fd].packet_bytes; - if (packet_bytes == 0) { byte *read_buf = (byte *) erts_alloc(ERTS_ALC_T_SYS_READ_BUF, ERTS_SYS_READ_BUF_SZ); @@ -2490,8 +2364,6 @@ if ((iv = (struct iovec*) driver_peekq(ix, &vsize)) == NULL) { driver_select(ix, ready_fd, ERL_DRV_WRITE, 0); - if (driver_data[fd].terminating) - driver_failure_atom(driver_data[fd].port_num,"normal"); return; /* 0; */ } vsize = vsize > MAX_VSIZE ? MAX_VSIZE : vsize; @@ -2517,86 +2389,6 @@ close((int)fd); } -#if FDBLOCK - -static void -fd_async(void *async_data) -{ - int res; - struct driver_data *dd = (struct driver_data*)async_data; - SysIOVec *iov0; - SysIOVec *iov; - int iovlen; - int err = 0; - /* much of this code is stolen from efile_drv:invoke_writev */ - driver_pdl_lock(dd->blocking->pdl); - iov0 = driver_peekq(dd->port_num, &iovlen); - iovlen = iovlen < MAXIOV ? iovlen : MAXIOV; - iov = erts_alloc_fnf(ERTS_ALC_T_SYS_WRITE_BUF, - sizeof(SysIOVec)*iovlen); - if (!iov) { - res = -1; - err = ENOMEM; - driver_pdl_unlock(dd->blocking->pdl); - } else { - memcpy(iov,iov0,iovlen*sizeof(SysIOVec)); - driver_pdl_unlock(dd->blocking->pdl); - - do { - res = writev(dd->ofd, iov, iovlen); - } while (res < 0 && errno == EINTR); - if (res < 0) - err = errno; - - erts_free(ERTS_ALC_T_SYS_WRITE_BUF, iov); - } - dd->blocking->res = res; - dd->blocking->err = err; -} - -void fd_ready_async(ErlDrvData drv_data, - ErlDrvThreadData thread_data) { - struct driver_data *dd = (struct driver_data *)thread_data; - ErlDrvPort port_num = dd->port_num; - - ASSERT(dd->blocking); - ASSERT(dd == (driver_data + (int)(long)drv_data)); - - if (dd->blocking->res > 0) { - driver_pdl_lock(dd->blocking->pdl); - if (driver_deq(port_num, dd->blocking->res) == 0) { - driver_pdl_unlock(dd->blocking->pdl); - set_busy_port(port_num, 0); - if (dd->terminating) { - /* The port is has been ordered to terminate - from either fd_flush or port_inp_failure */ - if (dd->terminating == 1) - driver_failure_atom(port_num, "normal"); - else if (dd->terminating == 2) - driver_failure_eof(port_num); - else if (dd->terminating < 0) - driver_failure_posix(port_num, -dd->terminating); - return; /* -1; */ - } - } else { - driver_pdl_unlock(dd->blocking->pdl); - /* still data left to write in queue */ - driver_async(port_num, &dd->blocking->pkey, fd_async, dd, NULL); - return /* 0; */; - } - } else if (dd->blocking->res < 0) { - if (dd->blocking->err == ERRNO_BLOCK) { - set_busy_port(port_num, 1); - /* still data left to write in queue */ - driver_async(port_num, &dd->blocking->pkey, fd_async, dd, NULL); - } else - driver_failure_posix(port_num, dd->blocking->err); - return; /* -1; */ - } - return; /* 0; */ -} - -#endif void erts_do_break_handling(void) { @@ -2866,30 +2658,18 @@ /* Nothing */ } -/* Read a key from console, used by break.c - Here we assume that all schedulers are stopped so that erl_poll - does not interfere with the select below. -*/ +/* Read a key from console (?) */ + int sys_get_key(fd) int fd; { - int c, ret; + int c; unsigned char rbuf[64]; - fd_set fds; fflush(stdout); /* Flush query ??? */ - FD_ZERO(&fds); - FD_SET(fd,&fds); - - ret = select(fd+1, &fds, NULL, NULL, NULL); - - if (ret == 1) { - do { - c = read(fd,rbuf,64); - } while (c < 0 && errno == EAGAIN); - if (c <= 0) - return c; + if ((c = read(fd,rbuf,64)) <= 0) { + return c; } return rbuf[0]; @@ -3213,6 +2993,13 @@ case '1': /* SIGUSR1 */ sigusr1_exit(); break; +#ifdef QUANTIFY + case '2': /* SIGUSR2 */ + quantify_save_data(); /* Might take a substantial amount of + time, but this is a test/debug + build */ + break; +#endif default: erl_exit(ERTS_ABORT_EXIT, "signal-dispatcher thread received unknown " @@ -3230,7 +3017,6 @@ { erts_smp_thr_opts_t thr_opts = ERTS_SMP_THR_OPTS_DEFAULT_INITER; thr_opts.detached = 1; - thr_opts.name = "sys_sig_dispatcher"; if (pipe(sig_notify_fds) < 0) { erl_exit(ERTS_ABORT_EXIT, @@ -3245,17 +3031,6 @@ NULL, &thr_opts); } - -static void -init_smp_sig_suspend(void) { - if (pipe(sig_suspend_fds) < 0) { - erl_exit(ERTS_ABORT_EXIT, - "Failed to create sig_suspend pipe: %s (%d)\n", - erl_errno_id(errno), - errno); - } -} - #ifdef __DARWIN__ int erts_darwin_main_thread_pipe[2]; @@ -3283,11 +3058,9 @@ #endif smp_sig_notify(0); /* Notify initialized */ - - /* Wait for a signal to arrive... */ - -#ifdef __DARWIN__ while (1) { + /* Wait for a signal to arrive... */ +#ifdef __DARWIN__ /* * The wx driver needs to be able to steal the main thread for Cocoa to * work properly. @@ -3302,24 +3075,12 @@ void* (*func)(void*); void* arg; void *resp; - res = read(erts_darwin_main_thread_pipe[0],&func,sizeof(void* (*)(void*))); - if (res != sizeof(void* (*)(void*))) - break; - res = read(erts_darwin_main_thread_pipe[0],&arg,sizeof(void*)); - if (res != sizeof(void*)) - break; + read(erts_darwin_main_thread_pipe[0],&func,sizeof(void* (*)(void*))); + read(erts_darwin_main_thread_pipe[0],&arg, sizeof(void*)); resp = (*func)(arg); write(erts_darwin_main_thread_result_pipe[1],&resp,sizeof(void *)); } - - if (res == -1 && errno != EINTR) - break; - } - /* Something broke with the main thread pipe, so we ignore it for now. - Most probably erts has closed this pipe and is about to exit. */ -#endif /* #ifdef __DARWIN__ */ - - while (1) { +#else #ifdef DEBUG int res = #else @@ -3328,6 +3089,7 @@ select(0, NULL, NULL, NULL, NULL); ASSERT(res < 0); ASSERT(errno == EINTR); +#endif } } @@ -3419,7 +3181,6 @@ #ifdef ERTS_SMP init_smp_sig_notify(); - init_smp_sig_suspend(); #endif /* Handled arguments have been marked with NULL. Slide arguments diff -Nru erlang-18.2-dfsg/erts/emulator/sys/unix/sys_float.c erlang-17.3-dfsg/erts/emulator/sys/unix/sys_float.c --- erlang-18.2-dfsg/erts/emulator/sys/unix/sys_float.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/unix/sys_float.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -33,7 +32,7 @@ erts_sys_init_float(void) { # ifdef SIGFPE - sys_signal(SIGFPE, SIG_IGN); /* Ignore so we can test for NaN and Inf */ + sys_sigset(SIGFPE, SIG_IGN); /* Ignore so we can test for NaN and Inf */ # endif } @@ -86,7 +85,7 @@ void erts_fp_check_init_error(volatile unsigned long *fpexnp) { - char buf[128]; + char buf[64]; snprintf(buf, sizeof buf, "ERTS_FP_CHECK_INIT at %p: detected unhandled FPE at %p\r\n", __builtin_return_address(0), (void*)*fpexnp); if (write(2, buf, strlen(buf)) <= 0) @@ -668,7 +667,7 @@ static void erts_thread_catch_fp_exceptions(void) { - sys_signal(SIGFPE, fpe_sig_handler); + sys_sigset(SIGFPE, fpe_sig_handler); unmask_fpe(); } diff -Nru erlang-18.2-dfsg/erts/emulator/sys/unix/sys_time.c erlang-17.3-dfsg/erts/emulator/sys/unix/sys_time.c --- erlang-18.2-dfsg/erts/emulator/sys/unix/sys_time.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/unix/sys_time.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -32,21 +31,8 @@ # undef _FILE_OFFSET_BITS #endif -#include #include "sys.h" #include "global.h" -#include "erl_os_monotonic_time_extender.h" - -#undef ERTS_HAVE_ERTS_OS_TIMES_IMPL__ -#undef ERTS_HAVE_ERTS_SYS_HRTIME_IMPL__ - -#if defined(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME) \ - || defined(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME) \ - || defined(SYS_HRTIME_USING_MACH_CLOCK_GET_TIME) -# include -# include -# define ERTS_MACH_CLOCKS -#endif #ifdef NO_SYSCONF # define TICKS_PER_SEC() HZ @@ -67,23 +53,9 @@ /******************* Routines for time measurement *********************/ -#undef ERTS_SYS_TIME_INTERNAL_STATE_WRITE_FREQ__ -#undef ERTS_SYS_TIME_INTERNAL_STATE_READ_ONLY__ -#undef ERTS_SYS_TIME_INTERNAL_STATE_READ_MOSTLY__ - -#if defined(OS_MONOTONIC_TIME_USING_TIMES) - -static Uint32 -get_tick_count(void) -{ - struct tms unused; - return (Uint32) times(&unused); -} - -#define ERTS_SYS_TIME_INTERNAL_STATE_READ_ONLY__ -#define ERTS_SYS_TIME_INTERNAL_STATE_READ_MOSTLY__ - -#endif +int erts_ticks_per_sec = 0; /* Will be SYS_CLK_TCK in erl_unix_sys.h */ +int erts_ticks_per_sec_wrap = 0; /* Will be SYS_CLK_TCK_WRAP */ +static int ticks_bsr = 0; /* Shift wrapped tick value this much to the right */ /* * init timers, chose a tick length, and return it. @@ -91,824 +63,37 @@ * does almost everything. Other platforms have to * emulate Unix in this sense. */ - -ErtsSysTimeData__ erts_sys_time_data__ erts_align_attribute(ERTS_CACHE_LINE_SIZE); - -#if defined(__linux__) && defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) - -#define ERTS_SYS_TIME_INTERNAL_STATE_WRITE_FREQ__ - -static ErtsMonotonicTime clock_gettime_monotonic(void); -static ErtsMonotonicTime clock_gettime_monotonic_verified(void); -#if defined(HAVE_CLOCK_GETTIME_MONOTONIC_RAW) -static ErtsMonotonicTime clock_gettime_monotonic_raw(void); -#endif -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) -static void clock_gettime_times(ErtsMonotonicTime *, ErtsSystemTime *); -static void clock_gettime_times_verified(ErtsMonotonicTime *, ErtsSystemTime *); -#if defined(HAVE_CLOCK_GETTIME_MONOTONIC_RAW) -static void clock_gettime_times_raw(ErtsMonotonicTime *, ErtsSystemTime *); -#endif -#endif - -#endif /* defined(__linux__) && defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) */ - -#ifdef ERTS_MACH_CLOCKS -# define ERTS_SYS_TIME_INTERNAL_STATE_READ_ONLY__ -typedef struct { - clock_id_t id; - clock_serv_t srv; - char *name; -} ErtsMachClock; - -typedef struct { - host_name_port_t host; - struct { - ErtsMachClock monotonic; - ErtsMachClock wall; - } clock; -} ErtsMachClocks; -static void mach_clocks_init(void); -static void mach_clocks_fini(void); -# ifdef HAVE_CLOCK_GET_ATTRIBUTES -# define ERTS_HAVE_MACH_CLOCK_GETRES -static Sint64 -mach_clock_getres(ErtsMachClock *clk); -# endif -#endif /* ERTS_MACH_CLOCKS */ - -#ifdef ERTS_SYS_TIME_INTERNAL_STATE_READ_ONLY__ -struct sys_time_internal_state_read_only__ { -#if defined(OS_MONOTONIC_TIME_USING_TIMES) - int times_shift; -#endif -#ifdef ERTS_MACH_CLOCKS - ErtsMachClocks mach; -#endif -}; -#endif - -#ifdef ERTS_SYS_TIME_INTERNAL_STATE_READ_MOSTLY__ -struct sys_time_internal_state_read_mostly__ { -#if defined(OS_MONOTONIC_TIME_USING_TIMES) - ErtsOsMonotonicTimeExtendState os_mtime_xtnd; -#endif -}; -#endif - -#ifdef ERTS_SYS_TIME_INTERNAL_STATE_WRITE_FREQ__ -struct sys_time_internal_state_write_freq__ { - erts_smp_mtx_t mtx; -#if defined(__linux__) && defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) - ErtsMonotonicTime last_delivered; -#endif -}; -#endif - -#if defined(ERTS_SYS_TIME_INTERNAL_STATE_READ_ONLY__) \ - || defined(ERTS_SYS_TIME_INTERNAL_STATE_WRITE_FREQ__) -static struct { -#ifdef ERTS_SYS_TIME_INTERNAL_STATE_READ_ONLY__ - union { - struct sys_time_internal_state_read_only__ o; - char align__[(((sizeof(struct sys_time_internal_state_read_only__) - 1) - / ASSUMED_CACHE_LINE_SIZE) + 1) - * ASSUMED_CACHE_LINE_SIZE]; - } r; -#endif -#ifdef ERTS_SYS_TIME_INTERNAL_STATE_READ_MOSTLY__ - union { - struct sys_time_internal_state_read_mostly__ m; - char align__[(((sizeof(struct sys_time_internal_state_read_mostly__) - 1) - / ASSUMED_CACHE_LINE_SIZE) + 1) - * ASSUMED_CACHE_LINE_SIZE]; - } wr; -#endif -#ifdef ERTS_SYS_TIME_INTERNAL_STATE_WRITE_FREQ__ - union { - struct sys_time_internal_state_write_freq__ f; - char align__[(((sizeof(struct sys_time_internal_state_write_freq__) - 1) - / ASSUMED_CACHE_LINE_SIZE) + 1) - * ASSUMED_CACHE_LINE_SIZE]; - } w; -#endif -} internal_state erts_align_attribute(ERTS_CACHE_LINE_SIZE); -#endif - -void -sys_init_time(ErtsSysInitTimeResult *init_resp) +int sys_init_time(void) { -#if defined(ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT) - int major, minor, build, vsn; -#endif -#if defined(ERTS_MACH_CLOCKS) - mach_clocks_init(); -#endif -#if !defined(ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT) - - init_resp->have_os_monotonic_time = 0; - -#else /* defined(ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT) */ - -#ifdef ERTS_HAVE_CORRECTED_OS_MONOTONIC_TIME - init_resp->have_corrected_os_monotonic_time = 1; -#else - init_resp->have_corrected_os_monotonic_time = 0; -#endif - - init_resp->os_monotonic_time_info.resolution = (Uint64) 1000*1000*1000; -#if defined(HAVE_CLOCK_GETRES) && defined(MONOTONIC_CLOCK_ID) - { - struct timespec ts; - if (clock_getres(MONOTONIC_CLOCK_ID, &ts) == 0) { - if (ts.tv_sec == 0 && ts.tv_nsec != 0) - init_resp->os_monotonic_time_info.resolution /= ts.tv_nsec; - else if (ts.tv_sec >= 1) - init_resp->os_monotonic_time_info.resolution = 1; - } - } -#elif defined(ERTS_HAVE_MACH_CLOCK_GETRES) && defined(MONOTONIC_CLOCK_ID) - init_resp->os_monotonic_time_info.resolution - = mach_clock_getres(&internal_state.r.o.mach.clock.monotonic); -#endif - -#ifdef MONOTONIC_CLOCK_ID_STR - init_resp->os_monotonic_time_info.clock_id = MONOTONIC_CLOCK_ID_STR; -#else - init_resp->os_monotonic_time_info.clock_id = NULL; -#endif - - init_resp->os_monotonic_time_info.locked_use = 0; - -#if defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) - init_resp->os_monotonic_time_info.func = "clock_gettime"; -#elif defined(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME) - init_resp->os_monotonic_time_info.func = "clock_get_time"; -#elif defined(OS_MONOTONIC_TIME_USING_GETHRTIME) - init_resp->os_monotonic_time_info.func = "gethrtime"; -#elif defined(OS_MONOTONIC_TIME_USING_TIMES) - init_resp->os_monotonic_time_info.func = "times"; -#else -# error Unknown erts_os_monotonic_time() implementation -#endif - - init_resp->have_os_monotonic_time = 1; - - os_version(&major, &minor, &build); - - vsn = ERTS_MK_VSN_INT(major, minor, build); - - -#if defined(__linux__) && defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) - if (vsn >= ERTS_MK_VSN_INT(2, 6, 33)) { - erts_sys_time_data__.r.o.os_monotonic_time = - clock_gettime_monotonic; -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) - erts_sys_time_data__.r.o.os_times = - clock_gettime_times; -#endif - } - else { - /* - * Linux versions prior to 2.6.33 have a - * known bug that sometimes cause the NTP - * adjusted monotonic clock to take small - * steps backwards. Use raw monotonic clock - * if it is present; otherwise, fall back - * on locked verification of values. - */ - init_resp->have_corrected_os_monotonic_time = 0; -#if defined(HAVE_CLOCK_GETTIME_MONOTONIC_RAW) - /* We know that CLOCK_MONOTONIC_RAW is defined, - but we don't know if we got a kernel that - supports it. Support for CLOCK_MONOTONIC_RAW - appeared in kernel 2.6.28... */ - if (vsn >= ERTS_MK_VSN_INT(2, 6, 28)) { - erts_sys_time_data__.r.o.os_monotonic_time = - clock_gettime_monotonic_raw; -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) - erts_sys_time_data__.r.o.os_times = - clock_gettime_times_raw; -#endif - init_resp->os_monotonic_time_info.clock_id = - "CLOCK_MONOTONIC_RAW"; - } - else -#endif /* defined(HAVE_CLOCK_GETTIME_MONOTONIC_RAW) */ - { - erts_sys_time_data__.r.o.os_monotonic_time = - clock_gettime_monotonic_verified; -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) - erts_sys_time_data__.r.o.os_times = - clock_gettime_times_verified; -#endif - erts_smp_mtx_init(&internal_state.w.f.mtx, - "os_monotonic_time"); - internal_state.w.f.last_delivered - = clock_gettime_monotonic(); - init_resp->os_monotonic_time_info.locked_use = 1; - } - } -#else /* !(defined(__linux__) && defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME)) */ - { - char flavor[1024]; - - os_flavor(flavor, sizeof(flavor)); - - if (sys_strcmp(flavor, "sunos") == 0) { - /* - * Don't trust hrtime on multi processors - * on SunOS prior to SunOS 5.8 - */ - if (vsn < ERTS_MK_VSN_INT(5, 8, 0)) { -#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF) - if (sysconf(_SC_NPROCESSORS_CONF) > 1) -#endif - init_resp->have_os_monotonic_time = 0; - } - } - } -#endif /* !(defined(__linux__) && defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME)) */ - -#endif /* defined(ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT) */ - -#ifdef ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT - init_resp->os_monotonic_time_unit = ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT; -#endif - init_resp->sys_clock_resolution = SYS_CLOCK_RESOLUTION; - /* - * This (erts_sys_time_data__.r.o.ticks_per_sec) is only for - * times() (CLK_TCK), the resolution is always one millisecond.. + * This (erts_ticks_per_sec) is only for times() (CLK_TCK), + * the resolution is always one millisecond.. */ - if ((erts_sys_time_data__.r.o.ticks_per_sec = TICKS_PER_SEC()) < 0) - erl_exit(ERTS_ABORT_EXIT, "Can't get clock ticks/sec\n"); - -#if defined(OS_MONOTONIC_TIME_USING_TIMES) -#if ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT -# error Time unit is supposed to be determined at runtime... -#endif - { - ErtsMonotonicTime resolution = erts_sys_time_data__.r.o.ticks_per_sec; - ErtsMonotonicTime time_unit = resolution; - int shift = 0; - - while (time_unit < 1000*1000) { - time_unit <<= 1; - shift++; - } - - init_resp->os_monotonic_time_info.resolution = resolution; - init_resp->os_monotonic_time_unit = time_unit; - init_resp->os_monotonic_time_info.extended = 1; - internal_state.r.o.times_shift = shift; - - erts_init_os_monotonic_time_extender(&internal_state.wr.m.os_mtime_xtnd, - get_tick_count, - (1 << 29) / resolution); - } -#endif /* defined(OS_MONOTONIC_TIME_USING_TIMES) */ - -#ifdef WALL_CLOCK_ID_STR - init_resp->os_system_time_info.clock_id = WALL_CLOCK_ID_STR; -#else - init_resp->os_system_time_info.clock_id = NULL; -#endif - - init_resp->os_system_time_info.locked_use = 0; - init_resp->os_system_time_info.resolution = (Uint64) 1000*1000*1000; -#if defined(HAVE_CLOCK_GETRES) && defined(WALL_CLOCK_ID) - { - struct timespec ts; - if (clock_getres(WALL_CLOCK_ID, &ts) == 0) { - if (ts.tv_sec == 0 && ts.tv_nsec != 0) - init_resp->os_system_time_info.resolution /= ts.tv_nsec; - else if (ts.tv_sec >= 1) - init_resp->os_system_time_info.resolution = 1; - } - } -#elif defined(ERTS_HAVE_MACH_CLOCK_GETRES) && defined(WALL_CLOCK_ID) - init_resp->os_system_time_info.resolution - = mach_clock_getres(&internal_state.r.o.mach.clock.wall); -#endif - -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) - init_resp->os_system_time_info.func = "clock_gettime"; -#elif defined(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME) - init_resp->os_system_time_info.func = "clock_get_time"; -#elif defined(OS_SYSTEM_TIME_GETTIMEOFDAY) - init_resp->os_system_time_info.func = "gettimeofday"; - init_resp->os_system_time_info.resolution = 1000*1000; - init_resp->os_system_time_info.clock_id = NULL; -#else -# error Missing erts_os_system_time() implementation -#endif - -} - -void -erts_late_sys_init_time(void) -{ -#if defined(OS_MONOTONIC_TIME_USING_TIMES) - erts_late_init_os_monotonic_time_extender(&internal_state.wr.m.os_mtime_xtnd); -#endif -} - -static ERTS_INLINE ErtsSystemTime -adj_stime_time_unit(ErtsSystemTime stime, Uint32 res) -{ - if (res == ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT) - return stime; - if (res == (Uint32) 1000*1000*1000 - && ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT == 1000*1000) - return stime/1000; - if (res == (Uint32) 1000*1000 - && ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT == 1000*1000*1000) - return stime*1000; - return ((ErtsSystemTime) - erts_time_unit_conversion(stime, - (Uint32) res, - (Uint32) ERTS_MONOTONIC_TIME_UNIT)); -} - -#define ERTS_TimeSpec2Sint64(TS) \ - ((((Sint64) (TS)->tv_sec) * ((Sint64) 1000*1000*1000)) \ - + ((Sint64) (TS)->tv_nsec)) - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * POSIX clock_gettime() * -\* */ - -#if defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) \ - || defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) - -static ERTS_INLINE Sint64 -posix_clock_gettime(clockid_t id, char *name) -{ - struct timespec ts; - - if (clock_gettime(id, &ts) != 0) { - int err = errno; - char *errstr = err ? strerror(err) : "unknown"; - erl_exit(ERTS_ABORT_EXIT, - "clock_gettime(%s, _) failed: %s (%d)\n", - name, errstr, err); - } - return ERTS_TimeSpec2Sint64(&ts); -} - -#endif /* defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) \ - || defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) */ - -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) - -ErtsSystemTime -erts_os_system_time(void) -{ - Sint64 stime = posix_clock_gettime(WALL_CLOCK_ID, - WALL_CLOCK_ID_STR); - return adj_stime_time_unit((ErtsSystemTime) stime, - (Uint32) 1000*1000*1000); -} - -#endif /* defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) */ - -#if defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) - -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) - -#define ERTS_HAVE_ERTS_OS_TIMES_IMPL__ - -static ERTS_INLINE void -posix_clock_gettime_times(clockid_t mid, char *mname, - ErtsMonotonicTime *mtimep, - clockid_t sid, char *sname, - ErtsSystemTime *stimep) -{ - struct timespec mts, sts; - int mres, sres, merr, serr; - - mres = clock_gettime(mid, &mts); - merr = errno; - sres = clock_gettime(sid, &sts); - serr = errno; - - if (mres != 0) { - char *errstr = merr ? strerror(merr) : "unknown"; - erl_exit(ERTS_ABORT_EXIT, - "clock_gettime(%s, _) failed: %s (%d)\n", - mname, errstr, merr); - } - if (sres != 0) { - char *errstr = serr ? strerror(serr) : "unknown"; - erl_exit(ERTS_ABORT_EXIT, - "clock_gettime(%s, _) failed: %s (%d)\n", - sname, errstr, serr); - } - - *mtimep = (ErtsMonotonicTime) ERTS_TimeSpec2Sint64(&mts); - *stimep = (ErtsSystemTime) ERTS_TimeSpec2Sint64(&sts); -} - -#endif /* defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) */ - -#if defined(__linux__) - -static ErtsMonotonicTime clock_gettime_monotonic_verified(void) -{ - ErtsMonotonicTime mtime; - - mtime = (ErtsMonotonicTime) posix_clock_gettime(MONOTONIC_CLOCK_ID, - MONOTONIC_CLOCK_ID_STR); - - erts_smp_mtx_lock(&internal_state.w.f.mtx); - if (mtime < internal_state.w.f.last_delivered) - mtime = internal_state.w.f.last_delivered; - else - internal_state.w.f.last_delivered = mtime; - erts_smp_mtx_unlock(&internal_state.w.f.mtx); - - return mtime; -} - -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) - -static void clock_gettime_times_verified(ErtsMonotonicTime *mtimep, - ErtsSystemTime *stimep) -{ - posix_clock_gettime_times(MONOTONIC_CLOCK_ID, - MONOTONIC_CLOCK_ID_STR, - mtimep, - WALL_CLOCK_ID, - WALL_CLOCK_ID_STR, - stimep); - - erts_smp_mtx_lock(&internal_state.w.f.mtx); - if (*mtimep < internal_state.w.f.last_delivered) - *mtimep = internal_state.w.f.last_delivered; - else - internal_state.w.f.last_delivered = *mtimep; - erts_smp_mtx_unlock(&internal_state.w.f.mtx); -} - -#endif /* defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) */ - -static ErtsMonotonicTime clock_gettime_monotonic(void) -{ - return (ErtsMonotonicTime) posix_clock_gettime(MONOTONIC_CLOCK_ID, - MONOTONIC_CLOCK_ID_STR); + if ((erts_ticks_per_sec = TICKS_PER_SEC()) < 0) + erl_exit(1, "Can't get clock ticks/sec\n"); + if (erts_ticks_per_sec >= 1000) { + /* Workaround for beta linux kernels, need to be done in runtime + to make erlang run on both 2.4 and 2.5 kernels. In the future, + the kernel ticks might as + well be used as a high res timer instead, but that's for when the + majority uses kernels with HZ == 1024 */ + ticks_bsr = 3; + } else { + ticks_bsr = 0; + } + erts_ticks_per_sec_wrap = (erts_ticks_per_sec >> ticks_bsr); + return SYS_CLOCK_RESOLUTION; +} + +clock_t sys_times_wrap(void) +{ + SysTimes dummy; + clock_t result = (sys_times(&dummy) >> ticks_bsr); + return result; } -#if defined(HAVE_CLOCK_GETTIME_MONOTONIC_RAW) -static ErtsMonotonicTime clock_gettime_monotonic_raw(void) -{ - return (ErtsMonotonicTime) posix_clock_gettime(CLOCK_MONOTONIC_RAW, - "CLOCK_MONOTONIC_RAW"); -} - -#endif /* defined(HAVE_CLOCK_GETTIME_MONOTONIC_RAW) */ - -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) - -static void clock_gettime_times(ErtsMonotonicTime *mtimep, - ErtsSystemTime *stimep) -{ - posix_clock_gettime_times(MONOTONIC_CLOCK_ID, - MONOTONIC_CLOCK_ID_STR, - mtimep, - WALL_CLOCK_ID, - WALL_CLOCK_ID_STR, - stimep); -} - -#if defined(HAVE_CLOCK_GETTIME_MONOTONIC_RAW) - -static void clock_gettime_times_raw(ErtsMonotonicTime *mtimep, - ErtsSystemTime *stimep) -{ - posix_clock_gettime_times(CLOCK_MONOTONIC_RAW, - "CLOCK_MONOTONIC_RAW", - mtimep, - WALL_CLOCK_ID, - WALL_CLOCK_ID_STR, - stimep); -} - -#endif /* defined(HAVE_CLOCK_GETTIME_MONOTONIC_RAW) */ - -#endif /* defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) */ - -#else /* !defined(__linux__) */ - -ErtsMonotonicTime erts_os_monotonic_time(void) -{ - return posix_clock_gettime(MONOTONIC_CLOCK_ID, - MONOTONIC_CLOCK_ID_STR); -} - -#if defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) - -void erts_os_times(ErtsMonotonicTime *mtimep, ErtsSystemTime *stimep) -{ - posix_clock_gettime_times(MONOTONIC_CLOCK_ID, - MONOTONIC_CLOCK_ID_STR, - mtimep, - WALL_CLOCK_ID, - WALL_CLOCK_ID_STR, - stimep); -} - -#endif /* defined(OS_SYSTEM_TIME_USING_CLOCK_GETTIME) */ - -#endif /* !defined(__linux__) */ - -#endif /* defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) */ - -#if defined(SYS_HRTIME_USING_CLOCK_GETTIME) -# define ERTS_HAVE_ERTS_SYS_HRTIME_IMPL__ - -ErtsSysHrTime -erts_sys_hrtime(void) -{ - return (ErtsSysHrTime) posix_clock_gettime(HRTIME_CLOCK_ID, - HRTIME_CLOCK_ID_STR); -} - -#endif /* defined(SYS_HRTIME_USING_CLOCK_GETTIME) */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * MACH clock_get_time() * -\* */ - -#if defined(ERTS_MACH_CLOCKS) - -static void -mach_clocks_fini(void) -{ - mach_port_t task = mach_task_self(); - mach_port_deallocate(task, internal_state.r.o.mach.host); -#if defined(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME) - mach_port_deallocate(task, internal_state.r.o.mach.clock.monotonic.srv); -#endif -#if defined(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME) - mach_port_deallocate(task, internal_state.r.o.mach.clock.wall.srv); -#endif -} - -static void -mach_clocks_init(void) -{ - kern_return_t kret; - host_name_port_t host; - clock_id_t id; - clock_serv_t *clck_srv_p; - char *name; - - host = internal_state.r.o.mach.host = mach_host_self(); - -#if defined(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME) \ - || defined(SYS_HRTIME_USING_MACH_CLOCK_GET_TIME) - id = internal_state.r.o.mach.clock.monotonic.id = MONOTONIC_CLOCK_ID; - name = internal_state.r.o.mach.clock.monotonic.name = MONOTONIC_CLOCK_ID_STR; - clck_srv_p = &internal_state.r.o.mach.clock.monotonic.srv; - kret = host_get_clock_service(host, id, clck_srv_p); - if (kret != KERN_SUCCESS) { - erl_exit(ERTS_ABORT_EXIT, - "host_get_clock_service(_, %s, _) failed\n", - name); - } -#endif - -#if defined(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME) - id = internal_state.r.o.mach.clock.wall.id = WALL_CLOCK_ID; - name = internal_state.r.o.mach.clock.wall.name = WALL_CLOCK_ID_STR; - clck_srv_p = &internal_state.r.o.mach.clock.wall.srv; - kret = host_get_clock_service(host, id, clck_srv_p); - if (kret != KERN_SUCCESS) { - erl_exit(ERTS_ABORT_EXIT, - "host_get_clock_service(_, %s, _) failed\n", - name); - } -#endif - - if (atexit(mach_clocks_fini) != 0) { - int err = errno; - char *errstr = err ? strerror(err) : "unknown"; - erl_exit(ERTS_ABORT_EXIT, - "Failed to register mach_clocks_fini() " - "for call at exit: %s (%d)\n", - errstr, err); - } -} - -#ifdef ERTS_HAVE_MACH_CLOCK_GETRES - -static Sint64 -mach_clock_getres(ErtsMachClock *clk) -{ - kern_return_t kret; - natural_t attr[1]; - mach_msg_type_number_t cnt; - - cnt = sizeof(attr); - kret = clock_get_attributes(clk->srv, - CLOCK_GET_TIME_RES, - (clock_attr_t) attr, - &cnt); - if (kret != KERN_SUCCESS || cnt != 1) { - erl_exit(ERTS_ABORT_EXIT, - "clock_get_attributes(%s, _) failed\n", - clk->name); - } - - return (Sint64) attr[0]; -} - -#endif /* ERTS_HAVE_MACH_CLOCK_GETRES */ - -static ERTS_INLINE Sint64 -mach_clock_get_time(ErtsMachClock *clk) -{ - kern_return_t kret; - mach_timespec_t time_spec; - - kret = clock_get_time(clk->srv, &time_spec); - if (kret != KERN_SUCCESS) - erl_exit(ERTS_ABORT_EXIT, "clock_get_time(%s, _) failed\n", clk->name); - - return ERTS_TimeSpec2Sint64(&time_spec); -} - -#endif /* defined(ERTS_MACH_CLOCKS) */ - -#if defined(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME) - -#define ERTS_HAVE_ERTS_OS_TIMES_IMPL__ - -ErtsSystemTime -erts_os_system_time(void) -{ - Sint64 stime = mach_clock_get_time(&internal_state.r.o.mach.clock.wall); - return adj_stime_time_unit((ErtsSystemTime) stime, - (Uint32) 1000*1000*1000); -} - -#endif /* defined(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME) */ - -#if defined(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME) - -ErtsMonotonicTime -erts_os_monotonic_time(void) -{ - return (ErtsMonotonicTime) - mach_clock_get_time(&internal_state.r.o.mach.clock.monotonic); -} - -#if defined(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME) - -#define ERTS_HAVE_ERTS_OS_TIMES_IMPL__ - -void -erts_os_times(ErtsMonotonicTime *mtimep, ErtsSystemTime *stimep) -{ - kern_return_t mkret, skret; - mach_timespec_t mon_time_spec, sys_time_spec; - - mkret = clock_get_time(internal_state.r.o.mach.clock.monotonic.srv, - &mon_time_spec); - skret = clock_get_time(internal_state.r.o.mach.clock.wall.srv, - &sys_time_spec); - - if (mkret != KERN_SUCCESS) - erl_exit(ERTS_ABORT_EXIT, - "clock_get_time(%s, _) failed\n", - internal_state.r.o.mach.clock.monotonic.name); - if (skret != KERN_SUCCESS) - erl_exit(ERTS_ABORT_EXIT, - "clock_get_time(%s, _) failed\n", - internal_state.r.o.mach.clock.wall.name); - - *mtimep = (ErtsMonotonicTime) ERTS_TimeSpec2Sint64(&mon_time_spec); - *stimep = (ErtsSystemTime) ERTS_TimeSpec2Sint64(&sys_time_spec); -} - -#endif /* defined(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME) */ - -#endif /* defined(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME) */ - -#if defined(SYS_HRTIME_USING_MACH_CLOCK_GET_TIME) - -#define ERTS_HAVE_ERTS_SYS_HRTIME_IMPL__ - -ErtsSysHrTime -erts_sys_hrtime(void) -{ - return (ErtsSysHrTime) - mach_clock_get_time(&internal_state.r.o.mach.clock.monotonic); -} - -#endif /* defined(SYS_HRTIME_USING_MACH_CLOCK_GET_TIME) */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * Solaris gethrtime() - OS monotonic time * -\* */ - -#if defined(OS_MONOTONIC_TIME_USING_GETHRTIME) - -ErtsMonotonicTime erts_os_monotonic_time(void) -{ - return (ErtsMonotonicTime) gethrtime(); -} - -#endif /* defined(OS_MONOTONIC_TIME_USING_GETHRTIME) */ - -#if defined(SYS_HRTIME_USING_GETHRTIME) - -#define ERTS_HAVE_ERTS_SYS_HRTIME_IMPL__ - -ErtsSysHrTime -erts_sys_hrtime(void) -{ - return (ErtsSysHrTime) gethrtime(); -} - -#endif /* defined(SYS_HRTIME_USING_GETHRTIME) */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * gettimeofday() - OS system time * -\* */ - -#if defined(OS_SYSTEM_TIME_GETTIMEOFDAY) - -ErtsSystemTime -erts_os_system_time(void) -{ - ErtsSystemTime stime; - struct timeval tv; - - if (gettimeofday(&tv, NULL) != 0) { - int err = errno; - char *errstr = err ? strerror(err) : "unknown"; - erl_exit(ERTS_ABORT_EXIT, - "gettimeofday(_, NULL) failed: %s (%d)\n", - errstr, err); - } - - stime = (ErtsSystemTime) tv.tv_sec; - stime *= (ErtsSystemTime) 1000*1000; - stime += (ErtsSystemTime) tv.tv_usec; - - return adj_stime_time_unit(stime, (Uint32) 1000*1000); -} - -#endif /* defined(OS_SYSTEM_TIME_GETTIMEOFDAY) */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * times() - OS monotonic time * -\* */ - -#if defined(OS_MONOTONIC_TIME_USING_TIMES) - -ErtsMonotonicTime -erts_os_monotonic_time(void) -{ - Uint32 ticks = get_tick_count(); - ERTS_CHK_EXTEND_OS_MONOTONIC_TIME(&internal_state.wr.m.os_mtime_xtnd, - ticks); - return ERTS_EXTEND_OS_MONOTONIC_TIME(&internal_state.wr.m.os_mtime_xtnd, - ticks) << internal_state.r.o.times_shift; -} - -#endif - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ - * Fallbacks * -\* */ - -#ifndef ERTS_HAVE_ERTS_SYS_HRTIME_IMPL__ - -ErtsSysHrTime -erts_sys_hrtime(void) -{ - return (ErtsSysHrTime) ERTS_MONOTONIC_TO_NSEC(erts_os_system_time()); -} - -#endif - -#if !defined(ERTS_HAVE_ERTS_OS_TIMES_IMPL__) \ - && defined(ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT) - -void -erts_os_times(ErtsMonotonicTime *mtimep, ErtsSystemTime *stimep) -{ - *mtimep = erts_os_monotonic_time(); - *stimep = erts_os_system_time(); -} - -#endif -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifdef HAVE_GETHRVTIME_PROCFS_IOCTL diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/dosmap.c erlang-17.3-dfsg/erts/emulator/sys/win32/dosmap.c --- erlang-18.2-dfsg/erts/emulator/sys/win32/dosmap.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/dosmap.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/driver_int.h erlang-17.3-dfsg/erts/emulator/sys/win32/driver_int.h --- erlang-18.2-dfsg/erts/emulator/sys/win32/driver_int.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/driver_int.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/erl_main.c erlang-17.3-dfsg/erts/emulator/sys/win32/erl_main.c --- erlang-18.2-dfsg/erts/emulator/sys/win32/erl_main.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/erl_main.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/erl_poll.c erlang-17.3-dfsg/erts/emulator/sys/win32/erl_poll.c --- erlang-18.2-dfsg/erts/emulator/sys/win32/erl_poll.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/erl_poll.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -26,7 +25,6 @@ #include "sys.h" #include "erl_alloc.h" #include "erl_poll.h" -#include "erl_time.h" /* * Some debug macros @@ -287,7 +285,7 @@ #ifdef ERTS_SMP erts_smp_mtx_t mtx; #endif - erts_atomic64_t timeout_time; + erts_smp_atomic32_t timeout; }; #ifdef ERTS_SMP @@ -365,26 +363,6 @@ wait_standby(PS); \ } while(0) -static ERTS_INLINE void -init_timeout_time(ErtsPollSet ps) -{ - erts_atomic64_init_nob(&ps->timeout_time, - (erts_aint64_t) ERTS_MONOTONIC_TIME_MAX); -} - -static ERTS_INLINE void -set_timeout_time(ErtsPollSet ps, ErtsMonotonicTime time) -{ - erts_atomic64_set_relb(&ps->timeout_time, - (erts_aint64_t) time); -} - -static ERTS_INLINE ErtsMonotonicTime -get_timeout_time(ErtsPollSet ps) -{ - return (ErtsMonotonicTime) erts_atomic64_read_acqb(&ps->timeout_time); -} - #define ERTS_POLL_NOT_WOKEN ((erts_aint32_t) 0) #define ERTS_POLL_WOKEN_IO_READY ((erts_aint32_t) 1) #define ERTS_POLL_WOKEN_INTR ((erts_aint32_t) 2) @@ -444,29 +422,15 @@ } static ERTS_INLINE DWORD -poll_wait_timeout(ErtsPollSet ps, ErtsMonotonicTime timeout_time) +poll_wait_timeout(ErtsPollSet ps, SysTimeval *tvp) { - ErtsMonotonicTime current_time, diff_time, timeout; + time_t timeout = tvp->tv_sec * 1000 + tvp->tv_usec / 1000; - if (timeout_time == ERTS_POLL_NO_TIMEOUT) { - no_timeout: - set_timeout_time(ps, ERTS_MONOTONIC_TIME_MIN); + if (timeout <= 0) { woke_up(ps); return (DWORD) 0; } - current_time = erts_get_monotonic_time(NULL); - diff_time = timeout_time - current_time; - if (diff_time <= 0) - goto no_timeout; - - /* Round up to nearest milli second */ - timeout = (ERTS_MONOTONIC_TO_MSEC(diff_time - 1) + 1); - if (timeout > INT_MAX) - timeout = INT_MAX; /* Also prevents DWORD overflow */ - - set_timeout_time(ps, current_time + ERTS_MSEC_TO_MONOTONIC(timeout)); - ResetEvent(ps->event_io_ready); /* * Since we don't know the internals of ResetEvent() we issue @@ -478,6 +442,10 @@ if (erts_atomic32_read_nob(&ps->wakeup_state) != ERTS_POLL_NOT_WOKEN) return (DWORD) 0; + if (timeout > ((time_t) ERTS_AINT32_T_MAX)) + timeout = ERTS_AINT32_T_MAX; /* Also prevents DWORD overflow */ + + erts_smp_atomic32_set_relb(&ps->timeout, (erts_aint32_t) timeout); return (DWORD) timeout; } @@ -1044,12 +1012,12 @@ void erts_poll_interrupt_timed(ErtsPollSet ps, int set /* bool */, - ErtsMonotonicTime timeout_time) + erts_short_time_t msec) { - HARDTRACEF(("In erts_poll_interrupt_timed(%d,%ld)",set,timeout_time)); + HARDTRACEF(("In erts_poll_interrupt_timed(%d,%ld)",set,msec)); if (!set) reset_interrupt(ps); - else if (get_timeout_time(ps) > timeout_time) + else if (erts_smp_atomic32_read_acqb(&ps->timeout) > (erts_aint32_t) msec) set_interrupt(ps); HARDTRACEF(("Out erts_poll_interrupt_timed")); } @@ -1117,14 +1085,14 @@ pcev[i].events, pcev[i].on); } - ERTS_POLLSET_UNLOCK(ps); + ERTS_POLLSET_LOCK(ps); HARDTRACEF(("Out erts_poll_controlv")); } int erts_poll_wait(ErtsPollSet ps, ErtsPollResFd pr[], int *len, - ErtsMonotonicTime timeout_time) + SysTimeval *tvp) { int no_fds; DWORD timeout; @@ -1181,7 +1149,7 @@ no_fds = ERTS_POLL_MAX_RES; #endif - timeout = poll_wait_timeout(ps, timeout_time); + timeout = poll_wait_timeout(ps, tvp); /*HARDDEBUGF(("timeout = %ld",(long) timeout));*/ @@ -1274,7 +1242,7 @@ erts_mtx_unlock(&w->mtx); } done: - set_timeout_time(ps, ERTS_MONOTONIC_TIME_MAX); + erts_smp_atomic32_set_nob(&ps->timeout, ERTS_AINT32_T_MAX); *len = num; ERTS_POLLSET_UNLOCK(ps); HARDTRACEF(("Out erts_poll_wait")); @@ -1358,7 +1326,7 @@ #ifdef ERTS_SMP erts_smp_mtx_init(&ps->mtx, "pollset"); #endif - init_timeout_time(ps); + erts_smp_atomic32_init_nob(&ps->timeout, ERTS_AINT32_T_MAX); HARDTRACEF(("Out erts_poll_create_pollset")); return ps; diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/erl_win32_sys_ddll.c erlang-17.3-dfsg/erts/emulator/sys/win32/erl_win32_sys_ddll.c --- erlang-18.2-dfsg/erts/emulator/sys/win32/erl_win32_sys_ddll.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/erl_win32_sys_ddll.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -52,8 +51,7 @@ #define ERL_NIF_API_FUNC_DECL(RET,NAME,ARGS) nif_callbacks.NAME = NAME #include "erl_nif_api_funcs.h" #undef ERL_NIF_API_FUNC_DECL - nif_callbacks.erts_alc_test = erts_alc_test; - + return; } diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/erl_win_dyn_driver.h erlang-17.3-dfsg/erts/emulator/sys/win32/erl_win_dyn_driver.h --- erlang-18.2-dfsg/erts/emulator/sys/win32/erl_win_dyn_driver.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/erl_win_dyn_driver.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -145,8 +144,8 @@ WDD_TYPEDEF(int, erl_drv_equal_tids, (ErlDrvTid tid1, ErlDrvTid tid2)); WDD_TYPEDEF(void, erl_drv_thread_exit, (void *resp)); WDD_TYPEDEF(int, erl_drv_thread_join, (ErlDrvTid, void **respp)); -WDD_TYPEDEF(int, erl_drv_putenv, (const char *key, char *value)); -WDD_TYPEDEF(int, erl_drv_getenv, (const char *key, char *value, size_t *value_size)); +WDD_TYPEDEF(int, erl_drv_putenv, (char *key, char *value)); +WDD_TYPEDEF(int, erl_drv_getenv, (char *key, char *value, size_t *value_size)); typedef struct { WDD_FTYPE(null_func) *null_func; diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/erl_win_sys.h erlang-17.3-dfsg/erts/emulator/sys/win32/erl_win_sys.h --- erlang-18.2-dfsg/erts/emulator/sys/win32/erl_win_sys.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/erl_win_sys.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -114,13 +113,18 @@ /* * Our own type of "FD's" */ -#define ERTS_SYS_FD_INVALID INVALID_HANDLE_VALUE #define ERTS_SYS_FD_TYPE HANDLE #define NO_FSTAT_ON_SYS_FD_TYPE 1 /* They are events, not files */ +#define HAVE_ERTS_CHECK_IO_DEBUG +int erts_check_io_debug(void); + /* * For erl_time_sup */ +#define HAVE_GETHRTIME + +#define sys_init_hrtime() /* Nothing */ #define SYS_CLK_TCK 1000 #define SYS_CLOCK_RESOLUTION 1 @@ -162,81 +166,18 @@ #if defined (__GNUC__) typedef unsigned long long Uint64; typedef long long Sint64; -# ifdef ULLONG_MAX -# define ERTS_UINT64_MAX ULLONG_MAX -# endif -# ifdef LLONG_MAX -# define ERTS_SINT64_MAX LLONG_MAX -# endif -# ifdef LLONG_MIN -# define ERTS_SINT64_MIN LLONG_MIN -# endif -typedef long long ErtsMonotonicTime; -typedef long long ErtsSysHrTime; +typedef long long SysHrTime; #else typedef ULONGLONG Uint64; typedef LONGLONG Sint64; -typedef LONGLONG ErtsMonotonicTime; -typedef LONGLONG ErtsSysHrTime; +typedef LONGLONG SysHrTime; #endif -typedef ErtsMonotonicTime ErtsSystemTime; - -ErtsSystemTime erts_os_system_time(void); - -#define ERTS_MONOTONIC_TIME_MIN (((ErtsMonotonicTime) 1) << 63) -#define ERTS_MONOTONIC_TIME_MAX (~ERTS_MONOTONIC_TIME_MIN) - -#define ERTS_HAVE_OS_MONOTONIC_TIME_SUPPORT 1 -#define ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT 0 - -struct erts_sys_time_read_only_data__ { - ErtsMonotonicTime (*os_monotonic_time)(void); - void (*os_times)(ErtsMonotonicTime *, ErtsSystemTime*); - ErtsSysHrTime (*sys_hrtime)(void); -}; - -typedef struct { - union { - struct erts_sys_time_read_only_data__ o; - char align__[(((sizeof(struct erts_sys_time_read_only_data__) - 1) - / ASSUMED_CACHE_LINE_SIZE) + 1) - * ASSUMED_CACHE_LINE_SIZE]; - } r; -} ErtsSysTimeData__; - -extern ErtsSysTimeData__ erts_sys_time_data__; - -ERTS_GLB_INLINE ErtsMonotonicTime erts_os_monotonic_time(void); -ERTS_GLB_INLINE void erts_os_times(ErtsMonotonicTime *, - ErtsSystemTime *); -ERTS_GLB_INLINE ErtsSysHrTime erts_sys_hrtime(void); - -#if ERTS_GLB_INLINE_INCL_FUNC_DEF - -ERTS_GLB_INLINE ErtsMonotonicTime -erts_os_monotonic_time(void) -{ - return (*erts_sys_time_data__.r.o.os_monotonic_time)(); -} - -ERTS_GLB_INLINE void -erts_os_times(ErtsMonotonicTime *mtimep, ErtsSystemTime *stimep) -{ - (*erts_sys_time_data__.r.o.os_times)(mtimep, stimep); -} - -ERTS_GLB_INLINE ErtsSysHrTime -erts_sys_hrtime(void) -{ - return (*erts_sys_time_data__.r.o.sys_hrtime)(); -} - -#endif /* ERTS_GLB_INLINE_INCL_FUNC_DEF */ - +extern int sys_init_time(void); extern void sys_gettimeofday(SysTimeval *tv); +extern SysHrTime sys_gethrtime(void); extern clock_t sys_times(SysTimes *buffer); extern char *win_build_environment(char *); @@ -268,8 +209,6 @@ int _finite(double x); #endif -#define erts_isfinite _finite - /*#define NO_FPE_SIGNALS*/ #define erts_get_current_fp_exception() NULL #define __ERTS_FP_CHECK_INIT(fpexnp) do {} while (0) @@ -299,16 +238,4 @@ int init_async(int); int exit_async(void); #endif - -#define ERTS_HAVE_TRY_CATCH 1 - -#define ERTS_SYS_TRY_CATCH(EXPR,CATCH) \ - __try { \ - EXPR; \ - } \ - __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) \ - { \ - CATCH; \ - } - #endif diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/sys.c erlang-17.3-dfsg/erts/emulator/sys/win32/sys.c --- erlang-18.2-dfsg/erts/emulator/sys/win32/sys.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/sys.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -248,27 +247,6 @@ #endif } -/* - * Function returns 1 if we can read from all values in between - * start and stop. - */ -int -erts_sys_is_area_readable(char *start, char *stop) { - volatile char tmp; - __try - { - while(start < stop) { - tmp = *start; - start++; - } - } - __except(EXCEPTION_EXECUTE_HANDLER) - { - return 0; - } - return 1; -} - int erts_sys_prepare_crash_dump(int secs) { Port *heart_port; @@ -1414,46 +1392,39 @@ return i; } - -/* - * Translating of command line arguments to correct format. In the examples - * below the '' are not part of the actual string. - * 'io:format("hello").' -> 'io:format(\"hello\").' - * 'io:format("is anybody in there?").' -> '"io:format(\"is anybody in there?\")."' - * 'Just nod if you can hear me.' -> '"Just nod if you can hear me."' - * 'Is there ""anyone at home?' -> '"Is there \"\"anyone at home?"' - * 'Relax."' -> 'Relax.\"' - * - * If new == NULL we just calculate the length. - * - * The reason for having to quote all of the is becasue CreateProcessW removes - * one level of escaping since it takes a single long command line rather - * than the argument chunks that unix uses. - */ -static int escape_and_quote(wchar_t *str, wchar_t *new, BOOL *quoted) { - int i, j = 0; - if (new == NULL) - *quoted = FALSE; - else if (*quoted) - new[j++] = L'"'; - for ( i = 0; str[i] != L'\0'; i++,j++) { - if (str[i] == L' ' && new == NULL && *quoted == FALSE) { - *quoted = TRUE; - j++; - } - /* check if we have to escape quotes */ - if (str[i] == L'"') { - if (new) new[j] = L'\\'; - j++; - } - if (new) new[j] = str[i]; - } - if (*quoted) { - if (new) new[j] = L'"'; - j++; +static BOOL need_quotes(wchar_t *str) +{ + int in_quote = 0; + int backslashed = 0; + int naked_space = 0; + + while (*str != L'\0') { + switch (*str) { + case L'\\' : + backslashed = !backslashed; + break; + case L'"': + if (backslashed) { + backslashed=0; + } else { + in_quote = !in_quote; + } + break; + case L' ': + backslashed = 0; + if (!(backslashed || in_quote)) { + naked_space++; + } + break; + default: + backslashed = 0; + } + ++str; } - return j; + return (naked_space > 0); } + + /* *---------------------------------------------------------------------- @@ -1614,24 +1585,31 @@ wcscpy(appname, execPath); } if (argv == NULL) { - BOOL orig_need_q; + BOOL orig_need_q = need_quotes(execPath); wchar_t *ptr; - int ocl = escape_and_quote(execPath, NULL, &orig_need_q); + int ocl = wcslen(execPath); if (run_cmd) { newcmdline = (wchar_t *) erts_alloc(ERTS_ALC_T_TMP, - (ocl + 1 + 11)*sizeof(wchar_t)); + (ocl + ((orig_need_q) ? 3 : 1) + + 11)*sizeof(wchar_t)); memcpy(newcmdline,L"cmd.exe /c ",11*sizeof(wchar_t)); ptr = newcmdline + 11; } else { newcmdline = (wchar_t *) erts_alloc(ERTS_ALC_T_TMP, - (ocl + 1)*sizeof(wchar_t)); + (ocl + ((orig_need_q) ? 3 : 1))*sizeof(wchar_t)); ptr = (wchar_t *) newcmdline; } - ptr += escape_and_quote(execPath, ptr, &orig_need_q); - ptr[0] = L'\0'; + if (orig_need_q) { + *ptr++ = L'"'; + } + memcpy(ptr,execPath,ocl*sizeof(wchar_t)); + ptr += ocl; + if (orig_need_q) { + *ptr++ = L'"'; + } + *ptr = L'\0'; } else { - int sum = 0; - BOOL *qte = NULL; + int sum = 1; /* '\0' */ wchar_t **ar = argv; wchar_t *n; wchar_t *save_arg0 = NULL; @@ -1642,13 +1620,11 @@ if (run_cmd) { sum += 11; /* cmd.exe /c */ } - - while (*ar != NULL) ar++; - qte = erts_alloc(ERTS_ALC_T_TMP, (ar - argv)*sizeof(BOOL)); - - ar = argv; while (*ar != NULL) { - sum += escape_and_quote(*ar,NULL,qte+(ar - argv)); + sum += wcslen(*ar); + if (need_quotes(*ar)) { + sum += 2; /* quotes */ + } sum++; /* space */ ++ar; } @@ -1660,18 +1636,26 @@ n += 11; } while (*ar != NULL) { - n += escape_and_quote(*ar,n,qte+(ar - argv)); + int q = need_quotes(*ar); + sum = wcslen(*ar); + if (q) { + *n++ = L'"'; + } + memcpy(n,*ar,sum*sizeof(wchar_t)); + n += sum; + if (q) { + *n++ = L'"'; + } *n++ = L' '; ++ar; } - *(n-1) = L'\0'; /* overwrite last space with '\0' */ + *(n-1) = L'\0'; if (save_arg0 != NULL) { argv[0] = save_arg0; } - erts_free(ERTS_ALC_T_TMP, qte); } - DEBUGF((stderr,"Creating child process: %S, createFlags = %d\n", newcmdline, createFlags)); + DEBUGF(("Creating child process: %s, createFlags = %d\n", newcmdline, createFlags)); ok = CreateProcessW((wchar_t *) appname, (wchar_t *) newcmdline, NULL, @@ -2206,7 +2190,7 @@ ASSERT(dp->out.flushEvent); SetEvent(dp->out.flushEvent); } while (WaitForSingleObject(dp->out.flushReplyEvent, 10) == WAIT_TIMEOUT - && !(dp->out.flags & DF_THREAD_FLUSHED)); + || !(dp->out.flags & DF_THREAD_FLUSHED)); } } @@ -3173,31 +3157,25 @@ void erts_sys_pre_init(void) { -#ifdef USE_THREADS - erts_thr_init_data_t eid = ERTS_THR_INIT_DATA_DEF_INITER; -#endif int_os_version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&int_os_version); check_supported_os_version(); - #ifdef USE_THREADS - eid.thread_create_child_func = thr_create_prepare_child; - /* Before creation in parent */ - eid.thread_create_prepare_func = thr_create_prepare; - /* After creation in parent */ - eid.thread_create_parent_func = thr_create_cleanup; - - erts_thr_init(&eid); -#endif + { + erts_thr_init_data_t eid = ERTS_THR_INIT_DATA_DEF_INITER; - erts_init_sys_time_sup(); + eid.thread_create_child_func = thr_create_prepare_child; + /* Before creation in parent */ + eid.thread_create_prepare_func = thr_create_prepare; + /* After creation in parent */ + eid.thread_create_parent_func = thr_create_cleanup, -#ifdef USE_THREADS + erts_thr_init(&eid); #ifdef ERTS_ENABLE_LOCK_COUNT - erts_lcnt_init(); + erts_lcnt_init(); #endif + } #endif - erts_smp_atomic_init_nob(&sys_misc_mem_sz, 0); } @@ -3280,9 +3258,9 @@ #ifdef ERTS_SMP void -erts_sys_schedule_interrupt_timed(int set, ErtsMonotonicTime timeout_time) +erts_sys_schedule_interrupt_timed(int set, erts_short_time_t msec) { - erts_check_io_interrupt_timed(set, timeout_time); + erts_check_io_interrupt_timed(set, msec); } #endif diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/sys_env.c erlang-17.3-dfsg/erts/emulator/sys/win32/sys_env.c --- erlang-18.2-dfsg/erts/emulator/sys/win32/sys_env.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/sys_env.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/sys_float.c erlang-17.3-dfsg/erts/emulator/sys/win32/sys_float.c --- erlang-18.2-dfsg/erts/emulator/sys/win32/sys_float.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/sys_float.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/sys_interrupt.c erlang-17.3-dfsg/erts/emulator/sys/win32/sys_interrupt.c --- erlang-18.2-dfsg/erts/emulator/sys/win32/sys_interrupt.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/sys_interrupt.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/sys/win32/sys_time.c erlang-17.3-dfsg/erts/emulator/sys/win32/sys_time.c --- erlang-18.2-dfsg/erts/emulator/sys/win32/sys_time.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/sys/win32/sys_time.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -26,11 +25,6 @@ #endif #include "sys.h" #include "assert.h" -#include "erl_os_monotonic_time_extender.h" -#include "erl_time.h" - -/* Need to look more closely at qpc before use... */ -#define ERTS_DISABLE_USE_OF_QPC_FOR_MONOTONIC_TIME 1 #define LL_LITERAL(X) ERTS_I64_LITERAL(X) @@ -67,6 +61,11 @@ (epoch) = ((ull.QuadPart / TICKS_PER_SECOND) - EPOCH_JULIAN_DIFF); \ } while(0) +static SysHrTime wrap = 0; +static DWORD last_tick_count = 0; +static erts_smp_mtx_t wrap_lock; +static ULONGLONG (WINAPI *pGetTickCount64)(void) = NULL; + /* Getting timezone information is a heavy operation, so we want to do this only once */ @@ -77,348 +76,27 @@ {0,31,28,31,30,31,30,31,31,30,31,30,31}, {0,31,29,31,30,31,30,31,31,30,31,30,31}}; -#define ERTS_GET_TICK_COUNT_TIME_UNIT_SHIFT 10 - -/* - * erts_os_monotonic_time() - */ - -struct sys_time_internal_state_read_only__ { - ULONGLONG (WINAPI *pGetTickCount64)(void); - BOOL (WINAPI *pQueryPerformanceCounter)(LARGE_INTEGER *); - Sint32 pcf; - int using_get_tick_count_time_unit; -}; - -struct sys_time_internal_state_read_mostly__ { - ErtsOsMonotonicTimeExtendState os_mtime_xtnd; -}; - -struct sys_time_internal_state_write_freq__ { - erts_smp_mtx_t mtime_mtx; - ULONGLONG wrap; - ULONGLONG last_tick_count; -}; - -__declspec(align(ASSUMED_CACHE_LINE_SIZE)) struct { - union { - struct sys_time_internal_state_read_only__ o; - char align__[(((sizeof(struct sys_time_internal_state_read_only__) - 1) - / ASSUMED_CACHE_LINE_SIZE) + 1) - * ASSUMED_CACHE_LINE_SIZE]; - } r; - union { - struct sys_time_internal_state_read_mostly__ m; - char align__[(((sizeof(struct sys_time_internal_state_read_mostly__) - 1) - / ASSUMED_CACHE_LINE_SIZE) + 1) - * ASSUMED_CACHE_LINE_SIZE]; - } wr; - union { - struct sys_time_internal_state_write_freq__ f; - char align__[(((sizeof(struct sys_time_internal_state_write_freq__) - 1) - / ASSUMED_CACHE_LINE_SIZE) + 1) - * ASSUMED_CACHE_LINE_SIZE]; - } w; -} internal_state; - -__declspec(align(ASSUMED_CACHE_LINE_SIZE)) ErtsSysTimeData__ erts_sys_time_data__; - - -static ERTS_INLINE ErtsSystemTime -SystemTime2MilliSec(SYSTEMTIME *stp) -{ - ErtsSystemTime stime; - FILETIME ft; - ULARGE_INTEGER ull; - - SystemTimeToFileTime(stp, &ft); - FILETIME_TO_ULI(ull,ft); - /* now in 100 ns units */ - stime = (ErtsSystemTime) ull.QuadPart; - stime -= (((ErtsSystemTime) EPOCH_JULIAN_DIFF) - * ((ErtsSystemTime) (10*1000*1000))); - stime /= (ErtsSystemTime) (10*1000); /* ms */ - return stime; -} - -static ErtsMonotonicTime -os_monotonic_time_qpc(void) -{ - LARGE_INTEGER pc; - - if (!(*internal_state.r.o.pQueryPerformanceCounter)(&pc)) - erl_exit(ERTS_ABORT_EXIT, "QueryPerformanceCounter() failed\n"); - - return (ErtsMonotonicTime) pc.QuadPart; -} - -static void -os_times_qpc(ErtsMonotonicTime *mtimep, ErtsSystemTime *stimep) -{ - LARGE_INTEGER pc; - SYSTEMTIME st; - ErtsSystemTime stime; - BOOL qpcr; - - qpcr = (*internal_state.r.o.pQueryPerformanceCounter)(&pc); - GetSystemTime(&st); - - if (!qpcr) - erl_exit(ERTS_ABORT_EXIT, "QueryPerformanceCounter() failed\n"); - - *mtimep = (ErtsMonotonicTime) pc.QuadPart; - - stime = SystemTime2MilliSec(&st); - - *stimep = ((ErtsSystemTime) - erts_time_unit_conversion((Uint64) stime, - (Uint32) 1000, - internal_state.r.o.pcf)); -} - -static Uint32 -get_tick_count(void) -{ - return (Uint32) GetTickCount(); -} - -static ErtsMonotonicTime -os_monotonic_time_gtc32(void) -{ - ErtsMonotonicTime mtime; - Uint32 ticks = (Uint32) GetTickCount(); - ERTS_CHK_EXTEND_OS_MONOTONIC_TIME(&internal_state.wr.m.os_mtime_xtnd, - ticks); - mtime = ERTS_EXTEND_OS_MONOTONIC_TIME(&internal_state.wr.m.os_mtime_xtnd, - ticks); - mtime <<= ERTS_GET_TICK_COUNT_TIME_UNIT_SHIFT; - return mtime; -} - -static void -os_times_gtc32(ErtsMonotonicTime *mtimep, ErtsSystemTime *stimep) -{ - SYSTEMTIME st; - ErtsSystemTime stime, mtime; - Uint32 ticks; - - ticks = (Uint32) GetTickCount(); - GetSystemTime(&st); - - ERTS_CHK_EXTEND_OS_MONOTONIC_TIME(&internal_state.wr.m.os_mtime_xtnd, - ticks); - mtime = ERTS_EXTEND_OS_MONOTONIC_TIME(&internal_state.wr.m.os_mtime_xtnd, - ticks); - mtime <<= ERTS_GET_TICK_COUNT_TIME_UNIT_SHIFT; - *mtimep = mtime; - - stime = SystemTime2MilliSec(&st); - stime <<= ERTS_GET_TICK_COUNT_TIME_UNIT_SHIFT; - *stimep = stime; - -} - -static ErtsMonotonicTime -os_monotonic_time_gtc64(void) -{ - ULONGLONG ticks = (*internal_state.r.o.pGetTickCount64)(); - ErtsMonotonicTime mtime = (ErtsMonotonicTime) ticks; - return mtime << ERTS_GET_TICK_COUNT_TIME_UNIT_SHIFT; -} - -static void -os_times_gtc64(ErtsMonotonicTime *mtimep, ErtsSystemTime *stimep) -{ - SYSTEMTIME st; - ErtsSystemTime stime, mtime; - ULONGLONG ticks; - - ticks = (*internal_state.r.o.pGetTickCount64)(); - GetSystemTime(&st); - - mtime = (ErtsMonotonicTime) ticks; - mtime <<= ERTS_GET_TICK_COUNT_TIME_UNIT_SHIFT; - *mtimep = mtime; - - stime = SystemTime2MilliSec(&st); - stime <<= ERTS_GET_TICK_COUNT_TIME_UNIT_SHIFT; - *stimep = stime; -} - -static ErtsSysHrTime -sys_hrtime_qpc(void) -{ - LARGE_INTEGER pc; - - if (!(*internal_state.r.o.pQueryPerformanceCounter)(&pc)) - erl_exit(ERTS_ABORT_EXIT, "QueryPerformanceCounter() failed\n"); - - ASSERT(pc.QuadPart > 0); - - return (ErtsSysHrTime) erts_time_unit_conversion((Uint64) pc.QuadPart, - internal_state.r.o.pcf, - (Uint32) 1000*1000*1000); -} - -static ErtsSysHrTime -sys_hrtime_gtc32(void) -{ - ErtsSysHrTime time; - Uint32 ticks = (Uint32) GetTickCount(); - ERTS_CHK_EXTEND_OS_MONOTONIC_TIME(&internal_state.wr.m.os_mtime_xtnd, - tick_count); - time = (ErtsSysHrTime) ERTS_EXTEND_OS_MONOTONIC_TIME(&internal_state.wr.m.os_mtime_xtnd, - ticks); - time *= (ErtsSysHrTime) (1000 * 1000); - return time; -} - -static ErtsSysHrTime -sys_hrtime_gtc64(void) -{ - ErtsSysHrTime time = (*internal_state.r.o.pGetTickCount64)(); - time *= (ErtsSysHrTime) (1000*1000); - return time; -} - -/* - * Init - */ - -void -sys_init_time(ErtsSysInitTimeResult *init_resp) +int +sys_init_time(void) { - ErtsMonotonicTime (*os_mtime_func)(void); - void (*os_times_func)(ErtsMonotonicTime *, ErtsSystemTime *); - ErtsSysHrTime (*sys_hrtime_func)(void) = NULL; - ErtsMonotonicTime time_unit; char kernel_dll_name[] = "kernel32"; HMODULE module; - init_resp->os_monotonic_time_info.clock_id = NULL; - module = GetModuleHandle(kernel_dll_name); - if (!module) { - get_tick_count: - erts_smp_mtx_init(&internal_state.w.f.mtime_mtx, - "os_monotonic_time"); - internal_state.w.f.wrap = 0; - internal_state.w.f.last_tick_count = 0; - - init_resp->os_monotonic_time_info.func = "GetTickCount"; - init_resp->os_monotonic_time_info.locked_use = 0; - /* 10-16 ms resolution according to MicroSoft documentation */ - init_resp->os_monotonic_time_info.resolution = 100; /* 10 ms */ - time_unit = (ErtsMonotonicTime) 1000; - time_unit <<= ERTS_GET_TICK_COUNT_TIME_UNIT_SHIFT; - internal_state.r.o.using_get_tick_count_time_unit = 1; - os_mtime_func = os_monotonic_time_gtc32; - os_times_func = os_times_gtc32; - init_resp->os_monotonic_time_info.extended = 1; - erts_init_os_monotonic_time_extender(&internal_state.wr.m.os_mtime_xtnd, - get_tick_count, - 60*60*24*7); /* Check once a week */ - if (!sys_hrtime_func) - sys_hrtime_func = sys_hrtime_gtc32; - } - else { - int major, minor, build; - - os_version(&major, &minor, &build); - - if (major < 6) { - - get_tick_count64: - - internal_state.r.o.pGetTickCount64 - = ((ULONGLONG (WINAPI *)(void)) - GetProcAddress(module, "GetTickCount64")); - if (!internal_state.r.o.pGetTickCount64) - goto get_tick_count; - - init_resp->os_monotonic_time_info.func = "GetTickCount64"; - init_resp->os_monotonic_time_info.locked_use = 0; - /* 10-16 ms resolution according to MicroSoft documentation */ - init_resp->os_monotonic_time_info.resolution = 100; /* 10 ms */ - time_unit = (ErtsMonotonicTime) 1000; - time_unit <<= ERTS_GET_TICK_COUNT_TIME_UNIT_SHIFT; - internal_state.r.o.using_get_tick_count_time_unit = 1; - os_mtime_func = os_monotonic_time_gtc64; - os_times_func = os_times_gtc64; - if (!sys_hrtime_func) - sys_hrtime_func = sys_hrtime_gtc64; - } - else { /* Vista or newer... */ - - LARGE_INTEGER pf; - BOOL (WINAPI *QPF)(LARGE_INTEGER *); - - QPF = ((BOOL (WINAPI *)(LARGE_INTEGER *)) - GetProcAddress(module, "QueryPerformanceFrequency")); - if (!QPF) - goto get_tick_count64; - if (!(*QPF)(&pf)) - goto get_tick_count64; - - internal_state.r.o.pQueryPerformanceCounter - = ((BOOL (WINAPI *)(LARGE_INTEGER *)) - GetProcAddress(module, "QueryPerformanceCounter")); - if (!internal_state.r.o.pQueryPerformanceCounter) - goto get_tick_count64; - - if (pf.QuadPart > (((LONGLONG) 1) << 32)) - goto get_tick_count64; - - internal_state.r.o.pcf = (Uint32) pf.QuadPart; - sys_hrtime_func = sys_hrtime_qpc; - - /* - * We only use QueryPerformanceCounter() for - * os-monotonic-time if its frequency is equal - * to, or larger than GHz in order to ensure - * that the user wont be able to observe faulty - * order between values retrieved on different threads. - */ - if (pf.QuadPart < (LONGLONG) 1000*1000*1000) - goto get_tick_count64; - - if (ERTS_DISABLE_USE_OF_QPC_FOR_MONOTONIC_TIME) - goto get_tick_count64; - - init_resp->os_monotonic_time_info.func = "QueryPerformanceCounter"; - init_resp->os_monotonic_time_info.locked_use = 0; - time_unit = (ErtsMonotonicTime) pf.QuadPart; - internal_state.r.o.using_get_tick_count_time_unit = 0; - init_resp->os_monotonic_time_info.resolution = time_unit; - os_mtime_func = os_monotonic_time_qpc; - os_times_func = os_times_qpc; - } - } - - erts_sys_time_data__.r.o.os_monotonic_time = os_mtime_func; - erts_sys_time_data__.r.o.os_times = os_times_func; - init_resp->os_monotonic_time_unit = time_unit; - init_resp->have_os_monotonic_time = 1; - init_resp->have_corrected_os_monotonic_time = 0; - init_resp->sys_clock_resolution = 1; - - init_resp->os_system_time_info.func = "GetSystemTime"; - init_resp->os_system_time_info.clock_id = NULL; - init_resp->os_system_time_info.resolution = 100; - init_resp->os_system_time_info.locked_use = 0; + pGetTickCount64 = (module != NULL) ? + (ULONGLONG (WINAPI *)(void)) + GetProcAddress(module,"GetTickCount64") : + NULL; if(GetTimeZoneInformation(&static_tzi) && static_tzi.StandardDate.wMonth != 0 && static_tzi.DaylightDate.wMonth != 0) { have_static_tzi = 1; } -} -void -erts_late_sys_init_time(void) -{ - if (erts_sys_time_data__.r.o.os_monotonic_time == os_monotonic_time_gtc32) - erts_late_init_os_monotonic_time_extender(&internal_state.wr.m.os_mtime_xtnd); + erts_smp_mtx_init(&wrap_lock, "sys_gethrtime"); + + return 1; } /* Returns a switchtimes for DST as UTC filetimes given data from a @@ -699,27 +377,41 @@ EPOCH_JULIAN_DIFF); } -ErtsSystemTime -erts_os_system_time(void) +extern int erts_initialized; +SysHrTime +sys_gethrtime(void) { - SYSTEMTIME st; - ErtsSystemTime stime; - - GetSystemTime(&st); - stime = SystemTime2MilliSec(&st); - - if (internal_state.r.o.using_get_tick_count_time_unit) { - stime <<= ERTS_GET_TICK_COUNT_TIME_UNIT_SHIFT; - return stime; + if (pGetTickCount64 != NULL) { + return ((SysHrTime) pGetTickCount64()) * LL_LITERAL(1000000); + } else { + DWORD ticks; + SysHrTime res; + erts_smp_mtx_lock(&wrap_lock); + ticks = (SysHrTime) (GetTickCount() & 0x7FFFFFFF); + if (ticks < (SysHrTime) last_tick_count) { + /* Detect a race that should no longer be here... */ + if ((((SysHrTime) last_tick_count) - ((SysHrTime) ticks)) > 1000) { + wrap += LL_LITERAL(1) << 31; + } else { + /* + * XXX Debug: Violates locking order, remove all this, + * after testing! + */ + erts_dsprintf_buf_t *dsbufp = erts_create_logger_dsbuf(); + erts_dsprintf(dsbufp, "Did not wrap when last_tick %d " + "and tick %d", + last_tick_count, ticks); + erts_send_error_to_logger_nogl(dsbufp); + ticks = last_tick_count; + } + } + last_tick_count = ticks; + res = ((((LONGLONG) ticks) + wrap) * LL_LITERAL(1000000)); + erts_smp_mtx_unlock(&wrap_lock); + return res; } - - return ((ErtsSystemTime) - erts_time_unit_conversion((Uint64) stime, - (Uint32) 1000, - internal_state.r.o.pcf)); } - clock_t sys_times(SysTimes *buffer) { clock_t kernel_ticks = (GetTickCount() / diff -Nru erlang-18.2-dfsg/erts/emulator/test/after_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/after_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/after_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/after_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -28,8 +27,7 @@ init_per_group/2,end_per_group/2, t_after/1, receive_after/1, receive_after_big/1, receive_after_errors/1, receive_var_zero/1, receive_zero/1, - multi_timeout/1, receive_after_32bit/1, - receive_after_blast/1]). + multi_timeout/1, receive_after_32bit/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -42,7 +40,7 @@ all() -> [t_after, receive_after, receive_after_big, receive_after_errors, receive_var_zero, receive_zero, - multi_timeout, receive_after_32bit, receive_after_blast]. + multi_timeout, receive_after_32bit]. groups() -> []. @@ -72,23 +70,30 @@ t_after(Config) when is_list(Config) -> ?line spawn(fun frequent_process/0), ?line Period = test_server:minutes(1), - ?line Before = erlang:monotonic_time(), + ?line Before = erlang:now(), receive after Period -> - ?line After = erlang:monotonic_time(), + ?line After = erlang:now(), ?line report(Period, Before, After) end. + report(Period, Before, After) -> - case erlang:convert_time_unit(After - Before, native, 100*1000) / Period of - Percent when Percent > 100.10 -> - test_server:fail({too_inaccurate, Percent}); - Percent when Percent < 100.0 -> - test_server:fail({too_early, Percent}); - Percent -> - Comment = io_lib:format("Elapsed/expected: ~.2f %", [Percent]), - {comment, lists:flatten(Comment)} - end. + ?line Elapsed = (element(1, After)*1000000000 + +element(2, After)*1000 + +element(3, After) div 1000) - + (element(1,Before)*1000000000 + + element(2,Before)*1000 + element(3,Before) div 1000), + ?line case Elapsed*100 / Period of + Percent when Percent > 100.10 -> + ?line test_server:fail({too_inaccurate, Percent}); + Percent when Percent < 100.0 -> + ?line test_server:fail({too_early, Percent}); + Percent -> + ?line Comment = io_lib:format("Elapsed/expected: ~.2f %", + [Percent]), + {comment, lists:flatten(Comment)} + end. frequent_process() -> receive @@ -246,26 +251,4 @@ receive after T -> exit(timeout) end; recv_after_32bit(_, _) -> receive after 16#ffffFFFF -> exit(timeout) end. - -blaster() -> - receive - {go, TimeoutTime} -> - Tmo = TimeoutTime - erlang:monotonic_time(milli_seconds), - receive after Tmo -> ok end - end. - -spawn_blasters(0) -> - []; -spawn_blasters(N) -> - [spawn_monitor(fun () -> blaster() end)|spawn_blasters(N-1)]. - -receive_after_blast(Config) when is_list(Config) -> - PMs = spawn_blasters(10000), - TimeoutTime = erlang:monotonic_time(milli_seconds) + 5000, - lists:foreach(fun ({P, _}) -> P ! {go, TimeoutTime} end, PMs), - lists:foreach(fun ({P, M}) -> - receive - {'DOWN', M, process, P, normal} -> - ok - end - end, PMs). + diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/allocator_test.h erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/allocator_test.h --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/allocator_test.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/allocator_test.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -20,20 +19,9 @@ #ifndef ALLOCATOR_TEST_H__ #define ALLOCATOR_TEST_H__ -#if SIZEOF_VOID_P == SIZEOF_INT -typedef unsigned int Ulong; -#elif SIZEOF_VOID_P == SIZEOF_LONG -typedef unsigned long Ulong; -#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG -typedef unsigned long long Ulong; -#else -# error No pointer sized integer type found ??? -#endif +typedef ErlDrvUInt Ulong; -#ifdef __WIN32__ -typedef Ulong erts_alc_test_Fn(Ulong, Ulong, Ulong, Ulong); -# define erts_alc_test ((erts_alc_test_Fn*)WinDynNifCallbacks.erts_alc_test) -#else +#ifndef __WIN32__ Ulong erts_alc_test(Ulong, Ulong, Ulong, Ulong); #endif @@ -96,7 +84,6 @@ #define CPOOL_DELETE(A,B) ((Carrier_t *) ALC_TEST2(0x022, (A), (B))) #define CPOOL_IS_EMPTY(A) ((int) ALC_TEST1(0x023, (A))) #define CPOOL_IS_IN_POOL(A,B) ((int) ALC_TEST2(0x024, (A), (B))) -#define UMEM2BLK_TEST(P) ((Block_t*) ALC_TEST1(0x025, (P))) /* From erl_goodfit_alloc.c */ #define BKT_IX(A, S) ((Ulong) ALC_TEST2(0x100, (A), (S))) @@ -154,9 +141,5 @@ #define THR_JOIN(T) ((void) ALC_TEST1(0xf11, (T))) #define THR_EXIT(R) ((void) ALC_TEST1(0xf12, (R))) #define IS_SMP_ENABLED ((int) ALC_TEST0(0xf13)) -#define ALLOC_TEST(S) ((void*) ALC_TEST1(0xf14, (S))) -#define FREE_TEST(P) ((void) ALC_TEST1(0xf15, (P))) -#define SET_TEST_MBC_USER_HEADER(SZ,CMBC,DMBC) ((int)ALC_TEST3(0xf16, (SZ), (CMBC), (DMBC))) -#define GET_TEST_MBC_SIZE() ((int) ALC_TEST0(0xf17)) #endif diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/basic.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/basic.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/basic.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/basic.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -60,6 +59,3 @@ if (tcs->extra) STOP_ALC((Allctr_t *) tcs->extra); } - -ERL_NIF_INIT(basic, testcase_nif_funcs, testcase_nif_init, - NULL, NULL, NULL); diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/basic.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/basic.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/basic.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/basic.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ --module(basic). - --export([init/1, start/1, run/1, stop/1]). - -init(File) -> - ok = erlang:load_nif(File, 0). - -start(_) -> erlang:nif_error(not_loaded). -run(_) -> erlang:nif_error(not_loaded). -stop(_) -> erlang:nif_error(not_loaded). diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_index.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_index.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_index.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_index.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -113,5 +112,3 @@ sbct ? sbct_buf : "default"); } -ERL_NIF_INIT(bucket_index, testcase_nif_funcs, testcase_nif_init, - NULL, NULL, NULL); diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_index.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_index.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_index.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_index.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ --module(bucket_index). - --export([init/1, start/1, run/1, stop/1]). - -init(File) -> - ok = erlang:load_nif(File, 0). - -start(_) -> erlang:nif_error(not_loaded). -run(_) -> erlang:nif_error(not_loaded). -stop(_) -> erlang:nif_error(not_loaded). diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_mask.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_mask.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_mask.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_mask.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -52,7 +51,7 @@ typedef struct linked_block { struct linked_block* next; }Linked; - Linked* link = NULL; + Linked* link; Linked* fence_list; Linked* pad_list; void* tmp; @@ -183,5 +182,3 @@ tcs->extra = NULL; } -ERL_NIF_INIT(bucket_mask, testcase_nif_funcs, testcase_nif_init, - NULL, NULL, NULL); diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_mask.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_mask.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_mask.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/bucket_mask.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ --module(bucket_mask). - --export([init/1, start/1, run/1, stop/1]). - -init(File) -> - ok = erlang:load_nif(File, 0). - -start(_) -> erlang:nif_error(not_loaded). -run(_) -> erlang:nif_error(not_loaded). -stop(_) -> erlang:nif_error(not_loaded). diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/coalesce.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/coalesce.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/coalesce.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/coalesce.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -317,6 +316,3 @@ if (tcs->extra) STOP_ALC((Allctr_t *) tcs->extra); } - -ERL_NIF_INIT(coalesce, testcase_nif_funcs, testcase_nif_init, - NULL, NULL, NULL); diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/coalesce.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/coalesce.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/coalesce.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/coalesce.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ --module(coalesce). - --export([init/1, start/1, run/1, stop/1]). - -init(File) -> - ok = erlang:load_nif(File, 0). - -start(_) -> erlang:nif_error(not_loaded). -run(_) -> erlang:nif_error(not_loaded). -stop(_) -> erlang:nif_error(not_loaded). diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/cpool.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/cpool.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/cpool.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/cpool.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -86,13 +85,13 @@ for (i = 0; i < (TEST_NO_CARRIERS_PER_THREAD+TEST_CARRIERS_OFFSET); i++) { int d; if (i < TEST_NO_CARRIERS_PER_THREAD) { - (void) CPOOL_INSERT(alloc, crr[i]); + CPOOL_INSERT(alloc, crr[i]); if ((i & 0x7) == 0) FATAL_ASSERT(CPOOL_IS_IN_POOL(alloc, crr[i])); } d = i-TEST_CARRIERS_OFFSET; if (d >= 0) { - (void) CPOOL_DELETE(alloc, crr[d]); + CPOOL_DELETE(alloc, crr[d]); if ((d & 0x7) == 0) FATAL_ASSERT(!CPOOL_IS_IN_POOL(alloc, crr[d])); } @@ -129,7 +128,7 @@ for (c = 0; c < TEST_NO_CARRIERS_PER_THREAD; c++) { Carrier_t *crr = (Carrier_t *) p; p += zcrr_sz; - (void) ZERO_CRR_INIT(alloc, crr); + ZERO_CRR_INIT(alloc, crr); threads[t].crr[c] = crr; } } @@ -156,6 +155,3 @@ ASSERT(tcs, no_threads == TEST_NO_THREADS); } - -ERL_NIF_INIT(cpool, testcase_nif_funcs, testcase_nif_init, - NULL, NULL, NULL); diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/cpool.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/cpool.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/cpool.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/cpool.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ --module(cpool). - --export([init/1, start/1, run/1, stop/1]). - -init(File) -> - ok = erlang:load_nif(File, 0). - -start(_) -> erlang:nif_error(not_loaded). -run(_) -> erlang:nif_error(not_loaded). -stop(_) -> erlang:nif_error(not_loaded). diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/Makefile.src erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/Makefile.src --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -25,8 +24,7 @@ bucket_mask@dll@ \ rbtree@dll@ \ mseg_clear_cache@dll@ \ - cpool@dll@ \ - migration@dll@ + cpool@dll@ CC = @CC@ LD = @LD@ diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/migration.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/migration.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/migration.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/migration.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,343 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2014. All Rights Reserved. - * - * The contents of this file are subject to the Erlang Public License, - * Version 1.1, (the "License"); you may not use this file except in - * compliance with the License. You should have received a copy of the - * Erlang Public License along with this software. If not, it can be - * retrieved online at http://www.erlang.org/. - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and limitations - * under the License. - * - * %CopyrightEnd% - */ - -/* - * Test the carrier migration logic - */ - -#ifndef __WIN32__ -#include -#include -#include -#endif -#include -#include -#include -#include -#include "testcase_driver.h" -#include "allocator_test.h" - -#define FATAL_ASSERT(A) \ - ((void) ((A) \ - ? 1 \ - : (fatal_assert_failed(#A, \ - (char *) __FILE__, \ - __LINE__), \ - 0))) - -static void -fatal_assert_failed(char* expr, char* file, int line) -{ - fflush(stdout); - fprintf(stderr, "%s:%d: Assertion failed: %s\n", - file, line, expr); - fflush(stderr); - abort(); -} - - -char * -testcase_name(void) -{ - return "migration"; -} - -/* Turns out random_r() is a nonstandard glibc extension. -#define HAVE_RANDOM_R -*/ -#ifdef HAVE_RANDOM_R - -typedef struct { struct random_data rnd; char rndbuf[32]; } MyRandState; - -static void myrand_init(MyRandState* mrs, unsigned int seed) -{ - int res; - memset(&mrs->rnd, 0, sizeof(mrs->rnd)); - res = initstate_r(seed, mrs->rndbuf, sizeof(mrs->rndbuf), &mrs->rnd); - FATAL_ASSERT(res == 0); -} - -static int myrand(MyRandState* mrs) -{ - int32_t x; - int res = random_r(&mrs->rnd, &x); - FATAL_ASSERT(res == 0); - return (int)x; -} - -#else /* !HAVE_RANDOM_R */ - -typedef unsigned int MyRandState; - -static void myrand_init(MyRandState* mrs, unsigned int seed) -{ - *mrs = seed; -} - -static int myrand(MyRandState* mrs) -{ - /* Taken from rand(3) man page. - * Modified to return a full 31-bit value by using low half of *mrs as well. - */ - *mrs = (*mrs) * 1103515245 + 12345; - return (int) (((*mrs >> 16) | (*mrs << 16)) & ~(1 << 31)); -} - -#endif /* !HAVE_RANDOM_R */ - -#define MAX_BLOCK_PER_THR 200 -#define BLOCKS_PER_MBC 10 -#define MAX_ROUNDS 10000 - -typedef struct MyBlock_ { - struct MyBlock_* next; - struct MyBlock_** prevp; -} MyBlock; - -typedef struct { - MyBlock* blockv[MAX_BLOCK_PER_THR]; - MyRandState rand_state; - enum { GROWING, SHRINKING, CLEANUP, DONE } phase; - int nblocks; - int goal_nblocks; - int round; - int nr_of_migrations; - int nr_of_carriers; - int max_blocks_in_mbc; - int block_size; - int max_nblocks; -} MigrationState; - -typedef struct { - ErlNifMutex* mtx; - int nblocks; - MyBlock* first; - MigrationState* employer; -} MyCrrInfo; - - -static int crr_info_offset = -1; -static void (*orig_create_mbc_fn)(Allctr_t *allctr, Carrier_t *carrier); -static void (*orig_destroying_mbc_fn)(Allctr_t *allctr, Carrier_t *carrier); - -static void my_creating_mbc(Allctr_t *allctr, Carrier_t *carrier) -{ - MyCrrInfo* mci = (MyCrrInfo*) ((char*)carrier + crr_info_offset); - if (orig_create_mbc_fn) - orig_create_mbc_fn(allctr, carrier); - - mci->mtx = enif_mutex_create("alloc_SUITE.migration"); - mci->nblocks = 0; - mci->first = NULL; - mci->employer = NULL; -} - -static void my_destroying_mbc(Allctr_t *allctr, Carrier_t *carrier) -{ - MyCrrInfo* mci = (MyCrrInfo*) ((char*)carrier + crr_info_offset); - - FATAL_ASSERT(mci->nblocks == 0); - FATAL_ASSERT(mci->first == NULL); - enif_mutex_destroy(mci->mtx); - - if (orig_destroying_mbc_fn) - orig_destroying_mbc_fn(allctr, carrier); -} - -static int migration_init(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info) -{ - void* creating_mbc_arg = (void*)my_creating_mbc; - void* destroying_mbc_arg = (void*)my_destroying_mbc; - - if (testcase_nif_init(env, priv_data, load_info)) - return -1; - - crr_info_offset = SET_TEST_MBC_USER_HEADER(sizeof(MyCrrInfo), - &creating_mbc_arg, - &destroying_mbc_arg); - FATAL_ASSERT(crr_info_offset >= 0); - orig_create_mbc_fn = creating_mbc_arg; - orig_destroying_mbc_fn = destroying_mbc_arg; - - return 0; -} - -static void add_block(MyBlock* p, MigrationState* state) -{ - MyCrrInfo* mci = (MyCrrInfo*)((char*)BLK_TO_MBC(UMEM2BLK_TEST(p)) + crr_info_offset); - - enif_mutex_lock(mci->mtx); - if (++mci->nblocks > state->max_blocks_in_mbc) - state->max_blocks_in_mbc = mci->nblocks; - p->next = mci->first; - p->prevp = &mci->first; - mci->first = p; - if (p->next) - p->next->prevp = &p->next; - if (mci->employer != state) { - if (!mci->employer) { - FATAL_ASSERT(mci->nblocks == 1); - state->nr_of_carriers++; - } - else { - state->nr_of_migrations++; - } - mci->employer = state; - } - enif_mutex_unlock(mci->mtx); -} - -static void remove_block(MyBlock* p) -{ - MyCrrInfo* mci = (MyCrrInfo*)((char*)BLK_TO_MBC(UMEM2BLK_TEST(p)) + crr_info_offset); - - enif_mutex_lock(mci->mtx); - mci->nblocks--; - if (p->next) - p->next->prevp = p->prevp; - *p->prevp = p->next; - enif_mutex_unlock(mci->mtx); -} - -static int rand_int(MigrationState* state, int low, int high) -{ - int x; - FATAL_ASSERT(high >= low); - x = myrand(&state->rand_state); - return low + (x % (high+1-low)); -} - - -static void do_cleanup(TestCaseState_t *tcs, MigrationState* state) -{ - if (state->nblocks == 0) { - state->phase = DONE; - testcase_printf(tcs, "%d: Done %d rounds", tcs->thr_nr, state->round); - testcase_printf(tcs, "%d: Cleanup all blocks", tcs->thr_nr); - testcase_printf(tcs, "%d: Empty carriers detected = %d", tcs->thr_nr, - state->nr_of_carriers); - testcase_printf(tcs, "%d: Migrations detected = %d", tcs->thr_nr, - state->nr_of_migrations); - testcase_printf(tcs, "%d: Max blocks in carrier = %d", tcs->thr_nr, - state->max_blocks_in_mbc); - } - else { - state->nblocks--; - if (state->blockv[state->nblocks]) { - remove_block(state->blockv[state->nblocks]); - FREE_TEST(state->blockv[state->nblocks]); - } - } -} - - -void -testcase_run(TestCaseState_t *tcs) -{ - MigrationState* state = (MigrationState*) tcs->extra; - - if (!tcs->extra) { - if (!IS_SMP_ENABLED) - testcase_skipped(tcs, "No SMP support"); - - tcs->extra = enif_alloc(sizeof(MigrationState)); - state = (MigrationState*) tcs->extra; - memset(state->blockv, 0, sizeof(state->blockv)); - myrand_init(&state->rand_state, tcs->thr_nr); - state->phase = GROWING; - state->nblocks = 0; - state->round = 0; - state->nr_of_migrations = 0; - state->nr_of_carriers = 0; - state->max_blocks_in_mbc = 0; - state->block_size = GET_TEST_MBC_SIZE() / (BLOCKS_PER_MBC+1); - if (MAX_BLOCK_PER_THR * state->block_size < tcs->free_mem) { - state->max_nblocks = MAX_BLOCK_PER_THR; - } else { - state->max_nblocks = tcs->free_mem / state->block_size; - } - state->goal_nblocks = rand_int(state, 1, state->max_nblocks); - } - - switch (state->phase) { - case GROWING: { - MyBlock* p; - FATAL_ASSERT(!state->blockv[state->nblocks]); - p = ALLOC_TEST(rand_int(state, state->block_size/2, state->block_size)); - FATAL_ASSERT(p); - add_block(p, state); - state->blockv[state->nblocks] = p; - if (++state->nblocks >= state->goal_nblocks) { - /*testcase_printf(tcs, "%d: Grown to %d blocks", tcs->thr_nr, state->nblocks);*/ - state->phase = SHRINKING; - state->goal_nblocks = rand_int(state, 0, state->goal_nblocks-1); - } - else - FATAL_ASSERT(!state->blockv[state->nblocks]); - break; - } - case SHRINKING: { - int ix = rand_int(state, 0, state->nblocks-1); - FATAL_ASSERT(state->blockv[ix]); - remove_block(state->blockv[ix]); - FREE_TEST(state->blockv[ix]); - state->blockv[ix] = state->blockv[--state->nblocks]; - state->blockv[state->nblocks] = NULL; - - if (state->nblocks <= state->goal_nblocks) { - /*testcase_printf(tcs, "%d: Shrunk to %d blocks", tcs->thr_nr, state->nblocks);*/ - if (++state->round >= MAX_ROUNDS) { - state->phase = CLEANUP; - } else { - state->phase = GROWING; - state->goal_nblocks = rand_int(state, state->goal_nblocks+1, state->max_nblocks); - } - } - break; - } - case CLEANUP: - do_cleanup(tcs, state); - break; - - default: - FATAL_ASSERT(!"Invalid phase"); - } - - if (state->phase == DONE) { - } - else { - testcase_continue(tcs); - } -} - -void -testcase_cleanup(TestCaseState_t *tcs) -{ - MigrationState* state = (MigrationState*) tcs->extra; - - while (state->phase != DONE) - do_cleanup(tcs, state); - - enif_free(tcs->extra); - tcs->extra = NULL; -} - - -ERL_NIF_INIT(migration, testcase_nif_funcs, migration_init, - NULL, NULL, NULL); diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/migration.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/migration.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/migration.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/migration.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ --module(migration). - --export([init/1, start/1, run/1, stop/1]). - -init(File) -> - ok = erlang:load_nif(File, 0). - -start(_) -> erlang:nif_error(not_loaded). -run(_) -> erlang:nif_error(not_loaded). -stop(_) -> erlang:nif_error(not_loaded). diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/mseg_clear_cache.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/mseg_clear_cache.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/mseg_clear_cache.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/mseg_clear_cache.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -101,6 +100,3 @@ tcs->extra = NULL; } } - -ERL_NIF_INIT(mseg_clear_cache, testcase_nif_funcs, testcase_nif_init, - NULL, NULL, NULL); diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/mseg_clear_cache.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/mseg_clear_cache.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/mseg_clear_cache.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/mseg_clear_cache.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ --module(mseg_clear_cache). - --export([init/1, start/1, run/1, stop/1]). - -init(File) -> - ok = erlang:load_nif(File, 0). - -start(_) -> erlang:nif_error(not_loaded). -run(_) -> erlang:nif_error(not_loaded). -stop(_) -> erlang:nif_error(not_loaded). diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/rbtree.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/rbtree.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/rbtree.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/rbtree.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -20,7 +19,7 @@ #include "testcase_driver.h" #include "allocator_test.h" -int NO_BLOCKS; +#define NO_BLOCKS 100000 #define RIGHT_VISITED (1 << 0) #define LEFT_VISITED (1 << 1) @@ -265,10 +264,9 @@ ASSERT(tcs, curr_blacks == 0); ASSERT(tcs, i == -1); - /* testcase_printf(tcs, "Red-Black Tree OK! Max depth = %d; " "Black depth = %d\n", max_i+1, blacks < 0 ? 0 : blacks); - */ + return res; } @@ -469,12 +467,6 @@ Allctr_t *a; rbtree_test_data *td; - NO_BLOCKS = 100*1000; - if (enif_is_identical(tcs->build_type, - enif_make_atom(tcs->curr_env,"valgrind"))) { - NO_BLOCKS /= 10; - } - /* Best fit... */ testcase_printf(tcs, "Setup...\n"); @@ -584,6 +576,3 @@ testcase_printf(tcs, "aoffcaobf test succeeded!\n"); } - -ERL_NIF_INIT(rbtree, testcase_nif_funcs, testcase_nif_init, - NULL, NULL, NULL); diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/rbtree.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/rbtree.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/rbtree.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/rbtree.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ --module(rbtree). - --export([init/1, start/1, run/1, stop/1]). - -init(File) -> - ok = erlang:load_nif(File, 0). - -start(_) -> erlang:nif_error(not_loaded). -run(_) -> erlang:nif_error(not_loaded). -stop(_) -> erlang:nif_error(not_loaded). diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/realloc_copy.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/realloc_copy.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/realloc_copy.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/realloc_copy.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -278,5 +277,3 @@ STOP_ALC((Allctr_t *) tcs->extra); } -ERL_NIF_INIT(realloc_copy, testcase_nif_funcs, testcase_nif_init, - NULL, NULL, NULL); diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/realloc_copy.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/realloc_copy.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/realloc_copy.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/realloc_copy.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ --module(realloc_copy). - --export([init/1, start/1, run/1, stop/1]). - -init(File) -> - ok = erlang:load_nif(File, 0). - -start(_) -> erlang:nif_error(not_loaded). -run(_) -> erlang:nif_error(not_loaded). -stop(_) -> erlang:nif_error(not_loaded). diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/testcase_driver.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/testcase_driver.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/testcase_driver.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/testcase_driver.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -23,147 +22,141 @@ #include #include #include -#include #ifdef __WIN32__ -static void my_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) -{ - _vsnprintf(outBuf, size, format, ap); - outBuf[size-1] = 0; /* be sure string is terminated */ -} -#elif defined(HAVE_VSNPRINTF) -# define my_vsnprintf(B,S,F,A) (void)vsnprintf(B,S,F,A) -#else -# warning Using unsafe 'vsprintf' without buffer overflow protection -# define my_vsnprintf(B,S,F,A) (void)vsprintf(B,F,A) +#undef HAVE_VSNPRINTF +#define HAVE_VSNPRINTF 1 +#define vsnprintf _vsnprintf #endif -static void my_snprintf(char *outBuf, size_t size, const char *format, ...) -{ - va_list ap; - va_start(ap, format); - my_vsnprintf(outBuf, size, format, ap); - va_end(ap); -} +#ifndef HAVE_VSNPRINTF +#define HAVE_VSNPRINTF 0 +#endif #define COMMENT_BUF_SZ 4096 #define TESTCASE_FAILED 0 #define TESTCASE_SKIPPED 1 #define TESTCASE_SUCCEEDED 2 -#define TESTCASE_CONTINUE 3 typedef struct { TestCaseState_t visible; + ErlDrvPort port; + ErlDrvTermData port_id; int result; - jmp_buf* done_jmp_buf; + jmp_buf done_jmp_buf; char *comment; char comment_buf[COMMENT_BUF_SZ]; } InternalTestCaseState_t; -ERL_NIF_TERM testcase_nif_start(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); -ERL_NIF_TERM testcase_nif_stop(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); -ERL_NIF_TERM testcase_nif_run(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); - -ErlNifFunc testcase_nif_funcs[] = -{ - {"start", 1, testcase_nif_start}, - {"run", 1, testcase_nif_run}, - {"stop", 1, testcase_nif_stop} +ErlDrvData testcase_drv_start(ErlDrvPort port, char *command); +void testcase_drv_stop(ErlDrvData drv_data); +void testcase_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len); + +static ErlDrvEntry testcase_drv_entry = { + NULL, + testcase_drv_start, + testcase_drv_stop, + testcase_drv_run, + NULL, + NULL, + "testcase_drv", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + ERL_DRV_EXTENDED_MARKER, + ERL_DRV_EXTENDED_MAJOR_VERSION, + ERL_DRV_EXTENDED_MINOR_VERSION, + 0, + NULL, + NULL, + NULL }; -static ErlNifResourceType* testcase_rt; -static ERL_NIF_TERM print_atom; -int testcase_nif_init(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info) +DRIVER_INIT(testcase_drv) { - testcase_rt = enif_open_resource_type(env, NULL, "testcase_rt", NULL, - ERL_NIF_RT_CREATE, NULL); - - print_atom = enif_make_atom(env, "print"); - return 0; + testcase_drv_entry.driver_name = testcase_name(); + return &testcase_drv_entry; } -ERL_NIF_TERM -testcase_nif_start(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) -{ /* (ThrNr, FreeMeg, BuildType) */ - ERL_NIF_TERM ret; +ErlDrvData +testcase_drv_start(ErlDrvPort port, char *command) +{ InternalTestCaseState_t *itcs = (InternalTestCaseState_t *) - enif_alloc_resource(testcase_rt, sizeof(InternalTestCaseState_t)); - int free_megabyte; - const int max_megabyte = INT_MAX / (1024*1024); - const ERL_NIF_TERM* tpl; - int tpl_arity; - - if (!itcs - || !enif_get_tuple(env, argv[0], &tpl_arity, &tpl) - || tpl_arity != 3 - || !enif_get_int(env, tpl[0], &itcs->visible.thr_nr) - || !enif_get_int(env, tpl[1], &free_megabyte)) { - enif_make_badarg(env); + driver_alloc(sizeof(InternalTestCaseState_t)); + if (!itcs) { + return ERL_DRV_ERROR_GENERAL; } - itcs->visible.free_mem = (free_megabyte < max_megabyte ? - free_megabyte : max_megabyte) * (1024*1024); + itcs->visible.testcase_name = testcase_name(); - itcs->visible.build_type = tpl[2]; itcs->visible.extra = NULL; + itcs->port = port; + itcs->port_id = driver_mk_port(port); itcs->result = TESTCASE_FAILED; itcs->comment = ""; - ret = enif_make_resource(env, itcs); - enif_release_resource(itcs); - return ret; + return (ErlDrvData) itcs; } -ERL_NIF_TERM -testcase_nif_stop(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +void +testcase_drv_stop(ErlDrvData drv_data) { - InternalTestCaseState_t *itcs; - if (!enif_get_resource(env, argv[0], testcase_rt, (void**)&itcs)) - return enif_make_badarg(env); - testcase_cleanup(&itcs->visible); - return enif_make_atom(env,"ok"); + testcase_cleanup((TestCaseState_t *) drv_data); + driver_free((void *) drv_data); } -ERL_NIF_TERM -testcase_nif_run(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +void +testcase_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) { - InternalTestCaseState_t *itcs; - const char* result_atom; - jmp_buf the_jmp_buf; - - if (!enif_get_resource(env, argv[0], testcase_rt, (void**)&itcs)) - return enif_make_badarg(env); + InternalTestCaseState_t *itcs = (InternalTestCaseState_t *) drv_data; + ErlDrvTermData result_atom; + ErlDrvTermData msg[12]; - itcs->visible.curr_env = env; + itcs->visible.command = buf; + itcs->visible.command_len = len; - /* For some unknown reason, first call to setjmp crashes on win64 - * when jmp_buf is allocated as part of the resource. But it works when - * allocated on stack. It used to work when this was a driver. - */ - itcs->done_jmp_buf = &the_jmp_buf; - - if (setjmp(the_jmp_buf) == 0) { - testcase_run(&itcs->visible); + if (setjmp(itcs->done_jmp_buf) == 0) { + testcase_run((TestCaseState_t *) itcs); itcs->result = TESTCASE_SUCCEEDED; } switch (itcs->result) { - case TESTCASE_CONTINUE: - return enif_make_atom(env, "continue"); - - case TESTCASE_SUCCEEDED: result_atom = "succeeded"; break; - case TESTCASE_SKIPPED: result_atom = "skipped"; break; - case TESTCASE_FAILED: result_atom = "failed"; break; + case TESTCASE_SUCCEEDED: + result_atom = driver_mk_atom("succeeded"); + break; + case TESTCASE_SKIPPED: + result_atom = driver_mk_atom("skipped"); + break; + case TESTCASE_FAILED: default: - result_atom = "failed"; - my_snprintf(itcs->comment_buf, sizeof(itcs->comment_buf), - "Unexpected test result code %d.", itcs->result); - itcs->comment = itcs->comment_buf; + result_atom = driver_mk_atom("failed"); + break; } - return enif_make_tuple2(env, enif_make_atom(env, result_atom), - enif_make_string(env, itcs->comment, ERL_NIF_LATIN1)); + msg[0] = ERL_DRV_ATOM; + msg[1] = (ErlDrvTermData) result_atom; + + msg[2] = ERL_DRV_PORT; + msg[3] = itcs->port_id; + + msg[4] = ERL_DRV_ATOM; + msg[5] = driver_mk_atom(itcs->visible.testcase_name); + + msg[6] = ERL_DRV_STRING; + msg[7] = (ErlDrvTermData) itcs->comment; + msg[8] = (ErlDrvTermData) strlen(itcs->comment); + + msg[9] = ERL_DRV_TUPLE; + msg[10] = (ErlDrvTermData) 4; + + erl_drv_output_term(itcs->port_id, msg, 11); } int @@ -178,22 +171,34 @@ void testcase_printf(TestCaseState_t *tcs, char *frmt, ...) { - InternalTestCaseState_t* itcs = (InternalTestCaseState_t*)tcs; - ErlNifPid pid; - ErlNifEnv* msg_env = enif_alloc_env(); - ERL_NIF_TERM msg; + InternalTestCaseState_t *itcs = (InternalTestCaseState_t *) tcs; + ErlDrvTermData msg[12]; va_list va; va_start(va, frmt); - my_vsnprintf(itcs->comment_buf, COMMENT_BUF_SZ, frmt, va); +#if HAVE_VSNPRINTF + vsnprintf(itcs->comment_buf, COMMENT_BUF_SZ, frmt, va); +#else + vsprintf(itcs->comment_buf, frmt, va); +#endif va_end(va); - msg = enif_make_tuple2(msg_env, print_atom, - enif_make_string(msg_env, itcs->comment_buf, ERL_NIF_LATIN1)); + msg[0] = ERL_DRV_ATOM; + msg[1] = (ErlDrvTermData) driver_mk_atom("print"); - enif_send(itcs->visible.curr_env, enif_self(itcs->visible.curr_env, &pid), - msg_env, msg); + msg[2] = ERL_DRV_PORT; + msg[3] = itcs->port_id; - enif_free_env(msg_env); + msg[4] = ERL_DRV_ATOM; + msg[5] = driver_mk_atom(itcs->visible.testcase_name); + + msg[6] = ERL_DRV_STRING; + msg[7] = (ErlDrvTermData) itcs->comment_buf; + msg[8] = (ErlDrvTermData) strlen(itcs->comment_buf); + + msg[9] = ERL_DRV_TUPLE; + msg[10] = (ErlDrvTermData) 4; + + erl_drv_output_term(itcs->port_id, msg, 11); } @@ -202,13 +207,17 @@ InternalTestCaseState_t *itcs = (InternalTestCaseState_t *) tcs; va_list va; va_start(va, frmt); - my_vsnprintf(itcs->comment_buf, COMMENT_BUF_SZ, frmt, va); +#if HAVE_VSNPRINTF + vsnprintf(itcs->comment_buf, COMMENT_BUF_SZ, frmt, va); +#else + vsprintf(itcs->comment_buf, frmt, va); +#endif va_end(va); itcs->result = TESTCASE_SUCCEEDED; itcs->comment = itcs->comment_buf; - longjmp(*itcs->done_jmp_buf, 1); + longjmp(itcs->done_jmp_buf, 1); } void testcase_skipped(TestCaseState_t *tcs, char *frmt, ...) @@ -216,20 +225,17 @@ InternalTestCaseState_t *itcs = (InternalTestCaseState_t *) tcs; va_list va; va_start(va, frmt); - my_vsnprintf(itcs->comment_buf, COMMENT_BUF_SZ, frmt, va); +#if HAVE_VSNPRINTF + vsnprintf(itcs->comment_buf, COMMENT_BUF_SZ, frmt, va); +#else + vsprintf(itcs->comment_buf, frmt, va); +#endif va_end(va); itcs->result = TESTCASE_SKIPPED; itcs->comment = itcs->comment_buf; - longjmp(*itcs->done_jmp_buf, 1); -} - -void testcase_continue(TestCaseState_t *tcs) -{ - InternalTestCaseState_t *itcs = (InternalTestCaseState_t *) tcs; - itcs->result = TESTCASE_CONTINUE; - longjmp(*itcs->done_jmp_buf, 1); + longjmp(itcs->done_jmp_buf, 1); } void testcase_failed(TestCaseState_t *tcs, char *frmt, ...) @@ -239,33 +245,37 @@ size_t bufsz = sizeof(buf); va_list va; va_start(va, frmt); - my_vsnprintf(itcs->comment_buf, COMMENT_BUF_SZ, frmt, va); +#if HAVE_VSNPRINTF + vsnprintf(itcs->comment_buf, COMMENT_BUF_SZ, frmt, va); +#else + vsprintf(itcs->comment_buf, frmt, va); +#endif va_end(va); itcs->result = TESTCASE_FAILED; itcs->comment = itcs->comment_buf; - if (enif_getenv("ERL_ABORT_ON_FAILURE", buf, &bufsz) == 0 + if (erl_drv_getenv("ERL_ABORT_ON_FAILURE", buf, &bufsz) == 0 && strcmp("true", buf) == 0) { fprintf(stderr, "Testcase \"%s\" failed: %s\n", itcs->visible.testcase_name, itcs->comment); abort(); } - longjmp(*itcs->done_jmp_buf, 1); + longjmp(itcs->done_jmp_buf, 1); } void *testcase_alloc(size_t size) { - return enif_alloc(size); + return driver_alloc(size); } void *testcase_realloc(void *ptr, size_t size) { - return enif_realloc(ptr, size); + return driver_realloc(ptr, size); } void testcase_free(void *ptr) { - enif_free(ptr); + driver_free(ptr); } diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/testcase_driver.h erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/testcase_driver.h --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/testcase_driver.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/testcase_driver.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -20,15 +19,13 @@ #ifndef TESTCASE_DRIVER_H__ #define TESTCASE_DRIVER_H__ -#include "erl_nif.h" +#include "erl_driver.h" #include typedef struct { - ErlNifEnv* curr_env; char *testcase_name; - int thr_nr; - int free_mem; /* in bytes */ - ERL_NIF_TERM build_type; /* opt, debug, valgrind, ... */ + char *command; + int command_len; void *extra; } TestCaseState_t; @@ -36,11 +33,9 @@ ((void) ((B) ? 1 : testcase_assertion_failed((TCS), __FILE__, __LINE__, #B))) -int testcase_nif_init(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info); void testcase_printf(TestCaseState_t *tcs, char *frmt, ...); void testcase_succeeded(TestCaseState_t *tcs, char *frmt, ...); void testcase_skipped(TestCaseState_t *tcs, char *frmt, ...); -void testcase_continue(TestCaseState_t *tcs); void testcase_failed(TestCaseState_t *tcs, char *frmt, ...); int testcase_assertion_failed(TestCaseState_t *tcs, char *file, int line, char *assertion); @@ -49,11 +44,8 @@ void testcase_free(void *ptr); -/* Implemented by testcase: */ char *testcase_name(void); void testcase_run(TestCaseState_t *tcs); void testcase_cleanup(TestCaseState_t *tcs); -extern ErlNifFunc testcase_nif_funcs[3]; - -#endif /* TESTCASE_DRIVER_H__ */ +#endif diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/threads.c erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/threads.c --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/threads.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/threads.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -86,7 +85,7 @@ tc_failed = 1; - if (enif_getenv("ERL_ABORT_ON_FAILURE", buf, &bufsz) == 0 + if (erl_drv_getenv("ERL_ABORT_ON_FAILURE", buf, &bufsz) == 0 && strcmp("true", buf) == 0) { fprintf(stderr, "Testcase \"%s\" failed: %s\n", testcase_name(), err_buf); @@ -187,6 +186,7 @@ for(i = 1; i <= NO_OF_THREADS; i++) { char *alc; + int res; threads[i].arg.no_ops_per_bl = NO_OF_OPS_PER_BL; @@ -445,6 +445,3 @@ exit_thread(td->t_no, 1); return NULL; } - -ERL_NIF_INIT(threads, testcase_nif_funcs, testcase_nif_init, - NULL, NULL, NULL); diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/threads.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/threads.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE_data/threads.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE_data/threads.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ --module(threads). - --export([init/1, start/1, run/1, stop/1]). - -init(File) -> - ok = erlang:load_nif(File, 0). - -start(_) -> erlang:nif_error(not_loaded). -run(_) -> erlang:nif_error(not_loaded). -stop(_) -> erlang:nif_error(not_loaded). diff -Nru erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/alloc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/alloc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -31,8 +30,7 @@ rbtree/1, mseg_clear_cache/1, erts_mmap/1, - cpool/1, - migration/1]). + cpool/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -44,7 +42,7 @@ all() -> [basic, coalesce, threads, realloc_copy, bucket_index, - bucket_mask, rbtree, mseg_clear_cache, erts_mmap, cpool, migration]. + bucket_mask, rbtree, mseg_clear_cache, erts_mmap, cpool]. groups() -> []. @@ -65,7 +63,7 @@ init_per_testcase(Case, Config) when is_list(Config) -> Dog = ?t:timetrap(?t:seconds(?DEFAULT_TIMETRAP_SECS)), - [{watchdog, Dog}, {testcase, Case}, {debug,false} | Config]. + [{watchdog, Dog},{testcase, Case}|Config]. end_per_testcase(_Case, Config) when is_list(Config) -> Dog = ?config(watchdog, Config), @@ -113,14 +111,6 @@ cpool(doc) -> []; cpool(Cfg) -> ?line drv_case(Cfg). -migration(Cfg) -> - case erlang:system_info(smp_support) of - true -> - drv_case(Cfg, concurrent, "+MZe true"); - false -> - {skipped, "No smp"} - end. - erts_mmap(Config) when is_list(Config) -> case {?t:os_type(), is_halfword_vm()} of {{unix, _}, false} -> @@ -185,17 +175,18 @@ %% %% drv_case(Config) -> - drv_case(Config, one_shot, ""). + drv_case(Config, ""). -drv_case(Config, Mode, NodeOpts) when is_list(Config) -> +drv_case(Config, Command) when is_list(Config), + is_list(Command) -> case ?t:os_type() of {Family, _} when Family == unix; Family == win32 -> - ?line {ok, Node} = start_node(Config, NodeOpts), + ?line {ok, Node} = start_node(Config), ?line Self = self(), ?line Ref = make_ref(), ?line spawn_link(Node, fun () -> - Res = run_drv_case(Config, Mode), + Res = run_drv_case(Config, Command), Self ! {Ref, Res} end), ?line Result = receive {Ref, Rslt} -> Rslt end, @@ -207,183 +198,62 @@ | io_lib:format("~p",[SkipOs])])} end. -run_drv_case(Config, Mode) -> - DataDir = ?config(data_dir,Config), - CaseName = ?config(testcase,Config), - File = filename:join(DataDir, CaseName), - {ok,CaseName,Bin} = compile:file(File, [binary,return_errors]), - {module,CaseName} = erlang:load_module(CaseName,Bin), - print_stats(CaseName), - ok = CaseName:init(File), - - SlaveState = slave_init(CaseName), - case Mode of - one_shot -> - Result = one_shot(CaseName); - - concurrent -> - Result = concurrent(CaseName) +run_drv_case(Config, Command) -> + ?line DataDir = ?config(data_dir,Config), + ?line CaseName = ?config(testcase,Config), + case erl_ddll:load_driver(DataDir, CaseName) of + ok -> ok; + {error, Error} -> + io:format("~s\n", [erl_ddll:format_error(Error)]), + ?line ?t:fail() end, + ?line Port = open_port({spawn, atom_to_list(CaseName)}, []), + ?line true = is_port(Port), + ?line Port ! {self(), {command, Command}}, + ?line Result = receive_drv_result(Port, CaseName), + ?line Port ! {self(), close}, + ?line receive + {Port, closed} -> + ok + end, + ?line ok = erl_ddll:unload_driver(CaseName), + ?line Result. + +receive_drv_result(Port, CaseName) -> + ?line receive + {print, Port, CaseName, Str} -> + ?line ?t:format("~s", [Str]), + ?line receive_drv_result(Port, CaseName); + {'EXIT', Port, Error} -> + ?line ?t:fail(Error); + {'EXIT', error, Error} -> + ?line ?t:fail(Error); + {failed, Port, CaseName, Comment} -> + ?line ?t:fail(Comment); + {skipped, Port, CaseName, Comment} -> + ?line {skipped, Comment}; + {succeeded, Port, CaseName, ""} -> + ?line succeeded; + {succeeded, Port, CaseName, Comment} -> + ?line {comment, Comment} + end. - wait_for_memory_deallocations(), - print_stats(CaseName), - - true = erlang:delete_module(CaseName), - slave_end(SlaveState), - Result. - -slave_init(migration) -> - A0 = case application:start(sasl) of - ok -> [sasl]; - _ -> [] - end, - case application:start(os_mon) of - ok -> [os_mon|A0]; - _ -> A0 - end; -slave_init(_) -> []. - -slave_end(Apps) -> - lists:foreach(fun (A) -> application:stop(A) end, Apps). - -wait_for_memory_deallocations() -> - try - erts_debug:set_internal_state(wait, deallocations) - catch - error:undef -> - erts_debug:set_internal_state(available_internal_state, true), - wait_for_memory_deallocations() - end. - -print_stats(migration) -> - {Btot,Ctot} = lists:foldl(fun({instance,Inr,Istats}, {Bacc,Cacc}) -> - {mbcs,MBCS} = lists:keyfind(mbcs, 1, Istats), - Btup = lists:keyfind(blocks, 1, MBCS), - Ctup = lists:keyfind(carriers, 1, MBCS), - io:format("{instance,~p,~p,~p}\n", [Inr, Btup, Ctup]), - {tuple_add(Bacc,Btup),tuple_add(Cacc,Ctup)}; - (_, Acc) -> Acc - end, - {{blocks,0,0,0},{carriers,0,0,0}}, - erlang:system_info({allocator,test_alloc})), - - io:format("Number of blocks : ~p\n", [Btot]), - io:format("Number of carriers: ~p\n", [Ctot]); - -print_stats(_) -> ok. - -tuple_add(T1, T2) -> - list_to_tuple(lists:zipwith(fun(E1,E2) when is_number(E1), is_number(E2) -> - E1 + E2; - (A,A) -> - A - end, - tuple_to_list(T1), tuple_to_list(T2))). - - -one_shot(CaseName) -> - State = CaseName:start({1, 0, erlang:system_info(build_type)}), - Result0 = CaseName:run(State), - false = (Result0 =:= continue), - Result1 = handle_result(State, Result0), - CaseName:stop(State), - Result1. - - -many_shot(CaseName, I, Mem) -> - State = CaseName:start({I, Mem, erlang:system_info(build_type)}), - Result1 = repeat_while(fun() -> - Result0 = CaseName:run(State), - handle_result(State, Result0) - end, - 10*1000, I), - CaseName:stop(State), - flush_log(), - Result1. - -concurrent(CaseName) -> - NSched = erlang:system_info(schedulers), - Mem = (free_memory() * 3) div 4, - PRs = lists:map(fun(I) -> spawn_opt(fun() -> - many_shot(CaseName, I, - Mem div NSched) - end, - [monitor, {scheduler,I}]) - end, - lists:seq(1, NSched)), - lists:foreach(fun({Pid,Ref}) -> - receive {'DOWN', Ref, process, Pid, Reason} -> - Reason - end - end, - PRs), - ok. - -repeat_while(Fun, Timeout, I) -> - TRef = erlang:start_timer(Timeout, self(), timeout), - R = repeat_while_loop(Fun, TRef, I), - erlang:cancel_timer(TRef, [{async,true},{info,false}]), - R. - -repeat_while_loop(Fun, TRef, I) -> - receive - {timeout, TRef, timeout} -> - io:format("~p: Timeout, enough is enough.",[I]), - succeeded - after 0 -> - %%io:format("~p calls fun\n", [self()]), - case Fun() of - continue -> repeat_while_loop(Fun, TRef, I); - R -> R - end - end. - -flush_log() -> - receive - {print, Str} -> - ?t:format("~s", [Str]), - flush_log() - after 0 -> - ok - end. - -handle_result(_State, Result0) -> - flush_log(), - case Result0 of - {'EXIT', Error} -> - ?line ?t:fail(Error); - {'EXIT', error, Error} -> - ?line ?t:fail(Error); - {failed, Comment} -> - ?line ?t:fail(Comment); - {skipped, Comment} -> - ?line {skipped, Comment}; - {succeeded, ""} -> - ?line succeeded; - {succeeded, Comment} -> - ?line {comment, Comment}; - continue -> - continue - end. - +start_node(Config) -> + start_node(Config, []). start_node(Config, Opts) when is_list(Config), is_list(Opts) -> - case ?config(debug,Config) of - true -> {ok, node()}; - _ -> start_node_1(Config, Opts) - end. - -start_node_1(Config, Opts) -> - Pa = filename:dirname(code:which(?MODULE)), - Name = list_to_atom(atom_to_list(?MODULE) - ++ "-" - ++ atom_to_list(?config(testcase, Config)) - ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) - ++ "-" - ++ integer_to_list(erlang:unique_integer([positive]))), - ?t:start_node(Name, slave, [{args, Opts++" -pa "++Pa}]). + ?line Pa = filename:dirname(code:which(?MODULE)), + ?line {A, B, C} = now(), + ?line Name = list_to_atom(atom_to_list(?MODULE) + ++ "-" + ++ atom_to_list(?config(testcase, Config)) + ++ "-" + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) + ++ "-" + ++ integer_to_list(C)), + ?line ?t:start_node(Name, slave, [{args, Opts++" -pa "++Pa}]). -stop_node(Node) when Node =:= node() -> ok; stop_node(Node) -> ?t:stop_node(Node). @@ -393,23 +263,3 @@ {4, 8} -> true; {WS, WS} -> false end. - -free_memory() -> - %% Free memory in MB. - try - SMD = memsup:get_system_memory_data(), - {value, {free_memory, Free}} = lists:keysearch(free_memory, 1, SMD), - TotFree = (Free + - case lists:keysearch(cached_memory, 1, SMD) of - {value, {cached_memory, Cached}} -> Cached; - false -> 0 - end + - case lists:keysearch(buffered_memory, 1, SMD) of - {value, {buffered_memory, Buffed}} -> Buffed; - false -> 0 - end), - TotFree div (1024*1024) - catch - error : undef -> - ?t:fail({"os_mon not built"}) - end. diff -Nru erlang-18.2-dfsg/erts/emulator/test/a_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/a_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/a_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/a_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -98,13 +97,23 @@ catch erlang:display('--- CHECK IO INFO ---'), catch erlang:display(ChkIo), catch erts_debug:set_internal_state(available_internal_state, true), - NoOfErrorFds = (catch element(1, erts_debug:get_internal_state(check_io_debug))), + NoOfErrorFds = (catch erts_debug:get_internal_state(check_io_debug)), catch erlang:display({'NoOfErrorFds', NoOfErrorFds}), catch erts_debug:set_internal_state(available_internal_state, false), catch erlang:display('--- CHECK IO INFO ---'), ok. get_check_io_info() -> - z_SUITE:get_check_io_info(). + ChkIo = erlang:system_info(check_io), + case lists:keysearch(pending_updates, 1, ChkIo) of + {value, {pending_updates, 0}} -> + display_check_io(ChkIo), + ChkIo; + false -> + ChkIo; + _ -> + receive after 10 -> ok end, + get_check_io_info() + end. diff -Nru erlang-18.2-dfsg/erts/emulator/test/beam_literals_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/beam_literals_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/beam_literals_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/beam_literals_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -227,11 +226,10 @@ %% Generate an Erlang module with all different type of type tests. ?line Tests = make_test([{T, L} || T <- type_tests(), L <- literals()]), ?line Mod = literal_test, - Anno = erl_anno:new(0), - Func = {function, Anno, test, 0, [{clause,Anno,[],[],Tests}]}, - Form = [{attribute,Anno,module,Mod}, - {attribute,Anno,compile,export_all}, - Func, {eof,Anno}], + ?line Func = {function, 0, test, 0, [{clause,0,[],[],Tests}]}, + ?line Form = [{attribute,0,module,Mod}, + {attribute,0,compile,export_all}, + Func, {eof,0}], %% Print generated code for inspection. ?line lists:foreach(fun (F) -> io:put_chars([erl_pp:form(F),"\n"]) end, Form), @@ -263,8 +261,7 @@ {ok,Toks,_Line} = erl_scan:string(S), {ok,E} = erl_parse:parse_exprs(Toks), {value,Val,_Bs} = erl_eval:exprs(E, []), - Anno = erl_anno:new(0), - {match,Anno,{atom,Anno,Val},hd(E)}. + {match,0,{atom,0,Val},hd(E)}. test(T, A, L) -> S = lists:flatten(io_lib:format("begin io:format(\"~~p~n\", [{~p,~p,~p}]), if ~w(~w, ~w) -> true; true -> false end end. ", @@ -272,8 +269,7 @@ {ok,Toks,_Line} = erl_scan:string(S), {ok,E} = erl_parse:parse_exprs(Toks), {value,Val,_Bs} = erl_eval:exprs(E, []), - Anno = erl_anno:new(0), - {match,Anno,{atom,Anno,Val},hd(E)}. + {match,0,{atom,0,Val},hd(E)}. literals() -> [42, diff -Nru erlang-18.2-dfsg/erts/emulator/test/beam_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/beam_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/beam_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/beam_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/bif_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/bif_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/bif_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/bif_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -21,7 +20,6 @@ -module(bif_SUITE). -include_lib("test_server/include/test_server.hrl"). --include_lib("kernel/include/file.hrl"). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, @@ -683,38 +681,8 @@ {badrpc,nodedown} = rpc:call(N2, erlang, halt, [0]), {ok,N3} = slave:start(H, halt_node3), {badrpc,nodedown} = rpc:call(N3, erlang, halt, [0,[]]), + ok. - % This test triggers a segfault when dumping a crash dump - % to make sure that we can handle it properly. - {ok,N4} = slave:start(H, halt_node4), - CrashDump = filename:join(proplists:get_value(priv_dir,Config), - "segfault_erl_crash.dump"), - true = rpc:call(N4, os, putenv, ["ERL_CRASH_DUMP",CrashDump]), - false = rpc:call(N4, erts_debug, set_internal_state, - [available_internal_state, true]), - {badrpc,nodedown} = rpc:call(N4, erts_debug, set_internal_state, - [broken_halt, "Validate correct crash dump"]), - ok = wait_until_stable_size(CrashDump,-1), - {ok, Bin} = file:read_file(CrashDump), - case {string:str(binary_to_list(Bin),"\n=end\n"), - string:str(binary_to_list(Bin),"\r\n=end\r\n")} of - {0,0} -> ct:fail("Could not find end marker in crash dump"); - _ -> ok - end. - -wait_until_stable_size(_File,-10) -> - {error,enoent}; -wait_until_stable_size(File,PrevSz) -> - timer:sleep(250), - case file:read_file_info(File) of - {error,enoent} -> - wait_until_stable_size(File,PrevSz-1); - {ok,#file_info{size = PrevSz }} when PrevSz /= -1 -> - io:format("Crashdump file size was: ~p (~s)~n",[PrevSz,File]), - ok; - {ok,#file_info{size = NewSz }} -> - wait_until_stable_size(File,NewSz) - end. %% Helpers diff -Nru erlang-18.2-dfsg/erts/emulator/test/big_SUITE_data/literal_test.erl erlang-17.3-dfsg/erts/emulator/test/big_SUITE_data/literal_test.erl --- erlang-18.2-dfsg/erts/emulator/test/big_SUITE_data/literal_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/big_SUITE_data/literal_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/big_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/big_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/big_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/big_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,7 +23,7 @@ init_per_group/2,end_per_group/2]). -export([t_div/1, eq_28/1, eq_32/1, eq_big/1, eq_math/1, big_literals/1, borders/1, negative/1, big_float_1/1, big_float_2/1, - shift_limit_1/1, powmod/1, system_limit/1, toobig/1, otp_6692/1]). + shift_limit_1/1, powmod/1, system_limit/1, otp_6692/1]). %% Internal exports. -export([eval/1]). @@ -41,7 +40,7 @@ all() -> [t_div, eq_28, eq_32, eq_big, eq_math, big_literals, borders, negative, {group, big_float}, shift_limit_1, - powmod, system_limit, toobig, otp_6692]. + powmod, system_limit, otp_6692]. groups() -> [{big_float, [], [big_float_1, big_float_2]}]. @@ -371,16 +370,6 @@ id(I) -> I. -toobig(Config) when is_list(Config) -> - ?line {'EXIT',{{badmatch,_},_}} = (catch toobig()), - ok. - -toobig() -> - A = erlang:term_to_binary(lists:seq(1000000, 2200000)), - ASize = erlang:bit_size(A), - <> = A, % should fail - ANr band ANr. - otp_6692(suite) -> []; otp_6692(doc) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/binary_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/binary_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/binary_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/binary_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -521,9 +520,7 @@ external_size_1(_, _, _) -> ok. t_iolist_size(Config) when is_list(Config) -> - ?line Seed = {erlang:monotonic_time(), - erlang:time_offset(), - erlang:unique_integer([positive])}, + ?line Seed = now(), ?line io:format("Seed: ~p", [Seed]), ?line random:seed(Seed), ?line Base = <<0:(1 bsl 20)/unit:8>>, diff -Nru erlang-18.2-dfsg/erts/emulator/test/bs_bincomp_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/bs_bincomp_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/bs_bincomp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/bs_bincomp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/bs_bit_binaries_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/bs_bit_binaries_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/bs_bit_binaries_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/bs_bit_binaries_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/bs_construct_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/bs_construct_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/bs_construct_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/bs_construct_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/bs_match_bin_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/bs_match_bin_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/bs_match_bin_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/bs_match_bin_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/bs_match_int_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/bs_match_int_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/bs_match_int_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/bs_match_int_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/emulator/test/bs_match_misc_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/bs_match_misc_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/bs_match_misc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/bs_match_misc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/bs_match_tail_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/bs_match_tail_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/bs_match_tail_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/bs_match_tail_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/bs_utf_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/bs_utf_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/bs_utf_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/bs_utf_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE_data/hard_busy_drv.c erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE_data/hard_busy_drv.c --- erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE_data/hard_busy_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE_data/hard_busy_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c --- erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE_data/Makefile.src erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE_data/Makefile.src --- erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE_data/scheduling_drv.c erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE_data/scheduling_drv.c --- erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE_data/scheduling_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE_data/scheduling_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE_data/soft_busy_drv.c erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE_data/soft_busy_drv.c --- erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE_data/soft_busy_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE_data/soft_busy_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/busy_port_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/busy_port_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -517,13 +516,13 @@ P = spawn_link(fun () -> erlang:yield(), Tester ! {self(), doing_port_command}, - Start = erlang:monotonic_time(micro_seconds), + Start = now(), Res = try {return, port_command(Prt, [], Opts)} catch Exception:Error -> {Exception, Error} end, - End = erlang:monotonic_time(micro_seconds), - Time = round((End - Start)/1000), + End = now(), + Time = round(timer:now_diff(End, Start)/1000), Tester ! {self(), port_command_result, Res, Time} end), receive @@ -777,7 +776,7 @@ run_command(M,spawn,Args) -> run_command(M,spawn,{Args,[]}); run_command(Mod,Func,Args) -> - erlang:display({{Mod,Func,Args}, erlang:system_time(micro_seconds)}), + erlang:display({{Mod,Func,Args},now()}), apply(Mod,Func,Args). validate_scenario(Data,[{print,Var}|T]) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/call_trace_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/call_trace_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/call_trace_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/call_trace_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/emulator/test/code_parallel_load_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/code_parallel_load_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/code_parallel_load_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/code_parallel_load_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012-2014. All Rights Reserved. +%% Copyright Ericsson AB 2012-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -191,15 +190,13 @@ generate(Module, Attributes, FunStrings) -> FunForms = function_forms(FunStrings), Forms = [ - {attribute,a(1),module,Module}, - {attribute,a(2),export,[FA || {FA,_} <- FunForms]} - ] ++ [{attribute, a(3), A, V}|| {A, V} <- Attributes] ++ + {attribute,1,module,Module}, + {attribute,2,export,[FA || {FA,_} <- FunForms]} + ] ++ [{attribute, 3, A, V}|| {A, V} <- Attributes] ++ [ Function || {_, Function} <- FunForms], {ok, Module, Bin} = compile:forms(Forms), Bin. -a(L) -> - erl_anno:new(L). function_forms([]) -> []; function_forms([S|Ss]) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/another_code_test.erl erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/another_code_test.erl --- erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/another_code_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/another_code_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/cpbugx.erl erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/cpbugx.erl --- erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/cpbugx.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/cpbugx.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/fun_confusion.erl erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/fun_confusion.erl --- erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/fun_confusion.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/fun_confusion.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/literals.erl erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/literals.erl --- erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/literals.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/literals.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/many_funs.erl erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/many_funs.erl --- erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/many_funs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/many_funs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/my_code_test.erl erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/my_code_test.erl --- erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/my_code_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/my_code_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/versions.erl erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/versions.erl --- erlang-18.2-dfsg/erts/emulator/test/code_SUITE_data/versions.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/code_SUITE_data/versions.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/code_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/code_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/code_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/code_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -390,63 +389,61 @@ make_stub(Config) when is_list(Config) -> catch erlang:purge_module(my_code_test), - MD5 = erlang:md5(<<>>), ?line Data = ?config(data_dir, Config), ?line File = filename:join(Data, "my_code_test"), ?line {ok,my_code_test,Code} = compile:file(File, [binary]), - ?line my_code_test = code:make_stub_module(my_code_test, Code, {[],[],MD5}), + ?line my_code_test = code:make_stub_module(my_code_test, Code, {[],[]}), ?line true = erlang:delete_module(my_code_test), ?line true = erlang:purge_module(my_code_test), ?line my_code_test = code:make_stub_module(my_code_test, make_unaligned_sub_binary(Code), - {[],[],MD5}), + {[],[]}), ?line true = erlang:delete_module(my_code_test), ?line true = erlang:purge_module(my_code_test), ?line my_code_test = code:make_stub_module(my_code_test, zlib:gzip(Code), - {[],[],MD5}), + {[],[]}), ?line true = erlang:delete_module(my_code_test), ?line true = erlang:purge_module(my_code_test), %% Should fail. ?line {'EXIT',{badarg,_}} = - (catch code:make_stub_module(my_code_test, <<"bad">>, {[],[],MD5})), + (catch code:make_stub_module(my_code_test, <<"bad">>, {[],[]})), ?line {'EXIT',{badarg,_}} = (catch code:make_stub_module(my_code_test, bit_sized_binary(Code), - {[],[],MD5})), + {[],[]})), ?line {'EXIT',{badarg,_}} = (catch code:make_stub_module(my_code_test_with_wrong_name, - Code, {[],[],MD5})), + Code, {[],[]})), ok. make_stub_many_funs(Config) when is_list(Config) -> catch erlang:purge_module(many_funs), - MD5 = erlang:md5(<<>>), ?line Data = ?config(data_dir, Config), ?line File = filename:join(Data, "many_funs"), ?line {ok,many_funs,Code} = compile:file(File, [binary]), - ?line many_funs = code:make_stub_module(many_funs, Code, {[],[],MD5}), + ?line many_funs = code:make_stub_module(many_funs, Code, {[],[]}), ?line true = erlang:delete_module(many_funs), ?line true = erlang:purge_module(many_funs), ?line many_funs = code:make_stub_module(many_funs, make_unaligned_sub_binary(Code), - {[],[],MD5}), + {[],[]}), ?line true = erlang:delete_module(many_funs), ?line true = erlang:purge_module(many_funs), %% Should fail. ?line {'EXIT',{badarg,_}} = - (catch code:make_stub_module(many_funs, <<"bad">>, {[],[],MD5})), + (catch code:make_stub_module(many_funs, <<"bad">>, {[],[]})), ?line {'EXIT',{badarg,_}} = (catch code:make_stub_module(many_funs, bit_sized_binary(Code), - {[],[],MD5})), + {[],[]})), ok. constant_pools(Config) when is_list(Config) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/crypto_reference.erl erlang-17.3-dfsg/erts/emulator/test/crypto_reference.erl --- erlang-18.2-dfsg/erts/emulator/test/crypto_reference.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/crypto_reference.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/crypto_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/crypto_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/crypto_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/crypto_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/ddll_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/ddll_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/ddll_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/ddll_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/decode_packet_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/decode_packet_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/decode_packet_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/decode_packet_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -53,9 +52,7 @@ init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Seed = {S1,S2,S3} = {erlang:monotonic_time(), - erlang:time_offset(), - erlang:unique_integer()}, + Seed = {S1,S2,S3} = now(), random:seed(S1,S2,S3), io:format("*** SEED: ~p ***\n", [Seed]), Dog=?t:timetrap(?t:minutes(1)), diff -Nru erlang-18.2-dfsg/erts/emulator/test/dgawd_handler.erl erlang-17.3-dfsg/erts/emulator/test/dgawd_handler.erl --- erlang-18.2-dfsg/erts/emulator/test/dgawd_handler.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/dgawd_handler.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/distribution_SUITE_data/run.erl erlang-17.3-dfsg/erts/emulator/test/distribution_SUITE_data/run.erl --- erlang-18.2-dfsg/erts/emulator/test/distribution_SUITE_data/run.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/distribution_SUITE_data/run.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,19 +29,16 @@ from(H, []) -> []. start() -> - Result = do_it(), - - %% Do GCs and node_and_dist_references - %% in an attempt to crash the VM (without OTP-13076 fix) - lists:foreach(fun(P) -> erlang:garbage_collect(P) end, - processes()), - erts_debug:set_internal_state(available_internal_state, true), - erts_debug:get_internal_state(node_and_dist_references), - - io:format("~w~n", [Result]), - + net_kernel:start([fideridum,shortnames]), + {ok, Node} = slave:start(host(), heppel), + P = spawn(Node, a, b, []), + B1 = term_to_binary(P), + N1 = node(P), + ok = net_kernel:stop(), + N2 = node(P), + io:format("~w~n", [N1 == N2]), if - Result -> + N1 == N2 -> init:stop(); true -> %% Make sure that the io:format/2 output is really written @@ -50,29 +46,3 @@ erlang:yield(), init:stop() end. - - -do_it() -> - {ok, _} = net_kernel:start([fideridum,shortnames]), - {ok, Node} = slave:start(host(), heppel), - P = spawn(Node, net_kernel, stop, []), - B1 = term_to_binary(P), - N1 = node(P), - ok = net_kernel:stop(), - N2 = node(P), - - %% OTP-13076 - %% Restart distribution with same node name as previous remote node - %% Repeat to wrap around creation - Result = lists:foldl(fun(_, Acc) -> - timer:sleep(2), % give net_kernel:stop() time to take effect :-( - {ok, _} = net_kernel:start([heppel,shortnames]), - N3 = node(P), - ok = net_kernel:stop(), - N4 = node(P), - Acc and (N3 =:= N1) and (N4 =:= N1) - end, - (N2 =:= N1), - lists:seq(1,3)), - - Result. diff -Nru erlang-18.2-dfsg/erts/emulator/test/distribution_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/distribution_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/distribution_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/distribution_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -1338,7 +1337,10 @@ get_conflicting_atoms(_CIX, 0) -> []; get_conflicting_atoms(CIX, N) -> - Atom = list_to_atom("atom" ++ integer_to_list(erlang:unique_integer([positive]))), + {A, B, C} = now(), + Atom = list_to_atom("atom" ++ integer_to_list(A*1000000000000 + + B*1000000 + + C)), case erts_debug:get_internal_state({atom_out_cache_index, Atom}) of CIX -> [Atom|get_conflicting_atoms(CIX, N-1)]; @@ -1349,7 +1351,10 @@ get_conflicting_unicode_atoms(_CIX, 0) -> []; get_conflicting_unicode_atoms(CIX, N) -> - Atom = string_to_atom([16#1f608] ++ "atom" ++ integer_to_list(erlang:unique_integer([positive]))), + {A, B, C} = now(), + Atom = string_to_atom([16#1f608] ++ "atom" ++ integer_to_list(A*1000000000000 + + B*1000000 + + C)), case erts_debug:get_internal_state({atom_out_cache_index, Atom}) of CIX -> [Atom|get_conflicting_unicode_atoms(CIX, N-1)]; @@ -1962,7 +1967,8 @@ %%% Utilities timestamp() -> - erlang:monotonic_time(milli_seconds). + {A,B,C} = erlang:now(), + (C div 1000) + (B * 1000) + (A * 1000000000). start_node(X) -> start_node(X, [], []). @@ -1986,9 +1992,7 @@ ++ "-" ++ atom_to_list(?config(testcase, Config)) ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) - ++ "-" - ++ integer_to_list(erlang:unique_integer([positive])))), + ++ integer_to_list(timestamp()))), start_node(Name, Args, Rel). stop_node(Node) -> @@ -2105,7 +2109,7 @@ Master ! {nodeup, node(), Node} end, Nodes0), - ?t:format("~p ~p: ~p~n", [node(), erlang:system_time(micro_seconds), Nodes0]), + ?t:format("~p ~p: ~p~n", [node(), erlang:now(), Nodes0]), node_monitor_loop(Master); false -> net_kernel:monitor_nodes(false, Opts), @@ -2126,7 +2130,7 @@ receive {nodeup, Node, _InfoList} = Msg -> Master ! {nodeup, node(), Node}, - ?t:format("~p ~p: ~p~n", [node(), erlang:system_time(micro_seconds), Msg]), + ?t:format("~p ~p: ~p~n", [node(), erlang:now(), Msg]), node_monitor_loop(Master); {nodedown, Node, InfoList} = Msg -> Reason = case lists:keysearch(nodedown_reason, 1, InfoList) of @@ -2134,7 +2138,7 @@ _ -> undefined end, Master ! {nodedown, node(), Node, Reason}, - ?t:format("~p ~p: ~p~n", [node(), erlang:system_time(micro_seconds), Msg]), + ?t:format("~p ~p: ~p~n", [node(), erlang:now(), Msg]), node_monitor_loop(Master) end. diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/async_blast_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/async_blast_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/async_blast_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/async_blast_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/caller_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/caller_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/caller_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/caller_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/chkio_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/chkio_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/chkio_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/chkio_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/consume_timeslice_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/consume_timeslice_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/consume_timeslice_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/consume_timeslice_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2012-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/invalid_extended_marker_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/invalid_extended_marker_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/invalid_extended_marker_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/invalid_extended_marker_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/ioq_exit_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/ioq_exit_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/ioq_exit_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/ioq_exit_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/io_ready_exit_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/io_ready_exit_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/io_ready_exit_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/io_ready_exit_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/larger_major_vsn_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/larger_major_vsn_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/larger_major_vsn_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/larger_major_vsn_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/larger_minor_vsn_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/larger_minor_vsn_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/larger_minor_vsn_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/larger_minor_vsn_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/missing_callback_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/missing_callback_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/missing_callback_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/missing_callback_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson AB. Portions * created by Ericsson are Copyright 2008, Ericsson Utvecklings AB. All diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/monitor_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/monitor_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/monitor_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/monitor_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/otp_6879_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/otp_6879_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/otp_6879_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/otp_6879_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/smaller_major_vsn_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/smaller_major_vsn_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/smaller_major_vsn_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/smaller_major_vsn_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/smaller_minor_vsn_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/smaller_minor_vsn_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/smaller_minor_vsn_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/smaller_minor_vsn_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_curr_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_curr_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_curr_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_curr_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.h erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.h --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_drv_impl.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/thr_alloc_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/thr_alloc_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/thr_alloc_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/thr_alloc_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/thr_free_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/thr_free_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/thr_free_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/thr_free_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/vsn_mismatch_drv_impl.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/vsn_mismatch_drv_impl.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/vsn_mismatch_drv_impl.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/vsn_mismatch_drv_impl.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/zero_extended_marker_garb_drv.c erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/zero_extended_marker_garb_drv.c --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE_data/zero_extended_marker_garb_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE_data/zero_extended_marker_garb_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/driver_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/driver_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/driver_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/driver_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -32,9 +31,8 @@ end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2, end_per_testcase/2, - - a_test/1, outputv_echo/1, + timer_measure/1, timer_cancel/1, timer_change/1, @@ -81,8 +79,7 @@ thr_free_drv/1, async_blast/1, thr_msg_blast/1, - consume_timeslice/1, - z_test/1]). + consume_timeslice/1]). -export([bin_prefix/2]). @@ -125,19 +122,19 @@ _ -> erts_debug:set_internal_state(available_internal_state, true) end, erlang:display({init_per_testcase, Case}), - ?line 0 = element(1, erts_debug:get_internal_state(check_io_debug)), + ?line 0 = erts_debug:get_internal_state(check_io_debug), [{watchdog, Dog},{testcase, Case}|Config]. end_per_testcase(Case, Config) -> Dog = ?config(watchdog, Config), erlang:display({end_per_testcase, Case}), - ?line 0 = element(1, erts_debug:get_internal_state(check_io_debug)), + ?line 0 = erts_debug:get_internal_state(check_io_debug), ?t:timetrap_cancel(Dog). suite() -> [{ct_hooks,[ts_install_cth]}]. -all() -> %% Keep a_test first and z_test last... - [a_test, outputv_errors, outputv_echo, queue_echo, {group, timer}, +all() -> + [outputv_errors, outputv_echo, queue_echo, {group, timer}, driver_unloaded, io_ready_exit, use_fallback_pollset, bad_fd_in_pollset, driver_event, fd_change, steal_control, otp_6602, driver_system_info_base_ver, @@ -154,8 +151,7 @@ thr_free_drv, async_blast, thr_msg_blast, - consume_timeslice, - z_test]. + consume_timeslice]. groups() -> [{timer, [], @@ -391,12 +387,12 @@ try_timeouts(_, 0) -> ok; try_timeouts(Port, Timeout) -> - ?line TimeBefore = erlang:monotonic_time(), + ?line TimeBefore = now(), ?line erlang:port_command(Port, <>), receive {Port,{data,[?TIMER]}} -> ?line Elapsed = erl_millisecs() - erl_millisecs(TimeBefore), - io:format("Elapsed: ~p Timeout: ~p\n", [Elapsed, Timeout]), + io:format("Elapsed: ~p Timeout: ~p\n", [Elapsed,Timeout]), if Elapsed < Timeout -> ?line ?t:fail(too_short); @@ -456,7 +452,7 @@ Name = 'timer_drv', ?line Port = start_driver(Config, Name, false), - ?line TimeBefore = erlang:monotonic_time(), + ?line TimeBefore = now(), Timeout0 = 350, ?line erlang:port_command(Port, <>), Timeout = Timeout0 + @@ -500,7 +496,7 @@ try_change_timer(_Port, 0) -> ok; try_change_timer(Port, Timeout) -> ?line Timeout_3 = Timeout*3, - ?line TimeBefore = erlang:monotonic_time(), + ?line TimeBefore = now(), ?line erlang:port_command(Port, <>), ?line erlang:port_command(Port, <>), receive @@ -921,7 +917,8 @@ end. chkio_test_init(Config) when is_list(Config) -> - ?line ChkIo = get_stable_check_io_info(), + ?line wait_until_no_pending_updates(), + ?line ChkIo = erlang:system_info(check_io), ?line case catch lists:keysearch(name, 1, ChkIo) of {value, {name, erts_poll}} -> ?line ?t:format("Before test: ~p~n", [ChkIo]), @@ -940,7 +937,8 @@ chkio_test_fini({chkio_test_result, Res, Before}) -> ?line ok = erl_ddll:unload_driver('chkio_drv'), ?line ok = erl_ddll:stop(), - ?line After = get_stable_check_io_info(), + ?line wait_until_no_pending_updates(), + ?line After = erlang:system_info(check_io), ?line ?t:format("After test: ~p~n", [After]), ?line verify_chkio_state(Before, After), ?line Res. @@ -987,7 +985,7 @@ ?line Fun(), ?line During = erlang:system_info(check_io), ?line erlang:display(During), - ?line 0 = element(1, erts_debug:get_internal_state(check_io_debug)), + ?line 0 = erts_debug:get_internal_state(check_io_debug), ?line ?t:format("During test: ~p~n", [During]), ?line chk_chkio_port(Port), ?line case erlang:port_control(Port, ?CHKIO_STOP, "") of @@ -1036,22 +1034,18 @@ After) end, ?line ok. + + -get_stable_check_io_info() -> - ChkIo = erlang:system_info(check_io), - PendUpdNo = case lists:keysearch(pending_updates, 1, ChkIo) of - {value, {pending_updates, PendNo}} -> - PendNo; - false -> - 0 - end, - {value, {active_fds, ActFds}} = lists:keysearch(active_fds, 1, ChkIo), - case {PendUpdNo, ActFds} of - {0, 0} -> - ChkIo; +wait_until_no_pending_updates() -> + case lists:keysearch(pending_updates, 1, erlang:system_info(check_io)) of + {value, {pending_updates, 0}} -> + ok; + false -> + ok; _ -> receive after 10 -> ok end, - get_stable_check_io_info() + wait_until_no_pending_updates() end. otp_6602(doc) -> ["Missed port lock when stealing control of fd from a " @@ -1205,8 +1199,8 @@ ?line Value = integer_to_list(erlang:system_info(schedulers)); %% Data added in 3rd version of driver_system_info() (driver version 1.5) -check_si_res(["emu_nif_vsn", Value]) -> - ?line Value = erlang:system_info(nif_version); +check_si_res(["emu_nif_vsn", _Value]) -> + true; %% Data added in 4th version of driver_system_info() (driver version 3.1) check_si_res(["dirty_sched", _Value]) -> @@ -2393,25 +2387,10 @@ PNs end. -a_test(Config) when is_list(Config) -> - check_io_debug(). - -z_test(Config) when is_list(Config) -> - check_io_debug(). - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Utilities %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -check_io_debug() -> - get_stable_check_io_info(), - {NoErrorFds, NoUsedFds, NoDrvSelStructs, NoDrvEvStructs} - = erts_debug:get_internal_state(check_io_debug), - 0 = NoErrorFds, - NoUsedFds = NoDrvSelStructs, - 0 = NoDrvEvStructs, - ok. - %flush_msgs() -> % receive % M -> @@ -2521,11 +2500,13 @@ end, random:uniform(N). +%% return millisecs from statistics source erl_millisecs() -> - erl_millisecs(erlang:monotonic_time()). + {Ms, S, Us} = erlang:now(), + Ms * 1000000000 + S * 1000 + Us / 1000. -erl_millisecs(MonotonicTime) -> - (1000*MonotonicTime)/erlang:convert_time_unit(1,seconds,native). +erl_millisecs({Ms,S,Us}) -> + Ms * 1000000000 + S * 1000 + Us / 1000. %% Start/stop drivers. start_driver(Config, Name, Binary) -> @@ -2574,15 +2555,18 @@ start_node(Config) when is_list(Config) -> - Pa = filename:dirname(code:which(?MODULE)), - Name = list_to_atom(atom_to_list(?MODULE) - ++ "-" - ++ atom_to_list(?config(testcase, Config)) - ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) - ++ "-" - ++ integer_to_list(erlang:unique_integer([positive]))), - ?t:start_node(Name, slave, [{args, "-pa "++Pa}]). + ?line Pa = filename:dirname(code:which(?MODULE)), + ?line {A, B, C} = now(), + ?line Name = list_to_atom(atom_to_list(?MODULE) + ++ "-" + ++ atom_to_list(?config(testcase, Config)) + ++ "-" + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) + ++ "-" + ++ integer_to_list(C)), + ?line ?t:start_node(Name, slave, [{args, "-pa "++Pa}]). stop_node(Node) -> ?t:stop_node(Node). diff -Nru erlang-18.2-dfsg/erts/emulator/test/efile_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/efile_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/efile_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/efile_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/basic.c erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/basic.c --- erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/basic.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/basic.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/Makefile.src erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/Makefile.src --- erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/rwlock.c erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/rwlock.c --- erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/rwlock.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/rwlock.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c --- erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.h erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.h --- erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/tsd.c erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/tsd.c --- erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/tsd.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE_data/tsd.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/erl_drv_thread_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/erl_drv_thread_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/erl_link_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/erl_link_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/erl_link_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/erl_link_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -1036,13 +1035,16 @@ get_names(0, _, Acc) -> Acc; get_names(N, T, Acc) -> + {A, B, C} = now(), get_names(N-1, T, [list_to_atom(atom_to_list(?MODULE) ++ "-" ++ atom_to_list(T) ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) ++ "-" - ++ integer_to_list(erlang:unique_integer([positive]))) | Acc]). + ++ integer_to_list(C)) | Acc]). start_node(Name) -> ?line start_node(Name, ""). diff -Nru erlang-18.2-dfsg/erts/emulator/test/erts_debug_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/erts_debug_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/erts_debug_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/erts_debug_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -72,11 +71,6 @@ 4 = do_test_size(#{}), 32 = do_test_size(#{b => 2,c => 3,txt => "hello world"}), - true = do_test_size(maps:from_list([{I,I}||I<-lists:seq(1,256)])) >= map_size_lower_bound(256), - true = do_test_size(maps:from_list([{I,I}||I<-lists:seq(1,4096)])) >= map_size_lower_bound(4096), - true = do_test_size(maps:from_list([{I,I}||I<-lists:seq(1,254)])) >= map_size_lower_bound(254), - true = do_test_size(maps:from_list([{I,I}||I<-lists:seq(1,239)])) >= map_size_lower_bound(239), - %% Test internal consistency of sizes, but without testing %% exact sizes. Const = id(42), @@ -98,14 +92,14 @@ %% Test shared data structures. do_test_size([ConsCell1|ConsCell1], - 3*ConsCellSz, - 2*ConsCellSz), + 3*ConsCellSz, + 2*ConsCellSz), do_test_size(fun() -> {ConsCell1,ConsCell2} end, - FunSz2 + 2*ConsCellSz, - FunSz2 + ConsCellSz), + FunSz2 + 2*ConsCellSz, + FunSz2 + ConsCellSz), do_test_size({SimplestFun,SimplestFun}, - 2*FunSz0+do_test_size({a,b}), - FunSz0+do_test_size({a,b})), + 2*FunSz0+do_test_size({a,b}), + FunSz0+do_test_size({a,b})), M = id(#{ "atom" => first, i => 0}), do_test_size([M,M#{ "atom" := other },M#{i := 42}],54,32), @@ -119,13 +113,6 @@ FlatSz = erts_debug:flat_size(Term), Sz = erts_debug:size(Term). -map_size_lower_bound(N) -> - %% this est. is a bit lower that actual lower bound - %% number of internal nodes - T = (N - 1) div 15, - %% total words - 2 + 17 * T + 2 * N. - flat_size_big(Config) when is_list(Config) -> %% Build a term whose external size only fits in a big num (on 32-bit CPU). flat_size_big_1(16#11111111111111117777777777777777888889999, 0, 16#FFFFFFF). @@ -139,48 +126,23 @@ flat_size_big_1(_, _, _) -> ok. df(Config) when is_list(Config) -> - P0 = pps(), - PrivDir = ?config(priv_dir, Config), - ok = file:set_cwd(PrivDir), - - AllLoaded = [M || {M,_} <- code:all_loaded()], - {Pid,Ref} = spawn_monitor(fun() -> df_smoke(AllLoaded) end), - receive - {'DOWN',Ref,process,Pid,Status} -> - normal = Status - after 20*1000 -> - %% Not finished (i.e. a slow computer). Stop now. - Pid ! stop, - receive - {'DOWN',Ref,process,Pid,Status} -> - normal = Status, - io:format("...") - end - end, - io:nl(), - _ = [_ = file:delete(atom_to_list(M) ++ ".dis") || - M <- AllLoaded], - - true = (P0 == pps()), + ?line P0 = pps(), + ?line PrivDir = ?config(priv_dir, Config), + ?line ok = file:set_cwd(PrivDir), + ?line erts_debug:df(?MODULE), + ?line Beam = filename:join(PrivDir, ?MODULE_STRING++".dis"), + ?line {ok,Bin} = file:read_file(Beam), + ?line ok = io:put_chars(binary_to_list(Bin)), + ?line ok = file:delete(Beam), + ?line true = (P0 == pps()), ok. -df_smoke([M|Ms]) -> - io:format("~p", [M]), - erts_debug:df(M), - receive - stop -> - ok - after 0 -> - df_smoke(Ms) - end; -df_smoke([]) -> ok. - pps() -> {erlang:ports()}. instructions(Config) when is_list(Config) -> - Is = erts_debug:instructions(), - _ = [list_to_atom(I) || I <- Is], + ?line Is = erts_debug:instructions(), + ?line _ = [list_to_atom(I) || I <- Is], ok. id(I) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/estone_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/estone_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/estone_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/estone_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -340,6 +339,7 @@ ]. macro(Ms,DataDir) -> + erlang:now(), %% compensate for old 4.3 firsttime clock bug :-( statistics(reductions), statistics(runtime), lists(500), %% fixup cache on first round @@ -369,9 +369,10 @@ apply_micro(M) -> {GC0, Words0, _} = statistics(garbage_collection), statistics(reductions), - Before = monotonic_time(), + Before = erlang:now(), + Compensate = apply_micro(M#micro.function, M#micro.loops), - After = monotonic_time(), + After = erlang:now(), {GC1, Words1, _} = statistics(garbage_collection), {_, Reds} = statistics(reductions), Elapsed = subtr(Before, After), @@ -388,13 +389,12 @@ {kilo_reductions, Reds div 1000}, {gc_intensity, gci(Elapsed, GC1 - GC0, Words1 - Words0)}]. -monotonic_time() -> - try erlang:monotonic_time() catch error:undef -> erlang:now() end. -subtr(Before, After) when is_integer(Before), is_integer(After) -> - erlang:convert_time_unit(After-Before, native, micro_seconds); -subtr({_,_,_}=Before, {_,_,_}=After) -> - timer:now_diff(After, Before). +subtr(Before, After) -> + (element(1,After)*1000000000000 + +element(2,After)*1000000+element(3,After)) - + (element(1,Before)*1000000000000 + +element(2,Before)*1000000+element(3,Before)). gci(Micros, Words, Gcs) -> ((256 * Gcs) / Micros) + (Words / Micros). @@ -633,10 +633,10 @@ %% Port I/O port_io(I) -> EstoneCat = get(estone_cat), - Before = monotonic_time(), + Before = erlang:now(), Pps = make_port_pids(5, I, EstoneCat), %% 5 ports send_procs(Pps, go), - After = monotonic_time(), + After = erlang:now(), wait_for_pids(Pps), subtr(Before, After). @@ -854,10 +854,10 @@ %% Binary handling, creating, manipulating and sending binaries binary_h(I) -> - Before = monotonic_time(), + Before = erlang:now(), P = spawn(?MODULE, echo, [self()]), B = list_to_binary(lists:duplicate(2000, 5)), - After = monotonic_time(), + After = erlang:now(), Compensate = subtr(Before, After), binary_h_2(I, P, B), Compensate. diff -Nru erlang-18.2-dfsg/erts/emulator/test/evil_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/evil_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/evil_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/evil_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/emulator/test/exception_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/exception_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/exception_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/exception_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/float_SUITE_data/fp_drv.c erlang-17.3-dfsg/erts/emulator/test/float_SUITE_data/fp_drv.c --- erlang-18.2-dfsg/erts/emulator/test/float_SUITE_data/fp_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/float_SUITE_data/fp_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson AB. Portions * created by Ericsson are Copyright 2008, Ericsson AB. All Rights @@ -30,14 +29,9 @@ #if defined (__GNUC__) int _finite(double x); #endif -#ifndef isfinite -#define isfinite _finite +#ifndef finite +#define finite _finite #endif -#elif !defined(HAVE_ISFINITE) && defined(HAVE_FINITE) -/* If not windows and we do not have isfinite */ -#define isfinite finite -#elif !defined(HAVE_ISFINITE) -# error "No finite function found!" #endif #include "erl_driver.h" @@ -85,21 +79,21 @@ x = 3.23e133; y = 3.57e257; z = x*y; - if (isfinite(z)) + if (finite(z)) return "is finite (1)"; x = 5.0; y = 0.0; z = x/y; - if (isfinite(z)) + if (finite(z)) return "is finite (2)"; z = log(-1.0); - if (isfinite(z)) + if (finite(z)) return "is finite (3)"; z = log(0.0); - if (isfinite(z)) + if (finite(z)) return "is finite (4)"; return "ok"; diff -Nru erlang-18.2-dfsg/erts/emulator/test/float_SUITE_data/has_fpe_bug.erl erlang-17.3-dfsg/erts/emulator/test/float_SUITE_data/has_fpe_bug.erl --- erlang-18.2-dfsg/erts/emulator/test/float_SUITE_data/has_fpe_bug.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/float_SUITE_data/has_fpe_bug.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/float_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/float_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/float_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/float_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -295,13 +294,16 @@ start_node(Config) when is_list(Config) -> ?line Pa = filename:dirname(code:which(?MODULE)), + ?line {A, B, C} = now(), ?line Name = list_to_atom(atom_to_list(?MODULE) ++ "-" ++ atom_to_list(?config(testcase, Config)) ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) ++ "-" - ++ integer_to_list(erlang:unique_integer([positive]))), + ++ integer_to_list(C)), ?line ?t:start_node(Name, slave, [{args, "-pa "++Pa}]). stop_node(Node) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/fun_r13_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/fun_r13_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/fun_r13_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/fun_r13_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/fun_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/fun_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/fun_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/fun_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/gc_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/gc_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/gc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/gc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -78,7 +77,7 @@ grow_heap1([], _MaxLen, _, down) -> ok; grow_heap1([_|List], MaxLen, CurLen, down) -> - C=erlang:unique_integer([positive]), + {_,_,C} = erlang:now(), Num = C rem (length(List))+1, Elem = lists:nth(Num, List), NewList = lists:delete(Elem, List), @@ -137,7 +136,7 @@ grow_stack_heap1([], _MaxLen, _, down) -> ok; grow_stack_heap1([_|List], MaxLen, CurLen, down) -> grow_stack1(CurLen*2,0), - C=erlang:unique_integer([positive]), + {_,_,C}=erlang:now(), Num=C rem (length(List))+1, Elem=lists:nth(Num, List), NewList=lists:delete(Elem, List), @@ -147,8 +146,8 @@ %% Create an arbitrary element/term. make_arbit() -> - {AA,BB,CC}=erlang:timestamp(), - A=AA+1, B=BB+1, C=(CC+erlang:unique_integer([positive])) rem 1000000 + 1, + {AA,BB,CC}=erlang:now(), + A=AA+1, B=BB+1, C=CC+1, New = case C rem 9 of 0 -> make_string((B div C) +5); @@ -172,7 +171,7 @@ make_string(_, 0, Acc) -> Acc; make_string(Alph, Length, Acc) -> - C=erlang:unique_integer([positive]), + {_,_,C}=erlang:now(), Pos=1+(Length*C rem length(Alph)), make_string(Alph, Length-1, [lists:nth(Pos,Alph)|Acc]). diff -Nru erlang-18.2-dfsg/erts/emulator/test/guard_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/guard_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/guard_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/guard_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/hash_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/hash_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/hash_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/hash_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -74,7 +73,6 @@ init_per_group/2,end_per_group/2, test_basic/1,test_cmp/1,test_range/1,test_spread/1, test_phash2/1,otp_5292/1,bit_level_binaries/1,otp_7127/1, - test_hash_zero/1, end_per_testcase/2,init_per_testcase/2]). init_per_testcase(_Case, Config) -> Dog=test_server:timetrap(test_server:minutes(10)), @@ -88,9 +86,7 @@ all() -> [test_basic, test_cmp, test_range, test_spread, - test_phash2, otp_5292, bit_level_binaries, otp_7127, - test_hash_zero - ]. + test_phash2, otp_5292, bit_level_binaries, otp_7127]. groups() -> []. @@ -164,8 +160,6 @@ otp_7127(Config) when is_list(Config) -> otp_7127_test(). -test_hash_zero(Config) when is_list(Config) -> - hash_zero_test(). -endif. @@ -597,26 +591,6 @@ 38990304 = erlang:phash2(<<"Scott9">>), ok. -hash_zero_test() -> - Zs = [0.0, -0.0, 0/-1, 0.0/-1, 0/-(1 bsl 65), - binary_to_term(<<131,70,0,0,0,0,0,0,0,0>>), %% +0.0 - binary_to_term(<<131,70,128,0,0,0,0,0,0,0>>)], %% -0.0 - ok = hash_zero_test(Zs,fun(T) -> erlang:phash2(T, 1 bsl 32) end), - ok = hash_zero_test(Zs,fun(T) -> erlang:phash(T, 1 bsl 32) end), - ok = hash_zero_test(Zs,fun(T) -> erlang:hash(T, (1 bsl 27) - 1) end), - ok. - -hash_zero_test([Z|Zs],F) -> - hash_zero_test(Zs,Z,F(Z),F). -hash_zero_test([Z|Zs],Z0,V,F) -> - true = Z0 =:= Z, %% assert exact equal - Z0 = Z, %% assert matching - V = F(Z), %% assert hash - hash_zero_test(Zs,Z0,V,F); -hash_zero_test([],_,_,_) -> - ok. - - %% %% Reference implementation of integer hashing %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/hibernate_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/hibernate_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/hibernate_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/hibernate_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/ignore_cores.erl erlang-17.3-dfsg/erts/emulator/test/ignore_cores.erl --- erlang-18.2-dfsg/erts/emulator/test/ignore_cores.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/ignore_cores.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/list_bif_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/list_bif_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/list_bif_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/list_bif_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/long_timers_test.erl erlang-17.3-dfsg/erts/emulator/test/long_timers_test.erl --- erlang-18.2-dfsg/erts/emulator/test/long_timers_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/long_timers_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,7 +28,7 @@ -define(MAX_TIMEOUT, 60). % Minutes --define(MAX_LATE_MS, 15*1000). % Milliseconds +-define(MAX_LATE, 10*1000). % Milliseconds -define(REG_NAME, '___LONG___TIMERS___TEST___SERVER___'). -define(DRV_NAME, timer_driver). @@ -76,7 +75,7 @@ erlang:demonitor(Mon), receive {'DOWN', Mon, _, _, _} -> ok after 0 -> ok end, stop_node(Node), - check(TORs, ms((End - Start) - max_late()), ok) + check(TORs, (timer:now_diff(End, Start) div 1000) - ?MAX_LATE, ok) end. check([#timeout_rec{timeout = Timeout, @@ -84,7 +83,7 @@ timeout_diff = undefined} | TORs], NeedRes, _Ok) when Timeout < NeedRes -> - io:format("~p timeout = ~p ms failed! No timeout.~n", + io:format("~p timeout = ~p failed! No timeout.~n", [Type, Timeout]), check(TORs, NeedRes, failed); check([#timeout_rec{timeout_diff = undefined} | TORs], @@ -96,7 +95,7 @@ timeout_diff = {error, Reason}} | TORs], NeedRes, _Ok) -> - io:format("~p timeout = ~p ms failed! exit reason ~p~n", + io:format("~p timeout = ~p failed! exit reason ~p~n", [Type, Timeout, Reason]), check(TORs, NeedRes, failed); check([#timeout_rec{timeout = Timeout, @@ -104,77 +103,43 @@ timeout_diff = TimeoutDiff} | TORs], NeedRes, Ok) -> - {NewOk, SuccessStr} = case ((0 =< TimeoutDiff) - andalso (TimeoutDiff =< max_late())) of - true -> {Ok, "succeeded"}; - false -> {failed, "FAILED"} - end, - io:format("~s timeout = ~s ms ~s! timeout diff = ~s.~n", - [type_str(Type), - time_str(Timeout), - SuccessStr, - time_str(TimeoutDiff, erlang:convert_time_unit(1, seconds, native))]), - check(TORs, NeedRes, NewOk); + case (0 =< TimeoutDiff) and (TimeoutDiff =< ?MAX_LATE) of + true -> + io:format("~p timeout = ~p succeded! timeout diff = ~p.~n", + [Type, Timeout, TimeoutDiff]), + check(TORs, NeedRes, Ok); + false -> + io:format("~p timeout = ~p failed! timeout diff = ~p.~n", + [Type, Timeout, TimeoutDiff]), + check(TORs, NeedRes, failed) + end; check([], _NeedRes, Ok) -> Ok. -type_str(receive_after) -> "receive ... after"; -type_str(bif_timer) -> "BIF timer"; -type_str(driver) -> "driver". - -time_str(Time, Unit) -> - lists:flatten([time_str(Time), " ", unit_str(Unit)]). - -time_str(Time) -> - lists:reverse(conv_time_str(lists:reverse(integer_to_list(Time)))). - -conv_time_str([X,Y,Z,C|Cs]) when C /= $- -> - [X,Y,Z,$`|conv_time_str([C|Cs])]; -conv_time_str(Cs) -> - Cs. - -unit_str(1) -> "s"; -unit_str(1000) -> "ms"; -unit_str(1000000) -> "us"; -unit_str(1000000000) -> "ns"; -unit_str(Res) when is_integer(Res) -> ["/ ", integer_to_list(Res), " s"]; -unit_str(Res) -> Res. - -to_diff(Timeout, Start, Stop) -> - %% 'Timeout' in milli seconds - %% 'Start', 'Stop', and result in native unit - (Stop - Start) - erlang:convert_time_unit(Timeout, milli_seconds, native). - -ms(Time) -> - erlang:convert_time_unit(Time, native, milli_seconds). - -max_late() -> - erlang:convert_time_unit(?MAX_LATE_MS, milli_seconds, native). - receive_after(Timeout) -> - Start = erlang:monotonic_time(), + Start = now(), receive {get_result, ?REG_NAME} -> ?REG_NAME ! #timeout_rec{pid = self(), type = receive_after, timeout = Timeout} after Timeout -> - Stop = erlang:monotonic_time(), + Stop = now(), receive {get_result, ?REG_NAME} -> + TimeoutDiff = ((timer:now_diff(Stop, Start) div 1000) + - Timeout), ?REG_NAME ! #timeout_rec{pid = self(), type = receive_after, timeout = Timeout, - timeout_diff = to_diff(Timeout, - Start, - Stop)} + timeout_diff = TimeoutDiff} end end. driver(Timeout) -> Port = open_port({spawn, ?DRV_NAME},[]), link(Port), - Start = erlang:monotonic_time(), + Start = now(), erlang:port_command(Port, <>), receive {get_result, ?REG_NAME} -> @@ -182,38 +147,38 @@ type = driver, timeout = Timeout}; {Port,{data,[?TIMER]}} -> - Stop = erlang:monotonic_time(), + Stop = now(), unlink(Port), true = erlang:port_close(Port), receive {get_result, ?REG_NAME} -> + TimeoutDiff = ((timer:now_diff(Stop, Start) div 1000) + - Timeout), ?REG_NAME ! #timeout_rec{pid = self(), type = driver, timeout = Timeout, - timeout_diff = to_diff(Timeout, - Start, - Stop)} + timeout_diff = TimeoutDiff} end end. bif_timer(Timeout) -> - Start = erlang:monotonic_time(), Tmr = erlang:start_timer(Timeout, self(), ok), + Start = now(), receive {get_result, ?REG_NAME} -> ?REG_NAME ! #timeout_rec{pid = self(), type = bif_timer, timeout = Timeout}; {timeout, Tmr, ok} -> - Stop = erlang:monotonic_time(), + Stop = now(), receive {get_result, ?REG_NAME} -> + TimeoutDiff = ((timer:now_diff(Stop, Start) div 1000) + - Timeout), ?REG_NAME ! #timeout_rec{pid = self(), type = bif_timer, timeout = Timeout, - timeout_diff = to_diff(Timeout, - Start, - Stop)} + timeout_diff = TimeoutDiff} end end. @@ -224,7 +189,7 @@ register(?REG_NAME, self()), {group_leader, GL} = process_info(whereis(net_kernel),group_leader), group_leader(GL, self()), - Start = erlang:monotonic_time(), + Start = now(), TORs = lists:map(fun (Min) -> TO = Min*60*1000, [#timeout_rec{pid = spawn_opt( @@ -257,7 +222,7 @@ test_loop(TORs, Start) -> receive {get_result, ?REG_NAME, Pid} -> - End = erlang:monotonic_time(), + End = now(), Pid ! {result, ?REG_NAME, get_test_results(TORs), Start, End}, erl_ddll:unload_driver(?DRV_NAME), erl_ddll:stop(), diff -Nru erlang-18.2-dfsg/erts/emulator/test/Makefile erlang-17.3-dfsg/erts/emulator/test/Makefile --- erlang-18.2-dfsg/erts/emulator/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -109,7 +108,6 @@ trace_call_time_SUITE \ scheduler_SUITE \ old_scheduler_SUITE \ - unique_SUITE \ z_SUITE \ old_mod \ long_timers_test \ @@ -126,8 +124,7 @@ bs_match_tail \ bs_match_misc \ bs_utf \ - guard \ - map + guard NATIVE= hibernate Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/emulator/test/map_SUITE_data/badmap_17.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/emulator/test/map_SUITE_data/badmap_17.beam differ diff -Nru erlang-18.2-dfsg/erts/emulator/test/map_SUITE_data/badmap_17.erl erlang-17.3-dfsg/erts/emulator/test/map_SUITE_data/badmap_17.erl --- erlang-18.2-dfsg/erts/emulator/test/map_SUITE_data/badmap_17.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/map_SUITE_data/badmap_17.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ --module(badmap_17). --export([update/1]). - -%% Compile this source file with OTP 17. - -update(Map) -> - try - update_1(Map), - error(update_did_not_fail) - catch - error:{badmap,Map} -> - ok - end, - try - update_2(Map), - error(update_did_not_fail) - catch - error:{badmap,Map} -> - ok - end. - -update_1(M) -> - M#{a=>42}. - -update_2(M) -> - M#{a:=42}. diff -Nru erlang-18.2-dfsg/erts/emulator/test/map_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/map_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/map_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/map_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -2,17 +2,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -22,24 +21,17 @@ ]). -export([ - t_build_and_match_literals/1, t_build_and_match_literals_large/1, - t_update_literals/1, t_update_literals_large/1, - t_match_and_update_literals/1, t_match_and_update_literals_large/1, + t_build_and_match_literals/1, + t_update_literals/1,t_match_and_update_literals/1, t_update_map_expressions/1, - t_update_assoc/1, t_update_assoc_large/1, - t_update_exact/1, t_update_exact_large/1, - t_guard_bifs/1, - t_guard_sequence/1, t_guard_sequence_large/1, - t_guard_update/1, t_guard_update_large/1, - t_guard_receive/1, t_guard_receive_large/1, - t_guard_fun/1, - t_update_deep/1, + t_update_assoc/1,t_update_exact/1, + t_guard_bifs/1, t_guard_sequence/1, t_guard_update/1, + t_guard_receive/1, t_guard_fun/1, t_list_comprehension/1, t_map_sort_literals/1, t_map_equal/1, - t_map_compare/1, + %t_size/1, t_map_size/1, - t_is_map/1, %% Specific Map BIFs t_bif_map_get/1, @@ -58,11 +50,6 @@ %% erlang t_erlang_hash/1, t_map_encode_decode/1, - t_gc_rare_map_overflow/1, - - %% non specific BIF related - t_bif_build_and_check/1, - t_bif_merge_and_check/1, %% maps module not bifs t_maps_fold/1, @@ -71,45 +58,24 @@ t_maps_without/1, %% misc - t_hashmap_balance/1, - t_erts_internal_order/1, - t_erts_internal_hash/1, t_pdict/1, t_ets/1, t_dets/1, - t_tracing/1, - - %% instruction-level tests - t_has_map_fields/1, - y_regs/1, - badmap_17/1 + t_tracing/1 ]). -include_lib("stdlib/include/ms_transform.hrl"). --define(CHECK(Cond,Term), - case (catch (Cond)) of - true -> true; - _ -> io:format("###### CHECK FAILED ######~nINPUT: ~p~n", [Term]), - exit(Term) - end). - suite() -> []. all() -> [ - t_build_and_match_literals, t_build_and_match_literals_large, - t_update_literals, t_update_literals_large, - t_match_and_update_literals, t_match_and_update_literals_large, + t_build_and_match_literals, + t_update_literals, t_match_and_update_literals, t_update_map_expressions, - t_update_assoc, t_update_assoc_large, - t_update_exact, t_update_exact_large, - t_guard_bifs, - t_guard_sequence, t_guard_sequence_large, - t_guard_update, t_guard_update_large, - t_guard_receive, t_guard_receive_large, - t_guard_fun, t_list_comprehension, - t_update_deep, - t_map_equal, t_map_compare, + t_update_assoc,t_update_exact, + t_guard_bifs, t_guard_sequence, t_guard_update, + t_guard_receive,t_guard_fun, t_list_comprehension, + t_map_equal, t_map_sort_literals, %% Specific Map BIFs @@ -122,12 +88,7 @@ %% erlang t_erlang_hash, t_map_encode_decode, - t_gc_rare_map_overflow, - t_map_size, t_is_map, - - %% non specific BIF related - t_bif_build_and_check, - t_bif_merge_and_check, + t_map_size, %% maps module t_maps_fold, t_maps_map, @@ -135,17 +96,9 @@ %% Other functions - t_hashmap_balance, - t_erts_internal_order, - t_erts_internal_hash, t_pdict, t_ets, - t_tracing, - - %% instruction-level tests - t_has_map_fields, - y_regs, - badmap_17 + t_tracing ]. groups() -> []. @@ -171,9 +124,6 @@ #{1:=a,2:=b,3:="c","4":="d",<<"5">>:=<<"e">>,{"6",7}:="f",8:=g} = id(#{1=>a,2=>b,3=>"c","4"=>"d",<<"5">>=><<"e">>,{"6",7}=>"f",8=>g}), - #{[]:=a,42.0:=b,x:={x,y},[a,b]:=list} = - id(#{[]=>a,42.0=>b,x=>{x,y},[a,b]=>list}), - #{<<"hi all">> := 1} = id(#{<<"hi",32,"all">> => 1}), #{a:=X,a:=X=3,b:=4} = id(#{a=>3,b=>4}), % weird but ok =) @@ -195,461 +145,17 @@ {'EXIT',{{badmatch,_},_}} = (catch (#{x:=3} = id(#{x=>"three"}))), ok. -t_build_and_match_literals_large(Config) when is_list(Config) -> - % normal non-repeating - M0 = id(#{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" }), - - #{10:=a0,20:=b0,30:="c0","40":="d0",<<"50">>:="e0",{["00"]}:="10"} = M0, - #{11:=a1,21:=b1,31:="c1","41":="d1",<<"51">>:="e1",{["01"]}:="11"} = M0, - #{12:=a2,22:=b2,32:="c2","42":="d2",<<"52">>:="e2",{["02"]}:="12"} = M0, - #{13:=a3,23:=b3,33:="c3","43":="d3",<<"53">>:="e3",{["03"]}:="13"} = M0, - #{14:=a4,24:=b4,34:="c4","44":="d4",<<"54">>:="e4",{["04"]}:="14"} = M0, - - #{15:=a5,25:=b5,35:="c5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M0, - #{16:=a6,26:=b6,36:="c6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M0, - #{17:=a7,27:=b7,37:="c7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M0, - #{18:=a8,28:=b8,38:="c8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M0, - #{19:=a9,29:=b9,39:="c9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M0, - - 60 = map_size(M0), - 60 = maps:size(M0), - - % with repeating - M1 = id(#{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 10=>na0,20=>nb0,30=>"nc0","40"=>"nd0",<<"50">>=>"ne0",{["00"]}=>"n10", - 11=>na1,21=>nb1,31=>"nc1","41"=>"nd1",<<"51">>=>"ne1",{["01"]}=>"n11", - 12=>na2,22=>nb2,32=>"nc2","42"=>"nd2",<<"52">>=>"ne2",{["02"]}=>"n12", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - - 13=>na3,23=>nb3,33=>"nc3","43"=>"nd3",<<"53">>=>"ne3",{["03"]}=>"n13", - 14=>na4,24=>nb4,34=>"nc4","44"=>"nd4",<<"54">>=>"ne4",{["04"]}=>"n14", - - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" }), - - #{10:=na0,20:=nb0,30:="nc0","40":="nd0",<<"50">>:="ne0",{["00"]}:="n10"} = M1, - #{11:=na1,21:=nb1,31:="nc1","41":="nd1",<<"51">>:="ne1",{["01"]}:="n11"} = M1, - #{12:=na2,22:=nb2,32:="nc2","42":="nd2",<<"52">>:="ne2",{["02"]}:="n12"} = M1, - #{13:=na3,23:=nb3,33:="nc3","43":="nd3",<<"53">>:="ne3",{["03"]}:="n13"} = M1, - #{14:=na4,24:=nb4,34:="nc4","44":="nd4",<<"54">>:="ne4",{["04"]}:="n14"} = M1, - - #{15:=a5,25:=b5,35:="c5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M1, - #{16:=a6,26:=b6,36:="c6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M1, - #{17:=a7,27:=b7,37:="c7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M1, - #{18:=a8,28:=b8,38:="c8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M1, - #{19:=a9,29:=b9,39:="c9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M1, - - 60 = map_size(M1), - 60 = maps:size(M1), - - % with floats - - M2 = id(#{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19", - - 10.0=>fa0,20.0=>fb0,30.0=>"fc0", - 11.0=>fa1,21.0=>fb1,31.0=>"fc1", - 12.0=>fa2,22.0=>fb2,32.0=>"fc2", - 13.0=>fa3,23.0=>fb3,33.0=>"fc3", - 14.0=>fa4,24.0=>fb4,34.0=>"fc4", - - 15.0=>fa5,25.0=>fb5,35.0=>"fc5", - 16.0=>fa6,26.0=>fb6,36.0=>"fc6", - 17.0=>fa7,27.0=>fb7,37.0=>"fc7", - 18.0=>fa8,28.0=>fb8,38.0=>"fc8", - 19.0=>fa9,29.0=>fb9,39.0=>"fc9"}), - - #{10:=a0,20:=b0,30:="c0","40":="d0",<<"50">>:="e0",{["00"]}:="10"} = M2, - #{11:=a1,21:=b1,31:="c1","41":="d1",<<"51">>:="e1",{["01"]}:="11"} = M2, - #{12:=a2,22:=b2,32:="c2","42":="d2",<<"52">>:="e2",{["02"]}:="12"} = M2, - #{13:=a3,23:=b3,33:="c3","43":="d3",<<"53">>:="e3",{["03"]}:="13"} = M2, - #{14:=a4,24:=b4,34:="c4","44":="d4",<<"54">>:="e4",{["04"]}:="14"} = M2, - - #{15:=a5,25:=b5,35:="c5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M2, - #{16:=a6,26:=b6,36:="c6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M2, - #{17:=a7,27:=b7,37:="c7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M2, - #{18:=a8,28:=b8,38:="c8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M2, - #{19:=a9,29:=b9,39:="c9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M2, - - #{10.0:=fa0,20.0:=fb0,30.0:="fc0","40":="d0",<<"50">>:="e0",{["00"]}:="10"} = M2, - #{11.0:=fa1,21.0:=fb1,31.0:="fc1","41":="d1",<<"51">>:="e1",{["01"]}:="11"} = M2, - #{12.0:=fa2,22.0:=fb2,32.0:="fc2","42":="d2",<<"52">>:="e2",{["02"]}:="12"} = M2, - #{13.0:=fa3,23.0:=fb3,33.0:="fc3","43":="d3",<<"53">>:="e3",{["03"]}:="13"} = M2, - #{14.0:=fa4,24.0:=fb4,34.0:="fc4","44":="d4",<<"54">>:="e4",{["04"]}:="14"} = M2, - - #{15.0:=fa5,25.0:=fb5,35.0:="fc5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M2, - #{16.0:=fa6,26.0:=fb6,36.0:="fc6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M2, - #{17.0:=fa7,27.0:=fb7,37.0:="fc7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M2, - #{18.0:=fa8,28.0:=fb8,38.0:="fc8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M2, - #{19.0:=fa9,29.0:=fb9,39.0:="fc9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M2, - - 90 = map_size(M2), - 90 = maps:size(M2), - - % with bignums - M3 = id(#{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19", - - 10.0=>fa0,20.0=>fb0,30.0=>"fc0", - 11.0=>fa1,21.0=>fb1,31.0=>"fc1", - 12.0=>fa2,22.0=>fb2,32.0=>"fc2", - 13.0=>fa3,23.0=>fb3,33.0=>"fc3", - 14.0=>fa4,24.0=>fb4,34.0=>"fc4", - - 15.0=>fa5,25.0=>fb5,35.0=>"fc5", - 16.0=>fa6,26.0=>fb6,36.0=>"fc6", - 17.0=>fa7,27.0=>fb7,37.0=>"fc7", - 18.0=>fa8,28.0=>fb8,38.0=>"fc8", - 19.0=>fa9,29.0=>fb9,39.0=>"fc9", - - 36893488147419103232=>big1, 73786976294838206464=>big2, - 147573952589676412928=>big3, 18446744073709551616=>big4, - 4294967296=>big5, 8589934592=>big6, - 4294967295=>big7, 67108863=>big8 - }), - - #{10:=a0,20:=b0,30:="c0","40":="d0",<<"50">>:="e0",{["00"]}:="10"} = M3, - #{11:=a1,21:=b1,31:="c1","41":="d1",<<"51">>:="e1",{["01"]}:="11"} = M3, - #{12:=a2,22:=b2,32:="c2","42":="d2",<<"52">>:="e2",{["02"]}:="12"} = M3, - #{13:=a3,23:=b3,33:="c3","43":="d3",<<"53">>:="e3",{["03"]}:="13"} = M3, - #{14:=a4,24:=b4,34:="c4","44":="d4",<<"54">>:="e4",{["04"]}:="14"} = M3, - - #{15:=a5,25:=b5,35:="c5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M3, - #{16:=a6,26:=b6,36:="c6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M3, - #{17:=a7,27:=b7,37:="c7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M3, - #{18:=a8,28:=b8,38:="c8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M3, - #{19:=a9,29:=b9,39:="c9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M3, - - #{10.0:=fa0,20.0:=fb0,30.0:="fc0","40":="d0",<<"50">>:="e0",{["00"]}:="10"} = M3, - #{11.0:=fa1,21.0:=fb1,31.0:="fc1","41":="d1",<<"51">>:="e1",{["01"]}:="11"} = M3, - #{12.0:=fa2,22.0:=fb2,32.0:="fc2","42":="d2",<<"52">>:="e2",{["02"]}:="12"} = M3, - #{13.0:=fa3,23.0:=fb3,33.0:="fc3","43":="d3",<<"53">>:="e3",{["03"]}:="13"} = M3, - #{14.0:=fa4,24.0:=fb4,34.0:="fc4","44":="d4",<<"54">>:="e4",{["04"]}:="14"} = M3, - - #{15.0:=fa5,25.0:=fb5,35.0:="fc5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M3, - #{16.0:=fa6,26.0:=fb6,36.0:="fc6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M3, - #{17.0:=fa7,27.0:=fb7,37.0:="fc7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M3, - #{18.0:=fa8,28.0:=fb8,38.0:="fc8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M3, - #{19.0:=fa9,29.0:=fb9,39.0:="fc9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M3, - - #{36893488147419103232:=big1,67108863:=big8,"45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M3, - #{147573952589676412928:=big3,8589934592:=big6,"46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M3, - #{4294967296:=big5,18446744073709551616:=big4,"47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M3, - #{4294967295:=big7,73786976294838206464:=big2,"48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M3, - - 98 = map_size(M3), - 98 = maps:size(M3), - - %% with maps - - M4 = id(#{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19", - - 10.0=>fa0,20.0=>fb0,30.0=>"fc0", - 11.0=>fa1,21.0=>fb1,31.0=>"fc1", - 12.0=>fa2,22.0=>fb2,32.0=>"fc2", - 13.0=>fa3,23.0=>fb3,33.0=>"fc3", - 14.0=>fa4,24.0=>fb4,34.0=>"fc4", - - 15.0=>fa5,25.0=>fb5,35.0=>"fc5", - 16.0=>fa6,26.0=>fb6,36.0=>"fc6", - 17.0=>fa7,27.0=>fb7,37.0=>"fc7", - 18.0=>fa8,28.0=>fb8,38.0=>"fc8", - 19.0=>fa9,29.0=>fb9,39.0=>"fc9", - - #{ one => small, map => key } => "small map key 1", - #{ second => small, map => key } => "small map key 2", - #{ third => small, map => key } => "small map key 3", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 1", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - k16=>a6,k26=>b6,k36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 2" }), - - #{10:=a0,20:=b0,30:="c0","40":="d0",<<"50">>:="e0",{["00"]}:="10"} = M4, - #{11:=a1,21:=b1,31:="c1","41":="d1",<<"51">>:="e1",{["01"]}:="11"} = M4, - #{12:=a2,22:=b2,32:="c2","42":="d2",<<"52">>:="e2",{["02"]}:="12"} = M4, - #{13:=a3,23:=b3,33:="c3","43":="d3",<<"53">>:="e3",{["03"]}:="13"} = M4, - #{14:=a4,24:=b4,34:="c4","44":="d4",<<"54">>:="e4",{["04"]}:="14"} = M4, - - #{15:=a5,25:=b5,35:="c5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M4, - #{16:=a6,26:=b6,36:="c6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M4, - #{17:=a7,27:=b7,37:="c7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M4, - #{18:=a8,28:=b8,38:="c8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M4, - #{19:=a9,29:=b9,39:="c9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M4, - - #{ #{ one => small, map => key } := "small map key 1", - #{ second => small, map => key } := "small map key 2", - #{ third => small, map => key } := "small map key 3" } = M4, - - #{ #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } := "large map key 1", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - k16=>a6,k26=>b6,k36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } := "large map key 2" } = M4, - - - #{ 15:=V1,25:=b5,35:=V2,"45":="d5",<<"55">>:=V3,{["05"]}:="15", - #{ one => small, map => key } := "small map key 1", - #{ second => small, map => key } := V4, - #{ third => small, map => key } := "small map key 3", - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } := V5 } = M4, - - a5 = V1, - "c5" = V2, - "e5" = V3, - "small map key 2" = V4, - "large map key 1" = V5, - - 95 = map_size(M4), - 95 = maps:size(M4), - - % call for value - - M5 = id(#{ 10=>id(a0),20=>b0,30=>id("c0"),"40"=>"d0",<<"50">>=>id("e0"),{["00"]}=>"10", - 11=>id(a1),21=>b1,31=>id("c1"),"41"=>"d1",<<"51">>=>id("e1"),{["01"]}=>"11", - 12=>id(a2),22=>b2,32=>id("c2"),"42"=>"d2",<<"52">>=>id("e2"),{["02"]}=>"12", - 13=>id(a3),23=>b3,33=>id("c3"),"43"=>"d3",<<"53">>=>id("e3"),{["03"]}=>"13", - 14=>id(a4),24=>b4,34=>id("c4"),"44"=>"d4",<<"54">>=>id("e4"),{["04"]}=>"14", - - 15=>id(a5),25=>b5,35=>id("c5"),"45"=>"d5",<<"55">>=>id("e5"),{["05"]}=>"15", - 16=>id(a6),26=>b6,36=>id("c6"),"46"=>"d6",<<"56">>=>id("e6"),{["06"]}=>"16", - 17=>id(a7),27=>b7,37=>id("c7"),"47"=>"d7",<<"57">>=>id("e7"),{["07"]}=>"17", - 18=>id(a8),28=>b8,38=>id("c8"),"48"=>"d8",<<"58">>=>id("e8"),{["08"]}=>"18", - 19=>id(a9),29=>b9,39=>id("c9"),"49"=>"d9",<<"59">>=>id("e9"),{["09"]}=>"19", - - 10.0=>fa0,20.0=>id(fb0),30.0=>id("fc0"), - 11.0=>fa1,21.0=>id(fb1),31.0=>id("fc1"), - 12.0=>fa2,22.0=>id(fb2),32.0=>id("fc2"), - 13.0=>fa3,23.0=>id(fb3),33.0=>id("fc3"), - 14.0=>fa4,24.0=>id(fb4),34.0=>id("fc4"), - - 15.0=>fa5,25.0=>id(fb5),35.0=>id("fc5"), - 16.0=>fa6,26.0=>id(fb6),36.0=>id("fc6"), - 17.0=>fa7,27.0=>id(fb7),37.0=>id("fc7"), - 18.0=>fa8,28.0=>id(fb8),38.0=>id("fc8"), - 19.0=>fa9,29.0=>id(fb9),39.0=>id("fc9"), - - #{ one => small, map => key } => id("small map key 1"), - #{ second => small, map => key } => "small map key 2", - #{ third => small, map => key } => "small map key 3", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 1", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - k16=>a6,k26=>b6,k36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => id("large map key 2") }), - - #{10:=a0,20:=b0,30:="c0","40":="d0",<<"50">>:="e0",{["00"]}:="10"} = M5, - #{11:=a1,21:=b1,31:="c1","41":="d1",<<"51">>:="e1",{["01"]}:="11"} = M5, - #{12:=a2,22:=b2,32:="c2","42":="d2",<<"52">>:="e2",{["02"]}:="12"} = M5, - #{13:=a3,23:=b3,33:="c3","43":="d3",<<"53">>:="e3",{["03"]}:="13"} = M5, - #{14:=a4,24:=b4,34:="c4","44":="d4",<<"54">>:="e4",{["04"]}:="14"} = M5, - - #{15:=a5,25:=b5,35:="c5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M5, - #{16:=a6,26:=b6,36:="c6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M5, - #{17:=a7,27:=b7,37:="c7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M5, - #{18:=a8,28:=b8,38:="c8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M5, - #{19:=a9,29:=b9,39:="c9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M5, - - #{ #{ one => small, map => key } := "small map key 1", - #{ second => small, map => key } := "small map key 2", - #{ third => small, map => key } := "small map key 3" } = M5, - - #{ #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } := "large map key 1", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - k16=>a6,k26=>b6,k36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } := "large map key 2" } = M5, - - 95 = map_size(M5), - 95 = maps:size(M5), - - %% remember - - #{10:=a0,20:=b0,30:="c0","40":="d0",<<"50">>:="e0",{["00"]}:="10"} = M0, - #{11:=a1,21:=b1,31:="c1","41":="d1",<<"51">>:="e1",{["01"]}:="11"} = M0, - #{12:=a2,22:=b2,32:="c2","42":="d2",<<"52">>:="e2",{["02"]}:="12"} = M0, - #{13:=a3,23:=b3,33:="c3","43":="d3",<<"53">>:="e3",{["03"]}:="13"} = M0, - #{14:=a4,24:=b4,34:="c4","44":="d4",<<"54">>:="e4",{["04"]}:="14"} = M0, - - #{10:=na0,20:=nb0,30:="nc0","40":="nd0",<<"50">>:="ne0",{["00"]}:="n10"} = M1, - #{11:=na1,21:=nb1,31:="nc1","41":="nd1",<<"51">>:="ne1",{["01"]}:="n11"} = M1, - #{12:=na2,22:=nb2,32:="nc2","42":="nd2",<<"52">>:="ne2",{["02"]}:="n12"} = M1, - #{13:=na3,23:=nb3,33:="nc3","43":="nd3",<<"53">>:="ne3",{["03"]}:="n13"} = M1, - #{14:=na4,24:=nb4,34:="nc4","44":="nd4",<<"54">>:="ne4",{["04"]}:="n14"} = M1, - - #{15:=a5,25:=b5,35:="c5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M1, - #{16:=a6,26:=b6,36:="c6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M1, - #{17:=a7,27:=b7,37:="c7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M1, - #{18:=a8,28:=b8,38:="c8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M1, - #{19:=a9,29:=b9,39:="c9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M1, - - #{15:=a5,25:=b5,35:="c5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M2, - #{16:=a6,26:=b6,36:="c6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M2, - #{17:=a7,27:=b7,37:="c7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M2, - #{18:=a8,28:=b8,38:="c8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M2, - #{19:=a9,29:=b9,39:="c9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M2, - - #{10.0:=fa0,20.0:=fb0,30.0:="fc0","40":="d0",<<"50">>:="e0",{["00"]}:="10"} = M2, - #{11.0:=fa1,21.0:=fb1,31.0:="fc1","41":="d1",<<"51">>:="e1",{["01"]}:="11"} = M2, - #{12.0:=fa2,22.0:=fb2,32.0:="fc2","42":="d2",<<"52">>:="e2",{["02"]}:="12"} = M2, - #{13.0:=fa3,23.0:=fb3,33.0:="fc3","43":="d3",<<"53">>:="e3",{["03"]}:="13"} = M2, - #{14.0:=fa4,24.0:=fb4,34.0:="fc4","44":="d4",<<"54">>:="e4",{["04"]}:="14"} = M2, - - #{15:=a5,25:=b5,35:="c5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M3, - #{16:=a6,26:=b6,36:="c6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M3, - #{17:=a7,27:=b7,37:="c7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M3, - #{18:=a8,28:=b8,38:="c8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M3, - #{19:=a9,29:=b9,39:="c9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M3, - - #{10.0:=fa0,20.0:=fb0,30.0:="fc0","40":="d0",<<"50">>:="e0",{["00"]}:="10"} = M3, - #{11.0:=fa1,21.0:=fb1,31.0:="fc1","41":="d1",<<"51">>:="e1",{["01"]}:="11"} = M3, - #{12.0:=fa2,22.0:=fb2,32.0:="fc2","42":="d2",<<"52">>:="e2",{["02"]}:="12"} = M3, - #{13.0:=fa3,23.0:=fb3,33.0:="fc3","43":="d3",<<"53">>:="e3",{["03"]}:="13"} = M3, - #{14.0:=fa4,24.0:=fb4,34.0:="fc4","44":="d4",<<"54">>:="e4",{["04"]}:="14"} = M3, - - #{15.0:=fa5,25.0:=fb5,35.0:="fc5","45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M3, - #{16.0:=fa6,26.0:=fb6,36.0:="fc6","46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M3, - #{17.0:=fa7,27.0:=fb7,37.0:="fc7","47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M3, - #{18.0:=fa8,28.0:=fb8,38.0:="fc8","48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M3, - #{19.0:=fa9,29.0:=fb9,39.0:="fc9","49":="d9",<<"59">>:="e9",{["09"]}:="19"} = M3, - - #{36893488147419103232:=big1,67108863:=big8,"45":="d5",<<"55">>:="e5",{["05"]}:="15"} = M3, - #{147573952589676412928:=big3,8589934592:=big6,"46":="d6",<<"56">>:="e6",{["06"]}:="16"} = M3, - #{4294967296:=big5,18446744073709551616:=big4,"47":="d7",<<"57">>:="e7",{["07"]}:="17"} = M3, - #{4294967295:=big7,73786976294838206464:=big2,"48":="d8",<<"58">>:="e8",{["08"]}:="18"} = M3, - ok. +%% Tests size(Map). +%% not implemented, perhaps it shouldn't be either +%t_size(Config) when is_list(Config) -> +% 0 = size(#{}), +% 1 = size(#{a=>1}), +% 1 = size(#{a=>#{a=>1}}), +% 2 = size(#{a=>1, b=>2}), +% 3 = size(#{a=>1, b=>2, b=>"3"}), +% ok. t_map_size(Config) when is_list(Config) -> 0 = map_size(id(#{})), @@ -666,108 +172,16 @@ true = map_is_size(M#{ "a" => 2}, 2), false = map_is_size(M#{ "c" => 2}, 2), - Ks = [build_key(fun(K) -> <<1,K:32,1>> end,I)||I<-lists:seq(1,100)], - ok = build_and_check_size(Ks,0,#{}), - - %% try deep collisions - %% statistically we get another subtree at 50k -> 100k elements - %% Try to be nice and don't use too much memory in the testcase, - - N = 500000, - Is = lists:seq(1,N), - N = map_size(maps:from_list([{I,I}||I<-Is])), - N = map_size(maps:from_list([{<>,I}||I<-Is])), - N = map_size(maps:from_list([{integer_to_list(I),I}||I<-Is])), - N = map_size(maps:from_list([{float(I),I}||I<-Is])), - %% Error cases. - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},_}} = - (catch map_size(T)) - end), - ok. - -build_and_check_size([K|Ks],N,M0) -> - N = map_size(M0), - M1 = M0#{ K => K }, - build_and_check_size(Ks,N + 1,M1); -build_and_check_size([],N,M) -> - N = map_size(M), + {'EXIT',{badarg,_}} = (catch map_size([])), + {'EXIT',{badarg,_}} = (catch map_size(<<1,2,3>>)), + {'EXIT',{badarg,_}} = (catch map_size(1)), ok. map_is_size(M,N) when map_size(M) =:= N -> true; map_is_size(_,_) -> false. -t_is_map(Config) when is_list(Config) -> - true = is_map(#{}), - true = is_map(#{a=>1}), - false = is_map({a,b}), - false = is_map(x), - if is_map(#{}) -> ok end, - if is_map(#{b=>1}) -> ok end, - if not is_map([1,2,3]) -> ok end, - if not is_map(x) -> ok end, - ok. - % test map updates without matching -t_update_literals_large(Config) when is_list(Config) -> - Map = id(#{ 10=>id(a0),20=>b0,30=>id("c0"),"40"=>"d0",<<"50">>=>id("e0"),{["00"]}=>"10", - 11=>id(a1),21=>b1,31=>id("c1"),"41"=>"d1",<<"51">>=>id("e1"),{["01"]}=>"11", - 12=>id(a2),22=>b2,32=>id("c2"),"42"=>"d2",<<"52">>=>id("e2"),{["02"]}=>"12", - 13=>id(a3),23=>b3,33=>id("c3"),"43"=>"d3",<<"53">>=>id("e3"),{["03"]}=>"13", - 14=>id(a4),24=>b4,34=>id("c4"),"44"=>"d4",<<"54">>=>id("e4"),{["04"]}=>"14", - - 15=>id(a5),25=>b5,35=>id("c5"),"45"=>"d5",<<"55">>=>id("e5"),{["05"]}=>"15", - 16=>id(a6),26=>b6,36=>id("c6"),"46"=>"d6",<<"56">>=>id("e6"),{["06"]}=>"16", - 17=>id(a7),27=>b7,37=>id("c7"),"47"=>"d7",<<"57">>=>id("e7"),{["07"]}=>"17", - 18=>id(a8),28=>b8,38=>id("c8"),"48"=>"d8",<<"58">>=>id("e8"),{["08"]}=>"18", - 19=>id(a9),29=>b9,39=>id("c9"),"49"=>"d9",<<"59">>=>id("e9"),{["09"]}=>"19", - - 10.0=>fa0,20.0=>id(fb0),30.0=>id("fc0"), - 11.0=>fa1,21.0=>id(fb1),31.0=>id("fc1"), - 12.0=>fa2,22.0=>id(fb2),32.0=>id("fc2"), - 13.0=>fa3,23.0=>id(fb3),33.0=>id("fc3"), - 14.0=>fa4,24.0=>id(fb4),34.0=>id("fc4"), - - 15.0=>fa5,25.0=>id(fb5),35.0=>id("fc5"), - 16.0=>fa6,26.0=>id(fb6),36.0=>id("fc6"), - 17.0=>fa7,27.0=>id(fb7),37.0=>id("fc7"), - 18.0=>fa8,28.0=>id(fb8),38.0=>id("fc8"), - 19.0=>fa9,29.0=>id(fb9),39.0=>id("fc9"), - - #{ one => small, map => key } => id("small map key 1"), - #{ second => small, map => key } => "small map key 2", - #{ third => small, map => key } => "small map key 3", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 1", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - k16=>a6,k26=>b6,k36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => id("large map key 2") }), - - #{x:="d",q:="4"} = loop_update_literals_x_q(Map, [ - {"a","1"},{"b","2"},{"c","3"},{"d","4"} - ]), - ok. - t_update_literals(Config) when is_list(Config) -> Map = #{x=>1,y=>2,z=>3,q=>4}, #{x:="d",q:="4"} = loop_update_literals_x_q(Map, [ @@ -775,15 +189,13 @@ ]), ok. - loop_update_literals_x_q(Map, []) -> Map; loop_update_literals_x_q(Map, [{X,Q}|Vs]) -> loop_update_literals_x_q(Map#{q=>Q,x=>X},Vs). % test map updates with matching t_match_and_update_literals(Config) when is_list(Config) -> - Map = #{ x=>0,y=>"untouched",z=>"also untouched",q=>1, - #{ "one" => small, map => key } => "small map key 1" }, + Map = #{x=>0,y=>"untouched",z=>"also untouched",q=>1}, #{x:=16,q:=21,y:="untouched",z:="also untouched"} = loop_match_and_update_literals_x_q(Map, [ {1,2},{3,4},{5,6},{7,8} ]), @@ -797,78 +209,8 @@ #{ 4 := another_number, int := 3 } = M2#{ 4 => another_number }, ok. -t_match_and_update_literals_large(Config) when is_list(Config) -> - Map = id(#{ 10=>id(a0),20=>b0,30=>id("c0"),"40"=>"d0",<<"50">>=>id("e0"),{["00"]}=>"10", - 11=>id(a1),21=>b1,31=>id("c1"),"41"=>"d1",<<"51">>=>id("e1"),{["01"]}=>"11", - 12=>id(a2),22=>b2,32=>id("c2"),"42"=>"d2",<<"52">>=>id("e2"),{["02"]}=>"12", - 13=>id(a3),23=>b3,33=>id("c3"),"43"=>"d3",<<"53">>=>id("e3"),{["03"]}=>"13", - 14=>id(a4),24=>b4,34=>id("c4"),"44"=>"d4",<<"54">>=>id("e4"),{["04"]}=>"14", - - 15=>id(a5),25=>b5,35=>id("c5"),"45"=>"d5",<<"55">>=>id("e5"),{["05"]}=>"15", - 16=>id(a6),26=>b6,36=>id("c6"),"46"=>"d6",<<"56">>=>id("e6"),{["06"]}=>"16", - 17=>id(a7),27=>b7,37=>id("c7"),"47"=>"d7",<<"57">>=>id("e7"),{["07"]}=>"17", - 18=>id(a8),28=>b8,38=>id("c8"),"48"=>"d8",<<"58">>=>id("e8"),{["08"]}=>"18", - 19=>id(a9),29=>b9,39=>id("c9"),"49"=>"d9",<<"59">>=>id("e9"),{["09"]}=>"19", - - 10.0=>fa0,20.0=>id(fb0),30.0=>id("fc0"), - 11.0=>fa1,21.0=>id(fb1),31.0=>id("fc1"), - 12.0=>fa2,22.0=>id(fb2),32.0=>id("fc2"), - 13.0=>fa3,23.0=>id(fb3),33.0=>id("fc3"), - 14.0=>fa4,24.0=>id(fb4),34.0=>id("fc4"), - - 15.0=>fa5,25.0=>id(fb5),35.0=>id("fc5"), - 16.0=>fa6,26.0=>id(fb6),36.0=>id("fc6"), - 17.0=>fa7,27.0=>id(fb7),37.0=>id("fc7"), - 18.0=>fa8,28.0=>id(fb8),38.0=>id("fc8"), - 19.0=>fa9,29.0=>id(fb9),39.0=>id("fc9"), - - x=>0,y=>"untouched",z=>"also untouched",q=>1, - - #{ "one" => small, map => key } => id("small map key 1"), - #{ second => small, map => key } => "small map key 2", - #{ third => small, map => key } => "small map key 3", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 1", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - k16=>a6,k26=>b6,k36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => id("large map key 2") }), - - #{x:=16,q:=21,y:="untouched",z:="also untouched"} = loop_match_and_update_literals_x_q(Map, [ - {1,2},{3,4},{5,6},{7,8} - ]), - M0 = id(Map#{ "hi" => "hello", int => 3, <<"key">> => <<"value">>, - 4 => number, 18446744073709551629 => wat}), - M1 = id(Map#{}), - M2 = M1#{ "hi" => "hello", int => 3, <<"key">> => <<"value">>, - 4 => number, 18446744073709551629 => wat}, - M0 = M2, - - #{ 4 := another_number, int := 3 } = M2#{ 4 => another_number }, - ok. - - loop_match_and_update_literals_x_q(Map, []) -> Map; -loop_match_and_update_literals_x_q(#{ q:=Q0, x:=X0, - #{ "one" => small, map => key } := "small map key 1" } = Map, [{X,Q}|Vs]) -> +loop_match_and_update_literals_x_q(#{q:=Q0,x:=X0} = Map, [{X,Q}|Vs]) -> loop_match_and_update_literals_x_q(Map#{q=>Q0+Q,x=>X0+X},Vs). @@ -880,17 +222,13 @@ #{ a :=42, b:=42, c:=42 } = (maps:from_list([{a,1},{b,2},{c,3}]))#{ a := 42, b := 42, c := 42 }, #{ "a" :=1, "b":=42, "c":=42 } = (maps:from_list([{"a",1},{"b",2}]))#{ "b" := 42, "c" => 42 }, - Ks = lists:seq($a,$z), - #{ "aa" := {$a,$a}, "ac":=41, "dc":=42 } = - (maps:from_list([{[K1,K2],{K1,K2}}|| K1 <- Ks, K2 <- Ks]))#{ "ac" := 41, "dc" => 42 }, - %% Error cases. - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},_}} = - (catch (T)#{a:=42,b=>2}) - end), + %% Error cases, FIXME: should be 'badmap'? + {'EXIT',{badarg,_}} = (catch (id(<<>>))#{ a := 42, b => 2 }), + {'EXIT',{badarg,_}} = (catch (id([]))#{ a := 42, b => 2 }), ok. + t_update_assoc(Config) when is_list(Config) -> M0 = id(#{1=>a,2=>b,3.0=>c,4=>d,5=>e}), @@ -903,75 +241,8 @@ M2 = M0#{3.0:=wrong,3.0=>new}, %% Errors cases. - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},_}} = - (catch T#{nonexisting=>val}) - end), - ok. - - -t_update_assoc_large(Config) when is_list(Config) -> - M0 = id(#{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19", - - 10.0=>fa0,20.0=>fb0,30.0=>"fc0", - 11.0=>fa1,21.0=>fb1,31.0=>"fc1", - 12.0=>fa2,22.0=>fb2,32.0=>"fc2", - 13.0=>fa3,23.0=>fb3,33.0=>"fc3", - 14.0=>fa4,24.0=>fb4,34.0=>"fc4", - - 15.0=>fa5,25.0=>fb5,35.0=>"fc5", - 16.0=>fa6,26.0=>fb6,36.0=>"fc6", - 17.0=>fa7,27.0=>fb7,37.0=>"fc7", - 18.0=>fa8,28.0=>fb8,38.0=>"fc8", - 19.0=>fa9,29.0=>fb9,39.0=>"fc9", - - #{ one => small, map => key } => "small map key 1", - #{ second => small, map => key } => "small map key 2", - #{ third => small, map => key } => "small map key 3", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 1", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - k16=>a6,k26=>b6,k36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 2" }), - - - M1 = M0#{1=>42,2=>100,4=>[a,b,c]}, - #{1:=42,2:=100,10.0:=fa0,4:=[a,b,c],25:=b5} = M1, - #{ 10:=43, 24:=b4, 15:=a5, 35:="c5", 2.0:=100, 13.0:=fa3, 4.0:=[a,b,c]} = - M0#{1.0=>float,10:=43,2.0=>wrong,2.0=>100,4.0=>[a,b,c]}, - - M2 = M0#{13.0=>new}, - #{10:=a0,20:=b0,13.0:=new,"40":="d0",<<"50">>:="e0"} = M2, - M2 = M0#{13.0:=wrong,13.0=>new}, + BadMap = id(badmap), + {'EXIT',{badarg,_}} = (catch BadMap#{nonexisting=>val}), ok. @@ -994,122 +265,13 @@ 1 := update2, 1.0 := new_val2, 1.0 => new_val3, 1.0 => new_val4 }, - %% Errors cases. - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},_}} = - (catch T#{nonexisting=>val}) - end), - Empty = id(#{}), - {'EXIT',{{badkey,nonexisting},_}} = (catch Empty#{nonexisting:=val}), - {'EXIT',{{badkey,nonexisting},_}} = (catch M0#{nonexisting:=val}), - {'EXIT',{{badkey,1.0},_}} = (catch M0#{1.0:=v,1.0=>v2}), - {'EXIT',{{badkey,42},_}} = (catch M0#{42.0:=v,42:=v2}), - {'EXIT',{{badkey,42.0},_}} = (catch M0#{42=>v1,42.0:=v2,42:=v3}), - - ok. - -t_update_exact_large(Config) when is_list(Config) -> - M0 = id(#{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19", - - 10.0=>fa0,20.0=>fb0,30.0=>"fc0", - 11.0=>fa1,21.0=>fb1,31.0=>"fc1", - 12.0=>fa2,22.0=>fb2,32.0=>"fc2", - 13.0=>fa3,23.0=>fb3,33.0=>"fc3", - 14.0=>fa4,24.0=>fb4,34.0=>"fc4", - - 15.0=>fa5,25.0=>fb5,35.0=>"fc5", - 16.0=>fa6,26.0=>fb6,36.0=>"fc6", - 17.0=>fa7,27.0=>fb7,37.0=>"fc7", - 18.0=>fa8,28.0=>fb8,38.0=>"fc8", - 19.0=>fa9,29.0=>fb9,39.0=>"fc9", - - #{ one => small, map => key } => "small map key 1", - #{ second => small, map => key } => "small map key 2", - #{ third => small, map => key } => "small map key 3", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 1", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - k16=>a6,k26=>b6,k36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 2" }), - - - M1 = M0#{10:=42,<<"55">>:=100,10.0:=[a,b,c]}, - #{ 10:=42,<<"55">>:=100,{["05"]}:="15",10.0:=[a,b,c], - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } := "large map key 1" } = M1, - - M1 = M0#{10:=wrong,10=>42,<<"55">>=>wrong,<<"55">>:=100,10.0:=[a,b,c]}, - - M2 = M0#{13.0:=new}, - #{10:=a0,20:=b0,13.0:=new} = M2, - M2 = M0#{13.0=>wrong,13.0:=new}, %% Errors cases. - {'EXIT',{{badkey,nonexisting},_}} = (catch M0#{nonexisting:=val}), - {'EXIT',{{badkey,1.0},_}} = (catch M0#{1.0:=v,1.0=>v2}), - {'EXIT',{{badkey,42},_}} = (catch M0#{42.0:=v,42:=v2}), - {'EXIT',{{badkey,42.0},_}} = (catch M0#{42=>v1,42.0:=v2,42:=v3}), - - ok. + {'EXIT',{badarg,_}} = (catch M0#{nonexisting:=val}), + {'EXIT',{badarg,_}} = (catch M0#{1.0:=v,1.0=>v2}), + {'EXIT',{badarg,_}} = (catch M0#{42.0:=v,42:=v2}), + {'EXIT',{badarg,_}} = (catch M0#{42=>v1,42.0:=v2,42:=v3}), -t_update_deep(Config) when is_list(Config) -> - N = 250000, - M0 = maps:from_list([{integer_to_list(I),a}||I<-lists:seq(1,N)]), - #{ "1" := a, "10" := a, "100" := a, "1000" := a, "10000" := a } = M0, - - M1 = M0#{ "1" := b, "10" := b, "100" := b, "1000" := b, "10000" := b }, - #{ "1" := a, "10" := a, "100" := a, "1000" := a, "10000" := a } = M0, - #{ "1" := b, "10" := b, "100" := b, "1000" := b, "10000" := b } = M1, - - M2 = M0#{ "1" => c, "10" => c, "100" => c, "1000" => c, "10000" => c }, - #{ "1" := a, "10" := a, "100" := a, "1000" := a, "10000" := a } = M0, - #{ "1" := b, "10" := b, "100" := b, "1000" := b, "10000" := b } = M1, - #{ "1" := c, "10" := c, "100" := c, "1000" := c, "10000" := c } = M2, - - M3 = M2#{ "n1" => d, "n10" => d, "n100" => d, "n1000" => d, "n10000" => d }, - #{ "1" := a, "10" := a, "100" := a, "1000" := a, "10000" := a } = M0, - #{ "1" := b, "10" := b, "100" := b, "1000" := b, "10000" := b } = M1, - #{ "1" := c, "10" := c, "100" := c, "1000" := c, "10000" := c } = M2, - #{ "1" := c, "10" := c, "100" := c, "1000" := c, "10000" := c } = M3, - #{ "n1" := d, "n10" := d, "n100" := d, "n1000" := d, "n10000" := d } = M3, ok. t_guard_bifs(Config) when is_list(Config) -> @@ -1141,82 +303,12 @@ {3,gg,M3} = map_guard_sequence_2(M3 = id(#{a=>gg, b=>4})), {4,sc,sc,M4} = map_guard_sequence_2(M4 = id(#{a=>sc, b=>3, c=>sc2})), {5,kk,kk,M5} = map_guard_sequence_2(M5 = id(#{a=>kk, b=>other, c=>sc2})), - + %% error case {'EXIT',{function_clause,_}} = (catch map_guard_sequence_1(#{seq=>6,val=>id("e")})), {'EXIT',{function_clause,_}} = (catch map_guard_sequence_2(#{b=>5})), ok. -t_guard_sequence_large(Config) when is_list(Config) -> - M0 = id(#{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00",03]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01",03]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02",03]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03",03]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04",03]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05",03]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06",03]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07",03]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08",03]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09",03]}=>"19", - - 10.0=>fa0,20.0=>fb0,30.0=>"fc0", - 11.0=>fa1,21.0=>fb1,31.0=>"fc1", - 12.0=>fa2,22.0=>fb2,32.0=>"fc2", - 13.0=>fa3,23.0=>fb3,33.0=>"fc3", - 14.0=>fa4,24.0=>fb4,34.0=>"fc4", - - 15.0=>fa5,25.0=>fb5,35.0=>"fc5", - 16.0=>fa6,26.0=>fb6,36.0=>"fc6", - 17.0=>fa7,27.0=>fb7,37.0=>"fc7", - 18.0=>fa8,28.0=>fb8,38.0=>"fc8", - 19.0=>fa9,29.0=>fb9,39.0=>"fc9", - - #{ one => small, map => key } => "small map key 1", - #{ second => small, map => key } => "small map key 2", - #{ third => small, map => key } => "small map key 3", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 1", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - k16=>a6,k26=>b6,k36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 2" }), - - {1, "a"} = map_guard_sequence_1(M0#{seq=>1,val=>id("a")}), - {2, "b"} = map_guard_sequence_1(M0#{seq=>2,val=>id("b")}), - {3, "c"} = map_guard_sequence_1(M0#{seq=>3,val=>id("c")}), - {4, "d"} = map_guard_sequence_1(M0#{seq=>4,val=>id("d")}), - {5, "e"} = map_guard_sequence_1(M0#{seq=>5,val=>id("e")}), - - {1,M1} = map_guard_sequence_2(M1 = id(M0#{a=>3})), - {2,M2} = map_guard_sequence_2(M2 = id(M0#{a=>4, b=>4})), - {3,gg,M3} = map_guard_sequence_2(M3 = id(M0#{a=>gg, b=>4})), - {4,sc,sc,M4} = map_guard_sequence_2(M4 = id(M0#{a=>sc, b=>3, c=>sc2})), - {5,kk,kk,M5} = map_guard_sequence_2(M5 = id(M0#{a=>kk, b=>other, c=>sc2})), - - {'EXIT',{function_clause,_}} = (catch map_guard_sequence_1(M0#{seq=>6,val=>id("e")})), - {'EXIT',{function_clause,_}} = (catch map_guard_sequence_2(M0#{b=>5})), - ok. - - map_guard_sequence_1(#{seq:=1=Seq, val:=Val}) -> {Seq,Val}; map_guard_sequence_1(#{seq:=2=Seq, val:=Val}) -> {Seq,Val}; map_guard_sequence_1(#{seq:=3=Seq, val:=Val}) -> {Seq,Val}; @@ -1236,66 +328,6 @@ second = map_guard_update(#{y=>old}, #{x=>second,y=>old}), ok. -t_guard_update_large(Config) when is_list(Config) -> - M0 = id(#{ 70=>a0,80=>b0,90=>"c0","40"=>"d0",<<"50">>=>"e0",{["00",03]}=>"10", - 71=>a1,81=>b1,91=>"c1","41"=>"d1",<<"51">>=>"e1",{["01",03]}=>"11", - 72=>a2,82=>b2,92=>"c2","42"=>"d2",<<"52">>=>"e2",{["02",03]}=>"12", - 73=>a3,83=>b3,93=>"c3","43"=>"d3",<<"53">>=>"e3",{["03",03]}=>"13", - 74=>a4,84=>b4,94=>"c4","44"=>"d4",<<"54">>=>"e4",{["04",03]}=>"14", - - 75=>a5,85=>b5,95=>"c5","45"=>"d5",<<"55">>=>"e5",{["05",03]}=>"15", - 76=>a6,86=>b6,96=>"c6","46"=>"d6",<<"56">>=>"e6",{["06",03]}=>"16", - 77=>a7,87=>b7,97=>"c7","47"=>"d7",<<"57">>=>"e7",{["07",03]}=>"17", - 78=>a8,88=>b8,98=>"c8","48"=>"d8",<<"58">>=>"e8",{["08",03]}=>"18", - 79=>a9,89=>b9,99=>"c9","49"=>"d9",<<"59">>=>"e9",{["09",03]}=>"19", - - 70.0=>fa0,80.0=>fb0,90.0=>"fc0", - 71.0=>fa1,81.0=>fb1,91.0=>"fc1", - 72.0=>fa2,82.0=>fb2,92.0=>"fc2", - 73.0=>fa3,83.0=>fb3,93.0=>"fc3", - 74.0=>fa4,84.0=>fb4,94.0=>"fc4", - - 75.0=>fa5,85.0=>fb5,95.0=>"fc5", - 76.0=>fa6,86.0=>fb6,96.0=>"fc6", - 77.0=>fa7,87.0=>fb7,97.0=>"fc7", - 78.0=>fa8,88.0=>fb8,98.0=>"fc8", - 79.0=>fa9,89.0=>fb9,99.0=>"fc9", - - #{ one => small, map => key } => "small map key 1", - #{ second => small, map => key } => "small map key 2", - #{ third => small, map => key } => "small map key 3", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - 16=>a6,26=>b6,36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 1", - - #{ 10=>a0,20=>b0,30=>"c0","40"=>"d0",<<"50">>=>"e0",{["00"]}=>"10", - 11=>a1,21=>b1,31=>"c1","41"=>"d1",<<"51">>=>"e1",{["01"]}=>"11", - 12=>a2,22=>b2,32=>"c2","42"=>"d2",<<"52">>=>"e2",{["02"]}=>"12", - 13=>a3,23=>b3,33=>"c3","43"=>"d3",<<"53">>=>"e3",{["03"]}=>"13", - 14=>a4,24=>b4,34=>"c4","44"=>"d4",<<"54">>=>"e4",{["04"]}=>"14", - - 15=>a5,25=>b5,35=>"c5","45"=>"d5",<<"55">>=>"e5",{["05"]}=>"15", - k16=>a6,k26=>b6,k36=>"c6","46"=>"d6",<<"56">>=>"e6",{["06"]}=>"16", - 17=>a7,27=>b7,37=>"c7","47"=>"d7",<<"57">>=>"e7",{["07"]}=>"17", - 18=>a8,28=>b8,38=>"c8","48"=>"d8",<<"58">>=>"e8",{["08"]}=>"18", - 19=>a9,29=>b9,39=>"c9","49"=>"d9",<<"59">>=>"e9",{["09"]}=>"19" } => "large map key 2" }), - - - error = map_guard_update(M0#{},M0#{}), - first = map_guard_update(M0#{},M0#{x=>first}), - second = map_guard_update(M0#{y=>old}, M0#{x=>second,y=>old}), - ok. - - map_guard_update(M1, M2) when M1#{x=>first} =:= M2 -> first; map_guard_update(M1, M2) when M1#{x=>second} =:= M2 -> second; map_guard_update(_, _) -> error. @@ -1325,42 +357,6 @@ done = call(Pid, done), ok. --define(t_guard_receive_large_procs, 1500). - -t_guard_receive_large(Config) when is_list(Config) -> - M = lists:foldl(fun(_,#{procs := Ps } = M) -> - M#{ procs := Ps#{ spawn_link(fun() -> grecv_loop() end) => 0 }} - end, #{procs => #{}, done => 0}, lists:seq(1,?t_guard_receive_large_procs)), - lists:foreach(fun(Pid) -> - Pid ! {self(), hello} - end, maps:keys(maps:get(procs,M))), - ok = guard_receive_large_loop(M), - ok. - -guard_receive_large_loop(#{done := ?t_guard_receive_large_procs}) -> - ok; -guard_receive_large_loop(M) -> - receive - #{pid := Pid, msg := hello} -> - case M of - #{done := Count, procs := #{Pid := 150}} -> - Pid ! {self(), done}, - guard_receive_large_loop(M#{done := Count + 1}); - #{procs := #{Pid := Count} = Ps} -> - Pid ! {self(), hello}, - guard_receive_large_loop(M#{procs := Ps#{Pid := Count + 1}}) - end - end. - -grecv_loop() -> - receive - {_, done} -> - ok; - {Pid, hello} -> - Pid ! #{pid=>self(), msg=>hello}, - grecv_loop() - end. - call(Pid, M) -> Pid ! {self(), M}, receive {Pid, Res} -> Res end. @@ -1391,11 +387,6 @@ t_list_comprehension(Config) when is_list(Config) -> [#{k:=1},#{k:=2},#{k:=3}] = [#{k=>I} || I <- [1,2,3]], - - Ks = lists:seq($a,$z), - Ms = [#{[K1,K2]=>{K1,K2}} || K1 <- Ks, K2 <- Ks], - [#{"aa" := {$a,$a}},#{"ab":={$a,$b}}|_] = Ms, - [#{"zz" := {$z,$z}},#{"zy":={$z,$y}}|_] = lists:reverse(Ms), ok. t_guard_fun(Config) when is_list(Config) -> @@ -1441,7 +432,7 @@ true = #{ c => 1, b => 1, a => 1 } < id(#{ b => 1, c => 1, d => 1}), true = #{ "a" => 1 } < id(#{ <<"a">> => 1}), false = #{ <<"a">> => 1 } < id(#{ "a" => 1}), - true = #{ 1 => 1 } < id(#{ 1.0 => 1}), + false = #{ 1 => 1 } < id(#{ 1.0 => 1}), false = #{ 1.0 => 1 } < id(#{ 1 => 1}), %% value order @@ -1449,47 +440,16 @@ false = #{ a => 2 } < id(#{ a => 1}), false = #{ a => 2, b => 1 } < id(#{ a => 1, b => 3}), true = #{ a => 1, b => 1 } < id(#{ a => 1, b => 3}), - false = #{ a => 1 } < id(#{ a => 1.0}), - false = #{ a => 1.0 } < id(#{ a => 1}), true = #{ "a" => "hi", b => 134 } == id(#{ b => 134,"a" => "hi"}), - %% large maps - - M = maps:from_list([{I,I}||I <- lists:seq(1,500)]), - - %% size order - true = M#{ a => 1, b => 2} < id(M#{ a => 1, b => 1, c => 1}), - true = M#{ b => 1, a => 1} < id(M#{ c => 1, a => 1, b => 1}), - false = M#{ c => 1, b => 1, a => 1} < id(M#{ c => 1, a => 1}), - - %% key order - true = M#{ a => 1 } < id(M#{ b => 1}), - false = M#{ b => 1 } < id(M#{ a => 1}), - true = M#{ a => 1, b => 1, c => 1 } < id(M#{ b => 1, c => 1, d => 1}), - true = M#{ b => 1, c => 1, d => 1 } > id(M#{ a => 1, b => 1, c => 1}), - true = M#{ c => 1, b => 1, a => 1 } < id(M#{ b => 1, c => 1, d => 1}), - true = M#{ "a" => 1 } < id(M#{ <<"a">> => 1}), - false = M#{ <<"a">> => 1 } < id(#{ "a" => 1}), - true = M#{ 1 => 1 } < id(maps:remove(1,M#{ 1.0 => 1})), - false = M#{ 1.0 => 1 } < id(M#{ 1 => 1}), - - %% value order - true = M#{ a => 1 } < id(M#{ a => 2}), - false = M#{ a => 2 } < id(M#{ a => 1}), - false = M#{ a => 2, b => 1 } < id(M#{ a => 1, b => 3}), - true = M#{ a => 1, b => 1 } < id(M#{ a => 1, b => 3}), - false = M#{ a => 1 } < id(M#{ a => 1.0}), - false = M#{ a => 1.0 } < id(M#{ a => 1}), - - true = M#{ "a" => "hi", b => 134 } == id(M#{ b => 134,"a" => "hi"}), - %% lists:sort SortVs = [#{"a"=>1},#{a=>2},#{1=>3},#{<<"a">>=>4}], [#{1:=ok},#{a:=ok},#{"a":=ok},#{<<"a">>:=ok}] = lists:sort([#{"a"=>ok},#{a=>ok},#{1=>ok},#{<<"a">>=>ok}]), [#{1:=3},#{a:=2},#{"a":=1},#{<<"a">>:=4}] = lists:sort(SortVs), [#{1:=3},#{a:=2},#{"a":=1},#{<<"a">>:=4}] = lists:sort(lists:reverse(SortVs)), + ok. t_map_equal(Config) when is_list(Config) -> @@ -1509,292 +469,27 @@ true = id(#{ a => 1, b => 3, c => <<"wat">> }) =:= id(#{ a => 1, b => 3, c=><<"wat">>}), ok. - -t_map_compare(Config) when is_list(Config) -> - Seed = {erlang:monotonic_time(), - erlang:time_offset(), - erlang:unique_integer()}, - io:format("seed = ~p\n", [Seed]), - random:seed(Seed), - repeat(100, fun(_) -> float_int_compare() end, []), - repeat(100, fun(_) -> recursive_compare() end, []), - ok. - -float_int_compare() -> - Terms = numeric_keys(3), - %%io:format("Keys to use: ~p\n", [Terms]), - Pairs = lists:map(fun(K) -> list_to_tuple([{K,V} || V <- Terms]) end, Terms), - lists:foreach(fun(Size) -> - MapGen = fun() -> map_gen(list_to_tuple(Pairs), Size) end, - repeat(100, fun do_compare/1, [MapGen, MapGen]) - end, - lists:seq(1,length(Terms))), - ok. - -numeric_keys(N) -> - lists:foldl(fun(_,Acc) -> - Int = random:uniform(N*4) - N*2, - Float = float(Int), - [Int, Float, Float * 0.99, Float * 1.01 | Acc] - end, - [], - lists:seq(1,N)). - - -repeat(0, _, _) -> - ok; -repeat(N, Fun, Arg) -> - Fun(Arg), - repeat(N-1, Fun, Arg). - -copy_term(T) -> - Papa = self(), - P = spawn_link(fun() -> receive Msg -> Papa ! Msg end end), - P ! T, - receive R -> R end. - -do_compare([Gen1, Gen2]) -> - M1 = Gen1(), - M2 = Gen2(), - %%io:format("Maps to compare: ~p AND ~p\n", [M1, M2]), - C = (M1 < M2), - Erlang = maps_lessthan(M1, M2), - C = Erlang, - ?CHECK(M1==M1, M1), - - %% Change one key from int to float (or vice versa) and check compare - ML1 = maps:to_list(M1), - {K1,V1} = lists:nth(random:uniform(length(ML1)), ML1), - case K1 of - I when is_integer(I) -> - case maps:find(float(I),M1) of - error -> - M1f = maps:remove(I, maps:put(float(I), V1, M1)), - ?CHECK(M1f > M1, [M1f, M1]); - _ -> ok - end; - - F when is_float(F), round(F) == F -> - case maps:find(round(F),M1) of - error -> - M1i = maps:remove(F, maps:put(round(F), V1, M1)), - ?CHECK(M1i < M1, [M1i, M1]); - _ -> ok - end; - - _ -> ok % skip floats with decimals - end, - - ?CHECK(M2 == M2, [M2]). - - -maps_lessthan(M1, M2) -> - case {maps:size(M1),maps:size(M2)} of - {_S,_S} -> - {K1,V1} = lists:unzip(term_sort(maps:to_list(M1))), - {K2,V2} = lists:unzip(term_sort(maps:to_list(M2))), - - case erts_internal:cmp_term(K1,K2) of - -1 -> true; - 0 -> (V1 < V2); - 1 -> false - end; - - {S1, S2} -> - S1 < S2 - end. - -term_sort(L) -> - lists:sort(fun(A,B) -> erts_internal:cmp_term(A,B) =< 0 end, - L). - - -cmp(T1, T2, Exact) when is_tuple(T1) and is_tuple(T2) -> - case {size(T1),size(T2)} of - {_S,_S} -> cmp(tuple_to_list(T1), tuple_to_list(T2), Exact); - {S1,S2} when S1 < S2 -> -1; - {S1,S2} when S1 > S2 -> 1 - end; - -cmp([H1|T1], [H2|T2], Exact) -> - case cmp(H1,H2, Exact) of - 0 -> cmp(T1,T2, Exact); - C -> C - end; - -cmp(M1, M2, Exact) when is_map(M1) andalso is_map(M2) -> - cmp_maps(M1,M2,Exact); -cmp(M1, M2, Exact) -> - cmp_others(M1, M2, Exact). - -cmp_maps(M1, M2, Exact) -> - case {maps:size(M1),maps:size(M2)} of - {_S,_S} -> - {K1,V1} = lists:unzip(term_sort(maps:to_list(M1))), - {K2,V2} = lists:unzip(term_sort(maps:to_list(M2))), - - case cmp(K1, K2, true) of - 0 -> cmp(V1, V2, Exact); - C -> C - end; - - {S1,S2} when S1 < S2 -> -1; - {S1,S2} when S1 > S2 -> 1 - end. - -cmp_others(I, F, true) when is_integer(I), is_float(F) -> - -1; -cmp_others(F, I, true) when is_float(F), is_integer(I) -> - 1; -cmp_others(T1, T2, _) -> - case {T1 -1; - {false,true} -> 0; - {false,false} -> 1 - end. - -map_gen(Pairs, Size) -> - {_,L} = lists:foldl(fun(_, {Keys, Acc}) -> - KI = random:uniform(size(Keys)), - K = element(KI,Keys), - KV = element(random:uniform(size(K)), K), - {erlang:delete_element(KI,Keys), [KV | Acc]} - end, - {Pairs, []}, - lists:seq(1,Size)), - - maps:from_list(L). - - -recursive_compare() -> - Leafs = {atom, 17, 16.9, 17.1, [], self(), spawn(fun() -> ok end), make_ref(), make_ref()}, - {A, B} = term_gen_recursive(Leafs, 0, 0), - %%io:format("Recursive term A = ~p\n", [A]), - %%io:format("Recursive term B = ~p\n", [B]), - - ?CHECK({true,false} =:= case do_cmp(A, B, false) of - -1 -> {A=B}; - 0 -> {A==B, A/=B}; - 1 -> {A>B, A= - C = cmp(A, B, Exact), - C. - -%% Generate two terms {A,B} that may only differ -%% at float vs integer types. -term_gen_recursive(Leafs, Flags, Depth) -> - MaxDepth = 10, - Rnd = case {Flags, Depth} of - {_, MaxDepth} -> % Only leafs - random:uniform(size(Leafs)) + 3; - {0, 0} -> % Only containers - random:uniform(3); - {0,_} -> % Anything - random:uniform(size(Leafs)+3) - end, - case Rnd of - 1 -> % Make map - Size = random:uniform(size(Leafs)), - lists:foldl(fun(_, {Acc1,Acc2}) -> - {K1,K2} = term_gen_recursive(Leafs, Flags, - Depth+1), - {V1,V2} = term_gen_recursive(Leafs, Flags, Depth+1), - %%ok = check_keys(K1,K2, 0), - {maps:put(K1,V1, Acc1), maps:put(K2,V2, Acc2)} - end, - {maps:new(), maps:new()}, - lists:seq(1,Size)); - 2 -> % Make cons - {Car1,Car2} = term_gen_recursive(Leafs, Flags, Depth+1), - {Cdr1,Cdr2} = term_gen_recursive(Leafs, Flags, Depth+1), - {[Car1 | Cdr1], [Car2 | Cdr2]}; - 3 -> % Make tuple - Size = random:uniform(size(Leafs)), - L = lists:map(fun(_) -> term_gen_recursive(Leafs, Flags, Depth+1) end, - lists:seq(1,Size)), - {L1, L2} = lists:unzip(L), - {list_to_tuple(L1), list_to_tuple(L2)}; - - N -> % Make leaf - case element(N-3, Leafs) of - I when is_integer(I) -> - case random:uniform(4) of - 1 -> {I, float(I)}; - 2 -> {float(I), I}; - _ -> {I,I} - end; - T -> {T,T} - end - end. - -check_keys(K1, K2, _) when K1 =:= K2 -> - case erlang:phash3(K1) =:= erlang:phash3(K2) of - true -> ok; - false -> - io:format("Same keys with different hash values !!!\nK1 = ~p\nK2 = ~p\n", [K1,K2]), - error - end; -check_keys(K1, K2, 0) -> - case {erlang:phash3(K1), erlang:phash3(K2)} of - {H,H} -> check_keys(K1, K2, 1); - {_,_} -> ok - end; -check_keys(K1, K2, L) when L < 10 -> - case {erlang:phash3([L|K1]), erlang:phash3([L|K2])} of - {H,H} -> check_keys(K1, K2, L+1); - {_,_} -> ok - end; -check_keys(K1, K2, L) -> - io:format("Same hash value at level ~p !!!\nK1 = ~p\nK2 = ~p\n", [L,K1,K2]), - error. - %% BIFs t_bif_map_get(Config) when is_list(Config) -> - %% small map + 1 = maps:get(a, #{ a=> 1}), 2 = maps:get(b, #{ a=> 1, b => 2}), "hi" = maps:get("hello", #{ a=>1, "hello" => "hi"}), "tuple hi" = maps:get({1,1.0}, #{ a=>a, {1,1.0} => "tuple hi"}), - M0 = id(#{ k1=>"v1", <<"k2">> => <<"v3">> }), - "v4" = maps:get(<<"k2">>, M0#{<<"k2">> => "v4"}), - - %% large map - M1 = maps:from_list([{I,I}||I<-lists:seq(1,100)] ++ - [{a,1},{b,2},{"hello","hi"},{{1,1.0},"tuple hi"}, - {k1,"v1"},{<<"k2">>,"v3"}]), - 1 = maps:get(a, M1), - 2 = maps:get(b, M1), - "hi" = maps:get("hello", M1), - "tuple hi" = maps:get({1,1.0}, M1), - "v3" = maps:get(<<"k2">>, M1), + M = id(#{ k1=>"v1", <<"k2">> => <<"v3">> }), + "v4" = maps:get(<<"k2">>, M#{ <<"k2">> => "v4" }), - %% error cases - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},[{maps,get,_,_}|_]}} = - (catch maps:get(a, T)) - end), - - {'EXIT',{{badkey,{1,1}},[{maps,get,_,_}|_]}} = - (catch maps:get({1,1}, #{{1,1.0} => "tuple"})), - {'EXIT',{{badkey,a},[{maps,get,_,_}|_]}} = (catch maps:get(a, #{})), - {'EXIT',{{badkey,a},[{maps,get,_,_}|_]}} = - (catch maps:get(a, #{b=>1, c=>2})), + %% error case + {'EXIT',{badarg, [{maps,get,_,_}|_]}} = (catch maps:get(a,[])), + {'EXIT',{badarg, [{maps,get,_,_}|_]}} = (catch maps:get(a,<<>>)), + {'EXIT',{bad_key,[{maps,get,_,_}|_]}} = (catch maps:get({1,1}, #{{1,1.0} => "tuple"})), + {'EXIT',{bad_key,[{maps,get,_,_}|_]}} = (catch maps:get(a,#{})), + {'EXIT',{bad_key,[{maps,get,_,_}|_]}} = (catch maps:get(a,#{ b=>1, c=>2})), ok. t_bif_map_find(Config) when is_list(Config) -> - %% small map + {ok, 1} = maps:find(a, #{ a=> 1}), {ok, 2} = maps:find(b, #{ a=> 1, b => 2}), {ok, "int"} = maps:find(1, #{ 1 => "int"}), @@ -1803,18 +498,8 @@ {ok, "hi"} = maps:find("hello", #{ a=>1, "hello" => "hi"}), {ok, "tuple hi"} = maps:find({1,1.0}, #{ a=>a, {1,1.0} => "tuple hi"}), - M0 = id(#{ k1=>"v1", <<"k2">> => <<"v3">> }), - {ok, "v4"} = maps:find(<<"k2">>, M0#{ <<"k2">> => "v4" }), - - %% large map - M1 = maps:from_list([{I,I}||I<-lists:seq(1,100)] ++ - [{a,1},{b,2},{"hello","hi"},{{1,1.0},"tuple hi"}, - {k1,"v1"},{<<"k2">>,"v3"}]), - {ok, 1} = maps:find(a, M1), - {ok, 2} = maps:find(b, M1), - {ok, "hi"} = maps:find("hello", M1), - {ok, "tuple hi"} = maps:find({1,1.0}, M1), - {ok, "v3"} = maps:find(<<"k2">>, M1), + M = id(#{ k1=>"v1", <<"k2">> => <<"v3">> }), + {ok, "v4"} = maps:find(<<"k2">>, M#{ <<"k2">> => "v4" }), %% error case error = maps:find(a,#{}), @@ -1823,10 +508,9 @@ error = maps:find(1, #{ 1.0 => "float"}), error = maps:find({1.0,1}, #{ a=>a, {1,1.0} => "tuple hi"}), % reverse types in tuple key - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},[{maps,find,_,_}|_]}} = - (catch maps:find(a, T)) - end), + + {'EXIT',{badarg,[{maps,find,_,_}|_]}} = (catch maps:find(a,id([]))), + {'EXIT',{badarg,[{maps,find,_,_}|_]}} = (catch maps:find(a,id(<<>>))), ok. @@ -1851,27 +535,26 @@ false = maps:is_key(1.0, maps:put(1, "number", M1)), %% error case - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},[{maps,is_key,_,_}|_]}} = - (catch maps:is_key(a, T)) - end), + {'EXIT',{badarg,[{maps,is_key,_,_}|_]}} = (catch maps:is_key(a,id([]))), + {'EXIT',{badarg,[{maps,is_key,_,_}|_]}} = (catch maps:is_key(a,id(<<>>))), ok. t_bif_map_keys(Config) when is_list(Config) -> [] = maps:keys(#{}), - [1,2,3,4,5] = lists:sort(maps:keys(#{ 1 => a, 2 => b, 3 => c, 4 => d, 5 => e})), - [1,2,3,4,5] = lists:sort(maps:keys(#{ 4 => d, 5 => e, 1 => a, 2 => b, 3 => c})), + [1,2,3,4,5] = maps:keys(#{ 1 => a, 2 => b, 3 => c, 4 => d, 5 => e}), + [1,2,3,4,5] = maps:keys(#{ 4 => d, 5 => e, 1 => a, 2 => b, 3 => c}), % values in key order: [4,int,"hi",<<"key">>] M1 = #{ "hi" => "hello", int => 3, <<"key">> => <<"value">>, 4 => number}, - [4,int,"hi",<<"key">>] = lists:sort(maps:keys(M1)), + [4,int,"hi",<<"key">>] = maps:keys(M1), %% error case - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},[{maps,keys,_,_}|_]}} = - (catch maps:keys(T)) - end), + {'EXIT',{badarg,[{maps,keys,_,_}|_]}} = (catch maps:keys(1 bsl 65 + 3)), + {'EXIT',{badarg,[{maps,keys,_,_}|_]}} = (catch maps:keys(154)), + {'EXIT',{badarg,[{maps,keys,_,_}|_]}} = (catch maps:keys(atom)), + {'EXIT',{badarg,[{maps,keys,_,_}|_]}} = (catch maps:keys([])), + {'EXIT',{badarg,[{maps,keys,_,_}|_]}} = (catch maps:keys(<<>>)), ok. t_bif_map_new(Config) when is_list(Config) -> @@ -1899,58 +582,11 @@ #{4 := integer, 18446744073709551629 := wat, float := 3.3, int := 3, {1,2} := "tuple", "hi" := "hello again", <<"key">> := <<"value">>} = maps:merge(M0,M1), - %% try deep collisions - N = 150000, - Is = lists:seq(1,N), - M2 = maps:from_list([{I,I}||I<-Is]), - 150000 = maps:size(M2), - M3 = maps:from_list([{<>,I}||I<-Is]), - 150000 = maps:size(M3), - M4 = maps:merge(M2,M3), - 300000 = maps:size(M4), - M5 = maps:from_list([{integer_to_list(I),I}||I<-Is]), - 150000 = maps:size(M5), - M6 = maps:merge(M4,M5), - 450000 = maps:size(M6), - M7 = maps:from_list([{float(I),I}||I<-Is]), - 150000 = maps:size(M7), - M8 = maps:merge(M7,M6), - 600000 = maps:size(M8), - - #{ 1 := 1, "1" := 1, <<1:32>> := 1 } = M8, - #{ 10 := 10, "10" := 10, <<10:32>> := 10 } = M8, - #{ 100 := 100, "100" := 100, <<100:32>> := 100 } = M8, - #{ 1000 := 1000, "1000" := 1000, <<1000:32>> := 1000 } = M8, - #{ 10000 := 10000, "10000" := 10000, <<10000:32>> := 10000 } = M8, - #{ 100000 := 100000, "100000" := 100000, <<100000:32>> := 100000 } = M8, - - %% overlapping - M8 = maps:merge(M2,M8), - M8 = maps:merge(M3,M8), - M8 = maps:merge(M4,M8), - M8 = maps:merge(M5,M8), - M8 = maps:merge(M6,M8), - M8 = maps:merge(M7,M8), - M8 = maps:merge(M8,M8), - - %% maps:merge/2 and mixed - - Ks1 = [764492191,2361333849], %% deep collision - Ks2 = lists:seq(1,33), - M9 = maps:from_list([{K,K}||K <- Ks1]), - M10 = maps:from_list([{K,K}||K <- Ks2]), - M11 = maps:merge(M9,M10), - ok = check_keys_exist(Ks1 ++ Ks2, M11), - %% error case - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},[{maps,merge,_,_}|_]}} = - (catch maps:merge(#{}, T)), - {'EXIT',{{badmap,T},[{maps,merge,_,_}|_]}} = - (catch maps:merge(T, #{})), - {'EXIT',{{badmap,T},[{maps,merge,_,_}|_]}} = - (catch maps:merge(T, T)) - end), + {'EXIT',{badarg,[{maps,merge,_,_}|_]}} = (catch maps:merge((1 bsl 65 + 3), <<>>)), + {'EXIT',{badarg,[{maps,merge,_,_}|_]}} = (catch maps:merge(<<>>, id(#{ a => 1}))), + {'EXIT',{badarg,[{maps,merge,_,_}|_]}} = (catch maps:merge(id(#{ a => 2}), <<>> )), + ok. @@ -1960,48 +596,41 @@ M1 = #{ "hi" := "hello"} = maps:put("hi", "hello", #{}), - true = is_members(["hi"],maps:keys(M1)), - true = is_members(["hello"],maps:values(M1)), + ["hi"] = maps:keys(M1), + ["hello"] = maps:values(M1), M2 = #{ int := 3 } = maps:put(int, 3, M1), - true = is_members([int,"hi"],maps:keys(M2)), - true = is_members([3,"hello"],maps:values(M2)), + [int,"hi"] = maps:keys(M2), + [3,"hello"] = maps:values(M2), M3 = #{ <<"key">> := <<"value">> } = maps:put(<<"key">>, <<"value">>, M2), - true = is_members([int,"hi",<<"key">>],maps:keys(M3)), - true = is_members([3,"hello",<<"value">>],maps:values(M3)), + [int,"hi",<<"key">>] = maps:keys(M3), + [3,"hello",<<"value">>] = maps:values(M3), M4 = #{ 18446744073709551629 := wat } = maps:put(18446744073709551629, wat, M3), - true = is_members([18446744073709551629,int,"hi",<<"key">>],maps:keys(M4)), - true = is_members([wat,3,"hello",<<"value">>],maps:values(M4)), + [18446744073709551629,int,"hi",<<"key">>] = maps:keys(M4), + [wat,3,"hello",<<"value">>] = maps:values(M4), M0 = #{ 4 := number } = M5 = maps:put(4, number, M4), - true = is_members([4,18446744073709551629,int,"hi",<<"key">>],maps:keys(M5)), - true = is_members([number,wat,3,"hello",<<"value">>],maps:values(M5)), + [4,18446744073709551629,int,"hi",<<"key">>] = maps:keys(M5), + [number,wat,3,"hello",<<"value">>] = maps:values(M5), M6 = #{ <<"key">> := <<"other value">> } = maps:put(<<"key">>, <<"other value">>, M5), - true = is_members([4,18446744073709551629,int,"hi",<<"key">>],maps:keys(M6)), - true = is_members([number,wat,3,"hello",<<"other value">>],maps:values(M6)), + [4,18446744073709551629,int,"hi",<<"key">>] = maps:keys(M6), + [number,wat,3,"hello",<<"other value">>] = maps:values(M6), %% error case - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},[{maps,put,_,_}|_]}} = - (catch maps:put(1, a, T)) - end), - ok. - -is_members(Ks,Ls) when length(Ks) =/= length(Ls) -> false; -is_members(Ks,Ls) -> is_members_do(Ks,Ls). - -is_members_do([],[]) -> true; -is_members_do([],_) -> false; -is_members_do([K|Ks],Ls) -> - is_members_do(Ks, lists:delete(K,Ls)). + {'EXIT',{badarg,[{maps,put,_,_}|_]}} = (catch maps:put(1,a,1 bsl 65 + 3)), + {'EXIT',{badarg,[{maps,put,_,_}|_]}} = (catch maps:put(1,a,154)), + {'EXIT',{badarg,[{maps,put,_,_}|_]}} = (catch maps:put(1,a,atom)), + {'EXIT',{badarg,[{maps,put,_,_}|_]}} = (catch maps:put(1,a,[])), + {'EXIT',{badarg,[{maps,put,_,_}|_]}} = (catch maps:put(1,a,<<>>)), + ok. t_bif_map_remove(Config) when is_list(Config) -> 0 = erlang:map_size(maps:remove(some_key, #{})), @@ -2010,20 +639,20 @@ 4 => number, 18446744073709551629 => wat}, M1 = maps:remove("hi", M0), - true = is_members([4,18446744073709551629,int,<<"key">>],maps:keys(M1)), - true = is_members([number,wat,3,<<"value">>],maps:values(M1)), + [4,18446744073709551629,int,<<"key">>] = maps:keys(M1), + [number,wat,3,<<"value">>] = maps:values(M1), M2 = maps:remove(int, M1), - true = is_members([4,18446744073709551629,<<"key">>],maps:keys(M2)), - true = is_members([number,wat,<<"value">>],maps:values(M2)), + [4,18446744073709551629,<<"key">>] = maps:keys(M2), + [number,wat,<<"value">>] = maps:values(M2), M3 = maps:remove(<<"key">>, M2), - true = is_members([4,18446744073709551629],maps:keys(M3)), - true = is_members([number,wat],maps:values(M3)), + [4,18446744073709551629] = maps:keys(M3), + [number,wat] = maps:values(M3), M4 = maps:remove(18446744073709551629, M3), - true = is_members([4],maps:keys(M4)), - true = is_members([number],maps:values(M4)), + [4] = maps:keys(M4), + [number] = maps:values(M4), M5 = maps:remove(4, M4), [] = maps:keys(M5), @@ -2035,10 +664,11 @@ #{ "hi" := "hello", int := 3, 4 := number} = maps:remove(18446744073709551629,maps:remove(<<"key">>,M0)), %% error case - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},[{maps,remove,_,_}|_]}} = - (catch maps:remove(a, T)) - end), + {'EXIT',{badarg,[{maps,remove,_,_}|_]}} = (catch maps:remove(a,1 bsl 65 + 3)), + {'EXIT',{badarg,[{maps,remove,_,_}|_]}} = (catch maps:remove(1,154)), + {'EXIT',{badarg,[{maps,remove,_,_}|_]}} = (catch maps:remove(a,atom)), + {'EXIT',{badarg,[{maps,remove,_,_}|_]}} = (catch maps:remove(1,[])), + {'EXIT',{badarg,[{maps,remove,_,_}|_]}} = (catch maps:remove(a,<<>>)), ok. t_bif_map_update(Config) when is_list(Config) -> @@ -2061,10 +691,10 @@ 4 := number, 18446744073709551629 := wazzup} = maps:update(18446744073709551629, wazzup, M0), %% error case - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},[{maps,update,_,_}|_]}} = - (catch maps:update(1, none, T)) - end), + {'EXIT',{badarg,[{maps,update,_,_}|_]}} = (catch maps:update(1,none,{})), + {'EXIT',{badarg,[{maps,update,_,_}|_]}} = (catch maps:update(1,none,<<"value">>)), + {'EXIT',{badarg,[{maps,update,_,_}|_]}} = (catch maps:update(5,none,M0)), + ok. @@ -2072,29 +702,21 @@ t_bif_map_values(Config) when is_list(Config) -> [] = maps:values(#{}), - [1] = maps:values(#{a=>1}), - true = is_members([a,b,c,d,e],maps:values(#{ 1 => a, 2 => b, 3 => c, 4 => d, 5 => e})), - true = is_members([a,b,c,d,e],maps:values(#{ 4 => d, 5 => e, 1 => a, 2 => b, 3 => c})), + [a,b,c,d,e] = maps:values(#{ 1 => a, 2 => b, 3 => c, 4 => d, 5 => e}), + [a,b,c,d,e] = maps:values(#{ 4 => d, 5 => e, 1 => a, 2 => b, 3 => c}), + % values in key order: [4,int,"hi",<<"key">>] M1 = #{ "hi" => "hello", int => 3, <<"key">> => <<"value">>, 4 => number}, M2 = M1#{ "hi" => "hello2", <<"key">> => <<"value2">> }, - true = is_members([number,3,"hello2",<<"value2">>],maps:values(M2)), - true = is_members([number,3,"hello",<<"value">>],maps:values(M1)), - - Vs = lists:seq(1000,20000), - M3 = maps:from_list([{K,K}||K<-Vs]), - M4 = maps:merge(M1,M3), - M5 = maps:merge(M2,M3), - true = is_members(Vs,maps:values(M3)), - true = is_members([number,3,"hello",<<"value">>]++Vs,maps:values(M4)), - true = is_members([number,3,"hello2",<<"value2">>]++Vs,maps:values(M5)), + [number,3,"hello2",<<"value2">>] = maps:values(M2), + [number,3,"hello",<<"value">>] = maps:values(M1), %% error case - do_badmap(fun(T) -> - {'EXIT',{{badmap,T},[{maps,values,_,_}|_]}} = - (catch maps:values(T)) - end), + {'EXIT',{badarg,[{maps,values,_,_}|_]}} = (catch maps:values(1 bsl 65 + 3)), + {'EXIT',{badarg,[{maps,values,_,_}|_]}} = (catch maps:values(atom)), + {'EXIT',{badarg,[{maps,values,_,_}|_]}} = (catch maps:values([])), + {'EXIT',{badarg,[{maps,values,_,_}|_]}} = (catch maps:values(<<>>)), ok. t_erlang_hash(Config) when is_list(Config) -> @@ -2108,61 +730,61 @@ t_bif_erlang_phash2() -> 39679005 = erlang:phash2(#{}), - 33667975 = erlang:phash2(#{ a => 1, "a" => 2, <<"a">> => 3, {a,b} => 4 }), % 78942764 - 95332690 = erlang:phash2(#{ 1 => a, 2 => "a", 3 => <<"a">>, 4 => {a,b} }), % 37338230 - 108954384 = erlang:phash2(#{ 1 => a }), % 14363616 - 59617982 = erlang:phash2(#{ a => 1 }), % 51612236 + 78942764 = erlang:phash2(#{ a => 1, "a" => 2, <<"a">> => 3, {a,b} => 4 }), + 37338230 = erlang:phash2(#{ 1 => a, 2 => "a", 3 => <<"a">>, 4 => {a,b} }), + 14363616 = erlang:phash2(#{ 1 => a }), + 51612236 = erlang:phash2(#{ a => 1 }), - 42770201 = erlang:phash2(#{{} => <<>>}), % 37468437 - 71687700 = erlang:phash2(#{<<>> => {}}), % 44049159 + 37468437 = erlang:phash2(#{{} => <<>>}), + 44049159 = erlang:phash2(#{<<>> => {}}), M0 = #{ a => 1, "key" => <<"value">> }, M1 = maps:remove("key",M0), M2 = M1#{ "key" => <<"value">> }, - 70249457 = erlang:phash2(M0), % 118679416 - 59617982 = erlang:phash2(M1), % 51612236 - 70249457 = erlang:phash2(M2), % 118679416 + 118679416 = erlang:phash2(M0), + 51612236 = erlang:phash2(M1), + 118679416 = erlang:phash2(M2), ok. t_bif_erlang_phash() -> Sz = 1 bsl 32, - 1113425985 = erlang:phash(#{},Sz), % 268440612 - 1510068139 = erlang:phash(#{ a => 1, "a" => 2, <<"a">> => 3, {a,b} => 4 },Sz), % 1196461908 - 3182345590 = erlang:phash(#{ 1 => a, 2 => "a", 3 => <<"a">>, 4 => {a,b} },Sz), % 3944426064 - 2927531828 = erlang:phash(#{ 1 => a },Sz), % 1394238263 - 1670235874 = erlang:phash(#{ a => 1 },Sz), % 4066388227 + 268440612 = erlang:phash(#{},Sz), + 1196461908 = erlang:phash(#{ a => 1, "a" => 2, <<"a">> => 3, {a,b} => 4 },Sz), + 3944426064 = erlang:phash(#{ 1 => a, 2 => "a", 3 => <<"a">>, 4 => {a,b} },Sz), + 1394238263 = erlang:phash(#{ 1 => a },Sz), + 4066388227 = erlang:phash(#{ a => 1 },Sz), - 3935089469 = erlang:phash(#{{} => <<>>},Sz), % 1578050717 - 71692856 = erlang:phash(#{<<>> => {}},Sz), % 1578050717 + 1578050717 = erlang:phash(#{{} => <<>>},Sz), + 1578050717 = erlang:phash(#{<<>> => {}},Sz), % yep, broken M0 = #{ a => 1, "key" => <<"value">> }, M1 = maps:remove("key",M0), M2 = M1#{ "key" => <<"value">> }, - 2620391445 = erlang:phash(M0,Sz), % 3590546636 - 1670235874 = erlang:phash(M1,Sz), % 4066388227 - 2620391445 = erlang:phash(M2,Sz), % 3590546636 + 3590546636 = erlang:phash(M0,Sz), + 4066388227 = erlang:phash(M1,Sz), + 3590546636 = erlang:phash(M2,Sz), ok. t_bif_erlang_hash() -> Sz = 1 bsl 27 - 1, - 39684169 = erlang:hash(#{},Sz), % 5158 - 33673142 = erlang:hash(#{ a => 1, "a" => 2, <<"a">> => 3, {a,b} => 4 },Sz), % 71555838 - 95337869 = erlang:hash(#{ 1 => a, 2 => "a", 3 => <<"a">>, 4 => {a,b} },Sz), % 5497225 - 108959561 = erlang:hash(#{ 1 => a },Sz), % 126071654 - 59623150 = erlang:hash(#{ a => 1 },Sz), % 126426236 + 5158 = erlang:hash(#{},Sz), + 71555838 = erlang:hash(#{ a => 1, "a" => 2, <<"a">> => 3, {a,b} => 4 },Sz), + 5497225 = erlang:hash(#{ 1 => a, 2 => "a", 3 => <<"a">>, 4 => {a,b} },Sz), + 126071654 = erlang:hash(#{ 1 => a },Sz), + 126426236 = erlang:hash(#{ a => 1 },Sz), - 42775386 = erlang:hash(#{{} => <<>>},Sz), % 101655720 - 71692856 = erlang:hash(#{<<>> => {}},Sz), % 101655720 + 101655720 = erlang:hash(#{{} => <<>>},Sz), + 101655720 = erlang:hash(#{<<>> => {}},Sz), % yep, broken M0 = #{ a => 1, "key" => <<"value">> }, M1 = maps:remove("key",M0), M2 = M1#{ "key" => <<"value">> }, - 70254632 = erlang:hash(M0,Sz), % 38260486 - 59623150 = erlang:hash(M1,Sz), % 126426236 - 70254632 = erlang:hash(M2,Sz), % 38260486 + 38260486 = erlang:hash(M0,Sz), + 126426236 = erlang:hash(M1,Sz), + 38260486 = erlang:hash(M2,Sz), ok. @@ -2183,9 +805,7 @@ {<<>>, sc9}, {3.14158, sc10}, {[3.14158], sc11}, {more_atoms, sc12}, {{more_tuples}, sc13}, {self(), sc14}, - {{},{}},{[],[]}, - {map_s, #{a=>a, 2=>b, 3=>c}}, - {map_l, maps:from_list([{I,I}||I <- lists:seq(1,74)])} + {{},{}},{[],[]} ], ok = map_encode_decode_and_match(Pairs,[],#{}), @@ -2198,35 +818,14 @@ %% literally #{ "hi" => "value", a=>33, b=>55 } in the internal order #{ a:=33, b:=55, "hi" := "value"} = erlang:binary_to_term(<<131,116,0,0,0,3, - 107,0,2,104,105, % "hi" :: list() + 107,0,2,104,105, % "hi" :: list() 107,0,5,118,97,108,117,101, % "value" :: list() - 100,0,1,97, % a :: atom() - 97,33, % 33 :: integer() - 100,0,1,98, % b :: atom() - 97,55 % 55 :: integer() + 100,0,1,97, % a :: atom() + 97,33, % 33 :: integer() + 100,0,1,98, % b :: atom() + 97,55 % 55 :: integer() >>), - %% Maps of different sizes - lists:foldl(fun(Key, M0) -> - M1 = M0#{Key => Key}, - case Key rem 17 of - 0 -> - M1 = binary_to_term(term_to_binary(M1)); - _ -> - ok - end, - M1 - end, - #{}, - lists:seq(1,10000)), - - %% many maps in same binary - MapList = lists:foldl(fun(K, [M|_]=Acc) -> [M#{K => K} | Acc] end, - [#{}], - lists:seq(1,100)), - MapList = binary_to_term(term_to_binary(MapList)), - MapListR = lists:reverse(MapList), - MapListR = binary_to_term(term_to_binary(MapListR)), %% error cases %% template: <<131,116,0,0,0,2,100,0,1,97,100,0,1,98,97,1,97,1>> @@ -2249,77 +848,51 @@ %% bad size (too small) .. should fail just truncate it .. weird. %% possibly change external format so truncated will be #{a:=1} - #{ a:=b } = erlang:binary_to_term(<<131,116,0,0,0,1,100,0,1,97,100,0,1,98,97,1,97,1>>), + #{ a:=b } = + erlang:binary_to_term(<<131,116,0,0,0,1,100,0,1,97,100,0,1,98,97,1,97,1>>), - %% specific fannerl (opensource app) binary_to_term error in 18.1 - - #{bias := {1,1,0}, - bit_fail := 0, - connections := #{{2,9} := _, - {8,14} := _, - {2,12} := _, - {5,7} := _, - {11,16} := _, - {11,15} := _}, - layers := {5,7,3}, - network_type := fann_nettype_layer, - num_input := 5, - num_layers := 3, - num_output := 3, - rprop_delta_max := _, - rprop_delta_min := _, - total_connections := 66, - total_neurons := 17, - train_error_function := fann_errorfunc_tanh, - train_stop_function := fann_stopfunc_mse, - training_algorithm := fann_train_rprop} = erlang:binary_to_term(fannerl()), ok. map_encode_decode_and_match([{K,V}|Pairs], EncodedPairs, M0) -> M1 = maps:put(K,V,M0), B0 = erlang:term_to_binary(M1), - Ls = [{erlang:term_to_binary(K), erlang:term_to_binary(V)}|EncodedPairs], - ok = match_encoded_map(B0, length(Ls), Ls), + Ls = lists:sort(fun(A,B) -> erts_internal:cmp_term(A,B) < 0 end, [{K, erlang:term_to_binary(K), erlang:term_to_binary(V)}|EncodedPairs]), + %% sort Ks and Vs according to term spec, then match it + KVbins = lists:foldr(fun({_,Kbin,Vbin}, Acc) -> [Kbin,Vbin | Acc] end, [], Ls), + ok = match_encoded_map(B0, length(Ls), KVbins), %% decode and match it M1 = erlang:binary_to_term(B0), map_encode_decode_and_match(Pairs,Ls,M1); map_encode_decode_and_match([],_,_) -> ok. match_encoded_map(<<131,116,Size:32,Encoded/binary>>,Size,Items) -> - match_encoded_map_stripped_size(Encoded,Items,Items); + match_encoded_map(Encoded,Items); match_encoded_map(_,_,_) -> no_match_size. -match_encoded_map_stripped_size(<<>>,_,_) -> ok; -match_encoded_map_stripped_size(B0,[{<<131,K/binary>>,<<131,V/binary>>}|Items],Ls) -> - Ksz = byte_size(K), - Vsz = byte_size(V), - case B0 of - <> -> - match_encoded_map_stripped_size(B1,Ls,Ls); - _ -> - match_encoded_map_stripped_size(B0,Items,Ls) - end; -match_encoded_map_stripped_size(_,[],_) -> fail. +match_encoded_map(<<>>,[]) -> ok; +match_encoded_map(Bin,[<<131,Item/binary>>|Items]) -> + Size = erlang:byte_size(Item), + <> = Bin, + EncodedTerm = Item, %% Asssert + match_encoded_map(Bin1,Items). t_bif_map_to_list(Config) when is_list(Config) -> [] = maps:to_list(#{}), - [{a,1},{b,2}] = lists:sort(maps:to_list(#{a=>1,b=>2})), - [{a,1},{b,2},{c,3}] = lists:sort(maps:to_list(#{c=>3,a=>1,b=>2})), - [{a,1},{b,2},{g,3}] = lists:sort(maps:to_list(#{g=>3,a=>1,b=>2})), - [{a,1},{b,2},{g,3},{"c",4}] = lists:sort(maps:to_list(#{g=>3,a=>1,b=>2,"c"=>4})), - [{3,v2},{hi,v4},{{hi,3},v5},{"hi",v3},{<<"hi">>,v1}] = - lists:sort(maps:to_list(#{<<"hi">>=>v1,3=>v2,"hi"=>v3,hi=>v4,{hi,3}=>v5})), - - [{3,v7},{hi,v9},{{hi,3},v10},{"hi",v8},{<<"hi">>,v6}] = - lists:sort(maps:to_list(#{<<"hi">>=>v1,3=>v2,"hi"=>v3,hi=>v4,{hi,3}=>v5, - <<"hi">>=>v6,3=>v7,"hi"=>v8,hi=>v9,{hi,3}=>v10})), + [{a,1},{b,2}] = maps:to_list(#{a=>1,b=>2}), + [{a,1},{b,2},{c,3}] = maps:to_list(#{c=>3,a=>1,b=>2}), + [{a,1},{b,2},{g,3}] = maps:to_list(#{g=>3,a=>1,b=>2}), + [{a,1},{b,2},{g,3},{"c",4}] = maps:to_list(#{g=>3,a=>1,b=>2,"c"=>4}), + [{3,v2},{hi,v4},{{hi,3},v5},{"hi",v3},{<<"hi">>,v1}] = maps:to_list(#{ + <<"hi">>=>v1,3=>v2,"hi"=>v3,hi=>v4,{hi,3}=>v5}), + + [{3,v7},{hi,v9},{{hi,3},v10},{"hi",v8},{<<"hi">>,v6}] = maps:to_list(#{ + <<"hi">>=>v1,3=>v2,"hi"=>v3,hi=>v4,{hi,3}=>v5, + <<"hi">>=>v6,3=>v7,"hi"=>v8,hi=>v9,{hi,3}=>v10}), %% error cases - do_badmap(fun(T) -> - {'EXIT', {{badmap,T},_}} = - (catch maps:to_list(T)) - end), + {'EXIT', {badarg,_}} = (catch maps:to_list(id(a))), + {'EXIT', {badarg,_}} = (catch maps:to_list(id(42))), ok. @@ -2328,7 +901,7 @@ A = maps:from_list([]), 0 = erlang:map_size(A), - #{a:=1,b:=2} = maps:from_list([{a,1},{b,2}]), + #{a:=1,b:=2} = maps:from_list([{a,1},{b,2}]), #{c:=3,a:=1,b:=2} = maps:from_list([{a,1},{b,2},{c,3}]), #{g:=3,a:=1,b:=2} = maps:from_list([{a,1},{b,2},{g,3}]), @@ -2341,13 +914,6 @@ maps:from_list([ {{hi,3},v3}, {"hi",v0},{3,v1}, {<<"hi">>,v4}, {hi,v2}, {<<"hi">>,v6}, {{hi,3},v10},{"hi",v11}, {hi,v9}, {3,v8}]), - %% repeated keys (large -> small) - Ps1 = [{a,I}|| I <- lists:seq(1,32)], - Ps2 = [{a,I}|| I <- lists:seq(33,64)], - - M = maps:from_list(Ps1 ++ [{b,1},{c,1}] ++ Ps2), - #{ a := 64, b := 1, c := 1 } = M, - %% error cases {'EXIT', {badarg,_}} = (catch maps:from_list(id([{a,b},b]))), {'EXIT', {badarg,_}} = (catch maps:from_list(id([{a,b},{b,b,3}]))), @@ -2357,184 +923,6 @@ {'EXIT', {badarg,_}} = (catch maps:from_list(id(42))), ok. -t_bif_build_and_check(Config) when is_list(Config) -> - ok = check_build_and_remove(750,[ - fun(K) -> [K,K] end, - fun(K) -> [float(K),K] end, - fun(K) -> K end, - fun(K) -> {1,K} end, - fun(K) -> {K} end, - fun(K) -> [K|K] end, - fun(K) -> [K,1,2,3,4] end, - fun(K) -> {K,atom} end, - fun(K) -> float(K) end, - fun(K) -> integer_to_list(K) end, - fun(K) -> list_to_atom(integer_to_list(K)) end, - fun(K) -> [K,{K,[K,{K,[K]}]}] end, - fun(K) -> <> end - ]), - - ok. - -check_build_and_remove(_,[]) -> ok; -check_build_and_remove(N,[F|Fs]) -> - {M,Ks} = build_and_check(N, maps:new(), F, []), - ok = remove_and_check(Ks,M), - check_build_and_remove(N,Fs). - -build_and_check(0, M0, _, Ks) -> {M0, Ks}; -build_and_check(N, M0, F, Ks) -> - K = build_key(F,N), - M1 = maps:put(K,K,M0), - ok = check_keys_exist([I||{I,_} <- [{K,M1}|Ks]], M1), - M2 = maps:update(K,v,M1), - v = maps:get(K,M2), - build_and_check(N-1,M1,F,[{K,M1}|Ks]). - -remove_and_check([],_) -> ok; -remove_and_check([{K,Mc}|Ks], M0) -> - K = maps:get(K,M0), - true = maps:is_key(K,M0), - true = Mc =:= M0, - true = M0 == Mc, - M1 = maps:remove(K,M0), - false = M1 =:= Mc, - false = Mc == M1, - false = maps:is_key(K,M1), - true = maps:is_key(K,M0), - ok = check_keys_exist([I||{I,_} <- Ks],M1), - error = maps:find(K,M1), - remove_and_check(Ks, M1). - -build_key(F,N) when N rem 3 =:= 0 -> F(N); -build_key(F,N) when N rem 3 =:= 1 -> K = F(N), {K,K}; -build_key(F,N) when N rem 3 =:= 2 -> K = F(N), [K,K]. - -check_keys_exist([], _) -> ok; -check_keys_exist([K|Ks],M) -> - true = maps:is_key(K,M), - check_keys_exist(Ks,M). - -t_bif_merge_and_check(Config) when is_list(Config) -> - - io:format("rand:export_seed() -> ~p\n",[rand:export_seed()]), - - %% simple disjunct ones - %% make sure all keys are unique - Kss = [[a,b,c,d], - [1,2,3,4], - [], - ["hi"], - [e], - [build_key(fun(K) -> {small,K} end, I) || I <- lists:seq(1,32)], - lists:seq(5, 28), - lists:seq(29, 59), - [build_key(fun(K) -> integer_to_list(K) end, I) || I <- lists:seq(2000,10000)], - [build_key(fun(K) -> <> end, I) || I <- lists:seq(1,80)], - [build_key(fun(K) -> {<>} end, I) || I <- lists:seq(100,1000)]], - - - KsMs = build_keys_map_pairs(Kss), - Cs = [{CKs1,CM1,CKs2,CM2} || {CKs1,CM1} <- KsMs, {CKs2,CM2} <- KsMs], - ok = merge_and_check_combo(Cs), - - %% overlapping ones - - KVs1 = [{a,1},{b,2},{c,3}], - KVs2 = [{b,3},{c,4},{d,5}], - KVs = [{I,I} || I <- lists:seq(1,32)], - KVs3 = KVs1 ++ KVs, - KVs4 = KVs2 ++ KVs, - - M1 = maps:from_list(KVs1), - M2 = maps:from_list(KVs2), - M3 = maps:from_list(KVs3), - M4 = maps:from_list(KVs4), - - M12 = maps:merge(M1,M2), - ok = check_key_values(KVs2 ++ [{a,1}], M12), - M21 = maps:merge(M2,M1), - ok = check_key_values(KVs1 ++ [{d,5}], M21), - - M34 = maps:merge(M3,M4), - ok = check_key_values(KVs4 ++ [{a,1}], M34), - M43 = maps:merge(M4,M3), - ok = check_key_values(KVs3 ++ [{d,5}], M43), - - M14 = maps:merge(M1,M4), - ok = check_key_values(KVs4 ++ [{a,1}], M14), - M41 = maps:merge(M4,M1), - ok = check_key_values(KVs1 ++ [{d,5}] ++ KVs, M41), - - [begin Ma = random_map(SzA, a), - Mb = random_map(SzB, b), - ok = merge_maps(Ma, Mb) - end || SzA <- [3,10,20,100,200,1000], SzB <- [3,10,20,100,200,1000]], - - ok. - -% Generate random map with an average of Sz number of pairs: K -> {V,K} -random_map(Sz, V) -> - random_map_insert(#{}, 0, V, Sz*2). - -random_map_insert(M0, K0, _, Sz) when K0 > Sz -> - M0; -random_map_insert(M0, K0, V, Sz) -> - Key = K0 + rand:uniform(3), - random_map_insert(M0#{Key => {V,Key}}, Key, V, Sz). - - -merge_maps(A, B) -> - AB = maps:merge(A, B), - %%io:format("A=~p\nB=~p\n",[A,B]), - maps_foreach(fun(K,VB) -> VB = maps:get(K, AB) - end, B), - maps_foreach(fun(K,VA) -> - case {maps:get(K, AB),maps:find(K, B)} of - {VA, error} -> ok; - {VB, {ok, VB}} -> ok - end - end, A), - - maps_foreach(fun(K,V) -> - case {maps:find(K, A),maps:find(K, B)} of - {{ok, V}, error} -> ok; - {error, {ok, V}} -> ok; - {{ok,_}, {ok, V}} -> ok - end - end, AB), - ok. - -maps_foreach(Fun, Map) -> - maps:fold(fun(K,V,_) -> Fun(K,V) end, void, Map). - - -check_key_values([],_) -> ok; -check_key_values([{K,V}|KVs],M) -> - V = maps:get(K,M), - check_key_values(KVs,M). - -merge_and_check_combo([]) -> ok; -merge_and_check_combo([{Ks1,M1,Ks2,M2}|Cs]) -> - M12 = maps:merge(M1,M2), - ok = check_keys_exist(Ks1 ++ Ks2, M12), - M21 = maps:merge(M2,M1), - ok = check_keys_exist(Ks1 ++ Ks2, M21), - - true = M12 =:= M21, - M12 = M21, - - merge_and_check_combo(Cs). - -build_keys_map_pairs([]) -> []; -build_keys_map_pairs([Ks|Kss]) -> - M = maps:from_list(keys_to_pairs(Ks)), - ok = check_keys_exist(Ks, M), - [{Ks,M}|build_keys_map_pairs(Kss)]. - -keys_to_pairs(Ks) -> [{K,K} || K <- Ks]. - - %% Maps module, not BIFs t_maps_fold(_Config) -> Vs = lists:seq(1,100), @@ -2572,191 +960,6 @@ %% MISC - -%% Verify that the the number of nodes in hashmaps -%% of different types and sizes does not deviate too -%% much from the theoretical model. -t_hashmap_balance(_Config) -> - io:format("Integer keys\n", []), - hashmap_balance(fun(I) -> I end), - io:format("Float keys\n", []), - hashmap_balance(fun(I) -> float(I) end), - io:format("String keys\n", []), - hashmap_balance(fun(I) -> integer_to_list(I) end), - io:format("Binary (big) keys\n", []), - hashmap_balance(fun(I) -> <> end), - io:format("Binary (little) keys\n", []), - hashmap_balance(fun(I) -> <> end), - io:format("Atom keys\n", []), - erts_debug:set_internal_state(available_internal_state, true), - hashmap_balance(fun(I) -> erts_debug:get_internal_state({atom,I}) end), - erts_debug:set_internal_state(available_internal_state, false), - - ok. - -hashmap_balance(KeyFun) -> - F = fun(I, {M0,Max0}) -> - Key = KeyFun(I), - M1 = M0#{Key => Key}, - Max1 = case erts_internal:map_type(M1) of - hashmap -> - Nodes = hashmap_nodes(M1), - Avg = maps:size(M1) * 0.4, - StdDev = math:sqrt(maps:size(M1)) / 3, - SD_diff = abs(Nodes - Avg) / StdDev, - %%io:format("~p keys: ~p nodes avg=~p SD_diff=~p\n", - %% [maps:size(M1), Nodes, Avg, SD_diff]), - {MaxDiff0, _} = Max0, - case {Nodes > Avg, SD_diff > MaxDiff0} of - {true, true} -> {SD_diff, M1}; - _ -> Max0 - end; - - flatmap -> Max0 - end, - {M1, Max1} - end, - - {_,{MaxDiff,MaxMap}} = lists:foldl(F, - {#{}, {0, 0}}, - lists:seq(1,10000)), - io:format("Max std dev diff ~p for map of size ~p (nodes=~p, flatsize=~p)\n", - [MaxDiff, maps:size(MaxMap), hashmap_nodes(MaxMap), erts_debug:flat_size(MaxMap)]), - - true = (MaxDiff < 6), % The probability of this line failing is about 0.000000001 - % for a uniform hash. I've set the probability this "high" for now - % to detect flaws in our make_internal_hash. - % Hard limit is 15 (see hashmap_over_estimated_heap_size). - ok. - -hashmap_nodes(M) -> - Info = erts_debug:map_info(M), - lists:foldl(fun(Tpl,Acc) -> - case element(1,Tpl) of - bitmaps -> Acc + element(2,Tpl); - arrays -> Acc + element(2,Tpl); - _ -> Acc - end - end, - 0, - Info). - -t_erts_internal_order(_Config) when is_list(_Config) -> - - -1 = erts_internal:cmp_term(1,2), - 1 = erts_internal:cmp_term(2,1), - 0 = erts_internal:cmp_term(2,2), - - - -1 = erts_internal:cmp_term(1,a), - 1 = erts_internal:cmp_term(a,1), - 0 = erts_internal:cmp_term(a,a), - - -1 = erts_internal:cmp_term(1,1.0), - 1 = erts_internal:cmp_term(1.0,1), - 0 = erts_internal:cmp_term(1.0,1.0), - - -1 = erts_internal:cmp_term(1,1 bsl 65), - 1 = erts_internal:cmp_term(1 bsl 65,1), - 0 = erts_internal:cmp_term(1 bsl 65, 1 bsl 65), - - -1 = erts_internal:cmp_term(1 bsl 65,float(1)), - 1 = erts_internal:cmp_term(float(1),1 bsl 65), - -1 = erts_internal:cmp_term(1,float(1 bsl 65)), - 1 = erts_internal:cmp_term(float(1 bsl 65),1), - 0 = erts_internal:cmp_term(float(1 bsl 65), float(1 bsl 65)), - - %% reported errors - -1 = erts_internal:cmp_term(0,2147483648), - 0 = erts_internal:cmp_term(2147483648,2147483648), - 1 = erts_internal:cmp_term(2147483648,0), - - M = #{0 => 0,2147483648 => 0}, - true = M =:= binary_to_term(term_to_binary(M)), - - F1 = fun(_, _) -> 0 end, - F2 = fun(_, _) -> 1 end, - M0 = maps:from_list( [{-2147483649, 0}, {0,0}, {97, 0}, {false, 0}, {flower, 0}, {F1, 0}, {F2, 0}, {<<>>, 0}]), - M1 = maps:merge(M0, #{0 => 1}), - 8 = maps:size(M1), - 1 = maps:get(0,M1), - ok. - -t_erts_internal_hash(_Config) when is_list(_Config) -> - K1 = 0.0, - K2 = 0.0/-1, - M = maps:from_list([{I,I}||I<-lists:seq(1,32)]), - - M1 = M#{ K1 => a, K2 => b }, - b = maps:get(K2,M1), - - M2 = M#{ K2 => a, K1 => b }, - b = maps:get(K1,M2), - - %% test previously faulty hash list optimization - - M3 = M#{[0] => a, [0,0] => b, [0,0,0] => c, [0,0,0,0] => d}, - a = maps:get([0],M3), - b = maps:get([0,0],M3), - c = maps:get([0,0,0],M3), - d = maps:get([0,0,0,0],M3), - - M4 = M#{{[0]} => a, {[0,0]} => b, {[0,0,0]} => c, {[0,0,0,0]} => d}, - a = maps:get({[0]},M4), - b = maps:get({[0,0]},M4), - c = maps:get({[0,0,0]},M4), - d = maps:get({[0,0,0,0]},M4), - - M5 = M3#{[0,0,0] => e, [0,0,0,0] => f, [0,0,0,0,0] => g, - [0,0,0,0,0,0] => h, [0,0,0,0,0,0,0] => i, - [0,0,0,0,0,0,0,0] => j, [0,0,0,0,0,0,0,0,0] => k}, - - a = maps:get([0],M5), - b = maps:get([0,0],M5), - e = maps:get([0,0,0],M5), - f = maps:get([0,0,0,0],M5), - g = maps:get([0,0,0,0,0],M5), - h = maps:get([0,0,0,0,0,0],M5), - i = maps:get([0,0,0,0,0,0,0],M5), - j = maps:get([0,0,0,0,0,0,0,0],M5), - k = maps:get([0,0,0,0,0,0,0,0,0],M5), - - M6 = M4#{{[0,0,0]} => e, {[0,0,0,0]} => f, {[0,0,0,0,0]} => g, - {[0,0,0,0,0,0]} => h, {[0,0,0,0,0,0,0]} => i, - {[0,0,0,0,0,0,0,0]} => j, {[0,0,0,0,0,0,0,0,0]} => k}, - - a = maps:get({[0]},M6), - b = maps:get({[0,0]},M6), - e = maps:get({[0,0,0]},M6), - f = maps:get({[0,0,0,0]},M6), - g = maps:get({[0,0,0,0,0]},M6), - h = maps:get({[0,0,0,0,0,0]},M6), - i = maps:get({[0,0,0,0,0,0,0]},M6), - j = maps:get({[0,0,0,0,0,0,0,0]},M6), - k = maps:get({[0,0,0,0,0,0,0,0,0]},M6), - - M7 = maps:merge(M5,M6), - - a = maps:get([0],M7), - b = maps:get([0,0],M7), - e = maps:get([0,0,0],M7), - f = maps:get([0,0,0,0],M7), - g = maps:get([0,0,0,0,0],M7), - h = maps:get([0,0,0,0,0,0],M7), - i = maps:get([0,0,0,0,0,0,0],M7), - j = maps:get([0,0,0,0,0,0,0,0],M7), - k = maps:get([0,0,0,0,0,0,0,0,0],M7), - a = maps:get({[0]},M7), - b = maps:get({[0,0]},M7), - e = maps:get({[0,0,0]},M7), - f = maps:get({[0,0,0,0]},M7), - g = maps:get({[0,0,0,0,0]},M7), - h = maps:get({[0,0,0,0,0,0]},M7), - i = maps:get({[0,0,0,0,0,0,0]},M7), - j = maps:get({[0,0,0,0,0,0,0,0]},M7), - k = maps:get({[0,0,0,0,0,0,0,0,0]},M7), - ok. - t_pdict(_Config) -> put(#{ a => b, b => a},#{ c => d}), @@ -2883,297 +1086,5 @@ Parent ! Msg, Parent. -t_has_map_fields(Config) when is_list(Config) -> - true = has_map_fields_1(#{one=>1}), - true = has_map_fields_1(#{one=>1,two=>2}), - false = has_map_fields_1(#{two=>2}), - false = has_map_fields_1(#{}), - - true = has_map_fields_2(#{c=>1,b=>2,a=>3}), - true = has_map_fields_2(#{c=>1,b=>2,a=>3,x=>42}), - false = has_map_fields_2(#{b=>2,c=>1}), - false = has_map_fields_2(#{x=>y}), - false = has_map_fields_2(#{}), - - true = has_map_fields_3(#{c=>1,b=>2,a=>3}), - true = has_map_fields_3(#{c=>1,b=>2,a=>3,[]=>42}), - true = has_map_fields_3(#{b=>2,a=>3,[]=>42,42.0=>43}), - true = has_map_fields_3(#{a=>3,[]=>42,42.0=>43}), - true = has_map_fields_3(#{[]=>42,42.0=>43}), - false = has_map_fields_3(#{b=>2,c=>1}), - false = has_map_fields_3(#{[]=>y}), - false = has_map_fields_3(#{42.0=>x,a=>99}), - false = has_map_fields_3(#{}), - - ok. - -has_map_fields_1(#{one:=_}) -> true; -has_map_fields_1(#{}) -> false. - -has_map_fields_2(#{a:=_,b:=_,c:=_}) -> true; -has_map_fields_2(#{}) -> false. - -has_map_fields_3(#{a:=_,b:=_}) -> true; -has_map_fields_3(#{[]:=_,42.0:=_}) -> true; -has_map_fields_3(#{}) -> false. - -y_regs(Config) when is_list(Config) -> - Val = [length(Config)], - Map0 = y_regs_update(#{}, Val), - Map2 = y_regs_update(Map0, Val), - - Map3 = maps:from_list([{I,I*I} || I <- lists:seq(1, 100)]), - Map4 = y_regs_update(Map3, Val), - - true = is_map(Map2) andalso is_map(Map4), - - ok. - -y_regs_update(Map0, Val0) -> - Val1 = {t,Val0}, - K1 = id({key,1}), - K2 = id({key,2}), - Map1 = Map0#{K1=>K1, - a=>Val0,b=>Val0,c=>Val0,d=>Val0,e=>Val0, - f=>Val0,g=>Val0,h=>Val0,i=>Val0,j=>Val0, - k=>Val0,l=>Val0,m=>Val0,n=>Val0,o=>Val0, - p=>Val0,q=>Val0,r=>Val0,s=>Val0,t=>Val0, - u=>Val0,v=>Val0,w=>Val0,x=>Val0,y=>Val0, - z=>Val0, - aa=>Val0,ab=>Val0,ac=>Val0,ad=>Val0,ae=>Val0, - af=>Val0,ag=>Val0,ah=>Val0,ai=>Val0,aj=>Val0, - ak=>Val0,al=>Val0,am=>Val0,an=>Val0,ao=>Val0, - ap=>Val0,aq=>Val0,ar=>Val0,as=>Val0,at=>Val0, - au=>Val0,av=>Val0,aw=>Val0,ax=>Val0,ay=>Val0, - az=>Val0, - K2=>[a,b,c]}, - Map2 = Map1#{K1=>K1, - a:=Val1,b:=Val1,c:=Val1,d:=Val1,e:=Val1, - f:=Val1,g:=Val1,h:=Val1,i:=Val1,j:=Val1, - k:=Val1,l:=Val1,m:=Val1,n:=Val1,o:=Val1, - p:=Val1,q:=Val1,r:=Val1,s:=Val1,t:=Val1, - u:=Val1,v:=Val1,w:=Val1,x:=Val1,y:=Val1, - z:=Val1, - aa:=Val1,ab:=Val1,ac:=Val1,ad:=Val1,ae:=Val1, - af:=Val1,ag:=Val1,ah:=Val1,ai:=Val1,aj:=Val1, - ak:=Val1,al:=Val1,am:=Val1,an:=Val1,ao:=Val1, - ap:=Val1,aq:=Val1,ar:=Val1,as:=Val1,at:=Val1, - au:=Val1,av:=Val1,aw:=Val1,ax:=Val1,ay:=Val1, - az:=Val1, - K2=>[a,b,c]}, - - %% Traverse the maps to validate them. - _ = erlang:phash2({Map1,Map2}, 100000), - - _ = id({K1,K2,Val0,Val1}), %Force use of Y registers. - Map2. - -do_badmap(Test) -> - Terms = [Test,fun erlang:abs/1,make_ref(),self(),0.0/id(-1), - <<0:1024>>,<<1:1>>,<<>>,<<1,2,3>>, - [],{a,b,c},[a,b],atom,10.0,42,(1 bsl 65) + 3], - [Test(T) || T <- Terms]. - -%% Test that a module compiled with the OTP 17 compiler will -%% generate the correct 'badmap' exception. -badmap_17(Config) -> - case ?MODULE of - map_SUITE -> do_badmap_17(Config); - _ -> {skip,"Run in map_SUITE"} - end. - -do_badmap_17(Config) -> - Mod = badmap_17, - DataDir = test_server:lookup_config(data_dir, Config), - Beam = filename:join(DataDir, Mod), - {module,Mod} = code:load_abs(Beam), - do_badmap(fun Mod:update/1). - %% Use this function to avoid compile-time evaluation of an expression. id(I) -> I. - - -%% OTP-13146 -%% Provoke major GC with a lot of "fat" maps on external format in msg queue -%% causing heap fragments to be allocated. -t_gc_rare_map_overflow(Config) -> - Pa = filename:dirname(code:which(?MODULE)), - {ok, Node} = test_server:start_node(gc_rare_map_overflow, slave, [{args, "-pa \""++Pa++"\""}]), - erts_debug:set_internal_state(available_internal_state, true), - try - Echo = spawn_link(Node, fun Loop() -> receive {From,Msg} -> From ! Msg - end, - Loop() - end), - FatMap = fatmap(34), - false = (flatmap =:= erts_internal:map_type(FatMap)), - - t_gc_rare_map_overflow_do(Echo, FatMap, fun() -> erlang:garbage_collect() end), - - %% Repeat test for minor gc: - t_gc_rare_map_overflow_do(Echo, FatMap, fun() -> minor_collect() end), - - unlink(Echo), - - %% Test fatmap in exit signal - Exiter = spawn_link(Node, fun Loop() -> receive {From,Msg} -> - "not_a_map" = Msg % badmatch! - end, - Loop() - end), - process_flag(trap_exit, true), - Exiter ! {self(), FatMap}, - {'EXIT', Exiter, {{badmatch,FatMap}, _}} = receive M -> M end, - ok - - after - process_flag(trap_exit, false), - erts_debug:set_internal_state(available_internal_state, false), - test_server:stop_node(Node) - end. - -t_gc_rare_map_overflow_do(Echo, FatMap, GcFun) -> - Master = self(), - true = receive M -> false after 0 -> true end, % assert empty msg queue - Echo ! {Master, token}, - repeat(1000, fun(_) -> Echo ! {Master, FatMap} end, void), - - timer:sleep(100), % Wait for maps to arrive in our msg queue - token = receive Tok -> Tok end, % and provoke move from outer to inner msg queue - - %% Do GC that will "overflow" and create heap frags due to all the fat maps - GcFun(), - - %% Now check that all maps in msg queueu are intact - %% Will crash emulator in OTP-18.1 - repeat(1000, fun(_) -> FatMap = receive FM -> FM end end, void), - ok. - -minor_collect() -> - Before = minor_gcs(), - erts_debug:set_internal_state(force_gc, self()), - erlang:yield(), - After = minor_gcs(), - io:format("minor_gcs: ~p -> ~p\n", [Before, After]). - -minor_gcs() -> - {garbage_collection, Info} = process_info(self(), garbage_collection), - {minor_gcs, GCS} = lists:keyfind(minor_gcs, 1, Info), - GCS. - -%% Generate a map with N (or N+1) keys that has an abnormal heap demand. -%% Done by finding keys that collide in the first 32-bit hash. -fatmap(N) -> - %%erts_debug:set_internal_state(available_internal_state, true), - Table = ets:new(void, [bag, private]), - - Seed0 = rand:seed_s(exsplus, {4711, 3141592, 2718281}), - Seed1 = fatmap_populate(Table, Seed0, (1 bsl 16)), - Keys = fatmap_generate(Table, Seed1, N, []), - ets:delete(Table), - maps:from_list([{K,K} || K <- Keys]). - -fatmap_populate(_, Seed, 0) -> Seed; -fatmap_populate(Table, Seed, N) -> - {I, NextSeed} = rand:uniform_s(1 bsl 48, Seed), - Hash = internal_hash(I), - ets:insert(Table, [{Hash, I}]), - fatmap_populate(Table, NextSeed, N-1). - - -fatmap_generate(_, _, N, Acc) when N =< 0 -> - Acc; -fatmap_generate(Table, Seed, N0, Acc0) -> - {I, NextSeed} = rand:uniform_s(1 bsl 48, Seed), - Hash = internal_hash(I), - case ets:member(Table, Hash) of - true -> - NewKeys = [I | ets:lookup_element(Table, Hash, 2)], - Acc1 = lists:usort(Acc0 ++ NewKeys), - N1 = N0 - (length(Acc1) - length(Acc0)), - fatmap_generate(Table, NextSeed, N1, Acc1); - false -> - fatmap_generate(Table, NextSeed, N0, Acc0) - end. - -internal_hash(Term) -> - erts_debug:get_internal_state({internal_hash, Term}). - - -%% map external_format (fannerl). -fannerl() -> - <<131,116,0,0,0,28,100,0,13,108,101,97,114,110,105,110,103,95,114, - 97,116,101,70,63,230,102,102,96,0,0,0,100,0,17,108,101,97,114,110,105,110, - 103,95,109,111,109,101,110,116,117,109,70,0,0,0,0,0,0,0,0,100,0, - 18,116,114,97,105,110,105,110,103,95,97,108,103,111,114,105,116,104,109,100,0, - 16,102,97,110,110,95,116,114,97,105,110,95,114,112,114,111,112, - 100,0,17,109,101,97,110,95,115,113,117,97,114,101,95,101,114,114,111,114,70, - 0,0,0,0,0,0,0,0,100,0,8,98,105,116,95,102,97,105,108,97,0,100,0,20, - 116,114,97,105,110,95,101,114,114,111,114,95,102,117,110,99,116,105,111, - 110,100,0,19,102,97,110,110,95,101,114,114,111,114,102,117,110,99, - 95,116,97,110,104,100,0,9,110,117,109,95,105,110,112,117,116,97,5,100,0,10,110, - 117,109,95,111,117,116,112,117,116,97,3,100,0,13,116,111,116,97,108, - 95,110,101,117,114,111,110,115,97,17,100,0,17,116,111,116,97,108,95,99,111,110, - 110,101,99,116,105,111,110,115,97,66,100,0,12,110,101,116,119,111,114,107, - 95,116,121,112,101,100,0,18,102,97,110,110,95,110,101,116,116,121,112,101, - 95,108,97,121,101,114,100,0,15,99,111,110,110,101,99,116,105,111,110,95, - 114,97,116,101,70,63,240,0,0,0,0,0,0,100,0,10,110,117,109,95,108,97,121,101, - 114,115,97,3,100,0,19,116,114,97,105,110,95,115,116,111,112,95,102,117,110, - 99,116,105,111,110,100,0,17,102,97,110,110,95,115,116,111,112,102,117,110, - 99,95,109,115,101,100,0,15,113,117,105,99,107,112,114,111,112,95,100,101,99, - 97,121,70,191,26,54,226,224,0,0,0,100,0,12,113,117,105,99,107,112,114, - 111,112,95,109,117,70,63,252,0,0,0,0,0,0,100,0,21,114,112,114,111,112,95,105, - 110,99,114,101,97,115,101,95,102,97,99,116,111,114,70,63,243,51,51, - 64,0,0,0,100,0,21,114,112,114,111,112,95,100,101,99,114,101,97,115,101, - 95,102,97,99,116,111,114,70,63,224,0,0,0,0,0,0,100,0,15,114,112,114,111,112, - 95,100,101,108,116,97,95,109,105,110,70,0,0,0,0,0,0,0,0,100,0,15,114,112,114, - 111,112,95,100,101,108,116,97,95,109,97,120,70,64,73,0,0,0,0,0,0,100,0, - 16,114,112,114,111,112,95,100,101,108,116,97,95,122,101,114,111,70,63,185,153, - 153,160,0,0,0,100,0,26,115,97,114,112,114,111,112,95,119,101,105,103, - 104,116,95,100,101,99,97,121,95,115,104,105,102,116,70,192,26,147,116,192,0,0,0, - 100,0,35,115,97,114,112,114,111,112,95,115,116,101,112,95,101,114, - 114,111,114,95,116,104,114,101,115,104,111,108,100,95,102,97,99,116,111,114,70, - 63,185,153,153,160,0,0,0,100,0,24,115,97,114,112,114,111,112,95,115, - 116,101,112,95,101,114,114,111,114,95,115,104,105,102,116,70,63,246,40,245, - 192,0,0,0,100,0,19,115,97,114,112,114,111,112,95,116,101,109,112,101,114, - 97,116,117,114,101,70,63,142,184,81,224,0,0,0,100,0,6,108,97,121,101,114,115, - 104,3,97,5,97,7,97,3,100,0,4,98,105,97,115,104,3,97,1,97,1,97,0,100,0,11, - 99,111,110,110,101,99,116,105,111,110,115,116,0,0,0,66,104,2,97,0,97,6,70, - 191,179,51,44,64,0,0,0,104,2,97,1,97,6,70,63,178,130,90,32,0,0,0,104,2,97,2, - 97,6,70,63,82,90,88,0,0,0,0,104,2,97,3,97,6,70,63,162,91,63,192,0,0,0,104,2, - 97,4,97,6,70,191,151,70,169,0,0,0,0,104,2,97,5,97,6,70,191,117,52,222,0,0,0, - 0,104,2,97,0,97,7,70,63,152,240,139,0,0,0,0,104,2,97,1,97,7,70,191,166,31, - 187,160,0,0,0,104,2,97,2,97,7,70,191,150,70,63,0,0,0,0,104,2,97,3,97,7,70, - 63,152,181,126,128,0,0,0,104,2,97,4,97,7,70,63,151,187,162,128,0,0,0,104,2, - 97,5,97,7,70,191,143,161,101,0,0,0,0,104,2,97,0,97,8,70,191,153,102,36,128,0, - 0,0,104,2,97,1,97,8,70,63,160,139,250,64,0,0,0,104,2,97,2,97,8,70,63,164,62, - 196,64,0,0,0,104,2,97,3,97,8,70,191,178,78,209,192,0,0,0,104,2,97,4,97,8,70, - 191,185,19,76,224,0,0,0,104,2,97,5,97,8,70,63,183,142,196,96,0,0,0,104,2,97,0, - 97,9,70,63,150,104,248,0,0,0,0,104,2,97,1,97,9,70,191,164,4,100,224,0,0,0, - 104,2,97,2,97,9,70,191,169,42,42,224,0,0,0,104,2,97,3,97,9,70,63,145,54,78,128,0, - 0,0,104,2,97,4,97,9,70,63,126,243,134,0,0,0,0,104,2,97,5,97,9,70,63,177, - 203,25,96,0,0,0,104,2,97,0,97,10,70,63,172,104,47,64,0,0,0,104,2,97,1,97,10, - 70,63,161,242,193,64,0,0,0,104,2,97,2,97,10,70,63,175,208,241,192,0,0,0,104,2, - 97,3,97,10,70,191,129,202,161,0,0,0,0,104,2,97,4,97,10,70,63,178,151,55,32,0,0,0, - 104,2,97,5,97,10,70,63,137,155,94,0,0,0,0,104,2,97,0,97,11,70,191,179, - 106,160,0,0,0,0,104,2,97,1,97,11,70,63,184,253,164,96,0,0,0,104,2,97,2,97,11, - 70,191,143,30,157,0,0,0,0,104,2,97,3,97,11,70,63,153,225,140,128,0,0,0,104, - 2,97,4,97,11,70,63,161,35,85,192,0,0,0,104,2,97,5,97,11,70,63,175,200,55,192, - 0,0,0,104,2,97,0,97,12,70,191,180,116,132,96,0,0,0,104,2,97,1,97,12,70,191, - 165,151,152,0,0,0,0,104,2,97,2,97,12,70,191,180,197,91,160,0,0,0,104,2,97,3,97,12, - 70,191,91,30,160,0,0,0,0,104,2,97,4,97,12,70,63,180,251,45,32,0,0,0, - 104,2,97,5,97,12,70,63,165,134,77,64,0,0,0,104,2,97,6,97,14,70,63,181,56,242,96, - 0,0,0,104,2,97,7,97,14,70,191,165,239,234,224,0,0,0,104,2,97,8,97,14, - 70,191,154,65,216,128,0,0,0,104,2,97,9,97,14,70,63,150,250,236,0,0,0,0,104,2,97, - 10,97,14,70,191,141,105,108,0,0,0,0,104,2,97,11,97,14,70,191,152,40, - 165,0,0,0,0,104,2,97,12,97,14,70,63,141,159,46,0,0,0,0,104,2,97,13,97,14,70, - 191,183,172,137,32,0,0,0,104,2,97,6,97,15,70,63,163,26,123,192,0,0,0,104, - 2,97,7,97,15,70,63,176,184,106,32,0,0,0,104,2,97,8,97,15,70,63,152,234,144, - 0,0,0,0,104,2,97,9,97,15,70,191,172,58,70,160,0,0,0,104,2,97,10,97,15,70, - 63,161,211,211,192,0,0,0,104,2,97,11,97,15,70,191,148,171,120,128,0,0,0,104, - 2,97,12,97,15,70,63,180,117,214,224,0,0,0,104,2,97,13,97,15,70,191,104, - 230,216,0,0,0,0,104,2,97,6,97,16,70,63,178,53,103,96,0,0,0,104,2,97,7,97,16, - 70,63,170,230,232,64,0,0,0,104,2,97,8,97,16,70,191,183,45,100,192,0,0,0, - 104,2,97,9,97,16,70,63,184,100,97,32,0,0,0,104,2,97,10,97,16,70,63,169,174, - 254,64,0,0,0,104,2,97,11,97,16,70,191,119,121,234,0,0,0,0,104,2,97,12,97, - 16,70,63,149,12,170,128,0,0,0,104,2,97,13,97,16,70,191,144,193,191,0,0,0,0>>. diff -Nru erlang-18.2-dfsg/erts/emulator/test/match_spec_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/match_spec_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/match_spec_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/match_spec_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -31,7 +30,6 @@ -export([fpe/1]). -export([otp_9422/1]). -export([faulty_seq_trace/1, do_faulty_seq_trace/0]). --export([maps/1]). -export([runner/2, loop_runner/3]). -export([f1/1, f2/2, f3/2, fn/1, fn/2, fn/3]). -export([do_boxed_and_small/0]). @@ -64,8 +62,7 @@ moving_labels, faulty_seq_trace, empty_list, - otp_9422, - maps]; + otp_9422]; true -> [not_run] end. @@ -170,11 +167,12 @@ [{['$1','$1'],[{is_atom, '$1'}],[kakalorum]}], [{call, {?MODULE, f2, [a, a]}}]), - %% Verify that 'process_dump' can handle a matchstate on the stack. - tr(fun() -> fbinmatch(<<0>>, 0) end, - {?MODULE, f1, 1}, - [{['_'],[],[{message, {process_dump}}]}], - [fun({trace, _, call, {?MODULE, f1, [0]}, _Bin}) -> true end]), +% case tr0(fun() -> ?MODULE:f2(a, a) end, +% {?MODULE, f2, 2}, +% [{['$1','$1'],[{is_atom, '$1'}],[{message, {process_dump}}]}]) of +% [{trace, _, call, {?MODULE, f2, [a, a]}, Bin}] -> +% erlang:display(binary_to_list(Bin)) +% end, % Error cases ?line errchk([{['$1','$1'],[{is_atom, '$1'}],[{banka, kanin}]}]), @@ -901,74 +899,6 @@ _ -> ok end. -maps(Config) when is_list(Config) -> - {ok,#{},[],[]} = erlang:match_spec_test(#{}, [{'_',[],['$_']}], table), - {ok,#{},[],[]} = erlang:match_spec_test(#{}, [{#{},[],['$_']}], table), - {ok,false,[],[]} = - erlang:match_spec_test(#{}, [{not_a_map,[],['$_']}], table), - {ok,bar,[],[]} = - erlang:match_spec_test(#{foo => bar}, - [{#{foo => '$1'},[],['$1']}], - table), - {ok,false,[],[]} = - erlang:match_spec_test(#{foo => bar}, - [{#{foo => qux},[],[qux]}], - table), - {ok,false,[],[]} = - erlang:match_spec_test(#{}, [{#{foo => '_'},[],[foo]}], table), - {error,_} = - erlang:match_spec_test(#{}, [{#{'$1' => '_'},[],[foo]}], table), - {ok,bar,[],[]} = - erlang:match_spec_test({#{foo => bar}}, - [{{#{foo => '$1'}},[],['$1']}], - table), - {ok,#{foo := 3},[],[]} = - erlang:match_spec_test({}, [{{},[],[#{foo => {'+',1,2}}]}], table), - - {ok,"camembert",[],[]} = - erlang:match_spec_test(#{b => "camembert",c => "cabécou"}, - [{#{b => '$1',c => "cabécou"},[],['$1']}], table), - - {ok,#{a :="camembert",b := "hi"},[],[]} = - erlang:match_spec_test(#{<<"b">> =>"camembert","c"=>"cabécou", "wat"=>"hi", b=><<"other">>}, - [{#{<<"b">> => '$1',"wat" => '$2'},[],[#{a=>'$1',b=>'$2'}]}], - table), - %% large maps - - Ls0 = [{I,<>}||I <- lists:seq(1,415)], - M0 = maps:from_list(Ls0), - M1 = #{a=>1,b=>2,c=>3,d=>4}, - - R1 = M0#{263 := #{ a=> 3 }}, - Ms1 = [{M1#{c:='$1'},[],[M0#{263 := #{a => '$1'}}]}], - - {ok,R1,[],[]} = erlang:match_spec_test(M1,Ms1,table), - - Ms2 = [{M0#{63:='$1', 19:='$2'},[],[M0#{19:='$1', 63:='$2'}]}], - R2 = M0#{63 := maps:get(19,M0), 19 := maps:get(63,M0) }, - {ok,R2,[],[]} = erlang:match_spec_test(M0,Ms2,table), - - ok = maps_check_loop(M1), - ok = maps_check_loop(M0), - M2 = maps:from_list([{integer_to_list(K),V} || {K,V} <- Ls0]), - ok = maps_check_loop(M2), - ok. - -maps_check_loop(M) -> - Ks = maps:keys(M), - maps_check_loop(M,M,M,M,Ks,lists:reverse(Ks),1). - -maps_check_loop(Orig,M0,MsM0,Rm0,[K|Ks],[Rk|Rks],Ix) -> - MsK = list_to_atom([$$]++integer_to_list(Ix)), - MsM1 = MsM0#{K := MsK}, - Rm1 = Rm0#{Rk := MsK}, - M1 = M0#{Rk := maps:get(K,MsM0)}, - Ms = [{MsM1,[],[Rm1]}], - {ok,M1,[],[]} = erlang:match_spec_test(Orig,Ms,table), - maps_check_loop(Orig,M1,MsM1,Rm1,Ks,Rks,Ix+1); -maps_check_loop(_,_,_,_,[],[],_) -> ok. - - empty_list(Config) when is_list(Config) -> Val=[{'$1',[], [{message,'$1'},{message,{caller}},{return_trace}]}], %% Did crash debug VM in faulty assert: @@ -998,14 +928,14 @@ erlang:trace(P, true, TraceFlags), erlang:trace_pattern(MFA, Pat, PatFlags), lists:map( - fun(X) when is_function(X,1) -> X; - (X) -> list_to_tuple([trace, P | tuple_to_list(X)]) + fun(X) -> + list_to_tuple([trace, P | tuple_to_list(X)]) end, Expected0) end). tr(RunFun, ControlFun) -> - P = spawn_link(?MODULE, runner, [self(), RunFun]), + P = spawn(?MODULE, runner, [self(), RunFun]), collect(P, ControlFun(P)). collect(P, TMs) -> @@ -1024,33 +954,18 @@ collect([TM | TMs]) -> ?t:format( "Expecting: ~p~n", [TM]), receive - M0 -> - M = case element(1, M0) of - trace_ts -> - list_to_tuple(lists:reverse( - tl(lists:reverse(tuple_to_list(M0))))); - _ -> M0 - end, - case is_function(TM,1) of - true -> - case (catch TM(M)) of - true -> - ?t:format("Got: ~p~n", [M]), - collect(TMs); - _ -> - ?t:format("Got unexpected: ~p~n", [M]), - flush({got_unexpected,M}) - end; - - false -> - case M of - TM -> - ?t:format("Got: ~p~n", [M]), - collect(TMs); - _ -> - ?t:format("Got unexpected: ~p~n", [M]), - flush({got_unexpected,M}) - end + M -> + case if element(1, M) == trace_ts -> + list_to_tuple(lists:reverse( + tl(lists:reverse(tuple_to_list(M))))); + true -> M + end of + TM -> + ?t:format("Got: ~p~n", [M]), + collect(TMs); + _ -> + ?t:format("Got unexpected: ~p~n", [M]), + flush({got_unexpected,M}) end end. @@ -1130,10 +1045,6 @@ fn(X, Y, Z) -> [X, Y, Z]. -fbinmatch(<>, Acc) -> - fbinmatch(Rest, [?MODULE:f1(Int) | Acc]); -fbinmatch(<<>>, Acc) -> Acc. - id(X) -> X. diff -Nru erlang-18.2-dfsg/erts/emulator/test/module_info_SUITE_data/module_info_test.erl erlang-17.3-dfsg/erts/emulator/test/module_info_SUITE_data/module_info_test.erl --- erlang-18.2-dfsg/erts/emulator/test/module_info_SUITE_data/module_info_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/module_info_SUITE_data/module_info_test.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% %CopyrightEnd% -%% - --module(module_info_test). --export([f/0]). - -f() -> - 17. diff -Nru erlang-18.2-dfsg/erts/emulator/test/module_info_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/module_info_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/module_info_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/module_info_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,7 +24,7 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2,end_per_testcase/2, - exports/1,functions/1,deleted/1,native/1,info/1]). + exports/1,functions/1,native/1]). %%-compile(native). @@ -52,8 +51,9 @@ end_per_group(_GroupName, Config) -> Config. -modules() -> - [exports, functions, deleted, native, info]. + +modules() -> + [exports, functions, native]. init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog = ?t:timetrap(?t:minutes(3)), @@ -81,66 +81,40 @@ %% Test that the list of exported functions from this module is correct. exports(Config) when is_list(Config) -> - All = all_exported(), - All = lists:sort(?MODULE:module_info(exports)), - (catch ?MODULE:foo()), - All = lists:sort(?MODULE:module_info(exports)), + ?line All = all_exported(), + ?line All = lists:sort(?MODULE:module_info(exports)), + ?line (catch ?MODULE:foo()), + ?line All = lists:sort(?MODULE:module_info(exports)), ok. %% Test that the list of exported functions from this module is correct. functions(Config) when is_list(Config) -> - All = all_functions(), - All = lists:sort(?MODULE:module_info(functions)), - ok. - -%% Test that deleted modules cause badarg -deleted(Config) when is_list(Config) -> - Data = ?config(data_dir, Config), - File = filename:join(Data, "module_info_test"), - {ok,module_info_test,Code} = compile:file(File, [binary]), - {module,module_info_test} = erlang:load_module(module_info_test, Code), - 17 = module_info_test:f(), - [_|_] = erlang:get_module_info(module_info_test, attributes), - [_|_] = erlang:get_module_info(module_info_test), - - %% first delete it - true = erlang:delete_module(module_info_test), - {'EXIT',{undef, _}} = (catch module_info_test:f()), - {'EXIT',{badarg, _}} = (catch erlang:get_module_info(module_info_test,attributes)), - {'EXIT',{badarg, _}} = (catch erlang:get_module_info(module_info_test)), - - %% then purge it - true = erlang:purge_module(module_info_test), - {'EXIT',{undef, _}} = (catch module_info_test:f()), - {'EXIT',{badarg, _}} = (catch erlang:get_module_info(module_info_test,attributes)), - {'EXIT',{badarg, _}} = (catch erlang:get_module_info(module_info_test)), + ?line All = all_functions(), + ?line All = lists:sort(?MODULE:module_info(functions)), ok. %% Test that the list of exported functions from this module is correct. -%% Verify that module_info(native) works. native(Config) when is_list(Config) -> - All = all_functions(), - case ?MODULE:module_info(native_addresses) of - [] -> - false = ?MODULE:module_info(native), - {comment,"no native functions"}; - L -> - true = ?MODULE:module_info(native), - %% Verify that all functions have unique addresses. - S0 = sofs:set(L, [{name,arity,addr}]), - S1 = sofs:projection({external,fun ?MODULE:native_proj/1}, S0), - S2 = sofs:relation_to_family(S1), - S3 = sofs:family_specification(fun ?MODULE:native_filter/1, S2), - 0 = sofs:no_elements(S3), - S4 = sofs:range(S1), - - %% Verify that the set of function with native addresses - %% is a subset of all functions in the module. - AllSet = sofs:set(All, [{name,arity}]), - true = sofs:is_subset(S4, AllSet), - - {comment,integer_to_list(sofs:no_elements(S0))++" native functions"} - end. + ?line All = all_functions(), + ?line case ?MODULE:module_info(native_addresses) of + [] -> + {comment,"no native functions"}; + L -> + %% Verify that all functions have unique addresses. + ?line S0 = sofs:set(L, [{name,arity,addr}]), + ?line S1 = sofs:projection({external,fun ?MODULE:native_proj/1}, S0), + ?line S2 = sofs:relation_to_family(S1), + ?line S3 = sofs:family_specification(fun ?MODULE:native_filter/1, S2), + ?line 0 = sofs:no_elements(S3), + ?line S4 = sofs:range(S1), + + %% Verify that the set of function with native addresses + %% is a subset of all functions in the module. + ?line AllSet = sofs:set(All, [{name,arity}]), + ?line true = sofs:is_subset(S4, AllSet), + + {comment,integer_to_list(sofs:no_elements(S0))++" native functions"} + end. native_proj({Name,Arity,Addr}) -> {Addr,{Name,Arity}}. @@ -148,22 +122,6 @@ native_filter(Set) -> sofs:no_elements(Set) =/= 1. -%% Test that the module info of this module is correct. Use -%% erlang:get_module_info(?MODULE) to avoid compiler optimization tricks. -info(Config) when is_list(Config) -> - Info = erlang:get_module_info(?MODULE), - All = all_exported(), - {ok,{?MODULE,MD5}} = beam_lib:md5(code:which(?MODULE)), - {module, ?MODULE} = lists:keyfind(module, 1, Info), - {md5, MD5} = lists:keyfind(md5, 1, Info), - {exports, Exports} = lists:keyfind(exports, 1, Info), - All = lists:sort(Exports), - {attributes, Attrs} = lists:keyfind(attributes, 1, Info), - {vsn,_} = lists:keyfind(vsn, 1, Attrs), - {compile, Compile} = lists:keyfind(compile, 1, Info), - {options,_} = lists:keyfind(options, 1, Compile), - ok. - %% Helper functions (local). add_arity(L) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/monitor_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/monitor_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/monitor_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/monitor_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,8 +26,7 @@ case_1/1, case_1a/1, case_2/1, case_2a/1, mon_e_1/1, demon_e_1/1, demon_1/1, demon_2/1, demon_3/1, demonitor_flush/1, local_remove_monitor/1, remote_remove_monitor/1, mon_1/1, mon_2/1, - large_exit/1, list_cleanup/1, mixer/1, named_down/1, otp_5827/1, - monitor_time_offset/1]). + large_exit/1, list_cleanup/1, mixer/1, named_down/1, otp_5827/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -40,8 +38,7 @@ [case_1, case_1a, case_2, case_2a, mon_e_1, demon_e_1, demon_1, mon_1, mon_2, demon_2, demon_3, demonitor_flush, {group, remove_monitor}, large_exit, - list_cleanup, mixer, named_down, otp_5827, - monitor_time_offset]. + list_cleanup, mixer, named_down, otp_5827]. groups() -> [{remove_monitor, [], @@ -62,7 +59,7 @@ init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:minutes(15)), - [{watchdog, Dog},{testcase, Func}|Config]. + [{watchdog, Dog}|Config]. end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), @@ -666,96 +663,110 @@ mixer(doc) -> "Test mixing of internal and external monitors."; mixer(Config) when is_list(Config) -> - PA = filename:dirname(code:which(?MODULE)), - NN = [j0,j1,j2], - NL0 = [begin - {ok, J} = test_server:start_node(X,slave,[{args, "-pa " ++ PA}]), - J - end || X <- NN], - NL1 = lists:duplicate(2,node()) ++ NL0, - Perm = perm(NL1), - lists:foreach( - fun(NL) -> - Js = [start_jeeves({[],M}) || M <- (NL ++ NL)], - [ask_jeeves(P,{monitor_process,self()}) || P <- Js], - {monitored_by,MB} = process_info(self(),monitored_by), - MBL = lists:sort(MB), - JsL = lists:sort(Js), - MBL = JsL, - {monitors,[]} = process_info(self(),monitors), - [tell_jeeves(P,{exit,flaff}) || P <- Js], - wait_for_m([],[],200) - end, - Perm), - lists:foreach( - fun(NL) -> - Js = [start_jeeves({[],M}) || M <- (NL ++ NL)], - Rs = [begin - {monitor_process,Ref} = ask_jeeves(P,{monitor_process,self()}), - {P,Ref} - end || P <- Js], - {monitored_by,MB} = process_info(self(),monitored_by), - MBL = lists:sort(MB), - JsL = lists:sort(Js), - MBL = JsL, - {monitors,[]} = process_info(self(),monitors), - [ask_jeeves(P,{demonitor,Ref}) || {P,Ref} <- Rs], - wait_for_m([],[],200), - [tell_jeeves(P,{exit,flaff}) || P <- Js] - end, - Perm), - lists:foreach( - fun(NL) -> - Js = [start_jeeves({[],M}) || M <- (NL ++ NL)], - [ask_jeeves(P,{monitor_process,self()}) || P <- Js], - [erlang:monitor(process,P) || P <- Js], - {monitored_by,MB} = process_info(self(),monitored_by), - MBL = lists:sort(MB), - JsL = lists:sort(Js), - MBL = JsL, - {monitors,M} = process_info(self(),monitors), - ML = lists:sort([P||{process,P} <- M]), - ML = JsL, - [begin - tell_jeeves(P,{exit,flaff}), - receive {'DOWN',_,process,P,_} -> ok end - end || P <- Js], - wait_for_m([],[],200) - end, - Perm), - lists:foreach( - fun(NL) -> - Js = [start_jeeves({[],M}) || M <- (NL ++ NL)], - Rs = [begin - {monitor_process,Ref} = ask_jeeves(P,{monitor_process,self()}), - {P,Ref} - end || P <- Js], - R2s = [{P,erlang:monitor(process,P)} || P <- Js], - {monitored_by,MB} = process_info(self(),monitored_by), - MBL = lists:sort(MB), - JsL = lists:sort(Js), - MBL = JsL, - {monitors,M} = process_info(self(),monitors), - ML = lists:sort([P||{process,P} <- M]), - ML = JsL, - [ask_jeeves(P,{demonitor,Ref}) || {P,Ref} <- Rs], - wait_for_m(lists:sort(M),[],200), - [erlang:demonitor(Ref) || {_P,Ref} <- R2s], - wait_for_m([],[],200), - [tell_jeeves(P,{exit,flaff}) || P <- Js] - end, - Perm), - [test_server:stop_node(K) || K <- NL0], + ?line PA = filename:dirname(code:which(?MODULE)), + ?line NN = [j0,j1,j2,j3], +% ?line NN = [j0,j1], + ?line NL0 = [begin + {ok, J} = test_server:start_node + (X, slave, [{args, "-pa " ++ PA}]), + J + end || X <- NN], + ?line NL1 = lists:duplicate(2,node()) ++ NL0, + ?line Perm = perm(NL1), + ?line lists:foreach( + fun(NL) -> + ?line Js = [ start_jeeves({[],M}) || M <- (NL ++ NL) ], + ?line [ask_jeeves(P,{monitor_process,self()}) || P <- Js], + ?line {monitored_by,MB} = + process_info(self(),monitored_by), + ?line MBL = lists:sort(MB), + ?line JsL = lists:sort(Js), + ?line MBL = JsL, + ?line {monitors,[]} = process_info(self(),monitors), + ?line [tell_jeeves(P,{exit,flaff}) || P <- Js], + ?line wait_for_m([],[],200) + end, + Perm), + ?line lists:foreach( + fun(NL) -> + ?line Js = [ start_jeeves({[],M}) || M <- (NL ++ NL) ], + ?line Rs = [begin + {monitor_process,Ref} = + ask_jeeves(P,{monitor_process,self()}), + {P,Ref} + end + || P <- Js], + ?line {monitored_by,MB} = + process_info(self(),monitored_by), + ?line MBL = lists:sort(MB), + ?line JsL = lists:sort(Js), + ?line MBL = JsL, + ?line {monitors,[]} = process_info(self(),monitors), + ?line [ask_jeeves(P,{demonitor,Ref}) || {P,Ref} <- Rs], + ?line wait_for_m([],[],200), + ?line [tell_jeeves(P,{exit,flaff}) || P <- Js] + end, + Perm), + ?line lists:foreach( + fun(NL) -> + ?line Js = [ start_jeeves({[],M}) || M <- (NL ++ NL) ], + ?line [ask_jeeves(P,{monitor_process,self()}) || P <- Js], + ?line [erlang:monitor(process,P) || P <- Js], + ?line {monitored_by,MB} = + process_info(self(),monitored_by), + ?line MBL = lists:sort(MB), + ?line JsL = lists:sort(Js), + ?line MBL = JsL, + ?line {monitors,M} = + process_info(self(),monitors), + ?line ML = lists:sort([P||{process,P} <- M]), + ?line ML = JsL, + ?line [begin + tell_jeeves(P,{exit,flaff}), + receive {'DOWN',_,process,P,_} -> ok end + end || P <- Js], + ?line wait_for_m([],[],200) + end, + Perm), + ?line lists:foreach( + fun(NL) -> + ?line Js = [ start_jeeves({[],M}) || M <- (NL ++ NL) ], + ?line Rs = [begin + {monitor_process,Ref} = + ask_jeeves(P,{monitor_process,self()}), + {P,Ref} + end + || P <- Js], + ?line R2s = [{P,erlang:monitor(process,P)} || P <- Js], + ?line {monitored_by,MB} = + process_info(self(),monitored_by), + ?line MBL = lists:sort(MB), + ?line JsL = lists:sort(Js), + ?line MBL = JsL, + ?line {monitors,M} = + process_info(self(),monitors), + ?line ML = lists:sort([P||{process,P} <- M]), + ?line ML = JsL, + ?line [ask_jeeves(P,{demonitor,Ref}) || {P,Ref} <- Rs], + ?line wait_for_m(lists:sort(M),[],200), + ?line [erlang:demonitor(Ref) || {_P,Ref} <- R2s], + ?line wait_for_m([],[],200), + ?line [tell_jeeves(P,{exit,flaff}) || P <- Js] + end, + Perm), + [test_server:stop_node(K) || K <- NL0 ], ok. named_down(doc) -> ["Test that DOWN message for a named monitor isn't" " delivered until name has been unregistered"]; named_down(suite) -> []; named_down(Config) when is_list(Config) -> + ?line {A,B,C} = now(), ?line Name = list_to_atom(atom_to_list(?MODULE) ++ "-named_down-" - ++ integer_to_list(erlang:system_time(seconds)) - ++ "-" ++ integer_to_list(erlang:unique_integer([positive]))), + ++ integer_to_list(A) + ++ "-" ++ integer_to_list(B) + ++ "-" ++ integer_to_list(C)), ?line Prio = process_flag(priority,high), %% Spawn a bunch of high prio cpu bound processes to prevent %% normal prio processes from terminating during the next @@ -826,89 +837,6 @@ ?line ?t:fail("erlang:monitor/2 hangs") end. -monitor_time_offset(Config) when is_list(Config) -> - {ok, Node} = start_node(Config, "+C single_time_warp"), - Me = self(), - PMs = lists:map(fun (_) -> - Pid = spawn(Node, - fun () -> - check_monitor_time_offset(Me) - end), - {Pid, erlang:monitor(process, Pid)} - end, - lists:seq(1, 100)), - lists:foreach(fun ({P, _M}) -> - P ! check_no_change_message - end, PMs), - lists:foreach(fun ({P, M}) -> - receive - {no_change_message_received, P} -> - ok; - {'DOWN', M, process, P, Reason} -> - ?t:fail(Reason) - end - end, PMs), - preliminary = rpc:call(Node, erlang, system_flag, [time_offset, finalize]), - lists:foreach(fun ({P, M}) -> - receive - {change_messages_received, P} -> - erlang:demonitor(M, [flush]); - {'DOWN', M, process, P, Reason} -> - ?t:fail(Reason) - end - end, PMs), - stop_node(Node), - ok. - -check_monitor_time_offset(Leader) -> - Mon1 = erlang:monitor(time_offset, clock_service), - Mon2 = erlang:monitor(time_offset, clock_service), - Mon3 = erlang:monitor(time_offset, clock_service), - Mon4 = erlang:monitor(time_offset, clock_service), - - erlang:demonitor(Mon2, [flush]), - - Mon5 = erlang:monitor(time_offset, clock_service), - Mon6 = erlang:monitor(time_offset, clock_service), - Mon7 = erlang:monitor(time_offset, clock_service), - - receive check_no_change_message -> ok end, - receive - {'CHANGE', _, time_offset, clock_service, _} -> - exit(unexpected_change_message_received) - after 0 -> - Leader ! {no_change_message_received, self()} - end, - receive after 100 -> ok end, - erlang:demonitor(Mon4, [flush]), - receive - {'CHANGE', Mon3, time_offset, clock_service, _} -> - ok - end, - receive - {'CHANGE', Mon6, time_offset, clock_service, _} -> - ok - end, - erlang:demonitor(Mon5, [flush]), - receive - {'CHANGE', Mon7, time_offset, clock_service, _} -> - ok - end, - receive - {'CHANGE', Mon1, time_offset, clock_service, _} -> - ok - end, - receive - {'CHANGE', _, time_offset, clock_service, _} -> - exit(unexpected_change_message_received) - after 1000 -> - ok - end, - Leader ! {change_messages_received, self()}. - -%% -%% ... -%% wait_for_m(_,_,0) -> exit(monitor_wait_timeout); @@ -1031,25 +959,3 @@ []; generate(Fun, N) -> [Fun() | generate(Fun, N-1)]. - -start_node(Config) -> - start_node(Config, ""). - -start_node(Config, Args) -> - TestCase = ?config(testcase, Config), - PA = filename:dirname(code:which(?MODULE)), - ESTime = erlang:monotonic_time(1) + erlang:time_offset(1), - Unique = erlang:unique_integer([positive]), - Name = list_to_atom(atom_to_list(?MODULE) - ++ "-" - ++ atom_to_list(TestCase) - ++ "-" - ++ integer_to_list(ESTime) - ++ "-" - ++ integer_to_list(Unique)), - test_server:start_node(Name, - slave, - [{args, "-pa " ++ PA ++ " " ++ Args}]). - -stop_node(Node) -> - test_server:stop_node(Node). diff -Nru erlang-18.2-dfsg/erts/emulator/test/mtx_SUITE_data/Makefile.src erlang-17.3-dfsg/erts/emulator/test/mtx_SUITE_data/Makefile.src --- erlang-18.2-dfsg/erts/emulator/test/mtx_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/mtx_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/test/mtx_SUITE_data/mtx_SUITE.c erlang-17.3-dfsg/erts/emulator/test/mtx_SUITE_data/mtx_SUITE.c --- erlang-18.2-dfsg/erts/emulator/test/mtx_SUITE_data/mtx_SUITE.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/mtx_SUITE_data/mtx_SUITE.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/mtx_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/mtx_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/mtx_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/mtx_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -442,10 +441,10 @@ receive after infinity -> ok end end) | Ps0] end, - Start = erlang:monotonic_time(), + Start = now(), lists:foreach(fun (P) -> P ! go end, Ps), lists:foreach(fun (P) -> receive {done, P} -> ok end end, Ps), - Stop = erlang:monotonic_time(), + Stop = now(), lists:foreach(fun (P) -> unlink(P), exit(P, bang), @@ -454,7 +453,7 @@ {'DOWN', M, process, P, _} -> ok end end, Ps), - Res = (Stop-Start)/erlang:convert_time_unit(1,seconds,native), + Res = timer:now_diff(Stop, Start)/1000000, Caller ! {?MODULE, self(), Res} end, TP = spawn_link(T), diff -Nru erlang-18.2-dfsg/erts/emulator/test/nested_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/nested_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/nested_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/nested_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/nif_SUITE_data/nif_mod.c erlang-17.3-dfsg/erts/emulator/test/nif_SUITE_data/nif_mod.c --- erlang-18.2-dfsg/erts/emulator/test/nif_SUITE_data/nif_mod.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/nif_SUITE_data/nif_mod.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -240,7 +239,7 @@ static ERL_NIF_TERM get_priv_data_ptr(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { ADD_CALL("get_priv_data_ptr"); - return enif_make_uint64(env, (ErlNifUInt64)priv_data(env)); + return enif_make_ulong(env, (unsigned long)priv_data(env)); } static ERL_NIF_TERM make_new_resource(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) diff -Nru erlang-18.2-dfsg/erts/emulator/test/nif_SUITE_data/nif_mod.erl erlang-17.3-dfsg/erts/emulator/test/nif_SUITE_data/nif_mod.erl --- erlang-18.2-dfsg/erts/emulator/test/nif_SUITE_data/nif_mod.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/nif_SUITE_data/nif_mod.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/nif_SUITE_data/nif_SUITE.c erlang-17.3-dfsg/erts/emulator/test/nif_SUITE_data/nif_SUITE.c --- erlang-18.2-dfsg/erts/emulator/test/nif_SUITE_data/nif_SUITE.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/nif_SUITE_data/nif_SUITE.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -381,8 +380,7 @@ ErlNifSInt64 sint64; ErlNifUInt64 uint64; double d; - ERL_NIF_TERM atom, ref1, ref2, term; - size_t len; + ERL_NIF_TERM atom, ref1, ref2; sint = INT_MIN; do { @@ -504,7 +502,6 @@ goto error; } } - ref1 = enif_make_ref(env); ref2 = enif_make_ref(env); if (!enif_is_ref(env,ref1) || !enif_is_ref(env,ref2) @@ -884,19 +881,15 @@ * * This function is separate from check_is because it calls enif_make_badarg * and so it must return the badarg exception as its return value. Thus, the - * badarg exception indicates success. + * badarg exception indicates success. Failure is indicated by returning an + * error atom. */ static ERL_NIF_TERM check_is_exception(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { - ERL_NIF_TERM badarg, exc_term; ERL_NIF_TERM error_atom = enif_make_atom(env, "error"); - ERL_NIF_TERM badarg_atom = enif_make_atom(env, "badarg"); - assert(!enif_is_exception(env, error_atom)); - badarg = enif_make_badarg(env); - assert(enif_is_exception(env, badarg)); - assert(enif_has_pending_exception(env, NULL)); - assert(enif_has_pending_exception(env, &exc_term)); - assert(enif_is_identical(exc_term, badarg_atom)); + ERL_NIF_TERM badarg = enif_make_badarg(env); + if (enif_is_exception(env, error_atom)) return error_atom; + if (!enif_is_exception(env, badarg)) return error_atom; return badarg; } @@ -1540,12 +1533,9 @@ static ERL_NIF_TERM call_nif_schedule(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { - ERL_NIF_TERM result; if (argc != 2) return enif_make_atom(env, "false"); - result = enif_schedule_nif(env, "nif_sched1", 0, nif_sched1, argc, argv); - assert(!enif_is_exception(env, result)); - return result; + return enif_schedule_nif(env, "nif_sched1", 0, nif_sched1, argc, argv); } #ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT @@ -1618,144 +1608,23 @@ static ERL_NIF_TERM call_dirty_nif_exception(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { switch (argc) { - case 1: { - int arg; - if (enif_get_int(env, argv[0], &arg) && arg < 2) { - ERL_NIF_TERM args[255]; - int i; - args[0] = argv[0]; - for (i = 1; i < 255; i++) - args[i] = enif_make_int(env, i); - return enif_schedule_nif(env, "call_dirty_nif_exception", ERL_NIF_DIRTY_JOB_CPU_BOUND, - call_dirty_nif_exception, 255, args); - } else { - return enif_raise_exception(env, argv[0]); - } - } - case 2: { - int return_badarg_directly; - enif_get_int(env, argv[0], &return_badarg_directly); - assert(return_badarg_directly == 1 || return_badarg_directly == 0); - if (return_badarg_directly) - return enif_make_badarg(env); - else { - /* ignore return value */ enif_make_badarg(env); - return enif_make_atom(env, "ok"); - } + case 0: { + ERL_NIF_TERM args[255]; + int i; + for (i = 0; i < 255; i++) + args[i] = enif_make_int(env, i); + return enif_schedule_nif(env, "call_dirty_nif_exception", ERL_NIF_DIRTY_JOB_CPU_BOUND, + call_dirty_nif_exception, 255, argv); } + case 1: + return enif_make_badarg(env); default: return enif_schedule_nif(env, "call_dirty_nif_exception", ERL_NIF_DIRTY_JOB_CPU_BOUND, call_dirty_nif_exception, argc-1, argv); } } - -static ERL_NIF_TERM call_dirty_nif_zero_args(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) -{ - int i; - ERL_NIF_TERM result[1000]; - ERL_NIF_TERM ok = enif_make_atom(env, "ok"); - assert(argc == 0); - for (i = 0; i < sizeof(result)/sizeof(*result); i++) { - result[i] = ok; - } - return enif_make_list_from_array(env, result, i); -} #endif -/* - * If argv[0] is the integer 0, call enif_make_badarg, but don't return its - * return value. Instead, return ok. Result should still be a badarg - * exception for the erlang caller. - * - * For any other value of argv[0], use it as an exception term and return - * the exception. - */ -static ERL_NIF_TERM call_nif_exception(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) -{ - ERL_NIF_TERM exc_term; - ERL_NIF_TERM badarg_atom = enif_make_atom(env, "badarg"); - int arg; - - if (enif_get_int(env, argv[0], &arg) && arg == 0) { - /* ignore return value */ enif_make_badarg(env); - assert(enif_has_pending_exception(env, NULL)); - assert(enif_has_pending_exception(env, &exc_term)); - assert(enif_is_identical(badarg_atom, exc_term)); - return enif_make_atom(env, "ok"); - } else { - ERL_NIF_TERM exc_retval = enif_raise_exception(env, argv[0]); - assert(enif_has_pending_exception(env, NULL)); - assert(enif_has_pending_exception(env, &exc_term)); - assert(enif_is_identical(argv[0], exc_term)); - return exc_retval; - } -} - -#if !defined(NAN) || !defined(INFINITY) -double zero(void) -{ - return 0.0; -} -#endif - -static ERL_NIF_TERM call_nif_nan_or_inf(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) -{ - double val; - char arg[6]; - ERL_NIF_TERM res; - - assert(argc == 1); - enif_get_atom(env, argv[0], arg, sizeof arg, ERL_NIF_LATIN1); - if (strcmp(arg, "nan") == 0) { - /* Verify that enif_make_double raises a badarg for NaN */ -#ifdef NAN - val = NAN; -#else - val = 0.0/zero(); -#endif - } else { - /* Verify that enif_make_double raises a badarg for NaN and infinity */ -#ifdef INFINITY - val = INFINITY; -#else - val = 1.0/zero(); -#endif - } - res = enif_make_double(env, val); - assert(enif_is_exception(env, res)); - assert(enif_has_pending_exception(env, NULL)); - if (strcmp(arg, "tuple") == 0) { - return enif_make_tuple2(env, argv[0], res); - } else { - return res; - } -} - -static ERL_NIF_TERM call_nif_atom_too_long(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) -{ - char str[257]; - char arg[4]; - size_t len; - int i; - ERL_NIF_TERM res; - - assert(argc == 1); - enif_get_atom(env, argv[0], arg, sizeof arg, ERL_NIF_LATIN1); - /* Verify that creating an atom from a string that's too long results in a badarg */ - for (i = 0; i < sizeof str; ++i) { - str[i] = 'a'; - } - str[256] = '\0'; - if (strcmp(arg, "len") == 0) { - len = strlen(str); - res = enif_make_atom_len(env, str, len); - } else { - res = enif_make_atom(env, str); - } - assert(enif_is_exception(env, res)); - return res; -} - static ERL_NIF_TERM is_map_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { return enif_make_int(env, enif_is_map(env,argv[0])); @@ -1832,13 +1701,12 @@ if (argc != 1 && !enif_is_map(env, map)) return enif_make_int(env, __LINE__); - if(!enif_map_iterator_create(env, map, &iter_f, ERL_NIF_MAP_ITERATOR_FIRST)) + if(!enif_map_iterator_create(env, map, &iter_f, ERL_NIF_MAP_ITERATOR_HEAD)) return enif_make_int(env, __LINE__); cnt = 0; - next_ret = 1; while(enif_map_iterator_get_pair(env,&iter_f,&key,&value)) { - if (!next_ret) + if (cnt && !next_ret) return enif_make_int(env, __LINE__); list_f = enif_make_list_cell(env, enif_make_tuple2(env, key, value), list_f); next_ret = enif_map_iterator_next(env,&iter_f); @@ -1847,13 +1715,12 @@ if (cnt && next_ret) return enif_make_int(env, __LINE__); - if(!enif_map_iterator_create(env, map, &iter_b, ERL_NIF_MAP_ITERATOR_LAST)) + if(!enif_map_iterator_create(env, map, &iter_b, ERL_NIF_MAP_ITERATOR_TAIL)) return enif_make_int(env, __LINE__); cnt = 0; - prev_ret = 1; while(enif_map_iterator_get_pair(env,&iter_b,&key,&value)) { - if (!prev_ret) + if (cnt && !prev_ret) return enif_make_int(env, __LINE__); /* Test that iter_f can step "backwards" */ @@ -1865,7 +1732,6 @@ list_b = enif_make_list_cell(env, enif_make_tuple2(env, key, value), list_b); prev_ret = enif_map_iterator_prev(env,&iter_b); - cnt++; } if (cnt) { @@ -1940,12 +1806,8 @@ #ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT {"call_dirty_nif", 3, call_dirty_nif}, {"send_from_dirty_nif", 1, send_from_dirty_nif, ERL_NIF_DIRTY_JOB_CPU_BOUND}, - {"call_dirty_nif_exception", 1, call_dirty_nif_exception, ERL_NIF_DIRTY_JOB_IO_BOUND}, - {"call_dirty_nif_zero_args", 0, call_dirty_nif_zero_args, ERL_NIF_DIRTY_JOB_CPU_BOUND}, + {"call_dirty_nif_exception", 0, call_dirty_nif_exception, ERL_NIF_DIRTY_JOB_IO_BOUND}, #endif - {"call_nif_exception", 1, call_nif_exception}, - {"call_nif_nan_or_inf", 1, call_nif_nan_or_inf}, - {"call_nif_atom_too_long", 1, call_nif_atom_too_long}, {"is_map_nif", 1, is_map_nif}, {"get_map_size_nif", 1, get_map_size_nif}, {"make_new_map_nif", 0, make_new_map_nif}, diff -Nru erlang-18.2-dfsg/erts/emulator/test/nif_SUITE_data/testcase_driver.h erlang-17.3-dfsg/erts/emulator/test/nif_SUITE_data/testcase_driver.h --- erlang-18.2-dfsg/erts/emulator/test/nif_SUITE_data/testcase_driver.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/nif_SUITE_data/testcase_driver.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/nif_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/nif_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/nif_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/nif_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -40,9 +39,7 @@ get_length/1, make_atom/1, make_string/1, reverse_list_test/1, otp_9828/1, otp_9668/1, consume_timeslice/1, dirty_nif/1, dirty_nif_send/1, - dirty_nif_exception/1, call_dirty_nif_exception/1, nif_schedule/1, - nif_exception/1, call_nif_exception/1, - nif_nan_and_inf/1, nif_atom_too_long/1 + dirty_nif_exception/1, nif_schedule/1 ]). -export([many_args_100/100]). @@ -71,8 +68,7 @@ make_string,reverse_list_test, otp_9828, otp_9668, consume_timeslice, - nif_schedule, dirty_nif, dirty_nif_send, dirty_nif_exception, - nif_exception, nif_nan_and_inf, nif_atom_too_long + nif_schedule, dirty_nif, dirty_nif_send, dirty_nif_exception ]. groups() -> @@ -455,7 +451,7 @@ M = maps_from_list_nif(Pairs), R = {RIs,Is} = sorted_list_from_maps_nif(M), io:format("Pairs: ~p~nMap: ~p~nReturned: ~p~n", [lists:sort(Pairs),M,R]), - true = (lists:sort(Is) =:= lists:sort(Pairs)), + Is = lists:sort(Pairs), Is = lists:reverse(RIs), #{} = maps_from_list_nif([]), @@ -1192,9 +1188,7 @@ %% Let a number of processes send random message blobs between each other %% using enif_send. Kill and spawn new ones randomly to keep a ~constant %% number of workers running. - Seed = {erlang:monotonic_time(), - erlang:time_offset(), - erlang:unique_integer()}, + Seed = now(), io:format("seed: ~p\n",[Seed]), random:seed(Seed), ets:new(nif_SUITE,[named_table,public]), @@ -1389,7 +1383,7 @@ self(), hd(erlang:ports()), [], [1,9,9,8], {hejsan, "hejsan", [$h,"ejs",<<"an">>]}, -18446744073709551616.2e2), try - ?line check_is_exception(), + ?line error = check_is_exception(), ?line throw(expected_badarg) catch error:badarg -> @@ -1570,8 +1564,6 @@ Val2 = "Erlang", Val3 = list_to_binary([Val2, 0]), {Val1, Val2, Val3} = call_dirty_nif(Val1, Val2, Val3), - LargeArray = lists:duplicate(1000, ok), - LargeArray = call_dirty_nif_zero_args(), ok catch error:badarg -> @@ -1601,94 +1593,19 @@ N when is_integer(N) -> ensure_lib_loaded(Config), try - %% this checks that the expected exception occurs when the - %% dirty NIF returns the result of enif_make_badarg - %% directly - call_dirty_nif_exception(1), - ?t:fail(expected_badarg) - catch - error:badarg -> - [{?MODULE,call_dirty_nif_exception,[1],_}|_] = - erlang:get_stacktrace(), - ok - end, - try - %% this checks that the expected exception occurs when the - %% dirty NIF calls enif_make_badarg at some point but then - %% returns a value that isn't an exception - call_dirty_nif_exception(0), + call_dirty_nif_exception(), ?t:fail(expected_badarg) catch error:badarg -> - [{?MODULE,call_dirty_nif_exception,[0],_}|_] = + [{?MODULE,call_dirty_nif_exception,[],_}|_] = erlang:get_stacktrace(), ok - end, - %% this checks that a dirty NIF can raise various terms as - %% exceptions - ok = nif_raise_exceptions(call_dirty_nif_exception) + end catch error:badarg -> {skipped,"No dirty scheduler support"} end. -nif_exception(Config) when is_list(Config) -> - ensure_lib_loaded(Config), - try - %% this checks that the expected exception occurs when the NIF - %% calls enif_make_badarg at some point but then tries to return a - %% value that isn't an exception - call_nif_exception(0), - ?t:fail(expected_badarg) - catch - error:badarg -> - ok - end, - %% this checks that a NIF can raise various terms as exceptions - ok = nif_raise_exceptions(call_nif_exception), - ok. - -nif_nan_and_inf(Config) when is_list(Config) -> - ensure_lib_loaded(Config), - try - call_nif_nan_or_inf(nan), - ?t:fail(expected_badarg) - catch - error:badarg -> - ok - end, - try - call_nif_nan_or_inf(inf), - ?t:fail(expected_badarg) - catch - error:badarg -> - ok - end, - try - call_nif_nan_or_inf(tuple), - ?t:fail(expected_badarg) - catch - error:badarg -> - ok - end. - -nif_atom_too_long(Config) when is_list(Config) -> - ensure_lib_loaded(Config), - try - call_nif_atom_too_long(all), - ?t:fail(expected_badarg) - catch - error:badarg -> - ok - end, - try - call_nif_atom_too_long(len), - ?t:fail(expected_badarg) - catch - error:badarg -> - ok - end. - next_msg(_Pid) -> receive M -> M @@ -1768,20 +1685,7 @@ io:format("CHECK at ~p: Expected ~p but got ~p\n",[Line,Exp,Got]), Got end. - -nif_raise_exceptions(NifFunc) -> - ExcTerms = [{error, test}, "a string", <<"a binary">>, - 42, [1,2,3,4,5], [{p,1},{p,2},{p,3}]], - lists:foldl(fun(Term, ok) -> - try - erlang:apply(?MODULE,NifFunc,[Term]), - ?t:fail({expected,Term}) - catch - error:Term -> - [{?MODULE,NifFunc,[Term],_}|_] = erlang:get_stacktrace(), - ok - end - end, ok, ExcTerms). + %% The NIFs: lib_version() -> undefined. @@ -1835,11 +1739,7 @@ call_nif_schedule(_,_) -> ?nif_stub. call_dirty_nif(_,_,_) -> ?nif_stub. send_from_dirty_nif(_) -> ?nif_stub. -call_dirty_nif_exception(_) -> ?nif_stub. -call_dirty_nif_zero_args() -> ?nif_stub. -call_nif_exception(_) -> ?nif_stub. -call_nif_nan_or_inf(_) -> ?nif_stub. -call_nif_atom_too_long(_) -> ?nif_stub. +call_dirty_nif_exception() -> ?nif_stub. %% maps is_map_nif(_) -> ?nif_stub. diff -Nru erlang-18.2-dfsg/erts/emulator/test/node_container_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/node_container_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/node_container_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/node_container_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -74,8 +73,6 @@ Config. end_per_suite(_Config) -> - erts_debug:set_internal_state(available_internal_state, true), - erts_debug:set_internal_state(node_tab_delayed_delete, -1), %% restore original value available_internal_state(false). init_per_group(_GroupName, Config) -> @@ -422,8 +419,6 @@ ["Tests that node tables are garbage collected."]; node_table_gc(suite) -> []; node_table_gc(Config) when is_list(Config) -> - erts_debug:set_internal_state(available_internal_state, true), - erts_debug:set_internal_state(node_tab_delayed_delete, 0), ?line PreKnown = nodes(known), ?line ?t:format("PreKnown = ~p~n", [PreKnown]), ?line make_node_garbage(0, 200000, 1000, []), @@ -433,7 +428,6 @@ ?line ?t:format("PostAreas = ~p~n", [PostAreas]), ?line true = length(PostKnown) =< length(PreKnown), ?line nc_refc_check(node()), - erts_debug:set_internal_state(node_tab_delayed_delete, -1), %% restore original value ?line ok. make_node_garbage(N, L, I, Ps) when N < L -> @@ -585,8 +579,6 @@ "as they should for entities controlling a connections."]; node_controller_refc(suite) -> []; node_controller_refc(Config) when is_list(Config) -> - erts_debug:set_internal_state(available_internal_state, true), - erts_debug:set_internal_state(node_tab_delayed_delete, 0), ?line NodeFirstName = get_nodefirstname(), ?line ?line {ok, Node} = start_node(NodeFirstName), ?line true = lists:member(Node, nodes()), @@ -614,7 +606,6 @@ ?line false = get_dist_references(Node), ?line false = lists:member(Node, nodes(known)), ?line nc_refc_check(node()), - erts_debug:set_internal_state(node_tab_delayed_delete, -1), %% restore original value ?line ok. %% @@ -998,32 +989,23 @@ check_refc(ThisNodeName,ThisCreation,Table,EntryList) when is_list(EntryList) -> lists:foreach( fun ({Entry, Refc, ReferrerList}) -> - {DelayedDeleteTimer, - FoundRefs} = + FoundRefs = lists:foldl( - fun ({Referrer, ReferencesList}, {DDT, A1}) -> - {case Referrer of - {system,delayed_delete_timer} -> - true; - _ -> - DDT - end, - A1 + lists:foldl(fun ({_T,Rs},A2) -> - A2+Rs - end, - 0, - ReferencesList)} + fun ({_Referrer, ReferencesList}, A1) -> + A1 + lists:foldl(fun ({_T,Rs},A2) -> + A2+Rs + end, + 0, + ReferencesList) end, - {false, 0}, + 0, ReferrerList), - %% Reference count equals found references? - case {Refc, FoundRefs, DelayedDeleteTimer} of - {X, X, _} -> - ok; - {0, 1, true} -> + %% Reference count equals found references ? + case Refc =:= FoundRefs of + true -> ok; - _ -> + false -> exit({invalid_reference_count, Table, Entry}) end, @@ -1031,8 +1013,7 @@ case {Entry, Refc} of {ThisNodeName, 0} -> ok; {{ThisNodeName, ThisCreation}, 0} -> ok; - {_, 0} when DelayedDeleteTimer == false -> - exit({not_referred_entry_in_table, Table, Entry}); + {_, 0} -> exit({not_referred_entry_in_table, Table, Entry}); {_, _} -> ok end @@ -1136,18 +1117,26 @@ false -> receive after 100 -> wait_until(Pred) end end. -get_nodefirstname_string() -> - atom_to_list(?MODULE) - ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) - ++ "-" - ++ integer_to_list(erlang:unique_integer([positive])). get_nodefirstname() -> - list_to_atom(get_nodefirstname_string()). + {A, B, C} = now(), + list_to_atom(atom_to_list(?MODULE) + ++ "-" + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) + ++ "-" + ++ integer_to_list(C)). get_nodename() -> - list_to_atom(get_nodefirstname_string() + {A, B, C} = now(), + list_to_atom(atom_to_list(?MODULE) + ++ "-" + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) + ++ "-" + ++ integer_to_list(C) ++ "@" ++ hostname()). diff -Nru erlang-18.2-dfsg/erts/emulator/test/nofrag_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/nofrag_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/nofrag_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/nofrag_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/num_bif_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/num_bif_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/num_bif_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/num_bif_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -429,7 +428,7 @@ list_to_binary(Value))), {'EXIT', {badarg, _}} = (catch erlang:list_to_integer(Value)) - end,["1.0"," 1"," -1","","+"]), + end,["1.0"," 1"," -1",""]), % Custom base error cases lists:foreach(fun({Value,Base}) -> @@ -442,11 +441,7 @@ {"1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111z",16}, {"1z111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",16}, {"111z11111111",16}]), - - %% log2 calculation overflow bug in do_integer_to_list (OTP-12624) - %% Would crash with segv - 0 = list_to_integer(lists:duplicate(10000000,$0)), - + ok. test_sti(Num) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/old_mod.erl erlang-17.3-dfsg/erts/emulator/test/old_mod.erl --- erlang-18.2-dfsg/erts/emulator/test/old_mod.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/old_mod.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/old_scheduler_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/old_scheduler_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/old_scheduler_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/old_scheduler_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -117,7 +116,7 @@ %% start controllers ?line Receiver = - spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Normal, Low) end), + spawn(fun() -> receiver(now(), Time, Self, Normal, Low) end), ?line Starter = spawn(fun() -> starter(Normal, Low, Receiver) end), @@ -155,7 +154,7 @@ Time = 30, ?line Receiver = - spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Normal, Low) end), + spawn(fun() -> receiver(now(), Time, Self, Normal, Low) end), ?line Starter = spawn(fun() -> starter(Normal, Low, Receiver) end), ?line {NRs,NAvg,LRs,LAvg,Ratio} = @@ -186,7 +185,7 @@ Time = 30, ?line Receiver = - spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Normal, Low) end), + spawn(fun() -> receiver(now(), Time, Self, Normal, Low) end), ?line Starter = spawn(fun() -> starter(Normal, Low, Receiver) end), ?line {NRs,NAvg,LRs,LAvg,Ratio} = @@ -221,7 +220,7 @@ Time = 30, ?line Receiver1 = - spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Max, High) end), + spawn(fun() -> receiver(now(), Time, Self, Max, High) end), ?line Starter1 = spawn(fun() -> starter(Max, High, Receiver1) end), ?line {M1Rs,M1Avg,HRs,HAvg,Ratio1} = @@ -239,7 +238,7 @@ end, ?line Receiver2 = - spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Max, Normal) end), + spawn(fun() -> receiver(now(), Time, Self, Max, Normal) end), ?line Starter2 = spawn(fun() -> starter(Max, Normal, Receiver2) end), ?line {M2Rs,M2Avg,NRs,NAvg,Ratio2} = @@ -257,7 +256,7 @@ end, ?line Receiver3 = - spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Max, Low) end), + spawn(fun() -> receiver(now(), Time, Self, Max, Low) end), ?line Starter3 = spawn(fun() -> starter(Max, Low, Receiver3) end), ?line {M3Rs,M3Avg,LRs,LAvg,Ratio3} = @@ -291,7 +290,7 @@ Time = 30, ?line Receiver1 = - spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, High, Normal) end), + spawn(fun() -> receiver(now(), Time, Self, High, Normal) end), ?line Starter1 = spawn(fun() -> starter(High, Normal, Receiver1) end), ?line {H1Rs,H1Avg,NRs,NAvg,Ratio1} = @@ -309,7 +308,7 @@ end, ?line Receiver2 = - spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, High, Low) end), + spawn(fun() -> receiver(now(), Time, Self, High, Low) end), ?line Starter2 = spawn(fun() -> starter(High, Low, Receiver2) end), ?line {H2Rs,H2Avg,LRs,LAvg,Ratio2} = @@ -338,13 +337,12 @@ %% uncomment lines below to get life sign (debug) receiver(T0, Time, Main, P1,P1N,P1Rs, P2,P2N,P2Rs, 0) -> -% T = erlang:convert_time_unit(erlang:monotonic_time() - T0, native, milli_seconds), +% T = elapsed_ms(T0, now()), % erlang:display({round(T/1000),P1Rs,P2Rs}), receiver(T0, Time, Main, P1,P1N,P1Rs, P2,P2N,P2Rs, 100000); receiver(T0, Time, Main, P1,P1N,P1Rs, P2,P2N,P2Rs, C) -> - Remain = Time - erlang:convert_time_unit(erlang:monotonic_time() - T0, - native, milli_seconds), % test time remaining + Remain = Time - elapsed_ms(T0, now()), % test time remaining Remain1 = if Remain < 0 -> 0; true -> @@ -411,3 +409,6 @@ ok end, flush_loop(). + +elapsed_ms({_MS0,S0,MuS0},{_MS1,S1,MuS1}) -> + round(((S1-S0)*1000)+((MuS1-MuS0)/1000)). diff -Nru erlang-18.2-dfsg/erts/emulator/test/op_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/op_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/op_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/op_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -274,8 +273,7 @@ ?line Bbts = lists:foldr(fun internal_bif/2, [Ok], Es), ?line Fun3 = make_function(bif_tests, Bbts), ?line Id = {function,1,id,1,[{clause,1,[{var,1,'I'}],[],[{var,1,'I'}]}]}, - Module0 = make_module(op_tests, [Fun1,Fun2,Fun3,Id]), - Module = erl_parse:new_anno(Module0), + ?line Module = make_module(op_tests, [Fun1,Fun2,Fun3,Id]), ?line lists:foreach(fun(F) -> io:put_chars([erl_pp:form(F),"\n"]) end, Module), %% Compile, load, and run the generated module. @@ -367,16 +365,13 @@ make_function(Name, Body) -> {function,1,Name,0,[{clause,1,[],[],Body}]}. -eval(E0) -> - E = erl_parse:new_anno(E0), +eval(E) -> ?line case catch erl_eval:exprs(E, []) of {'EXIT',Reason} -> {'EXIT',Reason}; {value,Val,_Bs} -> Val end. -unvalue(V) -> - Abstr = erl_parse:abstract(V), - erl_parse:anno_to_term(Abstr). +unvalue(V) -> erl_parse:abstract(V). value({nil,_}) -> []; value({integer,_,X}) -> X; diff -Nru erlang-18.2-dfsg/erts/emulator/test/port_bif_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/port_bif_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/port_bif_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/port_bif_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,7 +24,7 @@ init_per_group/2,end_per_group/2, command/1, command_e_1/1, command_e_2/1, command_e_3/1, command_e_4/1, port_info1/1, port_info2/1, - port_info_os_pid/1, port_info_race/1, + port_info_os_pid/1, connect/1, control/1, echo_to_busy/1]). -export([do_command_e_1/1, do_command_e_2/1, do_command_e_4/1]). @@ -43,8 +42,7 @@ groups() -> [{command_e, [], [command_e_1, command_e_2, command_e_3, command_e_4]}, - {port_info, [], - [port_info1, port_info2, port_info_os_pid, port_info_race]}]. + {port_info, [], [port_info1, port_info2, port_info_os_pid]}]. init_per_suite(Config) -> Config. @@ -256,28 +254,6 @@ true = erlang:port_close(P), ok. -port_info_race(Config) when is_list(Config) -> - DataDir = ?config(data_dir, Config), - Program = filename:join(DataDir, "port_test"), - Top = self(), - P1 = open_port({spawn,Program}, [{packet,1}]), - P2 = open_port({spawn,Program}, [{packet,1}]), - Info1 = erlang:port_info(P1), - Info2 = erlang:port_info(P2), - F = fun Loop(Port, _, 0) -> - Top ! {ok,Port}; - Loop(Port, Info, N) -> - Info = erlang:port_info(Port), - Loop(Port, Info, N - 1) - end, - spawn_link(fun () -> F(P1, Info1, 1000) end), - spawn_link(fun () -> F(P2, Info2, 1000) end), - receive {ok,P1} -> ok end, - receive {ok,P2} -> ok end, - true = erlang:port_close(P1), - true = erlang:port_close(P2), - ok. - output_test(_, _, Input, Output) when Output > 16#1fffffff -> io:format("~p bytes received\n", [Input]); output_test(P, Bin, Input0, Output0) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/port_SUITE_data/dead_port.c erlang-17.3-dfsg/erts/emulator/test/port_SUITE_data/dead_port.c --- erlang-18.2-dfsg/erts/emulator/test/port_SUITE_data/dead_port.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/port_SUITE_data/dead_port.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/emulator/test/port_SUITE_data/port_test.erl erlang-17.3-dfsg/erts/emulator/test/port_SUITE_data/port_test.erl --- erlang-18.2-dfsg/erts/emulator/test/port_SUITE_data/port_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/port_SUITE_data/port_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/port_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/port_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/port_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/port_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -91,7 +90,6 @@ mix_up_ports/1, otp_5112/1, otp_5119/1, otp_6224/1, exit_status_multi_scheduling_block/1, ports/1, spawn_driver/1, spawn_executable/1, close_deaf_port/1, - port_setget_data/1, unregister_name/1, parallelism_option/1]). -export([do_iter_max_ports/2]). @@ -117,7 +115,6 @@ mix_up_ports, otp_5112, otp_5119, exit_status_multi_scheduling_block, ports, spawn_driver, spawn_executable, close_deaf_port, unregister_name, - port_setget_data, parallelism_option]. groups() -> @@ -1408,12 +1405,6 @@ run_echo_args(SpaceDir,[ExactFile2,"hello world","dlrow olleh"]), [ExactFile2,"hello world","dlrow olleh"] = run_echo_args(SpaceDir,[binary, ExactFile2,"hello world","dlrow olleh"]), - - [ExactFile2,"hello \"world\"","\"dlrow\" olleh"] = - run_echo_args(SpaceDir,[binary, ExactFile2,"hello \"world\"","\"dlrow\" olleh"]), - [ExactFile2,"hello \"world\"","\"dlrow\" olleh"] = - run_echo_args(SpaceDir,[binary, ExactFile2,"hello \"world\"","\"dlrow\" olleh"]), - [ExactFile2] = run_echo_args(SpaceDir,[default]), [ExactFile2,"hello world","dlrow olleh"] = run_echo_args(SpaceDir,[switch_order,ExactFile2,"hello world", @@ -1816,7 +1807,7 @@ Parent = self(), ?t:format("SleepSecs = ~p~n", [SleepSecs]), PortProg = "sleep " ++ integer_to_list(SleepSecs), - Start = erlang:monotonic_time(micro_seconds), + Start = now(), NoProcs = case NoSchedsOnln of NProcs when NProcs < ?EXIT_STATUS_MSB_MAX_PROCS -> NProcs; @@ -1888,12 +1879,12 @@ receive {P, started, SIds} -> SIds end end, Procs), - StartedTime = (erlang:monotonic_time(micro_seconds) - Start)/1000000, + StartedTime = timer:now_diff(now(), Start)/1000000, ?t:format("StartedTime = ~p~n", [StartedTime]), true = StartedTime < SleepSecs, erlang:system_flag(multi_scheduling, block), lists:foreach(fun (P) -> receive {P, done} -> ok end end, Procs), - DoneTime = (erlang:monotonic_time(micro_seconds) - Start)/1000000, + DoneTime = timer:now_diff(now(), Start)/1000000, ?t:format("DoneTime = ~p~n", [DoneTime]), true = DoneTime > SleepSecs, ok = verify_multi_scheduling_blocked(), @@ -2342,61 +2333,6 @@ {comment, "Could not spawn more than " ++ integer_to_list(N) ++ " OS processes."} end. -%% Test undocumented port_set_data/2 and port_get_data/1 -%% Hammer from multiple processes a while -%% and then abrubtly close the port (OTP-12208). -port_setget_data(Config) when is_list(Config) -> - ok = load_driver(?config(data_dir, Config), "echo_drv"), - Port = erlang:open_port({spawn_driver, "echo_drv"}, []), - - NSched = erlang:system_info(schedulers_online), - HeapData = {1,2,3,<<"A heap binary">>,fun()->"This is fun"end, - list_to_binary(lists:seq(1,100))}, - PRs = lists:map(fun(I) -> - spawn_opt(fun() -> port_setget_data_hammer(Port,HeapData,false,1) end, - [monitor, {scheduler, I rem NSched}]) - end, - lists:seq(1,10)), - receive after 100 -> ok end, - Papa = self(), - lists:foreach(fun({Pid,_}) -> Pid ! {Papa,prepare_for_close} end, PRs), - lists:foreach(fun({Pid,_}) -> - receive {Pid,prepare_for_close} -> ok end - end, - PRs), - port_close(Port), - lists:foreach(fun({Pid,Ref}) -> - receive {'DOWN', Ref, process, Pid, normal} -> ok end - end, - PRs), - ok. - -port_setget_data_hammer(Port, HeapData, IsSet0, N) -> - Rand = random:uniform(3), - IsSet1 = try case Rand of - 1 -> true = erlang:port_set_data(Port, atom), true; - 2 -> true = erlang:port_set_data(Port, HeapData), true; - 3 -> case erlang:port_get_data(Port) of - atom -> true; - HeapData -> true; - undefined -> false=IsSet0 - end - end - catch - error:badarg -> - true = get(prepare_for_close), - io:format("~p did ~p rounds before port closed\n", [self(), N]), - exit(normal) - end, - receive {Papa, prepare_for_close} -> - put(prepare_for_close, true), - Papa ! {self(),prepare_for_close} - after 0 -> - ok - end, - port_setget_data_hammer(Port, HeapData, IsSet1, N+1). - - wait_until(Fun) -> case catch Fun() of true -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/process_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/process_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/process_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/process_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -380,15 +379,16 @@ process_flag(priority, high), receive after 1000 -> ok end, exit(Low, {you, are, dead}), - loop(erlang:monotonic_time() + erlang:convert_time_unit(5,seconds,native)). + {_, Sec, _} = now(), + loop(Sec, Sec). %% Busy loop for 5 seconds. -loop(StopTime) -> - case StopTime >= erlang:monotonic_time() of - true -> ok; - false -> loop(StopTime) - end. +loop(OrigSec, CurrentSec) when CurrentSec < OrigSec+5 -> + {_, NewSec, _} = now(), + loop(OrigSec, NewSec); +loop(_, _) -> + ok. %% Tries to send two different exit messages to a process. @@ -1478,15 +1478,7 @@ processes_this_tab(suite) -> []; processes_this_tab(Config) when is_list(Config) -> - Mem = case {erlang:system_info(build_type), - erlang:system_info(allocator)} of - {lcnt, {_, _Vsn, [sys_alloc], _Opts}} -> - %% When running +Mea min + lcnt we may need more memory - 1024 * 4; - _ -> - 1024 - end, - sys_mem_cond_run(Mem, fun () -> chk_processes_bif_test_res(processes_bif_test()) end). + sys_mem_cond_run(1024, fun () -> chk_processes_bif_test_res(processes_bif_test()) end). chk_processes_bif_test_res(ok) -> ok; chk_processes_bif_test_res({comment, _} = Comment) -> Comment; @@ -2458,13 +2450,16 @@ start_node(Config, Args) when is_list(Config) -> Pa = filename:dirname(code:which(?MODULE)), + {A, B, C} = now(), Name = list_to_atom(atom_to_list(?MODULE) ++ "-" ++ atom_to_list(?config(testcase, Config)) ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) ++ "-" - ++ integer_to_list(erlang:unique_integer([positive]))), + ++ integer_to_list(C)), ?t:start_node(Name, slave, [{args, "-pa "++Pa++" "++Args}]). stop_node(Node) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/pseudoknot_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/pseudoknot_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/pseudoknot_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/pseudoknot_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/random_iolist.erl erlang-17.3-dfsg/erts/emulator/test/random_iolist.erl --- erlang-18.2-dfsg/erts/emulator/test/random_iolist.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/random_iolist.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/receive_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/receive_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/receive_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/receive_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/ref_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/ref_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/ref_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/ref_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/register_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/register_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/register_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/register_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/save_calls_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/save_calls_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/save_calls_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/save_calls_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/scheduler_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/scheduler_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/scheduler_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/scheduler_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -1830,11 +1829,11 @@ do_it(Tracer, Low, Normal, High, Max, RedsPerSchedLimit) -> OldPrio = process_flag(priority, max), go_work(Low, Normal, High, Max), - StartWait = erlang:monotonic_time(milli_seconds), + StartWait = now(), %% Give the emulator a chance to balance the load... wait_balance(5), - EndWait = erlang:monotonic_time(milli_seconds), - BalanceWait = EndWait-StartWait, + EndWait = now(), + BalanceWait = timer:now_diff(EndWait,StartWait) div 1000, erlang:display({balance_wait, BalanceWait}), Timeout = ?DEFAULT_TIMEOUT - ?t:minutes(4) - BalanceWait, Res = case Timeout < ?MIN_SCHEDULER_TEST_TIMEOUT of @@ -2028,14 +2027,17 @@ start_node(Config, ""). start_node(Config, Args) when is_list(Config) -> - Pa = filename:dirname(code:which(?MODULE)), - Name = list_to_atom(atom_to_list(?MODULE) - ++ "-" - ++ atom_to_list(?config(testcase, Config)) - ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) - ++ "-" - ++ integer_to_list(erlang:unique_integer([positive]))), + ?line Pa = filename:dirname(code:which(?MODULE)), + ?line {A, B, C} = now(), + ?line Name = list_to_atom(atom_to_list(?MODULE) + ++ "-" + ++ atom_to_list(?config(testcase, Config)) + ++ "-" + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) + ++ "-" + ++ integer_to_list(C)), ?line ?t:start_node(Name, slave, [{args, "-pa "++Pa++" "++Args}]). stop_node(Node) -> Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/emulator/test/send_term_SUITE_data/ext_terms.bin and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/emulator/test/send_term_SUITE_data/ext_terms.bin differ diff -Nru erlang-18.2-dfsg/erts/emulator/test/send_term_SUITE_data/ext_terms.h erlang-17.3-dfsg/erts/emulator/test/send_term_SUITE_data/ext_terms.h --- erlang-18.2-dfsg/erts/emulator/test/send_term_SUITE_data/ext_terms.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/send_term_SUITE_data/ext_terms.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson AB. * Portions created by Ericsson are Copyright 2007, Ericsson AB. @@ -25,9 +24,9 @@ #ifndef EXT_TERMS_H__ #define EXT_TERMS_H__ static struct { - unsigned char ext[637]; + unsigned char ext[162]; int ext_size; - unsigned char cext[637]; + unsigned char cext[162]; int cext_size; } ext_terms[] = { {{131,104,3,98,0,0,18,103,98,255,255,237,153,108,0,0,0,2,100,0,7,97,110,95,97,116,111,109,107,0,6,97,32,108,105,115,116,106}, @@ -38,26 +37,26 @@ 46, {131,108,0,0,0,4,110,9,0,0,0,160,222,197,173,201,53,54,110,7,1,199,113,21,183,140,242,3,107,0,6,98,108,117,112,112,33,100,0,5,98,108,105,112,112,106}, 46}, - {{131,104,5,103,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,41,0,0,0,0,2,104,2,114,0,3,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,2,0,0,0,42,0,0,0,3,0,0,0,0,102,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,0,2,103,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,40,0,0,0,0,3,102,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,0,3,114,0,3,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,3,0,0,0,56,0,0,0,3,0,0,0,0}, - 204, - {131,80,0,0,0,203,120,156,203,96,77,79,97,16,73,140,207,203,79,73,117,72,205,169,48,54,201,200,171,52,50,210,53,76,98,96,96,208,4,98,6,166,12,166,34,6,102,28,138,152,128,10,180,128,152,25,164,50,13,183,73,12,76,64,107,132,179,19,115,114,48,229,52,64,242,204,105,56,229,25,152,193,246,99,147,5,89,107,1,179,30,0,103,37,46,144}, - 96}, - {{131,104,5,104,0,106,106,112,0,0,0,86,0,123,56,104,225,98,55,108,63,185,201,160,64,191,31,210,203,0,0,0,2,0,0,0,0,100,0,15,115,101,110,100,95,116,101,114,109,95,83,85,73,84,69,97,2,98,3,217,195,71,103,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,40,0,0,0,0,3,109,0,0,0,31,104,101,106,32,104,111,112,112,32,116,114,97,108,108,97,108,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97}, - 130, - {131,80,0,0,0,129,120,156,203,96,205,96,200,202,42,96,96,96,8,99,168,182,200,120,152,100,158,99,191,243,228,2,135,253,242,151,78,3,5,153,128,152,33,133,129,191,56,53,47,37,190,36,181,40,55,62,56,212,51,196,53,145,41,137,249,230,97,247,244,20,6,225,236,196,156,156,84,135,212,156,10,99,147,140,188,74,35,35,93,195,36,160,22,13,144,62,230,92,32,33,159,145,154,165,144,145,95,80,160,80,82,4,84,154,152,147,136,10,0,219,221,39,33}, - 123}, + {{131,104,5,103,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,0,0,0,38,0,0,0,0,3,104,2,114,0,3,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,40,0,0,0,0,0,0,0,0,102,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,0,0,0,1,3,103,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,0,0,0,37,0,0,0,0,3,102,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,0,0,0,1,3,114,0,3,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,59,0,0,0,0,0,0,0,0}, + 162, + {131,80,0,0,0,161,120,156,203,96,77,79,97,224,77,140,207,203,79,73,117,72,207,47,74,74,76,103,96,96,80,3,98,6,230,12,166,34,6,102,116,89,102,160,140,6,3,20,164,97,209,203,200,12,52,145,39,17,85,80,21,108,96,26,166,4,35,51,216,14,20,97,144,21,214,48,43,0,1,209,36,52}, + 82}, + {{131,104,5,104,0,106,106,112,0,0,0,79,0,21,87,190,182,1,38,106,214,65,228,1,52,27,227,2,212,0,0,0,1,0,0,0,0,100,0,15,115,101,110,100,95,116,101,114,109,95,83,85,73,84,69,97,1,98,0,184,11,180,103,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,0,0,0,37,0,0,0,0,3,109,0,0,0,31,104,101,106,32,104,111,112,112,32,116,114,97,108,108,97,108,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97}, + 123, + {131,80,0,0,0,122,120,156,203,96,205,96,200,202,42,96,96,96,240,103,16,13,223,183,141,81,45,235,154,227,19,70,19,233,199,76,87,128,130,140,64,204,144,194,192,95,156,154,151,18,95,146,90,148,27,31,28,234,25,226,154,200,152,196,176,131,123,75,122,10,3,79,98,94,126,74,170,67,122,126,81,82,98,58,80,173,42,72,3,115,46,144,144,207,72,205,82,200,200,47,40,80,40,41,74,204,201,73,204,73,68,5,0,18,237,35,68}, + 117}, {{131,108,0,0,0,4,110,10,0,28,199,113,166,118,185,145,86,105,9,110,5,1,28,103,24,89,10,107,0,2,98,33,100,0,10,98,108,105,112,112,112,112,112,112,112,106}, 46, {131,108,0,0,0,4,110,10,0,28,199,113,166,118,185,145,86,105,9,110,5,1,28,103,24,89,10,107,0,2,98,33,100,0,10,98,108,105,112,112,112,112,112,112,112,106}, 46}, - {{131,104,5,98,0,0,18,103,103,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,41,0,0,0,0,2,104,2,114,0,3,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,2,0,0,0,42,0,0,0,3,0,0,0,0,102,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,0,2,98,255,255,237,153,108,0,0,0,2,100,0,7,97,110,95,97,116,111,109,107,0,6,97,32,108,105,115,116,106}, - 141, - {131,80,0,0,0,140,120,156,203,96,77,98,96,16,74,79,79,97,16,73,140,207,203,79,73,117,72,205,169,48,54,201,200,171,52,50,210,53,4,202,49,104,2,49,3,83,6,83,17,3,51,14,69,76,64,5,90,64,204,12,82,153,134,219,36,6,166,164,255,255,223,206,204,1,177,82,24,216,19,243,226,19,75,242,115,179,25,216,18,21,114,50,139,75,178,0,77,99,35,202}, - 100}, - {{131,104,4,103,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,41,0,0,0,0,2,104,2,114,0,3,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,2,0,0,0,42,0,0,0,3,0,0,0,0,102,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,0,2,103,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,0,0,0,0,0,3,102,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,0,3}, - 166, - {131,80,0,0,0,165,120,156,203,96,73,79,97,16,73,140,207,203,79,73,117,72,205,169,48,54,201,200,171,52,50,210,53,76,98,96,96,208,4,98,6,166,12,166,34,6,102,28,138,152,128,10,180,128,152,25,164,50,13,183,73,12,76,64,107,132,179,19,115,114,176,200,129,0,115,26,110,121,102,0,219,33,38,209}, - 84}, + {{131,104,5,98,0,0,18,103,103,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,0,0,0,38,0,0,0,0,3,104,2,114,0,3,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,40,0,0,0,0,0,0,0,0,102,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,0,0,0,1,3,98,255,255,237,153,108,0,0,0,2,100,0,7,97,110,95,97,116,111,109,107,0,6,97,32,108,105,115,116,106}, + 120, + {131,80,0,0,0,119,120,156,203,96,77,98,96,16,74,79,79,97,224,77,140,207,203,79,73,117,72,207,47,74,74,76,103,96,96,80,3,98,6,230,12,166,34,6,102,116,89,102,160,140,6,3,20,164,97,209,203,200,156,244,255,255,219,153,57,64,38,83,10,3,123,98,94,124,98,73,126,110,54,3,91,162,66,78,102,113,73,22,0,167,192,30,158}, + 93}, + {{131,104,4,103,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,0,0,0,38,0,0,0,0,3,104,2,114,0,3,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,40,0,0,0,0,0,0,0,0,102,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,0,0,0,1,3,103,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,0,0,0,0,0,0,0,0,3,102,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,0,0,0,1,3}, + 131, + {131,80,0,0,0,130,120,156,203,96,73,79,97,224,77,140,207,203,79,73,117,72,207,47,74,74,76,103,96,96,80,3,98,6,230,12,166,34,6,102,116,89,102,160,140,6,3,20,164,97,209,203,200,12,52,145,39,17,85,16,12,152,211,48,37,24,153,1,215,214,30,50}, + 72}, {{131,104,3,98,0,0,18,103,98,255,255,237,153,108,0,0,0,2,100,0,7,97,110,95,97,116,111,109,107,0,6,97,32,108,105,115,116,106}, 38, {131,104,3,98,0,0,18,103,98,255,255,237,153,108,0,0,0,2,100,0,7,97,110,95,97,116,111,109,107,0,6,97,32,108,105,115,116,106}, @@ -66,58 +65,46 @@ 33, {131,104,3,98,0,0,18,103,98,255,255,237,153,108,0,0,0,2,100,0,4,97,116,111,109,107,0,4,108,105,115,116,106}, 33}, - {{131,104,4,103,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,41,0,0,0,0,2,104,2,114,0,3,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,2,0,0,0,42,0,0,0,3,0,0,0,0,102,100,0,20,97,95,110,111,100,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,0,2,103,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,0,0,0,0,0,3,102,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,0,0,0,0,3}, - 166, - {131,80,0,0,0,165,120,156,203,96,73,79,97,16,73,140,207,203,79,73,117,72,205,169,48,54,201,200,171,52,50,210,53,76,98,96,96,208,4,98,6,166,12,166,34,6,102,28,138,152,128,10,180,128,152,25,164,50,13,183,73,12,76,64,107,132,179,19,115,114,176,200,129,0,115,26,110,121,102,0,219,33,38,209}, - 84}, - {{131,104,4,110,8,0,28,199,17,175,172,214,173,61,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,0,114,0,3,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,3,0,0,0,57,0,0,0,3,0,0,0,0}, - 81, - {131,80,0,0,0,80,120,156,203,96,201,227,96,144,57,46,184,126,205,181,181,182,73,255,255,7,165,100,48,98,133,12,69,12,204,41,12,194,217,137,57,57,169,14,169,57,21,198,38,25,121,149,70,70,186,134,73,204,12,12,12,150,64,12,162,25,0,231,161,20,138}, - 71}, - {{131,104,4,110,9,0,28,199,241,98,116,219,231,23,24,98,255,255,82,100,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,107,0,1,1,106,106,106,106,106,106,106,106,106,106,114,0,3,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,3,0,0,0,58,0,0,0,3,0,0,0,0}, - 122, - {131,80,0,0,0,121,120,156,203,96,201,227,100,144,57,254,49,169,228,246,115,113,137,164,255,255,131,82,114,24,24,24,24,73,34,178,25,24,25,179,224,160,136,129,57,133,65,56,59,49,39,39,213,33,53,167,194,216,36,35,175,210,200,72,215,48,137,25,168,214,10,136,65,52,3,0,142,142,25,0}, - 80}, - {{131,104,4,110,8,0,28,199,129,17,222,251,42,6,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,2,114,0,3,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,3,0,0,0,59,0,0,0,3,0,0,0,0}, - 83, - {131,80,0,0,0,82,120,156,203,96,201,227,96,144,57,222,40,120,239,183,22,91,210,255,255,65,41,25,140,216,97,34,83,17,3,115,10,131,112,118,98,78,78,170,67,106,78,133,177,73,70,94,165,145,145,174,97,18,51,3,3,131,53,16,131,104,6,0,233,167,20,95}, + {{131,104,4,103,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,0,0,0,38,0,0,0,0,3,104,2,114,0,3,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,40,0,0,0,0,0,0,0,0,102,100,0,13,97,95,110,111,100,101,64,103,111,114,98,97,103,0,0,0,1,3,103,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,0,0,0,0,0,0,0,0,3,102,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,0,0,0,1,3}, + 131, + {131,80,0,0,0,130,120,156,203,96,73,79,97,224,77,140,207,203,79,73,117,72,207,47,74,74,76,103,96,96,80,3,98,6,230,12,166,34,6,102,116,89,102,160,140,6,3,20,164,97,209,203,200,12,52,145,39,17,85,16,12,152,211,48,37,24,153,1,215,214,30,50}, 72}, - {{131,104,4,110,9,0,28,199,113,221,139,146,14,239,240,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,3,114,0,3,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,3,0,0,0,60,0,0,0,3,0,0,0,0}, - 84, - {131,80,0,0,0,83,120,156,203,96,201,227,100,144,57,94,120,183,123,18,223,251,15,73,255,255,7,165,100,48,98,135,137,204,69,12,204,41,12,194,217,137,57,57,169,14,169,57,21,198,38,25,121,149,70,70,186,134,73,204,12,12,12,54,64,12,162,25,0,106,11,22,31}, - 73}, - {{131,104,4,110,9,0,28,199,177,214,190,98,202,104,2,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,4,114,0,3,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,3,0,0,0,61,0,0,0,3,0,0,0,0}, - 84, - {131,80,0,0,0,83,120,156,203,96,201,227,100,144,57,190,241,218,190,164,83,25,76,73,255,255,7,165,100,48,98,135,137,44,69,12,204,41,12,194,217,137,57,57,169,14,169,57,21,198,38,25,121,149,70,70,186,134,73,204,12,12,12,182,64,12,162,25,0,74,151,21,164}, - 73}, - {{131,104,4,110,7,0,28,199,85,220,50,202,15,98,255,255,82,100,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,107,0,1,5,106,106,106,106,106,106,106,106,106,106,114,0,3,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,3,0,0,0,62,0,0,0,3,0,0,0,0}, - 120, - {131,80,0,0,0,119,120,156,203,96,201,99,103,144,57,30,122,199,232,20,127,210,255,255,65,41,57,12,12,12,140,36,17,217,12,140,172,89,112,80,196,192,156,194,32,156,157,152,147,147,234,144,154,83,97,108,146,145,87,105,100,164,107,152,196,12,84,107,7,196,32,154,1,0,225,225,23,138}, - 78}, - {{131,104,4,110,9,0,28,199,241,98,116,219,231,23,24,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,6,114,0,3,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,3,0,0,0,63,0,0,0,3,0,0,0,0}, - 84, - {131,80,0,0,0,83,120,156,203,96,201,227,100,144,57,254,49,169,228,246,115,113,137,164,255,255,131,82,50,24,177,195,68,182,34,6,230,20,6,225,236,196,156,156,84,135,212,156,10,99,147,140,188,74,35,35,93,195,36,102,6,6,6,123,32,6,209,12,0,64,205,21,133}, - 73}, - {{131,104,4,110,7,0,28,199,59,73,56,148,1,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,7,114,0,3,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,3,0,0,0,64,0,0,0,3,0,0,0,0}, - 82, - {131,80,0,0,0,81,120,156,203,96,201,99,103,144,57,110,237,105,49,133,49,233,255,255,160,148,12,70,236,48,145,189,136,129,57,133,65,56,59,49,39,39,213,33,53,167,194,216,36,35,175,210,200,72,215,48,137,153,129,129,193,1,136,65,52,3,0,137,143,19,30}, + {{131,104,4,110,8,0,28,199,17,175,172,214,173,61,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,0,114,0,3,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,60,0,0,0,0,0,0,0,0}, + 74, + {131,80,0,0,0,73,120,156,203,96,201,227,96,144,57,46,184,126,205,181,181,182,73,255,255,7,165,100,48,98,133,12,69,12,204,41,12,60,137,121,249,41,169,14,233,249,69,73,137,233,204,12,12,12,54,12,80,0,0,73,17,18,208}, + 63}, + {{131,104,4,110,9,0,28,199,241,98,116,219,231,23,24,98,255,255,82,100,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,107,0,1,1,106,106,106,106,106,106,106,106,106,106,114,0,3,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,61,0,0,0,0,0,0,0,0}, + 115, + {131,80,0,0,0,114,120,156,203,96,201,227,100,144,57,254,49,169,228,246,115,113,137,164,255,255,131,82,114,24,24,24,24,73,34,178,25,24,25,179,224,160,136,129,57,133,129,39,49,47,63,37,213,33,61,191,40,41,49,157,25,168,200,150,1,10,0,208,188,23,70}, 71}, - {{131,104,4,110,8,0,28,199,17,175,172,214,173,61,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,8,114,0,3,100,0,19,107,97,108,108,101,64,101,108,120,51,52,104,110,121,50,50,45,49,98,3,0,0,0,65,0,0,0,3,0,0,0,0}, - 83, - {131,80,0,0,0,82,120,156,203,96,201,227,96,144,57,46,184,126,205,181,181,182,73,255,255,7,165,100,48,98,135,137,28,69,12,204,41,12,194,217,137,57,57,169,14,169,57,21,198,38,25,121,149,70,70,186,134,73,204,12,12,12,142,64,12,162,25,0,18,103,20,252}, - 72}, - {{131,116,0,0,0,0}, - 6, - {131,116,0,0,0,0}, - 6}, - {{131,116,0,0,0,3,97,1,97,11,97,2,97,22,97,3,97,33}, - 18, - {131,116,0,0,0,3,97,1,97,11,97,2,97,22,97,3,97,33}, - 18}, - {{131,116,0,0,0,100,97,48,98,0,0,2,16,97,62,98,0,0,2,170,97,11,97,121,97,39,98,0,0,1,173,97,83,98,0,0,3,145,97,63,98,0,0,2,181,97,34,98,0,0,1,118,97,68,98,0,0,2,236,97,26,98,0,0,1,30,97,78,98,0,0,3,90,97,52,98,0,0,2,60,97,15,97,165,97,64,98,0,0,2,192,97,75,98,0,0,3,57,97,81,98,0,0,3,123,97,71,98,0,0,3,13,97,20,97,220,97,50,98,0,0,2,38,97,17,97,187,97,25,98,0,0,1,19,97,65,98,0,0,2,203,97,98,98,0,0,4,54,97,79,98,0,0,3,101,97,13,97,143,97,44,98,0,0,1,228,97,8,97,88,97,99,98,0,0,4,65,97,36,98,0,0,1,140,97,67,98,0,0,2,225,97,7,97,77,97,66,98,0,0,2,214,97,85,98,0,0,3,167,97,76,98,0,0,3,68,97,1,97,11,97,32,98,0,0,1,96,97,69,98,0,0,2,247,97,37,98,0,0,1,151,97,35,98,0,0,1,129,97,84,98,0,0,3,156,97,3,97,33,97,82,98,0,0,3,134,97,45,98,0,0,1,239,97,55,98,0,0,2,93,97,6,97,66,97,2,97,22,97,94,98,0,0,4,10,97,49,98,0,0,2,27,97,41,98,0,0,1,195,97,91,98,0,0,3,233,97,87,98,0,0,3,189,97,33,98,0,0,1,107,97,42,98,0,0,1,206,97,74,98,0,0,3,46,97,60,98,0,0,2,148,97,43,98,0,0,1,217,97,10,97,110,97,70,98,0,0,3,2,97,9,97,99,97,72,98,0,0,3,24,97,86,98,0,0,3,178,97,19,97,209,97,56,98,0,0,2,104,97,95,98,0,0,4,21,97,57,98,0,0,2,115,97,51,98,0,0,2,49,97,14,97,154,97,5,97,55,97,54,98,0,0,2,82,97,18,97,198,97,61,98,0,0,2,159,97,31,98,0,0,1,85,97,22,97,242,97,29,98,0,0,1,63,97,97,98,0,0,4,43,97,21,97,231,97,89,98,0,0,3,211,97,27,98,0,0,1,41,97,24,98,0,0,1,8,97,47,98,0,0,2,5,97,100,98,0,0,4,76,97,40,98,0,0,1,184,97,96,98,0,0,4,32,97,73,98,0,0,3,35,97,90,98,0,0,3,222,97,30,98,0,0,1,74,97,58,98,0,0,2,126,97,80,98,0,0,3,112,97,88,98,0,0,3,200,97,59,98,0,0,2,137,97,77,98,0,0,3,79,97,23,97,253,97,28,98,0,0,1,52,97,46,98,0,0,1,250,97,92,98,0,0,3,244,97,53,98,0,0,2,71,97,93,98,0,0,3,255,97,16,97,176,97,38,98,0,0,1,162,97,4,97,44,97,12,97,132}, - 637, - {131,80,0,0,2,124,120,156,21,143,123,100,87,113,24,135,207,126,219,218,165,86,171,109,181,182,118,107,181,181,123,171,181,181,218,90,91,91,171,93,90,91,173,221,219,158,93,24,145,40,145,49,70,98,140,68,68,70,196,196,136,137,24,137,136,68,68,70,140,68,68,34,34,35,34,117,158,191,158,247,115,121,223,239,57,55,130,32,152,228,224,120,16,68,146,57,33,150,217,204,45,10,195,49,234,41,23,66,68,223,163,193,224,57,123,53,111,210,172,250,65,134,42,155,115,86,6,169,210,172,99,27,75,156,116,124,69,187,65,45,221,98,134,86,145,68,42,159,56,100,94,192,118,94,176,219,27,41,52,234,188,99,60,68,76,53,93,86,167,72,226,46,165,230,95,137,167,159,9,195,70,246,233,44,112,202,141,47,196,209,73,147,227,71,122,221,122,66,135,104,38,42,252,139,92,171,99,180,152,255,102,191,234,1,249,98,142,139,214,22,137,38,143,30,199,59,148,25,252,164,198,246,8,155,104,34,194,78,46,251,106,34,149,186,153,20,217,121,205,144,27,223,233,19,47,201,211,188,66,177,120,79,155,102,57,117,46,220,167,68,115,157,68,174,114,218,32,66,2,19,156,113,76,231,146,120,70,10,31,56,106,125,154,81,95,75,163,86,117,157,195,162,146,173,60,36,150,26,170,149,61,236,224,13,245,142,143,200,241,122,111,248,149,191,200,114,108,0,15,148,144,198,55,6,188,190,70,166,65,17,233,34,158,10,23,99,153,180,214,193,1,205,85,198,84,185,156,117,33,159,65,241,153,108,179,54,142,185,48,203,121,205,107,244,139,183,28,215,156,167,83,213,197,46,254,178,199,118,21,229,226,15,195,6,27,28,177,214,202,136,234,31,201,172,80,96,254,152,24,74,217,194,237,255,248,120,145,79}, - 418} + {{131,104,4,110,8,0,28,199,129,17,222,251,42,6,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,2,114,0,3,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,62,0,0,0,0,0,0,0,0}, + 76, + {131,80,0,0,0,75,120,156,203,96,201,227,96,144,57,222,40,120,239,183,22,91,210,255,255,65,41,25,140,216,97,34,83,17,3,115,10,3,79,98,94,126,74,170,67,122,126,81,82,98,58,51,3,3,131,29,3,20,0,0,76,82,18,165}, + 64}, + {{131,104,4,110,9,0,28,199,113,221,139,146,14,239,240,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,3,114,0,3,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,63,0,0,0,0,0,0,0,0}, + 77, + {131,80,0,0,0,76,120,156,203,96,201,227,100,144,57,94,120,183,123,18,223,251,15,73,255,255,7,165,100,48,98,135,137,204,69,12,204,41,12,60,137,121,249,41,169,14,233,249,69,73,137,233,204,12,12,12,246,12,80,0,0,192,110,20,101}, + 65}, + {{131,104,4,110,9,0,28,199,177,214,190,98,202,104,2,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,4,114,0,3,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,64,0,0,0,0,0,0,0,0}, + 77, + {131,80,0,0,0,76,120,156,203,96,201,227,100,144,57,190,241,218,190,164,83,25,76,73,255,255,7,165,100,48,98,135,137,44,69,12,204,41,12,60,137,121,249,41,169,14,233,249,69,73,137,233,204,12,12,12,14,12,80,0,0,164,94,19,234}, + 65}, + {{131,104,4,110,7,0,28,199,85,220,50,202,15,98,255,255,82,100,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,108,0,0,0,1,107,0,1,5,106,106,106,106,106,106,106,106,106,106,114,0,3,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,65,0,0,0,0,0,0,0,0}, + 113, + {131,80,0,0,0,112,120,156,203,96,201,99,103,144,57,30,122,199,232,20,127,210,255,255,65,41,57,12,12,12,140,36,17,217,12,140,172,89,112,80,196,192,156,194,192,147,152,151,159,146,234,144,158,95,148,148,152,206,12,84,228,200,0,5,0,46,116,21,208}, + 69}, + {{131,104,4,110,9,0,28,199,241,98,116,219,231,23,24,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,6,114,0,3,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,66,0,0,0,0,0,0,0,0}, + 77, + {131,80,0,0,0,76,120,156,203,96,201,227,100,144,57,254,49,169,228,246,115,113,137,164,255,255,131,82,50,24,177,195,68,182,34,6,230,20,6,158,196,188,252,148,84,135,244,252,162,164,196,116,102,6,6,6,39,6,40,0,0,155,123,19,203}, + 65}, + {{131,104,4,110,7,0,28,199,59,73,56,148,1,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,7,114,0,3,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,67,0,0,0,0,0,0,0,0}, + 75, + {131,80,0,0,0,74,120,156,203,96,201,99,103,144,57,110,237,105,49,133,49,233,255,255,160,148,12,70,236,48,145,189,136,129,57,133,129,39,49,47,63,37,213,33,61,191,40,41,49,157,153,129,129,193,153,1,10,0,245,21,17,100}, + 62}, + {{131,104,4,110,8,0,28,199,17,175,172,214,173,61,98,255,255,82,100,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,97,8,114,0,3,100,0,12,97,110,111,100,101,64,103,111,114,98,97,103,3,0,0,0,68,0,0,0,0,0,0,0,0}, + 76, + {131,80,0,0,0,75,120,156,203,96,201,227,96,144,57,46,184,126,205,181,181,182,73,255,255,7,165,100,48,98,135,137,28,69,12,204,41,12,60,137,121,249,41,169,14,233,249,69,73,137,233,204,12,12,12,46,12,80,0,0,112,226,19,66}, + 64} }; -#define NO_OF_EXT_TERMS 22 +#define NO_OF_EXT_TERMS 19 #endif diff -Nru erlang-18.2-dfsg/erts/emulator/test/send_term_SUITE_data/send_term_drv.c erlang-17.3-dfsg/erts/emulator/test/send_term_SUITE_data/send_term_drv.c --- erlang-18.2-dfsg/erts/emulator/test/send_term_SUITE_data/send_term_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/send_term_SUITE_data/send_term_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/erts/emulator/test/send_term_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/send_term_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/send_term_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/send_term_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -280,10 +279,7 @@ {4444444444444444,-44444, [[[[[[[[[[[5]]]]]]]]]]], make_ref()}, {444444444444444444444,-44444, {{{{{{{{{{{{6}}}}}}}}}}}}, make_ref()}, {444444444444444,-44444, {{{{{{{{{{{{7}}}}}}}}}}}}, make_ref()}, - {4444444444444444444,-44444, {{{{{{{{{{{{8}}}}}}}}}}}}, make_ref()}, - #{}, - #{1 => 11, 2 => 22, 3 => 33}, - maps:from_list([{K,K*11} || K <- lists:seq(1,100)])], + {4444444444444444444,-44444, {{{{{{{{{{{{8}}}}}}}}}}}}, make_ref()}], ok = file:write_file(filename:join([BaseDir, "send_term_SUITE_data", "ext_terms.bin"]), @@ -358,17 +354,16 @@ write_bytes(IoDev, ",", Bs, N+1). write_license(IoDev) -> - S = "/* ``Licensed under the Apache License, Version 2.0 (the \"License\");~n" - " * you may not use this file except in compliance with the License.~n" - " * You may obtain a copy of the License at~n" - " * ~n" - " * http://www.apache.org/licenses/LICENSE-2.0~n" - " * ~n" - " * Unless required by applicable law or agreed to in writing, software~n" - " * distributed under the License is distributed on an \"AS IS\" BASIS,~n" - " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.~n" - " * See the License for the specific language governing permissions and~n" - " * limitations under the License.~n" + S = "/* ``The contents of this file are subject to the Erlang Public License,~n" + " * Version 1.1, (the \"License\"); you may not use this file except in~n" + " * compliance with the License. You should have received a copy of the~n" + " * Erlang Public License along with this software. If not, it can be~n" + " * retrieved via the world wide web at http://www.erlang.org/.~n" + " * ~n" + " * Software distributed under the License is distributed on an \"AS IS\"~n" + " * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See~n" + " * the License for the specific language governing rights and limitations~n" + " * under the License.~n" " * ~n" " * The Initial Developer of the Original Code is Ericsson AB.~n" " * Portions created by Ericsson are Copyright 2007, Ericsson AB.~n" diff -Nru erlang-18.2-dfsg/erts/emulator/test/sensitive_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/sensitive_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/sensitive_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/sensitive_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/signal_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/signal_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/signal_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/signal_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -516,10 +515,12 @@ repeat(Fun, N-1). start_node(Config) -> + {A, B, C} = now(), Name = list_to_atom(atom_to_list(?MODULE) ++ "-" ++ atom_to_list(?config(testcase, Config)) - ++ "-" ++ integer_to_list(erlang:system_time(seconds)) - ++ "-" ++ integer_to_list(erlang:unique_integer([positive]))), + ++ "-" ++ integer_to_list(A) + ++ "-" ++ integer_to_list(B) + ++ "-" ++ integer_to_list(C)), Pa = filename:dirname(code:which(?MODULE)), ?t:start_node(Name, slave, [{args, "-pa " ++ Pa}]). diff -Nru erlang-18.2-dfsg/erts/emulator/test/smoke_test_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/smoke_test_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/smoke_test_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/smoke_test_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -168,13 +167,16 @@ start_node(Config, Args) when is_list(Config) -> Pa = filename:dirname(code:which(?MODULE)), + {A, B, C} = now(), Name = list_to_atom(atom_to_list(?MODULE) ++ "-" ++ atom_to_list(?config(testcase, Config)) ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) ++ "-" - ++ integer_to_list(erlang:unique_integer([positive]))), + ++ integer_to_list(C)), Opts = [{args, "-pa "++Pa++" "++Args}], ?t:start_node(Name, slave, Opts). diff -Nru erlang-18.2-dfsg/erts/emulator/test/statistics_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/statistics_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/statistics_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/statistics_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -309,7 +308,7 @@ try Schedulers = erlang:system_info(schedulers_online), %% Let testserver and everyone else finish their work - timer:sleep(1500), + timer:sleep(500), %% Empty load EmptyLoad = get_load(), {false, _} = {lists:any(fun(Load) -> Load > 50 end, EmptyLoad),EmptyLoad}, @@ -348,7 +347,7 @@ [exit(Pid, kill) || Pid <- [P1|HalfHogs++LastHogs]], AfterLoad = get_load(), - {false,_} = {lists:any(fun(Load) -> Load > 25 end, AfterLoad),AfterLoad}, + {false,_} = {lists:any(fun(Load) -> Load > 5 end, AfterLoad),AfterLoad}, true = erlang:system_flag(scheduler_wall_time, false) after erlang:system_flag(scheduler_wall_time, false) @@ -356,7 +355,7 @@ get_load() -> Start = erlang:statistics(scheduler_wall_time), - timer:sleep(1500), + timer:sleep(500), End = erlang:statistics(scheduler_wall_time), lists:reverse(lists:sort(load_percentage(lists:sort(Start),lists:sort(End)))). diff -Nru erlang-18.2-dfsg/erts/emulator/test/system_info_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/system_info_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/system_info_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/system_info_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -265,37 +264,6 @@ []), cmp_memory(MWs, "unlink procs"), - mem_workers_call(MWs, - fun () -> - lists:foreach( - fun (P) -> - Tmr = erlang:start_timer(1 bsl 34, - P, - hello), - Tmrs = case get('BIF_TMRS') of - undefined -> []; - Rs -> Rs - end, - true = is_reference(Tmr), - put('BIF_TMRS', [Tmr|Tmrs]) - end, Ps) - end, - []), - cmp_memory(MWs, "start BIF timer procs"), - - mem_workers_call(MWs, - fun () -> - lists:foreach(fun (Tmr) -> - true = is_reference(Tmr), - true = is_integer(erlang:cancel_timer(Tmr)) - end, get('BIF_TMRS')), - put('BIF_TMRS', undefined), - garbage_collect() - end, - []), - erts_debug:set_internal_state(wait, deallocations), - cmp_memory(MWs, "cancel BIF timer procs"), - DMs = mem_workers_call(MWs, fun () -> lists:map(fun (P) -> @@ -565,13 +533,16 @@ start_node(Config, Envs) when is_list(Config) -> Pa = filename:dirname(code:which(?MODULE)), + {A, B, C} = now(), Name = list_to_atom(atom_to_list(?MODULE) ++ "-" ++ atom_to_list(?config(testcase, Config)) ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) ++ "-" - ++ integer_to_list(erlang:unique_integer([positive]))), + ++ integer_to_list(C)), ?t:start_node(Name, peer, [{args, "-pa "++Pa}, {env, Envs}]). stop_node(Node) -> diff -Nru erlang-18.2-dfsg/erts/emulator/test/system_profile_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/system_profile_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/system_profile_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/system_profile_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/timer_bif_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/timer_bif_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/timer_bif_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/timer_bif_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,18 +26,11 @@ cancel_timer_1/1, start_timer_big/1, send_after_big/1, start_timer_e/1, send_after_e/1, cancel_timer_e/1, - read_timer_trivial/1, read_timer/1, read_timer_async/1, - cleanup/1, evil_timers/1, registered_process/1, same_time_yielding/1, - same_time_yielding_with_cancel/1, same_time_yielding_with_cancel_other/1, -% same_time_yielding_with_cancel_other_accessor/1, - auto_cancel_yielding/1]). + read_timer_trivial/1, read_timer/1, + cleanup/1, evil_timers/1, registered_process/1]). -include_lib("test_server/include/test_server.hrl"). --define(SHORT_TIMEOUT, 5000). %% Bif timers as short as this may be pre-allocated --define(TIMEOUT_YIELD_LIMIT, 100). --define(AUTO_CANCEL_YIELD_LIMIT, 100). - init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(test_server:seconds(30)), case catch erts_debug:get_internal_state(available_internal_state) of @@ -53,7 +45,6 @@ ok. init_per_suite(Config) -> - erts_debug:set_internal_state(available_internal_state, true), Config. end_per_suite(_Config) -> @@ -65,12 +56,8 @@ [start_timer_1, send_after_1, send_after_2, cancel_timer_1, start_timer_e, send_after_e, cancel_timer_e, start_timer_big, send_after_big, - read_timer_trivial, read_timer, read_timer_async, - cleanup, evil_timers, registered_process, - same_time_yielding, same_time_yielding_with_cancel, - same_time_yielding_with_cancel_other, -% same_time_yielding_with_cancel_other_accessor, - auto_cancel_yielding]. + read_timer_trivial, read_timer, cleanup, evil_timers, + registered_process]. groups() -> []. @@ -175,7 +162,7 @@ start_timer_e(doc) -> ["Error cases for start_timer/3"]; start_timer_e(Config) when is_list(Config) -> ?line {'EXIT', _} = (catch erlang:start_timer(-4, self(), hej)), - ?line {'EXIT', _} = (catch erlang:start_timer(1 bsl 64, + ?line {'EXIT', _} = (catch erlang:start_timer(4728472847827482, self(), hej)), ?line {'EXIT', _} = (catch erlang:start_timer(4.5, self(), hej)), @@ -193,7 +180,7 @@ send_after_e(suite) -> []; send_after_e(Config) when is_list(Config) -> ?line {'EXIT', _} = (catch erlang:send_after(-4, self(), hej)), - ?line {'EXIT', _} = (catch erlang:send_after(1 bsl 64, + ?line {'EXIT', _} = (catch erlang:send_after(4728472847827482, self(), hej)), ?line {'EXIT', _} = (catch erlang:send_after(4.5, self(), hej)), @@ -226,58 +213,20 @@ read_timer(doc) -> ["Test that read_timer/1 seems to return the correct values."]; read_timer(suite) -> []; read_timer(Config) when is_list(Config) -> - process_flag(scheduler, 1), - Big = 1 bsl 31, - R = erlang:send_after(Big, self(), hej_hopp), - - receive after 200 -> ok end, % Delay and clear reductions. - Left = erlang:read_timer(R), - Left2 = erlang:cancel_timer(R), - case Left == Left2 of - true -> ok; - false -> Left = Left2 + 1 - end, - false = erlang:read_timer(R), - - case Big - Left of - Diff when Diff >= 200, Diff < 10000 -> - ok; - _Diff -> - test_server:fail({big, Big, Left}) - end, - process_flag(scheduler, 0), - ok. + ?line Big = 1 bsl 31, + ?line R = erlang:send_after(Big, self(), hej_hopp), -read_timer_async(doc) -> ["Test that read_timer/1 seems to return the correct values."]; -read_timer_async(suite) -> []; -read_timer_async(Config) when is_list(Config) -> - process_flag(scheduler, 1), - Big = 1 bsl 33, - R = erlang:send_after(Big, self(), hej_hopp), - - %% Access from another scheduler - process_flag(scheduler, erlang:system_info(schedulers_online)), - - receive after 200 -> ok end, % Delay and clear reductions. - ok = erlang:read_timer(R, [{async, true}]), - ok = erlang:cancel_timer(R, [{async, true}, {info, true}]), - ok = erlang:read_timer(R, [{async, true}]), - - {read_timer, R, Left} = receive_one(), - {cancel_timer, R, Left2} = receive_one(), - case Left == Left2 of - true -> ok; - false -> Left = Left2 + 1 - end, - {read_timer, R, false} = receive_one(), + ?line receive after 200 -> ok end, % Delay and clear reductions. + ?line Left = erlang:read_timer(R), + ?line Left = erlang:cancel_timer(R), + ?line false = erlang:read_timer(R), - case Big - Left of - Diff when Diff >= 200, Diff < 10000 -> - ok; - _Diff -> - test_server:fail({big, Big, Left}) - end, - process_flag(scheduler, 0), + ?line case Big - Left of + Diff when Diff >= 200, Diff < 10000 -> + ok; + _Diff -> + test_server:fail({big, Big, Left}) + end, ok. cleanup(doc) -> []; @@ -287,42 +236,39 @@ %% Timer on dead process ?line P1 = spawn(fun () -> ok end), ?line wait_until(fun () -> process_is_cleaned_up(P1) end), - ?line T1 = erlang:start_timer(?SHORT_TIMEOUT*2, P1, "hej"), - ?line T2 = erlang:send_after(?SHORT_TIMEOUT*2, P1, "hej"), - receive after 1000 -> ok end, + ?line T1 = erlang:start_timer(10000, P1, "hej"), + ?line T2 = erlang:send_after(10000, P1, "hej"), ?line Mem = mem(), ?line false = erlang:read_timer(T1), ?line false = erlang:read_timer(T2), ?line Mem = mem(), %% Process dies before timeout - ?line P2 = spawn(fun () -> receive after (?SHORT_TIMEOUT div 10) -> ok end end), - ?line T3 = erlang:start_timer(?SHORT_TIMEOUT*2, P2, "hej"), - ?line T4 = erlang:send_after(?SHORT_TIMEOUT*2, P2, "hej"), - ?line true = mem_larger_than(Mem), + ?line P2 = spawn(fun () -> receive after 500 -> ok end end), + ?line T3 = erlang:start_timer(10000, P2, "hej"), + ?line T4 = erlang:send_after(10000, P2, "hej"), + ?line true = Mem < mem(), ?line true = is_integer(erlang:read_timer(T3)), ?line true = is_integer(erlang:read_timer(T4)), ?line wait_until(fun () -> process_is_cleaned_up(P2) end), - receive after 1000 -> ok end, ?line false = erlang:read_timer(T3), ?line false = erlang:read_timer(T4), ?line Mem = mem(), %% Cancel timer - ?line P3 = spawn(fun () -> receive after ?SHORT_TIMEOUT*4 -> ok end end), - ?line T5 = erlang:start_timer(?SHORT_TIMEOUT*2, P3, "hej"), - ?line T6 = erlang:send_after(?SHORT_TIMEOUT*2, P3, "hej"), - ?line true = mem_larger_than(Mem), + ?line P3 = spawn(fun () -> receive after 20000 -> ok end end), + ?line T5 = erlang:start_timer(10000, P3, "hej"), + ?line T6 = erlang:send_after(10000, P3, "hej"), + ?line true = Mem < mem(), ?line true = is_integer(erlang:cancel_timer(T5)), ?line true = is_integer(erlang:cancel_timer(T6)), ?line false = erlang:read_timer(T5), ?line false = erlang:read_timer(T6), ?line exit(P3, kill), - ?line wait_until(fun () -> process_is_cleaned_up(P3) end), ?line Mem = mem(), %% Timeout ?line Ref = make_ref(), - ?line T7 = erlang:start_timer(?SHORT_TIMEOUT+1, self(), Ref), - ?line T8 = erlang:send_after(?SHORT_TIMEOUT+1, self(), Ref), - ?line true = mem_larger_than(Mem), + ?line T7 = erlang:start_timer(500, self(), Ref), + ?line T8 = erlang:send_after(500, self(), Ref), + ?line true = Mem < mem(), ?line true = is_integer(erlang:read_timer(T7)), ?line true = is_integer(erlang:read_timer(T8)), ?line receive {timeout, T7, Ref} -> ok end, @@ -474,10 +420,10 @@ registered_process(Config) when is_list(Config) -> ?line Mem = mem(), %% Cancel - ?line T1 = erlang:start_timer(?SHORT_TIMEOUT+1, ?MODULE, "hej"), - ?line T2 = erlang:send_after(?SHORT_TIMEOUT+1, ?MODULE, "hej"), + ?line T1 = erlang:start_timer(500, ?MODULE, "hej"), + ?line T2 = erlang:send_after(500, ?MODULE, "hej"), ?line undefined = whereis(?MODULE), - ?line true = mem_larger_than(Mem), + ?line true = Mem < mem(), ?line true = is_integer(erlang:cancel_timer(T1)), ?line true = is_integer(erlang:cancel_timer(T2)), ?line false = erlang:read_timer(T1), @@ -485,10 +431,10 @@ ?line Mem = mem(), %% Timeout register after start ?line Ref1 = make_ref(), - ?line T3 = erlang:start_timer(?SHORT_TIMEOUT+1, ?MODULE, Ref1), - ?line T4 = erlang:send_after(?SHORT_TIMEOUT+1, ?MODULE, Ref1), + ?line T3 = erlang:start_timer(500, ?MODULE, Ref1), + ?line T4 = erlang:send_after(500, ?MODULE, Ref1), ?line undefined = whereis(?MODULE), - ?line true = mem_larger_than(Mem), + ?line true = Mem < mem(), ?line true = is_integer(erlang:read_timer(T3)), ?line true = is_integer(erlang:read_timer(T4)), ?line true = register(?MODULE, self()), @@ -497,9 +443,9 @@ ?line Mem = mem(), %% Timeout register before start ?line Ref2 = make_ref(), - ?line T5 = erlang:start_timer(?SHORT_TIMEOUT+1, ?MODULE, Ref2), - ?line T6 = erlang:send_after(?SHORT_TIMEOUT+1, ?MODULE, Ref2), - ?line true = mem_larger_than(Mem), + ?line T5 = erlang:start_timer(500, ?MODULE, Ref2), + ?line T6 = erlang:send_after(500, ?MODULE, Ref2), + ?line true = Mem < mem(), ?line true = is_integer(erlang:read_timer(T5)), ?line true = is_integer(erlang:read_timer(T6)), ?line receive {timeout, T5, Ref2} -> ok end, @@ -508,133 +454,10 @@ ?line true = unregister(?MODULE), ?line ok. -same_time_yielding(Config) when is_list(Config) -> - Mem = mem(), - SchdlrsOnln = erlang:system_info(schedulers_online), - Tmo = erlang:monotonic_time(milli_seconds) + 3000, - Tmrs = lists:map(fun (I) -> - process_flag(scheduler, (I rem SchdlrsOnln) + 1), - erlang:start_timer(Tmo, self(), hej, [{abs, true}]) - end, - lists:seq(1, (?TIMEOUT_YIELD_LIMIT*3+1)*SchdlrsOnln)), - true = mem_larger_than(Mem), - lists:foreach(fun (Tmr) -> receive {timeout, Tmr, hej} -> ok end end, Tmrs), - Done = erlang:monotonic_time(milli_seconds), - true = Done >= Tmo, - case erlang:system_info(build_type) of - opt -> true = Done < Tmo + 200; - _ -> true = Done < Tmo + 1000 - end, - Mem = mem(), - ok. - -same_time_yielding_with_cancel(Config) when is_list(Config) -> - same_time_yielding_with_cancel_test(false, false). - -same_time_yielding_with_cancel_other(Config) when is_list(Config) -> - same_time_yielding_with_cancel_test(true, false). - -%same_time_yielding_with_cancel_other_accessor(Config) when is_list(Config) -> -% same_time_yielding_with_cancel_test(true, true). - -do_cancel_tmrs(Tmo, Tmrs, Tester) -> - BeginCancel = erlang:convert_time_unit(Tmo, - milli_seconds, - micro_seconds) - 100, - busy_wait_until(fun () -> - erlang:monotonic_time(micro_seconds) >= BeginCancel - end), - lists:foreach(fun (Tmr) -> - erlang:cancel_timer(Tmr, - [{async, true}, - {info, true}]) - end, Tmrs), - case Tester == self() of - true -> ok; - false -> forward_msgs(Tester) - end. - -same_time_yielding_with_cancel_test(Other, Accessor) -> - Mem = mem(), - SchdlrsOnln = erlang:system_info(schedulers_online), - Tmo = erlang:monotonic_time(milli_seconds) + 3000, - Tester = self(), - Cancelor = case Other of - false -> - Tester; - true -> - spawn(fun () -> - receive - {timers, Tmrs} -> - do_cancel_tmrs(Tmo, Tmrs, Tester) - end - end) - end, - Opts = case Accessor of - false -> [{abs, true}]; - true -> [{accessor, Cancelor}, {abs, true}] - end, - Tmrs = lists:map(fun (I) -> - process_flag(scheduler, (I rem SchdlrsOnln) + 1), - erlang:start_timer(Tmo, self(), hej, Opts) - end, - lists:seq(1, (?TIMEOUT_YIELD_LIMIT*3+1)*SchdlrsOnln)), - true = mem_larger_than(Mem), - case Other of - false -> - do_cancel_tmrs(Tmo, Tmrs, Tester); - true -> - Cancelor ! {timers, Tmrs} - end, - {Tmos, Cncls} = lists:foldl(fun (Tmr, {T, C}) -> - receive - {timeout, Tmr, hej} -> - receive - {cancel_timer, Tmr, Info} -> - false = Info, - {T+1, C} - end; - {cancel_timer, Tmr, false} -> - receive - {timeout, Tmr, hej} -> - {T+1, C} - end; - {cancel_timer, Tmr, TimeLeft} -> - true = is_integer(TimeLeft), - {T, C+1} - end - end, - {0, 0}, - Tmrs), - io:format("Timeouts: ~p Cancels: ~p~n", [Tmos, Cncls]), - Mem = mem(), - case Other of - true -> exit(Cancelor, bang); - false -> ok - end, - {comment, - "Timeouts: " ++ integer_to_list(Tmos) ++ " Cancels: " - ++ integer_to_list(Cncls)}. - -auto_cancel_yielding(Config) when is_list(Config) -> - Mem = mem(), - SchdlrsOnln = erlang:system_info(schedulers_online), - P = spawn(fun () -> - lists:foreach( - fun (I) -> - process_flag(scheduler, (I rem SchdlrsOnln)+1), - erlang:start_timer((1 bsl 28)+I*10, self(), hej) - end, - lists:seq(1, - ((?AUTO_CANCEL_YIELD_LIMIT*3+1) - *SchdlrsOnln))), - receive after infinity -> ok end - end), - true = mem_larger_than(Mem), - exit(P, bang), - wait_until(fun () -> process_is_cleaned_up(P) end), - Mem = mem(), - ok. +mem() -> + AA = erlang:system_info(allocated_areas), + {value,{bif_timer,Mem}} = lists:keysearch(bif_timer, 1, AA), + Mem. process_is_cleaned_up(P) when is_pid(P) -> undefined == erts_debug:get_internal_state({process_status, P}). @@ -645,19 +468,6 @@ _ -> receive after 50 -> ok end, wait_until(Pred) end. -busy_wait_until(Pred) when is_function(Pred) -> - case catch Pred() of - true -> ok; - _ -> busy_wait_until(Pred) - end. - -forward_msgs(To) -> - receive - Msg -> - To ! Msg - end, - forward_msgs(To). - get(Time, Msg) -> receive Msg -> @@ -676,10 +486,9 @@ end. start_slave() -> + ?line {A, B, C} = now(), ?line Pa = filename:dirname(code:which(?MODULE)), - ?line Name = atom_to_list(?MODULE) - ++ "-" ++ integer_to_list(erlang:system_time(seconds)) - ++ "-" ++ integer_to_list(erlang:unique_integer([positive])), + ?line Name = atom_to_list(?MODULE) ++ "-" ++ integer_to_list(A+B+C), {ok, Node} = ?t:start_node(Name, slave, [{args, "-pa " ++ Pa}]), Node. @@ -740,58 +549,5 @@ type(X) when is_binary(X) -> binary; type(X) when is_atom(X) -> atom; type(_) -> unknown. + - -mem_larger_than(no_fix_alloc) -> - true; -mem_larger_than(Mem) -> - mem() > Mem. - -mem() -> - erts_debug:set_internal_state(wait, timer_cancellations), - erts_debug:set_internal_state(wait, deallocations), - case mem_get() of - {-1, -1} -> no_fix_alloc; - {A, U} -> io:format("mem = ~p ~p~n", [A, U]), U - end. - -mem_get() -> - % Bif timer memory - Ref = make_ref(), - erlang:system_info({memory_internal, Ref, [fix_alloc]}), - mem_recv(erlang:system_info(schedulers), Ref, {0, 0}). - -mem_recv(0, _Ref, AU) -> - AU; -mem_recv(N, Ref, AU) -> - receive - {Ref, _, IL} -> - mem_recv(N-1, Ref, mem_parse_ilists(IL, AU)) - end. - - -mem_parse_ilists([], AU) -> - AU; -mem_parse_ilists([I|Is], AU) -> - mem_parse_ilists(Is, mem_parse_ilist(I, AU)). - -mem_parse_ilist({fix_alloc, false}, _) -> - {-1, -1}; -mem_parse_ilist({fix_alloc, _, IDL}, {A, U}) -> - case lists:keyfind(fix_types, 1, IDL) of - {fix_types, TL} -> - {ThisA, ThisU} = mem_get_btm_aus(TL, 0, 0), - {ThisA + A, ThisU + U}; - {fix_types, Mask, TL} -> - {ThisA, ThisU} = mem_get_btm_aus(TL, 0, 0), - {(ThisA + A) band Mask , (ThisU + U) band Mask} - end. - -mem_get_btm_aus([], A, U) -> - {A, U}; -mem_get_btm_aus([{BtmType, BtmA, BtmU} | Types], - A, U) when BtmType == bif_timer; - BtmType == accessor_bif_timer -> - mem_get_btm_aus(Types, BtmA+A, BtmU+U); -mem_get_btm_aus([_|Types], A, U) -> - mem_get_btm_aus(Types, A, U). diff -Nru erlang-18.2-dfsg/erts/emulator/test/time_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/time_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/time_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/time_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,23 +3,21 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% -module(time_SUITE). --compile({nowarn_deprecated_function, {erlang,now,0}}). %% "Time is on my side." -- The Rolling Stones @@ -36,15 +34,7 @@ bad_univ_to_local/1, bad_local_to_univ/1, univ_to_seconds/1, seconds_to_univ/1, consistency/1, - now_unique/1, now_update/1, timestamp/1, - time_warp_modes/1, - monotonic_time_monotonicity/1, - monotonic_time_monotonicity_parallel/1, - time_unit_conversion/1, - signed_time_unit_conversion/1, - erlang_timestamp/1]). - --export([init_per_testcase/2, end_per_testcase/2]). + now_unique/1, now_update/1, timestamp/1]). -export([local_to_univ_utc/1]). @@ -66,12 +56,6 @@ -define(dst_timezone, 2). -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - [{testcase, Func}|Config]. - -end_per_testcase(_Func, Config) -> - ok. - suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> @@ -79,13 +63,7 @@ bad_univ_to_local, bad_local_to_univ, univ_to_seconds, seconds_to_univ, consistency, - {group, now}, timestamp, - time_warp_modes, - monotonic_time_monotonicity, - monotonic_time_monotonicity_parallel, - time_unit_conversion, - signed_time_unit_conversion, - erlang_timestamp]. + {group, now}, timestamp]. groups() -> [{now, [], [now_unique, now_update]}]. @@ -442,440 +420,6 @@ now_update1(0) -> ?line test_server:fail(). -time_warp_modes(Config) when is_list(Config) -> - %% All time warp modes always supported in - %% combination with no time correction... - check_time_warp_mode(Config, false, no_time_warp), - check_time_warp_mode(Config, false, single_time_warp), - check_time_warp_mode(Config, false, multi_time_warp), - - erts_debug:set_internal_state(available_internal_state, true), - try - case erts_debug:get_internal_state({check_time_config, - true, no_time_warp}) of - false -> ok; - true -> check_time_warp_mode(Config, true, no_time_warp) - end, - case erts_debug:get_internal_state({check_time_config, - true, single_time_warp}) of - false -> ok; - true -> check_time_warp_mode(Config, true, single_time_warp) - end, - case erts_debug:get_internal_state({check_time_config, - true, multi_time_warp}) of - false -> ok; - true -> check_time_warp_mode(Config, true, multi_time_warp) - end - after - erts_debug:set_internal_state(available_internal_state, false) - end. - -check_time_warp_mode(Config, TimeCorrection, TimeWarpMode) -> - io:format("~n~n~n***** Testing TimeCorrection=~p TimeWarpMode=~p *****~n", - [TimeCorrection, TimeWarpMode]), - Mon = erlang:monitor(time_offset, clock_service), - _ = erlang:time_offset(), - Start = erlang:monotonic_time(1000), - MonotonicityTimeout = 2000, - {ok, Node} = start_node(Config, - "+c " ++ atom_to_list(TimeCorrection) - ++ " +C " ++ atom_to_list(TimeWarpMode)), - StartTime = rpc:call(Node, erlang, system_info, [start_time]), - Me = self(), - MonotincityTestStarted = make_ref(), - MonotincityTestDone = make_ref(), - spawn_link(Node, - fun () -> - Me ! MonotincityTestStarted, - cmp_times(erlang:start_timer(MonotonicityTimeout, - self(), - timeout), - erlang:monotonic_time()), - Me ! MonotincityTestDone - end), - receive MonotincityTestStarted -> ok end, - check_time_offset(Node, TimeWarpMode), - TimeWarpMode = rpc:call(Node, erlang, system_info, [time_warp_mode]), - TimeCorrection = rpc:call(Node, erlang, system_info, [time_correction]), - receive MonotincityTestDone -> ok end, - MonotonicTime = rpc:call(Node, erlang, monotonic_time, []), - MonotonicTimeUnit = rpc:call(Node, - erlang, - convert_time_unit, - [1, seconds, native]), - UpMilliSeconds = erlang:convert_time_unit(MonotonicTime - StartTime, - MonotonicTimeUnit, - milli_seconds), - io:format("UpMilliSeconds=~p~n", [UpMilliSeconds]), - End = erlang:monotonic_time(milli_seconds), - stop_node(Node), - try - true = (UpMilliSeconds > (98*MonotonicityTimeout) div 100), - true = (UpMilliSeconds < (102*(End-Start)) div 100) - catch - error:_ -> - io:format("Uptime inconsistency", []), - case {TimeCorrection, erlang:system_info(time_correction)} of - {true, true} -> - ?t:fail(uptime_inconsistency); - {true, false} -> - _ = erlang:time_offset(), - receive - {'CHANGE', Mon, time_offset, clock_service, _} -> - ignore - after 1000 -> - ?t:fail(uptime_inconsistency) - end; - _ -> - ignore - end - end, - erlang:demonitor(Mon, [flush]), - ok. - -check_time_offset(Node, no_time_warp) -> - final = rpc:call(Node, erlang, system_info, [time_offset]), - final = rpc:call(Node, erlang, system_flag, [time_offset, finalize]), - final = rpc:call(Node, erlang, system_info, [time_offset]); -check_time_offset(Node, single_time_warp) -> - preliminary = rpc:call(Node, erlang, system_info, [time_offset]), - preliminary = rpc:call(Node, erlang, system_flag, [time_offset, finalize]), - final = rpc:call(Node, erlang, system_info, [time_offset]), - final = rpc:call(Node, erlang, system_flag, [time_offset, finalize]); -check_time_offset(Node, multi_time_warp) -> - volatile = rpc:call(Node, erlang, system_info, [time_offset]), - volatile = rpc:call(Node, erlang, system_flag, [time_offset, finalize]), - volatile = rpc:call(Node, erlang, system_info, [time_offset]). - -monotonic_time_monotonicity(Config) when is_list(Config) -> - Done = erlang:start_timer(10000,self(),timeout), - cmp_times(Done, erlang:monotonic_time()). - -cmp_times(Done, X0) -> - X1 = erlang:monotonic_time(), - X2 = erlang:monotonic_time(), - X3 = erlang:monotonic_time(), - X4 = erlang:monotonic_time(), - X5 = erlang:monotonic_time(), - true = (X0 =< X1), - true = (X1 =< X2), - true = (X2 =< X3), - true = (X3 =< X4), - true = (X4 =< X5), - receive - {timeout, Done, timeout} -> - ok - after 0 -> - cmp_times(Done, X5) - end. - --define(NR_OF_MONOTONIC_CALLS, 100000). - -monotonic_time_monotonicity_parallel(Config) when is_list(Config) -> - Me = self(), - Result = make_ref(), - Go = make_ref(), - UpAndRunning = make_ref(), - NoOnlnScheds = erlang:system_info(schedulers_online), - OffsetUI = erlang:unique_integer([monotonic]), - OffsetMT = erlang:monotonic_time(), - MinHSz = ?NR_OF_MONOTONIC_CALLS*(2 - + 3 - + erts_debug:flat_size(OffsetUI) - + erts_debug:flat_size(OffsetMT)), - Ps = lists:map( - fun (Sched) -> - spawn_opt( - fun () -> - Me ! {self(), UpAndRunning}, - receive Go -> ok end, - Res = fetch_monotonic(?NR_OF_MONOTONIC_CALLS, []), - Me ! {self(), Result, Sched, Res} - end, - [{scheduler, Sched}, - {priority, max}, - {min_heap_size, MinHSz}]) - end, - lists:seq(1, NoOnlnScheds)), - lists:foreach(fun (P) -> receive {P, UpAndRunning} -> ok end end, Ps), - lists:foreach(fun (P) -> P ! Go end, Ps), - TMs = recv_monotonics(Result, OffsetMT, OffsetUI, NoOnlnScheds, []), - true = check_monotonic_result(TMs, OffsetMT, OffsetUI, true). - -check_monotonic_result([{_Sched, _PrevUI, _MT, _PostUI}], - _OffsetMT, _OffsetUI, Res) -> - Res; -check_monotonic_result([{_ASched, _APrevUI, AMT, APostUI} = A, - {_BSched, BPrevUI, BMT, _BPostUI} = B | _] = L, - OffsetMT, OffsetUI, Res) -> - NewRes = case (AMT =< BMT) orelse (BPrevUI < APostUI) of - true -> - Res; - false -> - io:format("INCONSISTENCY: ~p ~p~n", [A, B]), - false - end, - check_monotonic_result(tl(L), OffsetMT, OffsetUI, NewRes). - -recv_monotonics(_Result, _OffsetMT, _OffsetUI, 0, Acc) -> - lists:keysort(2, Acc); -recv_monotonics(Result, OffsetMT, OffsetUI, N, Acc) -> - receive - {_, Result, Sched, Res} -> - CRes = convert_monotonic(Sched, OffsetMT, OffsetUI, Res, []), - recv_monotonics(Result, OffsetMT, OffsetUI, N-1, CRes ++ Acc) - end. - -convert_monotonic(_Sched, _OffsetMT, _OffsetUI, [{_MT, _UI}], Acc) -> - Acc; -convert_monotonic(Sched, OffsetMT, OffsetUI, - [{MT, UI}, {_PrevMT, PrevUI} | _] = L, Acc) -> - convert_monotonic(Sched, OffsetMT, OffsetUI, tl(L), - [{Sched, PrevUI-OffsetUI, MT-OffsetMT, UI-OffsetUI} - | Acc]). - -fetch_monotonic(0, Acc) -> - Acc; -fetch_monotonic(N, Acc) -> - MT = erlang:monotonic_time(), - UI = erlang:unique_integer([monotonic]), - fetch_monotonic(N-1, [{MT, UI} | Acc]). - --define(CHK_RES_CONVS_TIMEOUT, 400). - -time_unit_conversion(Config) when is_list(Config) -> - Mon = erlang:monitor(time_offset, clock_service), - start_check_res_convs(Mon, 1000000000000), - start_check_res_convs(Mon, 2333333333333), - start_check_res_convs(Mon, 5732678356789), - erlang:demonitor(Mon, [flush]). - -start_check_res_convs(Mon, Res) -> - io:format("Checking ~p time_unit~n", [Res]), - check_res_convs(Mon, - erlang:start_timer(?CHK_RES_CONVS_TIMEOUT, - self(), - timeout), - Res). - - -check_res_convs(Mon, Done, Res) -> - receive - {timeout, Done, timeout} -> - case Res div 10 of - 0 -> - ok; - NewRes -> - start_check_res_convs(Mon, NewRes) - end - after 0 -> - do_check_res_convs(Mon, Done, Res) - end. - -do_check_res_convs(Mon, Done, Res) -> - TStart = erlang:monotonic_time(), - T = erlang:monotonic_time(Res), - TEnd = erlang:monotonic_time(), - TMin = erlang:convert_time_unit(TStart, native, Res), - TMax = erlang:convert_time_unit(TEnd, native, Res), - %io:format("~p =< ~p =< ~p~n", [TMin, T, TEnd]), - true = (TMin =< T), - true = (TMax >= T), - check_time_offset_res_conv(Mon, Res), - check_res_convs(Mon, Done, Res). - - -check_time_offset_res_conv(Mon, Res) -> - TORes = erlang:time_offset(Res), - TO = erlang:time_offset(), - case erlang:convert_time_unit(TO, native, Res) of - TORes -> - ok; - TORes2 -> - case check_time_offset_change(Mon, TO, 1000) of - {TO, false} -> - ?t:fail({time_unit_conversion_inconsistency, - TO, TORes, TORes2}); - {_NewTO, true} -> - ?t:format("time_offset changed", []), - check_time_offset_res_conv(Mon, Res) - end - end. - -signed_time_unit_conversion(Config) when is_list(Config) -> - chk_strc(1000000000, 1000000), - chk_strc(1000000000, 1000), - chk_strc(1000000000, 1), - chk_strc(1000000, 1000), - chk_strc(1000000, 1), - chk_strc(1000, 1), - chk_strc(4711, 17), - chk_strc(1 bsl 10, 1), - chk_strc(1 bsl 16, 10), - chk_strc(1 bsl 17, 1 bsl 8), - chk_strc((1 bsl 17) + 1, (1 bsl 8) - 1), - chk_strc(1 bsl 17, 11), - ok. - -chk_strc(Res0, Res1) -> - case (Res0 /= Res1) andalso (Res0 =< 1000000) andalso (Res1 =< 1000000) of - true -> - {FromRes, ToRes} = case Res0 > Res1 of - true -> {Res0, Res1}; - false -> {Res1, Res0} - end, - MinFromValuesPerToValue = FromRes div ToRes, - MaxFromValuesPerToValue = ((FromRes-1) div ToRes)+1, - io:format("~p -> ~p [~p, ~p]~n", - [FromRes, ToRes, - MinFromValuesPerToValue, MaxFromValuesPerToValue]), - chk_values_per_value(FromRes, ToRes, - -10*FromRes, 10*FromRes, - MinFromValuesPerToValue, - MaxFromValuesPerToValue, - undefined, MinFromValuesPerToValue); - _ -> - ok - end, - chk_random_values(Res0, Res1), - chk_random_values(Res1, Res0), - ok. - -chk_random_values(FR, TR) -> -% case (FR rem TR == 0) orelse (TR rem FR == 0) of -% true -> - io:format("rand values ~p -> ~p~n", [FR, TR]), - random:seed(268438039, 268440479, 268439161), - Values = lists:map(fun (_) -> random:uniform(1 bsl 65) - (1 bsl 64) end, - lists:seq(1, 100000)), - CheckFun = fun (V) -> - CV = erlang:convert_time_unit(V, FR, TR), - case {(FR*CV) div TR =< V, - (FR*(CV+1)) div TR >= V} of - {true, true} -> - ok; - Failure -> - ?t:fail({Failure, CV, V, FR, TR}) - end - end, - lists:foreach(CheckFun, Values).%; -% false -> ok -% end. - - -chk_values_per_value(_FromRes, _ToRes, - EndValue, EndValue, - MinFromValuesPerToValue, MaxFromValuesPerToValue, - _ToValue, FromValueCount) -> -% io:format("~p [~p]~n", [EndValue, FromValueCount]), - case ((MinFromValuesPerToValue =< FromValueCount) - andalso (FromValueCount =< MaxFromValuesPerToValue)) of - false -> - ?t:fail({MinFromValuesPerToValue, - FromValueCount, - MaxFromValuesPerToValue}); - true -> - ok - end; -chk_values_per_value(FromRes, ToRes, Value, EndValue, - MinFromValuesPerToValue, MaxFromValuesPerToValue, - ToValue, FromValueCount) -> - case erlang:convert_time_unit(Value, FromRes, ToRes) of - ToValue -> - chk_values_per_value(FromRes, ToRes, - Value+1, EndValue, - MinFromValuesPerToValue, - MaxFromValuesPerToValue, - ToValue, FromValueCount+1); - NewToValue -> - case ((MinFromValuesPerToValue =< FromValueCount) - andalso (FromValueCount =< MaxFromValuesPerToValue)) of - false -> - ?t:fail({MinFromValuesPerToValue, - FromValueCount, - MaxFromValuesPerToValue}); - true -> -% io:format("~p -> ~p [~p]~n", -% [Value, NewToValue, FromValueCount]), - chk_values_per_value(FromRes, ToRes, - Value+1, EndValue, - MinFromValuesPerToValue, - MaxFromValuesPerToValue, - NewToValue, 1) - end - end. - -erlang_timestamp(Config) when is_list(Config) -> - Mon = erlang:monitor(time_offset, clock_service), - {TO, _} = check_time_offset_change(Mon, - erlang:time_offset(), - 0), - Done = erlang:start_timer(10000,self(),timeout), - ok = check_erlang_timestamp(Done, Mon, TO). - -check_erlang_timestamp(Done, Mon, TO) -> - receive - {timeout, Done, timeout} -> - erlang:demonitor(Mon, [flush]), - ok - after 0 -> - do_check_erlang_timestamp(Done, Mon, TO) - end. - -do_check_erlang_timestamp(Done, Mon, TO) -> - MinMon = erlang:monotonic_time(), - {MegaSec, Sec, MicroSec} = erlang:timestamp(), - MaxMon = erlang:monotonic_time(), - TsMin = erlang:convert_time_unit(MinMon+TO, - native, - micro_seconds), - TsMax = erlang:convert_time_unit(MaxMon+TO, - native, - micro_seconds), - TsTime = (MegaSec*1000000+Sec)*1000000+MicroSec, - case (TsMin =< TsTime) andalso (TsTime =< TsMax) of - true -> - NewTO = case erlang:time_offset() of - TO -> - TO; - _ -> - check_time_offset_change(Mon, TO, 0) - end, - check_erlang_timestamp(Done, Mon, NewTO); - false -> - io:format("TsMin=~p TsTime=~p TsMax=~p~n", [TsMin, TsTime, TsMax]), - ?t:format("Detected inconsistency; " - "checking for time_offset change...", []), - case check_time_offset_change(Mon, TO, 1000) of - {TO, false} -> - ?t:fail(timestamp_inconsistency); - {NewTO, true} -> - ?t:format("time_offset changed", []), - check_erlang_timestamp(Done, Mon, NewTO) - end - end. - -check_time_offset_change(Mon, TO, Wait) -> - process_changed_time_offset(Mon, TO, false, Wait). - -process_changed_time_offset(Mon, TO, Changed, Wait) -> - receive - {'CHANGE', Mon, time_offset, clock_service, NewTO} -> - process_changed_time_offset(Mon, NewTO, true, Wait) - after Wait -> - case erlang:time_offset() of - TO -> - {TO, Changed}; - _OtherTO -> - receive - {'CHANGE', Mon, time_offset, clock_service, NewTO} -> - process_changed_time_offset(Mon, NewTO, true, Wait) - end - end - end. - - - %% Returns the test data: a list of {Utc, Local} tuples. test_data() -> @@ -1010,25 +554,4 @@ {{1996, 4, 30}, {12, 0, -1}}, % Sec {{1996, 4, 30}, {12, 0, 60}}]. - -start_node(Config) -> - start_node(Config, ""). - -start_node(Config, Args) -> - TestCase = ?config(testcase, Config), - PA = filename:dirname(code:which(?MODULE)), - ESTime = erlang:monotonic_time(1) + erlang:time_offset(1), - Unique = erlang:unique_integer([positive]), - Name = list_to_atom(atom_to_list(?MODULE) - ++ "-" - ++ atom_to_list(TestCase) - ++ "-" - ++ integer_to_list(ESTime) - ++ "-" - ++ integer_to_list(Unique)), - test_server:start_node(Name, - slave, - [{args, "-pa " ++ PA ++ " " ++ Args}]). - -stop_node(Node) -> - test_server:stop_node(Node). + diff -Nru erlang-18.2-dfsg/erts/emulator/test/trace_bif_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/trace_bif_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/trace_bif_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/trace_bif_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2014. All Rights Reserved. +%% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -261,9 +260,7 @@ apply(erlang, Name, Args), bif_process(); {do_time_bif} -> - %% Match the return value to ensure that the time() call - %% is not optimized away. - {_,_,_} = time(), + _ = time(), %Assignment tells compiler to keep call. bif_process(); {do_statistics_bif} -> statistics(runtime), @@ -279,16 +276,13 @@ ?line MFA = {M,F,0} = {test,foo,0}, ?line Fname = atom_to_list(M)++".erl", ?line AbsForms = - [{attribute,a(1),module,M}, % -module(M). - {attribute,a(2),export,[{F,0}]}, % -export([F/0]). - {function,a(3),F,0, % F() -> - [{clause,a(4),[],[],[{atom,a(4),F}]}]}], % F. + [{attribute,1,module,M}, % -module(M). + {attribute,2,export,[{F,0}]}, % -export([F/0]). + {function,3,F,0, % F() -> + [{clause,4,[],[],[{atom,4,F}]}]}], % F. %% ?line {ok,M,Mbin} = compile:forms(AbsForms), ?line {module,M} = code:load_binary(M, Fname, Mbin), ?line true = erlang:delete_module(M), ?line {traced,undefined} = erlang:trace_info(MFA, traced), ok. - -a(L) -> - erl_anno:new(L). diff -Nru erlang-18.2-dfsg/erts/emulator/test/trace_call_count_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/trace_call_count_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/trace_call_count_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/trace_call_count_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/trace_call_time_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/trace_call_time_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/trace_call_time_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/trace_call_time_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -327,10 +326,10 @@ %% ?line [3,2,1] = seq_r(1, 3, fun(X) -> X+1 end), - ?line T0 = erlang:monotonic_time(), + ?line T0 = now(), ?line with_bif(Nbc), - ?line T1 = erlang:monotonic_time(), - ?line TimeB = erlang:convert_time_unit(T1-T0, native, micro_seconds), + ?line T1 = now(), + ?line TimeB = timer:now_diff(T1,T0), %% ?line List = collect(100), @@ -696,17 +695,17 @@ Pid. execute(Pids, Mfa) when is_list(Pids) -> - T0 = erlang:monotonic_time(), + T0 = now(), [P ! {self(), execute, Mfa} || P <- Pids], As = [receive {P, answer, Answer} -> Answer end || P <- Pids], - T1 = erlang:monotonic_time(), - {As, erlang:convert_time_unit(T1-T0, native, micro_seconds)}; + T1 = now(), + {As, timer:now_diff(T1,T0)}; execute(P, Mfa) -> - T0 = erlang:monotonic_time(), + T0 = now(), P ! {self(), execute, Mfa}, A = receive {P, answer, Answer} -> Answer end, - T1 = erlang:monotonic_time(), - {A, erlang:convert_time_unit(T1-T0, native, micro_seconds)}. + T1 = now(), + {A, timer:now_diff(T1,T0)}. diff -Nru erlang-18.2-dfsg/erts/emulator/test/trace_local_SUITE_data/trace_local_dummy.erl erlang-17.3-dfsg/erts/emulator/test/trace_local_SUITE_data/trace_local_dummy.erl --- erlang-18.2-dfsg/erts/emulator/test/trace_local_SUITE_data/trace_local_dummy.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/trace_local_SUITE_data/trace_local_dummy.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/trace_local_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/trace_local_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/trace_local_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/trace_local_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/trace_meta_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/trace_meta_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/trace_meta_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/trace_meta_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -73,7 +72,7 @@ info/1, tracer/1, combo/1, nosilent/1]). init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(test_server:minutes(5)), + ?line Dog=test_server:timetrap(test_server:minutes(5)), [{watchdog, Dog}|Config]. end_per_testcase(_Case, Config) -> @@ -180,112 +179,107 @@ %%% basic_test() -> - Pid = setup(), - erlang:trace_pattern({?MODULE,'_','_'},[],[meta]), - [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), - ?CTT(Pid,{?MODULE,exported_wrap,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,exported,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,local,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,local2,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,local_tail,[1]}) = receive_next(), - erlang:trace_pattern({?MODULE,'_','_'},false,[meta]), - [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), - ?NM, - [1,1,1,0] = lambda_slave(fun() -> - exported_wrap(1) - end), - ?NM, - erlang:trace_pattern({?MODULE,'_','_'},[],[meta]), - [1,1,1,0] = lambda_slave(fun() -> - exported_wrap(1) - end), - ?CTT(Pid,{?MODULE,_,_}) = receive_next(), %% The fun - ?CTT(Pid,{?MODULE,exported_wrap,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,exported,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,local,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,local2,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,local_tail,[1]}) = receive_next(), - erlang:trace_pattern({?MODULE,'_','_'},false,[meta]), - shutdown(), - ?NM, + ?line Pid = setup(), + ?line erlang:trace_pattern({?MODULE,'_','_'},[],[meta]), + ?line [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), + ?line ?CTT(Pid,{?MODULE,exported_wrap,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,exported,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,local,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,local2,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,local_tail,[1]}) = receive_next(), + ?line erlang:trace_pattern({?MODULE,'_','_'},false,[meta]), + ?line [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), + ?line ?NM, + ?line [1,1,1,0] = lambda_slave(fun() -> + exported_wrap(1) + end), + ?line ?NM, + ?line erlang:trace_pattern({?MODULE,'_','_'},[],[meta]), + ?line [1,1,1,0] = lambda_slave(fun() -> + exported_wrap(1) + end), + ?line ?CTT(Pid,{?MODULE,_,_}) = receive_next(), %% The fun + ?line ?CTT(Pid,{?MODULE,exported_wrap,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,exported,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,local,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,local2,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,local_tail,[1]}) = receive_next(), + ?line erlang:trace_pattern({?MODULE,'_','_'},false,[meta]), + ?line shutdown(), + ?line ?NM, ok. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% return_test() -> - Pid = setup(), - erlang:trace_pattern({?MODULE,'_','_'},[{'_',[],[{return_trace}]}], + ?line Pid = setup(), + ?line erlang:trace_pattern({?MODULE,'_','_'},[{'_',[],[{return_trace}]}], [meta]), - erlang:trace_pattern({erlang,phash2,'_'},[{'_',[],[{return_trace}]}], + ?line erlang:trace_pattern({erlang,phash2,'_'},[{'_',[],[{return_trace}]}], [meta]), - [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), - ?CTT(Pid,{?MODULE,exported_wrap,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,exported,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,local,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,local2,[1]}) = receive_next(), - ?CTT(Pid,{?MODULE,local_tail,[1]}) = receive_next(), - ?CTT(Pid,{erlang,phash2,[1,1]}) = receive_next(), - ?RFT(Pid,{erlang,phash2,2},0) = receive_next(), - ?RFT(Pid,{?MODULE,local_tail,1},[1,0]) = receive_next(), - ?RFT(Pid,{?MODULE,local2,1},[1,0]) = receive_next(), - ?RFT(Pid,{?MODULE,local,1},[1,1,0]) = receive_next(), - ?RFT(Pid,{?MODULE,exported,1},[1,1,1,0]) = receive_next(), - ?RFT(Pid,{?MODULE,exported_wrap,1},[1,1,1,0]) = receive_next(), - shutdown(), - ?NM, + ?line [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), + ?line ?CTT(Pid,{?MODULE,exported_wrap,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,exported,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,local,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,local2,[1]}) = receive_next(), + ?line ?CTT(Pid,{?MODULE,local_tail,[1]}) = receive_next(), + ?line ?CTT(Pid,{erlang,phash2,[1,1]}) = receive_next(), + ?line ?RFT(Pid,{erlang,phash2,2},0) = receive_next(), + ?line ?RFT(Pid,{?MODULE,local_tail,1},[1,0]) = receive_next(), + ?line ?RFT(Pid,{?MODULE,local2,1},[1,0]) = receive_next(), + ?line ?RFT(Pid,{?MODULE,local,1},[1,1,0]) = receive_next(), + ?line ?RFT(Pid,{?MODULE,exported,1},[1,1,1,0]) = receive_next(), + ?line ?RFT(Pid,{?MODULE,exported_wrap,1},[1,1,1,0]) = receive_next(), + ?line shutdown(), + ?line ?NM, ok. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% on_and_off_test() -> - Pid = setup(), - 1 = erlang:trace_pattern({?MODULE,local_tail,1},[],[meta]), - LocalTail = fun() -> - local_tail(1) - end, - [1,0] = lambda_slave(LocalTail), - ?CTT(Pid,{?MODULE,local_tail,[1]}) = receive_next(), - 0 = erlang:trace_pattern({?MODULE,local_tail,1},[],[global]), - [1,0] = lambda_slave(LocalTail), - ?NM, - 1 = erlang:trace_pattern({?MODULE,exported_wrap,1},[],[meta]), - [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), - ?CTT(Pid,{?MODULE,exported_wrap,[1]}) = receive_next(), - 1 = erlang:trace_pattern({erlang,phash2,2},[],[meta]), - [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), - ?CTT(Pid,{?MODULE,exported_wrap,[1]}) = receive_next(), - ?CTT(Pid,{erlang,phash2,[1,1]}) = receive_next(), - shutdown(), - erlang:trace_pattern({'_','_','_'},false,[meta]), - N = erlang:trace_pattern({erlang,'_','_'},true,[meta]), - case erlang:trace_pattern({erlang,'_','_'},false,[meta]) of - N -> ok; - Else -> - exit({number_mismatch, {expected, N}, {got, Else}}) - end, - case erlang:trace_pattern({erlang,'_','_'},false,[meta]) of - N -> ok; - Else2 -> - exit({number_mismatch, {expected, N}, {got, Else2}}) - end, - %% ?NM, - %% Can't check for erlang:*/* stuff since common_test or test_server - %% will likely call list_to_binary in the logger. just drain any potential - %% message - ok = flush(), + ?line Pid = setup(), + ?line 1 = erlang:trace_pattern({?MODULE,local_tail,1},[],[meta]), + ?line LocalTail = fun() -> + local_tail(1) + end, + ?line [1,0] = lambda_slave(LocalTail), + ?line ?CTT(Pid,{?MODULE,local_tail,[1]}) = receive_next(), + ?line 0 = erlang:trace_pattern({?MODULE,local_tail,1},[],[global]), + ?line [1,0] = lambda_slave(LocalTail), + ?line ?NM, + ?line 1 = erlang:trace_pattern({?MODULE,exported_wrap,1},[],[meta]), + ?line [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), + ?line ?CTT(Pid,{?MODULE,exported_wrap,[1]}) = receive_next(), + ?line 1 = erlang:trace_pattern({erlang,phash2,2},[],[meta]), + ?line [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), + ?line ?CTT(Pid,{?MODULE,exported_wrap,[1]}) = receive_next(), + ?line ?CTT(Pid,{erlang,phash2,[1,1]}) = receive_next(), + ?line shutdown(), + ?line erlang:trace_pattern({'_','_','_'},false,[meta]), + ?line N = erlang:trace_pattern({erlang,'_','_'},true,[meta]), + ?line case erlang:trace_pattern({erlang,'_','_'},false,[meta]) of + N -> + ok; + Else -> + exit({number_mismatch, {expected, N}, {got, Else}}) + end, + ?line case erlang:trace_pattern({erlang,'_','_'},false,[meta]) of + N -> + ok; + Else2 -> + exit({number_mismatch, {expected, N}, {got, Else2}}) + end, + ?line ?NM, ok. - -flush() -> - receive _ -> flush() after 0 -> ok end. - + %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% stack_grow_test() -> - Pid = setup(), - 1 = erlang:trace_pattern({?MODULE,loop,4}, + ?line Pid = setup(), + ?line 1 = erlang:trace_pattern({?MODULE,loop,4}, [{'_',[],[{return_trace}]}],[meta]), - Num = 1 bsl 15, - Surface = + ?line Num = 1 bsl 15, + ?line Surface = fun (This, ?RFT(P,{?MODULE,loop,4},N), N) when P == Pid-> if N == Num -> ?NM, @@ -294,7 +288,7 @@ This(This, receive_next(), N+1) end end, - Dive = + ?line Dive = fun (This, ?CTT(P,{?MODULE,loop,[{hej,hopp},[a,b,c],4.5,N]}), N) when P == Pid-> if N == 0 -> @@ -303,263 +297,272 @@ This(This, receive_next(), N-1) end end, - apply_slave(?MODULE,loop,[{hej,hopp},[a,b,c],4.5,Num]), -% apply_slave_async(?MODULE,loop,[{hej,hopp},[a,b,c],4.5,Num]), -% List = collect(test_server:seconds(5)), - ok = Dive(Dive, receive_next(), Num), - ?NM, + ?line apply_slave(?MODULE,loop,[{hej,hopp},[a,b,c],4.5,Num]), +% ?line apply_slave_async(?MODULE,loop,[{hej,hopp},[a,b,c],4.5,Num]), +% ?line List = collect(test_server:seconds(5)), + ?line ok = Dive(Dive, receive_next(), Num), + ?line ?NM, ok. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% info_test() -> - setup(), - Prog = [{['$1'],[{is_integer,'$1'}],[{message, false}]}, {'_',[],[]}], - Self = self(), - GoOn = make_ref(), - Pid = + ?line setup(), + ?line Prog = [{['$1'],[{is_integer,'$1'}],[{message, false}]}, + {'_',[],[]}], + ?line Self = self(), + ?line GoOn = make_ref(), + + ?line Pid = spawn_link( fun () -> erlang:trace_pattern({?MODULE,exported_wrap,1}, - Prog, [{meta, Self}]), + Prog, [{meta, Self}]), Self ! {self(), GoOn} end), - receive {Pid, GoOn} -> ok end, - {traced,false} = erlang:trace_info({?MODULE,exported_wrap,1}, traced), - {match_spec, false} = + ?line receive {Pid, GoOn} -> ok end, + ?line {traced,false} = erlang:trace_info({?MODULE,exported_wrap,1}, traced), + ?line {match_spec, false} = erlang:trace_info({?MODULE,exported_wrap,1}, match_spec), - {meta, Self} = erlang:trace_info({?MODULE,exported_wrap,1}, meta), - {meta_match_spec, MMS} = + ?line {meta, Self} = erlang:trace_info({?MODULE,exported_wrap,1}, meta), + ?line {meta_match_spec, MMS} = erlang:trace_info({?MODULE,exported_wrap,1}, meta_match_spec), - case MMS of - Prog -> - ok; - Wrong -> - exit({bad_result, {erlang,trace_info, - [{?MODULE,exported_wrap,1}, - meta_match_spec]}, - {expected, Prog}, {got, Wrong}}) - end, - erlang:garbage_collect(self()), - receive - after 1 -> - ok - end, - io:format("~p~n",[MMS]), - {meta_match_spec,MMS2} = + ?line case MMS of + Prog -> + ok; + Wrong -> + exit({bad_result, {erlang,trace_info, + [{?MODULE,exported_wrap,1}, + meta_match_spec]}, + {expected, Prog}, {got, Wrong}}) + end, + ?line erlang:garbage_collect(self()), + ?line receive + after 1 -> + ok + end, + ?line io:format("~p~n",[MMS]), + ?line {meta_match_spec,MMS2} = erlang:trace_info({?MODULE,exported_wrap,1}, meta_match_spec), - io:format("~p~n",[MMS2]), - case MMS2 of - Prog -> - ok; - Wrong2 -> - exit({bad_result, {erlang,trace_info, - [{?MODULE,exported_wrap,1}, - meta_match_spec]}, - {expected, Prog}, {got, Wrong2}}) - end, - {all, [_|_]=L} = erlang:trace_info({?MODULE,exported_wrap,1}, all), - {value, {meta, Self}} = lists:keysearch(meta, 1, L), - {value, {meta_match_spec, MMS}} = lists:keysearch(meta_match_spec, 1, L), - - erlang:trace_pattern({?MODULE,exported_wrap,1}, true, [meta]), - {meta_match_spec, []} = + ?line io:format("~p~n",[MMS2]), + ?line case MMS2 of + Prog -> + ok; + Wrong2 -> + exit({bad_result, {erlang,trace_info, + [{?MODULE,exported_wrap,1}, + meta_match_spec]}, + {expected, Prog}, {got, Wrong2}}) + end, + ?line {all, [_|_]=L} = erlang:trace_info({?MODULE,exported_wrap,1}, all), + ?line {value, {meta, Self}} = + lists:keysearch(meta, 1, L), + ?line {value, {meta_match_spec, MMS}} = + lists:keysearch(meta_match_spec, 1, L), + + ?line erlang:trace_pattern({?MODULE,exported_wrap,1}, true, [meta]), + ?line {meta_match_spec, []} = erlang:trace_info({?MODULE,exported_wrap,1}, meta_match_spec), - - erlang:trace_pattern({?MODULE,exported_wrap,1}, false, [meta]), - {meta, false} = erlang:trace_info({?MODULE,exported_wrap,1}, meta), - {meta_match_spec, false} = + + ?line erlang:trace_pattern({?MODULE,exported_wrap,1}, false, [meta]), + ?line {meta, false} = erlang:trace_info({?MODULE,exported_wrap,1}, meta), + ?line {meta_match_spec, false} = erlang:trace_info({?MODULE,exported_wrap,1}, meta_match_spec), - {all, false} = erlang:trace_info({?MODULE,exported_wrap,1}, all), - shutdown(), - ?NM, + ?line {all, false} = erlang:trace_info({?MODULE,exported_wrap,1}, all), + + ?line shutdown(), + ?line ?NM, ok. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracer_test() -> - Slave = setup(), - Self = self(), - - MatchSpec = [{'_',[],[{return_trace}]}], - Tracer1 = spawn_link(fun () -> relay_n(3, Self) end), - Setter = spawn_link( - fun () -> - erlang:trace_pattern({?MODULE,receiver,1}, - MatchSpec, - [{meta,Tracer1}]), - erlang:trace_pattern({erlang,phash2,2}, - MatchSpec, - [{meta,Tracer1}]), - Self ! {self(), done} - end), - receive {Setter, done} -> ok end, - Ref = make_ref(), - apply_slave_async(?MODULE, receiver, [Ref]), - {Tracer1,?CTT(Slave,{?MODULE,receiver,[Ref]})} = receive_next(100), - {Tracer1,?CTT(Slave,{erlang,phash2,[1,1]})} = receive_next(100), - {Tracer1,?RFT(Slave,{erlang,phash2,2},0)} = receive_next(100), + ?line Slave = setup(), + ?line Self = self(), + + ?line MatchSpec = [{'_',[],[{return_trace}]}], + ?line Tracer1 = spawn_link(fun () -> relay_n(3, Self) end), + ?line Setter = + spawn_link( + fun () -> + erlang:trace_pattern({?MODULE,receiver,1}, + MatchSpec, + [{meta,Tracer1}]), + erlang:trace_pattern({erlang,phash2,2}, + MatchSpec, + [{meta,Tracer1}]), + Self ! {self(), done} + end), + ?line receive {Setter, done} -> ok end, + ?line Ref = make_ref(), + ?line apply_slave_async(?MODULE, receiver, [Ref]), + ?line {Tracer1,?CTT(Slave,{?MODULE,receiver,[Ref]})} = receive_next(100), + ?line {Tracer1,?CTT(Slave,{erlang,phash2,[1,1]})} = receive_next(100), + ?line {Tracer1,?RFT(Slave,{erlang,phash2,2},0)} = receive_next(100), %% Initiate a return_trace that will fail since the tracer just stopped - Slave ! Ref, - receive_no_next(100), + ?line Slave ! Ref, + ?line receive_no_next(100), %% The breakpoint has not been hit since the tracer stopped - {meta,Tracer1} = + ?line {meta,Tracer1} = erlang:trace_info({?MODULE,receiver,1}, meta), - {meta_match_spec, MatchSpec} = + ?line {meta_match_spec, MatchSpec} = erlang:trace_info({?MODULE,receiver,1}, meta_match_spec), - {meta,Tracer1} = + ?line {meta,Tracer1} = erlang:trace_info({erlang,phash2,2}, meta), - {meta_match_spec, MatchSpec} = + ?line {meta_match_spec, MatchSpec} = erlang:trace_info({erlang,phash2,2}, meta_match_spec), %% Initiate trace messages that will fail - Ref2 = make_ref(), - apply_slave_async(?MODULE, receiver, [Ref2]), - Slave ! Ref2, - receive_no_next(100), - {meta,[]} = + ?line Ref2 = make_ref(), + ?line apply_slave_async(?MODULE, receiver, [Ref2]), + ?line Slave ! Ref2, + ?line receive_no_next(100), + ?line {meta,[]} = erlang:trace_info({?MODULE,receiver,1}, meta), - {meta_match_spec, MatchSpec} = + ?line {meta_match_spec, MatchSpec} = erlang:trace_info({?MODULE,receiver,1}, meta_match_spec), - {meta,[]} = + ?line {meta,[]} = erlang:trace_info({erlang,phash2,2}, meta), - {meta_match_spec, MatchSpec} = + ?line {meta_match_spec, MatchSpec} = erlang:trace_info({erlang,phash2,2}, meta_match_spec), %% Change tracer - Tracer2 = spawn_link(fun () -> relay_n(4, Self) end), - erlang:trace_pattern({?MODULE,receiver,1}, - MatchSpec, - [{meta,Tracer2}]), - erlang:trace_pattern({erlang,phash2,2}, - MatchSpec, - [{meta,Tracer2}]), - Ref3 = make_ref(), - apply_slave_async(?MODULE, receiver, [Ref3]), - {Tracer2,?CTT(Slave,{?MODULE,receiver,[Ref3]})} = receive_next(), - {Tracer2,?CTT(Slave,{erlang,phash2,[1,1]})} = receive_next(), - {Tracer2,?RFT(Slave,{erlang,phash2,2},0)} = receive_next(), + ?line Tracer2 = spawn_link(fun () -> relay_n(4, Self) end), + ?line erlang:trace_pattern({?MODULE,receiver,1}, + MatchSpec, + [{meta,Tracer2}]), + ?line erlang:trace_pattern({erlang,phash2,2}, + MatchSpec, + [{meta,Tracer2}]), + ?line Ref3 = make_ref(), + ?line apply_slave_async(?MODULE, receiver, [Ref3]), + ?line {Tracer2,?CTT(Slave,{?MODULE,receiver,[Ref3]})} = receive_next(), + ?line {Tracer2,?CTT(Slave,{erlang,phash2,[1,1]})} = receive_next(), + ?line {Tracer2,?RFT(Slave,{erlang,phash2,2},0)} = receive_next(), %% Change tracer between call trace and return trace - Tracer3 = spawn_link(fun () -> relay_n(4, Self) end), - erlang:trace_pattern({?MODULE,receiver,1}, - MatchSpec, - [{meta,Tracer3}]), - erlang:trace_pattern({erlang,phash2,2}, - MatchSpec, - [{meta,Tracer3}]), - Slave ! Ref3, + ?line Tracer3 = spawn_link(fun () -> relay_n(4, Self) end), + ?line erlang:trace_pattern({?MODULE,receiver,1}, + MatchSpec, + [{meta,Tracer3}]), + ?line erlang:trace_pattern({erlang,phash2,2}, + MatchSpec, + [{meta,Tracer3}]), + ?line Slave ! Ref3, %% The return trace should still come from Tracer2 - {Tracer2,?RFT(Slave,{?MODULE,receiver,1},Ref3)} = receive_next(), - Ref4 = make_ref(), + ?line {Tracer2,?RFT(Slave,{?MODULE,receiver,1},Ref3)} = receive_next(), + ?line Ref4 = make_ref(), %% Now should Tracer3 be used - apply_slave_async(?MODULE, receiver, [Ref4]), - Slave ! Ref4, - {Tracer3,?CTT(Slave,{?MODULE,receiver,[Ref4]})} = receive_next(), - {Tracer3,?CTT(Slave,{erlang,phash2,[1,1]})} = receive_next(), - {Tracer3,?RFT(Slave,{erlang,phash2,2},0)} = receive_next(), - {Tracer3,?RFT(Slave,{?MODULE,receiver,1},Ref4)} = receive_next(), + ?line apply_slave_async(?MODULE, receiver, [Ref4]), + ?line Slave ! Ref4, + ?line {Tracer3,?CTT(Slave,{?MODULE,receiver,[Ref4]})} = receive_next(), + ?line {Tracer3,?CTT(Slave,{erlang,phash2,[1,1]})} = receive_next(), + ?line {Tracer3,?RFT(Slave,{erlang,phash2,2},0)} = receive_next(), + ?line {Tracer3,?RFT(Slave,{?MODULE,receiver,1},Ref4)} = receive_next(), %% The breakpoint has not been hit since the tracer stopped - {meta,Tracer3} = erlang:trace_info({?MODULE,receiver,1}, meta), - {meta_match_spec, MatchSpec} = + ?line {meta,Tracer3} = + erlang:trace_info({?MODULE,receiver,1}, meta), + ?line {meta_match_spec, MatchSpec} = erlang:trace_info({?MODULE,receiver,1}, meta_match_spec), - {meta,Tracer3} = + ?line {meta,Tracer3} = erlang:trace_info({erlang,phash2,2}, meta), - {meta_match_spec, MatchSpec} = + ?line {meta_match_spec, MatchSpec} = erlang:trace_info({erlang,phash2,2}, meta_match_spec), - shutdown(), - ?NM, + + ?line shutdown(), + ?line ?NM, ok. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% combo_test() -> - Slave = setup(), - Self = self(), - - MatchSpec = [{'_',[],[{return_trace}]}], - Flags = lists:sort([call, return_to]), - LocalTracer = spawn_link(fun () -> relay_n(6, Self) end), - MetaTracer = spawn_link(fun () -> relay_n(4, Self) end), - 1 = erlang:trace_pattern({?MODULE,receiver,1}, - MatchSpec, - [local,{meta,MetaTracer}]), - 1 = erlang:trace_pattern({erlang,phash2,2}, - MatchSpec, - [local,{meta,MetaTracer}]), - 1 = erlang:trace(Slave, true, - [{tracer,LocalTracer} | Flags]), + ?line Slave = setup(), + ?line Self = self(), + + ?line MatchSpec = [{'_',[],[{return_trace}]}], + ?line Flags = lists:sort([call, return_to]), + ?line LocalTracer = spawn_link(fun () -> relay_n(6, Self) end), + ?line MetaTracer = spawn_link(fun () -> relay_n(4, Self) end), + ?line 1 = erlang:trace_pattern({?MODULE,receiver,1}, + MatchSpec, + [local,{meta,MetaTracer}]), + ?line 1 = erlang:trace_pattern({erlang,phash2,2}, + MatchSpec, + [local,{meta,MetaTracer}]), + ?line 1 = erlang:trace(Slave, true, + [{tracer,LocalTracer} | Flags]), %% - {all, TraceInfo1} = + ?line {all, TraceInfo1} = erlang:trace_info({?MODULE,receiver,1}, all), - {meta,MetaTracer} = + ?line {meta,MetaTracer} = erlang:trace_info({?MODULE,receiver,1}, meta), - {value,{meta,MetaTracer}} = + ?line {value,{meta,MetaTracer}} = lists:keysearch(meta, 1, TraceInfo1), - {meta_match_spec,MatchSpec} = + ?line {meta_match_spec,MatchSpec} = erlang:trace_info({?MODULE,receiver,1}, meta_match_spec), - {value,{meta_match_spec,MatchSpec}} = + ?line {value,{meta_match_spec,MatchSpec}} = lists:keysearch(meta_match_spec, 1, TraceInfo1), - {traced,local} = + ?line {traced,local} = erlang:trace_info({?MODULE,receiver,1}, traced), - {value,{traced,local}} = + ?line {value,{traced,local}} = lists:keysearch(traced, 1, TraceInfo1), - {match_spec,MatchSpec} = + ?line {match_spec,MatchSpec} = erlang:trace_info({?MODULE,receiver,1}, match_spec), - {value,{match_spec,MatchSpec}} = + ?line {value,{match_spec,MatchSpec}} = lists:keysearch(match_spec, 1, TraceInfo1), %% - {all, TraceInfo2} = + ?line {all, TraceInfo2} = erlang:trace_info({erlang,phash2,2}, all), - {meta,MetaTracer} = + ?line {meta,MetaTracer} = erlang:trace_info({erlang,phash2,2}, meta), - {value,{meta,MetaTracer}} = + ?line {value,{meta,MetaTracer}} = lists:keysearch(meta, 1, TraceInfo2), - {meta_match_spec,MatchSpec} = + ?line {meta_match_spec,MatchSpec} = erlang:trace_info({erlang,phash2,2}, meta_match_spec), - {value,{meta_match_spec,MatchSpec}} = + ?line {value,{meta_match_spec,MatchSpec}} = lists:keysearch(meta_match_spec, 1, TraceInfo2), - {traced,local} = + ?line {traced,local} = erlang:trace_info({erlang,phash2,2}, traced), - {value,{traced,local}} = + ?line {value,{traced,local}} = lists:keysearch(traced, 1, TraceInfo2), - {match_spec,MatchSpec} = + ?line {match_spec,MatchSpec} = erlang:trace_info({erlang,phash2,2}, match_spec), - {value,{match_spec,MatchSpec}} = + ?line {value,{match_spec,MatchSpec}} = lists:keysearch(match_spec, 1, TraceInfo2), %% - {flags,Flags1} = erlang:trace_info(Slave, flags), - Flags = lists:sort(Flags1), - {tracer,LocalTracer} = erlang:trace_info(Slave, tracer), + ?line {flags,Flags1} = erlang:trace_info(Slave, flags), + ?line Flags = lists:sort(Flags1), + ?line {tracer,LocalTracer} = erlang:trace_info(Slave, tracer), %% - Ref = make_ref(), - apply_slave_async(?MODULE, receiver, [Ref]), - Slave ! Ref, - ?CTT(Slave,{?MODULE,receiver,[Ref]}) = receive_next_bytag(MetaTracer), - ?CTT(Slave,{erlang,phash2,[1,1]}) = receive_next_bytag(MetaTracer), - ?RFT(Slave,{erlang,phash2,2},0) = receive_next_bytag(MetaTracer), - ?RFT(Slave,{?MODULE,receiver,1},Ref) = receive_next_bytag(MetaTracer), - ?CT(Slave,{?MODULE,receiver,[Ref]}) = receive_next_bytag(LocalTracer), - ?CT(Slave,{erlang,phash2,[1,1]}) = receive_next_bytag(LocalTracer), - case {receive_next_bytag(LocalTracer), + ?line Ref = make_ref(), + ?line apply_slave_async(?MODULE, receiver, [Ref]), + ?line Slave ! Ref, + ?line ?CTT(Slave,{?MODULE,receiver,[Ref]}) = receive_next_bytag(MetaTracer), + ?line ?CTT(Slave,{erlang,phash2,[1,1]}) = receive_next_bytag(MetaTracer), + ?line ?RFT(Slave,{erlang,phash2,2},0) = receive_next_bytag(MetaTracer), + ?line ?RFT(Slave,{?MODULE,receiver,1},Ref) = receive_next_bytag(MetaTracer), + ?line ?CT(Slave,{?MODULE,receiver,[Ref]}) = receive_next_bytag(LocalTracer), + ?line ?CT(Slave,{erlang,phash2,[1,1]}) = receive_next_bytag(LocalTracer), + ?line case {receive_next_bytag(LocalTracer), receive_next_bytag(LocalTracer)} of {?RF(Slave,{erlang,phash2,2},0), ?RT(Slave,{?MODULE,receiver,1})} -> - ok; + ?line ok; {?RT(Slave,{?MODULE,receiver,1}), ?RF(Slave,{erlang,phash2,2},0)} -> - ok; + ?line ok; Error1 -> ?t:fail({unexpected_message, Error1}) end, - case {receive_next_bytag(LocalTracer), + ?line case {receive_next_bytag(LocalTracer), receive_next_bytag(LocalTracer)} of {?RF(Slave,{?MODULE,receiver,1},Ref), ?RT(Slave,{?MODULE,slave,1})} -> - ok; + ?line ok; {?RT(Slave,{?MODULE,slave,1}), ?RF(Slave,{?MODULE,receiver,1},Ref)} -> - ok; + ?line ok; Error2 -> ?t:fail({unexpected_message, Error2}) end, - shutdown(), - ?NM, + + ?line shutdown(), + ?line ?NM, ok. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -567,38 +570,38 @@ %% Setup silent local call tracing, and start it using meta trace. nosilent_test() -> - Pid = setup(), - Trigger = {?MODULE,id,1}, - TriggerMS = [{[start],[],[{silent,false}]}, - {[stop],[],[{silent,true},{return_trace}]}], - 1 = erlang:trace(Pid, true, [call,silent,return_to]), - erlang:trace_pattern({?MODULE,'_','_'},[],[local]), - 1 = erlang:trace_pattern({?MODULE,local2,1}, - [{'_',[],[{return_trace}]}], - [local]), - 1 = erlang:trace_pattern({?MODULE,slave,1},false,[local]), - 1 = erlang:trace_pattern(Trigger,false,[local]), - 1 = erlang:trace_pattern(Trigger,TriggerMS,[meta]), - [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), - receive_no_next(17), - start = apply_slave(?MODULE, id, [start]), - ?CTT(Pid,{?MODULE,id,[start]}) = receive_next(), - [2,2,2,0] = apply_slave(?MODULE,exported_wrap,[2]), - ?CT(Pid,{?MODULE,exported_wrap,[2]}) = receive_next(), - ?CT(Pid,{?MODULE,exported,[2]}) = receive_next(), - ?CT(Pid,{?MODULE,local,[2]}) = receive_next(), - ?CT(Pid,{?MODULE,local2,[2]}) = receive_next(), - ?CT(Pid,{?MODULE,local_tail,[2]}) = receive_next(), - ?RF(Pid,{?MODULE,local2,1}, [2,0]) = receive_next(), - ?RT(Pid,{?MODULE,local,1}) = receive_next(), - ?RT(Pid,{?MODULE,exported,1}) = receive_next(), - ?RT(Pid,{?MODULE,slave,1}) = receive_next(), - stop = apply_slave(?MODULE, id, [stop]), - ?CTT(Pid,{?MODULE,id,[stop]}) = receive_next(), - ?RFT(Pid,{?MODULE,id,1}, stop) = receive_next(), - [3,3,3,0] = apply_slave(?MODULE,exported_wrap,[3]), - receive_no_next(17), - shutdown(), + ?line Pid = setup(), + ?line Trigger = {?MODULE,id,1}, + ?line TriggerMS = [{[start],[],[{silent,false}]}, + {[stop],[],[{silent,true},{return_trace}]}], + ?line 1 = erlang:trace(Pid, true, [call,silent,return_to]), + ?line erlang:trace_pattern({?MODULE,'_','_'},[],[local]), + ?line 1 = erlang:trace_pattern({?MODULE,local2,1}, + [{'_',[],[{return_trace}]}], + [local]), + ?line 1 = erlang:trace_pattern({?MODULE,slave,1},false,[local]), + ?line 1 = erlang:trace_pattern(Trigger,false,[local]), + ?line 1 = erlang:trace_pattern(Trigger,TriggerMS,[meta]), + ?line [1,1,1,0] = apply_slave(?MODULE,exported_wrap,[1]), + ?line receive_no_next(17), + ?line start = apply_slave(?MODULE, id, [start]), + ?line ?CTT(Pid,{?MODULE,id,[start]}) = receive_next(), + ?line [2,2,2,0] = apply_slave(?MODULE,exported_wrap,[2]), + ?line ?CT(Pid,{?MODULE,exported_wrap,[2]}) = receive_next(), + ?line ?CT(Pid,{?MODULE,exported,[2]}) = receive_next(), + ?line ?CT(Pid,{?MODULE,local,[2]}) = receive_next(), + ?line ?CT(Pid,{?MODULE,local2,[2]}) = receive_next(), + ?line ?CT(Pid,{?MODULE,local_tail,[2]}) = receive_next(), + ?line ?RF(Pid,{?MODULE,local2,1}, [2,0]) = receive_next(), + ?line ?RT(Pid,{?MODULE,local,1}) = receive_next(), + ?line ?RT(Pid,{?MODULE,exported,1}) = receive_next(), + ?line ?RT(Pid,{?MODULE,slave,1}) = receive_next(), + ?line stop = apply_slave(?MODULE, id, [stop]), + ?line ?CTT(Pid,{?MODULE,id,[stop]}) = receive_next(), + ?line ?RFT(Pid,{?MODULE,id,1}, stop) = receive_next(), + ?line [3,3,3,0] = apply_slave(?MODULE,exported_wrap,[3]), + ?line receive_no_next(17), + ?line shutdown(), ok. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -642,9 +645,9 @@ Sync ! sync, receive {From,apply, M, F, A} -> - ?dbgformat("Apply: ~p:~p/~p (~p)~n",[M,F,length(A),A]), - Res = apply(M,F,A), - ?dbgformat("done Apply: ~p:~p/~p (~p)~n",[M,F,length(A),A]), + ?line ?dbgformat("Apply: ~p:~p/~p (~p)~n",[M,F,length(A),A]), + ?line Res = apply(M,F,A), + ?line ?dbgformat("done Apply: ~p:~p/~p (~p)~n",[M,F,length(A),A]), From ! {apply, Res}, erlang:trace_pattern({?MODULE,slave,1},false,[meta]), slave(From); diff -Nru erlang-18.2-dfsg/erts/emulator/test/trace_nif_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/trace_nif_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/trace_nif_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/trace_nif_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/trace_port_SUITE_data/echo_drv.c erlang-17.3-dfsg/erts/emulator/test/trace_port_SUITE_data/echo_drv.c --- erlang-18.2-dfsg/erts/emulator/test/trace_port_SUITE_data/echo_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/trace_port_SUITE_data/echo_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,6 +1,5 @@ #include #include "erl_driver.h" -#include @@ -15,7 +14,6 @@ typedef struct _erl_drv_data { ErlDrvPort erlang_port; enum e_heavy heavy; - int crash; } EchoDrvData; static EchoDrvData echo_drv_data, *echo_drv_data_p; @@ -80,7 +78,6 @@ echo_drv_data_p = &echo_drv_data; echo_drv_data_p->erlang_port = port; echo_drv_data_p->heavy = heavy_off; - echo_drv_data_p->crash = 0; return echo_drv_data_p; } @@ -90,12 +87,6 @@ static void echo_drv_output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) { EchoDrvData* data_p = (EchoDrvData *) drv_data; - - if (data_p->crash) { - driver_failure_posix(data_p->erlang_port, EINTR); - return; - } - driver_output(data_p->erlang_port, buf, len); switch (data_p->heavy) { case heavy_off: @@ -109,7 +100,6 @@ data_p->heavy = heavy_off; break; } - } static void echo_drv_finish() { @@ -125,8 +115,6 @@ case 'h': data_p->heavy = heavy_set; break; - case 'c': - data_p->crash = 1; } return 0; } diff -Nru erlang-18.2-dfsg/erts/emulator/test/trace_port_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/trace_port_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/trace_port_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/trace_port_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -35,8 +34,7 @@ fake_schedule_after_getting_linked/1, fake_schedule_after_getting_unlinked/1, gc/1, - default_tracer/1, - tracer_port_crash/1]). + default_tracer/1]). -include_lib("test_server/include/test_server.hrl"). @@ -46,7 +44,7 @@ fake_schedule_after_register, fake_schedule_after_getting_linked, fake_schedule_after_getting_unlinked, gc, - default_tracer, tracer_port_crash]. + default_tracer]. suite() -> [{ct_hooks,[ts_install_cth]}]. @@ -474,42 +472,6 @@ ?line M = N, ok. -tracer_port_crash(Config) when is_list(Config) -> - case test_server:is_native(?MODULE) orelse - test_server:is_native(lists) of - true -> - {skip,"Native code"}; - false -> - Tr = start_tracer(Config), - Port = get(tracer_port), - Tracee = spawn(fun () -> - register(trace_port_linker, self()), - link(Port), - receive go -> ok end, - lists:reverse([1,b,c]), - receive die -> ok end - end), - Tr ! {unlink_tracer_port, self()}, - receive {unlinked_tracer_port, Tr} -> ok end, - port_control(Port, $c, []), %% Make port commands crash tracer port... - trace_func({lists,reverse,1}, []), - trace_pid(Tracee, true, [call]), - trace_info(Tracee, flags), - trace_info(self(), tracer), - Tracee ! go, - receive after 1000 -> ok end, - case whereis(trace_port_linker) of - undefined -> - ok; - Id -> -% erts_debug:set_internal_state(available_internal_state, true), -% erts_debug:set_internal_state(abort, {trace_port_linker, Id}) - ?t:fail({trace_port_linker, Id}) - end, - undefined = process_info(Tracee), - ok - end. - %%% Help functions. huge_data() -> huge_data(16384). @@ -668,10 +630,6 @@ {Port,{data,Msg}} -> RelayTo ! binary_to_term(Msg), tracer_loop(RelayTo, Port); - {unlink_tracer_port, From} -> - unlink(Port), - From ! {unlinked_tracer_port, self()}, - tracer_loop(RelayTo, Port); Other -> exit({bad_message,Other}) end. diff -Nru erlang-18.2-dfsg/erts/emulator/test/trace_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/trace_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/trace_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/trace_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/tuple_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/tuple_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/tuple_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/tuple_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/test/unique_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/unique_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/unique_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/unique_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,391 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2014. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - --module(unique_SUITE). - --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - init_per_testcase/2,end_per_testcase/2]). --export([unique_monotonic_integer_white_box/1, - unique_integer_white_box/1]). - --include_lib("test_server/include/test_server.hrl"). - -%-define(P(V), V). --define(P(V), print_ret_val(?FILE, ?LINE, V)). - --define(PRINT(V), print_ret_val(?FILE, ?LINE, V)). - - -init_per_testcase(Case, Config) -> - ?line Dog=test_server:timetrap(test_server:minutes(2)), - [{watchdog, Dog}, {testcase, Case}|Config]. - -end_per_testcase(_, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [unique_monotonic_integer_white_box, - unique_integer_white_box]. - -groups() -> - []. - -init_per_suite(Config) -> - erts_debug:set_internal_state(available_internal_state, true), - Config. - -end_per_suite(_Config) -> - erts_debug:set_internal_state(available_internal_state, false), - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -%% -%% -%% Unique counter white box test case -%% -%% - -unique_monotonic_integer_white_box(Config) when is_list(Config) -> - {ok, Node} = start_node(Config), - TestServer = self(), - Success = make_ref(), - %% Run this in a separate node, so we don't mess up - %% the system when moving the strict monotonic counter - %% around in a non-strict monotonic way... - Test = spawn(Node, - fun () -> - unique_monotonic_integer_white_box_test(TestServer, Success) - end), - Mon = erlang:monitor(process, Test), - receive - {'DOWN', Mon, process, Test, Error} -> - ?t:fail(Error); - Success -> - ok - end, - erlang:demonitor(Mon, [flush]), - stop_node(Node), - ok. - -set_unique_monotonic_integer_state(MinCounter, NextValue) -> - true = erts_debug:set_internal_state(unique_monotonic_integer_state, - NextValue-MinCounter-1). - - - -unique_monotonic_integer_white_box_test(TestServer, Success) -> - erts_debug:set_internal_state(available_internal_state, true), - - WordSize = erlang:system_info({wordsize, internal}), - SmallBits = WordSize*8 - 4, - - MinSmall = -1*(1 bsl (SmallBits-1)), - MaxSmall = (1 bsl (SmallBits-1))-1, - %% Make sure we got small sizes correct... - 0 = erts_debug:size(MinSmall), - false = 0 =:= erts_debug:size(MinSmall-1), - 0 = erts_debug:size(MaxSmall), - false = 0 =:= erts_debug:size(MaxSmall+1), - - ?PRINT({min_small, MinSmall}), - ?PRINT({max_small, MaxSmall}), - - MinSint64 = -1*(1 bsl 63), - MaxSint64 = (1 bsl 63)-1, - - ?PRINT({min_Sint64, MinSint64}), - ?PRINT({max_Sint64, MaxSint64}), - - MinCounter = erts_debug:get_internal_state(min_unique_monotonic_integer), - MaxCounter = MinCounter + (1 bsl 64) - 1, - - ?PRINT({min_counter, MinCounter}), - ?PRINT({max_counter, MaxCounter}), - - case WordSize of - 4 -> - MinCounter = MinSint64; - 8 -> - MinCounter = MinSmall - end, - - StartState = erts_debug:get_internal_state(unique_monotonic_integer_state), - - %% Verify that we get expected results over all internal limits... - - case MinCounter < MinSmall of - false -> - 8 = WordSize, - ok; - true -> - 4 = WordSize, - ?PRINT(over_min_small), - set_unique_monotonic_integer_state(MinCounter, MinSmall-2), - true = (?P(erlang:unique_integer([monotonic])) == MinSmall - 2), - true = (?P(erlang:unique_integer([monotonic])) == MinSmall - 1), - true = (?P(erlang:unique_integer([monotonic])) == MinSmall), - true = (?P(erlang:unique_integer([monotonic])) == MinSmall + 1), - true = (?P(erlang:unique_integer([monotonic])) == MinSmall + 2), - garbage_collect(), - ok - end, - - ?PRINT(over_zero), %% Not really an interesting limit, but... - set_unique_monotonic_integer_state(MinCounter, -2), - true = (?P(erlang:unique_integer([monotonic])) == -2), - true = (?P(erlang:unique_integer([monotonic])) == -1), - true = (?P(erlang:unique_integer([monotonic])) == 0), - true = (?P(erlang:unique_integer([monotonic])) == 1), - true = (?P(erlang:unique_integer([monotonic])) == 2), - garbage_collect(), - - ?PRINT(over_max_small), - set_unique_monotonic_integer_state(MinCounter, MaxSmall-2), - true = (?P(erlang:unique_integer([monotonic])) == MaxSmall - 2), - true = (?P(erlang:unique_integer([monotonic])) == MaxSmall - 1), - true = (?P(erlang:unique_integer([monotonic])) == MaxSmall), - true = (?P(erlang:unique_integer([monotonic])) == MaxSmall + 1), - true = (?P(erlang:unique_integer([monotonic])) == MaxSmall + 2), - garbage_collect(), - - case MaxCounter > MaxSint64 of - false -> - 4 = WordSize, - ok; - true -> - 8 = WordSize, - ?PRINT(over_max_sint64), - set_unique_monotonic_integer_state(MinCounter, MaxSint64-2), - true = (?P(erlang:unique_integer([monotonic])) == MaxSint64 - 2), - true = (?P(erlang:unique_integer([monotonic])) == MaxSint64 - 1), - true = (?P(erlang:unique_integer([monotonic])) == MaxSint64), - true = (?P(erlang:unique_integer([monotonic])) == MaxSint64 + 1), - true = (?P(erlang:unique_integer([monotonic])) == MaxSint64 + 2), - garbage_collect() - end, - - ?PRINT(over_max_min_counter), - set_unique_monotonic_integer_state(MinCounter, if MaxCounter == MaxSint64 -> - MaxCounter-2; - true -> - MinCounter-3 - end), - true = (?P(erlang:unique_integer([monotonic])) == MaxCounter - 2), - true = (?P(erlang:unique_integer([monotonic])) == MaxCounter - 1), - true = (?P(erlang:unique_integer([monotonic])) == MaxCounter), - true = (?P(erlang:unique_integer([monotonic])) == MinCounter), - true = (?P(erlang:unique_integer([monotonic])) == MinCounter + 1), - true = (?P(erlang:unique_integer([monotonic])) == MinCounter + 2), - garbage_collect(), - - %% Restore initial state and hope we didn't mess it up for the - %% system... - true = erts_debug:set_internal_state(unique_monotonic_integer_state, - StartState), - - TestServer ! Success. - -%% -%% -%% Unique integer white box test case -%% -%% - --record(uniqint_info, {min_int, - max_int, - max_small, - schedulers, - sched_bits}). - -unique_integer_white_box(Config) when is_list(Config) -> - UinqintInfo = init_uniqint_info(), - #uniqint_info{min_int = MinInt, - max_int = MaxInt, - max_small = MaxSmall} = UinqintInfo, - io:format("****************************************************~n", []), - io:format("*** Around MIN_UNIQ_INT ~p ***~n", [MinInt]), - io:format("****************************************************~n", []), - check_unique_integer_around(MinInt, UinqintInfo), - io:format("****************************************************~n", []), - io:format("*** Around 0 ***~n", []), - io:format("****************************************************~n", []), - check_unique_integer_around(0, UinqintInfo), - io:format("****************************************************~n", []), - io:format("*** Around MAX_SMALL ~p ***~n", [MaxSmall]), - io:format("****************************************************~n", []), - check_unique_integer_around(MaxSmall, UinqintInfo), - io:format("****************************************************~n", []), - io:format("*** Around 2^64+MIN_UNIQ_INT ~p ***~n", [(1 bsl 64)+MinInt]), - io:format("****************************************************~n", []), - check_unique_integer_around((1 bsl 64)+MinInt, UinqintInfo), - io:format("****************************************************~n", []), - io:format("*** Around 2^64 ~p~n", [(1 bsl 64)]), - io:format("****************************************************~n", []), - check_unique_integer_around((1 bsl 64), UinqintInfo), - io:format("****************************************************~n", []), - io:format("*** Around 2^64-MIN_UNIQ_INT ~p ***~n", [(1 bsl 64)-MinInt]), - io:format("****************************************************~n", []), - check_unique_integer_around((1 bsl 64)-MinInt, UinqintInfo), - io:format("****************************************************~n", []), - io:format("*** Around MAX_UNIQ_INT ~p ***~n", [MaxInt]), - io:format("****************************************************~n", []), - check_unique_integer_around(MaxInt, UinqintInfo), - ok. - - -%%% Internal unique_integer_white_box/1 test case - -calc_sched_bits(NoScheds, Shift) when NoScheds < 1 bsl Shift -> - Shift; -calc_sched_bits(NoScheds, Shift) -> - calc_sched_bits(NoScheds, Shift+1). - -init_uniqint_info() -> - SmallBits = erlang:system_info({wordsize, internal})*8-4, - io:format("SmallBits=~p~n", [SmallBits]), - Schedulers = erlang:system_info(schedulers), - io:format("Schedulers=~p~n", [Schedulers]), - MinSmall = -1*(1 bsl (SmallBits-1)), - io:format("MinSmall=~p~n", [MinSmall]), - MaxSmall = (1 bsl (SmallBits-1))-1, - io:format("MaxSmall=~p~n", [MaxSmall]), - SchedBits = calc_sched_bits(Schedulers, 0), - io:format("SchedBits=~p~n", [SchedBits]), - MaxInt = ((((1 bsl 64) - 1) bsl SchedBits) bor Schedulers) + MinSmall, - io:format("MaxInt=~p~n", [MaxInt]), - #uniqint_info{min_int = MinSmall, - max_int = MaxInt, - max_small = MaxSmall, - schedulers = Schedulers, - sched_bits = SchedBits}. - -valid_uniqint(Int, #uniqint_info{min_int = MinInt} = UinqintInfo) when Int < MinInt -> - valid_uniqint(MinInt, UinqintInfo); -valid_uniqint(Int, #uniqint_info{min_int = MinInt, - sched_bits = SchedBits, - schedulers = Scheds}) -> - Int1 = Int - MinInt, - {Inc, ThreadNo} = case Int1 band ((1 bsl SchedBits) - 1) of - TN when TN > Scheds -> - {1, Scheds}; - TN -> - {0, TN} - end, - Counter = ((Int1 bsr SchedBits) + Inc) rem (1 bsl 64), - ((Counter bsl SchedBits) bor ThreadNo) + MinInt. - -smaller_valid_uniqint(Int, UinqintInfo) -> - Cand = Int-1, - case valid_uniqint(Cand, UinqintInfo) of - RI when RI < Int -> - RI; - _ -> - smaller_valid_uniqint(Cand, UinqintInfo) - end. - -int32_to_bigendian_list(Int) -> - 0 = Int bsr 32, - [(Int bsr 24) band 16#ff, - (Int bsr 16) band 16#ff, - (Int bsr 8) band 16#ff, - Int band 16#ff]. - -mk_uniqint(Int, #uniqint_info {min_int = MinInt, - sched_bits = SchedBits} = _UinqintInfo) -> - Int1 = Int - MinInt, - ThrId = Int1 band ((1 bsl SchedBits) - 1), - Value = (Int1 bsr SchedBits) band ((1 bsl 64) - 1), - 0 = Int1 bsr (SchedBits + 64), - NodeName = atom_to_list(node()), - Make = {make_unique_integer, ThrId, Value}, - %% erlang:display(Make), - Res = erts_debug:get_internal_state(Make), - %% erlang:display({uniq_int, Res}), - Res. - -check_uniqint(Int, UinqintInfo) -> - UniqInt = mk_uniqint(Int, UinqintInfo), - io:format("UniqInt=~p ", [UniqInt]), - case UniqInt =:= Int of - true -> - io:format("OK~n~n", []); - false -> - io:format("result UniqInt=~p FAILED~n", [UniqInt]), - exit(badres) - end. - -check_unique_integer_around(Int, #uniqint_info{min_int = MinInt, - max_int = MaxInt} = UinqintInfo) -> - {Start, End} = case {Int =< MinInt+100, Int >= MaxInt-100} of - {true, false} -> - {MinInt, MinInt+100}; - {false, false} -> - {smaller_valid_uniqint(Int-100, UinqintInfo), - valid_uniqint(Int+100, UinqintInfo)}; - {false, true} -> - {MaxInt-100, MaxInt} - end, - lists:foldl(fun (I, OldRefInt) -> - RefInt = valid_uniqint(I, UinqintInfo), - case OldRefInt =:= RefInt of - true -> - ok; - false -> - check_uniqint(RefInt, UinqintInfo) - end, - RefInt - end, - none, - lists:seq(Start, End)). - - -%% helpers - -print_ret_val(File, Line, Value) -> - io:format("~s:~p: ~p~n", [File, Line, Value]), - Value. - -start_node(Config) -> - start_node(Config, []). -start_node(Config, Opts) when is_list(Config), is_list(Opts) -> - ?line Pa = filename:dirname(code:which(?MODULE)), - ?line A = erlang:monotonic_time(1) + erlang:time_offset(1), - ?line B = erlang:unique_integer([positive]), - ?line Name = list_to_atom(atom_to_list(?MODULE) - ++ "-" - ++ atom_to_list(?config(testcase, Config)) - ++ "-" - ++ integer_to_list(A) - ++ "-" - ++ integer_to_list(B)), - ?line ?t:start_node(Name, slave, [{args, Opts++" -pa "++Pa}]). - -stop_node(Node) -> - ?t:stop_node(Node). diff -Nru erlang-18.2-dfsg/erts/emulator/test/z_SUITE.erl erlang-17.3-dfsg/erts/emulator/test/z_SUITE.erl --- erlang-18.2-dfsg/erts/emulator/test/z_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/test/z_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -39,7 +38,7 @@ -export([schedulers_alive/1, node_container_refc_check/1, long_timers/1, pollset_size/1, - check_io_debug/1, get_check_io_info/0]). + check_io_debug/1]). -define(DEFAULT_TIMEOUT, ?t:minutes(5)). @@ -289,14 +288,11 @@ end. check_io_debug_test() -> - ?line erlang:display(get_check_io_info()), ?line erts_debug:set_internal_state(available_internal_state, true), - ?line {NoErrorFds, NoUsedFds, NoDrvSelStructs, NoDrvEvStructs} - = erts_debug:get_internal_state(check_io_debug), + ?line erlang:display(erlang:system_info(check_io)), + ?line NoOfErrorFds = erts_debug:get_internal_state(check_io_debug), ?line erts_debug:set_internal_state(available_internal_state, false), - ?line 0 = NoErrorFds, - ?line NoUsedFds = NoDrvSelStructs, - ?line 0 = NoDrvEvStructs, + ?line 0 = NoOfErrorFds, ?line ok. @@ -309,7 +305,7 @@ catch erlang:display('--- CHECK IO INFO ---'), catch erlang:display(ChkIo), catch erts_debug:set_internal_state(available_internal_state, true), - NoOfErrorFds = (catch element(1, erts_debug:get_internal_state(check_io_debug))), + NoOfErrorFds = (catch erts_debug:get_internal_state(check_io_debug)), catch erlang:display({'NoOfErrorFds', NoOfErrorFds}), catch erts_debug:set_internal_state(available_internal_state, false), catch erlang:display('--- CHECK IO INFO ---'), @@ -317,19 +313,14 @@ get_check_io_info() -> ChkIo = erlang:system_info(check_io), - PendUpdNo = case lists:keysearch(pending_updates, 1, ChkIo) of - {value, {pending_updates, PendNo}} -> - PendNo; - false -> - 0 - end, - {value, {active_fds, ActFds}} = lists:keysearch(active_fds, 1, ChkIo), - case {PendUpdNo, ActFds} of - {0, 0} -> + case lists:keysearch(pending_updates, 1, ChkIo) of + {value, {pending_updates, 0}} -> display_check_io(ChkIo), ChkIo; + false -> + ChkIo; _ -> - receive after 100 -> ok end, + receive after 10 -> ok end, get_check_io_info() end. diff -Nru erlang-18.2-dfsg/erts/emulator/utils/beam_makeops erlang-17.3-dfsg/erts/emulator/utils/beam_makeops --- erlang-18.2-dfsg/erts/emulator/utils/beam_makeops 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/beam_makeops 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1998-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/utils/beam_strip erlang-17.3-dfsg/erts/emulator/utils/beam_strip --- erlang-18.2-dfsg/erts/emulator/utils/beam_strip 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/beam_strip 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/utils/count erlang-17.3-dfsg/erts/emulator/utils/count --- erlang-18.2-dfsg/erts/emulator/utils/count 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/count 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/utils/loaded erlang-17.3-dfsg/erts/emulator/utils/loaded --- erlang-18.2-dfsg/erts/emulator/utils/loaded 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/loaded 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/emulator/utils/make_alloc_types erlang-17.3-dfsg/erts/emulator/utils/make_alloc_types --- erlang-18.2-dfsg/erts/emulator/utils/make_alloc_types 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/make_alloc_types 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2003-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% @@ -191,17 +190,16 @@ * * Copyright Ericsson AB ", (1900 + (localtime)[5]), ". All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the \"License\"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an \"AS IS\" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the \"License\"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an \"AS IS\" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * */ @@ -246,7 +244,7 @@ print DST "#define ERTS_ALC_C_MIN ($c_no)\n\n"; -foreach my $c (sort keys(%c_tab)) { +foreach my $c (keys(%c_tab)) { push(@c_order, $c); set_number($c_tab{$c}, $c_no); print DST "#define ERTS_ALC_C_$c ($c_no)\n"; diff -Nru erlang-18.2-dfsg/erts/emulator/utils/make_compiler_flags erlang-17.3-dfsg/erts/emulator/utils/make_compiler_flags --- erlang-18.2-dfsg/erts/emulator/utils/make_compiler_flags 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/make_compiler_flags 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1999-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -71,7 +70,7 @@ print "/* Warning: Do not edit this file.\n"; print " Auto-generated by '$prog'.*/\n"; -foreach (sort(keys %constants)) { +foreach(keys %constants) { print "const char* erts_build_flags_$_ = \"$constants{$_}\";\n" } diff -Nru erlang-18.2-dfsg/erts/emulator/utils/make_driver_tab erlang-17.3-dfsg/erts/emulator/utils/make_driver_tab --- erlang-18.2-dfsg/erts/emulator/utils/make_driver_tab 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/make_driver_tab 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1999-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/utils/make_preload erlang-17.3-dfsg/erts/emulator/utils/make_preload --- erlang-18.2-dfsg/erts/emulator/utils/make_preload 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/make_preload 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1999-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/utils/make_tables erlang-17.3-dfsg/erts/emulator/utils/make_tables --- erlang-18.2-dfsg/erts/emulator/utils/make_tables 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/make_tables 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1999-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/emulator/utils/make_version erlang-17.3-dfsg/erts/emulator/utils/make_version --- erlang-18.2-dfsg/erts/emulator/utils/make_version 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/make_version 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1999-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -59,11 +58,7 @@ #define ERLANG_OTP_RELEASE "$release" #define ERLANG_OTP_VERSION "$otp_version" #define ERLANG_VERSION "$version" -#if ERTS_SAVED_COMPILE_TIME -# define ERLANG_COMPILE_DATE "$time_str" -#else -# define ERLANG_COMPILE_DATE "" -#endif +#define ERLANG_COMPILE_DATE "$time_str" #define ERLANG_ARCHITECTURE "$architecture" EOF diff -Nru erlang-18.2-dfsg/erts/emulator/utils/mkver.c erlang-17.3-dfsg/erts/emulator/utils/mkver.c --- erlang-18.2-dfsg/erts/emulator/utils/mkver.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/utils/mkver.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -35,10 +34,8 @@ char** argv; { FILE *file; -#if ERTS_SAVED_COMPILE_TIME time_t now; -#endif - char *cnow = ""; + char *cnow; if (argc != 2) { fprintf(stderr, "usage: mkver version\n"); @@ -50,11 +47,9 @@ exit(1); } -#if ERTS_SAVED_COMPILE_TIME time(&now); cnow = ctime(&now); cnow[24] = '\0'; /* tidelipom */ -#endif fprintf(file, "/* This file was created by mkver -- don't modify.*/\n"); fprintf(file, "#define ERLANG_VERSION \"%s\"\n", argv[1]); fprintf(file, "#define ERLANG_COMPILE_DATE \"%s\"\n", cnow); diff -Nru erlang-18.2-dfsg/erts/emulator/valgrind/suppress.patched.3.6.0 erlang-17.3-dfsg/erts/emulator/valgrind/suppress.patched.3.6.0 --- erlang-18.2-dfsg/erts/emulator/valgrind/suppress.patched.3.6.0 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/valgrind/suppress.patched.3.6.0 2014-09-16 19:10:57.000000000 +0000 @@ -273,11 +273,6 @@ fun:AES_cbc_encrypt ... } -{ - crypto RC4 can do harmless word aligned read past end of input - Memcheck:Addr8 - fun:RC4 -} { erts_bits_init_state; Why is this needed? @@ -362,15 +357,3 @@ ... } -{ -Deliberate invalid read by test case bif_SUITE:erlang_halt -Memcheck:Addr4 -... -fun:erts_print_scheduler_info -... -fun:erl_exit -fun:broken_halt_test -fun:erts_debug_set_internal_state_2 -fun:process_main -} - diff -Nru erlang-18.2-dfsg/erts/emulator/valgrind/suppress.standard erlang-17.3-dfsg/erts/emulator/valgrind/suppress.standard --- erlang-18.2-dfsg/erts/emulator/valgrind/suppress.standard 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/valgrind/suppress.standard 2014-09-16 19:10:57.000000000 +0000 @@ -260,11 +260,6 @@ fun:AES_cbc_encrypt ... } -{ - crypto RC4 can do harmless word aligned read past end of input - Memcheck:Addr8 - fun:RC4 -} { Prebuilt constant terms in os_info_init (PossiblyLost) @@ -330,15 +325,3 @@ ... } -{ -Deliberate invalid read by test case bif_SUITE:erlang_halt -Memcheck:Addr4 -... -fun:erts_print_scheduler_info -... -fun:erl_exit -fun:broken_halt_test -fun:erts_debug_set_internal_state_2 -fun:process_main -} - diff -Nru erlang-18.2-dfsg/erts/emulator/zlib/zlib.mk erlang-17.3-dfsg/erts/emulator/zlib/zlib.mk --- erlang-18.2-dfsg/erts/emulator/zlib/zlib.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/emulator/zlib/zlib.mk 2014-09-16 19:10:57.000000000 +0000 @@ -6,17 +6,16 @@ # # Copyright Ericsson AB 2011-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/epmd/epmd.mk erlang-17.3-dfsg/erts/epmd/epmd.mk --- erlang-18.2-dfsg/erts/epmd/epmd.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/epmd.mk 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1998-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/epmd/Makefile erlang-17.3-dfsg/erts/epmd/Makefile --- erlang-18.2-dfsg/erts/epmd/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1998-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/epmd/src/epmd.c erlang-17.3-dfsg/erts/epmd/src/epmd.c --- erlang-18.2-dfsg/erts/epmd/src/epmd.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/src/epmd.c 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -29,7 +28,7 @@ #ifdef HAVE_STDLIB_H # include #endif -#include + /* forward declarations */ static void usage(EpmdVars *); @@ -176,9 +175,9 @@ g->nodes.reg = g->nodes.unreg = g->nodes.unreg_tail = NULL; g->nodes.unreg_count = 0; g->active_conn = 0; -#ifdef HAVE_SYSTEMD_DAEMON +#ifdef HAVE_SYSTEMD_SD_DAEMON_H g->is_systemd = 0; -#endif /* HAVE_SYSTEMD_DAEMON */ +#endif for (i = 0; i < MAX_LISTEN_SOCKETS; i++) g->listenfd[i] = -1; @@ -252,11 +251,11 @@ else usage(g); epmd_cleanup_exit(g,0); -#ifdef HAVE_SYSTEMD_DAEMON +#ifdef HAVE_SYSTEMD_SD_DAEMON_H } else if (strcmp(argv[0], "-systemd") == 0) { g->is_systemd = 1; argv++; argc--; -#endif /* HAVE_SYSTEMD_DAEMON */ +#endif } else usage(g); } @@ -346,7 +345,7 @@ inform it of that the log is closed. */ closelog(); - /* These shouldn't be needed but for safety... */ + /* These chouldn't be needed but for safety... */ open("/dev/null", O_RDONLY); /* Order is important! */ open("/dev/null", O_WRONLY); @@ -387,7 +386,7 @@ close(1); close(2); - /* These shouldn't be needed but for safety... */ + /* These chouldn't be needed but for safety... */ open("nul", O_RDONLY); open("nul", O_WRONLY); @@ -462,11 +461,11 @@ fprintf(stderr, " Forcibly unregisters a name with epmd\n"); fprintf(stderr, " (only allowed if -relaxed_command_check was given when \n"); fprintf(stderr, " epmd was started).\n"); -#ifdef HAVE_SYSTEMD_DAEMON +#ifdef HAVE_SYSTEMD_SD_DAEMON_H fprintf(stderr, " -systemd\n"); fprintf(stderr, " Wait for socket from systemd. The option makes sense\n"); fprintf(stderr, " when started from .socket unit.\n"); -#endif /* HAVE_SYSTEMD_DAEMON */ +#endif epmd_cleanup_exit(g,1); } @@ -499,7 +498,11 @@ #ifdef HAVE_SYSLOG_H if (onsyslog) { - erts_vsnprintf(buf, DEBUG_BUFFER_SIZE, format, args); + int len; + len = erts_vsnprintf(buf, DEBUG_BUFFER_SIZE, format, args); + if (perr != 0 && len < sizeof(buf)) { + erts_snprintf(buf+len, sizeof(buf)-len, ": %s", strerror(perr)); + } syslog(LOG_ERR,"epmd: %s",buf); } #endif @@ -590,11 +593,9 @@ for(i=0; g->argv[i] != NULL; ++i) free(g->argv[i]); free(g->argv); - } -#ifdef HAVE_SYSTEMD_DAEMON - sd_notifyf(0, "STATUS=Exited.\n" - "ERRNO=%i", exitval); -#endif /* HAVE_SYSTEMD_DAEMON */ + } + + exit(exitval); } diff -Nru erlang-18.2-dfsg/erts/epmd/src/epmd_cli.c erlang-17.3-dfsg/erts/epmd/src/epmd_cli.c --- erlang-18.2-dfsg/erts/epmd/src/epmd_cli.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/src/epmd_cli.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/epmd/src/epmd.h erlang-17.3-dfsg/erts/epmd/src/epmd.h --- erlang-18.2-dfsg/erts/epmd/src/epmd.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/src/epmd.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/epmd/src/epmd_int.h erlang-17.3-dfsg/erts/epmd/src/epmd_int.h --- erlang-18.2-dfsg/erts/epmd/src/epmd_int.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/src/epmd_int.h 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -126,9 +125,9 @@ # include "sys/select.h" #endif -#ifdef HAVE_SYSTEMD_DAEMON +#ifdef HAVE_SYSTEMD_SD_DAEMON_H # include -#endif /* HAVE_SYSTEMD_DAEMON */ +#endif /* ************************************************************************ */ /* Replace some functions by others by making the function name a macro */ @@ -341,9 +340,9 @@ int listenfd[MAX_LISTEN_SOCKETS]; char *addresses; char **argv; -#ifdef HAVE_SYSTEMD_DAEMON +#ifdef HAVE_SYSTEMD_SD_DAEMON_H int is_systemd; -#endif /* HAVE_SYSTEMD_DAEMON */ +#endif } EpmdVars; void dbg_printf(EpmdVars*,int,const char*,...); diff -Nru erlang-18.2-dfsg/erts/epmd/src/epmd_srv.c erlang-17.3-dfsg/erts/epmd/src/epmd_srv.c --- erlang-18.2-dfsg/erts/epmd/src/epmd_srv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/src/epmd_srv.c 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -245,7 +244,7 @@ } else { -#endif /* HAVE_SYSTEMD_DAEMON */ +#endif dbg_printf(g,2,"try to initiate listening port %d", g->port); @@ -313,7 +312,7 @@ } #ifdef HAVE_SYSTEMD_DAEMON } -#endif /* HAVE_SYSTEMD_DAEMON */ +#endif #if !defined(__WIN32__) && !defined(__OSE__) /* We ignore the SIGPIPE signal that is raised when we call write @@ -331,13 +330,13 @@ FD_ZERO(&g->orig_read_mask); g->select_fd_top = 0; -#ifdef HAVE_SYSTEMD_DAEMON +#ifdef HAVE_SYSTEMD_SD_DAEMON_H if (g->is_systemd) for (i = 0; i < num_sockets; i++) select_fd_set(g, listensock[i]); else { -#endif /* HAVE_SYSTEMD_DAEMON */ +#endif for (i = 0; i < num_sockets; i++) { if ((listensock[i] = socket(FAMILY,SOCK_STREAM,0)) < 0) @@ -400,12 +399,9 @@ } select_fd_set(g, listensock[i]); } -#ifdef HAVE_SYSTEMD_DAEMON +#ifdef HAVE_SYSTEMD_SD_DAEMON_H } - sd_notifyf(0, "READY=1\n" - "STATUS=Processing port mapping requests...\n" - "MAINPID=%lu", (unsigned long) getpid()); -#endif /* HAVE_SYSTEMD_DAEMON */ +#endif dbg_tty_printf(g,2,"entering the main select() loop"); diff -Nru erlang-18.2-dfsg/erts/epmd/src/Makefile erlang-17.3-dfsg/erts/epmd/src/Makefile --- erlang-18.2-dfsg/erts/epmd/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1998-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/epmd/src/Makefile.in erlang-17.3-dfsg/erts/epmd/src/Makefile.in --- erlang-18.2-dfsg/erts/epmd/src/Makefile.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/src/Makefile.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1998-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/epmd/test/epmd_SUITE.erl erlang-17.3-dfsg/erts/epmd/test/epmd_SUITE.erl --- erlang-18.2-dfsg/erts/epmd/test/epmd_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/test/epmd_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/epmd/test/Makefile erlang-17.3-dfsg/erts/epmd/test/Makefile --- erlang-18.2-dfsg/erts/epmd/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/epmd/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1998-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/common/ct_run.c erlang-17.3-dfsg/erts/etc/common/ct_run.c --- erlang-18.2-dfsg/erts/etc/common/ct_run.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/ct_run.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -83,6 +82,7 @@ static void error(char* format, ...); static char* emalloc(size_t size); static char* strsave(char* string); +static void push_words(char* src); static int run_erlang(char* name, char** argv); static char* get_default_emulator(char* progname); #ifdef __WIN32__ @@ -151,8 +151,6 @@ argv0 = argv; emulator = get_default_emulator(argv[0]); - if (strlen(emulator) >= MAXPATHLEN) - error("Emulator path length is too large"); /* * Allocate the argv vector to be used for arguments to Erlang. @@ -164,7 +162,7 @@ eargv_base = (char **) emalloc(eargv_size*sizeof(char*)); eargv = eargv_base; eargc = 0; - PUSH(strsave(emulator)); + push_words(emulator); eargc_base = eargc; eargv = eargv + eargv_size/2; eargc = 0; @@ -241,7 +239,7 @@ */ if (ct_mode == VTS_MODE) { - PUSH4("-s", "ct_webtool", "script_start", "vts"); + PUSH4("-s", "webtool", "script_start", "vts"); if (browser[0] != '\0') PUSH(browser); PUSH3("-s", "ct_run", "script_start"); } @@ -295,6 +293,26 @@ return run_erlang(eargv[0], eargv); } +static void +push_words(char* src) +{ + char sbuf[MAXPATHLEN]; + char* dst; + + dst = sbuf; + while ((*dst++ = *src++) != '\0') { + if (isspace((int)*src)) { + *dst = '\0'; + PUSH(strsave(sbuf)); + dst = sbuf; + do { + src++; + } while (isspace((int)*src)); + } + } + if (sbuf[0]) + PUSH(strsave(sbuf)); +} #ifdef __WIN32__ wchar_t *make_commandline(char **argv) { diff -Nru erlang-18.2-dfsg/erts/etc/common/dialyzer.c erlang-17.3-dfsg/erts/etc/common/dialyzer.c --- erlang-18.2-dfsg/erts/etc/common/dialyzer.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/dialyzer.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -65,6 +64,7 @@ static void error(char* format, ...); static char* emalloc(size_t size); static char* strsave(char* string); +static void push_words(char* src); static int run_erlang(char* name, char** argv); static char* get_default_emulator(char* progname); #ifdef __WIN32__ @@ -188,7 +188,7 @@ eargv_base = (char **) emalloc(eargv_size*sizeof(char*)); eargv = eargv_base; eargc = 0; - PUSH(strsave(emulator)); + push_words(emulator); eargc_base = eargc; eargv = eargv + eargv_size/2; eargc = 0; @@ -268,6 +268,27 @@ return run_erlang(eargv[0], eargv); } +static void +push_words(char* src) +{ + char sbuf[MAXPATHLEN]; + char* dst; + + dst = sbuf; + while ((*dst++ = *src++) != '\0') { + if (isspace((int)*src)) { + *dst = '\0'; + PUSH(strsave(sbuf)); + dst = sbuf; + do { + src++; + } while (isspace((int)*src)); + } + } + if (sbuf[0]) + PUSH(strsave(sbuf)); +} + #ifdef __WIN32__ wchar_t *make_commandline(char **argv) { diff -Nru erlang-18.2-dfsg/erts/etc/common/erlc.c erlang-17.3-dfsg/erts/etc/common/erlc.c --- erlang-18.2-dfsg/erts/etc/common/erlc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/erlc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -200,7 +199,7 @@ eargv_base = (char **) emalloc(eargv_size*sizeof(char*)); eargv = eargv_base; eargc = 0; - PUSH(strsave(emulator)); + push_words(emulator); eargc_base = eargc; eargv = eargv + eargv_size/2; eargc = 0; @@ -330,6 +329,26 @@ return argv[1]; } +static void +push_words(char* src) +{ + char sbuf[MAXPATHLEN]; + char* dst; + + dst = sbuf; + while ((*dst++ = *src++) != '\0') { + if (isspace((int)*src)) { + *dst = '\0'; + PUSH(strsave(sbuf)); + dst = sbuf; + do { + src++; + } while (isspace((int)*src)); + } + } + if (sbuf[0]) + PUSH(strsave(sbuf)); +} #ifdef __WIN32__ wchar_t *make_commandline(char **argv) { diff -Nru erlang-18.2-dfsg/erts/etc/common/erlexec.c erlang-17.3-dfsg/erts/etc/common/erlexec.c --- erlang-18.2-dfsg/erts/etc/common/erlexec.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/erlexec.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -73,7 +72,6 @@ 'R', /* driver_alloc */ 'S', /* sl_alloc */ 'T', /* temp_alloc */ - 'Z', /* test_alloc */ '\0' }; @@ -130,7 +128,6 @@ "bwt", "cl", "ct", - "ecio", "fwi", "tbt", "wct", @@ -145,7 +142,6 @@ static char *plush_val_switches[] = { "ms", "mbs", - "pds", "", NULL }; @@ -159,8 +155,6 @@ /* +z arguments with values */ static char *plusz_val_switches[] = { "dbbl", - "dntgc", - "ebwt", NULL }; @@ -719,7 +713,7 @@ * on itself here. We'll avoid doing that. */ if (strcmp(argv[i], "-make") == 0) { - add_args("-noshell", "-noinput", "-s", "make", "all_or_nothing", NULL); + add_args("-noshell", "-noinput", "-s", "make", "all", NULL); add_Eargs("-B"); haltAfterwards = 1; i = argc; /* Skip rest of command line */ @@ -812,7 +806,6 @@ case 'a': case 'A': case 'b': - case 'C': case 'e': case 'i': case 'n': @@ -886,19 +879,6 @@ } add_Eargs(argv[i]); break; - case 'c': - argv[i][0] = '-'; - if (argv[i][2] == '\0' && i+1 < argc) { - if (sys_strcmp(argv[i+1], "true") == 0 - || sys_strcmp(argv[i+1], "false") == 0) { - add_Eargs(argv[i]); - add_Eargs(argv[i+1]); - i++; - break; - } - } - add_Eargs(argv[i]); - break; case 'M': { int x; for (x = 0; plusM_au_allocs[x]; x++) @@ -1168,15 +1148,15 @@ #endif "] " "[-make] [-man [manopts] MANPAGE] [-x] [-emu_args] " - "[-args_file FILENAME] [+A THREADS] [+a SIZE] [+B[c|d|i]] [+c [BOOLEAN]] " - "[+C MODE] [+h HEAP_SIZE_OPTION] [+K BOOLEAN] " + "[-args_file FILENAME] [+A THREADS] [+a SIZE] [+B[c|d|i]] [+c] " + "[+h HEAP_SIZE_OPTION] [+K BOOLEAN] " "[+l] [+M ] [+P MAX_PROCS] [+Q MAX_PORTS] " "[+R COMPAT_REL] " "[+r] [+rg READER_GROUPS_LIMIT] [+s SCHEDULER_OPTION] " "[+S NO_SCHEDULERS:NO_SCHEDULERS_ONLINE] " "[+SP PERCENTAGE_SCHEDULERS:PERCENTAGE_SCHEDULERS_ONLINE] " "[+T LEVEL] [+V] [+v] " - "[+W] [+z MISC_OPTION] [args ...]\n"); + "[+W] [+z MISC_OPTION] [args ...]\n"); exit(1); } diff -Nru erlang-18.2-dfsg/erts/etc/common/escript.c erlang-17.3-dfsg/erts/etc/common/escript.c --- erlang-18.2-dfsg/erts/etc/common/escript.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/escript.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -74,6 +73,7 @@ static char* emalloc(size_t size); static void efree(void *p); static char* strsave(char* string); +static void push_words(char* src); static int run_erlang(char* name, char** argv); static char* get_default_emulator(char* progname); #ifdef __WIN32__ @@ -431,7 +431,7 @@ emulator = get_default_emulator(argv[0]); } - if (strlen(emulator) >= MAXPATHLEN) + if (strlen(emulator) >= PMAX) error("Value of environment variable ESCRIPT_EMULATOR is too large"); /* @@ -444,7 +444,7 @@ eargv_base = (char **) emalloc(eargv_size*sizeof(char*)); eargv = eargv_base; eargc = 0; - PUSH(strsave(emulator)); + push_words(emulator); eargc_base = eargc; eargv = eargv + eargv_size/2; eargc = 0; @@ -553,6 +553,26 @@ return run_erlang(eargv[0], eargv); } +static void +push_words(char* src) +{ + char sbuf[PMAX]; + char* dst; + + dst = sbuf; + while ((*dst++ = *src++) != '\0') { + if (isspace((int)*src)) { + *dst = '\0'; + PUSH(strsave(sbuf)); + dst = sbuf; + do { + src++; + } while (isspace((int)*src)); + } + } + if (sbuf[0]) + PUSH(strsave(sbuf)); +} #ifdef __WIN32__ wchar_t *make_commandline(char **argv) { diff -Nru erlang-18.2-dfsg/erts/etc/common/heart.c erlang-17.3-dfsg/erts/etc/common/heart.c --- erlang-18.2-dfsg/erts/etc/common/heart.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/heart.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -110,7 +109,7 @@ # include # include # include -# if defined(OS_MONOTONIC_TIME_USING_TIMES) +# if defined(CORRECT_USING_TIMES) # include # include # endif @@ -118,12 +117,11 @@ #define HEART_COMMAND_ENV "HEART_COMMAND" #define ERL_CRASH_DUMP_SECONDS_ENV "ERL_CRASH_DUMP_SECONDS" -#define HEART_KILL_SIGNAL "HEART_KILL_SIGNAL" -#define MSG_HDR_SIZE (2) -#define MSG_HDR_PLUS_OP_SIZE (3) -#define MSG_BODY_SIZE (2048) -#define MSG_TOTAL_SIZE (2050) +#define MSG_HDR_SIZE 2 +#define MSG_HDR_PLUS_OP_SIZE 3 +#define MSG_BODY_SIZE 2048 +#define MSG_TOTAL_SIZE 2050 unsigned char cmd[MSG_BODY_SIZE]; @@ -557,22 +555,14 @@ static void kill_old_erlang(void){ pid_t pid; - int i, res; - int sig = SIGKILL; - char *sigenv = NULL; - - sigenv = get_env(HEART_KILL_SIGNAL); - if (sigenv && strcmp(sigenv, "SIGABRT") == 0) { - print_error("kill signal SIGABRT requested"); - sig = SIGABRT; - } - + int i; + int res; if(heart_beat_kill_pid != 0){ pid = (pid_t) heart_beat_kill_pid; - res = kill(pid,sig); + res = kill(pid,SIGKILL); for(i=0; i < 5 && res == 0; ++i){ sleep(1); - res = kill(pid,sig); + res = kill(pid,SIGKILL); } if(errno != ESRCH){ print_error("Unable to kill old process, " @@ -718,12 +708,14 @@ print_error("Would reboot. Terminating."); else { kill_old_erlang(); + /* suppress gcc warning with 'if' */ ret = system(command); print_error("Executed \"%s\" -> %d. Terminating.",command, ret); } free_env_val(command); } else { kill_old_erlang(); + /* suppress gcc warning with 'if' */ ret = system((char*)&cmd[0]); print_error("Executed \"%s\" -> %d. Terminating.",cmd, ret); } @@ -1092,9 +1084,9 @@ return r; } -#elif defined(OS_MONOTONIC_TIME_USING_GETHRTIME) || defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) +#elif defined(HAVE_GETHRTIME) || defined(GETHRTIME_WITH_CLOCK_GETTIME) -#if defined(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME) +#if defined(GETHRTIME_WITH_CLOCK_GETTIME) typedef long long SysHrTime; SysHrTime sys_gethrtime(void); @@ -1103,7 +1095,7 @@ { struct timespec ts; long long result; - if (clock_gettime(MONOTONIC_CLOCK_ID,&ts) != 0) { + if (clock_gettime(CLOCK_MONOTONIC,&ts) != 0) { print_error("Fatal, could not get clock_monotonic value, terminating! " "errno = %d\n", errno); exit(1); @@ -1130,7 +1122,7 @@ return r; } -#elif defined(OS_MONOTONIC_TIME_USING_TIMES) +#elif defined(CORRECT_USING_TIMES) # ifdef NO_SYSCONF # include diff -Nru erlang-18.2-dfsg/erts/etc/common/inet_gethost.c erlang-17.3-dfsg/erts/etc/common/inet_gethost.c --- erlang-18.2-dfsg/erts/etc/common/inet_gethost.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/inet_gethost.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/common/Makefile erlang-17.3-dfsg/erts/etc/common/Makefile --- erlang-18.2-dfsg/erts/etc/common/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/common/Makefile.in erlang-17.3-dfsg/erts/etc/common/Makefile.in --- erlang-18.2-dfsg/erts/etc/common/Makefile.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/Makefile.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/common/run_erl_common.c erlang-17.3-dfsg/erts/etc/common/run_erl_common.c --- erlang-18.2-dfsg/erts/etc/common/run_erl_common.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/run_erl_common.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -33,18 +32,10 @@ #include #include -#ifdef __ANDROID__ -# include -#endif - #ifdef HAVE_SYSLOG_H # include #endif -#ifdef HAVE_SYS_IOCTL_H -# include -#endif - #ifdef __OSE__ # include "ramlog.h" #endif @@ -646,7 +637,7 @@ /* Extract any control sequences that are ment only for run_erl * and should not be forwarded to the pty. */ -int erts_run_erl_extract_ctrl_seq(char* buf, int len, int mfd) +int erts_run_erl_extract_ctrl_seq(char* buf, int len) { static const char prefix[] = "\033_"; static const char suffix[] = "\033\\"; @@ -671,7 +662,7 @@ struct winsize ws; ws.ws_col = col; ws.ws_row = row; - if (ioctl(mfd, TIOCSWINSZ, &ws) < 0) { + if (ioctl(MFD, TIOCSWINSZ, &ws) < 0) { ERRNO_ERR0(LOG_ERR,"Failed to set window size"); } #endif diff -Nru erlang-18.2-dfsg/erts/etc/common/run_erl_common.h erlang-17.3-dfsg/erts/etc/common/run_erl_common.h --- erlang-18.2-dfsg/erts/etc/common/run_erl_common.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/run_erl_common.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -41,7 +40,7 @@ int erts_run_erl_open_fifo(char *pipename,char *w_pipename,char *r_pipename); int erts_run_erl_log_alive_minutes(void); -int erts_run_erl_extract_ctrl_seq(char* buf, int len, int mfd); +int erts_run_erl_extract_ctrl_seq(char* buf, int len); /* File operations */ ssize_t sf_read(int fd, void *buffer, size_t len); diff -Nru erlang-18.2-dfsg/erts/etc/common/run_erl_vsn.h erlang-17.3-dfsg/erts/etc/common/run_erl_vsn.h --- erlang-18.2-dfsg/erts/etc/common/run_erl_vsn.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/run_erl_vsn.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/common/safe_string.c erlang-17.3-dfsg/erts/etc/common/safe_string.c --- erlang-18.2-dfsg/erts/etc/common/safe_string.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/safe_string.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/common/safe_string.h erlang-17.3-dfsg/erts/etc/common/safe_string.h --- erlang-18.2-dfsg/erts/etc/common/safe_string.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/safe_string.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/common/to_erl_common.c erlang-17.3-dfsg/erts/etc/common/to_erl_common.c --- erlang-18.2-dfsg/erts/etc/common/to_erl_common.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/to_erl_common.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/common/to_erl_common.h erlang-17.3-dfsg/erts/etc/common/to_erl_common.h --- erlang-18.2-dfsg/erts/etc/common/to_erl_common.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/to_erl_common.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/common/typer.c erlang-17.3-dfsg/erts/etc/common/typer.c --- erlang-18.2-dfsg/erts/etc/common/typer.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/common/typer.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -65,6 +64,7 @@ static void error(char* format, ...); static char* emalloc(size_t size); static char* strsave(char* string); +static void push_words(char* src); static int run_erlang(char* name, char** argv); static char* get_default_emulator(char* progname); #ifdef __WIN32__ @@ -128,9 +128,6 @@ emulator = get_default_emulator(argv[0]); - if (strlen(emulator) >= MAXPATHLEN) - error("Emulator path length is too large"); - /* * Allocate the argv vector to be used for arguments to Erlang. * Arrange for starting to pushing information in the middle of @@ -141,7 +138,7 @@ eargv_base = (char **) emalloc(eargv_size*sizeof(char*)); eargv = eargv_base; eargc = 0; - PUSH(strsave(emulator)); + push_words(emulator); eargc_base = eargc; eargv = eargv + eargv_size/2; eargc = 0; @@ -194,6 +191,26 @@ return run_erlang(eargv[0], eargv); } +static void +push_words(char* src) +{ + char sbuf[MAXPATHLEN]; + char* dst; + + dst = sbuf; + while ((*dst++ = *src++) != '\0') { + if (isspace((int)*src)) { + *dst = '\0'; + PUSH(strsave(sbuf)); + dst = sbuf; + do { + src++; + } while (isspace((int)*src)); + } + } + if (sbuf[0]) + PUSH(strsave(sbuf)); +} #ifdef __WIN32__ wchar_t *make_commandline(char **argv) { diff -Nru erlang-18.2-dfsg/erts/etc/Makefile erlang-17.3-dfsg/erts/etc/Makefile --- erlang-18.2-dfsg/erts/etc/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1999-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/ose/run_erl.c erlang-17.3-dfsg/erts/etc/ose/run_erl.c --- erlang-18.2-dfsg/erts/etc/ose/run_erl.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/ose/run_erl.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -496,7 +495,7 @@ #ifdef DEBUG erts_run_erl_log_status("Pty master write; "); #endif - len = erts_run_erl_extract_ctrl_seq(buffer,len, s->ofd); + len = erts_run_erl_extract_ctrl_seq(buffer,len); if (len > 0) { int wlen = erts_run_erl_write_all(s->ofd, buffer, len); @@ -616,7 +615,7 @@ returns */ PROCESS main_pid; hunt_in_block("run_erl","main",&main_pid); - sig = alloc(sizeof(*sig),ERTS_SIGNAL_RUN_ERL_DAEMON); + sig = alloc(sizeof(sig),ERTS_SIGNAL_RUN_ERL_DAEMON); send(&sig,main_pid); sig = receive(sigsel); pid = sender(&sig); diff -Nru erlang-18.2-dfsg/erts/etc/ose/run_erl.h erlang-17.3-dfsg/erts/etc/ose/run_erl.h --- erlang-18.2-dfsg/erts/etc/ose/run_erl.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/ose/run_erl.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/ose/run_erl_main.c erlang-17.3-dfsg/erts/etc/ose/run_erl_main.c --- erlang-18.2-dfsg/erts/etc/ose/run_erl_main.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/ose/run_erl_main.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/unix/cerl.src erlang-17.3-dfsg/erts/etc/unix/cerl.src --- erlang-18.2-dfsg/erts/etc/unix/cerl.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/cerl.src 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2003-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -44,7 +43,6 @@ # -gcov Run emulator compiled for gcov # -valgrind Run emulator compiled for valgrind # -lcnt Run emulator compiled for lock counting -# -icount Run emulator compiled for instruction counting # -nox Unset the DISPLAY variable to disable us of X Windows # # FIXME For GDB you can also set the break point using "-break FUNCTION". @@ -182,11 +180,6 @@ cargs="$cargs -frmptr" TYPE=.frmptr ;; - "-icount") - shift - cargs="$cargs -icount" - TYPE=.icount - ;; "-dump") shift GDB=dump @@ -382,9 +375,7 @@ # Set annotation level for gdb in emacs 22 and higher. Seems to # be working with level 1 for emacs 22 and level 3 for emacs 23... emacs_major=`$EMACS --version | head -1 | sed 's,^[^0-9]*\([0-9]*\).*,\1,g'` - if [ '!' -z "$emacs_major" -a $emacs_major -gt 23 ]; then - GDBARGS="-i=mi " - elif [ '!' -z "$emacs_major" -a $emacs_major -gt 22 ]; then + if [ '!' -z "$emacs_major" -a $emacs_major -gt 22 ]; then GDBARGS="--annotate=3 " elif [ '!' -z "$emacs_major" -a $emacs_major -gt 21 ]; then GDBARGS="--annotate=1 " diff -Nru erlang-18.2-dfsg/erts/etc/unix/dyn_erl.c erlang-17.3-dfsg/erts/etc/unix/dyn_erl.c --- erlang-18.2-dfsg/erts/etc/unix/dyn_erl.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/dyn_erl.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/unix/erl.src.src erlang-17.3-dfsg/erts/etc/unix/erl.src.src --- erlang-18.2-dfsg/erts/etc/unix/erl.src.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/erl.src.src 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1996-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/unix/etp_commands.erl erlang-17.3-dfsg/erts/etc/unix/etp_commands.erl --- erlang-18.2-dfsg/erts/etc/unix/etp_commands.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/etp_commands.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/etc/unix/etp-commands.in erlang-17.3-dfsg/erts/etc/unix/etp-commands.in --- erlang-18.2-dfsg/erts/etc/unix/etp-commands.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/etp-commands.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2005-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -147,10 +146,14 @@ etp-immediate-1 ($arg0) else # (($arg0) & 0x3) == 0 - if (($arg0) == etp_the_non_value) + if (($arg0) == 0x0) printf "" else - etp-cp-1 ($arg0) + if (($arg0) == 0x4) + printf "" + else + etp-cp-1 ($arg0) + end end end end @@ -352,32 +355,7 @@ etp-array-1 ((Eterm*)(($arg0)&~0x3)) ($arg1) ($arg1) \ 1 ((((Eterm*)(($arg0)&~0x3))[0]>>6)+1) '}' else - if (((Eterm*)(($arg0) & ~0x3))[0] & 0x3c) == 0x3c - # A map - if (((Eterm*)(($arg0) & ~0x3))[0] & 0xc0) == 0x0 - # Flat map - printf "#{Keys:" - etp-1 ((flatmap_t*)(($arg0)&~0x3))->keys (($arg1)+1) - printf " Values:{" - etp-array-1 ((Eterm*)(($arg0)&~0x3)+3) ($arg1) ($arg1) \ - 0 ((flatmap_t*)(($arg0)&~0x3))->size '}' - printf "}" - else - # Hashmap - printf "#<%x>{", (((((Eterm*)(($arg0)&~0x3))[0])>>(6+2+8))&0xffff) - if (((Eterm*)(($arg0) & ~0x3))[0] & 0xc0) >= 0x80 - # head bitmap/array - etp-bitmap-array-1 ((Eterm*)(($arg0)&~0x3)+2) ($arg1) ($arg1) \ - 0 (((((Eterm*)(($arg0)&~0x3))[0])>>(6+2+8))&0xffff) '}' - else - # node bitmap - etp-bitmap-array-1 ((Eterm*)(($arg0)&~0x3)+1) ($arg1) ($arg1) \ - 0 (((((Eterm*)(($arg0)&~0x3))[0])>>(6+2+8))&0xffff) '}' - end - end - else - etp-boxed-immediate-1 ($arg0) - end + etp-boxed-immediate-1 ($arg0) end end end @@ -500,36 +478,6 @@ end end -define etp-bitmap-array-1 -# Args: Eterm* p, int depth, int width, int pos, int bitmap, int end_char -# -# Reentrant -# -# Same as etp-array-1 with size = bitcount(bitmap) -# - if ($arg4) & 1 != 0 - if (($arg1) < $etp_max_depth) && (($arg2) < $etp_max_depth) - etp-1 (($arg0)[($arg3)]) (($arg1)+1) - if (($arg4) & (($arg4)-1)) != 0 - printf "," - end - etp-bitmap-array-1 ($arg0) ($arg1) (($arg2)+1) (($arg3)+1) (($arg4)>>1) ($arg5) - else - printf "...%c", ($arg5) - end - else - if ($arg4) == 0 - printf "%c", ($arg5) - else - etp-bitmap-array-1 $arg0 $arg1 $arg2 $arg3 (($arg4)>>1) $arg5 - - # WARNING: One might be tempted to optimize the bitcounting here - # by passing the bitmap argument as ($arg4 & ($arg4 - 1)). This is a very - # bad idea as arguments are passed as string substitution. - # The size of $arg4 would thus grow exponentially for each recursion. - end - end -end #define etpa-1 @@ -1117,8 +1065,8 @@ set $etp_cp_mid = $etp_cp_low + ($etp_cp_high-$etp_cp_low)/2 end if $etp_cp_p - # 13 = MI_FUNCTIONS - set $etp_cp_low = (Eterm**)($etp_cp_p->start + 13) + # 12 = MI_FUNCTIONS + set $etp_cp_low = (Eterm**)($etp_cp_p->start + 12) # 0 = MI_NUM_FUNCTIONS set $etp_cp_high = $etp_cp_low +$etp_cp_p->start[0] set $etp_cp_p = 0 @@ -1182,39 +1130,6 @@ %--------------------------------------------------------------------------- end -define etp-check-beam-ranges - set $etp_ci = 0 - while $etp_ci < 3 - printf "Checking code index %i...\n", $etp_ci - set $etp_j = 0 - while $etp_j < r[$etp_ci].n - set $etp_p = &r[$etp_ci].modules[$etp_j] - if $etp_j > 0 && $etp_p->start < (Range*)$etp_p[-1].end.counter - printf "r[%i].modules[%i]: ERROR start < previous\n", $etp_ci, $etp_j - end - if $etp_p->start > (Range*)$etp_p->end.counter - printf "r[%i].modules[%i]: ERROR start > end\n", $etp_ci, $etp_j - else - if $etp_p->start == (Range*)$etp_p->end.counter - printf "r[%i].modules[%i]: Purged\n", $etp_ci, $etp_j - end - end - set $etp_j = $etp_j + 1 - end - set $etp_ci = $etp_ci + 1 - end -end - -document etp-check-beam-ranges -%--------------------------------------------------------------------------- -% etp-check-beam-ranges -% -% Do consistency check of beam_ranges data structure -% and print errors and empty slots from purged modules. -%--------------------------------------------------------------------------- -end - - ############################################################################ # Commands for special term bunches. # @@ -2486,7 +2401,7 @@ printf "ERTS version: %s\n", etp_erts_version printf "Compile date: %s\n", etp_compile_date printf "Arch: %s\n", etp_arch - printf "Endianness: " + printf "Endianess: " if (etp_big_endian) printf "Big\n" else @@ -3566,13 +3481,11 @@ define etp-carrier-blocks set $etp_crr = (Carrier_t*) $arg0 set $etp_alc = (Allctr_t*)($etp_crr->allctr.counter & ~7) - set $etp_crr_end = ((char*)$etp_crr + ($etp_crr->chdr & ~7) - (sizeof(void*) & ~8)) set $etp_blk = (Block_t*) ((char*)$etp_crr + $etp_alc->mbc_header_size) set $etp_prev_blk = 0 set $etp_error_cnt = 0 set $etp_ablk_cnt = 0 set $etp_fblk_cnt = 0 - set $etp_aborted = 0 if $argc == 2 set $etp_be_silent = $arg1 @@ -3619,23 +3532,16 @@ end set $etp_prev_blk = $etp_blk set $etp_blk = (Block_t*) ((char*)$etp_blk + $etp_blk_sz) - if $etp_blk < (Block_t*) ((char*)$etp_prev_blk + $etp_alc->min_block_size) || $etp_blk >= $etp_crr_end - printf "ERROR: Invalid size of block at %#lx. ABORTING\n", $etp_prev_blk - set $etp_aborted = 1 - loop_break - end end - if !$etp_aborted - if ((char*)$etp_blk + $etp_blk_sz) != $etp_crr_end - printf "ERROR: Last block not at end of carrier\n" - set $etp_error_cnt = $etp_error_cnt + 1 - end - printf "Allocated blocks: %u\n", $etp_ablk_cnt - printf "Free blocks: %u\n", $etp_fblk_cnt + if ((char*)$etp_blk + $etp_blk_sz) != ((char*)$etp_crr + ($etp_crr->chdr & ~7)) + printf "ERROR: Last block not at end of carrier\n" + set $etp_error_cnt = $etp_error_cnt + 1 end + printf "Allocated blocks: %u\n", $etp_ablk_cnt + printf "Free blocks: %u\n", $etp_fblk_cnt if $etp_error_cnt - printf "%u ERRORs reported above\n", $etp_error_cnt + printf "%u ERRORs reported above\n", $etp-error-cnt end end @@ -3646,39 +3552,6 @@ %--------------------------------------------------------------------------- end -define etp-address-to-beam-opcode - set $etp_i = 0 - set $etp_min_diff = ((UWord)1 << (sizeof(UWord)*8 - 1)) - set $etp_min_opcode = -1 - set $etp_addr = (UWord) ($arg0) - - while $etp_i < num_instructions && $etp_min_diff > 0 - if ($etp_addr - (UWord)beam_ops[$etp_i]) < $etp_min_diff - set $etp_min_diff = $etp_addr - (UWord)beam_ops[$etp_i] - set $etp_min_opcode = $etp_i - end - set $etp_i = $etp_i + 1 - end - if $etp_min_diff == 0 - printf "Address %p is start of '%s'\n", $etp_addr, opc[$etp_min_opcode].name - else - if $etp_min_opcode >= 0 - printf "Address is %ld bytes into opcode '%s' at %p\n", $etp_min_diff, opc[$etp_min_opcode].name, beam_ops[$etp_min_opcode] - else - printf "Invalid opcode address\n" - end - end -end - -document etp-address-to-beam-opcode -%--------------------------------------------------------------------------- -% Get beam opcode from a native instruction address (within process_main()) -% Arg: Instructon pointer value -% -% Does not work with NO_JUMP_TABLE -%--------------------------------------------------------------------------- -end - ############################################################################ # Toolbox parameter handling diff -Nru erlang-18.2-dfsg/erts/etc/unix/etp_commands.mk erlang-17.3-dfsg/erts/etc/unix/etp_commands.mk --- erlang-18.2-dfsg/erts/etc/unix/etp_commands.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/etp_commands.mk 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2005-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/unix/etp-thr.py erlang-17.3-dfsg/erts/etc/unix/etp-thr.py --- erlang-18.2-dfsg/erts/etc/unix/etp-thr.py 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/etp-thr.py 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/unix/format_man_pages erlang-17.3-dfsg/erts/etc/unix/format_man_pages --- erlang-18.2-dfsg/erts/etc/unix/format_man_pages 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/format_man_pages 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 1996-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/unix/Install.src erlang-17.3-dfsg/erts/etc/unix/Install.src --- erlang-18.2-dfsg/erts/etc/unix/Install.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/Install.src 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1996-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/unix/Makefile erlang-17.3-dfsg/erts/etc/unix/Makefile --- erlang-18.2-dfsg/erts/etc/unix/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/unix/README erlang-17.3-dfsg/erts/etc/unix/README --- erlang-18.2-dfsg/erts/etc/unix/README 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/README 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ Copyright Ericsson AB 1996-2009. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/etc/unix/RELNOTES erlang-17.3-dfsg/erts/etc/unix/RELNOTES --- erlang-18.2-dfsg/erts/etc/unix/RELNOTES 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/RELNOTES 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ Copyright Ericsson AB 1996-2009. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/etc/unix/run_erl.c erlang-17.3-dfsg/erts/etc/unix/run_erl.c --- erlang-18.2-dfsg/erts/etc/unix/run_erl.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/run_erl.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -491,7 +490,7 @@ #ifdef DEBUG erts_run_erl_log_status("Pty master write; "); #endif - len = erts_run_erl_extract_ctrl_seq(buf, len, mfd); + len = erts_run_erl_extract_ctrl_seq(buf, len); if(len==1 && buf[0] == '\003') { kill(childpid,SIGINT); diff -Nru erlang-18.2-dfsg/erts/etc/unix/setuid_socket_wrap.c erlang-17.3-dfsg/erts/etc/unix/setuid_socket_wrap.c --- erlang-18.2-dfsg/erts/etc/unix/setuid_socket_wrap.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/setuid_socket_wrap.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/unix/start_erl.src erlang-17.3-dfsg/erts/etc/unix/start_erl.src --- erlang-18.2-dfsg/erts/etc/unix/start_erl.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/start_erl.src 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 1997-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/unix/start.src erlang-17.3-dfsg/erts/etc/unix/start.src --- erlang-18.2-dfsg/erts/etc/unix/start.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/start.src 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1996-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/unix/to_erl.c erlang-17.3-dfsg/erts/etc/unix/to_erl.c --- erlang-18.2-dfsg/erts/etc/unix/to_erl.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/unix/to_erl.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/beam.rc erlang-17.3-dfsg/erts/etc/win32/beam.rc --- erlang-18.2-dfsg/erts/etc/win32/beam.rc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/beam.rc 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ // // Copyright Ericsson AB 1997-2009. All Rights Reserved. // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// The contents of this file are subject to the Erlang Public License, +// Version 1.1, (the "License"); you may not use this file except in +// compliance with the License. You should have received a copy of the +// Erlang Public License along with this software. If not, it can be +// retrieved online at http://www.erlang.org/. +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +// the License for the specific language governing rights and limitations +// under the License. // // %CopyrightEnd% // diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/erl erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/erl --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/erl 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/erlc erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/erlc --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/erlc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/erlc 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/javac.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/javac.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/javac.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/javac.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/make_bootstrap_ini.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/make_bootstrap_ini.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/make_bootstrap_ini.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/make_bootstrap_ini.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2003-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/make_local_ini.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/make_local_ini.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/make_local_ini.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/make_local_ini.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2003-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/ar.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/ar.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/ar.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/ar.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2006-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/cc.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/cc.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/cc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/cc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2006-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/coffix.c erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/coffix.c --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/coffix.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/coffix.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/emu_cc.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/emu_cc.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/emu_cc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/emu_cc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2006-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/ld.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/ld.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/ld.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/ld.sh 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2006-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/mc.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/mc.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/mc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/mc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2006-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/rc.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/rc.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/mingw/rc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/mingw/rc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2006-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/ar.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/ar.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/ar.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/ar.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/cc.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/cc.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/cc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/cc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/cc_wrap.c erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/cc_wrap.c --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/cc_wrap.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/cc_wrap.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/coffix.c erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/coffix.c --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/coffix.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/coffix.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/emu_cc.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/emu_cc.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/emu_cc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/emu_cc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/ld.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/ld.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/ld.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/ld.sh 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2002-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/ld_wrap.c erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/ld_wrap.c --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/ld_wrap.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/ld_wrap.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/mc.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/mc.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/mc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/mc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2002-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/rc.sh erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/rc.sh --- erlang-18.2-dfsg/erts/etc/win32/cygwin_tools/vc/rc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/cygwin_tools/vc/rc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2002-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/erl.c erlang-17.3-dfsg/erts/etc/win32/erl.c --- erlang-18.2-dfsg/erts/etc/win32/erl.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erl.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -265,7 +264,7 @@ int len; - if (module == NULL) { + if (module = NULL) { error("Cannot GetModuleHandle()"); } diff -Nru erlang-18.2-dfsg/erts/etc/win32/erl_log.c erlang-17.3-dfsg/erts/etc/win32/erl_log.c --- erlang-18.2-dfsg/erts/etc/win32/erl_log.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erl_log.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/erl.rc erlang-17.3-dfsg/erts/etc/win32/erl.rc --- erlang-18.2-dfsg/erts/etc/win32/erl.rc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erl.rc 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ // // Copyright Ericsson AB 1998-2009. All Rights Reserved. // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// The contents of this file are subject to the Erlang Public License, +// Version 1.1, (the "License"); you may not use this file except in +// compliance with the License. You should have received a copy of the +// Erlang Public License along with this software. If not, it can be +// retrieved online at http://www.erlang.org/. +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +// the License for the specific language governing rights and limitations +// under the License. // // %CopyrightEnd% // diff -Nru erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_global.h erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_global.h --- erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_global.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_global.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_interactive.c erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_interactive.c --- erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_interactive.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_interactive.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_interactive.h erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_interactive.h --- erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_interactive.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_interactive.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_main.c erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_main.c --- erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_main.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_main.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_registry.c erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_registry.c --- erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_registry.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_registry.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_registry.h erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_registry.h --- erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_registry.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_registry.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_service.c erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_service.c --- erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_service.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_service.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_service.h erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_service.h --- erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_service.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_service.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_util.c erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_util.c --- erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_util.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_util.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_util.h erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_util.h --- erlang-18.2-dfsg/erts/etc/win32/erlsrv/erlsrv_util.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/erlsrv/erlsrv_util.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/init_file.c erlang-17.3-dfsg/erts/etc/win32/init_file.c --- erlang-18.2-dfsg/erts/etc/win32/init_file.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/init_file.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/init_file.h erlang-17.3-dfsg/erts/etc/win32/init_file.h --- erlang-18.2-dfsg/erts/etc/win32/init_file.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/init_file.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/Install.c erlang-17.3-dfsg/erts/etc/win32/Install.c --- erlang-18.2-dfsg/erts/etc/win32/Install.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/Install.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -81,7 +80,7 @@ } } if (root == NULL) { - if (module == NULL) { + if (module = NULL) { fprintf(stderr, "Cannot GetModuleHandle()\n"); exit(1); } diff -Nru erlang-18.2-dfsg/erts/etc/win32/Makefile erlang-17.3-dfsg/erts/etc/win32/Makefile --- erlang-18.2-dfsg/erts/etc/win32/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/erl erlang-17.3-dfsg/erts/etc/win32/msys_tools/erl --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/erl 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/erlc erlang-17.3-dfsg/erts/etc/win32/msys_tools/erlc --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/erlc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/erlc 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/javac.sh erlang-17.3-dfsg/erts/etc/win32/msys_tools/javac.sh --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/javac.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/javac.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/make_bootstrap_ini.sh erlang-17.3-dfsg/erts/etc/win32/msys_tools/make_bootstrap_ini.sh --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/make_bootstrap_ini.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/make_bootstrap_ini.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2003-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/make_local_ini.sh erlang-17.3-dfsg/erts/etc/win32/msys_tools/make_local_ini.sh --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/make_local_ini.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/make_local_ini.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2003-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/ar.sh erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/ar.sh --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/ar.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/ar.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/cc.sh erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/cc.sh --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/cc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/cc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -242,7 +241,7 @@ if [ $PREPROCESSING = true ]; then output_flag="-E" else - output_flag="-FS -c -Fo`cmd //C echo ${output_filename}`" + output_flag="-c -Fo`cmd //C echo ${output_filename}`" fi params="$COMMON_CFLAGS $MD $DEBUG_FLAGS $OPTIMIZE_FLAGS \ $CMD ${output_flag} $MPATH" @@ -250,8 +249,6 @@ echo cc.sh "$SAVE" >>$CC_SH_DEBUG_LOG echo cl.exe $params >>$CC_SH_DEBUG_LOG fi - # MSYS2 (currently) converts the paths wrong, avoid it - export MSYS2_ARG_CONV_EXCL=-FoC eval cl.exe $params >$MSG_FILE 2>$ERR_FILE RES=$? if test $PREPROCESSING = false; then @@ -276,7 +273,6 @@ fi rm -f $ERR_FILE $MSG_FILE if [ $RES != 0 ]; then - echo Failed: cl.exe $params rm -rf $TMPOBJDIR exit $RES fi @@ -315,10 +311,7 @@ stdlib="-lLIBMTD";; esac # And finally call the next script to do the linking... - params="$out_spec $LINKCMD $stdlib" - if [ "X$CC_SH_DEBUG_LOG" != "X" ]; then - echo ld.sh $ACCUM_OBJECTS $params - fi + params="$out_spec $LINKCMD $stdlib" eval ld.sh $ACCUM_OBJECTS $params RES=$? fi diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/coffix.c erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/coffix.c --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/coffix.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/coffix.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/emu_cc.sh erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/emu_cc.sh --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/emu_cc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/emu_cc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2002-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -29,7 +28,6 @@ WTOOLDIR=`cmd //C echo $WTOOLDIR0` # Do primitive 'make' newer_exe=`find $TOOLDIR -newer $COFFIX.c -name coffix.exe -print` -export MSYS2_ARG_CONV_EXCL="-FeC" if [ -z $newer_exe ]; then echo recompiling $COFFIX.exe cl.exe -Fe${WTOOLDIR}/coffix.exe ${WTOOLDIR}/coffix.c diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/ld.sh erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/ld.sh --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/ld.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/ld.sh 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2002-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/mc.sh erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/mc.sh --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/mc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/mc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2002-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -80,14 +79,9 @@ exit $RES fi fi -# MSYS2 (currently) converts the paths wrong, avoid it -export MSYS2_ARG_CONV_EXCL= eval $MCC "$CMD" >/tmp/mc.exe.${p}.1 2>/tmp/mc.exe.${p}.2 RES=$? -if [ $RES != 0 ]; then - echo Failed: $MCC "$CMD" -fi -tail -n +2 /tmp/mc.exe.${p}.2 >&2 +tail +2 /tmp/mc.exe.${p}.2 >&2 cat /tmp/mc.exe.${p}.1 rm -f /tmp/mc.exe.${p}.2 /tmp/mc.exe.${p}.1 exit $RES diff -Nru erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/rc.sh erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/rc.sh --- erlang-18.2-dfsg/erts/etc/win32/msys_tools/vc/rc.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/msys_tools/vc/rc.sh 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2002-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -79,14 +78,9 @@ echo rc.sh "$SAVE" >>$RC_SH_DEBUG_LOG echo rc.exe $CMD >>$RC_SH_DEBUG_LOG fi -# MSYS2 (currently) converts the paths wrong, avoid it -export MSYS2_ARG_CONV_EXCL=-Fo eval $RCC "$CMD" >/tmp/rc.exe.${p}.1 2>/tmp/rc.exe.${p}.2 RES=$? -if [ $RES != 0 ]; then - echo Failed: $RCC "$CMD" -fi -tail -n +2 /tmp/rc.exe.${p}.2 >&2 +tail +2 /tmp/rc.exe.${p}.2 >&2 cat /tmp/rc.exe.${p}.1 rm -f /tmp/rc.exe.${p}.2 /tmp/rc.exe.${p}.1 exit $RES diff -Nru erlang-18.2-dfsg/erts/etc/win32/Nmakefile.start_erl erlang-17.3-dfsg/erts/etc/win32/Nmakefile.start_erl --- erlang-18.2-dfsg/erts/etc/win32/Nmakefile.start_erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/Nmakefile.start_erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1998-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/nsis/dll_version_helper.sh erlang-17.3-dfsg/erts/etc/win32/nsis/dll_version_helper.sh --- erlang-18.2-dfsg/erts/etc/win32/nsis/dll_version_helper.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/nsis/dll_version_helper.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2007-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/etc/win32/nsis/erlang20.nsi erlang-17.3-dfsg/erts/etc/win32/nsis/erlang20.nsi --- erlang-18.2-dfsg/erts/etc/win32/nsis/erlang20.nsi 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/nsis/erlang20.nsi 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ ; ; Copyright Ericsson AB 2012. All Rights Reserved. ; -; Licensed under the Apache License, Version 2.0 (the "License"); -; you may not use this file except in compliance with the License. -; You may obtain a copy of the License at -; -; http://www.apache.org/licenses/LICENSE-2.0 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. +; The contents of this file are subject to the Erlang Public License, +; Version 1.1, (the "License"); you may not use this file except in +; compliance with the License. You should have received a copy of the +; Erlang Public License along with this software. If not, it can be +; retrieved online at http://www.erlang.org/. +; +; Software distributed under the License is distributed on an "AS IS" +; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +; the License for the specific language governing rights and limitations +; under the License. ; ; %CopyrightEnd% ; diff -Nru erlang-18.2-dfsg/erts/etc/win32/nsis/find_redist.sh erlang-17.3-dfsg/erts/etc/win32/nsis/find_redist.sh --- erlang-18.2-dfsg/erts/etc/win32/nsis/find_redist.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/nsis/find_redist.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2007-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -164,7 +163,7 @@ #echo $BPATH_LIST for BP in $BPATH_LIST; do - for verdir in "sdk v2.0" "sdk v3.5" "v6.0A" "v7.0" "v7.0A" "v7.1" "VC redist 1033"; do + for verdir in "sdk v2.0" "sdk v3.5" "v6.0A" "v7.0" "v7.0A" "v7.1"; do BPATH=$BP fail=false allow_fail=false diff -Nru erlang-18.2-dfsg/erts/etc/win32/nsis/Makefile erlang-17.3-dfsg/erts/etc/win32/nsis/Makefile --- erlang-18.2-dfsg/erts/etc/win32/nsis/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/nsis/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2003-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -42,13 +41,7 @@ TARGET_DIR = $(RELEASE_PATH) -ifdef MSYSTEM - ifeq ($(MSYSTEM),$(filter $(MSYSTEM),MSYS MINGW32 MINGW64)) - USEMSYS := true - endif -endif - -ifeq ($(USEMSYS),true) +ifeq ($(MSYSTEM),MINGW32) MAKENSISFLAGS = //V2 WTESTROOT=$(shell (msys2win_path.sh "$(RELEASE_PATH)")) @@ -69,7 +62,7 @@ endif REDIST_FILE=$(shell (sh ./find_redist.sh || echo "")) -ifeq ($(USEMSYS),true) +ifeq ($(MSYSTEM),MINGW32) NICEREDISTFILE=$(shell (msys2win_path.sh -m "$(REDIST_FILE)" 2>/dev/null || echo "")) else NICEREDISTFILE=$(shell (cygpath -d -m "$(REDIST_FILE)" 2>/dev/null || echo "")) diff -Nru erlang-18.2-dfsg/erts/etc/win32/port_entry.c erlang-17.3-dfsg/erts/etc/win32/port_entry.c --- erlang-18.2-dfsg/erts/etc/win32/port_entry.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/port_entry.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/resource.h erlang-17.3-dfsg/erts/etc/win32/resource.h --- erlang-18.2-dfsg/erts/etc/win32/resource.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/resource.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/start_erl.c erlang-17.3-dfsg/erts/etc/win32/start_erl.c --- erlang-18.2-dfsg/erts/etc/win32/start_erl.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/start_erl.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/etc/win32/win_erlexec.c erlang-17.3-dfsg/erts/etc/win32/win_erlexec.c --- erlang-18.2-dfsg/erts/etc/win32/win_erlexec.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/etc/win32/win_erlexec.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/example/Makefile erlang-17.3-dfsg/erts/example/Makefile --- erlang-18.2-dfsg/erts/example/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2006-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -31,7 +30,7 @@ CXXFLAGS += $(OUR_C_FLAGS) TARGETS = pg_sync.beam pg_async.beam pg_sync.so pg_async.so \ -next_perm.so next_perm.beam time_compat.beam +next_perm.so next_perm.beam all: $(TARGETS) diff -Nru erlang-18.2-dfsg/erts/example/matrix_nif.c erlang-17.3-dfsg/erts/example/matrix_nif.c --- erlang-18.2-dfsg/erts/example/matrix_nif.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/matrix_nif.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/example/matrix_nif.erl erlang-17.3-dfsg/erts/example/matrix_nif.erl --- erlang-18.2-dfsg/erts/example/matrix_nif.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/matrix_nif.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/example/next_perm.cc erlang-17.3-dfsg/erts/example/next_perm.cc --- erlang-18.2-dfsg/erts/example/next_perm.cc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/next_perm.cc 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/example/next_perm.erl erlang-17.3-dfsg/erts/example/next_perm.erl --- erlang-18.2-dfsg/erts/example/next_perm.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/next_perm.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/example/pg_async2.c erlang-17.3-dfsg/erts/example/pg_async2.c --- erlang-18.2-dfsg/erts/example/pg_async2.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/pg_async2.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/example/pg_async2.erl erlang-17.3-dfsg/erts/example/pg_async2.erl --- erlang-18.2-dfsg/erts/example/pg_async2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/pg_async2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/example/pg_async.c erlang-17.3-dfsg/erts/example/pg_async.c --- erlang-18.2-dfsg/erts/example/pg_async.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/pg_async.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/example/pg_async.erl erlang-17.3-dfsg/erts/example/pg_async.erl --- erlang-18.2-dfsg/erts/example/pg_async.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/pg_async.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/example/pg_encode2.c erlang-17.3-dfsg/erts/example/pg_encode2.c --- erlang-18.2-dfsg/erts/example/pg_encode2.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/pg_encode2.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/example/pg_encode2.h erlang-17.3-dfsg/erts/example/pg_encode2.h --- erlang-18.2-dfsg/erts/example/pg_encode2.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/pg_encode2.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/example/pg_encode.c erlang-17.3-dfsg/erts/example/pg_encode.c --- erlang-18.2-dfsg/erts/example/pg_encode.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/pg_encode.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/example/pg_encode.h erlang-17.3-dfsg/erts/example/pg_encode.h --- erlang-18.2-dfsg/erts/example/pg_encode.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/pg_encode.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/example/pg_sync.c erlang-17.3-dfsg/erts/example/pg_sync.c --- erlang-18.2-dfsg/erts/example/pg_sync.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/pg_sync.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/example/pg_sync.erl erlang-17.3-dfsg/erts/example/pg_sync.erl --- erlang-18.2-dfsg/erts/example/pg_sync.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/pg_sync.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/example/time_compat.erl erlang-17.3-dfsg/erts/example/time_compat.erl --- erlang-18.2-dfsg/erts/example/time_compat.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/example/time_compat.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,305 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2014-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% -%% If your code need to be able to execute on ERTS versions both -%% earlier and later than 7.0, the best approach is to use the new -%% time API introduced in ERTS 7.0 and implement a fallback -%% solution using the old primitives to be used on old ERTS -%% versions. This way your code can automatically take advantage -%% of the improvements in the API when available. This is an -%% example of how to implement such an API, but it can be used -%% as is if you want to. Just add (a preferrably renamed version of) -%% this module to your project, and call the API via this module -%% instead of calling the BIFs directly. -%% - --module(time_compat). - -%% We don't want warnings about the use of erlang:now/0 in -%% this module. --compile(nowarn_deprecated_function). -%% -%% We don't use -%% -compile({nowarn_deprecated_function, [{erlang, now, 0}]}). -%% since this will produce warnings when compiled on systems -%% where it has not yet been deprecated. -%% - --export([monotonic_time/0, - monotonic_time/1, - erlang_system_time/0, - erlang_system_time/1, - os_system_time/0, - os_system_time/1, - time_offset/0, - time_offset/1, - convert_time_unit/3, - timestamp/0, - unique_integer/0, - unique_integer/1, - monitor/2, - system_info/1, - system_flag/2]). - -monotonic_time() -> - try - erlang:monotonic_time() - catch - error:undef -> - %% Use Erlang system time as monotonic time - erlang_system_time_fallback() - end. - -monotonic_time(Unit) -> - try - erlang:monotonic_time(Unit) - catch - error:badarg -> - erlang:error(badarg, [Unit]); - error:undef -> - %% Use Erlang system time as monotonic time - STime = erlang_system_time_fallback(), - try - convert_time_unit_fallback(STime, native, Unit) - catch - error:bad_time_unit -> erlang:error(badarg, [Unit]) - end - end. - -erlang_system_time() -> - try - erlang:system_time() - catch - error:undef -> - erlang_system_time_fallback() - end. - -erlang_system_time(Unit) -> - try - erlang:system_time(Unit) - catch - error:badarg -> - erlang:error(badarg, [Unit]); - error:undef -> - STime = erlang_system_time_fallback(), - try - convert_time_unit_fallback(STime, native, Unit) - catch - error:bad_time_unit -> erlang:error(badarg, [Unit]) - end - end. - -os_system_time() -> - try - os:system_time() - catch - error:undef -> - os_system_time_fallback() - end. - -os_system_time(Unit) -> - try - os:system_time(Unit) - catch - error:badarg -> - erlang:error(badarg, [Unit]); - error:undef -> - STime = os_system_time_fallback(), - try - convert_time_unit_fallback(STime, native, Unit) - catch - error:bad_time_unit -> erlang:error(badarg, [Unit]) - end - end. - -time_offset() -> - try - erlang:time_offset() - catch - error:undef -> - %% Erlang system time and Erlang monotonic - %% time are always aligned - 0 - end. - -time_offset(Unit) -> - try - erlang:time_offset(Unit) - catch - error:badarg -> - erlang:error(badarg, [Unit]); - error:undef -> - try - _ = integer_time_unit(Unit) - catch - error:bad_time_unit -> erlang:error(badarg, [Unit]) - end, - %% Erlang system time and Erlang monotonic - %% time are always aligned - 0 - end. - -convert_time_unit(Time, FromUnit, ToUnit) -> - try - erlang:convert_time_unit(Time, FromUnit, ToUnit) - catch - error:undef -> - try - convert_time_unit_fallback(Time, FromUnit, ToUnit) - catch - _:_ -> - erlang:error(badarg, [Time, FromUnit, ToUnit]) - end; - error:Error -> - erlang:error(Error, [Time, FromUnit, ToUnit]) - end. - -timestamp() -> - try - erlang:timestamp() - catch - error:undef -> - erlang:now() - end. - -unique_integer() -> - try - erlang:unique_integer() - catch - error:undef -> - {MS, S, US} = erlang:now(), - (MS*1000000+S)*1000000+US - end. - -unique_integer(Modifiers) -> - try - erlang:unique_integer(Modifiers) - catch - error:badarg -> - erlang:error(badarg, [Modifiers]); - error:undef -> - case is_valid_modifier_list(Modifiers) of - true -> - %% now() converted to an integer - %% fullfill the requirements of - %% all modifiers: unique, positive, - %% and monotonic... - {MS, S, US} = erlang:now(), - (MS*1000000+S)*1000000+US; - false -> - erlang:error(badarg, [Modifiers]) - end - end. - -monitor(Type, Item) -> - try - erlang:monitor(Type, Item) - catch - error:Error -> - case {Error, Type, Item} of - {badarg, time_offset, clock_service} -> - %% Time offset is final and will never change. - %% Return a dummy reference, there will never - %% be any need for 'CHANGE' messages... - make_ref(); - _ -> - erlang:error(Error, [Type, Item]) - end - end. - -system_info(Item) -> - try - erlang:system_info(Item) - catch - error:badarg -> - case Item of - time_correction -> - case erlang:system_info(tolerant_timeofday) of - enabled -> true; - disabled -> false - end; - time_warp_mode -> - no_time_warp; - time_offset -> - final; - NotSupArg when NotSupArg == os_monotonic_time_source; - NotSupArg == os_system_time_source; - NotSupArg == start_time; - NotSupArg == end_time -> - %% Cannot emulate this... - erlang:error(notsup, [NotSupArg]); - _ -> - erlang:error(badarg, [Item]) - end; - error:Error -> - erlang:error(Error, [Item]) - end. - -system_flag(Flag, Value) -> - try - erlang:system_flag(Flag, Value) - catch - error:Error -> - case {Error, Flag, Value} of - {badarg, time_offset, finalize} -> - %% Time offset is final - final; - _ -> - erlang:error(Error, [Flag, Value]) - end - end. - -%% -%% Internal functions -%% - -integer_time_unit(native) -> 1000*1000; -integer_time_unit(nano_seconds) -> 1000*1000*1000; -integer_time_unit(micro_seconds) -> 1000*1000; -integer_time_unit(milli_seconds) -> 1000; -integer_time_unit(seconds) -> 1; -integer_time_unit(I) when is_integer(I), I > 0 -> I; -integer_time_unit(BadRes) -> erlang:error(bad_time_unit, [BadRes]). - -erlang_system_time_fallback() -> - {MS, S, US} = erlang:now(), - (MS*1000000+S)*1000000+US. - -os_system_time_fallback() -> - {MS, S, US} = os:timestamp(), - (MS*1000000+S)*1000000+US. - -convert_time_unit_fallback(Time, FromUnit, ToUnit) -> - FU = integer_time_unit(FromUnit), - TU = integer_time_unit(ToUnit), - case Time < 0 of - true -> TU*Time - (FU - 1); - false -> TU*Time - end div FU. - -is_valid_modifier_list([positive|Ms]) -> - is_valid_modifier_list(Ms); -is_valid_modifier_list([monotonic|Ms]) -> - is_valid_modifier_list(Ms); -is_valid_modifier_list([]) -> - true; -is_valid_modifier_list(_) -> - false. diff -Nru erlang-18.2-dfsg/erts/include/erl_fixed_size_int_types.h erlang-17.3-dfsg/erts/include/erl_fixed_size_int_types.h --- erlang-18.2-dfsg/erts/include/erl_fixed_size_int_types.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/erl_fixed_size_int_types.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/erl_int_sizes_config.h.in erlang-17.3-dfsg/erts/include/erl_int_sizes_config.h.in --- erlang-18.2-dfsg/erts/include/erl_int_sizes_config.h.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/erl_int_sizes_config.h.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/erl_memory_trace_parser.h erlang-17.3-dfsg/erts/include/erl_memory_trace_parser.h --- erlang-18.2-dfsg/erts/include/erl_memory_trace_parser.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/erl_memory_trace_parser.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/erl_native_features_config.h.in erlang-17.3-dfsg/erts/include/erl_native_features_config.h.in --- erlang-18.2-dfsg/erts/include/erl_native_features_config.h.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/erl_native_features_config.h.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/erl_errno.h erlang-17.3-dfsg/erts/include/internal/erl_errno.h --- erlang-18.2-dfsg/erts/include/internal/erl_errno.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/erl_errno.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/erl_memory_trace_protocol.h erlang-17.3-dfsg/erts/include/internal/erl_memory_trace_protocol.h --- erlang-18.2-dfsg/erts/include/internal/erl_memory_trace_protocol.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/erl_memory_trace_protocol.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/erl_misc_utils.h erlang-17.3-dfsg/erts/include/internal/erl_misc_utils.h --- erlang-18.2-dfsg/erts/include/internal/erl_misc_utils.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/erl_misc_utils.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/erl_printf_format.h erlang-17.3-dfsg/erts/include/internal/erl_printf_format.h --- erlang-18.2-dfsg/erts/include/internal/erl_printf_format.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/erl_printf_format.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/erl_printf.h erlang-17.3-dfsg/erts/include/internal/erl_printf.h --- erlang-18.2-dfsg/erts/include/internal/erl_printf.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/erl_printf.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/erts_internal.mk.in erlang-17.3-dfsg/erts/include/internal/erts_internal.mk.in --- erlang-18.2-dfsg/erts/include/internal/erts_internal.mk.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/erts_internal.mk.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/include/internal/ethr_atomics.h erlang-17.3-dfsg/erts/include/internal/ethr_atomics.h --- erlang-18.2-dfsg/erts/include/internal/ethr_atomics.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ethr_atomics.h 2014-09-16 19:10:57.000000000 +0000 @@ -12,17 +12,16 @@ * * Copyright Ericsson AB 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/ethread.h erlang-17.3-dfsg/erts/include/internal/ethread.h --- erlang-18.2-dfsg/erts/include/internal/ethread.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ethread.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2004-2015. All Rights Reserved. + * Copyright Ericsson AB 2004-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -54,8 +53,7 @@ #endif #if defined(ETHR_DEBUG) || !defined(ETHR_INLINE) || ETHR_XCHK \ - || (defined(__GNUC__) && defined(ERTS_MIXED_CYGWIN_VC)) \ - || (defined(__GNUC__) && defined(ERTS_MIXED_MSYS_VC)) + || (defined(__GNUC__) && defined(ERTS_MIXED_CYGWIN_VC)) # undef ETHR_INLINE # define ETHR_INLINE # undef ETHR_FORCE_INLINE @@ -216,6 +214,8 @@ /* Out own RW mutexes are probably faster, but use OSEs mutexes */ #define ETHR_USE_OWN_RWMTX_IMPL__ +#define ETHR_HAVE_THREAD_NAMES + #else /* No supported thread lib found */ #ifdef ETHR_NO_SUPP_THR_LIB_NOT_FATAL @@ -364,11 +364,8 @@ # include "sparc64/ethread.h" # endif # endif -# if ETHR_HAVE_GCC___ATOMIC_BUILTINS -# include "gcc/ethread.h" -# endif -# include "libatomic_ops/ethread.h" # include "gcc/ethread.h" +# include "libatomic_ops/ethread.h" # endif # elif defined(ETHR_HAVE_LIBATOMIC_OPS) # include "libatomic_ops/ethread.h" @@ -504,18 +501,21 @@ typedef struct { int detached; /* boolean (default false) */ int suggested_stack_size; /* kilo words (default sys dependent) */ - char *name; /* max 14 char long (default no-name) */ #ifdef ETHR_OSE_THREADS + char *name; U32 coreNo; #endif } ethr_thr_opts; #if defined(ETHR_OSE_THREADS) -#define ETHR_THR_OPTS_DEFAULT_INITER {0, -1, NULL, 0} +/* Default ethr name is big as we want to be able to sprint stuff in there */ +#define ETHR_THR_OPTS_DEFAULT_INITER \ + {0, -1, "ethread", 0} #else -#define ETHR_THR_OPTS_DEFAULT_INITER {0, -1, NULL} +#define ETHR_THR_OPTS_DEFAULT_INITER {0, -1} #endif + #if !defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_AUX_IMPL__) # define ETHR_NEED_SPINLOCK_PROTOTYPES__ # define ETHR_NEED_RWSPINLOCK_PROTOTYPES__ @@ -529,8 +529,6 @@ int ethr_thr_detach(ethr_tid); void ethr_thr_exit(void *); ethr_tid ethr_self(void); -int ethr_getname(ethr_tid, char *, size_t); -void ethr_setname(char *); int ethr_equal_tids(ethr_tid, ethr_tid); int ethr_tsd_key_create(ethr_tsd_key *,char *); @@ -542,7 +540,6 @@ #include int ethr_sigmask(int how, const sigset_t *set, sigset_t *oset); int ethr_sigwait(const sigset_t *set, int *sig); -int ethr_kill(const ethr_tid tid, const int sig); #endif void ethr_compiler_barrier(void); diff -Nru erlang-18.2-dfsg/erts/include/internal/ethread_header_config.h.in erlang-17.3-dfsg/erts/include/internal/ethread_header_config.h.in --- erlang-18.2-dfsg/erts/include/internal/ethread_header_config.h.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ethread_header_config.h.in 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2004-2015. All Rights Reserved. + * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -85,62 +84,32 @@ /* Define if run in Sparc RMO, PSO, or TSO mode */ #undef ETHR_SPARC_RMO -/* Define as a boolean indicating whether you have a gcc compatible compiler - capable of generating the ARM DMB instruction, and are compiling for an ARM - processor with ARM DMB instruction support, or not */ -#undef ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION - -/* Define as a bitmask corresponding to the word sizes that - __sync_synchronize() can handle on your system */ -#undef ETHR_HAVE___sync_synchronize - -/* Define as a bitmask corresponding to the word sizes that - __sync_add_and_fetch() can handle on your system */ -#undef ETHR_HAVE___sync_add_and_fetch - -/* Define as a bitmask corresponding to the word sizes that - __sync_fetch_and_and() can handle on your system */ -#undef ETHR_HAVE___sync_fetch_and_and - -/* Define as a bitmask corresponding to the word sizes that - __sync_fetch_and_or() can handle on your system */ -#undef ETHR_HAVE___sync_fetch_and_or - -/* Define as a bitmask corresponding to the word sizes that - __sync_val_compare_and_swap() can handle on your system */ -#undef ETHR_HAVE___sync_val_compare_and_swap - -/* Define as a boolean indicating whether you have a gcc __atomic builtins or - not */ -#undef ETHR_HAVE_GCC___ATOMIC_BUILTINS - -/* Define as a boolean indicating whether you trust gcc's __atomic_* builtins - memory barrier implementations, or not */ -#undef ETHR_TRUST_GCC_ATOMIC_BUILTINS_MEMORY_BARRIERS - -/* Define as a bitmask corresponding to the word sizes that __atomic_store_n() - can handle on your system */ -#undef ETHR_HAVE___atomic_store_n - -/* Define as a bitmask corresponding to the word sizes that __atomic_load_n() - can handle on your system */ -#undef ETHR_HAVE___atomic_load_n - -/* Define as a bitmask corresponding to the word sizes that - __atomic_add_fetch() can handle on your system */ -#undef ETHR_HAVE___atomic_add_fetch - -/* Define as a bitmask corresponding to the word sizes that - __atomic_fetch_and() can handle on your system */ -#undef ETHR_HAVE___atomic_fetch_and - -/* Define as a bitmask corresponding to the word sizes that - __atomic_fetch_or() can handle on your system */ -#undef ETHR_HAVE___atomic_fetch_or - -/* Define as a bitmask corresponding to the word sizes that - __atomic_compare_exchange_n() can handle on your system */ -#undef ETHR_HAVE___atomic_compare_exchange_n +/* Define if you have __sync_add_and_fetch() for 32-bit integers */ +#undef ETHR_HAVE___SYNC_ADD_AND_FETCH32 + +/* Define if you have __sync_add_and_fetch() for 64-bit integers */ +#undef ETHR_HAVE___SYNC_ADD_AND_FETCH64 + +/* Define if you have __sync_fetch_and_and() for 32-bit integers */ +#undef ETHR_HAVE___SYNC_FETCH_AND_AND32 + +/* Define if you have __sync_fetch_and_and() for 64-bit integers */ +#undef ETHR_HAVE___SYNC_FETCH_AND_AND64 + +/* Define if you have __sync_fetch_and_or() for 32-bit integers */ +#undef ETHR_HAVE___SYNC_FETCH_AND_OR32 + +/* Define if you have __sync_fetch_and_or() for 64-bit integers */ +#undef ETHR_HAVE___SYNC_FETCH_AND_OR64 + +/* Define if you have __sync_val_compare_and_swap() for 32-bit integers */ +#undef ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32 + +/* Define if you have __sync_val_compare_and_swap() for 64-bit integers */ +#undef ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64 + +/* Define if you have __sync_val_compare_and_swap() for 128-bit integers */ +#undef ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP128 /* Define if you prefer gcc native ethread implementations */ #undef ETHR_PREFER_GCC_NATIVE_IMPLS @@ -268,18 +237,3 @@ /* Assumed cache-line size (in bytes) */ #undef ASSUMED_CACHE_LINE_SIZE - -/* Define if you have a clock_gettime() with a monotonic clock */ -#undef ETHR_HAVE_CLOCK_GETTIME_MONOTONIC - -/* Define if you have a monotonic gethrtime() */ -#undef ETHR_HAVE_GETHRTIME - -/* Define if you have a mach clock_get_time() with a monotonic clock */ -#undef ETHR_HAVE_MACH_CLOCK_GET_TIME - -/* Define to the monotonic clock id to use */ -#undef ETHR_MONOTONIC_CLOCK_ID - -/* Define if pthread_cond_timedwait() can be used with a monotonic clock */ -#undef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC diff -Nru erlang-18.2-dfsg/erts/include/internal/ethread_inline.h erlang-17.3-dfsg/erts/include/internal/ethread_inline.h --- erlang-18.2-dfsg/erts/include/internal/ethread_inline.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ethread_inline.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -21,29 +20,6 @@ #ifndef ETHREAD_INLINE_H__ #define ETHREAD_INLINE_H__ -#define ETHR_GCC_COMPILER_FALSE 0 /* Not a gcc compatible compiler */ -#define ETHR_GCC_COMPILER_TRUE 1 /* The GNU gcc compiler */ -/* Negative integers for gcc compatible compilers */ -#define ETHR_GCC_COMPILER_CLANG -1 /* The Clang gcc compatible compiler */ -#define ETHR_GCC_COMPILER_ICC -2 /* The Intel gcc compatible compiler */ -/* Line them up... */ - -/* - * Unfortunately there is no easy and certain way of - * detecting a true gcc compiler, since the compatible - * ones all define the same defines as the true gnu-gcc... - */ -#if !defined(__GNUC__) && !defined(__GNUG__) -# define ETHR_GCC_COMPILER ETHR_GCC_COMPILER_FALSE -#elif defined(__clang__) -# define ETHR_GCC_COMPILER ETHR_GCC_COMPILER_CLANG -#elif defined(__ICC) || defined(__INTEL_COMPILER) -# define ETHR_GCC_COMPILER ETHR_GCC_COMPILER_ICC -#else -/* Seems to be the true gnu-gcc... */ -# define ETHR_GCC_COMPILER ETHR_GCC_COMPILER_TRUE -#endif - #if !defined(__GNUC__) # define ETHR_AT_LEAST_GCC_VSN__(MAJ, MIN, PL) 0 #elif !defined(__GNUC_MINOR__) diff -Nru erlang-18.2-dfsg/erts/include/internal/ethread.mk.in erlang-17.3-dfsg/erts/include/internal/ethread.mk.in --- erlang-18.2-dfsg/erts/include/internal/ethread.mk.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ethread.mk.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/include/internal/ethr_internal.h erlang-17.3-dfsg/erts/include/internal/ethr_internal.h --- erlang-18.2-dfsg/erts/include/internal/ethr_internal.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ethr_internal.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -58,33 +57,6 @@ int ethr_win_get_errno__(void); #endif -#ifdef ETHR_INCLUDE_MONOTONIC_CLOCK__ -#undef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME -#if defined(ETHR_HAVE_CLOCK_GETTIME_MONOTONIC) \ - || defined(ETHR_HAVE_MACH_CLOCK_GET_TIME) \ - || defined(ETHR_HAVE_GETHRTIME) -#ifdef ETHR_TIME_WITH_SYS_TIME -# include -# include -#else -# ifdef ETHR_HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif -#ifdef ETHR_HAVE_MACH_CLOCK_GET_TIME -#include -#include -#endif -#define ETHR_HAVE_ETHR_GET_MONOTONIC_TIME -ethr_sint64_t ethr_get_monotonic_time(void); -int ethr_get_monotonic_time_is_broken(void); -#endif -#endif /* ETHR_INCLUDE_MONOTONIC_CLOCK__ */ - -void ethr_init_event__(void); - /* implemented in lib_src/common/ethread_aux.c */ int ethr_init_common__(ethr_init_data *id); int ethr_late_init_common__(ethr_late_init_data *lid); diff -Nru erlang-18.2-dfsg/erts/include/internal/ethr_mutex.h erlang-17.3-dfsg/erts/include/internal/ethr_mutex.h --- erlang-18.2-dfsg/erts/include/internal/ethr_mutex.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ethr_mutex.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/ethr_optimized_fallbacks.h erlang-17.3-dfsg/erts/include/internal/ethr_optimized_fallbacks.h --- erlang-18.2-dfsg/erts/include/internal/ethr_optimized_fallbacks.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ethr_optimized_fallbacks.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/gcc/ethr_atomic.h erlang-17.3-dfsg/erts/include/internal/gcc/ethr_atomic.h --- erlang-18.2-dfsg/erts/include/internal/gcc/ethr_atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/gcc/ethr_atomic.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,99 +1,95 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2010-2015. All Rights Reserved. + * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ /* - * Description: Native atomics ethread support using gcc's __atomic - * and __sync builtins + * Description: Native atomics ethread support using gcc's builtins * Author: Rickard Green - * - * Note: The C11 memory model implemented by gcc's __atomic - * builtins does not match the ethread API very well. - * - * Due to this we cannot use the __ATOMIC_SEQ_CST - * memory model. For more information see the comment - * in the begining of ethr_membar.h in this directory. */ #undef ETHR_INCLUDE_ATOMIC_IMPL__ -#if !defined(ETHR_GCC_ATOMIC_ATOMIC32_H__) \ - && defined(ETHR_ATOMIC_WANT_32BIT_IMPL__) \ - && ((ETHR_HAVE___sync_val_compare_and_swap & 4) \ - || (ETHR_HAVE___atomic_compare_exchange_n & 4)) - -#define ETHR_GCC_ATOMIC_ATOMIC32_H__ -#define ETHR_INCLUDE_ATOMIC_IMPL__ 4 +#if !defined(ETHR_GCC_ATOMIC32_H__) && defined(ETHR_ATOMIC_WANT_32BIT_IMPL__) +#define ETHR_GCC_ATOMIC32_H__ +#if defined(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32) +# define ETHR_INCLUDE_ATOMIC_IMPL__ 4 +#endif #undef ETHR_ATOMIC_WANT_32BIT_IMPL__ - -#elif !defined(ETHR_GCC_ATOMIC64_H__) \ - && defined(ETHR_ATOMIC_WANT_64BIT_IMPL__) \ - && ((ETHR_HAVE___sync_val_compare_and_swap & 8) \ - || (ETHR_HAVE___atomic_compare_exchange_n & 8)) - +#elif !defined(ETHR_GCC_ATOMIC64_H__) && defined(ETHR_ATOMIC_WANT_64BIT_IMPL__) #define ETHR_GCC_ATOMIC64_H__ -#define ETHR_INCLUDE_ATOMIC_IMPL__ 8 +#if defined(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64) +# define ETHR_INCLUDE_ATOMIC_IMPL__ 8 +#endif #undef ETHR_ATOMIC_WANT_64BIT_IMPL__ - #endif #ifdef ETHR_INCLUDE_ATOMIC_IMPL__ +#ifndef ETHR_GCC_ATOMIC_COMMON__ +#define ETHR_GCC_ATOMIC_COMMON__ + +#define ETHR_READ_AND_SET_WITHOUT_SYNC_OP__ 0 +#if defined(__i386__) || defined(__x86_64__) || defined(__sparc__) \ + || defined(__powerpc__) || defined(__ppc__) || defined(__mips__) +# undef ETHR_READ_AND_SET_WITHOUT_SYNC_OP__ +# define ETHR_READ_AND_SET_WITHOUT_SYNC_OP__ 1 +#endif + +#endif /* ETHR_GCC_ATOMIC_COMMON__ */ + #if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 #define ETHR_HAVE_NATIVE_ATOMIC32 1 +#define ETHR_NATIVE_ATOMIC32_IMPL "gcc" #define ETHR_NATMC_FUNC__(X) ethr_native_atomic32_ ## X #define ETHR_ATMC_T__ ethr_native_atomic32_t #define ETHR_AINT_T__ ethr_sint32_t -#if ((ETHR_HAVE___sync_val_compare_and_swap & 4) \ - && (ETHR_HAVE___atomic_compare_exchange_n & 4)) -# define ETHR_NATIVE_ATOMIC32_IMPL "gcc_atomic_and_sync_builtins" -#elif (ETHR_HAVE___atomic_compare_exchange_n & 4) -# define ETHR_NATIVE_ATOMIC32_IMPL "gcc_atomic_builtins" -#elif (ETHR_HAVE___sync_val_compare_and_swap & 4) -# define ETHR_NATIVE_ATOMIC32_IMPL "gcc_sync_builtins" -#else -# error "!?" +#if defined(ETHR_HAVE___SYNC_ADD_AND_FETCH32) +# define ETHR_HAVE___SYNC_ADD_AND_FETCH +#endif +#if defined(ETHR_HAVE___SYNC_FETCH_AND_AND32) +# define ETHR_HAVE___SYNC_FETCH_AND_AND +#endif +#if defined(ETHR_HAVE___SYNC_FETCH_AND_OR32) +# define ETHR_HAVE___SYNC_FETCH_AND_OR #endif #elif ETHR_INCLUDE_ATOMIC_IMPL__ == 8 #define ETHR_HAVE_NATIVE_ATOMIC64 1 +#define ETHR_NATIVE_ATOMIC64_IMPL "gcc" #define ETHR_NATMC_FUNC__(X) ethr_native_atomic64_ ## X #define ETHR_ATMC_T__ ethr_native_atomic64_t #define ETHR_AINT_T__ ethr_sint64_t -#if ((ETHR_HAVE___sync_val_compare_and_swap & 8) \ - && (ETHR_HAVE___atomic_compare_exchange_n & 8)) -# define ETHR_NATIVE_ATOMIC64_IMPL "gcc_atomic_and_sync_builtins" -#elif (ETHR_HAVE___atomic_compare_exchange_n & 8) -# define ETHR_NATIVE_ATOMIC64_IMPL "gcc_atomic_builtins" -#elif (ETHR_HAVE___sync_val_compare_and_swap & 8) -# define ETHR_NATIVE_ATOMIC64_IMPL "gcc_sync_builtins" -#else -# error "!?" +#if defined(ETHR_HAVE___SYNC_ADD_AND_FETCH64) +# define ETHR_HAVE___SYNC_ADD_AND_FETCH +#endif +#if defined(ETHR_HAVE___SYNC_FETCH_AND_AND64) +# define ETHR_HAVE___SYNC_FETCH_AND_AND +#endif +#if defined(ETHR_HAVE___SYNC_FETCH_AND_OR64) +# define ETHR_HAVE___SYNC_FETCH_AND_OR #endif #else #error "Unsupported integer size" #endif -#undef ETHR_NATIVE_ATOMIC_IMPL__ - typedef struct { - volatile ETHR_AINT_T__ value; + volatile ETHR_AINT_T__ counter; } ETHR_ATMC_T__; + #if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_ATOMIC_IMPL__) #if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 @@ -102,19 +98,13 @@ # define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_ADDR 1 #endif - static ETHR_INLINE ETHR_AINT_T__ * ETHR_NATMC_FUNC__(addr)(ETHR_ATMC_T__ *var) { - return (ETHR_AINT_T__ *) &var->value; + return (ETHR_AINT_T__ *) &var->counter; } -/* - * set() - */ -#if (ETHR_HAVE___atomic_store_n & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if (ETHR_GCC_RELAXED_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) +#if ETHR_READ_AND_SET_WITHOUT_SYNC_OP__ #if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_SET 1 @@ -125,74 +115,12 @@ static ETHR_INLINE void ETHR_NATMC_FUNC__(set)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ value) { - __atomic_store_n(&var->value, value, __ATOMIC_RELAXED); -} - -#endif /* ETHR_GCC_RELAXED_VERSIONS__ */ - -#if (ETHR_GCC_RELB_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_SET_RELB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_SET_RELB 1 -#endif - -static ETHR_INLINE void -ETHR_NATMC_FUNC__(set_relb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ value) -{ - __atomic_store_n(&var->value, value, __ATOMIC_RELEASE); -} - -#endif /* ETHR_GCC_RELB_VERSIONS__ */ - -#elif (ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if (ETHR_GCC_RELAXED_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_SET 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_SET 1 -#endif - -static ETHR_INLINE void -ETHR_NATMC_FUNC__(set)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ value) -{ - var->value = value; -} - -#endif /* ETHR_GCC_RELAXED_VERSIONS__ */ - -#if (ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE_RELB__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if (ETHR_GCC_RELB_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_SET_RELB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_SET_RELB 1 -#endif - -static ETHR_INLINE void -ETHR_NATMC_FUNC__(set_relb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ value) -{ - var->value = value; + var->counter = value; } -#endif /* ETHR_GCC_RELB_VERSIONS__ */ - -#endif /* ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE_RELB__ */ - -#endif /* ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE__ */ - -/* - * read() - */ - -#if (ETHR_HAVE___atomic_load_n & ETHR_INCLUDE_ATOMIC_IMPL__) +#endif /* ETHR_READ_AND_SET_WITHOUT_SYNC_OP__ */ -#if (ETHR_GCC_RELAXED_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) +#if ETHR_READ_AND_SET_WITHOUT_SYNC_OP__ #if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_READ 1 @@ -203,125 +131,12 @@ static ETHR_INLINE ETHR_AINT_T__ ETHR_NATMC_FUNC__(read)(ETHR_ATMC_T__ *var) { - return __atomic_load_n(&var->value, __ATOMIC_RELAXED); + return var->counter; } -#endif /* ETHR_GCC_RELAXED_VERSIONS__ */ +#endif /* ETHR_READ_AND_SET_WITHOUT_SYNC_OP__ */ -#if ((ETHR_GCC_ACQB_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) \ - & ~ETHR___atomic_load_ACQUIRE_barrier_bug) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_READ_ACQB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_READ_ACQB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(read_acqb)(ETHR_ATMC_T__ *var) -{ - return __atomic_load_n(&var->value, __ATOMIC_ACQUIRE); -} - -#endif /* ETHR_GCC_ACQB_VERSIONS__ */ - -#elif (ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if (ETHR_GCC_RELAXED_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_READ 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_READ 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(read)(ETHR_ATMC_T__ *var) -{ - return var->value; -} - -#endif /* ETHR_GCC_RELAXED_VERSIONS__ */ - -#if (ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD_ACQB__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if (ETHR_GCC_ACQB_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_READ_ACQB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_READ_ACQB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(read_acqb)(ETHR_ATMC_T__ *var) -{ - return var->value; -} - -#endif /* ETHR_GCC_ACQB_VERSIONS__ */ - -#endif /* ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD_ACQB__ */ - -#endif /* ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD__ */ - -/* - * add_return() - */ -#if (ETHR_HAVE___atomic_add_fetch & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if (ETHR_GCC_RELAXED_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_ADD_RETURN 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_ADD_RETURN 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(add_return)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ incr) -{ - return __atomic_add_fetch(&var->value, incr, __ATOMIC_RELAXED); -} - -#endif /* ETHR_GCC_RELAXED_MOD_VERSIONS__ */ - -#if (ETHR_GCC_ACQB_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_ADD_RETURN_ACQB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_ADD_RETURN_ACQB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(add_return_acqb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ incr) -{ - return __atomic_add_fetch(&var->value, incr, __ATOMIC_ACQUIRE); -} - -#endif /* ETHR_GCC_ACQB_MOD_VERSIONS__ */ - -#if (ETHR_GCC_RELB_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_ADD_RETURN_RELB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_ADD_RETURN_RELB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(add_return_relb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ incr) -{ - return __atomic_add_fetch(&var->value, incr, __ATOMIC_RELEASE); -} - -#endif /* ETHR_GCC_RELB_MOD_VERSIONS__ */ - -#endif /* ETHR_HAVE___atomic_add_fetch */ - -#if ((ETHR_HAVE___sync_add_and_fetch & ETHR_INCLUDE_ATOMIC_IMPL__) \ - & ETHR_GCC_MB_MOD_VERSIONS__) +#if defined(ETHR_HAVE___SYNC_ADD_AND_FETCH) #if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_ADD_RETURN_MB 1 @@ -332,68 +147,12 @@ static ETHR_INLINE ETHR_AINT_T__ ETHR_NATMC_FUNC__(add_return_mb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ incr) { - return __sync_add_and_fetch(&var->value, incr); + return __sync_add_and_fetch(&var->counter, incr); } -#endif /* ETHR_HAVE___sync_add_and_fetch */ - -/* - * and_retold() - */ -#if (ETHR_HAVE___atomic_fetch_and & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if (ETHR_GCC_RELAXED_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_AND_RETOLD 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_AND_RETOLD 1 #endif -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(and_retold)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ mask) -{ - return __atomic_fetch_and(&var->value, mask, __ATOMIC_RELAXED); -} - -#endif /* ETHR_GCC_RELAXED_MOD_VERSIONS__ */ - -#if (ETHR_GCC_ACQB_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_AND_RETOLD_ACQB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_AND_RETOLD_ACQB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(and_retold_acqb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ mask) -{ - return __atomic_fetch_and(&var->value, mask, __ATOMIC_ACQUIRE); -} - -#endif /* ETHR_GCC_ACQB_MOD_VERSIONS__ */ - -#if (ETHR_GCC_RELB_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_AND_RETOLD_RELB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_AND_RETOLD_RELB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(and_retold_relb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ mask) -{ - return __atomic_fetch_and(&var->value, mask, __ATOMIC_RELEASE); -} - -#endif /* ETHR_GCC_RELB_MOD_VERSIONS__ */ - -#endif /* ETHR_HAVE___atomic_fetch_and */ - -#if ((ETHR_HAVE___sync_fetch_and_and & ETHR_INCLUDE_ATOMIC_IMPL__) \ - & ETHR_GCC_MB_MOD_VERSIONS__) +#if defined(ETHR_HAVE___SYNC_FETCH_AND_AND) #if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_AND_RETOLD_MB 1 @@ -404,68 +163,12 @@ static ETHR_INLINE ETHR_AINT_T__ ETHR_NATMC_FUNC__(and_retold_mb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ mask) { - return __sync_fetch_and_and(&var->value, mask); + return __sync_fetch_and_and(&var->counter, mask); } -#endif /* ETHR_HAVE___sync_fetch_and_and */ - -/* - * or_retold() - */ -#if (ETHR_HAVE___atomic_fetch_or & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if (ETHR_GCC_RELAXED_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_OR_RETOLD 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_OR_RETOLD 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(or_retold)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ mask) -{ - return __atomic_fetch_or(&var->value, mask, __ATOMIC_RELAXED); -} - -#endif /* ETHR_GCC_RELAXED_MOD_VERSIONS__ */ - -#if (ETHR_GCC_ACQB_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_OR_RETOLD_ACQB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_OR_RETOLD_ACQB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(or_retold_acqb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ mask) -{ - return __atomic_fetch_or(&var->value, mask, __ATOMIC_ACQUIRE); -} - -#endif /* ETHR_GCC_ACQB_MOD_VERSIONS__ */ - -#if (ETHR_GCC_RELB_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_OR_RETOLD_RELB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_OR_RETOLD_RELB 1 #endif -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(or_retold_relb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ mask) -{ - return __atomic_fetch_or(&var->value, mask, __ATOMIC_RELEASE); -} - -#endif /* ETHR_GCC_RELB_MOD_VERSIONS__ */ - -#endif /* ETHR_HAVE___atomic_fetch_or */ - -#if ((ETHR_HAVE___sync_fetch_and_or & ETHR_INCLUDE_ATOMIC_IMPL__) \ - & ETHR_GCC_MB_MOD_VERSIONS__) +#if defined(ETHR_HAVE___SYNC_FETCH_AND_OR) #if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_OR_RETOLD_MB 1 @@ -476,73 +179,11 @@ static ETHR_INLINE ETHR_AINT_T__ ETHR_NATMC_FUNC__(or_retold_mb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ mask) { - return (ETHR_AINT_T__) __sync_fetch_and_or(&var->value, mask); -} - -#endif /* ETHR_HAVE___sync_fetch_and_or */ - -/* - * cmpxchg() - */ -#if (ETHR_HAVE___atomic_compare_exchange_n & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if (ETHR_GCC_RELAXED_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_CMPXCHG 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(cmpxchg)(ETHR_ATMC_T__ *var, - ETHR_AINT_T__ new, - ETHR_AINT_T__ exp) -{ - ETHR_AINT_T__ xchg = exp; - if (__atomic_compare_exchange_n(&var->value, - &xchg, - new, - 0, /* No spurious failures, please */ - __ATOMIC_RELAXED, - __ATOMIC_RELAXED)) - return exp; - return xchg; + return (ETHR_AINT_T__) __sync_fetch_and_or(&var->counter, mask); } -#endif /* ETHR_GCC_RELAXED_MOD_VERSIONS__ */ - -#if (ETHR_GCC_ACQB_MOD_VERSIONS__ & ETHR_INCLUDE_ATOMIC_IMPL__) - -#if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG_ACQB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_CMPXCHG_ACQB 1 #endif -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(cmpxchg_acqb)(ETHR_ATMC_T__ *var, - ETHR_AINT_T__ new, - ETHR_AINT_T__ exp) -{ - ETHR_AINT_T__ xchg = exp; - if (__atomic_compare_exchange_n(&var->value, - &xchg, - new, - 0, /* No spurious failures, please */ - __ATOMIC_ACQUIRE, - __ATOMIC_ACQUIRE)) - return exp; - return xchg; -} - -#endif /* ETHR_GCC_ACQB_MOD_VERSIONS__ */ - -#endif /* ETHR_HAVE___atomic_compare_exchange_n */ - -#if ((ETHR_HAVE___sync_val_compare_and_swap & ETHR_INCLUDE_ATOMIC_IMPL__) \ - & ETHR_GCC_MB_MOD_VERSIONS__) - #if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG_MB 1 #else @@ -554,16 +195,17 @@ ETHR_AINT_T__ new, ETHR_AINT_T__ old) { - return __sync_val_compare_and_swap(&var->value, old, new); + return __sync_val_compare_and_swap(&var->counter, old, new); } -#endif /* ETHR_HAVE___sync_val_compare_and_swap */ - #endif /* ETHR_TRY_INLINE_FUNCS */ #undef ETHR_NATMC_FUNC__ #undef ETHR_ATMC_T__ #undef ETHR_AINT_T__ #undef ETHR_AINT_SUFFIX__ +#undef ETHR_HAVE___SYNC_ADD_AND_FETCH +#undef ETHR_HAVE___SYNC_FETCH_AND_AND +#undef ETHR_HAVE___SYNC_FETCH_AND_OR #endif diff -Nru erlang-18.2-dfsg/erts/include/internal/gcc/ethr_dw_atomic.h erlang-17.3-dfsg/erts/include/internal/gcc/ethr_dw_atomic.h --- erlang-18.2-dfsg/erts/include/internal/gcc/ethr_dw_atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/gcc/ethr_dw_atomic.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,57 +1,52 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2011-2015. All Rights Reserved. + * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ /* - * Description: Native double word atomics using gcc's __atomic - * and __sync builtins + * Description: Native double word atomics using gcc's builtins * Author: Rickard Green - * - * Note: The C11 memory model implemented by gcc's __atomic - * builtins does not match the ethread API very well. - * - * Due to this we cannot use the __ATOMIC_SEQ_CST - * memory model. For more information see the comment - * in the begining of ethr_membar.h in this directory. */ #undef ETHR_INCLUDE_DW_ATOMIC_IMPL__ -#if !defined(ETHR_GCC_ATOMIC_DW_ATOMIC_H__) \ - && ((ETHR_HAVE___sync_val_compare_and_swap & (2*ETHR_SIZEOF_PTR)) \ - || (ETHR_HAVE___atomic_compare_exchange_n & (2*ETHR_SIZEOF_PTR))) -# define ETHR_GCC_ATOMIC_DW_ATOMIC_H__ -# define ETHR_INCLUDE_DW_ATOMIC_IMPL__ +#ifndef ETHR_GCC_DW_ATOMIC_H__ +# define ETHR_GCC_DW_ATOMIC_H__ +# if ((ETHR_SIZEOF_PTR == 4 \ + && defined(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64)) \ + || (ETHR_SIZEOF_PTR == 8 \ + && defined(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP128) \ + && defined(ETHR_HAVE_INT128_T))) +# define ETHR_INCLUDE_DW_ATOMIC_IMPL__ +# endif #endif #ifdef ETHR_INCLUDE_DW_ATOMIC_IMPL__ # define ETHR_HAVE_NATIVE_SU_DW_ATOMIC +# define ETHR_NATIVE_DW_ATOMIC_IMPL "gcc" -#if ((ETHR_HAVE___sync_val_compare_and_swap & (2*ETHR_SIZEOF_PTR)) \ - && (ETHR_HAVE___atomic_compare_exchange_n & (2*ETHR_SIZEOF_PTR))) -# define ETHR_NATIVE_DW_ATOMIC_IMPL "gcc_atomic_and_sync_builtins" -#elif (ETHR_HAVE___atomic_compare_exchange_n & (2*ETHR_SIZEOF_PTR)) -# define ETHR_NATIVE_DW_ATOMIC_IMPL "gcc_atomic_builtins" -#elif (ETHR_HAVE___sync_val_compare_and_swap & (2*ETHR_SIZEOF_PTR)) -# define ETHR_NATIVE_DW_ATOMIC_IMPL "gcc_sync_builtins" -#else -# error "!?" -#endif +# if defined(__i386__) || defined(__x86_64__) +/* + * If ETHR_RTCHK_USE_NATIVE_DW_ATOMIC_IMPL__ is defined, it will be used + * at runtime in order to determine if native or fallback implementation + * should be used. + */ +# define ETHR_RTCHK_USE_NATIVE_DW_ATOMIC_IMPL__ \ + ETHR_X86_RUNTIME_CONF_HAVE_DW_CMPXCHG__ +# endif # if ETHR_SIZEOF_PTR == 4 # define ETHR_DW_NATMC_ALIGN_MASK__ 0x7 @@ -94,138 +89,15 @@ # define ETHR_DW_DBG_ALIGNED__(PTR) # endif - -#define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_ADDR 1 - +#define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_ADDR static ETHR_INLINE ethr_sint_t * ethr_native_dw_atomic_addr(ethr_native_dw_atomic_t *var) { return (ethr_sint_t *) ETHR_DW_NATMC_MEM__(var); } -#if (ETHR_HAVE___atomic_store_n & (2*ETHR_SIZEOF_PTR)) - -#if (ETHR_GCC_RELAXED_VERSIONS__ & (2*ETHR_SIZEOF_PTR)) - -#define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_SET 1 - -static ETHR_INLINE void -ethr_native_su_dw_atomic_set(ethr_native_dw_atomic_t *var, - ETHR_NATIVE_SU_DW_SINT_T value) -{ - ethr_native_dw_ptr_t p = (ethr_native_dw_ptr_t) ETHR_DW_NATMC_MEM__(var); - ETHR_DW_DBG_ALIGNED__(p); - __atomic_store_n(p, value, __ATOMIC_RELAXED); -} - -#endif /* ETHR_GCC_RELAXED_VERSIONS__ */ - -#if (ETHR_GCC_RELB_VERSIONS__ & (2*ETHR_SIZEOF_PTR)) -#define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_SET_RELB 1 - -static ETHR_INLINE void -ethr_native_su_dw_atomic_set_relb(ethr_native_dw_atomic_t *var, - ETHR_NATIVE_SU_DW_SINT_T value) -{ - ethr_native_dw_ptr_t p = (ethr_native_dw_ptr_t) ETHR_DW_NATMC_MEM__(var); - ETHR_DW_DBG_ALIGNED__(p); - __atomic_store_n(p, value, __ATOMIC_RELEASE); -} - -#endif /* ETHR_GCC_RELB_VERSIONS__ */ - -#endif /* ETHR_HAVE___atomic_store_n */ - -#if (ETHR_HAVE___atomic_load_n & (2*ETHR_SIZEOF_PTR)) - -#if (ETHR_GCC_RELAXED_VERSIONS__ & (2*ETHR_SIZEOF_PTR)) - -#define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_READ 1 - -static ETHR_INLINE ETHR_NATIVE_SU_DW_SINT_T -ethr_native_su_dw_atomic_read(ethr_native_dw_atomic_t *var) -{ - ethr_native_dw_ptr_t p = (ethr_native_dw_ptr_t) ETHR_DW_NATMC_MEM__(var); - ETHR_DW_DBG_ALIGNED__(p); - return __atomic_load_n(p, __ATOMIC_RELAXED); -} - -#endif /* ETHR_GCC_RELAXED_VERSIONS__ */ - -#if ((ETHR_GCC_ACQB_VERSIONS__ & (2*ETHR_SIZEOF_PTR)) \ - & ~ETHR___atomic_load_ACQUIRE_barrier_bug) - -#define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_READ_ACQB 1 - -static ETHR_INLINE ETHR_NATIVE_SU_DW_SINT_T -ethr_native_su_dw_atomic_read_acqb(ethr_native_dw_atomic_t *var) -{ - ethr_native_dw_ptr_t p = (ethr_native_dw_ptr_t) ETHR_DW_NATMC_MEM__(var); - ETHR_DW_DBG_ALIGNED__(p); - return __atomic_load_n(p, __ATOMIC_ACQUIRE); -} - -#endif /* ETHR_GCC_ACQB_VERSIONS__ */ - -#endif /* ETHR_HAVE___atomic_load_n */ - -#if (ETHR_HAVE___atomic_compare_exchange_n & (2*ETHR_SIZEOF_PTR)) - -#if (ETHR_GCC_RELAXED_MOD_VERSIONS__ & (2*ETHR_SIZEOF_PTR)) - -#define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_CMPXCHG 1 - -static ETHR_INLINE ETHR_NATIVE_SU_DW_SINT_T -ethr_native_su_dw_atomic_cmpxchg(ethr_native_dw_atomic_t *var, - ETHR_NATIVE_SU_DW_SINT_T new, - ETHR_NATIVE_SU_DW_SINT_T exp) -{ - ethr_native_dw_ptr_t p = (ethr_native_dw_ptr_t) ETHR_DW_NATMC_MEM__(var); - ETHR_NATIVE_SU_DW_SINT_T xchg = exp; - ETHR_DW_DBG_ALIGNED__(p); - if (__atomic_compare_exchange_n(p, - &xchg, - new, - 0, - __ATOMIC_RELAXED, - __ATOMIC_RELAXED)) - return exp; - return xchg; -} - -#endif /* ETHR_GCC_RELAXED_MOD_VERSIONS__ */ - -#if (ETHR_GCC_ACQB_MOD_VERSIONS__ & (2*ETHR_SIZEOF_PTR)) - -#define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_CMPXCHG_ACQB 1 - -static ETHR_INLINE ETHR_NATIVE_SU_DW_SINT_T -ethr_native_su_dw_atomic_cmpxchg_acqb(ethr_native_dw_atomic_t *var, - ETHR_NATIVE_SU_DW_SINT_T new, - ETHR_NATIVE_SU_DW_SINT_T exp) -{ - ethr_native_dw_ptr_t p = (ethr_native_dw_ptr_t) ETHR_DW_NATMC_MEM__(var); - ETHR_NATIVE_SU_DW_SINT_T xchg = exp; - ETHR_DW_DBG_ALIGNED__(p); - if (__atomic_compare_exchange_n(p, - &xchg, - new, - 0, - __ATOMIC_ACQUIRE, - __ATOMIC_ACQUIRE)) - return exp; - return xchg; -} - -#endif /* ETHR_GCC_ACQB_MOD_VERSIONS__ */ - -#endif /* ETHR_HAVE___atomic_compare_exchange_n */ - -#if ((ETHR_HAVE___sync_val_compare_and_swap & (2*ETHR_SIZEOF_PTR)) \ - & ETHR_GCC_MB_MOD_VERSIONS__) - -#define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_CMPXCHG_MB 1 +#define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_CMPXCHG_MB static ETHR_INLINE ETHR_NATIVE_SU_DW_SINT_T ethr_native_su_dw_atomic_cmpxchg_mb(ethr_native_dw_atomic_t *var, @@ -237,8 +109,7 @@ return __sync_val_compare_and_swap(p, old, new); } -#endif /* ETHR_HAVE___sync_val_compare_and_swap */ - #endif /* ETHR_TRY_INLINE_FUNCS */ -#endif /* ETHR_INCLUDE_DW_ATOMIC_IMPL__ */ +#endif /* ETHR_GCC_DW_ATOMIC_H__ */ + diff -Nru erlang-18.2-dfsg/erts/include/internal/gcc/ethread.h erlang-17.3-dfsg/erts/include/internal/gcc/ethread.h --- erlang-18.2-dfsg/erts/include/internal/gcc/ethread.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/gcc/ethread.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,310 +1,37 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2010-2015. All Rights Reserved. + * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ /* - * Description: Native atomic ethread support when using gcc's __atomic - * and __sync builtins + * Description: Native atomic ethread support when using gcc * Author: Rickard Green */ -#if !defined(ETHREAD_GCC_NATIVE_H__) && ETHR_GCC_COMPILER -#define ETHREAD_GCC_NATIVE_H__ +#ifndef ETHREAD_GCC_H__ +#define ETHREAD_GCC_H__ + +#if defined(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32) \ + || defined(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64) #ifndef ETHR_MEMBAR # include "ethr_membar.h" #endif -#define ETHR_GCC_VERSIONS_MASK__ 28 - -#undef ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE__ -#undef ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE_RELB__ -#undef ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD__ -#undef ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD_ACQB__ -#undef ETHR_GCC_RELAXED_VERSIONS__ -#undef ETHR_GCC_RELAXED_MOD_VERSIONS__ -#undef ETHR_GCC_ACQB_VERSIONS__ -#undef ETHR_GCC_ACQB_MOD_VERSIONS__ -#undef ETHR_GCC_RELB_VERSIONS__ -#undef ETHR_GCC_RELB_MOD_VERSIONS__ -#undef ETHR_GCC_MB_MOD_VERSIONS__ - -/* - * True GNU GCCs before version 4.8 do not emit a memory barrier - * after the load in the __atomic_load_n(_, __ATOMIC_ACQUIRE) - * case (which is needed on most architectures). - */ -#undef ETHR___atomic_load_ACQUIRE_barrier_bug -#if ETHR_GCC_COMPILER != ETHR_GCC_COMPILER_TRUE -/* - * A gcc compatible compiler. We have no information - * about the existence of this bug, but we assume - * that it is not impossible that it could have - * been "inherited". Therefore, until we are certain - * that the bug does not exist, we assume that it - * does. - */ -# define ETHR___atomic_load_ACQUIRE_barrier_bug ETHR_GCC_VERSIONS_MASK__ -#elif !ETHR_AT_LEAST_GCC_VSN__(4, 8, 0) -/* True gcc of version < 4.8, i.e., bug exist... */ -# define ETHR___atomic_load_ACQUIRE_barrier_bug ETHR_GCC_VERSIONS_MASK__ -#else /* True gcc of version >= 4.8 */ -/* - * Sizes less than or equal to word size have been fixed, - * but double word size has not been fixed. - */ -# if ETHR_SIZEOF_PTR == 8 -# define ETHR___atomic_load_ACQUIRE_barrier_bug \ - (~(8|4) & ETHR_GCC_VERSIONS_MASK__) -# elif ETHR_SIZEOF_PTR == 4 -# define ETHR___atomic_load_ACQUIRE_barrier_bug \ - (~4 & ETHR_GCC_VERSIONS_MASK__) -# else -# error word size not supported -# endif -#endif - -#define ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE__ 0 -#define ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE_RELB__ 0 -#define ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD__ 0 -#define ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD_ACQB__ 0 -#define ETHR_GCC_RELAXED_VERSIONS__ ETHR_GCC_VERSIONS_MASK__ -#define ETHR_GCC_RELAXED_MOD_VERSIONS__ ETHR_GCC_VERSIONS_MASK__ - -#if ETHR_TRUST_GCC_ATOMIC_BUILTINS_MEMORY_BARRIERS -# define ETHR_GCC_ACQB_VERSIONS__ ETHR_GCC_VERSIONS_MASK__ -# define ETHR_GCC_ACQB_MOD_VERSIONS__ ETHR_GCC_VERSIONS_MASK__ -# define ETHR_GCC_RELB_VERSIONS__ ETHR_GCC_VERSIONS_MASK__ -# define ETHR_GCC_RELB_MOD_VERSIONS__ ETHR_GCC_VERSIONS_MASK__ -#else -/* - * This is currently the default (on most platforms) since - * we've seen too many memory barrier bugs produced by gcc... - */ -# define ETHR_GCC_ACQB_VERSIONS__ 0 -# define ETHR_GCC_ACQB_MOD_VERSIONS__ 0 -# define ETHR_GCC_RELB_VERSIONS__ 0 -# define ETHR_GCC_RELB_MOD_VERSIONS__ 0 -#endif -/* - * In the general case we do not want any full barrier versions - * if we can implement more relaxed ones (using __atomic_* builtins). - * This since the implementations normally need extra memory barrier - * instructions to implement these. The x86/x86_64 implementations - * are an exception see below. - */ -#define ETHR_GCC_MB_MOD_VERSIONS__ \ - (ETHR_GCC_VERSIONS_MASK__ & ~ETHR_HAVE___atomic_compare_exchange_n) - -#if ETHR_SIZEOF_PTR == 8 -# define ETHR_GCC_VOLATILE_BIT_MASK__ 12 -#elif ETHR_SIZEOF_PTR == 4 -# define ETHR_GCC_VOLATILE_BIT_MASK__ 4 -#endif - -#if defined(__i386__) || defined(__x86_64__) || defined(__sparc__) \ - || defined(__powerpc__) || defined(__ppc__) || defined(__mips__) \ - || defined(__alpha__) || defined(__ia64__) - -/* - * Aligned volatile stores and loads of data smaller - * than or equal to word size are atomic... - */ -# undef ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE__ -# define ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE__ ETHR_GCC_VOLATILE_BIT_MASK__ -# undef ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD__ -# define ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD__ ETHR_GCC_VOLATILE_BIT_MASK__ - -#elif defined(__arm__) - -/* volatile stores are problematic on some machines... */ -# undef ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD__ -# define ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD__ ETHR_GCC_VOLATILE_BIT_MASK__ - -#endif - -#if defined(__ia64__) - -/* Volatile stores produce stores with release barriers. */ -# undef ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE_RELB__ -# define ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE_RELB__ ETHR_GCC_VOLATILE_BIT_MASK__ - -/* Volatile loads produce loads with acquire barrier. */ -# undef ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD_ACQB__ -# define ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD_ACQB__ ETHR_GCC_VOLATILE_BIT_MASK__ - -/* - * We trust gcc to produce acquire/release barriers on itanium. - * Since all atomic ops also have at least acquire or release - * barriers (also when passed the relaxed memory model) it - * would be very inefficient not to use these as native - * barriers on Itanium. - */ -# undef ETHR_GCC_ACQB_VERSIONS__ -# define ETHR_GCC_ACQB_VERSIONS__ ETHR_GCC_VERSIONS_MASK__ -# undef ETHR_GCC_ACQB_MOD_VERSIONS__ -# define ETHR_GCC_ACQB_MOD_VERSIONS__ ETHR_GCC_VERSIONS_MASK__ -# undef ETHR_GCC_RELB_VERSIONS__ -# define ETHR_GCC_RELB_VERSIONS__ ETHR_GCC_VERSIONS_MASK__ -# undef ETHR_GCC_RELB_MOD_VERSIONS__ -# define ETHR_GCC_RELB_MOD_VERSIONS__ ETHR_GCC_VERSIONS_MASK__ - -/* - * Itanium is not effected by the load acquire - * bug since the barrier is part of the instruction - * on Itanium (ld.acq), and not a separate instruction - * as on most platforms. - */ -# undef ETHR___atomic_load_ACQUIRE_barrier_bug -# define ETHR___atomic_load_ACQUIRE_barrier_bug 0 - -/* - * No point exposing relaxed versions since they are - * implemended using either acquire or release - * barriers. - */ -# undef ETHR_GCC_RELAXED_VERSIONS__ -# define ETHR_GCC_RELAXED_VERSIONS__ 0 - -/* #endif defined(__ia64__) */ -#elif defined(__i386__) || defined(__x86_64__) - -/* - * Want full barrier versions of all modification - * operations since all of these are implemented - * using locked instructions implying full memory - * barriers. - */ -# undef ETHR_GCC_MB_MOD_VERSIONS__ -# define ETHR_GCC_MB_MOD_VERSIONS__ ETHR_HAVE___sync_val_compare_and_swap - -/* - * No point exposing acquire/release versions - * when we got full memory barrier versions - * of modification operations since all of these - * are implemented using locked instructions - * implying full memory barriers. - */ -# if ETHR_GCC_ACQB_MOD_VERSIONS__ -# undef ETHR_GCC_ACQB_MOD_VERSIONS__ -# define ETHR_GCC_ACQB_MOD_VERSIONS__ \ - (ETHR_GCC_VERSIONS_MASK__ & ~ETHR_HAVE___sync_val_compare_and_swap) -# endif -# if ETHR_GCC_RELB_MOD_VERSIONS__ -# undef ETHR_GCC_RELB_MOD_VERSIONS__ -# define ETHR_GCC_RELB_MOD_VERSIONS__ \ - (ETHR_GCC_VERSIONS_MASK__ & ~ETHR_HAVE___sync_val_compare_and_swap) -# endif - -# ifdef ETHR_X86_OUT_OF_ORDER - -/* See above... */ -# undef ETHR_GCC_RELAXED_MOD_VERSIONS__ -# define ETHR_GCC_RELAXED_MOD_VERSIONS__ 0 - -# else /* !ETHR_X86_OUT_OF_ORDER, i.e., we don't use any x86-OOO instructions... */ - -/* - * Not effected by the load acquire barrier bug, - * since no barrier at all is needed for a load - * acquire... - */ -# undef ETHR___atomic_load_ACQUIRE_barrier_bug -# define ETHR___atomic_load_ACQUIRE_barrier_bug 0 - -/* Stores imply release barriers semantics. */ -# undef ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE_RELB__ -# define ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE_RELB__ ETHR_GCC_VOLATILE_BIT_MASK__ - -/* Loads imply acquire barrier semantics. */ -# undef ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD_ACQB__ -# define ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD_ACQB__ ETHR_GCC_VOLATILE_BIT_MASK__ - -/* - * Trust load acquire and store release for sizes - * where volatile operation implies these barrier - * semantics since no barriers are needed. - */ -# if !ETHR_GCC_ACQB_VERSIONS__ -# undef ETHR_GCC_ACQB_VERSIONS__ -# define ETHR_GCC_ACQB_VERSIONS__ ETHR_GCC_VOLATILE_BIT_MASK__ -# endif -# if !ETHR_GCC_RELB_VERSIONS__ -# undef ETHR_GCC_RELB_VERSIONS__ -# define ETHR_GCC_RELB_VERSIONS__ ETHR_GCC_VOLATILE_BIT_MASK__ -# endif - -/* - * No point exposing relaxed versions at all since - * all mod operations are implemented with locked - * instructions implying full memory barriers and - * volatile store and load imply release and - * acquire barrier semantics. - */ -# undef ETHR_GCC_RELAXED_VERSIONS__ -# define ETHR_GCC_RELAXED_VERSIONS__ 0 - -# endif /* !ETHR_X86_OUT_OF_ORDER */ - -/* #endif defined(__i386__) || defined(__x86_64__) */ -#elif defined(__powerpc__) || defined(__ppc__) - -# if !defined(ETHR_PPC_HAVE_LWSYNC) -/* - * Release barriers are typically implemented using - * the lwsync instruction. We want our runtime - * configure test to determine if the lwsync - * instruction is available on the system or not - * before we use it. Therefore, do not implement any - * native ops using the __ATOMIC_RELEASE model. - */ -# undef ETHR_GCC_RELB_VERSIONS__ -# define ETHR_GCC_RELB_VERSIONS__ 0 -# if defined(ETHR_GCC_IMPLEMENT_ACQB_USING_LWSYNC) -/* - * Acquire barriers are usually implemented by other means - * than lwsync, but can be implemented using lwsync. Define - * ETHR_GCC_IMPLEMENT_ACQB_USING_LWSYNC if acquire barriers - * are implemented using lwsync. - */ -# undef ETHR_GCC_ACQB_VERSIONS__ -# define ETHR_GCC_ACQB_VERSIONS__ 0 -# endif -# endif - -#endif /* defined(__powerpc__) || defined(__ppc__) */ - -#if !ETHR_GCC_RELAXED_VERSIONS__ -# undef ETHR_GCC_RELAXED_MOD_VERSIONS__ -# define ETHR_GCC_RELAXED_MOD_VERSIONS__ 0 -#endif - -#if !ETHR_GCC_ACQB_VERSIONS__ -# undef ETHR_GCC_ACQB_MOD_VERSIONS__ -# define ETHR_GCC_ACQB_MOD_VERSIONS__ 0 -#endif - -#if !ETHR_GCC_RELB_VERSIONS__ -# undef ETHR_GCC_RELB_MOD_VERSIONS__ -# define ETHR_GCC_RELB_MOD_VERSIONS__ 0 -#endif - #if !defined(ETHR_HAVE_NATIVE_ATOMIC32) # define ETHR_ATOMIC_WANT_32BIT_IMPL__ # include "ethr_atomic.h" @@ -315,51 +42,12 @@ # include "ethr_atomic.h" #endif -#if defined(__x86_64__) -/* - * No instructions available for native implementation - * of these for dw-atomics... - */ -# undef ETHR_GCC_RELAXED_VERSIONS__ -# define ETHR_GCC_RELAXED_VERSIONS__ 0 -# undef ETHR_GCC_ACQB_VERSIONS__ -# define ETHR_GCC_ACQB_VERSIONS__ 0 -# undef ETHR_GCC_RELB_VERSIONS__ -# define ETHR_GCC_RELB_VERSIONS__ 0 -#endif - -#if !ETHR_GCC_RELAXED_VERSIONS__ -# undef ETHR_GCC_RELAXED_MOD_VERSIONS__ -# define ETHR_GCC_RELAXED_MOD_VERSIONS__ 0 -#endif - -#if !ETHR_GCC_ACQB_VERSIONS__ -# undef ETHR_GCC_ACQB_MOD_VERSIONS__ -# define ETHR_GCC_ACQB_MOD_VERSIONS__ 0 -#endif - -#if !ETHR_GCC_RELB_VERSIONS__ -# undef ETHR_GCC_RELB_MOD_VERSIONS__ -# define ETHR_GCC_RELB_MOD_VERSIONS__ 0 -#endif - #if (!defined(ETHR_HAVE_NATIVE_DW_ATOMIC) \ && !(ETHR_SIZEOF_PTR == 4 && defined(ETHR_HAVE_NATIVE_ATOMIC64)) \ && !(ETHR_SIZEOF_PTR == 8 && defined(ETHR_HAVE_NATIVE_ATOMIC128))) # include "ethr_dw_atomic.h" #endif -#undef ETHR___atomic_load_ACQUIRE_barrier_bug -#undef ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE__ -#undef ETHR_GCC_VOLATILE_STORE_IS_ATOMIC_STORE_RELB__ -#undef ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD__ -#undef ETHR_GCC_VOLATILE_LOAD_IS_ATOMIC_LOAD_ACQB__ -#undef ETHR_GCC_RELAXED_VERSIONS__ -#undef ETHR_GCC_RELB_VERSIONS__ -#undef ETHR_GCC_RELB_VERSIONS__ -#undef ETHR_GCC_RELAXED_MOD_VERSIONS__ -#undef ETHR_GCC_ACQB_MOD_VERSIONS__ -#undef ETHR_GCC_RELB_MOD_VERSIONS__ -#undef ETHR_GCC_MB_MOD_VERSIONS__ +#endif -#endif /* ETHREAD_GCC_NATIVE_H__ */ +#endif diff -Nru erlang-18.2-dfsg/erts/include/internal/gcc/ethr_membar.h erlang-17.3-dfsg/erts/include/internal/gcc/ethr_membar.h --- erlang-18.2-dfsg/erts/include/internal/gcc/ethr_membar.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/gcc/ethr_membar.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,214 +1,73 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2011-2015. All Rights Reserved. + * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ /* - * Description: Memory barriers when using gcc's __atomic and - * __sync builtins + * Description: Memory barriers when using gcc's builtins * Author: Rickard Green - * - * Note: The C11 memory model implemented by gcc's __atomic - * builtins does not match the ethread API very well. - * - * A function with a barrier postfix in the ethread atomic - * API needs to ensure that all stores and loads are - * ordered around it according to the semantics of the - * barrier specified. - * - * The C11 aproch is different. The __atomic builtins - * API takes a memory model parameter. Assuming that all - * memory syncronizations using the involved atomic - * variables are made using this API, the synchronizations - * will adhere to the memory models used. That is, you do - * *not* know how loads and stores will be ordered around - * a specific __atomic operation in the general case. You - * only know the total effect of the combination of - * operations issued will adhere to the model. - * - * This limits how we can use the __atomic builtins. What - * we cannot use: - * - * 1. We cannot rely on __atomic_thread_fence() to issue - * any specific memory barriers at all. This regardless - * of memory model parameter passed. That is, we cannot - * use the __atomic_thread_fence() builtin at all. - * - * Why is this? If all __atomic builtins accessing - * memory issue memory barriers, __atomic_thread_fence() - * does not have to issue memory barriers. The - * implementation for the Itanium architecture is an - * example of this. Even using the __ATOMIC_RELAXED - * memory model all __atomic builtins accessing memory - * will issue memory barriers. Due to this no memory - * barriers at all will be issued by - * __atomic_thread_fence() using either one of the - * __ATOMIC_CONSUME, __ATOMIC_ACQUIRE, or - * __ATOMIC_RELEASE memory models. - * - * 2. We cannot rely on any __atomic builtin with the - * __ATOMIC_SEQ_CST memory model parameters to - * issue any specific memory barriers. That is, we - * cannot use these memory models at all. - * - * Why is this? Since all synchronizations is expected - * to be made using the __atomic builtins, memory - * barriers only have to be issued by some of them, - * and you do not know which ones wont issue memory - * barriers. - * - * One can easily be fooled into believing that when - * using the __ATOMIC_SEQ_CST memory model on all - * operations, all operations will issue full memory - * barriers. This is however not the case. The - * implementation for the x86_64 architecture is an - * example of this. Since all operations except loads - * issue full memory barriers, no memory barriers at - * all is issued by loads. This could also be - * implemented by issuing a full memory barrier on - * loads, but no barrier at all on stores. - * - * What can be used then? - * 1. All (legacy) __sync builtins implying full memory - * barriers issued. - * 2. All __atomic builtins using the __ATOMIC_RELAXED - * memory model can, of course, be used. This since - * no ordering guarantees at all are made. - * 3. All __atomic builtins accessing memory using the - * __ATOMIC_ACQUIRE and __ATOMIC_RELEASE memory - * models. This since an __atomic builtin memory - * access using the __ATOMIC_ACQUIRE must at least - * issue an aquire memory barrier and an __atomic - * builtin memory acess with the __ATOMIC_RELEASE - * memory model must at least issue a release memory - * barrier. Otherwise the two can not be paired. - * 4. All __atomic builtins accessing memory using the - * __ATOMIC_CONSUME builtin can be used for the same - * reason __ATOMIC_ACQUIRE can be used. The ethread - * atomic framework implementing the ethread API - * using native implementations does not expect the - * native implementations to produce versions with - * data dependent read barriers, so until the - * framework is changed we haven't got any use for - * for it. - * - * For some architectures we have our own memory barrier - * implementations. We prefer to use these since they - * should be as fine grained as possible. For other - * architectures we use the __sync_synchronize() builtin - * which issue a full memory barrier. For these - * architectures we have to assume that all loads and - * stores can be reordered without limitation. That is, - * unnecessary memory barriers will be issued if such - * reordering actually cannot occur. */ -/* - * We prefer to use our own memory barrier implementation if - * such exist instead of using __sync_synchronize()... - */ -#if defined(__i386__) || defined(__x86_64__) -# include "../i386/ethr_membar.h" -#elif defined(__sparc__) -# include "../sparc32/ethr_membar.h" -#elif defined(__powerpc__) || defined(__ppc__) || defined(__powerpc64__) -# include "../ppc32/ethr_membar.h" -#elif !defined(ETHR_GCC_ATOMIC_MEMBAR_H__) \ - && (ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION \ - || ETHR_HAVE___sync_synchronize \ - || (ETHR_HAVE___sync_val_compare_and_swap & 12)) -#define ETHR_GCC_ATOMIC_MEMBAR_H__ +#ifndef ETHR_GCC_MEMBAR_H__ +#define ETHR_GCC_MEMBAR_H__ #define ETHR_LoadLoad (1 << 0) #define ETHR_LoadStore (1 << 1) #define ETHR_StoreLoad (1 << 2) #define ETHR_StoreStore (1 << 3) -#define ETHR_COMPILER_BARRIER __asm__ __volatile__("" : : : "memory") - -#if ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION - -static __inline__ __attribute__((__always_inline__)) void -ethr_full_fence__(void) -{ - __asm__ __volatile__("dmb sy" : : : "memory"); -} - -static __inline__ __attribute__((__always_inline__)) void -ethr_store_fence__(void) -{ - __asm__ __volatile__("dmb st" : : : "memory"); -} - -#define ETHR_MEMBAR(B) \ - ETHR_CHOOSE_EXPR((B) == ETHR_StoreStore, ethr_store_fence__(), ethr_full_fence__()) - -#elif ETHR_HAVE___sync_synchronize - -static __inline__ __attribute__((__always_inline__)) void -ethr_full_fence__(void) -{ - /* - * The compiler barriers are here to fix missing clobbers - * in __sync_synchronize() when using buggy LLVM - * implementation of __sync_synchronize(). They - * do not introduce any unnecessary overhead when used - * here, so we use them for all systems. - */ - ETHR_COMPILER_BARRIER; - __sync_synchronize(); - ETHR_COMPILER_BARRIER; -} - -#else /* !ETHR_HAVE___sync_synchronize */ - /* - * Buggy __sync_synchronize(); call __sync_val_compare_and_swap() - * instead which imply a full memory barrier (and hope that one - * isn't buggy too). + * According to the documentation __sync_synchronize() will + * issue a full memory barrier. However, __sync_synchronize() + * is known to erroneously be a noop on at least some + * platforms with some gcc versions. This has suposedly been + * fixed in some gcc version, but we don't know from which + * version. Therefore, we only use it when it has been + * verified to work. Otherwise we use the workaround + * below. */ -#if (ETHR_HAVE___sync_val_compare_and_swap & 4) +#if defined(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32) # define ETHR_MB_T__ ethr_sint32_t -#elif (ETHR_HAVE___sync_val_compare_and_swap & 8) +#elif defined(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64) # define ETHR_MB_T__ ethr_sint64_t +#else +# error "No __sync_val_compare_and_swap" #endif +#define ETHR_SYNC_SYNCHRONIZE_WORKAROUND__ \ +do { \ + volatile ETHR_MB_T__ x___ = 0; \ + (void) __sync_val_compare_and_swap(&x___, (ETHR_MB_T__) 0, (ETHR_MB_T__) 1); \ +} while (0) -static __inline__ __attribute__((__always_inline__)) void -ethr_full_fence__(void) -{ - volatile ETHR_MB_T__ x = 0; - (void) __sync_val_compare_and_swap(&x, (ETHR_MB_T__) 0, (ETHR_MB_T__) 1); -} - -#endif /* !ETHR_HAVE___sync_synchronize */ +#define ETHR_COMPILER_BARRIER __asm__ __volatile__("" : : : "memory") -#ifndef ETHR_MEMBAR -# define ETHR_MEMBAR(B) ethr_full_fence__() +#if defined(__mips__) && ETHR_AT_LEAST_GCC_VSN__(4, 2, 0) +# define ETHR_MEMBAR(B) __sync_synchronize() +# define ETHR_READ_DEPEND_MEMORY_BARRIER __sync_synchronize() +#elif ((defined(__powerpc__) || defined(__ppc__)) \ + && ETHR_AT_LEAST_GCC_VSN__(4, 1, 2)) +# define ETHR_MEMBAR(B) __sync_synchronize() +#else /* Use workaround */ +# define ETHR_MEMBAR(B) \ + ETHR_SYNC_SYNCHRONIZE_WORKAROUND__ +# define ETHR_READ_DEPEND_MEMORY_BARRIER \ + ETHR_SYNC_SYNCHRONIZE_WORKAROUND__ #endif -/* - * Define ETHR_READ_DEPEND_MEMORY_BARRIER for all architechtures - * not known to order data dependent loads - */ - -#if !defined(__ia64__) && !defined(__arm__) -# define ETHR_READ_DEPEND_MEMORY_BARRIER ETHR_MEMBAR(ETHR_LoadLoad) -#endif -#endif /* ETHR_GCC_ATOMIC_MEMBAR_H__ */ +#endif /* ETHR_GCC_MEMBAR_H__ */ diff -Nru erlang-18.2-dfsg/erts/include/internal/i386/atomic.h erlang-17.3-dfsg/erts/include/internal/i386/atomic.h --- erlang-18.2-dfsg/erts/include/internal/i386/atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/i386/atomic.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/i386/ethr_dw_atomic.h erlang-17.3-dfsg/erts/include/internal/i386/ethr_dw_atomic.h --- erlang-18.2-dfsg/erts/include/internal/i386/ethr_dw_atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/i386/ethr_dw_atomic.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/i386/ethread.h erlang-17.3-dfsg/erts/include/internal/i386/ethread.h --- erlang-18.2-dfsg/erts/include/internal/i386/ethread.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/i386/ethread.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/i386/ethr_membar.h erlang-17.3-dfsg/erts/include/internal/i386/ethr_membar.h --- erlang-18.2-dfsg/erts/include/internal/i386/ethr_membar.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/i386/ethr_membar.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/i386/rwlock.h erlang-17.3-dfsg/erts/include/internal/i386/rwlock.h --- erlang-18.2-dfsg/erts/include/internal/i386/rwlock.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/i386/rwlock.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/i386/spinlock.h erlang-17.3-dfsg/erts/include/internal/i386/spinlock.h --- erlang-18.2-dfsg/erts/include/internal/i386/spinlock.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/i386/spinlock.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/libatomic_ops/ethr_atomic.h erlang-17.3-dfsg/erts/include/internal/libatomic_ops/ethr_atomic.h --- erlang-18.2-dfsg/erts/include/internal/libatomic_ops/ethr_atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/libatomic_ops/ethr_atomic.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2010-2014. All Rights Reserved. + * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -33,23 +32,22 @@ * These operations need to be defined by libatomic_ops; * otherwise, we won't compile: * - AO_nop_full() - * - AO_load() || AO_load_aquire() - * - AO_store() || AO_store_release() - * - AO_compare_and_swap() || AO_compare_and_swap_acquire() - * || AO_compare_and_swap_release() || AO_compare_and_swap_full() + * - AO_load() + * - AO_store() + * - AO_compare_and_swap() * */ #if ETHR_SIZEOF_AO_T == 4 #define ETHR_HAVE_NATIVE_ATOMIC32 1 -#define ETHR_NATIVE_ATOMIC32_IMPL ETHR_NATIVE_IMPL__ +#define ETHR_NATIVE_ATOMIC32_IMPL "libatomic_ops" #define ETHR_NATMC_FUNC__(X) ethr_native_atomic32_ ## X #define ETHR_ATMC_T__ ethr_native_atomic32_t #define ETHR_AINT_T__ ethr_sint32_t #define ETHR_AINT_SUFFIX__ "l" #elif ETHR_SIZEOF_AO_T == 8 #define ETHR_HAVE_NATIVE_ATOMIC64 1 -#define ETHR_NATIVE_ATOMIC64_IMPL ETHR_NATIVE_IMPL__ +#define ETHR_NATIVE_ATOMIC64_IMPL "libatomic_ops" #define ETHR_NATMC_FUNC__(X) ethr_native_atomic64_ ## X #define ETHR_ATMC_T__ ethr_native_atomic64_t #define ETHR_AINT_T__ ethr_sint64_t @@ -76,8 +74,6 @@ return (ETHR_AINT_T__ *) &var->counter; } -#ifdef AO_HAVE_store - #if ETHR_SIZEOF_AO_T == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_SET 1 #else @@ -90,24 +86,6 @@ AO_store(&var->counter, (AO_t) value); } -#endif - -#ifdef AO_HAVE_store_write - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_SET_WB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_SET_WB 1 -#endif - -static ETHR_INLINE void -ETHR_NATMC_FUNC__(set_wb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ value) -{ - AO_store_write(&var->counter, (AO_t) value); -} - -#endif - #ifdef AO_HAVE_store_release #if ETHR_SIZEOF_AO_T == 4 @@ -124,24 +102,6 @@ #endif -#ifdef AO_HAVE_store_full - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_SET_MB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_SET_MB 1 -#endif - -static ETHR_INLINE void -ETHR_NATMC_FUNC__(set_mb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ value) -{ - AO_store_full(&var->counter, (AO_t) value); -} - -#endif - -#ifdef AO_HAVE_load - #if ETHR_SIZEOF_AO_T == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_READ 1 #else @@ -154,24 +114,6 @@ return (ETHR_AINT_T__) AO_load(&var->counter); } -#endif - -#ifdef AO_HAVE_load_read - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_READ_RB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_READ_RB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(read_rb)(ETHR_ATMC_T__ *var) -{ - return (ETHR_AINT_T__) AO_load_read(&var->counter); -} - -#endif - #ifdef AO_HAVE_load_acquire #if ETHR_SIZEOF_AO_T == 4 @@ -188,22 +130,6 @@ #endif -#ifdef AO_HAVE_load_full - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_READ_MB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_READ_MB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(read_mb)(ETHR_ATMC_T__ *var) -{ - return (ETHR_AINT_T__) AO_load_full(&var->counter); -} - -#endif - #ifdef AO_HAVE_fetch_and_add #if ETHR_SIZEOF_AO_T == 4 @@ -220,54 +146,6 @@ #endif -#ifdef AO_HAVE_fetch_and_add_acquire - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_ADD_RETURN_ACQB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_ADD_RETURN_ACQB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(add_return_acqb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ incr) -{ - return ((ETHR_AINT_T__) AO_fetch_and_add_acquire(&var->counter, (AO_t) incr)) + incr; -} - -#endif - -#ifdef AO_HAVE_fetch_and_add_release - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_ADD_RETURN_RELB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_ADD_RETURN_RELB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(add_return_relb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ incr) -{ - return ((ETHR_AINT_T__) AO_fetch_and_add_release(&var->counter, (AO_t) incr)) + incr; -} - -#endif - -#ifdef AO_HAVE_fetch_and_add_full - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_ADD_RETURN_MB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_ADD_RETURN_MB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(add_return_mb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ incr) -{ - return ((ETHR_AINT_T__) AO_fetch_and_add_full(&var->counter, (AO_t) incr)) + incr; -} - -#endif - #ifdef AO_HAVE_fetch_and_add1 #if ETHR_SIZEOF_AO_T == 4 @@ -300,38 +178,6 @@ #endif -#ifdef AO_HAVE_fetch_and_add1_release - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_INC_RETURN_RELB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_INC_RETURN_RELB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(inc_return_relb)(ETHR_ATMC_T__ *var) -{ - return ((ETHR_AINT_T__) AO_fetch_and_add1_release(&var->counter)) + 1; -} - -#endif - -#ifdef AO_HAVE_fetch_and_add1_full - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_INC_RETURN_MB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_INC_RETURN_MB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(inc_return_mb)(ETHR_ATMC_T__ *var) -{ - return ((ETHR_AINT_T__) AO_fetch_and_add1_full(&var->counter)) + 1; -} - -#endif - #ifdef AO_HAVE_fetch_and_sub1 #if ETHR_SIZEOF_AO_T == 4 @@ -348,22 +194,6 @@ #endif -#ifdef AO_HAVE_fetch_and_sub1_acquire - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_DEC_RETURN_ACQB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_DEC_RETURN_ACQB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(dec_return_acqb)(ETHR_ATMC_T__ *var) -{ - return ((ETHR_AINT_T__) AO_fetch_and_sub1_acquire(&var->counter)) - 1; -} - -#endif - #ifdef AO_HAVE_fetch_and_sub1_release #if ETHR_SIZEOF_AO_T == 4 @@ -380,60 +210,7 @@ #endif -#ifdef AO_HAVE_fetch_and_sub1_full - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_DEC_RETURN_MB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_DEC_RETURN_MB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(dec_return_mb)(ETHR_ATMC_T__ *var) -{ - return ((ETHR_AINT_T__) AO_fetch_and_sub1_full(&var->counter)) - 1; -} - -#endif - -#if defined(AO_HAVE_compare_and_swap_full) || defined(AO_HAVE_fetch_compare_and_swap_full) - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG_MB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_CMPXCHG_MB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(cmpxchg_mb)(ETHR_ATMC_T__ *var, - ETHR_AINT_T__ new, - ETHR_AINT_T__ exp) -{ -#if defined(AO_HAVE_fetch_compare_and_swap_full) - return (ETHR_AINT_T__) AO_fetch_compare_and_swap_full(&var->counter, - (AO_t) exp, - (AO_t) new); -#else - ETHR_AINT_T__ act; - do { - if (AO_compare_and_swap_full(&var->counter, (AO_t) exp, (AO_t) new)) - return exp; -#ifdef AO_HAVE_load_acquire - act = (ETHR_AINT_T__) AO_load_acquire(&var->counter); -#else - act = (ETHR_AINT_T__) AO_load(&var->counter); -#endif - } while (act == exp); -#ifndef AO_HAVE_load_acquire - AO_nop_full(); -#endif - return act; -#endif -} - -#endif - -#if defined(AO_HAVE_compare_and_swap) || defined(AO_HAVE_fetch_compare_and_swap) +#ifdef AO_HAVE_compare_and_swap #if ETHR_SIZEOF_AO_T == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG 1 @@ -446,28 +223,18 @@ ETHR_AINT_T__ new, ETHR_AINT_T__ exp) { -#if defined(AO_HAVE_fetch_compare_and_swap) - return (ETHR_AINT_T__) AO_fetch_compare_and_swap(&var->counter, - (AO_t) exp, - (AO_t) new); -#else ETHR_AINT_T__ act; do { if (AO_compare_and_swap(&var->counter, (AO_t) exp, (AO_t) new)) return exp; -#ifdef AO_HAVE_load act = (ETHR_AINT_T__) AO_load(&var->counter); -#else - act = (ETHR_AINT_T__) AO_load_aquire(&var->counter); -#endif } while (act == exp); return act; -#endif } #endif -#if defined(AO_HAVE_compare_and_swap_acquire) || defined(AO_HAVE_fetch_compare_and_swap_acquire) +#ifdef AO_HAVE_compare_and_swap_acquire #if ETHR_SIZEOF_AO_T == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG_ACQB 1 @@ -480,11 +247,6 @@ ETHR_AINT_T__ new, ETHR_AINT_T__ exp) { -#if defined(AO_HAVE_fetch_compare_and_swap_acquire) - return (ETHR_AINT_T__) AO_fetch_compare_and_swap_acquire(&var->counter, - (AO_t) exp, - (AO_t) new); -#else ETHR_AINT_T__ act; do { if (AO_compare_and_swap_acquire(&var->counter, (AO_t) exp, (AO_t) new)) @@ -499,55 +261,11 @@ AO_nop_full(); #endif return act; -#endif -} - -#endif - -#if defined(AO_HAVE_compare_and_swap_read) || defined(AO_HAVE_fetch_compare_and_swap_read) - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG_RB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_CMPXCHG_RB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(cmpxchg_rb)(ETHR_ATMC_T__ *var, - ETHR_AINT_T__ new, - ETHR_AINT_T__ exp) -{ -#if defined(AO_HAVE_fetch_compare_and_swap_read) - return (ETHR_AINT_T__) AO_fetch_compare_and_swap_read(&var->counter, - (AO_t) exp, - (AO_t) new); -#else - ETHR_AINT_T__ act; - do { - if (AO_compare_and_swap_read(&var->counter, (AO_t) exp, (AO_t) new)) - return exp; -#if defined(AO_HAVE_load_read) - act = (ETHR_AINT_T__) AO_load_read(&var->counter); -#elif defined(AO_HAVE_load) - act = (ETHR_AINT_T__) AO_load(&var->counter); -#else - act = (ETHR_AINT_T__) AO_load_acquire(&var->counter); -#endif - } while (act == exp); -#ifndef AO_HAVE_load_read -#ifdef AO_HAVE_nop_read - AO_nop_read(); -#else - AO_nop_full(); -#endif -#endif - return act; -#endif } #endif -#if defined(AO_HAVE_compare_and_swap_release) || defined(AO_HAVE_fetch_compare_and_swap_release) +#ifdef AO_HAVE_compare_and_swap_release #if ETHR_SIZEOF_AO_T == 4 # define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG_RELB 1 @@ -560,57 +278,13 @@ ETHR_AINT_T__ new, ETHR_AINT_T__ exp) { -#if defined(AO_HAVE_fetch_compare_and_swap_release) - return (ETHR_AINT_T__) AO_fetch_compare_and_swap_release(&var->counter, - (AO_t) exp, - (AO_t) new); -#else ETHR_AINT_T__ act; do { if (AO_compare_and_swap_release(&var->counter, (AO_t) exp, (AO_t) new)) return exp; -#ifdef AO_HAVE_load - act = (ETHR_AINT_T__) AO_load(&var->counter); -#else - act = (ETHR_AINT_T__) AO_load_acquire(&var->counter); -#endif - } while (act == exp); - return act; -#endif -} - -#endif - -#if defined(AO_HAVE_compare_and_swap_write) || defined(AO_HAVE_fetch_compare_and_swap_write) - -#if ETHR_SIZEOF_AO_T == 4 -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG_WB 1 -#else -# define ETHR_HAVE_ETHR_NATIVE_ATOMIC64_CMPXCHG_WB 1 -#endif - -static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(cmpxchg_wb)(ETHR_ATMC_T__ *var, - ETHR_AINT_T__ new, - ETHR_AINT_T__ exp) -{ -#if defined(AO_HAVE_fetch_compare_and_swap_write) - return (ETHR_AINT_T__) AO_fetch_compare_and_swap_write(&var->counter, - (AO_t) exp, - (AO_t) new); -#else - ETHR_AINT_T__ act; - do { - if (AO_compare_and_swap_write(&var->counter, (AO_t) exp, (AO_t) new)) - return exp; -#ifdef AO_HAVE_load act = (ETHR_AINT_T__) AO_load(&var->counter); -#else - act = (ETHR_AINT_T__) AO_load_acquire(&var->counter); -#endif } while (act == exp); return act; -#endif } #endif diff -Nru erlang-18.2-dfsg/erts/include/internal/libatomic_ops/ethr_dw_atomic.h erlang-17.3-dfsg/erts/include/internal/libatomic_ops/ethr_dw_atomic.h --- erlang-18.2-dfsg/erts/include/internal/libatomic_ops/ethr_dw_atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/libatomic_ops/ethr_dw_atomic.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,568 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2014. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -/* - * Description: Native double word atomics using libatomic_ops - * Author: Rickard Green - */ - -#ifndef ETHR_LIBATOMIC_OPS_DW_ATOMIC_H__ -#define ETHR_LIBATOMIC_OPS_DW_ATOMIC_H__ - -#if defined(AO_HAVE_double_t) \ - && (defined(AO_HAVE_double_load_acquire) \ - || defined(AO_HAVE_double_load)) \ - && (defined(AO_HAVE_compare_double_and_swap_double) \ - || defined(AO_HAVE_compare_double_and_swap_double_full) \ - || defined(AO_HAVE_compare_double_and_swap_double_acquire) \ - || defined(AO_HAVE_compare_double_and_swap_double_release) \ - || defined(AO_HAVE_double_compare_and_swap) \ - || defined(AO_HAVE_double_compare_and_swap_full) \ - || defined(AO_HAVE_double_compare_and_swap_acquire) \ - || defined(AO_HAVE_double_compare_and_swap_release)) - -#if ETHR_SIZEOF_PTR == 4 -# define ETHR_NATIVE_SU_DW_SINT_T ethr_sint64_t -#elif ETHR_SIZEOF_PTR == 8 && defined(ETHR_HAVE_INT128_T) -# define ETHR_NATIVE_SU_DW_SINT_T ethr_sint128_t -#endif - -typedef union { - volatile AO_double_t dw_mem; -#if defined(ETHR_NATIVE_SU_DW_SINT_T) - ETHR_NATIVE_SU_DW_SINT_T su_dw_sint; -#endif -} ethr_native_dw_atomic_t; - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_NATIVE_SU_DW_ATOMIC -#else -# define ETHR_HAVE_NATIVE_DW_ATOMIC -#endif - -#define ETHR_NATIVE_DW_ATOMIC_IMPL ETHR_NATIVE_IMPL__ - -#if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_ATOMIC_IMPL__) - - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_NDWA_FUNC__(Func) ethr_native_su_dw_atomic_ ## Func -# define ETHR_NDWA_RET_3_TYPE__ ETHR_NATIVE_SU_DW_SINT_T -# define ETHR_NDWA_RET_2_TYPE__ ETHR_NATIVE_SU_DW_SINT_T -# define ETHR_NDWA_VAL_ARG_TYPE__ ETHR_NATIVE_SU_DW_SINT_T -# define ETHR_NDWA_DECL_ARG__(Arg) -# if defined(AO_HAVE_DOUBLE_PTR_STORAGE) -# define ETHR_NDWA_VAL2AOVAL__(AOV, V) \ - ((AOV).AO_whole = (double_ptr_storage) (V)) -# define ETHR_NDWA_AOVAL2VAL__(AOV, V) \ - ((V) = (ETHR_NATIVE_SU_DW_SINT_T) (AOV).AO_whole) -# define ETHR_NDWA_RETURN_VAL_3__(SUCCESS, AOVAL, VAL) \ - do { \ - return (ETHR_NATIVE_SU_DW_SINT_T) (AOVAL).AO_whole; \ - } while (0) -# define ETHR_NDWA_RETURN_VAL_2__(AOVAL, VAL) \ - do { \ - return (ETHR_NATIVE_SU_DW_SINT_T) (AOVAL).AO_whole; \ - } while (0) -# define ETHR_NDWA_AOVAL_EQ__(AOV1, AOV2) \ - ((AOV1).AO_whole == (AOV2).AO_whole) -# else -typedef union { - ethr_sint_t sint[2]; - ETHR_NATIVE_SU_DW_SINT_T dw_sint; -} ethr_dw_splitter_t; -# define ETHR_NDWA_VAL2AOVAL__(AOV, V) \ - do { \ - ethr_dw_splitter_t tmp__; \ - tmp__.dw_sint = (V); \ - (AOV).AO_val1 = (AO_t) tmp__.sint[0]; \ - (AOV).AO_val2 = (AO_t) tmp__.sint[1]; \ - } while (0) -# define ETHR_NDWA_AOVAL2VAL__(AOV, V) \ - do { \ - ethr_dw_splitter_t tmp__; \ - tmp__.sint[0] = (ethr_sint_t) (AOV).AO_val1; \ - tmp__.sint[1] = (ethr_sint_t) (AOV).AO_val2; \ - (V) = tmp__.dw_sint; \ - } while (0) -# define ETHR_NDWA_RETURN_VAL_3__(SUCCESS, AOVAL, VAL) \ - do { \ - ethr_dw_splitter_t tmp__; \ - tmp__.sint[0] = (ethr_sint_t) (AOVAL).AO_val1; \ - tmp__.sint[1] = (ethr_sint_t) (AOVAL).AO_val2; \ - return tmp__.dw_sint; \ - } while (0) -# define ETHR_NDWA_AOVAL_EQ__(AOV1, AOV2) \ - ((AOV1).AO_val1 == (AOV2).AO_val1 \ - && (AOV1).AO_val2 == (AOV2).AO_val2) -# endif -#else -# define ETHR_NDWA_FUNC__(Func) ethr_native_dw_atomic_ ## Func -# define ETHR_NDWA_RET_3_TYPE__ int -# define ETHR_NDWA_RET_2_TYPE__ void -# define ETHR_NDWA_VAL_ARG_TYPE__ ethr_sint_t * -# define ETHR_NDWA_DECL_ARG__(Arg) , ETHR_NDWA_VAL_ARG_TYPE__ Arg -# define ETHR_NDWA_VAL2AOVAL__(AOV, V) \ - do { \ - (AOV).AO_val1 = (AO_t) (V)[0]; \ - (AOV).AO_val2 = (AO_t) (V)[1]; \ - } while (0) -# define ETHR_NDWA_AOVAL2VAL__(AOV, V) \ - do { \ - ethr_dw_splitter_t tmp__; \ - (V)[0] = (ethr_sint_t) (AOV).AO_val1; \ - (V)[1] = (ethr_sint_t) (AOV).AO_val2; \ - } while (0) -# define ETHR_NDWA_RETURN_VAL_3__(SUCCESS, AOVAL, VAL) \ - do { \ - (VAL)[0] = (ethr_sint_t) (AOVAL).AO_val1; \ - (VAL)[1] = (ethr_sint_t) (AOVAL).AO_val2; \ - return (SUCCESS); \ - } while (0) -# define ETHR_NDWA_RETURN_VAL_2__(AOVAL, VAL) \ - do { \ - (VAL)[0] = (ethr_sint_t) (AOVAL).AO_val1; \ - (VAL)[1] = (ethr_sint_t) (AOVAL).AO_val2; \ - return; \ - } while (0) -# if defined(AO_HAVE_DOUBLE_PTR_STORAGE) -# define ETHR_NDWA_AOVAL_EQ__(AOV1, AOV2) \ - ((AOV1).AO_whole == (AOV2).AO_whole) -# else -# define ETHR_NDWA_AOVAL_EQ__(AOV1, AOV2) \ - ((AOV1).AO_val1 == (AOV2).AO_val1 \ - && (AOV1).AO_val2 == (AOV2).AO_val2) -# endif -#endif - -#define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_ADDR -static ETHR_INLINE ethr_sint_t * -ethr_native_dw_atomic_addr(ethr_native_dw_atomic_t *var) -{ - return (ethr_sint_t *) &var->dw_mem; -} - -#ifdef AO_HAVE_double_load - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_READ -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_READ -#endif - -static ETHR_INLINE ETHR_NDWA_RET_2_TYPE__ -ETHR_NDWA_FUNC__(read)(ethr_native_dw_atomic_t *var - ETHR_NDWA_DECL_ARG__(val)) -{ - AO_double_t act = AO_double_load(&var->dw_mem); - ETHR_NDWA_RETURN_VAL_2__(act, val); -} - -#endif - -#ifdef AO_HAVE_double_load_read - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_READ_RB -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_READ_RB -#endif - -static ETHR_INLINE ETHR_NDWA_RET_2_TYPE__ -ETHR_NDWA_FUNC__(read_rb)(ethr_native_dw_atomic_t *var - ETHR_NDWA_DECL_ARG__(val)) -{ - AO_double_t act = AO_double_load_read(&var->dw_mem); - ETHR_NDWA_RETURN_VAL_2__(act, val); -} - -#endif - -#ifdef AO_HAVE_double_load_acquire - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_READ_ACQB -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_READ_ACQB -#endif - -static ETHR_INLINE ETHR_NDWA_RET_2_TYPE__ -ETHR_NDWA_FUNC__(read_acqb)(ethr_native_dw_atomic_t *var - ETHR_NDWA_DECL_ARG__(val)) -{ - AO_double_t act = AO_double_load_acquire(&var->dw_mem); - ETHR_NDWA_RETURN_VAL_2__(act, val); -} - -#endif - -#ifdef AO_HAVE_double_store - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_SET -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_SET -#endif - -static ETHR_INLINE void -ETHR_NDWA_FUNC__(set)(ethr_native_dw_atomic_t *var, - ETHR_NDWA_VAL_ARG_TYPE__ val) -{ - AO_double_t new; - ETHR_NDWA_VAL2AOVAL__(new, val); - AO_double_store(&var->dw_mem, new); -} - -#endif - -#ifdef AO_HAVE_double_store_write - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_SET_WB -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_SET_WB -#endif - -static ETHR_INLINE void -ETHR_NDWA_FUNC__(set_wb)(ethr_native_dw_atomic_t *var, - ETHR_NDWA_VAL_ARG_TYPE__ val) -{ - AO_double_t new; - ETHR_NDWA_VAL2AOVAL__(new, val); - AO_double_store_write(&var->dw_mem, new); -} - -#endif - -#ifdef AO_HAVE_double_store_release - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_SET_RELB -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_SET_RELB -#endif - -static ETHR_INLINE void -ETHR_NDWA_FUNC__(set_relb)(ethr_native_dw_atomic_t *var, - ETHR_NDWA_VAL_ARG_TYPE__ val) -{ - AO_double_t new; - ETHR_NDWA_VAL2AOVAL__(new, val); - AO_double_store_release(&var->dw_mem, new); -} - -#endif - -#if defined(AO_HAVE_double_compare_and_swap_full) || defined(AO_HAVE_compare_double_and_swap_double_full) - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_CMPXCHG_MB -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_CMPXCHG_MB -#endif - -static ETHR_INLINE ETHR_NDWA_RET_3_TYPE__ -ETHR_NDWA_FUNC__(cmpxchg_mb)(ethr_native_dw_atomic_t *var, - ETHR_NDWA_VAL_ARG_TYPE__ new, - ETHR_NDWA_VAL_ARG_TYPE__ exp) -{ - AO_double_t ao_act, ao_new, ao_exp; - - ETHR_NDWA_VAL2AOVAL__(ao_exp, exp); - ETHR_NDWA_VAL2AOVAL__(ao_new, new); - - do { - int xchgd; -#if defined(AO_HAVE_double_compare_and_swap_full) - xchgd = AO_double_compare_and_swap_full(&var->dw_mem, ao_exp, ao_new); -#elif defined(AO_HAVE_compare_double_and_swap_double_full) - xchgd = AO_compare_double_and_swap_double_full(&var->dw_mem, - ao_exp.AO_val1, - ao_exp.AO_val2, - ao_new.AO_val1, - ao_new.AO_val2); -#endif - - if (xchgd) - ETHR_NDWA_RETURN_VAL_3__(1, ao_exp, exp); - -#ifdef AO_HAVE_double_load_acquire - ao_act = AO_double_load_acquire(&var->dw_mem); -#else - ao_act = AO_double_load(&var->dw_mem); -#endif - - } while (ETHR_NDWA_AOVAL_EQ__(ao_exp, ao_act)); - -#ifndef AO_HAVE_double_load_acquire - AO_nop_full(); -#endif - - ETHR_NDWA_RETURN_VAL_3__(1, ao_act, exp); -} - -#endif - -#if defined(AO_HAVE_double_compare_and_swap) || defined(AO_HAVE_compare_double_and_swap_double) - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_CMPXCHG -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_CMPXCHG -#endif - -static ETHR_INLINE ETHR_NDWA_RET_3_TYPE__ -ETHR_NDWA_FUNC__(cmpxchg)(ethr_native_dw_atomic_t *var, - ETHR_NDWA_VAL_ARG_TYPE__ new, - ETHR_NDWA_VAL_ARG_TYPE__ exp) -{ - AO_double_t ao_act, ao_new, ao_exp; - - ETHR_NDWA_VAL2AOVAL__(ao_exp, exp); - ETHR_NDWA_VAL2AOVAL__(ao_new, new); - - do { - int xchgd; -#if defined(AO_HAVE_double_compare_and_swap) - xchgd = AO_double_compare_and_swap(&var->dw_mem, ao_exp, ao_new); -#elif defined(AO_HAVE_compare_double_and_swap_double) - xchgd = AO_compare_double_and_swap_double(&var->dw_mem, - ao_exp.AO_val1, - ao_exp.AO_val2, - ao_new.AO_val1, - ao_new.AO_val2); -#endif - - if (xchgd) - ETHR_NDWA_RETURN_VAL_3__(1, ao_exp, exp); - -#ifdef AO_HAVE_double_load - ao_act = AO_double_load(&var->dw_mem); -#else - ao_act = AO_double_load_acquire(&var->dw_mem); -#endif - - } while (ETHR_NDWA_AOVAL_EQ__(ao_exp, ao_act)); - - ETHR_NDWA_RETURN_VAL_3__(1, ao_act, exp); -} - -#endif - -#if defined(AO_HAVE_double_compare_and_swap_read) || defined(AO_HAVE_compare_double_and_swap_double_read) - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_CMPXCHG_RB -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_CMPXCHG_RB -#endif - -static ETHR_INLINE ETHR_NDWA_RET_3_TYPE__ -ETHR_NDWA_FUNC__(cmpxchg_rb)(ethr_native_dw_atomic_t *var, - ETHR_NDWA_VAL_ARG_TYPE__ new, - ETHR_NDWA_VAL_ARG_TYPE__ exp) -{ - AO_double_t ao_act, ao_new, ao_exp; - - ETHR_NDWA_VAL2AOVAL__(ao_exp, exp); - ETHR_NDWA_VAL2AOVAL__(ao_new, new); - - do { - int xchgd; -#if defined(AO_HAVE_double_compare_and_swap_read) - xchgd = AO_double_compare_and_swap_read(&var->dw_mem, ao_exp, ao_new); -#elif defined(AO_HAVE_compare_double_and_swap_double_read) - xchgd = AO_compare_double_and_swap_double_read(&var->dw_mem, - ao_exp.AO_val1, - ao_exp.AO_val2, - ao_new.AO_val1, - ao_new.AO_val2); -#endif - - if (xchgd) - ETHR_NDWA_RETURN_VAL_3__(1, ao_exp, exp); - -#if defined(AO_HAVE_double_load_read) - ao_act = AO_double_load_read(&var->dw_mem); -#elif defined(AO_HAVE_double_load) - ao_act = AO_double_load(&var->dw_mem); -#else - ao_act = AO_double_load_acquire(&var->dw_mem); -#endif - - } while (ETHR_NDWA_AOVAL_EQ__(ao_exp, ao_act)); - -#ifndef AO_HAVE_double_load_read -#ifdef AO_HAVE_nop_read - AO_nop_read(); -#else - AO_nop_full(); -#endif -#endif - - ETHR_NDWA_RETURN_VAL_3__(1, ao_act, exp); -} - -#endif - -#if defined(AO_HAVE_double_compare_and_swap_acquire) || defined(AO_HAVE_compare_double_and_swap_double_acquire) - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_CMPXCHG_ACQB -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_CMPXCHG_ACQB -#endif - -static ETHR_INLINE ETHR_NDWA_RET_3_TYPE__ -ETHR_NDWA_FUNC__(cmpxchg_acqb)(ethr_native_dw_atomic_t *var, - ETHR_NDWA_VAL_ARG_TYPE__ new, - ETHR_NDWA_VAL_ARG_TYPE__ exp) -{ - AO_double_t ao_act, ao_new, ao_exp; - - ETHR_NDWA_VAL2AOVAL__(ao_exp, exp); - ETHR_NDWA_VAL2AOVAL__(ao_new, new); - - do { - int xchgd; -#if defined(AO_HAVE_double_compare_and_swap_acquire) - xchgd = AO_double_compare_and_swap_acquire(&var->dw_mem, ao_exp, ao_new); -#elif defined(AO_HAVE_compare_double_and_swap_double_acquire) - xchgd = AO_compare_double_and_swap_double_acquire(&var->dw_mem, - ao_exp.AO_val1, - ao_exp.AO_val2, - ao_new.AO_val1, - ao_new.AO_val2); -#endif - - if (xchgd) - ETHR_NDWA_RETURN_VAL_3__(1, ao_exp, exp); - -#ifdef AO_HAVE_double_load_acquire - ao_act = AO_double_load_acquire(&var->dw_mem); -#else - ao_act = AO_double_load(&var->dw_mem); -#endif - - } while (ETHR_NDWA_AOVAL_EQ__(ao_exp, ao_act)); - -#ifndef AO_HAVE_double_load_acquire - AO_nop_full(); -#endif - - ETHR_NDWA_RETURN_VAL_3__(1, ao_act, exp); -} - -#endif - -#if defined(AO_HAVE_double_compare_and_swap_write) || defined(AO_HAVE_compare_double_and_swap_double_write) - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_CMPXCHG_WB -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_CMPXCHG_WB -#endif - -static ETHR_INLINE ETHR_NDWA_RET_3_TYPE__ -ETHR_NDWA_FUNC__(cmpxchg_wb)(ethr_native_dw_atomic_t *var, - ETHR_NDWA_VAL_ARG_TYPE__ new, - ETHR_NDWA_VAL_ARG_TYPE__ exp) -{ - AO_double_t ao_act, ao_new, ao_exp; - - ETHR_NDWA_VAL2AOVAL__(ao_exp, exp); - ETHR_NDWA_VAL2AOVAL__(ao_new, new); - - do { - int xchgd; -#if defined(AO_HAVE_double_compare_and_swap_write) - xchgd = AO_double_compare_and_swap_write(&var->dw_mem, ao_exp, ao_new); -#elif defined(AO_HAVE_compare_double_and_swap_double_write) - xchgd = AO_compare_double_and_swap_double_write(&var->dw_mem, - ao_exp.AO_val1, - ao_exp.AO_val2, - ao_new.AO_val1, - ao_new.AO_val2); -#endif - - if (xchgd) - ETHR_NDWA_RETURN_VAL_3__(1, ao_exp, exp); - -#ifdef AO_HAVE_double_load - ao_act = AO_double_load(&var->dw_mem); -#else - ao_act = AO_double_load_acquire(&var->dw_mem); -#endif - - } while (ETHR_NDWA_AOVAL_EQ__(ao_exp, ao_act)); - - ETHR_NDWA_RETURN_VAL_3__(1, ao_act, exp); -} - -#endif - -#if defined(AO_HAVE_double_compare_and_swap_release) || defined(AO_HAVE_compare_double_and_swap_double_release) - -#if defined(ETHR_NATIVE_SU_DW_SINT_T) -# define ETHR_HAVE_ETHR_NATIVE_SU_DW_ATOMIC_CMPXCHG_RELB -#else -# define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_CMPXCHG_RELB -#endif - -static ETHR_INLINE ETHR_NDWA_RET_3_TYPE__ -ETHR_NDWA_FUNC__(cmpxchg_relb)(ethr_native_dw_atomic_t *var, - ETHR_NDWA_VAL_ARG_TYPE__ new, - ETHR_NDWA_VAL_ARG_TYPE__ exp) -{ - AO_double_t ao_act, ao_new, ao_exp; - - ETHR_NDWA_VAL2AOVAL__(ao_exp, exp); - ETHR_NDWA_VAL2AOVAL__(ao_new, new); - - do { - int xchgd; -#if defined(AO_HAVE_double_compare_and_swap_release) - xchgd = AO_double_compare_and_swap_release(&var->dw_mem, ao_exp, ao_new); -#elif defined(AO_HAVE_compare_double_and_swap_double_release) - xchgd = AO_compare_double_and_swap_double_release(&var->dw_mem, - ao_exp.AO_val1, - ao_exp.AO_val2, - ao_new.AO_val1, - ao_new.AO_val2); -#endif - - if (xchgd) - ETHR_NDWA_RETURN_VAL_3__(1, ao_exp, exp); - - ao_act = AO_double_load(&var->dw_mem); - - } while (ETHR_NDWA_AOVAL_EQ__(ao_exp, ao_act)); - - ETHR_NDWA_RETURN_VAL_3__(1, ao_act, exp); -} - -#endif - -#endif /* defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_ATOMIC_IMPL__) */ - -#endif /* Have AO double functionality ... */ - -#endif /* ETHR_LIBATOMIC_OPS_DW_ATOMIC_H__ */ - diff -Nru erlang-18.2-dfsg/erts/include/internal/libatomic_ops/ethread.h erlang-17.3-dfsg/erts/include/internal/libatomic_ops/ethread.h --- erlang-18.2-dfsg/erts/include/internal/libatomic_ops/ethread.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/libatomic_ops/ethread.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -34,12 +33,9 @@ #define AO_USE_PENTIUM4_INSTRS #endif -#define ETHR_NATIVE_IMPL__ "libatomic_ops" - #include "atomic_ops.h" #include "ethr_membar.h" #include "ethr_atomic.h" -#include "ethr_dw_atomic.h" #endif diff -Nru erlang-18.2-dfsg/erts/include/internal/libatomic_ops/ethr_membar.h erlang-17.3-dfsg/erts/include/internal/libatomic_ops/ethr_membar.h --- erlang-18.2-dfsg/erts/include/internal/libatomic_ops/ethr_membar.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/libatomic_ops/ethr_membar.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/ose/ethr_event.h erlang-17.3-dfsg/erts/include/internal/ose/ethr_event.h --- erlang-18.2-dfsg/erts/include/internal/ose/ethr_event.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ose/ethr_event.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/ppc32/atomic.h erlang-17.3-dfsg/erts/include/internal/ppc32/atomic.h --- erlang-18.2-dfsg/erts/include/internal/ppc32/atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ppc32/atomic.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -92,20 +91,6 @@ return res; } - -#ifndef ETHR_PPC_HAVE_NO_LWSYNC - -#define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_ADD_RETURN_RELB 1 - -static ETHR_INLINE ethr_sint32_t -ethr_native_atomic32_add_return_relb(ethr_native_atomic32_t *var, ethr_sint32_t incr) -{ - ethr_lwsync__(); - return ethr_native_atomic32_add_return(var, incr); -} - -#endif - #define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_INC_RETURN 1 static ETHR_INLINE ethr_sint32_t @@ -135,19 +120,7 @@ __asm__ __volatile("isync\n\t" : : : "memory"); return res; } - -#ifndef ETHR_PPC_HAVE_NO_LWSYNC - -#define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_INC_RETURN_RELB 1 - -static ETHR_INLINE ethr_sint32_t -ethr_native_atomic32_inc_return_relb(ethr_native_atomic32_t *var) -{ - ethr_lwsync__(); - return ethr_native_atomic32_inc_return(var); -} - -#endif + #define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_DEC_RETURN 1 @@ -179,19 +152,6 @@ return res; } -#ifndef ETHR_PPC_HAVE_NO_LWSYNC - -#define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_DEC_RETURN_RELB 1 - -static ETHR_INLINE ethr_sint32_t -ethr_native_atomic32_dec_return_relb(ethr_native_atomic32_t *var) -{ - ethr_lwsync__(); - return ethr_native_atomic32_dec_return(var); -} - -#endif - #define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_AND_RETOLD 1 static ETHR_INLINE ethr_sint32_t @@ -222,19 +182,6 @@ return res; } -#ifndef ETHR_PPC_HAVE_NO_LWSYNC - -#define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_AND_RETOLD_RELB 1 - -static ETHR_INLINE ethr_sint32_t -ethr_native_atomic32_and_retold_relb(ethr_native_atomic32_t *var, ethr_sint32_t mask) -{ - ethr_lwsync__(); - return ethr_native_atomic32_and_retold(var, mask); -} - -#endif - #define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_OR_RETOLD 1 static ETHR_INLINE ethr_sint32_t @@ -265,18 +212,6 @@ return res; } -#ifndef ETHR_PPC_HAVE_NO_LWSYNC - -#define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_OR_RETOLD_RELB 1 - -static ETHR_INLINE ethr_sint32_t -ethr_native_atomic32_or_retold_relb(ethr_native_atomic32_t *var, ethr_sint32_t mask) -{ - ethr_lwsync__(); - return ethr_native_atomic32_or_retold(var, mask); -} - -#endif #define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_XCHG 1 @@ -307,19 +242,6 @@ return res; } -#ifndef ETHR_PPC_HAVE_NO_LWSYNC - -#define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_XCHG_RELB 1 - -static ETHR_INLINE ethr_sint32_t -ethr_native_atomic32_xchg_relb(ethr_native_atomic32_t *var, ethr_sint32_t val) -{ - ethr_lwsync__(); - return ethr_native_atomic32_xchg(var, val); -} - -#endif - #define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG 1 static ETHR_INLINE ethr_sint32_t @@ -369,73 +291,6 @@ return old; } -#if !defined(ETHR_DISABLE_LWSYNC_FOR_CMPXCHG_RELB) && !defined(ETHR_PPC_HAVE_NO_LWSYNC) - -#define ETHR_HAVE_ETHR_NATIVE_ATOMIC32_CMPXCHG_RELB 1 - -static ETHR_INLINE ethr_sint32_t -ethr_native_atomic32_cmpxchg_relb(ethr_native_atomic32_t *var, - ethr_sint32_t new, - ethr_sint32_t expected) -{ - ethr_sint32_t actual; - - /* - * We want to implement the release barrier using the - * 'lwsync' instruction instead of using the more - * expensive 'sync' instruction. - * - * cmpxchg looks something like this: - * - * lwarx # Load - * ... - * if (fail) - * goto done; - * stwcx # Store - * if (fail) - * goto done; - * ... - * - * In the case we succeeded, 'lwsync' will have - * ordered all previously issued loads and stores - * against the successful store to this variable. - * That is everything is fine! - * - * In the case we did not succeed, we need to order - * all previously issued loads and stores against - * the load of this variable. 'lwsync' does not - * guarantee this. In order to solve this we issue - * a 'sync' and redo the load. If the value has - * changed to what the user passed as expected value - * we need to try the cmpxchg operation again, since - * this value indicates success. - */ - - ethr_lwsync__(); - - actual = ethr_native_atomic32_cmpxchg(var, new, expected); - -#ifndef ETHR_PPC_HAVE_LWSYNC - /* We checked for lwsync support in runtime... */ - if (ETHR_PPC_RUNTIME_CONF_HAVE_NO_LWSYNC__) - return actual; /* No need to; ethr_lwsync__() issued a sync... */ -#endif - - /* ethr_lwsync__() issued an lwsync... */ - if (actual == expected) - return actual; /* Successful operation */ - - /* Failure... need to issue a sync... */ - ethr_sync__(); - actual = ethr_native_atomic32_read(var); - if (actual != expected) - return actual; /* Fail... */ - /* Try again... */ - return ethr_native_atomic32_cmpxchg(var, new, expected); -} - -#endif - #endif /* ETHR_TRY_INLINE_FUNCS */ #endif /* ETHREAD_PPC_ATOMIC_H */ diff -Nru erlang-18.2-dfsg/erts/include/internal/ppc32/ethread.h erlang-17.3-dfsg/erts/include/internal/ppc32/ethread.h --- erlang-18.2-dfsg/erts/include/internal/ppc32/ethread.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ppc32/ethread.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/ppc32/ethr_membar.h erlang-17.3-dfsg/erts/include/internal/ppc32/ethr_membar.h --- erlang-18.2-dfsg/erts/include/internal/ppc32/ethr_membar.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ppc32/ethr_membar.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/ppc32/rwlock.h erlang-17.3-dfsg/erts/include/internal/ppc32/rwlock.h --- erlang-18.2-dfsg/erts/include/internal/ppc32/rwlock.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ppc32/rwlock.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/ppc32/spinlock.h erlang-17.3-dfsg/erts/include/internal/ppc32/spinlock.h --- erlang-18.2-dfsg/erts/include/internal/ppc32/spinlock.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/ppc32/spinlock.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/pthread/ethr_event.h erlang-17.3-dfsg/erts/include/internal/pthread/ethr_event.h --- erlang-18.2-dfsg/erts/include/internal/pthread/ethr_event.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/pthread/ethr_event.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -47,12 +46,12 @@ ethr_atomic32_t futex; } ethr_event; -#define ETHR_FUTEX__(FTX, OP, VAL, TIMEOUT) \ +#define ETHR_FUTEX__(FTX, OP, VAL) \ (-1 == syscall(__NR_futex, \ (void *) ethr_atomic32_addr((FTX)), \ (OP), \ (int) (VAL), \ - (TIMEOUT), \ + NULL, \ NULL, \ 0) \ ? errno : 0) @@ -65,7 +64,7 @@ ethr_sint32_t val; val = ethr_atomic32_xchg_mb(&e->futex, ETHR_EVENT_ON__); if (val == ETHR_EVENT_OFF_WAITER__) { - int res = ETHR_FUTEX__(&e->futex, ETHR_FUTEX_WAKE__, 1, NULL); + int res = ETHR_FUTEX__(&e->futex, ETHR_FUTEX_WAKE__, 1); if (res != 0) ETHR_FATAL_ERROR__(res); } @@ -81,68 +80,35 @@ #endif #elif defined(ETHR_PTHREADS) -/* --- Posix mutex/cond pipe/select implementation of events ---------------- */ - -#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__) -# define __DARWIN__ 1 -#endif - -#ifdef __DARWIN__ -typedef struct ethr_event_fdsets___ ethr_event_fdsets__; -#endif +/* --- Posix mutex/cond implementation of events ---------------------------- */ typedef struct { ethr_atomic32_t state; pthread_mutex_t mtx; pthread_cond_t cnd; - int fd[2]; -#ifdef __DARWIN__ - ethr_event_fdsets__ *fdsets; -#endif } ethr_event; -#define ETHR_EVENT_OFF_WAITER_SELECT__ ((ethr_sint32_t) -2) -#define ETHR_EVENT_OFF_WAITER__ ((ethr_sint32_t) -1) -#define ETHR_EVENT_OFF__ ((ethr_sint32_t) 1) -#define ETHR_EVENT_ON__ ((ethr_sint32_t) 0) - -#define ETHR_EVENT_IS_WAITING__(VAL) ((VAL) < 0) +#define ETHR_EVENT_OFF_WAITER__ -1L +#define ETHR_EVENT_OFF__ 1L +#define ETHR_EVENT_ON__ 0L #if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_EVENT_IMPL__) -#ifndef ETHR_HAVE_PTHREAD_TIMED_COND_MONOTONIC -#include -#include -#endif - static void ETHR_INLINE ETHR_INLINE_FUNC_NAME_(ethr_event_set)(ethr_event *e) { ethr_sint32_t val; val = ethr_atomic32_xchg_mb(&e->state, ETHR_EVENT_ON__); - if (ETHR_EVENT_IS_WAITING__(val)) { - int res; - if (val == ETHR_EVENT_OFF_WAITER_SELECT__) { - ssize_t wres; - int fd = e->fd[1]; - ETHR_ASSERT(fd >= 0); - do { - wres = write(fd, "!", 1); - } while (wres < 0 && errno == EINTR); - if (wres < 0 && errno != EAGAIN && errno != EWOULDBLOCK) - ETHR_FATAL_ERROR__(errno); - } - else { - res = pthread_mutex_lock(&e->mtx); - if (res != 0) - ETHR_FATAL_ERROR__(res); - res = pthread_cond_signal(&e->cnd); - if (res != 0) - ETHR_FATAL_ERROR__(res); - res = pthread_mutex_unlock(&e->mtx); - if (res != 0) - ETHR_FATAL_ERROR__(res); - } + if (val == ETHR_EVENT_OFF_WAITER__) { + int res = pthread_mutex_lock(&e->mtx); + if (res != 0) + ETHR_FATAL_ERROR__(res); + res = pthread_cond_signal(&e->cnd); + if (res != 0) + ETHR_FATAL_ERROR__(res); + res = pthread_mutex_unlock(&e->mtx); + if (res != 0) + ETHR_FATAL_ERROR__(res); } } @@ -158,12 +124,9 @@ #endif int ethr_event_init(ethr_event *e); -int ethr_event_prepare_timed(ethr_event *e); int ethr_event_destroy(ethr_event *e); int ethr_event_wait(ethr_event *e); int ethr_event_swait(ethr_event *e, int spincount); -int ethr_event_twait(ethr_event *e, ethr_sint64_t timeout); -int ethr_event_stwait(ethr_event *e, int spincount, ethr_sint64_t timeout); #if !defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_EVENT_IMPL__) void ethr_event_set(ethr_event *e); void ethr_event_reset(ethr_event *e); diff -Nru erlang-18.2-dfsg/erts/include/internal/README erlang-17.3-dfsg/erts/include/internal/README --- erlang-18.2-dfsg/erts/include/internal/README 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/README 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ Copyright Ericsson AB 2004-2009. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/include/internal/sparc32/atomic.h erlang-17.3-dfsg/erts/include/internal/sparc32/atomic.h --- erlang-18.2-dfsg/erts/include/internal/sparc32/atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/sparc32/atomic.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/sparc32/ethread.h erlang-17.3-dfsg/erts/include/internal/sparc32/ethread.h --- erlang-18.2-dfsg/erts/include/internal/sparc32/ethread.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/sparc32/ethread.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/sparc32/ethr_membar.h erlang-17.3-dfsg/erts/include/internal/sparc32/ethr_membar.h --- erlang-18.2-dfsg/erts/include/internal/sparc32/ethr_membar.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/sparc32/ethr_membar.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/sparc32/rwlock.h erlang-17.3-dfsg/erts/include/internal/sparc32/rwlock.h --- erlang-18.2-dfsg/erts/include/internal/sparc32/rwlock.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/sparc32/rwlock.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/sparc32/spinlock.h erlang-17.3-dfsg/erts/include/internal/sparc32/spinlock.h --- erlang-18.2-dfsg/erts/include/internal/sparc32/spinlock.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/sparc32/spinlock.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/sparc64/ethread.h erlang-17.3-dfsg/erts/include/internal/sparc64/ethread.h --- erlang-18.2-dfsg/erts/include/internal/sparc64/ethread.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/sparc64/ethread.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/tile/atomic.h erlang-17.3-dfsg/erts/include/internal/tile/atomic.h --- erlang-18.2-dfsg/erts/include/internal/tile/atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/tile/atomic.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/tile/ethread.h erlang-17.3-dfsg/erts/include/internal/tile/ethread.h --- erlang-18.2-dfsg/erts/include/internal/tile/ethread.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/tile/ethread.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/tile/ethr_membar.h erlang-17.3-dfsg/erts/include/internal/tile/ethr_membar.h --- erlang-18.2-dfsg/erts/include/internal/tile/ethr_membar.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/tile/ethr_membar.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/win/ethr_atomic.h erlang-17.3-dfsg/erts/include/internal/win/ethr_atomic.h --- erlang-18.2-dfsg/erts/include/internal/win/ethr_atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/win/ethr_atomic.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/win/ethr_dw_atomic.h erlang-17.3-dfsg/erts/include/internal/win/ethr_dw_atomic.h --- erlang-18.2-dfsg/erts/include/internal/win/ethr_dw_atomic.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/win/ethr_dw_atomic.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/win/ethread.h erlang-17.3-dfsg/erts/include/internal/win/ethread.h --- erlang-18.2-dfsg/erts/include/internal/win/ethread.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/win/ethread.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/win/ethr_event.h erlang-17.3-dfsg/erts/include/internal/win/ethr_event.h --- erlang-18.2-dfsg/erts/include/internal/win/ethr_event.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/win/ethr_event.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -56,12 +55,9 @@ #endif int ethr_event_init(ethr_event *e); -int ethr_event_prepare_timed(ethr_event *e); int ethr_event_destroy(ethr_event *e); int ethr_event_wait(ethr_event *e); int ethr_event_swait(ethr_event *e, int spincount); -int ethr_event_twait(ethr_event *e, ethr_sint64_t timeout); -int ethr_event_stwait(ethr_event *e, int spincount, ethr_sint64_t timeout); #if !defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_EVENT_IMPL__) void ethr_event_set(ethr_event *e); void ethr_event_reset(ethr_event *e); diff -Nru erlang-18.2-dfsg/erts/include/internal/win/ethr_membar.h erlang-17.3-dfsg/erts/include/internal/win/ethr_membar.h --- erlang-18.2-dfsg/erts/include/internal/win/ethr_membar.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/win/ethr_membar.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/include/internal/x86_64/ethread.h erlang-17.3-dfsg/erts/include/internal/x86_64/ethread.h --- erlang-18.2-dfsg/erts/include/internal/x86_64/ethread.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/include/internal/x86_64/ethread.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/lib/internal/README erlang-17.3-dfsg/erts/lib/internal/README --- erlang-18.2-dfsg/erts/lib/internal/README 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib/internal/README 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ Copyright Ericsson AB 2004-2009. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. %CopyrightEnd% diff -Nru erlang-18.2-dfsg/erts/lib_src/common/erl_memory_trace_parser.c erlang-17.3-dfsg/erts/lib_src/common/erl_memory_trace_parser.c --- erlang-18.2-dfsg/erts/lib_src/common/erl_memory_trace_parser.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/common/erl_memory_trace_parser.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/lib_src/common/erl_misc_utils.c erlang-17.3-dfsg/erts/lib_src/common/erl_misc_utils.c --- erlang-18.2-dfsg/erts/lib_src/common/erl_misc_utils.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/common/erl_misc_utils.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2006-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -1516,7 +1515,7 @@ if (is_thread_group) { thread++; } else { - *core_p = (*core_p) + 1; + *core_p = (*core_p)++; } index_procs++; } @@ -1536,9 +1535,9 @@ if (parentCacheLevel == 0) { *core_p = 0; - *processor_p = (*processor_p) + 1; + *processor_p = (*processor_p)++; } else { - *core_p = (*core_p) + 1; + *core_p = (*core_p)++; } if (error) diff -Nru erlang-18.2-dfsg/erts/lib_src/common/erl_printf.c erlang-17.3-dfsg/erts/lib_src/common/erl_printf.c --- erlang-18.2-dfsg/erts/lib_src/common/erl_printf.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/common/erl_printf.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -88,41 +87,6 @@ # define FWRITE fwrite #endif -/* We use write for stdout and stderr as they could be - set to non-blocking by shell drivers, and non-blocking - FILE * functions work unpredictably as best */ -static int -printf_putc(int c, FILE *stream) { - if ((FILE*)stream == stdout || (FILE*)stream == stderr) { - int fd = stream == stdout ? fileno(stdout) : fileno(stderr); - /* cast to a char here, because write expects bytes. */ - unsigned char buf[1] = { c }; - int res; - do { - res = write(fd, buf, 1); - } while (res == -1 && (errno == EAGAIN || errno == EINTR)); - if (res == -1) return EOF; - return res; - } - - return PUTC(c, stream); -} - -static size_t -printf_fwrite(const void *ptr, size_t size, size_t nitems, - FILE *stream) { - if ((FILE*)stream == stdout || (FILE*)stream == stderr) { - int fd = stream == stdout ? fileno(stdout) : fileno(stderr); - int res; - do { - res = write(fd, ptr, size*nitems); - } while (res == -1 && (errno == EAGAIN || errno == EINTR)); - if (res == -1) return 0; - return res; - } - return FWRITE(ptr, size, nitems, stream); -} - static int get_error_result(void) { @@ -139,10 +103,10 @@ size_t i; ASSERT(vfp); for (i = 0; i < len; i++) { - if (buf[i] == '\n' && printf_putc('\r', (FILE *) vfp) == EOF) - return get_error_result(); - if (printf_putc(buf[i], (FILE *) vfp) == EOF) - return get_error_result(); + if (buf[i] == '\n' && PUTC('\r', (FILE *) vfp) == EOF) + return get_error_result(); + if (PUTC(buf[i], (FILE *) vfp) == EOF) + return get_error_result(); } return len; } @@ -155,12 +119,12 @@ if (len <= 64) { /* Try to optimize writes of small bufs. */ int i; for (i = 0; i < len; i++) - if (printf_putc(buf[i], (FILE *) vfp) == EOF) + if (PUTC(buf[i], (FILE *) vfp) == EOF) return get_error_result(); } else #endif - if (printf_fwrite((void *) buf, sizeof(char), len, (FILE *) vfp) != len) + if (FWRITE((void *) buf, sizeof(char), len, (FILE *) vfp) != len) return get_error_result(); return len; } diff -Nru erlang-18.2-dfsg/erts/lib_src/common/erl_printf_format.c erlang-17.3-dfsg/erts/lib_src/common/erl_printf_format.c --- erlang-18.2-dfsg/erts/lib_src/common/erl_printf_format.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/common/erl_printf_format.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/lib_src/common/ethr_atomics.c erlang-17.3-dfsg/erts/lib_src/common/ethr_atomics.c --- erlang-18.2-dfsg/erts/lib_src/common/ethr_atomics.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/common/ethr_atomics.c 2014-09-16 19:10:57.000000000 +0000 @@ -12,17 +12,16 @@ * * Copyright Ericsson AB 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/lib_src/common/ethr_aux.c erlang-17.3-dfsg/erts/lib_src/common/ethr_aux.c --- erlang-18.2-dfsg/erts/lib_src/common/ethr_aux.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/common/ethr_aux.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -41,8 +40,8 @@ #include #endif -#define ERTS_TS_EV_ALLOC_DEFAULT_POOL_SIZE 2048 -#define ERTS_TS_EV_ALLOC_POOL_SIZE 32 +#define ERTS_TS_EV_ALLOC_DEFAULT_POOL_SIZE 4000 +#define ERTS_TS_EV_ALLOC_POOL_SIZE 25 erts_cpu_info_t *ethr_cpu_info__; @@ -149,8 +148,6 @@ { int res; - ethr_init_event__(); - #if defined(ETHR_X86_RUNTIME_CONF__) x86_init(); #endif diff -Nru erlang-18.2-dfsg/erts/lib_src/common/ethr_cbf.c erlang-17.3-dfsg/erts/lib_src/common/ethr_cbf.c --- erlang-18.2-dfsg/erts/lib_src/common/ethr_cbf.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/common/ethr_cbf.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/lib_src/common/ethr_mutex.c erlang-17.3-dfsg/erts/lib_src/common/ethr_mutex.c --- erlang-18.2-dfsg/erts/lib_src/common/ethr_mutex.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/common/ethr_mutex.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/lib_src/Makefile erlang-17.3-dfsg/erts/lib_src/Makefile --- erlang-18.2-dfsg/erts/lib_src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/lib_src/Makefile.in erlang-17.3-dfsg/erts/lib_src/Makefile.in --- erlang-18.2-dfsg/erts/lib_src/Makefile.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/Makefile.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -93,11 +92,6 @@ OMIT_OMIT_FP=yes PRE_LD= else -ifeq ($(TYPE),icount) -TYPE_SUFFIX = .icount -CFLAGS += -DERTS_OPCODE_COUNTER_SUPPORT -PRE_LD= -else override TYPE=opt OMIT_FP=true TYPE_SUFFIX= @@ -105,7 +99,6 @@ endif endif endif -endif endif endif endif diff -Nru erlang-18.2-dfsg/erts/lib_src/ose/ethread.c erlang-17.3-dfsg/erts/lib_src/ose/ethread.c --- erlang-18.2-dfsg/erts/lib_src/ose/ethread.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/ose/ethread.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/lib_src/ose/ethr_event.c erlang-17.3-dfsg/erts/lib_src/ose/ethr_event.c --- erlang-18.2-dfsg/erts/lib_src/ose/ethr_event.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/ose/ethr_event.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/lib_src/pthread/ethread.c erlang-17.3-dfsg/erts/lib_src/pthread/ethread.c --- erlang-18.2-dfsg/erts/lib_src/pthread/ethread.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/pthread/ethread.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -43,7 +42,6 @@ #include #include #include -#include #include @@ -51,8 +49,6 @@ #define ETHREAD_IMPL__ #include "ethread.h" -#undef ETHR_INCLUDE_MONOTONIC_CLOCK__ -#define ETHR_INCLUDE_MONOTONIC_CLOCK__ #include "ethr_internal.h" #ifndef ETHR_HAVE_ETHREAD_DEFINES @@ -81,8 +77,6 @@ void *(*thr_func)(void *); void *arg; void *prep_func_res; - char *name; - char name_buff[16]; } ethr_thr_wrap_data__; static void *thr_wrapper(void *vtwd) @@ -104,8 +98,6 @@ tsep = twd->tse; /* We aren't allowed to follow twd after result has been set! */ - if (twd->name) - ethr_setname(twd->name); ethr_atomic32_set(&twd->result, result); @@ -240,10 +232,6 @@ #endif /* ETHR_X86_RUNTIME_CONF__ */ -#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME -static void init_get_monotonic_time(void); -#endif - /* * -------------------------------------------------------------------------- * Exported functions @@ -266,10 +254,6 @@ goto error; #endif -#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME - init_get_monotonic_time(); -#endif - res = ethr_init_common__(id); if (res != 0) goto error; @@ -331,12 +315,6 @@ twd.thr_func = func; twd.arg = arg; - if (opts && opts->name) { - snprintf(twd.name_buff, 16, "%s", opts->name); - twd.name = twd.name_buff; - } else - twd.name = NULL; - res = pthread_attr_init(&attr); if (res != 0) return res; @@ -467,30 +445,6 @@ } int -ethr_getname(ethr_tid tid, char *buf, size_t len) -{ -#if defined(ETHR_HAVE_PTHREAD_GETNAME_NP_3) - return pthread_getname_np((pthread_t) tid, buf, len); -#elif defined(ETHR_HAVE_PTHREAD_GETNAME_NP_2) - return pthread_getname_np((pthread_t) tid, buf); -#else - return ENOSYS; -#endif -} - -void -ethr_setname(char *name) -{ -#if defined(ETHR_HAVE_PTHREAD_SETNAME_NP_2) - pthread_setname_np(ethr_self(), name); -#elif defined(ETHR_HAVE_PTHREAD_SET_NAME_NP_2) - pthread_set_name_np(ethr_self(), name); -#elif defined(ETHR_HAVE_PTHREAD_SETNAME_NP_1) - pthread_setname_np(name); -#endif -} - -int ethr_equal_tids(ethr_tid tid1, ethr_tid tid2) { return pthread_equal((pthread_t) tid1, (pthread_t) tid2); @@ -611,157 +565,8 @@ return 0; } -int ethr_kill(const ethr_tid tid, const int sig) -{ -#if ETHR_XCHK - if (ethr_not_inited__) { - ETHR_ASSERT(0); - return EACCES; - } -#endif - return pthread_kill((const pthread_t)tid, sig); -} - #endif /* #if ETHR_HAVE_ETHR_SIG_FUNCS */ -#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME - -static int broken_get_monotonic_time; - -#if defined(ETHR_HAVE_CLOCK_GETTIME_MONOTONIC) -# ifndef ETHR_MONOTONIC_CLOCK_ID -# error ETHR_MONOTONIC_CLOCK_ID should have been defined -# endif - -ethr_sint64_t -ethr_get_monotonic_time(void) -{ - ethr_sint64_t time; - struct timespec ts; - - if (broken_get_monotonic_time) - return (ethr_sint64_t) 0; - - if (0 != clock_gettime(ETHR_MONOTONIC_CLOCK_ID, &ts)) - ETHR_FATAL_ERROR__(errno); - - time = (ethr_sint64_t) ts.tv_sec; - time *= (ethr_sint64_t) 1000*1000*1000; - time += (ethr_sint64_t) ts.tv_nsec; - return time; -} - -#elif defined(ETHR_HAVE_MACH_CLOCK_GET_TIME) -# ifndef ETHR_MONOTONIC_CLOCK_ID -# error ETHR_MONOTONIC_CLOCK_ID should have been defined -# endif - -ethr_sint64_t -ethr_get_monotonic_time(void) -{ - ethr_sint64_t time; - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - if (broken_get_monotonic_time) - return (ethr_sint64_t) 0; - - errno = EFAULT; - host_get_clock_service(mach_host_self(), - ETHR_MONOTONIC_CLOCK_ID, - &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - if (res != KERN_SUCCESS) - ETHR_FATAL_ERROR__(errno); - mach_port_deallocate(mach_task_self(), clk_srv); - - time = (ethr_sint64_t) time_spec.tv_sec; - time *= (ethr_sint64_t) 1000*1000*1000; - time += (ethr_sint64_t) time_spec.tv_nsec; - return time; -} - -#elif defined(ETHR_HAVE_GETHRTIME) - -ethr_sint64_t -ethr_get_monotonic_time(void) -{ - if (broken_get_monotonic_time) - return (ethr_sint64_t) 0; - return (ethr_sint64_t) gethrtime(); -} - -#else -#error missing monotonic clock -#endif - -int -ethr_get_monotonic_time_is_broken(void) -{ - return broken_get_monotonic_time; -} - -#include -#include -#include - -static void -init_get_monotonic_time(void) -{ - struct utsname uts; - int vsn[3]; - int i; - char *c; - - broken_get_monotonic_time = 0; - - (void) uname(&uts); - - for (c = uts.sysname; *c; c++) { - if (isupper((int) *c)) - *c = tolower((int) *c); - } - - c = uts.release; - for (i = 0; i < sizeof(vsn)/sizeof(int); i++) { - if (!isdigit((int) *c)) - vsn[i] = 0; - else { - char *c2 = c; - do { - c2++; - } while (isdigit((int) *c2)); - *c2 = '\0'; - vsn[i] = atoi(c); - c = c2; - c++; - } - } - - if (strcmp("linux", uts.sysname) == 0) { - if (vsn[0] < 2 - || (vsn[0] == 2 && vsn[1] < 6) - || (vsn[0] == 2 && vsn[1] == 6 && vsn[2] < 33)) { - broken_get_monotonic_time = 1; - } - } - else if (strcmp("sunos", uts.sysname) == 0) { - if ((vsn[0] < 5 - || (vsn[0] == 5 && vsn[1] < 8)) -#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF) - && sysconf(_SC_NPROCESSORS_CONF) > 1 -#endif - ) { - broken_get_monotonic_time = 1; - } - } - -} - - -#endif /* ETHR_HAVE_ETHR_GET_MONOTONIC_TIME */ - ETHR_IMPL_NORETURN__ ethr_abort__(void) { diff -Nru erlang-18.2-dfsg/erts/lib_src/pthread/ethr_event.c erlang-17.3-dfsg/erts/lib_src/pthread/ethr_event.c --- erlang-18.2-dfsg/erts/lib_src/pthread/ethr_event.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/pthread/ethr_event.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -29,17 +28,7 @@ #include "config.h" #endif -#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__) -# define __DARWIN__ 1 -#endif -#ifdef __DARWIN__ -# define _DARWIN_UNLIMITED_SELECT -#endif - #include "ethread.h" -#undef ETHR_INCLUDE_MONOTONIC_CLOCK__ -#define ETHR_INCLUDE_MONOTONIC_CLOCK__ -#include "ethr_internal.h" #if defined(ETHR_LINUX_FUTEX_IMPL__) /* --- Linux futex implementation of ethread events ------------------------- */ @@ -49,12 +38,6 @@ #define ETHR_YIELD_AFTER_BUSY_LOOPS 50 -void -ethr_init_event__(void) -{ - -} - int ethr_event_init(ethr_event *e) { @@ -63,55 +46,27 @@ } int -ethr_event_prepare_timed(ethr_event *e) -{ - return 0; -} - -int ethr_event_destroy(ethr_event *e) { return 0; } static ETHR_INLINE int -wait__(ethr_event *e, int spincount, ethr_sint64_t timeout) +wait__(ethr_event *e, int spincount) { unsigned sc = spincount; int res; ethr_sint32_t val; int until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS; - ethr_sint64_t time = 0; /* SHUT UP annoying faulty warning... */ - struct timespec ts, *tsp; -#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME - ethr_sint64_t start = 0; /* SHUT UP annoying faulty warning... */ -#endif if (spincount < 0) ETHR_FATAL_ERROR__(EINVAL); - if (timeout < 0) { - tsp = NULL; - } - else { - tsp = &ts; - time = timeout; - if (spincount == 0) { - val = ethr_atomic32_read(&e->futex); - if (val == ETHR_EVENT_ON__) - goto return_event_on; - goto set_timeout; - } -#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME - start = ethr_get_monotonic_time(); -#endif - } - while (1) { while (1) { val = ethr_atomic32_read(&e->futex); if (val == ETHR_EVENT_ON__) - goto return_event_on; + return 0; if (sc == 0) break; sc--; @@ -124,200 +79,44 @@ } } - if (timeout >= 0) { -#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME - time = timeout - (ethr_get_monotonic_time() - start); -#endif - set_timeout: - if (time <= 0) { - val = ethr_atomic32_read(&e->futex); - if (val == ETHR_EVENT_ON__) - goto return_event_on; - return ETIMEDOUT; - } - ts.tv_sec = time / (1000*1000*1000); - ts.tv_nsec = time % (1000*1000*1000); - } - if (val != ETHR_EVENT_OFF_WAITER__) { val = ethr_atomic32_cmpxchg(&e->futex, ETHR_EVENT_OFF_WAITER__, ETHR_EVENT_OFF__); if (val == ETHR_EVENT_ON__) - goto return_event_on; + return 0; ETHR_ASSERT(val == ETHR_EVENT_OFF__); } res = ETHR_FUTEX__(&e->futex, ETHR_FUTEX_WAIT__, - ETHR_EVENT_OFF_WAITER__, - tsp); - switch (res) { - case EINTR: - case ETIMEDOUT: - return res; - case 0: - case EWOULDBLOCK: + ETHR_EVENT_OFF_WAITER__); + if (res == EINTR) break; - default: + if (res != 0 && res != EWOULDBLOCK) ETHR_FATAL_ERROR__(res); - } } -return_event_on: - - ETHR_MEMBAR(ETHR_LoadLoad|ETHR_LoadStore); - - return 0; - + return res; } #elif defined(ETHR_PTHREADS) -/* --- Posix mutex/cond pipe/select implementation of events ---------------- */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef __DARWIN__ - -struct ethr_event_fdsets___ { - fd_set *rsetp; - fd_set *esetp; - size_t mem_size; - fd_mask mem[1]; -}; - -#endif - -static void -setup_nonblocking_pipe(ethr_event *e) -{ - int flgs; - int res; - - res = pipe(e->fd); - if (res != 0) - ETHR_FATAL_ERROR__(errno); - - ETHR_ASSERT(e->fd[0] >= 0 && e->fd[1] >= 0); - - flgs = fcntl(e->fd[0], F_GETFL, 0); - fcntl(e->fd[0], F_SETFL, flgs | O_NONBLOCK); - flgs = fcntl(e->fd[1], F_GETFL, 0); - fcntl(e->fd[1], F_SETFL, flgs | O_NONBLOCK); - - -#ifndef __DARWIN__ - if (e->fd[0] >= FD_SETSIZE) - ETHR_FATAL_ERROR__(ENOTSUP); -#else - { - int nmasks; - ethr_event_fdsets__ *fdsets; - size_t mem_size; - - nmasks = (e->fd[0]+NFDBITS)/NFDBITS; - mem_size = 2*nmasks*sizeof(fd_mask); - if (mem_size < 2*sizeof(fd_set)) { - mem_size = 2*sizeof(fd_set); - nmasks = mem_size/(2*sizeof(fd_mask)); - } - - fdsets = malloc(sizeof(ethr_event_fdsets__) - + mem_size - - sizeof(fd_mask)); - if (!fdsets) - ETHR_FATAL_ERROR__(ENOMEM); - fdsets->rsetp = (fd_set *) (char *) &fdsets->mem[0]; - fdsets->esetp = (fd_set *) (char *) &fdsets->mem[nmasks]; - fdsets->mem_size = mem_size; - e->fdsets = fdsets; - } -#endif - - ETHR_MEMBAR(ETHR_StoreStore); -} - -#define ETHR_EVENT_INVALID_FD__ -1 -#define ETHR_EVENT_COND_TIMEDWAIT__ -2 - -#ifdef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC -static pthread_condattr_t monotonic_clock_cond_attr; -#endif -static pthread_condattr_t *monotonic_clock_cond_attr_p; - -#ifndef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME -# undef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC -#endif -#ifndef ETHR_MONOTONIC_CLOCK_ID -# undef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC -#endif - -void -ethr_init_event__(void) -{ - monotonic_clock_cond_attr_p = NULL; -#ifdef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC - if (!ethr_get_monotonic_time_is_broken() - && pthread_condattr_init(&monotonic_clock_cond_attr) == 0) { - if (pthread_condattr_setclock(&monotonic_clock_cond_attr, - ETHR_MONOTONIC_CLOCK_ID) == 0) - monotonic_clock_cond_attr_p = &monotonic_clock_cond_attr; - else - pthread_condattr_destroy(&monotonic_clock_cond_attr); - } -#endif -} +/* --- Posix mutex/cond implementation of events ---------------------------- */ int ethr_event_init(ethr_event *e) { int res; - ethr_atomic32_init(&e->state, ETHR_EVENT_OFF__); - res = pthread_mutex_init(&e->mtx, NULL); if (res != 0) return res; - - res = pthread_cond_init(&e->cnd, monotonic_clock_cond_attr_p); + res = pthread_cond_init(&e->cnd, NULL); if (res != 0) { pthread_mutex_destroy(&e->mtx); return res; } - -#ifdef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC - /* - * If ethr_get_monotonic_time() is broken we - * fall back on the pipe/select solution... - */ - if (monotonic_clock_cond_attr_p) { - e->fd[0] = e->fd[1] = ETHR_EVENT_COND_TIMEDWAIT__; - return 0; - } -#endif - - e->fd[0] = e->fd[1] = ETHR_EVENT_INVALID_FD__; - -#ifdef __DARWIN__ - e->fdsets = NULL; -#endif - - return 0; -} - -int -ethr_event_prepare_timed(ethr_event *e) -{ - if (e->fd[0] == ETHR_EVENT_INVALID_FD__) - setup_nonblocking_pipe(e); - return 0; } @@ -325,73 +124,22 @@ ethr_event_destroy(ethr_event *e) { int res; - if (e->fd[0] >= 0) { - close(e->fd[0]); - close(e->fd[1]); - } -#ifdef __DARWIN__ - if (e->fdsets) - free(e->fdsets); -#endif res = pthread_mutex_destroy(&e->mtx); if (res != 0) return res; - return pthread_cond_destroy(&e->cnd); + res = pthread_cond_destroy(&e->cnd); + if (res != 0) + return res; + return 0; } static ETHR_INLINE int -wait__(ethr_event *e, int spincount, ethr_sint64_t timeout) +wait__(ethr_event *e, int spincount) { int sc = spincount; ethr_sint32_t val; int res, ulres; int until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS; - ethr_sint64_t time = 0; /* SHUT UP annoying faulty warning... */ -#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME - ethr_sint64_t start = 0; /* SHUT UP annoying faulty warning... */ -#endif -#ifdef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC - struct timespec cond_timeout; -#endif - - val = ethr_atomic32_read(&e->state); - if (val == ETHR_EVENT_ON__) - goto return_event_on; - - if (timeout < 0) { - if (spincount == 0) - goto set_event_off_waiter; - } - if (timeout == 0) - return ETIMEDOUT; - else { - time = timeout; - switch (e->fd[0]) { - case ETHR_EVENT_INVALID_FD__: -#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME - start = ethr_get_monotonic_time(); -#endif - setup_nonblocking_pipe(e); - break; -#ifdef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC - case ETHR_EVENT_COND_TIMEDWAIT__: - time += ethr_get_monotonic_time(); - cond_timeout.tv_sec = time / (1000*1000*1000); - cond_timeout.tv_nsec = time % (1000*1000*1000); - if (spincount == 0) - goto set_event_off_waiter; - break; -#endif - default: - /* Already initialized pipe... */ - if (spincount == 0) - goto set_select_timeout; -#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME - start = ethr_get_monotonic_time(); -#endif - break; - } - } if (spincount < 0) ETHR_FATAL_ERROR__(EINVAL); @@ -399,8 +147,7 @@ while (1) { val = ethr_atomic32_read(&e->state); if (val == ETHR_EVENT_ON__) - goto return_event_on; - + return 0; if (sc == 0) break; sc--; @@ -413,162 +160,40 @@ } } - if (timeout < 0 -#ifdef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC - || e->fd[0] == ETHR_EVENT_COND_TIMEDWAIT__ -#endif - ) { - - set_event_off_waiter: - - if (val != ETHR_EVENT_OFF_WAITER__) { - ethr_sint32_t act; - act = ethr_atomic32_cmpxchg(&e->state, - ETHR_EVENT_OFF_WAITER__, - val); - if (act == ETHR_EVENT_ON__) - goto return_event_on; - ETHR_ASSERT(act == val); - } - - res = pthread_mutex_lock(&e->mtx); - if (res != 0) - ETHR_FATAL_ERROR__(res); - - while (1) { - - val = ethr_atomic32_read(&e->state); - if (val == ETHR_EVENT_ON__) { - ETHR_ASSERT(res == 0); - ETHR_MEMBAR(ETHR_LoadLoad|ETHR_LoadStore); - break; - } - -#ifdef ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC - if (timeout > 0) { - res = pthread_cond_timedwait(&e->cnd, &e->mtx, &cond_timeout); - if (res == EINTR || res == ETIMEDOUT) - break; - } - else -#endif - { - res = pthread_cond_wait(&e->cnd, &e->mtx); - if (res == EINTR) - break; - } - if (res != 0) - ETHR_FATAL_ERROR__(res); - } - - ulres = pthread_mutex_unlock(&e->mtx); - if (ulres != 0) - ETHR_FATAL_ERROR__(ulres); - + if (val != ETHR_EVENT_OFF_WAITER__) { + val = ethr_atomic32_cmpxchg(&e->state, + ETHR_EVENT_OFF_WAITER__, + ETHR_EVENT_OFF__); + if (val == ETHR_EVENT_ON__) + return 0; + ETHR_ASSERT(val == ETHR_EVENT_OFF__); } - else { - int fd; - int sres; - ssize_t rres; -#ifndef __DARWIN__ - fd_set rset, eset; -#endif - fd_set *rsetp, *esetp; - struct timeval select_timeout; - -#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME - time -= ethr_get_monotonic_time() - start; - if (time <= 0) - return ETIMEDOUT; -#endif - set_select_timeout: - - ETHR_ASSERT(time > 0); - - /* - * timeout in nano-second, but we can only wait - * for micro-seconds... - */ - time = ((time - 1) / 1000) + 1; - - select_timeout.tv_sec = time / (1000*1000); - select_timeout.tv_usec = time % (1000*1000); - - ETHR_ASSERT(val != ETHR_EVENT_ON__); - - fd = e->fd[0]; - - /* Cleanup pipe... */ - do { - char buf[64]; - rres = read(fd, buf, sizeof(buf)); - } while (rres > 0 || (rres < 0 && errno == EINTR)); - if (rres < 0 && errno != EAGAIN && errno != EWOULDBLOCK) - ETHR_FATAL_ERROR__(errno); - - /* - * Need to verify that state is still off - * after cleaning the pipe... - */ - if (val == ETHR_EVENT_OFF_WAITER_SELECT__) { - val = ethr_atomic32_read(&e->state); - if (val == ETHR_EVENT_ON__) - goto return_event_on; - } - else { - ethr_sint32_t act; - act = ethr_atomic32_cmpxchg(&e->state, - ETHR_EVENT_OFF_WAITER_SELECT__, - val); - if (act == ETHR_EVENT_ON__) - goto return_event_on; - ETHR_ASSERT(act == val); - } - - -#ifdef __DARWIN__ - rsetp = e->fdsets->rsetp; - esetp = e->fdsets->esetp; - memset((void *) &e->fdsets->mem[0], 0, e->fdsets->mem_size); -#else - FD_ZERO(&rset); - FD_ZERO(&eset); - rsetp = &rset; - esetp = &eset; -#endif + ETHR_ASSERT(val == ETHR_EVENT_OFF_WAITER__ + || val == ETHR_EVENT_OFF__); - FD_SET(fd, rsetp); - FD_SET(fd, esetp); + res = pthread_mutex_lock(&e->mtx); + if (res != 0) + ETHR_FATAL_ERROR__(res); - sres = select(fd + 1, rsetp, NULL, esetp, &select_timeout); - if (sres == 0) - res = ETIMEDOUT; - else { - res = EINTR; - if (sres < 0 && errno != EINTR) - ETHR_FATAL_ERROR__(errno); - /* else: - * Event is *probably* set, but it can be a - * lingering writer. That is, it is important - * that we verify that it actually is set. If - * it isn't, return EINTR (spurious wakeup). - */ - } + while (1) { val = ethr_atomic32_read(&e->state); if (val == ETHR_EVENT_ON__) - goto return_event_on; + break; + res = pthread_cond_wait(&e->cnd, &e->mtx); + if (res == EINTR) + break; + if (res != 0) + ETHR_FATAL_ERROR__(res); } - return res; - -return_event_on: - - ETHR_MEMBAR(ETHR_LoadLoad|ETHR_LoadStore); + ulres = pthread_mutex_unlock(&e->mtx); + if (ulres != 0) + ETHR_FATAL_ERROR__(ulres); - return 0; + return res; /* 0 || EINTR */ } #else @@ -590,23 +215,11 @@ int ethr_event_wait(ethr_event *e) { - return wait__(e, 0, -1); + return wait__(e, 0); } int ethr_event_swait(ethr_event *e, int spincount) { - return wait__(e, spincount, -1); -} - -int -ethr_event_twait(ethr_event *e, ethr_sint64_t timeout) -{ - return wait__(e, 0, timeout); -} - -int -ethr_event_stwait(ethr_event *e, int spincount, ethr_sint64_t timeout) -{ - return wait__(e, spincount, timeout); + return wait__(e, spincount); } diff -Nru erlang-18.2-dfsg/erts/lib_src/pthread/ethr_x86_sse2_asm.c erlang-17.3-dfsg/erts/lib_src/pthread/ethr_x86_sse2_asm.c --- erlang-18.2-dfsg/erts/lib_src/pthread/ethr_x86_sse2_asm.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/pthread/ethr_x86_sse2_asm.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/lib_src/utils/make_atomics_api erlang-17.3-dfsg/erts/lib_src/utils/make_atomics_api --- erlang-18.2-dfsg/erts/lib_src/utils/make_atomics_api 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/utils/make_atomics_api 2014-09-16 19:10:57.000000000 +0000 @@ -6,17 +6,16 @@ %% %% Copyright Ericsson AB 2011-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -1420,17 +1419,16 @@ * * Copyright Ericsson AB ", Years, ". All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the \"License\"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an \"AS IS\" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/lib_src/win/ethread.c erlang-17.3-dfsg/erts/lib_src/win/ethread.c --- erlang-18.2-dfsg/erts/lib_src/win/ethread.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/win/ethread.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2010-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -509,19 +508,6 @@ return *tid; } -/* getname and setname are not available on windows */ -int -ethr_getname(ethr_tid tid, char *buf, size_t len) -{ - return ENOSYS; -} - -void -ethr_setname(char *name) -{ - return; -} - int ethr_equal_tids(ethr_tid tid1, ethr_tid tid2) { diff -Nru erlang-18.2-dfsg/erts/lib_src/win/ethr_event.c erlang-17.3-dfsg/erts/lib_src/win/ethr_event.c --- erlang-18.2-dfsg/erts/lib_src/win/ethr_event.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/lib_src/win/ethr_event.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -26,16 +25,9 @@ #define ETHR_EVENT_IMPL__ #include "ethread.h" -#include "ethr_internal.h" /* --- Windows implementation of thread events ------------------------------ */ -void -ethr_init_event__(void) -{ - -} - int ethr_event_init(ethr_event *e) { @@ -47,12 +39,6 @@ } int -ethr_event_prepare_timed(ethr_event *e) -{ - return 0; -} - -int ethr_event_destroy(ethr_event *e) { BOOL res = CloseHandle(e->handle); @@ -72,29 +58,11 @@ } static ETHR_INLINE int -wait(ethr_event *e, int spincount, ethr_sint64_t timeout) +wait(ethr_event *e, int spincount) { - DWORD code, tmo; + DWORD code; int sc, res, until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS; - if (timeout < 0) - tmo = INFINITE; - else if (timeout == 0) { - ethr_sint32_t state = ethr_atomic32_read(&e->state); - if (state == ETHR_EVENT_ON__) { - ETHR_MEMBAR(ETHR_LoadLoad|ETHR_LoadStore); - return 0; - } - return ETIMEDOUT; - } - else { - /* - * Timeout in nano-seconds, but we can only - * wait for milli-seconds... - */ - tmo = (DWORD) (timeout - 1) / (1000*1000) + 1; - } - if (spincount < 0) ETHR_FATAL_ERROR__(EINVAL); @@ -104,10 +72,8 @@ ethr_sint32_t state; while (1) { state = ethr_atomic32_read(&e->state); - if (state == ETHR_EVENT_ON__) { - ETHR_MEMBAR(ETHR_LoadLoad|ETHR_LoadStore); + if (state == ETHR_EVENT_ON__) return 0; - } if (sc == 0) break; sc--; @@ -129,9 +95,7 @@ ETHR_ASSERT(state == ETHR_EVENT_OFF__); } - code = WaitForSingleObject(e->handle, tmo); - if (code == WAIT_TIMEOUT) - return ETIMEDOUT; + code = WaitForSingleObject(e->handle, INFINITE); if (code != WAIT_OBJECT_0) ETHR_FATAL_ERROR__(ethr_win_get_errno__()); } @@ -141,23 +105,11 @@ int ethr_event_wait(ethr_event *e) { - return wait(e, 0, -1); + return wait(e, 0); } int ethr_event_swait(ethr_event *e, int spincount) { - return wait(e, spincount, -1); -} - -int -ethr_event_twait(ethr_event *e, ethr_sint64_t timeout) -{ - return wait(e, 0, timeout); -} - -int -ethr_event_stwait(ethr_event *e, int spincount, ethr_sint64_t timeout) -{ - return wait(e, spincount, timeout); + return wait(e, spincount); } diff -Nru erlang-18.2-dfsg/erts/Makefile.in erlang-17.3-dfsg/erts/Makefile.in --- erlang-18.2-dfsg/erts/Makefile.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/Makefile.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2006-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/preloaded/ebin/erlang.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/preloaded/ebin/erlang.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/preloaded/ebin/erl_prim_loader.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/preloaded/ebin/erl_prim_loader.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/preloaded/ebin/erts_internal.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/preloaded/ebin/erts_internal.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/preloaded/ebin/init.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/preloaded/ebin/init.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/preloaded/ebin/otp_ring0.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/preloaded/ebin/otp_ring0.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/preloaded/ebin/prim_eval.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/preloaded/ebin/prim_eval.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/preloaded/ebin/prim_file.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/preloaded/ebin/prim_file.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/preloaded/ebin/prim_inet.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/preloaded/ebin/prim_inet.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/preloaded/ebin/prim_zip.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/preloaded/ebin/prim_zip.beam differ Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/erts/preloaded/ebin/zlib.beam and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/erts/preloaded/ebin/zlib.beam differ diff -Nru erlang-18.2-dfsg/erts/preloaded/Makefile erlang-17.3-dfsg/erts/preloaded/Makefile --- erlang-18.2-dfsg/erts/preloaded/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2008-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/preloaded/src/add_abstract_code erlang-17.3-dfsg/erts/preloaded/src/add_abstract_code --- erlang-18.2-dfsg/erts/preloaded/src/add_abstract_code 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/add_abstract_code 2014-09-16 19:10:57.000000000 +0000 @@ -6,17 +6,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/preloaded/src/erlang.erl erlang-17.3-dfsg/erts/preloaded/src/erlang.erl --- erlang-18.2-dfsg/erts/preloaded/src/erlang.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/erlang.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -39,6 +38,7 @@ -export([integer_to_list/2]). -export([integer_to_binary/2]). +-export([flush_monitor_message/2]). -export([set_cpu_topology/1, format_cpu_topology/1]). -export([await_proc_exit/3]). -export([memory/0, memory/1]). @@ -48,7 +48,7 @@ await_sched_wall_time_modifications/2, gather_gc_info_result/1]). --deprecated([hash/2, now/0]). +-deprecated([hash/2]). %% Get rid of autoimports of spawn to avoid clashes with ourselves. -compile({no_auto_import,[spawn_link/1]}). @@ -58,21 +58,12 @@ -compile({no_auto_import,[spawn_opt/5]}). -export_type([timestamp/0]). --export_type([time_unit/0]). -type ext_binary() :: binary(). -type timestamp() :: {MegaSecs :: non_neg_integer(), Secs :: non_neg_integer(), MicroSecs :: non_neg_integer()}. --type time_unit() :: - pos_integer() - | 'seconds' - | 'milli_seconds' - | 'micro_seconds' - | 'nano_seconds' - | 'native'. - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Native code BIF stubs and their types %% (BIF's actually implemented in this module goes last in the file) @@ -90,7 +81,7 @@ -export([binary_to_list/3, binary_to_term/1, binary_to_term/2]). -export([bit_size/1, bitsize/1, bitstring_to_list/1]). -export([bump_reductions/1, byte_size/1, call_on_load_function/1]). --export([cancel_timer/1, cancel_timer/2, check_old_code/1, check_process_code/2, +-export([cancel_timer/1, check_old_code/1, check_process_code/2, check_process_code/3, crc32/1]). -export([crc32/2, crc32_combine/3, date/0, decode_packet/3]). -export([delete_element/2]). @@ -102,7 +93,7 @@ float_to_list/1, float_to_list/2]). -export([fun_info/2, fun_info_mfa/1, fun_to_list/1, function_exported/3]). -export([garbage_collect/0, garbage_collect/1, garbage_collect/2]). --export([garbage_collect_message_area/0, get/0, get/1, get_keys/0, get_keys/1]). +-export([garbage_collect_message_area/0, get/0, get/1, get_keys/1]). -export([get_module_info/1, get_stacktrace/0, group_leader/0]). -export([group_leader/2, halt/0, halt/1, halt/2, hash/2, hibernate/3]). -export([insert_element/3]). @@ -113,8 +104,7 @@ -export([list_to_bitstring/1, list_to_existing_atom/1, list_to_float/1]). -export([list_to_integer/1, list_to_integer/2]). -export([list_to_pid/1, list_to_tuple/1, loaded/0]). --export([localtime/0, make_ref/0]). --export([map_size/1, match_spec_test/3, md5/1, md5_final/1]). +-export([localtime/0, make_ref/0, map_size/1, match_spec_test/3, md5/1, md5_final/1]). -export([md5_init/0, md5_update/2, module_loaded/1, monitor/2]). -export([monitor_node/2, monitor_node/3, nif_error/1, nif_error/2]). -export([node/0, node/1, now/0, phash/2, phash2/1, phash2/2]). @@ -122,19 +112,13 @@ -export([port_connect/2, port_control/3, port_get_data/1]). -export([port_set_data/2, port_to_list/1, ports/0]). -export([posixtime_to_universaltime/1, pre_loaded/0, prepare_loading/2]). --export([monotonic_time/0, monotonic_time/1]). --export([system_time/0, system_time/1]). --export([convert_time_unit/3]). --export([unique_integer/0, unique_integer/1]). --export([time_offset/0, time_offset/1, timestamp/0]). -export([process_display/2]). -export([process_flag/3, process_info/1, processes/0, purge_module/1]). --export([put/2, raise/3, read_timer/1, read_timer/2, ref_to_list/1, register/2]). --export([send_after/3, send_after/4, start_timer/3, start_timer/4]). --export([registered/0, resume_process/1, round/1, self/0]). +-export([put/2, raise/3, read_timer/1, ref_to_list/1, register/2]). +-export([registered/0, resume_process/1, round/1, self/0, send_after/3]). -export([seq_trace/2, seq_trace_print/1, seq_trace_print/2, setnode/2]). -export([setnode/3, size/1, spawn/3, spawn_link/3, split_binary/2]). --export([suspend_process/2, system_monitor/0]). +-export([start_timer/3, suspend_process/2, system_monitor/0]). -export([system_monitor/1, system_monitor/2, system_profile/0]). -export([system_profile/2, throw/1, time/0, trace/3, trace_delivered/1]). -export([trace_info/2, trunc/1, tuple_size/1, universaltime/0]). @@ -426,27 +410,12 @@ erlang:nif_error(undefined). %% cancel_timer/1 --spec erlang:cancel_timer(TimerRef) -> Result when +-spec erlang:cancel_timer(TimerRef) -> Time | false when TimerRef :: reference(), - Time :: non_neg_integer(), - Result :: Time | false. - + Time :: non_neg_integer(). cancel_timer(_TimerRef) -> erlang:nif_error(undefined). -%% cancel_timer/2 --spec erlang:cancel_timer(TimerRef, Options) -> Result | ok when - TimerRef :: reference(), - Async :: boolean(), - Info :: boolean(), - Option :: {async, Async} | {info, Info}, - Options :: [Option], - Time :: non_neg_integer(), - Result :: Time | false. - -cancel_timer(_TimerRef, _Options) -> - erlang:nif_error(undefined). - %% check_old_code/1 -spec check_old_code(Module) -> boolean() when Module :: module(). @@ -962,12 +931,6 @@ get(_Key) -> erlang:nif_error(undefined). -%% get_keys/0 --spec get_keys() -> [Key] when - Key :: term(). -get_keys() -> - erlang:nif_error(undefined). - %% get_keys/1 -spec get_keys(Val) -> [Key] when Val :: term(), @@ -1221,18 +1184,13 @@ module_loaded(_Module) -> erlang:nif_error(undefined). --type registered_name() :: atom(). - --type registered_process_identifier() :: registered_name() | {registered_name(), node()}. - --type monitor_process_identifier() :: pid() | registered_process_identifier(). - %% monitor/2 --spec monitor(process, monitor_process_identifier()) -> MonitorRef when - MonitorRef :: reference(); - (time_offset, clock_service) -> MonitorRef when +-spec monitor(Type, Item) -> MonitorRef when + Type :: process, + Item :: pid() | RegName | {RegName, Node}, + RegName :: module(), + Node :: node(), MonitorRef :: reference(). - monitor(_Type, _Item) -> erlang:nif_error(undefined). @@ -1334,90 +1292,6 @@ posixtime_to_universaltime(_P1) -> erlang:nif_error(undefined). --spec erlang:unique_integer(ModifierList) -> integer() when - ModifierList :: [Modifier], - Modifier :: positive | monotonic. - -unique_integer(_ModifierList) -> - erlang:nif_error(undefined). - --spec erlang:unique_integer() -> integer(). - -unique_integer() -> - erlang:nif_error(undefined). - --spec erlang:monotonic_time() -> integer(). - -monotonic_time() -> - erlang:nif_error(undefined). - --spec erlang:monotonic_time(Unit) -> integer() when - Unit :: time_unit(). - -monotonic_time(_Unit) -> - erlang:nif_error(undefined). - --spec erlang:system_time() -> integer(). - -system_time() -> - erlang:nif_error(undefined). - --spec erlang:system_time(Unit) -> integer() when - Unit :: time_unit(). - -system_time(_Unit) -> - erlang:nif_error(undefined). - --spec erlang:convert_time_unit(Time, FromUnit, ToUnit) -> ConvertedTime when - Time :: integer(), - ConvertedTime :: integer(), - FromUnit :: time_unit(), - ToUnit :: time_unit(). - -convert_time_unit(Time, FromUnit, ToUnit) -> - try - FU = case FromUnit of - native -> erts_internal:time_unit(); - nano_seconds -> 1000*1000*1000; - micro_seconds -> 1000*1000; - milli_seconds -> 1000; - seconds -> 1; - _ when FromUnit > 0 -> FromUnit - end, - TU = case ToUnit of - native -> erts_internal:time_unit(); - nano_seconds -> 1000*1000*1000; - micro_seconds -> 1000*1000; - milli_seconds -> 1000; - seconds -> 1; - _ when ToUnit > 0 -> ToUnit - end, - case Time < 0 of - true -> TU*Time - (FU - 1); - false -> TU*Time - end div FU - catch - _ : _ -> - erlang:error(badarg, [Time, FromUnit, ToUnit]) - end. - --spec erlang:time_offset() -> integer(). - -time_offset() -> - erlang:nif_error(undefined). - --spec erlang:time_offset(Unit) -> integer() when - Unit :: time_unit(). - -time_offset(_Unit) -> - erlang:nif_error(undefined). - --spec erlang:timestamp() -> Timestamp when - Timestamp :: timestamp(). - -timestamp() -> - erlang:nif_error(undefined). - %% prepare_loading/2 -spec erlang:prepare_loading(Module, Code) -> PreparedCode | {error, Reason} when Module :: module(), @@ -1483,26 +1357,11 @@ erlang:nif_error(undefined). %% read_timer/1 --spec erlang:read_timer(TimerRef) -> Result when - TimerRef :: reference(), - Time :: non_neg_integer(), - Result :: Time | false. - +-spec erlang:read_timer(TimerRef) -> non_neg_integer() | false when + TimerRef :: reference(). read_timer(_TimerRef) -> erlang:nif_error(undefined). -%% read_timer/2 --spec erlang:read_timer(TimerRef, Options) -> Result | ok when - TimerRef :: reference(), - Async :: boolean(), - Option :: {async, Async}, - Options :: [Option], - Time :: non_neg_integer(), - Result :: Time | false. - -read_timer(_TimerRef, _Options) -> - erlang:nif_error(undefined). - %% ref_to_list/1 -spec erlang:ref_to_list(Ref) -> string() when Ref :: reference(). @@ -1547,23 +1406,9 @@ Dest :: pid() | atom(), Msg :: term(), TimerRef :: reference(). - send_after(_Time, _Dest, _Msg) -> erlang:nif_error(undefined). -%% send_after/4 --spec erlang:send_after(Time, Dest, Msg, Options) -> TimerRef when - Time :: integer(), - Dest :: pid() | atom(), - Msg :: term(), - Options :: [Option], - Abs :: boolean(), - Option :: {abs, Abs}, - TimerRef :: reference(). - -send_after(_Time, _Dest, _Msg, _Options) -> - erlang:nif_error(undefined). - %% seq_trace/2 -spec erlang:seq_trace(P1, P2) -> seq_trace_info_returns() | {term(), term(), term(), term(), term()} when P1 :: atom(), @@ -1635,23 +1480,9 @@ Dest :: pid() | atom(), Msg :: term(), TimerRef :: reference(). - start_timer(_Time, _Dest, _Msg) -> erlang:nif_error(undefined). -%% start_timer/4 --spec erlang:start_timer(Time, Dest, Msg, Options) -> TimerRef when - Time :: integer(), - Dest :: pid() | atom(), - Msg :: term(), - Options :: [Option], - Abs :: boolean(), - Option :: {abs, Abs}, - TimerRef :: reference(). - -start_timer(_Time, _Dest, _Msg, _Options) -> - erlang:nif_error(undefined). - %% suspend_process/2 -spec erlang:suspend_process(Suspendee, OptList) -> boolean() when Suspendee :: pid(), @@ -1820,7 +1651,7 @@ %% Not documented -spec erlang:get_module_info(Module, Item) -> ModuleInfo when Module :: atom(), - Item :: module | exports | functions | attributes | compile | native_addresses | md5, + Item :: module | imports | exports | functions | attributes | compile | native_addresses, ModuleInfo :: atom() | [] | [{atom(), arity()}] | [{atom(), term()}] | [{atom(), arity(), integer()}]. get_module_info(_Module, _Item) -> erlang:nif_error(undefined). @@ -1974,7 +1805,6 @@ %% CHECK! Why the strange very thorough specification of the error %% condition with disallowed arity in erl_bif_types? %% Not documented -%% Shadowed by erl_bif_types: erlang:make_fun/3 -spec erlang:make_fun(Module, Function, Arity) -> function() when Module :: atom(), Function :: atom(), @@ -2288,8 +2118,6 @@ (trace_control_word, TCW) -> OldTCW when TCW :: non_neg_integer(), OldTCW :: non_neg_integer(); - (time_offset, finalize) -> OldState when - OldState :: preliminary | final | volatile; %% These are deliberately not documented (internal_cpu_topology, term()) -> term(); (sequential_tracer, pid() | port() | false) -> pid() | port() | false; @@ -2394,7 +2222,6 @@ CpuTopology :: cpu_topology(); (creation) -> integer(); (debug_compiled) -> boolean(); - (delayed_node_table_gc) -> infinity | non_neg_integer(); (dirty_cpu_schedulers) -> non_neg_integer(); (dirty_cpu_schedulers_online) -> non_neg_integer(); (dirty_io_schedulers) -> non_neg_integer(); @@ -2406,7 +2233,6 @@ (dynamic_trace) -> none | dtrace | systemtap; (dynamic_trace_probes) -> boolean(); (elib_malloc) -> false; - (eager_check_io) -> boolean(); (ets_limit) -> pos_integer(); (fullsweep_after) -> {fullsweep_after, non_neg_integer()}; (garbage_collection) -> [{atom(), integer()}]; @@ -2424,11 +2250,8 @@ MinBinVHeapSize :: pos_integer()}; (modified_timing_level) -> integer() | undefined; (multi_scheduling) -> disabled | blocked | enabled; - (multi_scheduling_blockers) -> [Pid :: pid()]; - (nif_version) -> string(); + (multi_scheduling_blockers) -> [PID :: pid()]; (otp_release) -> string(); - (os_monotonic_time_source) -> [{atom(),term()}]; - (os_system_time_source) -> [{atom(),term()}]; (port_count) -> non_neg_integer(); (port_limit) -> pos_integer(); (process_count) -> pos_integer(); @@ -2446,14 +2269,10 @@ (scheduler_id) -> SchedulerId :: pos_integer(); (schedulers | schedulers_online) -> pos_integer(); (smp_support) -> boolean(); - (start_time) -> integer(); (system_version) -> string(); (system_architecture) -> string(); (threads) -> boolean(); (thread_pool_size) -> non_neg_integer(); - (time_correction) -> true | false; - (time_offset) -> preliminary | final | volatile; - (time_warp_mode) -> no_time_warp | single_time_warp | multi_time_warp; (tolerant_timeofday) -> enabled | disabled; (trace_control_word) -> non_neg_integer(); (update_cpu_info) -> changed | unchanged; @@ -3220,6 +3039,16 @@ true -> integer_to_binary(I1, Base, R1) end. +%% erlang:flush_monitor_message/2 is for internal use only! +%% +%% erlang:demonitor(Ref, [flush]) traps to +%% erlang:flush_monitor_message(Ref, Res) when +%% it needs to flush a monitor message. +flush_monitor_message(Ref, Res) when erlang:is_reference(Ref), + erlang:is_atom(Res) -> + receive {_, Ref, _, _, _} -> ok after 0 -> ok end, + Res. + -record(cpu, {node = -1, processor = -1, processor_node = -1, @@ -3603,11 +3432,7 @@ get_fix_proc([{ProcType, A1, U1}| Rest], {A0, U0}) when ProcType == proc; ProcType == monitor_sh; ProcType == nlink_sh; - ProcType == msg_ref; - ProcType == ll_ptimer; - ProcType == hl_ptimer; - ProcType == bif_timer; - ProcType == accessor_bif_timer -> + ProcType == msg_ref -> get_fix_proc(Rest, {A0+A1, U0+U1}); get_fix_proc([_|Rest], Acc) -> get_fix_proc(Rest, Acc); diff -Nru erlang-18.2-dfsg/erts/preloaded/src/erl_prim_loader.erl erlang-17.3-dfsg/erts/preloaded/src/erl_prim_loader.erl --- erlang-18.2-dfsg/erts/preloaded/src/erl_prim_loader.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/erl_prim_loader.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/preloaded/src/erts.app.src erlang-17.3-dfsg/erts/preloaded/src/erts.app.src --- erlang-18.2-dfsg/erts/preloaded/src/erts.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/erts.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -36,7 +35,8 @@ {registered, []}, {applications, []}, {env, []}, - {runtime_dependencies, ["stdlib-2.5", "kernel-4.0", "sasl-2.4"]} + {mod, {erts, []}}, + {runtime_dependencies, ["stdlib-2.0", "kernel-3.0", "sasl-2.4"]} ]}. %% vim: ft=erlang diff -Nru erlang-18.2-dfsg/erts/preloaded/src/erts_internal.erl erlang-17.3-dfsg/erts/preloaded/src/erts_internal.erl --- erlang-18.2-dfsg/erts/preloaded/src/erts_internal.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/erts_internal.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -31,7 +30,7 @@ -export([await_port_send_result/3]). -export([cmp_term/2]). --export([map_to_tuple_keys/1, map_type/1, map_hashmap_children/1]). +-export([map_to_tuple_keys/1]). -export([port_command/3, port_connect/2, port_close/1, port_control/3, port_call/3, port_info/1, port_info/2]). @@ -39,14 +38,6 @@ -export([check_process_code/2]). --export([flush_monitor_messages/3]). - --export([await_result/1, gather_io_bytes/2]). - --export([time_unit/0]). - --export([is_system_process/1]). - %% %% Await result of send to port %% @@ -58,33 +49,6 @@ end. %% -%% Await result... -%% - -await_result(Ref) when is_reference(Ref) -> - receive - {Ref, Result} -> - Result - end. - -%% -%% statistics(io) end up in gather_io_bytes/2 -%% - -gather_io_bytes(Ref, No) when is_reference(Ref), - is_integer(No), - No > 0 -> - gather_io_bytes(Ref, No, 0, 0). - -gather_io_bytes(_Ref, 0, InAcc, OutAcc) -> - {{input, InAcc}, {output, OutAcc}}; -gather_io_bytes(Ref, No, InAcc, OutAcc) -> - receive - {Ref, _SchedId, In, Out} -> - gather_io_bytes(Ref, No-1, InAcc + In, OutAcc + Out) - end. - -%% %% Statically linked port NIFs %% @@ -214,52 +178,3 @@ map_to_tuple_keys(_M) -> erlang:nif_error(undefined). - -%% return the internal map type --spec map_type(M) -> Type when - M :: map(), - Type :: 'flatmap' | 'hashmap' | 'hashmap_node'. - -map_type(_M) -> - erlang:nif_error(undefined). - -%% return the internal hashmap sub-nodes from -%% a hashmap node --spec map_hashmap_children(M) -> Children when - M :: map(), %% hashmap node - Children :: [map() | nonempty_improper_list(term(),term())]. - -map_hashmap_children(_M) -> - erlang:nif_error(undefined). - --spec erts_internal:flush_monitor_messages(Ref, Multi, Res) -> term() when - Ref :: reference(), - Multi :: boolean(), - Res :: term(). - -%% erlang:demonitor(Ref, [flush]) traps to -%% erts_internal:flush_monitor_messages(Ref, Res) when -%% it needs to flush monitor messages. -flush_monitor_messages(Ref, Multi, Res) when is_reference(Ref) -> - receive - {_, Ref, _, _, _} -> - case Multi of - false -> - Res; - _ -> - flush_monitor_messages(Ref, Multi, Res) - end - after 0 -> - Res - end. - --spec erts_internal:time_unit() -> pos_integer(). - -time_unit() -> - erlang:nif_error(undefined). - --spec erts_internal:is_system_process(Pid) -> boolean() when - Pid :: pid(). - -is_system_process(_Pid) -> - erlang:nif_error(undefined). diff -Nru erlang-18.2-dfsg/erts/preloaded/src/init.erl erlang-17.3-dfsg/erts/preloaded/src/init.erl --- erlang-18.2-dfsg/erts/preloaded/src/init.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/init.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -167,6 +166,7 @@ boot(BootArgs) -> register(init, self()), process_flag(trap_exit, true), + start_on_load_handler_process(), {Start0,Flags,Args} = parse_boot_args(BootArgs), Start = map(fun prepare_run_args/1, Start0), Flags0 = flags_to_atoms_again(Flags), @@ -224,7 +224,6 @@ end. boot(Start,Flags,Args) -> - start_on_load_handler_process(), BootPid = do_boot(Flags,Start), State = #state{flags = Flags, args = Args, @@ -592,9 +591,12 @@ kill_all_pids(Heart) % Continue until all are really killed. end. -%% All except system processes. +%% All except zombies. +alive_processes() -> + [P || P <- processes(), erlang:is_process_alive(P)]. + get_pids(Heart) -> - Pids = [P || P <- processes(), not erts_internal:is_system_process(P)], + Pids = alive_processes(), delete(Heart,self(),Pids). delete(Heart,Init,[Heart|Pids]) -> delete(Heart,Init,Pids); diff -Nru erlang-18.2-dfsg/erts/preloaded/src/Makefile erlang-17.3-dfsg/erts/preloaded/src/Makefile --- erlang-18.2-dfsg/erts/preloaded/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2008-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/preloaded/src/otp_ring0.erl erlang-17.3-dfsg/erts/preloaded/src/otp_ring0.erl --- erlang-18.2-dfsg/erts/preloaded/src/otp_ring0.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/otp_ring0.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/preloaded/src/prim_eval.erl erlang-17.3-dfsg/erts/preloaded/src/prim_eval.erl --- erlang-18.2-dfsg/erts/preloaded/src/prim_eval.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/prim_eval.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/preloaded/src/prim_eval.S erlang-17.3-dfsg/erts/preloaded/src/prim_eval.S --- erlang-18.2-dfsg/erts/preloaded/src/prim_eval.S 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/prim_eval.S 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/preloaded/src/prim_file.erl erlang-17.3-dfsg/erts/preloaded/src/prim_file.erl --- erlang-18.2-dfsg/erts/preloaded/src/prim_file.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/prim_file.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/preloaded/src/prim_inet.erl erlang-17.3-dfsg/erts/preloaded/src/prim_inet.erl --- erlang-18.2-dfsg/erts/preloaded/src/prim_inet.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/prim_inet.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -128,18 +127,37 @@ %% TODO: shutdown equivalent for SCTP %% shutdown(S, read) when is_port(S) -> - shutdown_1(S, 0); + shutdown_2(S, 0); shutdown(S, write) when is_port(S) -> shutdown_1(S, 1); shutdown(S, read_write) when is_port(S) -> shutdown_1(S, 2). shutdown_1(S, How) -> + case subscribe(S, [subs_empty_out_q]) of + {ok,[{subs_empty_out_q,N}]} when N > 0 -> + shutdown_pend_loop(S, N); %% wait for pending output to be sent + _Other -> ok + end, + shutdown_2(S, How). + +shutdown_2(S, How) -> case ctl_cmd(S, ?TCP_REQ_SHUTDOWN, [How]) of {ok, []} -> ok; {error,_}=Error -> Error end. +shutdown_pend_loop(S, N0) -> + receive + {empty_out_q,S} -> ok + after ?INET_CLOSE_TIMEOUT -> + case getstat(S, [send_pend]) of + {ok,[{send_pend,N0}]} -> ok; + {ok,[{send_pend,N}]} -> shutdown_pend_loop(S, N); + _ -> ok + end + end. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% CLOSE(insock()) -> ok @@ -147,16 +165,11 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% close(S) when is_port(S) -> - case getopt(S, linger) of - {ok,{true,0}} -> - close_port(S); + case subscribe(S, [subs_empty_out_q]) of + {ok, [{subs_empty_out_q,N}]} when N > 0 -> + close_pend_loop(S, N); %% wait for pending output to be sent _ -> - case subscribe(S, [subs_empty_out_q]) of - {ok, [{subs_empty_out_q,N}]} when N > 0 -> - close_pend_loop(S, N); %% wait for pending output to be sent - _ -> - close_port(S) - end + close_port(S) end. close_pend_loop(S, N) -> @@ -232,7 +245,7 @@ %% if timeout is given: %% timeout < 0 -> infinity %% 0 -> immediate connect (mostly works for loopback) -%% > 0 -> wait for timeout ms if not connected then +%% > 0 -> wait for timout ms if not connected then %% return {error, timeout} %% %% ASYNC_CONNECT(insock(), IP, Port, Timeout) -> {ok, S, Ref} | {error, Reason} @@ -273,7 +286,7 @@ %% if timeout is given: %% timeout < 0 -> infinity %% 0 -> immediate accept (poll) -%% > 0 -> wait for timeout ms for accept if no accept then +%% > 0 -> wait for timout ms for accept if no accept then %% return {error, timeout} %% %% ASYNC_ACCEPT(insock(), Timeout) @@ -1146,8 +1159,6 @@ enc_opt(packet_size) -> ?INET_LOPT_PACKET_SIZE; enc_opt(read_packets) -> ?INET_LOPT_READ_PACKETS; enc_opt(netns) -> ?INET_LOPT_NETNS; -enc_opt(show_econnreset) -> ?INET_LOPT_TCP_SHOW_ECONNRESET; -enc_opt(line_delimiter) -> ?INET_LOPT_LINE_DELIM; enc_opt(raw) -> ?INET_OPT_RAW; % Names of SCTP opts: enc_opt(sctp_rtoinfo) -> ?SCTP_OPT_RTOINFO; @@ -1205,8 +1216,6 @@ dec_opt(?INET_LOPT_PACKET_SIZE) -> packet_size; dec_opt(?INET_LOPT_READ_PACKETS) -> read_packets; dec_opt(?INET_LOPT_NETNS) -> netns; -dec_opt(?INET_LOPT_TCP_SHOW_ECONNRESET) -> show_econnreset; -dec_opt(?INET_LOPT_LINE_DELIM) -> line_delimiter; dec_opt(?INET_OPT_RAW) -> raw; dec_opt(I) when is_integer(I) -> undefined. @@ -1289,7 +1298,6 @@ {httph_bin,?TCP_PB_HTTPH_BIN}, {ssl, ?TCP_PB_SSL_TLS}, % obsolete {ssl_tls, ?TCP_PB_SSL_TLS}]}; -type_opt_1(line_delimiter) -> int; type_opt_1(mode) -> {enum,[{list, ?INET_MODE_LIST}, {binary, ?INET_MODE_BINARY}]}; @@ -1307,7 +1315,6 @@ type_opt_1(packet_size) -> uint; type_opt_1(read_packets) -> uint; type_opt_1(netns) -> binary; -type_opt_1(show_econnreset) -> bool; %% %% SCTP options (to be set). If the type is a record type, the corresponding %% record signature is returned, otherwise, an "elementary" type tag diff -Nru erlang-18.2-dfsg/erts/preloaded/src/prim_zip.erl erlang-17.3-dfsg/erts/preloaded/src/prim_zip.erl --- erlang-18.2-dfsg/erts/preloaded/src/prim_zip.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/prim_zip.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/preloaded/src/zip_internal.hrl erlang-17.3-dfsg/erts/preloaded/src/zip_internal.hrl --- erlang-18.2-dfsg/erts/preloaded/src/zip_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/zip_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/preloaded/src/zlib.erl erlang-17.3-dfsg/erts/preloaded/src/zlib.erl --- erlang-18.2-dfsg/erts/preloaded/src/zlib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/preloaded/src/zlib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,14 +24,13 @@ deflate/2,deflate/3,deflateEnd/1, inflateInit/1,inflateInit/2,inflateSetDictionary/2, inflateSync/1,inflateReset/1,inflate/2,inflateEnd/1, - inflateChunk/1, inflateChunk/2, setBufSize/2,getBufSize/1, crc32/1,crc32/2,crc32/3,adler32/2,adler32/3,getQSize/1, crc32_combine/4,adler32_combine/4, compress/1,uncompress/1,zip/1,unzip/1, gzip/1,gunzip/1]). --export_type([zstream/0, zlevel/0, zwindowbits/0, zmemlevel/0, zstrategy/0]). +-export_type([zstream/0]). %% flush argument encoding -define(Z_NO_FLUSH, 0). @@ -102,7 +100,6 @@ -define(INFLATE_RESET, 12). -define(INFLATE_END, 13). -define(INFLATE, 14). --define(INFLATE_CHUNK, 25). -define(CRC32_0, 15). -define(CRC32_1, 16). @@ -127,7 +124,7 @@ -type zlevel() :: 'none' | 'default' | 'best_compression' | 'best_speed' | 0..9. -type zmethod() :: 'deflated'. --type zwindowbits() :: -15..-8 | 8..47. +-type zwindowbits() :: -15..-9 | 9..47. -type zmemlevel() :: 1..9. -type zstrategy() :: 'default' | 'filtered' | 'huffman_only' | 'rle'. @@ -266,39 +263,6 @@ erlang:error(badarg) end. --spec inflateChunk(Z, Data) -> Decompressed | {more, Decompressed} when - Z :: zstream(), - Data :: iodata(), - Decompressed :: iolist(). -inflateChunk(Z, Data) -> - try port_command(Z, Data) of - true -> - inflateChunk(Z) - catch - error:_Err -> - flush(Z), - erlang:error(badarg) - end. - --spec inflateChunk(Z) -> Decompressed | {more, Decompressed} when - Z :: zstream(), - Decompressed :: iolist(). -inflateChunk(Z) -> - Status = call(Z, ?INFLATE_CHUNK, []), - Data = receive - {Z, {data, Bin}} -> - Bin - after 0 -> - [] - end, - - case Status of - Good when (Good == ok) orelse (Good == stream_end) -> - Data; - inflate_has_more -> - {more, Data} - end. - -spec inflateEnd(Z) -> 'ok' when Z :: zstream(). inflateEnd(Z) -> @@ -532,8 +496,8 @@ -spec arg_bitsz(zwindowbits()) -> zwindowbits(). arg_bitsz(Bits) when is_integer(Bits) andalso - ((8 =< Bits andalso Bits < 48) orelse - (-15 =< Bits andalso Bits =< -8)) -> + ((8 < Bits andalso Bits < 48) orelse + (-15 =< Bits andalso Bits < -8)) -> Bits; arg_bitsz(_) -> erlang:error(badarg). @@ -550,9 +514,7 @@ [2,A,B,C,D] -> (A bsl 24)+(B bsl 16)+(C bsl 8)+D; [3,A,B,C,D] -> - erlang:error({need_dictionary,(A bsl 24)+(B bsl 16)+(C bsl 8)+D}); - [4, _, _, _, _] -> - inflate_has_more + erlang:error({need_dictionary,(A bsl 24)+(B bsl 16)+(C bsl 8)+D}) catch error:badarg -> %% Rethrow loses port_control from stacktrace. erlang:error(badarg) diff -Nru erlang-18.2-dfsg/erts/start_scripts/Makefile erlang-17.3-dfsg/erts/start_scripts/Makefile --- erlang-18.2-dfsg/erts/start_scripts/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/start_scripts/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/start_scripts/no_dot_erlang.rel.src erlang-17.3-dfsg/erts/start_scripts/no_dot_erlang.rel.src --- erlang-18.2-dfsg/erts/start_scripts/no_dot_erlang.rel.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/start_scripts/no_dot_erlang.rel.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/start_scripts/start_all_example.rel.src erlang-17.3-dfsg/erts/start_scripts/start_all_example.rel.src --- erlang-18.2-dfsg/erts/start_scripts/start_all_example.rel.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/start_scripts/start_all_example.rel.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/start_scripts/start_clean.rel.src erlang-17.3-dfsg/erts/start_scripts/start_clean.rel.src --- erlang-18.2-dfsg/erts/start_scripts/start_clean.rel.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/start_scripts/start_clean.rel.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/start_scripts/start_sasl.rel.src erlang-17.3-dfsg/erts/start_scripts/start_sasl.rel.src --- erlang-18.2-dfsg/erts/start_scripts/start_sasl.rel.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/start_scripts/start_sasl.rel.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/erlc_SUITE_data/include/erl_test.hrl erlang-17.3-dfsg/erts/test/erlc_SUITE_data/include/erl_test.hrl --- erlang-18.2-dfsg/erts/test/erlc_SUITE_data/include/erl_test.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlc_SUITE_data/include/erl_test.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/erl_test_bad.erl erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/erl_test_bad.erl --- erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/erl_test_bad.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/erl_test_bad.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/erl_test_missing_header.erl erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/erl_test_missing_header.erl --- erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/erl_test_missing_header.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/erl_test_missing_header.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/erl_test_ok.erl erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/erl_test_ok.erl --- erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/erl_test_ok.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/erl_test_ok.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/start_ok.script erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/start_ok.script --- erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/start_ok.script 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/start_ok.script 2014-09-16 19:10:57.000000000 +0000 @@ -52,6 +52,7 @@ shell_default, timer, gen_fsm, + pg, unix, dict, pool, @@ -155,6 +156,7 @@ {timer,1}, {gen_fsm,1}, {io_lib_pretty,1}, + {pg,1}, {slave,1}, {unix,1}, {dict,1}, diff -Nru erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/yecc_test_bad.yrl erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/yecc_test_bad.yrl --- erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/yecc_test_bad.yrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/yecc_test_bad.yrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/yecc_test_ok.yrl erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/yecc_test_ok.yrl --- erlang-18.2-dfsg/erts/test/erlc_SUITE_data/src/yecc_test_ok.yrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlc_SUITE_data/src/yecc_test_ok.yrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/erlc_SUITE.erl erlang-17.3-dfsg/erts/test/erlc_SUITE.erl --- erlang-18.2-dfsg/erts/test/erlc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/erlexec_SUITE_data/erlexec_tests.c erlang-17.3-dfsg/erts/test/erlexec_SUITE_data/erlexec_tests.c --- erlang-18.2-dfsg/erts/test/erlexec_SUITE_data/erlexec_tests.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlexec_SUITE_data/erlexec_tests.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2008-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/test/erlexec_SUITE_data/Makefile.src erlang-17.3-dfsg/erts/test/erlexec_SUITE_data/Makefile.src --- erlang-18.2-dfsg/erts/test/erlexec_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlexec_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2008-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/test/erlexec_SUITE.erl erlang-17.3-dfsg/erts/test/erlexec_SUITE.erl --- erlang-18.2-dfsg/erts/test/erlexec_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erlexec_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -463,10 +462,13 @@ get_nodename(T) -> + {A, B, C} = now(), atom_to_list(T) ++ "-" ++ atom_to_list(?MODULE) ++ "-" - ++ integer_to_list(erlang:system_time(seconds)) + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) ++ "-" - ++ integer_to_list(erlang:unique_integer([positive])). + ++ integer_to_list(C). diff -Nru erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/character_test.h erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/character_test.h --- erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/character_test.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/character_test.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/erl_print_tests.c erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/erl_print_tests.c --- erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/erl_print_tests.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/erl_print_tests.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -503,17 +502,16 @@ " * %%CopyrightBegin%%\n" " * Copyright Ericsson AB 1996-2009. All Rights Reserved.\n" " * \n" - " * Licensed under the Apache License, Version 2.0 (the \"License\");\n" - " * you may not use this file except in compliance with the License.\n" - " * You may obtain a copy of the License at\n" - " * \n" - " * http://www.apache.org/licenses/LICENSE-2.0\n" - " * \n" - " * Unless required by applicable law or agreed to in writing, software\n" - " * distributed under the License is distributed on an \"AS IS\" BASIS,\n" - " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" - " * See the License for the specific language governing permissions and\n" - " * limitations under the License.\n" + " * The contents of this file are subject to the Erlang Public License,\n" + " * Version 1.1, (the \"License\"); you may not use this file except in\n" + " * compliance with the License. You should have received a copy of the\n" + " * Erlang Public License along with this software. If not, it can be\n" + " * retrieved online at http://www.erlang.org/.\n" + " * \n" + " * Software distributed under the License is distributed on an \"AS IS\"\n" + " * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See\n" + " * the License for the specific language governing rights and limitations\n" + " * under the License.\n" " * %%CopyrightEnd%%\n" " */\n" "\n"); diff -Nru erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/integer_64_test.h erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/integer_64_test.h --- erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/integer_64_test.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/integer_64_test.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/integer_test.h erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/integer_test.h --- erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/integer_test.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/integer_test.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/Makefile.src erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/Makefile.src --- erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2005-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/snprintf_test.h erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/snprintf_test.h --- erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/snprintf_test.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/snprintf_test.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/string_test.h erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/string_test.h --- erlang-18.2-dfsg/erts/test/erl_print_SUITE_data/string_test.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erl_print_SUITE_data/string_test.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2005-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/test/erl_print_SUITE.erl erlang-17.3-dfsg/erts/test/erl_print_SUITE.erl --- erlang-18.2-dfsg/erts/test/erl_print_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/erl_print_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/ethread_SUITE_data/ethread_tests.c erlang-17.3-dfsg/erts/test/ethread_SUITE_data/ethread_tests.c --- erlang-18.2-dfsg/erts/test/ethread_SUITE_data/ethread_tests.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/ethread_SUITE_data/ethread_tests.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/test/ethread_SUITE_data/Makefile.src erlang-17.3-dfsg/erts/test/ethread_SUITE_data/Makefile.src --- erlang-18.2-dfsg/erts/test/ethread_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/ethread_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/test/ethread_SUITE.erl erlang-17.3-dfsg/erts/test/ethread_SUITE.erl --- erlang-18.2-dfsg/erts/test/ethread_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/ethread_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/ignore_cores.erl erlang-17.3-dfsg/erts/test/ignore_cores.erl --- erlang-18.2-dfsg/erts/test/ignore_cores.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/ignore_cores.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/install_SUITE.erl erlang-17.3-dfsg/erts/test/install_SUITE.erl --- erlang-18.2-dfsg/erts/test/install_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/install_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/Makefile erlang-17.3-dfsg/erts/test/Makefile --- erlang-18.2-dfsg/erts/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/test/nt_SUITE_data/Makefile.src erlang-17.3-dfsg/erts/test/nt_SUITE_data/Makefile.src --- erlang-18.2-dfsg/erts/test/nt_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/nt_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1998-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/test/nt_SUITE_data/nt_info.c erlang-17.3-dfsg/erts/test/nt_SUITE_data/nt_info.c --- erlang-18.2-dfsg/erts/test/nt_SUITE_data/nt_info.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/nt_SUITE_data/nt_info.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/erts/test/nt_SUITE.erl erlang-17.3-dfsg/erts/test/nt_SUITE.erl --- erlang-18.2-dfsg/erts/test/nt_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/nt_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/otp_SUITE.erl erlang-17.3-dfsg/erts/test/otp_SUITE.erl --- erlang-18.2-dfsg/erts/test/otp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/otp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2015. All Rights Reserved. +%% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,7 +23,7 @@ init_per_suite/1,end_per_suite/1]). -export([undefined_functions/1,deprecated_not_in_obsolete/1, obsolete_but_not_deprecated/1,call_to_deprecated/1, - call_to_size_1/1,call_to_now_0/1,strong_components/1, + call_to_size_1/1,strong_components/1, erl_file_encoding/1,xml_file_encoding/1,runtime_dependencies/1]). -include_lib("test_server/include/test_server.hrl"). @@ -36,7 +35,7 @@ all() -> [undefined_functions, deprecated_not_in_obsolete, obsolete_but_not_deprecated, call_to_deprecated, - call_to_size_1, call_to_now_0, strong_components, + call_to_size_1, strong_components, erl_file_encoding, xml_file_encoding, runtime_dependencies]. @@ -95,8 +94,7 @@ Undef4 = eunit_filter(Undef3), Undef5 = dialyzer_filter(Undef4), Undef6 = wx_filter(Undef5), - Undef7 = gs_filter(Undef6), - Undef = diameter_filter(Undef7), + Undef = gs_filter(Undef6), case Undef of [] -> ok; @@ -219,19 +217,6 @@ _ -> Undef end. -diameter_filter(Undef) -> - %% Filter away function calls that are catched. - filter(fun({{diameter_lib,_,_},{erlang,convert_time_unit,3}}) -> - false; - ({{diameter_lib,_,_},{erlang,monotonic_time,0}}) -> - false; - ({{diameter_lib,_,_},{erlang,unique_integer,0}}) -> - false; - ({{diameter_lib,_,_},{erlang,time_offset,0}}) -> - false; - (_) -> true - end, Undef). - deprecated_not_in_obsolete(Config) when is_list(Config) -> ?line Server = ?config(xref_server, Config), ?line {ok,DeprecatedFunctions} = xref:q(Server, "DF"), @@ -288,58 +273,48 @@ {comment,integer_to_list(length(DeprecatedCalls))++" calls to deprecated functions"}. call_to_size_1(Config) when is_list(Config) -> + Server = ?config(xref_server, Config), + %% Applications that do not call erlang:size/1: Apps = [asn1,compiler,debugger,kernel,observer,parsetools, runtime_tools,stdlib,tools,webtool], - not_recommended_calls(Config, Apps, {erlang,size,1}). - -call_to_now_0(Config) when is_list(Config) -> - %% Applications that do not call erlang:now/1: - Apps = [asn1,common_test,compiler,debugger,dialyzer, - gs,kernel,mnesia,observer,parsetools,reltool, - runtime_tools,sasl,stdlib,syntax_tools, - test_server,tools,webtool], - not_recommended_calls(Config, Apps, {erlang,now,0}). - -not_recommended_calls(Config, Apps, MFA) -> - Server = ?config(xref_server, Config), - Fs = [MFA], + Fs = [{erlang,size,1}], Q1 = io_lib:format("E || ~p : Fun", [Fs]), - {ok,AllCallsToMFA} = xref:q(Server, lists:flatten(Q1)), + ?line {ok,AllCallsToSize1} = xref:q(Server, lists:flatten(Q1)), Q2 = io_lib:format("E | ~p : App || ~p : Fun", [Apps,Fs]), - {ok,CallsToMFA} = xref:q(Server, lists:flatten(Q2)), + ?line {ok,CallsToSize1} = xref:q(Server, lists:flatten(Q2)), - case CallsToMFA of + case CallsToSize1 of [] -> ok; _ -> - io:format("These calls are not allowed:\n"), + io:format("These calls cause an error:~n"), foreach(fun ({MFA1,MFA2}) -> - io:format("~s calls non-recommended ~s", + io:format("~s calls soon to be deprecated ~s", [format_mfa(MFA1),format_mfa(MFA2)]) - end, CallsToMFA) + end, CallsToSize1) end, - %% Enumerate calls to MFA from other applications than - %% the ones known not to call MFA: - case AllCallsToMFA--CallsToMFA of + %% Enumerate calls to erlang:size/1 from other applications than + %% the ones known not to call erlang:size/1: + case AllCallsToSize1--CallsToSize1 of [] -> ok; Calls -> - io:format("~n~nThese calls are allowed for now:\n"), + io:format("~n~nThese calls do not cause an error (yet):~n"), foreach(fun ({MFA1,MFA2}) -> - io:format("~s calls non-recommended ~s", + io:format("~s calls soon to be deprecated ~s", [format_mfa(MFA1),format_mfa(MFA2)]) end, Calls) end, - case CallsToMFA of + case CallsToSize1 of [] -> ok; _ -> - ?t:fail({length(CallsToMFA),calls_to_size_1}) + ?line ?t:fail({length(CallsToSize1),calls_to_size_1}) end. strong_components(Config) when is_list(Config) -> diff -Nru erlang-18.2-dfsg/erts/test/run_erl_SUITE_data/defuncter.pl erlang-17.3-dfsg/erts/test/run_erl_SUITE_data/defuncter.pl --- erlang-18.2-dfsg/erts/test/run_erl_SUITE_data/defuncter.pl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/run_erl_SUITE_data/defuncter.pl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2006-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/test/run_erl_SUITE_data/run_erl_test.pl erlang-17.3-dfsg/erts/test/run_erl_SUITE_data/run_erl_test.pl --- erlang-18.2-dfsg/erts/test/run_erl_SUITE_data/run_erl_test.pl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/run_erl_SUITE_data/run_erl_test.pl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2006-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/test/run_erl_SUITE.erl erlang-17.3-dfsg/erts/test/run_erl_SUITE.erl --- erlang-18.2-dfsg/erts/test/run_erl_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/run_erl_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/test/upgrade_SUITE_data/start.src erlang-17.3-dfsg/erts/test/upgrade_SUITE_data/start.src --- erlang-18.2-dfsg/erts/test/upgrade_SUITE_data/start.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/upgrade_SUITE_data/start.src 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/test/upgrade_SUITE.erl erlang-17.3-dfsg/erts/test/upgrade_SUITE.erl --- erlang-18.2-dfsg/erts/test/upgrade_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/upgrade_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% -module(upgrade_SUITE). @@ -38,9 +37,8 @@ %% - hipe does not support any upgrade at all %% - dialyzer requires hipe (in the .app file) %% - typer requires hipe (in the .app file) -%% - erl_interface, jinterface support no upgrade -define(appup_exclude, - [dialyzer,hipe,typer,erl_interface,jinterface,ose]). + [dialyzer,hipe,typer]). init_per_suite(Config) -> %% Check that a real release is running, not e.g. cerl @@ -239,10 +237,7 @@ [{"OTP upgrade test",FromVsn,_,permanent}] = rpc:call(Node,release_handler,which_releases,[]), - ToRelName = filename:basename(ToRel), - copy_file(ToRel++".tar.gz", - filename:join([InstallDir,releases,ToRelName++".tar.gz"])), - {ok,ToVsn} = rpc:call(Node,release_handler,unpack_release,[ToRelName]), + {ok,ToVsn} = rpc:call(Node,release_handler,unpack_release,[ToRel]), [{"OTP upgrade test",ToVsn,_,unpacked}, {"OTP upgrade test",FromVsn,_,permanent}] = rpc:call(Node,release_handler,which_releases,[]), diff -Nru erlang-18.2-dfsg/erts/test/utils/gccifier.c erlang-17.3-dfsg/erts/test/utils/gccifier.c --- erlang-18.2-dfsg/erts/test/utils/gccifier.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/utils/gccifier.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/erts/test/utils/gccifier.sh erlang-17.3-dfsg/erts/test/utils/gccifier.sh --- erlang-18.2-dfsg/erts/test/utils/gccifier.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/utils/gccifier.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2005-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/erts/test/z_SUITE.erl erlang-17.3-dfsg/erts/test/z_SUITE.erl --- erlang-18.2-dfsg/erts/test/z_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/test/z_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/erts/vsn.mk erlang-17.3-dfsg/erts/vsn.mk --- erlang-18.2-dfsg/erts/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/erts/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -3,22 +3,21 @@ # # Copyright Ericsson AB 1997-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # -VSN = 7.2 +VSN = 6.2 # Port number 4365 in 4.2 # Port number 4366 in 4.3 diff -Nru erlang-18.2-dfsg/HOWTO/INSTALL-CROSS.md erlang-17.3-dfsg/HOWTO/INSTALL-CROSS.md --- erlang-18.2-dfsg/HOWTO/INSTALL-CROSS.md 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/HOWTO/INSTALL-CROSS.md 2014-09-16 19:10:57.000000000 +0000 @@ -550,17 +550,16 @@ Copyright Ericsson AB 2009-2014. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. %CopyrightEnd% diff -Nru erlang-18.2-dfsg/HOWTO/INSTALL.md erlang-17.3-dfsg/HOWTO/INSTALL.md --- erlang-18.2-dfsg/HOWTO/INSTALL.md 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/HOWTO/INSTALL.md 2014-09-16 19:10:57.000000000 +0000 @@ -210,14 +210,6 @@ $ export PATH=$ERL_TOP/bin:$PATH # Assuming bash/sh -For the FOP print formatter, two steps must be taken: - -* Adding the location of your installation of `fop` in `$FOP_HOME`. - - $ export FOP_HOME=/path/to/fop/dir # Assuming bash/sh - -* Adding the `fop` script (in `$FOP_HOME`) to your `$PATH`, either by adding `$FOP_HOME` to `$PATH`, or by copying the `fop` script to a directory already in your `$PATH`. - Build the documentation. $ make docs @@ -408,18 +400,6 @@ no automatic dependency handling between applications. If you disable an application that another application depends on, you also have to disable the dependant application. -* `--enable-gettimeofday-as-os-system-time` - Force usage of `gettimeofday()` for - OS system time. -* `--enable-prefer-elapsed-monotonic-time-during-suspend` - Prefer an OS monotonic - time source with elapsed time during suspend. -* `--disable-prefer-elapsed-monotonic-time-during-suspend` - Do not prefer an OS - monotonic time source with elapsed time during suspend. -* `--with-clock-resolution=high|low` - Try to find clock sources for OS system - time, and OS monotonic time with higher or lower resolution than chosen by - default. Note that both alternatives may have a negative impact on the performance - and scalability compared to the default clock sources chosen. -* `--disable-saved-compile-time` - Disable saving of compile date and time - in the emulator binary. * `--enable-dirty-schedulers` - Enable the **experimental** dirty schedulers functionality. Note that the dirty schedulers functionality is experimental, and **not supported**. This functionality **will** be subject to backward @@ -429,41 +409,6 @@ If you or your system has special requirements please read the `Makefile` for additional configuration information. -#### Atomic Memory Operations and the VM #### - -The VM with SMP support makes quite a heavy use of atomic memory operations. -An implementation providing native atomic memory operations is therefore very -important when building Erlang/OTP. By default the VM will refuse to build -if native atomic memory operations are not available. - -Erlang/OTP itself provides implementations of native atomic memory operations -that can be used when compiling with a `gcc` compatible compiler for 32/64-bit -x86, 32/64-bit SPARC V9, 32-bit PowerPC, or 32-bit Tile. When compiling with -a `gcc` compatible compiler for other architectures, the VM may be able to make -use of native atomic operations using the `__atomic_*` builtins (may be -available when using a `gcc` of at least version 4.7) and/or using the -`__sync_*` builtins (may be available when using a `gcc` of at least version -4.1). If only the `gcc`'s `__sync_*` builtins are available, the performance -will suffer. Such a configuration should only be used as a last resort. When -compiling on Windows using a MicroSoft Visual C++ compiler native atomic -memory operations are provided by Windows APIs. - -Native atomic implementation in the order preferred: -1. The implementation provided by Erlang/OTP. -2. The API provided by Windows. -3. The implementation based on the `gcc` `__atomic_*` builtins. -4. If none of the above are available for your architecture/compiler, you - are recommended to build and install [libatomic_ops][] before building - Erlang/OTP. The `libatomic_ops` library provides native atomic memory - operations for a variety of architectures and compilers. When building - Erlang/OTP you need to inform the build system of where the - `libatomic_ops` library is installed using the - `--with-libatomic_ops=PATH` `configure` switch. -5. As a last resort, the implementation solely based on the `gcc` - `__sync_*` builtins. This will however cause lots of expensive and - unnecessary memory barrier instructions to be issued. That is, - performance will suffer. The `configure` script will warn at the end - of its execution if it cannot find any other alternative than this. ### Building ### @@ -516,7 +461,7 @@ If you want to build the `wx` application, you will need to get wxWidgets-3.0 (`wxWidgets-3.0.0.tar.bz2` from ) or get it from github with bug fixes: - $ git clone --branch WX_3_0_BRANCH git@github.com:wxWidgets/wxWidgets.git + $ git clone --branch WX_3_0_branch git@github.com:wxWidgets/wxWidgets.git Be aware that the wxWidgets-3.0 is a new release of wxWidgets, it is not as mature as the old releases and the OS X port still lags behind the other ports. @@ -880,19 +825,18 @@ %CopyrightBegin% -Copyright Ericsson AB 1998-2015. All Rights Reserved. +Copyright Ericsson AB 1998-2014. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. %CopyrightEnd% @@ -918,4 +862,3 @@ [Optional Utilities]: #Optional-Utilities [Building on a Mac]: #Advanced-configuration-and-build-of-ErlangOTP_Building_OS-X-Darwin [Building with wxErlang]: #Advanced-configuration-and-build-of-ErlangOTP_Building_Building-with-wxErlang - [libatomic_ops]: https://github.com/ivmai/libatomic_ops/ diff -Nru erlang-18.2-dfsg/HOWTO/INSTALL-WIN32.md erlang-17.3-dfsg/HOWTO/INSTALL-WIN32.md --- erlang-18.2-dfsg/HOWTO/INSTALL-WIN32.md 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/HOWTO/INSTALL-WIN32.md 2014-09-16 19:10:57.000000000 +0000 @@ -4,110 +4,82 @@ Introduction ------------ -This section describes how to build the Erlang emulator and the OTP -libraries on Windows. Note that the Windows binary releases are still -a preferred alternative if one does not have Microsoft’s development -tools and/or don’t want to install Cygwin, MSYS or MSYS2. - -The instructions apply to versions of Windows supporting the Cygwin -emulated gnuish environment or the MSYS or MSYS2 ditto. We’ve built on -the following platforms: Windows 2012, Windows 7, Windows 8 and Windows 10. -It’s probably possible to build on older platforms too, but you might -not be able to install the appropriate Microsoft SDK, Visual Studio or -OpenSSL, in which case you will need to go back to earlier compilers etc. - -The procedure described uses either Cygwin, MSYS or MSYS2 as a build -environment. You run the bash shell in Cygwin/MSYS/MSYS2 and use the gnu -make/configure/autoconf etc to do the build. The emulator C-source code -is, however, mostly compiled with Microsoft Visual C++™, producing a -native Windows binary. This is the same procedure as we use to build the -pre-built binaries. Why we use VC++ and not gcc is explained further in -the FAQ section. - -If you are not familiar with Cygwin, MSYS, MSYS2 or a Unix environment, -you’ll probably need to read up a bit on how that works. There are plenty of -documentation about this online. - -These instructions apply for both 32-bit and 64-bit Windows. Note that even -if you build a 64-bit version of Erlang, most of the directories and files -involved are still named win32. Some occurances of the name win64 are -however present. The installation file for a 64-bit Windows version of -Erlang, for example, is `otp_win64_%OTP-REL%.exe`. +This file describes how to build the Erlang emulator and the OTP +libraries on Windows. The instructions apply to versions of Windows +supporting the Cygwin emulated gnuish environment for Windows or the +Msys ditto. We've built on the following platforms: Windows 2003 +server, Windows XP Home/Professional, Windows Vista and Windows 7 (32 +and 64 bit). You can probably build on Windows 2000, but you will not +be able to install the latest Microsoft SDK, so you have to go back to +some earlier compiler. Any Windows95'ish platform will surely get you +into trouble, what I'm not sure of, but it certainly will... + +The procedure described uses either Cygwin or Msys as a build +environment, you run the bash shell in Cygwin/Msys and use gnu +make/configure/autoconf etc to do the build. The emulator C-source +code is, however, mostly compiled with Microsoft Visual C++™, +producing a native Windows binary. This is the same procedure as we +use to build the pre-built binaries. The fact that we use VC++ and not +gcc is explained further in the FAQ section. + +I describe the build procedure to make it possible for open source +customers to build the emulator, given that they have the needed +tools. The binary Windows releases is still a preferred alternative if +one does not have Microsoft's development tools and/or don't want to +install Cygwin or Msys. + +To use Cygwin/Msys, one needs basic experience from a Unix environment, if +one does not know how to set environment variables, run programs etc +in a Unix environment, one will be quite lost in the Cygwin os Msys +ditto. I can unfortunately not teach all the world how to use +Cygwin and bash, neither how to install Cygwin nor perform basic tasks +on a computer. Please refer to other documentation on the net for +help, or use the binary release instead if you have problems using the +tools. -If you feel comfortable with the environment and build +However, if you feel comfortable with the environment and build system, and have all the necessary tools, you have a great opportunity to make the Erlang/OTP distribution for Windows better. Please submit -any suggestions to our [JIRA] [2] and patches to our [git project] [3] to let +any suggestions and patches to the appropriate [mailing lists] [1] to let them find their way into the next version of Erlang. If making changes to the build system (like makefiles etc) please bear in mind that the same makefiles are used on Unix/VxWorks, so that your changes -don't break other platforms. That of course goes for C-code too; system +don't break other platforms. That of course goes for C-code too, system specific code resides in the `$ERL_TOP/erts/emulator/sys/win32` and `$ERL_TOP/erts/etc/win32` directories mostly. The `$ERL_TOP/erts/emulator/beam` directory is for common code. -We've used this build procedure for a couple of +Before the R9C release of Erlang/OTP, the Windows release was built +partly on a Unix (Solaris) box and partly on a Windows box, using Perl +hacks to communicate and sync between the two machines. R9C was the +first release ever built solely on Windows, where no Unix machine is +needed at all. Now we've used this build procedure for a couple of releases, and it has worked fine for us. Still, there might be all sorts of troubles on different machines and with different -setups. We'll try to give hints wherever we've encountered difficulties, +setups. I'll try to give hints wherever I've encountered difficulties, but please share your experiences by using the [erlang-questions] [1] -mailing list. We cannot, of course, help everyone with all -their issues, so please try to solve such issues and submit -solutions/workarounds. +mailing list. I cannot of course help everyone with all +their problems, please try to solve the problems and submit +solutions/workarounds. Remember, it's all about sharing, not about +demanding... + +Starting with R15B, our build system runs both on Cygwin and Msys +(MinGW's fork of an early cygwin version). Msys is a smaller package +to install and may on some machines run slightly faster. If Cygwin +gives you trouble, try Msys instead, and v.v. Beginning with R15B +there is also a native 64bit version of Erlang for 64bit Windows 7 +(only). These instructions apply to both the 32bit VM and the 64bit +ditto. + +Note that even if you build a 64bit VM, most of the directories and +files involved are still named win32. You can view the name win32 as +meaning any windows version not beeing 16bit. A few occurences of the +name Win64 are however present in the system, for example the +installation file for a 64 bit windows version of Erlang is by default +named `otp_win64_.exe`. -Lets go then! We’ll start with a short version of the setup procedure, -followed by some FAQ, and then we’ll go into more details of the setup. - - -Short Version --------------------------- -In the following sections, we've described as much as we could about the -installation of the tools needed. Once the tools are installed, building -is quite easy. We have also tried to make these instructions understandable -for people with limited Unix experience. Cygwin/MSYS/MSYS2 is a whole new -environment to some Windows users, why careful explanation of environment -variables etc seemed to be in place. - -This is the short story though, for the experienced and impatient: - - * Get and install complete Cygwin (latest), complete MinGW with MSYS or - complete MSYS2 - - * Install Visual Studio 12.0 (2013) - - * Install Microsofts Windows SDK 8.1 - - * Get and install Sun's JDK 1.6.0 or later - - * Get and install NSIS 2.01 or later (up to 2.46 tried and working) - - * Get, build and install OpenSSL 0.9.8r or later (up to 1.0.2d - tried & working) with static libs. - - * Get the Erlang source distribution (from - ) and unpack with - Cygwin's/MSYS's/MSYS2's `tar`. - - * Set `ERL_TOP` to where you unpacked the source distribution - - * `$ cd $ERL_TOP` - - * Modify PATH and other environment variables so that all these tools - are runnable from a bash shell. Still standing in `$ERL_TOP`, issue - the following commands (for 32-bit Windows, remove the x64 from the - first row and change `otp_win64_%OTP-REL%` to `otp_win32_%OTP-REL%` on - the last row): - - $ eval `./otp_build env_win32 x64` - $ ./otp_build autoconf - $ ./otp_build configure - $ ./otp_build boot -a - $ ./otp_build release -a - $ ./otp_build installer_win32 - $ release/win32/otp_win64_%OTP-REL% /S - - Voila! `Start->Programs->Erlang OTP %OTP-REL%->Erlang` starts the Erlang - Windows shell. +Lets go then, I'll start with a little FAQ, based on in house questions +and misunderstandings. Frequently Asked Questions @@ -116,12 +88,12 @@ * Q: So, now I can build Erlang using GCC on Windows? A: No, unfortunately not. You'll need Microsoft's Visual C++ - still. A Bourne-shell script (cc.sh) wraps the Visual C++ compiler + still, a Bourne-shell script (cc.sh) wraps the Visual C++ compiler and runs it from within the Cygwin environment. All other tools needed to build Erlang are free-ware/open source, but not the C compiler. The Windows SDK is however enough to build Erlang, you do not need to buy Visual C++, just download the SDK (SDK version - 8.1 == Visual studio 2013). + 7.1 == Visual studio 2010). * Q: Why haven't you got rid of VC++ then, you \*\*\*\*\*\*? @@ -134,17 +106,18 @@ mingw build will possibly be back, but as long as VC++ gives better performance, the commercial build will be a VC++ one. -* Q: OK, you need VC++, but now you've started to demand a quite recent - (and expensive) version of Visual Studio. Why? +* Q: OK, you need VC++, but now you've started to demand a very recent + (and expensive) version of Visual studio, not the old and stable VC++ + 6.0 that was used in earlier versions. Why? A: Well, it's not expensive, it's free (as in free beer). Just download and install the latest Windows SDK from Microsoft and all the tools you need are there. The included debugger (WinDbg) is - also quite usable. That's what I used when porting Erlang to 64bit - Windows. Another reason to use later Microsoft compilers is + also quite usable, it's what I used when porting Erlang to 64bit + Windows. Another reason to use the latest Microsoft compilers is DLL compatibility. DLL's using a new version of the standard library might not load if the VM is compiled with an old VC++ - version. So we should aim to use the latest freely available SDK + version, why we should aim to use the latest freely available SDK and compiler. * Q: Can/will I build a Cygwin binary with the procedure you describe? @@ -157,7 +130,9 @@ some problems. Fixing those problems might be easy or might be hard. I suggest you try yourself and share your experience. No one would be happier if a simple `./configure && make` would produce a fully fledged - Cygwin binary. + Cygwin binary. Ericsson does however not pay me to do a Cygwin port, so + such a port would have to happen in spare time, which is a limited + resource... * Q: Hah, I saw you, you used GCC even though you said you didn't! @@ -167,7 +142,7 @@ particular file, `beam_emu.c` benefits immensely from being able to use the GCC labels-as-values extension, which boosts emulator performance by up to 50%. That does unfortunately not (yet) mean - that all of OTP could be compiled using GCC. That particular + that all of OTP could be compiled using GCC, that particular source code does not do anything system specific and actually is adopted to the fact that GCC is used to compile it on Windows. @@ -177,184 +152,229 @@ A: No, never. The hassle of keeping the project files up to date and do all the steps that constitute an OTP build from within the VC++ GUI is simply not worth it, maybe even impossible. A VC++ project - file for Erlang/OTP will never happen. + file for Erlang/OTP will never happen, at least I will never make + one. Clicking around in super-multi-tab'd dialogs to add a file or + compiler option when it's so much easier in a makefile is simply not + my style. * Q: So how does it all work then? - A: Cygwin, MSYS or MSYS2 is the environment, which closely resembles the - environment found on any Unix machine. It's almost like you had a + A: Cygwin or Msys is the environment, which closely resembles the + environments found on any Unix machine. It's almost like you had a virtual Unix machine inside Windows. Configure, given certain parameters, then creates makefiles that are used by the - environment's gnu-make to built the system. Most of the actual - compilers etc are not, however, Cygwin/MSYS/MSYS2 tools, so we've written + Cygwin/Msys gnu-make to built the system. Most of the actual + compilers etc are not, however, Cygwin/Msys tools, so I've written a couple of wrappers (Bourne-shell scripts), which reside in `$ERL_TOP/etc/win32/cygwin_tools` and `$ERL_TOP/etc/win32/msys_tools`. They all do conversion of parameters and switches common in the Unix environment to fit the native Windows tools. Most notable is of course the paths, which - in Cygwin/MSYS/MSYS2 are Unix-like paths with "forward slashes" (/) and - no drive letters. The Cygwin specific command `cygpath` is used - for most of the path conversions in a Cygwin environment. Other - tools are used (when needed) in the corresponding MSYS and MSYS2 + in Cygwin/Msys are Unix-like paths with "forward slashes" (/) and + no drive letters, the Cygwin specific command `cygpath` is used + for most of the path conversions in a Cygwin environment, other + tools are used (when needed) in the corresponding Msys environment. Luckily most compilers accept forward slashes instead of backslashes as path separators, but one still have to get the drive letters etc right, though. The wrapper scripts are not general in - the sense that, for example, cc.sh would understand and translate - every possible gcc option and pass correct options to + the sense that, for example, cc.sh would understand and translates + every possible gcc option and passes correct options to cl.exe. The principle is that the scripts are powerful enough to allow building of Erlang/OTP, no more, no less. They might need - extensions to cope with changes during the development of Erlang, and - that's one of the reasons we made them into shell-scripts and not - Perl-scripts. We believe they are easier to understand and change - that way. + extensions to cope with changes during the development of Erlang, + that's one of the reasons I made them into shell-scripts and not + Perl-scripts, I believe they are easier to understand and change + that way. I might be wrong though, cause another reason I didn't + write them in Perl is because I've never liked Perl and my Perl + code is no pleasant reading... In `$ERL_TOP`, there is a script called `otp_build`. That script handles the hassle of giving all the right parameters to `configure`/`make` and also helps you set up the correct environment variables to work with - the Erlang source under Cygwin/MSYS/MSYS2. + the Erlang source under Cygwin. * Q: You use and need Cygwin, but then you haven't taken the time to port Erlang to the Cygwin environment but instead focus on your commercial release, is that really ethical? - A: No, not really, but see this as a step in the right direction. + A: No, not really, but see this as a step in the right direction. I'm + aiming at GCC compiled emulators and a Cygwin version, but I really + need to do other things as well... In time, but don't hold your + breath... * Q: Can I build something that looks exactly as the commercial release? - A: Yes, we use the exact same build procedure. + A: Yes, we use the exactly same build procedure. -* Q: Which version of Cygwin/MSYS/MSYS2 and other tools do you use then? +* Q: Which version of Cygwin/Msys and other tools do you use then? - A: For Cygwin, MSYS and MSYS2 alike, we try to use the latest releases + A: For Cygwin and Msys alike, we try to use the latest releases available when building. What versions you use shouldn't really - matter. We try to include workarounds for the bugs we've found in - different Cygwin/MSYS/MSYS2 releases. Please help us add workarounds - for new Cygwin/MSYS/MSYS2-related bugs as soon as you encounter - them. Also please do submit bug reports to the appropriate Cygwin, MSYS - and/or MSYS2 developers. The GCC we used for %OTP-REL% was version - 4.8.1 (MinGW 32bit) and 4.8.5 (MSYS2 64bit). We used VC++ 12.0 - (i.e. Visual studio 2013), Sun's JDK 1.6.0\_45 (32bit) and Sun's - JDK 1.7.0\_1 (64bit), NSIS 2.46, and Win32 OpenSSL 1.0.2d. Please + matter, I try to include workarounds for the bugs I've found in + different Cygwin/Msys releases, please help me add workarounds + for new Cygwin/Msys-related bugs as soon as you encounter + them. Also please do submit bug reports to the appropriate Cygwin + and/or Msys developers. The GCC we used for %OTP-REL% was version + 4.7.0 (MinGW 64bit) and 4.3.4 (Cygwin 32bit). We used VC++ 10.0 + (i.e. Visual studio 2010), Sun's JDK 1.5.0\_17 (32bit) and Sun's + JDK 1.7.0\_1 (64bit), NSIS 2.46, and Win32 OpenSSL 0.9.8r. Please read the next section for details on what you need. -* Q: Can you help me setup X in Cygwin/MSYS/MSYS2? +* Q: Can you help me setup X in Cygwin? - A: No, unfortunately we haven't got time to help with Cygwin/MSYS/MSYS2 - related user problems, please read related websites, newsgroups and + A: No, unfortunately I haven't got time to help with Cygwin related + user problems, please read Cygwin related web sites, newsgroups and mailing lists. +* Q: Why is the instruction so long? Is it really that complicated? + + A: Partly it's long because I babble too much, partly because I've + described as much as I could about the installation of the needed + tools. Once the tools are installed, building is quite easy. I also + have tried to make this instruction understandable for people with + limited Unix experience. Cygwin/Msys is a whole new environment to some + Windows users, why careful explanation of environment variables etc + seemed to be in place. The short story, for the experienced and + impatient is: + + * Get and install complete Cygwin (latest) or complete MinGW with msys + + * Install Microsofts Windows SDK 7.1 (and .Net 4) + + * Get and install Sun's JDK 1.5.0 or higher + + * Get and install NSIS 2.01 or higher (up to 2.46 tried and working) + + * Get, build and install OpenSSL 0.9.8r or higher (up to 1.0.0a + tried & working) with static libs. + + * Get the Erlang source distribution (from + ) and unpack with Cygwin's `tar`. + + * Set `ERL_TOP` to where you unpacked the source distribution + + * `$ cd $ERL_TOP` + + * Get (from ) + and unpack the prebuilt TCL/TK binaries for windows with cygwin tar, + standing in `$ERL_TOP` + + * Modify PATH and other environment variables so that all these tools + are runnable from a bash shell. Still standing in `$ERL_TOP`, issue + the following commands: + + $ eval `./otp_build env_win32` + $ ./otp_build autoconf + $ ./otp_build configure + $ ./otp_build boot -a + $ ./otp_build release -a + $ ./otp_build installer_win32 + $ release/win32/otp_win32_%OTP-REL% /S + + Voila! `Start->Programs->Erlang OTP %OTP-REL%->Erlang` starts the Erlang + Windows shell. + Tools you Need and Their Environment ------------------------------------ You need some tools to be able to build Erlang/OTP on Windows. Most -notably you'll need Cygwin, MSYS or MSYS2, Visual Studio and Microsofts -Windows SDK, but you might also want a Java compiler, the NSIS install -system and OpenSSL. Well, here's some information about the different -tools: +notably you'll need Cygwin or Msys and Microsofts Windows SDK, but +you also might want a Java compiler, the NSIS install system and +OpenSSL. Well' here's the list: * Cygwin, the very latest is usually best. Get all the development - tools and of course all the basic ditto. Make sure to get jar and - also make sure *not* to install a Cygwin'ish Java, since the Cygwin - jar command is used but Sun's Java compiler and virtual machine. + tools and of course all the basic ditto. In fact getting the complete + package might be a good idea, as you'll start to love Cygwin after a + while if you're accustomed to Unix. Make sure to get jar and also make + sure *not* to install a Cygwin'ish Java... The Cygwin jar command is + used but Sun's Java compiler and virtual machine... If you are going to build a 64bit Windows version, you should make - sure to get MinGW's 64bit gcc installed with Cygwin. It's in one of + sure to get MinGW's 64bit gcc installed with cygwin. It's in one of the development packages. URL: - Get the installer from the website and use it to install - Cygwin. Be sure to have fair privileges. If you're on an NT domain you + Get the installer from the web site and use that to install + Cygwin. Be sure to have fair privileges. If you're on a NT domain you should consider running `mkpasswd -d` and `mkgroup -d` after the installation to get the user databases correct. See their respective manual pages. - When you start your first bash shell, you will get an awful prompt. You + When you start you first bash shell, you will get an awful prompt. You might also have a `PATH` environment variable that contains backslashes and such. Edit `$HOME/.profile` and `$HOME/.bashrc` to set fair prompts - and a correct PATH. Also do an `export SHELL` in `.profile`. For some + and set a correct PATH. Also do a `export SHELL` in `.profile`. For some non-obvious reason the environment variable `$SHELL` is not exported in bash. Also note that `.profile` is run at login time and `.bashrc` when sub shells are created. You'll need to explicitly source `.bashrc` from `.profile` if you want the commands there to be run at login time (like - setting up aliases, shell functions and the like). You can for example - do like this at the end of `.profile`: + setting up aliases, shell functions and the like). I personally + usually do like this at the end of `.profile`: ENV=$HOME/.bashrc export ENV . $ENV - You might also want to setup X-windows (XFree86). That might be as easy - as running startx from the command prompt and it might be much harder. - Use Google to find help. + You might also, if you're a hard core type of person at least, want to + setup X-windows (XFree86), that might be as easy as running startx + from the command prompt and it might be much harder. Use Google to + find help... If you don't use X-windows, you might want to setup the Windows console window by selecting properties in the console system menu (upper left corner of the window, the Cygwin icon in the title bar). Especially setting a larger screen buffer size (lines) is useful as it gets you a scrollbar so you can see whatever error messages - that might appear. + that might appear... - There are a few other shells available, but in all examples below we assume - that you use bash. + If you want to use (t)csh instead of bash you're on your own, I + haven't tried and know of no one that has. I expect + that you use bash in all shell examples. -* Alternatively you download MinGW and MSYS. You'll find the latest +* Alternatively you download MinGW and Msys. You'll find the latest installer at: URL: - Make sure to install the basic dev tools, but avoid the MinGW autoconf and - install the msys one instead. + Make sure to install everything they've got. To be able to build the 64bit VM, you will also need the 64bit MinGW compiler from: - URL: + URL: - We've tried up to 1.0, but the latest version should do. Make sure you - download the `mingw-w64-bin_i686-mingw_.zip`, not a linux + The latest version should do it. Make sure you download the + `mingw-w64-bin_i686-mingw_.zip`, not a linux version. You unzip the package on top of your MinGW installation (`c:\MinGW`) and that's it. -* A third alternative is to download and install MSYS2 from: - - URL: + Setting up your environment in Msys is similar to setting it up in + Cygwin. - When you've followed the instructions there, you also need to install - these packages: autoconf, make, perl, and tar. You do so by running - the following in the msys console: - - pacman -S msys/autoconf msys/make msys/perl msys/tar - - You also need a gcc. If you installed the 64 bit MSYS2 you run: - - mingw64/mingw-w64-x86_64-gcc - - And for 32 bit MSYS2: - - pacman -S mingw32/mingw-w64-i686-gcc - pacman -S mingw-w64-i686-editrights +* Microsofts Windows SDK version 7.1 (corresponding to VC++ 10.0 and + Visual Studio 2010). You'll find it here: + + URL: -* Visual Studio 2013 (Visual Studio 12.0). Download and run the web - installer from: + but before you install that, you need to have .Net 4 installed, + you'll find that here: - https://www.visualstudio.com/ + URL: -* Microsofts Windows SDK version 8.1 (corresponding to VC++ 12.0 and - Visual Studio 2013). You'll find it here: - - URL: + Use the web installer for the SDK, at least when I tried + downloading the whole package as an image, I got SDK 7.0 instead, + which is not what you want... -* To help setup the environment, there is a bat file, - `%PROGRAMFILES%\Mirosoft Visual Studio 12.0\VC\vcvarsall.bat`, - that set's the appropriate + There will be a Windows command file in `%PROGRAMFILES%\Mirosoft + SDKs\Windows\v7.1\Bin\SetEnv.cmd` that set's the appropriate environment for a Windows command prompt. This is not appropriate for bash, so you'll need to convert it to bash-style environments by editing your `.bash_profile`. In my case, where the SDK is installed in the default directory and `%PROGRAMFILES%` is `C:\Program Files`, the commands for setting up a 32bit build - environment (on a 64bit or 32bit machine) look like this (in Cygwin): + environment (on a 64bit or 32bit machine) look like this (in cygwin): # Some common paths C_DRV=/cygdrive/c @@ -363,290 +383,314 @@ # nsis NSIS_BIN=$PRG_FLS/NSIS # java - JAVA_BIN=$PROGRAMFILES/Java/jdk1.7.0_02/bin + JAVA_BIN=$PRG_FLS/Java/jdk1.6.0_16/bin ## ## MS SDK ## - CYGWIN=nowinsymlinks - - VISUAL_STUDIO_ROOT=$PRG_FLS/Microsoft\ Visual\ Studio\ 12.0 - WIN_VISUAL_STUDIO_ROOT="C:\\Program Files\\Microsoft Visual Studio 12.0" - SDK=$PRG_FLS/Windows\ Kits/8.1 - WIN_SDK="C:\\Program Files\\Windows Kits\\8.1" + CYGWIN=nowinsymlinks + MVS10="$PRG_FILES/Microsoft Visual Studio 10.0" + WIN_MVS10="C:\\Program Files\\Microsoft Visual Studio 10.0" + SDK10="$PRG_FILES/Microsoft SDKs/Windows/v7.1" + WIN_SDK10="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1" PATH="$NSIS_BIN:\ - $VISUAL_STUDIO_ROOT/VC/bin:\ - $VISUAL_STUDIO_ROOT/VC/vcpackages:\ - $VISUAL_STUDIO_ROOT/Common7/IDE:\ - $VISUAL_STUDIO_ROOT/Common7/Tools:\ - $SDK/bin/x86 + $MVS10/Common7/IDE:\ + $MVS10/Common7/Tools:\ + $MVS10/VC/Bin:\ + $MVS10/VC/Bin/VCPackages:\ + $SDK10/Bin/NETFX 4.0 Tools:\ + $SDK10/Bin:\ /usr/local/bin:/usr/bin:/bin:\ /cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:\ /cygdrive/c/WINDOWS/system32/Wbem:\ $JAVA_BIN" - LIBPATH="$WIN_VISUAL_STUDIO_ROOT\\VC\\lib" + LIBPATH="$WIN_MVS10\\VC\\LIB" - LIB="$WIN_VISUAL_STUDIO_ROOT\\VC\\lib\\;$WIN_SDK\\lib\\winv6.3\\um\\x86" + LIB="$WIN_MVS10\\VC\\LIB;$WIN_SDK10\\LIB" - INCLUDE="$WIN_VISUAL_STUDIO_ROOT\\VC\\include\\;$WIN_SDK\\include\\shared\\; - $WIN_SDK\\include\\um;$WIN_SDK\\include\\winrt\\;$WIN_SDK\\include\\um\\gl" + INCLUDE="$WIN_MVS10\\VC\\INCLUDE;$WIN_SDK10\\INCLUDE;$WIN_SDK10\\INCLUDE\\gl" - export CYGWIN PATH LIBPATH LIB INCLUDE + export CYGWIN PATH LIBPATH LIB INCLUDE - If you're using MinGW's MSYS instead, you need to change the `C_DRV` setting, - which would read: + If you're using Msys instead, the only thing you need to change is + the `C_DRV` setting, which would read: C_DRV=/c - and you also need to change the PATH environment variable to: - - MINGW_BIN=/c/MinGW/bin - - - PATH="$NSIS_BIN:\ - $VISUAL_STUDIO_ROOT/VC/bin:\ - $VISUAL_STUDIO_ROOT/VC/vcpackages:\ - $VISUAL_STUDIO_ROOT/Common7/IDE:\ - $VISUAL_STUDIO_ROOT/Common7/Tools:\ - $SDK/bin/x86:/usr/local/bin:\ - $MINGW_BIN:\ - /bin:/c/Windows/system32:/c/Windows:\ - /c/Windows/System32/Wbem:\ - $JAVA_BIN" - - For MSYS2 you use the same `C_DRV` and PATH as for MSYS, only update the `MINGW_BIN`: - - MINGW_BIN=/mingw32/bin - - - If you are building a 64 bit version of Erlang, you should set up - PATHs etc a little differently. We have two templates to make things - work in both Cygwin and MSYS but needs editing to work with MSYS2 (see the - comments in the script). - The following one is for 32 bits: - - make_winpath() - { - P=$1 - if [ "$IN_CYGWIN" = "true" ]; then - cygpath -d "$P" - else - (cd "$P" && /bin/cmd //C "for %i in (".") do @echo %~fsi") - fi - } - - make_upath() - { - P=$1 - if [ "$IN_CYGWIN" = "true" ]; then - cygpath "$P" - else - echo "$P" | /bin/sed 's,^\([a-zA-Z]\):\\,/\L\1/,;s,\\,/,g' - fi - } + And of course you might need to change `C:\Program Files` etc if + you're using a non-english version of Windows (XP). Note that in + later versions of Windows, the national adoptions of the program + files directories etc are not on the file system but only in the + explorer, so even if explorer says that your programs reside in + e.g. `C:\Program`, they might still reside in `C:\Program Files` + in reality... + + If you are building a 64 bit version of Erlang, you should set up + PATHs etc a little differently. I use the following script to + make things work in both Cygwin and Msys: + + make_winpath() + { + P=$1 + if [ "$IN_CYGWIN" = "true" ]; then + cygpath -d "$P" + else + (cd "$P" && /bin/cmd //C "for %i in (".") do @echo %~fsi") + fi + } + + make_upath() + { + P=$1 + if [ "$IN_CYGWIN" = "true" ]; then + cygpath "$P" + else + echo "$P" | /bin/sed 's,^\([a-zA-Z]\):\\,/\L\1/,;s,\\,/,g' + fi + } + + # Some common paths + if [ -x /usr/bin/msysinfo ]; then + # Without this the path conversion won't work + COMSPEC='C:\Windows\SysWOW64\cmd.exe' + MSYSTEM=MINGW32 + export MSYSTEM COMSPEC + IN_CYGWIN=false + else + CYGWIN=nowinsymlinks + export CYGWIN + IN_CYGWIN=true + fi + + if [ "$IN_CYGWIN" = "true" ]; then + PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:\ + /cygdrive/c/windows/system32:/cygdrive/c/windows:/cygdrive/c/windows/system32/Wbem + else + PATH=/usr/local/bin:/mingw/bin:/bin:/c/Windows/system32:/c/Windows:\ + /c/Windows/System32/Wbem + fi + + if [ "$IN_CYGWIN" = "true" ]; then + C_DRV=/cygdrive/c + else + C_DRV=/c + fi + + PRG_FLS64=$C_DRV/Program\ Files + PRG_FLS32=$C_DRV/Program\ Files\ \(x86\) + VISUAL_STUDIO_ROOT32=$PRG_FLS32/Microsoft\ Visual\ Studio\ 10.0 + MS_SDK_ROOT64=$PRG_FLS64/Microsoft\ SDKs/Windows/v7.1 + + # Okay, now mangle the paths and get rid of spaces by using short names + WIN_VCROOT32=`make_winpath "$VISUAL_STUDIO_ROOT32"` + VCROOT32=`make_upath $WIN_VCROOT32` + WIN_SDKROOT64=`make_winpath "$MS_SDK_ROOT64"` + SDKROOT64=`make_upath $WIN_SDKROOT64` + WIN_PROGRAMFILES32=`make_winpath "$PRG_FLS32"` + PROGRAMFILES32=`make_upath $WIN_PROGRAMFILES32` + + WIN_PROGRAMFILES64=`make_winpath "$PRG_FLS64"` + PROGRAMFILES64=`make_upath $WIN_PROGRAMFILES64` - # Some common paths - if [ -x /usr/bin/msys-?.0.dll ]; then - # Without this the path conversion won't work - COMSPEC='C:\Windows\System32\cmd.exe' - MSYSTEM=MINGW32 # Comment out this line if in MSYS2 - export MSYSTEM COMSPEC - # For MSYS2: Change /mingw/bin to the msys bin dir on the line below - PATH=/usr/local/bin:/mingw/bin:/bin:/c/Windows/system32:\ - /c/Windows:/c/Windows/System32/Wbem - C_DRV=/c - IN_CYGWIN=false - else - PATH=/ldisk/overrides:/usr/local/bin:/usr/bin:/bin:\ - /usr/X11R6/bin:/cygdrive/c/windows/system32:\ - /cygdrive/c/windows:/cygdrive/c/windows/system32/Wbem - C_DRV=/cygdrive/c - IN_CYGWIN=true - fi - - obe_otp_gcc_vsn_map=" - .*=>default - " - obe_otp_64_gcc_vsn_map=" - .*=>default - " - # Program Files - PRG_FLS=$C_DRV/Program\ Files + # nsis + NSIS_BIN=$PROGRAMFILES32/NSIS + # java + JAVA_BIN=$PROGRAMFILES64/Java/jdk1.7.0_01/bin + + ## The PATH variable should be Unix'ish + VCPATH=$VCROOT32/Common7/IDE:$VCROOT32/VC/BIN/amd64:$VCROOT32/Common7/Tools:\ + $VCROOT32/VC/VCPackages:$SDKROOT64/bin/NETFX4~1.0TO/x64:$SDKROOT64/bin/x64:\ + $SDKROOT64/bin + + ## Microsoft SDK libs + + LIBPATH=$WIN_VCROOT32\\VC\\LIB\\amd64 + LIB=$WIN_VCROOT32\\VC\\LIB\\amd64\;$WIN_SDKROOT64\\LIB\\X64 + INCLUDE=$WIN_VCROOT32\\VC\\INCLUDE\;$WIN_SDKROOT64\\include\;\ + $WIN_SDKROOT64\\include\\gl + + # Put nsis, c compiler and java in path + PATH=$NSIS_BIN:$VCPATH:$PATH:$JAVA_BIN + + # Make sure LIB and INCLUDE is available for others + export PATH LIBPATH LIB INCLUDE + + All this is derived from the SetEnv.cmd command file mentioned + earlier. The bottom line is to set the PATH so that NSIS and + Microsoft SDK is found before the Msys/Cygwin tools and that Java + is last in the PATH. + + Make a simple hello world (maybe one that prints out + `sizeof(void *)`) and try to compile it with the `cl` command from within + bash. If that does not work, your environment needs fixing. Also + remember to fix up the PATH environment, especially old Erlang + installations might have inserted quoted paths that Cygwin/Msys + does not understand. Remove or correct such paths. There should be + no backslashes in your path environment variable in Cygwin bash, + but LIB and INCLUDE should contain Windows style paths with + semicolon, drive letters and backslashes. - # Visual Studio - VISUAL_STUDIO_ROOT=$PRG_FLS/Microsoft\ Visual\ Studio\ 12.0 - WIN_VISUAL_STUDIO_ROOT="C:\\Program Files\\Microsoft Visual Studio 12.0" +* Sun's Java JDK 1.5.0 or higher. Our Java code (jinterface, ic) is + written for JDK 1.5.0. Get it for Windows and install it, the JRE is + not enough. If you don't care about Java, you can skip this step, the + result will be that jinterface is not built. - # SDK - SDK=$PRG_FLS/Windows\ Kits/8.1 - WIN_SDK="C:\\Program Files\\Windows Kits\\8.1" + URL: - # NSIS - NSIS_BIN=$PROGRAMFILES/NSIS + Add javac *LAST* to your path environment in bash, in my case this means: - # Java - JAVA_BIN=$PROGRAMFILES/Java/jdk1.7.0_02/bin + `PATH="$PATH:/cygdrive/c/Program Files/Java/jdk1.5.0_17/bin"` - ## The PATH variable should be Cygwin'ish - VCPATH= - $VISUAL_STUDIO_ROOT/VC/bin:\ - $VISUAL_STUDIO_ROOT/VC/vcpackages:\ - $VISUAL_STUDIO_ROOT/Common7/IDE:\ - $VISUAL_STUDIO_ROOT/Common7/Tools:\ - $SDK/bin/x86 + No `CLASSPATH` or anything is needed. Type `javac` at the bash prompt + and you should get a list of available Java options. Make sure by + typing `type java` that you use the Java you installed. Note however that + Cygwin's `jar.exe` is used, that's why the JDK bin-directory should be + added last in the `PATH`. - ## Microsoft SDK libs - LIBPATH=$WIN_VISUAL_STUDIO_ROOT\\VC\\lib +* Nullsoft NSIS installer system. You need this to build the self + installing package. It's a free open source installer that's much + nicer to use than the commercial Wise and Install shield + installers. This is the installer we use for commercial releases as + well from R9C an on. - LIB=$WIN_VISUAL_STUDIO_ROOT\\VC\\lib\\;$WIN_KITS\\lib\\winv6.3\\um\\x86 + URL: - INCLUDE=$WIN_VISUAL_STUDIO_ROOT\\VC\\include\\;\ - $WIN_KITS\\include\\shared\\;$WIN_KITS\\include\\um;\ - $WIN_KITS\\include\\winrt\\;$WIN_KITS\\include\\um\\gl + Install the lot, especially the modern user interface components, as + it's definitely needed. Put `makensis` in your path, in my case: - # Put nsis, c compiler and java in path - export PATH=$VCPATH:$PATH:$JAVA_BIN:$NSIS_BIN + PATH=/cygdrive/c/Program\ Files/NSIS:$PATH - # Make sure LIB and INCLUDE is available for others - export LIBPATH LIB INCLUDE + type makensis at the bash prompt and you should get a list of options + if everything is OK. +* OpenSSL. This is if you want the SSL and crypto applications to + compile (and run). There are prebuilt binaries available, but I + strongly recommend building this yourself. It's quite easy. + First get the source from - The first part of the 64 bit template is identical to the 32 bit one, - but there are some environment variable differences: + URL: - # Program Files - PRG_FLS64=$C_DRV/Program\ Files - PRG_FLS32=$C_DRV/Program\ Files\ \(x86\) + I would recommend using 0.9.8r. - # Visual Studio - VISUAL_STUDIO_ROOT=$PRG_FLS32/Microsoft\ Visual\ Studio\ 12.0 - WIN_VISUAL_STUDIO_ROOT="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0" + Download the tar file and unpack it (using your bash prompt) into + a directory of your choise. - # SDK - SDK=$PRG_FLS32/Windows\ Kits/8.1 - WIN_SDK="C:\\Program Files (x86)\\Windows Kits\\8.1" + You will need a Windowish Perl for the build. ActiveState has one: - # NSIS - NSIS_BIN=$PROGRAMFILES/NSIS - # Java - JAVA_BIN=$PROGRAMFILES/Java/jdk1.7.0_02/bin + URL: - ## The PATH variable should be Cygwin'ish - VCPATH= - $VISUAL_STUDIO_ROOT/VC/bin/amd64:\ - $VISUAL_STUDIO_ROOT/VC/vcpackages:\ - $VISUAL_STUDIO_ROOT/Common7/IDE:\ - $VISUAL_STUDIO_ROOT/Common7/Tools:\ - $SDK/bin/x86 + Download and install that. Disable options to associate it with + the .pl suffix and/or adding things to PATH, they are not needed. - ## Microsoft SDK libs - LIBPATH=$WIN_VISUAL_STUDIO_ROOT\\VC\\lib\\amd64 + Now fire up the Microsoft Windows SDK command prompt in RELEASE + mode for the architecture you are going to build. The easiest is + to copy the shortcut from the SDKs start menu item and edit the + command line in the shortcut (Right click->Properties) to end with + `/Release`. Make sure the banner when you double click your + shortcut (the text in the resulting command window) says + `Targeting Windows XP x64 Release` if you are going to do a 64 bit + build and `Targeting Windows XP x86 Release` if you are building a + 32 bit version. - LIB=$WIN_VISUAL_STUDIO_ROOT\\VC\\lib\\amd64\\;\ - $WIN_KITS\\lib\\winv6.3\\um\\x64 + Now cd to where you unpacked the OpenSSL source using your Release + Windows command prompt (it should be on the same drive as where + you are going to install it if everything is to work smothly). - INCLUDE=$WIN_VISUAL_STUDIO_ROOT\\VC\\include\\;\ - $WIN_KITS\\include\\shared\\;$WIN_KITS\\include\\um;\ - $WIN_KITS\\include\\winrt\\;$WIN_KITS\\include\\um\\gl + C:\> cd - # Put nsis, c compiler and java in path - export PATH=$VCPATH:$PATH:$JAVA_BIN:$NSIS_BIN + Add ActiveState (or some other windows perl, not cygwins) to your PATH: - # Make sure LIB and INCLUDE is available for others - export LIBPATH LIB INCLUDE + C:\...\> set PATH=C:\Perl\bin;%PATH% + Or if you installed the 64bit perl: + + C:\...\> set PATH=C:\Perl64\bin;%PATH% - Make sure to set the PATH so that NSIS and Microsoft SDK is found - before the MSYS/Cygwin tools and that Java is last in the PATH. + Configure OpenSSL for 32 bit: - Make a simple hello world and try to compile it with the `cl` - command from within bash. If that does not work, your environment - needs fixing. Remember, there should be - no backslashes in your path environment variable in Cygwin bash, - but LIB and INCLUDE should contain Windows style paths with - semicolon, drive letters and backslashes. + C:\...\> perl Configure VC-WIN32 --prefix=/OpenSSL -* Sun's Java JDK 1.6.0 or later. Our Java code (jinterface, ic) is - written for JDK 1.6.0. Get it for Windows and install it, the JRE is - not enough. If you don't care about Java, you can skip this step. The - result will be that jinterface is not built. + Or for 64 bit: - URL: + C:\...\> perl Configure VC-WIN64A --prefix=/OpenSSL-Win64 - Add javac *LAST* to your path environment in bash, in my case this means: + Do some setup (for 32 bit): - `PATH="$PATH:/cygdrive/c/Program Files/Java/jdk1.7.0_02/bin"` + C:\...\> ms\do_ms - No `CLASSPATH` or anything is needed. Type `javac` in the bash prompt - and you should get a list of available Java options. Make sure, e.g by - typing `type java`, that you use the Java you installed. Note however that - Cygwin's/MinGW's/MSYS2's `jar.exe` is used. That's why the JDK bin-directory should be - added last in the `PATH`. + The same for 64 bit: -* Nullsoft NSIS installer system. You need this to build the self - installing package. It's a free open source installer that's much - nicer to use than the commercial Wise and Install shield - installers. This is the installer we use for commercial releases as - well. + C:\...\> ms\do_win64a - URL: + Then build static libraries and install: - Install the lot, especially the modern user interface components, as - it's definitely needed. Put `makensis` in your path, in my case: + C:\...\> nmake -f ms\nt.mak + C:\...\> nmake -f ms\nt.mak install - PATH=/cygdrive/c/Program\ Files/NSIS:$PATH + That's it - you now have your perfectly consistent static build of + openssl. If you want to get rid of any possibly patented + algorithms in the lib, just read up on the OpenSSL FAQ and follow + the instructions. - Type makensis at the bash prompt and you should get a list of options - if everything is OK. + The installation locations chosen are where configure will look + for OpenSSL, so try to keep them as is. + +* Building with wxWidgets. Download wxWidgets-2.8.9 or higher patch + release (2.9.\* is a developer release which currently does not work + with wxErlang). -* OpenSSL. This is if you want the SSL and crypto applications to - compile (and run). There are prebuilt binaries, which you can just - download and install, available here: - - URL: - - We would recommend using 1.0.2d. - -* Building with wxWidgets. Download wxWidgets-3.0.2 or higher. - - Install or unpack it to the pgm folder: - Cygwin: - `DRIVE:/PATH/cygwin/opt/local/pgm` - MSYS: - `DRIVE:/PATH/MinGW/msys/1.0/opt/local/pgm` - MSYS2: - `DRIVE:/PATH/msys<32/64>/opt/local/pgm` + Install or unpack it to `DRIVE:/PATH/cygwin/opt/local/pgm`. - If the `wxUSE_POSTSCRIPT` isn't enabled in `\wxMSW-3.0.2\include\wx\msw\setup.h`, - enable it. + edit: `C:\cygwin\opt\local\pgm\wxMSW-2.8.11\include\wx\msw\setup.h` + enable `wxUSE_GLCANVAS`, `wxUSE_POSTSCRIPT` and `wxUSE_GRAPHICS_CONTEXT` build: From a command prompt with the VC tools available (See the instructions for OpenSSL build above for help on starting the proper command prompt in RELEASE mode): - C:\...\> cd \wxMSW-3.0.2\build\msw - C:\...\> nmake BUILD=release SHARED=0 DIR_SUFFIX_CPU= -f makefile.vc + C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\build\msw + C:\...\> nmake BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc + C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\contrib\build\stc + C:\...\> nmake BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc Or - if building a 64bit version: - C:\...\> cd \wxMSW-3.0.2\build\msw - C:\...\> nmake TARGET_CPU=amd64 BUILD=release SHARED=0 DIR_SUFFIX_CPU= -f makefile.vc + C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\build\msw + C:\...\> nmake TARGET_CPU=amd64 BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc + C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\contrib\build\stc + C:\...\> nmake TARGET_CPU=amd64 BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc -* Get the Erlang source distribution (from ). - The same as for Unix platforms. Preferably use tar from within Cygwin, MSYS or MSYS2 to +* The Erlang source distribution (from ). + The same as for Unix platforms. Preferably use tar from within Cygwin to unpack the source tar.gz (`tar zxf otp_src_%OTP-REL%.tar.gz`). - Set the environment `ERL_TOP` to point to the root directory of the + set the environment `ERL_TOP` to point to the root directory of the source distribution. Let's say I stood in `$HOME/src` and unpacked `otp_src_%OTP-REL%.tar.gz`, I then add the following to `.profile`: ERL_TOP=$HOME/src/otp_src_%OTP-REL% export $ERL_TOP +* The TCL/TK binaries. You could compile Tcl/Tk for windows yourself, + but you can get a stripped down version from our website which is + suitable to include in the final binary package. If you want to supply + tcl/tk yourself, read the instructions about how the tcl/tk tar file + used in the build is constructed under `$ERL_TOP/lib/gs/tcl`. The easy + way is to download + and unpack it standing in the `$ERL_TOP` directory. This will create the + file `win32.tar.gz` in `$ERL_TOP/lib/gs/tcl/binaries`. + + One last alternative is to create a file named `SKIP` in the + `$ERL_TOP/lib/gs/` after configure is run, but that will give you an + erlang system without gs (which might be okay as you probably will use + wx anyway). + + Note that there is no special 64bit version of TCL/TK needed, you + can use the 32bit program even for a 64bit build. The Shell Environment --------------------- @@ -687,18 +731,37 @@ sets seems OK. The path is cleaned of spaces if possible (using DOS style short names instead), the variables `OVERRIDE_TARGET`, `CC`, `CXX`, `AR` and `RANLIB` are set to their respective wrappers and the directories -`$ERL_TOP/erts/etc/win32/_tools/vc` and -`$ERL_TOP/erts/etc/win32/_tool` are added first in the PATH. +`$ERL_TOP/erts/etc/win32/cygwin_tools/vc` and +`$ERL_TOP/erts/etc/win32/cygwin_tool` are added first in the PATH. -Now you can check which erlc you have by writing `type erlc` in your shell. -It should reside in `$ERL_TOP/erts/etc/win32/cygwin_tools` -or `$ERL_TOP/erts/etc/win32/msys_tools`. +Try now a `type erlc`. That should result in the erlc wrapper script +(which does not have the .sh extension, for reasons best kept +untold...). It should reside in `$ERL_TOP/erts/etc/win32/cygwin_tools` +or `$ERL_TOP/erts/etc/win32/msys_tools`. You could also try `which +cc.sh`, which `ar.sh` etc. + +Now you're ready to build... Building and Installing ----------------------- -Building is easiest using the `otp_build` script: +Now it's assumed that you have executed `` eval `./otp_build env_win32` `` or +`` eval `./otp_build env_win32 x64` `` for this particular shell... + +Building is easiest using the `otp_build` script. That script takes care +of running configure, bootstrapping etc on Windows in a simple +way. The `otp_build` script is the utility we use ourselves to build on +different platforms and it therefore contains code for all sorts of +platforms. The principle is, however, that for non-Unix platforms, one +uses `./otp_build env_` to set up environment and then the +script knows how to build on the platform "by itself". You've already +run `./otp_build env_win32` in the step above, so now it's mostly like +we build on any platform. OK, here are then steps; Assuming you will +want to build a full installation executable with NSIS, you can omit +`` and the release will be copied to +`$ERL_TOP/release/win32`: and there is where the packed self installing +executable will reside too. $ ./otp_build autoconf # Ignore the warning blob about versions of autoconf $ ./otp_build configure @@ -706,18 +769,18 @@ $ ./otp_build release -a $ ./otp_build installer_win32 # optional -Now you will have a file called `otp_win32_%OTP-REL%.exe` or `otp_win64_%OTP-REL%.exe` -in the ``, i.e. `$ERL_TOP/release/win32`. +Now you will have a file called `otp_win32_R12B.exe` in the +``, i.e. `$ERL_TOP/release/win32`. Lets get into more detail: 1. `$ ./otp_build autoconf` - This step rebuilds the configure scripts - to work correctly in your environment. In an ideal world, this + to work correctly in the cygwin environment. In an ideal world, this would not be needed, but alas, we have encountered several incompatibilities between our distributed configure scripts (generated - on a Linux platform) and the Cygwin/MSYS/MSYS2 environment over the - years. Running autoconf in Cygwin/MSYS/MSYS2 ensures that the configure - scripts are generated in a compatible way and that they will work well + on a Linux platform) and the cygwin environment over the + years. Running autoconf on cygwin ensures that the configure scripts + are generated in a cygwin-compatible way and that they will work well in the next step. 2. `$ ./otp_build configure` - This runs the newly generated configure @@ -726,21 +789,38 @@ this awkward target name and behave accordingly. The CC variable also makes the compiler be `cc.sh`, which wraps MSVC++, so all configure tests regarding the C compiler gets to run the right compiler. A lot of - the tests are not needed on Windows, but we thought it best to run the - whole configure anyway. + the tests are not needed on Windows, but I thought it best to run the + whole configure anyway. The only configure option you might want to + supply is `--with-ssl`, which might be needed if you have built your + own OpenSSL distribution. The Shining Lights distribution should be + found automatically by `configure`, if that fails, add a + `--with-ssl=` that specifies the root directory of your OpenSSL + installation. 3. `$ ./otp_build boot -a` - This uses the bootstrap directory (shipped with the source, `$ERL_TOP/bootstrap`) to build a complete OTP - system. When this is done you can run erl from within the source tree; - just type `$ERL_TOP/bin/erl` and you whould have the prompt. + system. It first builds an emulator and sets up a minimal OTP system + under `$ERL_TOP/bootstrap`, then starts to compile the different OTP + compilers to make the `$ERL_TOP/bootstrap` system potent enough to be + able to compile all Erlang code in OTP. Then, all Erlang and C code + under `$ERL_TOP/lib` is built using the bootstrap system, giving a + complete OTP system (although not installed). When this is done, one + can run Erlang from within the source tree, just type `$ERL_TOP/bin/erl` + and you should have a prompt. If you omit the -a flag, you'll get a + smaller system, that might be useful during development. Now + exit from Erlang and start making a release of the thing: 4. `$ ./otp_build release -a` - Builds a commercial release tree from the - source tree. The default is to put it in `$ERL_TOP/release/win32`. You can + source tree, default is to put it in `$ERL_TOP/release/win32`, you can give any directory as parameter (Cygwin style), but it doesn't really - matter if you're going to build a self extracting installer too. + matter if you're going to build a self extracting installer too. You + could of course build release to the final directory and then run + `./Install.exe` standing in the directory where the release was put, + that will create a fully functional OTP installation. But let's make + the nifty installer: -5. `$ ./otp_build installer_win32` - Creates the self extracting installer executable. - The executable `otp_win32_%OTP-REL%.exe` or `otp_win64_%OTP-REL%.exe` will be placed +5. `$ ./otp_build installer_win32` - Create the self extracting installer + executable. The executable `otp_win32_%OTP-REL%.exe` will be placed in the top directory of the release created in the previous step. If no release directory is specified, the release is expected to have been built to `$ERL_TOP/release/win32`, which also will be the place @@ -749,7 +829,7 @@ /tmp/erl_release`), you're expected to give the same parameter here, (i.e. `./otp_build installer_win32 /tmp/erl_release`). You need to have a full NSIS installation and `makensis.exe` in your path for this to - work. Once you have created the installer, you can run it to + work of course. Once you have created the installer, you can run it to install Erlang/OTP in the regular way, just run the executable and follow the steps in the installation wizard. To get all default settings in the installation without any questions asked, you run the executable @@ -769,17 +849,37 @@ and after a while Erlang/OTP-%OTP-REL% will have been installed in `C:\Program Files\erl%ERTS-VSN%\`, with shortcuts in the menu etc. + The necessary setup of an Erlang installation is actually done by the + program `Install.exe`, which resides in the release top. That program + creates `.ini`-files and copies the correct boot scripts. If one has + the correct directory tree (like after a `./otp_build release -a`), only + the running of `Install.exe` is necessary to get a fully functional + OTP. What the self extracting installer adds is (of course) the + possibility to distribute the binary easily, together with adding + shortcuts to the Windows start menu. There is also some adding of + entries in the registry, to associate `.erl` and `.beam` files with + Erlang and get nifty icons, but that's not something you'll really need + to run Erlang. The registry is also used to store uninstall information, + but if one has not used the self extracting installer, one cannot + (need not) do any uninstall, one just scratches the release directory + and everything is gone. Erlang/OTP does not *need* to put anything + in the Windows registry at all, and does not if you don't use the self + extracting installer. In other words the installer is pure cosmetics. + +> *NOTE*: Beginning with R9C, the Windows installer does *not* add Erlang +> to the system wide path. If one wants to have Erlang in the path, one +> has to add it by hand. Development ----------- Once the system is built, you might want to change it. Having a test -release in some nice directory might be useful, but you can also run +release in some nice directory might be useful, but you also can run Erlang from within the source tree. The target `local_setup`, makes the program `$ERL_TOP/bin/erl.exe` usable and it also uses all the OTP libraries in the source tree. -If you hack the emulator, you can build the emulator executable +If you hack the emulator, you can then build the emulator executable by standing in `$ERL_TOP/erts/emulator` and do a simple $ make opt @@ -828,12 +928,12 @@ $ cd $ERL_TOP/lib/stdlib/src $ make opt -Note that you're expected to have a fresh Erlang in your path when +Note that you're expected o have a fresh Erlang in your path when doing this, preferably the plain %OTP-REL% you have built in the previous steps. You could also add `$ERL_TOP/bootstrap/bin` to your `PATH` before -rebuilding specific libraries. That would give you a good enough +rebuilding specific libraries, that would give you a good enough Erlang system to compile any OTP erlang code. Setting up the path -correctly is a little bit tricky. You still need to have +correctly is a little bit tricky, you still need to have `$ERL_TOP/erts/etc/win32/cygwin_tools/vc` and `$ERL_TOP/erts/etc/win32/cygwin_tools` *before* the actual emulator in the path. A typical setting of the path for using the bootstrap @@ -868,45 +968,72 @@ That's basically all you need to get going. - Using GIT --------- -You might want to check out versions of the source code from GitHUB. That is possible directly in Cygwin, but not in MSYS. There is a project MsysGIT: +You might want to check out versions of the source code from GitHUB. That is possible directly in cygwin, but not in Msys. There is a project MsysGIT: URL: that makes a nice Git port. The msys prompt you get from MsysGIT is however not compatible with the full version from MinGW, so you will need to check out files using MsysGIT's command prompt and then switch -to a common MSYS command prompt for building. Also all test suites -cannot be built as MsysGIT/MSYS does not handle symbolic links. +to a common Msys command prompt for building. Also all test suites +cannot be built as MsysGIT/Msys does not handle symbolic links. To +build test suites on Windows, you will need Cygwin for now. Hopefully +all symbolic links will disappear from our repository soon and this +issue will disappear. + +Final Words +----------- +My hope is that the possibility to build the whole system on Windows +will open up for free development on this platform too. There are many +things one might want to do better in the Windows version, like the +window-style command prompt as well as pure Cygwin porting. Although i +realize it's a much larger step to start building on Windows (with all +the software you need) than for instance on Linux, I sincerely hope +that some of you will make the effort and start submitting Windows +friendly patches. + +The first build system for Erlang using Cygwin on Windows was created +by Per Bergkvist. I haven't used his build system, but it's rumored to +be good. The idea to do this came from his work, so credit is well +deserved. + +Of course this would have been completely impossible without the +excellent Cygwin. The guys at Cygnus solutions and +Redhat deserve a huge THANKS! as well as all the other people in the +free software community who have helped in creating the magnificent +software that constitutes Cygwin. + +Also the people developing the alternative command prompt Msys and +the MinGW compiler are worth huge THANKS! The 64bit port would have +been impossible without the 64bit MinGW compiler. +Good luck and Happy Hacking, +Patrik, OTP Copyright and License --------------------- %CopyrightBegin% -Copyright Ericsson AB 2003-2015. All Rights Reserved. +Copyright Ericsson AB 2003-2014. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. %CopyrightEnd% - [1]: http://www.erlang.org/static/doc/mailinglist.html - [2]: http://bugs.erlang.org - [3]: https://github.com/erlang/otp + [1]: http://www.erlang.org/faq.html "mailing lists" [?TOC]: true diff -Nru erlang-18.2-dfsg/HOWTO/MARKDOWN.md erlang-17.3-dfsg/HOWTO/MARKDOWN.md --- erlang-18.2-dfsg/HOWTO/MARKDOWN.md 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/HOWTO/MARKDOWN.md 2014-09-16 19:10:57.000000000 +0000 @@ -246,17 +246,16 @@ Copyright Ericsson AB 2010-2013. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. %CopyrightEnd% diff -Nru erlang-18.2-dfsg/HOWTO/OTP-PATCH-APPLY.md erlang-17.3-dfsg/HOWTO/OTP-PATCH-APPLY.md --- erlang-18.2-dfsg/HOWTO/OTP-PATCH-APPLY.md 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/HOWTO/OTP-PATCH-APPLY.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,144 +0,0 @@ -Patching OTP Applications -========================= - -Introduction ------------- - -This document describes the process of patching an existing OTP -installation with one or more Erlang/OTP applications of newer versions -than already installed. The tool `otp_patch_apply` is available for this -specific purpose. It resides in the top directory of the Erlang/OTP -source tree. - -The `otp_patch_apply` tool utilizes the [runtime_dependencies][] tag in -the [application resource file][]. This information is used to determine -if the patch can be installed in the given Erlang/OTP installation -directory. - -Read more about the [version handling][] introduced in Erlang/OTP release -17, which also describes how to determine if an installation includes one -or more patched applications. - -If you want to apply patches of multiple OTP applications that resides -in different OTP versions, you have to apply these patches in multiple -steps. It is only possible to apply multiple OTP applications from the -same OTP version at once. - -Prerequisites -------------- - -It's assumed that the reader is familiar with -[building and installing Erlang/OTP][]. To be able to patch an -application, the following must exist: - -* An Erlang/OTP installation. - -* An Erlang/OTP source tree containing the updated applications that - you want to patch into the existing Erlang/OTP installation. - -Using otp\_patch\_apply ------------------------ - -> *WARNING*: Patching applications is a one-way process. -> Create a backup of your OTP installation directory before -> proceeding. - -First of all, build the OTP source tree at `$ERL_TOP` containing -the updated applications. - -> *NOTE*: Before applying a patch you need to do a *full* build -> of OTP in the source directory. - -If you are building in `git` you first need to generate the -`configure` scripts: - - $ ./otp_build autoconf - -Configure and build all applications in OTP: - - $ configure - $ make - -or - - $ ./otp_build configure - $ ./otp_build boot -a - -If you have installed documentation in the OTP installation, also -build the documentation: - - $ make docs - -After the successful build it's time to patch. The source tree directory, -the directory of the installation and the applications to patch are given -as arguments to `otp_patch_apply`. The dependencies of each application -are validated against the applications in the installation and the other -applications given as arguments. If a dependency error is detected, the -script will be aborted. - -The `otp_patch_apply` syntax: - - $ otp_patch_apply -s -i [-l ] [-c] [-f] [-h] \ - [-n] [-v] [... ] - - -s -- OTP source directory that contains build results. - -i -- OTP installation directory to patch. - -l -- Alternative OTP source library directory path(s) - containing build results of OTP applications. - Multiple paths should be colon separated. - -c -- Cleanup (remove) old versions of applications - patched in the installation. - -f -- Force patch of application(s) even though - dependencies are not fulfilled (should only be - considered in a test environment). - -h -- Print help then exit. - -n -- Do not install documentation. - -v -- Print version then exit. - -- Application to patch. - - Environment Variable: - ERL_LIBS -- Alternative OTP source library directory path(s) - containing build results of OTP applications. - Multiple paths should be colon separated. - -> *NOTE*: The complete build environment is required while running -> `otp_patch_apply`. - -> *NOTE*: All source directories identified by `-s` and `-l` should -> contain build results of OTP applications. - -For example, if the user wants to install patched versions of `mnesia` -and `ssl` built in `/home/me/git/otp` into the OTP installation -located in `/opt/erlang/my_otp` type - - $ otp_patch_apply -s /home/me/git/otp -i /opt/erlang/my_otp \ - mnesia ssl - -> *NOTE*: If the list of applications contains core applications, -> i.e `erts`, `kernel`, `stdlib` or `sasl`, the `Install` script in -> the patched Erlang/OTP installation must be rerun. - -The patched applications are appended to the list of installed -applications. Take a look at -`/releases/OTP-REL/installed_application_versions`. - -Sanity check ------------- - -The application dependencies can be checked using the Erlang shell. -Application dependencies are verified among installed applications by -`otp_patch_apply`, but these are not necessarily those actually loaded. -By calling `system_information:sanity_check()` one can validate -dependencies among applications actually loaded. - - 1> system_information:sanity_check(). - ok - -Please take a look at the reference of [sanity_check()][] for more -information. - -[application resource file]: kernel:app -[runtime_dependencies]: kernel:app#runtime_dependencies -[building and installing Erlang/OTP]: INSTALL.md -[version handling]: ../system_principles/versions -[sanity_check()]: runtime_tools:system_information#sanity_check-0 diff -Nru erlang-18.2-dfsg/lib/asn1/c_src/asn1_erl_nif.c erlang-17.3-dfsg/lib/asn1/c_src/asn1_erl_nif.c --- erlang-18.2-dfsg/lib/asn1/c_src/asn1_erl_nif.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/c_src/asn1_erl_nif.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * @@ -950,7 +949,7 @@ } else if (in_buf[*ib_index] == ASN1_INDEFINITE_LENGTH) { (*ib_index)++; curr_head = enif_make_list(env, 0); - if (*ib_index+1 >= in_buf_len || form == ASN1_PRIMITIVE) { + if (*ib_index+1 >= in_buf_len) { return ASN1_INDEF_LEN_ERROR; } while (!(in_buf[*ib_index] == 0 && in_buf[*ib_index + 1] == 0)) { diff -Nru erlang-18.2-dfsg/lib/asn1/c_src/Makefile erlang-17.3-dfsg/lib/asn1/c_src/Makefile --- erlang-18.2-dfsg/lib/asn1/c_src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/c_src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2002-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/asn1ct.xml erlang-17.3-dfsg/lib/asn1/doc/src/asn1ct.xml --- erlang-18.2-dfsg/lib/asn1/doc/src/asn1ct.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/asn1ct.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -36,45 +35,43 @@ ASN.1 compiler and compile-time support functions

The ASN.1 compiler takes an ASN.1 module as input and generates a - corresponding Erlang module, which can encode and decode the specified - data types. Alternatively, the compiler takes a specification module - specifying all input modules, and generates a module with - encode/decode functions. In addition, some generic functions - can be used during development of applications that handles ASN.1 - data (encoded as BER or PER).

- + corresponding Erlang module which can encode and decode the data-types + specified. Alternatively the compiler takes a specification module + (se below) specifying all input modules and generates one module with + encode/decode functions. There are also some generic functions which + can be used in during development of applications which handles ASN.1 + data (encoded as BER or PER).

-

By default in OTP 17, the representation of the BIT STRING - and OCTET STRING types as Erlang terms were changed. BIT - STRING values are now Erlang bit strings and OCTET STRING - values are binaries. Also, an undecoded open type is now wrapped in - an asn1_OPENTYPE tuple. For details, see BIT STRING, OCTET STRING, and - ASN.1 Information Objects in the User's Guide.

-

To revert to the old representation of the types, use option - legacy_erlang_types.

+

By default in OTP 17, the representation of the BIT STRING + and OCTET STRING types as Erlang terms have changed. BIT + STRING values are now Erlang bitstrings and OCTET STRING values + are binaries. Also, an undecoded open type will now be wrapped in + a asn1_OPENTYPE tuple. For details see BIT STRING, OCTET STRING, and + ASN.1 Information Objects in User's Guide.

+

To revert to the old representation of the types, use the + legacy_erlang_types option.

- -

In OTP R16, the options were simplified. The back end is chosen +

In R16, the options have been simplified. The back-end is chosen using one of the options ber, per, or uper. - Options optimize, nif, and driver options - are no longer necessary (and the ASN.1 compiler generates a - warning if they are used). Options ber_bin, per_bin, - and uper_bin options still work, but generates a warning. + The options optimize, nif, and driver options + are no longer necessary (and the ASN.1 compiler will print a + warning if they are used). The options ber_bin, per_bin, + and uper_bin options will still work, but will print a warning.

-

Another change in OTP R16 is that the generated function - encode/2 always returns a binary. Function encode/2 - for the BER back end used to return an iolist.

+

Another change in R16 is that the generated encode/2 + function always returns a binary. + The encode/2 function for the BER back-end used to return + an iolist.

- compile(Asn1module) -> ok | {error, Reason} compile(Asn1module, Options) -> ok | {error, Reason} - Compiles an ASN.1 module and generates encode/decode functions according to encoding rules BER or PER. + Compile an ASN.1 module and generate encode/decode functions according to the encoding rules BER or PER. Asn1module = atom() | string() Options = [Option| OldOption] @@ -88,82 +85,79 @@ Prefix = string() -

Compiles the ASN.1 module Asn1module and generates - an Erlang module Asn1module.erl with encode and decode +

Compiles the ASN.1 module Asn1module and generates an + Erlang module Asn1module.erl with encode and decode functions for the types defined in Asn1module. For each - ASN.1 value defined in the module, an Erlang function that + ASN.1 value defined in the module an Erlang function which returns the value in Erlang representation is generated.

-

If Asn1module is a filename without extension, first - ".asn1" is assumed, then ".asn", and finally +

If Asn1module is a filename without extension first + ".asn1" is assumed, then ".asn" and finally ".py" (to be compatible with the old ASN.1 compiler). - Asn1module can be a full pathname (relative or + Of course Asn1module can be a full pathname (relative or absolute) including filename with (or without) extension.

-

If it is needed to compile a set of ASN.1 modules into an - Erlang file with encode/decode functions, ensure to list all +

If one wishes to compile a set of Asn1 modules into one + Erlang file with encode/decode functions one has to list all involved files in a configuration file. This configuration - file must have a double extension ".set.asn" - (".asn" can alternatively be ".asn1" or ".py"). - List the input file names - within quotation marks (""), one at each row + file must have a double extension ".set.asn", (".asn" can + alternatively be ".asn1" or ".py"). The input files' names + must be listed, within quotation marks (""), one at each row in the file. If the input files are File1.asn, - File2.asn, and File3.asn, the configuration file - must look as follows:

+ File2.asn and File3.asn the configuration file + shall look like:

 File1.asn
 File2.asn
-File3.asn
-

The output files in this case get their names from the - configuration file. If the configuration file is named - SetOfFiles.set.asn, the names of the output files are - SetOfFiles.hrl, SetOfFiles.erl, and SetOfFiles.asn1db.

-

Sometimes in a system of ASN.1 modules, different - default tag modes, for example, AUTOMATIC, IMPLICIT, - or EXPLICIT. The - multi-file compilation resolves the default tagging as if +File3.asn

+

The output files will in this case get their names from the + configuration file. If the configuration file has the name + SetOfFiles.set.asn the name of the output files will be + SetOfFiles.hrl, SetOfFiles.erl and SetOfFiles.asn1db.

+

Sometimes in a system of ASN.1 modules there are different + default tag modes, e.g. AUTOMATIC, IMPLICIT or EXPLICIT. The + multi file compilation resolves the default tagging as if the modules were compiled separately.

-

Name collisions is another unwanted effect that can occur in - multi file-compilation. The compiler solves this problem in one - of two ways:

- - If the definitions are identical, the output module - keeps only one definition with the original name. - If the definitions have the same name and differs in the - definition, they are renamed. The new names are the definition - name and the original module name concatenated. - -

If a name collision occurs, the compiler reports a - "NOTICE: ..." message that tells if a definition was renamed, +

Another unwanted effect that may occur in multi file compilation + is name collisions. The compiler solves this problem in two + ways: If the definitions are identical then the output module + keeps only one definition with the original name. But if + definitions only have same name and differs in the definition, + then they will be renamed. The new names will be the definition + name and the original module name concatenated.

+

If any name collision have occurred the compiler reports a + "NOTICE: ..." message that tells if a definition was renamed, and the new name that must be used to encode/decode data.

-

Options is a list with options specific for the ASN.1 + +

+ Options is a list with options specific for the asn1 compiler and options that are applied to the Erlang compiler. - The latter are not recognized as ASN.1 specific. The - available options are as follows: + The latter are those that not is recognized as asn1 specific. + Available options are:

ber | per | uper

The encoding rule to be used. The supported encoding rules - are Basic Encoding Rules (BER), - Packed Encoding Rules (PER) aligned, and PER unaligned. - If the encoding rule option is omitted, ber + are BER (Basic Encoding Rules), + PER aligned (Packed Encoding Rules) and PER unaligned. + If the encoding rule option is omitted ber is the default.

The generated Erlang module always gets the same name - as the ASN.1 module. Therefore, only one - encoding rule per ASN.1 module can be used at runtime. + as the ASN.1 module and as a consequence of this only one + encoding rule per ASN.1 module can be used at runtime.

der

- With this option the Distinguished Encoding Rules (DER) is chosen. + By this option the Distinguished Encoding Rules (DER) is chosen. DER is regarded as a specialized variant of the BER encoding - rule. Therefore, this option only makes sense together - with option ber. + rule, therefore the der option only makes sense together + with the ber option. This option sometimes adds sorting and value checks when encoding, which implies a slower encoding. The decoding routines are the same @@ -173,123 +167,118 @@ compact_bit_string

- The BIT STRING type is decoded to "compact notation". + The BIT STRING type will be decoded to the "compact notation". This option is not recommended for new code.

-

For details, see Section - - BIT STRING in the User's Guide. +

For details see + + BIT STRING type section in the Users Guide + .

-

This option implies option legacy_erlang_types.

+

This option implies the legacy_erlang_types option.

legacy_bit_string

- The BIT STRING type is decoded to the legacy - format, that is, a list of zeroes and ones. + The BIT STRING type will be decoded to the legacy + format, i.e. a list of zeroes and ones. This option is not recommended for new code.

-

For details, see Section - BIT STRING - in the User's Guide

-

This option implies option legacy_erlang_types.

+

For details see + + BIT STRING type section in the Users Guide + . +

This option implies the legacy_erlang_types option.

+

legacy_erlang_types -

Use the same Erlang types to represent BIT STRING and - OCTET STRING as in OTP R16.

-

For details, see Section BIT STRING and Section - OCTET - STRING in the User's Guide.

-

This option is not recommended for new code.

+

Use the same Erlang types to represent BIT STRING and + OCTET STRING as in R16. For details see BIT STRING and + OCTET + STRING in User's Guide.

+

This option is not recommended for + new code.

{n2n, EnumTypeName}

- Tells the compiler to generate functions for conversion - between names (as atoms) and numbers and conversely for - the specified EnumTypeName. There can be multiple - occurrences of this option to specify several type names. - The type names must be declared as ENUMERATIONS in - the ASN.1 specification.

-

- If EnumTypeName does not exist in the ASN.1 specification, - the compilation stops with an error code.

-

- The generated conversion functions are named + Tells the compiler to generate functions for conversion between + names (as atoms) and numbers and vice versa for the EnumTypeName specified. There can be multiple occurrences of this option in order to specify several type names. The type names must be declared as ENUMERATIONS in the ASN.1 spec. + If the EnumTypeName does not exist in the ASN.1 spec the + compilation will stop with an error code. + The generated conversion functions are named name2num_EnumTypeName/1 and num2name_EnumTypeName/1.

noobj -

Do not compile (that is, do not produce object code) the - generated .erl file. If this option is omitted, the - generated Erlang module is compiled.

+

Do not compile (i.e do not produce object code) the generated + .erl file. If this option is omitted the generated Erlang module + will be compiled.

{i, IncludeDir}

Adds IncludeDir to the search-path for - .asn1db and ASN.1 source files. The compiler - tries to open an .asn1db file when a module imports - definitions from another ASN.1 module. If no - .asn1db file is found, the ASN.1 source file is - parsed. Several {i, IncludeDir} can be given. + .asn1db and asn1 source files. The compiler tries + to open a .asn1db file when a module imports + definitions from another ASN.1 module. If no + .asn1db file is found the asn1 source file is + parsed. Several {i, IncludeDir} can be given.

{outdir, Dir} -

Specifies directory Dir where all generated files - are to be placed. If this option is omitted, the files are - placed in the current directory.

+

Specifies the directory Dir where all generated files + shall be placed. If omitted the files are placed in the + current directory.

asn1config -

When using one of the specialized decodes, exclusive or - selective decode, instructions must be given in - a configuration file. Option asn1config enables - specialized decodes and takes the configuration file in - concern. The configuration file has - the same name as the ASN.1 specification, but with extension - .asn1config. +

When one of the specialized decodes, exclusive or + selective decode, is wanted one has to give instructions in + a configuration file. The option asn1config enables + specialized decodes and takes the configuration file, which + has the same name as the ASN.1 spec but with extension + .asn1config, in concern.

-

For instructions for exclusive decode, see Section - Exclusive - Decode in the User's Guide. +

The instructions for exclusive decode must follow the + instruction and grammar in the User's Guide.

-

For instructions for selective decode, see Section - Selective - Decode in the User's Guide. +

You can also find the instructions for selective decode + in the + User's Guide.

undec_rest -

A buffer that holds a message, being decoded it can also - have some following bytes. Those following bytes can now - be returned together with the decoded value. If an - ASN.1 specification is compiled with this option, a tuple - {ok, Value, Rest} is returned. Rest can be a +

A buffer that holds a message, being decoded may + also have some following bytes. Now it is possible to get + those following bytes returned together with the decoded + value. If an asn1 spec is compiled with this option a tuple + {ok, Value, Rest} is returned. Rest may be a list or a binary. Earlier versions of the compiler ignored those following bytes.

no_ok_wrapper -

With this option, the generated encode/2 - and decode/2 functions do not wrap a successful +

If this option is given, the generated encode/2 + and decode/2 functions will not wrap a successful return value in an {ok,...} tuple. If any error - occurs, an exception will be raised.

+ occurs, there will be an exception.

{macro_name_prefix, Prefix}

All macro names generated by the compiler are prefixed with - Prefix. This is useful when multiple protocols that contain + Prefix. This is useful when multiple protocols that contains macros with identical names are included in a single module.

{record_name_prefix, Prefix}

All record names generated by the compiler are prefixed with - Prefix. This is useful when multiple protocols that contain + Prefix. This is useful when multiple protocols that contains records with identical names are included in a single module.

verbose @@ -302,27 +291,27 @@

Causes warnings to be treated as errors.

-

Any more option that is applied is passed to - the final step when the generated .erl file is compiled. +

Any additional option that is applied will be passed to + the final step when the generated .erl file is compiled.

The compiler generates the following files:

- Asn1module.hrl (if any SET or SEQUENCE - is defined) + +

Asn1module.hrl (if any SET or SEQUENCE is defined)

- Asn1module.erl - Erlang module with encode, decode, - and value functions + +

Asn1module.erl the Erlang module with encode, decode and value functions.

- Asn1module.asn1db - Intermediate format used by the - compiler when modules IMPORT definitions from each other. + +

Asn1module.asn1db intermediate format used by the compiler when modules IMPORTS + definitions from each other.

- encode(Module, Type, Value)-> {ok, Bytes} | {error, Reason} - Encodes an ASN.1 value. + Encode an ASN.1 value. Module = Type = atom() Value = term() @@ -330,11 +319,11 @@ Reason = term() -

Encodes Value of Type defined in the ASN.1 module - Module. To get as fast execution as possible, the - encode function performs only the rudimentary tests that input - Value is a correct instance of Type. So, for example, - the length of strings is +

Encodes Value of Type defined in the ASN.1 module + Module. To get as fast execution as possible the + encode function only performs rudimentary tests that the input + Value + is a correct instance of Type. The length of strings is for example not always checked. Returns {ok, Bytes} if successful or {error, Reason} if an error occurred.

@@ -342,7 +331,6 @@ Use Module:encode(Type, Value) instead.

- decode(Module, Type, Bytes) -> {ok, Value} | {error, Reason} Decode from Bytes into an ASN.1 value. @@ -358,37 +346,26 @@ Use Module:decode(Type, Bytes) instead.

- value(Module, Type) -> {ok, Value} | {error, Reason} - Creates an ASN.1 value for test purposes. + Create an ASN.1 value for test purposes. Module = Type = atom() Value = term() Reason = term() -

Returns an Erlang term that is an example of a valid Erlang - representation of a value of the ASN.1 type Type. The value +

Returns an Erlang term which is an example of a valid Erlang + representation of a value of the ASN.1 type Type. The value is a random value and subsequent calls to this function will for most types return different values.

- -

Currently, the value function has many limitations. - Essentially, it will mostly work for old specifications based - on the 1997 standard for ASN.1, but not for most modern-style - applications. Another limitation is that the value function - may not work if options that change code generations strategies - such as the options macro_name_prefix and - record_name_prefix have been used.

-
- test(Module) -> ok | {error, Reason} test(Module, Type | Options) -> ok | {error, Reason} test(Module, Type, Value | Options) -> ok | {error, Reason} - Performs a test of encode and decode for types in an ASN.1 module. + Perform a test of encode and decode for types in an ASN.1 module. Module = Type = atom() Value = term() @@ -399,17 +376,9 @@

Performs a test of encode and decode of types in Module. The generated functions are called by this function. This function is useful during test to secure that the generated - encode and decode functions as well as the general runtime support - work as expected.

- -

Currently, the test functions have many limitations. - Essentially, they will mostly work for old specifications based - on the 1997 standard for ASN.1, but not for most modern-style - applications. Another limitation is that the test functions - may not work if options that change code generations strategies - such as the options macro_name_prefix and - record_name_prefix have been used.

-
+ encode and decode functions and the general runtime support work + as expected.

+

test/1 iterates over all types in Module.

@@ -421,12 +390,14 @@

test/3 tests type Type with Value.

-

Schematically, the following occurs for each type in the module:

+ +

Schematically the following happens for each type in the module:

{ok, Value} = asn1ct:value(Module, Type), {ok, Bytes} = asn1ct:encode(Module, Type, Value), {ok, Value} = asn1ct:decode(Module, Type, Bytes). -

The test functions use the *.asn1db files + +

The test functions utilizes the *.asn1db files for all included modules. If they are located in a different directory than the current working directory, use the include option to add paths. This is only needed when automatically diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/asn1_getting_started.xml erlang-17.3-dfsg/lib/asn1/doc/src/asn1_getting_started.xml --- erlang-18.2-dfsg/lib/asn1/doc/src/asn1_getting_started.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/asn1_getting_started.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,1291 +0,0 @@ - - - - -

- - 19972013 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Getting Started - Kenneth Lundin - - 1999-03-25 - D - asn1_getting_started.xml -
- -
- Example -

The following example demonstrates the basic functionality used to - run the Erlang ASN.1 compiler.

-

Create a file named People.asn containing the following:

-
-People DEFINITIONS AUTOMATIC TAGS ::=
-BEGIN
-  Person ::= SEQUENCE {
-    name PrintableString,
-    location INTEGER {home(0),field(1),roving(2)},
-    age INTEGER OPTIONAL
-  }
-END      
-

This file must be compiled before it can be used. - The ASN.1 compiler checks that the syntax is correct and that the - text represents proper ASN.1 code before generating an abstract - syntax tree. The code-generator then uses the abstract syntax - tree to generate code.

-

The generated Erlang files are placed in the current directory or - in the directory specified with option {outdir,Dir}.

-

The following shows how the compiler - can be called from the Erlang shell:

- -
-1> asn1ct:compile("People", [ber]).
-ok
-2>      
- -

Option verbose can be added to get information - about the generated files:

-
-2> asn1ct:compile("People", [ber,verbose]).
-Erlang ASN.1 compiling "People.asn" 
---{generated,"People.asn1db"}--
---{generated,"People.hrl"}--
---{generated,"People.erl"}--
-ok
-3>      
- -

ASN.1 module People is now accepted and the - abstract syntax tree is saved in file People.asn1db. - The generated Erlang code is compiled using the Erlang compiler - and loaded into the Erlang runtime system. There is now an API - for encode/2 and decode/2 in module - People, which is called like:

- , )]]> -

- or

-, )]]>

- -

Assume that there is a network - application that receives instances of the ASN.1 defined - type Person, modifies, and sends them back again:

- - -receive - {Port,{data,Bytes}} -> - case 'People':decode('Person',Bytes) of - {ok,P} -> - {ok,Answer} = 'People':encode('Person',mk_answer(P)), - Port ! {self(),{command,Answer}}; - {error,Reason} -> - exit({error,Reason}) - end - end, -

In this example, a series of bytes is received from an - external source and the bytes are then decoded into a valid - Erlang term. This was achieved with the call - 'People':decode('Person',Bytes), which returned - an Erlang value of the ASN.1 type Person. Then an answer was - constructed and encoded using - 'People':encode('Person',Answer), which takes an - instance of a defined ASN.1 type and transforms it to a - binary according to the BER or PER encoding rules.

-

The encoder and decoder can also be run from the shell:

-
-2> Rockstar = {'Person',"Some Name",roving,50}.
-{'Person',"Some Name",roving,50}
-3> {ok,Bin} = 'People':encode('Person',Rockstar).
-{ok,<<243,17,19,9,83,111,109,101,32,78,97,109,101,2,1,2,
-      2,1,50>>}
-4> {ok,Person} = 'People':decode('Person',Bin).
-{ok,{'Person',"Some Name",roving,50}}
-5>      
- -
- Module Dependencies -

It is common that ASN.1 modules import defined types, values, and - other entities from another ASN.1 module.

-

Earlier versions of the ASN.1 compiler required that modules - that were imported from had to be compiled before the module - that imported. This caused problems when ASN.1 modules had circular - dependencies.

-

Referenced modules are now parsed when the compiler finds an - entity that is imported. No code is generated for - the referenced module. However, the compiled modules rely on - that the referenced modules are also compiled.

-
-
- -
- ASN.1 Application User Interface -

The ASN.1 application provides the following two - separate user interfaces:

- - -

The module asn1ct, which provides the compile-time functions - (including the compiler)

-
- -

The module asn1rt_nif, which provides the runtime functions - for the ASN.1 decoder for the BER back end

-
-
-

The reason for this division of the interfaces into compile-time - and runtime - is that only runtime modules (asn1rt*) need to be loaded in - an embedded system. -

- -
- Compile-Time Functions -

The ASN.1 compiler can be started directly from the command line - by the erlc program. This is convenient when compiling - many ASN.1 files from the command line or when using Makefiles. - Some examples of how the erlc command can be used to start - the ASN.1 compiler:

-
-erlc Person.asn
-erlc -bper Person.asn
-erlc -bber ../Example.asn
-erlc -o ../asnfiles -I ../asnfiles -I /usr/local/standards/asn1 Person.asn
-

Useful options for the ASN.1 compiler:

- - -b[ber | per | uper] - -

Choice of encoding rules. If omitted, ber is the - default.

-
- -o OutDirectory - -

Where to put the generated files. Default is the current - directory.

-
- -I IncludeDir - -

Where to search for .asn1db files and ASN.1 - source specs to resolve references to other - modules. This option can be repeated many times if there - are several places to search in. The compiler - searches the current directory first.

-
- +der - -

DER encoding rule. Only when using option -ber.

-
- +asn1config - -

This functionality works together with option - ber. It enables the specialized decodes, see Section - Specialized Decode.

-
- +undec_rest - -

A buffer that holds a message being decoded can also have - trailing bytes. If those trailing bytes are important, they - can be returned along with the decoded value by compiling - the ASN.1 specification with option +undec_rest. - The return value from the decoder is - {ok,Value,Rest} where Rest is a binary - containing the trailing bytes.

-
- +'Any Erlc Option' - -

Any option can be added to the Erlang compiler when - compiling the generated Erlang files. Any option - unrecognized by the ASN.1 compiler is passed to the - Erlang compiler.

-
-
-

For a complete description of erlc, see - ERTS Reference Manual.

-

The compiler and other compile-time functions can also be started - from the Erlang shell. Here follows a brief - description of the primary functions. For a - complete description of each function, see module asn1ct in - the ASN.1 Reference Manual.

-

The compiler is started by asn1ct:compile/1 with - default options, or asn1ct:compile/2 if explicit options - are given.

-

Example:

-
-asn1ct:compile("H323-MESSAGES.asn1").      
-

This equals:

-
-asn1ct:compile("H323-MESSAGES.asn1",[ber]).      
-

If PER encoding is wanted:

-
-asn1ct:compile("H323-MESSAGES.asn1",[per]).      
-

The generic encode and decode functions can be called - as follows:

-
-'H323-MESSAGES':encode('SomeChoiceType',{call,<<"octetstring">>}).
-'H323-MESSAGES':decode('SomeChoiceType',Bytes).      
-
- -
- Runtime Functions -

When an ASN.1 specification is compiled with option ber, - the asn1rt_nif module and the NIF library in - asn1/priv_dir are needed at runtime.

-

By calling function info/0 in a generated module, you - get information about which compiler options were used.

-
- -
- Errors -

Errors detected at - compile-time are displayed on the screen together with line - numbers indicating where in the source file the respective error - was detected. If no errors are found, an Erlang ASN.1 module is - created.

-

The runtime encoders and decoders execute within a catch and - return {ok, Data} or - {error, {asn1, Description}} where - Description is - an Erlang term describing the error.

-
-
- -
- - Multi-File Compilation -

There are various reasons for using multi-file compilation:

- - To choose the name for the generated module, for - example, because you need to compile the same specs for - different encoding rules. - You want only one resulting module. - -

Specify which ASN.1 specs to compile in a module with extension - .set.asn. Choose a module name and provide the - names of the ASN.1 specs. For example, if you have the specs - File1.asn, File2.asn, and File3.asn, your - module MyModule.set.asn looks as follows:

-
-File1.asn
-File2.asn
-File3.asn    
-

If you compile with the following, the result is one merged - module MyModule.erl with the generated code from the three - ASN.1 specs:

- -~> erlc MyModule.set.asn -
- -
- Remark about Tags - -

Tags used to be important for all users of ASN.1, because it - was necessary to add tags manually to certain constructs in order - for the ASN.1 specification to be valid. Example of - an old-style specification:

- -
-Tags DEFINITIONS ::=
-BEGIN
-  Afters ::= CHOICE { cheese [0] IA5String,
-                      dessert [1] IA5String }
-END 
- -

Without the tags (the numbers in square brackets) the ASN.1 - compiler refused to compile the file.

- -

In 1994 the global tagging mode AUTOMATIC TAGS was introduced. - By putting AUTOMATIC TAGS in the module header, the ASN.1 - compiler automatically adds tags when needed. The following is the - same specification in AUTOMATIC TAGS mode:

- -
-Tags DEFINITIONS AUTOMATIC TAGS ::=
-BEGIN
-  Afters ::= CHOICE { cheese IA5String,
-                      dessert IA5String }
-END 
- -

Tags are not mentioned any more in this User's Guide.

-
- -
- - ASN.1 Types -

This section describes the ASN.1 types including their - functionality, purpose, and how values are assigned in Erlang. -

-

ASN.1 has both primitive and constructed types:

-

- - - Primitive Types - Constructed Types - - - BOOLEAN - SEQUENCE - - - INTEGER - SET - - - REAL - CHOICE - - - NULL - SET OF and SEQUENCE OF - - - ENUMERATED - ANY - - - BIT STRING - ANY DEFINED BY - - - OCTET STRING - EXTERNAL - - - Character Strings - EMBEDDED PDV - - - OBJECT IDENTIFIER - CHARACTER STRING - - - Object Descriptor - - - - TIME Types - - - Supported ASN.1 Types -
- - -

The values of each ASN.1 type have their own representation in Erlang, as - described in the following sections. Users must provide - these values for encoding according to the representation, as shown in the - following example:

-
-
-Operational ::= BOOLEAN --ASN.1 definition    
-

In Erlang code it can look as follows:

-
-Val = true,
-{ok,Bytes} = MyModule:encode('Operational', Val),    
- -
- - BOOLEAN -

Booleans in ASN.1 express values that can be either - TRUE or FALSE. - The meanings assigned to TRUE and FALSE are outside the scope - of this text.

-

In ASN.1 it is possible to have:

-
-Operational ::= BOOLEAN
-

Assigning a value to type Operational in Erlang is possible by - using the following Erlang code:

- -Myvar1 = true, -

Thus, in Erlang the atoms true and false are used - to encode a boolean value.

-
- -
- - INTEGER -

ASN.1 itself specifies indefinitely large integers. Erlang - systems with version 4.3 and higher support very large - integers, in practice indefinitely large integers.

-

The concept of subtyping can be applied to integers and - to other ASN.1 types. The details of subtyping are not - explained here; for more information, see X.680. Various - syntaxes are allowed when defining a type as an integer:

-
-T1 ::= INTEGER
-T2 ::= INTEGER (-2..7)
-T3 ::= INTEGER (0..MAX)
-T4 ::= INTEGER (0<..MAX)
-T5 ::= INTEGER (MIN<..-99)
-T6 ::= INTEGER {red(0),blue(1),white(2)}
-

The Erlang representation of an ASN.1 INTEGER is an integer or - an atom if a Named Number List (see T6 in the previous - list) is specified.

-

The following is an example of Erlang code that assigns values for the - types in the previous list:

-
-T1value = 0,
-T2value = 6,
-T6value1 = blue,
-T6value2 = 0,
-T6value3 = white
-

These Erlang variables are now bound to valid instances of - ASN.1 defined types. This style of value can be passed directly - to the encoder for transformation into a series of bytes.

-

The decoder returns an atom if the value corresponds to a - symbol in the Named Number List.

-
- -
- - REAL -

The following ASN.1 type is used for real numbers:

-
-R1 ::= REAL
-

It is assigned a value in Erlang as follows:

-
-R1value1 = "2.14",
-R1value2 = {256,10,-2},
-

In the last line, notice that the tuple {256,10,-2} is the real number - 2.56 in a special notation, which encodes faster than simply - stating the number as "2.56". The arity three tuple is - {Mantissa,Base,Exponent}, that is, Mantissa * Base^Exponent.

-
- -
- - NULL -

The type NULL is suitable where supply and recognition of a value - is important but the actual value is not.

-
-Notype ::= NULL
-

This type is assigned in Erlang as follows:

-
-N1 = 'NULL',
-

The actual value is the quoted atom 'NULL'.

-
- -
- - ENUMERATED -

The type ENUMERATED can be used when the value you want to - describe can only take one of a set of predefined values. Example:

-
-DaysOfTheWeek ::= ENUMERATED { 
-    sunday(1),monday(2),tuesday(3),
-    wednesday(4),thursday(5),friday(6),saturday(7) }
-

For example, to assign a weekday value in Erlang, use the same atom - as in the Enumerations of the type definition:

-
-Day1 = saturday,
-

The enumerated type is similar to an integer type, when - defined with a set of predefined values. The difference is that - an enumerated type can only have specified - values, whereas an integer can have any value.

-
- -
- - BIT STRING -

The type BIT STRING can be used to model information that - is made up of arbitrary length series of bits. It is intended - to be used for selection of flags, not for binary files.

-

In ASN.1, BIT STRING definitions can look as follows:

-
-Bits1 ::= BIT STRING
-Bits2 ::= BIT STRING {foo(0),bar(1),gnu(2),gnome(3),punk(14)}
-

The following two notations are available for representation of BIT - STRING values in Erlang and as input to the encode functions:

- - A bitstring. By default, a BIT STRING with no - symbolic names is decoded to an Erlang bitstring. - A list of atoms corresponding to atoms in the NamedBitList - in the BIT STRING definition. A BIT STRING with symbolic - names is always decoded to the format shown in the following - example: - -
-Bits1Val1 = <<0:1,1:1,0:1,1:1,1:1>>,
-Bits2Val1 = [gnu,punk],
-Bits2Val2 = <<2#1110:4>>,
-Bits2Val3 = [bar,gnu,gnome],
-

Bits2Val2 and Bits2Val3 denote the same value.

-

Bits2Val1 is assigned symbolic values. The assignment means - that the bits corresponding to gnu and punk, that is, bits - 2 and 14 are set to 1, and the rest are set to 0. The symbolic values - are shown as a list of values. If a named value, which is not - specified in the type definition, is shown, a runtime error occurs.

-

BIT STRINGs can also be subtyped with, for example, a SIZE - specification:

-
-Bits3 ::= BIT STRING (SIZE(0..31))      
-

This means that no bit higher than 31 can be set.

- -
- Deprecated Representations for BIT STRING -

In addition to the representations described earlier, the - following deprecated representations are available if the - specification has been compiled with option - legacy_erlang_types:

- - Aa a list of binary digits (0 or 1). This format is - accepted as input to the encode functions, and a BIT STRING - is decoded to this format if option - legacy_bit_string is given. - - As {Unused,Binary} where Unused denotes - how many trailing zero-bits 0-7 that are unused in the - least significant byte in Binary. This format is - accepted as input to the encode functions, and a BIT - STRING is decoded to this format if - compact_bit_string has been given. - - As a hexadecimal number (or an integer). Avoid this - as it is easy to misinterpret a BIT - STRING value in this format. - - -
-
- -
- - OCTET STRING -

OCTET STRING is the simplest of all ASN.1 types. OCTET - STRING only moves or transfers, for example, binary files or other - unstructured information complying with two rules: the - bytes consist of octets and encoding is not required.

-

It is possible to have the following ASN.1 type definitions:

-
-O1 ::= OCTET STRING
-O2 ::= OCTET STRING (SIZE(28))      
-

With the following example assignments in Erlang:

-
-O1Val = <<17,13,19,20,0,0,255,254>>,
-O2Val = <<"must be exactly 28 chars....">>,
-

By default, an OCTET STRING is always represented as - an Erlang binary. If the specification has been compiled with - option legacy_erlang_types, the encode functions - accept both lists and binaries, and the decode functions - decode an OCTET STRING to a list.

-
- -
- - Character Strings -

ASN.1 supports a wide variety of character sets. The main difference - between an OCTET STRING and a character string is that the - OCTET STRING has no imposed semantics on the bytes delivered.

-

However, when using, for example, IA5String (which closely - resembles ASCII), byte 65 (in decimal - notation) means character 'A'. -

-

For example, if a defined type is to be a VideotexString and - an octet is received with the unsigned integer value X, - the octet is to be interpreted as specified in standard - ITU-T T.100, T.101. -

-

The ASN.1 to Erlang compiler - does not determine the correct interpretation of each BER - string octet value with different character strings. The - application is responsible for interpretation - of octets. Therefore, from the BER - string point of view, octets are very similar to - character strings and are compiled in the same way. -

-

When PER is - used, there is a significant difference in the encoding scheme - between OCTET STRINGs and other strings. The constraints - specified for a type are especially important for PER, where - they affect the encoding. -

-

Examples:

-
-Digs ::= NumericString (SIZE(1..3))
-TextFile ::= IA5String (SIZE(0..64000))      
-

The corresponding Erlang assignments:

-
-DigsVal1 = "456",
-DigsVal2 = "123",
-TextFileVal1 = "abc...xyz...",
-TextFileVal2 = [88,76,55,44,99,121 .......... a lot of characters here ....]
-

The Erlang representation for "BMPString" and - "UniversalString" is either a list of ASCII values or a list - of quadruples. The quadruple representation associates to the - Unicode standard representation of characters. The ASCII - characters are all represented by quadruples beginning with - three zeros like {0,0,0,65} for character 'A'. When - decoding a value for these strings, the result is a list of - quadruples, or integers when the value is an ASCII character.

- -

The following example shows how it works. Assume the following - specification is in file PrimStrings.asn1:

-
-PrimStrings DEFINITIONS AUTOMATIC TAGS ::=
-BEGIN
-   BMP ::= BMPString
-END    
- -

Encoding and decoding some strings:

- -
-1> asn1ct:compile('PrimStrings', [ber]).
-ok
-2> {ok,Bytes1} = 'PrimStrings':encode('BMP', [{0,0,53,53},{0,0,45,56}]).
-{ok,<<30,4,53,54,45,56>>}
-3> 'PrimStrings':decode('BMP', Bytes1).
-{ok,[{0,0,53,53},{0,0,45,56}]}
-4> {ok,Bytes2} = 'PrimStrings':encode('BMP', [{0,0,53,53},{0,0,0,65}]).
-{ok,<<30,4,53,53,0,65>>}
-5> 'PrimStrings':decode('BMP', Bytes2).
-{ok,[{0,0,53,53},65]}
-6> {ok,Bytes3} = 'PrimStrings':encode('BMP', "BMP string").
-{ok,<<30,20,0,66,0,77,0,80,0,32,0,115,0,116,0,114,0,105,0,110,0,103>>}
-7> 'PrimStrings':decode('BMP', Bytes3).
-{ok,"BMP string"}      
- -

Type UTF8String is represented as a UTF-8 encoded binary in - Erlang. Such binaries can be created directly using the binary syntax - or by converting from a list of Unicode code points using function - unicode:characters_to_binary/1.

- -

The following shows examples of how UTF-8 encoded binaries can - be created and manipulated:

-
-1> Gs = "Мой маленький Гном".
-[1052,1086,1081,32,1084,1072,1083,1077,1085,1100,1082,1080,
- 1081,32,1043,1085,1086,1084]
-2> Gbin = unicode:characters_to_binary(Gs).
-<<208,156,208,190,208,185,32,208,188,208,176,208,187,208,
-  181,208,189,209,140,208,186,208,184,208,185,32,208,147,
-  208,...>>
-3> Gbin = <<"Мой маленький Гном"/utf8>>.
-<<208,156,208,190,208,185,32,208,188,208,176,208,187,208,
-  181,208,189,209,140,208,186,208,184,208,185,32,208,147,
-  208,...>>
-4> Gs = unicode:characters_to_list(Gbin).
-[1052,1086,1081,32,1084,1072,1083,1077,1085,1100,1082,1080,
- 1081,32,1043,1085,1086,1084]
- -

For details, see the unicode - module in stdlib.

- -

In the following example, this ASN.1 specification is used:

-
-UTF DEFINITIONS AUTOMATIC TAGS ::=
-BEGIN
-   UTF ::= UTF8String
-END   
- -

Encoding and decoding a string with Unicode characters:

- -
-5> asn1ct:compile('UTF', [ber]).
-ok
-6> {ok,Bytes1} = 'UTF':encode('UTF', <<"Гном"/utf8>>).
-{ok,<<12,8,208,147,208,189,208,190,208,188>>}
-7> {ok,Bin1} = 'UTF':decode('UTF', Bytes1).
-{ok,<<208,147,208,189,208,190,208,188>>}
-8> io:format("~ts\n", [Bin1]).
-Гном
-ok
-9> unicode:characters_to_list(Bin1).
-[1043,1085,1086,1084]   
-
- -
- - OBJECT IDENTIFIER -

The type OBJECT IDENTIFIER is used whenever a unique identity is - required. An ASN.1 module, a transfer syntax, and so on, is identified - with an OBJECT IDENTIFIER. Assume the following example:

-
-Oid ::= OBJECT IDENTIFIER
-

Therefore, the following example is a valid Erlang instance of - type 'Oid':

-
-OidVal1 = {1,2,55},
-

The OBJECT IDENTIFIER value is simply a tuple with the - consecutive values, which must be integers. -

-

The first value is limited to the values 0, 1, or 2. The - second value must be in the range 0..39 when the first value - is 0 or 1. -

-

The OBJECT IDENTIFIER is an important type and it is - widely used within different standards to identify various - objects uniquely. Dubuisson: ASN.1 - Communication Between - Heterogeneous Systems includes an - easy-to-understand description of the use of - OBJECT IDENTIFIER.

-
- -
- - Object Descriptor -

Values of this type can be assigned a value as an ordinary string - as follows:

- -
-      "This is the value of an Object descriptor"
-
- -
- - TIME Types -

Two time types are defined within ASN.1: Generalized - Time and Universal Time Coordinated (UTC). Both are assigned a - value as an ordinary string within double quotes, for example, - "19820102070533.8".

-

For DER encoding, the compiler does not check the validity - of the time values. The DER requirements upon those strings are - regarded as a matter for the application to fulfill.

-
- -
- - SEQUENCE -

The structured types of ASN.1 are constructed from other types - in a manner similar to the concepts of array and struct in C.

-

A SEQUENCE in ASN.1 is - comparable with a struct in C and a record in Erlang. - A SEQUENCE can be defined as follows:

-
-Pdu ::= SEQUENCE {
-   a INTEGER,
-   b REAL,
-   c OBJECT IDENTIFIER,
-   d NULL }      
-

This is a 4-component structure called Pdu. The record format - is the major format for representation of SEQUENCE in Erlang. - For each SEQUENCE and SET in an ASN.1 module an Erlang - record declaration is generated. For Pdu, a record - like the following is defined:

-
--record('Pdu',{a, b, c, d}).      
-

The record declarations for a module M are placed in a - separate M.hrl file.

-

Values can be assigned in Erlang as follows:

-
-MyPdu = #'Pdu'{a=22,b=77.99,c={0,1,2,3,4},d='NULL'}.      
-

The decode functions return a record as result when decoding - a SEQUENCE or a SET.

- -

A SEQUENCE and a SET can contain a component - with a DEFAULT keyword followed by the actual value, which - is the default value. The DEFAULT keyword means that the - application doing the encoding can omit encoding of the value, which - results in fewer bytes to send to the receiving application.

- -

An application can use the atom asn1_DEFAULT to indicate - that the encoding is to be omitted for that position in - the SEQUENCE.

- -

Depending on the encoding rules, the encoder can also compare - the given value to the default value and automatically omit the - encoding if the values are equal. How much effort the encoder makes - to compare the values depends on the encoding rules. The DER - encoding rules forbid encoding a value equal to the default value, - so it has a more thorough and time-consuming comparison than the - encoders for the other encoding rules.

- -

In the following example, this ASN.1 specification is used:

-
-File DEFINITIONS AUTOMATIC TAGS ::=
-BEGIN
-Seq1 ::= SEQUENCE {
-    a INTEGER DEFAULT 1,
-    b Seq2 DEFAULT {aa TRUE, bb 15}
-}
-
-Seq2 ::= SEQUENCE {
-    aa BOOLEAN,
-    bb INTEGER
-}
-
-Seq3 ::= SEQUENCE {
-    bs BIT STRING {a(0), b(1), c(2)} DEFAULT {a, c}
-}
-END 
-

Example where the BER encoder is able to omit encoding - of the default values:

-
-1> asn1ct:compile('File', [ber]).
-ok
-2> 'File':encode('Seq1', {'Seq1',asn1_DEFAULT,asn1_DEFAULT}).
-{ok,<<48,0>>}
-3> 'File':encode('Seq1', {'Seq1',1,{'Seq2',true,15}}).
-{ok,<<48,0>>}   
- -

Example with a named BIT STRING where the BER - encoder does not omit the encoding:

-
-4> 'File':encode('Seq3', {'Seq3',asn1_DEFAULT).
-{ok,<<48,0>>}
-5> 'File':encode('Seq3', {'Seq3',<<16#101:3>>).
-{ok,<<48,4,128,2,5,160>>}     
- -

The DER encoder omits the encoding for the same BIT STRING:

-
-6> asn1ct:compile('File', [ber,der]).
-ok
-7> 'File':encode('Seq3', {'Seq3',asn1_DEFAULT).
-{ok,<<48,0>>}
-8> 'File':encode('Seq3', {'Seq3',<<16#101:3>>).
-{ok,<<48,0>>}     
-
- -
- - SET -

In Erlang, the SET type is used exactly as SEQUENCE. - Notice that if BER or DER encoding rules are used, decoding a - SET is slower than decoding a SEQUENCE because the - components must be sorted.

-
- -
- Extensibility for SEQUENCE and SET -

When a SEQUENCE or SET contains an extension marker - and extension components as the following, the type can get more - components in newer versions of the ASN.1 spec:

-
-SExt ::= SEQUENCE {
-           a INTEGER,
-           ...,
-           b BOOLEAN }
-

In this case it has got a new - component b. Thus, incoming messages that are decoded - can have more or fever components than this one. -

-

The component b is treated as - an original component when encoding a message. In this case, as - it is not an optional element, it must be encoded. -

-

During decoding, the b field of the record gets the decoded - value of the b - component, if present, otherwise the value asn1_NOVALUE.

-
- -
- - CHOICE -

The type CHOICE is a space saver and is similar to the - concept of a 'union' in C.

-

Assume the following:

-
-SomeModuleName DEFINITIONS AUTOMATIC TAGS ::=
-BEGIN
-T ::= CHOICE {
-        x REAL,
-        y INTEGER,
-        z OBJECT IDENTIFIER }
-END 
-

It is then possible to assign values as follows:

-
-TVal1 = {y,17},
-TVal2 = {z,{0,1,2}},
-

A CHOICE value is always represented as the tuple - {ChoiceAlternative, Val} where ChoiceAlternative - is an atom denoting the selected choice alternative. -

- -
- Extensible CHOICE -

When a CHOICE contains an extension marker and the - decoder detects an unknown alternative of the CHOICE, - the value is represented as follows:

-
-{asn1_ExtAlt, BytesForOpenType}
-

Here BytesForOpenType is a list of bytes constituting the - encoding of the "unknown" CHOICE alternative.

-
-
- -
- - SET OF and SEQUENCE OF -

The types SET OF and SEQUENCE OF correspond - to the concept of an array - in several programming languages. The Erlang syntax for - both types is straightforward, for example:

-
-Arr1 ::= SET SIZE (5) OF INTEGER (4..9) 
-Arr2 ::= SEQUENCE OF OCTET STRING      
-

In Erlang the following can apply:

-
-Arr1Val = [4,5,6,7,8],
-Arr2Val = ["abc",[14,34,54],"Octets"],      
-

Notice that the definition of type SET OF implies that - the order of the components is undefined, but in practice there is - no difference between SET OF and SEQUENCE OF. - The ASN.1 compiler for Erlang does not randomize the order of the - SET OF components before encoding.

-

However, for a value of type SET OF, the DER - encoding format requires the elements to be sent in ascending - order of their encoding, which implies an expensive sorting - procedure in runtime. Therefore it is recommended to - use SEQUENCE OF instead of SET OF if possible.

-
- -
- - ANY and ANY DEFINED BY -

The types ANY and ANY DEFINED BY have been removed - from the standard since 1994. It is recommended not to use - these types any more. They can, however, exist in some old ASN.1 - modules. The idea with this type was to leave a "hole" in a - definition where it was possible to - put unspecified data of any kind, even non-ASN.1 data.

-

A value of this type is encoded as an open type.

-

Instead of ANY and ANY DEFINED BY, it is - recommended to use - information object class, table constraints, and - parameterization. In particular the construct - TYPE-IDENTIFIER.@Type accomplish the same as the - deprecated ANY.

-

See also - Information object.

-
- -
- - EXTERNAL, EMBEDDED PDV, and CHARACTER STRING -

The types EXTERNAL, EMBEDDED PDV, and - CHARACTER STRING are used in presentation layer negotiation. - They are encoded according to their associated type, see X.680.

-

The type EXTERNAL had a slightly different associated type - before 1994. X.691 states that encoding must follow - the older associated type. So, generated encode/decode - functions convert values of the newer format to the older format - before encoding. This implies that it is allowed to use - EXTERNAL type values of either format for encoding. Decoded - values are always returned in the newer format.

-
- -
- Embedded Named Types -

The structured types previously described can have other named - types as their components. The general syntax to assign a value - to component C of a named ASN.1 type T in Erlang - is the record syntax #'T'{'C'=Value}. - Here Value can be a value of yet another type T2, - for example:

-
-EmbeddedExample DEFINITIONS AUTOMATIC TAGS ::=
-BEGIN
-B ::= SEQUENCE {
-        a Arr1,
-        b T }
-
-Arr1 ::= SET SIZE (5) OF INTEGER (4..9) 
-
-T ::= CHOICE {
-        x REAL,
-        y INTEGER,
-        z OBJECT IDENTIFIER }
-        END      
-

SEQUENCE b can be encoded as follows in Erlang:

-
-1> 'EmbeddedExample':encode('B', {'B',[4,5,6,7,8],{x,"7.77"}}).
-{ok,<<5,56,0,8,3,55,55,55,46,69,45,50>>} 
-
-
- -
- Naming of Records in .hrl Files -

When an ASN.1 specification is compiled, all defined types of type - SET or SEQUENCE result in a corresponding record in the - generated .hrl file. This is because the values for - SET and SEQUENCE are represented as records as - mentioned earlier.

-

Some special cases of this functionality are presented in the - next section.

- -
- Embedded Structured Types -

In ASN.1 it is also possible to have components that are themselves - structured types. - For example, it is possible to have the following:

-
-Emb ::= SEQUENCE {
-    a SEQUENCE OF OCTET STRING,
-    b SET {
-       a INTEGER,
-       b INTEGER DEFAULT 66},
-    c CHOICE {
-       a INTEGER,
-       b FooType } }
-
-FooType ::= [3] VisibleString      
-

The following records are generated because of type Emb:

-
--record('Emb,{a, b, c}).
--record('Emb_b',{a, b = asn1_DEFAULT}). % the embedded SET type 
-

Values of type Emb can be assigned as follows:

- -V = #'Emb'{a=["qqqq",[1,2,255]], - b = #'Emb_b'{a=99}, - c ={b,"Can you see this"}}. -

For an embedded type of type SEQUENCE/SET in a - SEQUENCE/SET, the record name is extended with an - underscore and the component name. If the embedded structure is - deeper with the SEQUENCE, SET, or CHOICE - types in the line, each component name/alternative name is - added to the record name.

-

Example:

-
-Seq ::= SEQUENCE{
-    a CHOICE{
-        b SEQUENCE {
-           c  INTEGER
-        }
-    }
-}      
-

This results in the following record:

-
--record('Seq_a_b',{c}).      
-

If the structured type has a component with an embedded - SEQUENCE OF/SET OF which embedded type in turn - is a SEQUENCE/SET, it gives a record with the - SEQUENCE OF/SET OF - addition as in the following example:

-
-Seq ::= SEQUENCE {
-    a SEQUENCE OF SEQUENCE {
-           b
-               }
-    c SET OF SEQUENCE {
-           d
-               }
-}      
-

This results in the following records:

-
--record('Seq_a_SEQOF'{b}).
--record('Seq_c_SETOF'{d}).      
-

A parameterized type is to be considered as an embedded - type. Each time such a type is referenced, an instance of it is - defined. Thus, in the following example a record with name - 'Seq_b' is generated in the .hrl file and is used - to hold values:

-
-Seq ::= SEQUENCE {
-    b PType{INTEGER}
-}
-
-PType{T} ::= SEQUENCE{
-    id T
-}      
-
- -
- Recursive Types -

Types that refer to themselves are called recursive types. - Example:

-
-Rec ::= CHOICE {
-     nothing NULL,
-     something SEQUENCE {
-          a INTEGER,
-          b OCTET STRING,
-          c Rec }}      
-

This is allowed in ASN.1 and the ASN.1-to-Erlang compiler - supports this recursive type. - A value for this type is assigned in Erlang as follows:

-
-V = {something,#'Rec_something'{a = 77, 
-                                b = "some octets here", 
-                                c = {nothing,'NULL'}}}.      
-
-
- -
- ASN.1 Values -

Values can be assigned to an ASN.1 type within the ASN.1 code - itself, as opposed to the actions in the previous section where - a value was assigned to an ASN.1 type in Erlang. The full value - syntax of ASN.1 is supported and X.680 describes in detail how - to assign values in ASN.1. A short example:

-
-TT ::= SEQUENCE {
-   a INTEGER,
-   b SET OF OCTET STRING }
-
-tt TT ::= {a 77,b {"kalle","kula"}}    
-

The value defined here can be used in several ways. It can, for - example, be used as the value in some DEFAULT component:

-
-SS ::= SET {
-    s OBJECT IDENTIFIER,
-    val TT DEFAULT tt }    
-

It can also be used from inside an Erlang program. If this ASN.1 - code is defined in ASN.1 module Values, the ASN.1 value - tt can be reached from Erlang as a function call to - 'Values':tt() as in the following example:

-
-1> Val = 'Values':tt().
-{'TT',77,["kalle","kula"]}
-2> {ok,Bytes} = 'Values':encode('TT',Val).
-{ok,<<48,18,128,1,77,161,13,4,5,107,97,108,108,101,4,4,
-      107,117,108,97>>}
-4> 'Values':decode('TT',Bytes).
-{ok,{'TT',77,["kalle","kula"]}}
-5>  
-

This example shows that a function is generated by the compiler - that returns a valid Erlang representation of the value, although - the value is of a complex type.

-

Furthermore, a macro is generated for each value in the .hrl - file. So, the defined value tt can also be extracted by - ?tt in application code.

-
- -
- Macros -

The type MACRO is not supported. It is no longer part of - the ASN.1 standard.

-
- -
- - ASN.1 Information Objects (X.681) -

Information Object Classes, Information Objects, and Information - Object Sets (in the following called classes, objects, and - object sets, respectively) are defined in the standard - definition X.681. Only a brief explanation is given here.

-

These constructs makes it possible to define open types, that - is, values of that type can be of any ASN.1 type. Also, - relationships can be defined between different types and - values, as classes can hold types, values, objects, object - sets, and other classes in their fields. A class can be - defined in ASN.1 as follows:

-
-GENERAL-PROCEDURE ::= CLASS {
-      &Message,
-      &Reply               OPTIONAL,
-      &Error               OPTIONAL,
-      &id          PrintableString UNIQUE
-}
-WITH SYNTAX {
-      NEW MESSAGE     &Message
-      [REPLY           &Reply]
-      [ERROR           &Error]
-      ADDRESS          &id
-}    
-

An object is an instance of a class. An object set is a set - containing objects of a specified class. A definition can look - as follows:

-
-object1 GENERAL-PROCEDURE ::= {
-    NEW MESSAGE      PrintableString
-    ADDRESS          "home"
-}
-
-object2 GENERAL-PROCEDURE ::= {
-    NEW MESSAGE INTEGER
-    ERROR INTEGER
-    ADDRESS "remote"
-}
-

The object object1 is an instance of the class - GENERAL-PROCEDURE and has one type field and one - fixed type value field. The object object2 has also an - optional field ERROR, which is a type field. The field - ADDRESS is a UNIQUE field. Objects in an object set - must have unique values in their UNIQUE field, as in - GENERAL-PROCEDURES:

-
-GENERAL-PROCEDURES GENERAL-PROCEDURE ::= {
-    object1 | object2}    
-

You cannot encode a class, object, or object set, only refer to - it when defining other ASN.1 entities. Typically you refer to a - class as well as to object sets by table constraints and component - relation constraints (X.682) in ASN.1 types, as in the following:

-
-StartMessage  ::= SEQUENCE {
-    msgId  GENERAL-PROCEDURE.&id  ({GENERAL-PROCEDURES}),
-    content GENERAL-PROCEDURE.&Message ({GENERAL-PROCEDURES}{@msgId}),
-    }    
-

In type StartMessage, the constraint following field - content tells that in a value of type - StartMessage the value in field content must - come from the same object that is chosen by field msgId.

-

So, the value - #'StartMessage'{msgId="home",content="Any Printable String"} - is legal to encode as a StartMessage value. However, the value - #'StartMessage'{msgId="remote", content="Some String"} - is illegal as the constraint in StartMessage tells that - when you have chosen a value from a specific object in object - set GENERAL-PROCEDURES in field - msgId, you must choose a value from that same object in - the content field too. In this second case, it is to be - any INTEGER value.

-

StartMessage can in field content be - encoded with a value of any type that an object in object set - GENERAL-PROCEDURES has in its NEW MESSAGE field. - This field refers to a type field - &Message in the class. Field msgId is always - encoded as a PrintableString, as the field refers to a - fixed type in the class.

-

In practice, object sets are usually declared to be extensible so - that more objects can be added to the set later. Extensibility is - indicated as follows:

-
-GENERAL-PROCEDURES GENERAL-PROCEDURE ::= {
-    object1 | object2, ...}    
-

When decoding a type that uses an extensible set constraint, - it is always possible that the value in field UNIQUE - is unknown (that is, the type has been encoded with a later - version of the ASN.1 specification). The unencoded data is then - returned wrapped in a tuple as follows:

- -
-{asn1_OPENTYPE,Binary}
- -

Here Binary is an Erlang binary that contains the encoded - data. (If option legacy_erlang_types has been given, - only the binary is returned.)

-
- -
- Parameterization (X.683) -

Parameterization, which is defined in X.683, can be used when - defining types, values, value sets, classes, objects, or object sets. - A part of a definition can be supplied as a parameter. For - example, if a Type is used in a definition with a certain - purpose, you want the type name to express the intention. This - can be done with parameterization.

-

When many types (or another ASN.1 entity) only differ in some - minor cases, but the structure of the types is similar, only - one general type can be defined and the differences can be supplied - through parameters.

-

Example of use of parameterization:

-
-General{Type} ::= SEQUENCE
-{
-     number     INTEGER,
-     string     Type
-}
-      
-T1 ::= General{PrintableString}
-
-T2 ::= General{BIT STRING}
-

An example of a value that can be encoded as type T1 is - {12,"hello"}.

-

Notice that the compiler does not generate encode/decode functions - for parameterized types, only for the instances of the parameterized - types. Therefore, if a file contains the types General{}, - T1, and T2 as in the previous example, encode/decode - functions are only generated for T1 and T2. -

-
- - diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/asn1_introduction.xml erlang-17.3-dfsg/lib/asn1/doc/src/asn1_introduction.xml --- erlang-18.2-dfsg/lib/asn1/doc/src/asn1_introduction.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/asn1_introduction.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ - - - - -
- - 19972013 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Introduction - - - 2015-03-31 - A - asn1_introduction.xml -
- -

The ASN.1 application provides the following:

- - - An ASN.1 compiler for Erlang, which generates encode and - decode functions to be used by Erlang programs sending and - receiving ASN.1 specified data. - Runtime functions used by the generated code. - Support for the following encoding rules: - Basic Encoding Rules (BER) - Distinguished Encoding Rules (DER), a specialized form of - BER that is used in security-conscious applications - Packed Encoding Rules (PER), both the aligned and - unaligned variant - - - - -
- Scope -

This application covers all features of ASN.1 up to the 1997 - edition of the specification. In the 2002 edition, - new features were introduced. The following features - of the 2002 edition are fully or partly supported:

- - -

Decimal notation (for example, "1.5e3) for REAL values. - The NR1, NR2, and NR3 formats as explained in ISO 6093 are - supported.

-
- -

The RELATIVE-OID type for relative object identifiers is - fully supported.

-
- -

The subtype constraint (CONTAINING/ENCODED BY) to - constrain the content of an octet string or a bit string is - parsed when compiling, but no further action is taken. This - constraint is not a PER-visible constraint.

-
- -

The subtype constraint by regular expressions (PATTERN) - for character string types is parsed when compiling, but no - further action is taken. This constraint is not a - PER-visible constraint.

-
- -

Multiple-line comments as in C, /* ... */, are - supported.

-
-
-
- -
- Prerequisites -

It is assumed that the reader is familiar with the Erlang - programming language, concepts of OTP, and is familiar with the - ASN.1 notation. The ASN.1 notation is documented in the standard - definition X.680, which is the primary text. It can also be - helpful, but not necessary, to read the standard definitions - X.681, X.682, X.683, X.690, and X.691.

-

A good book explaining those reference texts is - Dubuisson: ASN.1 - Communication Between Heterogeneous Systems, - is free to download at - http://www.oss.com/asn1/dubuisson.html.

-
- -
- diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/asn1_overview.xml erlang-17.3-dfsg/lib/asn1/doc/src/asn1_overview.xml --- erlang-18.2-dfsg/lib/asn1/doc/src/asn1_overview.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/asn1_overview.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ - - - - -
- - 19972013 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - ASN.1 - Kenneth Lundin - - 1999-03-25 - D - asn1_overview.xml -
- -
- Introduction - -

ASN.1 is a formal language for - describing data structures to be exchanged between distributed - computer systems. The purpose of ASN.1 is to have a platform - and programming language independent notation to express types - using a standardized set of rules for the transformation of - values of a defined type into a stream of bytes. This stream of - bytes can then be sent on any type of communication - channel. This way, two applications written in different - programming languages running on different computers, and with - different internal representation of data, can exchange instances - of structured data types.

- -
-
- diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/asn1rt.xml erlang-17.3-dfsg/lib/asn1/doc/src/asn1rt.xml --- erlang-18.2-dfsg/lib/asn1/doc/src/asn1rt.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/asn1rt.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -47,7 +46,7 @@ decode(Module,Type,Bytes) -> {ok,Value}|{error,Reason} - Decodes from Bytes into an ASN.1 value. + Decode from bytes into an ASN.1 value. Module = Type = atom() Value = Reason = term() @@ -62,7 +61,7 @@ encode(Module,Type,Value)-> {ok,Bytes} | {error,Reason} - Encodes an ASN.1 value. + Encode an ASN.1 value. Module = Type = atom() Value = term() @@ -70,12 +69,12 @@ Reason = term() -

Encodes Value of Type defined in the ASN.1 +

Encodes Value of Type defined in the ASN.1 module Module. Returns a binary if successful. To get - as fast execution as possible, the encode function performs - only the rudimentary test that input Value is a correct - instance of Type. For example, the length of strings is - not always checked.

+ as fast execution as possible the encode function only + performs rudimentary tests that the input Value is a + correct instance of Type. The length of strings is, for + example, not always checked.

Use Module:encode(Type, Value) instead of this function.

@@ -89,23 +88,23 @@ Reason = term()
-

Returns the version of the ASN.1 compiler that was +

info/1 returns the version of the asn1 compiler that was used to compile the module. It also returns the compiler options - that were used.

+ that was used.

Use Module:info() instead of this function.

utf8_binary_to_list(UTF8Binary) -> {ok,UnicodeList} | {error,Reason} - Transforms an UTF8 encoded binary to a unicode list. + Transforms an utf8 encoded binary to a unicode list. UTF8Binary = binary() UnicodeList = [integer()] Reason = term() -

Transforms a UTF8 encoded binary +

utf8_binary_to_list/1 Transforms a UTF8 encoded binary to a list of integers, where each integer represents one character as its unicode value. The function fails if the binary is not a properly encoded UTF8 string.

@@ -115,14 +114,14 @@ utf8_list_to_binary(UnicodeList) -> {ok,UTF8Binary} | {error,Reason} - Transforms an unicode list to a UTF8 binary. + Transforms an unicode list ot an utf8 binary. UnicodeList = [integer()] UTF8Binary = binary() Reason = term() -

Transforms a list of integers, +

utf8_list_to_binary/1 Transforms a list of integers, where each integer represents one character as its unicode value, to a UTF8 encoded binary.

Use unicode:characters_to_binary/1 instead of this function.

diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/asn1_spec.xmlsrc erlang-17.3-dfsg/lib/asn1/doc/src/asn1_spec.xmlsrc --- erlang-18.2-dfsg/lib/asn1/doc/src/asn1_spec.xmlsrc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/asn1_spec.xmlsrc 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -30,100 +29,94 @@ asn1_spec.xml
-

When performance is of highest priority and you are interested in - a limited part of the ASN.1 encoded message before deciding what - to do with the rest of it, an option is to decode only this small - part. The situation can be a server that has to decide the - addressee of a message. The addressee can be interested in - the entire message, but the server can be a bottleneck that you want - to spare any unnecessary load.

-

Instead of making two complete decodes (the normal case of - decode), one in the server and one in the addressee, it is only - necessary to make one specialized decode(in the server) - and another complete decode(in the addressee). This section - describes the following two specialized decodes, which support - to solve this and similar problems:

- - Exclusive decode - Selected decode - -

This functionality is only provided when using BER - (option ber).

+

When performance is of highest priority and one is interested in + a limited part of the ASN.1 encoded message, before one decide what + to do with the rest of it, one may want to decode only this small + part. The situation may be a server that has to decide to which + addressee it will send a message. The addressee may be interested in + the entire message, but the server may be a bottleneck that one want + to spare any unnecessary load. Instead of making two complete decodes (the normal case of decode), one in the server and one + in the addressee, it is only necessary to make one specialized decode(in the server) and another complete decode(in the + addressee). The following specialized decodes exclusive decode and selected decode support to solve this and + similar problems. +

+

So far this functionality is only provided when using the + optimized BER_BIN version, that is when compiling with the + options ber_bin and optimize. It does also work + using the nif option. We have no intent to make this + available on the default BER version, but maybe in the PER_BIN + version (per_bin). +

Exclusive Decode

The basic idea with exclusive - decode is to specify which parts of the message you want to + decode is that you specify which parts of the message you want to exclude from being decoded. These parts remain encoded and are - returned in the value structure as binaries. They can be decoded + returned in the value structure as binaries. They may be decoded in turn by passing them to a certain decode_part/2 - function. The performance gain is high for large messages. - You can do an exclusive decode and later one or more - decodes of the parts, or a second complete decode instead of two or + function. The performance gain is high when the message is large + and you can do an exclusive decode and later on one or several + decodes of the parts or a second complete decode instead of two or more complete decodes.

- Procedure -

To perform an exclusive decode: + How To Make It Work +

In order to make exclusive decode work you have to do the + following:

- Step 1: Decide the name of the function for the - exclusive decode. -

Step 2: Include the following instructions in - a configuration file:

- - The name of the exclusive decode function - The name of the ASN.1 specification - A notation that tells which parts of the message - structure to be excluded from decode -
- Step 3 Compile with the additional option - asn1config. The compiler searches for a configuration - file with the same name as the ASN.1 specification but with - extension .asn1config. This configuration file is not - the same as used for compilation of a set of files. See Section - Writing an Exclusive Decode - Instruction. + First,decide the name of the function for the exclusive + decode. + Second, write instructions that must consist of the name + of the exclusive decode function, the name of the ASN.1 + specification and a notation that tells which parts of the + message structure will be excluded from decode. These + instructions shall be included in a configuration + file. + Third, compile with the additional option + asn1config. The compiler searches for a configuration + file with the same name as the ASN.1 spec but with the + extension .asn1config. This configuration file is not the same + as used for compilation of a set of files. See section + Writing an Exclusive Decode Instruction.
User Interface -

The runtime user interface for exclusive decode consists of - the following two functions:

- - A function for an exclusive decode, whose name the user - decides in the configuration file - The compiler generates a decode_part/2 - function when exclusive decode is chosen. This function decodes - the parts that were left undecoded during the exclusive - decode. - -

Both functions are described in the following.

-

If the exclusive decode function has, for example, the name +

The run-time user interface for exclusive decode consists of + two different functions. First, the function for an exclusive + decode, whose name the user decides in the configuration + file. Second, the compiler generates a decode_part/2 + function when exclusive decode is chosen. This function decodes + the parts that were left undecoded during the exclusive + decode. Both functions are described below. +

+

If the exclusive decode function has for example got the name decode_exclusive and an ASN.1 encoded message - Bin is to be exclusive decoded, the call is as follows:

+ Bin shall be exclusive decoded, the call is:

 {ok,Excl_Message} = 'MyModule':decode_exclusive(Bin)      
-

The result Excl_Message has the same structure as a - complete decode would have, except for the parts of the top type - that were not decoded. The undecoded parts are on their places - in the structure on format {Type_Key,Undecoded_Value}. +

The result Excl_Message has the same structure as an + complete decode would have, except for the parts of the top-type + that were not decoded. The undecoded parts will be on their place + in the structure on the format {Type_Key,Undecoded_Value}.

-

Each undecoded part that is to be decoded must be fed into - function decode_part/2 as follows:

+

Each undecoded part that shall be decoded must be fed into the decode_part/2 function,like:

-{ok,Part_Message} = 'MyModule':decode_part(Type_Key,Undecoded_Value)
+{ok,Part_Message} = 'MyModule':decode_part(Type_Key,Undecoded_Value)
Writing an Exclusive Decode Instruction -

This instruction is written in the configuration file - in the following format:

+

This instruction is written in the configuration file on the + format:

+
 Exclusive_Decode_Instruction = {exclusive_decode,{Module_Name,Decode_Instructions}}.
 
 Module_Name = atom()
@@ -144,76 +137,70 @@
 
 Top_Type = atom()
 
-Name = atom()
-

The instruction must be a valid Erlang term ended by a dot. +Name = atom() + +

Observe that the instruction must be a valid Erlang term ended + by a dot.

-

In Type_List the "path" from the top type to each - undecoded subcomponents is described. The top type of the path is +

In the Type_List the "path" from the top type to each + undecoded sub-components is described. The top type of the path is an atom, the name of it. The action on each component/type that - follows is described by one of - {Name,parts}, {Name,undecoded}, {Name,Element_List}.

-

The use and effect of the actions are as follows: + follows will be described by one of {Name,parts}, {Name,undecoded}, {Name,Element_List}

+

The use and effect of the actions are:

- {Name,undecoded} - Tells that the element is left - undecoded during the exclusive decode. The type of Name - can be any ASN.1 type. The value of element Name is - returned as a tuple (as mentioned in the previous section) in - the value structure of the top type. - {Name,parts} - The type of Name can be one of - SEQUENCE OF or SET OF. The action implies that - the different components of Name are left undecoded. The - value of Name is returned as a tuple (as mentioned in - the previous section) where the second element is a list of - binaries. This is because the representation of a SEQUENCE OF - or a SET OF in Erlang is a list of its internal type. Any - of the elements in this list or the entire list can be decoded by - function decode_part. - {Name,Element_List} - This action is used when one or - more of the subtypes of Name is exclusive decoded. + {Name,undecoded} Tells that the element will be + left undecoded during the exclusive decode. The type of Name may + be any ASN.1 type. The value of element Name will be returned as a + tuple,as mentioned above, in the value structure of the top type. + {Name,parts} The type of Name may be one of + SEQUENCE OF or SET OF. The action implies that the different + components of Name will be left undecoded. The value of Name + will be returned as a tuple, as above , where the second element is a list of + binaries. That is because the representation of a SEQUENCE OF/ + SET OF in Erlang is a list of its internal type. Any of the + elements of this list or the entire list can be decoded by the + decode_part function. + {Name,Element_List}This action is used when one or + more of the sub-types of Name will be exclusive decoded. -

Name in these actions can be a component name of a - SEQUENCE OF or a SET OF, or a name of an alternative - in a CHOICE. +

Name in the actions above may be a component name of a + SEQUENCE or a SET or a name of an alternative in a CHOICE.

Example -

In this examples, the definitions from the following ASN.1 - specification are used:

+

In the examples below we use the definitions from the following ASN.1 spec:

-

If Button is a top type and it is needed to exclude - component number from decode, Type_List in the - instruction in the configuration file is - ['Button',[{number,undecoded}]]. If you call the decode - function decode_Button_exclusive, Decode_Instruction is +

If Button is a top type and we want to exclude + component number from decode the Type_List in the + instruction in the configuration file will be + ['Button',[{number,undecoded}]]. If we call the decode + function decode_Button_exclusive the Decode_Instruction + will be {decode_Button_exclusive,['Button',[{number,undecoded}]]}.

-

Another top type is Window whose subcomponent - actions in type Status and the parts of component - buttonList are to be left undecoded. For this type, the - function is named decode__Window_exclusive. The complete - Exclusive_Decode_Instruction configuration is as follows:

+

We also have another top type Window whose sub + component actions in type Status and the parts of component + buttonList shall be left undecoded. For this type we name + the function decode__Window_exclusive. The whole + Exclusive_Decode_Instruction configuration is as follows:

-

The following figure shows the bytes of a Window:status - message. The components buttonList and actions are - excluded from decode. Only state and enabled are decoded - when decode__Window_exclusive is called.

- Bytes of a Window:status Message + Figure symbolizes the bytes of a Window:status message. The components buttonList and actions are excluded from decode. Only state and enabled are decoded when decode__Window_exclusive is called.

-

Compiling GUI.asn including the configuration file is done - as follows:

+

Compiling GUI.asn including the configuration file is done like:

-unix> erlc -bber +asn1config GUI.asn
+unix> erlc -bber_bin +optimize +asn1config GUI.asn
 
-erlang> asn1ct:compile('GUI', [ber,asn1config]).
-

The module can be used as follows:

+erlang> asn1ct:compile('GUI',[ber_bin,optimize,asn1config]). +

The module can be used like:

+
 1> Button_Msg = {'Button',123,true}.
 {'Button',123,true}
 2> {ok,Button_Bytes} = 'GUI':encode('Button',Button_Msg).
@@ -302,39 +289,35 @@
 11> 'GUI':decode_part(Type_Key_SeqOf,hd(Val_SEQOF)).
 {ok,{'Button',3,true}}
 12> 'GUI':decode_part(Type_Key_Choice,Val_Choice).  
-{ok,{possibleActions,[{'Action',16,{'Button',17,true}}]}}
+{ok,{possibleActions,[{'Action',16,{'Button',17,true}}]}} +
Selective Decode -

This specialized decode decodes a subtype of a - constructed value and is the fastest method to extract a - subvalue. This decode is typically used when you want to - inspect, for example, a version number, to be able to decide what +

This specialized decode decodes one single subtype of a + constructed value. It is the fastest method to extract one sub + value. The typical use of this decode is when one want to + inspect, for instance a version number,to be able to decide what to do with the entire value. The result is returned as {ok,Value} or {error,Reason}.

- Procedure -

To perform a selective decode: + How To Make It Work +

The following steps are necessary:

-

Step 1: Include the following instructions in - the configuration file:

- - The name of the user function - The name of the ASN.1 specification - A notation that tells which part of the type to be - decoded -
- Step 2: Compile with the additional option - asn1config. The compiler searches for a configuration file - with the same name as the ASN.1 specification, but with extension - .asn1config. In the same file you can also provide - configuration specifications for exclusive decode. - The generated Erlang module has the + Write instructions in the configuration + file. Including the name of a user function, the name of the ASN.1 + specification and a notation that tells which part of the type + will be decoded. + Compile with the additional option + asn1config. The compiler searches for a configuration file + with the same name as the ASN.1 spec but with the extension + .asn1config. In the same file you can provide configuration specs + for exclusive decode as well. The generated Erlang module has the usual functionality for encode/decode preserved and the specialized decode functionality added.
@@ -343,20 +326,21 @@
User Interface

The only new user interface function is the one provided by the - user in the configuration file. The function is started by + user in the configuration file. You can invoke that function by the ModuleName:FunctionName notation.

-

For example, if the configuration file includes the specification +

So, if you have the following spec {selective_decode,{'ModuleName',[{selected_decode_Window,TypeList}]}} - do the selective decode by + in the con-fig file, you do the selective decode by {ok,Result}='ModuleName':selected_decode_Window(EncodedBinary).

Writing a Selective Decode Instruction -

One or more selective decode functions can be described in a - configuration file. Use the following notation:

+

It is possible to describe one or many selective decode + functions in a configuration file, you have to use the following + notation:

 Selective_Decode_Instruction = {selective_decode,{Module_Name,Decode_Instructions}}.
 
@@ -374,43 +358,37 @@
 
 Name = atom()
 
-List_Selector = [integer()]
-

The instruction must be a valid Erlang term ended by a dot. -

- - Module_Name is the same as the name of the ASN.1 - specification, but without the extension. - Decode_Instruction is a tuple with your chosen - function name and the components from the top type that leads - to the single type you want to decode. Ensure to choose a name - of your function that is not the same as any of the generated - functions. - The first element of Type_List is the top type of the - encoded message. In Element_List, it is followed by - each of the component names that leads to selected type. - Each name in Element_List must be a constructed type - except the last name, which can be any type. - List_Selector makes it possible to choose one of the - encoded components in a a SEQUENCE OF or a SET OF. - It is also possible to go further in that component and pick a - subtype of that to decode. So, in the Type_List: - ['Window',status,buttonList,[1],number], component - buttonList must be of type SEQUENCE OF or - SET OF. - -

In the example, component number of the first of the encoded - elements in the SEQUENCE OF buttonList is selected. - This applies on the ASN.1 specification in Section - Writing an Exclusive Decode - Instruction. +List_Selector = [integer()] +

Observe that the instruction must be a valid Erlang term ended + by a dot. +

+

The Module_Name is the same as the name of the ASN.1 + spec, but without the extension. A Decode_Instruction is + a tuple with your chosen function name and the components from + the top type that leads to the single type you want to + decode. Notice that you have to choose a name of your function + that will not be the same as any of the generated functions. The + first element of the Type_List is the top type of the + encoded message. In the Element_List it is followed by + each of the component names that leads to selected type. Each of + the names in the Element_List must be constructed types + except the last name, which can be any type. +

+

The List_Selector makes it possible to choose one of the + encoded components in a SEQUENCE OF/ SET OF. It is also possible + to go further in that component and pick a sub type of that to + decode. So in the Type_List: ['Window',status,buttonList,[1],number] the + component buttonList has to be a SEQUENCE OF or SET OF type. In + this example component number of the first of the encoded + elements in the SEQUENCE OF buttonList is selected. This apply on + the ASN.1 spec above.

Another Example -

In this example, the same ASN.1 specification as in Section - Writing an Exclusive Decode Instruction - is used. The following is a valid selective decode instruction:

+

In this example we use the same ASN.1 spec as above. A valid selective decode + instruction is:

 {selective_decode,
     {'GUI',
@@ -426,17 +404,16 @@
       actions,
       possibleActions,
       [1],
-      handle,number]}]}}.
-

The first instruction, + handle,number]}]}}. + +

The first Decode_Instruction, {selected_decode_Window1,['Window',status,buttonList,[1],number]} - is described in the previous section.

-

The second instruction, - {selected_decode_Action,['Action',handle,number]}, takes - component number in the handle component of type - Action. If the value is - ValAction = {'Action',17,{'Button',4711,false}}, the internal - value 4711 is to be picked by selected_decode_Action. In an - Erlang terminal it looks as follows:

+ is commented in the previous section. The instruction + {selected_decode_Action,['Action',handle,number]} picks + the component number in the handle component of the type + Action. If we have the value ValAction = {'Action',17,{'Button',4711,false}} the internal value 4711 + should be picked by selected_decode_Action. In an Erlang + terminal it looks like:

 ValAction = {'Action',17,{'Button',4711,false}}.
 {'Action',17,{'Button',4711,false}}
@@ -446,41 +423,44 @@
 <<48,18,2,1,17,160,13,172,11,171,9,48,7,128,2,18,103,129,1,0>>
 9> 'GUI':selected_decode_Action(BinBytes).
 {ok,4711}
-10>
+10>

The third instruction, ['Window',status,actions,possibleActions,[1],handle,number], - works as follows:

+ which is a little more complicated,

- Step 1: Starts with type Window. - Step 2: Takes component status of Window - that is of type Status. - Step 3: Takes actions of type + starts with type Window. + Picks component status of Window that is + of type Status. + Then takes component actions of type Status. - Step 4: Takes possibleActions of the internally - defined CHOICE type. - Step 5: Goes into the first component of - SEQUENCE OF by [1]. That component is of type - Action. - Step 6: Takes component handle. - Step 7: Takes component number of type + Then possibleActions of the internal defined + CHOICE type. + Thereafter it goes into the first component of the + SEQUENCE OF by [1]. That component is of type + Action. + The instruction next picks component + handle. + And finally component number of the type Button. -

The following figure shows which components are in TypeList - ['Window',status,actions,possibleActions,[1],handle,number]:

+

The following figures shows which components are in the + TypeList + ['Window',status,actions,possibleActions,[1],handle,number]. And + which part of a message that will be decoded by + selected_decode_Window2. +

- Elements Specified in Configuration File for Selective Decode of a Subvalue in a Window Message + The elements specified in the config file for selective decode of a sub-value in a Window message -

In the following figure, only the marked element is decoded by - selected_decode_Window2:

- Bytes of a Window:status Message + Figure symbolizes the bytes of a Window:status message. Only the marked element is decoded when selected_decode_Window2 is called. -

With the following example, you can examine that both +

With the following example you can examine that both selected_decode_Window2 and - selected_decode_Window1 decodes the intended subvalue - of value Val:

+ selected_decode_Window1 decodes the intended sub-value + of the value Val

 1> Val = {'Window',{status,{'Status',12,
                     [{'Button',13,true},
@@ -498,8 +478,8 @@
 4> 'GUI':selected_decode_Window1(Bin).
 {ok,13}
 5> 'GUI':selected_decode_Window2(Bin).
-{ok,18}
-

Notice that the value fed into the selective decode +{ok,18} +

Observe that the value feed into the selective decode functions must be a binary.

@@ -509,19 +489,19 @@ Performance

To give an indication on the possible performance gain using the specialized decodes, some measures have been performed. The - relative figures in the outcome between selective, exclusive, and - complete decode (the normal case) depend on the structure of - the type, the size of the message, and on what level the + relative figures in the outcome between selective, exclusive and + complete decode (the normal case) depends on the structure of + the type, the size of the message and on what level the selective and exclusive decodes are specified.

- ASN.1 Specifications, Messages, and Configuration -

The specifications GUI and + ASN.1 Specifications, Messages and Configuration +

The specs GUI and MEDIA-GATEWAY-CONTROL - were used in the test. + was used in the test.

-

For the GUI specification the configuration was as follows:

+

For the GUI spec the configuration looked like:

 {selective_decode,
   {'GUI',
@@ -543,8 +523,9 @@
                 ['Window',
                  [{status,
                      [{buttonList,parts},
-                      {actions,undecoded}]}]]}]}}.
-

The MEDIA-GATEWAY-CONTROL configuration was as follows:

+ {actions,undecoded}]}]]}]}}. + +

The MEDIA-GATEWAY-CONTROL configuration was:

 {exclusive_decode,
   {'MEDIA-GATEWAY-CONTROL',
@@ -557,8 +538,9 @@
 {selective_decode,
   {'MEDIA-GATEWAY-CONTROL',
     [{decode_MegacoMessage_selective,
-         ['MegacoMessage',mess,version]}]}}.
-

The corresponding values were as follows:

+ ['MegacoMessage',mess,version]}]}}. + +

The corresponding values were:

 {'Window',{status,{'Status',12,
               [{'Button',13,true},
@@ -667,178 +649,177 @@
                 {'StatisticsParameter',[0,11,0,3],[[52,53,49,48,48]]},
                 {'StatisticsParameter',[0,12,0,6],[[48,46,50]]},
                 {'StatisticsParameter',[0,12,0,7],[[50,48]]},
-                {'StatisticsParameter',[0,12,0,8],[[52,48]]}]}]}}}]}]}}}]}}}
-

The size of the encoded values was 458 bytes for GUI and 464 - bytes for MEDIA-GATEWAY-CONTROL. + {'StatisticsParameter',[0,12,0,8],[[52,48]]}]}]}}}]}]}}}]}}} + +

The size of the encoded values was 458 bytes for GUI and 464 + bytes for MEDIA-GATEWAY-CONTROL.

Results -

The ASN.1 specifications in the test were compiled with options - ber_bin, optimize, driver and asn1config. Omitting - option driver gives +

The ASN.1 specs in the test are compiled with the options + ber_bin, optimize, driver and asn1config. If the + driver option had been omitted there should have been higher values for decode and decode_part. These tests have - not been rerun using NIFs, but are expected to perform about 5% better + not been re-run using nifs, but are expected to perform about 5% better than the linked-in driver.

The test program runs 10000 decodes on the value, resulting - in an output with the elapsed time in microseconds for the + in a printout with the elapsed time in microseconds for the total number of decodes.

Function - Time (microseconds) - Decode Type - ASN.1 Specification - % of Time versus Complete Decode + Time(microseconds) + Kind of Decode + ASN.1 spec + % of time vs. complete decode decode_MegacoMessage_selective/1 374045 - Selective + selective MEDIA-GATEWAY-CONTROL 8.3 decode_MegacoMessage_exclusive/1 621107 - Exclusive + exclusive MEDIA-GATEWAY-CONTROL 13.8 decode/2 4507457 - Complete + complete MEDIA-GATEWAY-CONTROL 100 selected_decode_Window1/1 449585 - Selective + selective GUI 7.6 selected_decode_Window2/1 890666 - Selective + selective GUI 15.1 decode_Window_status_exclusive/1 1251878 - Exclusive + exclusive GUI 21.3 decode/2 5889197 - Complete + complete GUI 100 - Results of Complete, Exclusive, and Selective Decode + Results of complete, exclusive and selective decode
-

It is also of interest to know the relation is between +

Another interesting question is what the relation is between a complete decode, an exclusive decode followed by - decode_part of the excluded parts, and a selective decode - followed by a complete decode. Some situations can be compared to - this simulation, for example, inspect a subvalue and later inspect + decode_part of the excluded parts and a selective decode + followed by a complete decode. Some situations may be compared to + this simulation, e.g. inspect a sub-value and later on look at the entire value. The following table shows figures from this - test. The number of loops and the time unit are the same as in the + test. The number of loops and time unit is the same as in the previous test.

Actions Function     - Time (microseconds) - ASN.1 Specification - % of Time vs. Complete Decode + Time(microseconds) + ASN.1 spec + % of time vs. complete decode - Complete + complete decode/2 4507457 MEDIA-GATEWAY-CONTROL 100 - Selective and Complete + selective and complete decode_­MegacoMessage_­selective/1 4881502 MEDIA-GATEWAY-CONTROL 108.3 - Exclusive and decode_part + exclusive and decode_part decode_­MegacoMessage_­exclusive/1 5481034 MEDIA-GATEWAY-CONTROL 112.3 - Complete + complete decode/2 5889197 GUI 100 - Selective and Complete + selective and complete selected_­decode_­Window1/1 6337636 GUI 107.6 - Selective and Complete + selective and complete selected_­decode_­Window2/1 6795319 GUI 115.4 - Exclusive and decode_part + exclusive and decode_part decode_­Window_­status_­exclusive/1 6249200 GUI 106.1 - Results of Complete, Exclusive + decode_part, and Selective + complete decodes + Results of complete, exclusive + decode_part and selective + complete decodes

Other ASN.1 types and values can differ much from these - figures. It is therefore important that you, in every case where + figures. Therefore it is important that you, in every case where you intend to use either of these decodes, perform some tests - that show if you will benefit your purpose. + that shows if you will benefit your purpose.

- Final Remarks - - The gain of using selective and exclusive decode instead of a - complete decode is greater the bigger the value and the - less deep in the structure you have to decode. - Use selective decode instead of exclusive decode if you are - interested in only a single subvalue. - Exclusive decode followed by - decode_part decodes is attractive if the parts are sent - to different servers for decoding, or if you in some cases are not - interested in all parts. - The fastest selective decode is when the decoded type is a + Comments +

Generally speaking the gain of selective and exclusive decode + in advance of complete decode is greater the bigger value and the + less deep in the structure you have to decode. One should also + prefer selective decode instead of exclusive decode if you are + interested in just one single sub-value.

+

Another observation is that the exclusive decode followed by + decode_part decodes is very attractive if the parts will be sent + to different servers for decoding or if one in some cases not is + interested in all parts.

+

The fastest selective decode are when the decoded type is a primitive type and not so deep in the structure of the top - type. selected_decode_Window2 decodes a high constructed - value, which explains why this operation is relatively slow. - It can vary from case to case which combination of - selective/complete decode or exclusive/part decode is the fastest. - + type. The selected_decode_Window2 decodes a big constructed + value, which explains why this operation is relatively slow.

+

It may vary from case to case which combination of + selective/complete decode or exclusive/part decode is the fastest.

diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/asn1_ug.xml erlang-17.3-dfsg/lib/asn1/doc/src/asn1_ug.xml --- erlang-18.2-dfsg/lib/asn1/doc/src/asn1_ug.xml 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/asn1_ug.xml 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,1417 @@ + + + + +
+ + 19972013 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Asn1 + Kenneth Lundin + + 1999-03-25 + D + asn1_ug.xml +
+ +
+ Introduction + +
+ Features +

The Asn1 application provides:

+ + An ASN.1 compiler for Erlang, which generates encode and + decode functions to be used by Erlang programs sending and + receiving ASN.1 specified data. + Run-time functions used by the generated code. + Support for the following encoding rules: + + + Basic Encoding Rules (BER) + + + Distinguished Encoding Rules (DER), a specialized + form of BER that is used in security-conscious + applications. + + + Packed Encoding Rules (PER); both the aligned and + unaligned variant. + + + + +
+ +
+ Overview +

ASN.1 (Abstract Syntax Notation One) is a formal language for + describing data structures to be exchanged between distributed + computer systems. The purpose of ASN.1 is to have a platform + and programming language independent notation to express types + using a standardized set of rules for the transformation of + values of a defined type into a stream of bytes. This stream of + bytes can then be sent on any type of communication + channel. This way, two applications written in different + programming languages running on different computers with + different internal representation of data can exchange instances + of structured data types.

+
+ +
+ Prerequisites +

It is assumed that the reader is familiar with the ASN.1 + notation as documented in the standard definition [] which is the primary text. It may also be + helpful, but not necessary, to read the standard definitions + [] [] [] [] [].

+

A good book explaining those reference texts is + [], which is free to download at + http://www.oss.com/asn1/dubuisson.html. +

+
+ +
+ Capabilities +

This application covers all features of ASN.1 up to the 1997 + edition of the specification. In the 2002 edition of ASN.1 a + number of new features were introduced. The following features + of the 2002 edition are fully or partly supported as shown + below:

+ + +

Decimal notation (e.g., "1.5e3") for REAL values. The + NR1, NR2 and NR3 formats as explained in ISO6093 are + supported.

+
+ +

The RELATIVE-OID type for relative object identifiers is + fully supported.

+
+ +

The subtype constraint (CONTAINING/ENCODED BY) to + constrain the content of an octet string or a bit string is + parsed when compiling, but no further action is taken. This + constraint is not a PER-visible constraint.

+
+ +

The subtype constraint by regular expressions (PATTERN) + for character string types is parsed when compiling, but no + further action is taken. This constraint is not a + PER-visible constraint.

+
+ +

Multiple-line comments as in C, /* ... */, are + supported.

+
+
+
+ +
+ +
+ Getting Started with Asn1 + +
+ A First Example +

The following example demonstrates the basic functionality used to run + the Erlang ASN.1 compiler.

+

Create a file called People.asn containing the following:

+
+People DEFINITIONS AUTOMATIC TAGS ::=
+BEGIN
+  Person ::= SEQUENCE {
+    name PrintableString,
+    location INTEGER {home(0),field(1),roving(2)},
+    age INTEGER OPTIONAL
+  }
+END      
+

This file (People.asn) must be compiled before it can be + used. + The ASN.1 compiler checks that the syntax is correct and that the + text represents proper ASN.1 code before generating an abstract + syntax tree. The code-generator then uses the abstract syntax + tree in order to generate code. +

+

The generated Erlang files will be placed in the current directory or + in the directory specified with the {outdir,Dir} option. + The following shows how the compiler + can be called from the Erlang shell:

+
+1> asn1ct:compile("People", [ber]).
+ok
+2>      
+ +

The verbose option can be given to have information + about the generated files printed:

+
+2> asn1ct:compile("People", [ber,verbose]).
+Erlang ASN.1 compiling "People.asn" 
+--{generated,"People.asn1db"}--
+--{generated,"People.hrl"}--
+--{generated,"People.erl"}--
+ok
+3>      
+ +

The ASN.1 module People is now accepted and the + abstract syntax tree is saved in the People.asn1db file; + the generated Erlang code is compiled using the Erlang compiler + and loaded into the Erlang run-time system. Now there is an API + for encode/2 and decode/2 in the module + People, which is invoked by:

+ , )]]> +

+ or

+, )]]>

+ +

Assume there is a network + application which receives instances of the ASN.1 defined + type Person, modifies and sends them back again:

+ +receive + {Port,{data,Bytes}} -> + case 'People':decode('Person',Bytes) of + {ok,P} -> + {ok,Answer} = 'People':encode('Person',mk_answer(P)), + Port ! {self(),{command,Answer}}; + {error,Reason} -> + exit({error,Reason}) + end + end, +

In the example above, a series of bytes is received from an + external source and the bytes are then decoded into a valid + Erlang term. This was achieved with the call + 'People':decode('Person',Bytes) which returned + an Erlang value of the ASN.1 type Person. Then an answer was + constructed and encoded using + 'People':encode('Person',Answer) which takes an + instance of a defined ASN.1 type and transforms it to a + binary according to the BER or PER encoding rules. +

+The encoder and the decoder can also be run from + the shell.

+
+2> Rockstar = {'Person',"Some Name",roving,50}.
+{'Person',"Some Name",roving,50}
+3> {ok,Bin} = 'People':encode('Person',Rockstar).
+{ok,<<243,17,19,9,83,111,109,101,32,78,97,109,101,2,1,2,
+      2,1,50>>}
+4> {ok,Person} = 'People':decode('Person',Bin).
+{ok,{'Person',"Some Name",roving,50}}
+5>      
+
+ +
+ Module dependencies +

It is common that ASN.1 modules import defined types, values and + other entities from another ASN.1 module.

+

Earlier versions of the ASN.1 compiler required that modules that + were imported from had to be compiled before the module that + imported. This caused problems when ASN.1 modules had circular + dependencies.

+

Referenced modules are now parsed when the compiler finds an + entity that is imported. There will not be any code generated for + the referenced module. However, the compiled module rely on + that the referenced modules also will be compiled.

+
+
+ +
+ The Asn1 Application User Interface +

The Asn1 application provides two separate user interfaces:

+ + +

The module asn1ct which provides the compile-time functions + (including the compiler).

+
+ +

The module asn1rt_nif which provides the run-time functions + for the ASN.1 decoder for the BER back-end.

+
+
+

The reason for the division of the interface into compile-time + and run-time + is that only run-time modules (asn1rt*) need to be loaded in + an embedded system. +

+ +
+ Compile-time Functions +

The ASN.1 compiler can be invoked directly from the command-line + by means of the erlc program. This is convenient when compiling + many ASN.1 files from the command-line or when using Makefiles. + Here are some examples of how the erlc command can be used to invoke the + ASN.1 compiler:

+
+erlc Person.asn
+erlc -bper Person.asn
+erlc -bber ../Example.asn
+erlc -o ../asnfiles -I ../asnfiles -I /usr/local/standards/asn1 Person.asn      
+

The useful options for the ASN.1 compiler are:

+ + -b[ber | per | uper] + +

Choice of encoding rules, if omitted ber is the + default.

+
+ -o OutDirectory + +

Where to put the generated files, default is the current + directory.

+
+ -I IncludeDir + +

Where to search for .asn1db files and ASN.1 + source specs in order to resolve references to other + modules. This option can be repeated many times if there + are several places to search in. The compiler will always + search the current directory first.

+
+ +der + +

DER encoding rule. Only when using -ber option.

+
+ +asn1config + +

This functionality works together with the + ber option. It enables the + specialized decodes, see the Specialized Decode chapter. +

+
+ +undec_rest + +

A buffer that holds a message being decoded may also have + trailing bytes. If those trailing bytes are important they + can be returned along with the decoded value by compiling + the ASN.1 specification with the +undec_rest option. + The return value from the decoder will be + {ok,Value,Rest} where Rest is a binary + containing the trailing bytes.

+
+ +'Any Erlc Option' + +

You may add any option to the Erlang compiler when + compiling the generated Erlang files. Any option + unrecognized by the ASN.1 compiler will be passed to the + Erlang compiler.

+
+
+

For a complete description of erlc see Erts Reference Manual.

+

The compiler and other compile-time functions can also be invoked from + the Erlang shell. Below follows a brief + description of the primary functions, for a + complete description of each function see + the Asn1 Reference Manual, the + asn1ct module.

+

The compiler is invoked by using asn1ct:compile/1 with + default options, or asn1ct:compile/2 if explicit options + are given. + Example:

+
+asn1ct:compile("H323-MESSAGES.asn1").      
+

which equals:

+
+asn1ct:compile("H323-MESSAGES.asn1",[ber]).      
+

If one wants PER encoding:

+
+asn1ct:compile("H323-MESSAGES.asn1",[per]).      
+

The generic encode and decode functions can be invoked like this:

+
+'H323-MESSAGES':encode('SomeChoiceType',{call,"octetstring"}).
+'H323-MESSAGES':decode('SomeChoiceType',Bytes).      
+
+ +
+ Run-time Functions +

When an ASN.1 specification is compiled with the ber + option, the module asn1rt_nif module and the NIF library in + asn1/priv_dir will be needed at run-time.

+

By invoking the function info/0 in a generated module, one + gets information about which compiler options were used.

+
+ +
+ Errors +

Errors detected at + compile time appear on the screen together with + a line number indicating where in the source file the error + was detected. If no errors are found, an Erlang ASN.1 module will + be created.

+

The run-time encoders and decoders execute within a catch and + returns {ok, Data} or + {error, {asn1, Description}} where + Description is + an Erlang term describing the error.

+
+
+ +
+ + Multi-file Compilation +

There are various reasons for using multi-file compilation:

+ + You want to choose the name for the generated module, + perhaps because you need to compile the same specs for + different encoding rules. + You want only one resulting module. + +

You need to specify which ASN.1 specs you will + compile in a module that must have the extension + .set.asn. You chose name of the module and provide the + names of the ASN.1 specs. For instance, if you have the specs + File1.asn, File2.asn and File3.asn your + module MyModule.set.asn will look like:

+
+File1.asn
+File2.asn
+File3.asn    
+

If you compile with:

+ +~> erlc MyModule.set.asn +

the result will be one merged module MyModule.erl with + the generated code from the three ASN.1 specs. +

+
+ +
+ A quick note about tags + +

Tags used to be important for all users of ASN.1, because it + was necessary to manually add tags to certain constructs in order + for the ASN.1 specification to be valid. Here is an example of + an old-style specification:

+ +
+Tags DEFINITIONS ::=
+BEGIN
+  Afters ::= CHOICE { cheese [0] IA5String,
+                      dessert [1] IA5String }
+END 
+ +

Without the tags (the numbers in square brackets) the ASN.1 + compiler would refuse to compile the file.

+ +

In 1994 the global tagging mode AUTOMATIC TAGS was introduced. + By putting AUTOMATIC TAGS in the module header, the ASN.1 compiler + will automatically add tags when needed. Here is the same + specification in AUTOMATIC TAGS mode:

+ +
+Tags DEFINITIONS AUTOMATIC TAGS ::=
+BEGIN
+  Afters ::= CHOICE { cheese IA5String,
+                      dessert IA5String }
+END
+
+ +

Tags will not be mentioned any more in this manual.

+
+ +
+ + The ASN.1 Types +

This section describes the ASN.1 types including their + functionality, purpose and how values are assigned in Erlang. +

+

ASN.1 has both primitive and constructed types:

+

+ + + Primitive types + Constructed types + + + BOOLEAN + SEQUENCE + + + INTEGER + SET + + + REAL + CHOICE + + + NULL + SET OF and SEQUENCE OF + + + ENUMERATED + ANY + + + BIT STRING + ANY DEFINED BY + + + OCTET STRING + EXTERNAL + + + Character Strings + EMBEDDED PDV + + + OBJECT IDENTIFIER + CHARACTER STRING + + + Object Descriptor + + + + The TIME types + + + The supported ASN.1 types +
+ + +

Values of each ASN.1 type has its own representation in Erlang + described in the following subsections. Users shall provide + these values for encoding according to the representation, as + in the example below.

+
+
+Operational ::= BOOLEAN --ASN.1 definition    
+

In Erlang code it may look like:

+
+Val = true,
+{ok,Bytes} = MyModule:encode('Operational', Val),    
+

Below follows a description of how + values of each type can be represented in Erlang. +

+ +
+ + BOOLEAN +

Booleans in ASN.1 express values that can be either + TRUE or FALSE. + The meanings assigned to TRUE or FALSE is beyond the scope + of this text.

+ + In ASN.1 it is possible to have:

+
+Operational ::= BOOLEAN
+      
+

Assigning a value to the type Operational in Erlang is possible by + using the following Erlang code:

+ +Myvar1 = true, + +

Thus, in Erlang the atoms true and false are used + to encode a boolean value.

+
+ +
+ + INTEGER +

ASN.1 itself specifies indefinitely large integers, and the Erlang + systems with versions 4.3 and higher, support very large + integers, in practice indefinitely large integers.

+

The concept of sub-typing can be applied to integers as well + as to other ASN.1 types. The details of sub-typing are not + explained here, for further info see []. A variety + of syntaxes are allowed when defining a type as an integer:

+
+T1 ::= INTEGER
+T2 ::= INTEGER (-2..7)
+T3 ::= INTEGER (0..MAX)
+T4 ::= INTEGER (0<..MAX)
+T5 ::= INTEGER (MIN<..-99)
+T6 ::= INTEGER {red(0),blue(1),white(2)}
+      
+

The Erlang representation of an ASN.1 INTEGER is an integer or + an atom if a so called Named Number List (see T6 above) + is specified.

+

Below is an example of Erlang code which assigns values for the + above types:

+
+T1value = 0,
+T2value = 6,
+T6value1 = blue,
+T6value2 = 0,
+T6value3 = white
+      
+

The Erlang variables above are now bound to valid instances of + ASN.1 defined types. This style of value can be passed directly + to the encoder for transformation into a series of bytes.

+

The decoder will return an atom if the value corresponds to a + symbol in the Named Number List.

+
+ +
+ + REAL +

The following ASN.1 type is used for real numbers:

+
+R1 ::= REAL
+      
+

It can be assigned a value in Erlang as:

+
+R1value1 = "2.14",
+R1value2 = {256,10,-2},
+      
+

In the last line note that the tuple {256,10,-2} is the real number + 2.56 in a special notation, which will encode faster than simply + stating the number as "2.56". The arity three tuple is + {Mantissa,Base,Exponent} i.e. Mantissa * Base^Exponent.

+
+ +
+ + NULL +

Null is suitable in cases where supply and recognition of a value + is important but the actual value is not.

+
+Notype ::= NULL
+      
+

The NULL type can be assigned in Erlang:

+
+N1 = 'NULL',
+      
+

The actual value is the quoted atom 'NULL'.

+
+ +
+ + ENUMERATED +

The enumerated type can be used, when the value we wish to + describe, may only take one of a set of predefined values.

+
+DaysOfTheWeek ::= ENUMERATED { 
+    sunday(1),monday(2),tuesday(3),
+    wednesday(4),thursday(5),friday(6),saturday(7) }
+      
+

For example to assign a weekday value in Erlang use the same atom + as in the Enumerations of the type definition:

+
+Day1 = saturday,
+      
+

The enumerated type is very similar to an integer type, when + defined with a set of predefined values. An enumerated type + differs from an integer in that it may only have specified + values, whereas an integer can also have any other value.

+
+ +
+ + BIT STRING +

The BIT STRING type can be used to model information which + is made up of arbitrary length series of bits. It is intended + to be used for a selection of flags, not for binary files.

+ + In ASN.1 BIT STRING definitions may look like: +

+
+Bits1 ::= BIT STRING
+Bits2 ::= BIT STRING {foo(0),bar(1),gnu(2),gnome(3),punk(14)}
+      
+

There are two notations available for representation of + BIT STRING values in Erlang and as input to the encode functions.

+ + A bitstring. By default, a BIT STRING with no + symbolic names will be decoded to an Erlang bitstring. + A list of atoms corresponding to atoms in the NamedBitList + in the BIT STRING definition. A BIT STRING with symbolic + names will always be decoded to this format. + +

Example:

+
+Bits1Val1 = <<0:1,1:1,0:1,1:1,1:1>>,
+Bits2Val1 = [gnu,punk],
+Bits2Val2 = <<2#1110:4>>,
+Bits2Val3 = [bar,gnu,gnome],
+      
+

Bits2Val2 and Bits2Val3 above denote the same value.

+

Bits2Val1 is assigned symbolic values. The assignment means + that the bits corresponding to gnu and punk i.e. bits + 2 and 14 are set to 1 and the rest set to 0. The symbolic values + appear as a list of values. If a named value appears, which is not + specified in the type definition, a run-time error will occur.

+

BIT STRINGS may also be sub-typed with, for example, a SIZE + specification:

+
+Bits3 ::= BIT STRING (SIZE(0..31))      
+

This means that no bit higher than 31 can ever be set.

+ +
+ Deprecated representations for BIT STRING +

In addition to the representations described above, the + following deprecated representations are available if the + specification has been compiled with the + legacy_erlang_types option:

+ + A list of binary digits (0 or 1). This format is + accepted as input to the encode functions, and a BIT STRING + will be decoded to this format if the + legacy_bit_string option has been given. + + As {Unused,Binary} where Unused denotes + how many trailing zero-bits 0 to 7 that are unused in the + least significant byte in Binary. This format is + accepted as input to the encode functions, and a BIT + STRING will be decoded to this format if + compact_bit_string has been given. + + A hexadecimal number (or an integer). This format + should be avoided, since it is easy to misinterpret a BIT + STRING value in this format. + + +
+
+ +
+ + OCTET STRING +

The OCTET STRING is the simplest of all ASN.1 types. The + OCTET STRING only moves or transfers e.g. binary files or other + unstructured information complying to two rules. Firstly, the + bytes consist of octets and secondly, encoding is not + required.

+

It is possible to have the following ASN.1 type definitions:

+
+O1 ::= OCTET STRING
+O2 ::= OCTET STRING (SIZE(28))      
+

With the following example assignments in Erlang:

+
+O1Val = <<17,13,19,20,0,0,255,254>>,
+O2Val = <<"must be exactly 28 chars....">>,
+

By default, an OCTET STRING is always represented as + an Erlang binary. If the specification has been compiled with + the legacy_erlang_types option, the encode functions + will accept both lists and binaries, and the decode functions + will decode an OCTET STRING to a list.

+
+ +
+ + Character Strings +

ASN.1 supports a wide variety of character sets. The main difference + between OCTET STRINGS and the Character strings is that OCTET + STRINGS have no imposed semantics on the bytes delivered.

+

However, when using for instance the IA5String (which closely + resembles ASCII) the byte 65 (in decimal + notation) means the character 'A'. +

+

For example, if a defined type is to be a VideotexString and + an octet is received with the unsigned integer value X, then + the octet should be interpreted as specified in the standard + ITU-T T.100,T.101. +

+

The ASN.1 to Erlang compiler + will not determine the correct interpretation of each BER + (Basic Encoding Rules) string octet value with different + Character strings. Interpretation of octets is the + responsibility of the application. Therefore, from the BER + string point of view, octets appear to be very similar to + character strings and are compiled in the same way. +

+

It should be noted that when PER (Packed Encoding Rules) is + used, there is a significant difference in the encoding scheme + between OCTET STRINGS and other strings. The constraints + specified for a type are especially important for PER, where + they affect the encoding. +

+

Here are some examples:

+
+Digs ::= NumericString (SIZE(1..3))
+TextFile ::= IA5String (SIZE(0..64000))      
+

with corresponding Erlang assignments:

+
+DigsVal1 = "456",
+DigsVal2 = "123",
+TextFileVal1 = "abc...xyz...",
+TextFileVal2 = [88,76,55,44,99,121 .......... a lot of characters here ....]        
+

The Erlang representation for "BMPString" and + "UniversalString" is either a list of ASCII values or a list + of quadruples. The quadruple representation associates to the + Unicode standard representation of characters. The ASCII + characters are all represented by quadruples beginning with + three zeros like {0,0,0,65} for the 'A' character. When + decoding a value for these strings the result is a list of + quadruples, or integers when the value is an ASCII character.

+ +

The following example shows how it works. We have the following + specification in the file PrimStrings.asn1.

+
+PrimStrings DEFINITIONS AUTOMATIC TAGS ::=
+BEGIN
+   BMP ::= BMPString
+END
+       
+ +

Encoding and decoding some strings:

+ +
+1> asn1ct:compile('PrimStrings', [ber]).
+ok
+2> {ok,Bytes1} = 'PrimStrings':encode('BMP', [{0,0,53,53},{0,0,45,56}]).
+{ok,<<30,4,53,54,45,56>>}
+3> 'PrimStrings':decode('BMP', Bytes1).
+{ok,[{0,0,53,53},{0,0,45,56}]}
+4> {ok,Bytes2} = 'PrimStrings':encode('BMP', [{0,0,53,53},{0,0,0,65}]).
+{ok,<<30,4,53,53,0,65>>}
+5> 'PrimStrings':decode('BMP', Bytes2).
+{ok,[{0,0,53,53},65]}
+6> {ok,Bytes3} = 'PrimStrings':encode('BMP', "BMP string").
+{ok,<<30,20,0,66,0,77,0,80,0,32,0,115,0,116,0,114,0,105,0,110,0,103>>}
+7> 'PrimStrings':decode('BMP', Bytes3).
+{ok,"BMP string"}      
+ +

The UTF8String type is represented as a UTF-8 encoded binary in + Erlang. Such binaries can be created directly using the binary syntax + or by converting from a list of Unicode code points using the + unicode:characters_to_binary/1 function.

+ +

Here are some examples showing how UTF-8 encoded binaries can + be created and manipulated:

+ +
+1> Gs = "Мой маленький Гном".
+[1052,1086,1081,32,1084,1072,1083,1077,1085,1100,1082,1080,
+ 1081,32,1043,1085,1086,1084]
+2> Gbin = unicode:characters_to_binary(Gs).
+<<208,156,208,190,208,185,32,208,188,208,176,208,187,208,
+  181,208,189,209,140,208,186,208,184,208,185,32,208,147,
+  208,...>>
+3> Gbin = <<"Мой маленький Гном"/utf8>>.
+<<208,156,208,190,208,185,32,208,188,208,176,208,187,208,
+  181,208,189,209,140,208,186,208,184,208,185,32,208,147,
+  208,...>>
+4> Gs = unicode:characters_to_list(Gbin).
+[1052,1086,1081,32,1084,1072,1083,1077,1085,1100,1082,1080,
+ 1081,32,1043,1085,1086,1084]
+      
+ +

See the unicode module + for more details.

+ +

In the following example we will use this ASN.1 specification:

+
+UTF DEFINITIONS AUTOMATIC TAGS ::=
+BEGIN
+   UTF ::= UTF8String
+END
+      
+ +

Encoding and decoding a string with Unicode characters:

+ +
+5> asn1ct:compile('UTF', [ber]).
+ok
+6> {ok,Bytes1} = 'UTF':encode('UTF', <<"Гном"/utf8>>).
+{ok,<<12,8,208,147,208,189,208,190,208,188>>}
+7> {ok,Bin1} = 'UTF':decode('UTF', Bytes1).
+{ok,<<208,147,208,189,208,190,208,188>>}
+8> io:format("~ts\n", [Bin1]).
+Гном
+ok
+9> unicode:characters_to_list(Bin1).
+[1043,1085,1086,1084]
+      
+
+ +
+ + OBJECT IDENTIFIER +

The OBJECT IDENTIFIER is used whenever a unique identity is required. + An ASN.1 module, a transfer syntax, etc. is identified with an + OBJECT IDENTIFIER. Assume the example below:

+
+Oid ::= OBJECT IDENTIFIER
+      
+

Therefore, the example below is a valid Erlang instance of the + type 'Oid'.

+
+OidVal1 = {1,2,55},
+      
+

The OBJECT IDENTIFIER value is simply a tuple with the + consecutive values which must be integers. +

+

The first value is limited to the values 0, 1 or 2 and the + second value must be in the range 0..39 when the first value + is 0 or 1. +

+

The OBJECT IDENTIFIER is a very important type and it is + widely used within different standards to uniquely identify + various objects. In [], there is an + easy-to-understand description of the usage of + OBJECT IDENTIFIER.

+

+
+ +
+ + Object Descriptor +

Values of this type can be assigned a value as an ordinary string + like this:

+ +
+      "This is the value of an Object descriptor"
+
+ +
+ + The TIME Types +

Two different time types are defined within ASN.1, Generalized + Time and UTC (Universal Time Coordinated), both are assigned a + value as an ordinary string within double quotes i.e. + "19820102070533.8".

+

In case of DER encoding the compiler does not check the validity + of the time values. The DER requirements upon those strings is + regarded as a matter for the application to fulfill.

+
+ +
+ + SEQUENCE +

The structured types of ASN.1 are constructed from other types + in a manner similar to the concepts of array and struct in C. +

+ A SEQUENCE in ASN.1 is + comparable with a struct in C and a record in Erlang. + A SEQUENCE may be defined as:

+
+Pdu ::= SEQUENCE {
+   a INTEGER,
+   b REAL,
+   c OBJECT IDENTIFIER,
+   d NULL }      
+

This is a 4-component structure called 'Pdu'. The major format + for representation of SEQUENCE in Erlang is the record format. + For each SEQUENCE and SET in an ASN.1 module an Erlang + record declaration is generated. For Pdu above, a record + like this is defined:

+
+-record('Pdu',{a, b, c, d}).      
+

The record declarations for a module M are placed in a + separate M.hrl file.

+

Values can be assigned in Erlang as shown below:

+
+MyPdu = #'Pdu'{a=22,b=77.99,c={0,1,2,3,4},d='NULL'}.      
+

The decode functions will return a record as result when decoding + a SEQUENCE or a SET.

+ +

A SEQUENCE and a SET may contain a component + with a DEFAULT key word followed by the actual value that + is the default value. The DEFAULT keyword means that the + application doing the encoding can omit encoding of the value, + thus resulting in fewer bytes to send to the receiving + application.

+ +

An application can use the atom asn1_DEFAULT to indicate + that the encoding should be omitted for that position in + the SEQUENCE.

+ +

Depending on the encoding rules, the encoder may also compare + the given value to the default value and automatically omit the + encoding if they are equal. How much effort the encoder makes to + to compare the values depends on the encoding rules. The DER + encoding rules forbids encoding a value equal to the default value, + so it has a more thorough and time-consuming comparison than the + encoders for the other encoding rules.

+ +

In the following example we will use this ASN.1 specification:

+
+File DEFINITIONS AUTOMATIC TAGS ::=
+BEGIN
+Seq1 ::= SEQUENCE {
+    a INTEGER DEFAULT 1,
+    b Seq2 DEFAULT {aa TRUE, bb 15}
+}
+
+Seq2 ::= SEQUENCE {
+    aa BOOLEAN,
+    bb INTEGER
+}
+
+Seq3 ::= SEQUENCE {
+    bs BIT STRING {a(0), b(1), c(2)} DEFAULT {a, c}
+}
+END 
+

Here is an example where the BER encoder is able to omit encoding + of the default values:

+
+1> asn1ct:compile('File', [ber]).
+ok
+2> 'File':encode('Seq1', {'Seq1',asn1_DEFAULT,asn1_DEFAULT}).
+{ok,<<48,0>>}
+3> 'File':encode('Seq1', {'Seq1',1,{'Seq2',true,15}}).
+{ok,<<48,0>>}   
+ +

And here is an example with a named BIT STRING where the BER + encoder will not omit the encoding:

+
+4> 'File':encode('Seq3', {'Seq3',asn1_DEFAULT).
+{ok,<<48,0>>}
+5> 'File':encode('Seq3', {'Seq3',<<16#101:3>>).
+{ok,<<48,4,128,2,5,160>>}     
+ +

The DER encoder will omit the encoding for the same BIT STRING:

+
+6> asn1ct:compile('File', [ber,der]).
+ok
+7> 'File':encode('Seq3', {'Seq3',asn1_DEFAULT).
+{ok,<<48,0>>}
+8> 'File':encode('Seq3', {'Seq3',<<16#101:3>>).
+{ok,<<48,0>>}     
+
+ +
+ + SET +

In Erlang, the SET type is used exactly as SEQUENCE. Note + that if the BER or DER encoding rules are used, decoding a + SET is slower than decoding a SEQUENCE because the components + must be sorted.

+
+ +
+ Notes about extensibility for SEQUENCE and SET +

When a SEQUENCE or SET contains an extension marker and + extension components like this:

+
+SExt ::= SEQUENCE {
+           a INTEGER,
+           ...,
+           b BOOLEAN }
+      
+

It means that the type may get more components in newer + versions of the ASN.1 spec. In this case it has got a new + component b. Thus, incoming messages that will be decoded + may have more or fever components than this one. +

+

The component b will be treated as + an original component when encoding a message. In this case, as + it is not an optional element, it must be encoded. +

+

During decoding the b field of the record will get the decoded + value of the b + component if present and otherwise the value asn1_NOVALUE.

+
+ +
+ + CHOICE +

The CHOICE type is a space saver and is similar to the concept of a + 'union' in the C language.

+

Assume:

+
+SomeModuleName DEFINITIONS AUTOMATIC TAGS ::=
+BEGIN
+T ::= CHOICE {
+        x REAL,
+        y INTEGER,
+        z OBJECT IDENTIFIER }
+END 
+

It is then possible to assign values:

+
+TVal1 = {y,17},
+TVal2 = {z,{0,1,2}},
+      
+

A CHOICE value is always represented as the tuple + {ChoiceAlternative, Val} where ChoiceAlternative + is an atom denoting the selected choice alternative. +

+ +
+ Extensible CHOICE +

When a CHOICE contains an extension marker and the decoder detects + an unknown alternative of the CHOICE the value is represented as:

+
+{asn1_ExtAlt, BytesForOpenType}
+        
+

Where BytesForOpenType is a list of bytes constituting the + encoding of the "unknown" CHOICE alternative.

+
+
+ +
+ + SET OF and SEQUENCE OF +

The SET OF and SEQUENCE OF types correspond to the concept of an array + found in several programming languages. The Erlang syntax for + both of these types is straight forward. For example:

+
+Arr1 ::= SET SIZE (5) OF INTEGER (4..9) 
+Arr2 ::= SEQUENCE OF OCTET STRING      
+

We may have the following in Erlang:

+
+Arr1Val = [4,5,6,7,8],
+Arr2Val = ["abc",[14,34,54],"Octets"],      
+

Please note that the definition of the SET OF type implies that + the order of the components is undefined, but in practice there is + no difference between SET OF and SEQUENCE OF. The ASN.1 compiler + for Erlang does not randomize the order of the SET OF components + before encoding.

+

However, in case of a value of the type SET OF, the DER + encoding format requires the elements to be sent in ascending + order of their encoding, which implies an expensive sorting + procedure in run-time. Therefore it is strongly recommended to + use SEQUENCE OF instead of SET OF if it is possible.

+
+ +
+ + ANY and ANY DEFINED BY +

The types ANY and ANY DEFINED BY have been removed + from the standard since 1994. It is recommended not to use + these types any more. They may, however, exist in some old ASN.1 + modules. + The idea with this type was to leave a "hole" in a definition where + one could put unspecified data of any kind, even non ASN.1 data.

+

A value of this type is encoded as an open type.

+

Instead of ANY/ANY DEFINED BY one should use + information object class, table constraints and + parameterization. In particular the construct + TYPE-IDENTIFIER.@Type accomplish the same as the + deprecated ANY.

+

See also Information object

+
+ +
+ + EXTERNAL, EMBEDDED PDV and CHARACTER STRING +

These types are used in presentation layer negotiation. They are + encoded according to their associated type, see [].

+

The EXTERNAL type had a slightly different associated type + before 1994. [] states that encoding shall follow + the older associate type. Therefore does generated encode/decode + functions convert values of the newer format to the older format + before encoding. This implies that it is allowed to use + EXTERNAL type values of either format for encoding. Decoded + values are always returned on the newer format.

+
+ +
+ Embedded Named Types +

The structured types previously described may very well have other named types + as their components. The general syntax to assign a value to the component C + of a named ASN.1 type T in Erlang is the record syntax + #'T'{'C'=Value}. + Where Value may be a value of yet another type T2.

+

For example:

+
+EmbeddedExample DEFINITIONS AUTOMATIC TAGS ::=
+BEGIN
+B ::= SEQUENCE {
+        a Arr1,
+        b T }
+
+Arr1 ::= SET SIZE (5) OF INTEGER (4..9) 
+
+T ::= CHOICE {
+        x REAL,
+        y INTEGER,
+        z OBJECT IDENTIFIER }
+        END      
+

The SEQUENCE b can be encoded like this in Erlang:

+
+1> 'EmbeddedExample':encode('B', {'B',[4,5,6,7,8],{x,"7.77"}}).
+{ok,<<5,56,0,8,3,55,55,55,46,69,45,50>>} 
+
+
+ +
+ Naming of Records in .hrl Files +

When an ASN.1 specification is compiled all defined types of + type SET or SEQUENCE will result in a corresponding record in the + generated hrl file. This is because the values for SET/SEQUENCE + as mentioned in sections above are represented as records.

+

Though there are some special cases of this functionality that + are presented below.

+ +
+ Embedded Structured Types +

It is also possible in ASN.1 to have components that are themselves + structured types. + For example, it is possible to have:

+
+Emb ::= SEQUENCE {
+    a SEQUENCE OF OCTET STRING,
+    b SET {
+       a INTEGER,
+       b INTEGER DEFAULT 66},
+    c CHOICE {
+       a INTEGER,
+       b FooType } }
+
+FooType ::= [3] VisibleString      
+

The following records are generated because of the type Emb:

+
+-record('Emb,{a, b, c}).
+-record('Emb_b',{a, b = asn1_DEFAULT}). % the embedded SET type
+      
+

Values of the Emb type can be assigned like this:

+ +V = #'Emb'{a=["qqqq",[1,2,255]], + b = #'Emb_b'{a=99}, + c ={b,"Can you see this"}}. + +

For an embedded type of type SEQUENCE/SET in a SEQUENCE/SET + the record name is extended with an underscore and the component + name. If the embedded structure is deeper with SEQUENCE, SET or + CHOICE types in the line, each component-/alternative-name will + be added to the record-name.

+

For example:

+
+Seq ::= SEQUENCE{
+    a CHOICE{
+        b SEQUENCE {
+           c  INTEGER
+        }
+    }
+}      
+

will result in the following record:

+
+-record('Seq_a_b',{c}).      
+

If the structured type has a component with an embedded + SEQUENCE OF/SET OF which embedded type in turn is a + SEQUENCE/SET it will give a record with the SEQOF/SETOF + addition as in the following example:

+
+Seq ::= SEQUENCE {
+    a SEQUENCE OF SEQUENCE {
+           b
+               }
+    c SET OF SEQUENCE {
+           d
+               }
+}      
+

This results in the records:

+
+-record('Seq_a_SEQOF'{b}).
+-record('Seq_c_SETOF'{d}).      
+

A parameterized type should be considered as an embedded + type. Each time a such type is referenced an instance of it is + defined. Thus in the following example a record with name + 'Seq_b' is generated in the .hrl file and used to hold + values.

+
+Seq ::= SEQUENCE {
+    b PType{INTEGER}
+}
+
+PType{T} ::= SEQUENCE{
+    id T
+}      
+
+ +
+ Recursive Types +

Types may refer to themselves. Suppose:

+
+Rec ::= CHOICE {
+     nothing NULL,
+     something SEQUENCE {
+          a INTEGER,
+          b OCTET STRING,
+          c Rec }}      
+

This type is recursive; that is, it refers to itself. This is allowed + in ASN.1 and the ASN.1-to-Erlang compiler supports this recursive + type. A value for this type is assigned in Erlang as shown below:

+
+V = {something,#'Rec_something'{a = 77, 
+                                b = "some octets here", 
+                                c = {nothing,'NULL'}}}.      
+
+
+ +
+ ASN.1 Values +

Values can be assigned to ASN.1 type within the ASN.1 code + itself, as opposed to the actions taken in the previous chapter where + a value was assigned to an ASN.1 type in Erlang. The full value + syntax of ASN.1 is supported and [X.680] describes in detail how + to assign values in ASN.1. Below is a short example:

+
+TT ::= SEQUENCE {
+   a INTEGER,
+   b SET OF OCTET STRING }
+
+tt TT ::= {a 77,b {"kalle","kula"}}    
+

The value defined here could be used in several ways. + Firstly, it could be used as the value in some DEFAULT component:

+
+SS ::= SET {
+    s OBJECT IDENTIFIER,
+    val TT DEFAULT tt }    
+

It could also be used from inside an Erlang program. If the above ASN.1 + code was defined in ASN.1 module Values, then the ASN.1 value + tt can be reached from Erlang as + a function call to 'Values':tt() as in the example below.

+
+1> Val = 'Values':tt().
+{'TT',77,["kalle","kula"]}
+2> {ok,Bytes} = 'Values':encode('TT',Val).
+{ok,<<48,18,128,1,77,161,13,4,5,107,97,108,108,101,4,4,
+      107,117,108,97>>}
+4> 'Values':decode('TT',Bytes).
+{ok,{'TT',77,["kalle","kula"]}}
+5>
+    
+

The above example shows that a function is generated by the compiler + that returns a valid Erlang representation of the value, even though + the value is of a complex type.

+

Furthermore, there is a macro generated for each value in the .hrl + file. So, the defined value tt can also be extracted by + ?tt in application code.

+
+ +
+ Macros +

MACRO is not supported as the the type is no longer part of the + ASN.1 standard.

+
+ +
+ + ASN.1 Information Objects (X.681) +

Information Object Classes, Information Objects and Information + Object Sets (in the following called classes, objects and + object sets respectively) are defined in the standard + definition []. In the following only a brief + explanation is given.

+

These constructs makes it possible to define open types, + i.e. values of that type can be of any ASN.1 type. It is also + possible to define relationships between different types and + values, since classes can hold types, values, objects, object + sets and other classes in its fields. + An Information Object Class may be defined in ASN.1 as:

+
+GENERAL-PROCEDURE ::= CLASS {
+      &Message,
+      &Reply               OPTIONAL,
+      &Error               OPTIONAL,
+      &id          PrintableString UNIQUE
+}
+WITH SYNTAX {
+      NEW MESSAGE     &Message
+      [REPLY           &Reply]
+      [ERROR           &Error]
+      ADDRESS          &id
+}    
+

An object is an instance of a class and an object set is a set + containing objects of one specified class. A definition may look like + below.

+

The object object1 is an instance of the CLASS + GENERAL-PROCEDURE and has one type field and one fixed type value + field. The object object2 also has an OPTIONAL field ERROR, + which is a type field.

+
+object1 GENERAL-PROCEDURE ::= {
+    NEW MESSAGE      PrintableString
+    ADDRESS          "home"
+}
+
+object2 GENERAL-PROCEDURE ::= {
+    NEW MESSAGE INTEGER
+    ERROR INTEGER
+    ADDRESS "remote"
+}    
+

The field ADDRESS is a UNIQUE field. Objects in an object set must + have unique values in their UNIQUE field, as in GENERAL-PROCEDURES:

+
+GENERAL-PROCEDURES GENERAL-PROCEDURE ::= {
+    object1 | object2}    
+

One can not encode a class, object or object set, only referring to + it when defining other ASN.1 entities. Typically one refers to a + class and to object sets by table constraints and component + relation constraints [] in ASN.1 types, as in:

+
+StartMessage  ::= SEQUENCE {
+    msgId  GENERAL-PROCEDURE.&id  ({GENERAL-PROCEDURES}),
+    content GENERAL-PROCEDURE.&Message ({GENERAL-PROCEDURES}{@msgId}),
+    }    
+

In the type StartMessage the constraint following the + content field tells that in a value of type + StartMessage the value in the content field must + come from the same object that is chosen by the msgId + field.

+

So, the value #'StartMessage'{msgId="home",content="Any Printable String"} is legal to encode as a StartMessage + value, while the value #'StartMessage'{msgId="remote", content="Some String"} is illegal since the constraint + in StartMessage tells that when you have chosen a value from a + specific object in the object set GENERAL-PROCEDURES in the + msgId field you have to choose a value from that same object in + the content field too. In this second case it should have been + any INTEGER value.

+

StartMessage can in the content field be + encoded with a value of any type that an object in the + GENERAL-PROCEDURES object set has in its NEW MESSAGE field. This field refers to a type field + &Message in the class. The msgId field is always + encoded as a PrintableString, since the field refers to a fixed type + in the class.

+

In practice, object sets are usually declared to be extensible so + so that more objects can be added to the set later. Extensibility is + indicated like this:

+
+GENERAL-PROCEDURES GENERAL-PROCEDURE ::= {
+    object1 | object2, ...}    
+

When decoding a type that uses an extensible set constraint, + there is always the possibility that the value in the UNIQUE + field is unknown (i.e. the type has been encoded with a later + version of the ASN.1 specification). When that happens, the + unencoded data will be returned wrapped in a tuple like this:

+ +
+{asn1_OPENTYPE,Binary}
+

where Binary is an Erlang binary that contains the encoded + data. (If the option legacy_erlang_types has been given, + just the binary will be returned.)

+
+ +
+ Parameterization (X.683) +

Parameterization, which is defined in the standard [], can be used when defining types, values, value + sets, information object classes, information objects or + information object sets. + A part of a definition can be supplied as a parameter. For + instance, if a Type is used in a definition with certain + purpose, one want the type-name to express the intention. This + can be done with parameterization.

+

When many types (or another ASN.1 entity) only differs in some + minor cases, but the structure of the types are similar, only + one general type can be defined and the differences may be supplied + through parameters.

+

One example of use of parameterization is:

+
+General{Type} ::= SEQUENCE
+{
+     number     INTEGER,
+     string     Type
+}
+      
+T1 ::= General{PrintableString}
+
+T2 ::= General{BIT STRING}
+    
+

An example of a value that can be encoded as type T1 is {12,"hello"}.

+

Note that the compiler does not generate encode/decode functions for + parameterized types, but only for the instances of the parameterized + types. Therefore, if a file contains the types General{}, T1 and T2 above, + encode/decode functions will only be generated for T1 and T2. +

+
+
+ diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/book.xml erlang-17.3-dfsg/lib/asn1/doc/src/book.xml --- erlang-18.2-dfsg/lib/asn1/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/Makefile erlang-17.3-dfsg/lib/asn1/doc/src/Makefile --- erlang-18.2-dfsg/lib/asn1/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -49,9 +48,7 @@ notes_history.xml XML_CHAPTER_FILES = \ - asn1_introduction.xml \ - asn1_getting_started.xml \ - asn1_overview.xml \ + asn1_ug.xml \ asn1_spec.xml \ notes.xml diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/notes.xml erlang-17.3-dfsg/lib/asn1/doc/src/notes.xml --- erlang-18.2-dfsg/lib/asn1/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -32,100 +31,6 @@

This document describes the changes made to the asn1 application.

-
Asn1 4.0.1 - -
Fixed Bugs and Malfunctions - - -

- Trying to encode an empty named BIT STRING in BER would - fail with a function_clause exception. (Thanks to - Svilen Ivanov for reporting this bug.)

-

- Own Id: OTP-13149

-
-
-
- -
- -
Asn1 4.0 - -
Fixed Bugs and Malfunctions - - -

- Many bugs have been eliminated in the the ASN.1 compiler - so that it can now successfully compile many more ASN.1 - specifications. Error messages have also been improved.

-

- Own Id: OTP-12395

-
-
-
- - -
Improvements and New Features - - -

The documentation for asn1ct:test/1,2,3 and - asn1ct:value/2 has been updated with information - about the limitations of the functions.

-

- Own Id: OTP-12765 Aux Id: seq12866, seq12867

-
-
-
- -
- -
Asn1 3.0.4 - -
Fixed Bugs and Malfunctions - - -

The ASN.1 compiler would crash if a SEQUENCE ended - with a double set of ellipses (...).

-

- Own Id: OTP-12546 Aux Id: seq12815

-
-
-
- -
- -
Asn1 3.0.3 - -
Fixed Bugs and Malfunctions - - -

- When decoding BER, primitives with an indefinite length - will be immediately rejected. (Thanks to Simon Cornish - for reporting this bug.)

-

- Own Id: OTP-12205

-
- -

- BER: A bug with compliance to X.680 (200811) s31.2.7 has - been fixed. Basically, when TagDefault is AUTOMATIC then - tags are IMPLICIT unless EXPLICIT is given.

-

- Own Id: OTP-12318

-
- -

- Usage of the EXTERNAL 1994 variant type was - broken.

-

- Own Id: OTP-12326

-
-
-
- -
-
Asn1 3.0.2
Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/part.xml erlang-17.3-dfsg/lib/asn1/doc/src/part.xml --- erlang-18.2-dfsg/lib/asn1/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -30,14 +29,11 @@ part.sgml
-

The ASN.1 application - contains modules with compile-time and runtime support for - Abstract Syntax Notation One (ASN.1). +

The Asn1 application + contains modules with compile-time and run-time support for ASN.1.

- - - + diff -Nru erlang-18.2-dfsg/lib/asn1/doc/src/ref_man.xml erlang-17.3-dfsg/lib/asn1/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/asn1/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,21 +8,20 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. - ASN.1 Reference Manual + Asn1 Reference Manual OTP Team 1997-10-04 @@ -30,8 +29,8 @@ application.sgml
-

The ASN.1 application - contains modules with compile-time and runtime support for ASN.1.

+

The Asn1 application + contains modules with compile-time and run-time support for ASN.1.

diff -Nru erlang-18.2-dfsg/lib/asn1/doc/users_guide/Makefile erlang-17.3-dfsg/lib/asn1/doc/users_guide/Makefile --- erlang-18.2-dfsg/lib/asn1/doc/users_guide/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/users_guide/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/asn1/doc/users_guide/users_guide.sgml erlang-17.3-dfsg/lib/asn1/doc/users_guide/users_guide.sgml --- erlang-18.2-dfsg/lib/asn1/doc/users_guide/users_guide.sgml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/asn1/doc/users_guide/users_guide.sgml 2014-09-16 19:10:57.000000000 +0000 @@ -1,16 +1,15 @@ -
diameter 1.11.1 - -
Fixed Bugs and Malfunctions - - -

- Fix request table leaks

-

- The End-to-End and Hop-by-Hop identifiers of outgoing - Diameter requests are stored in a table in order for the - caller to be located when the corresponding answer - message is received. Entries were orphaned if the handler - was terminated by an exit signal as a consequence of - actions taken by callback functions, or if callbacks - modified identifiers in retransmission cases.

-

- Own Id: OTP-13137

-
-
-
- -
- -
diameter 1.11 - -
Fixed Bugs and Malfunctions - - -

- Fix relay encode of nested, Grouped AVPs.

-

- A fault in OTP-12475 caused encode to fail if the first - AVP in a Grouped AVP was itself Grouped.

-

- Own Id: OTP-12879 Aux Id: OTP-12475

-
- -

- Match acceptable peer addresses case insensitively.

-

- Regular expressions passed in an 'accept' tuple to - diameter_tcp or diameter_sctp inappropriately matched - case.

-

- Own Id: OTP-12902

-
- -

- Fix diameter_watchdog function clause.

-

- OTP-12912 introduced an error with accepting transports - setting {restrict_connections, false}, causing - processes to fail when peer connections were terminated.

-

- Own Id: OTP-12969

-
-
-
- - -
Improvements and New Features - - -

- Don't report 5005 (DIAMETER_AVP_MISSING) errors - unnecessarily.

-

- An AVP whose decode failed was reported as missing, - despite having been reported with another error as a - consequence of the failure.

-

- Own Id: OTP-12871

-
- -

- Improve decode performance.

-

- The time required to decode a message increased - quadratically with the number of AVPs in the worst case, - leading to extremely long execution times.

-

- Own Id: OTP-12891

-
- -

- Improve watchdog and statistics performance.

-

- Inefficient use of timers contributed to poor performance - at high load, as did ordering of the table statistics are - written to.

-

- Own Id: OTP-12912

-
- -

- Add service_opt() strict_mbit.

-

- There are differing opinions on whether or not reception - of an arbitrary AVP setting the M-bit is an error. The - default interpretation is strict: if a command grammar - doesn't explicitly allow an AVP setting the M-bit then - reception of such an AVP is regarded as an error. Setting - {strict_mbit, false} disables this check.

-

- Own Id: OTP-12947

-
-
-
- -
- -
diameter 1.10 - -
Fixed Bugs and Malfunctions - - -

- Fix decode of Grouped AVPs containing errors.

-

- RFC 6733 says this of Failed-AVP in 7.5:

-

-

In the case where the offending AVP - is embedded within a Grouped AVP, the Failed-AVP MAY - contain the grouped AVP, which in turn contains the - single offending AVP. The same method MAY be employed if - the grouped AVP itself is embedded in yet another grouped - AVP and so on. In this case, the Failed-AVP MAY contain - the grouped AVP hierarchy up to the single offending AVP. - This enables the recipient to detect the location of the - offending AVP when embedded in a - group.

-

- It says this of DIAMETER_INVALID_AVP_LENGTH in 7.1.5:

-

-

The request contained an AVP with - an invalid length. A Diameter message indicating this - error MUST include the offending AVPs within a Failed-AVP - AVP. In cases where the erroneous AVP length value - exceeds the message length or is less than the minimum - AVP header length, it is sufficient to include the - offending AVP header and a zero filled payload of the - minimum required length for the payloads data type. If - the AVP is a Grouped AVP, the Grouped AVP header with an - empty payload would be sufficient to indicate the - offending AVP. In the case where the offending AVP header - cannot be fully decoded when the AVP length is less than - the minimum AVP header length, it is sufficient to - include an offending AVP header that is formulated by - padding the incomplete AVP header with zero up to the - minimum AVP header length.

-

- The AVPs placed in the errors field of a diameter_packet - record are intended to be appropriate for inclusion in a - Failed-AVP, but neither of the above paragraphs has been - followed in the Grouped case: the entire faulty AVP - (non-faulty components and all) has been included. This - made it difficult to identify the actual faulty AVP in - all but simple cases.

-

- The decode is now adapted to the RFC, and implements the - suggested single faulty AVP, nested in as many Grouped - containers as required.

-

- Own Id: OTP-12721

- - -

- Fix SCTP problems on Solaris.

-

- The allocation of association ids in Solaris was in - conflict with an assumption made in diameter_sctp, - resulting in failures when accepting multiple peer - connections.

-

- Own Id: OTP-12768

-
- -

- Fix start order of alternate transports.

-

- A transport configured with diameter:add_transport/2 can - be passed multiple transport_module/transport_config - tuples in order to specify alternate configuration, - modules being attempted in order until one succeeds. This - is primarily for the connecting case; for example, to - allow a transport to be configured to first attempt - connection over SCTP, and then TCP in case SCTP fails. - Multiple module tuples can be paired with a single config - tuple, but in this case the start order was reversed - relative to the order in which the modules were specifed.

-

- Own Id: OTP-12851

-
-
-
- - -
Improvements and New Features - - -

- Change license text from Erlang Public License to Apache - Public License v2.

-

- Own Id: OTP-12845

-
-
-
- -
- -
diameter 1.9.2 - -
Fixed Bugs and Malfunctions - - -

- Fix broken relay counters.

-

- OTP-12654 in OTP 17.5.3 broke counters in the case of - answer messages received in the relay application. - Counters were accumulated as unknown messages or - no_result_code instead of as relayed messages on the - intended Result-Code and 'Experimental-Result' tuples.

-

- Own Id: OTP-12741

-
- -

- Fix diameter_sctp listener race.

-

- An oversight in OTP-12428 made it possible to start a - transport process that could not establish associations.

-

- Own Id: OTP-12744

-
-
-
- -
- -
diameter 1.9.1 - -
Known Bugs and Problems - - -

- Don't leave extra bit in decoded AVP data.

-

- OTP-12074 in OTP 17.3 missed one case: a length error on - a trailing AVP unknown to the dictionary in question.

-

- Own Id: OTP-12642

-
- -

- Don't confuse Result-Code and Experimental-Result.

-

- The errors field of a decoded diameter_packet record was - populated with a Result-Code AVP when an - Experimental-Result containing a 3xxx Result-Code was - received in an answer not setting the E-bit. The correct - AVP is now extracted from the incoming message.

-

- Own Id: OTP-12654

-
- -

- Don't count on unknown Application Id.

-

- OTP-11721 in OTP 17.1 missed the case of an Application - Id not agreeing with that of the dictionary in question, - causing counters to be accumulated on keys containing the - unknown id.

-

- Own Id: OTP-12701

-
-
-
- -
- -
diameter 1.9 - -
Fixed Bugs and Malfunctions - - -

- Don't discard outgoing answers unnecessarily.

-

- Answers missing a Result-Code AVP or setting an E-bit - inappropriately were discarded even if encode was - successful.

-

- Own Id: OTP-11492

-
- -

- Increase supervision timeouts.

-

- At diameter application shutdown, DPR could be omitted on - open peer connections because of short supervision - timeouts.

-

- Own Id: OTP-12412

-
- -

- Fix retransmission of messages sent as header/avps list.

-

- Extracting End-to-End and Hop-by-Hop Identifiers resulted - in a function clause error, resulting in a handle_error - callback.

-

- Own Id: OTP-12415

-
- -

- Fix diameter_avp decode of Grouped AVPs having decode - errors.

-

- Components of such an AVP were not extracted, causing it - to be represented by a single diameter_avp record instead - of the intended list.

-

- Dictionary files must be recompiled for the fix to have - effect.

-

- Own Id: OTP-12475

-
- -

- Fix ordering of AVPs in relayed messages.

-

- The order was reversed relative to the received order, - with a Route-Record AVP prepended.

-

- Thanks to Andrzej Trawiński.

-

- Own Id: OTP-12551

-
- -

- Fix issues with DiameterURI encode/decode.

-

- RFC 6773 changed the default port and transport, but the - RFC 3588 defaults were used even if the RFC 6733 common - dictionary was in use. The RFC 3588 defaults are now only - used when the common dictionary is - diameter_gen_base_rfc3588.

-

- Both RFC 3588 and 6733 disallow - transport=udp;protocol=diameter. Encode of the - combination now fails.

-

- Decode of ports numbers outside the range 0-65535 and - fully qualified domain names longer than 255 octets now - fails.

-

- Note that RFC 3588 is obsolete, and that there is a - diameter_gen_base_rfc6733. The change in defaults is a - potential interoperability problem when moving to RFC - 6733 with peers that do not send all URI components. The - fact that 6733 allows 5xxx result codes in answer - messages setting the E-bit, which RFC 3588 doesn't, is - another.

-

- Own Id: OTP-12589

-
-
-
- - -
Improvements and New Features - - -

- Add service_opt() string_decode.

-

- To disable the decode of potentially large binaries to - string. This prevents large strings from being copied - when incoming Diameter messages are passed between - processes, a vulnerability that can lead to memory being - exhausted given sufficiently malicious peers.

-

- The value is a boolean(), true being the default for - backwards compatibility. Setting false causes both - diameter_caps records and decoded messages to contain - binary() in relevant places that previously had string(): - diameter_app(3) callbacks need to be prepared for the - change.

-

- The Diameter types affected are OctetString and the - derived types UTF8String, DiameterIdentity, DiameterURI, - IPFilterRule, and QoSFilterRule. Time and Address are - unaffected.

-

- Own Id: OTP-11952

-
- -

- Add transport_opt() pool_size.

-

- To allow for pools of accepting transport processes, - which can better service multiple simultaneous peer - connections. The option can also be used with connecting - transports, to establish multiple connections to the same - peer without having to configure multiple transports.

-

- Own Id: OTP-12428

-
- -

- Allow DPR to be sent with diameter:call/4.

-

- It has been possible to send, but the answer was regarded - as unsolicited and discarded. DPA now causes the - transport process in question to be terminated, as for - DPR that diameter itself sends.

-

- Own Id: OTP-12542

-
- -

- Discard requests after DPR.

-

- RFC 6733 is imprecise, but the tone is that messages - received after DPR are an exception to be dealt with only - because of the possibility of unordered delivery over - SCTP. As a consequence, and because a request following - DPR is unlikely to be answered due to the impending loss - of the peer connection, discard outgoing requests - following an outgoing or incoming DPR. Incoming requests - are also discarded, with the exception of DPR itself. - Answers are sent and received as usual.

-

- Own Id: OTP-12543

-
- -

- Add transport_opt() dpr_timeout.

-

- To cause a peer connection to be closed following an - outgoing DPA when the peer fails to do so. It is the - recipient of DPA that should close the connection - according to RFC 6733.

-

- Own Id: OTP-12609

-
- -

- Add service_opt() incoming_maxlen.

-

- To bound the expected size of incoming Diameter messages. - Messages larger than the specified number of bytes are - discarded, to prevent a malicious peer from generating - excessive load.

-

- Own Id: OTP-12628

-
-
-
- -
- -
diameter 1.8 - -
Fixed Bugs and Malfunctions - - -

- Fix remote diameter_request table leak.

-

- An outgoing request whose pick_peer callback selected a - transport on another node resulted in an orphaned table - entry on that node.

-

- Own Id: OTP-12196

-
- -

- Fix handling of 3xxx Result-Code without E-bit.

-

- OTP-12233 broke the population of the errors field of the - diameter_packet record when an incoming request with an - E-bit/Result-Code mismatch was detected, causing a - 4-tuple to be inserted as Result-Code in a diameter_avp - record.

-

- Own Id: OTP-12233

-
- -

- Fix ignored connect timer.

-

- There are two timers governing the establishment of peer - connections: connect_timer and watchdog_timer. The former - is the RFC 6733 Tc timer, and is used at initial - connection establishment. The latter is RFC 3539 TwInit, - and is used for connection reestablishment. A connecting - transport erroneously used watchdog_timer in both cases.

-

- Own Id: OTP-12281 Aux Id: seq12728

-
-
-
- - -
Improvements and New Features - - -

- Order candidate peers in pick_peer callbacks.

-

- The order of candidate peers presented to a - diameter_app(3) pick_peer callback has previously not - been documented, but there are use cases that are - simplified by an ordering. The order is now determined by - the filter.

-

- Own Id: OTP-12308

-
-
-
- -
-
diameter 1.7.1
Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/diameter/doc/src/ref_man.xml erlang-17.3-dfsg/lib/diameter/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/diameter/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -10,17 +10,16 @@ Ericsson AB. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. diff -Nru erlang-18.2-dfsg/lib/diameter/doc/src/seealso.ent erlang-17.3-dfsg/lib/diameter/doc/src/seealso.ent --- erlang-18.2-dfsg/lib/diameter/doc/src/seealso.ent 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/doc/src/seealso.ent 2014-09-16 19:10:57.000000000 +0000 @@ -4,19 +4,18 @@ %CopyrightBegin% -Copyright Ericsson AB 2012-2015. All Rights Reserved. +Copyright Ericsson AB 2012-2014. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. %CopyrightEnd% @@ -65,14 +64,11 @@ capabilities_cb'> capx_timeout'> disconnect_cb'> -dpa_timeout'> transport_config'> transport_module'> connect_timer'> watchdog_timer'> -diameter:service_opt() string_decode'> - handle_answer/4'> @@ -106,9 +102,6 @@ Address()'> DiameterIdentity()'> -DiameterURI()'> -IPFilterRule()'> -QoSFilterRule()'> Grouped()'> OctetString()'> Time()'> diff -Nru erlang-18.2-dfsg/lib/diameter/doc/src/seehere.sed erlang-17.3-dfsg/lib/diameter/doc/src/seehere.sed --- erlang-18.2-dfsg/lib/diameter/doc/src/seehere.sed 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/doc/src/seehere.sed 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/diameter/doc/src/user_man.xml erlang-17.3-dfsg/lib/diameter/doc/src/user_man.xml --- erlang-18.2-dfsg/lib/diameter/doc/src/user_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/doc/src/user_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/client_cb.erl erlang-17.3-dfsg/lib/diameter/examples/code/client_cb.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/client_cb.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/client_cb.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/client.erl erlang-17.3-dfsg/lib/diameter/examples/code/client.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/client.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/client.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -39,10 +38,9 @@ -module(client). -include_lib("diameter/include/diameter.hrl"). --include_lib("diameter/include/diameter_gen_base_rfc6733.hrl"). +-include_lib("diameter/include/diameter_gen_base_rfc3588.hrl"). -export([start/1, %% start a service - start/2, %% connect/2, %% add a connecting transport call/1, %% send using the record encoding cast/1, %% send using the list encoding and detached @@ -52,14 +50,17 @@ %% both the record and list encoding here, one detached and one not, %% is just for demonstration purposes. -%% Convenience functions using the default service name. +%% Convenience functions using the default service name, ?SVC_NAME. -export([start/0, connect/1, stop/0, call/0, cast/0]). --define(DEF_SVC_NAME, ?MODULE). +-define(SVC_NAME, ?MODULE). +-define(APP_ALIAS, ?MODULE). +-define(CALLBACK_MOD, client_cb). + -define(L, atom_to_list). %% The service configuration. As in the server example, a client @@ -69,40 +70,27 @@ {'Origin-Realm', "example.com"}, {'Vendor-Id', 0}, {'Product-Name', "Client"}, - {'Auth-Application-Id', [0]}, - {string_decode, false}, - {application, [{alias, common}, - {dictionary, diameter_gen_base_rfc6733}, - {module, client_cb}]}]). + {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, + {application, [{alias, ?APP_ALIAS}, + {dictionary, ?DIAMETER_DICT_COMMON}, + {module, ?CALLBACK_MOD}]}]). %% start/1 start(Name) when is_atom(Name) -> - start(Name, []); - -start(Opts) - when is_list(Opts) -> - start(?DEF_SVC_NAME, Opts). - -%% start/0 + peer:start(Name, ?SERVICE(Name)). start() -> - start(?DEF_SVC_NAME). - -%% start/2 - -start(Name, Opts) -> - node:start(Name, Opts ++ [T || {K,_} = T <- ?SERVICE(Name), - false == lists:keymember(K, 1, Opts)]). + start(?SVC_NAME). %% connect/2 connect(Name, T) -> - node:connect(Name, T). + peer:connect(Name, T). connect(T) -> - connect(?DEF_SVC_NAME, T). + connect(?SVC_NAME, T). %% call/1 @@ -111,10 +99,10 @@ RAR = #diameter_base_RAR{'Session-Id' = SId, 'Auth-Application-Id' = 0, 'Re-Auth-Request-Type' = 0}, - diameter:call(Name, common, RAR, []). + diameter:call(Name, ?APP_ALIAS, RAR, []). call() -> - call(?DEF_SVC_NAME). + call(?SVC_NAME). %% cast/1 @@ -123,15 +111,15 @@ RAR = ['RAR', {'Session-Id', SId}, {'Auth-Application-Id', 0}, {'Re-Auth-Request-Type', 1}], - diameter:call(Name, common, RAR, [detach]). + diameter:call(Name, ?APP_ALIAS, RAR, [detach]). cast() -> - cast(?DEF_SVC_NAME). + cast(?SVC_NAME). %% stop/1 stop(Name) -> - node:stop(Name). + peer:stop(Name). stop() -> - stop(?DEF_SVC_NAME). + stop(?SVC_NAME). diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/GNUmakefile erlang-17.3-dfsg/lib/diameter/examples/code/GNUmakefile --- erlang-18.2-dfsg/lib/diameter/examples/code/GNUmakefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/GNUmakefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2010-2015. All Rights Reserved. +# Copyright Ericsson AB 2010-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -21,7 +20,7 @@ EXAMPLES = client server relay # redirect proxy CALLBACKS = $(EXAMPLES:%=%_cb) -MODULES = node $(EXAMPLES) $(EXAMPLES:%=%_cb) +MODULES = peer $(EXAMPLES) $(EXAMPLES:%=%_cb) BEAM = $(MODULES:%=%.beam) diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/node.erl erlang-17.3-dfsg/lib/diameter/examples/code/node.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/node.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/node.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,175 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% -%% A library module used by the example Diameter nodes. Does little -%% more than provide an alternate/simplified transport configuration. -%% - --module(node). - --export([start/2, - listen/2, - connect/2, - stop/1]). - --type protocol() - :: tcp | sctp. - --type ip_address() - :: default - | inet:ip_address(). - --type server_transport() - :: protocol() - | {protocol(), ip_address(), non_neg_integer()}. - --type server_opts() - :: server_transport() - | {server_transport(), [diameter:transport_opt()]} - | [diameter:transport_opt()]. - --type client_transport() - :: protocol() | any - | {protocol() | any, ip_address(), non_neg_integer()} - | {protocol() | any, ip_address(), ip_address(), non_neg_integer()}. - --type client_opts() - :: client_transport() - | {client_transport(), [diameter:transport_opt()]} - | [diameter:transport_opt()]. - -%% The server_transport() and client_transport() config is just -%% convenience: arbitrary options can be specifed as a -%% [diameter:transport_opt()]. - --define(DEFAULT_PORT, 3868). - -%% --------------------------------------------------------------------------- -%% Interface functions -%% --------------------------------------------------------------------------- - -%% start/2 - --spec start(diameter:service_name(), [diameter:service_opt()]) - -> ok - | {error, term()}. - -start(Name, Opts) - when is_atom(Name), is_list(Opts) -> - diameter:start_service(Name, Opts). - -%% connect/2 - --spec connect(diameter:service_name(), client_opts()) - -> {ok, diameter:transport_ref()} - | {error, term()}. - -connect(Name, Opts) - when is_list(Opts) -> - diameter:add_transport(Name, {connect, Opts}); - -connect(Name, {T, Opts}) -> - connect(Name, Opts ++ client_opts(T)); - -connect(Name, T) -> - connect(Name, [{connect_timer, 5000} | client_opts(T)]). - -%% listen/2 - --spec listen(diameter:service_name(), server_opts()) - -> {ok, diameter:transport_ref()} - | {error, term()}. - -listen(Name, Opts) - when is_list(Opts) -> - diameter:add_transport(Name, {listen, Opts}); - -listen(Name, {T, Opts}) -> - listen(Name, Opts ++ server_opts(T)); - -listen(Name, T) -> - listen(Name, server_opts(T)). - -%% stop/1 - --spec stop(diameter:service_name()) - -> ok - | {error, term()}. - -stop(Name) -> - diameter:stop_service(Name). - -%% --------------------------------------------------------------------------- -%% Internal functions -%% --------------------------------------------------------------------------- - -%% server_opts/1 -%% -%% Return transport options for a listening transport. - -server_opts({T, Addr, Port}) -> - [{transport_module, tmod(T)}, - {transport_config, [{reuseaddr, true}, - {ip, addr(Addr)}, - {port, Port}]}]; - -server_opts(T) -> - server_opts({T, loopback, ?DEFAULT_PORT}). - -%% client_opts/1 -%% -%% Return transport options for a connecting transport. - -client_opts({T, LA, RA, RP}) - when T == all; %% backwards compatibility - T == any -> - [[S, {C,Os}], T] = [client_opts({P, LA, RA, RP}) || P <- [sctp,tcp]], - [S, {C,Os,2000} | T]; - -client_opts({T, LA, RA, RP}) -> - [{transport_module, tmod(T)}, - {transport_config, [{raddr, addr(RA)}, - {rport, RP}, - {reuseaddr, true} - | ip(LA)]}]; - -client_opts({T, RA, RP}) -> - client_opts({T, default, RA, RP}); - -client_opts(T) -> - client_opts({T, loopback, loopback, ?DEFAULT_PORT}). - -%% --------------------------------------------------------------------------- - -tmod(tcp) -> diameter_tcp; -tmod(sctp) -> diameter_sctp. - -ip(default) -> - []; -ip(loopback) -> - [{ip, {127,0,0,1}}]; -ip(Addr) -> - [{ip, Addr}]. - -addr(loopback) -> - {127,0,0,1}; -addr(A) -> - A. diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/peer.erl erlang-17.3-dfsg/lib/diameter/examples/code/peer.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/peer.erl 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/peer.erl 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,150 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%% +%% A library module that factors out commonality in the example +%% Diameter peers. +%% + +-module(peer). + +-include_lib("diameter/include/diameter.hrl"). +-include_lib("diameter/include/diameter_gen_base_rfc3588.hrl"). + +-export([start/2, + listen/2, + connect/2, + stop/1]). + +-type service_name() + :: term(). + +-type protocol() + :: tcp | sctp. + +-type ip_address() + :: default + | inet:ip_address(). + +-type server_config() + :: protocol() + | {protocol(), ip_address(), non_neg_integer()}. + +-type client_config() + :: protocol() + | {protocol(), ip_address(), non_neg_integer()} + | {protocol(), ip_address(), ip_address(), non_neg_integer()}. + +-define(DEFAULT_PORT, 3868). + +%% --------------------------------------------------------------------------- +%% Interface functions +%% --------------------------------------------------------------------------- + +%% start/2 + +-spec start(service_name(), list()) + -> ok + | {error, term()}. + +start(Name, Opts) + when is_atom(Name), is_list(Opts) -> + diameter:start_service(Name, Opts). + +%% connect/2 + +-spec connect(service_name(), client_config()) + -> {ok, reference()} + | {error, term()}. + +connect(Name, T) -> + diameter:add_transport(Name, {connect, [{reconnect_timer, 5000} + | client(T)]}). + +%% listen/2 + +-spec listen(service_name(), server_config()) + -> {ok, reference()} + | {error, term()}. + +listen(Name, T) -> + diameter:add_transport(Name, {listen, server(T)}). + +%% stop/1 + +-spec stop(service_name()) + -> ok + | {error, term()}. + +stop(Name) -> + diameter:stop_service(Name). + +%% --------------------------------------------------------------------------- +%% Internal functions +%% --------------------------------------------------------------------------- + +%% server/1 +%% +%% Return config for a listening transport. + +server({T, Addr, Port}) -> + [{transport_module, tmod(T)}, + {transport_config, [{reuseaddr, true}, + {ip, addr(Addr)}, + {port, Port}]}]; + +server(T) -> + server({T, loopback, ?DEFAULT_PORT}). + +%% client/1 +%% +%% Return config for a connecting transport. + +client({all, LA, RA, RP}) -> + [[M,{K,C}], T] + = [client({P, LA, RA, RP}) || P <- [sctp,tcp]], + [M, {K,C,2000} | T]; + +client({T, LA, RA, RP}) -> + [{transport_module, tmod(T)}, + {transport_config, [{raddr, addr(RA)}, + {rport, RP}, + {reuseaddr, true} + | ip(LA)]}]; + +client({T, RA, RP}) -> + client({T, default, RA, RP}); + +client(T) -> + client({T, loopback, loopback, ?DEFAULT_PORT}). + +tmod(tcp) -> diameter_tcp; +tmod(sctp) -> diameter_sctp. + +ip(default) -> + []; +ip(loopback) -> + [{ip, {127,0,0,1}}]; +ip(Addr) -> + [{ip, Addr}]. + +addr(loopback) -> + {127,0,0,1}; +addr(A) -> + A. diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/redirect_cb.erl erlang-17.3-dfsg/lib/diameter/examples/code/redirect_cb.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/redirect_cb.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/redirect_cb.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/redirect.erl erlang-17.3-dfsg/lib/diameter/examples/code/redirect.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/redirect.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/redirect.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/relay_cb.erl erlang-17.3-dfsg/lib/diameter/examples/code/relay_cb.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/relay_cb.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/relay_cb.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/relay.erl erlang-17.3-dfsg/lib/diameter/examples/code/relay.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/relay.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/relay.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -32,8 +31,10 @@ -module(relay). +-include_lib("diameter/include/diameter.hrl"). +-include_lib("diameter/include/diameter_gen_base_rfc3588.hrl"). + -export([start/1, - start/2, listen/2, connect/2, stop/1]). @@ -43,56 +44,49 @@ connect/1, stop/0]). --define(DEF_SVC_NAME, ?MODULE). +-define(APP_ALIAS, ?MODULE). +-define(SVC_NAME, ?MODULE). +-define(CALLBACK_MOD, relay_cb). %% The service configuration. -define(SERVICE(Name), [{'Origin-Host', atom_to_list(Name) ++ ".example.com"}, {'Origin-Realm', "example.com"}, {'Vendor-Id', 193}, {'Product-Name', "RelayAgent"}, - {'Auth-Application-Id', [16#FFFFFFFF]}, - {string_decode, false}, - {application, [{alias, relay}, - {dictionary, diameter_relay}, - {module, relay_cb}]}]). + {'Auth-Application-Id', [?DIAMETER_APP_ID_RELAY]}, + {application, [{alias, ?MODULE}, + {dictionary, ?DIAMETER_DICT_RELAY}, + {module, ?CALLBACK_MOD}]}]). %% start/1 start(Name) when is_atom(Name) -> - start(Name, []). - -%% start/1 + peer:start(Name, ?SERVICE(Name)). start() -> - start(?DEF_SVC_NAME). - -%% start/2 - -start(Name, Opts) -> - node:start(Name, Opts ++ [T || {K,_} = T <- ?SERVICE(Name), - false == lists:keymember(K, 1, Opts)]). + start(?SVC_NAME). %% listen/2 listen(Name, T) -> - node:listen(Name, T). + peer:listen(Name, T). listen(T) -> - listen(?DEF_SVC_NAME, T). + listen(?SVC_NAME, T). %% connect/2 connect(Name, T) -> - node:connect(Name, T). + peer:connect(Name, T). connect(T) -> - connect(?DEF_SVC_NAME, T). + connect(?SVC_NAME, T). %% stop/1 stop(Name) -> - node:stop(Name). + peer:stop(Name). stop() -> - stop(?DEF_SVC_NAME). + stop(?SVC_NAME). diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/sctp.erl erlang-17.3-dfsg/lib/diameter/examples/code/sctp.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/sctp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/sctp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/server_cb.erl erlang-17.3-dfsg/lib/diameter/examples/code/server_cb.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/server_cb.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/server_cb.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,7 +24,7 @@ -module(server_cb). -include_lib("diameter/include/diameter.hrl"). --include_lib("diameter/include/diameter_gen_base_rfc6733.hrl"). +-include_lib("diameter/include/diameter_gen_base_rfc3588.hrl"). %% diameter callbacks -export([peer_up/3, diff -Nru erlang-18.2-dfsg/lib/diameter/examples/code/server.erl erlang-17.3-dfsg/lib/diameter/examples/code/server.erl --- erlang-18.2-dfsg/lib/diameter/examples/code/server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/code/server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -35,17 +34,21 @@ -module(server). +-include_lib("diameter/include/diameter.hrl"). +-include_lib("diameter/include/diameter_gen_base_rfc3588.hrl"). + -export([start/1, %% start a service - start/2, %% listen/2, %% add a listening transport stop/1]). %% stop a service -%% Convenience functions using the default service name. +%% Convenience functions using the default service name, ?SVC_NAME. -export([start/0, listen/1, stop/0]). --define(DEF_SVC_NAME, ?MODULE). +-define(SVC_NAME, ?MODULE). +-define(APP_ALIAS, ?MODULE). +-define(CALLBACK_MOD, server_cb). %% The service configuration. In a server supporting multiple Diameter %% applications each application may have its own, although they could all @@ -54,46 +57,32 @@ {'Origin-Realm', "example.com"}, {'Vendor-Id', 193}, {'Product-Name', "Server"}, - {'Auth-Application-Id', [0]}, - {restrict_connections, false}, - {string_decode, false}, - {application, [{alias, common}, - {dictionary, diameter_gen_base_rfc6733}, - {module, server_cb}]}]). + {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, + {application, [{alias, ?APP_ALIAS}, + {dictionary, ?DIAMETER_DICT_COMMON}, + {module, ?CALLBACK_MOD}]}]). %% start/1 start(Name) when is_atom(Name) -> - start(Name, []); - -start(Opts) - when is_list(Opts) -> - start(?DEF_SVC_NAME, Opts). - -%% start/0 + peer:start(Name, ?SERVICE(Name)). start() -> - start(?DEF_SVC_NAME). - -%% start/2 - -start(Name, Opts) -> - node:start(Name, Opts ++ [T || {K,_} = T <- ?SERVICE(Name), - false == lists:keymember(K, 1, Opts)]). + start(?SVC_NAME). %% listen/2 listen(Name, T) -> - node:listen(Name, T). + peer:listen(Name, T). listen(T) -> - listen(?DEF_SVC_NAME, T). + listen(?SVC_NAME, T). %% stop/1 stop(Name) -> - node:stop(Name). + peer:stop(Name). stop() -> - stop(?DEF_SVC_NAME). + stop(?SVC_NAME). diff -Nru erlang-18.2-dfsg/lib/diameter/examples/dict/depend.sed erlang-17.3-dfsg/lib/diameter/examples/dict/depend.sed --- erlang-18.2-dfsg/lib/diameter/examples/dict/depend.sed 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/dict/depend.sed 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/diameter/examples/dict/GNUmakefile erlang-17.3-dfsg/lib/diameter/examples/dict/GNUmakefile --- erlang-18.2-dfsg/lib/diameter/examples/dict/GNUmakefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/dict/GNUmakefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4004_mip.dia erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4004_mip.dia --- erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4004_mip.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4004_mip.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2013. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4005_nas.dia erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4005_nas.dia --- erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4005_nas.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4005_nas.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2013. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4006_cc.dia erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4006_cc.dia --- erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4006_cc.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4006_cc.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2013. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4072_eap.dia erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4072_eap.dia --- erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4072_eap.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4072_eap.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2013. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4590_digest.dia erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4590_digest.dia --- erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4590_digest.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4590_digest.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2013. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4740_sip.dia erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4740_sip.dia --- erlang-18.2-dfsg/lib/diameter/examples/dict/rfc4740_sip.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/examples/dict/rfc4740_sip.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2013. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/include/diameter_gen.hrl erlang-17.3-dfsg/lib/diameter/include/diameter_gen.hrl --- erlang-18.2-dfsg/lib/diameter/include/diameter_gen.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/include/diameter_gen.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -26,15 +25,9 @@ -define(THROW(T), throw({?MODULE, T})). -%% Tag common to generated dictionaries. --define(TAG, diameter_gen). - %% Key to a value in the process dictionary that determines whether or %% not an unrecognized AVP setting the M-bit should be regarded as an -%% error or not. See is_strict/0. This is only used to relax M-bit -%% interpretation inside Grouped AVPs not setting the M-bit. The -%% service_opt() strict_mbit can be used to disable the check -%% globally. +%% error or not. See is_strict/0. -define(STRICT_KEY, strict). %% Key that says whether or not we should do a best-effort decode @@ -55,20 +48,13 @@ %% dictionary. putr(K,V) -> - put({?TAG, K}, V). + put({?MODULE, K}, V). getr(K) -> - case get({?TAG, K}) of - undefined -> - V = erase({?MODULE, K}), %% written in old code - V == undefined orelse putr(K,V), - V; - V -> - V - end. + get({?MODULE, K}). eraser(K) -> - erase({?TAG, K}). + erase({?MODULE, K}). %% --------------------------------------------------------------------------- %% # encode_avps/2 @@ -189,10 +175,9 @@ = lists:foldl(fun(T,A) -> decode(Name, T, A) end, {[], {newrec(Name), []}}, Recs), - {Rec, Avps, Failed ++ missing(Rec, Name, Failed)}. -%% Append 5005 errors so that errors are reported in the order -%% encountered. Failed-AVP should typically contain the first -%% encountered error accordg to the RFC. + {Rec, Avps, Failed ++ missing(Rec, Name)}. +%% Append 5005 errors so that a 5014 for the same AVP will take +%% precedence in a Result-Code/Failed-AVP setting. newrec(Name) -> '#new-'(name2rec(Name)). @@ -205,36 +190,20 @@ %% Failed-AVP AVP SHOULD be included in the message. The Failed-AVP %% AVP MUST contain an example of the missing AVP complete with the %% Vendor-Id if applicable. The value field of the missing AVP -%% should be of correct minimum length and contain zeros. +%% should be of correct minimum length and contain zeroes. -missing(Rec, Name, Failed) -> - Avps = lists:foldl(fun({_, #diameter_avp{code = C, vendor_id = V}}, A) -> - sets:add_element({C,V}, A) - end, - sets:new(), - Failed), - [{5005, A} || F <- '#info-'(element(1, Rec), fields), - not has_arity(avp_arity(Name, F), '#get-'(F, Rec)), - #diameter_avp{code = C, vendor_id = V} - = A <- [empty_avp(F)], - not sets:is_element({C,V}, Avps)]. +missing(Rec, Name) -> + [{5005, empty_avp(F)} || F <- '#info-'(element(1, Rec), fields), + A <- [avp_arity(Name, F)], + false <- [have_arity(A, '#get-'(F, Rec))]]. %% Maximum arities have already been checked in building the record. -has_arity({Min, _}, L) -> - has_prefix(Min, L); -has_arity(N, V) -> +have_arity({Min, _}, L) -> + Min =< length(L); +have_arity(N, V) -> N /= 1 orelse V /= undefined. -%% Compare a non-negative integer and the length of a list without -%% computing the length. -has_prefix(0, _) -> - true; -has_prefix(_, []) -> - false; -has_prefix(N, L) -> - has_prefix(N-1, tl(L)). - %% empty_avp/1 empty_avp(Name) -> @@ -344,20 +313,18 @@ %% decode is packed into 'AVP'. Mod = dict(Failed), %% Dictionary to decode in. - %% On decode, a Grouped AVP is represented as a #diameter_avp{} - %% list with AVP as head and component AVPs as tail. On encode, - %% data can be a list of component AVPs. - try Mod:avp(decode, Data, AvpName) of V -> {Avps, T} = Acc, {H, A} = ungroup(V, Avp), {[H | Avps], pack_avp(Name, A, T)} catch - throw: {?TAG, {grouped, Error, ComponentAvps}} -> - g(is_failed(), Error, Name, trim(Avp), Acc, ComponentAvps); error: Reason -> - d(is_failed(), Reason, Name, trim(Avp), Acc) + d(undefined == Failed orelse is_failed(), + Reason, + Name, + trim(Avp), + Acc) after reset(?STRICT_KEY, Strict), reset(?FAILED_KEY, Failed) @@ -371,10 +338,6 @@ trim(#diameter_avp{data = <<0:1, Bin/binary>>} = Avp) -> Avp#diameter_avp{data = Bin}; -trim(Avps) - when is_list(Avps) -> - lists:map(fun trim/1, Avps); - trim(Avp) -> Avp. @@ -395,27 +358,6 @@ dict(_) -> ?MODULE. -%% g/5 - -%% Ignore decode errors within Failed-AVP (best-effort) ... -g(true, [_Error | Rec], Name, Avp, Acc, _ComponentAvps) -> - decode_AVP(Name, Avp#diameter_avp{value = Rec}, Acc); -g(true, _Error, Name, Avp, Acc, _ComponentAvps) -> - decode_AVP(Name, Avp, Acc); - -%% ... or not. -g(false, [Error | _Rec], _Name, Avp, Acc, ComponentAvps) -> - g(Error, Avp, Acc, ComponentAvps); -g(false, Error, _Name, Avp, Acc, ComponentAvps) -> - g(Error, Avp, Acc, ComponentAvps). - -%% g/4 - -g({RC, ErrorData}, Avp, Acc, ComponentAvps) -> - {Avps, {Rec, Errors}} = Acc, - E = Avp#diameter_avp{data = [ErrorData]}, - {[[Avp | trim(ComponentAvps)] | Avps], {Rec, [{RC, E} | Errors]}}. - %% d/5 %% Ignore a decode error within Failed-AVP ... @@ -431,7 +373,7 @@ diameter_lib:log(decode_error, ?MODULE, ?LINE, - {Name, Avp#diameter_avp.name, Stack}), + {Reason, Name, Avp#diameter_avp.name, Stack}), {Rec, Failed} = Acc, {[Avp|Avps], {Rec, [rc(Reason, Avp) | Failed]}}. @@ -451,8 +393,7 @@ false. is_strict() -> - diameter_codec:getopt(strict_mbit) - andalso false /= getr(?STRICT_KEY). + false /= getr(?STRICT_KEY). %% relax/1 %% @@ -461,26 +402,14 @@ %% Strictly, this doesn't need to be the case. relax('Failed-AVP') -> - putr(?FAILED_KEY, true); + is_failed() orelse putr(?FAILED_KEY, true); relax(_) -> is_failed(). - -%% is_failed/0 -%% -%% Is the AVP currently being decoded nested within Failed-AVP? Note -%% that this is only true when Failed-AVP is the parent. In -%% particular, it's not true when Failed-AVP itself is being decoded -%% (unless nested). - + is_failed() -> true == getr(?FAILED_KEY). -%% is_failed/1 - -is_failed(Name) -> - 'Failed-AVP' == Name orelse is_failed(). - %% reset/2 reset(Key, undefined) -> @@ -494,14 +423,14 @@ %% undecoded. Note that the type field is 'undefined' in this case. decode_AVP(Name, Avp, {Avps, Acc}) -> - {[trim(Avp) | Avps], pack_AVP(Name, Avp, Acc)}. + {[Avp | Avps], pack_AVP(Name, Avp, Acc)}. %% rc/1 %% diameter_types will raise an error of this form to communicate %% DIAMETER_INVALID_AVP_LENGTH (5014). A module specified to a -%% @custom_types tag in a dictionary file can also raise an error of -%% this form. +%% @custom_types tag in a spec file can also raise an error of this +%% form. rc({'DIAMETER', 5014 = RC, _}, #diameter_avp{name = AvpName} = Avp) -> {RC, Avp#diameter_avp{data = empty_value(AvpName)}}; @@ -577,16 +506,17 @@ %% allow for Failed-AVP in an answer-message. pack_arity(Name, AvpName, M) -> + IsFailed = Name == 'Failed-AVP' orelse is_failed(), %% Not testing just Name /= 'Failed-AVP' means we're changing the %% packing of AVPs nested within Failed-AVP, but the point of %% ignoring errors within Failed-AVP is to decode as much as %% possible, and failing because a mandatory AVP couldn't be - %% packed into a dedicated field defeats that point. Note - %% is_failed/1 since is_failed/0 will return false when packing - %% 'AVP' within Failed-AVP. + %% packed into a dedicated field defeats that point. Note that we + %% can't just test not is_failed() since this will be 'true' when + %% packing an unknown AVP directly within Failed-AVP. - pack_arity(is_failed(Name) + pack_arity(IsFailed orelse {Name, AvpName} == {'answer-message', 'Failed-AVP'} orelse not M orelse not is_strict(), @@ -629,17 +559,14 @@ %% AVP MUST be included and contain a copy of the first instance of %% the offending AVP that exceeded the maximum number of occurrences %% - pack(_, 1, _, Avp, {Rec, Failed}) -> {Rec, [{5009, Avp} | Failed]}; -pack(L, {_, Max}, FieldName, Avp, Acc) -> - case '*' /= Max andalso has_prefix(Max, L) of - true -> - {Rec, Failed} = Acc, - {Rec, [{5009, Avp} | Failed]}; - false -> - p(FieldName, fun(V) -> [V|L] end, Avp, Acc) - end. +pack(L, {_, Max}, _, Avp, {Rec, Failed}) + when length(L) == Max -> + {Rec, [{5009, Avp} | Failed]}; + +pack(L, _, FieldName, Avp, Acc) -> + p(FieldName, fun(V) -> [V|L] end, Avp, Acc). %% p/4 @@ -655,55 +582,22 @@ %% # grouped_avp/3 %% --------------------------------------------------------------------------- --spec grouped_avp(decode, avp_name(), bitstring()) +-spec grouped_avp(decode, avp_name(), binary()) -> {avp_record(), [avp()]}; (encode, avp_name(), avp_record() | avp_values()) -> binary() | no_return(). -%% Length error induced by diameter_codec:collect_avps/1: the AVP -%% length in the header was too short (insufficient for the extracted -%% header) or too long (past the end of the message). An empty payload -%% is sufficient according to the RFC text for 5014. -grouped_avp(decode, _Name, <<0:1, _/binary>>) -> - throw({?TAG, {grouped, {5014, []}, []}}); - grouped_avp(decode, Name, Data) -> - grouped_decode(Name, diameter_codec:collect_avps(Data)); + {Rec, Avps, []} = decode_avps(Name, diameter_codec:collect_avps(Data)), + {Rec, Avps}; +%% A failed match here will result in 5004. Note that this is the only +%% AVP type that doesn't just return the decoded record, also +%% returning the list of component AVP's. grouped_avp(encode, Name, Data) -> encode_avps(Name, Data). -%% grouped_decode/2 -%% -%% Note that Grouped is the only AVP type that doesn't just return a -%% decoded value, also returning the list of component diameter_avp -%% records. - -%% Length error in trailing component AVP. -grouped_decode(_Name, {Error, Acc}) -> - {5014, Avp} = Error, - throw({?TAG, {grouped, Error, [Avp | Acc]}}); - -%% 7.5. Failed-AVP AVP - -%% In the case where the offending AVP is embedded within a Grouped AVP, -%% the Failed-AVP MAY contain the grouped AVP, which in turn contains -%% the single offending AVP. The same method MAY be employed if the -%% grouped AVP itself is embedded in yet another grouped AVP and so on. -%% In this case, the Failed-AVP MAY contain the grouped AVP hierarchy up -%% to the single offending AVP. This enables the recipient to detect -%% the location of the offending AVP when embedded in a group. - -%% An error in decoding a component AVP throws the first fauly -%% component, which the catch in d/3 wraps in the Grouped AVP in -%% question. A partially decoded record is only used when ignoring -%% errors in Failed-AVP. -grouped_decode(Name, ComponentAvps) -> - {Rec, Avps, Es} = decode_avps(Name, ComponentAvps), - [] == Es orelse throw({?TAG, {grouped, [{_,_} = hd(Es) | Rec], Avps}}), - {Rec, Avps}. - %% --------------------------------------------------------------------------- %% # empty_group/1 %% --------------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/diameter/include/diameter.hrl erlang-17.3-dfsg/lib/diameter/include/diameter.hrl --- erlang-18.2-dfsg/lib/diameter/include/diameter.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/include/diameter.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -40,7 +39,7 @@ %% -record(diameter_event, {service, %% name - info}). %% term() + info}). %% tuple() %% diameter_packet records are passed through the encode/decode %% interface supplied by a dictionary module configured on a Diameter diff -Nru erlang-18.2-dfsg/lib/diameter/Makefile erlang-17.3-dfsg/lib/diameter/Makefile --- erlang-18.2-dfsg/lib/diameter/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/diameter/src/app.sed erlang-17.3-dfsg/lib/diameter/src/app.sed --- erlang-18.2-dfsg/lib/diameter/src/app.sed 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/app.sed 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_app.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_app.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_callback.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_callback.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_callback.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_callback.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_capx.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_capx.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_capx.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_capx.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -51,8 +50,7 @@ -export([build_CER/2, recv_CER/3, recv_CEA/3, - make_caps/2, - binary_caps/1]). + make_caps/2]). -include_lib("diameter/include/diameter.hrl"). -include("diameter_internal.hrl"). @@ -117,8 +115,7 @@ -define(SC(K,F), set_cap({K, Val}, {Caps, #diameter_caps{F = false} = C}) -> - {Caps#diameter_caps{F = cap(K, copy(Val))}, - C#diameter_caps{F = true}}). + {Caps#diameter_caps{F = cap(K, Val)}, C#diameter_caps{F = true}}). ?SC('Origin-Host', origin_host); ?SC('Origin-Realm', origin_realm); @@ -378,10 +375,10 @@ 'Firmware-Revision', 'AVP'], CEX), - #diameter_caps{origin_host = copy(OH), - origin_realm = copy(OR), + #diameter_caps{origin_host = OH, + origin_realm = OR, vendor_id = VId, - product_name = copy(PN), + product_name = PN, origin_state_id = OSI, host_ip_address = IP, supported_vendor_id = SV, @@ -392,32 +389,6 @@ firmware_revision = FR, avp = X}. -%% Copy binaries to avoid retaining a reference to a large binary -%% containing AVPs we aren't interested in. -copy(B) - when is_binary(B) -> - binary:copy(B); - -copy(T) -> - T. - -%% binary_caps/1 -%% -%% Encode stringish capabilities with {string_decode, false}. - -binary_caps(Caps) -> - lists:foldl(fun bcaps/2, Caps, [#diameter_caps.origin_host, - #diameter_caps.origin_realm, - #diameter_caps.product_name]). - -bcaps(N, Caps) -> - case element(N, Caps) of - undefined -> - Caps; - V -> - setelement(N, Caps, iolist_to_binary(V)) - end. - %% --------------------------------------------------------------------------- %% --------------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_codec.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_codec.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_codec.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_codec.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,8 +22,6 @@ -export([encode/2, decode/2, decode/3, - setopts/1, - getopt/1, collect_avps/1, decode_header/1, sequence_numbers/1, @@ -62,52 +59,6 @@ %% +-+-+-+-+-+-+-+-+-+-+-+-+- %%% --------------------------------------------------------------------------- -%%% # setopts/1 -%%% # getopt/1 -%%% --------------------------------------------------------------------------- - -%% These functions are a compromise in the same vein as the use of the -%% process dictionary in diameter_gen.hrl in generated codec modules. -%% Instead of rewriting the entire dictionary generation to pass -%% encode/decode options around, the calling process sets them by -%% calling setopts/1. At current, the only option is whether or not to -%% decode binaries as strings, which is used by diameter_types. - -setopts(Opts) - when is_list(Opts) -> - lists:foreach(fun setopt/1, Opts). - -%% The default string_decode true is for backwards compatibility. -setopt({K, false = B}) - when K == string_decode; - K == strict_mbit -> - setopt(K, B); - -%% Regard anything but the generated RFC 3588 dictionary as modern. -%% This affects the interpretation of defaults during the decode -%% of values of type DiameterURI, this having changed from RFC 3588. -%% (So much for backwards compatibility.) -setopt({common_dictionary, diameter_gen_base_rfc3588}) -> - setopt(rfc, 3588); - -setopt(_) -> - ok. - -setopt(Key, Value) -> - put({diameter, Key}, Value). - -getopt(Key) -> - case get({diameter, Key}) of - undefined when Key == string_decode; - Key == strict_mbit -> - true; - undefined when Key == rfc -> - 6733; - V -> - V - end. - -%%% --------------------------------------------------------------------------- %%% # encode/2 %%% --------------------------------------------------------------------------- @@ -139,7 +90,7 @@ msg = Msg}). e(_, #diameter_packet{msg = [#diameter_header{} = Hdr | As]} = Pkt) -> - try encode_avps(reorder(As)) of + try encode_avps(As) of Avps -> Length = size(Avps) + 20, @@ -232,50 +183,26 @@ %% Message as a list of #diameter_avp{} ... encode_avps(_, _, [#diameter_avp{} | _] = Avps) -> - encode_avps(reorder(Avps)); + encode_avps(reorder(Avps, [], Avps)); %% ... or as a tuple list or record. encode_avps(Mod, MsgName, Values) -> Mod:encode_avps(MsgName, Values). %% reorder/1 -%% -%% Reorder AVPs for the relay case using the index field of -%% diameter_avp records. Decode populates this field in collect_avps -%% and presents AVPs in reverse order. A relay then sends the reversed -%% list with a Route-Record AVP prepended. The goal here is just to do -%% lists:reverse/1 in Grouped AVPs and the outer list, but only in the -%% case there are indexed AVPs at all, so as not to reverse lists that -%% have been explicilty sent (unindexed, in the desired order) as a -%% diameter_avp list. The effect is the same as lists:keysort/2, but -%% only on the cases we expect, not a general sort. - -reorder(Avps) -> - case reorder(Avps, []) of - false -> - Avps; - Sorted -> - Sorted - end. - -%% reorder/3 -%% In case someone has reversed the list already. (Not likely.) -reorder([#diameter_avp{index = 0} | _] = Avps, Acc) -> +reorder([#diameter_avp{index = 0} | _] = Avps, Acc, _) -> Avps ++ Acc; -%% Assume indexed AVPs are in reverse order. -reorder([#diameter_avp{index = N} = A | Avps], Acc) +reorder([#diameter_avp{index = N} = A | Avps], Acc, _) when is_integer(N) -> lists:reverse(Avps, [A | Acc]); -%% An unindexed AVP. -reorder([H | T], Acc) -> - reorder(T, [H | Acc]); +reorder([H | T], Acc, Avps) -> + reorder(T, [H | Acc], Avps); -%% No indexed members. -reorder([], _) -> - false. +reorder([], Acc, _) -> + Acc. %% encode_avps/1 @@ -463,9 +390,6 @@ sequence_numbers(#diameter_packet{header = #diameter_header{} = H}) -> sequence_numbers(H); -sequence_numbers(#diameter_packet{msg = [#diameter_header{} = H | _]}) -> - sequence_numbers(H); - sequence_numbers(#diameter_header{hop_by_hop_id = H, end_to_end_id = E}) -> {H,E}; @@ -593,7 +517,6 @@ %% Header is truncated. split_head(Bin) -> ?THROW({5014, #diameter_avp{data = Bin}}). -%% Note that pack_avp/1 will pad this at encode if sent in a Failed-AVP. %% 3588: %% @@ -623,7 +546,7 @@ %% AVP header with zero up to the minimum AVP header length. %% %% The underlined clause must be in error since (1) a header less than -%% the minimum value mean we might not know the identity of the AVP and +%% the minimum value mean we don't know the identity of the AVP and %% (2) the last sentence covers this case. %% split_data/3 @@ -638,18 +561,14 @@ <> -> {Data, Rest}; _ -> - %% Header length points past the end of the message, or - %% doesn't span the header. As stated in the 6733 text - %% above, it's sufficient to return a zero-filled minimal - %% payload if this is a request. Do this (in cases that we - %% know the type) by inducing a decode failure and letting - %% the dictionary's decode (in diameter_gen) deal with it. - %% - %% Note that the extra bit can only occur in the trailing - %% AVP of a message or Grouped AVP, since a faulty AVP - %% Length is otherwise indistinguishable from a correct - %% one here, since we don't know the types of the AVPs - %% being extracted. + %% Header length points past the end of the message. As + %% stated in the 6733 text above, it's sufficient to + %% return a zero-filled minimal payload if this is a + %% request. Do this (in cases that we know the type) by + %% inducing a decode failure and letting the dictionary's + %% decode (in diameter_gen) deal with it. Here we don't + %% know type. If the type isn't known, then the decode + %% just strips the extra bit. {<<0:1, Bin/binary>>, <<>>} end. @@ -659,23 +578,14 @@ %% The normal case here is data as an #diameter_avp{} list or an %% iolist, which are the cases that generated codec modules use. The -%% other cases are a convenience in the relay case in which the +%% other case is as a convenience in the relay case in which the %% dictionary doesn't know about specific AVP's. -%% Decoded Grouped AVP with decoded components: ignore components -%% since they're already encoded in the Grouped AVP. -pack_avp([#diameter_avp{} = Grouped | _Components]) -> - pack_avp(Grouped); - -%% Grouped AVP whose components need packing. It's intentional that -%% this isn't equivalent to [Grouped | Components]: here the -%% components need to be encoded before wrapping with the Grouped AVP, -%% and the list is flat, nesting being accomplished in the data -%% fields. -pack_avp(#diameter_avp{data = [#diameter_avp{} | _] = Components} = Grouped) -> - pack_avp(Grouped#diameter_avp{data = encode_avps(Components)}); +%% Grouped AVP whose components need packing ... +pack_avp(#diameter_avp{data = [#diameter_avp{} | _] = Avps} = A) -> + pack_avp(A#diameter_avp{data = encode_avps(Avps)}); -%% Data as a type/value tuple ... +%% ... data as a type/value tuple ... pack_avp(#diameter_avp{data = {Type, Value}} = A) when is_atom(Type) -> pack_avp(A#diameter_avp{data = diameter_types:Type(encode, Value)}); @@ -705,8 +615,8 @@ Len = size(<> = <>), <>; +%% ... from a dictionary compiled against old code in diameter_gen ... %% ... when ignoring errors in Failed-AVP ... -%% ... during a relay encode ... pack_avp(#diameter_avp{data = <<0:1, B/binary>>} = A) -> pack_avp(A#diameter_avp{data = B}); diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_config.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_config.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_config.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_config.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -36,10 +35,10 @@ %% -module(diameter_config). --behaviour(gen_server). - -compile({no_auto_import, [monitor/2]}). +-behaviour(gen_server). + -export([start_service/2, stop_service/1, add_transport/2, @@ -69,7 +68,7 @@ -include("diameter_internal.hrl"). %% Server state. --record(state, {id = diameter_lib:now()}). +-record(state, {id = now()}). %% Registered name of the server. -define(SERVER, ?MODULE). @@ -159,8 +158,7 @@ %% # add_transport/2 %% -------------------------------------------------------------------------- --spec add_transport(diameter:service_name(), - {connect|listen, [diameter:transport_opt()]}) +-spec add_transport(diameter:service_name(), {connect|listen, [diameter:transport_opt()]}) -> {ok, diameter:transport_ref()} | {error, term()}. @@ -533,10 +531,7 @@ opt({capabilities, Os}) -> is_list(Os) andalso ok == encode_CER(Os); -opt({K, Tmo}) - when K == capx_timeout; - K == dpr_timeout; - K == dpa_timeout -> +opt({capx_timeout, Tmo}) -> ?IS_UINT32(Tmo); opt({length_errors, T}) -> @@ -559,9 +554,6 @@ opt({spawn_opt, Opts}) -> is_list(Opts); -opt({pool_size, N}) -> - is_integer(N) andalso 0 < N; - %% Options that we can't validate. opt({K, _}) when K == transport_config; @@ -646,25 +638,13 @@ {false, monitor}, {?NOMASK, sequence}, {nodes, restrict_connections}, - {16#FFFFFF, incoming_maxlen}, - {true, strict_mbit}, - {true, string_decode}, {[], spawn_opt}]), - D = proplists:get_value(string_decode, SvcOpts, true), - #service{name = SvcName, rec = #diameter_service{applications = Apps, - capabilities = binary_caps(Caps, D)}, + capabilities = Caps}, options = SvcOpts}. -binary_caps(Caps, true) -> - Caps; -binary_caps(Caps, false) -> - diameter_capx:binary_caps(Caps). - -%% make_opts/2 - make_opts(Opts, Defs) -> Known = [{K, get_opt(K, Opts, D)} || {D,K} <- Defs], Unknown = Opts -- Known, @@ -673,28 +653,17 @@ [{K, opt(K,V)} || {K,V} <- Known]. -opt(incoming_maxlen, N) - when 0 =< N, N < 1 bsl 24 -> - N; - opt(spawn_opt, L) when is_list(L) -> L; opt(K, false = B) - when K == share_peers; - K == use_shared_peers; - K == monitor; - K == restrict_connections; - K == strict_mbit; - K == string_decode -> + when K /= sequence -> B; opt(K, true = B) when K == share_peers; - K == use_shared_peers; - K == strict_mbit; - K == string_decode -> + K == use_shared_peers -> B; opt(restrict_connections, T) diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_dict.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_dict.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_dict.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_dict.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -46,7 +45,6 @@ -export_type([evaluable/0, restriction/0, - message_length/0, remotes/0, sequence/0, app_alias/0, @@ -300,9 +298,6 @@ | [node()] | evaluable(). --type message_length() - :: 0..16#FFFFFF. - %% Options passed to start_service/2 -type service_opt() @@ -311,9 +306,6 @@ | {restrict_connections, restriction()} | {sequence, sequence() | evaluable()} | {share_peers, remotes()} - | {string_decode, boolean()} - | {strict_mbit, boolean()} - | {incoming_maxlen, message_length()} | {use_shared_peers, remotes()} | {spawn_opt, list()}. @@ -345,14 +337,11 @@ :: {transport_module, atom()} | {transport_config, any()} | {transport_config, any(), 'Unsigned32'() | infinity} - | {pool_size, pos_integer()} | {applications, [app_alias()]} | {capabilities, [capability()]} | {capabilities_cb, evaluable()} | {capx_timeout, 'Unsigned32'()} | {disconnect_cb, evaluable()} - | {dpr_timeout, 'Unsigned32'()} - | {dpa_timeout, 'Unsigned32'()} | {length_errors, exit | handle | discard} | {connect_timer, 'Unsigned32'()} | {watchdog_timer, 'Unsigned32'() | {module(), atom(), list()}} diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_internal.hrl erlang-17.3-dfsg/lib/diameter/src/base/diameter_internal.hrl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_lib.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_lib.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,37 +1,29 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% -module(diameter_lib). --compile({no_auto_import, [now/0]}). --compile({nowarn_deprecated_function, [{erlang, now, 0}]}). -export([info_report/2, error_report/2, warning_report/2, - now/0, - timestamp/1, now_diff/1, - micro_diff/1, - micro_diff/2, time/1, - seed/0, eval/1, eval_name/1, get_stacktrace/0, @@ -39,8 +31,6 @@ spawn_opts/2, wait/1, fold_tuple/3, - fold_n/3, - for_n/2, log/4]). %% --------------------------------------------------------------------------- @@ -100,68 +90,22 @@ end. %% --------------------------------------------------------------------------- -%% # now/0 -%% --------------------------------------------------------------------------- - --spec now() - -> integer(). - -now() -> - erlang:monotonic_time(). - -%% --------------------------------------------------------------------------- -%% # timestamp/1 -%% --------------------------------------------------------------------------- - --spec timestamp(integer()) - -> erlang:timestamp(). - -timestamp(MonoT) -> %% monotonic time - MicroSecs = monotonic_to_microseconds(MonoT + erlang:time_offset()), - Secs = MicroSecs div 1000000, - {Secs div 1000000, Secs rem 1000000, MicroSecs rem 1000000}. - -monotonic_to_microseconds(MonoT) -> - erlang:convert_time_unit(MonoT, native, micro_seconds). - -%% --------------------------------------------------------------------------- %% # now_diff/1 %% --------------------------------------------------------------------------- --spec now_diff(T0 :: integer()) +-spec now_diff(NowT) -> {Hours, Mins, Secs, MicroSecs} - when Hours :: non_neg_integer(), + when NowT :: {non_neg_integer(), 0..999999, 0..999999}, + Hours :: non_neg_integer(), Mins :: 0..59, Secs :: 0..59, MicroSecs :: 0..999999. -%% Return time difference as an {H, M, S, MicroS} tuple instead of as -%% integer microseconds. - -now_diff(T0) -> - time(micro_diff(T0)). - -%% --------------------------------------------------------------------------- -%% # micro_diff/1 -%% --------------------------------------------------------------------------- - --spec micro_diff(T0 :: integer()) - -> MicroSecs - when MicroSecs :: non_neg_integer(). - -micro_diff(T0) -> %% monotonic time - monotonic_to_microseconds(erlang:monotonic_time() - T0). - -%% --------------------------------------------------------------------------- -%% # micro_diff/2 -%% --------------------------------------------------------------------------- - --spec micro_diff(T1 :: integer(), T0 :: integer()) - -> MicroSecs - when MicroSecs :: non_neg_integer(). +%% Return timer:now_diff(now(), NowT) as an {H, M, S, MicroS} tuple +%% instead of as integer microseconds. -micro_diff(T1, T0) -> %% monotonic time - monotonic_to_microseconds(T1 - T0). +now_diff({_,_,_} = Time) -> + time(timer:now_diff(now(), Time)). %% --------------------------------------------------------------------------- %% # time/1 @@ -169,13 +113,19 @@ %% Return an elapsed time as an {H, M, S, MicroS} tuple. %% --------------------------------------------------------------------------- --spec time(Diff :: non_neg_integer()) +-spec time(NowT | Diff) -> {Hours, Mins, Secs, MicroSecs} - when Hours :: non_neg_integer(), + when NowT :: {non_neg_integer(), 0..999999, 0..999999}, + Diff :: non_neg_integer(), + Hours :: non_neg_integer(), Mins :: 0..59, Secs :: 0..59, MicroSecs :: 0..999999. +time({_,_,_} = NowT) -> %% time of day + %% 24 hours = 24*60*60*1000000 = 86400000000 microsec + time(timer:now_diff(NowT, {0,0,0}) rem 86400000000); + time(Micro) -> %% elapsed time Seconds = Micro div 1000000, H = Seconds div 3600, @@ -184,24 +134,6 @@ {H, M, S, Micro rem 1000000}. %% --------------------------------------------------------------------------- -%% # seed/0 -%% --------------------------------------------------------------------------- - --spec seed() - -> {erlang:timestamp(), {integer(), integer(), integer()}}. - -%% Return an argument for random:seed/1. - -seed() -> - T = now(), - {timestamp(T), seed(T)}. - -%% seed/1 - -seed(T) -> %% monotonic time - {erlang:phash2(node()), T, erlang:unique_integer()}. - -%% --------------------------------------------------------------------------- %% # eval/1 %% %% Evaluate a function in various forms. @@ -315,19 +247,17 @@ %% # wait/1 %% --------------------------------------------------------------------------- --spec wait([pid() | reference()]) +-spec wait([pid()]) -> ok. wait(L) -> - lists:foreach(fun down/1, L). + down([erlang:monitor(process, P) || P <- L]). -down(Pid) - when is_pid(Pid) -> - down(monitor(process, Pid)); - -down(MRef) - when is_reference(MRef) -> - receive {'DOWN', MRef, process, _, _} = T -> T end. +down([]) -> + ok; +down([MRef|T]) -> + receive {'DOWN', MRef, process, _, _} -> ok end, + down(T). %% --------------------------------------------------------------------------- %% # fold_tuple/3 @@ -360,35 +290,6 @@ setelement(Idx, T, Value). %% --------------------------------------------------------------------------- -%% # fold_n/3 -%% --------------------------------------------------------------------------- - --spec fold_n(F, Acc0, N) - -> term() - when F :: fun((non_neg_integer(), term()) -> term()), - Acc0 :: term(), - N :: non_neg_integer(). - -fold_n(F, Acc, N) - when is_integer(N), 0 < N -> - fold_n(F, F(N, Acc), N-1); - -fold_n(_, Acc, _) -> - Acc. - -%% --------------------------------------------------------------------------- -%% # for_n/2 -%% --------------------------------------------------------------------------- - --spec for_n(F, N) - -> non_neg_integer() - when F :: fun((non_neg_integer()) -> term()), - N :: non_neg_integer(). - -for_n(F, N) -> - fold_n(fun(M,A) -> F(M), A+1 end, 0, N). - -%% --------------------------------------------------------------------------- %% # log/4 %% %% Called to have something to trace on for happenings of interest. diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_misc_sup.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_misc_sup.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_misc_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_misc_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_peer.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_peer.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_peer.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_peer.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,24 +1,24 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% -module(diameter_peer). + -behaviour(gen_server). %% Interface towards transport modules ... @@ -57,7 +57,7 @@ -define(SERVER, ?MODULE). %% Server state. --record(state, {id = diameter_lib:now()}). +-record(state, {id = now()}). %% Default transport_module/config. -define(DEFAULT_TMOD, diameter_tcp). @@ -119,7 +119,7 @@ pair([{transport_config = T, C} | Rest], Mods, Acc) -> pair([{T, C, ?DEFAULT_TTMO} | Rest], Mods, Acc); pair([{transport_config, C, Tmo} | Rest], Mods, Acc) -> - pair(Rest, [], acc({lists:reverse(Mods), C, Tmo}, Acc)); + pair(Rest, [], acc({Mods, C, Tmo}, Acc)); pair([_ | Rest], Mods, Acc) -> pair(Rest, Mods, Acc); @@ -128,16 +128,13 @@ pair([], [], []) -> [{[?DEFAULT_TMOD], ?DEFAULT_TCFG, ?DEFAULT_TTMO}]; -%% One transport_module, one transport_config: ignore option order. -%% That is, interpret [{transport_config, _}, {transport_module, _}] -%% as if the order was reversed, not as config with default module and -%% module with default config. -pair([], [_] = Mods, [{[], Cfg, Tmo}]) -> - [{Mods, Cfg, Tmo}]; +%% One transport_module, one transport_config. +pair([], [M], [{[], Cfg, Tmo}]) -> + [{[M], Cfg, Tmo}]; %% Trailing transport_module: default transport_config. pair([], [_|_] = Mods, Acc) -> - pair([{transport_config, ?DEFAULT_TCFG}], Mods, Acc); + lists:reverse(acc({Mods, ?DEFAULT_TCFG, ?DEFAULT_TTMO}, Acc)); pair([], [], Acc) -> lists:reverse(def(Acc)). @@ -233,22 +230,12 @@ %% # send/2 %% --------------------------------------------------------------------------- -send(Pid, Msg) -> - ifc_send(Pid, {send, strip(Msg)}). - -%% Send only binary when possible. -strip(#diameter_packet{transport_data = undefined, - bin = Bin}) -> - Bin; - -%% Strip potentially large message terms. -strip(#diameter_packet{transport_data = T, - bin = Bin}) -> - #diameter_packet{transport_data = T, - bin = Bin}; +send(Pid, #diameter_packet{transport_data = undefined, + bin = Bin}) -> + send(Pid, Bin); -strip(Msg) -> - Msg. +send(Pid, Pkt) -> + ifc_send(Pid, {send, Pkt}). %% --------------------------------------------------------------------------- %% # close/1 @@ -337,6 +324,7 @@ {ok, State}. %% --------------------------------------------------------- +%% INTERNAL FUNCTIONS %% --------------------------------------------------------- %% ifc_send/2 diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_peer_fsm.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_peer_fsm.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_peer_fsm.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_peer_fsm.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -64,8 +63,6 @@ %% Keys in process dictionary. -define(CB_KEY, cb). %% capabilities callback -define(DPR_KEY, dpr). %% disconnect callback --define(DPA_KEY, dpa). %% timeout for incoming DPA, or shutdown after - %% outgoing DPA -define(REF_KEY, ref). %% transport_ref() -define(Q_KEY, q). %% transport start queue -define(START_KEY, start). %% start of connected transport @@ -85,26 +82,18 @@ N == ?GOAWAY; N == goaway; N == ?BUSY; N == busy). -%% RFC 6733: +%% RFC 3588: %% %% Timeout An application-defined timer has expired while waiting %% for some event. %% - +-define(EVENT_TIMEOUT, 10000). %% Default timeout for reception of CER/CEA. --define(CAPX_TIMEOUT, 10000). -%% Default timeout for DPA to be received in response to an outgoing -%% DPR. A bit short but the timeout used to be hardcoded. (So it could -%% be worse.) +%% Default timeout for DPA in response to DPR. A bit short but the +%% timeout used to be hardcoded. (So it could be worse.) -define(DPA_TIMEOUT, 1000). -%% Default timeout for the connection to be closed by the peer -%% following an outgoing DPA in response to an incoming DPR. It's the -%% recipient of DPA that should close the connection according to the -%% RFC. --define(DPR_TIMEOUT, 5000). - -type uint32() :: diameter:'Unsigned32'(). -record(state, @@ -118,15 +107,9 @@ transport :: pid(), %% transport process dictionary :: module(), %% common dictionary service :: #diameter_service{}, - dpr = false :: false - | true %% DPR received, DPA sent - | {boolean(), uint32(), uint32()}, - %% hop by hop and end to end identifiers in - %% outgoing DPR; boolean says whether or not - %% the request was sent explicitly with - %% diameter:call/4. - length_errors :: exit | handle | discard, - incoming_maxlen :: integer() | infinity}). + dpr = false :: false | {uint32(), uint32()}, + %% | hop by hop and end to end identifiers + length_errors :: exit | handle | discard}). %% There are non-3588 states possible as a consequence of 5.6.1 of the %% standard and the corresponding problem for incoming CEA's: we don't @@ -155,7 +138,7 @@ %% # start/3 %% --------------------------------------------------------------------------- --spec start(T, [Opt], {[diameter:service_opt()], +-spec start(T, [Opt], {diameter:sequence(), [node()], module(), #diameter_service{}}) @@ -194,23 +177,18 @@ proc_lib:init_ack({ok, self()}), gen_server:enter_loop(?MODULE, [], i(T)). -i({Ack, WPid, {M, Ref} = T, Opts, {SvcOpts, Nodes, Dict0, Svc}}) -> +i({Ack, WPid, {M, Ref} = T, Opts, {Mask, Nodes, Dict0, Svc}}) -> erlang:monitor(process, WPid), wait(Ack, WPid), diameter_stats:reg(Ref), - diameter_codec:setopts([{common_dictionary, Dict0} | SvcOpts]), - {_,_} = Mask = proplists:get_value(sequence, SvcOpts), - Maxlen = proplists:get_value(incoming_maxlen, SvcOpts, 16#FFFFFF), {[Cs,Ds], Rest} = proplists:split(Opts, [capabilities_cb, disconnect_cb]), putr(?CB_KEY, {Ref, [F || {_,F} <- Cs]}), putr(?DPR_KEY, [F || {_, F} <- Ds]), putr(?REF_KEY, Ref), putr(?SEQUENCE_KEY, Mask), putr(?RESTRICT_KEY, Nodes), - putr(?DPA_KEY, {proplists:get_value(dpr_timeout, Opts, ?DPR_TIMEOUT), - proplists:get_value(dpa_timeout, Opts, ?DPA_TIMEOUT)}), - Tmo = proplists:get_value(capx_timeout, Opts, ?CAPX_TIMEOUT), + Tmo = proplists:get_value(capx_timeout, Opts, ?EVENT_TIMEOUT), OnLengthErr = proplists:get_value(length_errors, Opts, exit), {TPid, Addrs} = start_transport(T, Rest, Svc), @@ -221,8 +199,7 @@ dictionary = Dict0, mode = M, service = svc(Svc, Addrs), - length_errors = OnLengthErr, - incoming_maxlen = Maxlen}. + length_errors = OnLengthErr}. %% The transport returns its local ip addresses so that different %% transports on the same service can use different local addresses. %% The local addresses are put into Host-IP-Address avps here when @@ -235,12 +212,9 @@ Ref -> ok; {'DOWN', _, process, Pid, _} = D -> - x(D) + exit({shutdown, D}) end. -x(T) -> - exit({shutdown, T}). - start_transport(T, Opts, #diameter_service{capabilities = LCaps} = Svc) -> Addrs0 = LCaps#diameter_caps.host_ip_address, start_transport(Addrs0, {T, Opts, Svc}). @@ -251,8 +225,8 @@ erlang:monitor(process, TPid), q_next(TPid, Addrs0, Tmo, Data), {TPid, Addrs}; - {error, No} -> - x({no_connection, No}) + No -> + exit({shutdown, No}) end. svc(#diameter_service{capabilities = LCaps0} = Svc, Addrs) -> @@ -315,7 +289,7 @@ ?LOG(stop, Reason), {stop, {shutdown, Reason}, State}; stop -> - ?LOG(stop, truncate(T)), + ?LOG(stop, T), {stop, {shutdown, T}, State} catch exit: {diameter_codec, encode, T} = Reason -> @@ -348,11 +322,6 @@ %% --------------------------------------------------------------------------- %% --------------------------------------------------------------------------- -truncate({'DOWN' = T, _, process, Pid, _}) -> - {T, Pid}; -truncate(T) -> - T. - putr(Key, Val) -> put({?MODULE, Key}, Val). @@ -399,8 +368,11 @@ %% message. This may be followed by an incoming message which arrived %% before the transport was killed and this can't be distinguished %% from one from the transport that's been started to replace it. -transition({diameter, T}, _) - when tuple_size(T) < 5, connected == element(2,T) -> +transition({diameter, {_, connected}}, _) -> + {stop, connection_timeout}; +transition({diameter, {_, connected, _}}, _) -> + {stop, connection_timeout}; +transition({diameter, {_, connected, _, _}}, _) -> {stop, connection_timeout}; %% Connection has timed out: start an alternate. @@ -428,8 +400,9 @@ ok; %% Outgoing message. -transition({send, Msg}, S) -> - outgoing(Msg, S); +transition({send, Msg}, #state{transport = TPid}) -> + send(TPid, Msg), + ok; %% Request for graceful shutdown at remove_transport, stop_service of %% application shutdown. @@ -438,8 +411,7 @@ transition({shutdown, Pid, _}, #state{parent = Pid}) -> ok; -%% DPA reception has timed out, or peer has not closed the connection -%% as a result of outgoing DPA. +%% DPA reception has timed out. transition(dpa_timeout, _) -> stop; @@ -547,9 +519,12 @@ recv(#diameter_packet{header = #diameter_header{} = Hdr} = Pkt, - #state{dictionary = Dict0} + #state{parent = Pid, + dictionary = Dict0} = S) -> - recv1(diameter_codec:msg_name(Dict0, Hdr), Pkt, S); + Name = diameter_codec:msg_name(Dict0, Hdr), + Pid ! {recv, self(), Name, Pkt}, + rcv(Name, Pkt, S); recv(#diameter_packet{header = undefined, bin = Bin} @@ -560,47 +535,6 @@ recv(Bin, S) -> recv(#diameter_packet{bin = Bin}, S). -%% recv1/3 - -recv1(_, - #diameter_packet{header = H, bin = Bin}, - #state{incoming_maxlen = M}) - when M < size(Bin) -> - invalid(false, incoming_maxlen_exceeded, {size(Bin), H}); - -%% Incoming request after outgoing DPR: discard. Don't discard DPR, so -%% both ends don't do so when sending simultaneously. -recv1(Name, - #diameter_packet{header = #diameter_header{is_request = true} = H}, - #state{dpr = {_,_,_}}) - when Name /= 'DPR' -> - invalid(false, recv_after_outgoing_dpr, H); - -%% Incoming request after incoming DPR: discard. -recv1(_, - #diameter_packet{header = #diameter_header{is_request = true} = H}, - #state{dpr = true}) -> - invalid(false, recv_after_incoming_dpr, H); - -%% DPA with identifier mismatch, or in response to a DPR initiated by -%% the service. -recv1('DPA' = N, - #diameter_packet{header = #diameter_header{hop_by_hop_id = Hid, - end_to_end_id = Eid}} - = Pkt, - #state{dpr = {X,H,E}} - = S) - when H /= Hid; - E /= Eid; - not X -> - rcv(N, Pkt, S); - -%% Any other message with a header and no length errors: send to the -%% parent. -recv1(Name, Pkt, #state{parent = Pid} = S) -> - Pid ! {recv, self(), Name, Pkt}, - rcv(Name, Pkt, S). - %% recv/3 recv(#diameter_header{length = Len} @@ -657,7 +591,7 @@ rcv('DPR' = N, Pkt, S) -> handle_request(N, Pkt, S); -%% DPA in response to DPR, with the expected identifiers. +%% DPA in response to DPR and with the expected identifiers. rcv('DPA' = N, #diameter_packet{header = #diameter_header{end_to_end_id = Eid, hop_by_hop_id = Hid} @@ -665,21 +599,14 @@ = Pkt, #state{dictionary = Dict0, transport = TPid, - dpr = {X, Hid, Eid}}) -> + dpr = {Hid, Eid}}) -> ?LOG(recv, N), - X orelse begin - %% Only count DPA in response to a DPR sent by the - %% service: explicit DPR is counted in the same way - %% as other explicitly sent requests. - incr(recv, H, Dict0), - incr_rc(recv, diameter_codec:decode(Dict0, Pkt), Dict0) - end, + incr(recv, H, Dict0), + incr_rc(recv, diameter_codec:decode(Dict0, Pkt), Dict0), diameter_peer:close(TPid), {stop, N}; -%% Ignore anything else, an unsolicited DPA in particular. Note that -%% dpa_timeout deals with the case in which the peer sends the wrong -%% identifiers in DPA. +%% Ignore anything else, an unsolicited DPA in particular. rcv(N, #diameter_packet{header = H}, _) when N == 'CER'; N == 'CEA'; @@ -713,61 +640,9 @@ %% Msg here could be a #diameter_packet or a binary depending on who's %% sending. In particular, the watchdog will send DWR as a binary %% while messages coming from clients will be in a #diameter_packet. - send(Pid, Msg) -> diameter_peer:send(Pid, Msg). -%% outgoing/2 - -%% Explicit DPR. -outgoing(#diameter_packet{header = #diameter_header{application_id = 0, - cmd_code = 282, - is_request = true} - = H} - = Pkt, - #state{dpr = T, - parent = Pid} - = S) -> - if T == false -> - inform_dpr(Pid), - send_dpr(true, Pkt, dpa_timeout(), S); - T == true -> - invalid(false, dpr_after_dpa, H); %% DPA sent: discard - true -> - invalid(false, dpr_after_dpr, H) %% DPR sent: discard - end; - -%% Explict CER or DWR: discard. These are sent by us. -outgoing(#diameter_packet{header = #diameter_header{application_id = 0, - cmd_code = C, - is_request = true} - = H}, - _) - when 257 == C; %% CER - 280 == C -> %% DWR - invalid(false, invalid_request, H); - -%% DPR not sent: send. -outgoing(Msg, #state{transport = TPid, dpr = false}) -> - send(TPid, Msg), - ok; - -%% Outgoing answer: send. -outgoing(#diameter_packet{header = #diameter_header{is_request = false}} - = Pkt, - #state{transport = TPid}) -> - send(TPid, Pkt), - ok; - -%% Outgoing request: discard. -outgoing(Msg, #state{dpr = {_,_,_}}) -> - invalid(false, send_after_dpr, header(Msg)). - -header(#diameter_packet{header = H}) -> - H; -header(Bin) -> %% DWR - diameter_codec:decode_header(Bin). - %% handle_request/3 %% %% Incoming CER or DPR. @@ -827,8 +702,6 @@ = Pkt, #state{dictionary = Dict0} = S) -> - diameter_codec:setopts([{string_decode, false}]), - {SupportedApps, RCaps, CEA} = recv_CER(CER, S), [RC, IS] = Dict0:'#get-'(['Result-Code', 'Inband-Security-Id'], CEA), @@ -861,7 +734,7 @@ errors = Es} = Pkt, S) -> - {RC, FailedAVP} = result_code(Type, H, Es), + {RC, FailedAVP} = result_code(H, Es), {answer(Type, RC, FailedAVP, S), post(Type, RC, Pkt, S)}. inband_security([]) -> @@ -878,16 +751,8 @@ post('CER' = T, RC, Pkt, S) -> {T, caps(S), {RC, Pkt}}; -post('DPR', _, _, #state{parent = Pid}) -> - [fun(S) -> dpr_timer(), inform_dpr(Pid), dpr(S) end]. - -dpr(#state{dpr = false} = S) -> %% not awaiting DPA - S#state{dpr = true}; %% DPR received -dpr(S) -> %% DPR already sent or received - S. - -inform_dpr(Pid) -> - Pid ! {'DPR', self()}. %% tell watchdog to die with us +post('DPR' = T, _, _, #state{parent = Pid}) -> + [fun(S) -> Pid ! {T, self()}, S end]. rejected({capabilities_cb, _F, Reason}, T, S) -> rejected(Reason, T, S); @@ -936,19 +801,6 @@ set([_|_] = Ans, FailedAvp) -> Ans ++ FailedAvp. -%% result_code/3 - -%% Be lenient with errors in DPR since there's no reason to be -%% otherwise. Rejecting may cause the peer to missinterpret the error -%% as meaning that the connection should not be closed, which may well -%% lead to more problems than any errors in the DPR. - -result_code('DPR', _, _) -> - {2001, []}; - -result_code('CER', H, Es) -> - result_code(H, Es). - %% result_code/2 result_code(#diameter_header{is_error = true}, _) -> @@ -1037,8 +889,6 @@ = DPkt = diameter_codec:decode(Dict0, Pkt), - diameter_codec:setopts([{string_decode, false}]), - RC = result_code(incr_rc(recv, DPkt, Dict0)), {SApps, IS, RCaps} = recv_CEA(DPkt, S), @@ -1179,7 +1029,7 @@ %% dpr/2 %% -%% The RFC isn't clear on whether DPR should be sent in a non-Open +%% The RFC isn't clear on whether DPR should be send in a non-Open %% state. The Peer State Machine transitions it documents aren't %% exhaustive (no Stop in Wait-I-CEA for example) so assume it's up to %% the implementation and transition to Closed (ie. die) if we haven't @@ -1195,7 +1045,7 @@ Peer = {self(), Caps}, dpr(CBs, [Reason, Ref, Peer], S); -%% Connection is open, DPR already sent or received. +%% Connection is open, DPR already sent. dpr(_, #state{state = 'Open'}) -> ok; @@ -1226,9 +1076,10 @@ dpr([], [Reason | _], S) -> send_dpr(Reason, [], S). --record(opts, {cause, timeout}). +-record(opts, {cause, timeout = ?DPA_TIMEOUT}). -send_dpr(Reason, Opts, #state{dictionary = Dict, +send_dpr(Reason, Opts, #state{transport = TPid, + dictionary = Dict, service = #diameter_service{capabilities = Caps}} = S) -> #opts{cause = Cause, timeout = Tmo} @@ -1237,37 +1088,24 @@ transport -> ?GOAWAY; _ -> ?REBOOT end, - timeout = dpa_timeout()}, + timeout = ?DPA_TIMEOUT}, Opts), #diameter_caps{origin_host = {OH, _}, origin_realm = {OR, _}} = Caps, - Pkt = encode(['DPR', {'Origin-Host', OH}, + #diameter_packet{header = #diameter_header{end_to_end_id = Eid, + hop_by_hop_id = Hid}} + = Pkt + = encode(['DPR', {'Origin-Host', OH}, {'Origin-Realm', OR}, {'Disconnect-Cause', Cause}], Dict), - send_dpr(false, Pkt, Tmo, S). - -%% send_dpr/4 - -send_dpr(X, - #diameter_packet{header = #diameter_header{end_to_end_id = Eid, - hop_by_hop_id = Hid}} - = Pkt, - Tmo, - #state{transport = TPid, - dictionary = Dict} - = S) -> - %% Only count DPR sent by the service: explicit DPR is counted in - %% the same way as other explicitly sent requests. - X orelse incr(send, Pkt, Dict), + incr(send, Pkt, Dict), send(TPid, Pkt), dpa_timer(Tmo), ?LOG(send, 'DPR'), - S#state{dpr = {X, Hid, Eid}}. - -%% opt/2 + S#state{dpr = {Hid, Eid}}. opt({timeout, Tmo}, Rec) when ?IS_TIMEOUT(Tmo) -> @@ -1290,17 +1128,6 @@ dpa_timer(Tmo) -> erlang:send_after(Tmo, self(), dpa_timeout). -dpa_timeout() -> - {_, Tmo} = getr(?DPA_KEY), - Tmo. - -dpr_timer() -> - dpa_timer(dpr_timeout()). - -dpr_timeout() -> - {Tmo, _} = getr(?DPA_KEY), - Tmo. - %% register_everywhere/1 %% %% Register a term and ensure it's not registered elsewhere. Note that diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_peer_fsm_sup.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_peer_fsm_sup.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_peer_fsm_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_peer_fsm_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_reg.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_reg.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_reg.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_reg.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,10 +22,10 @@ %% -module(diameter_reg). --behaviour(gen_server). - -compile({no_auto_import, [monitor/2]}). +-behaviour(gen_server). + -export([add/1, add_new/1, del/1, @@ -67,7 +66,7 @@ %% Table entry containing the Term -> Pid mapping. -define(MAPPING(Term, Pid), {Term, Pid}). --record(state, {id = diameter_lib:now(), +-record(state, {id = now(), q = []}). %% [{From, Pat}] %% =========================================================================== diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_service.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_service.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_service.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_service.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -112,7 +111,7 @@ %% to determine whether or not we need to call the process for a %% pick_peer callback in the statefull case. -record(state, - {id = diameter_lib:now(), + {id = now(), service_name :: diameter:service_name(), %% key in ?STATE_TABLE service :: #diameter_service{}, watchdogT = ets_new(watchdogs) %% #watchdog{} at start @@ -128,10 +127,7 @@ :: [{sequence, diameter:sequence()} %% sequence mask | {share_peers, diameter:remotes()} %% broadcast to | {use_shared_peers, diameter:remotes()} %% use from - | {restrict_connections, diameter:restriction()} - | {strict_mbit, boolean()} - | {string_decode, boolean()} - | {incoming_maxlen, diameter:message_length()}]}). + | {restrict_connections, diameter:restriction()}]}). %% shared_peers reflects the peers broadcast from remote nodes. %% Record representing an RFC 3539 watchdog process implemented by @@ -142,7 +138,7 @@ ref :: match(reference()), %% key into diameter_config options :: match([diameter:transport_opt()]),%% from start_transport state = ?WD_INITIAL :: match(wd_state()), - started = diameter_lib:now(),%% at process start + started = now(), %% at process start peer = false :: match(boolean() | pid())}). %% true at accepted, pid() at okay/reopen @@ -152,7 +148,7 @@ {pid :: pid(), apps :: [{0..16#FFFFFFFF, diameter:app_alias()}], %% {Id, Alias} caps :: #diameter_caps{}, - started = diameter_lib:now(), %% at process start + started = now(), %% at process start watchdog :: pid()}). %% key into watchdogT %% --------------------------------------------------------------------------- @@ -262,22 +258,16 @@ %% --------------------------------------------------------------------------- -spec pick_peer(SvcName, AppOrAlias, Opts) - -> {{TPid, Caps, App}, Mask, SvcOpts} - | false %% no selection - | {error, no_service} + -> {{TPid, Caps, App}, Mask} + | false + | {error, term()} when SvcName :: diameter:service_name(), - AppOrAlias :: #diameter_app{} - | {alias, diameter:app_alias()}, - Opts :: {fun((Dict :: module()) -> [term()]), - diameter:peer_filter(), - Xtra :: list()}, + AppOrAlias :: {alias, diameter:app_alias()} | #diameter_app{}, + Opts :: tuple(), TPid :: pid(), Caps :: #diameter_caps{}, App :: #diameter_app{}, - Mask :: diameter:sequence(), - SvcOpts :: [diameter:service_opt()]. -%% Extract Mask in the returned tuple so that diameter_traffic doesn't -%% need to know about the ordering of SvcOpts used here. + Mask :: diameter:sequence(). pick_peer(SvcName, App, Opts) -> pick(lookup_state(SvcName), App, Opts). @@ -294,10 +284,10 @@ Opts) -> %% initial call from diameter:call/4 pick(S, find_outgoing_app(Alias, Apps), Opts); -pick(_, false = No, _) -> - No; +pick(_, false, _) -> + false; -pick(#state{options = [{_, Mask} | SvcOpts]} +pick(#state{options = [{_, Mask} | _]} = S, #diameter_app{module = ModX, dictionary = Dict} = App0, @@ -306,7 +296,7 @@ [_,_] = RealmAndHost = diameter_lib:eval([DestF, Dict]), case pick_peer(App, RealmAndHost, Filter, S) of {TPid, Caps} -> - {{TPid, Caps, App}, Mask, SvcOpts}; + {{TPid, Caps, App}, Mask}; false = No -> No end. @@ -620,9 +610,8 @@ %% st/3 st(#watchdog{pid = Pid}, Reason, Acc) -> - MRef = monitor(process, Pid), Pid ! {shutdown, self(), Reason}, - [MRef | Acc]. + [Pid | Acc]. %% --------------------------------------------------------------------------- %% # call_service/2 @@ -697,10 +686,7 @@ {restrict_connections, proplists:get_value(restrict_connections, Opts, ?RESTRICT)}, - {spawn_opt, proplists:get_value(spawn_opt, Opts, [])}, - {string_decode, proplists:get_value(string_decode, Opts, true)}, - {incoming_maxlen, proplists:get_value(incoming_maxlen, Opts, 16#FFFFFF)}, - {strict_mbit, proplists:get_value(strict_mbit, Opts, true)}]. + {spawn_opt, proplists:get_value(spawn_opt, Opts, [])}]. %% The order of options is significant since we match against the list. mref(false = No) -> @@ -779,9 +765,8 @@ start(Ref, {T, Opts}, S) when T == connect; T == listen -> - N = proplists:get_value(pool_size, Opts, 1), try - {ok, start(Ref, type(T), Opts, N, S)} + {ok, start(Ref, type(T), Opts, S)} catch ?FAILURE(Reason) -> {error, Reason} @@ -799,44 +784,26 @@ %% start/4 -start(Ref, Type, Opts, State) -> - start(Ref, Type, Opts, 1, State). - -%% start/5 - -start(Ref, Type, Opts, N, #state{watchdogT = WatchdogT, - peerT = PeerT, - options = SvcOpts, - service_name = SvcName, - service = Svc0}) +start(Ref, Type, Opts, #state{watchdogT = WatchdogT, + peerT = PeerT, + options = SvcOpts, + service_name = SvcName, + service = Svc0}) when Type == connect; Type == accept -> #diameter_service{applications = Apps} - = Svc1 + = Svc = merge_service(Opts, Svc0), - Svc = binary_caps(Svc1, proplists:get_value(string_decode, SvcOpts, true)), - RecvData = diameter_traffic:make_recvdata([SvcName, - PeerT, - Apps, - SvcOpts]), - T = {{spawn_opts([Opts, SvcOpts]), RecvData}, Opts, SvcOpts, Svc}, - Rec = #watchdog{type = Type, - ref = Ref, - options = Opts}, - diameter_lib:fold_n(fun(_,A) -> - [wd(Type, Ref, T, WatchdogT, Rec) | A] - end, - [], - N). - -binary_caps(Svc, true) -> - Svc; -binary_caps(#diameter_service{capabilities = Caps} = Svc, false) -> - Svc#diameter_service{capabilities = diameter_capx:binary_caps(Caps)}. - -wd(Type, Ref, T, WatchdogT, Rec) -> - Pid = start_watchdog(Type, Ref, T), - insert(WatchdogT, Rec#watchdog{pid = Pid}), + {_,_} = Mask = proplists:get_value(sequence, SvcOpts), + RecvData = diameter_traffic:make_recvdata([SvcName, PeerT, Apps, Mask]), + Pid = s(Type, Ref, {{spawn_opts([Opts, SvcOpts]), RecvData}, + Opts, + SvcOpts, + Svc}), + insert(WatchdogT, #watchdog{pid = Pid, + type = Type, + ref = Ref, + options = Opts}), Pid. %% Note that the service record passed into the watchdog is the merged @@ -849,7 +816,7 @@ T /= link, T /= monitor]. -start_watchdog(Type, Ref, T) -> +s(Type, Ref, T) -> {_MRef, Pid} = diameter_watchdog:start({Type, Ref}, T), Pid. @@ -870,7 +837,7 @@ %% The fact that all capabilities can be configured on the transports %% means that the service doesn't necessarily represent a single -%% locally implemented Diameter node as identified by Origin-Host: a +%% locally implemented Diameter peer as identified by Origin-Host: a %% transport can configure its own Origin-Host. This means that the %% service little more than a placeholder for default capabilities %% plus a list of applications that individual transports can choose @@ -1218,7 +1185,7 @@ %% continuous restarted in case of faulty config or other problems. tc(Time, Tc) -> choose(Tc > ?RESTART_TC - orelse diameter_lib:micro_diff(Time) > 1000*?RESTART_TC, + orelse timer:now_diff(now(), Time) > 1000*?RESTART_TC, Tc, ?RESTART_TC). @@ -1493,52 +1460,42 @@ peers(Alias, RH, Filter, Peers) -> case ?Dict:find(Alias, Peers) of {ok, L} -> - filter(L, RH, Filter); + ps(L, RH, Filter, {[],[]}); error -> [] end. -%% filter/3 -%% -%% Return peers in match order. - -filter(Peers, RH, Filter) -> - {Ts, _} = fltr(Peers, RH, Filter), - Ts. +%% Place a peer whose Destination-Host/Realm matches those of the +%% request at the front of the result list. Could add some sort of +%% 'sort' option to allow more control. + +ps([], _, _, {Ys, Ns}) -> + lists:reverse(Ys, Ns); +ps([{_TPid, #diameter_caps{} = Caps} = TC | Rest], RH, Filter, Acc) -> + ps(Rest, RH, Filter, pacc(caps_filter(Caps, RH, Filter), + caps_filter(Caps, RH, {all, [host, realm]}), + TC, + Acc)). + +pacc(true, true, Peer, {Ts, Fs}) -> + {[Peer|Ts], Fs}; +pacc(true, false, Peer, {Ts, Fs}) -> + {Ts, [Peer|Fs]}; +pacc(_, _, _, Acc) -> + Acc. -%% fltr/4 - -fltr(Peers, _, none) -> - {Peers, []}; +%% caps_filter/3 -fltr(Peers, RH, {neg, F}) -> - {Ts, Fs} = fltr(Peers, RH, F), - {Fs, Ts}; +caps_filter(C, RH, {neg, F}) -> + not caps_filter(C, RH, F); -fltr(Peers, RH, {all, L}) +caps_filter(C, RH, {all, L}) when is_list(L) -> - lists:foldl(fun(F,A) -> fltr_all(F, A, RH) end, - {Peers, []}, - L); + lists:all(fun(F) -> caps_filter(C, RH, F) end, L); -fltr(Peers, RH, {any, L}) +caps_filter(C, RH, {any, L}) when is_list(L) -> - lists:foldl(fun(F,A) -> fltr_any(F, A, RH) end, - {[], Peers}, - L); - -fltr(Peers, RH, F) -> - lists:partition(fun({_,C}) -> caps_filter(C, RH, F) end, Peers). - -fltr_all(F, {Ts0, Fs0}, RH) -> - {Ts1, Fs1} = fltr(Ts0, RH, F), - {Ts1, Fs0 ++ Fs1}. - -fltr_any(F, {Ts0, Fs0}, RH) -> - {Ts1, Fs1} = fltr(Fs0, RH, F), - {Ts0 ++ Ts1, Fs1}. - -%% caps_filter/3 + lists:any(fun(F) -> caps_filter(C, RH, F) end, L); caps_filter(#diameter_caps{origin_host = {_,OH}}, [_,DH], host) -> eq(undefined, DH, OH); @@ -1551,6 +1508,9 @@ %% caps_filter/2 +caps_filter(_, none) -> + true; + caps_filter(#diameter_caps{origin_host = {_,OH}}, {host, H}) -> eq(any, H, OH); @@ -1751,43 +1711,31 @@ [], PeerD). -%% Single config entry. Distinguish between pool_size config or not on -%% a connecting transport for backwards compatibility: with the option -%% the form is similar to the listening case, with connections grouped -%% in a pool tuple (for lack of a better name), without as before. -transport([[{type, Type}, {options, Opts}] = L]) - when Type == listen; - Type == connect -> - L ++ [{K, []} || [{_,K}] <- [keys(Type, Opts)]]; +%% Only a config entry for a listening transport: use it. +transport([[{type, listen}, _] = L]) -> + L ++ [{accept, []}]; + +%% Only one config or peer entry for a connecting transport: use it. +transport([[{type, connect} | _] = L]) -> + L; %% Peer entries: discard config. Note that the peer entries have %% length at least 3. transport([[_,_] | L]) -> transport(L); -%% Multiple tranports. Note that all have the same options by -%% construction, which is not terribly space efficient. -transport([[{type, Type}, {options, Opts} | _] | _] = Ls) -> - transport(keys(Type, Opts), Ls). - -%% Group transports in an accept or pool tuple ... -transport([{Type, Key}], [[{type, _}, {options, Opts} | _] | _] = Ls) -> - [{type, Type}, +%% Possibly many peer entries for a listening transport. Note that all +%% have the same options by construction, which is not terribly space +%% efficient. +transport([[{type, accept}, {options, Opts} | _] | _] = Ls) -> + [{type, listen}, {options, Opts}, - {Key, [tl(tl(L)) || L <- Ls]}]; - -%% ... or not: there can only be one. -transport([], [L]) -> - L. - -keys(connect = T, Opts) -> - [{T, pool} || lists:keymember(pool_size, 1, Opts)]; -keys(_, _) -> - [{listen, accept}]. + {accept, [lists:nthtail(2,L) || L <- Ls]}]. peer_dict(#state{watchdogT = WatchdogT, peerT = PeerT}, Dict0) -> try ets:tab2list(WatchdogT) of - L -> lists:foldl(fun(T,A) -> peer_acc(PeerT, A, T) end, Dict0, L) + L -> + lists:foldl(fun(T,A) -> peer_acc(PeerT, A, T) end, Dict0, L) catch error: badarg -> Dict0 %% service has gone down end. diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_service_sup.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_service_sup.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_service_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_service_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -59,7 +58,7 @@ ChildSpec = {Mod, {Mod, start_link, []}, temporary, - 5000, + 1000, worker, [Mod]}, {ok, {Flags, [ChildSpec]}}. diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_session.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_session.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_session.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_session.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -158,8 +157,8 @@ %% --------------------------------------------------------------------------- init() -> - {Now, Seed} = diameter_lib:seed(), - random:seed(Seed), + Now = now(), + random:seed(Now), Time = time32(Now), Seq = (?INT32 band (Time bsl 20)) bor (random:uniform(1 bsl 20) - 1), ets:insert(diameter_sequence, [{origin_state_id, Time}, diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_stats.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_stats.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_stats.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_stats.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,6 +22,7 @@ %% -module(diameter_stats). + -behaviour(gen_server). -export([reg/2, reg/1, @@ -58,7 +58,7 @@ -define(SERVER, ?MODULE). %% Server state. --record(state, {id = diameter_lib:now()}). +-record(state, {id = now()}). -type counter() :: any(). -type ref() :: any(). @@ -140,14 +140,9 @@ L. to_refdict(L) -> - lists:foldl(fun append/2, orddict:new(), L). - -%% Order both references and counters in the returned list. -append({{Ctr, Ref}, N}, Dict) -> - orddict:update(Ref, - fun(D) -> orddict:store(Ctr, N, D) end, - [{Ctr, N}], - Dict). + lists:foldl(fun({{C,R}, N}, D) -> orddict:append(R, {C,N}, D) end, + orddict:new(), + L). %% --------------------------------------------------------------------------- %% # sum(Refs) @@ -223,7 +218,7 @@ %% ---------------------------------------------------------- init([]) -> - ets:new(?TABLE, [named_table, set, public, {write_concurrency, true}]), + ets:new(?TABLE, [named_table, ordered_set, public]), {ok, #state{}}. %% ---------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_sup.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_sup.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -65,7 +64,7 @@ {Mod, {Mod, start_link, []}, permanent, - infinity, + 1000, supervisor, [Mod]}. diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_sync.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_sync.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_sync.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_sync.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -70,7 +69,7 @@ %% Server state. -record(state, - {time = diameter_lib:now(), + {time = now(), pending = 0 :: non_neg_integer(), %% outstanding requests monitor = new() :: ets:tid(), %% MonitorRef -> {Name, From} queue = new() :: ets:tid()}). %% Name -> queue of {Pid, Ref} diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_traffic.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_traffic.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_traffic.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_traffic.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -78,13 +77,7 @@ {peerT :: ets:tid(), service_name :: diameter:service_name(), apps :: [#diameter_app{}], - sequence :: diameter:sequence(), - codec :: [{string_decode, boolean()} - | {strict_mbit, boolean()} - | {incoming_maxlen, diameter:message_length()}]}). -%% Note that incoming_maxlen is currently handled in diameter_peer_fsm, -%% so that any message exceeding the maximum is discarded. Retain the -%% option in case we want to extend the values and semantics. + sequence :: diameter:sequence()}). %% Record stored in diameter_request for each outgoing request. -record(request, @@ -99,16 +92,11 @@ %% # make_recvdata/1 %% --------------------------------------------------------------------------- -make_recvdata([SvcName, PeerT, Apps, SvcOpts | _]) -> - {_,_} = Mask = proplists:get_value(sequence, SvcOpts), +make_recvdata([SvcName, PeerT, Apps, Mask | _]) -> #recvdata{service_name = SvcName, peerT = PeerT, apps = Apps, - sequence = Mask, - codec = [T || {K,_} = T <- SvcOpts, - lists:member(K, [string_decode, - incoming_maxlen, - strict_mbit])]}. + sequence = Mask}. %% --------------------------------------------------------------------------- %% peer_up/1 @@ -131,11 +119,11 @@ %% incr/4 %% --------------------------------------------------------------------------- -incr(Dir, #diameter_packet{header = H}, TPid, AppDict) -> - incr(Dir, H, TPid, AppDict); +incr(Dir, #diameter_packet{header = H}, TPid, Dict) -> + incr(Dir, H, TPid, Dict); -incr(Dir, #diameter_header{} = H, TPid, AppDict) -> - incr(TPid, {msg_id(H, AppDict), Dir}). +incr(Dir, #diameter_header{} = H, TPid, Dict) -> + incr(TPid, {msg_id(H, Dict), Dir}). %% --------------------------------------------------------------------------- %% incr_error/4 @@ -143,61 +131,55 @@ %% Identify messages using the application dictionary, not the encode %% dictionary, which may differ in the case of answer-message. -incr_error(Dir, T, Pid, {_MsgDict, AppDict}) -> +incr_error(Dir, T, Pid, {_Dict, AppDict}) -> incr_error(Dir, T, Pid, AppDict); %% Decoded message without errors. incr_error(recv, #diameter_packet{errors = []}, _, _) -> ok; -incr_error(recv = D, #diameter_packet{header = H}, TPid, AppDict) -> - incr_error(D, H, TPid, AppDict); +incr_error(recv = D, #diameter_packet{header = H}, TPid, Dict) -> + incr_error(D, H, TPid, Dict); %% Encoded message with errors and an identifiable header ... -incr_error(send = D, {_, _, #diameter_header{} = H}, TPid, AppDict) -> - incr_error(D, H, TPid, AppDict); +incr_error(send = D, {_, _, #diameter_header{} = H}, TPid, Dict) -> + incr_error(D, H, TPid, Dict); %% ... or not. incr_error(send = D, {_,_}, TPid, _) -> incr_error(D, unknown, TPid); -incr_error(Dir, #diameter_header{} = H, TPid, AppDict) -> - incr_error(Dir, msg_id(H, AppDict), TPid); +incr_error(Dir, #diameter_header{} = H, TPid, Dict) -> + incr_error(Dir, msg_id(H, Dict), TPid); incr_error(Dir, Id, TPid, _) -> incr_error(Dir, Id, TPid). incr_error(Dir, Id, TPid) -> incr(TPid, {Id, Dir, error}). - + %% --------------------------------------------------------------------------- %% incr_rc/4 %% --------------------------------------------------------------------------- --spec incr_rc(send|recv, Pkt, TPid, DictT) +-spec incr_rc(send|recv, Pkt, TPid, Dict0) -> {Counter, non_neg_integer()} | Reason when Pkt :: #diameter_packet{}, TPid :: pid(), - DictT :: module() | {MsgDict :: module(), - AppDict :: module(), - CommonDict:: module()}, + Dict0 :: module(), Counter :: {'Result-Code', integer()} | {'Experimental-Result', integer(), integer()}, Reason :: atom(). -incr_rc(Dir, Pkt, TPid, {_, AppDict, _} = DictT) -> +incr_rc(Dir, Pkt, TPid, Dict0) -> try - incr_result(Dir, Pkt, TPid, DictT) + incr_result(Dir, Pkt, TPid, {Dict0, Dict0, Dict0}) catch exit: {E,_} when E == no_result_code; E == invalid_error_bit -> - incr(TPid, {msg_id(Pkt#diameter_packet.header, AppDict), Dir, E}), E - end; - -incr_rc(Dir, Pkt, TPid, Dict0) -> - incr_rc(Dir, Pkt, TPid, {Dict0, Dict0, Dict0}). + end. %% --------------------------------------------------------------------------- %% pending/1 @@ -241,8 +223,6 @@ Dict0, RecvData). -%% recv/6 - %% Incoming request ... recv(true, false, TPid, Pkt, Dict0, T) -> spawn_request(TPid, Pkt, Dict0, T); @@ -250,7 +230,6 @@ %% ... answer to known request ... recv(false, #request{ref = Ref, handler = Pid} = Req, _, Pkt, Dict0, _) -> Pid ! {answer, Ref, Req, Dict0, Pkt}; - %% Note that failover could have happened prior to this message being %% received and triggering failback. That is, both a failover message %% and answer may be on their way to the handler process. In the worst @@ -261,9 +240,7 @@ %% any others are discarded. %% ... or not. -recv(false, false, TPid, Pkt, _, _) -> - ?LOG(discarded, Pkt#diameter_packet.header), - incr(TPid, {{unknown, 0}, recv, discarded}), +recv(false, false, _, _, _, _) -> ok. %% spawn_request/4 @@ -289,11 +266,8 @@ #diameter_packet{header = #diameter_header{application_id = Id}} = Pkt, Dict0, - #recvdata{peerT = PeerT, - apps = Apps, - codec = Opts} + #recvdata{peerT = PeerT, apps = Apps} = RecvData) -> - diameter_codec:setopts([{common_dictionary, Dict0} | Opts]), send_A(recv_R(diameter_service:find_incoming_app(PeerT, TPid, Id, Apps), TPid, Pkt, @@ -305,14 +279,14 @@ %% recv_R/5 -recv_R({#diameter_app{id = Id, dictionary = AppDict} = App, Caps}, +recv_R({#diameter_app{id = Id, dictionary = Dict} = App, Caps}, TPid, Pkt0, Dict0, RecvData) -> - incr(recv, Pkt0, TPid, AppDict), - Pkt = errors(Id, diameter_codec:decode(Id, AppDict, Pkt0)), - incr_error(recv, Pkt, TPid, AppDict), + incr(recv, Pkt0, TPid, Dict), + Pkt = errors(Id, diameter_codec:decode(Id, Dict, Pkt0)), + incr_error(recv, Pkt, TPid, Dict), {Caps, Pkt, App, recv_R(App, TPid, Dict0, Caps, RecvData, Pkt)}; %% Note that the decode is different depending on whether or not Id is %% ?APP_ID_RELAY. @@ -520,17 +494,14 @@ %% send_A/6 -send_A(T, TPid, {AppDict, Dict0} = DictT0, ReqPkt, EvalPktFs, EvalFs) -> - {MsgDict, Pkt} = reply(T, TPid, DictT0, EvalPktFs, ReqPkt), - incr(send, Pkt, TPid, AppDict), - incr_rc(send, Pkt, TPid, {MsgDict, AppDict, Dict0}), %% count outgoing - send(TPid, Pkt), +send_A(T, TPid, DictT, ReqPkt, EvalPktFs, EvalFs) -> + reply(T, TPid, DictT, EvalPktFs, ReqPkt), lists:foreach(fun diameter_lib:eval/1, EvalFs). %% answer/6 answer({reply, Ans}, _Caps, _Pkt, App, Dict0, _RecvData) -> - {msg_dict(App#diameter_app.dictionary, Dict0, Ans), Ans}; + {dict(App#diameter_app.dictionary, Dict0, Ans), Ans}; answer({call, Opts}, Caps, Pkt, App, Dict0, RecvData) -> #diameter_caps{origin_host = {OH,_}} @@ -553,37 +524,27 @@ orelse ?ERROR({invalid_return, T, handle_request, App}), answer_message(RC, Caps, Dict0, Pkt). -%% msg_dict/3 -%% -%% Return the dictionary defining the message grammar in question: the -%% application dictionary or the common dictionary. +%% dict/3 -msg_dict(AppDict, Dict0, [Msg]) - when is_list(Msg); - is_tuple(Msg) -> - msg_dict(AppDict, Dict0, Msg); - -msg_dict(AppDict, Dict0, Msg) -> - choose(is_answer_message(Msg, Dict0), Dict0, AppDict). +%% An incoming answer, not yet decoded. +dict(Dict, Dict0, #diameter_packet{header + = #diameter_header{is_request = false, + is_error = E}, + msg = undefined}) -> + if E -> Dict0; true -> Dict end; -%% Incoming, not yet decoded. -is_answer_message(#diameter_packet{header = #diameter_header{} = H, - msg = undefined}, - Dict0) -> - is_answer_message([H], Dict0); +dict(Dict, Dict0, [Msg]) -> + dict(Dict, Dict0, Msg); -is_answer_message(#diameter_packet{msg = Msg}, Dict0) -> - is_answer_message(Msg, Dict0); +dict(Dict, Dict0, #diameter_packet{msg = Msg}) -> + dict(Dict, Dict0, Msg); -%% Message sent as a header/avps list. -is_answer_message([#diameter_header{is_request = R, is_error = E} | _], _) -> - E andalso not R; +dict(Dict, Dict0, Msg) -> + choose(is_answer_message(Msg, Dict0), Dict0, Dict). -%% Message sent as a tagged avp/value list. is_answer_message([Name | _], _) -> Name == 'answer-message'; -%% Message sent as a record. is_answer_message(Rec, Dict) -> try 'answer-message' == Dict:rec2msg(element(1,Rec)) @@ -631,7 +592,7 @@ Route = #diameter_avp{data = {Dict0, 'Route-Record', OH}}, Seq = diameter_session:sequence(Mask), Hdr = Hdr0#diameter_header{hop_by_hop_id = Seq}, - Msg = [Hdr, Route | Avps], %% reordered at encode + Msg = [Hdr, Route | Avps], resend(send_request(SvcName, App, Msg, Opts), Caps, Dict0, Pkt). %% The incoming request is relayed with the addition of a %% Route-Record. Note the requirement on the return from call/4 below, @@ -653,7 +614,7 @@ %% %% Relay a reply to a relayed request. -%% Answer from the peer: reset the hop by hop identifier. +%% Answer from the peer: reset the hop by hop identifier and send. resend(#diameter_packet{bin = B} = Pkt, _Caps, @@ -692,13 +653,13 @@ %% reply/5 %% Local answer ... -reply({MsgDict, Ans}, TPid, {AppDict, Dict0}, Fs, ReqPkt) -> - local(Ans, TPid, {MsgDict, AppDict, Dict0}, Fs, ReqPkt); +reply({Dict, Ans}, TPid, {AppDict, Dict0}, Fs, ReqPkt) -> + local(Ans, TPid, {Dict, AppDict, Dict0}, Fs, ReqPkt); %% ... or relayed. -reply(#diameter_packet{} = Pkt, _TPid, {AppDict, Dict0}, Fs, _ReqPkt) -> +reply(#diameter_packet{} = Pkt, TPid, _Dict0, Fs, _ReqPkt) -> eval_packet(Pkt, Fs), - {msg_dict(AppDict, Dict0, Pkt), Pkt}. + send(TPid, Pkt). %% local/5 %% @@ -711,12 +672,14 @@ is_tuple(Msg) -> local(Msg, TPid, DictT, Fs, ReqPkt#diameter_packet{errors = []}); -local(Msg, TPid, {MsgDict, AppDict, Dict0}, Fs, ReqPkt) -> - Pkt = encode({MsgDict, AppDict}, +local(Msg, TPid, {Dict, AppDict, Dict0} = DictT, Fs, ReqPkt) -> + Pkt = encode({Dict, AppDict}, TPid, - reset(make_answer_packet(Msg, ReqPkt), MsgDict, Dict0), + reset(make_answer_packet(Msg, ReqPkt), Dict, Dict0), Fs), - {MsgDict, Pkt}. + incr(send, Pkt, TPid, AppDict), + incr_result(send, Pkt, TPid, DictT), %% count outgoing + send(TPid, Pkt). %% reset/3 @@ -989,8 +952,8 @@ session_id(Code, Vid, Dict0, Avps) when is_list(Avps) -> try - #diameter_avp{data = Bin} = find_avp(Code, Vid, Avps), - [{'Session-Id', [Dict0:avp(decode, Bin, 'Session-Id')]}] + {value, #diameter_avp{data = D}} = find_avp(Code, Vid, Avps), + [{'Session-Id', [Dict0:avp(decode, D, 'Session-Id')]}] catch error: _ -> [] @@ -1007,17 +970,26 @@ %% find_avp/3 -%% Grouped ... -find_avp(Code, VId, [[#diameter_avp{code = Code, vendor_id = VId} | _] = As - | _]) -> - As; - -%% ... or not. -find_avp(Code, VId, [#diameter_avp{code = Code, vendor_id = VId} = A | _]) -> - A; +find_avp(Code, Vid, Avps) + when is_integer(Code), (undefined == Vid orelse is_integer(Vid)) -> + find(fun(A) -> is_avp(Code, Vid, A) end, Avps). + +%% The final argument here could be a list of AVP's, depending on the case, +%% but we're only searching at the top level. +is_avp(Code, Vid, #diameter_avp{code = Code, vendor_id = Vid}) -> + true; +is_avp(_, _, _) -> + false. -find_avp(Code, VId, [_ | Avps]) -> - find_avp(Code, VId, Avps). +find(_, []) -> + false; +find(Pred, [H|T]) -> + case Pred(H) of + true -> + {value, H}; + false -> + find(Pred, T) + end. %% 7. Error Handling %% @@ -1076,74 +1048,58 @@ %% Increment a stats counter for result codes in incoming and outgoing %% answers. -%% Message sent as a header/avps list. -incr_result(send = Dir, - #diameter_packet{msg = [#diameter_header{} = H | _]} - = Pkt, - TPid, - DictT) -> - incr_res(Dir, Pkt#diameter_packet{header = H}, TPid, DictT); - %% Outgoing message as binary: don't count. (Sending binaries is only %% partially supported.) -incr_result(send, #diameter_packet{header = undefined = No}, _, _) -> +incr_result(_, #diameter_packet{msg = undefined = No}, _, _) -> No; %% Incoming or outgoing. Outgoing with encode errors never gets here %% since encode fails. -incr_result(Dir, Pkt, TPid, DictT) -> - incr_res(Dir, Pkt, TPid, DictT). - -incr_res(Dir, - #diameter_packet{header = #diameter_header{is_error = E} - = Hdr, - errors = Es} - = Pkt, - TPid, - DictT) -> - {MsgDict, AppDict, Dict0} = DictT, +incr_result(Dir, Pkt, TPid, {Dict, AppDict, Dict0}) -> + #diameter_packet{header = #diameter_header{is_error = E} + = Hdr, + msg = Msg, + errors = Es} + = Pkt, Id = msg_id(Hdr, AppDict), - %% Could be {relay, 0}, in which case the R-bit is redundant since - %% only answers are being counted. Let it be however, so that the - %% same tuple is in both send/recv and result code counters. %% Count incoming decode errors. recv /= Dir orelse [] == Es orelse incr_error(Dir, Id, TPid, AppDict), %% Exit on a missing result code. - T = rc_counter(MsgDict, Dir, Pkt), - T == false andalso ?LOGX(no_result_code, {MsgDict, Dir, Hdr}), - {Ctr, RC, Avp} = T, + T = rc_counter(Dict, Msg), + T == false andalso ?LOGX(no_result_code, {Dict, Dir, Hdr}), + {Ctr, RC} = T, %% Or on an inappropriate value. is_result(RC, E, Dict0) - orelse ?LOGX(invalid_error_bit, {MsgDict, Dir, Hdr, Avp}), + orelse ?LOGX(invalid_error_bit, {Dict, Dir, Hdr, RC}), incr(TPid, {Id, Dir, Ctr}), Ctr. %% msg_id/2 -msg_id(#diameter_packet{header = H}, AppDict) -> - msg_id(H, AppDict); +msg_id(#diameter_packet{header = H}, Dict) -> + msg_id(H, Dict); %% Only count on known keys so as not to be vulnerable to attack: %% there are 2^32 (application ids) * 2^24 (command codes) = 2^56 %% pairs for an attacker to choose from. -msg_id(Hdr, AppDict) -> - {Aid, Code, R} = Id = diameter_codec:msg_id(Hdr), - case AppDict:id() of - ?APP_ID_RELAY -> - {relay, R}; - A -> - unknown(A /= Aid orelse '' == AppDict:msg_name(Code, 0 == R), Id) +msg_id(Hdr, Dict) -> + {_ApplId, Code, R} = Id = diameter_codec:msg_id(Hdr), + case Dict:msg_name(Code, 0 == R) of + '' -> + unknown(Dict:id(), R); + _ -> + Id end. -unknown(true, {_, _, R}) -> - {unknown, R}; -unknown(false, Id) -> - Id. +unknown(?APP_ID_RELAY, R) -> + {relay, R}; +unknown(_, _) -> + unknown. %% No E-bit: can't be 3xxx. is_result(RC, false, _Dict0) -> @@ -1164,7 +1120,7 @@ incr(TPid, Counter) -> diameter_stats:incr(Counter, TPid, 1). -%% rc_counter/3 +%% rc_counter/2 %% RFC 3588, 7.6: %% @@ -1172,49 +1128,39 @@ %% applications MUST include either one Result-Code AVP or one %% Experimental-Result AVP. -rc_counter(Dict, Dir, #diameter_packet{header = H, - avps = As, - msg = Msg}) - when Dir == recv; %% decoded incoming - Msg == undefined -> %% relayed outgoing - rc_counter(Dict, [H|As]); - -rc_counter(Dict, _, #diameter_packet{msg = Msg}) -> - rc_counter(Dict, Msg). - rc_counter(Dict, Msg) -> - rcc(get_result(Dict, Msg)). + rcc(Dict, Msg, int(get_avp_value(Dict, 'Result-Code', Msg))). -rcc(#diameter_avp{name = 'Result-Code' = Name, value = N} = A) - when is_integer(N) -> - {{Name, N}, N, A}; +rcc(Dict, Msg, undefined) -> + rcc(get_avp_value(Dict, 'Experimental-Result', Msg)); -rcc(#diameter_avp{name = 'Result-Code' = Name, value = [N|_]} = A) +rcc(_, _, N) when is_integer(N) -> - {{Name, N}, N, A}; + {{'Result-Code', N}, N}. -rcc(#diameter_avp{name = 'Experimental-Result', value = {_,_,N} = T} = A) - when is_integer(N) -> - {T, N, A}; +%% Outgoing answers may be in any of the forms messages can be sent +%% in. Incoming messages will be records. We're assuming here that the +%% arity of the result code AVP's is 0 or 1. -rcc(#diameter_avp{name = 'Experimental-Result', value = [{_,_,N} = T|_]} = A) +rcc([{_,_,N} = T | _]) when is_integer(N) -> - {T, N, A}; - + {T,N}; +rcc({_,_,N} = T) + when is_integer(N) -> + {T,N}; rcc(_) -> false. -%% get_result/2 - -get_result(Dict, Msg) -> - try - [throw(A) || N <- ['Result-Code', 'Experimental-Result'], - #diameter_avp{} = A <- [get_avp(Dict, N, Msg)]] - of - [] -> false - catch - #diameter_avp{} = A -> A - end. +%% Extract the first good looking integer. There's no guarantee +%% that what we're looking for has arity 1. +int([N|_]) + when is_integer(N) -> + N; +int(N) + when is_integer(N) -> + N; +int(_) -> + undefined. x(T) -> exit(T). @@ -1275,9 +1221,10 @@ send_R(SvcName, AppOrAlias, Msg, Opts, Caller) -> case pick_peer(SvcName, AppOrAlias, Msg, Opts) of - {Transport, Mask, SvcOpts} -> - diameter_codec:setopts(SvcOpts), + {{_,_,_} = Transport, Mask} -> send_request(Transport, Mask, Msg, Opts, Caller, SvcName); + false -> + {error, no_connection}; {error, _} = No -> No end. @@ -1339,8 +1286,6 @@ SvcName, []). -%% send_R/7 - send_R({send, Msg}, Pkt, Transport, Opts, Caller, SvcName, Fs) -> send_R(make_request_packet(Msg, Pkt), Transport, @@ -1443,21 +1388,6 @@ make_request_packet(Msg, Pkt) -> Pkt#diameter_packet{msg = Msg}. -%% make_retransmit_packet/2 - -make_retransmit_packet(#diameter_packet{msg = [#diameter_header{} = Hdr - | Avps]} - = Pkt) -> - Pkt#diameter_packet{msg = [make_retransmit_header(Hdr) | Avps]}; - -make_retransmit_packet(#diameter_packet{header = Hdr} = Pkt) -> - Pkt#diameter_packet{header = make_retransmit_header(Hdr)}. - -%% make_retransmit_header/1 - -make_retransmit_header(Hdr) -> - Hdr#diameter_header{is_retransmitted = true}. - %% fold_record/2 fold_record(undefined, R) -> @@ -1468,12 +1398,12 @@ %% send_R/6 send_R(Pkt0, - {TPid, Caps, #diameter_app{dictionary = AppDict} = App}, + {TPid, Caps, #diameter_app{dictionary = Dict} = App}, Opts, {Pid, Ref}, SvcName, Fs) -> - Pkt = encode(AppDict, TPid, Pkt0, Fs), + Pkt = encode(Dict, TPid, Pkt0, Fs), #options{timeout = Timeout} = Opts, @@ -1485,12 +1415,16 @@ caps = Caps, packet = Pkt0}, - incr(send, Pkt, TPid, AppDict), - TRef = send_request(TPid, Pkt, Req, SvcName, Timeout), - Pid ! Ref, %% tell caller a send has been attempted - handle_answer(SvcName, - App, - recv_A(Timeout, SvcName, App, Opts, {TRef, Req})). + try + incr(send, Pkt, TPid, Dict), + TRef = send_request(TPid, Pkt, Req, SvcName, Timeout), + Pid ! Ref, %% tell caller a send has been attempted + handle_answer(SvcName, + App, + recv_A(Timeout, SvcName, App, Opts, {TRef, Req})) + after + erase_requests(Pkt) + end. %% recv_A/5 @@ -1522,10 +1456,10 @@ id = Id} = App, {answer, Req, Dict0, Pkt}) -> - MsgDict = msg_dict(AppDict, Dict0, Pkt), - handle_A(errors(Id, diameter_codec:decode({MsgDict, AppDict}, Pkt)), + Dict = dict(AppDict, Dict0, Pkt), + handle_A(errors(Id, diameter_codec:decode({Dict, AppDict}, Pkt)), SvcName, - MsgDict, + Dict, Dict0, App, Req). @@ -1550,10 +1484,10 @@ %% a missing AVP. If both are optional in the dictionary %% then this isn't a decode error: just continue on. answer(Pkt, SvcName, App, Req); - exit: {invalid_error_bit, {_, _, _, Avp}} -> + exit: {invalid_error_bit, RC} -> #diameter_packet{errors = Es} = Pkt, - E = {5004, Avp}, + E = {5004, #diameter_avp{name = 'Result-Code', value = RC}}, answer(Pkt#diameter_packet{errors = [E|Es]}, SvcName, App, Req) end. @@ -1597,9 +1531,7 @@ %% timer value is ignored. This means that an answer could be accepted %% from a peer after timeout in the case of failover. -%% retransmit/5 - -retransmit({{_,_,App} = Transport, _, _}, Req, Opts, SvcName, Timeout) -> +retransmit({{_,_,App} = Transport, _Mask}, Req, Opts, SvcName, Timeout) -> try retransmit(Transport, Req, SvcName, Timeout) of T -> recv_A(Timeout, SvcName, App, Opts, T) catch @@ -1620,23 +1552,17 @@ pick_peer(SvcName, App, Msg, Opts#options{extra = []}); pick_peer(_, _, undefined, _) -> - {error, no_connection}; + false; pick_peer(SvcName, AppOrAlias, Msg, #options{filter = Filter, extra = Xtra}) -> - pick(diameter_service:pick_peer(SvcName, - AppOrAlias, - {fun(D) -> get_destination(D, Msg) end, - Filter, - Xtra})). - -pick(false) -> - {error, no_connection}; - -pick(T) -> - T. + diameter_service:pick_peer(SvcName, + AppOrAlias, + {fun(D) -> get_destination(D, Msg) end, + Filter, + Xtra}). %% handle_error/4 @@ -1690,18 +1616,9 @@ send_request(TPid, #diameter_packet{bin = Bin} = Pkt, Req, _SvcName, Timeout) when node() == node(TPid) -> - Seqs = diameter_codec:sequence_numbers(Bin), - TRef = erlang:start_timer(Timeout, self(), TPid), - Entry = {Seqs, Req, TRef}, - - %% Ensure that request table is cleaned even if we receive an exit - %% signal. An alternative would be to simply trap exits, but - %% callbacks are applied in this process, and these could possibly - %% be expecting the prevailing behaviour. - Self = self(), - spawn(fun() -> diameter_lib:wait([Self]), erase_request(Entry) end), - - store_request(Entry, TPid), + %% Store the outgoing request before sending to avoid a race with + %% reply reception. + TRef = store_request(TPid, Bin, Req, Timeout), send(TPid, Pkt), TRef; @@ -1715,34 +1632,25 @@ %% send/1 -send({TPid, Pkt, #request{handler = Pid} = Req0, SvcName, Timeout, TRef}) -> - Req = Req0#request{handler = self()}, - recv(TPid, Pid, TRef, send_request(TPid, Pkt, Req, SvcName, Timeout)). - -%% recv/4 -%% -%% Relay an answer from a remote node. - -recv(TPid, Pid, TRef, LocalTRef) -> +send({TPid, Pkt, #request{handler = Pid} = Req, SvcName, Timeout, TRef}) -> + Ref = send_request(TPid, + Pkt, + Req#request{handler = self()}, + SvcName, + Timeout), receive {answer, _, _, _, _} = A -> Pid ! A; - {failover = T, LocalTRef} -> + {failover = T, Ref} -> Pid ! {T, TRef}; T -> - exit({timeout, LocalTRef, TPid} = T) + exit({timeout, Ref, TPid} = T) end. %% send/2 -send(Pid, Pkt) -> %% Strip potentially large message terms. - #diameter_packet{header = H, - bin = Bin, - transport_data = T} - = Pkt, - Pid ! {send, #diameter_packet{header = H, - bin = Bin, - transport_data = T}}. +send(Pid, Pkt) -> + Pid ! {send, Pkt}. %% retransmit/4 @@ -1755,7 +1663,9 @@ have_request(Pkt0, TPid) %% Don't failover to a peer we've andalso ?THROW(timeout), %% already sent to. - Pkt = make_retransmit_packet(Pkt0), + #diameter_packet{header = Hdr0} = Pkt0, + Hdr = Hdr0#diameter_header{is_retransmitted = true}, + Pkt = Pkt0#diameter_packet{header = Hdr}, retransmit(cb(App, prepare_retransmit, [Pkt, SvcName, {TPid, Caps}]), Transport, @@ -1791,37 +1701,33 @@ ?ERROR({invalid_return, T, prepare_retransmit, App}). resend_request(Pkt0, - {TPid, Caps, #diameter_app{dictionary = AppDict}}, + {TPid, Caps, #diameter_app{dictionary = Dict}}, Req0, SvcName, Tmo, Fs) -> - Pkt = encode(AppDict, TPid, Pkt0, Fs), + Pkt = encode(Dict, TPid, Pkt0, Fs), Req = Req0#request{transport = TPid, packet = Pkt0, caps = Caps}, ?LOG(retransmission, Pkt#diameter_packet.header), - incr(TPid, {msg_id(Pkt, AppDict), send, retransmission}), + incr(TPid, {msg_id(Pkt, Dict), send, retransmission}), TRef = send_request(TPid, Pkt, Req, SvcName, Tmo), {TRef, Req}. -%% store_request/2 +%% store_request/4 -store_request(T, TPid) -> - ets:insert(?REQUEST_TABLE, T), +store_request(TPid, Bin, Req, Timeout) -> + Seqs = diameter_codec:sequence_numbers(Bin), + TRef = erlang:start_timer(Timeout, self(), TPid), + ets:insert(?REQUEST_TABLE, {Seqs, Req, TRef}), ets:member(?REQUEST_TABLE, TPid) - orelse begin - {_Seqs, _Req, TRef} = T, - (self() ! {failover, TRef}) %% failover/1 may have missed - end. + orelse (self() ! {failover, TRef}), %% failover/1 may have missed + TRef. %% lookup_request/2 -%% -%% Note the match on both the key and transport pid. The latter is -%% necessary since the same Hop-by-Hop and End-to-End identifiers are -%% reused in the case of retransmission. lookup_request(Msg, TPid) -> Seqs = diameter_codec:sequence_numbers(Msg), @@ -1835,10 +1741,10 @@ false end. -%% erase_request/1 +%% erase_requests/1 -erase_request(T) -> - ets:delete_object(?REQUEST_TABLE, T). +erase_requests(Pkt) -> + ets:delete(?REQUEST_TABLE, diameter_codec:sequence_numbers(Pkt)). %% match_requests/1 @@ -1861,7 +1767,7 @@ when is_pid(TPid) -> lists:foreach(fun failover/1, match_requests(TPid)); %% Note that a request process can store its request after failover -%% notifications are sent here: store_request/2 sends the notification +%% notifications are sent here: store_request/4 sends the notification %% in that case. %% Failover as a consequence of request_peer_down/1: inform the @@ -1890,7 +1796,7 @@ str(T) -> T. -%% get_avp/3 +%% get_avp_value/3 %% %% Find an AVP in a message of one of three forms: %% @@ -1907,71 +1813,47 @@ %% look for are in the common dictionary. This is required since the %% relay dictionary doesn't inherit the common dictionary (which maybe %% it should). -get_avp(?RELAY, Name, Msg) -> - get_avp(?BASE, Name, Msg); +get_avp_value(?RELAY, Name, Msg) -> + get_avp_value(?BASE, Name, Msg); -%% Message as a header/avps list. -get_avp(Dict, Name, [#diameter_header{} | Avps]) -> +%% Message sent as a header/avps list, probably a relay case but not +%% necessarily. +get_avp_value(Dict, Name, [#diameter_header{} | Avps]) -> try {Code, _, VId} = Dict:avp_header(Name), - find_avp(Code, VId, Avps) - of - A -> - (avp_decode(Dict, Name, ungroup(A)))#diameter_avp{name = Name} + [A|_] = lists:dropwhile(fun(#diameter_avp{code = C, vendor_id = V}) -> + C /= Code orelse V /= VId + end, + Avps), + avp_decode(Dict, Name, A) catch error: _ -> undefined end; %% Outgoing message as a name/values list. -get_avp(_, Name, [_MsgName | Avps]) -> +get_avp_value(_, Name, [_MsgName | Avps]) -> case lists:keyfind(Name, 1, Avps) of {_, V} -> - #diameter_avp{name = Name, value = V}; + V; _ -> undefined end; %% Message is typically a record but not necessarily. -get_avp(Dict, Name, Rec) -> +get_avp_value(Dict, Name, Rec) -> try - #diameter_avp{name = Name, value = Dict:'#get-'(Name, Rec)} + Dict:'#get-'(Name, Rec) catch error:_ -> undefined end. -%% get_avp_value/3 - -get_avp_value(Dict, Name, Msg) -> - case get_avp(Dict, Name, Msg) of - #diameter_avp{value = V} -> - V; - undefined = No -> - No - end. - -%% ungroup/1 - -ungroup([Avp|_]) -> - Avp; -ungroup(Avp) -> - Avp. - -%% avp_decode/3 - avp_decode(Dict, Name, #diameter_avp{value = undefined, - data = Bin} - = Avp) -> - try Dict:avp(decode, Bin, Name) of - V -> - Avp#diameter_avp{value = V} - catch - error:_ -> - Avp - end; -avp_decode(_, _, #diameter_avp{} = Avp) -> - Avp. + data = Bin}) -> + Dict:avp(decode, Bin, Name); +avp_decode(_, _, #diameter_avp{value = V}) -> + V. cb(#diameter_app{module = [_|_] = M}, F, A) -> eval(M, F, A); diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_types.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_types.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_types.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_types.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -76,7 +75,7 @@ %% message indicating this error MUST include the offending AVPs %% within a Failed-AVP AVP. %% --define(INVALID_LENGTH(Bitstr), erlang:error({'DIAMETER', 5014, Bitstr})). +-define(INVALID_LENGTH(Bin), erlang:error({'DIAMETER', 5014, Bin})). %% ------------------------------------------------------------------------- %% 3588, 4.2. Basic AVP Data Formats @@ -91,12 +90,7 @@ 'OctetString'(decode, Bin) when is_binary(Bin) -> - case diameter_codec:getopt(string_decode) of - true -> - binary_to_list(Bin); - false -> - Bin - end; + binary_to_list(Bin); 'OctetString'(decode, B) -> ?INVALID_LENGTH(B); @@ -304,29 +298,21 @@ 'OctetString'(M, lists:duplicate(0,7)); 'DiameterURI'(encode, #diameter_uri{type = Type, - fqdn = DN, - port = PN, + fqdn = D, + port = P, transport = T, - protocol = P}) - when (Type == 'aaa' orelse Type == 'aaas'), - is_integer(PN), - 0 =< PN, - (T == tcp orelse T == sctp orelse T == udp), - (P == diameter orelse P == radius orelse P == 'tacacs+'), - (P /= diameter orelse T /= udp) -> - iolist_to_binary([atom_to_list(Type), "://", DN, - ":", integer_to_list(PN), + protocol = Prot} + = U) -> + S = lists:append([atom_to_list(Type), "://", D, + ":", integer_to_list(P), ";transport=", atom_to_list(T), - ";protocol=", atom_to_list(P)]); -%% Don't omit defaults since they're dependent on whether RFC 3588 or -%% 6733 is being followed. For one, we don't know this at encode; for -%% two (more importantly), we don't know how the peer will interpret -%% defaults, so it's best to be explicit. Interpret defaults on decode -%% since there's no choice. + ";protocol=", atom_to_list(Prot)]), + U = scan_uri(S), %% assert + list_to_binary(S); 'DiameterURI'(encode, Str) -> Bin = iolist_to_binary(Str), - #diameter_uri{} = scan_uri(Bin), %% assert + #diameter_uri{} = scan_uri(Bin), %% type check Bin. %% -------------------- @@ -335,6 +321,7 @@ 'IPFilterRule'(encode = M, zero) -> 'OctetString'(M, lists:duplicate(0,33)); +%% TODO: parse grammar. 'IPFilterRule'(M, X) -> 'OctetString'(M, X). @@ -344,6 +331,7 @@ 'QoSFilterRule'(encode = M, zero = X) -> 'IPFilterRule'(M, X); +%% TODO: parse grammar. 'QoSFilterRule'(M, X) -> 'OctetString'(M, X). @@ -351,13 +339,7 @@ 'UTF8String'(decode, Bin) when is_binary(Bin) -> - case diameter_codec:getopt(string_decode) of - true -> - %% assert list return - tl([0|_] = unicode:characters_to_list([0, Bin])); - false -> - <<_/binary>> = unicode:characters_to_binary(Bin) - end; + tl([0|_] = unicode:characters_to_list([0, Bin])); %% assert list return 'UTF8String'(decode, B) -> ?INVALID_LENGTH(B); @@ -525,90 +507,55 @@ %% %% aaa-protocol = ( "diameter" / "radius" / "tacacs+" ) -%% RFC 6733, 4.3.1, changes the defaults: -%% -%% "aaa://" FQDN [ port ] [ transport ] [ protocol ] -%% -%% ; No transport security -%% -%% "aaas://" FQDN [ port ] [ transport ] [ protocol ] -%% -%% ; Transport security used -%% -%% FQDN = < Fully Qualified Domain Name > -%% -%% port = ":" 1*DIGIT -%% -%% ; One of the ports used to listen for -%% ; incoming connections. -%% ; If absent, the default Diameter port -%% ; (3868) is assumed if no transport -%% ; security is used and port 5658 when -%% ; transport security (TLS/TCP and DTLS/SCTP) -%% ; is used. -%% -%% transport = ";transport=" transport-protocol -%% -%% ; One of the transports used to listen -%% ; for incoming connections. If absent, -%% ; the default protocol is assumed to be TCP. -%% ; UDP MUST NOT be used when the aaa-protocol -%% ; field is set to diameter. -%% -%% transport-protocol = ( "tcp" / "sctp" / "udp" ) -%% -%% protocol = ";protocol=" aaa-protocol -%% -%% ; If absent, the default AAA protocol -%% ; is Diameter. -%% -%% aaa-protocol = ( "diameter" / "radius" / "tacacs+" ) +scan_uri(Bin) + when is_binary(Bin) -> + scan_uri(binary_to_list(Bin)); +scan_uri("aaa://" ++ Rest) -> + scan_fqdn(Rest, #diameter_uri{type = aaa}); +scan_uri("aaas://" ++ Rest) -> + scan_fqdn(Rest, #diameter_uri{type = aaas}). + +scan_fqdn(S, U) -> + {[_|_] = F, Rest} = lists:splitwith(fun is_fqdn/1, S), + scan_opt_port(Rest, U#diameter_uri{fqdn = F}). + +scan_opt_port(":" ++ S, U) -> + {[_|_] = P, Rest} = lists:splitwith(fun is_digit/1, S), + scan_opt_transport(Rest, U#diameter_uri{port = list_to_integer(P)}); +scan_opt_port(S, U) -> + scan_opt_transport(S, U). + +scan_opt_transport(";transport=" ++ S, U) -> + {P, Rest} = transport(S), + scan_opt_protocol(Rest, U#diameter_uri{transport = P}); +scan_opt_transport(S, U) -> + scan_opt_protocol(S, U). + +scan_opt_protocol(";protocol=" ++ S, U) -> + {P, ""} = protocol(S), + U#diameter_uri{protocol = P}; +scan_opt_protocol("", U) -> + U. + +transport("tcp" ++ S) -> + {tcp, S}; +transport("sctp" ++ S) -> + {sctp, S}; +transport("udp" ++ S) -> + {udp, S}. + +protocol("diameter" ++ S) -> + {diameter, S}; +protocol("radius" ++ S) -> + {radius, S}; +protocol("tacacs+" ++ S) -> + {'tacacs+', S}. + +is_fqdn(C) -> + is_digit(C) orelse is_alpha(C) orelse C == $. orelse C == $-. -scan_uri(Bin) -> - RE = "^(aaas?)://" - "([-a-zA-Z0-9.]{1,255})" - "(:0{0,5}([0-9]{1,5}))?" - "(;transport=(tcp|sctp|udp))?" - "(;protocol=(diameter|radius|tacacs\\+))?$", - %% A port number is 16-bit, so an arbitrary number of digits is - %% just a vulnerability, but provide a little slack with leading - %% zeros in a port number just because the regexp was previously - %% [0-9]+ and it's not inconceivable that a value might be padded. - %% Don't fantasize about this padding being more than the number - %% of digits in the port number proper. - %% - %% Similarly, a FQDN can't be arbitrarily long: at most 255 - %% octets. - {match, [A, DN, PN, T, P]} = re:run(Bin, - RE, - [{capture, [1,2,4,6,8], binary}]), - Type = to_atom(A), - {PN0, T0} = defaults(diameter_codec:getopt(rfc), Type), - PortNr = to_int(PN, PN0), - 0 = PortNr bsr 16, %% assert - #diameter_uri{type = Type, - fqdn = 'OctetString'(decode, DN), - port = PortNr, - transport = to_atom(T, T0), - protocol = to_atom(P, diameter)}. - -%% Choose defaults based on the RFC, since 6733 has changed them. -defaults(3588, _) -> - {3868, sctp}; -defaults(6733, aaa) -> - {3868, tcp}; -defaults(6733, aaas) -> - {5658, tcp}. - -to_int(<<>>, N) -> - N; -to_int(B, _) -> - binary_to_integer(B). - -to_atom(<<>>, A) -> - A; -to_atom(B, _) -> - to_atom(B). +is_alpha(C) -> + ($a =< C andalso C =< $z) orelse ($A =< C andalso C =< $Z). -to_atom(B) -> - binary_to_atom(B, latin1). +is_digit(C) -> + $0 =< C andalso C =< $9. diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_watchdog.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_watchdog.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_watchdog.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_watchdog.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -66,9 +65,7 @@ %% end PCB parent = self() :: pid(), %% service process transport :: pid() | undefined, %% peer_fsm process - tref :: reference() %% reference for current watchdog timer - | integer() %% monotonic time - | undefined, + tref :: reference(), %% reference for current watchdog timer dictionary :: module(), %% common dictionary receive_data :: term(), %% term passed into diameter_service with incoming message @@ -96,7 +93,7 @@ Ack = make_ref(), {ok, Pid} = diameter_watchdog_sup:start_child({Ack, Type, self(), T}), try - {monitor(process, Pid), Pid} + {erlang:monitor(process, Pid), Pid} after send(Pid, Ack) end. @@ -123,20 +120,17 @@ #diameter_service{applications = Apps, capabilities = Caps} = Svc}}) -> - monitor(process, Pid), + erlang:monitor(process, Pid), wait(Ack, Pid), - {_, Seed} = diameter_lib:seed(), - random:seed(Seed), - putr(restart, {T, Opts, Svc, SvcOpts}), %% save seeing it in trace - putr(dwr, dwr(Caps)), %% + random:seed(now()), + putr(restart, {T, Opts, Svc}), %% save seeing it in trace + putr(dwr, dwr(Caps)), %% {_,_} = Mask = proplists:get_value(sequence, SvcOpts), Restrict = proplists:get_value(restrict_connections, SvcOpts), Nodes = restrict_nodes(Restrict), Dict0 = common_dictionary(Apps), - diameter_codec:setopts([{common_dictionary, Dict0}, - {string_decode, false}]), #watchdog{parent = Pid, - transport = start(T, Opts, SvcOpts, Nodes, Dict0, Svc), + transport = start(T, Opts, Mask, Nodes, Dict0, Svc), tw = proplists:get_value(watchdog_timer, Opts, ?DEFAULT_TW_INIT), @@ -171,11 +165,11 @@ when ?IS_NATURAL(N) -> Rec#config{okay = N}. -%% start/6 +%% start/5 -start(T, Opts, SvcOpts, Nodes, Dict0, Svc) -> +start(T, Opts, Mask, Nodes, Dict0, Svc) -> {_MRef, Pid} - = diameter_peer_fsm:start(T, Opts, {SvcOpts, Nodes, Dict0, Svc}), + = diameter_peer_fsm:start(T, Opts, {Mask, Nodes, Dict0, Svc}), Pid. %% common_dictionary/1 @@ -248,16 +242,11 @@ event(T, State, S), %% before 'watchdog' {noreply, S}; stop -> - ?LOG(stop, truncate(T)), + ?LOG(stop, T), event(T, State, State#watchdog{status = down}), {stop, {shutdown, T}, State} end. -truncate({'DOWN' = T, _, process, Pid, _}) -> - {T, Pid}; -truncate(T) -> - T. - close({'DOWN', _, process, TPid, {shutdown, Reason}}, #watchdog{transport = TPid, parent = Pid}) -> @@ -266,15 +255,11 @@ close(_, _) -> ok. -event(_, - #watchdog{status = From, transport = F}, - #watchdog{status = To, transport = T}) - when F == undefined, T == undefined; %% transport not started - From == initial, To == down; %% never really left INITIAL - From == To -> %% no state transition +event(_, #watchdog{status = T}, #watchdog{status = T}) -> + ok; + +event(_, #watchdog{transport = undefined}, #watchdog{transport = undefined}) -> ok; -%% Note that there is no INITIAL -> DOWN transition in RFC 3539: ours -%% is just a consequence of stop. event(Msg, #watchdog{status = From, transport = F, parent = Pid}, @@ -330,7 +315,7 @@ %% expiry; or another watchdog is saying the same after reestablishing %% a connection previously had by this one. transition(close, #watchdog{}) -> - {accept, _} = role(), %% assert + {{accept, _}, _, _} = getr(restart), %% assert stop; %% Service is asking for the peer to be taken down gracefully. @@ -343,9 +328,8 @@ send(TPid, {T, self(), Reason}), S#watchdog{shutdown = true}; -%% Transport is telling us that DPA has been sent in response to DPR, -%% or that DPR has been explicitly sent: transport death should lead -%% to ours. +%% Transport is telling us that DPA has been sent in response to DPR: +%% its death should lead to ours. transition({'DPR', TPid}, #watchdog{transport = TPid} = S) -> S#watchdog{shutdown = true}; @@ -380,7 +364,7 @@ restrict = {_,R}, config = #config{suspect = OS}} = S) -> - case okay(role(), Hosts, R) of + case okay(getr(restart), Hosts, R) of okay -> set_watchdog(S#watchdog{status = okay, num_dwa = OS}); @@ -427,25 +411,31 @@ stop; %% ... or not. -transition({'DOWN', _, process, TPid, _Reason} = D, +transition({'DOWN', _, process, TPid, _Reason}, #watchdog{transport = TPid, status = T, restrict = {_,R}} = S0) -> S = S0#watchdog{pending = false, transport = undefined}, - {M,_} = role(), + {{M,_}, _, _} = getr(restart), %% Close an accepting watchdog immediately if there's no %% restriction on the number of connections to the same peer: the - %% state machine never enters state REOPEN in this case. - - if T == initial; - M == accept, not R -> - close(D, S0), - stop; - true -> - set_watchdog(S#watchdog{status = down}) + %% state machine never enters state REOPEN in this case. The + %% 'close' message (instead of stop) is so as not to bypass the + %% sending of messages to the service process in handle_info/2. + + if T /= initial, M == accept, not R -> + send(self(), close), + S#watchdog{status = down}; + T /= initial -> + set_watchdog(S#watchdog{status = down}); + M == connect -> + set_watchdog(S); + M == accept -> + send(self(), close), + S end; %% Incoming message. @@ -454,12 +444,11 @@ %% Current watchdog has timed out. transition({timeout, TRef, tw}, #watchdog{tref = TRef} = S) -> - set_watchdog(0, timeout(S)); + set_watchdog(timeout(S)); -%% Message has arrived since the timer was started: subtract time -%% already elapsed from new timer. -transition({timeout, _, tw}, #watchdog{tref = T0} = S) -> - set_watchdog(diameter_lib:micro_diff(T0) div 1000, S); +%% Timer was canceled after message was already sent. +transition({timeout, _, tw}, #watchdog{}) -> + ok; %% State query. transition({state, Pid}, #watchdog{status = S}) -> @@ -502,7 +491,7 @@ %% okay/3 -okay({accept, Ref}, Hosts, Restrict) -> +okay({{accept, Ref}, _, _}, Hosts, Restrict) -> T = {?MODULE, connection, Ref, Hosts}, diameter_reg:add(T), if Restrict -> @@ -513,7 +502,7 @@ %% Register before matching so that at least one of two registering %% processes will match the other. -okay({connect, _}, _, _) -> +okay({{connect, _}, _, _}, _, _) -> okay. %% okay/2 @@ -528,34 +517,20 @@ [_|_] = [send(P, close) || {_,P} <- C, self() /= P], reopen. -%% role/0 - -role() -> - element(1, getr(restart)). - %% set_watchdog/1 -%% Timer not yet set. -set_watchdog(#watchdog{tref = undefined} = S) -> - set_watchdog(0, S); - -%% Timer already set: start at new one only at expiry. -set_watchdog(#watchdog{} = S) -> - S#watchdog{tref = diameter_lib:now()}. - -%% set_watchdog/2 - -set_watchdog(_, stop = No) -> - No; - -set_watchdog(Ms, #watchdog{tw = TwInit} = S) -> - S#watchdog{tref = erlang:start_timer(tw(TwInit, Ms), self(), tw)}. - -%% A callback could return anything, so ensure the result isn't -%% negative. Don't prevent abuse, even though the smallest valid -%% timeout is 4000. -tw(TwInit, Ms) -> - max(tw(TwInit) - Ms, 0). +set_watchdog(#watchdog{tw = TwInit, + tref = TRef} + = S) -> + cancel(TRef), + S#watchdog{tref = erlang:start_timer(tw(TwInit), self(), tw)}; +set_watchdog(stop = No) -> + No. + +cancel(undefined) -> + ok; +cancel(TRef) -> + erlang:cancel_timer(TRef). tw(T) when is_integer(T), T >= 6000 -> @@ -576,7 +551,7 @@ ?LOG(send, 'DWR'), S#watchdog{pending = true}. -%% Don't count encode errors since we don't expect any on DWR/DWA. +%% Dont' count encode errors since we don't expect any on DWR/DWA. %% recv/3 @@ -598,18 +573,11 @@ DPkt = diameter_codec:decode(Dict0, Pkt), diameter_traffic:incr(recv, DPkt, TPid, Dict0), diameter_traffic:incr_error(recv, DPkt, TPid, Dict0), - #diameter_packet{header = H, - transport_data = T, - bin = Bin} - = EPkt - = encode(dwa, Dict0, Pkt), + EPkt = encode(dwa, Dict0, Pkt), diameter_traffic:incr(send, EPkt, TPid, Dict0), diameter_traffic:incr_rc(send, EPkt, TPid, Dict0), - %% Strip potentially large message terms. - send(TPid, {send, #diameter_packet{header = H, - transport_data = T, - bin = Bin}}), + send(TPid, {send, EPkt}), ?LOG(send, 'DWA'); rcv('DWA', Pkt, #watchdog{transport = TPid, @@ -624,10 +592,9 @@ rcv(N, _, _) when N == 'CER'; N == 'CEA'; - N == 'DPR' -> + N == 'DPR'; + N == 'DPA' -> false; -%% DPR can be sent explicitly with diameter:call/4. Only the -%% corresponding DPAs arrive here. rcv(_, Pkt, #watchdog{transport = TPid, dictionary = Dict0, @@ -828,25 +795,26 @@ %% state down rather then initial when receiving notification of an %% open connection. -restart({{connect, _} = T, Opts, Svc, SvcOpts}, +restart({{connect, _} = T, Opts, Svc}, #watchdog{parent = Pid, + sequence = Mask, restrict = {R,_}, dictionary = Dict0} = S) -> send(Pid, {reconnect, self()}), Nodes = restrict_nodes(R), - S#watchdog{transport = start(T, Opts, SvcOpts, Nodes, Dict0, Svc), + S#watchdog{transport = start(T, Opts, Mask, Nodes, Dict0, Svc), restrict = {R, lists:member(node(), Nodes)}}; %% No restriction on the number of connections to the same peer: just %% die. Note that a state machine never enters state REOPEN in this %% case. -restart({{accept, _}, _, _, _}, #watchdog{restrict = {_, false}}) -> - stop; +restart({{accept, _}, _, _}, #watchdog{restrict = {_, false}}) -> + stop; %% 'DOWN' was in old code: 'close' was not sent %% Otherwise hang around until told to die, either by the service or %% by another watchdog. -restart({{accept, _}, _, _, _}, S) -> +restart({{accept, _}, _, _}, S) -> S. %% Don't currently use Opts/Svc in the accept case. diff -Nru erlang-18.2-dfsg/lib/diameter/src/base/diameter_watchdog_sup.erl erlang-17.3-dfsg/lib/diameter/src/base/diameter_watchdog_sup.erl --- erlang-18.2-dfsg/lib/diameter/src/base/diameter_watchdog_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/base/diameter_watchdog_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_codegen.erl erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_codegen.erl --- erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_codegen.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_codegen.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -184,7 +183,7 @@ f_enumerated_avp(ParseD), f_empty_value(ParseD), f_dict(ParseD), - {eof, erl_anno:new(?LINE)}]], + {eof, ?LINE}]], lists:append(Forms). diff -Nru erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_dict_parser.yrl erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_dict_parser.yrl --- erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_dict_parser.yrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_dict_parser.yrl 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_dict_scanner.erl erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_dict_scanner.erl --- erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_dict_scanner.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_dict_scanner.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_dict_util.erl erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_dict_util.erl --- erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_dict_util.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_dict_util.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_exprecs.erl erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_exprecs.erl --- erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_exprecs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_exprecs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_forms.hrl erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_forms.hrl --- erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_forms.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_forms.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,10 +28,8 @@ [], [?APPLY(erlang, error, [?ATOM(badarg)])]}). --define(ANNO(L), erl_anno:new(L)). - %% Form tag with line number. --define(F(T), T, ?ANNO(?LINE)). +-define(F(T), T, ?LINE). %% Yes, that's right. The replacement is to the first unmatched ')'. -define(attribute, ?F(attribute)). @@ -50,10 +47,10 @@ -define(record_index, ?F(record_index)). -define(tuple, ?F(tuple)). --define(ATOM(T), {atom, ?ANNO(?LINE), T}). --define(INTEGER(N), {integer, ?ANNO(?LINE), N}). --define(VAR(V), {var, ?ANNO(?LINE), V}). --define(NIL, {nil, ?ANNO(?LINE)}). +-define(ATOM(T), {atom, ?LINE, T}). +-define(INTEGER(N), {integer, ?LINE, N}). +-define(VAR(V), {var, ?LINE, V}). +-define(NIL, {nil, ?LINE}). -define(CALL(F,A), {?call, ?ATOM(F), A}). -define(APPLY(M,F,A), {?call, {?remote, ?ATOM(M), ?ATOM(F)}, A}). diff -Nru erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_make.erl erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_make.erl --- erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_make.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_make.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_vsn.hrl erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_vsn.hrl --- erlang-18.2-dfsg/lib/diameter/src/compiler/diameter_vsn.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/compiler/diameter_vsn.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/depend.sed erlang-17.3-dfsg/lib/diameter/src/depend.sed --- erlang-18.2-dfsg/lib/diameter/src/depend.sed 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/depend.sed 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/diameter/src/diameter.app.src erlang-17.3-dfsg/lib/diameter/src/diameter.app.src --- erlang-18.2-dfsg/lib/diameter/src/diameter.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/diameter.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/diameter.appup.src erlang-17.3-dfsg/lib/diameter/src/diameter.appup.src --- erlang-18.2-dfsg/lib/diameter/src/diameter.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/diameter.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -2,19 +2,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -36,32 +35,27 @@ {"1.4.3", [{restart_application, diameter}]}, %% R16B02 {"1.4.4", [{restart_application, diameter}]}, {"1.5", [{restart_application, diameter}]}, %% R16B03 - {"1.6", [{restart_application, diameter}]}, %% 17.0 - {"1.7", [{restart_application, diameter}]}, %% 17.[12] - {"1.7.1", [{restart_application, diameter}]}, %% 17.3 - {"1.8", [{restart_application, diameter}]}, %% 17.4 - {"1.9", [{restart_application, diameter}]}, %% 17.5 - {"1.9.1", [{restart_application, diameter}]}, %% 17.5.3 - {"1.9.2", [{restart_application, diameter}]}, %% 17.5.5 - {"1.9.2.1", [{restart_application, diameter}]}, %% 17.5.6.3 - {"1.10", [{load_module, diameter_codec}, %% 18.0 - {load_module, diameter_peer_fsm}, - {load_module, diameter_watchdog}, - {load_module, diameter_stats}, - {load_module, diameter_config}, - {load_module, diameter_lib}, - {load_module, diameter_peer}, - {load_module, diameter_reg}, + {"1.6", [{load_module, diameter_lib}, %% 17.0 {load_module, diameter_traffic}, + {load_module, diameter_watchdog}, + {load_module, diameter_peer_fsm}, {load_module, diameter_service}, - {load_module, diameter_sync}, - {load_module, diameter}, {load_module, diameter_gen_base_rfc6733}, {load_module, diameter_gen_acct_rfc6733}, {load_module, diameter_gen_base_rfc3588}, {load_module, diameter_gen_base_accounting}, - {load_module, diameter_gen_relay}]}, - {"1.11", [{load_module, diameter_traffic}]} %% 18.1 + {load_module, diameter_gen_relay}, + {load_module, diameter_codec}, + {load_module, diameter_sctp}]}, + {"1.7", [{load_module, diameter_service}, %% 17.1 + {load_module, diameter_codec}, + {load_module, diameter_gen_base_rfc6733}, + {load_module, diameter_gen_acct_rfc6733}, + {load_module, diameter_gen_base_rfc3588}, + {load_module, diameter_gen_base_accounting}, + {load_module, diameter_gen_relay}, + {load_module, diameter_traffic}, + {load_module, diameter_peer_fsm}]} ], [ {"0.9", [{restart_application, diameter}]}, @@ -79,31 +73,26 @@ {"1.4.3", [{restart_application, diameter}]}, {"1.4.4", [{restart_application, diameter}]}, {"1.5", [{restart_application, diameter}]}, - {"1.6", [{restart_application, diameter}]}, - {"1.7", [{restart_application, diameter}]}, - {"1.7.1", [{restart_application, diameter}]}, - {"1.8", [{restart_application, diameter}]}, - {"1.9", [{restart_application, diameter}]}, - {"1.9.1", [{restart_application, diameter}]}, - {"1.9.2", [{restart_application, diameter}]}, - {"1.9.2.1", [{restart_application, diameter}]}, - {"1.10", [{load_module, diameter_gen_relay}, + {"1.6", [{load_module, diameter_sctp}, + {load_module, diameter_codec}, + {load_module, diameter_gen_relay}, {load_module, diameter_gen_base_accounting}, {load_module, diameter_gen_base_rfc3588}, {load_module, diameter_gen_acct_rfc6733}, {load_module, diameter_gen_base_rfc6733}, - {load_module, diameter}, - {load_module, diameter_sync}, {load_module, diameter_service}, - {load_module, diameter_traffic}, - {load_module, diameter_reg}, - {load_module, diameter_peer}, - {load_module, diameter_lib}, - {load_module, diameter_config}, - {load_module, diameter_stats}, - {load_module, diameter_watchdog}, {load_module, diameter_peer_fsm}, - {load_module, diameter_codec}]}, - {"1.11", [{load_module, diameter_traffic}]} + {load_module, diameter_watchdog}, + {load_module, diameter_traffic}, + {load_module, diameter_lib}]}, + {"1.7", [{load_module, diameter_peer_fsm}, + {load_module, diameter_traffic}, + {load_module, diameter_gen_relay}, + {load_module, diameter_gen_base_accounting}, + {load_module, diameter_gen_base_rfc3588}, + {load_module, diameter_gen_acct_rfc6733}, + {load_module, diameter_gen_base_rfc6733}, + {load_module, diameter_codec}, + {load_module, diameter_service}]} ] }. diff -Nru erlang-18.2-dfsg/lib/diameter/src/dict/acct_rfc6733.dia erlang-17.3-dfsg/lib/diameter/src/dict/acct_rfc6733.dia --- erlang-18.2-dfsg/lib/diameter/src/dict/acct_rfc6733.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/dict/acct_rfc6733.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2013. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/src/dict/base_accounting.dia erlang-17.3-dfsg/lib/diameter/src/dict/base_accounting.dia --- erlang-18.2-dfsg/lib/diameter/src/dict/base_accounting.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/dict/base_accounting.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2011. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/src/dict/base_rfc3588.dia erlang-17.3-dfsg/lib/diameter/src/dict/base_rfc3588.dia --- erlang-18.2-dfsg/lib/diameter/src/dict/base_rfc3588.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/dict/base_rfc3588.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2013. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/src/dict/base_rfc6733.dia erlang-17.3-dfsg/lib/diameter/src/dict/base_rfc6733.dia --- erlang-18.2-dfsg/lib/diameter/src/dict/base_rfc6733.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/dict/base_rfc6733.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2013. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/src/dict/capup_rfc6737.dia erlang-17.3-dfsg/lib/diameter/src/dict/capup_rfc6737.dia --- erlang-18.2-dfsg/lib/diameter/src/dict/capup_rfc6737.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/dict/capup_rfc6737.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2013. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/src/dict/relay.dia erlang-17.3-dfsg/lib/diameter/src/dict/relay.dia --- erlang-18.2-dfsg/lib/diameter/src/dict/relay.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/dict/relay.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2011. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/src/info/diameter_dbg.erl erlang-17.3-dfsg/lib/diameter/src/info/diameter_dbg.erl --- erlang-18.2-dfsg/lib/diameter/src/info/diameter_dbg.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/info/diameter_dbg.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/info/diameter_info.erl erlang-17.3-dfsg/lib/diameter/src/info/diameter_info.erl --- erlang-18.2-dfsg/lib/diameter/src/info/diameter_info.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/info/diameter_info.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -52,6 +51,8 @@ p/1, p/3]). +-compile({no_auto_import,[max/2]}). + -export([collect/2]). -define(LONG_TIMEOUT, 30000). @@ -682,6 +683,9 @@ recsplit(SFun, Rec) -> fun(Fs,Vs) -> SFun(element(1, Rec), Fs, Vs) end. +max(A, B) -> + if A > B -> A; true -> B end. + keyfetch(Key, List) -> {Key,V} = lists:keyfind(Key, 1, List), V. diff -Nru erlang-18.2-dfsg/lib/diameter/src/Makefile erlang-17.3-dfsg/lib/diameter/src/Makefile --- erlang-18.2-dfsg/lib/diameter/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/diameter/src/modules.mk erlang-17.3-dfsg/lib/diameter/src/modules.mk --- erlang-18.2-dfsg/lib/diameter/src/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2010-2015. All Rights Reserved. +# Copyright Ericsson AB 2010-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% @@ -95,7 +94,7 @@ # Released files relative to ../examples. EXAMPLES = \ code/GNUmakefile \ - code/node.erl \ + code/peer.erl \ code/client.erl \ code/client_cb.erl \ code/server.erl \ diff -Nru erlang-18.2-dfsg/lib/diameter/src/transport/diameter_etcp.erl erlang-17.3-dfsg/lib/diameter/src/transport/diameter_etcp.erl --- erlang-18.2-dfsg/lib/diameter/src/transport/diameter_etcp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/transport/diameter_etcp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/transport/diameter_etcp_sup.erl erlang-17.3-dfsg/lib/diameter/src/transport/diameter_etcp_sup.erl --- erlang-18.2-dfsg/lib/diameter/src/transport/diameter_etcp_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/transport/diameter_etcp_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/transport/diameter_sctp.erl erlang-17.3-dfsg/lib/diameter/src/transport/diameter_sctp.erl --- erlang-18.2-dfsg/lib/diameter/src/transport/diameter_sctp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/transport/diameter_sctp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,24 +1,24 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% -module(diameter_sctp). + -behaviour(gen_server). %% interface @@ -37,8 +37,7 @@ code_change/3, terminate/2]). --export([listener/1,%% diameter_sync callback - info/1]). %% service_info callback +-export([info/1]). %% service_info callback -export([ports/0, ports/1]). @@ -100,26 +99,22 @@ -record(listener, {ref :: reference(), socket :: gen_sctp:sctp_socket(), - count = 0 :: uint(), %% attached transport processes - pending = {0, queue:new()}, + count = 0 :: uint(), + tmap = ets:new(?MODULE, []) :: ets:tid(), + %% {MRef, Pid|AssocId}, {AssocId, Pid} + pending = {0, ets:new(?MODULE, [ordered_set])}, tref :: reference(), accept :: [match()]}). -%% Field pending implements two queues: the first of transport-to-be -%% processes to which an association has been assigned but for which -%% diameter hasn't yet spawned a transport process, a short-lived -%% state of affairs as a new transport is spawned as a consequence of -%% a peer being taken up, transport processes being spawned by the -%% listener on demand; the second of started transport processes that -%% have not yet been assigned an association. -%% -%% When diameter calls start/3, the transport process is either taken -%% from the first queue or spawned and placed in the second queue -%% until an association is established. When an association is -%% established, a controlling process is either taken from the second -%% queue or spawned and placed in the first queue. Thus, there are -%% only elements in one queue at a time, so share an ets table queue -%% and tag it with a positive length if it contains the first queue, a -%% negative length if it contains the second queue. +%% Field tmap is used to map an incoming message or event to the +%% relevent transport process. Field pending implements a queue of +%% transport processes to which an association has been assigned (at +%% comm_up and written into tmap) but for which diameter hasn't yet +%% spawned a transport process: a short-lived state of affairs as a +%% new transport is spawned as a consequence of a peer being taken up, +%% transport processes being spawned by the listener on demand. In +%% case diameter starts a transport before comm_up on a new +%% association, pending is set to an improper list with the spawned +%% transport as head and the queue as tail. %% --------------------------------------------------------------------------- %% # start/3 @@ -144,9 +139,9 @@ T. %% A listener spawns transports either as a consequence of this call -%% when there is not yet an association to assign it, or at comm_up on -%% a new association in which case the call retrieves a transport from -%% the pending queue. +%% when there is not yet an association to associate with it, or at +%% comm_up on a new association in which case the call retrieves a +%% transport from the pending queue. s({accept, Ref} = A, Addrs, Opts) -> {LPid, LAs} = listener(Ref, {Opts, Addrs}), try gen_server:call(LPid, {A, self()}, infinity) of @@ -216,12 +211,12 @@ i({listen, Ref, {Opts, Addrs}}) -> {[Matches], Rest} = proplists:split(Opts, [accept]), {LAs, Sock} = AS = open(Addrs, Rest, ?DEFAULT_PORT), + proc_lib:init_ack({ok, self(), LAs}), ok = gen_sctp:listen(Sock, true), true = diameter_reg:add_new({?MODULE, listener, {Ref, AS}}), - proc_lib:init_ack({ok, self(), LAs}), start_timer(#listener{ref = Ref, socket = Sock, - accept = [[M] || {accept, M} <- Matches]}); + accept = accept(Matches)}); %% A connecting transport. i({connect, Pid, Opts, Addrs, Ref}) -> @@ -231,73 +226,59 @@ {LAs, Sock} = open(Addrs, Rest, 0), putr(?REF_KEY, Ref), proc_lib:init_ack({ok, self(), LAs}), - monitor(process, Pid), + erlang:monitor(process, Pid), #transport{parent = Pid, mode = {connect, connect(Sock, RAs, RP, [])}, socket = Sock}; -%% An accepting transport spawned by diameter, not yet owning an -%% association. -i({accept, Ref, LPid, Pid}) +%% An accepting transport spawned by diameter. +i({accept, Pid, LPid, Sock, Ref}) when is_pid(Pid) -> putr(?REF_KEY, Ref), proc_lib:init_ack({ok, self()}), - monitor(process, Pid), - MRef = monitor(process, LPid), - wait([{peeloff, MRef}], #transport{parent = Pid, - mode = {accept, LPid}}); - -%% An accepting transport spawned at association establishment, whose -%% parent is not yet known. -i({accept, Ref, LPid}) -> + erlang:monitor(process, Pid), + erlang:monitor(process, LPid), + #transport{parent = Pid, + mode = {accept, LPid}, + socket = Sock}; + +%% An accepting transport spawned at association establishment. +i({accept, Ref, LPid, Sock, Id}) -> putr(?REF_KEY, Ref), proc_lib:init_ack({ok, self()}), - erlang:send_after(?ACCEPT_TIMEOUT, self(), accept_timeout), - MRef = monitor(process, LPid), - wait([{parent, Ref}, {peeloff, MRef}], #transport{mode = {accept, LPid}}). - -%% wait/2 -%% -%% Wait for diameter to start the transport process and for the -%% association to be peeled off before processing other messages. - -wait(Keys, S) -> - lists:foldl(fun i/2, S, Keys). - -i({K, Ref}, #transport{mode = {accept, _}} = S) -> + MRef = erlang:monitor(process, LPid), + %% Wait for a signal that the transport has been started before + %% processing other messages. receive - {Ref, Pid} when K == parent -> %% transport process started - S#transport{parent = Pid}; - {K, T, Matches} when K == peeloff -> %% association - {sctp, Sock, _RA, _RP, _Data} = T, - ok = accept_peer(Sock, Matches), - demonitor(Ref, [flush]), - t(T, S#transport{socket = Sock}); - accept_timeout = T -> - x(T); - {'DOWN', _, process, _, _} = T -> + {Ref, Pid} -> %% transport started + #transport{parent = Pid, + mode = {accept, LPid}, + socket = Sock}; + {'DOWN', MRef, process, _, _} = T -> %% listener down + close(Sock, Id), x(T) + after ?ACCEPT_TIMEOUT -> + close(Sock, Id), + x(timeout) end. +%% close/2 + +close(Sock, Id) -> + gen_sctp:eof(Sock, #sctp_assoc_change{assoc_id = Id}). +%% Having to pass a record here is hokey. + %% listener/2 -%% Accepting processes can be started concurrently: ensure only one -%% listener is started. listener(LRef, T) -> - diameter_sync:call({?MODULE, listener, LRef}, - {?MODULE, listener, [{LRef, T}]}, - infinity, - infinity). - -listener({LRef, T}) -> l(diameter_reg:match({?MODULE, listener, {LRef, '_'}}), LRef, T). -%% Existing listening process ... +%% Existing process with the listening socket ... l([{{?MODULE, listener, {_, AS}}, LPid}], _, _) -> - {LAs, _Sock} = AS, - {LPid, LAs}; + {LAs, _Sock} = AS, + {LPid, LAs}; -%% ... or not. +%% ... or not: start one. l([], LRef, T) -> {ok, LPid, LAs} = diameter_sctp_sup:start_child({listen, LRef, T}), {LPid, LAs}. @@ -367,10 +348,10 @@ %% --------------------------------------------------------------------------- handle_call({{accept, Ref}, Pid}, _, #listener{ref = Ref, - count = K} + count = N} = S) -> {TPid, NewS} = accept(Ref, Pid, S), - {reply, {ok, TPid}, NewS#listener{count = K+1}}; + {reply, {ok, TPid}, NewS#listener{count = N+1}}; handle_call(_, _, State) -> {reply, nok, State}. @@ -392,15 +373,6 @@ handle_info(T, #listener{} = S) -> {noreply, #listener{} = l(T,S)}. -%% Prior to the possiblity of setting pool_size on in transport -%% configuration, a new accepting transport was only started following -%% the death of a predecessor, so that there was only at most one -%% previously started transport process waiting for an association. -%% This assumption no longer holds with pool_size > 1, in which case -%% several accepting transports are started concurrently. Deal with -%% this by placing the started transports in a new queue of transport -%% processes waiting for an association. - %% --------------------------------------------------------------------------- %% # code_change/3 %% --------------------------------------------------------------------------- @@ -415,6 +387,16 @@ terminate(_, #transport{assoc_id = undefined}) -> ok; +terminate(_, #transport{socket = Sock, + mode = accept, + assoc_id = Id}) -> + close(Sock, Id); + +terminate(_, #transport{socket = Sock, + mode = {accept, _}, + assoc_id = Id}) -> + close(Sock, Id); + terminate(_, #transport{socket = Sock}) -> gen_sctp:close(Sock); @@ -441,17 +423,60 @@ %% Transition listener state. %% Incoming message from SCTP. -l({sctp, Sock, _RA, _RP, Data} = T, #listener{socket = Sock, - accept = Matches} - = S) -> +l({sctp, Sock, _RA, _RP, Data} = Msg, #listener{socket = Sock} = S) -> Id = assoc_id(Data), - {TPid, NewS} = accept(S), - TPid ! {peeloff, setelement(2, T, peeloff(Sock, Id, TPid)), Matches}, - setopts(Sock), - NewS; -l({'DOWN', _MRef, process, TPid, _}, #listener{pending = {_,Q}} = S) -> - down(queue:member(TPid, Q), TPid, S); + try find(Id, Data, S) of + {TPid, NewS} -> + TPid ! {peeloff, peeloff(Sock, Id, TPid), Msg, S#listener.accept}, + NewS; + false -> + S + after + setopts(Sock) + end; + +%% Transport is asking message to be sent. See send/3 for why the send +%% isn't directly from the transport. +l({send, AssocId, StreamId, Bin}, #listener{socket = Sock} = S) -> + send(Sock, AssocId, StreamId, Bin), + S; + +%% Accepting transport has died. One that's awaiting an association ... +l({'DOWN', MRef, process, TPid, _}, #listener{pending = [TPid | Q], + tmap = T, + count = N} + = S) -> + ets:delete(T, MRef), + ets:delete(T, TPid), + start_timer(S#listener{count = N-1, + pending = Q}); + +%% ... ditto and a new transport has already been started ... +l({'DOWN', _, process, _, _} = T, #listener{pending = [TPid | Q]} + = S) -> + #listener{pending = NQ} + = NewS + = l(T, S#listener{pending = Q}), + NewS#listener{pending = [TPid | NQ]}; + +%% ... or not. +l({'DOWN', MRef, process, TPid, _}, #listener{socket = Sock, + tmap = T, + count = N, + pending = {P,Q}} + = S) -> + [{MRef, Id}] = ets:lookup(T, MRef), %% Id = TPid | AssocId + ets:delete(T, MRef), + ets:delete(T, Id), + Id == TPid orelse close(Sock, Id), + case ets:lookup(Q, TPid) of + [{TPid, _}] -> %% transport in the pending queue ... + ets:delete(Q, TPid), + S#listener{pending = {P-1, Q}}; + [] -> %% ... or not + start_timer(S#listener{count = N-1}) + end; %% Timeout after the last accepting process has died. l({timeout, TRef, close = T}, #listener{tref = TRef, @@ -460,26 +485,6 @@ l({timeout, _, close}, #listener{} = S) -> S. -%% down/3 -%% -%% Accepting transport has died. - -%% One that's waiting for transport start in the pending queue ... -down(true, TPid, #listener{pending = {N,Q}, - count = K} - = S) -> - NQ = queue:filter(fun(P) -> P /= TPid end, Q), - if N < 0 -> %% awaiting an association ... - start_timer(S#listener{count = K-1, - pending = {N+1, NQ}}); - true -> %% ... or one has been assigned - S#listener{pending = {N-1, NQ}} - end; - -%% ... or one that's already attached. -down(false, _TPid, #listener{count = K} = S) -> - start_timer(S#listener{count = K-1}). - %% t/2 %% %% Transition transport state. @@ -496,10 +501,20 @@ %% transition/2 +%% Listening process is transfering ownership of an association. +transition({peeloff, Sock, {sctp, LSock, _RA, _RP, _Data} = Msg, Matches}, + #transport{mode = {accept, _}, + socket = LSock} + = S) -> + ok = accept_peer(Sock, Matches), + transition(Msg, S#transport{socket = Sock}); + %% Incoming message. -transition({sctp, Sock, _RA, _RP, Data}, #transport{socket = Sock} = S) -> +transition({sctp, _Sock, _RA, _RP, Data}, #transport{socket = Sock} = S) -> setopts(Sock), recv(Data, S); +%% Don't match on Sock since in R15B01 it can be the listening socket +%% in the (peeled-off) accept case, which is likely a bug. %% Outgoing message. transition({diameter, {send, Msg}}, S) -> @@ -521,8 +536,13 @@ transition({'DOWN', _, process, Pid, _}, #transport{parent = Pid}) -> stop; -%% Timeout after transport process has been started. -transition(accept_timeout, _) -> +%% Listener process has died. +transition({'DOWN', _, process, Pid, _}, #transport{mode = {accept, Pid}}) -> + stop; + +%% Ditto but we have ownership of the association. It might be that +%% we'll go down anyway though. +transition({'DOWN', _, process, _Pid, _}, #transport{mode = accept}) -> ok; %% Request for the local port number. @@ -549,27 +569,42 @@ orelse x({accept, RAddrs, Matches}), ok. +%% accept/1 + +accept(Opts) -> + [[M] || {accept, M} <- Opts]. + %% accept/3 %% %% Start a new transport process or use one that's already been -%% started as a consequence of diameter requesting a transport -%% process. +%% started as a consequence of association establishment. -accept(Ref, Pid, #listener{pending = {N,_}} = S) -> - {TPid, NQ} = q(Ref, Pid, S), - {TPid, S#listener{pending = {N-1, NQ}}}. +%% No pending associations: spawn a new transport. +accept(Ref, Pid, #listener{socket = Sock, + tmap = T, + pending = {0,_} = Q} + = S) -> + Arg = {accept, Pid, self(), Sock, Ref}, + {ok, TPid} = diameter_sctp_sup:start_child(Arg), + MRef = erlang:monitor(process, TPid), + ets:insert(T, [{MRef, TPid}, {TPid, MRef}]), + {TPid, S#listener{pending = [TPid | Q]}}; +%% Placing the transport in the pending field makes it available to +%% the next association. The stack starts a new accepting transport +%% only after this one brings the connection up (or dies). + +%% Accepting transport has died. This can happen if a new transport is +%% started before the DOWN has arrived. +accept(Ref, Pid, #listener{pending = [TPid | {0,_} = Q]} = S) -> + false = is_process_alive(TPid), %% assert + accept(Ref, Pid, S#listener{pending = Q}); %% Pending associations: attach to the first in the queue. -q(_, Pid, #listener{ref = Ref, - pending = {N,Q}}) - when 0 < N -> - {TPid, _} = T = dq(Q), +accept(_, Pid, #listener{ref = Ref, pending = {N,Q}} = S) -> + TPid = ets:first(Q), TPid ! {Ref, Pid}, - T; - -%% No pending associations: spawn a new transport. -q(Ref, Pid, #listener{pending = {_,Q}}) -> - nq({accept, Ref, self(), Pid}, Q). + ets:delete(Q, TPid), + {TPid, S#listener{pending = {N-1, Q}}}. %% send/2 @@ -630,7 +665,7 @@ = S) -> S#transport{mode = {C, connect(Sock, RAs, RP, [{RA,E} | Es])}}; -%% Association failure. +%% Lost association after establishment. recv({_, #sctp_assoc_change{}}, _) -> stop; @@ -641,10 +676,8 @@ bin = Bin}), ok; -recv({_, #sctp_shutdown_event{assoc_id = A}}, - #transport{assoc_id = Id}) - when A == Id; - A == 0 -> +recv({_, #sctp_shutdown_event{assoc_id = Id}}, + #transport{assoc_id = Id}) -> stop; %% Note that diameter_sctp(3) documents that sctp_events cannot be @@ -680,49 +713,49 @@ diameter_peer:up(Pid), S#transport{mode = A}. -%% accept/1 -%% -%% Start a new transport process or use one that's already been -%% started as a consequence of an event to a listener process. - -accept(#listener{pending = {N,_}} = S) -> - {TPid, NQ} = q(S), - {TPid, S#listener{pending = {N+1, NQ}}}. - -%% Transport waiting for an association: use it. -q(#listener{pending = {N,Q}}) - when N < 0 -> - dq(Q); - -%% No transport start yet: spawn one and queue. -q(#listener{ref = Ref, - pending = {_,Q}}) -> - nq({accept, Ref, self()}, Q). +%% find/3 -%% nq/2 -%% -%% Place a transport process in the second pending queue to make it -%% available to the next association. +find(Id, Data, #listener{tmap = T} = S) -> + f(ets:lookup(T, Id), Data, S). -nq(Arg, Q) -> +%% New association and a transport waiting for one: use it. +f([], + {_, #sctp_assoc_change{state = comm_up, + assoc_id = Id}}, + #listener{tmap = T, + pending = [TPid | {_,_} = Q]} + = S) -> + [{TPid, MRef}] = ets:lookup(T, TPid), + ets:insert(T, [{MRef, Id}, {Id, TPid}]), + ets:delete(T, TPid), + {TPid, S#listener{pending = Q}}; + +%% New association and no transport start yet: spawn one and place it +%% in the queue. +f([], + {_, #sctp_assoc_change{state = comm_up, + assoc_id = Id}}, + #listener{ref = Ref, + socket = Sock, + tmap = T, + pending = {N,Q}} + = S) -> + Arg = {accept, Ref, self(), Sock, Id}, {ok, TPid} = diameter_sctp_sup:start_child(Arg), - monitor(process, TPid), - {TPid, queue:in(TPid, Q)}. - -%% dq/1 -%% -%% Remove a transport process from the first pending queue to assign -%% it to an existing association. - -dq(Q) -> - {{value, TPid}, NQ} = queue:out(Q), - {TPid, NQ}. + MRef = erlang:monitor(process, TPid), + ets:insert(T, [{MRef, Id}, {Id, TPid}]), + ets:insert(Q, {TPid, now()}), + {TPid, S#listener{pending = {N+1, Q}}}; + +%% Known association ... +f([{_, TPid}], _, S) -> + {TPid, S}; + +%% ... or not: discard. +f([], _, _) -> + false. %% assoc_id/1 -%% -%% It's unclear if this is needed, or if the first message on an -%% association is always sctp_assoc_change, but don't assume since -%% SCTP behaviour differs between operating systems. assoc_id({[#sctp_sndrcvinfo{assoc_id = Id}], _}) -> Id; diff -Nru erlang-18.2-dfsg/lib/diameter/src/transport/diameter_sctp_sup.erl erlang-17.3-dfsg/lib/diameter/src/transport/diameter_sctp_sup.erl --- erlang-18.2-dfsg/lib/diameter/src/transport/diameter_sctp_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/transport/diameter_sctp_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/transport/diameter_tcp.erl erlang-17.3-dfsg/lib/diameter/src/transport/diameter_tcp.erl --- erlang-18.2-dfsg/lib/diameter/src/transport/diameter_tcp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/transport/diameter_tcp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -38,8 +37,7 @@ code_change/3, terminate/2]). --export([listener/1,%% diameter_sync callback - info/1]). %% service_info callback +-export([info/1]). %% service_info callback -export([ports/0, ports/1]). @@ -193,7 +191,7 @@ i({T, Ref, Mod, Pid, Opts, Addrs}) when T == accept; T == connect -> - monitor(process, Pid), + erlang:monitor(process, Pid), %% Since accept/connect might block indefinitely, spawn a process %% that does nothing but kill us with the parent until call %% returns. @@ -220,8 +218,8 @@ %% A monitor process to kill the transport if the parent dies. i(#monitor{parent = Pid, transport = TPid} = S) -> proc_lib:init_ack({ok, self()}), - monitor(process, Pid), - monitor(process, TPid), + erlang:monitor(process, Pid), + erlang:monitor(process, TPid), S; %% In principle a link between the transport and killer processes %% could do the same thing: have the accepting/connecting process be @@ -237,7 +235,7 @@ LAddr = laddr(LAddrOpt, Mod, LSock), true = diameter_reg:add_new({?MODULE, listener, {LRef, {LAddr, LSock}}}), proc_lib:init_ack({ok, self(), {LAddr, LSock}}), - monitor(process, APid), + erlang:monitor(process, APid), start_timer(#listener{socket = LSock}). laddr([], Mod, Sock) -> @@ -338,25 +336,17 @@ %% listener/2 -%% Accepting processes can be started concurrently: ensure only one -%% listener is started. listener(LRef, T) -> - diameter_sync:call({?MODULE, listener, LRef}, - {?MODULE, listener, [{LRef, T, self()}]}, - infinity, - infinity). - -listener({LRef, T, TPid}) -> - l(diameter_reg:match({?MODULE, listener, {LRef, '_'}}), LRef, T, TPid). - -%% Existing listening process ... -l([{{?MODULE, listener, {_, AS}}, LPid}], _, _, TPid) -> - LPid ! {accept, TPid}, + l(diameter_reg:match({?MODULE, listener, {LRef, '_'}}), LRef, T). + +%% Existing process with the listening socket ... +l([{{?MODULE, listener, {_, AS}}, LPid}], _, _) -> + LPid ! {accept, self()}, AS; -%% ... or not. -l([], LRef, T, TPid) -> - {ok, _, AS} = diameter_tcp_sup:start_child({listen, LRef, TPid, T}), +%% ... or not: start one. +l([], LRef, T) -> + {ok, _, AS} = diameter_tcp_sup:start_child({listen, LRef, self(), T}), AS. %% get_addr/1 @@ -512,7 +502,7 @@ %% Another accept transport is attaching. l({accept, TPid}, #listener{count = N} = S) -> - monitor(process, TPid), + erlang:monitor(process, TPid), S#listener{count = N+1}; %% Accepting process has died. diff -Nru erlang-18.2-dfsg/lib/diameter/src/transport/diameter_tcp_sup.erl erlang-17.3-dfsg/lib/diameter/src/transport/diameter_tcp_sup.erl --- erlang-18.2-dfsg/lib/diameter/src/transport/diameter_tcp_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/transport/diameter_tcp_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/transport/diameter_transport.erl erlang-17.3-dfsg/lib/diameter/src/transport/diameter_transport.erl --- erlang-18.2-dfsg/lib/diameter/src/transport/diameter_transport.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/transport/diameter_transport.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/src/transport/diameter_transport_sup.erl erlang-17.3-dfsg/lib/diameter/src/transport/diameter_transport_sup.erl --- erlang-18.2-dfsg/lib/diameter/src/transport/diameter_transport_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/src/transport/diameter_transport_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -55,7 +54,7 @@ Spec = {Name, {Module, start_link, [Name]}, permanent, - infinity, + 1000, supervisor, [Module]}, supervisor:start_child(?MODULE, Spec). diff -Nru erlang-18.2-dfsg/lib/diameter/subdirs.mk erlang-17.3-dfsg/lib/diameter/subdirs.mk --- erlang-18.2-dfsg/lib/diameter/subdirs.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/subdirs.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2010-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/diameter/test/coverspec.sed erlang-17.3-dfsg/lib/diameter/test/coverspec.sed --- erlang-18.2-dfsg/lib/diameter/test/coverspec.sed 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/coverspec.sed 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/diameter/test/depend.sed erlang-17.3-dfsg/lib/diameter/test/depend.sed --- erlang-18.2-dfsg/lib/diameter/test/depend.sed 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/depend.sed 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_3xxx_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_3xxx_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_3xxx_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_3xxx_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -48,7 +47,6 @@ send_double_error/1, send_3xxx/1, send_5xxx/1, - counters/1, stop/1]). %% diameter callbacks @@ -113,7 +111,7 @@ groups() -> Tc = tc(), - [{?util:name([E,D]), [], [start] ++ Tc ++ [counters, stop]} + [{?util:name([E,D]), [], [start] ++ Tc ++ [stop]} || E <- ?ERRORS, D <- ?RFCS]. init_per_suite(Config) -> @@ -171,203 +169,6 @@ ok = diameter:stop_service(?SERVER), ok = diameter:stop_service(?CLIENT). -%% counters/1 -%% -%% Check that counters are as expected. - -counters(Config) -> - Group = proplists:get_value(group, Config), - [_Errors, _Rfc] = G = ?util:name(Group), - [] = ?util:run([[fun counters/3, K, S, G] - || K <- [statistics, transport, connections], - S <- [?CLIENT, ?SERVER]]). - -counters(Key, Svc, Group) -> - counters(Key, Svc, Group, [_|_] = diameter:service_info(Svc, Key)). - -counters(statistics, Svc, [Errors, Rfc], L) -> - [{P, Stats}] = L, - true = is_pid(P), - stats(Svc, Errors, Rfc, lists:sort(Stats)); - -counters(_, _, _, _) -> - todo. - -stats(?CLIENT, E, rfc3588, L) - when E == answer; - E == answer_3xxx -> - [{{{unknown,0},recv},2}, - {{{0,257,0},recv},1}, - {{{0,257,1},send},1}, - {{{0,275,0},recv},6}, - {{{0,275,1},send},10}, - {{{unknown,0},recv,{'Result-Code',3001}},1}, - {{{unknown,0},recv,{'Result-Code',3007}},1}, - {{{0,257,0},recv,{'Result-Code',2001}},1}, - {{{0,275,0},recv,{'Result-Code',2001}},1}, - {{{0,275,0},recv,{'Result-Code',3008}},2}, - {{{0,275,0},recv,{'Result-Code',3999}},1}, - {{{0,275,0},recv,{'Result-Code',5002}},1}, - {{{0,275,0},recv,{'Result-Code',5005}},1}] - = L; - -stats(?SERVER, E, rfc3588, L) - when E == answer; - E == answer_3xxx -> - [{{{unknown,0},send},2}, - {{{unknown,1},recv},1}, - {{{0,257,0},send},1}, - {{{0,257,1},recv},1}, - {{{0,275,0},send},6}, - {{{0,275,1},recv},8}, - {{{unknown,0},send,{'Result-Code',3001}},1}, - {{{unknown,0},send,{'Result-Code',3007}},1}, - {{{unknown,1},recv,error},1}, - {{{0,257,0},send,{'Result-Code',2001}},1}, - {{{0,275,0},send,{'Result-Code',2001}},1}, - {{{0,275,0},send,{'Result-Code',3008}},2}, - {{{0,275,0},send,{'Result-Code',3999}},1}, - {{{0,275,0},send,{'Result-Code',5002}},1}, - {{{0,275,0},send,{'Result-Code',5005}},1}, - {{{0,275,1},recv,error},5}] - = L; - -stats(?CLIENT, answer, rfc6733, L) -> - [{{{unknown,0},recv},2}, - {{{0,257,0},recv},1}, - {{{0,257,1},send},1}, - {{{0,275,0},recv},8}, - {{{0,275,1},send},10}, - {{{unknown,0},recv,{'Result-Code',3001}},1}, - {{{unknown,0},recv,{'Result-Code',3007}},1}, - {{{0,257,0},recv,{'Result-Code',2001}},1}, - {{{0,275,0},recv,{'Result-Code',3008}},2}, - {{{0,275,0},recv,{'Result-Code',3999}},1}, - {{{0,275,0},recv,{'Result-Code',5002}},1}, - {{{0,275,0},recv,{'Result-Code',5005}},3}, - {{{0,275,0},recv,{'Result-Code',5999}},1}] - = L; - -stats(?SERVER, answer, rfc6733, L) -> - [{{{unknown,0},send},2}, - {{{unknown,1},recv},1}, - {{{0,257,0},send},1}, - {{{0,257,1},recv},1}, - {{{0,275,0},send},8}, - {{{0,275,1},recv},8}, - {{{unknown,0},send,{'Result-Code',3001}},1}, - {{{unknown,0},send,{'Result-Code',3007}},1}, - {{{unknown,1},recv,error},1}, - {{{0,257,0},send,{'Result-Code',2001}},1}, - {{{0,275,0},send,{'Result-Code',3008}},2}, - {{{0,275,0},send,{'Result-Code',3999}},1}, - {{{0,275,0},send,{'Result-Code',5002}},1}, - {{{0,275,0},send,{'Result-Code',5005}},3}, - {{{0,275,0},send,{'Result-Code',5999}},1}, - {{{0,275,1},recv,error},5}] - = L; - -stats(?CLIENT, answer_3xxx, rfc6733, L) -> - [{{{unknown,0},recv},2}, - {{{0,257,0},recv},1}, - {{{0,257,1},send},1}, - {{{0,275,0},recv},8}, - {{{0,275,1},send},10}, - {{{unknown,0},recv,{'Result-Code',3001}},1}, - {{{unknown,0},recv,{'Result-Code',3007}},1}, - {{{0,257,0},recv,{'Result-Code',2001}},1}, - {{{0,275,0},recv,{'Result-Code',2001}},1}, - {{{0,275,0},recv,{'Result-Code',3008}},2}, - {{{0,275,0},recv,{'Result-Code',3999}},1}, - {{{0,275,0},recv,{'Result-Code',5002}},1}, - {{{0,275,0},recv,{'Result-Code',5005}},2}, - {{{0,275,0},recv,{'Result-Code',5999}},1}] - = L; - -stats(?SERVER, answer_3xxx, rfc6733, L) -> - [{{{unknown,0},send},2}, - {{{unknown,1},recv},1}, - {{{0,257,0},send},1}, - {{{0,257,1},recv},1}, - {{{0,275,0},send},8}, - {{{0,275,1},recv},8}, - {{{unknown,0},send,{'Result-Code',3001}},1}, - {{{unknown,0},send,{'Result-Code',3007}},1}, - {{{unknown,1},recv,error},1}, - {{{0,257,0},send,{'Result-Code',2001}},1}, - {{{0,275,0},send,{'Result-Code',2001}},1}, - {{{0,275,0},send,{'Result-Code',3008}},2}, - {{{0,275,0},send,{'Result-Code',3999}},1}, - {{{0,275,0},send,{'Result-Code',5002}},1}, - {{{0,275,0},send,{'Result-Code',5005}},2}, - {{{0,275,0},send,{'Result-Code',5999}},1}, - {{{0,275,1},recv,error},5}] - = L; - -stats(?CLIENT, callback, rfc3588, L) -> - [{{{unknown,0},recv},1}, - {{{0,257,0},recv},1}, - {{{0,257,1},send},1}, - {{{0,275,0},recv},6}, - {{{0,275,1},send},10}, - {{{unknown,0},recv,{'Result-Code',3007}},1}, - {{{0,257,0},recv,{'Result-Code',2001}},1}, - {{{0,275,0},recv,{'Result-Code',2001}},2}, - {{{0,275,0},recv,{'Result-Code',3999}},1}, - {{{0,275,0},recv,{'Result-Code',5002}},1}, - {{{0,275,0},recv,{'Result-Code',5005}},2}] - = L; - -stats(?SERVER, callback, rfc3588, L) -> - [{{{unknown,0},send},1}, - {{{unknown,1},recv},1}, - {{{0,257,0},send},1}, - {{{0,257,1},recv},1}, - {{{0,275,0},send},6}, - {{{0,275,1},recv},8}, - {{{unknown,0},send,{'Result-Code',3007}},1}, - {{{unknown,1},recv,error},1}, - {{{0,257,0},send,{'Result-Code',2001}},1}, - {{{0,275,0},send,{'Result-Code',2001}},2}, - {{{0,275,0},send,{'Result-Code',3999}},1}, - {{{0,275,0},send,{'Result-Code',5002}},1}, - {{{0,275,0},send,{'Result-Code',5005}},2}, - {{{0,275,1},recv,error},5}] - = L; - -stats(?CLIENT, callback, rfc6733, L) -> - [{{{unknown,0},recv},1}, - {{{0,257,0},recv},1}, - {{{0,257,1},send},1}, - {{{0,275,0},recv},8}, - {{{0,275,1},send},10}, - {{{unknown,0},recv,{'Result-Code',3007}},1}, - {{{0,257,0},recv,{'Result-Code',2001}},1}, - {{{0,275,0},recv,{'Result-Code',2001}},2}, - {{{0,275,0},recv,{'Result-Code',3999}},1}, - {{{0,275,0},recv,{'Result-Code',5002}},1}, - {{{0,275,0},recv,{'Result-Code',5005}},3}, - {{{0,275,0},recv,{'Result-Code',5999}},1}] - = L; - -stats(?SERVER, callback, rfc6733, L) -> - [{{{unknown,0},send},1}, - {{{unknown,1},recv},1}, - {{{0,257,0},send},1}, - {{{0,257,1},recv},1}, - {{{0,275,0},send},8}, - {{{0,275,1},recv},8}, - {{{unknown,0},send,{'Result-Code',3007}},1}, - {{{unknown,1},recv,error},1}, - {{{0,257,0},send,{'Result-Code',2001}},1}, - {{{0,275,0},send,{'Result-Code',2001}},2}, - {{{0,275,0},send,{'Result-Code',3999}},1}, - {{{0,275,0},send,{'Result-Code',5002}},1}, - {{{0,275,0},send,{'Result-Code',5005}},3}, - {{{0,275,0},send,{'Result-Code',5999}},1}, - {{{0,275,1},recv,error},5}] - = L. - %% send_unknown_application/1 %% %% Send an unknown application that a callback (which shouldn't take diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_app_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_app_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_app_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_app_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -188,14 +187,15 @@ xref:stop(XRef), - Rel = release(), %% otp_release-ish - %% Only care about calls from our own application. - [] = lists:filter(fun({{F,_,_} = From, {_,_,_} = To}) -> + [] = lists:filter(fun({{F,_,_},{T,_,_}}) -> lists:member(F, Mods) - andalso not ignored(From, To, Rel) + andalso {F,T} /= {diameter_tcp, ssl} end, Undefs), + %% diameter_tcp does call ssl despite the latter not being listed + %% as a dependency in the app file since ssl is only required for + %% TLS security: it's up to a client who wants TLS to start ssl. %% Ensure that only runtime or info modules call runtime modules. %% It's not strictly necessary that diameter compiler modules not @@ -214,46 +214,12 @@ [] = lists:filter(fun(M) -> not lists:member(app(M), Deps) end, RTdeps -- Mods). -ignored({FromMod,_,_}, {ToMod,_,_} = To, Rel)-> - %% diameter_tcp does call ssl despite the latter not being listed - %% as a dependency in the app file since ssl is only required for - %% TLS security: it's up to a client who wants TLS to start ssl. - %% The OTP 18 time api is also called if it exists, so that the - %% same code can be run on older releases. - {FromMod, ToMod} == {diameter_tcp, ssl} - orelse (FromMod == diameter_lib - andalso Rel < 18 - andalso lists:member(To, time_api())). - -%% New time api in OTP 18. -time_api() -> - [{erlang, F, A} || {F,A} <- [{convert_time_unit,3}, - {monotonic_time,0}, - {monotonic_time,1}, - {system_time,0}, - {system_time,1}, - {time_offset,0}, - {time_offset,1}, - {timestamp,0}, - {unique_integer,0}, - {unique_integer,1}]] - ++ [{os, system_time, 0}, - {os, system_time, 1}]. - -release() -> - Rel = erlang:system_info(otp_release), - try list_to_integer(Rel) of - N -> N - catch - error:_ -> - 0 %% aka < 17 - end. - unversion(App) -> - {Name, [$-|Vsn]} = lists:splitwith(fun(C) -> C /= $- end, App), - true = is_app(Name), %% assert - Vsn = vsn_str(Vsn), %% - Name. + T = lists:dropwhile(fun is_vsn_ch/1, lists:reverse(App)), + lists:reverse(case T of [$-|TT] -> TT; _ -> T end). + +is_vsn_ch(C) -> + $0 =< C andalso C =< $9 orelse $. == C. app('$M_EXPR') -> %% could be anything but assume it's ok "erts"; @@ -322,11 +288,11 @@ %% Write a rel file and return its name. write_rel(Dir, [Erts | Apps], Vsn) -> - VS = vsn_str(Vsn), - Name = "diameter_test_" ++ VS, + true = is_vsn(Vsn), + Name = "diameter_test_" ++ Vsn, ok = write_file(filename:join([Dir, Name ++ ".rel"]), {release, - {"diameter " ++ VS ++ " test release", VS}, + {"diameter " ++ Vsn ++ " test release", Vsn}, Erts, Apps}), Name. @@ -341,34 +307,10 @@ write_file(Path, T) -> file:write_file(Path, io_lib:format("~p.", [T])). -%% Is a version string of the expected form? +%% Is a version string of the expected form? Return the argument +%% itself for 'false' for a useful badmatch. is_vsn(V) -> - V = vsn_str(V), - true. - -%% Turn a from/to version in appup to a version string after ensuring -%% that it's valid version number of regexp. In the regexp case, the -%% regexp itself becomes the version string since there's no -%% requirement that a version in appup be anything but a string. The -%% restrictions placed on string-valued version numbers (that they be -%% '.'-separated integers) are our own. - -vsn_str(S) - when is_list(S) -> - {_, match} = {S, match(S, "^(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*))*$")}, - {_, nomatch} = {S, match(S, "\\.0\\.0$")}, - S; - -vsn_str(B) - when is_binary(B) -> - {ok, _} = re:compile(B), - binary_to_list(B). - -match(S, RE) -> - re:run(S, RE, [{capture, none}]). - -%% Is an application name of the expected form? -is_app(S) - when is_list(S) -> - {_, match} = {S, match(S, "^([a-z]([a-z_]*|[a-zA-Z]*))$")}, - true. + is_list(V) + andalso length(V) == string:span(V, "0123456789.") + andalso V == string:join(string:tokens(V, [$.]), ".") %% no ".." + orelse {error, V}. diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_capx_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_capx_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_capx_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_capx_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -145,8 +144,8 @@ %% Generate a unique hostname for each testcase so that watchdogs %% don't prevent a connection from being brought up immediately. init_per_testcase(Name, Config) -> - [{host, ?L(Name) ++ "." ++ diameter_util:unique_string()} - | Config]. + Uniq = ["." ++ integer_to_list(N) || N <- tuple_to_list(now())], + [{host, lists:flatten([?L(Name) | Uniq])} | Config]. init_per_group(Name, Config) -> [{rfc, Name} | Config]. @@ -379,14 +378,10 @@ %% id's, failing with app_not_configured if it can't. load_dict(N) -> Mod = dict(N), - A1 = erl_anno:new(1), - A2 = erl_anno:new(2), - A3 = erl_anno:new(3), - A4 = erl_anno:new(4), - Forms = [{attribute, A1, module, Mod}, - {attribute, A2, compile, [export_all]}, - {function, A3, id, 0, - [{clause, A4, [], [], [{integer, A4, N}]}]}], + Forms = [{attribute, 1, module, Mod}, + {attribute, 2, compile, [export_all]}, + {function, 3, id, 0, + [{clause, 4, [], [], [{integer, 4, N}]}]}], {ok, Mod, Bin, []} = compile:forms(Forms, [return]), {module, Mod} = code:load_binary(Mod, Mod, Bin), N = Mod:id(). diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_codec_SUITE_data/avps.dia erlang-17.3-dfsg/lib/diameter/test/diameter_codec_SUITE_data/avps.dia --- erlang-18.2-dfsg/lib/diameter/test/diameter_codec_SUITE_data/avps.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_codec_SUITE_data/avps.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2011. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_codec_SUITE_data/diameter_test_unknown.erl erlang-17.3-dfsg/lib/diameter/test/diameter_codec_SUITE_data/diameter_test_unknown.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_codec_SUITE_data/diameter_test_unknown.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_codec_SUITE_data/diameter_test_unknown.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_codec_SUITE_data/recv.dia erlang-17.3-dfsg/lib/diameter/test/diameter_codec_SUITE_data/recv.dia --- erlang-18.2-dfsg/lib/diameter/test/diameter_codec_SUITE_data/recv.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_codec_SUITE_data/recv.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2011. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_codec_SUITE_data/send.dia erlang-17.3-dfsg/lib/diameter/test/diameter_codec_SUITE_data/send.dia --- erlang-18.2-dfsg/lib/diameter/test/diameter_codec_SUITE_data/send.dia 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_codec_SUITE_data/send.dia 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010-2011. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_codec_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_codec_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_codec_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_codec_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,9 +29,6 @@ -export([suite/0, all/0, - groups/0, - init_per_group/2, - end_per_group/2, init_per_testcase/2, end_per_testcase/2]). @@ -40,13 +36,9 @@ -export([base/1, gen/1, lib/1, - unknown/1, - success/1, - grouped_error/1, - failed_error/1]). + unknown/1]). -include("diameter_ct.hrl"). --include("diameter.hrl"). -define(L, atom_to_list). @@ -56,19 +48,7 @@ [{timetrap, {seconds, 10}}]. all() -> - [base, gen, lib, unknown, {group, recode}]. - -groups() -> - [{recode, [], [success, - grouped_error, - failed_error]}]. - -init_per_group(recode, Config) -> - ok = diameter:start(), - Config. - -end_per_group(_, _) -> - ok = diameter:stop(). + [base, gen, lib, unknown]. init_per_testcase(gen, Config) -> [{application, ?APP, App}] = diameter_util:consult(?APP, app), @@ -118,166 +98,3 @@ compile(File, Opts) -> compile:file(File, [return | Opts]). - -%% =========================================================================== - -%% Ensure a Grouped AVP is represented by a list in the avps field. -success(_) -> - Avps = [{295, <<1:32>>}, %% Termination-Cause - {284, [{280, "Proxy-Host"}, %% Proxy-Info - {33, "Proxy-State"}, %% - {295, <<2:32>>}]}], %% Termination-Cause - #diameter_packet{avps = [#diameter_avp{code = 295, - value = 1, - data = <<1:32>>}, - [#diameter_avp{code = 284}, - #diameter_avp{code = 280}, - #diameter_avp{code = 33}, - #diameter_avp{code = 295, - value = 2, - data = <<2:32>>}]], - errors = []} - = str(recode(str(Avps))). - -%% =========================================================================== - -%% Ensure a Grouped AVP is represented by a list in the avps field -%% even in the case of a decode error on a component AVP. -grouped_error(_) -> - Avps = [{295, <<1:32>>}, %% Termination-Cause - {284, [{295, <<0:32>>}, %% Proxy-Info, Termination-Cause - {280, "Proxy-Host"}, - {33, "Proxy-State"}]}], - #diameter_packet{avps = [#diameter_avp{code = 295, - value = 1, - data = <<1:32>>}, - [#diameter_avp{code = 284}, - #diameter_avp{code = 295, - value = undefined, - data = <<0:32>>}, - #diameter_avp{code = 280}, - #diameter_avp{code = 33}]], - errors = [{5004, #diameter_avp{code = 284}}]} - = str(recode(str(Avps))). - -%% =========================================================================== - -%% Ensure that a failed decode in Failed-AVP is acceptable, and that -%% the component AVPs are decoded if possible. -failed_error(_) -> - Avps = [{279, [{295, <<0:32>>}, %% Failed-AVP, Termination-Cause - {258, <<1:32>>}, %% Auth-Application-Id - {284, [{280, "Proxy-Host"}, %% Proxy-Info - {33, "Proxy-State"}, - {295, <<0:32>>}, %% Termination-Cause, invalid - {258, <<2:32>>}]}]}], %% Auth-Application-Id - #diameter_packet{avps = [[#diameter_avp{code = 279}, - #diameter_avp{code = 295, - value = undefined, - data = <<0:32>>}, - #diameter_avp{code = 258, - value = 1, - data = <<1:32>>}, - [#diameter_avp{code = 284}, - #diameter_avp{code = 280}, - #diameter_avp{code = 33}, - #diameter_avp{code = 295, - value = undefined}, - #diameter_avp{code = 258, - value = 2, - data = <<2:32>>}]]], - errors = []} - = sta(recode(sta(Avps))). - -%% =========================================================================== - -%% str/1 - -str(#diameter_packet{avps = [#diameter_avp{code = 263}, - #diameter_avp{code = 264}, - #diameter_avp{code = 296}, - #diameter_avp{code = 283}, - #diameter_avp{code = 258, - value = 0} - | T]} - = Pkt) -> - Pkt#diameter_packet{avps = T}; - -str(Avps) -> - OH = "diameter.erlang.org", - OR = "erlang.org", - DR = "example.com", - Sid = "diameter.erlang.org;123;456", - - [#diameter_header{version = 1, - cmd_code = 275, %% STR - is_request = true, - application_id = 0, - hop_by_hop_id = 17, - end_to_end_id = 42, - is_proxiable = false, - is_error = false, - is_retransmitted = false} - | avp([{263, Sid}, %% Session-Id - {264, OH}, %% Origin-Host - {296, OR}, %% Origin-Realm - {283, DR}, %% Destination-Realm - {258, <<0:32>>}] %% Auth-Application-Id - ++ Avps)]. - -%% sta/1 - -sta(#diameter_packet{avps = [#diameter_avp{code = 263}, - #diameter_avp{code = 268}, - #diameter_avp{code = 264}, - #diameter_avp{code = 296}, - #diameter_avp{code = 278, - value = 4} - | T]} - = Pkt) -> - Pkt#diameter_packet{avps = T}; - -sta(Avps) -> - OH = "diameter.erlang.org", - OR = "erlang.org", - Sid = "diameter.erlang.org;123;456", - - [#diameter_header{version = 1, - cmd_code = 275, %% STA - is_request = false, - application_id = 0, - hop_by_hop_id = 17, - end_to_end_id = 42, - is_proxiable = false, - is_error = false, - is_retransmitted = false} - | avp([{263, Sid}, %% Session-Id - {268, <<2002:32>>}, %% Result-Code - {264, OH}, %% Origin-Host - {296, OR}, %% Origin-Realm - {278, <<4:32>>}] %% Origin-State-Id - ++ Avps)]. - -avp({Code, Data}) -> - #diameter_avp{code = Code, - data = avp(Data)}; - -avp(#diameter_avp{} = A) -> - A; - -avp([{_,_} | _] = Avps) -> - lists:map(fun avp/1, Avps); - -avp(V) -> - V. - -%% recode/1 - -recode(Msg) -> - recode(Msg, diameter_gen_base_rfc6733). - -recode(#diameter_packet{} = Pkt, Dict) -> - diameter_codec:decode(Dict, diameter_codec:encode(Dict, Pkt)); - -recode(Msg, Dict) -> - recode(#diameter_packet{msg = Msg}, Dict). diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_codec_test.erl erlang-17.3-dfsg/lib/diameter/test/diameter_codec_test.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_codec_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_codec_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -230,7 +229,8 @@ when Ord =< Max -> diameter_enum:to_list(E); v(Max, Ord, E) -> - random:seed(diameter_util:seed()), + {M,S,U} = now(), + random:seed(M,S,U), v(Max, Ord, E, []). v(0, _, _, Acc) -> @@ -353,23 +353,12 @@ {[], ["aaa" ++ S ++ "://diameter.se" ++ P ++ Tr ++ Pr || S <- ["", "s"], - P <- ["", ":1234", ":0", ":65535"], + P <- ["", ":1234"], Tr <- ["" | [";transport=" ++ X || X <- ["tcp", "sctp", "udp"]]], Pr <- ["" | [";protocol=" ++ X - || X <- ["diameter","radius","tacacs+"]]], - Tr /= ";transport=udp" - orelse (Pr /= ";protocol=diameter" andalso Pr /= "")] - ++ ["aaa://" ++ lists:duplicate(255, $x)], - ["aaa://diameter.se:65536", - "aaa://diameter.se:-1", - "aaa://diameter.se;transport=udp;protocol=diameter", - "aaa://diameter.se;transport=udp", - "aaa://" ++ lists:duplicate(256, $x), - "aaa://:3868", - "aaax://diameter.se", - "aaa://diameter.se;transport=tcpx", - "aaa://diameter.se;transport=tcp;protocol=diameter "]}; + || X <- ["diameter","radius","tacacs+"]]]], + []}; values(T) when T == 'IPFilterRule'; @@ -523,7 +512,7 @@ seed(undefined) -> put({?MODULE, seed}, true), - random:seed(diameter_util:seed()); + random:seed(now()); seed(true) -> ok. diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_compiler_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_compiler_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_compiler_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_compiler_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_config_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_config_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_config_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_config_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -51,7 +50,7 @@ {request_errors, RE}, {call_mutates_state, C}]] || D <- [diameter_gen_base_rfc3588, diameter_gen_base_rfc6733], - M <- [?MODULE, [?MODULE, diameter_lib:now()]], + M <- [?MODULE, [?MODULE, now()]], A <- [0, common, make_ref()], S <- [[], make_ref()], AE <- [report, callback, discard], @@ -83,15 +82,6 @@ [false], [[node(), node()]]], [[x]]}, - {string_decode, - [[true], [false]], - [[0], [x]]}, - {incoming_maxlen, - [[0], [65536], [16#FFFFFF]], - [[-1], [1 bsl 24], [infinity], [false]]}, - {spawn_opt, - [[[]], [[monitor, link]]], - [[false]]}, {invalid_option, %% invalid service options are rejected [], [[x], @@ -167,13 +157,7 @@ {length_errors, [[exit], [handle], [discard]], [[x]]}, - {dpr_timeout, - [[0], [3000], [16#FFFFFFFF]], - [[infinity], [-1], [1 bsl 32], [x]]}, - {dpa_timeout, - [[0], [3000], [16#FFFFFFFF]], - [[infinity], [-1], [1 bsl 32], [x]]}, - {connect_timer, + {reconnect_timer, [[3000]], [[infinity]]}, {watchdog_timer, @@ -187,15 +171,9 @@ [[{suspect, 2}]]], [[x], [[{open, 0}]]]}, - {pool_size, - [[1], [100]], - [[0], [infinity], [-1], [x]]}, {private, [[x]], []}, - {spawn_opt, - [[[]], [[monitor, link]]], - [[false]]}, {invalid_option, %% invalid transport options are silently ignored [[x], [x,x]], diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_ct.erl erlang-17.3-dfsg/lib/diameter/test/diameter_ct.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_ct.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_ct.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -44,7 +43,7 @@ info(Start , info()). info() -> - [{time, diameter_lib:now()}, + [{time, now()}, {process_count, erlang:system_info(process_count)} | erlang:memory()]. @@ -57,6 +56,6 @@ io:format("INFO: ~p~n", [Diff]). diff(time, T0, T1) -> - diameter_lib:micro_diff(T1, T0); + timer:now_diff(T1, T0); diff(_, N0, N1) -> N1 - N0. diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_ct.hrl erlang-17.3-dfsg/lib/diameter/test/diameter_ct.hrl --- erlang-18.2-dfsg/lib/diameter/test/diameter_ct.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_ct.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_dict_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_dict_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_dict_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_dict_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_distribution_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_distribution_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_distribution_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_distribution_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_dpr_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_dpr_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_dpr_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_dpr_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012-2015. All Rights Reserved. +%% Copyright Ericsson AB 2012-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,7 +32,6 @@ %% testcases -export([start/1, connect/1, - send_dpr/1, remove_transport/1, stop_service/1, check/1, @@ -43,7 +41,6 @@ -export([disconnect/5]). -include("diameter.hrl"). --include("diameter_gen_base_rfc6733.hrl"). %% =========================================================================== @@ -54,6 +51,9 @@ -define(CLIENT, "CLIENT"). -define(SERVER, "SERVER"). +-define(DICT_COMMON, ?DIAMETER_DICT_COMMON). +-define(APP_ID, ?DICT_COMMON:id()). + %% Config for diameter:start_service/2. -define(SERVICE(Host), [{'Origin-Host', Host}, @@ -61,10 +61,9 @@ {'Host-IP-Address', [?ADDR]}, {'Vendor-Id', hd(Host)}, %% match this in disconnect/5 {'Product-Name', "OTP/diameter"}, - {'Acct-Application-Id', [0]}, + {'Acct-Application-Id', [?APP_ID]}, {restrict_connections, false}, - {application, [{dictionary, diameter_gen_base_rfc6733}, - {alias, common}, + {application, [{dictionary, ?DICT_COMMON}, {module, #diameter_callback{_ = false}}]}]). %% Disconnect reasons that diameter passes as the first argument of a @@ -75,12 +74,10 @@ -define(CAUSES, [0, rebooting, 1, busy, 2, goaway]). %% Establish one client connection for each element of this list, -%% configured with disconnect/5, disconnect_cb returning the specified -%% value. +%% configured with disconnect/5 as disconnect_cb and returning the +%% specified value. -define(RETURNS, - [[close, {dpr, [{cause, invalid}]}], - [ignore, close], - []] + [[close, {dpr, [{cause, invalid}]}], [ignore, close], []] ++ [[{dpr, [{timeout, 5000}, {cause, T}]}] || T <- ?CAUSES]). %% =========================================================================== @@ -89,7 +86,7 @@ [{timetrap, {seconds, 60}}]. all() -> - [start, send_dpr, stop | [{group, R} || R <- ?REASONS]]. + [{group, R} || R <- ?REASONS]. %% The group determines how transports are terminated: by remove_transport, %% stop_service or application stop. @@ -114,22 +111,6 @@ ok = diameter:start_service(?SERVER, ?SERVICE(?SERVER)), ok = diameter:start_service(?CLIENT, ?SERVICE(?CLIENT)). -send_dpr(_Config) -> - LRef = ?util:listen(?SERVER, tcp), - Ref = ?util:connect(?CLIENT, tcp, LRef, [{dpa_timeout, 10000}]), - #diameter_base_DPA{'Result-Code' = 2001} - = diameter:call(?CLIENT, - common, - ['DPR', {'Origin-Host', "CLIENT.erlang.org"}, - {'Origin-Realm', "erlang.org"}, - {'Disconnect-Cause', 0}]), - ok = receive %% endure the transport dies on DPA - #diameter_event{service = ?CLIENT, info = {down, Ref, _, _}} -> - ok - after 5000 -> - erlang:process_info(self(), messages) - end. - connect(Config) -> Pid = spawn(fun init/0), %% process for disconnect_cb to bang Grp = group(Config), diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_enum.erl erlang-17.3-dfsg/lib/diameter/test/diameter_enum.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_enum.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_enum.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_event_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_event_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_event_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_event_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-15. All Rights Reserved. +%% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -108,38 +107,29 @@ %% Connect with matching capabilities and expect the connection to %% come up. up(Config) -> - {Svc, Ref} = connect(Config, [{connect_timer, 5000}, - {watchdog_timer, 15000}]), + {Svc, Ref} = connect(Config, []), start = event(Svc), - {up, Ref, {TPid, Caps}, Cfg, #diameter_packet{}} = event(Svc), - {watchdog, Ref, _, {initial, okay}, _} = event(Svc), - %% Kill the transport process and see that the connection is - %% reestablished after a watchdog timeout, not after connect_timer - %% expiry. - exit(TPid, kill), - {down, Ref, {TPid, Caps}, Cfg} = event(Svc), - {watchdog, Ref, _, {okay, down}, _} = event(Svc), - {reconnect, Ref, _} = event(Svc, 10000, 20000). + {up, Ref, {_,_Caps}, _Config, #diameter_packet{}} = event(Svc), + {watchdog, Ref, _, {initial, okay}, _} = event(Svc). %% Connect with non-matching capabilities and expect CEA from the peer %% to indicate as much and then for the transport to be restarted -%% (after connect_timer). +%% (after reconnect_timer). down(Config) -> {Svc, Ref} = connect(Config, [{capabilities, [{'Acct-Application-Id', [?DICT_ACCT:id()]}]}, {applications, [?DICT_ACCT]}, - {connect_timer, 5000}, - {watchdog_timer, 20000}]), + {reconnect_timer, 5000}]), start = event(Svc), {closed, Ref, {'CEA', ?NO_COMMON_APP, _, #diameter_packet{}}, _} = event(Svc), - {reconnect, Ref, _} = event(Svc, 4000, 10000). + {reconnect, Ref, _} = event(Svc). %% Connect with matching capabilities but have the server delay its %% CEA and cause the client to timeout. cea_timeout(Config) -> {Svc, Ref} = connect(Config, [{capx_timeout, ?SERVER_CAPX_TMO div 2}, - {connect_timer, 2*?SERVER_CAPX_TMO}]), + {reconnect_timer, 2*?SERVER_CAPX_TMO}]), start = event(Svc), {closed, Ref, {'CEA', timeout}, _} = event(Svc). @@ -169,18 +159,12 @@ {Name, Ref}. uniq() -> - "-" ++ diameter_util:unique_string(). + {MS,S,US} = now(), + lists:flatten(io_lib:format("-~p-~p-~p-", [MS,S,US])). event(Name) -> receive #diameter_event{service = Name, info = T} -> T end. -event(Name, TL, TH) -> - T0 = diameter_lib:now(), - Event = event(Name), - DT = diameter_lib:micro_diff(T0) div 1000, - {true, true, DT, Event} = {TL < DT, DT < TH, DT, Event}, - Event. - start_service(Name, Opts) -> diameter:start_service(Name, [{monitor, self()} | Opts]). diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_examples_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_examples_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_examples_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_examples_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -296,15 +295,15 @@ [{timetrap, {minutes, 10}}]. slave(_) -> - T0 = diameter_lib:now(), + T0 = now(), {ok, Node} = ct_slave:start(?MODULE, ?TIMEOUTS), - T1 = diameter_lib:now(), - T2 = rpc:call(Node, diameter_lib, now, []), + T1 = now(), + T2 = rpc:call(Node, erlang, now, []), {ok, Node} = ct_slave:stop(?MODULE), - now_diff([T0, T1, T2, diameter_lib:now()]). + now_diff([T0, T1, T2, now()]). now_diff([T1,T2|_] = Ts) -> - [diameter_lib:micro_diff(T2,T1) | now_diff(tl(Ts))]; + [timer:now_diff(T2,T1) | now_diff(tl(Ts))]; now_diff(_) -> []. @@ -398,4 +397,4 @@ stop(Config) -> Prot = proplists:get_value(group, Config), - [] = [RC || N <- ?NODES, RC <- [catch stop(concat(Prot, N))], RC /= ok]. + [] = [RC || N <- ?NODES, RC <- [stop(concat(Prot, N))], RC /= ok]. diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_failover_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_failover_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_failover_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_failover_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_gen_sctp_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_gen_sctp_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_gen_sctp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_gen_sctp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -34,7 +33,7 @@ %% testcases -export([send_not_from_controlling_process/1, - send_from_multiple_clients/1, send_from_multiple_clients/0, + send_from_multiple_clients/1, receive_what_was_sent/1]). -include_lib("kernel/include/inet_sctp.hrl"). @@ -59,7 +58,7 @@ %% =========================================================================== suite() -> - [{timetrap, {seconds, 10}}]. + [{timetrap, {minutes, 2}}]. all() -> [send_not_from_controlling_process, @@ -120,10 +119,10 @@ send_not_from_controlling_process() -> FPid = self(), - {L, MRef} = spawn_monitor(fun() -> listen(FPid) end), + {L, MRef} = spawn_monitor(fun() -> listen(FPid) end),%% listening process receive {?MODULE, C, S} -> - demonitor(MRef, [flush]), + erlang:demonitor(MRef, [flush]), [L,C,S]; {'DOWN', MRef, process, _, _} = T -> error(T) @@ -138,7 +137,13 @@ LPid = self(), spawn(fun() -> connect1(PortNr, FPid, LPid) end), %% connecting process Id = assoc(Sock), - recv(Sock, Id). + ?SCTP(Sock, {[#sctp_sndrcvinfo{assoc_id = Id}], _Bin}) + = recv(). %% Waits with this as current_function. + +%% recv/0 + +recv() -> + receive T -> T end. %% connect1/3 @@ -149,7 +154,7 @@ FPid ! {?MODULE, self(), spawn(fun() -> send(Sock, Id) end)}, %% sending process - MRef = monitor(process, LPid), + MRef = erlang:monitor(process, LPid), down(MRef). %% Waits with this as current_function. %% down/1 @@ -168,9 +173,6 @@ %% %% Demonstrates sluggish delivery of messages. -send_from_multiple_clients() -> - [{timetrap, {seconds, 60}}]. - send_from_multiple_clients(_) -> {S, Rs} = T = send_from_multiple_clients(8, 1024), Max = ?FOREVER*1000, @@ -275,8 +277,7 @@ loop(Sock, MRef, Bin) -> receive - ?SCTP(Sock, {[#sctp_sndrcvinfo{assoc_id = Id}], B}) - when is_binary(B) -> + ?SCTP(Sock, {[#sctp_sndrcvinfo{assoc_id = Id}], B}) -> Sz = size(Bin), {Sz, Bin} = {size(B), B}, %% assert ok = send(Sock, Id, mark(Bin)), @@ -290,7 +291,7 @@ %% connect2/3 connect2(Pid, PortNr, Bin) -> - monitor(process, Pid), + erlang:monitor(process, Pid), {ok, Sock} = open(), ok = gen_sctp:connect_init(Sock, ?ADDR, PortNr, []), @@ -300,25 +301,19 @@ %% T2 = time after listening process received our message %% T3 = time after reply is received - T1 = diameter_lib:now(), + T1 = now(), ok = send(Sock, Id, Bin), T2 = unmark(recv(Sock, Id)), - T3 = diameter_lib:now(), - {diameter_lib:micro_diff(T2, T1), %% Outbound - diameter_lib:micro_diff(T3, T2)}. %% Inbound + T3 = now(), + {timer:now_diff(T2, T1), timer:now_diff(T3, T2)}. %% {Outbound, Inbound} %% recv/2 recv(Sock, Id) -> receive - ?SCTP(Sock, {[#sctp_sndrcvinfo{assoc_id = I}], Bin}) - when is_binary(Bin) -> - Id = I, %% assert + ?SCTP(Sock, {[#sctp_sndrcvinfo{assoc_id = Id}], Bin}) -> Bin; - ?SCTP(S, _) -> - Sock = S, %% assert - recv(Sock, Id); - T -> + T -> %% eg. 'DOWN' exit(T) end. @@ -330,13 +325,13 @@ %% mark/1 mark(Bin) -> - Info = term_to_binary(diameter_lib:now()), + Info = term_to_binary(now()), <>. %% unmark/1 unmark(Bin) -> - binary_to_term(Bin). + {_,_,_} = binary_to_term(Bin). %% =========================================================================== diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_gen_tcp_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_gen_tcp_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_gen_tcp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_gen_tcp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,28 +1,27 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2014-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% %% -%% Some gen_tcp-specific tests demonstrating problems that were +%% Some gen_sctp-specific tests demonstrating problems that were %% encountered during diameter development but have nothing -%% specifically to do with diameter. These can cause testcases in -%% other suites to fail. +%% specifically to do with diameter. At least one of them can cause +%% diameter_traffic_SUITE testcases to fail. %% -module(diameter_gen_tcp_SUITE). @@ -31,8 +30,7 @@ all/0]). %% testcases --export([send_long/1, - connect/1]). +-export([send_long/1]). -define(LOOPBACK, {127,0,0,1}). -define(GEN_OPTS, [binary, {active, true}, {ip, ?LOOPBACK}]). @@ -40,11 +38,10 @@ %% =========================================================================== suite() -> - [{timetrap, {seconds, 10}}]. + [{timetrap, {minutes, 2}}]. all() -> - [connect, %% Appears to fail only when run first. - send_long]. + [send_long]. %% =========================================================================== @@ -90,6 +87,15 @@ LPid ! {self(), fun(B) -> send(Sock, B) end}, down(LPid). +%% down/1 + +down(Pid) + when is_pid(Pid) -> + down(erlang:monitor(process, Pid)); + +down(MRef) -> + receive {'DOWN', MRef, process, _, Reason} -> Reason end. + %% send/2 %% %% Send from a spawned process just to avoid sending from the @@ -98,47 +104,3 @@ send(Sock, Bin) -> {_, MRef} = spawn_monitor(fun() -> exit(gen_tcp:send(Sock, Bin)) end), down(MRef). - -%% =========================================================================== - -%% connect/1 -%% -%% Test that simultaneous connections succeed. This fails sporadically -%% on OS X at the time of writing, when gen_tcp:connect/2 returns -%% {error, econnreset}. - -connect(_) -> - {ok, LSock} = gen_tcp:listen(0, ?GEN_OPTS), - {ok, {_,PortNr}} = inet:sockname(LSock), - Count = lists:seq(1,8), %% 8 simultaneous connects - As = [gen_accept(LSock) || _ <- Count], - %% Wait for spawned processes to have called gen_tcp:accept/1 - %% (presumably). - receive after 2000 -> ok end, - Cs = [gen_connect(PortNr) || _ <- Count], - [] = failures(Cs), - [] = failures(As). - -failures(Monitors) -> - [RC || {_, MRef} <- Monitors, RC <- [down(MRef)], ok /= element(1, RC)]. - -gen_accept(LSock) -> - spawn_monitor(fun() -> - exit(gen_tcp:accept(LSock)) - end). - -gen_connect(PortNr) -> - spawn_monitor(fun() -> - exit(gen_tcp:connect(?LOOPBACK, PortNr, ?GEN_OPTS)) - end). - -%% =========================================================================== - -%% down/1 - -down(Pid) - when is_pid(Pid) -> - down(monitor(process, Pid)); - -down(MRef) -> - receive {'DOWN', MRef, process, _, Reason} -> Reason end. diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_length_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_length_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_length_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_length_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_pool_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_pool_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_pool_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_pool_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,134 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% -%% Test of the pool_size option in connecting nodes with multiple -%% connections. -%% - --module(diameter_pool_SUITE). - --export([suite/0, - all/0, - init_per_testcase/2, - end_per_testcase/2, - init_per_suite/1, - end_per_suite/1]). - -%% testcases --export([tcp_connect/1, - sctp_connect/1, - any_connect/1]). - -%% =========================================================================== - --define(util, diameter_util). - -%% Config for diameter:start_service/2. --define(SERVICE(Host), - [{'Origin-Host', Host ++ ".ericsson.com"}, - {'Origin-Realm', "ericsson.com"}, - {'Host-IP-Address', [{127,0,0,1}]}, - {'Vendor-Id', 12345}, - {'Product-Name', "OTP/diameter"}, - {'Auth-Application-Id', [0]}, %% common - {'Acct-Application-Id', [3]}, %% accounting - {restrict_connections, false}, - {application, [{alias, common}, - {dictionary, diameter_gen_base_rfc6733}, - {module, diameter_callback}]}, - {application, [{alias, accounting}, - {dictionary, diameter_gen_acct_rfc6733}, - {module, diameter_callback}]}]). - -%% =========================================================================== - -suite() -> - [{timetrap, {seconds, 30}}]. - -all() -> - [tcp_connect, - sctp_connect, - any_connect]. - -init_per_testcase(_Name, Config) -> - Config. - -end_per_testcase(_Name, _Config) -> - diameter:stop(). - -init_per_suite(Config) -> - [{sctp, ?util:have_sctp()} | Config]. - -end_per_suite(_Config) -> - ok. - -%% =========================================================================== - -tcp_connect(_Config) -> - connect(tcp, tcp). - -sctp_connect(Config) -> - case lists:member({sctp, true}, Config) of - true -> connect(sctp, sctp); - false -> {skip, no_sctp} - end. - -any_connect(_Config) -> - connect(any, tcp). - -%% connect/2 - -%% Establish multiple connections between a client and server. -connect(ClientProt, ServerProt) -> - ok = diameter:start(), - [] = [{S,T} || S <- ["server", "client"], - T <- [diameter:start_service(S, ?SERVICE(S))], - T /= ok], - %% Listen with a single transport with pool_size = 4. Ensure the - %% expected number of transport processes are started. - LRef = ?util:listen("server", ServerProt, [{pool_size, 4}]), - {4,0} = count("server", LRef, accept), %% 4 transports, no connections - %% Establish 5 connections. - Ref = ?util:connect("client", ClientProt, LRef, [{pool_size, 5}]), - {5,5} = count("client", Ref, pool), %% 5 connections - %% Ensure the server has started replacement transports within a - %% reasonable time. Sleepsince there's no guarantee the - %% replacements have been started before the client has received - %% 'up' events. (Although it's likely.) - sleep(), - {9,5} = count("server", LRef, accept), %% 5 connections + 4 accepting - %% Ensure ther are still the expected number of accepting transports - %% after stopping the client service. - ok = diameter:stop_service("client"), - sleep(), - {4,0} = count("server", LRef, accept), %% 4 transports, no connections - %% Done. - ok = diameter:stop_service("server"). - -count(Name, Ref, Key) -> - [{transport, [[{ref, Ref} | T]]}, - {connections, Cs}] - = diameter:service_info(Name, [transport, connections]), - {Key, Ps} = lists:keyfind(Key, 1, T), - {length(Ps), length(Cs)}. %% number of processes, connections - -sleep() -> - receive after 1000 -> ok end. diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_reg_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_reg_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_reg_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_reg_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_relay_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_relay_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_relay_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_relay_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -50,7 +49,6 @@ send_timeout_1/1, send_timeout_2/1, info/1, - counters/1, disconnect/1, stop_services/1, stop/1]). @@ -122,7 +120,6 @@ start_services, connect, {group, all}, - counters, {group, all, [parallel]}, disconnect, stop_services, @@ -204,8 +201,8 @@ send4(_Config) -> call(?SERVER4). -%% Send an ASR that loops between the relays (RELAY1 -> RELAY2 -> -%% RELAY1) and expect the loop to be detected. +%% Send an ASR that loops between the relays and expect the loop to +%% be detected. send_loop(_Config) -> Req = ['ASR', {'Destination-Realm', realm(?SERVER1)}, {'Destination-Host', ?SERVER1}, @@ -230,103 +227,8 @@ call(Req, [{filter, realm}, {timeout, Tmo}]). info(_Config) -> - %% Wait for RELAY1 to have answered all requests, so that the - %% suite doesn't end before all answers are sent and counted. - receive after 6000 -> ok end, [] = ?util:info(). -counters(_Config) -> - [] = ?util:run([[fun counters/2, K, S] - || K <- [statistics, transport, connections], - S <- ?SERVICES]). - -counters(Key, Svc) -> - counters(Key, Svc, [_|_] = diameter:service_info(Svc, Key)). - -counters(statistics, Svc, Stats) -> - stats(Svc, lists:foldl(fun({K,N},D) -> orddict:update_counter(K, N, D) end, - orddict:new(), - lists:append([L || {P,L} <- Stats, is_pid(P)]))); - -counters(_, _, _) -> - todo. - -stats(?CLIENT, L) -> - [{{{0,257,0},recv},2}, %% CEA - {{{0,257,1},send},2}, %% CER - {{{0,258,0},recv},1}, %% RAA (send_timeout_1) - {{{0,258,1},send},2}, %% RAR (send_timeout_[12]) - {{{0,274,0},recv},1}, %% ASA (send_loop) - {{{0,274,1},send},1}, %% ASR (send_loop) - {{{0,275,0},recv},4}, %% STA (send[1-4]) - {{{0,275,1},send},4}, %% STR (send[1-4]) - {{{unknown,0},recv,discarded},1}, %% RAR (send_timeout_2) - {{{0,257,0},recv,{'Result-Code',2001}},2}, %% CEA - {{{0,258,0},recv,{'Result-Code',3002}},1}, %% RAA (send_timeout_1) - {{{0,274,0},recv,{'Result-Code',3005}},1}, %% ASA (send_loop) - {{{0,275,0},recv,{'Result-Code',2001}},4}] %% STA (send[1-4]) - = L; - -stats(S, L) - when S == ?SERVER1; - S == ?SERVER2; - S == ?SERVER3; - S == ?SERVER4 -> - [{{{0,257,0},send},1}, %% CEA - {{{0,257,1},recv},1}, %% CER - {{{0,275,0},send},1}, %% STA (send[1-4]) - {{{0,275,1},recv},1}, %% STR (send[1-4]) - {{{0,257,0},send,{'Result-Code',2001}},1}, %% CEA - {{{0,275,0},send,{'Result-Code',2001}},1}] %% STA (send[1-4]) - = L; - -stats(?RELAY1, L) -> - [{{{relay,0},recv},3}, %% STA x 2 (send[12]) - %% ASA (send_loop) - {{{relay,0},send},6}, %% STA x 2 (send[12]) - %% ASA x 2 (send_loop) - %% RAA x 2 (send_timeout_[12]) - {{{relay,1},recv},6}, %% STR x 2 (send[12]) - %% ASR x 2 (send_loop) - %% RAR x 2 (send_timeout_[12]) - {{{relay,1},send},5}, %% STR x 2 (send[12]) - %% ASR (send_loop) - %% RAR x 2 (send_timeout_[12]) - {{{0,257,0},recv},3}, %% CEA - {{{0,257,0},send},1}, %% " - {{{0,257,1},recv},1}, %% CER - {{{0,257,1},send},3}, %% " - {{{relay,0},recv,{'Result-Code',2001}},2}, %% STA x 2 (send[34]) - {{{relay,0},recv,{'Result-Code',3005}},1}, %% ASA (send_loop) - {{{relay,0},send,{'Result-Code',2001}},2}, %% STA x 2 (send[34]) - {{{relay,0},send,{'Result-Code',3002}},2}, %% RAA (send_timeout_[12]) - {{{relay,0},send,{'Result-Code',3005}},2}, %% ASA (send_loop) - {{{0,257,0},recv,{'Result-Code',2001}},3}, %% CEA - {{{0,257,0},send,{'Result-Code',2001}},1}] %% " - = L; - -stats(?RELAY2, L) -> - [{{{relay,0},recv},3}, %% STA x 2 (send[34]) - %% ASA (send_loop) - {{{relay,0},send},3}, %% STA x 2 (send[34]) - %% ASA (send_loop) - {{{relay,1},recv},5}, %% STR x 2 (send[34]) - %% RAR x 2 (send_timeout_[12]) - %% ASR (send_loop) - {{{relay,1},send},3}, %% STR x 2 (send[34]) - %% ASR (send_loop) - {{{0,257,0},recv},2}, %% CEA - {{{0,257,0},send},2}, %% " - {{{0,257,1},recv},2}, %% CER - {{{0,257,1},send},2}, %% " - {{{relay,0},recv,{'Result-Code',2001}},2}, %% STA x 2 (send[34]) - {{{relay,0},recv,{'Result-Code',3005}},1}, %% ASA (send_loop) - {{{relay,0},send,{'Result-Code',2001}},2}, %% STA x 2 (send[34]) - {{{relay,0},send,{'Result-Code',3005}},1}, %% ASA (send_loop) - {{{0,257,0},recv,{'Result-Code',2001}},2}, %% CEA - {{{0,257,0},send,{'Result-Code',2001}},2}] %% " - = L. - %% =========================================================================== realm(Host) -> @@ -334,39 +236,13 @@ call(Server) -> Realm = realm(Server), - %% Include some arbitrary AVPs to exercise encode/decode, that - %% are received back in the STA. - Avps = [#diameter_avp{code = 111, - data = [#diameter_avp{code = 222, - data = <<222:24>>}, - #diameter_avp{code = 333, - data = <<333:16>>}]}, - #diameter_avp{code = 444, - data = <<444:24>>}, - #diameter_avp{code = 555, - data = [#diameter_avp{code = 666, - data = [#diameter_avp - {code = 777, - data = <<7>>}]}, - #diameter_avp{code = 888, - data = <<8>>}, - #diameter_avp{code = 999, - data = <<9>>}]}], - Req = ['STR', {'Destination-Realm', Realm}, {'Destination-Host', [Server]}, {'Termination-Cause', ?LOGOUT}, - {'Auth-Application-Id', ?APP_ID}, - {'AVP', Avps}], - + {'Auth-Application-Id', ?APP_ID}], #diameter_base_STA{'Result-Code' = ?SUCCESS, 'Origin-Host' = Server, - 'Origin-Realm' = Realm, - %% Unknown AVPs can't be decoded as Grouped since - %% types aren't known. - 'AVP' = [#diameter_avp{code = 111}, - #diameter_avp{code = 444}, - #diameter_avp{code = 555}]} + 'Origin-Realm' = Realm} = call(Req, [{filter, realm}]). call(Req, Opts) -> @@ -427,24 +303,18 @@ when OH /= ?CLIENT -> request(Pkt, Caps). -%% RELAY1 answers ACR after it's timed out at the client. -request(#diameter_packet{header = #diameter_header{cmd_code = 271}}, - #diameter_caps{origin_host = {?RELAY1, _}}) -> - receive after 1000 -> {answer_message, 3004} end; %% TOO_BUSY - -%% RELAY1 routes any ASR or RAR to RELAY2. +%% RELAY1 routes any ASR or RAR to RELAY2 ... request(#diameter_packet{header = #diameter_header{cmd_code = C}}, #diameter_caps{origin_host = {?RELAY1, _}}) when C == 274; %% ASR C == 258 -> %% RAR {relay, [{filter, {realm, realm(?RELAY2)}}]}; -%% RELAY2 routes ASR back to RELAY1 to induce DIAMETER_LOOP_DETECTED. +%% ... which in turn routes it back. Expect diameter to either answer +%% either with DIAMETER_LOOP_DETECTED/DIAMETER_UNABLE_TO_COMPLY. request(#diameter_packet{header = #diameter_header{cmd_code = 274}}, #diameter_caps{origin_host = {?RELAY2, _}}) -> {relay, [{filter, {host, ?RELAY1}}]}; - -%% RELAY2 discards RAR to induce DIAMETER_UNABLE_TO_DELIVER. request(#diameter_packet{header = #diameter_header{cmd_code = 258}}, #diameter_caps{origin_host = {?RELAY2, _}}) -> discard; @@ -460,18 +330,9 @@ request(#diameter_packet{msg = #diameter_base_STR{'Session-Id' = SId, 'Origin-Host' = Host, 'Origin-Realm' = Realm, - 'Route-Record' = Route, - 'AVP' = Avps}}, + 'Route-Record' = Route}}, #diameter_caps{origin_host = {OH, _}, origin_realm = {OR, _}}) -> - - %% Payloads of unknown AVPs aren't decoded, so we don't know that - %% some types here are Grouped. - [#diameter_avp{code = 111, vendor_id = undefined}, - #diameter_avp{code = 444, vendor_id = undefined, data = <<444:24>>}, - #diameter_avp{code = 555, vendor_id = undefined}] - = Avps, - %% The request should have the Origin-Host/Realm of the original %% sender. R = realm(?CLIENT), @@ -482,5 +343,4 @@ {reply, #diameter_base_STA{'Result-Code' = ?SUCCESS, 'Session-Id' = SId, 'Origin-Host' = OH, - 'Origin-Realm' = OR, - 'AVP' = Avps}}. + 'Origin-Realm' = OR}}. diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_stats_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_stats_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_stats_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_stats_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -96,7 +95,7 @@ 7 = ?stat:incr(C1, Ref, 7), Self = self(), [{Ref, [{C1,7}]}, {Self, [{C1,2}, {C2,1}]}] - = ?stat:read([self(), Ref, make_ref()]), + = lists:sort(?stat:read([self(), Ref, make_ref()])), [] = ?stat:read([]), [] = ?stat:read([make_ref()]), ?stat:flush([self(), Ref, make_ref()]). @@ -116,7 +115,7 @@ [{Self, [{C1,1}, {C2,2}]}] = ?stat:sum([self()]), [{Ref, [{C1,7}]}, {Self, [{C1,1}, {C2,2}]}] - = ?stat:flush([self(), Ref]). + = lists:sort(?stat:flush([self(), Ref])). flush(_) -> Ref = make_ref(), diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_sync_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_sync_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_sync_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_sync_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_tls_SUITE_data/Makefile.ca erlang-17.3-dfsg/lib/diameter/test/diameter_tls_SUITE_data/Makefile.ca --- erlang-18.2-dfsg/lib/diameter/test/diameter_tls_SUITE_data/Makefile.ca 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_tls_SUITE_data/Makefile.ca 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_tls_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_tls_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_tls_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_tls_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -320,19 +319,19 @@ make_cert(Dir, Base ++ "_key.pem", Base ++ "_ca.pem"). make_cert(Dir, Keyfile, Certfile) -> - [KP,CP] = [filename:join([Dir, F]) || F <- [Keyfile, Certfile]], + [K,C] = Paths = [filename:join([Dir, F]) || F <- [Keyfile, Certfile]], - KC = join(["openssl genrsa -out", KP, "2048"]), - CC = join(["openssl req -new -x509 -key", KP, "-out", CP, "-days 7", - "-subj /C=SE/ST=./L=Stockholm/CN=www.erlang.org"]), + KCmd = join(["openssl genrsa -out", K, "2048"]), + CCmd = join(["openssl req -new -x509 -key", K, "-out", C, "-days 7", + "-subj /C=SE/ST=./L=Stockholm/CN=www.erlang.org"]), %% Hope for the best and only check that files are written. - [{_, _, {ok,_}},{_, _, {ok,_}}] - = [{P,O,T} || {P,C} <- [{KP,KC}, {CP,CC}], - O <- [os:cmd(C)], - T <- [file:read_file_info(P)]], + os:cmd(KCmd), + os:cmd(CCmd), + + [_,_] = [T || P <- Paths, {ok, T} <- [file:read_file_info(P)]], - {KP,CP}. + {K,C}. join(Strs) -> string:join(Strs, " "). diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_traffic_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_traffic_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_traffic_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_traffic_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -42,14 +41,12 @@ send_eval/1, send_bad_answer/1, send_protocol_error/1, - send_experimental_result/1, send_arbitrary/1, send_unknown/1, send_unknown_short/1, send_unknown_mandatory/1, send_unknown_short_mandatory/1, send_noreply/1, - send_grouped_error/1, send_unsupported/1, send_unsupported_app/1, send_error_bit/1, @@ -62,7 +59,6 @@ send_unexpected_mandatory_decode/1, send_unexpected_mandatory/1, send_long/1, - send_maxlen/1, send_nopeer/1, send_noapp/1, send_discard/1, @@ -126,6 +122,8 @@ -define(ADDR, {127,0,0,1}). +-define(CLIENT, "CLIENT"). +-define(SERVER, "SERVER"). -define(REALM, "erlang.org"). -define(HOST(Host, Realm), Host ++ [$.|Realm]). @@ -143,23 +141,11 @@ %% Which common dictionary to use in the clients. -define(RFCS, [rfc3588, rfc6733]). -%% Whether to decode stringish Diameter types to strings, or leave -%% them as binary. --define(STRING_DECODES, [true, false]). - -%% Which transport protocol to use. --define(TRANSPORTS, [tcp, sctp]). - -record(group, - {transport, - client_service, - client_encoding, + {client_encoding, client_dict0, - client_strings, - server_service, server_encoding, - server_container, - server_strings}). + server_container}). %% Not really what we should be setting unless the message is sent in %% the common application but diameter doesn't care. @@ -180,7 +166,7 @@ ?answer_message(_, ResultCode)). %% Config for diameter:start_service/2. --define(SERVICE(Name, Decode), +-define(SERVICE(Name), [{'Origin-Host', Name ++ "." ++ ?REALM}, {'Origin-Realm', ?REALM}, {'Host-IP-Address', [?ADDR]}, @@ -189,8 +175,6 @@ {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, {'Acct-Application-Id', [?DIAMETER_APP_ID_ACCOUNTING]}, {restrict_connections, false}, - {string_decode, Decode}, - {incoming_maxlen, 1 bsl 21}, {spawn_opt, [{min_heap_size, 5000}]} | [{application, [{dictionary, D}, {module, ?MODULE}, @@ -240,78 +224,37 @@ %% =========================================================================== suite() -> - [{timetrap, {seconds, 10}}]. + [{timetrap, {seconds, 60}}]. all() -> - [start, result_codes, {group, traffic}, outstanding, empty, stop]. + [start, start_services, add_transports, result_codes] + ++ [{group, ?util:name([R,D,A,C]), P} || R <- ?ENCODINGS, + D <- ?RFCS, + A <- ?ENCODINGS, + C <- ?CONTAINERS, + P <- [[], [parallel]]] + ++ [outstanding, remove_transports, empty, stop_services, stop]. groups() -> Ts = tc(), - Sctp = ?util:have_sctp(), - [{?util:name([R,D,A,C]), [parallel], Ts} || R <- ?ENCODINGS, - D <- ?RFCS, - A <- ?ENCODINGS, - C <- ?CONTAINERS] - ++ - [{?util:name([T,R,D,A,C,SD,CD]), - [], - [start_services, - add_transports, - result_codes, - {group, ?util:name([R,D,A,C])}, - remove_transports, - stop_services]} - || T <- ?TRANSPORTS, - T /= sctp orelse Sctp, - R <- ?ENCODINGS, - D <- ?RFCS, - A <- ?ENCODINGS, - C <- ?CONTAINERS, - SD <- ?STRING_DECODES, - CD <- ?STRING_DECODES] - ++ - [{traffic, [], [{group, ?util:name([T,R,D,A,C,SD,CD])} - || T <- ?TRANSPORTS, - T /= sctp orelse Sctp, - R <- ?ENCODINGS, - D <- ?RFCS, - A <- ?ENCODINGS, - C <- ?CONTAINERS, - SD <- ?STRING_DECODES, - CD <- ?STRING_DECODES]}]. + [{?util:name([R,D,A,C]), [], Ts} || R <- ?ENCODINGS, + D <- ?RFCS, + A <- ?ENCODINGS, + C <- ?CONTAINERS]. init_per_group(Name, Config) -> - case ?util:name(Name) of - [T,R,D,A,C,SD,CD] -> - G = #group{transport = T, - client_service = [$C|?util:unique_string()], - client_encoding = R, - client_dict0 = dict0(D), - client_strings = CD, - server_service = [$S|?util:unique_string()], - server_encoding = A, - server_container = C, - server_strings = SD}, - [{group, G} | Config]; - _ -> - Config - end. + [R,D,A,C] = ?util:name(Name), + G = #group{client_encoding = R, + client_dict0 = dict0(D), + server_encoding = A, + server_container = C}, + [{group, G} | Config]. end_per_group(_, _) -> ok. -%% Skip testcases that can reasonably fail under SCTP. init_per_testcase(Name, Config) -> - case [skip || #group{transport = sctp} - <- [proplists:get_value(group, Config)], - send_maxlen == Name - orelse send_long == Name] - of - [skip] -> - {skip, sctp}; - [] -> - [{testcase, Name} | Config] - end. + [{testcase, Name} | Config]. end_per_testcase(_, _) -> ok. @@ -324,14 +267,12 @@ send_eval, send_bad_answer, send_protocol_error, - send_experimental_result, send_arbitrary, send_unknown, send_unknown_short, send_unknown_mandatory, send_unknown_short_mandatory, send_noreply, - send_grouped_error, send_unsupported, send_unsupported_app, send_error_bit, @@ -344,7 +285,6 @@ send_unexpected_mandatory_decode, send_unexpected_mandatory, send_long, - send_maxlen, send_nopeer, send_noapp, send_discard, @@ -379,29 +319,19 @@ start(_Config) -> ok = diameter:start(). -start_services(Config) -> - #group{client_service = CN, - client_strings = CD, - server_service = SN, - server_strings = SD} - = group(Config), - ok = diameter:start_service(SN, ?SERVICE(SN, SD)), - ok = diameter:start_service(CN, [{sequence, ?CLIENT_MASK} - | ?SERVICE(CN, CD)]). +start_services(_Config) -> + ok = diameter:start_service(?SERVER, ?SERVICE(?SERVER)), + ok = diameter:start_service(?CLIENT, [{sequence, ?CLIENT_MASK} + | ?SERVICE(?CLIENT)]). add_transports(Config) -> - #group{transport = T, - client_service = CN, - server_service = SN} - = group(Config), - LRef = ?util:listen(SN, - T, + LRef = ?util:listen(?SERVER, + tcp, [{capabilities_cb, fun capx/2}, - {pool_size, 8}, {spawn_opt, [{min_heap_size, 8096}]}, {applications, apps(rfc3588)}]), - Cs = [?util:connect(CN, - T, + Cs = [?util:connect(?CLIENT, + tcp, LRef, [{id, Id}, {capabilities, [{'Origin-State-Id', origin(Id)}]}, @@ -424,18 +354,12 @@ is_atom(element(1,T))]. remove_transports(Config) -> - #group{client_service = CN, - server_service = SN} - = group(Config), [LRef | Cs] = ?util:read_priv(Config, "transport"), - [?util:disconnect(CN, C, SN, LRef) || C <- Cs]. + [?util:disconnect(?CLIENT, C, ?SERVER, LRef) || C <- Cs]. -stop_services(Config) -> - #group{client_service = CN, - server_service = SN} - = group(Config), - ok = diameter:stop_service(CN), - ok = diameter:stop_service(SN). +stop_services(_Config) -> + ok = diameter:stop_service(?CLIENT), + ok = diameter:stop_service(?SERVER). %% Ensure even transports have been removed from request table. empty(_Config) -> @@ -470,7 +394,7 @@ Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, {'Accounting-Record-Number', 1}], - ['ACA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | _] + ['ACA', _SessionId, {'Result-Code', ?SUCCESS} | _] = call(Config, Req). %% Send an accounting ACR that the server answers badly to. @@ -486,17 +410,16 @@ Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, {'Accounting-Record-Number', 3}], - ['ACA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | _] + ['ACA', _SessionId, {'Result-Code', ?SUCCESS} | _] = call(Config, Req). %% Send an accounting ACR that the server tries to answer with an -%% inappropriate header. That the error is detected is coded in -%% handle_answer. +%% inappropriate header, resulting in no answer being sent and the +%% request timing out. send_bad_answer(Config) -> Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, {'Accounting-Record-Number', 2}], - ?answer_message(?SUCCESS) - = call(Config, Req). + {timeout, _} = call(Config, Req). %% Send an ACR that the server callback answers explicitly with a %% protocol error. @@ -507,32 +430,23 @@ ?answer_message(?TOO_BUSY) = call(Config, Req). -%% Send a 3xxx Experimental-Result in an answer not setting the E-bit -%% and missing a Result-Code. -send_experimental_result(Config) -> - Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, - {'Accounting-Record-Number', 5}], - ['ACA', {'Session-Id', _} | _] - = call(Config, Req). - %% Send an ASR with an arbitrary non-mandatory AVP and expect success %% and the same AVP in the reply. send_arbitrary(Config) -> Req = ['ASR', {'AVP', [#diameter_avp{name = 'Product-Name', value = "XXX"}]}], - ['ASA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | Avps] + ['ASA', _SessionId, {'Result-Code', ?SUCCESS} | Avps] = call(Config, Req), {'AVP', [#diameter_avp{name = 'Product-Name', - value = V}]} - = lists:last(Avps), - "XXX" = string(V, Config). + value = "XXX"}]} + = lists:last(Avps). %% Send an unknown AVP (to some client) and check that it comes back. send_unknown(Config) -> Req = ['ASR', {'AVP', [#diameter_avp{code = 999, is_mandatory = false, data = <<17>>}]}], - ['ASA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | Avps] + ['ASA', _SessionId, {'Result-Code', ?SUCCESS} | Avps] = call(Config, Req), {'AVP', [#diameter_avp{code = 999, is_mandatory = false, @@ -548,7 +462,7 @@ Req = ['ASR', {'AVP', [#diameter_avp{code = 999, is_mandatory = M, data = <<17>>}]}], - ['ASA', {'Session-Id', _}, {'Result-Code', RC} | Avps] + ['ASA', _SessionId, {'Result-Code', RC} | Avps] = call(Config, Req), [#'diameter_base_Failed-AVP'{'AVP' = As}] = proplists:get_value('Failed-AVP', Avps), @@ -562,7 +476,7 @@ Req = ['ASR', {'AVP', [#diameter_avp{code = 999, is_mandatory = true, data = <<17>>}]}], - ['ASA', {'Session-Id', _}, {'Result-Code', ?AVP_UNSUPPORTED} | Avps] + ['ASA', _SessionId, {'Result-Code', ?AVP_UNSUPPORTED} | Avps] = call(Config, Req), [#'diameter_base_Failed-AVP'{'AVP' = As}] = proplists:get_value('Failed-AVP', Avps), @@ -576,13 +490,13 @@ send_unknown_short_mandatory(Config) -> send_unknown_short(Config, true, ?INVALID_AVP_LENGTH). -%% Send an ASR containing an unexpected mandatory Session-Timeout. +%% Send an ACR containing an unexpected mandatory Session-Timeout. %% Expect 5001, and check that the value in Failed-AVP was decoded. send_unexpected_mandatory_decode(Config) -> Req = ['ASR', {'AVP', [#diameter_avp{code = 27, %% Session-Timeout is_mandatory = true, data = <<12:32>>}]}], - ['ASA', {'Session-Id', _}, {'Result-Code', ?AVP_UNSUPPORTED} | Avps] + ['ASA', _SessionId, {'Result-Code', ?AVP_UNSUPPORTED} | Avps] = call(Config, Req), [#'diameter_base_Failed-AVP'{'AVP' = As}] = proplists:get_value('Failed-AVP', Avps), @@ -592,25 +506,6 @@ data = <<12:32>>}] = As. -%% Send an containing a faulty Grouped AVP (empty Proxy-Host in -%% Proxy-Info) and expect that only the faulty AVP is sent in -%% Failed-AVP. The encoded values of Proxy-Host and Proxy-State are -%% swapped in prepare_request since an empty Proxy-Host is an encode -%% error. -send_grouped_error(Config) -> - Req = ['ASR', {'Proxy-Info', [[{'Proxy-Host', "abcd"}, - {'Proxy-State', ""}]]}], - ['ASA', {'Session-Id', _}, {'Result-Code', ?INVALID_AVP_LENGTH} | Avps] - = call(Config, Req), - [#'diameter_base_Failed-AVP'{'AVP' = As}] - = proplists:get_value('Failed-AVP', Avps), - [#diameter_avp{name = 'Proxy-Info', - value = #'diameter_base_Proxy-Info' - {'Proxy-Host' = Empty, - 'Proxy-State' = undefined}}] - = As, - <<0>> = iolist_to_binary(Empty). - %% Send an STR that the server ignores. send_noreply(Config) -> Req = ['STR', {'Termination-Cause', ?BAD_ANSWER}], @@ -637,7 +532,7 @@ %% Send a bad version and check that we get 5011. send_unsupported_version(Config) -> Req = ['STR', {'Termination-Cause', ?LOGOUT}], - ['STA', {'Session-Id', _}, {'Result-Code', ?UNSUPPORTED_VERSION} | _] + ['STA', _SessionId, {'Result-Code', ?UNSUPPORTED_VERSION} | _] = call(Config, Req). %% Send a request containing an AVP length > data size. @@ -657,14 +552,14 @@ send_invalid_avp_length(Config) -> Req = ['STR', {'Termination-Cause', ?LOGOUT}], - ['STA', {'Session-Id', _}, + ['STA', _SessionId, {'Result-Code', ?INVALID_AVP_LENGTH}, - {'Origin-Host', _}, - {'Origin-Realm', _}, - {'User-Name', _}, - {'Class', _}, - {'Error-Message', _}, - {'Error-Reporting-Host', _}, + _OriginHost, + _OriginRealm, + _UserName, + _Class, + _ErrorMessage, + _ErrorReportingHost, {'Failed-AVP', [#'diameter_base_Failed-AVP'{'AVP' = [_]}]} | _] = call(Config, Req). @@ -682,33 +577,25 @@ send_unexpected_mandatory(Config) -> Req = ['STR', {'Termination-Cause', ?LOGOUT}], - ['STA', {'Session-Id', _}, {'Result-Code', ?AVP_UNSUPPORTED} | _] + ['STA', _SessionId, {'Result-Code', ?AVP_UNSUPPORTED} | _] = call(Config, Req). %% Send something long that will be fragmented by TCP. send_long(Config) -> Req = ['STR', {'Termination-Cause', ?LOGOUT}, {'User-Name', [lists:duplicate(1 bsl 20, $X)]}], - ['STA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | _] + ['STA', _SessionId, {'Result-Code', ?SUCCESS} | _] = call(Config, Req). -%% Send something longer than the configure incoming_maxlen. -send_maxlen(Config) -> - Req = ['STR', {'Termination-Cause', ?LOGOUT}, - {'User-Name', [lists:duplicate(1 bsl 21, $X)]}], - {timeout, _} = call(Config, Req). - %% Send something for which pick_peer finds no suitable peer. send_nopeer(Config) -> Req = ['STR', {'Termination-Cause', ?LOGOUT}], {error, no_connection} = call(Config, Req, [{extra, [?EXTRA]}]). %% Send something on an unconfigured application. -send_noapp(Config) -> - #group{client_service = CN} - = group(Config), +send_noapp(_Config) -> Req = ['STR', {'Termination-Cause', ?LOGOUT}], - {error, no_connection} = diameter:call(CN, unknown_alias, Req). + {error, no_connection} = diameter:call(?CLIENT, unknown_alias, Req). %% Send something that's discarded by prepare_request. send_discard(Config) -> @@ -720,10 +607,8 @@ Req = ['STR', {'Termination-Cause', ?LOGOUT}], {error, no_connection} = call(Config, Req, [{filter, {any, []}}]). send_any_2(Config) -> - #group{server_service = SN} - = group(Config), Req = ['STR', {'Termination-Cause', ?LOGOUT}, - {'Destination-Host', [?HOST(SN, "unknown.org")]}], + {'Destination-Host', [?HOST(?SERVER, "unknown.org")]}], ?answer_message(?UNABLE_TO_DELIVER) = call(Config, Req, [{filter, {any, [host, realm]}}]). @@ -731,14 +616,12 @@ send_all_1(Config) -> Req = ['STR', {'Termination-Cause', ?LOGOUT}], Realm = lists:foldr(fun(C,A) -> [C,A] end, [], ?REALM), - ['STA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | _] + ['STA', _SessionId, {'Result-Code', ?SUCCESS} | _] = call(Config, Req, [{filter, {all, [{host, any}, {realm, Realm}]}}]). send_all_2(Config) -> - #group{server_service = SN} - = group(Config), Req = ['STR', {'Termination-Cause', ?LOGOUT}, - {'Destination-Host', [?HOST(SN, "unknown.org")]}], + {'Destination-Host', [?HOST(?SERVER, "unknown.org")]}], {error, no_connection} = call(Config, Req, [{filter, {all, [host, realm]}}]). @@ -751,8 +634,9 @@ %% received the Session-Id. send_error(Config) -> Req = ['RAR', {'Re-Auth-Request-Type', ?AUTHORIZE_AUTHENTICATE}], - ?answer_message([_], ?TOO_BUSY) - = call(Config, Req). + ?answer_message(SId, ?TOO_BUSY) + = call(Config, Req), + true = undefined /= SId. %% Send a request with the detached option and receive it as a message %% from handle_answer instead. @@ -761,7 +645,7 @@ Ref = make_ref(), ok = call(Config, Req, [{extra, [{self(), Ref}]}, detach]), Ans = receive {Ref, T} -> T end, - ['STA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | _] + ['STA', _SessionId, {'Result-Code', ?SUCCESS} | _] = Ans. %% Send a request which can't be encoded and expect {error, encode}. @@ -770,15 +654,13 @@ %% Send with filtering and expect success. send_destination_1(Config) -> - #group{server_service = SN} - = group(Config), Req = ['STR', {'Termination-Cause', ?LOGOUT}, - {'Destination-Host', [?HOST(SN, ?REALM)]}], - ['STA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | _] + {'Destination-Host', [?HOST(?SERVER, ?REALM)]}], + ['STA', _SessionId, {'Result-Code', ?SUCCESS} | _] = call(Config, Req, [{filter, {all, [host, realm]}}]). send_destination_2(Config) -> Req = ['STR', {'Termination-Cause', ?LOGOUT}], - ['STA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | _] + ['STA', _SessionId, {'Result-Code', ?SUCCESS} | _] = call(Config, Req, [{filter, {all, [host, realm]}}]). %% Send with filtering on and expect failure when specifying an @@ -789,10 +671,8 @@ {error, no_connection} = call(Config, Req, [{filter, {all, [host, realm]}}]). send_destination_4(Config) -> - #group{server_service = SN} - = group(Config), Req = ['STR', {'Termination-Cause', ?LOGOUT}, - {'Destination-Host', [?HOST(SN, "unknown.org")]}], + {'Destination-Host', [?HOST(?SERVER, "unknown.org")]}], {error, no_connection} = call(Config, Req, [{filter, {all, [host, realm]}}]). @@ -804,10 +684,8 @@ ?answer_message(?REALM_NOT_SERVED) = call(Config, Req). send_destination_6(Config) -> - #group{server_service = SN} - = group(Config), Req = ['STR', {'Termination-Cause', ?LOGOUT}, - {'Destination-Host', [?HOST(SN, "unknown.org")]}], + {'Destination-Host', [?HOST(?SERVER, "unknown.org")]}], ?answer_message(?UNABLE_TO_DELIVER) = call(Config, Req). @@ -842,7 +720,7 @@ %% Specify multiple filter options and expect them be conjunctive. send_multiple_filters_1(Config) -> Fun = fun(#diameter_caps{}) -> true end, - ['STA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | _] + ['STA', _SessionId, {'Result-Code', ?SUCCESS} | _] = send_multiple_filters(Config, [host, {eval, Fun}]). send_multiple_filters_2(Config) -> E = {erlang, is_tuple, []}, @@ -853,7 +731,7 @@ E2 = {erlang, is_tuple, []}, E3 = {erlang, is_record, [diameter_caps]}, E4 = [{erlang, is_record, []}, diameter_caps], - ['STA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | _] + ['STA', _SessionId, {'Result-Code', ?SUCCESS} | _] = send_multiple_filters(Config, [{eval, E} || E <- [E1,E2,E3,E4]]). send_multiple_filters(Config, Fs) -> @@ -864,39 +742,24 @@ %% only the return value from the prepare_request callback being %% significant. send_anything(Config) -> - ['STA', {'Session-Id', _}, {'Result-Code', ?SUCCESS} | _] + ['STA', _SessionId, {'Result-Code', ?SUCCESS} | _] = call(Config, anything). %% =========================================================================== -group(Config) -> - #group{} = proplists:get_value(group, Config). - -string(V, Config) -> - #group{client_strings = B} = group(Config), - decode(V,B). - -decode(S, true) - when is_list(S) -> - S; -decode(B, false) - when is_binary(B) -> - binary_to_list(B). - call(Config, Req) -> call(Config, Req, []). call(Config, Req, Opts) -> Name = proplists:get_value(testcase, Config), - #group{client_service = CN, - client_encoding = ReqEncoding, + #group{client_encoding = ReqEncoding, client_dict0 = Dict0} = Group - = group(Config), - diameter:call(CN, + = proplists:get_value(group, Config), + diameter:call(?CLIENT, dict(Req, Dict0), msg(Req, ReqEncoding, Dict0), - [{extra, [{Name, Group}, diameter_lib:now()]} | Opts]). + [{extra, [{Name, Group}, now()]} | Opts]). origin({A,C}) -> 2*codec(A) + container(C); @@ -980,38 +843,35 @@ %% pick_peer/6-7 -pick_peer(Peers, _, [$C|_], _State, {Name, Group}, _) +pick_peer(Peers, _, ?CLIENT, _State, {Name, Group}, _) when Name /= send_detach -> find(Group, Peers). -pick_peer(_Peers, _, [$C|_], _State, {send_nopeer, _}, _, ?EXTRA) -> +pick_peer(_Peers, _, ?CLIENT, _State, {send_nopeer, _}, _, ?EXTRA) -> false; -pick_peer(Peers, _, [$C|_], _State, {send_detach, Group}, _, {_,_}) -> +pick_peer(Peers, _, ?CLIENT, _State, {send_detach, Group}, _, {_,_}) -> find(Group, Peers). -find(#group{client_service = CN, - server_encoding = A, - server_container = C}, - Peers) -> +find(#group{server_encoding = A, server_container = C}, Peers) -> Id = {A,C}, - [P] = [P || P <- Peers, id(Id, P, CN)], + [P] = [P || P <- Peers, id(Id, P)], {ok, P}. -id(Id, {Pid, _Caps}, SvcName) -> +id(Id, {Pid, _Caps}) -> [{ref, _}, {type, _}, {options, Opts} | _] - = diameter:service_info(SvcName, Pid), + = diameter:service_info(?CLIENT, Pid), lists:member({id, Id}, Opts). %% prepare_request/5-6 -prepare_request(_Pkt, [$C|_], {_Ref, _Caps}, {send_discard, _}, _) -> +prepare_request(_Pkt, ?CLIENT, {_Ref, _Caps}, {send_discard, _}, _) -> {discard, unprepared}; -prepare_request(Pkt, [$C|_], {_Ref, Caps}, {Name, Group}, _) -> +prepare_request(Pkt, ?CLIENT, {_Ref, Caps}, {Name, Group}, _) -> {send, prepare(Pkt, Caps, Name, Group)}. -prepare_request(Pkt, [$C|_], {_Ref, Caps}, {send_detach, Group}, _, _) -> +prepare_request(Pkt, ?CLIENT, {_Ref, Caps}, {send_detach, Group}, _, _) -> {eval_packet, {send, prepare(Pkt, Caps, Group)}, [fun log/2, detach]}. log(#diameter_packet{bin = Bin} = P, T) @@ -1091,38 +951,6 @@ Avp = <>, E#diameter_packet{bin = <>}; -prepare(Pkt, Caps, send_grouped_error, #group{client_dict0 = Dict0} - = Group) -> - Req = prepare(Pkt, Caps, Group), - #diameter_packet{bin = Bin} - = E - = diameter_codec:encode(Dict0, Pkt#diameter_packet{msg = Req}), - {Code, Flags, undefined} = Dict0:avp_header('Proxy-Info'), - %% Find Proxy-Info by looking for its header. - Pattern = <>, - {Offset, 8} = binary:match(Bin, Pattern), - - %% Extract and swap Proxy-Host/State payloads. - - <> - = Bin, - - E#diameter_packet{bin = <>}; - prepare(Pkt, Caps, send_unsupported, #group{client_dict0 = Dict0} = Group) -> Req = prepare(Pkt, Caps, Group), #diameter_packet{bin = <>} @@ -1214,10 +1042,10 @@ %% handle_answer/6-7 -handle_answer(Pkt, Req, [$C|_], Peer, {Name, Group}, _) -> +handle_answer(Pkt, Req, ?CLIENT, Peer, {Name, Group}, _) -> answer(Pkt, Req, Peer, Name, Group). -handle_answer(Pkt, Req, [$C|_], Peer, {send_detach = Name, Group}, _, X) -> +handle_answer(Pkt, Req, ?CLIENT, Peer, {send_detach = Name, Group}, _, X) -> {Pid, Ref} = X, Pid ! {Ref, answer(Pkt, Req, Peer, Name, Group)}. @@ -1229,19 +1057,15 @@ [R | Vs] = Dict:'#get-'(answer(Ans, Es, Name)), [Dict:rec2msg(R) | Vs]. -%% Missing Result-Code and inappropriate Experimental-Result-Code. -answer(Rec, Es, send_experimental_result) -> - [{5004, #diameter_avp{name = 'Experimental-Result'}}, - {5005, #diameter_avp{name = 'Result-Code'}}] - = Es, - Rec; - -%% An inappropriate E-bit results in a decode error ... -answer(Rec, Es, send_bad_answer) -> - [{5004, #diameter_avp{name = 'Result-Code'}} | _] = Es, +answer(Rec, [_|_], N) + when N == send_long_avp_length; + N == send_short_avp_length; + N == send_zero_avp_length; + N == send_invalid_avp_length; + N == send_invalid_reject; + N == send_unknown_short_mandatory; + N == send_unexpected_mandatory_decode -> Rec; - -%% ... while other errors are reflected in Failed-AVP. answer(Rec, [], _) -> Rec. @@ -1253,13 +1077,11 @@ %% handle_error/6 -handle_error(timeout = Reason, _Req, [$C|_], _Peer, _, Time) -> - Now = diameter_lib:now(), - {Reason, {diameter_lib:timestamp(Time), - diameter_lib:timestamp(Now), - diameter_lib:micro_diff(Now, Time)}}; +handle_error(timeout = Reason, _Req, ?CLIENT, _Peer, _, Time) -> + Now = now(), + {Reason, {Time, Now, timer:now_diff(Now, Time)}}; -handle_error(Reason, _Req, [$C|_], _Peer, _, _Time) -> +handle_error(Reason, _Req, ?CLIENT, _Peer, _, _Time) -> {error, Reason}. %% handle_request/3 @@ -1267,9 +1089,7 @@ %% Note that diameter will set Result-Code and Failed-AVPs if %% #diameter_packet.errors is non-null. -handle_request(#diameter_packet{header = H, msg = M, avps = As}, - _, - {_Ref, Caps}) -> +handle_request(#diameter_packet{header = H, msg = M}, ?SERVER, {_Ref, Caps}) -> #diameter_header{end_to_end_id = EI, hop_by_hop_id = HI} = H, @@ -1277,12 +1097,10 @@ V = EI bsr B, %% assert V = HI bsr B, %% #diameter_caps{origin_state_id = {_,[Id]}} = Caps, - answer(origin(Id), request(M, [H|As], Caps)). + answer(origin(Id), request(M, Caps)). answer(T, {Tag, Action, Post}) -> {Tag, answer(T, Action), Post}; -answer(_, {reply, [#diameter_header{} | _]} = T) -> - T; answer({A,C}, {reply, Ans}) -> answer(C, {reply, msg(Ans, A, diameter_gen_base_rfc3588)}); answer(pkt, {reply, Ans}) @@ -1291,41 +1109,6 @@ answer(_, T) -> T. -%% request/3 - -%% send_experimental_result -request(#diameter_base_accounting_ACR{'Accounting-Record-Number' = 5}, - [Hdr | Avps], - #diameter_caps{origin_host = {OH, _}, - origin_realm = {OR, _}}) -> - [H,R|T] = [A || N <- ['Origin-Host', - 'Origin-Realm', - 'Session-Id', - 'Accounting-Record-Type', - 'Accounting-Record-Number'], - #diameter_avp{} = A - <- [lists:keyfind(N, #diameter_avp.name, Avps)]], - Ans = [Hdr#diameter_header{is_request = false}, - H#diameter_avp{data = OH}, - R#diameter_avp{data = OR}, - #diameter_avp{name = 'Experimental-Result', - code = 297, - need_encryption = false, - data = [#diameter_avp{data = {?DIAMETER_DICT_COMMON, - 'Vendor-Id', - 123}}, - #diameter_avp{data - = {?DIAMETER_DICT_COMMON, - 'Experimental-Result-Code', - 3987}}]} - | T], - {reply, Ans}; - -request(Msg, _Avps, Caps) -> - request(Msg, Caps). - -%% request/2 - %% send_nok request(#diameter_base_accounting_ACR{'Accounting-Record-Number' = 0}, _) -> diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_transport_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_transport_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_transport_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_transport_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -54,7 +53,7 @@ %% Receive a message. -define(RECV(Pat, Ret), receive Pat -> Ret end). --define(RECV(Pat), ?RECV(Pat, diameter_lib:now())). +-define(RECV(Pat), ?RECV(Pat, now())). %% Sockets are opened on the loopback address. -define(ADDR, {127,0,0,1}). @@ -65,7 +64,7 @@ = #diameter_caps{host_ip_address = Addrs}}). -%% The term we register after open a listening port with gen_{tcp,sctp}. +%% The term we register after open a listening port with gen_tcp. -define(TEST_LISTENER(Ref, PortNr), {?MODULE, listen, Ref, PortNr}). @@ -86,7 +85,7 @@ %% =========================================================================== suite() -> - [{timetrap, {seconds, 15}}]. + [{timetrap, {minutes, 2}}]. all() -> [start, @@ -105,7 +104,7 @@ reconnect]. init_per_suite(Config) -> - [{sctp, ?util:have_sctp()} | Config]. + [{sctp, have_sctp()} | Config]. end_per_suite(_Config) -> ok. @@ -128,10 +127,7 @@ accept(tcp). sctp_accept(Config) -> - case lists:member({sctp, true}, Config) of - true -> accept(sctp); - false -> {skip, no_sctp} - end. + if_sctp(fun accept/1, Config). %% Start multiple accepting transport processes that are connected to %% with an equal number of connecting processes using gen_tcp/sctp @@ -161,10 +157,7 @@ connect(tcp). sctp_connect(Config) -> - case lists:member({sctp, true}, Config) of - true -> connect(sctp); - false -> {skip, no_sctp} - end. + if_sctp(fun connect/1, Config). connect(Prot) -> T = {Prot, make_ref()}, @@ -201,7 +194,7 @@ true = diameter:subscribe(SvcName), ok = start_service(SvcName), [{{_, _, LRef}, Pid}] = diameter_reg:wait({?MODULE, Ref, '_'}), - CRef = ?util:connect(SvcName, tcp, LRef, [{connect_timer, 2000}, + CRef = ?util:connect(SvcName, tcp, LRef, [{reconnect_timer, 2000}, {watchdog_timer, 6000}]), %% Tell partner to kill transport after seeing that there are no @@ -226,7 +219,7 @@ || T <- [listen, connect]]). start_service(SvcName) -> - OH = diameter_util:unique_string(), + OH = io_lib:format("~p-~p-~p", tuple_to_list(now())), Opts = [{application, [{dictionary, diameter_gen_base_rfc6733}, {module, diameter_callback}]}, {'Origin-Host', OH}, @@ -258,6 +251,28 @@ %% =========================================================================== %% =========================================================================== +%% have_sctp/0 + +have_sctp() -> + case gen_sctp:open() of + {ok, Sock} -> + gen_sctp:close(Sock), + true; + {error, E} when E == eprotonosupport; + E == esocktnosupport -> %% fail on any other reason + false + end. + +%% if_sctp/2 + +if_sctp(F, Config) -> + case proplists:get_value(sctp, Config) of + true -> + F(sctp); + false -> + {skip, no_sctp} + end. + %% init/2 init(accept, {Prot, Ref}) -> @@ -336,7 +351,7 @@ %% crypto:rand_bytes/1 isn't available on all platforms (since openssl %% isn't) so roll our own. rand_bytes(N) -> - random:seed(diameter_util:seed()), + random:seed(now()), rand_bytes(N, <<>>). rand_bytes(0, Bin) -> @@ -366,14 +381,37 @@ diameter_tcp:start(T, Svc, Opts). %% start_accept/2 +%% +%% Start transports sequentially by having each wait for a message +%% from a job in a queue before commencing. Only one transport with a +%% pending accept is started at a time since diameter_{tcp,sctp} +%% currently assume (and diameter currently implements) this. start_accept(Prot, Ref) -> + Pid = sync(accept, Ref), {Mod, Opts} = tmod(Prot), - {ok, TPid, [?ADDR]} = Mod:start({accept, Ref}, - ?SVC([?ADDR]), - [{port, 0} | Opts]), - ?RECV(?TMSG({TPid, connected})), - TPid. + + try + {ok, TPid, [?ADDR]} = Mod:start({accept, Ref}, + ?SVC([?ADDR]), + [{port, 0} | Opts]), + ?RECV(?TMSG({TPid, connected})), + TPid + after + Pid ! Ref + end. + +sync(What, Ref) -> + ok = diameter_sync:cast({?MODULE, What, Ref}, + [fun lock/2, Ref, self()], + infinity, + infinity), + receive {start, Ref, Pid} -> Pid end. + +lock(Ref, Pid) -> + Pid ! {start, Ref, self()}, + erlang:monitor(process, Pid), + Ref = receive T -> T end. tmod(sctp) -> {diameter_sctp, [{sctp_initmsg, ?SCTP_INIT}]}; @@ -402,13 +440,12 @@ %% gen_accept/2 gen_accept(sctp, Sock) -> - #sctp_assoc_change{state = comm_up, - outbound_streams = OS, - inbound_streams = IS, - assoc_id = Id} - = ?RECV(?SCTP(Sock, {_, #sctp_assoc_change{} = S}), S), - - putr(assoc, {OS, IS, Id}), + Assoc = ?RECV(?SCTP(Sock, {_, #sctp_assoc_change{state = comm_up, + outbound_streams = O, + inbound_streams = I, + assoc_id = A}}), + {O, I, A}), + putr(assoc, Assoc), {ok, Sock}; gen_accept(tcp, LSock) -> gen_tcp:accept(LSock). @@ -417,7 +454,8 @@ gen_send(sctp, Sock, Bin) -> {OS, _IS, Id} = getr(assoc), - gen_sctp:send(Sock, Id, erlang:unique_integer([positive]) rem OS, Bin); + {_, _, Us} = now(), + gen_sctp:send(Sock, Id, Us rem OS, Bin); gen_send(tcp, Sock, Bin) -> gen_tcp:send(Sock, Bin). @@ -425,11 +463,7 @@ gen_recv(sctp, Sock) -> {_OS, _IS, Id} = getr(assoc), - receive - ?SCTP(Sock, {[#sctp_sndrcvinfo{assoc_id = Id}], Bin}) - when is_binary(Bin) -> - Bin - end; + ?RECV(?SCTP(Sock, {[#sctp_sndrcvinfo{assoc_id = Id}], Bin}), Bin); gen_recv(tcp, Sock) -> tcp_recv(Sock, <<>>). diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_util.erl erlang-17.3-dfsg/lib/diameter/test/diameter_util.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_util.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_util.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,10 +29,7 @@ run/1, fold/3, foldl/3, - scramble/1, - seed/0, - unique_string/0, - have_sctp/0]). + scramble/1]). %% diameter-specific -export([lport/2, @@ -178,7 +174,7 @@ [[fun s/1, L]]). s(L) -> - random:seed(seed()), + random:seed(now()), s([], L). s(Acc, []) -> @@ -188,32 +184,6 @@ s([T|Acc], H ++ Rest). %% --------------------------------------------------------------------------- -%% seed/0 - -seed() -> - {_,T} = diameter_lib:seed(), - T. - -%% --------------------------------------------------------------------------- -%% unique_string/0 - -unique_string() -> - integer_to_list(erlang:unique_integer()). - -%% --------------------------------------------------------------------------- -%% have_sctp/0 - -have_sctp() -> - case gen_sctp:open() of - {ok, Sock} -> - gen_sctp:close(Sock), - true; - {error, E} when E == eprotonosupport; - E == esocktnosupport -> %% fail on any other reason - false - end. - -%% --------------------------------------------------------------------------- %% eval/1 %% %% Evaluate a function in one of a number of forms. @@ -284,12 +254,13 @@ %% %% Lookup the port number of a tcp/sctp listening transport. -lport(Prot, {Node, Ref}) -> - rpc:call(Node, ?MODULE, lport, [Prot, Ref]); +lport(M, {Node, Ref}) -> + rpc:call(Node, ?MODULE, lport, [M, Ref]); lport(Prot, Ref) -> + Mod = tmod(Prot), [_] = diameter_reg:wait({'_', listener, {Ref, '_'}}), - [N || M <- tmod(Prot), {listen, N, _} <- M:ports(Ref)]. + [N || {listen, N, _} <- Mod:ports(Ref)]. %% --------------------------------------------------------------------------- %% listen/2-3 @@ -321,17 +292,13 @@ Ref = add_transport(Client, {connect, opts(Prot, PortNr) ++ Opts}), true = transport(Client, Ref), %% assert - diameter_lib:for_n(fun(_) -> ok = up(Client, Ref, Prot, PortNr) end, - proplists:get_value(pool_size, Opts, 1)), + ok = receive + {diameter_event, Client, {up, Ref, _, _, _}} -> ok + after 10000 -> + {Client, Prot, PortNr, process_info(self(), messages)} + end, Ref. -up(Client, Ref, Prot, PortNr) -> - receive - {diameter_event, Client, {up, Ref, _, _, _}} -> ok - after 10000 -> - {Client, Prot, PortNr, process_info(self(), messages)} - end. - transport(SvcName, Ref) -> [Ref] == [R || [{ref, R} | _] <- diameter:service_info(SvcName, transport), R == Ref]. @@ -360,45 +327,17 @@ Ref. tmod(tcp) -> - [diameter_tcp]; + diameter_tcp; tmod(sctp) -> - [diameter_sctp]; -tmod(any) -> - [diameter_sctp, diameter_tcp]. + diameter_sctp. opts(Prot, T) -> - tmo(T, lists:append([[{transport_module, M}, {transport_config, C}] - || M <- tmod(Prot), - C <- [cfg(M,T) ++ cfg(M) ++ cfg(T)]])). - -tmo(listen, Opts) -> - Opts; -tmo(_, Opts) -> - tmo(Opts). - -%% Timeout on all but the last alternative. -tmo([_,_] = Opts) -> - Opts; -tmo([M, C | Opts]) -> - {transport_config = K, Cfg} = C, - [M, {K, Cfg, 5000} | tmo(Opts)]. - -%% Listening SCTP socket need larger-than-default buffers to avoid -%% resends on some platforms (eg. SLES 11). -cfg(diameter_sctp, listen) -> - [{recbuf, 1 bsl 16}, {sndbuf, 1 bsl 16}]; - -cfg(_, _) -> - []. - -cfg(M) - when M == diameter_tcp; - M == diameter_sctp -> - [{ip, ?ADDR}, {port, 0}]; + [{transport_module, tmod(Prot)}, + {transport_config, [{ip, ?ADDR}, {port, 0} | opts(T)]}]. -cfg(listen) -> +opts(listen) -> [{accept, M} || M <- [{256,0,0,1}, ["256.0.0.1", ["^.+$"]]]]; -cfg(PortNr) -> +opts(PortNr) -> [{raddr, ?ADDR}, {rport, PortNr}]. %% --------------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/diameter/test/diameter_watchdog_SUITE.erl erlang-17.3-dfsg/lib/diameter/test/diameter_watchdog_SUITE.erl --- erlang-18.2-dfsg/lib/diameter/test/diameter_watchdog_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/diameter_watchdog_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -49,8 +48,7 @@ accept/1, connect/3, send/2, - setopts/2, - close/1]). + setopts/2]). -include("diameter.hrl"). -include("diameter_ct.hrl"). @@ -546,9 +544,6 @@ send(Sock, Bin) -> send(getr(config), Sock, Bin). -close(Sock) -> - gen_tcp:close(Sock). - %% send/3 %% First outgoing message from a new transport process is CER/CEA. @@ -677,7 +672,7 @@ %% Generate a unique hostname for the faked peer. hostname() -> - ?util:unique_string(). + lists:flatten(io_lib:format("~p-~p-~p", tuple_to_list(now()))). putr(Key, Val) -> put({?MODULE, Key}, Val). diff -Nru erlang-18.2-dfsg/lib/diameter/test/Makefile erlang-17.3-dfsg/lib/diameter/test/Makefile --- erlang-18.2-dfsg/lib/diameter/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/diameter/test/modules.mk erlang-17.3-dfsg/lib/diameter/test/modules.mk --- erlang-18.2-dfsg/lib/diameter/test/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,19 @@ +#-*-makefile-*- ; force emacs to enter makefile-mode # %CopyrightBegin% # -# Copyright Ericsson AB 2010-2015. All Rights Reserved. +# Copyright Ericsson AB 2010-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% @@ -40,7 +40,6 @@ diameter_gen_sctp_SUITE \ diameter_gen_tcp_SUITE \ diameter_length_SUITE \ - diameter_pool_SUITE \ diameter_reg_SUITE \ diameter_relay_SUITE \ diameter_stats_SUITE \ diff -Nru erlang-18.2-dfsg/lib/diameter/test/release.sed erlang-17.3-dfsg/lib/diameter/test/release.sed --- erlang-18.2-dfsg/lib/diameter/test/release.sed 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/test/release.sed 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/diameter/vsn.mk erlang-17.3-dfsg/lib/diameter/vsn.mk --- erlang-18.2-dfsg/lib/diameter/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/diameter/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1,21 +1,22 @@ +#-*-makefile-*- ; force emacs to enter makefile-mode + # %CopyrightBegin% # -# Copyright Ericsson AB 2010-2015. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright Ericsson AB 2010-2014. All Rights Reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% APPLICATION = diameter -DIAMETER_VSN = 1.11.1 +DIAMETER_VSN = 1.7.1 APP_VSN = $(APPLICATION)-$(DIAMETER_VSN)$(PRE_VSN) diff -Nru erlang-18.2-dfsg/lib/edoc/doc/Makefile erlang-17.3-dfsg/lib/edoc/doc/Makefile --- erlang-18.2-dfsg/lib/edoc/doc/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/doc/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/edoc/doc/overview.edoc erlang-17.3-dfsg/lib/edoc/doc/overview.edoc --- erlang-18.2-dfsg/lib/edoc/doc/overview.edoc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/doc/overview.edoc 2014-09-16 19:10:57.000000000 +0000 @@ -76,9 +76,11 @@
  • {@link edoc:application/2}: Creates documentation for a typical Erlang application.
  • +
  • {@link edoc:packages/2}: Creates documentation for one or + more packages, automatically locating source files.
  • {@link edoc:files/2}: Creates documentation for a specified set of source files.
  • -
  • {@link edoc:run/2}: General interface function; the common +
  • {@link edoc:run/3}: General interface function; the common back-end for the above functions. Options are documented here.
@@ -182,7 +184,7 @@ path (see {@link edoc:read_source/2}).
`@todo' (or `@TODO')
-
Attaches a To-Do note to a function, module or +
Attaches a To-Do note to a function, module, package, or overview-page. The content can be any XHTML text describing the issue, e.g.: ```%% @TODO Finish writing the documentation.''' @@ -336,7 +338,7 @@
`@since'
Specifies when the module was introduced, with respect to - the application, release or distribution it is part + the application, package, release or distribution it is part of. The content can be arbitrary text.
`@version'
@@ -443,6 +445,7 @@ + @@ -528,7 +531,7 @@ ```%% @doc This will all be part of the first paragraph. %% It can stretch over several lines and contain any %% XHTML markup. - %% + %% %% This is the second paragraph. The above line is %% regarded as "empty" by EDoc, even though it ends with %% a space.''' @@ -682,6 +685,17 @@
Expands to the current date, as "Month Day Year", e.g. "{@date}".
+
@{@docRoot}
+
Expands to the relative URL path (such as + `"../../.."') from the current page to the root + directory of the generated documentation. This can be used to + create XHTML references such as `' that are independent of how + deep down in a package structure they occur. If packages are not + used (i.e., if all modules are in the "empty" package), + @{@docRoot} will always resolve to the empty + string.
+
@{@link reference. description}
This creates a hypertext link; cf. the @@ -696,6 +710,9 @@
Expands to the name of the current module. Only defined when a module is being processed.
+
@{@package}
+
Expands to the name of the current package.
+
@{@section heading}
Expands to a hypertext link to the specified section heading; diff -Nru erlang-18.2-dfsg/lib/edoc/doc/src/book.xml erlang-17.3-dfsg/lib/edoc/doc/src/book.xml --- erlang-18.2-dfsg/lib/edoc/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/edoc/doc/src/Makefile erlang-17.3-dfsg/lib/edoc/doc/src/Makefile --- erlang-18.2-dfsg/lib/edoc/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/edoc/doc/src/notes.xml erlang-17.3-dfsg/lib/edoc/doc/src/notes.xml --- erlang-18.2-dfsg/lib/edoc/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -32,37 +31,6 @@

This document describes the changes made to the EDoc application.

-
Edoc 0.7.17 - -
Improvements and New Features - - -

- Remove functionality related to packages

-

- Own Id: OTP-12431

-
-
-
- -
- -
Edoc 0.7.16 - -
Fixed Bugs and Malfunctions - - -

- Maps: Properly align union typed assoc values in - documentation

-

- Own Id: OTP-12190

-
-
-
- -
-
Edoc 0.7.15
Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/edoc/doc/src/part_notes.xml erlang-17.3-dfsg/lib/edoc/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/edoc/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/edoc/doc/src/part.xml erlang-17.3-dfsg/lib/edoc/doc/src/part.xml --- erlang-18.2-dfsg/lib/edoc/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/edoc/doc/src/ref_man.xml erlang-17.3-dfsg/lib/edoc/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/edoc/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/edoc/include/edoc_doclet.hrl erlang-17.3-dfsg/lib/edoc/include/edoc_doclet.hrl --- erlang-18.2-dfsg/lib/edoc/include/edoc_doclet.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/include/edoc_doclet.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,6 +1,6 @@ %% ===================================================================== %% Header file for EDoc doclet modules. -%% +%% %% Copyright (C) 2001-2004 Richard Carlsson %% %% This library is free software; you can redistribute it and/or modify @@ -43,11 +43,16 @@ %% @type doclet_gen() = #doclet_gen{sources = [string()], %% app = no_app() | atom(), -%% modules = [atom()]} +%% packages = [atom()], +%% modules = [atom()], +%% modules = [atom()], +%% filemap = function()} -record(doclet_gen, {sources = [], app = ?NO_APP, - modules = [] + packages = [], + modules = [], + filemap }). %% @type doclet_toc() = #doclet_gen{paths = [string()], diff -Nru erlang-18.2-dfsg/lib/edoc/include/Makefile erlang-17.3-dfsg/lib/edoc/include/Makefile --- erlang-18.2-dfsg/lib/edoc/include/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/include/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/edoc/Makefile erlang-17.3-dfsg/lib/edoc/Makefile --- erlang-18.2-dfsg/lib/edoc/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/edoc/priv/edoc.dtd erlang-17.3-dfsg/lib/edoc/priv/edoc.dtd --- erlang-18.2-dfsg/lib/edoc/priv/edoc.dtd 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/priv/edoc.dtd 2014-09-16 19:10:57.000000000 +0000 @@ -2,13 +2,20 @@ + since?, see*, reference*, todo?, packages, modules)> + + + diff -Nru erlang-18.2-dfsg/lib/edoc/priv/edoc_generate.src erlang-17.3-dfsg/lib/edoc/priv/edoc_generate.src --- erlang-18.2-dfsg/lib/edoc/priv/edoc_generate.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/priv/edoc_generate.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,15 +1,14 @@ #!/bin/sh -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999-2000, Ericsson diff -Nru erlang-18.2-dfsg/lib/edoc/priv/stylesheet.css erlang-17.3-dfsg/lib/edoc/priv/stylesheet.css --- erlang-18.2-dfsg/lib/edoc/priv/stylesheet.css 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/priv/stylesheet.css 2014-09-16 19:10:57.000000000 +0000 @@ -27,10 +27,10 @@ margin-left: 2em; background-color: #eeeeee; } -a.module { +a.module,a.package { text-decoration:none } -a.module:hover { +a.module:hover,a.package:hover { background-color: #eeeeee; } ul.definitions { diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc.app.src erlang-17.3-dfsg/lib/edoc/src/edoc.app.src --- erlang-18.2-dfsg/lib/edoc/src/edoc.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -23,5 +23,5 @@ {registered,[]}, {applications, [compiler,kernel,stdlib,syntax_tools]}, {env, []}, - {runtime_dependencies, ["xmerl-1.3.7","syntax_tools-1.6.14","stdlib-2.5", + {runtime_dependencies, ["xmerl-1.3.7","syntax_tools-1.6.14","stdlib-2.0", "kernel-3.0","inets-5.10","erts-6.0"]}]}. diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc.appup.src erlang-17.3-dfsg/lib/edoc/src/edoc.appup.src --- erlang-18.2-dfsg/lib/edoc/src/edoc.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_data.erl erlang-17.3-dfsg/lib/edoc/src/edoc_data.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_data.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_data.erl 2014-09-16 19:10:57.000000000 +0000 @@ -26,7 +26,7 @@ -module(edoc_data). --export([module/4, overview/4, type/2]). +-export([module/4, package/4, overview/4, type/2]). -export([hidden_filter/2, get_all_tags/1]). @@ -173,34 +173,21 @@ lists:keymember(callback, 1, Module#module.attributes) of true -> - M = Module#module.name, - Fs = get_callback_functions(M, callbacks), - Os1 = get_callback_functions(M, optional_callbacks), - Fs1 = [FA || FA <- Fs, not lists:member(FA, Os1)], - Req = if Fs1 =:= [] -> - []; - true -> - [{callbacks, - [callback(FA, Env, Opts) || FA <- Fs1]}] - end, - Opt = if Os1 =:= [] -> - []; - true -> - [{optional_callbacks, - [callback(FA, Env, Opts) || FA <- Os1]}] - end, - Req ++ Opt; + try (Module#module.name):behaviour_info(callbacks) of + Fs -> + Fs1 = [{F,A} || {F,A} <- Fs, is_atom(F), is_integer(A)], + if Fs1 =:= [] -> + []; + true -> + [{callbacks, + [callback(F, Env, Opts) || F <- Fs1]}] + end + catch + _:_ -> [] + end; false -> [] end. -get_callback_functions(M, Callbacks) -> - try - [FA || {F, A} = FA <- M:behaviour_info(Callbacks), - is_atom(F), is_integer(A), A >= 0] - catch - _:_ -> [] - end. - %% %% xmerl_lib:expand_element({type, [edoc_types:to_xml(T, Env)]}). +%% +%% +%% + +package(Package, Tags, Env, Opts) -> + Env1 = Env#env{package = Package, + root = edoc_refs:relative_package_path('', Package)}, + xmerl_lib:expand_element(package_1(Package, Tags, Env1, Opts)). + +package_1(Package, Tags, Env, Opts) -> + {package, [{root, Env#env.root}], + ([{packageName, [atom_to_list(Package)]}] + ++ get_doc(Tags) + ++ authors(Tags) + ++ get_copyright(Tags) + ++ get_version(Tags) + ++ get_since(Tags) + ++ get_deprecated(Tags) + ++ sees(Tags, Env) + ++ references(Tags) + ++ todos(Tags, Opts)) + }. + %% +%% since?, see*, reference*, todo?, packages, modules)> %% %% overview(Title, Tags, Env, Opts) -> - Env1 = Env#env{ + Env1 = Env#env{package = '', root = ""}, xmerl_lib:expand_element(overview_1(Title, Tags, Env1, Opts)). diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_doclet.erl erlang-17.3-dfsg/lib/edoc/src/edoc_doclet.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_doclet.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_doclet.erl 2014-09-16 19:10:57.000000000 +0000 @@ -42,7 +42,9 @@ -define(DEFAULT_FILE_SUFFIX, ".html"). -define(INDEX_FILE, "index.html"). -define(OVERVIEW_FILE, "overview.edoc"). +-define(PACKAGE_SUMMARY, "package-summary.html"). -define(OVERVIEW_SUMMARY, "overview-summary.html"). +-define(PACKAGES_FRAME, "packages-frame.html"). -define(MODULES_FRAME, "modules-frame.html"). -define(STYLESHEET, "stylesheet.css"). -define(IMAGE, "erlang.png"). @@ -50,10 +52,11 @@ -include_lib("xmerl/include/xmerl.hrl"). -%% Sources is the list of inputs in the order they were found. -%% Modules are sorted lists of atoms without duplicates. (They +%% Sources is the list of inputs in the order they were found. Packages +%% and Modules are sorted lists of atoms without duplicates. (They %% usually include the data from the edoc-info file in the target -%% directory, if it exists.) +%% directory, if it exists.) Note that the "empty package" is never +%% included in Packages! %% @spec (Command::doclet_gen() | doclet_toc(), edoc_context()) -> ok %% @doc Main doclet entry point. See the file gen(Cmd#doclet_gen.sources, Cmd#doclet_gen.app, + Cmd#doclet_gen.packages, Cmd#doclet_gen.modules, + Cmd#doclet_gen.filemap, Ctxt); run(#doclet_toc{}=Cmd, Ctxt) -> toc(Cmd#doclet_toc.paths, Ctxt). -gen(Sources, App, Modules, Ctxt) -> +gen(Sources, App, Packages, Modules, FileMap, Ctxt) -> Dir = Ctxt#context.dir, Env = Ctxt#context.env, Options = Ctxt#context.opts, @@ -127,9 +132,11 @@ CSS = stylesheet(Options), {Modules1, Error} = sources(Sources, Dir, Modules, Env, Options), modules_frame(Dir, Modules1, Title, CSS), + packages(Packages, Dir, FileMap, Env, Options), + packages_frame(Dir, Packages, Title, CSS), overview(Dir, Title, Env, Options), - index_file(Dir, Title), - edoc_lib:write_info_file(App, Modules1, Dir), + index_file(Dir, length(Packages) > 1, Title), + edoc_lib:write_info_file(App, Packages, Modules1, Dir), copy_stylesheet(Dir, Options), copy_image(Dir), %% handle postponed error during processing of source files @@ -175,19 +182,19 @@ %% set if it was successful. Errors are just flagged at this stage, %% allowing all source files to be processed even if some of them fail. -source({M, Name, Path}, Dir, Suffix, Env, Set, Private, Hidden, +source({M, P, Name, Path}, Dir, Suffix, Env, Set, Private, Hidden, Error, Options) -> File = filename:join(Path, Name), case catch {ok, edoc:get_doc(File, Env, Options)} of {ok, {Module, Doc}} -> - check_name(Module, M, File), + check_name(Module, M, P, File), case ((not is_private(Doc)) orelse Private) andalso ((not is_hidden(Doc)) orelse Hidden) of true -> Text = edoc:layout(Doc, Options), Name1 = atom_to_list(M) ++ Suffix, Encoding = [{encoding,encoding(Doc)}], - edoc_lib:write_file(Text, Dir, Name1, Encoding), + edoc_lib:write_file(Text, Dir, Name1, P, Encoding), {sets:add_element(Module, Set), Error}; false -> {Set, Error} @@ -197,7 +204,8 @@ {Set, true} end. -check_name(M, M0, File) -> +check_name(M, M0, P0, File) -> + P = '', N = M, N0 = M0, case N of @@ -214,12 +222,47 @@ ok end end, - ok. + if P =/= P0 -> + warning("file '~ts' belongs to package '~s', not '~s'.", + [File, P, P0]); + true -> + ok + end. + + +%% Generating the summary files for packages. + +%% INHERIT-OPTIONS: read_file/4 +%% INHERIT-OPTIONS: edoc_lib:run_layout/2 + +packages(Packages, Dir, FileMap, Env, Options) -> + lists:foreach(fun (P) -> + package(P, Dir, FileMap, Env, Options) + end, + Packages). + +package(P, Dir, FileMap, Env, Opts) -> + Tags = case FileMap(P) of + "" -> + []; + File -> + read_file(File, package, Env, Opts) + end, + Data = edoc_data:package(P, Tags, Env, Opts), + F = fun (M) -> + M:package(Data, Opts) + end, + Text = edoc_lib:run_layout(F, Opts), + edoc_lib:write_file(Text, Dir, ?PACKAGE_SUMMARY, P). + %% Creating an index file, with some frames optional. %% TODO: get rid of frames, or change doctype to Frameset -index_file(Dir, Title) -> +index_file(Dir, Packages, Title) -> + Frame1 = {frame, [{src,?PACKAGES_FRAME}, + {name,"packagesFrame"},{title,""}], + []}, Frame2 = {frame, [{src,?MODULES_FRAME}, {name,"modulesFrame"},{title,""}], []}, @@ -227,7 +270,16 @@ {name,"overviewFrame"},{title,""}], []}, Frameset = {frameset, [{cols,"20%,80%"}], - [?NL, Frame2, ?NL, ?NL, Frame3, ?NL, + case Packages of + true -> + [?NL, + {frameset, [{rows,"30%,70%"}], + [?NL, Frame1, ?NL, Frame2, ?NL]} + ]; + false -> + [?NL, Frame2, ?NL] + end + ++ [?NL, Frame3, ?NL, {noframes, [?NL, {h2, ["This page uses frames"]}, @@ -244,6 +296,24 @@ Text = xmerl:export_simple([XML], xmerl_html, []), edoc_lib:write_file(Text, Dir, ?INDEX_FILE). +packages_frame(Dir, Ps, Title, CSS) -> + Body = [?NL, + {h2, [{class, "indextitle"}], ["Packages"]}, + ?NL, + {table, [{width, "100%"}, {border, 0}, + {summary, "list of packages"}], + lists:concat( + [[?NL, + {tr, [{td, [], [{a, [{href, package_ref(P)}, + {target,"overviewFrame"}, + {class, "package"}], + [atom_to_list(P)]}]}]}] + || P <- Ps])}, + ?NL], + XML = xhtml(Title, CSS, Body), + Text = xmerl:export_simple([XML], xmerl_html, []), + edoc_lib:write_file(Text, Dir, ?PACKAGES_FRAME). + modules_frame(Dir, Ms, Title, CSS) -> Body = [?NL, {h2, [{class, "indextitle"}], ["Modules"]}, @@ -264,7 +334,11 @@ edoc_lib:write_file(Text, Dir, ?MODULES_FRAME). module_ref(M) -> - atom_to_list(M) ++ ?DEFAULT_FILE_SUFFIX. + edoc_refs:relative_package_path(M, '') ++ ?DEFAULT_FILE_SUFFIX. + +package_ref(P) -> + edoc_lib:join_uri(edoc_refs:relative_package_path(P, ''), + ?PACKAGE_SUMMARY). xhtml(Title, CSS, Content) -> xhtml_1(Title, CSS, {body, [{bgcolor, "white"}], Content}). @@ -298,7 +372,7 @@ end, Text = edoc_lib:run_layout(F, Opts), EncOpts = [{encoding,Encoding}], - edoc_lib:write_file(Text, Dir, ?OVERVIEW_SUMMARY, EncOpts). + edoc_lib:write_file(Text, Dir, ?OVERVIEW_SUMMARY, '', EncOpts). copy_image(Dir) -> case code:priv_dir(?EDOC_APP) of @@ -431,7 +505,7 @@ % Priv = proplists:get_bool(private, Options), CSS = stylesheet(Options), Apps1 = [{filename:dirname(A),filename:basename(A)} || A <- Paths], - index_file(Dir, Title), + index_file(Dir, false, Title), application_frame(Dir, Apps1, Title, CSS), modules_frame(Dir, [], Title, CSS), overview(Dir, Title, Env, Options), diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc.erl erlang-17.3-dfsg/lib/edoc/src/edoc.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -24,11 +24,12 @@ %% TODO: option for ignoring functions matching some pattern ('..._test_'/0) %% TODO: @private_type tag, opaque unless generating private docs? %% TODO: document the record type syntax -%% TODO: some 'skip' option for ignoring particular modules? +%% TODO: some 'skip' option for ignoring particular modules/packages? +%% TODO: intermediate-level packages: document even if no local sources. %% TODO: multiline comment support (needs modified comment representation) %% TODO: config-file for default settings %% TODO: config: locations of all local docdirs; generate local doc-index page -%% TODO: config: URL:s of offline apps +%% TODO: config: URL:s of offline packages/apps %% TODO: config: default stylesheet %% TODO: config: default header/footer, etc. %% TODO: offline linkage @@ -44,10 +45,10 @@ -module(edoc). --export([files/1, files/2, +-export([packages/1, packages/2, files/1, files/2, application/1, application/2, application/3, toc/1, toc/2, toc/3, - run/2, + run/3, file/1, file/2, read/1, read/2, layout/1, layout/2, @@ -67,15 +68,15 @@ file(Name) -> file(Name, []). -%% @spec file(filename(), proplist()) -> ok +%% @spec file(filename(), proplist()) -> ok %% %% @type filename() = //kernel/file:filename() %% @type proplist() = [term()] %% %% @deprecated This is part of the old interface to EDoc and is mainly %% kept for backwards compatibility. The preferred way of generating -%% documentation is through one of the functions {@link application/2} -%% and {@link files/2}. +%% documentation is through one of the functions {@link application/2}, +%% {@link packages/2} and {@link files/2}. %% %% @doc Reads a source code file and outputs formatted documentation to %% a corresponding file. @@ -120,24 +121,44 @@ ?DEFAULT_FILE_SUFFIX), Dir = proplists:get_value(dir, Options, filename:dirname(Name)), Encoding = [{encoding, edoc_lib:read_encoding(Name, [])}], - edoc_lib:write_file(Text, Dir, BaseName ++ Suffix, Encoding). + edoc_lib:write_file(Text, Dir, BaseName ++ Suffix, '', Encoding). -%% TODO: better documentation of files/1/2, application/1/2/3 +%% TODO: better documentation of files/1/2, packages/1/2, application/1/2/3 -%% @spec (Files::[filename()]) -> ok +%% @spec (Files::[filename() | {package(), [filename()]}]) -> ok +%% @equiv packages(Packages, []) files(Files) -> files(Files, []). -%% @spec (Files::[filename()], +%% @spec (Files::[filename() | {package(), [filename()]}], %% Options::proplist()) -> ok -%% @doc Runs EDoc on a given set of source files. See {@link run/2} for +%% @doc Runs EDoc on a given set of source files. See {@link run/3} for %% details, including options. %% @equiv run([], Files, Options) files(Files, Options) -> - run(Files, Options). + run([], Files, Options). + +%% @spec (Packages::[package()]) -> ok +%% @equiv packages(Packages, []) + +packages(Packages) -> + packages(Packages, []). + +%% @spec (Packages::[package()], Options::proplist()) -> ok +%% @type package() = atom() | string() +%% +%% @doc Runs EDoc on a set of packages. The `source_path' option is used +%% to locate the files; see {@link run/3} for details, including +%% options. This function automatically appends the current directory to +%% the source path. +%% +%% @equiv run(Packages, [], Options) + +packages(Packages, Options) -> + run(Packages, [], Options ++ [{source_path, [?CURRENT_DIR]}]). %% @spec (Application::atom()) -> ok %% @equiv application(Application, []) @@ -173,7 +194,7 @@ %% subdirectory, if it exists, or otherwise in the application %% directory itself. %% -%%
  • The {@link run/2. `subpackages'} option is turned on. All found +%%
  • The {@link run/3. `subpackages'} option is turned on. All found %% source files will be processed. %%
  • %%
  • The `include' subdirectory is automatically added to the @@ -182,7 +203,7 @@ %%
  • %% %% -%% See {@link run/2} for details, including options. +%% See {@link run/3} for details, including options. %% %% @see application/2 @@ -198,7 +219,7 @@ {includes, [filename:join(Dir, "include")]}], Opts1 = set_app_default(App, Dir, Opts), %% Recursively document all subpackages of '' - i.e., everything. - run([], [{application, App} | Opts1]). + run([''], [], [{application, App} | Opts1]). %% Try to set up a default application base URI in a smart way if the %% user has not specified it explicitly. @@ -219,20 +240,31 @@ Opts end. +%% If no source files are found for a (specified) package, no package +%% documentation will be generated either (even if there is a +%% package-documentation file). This is the way it should be. For +%% specified files, use empty package (unless otherwise specified). The +%% assumed package is always used for creating the output. If the actual +%% module or package of the source differs from the assumption gathered +%% from the path and file name, a warning should be issued (since links +%% are likely to be incorrect). + opt_defaults() -> - []. + [packages]. opt_negations() -> [{no_preprocess, preprocess}, {no_subpackages, subpackages}, - {no_report_missing_types, report_missing_types}]. + {no_report_missing_types, report_missing_types}, + {no_packages, packages}]. -%% @spec run(Files::[filename()], +%% @spec run(Packages::[package()], +%% Files::[filename() | {package(), [filename()]}], %% Options::proplist()) -> ok -%% @doc Runs EDoc on a given set of source files. Note +%% @doc Runs EDoc on a given set of source files and/or packages. Note %% that the doclet plugin module has its own particular options; see the %% `doclet' option below. -%% +%% %% Also see {@link layout/2} for layout-related options, and %% {@link get_doc/2} for options related to reading source %% files. @@ -266,6 +298,11 @@ %% The default doclet module is {@link edoc_doclet}; see {@link %% edoc_doclet:run/2} for doclet-specific options. %%
    +%%
    {@type {exclude_packages, [package()]@}} +%%
    +%%
    Lists packages to be excluded from the documentation. Typically +%% used in conjunction with the `subpackages' option. +%%
    %%
    {@type {file_suffix, string()@}} %%
    %%
    Specifies the suffix used for output files. The default value is @@ -277,6 +314,22 @@ %% target directory will be ignored and overwritten. The default %% value is `false'. %%
    +%%
    {@type {packages, boolean()@}} +%%
    +%%
    If the value is `true', it it assumed that packages (module +%% namespaces) are being used, and that the source code directory +%% structure reflects this. The default value is `true'. (Usually, +%% this does the right thing even if all the modules belong to the +%% top-level "empty" package.) `no_packages' is an alias for +%% `{packages, false}'. See the `subpackages' option below for +%% further details. +%% +%% If the source code is organized in a hierarchy of +%% subdirectories although it does not use packages, use +%% `no_packages' together with the recursive-search `subpackages' +%% option (on by default) to automatically generate documentation +%% for all the modules. +%%
    %%
    {@type {source_path, [filename()]@}} %%
    %%
    Specifies a list of file system paths used to locate the source @@ -292,7 +345,7 @@ %%
    If the value is `true', all subpackages of specified packages %% will also be included in the documentation. The default value is %% `false'. `no_subpackages' is an alias for `{subpackages, -%% false}'. +%% false}'. See also the `exclude_packages' option. %% %% Subpackage source files are found by recursively searching %% for source code files in subdirectories of the known source code @@ -305,31 +358,38 @@ %% %% %% @see files/2 +%% @see packages/2 %% @see application/2 %% NEW-OPTIONS: source_path, application %% INHERIT-OPTIONS: init_context/1 %% INHERIT-OPTIONS: expand_sources/2 %% INHERIT-OPTIONS: target_dir_info/5 -%% INHERIT-OPTIONS: edoc_lib:find_sources/2 +%% INHERIT-OPTIONS: edoc_lib:find_sources/3 %% INHERIT-OPTIONS: edoc_lib:run_doclet/2 -%% INHERIT-OPTIONS: edoc_lib:get_doc_env/3 +%% INHERIT-OPTIONS: edoc_lib:get_doc_env/4 -run(Files, Opts0) -> +run(Packages, Files, Opts0) -> Opts = expand_opts(Opts0), Ctxt = init_context(Opts), Dir = Ctxt#context.dir, Path = proplists:append_values(source_path, Opts), - Ss = sources(Path, Opts), + Ss = sources(Path, Packages, Opts), {Ss1, Ms} = expand_sources(expand_files(Files) ++ Ss, Opts), + Ps = [P || {_, P, _, _} <- Ss1], App = proplists:get_value(application, Opts, ?NO_APP), - {App1, Ms1} = target_dir_info(Dir, App, Ms, Opts), + {App1, Ps1, Ms1} = target_dir_info(Dir, App, Ps, Ms, Opts), + %% The "empty package" is never included in the list of packages. + Ps2 = edoc_lib:unique(lists:sort(Ps1)) -- [''], Ms2 = edoc_lib:unique(lists:sort(Ms1)), - Env = edoc_lib:get_doc_env(App1, Ms2, Opts), + Fs = package_files(Path, Ps2), + Env = edoc_lib:get_doc_env(App1, Ps2, Ms2, Opts), Ctxt1 = Ctxt#context{env = Env}, Cmd = #doclet_gen{sources = Ss1, app = App1, - modules = Ms2 + packages = Ps2, + modules = Ms2, + filemap = Fs }, F = fun (M) -> M:run(Cmd, Ctxt1) @@ -341,22 +401,42 @@ Opts0 ++ opt_defaults()). %% NEW-OPTIONS: dir -%% DEFER-OPTIONS: run/2 +%% DEFER-OPTIONS: run/3 init_context(Opts) -> #context{dir = proplists:get_value(dir, Opts, ?CURRENT_DIR), opts = Opts }. -%% INHERIT-OPTIONS: edoc_lib:find_sources/2 +%% INHERIT-OPTIONS: edoc_lib:find_sources/3 -sources(Path, Opts) -> - edoc_lib:find_sources(Path, Opts). +sources(Path, Packages, Opts) -> + lists:foldl(fun (P, Xs) -> + edoc_lib:find_sources(Path, P, Opts) ++ Xs + end, + [], Packages). + +package_files(Path, Packages) -> + Name = ?PACKAGE_FILE, % this is hard-coded for now + D = lists:foldl(fun (P, D) -> + F = edoc_lib:find_file(Path, P, Name), + dict:store(P, F, D) + end, + dict:new(), Packages), + fun (P) -> + case dict:find(P, D) of + {ok, F} -> F; + error -> "" + end + end. %% Expand user-specified sets of files. +expand_files([{P, Fs1} | Fs]) -> + [{P, filename:basename(F), filename:dirname(F)} || F <- Fs1] + ++ expand_files(Fs); expand_files([F | Fs]) -> - [{filename:basename(F), filename:dirname(F)} | + [{'', filename:basename(F), filename:dirname(F)} | expand_files(Fs)]; expand_files([]) -> []. @@ -364,23 +444,26 @@ %% Create the (assumed) full module names. Keep only the first source %% for each module, but preserve the order of the list. -%% NEW-OPTIONS: source_suffix -%% DEFER-OPTIONS: run/2 +%% NEW-OPTIONS: source_suffix, packages +%% DEFER-OPTIONS: run/3 expand_sources(Ss, Opts) -> Suffix = proplists:get_value(source_suffix, Opts, ?DEFAULT_SOURCE_SUFFIX), - Ss1 = [{F,D} || {F,D} <- Ss], + Ss1 = case proplists:get_bool(packages, Opts) of + true -> Ss; + false -> [{'',F,D} || {_P,F,D} <- Ss] + end, expand_sources(Ss1, Suffix, sets:new(), [], []). -expand_sources([{F, D} | Fs], Suffix, S, As, Ms) -> +expand_sources([{'', F, D} | Fs], Suffix, S, As, Ms) -> M = list_to_atom(filename:rootname(F, Suffix)), case sets:is_element(M, S) of true -> expand_sources(Fs, Suffix, S, As, Ms); false -> S1 = sets:add_element(M, S), - expand_sources(Fs, Suffix, S1, [{M, F, D} | As], + expand_sources(Fs, Suffix, S1, [{M, '', F, D} | As], [M | Ms]) end; expand_sources([], _Suffix, _S, As, Ms) -> @@ -388,15 +471,16 @@ %% NEW-OPTIONS: new -target_dir_info(Dir, App, Ms, Opts) -> +target_dir_info(Dir, App, Ps, Ms, Opts) -> case proplists:get_bool(new, Opts) of true -> - {App, Ms}; + {App, Ps, Ms}; false -> - {App1, Ms1} = edoc_lib:read_info_file(Dir), + {App1, Ps1, Ms1} = edoc_lib:read_info_file(Dir), {if App == ?NO_APP -> App1; true -> App end, + Ps ++ Ps1, Ms ++ Ms1} end. @@ -421,12 +505,12 @@ %% INHERIT-OPTIONS: init_context/1 %% INHERIT-OPTIONS: edoc_lib:run_doclet/2 -%% INHERIT-OPTIONS: edoc_lib:get_doc_env/3 +%% INHERIT-OPTIONS: edoc_lib:get_doc_env/4 toc(Dir, Paths, Opts0) -> Opts = expand_opts(Opts0 ++ [{dir, Dir}]), Ctxt = init_context(Opts), - Env = edoc_lib:get_doc_env('', [], Opts), + Env = edoc_lib:get_doc_env('', [], [], Opts), Ctxt1 = Ctxt#context{env = Env}, F = fun (M) -> M:run(#doclet_toc{paths=Paths}, Ctxt1) @@ -478,7 +562,7 @@ %% %% %% @see layout/1 -%% @see run/2 +%% @see run/3 %% @see read/2 %% @see file/2 @@ -689,12 +773,13 @@ fix_last_line(Toks0) -> Toks1 = lists:reverse(Toks0), - LastLine = erl_scan:line(hd(Toks1)), + {line, LastLine} = erl_scan:token_info(hd(Toks1), line), fll(Toks1, LastLine, []). -fll([{Category, Anno0, Symbol} | L], LastLine, Ts) -> - Anno = erl_anno:set_line(LastLine, Anno0), - lists:reverse(L, [{Category, Anno, Symbol} | Ts]); +fll([{Category, Attributes0, Symbol} | L], LastLine, Ts) -> + F = fun(_OldLine) -> LastLine end, + Attributes = erl_scan:set_attribute(line, Attributes0, F), + lists:reverse(L, [{Category, Attributes, Symbol} | Ts]); fll([T | L], LastLine, Ts) -> fll(L, LastLine, [T | Ts]); fll(L, _LastLine, Ts) -> @@ -768,16 +853,16 @@ %% %% %% See {@link read_source/2}, {@link read_comments/2} and {@link -%% edoc_lib:get_doc_env/3} for further options. +%% edoc_lib:get_doc_env/4} for further options. %% %% @see get_doc/3 -%% @see run/2 +%% @see run/3 %% @see edoc_extract:source/5 %% @see read/2 %% @see layout/2 %% INHERIT-OPTIONS: get_doc/3 -%% INHERIT-OPTIONS: edoc_lib:get_doc_env/3 +%% INHERIT-OPTIONS: edoc_lib:get_doc_env/4 get_doc(File, Opts) -> Env = edoc_lib:get_doc_env(Opts), @@ -789,7 +874,7 @@ %% %% @doc Like {@link get_doc/2}, but for a given environment %% parameter. `Env' is an environment created by {@link -%% edoc_lib:get_doc_env/3}. +%% edoc_lib:get_doc_env/4}. %% INHERIT-OPTIONS: read_source/2, read_comments/2, edoc_extract:source/5 %% DEFER-OPTIONS: get_doc/2 diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_extract.erl erlang-17.3-dfsg/lib/edoc/src/edoc_extract.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_extract.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_extract.erl 2014-09-16 19:10:57.000000000 +0000 @@ -91,7 +91,7 @@ %% type `form_list', or a list of syntax trees representing %% "program forms" (cf. {@link edoc:read_source/2}. %% `Env' is an environment created by {@link -%% edoc_lib:get_doc_env/3}. The `File' argument is used for +%% edoc_lib:get_doc_env/4}. The `File' argument is used for %% error reporting and output file name generation only. %% %% See {@link edoc:get_doc/2} for descriptions of the `def', @@ -121,8 +121,10 @@ Module = get_module_info(Tree, File), {Header, Footer, Entries} = collect(Forms, Module), Name = Module#module.name, + Package = '', Env1 = Env#env{module = Name, - root = ""}, + package = Package, + root = edoc_refs:relative_package_path('', Package)}, Env2 = add_macro_defs(module_macros(Env1), Opts, Env1), Entries1 = get_tags([Header, Footer | Entries], Env2, File, TypeDocs), Entries2 = edoc_specs:add_data(Entries1, Opts, File, Module), @@ -216,13 +218,13 @@ %% @spec file(File::filename(), Context, Env::edoc_env(), %% Options::proplist()) -> {ok, Tags} | {error, Reason} -%% Context = overview +%% Context = overview | package %% Tags = [term()] %% Reason = term() %% %% @doc Reads a text file and returns the list of tags in the file. Any %% lines of text before the first tag are ignored. `Env' is an -%% environment created by {@link edoc_lib:get_doc_env/3}. Upon error, +%% environment created by {@link edoc_lib:get_doc_env/4}. Upon error, %% `Reason' is an atom returned from the call to {@link %% //kernel/file:read_file/1} or the atom 'invalid_unicode'. %% @@ -247,12 +249,12 @@ %% @spec (Text::string(), Context, Env::edoc_env(), %% Options::proplist()) -> Tags -%% Context = overview +%% Context = overview | package %% Tags = [term()] %% %% @doc Returns the list of tags in the text. Any lines of text before %% the first tag are ignored. `Env' is an environment created by {@link -%% edoc_lib:get_doc_env/3}. +%% edoc_lib:get_doc_env/4}. %% %% See {@link source/4} for a description of the `def' option. @@ -351,6 +353,8 @@ [F | preprocess_forms_1(Fs)]; {function, _} -> [F | preprocess_forms_1(Fs)]; + {rule, _} -> + [F | preprocess_forms_1(Fs)]; {attribute, {module, _}} -> [F | preprocess_forms_1(Fs)]; text -> @@ -386,6 +390,15 @@ collect(Fs, [], [], [], [#entry{name = Name, args = Args, line = L, export = Export, + data = {comment_text(Cs),Ss,Ts}} | As], + Header, Mod); + {rule, Name} -> + L = erl_syntax:get_pos(F), + Export = ordsets:is_element(Name, Mod#module.exports), + Args = parameters(erl_syntax:rule_clauses(F)), + collect(Fs, [], [], [], + [#entry{name = Name, args = Args, line = L, + export = Export, data = {comment_text(Cs),Ss,Ts}} | As], Header, Mod); {attribute, {module, _}} when Header =:= undefined -> diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc.hrl erlang-17.3-dfsg/lib/edoc/src/edoc.hrl --- erlang-18.2-dfsg/lib/edoc/src/edoc.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,6 +1,6 @@ %% ===================================================================== %% Header file for EDoc -%% +%% %% Copyright (C) 2001-2004 Richard Carlsson %% %% This library is free software; you can redistribute it and/or modify @@ -25,7 +25,9 @@ -define(APPLICATION, edoc). -define(INFO_FILE, "edoc-info"). +-define(PACKAGE_FILE, "package.edoc"). -define(OVERVIEW_FILE, "overview.edoc"). +-define(PACKAGE_SUMMARY, "package-summary"). -define(DEFAULT_SOURCE_SUFFIX, ".erl"). -define(DEFAULT_FILE_SUFFIX, ".html"). -define(DEFAULT_DOCLET, edoc_doclet). @@ -63,10 +65,13 @@ %% Environment for generating documentation data -record(env, {module = [], + package = [], root = "", file_suffix, + package_summary, apps, modules, + packages, app_default, macros = [], includes = [] diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_layout.erl erlang-17.3-dfsg/lib/edoc/src/edoc_layout.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_layout.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_layout.erl 2014-09-16 19:10:57.000000000 +0000 @@ -27,7 +27,7 @@ -module(edoc_layout). --export([module/2, overview/2, type/1]). +-export([module/2, package/2, overview/2, type/1]). -import(edoc_report, [report/2]). @@ -520,7 +520,7 @@ {R, ".\n"} = etypef(L, O), [{pre, R}] catch _:_ -> - %% Should not happen. + %% Example: "@spec ... -> record(a)" format_spec(Name, Type, Defs, Opts#opts{pretty_printer=''}) end; format_spec(Sep, Type, Defs, _Opts) -> @@ -535,8 +535,7 @@ pp_clause(Pre, Type) -> Types = ot_utype([Type]), Atom = lists:duplicate(iolist_size(Pre), $a), - Attr = {attribute,0,spec,{{list_to_atom(Atom),0},[Types]}}, - L1 = erl_pp:attribute(erl_parse:new_anno(Attr)), + L1 = erl_pp:attribute({attribute,0,spec,{{list_to_atom(Atom),0},[Types]}}), "-spec " ++ L2 = lists:flatten(L1), L3 = Pre ++ lists:nthtail(length(Atom), L2), re:replace(L3, "\n ", "\n", [{return,list},global]). @@ -556,8 +555,7 @@ pp_type(Prefix, Type) -> Atom = list_to_atom(lists:duplicate(iolist_size(Prefix), $a)), - Attr = {attribute,0,type,{Atom,ot_utype(Type),[]}}, - L1 = erl_pp:attribute(erl_parse:new_anno(Attr)), + L1 = erl_pp:attribute({attribute,0,type,{Atom,ot_utype(Type),[]}}), {L2,N} = case lists:dropwhile(fun(C) -> C =/= $: end, lists:flatten(L1)) of ":: " ++ L3 -> {L3,9}; % compensation for extra "()" and ":" "::\n" ++ L3 -> {"\n"++L3,6} @@ -703,8 +701,6 @@ end. behaviours(Es, Name) -> - CBs = get_content(callbacks, Es), - OCBs = get_content(optional_callbacks, Es), (case get_elem(behaviour, Es) of [] -> []; Es1 -> @@ -713,24 +709,13 @@ ?NL] end ++ - if CBs =:= [], OCBs =:= [] -> - []; - true -> - Req = if CBs =:= [] -> - []; - true -> - [br, " Required callback functions: "] - ++ seq(fun callback/1, CBs, ["."]) - end, - Opt = if OCBs =:= [] -> - []; - true -> - [br, " Optional callback functions: "] - ++ seq(fun callback/1, OCBs, ["."]) - end, + case get_content(callbacks, Es) of + [] -> []; + Es1 -> [{p, ([{b, ["This module defines the ", {tt, [Name]}, - " behaviour."]}] - ++ Req ++ Opt)}, + " behaviour."]}, + br, " Required callback functions: "] + ++ seq(fun callback/1, Es1, ["."]))}, ?NL] end). @@ -846,6 +831,8 @@ t_nonempty_list(Es); t_type([#xmlElement{name = map, content = Es}]) -> t_map(Es); +t_type([#xmlElement{name = map_field, content=Es}]) -> + t_map_field(Es); t_type([#xmlElement{name = tuple, content = Es}]) -> t_tuple(Es); t_type([#xmlElement{name = 'fun', content = Es}]) -> @@ -895,10 +882,9 @@ [") -> "] ++ t_utype(get_elem(type, Es))). t_map(Es) -> - Fs = get_elem(map_field, Es), - ["#{"] ++ seq(fun t_map_field/1, Fs, ["}"]). + ["#{"] ++ seq(fun t_utype_elem/1, Es, ["}"]). -t_map_field(#xmlElement{content = [K,V]}) -> +t_map_field([K,V]) -> t_utype_elem(K) ++ [" => "] ++ t_utype_elem(V). t_record(E, Es) -> @@ -980,6 +966,9 @@ local_label(R) -> "#" ++ R. +xhtml(Title, CSS, Body) -> + xhtml(Title, CSS, Body, "latin1"). + xhtml(Title, CSS, Body, Encoding) -> EncString = case Encoding of "latin1" -> "ISO-8859-1"; @@ -1009,6 +998,27 @@ xmerl:export_simple_content(t_utype_elem(E) ++ local_defs(Ds, Opts), ?HTML_EXPORT). +package(E=#xmlElement{name = package, content = Es}, Options) -> + Opts = init_opts(E, Options), + Name = get_text(packageName, Es), + Title = ["Package ", Name], + Desc = get_content(description, Es), +% ShortDesc = get_content(briefDescription, Desc), + FullDesc = get_content(fullDescription, Desc), + Body = ([?NL, {h1, [Title]}, ?NL] +% ++ ShortDesc + ++ copyright(Es) + ++ deprecated(Es, "package") + ++ version(Es) + ++ since(Es) + ++ authors(Es) + ++ references(Es) + ++ sees(Es) + ++ todos(Es) + ++ FullDesc), + XML = xhtml(Title, stylesheet(Opts), Body), + xmerl:export_simple(XML, ?HTML_EXPORT, []). + overview(E=#xmlElement{name = overview, content = Es}, Options) -> Opts = init_opts(E, Options), Title = [get_text(title, Es)], @@ -1074,6 +1084,8 @@ ot_tuple(Es); ot_type([#xmlElement{name = map, content = Es}]) -> ot_map(Es); +ot_type([#xmlElement{name = map_field, content = Es}]) -> + ot_map_field(Es); ot_type([#xmlElement{name = 'fun', content = Es}]) -> ot_fun(Es); ot_type([#xmlElement{name = record, content = Es}]) -> @@ -1087,8 +1099,8 @@ {var,0,list_to_atom(get_attrval(name, E))}. ot_atom(E) -> - {ok, [{atom,A,Name}], _} = erl_scan:string(get_attrval(value, E), 0), - {atom,erl_anno:line(A),Name}. + {ok, [Atom], _} = erl_scan:string(get_attrval(value, E), 0), + Atom. ot_integer(E) -> {integer,0,list_to_integer(get_attrval(value, E))}. @@ -1131,10 +1143,10 @@ {type,0,tuple,[ot_utype_elem(E) || E <- Es]}. ot_map(Es) -> - {type,0,map,[ot_map_field(E) || E <- get_elem(map_field,Es)]}. + {type,0,map,[ot_utype_elem(E) || E <- Es]}. -ot_map_field(#xmlElement{content=[K,V]}) -> - {type,0,map_field_assoc,ot_utype_elem(K), ot_utype_elem(V)}. +ot_map_field(Es) -> + {type,0,map_field_assoc,[ot_utype_elem(E) || E <- Es]}. ot_fun(Es) -> Range = ot_utype(get_elem(type, Es)), diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_lib.erl erlang-17.3-dfsg/lib/edoc/src/edoc_lib.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -29,9 +29,9 @@ get_first_sentence/1, is_space/1, strip_space/1, parse_expr/2, parse_contact/2, escape_uri/1, join_uri/2, is_relative_uri/1, is_name/1, to_label/1, find_doc_dirs/0, find_sources/2, - find_file/2, try_subdir/2, unique/1, - write_file/3, write_file/4, write_info_file/3, - read_info_file/1, get_doc_env/1, get_doc_env/3, copy_file/2, + find_sources/3, find_file/3, try_subdir/2, unique/1, + write_file/3, write_file/4, write_file/5, write_info_file/4, + read_info_file/1, get_doc_env/1, get_doc_env/4, copy_file/2, uri_get/1, run_doclet/2, run_layout/2, simplify_path/1, timestr/1, datestr/1, read_encoding/2]). @@ -266,6 +266,13 @@ is_name_1([]) -> true; is_name_1(_) -> false. +to_atom(A) when is_atom(A) -> A; +to_atom(S) when is_list(S) -> list_to_atom(S). + +to_list(A) when is_atom(A) -> atom_to_list(A); +to_list(S) when is_list(S) -> S. + + %% @private unique([X | Xs]) -> [X | unique(Xs, X)]; unique([]) -> []. @@ -667,7 +674,7 @@ try_subdir(Dir, Subdir) -> D = filename:join(Dir, Subdir), case filelib:is_dir(D) of - true -> D; + true -> D; false -> Dir end. @@ -679,10 +686,19 @@ %% @private write_file(Text, Dir, Name) -> - write_file(Text, Dir, Name, [{encoding,latin1}]). + write_file(Text, Dir, Name, ''). + +%% @spec (Text::deep_string(), Dir::edoc:filename(), +%% Name::edoc:filename(), Package::atom()|string()) -> ok +%% @doc Like {@link write_file/3}, but adds path components to the target +%% directory corresponding to the specified package. +%% @private -write_file(Text, Dir, Name, Options) -> - File = filename:join([Dir, Name]), +write_file(Text, Dir, Name, Package) -> + write_file(Text, Dir, Name, Package, [{encoding,latin1}]). + +write_file(Text, Dir, Name, Package, Options) -> + File = filename:join([Dir, to_list(Package), Name]), ok = filelib:ensure_dir(File), case file:open(File, [write] ++ Options) of {ok, FD} -> @@ -695,14 +711,15 @@ end. %% @private -write_info_file(App, Modules, Dir) -> - Ts = [{modules, Modules}], +write_info_file(App, Packages, Modules, Dir) -> + Ts = [{packages, Packages}, + {modules, Modules}], Ts1 = if App =:= ?NO_APP -> Ts; true -> [{application, App} | Ts] end, S0 = [io_lib:fwrite("~p.\n", [T]) || T <- Ts1], S = ["%% encoding: UTF-8\n" | S0], - write_file(S, Dir, ?INFO_FILE, [{encoding,unicode}]). + write_file(S, Dir, ?INFO_FILE, '', [{encoding,unicode}]). %% @spec (Name::edoc:filename()) -> {ok, string()} | {error, Reason} %% @@ -727,8 +744,9 @@ info_file_data(Ts) -> App = proplists:get_value(application, Ts, ?NO_APP), + Ps = proplists:append_values(packages, Ts), Ms = proplists:append_values(modules, Ts), - {App, Ms}. + {App, Ps, Ms}. %% Local file access - don't complain if file does not exist. @@ -743,10 +761,10 @@ {error, R} -> R1 = file:format_error(R), warning("could not read '~ts': ~ts.", [File, R1]), - {?NO_APP, []} - end; + {?NO_APP, [], []} + end; false -> - {?NO_APP, []} + {?NO_APP, [], []} end. %% URI access @@ -758,7 +776,7 @@ parse_info_file(Text, URI); {error, Msg} -> warning("could not read '~ts': ~ts.", [URI, Msg]), - {?NO_APP, []} + {?NO_APP, [], []} end. parse_info_file(Text, Name) -> @@ -767,10 +785,10 @@ info_file_data(Vs); {error, eof} -> warning("unexpected end of file in '~ts'.", [Name]), - {?NO_APP, []}; + {?NO_APP, [], []}; {error, {_Line,Module,R}} -> warning("~ts: ~ts.", [Module:format_error(R), Name]), - {?NO_APP, []} + {?NO_APP, [], []} end. parse_terms(Text) -> @@ -797,67 +815,82 @@ %% --------------------------------------------------------------------- -%% Source files +%% Source files and packages + +%% @private +find_sources(Path, Opts) -> + find_sources(Path, "", Opts). -%% @doc See {@link edoc:run/2} for a description of the options -%% `subpackages', `source_suffix'. +%% @doc See {@link edoc:run/3} for a description of the options +%% `subpackages', `source_suffix' and `exclude_packages'. %% @private -%% NEW-OPTIONS: subpackages, source_suffix -%% DEFER-OPTIONS: edoc:run/2 +%% NEW-OPTIONS: subpackages, source_suffix, exclude_packages +%% DEFER-OPTIONS: edoc:run/3 -find_sources(Path, Opts) -> +find_sources(Path, Pkg, Opts) -> Rec = proplists:get_bool(subpackages, Opts), Ext = proplists:get_value(source_suffix, Opts, ?DEFAULT_SOURCE_SUFFIX), - find_sources(Path, Rec, Ext, Opts). - -find_sources(Path, Rec, Ext, _Opts) -> - lists:flatten(find_sources_1(Path, Rec, Ext)). + find_sources(Path, Pkg, Rec, Ext, Opts). -find_sources_1([P | Ps], Rec, Ext) -> - Dir = P, - Fs1 = find_sources_1(Ps, Rec, Ext), +find_sources(Path, Pkg, Rec, Ext, Opts) -> + Skip = proplists:get_value(exclude_packages, Opts, []), + lists:flatten(find_sources_1(Path, to_atom(Pkg), Rec, Ext, Skip)). + +find_sources_1([P | Ps], Pkg, Rec, Ext, Skip) -> + Dir = filename:join(P, atom_to_list(Pkg)), + Fs1 = find_sources_1(Ps, Pkg, Rec, Ext, Skip), case filelib:is_dir(Dir) of true -> - [find_sources_2(Dir, Rec, Ext) | Fs1]; + [find_sources_2(Dir, Pkg, Rec, Ext, Skip) | Fs1]; false -> Fs1 end; -find_sources_1([], _Rec, _Ext) -> +find_sources_1([], _Pkg, _Rec, _Ext, _Skip) -> []. -find_sources_2(Dir, Rec, Ext) -> - Es = list_dir(Dir, false), % just warn if listing fails - Es1 = [{E, Dir} || E <- Es, is_source_file(E, Ext)], - case Rec of +find_sources_2(Dir, Pkg, Rec, Ext, Skip) -> + case lists:member(Pkg, Skip) of + false -> + Es = list_dir(Dir, false), % just warn if listing fails + Es1 = [{Pkg, E, Dir} || E <- Es, is_source_file(E, Ext)], + case Rec of true -> - [find_sources_3(Es, Dir, Rec, Ext) | Es1]; + [find_sources_3(Es, Dir, Pkg, Rec, Ext, Skip) | Es1]; false -> - Es1 - end. + Es1 + end; + true -> + [] + end. -find_sources_3(Es, Dir, Rec, Ext) -> +find_sources_3(Es, Dir, Pkg, Rec, Ext, Skip) -> [find_sources_2(filename:join(Dir, E), - Rec, Ext) - || E <- Es, is_source_dir(E, Dir)]. + to_atom(join(Pkg, E)), Rec, Ext, Skip) + || E <- Es, is_package_dir(E, Dir)]. + +join('', E) -> E; +join(Pkg, E) -> filename:join(Pkg, E). is_source_file(Name, Ext) -> (filename:extension(Name) == Ext) andalso is_name(filename:rootname(Name, Ext)). -is_source_dir(Name, Dir) -> - filelib:is_dir(filename:join(Dir, Name)). +is_package_dir(Name, Dir) -> + is_name(filename:rootname(filename:basename(Name))) + andalso filelib:is_dir(filename:join(Dir, Name)). %% @private -find_file([P | Ps], Name) -> +find_file([P | Ps], []=Pkg, Name) -> + Pkg = [], File = filename:join(P, Name), case filelib:is_file(File) of true -> - File; + File; false -> - find_file(Ps, Name) - end; -find_file([], _Name) -> + find_file(Ps, Pkg, Name) + end; +find_file([], [], _Name) -> "". %% @private @@ -876,7 +909,7 @@ File = filename:join(Dir, ?INFO_FILE), case filelib:is_file(File) of true -> - [Dir | find_doc_dirs(Ps)]; + [Dir | find_doc_dirs(Ps)]; false -> find_doc_dirs(Ps) end; @@ -888,23 +921,24 @@ %% implies that we use the default app-path. %% NEW-OPTIONS: doc_path -%% DEFER-OPTIONS: get_doc_env/3 +%% DEFER-OPTIONS: get_doc_env/4 -get_doc_links(App, Modules, Opts) -> +get_doc_links(App, Packages, Modules, Opts) -> Path = proplists:append_values(doc_path, Opts) ++ find_doc_dirs(), Ds = [{P, uri_get_info_file(P)} || P <- Path], - Ds1 = [{"", {App, Modules}} | Ds], + Ds1 = [{"", {App, Packages, Modules}} | Ds], D = dict:new(), - make_links(Ds1, D, D). + make_links(Ds1, D, D, D). -make_links([{Dir, {App, Ms}} | Ds], A, M) -> +make_links([{Dir, {App, Ps, Ms}} | Ds], A, P, M) -> A1 = if App == ?NO_APP -> A; true -> add_new(App, Dir, A) end, F = fun (K, D) -> add_new(K, Dir, D) end, + P1 = lists:foldl(F, P, Ps), M1 = lists:foldl(F, M, Ms), - make_links(Ds, A1, M1); -make_links([], A, M) -> + make_links(Ds, A1, P1, M1); +make_links([], A, P, M) -> F = fun (D) -> fun (K) -> case dict:find(K, D) of @@ -913,7 +947,7 @@ end end end, - {F(A), F(M)}. + {F(A), F(P), F(M)}. add_new(K, V, D) -> case dict:is_key(K, D) of @@ -924,14 +958,15 @@ end. %% @spec (Options::proplist()) -> edoc_env() -%% @equiv get_doc_env([], [], Opts) +%% @equiv get_doc_env([], [], [], Opts) %% @private get_doc_env(Opts) -> - get_doc_env([], [], Opts). + get_doc_env([], [], [], Opts). -%% @spec (App, Modules, Options::proplist()) -> edoc_env() +%% @spec (App, Packages, Modules, Options::proplist()) -> edoc_env() %% App = [] | atom() +%% Packages = [atom()] %% Modules = [atom()] %% proplist() = [term()] %% @@ -940,7 +975,7 @@ %% generating references. The data representation is not documented. %% %% @doc Creates an environment data structure used by parts of EDoc for -%% generating references, etc. See {@link edoc:run/2} for a description +%% generating references, etc. See {@link edoc:run/3} for a description %% of the options `file_suffix', `app_default' and `doc_path'. %% %% @see edoc_extract:source/4 @@ -948,17 +983,19 @@ %% NEW-OPTIONS: file_suffix, app_default %% INHERIT-OPTIONS: get_doc_links/4 -%% DEFER-OPTIONS: edoc:run/2 +%% DEFER-OPTIONS: edoc:run/3 -get_doc_env(App, Modules, Opts) -> +get_doc_env(App, Packages, Modules, Opts) -> Suffix = proplists:get_value(file_suffix, Opts, ?DEFAULT_FILE_SUFFIX), AppDefault = proplists:get_value(app_default, Opts, ?APP_DEFAULT), Includes = proplists:append_values(includes, Opts), - {A, M} = get_doc_links(App, Modules, Opts), + {A, P, M} = get_doc_links(App, Packages, Modules, Opts), #env{file_suffix = Suffix, + package_summary = ?PACKAGE_SUMMARY ++ Suffix, apps = A, + packages = P, modules = M, app_default = AppDefault, includes = Includes @@ -967,10 +1004,10 @@ %% --------------------------------------------------------------------- %% Plug-in modules -%% @doc See {@link edoc:run/2} for a description of the `doclet' option. +%% @doc See {@link edoc:run/3} for a description of the `doclet' option. %% NEW-OPTIONS: doclet -%% DEFER-OPTIONS: edoc:run/2 +%% DEFER-OPTIONS: edoc:run/3 %% @private run_doclet(Fun, Opts) -> @@ -1012,7 +1049,7 @@ %% --------------------------------------------------------------------- %% Error handling --type line() :: erl_anno:line(). +-type line() :: erl_scan:line(). -type err() :: 'eof' | {'missing', char()} | {line(), atom(), string()} diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_macros.erl erlang-17.3-dfsg/lib/edoc/src/edoc_macros.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_macros.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_macros.erl 2014-09-16 19:10:57.000000000 +0000 @@ -40,6 +40,10 @@ true -> [{module, atom_to_list(Env#env.module)}] end ++ + if Env#env.package =:= [] -> []; + true -> [{package, atom_to_list(Env#env.package)}] + end + ++ [{date, fun date_macro/3}, {docRoot, Env#env.root}, {link, fun link_macro/3}, @@ -311,7 +315,7 @@ macro_content([], _As, _L, _N) -> throw('end'). --type line() :: erl_anno:line(). +-type line() :: erl_scan:line(). -type err() :: 'unterminated_macro' | 'macro_name' | {'macro_name', string()} diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_parser.yrl erlang-17.3-dfsg/lib/edoc/src/edoc_parser.yrl --- erlang-18.2-dfsg/lib/edoc/src/edoc_parser.yrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_parser.yrl 2014-09-16 19:10:57.000000000 +0000 @@ -28,7 +28,7 @@ Nonterminals start spec func_type utype_list utype_tuple utypes utype ptypes ptype nutype function_name where_defs defs defs2 def typedef etype -throws qname ref aref mref lref var_list vars fields field +throws qname ref aref mref lref pref var_list vars fields field utype_map utype_map_fields utype_map_field futype_list bin_base_type bin_unit_type. @@ -207,11 +207,14 @@ ref -> aref: '$1'. ref -> mref: '$1'. ref -> lref: '$1'. +ref -> pref: '$1'. aref -> '//' atom: edoc_refs:app(tok_val('$2')). aref -> '//' atom '/' mref: edoc_refs:app(tok_val('$2'), '$4'). +aref -> '//' atom '/' pref: + edoc_refs:app(tok_val('$2'), '$4'). mref -> qname ':' atom '/' integer: edoc_refs:function(qname('$1'), tok_val('$3'), tok_val('$5')). @@ -220,6 +223,9 @@ mref -> qname: edoc_refs:module(qname('$1')). +pref -> qname '.' '*': + edoc_refs:package(qname('$1')). + lref -> atom '/' integer: edoc_refs:function(tok_val('$1'), tok_val('$3')). lref -> atom '(' ')': @@ -338,7 +344,7 @@ args = lists:reverse(As)}, type = T}; false -> - return_error(tok_line(P), "variable expected after '('") + return_error(element(2, P), "variable expected after '('") end. all_vars([#t_var{} | As]) -> @@ -393,7 +399,7 @@ %% @doc Parses a reference to a module, -%% function, type, or application +%% package, function, type, or application parse_ref(S, L) -> case edoc_scanner:string(S, L) of @@ -452,7 +458,7 @@ %% --------------------------------------------------------------------- --spec throw_error(term(), erl_anno:line()) -> no_return(). +-spec throw_error(term(), erl_scan:line()) -> no_return(). throw_error({parse_spec, E}, L) -> throw_error({"specification", E}, L); diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_refs.erl erlang-17.3-dfsg/lib/edoc/src/edoc_refs.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_refs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_refs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -27,9 +27,10 @@ -module(edoc_refs). --export([app/1, app/2, module/1, module/2, module/3, +-export([app/1, app/2, package/1, module/1, module/2, module/3, function/2, function/3, function/4, type/1, type/2, type/3, - to_string/1, to_label/1, get_uri/2, is_top/2]). + to_string/1, to_label/1, get_uri/2, is_top/2, + relative_module_path/2, relative_package_path/2]). -import(edoc_lib, [join_uri/2, escape_uri/1]). @@ -55,6 +56,9 @@ module(App, M, Ref) -> app(App, module(M, Ref)). +package(P) -> + {package, P}. + function(F, A) -> {function, F, A}. @@ -84,6 +88,8 @@ atom_to_list(M) ; to_string({module, M, Ref}) -> atom_to_list(M) ++ ":" ++ to_string(Ref); +to_string({package, P}) -> + atom_to_list(P) ++ ".*"; to_string({function, F, A}) -> atom_to_list(F) ++ "/" ++ integer_to_list(A); to_string({type, T}) -> @@ -105,19 +111,24 @@ module_ref(M, Env) ++ "#" ++ to_label(Ref); get_uri({module, M}, Env) -> module_ref(M, Env); +get_uri({package, P}, Env) -> + package_ref(P, Env); get_uri(Ref, _Env) -> "#" ++ to_label(Ref). abs_uri({module, M}, Env) -> module_absref(M, Env); abs_uri({module, M, Ref}, Env) -> - module_absref(M, Env) ++ "#" ++ to_label(Ref). + module_absref(M, Env) ++ "#" ++ to_label(Ref); +abs_uri({package, P}, Env) -> + package_absref(P, Env). module_ref(M, Env) -> case (Env#env.modules)(M) of "" -> File = atom_to_list(M) ++ Env#env.file_suffix, - escape_uri(File); + Path = relative_module_path(M, Env#env.package), + join_uri(Path, escape_uri(File)); Base -> join_uri(Base, module_absref(M, Env)) end. @@ -125,6 +136,19 @@ module_absref(M, Env) -> escape_uri(atom_to_list(M)) ++ escape_uri(Env#env.file_suffix). +package_ref(P, Env) -> + case (Env#env.packages)(P) of + "" -> + join_uri(relative_package_path(P, Env#env.package), + escape_uri(Env#env.package_summary)); + Base -> + join_uri(Base, package_absref(P, Env)) + end. + +package_absref(P, Env) -> + join_uri(escape_uri(atom_to_list(P)), + escape_uri(Env#env.package_summary)). + app_ref(A, Env) -> case (Env#env.apps)(A) of "" -> @@ -142,3 +166,43 @@ is_top(_Ref, _Env) -> false. +%% Each segment of a path must be separately escaped before joining. + +join_segments([S]) -> + escape_uri(S); +join_segments([S | Ss]) -> + join_uri(escape_uri(S), join_segments(Ss)). + +%% 'From' is always the "current package" here: + +%% The empty string is returned if the To module has only one segment, +%% implying a local reference. + +relative_module_path(_To, _From) -> + "". + +relative_package_path(To, From) -> + relative_path([atom_to_list(To)], [atom_to_list(From)]). + +%% This takes two lists of path segments (From, To). Note that an empty +%% string will be returned if the paths are the same. Empty leading +%% segments are stripped from both paths. + +relative_path(Ts, ["" | Fs]) -> + relative_path(Ts, Fs); +relative_path(["" | Ts], Fs) -> + relative_path(Ts, Fs); +relative_path(Ts, Fs) -> + relative_path_1(Ts, Fs). + +relative_path_1([T | Ts], [F | Fs]) when F == T -> + relative_path_1(Ts, Fs); +relative_path_1(Ts, Fs) -> + relative_path_2(Fs, Ts). + +relative_path_2([_F | Fs], Ts) -> + relative_path_2(Fs, [".." | Ts]); +relative_path_2([], []) -> + ""; +relative_path_2([], Ts) -> + join_segments(Ts). diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_run.erl erlang-17.3-dfsg/lib/edoc/src/edoc_run.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_run.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_run.erl 2014-09-16 19:10:57.000000000 +0000 @@ -17,7 +17,7 @@ %% @copyright 2003 Richard Carlsson %% @author Richard Carlsson %% @see edoc -%% @end +%% @end %% ===================================================================== %% @doc Interface for calling EDoc from Erlang startup options. @@ -38,7 +38,7 @@ -module(edoc_run). --export([file/1, application/1, files/1, toc/1]). +-export([file/1, application/1, packages/1, files/1, toc/1]). -compile({no_auto_import,[error/1]}). @@ -92,6 +92,28 @@ end, run(F). +%% @spec packages([string()]) -> none() +%% +%% @doc Calls {@link edoc:application/2} with the corresponding +%% arguments. The strings in the list are parsed as Erlang constant +%% terms. The list can be either `[Packages]' or `[Packages, Options]'. +%% In the first case {@link edoc:application/1} is called instead. +%% +%% The function call never returns; instead, the emulator is +%% automatically terminated when the call has completed, signalling +%% success or failure to the operating system. + +packages(Args) -> + F = fun () -> + case parse_args(Args) of + [Packages] -> edoc:packages(Packages); + [Packages, Opts] -> edoc:packages(Packages, Opts); + _ -> + invalid_args("edoc_run:packages/1", Args) + end + end, + run(F). + %% @hidden Not official yet toc(Args) -> F = fun () -> @@ -109,8 +131,8 @@ %% %% @deprecated This is part of the old interface to EDoc and is mainly %% kept for backwards compatibility. The preferred way of generating -%% documentation is through one of the functions {@link application/1} -%% and {@link files/1}. +%% documentation is through one of the functions {@link application/1}, +%% {@link packages/1} and {@link files/1}. %% %% @doc Calls {@link edoc:file/2} with the corresponding arguments. The %% strings in the list are parsed as Erlang constant terms. The list can diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_scanner.erl erlang-17.3-dfsg/lib/edoc/src/edoc_scanner.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_scanner.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_scanner.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,13 +1,12 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and %% limitations under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_specs.erl erlang-17.3-dfsg/lib/edoc/src/edoc_specs.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_specs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_specs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -59,7 +58,7 @@ end, {#t_name{name = N}, T, As, Doc0} end, - #tag{name = type, line = get_line(element(2, Type)), + #tag{name = type, line = element(2, Type), origin = code, data = {#t_typedef{name = TypeName, args = d2e(Args), @@ -72,7 +71,7 @@ spec(Form, Clause) -> {Name, _Arity, TypeSpecs} = get_spec(Form), TypeSpec = lists:nth(Clause, TypeSpecs), - #tag{name = spec, line = get_line(element(2, TypeSpec)), + #tag{name = spec, line = element(2, TypeSpec), origin = code, data = aspec(d2e(TypeSpec), Name)}. @@ -84,7 +83,7 @@ {#t_name{name = Name}, Arity, TypeSpecs} = get_spec(Form), As = string:join(lists:duplicate(Arity, "_X"), ","), S = lists:flatten(io_lib:format("~p(~s) -> true\n", [Name, As])), - #tag{name = spec, line = get_line(element(2, hd(TypeSpecs))), + #tag{name = spec, line = element(2, hd(TypeSpecs)), origin = code, data = S}. -spec docs(Forms::[syntaxTree()], @@ -141,7 +140,7 @@ %% Postcomments before the dot after the typespec are ignored. C2 = [C1 | [C || C <- erl_syntax:get_postcomments(F), - erl_syntax:get_pos(C) >= LastTypeLine]], + get_line(erl_syntax:get_pos(C)) >= LastTypeLine]], C3 = collect_comments(Fs, LastTypeLine), #tag{data = Doc0} = Fun(lists:reverse(C2 ++ C3), LastTypeLine), case strip(Doc0) of % Strip away "f(). \n" @@ -158,7 +157,7 @@ collect_comments([], _Line) -> []; collect_comments([F | Fs], Line) -> - L1 = erl_syntax:get_pos(F), + L1 = get_line(erl_syntax:get_pos(F)), if L1 =:= Line + 1; L1 =:= Line -> % a separate postcomment @@ -191,26 +190,29 @@ {Name, Data} = erl_syntax_lib:analyze_wild_attribute(F), type = edoc_specs:tag(Name), Attr = {attribute, erl_syntax:get_pos(F), Name, Data}, - Fun = fun(A) -> - Line = get_line(A), - case get('$max_line') of - Max when Max < Line -> - _ = put('$max_line', Line); - _ -> - ok - end - end, - undefined = put('$max_line', 0), - _ = erl_parse:map_anno(Fun, Attr), - Line = erase('$max_line'), + Ref = make_ref(), + Fun = fun(L) -> {Ref, get_line(L)} end, TypeName = case Data of {N, _T, As} when is_atom(N) -> % skip records {N, length(As)} end, + Line = gll(erl_lint:modify_line(Attr, Fun), Ref), {TypeName, Line}. -get_line(Anno) -> - erl_anno:line(Anno). +gll({Ref, Line}, Ref) -> + Line; +gll([], _Ref) -> + 0; +gll(List, Ref) when is_list(List) -> + lists:max([gll(E, Ref) || E <- List]); +gll(Tuple, Ref) when is_tuple(Tuple) -> + gll(tuple_to_list(Tuple), Ref); +gll(_, _) -> + 0. + +get_line(Pos) -> + {line, Line} = erl_scan:attributes_info(Pos, line), + Line. %% Collect all Erlang types. Types in comments (@type) shadow Erlang %% types (-spec/-opaque). @@ -296,54 +298,47 @@ is_name(A) -> is_atom(A). -d2e(T) -> - d2e(T, 0). - -d2e({ann_type,_,[V, T0]}, Prec) -> +d2e({ann_type,_,[V, T0]}) -> %% Note: the -spec/-type syntax allows annotations everywhere, but %% EDoc does not. The fact that the annotation is added to the %% type here does not necessarily mean that it will be used by the %% layout module. - {_L,P,R} = erl_parse:type_inop_prec('::'), - T1 = d2e(T0, R), - T = ?add_t_ann(T1, element(3, V)), - maybe_paren(P, Prec, T); % the only necessary call to maybe_paren() -d2e({remote_type,_,[{atom,_,M},{atom,_,F},Ts0]}, _Prec) -> + T = d2e(T0), + ?add_t_ann(T, element(3, V)); +d2e({remote_type,_,[{atom,_,M},{atom,_,F},Ts0]}) -> Ts = d2e(Ts0), typevar_anno(#t_type{name = #t_name{module = M, name = F}, args = Ts}, Ts); -d2e({type,_,'fun',[{type,_,product,As0},Ran0]}, _Prec) -> +d2e({type,_,'fun',[{type,_,product,As0},Ran0]}) -> Ts = [Ran|As] = d2e([Ran0|As0]), %% Assume that the linter has checked type variables. typevar_anno(#t_fun{args = As, range = Ran}, Ts); -d2e({type,_,'fun',[A0={type,_,any},Ran0]}, _Prec) -> +d2e({type,_,'fun',[A0={type,_,any},Ran0]}) -> Ts = [A, Ran] = d2e([A0, Ran0]), typevar_anno(#t_fun{args = [A], range = Ran}, Ts); -d2e({type,_,'fun',[]}, _Prec) -> +d2e({type,_,'fun',[]}) -> #t_type{name = #t_name{name = function}, args = []}; -d2e({type,_,any}, _Prec) -> +d2e({type,_,any}) -> #t_var{name = '...'}; % Kludge... not a type variable! -d2e({type,_,nil,[]}, _Prec) -> +d2e({type,_,nil,[]}) -> #t_nil{}; -d2e({paren_type,_,[T]}, Prec) -> - d2e(T, Prec); -d2e({type,_,list,[T0]}, _Prec) -> +d2e({paren_type,_,[T]}) -> + #t_paren{type = d2e(T)}; +d2e({type,_,list,[T0]}) -> T = d2e(T0), typevar_anno(#t_list{type = T}, [T]); -d2e({type,_,nonempty_list,[T0]}, _Prec) -> +d2e({type,_,nonempty_list,[T0]}) -> T = d2e(T0), typevar_anno(#t_nonempty_list{type = T}, [T]); -d2e({type,_,bounded_fun,[T,Gs]}, _Prec) -> +d2e({type,_,bounded_fun,[T,Gs]}) -> [F0|Defs] = d2e([T|Gs]), F = ?set_t_ann(F0, lists:keydelete(type_variables, 1, ?t_ann(F0))), %% Assume that the linter has checked type variables. #t_spec{type = typevar_anno(F, [F0]), defs = Defs}; -d2e({type,_,range,[V1,V2]}, Prec) -> - {_L,P,_R} = erl_parse:type_inop_prec('..'), +d2e({type,_,range,[V1,V2]}) -> {integer,_,I1} = erl_eval:partial_eval(V1), {integer,_,I2} = erl_eval:partial_eval(V2), - T0 = #t_integer_range{from = I1, to = I2}, - maybe_paren(P, Prec, T0); -d2e({type,_,constraint,[Sub,Ts0]}, _Prec) -> + #t_integer_range{from = I1, to = I2}; +d2e({type,_,constraint,[Sub,Ts0]}) -> case {Sub,Ts0} of {{atom,_,is_subtype},[{var,_,N},T0]} -> Ts = [T] = d2e([T0]), @@ -353,62 +348,49 @@ Ts = [ST,T] = d2e([ST0,T0]), #t_def{name = ST, type = typevar_anno(T, Ts)}; _ -> - throw_error(get_line(element(2, Sub)), "cannot handle guard", []) + throw_error(element(2, Sub), "cannot handle guard", []) end; -d2e({type,_,union,Ts0}, Prec) -> - {_L,P,R} = erl_parse:type_inop_prec('|'), - Ts = d2e(Ts0, R), - T = maybe_paren(P, Prec, #t_union{types = Ts}), - typevar_anno(T, Ts); -d2e({type,_,tuple,any}, _Prec) -> +d2e({type,_,union,Ts0}) -> + Ts = d2e(Ts0), + typevar_anno(#t_union{types = Ts}, Ts); +d2e({type,_,tuple,any}) -> #t_type{name = #t_name{name = tuple}, args = []}; -d2e({type,_,binary,[Base,Unit]}, _Prec) -> - {integer,_,B} = erl_eval:partial_eval(Base), - {integer,_,U} = erl_eval:partial_eval(Unit), - #t_binary{base_size = B, unit_size = U}; -d2e({type,_,map,any}, _Prec) -> - #t_map{types = []}; -d2e({type,_,map,Es}, _Prec) -> - #t_map{types = d2e(Es) }; -d2e({type,_,map_field_assoc,[K,V]}, Prec) -> - T = #t_map_field{k_type = d2e(K), v_type=d2e(V) }, - {P,_R} = erl_parse:type_preop_prec('#'), - maybe_paren(P, Prec, T); -d2e({type,_,map_field_exact,K,V}, Prec) -> - T = #t_map_field{k_type = d2e(K), v_type=d2e(V) }, - {P,_R} = erl_parse:type_preop_prec('#'), - maybe_paren(P, Prec, T); -d2e({type,_,tuple,Ts0}, _Prec) -> +d2e({type,_,binary,[Base,Unit]}) -> + #t_binary{base_size = element(3, Base), + unit_size = element(3, Unit)}; +d2e({type,_,map,any}) -> + #t_map{ types = []}; +d2e({type,_,map,Es}) -> + #t_map{ types = d2e(Es) }; +d2e({type,_,map_field_assoc,K,V}) -> + #t_map_field{ k_type = d2e(K), v_type=d2e(V) }; +d2e({type,_,map_field_exact,K,V}) -> + #t_map_field{ k_type = d2e(K), v_type=d2e(V) }; +d2e({type,_,tuple,Ts0}) -> Ts = d2e(Ts0), typevar_anno(#t_tuple{types = Ts}, Ts); -d2e({type,_,record,[Name|Fs0]}, Prec) -> +d2e({type,_,record,[Name|Fs0]}) -> Atom = #t_atom{val = element(3, Name)}, Fs = d2e(Fs0), - {P,_R} = erl_parse:type_preop_prec('#'), - T = maybe_paren(P, Prec, #t_record{name = Atom, fields = Fs}), - typevar_anno(T, Fs); -d2e({type,_,field_type,[Name,Type0]}, Prec) -> - {_L,P,R} = erl_parse:type_inop_prec('::'), - Type = maybe_paren(P, Prec, d2e(Type0, R)), - T = #t_field{name = #t_atom{val = element(3, Name)}, type = Type}, - typevar_anno(T, [Type]); -d2e({typed_record_field,{record_field,L,Name},Type}, Prec) -> - d2e({type,L,field_type,[Name,Type]}, Prec); -d2e({typed_record_field,{record_field,L,Name,_E},Type}, Prec) -> - d2e({type,L,field_type,[Name,Type]}, Prec); -d2e({record_field,L,_Name,_E}=F, Prec) -> - d2e({typed_record_field,F,{type,L,any,[]}}, Prec); % Maybe skip... -d2e({record_field,L,_Name}=F, Prec) -> - d2e({typed_record_field,F,{type,L,any,[]}}, Prec); % Maybe skip... -d2e({type,_,Name,Types0}, _Prec) -> + typevar_anno(#t_record{name = Atom, fields = Fs}, Fs); +d2e({type,_,field_type,[Name,Type0]}) -> + Type = d2e(Type0), + typevar_anno(#t_field{name = #t_atom{val = element(3, Name)}, type = Type}, + [Type]); +d2e({typed_record_field,{record_field,L,Name},Type}) -> + d2e({type,L,field_type,[Name,Type]}); +d2e({typed_record_field,{record_field,L,Name,_E},Type}) -> + d2e({type,L,field_type,[Name,Type]}); +d2e({record_field,L,_Name,_E}=F) -> + d2e({typed_record_field,F,{type,L,any,[]}}); % Maybe skip... +d2e({record_field,L,_Name}=F) -> + d2e({typed_record_field,F,{type,L,any,[]}}); % Maybe skip... +d2e({type,_,Name,Types0}) -> Types = d2e(Types0), typevar_anno(#t_type{name = #t_name{name = Name}, args = Types}, Types); -d2e({user_type,_,Name,Types0}, _Prec) -> - Types = d2e(Types0), - typevar_anno(#t_type{name = #t_name{name = Name}, args = Types}, Types); -d2e({var,_,'_'}, _Prec) -> +d2e({var,_,'_'}) -> #t_type{name = #t_name{name = ?TOP_TYPE}}; -d2e({var,_,TypeName}, _Prec) -> +d2e({var,_,TypeName}) -> TypeVar = ordsets:from_list([TypeName]), T = #t_var{name = TypeName}, %% Annotate type variables with the name of the variable. @@ -416,13 +398,13 @@ %% from using the argument name from the source or to invent a new name. T1 = ?add_t_ann(T, {type_variables, TypeVar}), ?add_t_ann(T1, TypeName); -d2e(L, Prec) when is_list(L) -> - [d2e(T, Prec) || T <- L]; -d2e({atom,_,A}, _Prec) -> +d2e(L) when is_list(L) -> + [d2e(T) || T <- L]; +d2e({atom,_,A}) -> #t_atom{val = A}; -d2e(undefined = U, _Prec) -> % opaque +d2e(undefined = U) -> % opaque U; -d2e(Expr, _Prec) -> +d2e(Expr) -> {integer,_,I} = erl_eval:partial_eval(Expr), #t_integer{val = I}. @@ -440,11 +422,6 @@ get_typevars(Ts) -> [Vs || T <- Ts, T =/= undefined, {type_variables, Vs} <- ?t_ann(T)]. -maybe_paren(P, Prec, T) when P < Prec -> - #t_paren{type = T}; -maybe_paren(_P, _Prec, T) -> - T. - -record(parms, {tab, warn, file, line}). %% Expands record references. Explicitly given record fields are kept, @@ -507,11 +484,11 @@ Args = xrecs(Args0, P), Range = xrecs(Range0, P), T#t_fun{args = Args, range = Range}; -xrecs(#t_map{types = Ts0 }=T,P) -> +xrecs(#t_map{ types = Ts0 }=T,P) -> Ts = xrecs(Ts0, P), - T#t_map{types = Ts }; -xrecs(#t_map_field{k_type=Kt, v_type=Vt}=T, P) -> - T#t_map_field{k_type=xrecs(Kt,P), v_type=xrecs(Vt,P)}; + T#t_map{ types = Ts }; +xrecs(#t_map_field{ k_type=Kt, v_type=Vt}=T, P) -> + T#t_map_field{ k_type=xrecs(Kt,P), v_type=xrecs(Vt,P)}; xrecs(#t_tuple{types = Types0}=T, P) -> Types = xrecs(Types0, P), T#t_tuple{types = Types}; diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_tags.erl erlang-17.3-dfsg/lib/edoc/src/edoc_tags.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_tags.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_tags.erl 2014-09-16 19:10:57.000000000 +0000 @@ -42,7 +42,7 @@ %% Name = atom() %% Parser = text | xml | (Text,Line,Where) -> term() %% Flags = [Flag] -%% Flag = module | function | overview | single +%% Flag = module | function | package | overview | single %% %% Note that the pseudo-tag '@clear' is not listed here. %% (Cf. the function 'filter_tags'.) @@ -57,11 +57,11 @@ %% - @category (useless; superseded by keywords or free text search) tags() -> - All = [module,footer,function,overview], - [{author, fun parse_contact/4, [module,overview]}, - {copyright, text, [module,overview,single]}, - {deprecated, xml, [module,function,single]}, - {doc, xml, [module,function,overview,single]}, + All = [module,footer,function,package,overview], + [{author, fun parse_contact/4, [module,package,overview]}, + {copyright, text, [module,package,overview,single]}, + {deprecated, xml, [module,function,package,single]}, + {doc, xml, [module,function,package,overview,single]}, {docfile, fun parse_file/4, All}, {'end', text, All}, {equiv, fun parse_expr/4, [function,single]}, @@ -69,17 +69,17 @@ {hidden, text, [module,function,single]}, {param, fun parse_param/4, [function]}, {private, text, [module,function,single]}, - {reference, xml, [module,footer,overview]}, + {reference, xml, [module,footer,package,overview]}, {returns, xml, [function,single]}, - {see, fun parse_see/4, [module,function,overview]}, - {since, text, [module,function,overview,single]}, + {see, fun parse_see/4, [module,function,package,overview]}, + {since, text, [module,function,package,overview,single]}, {spec, fun parse_spec/4, [function,single]}, {throws, fun parse_throws/4, [function,single]}, {title, text, [overview,single]}, {'TODO', xml, All}, {todo, xml, All}, {type, fun parse_typedef/4, [module,footer,function]}, - {version, text, [module,overview,single]}]. + {version, text, [module,package,overview,single]}]. aliases('TODO') -> todo; aliases(return) -> returns; @@ -329,7 +329,10 @@ NAs = length(As), case edoc_types:is_predefined(T, NAs) of true -> - case edoc_types:is_new_predefined(T, NAs) of + case + edoc_types:is_new_predefined(T, NAs) + orelse edoc_types:is_predefined_otp_type(T, NAs) + of false -> throw_error(Line, {"redefining built-in type '~w'.", [T]}); @@ -342,7 +345,7 @@ Def end. --type line() :: erl_anno:line(). +-type line() :: erl_scan:line(). -spec parse_file(_, line(), _, _) -> no_return(). @@ -369,7 +372,7 @@ {string, _, File} -> Dir = filename:dirname(Where), Path = Env#env.includes ++ [Dir], - case edoc_lib:find_file(Path, File) of + case edoc_lib:find_file(Path, "", File) of "" -> throw_error(Line, {file_not_found, File}); File1 -> @@ -496,6 +499,7 @@ Mod =/= [] orelse lists:member(TypeName, ets:lookup(DT, Name)) orelse edoc_types:is_predefined(N, NArgs) + orelse edoc_types:is_predefined_otp_type(N, NArgs) orelse lists:member(TypeName, LocalTypes) of true -> diff -Nru erlang-18.2-dfsg/lib/edoc/src/edoc_types.erl erlang-17.3-dfsg/lib/edoc/src/edoc_types.erl --- erlang-18.2-dfsg/lib/edoc/src/edoc_types.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/edoc_types.erl 2014-09-16 19:10:57.000000000 +0000 @@ -25,7 +25,7 @@ -module(edoc_types). --export([is_predefined/2, is_new_predefined/2, +-export([is_predefined/2, is_new_predefined/2, is_predefined_otp_type/2, to_ref/1, to_xml/2, to_label/1, arg_names/1, set_arg_names/2, arg_descs/1, range_desc/1]). @@ -34,13 +34,67 @@ -include("edoc_types.hrl"). -include_lib("xmerl/include/xmerl.hrl"). + +is_predefined(any, 0) -> true; +is_predefined(atom, 0) -> true; +is_predefined(binary, 0) -> true; +is_predefined(bool, 0) -> true; % kept for backwards compatibility +is_predefined(char, 0) -> true; is_predefined(cons, 2) -> true; is_predefined(deep_string, 0) -> true; -is_predefined(F, A) -> erl_internal:is_type(F, A). - +is_predefined(float, 0) -> true; +is_predefined(function, 0) -> true; +is_predefined(integer, 0) -> true; +is_predefined(list, 0) -> true; +is_predefined(list, 1) -> true; +is_predefined(nil, 0) -> true; +is_predefined(none, 0) -> true; +is_predefined(no_return, 0) -> true; +is_predefined(number, 0) -> true; +is_predefined(pid, 0) -> true; +is_predefined(port, 0) -> true; +is_predefined(reference, 0) -> true; +is_predefined(string, 0) -> true; +is_predefined(term, 0) -> true; +is_predefined(tuple, 0) -> true; +is_predefined(F, A) -> is_new_predefined(F, A). + +%% Should eventually be coalesced with is_predefined/2. +is_new_predefined(arity, 0) -> true; +is_new_predefined(bitstring, 0) -> true; +is_new_predefined(boolean, 0) -> true; +is_new_predefined(byte, 0) -> true; +is_new_predefined(iodata, 0) -> true; +is_new_predefined(iolist, 0) -> true; is_new_predefined(map, 0) -> true; +is_new_predefined(maybe_improper_list, 0) -> true; +is_new_predefined(maybe_improper_list, 2) -> true; +is_new_predefined(mfa, 0) -> true; +is_new_predefined(module, 0) -> true; +is_new_predefined(neg_integer, 0) -> true; +is_new_predefined(node, 0) -> true; +is_new_predefined(non_neg_integer, 0) -> true; +is_new_predefined(nonempty_improper_list, 2) -> true; +is_new_predefined(nonempty_list, 0) -> true; +is_new_predefined(nonempty_list, 1) -> true; +is_new_predefined(nonempty_maybe_improper_list, 0) -> true; +is_new_predefined(nonempty_maybe_improper_list, 2) -> true; +is_new_predefined(nonempty_string, 0) -> true; +is_new_predefined(pos_integer, 0) -> true; +is_new_predefined(timeout, 0) -> true; is_new_predefined(_, _) -> false. +%% The following types will be removed later, but they are currently +%% kind of built-in. +is_predefined_otp_type(array, 0) -> true; +is_predefined_otp_type(dict, 0) -> true; +is_predefined_otp_type(digraph, 0) -> true; +is_predefined_otp_type(gb_set, 0) -> true; +is_predefined_otp_type(gb_tree, 0) -> true; +is_predefined_otp_type(queue, 0) -> true; +is_predefined_otp_type(set, 0) -> true; +is_predefined_otp_type(_, _) -> false. + to_ref(#t_typedef{name = N}) -> to_ref(N); to_ref(#t_def{name = N}) -> @@ -75,7 +129,8 @@ Predef = case N of #t_name{module = [], name = T} -> NArgs = length(As), - is_predefined(T, NArgs); + (is_predefined(T, NArgs) + orelse is_predefined_otp_type(T, NArgs)); _ -> false end, @@ -88,7 +143,7 @@ {'fun', [{argtypes, map(fun wrap_utype/2, As, Env)}, wrap_utype(T, Env)]}; to_xml(#t_map{ types = Ts}, Env) -> - {map, map(fun to_xml/2, Ts, Env)}; + {map, map(fun wrap_utype/2, Ts, Env)}; to_xml(#t_map_field{ k_type=K, v_type=V}, Env) -> {map_field, [wrap_utype(K,Env), wrap_utype(V, Env)]}; to_xml(#t_tuple{types = Ts}, Env) -> diff -Nru erlang-18.2-dfsg/lib/edoc/src/otpsgml_layout.erl erlang-17.3-dfsg/lib/edoc/src/otpsgml_layout.erl --- erlang-18.2-dfsg/lib/edoc/src/otpsgml_layout.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/src/otpsgml_layout.erl 2014-09-16 19:10:57.000000000 +0000 @@ -28,7 +28,7 @@ -module(otpsgml_layout). --export([module/2, overview/2,type/1]). +-export([module/2, package/2, overview/2,type/1]). -import(edoc_report, [report/2]). @@ -811,6 +811,27 @@ xmerl:export_simple_content(t_utype_elem(E) ++ local_defs(Ds), ?SGML_EXPORT). + +package(E=#xmlElement{name = package, content = Es}, Options) -> + Opts = init_opts(E, Options), + Name = get_text(packageName, Es), + Title = io_lib:fwrite("Package ~s", [Name]), + Desc = get_content(description, Es), +% ShortDesc = get_content(briefDescription, Desc), + FullDesc = get_content(fullDescription, Desc), + Body = ([?NL, {h1, [Title]}, ?NL] +% ++ ShortDesc + ++ copyright(Es) + ++ deprecated(Es, "package") + ++ version(Es) + ++ since(Es) + ++ authors(Es) + ++ references(Es) + ++ sees(Es) + ++ FullDesc), + XML = xml(Title, stylesheet(Opts), Body), + xmerl:export_simple([XML], ?SGML_EXPORT, []). + overview(E=#xmlElement{name = overview, content = Es}, Options) -> Opts = init_opts(E, Options), Title = get_text(title, Es), @@ -822,7 +843,6 @@ ++ copyright(Es) ++ version(Es) ++ since(Es) - ++ deprecated(Es, "application") ++ authors(Es) ++ references(Es) ++ sees(Es) diff -Nru erlang-18.2-dfsg/lib/edoc/test/edoc_SUITE_data/myapp/src/a.erl erlang-17.3-dfsg/lib/edoc/test/edoc_SUITE_data/myapp/src/a.erl --- erlang-18.2-dfsg/lib/edoc/test/edoc_SUITE_data/myapp/src/a.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/test/edoc_SUITE_data/myapp/src/a.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ --module(a). diff -Nru erlang-18.2-dfsg/lib/edoc/test/edoc_SUITE_data/myapp/src/src_1/b.erl erlang-17.3-dfsg/lib/edoc/test/edoc_SUITE_data/myapp/src/src_1/b.erl --- erlang-18.2-dfsg/lib/edoc/test/edoc_SUITE_data/myapp/src/src_1/b.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/test/edoc_SUITE_data/myapp/src/src_1/b.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ --module(b). diff -Nru erlang-18.2-dfsg/lib/edoc/test/edoc_SUITE.erl erlang-17.3-dfsg/lib/edoc/test/edoc_SUITE.erl --- erlang-18.2-dfsg/lib/edoc/test/edoc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/test/edoc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -23,12 +22,12 @@ init_per_group/2,end_per_group/2]). %% Test cases --export([app/1,appup/1,build_std/1,build_map_module/1,otp_12008/1, build_app/1]). +-export([app/1,appup/1,build_std/1,build_map_module/1,otp_12008/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [app,appup,build_std,build_map_module,otp_12008, build_app]. + [app,appup,build_std,build_map_module,otp_12008]. groups() -> []. @@ -96,20 +95,3 @@ ok = edoc:files([Un2], Opts2), {'EXIT', error} = (catch edoc:files([Un3], Opts2)), ok. - -build_app(suite) -> []; -build_app(doc) -> ["Build a local app with nested source directories"]; -build_app(Config) -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - OutDir = filename:join(PrivDir, "myapp"), - Src = filename:join(DataDir, "myapp"), - - ok = edoc:application(myapp, Src, [{dir, OutDir}, {subpackages, false}]), - true = filelib:is_regular(filename:join(OutDir, "a.html")), - false = filelib:is_regular(filename:join(OutDir, "b.html")), - - ok = edoc:application(myapp, Src, [{dir, OutDir}]), - true = filelib:is_regular(filename:join(OutDir, "a.html")), - true = filelib:is_regular(filename:join(OutDir, "b.html")), - ok. diff -Nru erlang-18.2-dfsg/lib/edoc/vsn.mk erlang-17.3-dfsg/lib/edoc/vsn.mk --- erlang-18.2-dfsg/lib/edoc/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/edoc/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -EDOC_VSN = 0.7.17 +EDOC_VSN = 0.7.15 diff -Nru erlang-18.2-dfsg/lib/eldap/asn1/ELDAPv3.asn1 erlang-17.3-dfsg/lib/eldap/asn1/ELDAPv3.asn1 --- erlang-18.2-dfsg/lib/eldap/asn1/ELDAPv3.asn1 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/asn1/ELDAPv3.asn1 2014-09-16 19:10:57.000000000 +0000 @@ -274,17 +274,5 @@ responseName [0] LDAPOID OPTIONAL, responseValue [1] OCTET STRING OPTIONAL } --- Extended syntax for Password Modify (RFC 3062, Section 2) - --- passwdModifyOID OBJECT IDENTIFIER ::= 1.3.6.1.4.1.4203.1.11.1 - -PasswdModifyRequestValue ::= SEQUENCE { - userIdentity [0] OCTET STRING OPTIONAL, - oldPasswd [1] OCTET STRING OPTIONAL, - newPasswd [2] OCTET STRING OPTIONAL } - -PasswdModifyResponseValue ::= SEQUENCE { - genPasswd [0] OCTET STRING OPTIONAL } - END diff -Nru erlang-18.2-dfsg/lib/eldap/doc/src/book.xml erlang-17.3-dfsg/lib/eldap/doc/src/book.xml --- erlang-18.2-dfsg/lib/eldap/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/eldap/doc/src/eldap.xml erlang-17.3-dfsg/lib/eldap/doc/src/eldap.xml --- erlang-18.2-dfsg/lib/eldap/doc/src/eldap.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/doc/src/eldap.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -49,7 +48,7 @@ dereference() See neverDerefAliases/0, derefInSearching/0, derefFindingBaseObj/0, derefAlways/0 filter() See present/1, substrings/2, equalityMatch/2, greaterOrEqual/2, lessOrEqual/2, - approxMatch/2, extensibleMatch/2, + approxMatch/2, 'and'/1, 'or'/1, 'not'/1.

    @@ -76,9 +75,7 @@

    Setup a connection to an LDAP server, the HOST's are tried in order.

    The log function takes three arguments, fun(Level, FormatString, [FormatArg]) end.

    Timeout set the maximum time in milliseconds that each server request may take.

    -

    All TCP socket options are accepted except - active, binary, deliver, list, mode and packet -

    +

    Currently, the only TCP socket option accepted is inet6. Default is inet.

    @@ -104,27 +101,23 @@ Handle = handle() Options = ssl:ssl_options() - Timeout = infinity | positive_integer() + Timeout = inifinity | positive_integer()

    Upgrade the connection associated with Handle to a tls connection if possible.

    -

    The upgrade is done in two phases: first the server is asked for permission to upgrade. Second, if the request is acknowledged, the upgrade to tls is performed.

    -

    Error responses from phase one will not affect the current encryption state of the connection. Those responses are:

    +

    The upgrade is done in two phases: first the server is asked for permission to upgrade. Second, if the request is acknowledged, the upgrade is performed.

    +

    Error responese from phase one will not affect the current encryption state of the connection. Those responses are:

    tls_already_started The connection is already encrypted. The connection is not affected. {response,ResponseFromServer} The upgrade was refused by the LDAP server. The ResponseFromServer is an atom delivered byt the LDAP server explained in section 2.3 of rfc 2830. The connection is not affected, so it is still un-encrypted. -

    Errors in the second phase will however end the connection:

    +

    Errors in the seconde phase will however end the connection:

    Error Any error responded from ssl:connect/3 -

    The Timeout parameter is for the actual tls upgrade (phase 2) while the timeout in - eldap:open/2 is used for the initial negotiation about - upgrade (phase 1). -

    @@ -219,46 +212,6 @@ - modify_password(Handle, Dn, NewPasswd) -> ok | {ok, GenPasswd} | {error, Reason} - Modify the password of a user. - - Dn = string() - NewPasswd = string() - - -

    Modify the password of a user. See modify_password/4.

    -
    -
    - - modify_password(Handle, Dn, NewPasswd, OldPasswd) -> ok | {ok, GenPasswd} | {error, Reason} - Modify the password of a user. - - Dn = string() - NewPasswd = string() - OldPasswd = string() - GenPasswd = string() - - -

    Modify the password of a user.

    - - -

    Dn. The user to modify. Should be "" if the - modify request is for the user of the LDAP session.

    -
    - -

    NewPasswd. The new password to set. Should be "" - if the server is to generate the password. In this case, - the result will be {ok, GenPasswd}.

    -
    - -

    OldPasswd. Sometimes required by server policy - for a user to change their password. If not required, use - modify_password/3.

    -
    -
    -
    -
    - modify_dn(Handle, Dn, NewRDN, DeleteOldRDN, NewSupDN) -> ok | {error, Reason} Modify the DN of an entry. @@ -269,9 +222,9 @@

    Modify the DN of an entry. DeleteOldRDN indicates - whether the current RDN should be removed from the attribute list after the after operation. - NewSupDN is the new parent that the RDN shall be moved to. If the old parent should - remain as parent, NewSupDN shall be "".

    + whether the current RDN should be removed after operation. + NewSupDN should be "" if the RDN should not be moved or the new parent which + the RDN will be moved to.

       modify_dn(Handle, "cn=Bill Valentine, ou=people, o=Example Org, dc=example, dc=com ",
                 "cn=Bill Jr Valentine", true, "")
    @@ -298,10 +251,6 @@
       Filter = eldap:substrings("cn", [{any,"V"}]),
       search(Handle, [{base, "dc=example, dc=com"}, {filter, Filter}, {attributes, ["cn"]}]),
     	
    -

    The timeout option in the SearchOptions is for the ldap server, while - the timeout in eldap:open/2 is used for each - individual request in the search operation. -

    @@ -397,20 +346,6 @@

    Create a approximation match filter.

    - extensibleMatch(MatchValue, OptionalAttrs) -> filter() - Create search filter option. - - MatchValue = string() - OptionalAttrs = [Attr] - Attr = {matchingRule,string()} | {type,string()} | {dnAttributes,boolean()} - -

    Creates an extensible match filter. For example,

    - - eldap:extensibleMatch("Bar", [{type,"sn"}, {matchingRule,"caseExactMatch"}])) - -

    creates a filter which performs a caseExactMatch on the attribute sn and matches with the value "Bar". The default value of dnAttributes is false.

    -
    - 'and'([Filter]) -> filter() Create search filter option. diff -Nru erlang-18.2-dfsg/lib/eldap/doc/src/Makefile erlang-17.3-dfsg/lib/eldap/doc/src/Makefile --- erlang-18.2-dfsg/lib/eldap/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/eldap/doc/src/notes.xml erlang-17.3-dfsg/lib/eldap/doc/src/notes.xml --- erlang-18.2-dfsg/lib/eldap/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,117 +30,7 @@

    This document describes the changes made to the Eldap application.

    -
    Eldap 1.2 - -
    Improvements and New Features - - -

    - Support added for LDAP Password Modify Extended Operation - (RFC 3062). Thanks to danielwhite.

    -

    - Own Id: OTP-12282

    -
    -
    -
    - -
    - -
    Eldap 1.1.1 - -
    Fixed Bugs and Malfunctions - - -

    - Corrects that eldap:close/1 returned a tuple - instead of the specified atom ok.

    -

    - Own Id: OTP-12349

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Clarification in the reference manual for - eldap:modify_dn/5, eldap:search/2 and - eldap:start_tls/3.

    -

    - Own Id: OTP-12354

    -
    - -

    - The eldap test suites are extended and re-organized.

    -

    - Own Id: OTP-12355

    -
    -
    -
    - -
    - -
    Eldap 1.1 - -
    Fixed Bugs and Malfunctions - - -

    - Fixed that eldap:open did not use the Timeout parameter - when calling ssl:connect. (Thanks Wiesław Bieniek for - reporting)

    -

    - Own Id: OTP-12311

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Added the LDAP filter extensibleMatch.

    -

    - Own Id: OTP-12174

    -
    -
    -
    - -
    - -
    Eldap 1.0.4 - -
    Fixed Bugs and Malfunctions - - -

    - eldap:open/2 and eldap:open/3 gave wrong - return values for option errors.

    -

    - Own Id: OTP-12182

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Nearly all TCP options are possible to give in the - eldap:open/2 call.

    -

    - Own Id: OTP-12171

    -
    -
    -
    - -
    - -
    Eldap 1.0.3 +
    Eldap 1.0.3
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/eldap/doc/src/ref_man.xml erlang-17.3-dfsg/lib/eldap/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/eldap/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/eldap/doc/src/release_notes.xml erlang-17.3-dfsg/lib/eldap/doc/src/release_notes.xml --- erlang-18.2-dfsg/lib/eldap/doc/src/release_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/doc/src/release_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/eldap/doc/src/usersguide.xml erlang-17.3-dfsg/lib/eldap/doc/src/usersguide.xml --- erlang-18.2-dfsg/lib/eldap/doc/src/usersguide.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/doc/src/usersguide.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/eldap/Makefile erlang-17.3-dfsg/lib/eldap/Makefile --- erlang-18.2-dfsg/lib/eldap/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/eldap/src/eldap.appup.src erlang-17.3-dfsg/lib/eldap/src/eldap.appup.src --- erlang-18.2-dfsg/lib/eldap/src/eldap.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/src/eldap.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/eldap/src/eldap.erl erlang-17.3-dfsg/lib/eldap/src/eldap.erl --- erlang-18.2-dfsg/lib/eldap/src/eldap.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/src/eldap.erl 2014-09-16 19:10:57.000000000 +0000 @@ -12,11 +12,8 @@ -vc('$Id$ '). -export([open/1,open/2,simple_bind/3,controlling_process/2, start_tls/2, start_tls/3, - modify_password/3, modify_password/4, - getopts/2, baseObject/0,singleLevel/0,wholeSubtree/0,close/1, equalityMatch/2,greaterOrEqual/2,lessOrEqual/2, - extensibleMatch/2, approxMatch/2,search/2,substrings/2,present/1, 'and'/1,'or'/1,'not'/1,modify/3, mod_add/2, mod_delete/2, mod_replace/2, add/3, delete/2, modify_dn/5,parse_dn/1, @@ -95,38 +92,11 @@ recv(Handle). %%% -------------------------------------------------------------------- -%%% Modify the password of a user. -%%% -%%% Dn - Name of the entry to modify. If empty, the session user. -%%% NewPasswd - New password. If empty, the server returns a new password. -%%% OldPasswd - Original password for server verification, may be empty. -%%% -%%% Returns: ok | {ok, GenPasswd} | {error, term()} -%%% -------------------------------------------------------------------- -modify_password(Handle, Dn, NewPasswd) -> - modify_password(Handle, Dn, NewPasswd, []). - -modify_password(Handle, Dn, NewPasswd, OldPasswd) - when is_pid(Handle), is_list(Dn), is_list(NewPasswd), is_list(OldPasswd) -> - send(Handle, {passwd_modify,optional(Dn),optional(NewPasswd),optional(OldPasswd)}), - recv(Handle). - -%%% -------------------------------------------------------------------- -%%% Ask for option values on the socket. -%%% Warning: This is an undocumented function for testing purposes only. -%%% Use at own risk... -%%% -------------------------------------------------------------------- -getopts(Handle, OptNames) when is_pid(Handle), is_list(OptNames) -> - send(Handle, {getopts, OptNames}), - recv(Handle). - -%%% -------------------------------------------------------------------- %%% Shutdown connection (and process) asynchronous. %%% -------------------------------------------------------------------- close(Handle) when is_pid(Handle) -> - send(Handle, close), - ok. + send(Handle, close). %%% -------------------------------------------------------------------- %%% Set who we should link ourselves to @@ -370,27 +340,6 @@ {substrings,#'SubstringFilter'{type = Type, substrings = Ss}}. -%%% -%%% Filter for extensibleMatch -%%% -extensibleMatch(MatchValue, OptArgs) -> - MatchingRuleAssertion = - mra(OptArgs, #'MatchingRuleAssertion'{matchValue = MatchValue}), - {extensibleMatch, MatchingRuleAssertion}. - -mra([{matchingRule,Val}|T], Ack) when is_list(Val) -> - mra(T, Ack#'MatchingRuleAssertion'{matchingRule=Val}); -mra([{type,Val}|T], Ack) when is_list(Val) -> - mra(T, Ack#'MatchingRuleAssertion'{type=Val}); -mra([{dnAttributes,true}|T], Ack) -> - mra(T, Ack#'MatchingRuleAssertion'{dnAttributes="TRUE"}); -mra([{dnAttributes,false}|T], Ack) -> - mra(T, Ack#'MatchingRuleAssertion'{dnAttributes="FALSE"}); -mra([H|_], _) -> - throw({error,{extensibleMatch_arg,H}}); -mra([], Ack) -> - Ack. - %%% -------------------------------------------------------------------- %%% Worker process. We keep track of a controlling process to %%% be able to terminate together with it. @@ -413,7 +362,7 @@ parse_args([{timeout, Timeout}|T], Cpid, Data) when is_integer(Timeout),Timeout>0 -> parse_args(T, Cpid, Data#eldap{timeout = Timeout}); parse_args([{anon_auth, true}|T], Cpid, Data) -> - parse_args(T, Cpid, Data#eldap{anon_auth = true}); + parse_args(T, Cpid, Data#eldap{anon_auth = false}); parse_args([{anon_auth, _}|T], Cpid, Data) -> parse_args(T, Cpid, Data); parse_args([{ssl, true}|T], Cpid, Data) -> @@ -425,35 +374,24 @@ parse_args([{sslopts, _}|T], Cpid, Data) -> parse_args(T, Cpid, Data); parse_args([{tcpopts, Opts}|T], Cpid, Data) when is_list(Opts) -> - parse_args(T, Cpid, Data#eldap{tcp_opts = tcp_opts(Opts,Cpid,Data#eldap.tcp_opts)}); + parse_args(T, Cpid, Data#eldap{tcp_opts = inet6_opt(Opts) ++ Data#eldap.tcp_opts}); parse_args([{log, F}|T], Cpid, Data) when is_function(F) -> parse_args(T, Cpid, Data#eldap{log = F}); parse_args([{log, _}|T], Cpid, Data) -> parse_args(T, Cpid, Data); parse_args([H|_], Cpid, _) -> send(Cpid, {error,{wrong_option,H}}), - unlink(Cpid), exit(wrong_option); parse_args([], _, Data) -> Data. -tcp_opts([Opt|Opts], Cpid, Acc) -> - Key = if is_atom(Opt) -> Opt; - is_tuple(Opt) -> element(1,Opt) - end, - case lists:member(Key,[active,binary,deliver,list,mode,packet]) of - false -> - tcp_opts(Opts, Cpid, [Opt|Acc]); +inet6_opt(Opts) -> + case proplists:get_value(inet6, Opts) of true -> - tcp_opts_error(Opt, Cpid) - end; -tcp_opts([], _Cpid, Acc) -> Acc. - -tcp_opts_error(Opt, Cpid) -> - send(Cpid, {error, {{forbidden_tcp_option,Opt}, - "This option affects the eldap functionality and can't be set by user"}}), - unlink(Cpid), - exit(forbidden_tcp_option). + [inet6]; + _ -> + [] + end. %%% Try to connect to the hosts in the listed order, %%% and stop with the first one to which a successful @@ -478,8 +416,7 @@ Data#eldap.timeout); do_connect(Host, Data, Opts) when Data#eldap.ldaps == true -> ssl:connect(Host, Data#eldap.port, - Opts ++ Data#eldap.tls_opts ++ Data#eldap.tcp_opts, - Data#eldap.timeout). + Opts ++ Data#eldap.tls_opts ++ Data#eldap.tcp_opts). loop(Cpid, Data) -> receive @@ -525,45 +462,10 @@ send(From,Res), ?MODULE:loop(Cpid, NewData); - {From, {passwd_modify,Dn,NewPasswd,OldPasswd}} -> - {Res,NewData} = do_passwd_modify(Data, Dn, NewPasswd, OldPasswd), - send(From, Res), - ?MODULE:loop(Cpid, NewData); - {_From, close} -> unlink(Cpid), exit(closed); - {From, {getopts, OptNames}} -> - Result = - try - [case OptName of - port -> {port, Data#eldap.port}; - log -> {log, Data#eldap.log}; - timeout -> {timeout, Data#eldap.timeout}; - ssl -> {ssl, Data#eldap.ldaps}; - {sslopts, SslOptNames} when Data#eldap.using_tls==true -> - case ssl:getopts(Data#eldap.fd, SslOptNames) of - {ok,SslOptVals} -> {sslopts, SslOptVals}; - {error,Reason} -> throw({error,Reason}) - end; - {sslopts, _} -> - throw({error,no_tls}); - {tcpopts, TcpOptNames} -> - case inet:getopts(Data#eldap.fd, TcpOptNames) of - {ok,TcpOptVals} -> {tcpopts, TcpOptVals}; - {error,Posix} -> throw({error,Posix}) - end - end || OptName <- OptNames] - of - OptsList -> {ok,OptsList} - catch - throw:Error -> Error; - Class:Error -> {error,{Class,Error}} - end, - send(From, Result), - ?MODULE:loop(Cpid, Data); - {Cpid, 'EXIT', Reason} -> ?PRINT("Got EXIT from Cpid, reason=~p~n",[Reason]), exit(Reason); @@ -820,60 +722,6 @@ check_reply(Data#eldap{id = Id}, Resp, modifyResponse). %%% -------------------------------------------------------------------- -%%% PasswdModifyRequest -%%% -------------------------------------------------------------------- - --define(PASSWD_MODIFY_OID, "1.3.6.1.4.1.4203.1.11.1"). - -do_passwd_modify(Data, Dn, NewPasswd, OldPasswd) -> - case catch do_passwd_modify_0(Data, Dn, NewPasswd, OldPasswd) of - {error,Emsg} -> {ldap_closed_p(Data, Emsg),Data}; - {'EXIT',Error} -> {ldap_closed_p(Data, Error),Data}; - {ok,NewData} -> {ok,NewData}; - {ok,Passwd,NewData} -> {{ok, Passwd},NewData}; - Else -> {ldap_closed_p(Data, Else),Data} - end. - -do_passwd_modify_0(Data, Dn, NewPasswd, OldPasswd) -> - Req = #'PasswdModifyRequestValue'{userIdentity = Dn, - oldPasswd = OldPasswd, - newPasswd = NewPasswd}, - log2(Data, "modify password request = ~p~n", [Req]), - {ok, Bytes} = 'ELDAPv3':encode('PasswdModifyRequestValue', Req), - ExtReq = #'ExtendedRequest'{requestName = ?PASSWD_MODIFY_OID, - requestValue = Bytes}, - Id = bump_id(Data), - log2(Data, "extended request = ~p~n", [ExtReq]), - Reply = request(Data#eldap.fd, Data, Id, {extendedReq, ExtReq}), - log2(Data, "modify password reply = ~p~n", [Reply]), - exec_passwd_modify_reply(Data#eldap{id = Id}, Reply). - -exec_passwd_modify_reply(Data, {ok,Msg}) when - Msg#'LDAPMessage'.messageID == Data#eldap.id -> - case Msg#'LDAPMessage'.protocolOp of - {extendedResp, Result} -> - case Result#'ExtendedResponse'.resultCode of - success -> - case Result#'ExtendedResponse'.responseValue of - asn1_NOVALUE -> - {ok, Data}; - Value -> - case 'ELDAPv3':decode('PasswdModifyResponseValue', Value) of - {ok,#'PasswdModifyResponseValue'{genPasswd = Passwd}} -> - {ok, Passwd, Data}; - Error -> - throw(Error) - end - end; - Error -> - {error, {response,Error}} - end; - Other -> {error, Other} - end; -exec_passwd_modify_reply(_, Error) -> - {error, Error}. - -%%% -------------------------------------------------------------------- %%% modifyDNRequest %%% -------------------------------------------------------------------- @@ -963,7 +811,6 @@ v_filter({approxMatch,AV}) -> {approxMatch,AV}; v_filter({present,A}) -> {present,A}; v_filter({substrings,S}) when is_record(S,'SubstringFilter') -> {substrings,S}; -v_filter({extensibleMatch,S}) when is_record(S,'MatchingRuleAssertion') -> {extensibleMatch,S}; v_filter(_Filter) -> throw({error,concat(["unknown filter: ",_Filter])}). v_modifications(Mods) -> diff -Nru erlang-18.2-dfsg/lib/eldap/src/Makefile erlang-17.3-dfsg/lib/eldap/src/Makefile --- erlang-18.2-dfsg/lib/eldap/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2012-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # Binary files /tmp/tmp4OT3UZ/1gNB8mPsmk/erlang-18.2-dfsg/lib/eldap/test/eldap_basic_SUITE_data/RAND and /tmp/tmp4OT3UZ/RkyUh2tbhJ/erlang-17.3-dfsg/lib/eldap/test/eldap_basic_SUITE_data/RAND differ diff -Nru erlang-18.2-dfsg/lib/eldap/test/eldap_basic_SUITE.erl erlang-17.3-dfsg/lib/eldap/test/eldap_basic_SUITE.erl --- erlang-18.2-dfsg/lib/eldap/test/eldap_basic_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/test/eldap_basic_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012-2014. All Rights Reserved. +%% Copyright Ericsson AB 2012-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,923 +24,297 @@ %%-include_lib("common_test/include/ct.hrl"). -include_lib("test_server/include/test_server.hrl"). -include_lib("eldap/include/eldap.hrl"). --include_lib("eldap/ebin/ELDAPv3.hrl"). - -define(TIMEOUT, 120000). % 2 min -all() -> - [app, - appup, - {group, encode_decode}, - {group, return_values}, - {group, v4_connections}, - {group, v6_connections}, - {group, plain_api}, - {group, ssl_api}, - {group, start_tls_api} - ]. - -groups() -> - [{encode_decode, [], [encode, - decode - ]}, - {plain_api, [], [{group,api}]}, - {ssl_api, [], [{group,api}, start_tls_on_ssl_should_fail]}, - {start_tls_api, [], [{group,api}, start_tls_twice_should_fail]}, - - {api, [], [{group,api_not_bound}, - {group,api_bound}]}, - - {api_not_bound, [], [elementary_search, search_non_existant, - add_when_not_bound, - bind]}, - {api_bound, [], [add_when_bound, - add_already_exists, - more_add, - search_filter_equalityMatch, - search_filter_substring_any, - search_filter_initial, - search_filter_final, - search_filter_and, - search_filter_or, - search_filter_and_not, - search_two_hits, - modify, - delete, - modify_dn_delete_old, - modify_dn_keep_old]}, - {v4_connections, [], connection_tests()}, - {v6_connections, [], connection_tests()}, - {return_values, [], [open_ret_val_success, - open_ret_val_error, - close_ret_val]} - ]. - -connection_tests() -> - [tcp_connection, - tcp_connection_option, - ssl_connection, - client_side_start_tls_timeout, - client_side_bind_timeout, - client_side_add_timeout, - client_side_search_timeout - ]. - - - init_per_suite(Config) -> - SSL_available = init_ssl_certs_et_al(Config), - LDAP_server = find_first_server(false, [{config,eldap_server}, {config,ldap_server}, {"localhost",9876}]), - LDAPS_server = - case SSL_available of - true -> - find_first_server(true, [{config,ldaps_server}, {"localhost",9877}]); - false -> - undefined - end, - [{ssl_available, SSL_available}, - {ldap_server, LDAP_server}, - {ldaps_server, LDAPS_server} | Config]. + StartSsl = try ssl:start() + catch + Error:Reason -> + {skip, lists:flatten(io_lib:format("eldap init_per_suite failed to start ssl Error=~p Reason=~p", [Error, Reason]))} + end, + case StartSsl of + ok -> + chk_config(ldap_server, {"localhost",9876}, + chk_config(ldaps_server, {"localhost",9877}, + Config)); + _ -> + StartSsl + end. end_per_suite(_Config) -> - ssl:stop(). + ok. +init_per_testcase(_TestCase, Config0) -> + {EldapHost,Port} = proplists:get_value(ldap_server,Config0), + try + {ok, Handle} = eldap:open([EldapHost], [{port,Port}]), + ok = eldap:simple_bind(Handle, "cn=Manager,dc=ericsson,dc=se", "hejsan"), + {ok, MyHost} = inet:gethostname(), + Path = "dc="++MyHost++",dc=ericsson,dc=se", + eldap:add(Handle,"dc=ericsson,dc=se", + [{"objectclass", ["dcObject", "organization"]}, + {"dc", ["ericsson"]}, {"o", ["Testing"]}]), + eldap:add(Handle,Path, + [{"objectclass", ["dcObject", "organization"]}, + {"dc", [MyHost]}, {"o", ["Test machine"]}]), + [{eldap_path,Path}|Config0] + catch error:{badmatch,Error} -> + io:format("Eldap init error ~p~n ~p~n",[Error, erlang:get_stacktrace()]), + {skip, lists:flatten(io_lib:format("Ldap init failed with host ~p:~p. Error=~p", [EldapHost,Port,Error]))} + end. + +end_per_testcase(_TestCase, Config) -> + {EHost, Port} = proplists:get_value(ldap_server, Config), + Path = proplists:get_value(eldap_path, Config), + {ok, H} = eldap:open([EHost], [{port, Port}]), + ok = eldap:simple_bind(H, "cn=Manager,dc=ericsson,dc=se", "hejsan"), + case eldap:search(H, [{base, Path}, + {filter, eldap:present("objectclass")}, + {scope, eldap:wholeSubtree()}]) + of + {ok, {eldap_search_result, Entries, _}} -> + [ok = eldap:delete(H, Entry) || {eldap_entry, Entry, _} <- Entries]; + _ -> ignore + end, -init_per_group(return_values, Config) -> - case ?config(ldap_server,Config) of - undefined -> - {skip, "LDAP server not availble"}; - {Host,Port} -> - ct:comment("ldap://~s:~p",[Host,Port]), - Config - end; -init_per_group(plain_api, Config0) -> - case ?config(ldap_server,Config0) of - undefined -> - {skip, "LDAP server not availble"}; - Server = {Host,Port} -> - ct:comment("ldap://~s:~p",[Host,Port]), - initialize_db([{server,Server}, {ssl_flag,false}, {start_tls,false} | Config0]) - end; -init_per_group(ssl_api, Config0) -> - case ?config(ldaps_server,Config0) of - undefined -> - {skip, "LDAPS server not availble"}; - Server = {Host,Port} -> - ct:comment("ldaps://~s:~p",[Host,Port]), - initialize_db([{server,Server}, {ssl_flag,true}, {start_tls,false} | Config0]) - end; -init_per_group(start_tls_api, Config0) -> - case {?config(ldap_server,Config0), ?config(ssl_available,Config0)} of - {undefined,true} -> - {skip, "LDAP server not availble"}; - {_,false} -> - {skip, "TLS not availble"}; - {Server={Host,Port}, true} -> - ct:comment("ldap://~s:~p + start_tls",[Host,Port]), - Config = [{server,Server}, {ssl_flag,false} | Config0], - case supported_extension("1.3.6.1.4.1.1466.20037", Config) of - true -> initialize_db([{start_tls,true} | Config]); - false -> {skip, "start_tls not supported according to the server"} - end - end; -init_per_group(v4_connections, Config) -> - [{tcp_listen_opts, [{reuseaddr, true}]}, - {listen_host, "localhost"}, - {tcp_connect_opts, []} - | Config]; -init_per_group(v6_connections, Config) -> - {ok, Hostname} = inet:gethostname(), - case lists:member(list_to_atom(Hostname), ct:get_config(ipv6_hosts,[])) of - true -> - [{tcp_listen_opts, [inet6,{reuseaddr, true}]}, - {listen_host, "::"}, - {tcp_connect_opts, [{tcpopts,[inet6]}]} - | Config]; - false -> - {skip, io_lib:format("~p is not an ipv6_host",[Hostname])} - end; -init_per_group(_, Config) -> - Config. - -end_per_group(plain_api, Config) -> clear_db(Config); -end_per_group(ssl_api, Config) -> clear_db(Config); -end_per_group(start_tls_api, Config) -> clear_db(Config); -end_per_group(_Group, Config) -> Config. - - -init_per_testcase(ssl_connection, Config) -> - case ?config(ssl_available,Config) of - true -> - SSL_Port = 9999, - CertFile = filename:join(?config(data_dir,Config), "certs/server/cert.pem"), - KeyFile = filename:join(?config(data_dir,Config), "certs/server/key.pem"), - - Parent = self(), - Listener = spawn_link( - fun() -> - case ssl:listen(SSL_Port, [{certfile, CertFile}, - {keyfile, KeyFile} - | ?config(tcp_listen_opts,Config) - ]) of - {ok,SSL_LSock} -> - Parent ! {ok,self()}, - (fun L() -> - ct:log("ssl server waiting for connections...",[]), - {ok, S} = ssl:transport_accept(SSL_LSock), - ct:log("ssl:transport_accept/1 ok",[]), - ok = ssl:ssl_accept(S), - ct:log("ssl:ssl_accept/1 ok",[]), - L() - end)(); - Other -> - Parent ! {not_ok,Other,self()} - end - end), - receive - {ok,Listener} -> - ct:log("SSL listening to port ~p (process ~p)",[SSL_Port, Listener]), - [{ssl_listener,Listener}, - {ssl_listen_port,SSL_Port}, - {ssl_connect_opts,[]} - | Config]; - {no_ok,SSL_Other,Listener} -> - ct:log("ssl:listen on port ~p failed: ~p",[SSL_Port,SSL_Other]), - {fail, "ssl:listen/2 failed"} - after 5000 -> - {fail, "Waiting for ssl:listen timeout"} - end; - false -> - {skip, "ssl not available"} - end; - -init_per_testcase(TC, Config) -> - case lists:member(TC,connection_tests()) of - true -> - case gen_tcp:listen(0, proplists:get_value(tcp_listen_opts,Config)) of - {ok,LSock} -> - {ok,{_,Port}} = inet:sockname(LSock), - [{listen_socket,LSock}, - {listen_port,Port} - | Config]; - Other -> - {fail, Other} - end; - - false -> - case proplists:get_value(name,?config(tc_group_properties, Config)) of - api_not_bound -> - {ok,H} = open(Config), - [{handle,H} | Config]; - api_bound -> - {ok,H} = open(Config), - ok = eldap:simple_bind(H, - "cn=Manager,dc=ericsson,dc=se", - "hejsan"), - [{handle,H} | Config]; - _Name -> - Config - end - end. - -end_per_testcase(_, Config) -> - catch gen_tcp:close( proplists:get_value(listen_socket, Config) ), - catch eldap:close( proplists:get_value(handle,Config) ). + ok. +%% suite() -> -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% -%%% Test cases -%%% +all() -> + [app, + appup, + api, + ssl_api, + start_tls, + tls_operations, + start_tls_twice, + start_tls_on_ssl + ]. -%%%---------------------------------------------------------------- -%%% Test that the eldap app file is ok +app(doc) -> "Test that the eldap app file is ok"; +app(suite) -> []; app(Config) when is_list(Config) -> ok = test_server:app_test(eldap). -%%%---------------------------------------------------------------- -%%% Test that the eldap appup file is ok +%% Test that the eldap appup file is ok appup(Config) when is_list(Config) -> ok = test_server:appup_test(eldap). -%%%---------------------------------------------------------------- -open_ret_val_success(Config) -> - {Host,Port} = ?config(ldap_server,Config), - {ok,H} = eldap:open([Host], [{port,Port}]), - catch eldap:close(H). - -%%%---------------------------------------------------------------- -open_ret_val_error(_Config) -> - {error,_} = eldap:open(["nohost.example.com"], [{port,65535}]). - -%%%---------------------------------------------------------------- -close_ret_val(Config) -> - {Host,Port} = ?config(ldap_server,Config), - {ok,H} = eldap:open([Host], [{port,Port}]), - ok = eldap:close(H). - -%%%---------------------------------------------------------------- -tcp_connection(Config) -> - Host = proplists:get_value(listen_host, Config), - Port = proplists:get_value(listen_port, Config), - Opts = proplists:get_value(tcp_connect_opts, Config), - case eldap:open([Host], [{port,Port}|Opts]) of - {ok,_H} -> - Sl = proplists:get_value(listen_socket, Config), - case gen_tcp:accept(Sl,1000) of - {ok,_S} -> ok; - {error,timeout} -> ct:fail("server side accept timeout",[]); - Other -> ct:fail("gen_tdp:accept failed: ~p",[Other]) - end; - Other -> ct:fail("eldap:open failed: ~p",[Other]) - end. - -%%%---------------------------------------------------------------- -ssl_connection(Config) -> - Host = proplists:get_value(listen_host, Config), - Port = proplists:get_value(ssl_listen_port, Config), - Opts = proplists:get_value(tcp_connect_opts, Config), - SSLOpts = proplists:get_value(ssl_connect_opts, Config), - case eldap:open([Host], [{port,Port}, - {ssl,true}, - {timeout,5000}, - {sslopts,SSLOpts}|Opts]) of - {ok,_H} -> ok; - Other -> ct:fail("eldap:open failed: ~p",[Other]) - end. - -%%%---------------------------------------------------------------- -client_side_add_timeout(Config) -> - client_timeout( - fun(H) -> - eldap:add(H, "cn=Foo Bar,dc=host,dc=ericsson,dc=se", - [{"objectclass", ["person"]}, - {"cn", ["Foo Bar"]}, - {"sn", ["Bar"]}, - {"telephoneNumber", ["555-1232", "555-5432"]}]) - end, Config). - -%%%---------------------------------------------------------------- -client_side_bind_timeout(Config) -> - client_timeout( - fun(H) -> - eldap:simple_bind(H, anon, anon) - end, Config). - -%%%---------------------------------------------------------------- -client_side_search_timeout(Config) -> - client_timeout( - fun(H) -> - eldap:search(H, [{base,"dc=host,dc=ericsson,dc=se"}, - {filter, eldap:present("objectclass")}, - {scope, eldap:wholeSubtree()}]) - end, Config). - -%%%---------------------------------------------------------------- -client_side_start_tls_timeout(Config) -> - client_timeout( - fun(H) -> - eldap:start_tls(H, []) - end, Config). - -%%%---------------------------------------------------------------- -tcp_connection_option(Config) -> - Host = proplists:get_value(listen_host, Config), - Port = proplists:get_value(listen_port, Config), - Opts = proplists:get_value(tcp_connect_opts, Config), - Sl = proplists:get_value(listen_socket, Config), - - %% Make an option value to test. The option must be implemented on all - %% platforms that we test on. Must check what the default value is - %% so we don't happen to choose that particular value. - {ok,[{linger,DefaultLinger}]} = inet:getopts(Sl, [linger]), - TestLinger = case DefaultLinger of - {false,_} -> {true,5}; - {true,_} -> {false,0} - end, - - case catch eldap:open([Host], - [{port,Port},{tcpopts,[{linger,TestLinger}]}|Opts]) of - {ok,H} -> - case gen_tcp:accept(Sl,1000) of - {ok,_} -> - case eldap:getopts(H, [{tcpopts,[linger]}]) of - {ok,[{tcpopts,[{linger,ActualLinger}]}]} -> - case ActualLinger of - TestLinger -> - ok; - DefaultLinger -> - ct:fail("eldap:getopts: 'linger' didn't change," - " got ~p (=default) expected ~p", - [ActualLinger,TestLinger]); - _ -> - ct:fail("eldap:getopts: bad 'linger', got ~p expected ~p", - [ActualLinger,TestLinger]) - end; - Other -> - ct:fail("eldap:getopts: bad result ~p",[Other]) - end; - {error,timeout} -> - ct:fail("server side accept timeout",[]) - end; - - Other -> - ct:fail("eldap:open failed: ~p",[Other]) - end. - - -%%%---------------------------------------------------------------- -%%% Basic test that all api functions works as expected - -%%%---------------------------------------------------------------- -elementary_search(Config) -> - {ok, #eldap_search_result{entries=[_]}} = - eldap:search(?config(handle,Config), - #eldap_search{base = ?config(eldap_path, Config), - filter= eldap:present("objectclass"), - scope = eldap:wholeSubtree()}). - -%%%---------------------------------------------------------------- -search_non_existant(Config) -> - {error, noSuchObject} = - eldap:search(?config(handle,Config), - #eldap_search{base = "cn=Bar," ++ ?config(eldap_path, Config), - filter= eldap:present("objectclass"), - scope = eldap:wholeSubtree()}). - -%%%---------------------------------------------------------------- -add_when_not_bound(Config) -> - {error, _} = eldap:add(?config(handle,Config), - "cn=Jonas Jonsson," ++ ?config(eldap_path, Config), - [{"objectclass", ["person"]}, - {"cn", ["Jonas Jonsson"]}, - {"sn", ["Jonsson"]}]). - -%%%---------------------------------------------------------------- -bind(Config) -> - ok = eldap:simple_bind(?config(handle,Config), - "cn=Manager,dc=ericsson,dc=se", - "hejsan"). - -%%%---------------------------------------------------------------- -add_when_bound(Config) -> - ok = eldap:add(?config(handle, Config), - "cn=Jonas Jonsson," ++ ?config(eldap_path, Config), - [{"objectclass", ["person"]}, - {"cn", ["Jonas Jonsson"]}, - {"sn", ["Jonsson"]}]). +api(doc) -> "Basic test that all api functions works as expected"; +api(suite) -> []; +api(Config) -> + {Host,Port} = proplists:get_value(ldap_server, Config), + {ok, H} = eldap:open([Host], [{port,Port}]), + %% {ok, H} = eldap:open([Host], [{port,Port+1}, {ssl, true}]), + do_api_checks(H, Config), + eldap:close(H), + ok. -%%%---------------------------------------------------------------- -add_already_exists(Config) -> - {error, entryAlreadyExists} = - eldap:add(?config(handle, Config), - "cn=Jonas Jonsson," ++ ?config(eldap_path, Config), - [{"objectclass", ["person"]}, - {"cn", ["Jonas Jonsson"]}, - {"sn", ["Jonsson"]}]). - -%%%---------------------------------------------------------------- -more_add(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - ok = eldap:add(H, "cn=Foo Bar," ++ BasePath, - [{"objectclass", ["person"]}, - {"cn", ["Foo Bar"]}, - {"sn", ["Bar"]}, - {"telephoneNumber", ["555-1232", "555-5432"]}]), - ok = eldap:add(H, "ou=Team," ++ BasePath, - [{"objectclass", ["organizationalUnit"]}, - {"ou", ["Team"]}]). +ssl_api(doc) -> "Basic test that all api functions works as expected"; +ssl_api(suite) -> []; +ssl_api(Config) -> + {Host,Port} = proplists:get_value(ldaps_server, Config), + {ok, H} = eldap:open([Host], [{port,Port}, {ssl,true}]), + do_api_checks(H, Config), + eldap:close(H), + ok. -%%%---------------------------------------------------------------- -search_filter_equalityMatch(Config) -> - BasePath = ?config(eldap_path, Config), - ExpectedDN = "cn=Jonas Jonsson," ++ BasePath, - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=ExpectedDN}]}} = - eldap:search(?config(handle, Config), - #eldap_search{base = BasePath, - filter = eldap:equalityMatch("sn", "Jonsson"), - scope=eldap:singleLevel()}). - -%%%---------------------------------------------------------------- -search_filter_substring_any(Config) -> - BasePath = ?config(eldap_path, Config), - ExpectedDN = "cn=Jonas Jonsson," ++ BasePath, - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=ExpectedDN}]}} = - eldap:search(?config(handle, Config), - #eldap_search{base = BasePath, - filter = eldap:substrings("sn", [{any, "ss"}]), - scope=eldap:singleLevel()}). - -%%%---------------------------------------------------------------- -search_filter_initial(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - ExpectedDN = "cn=Foo Bar," ++ BasePath, - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=ExpectedDN}]}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:substrings("sn", [{initial, "B"}]), - scope=eldap:singleLevel()}). - -%%%---------------------------------------------------------------- -search_filter_final(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - ExpectedDN = "cn=Foo Bar," ++ BasePath, - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=ExpectedDN}]}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:substrings("sn", [{final, "r"}]), - scope=eldap:singleLevel()}). - -%%%---------------------------------------------------------------- -search_filter_and(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - ExpectedDN = "cn=Foo Bar," ++ BasePath, - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=ExpectedDN}]}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:'and'([eldap:substrings("sn", [{any, "a"}]), - eldap:equalityMatch("cn","Foo Bar")]), - scope=eldap:singleLevel()}). - -%%%---------------------------------------------------------------- -search_filter_or(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - ExpectedDNs = lists:sort(["cn=Foo Bar," ++ BasePath, - "ou=Team," ++ BasePath]), - {ok, #eldap_search_result{entries=Es}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:'or'([eldap:substrings("sn", [{any, "a"}]), - eldap:equalityMatch("ou","Team")]), - scope=eldap:singleLevel()}), - ExpectedDNs = lists:sort([DN || #eldap_entry{object_name=DN} <- Es]). - -%%%---------------------------------------------------------------- -search_filter_and_not(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - {ok, #eldap_search_result{entries=[]}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:'and'([eldap:substrings("sn", [{any, "a"}]), - eldap:'not'( - eldap:equalityMatch("cn","Foo Bar") - )]), - scope=eldap:singleLevel()}). - -%%%---------------------------------------------------------------- -search_two_hits(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - DN1 = "cn=Santa Claus," ++ BasePath, - DN2 = "cn=Jultomten," ++ BasePath, - %% Add two objects: - ok = eldap:add(H, DN1, - [{"objectclass", ["person"]}, - {"cn", ["Santa Claus"]}, - {"sn", ["Santa"]}, - {"description", ["USA"]}]), - ok = eldap:add(H, DN2, - [{"objectclass", ["person"]}, - {"cn", ["Jultomten"]}, - {"sn", ["Tomten"]}, - {"description", ["Sweden"]}]), - - %% Search for them: - {ok, #eldap_search_result{entries=Es}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:present("description"), - scope=eldap:singleLevel()}), - - %% And check that they are the expected ones: - ExpectedDNs = lists:sort([DN1, DN2]), - ExpectedDNs = lists:sort([D || #eldap_entry{object_name=D} <- Es]), - - %% Restore the database: - [ok=eldap:delete(H,DN) || DN <- ExpectedDNs]. - -%%%---------------------------------------------------------------- -modify(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - %% The object to modify - DN = "cn=Foo Bar," ++ BasePath, - %% Save a copy to restore later: - {ok,OriginalAttrs} = attributes(H, DN), +start_tls(doc) -> "Test that an existing (tcp) connection can be upgraded to tls"; +start_tls(suite) -> []; +start_tls(Config) -> + {Host,Port} = proplists:get_value(ldap_server, Config), + {ok, H} = eldap:open([Host], [{port,Port}]), + ok = eldap:start_tls(H, [ + {keyfile, filename:join([proplists:get_value(data_dir,Config), + "certs/client/key.pem"])} + ]), + eldap:close(H). - %% Do a change - Mod = [eldap:mod_replace("telephoneNumber", ["555-12345"]), - eldap:mod_add("description", ["Nice guy"])], - ok = eldap:modify(H, DN, Mod), - %% Check that the object was changed - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=DN}]}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:equalityMatch("telephoneNumber", "555-12345"), - scope=eldap:singleLevel()}), - - %% Do another type of change - ok = eldap:modify(H, DN, [eldap:mod_delete("telephoneNumber", [])]), - %% and check that it worked by repeating the test above - {ok, #eldap_search_result{entries=[]}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:equalityMatch("telephoneNumber", "555-12345"), - scope=eldap:singleLevel()}), - %% restore the orignal version: - restore_original_object(H, DN, OriginalAttrs). - -%%%---------------------------------------------------------------- -delete(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - %% The element to play with: - DN = "cn=Jonas Jonsson," ++ BasePath, - - %% Prove that the element is present before deletion - {ok,OriginalAttrs} = attributes(H, DN), - - %% Do what the test has to do: - ok = eldap:delete(H, DN), - %% check that it really was deleted: - {error, noSuchObject} = eldap:delete(H, DN), - - %% And restore the object for subsequent tests - restore_original_object(H, DN, OriginalAttrs). - -%%%---------------------------------------------------------------- -modify_dn_delete_old(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - OrigCN = "Foo Bar", - OriginalRDN = "cn="++OrigCN, - DN = OriginalRDN ++ "," ++ BasePath, - NewCN = "Niclas Andre", - NewRDN = "cn="++NewCN, - NewDN = NewRDN ++ "," ++BasePath, - - %% Check that the object to modify_dn of exists: - {ok,OriginalAttrs} = attributes(H, DN), - CN_orig = lists:sort(proplists:get_value("cn",OriginalAttrs)), - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=DN}]}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:substrings("sn", [{any, "a"}]), - scope = eldap:singleLevel()}), - - %% Modify and delete the old one: - ok = eldap:modify_dn(H, DN, NewRDN, true, ""), - - %% Check that DN was modified and the old one was deleted: - {ok,NewAttrs} = attributes(H, NewDN), - CN_new = lists:sort(proplists:get_value("cn",NewAttrs)), - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=NewDN}]}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:substrings("sn", [{any, "a"}]), - scope = eldap:singleLevel()}), - %% What we expect: - CN_new = lists:sort([NewCN | CN_orig -- [OrigCN]]), - - %% Change back: - ok = eldap:modify_dn(H, NewDN, OriginalRDN, true, ""), - - %% Check that DN was modified and the new one was deleted: - {ok,SameAsOriginalAttrs} = attributes(H, DN), - CN_orig = lists:sort(proplists:get_value("cn",SameAsOriginalAttrs)), - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=DN}]}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:substrings("sn", [{any, "a"}]), - scope = eldap:singleLevel()}). - -%%%---------------------------------------------------------------- -modify_dn_keep_old(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), - OriginalRDN = "cn=Foo Bar", - DN = OriginalRDN ++ "," ++ BasePath, - NewCN = "Niclas Andre", - NewRDN = "cn="++NewCN, - NewDN = NewRDN ++ "," ++BasePath, - - %% Check that the object to modify_dn of exists but the new one does not: - {ok,OriginalAttrs} = attributes(H, DN), - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=DN}]}} = - eldap:search(H, - #eldap_search{base = BasePath, - filter = eldap:substrings("sn", [{any, "a"}]), - scope = eldap:singleLevel()}), - - %% Modify but keep the old "cn" attr: - ok = eldap:modify_dn(H, DN, NewRDN, false, ""), - - %% Check that DN was modified and the old CN entry is not deleted: - {ok,NewAttrs} = attributes(H, NewDN), - CN_orig = proplists:get_value("cn",OriginalAttrs), - CN_new = proplists:get_value("cn",NewAttrs), - Expected = lists:sort([NewCN|CN_orig]), - Expected = lists:sort(CN_new), - - %% Restore db: - ok = eldap:delete(H, NewDN), - restore_original_object(H, DN, OriginalAttrs). - -%%%---------------------------------------------------------------- -%%% Test that start_tls on an already upgraded connection makes no noise -start_tls_twice_should_fail(Config) -> - {ok,H} = open_bind(Config), - {error,tls_already_started} = eldap:start_tls(H, []), +tls_operations(doc) -> "Test that an upgraded connection is usable for ldap stuff"; +tls_operations(suite) -> []; +tls_operations(Config) -> + {Host,Port} = proplists:get_value(ldap_server, Config), + {ok, H} = eldap:open([Host], [{port,Port}]), + ok = eldap:start_tls(H, [ + {keyfile, filename:join([proplists:get_value(data_dir,Config), + "certs/client/key.pem"])} + ]), + do_api_checks(H, Config), eldap:close(H). -%%%---------------------------------------------------------------- -%%% Test that start_tls on an ldaps connection fails -start_tls_on_ssl_should_fail(Config) -> - {ok,H} = open_bind(Config), +start_tls_twice(doc) -> "Test that start_tls on an already upgraded connection fails"; +start_tls_twice(suite) -> []; +start_tls_twice(Config) -> + {Host,Port} = proplists:get_value(ldap_server, Config), + {ok, H} = eldap:open([Host], [{port,Port}]), + ok = eldap:start_tls(H, []), {error,tls_already_started} = eldap:start_tls(H, []), + do_api_checks(H, Config), eldap:close(H). -%%%---------------------------------------------------------------- -encode(_Config) -> - {ok,Bin} = 'ELDAPv3':encode('AddRequest', #'AddRequest'{entry="hejHopp" ,attributes=[]} ), - Expected = <<104,11,4,7,104,101,106,72,111,112,112,48,0>>, - case Bin of - Expected -> ok; - _ -> ct:log("Encoded erroneously to:~n~p~nExpected:~n~p",[Bin,Expected]), - {fail, "Bad encode"} - end. - -%%%---------------------------------------------------------------- -decode(_Config) -> - {ok,Res} = 'ELDAPv3':decode('AddRequest', <<104,11,4,7,104,101,106,72,111,112,112,48,0>>), - ct:log("Res = ~p", [Res]), - Expected = #'AddRequest'{entry = "hejHopp",attributes = []}, - case Res of - Expected -> ok; - #'AddRequest'{entry= <<"hejHopp">>, attributes=[]} -> - {fail, "decoded to (correct) binary!!"}; - _ -> - {fail, "Bad decode"} - end. - +start_tls_on_ssl(doc) -> "Test that start_tls on an ldaps connection fails"; +start_tls_on_ssl(suite) -> []; +start_tls_on_ssl(Config) -> + {Host,Port} = proplists:get_value(ldaps_server, Config), + {ok, H} = eldap:open([Host], [{port,Port}, {ssl,true}]), + {error,tls_already_started} = eldap:start_tls(H, []), + do_api_checks(H, Config), + eldap:close(H). -%%%**************************************************************** -%%% Private -attributes(H, DN) -> - case eldap:search(H, - #eldap_search{base = DN, - filter= eldap:present("objectclass"), - scope = eldap:wholeSubtree()}) of - {ok, #eldap_search_result{entries=[#eldap_entry{object_name=DN, - attributes=OriginalAttrs}]}} -> - {ok, OriginalAttrs}; - Other -> - Other +%%%-------------------------------------------------------------------------------- +chk_config(Key, Default, Config) -> + case catch ct:get_config(ldap_server, undefined) of + undefined -> [{Key,Default} | Config ]; + {'EXIT',_} -> [{Key,Default} | Config ]; + Value -> [{Key,Value} | Config] end. -restore_original_object(H, DN, Attrs) -> - eldap:delete(H, DN), - ok = eldap:add(H, DN, Attrs). - - -find_first_server(UseSSL, [{config,Key}|Ss]) -> - case ct:get_config(Key) of - {Host,Port} -> - ct:log("find_first_server config ~p -> ~p",[Key,{Host,Port}]), - find_first_server(UseSSL, [{Host,Port}|Ss]); - undefined -> - ct:log("find_first_server config ~p is undefined",[Key]), - find_first_server(UseSSL, Ss) - end; -find_first_server(UseSSL, [{Host,Port}|Ss]) -> - case eldap:open([Host],[{port,Port},{ssl,UseSSL}]) of - {ok,H} when UseSSL==false, Ss=/=[] -> - case eldap:start_tls(H,[]) of - ok -> - ct:log("find_first_server ~p UseSSL=~p -> ok",[{Host,Port},UseSSL]), - eldap:close(H), - {Host,Port}; - Res -> - ct:log("find_first_server ~p UseSSL=~p failed with~n~p~nSave as spare host.",[{Host,Port},UseSSL,Res]), - eldap:close(H), - find_first_server(UseSSL, Ss++[{spare_host,Host,Port}]) - end; - {ok,H} -> - ct:log("find_first_server ~p UseSSL=~p -> ok",[{Host,Port},UseSSL]), - eldap:close(H), - {Host,Port}; - Res -> - ct:log("find_first_server ~p UseSSL=~p failed with~n~p",[{Host,Port},UseSSL,Res]), - find_first_server(UseSSL, Ss) - end; -find_first_server(false, [{spare_host,Host,Port}|_]) -> - ct:log("find_first_server can't find start_tls host, use the spare non-start_tls host for plain ldap: ~p",[{Host,Port}]), - {Host,Port}; -find_first_server(_, []) -> - ct:log("find_first_server, nothing left to try",[]), - undefined. - -initialize_db(Config) -> - case {open_bind(Config), inet:gethostname()} of - {{ok,H}, {ok,MyHost}} -> - Path = "dc="++MyHost++",dc=ericsson,dc=se", - delete_old_contents(H, Path), - add_new_contents(H, Path, MyHost), - eldap:close(H), - [{eldap_path,Path}|Config]; - Other -> - ct:fail("initialize_db failed: ~p",[Other]) - end. -clear_db(Config) -> - {ok,H} = open_bind(Config), - Path = ?config(eldap_path, Config), - delete_old_contents(H, Path), - eldap:close(H), - Config. - -delete_old_contents(H, Path) -> - case eldap:search(H, [{base, Path}, - {filter, eldap:present("objectclass")}, - {scope, eldap:wholeSubtree()}]) - of - {ok, #eldap_search_result{entries=Entries}} -> - [ok = eldap:delete(H,DN) || #eldap_entry{object_name=DN} <- Entries]; - _Res -> - ignore - end. -add_new_contents(H, Path, MyHost) -> - ok(eldap:add(H,"dc=ericsson,dc=se", - [{"objectclass", ["dcObject", "organization"]}, - {"dc", ["ericsson"]}, - {"o", ["Testing"]}])), - ok(eldap:add(H,Path, - [{"objectclass", ["dcObject", "organization"]}, - {"dc", [MyHost]}, - {"o", ["Test machine"]}])). - - -ok({error,entryAlreadyExists}) -> ok; -ok(X) -> ok=X. +do_api_checks(H, Config) -> + BasePath = proplists:get_value(eldap_path, Config), + All = fun(Where) -> + eldap:search(H, #eldap_search{base=Where, + filter=eldap:present("objectclass"), + scope= eldap:wholeSubtree()}) + end, + {ok, #eldap_search_result{entries=[_XYZ]}} = All(BasePath), +%% ct:log("XYZ=~p",[_XYZ]), + {error, noSuchObject} = All("cn=Bar,"++BasePath), + {error, _} = eldap:add(H, "cn=Jonas Jonsson," ++ BasePath, + [{"objectclass", ["person"]}, + {"cn", ["Jonas Jonsson"]}, {"sn", ["Jonsson"]}]), + eldap:simple_bind(H, "cn=Manager,dc=ericsson,dc=se", "hejsan"), -cond_start_tls(H, Config) -> - case ?config(start_tls,Config) of - true -> start_tls(H,Config); - _ -> Config - end. + chk_add(H, BasePath), + {ok,FB} = chk_search(H, BasePath), + chk_modify(H, FB), + chk_delete(H, BasePath), + chk_modify_dn(H, FB). -start_tls(H, Config) -> - KeyFile = filename:join([?config(data_dir,Config), - "certs/client/key.pem" - ]), - case eldap:start_tls(H, [{keyfile, KeyFile}]) of - ok -> - [{start_tls_success,true} | Config]; - Error -> - ct:log("Start_tls on ~p failed: ~p",[?config(url,Config) ,Error]), - ct:fail("start_tls failed") - end. +chk_add(H, BasePath) -> + ok = eldap:add(H, "cn=Jonas Jonsson," ++ BasePath, + [{"objectclass", ["person"]}, + {"cn", ["Jonas Jonsson"]}, {"sn", ["Jonsson"]}]), + {error, entryAlreadyExists} = eldap:add(H, "cn=Jonas Jonsson," ++ BasePath, + [{"objectclass", ["person"]}, + {"cn", ["Jonas Jonsson"]}, {"sn", ["Jonsson"]}]), + ok = eldap:add(H, "cn=Foo Bar," ++ BasePath, + [{"objectclass", ["person"]}, + {"cn", ["Foo Bar"]}, {"sn", ["Bar"]}, {"telephoneNumber", ["555-1232", "555-5432"]}]), + ok = eldap:add(H, "ou=Team," ++ BasePath, + [{"objectclass", ["organizationalUnit"]}, + {"ou", ["Team"]}]). -%%%---------------------------------------------------------------- -open_bind(Config) -> - {ok,H} = open(Config), - ok = eldap:simple_bind(H, "cn=Manager,dc=ericsson,dc=se", "hejsan"), - {ok,H}. +chk_search(H, BasePath) -> + Search = fun(Filter) -> + eldap:search(H, #eldap_search{base=BasePath, + filter=Filter, + scope=eldap:singleLevel()}) + end, + JJSR = {ok, #eldap_search_result{entries=[#eldap_entry{}]}} = Search(eldap:equalityMatch("sn", "Jonsson")), + JJSR = Search(eldap:substrings("sn", [{any, "ss"}])), + FBSR = {ok, #eldap_search_result{entries=[#eldap_entry{object_name=FB}]}} = + Search(eldap:substrings("sn", [{any, "a"}])), + FBSR = Search(eldap:substrings("sn", [{initial, "B"}])), + FBSR = Search(eldap:substrings("sn", [{final, "r"}])), + F_AND = eldap:'and'([eldap:present("objectclass"), eldap:present("ou")]), + {ok, #eldap_search_result{entries=[#eldap_entry{}]}} = Search(F_AND), + F_NOT = eldap:'and'([eldap:present("objectclass"), eldap:'not'(eldap:present("ou"))]), + {ok, #eldap_search_result{entries=[#eldap_entry{}, #eldap_entry{}]}} = Search(F_NOT), + {ok,FB}. %% FIXME -open(Config) -> - {Host,Port} = ?config(server,Config), - SSLflag = ?config(ssl_flag,Config), - {ok,H} = eldap:open([Host], [{port,Port},{ssl,SSLflag}]), - cond_start_tls(H, Config), - {ok,H}. - -%%%---------------------------------------------------------------- -supported_extension(OID, Config) -> - {ok,H} = open_bind(Config), - case eldap:search(H, [{scope, eldap:baseObject()}, - {filter, eldap:present("objectclass")}, - {deref, eldap:neverDerefAliases()}, - {attributes, ["+"]}]) of - {ok,R=#eldap_search_result{}} -> - eldap:close(H), - lists:member(OID, - [SE || EE <- R#eldap_search_result.entries, - {"supportedExtension",SEs} <- EE#eldap_entry.attributes, - SE<-SEs]); - _ -> - eldap:close(H), - false +chk_modify(H, FB) -> + Mod = [eldap:mod_replace("telephoneNumber", ["555-12345"]), + eldap:mod_add("description", ["Nice guy"])], + %% io:format("MOD ~p ~p ~n",[FB, Mod]), + ok = eldap:modify(H, FB, Mod), + %% DELETE ATTR + ok = eldap:modify(H, FB, [eldap:mod_delete("telephoneNumber", [])]). + + +chk_delete(H, BasePath) -> + {error, entryAlreadyExists} = eldap:add(H, "cn=Jonas Jonsson," ++ BasePath, + [{"objectclass", ["person"]}, + {"cn", ["Jonas Jonsson"]}, {"sn", ["Jonsson"]}]), + ok = eldap:delete(H, "cn=Jonas Jonsson," ++ BasePath), + {error, noSuchObject} = eldap:delete(H, "cn=Jonas Jonsson," ++ BasePath). + +chk_modify_dn(H, FB) -> + ok = eldap:modify_dn(H, FB, "cn=Niclas Andre", true, ""). + %%io:format("Res ~p~n ~p~n",[R, All(BasePath)]). + + +%%%---------------- +add(H, Attr, Value, Path0, Attrs, Class) -> + Path = case Path0 of + [] -> Attr ++ "=" ++ Value; + _ -> Attr ++ "=" ++ Value ++ "," ++ Path0 + end, + case eldap:add(H, Path, [{"objectclass", Class}, {Attr, [Value]}] ++ Attrs) + of + ok -> {ok, Path}; + {error, E = entryAlreadyExists} -> {E, Path}; + R = {error, Reason} -> + io:format("~p:~p: ~s,~s =>~n ~p~n", + [?MODULE,?LINE, Attr, Value, R]), + exit({ldap, add, Reason}) end. -%%%---------------------------------------------------------------- -client_timeout(Fun, Config) -> - Host = proplists:get_value(listen_host, Config), - Port = proplists:get_value(listen_port, Config), - Opts = proplists:get_value(tcp_connect_opts, Config), - T = 1000, - case eldap:open([Host], [{timeout,T},{port,Port}|Opts]) of - {ok,H} -> - T0 = erlang:monotonic_time(), - {error,{gen_tcp_error,timeout}} = Fun(H), - T_op = ms_passed(T0), - ct:log("Time = ~p, Timeout spec = ~p",[T_op,T]), - if - T_op < T -> - {fail, "Timeout too early"}; - true -> - ok - end; - Other -> ct:fail("eldap:open failed: ~p",[Other]) - end. -%% Help function, elapsed milliseconds since T0 -ms_passed(T0) -> - %% OTP 18 - erlang:convert_time_unit(erlang:monotonic_time() - T0, - native, - micro_seconds) / 1000. - -%%%---------------------------------------------------------------- -init_ssl_certs_et_al(Config) -> - try ssl:start() - of - R when R==ok ; R=={error,{already_started,ssl}} -> - try make_certs:all("/dev/null", - filename:join(?config(data_dir,Config), "certs")) - of - {ok,_} -> true; - Other -> - ct:comment("make_certs failed"), - ct:log("make_certs failed ~p", [Other]), - false - catch - C:E -> - ct:comment("make_certs crashed"), - ct:log("make_certs failed ~p:~p", [C,E]), - false - end; - _ -> - false - catch - Error:Reason -> - ct:comment("ssl failed to start"), - ct:log("init_per_suite failed to start ssl Error=~p Reason=~p", [Error, Reason]), - false - end. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Develop +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +test() -> + run(). + +run() -> + Cases = all(), + run(Cases). + +run(Case) when is_atom(Case) -> + run([Case]); +run(Cases) when is_list(Cases) -> + Run = fun(Test, Config0) -> + Config = init_per_testcase(Test, Config0), + try + io:format("~nTest ~p ... ",[Test]), + ?MODULE:Test(Config), + end_per_testcase(Test, Config), + io:format("ok~n",[]) + catch _:Reason -> + io:format("~n FAIL (~p): ~p~n ~p~n", + [Test, Reason, erlang:get_stacktrace()]) + end + end, + process_flag(trap_exit, true), + Pid = spawn_link(fun() -> + case init_per_suite([]) of + {skip, Reason} -> io:format("Skip ~s~n",[Reason]); + Config -> + try + [Run(Test, Config) || Test <- Cases] + catch _:Err -> + io:format("Error ~p in ~p~n",[Err, erlang:get_stacktrace()]) + end, + end_per_suite(Config) + end + end), + receive + {'EXIT', Pid, normal} -> ok; + Msg -> io:format("Received ~p (~p)~n",[Msg, Pid]) + after 100 -> ok end, + process_flag(trap_exit, false), + ok. diff -Nru erlang-18.2-dfsg/lib/eldap/test/eldap_misc_SUITE.erl erlang-17.3-dfsg/lib/eldap/test/eldap_misc_SUITE.erl --- erlang-18.2-dfsg/lib/eldap/test/eldap_misc_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/test/eldap_misc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,51 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2012-2014. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +-module(eldap_misc_SUITE). + +-compile(export_all). %% Use this only in test suites... + +-include_lib("common_test/include/ct.hrl"). +-include_lib("eldap/include/eldap.hrl"). +-include_lib("eldap/ebin/ELDAPv3.hrl"). + +all() -> + [ + encode, + decode + ]. + + +encode(_Config) -> + {ok,Bin} = 'ELDAPv3':encode('AddRequest', #'AddRequest'{entry="hejHopp" ,attributes=[]} ), + Expected = <<104,11,4,7,104,101,106,72,111,112,112,48,0>>, + Expected = Bin. + +decode(_Config) -> + {ok,Res} = 'ELDAPv3':decode('AddRequest', <<104,11,4,7,104,101,106,72,111,112,112,48,0>>), + ct:log("Res = ~p", [Res]), + Expected = #'AddRequest'{entry = "hejHopp",attributes = []}, + case Res of + Expected -> ok; + #'AddRequest'{entry= <<"hejHopp">>, attributes=[]} -> + {fail, "decoded to (correct) binary!!"}; + _ -> + {fail, "Bad decode"} + end. + diff -Nru erlang-18.2-dfsg/lib/eldap/test/make_certs.erl erlang-17.3-dfsg/lib/eldap/test/make_certs.erl --- erlang-18.2-dfsg/lib/eldap/test/make_certs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/test/make_certs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,90 +1,41 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2012. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at %% -%% http://www.apache.org/licenses/LICENSE-2.0 +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% %% %CopyrightEnd% %% -module(make_certs). --compile([export_all]). -%-export([all/1, all/2, rootCA/2, intermediateCA/3, endusers/3, enduser/3, revoke/3, gencrl/2, verify/3]). +-export([all/2]). --record(config, {commonName, +-record(dn, {commonName, organizationalUnitName = "Erlang OTP", organizationName = "Ericsson AB", localityName = "Stockholm", countryName = "SE", - emailAddress = "peter@erix.ericsson.se", - default_bits = 2048, - v2_crls = true, - ecc_certs = false, - issuing_distribution_point = false, - crl_port = 8000, - openssl_cmd = "openssl"}). - - -default_config() -> - #config{}. - -make_config(Args) -> - make_config(Args, #config{}). - -make_config([], C) -> - C; -make_config([{organizationalUnitName, Name}|T], C) when is_list(Name) -> - make_config(T, C#config{organizationalUnitName = Name}); -make_config([{organizationName, Name}|T], C) when is_list(Name) -> - make_config(T, C#config{organizationName = Name}); -make_config([{localityName, Name}|T], C) when is_list(Name) -> - make_config(T, C#config{localityName = Name}); -make_config([{countryName, Name}|T], C) when is_list(Name) -> - make_config(T, C#config{countryName = Name}); -make_config([{emailAddress, Name}|T], C) when is_list(Name) -> - make_config(T, C#config{emailAddress = Name}); -make_config([{default_bits, Bits}|T], C) when is_integer(Bits) -> - make_config(T, C#config{default_bits = Bits}); -make_config([{v2_crls, Bool}|T], C) when is_boolean(Bool) -> - make_config(T, C#config{v2_crls = Bool}); -make_config([{crl_port, Port}|T], C) when is_integer(Port) -> - make_config(T, C#config{crl_port = Port}); -make_config([{ecc_certs, Bool}|T], C) when is_boolean(Bool) -> - make_config(T, C#config{ecc_certs = Bool}); -make_config([{issuing_distribution_point, Bool}|T], C) when is_boolean(Bool) -> - make_config(T, C#config{issuing_distribution_point = Bool}); -make_config([{openssl_cmd, Cmd}|T], C) when is_list(Cmd) -> - make_config(T, C#config{openssl_cmd = Cmd}). - - -all([DataDir, PrivDir]) -> - all(DataDir, PrivDir). + emailAddress = "peter@erix.ericsson.se"}). all(DataDir, PrivDir) -> - all(DataDir, PrivDir, #config{}). - -all(DataDir, PrivDir, C) when is_list(C) -> - all(DataDir, PrivDir, make_config(C)); -all(DataDir, PrivDir, C = #config{}) -> - ok = filelib:ensure_dir(filename:join(PrivDir, "erlangCA")), + OpenSSLCmd = "openssl", create_rnd(DataDir, PrivDir), % For all requests - rootCA(PrivDir, "erlangCA", C), - intermediateCA(PrivDir, "otpCA", "erlangCA", C), - endusers(PrivDir, "otpCA", ["client", "server", "revoked"], C), - endusers(PrivDir, "erlangCA", ["localhost"], C), - %% Create keycert files + rootCA(PrivDir, OpenSSLCmd, "erlangCA"), + intermediateCA(PrivDir, OpenSSLCmd, "otpCA", "erlangCA"), + endusers(PrivDir, OpenSSLCmd, "otpCA", ["client", "server"]), + collect_certs(PrivDir, ["erlangCA", "otpCA"], ["client", "server"]), + %% Create keycert files SDir = filename:join([PrivDir, "server"]), SC = filename:join([SDir, "cert.pem"]), SK = filename:join([SDir, "key.pem"]), @@ -95,14 +46,7 @@ CK = filename:join([CDir, "key.pem"]), CKC = filename:join([CDir, "keycert.pem"]), append_files([CK, CC], CKC), - RDir = filename:join([PrivDir, "revoked"]), - RC = filename:join([RDir, "cert.pem"]), - RK = filename:join([RDir, "key.pem"]), - RKC = filename:join([RDir, "keycert.pem"]), - revoke(PrivDir, "otpCA", "revoked", C), - append_files([RK, RC], RKC), - remove_rnd(PrivDir), - {ok, C}. + remove_rnd(PrivDir). append_files(FileNames, ResultFileName) -> {ok, ResultFile} = file:open(ResultFileName, [write]), @@ -115,182 +59,117 @@ ok = file:write(RF, Data), do_append_files(Fs, RF). -rootCA(Root, Name, C) -> - create_ca_dir(Root, Name, ca_cnf(C#config{commonName = Name})), - create_self_signed_cert(Root, Name, req_cnf(C#config{commonName = Name}), C), - file:copy(filename:join([Root, Name, "cert.pem"]), filename:join([Root, Name, "cacerts.pem"])), - gencrl(Root, Name, C). +rootCA(Root, OpenSSLCmd, Name) -> + create_ca_dir(Root, Name, ca_cnf(Name)), + DN = #dn{commonName = Name}, + create_self_signed_cert(Root, OpenSSLCmd, Name, req_cnf(DN)), + ok. -intermediateCA(Root, CA, ParentCA, C) -> - create_ca_dir(Root, CA, ca_cnf(C#config{commonName = CA})), +intermediateCA(Root, OpenSSLCmd, CA, ParentCA) -> + CA = "otpCA", + create_ca_dir(Root, CA, ca_cnf(CA)), CARoot = filename:join([Root, CA]), + DN = #dn{commonName = CA}, CnfFile = filename:join([CARoot, "req.cnf"]), - file:write_file(CnfFile, req_cnf(C#config{commonName = CA})), - KeyFile = filename:join([CARoot, "private", "key.pem"]), - ReqFile = filename:join([CARoot, "req.pem"]), - create_req(Root, CnfFile, KeyFile, ReqFile, C), + file:write_file(CnfFile, req_cnf(DN)), + KeyFile = filename:join([CARoot, "private", "key.pem"]), + ReqFile = filename:join([CARoot, "req.pem"]), + create_req(Root, OpenSSLCmd, CnfFile, KeyFile, ReqFile), CertFile = filename:join([CARoot, "cert.pem"]), - sign_req(Root, ParentCA, "ca_cert", ReqFile, CertFile, C), - CACertsFile = filename:join(CARoot, "cacerts.pem"), - file:copy(filename:join([Root, ParentCA, "cacerts.pem"]), CACertsFile), - %% append this CA's cert to the cacerts file - {ok, Bin} = file:read_file(CertFile), - {ok, FD} = file:open(CACertsFile, [append]), - file:write(FD, ["\n", Bin]), - file:close(FD), - gencrl(Root, CA, C). + sign_req(Root, OpenSSLCmd, ParentCA, "ca_cert", ReqFile, CertFile). -endusers(Root, CA, Users, C) -> - [enduser(Root, CA, User, C) || User <- Users]. +endusers(Root, OpenSSLCmd, CA, Users) -> + lists:foreach(fun(User) -> enduser(Root, OpenSSLCmd, CA, User) end, Users). -enduser(Root, CA, User, C) -> +enduser(Root, OpenSSLCmd, CA, User) -> UsrRoot = filename:join([Root, User]), file:make_dir(UsrRoot), CnfFile = filename:join([UsrRoot, "req.cnf"]), - file:write_file(CnfFile, req_cnf(C#config{commonName = User})), - KeyFile = filename:join([UsrRoot, "key.pem"]), - ReqFile = filename:join([UsrRoot, "req.pem"]), - create_req(Root, CnfFile, KeyFile, ReqFile, C), - %create_req(Root, CnfFile, KeyFile, ReqFile), + DN = #dn{commonName = User}, + file:write_file(CnfFile, req_cnf(DN)), + KeyFile = filename:join([UsrRoot, "key.pem"]), + ReqFile = filename:join([UsrRoot, "req.pem"]), + create_req(Root, OpenSSLCmd, CnfFile, KeyFile, ReqFile), CertFileAllUsage = filename:join([UsrRoot, "cert.pem"]), - sign_req(Root, CA, "user_cert", ReqFile, CertFileAllUsage, C), + sign_req(Root, OpenSSLCmd, CA, "user_cert", ReqFile, CertFileAllUsage), CertFileDigitalSigOnly = filename:join([UsrRoot, "digital_signature_only_cert.pem"]), - sign_req(Root, CA, "user_cert_digital_signature_only", ReqFile, CertFileDigitalSigOnly, C), - CACertsFile = filename:join(UsrRoot, "cacerts.pem"), - file:copy(filename:join([Root, CA, "cacerts.pem"]), CACertsFile), - ok. + sign_req(Root, OpenSSLCmd, CA, "user_cert_digital_signature_only", ReqFile, CertFileDigitalSigOnly). -revoke(Root, CA, User, C) -> - UsrCert = filename:join([Root, User, "cert.pem"]), - CACnfFile = filename:join([Root, CA, "ca.cnf"]), - Cmd = [C#config.openssl_cmd, " ca" - " -revoke ", UsrCert, - [" -crl_reason keyCompromise" || C#config.v2_crls ], - " -config ", CACnfFile], - Env = [{"ROOTDIR", filename:absname(Root)}], - cmd(Cmd, Env), - gencrl(Root, CA, C). - -gencrl(Root, CA, C) -> - CACnfFile = filename:join([Root, CA, "ca.cnf"]), - CACRLFile = filename:join([Root, CA, "crl.pem"]), - Cmd = [C#config.openssl_cmd, " ca" - " -gencrl ", - " -crlhours 24", - " -out ", CACRLFile, - " -config ", CACnfFile], - Env = [{"ROOTDIR", filename:absname(Root)}], - cmd(Cmd, Env). - -verify(Root, CA, User, C) -> - CAFile = filename:join([Root, User, "cacerts.pem"]), - CACRLFile = filename:join([Root, CA, "crl.pem"]), - CertFile = filename:join([Root, User, "cert.pem"]), - Cmd = [C#config.openssl_cmd, " verify" - " -CAfile ", CAFile, - " -CRLfile ", CACRLFile, %% this is undocumented, but seems to work - " -crl_check ", - CertFile], - Env = [{"ROOTDIR", filename:absname(Root)}], - try cmd(Cmd, Env) catch - exit:{eval_cmd, _, _} -> - invalid - end. +collect_certs(Root, CAs, Users) -> + Bins = lists:foldr( + fun(CA, Acc) -> + File = filename:join([Root, CA, "cert.pem"]), + {ok, Bin} = file:read_file(File), + [Bin, "\n" | Acc] + end, [], CAs), + lists:foreach( + fun(User) -> + File = filename:join([Root, User, "cacerts.pem"]), + file:write_file(File, Bins) + end, Users). -create_self_signed_cert(Root, CAName, Cnf, C = #config{ecc_certs = true}) -> +create_self_signed_cert(Root, OpenSSLCmd, CAName, Cnf) -> CARoot = filename:join([Root, CAName]), CnfFile = filename:join([CARoot, "req.cnf"]), file:write_file(CnfFile, Cnf), - KeyFile = filename:join([CARoot, "private", "key.pem"]), - CertFile = filename:join([CARoot, "cert.pem"]), - Cmd = [C#config.openssl_cmd, " ecparam" - " -out ", KeyFile, - " -name secp521r1 ", - %" -name sect283k1 ", - " -genkey "], - Env = [{"ROOTDIR", filename:absname(Root)}], - cmd(Cmd, Env), - - Cmd2 = [C#config.openssl_cmd, " req" - " -new" - " -x509" - " -config ", CnfFile, - " -key ", KeyFile, - " -outform PEM ", - " -out ", CertFile], - cmd(Cmd2, Env); -create_self_signed_cert(Root, CAName, Cnf, C) -> - CARoot = filename:join([Root, CAName]), - CnfFile = filename:join([CARoot, "req.cnf"]), - file:write_file(CnfFile, Cnf), - KeyFile = filename:join([CARoot, "private", "key.pem"]), - CertFile = filename:join([CARoot, "cert.pem"]), - Cmd = [C#config.openssl_cmd, " req" + KeyFile = filename:join([CARoot, "private", "key.pem"]), + CertFile = filename:join([CARoot, "cert.pem"]), + Cmd = [OpenSSLCmd, " req" " -new" " -x509" " -config ", CnfFile, " -keyout ", KeyFile, - " -outform PEM", - " -out ", CertFile], - Env = [{"ROOTDIR", filename:absname(Root)}], - cmd(Cmd, Env). + " -out ", CertFile], + Env = [{"ROOTDIR", Root}], + cmd(Cmd, Env), + fix_key_file(OpenSSLCmd, KeyFile). +% openssl 1.0 generates key files in pkcs8 format by default and we don't handle this format +fix_key_file(OpenSSLCmd, KeyFile) -> + KeyFileTmp = KeyFile ++ ".tmp", + Cmd = [OpenSSLCmd, " rsa", + " -in ", + KeyFile, + " -out ", + KeyFileTmp], + cmd(Cmd, []), + ok = file:rename(KeyFileTmp, KeyFile). create_ca_dir(Root, CAName, Cnf) -> CARoot = filename:join([Root, CAName]), - ok = filelib:ensure_dir(CARoot), file:make_dir(CARoot), create_dirs(CARoot, ["certs", "crl", "newcerts", "private"]), create_rnd(Root, filename:join([CAName, "private"])), create_files(CARoot, [{"serial", "01\n"}, - {"crlnumber", "01"}, {"index.txt", ""}, {"ca.cnf", Cnf}]). -create_req(Root, CnfFile, KeyFile, ReqFile, C = #config{ecc_certs = true}) -> - Cmd = [C#config.openssl_cmd, " ecparam" - " -out ", KeyFile, - " -name secp521r1 ", - %" -name sect283k1 ", - " -genkey "], - Env = [{"ROOTDIR", filename:absname(Root)}], - cmd(Cmd, Env), - Cmd2 = [C#config.openssl_cmd, " req" - " -new ", - " -key ", KeyFile, - " -outform PEM ", - " -out ", ReqFile, - " -config ", CnfFile], - cmd(Cmd2, Env); - %fix_key_file(KeyFile). -create_req(Root, CnfFile, KeyFile, ReqFile, C) -> - Cmd = [C#config.openssl_cmd, " req" +create_req(Root, OpenSSLCmd, CnfFile, KeyFile, ReqFile) -> + Cmd = [OpenSSLCmd, " req" " -new" " -config ", CnfFile, - " -outform PEM ", - " -keyout ", KeyFile, - " -out ", ReqFile], - Env = [{"ROOTDIR", filename:absname(Root)}], - cmd(Cmd, Env). - %fix_key_file(KeyFile). - + " -keyout ", KeyFile, + " -out ", ReqFile], + Env = [{"ROOTDIR", Root}], + cmd(Cmd, Env), + fix_key_file(OpenSSLCmd, KeyFile). -sign_req(Root, CA, CertType, ReqFile, CertFile, C) -> +sign_req(Root, OpenSSLCmd, CA, CertType, ReqFile, CertFile) -> CACnfFile = filename:join([Root, CA, "ca.cnf"]), - Cmd = [C#config.openssl_cmd, " ca" + Cmd = [OpenSSLCmd, " ca" " -batch" " -notext" - " -config ", CACnfFile, + " -config ", CACnfFile, " -extensions ", CertType, - " -in ", ReqFile, + " -in ", ReqFile, " -out ", CertFile], - Env = [{"ROOTDIR", filename:absname(Root)}], + Env = [{"ROOTDIR", Root}], cmd(Cmd, Env). - + %% %% Misc %% - + create_dirs(Root, Dirs) -> lists:foreach(fun(Dir) -> file:make_dir(filename:join([Root, Dir])) end, @@ -313,30 +192,30 @@ cmd(Cmd, Env) -> FCmd = lists:flatten(Cmd), - Port = open_port({spawn, FCmd}, [stream, eof, exit_status, stderr_to_stdout, + Port = open_port({spawn, FCmd}, [stream, eof, exit_status, stderr_to_stdout, {env, Env}]), - eval_cmd(Port, FCmd). + eval_cmd(Port). -eval_cmd(Port, Cmd) -> - receive +eval_cmd(Port) -> + receive {Port, {data, _}} -> - eval_cmd(Port, Cmd); + eval_cmd(Port); {Port, eof} -> ok end, receive {Port, {exit_status, Status}} when Status /= 0 -> %% io:fwrite("exit status: ~w~n", [Status]), - exit({eval_cmd, Cmd, Status}) + exit({eval_cmd, Status}) after 0 -> ok end. %% -%% Contents of configuration files +%% Contents of configuration files %% -req_cnf(C) -> +req_cnf(DN) -> ["# Purpose: Configuration for requests (end users and CAs)." "\n" "ROOTDIR = $ENV::ROOTDIR\n" @@ -345,10 +224,10 @@ "[req]\n" "input_password = secret\n" "output_password = secret\n" - "default_bits = ", integer_to_list(C#config.default_bits), "\n" + "default_bits = 1024\n" "RANDFILE = $ROOTDIR/RAND\n" "encrypt_key = no\n" - "default_md = md5\n" + "default_md = sha1\n" "#string_mask = pkix\n" "x509_extensions = ca_ext\n" "prompt = no\n" @@ -356,12 +235,12 @@ "\n" "[name]\n" - "commonName = ", C#config.commonName, "\n" - "organizationalUnitName = ", C#config.organizationalUnitName, "\n" - "organizationName = ", C#config.organizationName, "\n" - "localityName = ", C#config.localityName, "\n" - "countryName = ", C#config.countryName, "\n" - "emailAddress = ", C#config.emailAddress, "\n" + "commonName = ", DN#dn.commonName, "\n" + "organizationalUnitName = ", DN#dn.organizationalUnitName, "\n" + "organizationName = ", DN#dn.organizationName, "\n" + "localityName = ", DN#dn.localityName, "\n" + "countryName = ", DN#dn.countryName, "\n" + "emailAddress = ", DN#dn.emailAddress, "\n" "\n" "[ca_ext]\n" @@ -370,7 +249,8 @@ "subjectKeyIdentifier = hash\n" "subjectAltName = email:copy\n"]. -ca_cnf(C) -> + +ca_cnf(CA) -> ["# Purpose: Configuration for CAs.\n" "\n" "ROOTDIR = $ENV::ROOTDIR\n" @@ -378,23 +258,21 @@ "\n" "[ca]\n" - "dir = $ROOTDIR/", C#config.commonName, "\n" + "dir = $ROOTDIR/", CA, "\n" "certs = $dir/certs\n" "crl_dir = $dir/crl\n" "database = $dir/index.txt\n" "new_certs_dir = $dir/newcerts\n" "certificate = $dir/cert.pem\n" "serial = $dir/serial\n" - "crl = $dir/crl.pem\n", - ["crlnumber = $dir/crlnumber\n" || C#config.v2_crls], + "crl = $dir/crl.pem\n" "private_key = $dir/private/key.pem\n" "RANDFILE = $dir/private/RAND\n" "\n" - "x509_extensions = user_cert\n", - ["crl_extensions = crl_ext\n" || C#config.v2_crls], + "x509_extensions = user_cert\n" "unique_subject = no\n" "default_days = 3600\n" - "default_md = md5\n" + "default_md = sha1\n" "preserve = no\n" "policy = policy_match\n" "\n" @@ -408,13 +286,6 @@ "emailAddress = supplied\n" "\n" - "[crl_ext]\n" - "authorityKeyIdentifier=keyid:always,issuer:always\n", - ["issuingDistributionPoint=critical, @idpsec\n" || C#config.issuing_distribution_point], - - "[idpsec]\n" - "fullname=URI:http://localhost:8000/",C#config.commonName,"/crl.pem\n" - "[user_cert]\n" "basicConstraints = CA:false\n" "keyUsage = nonRepudiation, digitalSignature, keyEncipherment\n" @@ -422,12 +293,6 @@ "authorityKeyIdentifier = keyid,issuer:always\n" "subjectAltName = email:copy\n" "issuerAltName = issuer:copy\n" - "crlDistributionPoints=@crl_section\n" - - "[crl_section]\n" - %% intentionally invalid - "URI.1=http://localhost/",C#config.commonName,"/crl.pem\n" - "URI.2=http://localhost:",integer_to_list(C#config.crl_port),"/",C#config.commonName,"/crl.pem\n" "\n" "[user_cert_digital_signature_only]\n" @@ -445,7 +310,4 @@ "subjectKeyIdentifier = hash\n" "authorityKeyIdentifier = keyid:always,issuer:always\n" "subjectAltName = email:copy\n" - "issuerAltName = issuer:copy\n" - "crlDistributionPoints=@crl_section\n" - ]. - + "issuerAltName = issuer:copy\n"]. diff -Nru erlang-18.2-dfsg/lib/eldap/test/Makefile erlang-17.3-dfsg/lib/eldap/test/Makefile --- erlang-18.2-dfsg/lib/eldap/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -29,9 +28,7 @@ # ---------------------------------------------------- MODULES= \ - eldap_basic_SUITE \ - make_certs - + eldap_basic_SUITE ERL_FILES= $(MODULES:%=%.erl) diff -Nru erlang-18.2-dfsg/lib/eldap/vsn.mk erlang-17.3-dfsg/lib/eldap/vsn.mk --- erlang-18.2-dfsg/lib/eldap/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eldap/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1,2 @@ -ELDAP_VSN = 1.2 +ELDAP_VSN = 1.0.3 + diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/block_tags.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/block_tags.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/block_tags.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/block_tags.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/book.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/book.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/character_entities.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/character_entities.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/character_entities.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/character_entities.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/doc-build.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/doc-build.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/doc-build.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/doc-build.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. How to Build OTP like documentation diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/docgen_xml_check.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/docgen_xml_check.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/docgen_xml_check.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/docgen_xml_check.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/erl_docgen_app.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/erl_docgen_app.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/erl_docgen_app.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/erl_docgen_app.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -32,7 +31,7 @@

    - The application consists of the following parts:

    + The application consists of the following parts XSL @@ -59,6 +58,7 @@

    +

    diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/fasc_dtds.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/fasc_dtds.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/fasc_dtds.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/fasc_dtds.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/header_tags.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/header_tags.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/header_tags.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/header_tags.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/inline_tags.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/inline_tags.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/inline_tags.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/inline_tags.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/Makefile erlang-17.3-dfsg/lib/erl_docgen/doc/src/Makefile --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2011-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/notes.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/notes.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,55 +30,7 @@

    This document describes the changes made to the erl_docgen application.

    -
    Erl_Docgen 0.4.1 - -
    Improvements and New Features - - -

    Updated the xmllint target to just check the xml - files with real documentation content.
    Corrected - some errors and added some missing target in the DTD's. -

    -

    - Own Id: OTP-13026

    -
    -
    -
    - -
    - -
    Erl_Docgen 0.4 - -
    Improvements and New Features - - -

    Add possibility to add extra information on - documentation front pages.

    -

    - Own Id: OTP-12722

    -
    -
    -
    - -
    - -
    Erl_Docgen 0.3.7 - -
    Fixed Bugs and Malfunctions - - -

    - Maps: Properly align union typed assoc values in - documentation

    -

    - Own Id: OTP-12190

    -
    -
    -
    - -
    - -
    Erl_Docgen 0.3.6 +
    Erl_Docgen 0.3.6
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/overview.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/overview.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/overview.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/overview.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. Overview OTP DTDs diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/part.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/part.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. Erl_Docgen User's Guide diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/refman_dtds.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/refman_dtds.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/refman_dtds.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/refman_dtds.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/ref_man.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/doc/src/user_guide_dtds.xml erlang-17.3-dfsg/lib/erl_docgen/doc/src/user_guide_dtds.xml --- erlang-18.2-dfsg/lib/erl_docgen/doc/src/user_guide_dtds.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/doc/src/user_guide_dtds.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/Makefile erlang-17.3-dfsg/lib/erl_docgen/Makefile --- erlang-18.2-dfsg/lib/erl_docgen/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/bin/codeline_preprocessing.escript erlang-17.3-dfsg/lib/erl_docgen/priv/bin/codeline_preprocessing.escript --- erlang-18.2-dfsg/lib/erl_docgen/priv/bin/codeline_preprocessing.escript 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/bin/codeline_preprocessing.escript 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 2009-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %%---------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/bin/Makefile erlang-17.3-dfsg/lib/erl_docgen/priv/bin/Makefile --- erlang-18.2-dfsg/lib/erl_docgen/priv/bin/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/bin/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/bin/specs_gen.escript erlang-17.3-dfsg/lib/erl_docgen/priv/bin/specs_gen.escript --- erlang-18.2-dfsg/lib/erl_docgen/priv/bin/specs_gen.escript 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/bin/specs_gen.escript 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -98,7 +97,7 @@ edoc:read_source(File, Opts). extract(File, Forms, Opts) -> - Env = edoc_lib:get_doc_env([], [], _Opts=[]), + Env = edoc_lib:get_doc_env([], [], [], _Opts=[]), {_Module, Doc} = edoc_extract:source(Forms, File, Env, Opts), Doc. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/bin/xml_from_edoc.escript erlang-17.3-dfsg/lib/erl_docgen/priv/bin/xml_from_edoc.escript --- erlang-18.2-dfsg/lib/erl_docgen/priv/bin/xml_from_edoc.escript 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/bin/xml_from_edoc.escript 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %%---------------------------------------------------------------------- @@ -118,7 +117,7 @@ Text = edoc_lib:run_layout(F, Opts), OutFile = "chapter" ++ Args#args.suffix, - edoc_lib:write_file(Text, ".", OutFile, Encoding); + edoc_lib:write_file(Text, ".", OutFile, '', Encoding); false -> io:format("~s: not a regular file\n", [File]), usage() diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/bin/xref_mod_app.escript erlang-17.3-dfsg/lib/erl_docgen/priv/bin/xref_mod_app.escript --- erlang-18.2-dfsg/lib/erl_docgen/priv/bin/xref_mod_app.escript 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/bin/xref_mod_app.escript 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/css/Makefile erlang-17.3-dfsg/lib/erl_docgen/priv/css/Makefile --- erlang-18.2-dfsg/lib/erl_docgen/priv/css/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/css/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/css/otp_doc.css erlang-17.3-dfsg/lib/erl_docgen/priv/css/otp_doc.css --- erlang-18.2-dfsg/lib/erl_docgen/priv/css/otp_doc.css 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/css/otp_doc.css 2014-09-16 19:10:57.000000000 +0000 @@ -66,7 +66,7 @@ span.bold_code { font-family: Courier, monospace; font-weight: bold } span.code { font-family: Courier, monospace; font-weight: normal } -.note, .warning, .do, .dont { +.note, .warning { border: solid black 1px; margin: 1em 3em; } @@ -96,41 +96,10 @@ font-size: 90%; padding: 5px 10px; } -.do .label { - background: #30d42a; - color: white; - font-weight: bold; - padding: 5px 10px; -} -.do .content { - background: #eafeea; - color: black; - line-height: 120%; - font-size: 90%; - padding: 5px 10px; -} -.dont .label { - background: #C00; - color: white; - font-weight: bold; - padding: 5px 10px; -} -.dont .content { - background: #FFF0F0; - color: black; - line-height: 120%; - font-size: 90%; - padding: 5px 10px; -} .example { background-color:#eeeeff; padding: 0px 10px; } -.extrafrontpageinfo { - color: #C00; - font-weight: bold; - font-size: 120%; -} pre { font-family: Courier, monospace; font-weight: normal } diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/dtd/application.dtd erlang-17.3-dfsg/lib/erl_docgen/priv/dtd/application.dtd --- erlang-18.2-dfsg/lib/erl_docgen/priv/dtd/application.dtd 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/dtd/application.dtd 2014-09-16 19:10:57.000000000 +0000 @@ -1,16 +1,15 @@ - diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/dtd/cites.dtd erlang-17.3-dfsg/lib/erl_docgen/priv/dtd/cites.dtd --- erlang-18.2-dfsg/lib/erl_docgen/priv/dtd/cites.dtd 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/dtd/cites.dtd 2014-09-16 19:10:57.000000000 +0000 @@ -1,15 +1,14 @@ - - - + + + - - - - - - + + @@ -66,13 +61,13 @@ - - - + + + - + diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/dtd/common.entities.dtd erlang-17.3-dfsg/lib/erl_docgen/priv/dtd/common.entities.dtd --- erlang-18.2-dfsg/lib/erl_docgen/priv/dtd/common.entities.dtd 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/dtd/common.entities.dtd 2014-09-16 19:10:57.000000000 +0000 @@ -1,15 +1,14 @@ + prepared,responsible?,docno,approved?, + checked?,date,rev,file?) > - + - - - + + + + warning|note)*) > - - + + diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/dtd/common.table.dtd erlang-17.3-dfsg/lib/erl_docgen/priv/dtd/common.table.dtd --- erlang-18.2-dfsg/lib/erl_docgen/priv/dtd/common.table.dtd 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/dtd/common.table.dtd 2014-09-16 19:10:57.000000000 +0000 @@ -1,15 +1,14 @@ - - -
    -
    Do
    -
    -

    - - - -

    -
    -
    -
    - - - - -
    -
    Don't
    -
    -

    - - - -

    -
    -
    -
    -

    @@ -990,15 +959,12 @@

    + - - - -
    @@ -1136,9 +1102,6 @@

    Version

    -
    -
    -
    @@ -1304,9 +1267,6 @@

    Version

    -
    -
    -
    @@ -2129,9 +2089,6 @@

    Version

    -
    -
    -
    diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/xsl/db_man.xsl erlang-17.3-dfsg/lib/erl_docgen/priv/xsl/db_man.xsl --- erlang-18.2-dfsg/lib/erl_docgen/priv/xsl/db_man.xsl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/xsl/db_man.xsl 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at + # The contents of this file are subject to the Erlang Public License, + # Version 1.1, (the "License"); you may not use this file except in + # compliance with the License. You should have received a copy of the + # Erlang Public License along with this software. If not, it can be + # retrieved online at http://www.erlang.org/. # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. + # Software distributed under the License is distributed on an "AS IS" + # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + # the License for the specific language governing rights and limitations + # under the License. # # %CopyrightEnd% @@ -544,29 +543,7 @@ - - - .LP - .RS -4 - .B - Do: - .RE - - - - - - - .LP - .RS -4 - .B - Dont: - .RE - - - - - + @@ -594,12 +571,6 @@ \fR\& - - - \fI - - \fR\& - diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/xsl/db_pdf_params.xsl erlang-17.3-dfsg/lib/erl_docgen/priv/xsl/db_pdf_params.xsl --- erlang-18.2-dfsg/lib/erl_docgen/priv/xsl/db_pdf_params.xsl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/xsl/db_pdf_params.xsl 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at + # The contents of this file are subject to the Erlang Public License, + # Version 1.1, (the "License"); you may not use this file except in + # compliance with the License. You should have received a copy of the + # Erlang Public License along with this software. If not, it can be + # retrieved online at http://www.erlang.org/. # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. + # Software distributed under the License is distributed on an "AS IS" + # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + # the License for the specific language governing rights and limitations + # under the License. # # %CopyrightEnd% @@ -99,14 +98,6 @@ end - - 2.5em - 1.33em - bold - #C00 - end - - solid 1pt @@ -298,33 +289,6 @@ always - - #d0fed0 - 1em - 2em - justify - 1em - 0.3em - 0.5em - 0.5em - 0.5em - 0.5em - always - - - - #ffd6d6 - 1em - 2em - justify - 1em - 0.3em - 0.5em - 0.5em - 0.5em - 0.5em - always - 1.33em diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/xsl/db_pdf.xsl erlang-17.3-dfsg/lib/erl_docgen/priv/xsl/db_pdf.xsl --- erlang-18.2-dfsg/lib/erl_docgen/priv/xsl/db_pdf.xsl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/xsl/db_pdf.xsl 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2009-2013. All Rights Reserved. # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at + # The contents of this file are subject to the Erlang Public License, + # Version 1.1, (the "License"); you may not use this file except in + # compliance with the License. You should have received a copy of the + # Erlang Public License along with this software. If not, it can be + # retrieved online at http://www.erlang.org/. # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. + # Software distributed under the License is distributed on an "AS IS" + # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + # the License for the specific language governing rights and limitations + # under the License. # # %CopyrightEnd% @@ -672,10 +671,6 @@ - - - - - @@ -1145,31 +1138,6 @@ - - - - - - Do: - - - - - - - - - - - - - Don't: - - - - - - @@ -1185,12 +1153,6 @@ - - - - - - diff -Nru erlang-18.2-dfsg/lib/erl_docgen/priv/xsl/Makefile erlang-17.3-dfsg/lib/erl_docgen/priv/xsl/Makefile --- erlang-18.2-dfsg/lib/erl_docgen/priv/xsl/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/priv/xsl/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_docgen/src/docgen_edoc_xml_cb.erl erlang-17.3-dfsg/lib/erl_docgen/src/docgen_edoc_xml_cb.erl --- erlang-18.2-dfsg/lib/erl_docgen/src/docgen_edoc_xml_cb.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/src/docgen_edoc_xml_cb.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2015. All Rights Reserved. +%% Copyright Ericsson AB 2001-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -352,8 +351,8 @@ end; otp_xmlify_e(#xmlElement{name=Tag} = E) % 5a when Tag==h1; Tag==h2; Tag==h3; Tag==h4; Tag==h5 -> - {Name, Text} = text_and_a_name_only(E#xmlElement.content), - [Name, E#xmlElement{name=b, content=Text}]; + Content = text_and_a_name_only(E#xmlElement.content), + [E#xmlElement{name=b, content=Content}]; otp_xmlify_e(#xmlElement{name=Tag} = E) % 5b-c) when Tag==center; Tag==font -> @@ -1190,13 +1189,17 @@ get_text(#xmlElement{content=[E]}) -> get_text(E). -%% text_and_name_only(Es) -> {N, Ts} -text_and_a_name_only(Es) -> - [Name|_] = [Name || - #xmlElement{ - name = a, - attributes = [#xmlAttribute{name=name}]}=Name <- Es], - {Name#xmlElement{content = []}, text_only(Es)}. +%% text_and_name_only(Es) -> Ts +text_and_a_name_only([#xmlElement{ + name = a, + attributes = [#xmlAttribute{name=name}]} = Name|Es]) -> + [Name|text_and_a_name_only(Es)]; +text_and_a_name_only([#xmlElement{content = Content}|Es]) -> + text_and_a_name_only(Content) ++ text_and_a_name_only(Es); +text_and_a_name_only([#xmlText{} = E |Es]) -> + [E | text_and_a_name_only(Es)]; +text_and_a_name_only([]) -> + []. %% text_only(Es) -> Ts %% Takes a list of xmlElement and xmlText and return a lists of xmlText. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/src/docgen_otp_specs.erl erlang-17.3-dfsg/lib/erl_docgen/src/docgen_otp_specs.erl --- erlang-18.2-dfsg/lib/erl_docgen/src/docgen_otp_specs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/src/docgen_otp_specs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -203,8 +202,7 @@ pp_clause(Pre, Type) -> Types = ot_utype([Type]), Atom = lists:duplicate(iolist_size(Pre), $a), - Attr = {attribute,0,spec,{{list_to_atom(Atom),0},[Types]}}, - L1 = erl_pp:attribute(erl_parse:new_anno(Attr)), + L1 = erl_pp:attribute({attribute,0,spec,{{list_to_atom(Atom),0},[Types]}}), "-spec " ++ L2 = lists:flatten(L1), L3 = Pre ++ lists:nthtail(length(Atom), L2), re:replace(L3, "\n ", "\n", [{return,list},global]). @@ -224,8 +222,7 @@ pp_type(Prefix, Type) -> Atom = list_to_atom(lists:duplicate(iolist_size(Prefix), $a)), - Attr = {attribute,0,type,{Atom,ot_utype(Type),[]}}, - L1 = erl_pp:attribute(erl_parse:new_anno(Attr)), + L1 = erl_pp:attribute({attribute,0,type,{Atom,ot_utype(Type),[]}}), {L2,N} = case lists:dropwhile(fun(C) -> C =/= $: end, lists:flatten(L1)) of ":: " ++ L3 -> {L3,9}; % compensation for extra "()" and ":" "::\n" ++ L3 -> {"\n"++L3,6} @@ -393,6 +390,8 @@ t_tuple(Es); t_type([#xmlElement{name = map, content = Es}]) -> t_map(Es); +t_type([#xmlElement{name = map_field, content = Es}]) -> + t_map_field(Es); t_type([#xmlElement{name = 'fun', content = Es}]) -> ["fun("] ++ t_fun(Es) ++ [")"]; t_type([E = #xmlElement{name = record, content = Es}]) -> @@ -436,10 +435,9 @@ ["{"] ++ seq(fun t_utype_elem/1, Es, ["}"]). t_map(Es) -> - Fs = get_elem(map_field, Es), - ["#{"] ++ seq(fun t_map_field/1, Fs, ["}"]). + ["#{"] ++ seq(fun t_utype_elem/1, Es, ["}"]). -t_map_field(#xmlElement{content = [K,V]}) -> +t_map_field([K,V]) -> [t_utype_elem(K) ++ " => " ++ t_utype_elem(V)]. t_fun(Es) -> @@ -559,12 +557,14 @@ ot_tuple(Es); ot_type([#xmlElement{name = map, content = Es}]) -> ot_map(Es); +ot_type([#xmlElement{name = map_field, content = Es}]) -> + ot_map_field(Es); ot_type([#xmlElement{name = 'fun', content = Es}]) -> ot_fun(Es); ot_type([#xmlElement{name = record, content = Es}]) -> ot_record(Es); ot_type([#xmlElement{name = abstype, content = Es}]) -> - ot_abstype(Es); + ot_abstype(Es); ot_type([#xmlElement{name = union, content = Es}]) -> ot_union(Es). @@ -572,8 +572,8 @@ {var,0,list_to_atom(get_attrval(name, E))}. ot_atom(E) -> - {ok, [{atom,A,Name}], _} = erl_scan:string(get_attrval(value, E), 0), - {atom,erl_anno:line(A),Name}. + {ok, [Atom], _} = erl_scan:string(get_attrval(value, E), 0), + Atom. ot_integer(E) -> {integer,0,list_to_integer(get_attrval(value, E))}. @@ -616,10 +616,10 @@ {type,0,tuple,[ot_utype_elem(E) || E <- Es]}. ot_map(Es) -> - {type,0,map,[ot_map_field(E) || E <- get_elem(map_field,Es)]}. + {type,0,map,[ot_utype_elem(E) || E <- Es]}. -ot_map_field(#xmlElement{content=[K,V]}) -> - {type,0,map_field_assoc,[ot_utype_elem(K),ot_utype_elem(V)]}. +ot_map_field(Es) -> + {type,0,map_field_assoc,[ot_utype_elem(E) || E <- Es]}. ot_fun(Es) -> Range = ot_utype(get_elem(type, Es)), diff -Nru erlang-18.2-dfsg/lib/erl_docgen/src/docgen_xmerl_xml_cb.erl erlang-17.3-dfsg/lib/erl_docgen/src/docgen_xmerl_xml_cb.erl --- erlang-18.2-dfsg/lib/erl_docgen/src/docgen_xmerl_xml_cb.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/src/docgen_xmerl_xml_cb.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_docgen/src/docgen_xml_check.erl erlang-17.3-dfsg/lib/erl_docgen/src/docgen_xml_check.erl --- erlang-18.2-dfsg/lib/erl_docgen/src/docgen_xml_check.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/src/docgen_xml_check.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999-2000, Ericsson diff -Nru erlang-18.2-dfsg/lib/erl_docgen/src/erl_docgen.app.src erlang-17.3-dfsg/lib/erl_docgen/src/erl_docgen.app.src --- erlang-18.2-dfsg/lib/erl_docgen/src/erl_docgen.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/src/erl_docgen.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -9,6 +9,6 @@ {registered,[]}, {applications, [kernel,stdlib]}, {env, []}, - {runtime_dependencies, ["xmerl-1.3.7","stdlib-2.5","edoc-0.7.13","erts-6.0"]} + {runtime_dependencies, ["xmerl-1.3.7","stdlib-2.0","edoc-0.7.13","erts-6.0"]} ] }. diff -Nru erlang-18.2-dfsg/lib/erl_docgen/src/erl_docgen.appup.src erlang-17.3-dfsg/lib/erl_docgen/src/erl_docgen.appup.src --- erlang-18.2-dfsg/lib/erl_docgen/src/erl_docgen.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/src/erl_docgen.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/erl_docgen/src/Makefile erlang-17.3-dfsg/lib/erl_docgen/src/Makefile --- erlang-18.2-dfsg/lib/erl_docgen/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_docgen/test/erl_docgen_SUITE.erl erlang-17.3-dfsg/lib/erl_docgen/test/erl_docgen_SUITE.erl --- erlang-18.2-dfsg/lib/erl_docgen/test/erl_docgen_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/test/erl_docgen_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/erl_docgen/vsn.mk erlang-17.3-dfsg/lib/erl_docgen/vsn.mk --- erlang-18.2-dfsg/lib/erl_docgen/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_docgen/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -ERL_DOCGEN_VSN = 0.4.1 +ERL_DOCGEN_VSN = 0.3.6 diff -Nru erlang-18.2-dfsg/lib/erl_interface/aclocal.m4 erlang-17.3-dfsg/lib/erl_interface/aclocal.m4 --- erlang-18.2-dfsg/lib/erl_interface/aclocal.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/aclocal.m4 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ dnl dnl %CopyrightBegin% dnl -dnl Copyright Ericsson AB 1998-2015. All Rights Reserved. +dnl Copyright Ericsson AB 1998-2013. All Rights Reserved. dnl -dnl Licensed under the Apache License, Version 2.0 (the "License"); -dnl you may not use this file except in compliance with the License. -dnl You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. +dnl +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. dnl dnl %CopyrightEnd% dnl @@ -61,6 +60,7 @@ dnl Cross compilation variables AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigaltstack, [have working sigaltstack(): yes|no (only used when cross compiling)]) @@ -142,18 +142,18 @@ AC_MSG_CHECKING(for mixed cygwin or msys and native VC++ environment) if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then - if test -x /usr/bin/msys-?.0.dll; then - CFLAGS="-O2" - MIXED_MSYS=yes - AC_MSG_RESULT([MSYS and VC]) - MIXED_MSYS_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" - elif test -x /usr/bin/cygpath; then + if test -x /usr/bin/cygpath; then CFLAGS="-O2" MIXED_CYGWIN=yes AC_MSG_RESULT([Cygwin and VC]) MIXED_CYGWIN_VC=yes CPPFLAGS="$CPPFLAGS -DERTS_MIXED_CYGWIN_VC" + elif test -x /usr/bin/msysinfo; then + CFLAGS="-O2" + MIXED_MSYS=yes + AC_MSG_RESULT([MSYS and VC]) + MIXED_MSYS_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" else AC_MSG_RESULT([undeterminable]) AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!) @@ -246,31 +246,31 @@ return 1; lbl2: return 2; -],ac_cv_prog_emu_cc="$CC",ac_cv_prog_emu_cc=no) +],ac_cv_prog_emu_cc=$CC,ac_cv_prog_emu_cc=no) -if test "$ac_cv_prog_emu_cc" = no; then +if test $ac_cv_prog_emu_cc = no; then for ac_progname in emu_cc.sh gcc-4.2 gcc; do IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_progname"; then - ac_cv_prog_emu_cc="$ac_dir/$ac_progname" + if test -f $ac_dir/$ac_progname; then + ac_cv_prog_emu_cc=$ac_dir/$ac_progname break fi done IFS="$ac_save_ifs" - if test "$ac_cv_prog_emu_cc" != no; then + if test $ac_cv_prog_emu_cc != no; then break fi done fi -if test "$ac_cv_prog_emu_cc" != no; then - save_CC="$CC" +if test $ac_cv_prog_emu_cc != no; then + save_CC=$CC save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS - CC="$ac_cv_prog_emu_cc" + CC=$ac_cv_prog_emu_cc CFLAGS="" CPPFLAGS="" AC_TRY_COMPILE([],[ @@ -291,17 +291,17 @@ return 1; lbl2: return 2; - ],ac_cv_prog_emu_cc="$CC",ac_cv_prog_emu_cc=no) + ],ac_cv_prog_emu_cc=$CC,ac_cv_prog_emu_cc=no) CC=$save_CC CFLAGS=$save_CFLAGS CPPFLAGS=$save_CPPFLAGS fi ]) -if test "$ac_cv_prog_emu_cc" = no; then +if test $ac_cv_prog_emu_cc = no; then AC_DEFINE(NO_JUMP_TABLE,[],[Defined if no found C compiler can handle jump tables]) - EMU_CC="$CC" + EMU_CC=$CC else - EMU_CC="$ac_cv_prog_emu_cc" + EMU_CC=$ac_cv_prog_emu_cc fi AC_SUBST(EMU_CC) ]) @@ -559,7 +559,7 @@ AC_DEFUN(LM_SYS_MULTICAST, [AC_CACHE_CHECK([for multicast support], ac_cv_sys_multicast_support, -[AC_EGREP_CPP(^yes$, +[AC_EGREP_CPP(yes, [#include #include #include @@ -724,250 +724,6 @@ ])# AC_C_DOUBLE_MIDDLE_ENDIAN -AC_DEFUN(ERL_MONOTONIC_CLOCK, -[ - if test "$3" = "yes"; then - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_BOOTTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_PRECISE" - else - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_UPTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_UPTIME_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_UPTIME_PRECISE" - fi - - case "$1" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_monotonic="$high_resolution_clock_gettime_monotonic" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_monotonic="$low_resolution_clock_gettime_monotonic" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_monotonic="$2" - ;; - *) - check_msg="custom " - prefer_resolution_clock_gettime_monotonic="$2" - ;; - esac - - AC_CACHE_CHECK([for clock_gettime(CLOCK_MONOTONIC_RAW, _)], erl_cv_clock_gettime_monotonic_raw, - [ - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_monotonic_raw=yes, - erl_cv_clock_gettime_monotonic_raw=no) - ]) - - AC_CACHE_CHECK([for clock_gettime() with ${check_msg}monotonic clock type], erl_cv_clock_gettime_monotonic_$1, - [ - for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_monotonic_$1=$clock_type, - erl_cv_clock_gettime_monotonic_$1=no) - test $erl_cv_clock_gettime_monotonic_$1 = no || break - done - ]) - - AC_CHECK_FUNCS([clock_getres clock_get_attributes gethrtime]) - - AC_CACHE_CHECK([for mach clock_get_time() with monotonic clock type], erl_cv_mach_clock_get_time_monotonic, - [ - AC_TRY_COMPILE([ -#include -#include - ], - [ - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - ], - erl_cv_mach_clock_get_time_monotonic=yes, - erl_cv_mach_clock_get_time_monotonic=no) - ]) - - erl_corrected_monotonic_clock=no - case $erl_cv_clock_gettime_monotonic_$1-$ac_cv_func_gethrtime-$erl_cv_mach_clock_get_time_monotonic-$host_os in - *-*-*-win32) - erl_monotonic_clock_func=WindowsAPI - ;; - CLOCK_*-*-*-linux*) - case $erl_cv_clock_gettime_monotonic_$1-$erl_cv_clock_gettime_monotonic_raw in - CLOCK_BOOTTIME-yes|CLOCK_MONOTONIC-yes) - erl_corrected_monotonic_clock=yes - ;; - *) - # We don't trust CLOCK_MONOTONIC to be NTP - # adjusted on linux systems that do not have - # CLOCK_MONOTONIC_RAW (although it seems to - # be...) - ;; - esac - erl_monotonic_clock_func=clock_gettime - ;; - no-no-no-linux*) - erl_monotonic_clock_func=times - ;; - CLOCK_*-*-*-*) - erl_monotonic_clock_func=clock_gettime - ;; - no-yes-*-*) - erl_monotonic_clock_func=gethrtime - ;; - no-no-yes-*) - erl_monotonic_clock_func=mach_clock_get_time - ;; - no-no-no-*) - erl_monotonic_clock_func=none - ;; - esac - - erl_monotonic_clock_low_resolution=no - erl_monotonic_clock_lib= - erl_monotonic_clock_id= - case $erl_monotonic_clock_func in - clock_gettime) - erl_monotonic_clock_id=$erl_cv_clock_gettime_monotonic_$1 - for low_res_id in $low_resolution_clock_gettime_monotonic; do - if test $erl_monotonic_clock_id = $low_res_id; then - erl_monotonic_clock_low_resolution=yes - break - fi - done - AC_CHECK_LIB(rt, clock_gettime, [erl_monotonic_clock_lib="-lrt"]) - ;; - mach_clock_get_time) - erl_monotonic_clock_id=SYSTEM_CLOCK - ;; - times) - erl_monotonic_clock_low_resolution=yes - ;; - *) - ;; - esac - -]) - -AC_DEFUN(ERL_WALL_CLOCK, -[ - default_resolution_clock_gettime_wall="CLOCK_REALTIME" - low_resolution_clock_gettime_wall="CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST" - high_resolution_clock_gettime_wall="CLOCK_REALTIME_PRECISE" - - case "$1" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_wall="$high_resolution_clock_gettime_wall" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_wall="$low_resolution_clock_gettime_wall" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_wall="$2" - ;; - *) - check_msg="" - prefer_resolution_clock_gettime_wall= - ;; - esac - - AC_CACHE_CHECK([for clock_gettime() with ${check_msg}wall clock type], erl_cv_clock_gettime_wall_$1, - [ - for clock_type in $prefer_resolution_clock_gettime_wall $default_resolution_clock_gettime_wall $high_resolution_clock_gettime_wall $low_resolution_clock_gettime_wall; do - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_wall_$1=$clock_type, - erl_cv_clock_gettime_wall_$1=no) - test $erl_cv_clock_gettime_wall_$1 = no || break - done - ]) - - AC_CHECK_FUNCS([clock_getres clock_get_attributes gettimeofday]) - - AC_CACHE_CHECK([for mach clock_get_time() with wall clock type], erl_cv_mach_clock_get_time_wall, - [ - AC_TRY_COMPILE([ -#include -#include - ], - [ - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - ], - erl_cv_mach_clock_get_time_wall=yes, - erl_cv_mach_clock_get_time_wall=no) - ]) - - erl_wall_clock_low_resolution=no - erl_wall_clock_id= - case $1-$erl_cv_clock_gettime_wall_$1-$erl_cv_mach_clock_get_time_wall-$ac_cv_func_gettimeofday-$host_os in - *-*-*-*-win32) - erl_wall_clock_func=WindowsAPI - erl_wall_clock_low_resolution=yes - ;; - high_resolution-no-yes-*-*) - erl_wall_clock_func=mach_clock_get_time - erl_wall_clock_id=CALENDAR_CLOCK - ;; - *-CLOCK_*-*-*-*) - erl_wall_clock_func=clock_gettime - erl_wall_clock_id=$erl_cv_clock_gettime_wall_$1 - for low_res_id in $low_resolution_clock_gettime_wall; do - if test $erl_wall_clock_id = $low_res_id; then - erl_wall_clock_low_resolution=yes - break - fi - done - ;; - *-no-*-yes-*) - erl_wall_clock_func=gettimeofday - ;; - *) - erl_wall_clock_func=none - ;; - esac -]) - dnl ---------------------------------------------------------------------- dnl dnl LM_CHECK_THR_LIB @@ -1152,226 +908,24 @@ ]) -AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OP__, -[ - # $1 - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]]" - case $1 in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, __ATOMIC_RELAXED); res = $1(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = $1(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = $1(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - AC_MSG_ERROR([Internal error: missing implementation for $1]) - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - AC_CACHE_CHECK([for 32-bit $1()], ethr_cv_32bit_$1, - [ - ethr_cv_32bit_$1=no - AC_TRY_LINK([], [$atomic32_call], [ethr_cv_32bit_$1=yes]) - ]) - AC_CACHE_CHECK([for 64-bit $1()], ethr_cv_64bit_$1, - [ - ethr_cv_64bit_$1=no - AC_TRY_LINK([], [$atomic64_call], [ethr_cv_64bit_$1=yes]) - ]) - AC_CACHE_CHECK([for 128-bit $1()], ethr_cv_128bit_$1, - [ - ethr_cv_128bit_$1=no - AC_TRY_LINK([], [$atomic128_call], [ethr_cv_128bit_$1=yes]) - ]) - - case $ethr_cv_128bit_$1-$ethr_cv_64bit_$1-$ethr_cv_32bit_$1 in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - AC_DEFINE_UNQUOTED([ETHR_HAVE_$1], [$have_atomic_ops], [Define as a bitmask corresponding to the word sizes that $1() can handle on your system]) -]) - -AC_DEFUN(ETHR_CHK_IF_NOOP, +AC_DEFUN(ETHR_CHK_SYNC_OP, [ - ethr_test_filename="chk_if_$1$3_noop_config1test.$$" - cat > "${ethr_test_filename}.c" < "${ethr_test_filename}.c" </dev/null 2>&1; then - ethr_$1$3_noop=yes - else - ethr_$1$3_noop=no - fi - rm -f "${ethr_test_filename}.c" "${ethr_test_filename}1.o" "${ethr_test_filename}2.o" -]) - -AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OPS, -[ - AC_CHECK_SIZEOF(short) - AC_CHECK_SIZEOF(int) - AC_CHECK_SIZEOF(long) - AC_CHECK_SIZEOF(long long) - AC_CHECK_SIZEOF(__int128_t) - - if test "$ac_cv_sizeof_short" = "4"; then - gcc_atomic_type32="short" - elif test "$ac_cv_sizeof_int" = "4"; then - gcc_atomic_type32="int" - elif test "$ac_cv_sizeof_long" = "4"; then - gcc_atomic_type32="long" - else - AC_MSG_ERROR([No 32-bit type found]) - fi - - if test "$ac_cv_sizeof_int" = "8"; then - gcc_atomic_type64="int" - elif test "$ac_cv_sizeof_long" = "8"; then - gcc_atomic_type64="long" - elif test "$ac_cv_sizeof_long_long" = "8"; then - gcc_atomic_type64="long long" - else - AC_MSG_ERROR([No 64-bit type found]) - fi - - if test "$ac_cv_sizeof___int128_t" = "16"; then - gcc_atomic_type128="__int128_t" - else - gcc_atomic_type128="#error " - fi - AC_CACHE_CHECK([for a working __sync_synchronize()], ethr_cv___sync_synchronize, - [ - ethr_cv___sync_synchronize=no - AC_TRY_LINK([], - [ __sync_synchronize(); ], - [ethr_cv___sync_synchronize=yes]) - if test $ethr_cv___sync_synchronize = yes; then - # - # Old gcc versions on at least x86 have a buggy - # __sync_synchronize() which does not emit a - # memory barrier. We try to detect this by - # compiling to assembly with and without - # __sync_synchronize() and compare the results. - # - ETHR_CHK_IF_NOOP(__sync_synchronize, [()], []) - if test $ethr___sync_synchronize_noop = yes; then - # Got a buggy implementation of - # __sync_synchronize... - ethr_cv___sync_synchronize="no; buggy implementation" - fi - fi - ]) - - if test "$ethr_cv___sync_synchronize" = "yes"; then - have_sync_synchronize_value="~0" - else - have_sync_synchronize_value="0" - fi - AC_DEFINE_UNQUOTED([ETHR_HAVE___sync_synchronize], [$have_sync_synchronize_value], [Define as a bitmask corresponding to the word sizes that __sync_synchronize() can handle on your system]) - - ETHR_CHK_GCC_ATOMIC_OP__(__sync_add_and_fetch) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_fetch_and_and) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_fetch_and_or) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_val_compare_and_swap) - - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_store_n) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_load_n) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_add_fetch) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_fetch_and) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_fetch_or) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_compare_exchange_n) - - ethr_have_gcc_native_atomics=no - ethr_arm_dbm_instr_val=0 - case "$GCC-$host_cpu" in - yes-arm*) - AC_CACHE_CHECK([for ARM DMB instruction], ethr_cv_arm_dbm_instr, - [ - ethr_cv_arm_dbm_instr=no - AC_TRY_LINK([], - [ - __asm__ __volatile__("dmb sy" : : : "memory"); - __asm__ __volatile__("dmb st" : : : "memory"); - ], - [ethr_cv_arm_dbm_instr=yes]) - ]) - if test $ethr_cv_arm_dbm_instr = yes; then - ethr_arm_dbm_instr_val=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi;; - *) - ;; + AC_MSG_CHECKING([for $3-bit $1()]) + case "$2" in + "1") sync_call="$1(&var);";; + "2") sync_call="$1(&var, ($4) 0);";; + "3") sync_call="$1(&var, ($4) 0, ($4) 0);";; esac - AC_DEFINE_UNQUOTED([ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION], [$ethr_arm_dbm_instr_val], [Define as a boolean indicating whether you have a gcc compatible compiler capable of generating the ARM DMB instruction, and are compiling for an ARM processor with ARM DMB instruction support, or not]) - test $ethr_cv_32bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_64bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - if test "$ethr_cv___sync_synchronize" = "yes"; then - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi - ethr_have_gcc_atomic_builtins=0 - if test $ethr_have_gcc_native_atomics = yes; then - ethr_native_atomic_implementation=gcc_sync - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_have_gcc_atomic_builtins = 1 && ethr_native_atomic_implementation=gcc_atomic_sync - fi - AC_DEFINE_UNQUOTED([ETHR_HAVE_GCC___ATOMIC_BUILTINS], [$ethr_have_gcc_atomic_builtins], [Define as a boolean indicating whether you have a gcc __atomic builtins or not]) - test $ethr_have_gcc_native_atomics = yes && ethr_have_native_atomics=yes + have_sync_op=no + AC_TRY_LINK([], + [ + $4 res; + volatile $4 var; + res = $sync_call + ], + [have_sync_op=yes]) + test $have_sync_op = yes && $5 + AC_MSG_RESULT([$have_sync_op]) ]) AC_DEFUN(ETHR_CHK_INTERLOCKED, @@ -1451,16 +1005,6 @@ test $enable_prefer_gcc_native_ethr_impls = yes && AC_DEFINE(ETHR_PREFER_GCC_NATIVE_IMPLS, 1, [Define if you prefer gcc native ethread implementations]) -AC_ARG_ENABLE(trust-gcc-atomic-builtins-memory-barriers, - AS_HELP_STRING([--enable-trust-gcc-atomic-builtins-memory-barriers], - [trust gcc atomic builtins memory barriers]), -[ case "$enableval" in - yes) trust_gcc_atomic_builtins_mbs=1 ;; - *) trust_gcc_atomic_builtins_mbs=0 ;; - esac ], trust_gcc_atomic_builtins_mbs=0) - -AC_DEFINE_UNQUOTED(ETHR_TRUST_GCC_ATOMIC_BUILTINS_MEMORY_BARRIERS, [$trust_gcc_atomic_builtins_mbs], [Define as a boolean indicating whether you trust gcc's __atomic_* builtins memory barrier implementations, or not]) - AC_ARG_WITH(libatomic_ops, AS_HELP_STRING([--with-libatomic_ops=PATH], [specify and prefer usage of libatomic_ops in the ethread library])) @@ -1472,33 +1016,12 @@ LM_CHECK_THR_LIB ERL_INTERNAL_LIBS -ERL_MONOTONIC_CLOCK(try_find_pthread_compatible, CLOCK_HIGHRES CLOCK_MONOTONIC, no) - -case $erl_monotonic_clock_func in - clock_gettime) - AC_DEFINE(ETHR_HAVE_CLOCK_GETTIME_MONOTONIC, [1], [Define if you have a clock_gettime() with a monotonic clock]) - ;; - mach_clock_get_time) - AC_DEFINE(ETHR_HAVE_MACH_CLOCK_GET_TIME, [1], [Define if you have a mach clock_get_time() with a monotonic clock]) - ;; - gethrtime) - AC_DEFINE(ETHR_HAVE_GETHRTIME, [1], [Define if you have a monotonic gethrtime()]) - ;; - *) - ;; -esac - -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(ETHR_MONOTONIC_CLOCK_ID, [$erl_monotonic_clock_id], [Define to the monotonic clock id to use]) -fi - -ethr_native_atomic_implementation=none ethr_have_native_atomics=no ethr_have_native_spinlock=no ETHR_THR_LIB_BASE="$THR_LIB_NAME" ETHR_THR_LIB_BASE_TYPE="$THR_LIB_TYPE" ETHR_DEFS="$THR_DEFS" -ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS $erl_monotonic_clock_lib" +ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS" ETHR_LIBS= ETHR_LIB_NAME= @@ -1577,10 +1100,7 @@ ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange128], [4], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE128, 1, [Define if you have _InterlockedCompareExchange128()])) fi - if test "$ethr_have_native_atomics" = "yes"; then - ethr_native_atomic_implementation=windows - ethr_have_native_spinlock=yes - fi + test "$ethr_have_native_atomics" = "yes" && ethr_have_native_spinlock=yes ;; pthread|ose_threads) @@ -1809,50 +1329,6 @@ AC_DEFINE(ETHR_HAVE_PTHREAD_ATTR_SETGUARDSIZE, 1, \ [Define if you have the pthread_attr_setguardsize function.])) - if test "x$erl_monotonic_clock_id" != "x"; then - AC_MSG_CHECKING(whether pthread_cond_timedwait() can use the monotonic clock $erl_monotonic_clock_id for timeout) - pthread_cond_timedwait_monotonic=no - AC_TRY_LINK([ - #if defined(ETHR_NEED_NPTL_PTHREAD_H) - # include - #elif defined(ETHR_HAVE_MIT_PTHREAD_H) - # include - #elif defined(ETHR_HAVE_PTHREAD_H) - # include - #endif - #ifdef ETHR_TIME_WITH_SYS_TIME - # include - # include - #else - # ifdef ETHR_HAVE_SYS_TIME_H - # include - # else - # include - # endif - #endif - #if defined(ETHR_HAVE_MACH_CLOCK_GET_TIME) - # include - # include - #endif - ], - [ - int res; - pthread_condattr_t attr; - pthread_cond_t cond; - struct timespec cond_timeout; - pthread_mutex_t mutex; - res = pthread_condattr_init(&attr); - res = pthread_condattr_setclock(&attr, ETHR_MONOTONIC_CLOCK_ID); - res = pthread_cond_init(&cond, &attr); - res = pthread_cond_timedwait(&cond, &mutex, &cond_timeout); - ], - [pthread_cond_timedwait_monotonic=yes]) - AC_MSG_RESULT([$pthread_cond_timedwait_monotonic]) - if test $pthread_cond_timedwait_monotonic = yes; then - AC_DEFINE(ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC, [1], [Define if pthread_cond_timedwait() can be used with a monotonic clock]) - fi - fi - linux_futex=no AC_MSG_CHECKING([for Linux futexes]) AC_TRY_LINK([ @@ -1873,62 +1349,56 @@ AC_MSG_RESULT([$linux_futex]) test $linux_futex = yes && AC_DEFINE(ETHR_HAVE_LINUX_FUTEX, 1, [Define if you have a linux futex implementation.]) - pthread_setname=no - AC_MSG_CHECKING([for pthread_setname_np]) - old_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Werror" - AC_TRY_LINK([#define __USE_GNU - #include ], - [pthread_setname_np(pthread_self(), "name");], - pthread_setname=linux) - AC_TRY_LINK([#define __USE_GNU - #include ], - [pthread_set_name_np(pthread_self(), "name");], - pthread_setname=bsd) - AC_TRY_LINK([#define _DARWIN_C_SOURCE - #include ], - [pthread_setname_np("name");], - pthread_setname=darwin) - AC_MSG_RESULT([$pthread_setname]) - case $pthread_setname in - linux) AC_DEFINE(ETHR_HAVE_PTHREAD_SETNAME_NP_2, 1, - [Define if you have linux style pthread_setname_np]);; - bsd) AC_DEFINE(ETHR_HAVE_PTHREAD_SET_NAME_NP_2, 1, - [Define if you have bsd style pthread_set_name_np]);; - darwin) AC_DEFINE(ETHR_HAVE_PTHREAD_SETNAME_NP_1, 1, - [Define if you have darwin style pthread_setname_np]);; - *) ;; - esac + fi - pthread_getname=no - AC_MSG_CHECKING([for pthread_getname_np]) - AC_TRY_LINK([#define __USE_GNU - #define _DARWIN_C_SOURCE - #include ], - [char buff[256]; pthread_getname_np(pthread_self(), buff, 256);], - pthread_getname=linux) - AC_TRY_LINK([#define __USE_GNU - #define _DARWIN_C_SOURCE - #include ], - [char buff[256]; pthread_getname_np(pthread_self(), buff);], - pthread_getname=ibm) - AC_MSG_RESULT([$pthread_getname]) - case $pthread_getname in - linux) AC_DEFINE(ETHR_HAVE_PTHREAD_GETNAME_NP_3, 1, - [Define if you have linux style pthread_getname_np]);; - ibm) AC_DEFINE(ETHR_HAVE_PTHREAD_GETNAME_NP_2, 1, - [Define if you have ibm style pthread_getname_np]);; - *) ;; - esac - CFLAGS=$old_CFLAGS + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(long) + AC_CHECK_SIZEOF(long long) + AC_CHECK_SIZEOF(__int128_t) + + if test "$ac_cv_sizeof_int" = "4"; then + int32="int" + elif test "$ac_cv_sizeof_long" = "4"; then + int32="long" + elif test "$ac_cv_sizeof_long_long" = "4"; then + int32="long long" + else + AC_MSG_ERROR([No 32-bit type found]) + fi - fi ## test "x$THR_LIB_NAME" = "xpthread" + if test "$ac_cv_sizeof_int" = "8"; then + int64="int" + elif test "$ac_cv_sizeof_long" = "8"; then + int64="long" + elif test "$ac_cv_sizeof_long_long" = "8"; then + int64="long long" + else + AC_MSG_ERROR([No 64-bit type found]) + fi + + int128=no + if test "$ac_cv_sizeof___int128_t" = "16"; then + int128="__int128_t" + fi if test "X$disable_native_ethr_impls" = "Xyes"; then ethr_have_native_atomics=no else + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32, 1, [Define if you have __sync_val_compare_and_swap() for 32-bit integers])) + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_SYNC_OP([__sync_add_and_fetch], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_ADD_AND_FETCH32, 1, [Define if you have __sync_add_and_fetch() for 32-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_and], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_AND32, 1, [Define if you have __sync_fetch_and_and() for 32-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_or], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_OR32, 1, [Define if you have __sync_fetch_and_or() for 32-bit integers])) + + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64, 1, [Define if you have __sync_val_compare_and_swap() for 64-bit integers])) + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_SYNC_OP([__sync_add_and_fetch], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_ADD_AND_FETCH64, 1, [Define if you have __sync_add_and_fetch() for 64-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_and], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_AND64, 1, [Define if you have __sync_fetch_and_and() for 64-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_or], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_OR64, 1, [Define if you have __sync_fetch_and_or() for 64-bit integers])) - ETHR_CHK_GCC_ATOMIC_OPS([]) + if test $int128 != no; then + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [128], [$int128], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP128, 1, [Define if you have __sync_val_compare_and_swap() for 128-bit integers])) + fi AC_MSG_CHECKING([for a usable libatomic_ops implementation]) case "x$with_libatomic_ops" in @@ -1951,34 +1421,11 @@ int z; AO_nop_full(); -#if defined(AO_HAVE_store) AO_store(&x, (AO_t) 0); -#elif defined(AO_HAVE_store_release) - AO_store_release(&x, (AO_t) 0); -#else -#error No store -#endif -#if defined(AO_HAVE_load) z = AO_load(&x); -#elif defined(AO_HAVE_load_acquire) - z = AO_load_acquire(&x); -#else -#error No load -#endif -#if defined(AO_HAVE_compare_and_swap_full) z = AO_compare_and_swap_full(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap_release) - z = AO_compare_and_swap_release(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap_acquire) - z = AO_compare_and_swap_acquire(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap) - z = AO_compare_and_swap(&x, (AO_t) 0, (AO_t) 1); -#else -#error No compare_and_swap -#endif ], [ethr_have_native_atomics=yes - ethr_native_atomic_implementation=libatomic_ops ethr_have_libatomic_ops=yes]) AC_MSG_RESULT([$ethr_have_libatomic_ops]) if test $ethr_have_libatomic_ops = yes; then @@ -2010,19 +1457,15 @@ *) AC_MSG_ERROR([Unsupported Sparc memory order: $with_sparc_memory_order]);; esac - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; i86pc | i*86 | x86_64 | amd64) if test "$enable_x86_out_of_order" = "yes"; then AC_DEFINE(ETHR_X86_OUT_OF_ORDER, 1, [Define if x86/x86_64 out of order instructions should be synchronized]) fi - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; macppc | ppc | powerpc | "Power Macintosh") - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; tile) - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; *) ;; @@ -2195,233 +1638,109 @@ ]) + dnl ---------------------------------------------------------------------- dnl dnl ERL_TIME_CORRECTION dnl -dnl Check for primitives that can be used for implementing -dnl erts_os_monotonic_time() and erts_os_system_time() +dnl In the presence of a high resolution realtime timer Erlang can adapt +dnl its view of time relative to this timer. On solaris such a timer is +dnl available with the syscall gethrtime(). On other OS's a fallback +dnl solution using times() is implemented. (However on e.g. FreeBSD times() +dnl is implemented using gettimeofday so it doesn't make much sense to +dnl use it there...) On second thought, it seems to be safer to do it the +dnl other way around. I.e. only use times() on OS's where we know it will +dnl work... dnl AC_DEFUN(ERL_TIME_CORRECTION, -[ - -AC_ARG_WITH(clock-resolution, -AS_HELP_STRING([--with-clock-resolution=high|low|default], - [specify wanted clock resolution])) - -AC_ARG_WITH(clock-gettime-realtime-id, -AS_HELP_STRING([--with-clock-gettime-realtime-id=CLOCKID], - [specify clock id to use with clock_gettime() for realtime time)])) - -AC_ARG_WITH(clock-gettime-monotonic-id, -AS_HELP_STRING([--with-clock-gettime-monotonic-id=CLOCKID], - [specify clock id to use with clock_gettime() for monotonic time)])) - -AC_ARG_ENABLE(prefer-elapsed-monotonic-time-during-suspend, -AS_HELP_STRING([--enable-prefer-elapsed-monotonic-time-during-suspend], - [Prefer an OS monotonic time source with elapsed time during suspend]) -AS_HELP_STRING([--disable-prefer-elapsed-monotonic-time-during-suspend], - [Do not prefer an OS monotonic time source with elapsed time during suspend]), -[ case "$enableval" in - yes) prefer_elapsed_monotonic_time_during_suspend=yes ;; - *) prefer_elapsed_monotonic_time_during_suspend=no ;; - esac ], prefer_elapsed_monotonic_time_during_suspend=no) - -AC_ARG_ENABLE(gettimeofday-as-os-system-time, - AS_HELP_STRING([--enable-gettimeofday-as-os-system-time], - [Force usage of gettimeofday() for OS system time]), -[ case "$enableval" in - yes) force_gettimeofday_os_system_time=yes ;; - *) force_gettimeofday_os_system_time=no ;; - esac ], force_gettimeofday_os_system_time=no) - -case "$with_clock_resolution" in - ""|no|yes) - with_clock_resolution=default;; - high|low|default) - ;; - *) - AC_MSG_ERROR([Invalid wanted clock resolution: $with_clock_resolution]) - ;; -esac - -if test "$force_gettimeofday_os_system_time" = "yes"; then - - AC_CHECK_FUNCS([gettimeofday]) - if test "$ac_cv_func_gettimeofday" = "yes"; then - AC_DEFINE(OS_SYSTEM_TIME_GETTIMEOFDAY, [1], [Define if you want to implement erts_os_system_time() using gettimeofday()]) - else - AC_MSG_ERROR([No gettimeofday() available]) - fi - -else # $force_gettimeofday_os_system_time != yes - -case "$with_clock_gettime_realtime_id" in - ""|no) - with_clock_gettime_realtime_id=no - ;; - CLOCK_*CPUTIME*) - AC_MSG_ERROR([Invalid clock_gettime() realtime clock id: Refusing to use the cputime clock id $with_clock_gettime_realtime_id as realtime clock id]) - ;; - CLOCK_MONOTONIC*|CLOCK_BOOTTIME*|CLOCK_UPTIME*|CLOCK_HIGHRES*) - AC_MSG_ERROR([Invalid clock_gettime() realtime clock id: Refusing to use the monotonic clock id $with_clock_gettime_realtime_id as realtime clock id]) - ;; - CLOCK_*) - ;; - *) - AC_MSG_ERROR([Invalid clock_gettime() clock id: $with_clock_gettime_realtime_id]) - ;; -esac - -case "$with_clock_resolution-$with_clock_gettime_realtime_id" in - high-no) - ERL_WALL_CLOCK(high_resolution);; - low-no) - ERL_WALL_CLOCK(low_resolution);; - default-no) - ERL_WALL_CLOCK(default_resolution);; - *) - ERL_WALL_CLOCK(custom_resolution, $with_clock_gettime_realtime_id);; -esac - -case "$erl_wall_clock_func-$erl_wall_clock_id-$with_clock_gettime_realtime_id" in - *-*-no) - ;; - clock_gettime-$with_clock_gettime_realtime_id-$with_clock_gettime_realtime_id) - ;; - *) - AC_MSG_ERROR([$with_clock_gettime_realtime_id as clock id to clock_gettime() doesn't compile]) - ;; -esac - -case $erl_wall_clock_func in - none) - AC_MSG_ERROR([No wall clock source found]) - ;; - mach_clock_get_time) - AC_DEFINE(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_system_time() using mach clock_get_time()]) - ;; - clock_gettime) - AC_DEFINE(OS_SYSTEM_TIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_system_time() using clock_gettime()]) - ;; - gettimeofday) - AC_DEFINE(OS_SYSTEM_TIME_GETTIMEOFDAY, [1], [Define if you want to implement erts_os_system_time() using gettimeofday()]) - ;; - *) - ;; -esac - -if test "x$erl_wall_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(WALL_CLOCK_ID_STR, ["$erl_wall_clock_id"], [Define as a string of wall clock id to use]) - AC_DEFINE_UNQUOTED(WALL_CLOCK_ID, [$erl_wall_clock_id], [Define to wall clock id to use]) -fi - -fi # $force_gettimeofday_os_system_time != yes - -case "$with_clock_gettime_monotonic_id" in - ""|no) - with_clock_gettime_monotonic_id=no - ;; - CLOCK_*CPUTIME*) - AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the cputime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) - ;; - CLOCK_REALTIME*|CLOCK_TAI*) - AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the realtime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) - ;; - CLOCK_*) - ;; - *) - AC_MSG_ERROR([Invalid clock_gettime() clock id: $with_clock_gettime_monotonic_id]) - ;; -esac - -case "$with_clock_resolution-$with_clock_gettime_monotonic_id" in - high-no) - ERL_MONOTONIC_CLOCK(high_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - low-no) - ERL_MONOTONIC_CLOCK(low_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - default-no) - ERL_MONOTONIC_CLOCK(default_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - *) - ERL_MONOTONIC_CLOCK(custom_resolution, $with_clock_gettime_monotonic_id, $prefer_elapsed_monotonic_time_during_suspend);; -esac - -case "$erl_monotonic_clock_func-$erl_monotonic_clock_id-$with_clock_gettime_monotonic_id" in - *-*-no) - ;; - clock_gettime-$with_clock_gettime_monotonic_id-$with_clock_gettime_monotonic_id) - ;; - *) - AC_MSG_ERROR([$with_clock_gettime_monotonic_id as clock id to clock_gettime() doesn't compile]) - ;; -esac - -case $erl_monotonic_clock_func in - times) - AC_DEFINE(OS_MONOTONIC_TIME_USING_TIMES, [1], [Define if you want to implement erts_os_monotonic_time() using times()]) - ;; - mach_clock_get_time) - AC_DEFINE(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_monotonic_time() using mach clock_get_time()]) - ;; - clock_gettime) - AC_DEFINE(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_monotonic_time() using clock_gettime()]) - ;; - gethrtime) - AC_DEFINE(OS_MONOTONIC_TIME_USING_GETHRTIME, [1], [Define if you want to implement erts_os_monotonic_time() using gethrtime()]) - ;; - *) - ;; -esac - -if test $erl_corrected_monotonic_clock = yes; then - AC_DEFINE(ERTS_HAVE_CORRECTED_OS_MONOTONIC_TIME, [1], [Define if OS monotonic clock is corrected]) -fi - -if test $erl_monotonic_clock_low_resolution = yes; then - AC_DEFINE(ERTS_HAVE_LOW_RESOLUTION_OS_MONOTONIC_LOW, [1], [Define if you have a low resolution OS monotonic clock]) -fi - -xrtlib="$erl_monotonic_clock_lib" -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(MONOTONIC_CLOCK_ID_STR, ["$erl_monotonic_clock_id"], [Define as a string of monotonic clock id to use]) - AC_DEFINE_UNQUOTED(MONOTONIC_CLOCK_ID, [$erl_monotonic_clock_id], [Define to monotonic clock id to use]) +[if test x$ac_cv_func_gethrtime = x; then + AC_CHECK_FUNC(gethrtime) fi - -if test $erl_cv_clock_gettime_monotonic_raw = yes; then - AC_DEFINE(HAVE_CLOCK_GETTIME_MONOTONIC_RAW, [1], [Define if you have clock_gettime(CLOCK_MONOTONIC_RAW, _)]) +if test x$clock_gettime_correction = xunknown; then + AC_TRY_COMPILE([#include ], + [struct timespec ts; + long long result; + clock_gettime(CLOCK_MONOTONIC,&ts); + result = ((long long) ts.tv_sec) * 1000000000LL + + ((long long) ts.tv_nsec);], + clock_gettime_compiles=yes, + clock_gettime_compiles=no) +else + clock_gettime_compiles=no fi + -ERL_MONOTONIC_CLOCK(high_resolution, undefined, no) +AC_CACHE_CHECK([how to correct for time adjustments], erl_cv_time_correction, +[ +case $clock_gettime_correction in + yes) + erl_cv_time_correction=clock_gettime;; + no|unknown) + case $ac_cv_func_gethrtime in + yes) + erl_cv_time_correction=hrtime ;; + no) + case $host_os in + linux*) + case $clock_gettime_correction in + unknown) + if test x$clock_gettime_compiles = xyes; then + if test X$cross_compiling != Xyes; then + linux_kernel_vsn_=`uname -r` + case $linux_kernel_vsn_ in + [[0-1]].*|2.[[0-5]]|2.[[0-5]].*) + erl_cv_time_correction=times ;; + *) + erl_cv_time_correction=clock_gettime;; + esac + else + case X$erl_xcomp_linux_clock_gettime_correction in + X) + erl_cv_time_correction=cross;; + Xyes|Xno) + if test $erl_xcomp_linux_clock_gettime_correction = yes; then + erl_cv_time_correction=clock_gettime + else + erl_cv_time_correction=times + fi;; + *) + AC_MSG_ERROR([Bad erl_xcomp_linux_clock_gettime_correction value: $erl_xcomp_linux_clock_gettime_correction]);; + esac + fi + else + erl_cv_time_correction=times + fi + ;; + *) + erl_cv_time_correction=times ;; + esac + ;; + *) + erl_cv_time_correction=none ;; + esac + ;; + esac + ;; +esac +]) -case $$erl_monotonic_clock_low_resolution-$erl_monotonic_clock_func in - no-mach_clock_get_time) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_hrtime() using mach clock_get_time()]) - ;; - no-clock_gettime) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_hrtime() using clock_gettime()]) - ;; - no-gethrtime) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_GETHRTIME, [1], [Define if you want to implement erts_os_hrtime() using gethrtime()]) +xrtlib="" +case $erl_cv_time_correction in + times) + AC_DEFINE(CORRECT_USING_TIMES,[], + [Define if you do not have a high-res. timer & want to use times() instead]) ;; - *) - monotonic_hrtime=no + clock_gettime|cross) + if test $erl_cv_time_correction = cross; then + erl_cv_time_correction=clock_gettime + AC_MSG_WARN([result clock_gettime guessed because of cross compilation]) + fi + xrtlib="-lrt" + AC_DEFINE(GETHRTIME_WITH_CLOCK_GETTIME,[1], + [Define if you want to use clock_gettime to simulate gethrtime]) ;; esac - -if test $monotonic_hrtime = yes; then - AC_DEFINE(HAVE_MONOTONIC_ERTS_SYS_HRTIME, [1], [Define if you have a monotonic erts_os_hrtime() implementation]) -fi - -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(HRTIME_CLOCK_ID_STR, ["$erl_monotonic_clock_id"], [Define as a string of monotonic clock id to use]) - AC_DEFINE_UNQUOTED(HRTIME_CLOCK_ID, [$erl_monotonic_clock_id], [Define to monotonic clock id to use]) -fi - - dnl dnl Check if gethrvtime is working, and if to use procfs ioctl dnl or (yet to be written) write to the procfs ctl file. @@ -2494,7 +1813,6 @@ esac ]) -LIBRT=$xrtlib case $erl_gethrvtime in procfs_ioctl) AC_DEFINE(HAVE_GETHRVTIME_PROCFS_IOCTL,[1], @@ -2541,33 +1859,43 @@ exit(0); return 0; } ], - erl_clock_gettime_cpu_time=yes, - erl_clock_gettime_cpu_time=no, + erl_clock_gettime=yes, + erl_clock_gettime=no, [ case X$erl_xcomp_clock_gettime_cpu_time in - X) erl_clock_gettime_cpu_time=cross;; - Xyes|Xno) erl_clock_gettime_cpu_time=$erl_xcomp_clock_gettime_cpu_time;; + X) erl_clock_gettime=cross;; + Xyes|Xno) erl_clock_gettime=$erl_xcomp_clock_gettime_cpu_time;; *) AC_MSG_ERROR([Bad erl_xcomp_clock_gettime_cpu_time value: $erl_xcomp_clock_gettime_cpu_time]);; esac ]) LIBS=$save_libs - AC_MSG_RESULT($erl_clock_gettime_cpu_time) - case $erl_clock_gettime_cpu_time in - yes) - AC_DEFINE(HAVE_CLOCK_GETTIME_CPU_TIME,[], - [define if clock_gettime() works for getting process time]) - LIBRT=-lrt - ;; - cross) - erl_clock_gettime_cpu_time=no - AC_MSG_WARN([result no guessed because of cross compilation]) + case $host_os in + linux*) + AC_MSG_RESULT([no; not stable]) + LIBRT=$xrtlib ;; *) + AC_MSG_RESULT($erl_clock_gettime) + case $erl_clock_gettime in + yes) + AC_DEFINE(HAVE_CLOCK_GETTIME,[], + [define if clock_gettime() works for getting process time]) + LIBRT=-lrt + ;; + cross) + erl_clock_gettime=no + AC_MSG_WARN([result no guessed because of cross compilation]) + LIBRT=$xrtlib + ;; + *) + LIBRT=$xrtlib + ;; + esac ;; esac + AC_SUBST(LIBRT) ;; esac -AC_SUBST(LIBRT) ])dnl dnl ---------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/erl_interface/configure erlang-17.3-dfsg/lib/erl_interface/configure --- erlang-18.2-dfsg/lib/erl_interface/configure 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/configure 2014-09-16 19:10:57.000000000 +0000 @@ -7501,20 +7501,20 @@ echo "$as_me:$LINENO: checking for mixed cygwin or msys and native VC++ environment" >&5 echo $ECHO_N "checking for mixed cygwin or msys and native VC++ environment... $ECHO_C" >&6 if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then - if test -x /usr/bin/msys-?.0.dll; then - CFLAGS="-O2" - MIXED_MSYS=yes - echo "$as_me:$LINENO: result: MSYS and VC" >&5 -echo "${ECHO_T}MSYS and VC" >&6 - MIXED_MSYS_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" - elif test -x /usr/bin/cygpath; then + if test -x /usr/bin/cygpath; then CFLAGS="-O2" MIXED_CYGWIN=yes echo "$as_me:$LINENO: result: Cygwin and VC" >&5 echo "${ECHO_T}Cygwin and VC" >&6 MIXED_CYGWIN_VC=yes CPPFLAGS="$CPPFLAGS -DERTS_MIXED_CYGWIN_VC" + elif test -x /usr/bin/msysinfo; then + CFLAGS="-O2" + MIXED_MSYS=yes + echo "$as_me:$LINENO: result: MSYS and VC" >&5 +echo "${ECHO_T}MSYS and VC" >&6 + MIXED_MSYS_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" else echo "$as_me:$LINENO: result: undeterminable" >&5 echo "${ECHO_T}undeterminable" >&6 diff -Nru erlang-18.2-dfsg/lib/erl_interface/configure.in erlang-17.3-dfsg/lib/erl_interface/configure.in --- erlang-18.2-dfsg/lib/erl_interface/configure.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/configure.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/book.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/book.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/ei_connect.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/ei_connect.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/ei_connect.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/ei_connect.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/ei_users_guide.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/ei_users_guide.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/ei_users_guide.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/ei_users_guide.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/ei.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/ei.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/ei.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/ei.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -203,9 +202,6 @@

    Encodes a double-precision (64 bit) floating point number in the binary format.

    -

    - The function returns if the floating point number is not finite. -

    diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_call.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_call.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_call.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_call.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_connect.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_connect.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_connect.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_connect.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_error.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_error.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_error.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_error.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_eterm.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_eterm.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_eterm.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_eterm.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -372,11 +371,9 @@

    is a value to be converted to an Erlang float.

    The function returns an Erlang float object with the value - specified in or if - is not finite. -

    + specified in .

    can be used to retrieve the - value from an Erlang float.

    + value from an Erlang float.

    diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_format.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_format.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_format.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_format.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_global.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_global.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_global.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_global.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_interface.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_interface.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_interface.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_interface.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_malloc.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_malloc.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_malloc.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_malloc.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_marshal.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_marshal.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/erl_marshal.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/erl_marshal.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/Makefile erlang-17.3-dfsg/lib/erl_interface/doc/src/Makefile --- erlang-18.2-dfsg/lib/erl_interface/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1998-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/notes_history.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/notes_history.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/notes.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/notes.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,93 +30,6 @@

    This document describes the changes made to the Erl_interface application.

    -
    Erl_Interface 3.8.1 - -
    Improvements and New Features - - -

    - Fix the conditional selection of gethostbyname_r and - gethostbyaddr_r.

    -

    - Own Id: OTP-13188

    -
    -
    -
    - -
    - -
    Erl_Interface 3.8 - -
    Improvements and New Features - - -

    - Do not accept Nan and Infinity values

    -

    - Erlang does not accept these values, so we return an - error in the C interface rather than letting them through - to the Erlang VM, which rejects the message with a - somewhat cryptic "bad external term".

    -

    - Own Id: OTP-12801

    -
    -
    -
    - -
    - -
    Erl_Interface 3.7.20 - -
    Fixed Bugs and Malfunctions - - -

    - Use C99 function isfinite() instead of finite() when - available on non GCC compilers.

    -

    - Own Id: OTP-12268

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Distribute autoconf helpers to applications at - build time instead of having multiple identical copies - committed in the repository.

    -

    - Own Id: OTP-12348

    -
    - -

    - Added an .appup file for the application.

    -

    - Own Id: OTP-12358 Aux Id: OTP-12178

    -
    -
    -
    - -
    - -
    Erl_Interface 3.7.19 - -
    Fixed Bugs and Malfunctions - - -

    - Added a .app file for the application.

    -

    - Own Id: OTP-12178

    -
    -
    -
    - -
    -
    Erl_Interface 3.7.18
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/part_erl_interface.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/part_erl_interface.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/part_erl_interface.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/part_erl_interface.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/part_notes_history.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/part_notes.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/part.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/part.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/ref_man_ei.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/ref_man_ei.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/ref_man_ei.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/ref_man_ei.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/ref_man_erl_interface.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/ref_man_erl_interface.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/ref_man_erl_interface.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/ref_man_erl_interface.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/ref_man.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. Erl_Interface Command Reference diff -Nru erlang-18.2-dfsg/lib/erl_interface/doc/src/registry.xml erlang-17.3-dfsg/lib/erl_interface/doc/src/registry.xml --- erlang-18.2-dfsg/lib/erl_interface/doc/src/registry.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/doc/src/registry.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/erl_interface/include/eicode.h erlang-17.3-dfsg/lib/erl_interface/include/eicode.h --- erlang-18.2-dfsg/lib/erl_interface/include/eicode.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/include/eicode.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/include/ei_connect.h erlang-17.3-dfsg/lib/erl_interface/include/ei_connect.h --- erlang-18.2-dfsg/lib/erl_interface/include/ei_connect.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/include/ei_connect.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/include/ei.h erlang-17.3-dfsg/lib/erl_interface/include/ei.h --- erlang-18.2-dfsg/lib/erl_interface/include/ei.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/include/ei.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/include/erl_interface.h erlang-17.3-dfsg/lib/erl_interface/include/erl_interface.h --- erlang-18.2-dfsg/lib/erl_interface/include/erl_interface.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/include/erl_interface.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/Makefile erlang-17.3-dfsg/lib/erl_interface/Makefile --- erlang-18.2-dfsg/lib/erl_interface/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/auxdir/config.guess erlang-17.3-dfsg/lib/erl_interface/src/auxdir/config.guess --- erlang-18.2-dfsg/lib/erl_interface/src/auxdir/config.guess 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/auxdir/config.guess 2014-09-16 19:10:57.000000000 +0000 @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2015 Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2015-03-04' +timestamp='2013-02-12' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # -# Please send patches to . +# Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2015 Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -132,27 +132,6 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - ;; -esac - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -168,27 +147,20 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || \ - echo unknown)` + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown - ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in - arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) + arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ @@ -204,13 +176,6 @@ os=netbsd ;; esac - # Determine ABI tags. - case "${UNAME_MACHINE_ARCH}" in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` - ;; - esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -227,7 +192,7 @@ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}${abi}" + echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -593,9 +558,8 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -841,7 +805,7 @@ *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - *:MSYS*:*) + i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -889,21 +853,21 @@ exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -916,57 +880,59 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + echo ${UNAME_MACHINE}-unknown-linux-gnueabi else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - e2k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -985,63 +951,57 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} + echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} + echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} + echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} + echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} + echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1274,31 +1234,19 @@ exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1389,6 +1337,154 @@ exit ;; esac +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + cat >&2 <. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -68,7 +68,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2015 Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,7 +117,7 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os @@ -252,20 +252,19 @@ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arceb \ + | arc \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ - | c4x | c8051 | clipper \ + | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ + | epiphany \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ @@ -283,10 +282,8 @@ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ @@ -298,11 +295,11 @@ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ + | open8 \ + | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ @@ -313,7 +310,6 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -328,10 +324,7 @@ c6x) basic_machine=tic6x-unknown ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -373,22 +366,21 @@ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ + | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ @@ -408,10 +400,8 @@ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ @@ -423,7 +413,6 @@ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ - | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ @@ -441,7 +430,6 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ - | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -518,9 +506,6 @@ basic_machine=i386-pc os=-aros ;; - asmjs) - basic_machine=asmjs-unknown - ;; aux) basic_machine=m68k-apple os=-aux @@ -782,9 +767,6 @@ basic_machine=m68k-isi os=-sysv ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` - ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -812,7 +794,7 @@ os=-mingw64 ;; mingw32) - basic_machine=i686-pc + basic_machine=i386-pc os=-mingw32 ;; mingw32ce) @@ -840,10 +822,6 @@ basic_machine=powerpc-unknown os=-morphos ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; msdos) basic_machine=i386-pc os=-msdos @@ -852,7 +830,7 @@ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i686-pc + basic_machine=i386-pc os=-msys ;; mvs) @@ -1376,7 +1354,7 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* | -cloudabi* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ @@ -1389,14 +1367,14 @@ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1568,9 +1546,6 @@ c4x-* | tic4x-*) os=-coff ;; - c8051-*) - os=-elf - ;; hexagon-*) os=-elf ;; @@ -1614,6 +1589,9 @@ mips*-*) os=-elf ;; + or1k-*) + os=-elf + ;; or32-*) os=-coff ;; @@ -1808,3 +1786,4 @@ # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: + diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/connect/ei_connect.c erlang-17.3-dfsg/lib/erl_interface/src/connect/ei_connect.c --- erlang-18.2-dfsg/lib/erl_interface/src/connect/ei_connect.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/connect/ei_connect.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/connect/ei_connect_int.h erlang-17.3-dfsg/lib/erl_interface/src/connect/ei_connect_int.h --- erlang-18.2-dfsg/lib/erl_interface/src/connect/ei_connect_int.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/connect/ei_connect_int.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/connect/eirecv.c erlang-17.3-dfsg/lib/erl_interface/src/connect/eirecv.c --- erlang-18.2-dfsg/lib/erl_interface/src/connect/eirecv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/connect/eirecv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/connect/eirecv.h erlang-17.3-dfsg/lib/erl_interface/src/connect/eirecv.h --- erlang-18.2-dfsg/lib/erl_interface/src/connect/eirecv.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/connect/eirecv.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/connect/ei_resolve.c erlang-17.3-dfsg/lib/erl_interface/src/connect/ei_resolve.c --- erlang-18.2-dfsg/lib/erl_interface/src/connect/ei_resolve.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/connect/ei_resolve.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -601,16 +600,6 @@ return gethostbyaddr(addr, len, type); } -/* - * Imprecise way to select the actually available gethostbyname_r and - * gethostbyaddr_r. - * - * TODO: check this properly in configure.in - */ -#if (defined(__linux__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__)) - #define HAVE_GETHOSTBYADDR_R_8 1 -#endif - struct hostent *ei_gethostbyaddr_r(const char *addr, int length, int type, @@ -626,7 +615,7 @@ #ifndef HAVE_GETHOSTBYNAME_R return my_gethostbyaddr_r(addr,length,type,hostp,buffer,buflen,h_errnop); #else -#ifdef HAVE_GETHOSTBYADDR_R_8 +#if (defined(__GLIBC__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__)) struct hostent *result; gethostbyaddr_r(addr, length, type, hostp, buffer, buflen, &result, @@ -653,7 +642,7 @@ #ifndef HAVE_GETHOSTBYNAME_R return my_gethostbyname_r(name,hostp,buffer,buflen,h_errnop); #else -#ifdef HAVE_GETHOSTBYADDR_R_8 +#if (defined(__GLIBC__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__) || defined(__ANDROID__)) struct hostent *result; gethostbyname_r(name, hostp, buffer, buflen, &result, h_errnop); diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/connect/ei_resolve.h erlang-17.3-dfsg/lib/erl_interface/src/connect/ei_resolve.h --- erlang-18.2-dfsg/lib/erl_interface/src/connect/ei_resolve.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/connect/ei_resolve.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/connect/eisend.h erlang-17.3-dfsg/lib/erl_interface/src/connect/eisend.h --- erlang-18.2-dfsg/lib/erl_interface/src/connect/eisend.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/connect/eisend.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/connect/send.c erlang-17.3-dfsg/lib/erl_interface/src/connect/send.c --- erlang-18.2-dfsg/lib/erl_interface/src/connect/send.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/connect/send.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/connect/send_exit.c erlang-17.3-dfsg/lib/erl_interface/src/connect/send_exit.c --- erlang-18.2-dfsg/lib/erl_interface/src/connect/send_exit.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/connect/send_exit.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/connect/send_reg.c erlang-17.3-dfsg/lib/erl_interface/src/connect/send_reg.c --- erlang-18.2-dfsg/lib/erl_interface/src/connect/send_reg.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/connect/send_reg.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_atom.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_atom.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_atom.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_atom.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_big.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_big.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_big.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_big.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -151,9 +150,14 @@ #define INLINED_FP_CONVERSION 1 #endif +#ifdef USE_ISINF_ISNAN /* simulate finite() */ +# define finite(f) (!isinf(f) && !isnan(f)) +# define HAVE_FINITE +#endif + #ifdef NO_FPE_SIGNALS # define ERTS_FP_CHECK_INIT() do {} while (0) -# define ERTS_FP_ERROR(f, Action) if (!isfinite(f)) { Action; } else {} +# define ERTS_FP_ERROR(f, Action) if (!finite(f)) { Action; } else {} # define ERTS_SAVE_FP_EXCEPTION() # define ERTS_RESTORE_FP_EXCEPTION() #else diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_bignum.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_bignum.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_bignum.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_bignum.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_binary.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_binary.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_binary.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_binary.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_boolean.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_boolean.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_boolean.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_boolean.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_char.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_char.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_char.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_char.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_double.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_double.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_double.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_double.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_fun.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_fun.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_fun.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_fun.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_intlist.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_intlist.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_intlist.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_intlist.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_list_header.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_list_header.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_list_header.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_list_header.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_long.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_long.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_long.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_long.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_longlong.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_longlong.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_longlong.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_longlong.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_pid.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_pid.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_pid.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_pid.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_port.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_port.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_port.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_port.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_ref.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_ref.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_ref.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_ref.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_skip.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_skip.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_skip.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_skip.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_skip.h erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_skip.h --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_skip.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_skip.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_string.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_string.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_string.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_string.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_trace.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_trace.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_trace.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_trace.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_tuple_header.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_tuple_header.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_tuple_header.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_tuple_header.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_ulong.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_ulong.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_ulong.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_ulong.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_ulonglong.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_ulonglong.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_ulonglong.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_ulonglong.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_version.c erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_version.c --- erlang-18.2-dfsg/lib/erl_interface/src/decode/decode_version.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/decode/decode_version.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/eidefs.mk.in erlang-17.3-dfsg/lib/erl_interface/src/eidefs.mk.in --- erlang-18.2-dfsg/lib/erl_interface/src/eidefs.mk.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/eidefs.mk.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/eicode.h erlang-17.3-dfsg/lib/erl_interface/src/encode/eicode.h --- erlang-18.2-dfsg/lib/erl_interface/src/encode/eicode.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/eicode.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_atom.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_atom.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_atom.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_atom.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_big.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_big.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_big.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_big.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_bignum.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_bignum.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_bignum.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_bignum.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_binary.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_binary.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_binary.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_binary.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_boolean.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_boolean.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_boolean.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_boolean.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_char.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_char.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_char.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_char.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_double.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_double.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_double.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_double.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -22,24 +21,12 @@ #include "eidef.h" #include "eiext.h" #include "putget.h" -#if defined(HAVE_ISFINITE) -#include -#endif int ei_encode_double(char *buf, int *index, double p) { char *s = buf + *index; char *s0 = s; - /* Erlang does not handle Inf and NaN, so we return an error rather - * than letting the Erlang VM complain about a bad external - * term. */ -#if defined(HAVE_ISFINITE) - if(!isfinite(p)) { - return -1; - } -#endif - if (!buf) s += 9; else { diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_fun.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_fun.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_fun.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_fun.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_list_header.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_list_header.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_list_header.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_list_header.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_long.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_long.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_long.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_long.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_longlong.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_longlong.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_longlong.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_longlong.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_pid.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_pid.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_pid.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_pid.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_port.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_port.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_port.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_port.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_ref.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_ref.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_ref.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_ref.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_string.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_string.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_string.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_string.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_trace.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_trace.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_trace.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_trace.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_tuple_header.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_tuple_header.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_tuple_header.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_tuple_header.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_ulong.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_ulong.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_ulong.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_ulong.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_ulonglong.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_ulonglong.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_ulonglong.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_ulonglong.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_version.c erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_version.c --- erlang-18.2-dfsg/lib/erl_interface/src/encode/encode_version.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/encode/encode_version.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/epmd/ei_epmd.h erlang-17.3-dfsg/lib/erl_interface/src/epmd/ei_epmd.h --- erlang-18.2-dfsg/lib/erl_interface/src/epmd/ei_epmd.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/epmd/ei_epmd.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/epmd/epmd_port.c erlang-17.3-dfsg/lib/erl_interface/src/epmd/epmd_port.c --- erlang-18.2-dfsg/lib/erl_interface/src/epmd/epmd_port.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/epmd/epmd_port.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/epmd/epmd_publish.c erlang-17.3-dfsg/lib/erl_interface/src/epmd/epmd_publish.c --- erlang-18.2-dfsg/lib/erl_interface/src/epmd/epmd_publish.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/epmd/epmd_publish.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/epmd/epmd_unpublish.c erlang-17.3-dfsg/lib/erl_interface/src/epmd/epmd_unpublish.c --- erlang-18.2-dfsg/lib/erl_interface/src/epmd/epmd_unpublish.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/epmd/epmd_unpublish.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/erl_interface.app.src erlang-17.3-dfsg/lib/erl_interface/src/erl_interface.app.src --- erlang-18.2-dfsg/lib/erl_interface/src/erl_interface.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/erl_interface.app.src 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2014. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% This is an -*- erlang -*- file. -%% - -{application, erl_interface, - [ - {description, "Erl Interface"}, - {vsn, "%VSN%"}, - {modules, []}, - {registered, []}, - {applications, []}, - {env, []}, - {runtime_dependencies, []} - ] -}. diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/erl_interface.appup.src erlang-17.3-dfsg/lib/erl_interface/src/erl_interface.appup.src --- erlang-18.2-dfsg/lib/erl_interface/src/erl_interface.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/erl_interface.appup.src 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -%% -*- erlang -*- -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2014. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -{"%VSN%", [], []}. diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/decode_term.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/decode_term.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/decode_term.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/decode_term.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/encode_term.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/encode_term.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/encode_term.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/encode_term.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_config.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_config.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_config.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_config.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_connect.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_connect.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_connect.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_connect.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_connect.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_connect.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_connect.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_connect.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_error.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_error.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_error.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_error.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_error.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_error.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_error.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_error.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_eterm.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_eterm.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_eterm.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_eterm.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -27,9 +26,6 @@ #include #include #include -#if defined(HAVE_ISFINITE) -#include -#endif #include "ei_locking.h" #include "ei_resolve.h" @@ -129,15 +125,6 @@ { ETERM *ep; -#if defined(HAVE_ISFINITE) - /* Erlang does not handle Inf and NaN, so we return an error - * rather than letting the Erlang VM complain about a bad external - * term. */ - if(!isfinite(d)) { - return NULL; - } -#endif - ep = erl_alloc_eterm(ERL_FLOAT); ERL_COUNT(ep) = 1; ERL_FLOAT_VALUE(ep) = d; diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_eterm.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_eterm.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_eterm.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_eterm.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_fix_alloc.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_fix_alloc.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_fix_alloc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_fix_alloc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_fix_alloc.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_fix_alloc.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_fix_alloc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_fix_alloc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_format.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_format.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_format.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_format.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_format.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_format.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_format.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_format.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_global.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_global.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_global.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_global.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_internal.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_internal.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_internal.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_internal.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_malloc.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_malloc.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_malloc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_malloc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_malloc.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_malloc.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_malloc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_malloc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_marshal.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_marshal.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_marshal.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_marshal.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_marshal.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_marshal.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_marshal.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_marshal.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_resolve.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_resolve.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_resolve.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_resolve.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_timeout.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_timeout.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_timeout.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_timeout.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_timeout.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_timeout.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/erl_timeout.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/erl_timeout.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/global_names.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/global_names.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/global_names.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/global_names.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/global_register.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/global_register.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/global_register.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/global_register.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/global_unregister.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/global_unregister.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/global_unregister.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/global_unregister.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/global_whereis.c erlang-17.3-dfsg/lib/erl_interface/src/legacy/global_whereis.c --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/global_whereis.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/global_whereis.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/legacy/portability.h erlang-17.3-dfsg/lib/erl_interface/src/legacy/portability.h --- erlang-18.2-dfsg/lib/erl_interface/src/legacy/portability.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/legacy/portability.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/Makefile erlang-17.3-dfsg/lib/erl_interface/src/Makefile --- erlang-18.2-dfsg/lib/erl_interface/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/Makefile.in erlang-17.3-dfsg/lib/erl_interface/src/Makefile.in --- erlang-18.2-dfsg/lib/erl_interface/src/Makefile.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/Makefile.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -41,16 +40,6 @@ include $(ERL_TOP)/make/output.mk -EBINDIR=../ebin - -APP_FILE= erl_interface.app -APP_SRC= $(APP_FILE).src -APP_TARGET= $(EBINDIR)/$(APP_FILE) - -APPUP_FILE= erl_interface.appup -APPUP_SRC= $(APPUP_FILE).src -APPUP_TARGET= $(EBINDIR)/$(APPUP_FILE) - USING_MINGW=@MIXED_CYGWIN_MINGW@ USING_MSYS_VC==@MIXED_MSYS_VC@ USING_CYGWIN_VC==@MIXED_MSYS_VC@ @@ -223,9 +212,7 @@ TARGETS = \ $(OBJ_TARGETS) \ - $(EXE_TARGETS) \ - $(APP_TARGET) \ - $(APPUP_TARGET) + $(EXE_TARGETS) OBJ_TARGETS = \ $(MT_EILIB) \ @@ -254,9 +241,7 @@ ifeq ($USING_MINGW,yes) TARGETS = \ $(OBJ_TARGETS) \ - $(EXE_TARGETS) \ - $(APP_TARGET) \ - $(APPUP_TARGET) + $(EXE_TARGETS) OBJ_TARGETS = \ $(MD_EILIB) \ @@ -274,9 +259,7 @@ TARGETS = \ $(OBJ_TARGETS) \ - $(EXE_TARGETS) \ - $(APP_TARGET) \ - $(APPUP_TARGET) + $(EXE_TARGETS) OBJ_TARGETS = \ $(ST_EILIB) \ @@ -298,9 +281,7 @@ TARGETS = \ $(OBJ_TARGETS) \ - $(EXE_TARGETS) \ - $(APP_TARGET) \ - $(APPUP_TARGET) + $(EXE_TARGETS) OBJ_TARGETS = \ $(ST_EILIB) \ @@ -566,8 +547,6 @@ rm -f $(MDD_EIOBJECTS) $(MDD_ERLOBJECTS) $(MDD_EILIB) $(MDD_ERLLIB) rm -f $(ERL_CALL) rm -f $(FAKE_TARGETS) - rm -f $(APP_TARGET) - rm -f $(APPUP_TARGET) distclean: clean rm -f config.h config.log config.status configure @@ -618,17 +597,12 @@ # Create directories ########################################################################### -_create_dirs := $(shell mkdir -p $(EBINDIR) $(BINDIR) $(OBJDIR) $(ST_OBJDIR) $(MT_OBJDIR) $(MD_OBJDIR) $(MDD_OBJDIR)) +_create_dirs := $(shell mkdir -p $(BINDIR) $(OBJDIR) $(ST_OBJDIR) $(MT_OBJDIR) $(MD_OBJDIR) $(MDD_OBJDIR)) ########################################################################### # Special rules ########################################################################### -$(APP_TARGET): $(APP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(ERL_INTERFACE_VSN);' $< > $@ -$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(ERL_INTERFACE_VSN);' $< > $@ - ifeq ($(TARGET),win32) # Windows archive creation @@ -883,7 +857,6 @@ $(INSTALL_DIR) "$(RELSYSDIR)/include" $(INSTALL_DIR) "$(RELSYSDIR)/lib" $(INSTALL_DIR) "$(RELSYSDIR)/bin" - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" $(INSTALL_DIR) "$(RELSYSDIR)/src/auxdir" $(INSTALL_DIR) "$(RELSYSDIR)/src/connect" $(INSTALL_DIR) "$(RELSYSDIR)/src/decode" @@ -895,8 +868,6 @@ $(INSTALL_DIR) "$(RELSYSDIR)/src/registry" $(INSTALL_DIR) "$(RELEASE_PATH)/usr/include" $(INSTALL_DIR) "$(RELEASE_PATH)/usr/lib" - $(INSTALL_DATA) $(APP_TARGET) "$(RELSYSDIR)/ebin/$(APP_FILE)" - $(INSTALL_DATA) $(APPUP_TARGET) "$(RELSYSDIR)/ebin/$(APPUP_FILE)" $(INSTALL_DATA) $(HEADERS) "$(RELSYSDIR)/include" $(INSTALL_DATA) $(HEADERS) "$(RELEASE_PATH)/usr/include" $(INSTALL_DATA) $(OBJ_TARGETS) "$(RELSYSDIR)/lib" diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_compat.c erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_compat.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_compat.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_compat.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_decode_term.c erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_decode_term.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_decode_term.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_decode_term.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_decode_term.h erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_decode_term.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_decode_term.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_decode_term.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/eidef.h erlang-17.3-dfsg/lib/erl_interface/src/misc/eidef.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/eidef.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/eidef.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * @@ -42,27 +41,6 @@ typedef int socklen_t; #endif -#ifdef USE_ISINF_ISNAN /* simulate finite() */ -# define isfinite(f) (!isinf(f) && !isnan(f)) -# define HAVE_ISFINITE -#elif defined(__GNUC__) && defined(HAVE_FINITE) -/* We use finite in gcc as it emits assembler instead of - the function call that isfinite emits. The assembler is - significantly faster. */ -# ifdef isfinite -# undef isfinite -# endif -# define isfinite finite -# ifndef HAVE_ISFINITE -# define HAVE_ISFINITE -# endif -#elif defined(isfinite) && !defined(HAVE_ISFINITE) -# define HAVE_ISFINITE -#elif !defined(HAVE_ISFINITE) && defined(HAVE_FINITE) -# define isfinite finite -# define HAVE_ISFINITE -#endif - typedef unsigned char uint8; /* FIXME use configure */ typedef unsigned short uint16; typedef unsigned int uint32; diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/eiext.h erlang-17.3-dfsg/lib/erl_interface/src/misc/eiext.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/eiext.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/eiext.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_format.c erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_format.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_format.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_format.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_format.h erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_format.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_format.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_format.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_internal.h erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_internal.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_internal.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_internal.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_locking.c erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_locking.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_locking.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_locking.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_locking.h erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_locking.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_locking.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_locking.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_malloc.c erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_malloc.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_malloc.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_malloc.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_malloc.h erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_malloc.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_malloc.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_malloc.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_portio.c erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_portio.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_portio.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_portio.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_portio.h erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_portio.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_portio.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_portio.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_printterm.c erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_printterm.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_printterm.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_printterm.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_printterm.h erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_printterm.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_printterm.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_printterm.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_pthreads.c erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_pthreads.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_pthreads.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_pthreads.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_trace.c erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_trace.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_trace.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_trace.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_trace.h erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_trace.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_trace.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_trace.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_x_encode.c erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_x_encode.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_x_encode.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_x_encode.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_x_encode.h erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_x_encode.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/ei_x_encode.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/ei_x_encode.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/get_type.c erlang-17.3-dfsg/lib/erl_interface/src/misc/get_type.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/get_type.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/get_type.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/putget.h erlang-17.3-dfsg/lib/erl_interface/src/misc/putget.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/putget.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/putget.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/show_msg.c erlang-17.3-dfsg/lib/erl_interface/src/misc/show_msg.c --- erlang-18.2-dfsg/lib/erl_interface/src/misc/show_msg.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/show_msg.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/misc/show_msg.h erlang-17.3-dfsg/lib/erl_interface/src/misc/show_msg.h --- erlang-18.2-dfsg/lib/erl_interface/src/misc/show_msg.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/misc/show_msg.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/not_used/ei_send.c erlang-17.3-dfsg/lib/erl_interface/src/not_used/ei_send.c --- erlang-18.2-dfsg/lib/erl_interface/src/not_used/ei_send.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/not_used/ei_send.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/not_used/ei_send_reg.c erlang-17.3-dfsg/lib/erl_interface/src/not_used/ei_send_reg.c --- erlang-18.2-dfsg/lib/erl_interface/src/not_used/ei_send_reg.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/not_used/ei_send_reg.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/not_used/send_link.c erlang-17.3-dfsg/lib/erl_interface/src/not_used/send_link.c --- erlang-18.2-dfsg/lib/erl_interface/src/not_used/send_link.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/not_used/send_link.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/not_used/whereis.c erlang-17.3-dfsg/lib/erl_interface/src/not_used/whereis.c --- erlang-18.2-dfsg/lib/erl_interface/src/not_used/whereis.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/not_used/whereis.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/prog/ei_fake_prog.c erlang-17.3-dfsg/lib/erl_interface/src/prog/ei_fake_prog.c --- erlang-18.2-dfsg/lib/erl_interface/src/prog/ei_fake_prog.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/prog/ei_fake_prog.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/prog/erl_call.c erlang-17.3-dfsg/lib/erl_interface/src/prog/erl_call.c --- erlang-18.2-dfsg/lib/erl_interface/src/prog/erl_call.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/prog/erl_call.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1996-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/prog/erl_fake_prog.c erlang-17.3-dfsg/lib/erl_interface/src/prog/erl_fake_prog.c --- erlang-18.2-dfsg/lib/erl_interface/src/prog/erl_fake_prog.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/prog/erl_fake_prog.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/prog/erl_start.c erlang-17.3-dfsg/lib/erl_interface/src/prog/erl_start.c --- erlang-18.2-dfsg/lib/erl_interface/src/prog/erl_start.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/prog/erl_start.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/prog/erl_start.h erlang-17.3-dfsg/lib/erl_interface/src/prog/erl_start.h --- erlang-18.2-dfsg/lib/erl_interface/src/prog/erl_start.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/prog/erl_start.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_dohash.c erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_dohash.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_dohash.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_dohash.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_foreach.c erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_foreach.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_foreach.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_foreach.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_freetab.c erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_freetab.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_freetab.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_freetab.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash.h erlang-17.3-dfsg/lib/erl_interface/src/registry/hash.h --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_insert.c erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_insert.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_insert.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_insert.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_isprime.c erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_isprime.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_isprime.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_isprime.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_lookup.c erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_lookup.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_lookup.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_lookup.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_newtab.c erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_newtab.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_newtab.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_newtab.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_remove.c erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_remove.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_remove.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_remove.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_resize.c erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_resize.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_resize.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_resize.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_rlookup.c erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_rlookup.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/hash_rlookup.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/hash_rlookup.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_close.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_close.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_close.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_close.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_delete.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_delete.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_delete.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_delete.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_dirty.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_dirty.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_dirty.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_dirty.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_dump.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_dump.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_dump.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_dump.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_free.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_free.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_free.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_free.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_get.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_get.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_get.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_get.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_getf.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_getf.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_getf.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_getf.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_geti.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_geti.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_geti.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_geti.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_getp.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_getp.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_getp.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_getp.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_gets.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_gets.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_gets.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_gets.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg.h erlang-17.3-dfsg/lib/erl_interface/src/registry/reg.h --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_make.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_make.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_make.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_make.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_open.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_open.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_open.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_open.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_purge.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_purge.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_purge.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_purge.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_resize.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_resize.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_resize.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_resize.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_restore.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_restore.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_restore.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_restore.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_set.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_set.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_set.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_set.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_setf.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_setf.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_setf.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_setf.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_seti.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_seti.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_seti.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_seti.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_setp.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_setp.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_setp.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_setp.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_sets.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_sets.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_sets.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_sets.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_stat.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_stat.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_stat.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_stat.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_tabstat.c erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_tabstat.c --- erlang-18.2-dfsg/lib/erl_interface/src/registry/reg_tabstat.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/src/registry/reg_tabstat.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1998-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/ei_runner.c erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/ei_runner.c --- erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/ei_runner.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/ei_runner.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/ei_runner.h erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/ei_runner.h --- erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/ei_runner.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/ei_runner.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/gccifier.c erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/gccifier.c --- erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/gccifier.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/gccifier.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/gccifier.sh erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/gccifier.sh --- erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/gccifier.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/gccifier.sh 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2005-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/init_tc.erl erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/init_tc.erl --- erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/init_tc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/init_tc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2003-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2003-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/reclaim.h erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/reclaim.h --- erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/reclaim.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/reclaim.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/runner.c erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/runner.c --- erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/runner.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/runner.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/runner.h erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/runner.h --- erlang-18.2-dfsg/lib/erl_interface/test/all_SUITE_data/runner.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/all_SUITE_data/runner.h 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/ei_accept_test.c erlang-17.3-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/ei_accept_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/ei_accept_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/ei_accept_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/eiaccnode.c erlang-17.3-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/eiaccnode.c --- erlang-18.2-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/eiaccnode.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/eiaccnode.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_accept_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_accept_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/ei_accept_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/ei_accept_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_accept_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/ei_connect_test.c erlang-17.3-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/ei_connect_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/ei_connect_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/ei_connect_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/einode.c erlang-17.3-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/einode.c --- erlang-18.2-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/einode.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/einode.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_connect_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/ei_connect_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/ei_connect_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_connect_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2014. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_encode_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/ei_decode_test.c erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/ei_decode_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/ei_decode_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/ei_decode_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/ei_decode_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_decode_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/ei_encode_test.c erlang-17.3-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/ei_encode_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/ei_encode_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/ei_encode_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_encode_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_encode_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/ei_encode_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/ei_encode_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_encode_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -175,7 +174,7 @@ %% ######################################################################## %% -%% A "character" for us is an 8 bit integer, always positive, i.e. +%% A "character" for us is an 8 bit integer, alwasy positive, i.e. %% it is unsigned. %% FIXME maybe the API should change to use "unsigned char" to be clear?! diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_format_SUITE_data/ei_format_test.c erlang-17.3-dfsg/lib/erl_interface/test/ei_format_SUITE_data/ei_format_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/ei_format_SUITE_data/ei_format_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_format_SUITE_data/ei_format_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_format_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/ei_format_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/ei_format_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_format_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_format_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/ei_format_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/ei_format_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_format_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_format_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/ei_format_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/ei_format_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_format_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_print_SUITE_data/ei_print_test.c erlang-17.3-dfsg/lib/erl_interface/test/ei_print_SUITE_data/ei_print_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/ei_print_SUITE_data/ei_print_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_print_SUITE_data/ei_print_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_print_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/ei_print_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/ei_print_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_print_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_print_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/ei_print_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/ei_print_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_print_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_print_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/ei_print_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/ei_print_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_print_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/ei_tmo_test.c erlang-17.3-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/ei_tmo_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/ei_tmo_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/ei_tmo_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2003-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_tmo_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2003-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/ei_tmo_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/ei_tmo_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/ei_tmo_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/ei_tmo_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/erl_connect_test.c erlang-17.3-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/erl_connect_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/erl_connect_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/erl_connect_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_connect_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_connect_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/erl_connect_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/erl_connect_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_connect_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/cnode.c erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/cnode.c --- erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/cnode.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/cnode.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/eterm_test.c erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/eterm_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/eterm_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/eterm_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/print_term.c erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/print_term.c --- erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/print_term.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE_data/print_term.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/erl_eterm_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_eterm_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c erlang-17.3-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2002-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% * diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2002-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_ext_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2002-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_ext_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/erl_ext_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/erl_ext_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_ext_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_format_SUITE_data/format_test.c erlang-17.3-dfsg/lib/erl_interface/test/erl_format_SUITE_data/format_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/erl_format_SUITE_data/format_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_format_SUITE_data/format_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_format_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/erl_format_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/erl_format_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_format_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_format_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/erl_format_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/erl_format_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_format_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_format_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/erl_format_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/erl_format_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_format_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c erlang-17.3-dfsg/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2000-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_global_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/erl_global_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/erl_global_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_global_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_global_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/erl_global_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/erl_global_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_global_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_global_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/erl_global_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/erl_global_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_global_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_match_SUITE_data/Makefile.first erlang-17.3-dfsg/lib/erl_interface/test/erl_match_SUITE_data/Makefile.first --- erlang-18.2-dfsg/lib/erl_interface/test/erl_match_SUITE_data/Makefile.first 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_match_SUITE_data/Makefile.first 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_match_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/erl_match_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/erl_match_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_match_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_match_SUITE_data/match_test.c erlang-17.3-dfsg/lib/erl_interface/test/erl_match_SUITE_data/match_test.c --- erlang-18.2-dfsg/lib/erl_interface/test/erl_match_SUITE_data/match_test.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_match_SUITE_data/match_test.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1997-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/erl_match_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/erl_match_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/erl_match_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/erl_match_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/Makefile erlang-17.3-dfsg/lib/erl_interface/test/Makefile --- erlang-18.2-dfsg/lib/erl_interface/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/port_call_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/erl_interface/test/port_call_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/erl_interface/test/port_call_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/port_call_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/port_call_SUITE_data/port_call_drv.c erlang-17.3-dfsg/lib/erl_interface/test/port_call_SUITE_data/port_call_drv.c --- erlang-18.2-dfsg/lib/erl_interface/test/port_call_SUITE_data/port_call_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/port_call_SUITE_data/port_call_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2001-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/port_call_SUITE.erl erlang-17.3-dfsg/lib/erl_interface/test/port_call_SUITE.erl --- erlang-18.2-dfsg/lib/erl_interface/test/port_call_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/port_call_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/test/runner.erl erlang-17.3-dfsg/lib/erl_interface/test/runner.erl --- erlang-18.2-dfsg/lib/erl_interface/test/runner.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/test/runner.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/erl_interface/vsn.mk erlang-17.3-dfsg/lib/erl_interface/vsn.mk --- erlang-18.2-dfsg/lib/erl_interface/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/erl_interface/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1,2 +1,2 @@ -EI_VSN = 3.8.1 +EI_VSN = 3.7.18 ERL_INTERFACE_VSN = $(EI_VSN) diff -Nru erlang-18.2-dfsg/lib/et/doc/src/book.xml erlang-17.3-dfsg/lib/et/doc/src/book.xml --- erlang-18.2-dfsg/lib/et/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/doc/src/et_collector.xml erlang-17.3-dfsg/lib/et/doc/src/et_collector.xml --- erlang-18.2-dfsg/lib/et/doc/src/et_collector.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/et_collector.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/doc/src/et_desc.xmlsrc erlang-17.3-dfsg/lib/et/doc/src/et_desc.xmlsrc --- erlang-18.2-dfsg/lib/et/doc/src/et_desc.xmlsrc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/et_desc.xmlsrc 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/doc/src/et_examples.xmlsrc erlang-17.3-dfsg/lib/et/doc/src/et_examples.xmlsrc --- erlang-18.2-dfsg/lib/et/doc/src/et_examples.xmlsrc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/et_examples.xmlsrc 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/doc/src/et_intro.xml erlang-17.3-dfsg/lib/et/doc/src/et_intro.xml --- erlang-18.2-dfsg/lib/et/doc/src/et_intro.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/et_intro.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/doc/src/et_selector.xml erlang-17.3-dfsg/lib/et/doc/src/et_selector.xml --- erlang-18.2-dfsg/lib/et/doc/src/et_selector.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/et_selector.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/doc/src/et_tutorial.xmlsrc erlang-17.3-dfsg/lib/et/doc/src/et_tutorial.xmlsrc --- erlang-18.2-dfsg/lib/et/doc/src/et_tutorial.xmlsrc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/et_tutorial.xmlsrc 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/doc/src/et_viewer.xml erlang-17.3-dfsg/lib/et/doc/src/et_viewer.xml --- erlang-18.2-dfsg/lib/et/doc/src/et_viewer.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/et_viewer.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/doc/src/et.xml erlang-17.3-dfsg/lib/et/doc/src/et.xml --- erlang-18.2-dfsg/lib/et/doc/src/et.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/et.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/doc/src/files.mk erlang-17.3-dfsg/lib/et/doc/src/files.mk --- erlang-18.2-dfsg/lib/et/doc/src/files.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/files.mk 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2002-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/et/doc/src/Makefile erlang-17.3-dfsg/lib/et/doc/src/Makefile --- erlang-18.2-dfsg/lib/et/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2002-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/et/doc/src/notes.xml erlang-17.3-dfsg/lib/et/doc/src/notes.xml --- erlang-18.2-dfsg/lib/et/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -37,24 +36,6 @@ one section in this document. The title of each section is the version number of Event Tracer (ET).

    -
    ET 1.5.1 - -
    Fixed Bugs and Malfunctions - - -

    The et application must continue to use - erlang:now/0 in order to obtain timestamps that - are consistent with timestamps obtained from tracing. The - application has been updated to suppress the warning for - erlang:now/0.

    -

    - Own Id: OTP-12780

    -
    -
    -
    - -
    -
    ET 1.5
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/et/doc/src/part.xml erlang-17.3-dfsg/lib/et/doc/src/part.xml --- erlang-18.2-dfsg/lib/et/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/doc/src/ref_man.xml erlang-17.3-dfsg/lib/et/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/et/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/et/examples/et_demo.erl erlang-17.3-dfsg/lib/et/examples/et_demo.erl --- erlang-18.2-dfsg/lib/et/examples/et_demo.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/examples/et_demo.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/et/examples/Makefile erlang-17.3-dfsg/lib/et/examples/Makefile --- erlang-18.2-dfsg/lib/et/examples/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/examples/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2002-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/et/include/et.hrl erlang-17.3-dfsg/lib/et/include/et.hrl --- erlang-18.2-dfsg/lib/et/include/et.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/include/et.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/et/Makefile erlang-17.3-dfsg/lib/et/Makefile --- erlang-18.2-dfsg/lib/et/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2002-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/et/src/et.app.src erlang-17.3-dfsg/lib/et/src/et.app.src --- erlang-18.2-dfsg/lib/et/src/et.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/et.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/et/src/et.appup.src erlang-17.3-dfsg/lib/et/src/et.appup.src --- erlang-18.2-dfsg/lib/et/src/et.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/et.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/et/src/et_collector.erl erlang-17.3-dfsg/lib/et/src/et_collector.erl --- erlang-18.2-dfsg/lib/et/src/et_collector.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/et_collector.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -65,8 +64,6 @@ -export([init/1,terminate/2, code_change/3, handle_call/3, handle_cast/2, handle_info/2]). --compile([{nowarn_deprecated_function,[{erlang,now,0}]}]). - -include("et_internal.hrl"). -include("../include/et.hrl"). diff -Nru erlang-18.2-dfsg/lib/et/src/et.erl erlang-17.3-dfsg/lib/et/src/et.erl --- erlang-18.2-dfsg/lib/et/src/et.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/et.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/et/src/et_internal.hrl erlang-17.3-dfsg/lib/et/src/et_internal.hrl --- erlang-18.2-dfsg/lib/et/src/et_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/et_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/et/src/et_selector.erl erlang-17.3-dfsg/lib/et/src/et_selector.erl --- erlang-18.2-dfsg/lib/et/src/et_selector.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/et_selector.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,8 +28,6 @@ parse_event/2 ]). --compile([{nowarn_deprecated_function,[{erlang,now,0}]}]). - -include("../include/et.hrl"). %%---------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/et/src/et_viewer.erl erlang-17.3-dfsg/lib/et/src/et_viewer.erl --- erlang-18.2-dfsg/lib/et/src/et_viewer.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/et_viewer.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/et/src/et_wx_contents_viewer.erl erlang-17.3-dfsg/lib/et/src/et_wx_contents_viewer.erl --- erlang-18.2-dfsg/lib/et/src/et_wx_contents_viewer.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/et_wx_contents_viewer.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/et/src/et_wx_viewer.erl erlang-17.3-dfsg/lib/et/src/et_wx_viewer.erl --- erlang-18.2-dfsg/lib/et/src/et_wx_viewer.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/et_wx_viewer.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/et/src/Makefile erlang-17.3-dfsg/lib/et/src/Makefile --- erlang-18.2-dfsg/lib/et/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -66,7 +65,7 @@ # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += -pa $(ERL_TOP)/lib/et/ebin -I../include -Werror +ERL_COMPILE_FLAGS += -pa $(ERL_TOP)/lib/et/ebin -I../include # ---------------------------------------------------- # Special Build Targets diff -Nru erlang-18.2-dfsg/lib/et/src/modules.mk erlang-17.3-dfsg/lib/et/src/modules.mk --- erlang-18.2-dfsg/lib/et/src/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/src/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2001-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/et/subdirs.mk erlang-17.3-dfsg/lib/et/subdirs.mk --- erlang-18.2-dfsg/lib/et/subdirs.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/subdirs.mk 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2002-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/et/test/et_SUITE.erl erlang-17.3-dfsg/lib/et/test/et_SUITE.erl --- erlang-18.2-dfsg/lib/et/test/et_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/test/et_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/et/test/ett erlang-17.3-dfsg/lib/et/test/ett --- erlang-18.2-dfsg/lib/et/test/ett 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/test/ett 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/et/test/ett.erl erlang-17.3-dfsg/lib/et/test/ett.erl --- erlang-18.2-dfsg/lib/et/test/ett.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/test/ett.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/et/test/et_test_lib.erl erlang-17.3-dfsg/lib/et/test/et_test_lib.erl --- erlang-18.2-dfsg/lib/et/test/et_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/test/et_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/et/test/et_test_lib.hrl erlang-17.3-dfsg/lib/et/test/et_test_lib.hrl --- erlang-18.2-dfsg/lib/et/test/et_test_lib.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/test/et_test_lib.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/et/test/et_wx_SUITE.erl erlang-17.3-dfsg/lib/et/test/et_wx_SUITE.erl --- erlang-18.2-dfsg/lib/et/test/et_wx_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/test/et_wx_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/et/test/Makefile erlang-17.3-dfsg/lib/et/test/Makefile --- erlang-18.2-dfsg/lib/et/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/et/vsn.mk erlang-17.3-dfsg/lib/et/vsn.mk --- erlang-18.2-dfsg/lib/et/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/et/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -ET_VSN = 1.5.1 +ET_VSN = 1.5 diff -Nru erlang-18.2-dfsg/lib/eunit/doc/overview.edoc erlang-17.3-dfsg/lib/eunit/doc/overview.edoc --- erlang-18.2-dfsg/lib/eunit/doc/overview.edoc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/doc/overview.edoc 2014-09-16 19:10:57.000000000 +0000 @@ -569,9 +569,6 @@ ```?assertMatch({found, {fred, _}}, lookup(bloggs, Table))''' ```?assertMatch([X|_] when X > 0, binary_to_list(B))'''
    -
    `assertNotMatch(GuardedPattern, Expr)'
    -
    The inverse case of assertMatch, for convenience. -
    `assertEqual(Expect, Expr)'
    Evaluates the expressions `Expect' and `Expr' and compares the results for equality, if testing is enabled. If the values are not @@ -586,9 +583,6 @@ ```?assertEqual("b" ++ "a", lists:reverse("ab"))''' ```?assertEqual(foo(X), bar(Y))'''
    -
    `assertNotEqual(Unexpected, Expr)'
    -
    The inverse case of assertEqual, for convenience. -
    `assertException(ClassPattern, TermPattern, Expr)'
    `assertError(TermPattern, Expr)'
    `assertExit(TermPattern, Expr)'
    @@ -885,7 +879,7 @@ terminate. Note that if a timeout is set around a fixture, it includes the time for setup and cleanup, and if the timeout is triggered, the entire fixture is abruptly terminated (without running the -cleanup). The default timeout for an individual test is 5 seconds. +cleanup).
    `{inorder, Tests}'
    Runs the specified tests in strict order. Also see `{inparallel, Tests}'. By default, tests are neither marked as `inorder' or @@ -907,6 +901,7 @@ timeouts, etc.). To make the descriptions simpler, we first list some definitions: +
    Reference syntaxExampleScope
    `Module'{@link edoc_run}, `erl.lang.list'Global
    `Package.*'`erl.lang.*'Global
    `Function/Arity'`file/2'Within module
    `Module:Function/Arity'{@link edoc:application/2}Global
    `Type()'`filename()'Within module
    @@ -927,6 +922,7 @@
    `Setup'`() -> (R::any())'`Where'`local | spawn | {spawn, Node::atom()}'
    + (these are explained in more detail further below.) The following representations specify fixture handling for test sets: diff -Nru erlang-18.2-dfsg/lib/eunit/doc/src/book.xml erlang-17.3-dfsg/lib/eunit/doc/src/book.xml --- erlang-18.2-dfsg/lib/eunit/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/eunit/doc/src/Makefile erlang-17.3-dfsg/lib/eunit/doc/src/Makefile --- erlang-18.2-dfsg/lib/eunit/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # Ericsson AB, All Rights Reserved # # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson AB. # diff -Nru erlang-18.2-dfsg/lib/eunit/doc/src/notes.xml erlang-17.3-dfsg/lib/eunit/doc/src/notes.xml --- erlang-18.2-dfsg/lib/eunit/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -33,72 +32,6 @@

    This document describes the changes made to the EUnit application.

    -
    Eunit 2.2.12 - -
    Fixed Bugs and Malfunctions - - -

    - Small documentation fixes

    -

    - Own Id: OTP-13017

    -
    -
    -
    - -
    - -
    Eunit 2.2.11 - -
    Fixed Bugs and Malfunctions - - -

    - Improve success message when 2 tests have passed

    -

    - Own Id: OTP-12952

    -
    -
    -
    - -
    - -
    Eunit 2.2.10 - -
    Fixed Bugs and Malfunctions - - -

    The eunit application is now unicode safe.

    -

    - Own Id: OTP-11660

    -
    -
    -
    - -
    - -
    Eunit 2.2.9 - -
    Fixed Bugs and Malfunctions - - -

    - Make sure to install .hrl files when needed

    -

    - Own Id: OTP-12197

    -
    - -

    - Make sure the clean rule for ssh, ssl, eunit and otp_mibs - actually removes generated files.

    -

    - Own Id: OTP-12200

    -
    -
    -
    - -
    -
    Eunit 2.2.8
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/eunit/doc/src/part_notes.xml erlang-17.3-dfsg/lib/eunit/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/eunit/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/eunit/doc/src/part.xml erlang-17.3-dfsg/lib/eunit/doc/src/part.xml --- erlang-18.2-dfsg/lib/eunit/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/eunit/doc/src/ref_man.xml erlang-17.3-dfsg/lib/eunit/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/eunit/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/eunit/examples/Makefile erlang-17.3-dfsg/lib/eunit/examples/Makefile --- erlang-18.2-dfsg/lib/eunit/examples/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/examples/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/eunit/include/eunit.hrl erlang-17.3-dfsg/lib/eunit/include/eunit.hrl --- erlang-18.2-dfsg/lib/eunit/include/eunit.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/include/eunit.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -15,14 +15,11 @@ %% %% Copyright (C) 2004-2006 Mickaël Rémond, Richard Carlsson --ifndef(EUNIT_HRL). --define(EUNIT_HRL, true). - %% Including this file turns on testing and defines TEST, unless NOTEST %% is defined before the file is included. If both NOTEST and TEST are %% already defined, then TEST takes precedence, and NOTEST will become %% undefined. -%% +%% %% If NODEBUG is defined before this file is included, the debug macros %% are disabled, unless DEBUG is also defined, in which case NODEBUG %% will become undefined. NODEBUG also implies NOASSERT, unless testing @@ -34,10 +31,14 @@ %% even if NODEBUG is defined. If both ASSERT and NOASSERT are defined %% before the file is included, then ASSERT takes precedence, and NOASSERT %% will become undefined regardless of TEST. -%% +%% %% After including this file, EUNIT will be defined if and only if TEST %% is defined. +-ifndef(EUNIT_HRL). +-define(EUNIT_HRL, true). + + %% allow defining TEST to override NOTEST -ifdef(TEST). -undef(NOTEST). @@ -48,6 +49,13 @@ -undef(NODEBUG). -endif. +%% allow NODEBUG to imply NOASSERT, unless overridden below +-ifdef(NODEBUG). +-ifndef(NOASSERT). +-define(NOASSERT, true). +-endif. +-endif. + %% note that the main switch used within this file is NOTEST; however, %% both TEST and EUNIT may be used to check whether testing is enabled -ifndef(NOTEST). @@ -62,8 +70,10 @@ -undef(EUNIT). -endif. -%% include the assert macros; ASSERT overrides NOASSERT if defined --include_lib("stdlib/include/assert.hrl"). +%% allow ASSERT to override NOASSERT (regardless of TEST/NOTEST) +-ifdef(ASSERT). +-undef(NOASSERT). +-endif. %% Parse transforms for automatic exporting/stripping of test functions. %% (Note that although automatic stripping is convenient, it will make @@ -81,7 +91,7 @@ %% All macros should be available even if testing is turned off, and %% should preferably not require EUnit to be present at runtime. -%% +%% %% We must use fun-call wrappers ((fun () -> ... end)()) to avoid %% exporting local variables, and furthermore we only use variable names %% prefixed with "__", that hopefully will not be bound outside the fun. @@ -118,21 +128,209 @@ current_function)))). -endif. -%% General test macros +%% The plain assert macro should be defined to do nothing if this file +%% is included when debugging/testing is turned off. +-ifdef(NOASSERT). +-ifndef(assert). +-define(assert(BoolExpr),ok). +-endif. +-else. +%% The assert macro is written the way it is so as not to cause warnings +%% for clauses that cannot match, even if the expression is a constant. +-undef(assert). +-define(assert(BoolExpr), + begin + ((fun () -> + case (BoolExpr) of + true -> ok; + __V -> erlang:error({assertion_failed, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??BoolExpr)}, + {expected, true}, + {value, case __V of false -> __V; + _ -> {not_a_boolean,__V} + end}]}) + end + end)()) + end). +-endif. +-define(assertNot(BoolExpr), ?assert(not (BoolExpr))). -define(_test(Expr), {?LINE, fun () -> (Expr) end}). + -define(_assert(BoolExpr), ?_test(?assert(BoolExpr))). + -define(_assertNot(BoolExpr), ?_assert(not (BoolExpr))). + +%% This is mostly a convenience which gives more detailed reports. +%% Note: Guard is a guarded pattern, and can not be used for value. +-ifdef(NOASSERT). +-define(assertMatch(Guard, Expr), ok). +-else. +-define(assertMatch(Guard, Expr), + begin + ((fun () -> + case (Expr) of + Guard -> ok; + __V -> erlang:error({assertMatch_failed, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??Expr)}, + {pattern, (??Guard)}, + {value, __V}]}) + end + end)()) + end). +-endif. -define(_assertMatch(Guard, Expr), ?_test(?assertMatch(Guard, Expr))). + +%% This is the inverse case of assertMatch, for convenience. +-ifdef(NOASSERT). +-define(assertNotMatch(Guard, Expr), ok). +-else. +-define(assertNotMatch(Guard, Expr), + begin + ((fun () -> + __V = (Expr), + case __V of + Guard -> erlang:error({assertNotMatch_failed, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??Expr)}, + {pattern, (??Guard)}, + {value, __V}]}); + _ -> ok + end + end)()) + end). +-endif. -define(_assertNotMatch(Guard, Expr), ?_test(?assertNotMatch(Guard, Expr))). + +%% This is a convenience macro which gives more detailed reports when +%% the expected LHS value is not a pattern, but a computed value +-ifdef(NOASSERT). +-define(assertEqual(Expect, Expr), ok). +-else. +-define(assertEqual(Expect, Expr), + begin + ((fun (__X) -> + case (Expr) of + __X -> ok; + __V -> erlang:error({assertEqual_failed, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??Expr)}, + {expected, __X}, + {value, __V}]}) + end + end)(Expect)) + end). +-endif. -define(_assertEqual(Expect, Expr), ?_test(?assertEqual(Expect, Expr))). + +%% This is the inverse case of assertEqual, for convenience. +-ifdef(NOASSERT). +-define(assertNotEqual(Unexpected, Expr), ok). +-else. +-define(assertNotEqual(Unexpected, Expr), + begin + ((fun (__X) -> + case (Expr) of + __X -> erlang:error({assertNotEqual_failed, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??Expr)}, + {value, __X}]}); + _ -> ok + end + end)(Unexpected)) + end). +-endif. -define(_assertNotEqual(Unexpected, Expr), ?_test(?assertNotEqual(Unexpected, Expr))). + +%% Note: Class and Term are patterns, and can not be used for value. +%% Term can be a guarded pattern, but Class cannot. +-ifdef(NOASSERT). +-define(assertException(Class, Term, Expr), ok). +-else. +-define(assertException(Class, Term, Expr), + begin + ((fun () -> + try (Expr) of + __V -> erlang:error({assertException_failed, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??Expr)}, + {pattern, + "{ "++(??Class)++" , "++(??Term) + ++" , [...] }"}, + {unexpected_success, __V}]}) + catch + Class:Term -> ok; + __C:__T -> + erlang:error({assertException_failed, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??Expr)}, + {pattern, + "{ "++(??Class)++" , "++(??Term) + ++" , [...] }"}, + {unexpected_exception, + {__C, __T, + erlang:get_stacktrace()}}]}) + end + end)()) + end). +-endif. + +-define(assertError(Term, Expr), ?assertException(error, Term, Expr)). +-define(assertExit(Term, Expr), ?assertException(exit, Term, Expr)). +-define(assertThrow(Term, Expr), ?assertException(throw, Term, Expr)). + -define(_assertException(Class, Term, Expr), ?_test(?assertException(Class, Term, Expr))). -define(_assertError(Term, Expr), ?_assertException(error, Term, Expr)). -define(_assertExit(Term, Expr), ?_assertException(exit, Term, Expr)). -define(_assertThrow(Term, Expr), ?_assertException(throw, Term, Expr)). + +%% This is the inverse case of assertException, for convenience. +%% Note: Class and Term are patterns, and can not be used for value. +%% Both Class and Term can be guarded patterns. +-ifdef(NOASSERT). +-define(assertNotException(Class, Term, Expr), ok). +-else. +-define(assertNotException(Class, Term, Expr), + begin + ((fun () -> + try (Expr) of + _ -> ok + catch + __C:__T -> + case __C of + Class -> + case __T of + Term -> + erlang:error({assertNotException_failed, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??Expr)}, + {pattern, + "{ "++(??Class)++" , " + ++(??Term)++" , [...] }"}, + {unexpected_exception, + {__C, __T, + erlang:get_stacktrace() + }}]}); + _ -> ok + end; + _ -> ok + end + end + end)()) + end). +-endif. -define(_assertNotException(Class, Term, Expr), ?_test(?assertNotException(Class, Term, Expr))). @@ -166,18 +364,18 @@ -else. -define(assertCmdStatus(N, Cmd), begin - ((fun () -> - case ?_cmd_(Cmd) of - {(N), _} -> ok; - {__N, _} -> erlang:error({assertCmd_failed, - [{module, ?MODULE}, - {line, ?LINE}, - {command, (Cmd)}, - {expected_status,(N)}, - {status,__N}]}) - end - end)()) - end). + ((fun () -> + case ?_cmd_(Cmd) of + {(N), _} -> ok; + {__N, _} -> erlang:error({assertCmd_failed, + [{module, ?MODULE}, + {line, ?LINE}, + {command, (Cmd)}, + {expected_status,(N)}, + {status,__N}]}) + end + end)()) + end). -endif. -define(assertCmd(Cmd), ?assertCmdStatus(0, Cmd)). @@ -186,17 +384,17 @@ -else. -define(assertCmdOutput(T, Cmd), begin - ((fun () -> - case ?_cmd_(Cmd) of - {_, (T)} -> ok; - {_, __T} -> erlang:error({assertCmdOutput_failed, - [{module, ?MODULE}, - {line, ?LINE}, - {command,(Cmd)}, - {expected_output,(T)}, - {output,__T}]}) - end - end)()) + ((fun () -> + case ?_cmd_(Cmd) of + {_, (T)} -> ok; + {_, __T} -> erlang:error({assertCmdOutput_failed, + [{module, ?MODULE}, + {line, ?LINE}, + {command,(Cmd)}, + {expected_output,(T)}, + {output,__T}]}) + end + end)()) end). -endif. @@ -216,7 +414,7 @@ -else. -define(debugMsg(S), begin - io:fwrite(user, <<"~ts:~w:~w: ~ts\n">>, + io:fwrite(user, <<"~s:~w:~w: ~s\n">>, [?FILE, ?LINE, self(), S]), ok end). @@ -225,7 +423,7 @@ -define(debugVal(E), begin ((fun (__V) -> - ?debugFmt(<<"~ts = ~tP">>, [(??E), __V, 15]), + ?debugFmt(<<"~s = ~P">>, [(??E), __V, 15]), __V end)(E)) end). @@ -235,10 +433,11 @@ {__T0, _} = statistics(wall_clock), __V = (E), {__T1, _} = statistics(wall_clock), - ?debugFmt(<<"~ts: ~.3f s">>, [(S), (__T1-__T0)/1000]), + ?debugFmt(<<"~s: ~.3f s">>, [(S), (__T1-__T0)/1000]), __V end)()) end). -endif. + -endif. % EUNIT_HRL diff -Nru erlang-18.2-dfsg/lib/eunit/Makefile erlang-17.3-dfsg/lib/eunit/Makefile --- erlang-18.2-dfsg/lib/eunit/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit.app.src erlang-17.3-dfsg/lib/eunit/src/eunit.app.src --- erlang-18.2-dfsg/lib/eunit/src/eunit.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -19,4 +19,4 @@ {registered,[]}, {applications, [kernel,stdlib]}, {env, []}, - {runtime_dependencies, ["stdlib-2.5","kernel-3.0","erts-6.0"]}]}. + {runtime_dependencies, ["stdlib-2.0","kernel-3.0","erts-6.0"]}]}. diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit.appup.src erlang-17.3-dfsg/lib/eunit/src/eunit.appup.src --- erlang-18.2-dfsg/lib/eunit/src/eunit.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit_autoexport.erl erlang-17.3-dfsg/lib/eunit/src/eunit_autoexport.erl --- erlang-18.2-dfsg/lib/eunit/src/eunit_autoexport.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit_autoexport.erl 2014-09-16 19:10:57.000000000 +0000 @@ -79,12 +79,11 @@ rewrite([F | Fs], As, Module, Test) -> rewrite(Fs, [F | As], Module, Test); rewrite([], As, Module, Test) -> - L = erl_anno:new(0), {if Test -> - [{function,L,test,0, - [{clause,L,[],[], - [{call,L,{remote,L,{atom,L,eunit},{atom,L,test}}, - [{atom,L,Module}]}]}]} + [{function,0,test,0, + [{clause,0,[],[], + [{call,0,{remote,0,{atom,0,eunit},{atom,0,test}}, + [{atom,0,Module}]}]}]} | As]; true -> As @@ -97,4 +96,4 @@ Es = if Test -> [{test,0} | Exports]; true -> Exports end, - [M, {attribute,erl_anno:new(0),export,Es} | lists:reverse(Fs1)]. + [M, {attribute,0,export,Es} | lists:reverse(Fs1)]. diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit_data.erl erlang-17.3-dfsg/lib/eunit/src/eunit_data.erl --- erlang-18.2-dfsg/lib/eunit/src/eunit_data.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit_data.erl 2014-09-16 19:10:57.000000000 +0000 @@ -391,7 +391,7 @@ parse({S, T1} = T) when is_list(S) -> case eunit_lib:is_string(S) of true -> - group(#group{tests = T1, desc = unicode:characters_to_binary(S)}); + group(#group{tests = T1, desc = list_to_binary(S)}); false -> bad_test(T) end; diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit.erl erlang-17.3-dfsg/lib/eunit/src/eunit.erl --- erlang-18.2-dfsg/lib/eunit/src/eunit.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit.erl 2014-09-16 19:10:57.000000000 +0000 @@ -231,7 +231,7 @@ event_logger_loop(Reference, FD) -> receive {status, _Id, _Info}=Msg -> - io:fwrite(FD, "~tp.\n", [Msg]), + io:fwrite(FD, "~p.\n", [Msg]), event_logger_loop(Reference, FD); {stop, Reference, _ReplyTo} -> %% no need to reply, just exit diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit_internal.hrl erlang-17.3-dfsg/lib/eunit/src/eunit_internal.hrl --- erlang-18.2-dfsg/lib/eunit/src/eunit_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -14,8 +14,8 @@ -define(DEFAULT_MODULE_WRAPPER_NAME, eunit_wrapper_). -ifdef(DEBUG). --define(debugmsg(S),io:fwrite("\n* ~ts: ~ts\n", [?MODULE,S])). --define(debugmsg1(S,As),io:fwrite("\n* ~ts: " ++ S ++ "\n", [?MODULE] ++ As)). +-define(debugmsg(S),io:fwrite("\n* ~s: ~s\n", [?MODULE,S])). +-define(debugmsg1(S,As),io:fwrite("\n* ~s: " ++ S ++ "\n", [?MODULE] ++ As)). -else. -define(debugmsg(S),ok). -define(debugmsg1(S,As),ok). diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit_lib.erl erlang-17.3-dfsg/lib/eunit/src/eunit_lib.erl --- erlang-18.2-dfsg/lib/eunit/src/eunit_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -57,7 +57,7 @@ when is_atom(Class), is_list(Trace) -> case is_stacktrace(Trace) of true -> - io_lib:format("~ts**~w:~ts", + io_lib:format("~s**~w:~s", [format_stacktrace(Trace), Class, format_term(Term, Depth)]); false -> @@ -67,11 +67,11 @@ format_term(Term, Depth). format_term(Term, Depth) -> - io_lib:format("~tP\n", [Term, Depth]). + io_lib:format("~P\n", [Term, Depth]). format_exit_term(Term) -> {Reason, Trace} = analyze_exit_term(Term), - io_lib:format("~tP~ts", [Reason, 15, Trace]). + io_lib:format("~P~s", [Reason, 15, Trace]). analyze_exit_term({Reason, [_|_]=Trace}=Term) -> case is_stacktrace(Trace) of @@ -102,7 +102,7 @@ format_stacktrace(Trace, "in function", "in call from"). format_stacktrace([{M,F,A,L}|Fs], Pre, Pre1) when is_integer(A) -> - [io_lib:fwrite("~ts ~w:~w/~w~ts\n", + [io_lib:fwrite("~s ~w:~w/~w~s\n", [Pre, M, F, A, format_stacktrace_location(L)]) | format_stacktrace(Fs, Pre1, Pre1)]; format_stacktrace([{M,F,As,L}|Fs], Pre, Pre1) when is_list(As) -> @@ -110,15 +110,15 @@ C = case is_op(M,F,A) of true when A =:= 1 -> [A1] = As, - io_lib:fwrite("~ts ~ts", [F,format_arg(A1)]); + io_lib:fwrite("~s ~s", [F,format_arg(A1)]); true when A =:= 2 -> [A1, A2] = As, - io_lib:fwrite("~ts ~ts ~ts", + io_lib:fwrite("~s ~s ~s", [format_arg(A1),F,format_arg(A2)]); false -> - io_lib:fwrite("~w(~ts)", [F,format_arglist(As)]) + io_lib:fwrite("~w(~s)", [F,format_arglist(As)]) end, - [io_lib:fwrite("~ts ~w:~w/~w~ts\n called as ~ts\n", + [io_lib:fwrite("~s ~w:~w/~w~s\n called as ~s\n", [Pre,M,F,A,format_stacktrace_location(L),C]) | format_stacktrace(Fs,Pre1,Pre1)]; format_stacktrace([{M,F,As}|Fs], Pre, Pre1) -> @@ -130,18 +130,18 @@ File = proplists:get_value(file, Location), Line = proplists:get_value(line, Location), if File =/= undefined, Line =/= undefined -> - io_lib:format(" (~ts, line ~w)", [File, Line]); + io_lib:format(" (~s, line ~w)", [File, Line]); true -> "" end. format_arg(A) -> - io_lib:format("~tP",[A,15]). + io_lib:format("~P",[A,15]). format_arglist([A]) -> format_arg(A); format_arglist([A|As]) -> - [io_lib:format("~tP,",[A,15]) | format_arglist(As)]; + [io_lib:format("~P,",[A,15]) | format_arglist(As)]; format_arglist([]) -> "". @@ -155,41 +155,41 @@ false. format_error({bad_test, Term}) -> - error_msg("bad test descriptor", "~tP", [Term, 15]); + error_msg("bad test descriptor", "~P", [Term, 15]); format_error({bad_generator, {{M,F,A}, Term}}) -> error_msg(io_lib:format("result from generator ~w:~w/~w is not a test", [M,F,A]), - "~tP", [Term, 15]); + "~P", [Term, 15]); format_error({generator_failed, {{M,F,A}, Exception}}) -> error_msg(io_lib:format("test generator ~w:~w/~w failed",[M,F,A]), - "~ts", [format_exception(Exception)]); + "~s", [format_exception(Exception)]); format_error({no_such_function, {M,F,A}}) when is_atom(M), is_atom(F), is_integer(A) -> error_msg(io_lib:format("no such function: ~w:~w/~w", [M,F,A]), "", []); format_error({module_not_found, M}) -> - error_msg("test module not found", "~tp", [M]); + error_msg("test module not found", "~p", [M]); format_error({application_not_found, A}) when is_atom(A) -> error_msg("application not found", "~w", [A]); format_error({file_read_error, {_R, Msg, F}}) -> - error_msg("error reading file", "~ts: ~ts", [Msg, F]); + error_msg("error reading file", "~s: ~s", [Msg, F]); format_error({setup_failed, Exception}) -> - error_msg("context setup failed", "~ts", + error_msg("context setup failed", "~s", [format_exception(Exception)]); format_error({cleanup_failed, Exception}) -> - error_msg("context cleanup failed", "~ts", + error_msg("context cleanup failed", "~s", [format_exception(Exception)]); format_error({{bad_instantiator, {{M,F,A}, Term}}, _DummyException}) -> error_msg(io_lib:format("result from instantiator ~w:~w/~w is not a test", [M,F,A]), - "~tP", [Term, 15]); + "~P", [Term, 15]); format_error({instantiation_failed, Exception}) -> - error_msg("instantiation of subtests failed", "~ts", + error_msg("instantiation of subtests failed", "~s", [format_exception(Exception)]). error_msg(Title, Fmt, Args) -> Msg = io_lib:format("**"++Fmt, Args), % gets indentation right - io_lib:fwrite("*** ~ts ***\n~ts\n\n", [Title, Msg]). + io_lib:fwrite("*** ~s ***\n~s\n\n", [Title, Msg]). -ifdef(TEST). format_exception_test_() -> diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit_proc.erl erlang-17.3-dfsg/lib/eunit/src/eunit_proc.erl --- erlang-18.2-dfsg/lib/eunit/src/eunit_proc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit_proc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -230,7 +230,7 @@ message_super(Id, {progress, 'begin', {Type, Data}}, St), insulator_wait(Child, Parent, [[] | Buf], St); {child, Child, Id, {'end', Status, Time}} -> - Data = [{time, Time}, {output, lists:reverse(hd(Buf))}], + Data = [{time, Time}, {output, buffer_to_binary(hd(Buf))}], message_super(Id, {progress, 'end', {Status, Data}}, St), insulator_wait(Child, Parent, tl(Buf), St); {child, Child, Id, {skipped, Reason}} -> @@ -272,6 +272,9 @@ exit(Child, kill), terminate_insulator(St). +buffer_to_binary([B]) when is_binary(B) -> B; % avoid unnecessary copying +buffer_to_binary(Buf) -> list_to_binary(lists:reverse(Buf)). + %% Unlinking before exit avoids polluting the parent process with exit %% signals from the insulator. The child process is already dead here. @@ -594,7 +597,7 @@ %% no more messages and nothing to wait for; we ought to %% have collected all immediately pending output now process_flag(priority, normal), - Runner ! {self(), lists:reverse(Buf)} + Runner ! {self(), buffer_to_binary(Buf)} end. group_leader_sync(G) -> diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit_server.erl erlang-17.3-dfsg/lib/eunit/src/eunit_server.erl --- erlang-18.2-dfsg/lib/eunit/src/eunit_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -200,7 +200,7 @@ server(St#state{stopped = true}); server_command(From, {watch, Target, _Opts}, St) -> %% the code watcher is only started on demand - %% TODO: this is disabled for now + %% FIXME: this is disabled for now in the OTP distribution %%code_monitor:monitor(self()), %% TODO: propagate options to testing stage St1 = add_watch(Target, St), diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit_surefire.erl erlang-17.3-dfsg/lib/eunit/src/eunit_surefire.erl --- erlang-18.2-dfsg/lib/eunit/src/eunit_surefire.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit_surefire.erl 2014-09-16 19:10:57.000000000 +0000 @@ -203,9 +203,9 @@ testcases=[TestCase|TestSuite#testsuite.testcases] }, St#state{testsuites=store_suite(NewTestSuite, TestSuites)}. -format_name({Module, Function, _Arity}, Line) -> - lists:flatten([atom_to_list(Module), ":", integer_to_list(Line), " ", - atom_to_list(Function)]). +format_name({Module, Function, Arity}, Line) -> + lists:flatten([atom_to_list(Module), ":", atom_to_list(Function), "/", + integer_to_list(Arity), "_", integer_to_list(Line)]). format_desc(undefined) -> ""; format_desc(Desc) when is_binary(Desc) -> @@ -279,7 +279,7 @@ %% Write the XML header. %% ---------------------------------------------------------------------------- write_header(FileDescriptor) -> - io:format(FileDescriptor, "~ts~ts", [<<"">>, ?NEWLINE]). + file:write(FileDescriptor, [<<"">>, ?NEWLINE]). %% ---------------------------------------------------------------------------- %% Write the testsuite start tag, with attributes describing the statistics @@ -303,7 +303,7 @@ <<"\" time=\"">>, format_time(Time), <<"\" name=\"">>, escape_attr(Name), <<"\">">>, ?NEWLINE], - io:format(FileDescriptor, "~ts", [StartTag]). + file:write(FileDescriptor, StartTag). %% ---------------------------------------------------------------------------- %% Recursive function to write the test cases. @@ -317,7 +317,7 @@ %% Write the testsuite end tag. %% ---------------------------------------------------------------------------- write_end_tag(FileDescriptor) -> - io:format(FileDescriptor, "~ts~ts", [<<"">>, ?NEWLINE]). + file:write(FileDescriptor, [<<"">>, ?NEWLINE]). %% ---------------------------------------------------------------------------- %% Write a test case, as a testcase tag. @@ -334,16 +334,17 @@ FileDescriptor) -> DescriptionAttr = case Description of [] -> []; - _ -> [<<" (">>, escape_attr(Description), <<")">>] + _ -> [<<" description=\"">>, escape_attr(Description), <<"\"">>] end, StartTag = [ ?INDENT, <<">, format_time(Time), - <<"\" name=\"">>, escape_attr(Name), DescriptionAttr, <<"\"">>], + <<"\" name=\"">>, escape_attr(Name), <<"\"">>, + DescriptionAttr], ContentAndEndTag = case {Result, Output} of {ok, <<>>} -> [<<"/>">>, ?NEWLINE]; _ -> [<<">">>, ?NEWLINE, format_testcase_result(Result), format_testcase_output(Output), ?INDENT, <<"">>, ?NEWLINE] end, - io:format(FileDescriptor, "~ts~ts", [StartTag, ContentAndEndTag]). + file:write(FileDescriptor, [StartTag, ContentAndEndTag]). %% ---------------------------------------------------------------------------- %% Format the result of the test. @@ -426,7 +427,7 @@ %% Replace < with <, > with > and & with & %% ---------------------------------------------------------------------------- escape_text(Text) when is_binary(Text) -> escape_text(binary_to_list(Text)); -escape_text(Text) -> escape_xml(to_utf8(lists:flatten(Text)), [], false). +escape_text(Text) -> escape_xml(lists:flatten(Text), [], false). %% ---------------------------------------------------------------------------- @@ -434,7 +435,7 @@ %% Replace < with <, > with > and & with & %% ---------------------------------------------------------------------------- escape_attr(Text) when is_binary(Text) -> escape_attr(binary_to_list(Text)); -escape_attr(Text) -> escape_xml(to_utf8(lists:flatten(Text)), [], true). +escape_attr(Text) -> escape_xml(lists:flatten(Text), [], true). escape_xml([], Acc, _ForAttr) -> lists:reverse(Acc); escape_xml([$< | Tail], Acc, ForAttr) -> escape_xml(Tail, [$;, $t, $l, $& | Acc], ForAttr); @@ -442,17 +443,3 @@ escape_xml([$& | Tail], Acc, ForAttr) -> escape_xml(Tail, [$;, $p, $m, $a, $& | Acc], ForAttr); escape_xml([$" | Tail], Acc, true) -> escape_xml(Tail, [$;, $t, $o, $u, $q, $& | Acc], true); % " escape_xml([Char | Tail], Acc, ForAttr) when is_integer(Char) -> escape_xml(Tail, [Char | Acc], ForAttr). - -%% the input may be utf8 or latin1; the resulting list is unicode -to_utf8(Desc) when is_binary(Desc) -> - case unicode:characters_to_list(Desc) of - {_,_,_} -> unicode:characters_to_list(Desc, latin1); - X -> X - end; -to_utf8(Desc) when is_list(Desc) -> - try - to_utf8(list_to_binary(Desc)) - catch - _:_ -> - Desc - end. diff -Nru erlang-18.2-dfsg/lib/eunit/src/eunit_tty.erl erlang-17.3-dfsg/lib/eunit/src/eunit_tty.erl --- erlang-18.2-dfsg/lib/eunit/src/eunit_tty.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/eunit_tty.erl 2014-09-16 19:10:57.000000000 +0000 @@ -67,8 +67,6 @@ end, if Pass =:= 1 -> fwrite(" Test passed.\n"); - Pass =:= 2 -> - fwrite(" 2 tests passed.\n"); true -> fwrite(" All ~w tests passed.\n", [Pass]) end @@ -85,7 +83,7 @@ sync_end(error) end; terminate({error, Reason}, _St) -> - fwrite("Internal error: ~tP.\n", [Reason, 25]), + fwrite("Internal error: ~P.\n", [Reason, 25]), sync_end(error). sync_end(Result) -> @@ -179,7 +177,7 @@ print_group_start(I, Desc) -> indent(I), - fwrite("~ts\n", [Desc]). + fwrite("~s\n", [Desc]). print_group_end(I, Time) -> if Time > 0 -> @@ -197,13 +195,13 @@ true -> io_lib:fwrite("~w:", [Line]) end, D = if Desc =:= "" ; Desc =:= undefined -> ""; - true -> io_lib:fwrite(" (~ts)", [Desc]) + true -> io_lib:fwrite(" (~s)", [Desc]) end, case proplists:get_value(source, Data) of {Module, Name, _Arity} -> - fwrite("~ts:~ts ~ts~ts...", [Module, L, Name, D]); + fwrite("~s:~s ~s~s...", [Module, L, Name, D]); _ -> - fwrite("~ts~ts...", [L, D]) + fwrite("~s~s...", [L, D]) end. print_test_end(Data) -> @@ -211,21 +209,21 @@ T = if Time > 0 -> io_lib:fwrite("[~.3f s] ", [Time/1000]); true -> "" end, - fwrite("~tsok\n", [T]). + fwrite("~sok\n", [T]). print_test_error({error, Exception}, Data) -> Output = proplists:get_value(output, Data), - fwrite("*failed*\n~ts", [eunit_lib:format_exception(Exception)]), + fwrite("*failed*\n~s", [eunit_lib:format_exception(Exception)]), case Output of <<>> -> fwrite("\n\n"); <> -> - fwrite(" output:<<\"~ts\">>...\n\n", [Text]); + fwrite(" output:<<\"~s\">>...\n\n", [Text]); _ -> - fwrite(" output:<<\"~ts\">>\n\n", [Output]) + fwrite(" output:<<\"~s\">>\n\n", [Output]) end; print_test_error({skipped, Reason}, _) -> - fwrite("*did not run*\n::~ts\n", [format_skipped(Reason)]). + fwrite("*did not run*\n::~s\n", [format_skipped(Reason)]). format_skipped({module_not_found, M}) -> io_lib:fwrite("missing module: ~w", [M]); @@ -246,12 +244,12 @@ format_cancel(timeout) -> "*timed out*\n"; format_cancel({startup, Reason}) -> - io_lib:fwrite("*could not start test process*\n::~tP\n\n", + io_lib:fwrite("*could not start test process*\n::~P\n\n", [Reason, 15]); format_cancel({blame, _SubId}) -> "*cancelled because of subtask*\n"; format_cancel({exit, Reason}) -> - io_lib:fwrite("*unexpected termination of test process*\n::~tP\n\n", + io_lib:fwrite("*unexpected termination of test process*\n::~P\n\n", [Reason, 15]); format_cancel({abort, Reason}) -> eunit_lib:format_error(Reason). diff -Nru erlang-18.2-dfsg/lib/eunit/src/Makefile erlang-17.3-dfsg/lib/eunit/src/Makefile --- erlang-18.2-dfsg/lib/eunit/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -24,7 +24,7 @@ EBIN = ../ebin INCLUDE=../include -ERL_COMPILE_FLAGS += -pa $(EBIN) -pa ../../stdlib/ebin -I$(INCLUDE) +warn_unused_vars +nowarn_shadow_vars +warn_unused_import +warn_obsolete_guard +ERL_COMPILE_FLAGS += -pa $(EBIN) -I$(INCLUDE) +warn_unused_vars +nowarn_shadow_vars +warn_unused_import +warn_obsolete_guard PARSE_TRANSFORM = eunit_autoexport.erl @@ -46,8 +46,6 @@ INCLUDE_FILES = eunit.hrl -INTERNAL_HRL_FILES= eunit_internal.hrl - PARSE_TRANSFORM_BIN = $(PARSE_TRANSFORM:%.erl=$(EBIN)/%.$(EMULATOR)) TARGET_FILES= $(SOURCES:%.erl=$(EBIN)/%.$(EMULATOR)) @@ -80,7 +78,7 @@ clean: - rm -f $(OBJECTS) $(PARSE_TRANSFORM_BIN) + rm -f $(OBJECTS) rm -f core *~ distclean: clean @@ -121,7 +119,6 @@ $(INSTALL_DATA) $(PARSE_TRANSFORM_BIN) $(OBJECTS) "$(RELSYSDIR)/ebin" $(INSTALL_DIR) "$(RELSYSDIR)/src" $(INSTALL_DATA) $(PARSE_TRANSFORM) $(SOURCES) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(INTERNAL_HRL_FILES) "$(RELSYSDIR)/src" $(INSTALL_DIR) "$(RELSYSDIR)/include" $(INSTALL_DATA) $(INCLUDE_DELIVERABLES) "$(RELSYSDIR)/include" diff -Nru erlang-18.2-dfsg/lib/eunit/test/eunit_SUITE.erl erlang-17.3-dfsg/lib/eunit/test/eunit_SUITE.erl --- erlang-18.2-dfsg/lib/eunit/test/eunit_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/test/eunit_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,36 +1,35 @@ %% %% %CopyrightBegin% -%% +%% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% %% %CopyrightEnd% %% -module(eunit_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, - app_test/1,appup_test/1,eunit_test/1,surefire_utf8_test/1,surefire_latin_test/1]). - + app_test/1,appup_test/1,eunit_test/1]). + -include_lib("common_test/include/ct.hrl"). suite() -> [{ct_hooks,[ts_install_cth]}]. -all() -> - [app_test, appup_test, eunit_test, surefire_utf8_test, surefire_latin_test]. +all() -> + [app_test, appup_test, eunit_test]. -groups() -> +groups() -> []. init_per_suite(Config) -> @@ -55,21 +54,3 @@ ok = file:set_cwd(code:lib_dir(eunit)), ok = eunit:test(eunit). -surefire_latin_test(Config) when is_list(Config) -> - ok = file:set_cwd(proplists:get_value(priv_dir, Config, ".")), - check_surefire(tlatin), - ok. - -surefire_utf8_test(Config) when is_list(Config) -> - ok = file:set_cwd(proplists:get_value(priv_dir, Config, ".")), - check_surefire(tutf8), - ok. - -check_surefire(Module) -> - File = "TEST-"++atom_to_list(Module)++".xml", - file:delete(File), - % ignore test result, some fail on purpose - eunit:test(Module, [{report,{eunit_surefire,[{dir,"."}]}}]), - {ok, Bin} = file:read_file(File), - [_|_] = unicode:characters_to_list(Bin, unicode), - ok. \ No newline at end of file diff -Nru erlang-18.2-dfsg/lib/eunit/test/Makefile erlang-17.3-dfsg/lib/eunit/test/Makefile --- erlang-18.2-dfsg/lib/eunit/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -21,9 +20,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk MODULES = \ - eunit_SUITE \ - tlatin \ - tutf8 + eunit_SUITE ERL_FILES= $(MODULES:%=%.erl) diff -Nru erlang-18.2-dfsg/lib/eunit/test/tlatin.erl erlang-17.3-dfsg/lib/eunit/test/tlatin.erl --- erlang-18.2-dfsg/lib/eunit/test/tlatin.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/test/tlatin.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -% coding: latin-1 - --module(tlatin). - --include_lib("eunit/include/eunit.hrl"). - -'foo_ä_test_'() -> - [ - {"1ö1", fun() -> io:format("1å1 ~s ~w",[<<"aö">>, 'Zök']), io:format([128,64,255,255]), ?assert("gö"=="gö") end} - ,{<<"2ö2">>, fun() -> io:format("2å2 ~s",[<<"bö">>]), io:format([128,64]), ?assert("gö"=="gö") end} - ,{<<"3ö3"/utf8>>, fun() -> io:format("3å3 ~ts",[<<"cö"/utf8>>]), io:format([128,64]), ?assert("gö"=="gö") end} - ,{"1ä1", fun() -> io:format("1ä1 ~s ~w",[<<"aä">>,'Zbäd']), io:format([128,64,255,255]), ?assert("wå"=="wä") end} - ,{<<"2ä2">>, fun() -> io:format("2ä2 ~s",[<<"bä">>]), io:format([128,64]), ?assert("wå"=="wä") end} - ,{<<"3ä3"/utf8>>, fun() -> io:format("3ä3 ~ts",[<<"cä"/utf8>>]), io:format([128,64]), ?assert("wå"=="wä") end} - ]. diff -Nru erlang-18.2-dfsg/lib/eunit/test/tutf8.erl erlang-17.3-dfsg/lib/eunit/test/tutf8.erl --- erlang-18.2-dfsg/lib/eunit/test/tutf8.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/test/tutf8.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -%% coding: utf-8 - --module(tutf8). - --include_lib("eunit/include/eunit.hrl"). - -'foo_ö_test_'() -> - [ - {"1ö汉1", fun() -> io:format("1å汉1 ~s ~w",[<<"aö汉">>, 'Zök']), io:format([128,64,255,255]), ?assert("gö汉"=="gö汉") end} - ,{<<"2ö汉2">>, fun() -> io:format("2å汉2 ~s",[<<"bö汉">>]), io:format([128,64]), ?assert("gö汉"=="gö汉") end} - ,{<<"3ö汉3"/utf8>>, fun() -> io:format("3å汉3 ~ts",[<<"cö汉"/utf8>>]), io:format([128,64]), ?assert("gö汉"=="gö汉") end} - ,{"1ä汉1", fun() -> io:format("1ä汉1 ~s ~w",[<<"aä汉">>, 'Zbäd']), io:format([128,64,255,255]), ?assert("wå汉"=="wä汉") end} - ,{<<"2ä汉2">>, fun() -> io:format("2ä汉2 ~s",[<<"bä汉">>]), io:format([128,64]), ?assert("wå汉"=="wä汉") end} - ,{<<"3ä汉"/utf8>>, fun() -> io:format("3ä汉3 ~ts",[<<"cä汉"/utf8>>]), io:format([128,64]), ?assert("wå汉"=="wä汉") end} - ]. diff -Nru erlang-18.2-dfsg/lib/eunit/vsn.mk erlang-17.3-dfsg/lib/eunit/vsn.mk --- erlang-18.2-dfsg/lib/eunit/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/eunit/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -EUNIT_VSN = 2.2.12 +EUNIT_VSN = 2.2.8 diff -Nru erlang-18.2-dfsg/lib/gs/contribs/bonk/bonk.erl erlang-17.3-dfsg/lib/gs/contribs/bonk/bonk.erl --- erlang-18.2-dfsg/lib/gs/contribs/bonk/bonk.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/bonk/bonk.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/gs/contribs/bonk/bonk_sound.erl erlang-17.3-dfsg/lib/gs/contribs/bonk/bonk_sound.erl --- erlang-18.2-dfsg/lib/gs/contribs/bonk/bonk_sound.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/bonk/bonk_sound.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/gs/contribs/bonk/bonk_square.erl erlang-17.3-dfsg/lib/gs/contribs/bonk/bonk_square.erl --- erlang-18.2-dfsg/lib/gs/contribs/bonk/bonk_square.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/bonk/bonk_square.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/gs/contribs/bonk/Makefile erlang-17.3-dfsg/lib/gs/contribs/bonk/Makefile --- erlang-18.2-dfsg/lib/gs/contribs/bonk/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/bonk/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/gs/contribs/bonk/sounder.erl erlang-17.3-dfsg/lib/gs/contribs/bonk/sounder.erl --- erlang-18.2-dfsg/lib/gs/contribs/bonk/sounder.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/bonk/sounder.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/gs/contribs/cols/cols.erl erlang-17.3-dfsg/lib/gs/contribs/cols/cols.erl --- erlang-18.2-dfsg/lib/gs/contribs/cols/cols.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/cols/cols.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/gs/contribs/cols/highscore.erl erlang-17.3-dfsg/lib/gs/contribs/cols/highscore.erl --- erlang-18.2-dfsg/lib/gs/contribs/cols/highscore.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/cols/highscore.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/gs/contribs/cols/Makefile erlang-17.3-dfsg/lib/gs/contribs/cols/Makefile --- erlang-18.2-dfsg/lib/gs/contribs/cols/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/cols/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/gs/contribs/Makefile erlang-17.3-dfsg/lib/gs/contribs/Makefile --- erlang-18.2-dfsg/lib/gs/contribs/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/gs/contribs/mandel/Makefile erlang-17.3-dfsg/lib/gs/contribs/mandel/Makefile --- erlang-18.2-dfsg/lib/gs/contribs/mandel/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/mandel/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/gs/contribs/mandel/mandel.erl erlang-17.3-dfsg/lib/gs/contribs/mandel/mandel.erl --- erlang-18.2-dfsg/lib/gs/contribs/mandel/mandel.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/mandel/mandel.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/gs/contribs/mandel/mandel.html erlang-17.3-dfsg/lib/gs/contribs/mandel/mandel.html --- erlang-18.2-dfsg/lib/gs/contribs/mandel/mandel.html 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/gs/contribs/mandel/mandel.html 2014-09-16 19:10:57.000000000 +0000 @@ -1,16 +1,15 @@ hexlist_to_integer(HexString) -> Number - Converts a hexadecimal string to an integer. + Convert a hexadecimal string to an integer. Number = integer() HexString = string() -

    hexlist_to_integer converts the hexadecimal value of - HexString to an integer.

    +

    hexlist_to_integer Convert the Hexadecimal value of + HexString to an integer.

    + +
    integer_to_hexlist(Number) -> HexString - Converts an integer to a hexadecimal string. + Convert an integer to a hexadecimal string. Number = integer() HexString = string() -

    integer_to_hexlist/1 returns a string representing - Number in a hexadecimal form.

    + +

    integer_to_hexlist/1 Returns a string that represents + the Number in a Hexadecimal form.

    + +
    lookup(ETSTable,Key) -> Result lookup(ETSTable,Key,Undefined) -> Result - Extracts the first value associated with a Key - in an ETS table. + Extract the first value associated with a key in an ETS table. ETSTable = ets_table() Key = term() @@ -151,18 +194,20 @@

    lookup extracts {Key,Value} tuples from ETSTable and returns the Value associated - with Key. If ETSTable is of type bag, + with Key. If ETSTable is of type bag only the first Value associated with Key is returned. lookup/2 returns undefined and lookup/3 returns Undefined if no Value is found.

    + +
    lookup_mime(ConfigDB,Suffix) lookup_mime(ConfigDB,Suffix,Undefined) -> MimeType - Returns the MIME type associated with a specific file suffix. + Return the mime type associated with a specific file suffix. ConfigDB = ets_table() Suffix = string() @@ -170,19 +215,20 @@ Undefined = term() -

    lookup_mime returns the MIME type associated with a - specific file suffix as specified in the file mime.types - (located in the - - config directory).

    + +

    lookup_mime returns the mime type associated with a + specific file suffix as specified in the mime.types + file (located in the + config directory).

    + +
    lookup_mime_default(ConfigDB,Suffix) lookup_mime_default(ConfigDB,Suffix,Undefined) -> MimeType - Returns the MIME type associated with a specific file suffix - or the value of the DefaultType. + Return the mime type associated with a specific file suffix or the value of the DefaultType. ConfigDB = ets_table() Suffix = string() @@ -190,19 +236,22 @@ Undefined = term() -

    lookup_mime_default returns the MIME type associated + +

    lookup_mime_default returns the mime type associated with a specific file suffix as specified in the mime.types file (located in the - - config directory). - If no appropriate association is found, the value of DefaultType is + config directory). + If no appropriate association can be found + the value of DefaultType is returned.

    + +
    message(StatusCode,PhraseArgs,ConfigDB) -> Message - Returns an informative HTTP 1.1 status string in HTML. + Return an informative HTTP 1.1 status string in HTML. StatusCode = 301 | 400 | 403 | 404 | 500 | 501 | 504 PhraseArgs = term() @@ -210,48 +259,53 @@ Message = string() +

    message/3 returns an informative HTTP 1.1 status string in HTML. Each StatusCode requires a specific PhraseArgs:

    301 -

    string(): A URL pointing at the new document - position.

    + string(): A URL pointing at the new document + position. 400 | 401 | 500 -

    none (no PhraseArgs).

    + none (No PhraseArgs) 403 | 404 -

    string(): A Request-URI as described in - RFC 2616.

    -
    + string(): A Request-URI as described in + RFC 2616. 501 -

    {Method,RequestURI,HTTPVersion}: The HTTP - Method, Request-URI, and HTTP-Version - as defined in RFC 2616.

    + {Method,RequestURI,HTTPVersion}: The HTTP + Method, Request-URI and HTTP-Version + as defined in RFC 2616. 504 -

    string(): A string describing why the service - was unavailable.

    + string(): A string describing why the service + was unavailable.
    + +
    month(NthMonth) -> Month - Converts the month as an integer (1-12) to an abbreviated string. + Convert the month as an integer (1-12) to an abbreviated string. NthMonth = 1-12 Month = string() +

    month/1 converts the month NthMonth as an integer (1-12) to an abbreviated string, that is:

    1 = "Jan", 2 = "Feb", ..., 12 = "Dec".

    + +
    multi_lookup(ETSTable,Key) -> Result - Extracts the values associated with a key in an ETS table. + Extract the values associated with a key in a ETS table. ETSTable = ets_table() Key = term() @@ -259,44 +313,49 @@

    multi_lookup extracts all {Key,Value} tuples - from an ETSTable and returns all Values - associated with Key in a list.

    + from an ETSTable and returns allValues associated with the Key in a list.

    + +
    reason_phrase(StatusCode) -> Description - Returns the description of an HTTP 1.1 status code. + Return the description of an HTTP 1.1 status code. - StatusCode = 100| 200 | 201 | 202 | 204 | 205 | 206 | 300 | 301 | 302 | 303 | 304 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 410 411 | 412 | 413 | 414 415 | 416 | 417 | 500 | 501 | 502 | 503 | 504 | 505 + StatusCode = 100| 200 | 201 | 202 | 204 | 205 | 206 | 300 | 301 | 302 | 303 | 304 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 410 411 | 412 | 413 | 414 415 | 416 | 417 | 500 | 501 | 502 | 503 | 504 | 505 Description = string() -

    reason_phrase returns Description of an - HTTP 1.1 StatusCode, for example, 200 is "OK" and 201 - is "Created". For more information, see - RFC 2616.

    +

    reason_phrase returns the Description of an + HTTP 1.1 StatusCode, for example 200 is "OK" and 201 + is "Created". Read RFC 2616 for further information.

    + +
    rfc1123_date() -> RFC1123Date rfc1123_date({{YYYY,MM,DD},{Hour,Min,Sec}}) -> RFC1123Date - Returns the current date in RFC 1123 format. + Return the current date in RFC 1123 format. YYYY = MM = DD = Hour = Min = Sec = integer() RFC1123Date = string() +

    rfc1123_date/0 returns the current date in RFC 1123 format. rfc_date/1 converts the date in the Erlang format to the RFC 1123 date format.

    + +
    split(String,RegExp,N) -> SplitRes - Splits a string in N chunks using a regular expression. + Split a string in N chunks using a regular expression. String = RegExp = string() SplitRes = {ok, FieldList} | {error, errordesc()} @@ -304,86 +363,96 @@ N = integer -

    split/3 splits String in N chunks - using RegExp. split/3 is equivalent to - regexp:split/2 with the exception that N - defines the maximum number of fields in + +

    split/3 splits the String in N chunks + using the RegExp. split/3 is is equivalent to + regexp:split/2 with one exception, that is N + defines the number of maximum number of fields in the FieldList.

    + +
    split_script_path(RequestLine) -> Splitted - Splits a RequestLine in a file reference to an executable, - and a QueryString or a PathInfostring. + Split a RequestLinein a file reference to an executable and aQueryStringor a PathInfostring. RequestLine = string() Splitted = not_a_script | {Path, PathInfo, QueryString} Path = QueryString = PathInfo = string() +

    split_script_path/1 is equivalent to split_path/1 with one exception. If the longest - possible path is not a regular, accessible, and executable - file, then not_a_script is returned.

    + possible path is not a regular, accessible and executable + file not_a_script is returned.

    + +
    split_path(RequestLine) -> {Path,QueryStringOrPathInfo} - Splits a RequestLine in a file reference, and a - QueryString or a PathInfo string. + Split a RequestLinein a file reference and a QueryStringor aPathInfostring. RequestLine = Path = QueryStringOrPathInfo = string() -

    split_path/1 splits RequestLine in a file - reference (Path), and a QueryString or a - PathInfo string as specified in - RFC 2616. - A QueryString is isolated from Path with a + +

    split_path/1 splits the RequestLine in a file + reference (Path) and a QueryString or a + PathInfo string as specified in RFC 2616. A + QueryString is isolated from the Path with a question mark (?) and PathInfo with a slash (/). In the case of a QueryString, everything before - ? is a Path and everything after ? is a - QueryString. In the case of a PathInfo, + the ? is a Path and everything after a + QueryString. In the case of a PathInfo the RequestLine is scanned from left-to-right on the hunt for longest possible Path being a file or a directory. Everything after the longest possible Path, isolated with a /, is regarded as PathInfo. The resulting Path is decoded using decode_hex/1 before delivery.

    + +
    strip(String) -> Stripped - Returns String where the leading and trailing space - tabs are removed. + Returns String where the leading and trailing space and tabs has been removed. String = Stripped = string() +

    strip/1 removes any leading or trailing linear white - space from the string. Linear white space is to be read as + space from the string. Linear white space should be read as horizontal tab or space.

    + +
    suffix(FileName) -> Suffix - Extracts the file suffix from a given filename. + Extract the file suffix from a given filename. FileName = Suffix = string() +

    suffix/1 is equivalent to - filename:extension/1 with the exception that - Suffix is returned without a leading dot (.).

    + filename:extension/1 with one exception, that is + Suffix is returned without a leading dot (.).

    + SEE ALSO

    httpd(3)

    diff -Nru erlang-18.2-dfsg/lib/inets/doc/src/httpd.xml erlang-17.3-dfsg/lib/inets/doc/src/httpd.xml --- erlang-18.2-dfsg/lib/inets/doc/src/httpd.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/doc/src/httpd.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19972015 + 19972013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -30,892 +29,919 @@ httpd.sgml
    httpd - - HTTP server API + An implementation of an HTTP + 1.1 compliant Web server, as defined in RFC 2616. -

    An implementation of an HTTP 1.1 compliant web server, as defined in - RFC 2616. - Provides web server start options, administrative functions, and - an Erlang callback API.

    +

    Documents the HTTP server start options, some administrative + functions and also specifies the Erlang Web server callback + API

    - DATA TYPES + COMMON DATA TYPES

    Type definitions that are used more than once in this module:

    -

    boolean() = true | false

    -

    string() = list of ASCII characters

    -

    path() = string() representing a file or a directory path

    -

    ip_address() = {N1,N2,N3,N4} % IPv4 +

    boolean() = true | false

    +

    string() = list of ASCII characters

    +

    path() = string() - representing a file or directory path.

    +

    ip_address() = {N1,N2,N3,N4} % IPv4 | {K1,K2,K3,K4,K5,K6,K7,K8} % IPv6

    -

    hostname() = string() representing a host, for example, - "foo.bar.com"

    +

    hostname() = string() - representing a host ex "foo.bar.com"

    property() = atom()

    - ERLANG HTTP SERVER SERVICE START/STOP -

    A web server can be configured to start when starting the Inets - application, or dynamically in runtime by calling the - Inets application API inets:start(httpd, ServiceConfig) or + ERLANG HTTP SERVER SERVICE START/STOP +

    A web server can be configured to start when starting the inets + application or started dynamically in runtime by calling the + Inets application API inets:start(httpd, ServiceConfig), or inets:start(httpd, ServiceConfig, How), - see inets(3). - The configuration options, also called - properties, are as follows:

    + see inets(3) Below follows a + description of the available configuration options, also called + properties.

    -

    File Properties

    +

    File properties

    When the web server is started - at application start time, the properties are to be fetched from a - configuration file that can consist of a regular Erlang property - list, that is, [{Option, Value}], where Option = property() + at application start time the properties should be fetched from a + configuration file that could consist of a regular erlang property + list, e.i. [{Option, Value}] where Option = property() and Value = term(), followed by a full stop, or for - backwards compatibility, an Apache-like configuration file. If the - web server is started dynamically at runtime, - a file can still be specified but also the complete property + backwards compatibility an Apache like configuration file. If the + web server is started dynamically at runtime you may still specify + a file but you could also just specify the complete property list.

    - {proplist_file, path()} + + {proplist_file, path()} -

    If this property is defined, Inets expects to find - all other properties defined in this file. The +

    If this property is defined inets will expect to find + all other properties defined in this file. Note that the file must include all properties listed under mandatory - properties.

    + properties.

    - {file, path()} + + {file, path()} -

    If this property is defined, Inets expects to find all - other properties defined in this file, which uses Apache-like - syntax. The file must include all properties listed - under mandatory properties. The Apache-like syntax is the property, +

    If this property is defined inets will expect to find all + other properties defined in this file, that uses Apache like + syntax. Note that the file must include all properties listed + under mandatory properties. The Apache like syntax is the property, written as one word where each new word begins with a capital, - followed by a white-space, followed by the value, followed by a - new line.

    -

    Example:

    + followed by a white-space followed by the value followed by a + new line. Ex:

    + -{server_root, "/urs/local/www"} -> ServerRoot /usr/local/www +{server_root, "/urs/local/www"} -> ServerRoot /usr/local/www +
    -

    A few exceptions are documented +

    With a few exceptions, that are documented for each property that behaves differently, - and the special cases {directory, {path(), PropertyList}} - and {security_directory, {Dir, PropertyList}}, are represented + and the special case {directory, {path(), PropertyList}} and + {security_directory, {Dir, PropertyList}} that are represented as:

     	  
       
     
    -         ]]>
    + ]]> + -

    The properties proplist_file and file are mutually exclusive. Also newer properties may not be supported as Apache-like options, this is a legacy feature.

    +

    The properties proplist_file and file are mutually exclusive.

    -

    Mandatory Properties

    +

    Mandatory properties

    - {port, integer()} + + {port, integer()} -

    The port that the HTTP server listen to. +

    The port that the HTTP server shall listen on. If zero is specified as port, an arbitrary available port - is picked and function httpd:info/2 can be used to - determine which port was picked.

    + will be picked and you can use the httpd:info/2 function to find + out which port was picked.

    - {server_name, string()} + + {server_name, string()} -

    The name of your server, normally a fully qualified domain name.

    +

    The name of your server, normally a fully qualified domain name.

    - {server_root, path()} + + {server_root, path()} -

    Defines the home directory of the server, where log files, and so on, - can be stored. Relative paths specified in other properties refer - to this directory.

    +

    Defines the server's home directory where log files etc can + be stored. Relative paths specified in other properties refer + to this directory.

    - {document_root, path()} + + {document_root, path()} -

    Defines the top directory for the documents that - are available on the HTTP server.

    + Defines the top directory for the documents that + are available on the HTTP server.
    -

    Communication Properties

    +

    Communication properties

    - {bind_address, ip_address() | hostname() | any} + + {bind_address, ip_address() | hostname() | any} -

    Default is any. any is denoted * - in the Apache-like configuration file.

    -
    - - {profile, atom()} - -

    Used together with bind_address - and port to uniquely identify - a HTTP server. This can be useful in a virtualized environment, - where there can - be more that one server that has the same bind_address and port. - If this property is not explicitly set, it is assumed that the - bind_address and - portuniquely identifies the HTTP server. -

    +

    Defaults to any. Note that any is denoted * + in the apache like configuration file.

    - {socket_type, ip_comm | {ip_comm, Config::proplist()} | {essl, Config::proplist()}} + + {socket_type, ip_comm | {essl, Config::proplist()}} -

    For ip_comm configuration options, see - gen_tcp:listen/2, some options - that are used internally by httpd can not be set.

    -

    For SSL configuration options, see - ssl:listen/2.

    -

    Default is ip_comm.

    +

    For ssl configuration options see ssl:listen/2

    +

    Defaults to ip_comm.

    - {ipfamily, inet | inet6} + + {ipfamily, inet | inet6 | inet6fb4} -

    Default is inet, legacy option inet6fb4 no longer makes sense and will be translated - to inet.

    +

    Defaults to inet6fb4.

    +

    Note that this option is only used when the option + socket_type has the value ip_comm.

    - - {minimum_bytes_per_second, integer()} + + {minimum_bytes_per_second, integer()} -

    If given, sets a minimum of bytes per second value for connections.

    -

    If the value is unreached, the socket closes for that connection.

    -

    The option is good for reducing the risk of "slow DoS" attacks.

    +

    If given, sets a minimum bytes per second value for connections.

    +

    If the value is not reached, the socket will close for that connection.

    +

    The option is good for reducing the risk of "slow dos" attacks.

    -

    Erlang Web Server API Modules

    +

    Erlang Web server API modules

    - {modules, [atom()]} + + {modules, [atom()]} -

    Defines which modules the HTTP server uses when handling - requests. Default is [mod_alias, mod_auth, mod_esi, +

    Defines which modules the HTTP server will use to handle + requests. Defaults to: [mod_alias, mod_auth, mod_esi, mod_actions, mod_cgi, mod_dir, mod_get, mod_head, mod_log, - mod_disk_log]. - Notice that some mod-modules are dependent on - others, so the order cannot be entirely arbitrary. See the - Inets Web Server Modules in the - User's Guide for details.

    + mod_disk_log] + Note that some mod-modules are dependent on + others, so the order can not be entirely arbitrary. See the + Inets Web server Modules in the + Users guide for more information.

    Limit properties

    - - - {customize, atom()} + + + {disable_chunked_transfer_encoding_send, boolean()} -

    A callback module to customize the inets HTTP servers behaviour - see httpd_custom_api

    +

    This property allows you to disable chunked + transfer-encoding when sending a response to a HTTP/1.1 + client, by default this is false.

    - {disable_chunked_transfer_encoding_send, boolean()} - -

    Allows you to disable chunked - transfer-encoding when sending a response to an HTTP/1.1 - client. Default is false.

    -
    - - {keep_alive, boolean()} + + {keep_alive, boolean()} -

    Instructs the server whether to use persistent +

    Instructs the server whether or not to use persistent connections when the client claims to be HTTP/1.1 - compliant. Default is true.

    + compliant, default is true.

    - {keep_alive_timeout, integer()} + + {keep_alive_timeout, integer()} -

    The number of seconds the server waits for a +

    The number of seconds the server will wait for a subsequent request from the client before closing the - connection. Default is 150.

    + connection. Default is 150.

    - {max_body_size, integer()} + + {max_body_size, integer()} -

    Limits the size of the message body of an HTTP request. - Default is no limit.

    +

    Limits the size of the message body of HTTP request. + By the default there is no limit.

    - {max_clients, integer()} + + {max_clients, integer()}

    Limits the number of simultaneous requests that can be - supported. Default is 150.

    -
    - - {max_header_size, integer()} - -

    Limits the size of the message header of an HTTP request. - Default is 10240.

    + supported. Defaults to 150.

    - {max_content_length, integer()} + + {max_header_size, integer()} -

    Maximum content-length in an incoming request, in bytes. Requests - with content larger than this are answered with status 413. - Default is 100000000 (100 MB). -

    +

    Limits the size of the message header of HTTP request. + Defaults to 10240.

    - - {max_uri_size, integer()} + + + {max_uri_size, integer()} -

    Limits the size of the HTTP request URI. - Default is no limit.

    +

    Limits the size of the HTTP request URI. By + default there is no limit.

    - {max_keep_alive_request, integer()} + + {max_keep_alive_request, integer()} -

    The number of requests that a client can do on one +

    The number of request that a client can do on one connection. When the server has responded to the number of - requests defined by max_keep_alive_requests, the server - closes the connection. The server closes it even if there are - queued request. Default is no limit.

    + requests defined by max_keep_alive_requests the server close the + connection. The server will close it even if there are queued + request. Defaults to no limit.

    -

    Administrative Properties

    +

    Administrative properties

    - {mime_types, [{MimeType, Extension}] | path()} + + {mime_types, [{MimeType, Extension}] | path()} -

    MimeType = string() and Extension = string(). +

    Where MimeType = string() and Extension = string(). Files delivered to the client are MIME typed according to RFC 1590. File suffixes are mapped to MIME types before file delivery. The mapping between file suffixes and MIME types can be specified - as an Apache-like file or directly in the property list. Such - a file can look like the follwoing:

    + as an Apache like file as well as directly in the property list. Such + a file may look like:

     # MIME type	Extension  
     text/html	html htm
    -text/plain	asc txt
    +text/plain asc txt + -

    Default is [{"html","text/html"},{"htm","text/html"}].

    +

    Defaults to [{"html","text/html"},{"htm","text/html"}]

    - {mime_type, string()} + + {mime_type, string()} -

    When the server is asked to provide a document type that - cannot be determined by the MIME Type Settings, the server - uses this default type.

    +

    When the server is asked to provide a document type which + cannot be determined by the MIME Type Settings, the server will + use this default type.

    - {server_admin, string()} + + {server_admin, string()} -

    Defines the email-address of the server - administrator to be included in any error messages returned by - the server.

    -
    - - {server_tokens, none|prod|major|minor|minimal|os|full|{private, string()}} - -

    Defines the look of the value of the server header.

    -

    Example: Assuming the version of Inets is 5.8.1, - the server header string can look as follows for - the different values of server-tokens:

    - - none -

    "" % A Server: header will not be generated

    - prod -

    "inets"

    - major -

    "inets/5"

    - minor -

    "inets/5.8"

    - minimal -

    "inets/5.8.1"

    - os -

    "inets/5.8.1 (unix)"

    - full -

    "inets/5.8.1 (unix/linux) OTP/R15B"

    - {private, "foo/bar"} -

    "foo/bar"

    -
    -

    By default, the value is as before, that is, minimal.

    -
    - - {log_format, common | combined} - -

    Defines if access logs are to be written according to the common - log format or the extended common log format. - The common format is one line looking like this: - remotehost rfc931 authuser [date] "request" status bytes.

    -

    Here:

    - - remotehost - Remote. - rfc931 - The remote username of the client (RFC 931). - authuser - The username used for authentication. - [date] - Date and time of the request (RFC 1123). - "request" - The request line as it came from the client (RFC 1945). - status - The HTTP status code returned to the client (RFC 1945). - bytes - The content-length of the document transferred. - +

    ServerAdmin defines the email-address of the server + administrator, to be included in any error messages returned by + the server.

    +
    + + + {server_tokens, prod|major|minor|minimal|os|full|{private, string()}} + +

    ServerTokens defines how the value of the server header + should look.

    +

    Example: Assuming the version of inets is 5.8.1, + here is what the server header string could look like for + the different values of server-tokens:

    +
    +prod                  "inets"
    +major                 "inets/5"
    +minor                 "inets/5.8"
    +minimal               "inets/5.8.1"
    +os                    "inets/5.8.1 (unix)"
    +full                  "inets/5.8.1 (unix/linux) OTP/R15B"
    +{private, "foo/bar"}  "foo/bar"
    +	
    +

    By default, the value is as before, which is minimal.

    +
    + + + {log_format, common | combined} + +

    Defines if access logs should be written according to the common + log format or to the extended common log format. + The common format is one line that looks like this: + remotehost rfc931 authuser [date] "request" status bytes

    + +
    +remotehost
    +	Remote
    +rfc931
    +	The client's remote username (RFC 931). 
    +authuser
    +	The username with which the user authenticated 
    +        himself. 
    +[date]
    +	Date and time of the request (RFC 1123). 
    +"request"
    +	The request line exactly as it came from the client
    +        (RFC 1945). 
    +status
    +	The HTTP status code returned to the client 
    +        (RFC 1945). 
    +bytes
    +	The content-length of the document transferred. 
    +        
    -

    The combined format is one line looking like this: +

    The combined format is on line that look like this: remotehost rfc931 authuser [date] "request" status bytes "referer" "user_agent"

    -

    In addition to the earlier:

    - - "referer" - The URL the client was on before - requesting the URL (if it could not be determined, - a minus sign is placed in this field). - "user_agent" - The software the client claims to be using (if it - could not be determined, a minus sign is placed in - this field). - - -

    This affects the access logs written by mod_log and - mod_disk_log. -

    + +
    +"referer"
    +	The url the client was on before
    +	requesting your url. (If it could not be determined 
    +	a minus sign will be placed in this field)
    +"user_agent"
    +	The software the client claims to be using. (If it
    +	could not be determined a minus sign will be placed in
    +	this field)
    +	
    + +

    This affects the access logs written by mod_log and mod_disk_log. +

    +
    - {error_log_format, pretty | compact} + + {error_log_format, pretty | compact} -

    Default is pretty. If the error log is meant to be read - directly by a human, pretty is the best option.

    -

    pretty has a format corresponding to:

    +

    Defaults to pretty. If the error log is meant to be read + directly by a human pretty will be the best + option. pretty has the format corresponding to: +

    - io:format("[~s] ~s, reason: ~n ~p ~n~n", [Date, Msg, Reason]). + io:format("[~s] ~s, reason: ~n ~p ~n~n", [Date, Msg, Reason]). + -

    compact has a format corresponding to:

    +

    compact has the format corresponding to:

    - io:format("[~s] ~s, reason: ~w ~n", [Date, Msg, Reason]). + io:format("[~s] ~s, reason: ~w ~n", [Date, Msg, Reason]). + -

    This affects the error logs written by mod_log and - mod_disk_log. +

    This affects the error logs written by mod_log and mod_disk_log.

    -

    URL Aliasing Properties - Requires mod_alias

    +

    URL aliasing properties - requires mod_alias

    - {alias, {Alias, RealName}} + + {alias, {Alias, RealName}} -

    Alias = string() and RealName = string(). - alias allows documents to be stored in the local file - system instead of the document_root location. URLs with a path - beginning with url-path is mapped to local files beginning with - directory-filename, for example:

    +

    Where Alias = string() and RealName = string(). + The Alias property allows documents to be stored in the local file + system instead of the document_root location. URLs with a path that + begins with url-path is mapped to local files that begins with + directory-filename, for example: {alias, {"/image", "/ftp/pub/image"}} -

    Access to http://your.server.org/image/foo.gif would refer to - the file /ftp/pub/image/foo.gif.

    + and an access to http://your.server.org/image/foo.gif would refer to + the file /ftp/pub/image/foo.gif.

    - {re_write, {Re, Replacement}} + + {re_write, {Re, Replacement}} -

    Re = string() and Replacement = string(). - re_write allows documents to be stored in the local file - system instead of the document_root location. URLs are rewritten - by re:replace/3 to produce a path in the local file-system, - for example:

    +

    Where Re = string() and Replacement = string(). + The ReWrite property allows documents to be stored in the local file + system instead of the document_root location. URLs are rewritten + by re:replace/3 to produce a path in the local filesystem. + For example: {re_write, {"^/[~]([^/]+)(.*)$", "/home/\\1/public\\2"}} -

    Access to http://your.server.org/~bob/foo.gif would refer to + and an access to http://your.server.org/~bob/foo.gif would refer to the file /home/bob/public/foo.gif. - In an Apache-like configuration file, Re is separated - from Replacement with one single space, and as expected - backslashes do not need to be backslash escaped, the - same example would become:

    + In an Apache like configuration file the Re is separated + from Replacement with one single space, and as expected + backslashes do not need to be backslash escaped so the + same example would become: ReWrite ^/[~]([^/]+)(.*)$ /home/\1/public\2 -

    Beware of trailing space in Replacement to be used. - If you must have a space in Re, use, for example, the character - encoding \040, see - re(3).

    + Beware of trailing space in Replacement that will be used. + If you must have a space in Re use e.g the character encoding + \040 see re(3).

    - {directory_index, [string()]} + + {directory_index, [string()]} -

    directory_index specifies a list of resources to look for - if a client requests a directory using a / at the end of the - directory name. file depicts the name of a file in the - directory. Several files can be given, in which case the server - returns the first it finds, for example:

    +

    DirectoryIndex specifies a list of resources to look for + if a client requests a directory using a / at the end of the + directory name. file depicts the name of a file in the + directory. Several files may be given, in which case the server + will return the first it finds, for example: {directory_index, ["index.hml", "welcome.html"]} -

    Access to http://your.server.org/docs/ would return + and access to http://your.server.org/docs/ would return http://your.server.org/docs/index.html or - http://your.server.org/docs/welcome.html if index.html does not - exist.

    + http://your.server.org/docs/welcome.html if index.html do not + exist.

    -

    CGI Properties - Requires mod_cgi

    +

    CGI properties - requires mod_cgi

    - {script_alias, {Alias, RealName}} + + {script_alias, {Alias, RealName}} -

    Alias = string() and RealName = string(). - Have the same behavior as property alias, except that - they also mark the target directory as containing CGI +

    Where Alias = string() and RealName = string(). + Has the same behavior as the Alias property, except that + it also marks the target directory as containing CGI scripts. URLs with a path beginning with url-path are mapped to - scripts beginning with directory-filename, for example:

    + scripts beginning with directory-filename, for example: {script_alias, {"/cgi-bin/", "/web/cgi-bin/"}} -

    Access to http://your.server.org/cgi-bin/foo would cause - the server to run the script /web/cgi-bin/foo.

    + and an access to http://your.server.org/cgi-bin/foo would cause + the server to run the script /web/cgi-bin/foo.

    - {script_re_write, {Re, Replacement}} + + {script_re_write, {Re, Replacement}} -

    Re = string() and Replacement = string(). - Have the same behavior as property re_write, except that - they also mark the target directory as containing CGI +

    Where Re = string() and Replacement = string(). + Has the same behavior as the ReWrite property, except that + it also marks the target directory as containing CGI scripts. URLs with a path beginning with url-path are mapped to - scripts beginning with directory-filename, for example:

    + scripts beginning with directory-filename, for example: {script_re_write, {"^/cgi-bin/(\\d+)/", "/web/\\1/cgi-bin/"}} -

    Access to http://your.server.org/cgi-bin/17/foo would cause - the server to run the script /web/17/cgi-bin/foo.

    + and an access to http://your.server.org/cgi-bin/17/foo would cause + the server to run the script /web/17/cgi-bin/foo.

    - {script_nocache, boolean()} + + {script_nocache, boolean()} -

    If script_nocache is set to true, the HTTP server by - default adds the header fields necessary to prevent proxies from - caching the page. Generally this is preferred. - Default to false.

    +

    If ScriptNoCache is set to true the HTTP server will by + default add the header fields necessary to prevent proxies from + caching the page. Generally this is something you want. Defaults + to false.

    - {script_timeout, integer()} + + {script_timeout, integer()} -

    The time in seconds the web server waits between each - chunk of data from the script. If the CGI script does not deliver - any data before the timeout, the connection to the client is - closed. Default is 15.

    +

    The time in seconds the web server will wait between each + chunk of data from the script. If the CGI-script not delivers + any data before the timeout the connection to the client will be + closed. Defaults to 15.

    - {action, {MimeType, CgiScript}} - requires mod_action + + {action, {MimeType, CgiScript}} - requires mod_action -

    MimeType = string() and CgiScript = string(). - action adds an action activating a CGI script - whenever a file of a certain MIME type is requested. It +

    Where MimeType = string() and CgiScript = string(). + Action adds an action, which will activate a cgi-script + whenever a file of a certain mime-type is requested. It propagates the URL and file path of the requested document using the standard CGI PATH_INFO and PATH_TRANSLATED environment - variables.

    -

    Example:

    + variables. {action, {"text/plain", "/cgi-bin/log_and_deliver_text"}} +

    - {script, {Method, CgiScript}} - requires mod_action + + {script, {Method, CgiScript}} - requires mod_action -

    Method = string() and CgiScript = string(). - script adds an action activating a CGI script +

    Where Method = string() and CgiScript = string(). + Script adds an action, which will activate a cgi-script whenever a file is requested using a certain HTTP method. The - method is either GET or POST, as defined in RFC 1945. It + method is either GET or POST as defined in RFC 1945. It propagates the URL and file path of the requested document using the standard CGI PATH_INFO and PATH_TRANSLATED environment - variables.

    -

    Example:

    + variables. {script, {"PUT", "/cgi-bin/put"}} +

    -

    ESI Properties - Requires mod_esi

    +

    ESI properties - requires mod_esi

    - {erl_script_alias, {URLPath, [AllowedModule]}} + + {erl_script_alias, {URLPath, [AllowedModule]}} -

    URLPath = string() and AllowedModule = atom(). - erl_script_alias marks all URLs matching url-path as erl +

    Where URLPath = string() and AllowedModule = atom(). + erl_script_alias marks all URLs matching url-path as erl scheme scripts. A matching URL is mapped into a specific module - and function, for example:

    + and function. For example: - {erl_script_alias, {"/cgi-bin/example", [httpd_example]}} + {erl_script_alias, {"/cgi-bin/example", [httpd_example]}} + -

    A request to + and a request to http://your.server.org/cgi-bin/example/httpd_example:yahoo - would refer to httpd_example:yahoo/3 or, if that does not exist, + would refer to httpd_example:yahoo/3 or, if that did not exist, httpd_example:yahoo/2 and http://your.server.org/cgi-bin/example/other:yahoo would - not be allowed to execute.

    + not be allowed to execute.

    - {erl_script_nocache, boolean()} + + {erl_script_nocache, boolean()} -

    If erl_script_nocache is set to true, the server adds - HTTP header fields preventing proxies from caching the - page. This is generally a good idea for dynamic content, as - the content often varies between each request. - Default is false.

    +

    If erl_script_nocache is set to true the server will add + http header fields that prevents proxies from caching the + page. This is generally a good idea for dynamic content, since + the content often vary between each request. + Defaults to false.

    - {erl_script_timeout, integer()} + + {erl_script_timeout, integer()} -

    If erl_script_timeout sets the time in seconds the server - waits between each chunk of data to be delivered through - mod_esi:deliver/2. Default is 15. This is only relevant - for scripts that use the erl scheme.

    +

    If erl_script_timeout sets the time in seconds the server will + wait between each chunk of data to be delivered through + mod_esi:deliver/2. Defaults to 15. This is only relevant + for scripts that uses the erl scheme.

    - {eval_script_alias, {URLPath, [AllowedModule]}} + + {eval_script_alias, {URLPath, [AllowedModule]}} -

    URLPath = string() and AllowedModule = atom(). - Same as erl_script_alias but for scripts - using the eval scheme. This is only supported - for backwards compatibility. The eval scheme is deprecated.

    +

    Where URLPath = string() and AllowedModule = atom(). + Same as erl_script_alias but for scripts + using the eval scheme. Note that this is only supported + for backwards compatibility. The eval scheme is deprecated.

    -

    Log Properties - Requires mod_log

    +

    Log properties - requires mod_log

    - {error_log, path()} + + {error_log, path()}

    Defines the filename of the error log file to be used to log - server errors. If the filename does not begin with a slash (/), - it is assumed to be relative to the server_root.

    + server errors. If the filename does not begin with a slash (/) + it is assumed to be relative to the server_root.

    - {security_log, path()} + + {security_log, path()}

    Defines the filename of the access log file to be used to log security events. If the filename does not begin with a slash - (/), it is assumed to be relative to the server_root.

    + (/) it is assumed to be relative to the server_root.

    - {transfer_log, path()} + + {transfer_log, path()}

    Defines the filename of the access log file to be used to log incoming requests. If the filename does not begin with a - slash (/), it is assumed to be relative to the server_root.

    + slash (/) it is assumed to be relative to the server_root.

    -

    Disk Log Properties - Requires mod_disk_log

    +

    Disk Log properties - requires mod_disk_log

    - {disk_log_format, internal | external} + + {disk_log_format, internal | external} -

    Defines the file format of the log files. See disk_log for - details. If the internal file format is used, the - log file is repaired after a crash. When a log file is - repaired, data can disappear. When the external file format is - used, httpd does not start if the log file is broken. Default is - external.

    +

    Defines the file-format of the log files see disk_log for + more information. If the internal file-format is used, the + logfile will be repaired after a crash. When a log file is + repaired data might get lost. When the external file-format is + used httpd will not start if the log file is broken. Defaults to + external.

    - {error_disk_log, path()} + + {error_disk_log, path()} -

    Defines the filename of the (disk_log(3)) error log file +

    Defines the filename of the (disk_log(3)) error log file to be used to log server errors. If the filename does not begin - with a slash (/), it is assumed to be relative to the server_root.

    + with a slash (/) it is assumed to be relative to the server_root.

    - {error_disk_log_size, {MaxBytes, MaxFiles}} + + {error_disk_log_size, {MaxBytes, MaxFiles}} -

    MaxBytes = integer() and MaxFiles = integer(). - Defines the properties of the (disk_log(3)) error log - file. This file is of type wrap log and - max bytes is written to each file and max files is - used before the first file is truncated and reused.

    +

    Where MaxBytes = integer() and MaxFiles = integer(). + Defines the properties of the (disk_log(3)) error log + file. The disk_log(3) error log file is of type wrap log and + max-bytes will be written to each file and max-files will be + used before the first file is truncated and reused.

    - {security_disk_log, path()} + + {security_disk_log, path()} -

    Defines the filename of the (disk_log(3)) access log file - logging incoming security events, that is, authenticated - requests. If the filename does not begin with a slash (/), it - is assumed to be relative to the server_root.

    +

    Defines the filename of the (disk_log(3)) access log file + which logs incoming security events i.e authenticated + requests. If the filename does not begin with a slash (/) it + is assumed to be relative to the server_root.

    - {security_disk_log_size, {MaxBytes, MaxFiles}} + + {security_disk_log_size, {MaxBytes, MaxFiles}} -

    MaxBytes = integer() and MaxFiles = integer(). - Defines the properties of the disk_log(3) access log - file. This file is of type wrap log and - max bytes is written to each file and max files is - used before the first file is truncated and reused.

    +

    Where MaxBytes = integer() and MaxFiles = integer(). + Defines the properties of the disk_log(3) access log + file. The disk_log(3) access log file is of type wrap log and + max-bytes will be written to each file and max-files will be + used before the first file is truncated and reused.

    - {transfer_disk_log, path()} + + {transfer_disk_log, path()} -

    Defines the filename of the (disk_log(3)) access log file - logging incoming requests. If the filename does not begin - with a slash (/), it is assumed to be relative to the - server_root.

    +

    Defines the filename of the (disk_log(3)) access log file + which logs incoming requests. If the filename does not begin + with a slash (/) it is assumed to be relative to the + server_root.

    - {transfer_disk_log_size, {MaxBytes, MaxFiles}} + + {transfer_disk_log_size, {MaxBytes, MaxFiles}} -

    MaxBytes = integer() and MaxFiles = integer(). - Defines the properties of the disk_log(3) access log - file. This file is of type wrap log and - max bytes is written to each file and max files is - used before the first file is truncated and reused.

    +

    Where MaxBytes = integer() and MaxFiles = integer(). + Defines the properties of the disk_log(3) access log + file. The disk_log(3) access log file is of type wrap log and + max-bytes will be written to each file and max-files will be + used before the first file is truncated and reused.

    -

    Authentication Properties - Requires mod_auth

    +

    Authentication properties - requires mod_auth

    {directory, {path(), [{property(), term()}]}}

    -

    The properties for directories are as follows:

    +

    Here follows the valid properties for directories

    - {allow_from, all | [RegxpHostString]} + + {allow_from, all | [RegxpHostString]} -

    Defines a set of hosts to be granted access to a - given directory, for example:

    +

    Defines a set of hosts which should be granted access to a + given directory. + + For example: {allow_from, ["123.34.56.11", "150.100.23"]} -

    The host 123.34.56.11 and all machines on the 150.100.23 - subnet are allowed access.

    + The host 123.34.56.11 and all machines on the 150.100.23 + subnet are allowed access.

    - {deny_from, all | [RegxpHostString]} + + {deny_from, all | [RegxpHostString]}

    Defines a set of hosts - to be denied access to a given directory, for example:

    + which should be denied access to a given directory. + For example: {deny_from, ["123.34.56.11", "150.100.23"]} -

    The host 123.34.56.11 and all machines on the 150.100.23 - subnet are not allowed access.

    + The host 123.34.56.11 and all machines on the 150.100.23 + subnet are not allowed access.

    - {auth_type, plain | dets | mnesia} + + {auth_type, plain | dets | mnesia}

    Sets the type of authentication database that is used for the - directory. The key difference between the different methods is - that dynamic data can be saved when Mnesia and Dets - are used. - This property is called AuthDbType in the Apache-like - configuration files.

    + directory.The key difference between the different methods is + that dynamic data can be saved when Mnesia and Dets is used. + This property is called AuthDbType in the Apache like + configuration files.

    - {auth_user_file, path()} + + {auth_user_file, path()} -

    Sets the name of a file containing the list of users and - passwords for user authentication. The filename can be either +

    Sets the name of a file which contains the list of users and + passwords for user authentication. filename can be either absolute or relative to the server_root. If using the - plain storage method, this file is a plain text file where - each line contains a username followed by a colon, followed - by the non-encrypted password. If usernames are duplicated, - the behavior is undefined.

    -

    Example:

    + plain storage method, this file is a plain text file, where + each line contains a user name followed by a colon, followed + by the non-encrypted password. If user names are duplicated, + the behavior is undefined. For example: ragnar:s7Xxv7 edward:wwjau8 -

    If the Dets storage method is used, the user database is - maintained by Dets and must not be edited by hand. Use the - API functions in module mod_auth to create/edit the user - database. This directive is ignored if the Mnesia - storage method is used. For security reasons, ensure that - auth_user_file is stored outside the document tree of the web - server. If it is placed in the directory that it protects, - clients can download it.

    + If using the dets storage method, the user database is + maintained by dets and should not be edited by hand. Use the + API functions in mod_auth module to create / edit the user + database. This directive is ignored if using the mnesia + storage method. For security reasons, make sure that the + auth_user_file is stored outside the document tree of the Web + server. If it is placed in the directory which it protects, + clients will be able to download it.

    - {auth_group_file, path()} + + {auth_group_file, path()} -

    Sets the name of a file containing the list of user - groups for user authentication. The filename can be either - absolute or relative to the server_root. If the plain - storage method is used, the group file is a plain text file, where +

    Sets the name of a file which contains the list of user + groups for user authentication. Filename can be either + absolute or relative to the server_root. If you use the plain + storage method, the group file is a plain text file, where each line contains a group name followed by a colon, followed - by the members usernames separated by spaces.

    -

    Example:

    + by the member user names separated by spaces. For example: group1: bob joe ante -

    If the Dets storage method is used, the group database is - maintained by Dets and must not be edited by hand. Use the - API for module mod_auth to create/edit the group database. - This directive is ignored if the Mnesia storage method is used. - For security reasons, ensure that the auth_group_file is - stored outside the document tree of the web server. If it is - placed in the directory that it protects, clients - can download it.

    + If using the dets storage method, the group database is + maintained by dets and should not be edited by hand. Use the + API for mod_auth module to create / edit the group database. + This directive is ignored if using the mnesia storage method. + For security reasons, make sure that the auth_group_file is + stored outside the document tree of the Web server. If it is + placed in the directory which it protects, clients will be + able to download it.

    - {auth_name, string()} + + {auth_name, string()}

    Sets the name of the authorization realm (auth-domain) for - a directory. This string informs the client about which - username and password to use.

    + a directory. This string informs the client about which user + name and password to use.

    - {auth_access_password, string()} + + {auth_access_password, string()} -

    If set to other than "NoPassword", the password is required - for all API calls. If the password is set to "DummyPassword", the +

    If set to other than "NoPassword" the password is required + for all API calls. If the password is set to "DummyPassword" the password must be changed before any other API calls. To secure - the authenticating data, the password must be changed after the - web server is started. Otherwise it is written in clear - text in the configuration file.

    + the authenticating data the password must be changed after the + web server is started since it otherwise is written in clear + text in the configuration file.

    - {require_user, [string()]} + + {require_user, [string()]} -

    Defines users to grant access to a given - directory using a secret password.

    +

    Defines users which should be granted access to a given + directory using a secret password.

    - {require_group, [string()]} + + {require_group, [string()]} -

    Defines users to grant access to a given - directory using a secret password.

    +

    Defines users which should be granted access to a given + directory using a secret password.

    -

    Htaccess Authentication Properties - Requires mod_htaccess

    +

    Htaccess authentication properties - requires mod_htaccess

    - {access_files, [path()]} + + {access_files, [path()]} -

    Specifies the filenames that are used for - access files. When a request comes, every directory in the path - to the requested asset are searched after files with the - names specified by this parameter. If such a file is found, the - file is parsed and the restrictions specified in it are - applied to the request.

    +

    Specify which filenames that are used for + access-files. When a request comes every directory in the path + to the requested asset will be searched after files with the + names specified by this parameter. If such a file is found the + file will be parsed and the restrictions specified in it will + be applied to the request.

    -

    Security Properties - Requires mod_security

    +

    Security properties - requires mod_security

    {security_directory, {path(), [{property(), term()}]}}

    -

    The properties for the security directories are as follows:

    +

    Here follows the valid properties for security directories

    - {data_file, path()} + + {data_file, path()} -

    Name of the security data file. The filename can either be - absolute or relative to the server_root. This file is used to - store persistent data for module mod_security.

    +

    Name of the security data file. The filename can either + absolute or relative to the server_root. This file is used to + store persistent data for the mod_security module.

    - {max_retries, integer()} + + {max_retries, integer()} -

    Specifies the maximum number of attempts to authenticate a - user before the user is blocked out. If a user - successfully authenticates while blocked, the - user receives a 403 (Forbidden) response from the - server. If the user makes a failed attempt while blocked, the - server returns 401 (Unauthorized), for security +

    Specifies the maximum number of tries to authenticate a + user has before the user is blocked out. If a user + successfully authenticates when the user has been blocked, the + user will receive a 403 (Forbidden) response from the + server. If the user makes a failed attempt while blocked the + server will return 401 (Unauthorized), for security reasons. - Default is 3. Can be set to infinity.

    + Defaults to 3 may also be set to infinity.

    - {block_time, integer()} + + {block_time, integer()}

    Specifies the number of minutes a user is blocked. After - this timehas passed, the user automatically regains access. - Default is 60.

    + this amount of time, he automatically regains access. + Defaults to 60.

    - {fail_expire_time, integer()} + + {fail_expire_time, integer()}

    Specifies the number of minutes a failed user authentication - is remembered. If a user authenticates after this - time has passed, the previous failed authentications are + is remembered. If a user authenticates after this amount of + time, his previous failed authentications are forgotten. - Default is 30.

    + Defaults to 30.

    - {auth_timeout, integer()} + + {auth_timeout, integer()} Specifies the number of seconds a successful user authentication is remembered. After this time has passed, the - authentication is no longer reported. Default is 30. + authentication will no longer be reported. Defaults to 30.
    + info(Pid) -> info(Pid, Properties) -> [{Option, Value}] - Fetches information about the HTTP server. + Fetches information about the HTTP server Properties = [property()] - Option = property() + Option = property() Value = term()

    Fetches information about the HTTP server. When called - with only the pid, all properties are fetched. When called - with a list of specific properties, they are fetched. - The available properties are the same as the start options - of the server. + with only the pid all properties are fetched, when called + with a list of specific properties they are fetched. + Available properties are the same as the server's start options.

    -

    Pid is the pid returned from inets:start/[2,3]. - Can also be retrieved form inets:services/0 and - inets:services_info/0, - see inets(3). +

    Pid is the pid returned from inets:start/[2,3]. + Can also be retrieved form inets:services/0, inets:services_info/0 + see inets(3)

    + info(Address, Port) -> - info(Address, Port, Profile) -> - info(Address, Port, Profile, Properties) -> [{Option, Value}] info(Address, Port, Properties) -> [{Option, Value}] - Fetches information about the HTTP server. + Fetches information about the HTTP server Address = ip_address() Port = integer() - Profile = atom() Properties = [property()] Option = property() Value = term()

    Fetches information about the HTTP server. When called with - only Address and Port, all properties are - fetched. When called with a list of specific properties, they - are fetched. The available properties are the same as the - start options of the server. + only the Address and Port all properties are fetched, when + called with a list of specific properties they are fetched. + Available properties are the same as the server's start + options.

    -

    The address must be the IP address and cannot be +

    Address has to be the ip-address and can not be the hostname.

    + reload_config(Config, Mode) -> ok | {error, Reason} Reloads the HTTP server configuration without restarting the server. @@ -927,26 +953,24 @@

    Reloads the HTTP server configuration without restarting the - server. Incoming requests are answered with a temporary - down message during the reload time.

    + server. Incoming requests will be answered with a temporary + down message during the time the it takes to reload.

    -

    Available properties are the same as the - start options of the server, but the properties - bind_address and port - cannot be changed.

    - -

    If mode is disturbing, the server is blocked forcefully, - all ongoing requests terminates, and the reload - starts immediately. If mode is non-disturbing, no new - connections are accepted, but ongoing requests are +

    Available properties are the same as the server's + start options, although the properties bind_address and + port can not be changed.

    + +

    If mode is disturbing, the server is blocked forcefully and + all ongoing requests are terminated and the reload will + start immediately. If mode is non-disturbing, no new + connections are accepted, but the ongoing requests are allowed to complete before the reload is done.

    - ERLANG WEB SERVER API DATA TYPES -

    The Erlang web server API data types are as follows:

    + ERLANG WEB SERVER API DATA TYPES ModData = #mod{} @@ -963,75 +987,73 @@ parsed_header = [], entity_body, connection - }). + }). +
    -

    To acess the record in your callback-module use:

    - -include_lib("inets/include/httpd.hrl"). +

    To acess the record in your callback-module use

    + -include_lib("inets/include/httpd.hrl"). -

    The fields of record mod have the following meaning: +

    The fields of the mod record has the following meaning:

    data -

    Type [{InteractionKey,InteractionValue}] is used to + Type [{InteractionKey,InteractionValue}] is used to propagate data between modules. Depicted - interaction_data() in function type declarations.

    + interaction_data() in function type declarations.
    socket_type -

    socket_type() - indicates whether it is an IP socket or an ssl socket.

    + socket_type(), + Indicates whether it is an ip socket or a ssl socket. socket -

    The socket, in format ip_comm or ssl, - depending on socket_type.

    + The actual socket in ip_comm or ssl format + depending on the socket_type. config_db -

    The config file directives stored as key-value tuples in - an ETS table. Depicted config_db() in function type - declarations.

    + The config file directives stored as key-value tuples in + an ETS-table. Depicted config_db() in function type + declarations. method -

    Type "GET" | "POST" | "HEAD" | "TRACE", that is, the - HTTP method.

    + Type "GET" | "POST" | "HEAD" | "TRACE", that is the + HTTP method. absolute_uri -

    If the request is an HTTP/1.1 - request, the URI can be in the absolute URI format. In that - case, httpd saves the absolute URI in this field. An Example - of an absolute URI is - "http://ServerName:Part/cgi-bin/find.pl?person=jocke"

    + If the request is a HTTP/1.1 + request the URI might be in the absolute URI format. In that + case httpd will save the absolute URI in this field. An Example + of an absolute URI could + be"http://ServerName:Part/cgi-bin/find.pl?person=jocke" request_uri -

    The Request-URI as defined - in RFC 1945, for example, "/cgi-bin/find.pl?person=jocke".

    -
    + The Request-URI as defined + in RFC 1945, for example "/cgi-bin/find.pl?person=jocke" http_version -

    The HTTP version of the - request, that is, "HTTP/0.9", "HTTP/1.0", or "HTTP/1.1".

    + The HTTP version of the + request, that is "HTTP/0.9", "HTTP/1.0", or "HTTP/1.1". request_line -

    The Request-Line as - defined inRFC 1945, for example, - "GET /cgi-bin/find.pl?person=jocke HTTP/1.0".

    + The Request-Line as + defined in RFC 1945, for example "GET /cgi-bin/find.pl?person=jocke HTTP/1.0". parsed_header - Type [{HeaderKey,HeaderValue}]. + Type [{HeaderKey,HeaderValue}], parsed_header contains all HTTP header fields from the - HTTP request stored in a list as key-value tuples. See - RFC 2616 - for a listing of all header fields. For example, the date field - is stored as {"date","Wed, 15 Oct 1997 14:35:17 GMT"}. - RFC 2616 defines that HTTP is a case-insensitive protocol and - the header fields can be in lower case or upper case. httpd - ensures that all header field names are in lower case. + HTTP-request stored in a list as key-value tuples. See RFC 2616 + for a listing of all header fields. For example the date field + would be stored as: {"date","Wed, 15 Oct 1997 14:35:17 GMT"} . + RFC 2616 defines that HTTP is a case insensitive protocol and + the header fields may be in lower case or upper case. Httpd will + ensure that all header field names are in lower case. entity_body -

    The entity-Body as defined - in RFC 2616, for example, data sent from a CGI script using the - POST method.

    + The Entity-Body as defined + in RFC 2616, for example data sent from a CGI-script using the + POST method. connection -

    true | false. If set to true, the connection to the - client is a persistent connection and is not closed when - the request is served.

    + true | false If set to true the connection to the + client is a persistent connection and will not be closed when + the request is served.
    @@ -1040,63 +1062,56 @@
    + Module:do(ModData)-> {proceed, OldData} | {proceed, NewData} | {break, NewData} | done - Called for each request to the web server. + Called for each request to the Web server. OldData = list() - NewData = [{response,{StatusCode,Body}}] - | [{response,{response,Head,Body}}] - | [{response,{already_sent,Statuscode,Size}}] + NewData = [{response,{StatusCode,Body}}] | [{response,{response,Head,Body}}] | [{response,{already_sent,Statuscode,Size}}] StatusCode = integer() Body = io_list() | nobody | {Fun, Arg} Head = [HeaderOption] HeaderOption = {Option, Value} | {code, StatusCode} - Option = accept_ranges | allow - | cache_control | content_MD5 - | content_encoding | content_language - | content_length | content_location - | content_range | content_type | date - | etag | expires | last_modified - | location | pragma | retry_after - | server | trailer | transfer_encoding + Option = accept_ranges | allow | cache_control | content_MD5 | content_encoding | content_language | content_length | content_location | content_range | content_type | date | etag | expires | last_modified | location | pragma | retry_after | server | trailer | transfer_encoding Value = string() Fun = fun( Arg ) -> sent| close | Body Arg = [term()] -

    When a valid request reaches httpd, it calls do/1 in - each module, defined by the configuration - option of Module. The function can generate data for other - modules or a response that can be sent back to the client.

    -

    The field data in ModData is a list. This list is +

    When a valid request reaches httpd it calls do/1 in + each module defined by the Modules configuration + option. The function may generate data for other modules + or a response that can be sent back to the client.

    +

    The field data in ModData is a list. This list will be the list returned from the last call to do/1.

    -

    Body is the body of the HTTP response that is - sent back to the client. An appropriate header is - appended to the message. StatusCode is the - status code of the response, see - RFC 2616 - for the appropriate values.

    +

    Body is the body of the http-response that will be + sent back to the client an appropriate header will be + appended to the message. StatusCode will be the + status code of the response see RFC2616 for the appropriate + values.

    Head is a key value list of HTTP header fields. The - server constructs an HTTP header from this data. See RFC 2616 for the appropriate value for each header field. If the - client is an HTTP/1.0 client, the server filters the - list so that only HTTP/1.0 header fields are sent back - to the client.

    + server will construct a HTTP header from this data. See RFC + 2616 for the appropriate value for each header field. If the + client is a HTTP/1.0 client then the server will filter the + list so that only HTTP/1.0 header fields will be sent back + to the client.

    If Body is returned and equal to {Fun,Arg}, - the web server tries apply/2 on Fun with - Arg as argument. The web server expects that the fun either - returns a list (Body) that is an HTTP repsonse, or the - atom sent if the HTTP response is sent back to the - client. If close is returned from the fun, something has gone - wrong and the server signals this to the client by + the Web server will try apply/2 on Fun with + Arg as argument and expect that the fun either + returns a list (Body) that is a HTTP-repsonse or the + atom sent if the HTTP-response is sent back to the + client. If close is returned from the fun something has gone + wrong and the server will signal this to the client by closing the connection.

    - Module:load(Line, AccIn)-> eof | ok | {ok, AccOut} | {ok, AccOut, {Option, Value}} | {ok, AccOut, [{Option, Value}]} | {error, Reason} - Converts a line in an Apache-like config - file to an {Option, Value} tuple. + + Module:load(Line, AccIn)-> eof | ok | {ok, AccOut} | {ok, AccOut, {Option, Value}} | {ok, AccOut, [{Option, Value}]} | {error, Reason} + Load is used to convert a line in a Apache like config + file to a {Option, Value} tuple. Line = string() AccIn = [{Option, Value}] @@ -1106,53 +1121,55 @@ Reason = term() -

    Converts a line in an Apache-like - configuration file to an {Option, Value} tuple. Some - more complex configuration options, such as directory - and security_directory, create an - accumulator. This function only needs clauses for the +

    Load is used to convert a line in a Apache like + configuration file to a {Option, Value} tuple. Some + more complex configuration options such as directory + and security_directory will create an + accumulator.This function does only need clauses for the options implemented by this particular callback module.

    - - - Module:remove(ConfigDB) -> ok | {error, Reason} - Callback function that is called when the web server is closed. - - ConfigDB = ets_table() - Reason = term() - - -

    When httpd is shut down, it tries to execute - remove/1 in each Erlang web server callback module. The - programmer can use this function to clean up resources - created in the store function.

    -
    -
    - + - Module:store({Option, Value}, Config)-> {ok, {Option, NewValue}} | {error, Reason} - Checks the validity of the configuration options. + + Module:store({Option, Value}, Config)-> {ok, {Option, NewValue}} | {error, Reason} + Line = string() Option = property() Config = [{Option, Value}] - Value = term() + Value = term() Reason = term() -

    Checks the validity of the +

    This function is used to check the validity of the configuration options before saving them in the internal - database. This function can also have a side effect, - that is, setup of necessary extra resources implied by the + database. This function may also have a side effect + e.i. setup necessary extra resources implied by the configuration option. It can also resolve possible dependencies among configuration options by changing the value of the option. - This function only needs clauses for the options + This function does only need clauses for the options implemented by this particular callback module.

    + + + + Module:remove(ConfigDB) -> ok | {error, Reason} + Callback function that is called when the Web server is closed. + + ConfigDB = ets_table() + Reason = term() + + +

    When httpd is shutdown it will try to execute + remove/1 in each Erlang web server callback module. The + programmer may use this function to clean up resources + that may have been created in the store function.

    +
    +
    @@ -1160,8 +1177,9 @@
    - parse_query(QueryString) -> [{Key,Value}] - Parses incoming data to erl and eval scripts. + + parse_query(QueryString) -> [{Key,Value}] + Parse incoming data to erl and eval scripts. QueryString = string() Key = string() @@ -1169,9 +1187,8 @@

    parse_query/1 parses incoming data to erl and - eval scripts (see mod_esi(3)) - as defined in the standard - URL format, that is, '+' becomes 'space' and decoding of + eval scripts (See mod_esi(3)) as defined in the standard + URL format, that is '+' becomes 'space' and decoding of hexadecimal characters (%xx).

    @@ -1179,9 +1196,8 @@
    SEE ALSO -

    RFC 2616, - inets(3), - ssl(3) +

    RFC 2616, inets(3), + ssl(3)

    diff -Nru erlang-18.2-dfsg/lib/inets/doc/src/http_server.xml erlang-17.3-dfsg/lib/inets/doc/src/http_server.xml --- erlang-18.2-dfsg/lib/inets/doc/src/http_server.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/doc/src/http_server.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,84 +4,94 @@
    - 20042015 + 20042013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. - HTTP server + + HTTP server + Ingela Anderton Andin + + + + + + http_server.xml + +
    - Configuration - + Introduction +

    The HTTP server, also referred to as httpd, handles HTTP requests - as described in - RFC 2616 - with a few exceptions, such as gateway - and proxy functionality. The server supports IPv6 as long as the - underlying mechanisms also do so.

    - -

    The server implements numerous features, such as:

    - - Secure Sockets Layer (SSL) - Erlang Scripting Interface (ESI) - Common Gateway Interface (CGI) - User Authentication (using Mnesia, - Dets or plain text database) - Common Logfile Format (with or without disk_log(3) support) - URL Aliasing - Action Mappings - Directory Listings - + as described in RFC 2616 with a few exceptions such as gateway + and proxy functionality. The server supports ipv6 as long as the + underlying mechanisms also do so.

    + +

    The server implements numerous features such as SSL (Secure Sockets + Layer), ESI (Erlang Scripting Interface), CGI (Common Gateway + Interface), User Authentication(using Mnesia, dets or plain text + database), Common Logfile Format (with or without disk_log(3) + support), URL Aliasing, Action Mappings, Directory Listings and SSI + (Server-Side Includes).

    -

    The configuration of the server is provided as an Erlang - property list. For backwards compatibility, a configuration +

    The configuration of the server is provided as an erlang + property list, and for backwards compatibility also a configuration file using apache-style configuration directives is supported.

    -

    As of Inets 5.0 the HTTP server is an easy to - start/stop and customize web server providing the most basic - web server functionality. Inets is designed for embedded systems - and if you want a full-fledged web server there are exists other - erlang open source alternatives.

    - -

    Almost all server functionality has been implemented using an - especially crafted server API, which is described in the Erlang Web - Server API. This API can be used +

    As of inets version 5.0 the HTTP server is an easy to + start/stop and customize web server that provides the most basic + web server functionality. Depending on your needs there + are also other erlang based web servers that may be of interest + such as Yaws, http://yaws.hyber.org, that for instance has its own + markup support to generate html, and supports certain buzzword + technologies such as SOAP.

    + +

    Allmost all server functionality has been implemented using an + especially crafted server API which is described in the Erlang Web + Server API. This API can be used to advantage by all who wish to enhance the core server functionality, for example with custom logging and authentication.

    -

    The following is to be put in the Erlang node application configuration - file to start an HTTP server at application startup:

    + +
    + +
    + Configuration + +

    What to put in the erlang node application configuration file + in order to start a http server at application startup.

    [{inets, [{services, [{httpd, [{proplist_file, "/var/tmp/server_root/conf/8888_props.conf"}]}, {httpd, [{proplist_file, - "/var/tmp/server_root/conf/8080_props.conf"}]}]}]}]. + "/var/tmp/server_root/conf/8080_props.conf"}]}]}]}]. + -

    The server is configured using an Erlang property list. - For the available properties, see - httpd(3). - For backwards compatibility, apache-like configuration files - are also supported. +

    The server is configured using an erlang property list. + For the available properties see + httpd(3) + For backwards compatibility also apache-like config files + are supported.

    -

    The available configuration properties are as follows:

    +

    All possible config properties are as follows

    httpd_service() -> {httpd, httpd()} httpd() -> [httpd_config()] @@ -93,43 +103,40 @@ debug_options() -> {all_functions, modules()} | {exported_functions, modules()} | {disable, modules()} - modules() -> [atom()] -

    Here:

    - - {file, file()} -

    If you use an old apace-like configuration file.

    - {proplist_file, file()} -

    File containing an Erlang property + modules() -> [atom()] + +

    {proplist_file, file()} File containing an erlang property list, followed by a full stop, describing the HTTP server - configuration.

    - {debug, debug()} -

    Can enable trace on all functions or only exported functions - on chosen modules.

    - {accept_timeout, integer()} -

    Sets the wanted time-out value for - the server to set up a request connection.

    -
    + configuration.

    +

    {file, file()} If you use an old apace-like configuration file.

    +

    {debug, debug()} - Can enable trace on all + functions or only exported functions on chosen modules.

    +

    {accept_timeout, integer()} sets the wanted timeout value for + the server to set up a request connection.

    + +
    - Getting Started - -

    Start Inets:

    + Using the HTTP Server API 1 > inets:start(). - ok -

    Start an HTTP server with minimal required configuration. - If you specify port 0, an arbitrary available port is - used, and you can use function info to find which port - number that was picked:

    + ok + +

    Start a HTTP server with minimal + required configuration. Note that if you + specify port 0 an arbitrary available port will be + used and you can use the info function to find out + which port number that was picked. +

    2 > {ok, Pid} = inets:start(httpd, [{port, 0}, {server_name,"httpd_test"}, {server_root,"/tmp"}, {document_root,"/tmp/htdocs"}, {bind_address, "localhost"}]). - {ok, 0.79.0} + {ok, 0.79.0} + -

    Call info:

    3 > httpd:info(Pid). [{mime_types,[{"html","text/html"},{"htm","text/html"}]}, @@ -137,404 +144,571 @@ {bind_address, {127,0,0,1}}, {server_root,"/tmp"}, {port,59408}, - {document_root,"/tmp/htdocs"}] + {document_root,"/tmp/htdocs"}] + -

    Reload the configuration without restarting the server: - +

    Reload the configuration without restarting the server. + Note port and bind_address can not be changed. Clients + trying to access the server during the reload will + get a service temporary unavailable answer.

    4 > httpd:reload_config([{port, 59408}, {server_name,"httpd_test"}, {server_root,"/tmp/www_test"}, {document_root,"/tmp/www_test/htdocs"}, {bind_address, "localhost"}], non_disturbing). - ok. - -

    port and bind_address cannot be changed. - Clients trying to access the server during the reload - get a service temporary unavailable answer.

    + ok. + 5 > httpd:info(Pid, [server_root, document_root]). - [{server_root,"/tmp/www_test"},{document_root,"/tmp/www_test/htdocs"}] + [{server_root,"/tmp/www_test"},{document_root,"/tmp/www_test/htdocs"}] + - 6 > ok = inets:stop(httpd, Pid). + 6 > ok = inets:stop(httpd, Pid). + -

    Alternative:

    +

    Alternative:

    - 6 > ok = inets:stop(httpd, {{127,0,0,1}, 59408}). + 6 > ok = inets:stop(httpd, {{127,0,0,1}, 59408}). + -

    Notice that bind_address must be the IP address reported - by function info and cannot be the hostname that is allowed - when putting in bind_address.

    +

    Note that bind_address has to be + the ip address reported by the info function and can + not be the hostname that is allowed when inputting bind_address.

    + +
    - Htaccess - User Configurable Authentication - -

    Web server users without server administrative privileges - that need to manage authentication of web pages that are local - to their user can use the per-directory runtime configurable - user-authentication scheme htaccess. - It works as follows:

    + Htaccess - User Configurable Authentication. +

    If users of the web server needs to manage authentication of + web pages that are local to their user and do not have + server administrative privileges. They can use the + per-directory runtime configurable user-authentication scheme + that Inets calls htaccess. It works the following way:

    Each directory in the path to the requested asset is - searched for an access file (default is .htaccess), which - restricts the web servers rights to respond to a request. - If an access file is found, the rules in that file is applied to the - request. - The rules in an access file apply to files in the same - directory and in subdirectories. If there exists more than one - access file in the path to an asset, the rules in the - access file nearest the requested asset is applied. - To change the rules that restrict the use of - an asset, the user only needs write access - to the directory where the asset is. - All access files in the path to a requested asset are read - once per request. This means that the load on the server - increases when htaccess is used. - If a directory is limited both by authentication directives - in the HTTP server configuration file and by the htaccess - files, the user must be allowed to get access to the file by both - methods for the request to succeed. + searched for an access-file (default .htaccess), that restricts + the web servers rights to respond to a request. If an access-file + is found the rules in that file is applied to the + request. + The rules in an access-file applies both to files in the same + directories and in subdirectories. If there exists more than one + access-file in the path to an asset, the rules in the + access-file nearest the requested asset will be applied. + To change the rules that restricts the use of + an asset. The user only needs to have write access + to the directory where the asset exists. + All the access-files in the path to a requested asset is read + once per request, this means that the load on the server will + increase when this scheme is used. + If a directory is + limited both by auth directives in the HTTP server configuration + file and by the htaccess files. The user must be allowed to get + access the file by both methods for the request to succeed.
    Access Files Directives -

    In every directory under DocumentRoot or under an - Alias a user can place an access file. An access file - is a plain text file that specifies the restrictions to - consider before the web server answers to a - request. If there are more than one access file in the path - to the requested asset, the directives in the access file in - the directory nearest the asset is used.

    - - "allow" +

    In every directory under the DocumentRoot or under an + Alias a user can place an access-file. An access-file + is a plain text file that specify the restrictions that + shall be considered before the web server answer to a + request. If there are more than one access-file in the path + to the requested asset, the directives in the access-file in + the directory nearest the asset will be used.

    + -

    Syntax: Allow from subnet subnet | from all

    -

    Default: from all

    -

    Same as directive allow for the server configuration file.

    -
    - "AllowOverRide" - -

    Syntax: AllowOverRide all | none | Directives

    -

    Default: none

    -

    AllowOverRide specifies the parameters that - access files in subdirectories are not allowed to alter the value - for. If the parameter is set to none, no further - access files is parsed. +

    DIRECTIVE: "allow"

    +

    Syntax:Allow from subnet subnet|from all

    +Default:from all

    +

    +

    Same as the directive allow for the server config file.

    +
    + +

    DIRECTIVE: "AllowOverRide"

    +

    Syntax:AllowOverRide all | none | + Directives

    +Default:- None -

    +AllowOverRide Specify which parameters that not + access-files in subdirectories are allowed to alter the value + for. If the parameter is set to none no more + access-files will be parsed.

    -

    If only one access file exists, setting this parameter to - none can ease the burden on the server as the server - then stops looking for access files.

    -
    - "AuthGroupfile" - -

    Syntax: AuthGroupFile Filename

    -

    Default: none

    -

    AuthGroupFile indicates which file that contains the list - of groups. The filename must contain the absolute path to the - file. The format of the file is one group per row and +

    If only one access-file exists setting this parameter to + none can lessen the burden on the server since the server + will stop looking for access-files.

    +
    + +

    DIRECTIVE: "AuthGroupfile"

    +

    Syntax:AuthGroupFile Filename

    +Default:- None -

    +

    +

    AuthGroupFile indicates which file that contains the list + of groups. Filename must contain the absolute path to the + file. The format of the file is one group per row and every row contains the name of the group and the members - of the group, separated by a space, for example:

    + of the group separated by a space, for example:

    -GroupName: Member1 Member2 .... MemberN
    +GroupName: Member1 Member2 .... MemberN + +
    + +

    DIRECTIVE: "AuthName"

    +

    Syntax:AuthName auth-domain

    +Default:- None -

    +

    +

    Same as the directive AuthName for the server config file.

    +
    + +

    DIRECTIVE: "AuthType"

    +

    Syntax:AuthType Basic

    +Default:Basic

    +

    +

    AuthType Specify which authentication scheme that shall + be used. Today only Basic Authenticating using UUEncoding of + the password and user ID is implemented.

    - "AuthName" -

    Syntax: AuthName auth-domain

    -

    Default: none

    -

    Same as directive AuthName for the server - configuration file.

    -
    - "AuthType" - -

    Syntax: AuthType Basic

    -

    Default: Basic

    -

    AuthType specifies which authentication scheme to - be used. Only Basic Authenticating using UUEncoding of - the password and user ID is implemented.

    -
    - "AuthUserFile" - -

    Syntax: AuthUserFile Filename

    -

    Default:none

    -

    AuthUserFile indicates which file that contains the list - of users. The filename must contain the absolute path to the - file. The username and password are not encrypted so do not +

    DIRECTIVE: "AuthUserFile"

    +

    Syntax:AuthUserFile Filename

    +Default:- None -

    +

    +

    AuthUserFile indicate which file that contains the list + of users. Filename must contain the absolute path to the + file. The users name and password are not encrypted so do not place the file with users in a directory that is accessible - through the web server. The format of the file is one user per row. - Every row contains UserName and Password separated - by a colon, for example:

    + via the web server. The format of the file is one user per row + and every row contains User Name and Password separated by a + colon, for example:

     UserName:Password
    -UserName:Password
    +UserName:Password + +
    + +

    DIRECTIVE: "deny"

    +

    Syntax:deny from subnet subnet|from all

    +Context: Limit

    +

    Same as the directive deny for the server config file.

    - "deny" -

    Syntax: deny from subnet subnet | from all

    -

    Context: Limit

    -

    Same as directive deny for the server configuration file.

    -
    - "Limit" - -

    Syntax: RequestMethods>

    -

    Default: none

    -

    ]]> and </Limit> are used to enclose - a group of directives applying only to requests using - the specified methods. If no request method is specified, +

    DIRECTIVE: "Limit"

    +

    +

    Syntax: RequestMethods>

    +Default: - None -

    +

    +

    ]]> and </Limit> are used to enclose + a group of directives which applies only to requests using + the specified methods. If no request method is specified all request methods are verified against the restrictions.

    -

    Example:

     <Limit POST GET HEAD>
       order allow deny
       require group group1
       allow from 123.145.244.5
    -</Limit>
    +</Limit> +
    - "order" - -

    Syntax: order allow deny | deny allow

    -

    Default: allow deny

    -

    order defines if the deny or allow control is to - be performed first.

    -

    If the order is set to allow deny, the users - network address is first controlled to be in the allow subset. - If the user network address is not in the allowed subset, the user - is denied to get the asset. If the network address is in the - allowed subset, a second control is performed. That is, - the user network address is not in the subset of network - addresses to be denied as specified by parameter deny.

    -

    If the order is set to deny allow, only users from networks - specified to be in the allowed subset succeeds to request + +

    DIRECTIVE: "order"

    +Syntax:order allow deny | deny allow

    +Default: allow deny

    +

    +

    order, defines if the deny or allow control shall + be preformed first.

    +

    If the order is set to allow deny, then first the users + network address is controlled to be in the allow subset. If + the users network address is not in the allowed subset he will + be denied to get the asset. If the network-address is in the + allowed subset then a second control will be preformed, that + the users network address is not in the subset of network + addresses that shall be denied as specified by the deny + parameter.

    +

    If the order is set to deny allow then only users from networks + specified to be in the allowed subset will succeed to request assets in the limited area.

    - "require" - -

    Syntax: require - group group1 group2... | user user1 user2...

    -

    Default: none

    -

    Context: Limit

    -

    For more information, see directive require in - mod_auth(3).

    + +

    DIRECTIVE: "require"

    +

    Syntax:require + group group1 group2...|user user1 user2...

    +Default:- None -

    +Context: Limit

    +

    +

    See the require directive in the documentation of mod_auth(3) + for more information.

    -
    +
    + +
    Dynamic Web Pages - -

    Inets HTTP server provides two ways of creating dynamic web - pages, each with its own advantages and disadvantages:

    - - CGI scripts -

    Common Gateway Interface (CGI) scripts can be written - in any programming language. CGI scripts are standardized and - supported by most web servers. The drawback with CGI scripts is that - they are resource-intensive because of their design. CGI requires the - server to fork a new OS process for each executable it needs to start. -

    - ESI-functions -

    Erlang Server Interface (ESI) functions provide a tight and efficient - interface to the execution of Erlang functions. This interface, - on the other hand, is Inets specific.

    -
    - +

    The Inets HTTP server provides two ways of creating dynamic web + pages, each with its own advantages and disadvantages.

    +

    First there are CGI-scripts that can be written in any programming + language. CGI-scripts are standardized and supported by most + web servers. The drawback with CGI-scripts is that they are resource + intensive because of their design. CGI requires the server to fork a + new OS process for each executable it needs to start.

    +

    Second there are ESI-functions that provide a tight and efficient + interface to the execution of Erlang functions, this interface + on the other hand is Inets specific.

    +
    - CGI Version 1.1, RFC 3875 -

    The module mod_cgi enables execution of - CGI scripts - on the server. A file matching the definition of a - ScriptAlias config directive is treated as a CGI script. A CGI + The Common Gateway Interface (CGI) Version 1.1, RFC 3875. +

    The mod_cgi module makes it possible to execute CGI scripts + in the server. A file that matches the definition of a + ScriptAlias config directive is treated as a CGI script. A CGI script is executed by the server and its output is returned to - the client.

    -

    The CGI script response comprises a message header and a - message body, separated by a blank line. The message header - contains one or more header fields. The body can be - empty.

    -

    Example:

    + the client.

    +

    The CGI Script response comprises a message-header and a + message-body, separated by a blank line. The message-header + contains one or more header fields. The body may be + empty. Example:

    "Content-Type:text/plain\nAccept-Ranges:none\n\nsome very - plain text" + plain text" -

    The server interprets the message headers and most of them - are transformed into HTTP headers and sent back to the - client together with the message-body.

    -

    Support for CGI-1.1 is implemented in accordance with - RFC 3875.

    +

    The server will interpret the cgi-headers and most of them + will be transformed into HTTP headers and sent back to the + client together with the body.

    +

    Support for CGI-1.1 is implemented in accordance with the RFC + 3875.

    - ESI -

    The Erlang server interface is implemented by - module mod_esi.

    + Erlang Server Interface (ESI) +

    The erlang server interface is implemented by the + module mod_esi.

    - ERL Scheme + ERL Scheme

    The erl scheme is designed to mimic plain CGI, but without - the extra overhead. An URL that calls an Erlang erl function + the extra overhead. An URL which calls an Erlang erl function has the following syntax (regular expression):

    -http://your.server.org/***/Module[:/]Function(?QueryString|/PathInfo) -

    *** depends on how the ErlScriptAlias config - directive has been used.

    -

    The module Module referred to must be found in the code - path, and it must define a function Function with an arity - of two or three. It is preferable to implement a function - with arity three, as it permits to send chunks of the - web page to the client during the generation +http://your.server.org/***/Module[:/]Function(?QueryString|/PathInfo) + +

    *** above depends on how the ErlScriptAlias config + directive has been used

    +

    The module (Module) referred to must be found in the code + path, and it must define a function (Function) with an arity + of two or three. It is preferable to implement a funtion + with arity three as it permits you to send chunks of the + webpage beeing generated to the client during the generation phase instead of first generating the whole web page and then sending it to the client. The option to implement a function with arity two is only kept for backwards compatibility reasons. - For implementation details of the ESI callback function, - see mod_esi(3).

    + See mod_esi(3) for + implementation details of the esi callback function.

    - EVAL Scheme + EVAL Scheme

    The eval scheme is straight-forward and does not mimic the - behavior of plain CGI. An URL that calls an Erlang eval + behavior of plain CGI. An URL which calls an Erlang eval function has the following syntax:

    -http://your.server.org/***/Mod:Func(Arg1,...,ArgN) -

    *** depends on how the ErlScriptAlias config - directive has been used.

    -

    The module Mod referred to must be found in the code - path and data returned by the function Func is passed +http://your.server.org/***/Mod:Func(Arg1,...,ArgN) + +

    *** above depends on how the ErlScriptAlias config + directive has been used

    +

    The module (Mod) referred to must be found in the code + path, and data returned by the function (Func) is passed back to the client. Data returned from the - function must take the form as specified in - the CGI specification. For implementation details of the ESI - callback function, - see mod_esi(3).

    + function must furthermore take the form as specified in + the CGI specification. See mod_esi(3) for implementation details of the esi + callback function.

    The eval scheme can seriously threaten the - integrity of the Erlang node housing a web server, for - example:

    + integrity of the Erlang node housing a Web server, for + example:

    -http://your.server.org/eval?httpd_example:print(atom_to_list(apply(erlang,halt,[]))) -

    This effectively closes down the Erlang node. - Therefore, use the erl scheme instead, until this - security breach is fixed.

    -

    Today there are no good ways of solving this problem - and therefore the eval scheme can be removed in future - release of Inets.

    +http://your.server.org/eval?httpd_example:print(atom_to_list(apply(erlang,halt,[]))) + +

    which effectively will close down the Erlang node, + therefor, use the erl scheme instead, until this + security breach has been fixed.

    +

    Today there are no good way of solving this problem + and therefore Eval Scheme may be removed in future + release of Inets.

    + +
    - Logging - -

    Three types of logs are supported: transfer logs, - security logs, and error logs. The de-facto standard Common + Logging +

    There are three types of logs supported. Transfer logs, + security logs and error logs. The de-facto standard Common Logfile Format is used for the transfer and security logging. There are numerous statistics programs available to analyze Common Logfile Format. The Common Logfile Format looks as follows:

    remotehost rfc931 authuser [date] "request" status bytes

    -

    Here:

    remotehost - Remote hostname. + Remote hostname rfc931 - The client remote username (RFC 931). + The client's remote username (RFC 931). authuser - The username used for authentication. + The username with which the user authenticated himself. [date] - Date and time of the request (RFC 1123). + Date and time of the request (RFC 1123). "request" - The request line exactly as it came from the client (RFC 1945). + The request line exactly as it came from the client (RFC 1945). status - The HTTP status code returned to the client (RFC 1945). + The HTTP status code returned to the client (RFC 1945). bytes The content-length of the document transferred.

    Internal server errors are recorded in the error log file. The - format of this file is a more unplanned format than the logs using + format of this file is a more ad hoc format than the logs using Common Logfile Format, but conforms to the following syntax:

    [date] access to path failed for remotehost, reason: reason

    + +
    - +
    - Erlang Web Server API -

    The process of handling an HTTP request involves several steps, + Server Side Includes +

    Server Side Includes enables the server to run code embedded + in HTML pages to generate the response to the client.

    + +

    Having the server parse HTML pages is a double edged sword! + It can be costly for a heavily loaded server to perform + parsing of HTML pages while sending them. Furthermore, it can + be considered a security risk to have average users executing + commands in the name of the Erlang node user. Carefully + consider these items before activating server-side includes.

    +
    + +
    + + SERVER-SIDE INCLUDES (SSI) SETUP +

    The server must be told which filename extensions to be used + for the parsed files. These files, while very similar to HTML, + are not HTML and are thus not treated the same. Internally, the + server uses the magic MIME type text/x-server-parsed-html + to identify parsed documents. It will then perform a format + conversion to change these files into HTML for the + client. Update the mime.types file, as described in the + Mime Type Settings, to tell the server which extension to use + for parsed files, for example: +

    +
    +	text/x-server-parsed-html shtml shtm
    +        
    +

    This makes files ending with .shtml and .shtm + into parsed files. Alternatively, if the performance hit is not a + problem, all HTML pages can be marked as parsed: +

    +
    +	text/x-server-parsed-html html htm
    +        
    +
    + +
    + + Server-Side Includes (SSI) Format +

    All server-side include directives to the server are formatted + as SGML comments within the HTML page. This is in case the + document should ever find itself in the client's hands + unparsed. Each directive has the following format: +

    +
    +	<!--#command tag1="value1" tag2="value2" -->
    +        
    +

    Each command takes different arguments, most only accept one + tag at a time. Here is a breakdown of the commands and their + associated tags: +

    +

    The config directive controls various aspects of the + file parsing. There are two valid tags: +

    + + errmsg + +

    controls the message sent back to the client if an + error occurred while parsing the document. All errors are + logged in the server's error log.

    +
    + sizefmt + +

    determines the format used to display the size of + a file. Valid choices are bytes or + abbrev. bytes for a formatted byte count + or abbrev for an abbreviated version displaying + the number of kilobytes.

    +
    +
    +

    The include directory + will insert the text of a document into the parsed + document. This command accepts two tags:

    + + virtual + +

    gives a virtual path to a document on the + server. Only normal files and other parsed documents can + be accessed in this way.

    +
    + file + +

    gives a pathname relative to the current + directory. ../ cannot be used in this pathname, nor + can absolute paths. As above, you can send other parsed + documents, but you cannot send CGI scripts.

    +
    +
    +

    The echo directive prints the value of one of the include + variables (defined below). The only valid tag to this + command is var, whose value is the name of the + variable you wish to echo.

    +

    The fsize directive prints the size of the specified + file. Valid tags are the same as with the include + command. The resulting format of this command is subject + to the sizefmt parameter to the config + command.

    +

    The lastmod directive prints the last modification date of + the specified file. Valid tags are the same as with the + include command.

    +

    The exec directive executes a given shell command or CGI + script. Valid tags are:

    + + cmd + +

    executes the given string using /bin/sh. All + of the variables defined below are defined, and can be + used in the command.

    +
    + cgi + +

    executes the given virtual path to a CGI script and + includes its output. The server does not perform error + checking on the script output.

    +
    +
    +
    + +
    + + Server-Side Includes (SSI) Environment Variables +

    A number of variables are made available to parsed + documents. In addition to the CGI variable set, the following + variables are made available: +

    + + DOCUMENT_NAME + +

    The current filename.

    +
    + DOCUMENT_URI + +

    The virtual path to this document (such as + /docs/tutorials/foo.shtml).

    +
    + QUERY_STRING_UNESCAPED + +

    The unescaped version of any search query the client + sent, with all shell-special characters escaped with + \.

    +
    + DATE_LOCAL + +

    The current date, local time zone.

    +
    + DATE_GMT + +

    Same as DATE_LOCAL but in Greenwich mean time.

    +
    + LAST_MODIFIED + +

    The last modification date of the current document.

    +
    +
    +
    +
    + +
    + The Erlang Web Server API +

    The process of handling a HTTP request involves several steps such as:

    - Setting up connections, sending and receiving data. - URI to filename translation. - Authentication/access checks. - Retrieving/generating the response. - Logging. - -

    To provide customization and extensibility of the request - handling of the HTTP servers, most of these steps are handled by - one or more modules. These modules can be replaced or removed at - runtime and new ones can be added. For each request, all modules are - traversed in the order specified by the module directive in the - server configuration file. Some parts, mainly the communication- - related steps, are considered server core functionality and are - not implemented using the Erlang web server API. A description of - functionality implemented by the Erlang webserver API is described - in Section - Inets Web Server Modules.

    - + Seting up connections, sending and receiving data. + URI to filename translation + Authenication/access checks. + Retriving/generating the response. + Logging + +

    To provide customization and extensibility of the HTTP servers + request handling most of these steps are handled by one or more + modules that may be replaced or removed at runtime, and of course + new ones can be added. For each request all modules will be + traversed in the order specified by the modules directive in the + server configuration file. Some parts mainly the communication + related steps are considered server core functionality and are + not implemented using the Erlang Web Server API. A description of + functionality implemented by the Erlang Webserver API is described + in the section Inets Webserver Modules.

    A module can use data generated by previous modules in the - Erlang webserver API module sequence or generate data to be used - by consecutive Erlang Web Server API modules. This is - possible owing to an internal list of key-value tuples, referred to - as interaction data.

    + Erlang Webserver API module sequence or generate data to be used + by consecutive Erlang Web Server API modules. This is made + possible due to an internal list of key-value tuples, also referred to + as interaction data.

    Interaction data enforces module dependencies and - is to be avoided if possible. This means that the order - of modules in the modules property is significant.

    + should be avoided if possible. This means the order + of modules in the Modules property is significant.

    API Description -

    Each module that implements server functionality - using the Erlang web server API is to implement the following +

    Each module implements server functionality + using the Erlang Web Server API should implement the following call back functions:

    - do/1 (mandatory) - the function called when - a request is to be handled - load/2 - store/2 - remove/1 + do/1 (mandatory) - the function called when + a request should be handled. + load/2 + store/2 + remove/1

    The latter functions are needed only when new config - directives are to be introduced. For details, see - httpd(3).

    + directives are to be introduced. For details see + httpd(3)

    - Inets Web Server Modules - -

    The convention is that - all modules implementing some web server functionality has the - name mod_*. When configuring the web server, an appropriate - selection of these modules is to be present in the module - directive. Notice that there are some interaction dependencies - to take into account, so the order of the modules cannot be - random.

    - -
    - mod_action - Filetype/Method-Based Script Execution -

    This module runs CGI scripts whenever a file of a - certain type or HTTP method (see - RFC 1945) - is requested. + Inets Web Server Modules

    The convention is that + all modules implementing some webserver functionality has the + name mod_*. When configuring the web server an appropriate + selection of these modules should be present in the Module + directive. Please note that there are some interaction dependencies + to take into account so the order of the modules can not be + totally random.

    + +
    + mod_action - Filetype/Method-Based Script Execution. +

    Runs CGI scripts whenever a file of a + certain type or HTTP method (See RFC 1945) is requested.

    Uses the following Erlang Web Server API interaction data:

    - real_name - from mod_alias. + real_name - from mod_alias

    Exports the following Erlang Web Server API interaction data, if possible:

    @@ -546,51 +720,48 @@
    mod_alias - URL Aliasing -

    The mod_alias - module makes it possible to map different parts of the - host file system into the document tree, that is, creates aliases and +

    This module makes it possible to map different parts of the + host file system into the document tree e.i. creates aliases and redirections.

    Exports the following Erlang Web Server API interaction data, if possible:

    {real_name, PathData} - PathData is the argument used for API function - mod_alias:path/3. + PathData is the argument used for API function mod_alias:path/3.
    - mod_auth - User Authentication -

    The mod_auth(3) - module provides for basic user authentication using - textual files, Dets databases as well as Mnesia databases.

    + mod_auth - User Authentication +

    This module provides for basic user authentication using + textual files, dets databases as well as mnesia databases.

    Uses the following Erlang Web Server API interaction data:

    - real_name - from mod_alias + real_name - from mod_alias

    Exports the following Erlang Web Server API interaction data:

    {remote_user, User} - The username used for authentication. + The user name with which the user has authenticated himself.
    - Mnesia As Authentication Database + Mnesia as Authentication Database -

    If Mnesia is used as storage method, Mnesia must be - started before the HTTP server. The first time Mnesia is - started, the schema and the tables must be created before - Mnesia is started. A simple example of a module with two - functions that creates and start Mnesia is provided - here. Function first_start/0 is to be used the first - time. It creates the schema and the tables. - start/0 is to be used in consecutive startups. - start/0 starts Mnesia and waits for the tables to +

    If Mnesia is used as storage method, Mnesia must be + started prio to the HTTP server. The first time Mnesia is + started the schema and the tables must be created before + Mnesia is started. A naive example of a module with two + functions that creates and start mnesia is provided + here. The function shall be used the first + time. first_start/0 creates the schema and the tables. The + second function start/0 shall be used in consecutive + startups. start/0 Starts Mnesia and wait for the tables to be initiated. This function must only be used when the - schema and the tables are already created.

    + schema and the tables already is created.

    -module(mnesia_test). @@ -614,28 +785,28 @@ start() -> mnesia:start(), - mnesia:wait_for_tables([httpd_user, httpd_group], 60000). + mnesia:wait_for_tables([httpd_user, httpd_group], 60000). + -

    To create the Mnesia tables, we use two records defined in - mod_auth.hrl, so that file must be included. first_start/0 - creates a schema that specifies on which nodes the database is to reside. - Then it starts Mnesia and creates the tables. The first argument - is the name of the tables, the second argument is a list of options of - how to create the table, see - mnesia, documentation for - more information. As the implementation of the mod_auth_mnesia - saves one row for each user, the type must be bag. - When the schema and the tables are created, function - mnesia:start/0 - is used to start Mnesia and - waits for the tables to be loaded. Mnesia uses the - directory specified as mnesia_dir at startup if specified, - otherwise Mnesia uses the current directory. For security - reasons, ensure that the Mnesia tables are stored outside - the document tree of the HTTP server. If they are placed in the - directory which it protects, clients can download the tables. - Only the Dets and Mnesia storage - methods allow writing of dynamic user data to disk. plain is +

    To create the Mnesia tables we use two records defined in + mod_auth.hrl so the file must be included. The first + function first_start/0 creates a schema that specify on + which nodes the database shall reside. Then it starts Mnesia + and creates the tables. The first argument is the name of + the tables, the second argument is a list of options how the + table will be created, see Mnesia documentation for more + information. Since the current implementation of the + mod_auth_mnesia saves one row for each user the type must be + bag. When the schema and the tables is created the second + function start/0 shall be used to start Mensia. It starts + Mnesia and wait for the tables to be loaded. Mnesia use the + directory specified as mnesia_dir at startup if specified, + otherwise Mnesia use the current directory. For security + reasons, make sure that the Mnesia tables are stored outside + the document tree of the HTTP server. If it is placed in the + directory which it protects, clients will be able to + download the tables. Only the dets and mnesia storage + methods allow writing of dynamic user data to disk. plain is a read only method.

    @@ -643,19 +814,19 @@
    mod_cgi - CGI Scripts -

    This module handles invoking of CGI scripts.

    +

    This module handles invoking of CGI scripts

    mod_dir - Directories

    This module generates an HTML directory listing (Apache-style) if a client sends a request for a directory - instead of a file. This module must be removed from the + instead of a file. This module needs to be removed from the Modules config directive if directory listings is unwanted.

    Uses the following Erlang Web Server API interaction data:

    - real_name - from mod_alias + real_name - from mod_alias

    Exports the following Erlang Web Server API interaction data:

    @@ -667,27 +838,27 @@
    - mod_disk_log - Logging Using Disk_Log. + mod_disk_log - Logging Using disk_log.

    Standard logging using the "Common Logfile Format" and - kernel:disk_log(3).

    + disk_log(3).

    Uses the following Erlang Web Server API interaction data:

    - remote_user - from mod_auth + remote_user - from mod_auth
    mod_esi - Erlang Server Interface -

    The mod_esi(3) - module implements the Erlang Server Interface (ESI) providing a - tight and efficient interface to the execution of Erlang functions.

    -

    Uses the following Erlang web server API interaction data: +

    This module implements + the Erlang Server Interface (ESI) that provides a tight and + efficient interface to the execution of Erlang functions.

    +

    Uses the following Erlang Web Server API interaction data:

    - remote_user - from mod_auth + remote_user - from mod_auth -

    Exports the following Erlang web server API interaction data: +

    Exports the following Erlang Web Server API interaction data:

    {mime_type, MimeType} @@ -699,11 +870,11 @@
    mod_get - Regular GET Requests

    This module is responsible for handling GET requests to regular - files. GET requests for parts of files is handled by mod_range.

    -

    Uses the following Erlang web server API interaction data: + files. GET requests for parts of files is handled by mod_range.

    +

    Uses the following Erlang Web Server API interaction data:

    - real_name - from mod_alias + real_name - from mod_alias
    @@ -715,7 +886,7 @@

    Uses the following Erlang Web Server API interaction data:

    - real_name - from mod_alias + real_name - from mod_alias
    @@ -726,97 +897,120 @@

    Uses the following Erlang Web Server API interaction data:

    - real_name - from mod_alias + real_name - from mod_alias

    Exports the following Erlang Web Server API interaction data:

    {remote_user_name, User} - The username used for authentication. + The user name with which the user has authenticated himself.
    +
    + mod_include - SSI +

    This module makes it possible to expand "macros" embedded in + HTML pages before they are delivered to the client, that is + Server-Side Includes (SSI). +

    +

    Uses the following Erlang Webserver API interaction data: +

    + + real_name - from mod_alias + remote_user - from mod_auth + +

    Exports the following Erlang Webserver API interaction data: +

    + + {mime_type, MimeType} + The file suffix of the incoming URL mapped into a + MimeType as defined in the Mime Type Settings + section. + +
    +
    mod_log - Logging Using Text Files.

    Standard logging using the "Common Logfile Format" and text files.

    -

    Uses the following Erlang Web Server API interaction data: +

    Uses the following Erlang Webserver API interaction data:

    - remote_user - from mod_auth + remote_user - from mod_auth
    mod_range - Requests with Range Headers -

    This module responses to requests for one or many ranges of a - file. This is especially useful when downloading large files, - as a broken download can be resumed.

    -

    Notice that request for multiple parts of a document report a +

    This module response to requests for one or many ranges of a + file. This is especially useful when downloading large files, + since a broken download may be resumed.

    +

    Note that request for multiple parts of a document will report a size of zero to the log file.

    -

    Uses the following Erlang Web Server API interaction data: +

    Uses the following Erlang Webserver API interaction data:

    - real_name - from mod_alias + real_name - from mod_alias
    mod_response_control - Requests with If* Headers -

    This module controls that the conditions in the requests are - fulfilled. For example, a request can specify that the answer - only is of interest if the content is unchanged since the last - retrieval. If the content is changed, the range request is to - be converted to a request for the whole file instead.

    -

    If a client sends more than one of the header fields that - restricts the servers right to respond, the standard does not - specify how this is to be handled. - httpd(3) controls each - field in the following order and if one of the fields does not - match the current state, the request is rejected with a proper - response:

    -

    If-modified

    -

    If-Unmodified

    -

    If-Match

    -

    If-Nomatch

    +

    This module controls that the conditions in the requests is + fulfilled. For example a request may specify that the answer + only is of interest if the content is unchanged since last + retrieval. Or if the content is changed the range-request shall + be converted to a request for the whole file instead.

    If + a client sends more then one of the header fields that restricts + the servers right to respond, the standard does not specify how + this shall be handled. httpd will control each field in the + following order and if one of the fields not match the current + state the request will be rejected with a proper response. +

    -

    Uses the following Erlang Web Server API interaction data: + 1.If-modified

    + + 2.If-Unmodified

    + + 3.If-Match

    + + 4.If-Nomatch

    +

    +

    Uses the following Erlang Webserver API interaction data:

    - real_name - from mod_alias + real_name - from mod_alias -

    Exports the following Erlang Web Server API interaction data: +

    Exports the following Erlang Webserver API interaction data:

    {if_range, send_file} - The conditions for the range request are not fulfilled. + The conditions for the range request was not fulfilled. The response must not be treated as a range request, instead it - must be treated as an ordinary get request. + must be treated as a ordinary get request.
    mod_security - Security Filter -

    The mod_security - module serves as a filter for authenticated requests - handled in mod_auth(3). - It provides a possibility to restrict users from - access for a specified amount of time if they fail to +

    This module serves as a filter for authenticated requests + handled in mod_auth. It provides possibility to restrict users + from access for a specified amount of time if they fail to authenticate several times. It logs failed authentication as - well as blocking of users, and it calls a configurable - callback module when the events occur.

    + well as blocking of users, and it also calls a configurable + call-back module when the events occur.

    There is also an - API to block or unblock users manually. This API can also list - blocked users or users who have been authenticated within a - configurable amount of time.

    + API to manually block, unblock and list blocked users or users, + who have been authenticated within a configurable amount of + time.

    mod_trace - TRACE Request -

    mod_trace is responsible for handling of TRACE requests. +

    mod_trace is responsible for handling of TRACE requests. Trace is a new request method in HTTP/1.1. The intended use of trace requests is for testing. The body of the trace response is - the request message that the responding web server or proxy + the request message that the responding Web server or proxy received.

    diff -Nru erlang-18.2-dfsg/lib/inets/doc/src/http_uri.xml erlang-17.3-dfsg/lib/inets/doc/src/http_uri.xml --- erlang-18.2-dfsg/lib/inets/doc/src/http_uri.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/doc/src/http_uri.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 20122015 + 20122013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -35,151 +34,124 @@

    This module provides utility functions for working with URIs, - according to - RFC 3986.

    + according to RFC 3986.

    +
    - DATA TYPES + COMMON DATA TYPES

    Type definitions that are used more than once in this module:

    -

    boolean() = true | false

    -

    string() = list of ASCII characters

    +
    - URI DATA TYPES + URI DATA TYPES

    Type definitions that are related to URI:

    - - - uri() = string() -

    Syntax according to the URI definition in RFC 3986, - for example, "http://www.erlang.org/"

    - user_info() = string() -

    - scheme() = atom() -

    Example: http, https

    - host() = string() -

    - port() = pos_integer() -

    - path() = string() -

    Represents a file path or directory path

    - query() = string() -

    - fragment() = string() -

    -
    - -

    For more information about URI, see - RFC 3986.

    +

    For more information about URI, see RFC 3986.

    + + +
    - decode(HexEncodedURI) -> URI - - Decodes a hexadecimal encoded URI. - - HexEncodedURI = string() - A possibly hexadecimal encoded URI - URI = uri() - - - -

    Decodes a possibly hexadecimal encoded URI.

    - -
    -
    - - encode(URI) -> HexEncodedURI - - Encodes a hexadecimal encoded URI. + scheme_defaults() -> SchemeDefaults + A list of scheme and their default ports - URI = uri() - HexEncodedURI = string() - Hexadecimal encoded URI + SchemeDefaults = [{scheme(), default_scheme_port_number()}] + default_scheme_port_number() = pos_integer() - -

    Encodes a hexadecimal encoded URI.

    +

    This function provides a list of the scheme and their default + port numbers currently supported (by default) by this utility.

    - +
    parse(URI) -> {ok, Result} | {error, Reason} parse(URI, Options) -> {ok, Result} | {error, Reason} - Parses a URI. + Parse an URI - URI = uri() - Options = [Option] + URI = uri() + Options = [Option] Option = {ipv6_host_with_brackets, boolean()} | - {scheme_defaults, scheme_defaults()} | - {fragment, boolean()} | - {schema_validation_fun, fun()}] - Result = {Scheme, UserInfo, Host, Port, Path, Query} | - {Scheme, UserInfo, Host, Port, Path, Query, Fragment} + {scheme_defaults, scheme_defaults()}] + Result = {Scheme, UserInfo, Host, Port, Path, Query} UserInfo = user_info() Host = host() Port = pos_integer() Path = path() Query = query() - Fragment = fragment() - Reason = term() + Reason = term() -

    Parses a URI. If no scheme defaults - are provided, the value of the +

    This function is used to parse an URI. If no scheme defaults + are provided, the value of scheme_defaults - function is used.

    + function will be used.

    -

    When parsing a URI with an unknown scheme (that is, - a scheme not found in the scheme defaults), a port number must be - provided, otherwise the parsing fails.

    +

    Note that when parsing an URI with an unknown scheme (that is, + a scheme not found in the scheme defaults) a port number must be + provided or else the parsing will fail.

    -

    If the fragment option is true, the URI fragment is returned as - part of the parsing result, otherwise it is ignored.

    - -

    Scheme validation fun is to be defined as follows:

    + +
    +
    - -fun(SchemeStr :: string()) -> - valid | {error, Reason :: term()}. - + + encode(URI) -> HexEncodedURI + + Hex encode an URI + + URI = uri() + HexEncodedURI = string() - Hex encoded uri + -

    It is called before scheme string gets converted into scheme atom and - thus possible atom leak could be prevented

    + +

    Hex encode an URI.

    - +
    - scheme_defaults() -> SchemeDefaults - A list of the scheme and their default ports. + decode(HexEncodedURI) -> URI + + Decode a hex encoded URI - SchemeDefaults = [{scheme(), default_scheme_port_number()}] - default_scheme_port_number() = pos_integer() + HexEncodedURI = string() - A possibly hex encoded uri + URI = uri() + -

    Provides a list of the scheme and their default - port numbers supported (by default) by this utility.

    +

    Decode a possibly hex encoded URI.

    -
    - -
    +

    [httpc] Deprecated interface module http has been removed. It has (long) been replaced by http client interface module - httpc.

    + httpc.

    Own Id: OTP-9359

    @@ -1416,13 +989,15 @@
    Inets 5.6
    Improvements and New Features - +

    [httpc] Add support for upload body streaming (PUT and POST).

    For more info, see the definition of the Body argument of the - request/[4,5] + request/4,5 function.

    Filipe David Manana

    Own Id: OTP-9094

    @@ -1435,7 +1010,7 @@

    [httpd] - mod_esi:deliver/2 + mod_esi:deliver/2 made to accept binary data.

    Bernard Duggan

    Own Id: OTP-9123

    @@ -1463,7 +1038,7 @@ for using file descriptors has been improved. It is now possible to add the file descriptor to the config (option fd) when calling the - inets:start(httpd, ...) + inets:start(httpd, ...) function.

    Attila Rajmund Nohl

    Own Id: OTP-9202

    @@ -1477,7 +1052,7 @@

    See the httpd socket_type communication property or the httpc - request/[4,5] function + request/4,5 function for more info.

    Own Id: OTP-9230

    *** POTENTIAL INCOMPATIBILITY ***

    @@ -1677,7 +1252,7 @@

    [httpc|httpd] - Now allow the use of the "new" ssl, by using the essl tag instead.

    See the http_option option in the - request/[4,5] or + request/4,5 or the socket-type section of the Communication properties chapter for more info,

    Own Id: OTP-7907

    @@ -1872,21 +1447,23 @@

    [httpd] - Issues with ESI erl_script_timeout.

    - - -

    The erl_script_timeout config option is ducumented - as a number of seconds. But when parsing the config, in the - new format (not a config file), it was handled as if in - number of milliseconds.

    -
    - -

    When the erl-script-timeout time was exceeded, the server - incorrectly marked the answer as sent, thereby leaving - client hanging (with an incomplete answer). - This has been changed, so that now the socket will be - closed.

    -
    -
    +

    + + +

    The erl_script_timeout config option is ducumented + as a number of seconds. But when parsing the config, in the + new format (not a config file), it was handled as if in + number of milliseconds.

    +
    + +

    When the erl-script-timeout time was exceeded, the server + incorrectly marked the answer as sent, thereby leaving + client hanging (with an incomplete answer). + This has been changed, so that now the socket will be + closed.

    +
    +
    +

    Own Id: OTP-8509

    @@ -1907,8 +1484,8 @@

    [httpc] - Allow users to pass socket options to the transport module when making requests.

    See the socket_opts option in the - request/4 or - set_options/[1,2] + request/4 or + set_options/1,2 for more info,

    Own Id: OTP-8352

    @@ -1949,7 +1526,7 @@ deliver an async reply to more receivers then the calling process.

    See the - receiver + receiver option for more info,

    Own Id: OTP-8106

    @@ -1962,19 +1539,20 @@

    [httpc] Several more or less critical fixes:

    - - -

    Initial call between the httpc manager and request - handler was synchronous.

    -

    When the manager starts a new request handler, - this is no longer a synchronous operation. Previously, - the new request handler made the connection to the - server and issuing of the first request (the reason - for starting it) in the gen_server init function. - If the connection for some reason "took some time", - the manager hanged, leaving all other activities by - that manager also hanging.

    -
    +

    + + +

    Initial call between the httpc manager and request + handler was synchronous.

    +

    When the manager starts a new request handler, + this is no longer a synchronous operation. Previously, + the new request handler made the connection to the + server and issuing of the first request (the reason + for starting it) in the gen_server init function. + If the connection for some reason "took some time", + the manager hanged, leaving all other activities by + that manager also hanging.

    +
    - + +

    As a side-effect of these changes, some modules was also renamed, and a new api module, httpc, has been introduced @@ -2216,7 +1795,7 @@ request, when the client connects to the server. Default value is that of the timeout option.

    See the - request/[4,5] + request/4,5 function for more info.

    Own Id: OTP-7298

    @@ -2323,7 +1902,7 @@ the client connects to the server.

    As a side-effect of this, the option ipv6 has been removed and replaced by the ipfamily option.

    -

    See http:set_options/[1,2] +

    See http:set_options/1,2 for more info.

    *** POTENTIAL INCOMPATIBILITY ***

    Own Id: OTP-8004

    diff -Nru erlang-18.2-dfsg/lib/inets/doc/src/part_notes_history.xml erlang-17.3-dfsg/lib/inets/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/lib/inets/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/inets/doc/src/part_notes.xml erlang-17.3-dfsg/lib/inets/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/inets/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/inets/doc/src/part.xml erlang-17.3-dfsg/lib/inets/doc/src/part.xml --- erlang-18.2-dfsg/lib/inets/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -30,18 +29,10 @@ part.sgml
    -

    The Inets application provides a set of - Internet-related services as follows:

    - - An FTP client - A TFTP client and server - An client and server - -

    The HTTP client and server are HTTP 1.1 compliant as - defined in - RFC 2616.

    +

    The Inets Application provides a set of Internet + related services. Currently supported are a HTTP client, a HTTP + server a FTP client and a TFTP client and server.

    - diff -Nru erlang-18.2-dfsg/lib/inets/doc/src/ref_man.xml erlang-17.3-dfsg/lib/inets/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/inets/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19972015 + 19972013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -30,16 +29,16 @@ ref_man.xml
    -

    Inets is a container for Internet clients and - servers. An FTP client, an HTTP client and server, and - a TFTP client and server are incorporated in Inets.

    +

    Inets is a container for Internet clients and + servers. Currently a FTP client, a HTTP client and server, and + a tftp client and server has been incorporated in Inets.

    - + diff -Nru erlang-18.2-dfsg/lib/inets/doc/src/tftp.xml erlang-17.3-dfsg/lib/inets/doc/src/tftp.xml --- erlang-18.2-dfsg/lib/inets/doc/src/tftp.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/doc/src/tftp.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 20062015 + 20062013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -29,170 +28,173 @@
    tftp - Trivial FTP. + Trivial FTP

    This is a complete implementation of the following IETF standards:

    - RFC 1350, The TFTP Protocol (revision 2) - RFC 2347, TFTP Option Extension - RFC 2348, TFTP Blocksize Option - RFC 2349, TFTP Timeout Interval and Transfer Size Options + RFC 1350, The TFTP Protocol (revision 2). + RFC 2347, TFTP Option Extension. + RFC 2348, TFTP Blocksize Option. + RFC 2349, TFTP Timeout Interval and Transfer Size Options. -

    The only feature that not is implemented is +

    The only feature that not is implemented in this release is the "netascii" transfer mode.

    The start/1 function starts - a daemon process listening for UDP packets on a port. When it - receives a request for read or write, it spawns a temporary server - process handling the transfer.

    -

    On the client side, - function read_file/3 + a daemon process which listens for UDP packets on a port. When it + receives a request for read or write it spawns a temporary server + process which handles the actual transfer of the file.

    +

    On the client side + the read_file/3 and write_file/3 - spawn a temporary client process establishing - contact with a TFTP daemon and perform the file transfer.

    -

    tftp uses a callback module to handle the file + functions spawns a temporary client process which establishes + contact with a TFTP daemon and performs the actual transfer of + the file.

    +

    tftp uses a callback module to handle the actual file transfer. Two such callback modules are provided, tftp_binary and tftp_file. See read_file/3 and - write_file/3 for details. - You can also implement your own callback modules, see - CALLBACK FUNCTIONS. - A callback module provided by - the user is registered using option callback, see - DATA TYPES.

    + write_file/3 for + more information about these. The user can also implement own + callback modules, see CALLBACK FUNCTIONS below. A callback module provided by + the user is registered using the callback option, see + DATA TYPES below.

    - TFTP SERVER SERVICE START/STOP + TFTP SERVER SERVICE START/STOP

    A TFTP server can be configured to start statically when starting - the Inets application. Alternatively, it can be started dynamically - (when Inets is already started) by calling the Inets application - API inets:start(tftpd, ServiceConfig) or + the Inets application. Alternatively it can be started dynamically + (when Inets already is started) by calling the Inets application API + inets:start(tftpd, ServiceConfig), or inets:start(tftpd, ServiceConfig, How), see inets(3) for details. - The ServiceConfig for TFTP is described in - the DATA TYPES + The ServiceConfig for TFTP is described below in + the COMMON DATA TYPES section.

    The TFTP server can be stopped using inets:stop(tftpd, Pid), see inets(3) for details.

    The TPFT client is of such a temporary nature that it is not - handled as a service in the Inets service framework.

    + handled as a service in the Inets service framework.

    - DATA TYPES -

    ServiceConfig = Options

    -

    Options = [option()]

    + COMMON DATA TYPES +
    +      ServiceConfig = Options
    +      Options = [option()]
    +      option() -- see below
    +    

    Most of the options are common for both the client and the server - side, but some of them differs a little. - The available option()s are as follows:

    + side, but some of them differs a little. Here are the available + options:

    {debug, Level}

    Level = none | error | warning | brief | normal | verbose | all

    -

    Controls the level of debug printouts. - Default is none.

    +

    Controls the level of debug printouts. The default is + none.

    {host, Host} -

    Host = hostname(), see - inet(3).

    +

    Host = hostname() see + inet(3)

    The name or IP address of the host where the TFTP daemon resides. This option is only used by the client.

    {port, Port}

    Port = int()

    -

    The TFTP port where the daemon listens. Defaults is - the standardized number 69. On the server side, it can - sometimes make sense to set it to 0, meaning that - the daemon just picks a free port (which one is - returned by function info/1).

    -

    If a socket is connected already, option - {udp, [{fd, integer()}]} can be used to pass the - open file descriptor to gen_udp. This can be automated - by using a command-line argument stating the +

    The TFTP port where the daemon listens. It defaults to + the standardized number 69. On the server side it may + sometimes make sense to set it to 0, which means that + the daemon just will pick a free port (which one is + returned by the info/1 function).

    +

    If a socket has somehow already has been connected, the + {udp, [{fd, integer()}]} option can be used to pass the + open file descriptor to gen_udp. This can be automated + a bit by using a command line argument stating the prebound file descriptor number. For example, if the - port is 69 and file descriptor 22 is opened by - setuid_socket_wrap, the command-line argument - "-tftpd_69 22" triggers the prebound file + Port is 69 and the file descriptor 22 has been opened by + setuid_socket_wrap. Then the command line argument + "-tftpd_69 22" will trigger the prebound file descriptor 22 to be used instead of opening port 69. - The UDP option {udp, [{fd, 22}]} is automatically added. - See init:get_argument/ about command-line arguments and - gen_udp:open/2 about UDP options.

    + The UDP option {udp, [{fd, 22}]} automatically be added. + See init:get_argument/ about command line arguments and + gen_udp:open/2 about UDP options.

    {port_policy, Policy} -

    Policy = random | Port | {range, MinPort, MaxPort}

    -

    Port = MinPort = MaxPort = int()

    -

    Policy for the selection of the temporary port that is used - by the server/client during the file transfer. Default is - random, which is the standardized policy. With this - policy a randomized free port is used. A single port or a range - of ports can be useful if the protocol passes through a +

    Policy = random | Port | {range, MinPort, MaxPort}

    +Port = MinPort = MaxPort = int()

    +

    Policy for the selection of the temporary port which is used + by the server/client during the file transfer. It defaults to + random which is the standardized policy. With this + policy a randomized free port used. A single port or a range + of ports can be useful if the protocol should pass through a firewall.

    {udp, Options} -

    Options = [Opt], see - gen_udp:open/2.

    +

    Options = [Opt] see + gen_udp:open/2

    {use_tsize, Bool}

    Bool = bool()

    -

    Flag for automated use of option tsize. With - this set to true, the write_file/3 client - determines the filesize and sends it to the server as +

    Flag for automated usage of the tsize option. With + this set to true, the write_file/3 client will + determine the filesize and send it to the server as the standardized tsize option. A read_file/3 - client acquires only a filesize from the server by sending + client will just acquire filesize from the server by sending a zero tsize.

    {max_tsize, MaxTsize}

    MaxTsize = int() | infinity

    Threshold for the maximal filesize in bytes. The transfer - is aborted if the limit is exceeded. - Default is infinity.

    + will be aborted if the limit is exceeded. It defaults to + infinity.

    {max_conn, MaxConn}

    MaxConn = int() | infinity

    Threshold for the maximal number of active connections. - The daemon rejects the setup of new connections if - the limit is exceeded. Default is infinity.

    + The daemon will reject the setup of new connections if + the limit is exceeded. It defaults to infinity.

    {TftpKey, TftpVal}

    TftpKey = string()

    TftpVal = string()

    -

    Name and value of a TFTP option.

    +

    The name and value of a TFTP option.

    {reject, Feature}

    Feature = Mode | TftpKey

     Mode = read | write

     TftpKey = string()

    -

    Controls which features to reject. This is - mostly useful for the server as it can restrict the use - of certain TFTP options or read/write access.

    +

    Control which features that should be rejected. This is + mostly useful for the server as it may restrict usage of + certain TFTP options or read/write access.

    {callback, {RegExp, Module, State}}

    RegExp = string()

    Module = atom()

    -State = term()

    +State = term()

    Registration of a callback module. When a file is to be - transferred, its local filename is matched to the regular + transferred, its local filename will be matched to the regular expressions of the registered callbacks. The first matching - callback is used during the transfer. See + callback will be used the during the transfer. See read_file/3 and write_file/3.

    -

    The callback module must implement the tftp behavior, see +

    The callback module must implement the tftp behavior, CALLBACK FUNCTIONS.

    @@ -200,9 +202,9 @@

    Module = module()()

    -

    Callback module for customized logging of errors, warnings, and - info messages. The callback module must implement the - tftp_logger behavior, see +

    Callback module for customized logging of error, warning and + info messages. >The callback module must implement the + tftp_logger behavior, LOGGER FUNCTIONS. The default module is tftp_logger.

    @@ -212,169 +214,199 @@

    MaxRetries = int()

    Threshold for the maximal number of retries. By default - the server/client tries to resend a message up to - five times when the time-out expires.

    + the server/client will try to resend a message up to + 5 times when the timeout expires.

    + +
    - change_config(daemons, Options) -> [{Pid, Result}] - Changes configuration for all daemons. - + start(Options) -> {ok, Pid} | {error, Reason} + Start a daemon process Options = [option()] Pid = pid() - Result = ok | {error, Reason} Reason = term() -

    Changes configuration for all TFTP daemon processes.

    +

    Starts a daemon process which listens for udp packets on a + port. When it receives a request for read or write it spawns + a temporary server process which handles the actual transfer + of the (virtual) file.

    + +
    - change_config(servers, Options) -> [{Pid, Result}] - Changes configuration for all servers. - + read_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason} + Read a (virtual) file from a TFTP server + RemoteFilename = string() + LocalFilename = binary | string() Options = [option()] - Pid = pid() - Result = ok | {error, Reason} + LastCallbackState = term() Reason = term() -

    Changes configuration for all TFTP server processes.

    +

    Reads a (virtual) file RemoteFilename from a TFTP + server.

    +

    If LocalFilename is the atom binary, + tftp_binary is used as callback module. It concatenates + all transferred blocks and returns them as one single binary + in LastCallbackState.

    +

    If LocalFilename is a string and there are no + registered callback modules, tftp_file is used as + callback module. It writes each transferred block to the file + named LocalFilename and returns the number of + transferred bytes in LastCallbackState.

    +

    If LocalFilename is a string and there are registered + callback modules, LocalFilename is tested against + the regexps of these and the callback module corresponding to + the first match is used, or an error tuple is returned if no + matching regexp is found.

    + +
    - change_config(Pid, Options) -> Result - Changes configuration for a TFTP daemon, server, - or client process. + write_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason} + Write a (virtual) file to a TFTP server - Pid = pid() + RemoteFilename = string() + LocalFilename = binary() | string() Options = [option()] - Result = ok | {error, Reason} + LastCallbackState = term() Reason = term() -

    Changes configuration for a TFTP daemon, server, or client process.

    +

    Writes a (virtual) file RemoteFilename to a TFTP + server.

    +

    If LocalFilename is a binary, tftp_binary is + used as callback module. The binary is transferred block by + block and the number of transferred bytes is returned in + LastCallbackState.

    +

    If LocalFilename is a string and there are no + registered callback modules, tftp_file is used as + callback module. It reads the file named LocalFilename + block by block and returns the number of transferred bytes + in LastCallbackState.

    +

    If LocalFilename is a string and there are registered + callback modules, LocalFilename is tested against + the regexps of these and the callback module corresponding to + the first match is used, or an error tuple is returned if no + matching regexp is found.

    + +
    - + info(daemons) -> [{Pid, Options}] - Returns information about all daemons. + Return information about all daemons Pid = [pid()()] Options = [option()] Reason = term() -

    Returns information about all TFTP daemon processes.

    +

    Returns info about all TFTP daemon processes.

    + +
    info(servers) -> [{Pid, Options}] - Returns information about all servers. + Return information about all servers Pid = [pid()()] Options = [option()] Reason = term() -

    Returns information about all TFTP server processes.

    +

    Returns info about all TFTP server processes.

    + +
    info(Pid) -> {ok, Options} | {error, Reason} - Returns information about a daemon, server, or client process. + Return information about a daemon, server or client process Options = [option()] Reason = term() -

    Returns information about a TFTP daemon, server, or client process.

    +

    Returns info about a TFTP daemon, server or client process.

    + +
    - - - read_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason} - Reads a (virtual) file from a TFTP server. + + + change_config(daemons, Options) -> [{Pid, Result}] + Changes config for all daemons + - RemoteFilename = string() - LocalFilename = binary | string() Options = [option()] - LastCallbackState = term() + Pid = pid() + Result = ok | {error, Reason} Reason = term() -

    Reads a (virtual) file RemoteFilename from a TFTP - server.

    -

    If LocalFilename is the atom binary, - tftp_binary is used as callback module. It concatenates - all transferred blocks and returns them as one single binary - in LastCallbackState.

    -

    If LocalFilename is a string and there are no - registered callback modules, tftp_file is used as - callback module. It writes each transferred block to the file - named LocalFilename and returns the number of - transferred bytes in LastCallbackState.

    -

    If LocalFilename is a string and there are registered - callback modules, LocalFilename is tested against - the regexps of these and the callback module corresponding to - the first match is used, or an error tuple is returned if no - matching regexp is found.

    -
    +

    Changes config for all TFTP daemon processes.

    + + +
    - + - start(Options) -> {ok, Pid} | {error, Reason} - Starts a daemon process. + change_config(servers, Options) -> [{Pid, Result}] + Changes config for all servers + Options = [option()] Pid = pid() + Result = ok | {error, Reason} Reason = term() -

    Starts a daemon process listening for UDP packets on a - port. When it receives a request for read or write, it spawns - a temporary server process handling the actual transfer - of the (virtual) file.

    +

    Changes config for all TFTP server processes.

    + +
    - write_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason} - Writes a (virtual) file to a TFTP server. + change_config(Pid, Options) -> Result + Changes config for a TFTP daemon, server or client process - RemoteFilename = string() - LocalFilename = binary() | string() + Pid = pid() Options = [option()] - LastCallbackState = term() + Result = ok | {error, Reason} Reason = term() -

    Writes a (virtual) file RemoteFilename to a TFTP - server.

    -

    If LocalFilename is a binary, tftp_binary is - used as callback module. The binary is transferred block by - block and the number of transferred bytes is returned in - LastCallbackState.

    -

    If LocalFilename is a string and there are no - registered callback modules, tftp_file is used as - callback module. It reads the file named LocalFilename - block by block and returns the number of transferred bytes - in LastCallbackState.

    -

    If LocalFilename is a string and there are registered - callback modules, LocalFilename is tested against - the regexps of these and the callback module corresponding to - the first match is used, or an error tuple is returned if no - matching regexp is found.

    +

    Changes config for a TFTP daemon, server or client process

    + + +
    +
    + + + start() -> ok | {error, Reason} + Start the Inets application + + Reason = term() + + +

    Starts the Inets application.

    @@ -382,41 +414,40 @@
    CALLBACK FUNCTIONS -

    A tftp callback module is to be implemented as a - tftp behavior and export the functions listed - in the following.

    -

    On the server side, the callback interaction starts with a call to +

    A tftp callback module should be implemented as a + tftp behavior and export the functions listed below.

    +

    On the server side the callback interaction starts with a call to open/5 with the registered initial callback state. open/5 is expected to open the (virtual) file. Then either - function read/1 or write/2 is invoked - repeatedly, once per transferred block. At each function call, + the read/1 or write/2 functions are invoked + repeatedly, once per transferred block. At each function call the state returned from the previous call is obtained. When - the last block is encountered, function read/1 or - write/2 is expected to close the (virtual) file - and return its last state. Function abort/3 is only - used in error situations. Function prepare/5 is not used on + the last block has been encountered the read/1 or + write/2 functions is expected to close the (virtual) file + and return its last state. The abort/3 function is only + used in error situations. prepare/5 is not used on the server side.

    -

    On the client side, the callback interaction is the same, but it +

    On the client side the callback interaction is the same, but it starts and ends a bit differently. It starts with a call to prepare/5 with the same arguments as open/5 takes. - prepare/5 is expected to validate the TFTP options - suggested by the user and to return the subset of them that it - accepts. Then the options are sent to the server, which performs + prepare/5 is expected to validate the TFTP options, + suggested by the user and return the subset of them that it + accepts. Then the options is sent to the server which will perform the same TFTP option negotiation procedure. The options that are - accepted by the server are forwarded to function open/5 - on the client side. On the client side, function open/5 - must accept all option as-is or reject the transfer. Then + accepted by the server are forwarded to the open/5 function + on the client side. On the client side the open/5 function + must accept all option as is or reject the transfer. Then the callback interaction follows the same pattern as described - for the server side. When the last block is encountered in - read/1 or write/2, the returned state is forwarded to + above for the server side. When the last block is encountered in + read/1 or write/2 the returned state is forwarded to the user and returned from read_file/3 or write_file/3.

    -

    If a callback (performing the file access +

    If a callback (which performs the file access in the TFTP server) takes too long time (more than - the double TFTP time-out), the server aborts the - connection and sends an error reply to the client. - This implies that the server releases resources + the double TFTP timeout), the server will abort the + connection and send an error reply to the client. + This implies that the server will release resources attached to the connection faster than before. The server simply assumes that the client has given up.

    @@ -424,45 +455,21 @@

    If the TFTP server receives yet another request from the same client (same host and port) while it already has an active connection to the client, it - ignores the new request if the request is - equal to the first one (same filename and options). + will simply ignore the new request if the request is + equal with the first one (same filename and options). This implies that the (new) client will be served by the already ongoing connection on the server side. By not setting up yet another connection, in - parallel with the ongoing one, the server - consumes less resources.

    + parallel with the ongoing one, the server will + consumer lesser resources.

    - - Module:abort(Code, Text, State) -> ok - Aborts the file transfer. - - Code = undef | enoent | eacces | enospc -   | badop | eexist | baduser | badopt -   | int() - Text = string() - State = term() - - -

    Invoked when the file transfer is aborted.

    -

    The callback function is expected to clean - up its used resources after the aborted file - transfer, such as closing open file - descriptors and so on. The function is not - invoked if any of the other callback - functions returns an error, as it is - expected that they already have cleaned up - the necessary resources. However, it is - invoked if the functions fail (crash).

    -
    -
    - - - Module:open(Peer, Access, Filename, Mode, SuggestedOptions, State) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}} - Opens a file for read or write access. + + prepare(Peer, Access, Filename, Mode, SuggestedOptions, InitialState) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}} + Prepare to open a file on the client side Peer = {PeerType, PeerHost, PeerPort} PeerType = inet | inet6 @@ -473,8 +480,7 @@ Mode = string() SuggestedOptions = AcceptedOptions = [{Key, Value}]  Key = Value = string() - State = InitialState | term() -  InitialState = [] | [{root_dir, string()}] + InitialState = [] | [{root_dir, string()}] NewState = term() Code = undef | enoent | eacces | enospc   | badop | eexist | baduser | badopt @@ -482,22 +488,23 @@ Text = string() -

    Opens a file for read or write access.

    -

    On the client side, where the open/5 call has been - preceded by a call to prepare/5, all options must be - accepted or rejected.

    -

    On the server side, where there is no preceding - prepare/5 call, no new options can be added, but - those present in SuggestedOptions can be - omitted or replaced with new values in AcceptedOptions.

    +

    Prepares to open a file on the client side.

    +

    No new options may be added, but the ones that are present in + SuggestedOptions may be omitted or replaced with new + values in AcceptedOptions.

    +

    Will be followed by a call to open/4 before any + read/write access is performed. AcceptedOptions is + sent to the server which replies with those options that it + accepts. These will be forwarded to open/4 as + SuggestedOptions.

    - +
    - + - Module:prepare(Peer, Access, Filename, Mode, SuggestedOptions, InitialState) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}} - Prepares to open a file on the client side. + open(Peer, Access, Filename, Mode, SuggestedOptions, State) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}} + Open a file for read or write access Peer = {PeerType, PeerHost, PeerPort} PeerType = inet | inet6 @@ -508,7 +515,8 @@ Mode = string() SuggestedOptions = AcceptedOptions = [{Key, Value}]  Key = Value = string() - InitialState = [] | [{root_dir, string()}] + State = InitialState | term() +  InitialState = [] | [{root_dir, string()}] NewState = term() Code = undef | enoent | eacces | enospc   | badop | eexist | baduser | badopt @@ -516,23 +524,22 @@ Text = string() -

    Prepares to open a file on the client side.

    -

    No new options can be added, but those present in - SuggestedOptions can be omitted or replaced with new - values in AcceptedOptions.

    -

    This is followed by a call to open/4 before any - read/write access is performed. AcceptedOptions is - sent to the server, which replies with the options that it - accepts. These are then forwarded to open/4 as - SuggestedOptions.

    +

    Opens a file for read or write access.

    +

    On the client side where the open/5 call has been + preceded by a call to prepare/5, all options must be + accepted or rejected.

    +

    On the server side, where there is no preceding + prepare/5 call, no new options may be added, but + the ones that are present in SuggestedOptions may be + omitted or replaced with new values in AcceptedOptions.

    - +
    - Module:read(State) -> {more, Bin, NewState} | {last, Bin, FileSize} | {error, {Code, Text}} - Reads a chunk from the file. + read(State) -> {more, Bin, NewState} | {last, Bin, FileSize} | {error, {Code, Text}} + Read a chunk from the file State = NewState = term() Bin = binary() @@ -543,13 +550,13 @@ Text = string() -

    Reads a chunk from the file.

    +

    Read a chunk from the file.

    The callback function is expected to close the file when the last file chunk is - encountered. When an error is encountered, + encountered. When an error is encountered the callback function is expected to clean up after the aborted file transfer, such as - closing open file descriptors, and so on. In both + closing open file descriptors etc. In both cases there will be no more calls to any of the callback functions.

    @@ -558,8 +565,8 @@
    - Module:write(Bin, State) -> {more, NewState} | {last, FileSize} | {error, {Code, Text}} - Writes a chunk to the file. + write(Bin, State) -> {more, NewState} | {last, FileSize} | {error, {Code, Text}} + Write a chunk to the file Bin = binary() State = NewState = term() @@ -570,75 +577,99 @@ Text = string() -

    Writes a chunk to the file.

    +

    Write a chunk to the file.

    The callback function is expected to close the file when the last file chunk is - encountered. When an error is encountered, + encountered. When an error is encountered the callback function is expected to clean up after the aborted file transfer, such as - closing open file descriptors, and so on. In both + closing open file descriptors etc. In both cases there will be no more calls to any of the callback functions.

    + + + abort(Code, Text, State) -> ok + Abort the file transfer + + Code = undef | enoent | eacces | enospc +   | badop | eexist | baduser | badopt +   | int() + Text = string() + State = term() + + +

    Invoked when the file transfer is aborted.

    +

    The callback function is expected to clean + up its used resources after the aborted file + transfer, such as closing open file + descriptors etc. The function will not be + invoked if any of the other callback + functions returns an error, as it is + expected that they already have cleaned up + the necessary resources. It will however be + invoked if the functions fails (crashes).

    +
    +
    LOGGER FUNCTIONS -

    A tftp_logger callback module is to be implemented as a - tftp_logger behavior and export the following functions:

    +

    A tftp_logger callback module should be implemented as a + tftp_logger behavior and export the functions listed below.

    - Logger:error_msg(Format, Data) -> ok | exit(Reason) - Logs an error message. + error_msg(Format, Data) -> ok | exit(Reason) + Log an error message Format = string() Data = [term()] Reason = term() -

    Logs an error message. - See error_logger:error_msg/2 for details.

    +

    Log an error message. + See error_logger:error_msg/2 for details.

    - Logger:info_msg(Format, Data) -> ok | exit(Reason) - Logs an info message. + warning_msg(Format, Data) -> ok | exit(Reason) + Log an error message Format = string() Data = [term()] Reason = term() -

    Logs an info message. - See error_logger:info_msg/2 for details.

    +

    Log a warning message. + See error_logger:warning_msg/2 for details.

    + +
    - + - Logger:warning_msg(Format, Data) -> ok | exit(Reason) - Logs a warning message. + info_msg(Format, Data) -> ok | exit(Reason) + Log an error message Format = string() Data = [term()] Reason = term() -

    Logs a warning message. - See error_logger:warning_msg/2 for details.

    - - +

    Log an info message. + See error_logger:info_msg/2 for details.

    diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_client.erl erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_client.erl --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_client.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_client.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_ctrl.erl erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_ctrl.erl --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_ctrl.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_ctrl.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt.erl erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt.erl --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_logger.erl erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_logger.erl --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_logger.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_logger.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_logger.hrl erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_logger.hrl --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_logger.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_logger.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_random_html.erl erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_random_html.erl --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_random_html.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_random_html.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -49,10 +48,7 @@ ". content(WorkSim, SzSim) -> - {A, B, C} = {erlang:phash2([node()]), - inets_time_compat:monotonic_time(), - inets_time_compat:unique_integer()}, - + {A, B, C} = now(), random:seed(A, B, C), lists:sort([random:uniform(X) || X <- lists:seq(1, WorkSim)]), lists:flatten(lists:duplicate(SzSim, "Dummy data ")). diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_server.erl erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_server.erl --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt.sh.skel erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt.sh.skel --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt.sh.skel 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt.sh.skel 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_slave.erl erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_slave.erl --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/hdlt_slave.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/hdlt_slave.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -181,7 +180,7 @@ ?DEBUG("ssh_exec_erl -> done", []), {ok, Connection, Channel}; Error3 -> - ?LOG("failed exec command: ~p", [Error3]), + ?LOG("failed exec comand: ~p", [Error3]), throw({error, {ssh_exec_failed, Error3}}) end. diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/Makefile erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/Makefile --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/modules.mk erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/modules.mk --- erlang-18.2-dfsg/lib/inets/examples/httpd_load_test/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/httpd_load_test/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/inets/examples/Makefile erlang-17.3-dfsg/lib/inets/examples/Makefile --- erlang-18.2-dfsg/lib/inets/examples/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/examples/server_root/conf/httpd.conf erlang-17.3-dfsg/lib/inets/examples/server_root/conf/httpd.conf --- erlang-18.2-dfsg/lib/inets/examples/server_root/conf/httpd.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/server_root/conf/httpd.conf 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/examples/server_root/Makefile erlang-17.3-dfsg/lib/inets/examples/server_root/Makefile --- erlang-18.2-dfsg/lib/inets/examples/server_root/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/examples/server_root/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/include/httpd.hrl erlang-17.3-dfsg/lib/inets/include/httpd.hrl --- erlang-18.2-dfsg/lib/inets/include/httpd.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/include/httpd.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/include/mod_auth.hrl erlang-17.3-dfsg/lib/inets/include/mod_auth.hrl --- erlang-18.2-dfsg/lib/inets/include/mod_auth.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/include/mod_auth.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/Makefile erlang-17.3-dfsg/lib/inets/Makefile --- erlang-18.2-dfsg/lib/inets/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/priv/Makefile erlang-17.3-dfsg/lib/inets/priv/Makefile --- erlang-18.2-dfsg/lib/inets/priv/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/priv/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/src/ftp/ftp.erl erlang-17.3-dfsg/lib/inets/src/ftp/ftp.erl --- erlang-18.2-dfsg/lib/inets/src/ftp/ftp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/ftp/ftp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -61,7 +60,6 @@ -define(DATA_ACCEPT_TIMEOUT, infinity). -define(DEFAULT_MODE, passive). -define(PROGRESS_DEFAULT, ignore). --define(FTP_EXT_DEFAULT, false). %% Internal Constants -define(FTP_PORT, 21). @@ -96,8 +94,7 @@ ipfamily, % inet | inet6 | inet6fb4 progress = ignore, % ignore | pid() dtimeout = ?DATA_ACCEPT_TIMEOUT, % non_neg_integer() | infinity - tls_upgrading_data_connection = false, - ftp_extension = ?FTP_EXT_DEFAULT + tls_upgrading_data_connection = false }). @@ -972,8 +969,6 @@ %% timeout %% dtimeout %% progress -%% ftp_extension - open_options(Options) -> ?fcrt("open_options", [{options, Options}]), ValidateMode = @@ -1018,11 +1013,6 @@ (_) -> false end, - ValidateFtpExtension = - fun(true) -> true; - (false) -> true; - (_) -> false - end, ValidOptions = [{mode, ValidateMode, false, ?DEFAULT_MODE}, {host, ValidateHost, true, ehost}, @@ -1030,8 +1020,7 @@ {ipfamily, ValidateIpFamily, false, inet}, {timeout, ValidateTimeout, false, ?CONNECTION_TIMEOUT}, {dtimeout, ValidateDTimeout, false, ?DATA_ACCEPT_TIMEOUT}, - {progress, ValidateProgress, false, ?PROGRESS_DEFAULT}, - {ftp_extension, ValidateFtpExtension, false, ?FTP_EXT_DEFAULT}], + {progress, ValidateProgress, false, ?PROGRESS_DEFAULT}], validate_options(Options, ValidOptions, []). tls_options(Options) -> @@ -1185,14 +1174,12 @@ DTimeout = key_search(dtimeout, Opts, ?DATA_ACCEPT_TIMEOUT), Progress = key_search(progress, Opts, ignore), IpFamily = key_search(ipfamily, Opts, inet), - FtpExt = key_search(ftp_extension, Opts, ?FTP_EXT_DEFAULT), State2 = State#state{client = From, mode = Mode, progress = progress(Progress), ipfamily = IpFamily, - dtimeout = DTimeout, - ftp_extension = FtpExt}, + dtimeout = DTimeout}, ?fcrd("handle_call(open) -> setup ctrl connection with", [{host, Host}, {port, Port}, {timeout, Timeout}]), @@ -1215,13 +1202,11 @@ Timeout = key_search(timeout, Opts, ?CONNECTION_TIMEOUT), DTimeout = key_search(dtimeout, Opts, ?DATA_ACCEPT_TIMEOUT), Progress = key_search(progress, Opts, ignore), - FtpExt = key_search(ftp_extension, Opts, ?FTP_EXT_DEFAULT), State2 = State#state{client = From, mode = Mode, progress = progress(Progress), - dtimeout = DTimeout, - ftp_extension = FtpExt}, + dtimeout = DTimeout}, case setup_ctrl_connection(Host, Port, Timeout, State2) of {ok, State3, WaitTimeout} -> @@ -1800,8 +1785,7 @@ ipfamily = inet, client = From, caller = {setup_data_connection, Caller}, - timeout = Timeout, - ftp_extension = false} = State) -> + timeout = Timeout} = State) -> {_, [?LEFT_PAREN | Rest]} = lists:splitwith(fun(?LEFT_PAREN) -> false; (_) -> true end, Lines), @@ -1822,28 +1806,6 @@ {noreply,State#state{client = undefined, caller = undefined}} end; -handle_ctrl_result({pos_compl, Lines}, - #state{mode = passive, - ipfamily = inet, - client = From, - caller = {setup_data_connection, Caller}, - csock = CSock, - timeout = Timeout, - ftp_extension = true} = State) -> - - [_, PortStr | _] = lists:reverse(string:tokens(Lines, "|")), - {ok, {IP, _}} = peername(CSock), - - ?DBG('<--data tcp connect to ~p:~p, Caller=~p~n',[IP,PortStr,Caller]), - case connect(IP, list_to_integer(PortStr), Timeout, State) of - {ok, _, Socket} -> - handle_caller(State#state{caller = Caller, dsock = {tcp, Socket}}); - {error, _Reason} = Error -> - gen_server:reply(From, Error), - {noreply, State#state{client = undefined, caller = undefined}} - end; - - %% FTP server does not support passive mode: try to fallback on active mode handle_ctrl_result(_, #state{mode = passive, @@ -2177,16 +2139,16 @@ %% Connect to FTP server at Host (default is TCP port 21) %% in order to establish a control connection. setup_ctrl_connection(Host, Port, Timeout, State) -> - MsTime = inets_time_compat:monotonic_time(), + MsTime = millisec_time(), case connect(Host, Port, Timeout, State) of {ok, IpFam, CSock} -> NewState = State#state{csock = {tcp, CSock}, ipfamily = IpFam}, activate_ctrl_connection(NewState), - case Timeout - inets_lib:millisec_passed(MsTime) of + case Timeout - (millisec_time() - MsTime) of Timeout2 when (Timeout2 >= 0) -> {ok, NewState#state{caller = open}, Timeout2}; _ -> - %% Oups: Simulate timeout + %% Oups: Simulate timeout {ok, NewState#state{caller = open}, 0} end; Error -> @@ -2195,8 +2157,7 @@ setup_data_connection(#state{mode = active, caller = Caller, - csock = CSock, - ftp_extension = FtpExt} = State) -> + csock = CSock} = State) -> case (catch sockname(CSock)) of {ok, {{_, _, _, _, _, _, _, _} = IP, _}} -> {ok, LSock} = @@ -2213,18 +2174,11 @@ {ok, LSock} = gen_tcp:listen(0, [{ip, IP}, {active, false}, binary, {packet, 0}]), {ok, Port} = inet:port(LSock), - case FtpExt of - false -> - {IP1, IP2, IP3, IP4} = IP, - {Port1, Port2} = {Port div 256, Port rem 256}, - send_ctrl_message(State, - mk_cmd("PORT ~w,~w,~w,~w,~w,~w", - [IP1, IP2, IP3, IP4, Port1, Port2])); - true -> - IpAddress = inet_parse:ntoa(IP), - Cmd = mk_cmd("EPRT |1|~s|~p|", [IpAddress, Port]), - send_ctrl_message(State, Cmd) - end, + {IP1, IP2, IP3, IP4} = IP, + {Port1, Port2} = {Port div 256, Port rem 256}, + send_ctrl_message(State, + mk_cmd("PORT ~w,~w,~w,~w,~w,~w", + [IP1, IP2, IP3, IP4, Port1, Port2])), activate_ctrl_connection(State), {noreply, State#state{caller = {setup_data_connection, {LSock, Caller}}}} @@ -2237,17 +2191,9 @@ {noreply, State#state{caller = {setup_data_connection, Caller}}}; setup_data_connection(#state{mode = passive, ipfamily = inet, - caller = Caller, - ftp_extension = false} = State) -> + caller = Caller} = State) -> send_ctrl_message(State, mk_cmd("PASV", [])), activate_ctrl_connection(State), - {noreply, State#state{caller = {setup_data_connection, Caller}}}; - -setup_data_connection(#state{mode = passive, ipfamily = inet, - caller = Caller, - ftp_extension = true} = State) -> - send_ctrl_message(State, mk_cmd("EPSV", [])), - activate_ctrl_connection(State), {noreply, State#state{caller = {setup_data_connection, Caller}}}. connect(Host, Port, Timeout, #state{ipfamily = inet = IpFam}) -> @@ -2502,6 +2448,10 @@ ftp_progress:report(ProgressPid, Report). +millisec_time() -> + {A,B,C} = erlang:now(), + A*1000000000+B*1000+(C div 1000). + peername({tcp, Socket}) -> inet:peername(Socket); peername({ssl, Socket}) -> ssl:peername(Socket). diff -Nru erlang-18.2-dfsg/lib/inets/src/ftp/ftp_internal.hrl erlang-17.3-dfsg/lib/inets/src/ftp/ftp_internal.hrl --- erlang-18.2-dfsg/lib/inets/src/ftp/ftp_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/ftp/ftp_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/ftp/ftp_progress.erl erlang-17.3-dfsg/lib/inets/src/ftp/ftp_progress.erl --- erlang-18.2-dfsg/lib/inets/src/ftp/ftp_progress.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/ftp/ftp_progress.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/ftp/ftp_response.erl erlang-17.3-dfsg/lib/inets/src/ftp/ftp_response.erl --- erlang-18.2-dfsg/lib/inets/src/ftp/ftp_response.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/ftp/ftp_response.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/ftp/ftp_sup.erl erlang-17.3-dfsg/lib/inets/src/ftp/ftp_sup.erl --- erlang-18.2-dfsg/lib/inets/src/ftp/ftp_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/ftp/ftp_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/ftp/Makefile erlang-17.3-dfsg/lib/inets/src/ftp/Makefile --- erlang-18.2-dfsg/lib/inets/src/ftp/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/ftp/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2005-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/httpc_cookie.erl erlang-17.3-dfsg/lib/inets/src/http_client/httpc_cookie.erl --- erlang-18.2-dfsg/lib/inets/src/http_client/httpc_cookie.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/httpc_cookie.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -116,8 +115,8 @@ %%-------------------------------------------------------------------- -%% Func: insert(CookieDb, Cookie) -> ok -%% Purpose: insert cookies into the cookie db +%% Func: insert(CookieDb) -> ok +%% Purpose: Close the cookie db %%-------------------------------------------------------------------- %% If no persistent cookie database is defined we @@ -335,23 +334,9 @@ add_domain(Str, #http_cookie{domain = Domain}) -> Str ++ "; $Domain=" ++ Domain. -is_set_cookie_valid("") -> - %% an empty Set-Cookie header is not valid - false; -is_set_cookie_valid([$=|_]) -> - %% a Set-Cookie header without name is not valid - false; -is_set_cookie_valid(SetCookieHeader) -> - %% a Set-Cookie header without name/value is not valid - case string:chr(SetCookieHeader, $=) of - 0 -> false; - _ -> true - end. - parse_set_cookies(CookieHeaders, DefaultPathDomain) -> - %% filter invalid Set-Cookie headers - SetCookieHeaders = [Value || {"set-cookie", Value} <- CookieHeaders, - is_set_cookie_valid(Value)], + %% empty Set-Cookie header is invalid according to RFC but some sites violate it + SetCookieHeaders = [Value || {"set-cookie", Value} <- CookieHeaders, Value /= ""], Cookies = [parse_set_cookie(SetCookieHeader, DefaultPathDomain) || SetCookieHeader <- SetCookieHeaders], %% print_cookies("Parsed Cookies", Cookies), @@ -363,8 +348,6 @@ Name = string:substr(CookieHeader, 1, Pos - 1), {Value, Attrs} = case string:substr(CookieHeader, Pos + 1) of - [] -> - {"", ""}; [$;|ValueAndAttrs] -> {"", string:tokens(ValueAndAttrs, ";")}; ValueAndAttrs -> diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/httpc.erl erlang-17.3-dfsg/lib/inets/src/http_client/httpc.erl --- erlang-18.2-dfsg/lib/inets/src/http_client/httpc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/httpc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/httpc_handler.erl erlang-17.3-dfsg/lib/inets/src/http_client/httpc_handler.erl --- erlang-18.2-dfsg/lib/inets/src/http_client/httpc_handler.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/httpc_handler.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2015. All Rights Reserved. +%% Copyright Ericsson AB 2002-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -26,7 +25,6 @@ -include_lib("inets/src/http_lib/http_internal.hrl"). -include("httpc_internal.hrl"). --define(IS_STREAMED(Code), ((Code =:= 200) orelse (Code =:= 206))). %%-------------------------------------------------------------------- %% Internal Application API @@ -89,7 +87,7 @@ %% block the httpc manager process in odd cases such as trying to call %% a server that does not exist. (See OTP-6735) The only API function %% sending messages to the handler process that can be called before -%% init has completed is cancel and that is not a problem! (Send and +%% init has compleated is cancel and that is not a problem! (Send and %% stream will not be called before the first request has been sent and %% the reply or part of it has arrived.) %%-------------------------------------------------------------------- @@ -164,22 +162,22 @@ %% Request should not be streamed stream(BodyPart, #request{stream = none} = Request, _) -> ?hcrt("stream - none", []), - {false, BodyPart, Request}; + {BodyPart, Request}; %% Stream to caller stream(BodyPart, #request{stream = Self} = Request, Code) - when ?IS_STREAMED(Code) andalso + when ((Code =:= 200) orelse (Code =:= 206)) andalso ((Self =:= self) orelse (Self =:= {self, once})) -> ?hcrt("stream - self", [{stream, Self}, {code, Code}]), httpc_response:send(Request#request.from, {Request#request.id, stream, BodyPart}), - {true, <<>>, Request}; + {<<>>, Request}; %% Stream to file %% This has been moved to start_stream/3 %% We keep this for backward compatibillity... stream(BodyPart, #request{stream = Filename} = Request, Code) - when ?IS_STREAMED(Code) andalso is_list(Filename) -> + when ((Code =:= 200) orelse (Code =:= 206)) andalso is_list(Filename) -> ?hcrt("stream - filename", [{stream, Filename}, {code, Code}]), case file:open(Filename, [write, raw, append, delayed_write]) of {ok, Fd} -> @@ -191,18 +189,18 @@ %% Stream to file stream(BodyPart, #request{stream = Fd} = Request, Code) - when ?IS_STREAMED(Code) -> + when ((Code =:= 200) orelse (Code =:= 206)) -> ?hcrt("stream to file", [{stream, Fd}, {code, Code}]), case file:write(Fd, BodyPart) of ok -> - {true, <<>>, Request}; + {<<>>, Request}; {error, Reason} -> exit({stream_to_file_failed, Reason}) end; stream(BodyPart, Request,_) -> % only 200 and 206 responses can be streamed ?hcrt("stream - ignore", [{request, Request}]), - {false, BodyPart, Request}. + {BodyPart, Request}. %%==================================================================== @@ -318,9 +316,8 @@ {reply, ok, State} end; {error, Reason} -> - ?hcri("failed sending request", [{reason, Reason}]), - NewPipeline = queue:in(Request, State0#state.pipeline), - {stop, shutdown, {pipeline_failed, Reason}, State0#state{pipeline = NewPipeline}} + ?hcri("failed sending request", [{reason, Reason}]), + {reply, {pipeline_failed, Reason}, State0} end; handle_call(#request{address = Addr} = Request, _, @@ -353,30 +350,30 @@ {reply, ok, State0#state{keep_alive = NewKeepAlive, session = NewSession}}; undefined -> - %% Note: tcp-message receiving has already been + %% Note: tcp-message reciving has already been %% activated by handle_pipeline/2. ?hcrd("no current request", []), cancel_timer(Timers#timers.queue_timer, timeout_queue), - NewTimers = Timers#timers{queue_timer = undefined}, - State1 = State0#state{timers = NewTimers}, Address = handle_proxy(Addr, Proxy), case httpc_request:send(Address, Session, Request) of ok -> ?hcrd("request sent", []), %% Activate the request time out for the new request - State2 = - activate_request_timeout(State1#state{request = Request}), + State1 = + activate_request_timeout(State0#state{request = Request}), + NewTimers = State1#state.timers, NewSession = Session#session{queue_length = 1, client_close = ClientClose}, insert_session(NewSession, ProfileName), - State = init_wait_for_response_state(Request, State2#state{session = NewSession}), + State = init_wait_for_response_state(Request, State1#state{session = NewSession, + timers = NewTimers}), {reply, ok, State}; {error, Reason} -> ?hcri("failed sending request", [{reason, Reason}]), - {stop, shutdown, {keepalive_failed, Reason}, State1} + {reply, {request_failed, Reason}, State0} end end; @@ -394,7 +391,7 @@ %% When the request in process has been canceled the handler process is %% stopped and the pipelined requests will be reissued or remaining %% requests will be sent on a new connection. This is is -%% based on the assumption that it is probably cheaper to reissue the +%% based on the assumption that it is proably cheaper to reissue the %% requests than to wait for a potentiall large response that we then %% only throw away. This of course is not always true maybe we could %% do something smarter here?! If the request canceled is not @@ -422,16 +419,6 @@ {profile, ProfileName}, {canceled, Canceled}]), {noreply, State#state{canceled = [RequestId | Canceled]}}; -handle_cast({cancel, RequestId}, - #state{profile_name = ProfileName, - request = undefined, - canceled = Canceled} = State) -> - ?hcrv("cancel", [{request_id, RequestId}, - {curr_req_id, undefined}, - {profile, ProfileName}, - {canceled, Canceled}]), - {noreply, State}; - handle_cast(stream_next, #state{session = Session} = State) -> activate_once(Session), @@ -475,18 +462,18 @@ {Module, whole_body, [Body, Length]} -> ?hcrd("data processed - whole body", [{length, Length}]), {_, Code, _} = StatusLine, - {Streamed, NewBody, NewRequest} = stream(Body, Request, Code), + {NewBody, NewRequest} = stream(Body, Request, Code), %% When we stream we will not keep the already %% streamed data, that would be a waste of memory. NewLength = - case Streamed of - false -> + case Stream of + none -> Length; - true -> + _ -> Length - size(Body) end, - NewState = next_body_chunk(State, Code), + NewState = next_body_chunk(State), NewMFA = {Module, whole_body, [NewBody, NewLength]}, {noreply, NewState#state{mfa = NewMFA, request = NewRequest}}; @@ -498,8 +485,8 @@ %% The response body is chunk-encoded. Steal decoded %% chunks as much as possible to stream. {_, Code, _} = StatusLine, - {_, NewBody, NewRequest} = stream(BodySoFar, Request, Code), - NewState = next_body_chunk(State, Code), + {NewBody, NewRequest} = stream(BodySoFar, Request, Code), + NewState = next_body_chunk(State), NewMFA = {Module, decode_size, [TotalChunk, HexList, {MaxBodySize, NewBody, AccLength, MaxHeaderSize}]}, @@ -518,8 +505,8 @@ NewChunkSize = ChunkSize - ChunkSizeToSteal, {_, Code, _} = StatusLine, - {_, NewBody, NewRequest} = stream(StolenBody, Request, Code), - NewState = next_body_chunk(State, Code), + {NewBody, NewRequest} = stream(StolenBody, Request, Code), + NewState = next_body_chunk(State), NewMFA = {Module, decode_data, [NewChunkSize, NewTotalChunk, {MaxBodySize, NewBody, AccLength, MaxHeaderSize}]}, @@ -645,7 +632,7 @@ handle_info(timeout_queue, State = #state{request = undefined}) -> {stop, normal, State}; -%% Timing was such as the queue_timeout was not canceled! +%% Timing was such as the pipeline_timout was not canceled! handle_info(timeout_queue, #state{timers = Timers} = State) -> {noreply, State#state{timers = Timers#timers{queue_timer = undefined}}}; @@ -1072,13 +1059,13 @@ ?hcrt("handle_http_msg", [{chunked_headers, ChunkedHeaders}, {headers, Headers}]), NewHeaders = http_chunk:handle_headers(Headers, ChunkedHeaders), - {_, NewBody, NewRequest} = stream(Body, State#state.request, Code), + {NewBody, NewRequest} = stream(Body, State#state.request, Code), handle_response(State#state{headers = NewHeaders, body = NewBody, request = NewRequest}); handle_http_msg(Body, #state{status_line = {_,Code, _}} = State) -> ?hcrt("handle_http_msg", [{code, Code}]), - {_, NewBody, NewRequest} = stream(Body, State#state.request, Code), + {NewBody, NewRequest} = stream(Body, State#state.request, Code), handle_response(State#state{body = NewBody, request = NewRequest}). handle_http_body(_, #state{status = {ssl_tunnel, _}, @@ -1113,14 +1100,14 @@ case case_insensitive_header(TransferEnc) of "chunked" -> ?hcrt("handle_http_body - chunked", []), - try http_chunk:decode(Body, State#state.max_body_size, - State#state.max_header_size) of + case http_chunk:decode(Body, State#state.max_body_size, + State#state.max_header_size) of {Module, Function, Args} -> ?hcrt("handle_http_body - new mfa", [{module, Module}, {function, Function}, {args, Args}]), - NewState = next_body_chunk(State, Code), + NewState = next_body_chunk(State), {noreply, NewState#state{mfa = {Module, Function, Args}}}; {ok, {ChunkedHeaders, NewBody}} -> @@ -1134,18 +1121,11 @@ handle_response(State#state{headers = NewHeaders, body = NewBody}); _ -> - {_, NewBody2, _} = + {NewBody2, NewRequest} = stream(NewBody, Request, Code), handle_response(State#state{headers = NewHeaders, body = NewBody2}) end - catch throw:{error, Reason} -> - NewState = - answer_request(Request, - httpc_response:error(Request, - Reason), - State), - {stop, normal, NewState} end; Enc when Enc =:= "identity"; Enc =:= undefined -> ?hcrt("handle_http_body - identity", []), @@ -1155,12 +1135,12 @@ true -> case httpc_response:whole_body(Body, Length) of {ok, Body} -> - {_, NewBody, NewRequest} = + {NewBody, NewRequest} = stream(Body, Request, Code), handle_response(State#state{body = NewBody, request = NewRequest}); MFA -> - NewState = next_body_chunk(State, Code), + NewState = next_body_chunk(State), {noreply, NewState#state{mfa = MFA}} end; false -> @@ -1321,8 +1301,7 @@ handle_keep_alive_queue(#state{status = keep_alive, session = Session, profile_name = ProfileName, - options = #options{keep_alive_timeout = TimeOut, - proxy = Proxy}} = State, + options = #options{keep_alive_timeout = TimeOut}} = State, Data) -> ?hcrd("handle keep_alive", [{profile, ProfileName}, @@ -1343,15 +1322,14 @@ State#state{keep_alive = KeepAlive}, Data); false -> ?hcrv("next request", [{request, NextRequest}]), - #request{address = Addr} = NextRequest, - Address = handle_proxy(Addr, Proxy), + #request{address = Address} = NextRequest, case httpc_request:send(Address, Session, NextRequest) of ok -> receive_response(NextRequest, Session, <<>>, State#state{keep_alive = KeepAlive}); {error, Reason} -> - {stop, {shutdown, {keepalive_failed, Reason}}, State} + {reply, {keep_alive_failed, Reason}, State} end end end. @@ -1366,7 +1344,7 @@ %% closed by the server, the client may want to close it. NewState = activate_queue_timeout(TimeOut, State), update_session(ProfileName, Session, #session.queue_length, 0), - %% Note mfa will be initialized when a new request + %% Note mfa will be initilized when a new request %% arrives. {noreply, NewState#state{request = undefined, @@ -1409,8 +1387,6 @@ activate_once(#session{socket = Socket, socket_type = SocketType}) -> http_transport:setopts(SocketType, Socket, [{active, once}]). -close_socket(#session{socket = {remote_close,_}}) -> - ok; close_socket(#session{socket = Socket, socket_type = SocketType}) -> http_transport:close(SocketType, Socket). @@ -1654,21 +1630,21 @@ {ok, Request}; start_stream({_Version, Code, _ReasonPhrase}, Headers, #request{stream = self} = Request) - when ?IS_STREAMED(Code) -> + when (Code =:= 200) orelse (Code =:= 206) -> ?hcrt("start stream - self", [{code, Code}]), Msg = httpc_response:stream_start(Headers, Request, ignore), httpc_response:send(Request#request.from, Msg), {ok, Request}; start_stream({_Version, Code, _ReasonPhrase}, Headers, #request{stream = {self, once}} = Request) - when ?IS_STREAMED(Code) -> + when (Code =:= 200) orelse (Code =:= 206) -> ?hcrt("start stream - self:once", [{code, Code}]), Msg = httpc_response:stream_start(Headers, Request, self()), httpc_response:send(Request#request.from, Msg), {ok, Request}; start_stream({_Version, Code, _ReasonPhrase}, _Headers, #request{stream = Filename} = Request) - when ?IS_STREAMED(Code) andalso is_list(Filename) -> + when ((Code =:= 200) orelse (Code =:= 206)) andalso is_list(Filename) -> ?hcrt("start stream", [{code, Code}, {filename, Filename}]), case file:open(Filename, [write, raw, append, delayed_write]) of {ok, Fd} -> @@ -1720,15 +1696,13 @@ next_body_chunk(#state{request = #request{stream = {self, once}}, once = once, - session = Session} = State, - Code) when ?IS_STREAMED(Code) -> + session = Session} = State) -> activate_once(Session), State#state{once = inactive}; next_body_chunk(#state{request = #request{stream = {self, once}}, - once = inactive} = State, - Code) when ?IS_STREAMED(Code) -> + once = inactive} = State) -> State; %% Wait for user to call stream_next -next_body_chunk(#state{session = Session} = State, _) -> +next_body_chunk(#state{session = Session} = State) -> activate_once(Session), State. @@ -1827,15 +1801,13 @@ tls_upgrade(#state{status = {ssl_tunnel, #request{settings = - #http_options{ssl = {_, TLSOptions0} = SocketType}, - address = {Host, _} = Address} = Request}, + #http_options{ssl = {_, TLSOptions} = SocketType}} = Request}, session = #session{socket = TCPSocket} = Session0, options = Options} = State) -> - TLSOptions = maybe_add_sni(Host, TLSOptions0), - case ssl:connect(TCPSocket, TLSOptions) of {ok, TLSSocket} -> + Address = Request#request.address, ClientClose = httpc_request:is_client_closing(Request#request.headers), SessionType = httpc_manager:session_type(Options), Session = Session0#session{ @@ -1856,23 +1828,10 @@ status = new }, {noreply, activate_request_timeout(NewState)}; - {error, Reason} -> - Error = httpc_response:error(Request, {failed_connect, - [{to_address, Address}, - {tls, TLSOptions, Reason}]}), - maybe_send_answer(Request, Error, State), + {error, _Reason} -> {stop, normal, State#state{request = Request}} end. -maybe_add_sni(Host, Options) -> - case http_util:is_hostname(Host) andalso - not lists:keymember(server_name_indication, 1, Options) of - true -> - [{server_name_indication, Host} | Options]; - false -> - Options - end. - %% --------------------------------------------------------------------- %% Session wrappers %% --------------------------------------------------------------------- @@ -1891,7 +1850,6 @@ Session2 = erlang:setelement(Pos, Session, Value), insert_session(Session2, ProfileName); T:E -> - Stacktrace = erlang:get_stacktrace(), error_logger:error_msg("Failed updating session: " "~n ProfileName: ~p" "~n SessionId: ~p" @@ -1915,7 +1873,7 @@ {value, Value}, {etype, T}, {error, E}, - {stacktrace, Stacktrace}]}) + {stacktrace, erlang:get_stacktrace()}]}) end. diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/httpc_handler_sup.erl erlang-17.3-dfsg/lib/inets/src/http_client/httpc_handler_sup.erl --- erlang-18.2-dfsg/lib/inets/src/http_client/httpc_handler_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/httpc_handler_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/httpc_internal.hrl erlang-17.3-dfsg/lib/inets/src/http_client/httpc_internal.hrl --- erlang-18.2-dfsg/lib/inets/src/http_client/httpc_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/httpc_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/httpc_manager.erl erlang-17.3-dfsg/lib/inets/src/http_client/httpc_manager.erl --- erlang-18.2-dfsg/lib/inets/src/http_client/httpc_manager.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/httpc_manager.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/httpc_profile_sup.erl erlang-17.3-dfsg/lib/inets/src/http_client/httpc_profile_sup.erl --- erlang-18.2-dfsg/lib/inets/src/http_client/httpc_profile_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/httpc_profile_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/httpc_request.erl erlang-17.3-dfsg/lib/inets/src/http_client/httpc_request.erl --- erlang-18.2-dfsg/lib/inets/src/http_client/httpc_request.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/httpc_request.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/httpc_response.erl erlang-17.3-dfsg/lib/inets/src/http_client/httpc_response.erl --- erlang-18.2-dfsg/lib/inets/src/http_client/httpc_response.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/httpc_response.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -328,7 +327,7 @@ undefined -> status_server_error_50x(Response, Request); Time when (length(Time) < 3) -> % Wait only 99 s or less - NewTime = list_to_integer(Time) * 1000, % time in ms + NewTime = list_to_integer(Time) * 100, % time in ms {_, Data} = format_response(Response), {retry, {NewTime, Request}, Data}; _ -> diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/httpc_sup.erl erlang-17.3-dfsg/lib/inets/src/http_client/httpc_sup.erl --- erlang-18.2-dfsg/lib/inets/src/http_client/httpc_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/httpc_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_client/Makefile erlang-17.3-dfsg/lib/inets/src/http_client/Makefile --- erlang-18.2-dfsg/lib/inets/src/http_client/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_client/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2005-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/src/http_lib/http_chunk.erl erlang-17.3-dfsg/lib/inets/src/http_lib/http_chunk.erl --- erlang-18.2-dfsg/lib/inets/src/http_lib/http_chunk.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_lib/http_chunk.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,7 +24,7 @@ -include("http_internal.hrl"). %% API --export([decode/3, encode/1, encode_last/0, encode_last/1, handle_headers/2]). +-export([decode/3, encode/1, encode_last/0, handle_headers/2]). %% Callback API - used for example if the chunkedbody is received a %% little at a time on a socket. -export([decode_size/1, ignore_extensions/1, decode_data/1, decode_trailer/1]). @@ -57,7 +56,7 @@ %%------------------------------------------------------------------------- decode(ChunkedBody, MaxBodySize, MaxHeaderSize) -> %% Note decode_size will call decode_data. - decode_size([ChunkedBody, <<>>, [], 0, + decode_size([ChunkedBody, <<>>, [], {MaxBodySize, <<>>, 0, MaxHeaderSize}]). %%------------------------------------------------------------------------- @@ -85,11 +84,6 @@ encode_last() -> <<$0, ?CR, ?LF, ?CR, ?LF >>. -encode_last([]) -> - encode_last(); -encode_last(Trailers0) -> - Trailers = list_to_binary(encode_trailers(Trailers0)), - <<$0, ?CR, ?LF, Trailers/binary>>. %%------------------------------------------------------------------------- %% handle_headers(HeaderRecord, ChunkedHeaders) -> NewHeaderRecord @@ -125,80 +119,65 @@ %% Functions that may be returned during the decoding process %% if the input data is incompleate. -decode_size([Bin, Rest, HexList, AccSize, Info]) -> - decode_size(<>, HexList, AccSize, Info). +decode_size([Bin, Rest, HexList, Info]) -> + decode_size(<>, HexList, Info). -ignore_extensions([Bin, Rest, RemainingSize, TotalMaxHeaderSize, NextFunction]) -> - ignore_extensions(<>, RemainingSize, TotalMaxHeaderSize, NextFunction). +ignore_extensions([Bin, Rest, NextFunction]) -> + ignore_extensions(<>, NextFunction). decode_data([Bin, ChunkSize, TotalChunk, Info]) -> decode_data(ChunkSize, <>, Info). -decode_trailer([Bin, Rest, Header, Headers, Body, - BodyLength, RemainingSize, TotalMaxHeaderSize]) -> +decode_trailer([Bin, Rest, Header, Headers, MaxHeaderSize, Body, + BodyLength]) -> decode_trailer(<>, - Header, Headers, Body, BodyLength, RemainingSize, TotalMaxHeaderSize). + Header, Headers, MaxHeaderSize, Body, BodyLength). %%%======================================================================== %%% Internal functions %%%======================================================================== -decode_size(_, _, AccHeaderSize, {_,_,_, MaxHeaderSize}) when - AccHeaderSize > MaxHeaderSize -> - throw({error, {header_too_long, {max, MaxHeaderSize}}}); - -decode_size(<<>>, HexList, AccHeaderSize, Info) -> - {?MODULE, decode_size, [<<>>, HexList, AccHeaderSize, Info]}; -decode_size(Data = <>, HexList, AccHeaderSize, +decode_size(<<>>, HexList, Info) -> + {?MODULE, decode_size, [<<>>, HexList, Info]}; +decode_size(Data = <>, HexList, {MaxBodySize, Body, AccLength, MaxHeaderSize}) -> - try http_util:hexlist_to_integer(lists:reverse(string:strip(HexList, left))) of + ChunkSize = http_util:hexlist_to_integer(lists:reverse(HexList)), + case ChunkSize of 0 -> % Last chunk, there was no data - ignore_extensions(Data, remaing_size(MaxHeaderSize, AccHeaderSize), MaxHeaderSize, - {?MODULE, decode_trailer, - [<<>>, [],[], - Body, - integer_to_list(AccLength)]}); - ChunkSize -> + ignore_extensions(Data, {?MODULE, decode_trailer, + [<<>>, [],[], MaxHeaderSize, + Body, + integer_to_list(AccLength)]}); + _ -> %% Note decode_data may call decode_size again if there %% is more than one chunk, hence here is where the last parameter %% to this function comes in. decode_data(ChunkSize, ChunkRest, {MaxBodySize, Body, - ChunkSize + AccLength, + ChunkSize + AccLength , MaxHeaderSize}) - catch - _:_ -> - throw({error, {chunk_size, lists:reverse(HexList)}}) end; -decode_size(<<";", Rest/binary>>, HexList, AccHeaderSize, {_,_,_, MaxHeaderSize} = Info) -> +decode_size(<<";", Rest/binary>>, HexList, Info) -> %% Note ignore_extensions will call decode_size/1 again when %% it ignored all extensions. - ignore_extensions(Rest, remaing_size(MaxHeaderSize, AccHeaderSize), MaxHeaderSize, - {?MODULE, decode_size, [<<>>, HexList, AccHeaderSize, Info]}); -decode_size(<> = Data, HexList, AccHeaderSize, Info) -> - {?MODULE, decode_size, [Data, HexList, AccHeaderSize, Info]}; -decode_size(<>, HexList, AccHeaderSize, Info) -> - decode_size(Rest, [Octet | HexList], AccHeaderSize + 1, Info). + ignore_extensions(Rest, {?MODULE, decode_size, [<<>>, HexList, Info]}); +decode_size(<> = Data, HexList, Info) -> + {?MODULE, decode_size, [Data, HexList, Info]}; +decode_size(<>, HexList, Info) -> + decode_size(Rest, [Octet | HexList], Info). %% "All applications MUST ignore chunk-extension extensions they %% do not understand.", see RFC 2616 Section 3.6.1 We don't %% understand any extension... -ignore_extensions(_, 0, TotalMaxHeaderSize, _) -> - throw({error, {header_too_long, {max, TotalMaxHeaderSize}}}); -ignore_extensions(<<>>, RemainingSize, TotalMaxHeaderSize, NextFunction) -> - {?MODULE, ignore_extensions, [<<>>, RemainingSize, TotalMaxHeaderSize, NextFunction]}; -ignore_extensions(Data = <>, RemainingSize, TotalMaxHeaderSize, +ignore_extensions(<<>>, NextFunction) -> + {?MODULE, ignore_extensions, [<<>>, NextFunction]}; +ignore_extensions(Data = <>, {Module, Function, Args}) -> - case Function of - decode_trailer -> - Module:Function([Data | Args ++ [RemainingSize, TotalMaxHeaderSize]]); - _ -> - Module:Function([Data | Args]) - end; -ignore_extensions(<> = Data, RemainingSize, TotalMaxHeaderSize, NextFunction) -> - {?MODULE, ignore_extensions, [Data, RemainingSize, TotalMaxHeaderSize, NextFunction]}; -ignore_extensions(<<_Octet, Rest/binary>>, RemainingSize, TotalMaxHeaderSize, NextFunction) -> - ignore_extensions(Rest, remaing_size(RemainingSize, 1), TotalMaxHeaderSize, NextFunction). + Module:Function([Data | Args]); +ignore_extensions(<> = Data, NextFunction) -> + {?MODULE, ignore_extensions, [Data, NextFunction]}; +ignore_extensions(<<_Octet, Rest/binary>>, NextFunction) -> + ignore_extensions(Rest, NextFunction). decode_data(ChunkSize, TotalChunk, Info = {MaxBodySize, BodySoFar, AccLength, MaxHeaderSize}) @@ -210,89 +189,83 @@ %% once it ignored all extensions. {?MODULE, ignore_extensions, [<<>>, - {?MODULE, decode_trailer, [<<>>, [],[], + {?MODULE, decode_trailer, [<<>>, [],[], MaxHeaderSize, <>, integer_to_list(AccLength)]}]}; <> -> %% Note ignore_extensions will call decode_trailer/1 %% once it ignored all extensions. - ignore_extensions(Rest, MaxHeaderSize, MaxHeaderSize, - {?MODULE, decode_trailer, - [<<>>, [],[], + ignore_extensions(Rest, {?MODULE, decode_trailer, + [<<>>, [],[], MaxHeaderSize, <>, integer_to_list(AccLength)]}); <> -> - {?MODULE, decode_trailer, [<>, [],[], + {?MODULE, decode_trailer, [<>, [],[], MaxHeaderSize, <>, - integer_to_list(AccLength), MaxHeaderSize, MaxHeaderSize]}; + integer_to_list(AccLength)]}; <> -> - decode_trailer(<>, [],[], + decode_trailer(<>, [],[], MaxHeaderSize, <>, - integer_to_list(AccLength), MaxHeaderSize, MaxHeaderSize); - %% There are more chunks, so here we go again... + integer_to_list(AccLength)); + %% There are more chunks, so here we go agin... <> -> NewBody = <>, - {?MODULE, decode_size, [<<>>, [], 0, {MaxBodySize, NewBody, AccLength, MaxHeaderSize}]}; + {?MODULE, decode_size, [<<>>, [], {MaxBodySize, NewBody, AccLength, MaxHeaderSize}]}; <> when (AccLength < MaxBodySize) or (MaxBodySize == nolimit) -> - decode_size(Rest, [], 0, + decode_size(Rest, [], {MaxBodySize, <>, AccLength, MaxHeaderSize}); <<_:ChunkSize/binary, ?CR, ?LF, _/binary>> -> - throw({error, {body_too_big, {max, MaxBodySize}}}); + throw({error, body_too_big}); _ -> {?MODULE, decode_data, [ChunkSize, TotalChunk, Info]} end; decode_data(ChunkSize, TotalChunk, Info) -> {?MODULE, decode_data, [ChunkSize, TotalChunk, Info]}. -decode_trailer(_,_,_,_,_, 0, TotalMaxHeaderSize) -> - throw({error, {header_too_long, {max, TotalMaxHeaderSize}}}); -decode_trailer(<<>>, Header, Headers, Body, BodyLength, RemainingSize, TotalMaxHeaderSize) -> - {?MODULE, decode_trailer, [<<>>, Header, Headers, Body, - BodyLength, RemainingSize, TotalMaxHeaderSize]}; +decode_trailer(<<>>, Header, Headers, MaxHeaderSize, Body, BodyLength) -> + {?MODULE, decode_trailer, [<<>>, Header, Headers, MaxHeaderSize, Body, + BodyLength]}; + %% Note: If Bin is not empty it is part of a pipelined request/response. -decode_trailer(<>, [], [], Body, BodyLength, _, _) -> +decode_trailer(<>, [], [], _, Body, BodyLength) -> {ok, {["content-length:" ++ BodyLength], <>}}; decode_trailer(<>, - Header, Headers, Body, BodyLength, _, _) -> + Header, Headers, MaxHeaderSize, Body, BodyLength) -> NewHeaders = case Header of [] -> Headers; _ -> [lists:reverse(Header) | Headers] end, - {ok, {["content-length:" ++ BodyLength | NewHeaders], - <>}}; -decode_trailer(<> = Data, Header, Headers, - Body, BodyLength, RemainingSize, TotalMaxHeaderSize) -> - {?MODULE, decode_trailer, [Data, Header, Headers, Body, - BodyLength, RemainingSize, TotalMaxHeaderSize]}; -decode_trailer(<> = Data, Header, Headers, - Body, BodyLength, RemainingSize, TotalMaxHeaderSize) -> - {?MODULE, decode_trailer, [Data, Header, Headers, Body, - BodyLength, RemainingSize, TotalMaxHeaderSize]}; -decode_trailer(<> = Data, Header, Headers, - Body, BodyLength, RemainingSize, TotalMaxHeaderSize) -> - {?MODULE, decode_trailer, [Data, Header, Headers, Body, - BodyLength, RemainingSize, TotalMaxHeaderSize]}; -decode_trailer(<>, Header, Headers, Body, BodyLength, RemainingSize, TotalMaxHeaderSize) -> + Length = length(NewHeaders), + case Length > MaxHeaderSize of + true -> + throw({error, {header_too_long, MaxHeaderSize, + MaxHeaderSize-Length}}); + false -> + {ok, {["content-length:" ++ BodyLength | NewHeaders], + <>}} + end; +decode_trailer(<> = Data, Header, Headers, MaxHeaderSize, + Body, BodyLength) -> + {?MODULE, decode_trailer, [Data, Header, Headers, MaxHeaderSize, Body, + BodyLength]}; +decode_trailer(<> = Data, Header, Headers, MaxHeaderSize, + Body, BodyLength) -> + {?MODULE, decode_trailer, [Data, Header, Headers, MaxHeaderSize, Body, + BodyLength]}; +decode_trailer(<> = Data, Header, Headers, MaxHeaderSize, + Body, BodyLength) -> + {?MODULE, decode_trailer, [Data, Header, Headers, MaxHeaderSize, Body, + BodyLength]}; +decode_trailer(<>, Header, Headers, + MaxHeaderSize, Body, BodyLength) -> decode_trailer(Rest, [], [lists:reverse(Header) | Headers], - Body, BodyLength, RemainingSize, TotalMaxHeaderSize); -decode_trailer(<>, Header, Headers, Body, - BodyLength, RemainingSize, TotalMaxHeaderSize) -> - decode_trailer(Rest, [Octet | Header], Headers, - Body, BodyLength, remaing_size(RemainingSize, 1), TotalMaxHeaderSize). - -remaing_size(nolimit, _) -> - nolimit; -remaing_size(Total, Consumed) -> - Total - Consumed. - -encode_trailers(Trailers) -> - encode_trailers(Trailers, ""). - -encode_trailers([], Acc) -> - Acc ++ ?CRLF ++ ?CRLF; -encode_trailers([{Header, Value} | Rest], Acc) -> - encode_trailers(Rest, Header ++ ":" ++ Value ++ ?CRLF ++ Acc). + MaxHeaderSize, Body, BodyLength); + +decode_trailer(<>, Header, Headers, MaxHeaderSize, Body, + BodyLength) -> + decode_trailer(Rest, [Octet | Header], Headers, MaxHeaderSize, + Body, BodyLength). diff -Nru erlang-18.2-dfsg/lib/inets/src/http_lib/http_internal.hrl erlang-17.3-dfsg/lib/inets/src/http_lib/http_internal.hrl --- erlang-18.2-dfsg/lib/inets/src/http_lib/http_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_lib/http_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2015. All Rights Reserved. +%% Copyright Ericsson AB 2002-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,7 +28,6 @@ -define(HTTP_MAX_URI_SIZE, nolimit). -define(HTTP_MAX_VERSION_STRING, 8). -define(HTTP_MAX_METHOD_STRING, 20). --define(HTTP_MAX_CONTENT_LENGTH, 100000000). -ifndef(HTTP_DEFAULT_SSL_KIND). -define(HTTP_DEFAULT_SSL_KIND, essl). diff -Nru erlang-18.2-dfsg/lib/inets/src/http_lib/http_request.erl erlang-17.3-dfsg/lib/inets/src/http_lib/http_request.erl --- erlang-18.2-dfsg/lib/inets/src/http_lib/http_request.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_lib/http_request.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2015. All Rights Reserved. +%% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -22,16 +21,8 @@ -include("http_internal.hrl"). --export([headers/2, http_headers/1, is_absolut_uri/1, key_value/1]). +-export([headers/2, http_headers/1, is_absolut_uri/1]). - -key_value(KeyValueStr) -> - case lists:splitwith(fun($:) -> false; (_) -> true end, KeyValueStr) of - {Key, [$: | Value]} -> - {http_util:to_lower(string:strip(Key)), string:strip(Value)}; - {_, []} -> - undefined - end. %%------------------------------------------------------------------------- %% headers(HeaderList, #http_request_h{}) -> #http_request_h{} %% HeaderList - ["HeaderField:Value"] @@ -43,12 +34,14 @@ %%------------------------------------------------------------------------- headers([], Headers) -> Headers; -headers([{Key, Value} | Tail], Headers) -> - headers(Tail, headers(Key, Value, Headers)); -headers([undefined], Headers) -> - Headers; -headers(KeyValues, Headers) -> - headers([key_value(KeyValue) || KeyValue <- KeyValues], Headers). +headers([Header | Tail], Headers) -> + case lists:splitwith(fun($:) -> false; (_) -> true end, Header) of + {Key, [$: | Value]} -> + headers(Tail, headers(http_util:to_lower(string:strip(Key)), + string:strip(Value), Headers)); + {_, []} -> + headers(Tail, Headers) + end. %%------------------------------------------------------------------------- %% headers(#http_request_h{}) -> HeaderList diff -Nru erlang-18.2-dfsg/lib/inets/src/http_lib/http_response.erl erlang-17.3-dfsg/lib/inets/src/http_lib/http_response.erl --- erlang-18.2-dfsg/lib/inets/src/http_lib/http_response.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_lib/http_response.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -31,11 +30,16 @@ %% Value - string() %% %% Description: Creates a http_response_h-record used internally to -%% handle http-headers, assumes reversed list of headers -%% to unfold multiline headers with obs-folds +%% handle http-headers. %%------------------------------------------------------------------------- -headers(RevLines, Headers) -> - fill_headers(RevLines, [], Headers). +headers([], Headers) -> + Headers; + +headers([Header | Tail], Headers) -> + {Key, [$: | Value]} = + lists:splitwith(fun($:) -> false; (_) -> true end, Header), + headers(Tail, headers(http_util:to_lower(string:strip(Key)), + string:strip(Value), Headers)). %%------------------------------------------------------------------------- %% headers(#http_response_h{}) -> HeaderList @@ -63,25 +67,6 @@ %%%======================================================================== %%% Internal functions %%%======================================================================== -fill_headers([], _, Headers) -> - Headers; -fill_headers([[]], _, Headers) -> - Headers; -fill_headers([[Ch|HeaderFold]|Tail], Folded, Headers) - when Ch == $\t; Ch == $\s -> - fill_headers(Tail, [HeaderFold|Folded], Headers); -fill_headers([Header | Tail], Folded, Headers) -> - Unfolded = unfold([Header|Folded]), - {Key, [$: | Value]} = - lists:splitwith(fun($:) -> false; (_) -> true end, Unfolded), - fill_headers(Tail, [], headers(http_util:to_lower(string:strip(Key)), - string:strip(Value), Headers)). - -unfold([L]) -> - L; -unfold(Folded) -> - string:join(Folded, " "). - headers("cache-control", Value, Headers) -> Headers#http_response_h{'cache-control'= Value}; headers("connection", Value, Headers) -> diff -Nru erlang-18.2-dfsg/lib/inets/src/http_lib/http_transport.erl erlang-17.3-dfsg/lib/inets/src/http_lib/http_transport.erl --- erlang-18.2-dfsg/lib/inets/src/http_lib/http_transport.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_lib/http_transport.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -40,6 +39,12 @@ -include_lib("inets/src/inets_app/inets_internal.hrl"). -include("http_internal.hrl"). +-define(SERVICE, httpl). +-define(hlri(Label, Content), ?report_important(Label, ?SERVICE, Content)). +-define(hlrv(Label, Content), ?report_verbose(Label, ?SERVICE, Content)). +-define(hlrd(Label, Content), ?report_debug(Label, ?SERVICE, Content)). +-define(hlrt(Label, Content), ?report_trace(Label, ?SERVICE, Content)). + %%%========================================================================= %%% Internal application API @@ -49,27 +54,38 @@ %% start(SocketType) -> ok | {error, Reason} %% SocketType = ip_comm | {ssl, _} %% -%% Description: Makes sure ssl is started. +%% Description: Makes sure inet_db or ssl is started. %%------------------------------------------------------------------------- start(ip_comm) -> - ok; -start({ip_comm, _}) -> - ok; + do_start_ip_comm(); + +%% This is just for backward compatibillity start({ssl, _}) -> do_start_ssl(); start({essl, _}) -> do_start_ssl(). + +do_start_ip_comm() -> + case inet_db:start() of + {ok, _} -> + ok; + {error, {already_started, _}} -> + ok; + Error -> + Error + end. + do_start_ssl() -> - try lists:foreach(fun(App) -> - ok = application:ensure_started(App) - end, - [crypto, asn1, public_key, ssl]) - catch - _:Reason -> - {error, Reason} + case ssl:start() of + ok -> + ok; + {error, {already_started,_}} -> + ok; + Error -> + Error end. - + %%------------------------------------------------------------------------- %% connect(SocketType, Address, Options, Timeout) -> @@ -86,8 +102,12 @@ connect(SocketType, Address, Opts) -> connect(SocketType, Address, Opts, infinity). -connect(ip_comm, {Host, Port}, Opts0, Timeout) -> - Opts = [binary, {packet, 0}, {active, false}, {reuseaddr, true} | Opts0 ], + +connect(ip_comm = _SocketType, {Host, Port}, Opts0, Timeout) + when is_list(Opts0) -> + Opts = [binary, {packet, 0}, {active, false}, {reuseaddr, true} | Opts0], + ?hlrt("connect using gen_tcp", + [{host, Host}, {port, Port}, {opts, Opts}, {timeout, Timeout}]), try gen_tcp:connect(Host, Port, Opts, Timeout) of {ok, _} = OK -> OK; @@ -106,6 +126,11 @@ connect({essl, SslConfig}, {Host, Port}, Opts0, Timeout) -> Opts = [binary, {active, false}, {ssl_imp, new} | Opts0] ++ SslConfig, + ?hlrt("connect using essl", + [{host, Host}, + {port, Port}, + {ssl_config, SslConfig}, + {timeout, Timeout}]), case (catch ssl:connect(Host, Port, Opts, Timeout)) of {'EXIT', Reason} -> {error, {eoptions, Reason}}; @@ -130,23 +155,29 @@ %% reason for this to enable a HTTP-server not running as root to use %% port 80. %%------------------------------------------------------------------------- -listen(ip_comm, Addr, Port, Fd, IpFamily) -> - listen_ip_comm(Addr, Port, [], Fd, IpFamily); - -listen({ip_comm, SockOpts}, Addr, Port, Fd, IpFamily) -> - listen_ip_comm(Addr, Port, SockOpts, Fd, IpFamily); - +listen(ip_comm = _SocketType, Addr, Port, Fd, IpFamily) -> + listen_ip_comm(Addr, Port, Fd, IpFamily); + listen({essl, SSLConfig}, Addr, Port, Fd, IpFamily) -> listen_ssl(Addr, Port, Fd, SSLConfig, IpFamily, []). -listen(ip_comm, Addr, Port, IpFamily) -> - listen_ip_comm(Addr, Port, [], undefined, IpFamily); +listen(ip_comm = _SocketType, Addr, Port, IpFamily) -> + listen_ip_comm(Addr, Port, undefined, IpFamily); %% Wrapper for backaward compatibillity listen({ssl, SSLConfig}, Addr, Port, IpFamily) -> + ?hlrt("listen (wrapper)", + [{addr, Addr}, + {port, Port}, + {ssl_config, SSLConfig}]), listen({?HTTP_DEFAULT_SSL_KIND, SSLConfig}, Addr, Port, IpFamily); + listen({essl, SSLConfig}, Addr, Port, IpFamily) -> + ?hlrt("listen (essl)", + [{addr, Addr}, + {port, Port}, + {ssl_config, SSLConfig}]), {SSLConfig2, ExtraOpts} = case proplists:get_value(log_alert, SSLConfig, undefined) of undefined -> {SSLConfig, []}; @@ -155,36 +186,89 @@ end, listen_ssl(Addr, Port, undefined, SSLConfig2, IpFamily, ExtraOpts). -listen_ip_comm(Addr, Port, SockOpts, Fd, IpFamily) -> - case (catch do_listen_ip_comm(Addr, Port, SockOpts, Fd, IpFamily)) of +listen_ip_comm(Addr, Port, Fd, IpFamily) -> + case (catch do_listen_ip_comm(Addr, Port, Fd, IpFamily)) of {'EXIT', Reason} -> {error, {exit, Reason}}; Else -> Else end. -do_listen_ip_comm(Addr, Port, SockOpts, Fd, IpFamily) -> - Backlog = proplists:get_value(backlog, SockOpts, 128), - {NewPort, Opts} = get_socket_info(Addr, Port, Fd, - [{backlog, Backlog}, {reuseaddr, true} | SockOpts]), - Opts2 = [IpFamily | Opts], - gen_tcp:listen(NewPort, Opts2). +do_listen_ip_comm(Addr, Port, Fd, IpFamily) -> + {NewPort, Opts} = get_socket_info(Addr, Port, Fd), + case IpFamily of + inet6fb4 -> + Opts2 = [inet6 | Opts], + ?hlrt("try ipv6 listen", [{port, NewPort}, {opts, Opts2}]), + case (catch gen_tcp:listen(NewPort, Opts2)) of + {error, Reason} when ((Reason =:= nxdomain) orelse + (Reason =:= eafnosupport)) -> + Opts3 = [inet | Opts], + ?hlrt("ipv6 listen failed - try ipv4 instead", + [{reason, Reason}, {port, NewPort}, {opts, Opts3}]), + gen_tcp:listen(NewPort, Opts3); + + %% This is when a given hostname has resolved to a + %% IPv4-address. The inet6-option together with a + %% {ip, IPv4} option results in badarg + {'EXIT', Reason} -> + Opts3 = [inet | Opts], + ?hlrt("ipv6 listen exit - try ipv4 instead", + [{reason, Reason}, {port, NewPort}, {opts, Opts3}]), + gen_tcp:listen(NewPort, Opts3); + + Other -> + ?hlrt("ipv6 listen done", [{other, Other}]), + Other + end; + _ -> + Opts2 = [IpFamily | Opts], + ?hlrt("listen", [{port, NewPort}, {opts, Opts2}]), + gen_tcp:listen(NewPort, Opts2) + end. listen_ssl(Addr, Port, Fd, Opts0, IpFamily, ExtraOpts) -> - Backlog = proplists:get_value(backlog, Opts0, 128), - {NewPort, SockOpt} = get_socket_info(Addr, Port, Fd, - [{backlog, Backlog}, {reuseaddr, true}]), + {NewPort, SockOpt} = get_socket_info(Addr, Port, Fd), Opts = SockOpt ++ Opts0, - Opts2 = [IpFamily | Opts], - ssl:listen(NewPort, Opts2 ++ ExtraOpts). + case IpFamily of + inet6fb4 -> + Opts2 = [inet6 | Opts] ++ ExtraOpts, + ?hlrt("try ipv6 listen", [{opts, Opts2}]), + case (catch ssl:listen(Port, Opts2)) of + {error, Reason} when ((Reason =:= nxdomain) orelse + (Reason =:= eafnosupport)) -> + Opts3 = [inet | Opts] ++ ExtraOpts, + ?hlrt("ipv6 listen failed - try ipv4 instead", + [{reason, Reason}, {opts, Opts3}]), + ssl:listen(NewPort, Opts3); + + {'EXIT', Reason} -> + Opts3 = [inet | Opts] ++ ExtraOpts, + ?hlrt("ipv6 listen exit - try ipv4 instead", + [{reason, Reason}, {opts, Opts3}]), + ssl:listen(NewPort, Opts3); + + Other -> + ?hlrt("ipv6 listen done", [{other, Other}]), + Other + end; + + _ -> + Opts2 = [IpFamily | Opts], + ?hlrt("listen", [{opts, Opts2}]), + ssl:listen(NewPort, Opts2 ++ ExtraOpts) + end. -get_socket_info(Addr, Port, Fd, BaseOpts) -> + + +get_socket_info(Addr, Port, Fd) -> + BaseOpts = [{backlog, 128}, {reuseaddr, true}], %% The presence of a file descriptor takes precedence case Fd of undefined -> {Port, sock_opts(Addr, BaseOpts)}; Fd -> - {0, sock_opts([{fd, Fd} | BaseOpts])} + {0, sock_opts(Addr, [{fd, Fd} | BaseOpts])} end. %%------------------------------------------------------------------------- @@ -203,8 +287,6 @@ accept(ip_comm, ListenSocket, Timeout) -> gen_tcp:accept(ListenSocket, Timeout); -accept({ip_comm, _}, ListenSocket, Timeout) -> - gen_tcp:accept(ListenSocket, Timeout); %% Wrapper for backaward compatibillity accept({ssl, SSLConfig}, ListenSocket, Timeout) -> @@ -224,8 +306,6 @@ %%------------------------------------------------------------------------- controlling_process(ip_comm, Socket, NewOwner) -> gen_tcp:controlling_process(Socket, NewOwner); -controlling_process({ip_comm, _}, Socket, NewOwner) -> - gen_tcp:controlling_process(Socket, NewOwner); %% Wrapper for backaward compatibillity controlling_process({ssl, SSLConfig}, Socket, NewOwner) -> @@ -244,8 +324,7 @@ %% gen_tcp or ssl. %%------------------------------------------------------------------------- setopts(ip_comm, Socket, Options) -> - inet:setopts(Socket, Options); -setopts({ip_comm, _}, Socket, Options) -> + ?hlrt("ip_comm setopts", [{socket, Socket}, {options, Options}]), inet:setopts(Socket, Options); %% Wrapper for backaward compatibillity @@ -253,7 +332,10 @@ setopts({?HTTP_DEFAULT_SSL_KIND, SSLConfig}, Socket, Options); setopts({essl, _}, Socket, Options) -> - (catch ssl:setopts(Socket, Options)). + ?hlrt("[e]ssl setopts", [{socket, Socket}, {options, Options}]), + Reason = (catch ssl:setopts(Socket, Options)), + ?hlrt("[e]ssl setopts result", [{reason, Reason}]), + Reason. %%------------------------------------------------------------------------- @@ -267,10 +349,8 @@ Opts = [packet, packet_size, recbuf, sndbuf, priority, tos, send_timeout], getopts(SocketType, Socket, Opts). -getopts({ip_comm, _}, Socket, Options) -> - getopts(ip_comm, Socket, Options); - getopts(ip_comm, Socket, Options) -> + ?hlrt("ip_comm getopts", [{socket, Socket}, {options, Options}]), case inet:getopts(Socket, Options) of {ok, SocketOpts} -> SocketOpts; @@ -283,6 +363,7 @@ getopts({?HTTP_DEFAULT_SSL_KIND, SSLConfig}, Socket, Options); getopts({essl, _}, Socket, Options) -> + ?hlrt("essl getopts", [{socket, Socket}, {options, Options}]), getopts_ssl(Socket, Options). getopts_ssl(Socket, Options) -> @@ -302,6 +383,7 @@ %% Description: Gets the socket stats values for the socket %%------------------------------------------------------------------------- getstat(ip_comm = _SocketType, Socket) -> + ?hlrt("ip_comm getstat", [{socket, Socket}]), case inet:getstat(Socket) of {ok, Stats} -> Stats; @@ -326,8 +408,6 @@ %%------------------------------------------------------------------------- send(ip_comm, Socket, Message) -> gen_tcp:send(Socket, Message); -send({ip_comm, _}, Socket, Message) -> - gen_tcp:send(Socket, Message); %% Wrapper for backaward compatibillity send({ssl, SSLConfig}, Socket, Message) -> @@ -336,6 +416,7 @@ send({essl, _}, Socket, Message) -> ssl:send(Socket, Message). + %%------------------------------------------------------------------------- %% close(SocketType, Socket) -> ok | {error, Reason} %% SocketType = ip_comm | {ssl, _} @@ -345,8 +426,6 @@ %%------------------------------------------------------------------------- close(ip_comm, Socket) -> gen_tcp:close(Socket); -close({ip_comm, []}, Socket) -> - gen_tcp:close(Socket); %% Wrapper for backaward compatibillity close({ssl, SSLConfig}, Socket) -> @@ -368,8 +447,6 @@ %%------------------------------------------------------------------------- peername(ip_comm, Socket) -> do_peername(inet:peername(Socket)); -peername({ip_comm, _}, Socket) -> - do_peername(inet:peername(Socket)); %% Wrapper for backaward compatibillity peername({ssl, SSLConfig}, Socket) -> @@ -402,8 +479,7 @@ %%------------------------------------------------------------------------- sockname(ip_comm, Socket) -> do_sockname(inet:sockname(Socket)); -sockname({ip_comm, _}, Socket) -> - do_sockname(inet:sockname(Socket)); + %% Wrapper for backaward compatibillity sockname({ssl, SSLConfig}, Socket) -> sockname({?HTTP_DEFAULT_SSL_KIND, SSLConfig}, Socket); @@ -478,13 +554,28 @@ %% -- negotiate -- negotiate(ip_comm,_,_) -> - ok; -negotiate({ip_comm, _},_,_) -> + ?hlrt("negotiate(ip_comm)", []), ok; negotiate({ssl, SSLConfig}, Socket, Timeout) -> + ?hlrt("negotiate(ssl)", []), negotiate({?HTTP_DEFAULT_SSL_KIND, SSLConfig}, Socket, Timeout); negotiate({essl, _}, Socket, Timeout) -> + ?hlrt("negotiate(essl)", []), negotiate_ssl(Socket, Timeout). negotiate_ssl(Socket, Timeout) -> - ssl:ssl_accept(Socket, Timeout). + ?hlrt("negotiate_ssl", [{socket, Socket}, {timeout, Timeout}]), + case ssl:ssl_accept(Socket, Timeout) of + ok -> + ok; + {error, Reason} -> + ?hlrd("negotiate_ssl - accept failed", [{reason, Reason}]), + %% Look for "valid" error reasons + ValidReasons = [timeout, econnreset, esslaccept, esslerrssl], + case lists:member(Reason, ValidReasons) of + true -> + {error, normal}; + false -> + {error, Reason} + end + end. diff -Nru erlang-18.2-dfsg/lib/inets/src/http_lib/http_uri.erl erlang-17.3-dfsg/lib/inets/src/http_lib/http_uri.erl --- erlang-18.2-dfsg/lib/inets/src/http_lib/http_uri.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_lib/http_uri.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -91,8 +90,8 @@ {error, Reason}; {Scheme, DefaultPort, Rest} -> case (catch parse_uri_rest(Scheme, DefaultPort, Rest, Opts)) of - {ok, Result} -> - {ok, Result}; + {ok, {UserInfo, Host, Port, Path, Query}} -> + {ok, {Scheme, UserInfo, Host, Port, Path, Query}}; {error, Reason} -> {error, {Reason, Scheme, AbsURI}}; _ -> @@ -138,50 +137,38 @@ {error, no_scheme} -> {error, no_scheme}; {SchemeStr, Rest} -> - case extract_scheme(SchemeStr, Opts) of - {error, Error} -> - {error, Error}; - {ok, Scheme} -> - SchemeDefaults = which_scheme_defaults(Opts), - case lists:keysearch(Scheme, 1, SchemeDefaults) of - {value, {Scheme, DefaultPort}} -> - {Scheme, DefaultPort, Rest}; - false -> - {Scheme, no_default_port, Rest} - end + Scheme = list_to_atom(http_util:to_lower(SchemeStr)), + SchemeDefaults = which_scheme_defaults(Opts), + case lists:keysearch(Scheme, 1, SchemeDefaults) of + {value, {Scheme, DefaultPort}} -> + {Scheme, DefaultPort, Rest}; + false -> + {Scheme, no_default_port, Rest} end end. -extract_scheme(Str, Opts) -> - case lists:keysearch(scheme_validation_fun, 1, Opts) of - {value, {scheme_validation_fun, Fun}} when is_function(Fun) -> - case Fun(Str) of - valid -> - {ok, list_to_atom(http_util:to_lower(Str))}; - {error, Error} -> - {error, Error} - end; - _ -> - {ok, list_to_atom(http_util:to_lower(Str))} - end. - parse_uri_rest(Scheme, DefaultPort, "//" ++ URIPart, Opts) -> - {Authority, PathQueryFragment} = - split_uri(URIPart, "[/?#]", {URIPart, ""}, 1, 0), - {RawPath, QueryFragment} = - split_uri(PathQueryFragment, "[?#]", {PathQueryFragment, ""}, 1, 0), - {Query, Fragment} = - split_uri(QueryFragment, "#", {QueryFragment, ""}, 1, 0), + {Authority, PathQuery} = + case split_uri(URIPart, "/", URIPart, 1, 0) of + Split = {_, _} -> + Split; + URIPart -> + case split_uri(URIPart, "\\?", URIPart, 1, 0) of + Split = {_, _} -> + Split; + URIPart -> + {URIPart,""} + end + end, {UserInfo, HostPort} = split_uri(Authority, "@", {"", Authority}, 1, 1), {Host, Port} = parse_host_port(Scheme, DefaultPort, HostPort, Opts), - Path = path(RawPath), - case lists:keyfind(fragment, 1, Opts) of - {fragment, true} -> - {ok, {Scheme, UserInfo, Host, Port, Path, Query, Fragment}}; - _ -> - {ok, {Scheme, UserInfo, Host, Port, Path, Query}} - end. + {Path, Query} = parse_path_query(PathQuery), + {ok, {UserInfo, Host, Port, Path, Query}}. + +parse_path_query(PathQuery) -> + {Path, Query} = split_uri(PathQuery, "\\?", {PathQuery, ""}, 1, 0), + {path(Path), Query}. %% In this version of the function, we no longer need %% the Scheme argument, but just in case... diff -Nru erlang-18.2-dfsg/lib/inets/src/http_lib/http_util.erl erlang-17.3-dfsg/lib/inets/src/http_lib/http_util.erl --- erlang-18.2-dfsg/lib/inets/src/http_lib/http_util.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_lib/http_util.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -152,11 +151,27 @@ Sec=list_to_integer([S1,S2]), {{Year,Month,Day},{Hour,Min,Sec}}. -hexlist_to_integer(List) -> - list_to_integer(List, 16). +hexlist_to_integer([]) -> + empty; +%%When the string only contains one value its eaasy done. +%% 0-9 +hexlist_to_integer([Size]) when (Size >= 48) andalso (Size =< 57) -> + Size - 48; +%% A-F +hexlist_to_integer([Size]) when (Size >= 65) andalso (Size =< 70) -> + Size - 55; +%% a-f +hexlist_to_integer([Size]) when (Size >= 97) andalso (Size =< 102) -> + Size - 87; +hexlist_to_integer([_Size]) -> + not_a_num; + +hexlist_to_integer(Size) -> + Len = string:span(Size, "1234567890abcdefABCDEF"), + hexlist_to_integer2(Size, 16 bsl (4 *(Len-2)),0). -integer_to_hexlist(Int) -> - integer_to_list(Int, 16). +integer_to_hexlist(Num)-> + integer_to_hexlist(Num, get_size(Num), []). convert_month("Jan") -> 1; convert_month("Feb") -> 2; @@ -197,6 +212,51 @@ %%%======================================================================== %%% Internal functions %%%======================================================================== +hexlist_to_integer2([],_Pos,Sum)-> + Sum; +hexlist_to_integer2([HexVal | HexString], Pos, Sum) + when HexVal >= 48, HexVal =< 57 -> + hexlist_to_integer2(HexString, Pos bsr 4, Sum + ((HexVal-48) * Pos)); + +hexlist_to_integer2([HexVal | HexString], Pos, Sum) + when HexVal >= 65, HexVal =<70 -> + hexlist_to_integer2(HexString, Pos bsr 4, Sum + ((HexVal-55) * Pos)); + +hexlist_to_integer2([HexVal | HexString], Pos, Sum) + when HexVal>=97, HexVal=<102 -> + hexlist_to_integer2(HexString, Pos bsr 4, Sum + ((HexVal-87) * Pos)); + +hexlist_to_integer2(_AfterHexString, _Pos, Sum)-> + Sum. + +integer_to_hexlist(Num, Pot, Res) when Pot < 0 -> + convert_to_ascii([Num | Res]); + +integer_to_hexlist(Num,Pot,Res) -> + Position = (16 bsl (Pot*4)), + PosVal = Num div Position, + integer_to_hexlist(Num - (PosVal*Position), Pot-1, [PosVal | Res]). + +get_size(Num)-> + get_size(Num, 0). + +get_size(Num, Pot) when Num < (16 bsl(Pot *4)) -> + Pot-1; + +get_size(Num, Pot) -> + get_size(Num, Pot+1). + +convert_to_ascii(RevesedNum) -> + convert_to_ascii(RevesedNum, []). + +convert_to_ascii([], Num)-> + Num; +convert_to_ascii([Num | Reversed], Number) + when (Num > -1) andalso (Num < 10) -> + convert_to_ascii(Reversed, [Num + 48 | Number]); +convert_to_ascii([Num | Reversed], Number) + when (Num > 9) andalso (Num < 16) -> + convert_to_ascii(Reversed, [Num + 55 | Number]). char_to_html_entity(Char, Reserved) -> case sets:is_element(Char, Reserved) of diff -Nru erlang-18.2-dfsg/lib/inets/src/http_lib/Makefile erlang-17.3-dfsg/lib/inets/src/http_lib/Makefile --- erlang-18.2-dfsg/lib/inets/src/http_lib/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_lib/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2005-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_acceptor.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_acceptor.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_acceptor.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_acceptor.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_acceptor_sup.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_acceptor_sup.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_acceptor_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_acceptor_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,8 +26,6 @@ -behaviour(supervisor). --include("httpd_internal.hrl"). - %% API -export([start_link/1]). %%, start_acceptor/6, start_acceptor/7, stop_acceptor/2]). @@ -39,9 +36,8 @@ %%%========================================================================= %%% API %%%========================================================================= -start_link([Addr, Port, Config| _] = Args) -> - Profile = proplists:get_value(profile, Config, ?DEFAULT_PROFILE), - SupName = make_name(Addr, Port, Profile), +start_link([Addr, Port| _] = Args) -> + SupName = make_name(Addr, Port), supervisor:start_link({local, SupName}, ?MODULE, [Args]). %%%========================================================================= @@ -58,23 +54,20 @@ %%% Internal functions %%%========================================================================= child_spec([Address, Port, ConfigList, AcceptTimeout, ListenInfo]) -> - Profile = proplists:get_value(profile, ConfigList, ?DEFAULT_PROFILE), - Name = id(Address, Port, Profile), - Manager = httpd_util:make_name("httpd", Address, Port, Profile), + Name = id(Address, Port), + Manager = httpd_util:make_name("httpd", Address, Port), SockType = proplists:get_value(socket_type, ConfigList, ip_comm), IpFamily = proplists:get_value(ipfamily, ConfigList, inet), StartFunc = case ListenInfo of undefined -> - {httpd_acceptor, start_link, - [Manager, SockType, Address, Port, IpFamily, - httpd_util:make_name("httpd_conf", Address, Port, Profile), - AcceptTimeout]}; + {httpd_acceptor, start_link, [Manager, SockType, Address, Port, IpFamily, + httpd_util:make_name("httpd_conf", Address, Port), + AcceptTimeout]}; _ -> - {httpd_acceptor, start_link, - [Manager, SockType, Address, Port, ListenInfo, - IpFamily, - httpd_util:make_name("httpd_conf", Address, Port, Profile), - AcceptTimeout]} + {httpd_acceptor, start_link, [Manager, SockType, Address, Port, ListenInfo, + IpFamily, + httpd_util:make_name("httpd_conf", Address, Port), + AcceptTimeout]} end, Restart = transient, Shutdown = brutal_kill, @@ -82,9 +75,9 @@ Type = worker, {Name, StartFunc, Restart, Shutdown, Type, Modules}. -id(Address, Port, Profile) -> - {httpd_acceptor_sup, Address, Port, Profile}. +id(Address, Port) -> + {httpd_acceptor_sup, Address, Port}. -make_name(Addr, Port, Profile) -> - httpd_util:make_name("httpd_acceptor_sup", Addr, Port, Profile). +make_name(Addr,Port) -> + httpd_util:make_name("httpd_acceptor_sup", Addr, Port). diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_cgi.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_cgi.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_cgi.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_cgi.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_conf.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_conf.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_conf.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_conf.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,48 +1,159 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% %% -module(httpd_conf). +%% EWSAPI +-export([is_directory/1, is_file/1, make_integer/1, clean/1, + custom_clean/3, check_enum/2]). + %% Application internal API -export([load/1, load/2, load_mime_types/1, store/1, store/2, - remove/1, remove_all/1, get_config/3, get_config/4, + remove/1, remove_all/1, get_config/2, get_config/3, lookup_socket_type/1, lookup/2, lookup/3, lookup/4, - validate_properties/1, white_space_clean/1]). - -%% Deprecated --export([is_directory/1, is_file/1, make_integer/1, clean/1, - custom_clean/3, check_enum/2]). - --deprecated({is_directory, 1, next_major_release}). --deprecated({is_file, 1, next_major_release}). --deprecated({make_integer, 1, next_major_release}). --deprecated({clean, 1, next_major_release}). --deprecated({custom_clean, 3, next_major_release}). --deprecated({check_enum, 2, next_major_release}). + validate_properties/1]). -define(VMODULE,"CONF"). -include("httpd_internal.hrl"). -include("httpd.hrl"). -include_lib("inets/src/http_lib/http_internal.hrl"). + +%%%========================================================================= +%%% EWSAPI +%%%========================================================================= +%%------------------------------------------------------------------------- +%% is_directory(FilePath) -> Result +%% FilePath = string() +%% Result = {ok,Directory} | {error,Reason} +%% Directory = string() +%% Reason = string() | enoent | eaccess | enotdir | FileInfo +%% FileInfo = File info record +%% +%% Description: Checks if FilePath is a directory in which case it is +%% returned. +%%------------------------------------------------------------------------- +is_directory(Directory) -> + case file:read_file_info(Directory) of + {ok,FileInfo} -> + #file_info{type = Type, access = Access} = FileInfo, + is_directory(Type,Access,FileInfo,Directory); + {error,Reason} -> + {error,Reason} + end. +is_directory(directory,read,_FileInfo,Directory) -> + {ok,Directory}; +is_directory(directory,read_write,_FileInfo,Directory) -> + {ok,Directory}; +is_directory(_Type,_Access,FileInfo,_Directory) -> + {error,FileInfo}. + + +%%------------------------------------------------------------------------- +%% is_file(FilePath) -> Result +%% FilePath = string() +%% Result = {ok,File} | {error,Reason} +%% File = string() +%% Reason = string() | enoent | eaccess | enotdir | FileInfo +%% FileInfo = File info record +%% +%% Description: Checks if FilePath is a regular file in which case it +%% is returned. +%%------------------------------------------------------------------------- +is_file(File) -> + case file:read_file_info(File) of + {ok,FileInfo} -> + #file_info{type = Type, access = Access} = FileInfo, + is_file(Type,Access,FileInfo,File); + {error,Reason} -> + {error,Reason} + end. +is_file(regular,read,_FileInfo,File) -> + {ok,File}; +is_file(regular,read_write,_FileInfo,File) -> + {ok,File}; +is_file(_Type,_Access,FileInfo,_File) -> + {error,FileInfo}. + + +%%------------------------------------------------------------------------- +%% make_integer(String) -> Result +%% String = string() +%% Result = {ok,integer()} | {error,nomatch} +%% +%% Description: make_integer/1 returns an integer representation of String. +%%------------------------------------------------------------------------- +make_integer(String) -> + case inets_regexp:match(clean(String),"[0-9]+") of + {match, _, _} -> + {ok, list_to_integer(clean(String))}; + nomatch -> + {error, nomatch} + end. + + +%%------------------------------------------------------------------------- +%% clean(String) -> Stripped +%% String = Stripped = string() +%% +%% Description:clean/1 removes leading and/or trailing white spaces +%% from String. +%%------------------------------------------------------------------------- +clean(String) -> + {ok,CleanedString,_} = + inets_regexp:gsub(String, "^[ \t\n\r\f]*|[ \t\n\r\f]*\$",""), + CleanedString. + + +%%------------------------------------------------------------------------- +%% custom_clean(String,Before,After) -> Stripped +%% Before = After = regexp() +%% String = Stripped = string() +%% +%% Description: custom_clean/3 removes leading and/or trailing white +%% spaces and custom characters from String. +%%------------------------------------------------------------------------- +custom_clean(String,MoreBefore,MoreAfter) -> + {ok,CleanedString,_} = inets_regexp:gsub(String,"^[ \t\n\r\f"++MoreBefore++ + "]*|[ \t\n\r\f"++MoreAfter++"]*\$",""), + CleanedString. + + +%%------------------------------------------------------------------------- +%% check_enum(EnumString,ValidEnumStrings) -> Result +%% EnumString = string() +%% ValidEnumStrings = [string()] +%% Result = {ok,atom()} | {error,not_valid} +%% +%% Description: check_enum/2 checks if EnumString is a valid +%% enumeration of ValidEnumStrings in which case it is returned as an +%% atom. +%%------------------------------------------------------------------------- +check_enum(_Enum,[]) -> + {error, not_valid}; +check_enum(Enum,[Enum|_Rest]) -> + {ok, list_to_atom(Enum)}; +check_enum(Enum, [_NotValid|Rest]) -> + check_enum(Enum, Rest). + + %%%========================================================================= %%% Application internal API %%%========================================================================= @@ -81,7 +192,7 @@ {ok, Integer} -> {ok, [], {max_header_size,Integer}}; {error, _} -> - {error, ?NICE(string:strip(MaxHeaderSize)++ + {error, ?NICE(clean(MaxHeaderSize)++ " is an invalid number of MaxHeaderSize")} end; @@ -90,50 +201,50 @@ {ok, Integer} -> {ok, [], {max_uri_size, Integer}}; {error, _} -> - {error, ?NICE(string:strip(MaxHeaderSize)++ + {error, ?NICE(clean(MaxHeaderSize)++ " is an invalid number of MaxHeaderSize")} end; -load("MaxContentLength " ++ Max, []) -> - case make_integer(Max) of +load("MaxBodySize " ++ MaxBodySize, []) -> + case make_integer(MaxBodySize) of {ok, Integer} -> - {ok, [], {max_content_length, Integer}}; + {ok, [], {max_body_size,Integer}}; {error, _} -> - {error, ?NICE(string:strip(Max) ++ - " is an invalid number of MaxContentLength")} + {error, ?NICE(clean(MaxBodySize) ++ + " is an invalid number of MaxBodySize")} end; load("ServerName " ++ ServerName, []) -> - {ok,[], {server_name, string:strip(ServerName)}}; + {ok,[], {server_name, clean(ServerName)}}; load("ServerTokens " ++ ServerTokens, []) -> %% These are the valid *plain* server tokens: - %% none, prod, major, minor, minimum, os, full + %% sprod, major, minor, minimum, os, full %% It can also be a "private" server token: private: case string:tokens(ServerTokens, [$:]) of ["private", Private] -> - {ok,[], {server_tokens, string:strip(Private)}}; + {ok,[], {server_tokens, clean(Private)}}; [TokStr] -> - Tok = list_to_atom(string:strip(TokStr)), - case lists:member(Tok, [none, prod, major, minor, minimum, os, full]) of + Tok = list_to_atom(clean(TokStr)), + case lists:member(Tok, [prod, major, minor, minimum, os, full]) of true -> {ok,[], {server_tokens, Tok}}; false -> - {error, ?NICE(string:strip(ServerTokens) ++ + {error, ?NICE(clean(ServerTokens) ++ " is an invalid ServerTokens")} end; _ -> - {error, ?NICE(string:strip(ServerTokens) ++ " is an invalid ServerTokens")} + {error, ?NICE(clean(ServerTokens) ++ " is an invalid ServerTokens")} end; load("SocketType " ++ SocketType, []) -> %% ssl is the same as HTTP_DEFAULT_SSL_KIND %% essl is the pure Erlang-based ssl (the "new" ssl) - case check_enum(string:strip(SocketType), ["ssl", "essl", "ip_comm"]) of + case check_enum(clean(SocketType), ["ssl", "essl", "ip_comm"]) of {ok, ValidSocketType} -> {ok, [], {socket_type, ValidSocketType}}; {error,_} -> - {error, ?NICE(string:strip(SocketType) ++ " is an invalid SocketType")} + {error, ?NICE(clean(SocketType) ++ " is an invalid SocketType")} end; load("Port " ++ Port, []) -> @@ -141,7 +252,7 @@ {ok, Integer} -> {ok, [], {port, Integer}}; {error, _} -> - {error, ?NICE(string:strip(Port)++" is an invalid Port")} + {error, ?NICE(clean(Port)++" is an invalid Port")} end; load("BindAddress " ++ Address0, []) -> @@ -156,7 +267,7 @@ case string:tokens(Address0, [$|]) of [Address1] -> ?hdrv("load BindAddress", [{address1, Address1}]), - {clean_address(Address1), inet}; + {clean_address(Address1), inet6fb4}; [Address1, IpFamilyStr] -> ?hdrv("load BindAddress", [{address1, Address1}, @@ -197,7 +308,7 @@ end; load("KeepAlive " ++ OnorOff, []) -> - case list_to_atom(string:strip(OnorOff)) of + case list_to_atom(clean(OnorOff)) of off -> {ok, [], {keep_alive, false}}; _ -> @@ -209,7 +320,7 @@ {ok, Integer} -> {ok, [], {max_keep_alive_request, Integer}}; {error, _} -> - {error, ?NICE(string:strip(MaxRequests) ++ + {error, ?NICE(clean(MaxRequests) ++ " is an invalid MaxKeepAliveRequests")} end; @@ -219,16 +330,16 @@ {ok, Integer} -> {ok, [], {max_keep_alive_request, Integer}}; {error, _} -> - {error, ?NICE(string:strip(MaxRequests) ++ + {error, ?NICE(clean(MaxRequests) ++ " is an invalid MaxKeepAliveRequest")} end; load("KeepAliveTimeout " ++ Timeout, []) -> case make_integer(Timeout) of {ok, Integer} -> - {ok, [], {keep_alive_timeout, Integer}}; + {ok, [], {keep_alive_timeout, Integer*1000}}; {error, _} -> - {error, ?NICE(string:strip(Timeout)++" is an invalid KeepAliveTimeout")} + {error, ?NICE(clean(Timeout)++" is an invalid KeepAliveTimeout")} end; load("Modules " ++ Modules, []) -> @@ -236,18 +347,18 @@ {ok, [], {modules,[list_to_atom(X) || X <- ModuleList]}}; load("ServerAdmin " ++ ServerAdmin, []) -> - {ok, [], {server_admin,string:strip(ServerAdmin)}}; + {ok, [], {server_admin,clean(ServerAdmin)}}; load("ServerRoot " ++ ServerRoot, []) -> - case is_directory(string:strip(ServerRoot)) of + case is_directory(clean(ServerRoot)) of {ok, Directory} -> {ok, [], [{server_root,string:strip(Directory,right,$/)}]}; {error, _} -> - {error, ?NICE(string:strip(ServerRoot)++" is an invalid ServerRoot")} + {error, ?NICE(clean(ServerRoot)++" is an invalid ServerRoot")} end; load("MimeTypes " ++ MimeTypes, []) -> - case load_mime_types(white_space_clean(MimeTypes)) of + case load_mime_types(clean(MimeTypes)) of {ok, MimeTypesList} -> {ok, [], [{mime_types, MimeTypesList}]}; {error, Reason} -> @@ -259,24 +370,24 @@ {ok, Integer} -> {ok, [], {max_clients,Integer}}; {error, _} -> - {error, ?NICE(string:strip(MaxClients) ++ + {error, ?NICE(clean(MaxClients) ++ " is an invalid number of MaxClients")} end; load("DocumentRoot " ++ DocumentRoot,[]) -> - case is_directory(string:strip(DocumentRoot)) of + case is_directory(clean(DocumentRoot)) of {ok, Directory} -> {ok, [], {document_root,string:strip(Directory,right,$/)}}; {error, _} -> - {error, ?NICE(string:strip(DocumentRoot)++" is an invalid DocumentRoot")} + {error, ?NICE(clean(DocumentRoot)++" is an invalid DocumentRoot")} end; load("DefaultType " ++ DefaultType, []) -> - {ok, [], {default_type,string:strip(DefaultType)}}; + {ok, [], {default_type,clean(DefaultType)}}; load("SSLCertificateFile " ++ SSLCertificateFile, []) -> - case is_file(string:strip(SSLCertificateFile)) of + case is_file(clean(SSLCertificateFile)) of {ok, File} -> {ok, [], {ssl_certificate_file,File}}; {error, _} -> - {error, ?NICE(string:strip(SSLCertificateFile)++ + {error, ?NICE(clean(SSLCertificateFile)++ " is an invalid SSLCertificateFile")} end; load("SSLLogLevel " ++ SSLLogAlert, []) -> @@ -287,87 +398,80 @@ {ok, [], {ssl_log_alert, true}} end; load("SSLCertificateKeyFile " ++ SSLCertificateKeyFile, []) -> - case is_file(string:strip(SSLCertificateKeyFile)) of + case is_file(clean(SSLCertificateKeyFile)) of {ok, File} -> {ok, [], {ssl_certificate_key_file,File}}; {error, _} -> - {error, ?NICE(string:strip(SSLCertificateKeyFile)++ + {error, ?NICE(clean(SSLCertificateKeyFile)++ " is an invalid SSLCertificateKeyFile")} end; load("SSLVerifyClient " ++ SSLVerifyClient, []) -> - case make_integer(string:strip(SSLVerifyClient)) of + case make_integer(clean(SSLVerifyClient)) of {ok, Integer} when (Integer >=0) andalso (Integer =< 2) -> {ok, [], {ssl_verify_client,Integer}}; {ok, _Integer} -> - {error,?NICE(string:strip(SSLVerifyClient) ++ + {error,?NICE(clean(SSLVerifyClient) ++ " is an invalid SSLVerifyClient")}; {error, nomatch} -> - {error,?NICE(string:strip(SSLVerifyClient) ++ + {error,?NICE(clean(SSLVerifyClient) ++ " is an invalid SSLVerifyClient")} end; load("SSLVerifyDepth " ++ SSLVerifyDepth, []) -> - case make_integer(string:strip(SSLVerifyDepth)) of + case make_integer(clean(SSLVerifyDepth)) of {ok, Integer} when Integer > 0 -> {ok, [], {ssl_verify_client_depth,Integer}}; {ok, _Integer} -> - {error,?NICE(string:strip(SSLVerifyDepth) ++ + {error,?NICE(clean(SSLVerifyDepth) ++ " is an invalid SSLVerifyDepth")}; {error, nomatch} -> - {error,?NICE(string:strip(SSLVerifyDepth) ++ + {error,?NICE(clean(SSLVerifyDepth) ++ " is an invalid SSLVerifyDepth")} end; load("SSLCiphers " ++ SSLCiphers, []) -> - {ok, [], {ssl_ciphers, string:strip(SSLCiphers)}}; + {ok, [], {ssl_ciphers, clean(SSLCiphers)}}; load("SSLCACertificateFile " ++ SSLCACertificateFile, []) -> - case is_file(string:strip(SSLCACertificateFile)) of + case is_file(clean(SSLCACertificateFile)) of {ok, File} -> {ok, [], {ssl_ca_certificate_file,File}}; {error, _} -> - {error, ?NICE(string:strip(SSLCACertificateFile)++ + {error, ?NICE(clean(SSLCACertificateFile)++ " is an invalid SSLCACertificateFile")} end; load("SSLPasswordCallbackModule " ++ SSLPasswordCallbackModule, []) -> {ok, [], {ssl_password_callback_module, - list_to_atom(string:strip(SSLPasswordCallbackModule))}}; + list_to_atom(clean(SSLPasswordCallbackModule))}}; load("SSLPasswordCallbackFunction " ++ SSLPasswordCallbackFunction, []) -> {ok, [], {ssl_password_callback_function, - list_to_atom(string:strip(SSLPasswordCallbackFunction))}}; + list_to_atom(clean(SSLPasswordCallbackFunction))}}; load("SSLPasswordCallbackArguments " ++ SSLPasswordCallbackArguments, []) -> {ok, [], {ssl_password_callback_arguments, SSLPasswordCallbackArguments}}; load("DisableChunkedTransferEncodingSend " ++ TrueOrFalse, []) -> - case list_to_atom(string:strip(TrueOrFalse)) of + case list_to_atom(clean(TrueOrFalse)) of true -> {ok, [], {disable_chunked_transfer_encoding_send, true}}; _ -> {ok, [], {disable_chunked_transfer_encoding_send, false}} end; load("LogFormat " ++ LogFormat, []) -> - {ok,[],{log_format, list_to_atom(string:strip(LogFormat))}}; + {ok,[],{log_format, list_to_atom(httpd_conf:clean(LogFormat))}}; load("ErrorLogFormat " ++ LogFormat, []) -> - {ok,[],{error_log_format, list_to_atom(string:strip(LogFormat))}}. + {ok,[],{error_log_format, list_to_atom(httpd_conf:clean(LogFormat))}}. clean_address(Addr) -> - string:strip(string:strip(string:strip(Addr), left, $[), right, $]). + string:strip(string:strip(clean(Addr), left, $[), right, $]). make_ipfamily(IpFamilyStr) -> - validate_ipfamily(list_to_atom(IpFamilyStr)). - -validate_ipfamily(inet) -> - inet; -validate_ipfamily(inet6) -> - inet6; -%% Backwards compatibility wrapper, -%% fallback to the default, IPV4, -%% as it will most proably work. -%% IPv6 standard moved away from -%% beeing able to fallback to ipv4 -validate_ipfamily(inet6fb4) -> - inet; -validate_ipfamily(IpFamilyStr) -> - throw({error, {bad_ipfamily, IpFamilyStr}}). + IpFamily = list_to_atom(IpFamilyStr), + case lists:member(IpFamily, [inet, inet6, inet6fb4]) of + true -> + IpFamily; + false -> + throw({error, {bad_ipfamily, IpFamilyStr}}) + end. + %% %% load_mime_types/1 -> {ok, MimeTypes} | {error, Reason} @@ -400,16 +504,20 @@ undefined -> case proplists:get_value(sock_type, Properties, ip_comm) of ip_comm -> - add_inet_defaults(Properties); - {ip_comm, _} -> - add_inet_defaults(Properties); + case proplists:get_value(ipfamily, Properties) of + undefined -> + [{bind_address, any}, + {ipfamily, inet6fb4} | Properties]; + _ -> + [{bind_address, any} | Properties] + end; _ -> [{bind_address, any} | Properties] end; any -> Properties; Address0 -> - IpFamily = proplists:get_value(ipfamily, Properties, inet), + IpFamily = proplists:get_value(ipfamily, Properties, inet6fb4), case httpd_util:ip_address(Address0, IpFamily) of {ok, Address} -> Properties1 = proplists:delete(bind_address, Properties), @@ -421,16 +529,6 @@ throw(Error) end end. - -add_inet_defaults(Properties) -> - case proplists:get_value(ipfamily, Properties) of - undefined -> - [{bind_address, any}, - {ipfamily, inet} | Properties]; - _ -> - [{bind_address, any} | Properties] - end. - check_minimum_bytes_per_second(Properties) -> case proplists:get_value(minimum_bytes_per_second, Properties, false) of false -> @@ -471,12 +569,6 @@ validate_config_params([{max_body_size, Value} | _]) -> throw({max_body_size, Value}); -validate_config_params([{max_content_length, Value} | Rest]) - when is_integer(Value) andalso (Value > 0) -> - validate_config_params(Rest); -validate_config_params([{max_content_length, Value} | _]) -> - throw({max_content_length, Value}); - validate_config_params([{server_name, Value} | Rest]) when is_list(Value) -> validate_config_params(Rest); @@ -500,11 +592,12 @@ validate_config_params([{socket_type, ip_comm} | Rest]) -> validate_config_params(Rest); -validate_config_params([{socket_type, {Value, Opts}} | Rest]) when Value == ip_comm; - Value == ssl; - Value == essl -> - %% Make sure not to set socket values used internaly - validate_config_params(Opts), +validate_config_params([{socket_type, Value} | Rest]) + when Value == ssl; Value == essl -> + validate_config_params(Rest); + +validate_config_params([{socket_type, {Value, _}} | Rest]) + when Value == essl orelse Value == ssl -> validate_config_params(Rest); validate_config_params([{socket_type, Value} | _]) -> @@ -542,7 +635,7 @@ when is_integer(Value) andalso (Value > 0) -> validate_config_params(Rest); validate_config_params([{max_keep_alive_request, Value} | _]) -> - throw({max_keep_alive_request, Value}); + throw({max_header_size, Value}); validate_config_params([{keep_alive_timeout, Value} | Rest]) when is_integer(Value) andalso (Value >= 0) -> @@ -634,32 +727,21 @@ validate_config_params([{disable_chunked_transfer_encoding_send, Value} | _ ]) -> throw({disable_chunked_transfer_encoding_send, Value}); -validate_config_params([{Name, _} = Opt | _]) when Name == packet; - Name == mode; - Name == active; - Name == reuseaddr -> - throw({internaly_handled_opt_can_not_be_set, Opt}); validate_config_params([_| Rest]) -> validate_config_params(Rest). +%% It is actually pointless to check bind_address in this way since +%% we need ipfamily to do it properly... is_bind_address(any) -> true; is_bind_address(Value) -> - case is_bind_address(Value, inet) of - false -> - is_bind_address(Value, inet6); - True -> - True - end. - -is_bind_address(Value, IpFamily) -> - case httpd_util:ip_address(Value, IpFamily) of + case httpd_util:ip_address(Value, inet6fb4) of {ok, _} -> true; _ -> false end. - + store(ConfigList0) -> ?hdrd("store", []), try validate_config_params(ConfigList0) of @@ -669,9 +751,8 @@ ?hdrt("store", [{modules, Modules}]), Port = proplists:get_value(port, ConfigList0), Addr = proplists:get_value(bind_address, ConfigList0, any), - Profile = proplists:get_value(profile, ConfigList0, default), ConfigList = fix_mime_types(ConfigList0), - Name = httpd_util:make_name("httpd_conf", Addr, Port, Profile), + Name = httpd_util:make_name("httpd_conf", Addr, Port), ConfigDB = ets:new(Name, [named_table, bag, protected]), store(ConfigDB, ConfigList, lists:append(Modules, [?MODULE]), @@ -698,15 +779,8 @@ [{"html","text/html"},{"htm","text/html"}]} | ConfigList0] end; - MimeTypes -> - case filelib:is_file(MimeTypes) of - true -> - {ok, MimeTypesList} = load_mime_types(MimeTypes), - ConfigList = proplists:delete(mime_types, ConfigList0), - [{mime_types, MimeTypesList} | ConfigList]; - false -> - ConfigList0 - end + _ -> + ConfigList0 end. store({mime_types,MimeTypesList},ConfigList) -> @@ -725,7 +799,7 @@ Server = server(ServerTokens), {ok, [Entry, {server, Server}]}; store({keep_alive_timeout, KeepAliveTimeout}, _ConfigList) -> - {ok, {keep_alive_timeout, KeepAliveTimeout}}; + {ok, {keep_alive_timeout, KeepAliveTimeout * 1000}}; store(ConfigListEntry, _ConfigList) -> {ok, ConfigListEntry}. @@ -770,8 +844,6 @@ OS = os_info(full), lists:flatten( io_lib:format("~s ~s OTP/~s", [?SERVER_SOFTWARE, OS, OTPRelease])); -server(none = _ServerTokens) -> - ""; server({private, Server} = _ServerTokens) when is_list(Server) -> %% The user provide its own Server; @@ -799,16 +871,38 @@ ets:delete(ConfigDB), ok. +%% config(ConfigDB) -> +%% case httpd_util:lookup(ConfigDB, socket_type, ip_comm) of +%% ssl -> +%% case ssl_certificate_file(ConfigDB) of +%% undefined -> +%% {error, +%% "Directive SSLCertificateFile " +%% "not found in the config file"}; +%% SSLCertificateFile -> +%% {ssl, +%% SSLCertificateFile++ +%% ssl_certificate_key_file(ConfigDB)++ +%% ssl_verify_client(ConfigDB)++ +%% ssl_ciphers(ConfigDB)++ +%% ssl_password(ConfigDB)++ +%% ssl_verify_depth(ConfigDB)++ +%% ssl_ca_certificate_file(ConfigDB)} +%% end; +%% ip_comm -> +%% ip_comm +%% end. -get_config(Address, Port, Profile) -> - Tab = httpd_util:make_name("httpd_conf", Address, Port, Profile), + +get_config(Address, Port) -> + Tab = httpd_util:make_name("httpd_conf", Address, Port), Properties = ets:tab2list(Tab), MimeTab = proplists:get_value(mime_types, Properties), NewProperties = proplists:delete(mime_types, Properties), [{mime_types, ets:tab2list(MimeTab)} | NewProperties]. -get_config(Address, Port, Profile, Properties) -> - Tab = httpd_util:make_name("httpd_conf", Address, Port, Profile), +get_config(Address, Port, Properties) -> + Tab = httpd_util:make_name("httpd_conf", Address, Port), Config = lists:map(fun(Prop) -> {Prop, httpd_util:lookup(Tab, Prop)} end, Properties), @@ -837,8 +931,6 @@ case httpd_util:lookup(ConfigDB, socket_type, ip_comm) of ip_comm -> ip_comm; - {ip_comm, _} = Type -> - Type; {Tag, Conf} -> {Tag, Conf}; SSL when (SSL =:= ssl) orelse (SSL =:= essl) -> @@ -978,7 +1070,7 @@ verify_modules([Mod|Rest]) -> case code:which(Mod) of non_existing -> - {error, ?NICE(string:strip(atom_to_list(Mod), right, $\n) ++" does not exist")}; + {error, ?NICE(atom_to_list(Mod)++" does not exist")}; _Path -> verify_modules(Rest) end. @@ -1020,7 +1112,7 @@ eof -> eof; String -> - white_space_clean(String) + clean(String) end, parse_mime_types(Stream, MimeTypesList, Line). parse_mime_types(Stream, MimeTypesList, eof) -> @@ -1201,73 +1293,9 @@ end. plain_server_tokens() -> - [none, prod, major, minor, minimum, os, full]. + [prod, major, minor, minimum, os, full]. error_report(Where,M,F,Error) -> error_logger:error_report([{?MODULE, Where}, {apply, {M, F, []}}, Error]). -white_space_clean(String) -> - {ok,CleanedString,_} = - inets_regexp:gsub(String, "^[ \t\n\r\f]*|[ \t\n\r\f]*\$",""), - CleanedString. - - -%%%========================================================================= -%%% Deprecated remove in 19 -%%%========================================================================= -is_directory(Directory) -> - case file:read_file_info(Directory) of - {ok,FileInfo} -> - #file_info{type = Type, access = Access} = FileInfo, - is_directory(Type,Access,FileInfo,Directory); - {error,Reason} -> - {error,Reason} - end. -is_directory(directory,read,_FileInfo,Directory) -> - {ok,Directory}; -is_directory(directory,read_write,_FileInfo,Directory) -> - {ok,Directory}; -is_directory(_Type,_Access,FileInfo,_Directory) -> - {error,FileInfo}. - -is_file(File) -> - case file:read_file_info(File) of - {ok,FileInfo} -> - #file_info{type = Type, access = Access} = FileInfo, - is_file(Type,Access,FileInfo,File); - {error,Reason} -> - {error,Reason} - end. -is_file(regular,read,_FileInfo,File) -> - {ok,File}; -is_file(regular,read_write,_FileInfo,File) -> - {ok,File}; -is_file(_Type,_Access,FileInfo,_File) -> - {error,FileInfo}. - -make_integer(String) -> - case inets_regexp:match(string:strip(String),"[0-9]+") of - {match, _, _} -> - {ok, list_to_integer(string:strip(String))}; - nomatch -> - {error, nomatch} - end. - -clean(String) -> - {ok,CleanedString,_} = - inets_regexp:gsub(String, "^[ \t\n\r\f]*|[ \t\n\r\f]*\$",""), - CleanedString. - -custom_clean(String,MoreBefore,MoreAfter) -> - {ok,CleanedString,_} = inets_regexp:gsub(String,"^[ \t\n\r\f"++MoreBefore++ - "]*|[ \t\n\r\f"++MoreAfter++"]*\$",""), - CleanedString. - -check_enum(_Enum,[]) -> - {error, not_valid}; -check_enum(Enum,[Enum|_Rest]) -> - {ok, list_to_atom(Enum)}; -check_enum(Enum, [_NotValid|Rest]) -> - check_enum(Enum, Rest). - diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_connection_sup.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_connection_sup.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_connection_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_connection_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_custom_api.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_custom_api.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_custom_api.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_custom_api.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(httpd_custom_api). - --callback response_default_headers() -> - [{Key::string(), Value::string()}]. --callback response_header({Key::string(), Value::string()}) -> - {true, {Key::string(), Value::string()}} | false | - {true, string()}. %% Used internally to avoid traversing headers twice --callback request_header({Key::string(), Value::string()}) -> - {true, {Key::string(), Value::string()}} | false. - --optional_callbacks([response_default_headers/0, response_header/1, - request_header/1]). diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_custom.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_custom.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_custom.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_custom.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(httpd_custom). - --export([response_header/1, request_header/1, response_default_headers/0]). --export([customize_headers/3, response_default_headers/1]). - --include("../inets_app/inets_internal.hrl"). - --behaviour(httpd_custom_api). - -%%-------------------------------------------------------------------- -%% Behavior API ----------------------------------- -%%-------------------------------------------------------------------- - -response_header(Header) -> - {true, httpify(Header)}. -request_header(Header) -> - {true, Header}. -response_default_headers() -> - []. - -%%-------------------------------------------------------------------- -%% Internal API ----------------------------------- -%%-------------------------------------------------------------------- -customize_headers(?MODULE, Function, Arg) -> - ?MODULE:Function(Arg); -customize_headers(Module, Function, Arg) -> - try Module:Function(Arg) of - {true, Value} -> - ?MODULE:Function(Value); - false -> - false - catch - _:_ -> - ?MODULE:Function(Arg) - end. - -response_default_headers(?MODULE) -> - response_default_headers(); -response_default_headers(Module) -> - try Module:response_default_headers() of - Defaults -> - [{http_util:to_lower(Key), Value} || {Key, Value} <- Defaults, - is_list(Key), is_list(Value)] - catch - _:_ -> - ?MODULE:response_default_headers() - end. -%%-------------------------------------------------------------------- -%% Internal functions ----------------------------------- -%%-------------------------------------------------------------------- -httpify({Key0, Value}) -> - %% make sure first letter is capital (defacto standard) - Words1 = string:tokens(Key0, "-"), - Words2 = upify(Words1, []), - Key = new_key(Words2), - Key ++ ": " ++ Value ++ ?CRLF . - -new_key([]) -> - ""; -new_key([W]) -> - W; -new_key([W1,W2]) -> - W1 ++ "-" ++ W2; -new_key([W|R]) -> - W ++ "-" ++ new_key(R). - -upify([], Acc) -> - lists:reverse(Acc); -upify([Key|Rest], Acc) -> - upify(Rest, [upify2(Key)|Acc]). - -upify2([C|Rest]) when (C >= $a) andalso (C =< $z) -> - [C-($a-$A)|Rest]; -upify2(Str) -> - Str. diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,7 +23,6 @@ -behaviour(inets_service). -include("httpd.hrl"). --include("httpd_internal.hrl"). %% Behavior callbacks -export([ @@ -63,27 +61,18 @@ {ok, ServiceInfo} = service_info(Pid), Address = proplists:get_value(bind_address, ServiceInfo), Port = proplists:get_value(port, ServiceInfo), - Profile = proplists:get_value(profile, ServiceInfo, default), case Properties of [] -> - info(Address, Port, Profile); + info(Address, Port); _ -> - info(Address, Port, Profile, Properties) + info(Address, Port, Properties) end; - info(Address, Port) when is_integer(Port) -> - info(Address, Port, default). - -info(Address, Port, Profile) when is_integer(Port), is_atom(Profile) -> - httpd_conf:get_config(Address, Port, Profile); + httpd_conf:get_config(Address, Port). info(Address, Port, Properties) when is_integer(Port) andalso is_list(Properties) -> - httpd_conf:get_config(Address, Port, default, Properties). - -info(Address, Port, Profile, Properties) when is_integer(Port) andalso - is_atom(Profile) andalso is_list(Properties) -> - httpd_conf:get_config(Address, Port, Profile, Properties). + httpd_conf:get_config(Address, Port, Properties). %%%======================================================================== @@ -97,16 +86,14 @@ httpd_sup:start_child(Conf). stop_service({Address, Port}) -> - stop_service({Address, Port, ?DEFAULT_PROFILE}); -stop_service({Address, Port, Profile}) -> - httpd_sup:stop_child(Address, Port, Profile); + httpd_sup:stop_child(Address, Port); + stop_service(Pid) when is_pid(Pid) -> case service_info(Pid) of {ok, Info} -> Address = proplists:get_value(bind_address, Info), Port = proplists:get_value(port, Info), - Profile = proplists:get_value(profile, Info, ?DEFAULT_PROFILE), - stop_service({Address, Port, Profile}); + stop_service({Address, Port}); Error -> Error end. @@ -114,6 +101,7 @@ services() -> [{httpd, ChildPid} || {_, ChildPid, _, _} <- supervisor:which_children(httpd_sup)]. + service_info(Pid) -> try [{ChildName, ChildPid} || @@ -126,6 +114,7 @@ {error, service_not_available} end. + %%%-------------------------------------------------------------- %%% Internal functions %%%-------------------------------------------------------------------- @@ -139,12 +128,12 @@ child_name2info(undefined) -> {error, no_such_service}; -child_name2info({httpd_instance_sup, any, Port, Profile}) -> +child_name2info({httpd_instance_sup, any, Port}) -> {ok, Host} = inet:gethostname(), - Info = info(any, Port, Profile, [server_name]), + Info = info(any, Port, [server_name]), {ok, [{bind_address, any}, {host, Host}, {port, Port} | Info]}; -child_name2info({httpd_instance_sup, Address, Port, Profile}) -> - Info = info(Address, Port, Profile, [server_name]), +child_name2info({httpd_instance_sup, Address, Port}) -> + Info = info(Address, Port, [server_name]), case inet:gethostbyaddr(Address) of {ok, {_, Host, _, _,_, _}} -> {ok, [{bind_address, Address}, @@ -154,8 +143,8 @@ end. -reload(Config, Address, Port, Profile) -> - Name = make_name(Address,Port, Profile), +reload(Config, Address, Port) -> + Name = make_name(Address,Port), case whereis(Name) of Pid when is_pid(Pid) -> httpd_manager:reload(Pid, Config); @@ -202,19 +191,51 @@ %%% Timeout -> integer() %%% -block(Addr, Port, Profile, disturbing) when is_integer(Port) -> - do_block(Addr, Port, Profile, disturbing); -block(Addr, Port, Profile, non_disturbing) when is_integer(Port) -> - do_block(Addr, Port, Profile, non_disturbing). -do_block(Addr, Port, Profile, Mode) when is_integer(Port) andalso is_atom(Mode) -> - Name = make_name(Addr, Port, Profile), +block(Addr, Port, disturbing) when is_integer(Port) -> + do_block(Addr, Port, disturbing); +block(Addr, Port, non_disturbing) when is_integer(Port) -> + do_block(Addr, Port, non_disturbing); + +block(ConfigFile, Mode, Timeout) + when is_list(ConfigFile) andalso + is_atom(Mode) andalso + is_integer(Timeout) -> + case get_addr_and_port(ConfigFile) of + {ok, Addr, Port} -> + block(Addr, Port, Mode, Timeout); + Error -> + Error + end. + + +block(Addr, Port, non_disturbing, Timeout) + when is_integer(Port) andalso is_integer(Timeout) -> + do_block(Addr, Port, non_disturbing, Timeout); +block(Addr,Port,disturbing,Timeout) + when is_integer(Port) andalso is_integer(Timeout) -> + do_block(Addr, Port, disturbing, Timeout). + +do_block(Addr, Port, Mode) when is_integer(Port) andalso is_atom(Mode) -> + Name = make_name(Addr,Port), + case whereis(Name) of + Pid when is_pid(Pid) -> + httpd_manager:block(Pid,Mode); + _ -> + {error,not_started} + end. + + +do_block(Addr, Port, Mode, Timeout) + when is_integer(Port) andalso is_atom(Mode) -> + Name = make_name(Addr,Port), case whereis(Name) of Pid when is_pid(Pid) -> - httpd_manager:block(Pid, Mode); + httpd_manager:block(Pid,Mode,Timeout); _ -> {error,not_started} end. + %%% ========================================================= %%% Function: unblock/2 %%% unblock(Addr, Port) @@ -227,8 +248,8 @@ %%% ConfigFile -> string() %%% -unblock(Addr, Port, Profile) when is_integer(Port) -> - Name = make_name(Addr,Port, Profile), +unblock(Addr, Port) when is_integer(Port) -> + Name = make_name(Addr,Port), case whereis(Name) of Pid when is_pid(Pid) -> httpd_manager:unblock(Pid); @@ -248,9 +269,24 @@ foreach(Rest) end. +get_addr_and_port(ConfigFile) -> + case httpd_conf:load(ConfigFile) of + {ok, ConfigList} -> + case (catch httpd_conf:validate_properties(ConfigList)) of + {ok, Config} -> + Address = proplists:get_value(bind_address, Config, any), + Port = proplists:get_value(port, Config, 80), + {ok, Address, Port}; + Error -> + Error + end; + Error -> + Error + end. + -make_name(Addr, Port, Profile) -> - httpd_util:make_name("httpd", Addr, Port, Profile). +make_name(Addr, Port) -> + httpd_util:make_name("httpd", Addr, Port). do_reload_config(ConfigList, Mode) -> @@ -258,11 +294,10 @@ {ok, Config} -> Address = proplists:get_value(bind_address, Config, any), Port = proplists:get_value(port, Config, 80), - Profile = proplists:get_value(profile, Config, default), - case block(Address, Port, Profile, Mode) of + case block(Address, Port, Mode) of ok -> - reload(Config, Address, Port, Profile), - unblock(Address, Port, Profile); + reload(Config, Address, Port), + unblock(Address, Port); Error -> Error end; diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_esi.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_esi.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_esi.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_esi.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_example.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_example.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_example.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_example.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,7 +23,7 @@ -export([newformat/3]). %% These are used by the inets test-suite --export([delay/1, chunk_timeout/3]). +-export([delay/1]). print(String) -> @@ -127,7 +126,9 @@ i("httpd_example:delay(~p) -> done, now reply",[Time]), delay_reply("delay ok"); delay(Time) when is_list(Time) -> - delay(list_to_integer(Time)); + delay(httpd_conf:make_integer(Time)); +delay({ok,Time}) when is_integer(Time) -> + delay(Time); delay({error,_Reason}) -> i("delay -> called with invalid time"), delay_reply("delay failed: invalid delay time"). @@ -142,11 +143,3 @@ i(F,A) -> io:format(F ++ "~n",A). sleep(T) -> receive after T -> ok end. - -%% ------------------------------------------------------ - -chunk_timeout(SessionID, _, StrInt) -> - mod_esi:deliver(SessionID, "Tranfer-Encoding:chunked/html\r\n\r\n"), - mod_esi:deliver(SessionID, top("Test chunk encoding timeout")), - timer:sleep(20000), - mod_esi:deliver(SessionID, footer()). diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_file.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_file.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_file.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_file.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd.hrl erlang-17.3-dfsg/lib/inets/src/http_server/httpd.hrl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_instance_sup.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_instance_sup.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_instance_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_instance_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -28,8 +27,6 @@ -behaviour(supervisor). --include("httpd_internal.hrl"). - %% Internal application API -export([start_link/3, start_link/4]). @@ -44,8 +41,7 @@ {ok, Config2} -> Address = proplists:get_value(bind_address, Config2), Port = proplists:get_value(port, Config2), - Profile = proplists:get_value(profile, Config2, ?DEFAULT_PROFILE), - Name = make_name(Address, Port, Profile), + Name = make_name(Address, Port), SupName = {local, Name}, supervisor:start_link(SupName, ?MODULE, [undefined, Config2, AcceptTimeout, @@ -58,8 +54,7 @@ start_link(ConfigFile, AcceptTimeout, Debug) -> case file_2_config(ConfigFile) of {ok, ConfigList, Address, Port} -> - Profile = proplists:get_value(profile, ConfigList, ?DEFAULT_PROFILE), - Name = make_name(Address, Port, Profile), + Name = make_name(Address, Port), SupName = {local, Name}, supervisor:start_link(SupName, ?MODULE, [ConfigFile, ConfigList, AcceptTimeout, @@ -75,8 +70,7 @@ {ok, Config2} -> Address = proplists:get_value(bind_address, Config2), Port = proplists:get_value(port, Config2), - Profile = proplists:get_value(profile, Config2, ?DEFAULT_PROFILE), - Name = make_name(Address, Port, Profile), + Name = make_name(Address, Port), SupName = {local, Name}, supervisor:start_link(SupName, ?MODULE, [undefined, Config2, AcceptTimeout, @@ -89,8 +83,7 @@ start_link(ConfigFile, AcceptTimeout, ListenInfo, Debug) -> case file_2_config(ConfigFile) of {ok, ConfigList, Address, Port} -> - Profile = proplists:get_value(profile, ConfigList, ?DEFAULT_PROFILE), - Name = make_name(Address, Port, Profile), + Name = make_name(Address, Port), SupName = {local, Name}, supervisor:start_link(SupName, ?MODULE, [ConfigFile, ConfigList, AcceptTimeout, @@ -106,24 +99,22 @@ %%%========================================================================= init([ConfigFile, ConfigList, AcceptTimeout, Debug, Address, Port]) -> httpd_util:enable_debug(Debug), - Profile = proplists:get_value(profile, ConfigList, ?DEFAULT_PROFILE), Flags = {one_for_one, 0, 1}, - Children = [httpd_connection_sup_spec(Address, Port, Profile), - httpd_acceptor_sup_spec(Address, Port, Profile, ConfigList, AcceptTimeout, + Children = [httpd_connection_sup_spec(Address, Port), + httpd_acceptor_sup_spec(Address, Port, ConfigList, AcceptTimeout, undefined), - sup_spec(httpd_misc_sup, Address, Port, Profile), - worker_spec(httpd_manager, Address, Port, Profile, + sup_spec(httpd_misc_sup, Address, Port), + worker_spec(httpd_manager, Address, Port, ConfigFile, ConfigList,AcceptTimeout)], {ok, {Flags, Children}}; init([ConfigFile, ConfigList, AcceptTimeout, Debug, Address, Port, ListenInfo]) -> httpd_util:enable_debug(Debug), - Profile = proplists:get_value(profile, ConfigList, ?DEFAULT_PROFILE), Flags = {one_for_one, 0, 1}, - Children = [httpd_connection_sup_spec(Address, Port, Profile), - httpd_acceptor_sup_spec(Address, Port, Profile, ConfigList, AcceptTimeout, - ListenInfo), - sup_spec(httpd_misc_sup, Address, Port, Profile), - worker_spec(httpd_manager, Address, Port, Profile, ListenInfo, + Children = [httpd_connection_sup_spec(Address, Port), + httpd_acceptor_sup_spec(Address, Port, ConfigList, AcceptTimeout, + ListenInfo), + sup_spec(httpd_misc_sup, Address, Port), + worker_spec(httpd_manager, Address, Port, ListenInfo, ConfigFile, ConfigList, AcceptTimeout)], {ok, {Flags, Children}}. @@ -131,8 +122,8 @@ %%%========================================================================= %%% Internal functions %%%========================================================================= -httpd_connection_sup_spec(Address, Port, Profile) -> - Name = {httpd_connection_sup, Address, Port, Profile}, +httpd_connection_sup_spec(Address, Port) -> + Name = {httpd_connection_sup, Address, Port}, StartFunc = {httpd_connection_sup, start_link, [[Address, Port]]}, Restart = permanent, Shutdown = 5000, @@ -140,8 +131,8 @@ Type = supervisor, {Name, StartFunc, Restart, Shutdown, Type, Modules}. -httpd_acceptor_sup_spec(Address, Port, Profile, ConfigList, AcceptTimeout, ListenInfo) -> - Name = {httpd_acceptor_sup, Address, Port, Profile}, +httpd_acceptor_sup_spec(Address, Port, ConfigList, AcceptTimeout, ListenInfo) -> + Name = {httpd_acceptor_sup, Address, Port}, StartFunc = {httpd_acceptor_sup, start_link, [[Address, Port, ConfigList, AcceptTimeout, ListenInfo]]}, Restart = permanent, Shutdown = infinity, @@ -149,18 +140,18 @@ Type = supervisor, {Name, StartFunc, Restart, Shutdown, Type, Modules}. -sup_spec(SupModule, Address, Port, Profile) -> - Name = {SupModule, Address, Port, Profile}, - StartFunc = {SupModule, start_link, [Address, Port, Profile]}, +sup_spec(SupModule, Address, Port) -> + Name = {SupModule, Address, Port}, + StartFunc = {SupModule, start_link, [Address, Port]}, Restart = permanent, Shutdown = infinity, Modules = [SupModule], Type = supervisor, {Name, StartFunc, Restart, Shutdown, Type, Modules}. -worker_spec(WorkerModule, Address, Port, Profile, ConfigFile, +worker_spec(WorkerModule, Address, Port, ConfigFile, ConfigList, AcceptTimeout) -> - Name = {WorkerModule, Address, Port, Profile}, + Name = {WorkerModule, Address, Port}, StartFunc = {WorkerModule, start_link, [ConfigFile, ConfigList, AcceptTimeout]}, Restart = permanent, @@ -169,9 +160,9 @@ Type = worker, {Name, StartFunc, Restart, Shutdown, Type, Modules}. -worker_spec(WorkerModule, Address, Port, Profile, ListenInfo, ConfigFile, +worker_spec(WorkerModule, Address, Port, ListenInfo, ConfigFile, ConfigList, AcceptTimeout) -> - Name = {WorkerModule, Address, Port, Profile}, + Name = {WorkerModule, Address, Port}, StartFunc = {WorkerModule, start_link, [ConfigFile, ConfigList, AcceptTimeout, ListenInfo]}, Restart = permanent, @@ -180,8 +171,8 @@ Type = worker, {Name, StartFunc, Restart, Shutdown, Type, Modules}. -make_name(Address, Port, Profile) -> - httpd_util:make_name("httpd_instance_sup", Address, Port, Profile). +make_name(Address,Port) -> + httpd_util:make_name("httpd_instance_sup", Address, Port). file_2_config(ConfigFile) -> diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_internal.hrl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_internal.hrl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -32,8 +31,6 @@ -define(SOCKET_MAX_POLL,25). -define(FILE_CHUNK_SIZE,64*1024). -define(GATEWAY_INTERFACE,"CGI/1.1"). --define(DEFAULT_PROFILE, default). - -define(NICE(Reason),lists:flatten(atom_to_list(?MODULE)++": "++Reason)). -define(DEFAULT_CONTEXT, [{errmsg,"[an error occurred while processing this directive]"}, diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_log.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_log.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_log.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_log.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_manager.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_manager.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_manager.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_manager.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,7 +28,7 @@ -export([start/2, start_link/2, start_link/3, start_link/4, stop/1, reload/2]). -export([new_connection/1]). --export([config_match/3, config_match/4]). +-export([config_match/2, config_match/3]). -export([block/2, block/3, unblock/1]). %% gen_server exports @@ -55,8 +54,7 @@ start(ConfigFile, ConfigList) -> Port = proplists:get_value(port,ConfigList,80), Addr = proplists:get_value(bind_address, ConfigList), - Profile = proplists:get_value(profile, ConfigList, default), - Name = make_name(Addr, Port, Profile), + Name = make_name(Addr,Port), gen_server:start({local,Name},?MODULE, [ConfigFile, ConfigList, 15000, Addr, Port],[]). @@ -67,8 +65,7 @@ start_link(ConfigFile, ConfigList, AcceptTimeout) -> Port = proplists:get_value(port, ConfigList, 80), Addr = proplists:get_value(bind_address, ConfigList), - Profile = proplists:get_value(profile, ConfigList, default), - Name = make_name(Addr, Port, Profile), + Name = make_name(Addr, Port), gen_server:start_link({local, Name},?MODULE, [ConfigFile, ConfigList, @@ -77,8 +74,7 @@ start_link(ConfigFile, ConfigList, AcceptTimeout, ListenSocket) -> Port = proplists:get_value(port, ConfigList, 80), Addr = proplists:get_value(bind_address, ConfigList), - Profile = proplists:get_value(profile, ConfigList, default), - Name = make_name(Addr, Port, Profile), + Name = make_name(Addr, Port), gen_server:start_link({local, Name},?MODULE, [ConfigFile, ConfigList, AcceptTimeout, Addr, @@ -101,10 +97,10 @@ new_connection(Manager) -> call(Manager, {new_connection, self()}). -config_match(Port, Profile, Pattern) -> - config_match(undefined,Port, Profile, Pattern). -config_match(Addr, Port, Profile, Pattern) -> - Name = httpd_util:make_name("httpd",Addr,Port, Profile), +config_match(Port, Pattern) -> + config_match(undefined,Port,Pattern). +config_match(Addr, Port, Pattern) -> + Name = httpd_util:make_name("httpd",Addr,Port), call(whereis(Name), {config_match, Pattern}). %%%-------------------------------------------------------------------- @@ -450,8 +446,8 @@ active end. -make_name(Addr, Port, Profile) -> - httpd_util:make_name("httpd", Addr, Port, Profile). +make_name(Addr,Port) -> + httpd_util:make_name("httpd",Addr,Port). report_error(State,String) -> diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_misc_sup.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_misc_sup.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_misc_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_misc_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -28,8 +27,8 @@ -behaviour(supervisor). %% API --export([start_link/3, start_auth_server/3, stop_auth_server/3, - start_sec_server/3, stop_sec_server/3]). +-export([start_link/2, start_auth_server/2, stop_auth_server/2, + start_sec_server/2, stop_sec_server/2]). %% Supervisor callback -export([init/1]). @@ -38,26 +37,26 @@ %%% API %%%========================================================================= -start_link(Addr, Port, Profile) -> - SupName = make_name(Addr, Port, Profile), +start_link(Addr, Port) -> + SupName = make_name(Addr, Port), supervisor:start_link({local, SupName}, ?MODULE, []). %%---------------------------------------------------------------------- %% Function: [start|stop]_[auth|sec]_server/3 %% Description: Starts a [auth | security] worker (child) process %%---------------------------------------------------------------------- -start_auth_server(Addr, Port, Profile) -> - start_permanent_worker(mod_auth_server, Addr, Port, Profile, [gen_server]). +start_auth_server(Addr, Port) -> + start_permanent_worker(mod_auth_server, Addr, Port, [gen_server]). -stop_auth_server(Addr, Port, Profile) -> - stop_permanent_worker(mod_auth_server, Addr, Port, Profile). +stop_auth_server(Addr, Port) -> + stop_permanent_worker(mod_auth_server, Addr, Port). -start_sec_server(Addr, Port, Profile) -> - start_permanent_worker(mod_security_server, Addr, Port, Profile, [gen_server]). +start_sec_server(Addr, Port) -> + start_permanent_worker(mod_security_server, Addr, Port, [gen_server]). -stop_sec_server(Addr, Port, Profile) -> - stop_permanent_worker(mod_security_server, Addr, Port, Profile). +stop_sec_server(Addr, Port) -> + stop_permanent_worker(mod_security_server, Addr, Port). %%%========================================================================= @@ -71,15 +70,15 @@ %%%========================================================================= %%% Internal functions %%%========================================================================= -start_permanent_worker(Mod, Addr, Port, Profile, Modules) -> - SupName = make_name(Addr, Port, Profile), +start_permanent_worker(Mod, Addr, Port, Modules) -> + SupName = make_name(Addr, Port), Spec = {{Mod, Addr, Port}, - {Mod, start_link, [Addr, Port, Profile]}, + {Mod, start_link, [Addr, Port]}, permanent, timer:seconds(1), worker, [Mod] ++ Modules}, supervisor:start_child(SupName, Spec). -stop_permanent_worker(Mod, Addr, Port, Profile) -> - SupName = make_name(Addr, Port, Profile), +stop_permanent_worker(Mod, Addr, Port) -> + SupName = make_name(Addr, Port), Name = {Mod, Addr, Port}, case supervisor:terminate_child(SupName, Name) of ok -> @@ -88,5 +87,5 @@ Error end. -make_name(Addr,Port, Profile) -> - httpd_util:make_name("httpd_misc_sup",Addr,Port, Profile). +make_name(Addr,Port) -> + httpd_util:make_name("httpd_misc_sup",Addr,Port). diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_request.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_request.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_request.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_request.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2015. All Rights Reserved. +%% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -43,28 +42,28 @@ %%%========================================================================= %%% Internal application API %%%========================================================================= -parse([Bin, Options]) -> - ?hdrt("parse", [{bin, Bin}, {max_sizes, Options}]), - parse_method(Bin, [], 0, proplists:get_value(max_method, Options), Options, []); +parse([Bin, MaxSizes]) -> + ?hdrt("parse", [{bin, Bin}, {max_sizes, MaxSizes}]), + parse_method(Bin, [], 0, proplists:get_value(max_method, MaxSizes), MaxSizes, []); parse(Unknown) -> ?hdrt("parse", [{unknown, Unknown}]), exit({bad_args, Unknown}). %% Functions that may be returned during the decoding process %% if the input data is incompleate. -parse_method([Bin, Method, Current, Max, Options, Result]) -> - parse_method(Bin, Method, Current, Max, Options, Result). +parse_method([Bin, Method, Current, Max, MaxSizes, Result]) -> + parse_method(Bin, Method, Current, Max, MaxSizes, Result). -parse_uri([Bin, URI, Current, Max, Options, Result]) -> - parse_uri(Bin, URI, Current, Max, Options, Result). +parse_uri([Bin, URI, Current, Max, MaxSizes, Result]) -> + parse_uri(Bin, URI, Current, Max, MaxSizes, Result). -parse_version([Bin, Rest, Version, Current, Max, Options, Result]) -> - parse_version(<>, Version, Current, Max, Options, +parse_version([Bin, Rest, Version, Current, Max, MaxSizes, Result]) -> + parse_version(<>, Version, Current, Max, MaxSizes, Result). -parse_headers([Bin, Rest, Header, Headers, Current, Max, Options, Result]) -> +parse_headers([Bin, Rest, Header, Headers, Current, Max, MaxSizes, Result]) -> parse_headers(<>, - Header, Headers, Current, Max, Options, Result). + Header, Headers, Current, Max, MaxSizes, Result). whole_body([Bin, Body, Length]) -> whole_body(<>, Length). @@ -119,123 +118,108 @@ %% create it. %% ---------------------------------------------------------------------- update_mod_data(ModData, Method, RequestURI, HTTPVersion, Headers)-> - PersistentConn = get_persistens(HTTPVersion, Headers, + ParsedHeaders = tagup_header(Headers), + PersistentConn = get_persistens(HTTPVersion, ParsedHeaders, ModData#mod.config_db), {ok, ModData#mod{data = [], method = Method, absolute_uri = format_absolute_uri(RequestURI, - Headers), + ParsedHeaders), request_uri = format_request_uri(RequestURI), http_version = HTTPVersion, request_line = Method ++ " " ++ RequestURI ++ " " ++ HTTPVersion, - parsed_header = Headers, + parsed_header = ParsedHeaders, connection = PersistentConn}}. %%%======================================================================== %%% Internal functions %%%======================================================================== -parse_method(<<>>, Method, Current, Max, Options, Result) -> - {?MODULE, parse_method, [Method, Current, Max, Options, Result]}; -parse_method(<>, Method, _Current, _Max, Options, Result) -> - parse_uri(Rest, [], 0, proplists:get_value(max_uri, Options), Options, +parse_method(<<>>, Method, Current, Max, MaxSizes, Result) -> + {?MODULE, parse_method, [Method, Current, Max, MaxSizes, Result]}; +parse_method(<>, Method, _Current, _Max, MaxSizes, Result) -> + parse_uri(Rest, [], 0, proplists:get_value(max_uri, MaxSizes), MaxSizes, [string:strip(lists:reverse(Method)) | Result]); -parse_method(<>, Method, Current, Max, Options, Result) when Current =< Max -> - parse_method(Rest, [Octet | Method], Current + 1, Max, Options, Result); +parse_method(<>, Method, Current, Max, MaxSizes, Result) when Current =< Max -> + parse_method(Rest, [Octet | Method], Current + 1, Max, MaxSizes, Result); parse_method(_, _, _, Max, _, _) -> %% We do not know the version of the client as it comes after the %% method send the lowest version in the response so that the client %% will be able to handle it. - {error, {size_error, Max, 413, "Method unreasonably long"}, lowest_version()}. + {error, {too_long, Max, 413, "Method unreasonably long"}, lowest_version()}. parse_uri(_, _, Current, MaxURI, _, _) when (Current > MaxURI) andalso (MaxURI =/= nolimit) -> %% We do not know the version of the client as it comes after the %% uri send the lowest version in the response so that the client %% will be able to handle it. - {error, {size_error, MaxURI, 414, "URI unreasonably long"},lowest_version()}; -parse_uri(<<>>, URI, Current, Max, Options, Result) -> - {?MODULE, parse_uri, [URI, Current, Max, Options, Result]}; -parse_uri(<>, URI, _, _, Options, Result) -> - parse_version(Rest, [], 0, proplists:get_value(max_version, Options), Options, + {error, {too_long, MaxURI, 414, "URI unreasonably long"},lowest_version()}; +parse_uri(<<>>, URI, Current, Max, MaxSizes, Result) -> + {?MODULE, parse_uri, [URI, Current, Max, MaxSizes, Result]}; +parse_uri(<>, URI, _, _, MaxSizes, Result) -> + parse_version(Rest, [], 0, proplists:get_value(max_version, MaxSizes), MaxSizes, [string:strip(lists:reverse(URI)) | Result]); %% Can happen if it is a simple HTTP/0.9 request e.i "GET /\r\n\r\n" -parse_uri(<> = Data, URI, _, _, Options, Result) -> - parse_version(Data, [], 0, proplists:get_value(max_version, Options), Options, +parse_uri(<> = Data, URI, _, _, MaxSizes, Result) -> + parse_version(Data, [], 0, proplists:get_value(max_version, MaxSizes), MaxSizes, [string:strip(lists:reverse(URI)) | Result]); -parse_uri(<>, URI, Current, Max, Options, Result) -> - parse_uri(Rest, [Octet | URI], Current + 1, Max, Options, Result). +parse_uri(<>, URI, Current, Max, MaxSizes, Result) -> + parse_uri(Rest, [Octet | URI], Current + 1, Max, MaxSizes, Result). -parse_version(<<>>, Version, Current, Max, Options, Result) -> - {?MODULE, parse_version, [<<>>, Version, Current, Max, Options, Result]}; -parse_version(<>, Version, Current, Max, Options, Result) -> +parse_version(<<>>, Version, Current, Max, MaxSizes, Result) -> + {?MODULE, parse_version, [<<>>, Version, Current, Max, MaxSizes, Result]}; +parse_version(<>, Version, Current, Max, MaxSizes, Result) -> %% If ?CR is is missing RFC2616 section-19.3 - parse_version(<>, Version, Current, Max, Options, Result); -parse_version(<>, Version, _, _, Options, Result) -> - parse_headers(Rest, [], [], 0, proplists:get_value(max_header, Options), Options, + parse_version(<>, Version, Current, Max, MaxSizes, Result); +parse_version(<>, Version, _, _, MaxSizes, Result) -> + parse_headers(Rest, [], [], 0, proplists:get_value(max_header, MaxSizes), MaxSizes, [string:strip(lists:reverse(Version)) | Result]); -parse_version(<> = Data, Version, Current, Max, Options, Result) -> - {?MODULE, parse_version, [Data, Version, Current, Max, Options, Result]}; -parse_version(<>, Version, Current, Max, Options, Result) when Current =< Max -> - parse_version(Rest, [Octet | Version], Current + 1, Max, Options, Result); +parse_version(<> = Data, Version, Current, Max, MaxSizes, Result) -> + {?MODULE, parse_version, [Data, Version, Current, Max, MaxSizes, Result]}; +parse_version(<>, Version, Current, Max, MaxSizes, Result) when Current =< Max -> + parse_version(Rest, [Octet | Version], Current + 1, Max, MaxSizes, Result); parse_version(_, _, _, Max,_,_) -> - {error, {size_error, Max, 413, "Version string unreasonably long"}, lowest_version()}. + {error, {too_long, Max, 413, "Version string unreasonably long"}, lowest_version()}. parse_headers(_, _, _, Current, Max, _, Result) when Max =/= nolimit andalso Current > Max -> HttpVersion = lists:nth(3, lists:reverse(Result)), - {error, {size_error, Max, 413, "Headers unreasonably long"}, HttpVersion}; + {error, {too_long, Max, 413, "Headers unreasonably long"}, HttpVersion}; -parse_headers(<<>>, Header, Headers, Current, Max, Options, Result) -> +parse_headers(<<>>, Header, Headers, Current, Max, MaxSizes, Result) -> {?MODULE, parse_headers, [<<>>, Header, Headers, Current, Max, - Options, Result]}; -parse_headers(<>, [], [], Current, Max, Options, Result) -> + MaxSizes, Result]}; +parse_headers(<>, [], [], Current, Max, MaxSizes, Result) -> %% If ?CR is is missing RFC2616 section-19.3 parse_headers(<>, [], [], Current, Max, - Options, Result); + MaxSizes, Result); -parse_headers(<>, [], [], Current, Max, Options, Result) -> +parse_headers(<>, [], [], Current, Max, MaxSizes, Result) -> %% If ?CR is is missing RFC2616 section-19.3 parse_headers(<>, [], [], Current, Max, - Options, Result); + MaxSizes, Result); parse_headers(<>, [], [], _, _, _, Result) -> NewResult = list_to_tuple(lists:reverse([Body, {#http_request_h{}, []} | Result])), {ok, NewResult}; parse_headers(<>, Header, Headers, _, _, - Options, Result) -> - Customize = proplists:get_value(customize, Options), - case http_request:key_value(lists:reverse(Header)) of - undefined -> %% Skip headers with missing : - FinalHeaders = lists:filtermap(fun(H) -> - httpd_custom:customize_headers(Customize, request_header, H) - end, - Headers), - {ok, list_to_tuple(lists:reverse([Body, {http_request:headers(FinalHeaders, #http_request_h{}), FinalHeaders} | Result]))}; - NewHeader -> - case check_header(NewHeader, Options) of - ok -> - FinalHeaders = lists:filtermap(fun(H) -> - httpd_custom:customize_headers(Customize, request_header, H) - end, [NewHeader | Headers]), - {ok, list_to_tuple(lists:reverse([Body, {http_request:headers(FinalHeaders, - #http_request_h{}), - FinalHeaders} | Result]))}; - - {error, Reason} -> - HttpVersion = lists:nth(3, lists:reverse(Result)), - {error, Reason, HttpVersion} - end - end; + _, Result) -> + HTTPHeaders = [lists:reverse(Header) | Headers], + RequestHeaderRcord = + http_request:headers(HTTPHeaders, #http_request_h{}), + NewResult = + list_to_tuple(lists:reverse([Body, {RequestHeaderRcord, + HTTPHeaders} | Result])), + {ok, NewResult}; parse_headers(<> = Data, Header, Headers, Current, Max, - Options, Result) -> + MaxSizes, Result) -> {?MODULE, parse_headers, [Data, Header, Headers, Current, Max, - Options, Result]}; -parse_headers(<>, [], [], Current, Max, Options, Result) -> + MaxSizes, Result]}; +parse_headers(<>, [], [], Current, Max, MaxSizes, Result) -> %% If ?CR is is missing RFC2616 section-19.3 - parse_headers(<>, [], [], Current, Max, Options, Result); + parse_headers(<>, [], [], Current, Max, MaxSizes, Result); %% There where no headers, which is unlikely to happen. parse_headers(<>, [], [], _, _, _, Result) -> @@ -244,50 +228,37 @@ {ok, NewResult}; parse_headers(<>, Header, Headers, Current, Max, - Options, Result) -> + MaxSizes, Result) -> %% If ?CR is is missing RFC2616 section-19.3 - parse_headers(<>, Header, Headers, Current, Max, Options, Result); + parse_headers(<>, Header, Headers, Current, Max, MaxSizes, Result); parse_headers(<> = Data, Header, Headers, Current, Max, - Options, Result) -> + MaxSizes, Result) -> {?MODULE, parse_headers, [Data, Header, Headers, Current, Max, - Options, Result]}; + MaxSizes, Result]}; parse_headers(<>, Header, Headers, Current, Max, - Options, Result) -> + MaxSizes, Result) -> %% If ?CR is is missing RFC2616 section-19.3 parse_headers(<>, Header, Headers, Current, Max, - Options, Result); + MaxSizes, Result); parse_headers(<>, Header, Headers, _, Max, - Options, Result) -> - case http_request:key_value(lists:reverse(Header)) of - undefined -> %% Skip headers with missing : - parse_headers(Rest, [Octet], Headers, - 0, Max, Options, Result); - NewHeader -> - case check_header(NewHeader, Options) of - ok -> - parse_headers(Rest, [Octet], [NewHeader | Headers], - 0, Max, Options, Result); - {error, Reason} -> - HttpVersion = lists:nth(3, lists:reverse(Result)), - {error, Reason, HttpVersion} - end - end; - + MaxSizes, Result) -> + parse_headers(Rest, [Octet], [lists:reverse(Header) | Headers], + 0, Max, MaxSizes, Result); parse_headers(<> = Data, Header, Headers, Current, Max, - Options, Result) -> + MaxSizes, Result) -> {?MODULE, parse_headers, [Data, Header, Headers, Current, Max, - Options, Result]}; + MaxSizes, Result]}; parse_headers(<>, Header, Headers, Current, Max, - Options, Result) -> + MaxSizes, Result) -> %% If ?CR is is missing RFC2616 section-19.3 parse_headers(<>, Header, Headers, Current, Max, - Options, Result); + MaxSizes, Result); parse_headers(<>, Header, Headers, Current, - Max, Options, Result) -> + Max, MaxSizes, Result) -> parse_headers(Rest, [Octet | Header], Headers, Current + 1, Max, - Options, Result). + MaxSizes, Result). whole_body(Body, Length) -> case size(Body) of @@ -417,29 +388,29 @@ false end. + +%%---------------------------------------------------------------------- +%% tagup_header +%% +%% Parses the header of a HTTP request and returns a key,value tuple +%% list containing Name and Value of each header directive as of: +%% +%% Content-Type: multipart/mixed -> {"Content-Type", "multipart/mixed"} +%% +%% But in http/1.1 the field-names are case insencitive so now it must be +%% Content-Type: multipart/mixed -> {"content-type", "multipart/mixed"} +%% The standard furthermore says that leading and traling white space +%% is not a part of the fieldvalue and shall therefore be removed. +%%---------------------------------------------------------------------- +tagup_header([]) -> []; +tagup_header([Line|Rest]) -> [tag(Line, [])|tagup_header(Rest)]. + +tag([], Tag) -> + {http_util:to_lower(lists:reverse(Tag)), ""}; +tag([$:|Rest], Tag) -> + {http_util:to_lower(lists:reverse(Tag)), string:strip(Rest)}; +tag([Chr|Rest], Tag) -> + tag(Rest, [Chr|Tag]). + lowest_version()-> "HTTP/0.9". - -check_header({"content-length", Value}, Maxsizes) -> - Max = proplists:get_value(max_content_length, Maxsizes), - MaxLen = length(integer_to_list(Max)), - case length(Value) =< MaxLen of - true -> - try - list_to_integer(Value) - of - I when I>= 0 -> - ok; - _ -> - {error, {size_error, Max, 411, "negative content-length"}} - catch _:_ -> - {error, {size_error, Max, 411, "content-length not an integer"}} - end; - false -> - {error, {size_error, Max, 413, "content-length unreasonably long"}} - end; -check_header(_, _) -> - ok. - - - diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_request_handler.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_request_handler.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_request_handler.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_request_handler.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,7 +29,7 @@ %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, - terminate/2, code_change/3, format_status/2]). + terminate/2, code_change/3]). -include("httpd.hrl"). -include("http_internal.hrl"). @@ -97,9 +96,8 @@ proc_lib:init_ack({ok, self()}), {SocketType, Socket} = await_socket_ownership_transfer(AcceptTimeout), - - %%Timeout value is in seconds we want it in milliseconds - KeepAliveTimeOut = 1000 * httpd_util:lookup(ConfigDB, keep_alive_timeout, 150), + + KeepAliveTimeOut = httpd_util:lookup(ConfigDB, keep_alive_timeout, 150000), case http_transport:negotiate(SocketType, Socket, ?HANDSHAKE_TIMEOUT) of {error, _Error} -> @@ -121,17 +119,11 @@ MaxHeaderSize = max_header_size(ConfigDB), MaxURISize = max_uri_size(ConfigDB), NrOfRequest = max_keep_alive_request(ConfigDB), - MaxContentLen = max_content_length(ConfigDB), - Customize = customize(ConfigDB), - + {_, Status} = httpd_manager:new_connection(Manager), MFA = {httpd_request, parse, [[{max_uri, MaxURISize}, {max_header, MaxHeaderSize}, - {max_version, ?HTTP_MAX_VERSION_STRING}, - {max_method, ?HTTP_MAX_METHOD_STRING}, - {max_content_length, MaxContentLen}, - {customize, Customize} - ]]}, + {max_version, ?HTTP_MAX_VERSION_STRING}, {max_method, ?HTTP_MAX_METHOD_STRING}]]}, State = #state{mod = Mod, manager = Manager, @@ -215,7 +207,7 @@ set_new_data_size(cancel_request_timeout(State), NewDataSize) end, handle_http_msg(Result, NewState); - {error, {size_error, MaxSize, ErrCode, ErrStr}, Version} -> + {error, {too_long, MaxSize, ErrCode, ErrStr}, Version} -> NewModData = ModData#mod{http_version = Version}, httpd_response:send_status(NewModData, ErrCode, ErrStr), Reason = io_lib:format("~p: ~p max size is ~p~n", @@ -310,18 +302,6 @@ cancel_request_timeout(State), httpd_socket:close(ModData#mod.socket_type, ModData#mod.socket). -format_status(normal, [_, State]) -> - [{data, [{"StateData", State}]}]; -format_status(terminate, [_, State]) -> - Mod = (State#state.mod), - case Mod#mod.socket_type of - ip_comm -> - [{data, [{"StateData", State}]}]; - {essl, _} -> - %% Do not print ssl options in superviosr reports - [{data, [{"StateData", - State#state{mod = Mod#mod{socket_type = 'TLS'}}}]}] - end. %%-------------------------------------------------------------------- %% code_change(OldVsn, State, Extra) -> {ok, NewState} @@ -443,7 +423,7 @@ MaxHeaderSize, MaxBodySize) -> case Headers#http_request_h.'transfer-encoding' of "chunked" -> - try http_chunk:decode(Body, MaxBodySize, MaxHeaderSize) of + case http_chunk:decode(Body, MaxBodySize, MaxHeaderSize) of {Module, Function, Args} -> http_transport:setopts(ModData#mod.socket_type, ModData#mod.socket, @@ -455,14 +435,6 @@ http_chunk:handle_headers(Headers, ChunkedHeaders), handle_response(State#state{headers = NewHeaders, body = NewBody}) - catch - throw:Error -> - httpd_response:send_status(ModData, 400, - "Bad input"), - Reason = io_lib:format("Chunk decoding failed: ~p~n", - [Error]), - error_log(Reason, ModData), - {stop, normal, State#state{response_sent = true}} end; Encoding when is_list(Encoding) -> httpd_response:send_status(ModData, 501, @@ -472,7 +444,8 @@ error_log(Reason, ModData), {stop, normal, State#state{response_sent = true}}; _ -> - Length = list_to_integer(Headers#http_request_h.'content-length'), + Length = + list_to_integer(Headers#http_request_h.'content-length'), case ((Length =< MaxBodySize) or (MaxBodySize == nolimit)) of true -> case httpd_request:whole_body(Body, Length) of @@ -481,7 +454,7 @@ ModData#mod.socket, [{active, once}]), {noreply, State#state{mfa = - {Module, Function, Args}}}; + {Module, Function, Args}}}; {ok, NewBody} -> handle_response( @@ -498,7 +471,7 @@ handle_expect(#state{headers = Headers, mod = #mod{config_db = ConfigDB} = ModData} = State, MaxBodySize) -> - Length = list_to_integer(Headers#http_request_h.'content-length'), + Length = Headers#http_request_h.'content-length', case expect(Headers, ModData#mod.http_version, ConfigDB) of continue when (MaxBodySize > Length) orelse (MaxBodySize =:= nolimit) -> httpd_response:send_status(ModData, 100, ""), @@ -572,15 +545,9 @@ init_data = ModData#mod.init_data}, MaxHeaderSize = max_header_size(ModData#mod.config_db), MaxURISize = max_uri_size(ModData#mod.config_db), - MaxContentLen = max_content_length(ModData#mod.config_db), - Customize = customize(ModData#mod.config_db), MFA = {httpd_request, parse, [[{max_uri, MaxURISize}, {max_header, MaxHeaderSize}, - {max_version, ?HTTP_MAX_VERSION_STRING}, - {max_method, ?HTTP_MAX_METHOD_STRING}, - {max_content_length, MaxContentLen}, - {customize, Customize} - ]]}, + {max_version, ?HTTP_MAX_VERSION_STRING}, {max_method, ?HTTP_MAX_METHOD_STRING}]]}, TmpState = State#state{mod = NewModData, mfa = MFA, max_keep_alive_request = decrease(Max), @@ -630,10 +597,21 @@ decrease(N) -> N. -error_log(ReasonString, #mod{config_db = ConfigDB}) -> +error_log(ReasonString, Info) -> Error = lists:flatten( io_lib:format("Error reading request: ~s", [ReasonString])), - httpd_util:error_log(ConfigDB, Error). + error_log(mod_log, Info, Error), + error_log(mod_disk_log, Info, Error). + +error_log(Mod, #mod{config_db = ConfigDB} = Info, String) -> + Modules = httpd_util:lookup(ConfigDB, modules, + [mod_get, mod_head, mod_log]), + case lists:member(Mod, Modules) of + true -> + Mod:error_log(Info, String); + _ -> + ok + end. %%-------------------------------------------------------------------- @@ -652,8 +630,3 @@ max_keep_alive_request(ConfigDB) -> httpd_util:lookup(ConfigDB, max_keep_alive_request, infinity). -max_content_length(ConfigDB) -> - httpd_util:lookup(ConfigDB, max_content_length, ?HTTP_MAX_CONTENT_LENGTH). - -customize(ConfigDB) -> - httpd_util:lookup(ConfigDB, customize, httpd_custom). diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_response.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_response.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_response.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_response.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,27 +1,26 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% %% -module(httpd_response). -export([generate_and_send_response/1, send_status/3, send_header/3, - send_body/3, send_chunk/3, send_final_chunk/2, send_final_chunk/3, - split_header/2, is_disable_chunked_send/1, cache_headers/2]). + send_body/3, send_chunk/3, send_final_chunk/2, split_header/2, + is_disable_chunked_send/1, cache_headers/2]). -export([map_status_code/2]). -include_lib("inets/src/inets_app/inets_internal.hrl"). @@ -89,7 +88,8 @@ "~n Error: ~p" "~n Stack trace: ~p", [Module, T, E, ?STACK()])), - httpd_util:error_log(ModData#mod.config_db, String), + report_error(mod_log, ModData#mod.config_db, String), + report_error(mod_disk_log, ModData#mod.config_db, String), send_status(ModData, 500, none), done end. @@ -176,7 +176,7 @@ StatusLine = [NewVer, " ", io_lib:write(NewStatusCode), " ", httpd_util:reason_phrase(NewStatusCode), ?CRLF], ConnectionHeader = get_connection(Conn, NewVer), - Head = [StatusLine, Headers, ConnectionHeader , ?CRLF], + Head = list_to_binary([StatusLine, Headers, ConnectionHeader , ?CRLF]), httpd_socket:deliver(Type, Sock, Head). map_status_code("HTTP/1.0", Code) @@ -244,6 +244,7 @@ ok; send_chunk(_, [], _) -> ok; + send_chunk(#mod{http_version = "HTTP/1.1", socket_type = Type, socket = Sock}, Response0, false) -> Response = http_chunk:encode(Response0), @@ -252,13 +253,10 @@ send_chunk(#mod{socket_type = Type, socket = Sock} = _ModData, Response, _) -> httpd_socket:deliver(Type, Sock, Response). -send_final_chunk(Mod, IsDisableChunkedSend) -> - send_final_chunk(Mod, [], IsDisableChunkedSend). - send_final_chunk(#mod{http_version = "HTTP/1.1", - socket_type = Type, socket = Sock}, Trailers, false) -> - httpd_socket:deliver(Type, Sock, http_chunk:encode_last(Trailers)); -send_final_chunk(#mod{socket_type = Type, socket = Sock}, _, _) -> + socket_type = Type, socket = Sock}, false) -> + httpd_socket:deliver(Type, Sock, http_chunk:encode_last()); +send_final_chunk(#mod{socket_type = Type, socket = Sock}, _) -> httpd_socket:close(Type, Sock). is_disable_chunked_send(Db) -> @@ -288,28 +286,42 @@ Date = httpd_util:rfc1123_date(), ContentType = "text/html", Server = server(ConfigDb), - CustomizeCB = httpd_util:lookup(ConfigDb, customize, httpd_custom), + NewHeaders = add_default_headers([{"date", Date}, + {"content-type", ContentType}, + {"server", Server}], + KeyValueTupleHeaders), + lists:map(fun fix_header/1, NewHeaders). + - CustomDefaults = httpd_custom:response_default_headers(CustomizeCB), - SystemDefaultes = ([{"date", Date}, - {"content-type", ContentType} - | if Server=="" -> []; - true -> [{"server", Server}] - end - ]), - - %% System defaults not present in custom defaults will be added - %% to defaults - Defaults = add_default_headers(SystemDefaultes, CustomDefaults), - - Headers0 = add_default_headers(Defaults, KeyValueTupleHeaders), - lists:filtermap(fun(H) -> - httpd_custom:customize_headers(CustomizeCB, response_header, H) - end, - [Header || Header <- Headers0]). server(ConfigDb) -> httpd_util:lookup(ConfigDb, server, ?SERVER_SOFTWARE). +fix_header({Key0, Value}) -> + %% make sure first letter is capital + Words1 = string:tokens(Key0, "-"), + Words2 = upify(Words1, []), + Key = new_key(Words2), + Key ++ ": " ++ Value ++ ?CRLF . + +new_key([]) -> + ""; +new_key([W]) -> + W; +new_key([W1,W2]) -> + W1 ++ "-" ++ W2; +new_key([W|R]) -> + W ++ "-" ++ new_key(R). + +upify([], Acc) -> + lists:reverse(Acc); +upify([Key|Rest], Acc) -> + upify(Rest, [upify2(Key)|Acc]). + +upify2([C|Rest]) when (C >= $a) andalso (C =< $z) -> + [C-($a-$A)|Rest]; +upify2(Str) -> + Str. + add_default_headers([], Headers) -> Headers; @@ -398,6 +410,16 @@ content_length(Body)-> integer_to_list(httpd_util:flatlength(Body)). +report_error(Mod, ConfigDB, Error) -> + Modules = httpd_util:lookup(ConfigDB, modules, + [mod_get, mod_head, mod_log]), + case lists:member(Mod, Modules) of + true -> + Mod:report_error(ConfigDB, Error); + _ -> + ok + end. + handle_headers([], NewHeaders) -> {ok, NewHeaders}; diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_script_env.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_script_env.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_script_env.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_script_env.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_socket.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_socket.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_socket.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_socket.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_sup.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_sup.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,7 +28,7 @@ %% Internal application API -export([start_link/1, start_link/2]). --export([start_child/1, restart_child/3, stop_child/3]). +-export([start_child/1, restart_child/2, stop_child/2]). %% Supervisor callback -export([init/1]). @@ -38,6 +37,7 @@ -define(TIMEOUT, 15000). -include("httpd_internal.hrl"). +-include("inets_internal.hrl"). %%%========================================================================= %%% API @@ -64,32 +64,33 @@ end. -restart_child(Address, Port, Profile) -> - Name = id(Address, Port, Profile), +restart_child(Address, Port) -> + Name = id(Address, Port), case supervisor:terminate_child(?MODULE, Name) of - ok -> - supervisor:restart_child(?MODULE, Name); - Error -> - Error - end. - -stop_child(Address, Port, Profile) -> - Name = id(Address, Port, Profile), + ok -> + supervisor:restart_child(?MODULE, Name); + Error -> + Error + end. + +stop_child(Address, Port) -> + Name = id(Address, Port), case supervisor:terminate_child(?MODULE, Name) of - ok -> - supervisor:delete_child(?MODULE, Name); - Error -> + ok -> + supervisor:delete_child(?MODULE, Name); + Error -> Error end. - -id(Address, Port, Profile) -> - {httpd_instance_sup, Address, Port, Profile}. + +id(Address, Port) -> + {httpd_instance_sup, Address, Port}. %%%========================================================================= %%% Supervisor callback %%%========================================================================= init([HttpdServices]) -> + ?hdrd("starting", [{httpd_service, HttpdServices}]), RestartStrategy = one_for_one, MaxR = 10, MaxT = 3600, @@ -117,18 +118,23 @@ child_specs([], Acc) -> Acc; child_specs([{httpd, HttpdService} | Rest], Acc) -> + ?hdrd("child specs", [{httpd, HttpdService}]), NewHttpdService = (catch mk_tuple_list(HttpdService)), + ?hdrd("child specs", [{new_httpd, NewHttpdService}]), case catch child_spec(NewHttpdService) of {error, Reason} -> + ?hdri("failed generating child spec", [{reason, Reason}]), error_msg("Failed to start service: ~n~p ~n due to: ~p~n", [HttpdService, Reason]), child_specs(Rest, Acc); Spec -> + ?hdrt("child spec", [{child_spec, Spec}]), child_specs(Rest, [Spec | Acc]) end. child_spec(HttpdService) -> {ok, Config} = httpd_config(HttpdService), + ?hdrt("child spec", [{config, Config}]), Debug = proplists:get_value(debug, Config, []), AcceptTimeout = proplists:get_value(accept_timeout, Config, 15000), httpd_util:valid_options(Debug, AcceptTimeout, Config), @@ -156,27 +162,32 @@ httpd_child_spec([Value| _] = Config, AcceptTimeout, Debug) when is_tuple(Value) -> + ?hdrt("httpd_child_spec - entry", [{accept_timeout, AcceptTimeout}, + {debug, Debug}]), Address = proplists:get_value(bind_address, Config, any), Port = proplists:get_value(port, Config, 80), - Profile = proplists:get_value(profile, Config, ?DEFAULT_PROFILE), - httpd_child_spec(Config, AcceptTimeout, Debug, Address, Port, Profile); + httpd_child_spec(Config, AcceptTimeout, Debug, Address, Port); %% In this case the AcceptTimeout and Debug will only have default values... httpd_child_spec(ConfigFile, AcceptTimeoutDef, DebugDef) -> + ?hdrt("httpd_child_spec - entry", [{config_file, ConfigFile}, + {accept_timeout_def, AcceptTimeoutDef}, + {debug_def, DebugDef}]), case httpd_conf:load(ConfigFile) of {ok, ConfigList} -> + ?hdrt("httpd_child_spec - loaded", [{config_list, ConfigList}]), case (catch httpd_conf:validate_properties(ConfigList)) of {ok, Config} -> + ?hdrt("httpd_child_spec - validated", [{config, Config}]), Address = proplists:get_value(bind_address, Config, any), Port = proplists:get_value(port, Config, 80), - Profile = proplists:get_value(profile, Config, ?DEFAULT_PROFILE), AcceptTimeout = proplists:get_value(accept_timeout, Config, AcceptTimeoutDef), Debug = proplists:get_value(debug, Config, DebugDef), httpd_child_spec([{file, ConfigFile} | Config], - AcceptTimeout, Debug, Address, Port, Profile); + AcceptTimeout, Debug, Address, Port); Error -> Error end; @@ -184,23 +195,19 @@ Error end. -httpd_child_spec(Config, AcceptTimeout, Debug, Addr, Port, Profile) -> - case get_fd(Port) of - {ok, Fd} -> - case Port == 0 orelse Fd =/= undefined of - true -> - httpd_child_spec_listen(Config, AcceptTimeout, Debug, Addr, Port, Profile); - false -> - httpd_child_spec_nolisten(Config, AcceptTimeout, Debug, Addr, Port, Profile) - end; - Error -> - Error +httpd_child_spec(Config, AcceptTimeout, Debug, Addr, Port) -> + Fd = proplists:get_value(fd, Config, undefined), + case Port == 0 orelse Fd =/= undefined of + true -> + httpd_child_spec_listen(Config, AcceptTimeout, Debug, Addr, Port); + false -> + httpd_child_spec_nolisten(Config, AcceptTimeout, Debug, Addr, Port) end. -httpd_child_spec_listen(Config, AcceptTimeout, Debug, Addr, Port, Profile) -> +httpd_child_spec_listen(Config, AcceptTimeout, Debug, Addr, Port) -> case start_listen(Addr, Port, Config) of {Pid, {NewPort, NewConfig, ListenSocket}} -> - Name = {httpd_instance_sup, Addr, NewPort, Profile}, + Name = {httpd_instance_sup, Addr, NewPort}, StartFunc = {httpd_instance_sup, start_link, [NewConfig, AcceptTimeout, {Pid, ListenSocket}, Debug]}, @@ -214,8 +221,8 @@ {error, Reason} end. -httpd_child_spec_nolisten(Config, AcceptTimeout, Debug, Addr, Port, Profile) -> - Name = {httpd_instance_sup, Addr, Port, Profile}, +httpd_child_spec_nolisten(Config, AcceptTimeout, Debug, Addr, Port) -> + Name = {httpd_instance_sup, Addr, Port}, StartFunc = {httpd_instance_sup, start_link, [Config, AcceptTimeout, Debug]}, Restart = permanent, @@ -240,8 +247,8 @@ SocketType -> case http_transport:start(SocketType) of ok -> - {ok, Fd} = get_fd(Port), - IpFamily = proplists:get_value(ipfamily, Config, inet), + Fd = proplists:get_value(fd, Config), + IpFamily = proplists:get_value(ipfamily, Config, inet6fb4), case http_transport:listen(SocketType, Address, Port, Fd, IpFamily) of {ok, ListenSocket} -> NewConfig = proplists:delete(port, Config), @@ -286,8 +293,6 @@ socket_type(ip_comm = SocketType, _) -> SocketType; -socket_type({ip_comm, _} = SocketType, _) -> - SocketType; socket_type({essl, _} = SocketType, _) -> SocketType; socket_type(_, Config) -> @@ -361,19 +366,3 @@ File -> [{cacertfile, File}] end. - -get_fd(0) -> - {ok, undefined}; -get_fd(Port) -> - FdKey = list_to_atom("httpd_" ++ integer_to_list(Port)), - case init:get_argument(FdKey) of - {ok, [[Value]]} -> - case (catch list_to_integer(Value)) of - N when is_integer(N) -> - {ok, N}; - _ -> - {error, {bad_descriptor, Value}} - end; - _ -> - {ok, undefined} - end. diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/httpd_util.erl erlang-17.3-dfsg/lib/inets/src/http_server/httpd_util.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/httpd_util.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/httpd_util.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -31,7 +30,7 @@ convert_netscapecookie_date/1, enable_debug/1, valid_options/3, modules_validate/1, module_validate/1, dir_validate/2, file_validate/2, mime_type_validate/1, - mime_types_validate/1, custom_date/0, error_log/2]). + mime_types_validate/1, custom_date/0]). -export([encode_hex/1, decode_hex/1]). -include_lib("kernel/include/file.hrl"). @@ -42,7 +41,17 @@ {ok, Address}; ip_address(Host, IpFamily) when ((IpFamily =:= inet) orelse (IpFamily =:= inet6)) -> - inet:getaddr(Host, IpFamily). + inet:getaddr(Host, IpFamily); +ip_address(Host, inet6fb4 = _IpFamily) -> + Inet = case gen_tcp:listen(0, [inet6]) of + {ok, Dummyport} -> + gen_tcp:close(Dummyport), + inet6; + _ -> + inet + end, + inet:getaddr(Host, Inet). + %% lookup @@ -563,10 +572,7 @@ make_name(Prefix,Addr,Port) -> make_name(Prefix,Addr,Port,""). - -make_name(Prefix, Addr,Port,Postfix) when is_atom(Postfix)-> - make_name(Prefix, Addr,Port, atom_to_list(Postfix)); - + make_name(Prefix,"*",Port,Postfix) -> make_name(Prefix,undefined,Port,Postfix); @@ -589,7 +595,15 @@ io_lib:format("~w_~w_~w_~w", [A,B,C,D]); make_name2({A, B, C, D, E, F, G, H}) -> - io_lib:format("~w_~w_~w_~w_~w_~w_~w_~w", [A,B,C,D,E,F,G,H]); + io_lib:format("~s_~s_~s_~s_~s_~s_~s_~s", [integer_to_hexlist(A), + integer_to_hexlist(B), + integer_to_hexlist(C), + integer_to_hexlist(D), + integer_to_hexlist(E), + integer_to_hexlist(F), + integer_to_hexlist(G), + integer_to_hexlist(H) + ]); make_name2(Addr) -> search_and_replace(Addr,$.,$_). @@ -776,17 +790,3 @@ ok end, do_enable_debug(Rest). - -error_log(ConfigDb, Error) -> - error_log(mod_log, ConfigDb, Error), - error_log(mod_disk_log, ConfigDb, Error). - -error_log(Mod, ConfigDB, Error) -> - Modules = httpd_util:lookup(ConfigDB, modules, - [mod_get, mod_head, mod_log]), - case lists:member(Mod, Modules) of - true -> - Mod:report_error(ConfigDB, Error); - _ -> - ok - end. diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/Makefile erlang-17.3-dfsg/lib/inets/src/http_server/Makefile --- erlang-18.2-dfsg/lib/inets/src/http_server/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2005-2015. All Rights Reserved. +# Copyright Ericsson AB 2005-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -40,10 +39,6 @@ # ---------------------------------------------------- # Target Specs # ---------------------------------------------------- - -BEHAVIOUR_MODULES= \ - httpd_custom_api - MODULES = \ httpd \ httpd_acceptor \ @@ -51,7 +46,6 @@ httpd_connection_sup\ httpd_cgi \ httpd_conf \ - httpd_custom \ httpd_example \ httpd_esi \ httpd_file\ @@ -81,6 +75,7 @@ mod_get \ mod_head \ mod_htaccess \ + mod_include \ mod_log \ mod_range \ mod_responsecontrol \ @@ -90,13 +85,10 @@ HRL_FILES = httpd.hrl httpd_internal.hrl mod_auth.hrl -ERL_FILES = $(MODULES:%=%.erl)\ - $(BEHAVIOUR_MODULES:%=%.erl) +ERL_FILES = $(MODULES:%=%.erl) TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) -BEHAVIOUR_TARGET_FILES= $(BEHAVIOUR_MODULES:%=$(EBIN)/%.$(EMULATOR)) - INETS_FLAGS = -D'SERVER_SOFTWARE="$(APPLICATION)/$(VSN)"' @@ -116,12 +108,11 @@ # ---------------------------------------------------- # Targets # ---------------------------------------------------- -$(TARGET_FILES): $(BEHAVIOUR_TARGET_FILES) debug opt: $(TARGET_FILES) clean: - rm -f $(TARGET_FILES) $(BEHAVIOUR_TARGET_FILES) + rm -f $(TARGET_FILES) rm -f core docs: @@ -137,7 +128,7 @@ $(INSTALL_DIR) "$(RELSYSDIR)/src/http_server" $(INSTALL_DATA) $(HRL_FILES) $(ERL_FILES) "$(RELSYSDIR)/src/http_server" $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(BEHAVIOUR_TARGET_FILES) "$(RELSYSDIR)/ebin" + $(INSTALL_DATA) $(TARGET_FILES) "$(RELSYSDIR)/ebin" release_docs_spec: diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_actions.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_actions.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_actions.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_actions.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -85,14 +84,14 @@ {ok,[MimeType, CGIScript]} -> {ok,[],{action, {MimeType, CGIScript}}}; {ok,_} -> - {error,?NICE(string:strip(Action)++" is an invalid Action")} + {error,?NICE(httpd_conf:clean(Action)++" is an invalid Action")} end; load("Script " ++ Script,[]) -> case inets_regexp:split(Script, " ") of {ok,[Method, CGIScript]} -> {ok,[],{script, {Method, CGIScript}}}; {ok,_} -> - {error,?NICE(string:strip(Script)++" is an invalid Script")} + {error,?NICE(httpd_conf:clean(Script)++" is an invalid Script")} end. store({action, {MimeType, CGIScript}} = Conf, _) when is_list(MimeType), diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_alias.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_alias.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_alias.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_alias.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -56,7 +55,6 @@ do_alias(#mod{config_db = ConfigDB, request_uri = ReqURI, - socket_type = SocketType, data = Data}) -> {ShortPath, Path, AfterPath} = real_name(ConfigDB, ReqURI, which_alias(ConfigDB)), @@ -72,9 +70,8 @@ (LastChar =/= $/)) -> ?hdrt("directory and last-char is a /", []), ServerName = which_server_name(ConfigDB), - Port = port_string(which_port(ConfigDB)), - Protocol = get_protocol(SocketType), - URL = Protocol ++ ServerName ++ Port ++ ReqURI ++ "/", + Port = port_string( which_port(ConfigDB) ), + URL = "http://" ++ ServerName ++ Port ++ ReqURI ++ "/", ReasonPhrase = httpd_util:reason_phrase(301), Message = httpd_util:message(301, URL, ConfigDB), {proceed, @@ -97,12 +94,6 @@ port_string(Port) -> ":" ++ integer_to_list(Port). -get_protocol(ip_comm) -> - "http://"; -get_protocol(_) -> - %% Should clean up to have only one ssl type essl vs ssl is not relevant any more - "https://". - %% real_name real_name(ConfigDB, RequestURI, []) -> @@ -213,7 +204,7 @@ {ok, [FakeName, RealName]} -> {ok,[],{alias,{FakeName,RealName}}}; {ok, _} -> - {error,?NICE(string:strip(Alias)++" is an invalid Alias")} + {error,?NICE(httpd_conf:clean(Alias)++" is an invalid Alias")} end; load("ReWrite " ++ Rule, Acc) -> load_re_write(Rule, Acc, "ReWrite", re_write); @@ -224,7 +215,7 @@ RealName1 = filename:join(filename:split(RealName)), {ok, [], {script_alias, {FakeName, RealName1++"/"}}}; {ok, _} -> - {error, ?NICE(string:strip(ScriptAlias)++ + {error, ?NICE(httpd_conf:clean(ScriptAlias)++ " is an invalid ScriptAlias")} end; load("ScriptReWrite " ++ Rule, Acc) -> @@ -235,7 +226,7 @@ fun ($\s) -> true; ($\t) -> true; (_) -> false end, Rule0) of "" -> - {error, ?NICE(string:strip(Rule0)++" is an invalid "++Type)}; + {error, ?NICE(httpd_conf:clean(Rule0)++" is an invalid "++Type)}; Rule -> case string:chr(Rule, $\s) of 0 -> diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth_dets.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth_dets.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth_dets.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth_dets.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -39,23 +38,23 @@ -include("httpd_internal.hrl"). -include("mod_auth.hrl"). -%%==================================================================== -%% Internal application API -%%==================================================================== - store_directory_data(_Directory, DirData, Server_root) -> + ?CDEBUG("store_directory_data -> ~n" + " Directory: ~p~n" + " DirData: ~p", + [_Directory, DirData]), + {PWFile, Absolute_pwdfile} = absolute_file_name(auth_user_file, DirData, Server_root), {GroupFile, Absolute_groupfile} = absolute_file_name(auth_group_file, DirData, Server_root), Addr = proplists:get_value(bind_address, DirData), Port = proplists:get_value(port, DirData), - Profile = proplists:get_value(profile, DirData, ?DEFAULT_PROFILE), - PWName = httpd_util:make_name("httpd_dets_pwdb", Addr, Port, Profile), + PWName = httpd_util:make_name("httpd_dets_pwdb",Addr,Port), case dets:open_file(PWName,[{type,set},{file,Absolute_pwdfile},{repair,true}]) of {ok, PWDB} -> - GDBName = httpd_util:make_name("httpd_dets_groupdb", Addr, Port, Profile), + GDBName = httpd_util:make_name("httpd_dets_groupdb",Addr,Port), case dets:open_file(GDBName,[{type,set},{file,Absolute_groupfile},{repair,true}]) of {ok, GDB} -> NDD1 = lists:keyreplace(auth_user_file, 1, DirData, @@ -70,8 +69,11 @@ {error, {{file, PWFile},Err2}} end. +%% %% Storage format of users in the dets table: %% {{UserName, Addr, Port, Dir}, Password, UserData} +%% + add_user(DirData, UStruct) -> {Addr, Port, Dir} = lookup_common(DirData), PWDB = proplists:get_value(auth_user_file, DirData), @@ -97,15 +99,21 @@ end. list_users(DirData) -> + ?DEBUG("list_users -> ~n" + " DirData: ~p", [DirData]), {Addr, Port, Dir} = lookup_common(DirData), PWDB = proplists:get_value(auth_user_file, DirData), - case dets:traverse(PWDB, fun(X) -> {continue, X} end) of + case dets:traverse(PWDB, fun(X) -> {continue, X} end) of %% SOOOO Ugly ! Records when is_list(Records) -> + ?DEBUG("list_users -> ~n" + " Records: ~p", [Records]), {ok, [UserName || {{UserName, AnyAddr, AnyPort, AnyDir}, _Password, _Data} <- Records, AnyAddr == Addr, AnyPort == Port, AnyDir == Dir]}; _O -> + ?DEBUG("list_users -> ~n" + " O: ~p", [_O]), {ok, []} end. @@ -126,8 +134,10 @@ {error, no_such_user} end. +%% %% Storage of groups in the dets table: %% {Group, UserList} where UserList is a list of strings. +%% add_group_member(DirData, GroupName, UserName) -> {Addr, Port, Dir} = lookup_common(DirData), GDB = proplists:get_value(auth_group_file, DirData), @@ -205,7 +215,16 @@ {error, no_such_group} end. +lookup_common(DirData) -> + Dir = proplists:get_value(path, DirData), + Port = proplists:get_value(port, DirData), + Addr = proplists:get_value(bind_address, DirData), + {Addr, Port, Dir}. + +%% remove/1 +%% %% Closes dets tables used by this auth mod. +%% remove(DirData) -> PWDB = proplists:get_value(auth_user_file, DirData), GDB = proplists:get_value(auth_group_file, DirData), @@ -213,9 +232,8 @@ dets:close(PWDB), ok. -%%-------------------------------------------------------------------- -%%% Internal functions -%%-------------------------------------------------------------------- +%% absolute_file_name/2 +%% %% Return the absolute path name of File_type. absolute_file_name(File_type, DirData, Server_root) -> Path = proplists:get_value(File_type, DirData), @@ -235,8 +253,3 @@ end, {Path, Absolute_path}. -lookup_common(DirData) -> - Dir = proplists:get_value(path, DirData), - Port = proplists:get_value(port, DirData), - Addr = proplists:get_value(bind_address, DirData), - {Addr, Port, Dir}. diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -39,16 +38,15 @@ -include("httpd.hrl"). -include("mod_auth.hrl"). -include("httpd_internal.hrl"). +-include("inets_internal.hrl"). -define(VMODULE,"AUTH"). -define(NOPASSWORD,"NoPassword"). -%%==================================================================== -%% Internal application API -%%==================================================================== - +%% do do(Info) -> + ?hdrt("do", [{info, Info}]), case proplists:get_value(status,Info#mod.data) of %% A status code has been generated! {_StatusCode, _PhraseArgs, _Reason} -> @@ -63,15 +61,22 @@ %% Is it a secret area? case secretp(Path,Info#mod.config_db) of {yes, {Directory, DirectoryData}} -> + ?hdrt("secret area", + [{directory, Directory}, + {directory_data, DirectoryData}]), + + %% Authenticate (allow) case allow((Info#mod.init_data)#init_data.peername, Info#mod.socket_type,Info#mod.socket, DirectoryData) of allowed -> + ?hdrt("allowed", []), case deny((Info#mod.init_data)#init_data.peername, Info#mod.socket_type, Info#mod.socket, DirectoryData) of not_denied -> + ?hdrt("not denied", []), case proplists:get_value(auth_type, DirectoryData) of undefined -> @@ -85,13 +90,15 @@ AuthType) end; {denied, Reason} -> + ?hdrt("denied", [{reason, Reason}]), {proceed, [{status, {403, - Info#mod.request_uri, - Reason}}| + Info#mod.request_uri, + Reason}}| Info#mod.data]} end; {not_allowed, Reason} -> + ?hdrt("not allowed", [{reason, Reason}]), {proceed,[{status,{403, Info#mod.request_uri, Reason}} | @@ -107,6 +114,246 @@ end. +do_auth(Info, Directory, DirectoryData, AuthType) -> + %% Authenticate (require) + ?hdrt("authenticate", [{auth_type, AuthType}]), + case require(Info, Directory, DirectoryData) of + authorized -> + ?hdrt("authorized", []), + {proceed,Info#mod.data}; + {authorized, User} -> + ?hdrt("authorized", [{user, User}]), + {proceed, [{remote_user,User}|Info#mod.data]}; + {authorization_required, Realm} -> + ?hdrt("authorization required", [{realm, Realm}]), + ReasonPhrase = httpd_util:reason_phrase(401), + Message = httpd_util:message(401,none,Info#mod.config_db), + {proceed, + [{response, + {401, + ["WWW-Authenticate: Basic realm=\"",Realm, + "\"\r\n\r\n","\n\n", + ReasonPhrase,"\n", + "\n\n

    ",ReasonPhrase, + "

    \n",Message,"\n\n\n"]}}| + Info#mod.data]}; + {status, {StatusCode,PhraseArgs,Reason}} -> + {proceed, [{status,{StatusCode,PhraseArgs,Reason}}| + Info#mod.data]} + end. + +%% require + +require(Info, Directory, DirectoryData) -> + ParsedHeader = Info#mod.parsed_header, + ValidUsers = proplists:get_value(require_user, DirectoryData), + ValidGroups = proplists:get_value(require_group, DirectoryData), + %% Any user or group restrictions? + case ValidGroups of + undefined when ValidUsers =:= undefined -> + authorized; + _ -> + case proplists:get_value("authorization", ParsedHeader) of + undefined -> + authorization_required(DirectoryData); + %% Check credentials! + "Basic" ++ EncodedString = Credentials -> + case (catch base64:decode_to_string(EncodedString)) of + {'EXIT',{function_clause, _}} -> + {status, {401, none, ?NICE("Bad credentials "++ + Credentials)}}; + DecodedString -> + validate_user(Info, Directory, DirectoryData, + ValidUsers, ValidGroups, + DecodedString) + end; + %% Bad credentials! + BadCredentials -> + {status, {401, none, ?NICE("Bad credentials "++ + BadCredentials)}} + end + end. + +authorization_required(DirectoryData) -> + case proplists:get_value(auth_name, DirectoryData) of + undefined -> + {status,{500, none,?NICE("AuthName directive not specified")}}; + Realm -> + {authorization_required, Realm} + end. + + +validate_user(Info, Directory, DirectoryData, ValidUsers, + ValidGroups, DecodedString) -> + case a_valid_user(Info, DecodedString, + ValidUsers, ValidGroups, + Directory, DirectoryData) of + {yes, User} -> + {authorized, User}; + {no, _Reason} -> + authorization_required(DirectoryData); + {status, {StatusCode,PhraseArgs,Reason}} -> + {status,{StatusCode,PhraseArgs,Reason}} + end. + +a_valid_user(Info,DecodedString,ValidUsers,ValidGroups,Dir,DirData) -> + case httpd_util:split(DecodedString,":",2) of + {ok, [SupposedUser, Password]} -> + case user_accepted(SupposedUser, ValidUsers) of + true -> + check_password(SupposedUser, Password, Dir, DirData); + false -> + case group_accepted(Info,SupposedUser, + ValidGroups,Dir,DirData) of + true -> + check_password(SupposedUser,Password,Dir,DirData); + false -> + {no,?NICE("No such user exists")} + end + end; + {ok, BadCredentials} -> + {status,{401,none,?NICE("Bad credentials "++BadCredentials)}} + end. + +user_accepted(_SupposedUser, undefined) -> + false; +user_accepted(SupposedUser, ValidUsers) -> + lists:member(SupposedUser, ValidUsers). + + +group_accepted(_Info, _User, undefined, _Dir, _DirData) -> + false; +group_accepted(_Info, _User, [], _Dir, _DirData) -> + false; +group_accepted(Info, User, [Group|Rest], Dir, DirData) -> + Ret = int_list_group_members(Group, Dir, DirData), + case Ret of + {ok, UserList} -> + case lists:member(User, UserList) of + true -> + true; + false -> + group_accepted(Info, User, Rest, Dir, DirData) + end; + _ -> + false + end. + +check_password(User, Password, _Dir, DirData) -> + case int_get_user(DirData, User) of + {ok, UStruct} -> + case UStruct#httpd_user.password of + Password -> + %% FIXME + {yes, UStruct#httpd_user.username}; + _ -> + {no, "No such user"} % Don't say 'Bad Password' !!! + end; + _Other -> + {no, "No such user"} + end. + + +%% Middle API. Theese functions call the appropriate authentication module. +int_get_user(DirData, User) -> + AuthMod = auth_mod_name(DirData), + apply(AuthMod, get_user, [DirData, User]). + +int_list_group_members(Group, _Dir, DirData) -> + AuthMod = auth_mod_name(DirData), + apply(AuthMod, list_group_members, [DirData, Group]). + +auth_mod_name(DirData) -> + case proplists:get_value(auth_type, DirData, plain) of + plain -> mod_auth_plain; + mnesia -> mod_auth_mnesia; + dets -> mod_auth_dets + end. + + +%% +%% Is it a secret area? +%% + +%% secretp + +secretp(Path,ConfigDB) -> + Directories = ets:match(ConfigDB,{directory, {'$1','_'}}), + case secret_path(Path, Directories) of + {yes,Directory} -> + {yes, {Directory, + lists:flatten( + ets:match(ConfigDB,{directory, {Directory,'$1'}}))}}; + no -> + no + end. + +secret_path(Path, Directories) -> + secret_path(Path, httpd_util:uniq(lists:sort(Directories)),to_be_found). + +secret_path(_Path, [], to_be_found) -> + no; +secret_path(_Path, [], Directory) -> + {yes, Directory}; +secret_path(Path, [[NewDirectory] | Rest], Directory) -> + case inets_regexp:match(Path, NewDirectory) of + {match, _, _} when Directory =:= to_be_found -> + secret_path(Path, Rest, NewDirectory); + {match, _, Length} when Length > length(Directory)-> + secret_path(Path, Rest,NewDirectory); + {match, _, _Length} -> + secret_path(Path, Rest, Directory); + nomatch -> + secret_path(Path, Rest, Directory) + end. + +%% +%% Authenticate +%% + +%% allow + +allow({_,RemoteAddr}, _SocketType, _Socket, DirectoryData) -> + Hosts = proplists:get_value(allow_from, DirectoryData, all), + case validate_addr(RemoteAddr, Hosts) of + true -> + allowed; + false -> + {not_allowed, ?NICE("Connection from your host is not allowed")} + end. + +validate_addr(_RemoteAddr, all) -> % When called from 'allow' + true; +validate_addr(_RemoteAddr, none) -> % When called from 'deny' + false; +validate_addr(_RemoteAddr, []) -> + false; +validate_addr(RemoteAddr, [HostRegExp | Rest]) -> + case inets_regexp:match(RemoteAddr, HostRegExp) of + {match,_,_} -> + true; + nomatch -> + validate_addr(RemoteAddr,Rest) + end. + +%% deny + +deny({_,RemoteAddr}, _SocketType, _Socket,DirectoryData) -> + Hosts = proplists:get_value(deny_from, DirectoryData, none), + case validate_addr(RemoteAddr,Hosts) of + true -> + {denied, ?NICE("Connection from your host is not allowed")}; + false -> + not_denied + end. + +%% +%% Configuration +%% + +%% load/2 +%% + %% mod_auth recognizes the following Configuration Directives: %% %% AuthDBType @@ -128,35 +375,36 @@ %% state it was previously. load(" - Dir = string:strip(string:strip(Directory),right, $>), + Dir = httpd_conf:custom_clean(Directory,"",">"), {ok,[{directory, {Dir, [{path, Dir}]}}]}; load(eof,[{directory, {Directory, _DirData}}|_]) -> {error, ?NICE("Premature end-of-file in "++ Directory)}; load("AuthName " ++ AuthName, [{directory, {Directory, DirData}}|Rest]) -> {ok, [{directory, {Directory, - [{auth_name, string:strip(AuthName)} | DirData]}} + [{auth_name, httpd_conf:clean(AuthName)} | DirData]}} | Rest ]}; load("AuthUserFile " ++ AuthUserFile0, [{directory, {Directory, DirData}}|Rest]) -> - AuthUserFile = string:strip(AuthUserFile0), + AuthUserFile = httpd_conf:clean(AuthUserFile0), {ok, [{directory, {Directory, [{auth_user_file, AuthUserFile}|DirData]}} | Rest ]}; load("AuthGroupFile " ++ AuthGroupFile0, [{directory, {Directory, DirData}}|Rest]) -> - AuthGroupFile = string:strip(AuthGroupFile0), + AuthGroupFile = httpd_conf:clean(AuthGroupFile0), {ok,[{directory, {Directory, [{auth_group_file, AuthGroupFile}|DirData]}} | Rest]}; +%AuthAccessPassword load("AuthAccessPassword " ++ AuthAccessPassword0, [{directory, {Directory, DirData}}|Rest]) -> - AuthAccessPassword = string:strip(AuthAccessPassword0), + AuthAccessPassword = httpd_conf:clean(AuthAccessPassword0), {ok,[{directory, {Directory, [{auth_access_password, AuthAccessPassword}|DirData]}} | Rest]}; load("AuthDBType " ++ Type, [{directory, {Dir, DirData}}|Rest]) -> - case string:strip(Type) of + case httpd_conf:clean(Type) of "plain" -> {ok, [{directory, {Dir, [{auth_type, plain}|DirData]}} | Rest ]}; "mnesia" -> @@ -164,7 +412,7 @@ "dets" -> {ok, [{directory, {Dir, [{auth_type, dets}|DirData]}} | Rest ]}; _ -> - {error, ?NICE(string:strip(Type)++" is an invalid AuthDBType")} + {error, ?NICE(httpd_conf:clean(Type)++" is an invalid AuthDBType")} end; load("require " ++ Require,[{directory, {Directory, DirData}}|Rest]) -> @@ -176,7 +424,7 @@ {ok,[{directory, {Directory, [{require_group,Groups}|DirData]}} | Rest]}; {ok,_} -> - {error,?NICE(string:strip(Require) ++" is an invalid require")} + {error,?NICE(httpd_conf:clean(Require) ++" is an invalid require")} end; load("allow " ++ Allow,[{directory, {Directory, DirData}}|Rest]) -> @@ -188,7 +436,7 @@ {ok,[{directory, {Directory, [{allow_from,Hosts}|DirData]}} | Rest]}; {ok,_} -> - {error,?NICE(string:strip(Allow) ++" is an invalid allow")} + {error,?NICE(httpd_conf:clean(Allow) ++" is an invalid allow")} end; load("deny " ++ Deny,[{directory, {Directory, DirData}}|Rest]) -> @@ -200,7 +448,7 @@ {ok,[{{directory, Directory, [{deny_from, Hosts}|DirData]}} | Rest]}; {ok, _} -> - {error,?NICE(string:strip(Deny) ++" is an invalid deny")} + {error,?NICE(httpd_conf:clean(Deny) ++" is an invalid deny")} end; load("",[{directory, {Directory, DirData}}|Rest]) -> @@ -208,18 +456,38 @@ load("AuthMnesiaDB " ++ AuthMnesiaDB, [{directory, {Dir, DirData}}|Rest]) -> - case string:strip(AuthMnesiaDB) of + case httpd_conf:clean(AuthMnesiaDB) of "On" -> {ok,[{directory, {Dir,[{auth_type,mnesia}|DirData]}}|Rest]}; "Off" -> {ok,[{directory, {Dir,[{auth_type,plain}|DirData]}}|Rest]}; _ -> - {error, ?NICE(string:strip(AuthMnesiaDB) ++ - " is an invalid AuthMnesiaDB")} + {error, ?NICE(httpd_conf:clean(AuthMnesiaDB) ++ + " is an invalid AuthMnesiaDB")} + end. + +directory_config_check(Directory, DirData) -> + case proplists:get_value(auth_type, DirData) of + plain -> + check_filename_present(Directory,auth_user_file,DirData), + check_filename_present(Directory,auth_group_file,DirData); + _ -> + ok + end. +check_filename_present(Dir,AuthFile,DirData) -> + case proplists:get_value(AuthFile,DirData) of + Name when is_list(Name) -> + ok; + _ -> + throw({missing_auth_file, AuthFile, {directory, {Dir, DirData}}}) end. +%% store + store({directory, {Directory, DirData}}, ConfigList) when is_list(Directory) andalso is_list(DirData) -> + ?hdrt("store", + [{directory, Directory}, {dir_data, DirData}]), try directory_config_check(Directory, DirData) of ok -> store_directory(Directory, DirData, ConfigList) @@ -230,19 +498,108 @@ store({directory, {Directory, DirData}}, _) -> {error, {wrong_type, {directory, {Directory, DirData}}}}. -remove(ConfigDB) -> - lists:foreach(fun({directory, {_Dir, DirData}}) -> - AuthMod = auth_mod_name(DirData), - (catch apply(AuthMod, remove, [DirData])) - end, - ets:match_object(ConfigDB,{directory,{'_','_'}})), +store_directory(Directory0, DirData0, ConfigList) -> + ?hdrt("store directory - entry", + [{directory, Directory0}, {dir_data, DirData0}]), + Port = proplists:get_value(port, ConfigList), + DirData = case proplists:get_value(bind_address, ConfigList) of + undefined -> + [{port, Port}|DirData0]; + Addr -> + [{port, Port},{bind_address,Addr}|DirData0] + end, + Directory = + case filename:pathtype(Directory0) of + relative -> + SR = proplists:get_value(server_root, ConfigList), + filename:join(SR, Directory0); + _ -> + Directory0 + end, + AuthMod = + case proplists:get_value(auth_type, DirData0) of + mnesia -> mod_auth_mnesia; + dets -> mod_auth_dets; + plain -> mod_auth_plain; + _ -> no_module_at_all + end, + ?hdrt("store directory", + [{directory, Directory}, {dir_data, DirData}, {auth_mod, AuthMod}]), + case AuthMod of + no_module_at_all -> + {ok, {directory, {Directory, DirData}}}; + _ -> + %% Check that there are a password or add a standard password: + %% "NoPassword" + %% In this way a user must select to use a noPassword + Passwd = + case proplists:get_value(auth_access_password, DirData) of + undefined -> + ?NOPASSWORD; + PassW -> + PassW + end, + DirDataLast = lists:keydelete(auth_access_password,1,DirData), + Server_root = proplists:get_value(server_root, ConfigList), + case catch AuthMod:store_directory_data(Directory, + DirDataLast, + Server_root) of + ok -> + add_auth_password(Directory, Passwd, ConfigList), + {ok, {directory, {Directory, DirDataLast}}}; + {ok, NewDirData} -> + add_auth_password(Directory, Passwd, ConfigList), + {ok, {directory, {Directory, NewDirData}}}; + {error, Reason} -> + {error, Reason}; + Other -> + {error, Other} + end + end. - Addr = httpd_util:lookup(ConfigDB, bind_address, undefined), - Port = httpd_util:lookup(ConfigDB, port), - Profile = httpd_util:lookup(ConfigDB, profile, ?DEFAULT_PROFILE), - mod_auth_server:stop(Addr, Port, Profile), +add_auth_password(Dir, Pwd0, ConfigList) -> + Addr = proplists:get_value(bind_address, ConfigList), + Port = proplists:get_value(port, ConfigList), + mod_auth_server:start(Addr, Port), + mod_auth_server:add_password(Addr, Port, Dir, Pwd0). + +%% remove + + +remove(ConfigDB) -> + lists:foreach(fun({directory, {_Dir, DirData}}) -> + AuthMod = auth_mod_name(DirData), + (catch apply(AuthMod, remove, [DirData])) + end, + ets:match_object(ConfigDB,{directory,{'_','_'}})), + Addr = case lookup(ConfigDB, bind_address) of + [] -> + undefined; + [{bind_address, Address}] -> + Address + end, + [{port, Port}] = lookup(ConfigDB, port), + mod_auth_server:stop(Addr, Port), ok. +%% -------------------------------------------------------------------- + +%% update_password + +update_password(Port, Dir, Old, New, New)-> + update_password(undefined, Port, Dir, Old, New, New). + +update_password(Addr, Port, Dir, Old, New, New) when is_list(New) -> + mod_auth_server:update_password(Addr, Port, Dir, Old, New); + +update_password(_Addr, _Port, _Dir, _Old, _New, _New) -> + {error, badtype}; +update_password(_Addr, _Port, _Dir, _Old, _New, _New1) -> + {error, notqeual}. + + +%% add_user + add_user(UserName, Opt) -> case get_options(Opt, mandatory) of {Addr, Port, Dir, AuthPwd}-> @@ -266,6 +623,9 @@ user_data = UserData}], mod_auth_server:add_user(Addr, Port, Dir, User, ?NOPASSWORD). + +%% get_user + get_user(UserName, Opt) -> case get_options(Opt, mandatory) of {Addr, Port, Dir, AuthPwd} -> @@ -279,6 +639,9 @@ get_user(UserName, Addr, Port, Dir) -> mod_auth_server:get_user(Addr, Port, Dir, UserName, ?NOPASSWORD). + +%% add_group_member + add_group_member(GroupName, UserName, Opt)-> case get_options(Opt, mandatory) of {Addr, Port, Dir, AuthPwd}-> @@ -295,6 +658,9 @@ mod_auth_server:add_group_member(Addr, Port, Dir, GroupName, UserName, ?NOPASSWORD). + +%% delete_group_member + delete_group_member(GroupName, UserName, Opt) -> case get_options(Opt, mandatory) of {Addr, Port, Dir, AuthPwd} -> @@ -310,6 +676,9 @@ mod_auth_server:delete_group_member(Addr, Port, Dir, GroupName, UserName, ?NOPASSWORD). + +%% list_users + list_users(Opt) -> case get_options(Opt, mandatory) of {Addr, Port, Dir, AuthPwd} -> @@ -323,6 +692,9 @@ list_users(Addr, Port, Dir) -> mod_auth_server:list_users(Addr, Port, Dir, ?NOPASSWORD). + +%% delete_user + delete_user(UserName, Opt) -> case get_options(Opt, mandatory) of {Addr, Port, Dir, AuthPwd} -> @@ -335,6 +707,9 @@ delete_user(UserName, undefined, Port, Dir). delete_user(UserName, Addr, Port, Dir) -> mod_auth_server:delete_user(Addr, Port, Dir, UserName, ?NOPASSWORD). + + +%% delete_group delete_group(GroupName, Opt) -> case get_options(Opt, mandatory) of @@ -349,6 +724,9 @@ delete_group(GroupName, Addr, Port, Dir) -> mod_auth_server:delete_group(Addr, Port, Dir, GroupName, ?NOPASSWORD). + +%% list_groups + list_groups(Opt) -> case get_options(Opt, mandatory) of {Addr, Port, Dir, AuthPwd} -> @@ -362,6 +740,9 @@ list_groups(Addr, Port, Dir) -> mod_auth_server:list_groups(Addr, Port, Dir, ?NOPASSWORD). + +%% list_group_members + list_group_members(GroupName, Opt) -> case get_options(Opt, mandatory) of {Addr, Port, Dir, AuthPwd} -> @@ -377,312 +758,6 @@ mod_auth_server:list_group_members(Addr, Port, Dir, GroupName, ?NOPASSWORD). -update_password(Port, Dir, Old, New, New)-> - update_password(undefined, Port, Dir, Old, New, New). - -update_password(Addr, Port, Dir, Old, New, New) when is_list(New) -> - mod_auth_server:update_password(Addr, Port, Dir, Old, New); - -update_password(_Addr, _Port, _Dir, _Old, _New, _New) -> - {error, badtype}; -update_password(_Addr, _Port, _Dir, _Old, _New, _New1) -> - {error, notqeual}. - -%%-------------------------------------------------------------------- -%%% Internal functions -%%-------------------------------------------------------------------- - -do_auth(Info, Directory, DirectoryData, _AuthType) -> - %% Authenticate (require) - case require(Info, Directory, DirectoryData) of - authorized -> - {proceed,Info#mod.data}; - {authorized, User} -> - {proceed, [{remote_user,User}|Info#mod.data]}; - {authorization_required, Realm} -> - ReasonPhrase = httpd_util:reason_phrase(401), - Message = httpd_util:message(401,none,Info#mod.config_db), - {proceed, - [{response, - {401, - ["WWW-Authenticate: Basic realm=\"",Realm, - "\"\r\n\r\n","\n\n", - ReasonPhrase,"\n", - "\n\n

    ",ReasonPhrase, - "

    \n",Message,"\n\n\n"]}}| - Info#mod.data]}; - {status, {StatusCode,PhraseArgs,Reason}} -> - {proceed, [{status,{StatusCode,PhraseArgs,Reason}}| - Info#mod.data]} - end. - -require(Info, Directory, DirectoryData) -> - ParsedHeader = Info#mod.parsed_header, - ValidUsers = proplists:get_value(require_user, DirectoryData), - ValidGroups = proplists:get_value(require_group, DirectoryData), - %% Any user or group restrictions? - case ValidGroups of - undefined when ValidUsers =:= undefined -> - authorized; - _ -> - case proplists:get_value("authorization", ParsedHeader) of - undefined -> - authorization_required(DirectoryData); - %% Check credentials! - "Basic" ++ EncodedString = Credentials -> - case (catch base64:decode_to_string(EncodedString)) of - {'EXIT',{function_clause, _}} -> - {status, {401, none, ?NICE("Bad credentials "++ - Credentials)}}; - DecodedString -> - validate_user(Info, Directory, DirectoryData, - ValidUsers, ValidGroups, - DecodedString) - end; - %% Bad credentials! - BadCredentials -> - {status, {401, none, ?NICE("Bad credentials "++ - BadCredentials)}} - end - end. - -authorization_required(DirectoryData) -> - case proplists:get_value(auth_name, DirectoryData) of - undefined -> - {status,{500, none,?NICE("AuthName directive not specified")}}; - Realm -> - {authorization_required, Realm} - end. - - -validate_user(Info, Directory, DirectoryData, ValidUsers, - ValidGroups, DecodedString) -> - case a_valid_user(Info, DecodedString, - ValidUsers, ValidGroups, - Directory, DirectoryData) of - {yes, User} -> - {authorized, User}; - {no, _Reason} -> - authorization_required(DirectoryData); - {status, {StatusCode,PhraseArgs,Reason}} -> - {status,{StatusCode,PhraseArgs,Reason}} - end. - -a_valid_user(Info,DecodedString,ValidUsers,ValidGroups,Dir,DirData) -> - case httpd_util:split(DecodedString,":",2) of - {ok, [SupposedUser, Password]} -> - case user_accepted(SupposedUser, ValidUsers) of - true -> - check_password(SupposedUser, Password, Dir, DirData); - false -> - case group_accepted(Info,SupposedUser, - ValidGroups,Dir,DirData) of - true -> - check_password(SupposedUser,Password,Dir,DirData); - false -> - {no,?NICE("No such user exists")} - end - end; - {ok, BadCredentials} -> - {status,{401,none,?NICE("Bad credentials "++BadCredentials)}} - end. - -user_accepted(_SupposedUser, undefined) -> - false; -user_accepted(SupposedUser, ValidUsers) -> - lists:member(SupposedUser, ValidUsers). - - -group_accepted(_Info, _User, undefined, _Dir, _DirData) -> - false; -group_accepted(_Info, _User, [], _Dir, _DirData) -> - false; -group_accepted(Info, User, [Group|Rest], Dir, DirData) -> - Ret = int_list_group_members(Group, Dir, DirData), - case Ret of - {ok, UserList} -> - case lists:member(User, UserList) of - true -> - true; - false -> - group_accepted(Info, User, Rest, Dir, DirData) - end; - _ -> - false - end. - -check_password(User, Password, _Dir, DirData) -> - case int_get_user(DirData, User) of - {ok, UStruct} -> - case UStruct#httpd_user.password of - Password -> - %% FIXME - {yes, UStruct#httpd_user.username}; - _ -> - {no, "No such user"} % Don't say 'Bad Password' !!! - end; - _Other -> - {no, "No such user"} - end. - - -%% Middle API. Theese functions call the appropriate authentication module. -int_get_user(DirData, User) -> - AuthMod = auth_mod_name(DirData), - apply(AuthMod, get_user, [DirData, User]). - -int_list_group_members(Group, _Dir, DirData) -> - AuthMod = auth_mod_name(DirData), - apply(AuthMod, list_group_members, [DirData, Group]). - -auth_mod_name(DirData) -> - case proplists:get_value(auth_type, DirData, plain) of - plain -> mod_auth_plain; - mnesia -> mod_auth_mnesia; - dets -> mod_auth_dets - end. - -secretp(Path,ConfigDB) -> - Directories = ets:match(ConfigDB,{directory, {'$1','_'}}), - case secret_path(Path, Directories) of - {yes,Directory} -> - {yes, {Directory, - lists:flatten( - ets:match(ConfigDB,{directory, {Directory,'$1'}}))}}; - no -> - no - end. - -secret_path(Path, Directories) -> - secret_path(Path, httpd_util:uniq(lists:sort(Directories)),to_be_found). - -secret_path(_Path, [], to_be_found) -> - no; -secret_path(_Path, [], Directory) -> - {yes, Directory}; -secret_path(Path, [[NewDirectory] | Rest], Directory) -> - case inets_regexp:match(Path, NewDirectory) of - {match, _, _} when Directory =:= to_be_found -> - secret_path(Path, Rest, NewDirectory); - {match, _, Length} when Length > length(Directory)-> - secret_path(Path, Rest,NewDirectory); - {match, _, _Length} -> - secret_path(Path, Rest, Directory); - nomatch -> - secret_path(Path, Rest, Directory) - end. - -allow({_,RemoteAddr}, _SocketType, _Socket, DirectoryData) -> - Hosts = proplists:get_value(allow_from, DirectoryData, all), - case validate_addr(RemoteAddr, Hosts) of - true -> - allowed; - false -> - {not_allowed, ?NICE("Connection from your host is not allowed")} - end. - -validate_addr(_RemoteAddr, all) -> % When called from 'allow' - true; -validate_addr(_RemoteAddr, none) -> % When called from 'deny' - false; -validate_addr(_RemoteAddr, []) -> - false; -validate_addr(RemoteAddr, [HostRegExp | Rest]) -> - case inets_regexp:match(RemoteAddr, HostRegExp) of - {match,_,_} -> - true; - nomatch -> - validate_addr(RemoteAddr,Rest) - end. - -deny({_,RemoteAddr}, _SocketType, _Socket,DirectoryData) -> - Hosts = proplists:get_value(deny_from, DirectoryData, none), - case validate_addr(RemoteAddr,Hosts) of - true -> - {denied, ?NICE("Connection from your host is not allowed")}; - false -> - not_denied - end. - - -directory_config_check(Directory, DirData) -> - case proplists:get_value(auth_type, DirData) of - plain -> - check_filename_present(Directory,auth_user_file,DirData), - check_filename_present(Directory,auth_group_file,DirData); - _ -> - ok - end. -check_filename_present(Dir,AuthFile,DirData) -> - case proplists:get_value(AuthFile,DirData) of - Name when is_list(Name) -> - ok; - _ -> - throw({missing_auth_file, AuthFile, {directory, {Dir, DirData}}}) - end. - -store_directory(Directory0, DirData0, ConfigList) -> - Port = proplists:get_value(port, ConfigList), - DirData = case proplists:get_value(bind_address, ConfigList) of - undefined -> - [{port, Port}|DirData0]; - Addr -> - [{port, Port},{bind_address,Addr}|DirData0] - end, - Directory = - case filename:pathtype(Directory0) of - relative -> - SR = proplists:get_value(server_root, ConfigList), - filename:join(SR, Directory0); - _ -> - Directory0 - end, - AuthMod = - case proplists:get_value(auth_type, DirData0) of - mnesia -> mod_auth_mnesia; - dets -> mod_auth_dets; - plain -> mod_auth_plain; - _ -> no_module_at_all - end, - case AuthMod of - no_module_at_all -> - {ok, {directory, {Directory, DirData}}}; - _ -> - %% Check that there are a password or add a standard password: - %% "NoPassword" - %% In this way a user must select to use a noPassword - Passwd = - case proplists:get_value(auth_access_password, DirData) of - undefined -> - ?NOPASSWORD; - PassW -> - PassW - end, - DirDataLast = lists:keydelete(auth_access_password,1,DirData), - Server_root = proplists:get_value(server_root, ConfigList), - case catch AuthMod:store_directory_data(Directory, - DirDataLast, - Server_root) of - ok -> - add_auth_password(Directory, Passwd, ConfigList), - {ok, {directory, {Directory, DirDataLast}}}; - {ok, NewDirData} -> - add_auth_password(Directory, Passwd, ConfigList), - {ok, {directory, {Directory, NewDirData}}}; - {error, Reason} -> - {error, Reason}; - Other -> - {error, Other} - end - end. - -add_auth_password(Dir, Pwd0, ConfigList) -> - Addr = proplists:get_value(bind_address, ConfigList), - Port = proplists:get_value(port, ConfigList), - Profile = proplists:get_value(profile, ConfigList, ?DEFAULT_PROFILE), - mod_auth_server:start(Addr, Port, Profile), - mod_auth_server:add_password(Addr, Port, Dir, Pwd0). - %% Opt = [{port, Port}, %% {addr, Addr}, %% {dir, Dir}, @@ -717,3 +792,7 @@ {UserData, Pwd} end end. + + +lookup(Db, Key) -> + ets:lookup(Db, Key). diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth.hrl erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth.hrl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth_mnesia.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth_mnesia.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth_mnesia.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth_mnesia.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth_plain.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth_plain.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth_plain.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth_plain.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,11 +22,15 @@ -include("httpd.hrl"). -include("mod_auth.hrl"). -include("httpd_internal.hrl"). +-include("inets_internal.hrl"). + -define(VMODULE,"AUTH_PLAIN"). %% Internal API -export([store_directory_data/3]). + + -export([get_user/2, list_group_members/2, add_user/2, @@ -39,13 +42,17 @@ delete_group/2, remove/1]). -%%==================================================================== -%% Internal application API -%%==================================================================== +%% +%% API +%% +%% %% Storage format of users in the ets table: %% {UserName, Password, UserData} +%% + add_user(DirData, #httpd_user{username = User} = UStruct) -> + ?hdrt("add user", [{user, UStruct}]), PWDB = proplists:get_value(auth_user_file, DirData), Record = {User, UStruct#httpd_user.password, @@ -59,6 +66,7 @@ end. get_user(DirData, User) -> + ?hdrt("get user", [{dir_data, DirData}, {user, User}]), PWDB = proplists:get_value(auth_user_file, DirData), case ets:lookup(PWDB, User) of [{User, PassWd, Data}] -> @@ -76,6 +84,7 @@ [], lists:flatten(Records))}. delete_user(DirData, UserName) -> + ?hdrt("delete user", [{dir_data, DirData}, {user, UserName}]), PWDB = proplists:get_value(auth_user_file, DirData), case ets:lookup(PWDB, UserName) of [{UserName, _SomePassword, _SomeData}] -> @@ -89,8 +98,11 @@ {error, no_such_user} end. +%% %% Storage of groups in the ets table: %% {Group, UserList} where UserList is a list of strings. +%% + add_group_member(DirData, Group, UserName) -> GDB = proplists:get_value(auth_group_file, DirData), case ets:lookup(GDB, Group) of @@ -151,12 +163,17 @@ end. store_directory_data(_Directory, DirData, Server_root) -> + ?hdrt("store directory data", + [{dir_data, DirData}, {server_root, Server_root}]), PWFile = absolute_file_name(auth_user_file, DirData, Server_root), GroupFile = absolute_file_name(auth_group_file, DirData, Server_root), case load_passwd(PWFile) of {ok, PWDB} -> + ?hdrt("password file loaded", [{file, PWFile}, {pwdb, PWDB}]), case load_group(GroupFile) of {ok, GRDB} -> + ?hdrt("group file loaded", + [{file, GroupFile}, {grdb, GRDB}]), %% Address and port is included in the file names... Addr = proplists:get_value(bind_address, DirData), Port = proplists:get_value(port, DirData), @@ -174,83 +191,9 @@ {error, Err2} end. -%% Deletes ets tables used by this auth mod. -remove(DirData) -> - PWDB = proplists:get_value(auth_user_file, DirData), - GDB = proplists:get_value(auth_group_file, DirData), - ets:delete(PWDB), - ets:delete(GDB). - -%%-------------------------------------------------------------------- -%%% Internal functions -%%-------------------------------------------------------------------- -%% Return the absolute path name of File_type. -absolute_file_name(File_type, DirData, Server_root) -> - Path = proplists:get_value(File_type, DirData), - case filename:pathtype(Path) of - relative -> - case Server_root of - undefined -> - {error, - ?NICE(Path++ - " is an invalid file name because " - "ServerRoot is not defined")}; - _ -> - filename:join(Server_root,Path) - end; - _ -> - Path - end. - -store_group(Addr,Port,GroupList) -> - %% Not a named table so not importante to add Profile to name - Name = httpd_util:make_name("httpd_group",Addr,Port), - GroupDB = ets:new(Name, [set, public]), - store_group(GroupDB, GroupList). - -store_group(GroupDB,[]) -> - {ok, GroupDB}; -store_group(GroupDB, [User|Rest]) -> - ets:insert(GroupDB, User), - store_group(GroupDB, Rest). -store_passwd(Addr,Port,PasswdList) -> - %% Not a named table so not importante to add Profile to name - Name = httpd_util:make_name("httpd_passwd",Addr,Port), - PasswdDB = ets:new(Name, [set, public]), - store_passwd(PasswdDB, PasswdList). -store_passwd(PasswdDB, []) -> - {ok, PasswdDB}; -store_passwd(PasswdDB, [User|Rest]) -> - ets:insert(PasswdDB, User), - store_passwd(PasswdDB, Rest). - -parse_group(Stream, GroupList) -> - Line = - case io:get_line(Stream,'') of - eof -> - eof; - String -> - httpd_conf:white_space_clean(String) - end, - parse_group(Stream, GroupList, Line). - -parse_group(Stream, GroupList, eof) -> - file:close(Stream), - {ok, GroupList}; -parse_group(Stream, GroupList, "") -> - parse_group(Stream, GroupList); -parse_group(Stream, GroupList, [$#|_]) -> - parse_group(Stream, GroupList); -parse_group(Stream, GroupList, Line) -> - case inets_regexp:split(Line, ":") of - {ok, [Group,Users]} -> - {ok, UserList} = inets_regexp:split(Users," "), - parse_group(Stream, [{Group,UserList}|GroupList]); - {ok, _} -> - {error, ?NICE(Line)} - end. +%% load_passwd load_passwd(AuthUserFile) -> case file:open(AuthUserFile, [read]) of @@ -266,7 +209,7 @@ eof -> eof; String -> - httpd_conf:white_space_clean(String) + httpd_conf:clean(String) end, parse_passwd(Stream, PasswdList, Line). @@ -285,6 +228,8 @@ {error, ?NICE(Line)} end. +%% load_group + load_group(AuthGroupFile) -> case file:open(AuthGroupFile, [read]) of {ok, Stream} -> @@ -292,3 +237,91 @@ {error, _} -> {error, ?NICE("Can't open " ++ AuthGroupFile)} end. + +parse_group(Stream, GroupList) -> + Line = + case io:get_line(Stream,'') of + eof -> + eof; + String -> + httpd_conf:clean(String) + end, + parse_group(Stream, GroupList, Line). + +parse_group(Stream, GroupList, eof) -> + file:close(Stream), + {ok, GroupList}; +parse_group(Stream, GroupList, "") -> + parse_group(Stream, GroupList); +parse_group(Stream, GroupList, [$#|_]) -> + parse_group(Stream, GroupList); +parse_group(Stream, GroupList, Line) -> + case inets_regexp:split(Line, ":") of + {ok, [Group,Users]} -> + {ok, UserList} = inets_regexp:split(Users," "), + parse_group(Stream, [{Group,UserList}|GroupList]); + {ok, _} -> + {error, ?NICE(Line)} + end. + + +%% store_passwd + +store_passwd(Addr,Port,PasswdList) -> + Name = httpd_util:make_name("httpd_passwd",Addr,Port), + PasswdDB = ets:new(Name, [set, public]), + store_passwd(PasswdDB, PasswdList). + +store_passwd(PasswdDB, []) -> + {ok, PasswdDB}; +store_passwd(PasswdDB, [User|Rest]) -> + ets:insert(PasswdDB, User), + store_passwd(PasswdDB, Rest). + +%% store_group + +store_group(Addr,Port,GroupList) -> + Name = httpd_util:make_name("httpd_group",Addr,Port), + GroupDB = ets:new(Name, [set, public]), + store_group(GroupDB, GroupList). + + +store_group(GroupDB,[]) -> + {ok, GroupDB}; +store_group(GroupDB, [User|Rest]) -> + ets:insert(GroupDB, User), + store_group(GroupDB, Rest). + + +%% remove/1 +%% +%% Deletes ets tables used by this auth mod. +%% +remove(DirData) -> + PWDB = proplists:get_value(auth_user_file, DirData), + GDB = proplists:get_value(auth_group_file, DirData), + ets:delete(PWDB), + ets:delete(GDB). + + + +%% absolute_file_name/2 +%% +%% Return the absolute path name of File_type. +absolute_file_name(File_type, DirData, Server_root) -> + Path = proplists:get_value(File_type, DirData), + case filename:pathtype(Path) of + relative -> + case Server_root of + undefined -> + {error, + ?NICE(Path++ + " is an invalid file name because " + "ServerRoot is not defined")}; + _ -> + filename:join(Server_root,Path) + end; + _ -> + Path + end. + diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth_server.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth_server.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_auth_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_auth_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,184 +22,246 @@ -include("httpd.hrl"). -include("httpd_internal.hrl"). +-include("inets_internal.hrl"). -behaviour(gen_server). + %% mod_auth exports --export([start/3, stop/3, +-export([start/2, stop/2, add_password/4, update_password/5, add_user/5, delete_user/5, get_user/5, list_users/4, add_group_member/6, delete_group_member/6, list_group_members/5, delete_group/5, list_groups/4]). %% gen_server exports --export([start_link/3, init/1, +-export([start_link/2, init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -record(state, {tab}). -%%==================================================================== -%% Internal application API -%%==================================================================== +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% External API %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% start_link/3 +%% %% NOTE: This is called by httpd_misc_sup when the process is started %% -start_link(Addr, Port, Profile) -> - Name = make_name(Addr, Port, Profile), +start_link(Addr, Port) -> + ?hdrt("start_link", [{address, Addr}, {port, Port}]), + Name = make_name(Addr, Port), gen_server:start_link({local, Name}, ?MODULE, [], [{timeout, infinity}]). -start(Addr, Port, Profile) -> - Name = make_name(Addr, Port, Profile), + +%% start/2 + +start(Addr, Port) -> + ?hdrd("start", [{address, Addr}, {port, Port}]), + Name = make_name(Addr, Port), case whereis(Name) of undefined -> - httpd_misc_sup:start_auth_server(Addr, Port, Profile); + httpd_misc_sup:start_auth_server(Addr, Port); _ -> %% Already started... ok end. -stop(Addr, Port, Profile) -> - Name = make_name(Addr, Port, Profile), + +%% stop/2 + +stop(Addr, Port) -> + ?hdrd("stop", [{address, Addr}, {port, Port}]), + Name = make_name(Addr, Port), case whereis(Name) of undefined -> %% Already stopped ok; _ -> - (catch httpd_misc_sup:stop_auth_server(Addr, Port, Profile)) + (catch httpd_misc_sup:stop_auth_server(Addr, Port)) end. +%% add_password/4 + add_password(Addr, Port, Dir, Password) -> - add_password(Addr, Port, ?DEFAULT_PROFILE, Dir, Password). -add_password(Addr, Port, Profile, Dir, Password) -> - Name = make_name(Addr, Port, Profile), + ?hdrt("add password", [{address, Addr}, {port, Port}]), + Name = make_name(Addr, Port), Req = {add_password, Dir, Password}, call(Name, Req). -update_password(Addr, Port, Dir, Old, New) -> - update_password(Addr, Port, ?DEFAULT_PROFILE, Dir, Old, New). -update_password(Addr, Port, Profile, Dir, Old, New) when is_list(New) -> - Name = make_name(Addr, Port, Profile), + +%% update_password/6 + +update_password(Addr, Port, Dir, Old, New) when is_list(New) -> + ?hdrt("update password", + [{address, Addr}, {port, Port}, {dir, Dir}, {old, Old}, {new, New}]), + Name = make_name(Addr, Port), Req = {update_password, Dir, Old, New}, call(Name, Req). + + +%% add_user/5 add_user(Addr, Port, Dir, User, Password) -> - add_user(Addr, Port, ?DEFAULT_PROFILE, Dir, User, Password). -add_user(Addr, Port, Profile, Dir, User, Password) -> - Name = make_name(Addr, Port, Profile), - Req = {add_user, Addr, Port, Profile, Dir, User, Password}, + ?hdrt("add user", + [{address, Addr}, {port, Port}, + {dir, Dir}, {user, User}, {passwd, Password}]), + Name = make_name(Addr, Port), + Req = {add_user, Addr, Port, Dir, User, Password}, call(Name, Req). + +%% delete_user/5 + delete_user(Addr, Port, Dir, UserName, Password) -> - delete_user(Addr, Port, ?DEFAULT_PROFILE, Dir, UserName, Password). -delete_user(Addr, Port, Profile, Dir, UserName, Password) -> - Name = make_name(Addr, Port, Profile), - Req = {delete_user, Addr, Port, Profile, Dir, UserName, Password}, + ?hdrt("delete user", + [{address, Addr}, {port, Port}, + {dir, Dir}, {user, UserName}, {passwd, Password}]), + Name = make_name(Addr, Port), + Req = {delete_user, Addr, Port, Dir, UserName, Password}, call(Name, Req). + +%% get_user/5 + get_user(Addr, Port, Dir, UserName, Password) -> - get_user(Addr, Port, ?DEFAULT_PROFILE, Dir, UserName, Password). -get_user(Addr, Port, Profile,Dir, UserName, Password) -> - Name = make_name(Addr, Port, Profile), - Req = {get_user, Addr, Port, Profile, Dir, UserName, Password}, + ?hdrt("get user", + [{address, Addr}, {port, Port}, + {dir, Dir}, {user, UserName}, {passwd, Password}]), + Name = make_name(Addr, Port), + Req = {get_user, Addr, Port, Dir, UserName, Password}, call(Name, Req). + +%% list_users/4 + list_users(Addr, Port, Dir, Password) -> - list_users(Addr, Port, ?DEFAULT_PROFILE, Dir, Password). -list_users(Addr, Port, Profile, Dir, Password) -> - Name = make_name(Addr,Port, Profile), - Req = {list_users, Addr, Port, Profile, Dir, Password}, + ?hdrt("list users", + [{address, Addr}, {port, Port}, {dir, Dir}, {passwd, Password}]), + Name = make_name(Addr,Port), + Req = {list_users, Addr, Port, Dir, Password}, call(Name, Req). + +%% add_group_member/6 + add_group_member(Addr, Port, Dir, GroupName, UserName, Password) -> - add_group_member(Addr, Port, ?DEFAULT_PROFILE, Dir, GroupName, UserName, Password). -add_group_member(Addr, Port, Profile, Dir, GroupName, UserName, Password) -> - Name = make_name(Addr,Port, Profile), - Req = {add_group_member, Addr, Port, Profile, Dir, GroupName, UserName, Password}, + ?hdrt("add group member", + [{address, Addr}, {port, Port}, {dir, Dir}, + {group, GroupName}, {user, UserName}, {passwd, Password}]), + Name = make_name(Addr,Port), + Req = {add_group_member, Addr, Port, Dir, GroupName, UserName, Password}, call(Name, Req). + +%% delete_group_member/6 + delete_group_member(Addr, Port, Dir, GroupName, UserName, Password) -> - delete_group_member(Addr, Port, ?DEFAULT_PROFILE, Dir, GroupName, UserName, Password). -delete_group_member(Addr, Port, Profile, Dir, GroupName, UserName, Password) -> - Name = make_name(Addr,Port,Profile), - Req = {delete_group_member, Addr, Port, Profile, Dir, GroupName, UserName, Password}, + ?hdrt("delete group member", + [{address, Addr}, {port, Port}, {dir, Dir}, + {group, GroupName}, {user, UserName}, {passwd, Password}]), + Name = make_name(Addr,Port), + Req = {delete_group_member, Addr, Port, Dir, GroupName, UserName, Password}, call(Name, Req). + +%% list_group_members/4 + list_group_members(Addr, Port, Dir, Group, Password) -> - list_group_members(Addr, Port, ?DEFAULT_PROFILE, Dir, Group, Password). -list_group_members(Addr, Port, Profile, Dir, Group, Password) -> - Name = make_name(Addr, Port, Profile), + ?hdrt("list group members", + [{address, Addr}, {port, Port}, {dir, Dir}, + {group, Group}, {passwd, Password}]), + Name = make_name(Addr, Port), Req = {list_group_members, Addr, Port, Dir, Group, Password}, call(Name, Req). + +%% delete_group/5 + delete_group(Addr, Port, Dir, GroupName, Password) -> - delete_group(Addr, Port, ?DEFAULT_PROFILE, Dir, GroupName, Password). -delete_group(Addr, Port, Profile, Dir, GroupName, Password) -> - Name = make_name(Addr, Port, Profile), - Req = {delete_group, Addr, Port, Profile, Dir, GroupName, Password}, + ?hdrt("delete group", + [{address, Addr}, {port, Port}, {dir, Dir}, + {group, GroupName}, {passwd, Password}]), + Name = make_name(Addr, Port), + Req = {delete_group, Addr, Port, Dir, GroupName, Password}, call(Name, Req). + +%% list_groups/4 + list_groups(Addr, Port, Dir, Password) -> - list_groups(Addr, Port, ?DEFAULT_PROFILE, Dir, Password). -list_groups(Addr, Port, Profile, Dir, Password) -> - Name = make_name(Addr, Port, Profile), - Req = {list_groups, Addr, Port,Profile, Dir, Password}, + ?hdrt("list groups", + [{address, Addr}, {port, Port}, {dir, Dir}, {passwd, Password}]), + Name = make_name(Addr, Port), + Req = {list_groups, Addr, Port, Dir, Password}, call(Name, Req). -%%==================================================================== -%% Behavior call backs -%%==================================================================== + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% Server call-back functions %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% init + init(_) -> + ?hdrv("initiating", []), {ok,#state{tab = ets:new(auth_pwd,[set,protected])}}. %% handle_call %% Add a user -handle_call({add_user, Addr, Port, Profile, Dir, User, AuthPwd}, _From, State) -> - Reply = api_call(Addr, Port, Profile, Dir, add_user, User, AuthPwd, State), +handle_call({add_user, Addr, Port, Dir, User, AuthPwd}, _From, State) -> + Reply = api_call(Addr, Port, Dir, add_user, User, AuthPwd, State), + ?hdrt("add user", [{reply, Reply}]), {reply, Reply, State}; %% Get data about a user -handle_call({get_user, Addr, Port, Profile, Dir, User, AuthPwd}, _From, State) -> - Reply = api_call(Addr, Port, Profile, Dir, get_user, [User], AuthPwd, State), +handle_call({get_user, Addr, Port, Dir, User, AuthPwd}, _From, State) -> + Reply = api_call(Addr, Port, Dir, get_user, [User], AuthPwd, State), {reply, Reply, State}; %% Add a group member -handle_call({add_group_member, Addr, Port, Profile, Dir, Group, User, AuthPwd}, +handle_call({add_group_member, Addr, Port, Dir, Group, User, AuthPwd}, _From, State) -> - Reply = api_call(Addr, Port, Profile, Dir, add_group_member, [Group, User], + Reply = api_call(Addr, Port, Dir, add_group_member, [Group, User], AuthPwd, State), {reply, Reply, State}; %% delete a group -handle_call({delete_group_member, Addr, Port, Profile, Dir, Group, User, AuthPwd}, +handle_call({delete_group_member, Addr, Port, Dir, Group, User, AuthPwd}, _From, State) -> - Reply = api_call(Addr, Port, Profile, Dir, delete_group_member, [Group, User], + Reply = api_call(Addr, Port, Dir, delete_group_member, [Group, User], AuthPwd, State), {reply, Reply, State}; %% List all users thats standalone users -handle_call({list_users, Addr, Port, Profile, Dir, AuthPwd}, _From, State) -> - Reply = api_call(Addr, Port, Profile, Dir, list_users, [], AuthPwd, State), +handle_call({list_users, Addr, Port, Dir, AuthPwd}, _From, State) -> + Reply = api_call(Addr, Port, Dir, list_users, [], AuthPwd, State), {reply, Reply, State}; %% Delete a user -handle_call({delete_user, Addr, Port, Profile, Dir, User, AuthPwd}, _From, State) -> - Reply = api_call(Addr, Port, Profile, Dir, delete_user, [User], AuthPwd, State), +handle_call({delete_user, Addr, Port, Dir, User, AuthPwd}, _From, State) -> + Reply = api_call(Addr, Port, Dir, delete_user, [User], AuthPwd, State), {reply, Reply, State}; %% Delete a group -handle_call({delete_group, Addr, Port, Profile, Dir, Group, AuthPwd}, _From, State) -> - Reply = api_call(Addr, Port, Profile, Dir, delete_group, [Group], AuthPwd, State), +handle_call({delete_group, Addr, Port, Dir, Group, AuthPwd}, _From, State) -> + Reply = api_call(Addr, Port, Dir, delete_group, [Group], AuthPwd, State), {reply, Reply, State}; %% List the current groups -handle_call({list_groups, Addr, Port, Profile, Dir, AuthPwd}, _From, State) -> - Reply = api_call(Addr, Port, Profile, Dir, list_groups, [], AuthPwd, State), +handle_call({list_groups, Addr, Port, Dir, AuthPwd}, _From, State) -> + Reply = api_call(Addr, Port, Dir, list_groups, [], AuthPwd, State), {reply, Reply, State}; %% List the members of the given group -handle_call({list_group_members, Addr, Port, Profile, Dir, Group, AuthPwd}, +handle_call({list_group_members, Addr, Port, Dir, Group, AuthPwd}, _From, State) -> - Reply = api_call(Addr, Port, Profile, Dir, list_group_members, [Group], + Reply = api_call(Addr, Port, Dir, list_group_members, [Group], AuthPwd, State), {reply, Reply, State}; @@ -245,16 +306,26 @@ ets:delete(State#state.tab), ok. + +%% code_change(Vsn, State, Extra) +%% code_change(_Vsn, State, _Extra) -> {ok, State}. -%%-------------------------------------------------------------------- -%%% Internal functions -%%-------------------------------------------------------------------- -api_call(Addr, Port, Profile, Dir, Func, Args,Password,State) -> + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% The functions that really changes the data in the database %% +%% of users to different directories %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% API gateway + +api_call(Addr, Port, Dir, Func, Args,Password,State) -> case controlPassword(Password, State, Dir) of ok-> - ConfigName = httpd_util:make_name("httpd_conf", Addr, Port, Profile), + ConfigName = httpd_util:make_name("httpd_conf", Addr, Port), case ets:match_object(ConfigName, {directory, {Dir, '$1'}}) of [{directory, {Dir, DirData}}] -> AuthMod = auth_mod_name(DirData), @@ -315,8 +386,8 @@ ets:lookup(Db, Key). -make_name(Addr, Port, Profile) -> - httpd_util:make_name(?MODULE_STRING, Addr, Port, Profile). +make_name(Addr,Port) -> + httpd_util:make_name("httpd_auth",Addr,Port). call(Name, Req) -> @@ -326,3 +397,5 @@ Reply -> Reply end. + + diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_browser.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_browser.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_browser.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_browser.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_cgi.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_cgi.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_cgi.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_cgi.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -96,24 +95,24 @@ %% or cache %% load("ScriptNoCache " ++ CacheArg, [])-> - case catch list_to_atom(string:strip(CacheArg)) of + case catch list_to_atom(httpd_conf:clean(CacheArg)) of true -> {ok, [], {script_nocache, true}}; false -> {ok, [], {script_nocache, false}}; _ -> - {error, ?NICE(string:strip(CacheArg)++ + {error, ?NICE(httpd_conf:clean(CacheArg)++ " is an invalid ScriptNoCache directive")} end; %% ScriptTimeout Seconds, The number of seconds that the server %% maximum will wait for the script to %% generate a part of the document load("ScriptTimeout " ++ Timeout, [])-> - case catch list_to_integer(string:strip(Timeout)) of + case catch list_to_integer(httpd_conf:clean(Timeout)) of TimeoutSec when is_integer(TimeoutSec) -> {ok, [], {script_timeout,TimeoutSec*1000}}; _ -> - {error, ?NICE(string:strip(Timeout)++ + {error, ?NICE(httpd_conf:clean(Timeout)++ " is an invalid ScriptTimeout")} end. diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_dir.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_dir.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_dir.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_dir.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_disk_log.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_disk_log.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_disk_log.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_disk_log.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -140,70 +139,70 @@ load("TransferDiskLogSize " ++ TransferDiskLogSize, []) -> case inets_regexp:split(TransferDiskLogSize," ") of {ok,[MaxBytes,MaxFiles]} -> - case make_integer(MaxBytes) of + case httpd_conf:make_integer(MaxBytes) of {ok,MaxBytesInteger} -> - case make_integer(MaxFiles) of + case httpd_conf:make_integer(MaxFiles) of {ok,MaxFilesInteger} -> {ok,[],{transfer_disk_log_size, {MaxBytesInteger,MaxFilesInteger}}}; {error,_} -> {error, - ?NICE(string:strip(TransferDiskLogSize)++ + ?NICE(httpd_conf:clean(TransferDiskLogSize)++ " is an invalid TransferDiskLogSize")} end; {error,_} -> - {error,?NICE(string:strip(TransferDiskLogSize)++ + {error,?NICE(httpd_conf:clean(TransferDiskLogSize)++ " is an invalid TransferDiskLogSize")} end end; load("TransferDiskLog " ++ TransferDiskLog,[]) -> - {ok,[],{transfer_disk_log,string:strip(TransferDiskLog)}}; + {ok,[],{transfer_disk_log,httpd_conf:clean(TransferDiskLog)}}; load("ErrorDiskLogSize " ++ ErrorDiskLogSize, []) -> case inets_regexp:split(ErrorDiskLogSize," ") of {ok,[MaxBytes,MaxFiles]} -> - case make_integer(MaxBytes) of + case httpd_conf:make_integer(MaxBytes) of {ok,MaxBytesInteger} -> - case make_integer(MaxFiles) of + case httpd_conf:make_integer(MaxFiles) of {ok,MaxFilesInteger} -> {ok,[],{error_disk_log_size, {MaxBytesInteger,MaxFilesInteger}}}; {error,_} -> - {error,?NICE(string:strip(ErrorDiskLogSize)++ + {error,?NICE(httpd_conf:clean(ErrorDiskLogSize)++ " is an invalid ErrorDiskLogSize")} end; {error,_} -> - {error,?NICE(string:strip(ErrorDiskLogSize)++ + {error,?NICE(httpd_conf:clean(ErrorDiskLogSize)++ " is an invalid ErrorDiskLogSize")} end end; load("ErrorDiskLog " ++ ErrorDiskLog, []) -> - {ok, [], {error_disk_log, string:strip(ErrorDiskLog)}}; + {ok, [], {error_disk_log, httpd_conf:clean(ErrorDiskLog)}}; load("SecurityDiskLogSize " ++ SecurityDiskLogSize, []) -> case inets_regexp:split(SecurityDiskLogSize, " ") of {ok, [MaxBytes, MaxFiles]} -> - case make_integer(MaxBytes) of + case httpd_conf:make_integer(MaxBytes) of {ok, MaxBytesInteger} -> - case make_integer(MaxFiles) of + case httpd_conf:make_integer(MaxFiles) of {ok, MaxFilesInteger} -> {ok, [], {security_disk_log_size, {MaxBytesInteger, MaxFilesInteger}}}; {error,_} -> {error, - ?NICE(string:strip(SecurityDiskLogSize) ++ + ?NICE(httpd_conf:clean(SecurityDiskLogSize) ++ " is an invalid SecurityDiskLogSize")} end; {error, _} -> - {error, ?NICE(string:strip(SecurityDiskLogSize) ++ + {error, ?NICE(httpd_conf:clean(SecurityDiskLogSize) ++ " is an invalid SecurityDiskLogSize")} end end; load("SecurityDiskLog " ++ SecurityDiskLog, []) -> - {ok, [], {security_disk_log, string:strip(SecurityDiskLog)}}; + {ok, [], {security_disk_log, httpd_conf:clean(SecurityDiskLog)}}; load("DiskLogFormat " ++ Format, []) -> - case string:strip(Format) of + case httpd_conf:clean(Format) of "internal" -> {ok, [], {disk_log_format,internal}}; "external" -> @@ -315,7 +314,7 @@ proplists:get_value(Tag, ConfigList, {500*1024,8}). create_disk_log(LogFile, SizeTag, ConfigList) -> - Filename = string:strip(LogFile), + Filename = httpd_conf:clean(LogFile), {MaxBytes, MaxFiles} = log_size(ConfigList, SizeTag), case filename:pathtype(Filename) of absolute -> @@ -414,11 +413,3 @@ log_internal_info(Info,Date,[_|Rest]) -> log_internal_info(Info,Date,Rest). -make_integer(List) -> - try list_to_integer(List) of - N -> - {ok, N} - catch - _:_ -> - {error, {badarg, list_to_integer, List}} - end. diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_esi.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_esi.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_esi.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_esi.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -99,40 +98,40 @@ case inets_regexp:split(ErlScriptAlias," ") of {ok, [ErlName | StrModules]} -> Modules = lists:map(fun(Str) -> - list_to_atom(string:strip(Str)) + list_to_atom(httpd_conf:clean(Str)) end, StrModules), {ok, [], {erl_script_alias, {ErlName, Modules}}}; {ok, _} -> - {error, ?NICE(string:strip(ErlScriptAlias) ++ + {error, ?NICE(httpd_conf:clean(ErlScriptAlias) ++ " is an invalid ErlScriptAlias")} end; load("EvalScriptAlias " ++ EvalScriptAlias, []) -> case inets_regexp:split(EvalScriptAlias, " ") of {ok, [EvalName | StrModules]} -> Modules = lists:map(fun(Str) -> - list_to_atom(string:strip(Str)) + list_to_atom(httpd_conf:clean(Str)) end, StrModules), {ok, [], {eval_script_alias, {EvalName, Modules}}}; {ok, _} -> - {error, ?NICE(string:strip(EvalScriptAlias) ++ + {error, ?NICE(httpd_conf:clean(EvalScriptAlias) ++ " is an invalid EvalScriptAlias")} end; load("ErlScriptTimeout " ++ Timeout, [])-> - case catch list_to_integer(string:strip(Timeout)) of + case catch list_to_integer(httpd_conf:clean(Timeout)) of TimeoutSec when is_integer(TimeoutSec) -> {ok, [], {erl_script_timeout, TimeoutSec * 1000}}; _ -> - {error, ?NICE(string:strip(Timeout) ++ + {error, ?NICE(httpd_conf:clean(Timeout) ++ " is an invalid ErlScriptTimeout")} end; load("ErlScriptNoCache " ++ CacheArg, [])-> - case catch list_to_atom(string:strip(CacheArg)) of + case catch list_to_atom(httpd_conf:clean(CacheArg)) of true -> {ok, [], {erl_script_nocache, true}}; false -> {ok, [], {erl_script_nocache, false}}; _ -> - {error, ?NICE(string:strip(CacheArg)++ + {error, ?NICE(httpd_conf:clean(CacheArg)++ " is an invalid ErlScriptNoCache directive")} end. @@ -376,6 +375,7 @@ end), Response = deliver_webpage_chunk(ModData, Pid), + process_flag(trap_exit,false), Response. @@ -417,6 +417,7 @@ ?hdrv("deliver_webpage_chunk - timeout", []), send_headers(ModData, 504, [{"connection", "close"}]), httpd_socket:close(ModData#mod.socket_type, ModData#mod.socket), + process_flag(trap_exit,false), {proceed,[{response, {already_sent, 200, 0}} | ModData#mod.data]} end. @@ -444,6 +445,7 @@ ExtraHeaders ++ HTTPHeaders). handle_body(_, #mod{method = "HEAD"} = ModData, _, _, Size, _) -> + process_flag(trap_exit,false), {proceed, [{response, {already_sent, 200, Size}} | ModData#mod.data]}; handle_body(Pid, ModData, Body, Timeout, Size, IsDisableChunkedSend) -> @@ -451,54 +453,34 @@ httpd_response:send_chunk(ModData, Body, IsDisableChunkedSend), receive {esi_data, Data} when is_binary(Data) -> + ?hdrt("handle_body - received binary data (esi)", []), handle_body(Pid, ModData, Data, Timeout, Size + byte_size(Data), IsDisableChunkedSend); {esi_data, Data} -> + ?hdrt("handle_body - received data (esi)", []), handle_body(Pid, ModData, Data, Timeout, Size + length(Data), IsDisableChunkedSend); {ok, Data} -> + ?hdrt("handle_body - received data (ok)", []), handle_body(Pid, ModData, Data, Timeout, Size + length(Data), IsDisableChunkedSend); {'EXIT', Pid, normal} when is_pid(Pid) -> + ?hdrt("handle_body - exit:normal", []), httpd_response:send_final_chunk(ModData, IsDisableChunkedSend), {proceed, [{response, {already_sent, 200, Size}} | ModData#mod.data]}; {'EXIT', Pid, Reason} when is_pid(Pid) -> - Error = lists:flatten(io_lib:format("mod_esi process failed with reason ~p", [Reason])), - httpd_util:error_log(ModData#mod.config_db, Error), - httpd_response:send_final_chunk(ModData, - [{"Warning", "199 inets server - body maybe incomplete, " - "internal server error"}], - IsDisableChunkedSend), - done + ?hdrv("handle_body - exit", [{reason, Reason}]), + httpd_response:send_final_chunk(ModData, IsDisableChunkedSend), + exit({mod_esi_linked_process_died, Pid, Reason}) + after Timeout -> - kill_esi_delivery_process(Pid), - httpd_response:send_final_chunk(ModData, [{"Warning", "199 inets server - " - "body maybe incomplete, timed out"}], - IsDisableChunkedSend), - done + ?hdrv("handle_body - timeout", []), + process_flag(trap_exit,false), + httpd_response:send_final_chunk(ModData, IsDisableChunkedSend), + exit({mod_esi_linked_process_timeout, Pid}) end. -kill_esi_delivery_process(Pid) -> - exit(Pid, kill), - receive - {'EXIT', Pid, killed} -> - %% Clean message queue - receive - {esi_data, _} -> - ok - after 0 -> - ok - end, - receive - {ok, _} -> - ok - after 0 -> - ok - end - end. - - erl_script_timeout(Db) -> httpd_util:lookup(Db, erl_script_timeout, ?DEFAULT_ERL_TIMEOUT). diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_get.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_get.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_get.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_get.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_head.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_head.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_head.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_head.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_htaccess.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_htaccess.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_htaccess.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_htaccess.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -35,7 +34,7 @@ % Names on accessfiles %---------------------------------------------------------------------- load("AccessFileName" ++ FileNames, _Context)-> - CleanFileNames=string:strip(FileNames), + CleanFileNames=httpd_conf:clean(FileNames), {ok,[],{access_files,string:tokens(CleanFileNames," ")}}. store({access_files, Files} = Conf, _) when is_list(Files)-> diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_include.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_include.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_include.erl 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_include.erl 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,598 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% +-module(mod_include). +-export([do/1,parse/2,config/6,include/6,echo/6,fsize/6,flastmod/6,exec/6]). + +-include("httpd.hrl"). +-include("httpd_internal.hrl"). + +-define(VMODULE,"INCLUDE"). + +%% do + +do(Info) -> + case Info#mod.method of + "GET" -> + case proplists:get_value(status, Info#mod.data) of + %% A status code has been generated! + {_StatusCode, _PhraseArgs, _Reason} -> + {proceed,Info#mod.data}; + %% No status code has been generated! + undefined -> + case proplists:get_value(response, Info#mod.data) of + %% No response has been generated! + undefined -> + do_include(Info); + %% A response has been generated or sent! + _Response -> + {proceed,Info#mod.data} + end + end; + %% Not a GET method! + _ -> + {proceed,Info#mod.data} + end. + +do_include(Info) -> + Path = mod_alias:path(Info#mod.data,Info#mod.config_db, + Info#mod.request_uri), + Suffix = httpd_util:suffix(Path), + case httpd_util:lookup_mime_default(Info#mod.config_db,Suffix) of + "text/x-server-parsed-html" -> + HeaderStart = [{content_type, "text/html"}], + case send_in(Info, Path, HeaderStart, file:read_file_info(Path)) of + {ok, ErrorLog, Size} -> + {proceed, [{response, {already_sent, 200, Size}}, + {mime_type, "text/html"} | + lists:append(ErrorLog, Info#mod.data)]}; + {error, Reason} -> + {proceed, + [{status,send_error(Reason,Info,Path)}|Info#mod.data]} + end; + _ -> %% Unknown mime type, ignore + {proceed,Info#mod.data} + end. + + +%% +%% config directive +%% + +config(_Info, Context, ErrorLog, TagList, ValueList, R) -> + case verify_tags("config",[errmsg,timefmt,sizefmt], + TagList,ValueList) of + ok -> + {ok,update_context(TagList,ValueList,Context),ErrorLog,"",R}; + {error,Reason} -> + {ok,Context,[{internal_info,Reason}|ErrorLog], + proplists:get_value(errmsg,Context,""),R} + end. + +update_context([],[],Context) -> + Context; +update_context([Tag|R1],[Value|R2],Context) -> + update_context(R1,R2,[{Tag,Value}|Context]). + +verify_tags(Command,ValidTags,TagList,ValueList) + when length(TagList) =:= length(ValueList) -> + verify_tags(Command, ValidTags, TagList); +verify_tags(Command, _ValidTags, _TagList, _ValueList) -> + {error, ?NICE(Command ++ " directive has spurious tags")}. + +verify_tags(_Command, _ValidTags, []) -> + ok; +verify_tags(Command, ValidTags, [Tag|Rest]) -> + case lists:member(Tag, ValidTags) of + true -> + verify_tags(Command, ValidTags, Rest); + false -> + {error, ?NICE(Command++" directive has a spurious tag ("++ + atom_to_list(Tag)++")")} + end. + +%% +%% include directive +%% + +include(Info,Context,ErrorLog,[virtual],[VirtualPath],R) -> + Aliases = httpd_util:multi_lookup(Info#mod.config_db,alias), + {_, Path, _AfterPath} = + mod_alias:real_name(Info#mod.config_db, VirtualPath, Aliases), + include(Info,Context,ErrorLog,R,Path); +include(Info, Context, ErrorLog, [file], [FileName], R) -> + Path = file(Info#mod.config_db, Info#mod.request_uri, FileName), + include(Info, Context, ErrorLog, R, Path); +include(_Info, Context, ErrorLog, _TagList, _ValueList, R) -> + {ok, Context, + [{internal_info,?NICE("include directive has a spurious tag")}| + ErrorLog], proplists:get_value(errmsg, Context, ""), R}. + +include(Info, Context, ErrorLog, R, Path) -> + case file:read_file(Path) of + {ok, Body} -> + {ok, NewContext, NewErrorLog, Result} = + parse(Info, binary_to_list(Body), Context, ErrorLog, []), + {ok, NewContext, NewErrorLog, Result, R}; + {error, _Reason} -> + {ok, Context, + [{internal_info, ?NICE("Can't open "++Path)}|ErrorLog], + proplists:get_value(errmsg, Context, ""), R} + end. + +file(ConfigDB, RequestURI, FileName) -> + Aliases = httpd_util:multi_lookup(ConfigDB, alias), + {_, Path, _AfterPath} + = mod_alias:real_name(ConfigDB, RequestURI, Aliases), + Pwd = filename:dirname(Path), + filename:join(Pwd, FileName). + +%% +%% echo directive +%% + +echo(Info,Context,ErrorLog,[var],["DOCUMENT_NAME"],R) -> + {ok,Context,ErrorLog,document_name(Info#mod.data,Info#mod.config_db, + Info#mod.request_uri),R}; +echo(Info,Context,ErrorLog,[var],["DOCUMENT_URI"],R) -> + {ok,Context,ErrorLog,document_uri(Info#mod.config_db, + Info#mod.request_uri),R}; +echo(Info,Context,ErrorLog,[var],["QUERY_STRING_UNESCAPED"],R) -> + {ok,Context,ErrorLog,query_string_unescaped(Info#mod.request_uri),R}; +echo(_Info,Context,ErrorLog,[var],["DATE_LOCAL"],R) -> + {ok,Context,ErrorLog,date_local(),R}; +echo(_Info,Context,ErrorLog,[var],["DATE_GMT"],R) -> + {ok,Context,ErrorLog,date_gmt(),R}; +echo(Info,Context,ErrorLog,[var],["LAST_MODIFIED"],R) -> + {ok,Context,ErrorLog,last_modified(Info#mod.data,Info#mod.config_db, + Info#mod.request_uri),R}; +echo(_Info, Context, ErrorLog, _TagList, _ValueList, R) -> + {ok,Context, + [{internal_info,?NICE("echo directive has a spurious tag")}| + ErrorLog],"(none)",R}. + +document_name(Data,ConfigDB,RequestURI) -> + Path = mod_alias:path(Data,ConfigDB,RequestURI), + case inets_regexp:match(Path,"[^/]*\$") of + {match,Start,Length} -> + string:substr(Path,Start,Length); + nomatch -> + "(none)" + end. + +document_uri(ConfigDB, RequestURI) -> + Aliases = httpd_util:multi_lookup(ConfigDB, alias), + + {_, Path, AfterPath} = mod_alias:real_name(ConfigDB, RequestURI, Aliases), + + VirtualPath = string:substr(RequestURI, 1, + length(RequestURI)-length(AfterPath)), + {match, Start, Length} = inets_regexp:match(Path,"[^/]*\$"), + FileName = string:substr(Path,Start,Length), + case inets_regexp:match(VirtualPath, FileName++"\$") of + {match, _, _} -> + http_uri:decode(VirtualPath)++AfterPath; + nomatch -> + string:strip(http_uri:decode(VirtualPath),right,$/)++ + "/"++FileName++AfterPath + end. + +query_string_unescaped(RequestURI) -> + case inets_regexp:match(RequestURI,"[\?].*\$") of + {match,Start,Length} -> + %% Escape all shell-special variables with \ + escape(string:substr(RequestURI,Start+1,Length-1)); + nomatch -> + "(none)" + end. + +escape([]) -> []; +escape([$;|R]) -> [$\\,$;|escape(R)]; +escape([$&|R]) -> [$\\,$&|escape(R)]; +escape([$(|R]) -> [$\\,$(|escape(R)]; +escape([$)|R]) -> [$\\,$)|escape(R)]; +escape([$||R]) -> [$\\,$||escape(R)]; +escape([$^|R]) -> [$\\,$^|escape(R)]; +escape([$<|R]) -> [$\\,$<|escape(R)]; +escape([$>|R]) -> [$\\,$>|escape(R)]; +escape([$\n|R]) -> [$\\,$\n|escape(R)]; +escape([$ |R]) -> [$\\,$ |escape(R)]; +escape([$\t|R]) -> [$\\,$\t|escape(R)]; +escape([C|R]) -> [C|escape(R)]. + +date_local() -> + {{Year,Month,Day},{Hour,Minute,Second}}=calendar:local_time(), + %% Time format hard-wired to: "%a %b %e %T %Y" according to strftime(3) + io_lib:format("~s ~s ~2w ~2.2.0w:~2.2.0w:~2.2.0w ~w", + [httpd_util:day(calendar:day_of_the_week(Year,Month,Day)), + httpd_util:month(Month),Day,Hour,Minute,Second,Year]). + +date_gmt() -> + {{Year,Month,Day},{Hour,Minute,Second}}=calendar:universal_time(), + %% Time format hard-wired to: "%a %b %e %T %Z %Y" according to strftime(3) + io_lib:format("~s ~s ~2w ~2.2.0w:~2.2.0w:~2.2.0w GMT ~w", + [httpd_util:day(calendar:day_of_the_week(Year,Month,Day)), + httpd_util:month(Month),Day,Hour,Minute,Second,Year]). + +last_modified(Data,ConfigDB,RequestURI) -> + {ok,FileInfo}=file:read_file_info(mod_alias:path(Data,ConfigDB,RequestURI)), + {{Year,Month,Day},{Hour,Minute,Second}}=FileInfo#file_info.mtime, + io_lib:format("~s ~s ~2w ~2.2.0w:~2.2.0w:~2.2.0w ~w", + [httpd_util:day(calendar:day_of_the_week(Year,Month,Day)), + httpd_util:month(Month),Day,Hour,Minute,Second,Year]). + +%% +%% fsize directive +%% + +fsize(Info,Context,ErrorLog,[virtual],[VirtualPath],R) -> + Aliases = httpd_util:multi_lookup(Info#mod.config_db,alias), + {_,Path, _AfterPath}= + mod_alias:real_name(Info#mod.config_db,VirtualPath,Aliases), + fsize(Info, Context, ErrorLog, R, Path); +fsize(Info,Context,ErrorLog,[file],[FileName],R) -> + Path = file(Info#mod.config_db,Info#mod.request_uri,FileName), + fsize(Info,Context,ErrorLog,R,Path); +fsize(_Info, Context, ErrorLog, _TagList, _ValueList, R) -> + {ok,Context,[{internal_info,?NICE("fsize directive has a spurious tag")}| + ErrorLog],proplists:get_value(errmsg,Context,""),R}. + +fsize(_Info, Context, ErrorLog, R, Path) -> + case file:read_file_info(Path) of + {ok,FileInfo} -> + case proplists:get_value(sizefmt,Context) of + "bytes" -> + {ok,Context,ErrorLog, + integer_to_list(FileInfo#file_info.size),R}; + "abbrev" -> + Size = integer_to_list(trunc(FileInfo#file_info.size/1024+1))++"k", + {ok,Context,ErrorLog,Size,R}; + Value-> + {ok,Context, + [{internal_info, + ?NICE("fsize directive has a spurious tag value ("++ + Value++")")}| + ErrorLog], + proplists:get_value(errmsg, Context, ""), R} + end; + {error, _Reason} -> + {ok,Context,[{internal_info,?NICE("Can't open "++Path)}|ErrorLog], + proplists:get_value(errmsg,Context,""),R} + end. + +%% +%% flastmod directive +%% + +flastmod(#mod{config_db = Db} = Info, + Context, ErrorLog, [virtual], [VirtualPath],R) -> + Aliases = httpd_util:multi_lookup(Db,alias), + {_,Path, _AfterPath} = mod_alias:real_name(Db, VirtualPath, Aliases), + flastmod(Info,Context,ErrorLog,R,Path); +flastmod(#mod{config_db = Db, request_uri = RequestUri} = Info, + Context, ErrorLog, [file], [FileName], R) -> + Path = file(Db, RequestUri, FileName), + flastmod(Info, Context, ErrorLog, R, Path); +flastmod(_Info, Context, ErrorLog, _TagList, _ValueList, R) -> + {ok,Context, + [{internal_info,?NICE("flastmod directive has a spurious tag")}| + ErrorLog],proplists:get_value(errmsg,Context,""),R}. + +flastmod(_Info, Context, ErrorLog, R, File) -> + case file:read_file_info(File) of + {ok, FileInfo} -> + {{Yr,Mon,Day},{Hour,Minute,Second}}=FileInfo#file_info.mtime, + Result = + io_lib:format("~s ~s ~2w ~w:~w:~w ~w", + [httpd_util:day( + calendar:day_of_the_week(Yr,Mon, Day)), + httpd_util:month(Mon),Day,Hour,Minute,Second, Yr]), + {ok, Context, ErrorLog, Result, R}; + {error, _Reason} -> + {ok,Context,[{internal_info,?NICE("Can't open "++File)}|ErrorLog], + proplists:get_value(errmsg,Context,""),R} + end. + +%% +%% exec directive +%% + +exec(Info,Context,ErrorLog,[cmd],[Command],R) -> + cmd(Info,Context,ErrorLog,R,Command); +exec(Info,Context,ErrorLog,[cgi],[RequestURI],R) -> + cgi(Info,Context,ErrorLog,R,RequestURI); +exec(_Info, Context, ErrorLog, _TagList, _ValueList, R) -> + {ok, Context, + [{internal_info,?NICE("exec directive has a spurious tag")}| + ErrorLog], proplists:get_value(errmsg,Context,""),R}. + +%% cmd + +cmd(Info, Context, ErrorLog, R, Command) -> + process_flag(trap_exit,true), + Env = env(Info), + Dir = filename:dirname(Command), + Port = (catch open_port({spawn,Command},[stream,{cd,Dir},{env,Env}])), + case Port of + P when is_port(P) -> + {NewErrorLog, Result} = proxy(Port, ErrorLog), + {ok, Context, NewErrorLog, Result, R}; + {'EXIT', Reason} -> + exit({open_port_failed,Reason, + [{uri,Info#mod.request_uri},{script,Command}, + {env,Env},{dir,Dir}]}); + O -> + exit({open_port_failed,O, + [{uri,Info#mod.request_uri},{script,Command}, + {env,Env},{dir,Dir}]}) + end. + +env(Info) -> + [{"DOCUMENT_NAME",document_name(Info#mod.data,Info#mod.config_db, + Info#mod.request_uri)}, + {"DOCUMENT_URI", document_uri(Info#mod.config_db, Info#mod.request_uri)}, + {"QUERY_STRING_UNESCAPED", query_string_unescaped(Info#mod.request_uri)}, + {"DATE_LOCAL", date_local()}, + {"DATE_GMT", date_gmt()}, + {"LAST_MODIFIED", last_modified(Info#mod.data, Info#mod.config_db, + Info#mod.request_uri)} + ]. + +%% cgi + +cgi(Info, Context, ErrorLog, R, RequestURI) -> + ScriptAliases = httpd_util:multi_lookup(Info#mod.config_db, script_alias), + case mod_alias:real_script_name(Info#mod.config_db, RequestURI, + ScriptAliases) of + {Script, AfterScript} -> + exec_script(Info,Script,AfterScript,ErrorLog,Context,R); + not_a_script -> + {ok, Context, + [{internal_info, ?NICE(RequestURI++" is not a script")}| + ErrorLog], proplists:get_value(errmsg, Context, ""),R} + end. + +remove_header([]) -> + []; +remove_header([$\n,$\n|Rest]) -> + Rest; +remove_header([_C|Rest]) -> + remove_header(Rest). + + +exec_script(#mod{config_db = Db, request_uri = RequestUri} = Info, + Script, _AfterScript, ErrorLog, Context, R) -> + process_flag(trap_exit,true), + Aliases = httpd_util:multi_lookup(Db, alias), + {_, Path, AfterPath} = mod_alias:real_name(Db, RequestUri, Aliases), + Env = env(Info) ++ mod_cgi:env(Info, Path, AfterPath), + Dir = filename:dirname(Path), + Port = (catch open_port({spawn,Script},[stream,{env, Env},{cd, Dir}])), + case Port of + P when is_port(P) -> + %% Send entity body to port. + Res = case Info#mod.entity_body of + [] -> + true; + EntityBody -> + (catch port_command(Port, EntityBody)) + end, + case Res of + {'EXIT', Reason} -> + exit({open_cmd_failed,Reason, + [{mod,?MODULE},{port,Port}, + {uri,RequestUri}, + {script,Script},{env,Env},{dir,Dir}, + {ebody_size,sz(Info#mod.entity_body)}]}); + true -> + {NewErrorLog, Result} = proxy(Port, ErrorLog), + {ok, Context, NewErrorLog, remove_header(Result), R} + end; + {'EXIT', Reason} -> + exit({open_port_failed,Reason, + [{mod,?MODULE},{uri,RequestUri},{script,Script}, + {env,Env},{dir,Dir}]}); + O -> + exit({open_port_failed,O, + [{mod,?MODULE},{uri,RequestUri},{script,Script}, + {env,Env},{dir,Dir}]}) + end. + + +%% +%% Port communication +%% + +proxy(Port, ErrorLog) -> + process_flag(trap_exit, true), + proxy(Port, ErrorLog, []). + +proxy(Port, ErrorLog, Result) -> + receive + {Port, {data, Response}} -> + proxy(Port, ErrorLog, lists:append(Result,Response)); + {'EXIT', Port, normal} when is_port(Port) -> + process_flag(trap_exit, false), + {ErrorLog, Result}; + {'EXIT', Port, _Reason} when is_port(Port) -> + process_flag(trap_exit, false), + {[{internal_info, + ?NICE("Scrambled output from CGI-script")}|ErrorLog], + Result}; + {'EXIT', Pid, Reason} when is_pid(Pid) -> + process_flag(trap_exit, false), + {'EXIT', Pid, Reason}; + %% This should not happen! + _WhatEver -> + process_flag(trap_exit, false), + {ErrorLog, Result} + end. + + +%% ------ +%% Temporary until I figure out a way to fix send_in_chunks +%% (comments and directives that start in one chunk but end +%% in another is not handled). +%% + +send_in(Info, Path, Head, {ok,FileInfo}) -> + case file:read_file(Path) of + {ok, Bin} -> + send_in1(Info, binary_to_list(Bin), Head, FileInfo); + {error, Reason} -> + {error, {read,Reason}} + end; +send_in(_Info , _Path, _Head,{error,Reason}) -> + {error, {open,Reason}}. + +send_in1(Info, Data, Head, FileInfo) -> + {ok, _Context, Err, ParsedBody} = parse(Info,Data,?DEFAULT_CONTEXT,[],[]), + Size = length(ParsedBody), + LastModified = case catch httpd_util:rfc1123_date(FileInfo#file_info.mtime) of + Date when is_list(Date) -> [{last_modified,Date}]; + _ -> [] + end, + Head1 = case Info#mod.http_version of + "HTTP/1.1"-> + Head ++ [{content_length, integer_to_list(Size)}, + {etag, httpd_util:create_etag(FileInfo,Size)}| + LastModified]; + _-> + %% i.e http/1.0 and http/0.9 + Head ++ [{content_length, integer_to_list(Size)}| + LastModified] + end, + httpd_response:send_header(Info, 200, Head1), + httpd_socket:deliver(Info#mod.socket_type,Info#mod.socket, ParsedBody), + {ok, Err, Size}. + + +parse(Info,Body) -> + parse(Info, Body, ?DEFAULT_CONTEXT, [], []). + +parse(_Info, [], Context, ErrorLog, Result) -> + {ok, Context, lists:reverse(ErrorLog), lists:reverse(Result)}; +parse(Info,[$<,$!,$-,$-,$#|R1],Context,ErrorLog,Result) -> + case catch parse0(R1,Context) of + {parse_error,Reason} -> + parse(Info,R1,Context,[{internal_info,?NICE(Reason)}|ErrorLog], + [$#,$-,$-,$!,$<|Result]); + {ok,Context,Command,TagList,ValueList,R2} -> + {ok,NewContext,NewErrorLog,MoreResult,R3}= + handle(Info,Context,ErrorLog,Command,TagList,ValueList,R2), + parse(Info,R3,NewContext,NewErrorLog, + lists:reverse(MoreResult)++Result) + end; +parse(Info,[$<,$!,$-,$-|R1],Context,ErrorLog,Result) -> + case catch parse5(R1,[],0) of + {parse_error,Reason} -> + parse(Info,R1,Context, + [{internal_info,?NICE(Reason)}|ErrorLog],Result); + {Comment,R2} -> + parse(Info,R2,Context,ErrorLog,Comment++Result) + end; +parse(Info,[C|R],Context,ErrorLog,Result) -> + parse(Info,R,Context,ErrorLog,[C|Result]). + +handle(Info,Context,ErrorLog,Command,TagList,ValueList,R) -> + case catch apply(?MODULE,Command,[Info,Context,ErrorLog,TagList,ValueList, + R]) of + {'EXIT',{undef,_}} -> + throw({parse_error,"Unknown command "++atom_to_list(Command)++ + " in parsed doc"}); + Result -> + Result + end. + +parse0([], _Context) -> + throw({parse_error,"Premature EOF in parsed file"}); +parse0([$-,$-,$>|_R], _Context) -> + throw({parse_error,"Premature EOF in parsed file"}); +parse0([$ |R], Context) -> + parse0(R,Context); +parse0(String, Context) -> + parse1(String, Context,""). + +parse1([], _Context, _Command) -> + throw({parse_error,"Premature EOF in parsed file"}); +parse1([$-,$-,$>|_R], _Context, _Command) -> + throw({parse_error,"Premature EOF in parsed file"}); +parse1([$ |R], Context, Command) -> + parse2(R,Context,list_to_atom(lists:reverse(Command)),[],[],""); +parse1([C|R], Context, Command) -> + parse1(R,Context,[C|Command]). + +parse2([], _Context, _Command, _TagList, _ValueList, _Tag) -> + throw({parse_error,"Premature EOF in parsed file"}); +parse2([$-,$-,$>|R], Context, Command, TagList, ValueList, _Tag) -> + {ok,Context,Command,TagList,ValueList,R}; +parse2([$ |R],Context,Command,TagList,ValueList,Tag) -> + parse2(R,Context,Command,TagList,ValueList,Tag); +parse2([$=|R],Context,Command,TagList,ValueList,Tag) -> + parse3(R,Context,Command,[list_to_atom(lists:reverse(Tag))|TagList], + ValueList); +parse2([C|R],Context,Command,TagList,ValueList,Tag) -> + parse2(R,Context,Command,TagList,ValueList,[C|Tag]). + +parse3([], _Context, _Command, _TagList, _ValueList) -> + throw({parse_error,"Premature EOF in parsed file"}); +parse3([$-,$-,$>|_R], _Context, _Command, _TagList, _ValueList) -> + throw({parse_error,"Premature EOF in parsed file"}); +parse3([$ |R], Context, Command, TagList, ValueList) -> + parse3(R, Context, Command, TagList, ValueList); +parse3([$"|R], Context, Command, TagList, ValueList) -> + parse4(R,Context,Command,TagList,ValueList,""); +parse3(_String, _Context, _Command, _TagList, _ValueList) -> + throw({parse_error,"Premature EOF in parsed file"}). + +parse4([], _Context, _Command, _TagList, _ValueList, _Value) -> + throw({parse_error,"Premature EOF in parsed file"}); +parse4([$-,$-,$>|_R], _Context, _Command, _TagList, _ValueList, _Value) -> + throw({parse_error,"Premature EOF in parsed file"}); +parse4([$"|R],Context,Command,TagList,ValueList,Value) -> + parse2(R,Context,Command,TagList,[lists:reverse(Value)|ValueList],""); +parse4([C|R],Context,Command,TagList,ValueList,Value) -> + parse4(R,Context,Command,TagList,ValueList,[C|Value]). + +parse5([], _Comment, _Depth) -> + throw({parse_error,"Premature EOF in parsed file"}); +parse5([$<,$!,$-,$-|R],Comment,Depth) -> + parse5(R,[$-,$-,$!,$<|Comment],Depth+1); +parse5([$-,$-,$>|R],Comment,0) -> + {">--"++Comment++"--!<",R}; +parse5([$-,$-,$>|R],Comment,Depth) -> + parse5(R,[$>,$-,$-|Comment],Depth-1); +parse5([C|R],Comment,Depth) -> + parse5(R,[C|Comment],Depth). + + +sz(B) when is_binary(B) -> {binary,size(B)}; +sz(L) when is_list(L) -> {list,length(L)}; +sz(_) -> undefined. + +%% send_error - Handle failure to send the file +%% +send_error({open,Reason},Info,Path) -> + httpd_file:handle_error(Reason, "open", Info, Path); +send_error({read,Reason},Info,Path) -> + httpd_file:handle_error(Reason, "read", Info, Path). + + + + diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_log.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_log.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_log.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_log.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -128,11 +127,11 @@ %% Description: See httpd(3) ESWAPI CALLBACK FUNCTIONS %%------------------------------------------------------------------------- load("TransferLog " ++ TransferLog, []) -> - {ok,[],{transfer_log,string:strip(TransferLog)}}; + {ok,[],{transfer_log,httpd_conf:clean(TransferLog)}}; load("ErrorLog " ++ ErrorLog, []) -> - {ok,[],{error_log,string:strip(ErrorLog)}}; + {ok,[],{error_log,httpd_conf:clean(ErrorLog)}}; load("SecurityLog " ++ SecurityLog, []) -> - {ok, [], {security_log, string:strip(SecurityLog)}}. + {ok, [], {security_log, httpd_conf:clean(SecurityLog)}}. %%-------------------------------------------------------------------------- %% store(Directive, DirectiveList) -> {ok, NewDirective} | @@ -201,7 +200,7 @@ end. create_log(LogFile, ConfigList) -> - Filename = string:strip(LogFile), + Filename = httpd_conf:clean(LogFile), case filename:pathtype(Filename) of absolute -> case file:open(Filename, [read, write]) of diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_range.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_range.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_range.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_range.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_responsecontrol.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_responsecontrol.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_responsecontrol.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_responsecontrol.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_security.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_security.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_security.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_security.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,13 +32,14 @@ -include("httpd.hrl"). -include("httpd_internal.hrl"). +-include("inets_internal.hrl"). -define(VMODULE,"SEC"). -%%==================================================================== -%% Internal application API -%%==================================================================== + +%% do/1 do(Info) -> + ?hdrt("do", [{info, Info}]), %% Check and see if any user has been authorized. case proplists:get_value(remote_user, Info#mod.data,not_defined_user) of not_defined_user -> @@ -84,66 +84,151 @@ {_Dir, SDirData} = secretp(Path, Info#mod.config_db), Addr = httpd_util:lookup(Info#mod.config_db, bind_address), Port = httpd_util:lookup(Info#mod.config_db, port), - Profile = httpd_util:lookup(Info#mod.config_db, profile, ?DEFAULT_PROFILE), case mod_security_server:check_blocked_user(Info, User, SDirData, - Addr, Port, Profile) of + Addr, Port) of true -> report_failed(Info, User ,"User Blocked"), {proceed, [{status, {403, Info#mod.request_uri, ""}} | Info#mod.data]}; false -> report_failed(Info, User,"Authentication Succedded"), - mod_security_server:store_successful_auth(Addr, Port, Profile, + mod_security_server:store_successful_auth(Addr, Port, User, SDirData), {proceed, Info#mod.data} end end. +report_failed(Info, Auth, Event) -> + Request = Info#mod.request_line, + {_PortNumber,RemoteHost}=(Info#mod.init_data)#init_data.peername, + String = RemoteHost ++ " : " ++ Event ++ " : " ++ Request ++ + " : " ++ Auth, + mod_disk_log:security_log(Info,String), + mod_log:security_log(Info, String). + +take_failed_action(Info, Auth) -> + ?hdrd("take failed action", [{auth, Auth}]), + Path = mod_alias:path(Info#mod.data, Info#mod.config_db, + Info#mod.request_uri), + {_Dir, SDirData} = secretp(Path, Info#mod.config_db), + Addr = httpd_util:lookup(Info#mod.config_db, bind_address), + Port = httpd_util:lookup(Info#mod.config_db, port), + mod_security_server:store_failed_auth(Info, Addr, Port, + Auth, SDirData). + +secretp(Path, ConfigDB) -> + Directories = ets:match(ConfigDB,{directory,{'$1','_'}}), + case secret_path(Path, Directories) of + {yes, Directory} -> + ?hdrd("secretp - yes", [{dir, Directory}]), + SDirs0 = httpd_util:multi_lookup(ConfigDB, security_directory), + [SDir] = lists:filter(fun({Directory0, _}) + when Directory0 == Directory -> + true; + (_) -> + false + end, SDirs0), + SDir; + no -> + {[], []} + end. + +secret_path(Path,Directories) -> + secret_path(Path, httpd_util:uniq(lists:sort(Directories)), to_be_found). + +secret_path(_Path, [], to_be_found) -> + no; +secret_path(_Path, [], Dir) -> + {yes, Dir}; +secret_path(Path, [[NewDir]|Rest], Dir) -> + case inets_regexp:match(Path, NewDir) of + {match, _, _} when Dir =:= to_be_found -> + secret_path(Path, Rest, NewDir); + {match, _, Length} when Length > length(Dir) -> + secret_path(Path, Rest, NewDir); + {match, _, _} -> + secret_path(Path, Rest, Dir); + nomatch -> + secret_path(Path, Rest, Dir) + end. + + load(" - Dir = string:strip(string:strip(Directory),right, $>), + ?hdrt("load security directory - begin", [{directory, Directory}]), + Dir = httpd_conf:custom_clean(Directory,"",">"), {ok, [{security_directory, {Dir, [{path, Dir}]}}]}; load(eof,[{security_directory, {Directory, _DirData}}|_]) -> {error, ?NICE("Premature end-of-file in "++Directory)}; load("SecurityDataFile " ++ FileName, [{security_directory, {Dir, DirData}}]) -> - File = string:strip(FileName), + ?hdrt("load security directory", + [{file, FileName}, {dir, Dir}, {dir_data, DirData}]), + File = httpd_conf:clean(FileName), {ok, [{security_directory, {Dir, [{data_file, File}|DirData]}}]}; load("SecurityCallbackModule " ++ ModuleName, [{security_directory, {Dir, DirData}}]) -> - Mod = list_to_atom(string:strip(ModuleName)), + ?hdrt("load security directory", + [{module, ModuleName}, {dir, Dir}, {dir_data, DirData}]), + Mod = list_to_atom(httpd_conf:clean(ModuleName)), {ok, [{security_directory, {Dir, [{callback_module, Mod}|DirData]}}]}; load("SecurityMaxRetries " ++ Retries, [{security_directory, {Dir, DirData}}]) -> + ?hdrt("load security directory", + [{max_retries, Retries}, {dir, Dir}, {dir_data, DirData}]), load_return_int_tag("SecurityMaxRetries", max_retries, - string:strip(Retries), Dir, DirData); + httpd_conf:clean(Retries), Dir, DirData); load("SecurityBlockTime " ++ Time, [{security_directory, {Dir, DirData}}]) -> + ?hdrt("load security directory", + [{block_time, Time}, {dir, Dir}, {dir_data, DirData}]), load_return_int_tag("SecurityBlockTime", block_time, - string:strip(Time), Dir, DirData); + httpd_conf:clean(Time), Dir, DirData); load("SecurityFailExpireTime " ++ Time, [{security_directory, {Dir, DirData}}]) -> + ?hdrt("load security directory", + [{expire_time, Time}, {dir, Dir}, {dir_data, DirData}]), load_return_int_tag("SecurityFailExpireTime", fail_expire_time, - string:strip(Time), Dir, DirData); + httpd_conf:clean(Time), Dir, DirData); load("SecurityAuthTimeout " ++ Time0, [{security_directory, {Dir, DirData}}]) -> - Time = string:strip(Time0), + ?hdrt("load security directory", + [{auth_timeout, Time0}, {dir, Dir}, {dir_data, DirData}]), + Time = httpd_conf:clean(Time0), load_return_int_tag("SecurityAuthTimeout", auth_timeout, - string:strip(Time), Dir, DirData); + httpd_conf:clean(Time), Dir, DirData); load("AuthName " ++ Name0, [{security_directory, {Dir, DirData}}]) -> - Name = string:strip(Name0), + ?hdrt("load security directory", + [{name, Name0}, {dir, Dir}, {dir_data, DirData}]), + Name = httpd_conf:clean(Name0), {ok, [{security_directory, {Dir, [{auth_name, Name}|DirData]}}]}; load("",[{security_directory, {Dir, DirData}}]) -> + ?hdrt("load security directory - end", + [{dir, Dir}, {dir_data, DirData}]), {ok, [], {security_directory, {Dir, DirData}}}. +load_return_int_tag(Name, Atom, Time, Dir, DirData) -> + case Time of + "infinity" -> + {ok, [{security_directory, {Dir, + [{Atom, 99999999999999999999999999999} | DirData]}}]}; + _Int -> + case catch list_to_integer(Time) of + {'EXIT', _} -> + {error, Time++" is an invalid "++Name}; + Val -> + {ok, [{security_directory, {Dir, [{Atom, Val}|DirData]}}]} + end + end. + store({security_directory, {Dir, DirData}}, ConfigList) when is_list(Dir) andalso is_list(DirData) -> + ?hdrt("store security directory", [{dir, Dir}, {dir_data, DirData}]), Addr = proplists:get_value(bind_address, ConfigList), Port = proplists:get_value(port, ConfigList), - Profile = proplists:get_value(profile, ConfigList, ?DEFAULT_PROFILE), - mod_security_server:start(Addr, Port, Profile), + mod_security_server:start(Addr, Port), SR = proplists:get_value(server_root, ConfigList), case proplists:get_value(data_file, DirData, no_data_file) of no_data_file -> @@ -156,7 +241,7 @@ _ -> DataFile0 end, - case mod_security_server:new_table(Addr, Port, Profile, DataFile) of + case mod_security_server:new_table(Addr, Port, DataFile) of {ok, TwoTables} -> NewDirData0 = lists:keyreplace(data_file, 1, DirData, {data_file, TwoTables}), @@ -176,35 +261,45 @@ {error, {wrong_type, {security_directory, {Directory, DirData}}}}. remove(ConfigDB) -> - Addr = httpd_util:lookup(ConfigDB, bind_address, undefined), - Port = httpd_util:lookup(ConfigDB, port), - Profile = httpd_util:lookup(ConfigDB, profile, ?DEFAULT_PROFILE), - mod_security_server:delete_tables(Addr, Port, Profile), - mod_security_server:stop(Addr, Port, Profile). + Addr = case ets:lookup(ConfigDB, bind_address) of + [] -> + undefined; + [{bind_address, Address}] -> + Address + end, + [{port, Port}] = ets:lookup(ConfigDB, port), + mod_security_server:delete_tables(Addr, Port), + mod_security_server:stop(Addr, Port). +%% +%% User API +%% + +%% list_blocked_users + list_blocked_users(Port) -> list_blocked_users(undefined, Port). list_blocked_users(Port, Dir) when is_integer(Port) -> list_blocked_users(undefined,Port,Dir); list_blocked_users(Addr, Port) when is_integer(Port) -> - lists:map(fun({User, Addr0, Port0, ?DEFAULT_PROFILE, Dir0, Time}) -> - {User, Addr0, Port0, Dir0,Time} - end, - mod_security_server:list_blocked_users(Addr, Port)). + mod_security_server:list_blocked_users(Addr, Port). list_blocked_users(Addr, Port, Dir) -> - lists:map(fun({User, Addr0, Port0, ?DEFAULT_PROFILE, Dir0, Time}) -> - {User, Addr0, Port0, Dir0,Time} - end, - mod_security_server:list_blocked_users(Addr, Port, Dir)). + mod_security_server:list_blocked_users(Addr, Port, Dir). + + +%% block_user block_user(User, Port, Dir, Time) -> block_user(User, undefined, Port, Dir, Time). block_user(User, Addr, Port, Dir, Time) -> mod_security_server:block_user(User, Addr, Port, Dir, Time). + +%% unblock_user + unblock_user(User, Port) -> unblock_user(User, undefined, Port). @@ -216,6 +311,9 @@ unblock_user(User, Addr, Port, Dir) -> mod_security_server:unblock_user(User, Addr, Port, Dir). + +%% list_auth_users + list_auth_users(Port) -> list_auth_users(undefined,Port). @@ -226,76 +324,3 @@ list_auth_users(Addr, Port, Dir) -> mod_security_server:list_auth_users(Addr, Port, Dir). - -%%-------------------------------------------------------------------- -%%% Internal functions -%%-------------------------------------------------------------------- - -report_failed(Info, Auth, Event) -> - Request = Info#mod.request_line, - {_PortNumber,RemoteHost}=(Info#mod.init_data)#init_data.peername, - String = RemoteHost ++ " : " ++ Event ++ " : " ++ Request ++ - " : " ++ Auth, - mod_disk_log:security_log(Info,String), - mod_log:security_log(Info, String). - -take_failed_action(Info, Auth) -> - Path = mod_alias:path(Info#mod.data, Info#mod.config_db, - Info#mod.request_uri), - {_Dir, SDirData} = secretp(Path, Info#mod.config_db), - Addr = httpd_util:lookup(Info#mod.config_db, bind_address), - Port = httpd_util:lookup(Info#mod.config_db, port), - Profile = httpd_util:lookup(Info#mod.config_db, profile, ?DEFAULT_PROFILE), - mod_security_server:store_failed_auth(Info, Addr, Port, Profile, - Auth, SDirData). - -secretp(Path, ConfigDB) -> - Directories = ets:match(ConfigDB,{directory,{'$1','_'}}), - case secret_path(Path, Directories) of - {yes, Directory} -> - SDirs0 = httpd_util:multi_lookup(ConfigDB, security_directory), - [SDir] = lists:filter(fun({Directory0, _}) - when Directory0 == Directory -> - true; - (_) -> - false - end, SDirs0), - SDir; - no -> - {[], []} - end. - -secret_path(Path,Directories) -> - secret_path(Path, httpd_util:uniq(lists:sort(Directories)), to_be_found). - -secret_path(_Path, [], to_be_found) -> - no; -secret_path(_Path, [], Dir) -> - {yes, Dir}; -secret_path(Path, [[NewDir]|Rest], Dir) -> - case inets_regexp:match(Path, NewDir) of - {match, _, _} when Dir =:= to_be_found -> - secret_path(Path, Rest, NewDir); - {match, _, Length} when Length > length(Dir) -> - secret_path(Path, Rest, NewDir); - {match, _, _} -> - secret_path(Path, Rest, Dir); - nomatch -> - secret_path(Path, Rest, Dir) - end. - - - -load_return_int_tag(Name, Atom, Time, Dir, DirData) -> - case Time of - "infinity" -> - {ok, [{security_directory, {Dir, - [{Atom, 99999999999999999999999999999} | DirData]}}]}; - _Int -> - case catch list_to_integer(Time) of - {'EXIT', _} -> - {error, Time++" is an invalid "++Name}; - Val -> - {ok, [{security_directory, {Dir, [{Atom, Val}|DirData]}}]} - end - end. diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_security_server.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_security_server.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_security_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_security_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -46,6 +45,7 @@ -include("httpd.hrl"). -include("httpd_internal.hrl"). +-include("inets_internal.hrl"). -behaviour(gen_server). @@ -57,105 +57,129 @@ list_auth_users/2, list_auth_users/3]). %% Internal exports (for mod_security only) --export([start/3, stop/2, stop/3, - new_table/4, delete_tables/3, - store_failed_auth/6, store_successful_auth/5, - check_blocked_user/6]). +-export([start/2, stop/1, stop/2, + new_table/3, delete_tables/2, + store_failed_auth/5, store_successful_auth/4, + check_blocked_user/5]). %% gen_server exports --export([start_link/3, init/1, +-export([start_link/2, init/1, handle_info/2, handle_call/3, handle_cast/2, terminate/2, code_change/3]). -%%==================================================================== -%% Internal application API -%%==================================================================== +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% External API %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% start_link/3 +%% %% NOTE: This is called by httpd_misc_sup when the process is started -start_link(Addr, Port, Profile) -> - Name = make_name(Addr, Port, Profile), +%% + +start_link(Addr, Port) -> + ?hdrt("start_link", [{address, Addr}, {port, Port}]), + Name = make_name(Addr, Port), gen_server:start_link({local, Name}, ?MODULE, [], [{timeout, infinity}]). + +%% start/2 %% Called by the mod_security module. -start(Addr, Port, Profile) -> - Name = make_name(Addr, Port, Profile), + +start(Addr, Port) -> + ?hdrt("start", [{address, Addr}, {port, Port}]), + Name = make_name(Addr, Port), case whereis(Name) of undefined -> - httpd_misc_sup:start_sec_server(Addr, Port, Profile); + httpd_misc_sup:start_sec_server(Addr, Port); _ -> %% Already started... ok end. -stop(Port, Profile) -> - stop(undefined, Port, Profile). -stop(Addr, Port, Profile) -> - Name = make_name(Addr, Port, Profile), + +%% stop + +stop(Port) -> + stop(undefined, Port). +stop(Addr, Port) -> + ?hdrt("stop", [{address, Addr}, {port, Port}]), + Name = make_name(Addr, Port), case whereis(Name) of undefined -> ok; _ -> - httpd_misc_sup:stop_sec_server(Addr, Port, Profile) + httpd_misc_sup:stop_sec_server(Addr, Port) end. + addr(undefined) -> any; addr(Addr) -> Addr. + +%% list_blocked_users + list_blocked_users(Addr, Port) -> - list_blocked_users(Addr, Port, ?DEFAULT_PROFILE). -list_blocked_users(Addr, Port, Profile) when is_atom(Profile)-> - Name = make_name(Addr, Port, Profile), - Req = {list_blocked_users, addr(Addr), Port, Profile,'_'}, - call(Name, Req); + Name = make_name(Addr, Port), + Req = {list_blocked_users, addr(Addr), Port, '_'}, + call(Name, Req). + list_blocked_users(Addr, Port, Dir) -> - list_blocked_users(Addr, Port, ?DEFAULT_PROFILE, Dir). -list_blocked_users(Addr, Port, Profile, Dir) -> - Name = make_name(Addr, Port, Profile), - Req = {list_blocked_users, addr(Addr), Port, Profile, Dir}, + Name = make_name(Addr, Port), + Req = {list_blocked_users, addr(Addr), Port, Dir}, call(Name, Req). + +%% block_user + block_user(User, Addr, Port, Dir, Time) -> - block_user(User, Addr, Port, ?DEFAULT_PROFILE, Dir, Time). -block_user(User, Addr, Port, Profile, Dir, Time) -> - Name = make_name(Addr, Port, Profile), - Req = {block_user, User, addr(Addr), Port, Profile, Dir, Time}, + Name = make_name(Addr, Port), + Req = {block_user, User, addr(Addr), Port, Dir, Time}, call(Name, Req). + +%% unblock_user + unblock_user(User, Addr, Port) -> - unblock_user(User, Addr, Port, ?DEFAULT_PROFILE). -unblock_user(User, Addr, Port, Profile) when is_atom(Profile)-> - Name = make_name(Addr, Port, Profile), - Req = {unblock_user, User, addr(Addr), Port, Profile, '_'}, - call(Name, Req); + Name = make_name(Addr, Port), + Req = {unblock_user, User, addr(Addr), Port, '_'}, + call(Name, Req). + unblock_user(User, Addr, Port, Dir) -> - unblock_user(User, Addr, Port, ?DEFAULT_PROFILE, Dir). -unblock_user(User, Addr, Port, Profile, Dir) -> - Name = make_name(Addr, Port, Profile), - Req = {unblock_user, User, addr(Addr), Port, Profile, Dir}, + Name = make_name(Addr, Port), + Req = {unblock_user, User, addr(Addr), Port, Dir}, call(Name, Req). + +%% list_auth_users + list_auth_users(Addr, Port) -> - list_auth_users(Addr, Port, ?DEFAULT_PROFILE). -list_auth_users(Addr, Port, Profile) when is_atom(Profile) -> - Name = make_name(Addr, Port, Profile), - Req = {list_auth_users, addr(Addr), Port, Profile, '_'}, - call(Name, Req); + Name = make_name(Addr, Port), + Req = {list_auth_users, addr(Addr), Port, '_'}, + call(Name, Req). + list_auth_users(Addr, Port, Dir) -> - list_auth_users(Addr, Port, ?DEFAULT_PROFILE, Dir). -list_auth_users(Addr, Port, Profile, Dir) -> - Name = make_name(Addr,Port, Profile), - Req = {list_auth_users, addr(Addr), Port, Profile, Dir}, + Name = make_name(Addr,Port), + Req = {list_auth_users, addr(Addr), Port, Dir}, call(Name, Req). + + +%% new_table -new_table(Addr, Port, Profile, TabName) -> - Name = make_name(Addr,Port, Profile), - Req = {new_table, addr(Addr), Port, Profile, TabName}, +new_table(Addr, Port, TabName) -> + Name = make_name(Addr,Port), + Req = {new_table, addr(Addr), Port, TabName}, call(Name, Req). -delete_tables(Addr, Port, Profile) -> - Name = make_name(Addr, Port, Profile), + +%% delete_tables + +delete_tables(Addr, Port) -> + Name = make_name(Addr, Port), case whereis(Name) of undefined -> ok; @@ -163,53 +187,79 @@ call(Name, delete_tables) end. -store_failed_auth(Info, Addr, Port, Profile, DecodedString, SDirData) -> - Name = make_name(Addr, Port, Profile), - Msg = {store_failed_auth, Profile, [Info,DecodedString,SDirData]}, + +%% store_failed_auth + +store_failed_auth(Info, Addr, Port, DecodedString, SDirData) -> + ?hdrv("store failed auth", + [{addr, Addr}, {port, Port}, + {decoded_string, DecodedString}, {sdir_data, SDirData}]), + Name = make_name(Addr,Port), + Msg = {store_failed_auth,[Info,DecodedString,SDirData]}, cast(Name, Msg). -store_successful_auth(Addr, Port, Profile, User, SDirData) -> - Name = make_name(Addr,Port, Profile), - Msg = {store_successful_auth, [User,Addr,Port, Profile, SDirData]}, + +%% store_successful_auth + +store_successful_auth(Addr, Port, User, SDirData) -> + Name = make_name(Addr,Port), + Msg = {store_successful_auth, [User,Addr,Port,SDirData]}, cast(Name, Msg). - -check_blocked_user(Info, User, SDirData, Addr, Port, Profile) -> - Name = make_name(Addr, Port, Profile), - Req = {check_blocked_user, Profile, [Info, User, SDirData]}, + + +%% check_blocked_user + +check_blocked_user(Info, User, SDirData, Addr, Port) -> + Name = make_name(Addr, Port), + Req = {check_blocked_user, [Info, User, SDirData]}, call(Name, Req). -%%==================================================================== -%% Behavior call backs -%%==================================================================== + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% Server call-back functions %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + init(_) -> + ?hdrv("initiating", []), process_flag(trap_exit, true), {ok, []}. handle_call(stop, _From, _Tables) -> {stop, normal, ok, []}; -handle_call({block_user, User, Addr, Port, Profile, Dir, Time}, _From, Tables) -> - Ret = block_user_int(User, Addr, Port, Profile, Dir, Time), +handle_call({block_user, User, Addr, Port, Dir, Time}, _From, Tables) -> + ?hdrv("block user", + [{user, User}, {addr, Addr}, {port, Port}, {dir, Dir}, + {time, Time}]), + Ret = block_user_int(User, Addr, Port, Dir, Time), {reply, Ret, Tables}; -handle_call({list_blocked_users, Addr, Port, Profile, Dir}, _From, Tables) -> - Blocked = list_blocked(Tables, Addr, Port, Profile, Dir, []), +handle_call({list_blocked_users, Addr, Port, Dir}, _From, Tables) -> + ?hdrv("list blocked users", + [{addr, Addr}, {port, Port}, {dir, Dir}]), + Blocked = list_blocked(Tables, Addr, Port, Dir, []), {reply, Blocked, Tables}; -handle_call({unblock_user, User, Addr, Port, Profile, Dir}, _From, Tables) -> - Ret = unblock_user_int(User, Addr, Port, Profile,Dir), +handle_call({unblock_user, User, Addr, Port, Dir}, _From, Tables) -> + ?hdrv("block user", + [{user, User}, {addr, Addr}, {port, Port}, {dir, Dir}]), + Ret = unblock_user_int(User, Addr, Port, Dir), {reply, Ret, Tables}; -handle_call({list_auth_users, Addr, Port, Profile, Dir}, _From, Tables) -> - Auth = list_auth(Tables, Addr, Port, Profile, Dir, []), +handle_call({list_auth_users, Addr, Port, Dir}, _From, Tables) -> + ?hdrv("list auth users", + [{addr, Addr}, {port, Port}, {dir, Dir}]), + Auth = list_auth(Tables, Addr, Port, Dir, []), {reply, Auth, Tables}; -handle_call({new_table, Addr, Port, Profile, Name}, _From, Tables) -> +handle_call({new_table, Addr, Port, Name}, _From, Tables) -> case lists:keysearch(Name, 1, Tables) of {value, {Name, {Ets, Dets}}} -> {reply, {ok, {Ets, Dets}}, Tables}; false -> - TName = make_name(Addr,Port, Profile, length(Tables)), + TName = make_name(Addr,Port,length(Tables)), case dets:open_file(TName, [{type, bag}, {file, Name}, {repair, true}, {access, read_write}]) of @@ -230,7 +280,7 @@ end, Tables), {reply, ok, []}; -handle_call({check_blocked_user, Profile, [Info, User, SDirData]}, _From, Tables) -> +handle_call({check_blocked_user, [Info, User, SDirData]}, _From, Tables) -> {ETS, DETS} = proplists:get_value(data_file, SDirData), Dir = proplists:get_value(path, SDirData), Addr = proplists:get_value(bind_address, SDirData), @@ -238,24 +288,27 @@ CBModule = proplists:get_value(callback_module, SDirData, no_module_at_all), Ret = - check_blocked_user(Info, User, Dir, Addr, Port, Profile, ETS, DETS, CBModule), + check_blocked_user(Info, User, Dir, Addr, Port, ETS, DETS, CBModule), {reply, Ret, Tables}; handle_call(_Request,_From,Tables) -> {reply,ok,Tables}. -handle_cast({store_failed_auth, _,[_, _, []]}, Tables) -> + +%% handle_cast + +handle_cast({store_failed_auth, [_, _, []]}, Tables) -> %% Some other authentication scheme than mod_auth (example mod_htacess) %% was the source for the authentication failure so we should ignor it! {noreply, Tables}; -handle_cast({store_failed_auth, Profile, [Info, DecodedString, SDirData]}, Tables) -> +handle_cast({store_failed_auth, [Info, DecodedString, SDirData]}, Tables) -> {ETS, DETS} = proplists:get_value(data_file, SDirData), Dir = proplists:get_value(path, SDirData), Addr = proplists:get_value(bind_address, SDirData), Port = proplists:get_value(port, SDirData), {ok, [User,Password]} = httpd_util:split(DecodedString,":",2), Seconds = universal_time(), - Key = {User, Dir, Addr, Port, Profile}, + Key = {User, Dir, Addr, Port}, %% Event CBModule = proplists:get_value(callback_module, SDirData, no_module_at_all), @@ -310,7 +363,7 @@ dets:match_delete(DETS, {blocked_user, {User, Addr, Port, Dir, '$1'}}), BlockRecord = {blocked_user, - {User, Addr, Port, Profile, Dir, Future}}, + {User, Addr, Port, Dir, Future}}, ets:insert(ETS, BlockRecord), dets:insert(DETS, BlockRecord), %% Remove previous failed requests. @@ -321,11 +374,11 @@ end, {noreply, Tables}; -handle_cast({store_successful_auth, [User, Addr, Port, Profile, SDirData]}, Tables) -> +handle_cast({store_successful_auth, [User, Addr, Port, SDirData]}, Tables) -> {ETS, DETS} = proplists:get_value(data_file, SDirData), AuthTimeOut = proplists:get_value(auth_timeout, SDirData, 30), Dir = proplists:get_value(path, SDirData), - Key = {User, Dir, Addr, Port, Profile}, + Key = {User, Dir, Addr, Port}, %% Remove failed entries for this Key dets:match_delete(DETS, {failed, {Key, '_', '_'}}), @@ -343,22 +396,33 @@ error_msg("security server got unknown cast: ~p",[Req]), {noreply, Tables}. + +%% handle_info + handle_info(_Info, State) -> {noreply, State}. + +%% terminate + terminate(_Reason, _Tables) -> ok. + +%% code_change({down, ToVsn}, State, Extra) +%% +code_change({down, _}, State, _Extra) -> + {ok, State}; + + +%% code_change(FromVsn, State, Extra) +%% code_change(_, State, _Extra) -> {ok, State}. -%%-------------------------------------------------------------------- -%%% Internal functions -%%-------------------------------------------------------------------- - %% block_user_int/5 -block_user_int(User, Addr, Port, Profile, Dir, Time) -> - Dirs = httpd_manager:config_match(Addr, Port, Profile, +block_user_int(User, Addr, Port, Dir, Time) -> + Dirs = httpd_manager:config_match(Addr, Port, {security_directory, {'_', '_'}}), case find_dirdata(Dirs, Dir) of {ok, DirData, {ETS, DETS}} -> @@ -370,11 +434,11 @@ Time end, Future = universal_time()+Time1, - ets:match_delete(ETS, {blocked_user, {User,Addr,Port,Profile, Dir,'_'}}), + ets:match_delete(ETS, {blocked_user, {User,Addr,Port,Dir,'_'}}), dets:match_delete(DETS, {blocked_user, - {User,Addr,Port,Profile, Dir,'_'}}), - ets:insert(ETS, {blocked_user, {User,Addr,Port, Profile, Dir,Future}}), - dets:insert(DETS, {blocked_user, {User,Addr,Port,Profile, Dir,Future}}), + {User,Addr,Port,Dir,'_'}}), + ets:insert(ETS, {blocked_user, {User,Addr,Port,Dir,Future}}), + dets:insert(DETS, {blocked_user, {User,Addr,Port,Dir,Future}}), CBModule = proplists:get_value(callback_module, DirData, no_module_at_all), user_block_event(CBModule,Addr,Port,Dir,User), @@ -383,6 +447,7 @@ {error, no_such_directory} end. + find_dirdata([], _Dir) -> false; find_dirdata([{security_directory, {_, DirData}}|SDirs], Dir) -> @@ -395,20 +460,21 @@ find_dirdata(SDirs, Dir) end. -unblock_user_int(User, Addr, Port, Profile, Dir) -> - Dirs = httpd_manager:config_match(Addr, Port, Profile, +%% unblock_user_int/4 +unblock_user_int(User, Addr, Port, Dir) -> + Dirs = httpd_manager:config_match(Addr, Port, {security_directory, {'_', '_'}}), case find_dirdata(Dirs, Dir) of {ok, DirData, {ETS, DETS}} -> case ets:match_object(ETS, - {blocked_user,{User,Addr,Port,Profile,Dir,'_'}}) of + {blocked_user,{User,Addr,Port,Dir,'_'}}) of [] -> {error, not_blocked}; _Objects -> ets:match_delete(ETS, {blocked_user, - {User, Addr, Port, Profile, Dir, '_'}}), + {User, Addr, Port, Dir, '_'}}), dets:match_delete(DETS, {blocked_user, - {User, Addr, Port, Profile, Dir, '_'}}), + {User, Addr, Port, Dir, '_'}}), CBModule = proplists:get_value(callback_module, DirData, no_module_at_all), @@ -419,51 +485,63 @@ {error, no_such_directory} end. -list_auth([], _, _, _, _, Acc) -> + + +%% list_auth/2 + +list_auth([], _Addr, _Port, _Dir, Acc) -> Acc; -list_auth([{_Name, {ETS, DETS}}|Tables], Addr, Port, Profile, Dir, Acc) -> - case ets:match_object(ETS, {success, {{'_', Dir, Addr, Port, Profile}, '_'}}) of +list_auth([{_Name, {ETS, DETS}}|Tables], Addr, Port, Dir, Acc) -> + case ets:match_object(ETS, {success, {{'_', Dir, Addr, Port}, '_'}}) of [] -> - list_auth(Tables, Addr, Port, Profile, Dir, Acc); + list_auth(Tables, Addr, Port, Dir, Acc); List -> TN = universal_time(), - NewAcc = lists:foldr(fun({success,{{U,Ad,P, Pr,D},T}},Ac) -> + NewAcc = lists:foldr(fun({success,{{U,Ad,P,D},T}},Ac) -> if T-TN > 0 -> [U|Ac]; true -> Rec = {success, - {{U,Ad,P,Pr,D},T}}, + {{U,Ad,P,D},T}}, ets:match_delete(ETS,Rec), dets:match_delete(DETS,Rec), Ac end end, Acc, List), - list_auth(Tables, Addr, Port, Profile, Dir, NewAcc) + list_auth(Tables, Addr, Port, Dir, NewAcc) end. -list_blocked([], _, _, _, _, Acc) -> + +%% list_blocked/2 + +list_blocked([], _Addr, _Port, _Dir, Acc) -> + ?hdrv("list blocked", [{acc, Acc}]), TN = universal_time(), - lists:foldl(fun({U,Ad,P,Pr,D,T}, Ac) -> + lists:foldl(fun({U,Ad,P,D,T}, Ac) -> if T-TN > 0 -> - [{U,Ad,P, Pr,D,local_time(T)}|Ac]; + [{U,Ad,P,D,local_time(T)}|Ac]; true -> Ac end end, [], Acc); -list_blocked([{_Name, {ETS, _DETS}}|Tables], Addr, Port, Profile, Dir, Acc) -> +list_blocked([{_Name, {ETS, _DETS}}|Tables], Addr, Port, Dir, Acc) -> + ?hdrv("list blocked", [{ets, ETS}, {tab2list, ets:tab2list(ETS)}]), List = ets:match_object(ETS, {blocked_user, - {'_',Addr,Port,Profile, Dir,'_'}}), + {'_',Addr,Port,Dir,'_'}}), NewBlocked = lists:foldl(fun({blocked_user, X}, A) -> [X|A] end, Acc, List), - list_blocked(Tables, Addr, Port, Profile, Dir, NewBlocked). + list_blocked(Tables, Addr, Port, Dir, NewBlocked). +%% +%% sync_dets_to_ets/2 +%% %% Reads dets-table DETS and syncronizes it with the ets-table ETS. %% sync_dets_to_ets(DETS, ETS) -> @@ -472,62 +550,68 @@ continue end). +%% +%% check_blocked_user/7 -> true | false +%% %% Check if a specific user is blocked from access. %% %% The sideeffect of this routine is that it unblocks also other users %% whos blocking time has expired. This to keep the tables as small %% as possible. %% -check_blocked_user(Info, User, Dir, Addr, Port, Profile, ETS, DETS, CBModule) -> +check_blocked_user(Info, User, Dir, Addr, Port, ETS, DETS, CBModule) -> TN = universal_time(), - BlockList = ets:match_object(ETS, {blocked_user, {User, '_', '_', '_', '_', '_'}}), + BlockList = ets:match_object(ETS, {blocked_user, {User, '_', '_', '_', '_'}}), Blocked = lists:foldl(fun({blocked_user, X}, A) -> [X|A] end, [], BlockList), check_blocked_user(Info,User,Dir, - Addr,Port, Profile, ETS,DETS,TN,Blocked,CBModule). + Addr,Port,ETS,DETS,TN,Blocked,CBModule). -check_blocked_user(_Info, _, _, _, _, _, _, _, _,[], _CBModule) -> +check_blocked_user(_Info, _User, _Dir, _Addr, _Port, _ETS, _DETS, _TN, + [], _CBModule) -> false; -check_blocked_user(Info, User, Dir, Addr, Port, Profile, ETS, DETS, TN, - [{User,Addr,Port,Profile, Dir,T}| _], CBModule) -> +check_blocked_user(Info, User, Dir, Addr, Port, ETS, DETS, TN, + [{User,Addr,Port,Dir,T}| _], CBModule) -> TD = T-TN, if TD =< 0 -> %% Blocking has expired, remove and grant access. - unblock_user(Info, User, Dir, Addr, Port, Profile, ETS, DETS, CBModule), + unblock_user(Info, User, Dir, Addr, Port, ETS, DETS, CBModule), false; true -> true end; -check_blocked_user(Info, User, Dir, Addr, Port, Profile, ETS, DETS, TN, - [{OUser,ODir,OAddr,OPort, OProfile, T}|Ls], CBModule) -> +check_blocked_user(Info, User, Dir, Addr, Port, ETS, DETS, TN, + [{OUser,ODir,OAddr,OPort,T}|Ls], CBModule) -> TD = T-TN, if TD =< 0 -> %% Blocking has expired, remove. - unblock_user(Info, OUser, ODir, OAddr, OPort, OProfile, + unblock_user(Info, OUser, ODir, OAddr, OPort, ETS, DETS, CBModule); true -> true end, - check_blocked_user(Info, User, Dir, Addr, Port, Profile, ETS, DETS, + check_blocked_user(Info, User, Dir, Addr, Port, ETS, DETS, TN, Ls, CBModule). -unblock_user(Info, User, Dir, Addr, Port, Profile, ETS, DETS, CBModule) -> +unblock_user(Info, User, Dir, Addr, Port, ETS, DETS, CBModule) -> Reason = io_lib:format("User ~s was removed from the block list for dir ~s", [User, Dir]), mod_log:security_log(Info, lists:flatten(Reason)), user_unblock_event(CBModule,Addr,Port,Dir,User), - dets:match_delete(DETS, {blocked_user, {User, Addr, Port, Profile, Dir, '_'}}), - ets:match_delete(ETS, {blocked_user, {User, Addr, Port, Profile, Dir, '_'}}). + dets:match_delete(DETS, {blocked_user, {User, Addr, Port, Dir, '_'}}), + ets:match_delete(ETS, {blocked_user, {User, Addr, Port, Dir, '_'}}). -make_name(Addr,Port, Profile) -> - httpd_util:make_name(?MODULE_STRING, Addr, Port, Profile). -make_name(Addr,Port, Profile, Num) -> - httpd_util:make_name(?MODULE_STRING, Addr,Port, - atom_to_list(Profile) ++ "__" ++ integer_to_list(Num)). +make_name(Addr,Port) -> + httpd_util:make_name("httpd_security",Addr,Port). + +make_name(Addr,Port,Num) -> + httpd_util:make_name("httpd_security",Addr,Port, + "__" ++ integer_to_list(Num)). + auth_fail_event(Mod,Addr,Port,Dir,User,Passwd) -> event(auth_fail,Mod,Addr,Port,Dir,[{user,User},{password,Passwd}]). @@ -539,10 +623,17 @@ event(user_unblock,Mod,Addr,Port,Dir,[{user,User}]). event(Event, Mod, undefined, Port, Dir, Info) -> + ?hdrt("event", + [{event, Event}, {mod, Mod}, {port, Port}, {dir, Dir}]), (catch Mod:event(Event,Port,Dir,Info)); event(Event, Mod, any, Port, Dir, Info) -> + ?hdrt("event", + [{event, Event}, {mod, Mod}, {port, Port}, {dir, Dir}]), (catch Mod:event(Event,Port,Dir,Info)); event(Event, Mod, Addr, Port, Dir, Info) -> + ?hdrt("event", + [{event, Event}, {mod, Mod}, + {addr, Addr}, {port, Port}, {dir, Dir}]), (catch Mod:event(Event,Addr,Port,Dir,Info)). universal_time() -> @@ -552,9 +643,11 @@ calendar:universal_time_to_local_time( calendar:gregorian_seconds_to_datetime(T)). + error_msg(F, A) -> error_logger:error_msg(F, A). + call(Name, Req) -> case (catch gen_server:call(Name, Req)) of {'EXIT', Reason} -> @@ -563,6 +656,7 @@ Reply end. + cast(Name, Msg) -> case (catch gen_server:cast(Name, Msg)) of {'EXIT', Reason} -> diff -Nru erlang-18.2-dfsg/lib/inets/src/http_server/mod_trace.erl erlang-17.3-dfsg/lib/inets/src/http_server/mod_trace.erl --- erlang-18.2-dfsg/lib/inets/src/http_server/mod_trace.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/http_server/mod_trace.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets_app.erl erlang-17.3-dfsg/lib/inets/src/inets_app/inets_app.erl --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets.app.src erlang-17.3-dfsg/lib/inets/src/inets_app/inets.app.src --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% This is an -*- erlang -*- file. %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,9 +26,7 @@ inets_app, inets_service, inets_regexp, - inets_trace, - inets_lib, - inets_time_compat, + inets_trace, %% FTP ftp, @@ -64,8 +61,6 @@ httpd_cgi, httpd_connection_sup, httpd_conf, - httpd_custom, - httpd_custom_api, httpd_esi, httpd_example, httpd_file, @@ -95,6 +90,7 @@ mod_get, mod_head, mod_htaccess, + mod_include, mod_log, mod_range, mod_responsecontrol, diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets.appup.src erlang-17.3-dfsg/lib/inets/src/inets_app/inets.appup.src --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,26 +3,58 @@ %% %% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", [ - {<<"6\\..*">>,[{restart_application, inets}]}, + {"5.10.2", + [ + {load_module, httpd_request_handler, soft_purge, soft_purge, + []}]}, + {"5.10.1", + [{load_module, httpc_handler, soft_purge, soft_purge, []}, + {load_module, httpd, soft_purge, soft_purge, []}, + {load_module, httpd_manager, soft_purge, soft_purge, []}, + {load_module, httpd_request, soft_purge, soft_purge, []}, + {load_module, httpd_request_handler, soft_purge, soft_purge, + []}]}, + {"5.10", + [{load_module, httpc_handler, soft_purge, soft_purge, []}, + {load_module, httpd, soft_purge, soft_purge, []}, + {load_module, httpd_manager, soft_purge, soft_purge, []}, + {load_module, httpd_request, soft_purge, soft_purge, []}, + {load_module, httpd_request_handler, soft_purge, soft_purge, + []}]}, {<<"5\\..*">>,[{restart_application, inets}]} ], [ - {<<"6\\..*">>,[{restart_application, inets}]}, + {"5.10.2", + [ + {load_module, httpd_request_handler, soft_purge, soft_purge, + []}]}, + {"5.10.1", + [{load_module, httpc_handler, soft_purge, soft_purge, []}, + {load_module, httpd, soft_purge, soft_purge, []}, + {load_module, httpd_manager, soft_purge, soft_purge, []}, + {load_module, httpd_request, soft_purge, soft_purge, []}, + {load_module, httpd_request_handler, soft_purge, soft_purge, + []}]}, + {"5.10", + [{load_module, httpc_handler, soft_purge, soft_purge, []}, + {load_module, httpd, soft_purge, soft_purge, []}, + {load_module, httpd_manager, soft_purge, soft_purge, []}, + {load_module, httpd_request, soft_purge, soft_purge, []}, + {load_module, httpd_request_handler, soft_purge, soft_purge, []}]}, {<<"5\\..*">>,[{restart_application, inets}]} ] }. diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets.erl erlang-17.3-dfsg/lib/inets/src/inets_app/inets.erl --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets_internal.hrl erlang-17.3-dfsg/lib/inets/src/inets_app/inets_internal.hrl --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets_lib.erl erlang-17.3-dfsg/lib/inets/src/inets_app/inets_lib.erl --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets_lib.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - --module(inets_lib). - --export([millisec_passed/1, formated_timestamp/0, format_timestamp/1]). - - - -%% Help function, elapsed milliseconds since T0 -millisec_passed({_,_,_} = T0 ) -> - %% OTP 17 and earlier - timer:now_diff(inets_time_compat:timestamp(), T0) div 1000; - -millisec_passed(T0) -> - %% OTP 18 - erlang:convert_time_unit(erlang:monotonic_time() - T0, - native, - micro_seconds) div 1000. - -%% Return formated time stamp (e.g. 2015:03:16 10:05:23 1234) -formated_timestamp() -> - format_timestamp( os:timestamp() ). - -%% Return formated time stamp (e.g. 2015:03:16 10:05:23 1234) -format_timestamp({_N1, _N2, N3} = Tme) -> - {Date, Time} = calendar:now_to_datetime(Tme), - {YYYY,MM,DD} = Date, - {Hour,Min,Sec} = Time, - FormatDate = - io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w", - [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]), - lists:flatten(FormatDate). diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets.mk erlang-17.3-dfsg/lib/inets/src/inets_app/inets.mk --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2010-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets_regexp.erl erlang-17.3-dfsg/lib/inets/src/inets_app/inets_regexp.erl --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets_regexp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets_regexp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets_service.erl erlang-17.3-dfsg/lib/inets/src/inets_app/inets_service.erl --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets_service.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets_service.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets_sup.erl erlang-17.3-dfsg/lib/inets/src/inets_app/inets_sup.erl --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets_time_compat.erl erlang-17.3-dfsg/lib/inets/src/inets_app/inets_time_compat.erl --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets_time_compat.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets_time_compat.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% This module is created to be able to execute on ERTS versions both -%% earlier and later than 7.0. - --module(inets_time_compat). - -%% We don't want warnings about the use of erlang:now/0 in -%% this module. --compile(nowarn_deprecated_function). - --export([monotonic_time/0, - timestamp/0, - unique_integer/0, - unique_integer/1]). - -monotonic_time() -> - try - erlang:monotonic_time() - catch - error:undef -> - %% Use Erlang system time as monotonic time - erlang_system_time_fallback() - end. - -timestamp() -> - try - erlang:timestamp() - catch - error:undef -> - erlang:now() - end. - -unique_integer() -> - try - erlang:unique_integer() - catch - error:undef -> - erlang_system_time_fallback() - end. - -unique_integer(Modifiers) -> - try - erlang:unique_integer(Modifiers) - catch - error:badarg -> - erlang:error(badarg, [Modifiers]); - error:undef -> - erlang_system_time_fallback() - end. - -erlang_system_time_fallback() -> - {MS, S, US} = erlang:now(), - (MS*1000000+S)*1000000+US. diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/inets_trace.erl erlang-17.3-dfsg/lib/inets/src/inets_app/inets_trace.erl --- erlang-18.2-dfsg/lib/inets/src/inets_app/inets_trace.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/inets_trace.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011-2015. All Rights Reserved. +%% Copyright Ericsson AB 2011-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -229,24 +228,21 @@ [_Sev, "stop trace", stop_trace, [stop_trace]]}, Timestamp}, {_, standard_io} = Fd) -> - (catch io:format(standard_io, "stop trace at ~s~n", - [inets_lib:format_timestamp(Timestamp)])), + (catch io:format(standard_io, "stop trace at ~s~n", [format_timestamp(Timestamp)])), Fd; handle_trace({trace_ts, _Who, call, {?MODULE, report_event, [_Sev, "stop trace", stop_trace, [stop_trace]]}, Timestamp}, standard_io = Fd) -> - (catch io:format(Fd, "stop trace at ~s~n", - [inets_lib:format_timestamp(Timestamp)])), + (catch io:format(Fd, "stop trace at ~s~n", [format_timestamp(Timestamp)])), Fd; handle_trace({trace_ts, _Who, call, {?MODULE, report_event, [_Sev, "stop trace", stop_trace, [stop_trace]]}, Timestamp}, {_Service, Fd}) -> - (catch io:format(Fd, "stop trace at ~s~n", - [inets_lib:format_timestamp(Timestamp)])), + (catch io:format(Fd, "stop trace at ~s~n", [format_timestamp(Timestamp)])), (catch file:close(Fd)), closed_file; handle_trace({trace_ts, _Who, call, @@ -254,8 +250,7 @@ [_Sev, "stop trace", stop_trace, [stop_trace]]}, Timestamp}, Fd) -> - (catch io:format(Fd, "stop trace at ~s~n", - [inets_lib:format_timestamp(Timestamp)])), + (catch io:format(Fd, "stop trace at ~s~n", [format_timestamp(Timestamp)])), (catch file:close(Fd)), closed_file; handle_trace({trace_ts, Who, call, @@ -285,7 +280,7 @@ do_print_inets_trace(Fd, Sev, Timestamp, Who, Label, Service, Content). do_print_inets_trace(Fd, Sev, Timestamp, Who, Label, Service, Content) -> - Ts = inets_lib:format_timestamp(Timestamp), + Ts = format_timestamp(Timestamp), io:format(Fd, "[inets ~w trace ~w ~w ~s] ~s " "~n Content: ~p" "~n", @@ -312,7 +307,7 @@ "~n", [Who, What, Where, Extra]); do_print_trace(Fd, {trace_ts, Who, What, Where, When}) -> - Ts = inets_lib:format_timestamp(When), + Ts = format_timestamp(When), io:format(Fd, "[trace ~s]" "~n Who: ~p" "~n What: ~p" @@ -320,7 +315,7 @@ "~n", [Ts, Who, What, Where]); do_print_trace(Fd, {trace_ts, Who, What, Where, Extra, When}) -> - Ts = inets_lib:format_timestamp(When), + Ts = format_timestamp(When), io:format(Fd, "[trace ~s]" "~n Who: ~p" "~n What: ~p" @@ -335,7 +330,7 @@ "~n", [What, Where]); do_print_trace(Fd, {seq_trace, What, Where, When}) -> - Ts = inets_lib:format_timestamp(When), + Ts = format_timestamp(When), io:format(Fd, "[seq trace ~s]" "~n What: ~p" "~n Where: ~p" @@ -350,3 +345,13 @@ "~n", [Trace]). +format_timestamp({_N1, _N2, N3} = Now) -> + {Date, Time} = calendar:now_to_datetime(Now), + {YYYY,MM,DD} = Date, + {Hour,Min,Sec} = Time, + FormatDate = + io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w", + [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]), + lists:flatten(FormatDate). + + diff -Nru erlang-18.2-dfsg/lib/inets/src/inets_app/Makefile erlang-17.3-dfsg/lib/inets/src/inets_app/Makefile --- erlang-18.2-dfsg/lib/inets/src/inets_app/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/inets_app/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2005-2015. All Rights Reserved. +# Copyright Ericsson AB 2005-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -48,9 +47,7 @@ inets_app \ inets_sup \ inets_regexp \ - inets_trace \ - inets_lib \ - inets_time_compat + inets_trace INTERNAL_HRL_FILES = inets_internal.hrl EXTERNAL_HRL_FILES = ../../include/httpd.hrl \ diff -Nru erlang-18.2-dfsg/lib/inets/src/Makefile erlang-17.3-dfsg/lib/inets/src/Makefile --- erlang-18.2-dfsg/lib/inets/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/src/tftp/Makefile erlang-17.3-dfsg/lib/inets/src/tftp/Makefile --- erlang-18.2-dfsg/lib/inets/src/tftp/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/tftp/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2005-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/src/tftp/tftp_binary.erl erlang-17.3-dfsg/lib/inets/src/tftp/tftp_binary.erl --- erlang-18.2-dfsg/lib/inets/src/tftp/tftp_binary.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/tftp/tftp_binary.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/tftp/tftp_engine.erl erlang-17.3-dfsg/lib/inets/src/tftp/tftp_engine.erl --- erlang-18.2-dfsg/lib/inets/src/tftp/tftp_engine.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/tftp/tftp_engine.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -128,8 +127,8 @@ daemon_init(Config) when is_record(Config, config), is_pid(Config#config.parent_pid) -> process_flag(trap_exit, true), - {Port, UdpOptions} = prepare_daemon_udp(Config), - case catch gen_udp:open(Port, UdpOptions) of + UdpOptions = prepare_daemon_udp(Config), + case catch gen_udp:open(Config#config.udp_port, UdpOptions) of {ok, Socket} -> {ok, ActualPort} = inet:port(Socket), proc_lib:init_ack({ok, self()}), @@ -157,7 +156,7 @@ case lists:keymember(fd, 1, UdpOptions) of true -> %% Use explicit fd - {Port, UdpOptions}; + UdpOptions; false -> %% Use fd from setuid_socket_wrap, such as -tftpd_69 InitArg = list_to_atom("tftpd_" ++ integer_to_list(Port)), @@ -165,7 +164,7 @@ {ok, [[FdStr]] = Badarg} when is_list(FdStr) -> case catch list_to_integer(FdStr) of Fd when is_integer(Fd) -> - {0, [{fd, Fd} | lists:keydelete(ip, 1, UdpOptions)]}; + [{fd, Fd} | UdpOptions]; {'EXIT', _} -> Text = lists:flatten(io_lib:format("Illegal prebound fd ~p: ~p", [InitArg, Badarg])), print_debug_info(Config, daemon, open, ?ERROR(open, undef, Text, "")), @@ -176,7 +175,7 @@ print_debug_info(Config, daemon, open, ?ERROR(open, undef, Text, "")), exit({badarg, {prebound_fd, InitArg, Badarg}}); error -> - {Port, UdpOptions} + UdpOptions end end. diff -Nru erlang-18.2-dfsg/lib/inets/src/tftp/tftp.erl erlang-17.3-dfsg/lib/inets/src/tftp/tftp.erl --- erlang-18.2-dfsg/lib/inets/src/tftp/tftp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/tftp/tftp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/tftp/tftp_file.erl erlang-17.3-dfsg/lib/inets/src/tftp/tftp_file.erl --- erlang-18.2-dfsg/lib/inets/src/tftp/tftp_file.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/tftp/tftp_file.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/tftp/tftp.hrl erlang-17.3-dfsg/lib/inets/src/tftp/tftp.hrl --- erlang-18.2-dfsg/lib/inets/src/tftp/tftp.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/tftp/tftp.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/tftp/tftp_lib.erl erlang-17.3-dfsg/lib/inets/src/tftp/tftp_lib.erl --- erlang-18.2-dfsg/lib/inets/src/tftp/tftp_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/tftp/tftp_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/src/tftp/tftp_logger.erl erlang-17.3-dfsg/lib/inets/src/tftp/tftp_logger.erl --- erlang-18.2-dfsg/lib/inets/src/tftp/tftp_logger.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/tftp/tftp_logger.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -85,8 +84,8 @@ %%------------------------------------------------------------------- add_timestamp(Format, Data) -> - Time = inets_time_compat:timestamp(), - {{_Y, _Mo, _D}, {H, Mi, S}} = calendar:now_to_universal_time(Time), + Now = {_MegaSecs, _Secs, _MicroSecs} = erlang:now(), + {{_Y, _Mo, _D}, {H, Mi, S}} = calendar:now_to_universal_time(Now), %% {"~p-~s-~sT~s:~s:~sZ,~6.6.0w tftp: " ++ Format ++ "\n", %% [Y, t(Mo), t(D), t(H), t(Mi), t(S), MicroSecs | Data]}. {"~s:~s:~s tftp: " ++ Format, [t(H), t(Mi), t(S) | Data]}. diff -Nru erlang-18.2-dfsg/lib/inets/src/tftp/tftp_sup.erl erlang-17.3-dfsg/lib/inets/src/tftp/tftp_sup.erl --- erlang-18.2-dfsg/lib/inets/src/tftp/tftp_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/src/tftp/tftp_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2015. All Rights Reserved. +%% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -94,7 +93,7 @@ {value, {_, Port}} when is_integer(Port), Port > 0 -> {tftpd, Port}; _ -> - {tftpd, inets_time_compat:unique_integer([positive])} + {tftpd, erlang:now()} end. default_kill_after() -> diff -Nru erlang-18.2-dfsg/lib/inets/test/erl_make_certs.erl erlang-17.3-dfsg/lib/inets/test/erl_make_certs.erl --- erlang-18.2-dfsg/lib/inets/test/erl_make_certs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/erl_make_certs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -205,7 +204,7 @@ Subject. subject(undefined, IsRootCA) -> - User = if IsRootCA -> "RootCA"; true -> os:getenv("USER", "test_user") end, + User = if IsRootCA -> "RootCA"; true -> user() end, Opts = [{email, User ++ "@erlang.org"}, {name, User}, {city, "Stockholm"}, @@ -216,6 +215,14 @@ subject(Opts, _) -> subject(Opts). +user() -> + case os:getenv("USER") of + false -> + "test_user"; + User -> + User + end. + subject(SubjectOpts) when is_list(SubjectOpts) -> Encode = fun(Opt) -> {Type,Value} = subject_enc(Opt), diff -Nru erlang-18.2-dfsg/lib/inets/test/ftp_format_SUITE.erl erlang-17.3-dfsg/lib/inets/test/ftp_format_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/ftp_format_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/ftp_format_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/ftp_internal.hrl erlang-17.3-dfsg/lib/inets/test/ftp_internal.hrl --- erlang-18.2-dfsg/lib/inets/test/ftp_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/ftp_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/ftp_property_test_SUITE.erl erlang-17.3-dfsg/lib/inets/test/ftp_property_test_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/ftp_property_test_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/ftp_property_test_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/ftp_SUITE.erl erlang-17.3-dfsg/lib/inets/test/ftp_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/ftp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/ftp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/ftp_suite_lib.erl erlang-17.3-dfsg/lib/inets/test/ftp_suite_lib.erl --- erlang-18.2-dfsg/lib/inets/test/ftp_suite_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/ftp_suite_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2015. All Rights Reserved. +%% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -1353,9 +1352,9 @@ ok. do_mkdir(Pid) -> - NewDir = "earl_" ++ - integer_to_list(inets_time_compat:unique_integer([positive])), - + {A, B, C} = erlang:now(), + NewDir = "nisse_" ++ integer_to_list(A) ++ "_" ++ + integer_to_list(B) ++ "_" ++ integer_to_list(C), ok = ftp:cd(Pid, "incoming"), {ok, CurrDir} = ftp:pwd(Pid), {error, efnamena} = ftp:mkdir(Pid, NewDir++"\r\nCWD ."), diff -Nru erlang-18.2-dfsg/lib/inets/test/httpc_cookie_SUITE.erl erlang-17.3-dfsg/lib/inets/test/httpc_cookie_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/httpc_cookie_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpc_cookie_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/httpc_internal.hrl erlang-17.3-dfsg/lib/inets/test/httpc_internal.hrl --- erlang-18.2-dfsg/lib/inets/test/httpc_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpc_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/httpc_proxy_SUITE_data/apache2/apache2.conf erlang-17.3-dfsg/lib/inets/test/httpc_proxy_SUITE_data/apache2/apache2.conf --- erlang-18.2-dfsg/lib/inets/test/httpc_proxy_SUITE_data/apache2/apache2.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpc_proxy_SUITE_data/apache2/apache2.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/lib/inets/test/httpc_proxy_SUITE_data/server_proxy.sh erlang-17.3-dfsg/lib/inets/test/httpc_proxy_SUITE_data/server_proxy.sh --- erlang-18.2-dfsg/lib/inets/test/httpc_proxy_SUITE_data/server_proxy.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpc_proxy_SUITE_data/server_proxy.sh 2014-09-16 19:10:57.000000000 +0000 @@ -7,17 +7,16 @@ ## ## Copyright Ericsson AB 2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## @@ -169,8 +168,6 @@ ViaProxyName "tinyproxy" ConnectPort $APACHE_HTTPS_PORT -# to test connect error -ConnectPort $APACHE_HTTP_PORT EOF (tinyproxy -d -c tinyproxy.conf 1>/dev/null 2>&1 - [https_connect_error]. - %%-------------------------------------------------------------------- init_per_suite(Config0) -> - case init_apps(suite_apps(), Config0) of + case init_apps([crypto,public_key], Config0) of Config when is_list(Config) -> make_cert_files(dsa, "server-", Config), Config; @@ -98,7 +94,7 @@ %% internal functions suite_apps() -> - [asn1,crypto,public_key]. + [crypto,public_key]. %%-------------------------------------------------------------------- @@ -435,21 +431,6 @@ end. %%-------------------------------------------------------------------- -https_connect_error(doc) -> - ["Error from CONNECT tunnel should be returned"]; -https_connect_error(Config) when is_list(Config) -> - {HttpServer,HttpPort} = ?config(http, Config), - Method = get, - %% using HTTPS scheme with HTTP port to trigger connection error - URL = "https://" ++ HttpServer ++ ":" ++ - integer_to_list(HttpPort) ++ "/index.html", - Opts = [], - HttpOpts = [], - Request = {URL,[]}, - {error,{failed_connect,[_,{tls,_,_}]}} = - httpc:request(Method, Request, HttpOpts, Opts). - -%%-------------------------------------------------------------------- %% Internal Functions ------------------------------------------------ %%-------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/inets/test/httpc_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/inets/test/httpc_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/inets/test/httpc_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpc_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -10,10 +10,5 @@ cgi_echo@exe@: cgi_echo@obj@ $(LD) $(CROSSLDFLAGS) -o cgi_echo cgi_echo@obj@ @LIBS@ -@IFEQ@ (@CC@, cl -nologo) -cgi_echo@obj@: cgi_echo.c - $(CC) /c /Focgi_echo@obj@ $(CFLAGS) cgi_echo.c -@ELSE@ cgi_echo@obj@: cgi_echo.c $(CC) -c -o cgi_echo@obj@ $(CFLAGS) cgi_echo.c -@ENDIF@ diff -Nru erlang-18.2-dfsg/lib/inets/test/httpc_SUITE.erl erlang-17.3-dfsg/lib/inets/test/httpc_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/httpc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,7 +28,6 @@ -include_lib("common_test/include/ct.hrl"). -include("inets_test_lib.hrl"). -include("http_internal.hrl"). --include("httpc_internal.hrl"). %% Note: This directive should only be used in test suites. -compile(export_all). @@ -93,26 +91,20 @@ cookie, cookie_profile, empty_set_cookie, - invalid_set_cookie, trace, stream_once, stream_single_chunk, stream_no_length, - not_streamed_once, - stream_large_not_200_or_206, no_content_204, tolerate_missing_CR, userinfo, bad_response, internal_server_error, invalid_http, - invalid_chunk_size, headers_dummy, - headers_with_obs_fold, empty_response_header, remote_socket_close, remote_socket_close_async, - process_leak_on_keepalive, transfer_encoding, transfer_encoding_identity, redirect_loop, @@ -411,21 +403,6 @@ stream_test(Request1, {stream, self}), Request2 = {url(group_name(Config), "/http_1_0_no_length_multiple.html", Config), []}, stream_test(Request2, {stream, self}). -%%------------------------------------------------------------------------- -stream_large_not_200_or_206() -> - [{doc, "Test the option stream for large responses with status codes " - "other than 200 or 206" }]. -stream_large_not_200_or_206(Config) when is_list(Config) -> - Request = {url(group_name(Config), "/large_404_response.html", Config), []}, - {404, _} = not_streamed_test(Request, {stream, self}). -%%------------------------------------------------------------------------- -not_streamed_once() -> - [{doc, "Test not streamed responses with once streaming"}]. -not_streamed_once(Config) when is_list(Config) -> - Request0 = {url(group_name(Config), "/404.html", Config), []}, - {404, _} = not_streamed_test(Request0, {stream, {self, once}}), - Request1 = {url(group_name(Config), "/404_chunked.html", Config), []}, - {404, _} = not_streamed_test(Request1, {stream, {self, once}}). %%------------------------------------------------------------------------- @@ -591,18 +568,6 @@ ok = httpc:set_options([{cookies, disabled}]). %%------------------------------------------------------------------------- -invalid_set_cookie(doc) -> - ["Test ignoring invalid Set-Cookie header"]; -invalid_set_cookie(Config) when is_list(Config) -> - ok = httpc:set_options([{cookies, enabled}]), - - URL = url(group_name(Config), "/invalid_set_cookie.html", Config), - {ok, {{_,200,_}, [_|_], [_|_]}} = - httpc:request(get, {URL, []}, [], []), - - ok = httpc:set_options([{cookies, disabled}]). - -%%------------------------------------------------------------------------- headers_as_is(doc) -> ["Test the option headers_as_is"]; headers_as_is(Config) when is_list(Config) -> @@ -766,22 +731,6 @@ ct:print("Parse error: ~p ~n", [Reason]). %%------------------------------------------------------------------------- - -invalid_chunk_size(doc) -> - ["Test parse error of HTTP chunk size"]; -invalid_chunk_size(suite) -> - []; -invalid_chunk_size(Config) when is_list(Config) -> - - URL = url(group_name(Config), "/invalid_chunk_size.html", Config), - - {error, {chunk_size, _} = Reason} = - httpc:request(get, {URL, []}, [], []), - - ct:print("Parse error: ~p ~n", [Reason]). - -%%------------------------------------------------------------------------- - emulate_lower_versions(doc) -> [{doc, "Perform request as 0.9 and 1.0 clients."}]; emulate_lower_versions(Config) when is_list(Config) -> @@ -928,13 +877,6 @@ %%------------------------------------------------------------------------- -headers_with_obs_fold(Config) when is_list(Config) -> - Request = {url(group_name(Config), "/obs_folded_headers.html", Config), []}, - {ok, {{_,200,_}, Headers, [_|_]}} = httpc:request(get, Request, [], []), - "a b" = proplists:get_value("folded", Headers). - -%%------------------------------------------------------------------------- - invalid_headers(Config) -> Request = {url(group_name(Config), "/dummy.html", Config), [{"cookie", undefined}]}, {error, _} = httpc:request(get, Request, [], []). @@ -958,33 +900,6 @@ %%------------------------------------------------------------------------- -process_leak_on_keepalive(Config) -> - {ok, ClosedSocket} = gen_tcp:listen(6666, [{active, false}]), - ok = gen_tcp:close(ClosedSocket), - Request = {url(group_name(Config), "/dummy.html", Config), []}, - HttpcHandlers0 = supervisor:which_children(httpc_handler_sup), - {ok, {{_, 200, _}, _, Body}} = httpc:request(get, Request, [], []), - HttpcHandlers1 = supervisor:which_children(httpc_handler_sup), - ChildrenCount = supervisor:count_children(httpc_handler_sup), - %% Assuming that the new handler will be selected for keep_alive - %% which could not be the case if other handlers existed - [{undefined, Pid, worker, [httpc_handler]}] = - ordsets:to_list( - ordsets:subtract(ordsets:from_list(HttpcHandlers1), - ordsets:from_list(HttpcHandlers0))), - sys:replace_state( - Pid, fun (State) -> - Session = element(3, State), - setelement(3, State, Session#session{socket=ClosedSocket}) - end), - {ok, {{_, 200, _}, _, Body}} = httpc:request(get, Request, [], []), - %% bad handler with the closed socket should get replaced by - %% the new one, so children count should stay the same - ChildrenCount = supervisor:count_children(httpc_handler_sup), - ok. - -%%------------------------------------------------------------------------- - stream_to_pid(Config) when is_list(Config) -> ReceiverPid = create_receiver(pid), Receiver = ReceiverPid, @@ -1151,19 +1066,6 @@ Body = binary_to_list(StreamedBody). -not_streamed_test(Request, To) -> - {ok, {{_,Code,_}, [_ | _], Body}} = - httpc:request(get, Request, [], [{body_format, binary}]), - {ok, RequestId} = - httpc:request(get, Request, [], [{body_format, binary}, {sync, false}, To]), - - receive - {http, {RequestId, {{_, Code, _}, _Headers, Body}}} -> - {Code, binary_to_list(Body)}; - {http, Msg} -> - ct:fail(Msg) - end. - url(http, End, Config) -> Port = ?config(port, Config), {ok,Host} = inet:gethostname(), @@ -1344,11 +1246,8 @@ dummy_ipcomm_server_loop({httpd_request, parse, [[{max_uri, ?HTTP_MAX_URI_SIZE}, {max_header, ?HTTP_MAX_HEADER_SIZE}, {max_version,?HTTP_MAX_VERSION_STRING}, - {max_method, ?HTTP_MAX_METHOD_STRING}, - {max_content_length, ?HTTP_MAX_CONTENT_LENGTH}, - {customize, httpd_custom} - ]]}, - [], ListenSocket); + {max_method, ?HTTP_MAX_METHOD_STRING}]]}, + [], ListenSocket); dummy_server_init(Caller, ssl, Inet, SSLOptions) -> BaseOpts = [binary, {reuseaddr,true}, {active, false} | @@ -1362,10 +1261,7 @@ dummy_ssl_server_loop({httpd_request, parse, [[{max_uri, ?HTTP_MAX_URI_SIZE}, {max_method, ?HTTP_MAX_METHOD_STRING}, {max_version,?HTTP_MAX_VERSION_STRING}, - {max_method, ?HTTP_MAX_METHOD_STRING}, - {max_content_length, ?HTTP_MAX_CONTENT_LENGTH}, - {customize, httpd_custom} - ]]}, + {max_method, ?HTTP_MAX_METHOD_STRING}]]}, [], ListenSocket). dummy_ipcomm_server_loop(MFA, Handlers, ListenSocket) -> @@ -1442,22 +1338,16 @@ stop -> stop; <<>> -> - {httpd_request, parse, [[{max_uri,?HTTP_MAX_URI_SIZE}, - {max_header, ?HTTP_MAX_HEADER_SIZE}, - {max_version,?HTTP_MAX_VERSION_STRING}, - {max_method, ?HTTP_MAX_METHOD_STRING}, - {max_content_length, ?HTTP_MAX_CONTENT_LENGTH}, - {customize, httpd_custom} - ]]}; + {httpd_request, parse, [[<<>>, [{max_uri, ?HTTP_MAX_URI_SIZE}, + {max_header, ?HTTP_MAX_HEADER_SIZE}, + {max_version,?HTTP_MAX_VERSION_STRING}, + {max_method, ?HTTP_MAX_METHOD_STRING}]]]}; Data -> handle_request(httpd_request, parse, [Data, [{max_uri, ?HTTP_MAX_URI_SIZE}, {max_header, ?HTTP_MAX_HEADER_SIZE}, - {max_version,?HTTP_MAX_VERSION_STRING}, - {max_method, ?HTTP_MAX_METHOD_STRING}, - {max_content_length, ?HTTP_MAX_CONTENT_LENGTH}, - {customize, httpd_custom} - ]], Socket) + {max_version,?HTTP_MAX_VERSION_STRING}, + {max_method, ?HTTP_MAX_METHOD_STRING}]], Socket) end; NewMFA -> NewMFA @@ -1547,7 +1437,7 @@ ensure_host_header_with_port([]) -> false; -ensure_host_header_with_port([{"host", Host}| _]) -> +ensure_host_header_with_port(["host: " ++ Host| _]) -> case string:tokens(Host, [$:]) of [_ActualHost, _Port] -> true; @@ -1559,7 +1449,7 @@ auth_header([]) -> auth_header_not_found; -auth_header([{"authorization", Value} | _]) -> +auth_header(["authorization:" ++ Value | _]) -> {ok, string:strip(Value)}; auth_header([_ | Tail]) -> auth_header(Tail). @@ -1576,7 +1466,7 @@ check_cookie([]) -> ct:fail(no_cookie_header); -check_cookie([{"cookie", _} | _]) -> +check_cookie(["cookie:" ++ _Value | _]) -> ok; check_cookie([_Head | Tail]) -> check_cookie(Tail). @@ -1695,11 +1585,6 @@ "Content-Length:" ++ integer_to_list(length(Body)) ++ "\r\n\r\n" ++ Body; -handle_uri(_,"/404.html",_,_,_,_) -> - "HTTP/1.1 404 not found\r\n" ++ - "Content-Length:14\r\n\r\n" ++ - "Page not found"; - handle_uri(_,"/500.html",_,_,_,_) -> "HTTP/1.1 500 Internal Server Error\r\n" ++ "Content-Length:47\r\n\r\n" ++ @@ -1773,13 +1658,6 @@ send(Socket, http_chunk:encode("obar")), http_chunk:encode_last(); -handle_uri(_,"/obs_folded_headers.html",_,_,_,_) -> - "HTTP/1.1 200 ok\r\n" - "Content-Length:5\r\n" - "Folded: a\r\n" - " b\r\n\r\n" - "Hello"; - handle_uri(_,"/capital_transfer_encoding.html",_,_,Socket,_) -> Head = "HTTP/1.1 200 ok\r\n" ++ "Transfer-Encoding:Chunked\r\n\r\n", @@ -1808,14 +1686,6 @@ "Content-Length:32\r\n\r\n"++ "foobar"; -handle_uri(_,"/invalid_set_cookie.html",_,_,_,_) -> - "HTTP/1.1 200 ok\r\n" ++ - "set-cookie: =\r\n" ++ - "set-cookie: name=\r\n" ++ - "set-cookie: name-or-value\r\n" ++ - "Content-Length:32\r\n\r\n"++ - "foobar"; - handle_uri(_,"/missing_crlf.html",_,_,_,_) -> "HTTP/1.1 200 ok" ++ "Content-Length:32\r\n" ++ @@ -1835,15 +1705,6 @@ http_chunk:encode("obar")), http_chunk:encode_last(); -handle_uri(_,"/404_chunked.html",_,_,Socket,_) -> - Head = "HTTP/1.1 404 not found\r\n" ++ - "Transfer-Encoding:Chunked\r\n\r\n", - send(Socket, Head), - send(Socket, http_chunk:encode("Not ")), - send(Socket, - http_chunk:encode("found")), - http_chunk:encode_last(); - handle_uri(_,"/single_chunk.html",_,_,Socket,_) -> Chunk = "HTTP/1.1 200 ok\r\n" ++ "Transfer-Encoding:Chunked\r\n\r\n" ++ @@ -1868,17 +1729,6 @@ send(Socket, string:copies("other multiple packets ", 200)), close(Socket); -handle_uri(_,"/large_404_response.html",_,_,Socket,_) -> - %% long body to make sure it will be sent in multiple tcp packets - Body = string:copies("other multiple packets ", 200), - Head = io_lib:format("HTTP/1.1 404 not found\r\n" - "Content-length: ~B\r\n" - "Content-type: text/plain\r\n\r\n", - [length(Body)]), - send(Socket, Head), - send(Socket, Body), - close(Socket); - handle_uri(_,"/once.html",_,_,Socket,_) -> Head = "HTTP/1.1 200 ok\r\n" ++ "Content-Length:32\r\n\r\n", @@ -1893,10 +1743,6 @@ "HTTP/1.1 301\r\nDate:Sun, 09 Dec 2007 13:04:18 GMT\r\n" ++ "Transfer-Encoding:chunked\r\n\r\n"; -handle_uri(_,"/invalid_chunk_size.html",_,_,_,_) -> - "HTTP/1.1 200 ok\r\n" ++ - "Transfer-Encoding:chunked\r\n\r\nåäö\r\n"; - handle_uri(_,"/missing_reason_phrase.html",_,_,_,_) -> "HTTP/1.1 200\r\n" ++ "Content-Length: 32\r\n\r\n" @@ -2030,13 +1876,12 @@ wait4clients([], _Timeout) -> ok; wait4clients(Clients, Timeout) when Timeout > 0 -> - Time = inets_time_compat:monotonic_time(), - + Time = now_ms(), receive {'DOWN', _MRef, process, Pid, normal} -> {value, {Id, _, _}} = lists:keysearch(Pid, 2, Clients), NewClients = lists:keydelete(Id, 1, Clients), - wait4clients(NewClients, Timeout - inets_lib:millisec_passed(Time)); + wait4clients(NewClients, Timeout - (now_ms() - Time)); {'DOWN', _MRef, process, Pid, Reason} -> {value, {Id, _, _}} = lists:keysearch(Pid, 2, Clients), ct:fail({bad_client_termination, Id, Reason}) @@ -2129,10 +1974,14 @@ "keep-alive" -> keep_alive end. -set_random_seed() -> - Unique = inets_time_compat:unique_integer(), +%% Time in milli seconds +now_ms() -> + {A,B,C} = erlang:now(), + A*1000000000+B*1000+(C div 1000). - A = erlang:phash2([make_ref(), self(), Unique]), +set_random_seed() -> + {_, _, Micros} = now(), + A = erlang:phash2([make_ref(), self(), Micros]), random:seed(A, A, A). diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_1_0.erl erlang-17.3-dfsg/lib/inets/test/httpd_1_0.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_1_0.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_1_0.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_1_1.erl erlang-17.3-dfsg/lib/inets/test/httpd_1_1.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_1_1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_1_1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,7 +23,7 @@ -include_lib("kernel/include/file.hrl"). -export([host/4, chunked/4, expect/4, range/4, if_test/5, trace/4, - head/4, mod_cgi_chunked_encoding_test/5, mod_esi_chunk_timeout/4]). + head/4, mod_cgi_chunked_encoding_test/5]). %% -define(all_keys_lower_case,true). -ifndef(all_keys_lower_case). @@ -274,15 +273,6 @@ [{statuscode, 200}]), mod_cgi_chunked_encoding_test(Type, Port, Host, Node, Rest). - -mod_esi_chunk_timeout(Type, Port, Host, Node) -> - ok = httpd_test_lib:verify_request(Type, Host, Port, Node, - "GET /cgi-bin/erl/httpd_example/chunk_timeout?input=20000 HTTP/1.1\r\n" - "Host:"++ Host ++"\r\n" - "\r\n", - [{statuscode, 200}, - {header, "warning"}]). - %%-------------------------------------------------------------------- %% Internal functions %%-------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_basic_SUITE.erl erlang-17.3-dfsg/lib/inets/test/httpd_basic_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_basic_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_basic_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_block.erl erlang-17.3-dfsg/lib/inets/test/httpd_block.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_block.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_block.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -293,7 +292,7 @@ end. make_name(Addr, Port) -> - httpd_util:make_name("httpd", Addr, Port, default). + httpd_util:make_name("httpd", Addr, Port). get_admin_state(_, _Host, Port) -> Name = make_name(undefined, Port), diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_load.erl erlang-17.3-dfsg/lib/inets/test/httpd_load.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_load.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_load.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_mod.erl erlang-17.3-dfsg/lib/inets/test/httpd_mod.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_mod.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_mod.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_mod_SUITE.erl erlang-17.3-dfsg/lib/inets/test/httpd_mod_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_mod_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_mod_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_poll.erl erlang-17.3-dfsg/lib/inets/test/httpd_poll.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_poll.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_poll.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/inets/test/httpd_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/inets/test/httpd_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -10,10 +10,5 @@ cgi_echo@exe@: cgi_echo@obj@ $(LD) $(CROSSLDFLAGS) -o cgi_echo cgi_echo@obj@ @LIBS@ -@IFEQ@ (@CC@, cl -nologo) -cgi_echo@obj@: cgi_echo.c - $(CC) /c /Focgi_echo@obj@ $(CFLAGS) cgi_echo.c -@ELSE@ cgi_echo@obj@: cgi_echo.c $(CC) -c -o cgi_echo@obj@ $(CFLAGS) cgi_echo.c -@ENDIF@ diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_SUITE_data/server_root/config/mime.types erlang-17.3-dfsg/lib/inets/test/httpd_SUITE_data/server_root/config/mime.types --- erlang-18.2-dfsg/lib/inets/test/httpd_SUITE_data/server_root/config/mime.types 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_SUITE_data/server_root/config/mime.types 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -text/html html -text/html htm -text/html shtml -image/gif gif diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_SUITE.erl erlang-17.3-dfsg/lib/inets/test/httpd_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -54,8 +53,6 @@ {group, https_basic}, {group, http_limit}, {group, https_limit}, - {group, http_custom}, - {group, https_custom}, {group, http_basic_auth}, {group, https_basic_auth}, {group, http_auth_api}, @@ -69,8 +66,7 @@ {group, http_security}, {group, https_security}, {group, http_reload}, - {group, https_reload}, - {group, http_mime_types} + {group, https_reload} ]. groups() -> @@ -79,8 +75,6 @@ {https_basic, [], basic_groups()}, {http_limit, [], [{group, limit}]}, {https_limit, [], [{group, limit}]}, - {http_custom, [], [{group, custom}]}, - {https_custom, [], [{group, custom}]}, {http_basic_auth, [], [{group, basic_auth}]}, {https_basic_auth, [], [{group, basic_auth}]}, {http_auth_api, [], [{group, auth_api}]}, @@ -95,9 +89,7 @@ {https_security, [], [{group, security}]}, {http_reload, [], [{group, reload}]}, {https_reload, [], [{group, reload}]}, - {http_mime_types, [], [alias_1_1, alias_1_0, alias_0_9]}, {limit, [], [max_clients_1_1, max_clients_1_0, max_clients_0_9]}, - {custom, [], [customize, add_default]}, {reload, [], [non_disturbing_reconfiger_dies, disturbing_reconfiger_dies, non_disturbing_1_1, @@ -117,7 +109,7 @@ {htaccess, [], [htaccess_1_1, htaccess_1_0, htaccess_0_9]}, {security, [], [security_1_1, security_1_0]}, %% Skip 0.9 as causes timing issus in test code {http_1_1, [], [host, chunked, expect, cgi, cgi_chunked_encoding_test, - trace, range, if_modified_since, mod_esi_chunk_timeout] ++ http_head() ++ http_get() ++ load()}, + trace, range, if_modified_since] ++ http_head() ++ http_get() ++ load()}, {http_1_0, [], [host, cgi, trace] ++ http_head() ++ http_get() ++ load()}, {http_0_9, [], http_head() ++ http_get() ++ load()} ]. @@ -135,11 +127,11 @@ get, %%actions, Add configuration so that this test mod_action esi, + ssi, content_length, bad_hex, missing_CR, max_header, - max_content_length, ipv6 ]. @@ -184,7 +176,6 @@ %%-------------------------------------------------------------------- init_per_group(Group, Config0) when Group == https_basic; Group == https_limit; - Group == https_custom; Group == https_basic_auth; Group == https_auth_api; Group == https_auth_api_dets; @@ -195,14 +186,12 @@ init_ssl(Group, Config0); init_per_group(Group, Config0) when Group == http_basic; Group == http_limit; - Group == http_custom; Group == http_basic_auth; Group == http_auth_api; Group == http_auth_api_dets; Group == http_auth_api_mnesia; Group == http_security; - Group == http_reload; - Group == http_mime_types + Group == http_reload -> ok = start_apps(Group), init_httpd(Group, [{type, ip_comm} | Config0]); @@ -246,8 +235,7 @@ Group == http_auth_api_mnesia; Group == http_htaccess; Group == http_security; - Group == http_reload; - Group == http_mime_types + Group == http_reload -> inets:stop(); end_per_group(Group, _Config) when Group == https_basic; @@ -563,6 +551,22 @@ end. %%------------------------------------------------------------------------- +ssi() -> + [{doc, "HTTP GET server side include test"}]. +ssi(Config) when is_list(Config) -> + Version = ?config(http_version, Config), + Host = ?config(host, Config), + Type = ?config(type, Config), + ok = httpd_test_lib:verify_request(?config(type, Config), Host, ?config(port, Config), + transport_opts(Type, Config), + ?config(node, Config), + http_request("GET /fsize.shtml ", Version, Host), + [{statuscode, 200}, + {header, "Content-Type", "text/html"}, + {header, "Date"}, + {header, "Server"}, + {version, Version}]). +%%------------------------------------------------------------------------- htaccess_1_1(Config) when is_list(Config) -> htaccess([{http_version, "HTTP/1.1"} | Config]). @@ -757,13 +761,6 @@ Config, [{statuscode, 200}, {no_header, "cache-control"}]). %%------------------------------------------------------------------------- -mod_esi_chunk_timeout(Config) when is_list(Config) -> - ok = httpd_1_1:mod_esi_chunk_timeout(?config(type, Config), - ?config(port, Config), - ?config(host, Config), - ?config(node, Config)). - -%%------------------------------------------------------------------------- cgi() -> [{doc, "Test mod_cgi"}]. @@ -859,24 +856,6 @@ ?config(node, Config), Requests). %%------------------------------------------------------------------------- -alias_1_1() -> - [{doc, "Test mod_alias"}]. - -alias_1_1(Config) when is_list(Config) -> - alias([{http_version, "HTTP/1.1"} | Config]). - -alias_1_0() -> - [{doc, "Test mod_alias"}]. - -alias_1_0(Config) when is_list(Config) -> - alias([{http_version, "HTTP/1.0"} | Config]). - -alias_0_9() -> - [{doc, "Test mod_alias"}]. - -alias_0_9(Config) when is_list(Config) -> - alias([{http_version, "HTTP/0.9"} | Config]). - alias() -> [{doc, "Test mod_alias"}]. @@ -935,6 +914,7 @@ Cb = ?config(version_cb, Config), Cb:trace(?config(type, Config), ?config(port, Config), ?config(host, Config), ?config(node, Config)). + %%------------------------------------------------------------------------- light() -> ["Test light load"]. @@ -992,43 +972,6 @@ {version, Version}]). %%------------------------------------------------------------------------- -customize() -> - [{doc, "Test filtering of headers with custom callback"}]. - -customize(Config) when is_list(Config) -> - Version = "HTTP/1.1", - Host = ?config(host, Config), - Type = ?config(type, Config), - ok = httpd_test_lib:verify_request(?config(type, Config), Host, - ?config(port, Config), - transport_opts(Type, Config), - ?config(node, Config), - http_request("GET /index.html ", Version, Host), - [{statuscode, 200}, - {header, "Content-Type", "text/html"}, - {header, "Date"}, - {no_header, "Server"}, - {version, Version}]). - -add_default() -> - [{doc, "Test adding default header with custom callback"}]. - -add_default(Config) when is_list(Config) -> - Version = "HTTP/1.1", - Host = ?config(host, Config), - Type = ?config(type, Config), - ok = httpd_test_lib:verify_request(?config(type, Config), Host, - ?config(port, Config), - transport_opts(Type, Config), - ?config(node, Config), - http_request("GET /index.html ", Version, Host), - [{statuscode, 200}, - {header, "Content-Type", "text/html"}, - {header, "Date", "Override-date"}, - {header, "X-Frame-Options"}, - {version, Version}]). - -%%------------------------------------------------------------------------- max_header() -> ["Denial Of Service (DOS) attack, prevented by max_header"]. max_header(Config) when is_list(Config) -> @@ -1036,22 +979,13 @@ Host = ?config(host, Config), case Version of "HTTP/0.9" -> - {skip, not_implemented}; + {skip, no_implemented}; _ -> dos_hostname(?config(type, Config), ?config(port, Config), Host, ?config(node, Config), Version, ?MAX_HEADER_SIZE) end. %%------------------------------------------------------------------------- -max_content_length() -> - ["Denial Of Service (DOS) attack, prevented by max_content_length"]. -max_content_length(Config) when is_list(Config) -> - Version = ?config(http_version, Config), - Host = ?config(host, Config), - garbage_content_length(?config(type, Config), ?config(port, Config), Host, - ?config(node, Config), Version). - -%%------------------------------------------------------------------------- security_1_1(Config) when is_list(Config) -> security([{http_version, "HTTP/1.1"} | Config]). @@ -1332,26 +1266,22 @@ CgiDir = filename:join(ServerRoot, "cgi-bin"), AuthDir = filename:join(ServerRoot, "auth"), PicsDir = filename:join(ServerRoot, "icons"), - ConfigDir = filename:join(ServerRoot, "config"), ok = file:make_dir(ServerRoot), ok = file:make_dir(DocRoot), ok = file:make_dir(CgiDir), ok = file:make_dir(AuthDir), ok = file:make_dir(PicsDir), - ok = file:make_dir(ConfigDir), DocSrc = filename:join(DataDir, "server_root/htdocs"), AuthSrc = filename:join(DataDir, "server_root/auth"), CgiSrc = filename:join(DataDir, "server_root/cgi-bin"), PicsSrc = filename:join(DataDir, "server_root/icons"), - ConfigSrc = filename:join(DataDir, "server_root/config"), inets_test_lib:copy_dirs(DocSrc, DocRoot), inets_test_lib:copy_dirs(AuthSrc, AuthDir), inets_test_lib:copy_dirs(CgiSrc, CgiDir), inets_test_lib:copy_dirs(PicsSrc, PicsDir), - inets_test_lib:copy_dirs(ConfigSrc, ConfigDir), Cgi = case test_server:os_type() of {win32, _} -> @@ -1372,27 +1302,24 @@ start_apps(Group) when Group == https_basic; Group == https_limit; - Group == https_custom; Group == https_basic_auth; Group == https_auth_api; Group == https_auth_api_dets; Group == https_auth_api_mnesia; - Group == https_htaccess; - Group == https_security; - Group == https_reload + Group == http_htaccess; + Group == http_security; + Group == http_reload -> inets_test_lib:start_apps([inets, asn1, crypto, public_key, ssl]); start_apps(Group) when Group == http_basic; Group == http_limit; - Group == http_custom; Group == http_basic_auth; Group == http_auth_api; Group == http_auth_api_dets; Group == http_auth_api_mnesia; - Group == http_htaccess; - Group == http_security; - Group == http_reload; - Group == http_mime_types-> + Group == https_htaccess; + Group == https_security; + Group == https_reload-> inets_test_lib:start_apps([inets]). server_start(_, HttpdConfig) -> @@ -1441,15 +1368,7 @@ server_config(https_reload, Config) -> [{keep_alive_timeout, 2}] ++ server_config(https, Config); server_config(http_limit, Config) -> - Conf = [{max_clients, 1}, - %% Make sure option checking code is run - {max_content_length, 100000002}] ++ server_config(http, Config), - ct:pal("Received message ~p~n", [Conf]), - Conf; -server_config(http_custom, Config) -> - [{customize, ?MODULE}] ++ server_config(http, Config); -server_config(https_custom, Config) -> - [{customize, ?MODULE}] ++ server_config(https, Config); + [{max_clients, 1}] ++ server_config(http, Config); server_config(https_limit, Config) -> [{max_clients, 1}] ++ server_config(https, Config); server_config(http_basic_auth, Config) -> @@ -1486,16 +1405,10 @@ server_config(https_security, Config) -> ServerRoot = ?config(server_root, Config), tl(auth_conf(ServerRoot)) ++ security_conf(ServerRoot) ++ server_config(https, Config); -server_config(http_mime_types, Config0) -> - Config1 = basic_conf() ++ server_config(http, Config0), - ServerRoot = ?config(server_root, Config0), - MimeTypesFile = filename:join([ServerRoot,"config", "mime.types"]), - [{mime_types, MimeTypesFile} | proplists:delete(mime_types, Config1)]; server_config(http, Config) -> ServerRoot = ?config(server_root, Config), [{port, 0}, - {socket_type, {ip_comm, [{nodelay, true}]}}, {server_name,"httpd_test"}, {server_root, ServerRoot}, {document_root, ?config(doc_root, Config)}, @@ -1517,14 +1430,13 @@ server_config(https, Config) -> PrivDir = ?config(priv_dir, Config), [{socket_type, {essl, - [{nodelay, true}, - {cacertfile, - filename:join(PrivDir, "public_key_cacert.pem")}, - {certfile, - filename:join(PrivDir, "public_key_cert.pem")}, - {keyfile, - filename:join(PrivDir, "public_key_cert_key.pem")} - ]}}] ++ proplists:delete(socket_type, server_config(http, Config)). + [{cacertfile, + filename:join(PrivDir, "public_key_cacert.pem")}, + {certfile, + filename:join(PrivDir, "public_key_cert.pem")}, + {keyfile, + filename:join(PrivDir, "public_key_cert_key.pem")} + ]}}] ++ server_config(http, Config). init_httpd(Group, Config0) -> Config1 = proplists:delete(port, Config0), @@ -1902,7 +1814,7 @@ ok = httpd_test_lib:verify_request(Type, Host, Port, Node, dos_hostname_request(TooLongHeader, Version), - [{statuscode, request_entity_too_large_code(Version)}, + [{statuscode, dos_code(Version)}, {version, Version}]). dos_hostname_request(Host, Version) -> dos_http_request("GET / ", Version, Host). @@ -1912,32 +1824,11 @@ dos_http_request(Request, Version, Host) -> Request ++ Version ++ "\r\nhost:" ++ Host ++ "\r\n\r\n". -request_entity_too_large_code("HTTP/1.0") -> +dos_code("HTTP/1.0") -> 403; %% 413 not defined in HTTP/1.0 -request_entity_too_large_code(_) -> +dos_code(_) -> 413. -length_required_code("HTTP/1.0") -> - 403; %% 411 not defined in HTTP/1.0 -length_required_code(_) -> - 411. - -garbage_content_length(Type, Port, Host, Node, Version) -> - ok = httpd_test_lib:verify_request(Type, Host, Port, Node, - garbage_content_length_request("GET / ", Version, Host, "aaaa"), - [{statuscode, length_required_code(Version)}, - {version, Version}]), - ok = httpd_test_lib:verify_request(Type, Host, Port, Node, - garbage_content_length_request("GET / ", Version, Host, - lists:duplicate($a, 100)), - [{statuscode, request_entity_too_large_code(Version)}, - {version, Version}]). - -garbage_content_length_request(Request, Version, Host, Garbage) -> - http_request(Request, Version, Host, - {"content-length:" ++ Garbage, "Body with garbage content length indicator"}). - - update_password(Node, ServerRoot, _Address, Port, AuthPrefix, Dir, Old, New)-> Directory = filename:join([ServerRoot, "htdocs", AuthPrefix ++ Dir]), rpc:call(Node, mod_auth, update_password, @@ -2054,14 +1945,3 @@ "tcp"; typestr(_) -> "ssl". - -response_header({"server", _}) -> - false; -response_header(Header) -> - {true, Header}. - -response_default_headers() -> - [%% Add new header - {"X-Frame-Options", "SAMEORIGIN"}, - %% Override built-in default - {"Date", "Override-date"}]. diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_test_data/server_root/conf/httpd.conf erlang-17.3-dfsg/lib/inets/test/httpd_test_data/server_root/conf/httpd.conf --- erlang-18.2-dfsg/lib/inets/test/httpd_test_data/server_root/conf/httpd.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_test_data/server_root/conf/httpd.conf 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_test_data/server_root/Makefile erlang-17.3-dfsg/lib/inets/test/httpd_test_data/server_root/Makefile --- erlang-18.2-dfsg/lib/inets/test/httpd_test_data/server_root/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_test_data/server_root/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_test_lib.erl erlang-17.3-dfsg/lib/inets/test/httpd_test_lib.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -235,17 +234,11 @@ _ -> ok end, - HList = http_response:header_list(Headers), - do_validate(HList, Options, N, P), - case lists:keysearch("warning", 1, HList) of - {value, _} -> - ok; - _ -> - check_body(RequestStr, StatusCode, - Headers#http_response_h.'content-type', - list_to_integer(Headers#http_response_h.'content-length'), - Body) - end. + do_validate(http_response:header_list(Headers), Options, N, P), + check_body(RequestStr, StatusCode, + Headers#http_response_h.'content-type', + list_to_integer(Headers#http_response_h.'content-length'), + Body). %-------------------------------------------------------------------- %% Internal functions @@ -300,9 +293,9 @@ {value, {LowerHeaderField, Value}} -> ok; false -> - ct:fail({wrong_header_field_value, LowerHeaderField, Header, Value}); + ct:fail({wrong_header_field_value, LowerHeaderField, Header}); _ -> - ct:fail({wrong_header_field_value, LowerHeaderField, Header, Value}) + ct:fail({wrong_header_field_value, LowerHeaderField, Header}) end, do_validate(Header, Rest, N, P); do_validate(Header,[{no_header, HeaderField}|Rest],N,P) -> diff -Nru erlang-18.2-dfsg/lib/inets/test/httpd_time_test.erl erlang-17.3-dfsg/lib/inets/test/httpd_time_test.erl --- erlang-18.2-dfsg/lib/inets/test/httpd_time_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/httpd_time_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2015. All Rights Reserved. +%% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -117,14 +116,13 @@ loop(Pollers, Timeout) -> d("loop -> entry when" "~n Timeout: ~p", [Timeout]), - Start = inets_time_compat:monotonic_time(), - + Start = t(), receive {'EXIT', Pid, {poller_stat_failure, SocketType, Host, Port, Time, Reason}} -> case is_poller(Pid, Pollers) of true -> error_msg("received unexpected exit from poller ~p~n" - "before completion of test " + "befor completion of test " "after ~p micro sec" "~n SocketType: ~p" "~n Host: ~p" @@ -135,7 +133,7 @@ false -> error_msg("received unexpected ~p from ~p" "befor completion of test", [Reason, Pid]), - loop(Pollers, Timeout - inets_lib:millisec_passed(Start)) + loop(Pollers, to(Timeout, Start)) end; {poller_stat_failure, Pid, {SocketType, Host, Port, Time, Reason}} -> @@ -414,6 +412,35 @@ end. +trash_the_rest(Socket, N) -> + receive + {ssl, Socket, Trash} -> + trash_the_rest(Socket, add(N,sz(Trash))); + {ssl_closed, Socket} -> + N; + {ssl_error, Socket, Error} -> + exit({connection_error, Error}); + + {tcp, Socket, Trash} -> + trash_the_rest(Socket, add(N,sz(Trash))); + {tcp_closed, Socket} -> + N; + {tcp_error, Socket, Error} -> + exit({connection_error, Error}) + + after 10000 -> + exit({connection_timed_out, N}) + end. + + +add(N1,N2) when is_integer(N1) andalso is_integer(N2) -> + N1 + N2; +add(N1,_) when is_integer(N1) -> + N1; +add(_,N2) when is_integer(N2) -> + N2. + + sz(L) when is_list(L) -> length(lists:flatten(L)); sz(B) when is_binary(B) -> @@ -478,6 +505,17 @@ %% ---------------------------------------------------------------- +to(To, Start) -> + To - (t() - Start). + +%% Time in milli seconds +t() -> + {A,B,C} = erlang:now(), + A*1000000000+B*1000+(C div 1000). + + +%% ---------------------------------------------------------------- + % close(Socket) -> diff -Nru erlang-18.2-dfsg/lib/inets/test/http_format_SUITE.erl erlang-17.3-dfsg/lib/inets/test/http_format_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/http_format_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/http_format_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,31 +1,44 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% %% -module(http_format_SUITE). +-author('ingela@erix.ericsson.se'). -include_lib("common_test/include/ct.hrl"). +-include("test_server_line.hrl"). -include("http_internal.hrl"). -%% Note: This directive should only be used in test suites. --compile(export_all). +%% Test server specific exports +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2, end_per_testcase/2]). + +%% Test cases must be exported. +-export([ chunk_decode/1, chunk_encode/1, + chunk_extensions_otp_6005/1, chunk_decode_otp_6264/1, + chunk_decode_empty_chunk_otp_6511/1, + chunk_decode_trailer/1, + http_response/1, http_request/1, validate_request_line/1, + esi_parse_headers/1, cgi_parse_headers/1, + is_absolut_uri/1, convert_netscapecookie_date/1, + check_content_length_encoding/1]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [{group, chunk}, http_response, http_request, @@ -38,8 +51,7 @@ [chunk_decode, chunk_encode, chunk_extensions_otp_6005, chunk_decode_otp_6264, chunk_decode_empty_chunk_otp_6511, - chunk_whitespace_suffix, - chunk_decode_trailer, chunk_max_headersize, chunk_max_bodysize, chunk_not_hex]}]. + chunk_decode_trailer]}]. init_per_suite(Config) -> Config. @@ -68,8 +80,12 @@ %% Test cases starts here. %%------------------------------------------------------------------------- -chunk_decode() -> - [{doc, "Test http_chunk:decode/3"}]. + +%%------------------------------------------------------------------------- +chunk_decode(doc) -> + ["Test http_chunk:decode/3"]; +chunk_decode(suite) -> + []; chunk_decode(Config) when is_list(Config) -> ReqHeaders = #http_request_h{'transfer-encoding' = "chunked"}, ChunkedBody = "A" ++ ?CRLF ++ "1234567890" ++ ?CRLF ++ "4" ++ @@ -92,11 +108,15 @@ ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE), {_, Body} = parse(Module, Function, Args, tl(NewChunkedBody)), - "1234567890HEJ!" = binary_to_list(Body). + "1234567890HEJ!" = binary_to_list(Body), + + ok. %%------------------------------------------------------------------------- -chunk_extensions_otp_6005() -> - [{doc, "Make sure so called extensions are ignored"}]. +chunk_extensions_otp_6005(doc) -> + ["Make sure so called extensions are ignored"]; +chunk_extensions_otp_6005(suite) -> + []; chunk_extensions_otp_6005(Config) when is_list(Config)-> ChunkedBody = "A;ignore this" ++ ?CRLF ++ "1234567890" ++ ?CRLF ++ "4" ++ ?CRLF ++ "HEJ!"++ ?CRLF ++ "0" ++ @@ -115,11 +135,14 @@ ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE), {_, NewBody} = parse(Module1, Function1, Args1, tl(ChunkedBody1)), - "1234567890HEJ!" = binary_to_list(NewBody). + "1234567890HEJ!" = binary_to_list(NewBody), + ok. %%------------------------------------------------------------------------- -chunk_decode_otp_6264() -> - [{doc, "Check that 0 in the body does not count as the last chunk"}]. +chunk_decode_otp_6264(doc) -> + ["Check that 0 in the body does not count as the last chunk"]; +chunk_decode_otp_6264(suite) -> + []; chunk_decode_otp_6264(Config) when is_list(Config)-> ChunkedBody = "A;ignore this" ++ ?CRLF ++ "1234567890" ++ ?CRLF ++ "4" ++ ?CRLF ++ "0123"++ ?CRLF ++ "0" ++ @@ -149,33 +172,27 @@ ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE), {_, NewBody} = parse(Module1, Function1, Args1, tl(NewChunkedBody1)), - "12345678900" = binary_to_list(NewBody). + "12345678900" = binary_to_list(NewBody), + + ok. %%------------------------------------------------------------------------- +chunk_decode_empty_chunk_otp_6511(doc) -> + [""]; +chunk_decode_empty_chunk_otp_6511(suite) -> + []; chunk_decode_empty_chunk_otp_6511(Config) when is_list(Config) -> ChunkedBody = "0" ++ ?CRLF ++ ?CRLF, {ok,{["content-length:0"],<<>>}} = http_chunk:decode(list_to_binary(ChunkedBody), - ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE). + ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE), + ok. %%------------------------------------------------------------------------- -chunk_whitespace_suffix() -> - [{doc, "Test whitespace after chunked length header"}]. -chunk_whitespace_suffix(Config) when is_list(Config) -> - ChunkedBody = "1a ; ignore-stuff-here" ++ ?CRLF ++ - "abcdefghijklmnopqrstuvwxyz" ++ ?CRLF ++ "10 " ++ ?CRLF - ++ "1234567890abcdef" ++ ?CRLF ++ "0 " ++ ?CRLF - ++ "some-footer:some-value" ++ ?CRLF - ++ "another-footer:another-value" ++ ?CRLF ++ ?CRLF, - {ok, {["content-length:42", "another-footer:another-value", - "some-footer:some-value", ""], - <<"abcdefghijklmnopqrstuvwxyz1234567890abcdef">>}} = - http_chunk:decode(list_to_binary(ChunkedBody), - ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE). - -%%------------------------------------------------------------------------- -chunk_decode_trailer() -> - [{doc,"Make sure trailers are handled correctly. Trailers should" - "become new headers"}]. +chunk_decode_trailer(doc) -> + ["Make sure trailers are handled correctly. Trailers should" + "become new headers"]; +chunk_decode_trailer(suite) -> + []; chunk_decode_trailer(Config) when is_list(Config)-> ChunkedBody = "1a; ignore-stuff-here" ++ ?CRLF ++ "abcdefghijklmnopqrstuvwxyz" ++ ?CRLF ++ "10" ++ ?CRLF @@ -231,79 +248,30 @@ ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE), {_, NewBody} = parse(Module1, Function1, Args1, tl(ChunkedBody3)), - "abcdefghijklmnopqrstuvwxyz1234567890abcdef" = binary_to_list(NewBody). + "abcdefghijklmnopqrstuvwxyz1234567890abcdef" = binary_to_list(NewBody), + + ok. %%------------------------------------------------------------------------- -chunk_encode() -> - [{doc, "Test http_chunk:encode/1 & http_chunk:encode_last/0"}]. +chunk_encode(doc) -> + ["Test http_chunk:encode/1 & http_chunk:encode_last/0"]; +chunk_encode(suite) -> + []; chunk_encode(Config) when is_list(Config) -> <<54, ?CR, ?LF, 102,111,111,98,97,114, ?CR, ?LF>> = http_chunk:encode(list_to_binary("foobar")), ["6", ?CR, ?LF,"foobar", ?CR, ?LF] = http_chunk:encode("foobar"), - <<$0, ?CR, ?LF, ?CR, ?LF >> = http_chunk:encode_last(). -%%------------------------------------------------------------------------- -chunk_max_headersize() -> - [{doc, "Test max header limit"}]. -chunk_max_headersize(Config) when is_list(Config) -> - ChunkedBody = "1a; ignore-stuff-here" ++ ?CRLF ++ - "abcdefghijklmnopqrstuvwxyz" ++ ?CRLF ++ "10" ++ ?CRLF - ++ "1234567890abcdef" ++ ?CRLF ++ "0" ++ ?CRLF - ++ "some-footer:some-value" ++ ?CRLF - ++ "another-footer:another-value" ++ ?CRLF ++ ?CRLF, - - {ok, {_, _}} = - http_chunk:decode(list_to_binary(ChunkedBody), - ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE), - - %% Too long in length header - {error,{header_too_long, {max, 1}}} = - (catch http_chunk:decode(list_to_binary(ChunkedBody), - ?HTTP_MAX_BODY_SIZE, 1)), - - %% Too long in extension field - {error,{header_too_long, {max, 10}}} = - (catch http_chunk:decode(list_to_binary(ChunkedBody), - ?HTTP_MAX_BODY_SIZE, 10)), - - %% Too long in trailer - {error,{header_too_long, {max, 30}}} = - (catch http_chunk:decode(list_to_binary(ChunkedBody), - ?HTTP_MAX_BODY_SIZE, 30)). -%%------------------------------------------------------------------------- -chunk_not_hex() -> - [{doc, "Test bad chunked length header"}]. -chunk_not_hex(Config) when is_list(Config) -> - ChunkedBody = "åäö; ignore-stuff-here" ++ ?CRLF ++ - "abcdefghijklmnopqrstuvwxyz" ++ ?CRLF ++ "10" ++ ?CRLF - ++ "1234567890abcdef" ++ ?CRLF ++ "0" ++ ?CRLF - ++ "some-footer:some-value" ++ ?CRLF - ++ "another-footer:another-value" ++ ?CRLF ++ ?CRLF, - {error,{chunk_size, "åäö"}} = - (catch http_chunk:decode(list_to_binary(ChunkedBody), - ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE)). -%%------------------------------------------------------------------------- -chunk_max_bodysize() -> - [{doc, "Test max body limit"}]. -chunk_max_bodysize(Config) when is_list(Config) -> - ChunkedBody = "1a; ignore-stuff-here" ++ ?CRLF ++ - "abcdefghijklmnopqrstuvwxyz" ++ ?CRLF ++ "10" ++ ?CRLF - ++ "1234567890abcdef" ++ ?CRLF ++ "0" ++ ?CRLF - ++ "some-footer:some-value" ++ ?CRLF - ++ "another-footer:another-value" ++ ?CRLF ++ ?CRLF, - {ok, {_, _}} = - http_chunk:decode(list_to_binary(ChunkedBody), - ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE), - - %% Too long body - {error,{body_too_big, {max, 10}}} = - (catch http_chunk:decode(list_to_binary(ChunkedBody), - 10, ?HTTP_MAX_HEADER_SIZE)). + <<$0, ?CR, ?LF, ?CR, ?LF >> = http_chunk:encode_last(), + ok. + %%------------------------------------------------------------------------- -http_response() -> - [{doc, "Test httpc_response:parse*. This test case will simulate that the " +http_response(doc) -> + ["Test httpc_response:parse*. This test case will simulate that the " "message will be recived a little at the time on a socket and the " - "package may be broken up into smaller parts at arbitrary point."}]. + "package may be broken up into smaller parts at arbitrary point."]; +http_response(suite) -> + []; http_response(Config) when is_list(Config) -> HttpHead1 = ["HTTP", "/1.1 ", "20", "0 ", "ok", [?CR, ?LF], @@ -371,10 +339,12 @@ [<<>>,Length1], HttpBody1)), ok. %%------------------------------------------------------------------------- -http_request() -> - [{doc, "Test httpd_request:parse* This test case will simulate that the " +http_request(doc) -> + ["Test httpd_request:parse* This test case will simulate that the " "message will be recived a little at the time on a socket and the " - "package may be broken up into smaller parts at arbitrary point."}]. + "package may be broken up into smaller parts at arbitrary point."]; +http_request(suite) -> + []; http_request(Config) when is_list(Config) -> HttpHead = ["GE", "T ", "http://www.erlang", ".org ", "HTTP", @@ -385,12 +355,10 @@ "http://www.erlang.org", "HTTP/1.1", {#http_request_h{host = "www.erlang.org", te = []}, - [{"te", []}, {"host", "www.erlang.org"}]}, <<>>} = + ["te: ","host:www.erlang.org"]}, <<>>} = parse(httpd_request, parse, [[{max_header, ?HTTP_MAX_HEADER_SIZE}, {max_version, ?HTTP_MAX_VERSION_STRING}, - {max_method, ?HTTP_MAX_METHOD_STRING}, - {max_content_length, ?HTTP_MAX_CONTENT_LENGTH} - ]], + {max_method, ?HTTP_MAX_METHOD_STRING}]], HttpHead), HttpHead1 = ["GET http://www.erlang.org HTTP/1.1" ++ @@ -401,9 +369,7 @@ {#http_request_h{}, []}, <<>>} = parse(httpd_request, parse, [[{max_header, ?HTTP_MAX_HEADER_SIZE}, {max_version, ?HTTP_MAX_VERSION_STRING}, - {max_method, ?HTTP_MAX_METHOD_STRING}, - {max_content_length, ?HTTP_MAX_CONTENT_LENGTH} - ]], HttpHead1), + {max_method, ?HTTP_MAX_METHOD_STRING}]], HttpHead1), HttpHead2 = ["GET http://www.erlang.org HTTP/1.1" ++ @@ -414,9 +380,7 @@ {#http_request_h{}, []}, <<>>} = parse(httpd_request, parse, [[{max_header, ?HTTP_MAX_HEADER_SIZE}, {max_version, ?HTTP_MAX_VERSION_STRING}, - {max_method, ?HTTP_MAX_METHOD_STRING}, - {max_content_length, ?HTTP_MAX_CONTENT_LENGTH} - ]], HttpHead2), + {max_method, ?HTTP_MAX_METHOD_STRING}]], HttpHead2), %% Note the following body is not related to the headers above HttpBody = ["\n\n dummy \n\n\n", @@ -436,12 +400,15 @@ NewBody1 = binary_to_list(parse (httpd_request, whole_body, - [<<>>, Length1], HttpBody1)). + [<<>>, Length1], HttpBody1)), + ok. %%------------------------------------------------------------------------- -validate_request_line() -> - [{doc, "Test httpd_request:validate/3. Makes sure you can not get past" +validate_request_line(doc) -> + ["Test httpd_request:validate/3. Makes sure you can not get past" " the server_root and that the request is recognized by the server" - " and protcol version."}]. + " and protcol version." ]; +validate_request_line(suite) -> + []; validate_request_line(Config) when is_list(Config) -> %% HTTP/0.9 only has GET requests @@ -494,12 +461,16 @@ NewForbiddenUri1 = "http://127.0.0.1:8888/../home/ingela/test.html", {error, {bad_request, {forbidden, NewForbiddenUri1}}} = - httpd_request:validate("GET", NewForbiddenUri1, "HTTP/1.1"). + httpd_request:validate("GET", NewForbiddenUri1, "HTTP/1.1"), + + ok. %%------------------------------------------------------------------------- -check_content_length_encoding() -> - [{doc, "Test http_request:headers/2. Check that the content-length is" - " encoded even when it is zero."}]. +check_content_length_encoding(doc) -> + ["Test http_request:headers/2. Check that the content-length is" + " encoded even when it is zero." ]; +check_content_length_encoding(suite) -> + []; check_content_length_encoding(Config) when is_list(Config) -> %% Check that the content-length is preserved. @@ -508,12 +479,16 @@ true = (string:str(Header1, "content-length: 123\r\n") > 0), %% Check that content-length=0 is handled correctly. Header2 = http_request:http_headers(#http_request_h{'content-length'="0"}), - true = (string:str(Header2, "content-length: 0\r\n") > 0). + true = (string:str(Header2, "content-length: 0\r\n") > 0), + + ok. %%------------------------------------------------------------------------- -esi_parse_headers() -> - [{doc, "Test httpd_esi:*. All header values are received in the same" - " erlang message."}]. +esi_parse_headers(doc) -> + ["Test httpd_esi:*. All header values are received in the same" + " erlang message."]; +esi_parse_headers(suite) -> + []; esi_parse_headers(Config) when is_list(Config) -> ESIResult = "content-type:text/html\r\ndate:Thu, 28 Oct 2004 07:57:43 " @@ -540,14 +515,16 @@ httpd_esi:handle_headers(Headers2), {proceed,"/foo/bar.html"} = - httpd_esi:handle_headers("location:/foo/bar.html\r\n"). + httpd_esi:handle_headers("location:/foo/bar.html\r\n"), + ok. %%-------------------------------------------------------------------- -cgi_parse_headers() -> - [{doc, "Test httpd_cgi:*. This test case will simulate that the " +cgi_parse_headers(doc) -> + ["Test httpd_cgi:*. This test case will simulate that the " "message will be recived a little at the time on a socket and the " - "package may be broken up into smaller parts at arbitrary point."}]. - + "package may be broken up into smaller parts at arbitrary point."]; +cgi_parse_headers(suite) -> + []; cgi_parse_headers(Config) when is_list(Config) -> CGIResult = ["content-type:text", "/html\ndate:Thu, 28 Oct 2004 07:57:43 " @@ -583,18 +560,26 @@ {ok,[{"content-type","text/html"}, {"connection","close"}, {"content-language","en"}, - {"age","4711"}], {200,"ok"}} = httpd_cgi:handle_headers(Headers3). + {"age","4711"}], {200,"ok"}} = httpd_cgi:handle_headers(Headers3), + + ok. + %%------------------------------------------------------------------------- -is_absolut_uri() -> - [{doc, "Test http_request:is_absolut_uri/1."}]. +is_absolut_uri(doc) -> + ["Test http_request:is_absolut_uri/1."]; +is_absolut_uri(suite) -> + []; is_absolut_uri(Config) when is_list(Config) -> true = http_request:is_absolut_uri("http://www.erlang.org"), true = http_request:is_absolut_uri("https://www.erlang.org"), false = http_request:is_absolut_uri("index.html"). + %%------------------------------------------------------------------------- -convert_netscapecookie_date() -> - [{doc, "Test http_util:convert_netscapecookie_date/1."}]. +convert_netscapecookie_date(doc) -> + ["Test http_util:convert_netscapecookie_date/1."]; +convert_netscapecookie_date(suite) -> + []; convert_netscapecookie_date(Config) when is_list(Config) -> {{2006,1,6},{8,59,38}} = http_util:convert_netscapecookie_date("Mon, 06-Jan-2006 08:59:38 GMT"), @@ -627,7 +612,9 @@ {{2006,12,12},{8,59,38}} = http_util:convert_netscapecookie_date("Sun 12-Dec-06 08:59:38 GMT"), {{2036,1,1},{8,0,1}} = - http_util:convert_netscapecookie_date("Tue Jan 01 08:00:01 2036 GMT"). + http_util:convert_netscapecookie_date("Tue Jan 01 08:00:01 2036 GMT"), + ok. + %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/inets/test/http_internal.hrl erlang-17.3-dfsg/lib/inets/test/http_internal.hrl --- erlang-18.2-dfsg/lib/inets/test/http_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/http_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2015. All Rights Reserved. +%% Copyright Ericsson AB 2002-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,7 +28,6 @@ -define(HTTP_MAX_URI_SIZE, nolimit). -define(HTTP_MAX_VERSION_STRING, 8). -define(HTTP_MAX_METHOD_STRING, 20). --define(HTTP_MAX_CONTENT_LENGTH, 100000000). -ifndef(HTTP_DEFAULT_SSL_KIND). -define(HTTP_DEFAULT_SSL_KIND, essl). diff -Nru erlang-18.2-dfsg/lib/inets/test/inets_app_test.erl erlang-17.3-dfsg/lib/inets/test/inets_app_test.erl --- erlang-18.2-dfsg/lib/inets/test/inets_app_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/inets_app_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2015. All Rights Reserved. +%% Copyright Ericsson AB 2002-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,6 +32,19 @@ %% Test server callbacks +init_per_testcase(undef_funcs, Config) -> + NewConfig = lists:keydelete(watchdog, 1, Config), + Dog = test_server:timetrap(inets_test_lib:minutes(10)), + + %% We need to check if there is a point to run this test. + %% On some platforms, crypto will not build, which in turn + %% causes ssl to not build (at this time, this will + %% change in the future). + %% So, we first check if we can start crypto, and if not, + %% we skip this test case! + ?ENSURE_STARTED(crypto), + + [{watchdog, Dog}| NewConfig]; init_per_testcase(_, Config) -> Config. @@ -42,7 +54,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all() -> - [fields, modules, exportall, app_depend]. + [fields, modules, exportall, app_depend, undef_funcs]. groups() -> []. @@ -232,6 +244,56 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +undef_funcs(suite) -> + []; +undef_funcs(doc) -> + []; +undef_funcs(Config) when is_list(Config) -> + App = inets, + AppFile = key1search(app_file, Config), + Mods = key1search(modules, AppFile), + Root = code:root_dir(), + LibDir = code:lib_dir(App), + EbinDir = filename:join([LibDir,"ebin"]), + XRefTestName = undef_funcs_make_name(App, xref_test_name), + {ok, XRef} = xref:start(XRefTestName), + ok = xref:set_default(XRef, + [{verbose,false},{warnings,false}]), + XRefName = undef_funcs_make_name(App, xref_name), + {ok, XRefName} = xref:add_release(XRef, Root, {name, XRefName}), + {ok, App} = xref:replace_application(XRef, App, EbinDir), + {ok, Undefs} = xref:analyze(XRef, undefined_function_calls), + xref:stop(XRef), + analyze_undefined_function_calls(Undefs, Mods, []). + +analyze_undefined_function_calls([], _, []) -> + ok; +analyze_undefined_function_calls([], _, AppUndefs) -> + exit({suite_failed, {undefined_function_calls, AppUndefs}}); +analyze_undefined_function_calls([{{Mod, _F, _A}, _C} = AppUndef|Undefs], + AppModules, AppUndefs) -> + %% Check that this module is our's + case lists:member(Mod,AppModules) of + true -> + {Calling,Called} = AppUndef, + {Mod1,Func1,Ar1} = Calling, + {Mod2,Func2,Ar2} = Called, + io:format("undefined function call: " + "~n ~w:~w/~w calls ~w:~w/~w~n", + [Mod1,Func1,Ar1,Mod2,Func2,Ar2]), + analyze_undefined_function_calls(Undefs, AppModules, + [AppUndef|AppUndefs]); + false -> + io:format("dropping ~p~n", [Mod]), + analyze_undefined_function_calls(Undefs, AppModules, AppUndefs) + end. + +%% This function is used simply to avoid cut-and-paste errors later... +undef_funcs_make_name(App, PostFix) -> + list_to_atom(atom_to_list(App) ++ "_" ++ atom_to_list(PostFix)). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + fail(Reason) -> exit({suite_failed, Reason}). diff -Nru erlang-18.2-dfsg/lib/inets/test/inets_appup_test.erl erlang-17.3-dfsg/lib/inets/test/inets_appup_test.erl --- erlang-18.2-dfsg/lib/inets/test/inets_appup_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/inets_appup_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/inets_internal.hrl erlang-17.3-dfsg/lib/inets/test/inets_internal.hrl --- erlang-18.2-dfsg/lib/inets/test/inets_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/inets_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/inets_socketwrap_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/inets/test/inets_socketwrap_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/inets/test/inets_socketwrap_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/inets_socketwrap_SUITE_data/Makefile.src 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2015-2015. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# - -CC = @CC@ -LD = @LD@ -CFLAGS = @CFLAGS@ -CROSSLDFLAGS = @CROSSLDFLAGS@ - -PROGS = setuid_socket_wrap@exe@ - -.PHONY: all -@IFEQ@ (@os@, linux-gnu) -all: $(PROGS) -@ELSE@ -all: -@ENDIF@ - -setuid_socket_wrap@exe@: setuid_socket_wrap@obj@ - $(LD) $(CROSSLDFLAGS) -o setuid_socket_wrap setuid_socket_wrap@obj@ @LIBS@ - -setuid_socket_wrap@obj@: setuid_socket_wrap.c - $(CC) -c $(CFLAGS) -o setuid_socket_wrap@obj@ setuid_socket_wrap.c diff -Nru erlang-18.2-dfsg/lib/inets/test/inets_socketwrap_SUITE_data/setuid_socket_wrap.c erlang-17.3-dfsg/lib/inets/test/inets_socketwrap_SUITE_data/setuid_socket_wrap.c --- erlang-18.2-dfsg/lib/inets/test/inets_socketwrap_SUITE_data/setuid_socket_wrap.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/inets_socketwrap_SUITE_data/setuid_socket_wrap.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,259 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ -/* - * setuid_socket_wrap.c - * - * ./a.out [-s [tag,][addr]:[port]]* [-d [tag,][addr]:[port]]* - * [-r [tag,]proto]* [-p erl_path]* -- program args - * - * Where: -s = stream socket, -d datagram socket and -r means raw socket. - * - */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -struct sock_list { - struct sock_list *next; - int fd; - int type; - int protocol; - struct sockaddr_in addr; - char *arg; -}; - -int parse_addr(addr, str) - struct sockaddr_in *addr; - char *str; -{ - int port = 0; - char *cp; - struct hostent *hp; - struct servent *se; - - if ((cp = strrchr(str, (int)':')) != NULL) - *cp++ = '\0'; - if (cp) { - if (!isdigit((int)cp[0])) { - if ((se = getservbyname(cp, "tcp")) != NULL) { - port = ntohs(se->s_port); - } else { - fprintf(stderr, "unknown port %s\n", cp); - return -1; - } - } else { - port = atoi(cp); - } - } - if (port < 0 || port > 0xffff) { - fprintf(stderr, "bad port number %d\n", port); - return -1; - } - - bzero(addr, sizeof(*addr)); - addr->sin_family = AF_INET; - addr->sin_port = htons(port); - if (*str == '\000') { - addr->sin_addr.s_addr = INADDR_ANY; - } else { - if ((addr->sin_addr.s_addr = inet_addr(str)) == INADDR_NONE) { - if ((hp = gethostbyname(str)) == NULL) { - fprintf(stderr, "\"%s\" unknown host or address!\n", str); - return -1; - } else { - bcopy(hp->h_addr_list[0], &addr->sin_addr.s_addr,hp->h_length); - } - } - } - return 0; -} - -struct sock_list *new_entry(type, argstr) - int type; - char *argstr; -{ - struct sock_list *sle; - char *cp; - - sle = (struct sock_list *)malloc(sizeof(struct sock_list)); - if (!sle) - return NULL; - sle->next = NULL; - sle->fd = -1; - - if ((cp = strchr(argstr, (int)',')) != NULL) { - *cp++ = '\0'; - sle->arg = argstr; - argstr = cp; - } else { - sle->arg = "-fd"; - } - sle->type = type; - switch (type) { - case SOCK_RAW: { - struct protoent *pe; - pe = getprotobyname(argstr); - if (!pe) { - fprintf(stderr, "Unknown protocol: %s\n", argstr); - free(sle); - return NULL; - } - sle->protocol = pe->p_proto; - break; - } - case SOCK_STREAM: - case SOCK_DGRAM: - sle->protocol = 0; - if (parse_addr(&sle->addr, argstr) < 0) { - free(sle); - return NULL; - } - break; - } - return sle; -} - -int open_socket(sle) - struct sock_list *sle; -{ - sle->fd = socket(AF_INET, sle->type, sle->protocol); - if (sle->fd < 0) { - perror("socket"); - return -1; - } - if (sle->type != SOCK_RAW) { -#if 0 - printf("binding fd %d to %s:%d\n", sle->fd, - inet_ntoa(sle->addr.sin_addr), ntohs(sle->addr.sin_port)); -#endif - if (bind(sle->fd, (struct sockaddr *)&sle->addr, sizeof(sle->addr))<0){ - perror("bind"); - close(sle->fd); - return -1; - } - } - return sle->fd; -} - -int main(argc, argv) - int argc; - char *argv[]; -{ - struct sock_list *sl = NULL, *sltmp = NULL; - int count = 0; - int c; - char *run_prog = NULL; - - while ((c = getopt(argc, argv, "s:d:r:p:")) != EOF) - switch (c) { - case 's': - sltmp = new_entry(SOCK_STREAM, optarg); - if (!sltmp) { - exit(1); - } - sltmp->next = sl; - sl = sltmp; - count++; - break; - case 'd': - sltmp = new_entry(SOCK_DGRAM, optarg); - if (!sltmp) { - exit(1); - } - sltmp->next = sl; - sl = sltmp; - count++; - break; - case 'r': - sltmp = new_entry(SOCK_RAW, optarg); - if (!sltmp) { - exit(1); - } - sltmp->next = sl; - sl = sltmp; - count++; - break; - case 'p': - run_prog = optarg; - break; - default: - exit(1); - } - argc -= optind; - argv += optind; - - for(sltmp = sl; sltmp != NULL; sltmp = sltmp->next) - if (open_socket(sltmp) < 0) { - fprintf(stderr, "failed to create socket!\n"); - exit(1); - } - - setuid(getuid()); - - { - int i; - char **newargv; - char *run_prog_name; - - newargv = (char **)malloc((1 + 2*count + argc + 1) * sizeof(char*)); - - if ((run_prog_name = strrchr(run_prog, (int)'/')) == NULL) - run_prog_name = run_prog; - else - run_prog_name++; - - i = 0; - newargv[i++] = run_prog_name; - - for (; argc; argc--, argv++, i++) - newargv[i] = *argv; - for(sltmp = sl; sltmp != NULL; ) { - char *fd_str = (char *)malloc(8); - if (!fd_str) exit(1); - sprintf(fd_str, "%d", sltmp->fd); - if (sltmp->arg && *(sltmp->arg)) - newargv[i++] = sltmp->arg; - newargv[i++] = fd_str; - sl = sltmp; - sltmp = sltmp->next; - free(sl); - } - newargv[i] = (char *)NULL; - execv(run_prog, newargv); - perror("exec"); - exit(1); - } - exit(0); -} diff -Nru erlang-18.2-dfsg/lib/inets/test/inets_socketwrap_SUITE.erl erlang-17.3-dfsg/lib/inets/test/inets_socketwrap_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/inets_socketwrap_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/inets_socketwrap_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,154 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(inets_socketwrap_SUITE). - --include_lib("common_test/include/ct.hrl"). --include("inets_test_lib.hrl"). - -%% Note: This directive should only be used in test suites. --compile(export_all). - -suite() -> - [{ct_hooks,[ts_install_cth]}]. - -all() -> - [start_httpd_fd, start_tftpd_fd]. - -init_per_suite(Config) -> - case os:type() of - {unix, linux} -> - Config; - _ -> - {skip, linux_feature} - end. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -init_per_testcase(Case, Config) -> - end_per_testcase(Case, Config), - Config. - -end_per_testcase(_, Config) -> - inets:stop(), - Config. - -%%------------------------------------------------------------------------- -start_httpd_fd() -> - [{doc, "Start/stop of httpd service with socket wrapper"}]. -start_httpd_fd(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - DataDir = ?config(data_dir, Config), - HttpdConf = [{port, 80}, {ipfamily, inet}, - {server_name, "httpd_fd_test"}, {server_root, PrivDir}, - {document_root, PrivDir}, {bind_address, any}], - case setup_node_info(node()) of - {skip, _} = Skip -> - Skip; - {Node, NodeArg} -> - InetPort = inets_test_lib:inet_port(node()), - ct:pal("Node: ~p Port ~p~n", [Node, InetPort]), - Wrapper = filename:join(DataDir, "setuid_socket_wrap"), - Cmd = Wrapper ++ - " -s -httpd_80,0:" ++ integer_to_list(InetPort) - ++ " -p " ++ os:find_executable("erl") ++ - " -- " ++ NodeArg, - ct:pal("cmd: ~p~n", [Cmd]), - case open_port({spawn, Cmd}, [stderr_to_stdout]) of - Port when is_port(Port) -> - wait_node_up(Node, 10), - ct:pal("~p", [rpc:call(Node, init, get_argument, [httpd_80])]), - ok = rpc:call(Node, inets, start, []), - {ok, Pid} = rpc:call(Node, inets, start, [httpd, HttpdConf]), - [{port, InetPort}] = rpc:call(Node, httpd, info, [Pid, [port]]), - rpc:call(Node, erlang, halt, []); - _ -> - ct:fail(open_port_failed) - end - end. -%%------------------------------------------------------------------------- -start_tftpd_fd() -> - [{doc, "Start/stop of tfpd service with socket wrapper"}]. -start_tftpd_fd(Config) when is_list(Config) -> - DataDir = ?config(data_dir, Config), - case setup_node_info(node()) of - {skip, _} = Skip -> - Skip; - {Node, NodeArg} -> - InetPort = inets_test_lib:inet_port(node()), - ct:pal("Node: ~p~n", [Node]), - Wrapper = filename:join(DataDir, "setuid_socket_wrap"), - Cmd = Wrapper ++ - " -s -tftpd_69,0:" ++ integer_to_list(InetPort) - ++ " -p " ++ os:find_executable("erl") ++ - " -- " ++ NodeArg, - ct:pal("cmd: ~p~n", [Cmd]), - case open_port({spawn, Cmd}, [stderr_to_stdout]) of - Port when is_port(Port) -> - wait_node_up(Node, 10), - ct:pal("~p", [rpc:call(Node, init, get_argument, [tftpd_69])]), - ok = rpc:call(Node, inets, start, []), - {ok, Pid} = rpc:call(Node, inets, start, - [tftpd,[{host, "localhost"}]]), - {ok, Info} = rpc:call(Node, tftp, info, [Pid]), - {value,{port, InetPort}} = lists:keysearch(port, 1, Info), - rpc:call(Node, erlang, halt, []); - _ -> - ct:fail(open_port_failed) - end - end. -%%------------------------------------------------------------------------- -%% Internal functions -%%------------------------------------------------------------------------- -setup_node_info(nonode@nohost) -> - {skip, needs_distributed_node}; -setup_node_info(Node) -> - Static = "-detached -noinput", - Name = "inets_fd_test", - NameSw = case net_kernel:longnames() of - false -> "-sname "; - _ -> "-name " - end, - StrNode = - Static ++ " " - ++ NameSw ++ " " ++ Name ++ " " - ++ "-setcookie " ++ atom_to_list(erlang:get_cookie()), - [_, Location] = string:tokens(atom_to_list(Node), "$@"), - TestNode = Name ++ "@" ++ Location, - {list_to_atom(TestNode), StrNode}. - -wait_node_up(Node, 0) -> - ct:fail({failed_to_start_node, Node}); -wait_node_up(Node, N) -> - ct:pal("(Node ~p: net_adm:ping(~p)~n", [node(), Node]), - case net_adm:ping(Node) of - pong -> - ok; - pang -> - ct:sleep(5000), - wait_node_up(Node, N-1) - end. diff -Nru erlang-18.2-dfsg/lib/inets/test/inets_SUITE.erl erlang-17.3-dfsg/lib/inets/test/inets_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/inets_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/inets_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -21,6 +20,7 @@ -module(inets_SUITE). -include_lib("common_test/include/ct.hrl"). +-include("test_server_line.hrl"). -include("inets_test_lib.hrl"). %% Note: This directive should only be used in test suites. @@ -36,12 +36,8 @@ groups() -> [{services_test, [], - [start_inets, - start_httpc, - start_httpd, - start_ftpc, - start_tftpd - ]}, + [start_inets, start_httpc, start_httpd, start_ftpc, + start_tftpd]}, {app_test, [], [{inets_app_test, all}]}, {appup_test, [], [{inets_appup_test, all}]}]. @@ -51,6 +47,9 @@ end_per_group(_GroupName, Config) -> Config. + + + %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config %% Config - [tuple()] @@ -103,8 +102,14 @@ %% Test cases starts here. %%------------------------------------------------------------------------- -start_inets() -> - [{doc, "Test inets API functions"}]. + + +%%------------------------------------------------------------------------- + +start_inets(doc) -> + ["Test inets API functions"]; +start_inets(suite) -> + []; start_inets(Config) when is_list(Config) -> [_|_] = inets:service_names(), @@ -128,85 +133,134 @@ ok = inets:start(permanent), ok = inets:stop(). + %%------------------------------------------------------------------------- -start_httpc() -> - [{doc, "Start/stop of httpc service"}]. +start_httpc(doc) -> + ["Start/stop of httpc service"]; +start_httpc(suite) -> + []; start_httpc(Config) when is_list(Config) -> process_flag(trap_exit, true), + tsp("start_httpc -> entry with" + "~n Config: ~p", [Config]), + PrivDir = ?config(priv_dir, Config), + tsp("start_httpc -> start (empty) inets"), ok = inets:start(), + + tsp("start_httpc -> start httpc (as inets service) with profile foo"), {ok, Pid0} = inets:start(httpc, [{profile, foo}]), + tsp("start_httpc -> check running services"), Pids0 = [ServicePid || {_, ServicePid} <- inets:services()], true = lists:member(Pid0, Pids0), [_|_] = inets:services_info(), + tsp("start_httpc -> stop httpc"), inets:stop(httpc, Pid0), + tsp("start_httpc -> sleep some"), test_server:sleep(100), + tsp("start_httpc -> check running services"), Pids1 = [ServicePid || {_, ServicePid} <- inets:services()], false = lists:member(Pid0, Pids1), + tsp("start_httpc -> start httpc (stand-alone) with profile bar"), {ok, Pid1} = inets:start(httpc, [{profile, bar}], stand_alone), + tsp("start_httpc -> check running services"), Pids2 = [ServicePid || {_, ServicePid} <- inets:services()], false = lists:member(Pid1, Pids2), + tsp("start_httpc -> stop httpc"), ok = inets:stop(stand_alone, Pid1), receive {'EXIT', Pid1, shutdown} -> ok after 100 -> - ct:fail(stand_alone_not_shutdown) + tsf(stand_alone_not_shutdown) end, + tsp("start_httpc -> stop inets"), ok = inets:stop(), + tsp("start_httpc -> unload inets"), application:load(inets), + + tsp("start_httpc -> set inets environment (httpc profile foo)"), application:set_env(inets, services, [{httpc,[{profile, foo}, {data_dir, PrivDir}]}]), + + tsp("start_httpc -> start inets"), ok = inets:start(), + tsp("start_httpc -> check running services"), (?NUM_DEFAULT_SERVICES + 1) = length(inets:services()), + tsp("start_httpc -> unset inets env"), application:unset_env(inets, services), + + tsp("start_httpc -> stop inets"), ok = inets:stop(), + + tsp("start_httpc -> start (empty) inets"), ok = inets:start(), + tsp("start_httpc -> start inets httpc service with profile foo"), {ok, Pid3} = inets:start(httpc, [{profile, foo}]), + + tsp("start_httpc -> stop inets service httpc with profile foo"), ok = inets:stop(httpc, foo), + + tsp("start_httpc -> check running services"), Pids3 = [ServicePid || {_, ServicePid} <- inets:services()], false = lists:member(Pid3, Pids3), - ok = inets:stop(). + + tsp("start_httpc -> stop inets"), + ok = inets:stop(), + + tsp("start_httpc -> done"), + ok. + %%------------------------------------------------------------------------- -start_httpd() -> - [{doc, "Start/stop of httpd service"}]. +start_httpd(doc) -> + ["Start/stop of httpd service"]; +start_httpd(suite) -> + []; start_httpd(Config) when is_list(Config) -> process_flag(trap_exit, true), + i("start_httpd -> entry with" + "~n Config: ~p", [Config]), PrivDir = ?config(priv_dir, Config), HttpdConf = [{server_name, "httpd_test"}, {server_root, PrivDir}, - {document_root, PrivDir}, {bind_address, any}], + {document_root, PrivDir}, {bind_address, "localhost"}], + i("start_httpd -> start inets"), ok = inets:start(), + + i("start_httpd -> start httpd service"), {ok, Pid0} = inets:start(httpd, [{port, 0}, {ipfamily, inet} | HttpdConf]), Pids0 = [ServicePid || {_, ServicePid} <- inets:services()], true = lists:member(Pid0, Pids0), [_|_] = inets:services_info(), + i("start_httpd -> stop httpd service"), inets:stop(httpd, Pid0), test_server:sleep(500), Pids1 = [ServicePid || {_, ServicePid} <- inets:services()], false = lists:member(Pid0, Pids1), + i("start_httpd -> start (stand-alone) httpd service"), {ok, Pid1} = inets:start(httpd, [{port, 0}, {ipfamily, inet} | HttpdConf], stand_alone), Pids2 = [ServicePid || {_, ServicePid} <- inets:services()], false = lists:member(Pid1, Pids2), + i("start_httpd -> stop (stand-alone) httpd service"), ok = inets:stop(stand_alone, Pid1), receive {'EXIT', Pid1, shutdown} -> @@ -214,6 +268,7 @@ after 100 -> test_server:fail(stand_alone_not_shutdown) end, + i("start_httpd -> stop inets"), ok = inets:stop(), File0 = filename:join(PrivDir, "httpd.conf"), {ok, Fd0} = file:open(File0, [write]), @@ -221,12 +276,17 @@ ok = file:write(Fd0, Str), file:close(Fd0), + i("start_httpd -> [application] load inets"), application:load(inets), + i("start_httpd -> [application] set httpd services env with proplist-file"), application:set_env(inets, services, [{httpd, [{proplist_file, File0}]}]), + i("start_httpd -> start inets"), ok = inets:start(), (?NUM_DEFAULT_SERVICES + 1) = length(inets:services()), + i("start_httpd -> [application] unset services env"), application:unset_env(inets, services), + i("start_httpd -> stop inets"), ok = inets:stop(), File1 = filename:join(PrivDir, "httpd_apache.conf"), @@ -239,46 +299,68 @@ file:write(Fd1, "Port 0\r\n"), file:close(Fd1), + i("start_httpd -> [application] load inets"), application:load(inets), + i("start_httpd -> [application] set httpd services env with file"), application:set_env(inets, services, [{httpd, [{file, File1}]}]), + i("start_httpd -> start inets"), ok = inets:start(), (?NUM_DEFAULT_SERVICES + 1) = length(inets:services()), + i("start_httpd -> [application] unset services env"), application:unset_env(inets, services), + i("start_httpd -> stop inets"), ok = inets:stop(), %% OLD format + i("start_httpd -> [application] load inets"), application:load(inets), + i("start_httpd -> [application] set httpd services OLD env"), application:set_env(inets, services, [{httpd, File1}]), + i("start_httpd -> start inets"), ok = inets:start(), (?NUM_DEFAULT_SERVICES + 1) = length(inets:services()), + i("start_httpd -> [application] unset services enc"), application:unset_env(inets, services), + i("start_httpd -> stop inets"), ok = inets:stop(), + + i("start_httpd -> start inets"), ok = inets:start(), + i("start_httpd -> try (and fail) start httpd service - server_name"), {error, {missing_property, server_name}} = inets:start(httpd, [{port, 0}, {server_root, PrivDir}, {document_root, PrivDir}, {bind_address, "localhost"}]), + i("start_httpd -> try (and fail) start httpd service - missing document_root"), {error, {missing_property, document_root}} = inets:start(httpd, [{port, 0}, {server_name, "httpd_test"}, {server_root, PrivDir}, {bind_address, "localhost"}]), + i("start_httpd -> try (and fail) start httpd service - missing server_root"), {error, {missing_property, server_root}} = inets:start(httpd, [{port, 0}, {server_name, "httpd_test"}, {document_root, PrivDir}, {bind_address, "localhost"}]), + i("start_httpd -> try (and fail) start httpd service - missing port"), {error, {missing_property, port}} = inets:start(httpd, HttpdConf), - ok = inets:stop(). + i("start_httpd -> stop inets"), + ok = inets:stop(), + i("start_httpd -> done"), + ok. + %%------------------------------------------------------------------------- start_ftpc(doc) -> - [{doc, "Start/stop of ftpc service"}]; + ["Start/stop of ftpc service"]; +start_ftpc(suite) -> + []; start_ftpc(Config) when is_list(Config) -> process_flag(trap_exit, true), ok = inets:start(), @@ -306,7 +388,7 @@ {'EXIT', Pid1, shutdown} -> ok after 100 -> - ct:fail(stand_alone_not_shutdown) + tsf(stand_alone_not_shutdown) end, ok = inets:stop(), ok; @@ -318,11 +400,15 @@ throw:{error, not_found} -> {skip, "No available FTP servers"} end. + + %%------------------------------------------------------------------------- -start_tftpd() -> - [{doc, "Start/stop of tfpd service"}]. +start_tftpd(doc) -> + ["Start/stop of tfpd service"]; +start_tftpd(suite) -> + []; start_tftpd(Config) when is_list(Config) -> process_flag(trap_exit, true), ok = inets:start(), @@ -354,12 +440,16 @@ application:unset_env(inets, services), ok = inets:stop(). + %%------------------------------------------------------------------------- -httpd_reload() -> - [{doc, "Reload httpd configuration without restarting service"}]. +httpd_reload(doc) -> + ["Reload httpd configuration without restarting service"]; +httpd_reload(suite) -> + []; httpd_reload(Config) when is_list(Config) -> process_flag(trap_exit, true), + i("httpd_reload -> starting"), PrivDir = ?config(priv_dir, Config), DataDir = ?config(data_dir, Config), HttpdConf = [{server_name, "httpd_test"}, @@ -367,18 +457,23 @@ {document_root, PrivDir}, {bind_address, "localhost"}], + i("httpd_reload -> start inets"), + ok = inets:start(), test_server:sleep(5000), + i("httpd_reload -> inets started - start httpd service"), - {ok, Pid0} = inets:start(httpd, [{port, 0}, - {ipfamily, inet} | HttpdConf]), + {ok, Pid0} = inets:start(httpd, [{port, 0}, {ipfamily, inet} | HttpdConf]), test_server:sleep(5000), + i("httpd_reload -> httpd service started (~p) - get port", [Pid0]), [{port, Port0}] = httpd:info(Pid0, [port]), test_server:sleep(5000), + i("httpd_reload -> Port: ~p - get document root", [Port0]), [{document_root, PrivDir}] = httpd:info(Pid0, [document_root]), test_server:sleep(5000), + i("httpd_reload -> document root: ~p - reload config", [PrivDir]), ok = httpd:reload_config([{port, Port0}, {ipfamily, inet}, {server_name, "httpd_test"}, @@ -386,8 +481,11 @@ {document_root, DataDir}, {bind_address, "localhost"}], non_disturbing), test_server:sleep(5000), + io:format("~w:~w:httpd_reload - reloaded - get document root~n", [?MODULE, ?LINE]), + [{document_root, DataDir}] = httpd:info(Pid0, [document_root]), test_server:sleep(5000), + i("httpd_reload -> document root: ~p - reload config", [DataDir]), ok = httpd:reload_config([{port, Port0}, {ipfamily, inet}, {server_name, "httpd_test"}, @@ -440,5 +538,36 @@ ok = inets:stop(httpd, Pid1), application:unset_env(inets, services), - ok = inets:stop(). + ok = inets:stop(), + i("httpd_reload -> starting"), + ok. + + +tsf(Reason) -> + test_server:fail(Reason). + +tsp(F) -> + tsp(F, []). +tsp(F, A) -> + Timestamp = formated_timestamp(), + test_server:format("** ~s ** ~p ~p:" ++ F ++ "~n", [Timestamp, self(), ?MODULE | A]). + +i(F) -> + i(F, []). + +i(F, A) -> + Timestamp = formated_timestamp(), + io:format("*** ~s ~w:" ++ F ++ "~n", [Timestamp, ?MODULE | A]). + +formated_timestamp() -> + format_timestamp( os:timestamp() ). + +format_timestamp({_N1, _N2, N3} = Now) -> + {Date, Time} = calendar:now_to_datetime(Now), + {YYYY,MM,DD} = Date, + {Hour,Min,Sec} = Time, + FormatDate = + io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w", + [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]), + lists:flatten(FormatDate). diff -Nru erlang-18.2-dfsg/lib/inets/test/inets_sup_SUITE.erl erlang-17.3-dfsg/lib/inets/test/inets_sup_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/inets_sup_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/inets_sup_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,14 +22,14 @@ -include_lib("common_test/include/ct.hrl"). + %% Note: This directive should only be used in test suites. -compile(export_all). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [default_tree, ftpc_worker, tftpd_worker, - httpd_subtree, httpd_subtree_profile, + [default_tree, ftpc_worker, tftpd_worker, httpd_subtree, httpc_subtree]. groups() -> @@ -42,29 +41,54 @@ end_per_group(_GroupName, Config) -> Config. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config) -> Config +%% Config - [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Description: Initiation before the whole suite +%% +%% Note: This function is free to add any key/value pairs to the Config +%% variable, but should NOT alter/remove any existing entries. +%%-------------------------------------------------------------------- init_per_suite(Config) -> Config. +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config) -> _ +%% Config - [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Description: Cleanup after the whole suite +%%-------------------------------------------------------------------- end_per_suite(_) -> inets:stop(), ok. +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(Case, Config) -> Config +%% Case - atom() +%% Name of the test case that is about to be run. +%% Config - [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% +%% Description: Initiation before each test case +%% +%% Note: This function is free to add any key/value pairs to the Config +%% variable, but should NOT alter/remove any existing entries. +%%-------------------------------------------------------------------- init_per_testcase(httpd_subtree, Config) -> Dog = test_server:timetrap(?t:minutes(1)), NewConfig = lists:keydelete(watchdog, 1, Config), PrivDir = ?config(priv_dir, Config), - Dir = filename:join(PrivDir, "root"), - ok = file:make_dir(Dir), - + SimpleConfig = [{port, 0}, {server_name,"www.test"}, {modules, [mod_get]}, - {server_root, Dir}, - {document_root, Dir}, + {server_root, PrivDir}, + {document_root, PrivDir}, {bind_address, any}, {ipfamily, inet}], try - inets:stop(), inets:start(), inets:start(httpd, SimpleConfig), [{watchdog, Dog} | NewConfig] @@ -73,33 +97,7 @@ inets:stop(), exit({failed_starting_inets, Reason}) end; - -init_per_testcase(httpd_subtree_profile, Config) -> - Dog = test_server:timetrap(?t:minutes(1)), - NewConfig = lists:keydelete(watchdog, 1, Config), - PrivDir = ?config(priv_dir, Config), - Dir = filename:join(PrivDir, "root"), - ok = file:make_dir(Dir), - - SimpleConfig = [{port, 0}, - {server_name,"www.test"}, - {modules, [mod_get]}, - {server_root, Dir}, - {document_root, Dir}, - {bind_address, any}, - {profile, test_profile}, - {ipfamily, inet}], - try - inets:stop(), - inets:start(), - {ok, _} = inets:start(httpd, SimpleConfig), - [{watchdog, Dog} | NewConfig] - catch - _:Reason -> - inets:stop(), - exit({failed_starting_inets, Reason}) - end; - + init_per_testcase(_Case, Config) -> Dog = test_server:timetrap(?t:minutes(5)), @@ -108,13 +106,20 @@ ok = inets:start(), [{watchdog, Dog} | NewConfig]. -end_per_testcase(Case, Config) when Case == httpd_subtree; - Case == httpd_subtree_profile -> + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(Case, Config) -> _ +%% Case - atom() +%% Name of the test case that is about to be run. +%% Config - [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Description: Cleanup after each test case +%%-------------------------------------------------------------------- +end_per_testcase(httpd_subtree, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), - PrivDir = ?config(priv_dir, Config), - Dir = filename:join(PrivDir, "root"), - inets_test_lib:del_dirs(Dir), + PrivDir = ?config(priv_dir, Config), + inets_test_lib:del_dirs(PrivDir), ok; end_per_testcase(_, Config) -> @@ -126,9 +131,16 @@ %%------------------------------------------------------------------------- %% Test cases starts here. %%------------------------------------------------------------------------- -default_tree() -> - [{doc, "Makes sure the correct processes are started and linked," - "in the default case."}]. + + +%%------------------------------------------------------------------------- +%% default_tree +%%------------------------------------------------------------------------- +default_tree(doc) -> + ["Makes sure the correct processes are started and linked," + "in the default case."]; +default_tree(suite) -> + []; default_tree(Config) when is_list(Config) -> TopSupChildren = supervisor:which_children(inets_sup), 4 = length(TopSupChildren), @@ -161,9 +173,15 @@ ok. -ftpc_worker() -> - [{doc, "Makes sure the ftp worker processes are added and removed " - "appropriatly to/from the supervison tree."}]. + +%%------------------------------------------------------------------------- +%% ftpc_worker +%%------------------------------------------------------------------------- +ftpc_worker(doc) -> + ["Makes sure the ftp worker processes are added and removed " + "appropriatly to/from the supervison tree."]; +ftpc_worker(suite) -> + []; ftpc_worker(Config) when is_list(Config) -> [] = supervisor:which_children(ftp_sup), try @@ -189,8 +207,14 @@ {skip, "No available FTP servers"} end. -tftpd_worker() -> - [{doc, "Makes sure the tftp sub tree is correct."}]. + +%%------------------------------------------------------------------------- +%% tftpd_worker +%%------------------------------------------------------------------------- +tftpd_worker(doc) -> + ["Makes sure the tftp sub tree is correct."]; +tftpd_worker(suite) -> + []; tftpd_worker(Config) when is_list(Config) -> [] = supervisor:which_children(tftp_sup), {ok, Pid0} = inets:start(tftpd, [{host, inets_test_lib:hostname()}, @@ -204,63 +228,22 @@ [] = supervisor:which_children(tftp_sup), ok. -httpd_subtree() -> - [{doc, "Makes sure the httpd sub tree is correct."}]. -httpd_subtree(Config) when is_list(Config) -> - do_httpd_subtree(Config, default). - -httpd_subtree_profile(doc) -> - ["Makes sure the httpd sub tree is correct when using a profile"]; -httpd_subtree_profile(Config) when is_list(Config) -> - do_httpd_subtree(Config, test_profile). - -httpc_subtree() -> - [{doc, "Makes sure the httpd sub tree is correct."}]. -httpc_subtree(Config) when is_list(Config) -> - {ok, Foo} = inets:start(httpc, [{profile, foo}]), - - {ok, Bar} = inets:start(httpc, [{profile, bar}], stand_alone), - - HttpcChildren = supervisor:which_children(httpc_profile_sup), - - {value, {httpc_manager, _, worker, [httpc_manager]}} = - lists:keysearch(httpc_manager, 1, HttpcChildren), - - {value,{{httpc,foo}, _Pid, worker, [httpc_manager]}} = - lists:keysearch({httpc, foo}, 1, HttpcChildren), - false = lists:keysearch({httpc, bar}, 1, HttpcChildren), - - inets:stop(httpc, Foo), - exit(Bar, normal). %%------------------------------------------------------------------------- -%% Internal functions +%% httpd_subtree %%------------------------------------------------------------------------- - -verify_child(Parent, Child, Type) -> - Children = supervisor:which_children(Parent), - verify_child(Children, Parent, Child, Type). - -verify_child([], Parent, Child, _Type) -> - {error, {child_not_found, Child, Parent}}; -verify_child([{Id, _Pid, Type2, Mods}|Children], Parent, Child, Type) -> - case lists:member(Child, Mods) of - true when (Type2 =:= Type) -> - {ok, Id}; - true when (Type2 =/= Type) -> - {error, {wrong_type, Type2, Child, Parent}}; - false -> - verify_child(Children, Parent, Child, Type) - end. - -do_httpd_subtree(_Config, Profile) -> - %% Check that we have the httpd top supervisor +httpd_subtree(doc) -> + ["Makes sure the httpd sub tree is correct."]; +httpd_subtree(suite) -> + []; +httpd_subtree(Config) when is_list(Config) -> + %% Check that we have the httpd top supervisor {ok, _} = verify_child(inets_sup, httpd_sup, supervisor), %% Check that we have the httpd instance supervisor {ok, Id} = verify_child(httpd_sup, httpd_instance_sup, supervisor), - {httpd_instance_sup, Addr, Port, Profile} = Id, - Instance = httpd_util:make_name("httpd_instance_sup", Addr, Port, Profile), + {httpd_instance_sup, Addr, Port} = Id, + Instance = httpd_util:make_name("httpd_instance_sup", Addr, Port), %% Check that we have the expected httpd instance children {ok, _} = verify_child(Instance, httpd_connection_sup, supervisor), @@ -269,7 +252,7 @@ {ok, _} = verify_child(Instance, httpd_manager, worker), %% Check that the httpd instance acc supervisor has children - InstanceAcc = httpd_util:make_name("httpd_acceptor_sup", Addr, Port, Profile), + InstanceAcc = httpd_util:make_name("httpd_acceptor_sup", Addr, Port), case supervisor:which_children(InstanceAcc) of [_ | _] -> ok; @@ -280,7 +263,7 @@ %% Check that the httpd instance misc supervisor has no children io:format("httpd_subtree -> verify misc~n", []), - InstanceMisc = httpd_util:make_name("httpd_misc_sup", Addr, Port, Profile), + InstanceMisc = httpd_util:make_name("httpd_misc_sup", Addr, Port), case supervisor:which_children(InstanceMisc) of [] -> ok; @@ -290,3 +273,45 @@ end, io:format("httpd_subtree -> done~n", []), ok. + + +verify_child(Parent, Child, Type) -> + Children = supervisor:which_children(Parent), + verify_child(Children, Parent, Child, Type). + +verify_child([], Parent, Child, _Type) -> + {error, {child_not_found, Child, Parent}}; +verify_child([{Id, _Pid, Type2, Mods}|Children], Parent, Child, Type) -> + case lists:member(Child, Mods) of + true when (Type2 =:= Type) -> + {ok, Id}; + true when (Type2 =/= Type) -> + {error, {wrong_type, Type2, Child, Parent}}; + false -> + verify_child(Children, Parent, Child, Type) + end. + +%%------------------------------------------------------------------------- +%% httpc_subtree +%%------------------------------------------------------------------------- +httpc_subtree(doc) -> + ["Makes sure the httpc sub tree is correct."]; +httpc_subtree(suite) -> + []; +httpc_subtree(Config) when is_list(Config) -> + {ok, Foo} = inets:start(httpc, [{profile, foo}]), + + {ok, Bar} = inets:start(httpc, [{profile, bar}], stand_alone), + + HttpcChildren = supervisor:which_children(httpc_profile_sup), + + {value, {httpc_manager, _, worker, [httpc_manager]}} = + lists:keysearch(httpc_manager, 1, HttpcChildren), + + {value,{{httpc,foo}, _Pid, worker, [httpc_manager]}} = + lists:keysearch({httpc, foo}, 1, HttpcChildren), + false = lists:keysearch({httpc, bar}, 1, HttpcChildren), + + inets:stop(httpc, Foo), + exit(Bar, normal). + diff -Nru erlang-18.2-dfsg/lib/inets/test/inets_test_lib.erl erlang-17.3-dfsg/lib/inets/test/inets_test_lib.erl --- erlang-18.2-dfsg/lib/inets/test/inets_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/inets_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2015. All Rights Reserved. +%% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -499,6 +498,13 @@ close(ip_comm,Socket) -> catch gen_tcp:close(Socket). +millis() -> + erlang:now(). + +millis_diff(A,B) -> + T1 = (element(1,A)*1000000) + element(2,A) + (element(3,A)/1000000), + T2 = (element(1,B)*1000000) + element(2,B) + (element(3,B)/1000000), + T1 - T2. hours(N) -> trunc(N * 1000 * 60 * 60). minutes(N) -> trunc(N * 1000 * 60). @@ -540,7 +546,7 @@ tsp(F) -> tsp(F, []). tsp(F, A) -> - Timestamp = inets_lib:formated_timestamp(), + Timestamp = formated_timestamp(), ct:pal("*** ~s ~p ~p " ++ F ++ "~n", [Timestamp, node(), self() | A]). @@ -553,6 +559,18 @@ timestamp() -> http_util:timestamp(). +formated_timestamp() -> + format_timestamp( os:timestamp() ). + +format_timestamp({_N1, _N2, N3} = Now) -> + {Date, Time} = calendar:now_to_datetime(Now), + {YYYY,MM,DD} = Date, + {Hour,Min,Sec} = Time, + FormatDate = + io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w", + [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]), + lists:flatten(FormatDate). + start_apps(Apps) -> lists:foreach(fun(App) -> application:stop(App), @@ -563,12 +581,3 @@ application:stop(App) end, Apps). -inet_port(Node) -> - {Port, Socket} = do_inet_port(Node), - rpc:call(Node, gen_tcp, close, [Socket]), - Port. - -do_inet_port(Node) -> - {ok, Socket} = rpc:call(Node, gen_tcp, listen, [0, [{reuseaddr, true}]]), - {ok, Port} = rpc:call(Node, inet, port, [Socket]), - {Port, Socket}. diff -Nru erlang-18.2-dfsg/lib/inets/test/inets_test_lib.hrl erlang-17.3-dfsg/lib/inets/test/inets_test_lib.hrl --- erlang-18.2-dfsg/lib/inets/test/inets_test_lib.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/inets_test_lib.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/Makefile erlang-17.3-dfsg/lib/inets/test/Makefile --- erlang-18.2-dfsg/lib/inets/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -174,8 +173,7 @@ inets_appup_test \ tftp_test_lib \ tftp_SUITE \ - uri_SUITE \ - inets_socketwrap_SUITE + uri_SUITE EBIN = . @@ -204,7 +202,7 @@ # inets_ftp_suite \ # inets_tftp_suite -INETS_DATADIRS = inets_SUITE_data inets_socketwrap_SUITE_data +INETS_DATADIRS = inets_SUITE_data inets_sup_SUITE_data HTTPD_DATADIRS = httpd_test_data httpd_SUITE_data httpd_basic_SUITE_data old_httpd_SUITE_data HTTPC_DATADIRS = httpc_SUITE_data httpc_proxy_SUITE_data FTP_DATADIRS = ftp_SUITE_data @@ -251,7 +249,7 @@ # 1) INETS_PRIV_DIR must be created # ---------------------------------------------------- -tests debug opt: $(BUILDTARGET) +tests debug opt: $(BUILDTARGET) targets: $(TARGET_FILES) diff -Nru erlang-18.2-dfsg/lib/inets/test/old_httpd_SUITE_data/server_root/conf/httpd.conf erlang-17.3-dfsg/lib/inets/test/old_httpd_SUITE_data/server_root/conf/httpd.conf --- erlang-18.2-dfsg/lib/inets/test/old_httpd_SUITE_data/server_root/conf/httpd.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/old_httpd_SUITE_data/server_root/conf/httpd.conf 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/test/old_httpd_SUITE_data/server_root/Makefile erlang-17.3-dfsg/lib/inets/test/old_httpd_SUITE_data/server_root/Makefile --- erlang-18.2-dfsg/lib/inets/test/old_httpd_SUITE_data/server_root/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/old_httpd_SUITE_data/server_root/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/inets/test/old_httpd_SUITE.erl erlang-17.3-dfsg/lib/inets/test/old_httpd_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/old_httpd_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/old_httpd_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -2073,13 +2072,13 @@ "Modules mod_alias mod_htaccess mod_auth " "mod_security " "mod_responsecontrol mod_trace mod_esi " - "mod_actions mod_cgi mod_dir " + "mod_actions mod_cgi mod_include mod_dir " "mod_range mod_get " "mod_head mod_log mod_disk_log"; _ -> "Modules mod_alias mod_auth mod_security " "mod_responsecontrol mod_trace mod_esi " - "mod_actions mod_cgi mod_dir " + "mod_actions mod_cgi mod_include mod_dir " "mod_range mod_get " "mod_head mod_log mod_disk_log" end, @@ -2437,7 +2436,7 @@ MaxHdrAct = io_lib:format("~p", [close]), Mod_order = "Modules mod_alias mod_auth mod_esi mod_actions mod_cgi" - " mod_dir mod_get mod_head" + " mod_include mod_dir mod_get mod_head" " mod_log mod_disk_log mod_trace", SSL = diff -Nru erlang-18.2-dfsg/lib/inets/test/property_test/ftp_simple_client_server.erl erlang-17.3-dfsg/lib/inets/test/property_test/ftp_simple_client_server.erl --- erlang-18.2-dfsg/lib/inets/test/property_test/ftp_simple_client_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/property_test/ftp_simple_client_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/tftp_SUITE.erl erlang-17.3-dfsg/lib/inets/test/tftp_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/tftp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/tftp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/tftp_test_lib.erl erlang-17.3-dfsg/lib/inets/test/tftp_test_lib.erl --- erlang-18.2-dfsg/lib/inets/test/tftp_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/tftp_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/tftp_test_lib.hrl erlang-17.3-dfsg/lib/inets/test/tftp_test_lib.hrl --- erlang-18.2-dfsg/lib/inets/test/tftp_test_lib.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/tftp_test_lib.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/inets/test/uri_SUITE.erl erlang-17.3-dfsg/lib/inets/test/uri_SUITE.erl --- erlang-18.2-dfsg/lib/inets/test/uri_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/test/uri_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -47,10 +46,8 @@ userinfo, scheme, queries, - fragments, escaped, - hexed_query, - scheme_validation + hexed_query ]. %%-------------------------------------------------------------------- @@ -108,42 +105,6 @@ {ok, {http,[],"localhost",8888,"/foobar.html","?foo=bar&foobar=42"}} = http_uri:parse("http://localhost:8888/foobar.html?foo=bar&foobar=42"). -fragments(Config) when is_list(Config) -> - {ok, {http,[],"localhost",80,"/",""}} = - http_uri:parse("http://localhost#fragment"), - {ok, {http,[],"localhost",80,"/path",""}} = - http_uri:parse("http://localhost/path#fragment"), - {ok, {http,[],"localhost",80,"/","?query"}} = - http_uri:parse("http://localhost?query#fragment"), - {ok, {http,[],"localhost",80,"/path","?query"}} = - http_uri:parse("http://localhost/path?query#fragment"), - {ok, {http,[],"localhost",80,"/","","#fragment"}} = - http_uri:parse("http://localhost#fragment", [{fragment,true}]), - {ok, {http,[],"localhost",80,"/path","","#fragment"}} = - http_uri:parse("http://localhost/path#fragment", [{fragment,true}]), - {ok, {http,[],"localhost",80,"/","?query","#fragment"}} = - http_uri:parse("http://localhost?query#fragment", [{fragment,true}]), - {ok, {http,[],"localhost",80,"/path","?query","#fragment"}} = - http_uri:parse("http://localhost/path?query#fragment", - [{fragment,true}]), - {ok, {http,[],"localhost",80,"/","",""}} = - http_uri:parse("http://localhost", [{fragment,true}]), - {ok, {http,[],"localhost",80,"/path","",""}} = - http_uri:parse("http://localhost/path", [{fragment,true}]), - {ok, {http,[],"localhost",80,"/","?query",""}} = - http_uri:parse("http://localhost?query", [{fragment,true}]), - {ok, {http,[],"localhost",80,"/path","?query",""}} = - http_uri:parse("http://localhost/path?query", [{fragment,true}]), - {ok, {http,[],"localhost",80,"/","","#"}} = - http_uri:parse("http://localhost#", [{fragment,true}]), - {ok, {http,[],"localhost",80,"/path","","#"}} = - http_uri:parse("http://localhost/path#", [{fragment,true}]), - {ok, {http,[],"localhost",80,"/","?query","#"}} = - http_uri:parse("http://localhost?query#", [{fragment,true}]), - {ok, {http,[],"localhost",80,"/path","?query","#"}} = - http_uri:parse("http://localhost/path?query#", [{fragment,true}]), - ok. - escaped(Config) when is_list(Config) -> {ok, {http,[],"www.somedomain.com",80,"/%2Eabc",[]}} = http_uri:parse("http://www.somedomain.com/%2Eabc"), @@ -176,26 +137,6 @@ verify_uri(URI2, Verify2), verify_uri(URI3, Verify3). -scheme_validation(Config) when is_list(Config) -> - {ok, {http,[],"localhost",80,"/",""}} = - http_uri:parse("http://localhost#fragment"), - - ValidationFun = - fun("http") -> valid; - (_) -> {error, bad_scheme} - end, - - {ok, {http,[],"localhost",80,"/",""}} = - http_uri:parse("http://localhost#fragment", - [{scheme_validation_fun, ValidationFun}]), - {error, bad_scheme} = - http_uri:parse("https://localhost#fragment", - [{scheme_validation_fun, ValidationFun}]), - %% non-fun scheme_validation_fun works as no option passed - {ok, {https,[],"localhost",443,"/",""}} = - http_uri:parse("https://localhost#fragment", - [{scheme_validation_fun, none}]). - %%-------------------------------------------------------------------- %% Internal Functions ------------------------------------------------ diff -Nru erlang-18.2-dfsg/lib/inets/vsn.mk erlang-17.3-dfsg/lib/inets/vsn.mk --- erlang-18.2-dfsg/lib/inets/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/inets/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -2,23 +2,22 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2001-2015. All Rights Reserved. +# Copyright Ericsson AB 2001-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% APPLICATION = inets -INETS_VSN = 6.1 +INETS_VSN = 5.10.3 PRE_VSN = APP_VSN = "$(APPLICATION)-$(INETS_VSN)$(PRE_VSN)" diff -Nru erlang-18.2-dfsg/lib/jinterface/.classpath erlang-17.3-dfsg/lib/jinterface/.classpath --- erlang-18.2-dfsg/lib/jinterface/.classpath 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/.classpath 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/book.xml erlang-17.3-dfsg/lib/jinterface/doc/src/book.xml --- erlang-18.2-dfsg/lib/jinterface/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/index.html.src erlang-17.3-dfsg/lib/jinterface/doc/src/index.html.src --- erlang-18.2-dfsg/lib/jinterface/doc/src/index.html.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/index.html.src 2014-09-16 19:10:57.000000000 +0000 @@ -6,17 +6,16 @@ Copyright Ericsson AB 2000-2009. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. %CopyrightEnd% --> diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/jinterface_users_guide.xml erlang-17.3-dfsg/lib/jinterface/doc/src/jinterface_users_guide.xml --- erlang-18.2-dfsg/lib/jinterface/doc/src/jinterface_users_guide.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/jinterface_users_guide.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -224,14 +223,6 @@
    - Transport Factory -

    All necessary connections are made using methods of - OtpTransportFactory - interface. Default OtpTransportFactory implementation is based on standard Socket class. - User may provide custom transport factory as needed. See java doc for details.

    -
    - -
    Sending and Receiving Messages

    Messages sent with this package must be instances of OtpErlangObject diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/jinterface.xml erlang-17.3-dfsg/lib/jinterface/doc/src/jinterface.xml --- erlang-18.2-dfsg/lib/jinterface/doc/src/jinterface.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/jinterface.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/Makefile erlang-17.3-dfsg/lib/jinterface/doc/src/Makefile --- erlang-18.2-dfsg/lib/jinterface/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2000-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/notes_history.xml erlang-17.3-dfsg/lib/jinterface/doc/src/notes_history.xml --- erlang-18.2-dfsg/lib/jinterface/doc/src/notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/notes.xml erlang-17.3-dfsg/lib/jinterface/doc/src/notes.xml --- erlang-18.2-dfsg/lib/jinterface/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,137 +30,6 @@

    This document describes the changes made to the Jinterface application.

    -
    Jinterface 1.6.1 - -
    Fixed Bugs and Malfunctions - - -

    - Add missing Term tag matching switch statement that was - missing an external fun tag.

    -

    - Own Id: OTP-13106

    -
    - -

    - fixed writing small compressed values.

    -

    - Own Id: OTP-13165

    -
    -
    -
    - -
    - -
    Jinterface 1.6 - -
    Fixed Bugs and Malfunctions - - -

    - Reformat the sources for JInterface uniformly and - according to the standard Java style guidelines. Provide - description of the rules applied in Eclipse format (for - other editors one can check the settings against these).

    -

    - In short, the formatting style is: * indentation uses - only spaces; each level is 4 positions * no trailing - whitespace * mostly default Java style formatting (any - difference is minor) * always use {} blocks * use 'final' - as much as possible

    -

    - Own Id: OTP-12333

    -
    - -

    - Remove extra @param in javadoc as this gives an error - when building the docs in java 1.8

    -

    - Own Id: OTP-12746

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Add basic transport factory implementation. This makes - possible creating connections between nodes using ssh - channels for example.

    -

    - Own Id: OTP-12686

    -
    - -

    - Add Jinterface generic match and bind methods to provide - low level interface base methods sufficient for variety - of higher level pattern matching/variable binding - implementations.

    -

    - Own Id: OTP-12691

    -
    - -

    - Minimal Java version is now 1.6

    -

    - Own Id: OTP-12715

    -
    -
    -
    - -
    - -
    Jinterface 1.5.12 - -
    Fixed Bugs and Malfunctions - - -

    - handle empty .erlang.cookie without crashing and - OtpErlangList.clone must not return null

    -

    - Own Id: OTP-12210

    -
    - -

    - This fixes all the compilation warnings in the Java code

    -

    - Own Id: OTP-12211

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Added an .appup file for the application.

    -

    - Own Id: OTP-12358 Aux Id: OTP-12178

    -
    -
    -
    - -
    - -
    Jinterface 1.5.11 - -
    Fixed Bugs and Malfunctions - - -

    - Added a .app file for the application.

    -

    - Own Id: OTP-12178

    -
    -
    -
    - -
    -
    Jinterface 1.5.10
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/part_notes_history.xml erlang-17.3-dfsg/lib/jinterface/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/lib/jinterface/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/part_notes.xml erlang-17.3-dfsg/lib/jinterface/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/jinterface/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/part.xml erlang-17.3-dfsg/lib/jinterface/doc/src/part.xml --- erlang-18.2-dfsg/lib/jinterface/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/jinterface/doc/src/ref_man.xml erlang-17.3-dfsg/lib/jinterface/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/jinterface/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,53 +1,53 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2010. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; import java.io.IOException; -import java.io.OutputStream; +import java.io.InputStream; +import java.net.Socket; import java.util.Random; /** * Maintains a connection between a Java process and a remote Erlang, Java or C * node. The object maintains connection state and allows data to be sent to and * received from the peer. - * + * *

    * This abstract class provides the neccesary methods to maintain the actual * connection and encode the messages and headers in the proper format according * to the Erlang distribution protocol. Subclasses can use these methods to * provide a more or less transparent communication channel as desired. *

    - * + * *

    * Note that no receive methods are provided. Subclasses must provide methods * for message delivery, and may implement their own receive methods. *

    - * + * *

    * If an exception occurs in any of the methods in this class, the connection * will be closed and must be reopened in order to resume communication with the * peer. This will be indicated to the subclass by passing the exception to its * delivery() method. *

    - * + * *

    * The System property OtpConnection.trace can be used to change the initial * trace level setting for all connections. Normally the initial trace level is @@ -85,9 +85,9 @@ private volatile boolean done = false; protected boolean connected = false; // connection status - protected OtpTransport socket; // communication channel + protected Socket socket; // communication channel protected OtpPeer peer; // who are we connected to - protected OtpLocalNode localNode; // this nodes id + protected OtpLocalNode self; // this nodes id String name; // local name of this connection protected boolean cookieOk = false; // already checked the cookie for this @@ -107,103 +107,104 @@ private int flags = 0; static { - // trace this connection? - final String trace = System.getProperties().getProperty( - "OtpConnection.trace"); - try { - if (trace != null) { - defaultLevel = Integer.valueOf(trace).intValue(); - } - } catch (final NumberFormatException e) { - defaultLevel = 0; - } - random = new Random(); + // trace this connection? + final String trace = System.getProperties().getProperty( + "OtpConnection.trace"); + try { + if (trace != null) { + defaultLevel = Integer.valueOf(trace).intValue(); + } + } catch (final NumberFormatException e) { + defaultLevel = 0; + } + random = new Random(); } // private AbstractConnection() { // } /** - * Accept an incoming connection from a remote node. Used by - * {@link OtpSelf#accept() OtpSelf.accept()} to create a connection based on - * data received when handshaking with the peer node, when the remote node - * is the connection initiator. - * - * @exception java.io.IOException - * if it was not possible to connect to the peer. - * - * @exception OtpAuthException - * if handshake resulted in an authentication error + * Accept an incoming connection from a remote node. Used by {@link + * OtpSelf#accept() OtpSelf.accept()} to create a connection based on data + * received when handshaking with the peer node, when the remote node is the + * connection intitiator. + * + * @exception java.io.IOException if it was not possible to connect to the + * peer. + * + * @exception OtpAuthException if handshake resulted in an authentication + * error */ - protected AbstractConnection(final OtpLocalNode self, final OtpTransport s) - throws IOException, OtpAuthException { - localNode = self; - peer = new OtpPeer(self.transportFactory); - socket = s; - - traceLevel = defaultLevel; - setDaemon(true); - - if (traceLevel >= handshakeThreshold) { - System.out.println("<- ACCEPT FROM " + s); - } - - // get his info - recvName(peer); - - // now find highest common dist value - if (peer.proto != self.proto || self.distHigh < peer.distLow - || self.distLow > peer.distHigh) { - close(); - throw new IOException( - "No common protocol found - cannot accept connection"); - } - // highest common version: min(peer.distHigh, self.distHigh) - peer.distChoose = peer.distHigh > self.distHigh ? self.distHigh - : peer.distHigh; + protected AbstractConnection(final OtpLocalNode self, final Socket s) + throws IOException, OtpAuthException { + this.self = self; + peer = new OtpPeer(); + socket = s; + + socket.setTcpNoDelay(true); + + traceLevel = defaultLevel; + setDaemon(true); + + if (traceLevel >= handshakeThreshold) { + System.out.println("<- ACCEPT FROM " + s.getInetAddress() + ":" + + s.getPort()); + } + + // get his info + recvName(peer); + + // now find highest common dist value + if (peer.proto != self.proto || self.distHigh < peer.distLow + || self.distLow > peer.distHigh) { + close(); + throw new IOException( + "No common protocol found - cannot accept connection"); + } + // highest common version: min(peer.distHigh, self.distHigh) + peer.distChoose = peer.distHigh > self.distHigh ? self.distHigh + : peer.distHigh; - doAccept(); - name = peer.node(); + doAccept(); + name = peer.node(); } /** * Intiate and open a connection to a remote node. - * - * @exception java.io.IOException - * if it was not possible to connect to the peer. - * - * @exception OtpAuthException - * if handshake resulted in an authentication error. + * + * @exception java.io.IOException if it was not possible to connect to the + * peer. + * + * @exception OtpAuthException if handshake resulted in an authentication + * error. */ protected AbstractConnection(final OtpLocalNode self, final OtpPeer other) - throws IOException, OtpAuthException { - peer = other; - localNode = self; - socket = null; - int port; - - traceLevel = defaultLevel; - setDaemon(true); - - // now get a connection between the two... - port = OtpEpmd.lookupPort(peer); - if (port == 0) - throw new IOException("No remote node found - cannot connect"); - - // now find highest common dist value - if (peer.proto != self.proto || self.distHigh < peer.distLow - || self.distLow > peer.distHigh) { - throw new IOException("No common protocol found - cannot connect"); - } - - // highest common version: min(peer.distHigh, self.distHigh) - peer.distChoose = peer.distHigh > self.distHigh ? self.distHigh - : peer.distHigh; + throws IOException, OtpAuthException { + peer = other; + this.self = self; + socket = null; + int port; + + traceLevel = defaultLevel; + setDaemon(true); + + // now get a connection between the two... + port = OtpEpmd.lookupPort(peer); + + // now find highest common dist value + if (peer.proto != self.proto || self.distHigh < peer.distLow + || self.distLow > peer.distHigh) { + throw new IOException("No common protocol found - cannot connect"); + } + + // highest common version: min(peer.distHigh, self.distHigh) + peer.distChoose = peer.distHigh > self.distHigh ? self.distHigh + : peer.distHigh; - doConnect(port); + doConnect(port); - name = peer.node(); - connected = true; + name = peer.node(); + connected = true; } /** @@ -218,91 +219,89 @@ /** * Send a pre-encoded message to a named process on a remote node. - * + * * @param dest * the name of the remote process. * @param payload * the encoded message to send. - * + * * @exception java.io.IOException * if the connection is not active or a communication error * occurs. */ protected void sendBuf(final OtpErlangPid from, final String dest, - final OtpOutputStream payload) throws IOException { - if (!connected) { - throw new IOException("Not connected"); - } - @SuppressWarnings("resource") - final OtpOutputStream header = new OtpOutputStream(headerLen); - - // preamble: 4 byte length + "passthrough" tag + version - header.write4BE(0); // reserve space for length - header.write1(passThrough); - header.write1(version); - - // header info - header.write_tuple_head(4); - header.write_long(regSendTag); - header.write_any(from); - if (sendCookie) { - header.write_atom(localNode.cookie()); - } else { - header.write_atom(""); - } - header.write_atom(dest); + final OtpOutputStream payload) throws IOException { + if (!connected) { + throw new IOException("Not connected"); + } + final OtpOutputStream header = new OtpOutputStream(headerLen); + + // preamble: 4 byte length + "passthrough" tag + version + header.write4BE(0); // reserve space for length + header.write1(passThrough); + header.write1(version); + + // header info + header.write_tuple_head(4); + header.write_long(regSendTag); + header.write_any(from); + if (sendCookie) { + header.write_atom(self.cookie()); + } else { + header.write_atom(""); + } + header.write_atom(dest); - // version for payload - header.write1(version); + // version for payload + header.write1(version); - // fix up length in preamble - header.poke4BE(0, header.size() + payload.size() - 4); + // fix up length in preamble + header.poke4BE(0, header.size() + payload.size() - 4); - do_send(header, payload); + do_send(header, payload); } /** * Send a pre-encoded message to a process on a remote node. - * + * * @param dest * the Erlang PID of the remote process. * @param payload * the encoded message to send. - * + * * @exception java.io.IOException * if the connection is not active or a communication error * occurs. */ protected void sendBuf(final OtpErlangPid from, final OtpErlangPid dest, - final OtpOutputStream payload) throws IOException { - if (!connected) { - throw new IOException("Not connected"); - } - @SuppressWarnings("resource") - final OtpOutputStream header = new OtpOutputStream(headerLen); - - // preamble: 4 byte length + "passthrough" tag + version - header.write4BE(0); // reserve space for length - header.write1(passThrough); - header.write1(version); - - // header info - header.write_tuple_head(3); - header.write_long(sendTag); - if (sendCookie) { - header.write_atom(localNode.cookie()); - } else { - header.write_atom(""); - } - header.write_any(dest); + final OtpOutputStream payload) throws IOException { + if (!connected) { + throw new IOException("Not connected"); + } + final OtpOutputStream header = new OtpOutputStream(headerLen); + + // preamble: 4 byte length + "passthrough" tag + version + header.write4BE(0); // reserve space for length + header.write1(passThrough); + header.write1(version); + + // header info + header.write_tuple_head(3); + header.write_long(sendTag); + if (sendCookie) { + header.write_atom(self.cookie()); + } else { + header.write_atom(""); + } + header.write_any(dest); - // version for payload - header.write1(version); + // version for payload + header.write1(version); - // fix up length in preamble - header.poke4BE(0, header.size() + payload.size() - 4); + // fix up length in preamble + header.poke4BE(0, header.size() + payload.size() - 4); - do_send(header, payload); + do_send(header, payload); } /* @@ -311,60 +310,58 @@ * otherwise */ private void cookieError(final OtpLocalNode local, - final OtpErlangAtom cookie) throws OtpAuthException { - try { - @SuppressWarnings("resource") - final OtpOutputStream header = new OtpOutputStream(headerLen); - - // preamble: 4 byte length + "passthrough" tag + version - header.write4BE(0); // reserve space for length - header.write1(passThrough); - header.write1(version); - - header.write_tuple_head(4); - header.write_long(regSendTag); - header.write_any(local.createPid()); // disposable pid - header.write_atom(cookie.atomValue()); // important: his cookie, - // not mine... - header.write_atom("auth"); - - // version for payload - header.write1(version); - - // the payload - - // the no_auth message (copied from Erlang) Don't change this - // (Erlang will crash) - // {$gen_cast, {print, "~n** Unauthorized cookie ~w **~n", - // [foo@aule]}} - final OtpErlangObject[] msg = new OtpErlangObject[2]; - final OtpErlangObject[] msgbody = new OtpErlangObject[3]; - - msgbody[0] = new OtpErlangAtom("print"); - msgbody[1] = new OtpErlangString("~n** Bad cookie sent to " + local - + " **~n"); - // Erlang will crash and burn if there is no third argument here... - msgbody[2] = new OtpErlangList(); // empty list - - msg[0] = new OtpErlangAtom("$gen_cast"); - msg[1] = new OtpErlangTuple(msgbody); - - @SuppressWarnings("resource") - final OtpOutputStream payload = new OtpOutputStream( - new OtpErlangTuple(msg)); - - // fix up length in preamble - header.poke4BE(0, header.size() + payload.size() - 4); - - try { - do_send(header, payload); - } catch (final IOException e) { - } // ignore - } finally { - close(); - } - throw new OtpAuthException("Remote cookie not authorized: " - + cookie.atomValue()); + final OtpErlangAtom cookie) throws OtpAuthException { + try { + final OtpOutputStream header = new OtpOutputStream(headerLen); + + // preamble: 4 byte length + "passthrough" tag + version + header.write4BE(0); // reserve space for length + header.write1(passThrough); + header.write1(version); + + header.write_tuple_head(4); + header.write_long(regSendTag); + header.write_any(local.createPid()); // disposable pid + header.write_atom(cookie.atomValue()); // important: his cookie, + // not mine... + header.write_atom("auth"); + + // version for payload + header.write1(version); + + // the payload + + // the no_auth message (copied from Erlang) Don't change this + // (Erlang will crash) + // {$gen_cast, {print, "~n** Unauthorized cookie ~w **~n", + // [foo@aule]}} + final OtpErlangObject[] msg = new OtpErlangObject[2]; + final OtpErlangObject[] msgbody = new OtpErlangObject[3]; + + msgbody[0] = new OtpErlangAtom("print"); + msgbody[1] = new OtpErlangString("~n** Bad cookie sent to " + local + + " **~n"); + // Erlang will crash and burn if there is no third argument here... + msgbody[2] = new OtpErlangList(); // empty list + + msg[0] = new OtpErlangAtom("$gen_cast"); + msg[1] = new OtpErlangTuple(msgbody); + + final OtpOutputStream payload = new OtpOutputStream( + new OtpErlangTuple(msg)); + + // fix up length in preamble + header.poke4BE(0, header.size() + payload.size() - 4); + + try { + do_send(header, payload); + } catch (final IOException e) { + } // ignore + } finally { + close(); + } + throw new OtpAuthException("Remote cookie not authorized: " + + cookie.atomValue()); } // link to pid @@ -374,366 +371,359 @@ * remote node. If the link is still active when the remote process * terminates, an exit signal will be sent to this connection. Use * {@link #sendUnlink unlink()} to remove the link. - * + * * @param dest * the Erlang PID of the remote process. - * + * * @exception java.io.IOException * if the connection is not active or a communication error * occurs. */ protected void sendLink(final OtpErlangPid from, final OtpErlangPid dest) - throws IOException { - if (!connected) { - throw new IOException("Not connected"); - } - @SuppressWarnings("resource") - final OtpOutputStream header = new OtpOutputStream(headerLen); - - // preamble: 4 byte length + "passthrough" tag - header.write4BE(0); // reserve space for length - header.write1(passThrough); - header.write1(version); - - // header - header.write_tuple_head(3); - header.write_long(linkTag); - header.write_any(from); - header.write_any(dest); + throws IOException { + if (!connected) { + throw new IOException("Not connected"); + } + final OtpOutputStream header = new OtpOutputStream(headerLen); + + // preamble: 4 byte length + "passthrough" tag + header.write4BE(0); // reserve space for length + header.write1(passThrough); + header.write1(version); + + // header + header.write_tuple_head(3); + header.write_long(linkTag); + header.write_any(from); + header.write_any(dest); - // fix up length in preamble - header.poke4BE(0, header.size() - 4); + // fix up length in preamble + header.poke4BE(0, header.size() - 4); - do_send(header); + do_send(header); } /** * Remove a link between the local node and the specified process on the * remote node. This method deactivates links created with {@link #sendLink * link()}. - * + * * @param dest * the Erlang PID of the remote process. - * + * * @exception java.io.IOException * if the connection is not active or a communication error * occurs. */ protected void sendUnlink(final OtpErlangPid from, final OtpErlangPid dest) - throws IOException { - if (!connected) { - throw new IOException("Not connected"); - } - @SuppressWarnings("resource") - final OtpOutputStream header = new OtpOutputStream(headerLen); - - // preamble: 4 byte length + "passthrough" tag - header.write4BE(0); // reserve space for length - header.write1(passThrough); - header.write1(version); - - // header - header.write_tuple_head(3); - header.write_long(unlinkTag); - header.write_any(from); - header.write_any(dest); + throws IOException { + if (!connected) { + throw new IOException("Not connected"); + } + final OtpOutputStream header = new OtpOutputStream(headerLen); + + // preamble: 4 byte length + "passthrough" tag + header.write4BE(0); // reserve space for length + header.write1(passThrough); + header.write1(version); + + // header + header.write_tuple_head(3); + header.write_long(unlinkTag); + header.write_any(from); + header.write_any(dest); - // fix up length in preamble - header.poke4BE(0, header.size() - 4); + // fix up length in preamble + header.poke4BE(0, header.size() - 4); - do_send(header); + do_send(header); } /* used internally when "processes" terminate */ protected void sendExit(final OtpErlangPid from, final OtpErlangPid dest, - final OtpErlangObject reason) throws IOException { - sendExit(exitTag, from, dest, reason); + final OtpErlangObject reason) throws IOException { + sendExit(exitTag, from, dest, reason); } /** * Send an exit signal to a remote process. - * + * * @param dest * the Erlang PID of the remote process. * @param reason * an Erlang term describing the exit reason. - * + * * @exception java.io.IOException * if the connection is not active or a communication error * occurs. */ protected void sendExit2(final OtpErlangPid from, final OtpErlangPid dest, - final OtpErlangObject reason) throws IOException { - sendExit(exit2Tag, from, dest, reason); + final OtpErlangObject reason) throws IOException { + sendExit(exit2Tag, from, dest, reason); } private void sendExit(final int tag, final OtpErlangPid from, - final OtpErlangPid dest, final OtpErlangObject reason) - throws IOException { - if (!connected) { - throw new IOException("Not connected"); - } - @SuppressWarnings("resource") - final OtpOutputStream header = new OtpOutputStream(headerLen); - - // preamble: 4 byte length + "passthrough" tag - header.write4BE(0); // reserve space for length - header.write1(passThrough); - header.write1(version); - - // header - header.write_tuple_head(4); - header.write_long(tag); - header.write_any(from); - header.write_any(dest); - header.write_any(reason); + final OtpErlangPid dest, final OtpErlangObject reason) + throws IOException { + if (!connected) { + throw new IOException("Not connected"); + } + final OtpOutputStream header = new OtpOutputStream(headerLen); + + // preamble: 4 byte length + "passthrough" tag + header.write4BE(0); // reserve space for length + header.write1(passThrough); + header.write1(version); + + // header + header.write_tuple_head(4); + header.write_long(tag); + header.write_any(from); + header.write_any(dest); + header.write_any(reason); - // fix up length in preamble - header.poke4BE(0, header.size() - 4); + // fix up length in preamble + header.poke4BE(0, header.size() - 4); - do_send(header); + do_send(header); } - @SuppressWarnings("resource") @Override public void run() { - if (!connected) { - deliver(new IOException("Not connected")); - return; - } - - final byte[] lbuf = new byte[4]; - OtpInputStream ibuf; - OtpErlangObject traceobj; - int len; - final byte[] tock = { 0, 0, 0, 0 }; - - try { - receive_loop: while (!done) { - // don't return until we get a real message - // or a failure of some kind (e.g. EXIT) - // read length and read buffer must be atomic! - do { - // read 4 bytes - get length of incoming packet - // socket.getInputStream().read(lbuf); - readSock(socket, lbuf); - ibuf = new OtpInputStream(lbuf, flags); - len = ibuf.read4BE(); - - // received tick? send tock! - if (len == 0) { - synchronized (this) { - OutputStream out = socket.getOutputStream(); - out.write(tock); - out.flush(); - } - } - - } while (len == 0); // tick_loop - - // got a real message (maybe) - read len bytes - final byte[] tmpbuf = new byte[len]; - // i = socket.getInputStream().read(tmpbuf); - readSock(socket, tmpbuf); - ibuf.close(); - ibuf = new OtpInputStream(tmpbuf, flags); - - if (ibuf.read1() != passThrough) { - break receive_loop; - } - - // got a real message (really) - OtpErlangObject reason = null; - OtpErlangAtom cookie = null; - OtpErlangObject tmp = null; - OtpErlangTuple head = null; - OtpErlangAtom toName; - OtpErlangPid to; - OtpErlangPid from; - int tag; - - // decode the header - tmp = ibuf.read_any(); - if (!(tmp instanceof OtpErlangTuple)) { - break receive_loop; - } - - head = (OtpErlangTuple) tmp; - if (!(head.elementAt(0) instanceof OtpErlangLong)) { - break receive_loop; - } - - // lets see what kind of message this is - tag = (int) ((OtpErlangLong) head.elementAt(0)).longValue(); - - switch (tag) { - case sendTag: // { SEND, Cookie, ToPid } - case sendTTTag: // { SEND, Cookie, ToPid, TraceToken } - if (!cookieOk) { - // we only check this once, he can send us bad cookies - // later if he likes - if (!(head.elementAt(1) instanceof OtpErlangAtom)) { - break receive_loop; - } - cookie = (OtpErlangAtom) head.elementAt(1); - if (sendCookie) { - if (!cookie.atomValue().equals(localNode.cookie())) { - cookieError(localNode, cookie); - } - } else { - if (!cookie.atomValue().equals("")) { - cookieError(localNode, cookie); - } - } - cookieOk = true; - } - - if (traceLevel >= sendThreshold) { - System.out.println("<- " + headerType(head) + " " - + head); - - /* show received payload too */ - ibuf.mark(0); - traceobj = ibuf.read_any(); - - if (traceobj != null) { - System.out.println(" " + traceobj); - } else { - System.out.println(" (null)"); - } - ibuf.reset(); - } - - to = (OtpErlangPid) head.elementAt(2); - - deliver(new OtpMsg(to, ibuf)); - break; - - case regSendTag: // { REG_SEND, FromPid, Cookie, ToName } - case regSendTTTag: // { REG_SEND, FromPid, Cookie, ToName, - // TraceToken } - if (!cookieOk) { - // we only check this once, he can send us bad cookies - // later if he likes - if (!(head.elementAt(2) instanceof OtpErlangAtom)) { - break receive_loop; - } - cookie = (OtpErlangAtom) head.elementAt(2); - if (sendCookie) { - if (!cookie.atomValue().equals(localNode.cookie())) { - cookieError(localNode, cookie); - } - } else { - if (!cookie.atomValue().equals("")) { - cookieError(localNode, cookie); - } - } - cookieOk = true; - } - - if (traceLevel >= sendThreshold) { - System.out.println("<- " + headerType(head) + " " - + head); - - /* show received payload too */ - ibuf.mark(0); - traceobj = ibuf.read_any(); - - if (traceobj != null) { - System.out.println(" " + traceobj); - } else { - System.out.println(" (null)"); - } - ibuf.reset(); - } - - from = (OtpErlangPid) head.elementAt(1); - toName = (OtpErlangAtom) head.elementAt(3); - - deliver(new OtpMsg(from, toName.atomValue(), ibuf)); - break; - - case exitTag: // { EXIT, FromPid, ToPid, Reason } - case exit2Tag: // { EXIT2, FromPid, ToPid, Reason } - if (head.elementAt(3) == null) { - break receive_loop; - } - if (traceLevel >= ctrlThreshold) { - System.out.println("<- " + headerType(head) + " " - + head); - } - - from = (OtpErlangPid) head.elementAt(1); - to = (OtpErlangPid) head.elementAt(2); - reason = head.elementAt(3); - - deliver(new OtpMsg(tag, from, to, reason)); - break; - - case exitTTTag: // { EXIT, FromPid, ToPid, TraceToken, Reason } - case exit2TTTag: // { EXIT2, FromPid, ToPid, TraceToken, - // Reason - // } - // as above, but bifferent element number - if (head.elementAt(4) == null) { - break receive_loop; - } - if (traceLevel >= ctrlThreshold) { - System.out.println("<- " + headerType(head) + " " - + head); - } - - from = (OtpErlangPid) head.elementAt(1); - to = (OtpErlangPid) head.elementAt(2); - reason = head.elementAt(4); - - deliver(new OtpMsg(tag, from, to, reason)); - break; - - case linkTag: // { LINK, FromPid, ToPid} - case unlinkTag: // { UNLINK, FromPid, ToPid} - if (traceLevel >= ctrlThreshold) { - System.out.println("<- " + headerType(head) + " " - + head); - } - - from = (OtpErlangPid) head.elementAt(1); - to = (OtpErlangPid) head.elementAt(2); - - deliver(new OtpMsg(tag, from, to)); - break; - - // absolutely no idea what to do with these, so we ignore - // them... - case groupLeaderTag: // { GROUPLEADER, FromPid, ToPid} - // (just show trace) - if (traceLevel >= ctrlThreshold) { - System.out.println("<- " + headerType(head) + " " - + head); - } - break; - - default: - // garbage? - break receive_loop; - } - } // end receive_loop - - // this section reachable only with break - // we have received garbage from peer - deliver(new OtpErlangExit("Remote is sending garbage")); - - } // try - - catch (final OtpAuthException e) { - deliver(e); - } catch (final OtpErlangDecodeException e) { - deliver(new OtpErlangExit("Remote is sending garbage")); - } catch (final IOException e) { - deliver(new OtpErlangExit("Remote has closed connection")); - } finally { - close(); - } + if (!connected) { + deliver(new IOException("Not connected")); + return; + } + + final byte[] lbuf = new byte[4]; + OtpInputStream ibuf; + OtpErlangObject traceobj; + int len; + final byte[] tock = { 0, 0, 0, 0 }; + + try { + receive_loop: while (!done) { + // don't return until we get a real message + // or a failure of some kind (e.g. EXIT) + // read length and read buffer must be atomic! + tick_loop: do { + // read 4 bytes - get length of incoming packet + // socket.getInputStream().read(lbuf); + readSock(socket, lbuf); + ibuf = new OtpInputStream(lbuf, flags); + len = ibuf.read4BE(); + + // received tick? send tock! + if (len == 0) { + synchronized (this) { + socket.getOutputStream().write(tock); + } + } + + } while (len == 0); // tick_loop + + // got a real message (maybe) - read len bytes + final byte[] tmpbuf = new byte[len]; + // i = socket.getInputStream().read(tmpbuf); + readSock(socket, tmpbuf); + ibuf = new OtpInputStream(tmpbuf, flags); + + if (ibuf.read1() != passThrough) { + break receive_loop; + } + + // got a real message (really) + OtpErlangObject reason = null; + OtpErlangAtom cookie = null; + OtpErlangObject tmp = null; + OtpErlangTuple head = null; + OtpErlangAtom toName; + OtpErlangPid to; + OtpErlangPid from; + int tag; + + // decode the header + tmp = ibuf.read_any(); + if (!(tmp instanceof OtpErlangTuple)) { + break receive_loop; + } + + head = (OtpErlangTuple) tmp; + if (!(head.elementAt(0) instanceof OtpErlangLong)) { + break receive_loop; + } + + // lets see what kind of message this is + tag = (int) ((OtpErlangLong) head.elementAt(0)).longValue(); + + switch (tag) { + case sendTag: // { SEND, Cookie, ToPid } + case sendTTTag: // { SEND, Cookie, ToPid, TraceToken } + if (!cookieOk) { + // we only check this once, he can send us bad cookies + // later if he likes + if (!(head.elementAt(1) instanceof OtpErlangAtom)) { + break receive_loop; + } + cookie = (OtpErlangAtom) head.elementAt(1); + if (sendCookie) { + if (!cookie.atomValue().equals(self.cookie())) { + cookieError(self, cookie); + } + } else { + if (!cookie.atomValue().equals("")) { + cookieError(self, cookie); + } + } + cookieOk = true; + } + + if (traceLevel >= sendThreshold) { + System.out.println("<- " + headerType(head) + " " + + head); + + /* show received payload too */ + ibuf.mark(0); + traceobj = ibuf.read_any(); + + if (traceobj != null) { + System.out.println(" " + traceobj); + } else { + System.out.println(" (null)"); + } + ibuf.reset(); + } + + to = (OtpErlangPid) head.elementAt(2); + + deliver(new OtpMsg(to, ibuf)); + break; + + case regSendTag: // { REG_SEND, FromPid, Cookie, ToName } + case regSendTTTag: // { REG_SEND, FromPid, Cookie, ToName, + // TraceToken } + if (!cookieOk) { + // we only check this once, he can send us bad cookies + // later if he likes + if (!(head.elementAt(2) instanceof OtpErlangAtom)) { + break receive_loop; + } + cookie = (OtpErlangAtom) head.elementAt(2); + if (sendCookie) { + if (!cookie.atomValue().equals(self.cookie())) { + cookieError(self, cookie); + } + } else { + if (!cookie.atomValue().equals("")) { + cookieError(self, cookie); + } + } + cookieOk = true; + } + + if (traceLevel >= sendThreshold) { + System.out.println("<- " + headerType(head) + " " + + head); + + /* show received payload too */ + ibuf.mark(0); + traceobj = ibuf.read_any(); + + if (traceobj != null) { + System.out.println(" " + traceobj); + } else { + System.out.println(" (null)"); + } + ibuf.reset(); + } + + from = (OtpErlangPid) head.elementAt(1); + toName = (OtpErlangAtom) head.elementAt(3); + + deliver(new OtpMsg(from, toName.atomValue(), ibuf)); + break; + + case exitTag: // { EXIT, FromPid, ToPid, Reason } + case exit2Tag: // { EXIT2, FromPid, ToPid, Reason } + if (head.elementAt(3) == null) { + break receive_loop; + } + if (traceLevel >= ctrlThreshold) { + System.out.println("<- " + headerType(head) + " " + + head); + } + + from = (OtpErlangPid) head.elementAt(1); + to = (OtpErlangPid) head.elementAt(2); + reason = head.elementAt(3); + + deliver(new OtpMsg(tag, from, to, reason)); + break; + + case exitTTTag: // { EXIT, FromPid, ToPid, TraceToken, Reason } + case exit2TTTag: // { EXIT2, FromPid, ToPid, TraceToken, + // Reason + // } + // as above, but bifferent element number + if (head.elementAt(4) == null) { + break receive_loop; + } + if (traceLevel >= ctrlThreshold) { + System.out.println("<- " + headerType(head) + " " + + head); + } + + from = (OtpErlangPid) head.elementAt(1); + to = (OtpErlangPid) head.elementAt(2); + reason = head.elementAt(4); + + deliver(new OtpMsg(tag, from, to, reason)); + break; + + case linkTag: // { LINK, FromPid, ToPid} + case unlinkTag: // { UNLINK, FromPid, ToPid} + if (traceLevel >= ctrlThreshold) { + System.out.println("<- " + headerType(head) + " " + + head); + } + + from = (OtpErlangPid) head.elementAt(1); + to = (OtpErlangPid) head.elementAt(2); + + deliver(new OtpMsg(tag, from, to)); + break; + + // absolutely no idea what to do with these, so we ignore + // them... + case groupLeaderTag: // { GROUPLEADER, FromPid, ToPid} + // (just show trace) + if (traceLevel >= ctrlThreshold) { + System.out.println("<- " + headerType(head) + " " + + head); + } + break; + + default: + // garbage? + break receive_loop; + } + } // end receive_loop + + // this section reachable only with break + // we have received garbage from peer + deliver(new OtpErlangExit("Remote is sending garbage")); + + } // try + + catch (final OtpAuthException e) { + deliver(e); + } catch (final OtpErlangDecodeException e) { + deliver(new OtpErlangExit("Remote is sending garbage")); + } catch (final IOException e) { + deliver(new OtpErlangExit("Remote has closed connection")); + } finally { + close(); + } } /** @@ -741,7 +731,7 @@ * Set the trace level for this connection. Normally tracing is off by * default unless System property OtpConnection.trace was set. *

    - * + * *

    * The following levels are valid: 0 turns off tracing completely, 1 shows * ordinary send and receive messages, 2 shows control messages such as link @@ -749,643 +739,622 @@ * communication with Epmd. Each level includes the information shown by the * lower ones. *

    - * + * * @param level * the level to set. - * + * * @return the previous trace level. */ - public int setTraceLevel(final int level) { - final int oldLevel = traceLevel; + public int setTraceLevel(int level) { + final int oldLevel = traceLevel; - // pin the value - int theLevel = level; - if (level < 0) { - theLevel = 0; - } else if (level > 4) { - theLevel = 4; - } + // pin the value + if (level < 0) { + level = 0; + } else if (level > 4) { + level = 4; + } - traceLevel = theLevel; + traceLevel = level; - return oldLevel; + return oldLevel; } /** * Get the trace level for this connection. - * + * * @return the current trace level. */ public int getTraceLevel() { - return traceLevel; + return traceLevel; } /** * Close the connection to the remote node. */ public void close() { - done = true; - connected = false; - synchronized (this) { - try { - if (socket != null) { - if (traceLevel >= ctrlThreshold) { - System.out.println("-> CLOSE"); - } - socket.close(); - } - } catch (final IOException e) { /* ignore socket close errors */ - } finally { - socket = null; - } - } + done = true; + connected = false; + synchronized (this) { + try { + if (socket != null) { + if (traceLevel >= ctrlThreshold) { + System.out.println("-> CLOSE"); + } + socket.close(); + } + } catch (final IOException e) { /* ignore socket close errors */ + } finally { + socket = null; + } + } } @Override protected void finalize() { - close(); + close(); } /** * Determine if the connection is still alive. Note that this method only * reports the status of the connection, and that it is possible that there * are unread messages waiting in the receive queue. - * + * * @return true if the connection is alive. */ public boolean isConnected() { - return connected; + return connected; } // used by send and send_reg (message types with payload) protected synchronized void do_send(final OtpOutputStream header, - final OtpOutputStream payload) throws IOException { - try { - if (traceLevel >= sendThreshold) { - // Need to decode header and output buffer to show trace - // message! - // First make OtpInputStream, then decode. - try { - final OtpErlangObject h = header.getOtpInputStream(5) - .read_any(); - System.out.println("-> " + headerType(h) + " " + h); - - OtpErlangObject o = payload.getOtpInputStream(0).read_any(); - System.out.println(" " + o); - o = null; - } catch (final OtpErlangDecodeException e) { - System.out.println(" " + "can't decode output buffer:" - + e); - } - } - - // group flush op in favour of possible ssh-tunneled stream - OutputStream out = socket.getOutputStream(); - header.writeTo(out); - payload.writeTo(out); - out.flush(); - } catch (final IOException e) { - close(); - throw e; - } + final OtpOutputStream payload) throws IOException { + try { + if (traceLevel >= sendThreshold) { + // Need to decode header and output buffer to show trace + // message! + // First make OtpInputStream, then decode. + try { + final OtpErlangObject h = header.getOtpInputStream(5) + .read_any(); + System.out.println("-> " + headerType(h) + " " + h); + + OtpErlangObject o = payload.getOtpInputStream(0).read_any(); + System.out.println(" " + o); + o = null; + } catch (final OtpErlangDecodeException e) { + System.out.println(" " + "can't decode output buffer:" + + e); + } + } + + header.writeTo(socket.getOutputStream()); + payload.writeTo(socket.getOutputStream()); + } catch (final IOException e) { + close(); + throw e; + } } // used by the other message types protected synchronized void do_send(final OtpOutputStream header) - throws IOException { - try { - if (traceLevel >= ctrlThreshold) { - try { - final OtpErlangObject h = header.getOtpInputStream(5) - .read_any(); - System.out.println("-> " + headerType(h) + " " + h); - } catch (final OtpErlangDecodeException e) { - System.out.println(" " + "can't decode output buffer: " - + e); - } - } - header.writeToAndFlush(socket.getOutputStream()); - } catch (final IOException e) { - close(); - throw e; - } + throws IOException { + try { + if (traceLevel >= ctrlThreshold) { + try { + final OtpErlangObject h = header.getOtpInputStream(5) + .read_any(); + System.out.println("-> " + headerType(h) + " " + h); + } catch (final OtpErlangDecodeException e) { + System.out.println(" " + "can't decode output buffer: " + + e); + } + } + header.writeTo(socket.getOutputStream()); + } catch (final IOException e) { + close(); + throw e; + } } protected String headerType(final OtpErlangObject h) { - int tag = -1; + int tag = -1; - if (h instanceof OtpErlangTuple) { - tag = (int) ((OtpErlangLong) ((OtpErlangTuple) h).elementAt(0)) - .longValue(); - } + if (h instanceof OtpErlangTuple) { + tag = (int) ((OtpErlangLong) ((OtpErlangTuple) h).elementAt(0)) + .longValue(); + } - switch (tag) { - case linkTag: - return "LINK"; + switch (tag) { + case linkTag: + return "LINK"; - case sendTag: - return "SEND"; + case sendTag: + return "SEND"; - case exitTag: - return "EXIT"; + case exitTag: + return "EXIT"; - case unlinkTag: - return "UNLINK"; + case unlinkTag: + return "UNLINK"; - case regSendTag: - return "REG_SEND"; + case regSendTag: + return "REG_SEND"; - case groupLeaderTag: - return "GROUP_LEADER"; + case groupLeaderTag: + return "GROUP_LEADER"; - case exit2Tag: - return "EXIT2"; + case exit2Tag: + return "EXIT2"; - case sendTTTag: - return "SEND_TT"; + case sendTTTag: + return "SEND_TT"; - case exitTTTag: - return "EXIT_TT"; + case exitTTTag: + return "EXIT_TT"; - case regSendTTTag: - return "REG_SEND_TT"; + case regSendTTTag: + return "REG_SEND_TT"; - case exit2TTTag: - return "EXIT2_TT"; - } + case exit2TTTag: + return "EXIT2_TT"; + } - return "(unknown type)"; + return "(unknown type)"; } /* this method now throws exception if we don't get full read */ - protected int readSock(final OtpTransport s, final byte[] b) - throws IOException { - int got = 0; - final int len = b.length; - int i; - - synchronized (this) { - if (s == null) { - throw new IOException("expected " + len - + " bytes, socket was closed"); - } - } - - while (got < len) { - i = s.getInputStream().read(b, got, len - got); - - if (i < 0) { - throw new IOException("expected " + len - + " bytes, got EOF after " + got + " bytes"); - } else if (i == 0 && len != 0) { - /* - * This is a corner case. According to - * http://java.sun.com/j2se/1.4.2/docs/api/ class InputStream - * is.read(,,l) can only return 0 if l==0. In other words it - * should not happen, but apparently did. - */ - throw new IOException("Remote connection closed"); - } else { - got += i; - } - } - return got; + protected int readSock(final Socket s, final byte[] b) throws IOException { + int got = 0; + final int len = b.length; + int i; + InputStream is = null; + + synchronized (this) { + if (s == null) { + throw new IOException("expected " + len + + " bytes, socket was closed"); + } + is = s.getInputStream(); + } + + while (got < len) { + i = is.read(b, got, len - got); + + if (i < 0) { + throw new IOException("expected " + len + + " bytes, got EOF after " + got + " bytes"); + } else if (i == 0 && len != 0) { + /* + * This is a corner case. According to + * http://java.sun.com/j2se/1.4.2/docs/api/ class InputStream + * is.read(,,l) can only return 0 if l==0. In other words it + * should not happen, but apparently did. + */ + throw new IOException("Remote connection closed"); + } else { + got += i; + } + } + return got; } protected void doAccept() throws IOException, OtpAuthException { - try { - sendStatus("ok"); - final int our_challenge = genChallenge(); - sendChallenge(peer.distChoose, localNode.flags, our_challenge); - final int her_challenge = recvChallengeReply(our_challenge); - final byte[] our_digest = genDigest(her_challenge, - localNode.cookie()); - sendChallengeAck(our_digest); - connected = true; - cookieOk = true; - sendCookie = false; - } catch (final IOException ie) { - close(); - throw ie; - } catch (final OtpAuthException ae) { - close(); - throw ae; - } catch (final Exception e) { - final String nn = peer.node(); - close(); - final IOException ioe = new IOException( - "Error accepting connection from " + nn); - ioe.initCause(e); - throw ioe; - } - if (traceLevel >= handshakeThreshold) { - System.out.println("<- MD5 ACCEPTED " + peer.host()); - } + try { + sendStatus("ok"); + final int our_challenge = genChallenge(); + sendChallenge(peer.distChoose, self.flags, our_challenge); + final int her_challenge = recvChallengeReply(our_challenge); + final byte[] our_digest = genDigest(her_challenge, self.cookie()); + sendChallengeAck(our_digest); + connected = true; + cookieOk = true; + sendCookie = false; + } catch (final IOException ie) { + close(); + throw ie; + } catch (final OtpAuthException ae) { + close(); + throw ae; + } catch (final Exception e) { + final String nn = peer.node(); + close(); + IOException ioe = new IOException("Error accepting connection from " + nn); + ioe.initCause(e); + throw ioe; + } + if (traceLevel >= handshakeThreshold) { + System.out.println("<- MD5 ACCEPTED " + peer.host()); + } } protected void doConnect(final int port) throws IOException, - OtpAuthException { - try { - socket = peer.createTransport(peer.host(), port); - - if (traceLevel >= handshakeThreshold) { - System.out.println("-> MD5 CONNECT TO " + peer.host() + ":" - + port); - } - sendName(peer.distChoose, localNode.flags); - recvStatus(); - final int her_challenge = recvChallenge(); - final byte[] our_digest = genDigest(her_challenge, - localNode.cookie()); - final int our_challenge = genChallenge(); - sendChallengeReply(our_challenge, our_digest); - recvChallengeAck(our_challenge); - cookieOk = true; - sendCookie = false; - } catch (final OtpAuthException ae) { - close(); - throw ae; - } catch (final Exception e) { - close(); - final IOException ioe = new IOException( - "Cannot connect to peer node"); - ioe.initCause(e); - throw ioe; - } + OtpAuthException { + try { + socket = new Socket(peer.host(), port); + socket.setTcpNoDelay(true); + + if (traceLevel >= handshakeThreshold) { + System.out.println("-> MD5 CONNECT TO " + peer.host() + ":" + + port); + } + sendName(peer.distChoose, self.flags); + recvStatus(); + final int her_challenge = recvChallenge(); + final byte[] our_digest = genDigest(her_challenge, self.cookie()); + final int our_challenge = genChallenge(); + sendChallengeReply(our_challenge, our_digest); + recvChallengeAck(our_challenge); + cookieOk = true; + sendCookie = false; + } catch (final OtpAuthException ae) { + close(); + throw ae; + } catch (final Exception e) { + close(); + IOException ioe = new IOException("Cannot connect to peer node"); + ioe.initCause(e); + throw ioe; + } } // This is nooo good as a challenge, // XXX fix me. static protected int genChallenge() { - return random.nextInt(); + return random.nextInt(); } // Used to debug print a message digest static String hex0(final byte x) { - final char tab[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', 'f' }; - int uint; - if (x < 0) { - uint = x & 0x7F; - uint |= 1 << 7; - } else { - uint = x; - } - return "" + tab[uint >>> 4] + tab[uint & 0xF]; + final char tab[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f' }; + int uint; + if (x < 0) { + uint = x & 0x7F; + uint |= 1 << 7; + } else { + uint = x; + } + return "" + tab[uint >>> 4] + tab[uint & 0xF]; } static String hex(final byte[] b) { - final StringBuffer sb = new StringBuffer(); - try { - int i; - for (i = 0; i < b.length; ++i) { - sb.append(hex0(b[i])); - } - } catch (final Exception e) { - // Debug function, ignore errors. - } - return sb.toString(); + final StringBuffer sb = new StringBuffer(); + try { + int i; + for (i = 0; i < b.length; ++i) { + sb.append(hex0(b[i])); + } + } catch (final Exception e) { + // Debug function, ignore errors. + } + return sb.toString(); } protected byte[] genDigest(final int challenge, final String cookie) { - int i; - long ch2; + int i; + long ch2; - if (challenge < 0) { - ch2 = 1L << 31; - ch2 |= challenge & 0x7FFFFFFF; - } else { - ch2 = challenge; - } - final OtpMD5 context = new OtpMD5(); - context.update(cookie); - context.update("" + ch2); - - final int[] tmp = context.final_bytes(); - final byte[] res = new byte[tmp.length]; - for (i = 0; i < tmp.length; ++i) { - res[i] = (byte) (tmp[i] & 0xFF); - } - return res; - } - - protected void sendName(final int dist, final int aflags) - throws IOException { - - @SuppressWarnings("resource") - final OtpOutputStream obuf = new OtpOutputStream(); - final String str = localNode.node(); - obuf.write2BE(str.length() + 7); // 7 bytes + nodename - obuf.write1(AbstractNode.NTYPE_R6); - obuf.write2BE(dist); - obuf.write4BE(aflags); - obuf.write(str.getBytes()); - - obuf.writeToAndFlush(socket.getOutputStream()); - - if (traceLevel >= handshakeThreshold) { - System.out.println("-> " + "HANDSHAKE sendName" + " flags=" - + aflags + " dist=" + dist + " local=" + localNode); - } - } - - protected void sendChallenge(final int dist, final int aflags, - final int challenge) throws IOException { - - @SuppressWarnings("resource") - final OtpOutputStream obuf = new OtpOutputStream(); - final String str = localNode.node(); - obuf.write2BE(str.length() + 11); // 11 bytes + nodename - obuf.write1(AbstractNode.NTYPE_R6); - obuf.write2BE(dist); - obuf.write4BE(aflags); - obuf.write4BE(challenge); - obuf.write(str.getBytes()); - - obuf.writeToAndFlush(socket.getOutputStream()); - - if (traceLevel >= handshakeThreshold) { - System.out.println("-> " + "HANDSHAKE sendChallenge" + " flags=" - + aflags + " dist=" + dist + " challenge=" + challenge - + " local=" + localNode); - } + if (challenge < 0) { + ch2 = 1L << 31; + ch2 |= challenge & 0x7FFFFFFF; + } else { + ch2 = challenge; + } + final OtpMD5 context = new OtpMD5(); + context.update(cookie); + context.update("" + ch2); + + final int[] tmp = context.final_bytes(); + final byte[] res = new byte[tmp.length]; + for (i = 0; i < tmp.length; ++i) { + res[i] = (byte) (tmp[i] & 0xFF); + } + return res; + } + + protected void sendName(final int dist, final int flags) throws IOException { + + final OtpOutputStream obuf = new OtpOutputStream(); + final String str = self.node(); + obuf.write2BE(str.length() + 7); // 7 bytes + nodename + obuf.write1(AbstractNode.NTYPE_R6); + obuf.write2BE(dist); + obuf.write4BE(flags); + obuf.write(str.getBytes()); + + obuf.writeTo(socket.getOutputStream()); + + if (traceLevel >= handshakeThreshold) { + System.out.println("-> " + "HANDSHAKE sendName" + " flags=" + flags + + " dist=" + dist + " local=" + self); + } + } + + protected void sendChallenge(final int dist, final int flags, + final int challenge) throws IOException { + + final OtpOutputStream obuf = new OtpOutputStream(); + final String str = self.node(); + obuf.write2BE(str.length() + 11); // 11 bytes + nodename + obuf.write1(AbstractNode.NTYPE_R6); + obuf.write2BE(dist); + obuf.write4BE(flags); + obuf.write4BE(challenge); + obuf.write(str.getBytes()); + + obuf.writeTo(socket.getOutputStream()); + + if (traceLevel >= handshakeThreshold) { + System.out.println("-> " + "HANDSHAKE sendChallenge" + " flags=" + + flags + " dist=" + dist + " challenge=" + challenge + + " local=" + self); + } } protected byte[] read2BytePackage() throws IOException, - OtpErlangDecodeException { + OtpErlangDecodeException { - final byte[] lbuf = new byte[2]; - byte[] tmpbuf; + final byte[] lbuf = new byte[2]; + byte[] tmpbuf; - readSock(socket, lbuf); - @SuppressWarnings("resource") - final OtpInputStream ibuf = new OtpInputStream(lbuf, 0); - final int len = ibuf.read2BE(); - tmpbuf = new byte[len]; - readSock(socket, tmpbuf); - return tmpbuf; - } - - protected void recvName(final OtpPeer apeer) throws IOException { - - String hisname = ""; - - try { - final byte[] tmpbuf = read2BytePackage(); - @SuppressWarnings("resource") - final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); - byte[] tmpname; - final int len = tmpbuf.length; - apeer.ntype = ibuf.read1(); - if (apeer.ntype != AbstractNode.NTYPE_R6) { - throw new IOException("Unknown remote node type"); - } - apeer.distLow = apeer.distHigh = ibuf.read2BE(); - if (apeer.distLow < 5) { - throw new IOException("Unknown remote node type"); - } - apeer.flags = ibuf.read4BE(); - tmpname = new byte[len - 7]; - ibuf.readN(tmpname); - hisname = OtpErlangString.newString(tmpname); - // Set the old nodetype parameter to indicate hidden/normal status - // When the old handshake is removed, the ntype should also be. - if ((apeer.flags & AbstractNode.dFlagPublished) != 0) { - apeer.ntype = AbstractNode.NTYPE_R4_ERLANG; - } else { - apeer.ntype = AbstractNode.NTYPE_R4_HIDDEN; - } - - if ((apeer.flags & AbstractNode.dFlagExtendedReferences) == 0) { - throw new IOException( - "Handshake failed - peer cannot handle extended references"); - } - - if ((apeer.flags & AbstractNode.dFlagExtendedPidsPorts) == 0) { - throw new IOException( - "Handshake failed - peer cannot handle extended pids and ports"); - } - - } catch (final OtpErlangDecodeException e) { - throw new IOException("Handshake failed - not enough data"); - } - - final int i = hisname.indexOf('@', 0); - apeer.node = hisname; - apeer.alive = hisname.substring(0, i); - apeer.host = hisname.substring(i + 1, hisname.length()); - - if (traceLevel >= handshakeThreshold) { - System.out.println("<- " + "HANDSHAKE" + " ntype=" + apeer.ntype - + " dist=" + apeer.distHigh + " remote=" + apeer); - } + readSock(socket, lbuf); + final OtpInputStream ibuf = new OtpInputStream(lbuf, 0); + final int len = ibuf.read2BE(); + tmpbuf = new byte[len]; + readSock(socket, tmpbuf); + return tmpbuf; + } + + protected void recvName(final OtpPeer peer) throws IOException { + + String hisname = ""; + + try { + final byte[] tmpbuf = read2BytePackage(); + final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); + byte[] tmpname; + final int len = tmpbuf.length; + peer.ntype = ibuf.read1(); + if (peer.ntype != AbstractNode.NTYPE_R6) { + throw new IOException("Unknown remote node type"); + } + peer.distLow = peer.distHigh = ibuf.read2BE(); + if (peer.distLow < 5) { + throw new IOException("Unknown remote node type"); + } + peer.flags = ibuf.read4BE(); + tmpname = new byte[len - 7]; + ibuf.readN(tmpname); + hisname = OtpErlangString.newString(tmpname); + // Set the old nodetype parameter to indicate hidden/normal status + // When the old handshake is removed, the ntype should also be. + if ((peer.flags & AbstractNode.dFlagPublished) != 0) { + peer.ntype = AbstractNode.NTYPE_R4_ERLANG; + } else { + peer.ntype = AbstractNode.NTYPE_R4_HIDDEN; + } + + if ((peer.flags & AbstractNode.dFlagExtendedReferences) == 0) { + throw new IOException( + "Handshake failed - peer cannot handle extended references"); + } + + if ((peer.flags & AbstractNode.dFlagExtendedPidsPorts) == 0) { + throw new IOException( + "Handshake failed - peer cannot handle extended pids and ports"); + } + + } catch (final OtpErlangDecodeException e) { + throw new IOException("Handshake failed - not enough data"); + } + + final int i = hisname.indexOf('@', 0); + peer.node = hisname; + peer.alive = hisname.substring(0, i); + peer.host = hisname.substring(i + 1, hisname.length()); + + if (traceLevel >= handshakeThreshold) { + System.out.println("<- " + "HANDSHAKE" + " ntype=" + peer.ntype + + " dist=" + peer.distHigh + " remote=" + peer); + } } protected int recvChallenge() throws IOException { - int challenge; + int challenge; - try { - final byte[] buf = read2BytePackage(); - @SuppressWarnings("resource") - final OtpInputStream ibuf = new OtpInputStream(buf, 0); - peer.ntype = ibuf.read1(); - if (peer.ntype != AbstractNode.NTYPE_R6) { - throw new IOException("Unexpected peer type"); - } - peer.distLow = peer.distHigh = ibuf.read2BE(); - peer.flags = ibuf.read4BE(); - challenge = ibuf.read4BE(); - final byte[] tmpname = new byte[buf.length - 11]; - ibuf.readN(tmpname); - final String hisname = OtpErlangString.newString(tmpname); - if (!hisname.equals(peer.node)) { - throw new IOException( - "Handshake failed - peer has wrong name: " + hisname); - } - - if ((peer.flags & AbstractNode.dFlagExtendedReferences) == 0) { - throw new IOException( - "Handshake failed - peer cannot handle extended references"); - } - - if ((peer.flags & AbstractNode.dFlagExtendedPidsPorts) == 0) { - throw new IOException( - "Handshake failed - peer cannot handle extended pids and ports"); - } - - } catch (final OtpErlangDecodeException e) { - throw new IOException("Handshake failed - not enough data"); - } - - if (traceLevel >= handshakeThreshold) { - System.out.println("<- " + "HANDSHAKE recvChallenge" + " from=" - + peer.node + " challenge=" + challenge + " local=" - + localNode); - } + try { + final byte[] buf = read2BytePackage(); + final OtpInputStream ibuf = new OtpInputStream(buf, 0); + peer.ntype = ibuf.read1(); + if (peer.ntype != AbstractNode.NTYPE_R6) { + throw new IOException("Unexpected peer type"); + } + peer.distLow = peer.distHigh = ibuf.read2BE(); + peer.flags = ibuf.read4BE(); + challenge = ibuf.read4BE(); + final byte[] tmpname = new byte[buf.length - 11]; + ibuf.readN(tmpname); + final String hisname = OtpErlangString.newString(tmpname); + if (!hisname.equals(peer.node)) { + throw new IOException( + "Handshake failed - peer has wrong name: " + hisname); + } + + if ((peer.flags & AbstractNode.dFlagExtendedReferences) == 0) { + throw new IOException( + "Handshake failed - peer cannot handle extended references"); + } + + if ((peer.flags & AbstractNode.dFlagExtendedPidsPorts) == 0) { + throw new IOException( + "Handshake failed - peer cannot handle extended pids and ports"); + } + + } catch (final OtpErlangDecodeException e) { + throw new IOException("Handshake failed - not enough data"); + } + + if (traceLevel >= handshakeThreshold) { + System.out.println("<- " + "HANDSHAKE recvChallenge" + " from=" + + peer.node + " challenge=" + challenge + " local=" + self); + } - return challenge; + return challenge; } protected void sendChallengeReply(final int challenge, final byte[] digest) - throws IOException { + throws IOException { - @SuppressWarnings("resource") - final OtpOutputStream obuf = new OtpOutputStream(); - obuf.write2BE(21); - obuf.write1(ChallengeReply); - obuf.write4BE(challenge); - obuf.write(digest); - obuf.writeToAndFlush(socket.getOutputStream()); - - if (traceLevel >= handshakeThreshold) { - System.out.println("-> " + "HANDSHAKE sendChallengeReply" - + " challenge=" + challenge + " digest=" + hex(digest) - + " local=" + localNode); - } + final OtpOutputStream obuf = new OtpOutputStream(); + obuf.write2BE(21); + obuf.write1(ChallengeReply); + obuf.write4BE(challenge); + obuf.write(digest); + obuf.writeTo(socket.getOutputStream()); + + if (traceLevel >= handshakeThreshold) { + System.out.println("-> " + "HANDSHAKE sendChallengeReply" + + " challenge=" + challenge + " digest=" + hex(digest) + + " local=" + self); + } } // Would use Array.equals in newer JDK... private boolean digests_equals(final byte[] a, final byte[] b) { - int i; - for (i = 0; i < 16; ++i) { - if (a[i] != b[i]) { - return false; - } - } - return true; + int i; + for (i = 0; i < 16; ++i) { + if (a[i] != b[i]) { + return false; + } + } + return true; } protected int recvChallengeReply(final int our_challenge) - throws IOException, OtpAuthException { + throws IOException, OtpAuthException { - int challenge; - final byte[] her_digest = new byte[16]; + int challenge; + final byte[] her_digest = new byte[16]; - try { - final byte[] buf = read2BytePackage(); - @SuppressWarnings("resource") - final OtpInputStream ibuf = new OtpInputStream(buf, 0); - final int tag = ibuf.read1(); - if (tag != ChallengeReply) { - throw new IOException("Handshake protocol error"); - } - challenge = ibuf.read4BE(); - ibuf.readN(her_digest); - final byte[] our_digest = genDigest(our_challenge, - localNode.cookie()); - if (!digests_equals(her_digest, our_digest)) { - throw new OtpAuthException("Peer authentication error."); - } - } catch (final OtpErlangDecodeException e) { - throw new IOException("Handshake failed - not enough data"); - } - - if (traceLevel >= handshakeThreshold) { - System.out.println("<- " + "HANDSHAKE recvChallengeReply" - + " from=" + peer.node + " challenge=" + challenge - + " digest=" + hex(her_digest) + " local=" + localNode); - } + try { + final byte[] buf = read2BytePackage(); + final OtpInputStream ibuf = new OtpInputStream(buf, 0); + final int tag = ibuf.read1(); + if (tag != ChallengeReply) { + throw new IOException("Handshake protocol error"); + } + challenge = ibuf.read4BE(); + ibuf.readN(her_digest); + final byte[] our_digest = genDigest(our_challenge, self.cookie()); + if (!digests_equals(her_digest, our_digest)) { + throw new OtpAuthException("Peer authentication error."); + } + } catch (final OtpErlangDecodeException e) { + throw new IOException("Handshake failed - not enough data"); + } + + if (traceLevel >= handshakeThreshold) { + System.out.println("<- " + "HANDSHAKE recvChallengeReply" + + " from=" + peer.node + " challenge=" + challenge + + " digest=" + hex(her_digest) + " local=" + self); + } - return challenge; + return challenge; } protected void sendChallengeAck(final byte[] digest) throws IOException { - @SuppressWarnings("resource") - final OtpOutputStream obuf = new OtpOutputStream(); - obuf.write2BE(17); - obuf.write1(ChallengeAck); - obuf.write(digest); - - obuf.writeToAndFlush(socket.getOutputStream()); - - if (traceLevel >= handshakeThreshold) { - System.out.println("-> " + "HANDSHAKE sendChallengeAck" - + " digest=" + hex(digest) + " local=" + localNode); - } + final OtpOutputStream obuf = new OtpOutputStream(); + obuf.write2BE(17); + obuf.write1(ChallengeAck); + obuf.write(digest); + + obuf.writeTo(socket.getOutputStream()); + + if (traceLevel >= handshakeThreshold) { + System.out.println("-> " + "HANDSHAKE sendChallengeAck" + + " digest=" + hex(digest) + " local=" + self); + } } protected void recvChallengeAck(final int our_challenge) - throws IOException, OtpAuthException { + throws IOException, OtpAuthException { - final byte[] her_digest = new byte[16]; - try { - final byte[] buf = read2BytePackage(); - @SuppressWarnings("resource") - final OtpInputStream ibuf = new OtpInputStream(buf, 0); - final int tag = ibuf.read1(); - if (tag != ChallengeAck) { - throw new IOException("Handshake protocol error"); - } - ibuf.readN(her_digest); - final byte[] our_digest = genDigest(our_challenge, - localNode.cookie()); - if (!digests_equals(her_digest, our_digest)) { - throw new OtpAuthException("Peer authentication error."); - } - } catch (final OtpErlangDecodeException e) { - throw new IOException("Handshake failed - not enough data"); - } catch (final Exception e) { - throw new OtpAuthException("Peer authentication error."); - } - - if (traceLevel >= handshakeThreshold) { - System.out.println("<- " + "HANDSHAKE recvChallengeAck" + " from=" - + peer.node + " digest=" + hex(her_digest) + " local=" - + localNode); - } + final byte[] her_digest = new byte[16]; + try { + final byte[] buf = read2BytePackage(); + final OtpInputStream ibuf = new OtpInputStream(buf, 0); + final int tag = ibuf.read1(); + if (tag != ChallengeAck) { + throw new IOException("Handshake protocol error"); + } + ibuf.readN(her_digest); + final byte[] our_digest = genDigest(our_challenge, self.cookie()); + if (!digests_equals(her_digest, our_digest)) { + throw new OtpAuthException("Peer authentication error."); + } + } catch (final OtpErlangDecodeException e) { + throw new IOException("Handshake failed - not enough data"); + } catch (final Exception e) { + throw new OtpAuthException("Peer authentication error."); + } + + if (traceLevel >= handshakeThreshold) { + System.out.println("<- " + "HANDSHAKE recvChallengeAck" + " from=" + + peer.node + " digest=" + hex(her_digest) + " local=" + + self); + } } protected void sendStatus(final String status) throws IOException { - @SuppressWarnings("resource") - final OtpOutputStream obuf = new OtpOutputStream(); - obuf.write2BE(status.length() + 1); - obuf.write1(ChallengeStatus); - obuf.write(status.getBytes()); - - obuf.writeToAndFlush(socket.getOutputStream()); - - if (traceLevel >= handshakeThreshold) { - System.out.println("-> " + "HANDSHAKE sendStatus" + " status=" - + status + " local=" + localNode); - } + final OtpOutputStream obuf = new OtpOutputStream(); + obuf.write2BE(status.length() + 1); + obuf.write1(ChallengeStatus); + obuf.write(status.getBytes()); + + obuf.writeTo(socket.getOutputStream()); + + if (traceLevel >= handshakeThreshold) { + System.out.println("-> " + "HANDSHAKE sendStatus" + " status=" + + status + " local=" + self); + } } protected void recvStatus() throws IOException { - try { - final byte[] buf = read2BytePackage(); - @SuppressWarnings("resource") - final OtpInputStream ibuf = new OtpInputStream(buf, 0); - final int tag = ibuf.read1(); - if (tag != ChallengeStatus) { - throw new IOException("Handshake protocol error"); - } - final byte[] tmpbuf = new byte[buf.length - 1]; - ibuf.readN(tmpbuf); - final String status = OtpErlangString.newString(tmpbuf); - - if (status.compareTo("ok") != 0) { - throw new IOException("Peer replied with status '" + status - + "' instead of 'ok'"); - } - } catch (final OtpErlangDecodeException e) { - throw new IOException("Handshake failed - not enough data"); - } - if (traceLevel >= handshakeThreshold) { - System.out.println("<- " + "HANDSHAKE recvStatus (ok)" + " local=" - + localNode); - } + try { + final byte[] buf = read2BytePackage(); + final OtpInputStream ibuf = new OtpInputStream(buf, 0); + final int tag = ibuf.read1(); + if (tag != ChallengeStatus) { + throw new IOException("Handshake protocol error"); + } + final byte[] tmpbuf = new byte[buf.length - 1]; + ibuf.readN(tmpbuf); + final String status = OtpErlangString.newString(tmpbuf); + + if (status.compareTo("ok") != 0) { + throw new IOException("Peer replied with status '" + status + + "' instead of 'ok'"); + } + } catch (final OtpErlangDecodeException e) { + throw new IOException("Handshake failed - not enough data"); + } + if (traceLevel >= handshakeThreshold) { + System.out.println("<- " + "HANDSHAKE recvStatus (ok)" + " local=" + + self); + } } public void setFlags(final int flags) { - this.flags = flags; + this.flags = flags; } public int getFlags() { - return flags; + return flags; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,21 +1,20 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2014. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -30,7 +29,7 @@ *

    * Represents an OTP node. *

    - * + * *

    * About nodenames: Erlang nodenames consist of two components, an alivename and * a hostname separated by '@'. Additionally, there are two nodename formats: @@ -41,7 +40,7 @@ * however Jinterface makes no distinction. See the Erlang documentation for * more information about nodenames. *

    - * + * *

    * The constructors for the AbstractNode classes will create names exactly as * you provide them as long as the name contains '@'. If the string you provide @@ -49,7 +48,7 @@ * host will be appended, resulting in a shortname. Nodenames longer than 255 * characters will be truncated without warning. *

    - * + * *

    * Upon initialization, this class attempts to read the file .erlang.cookie in * the user's home directory, and uses the trimmed first line of the file as the @@ -59,20 +58,19 @@ * using the system property "user.home", which may not be automatically set on * all platforms. *

    - * + * *

    * Instances of this class cannot be created directly, use one of the subclasses * instead. *

    */ -public class AbstractNode implements OtpTransportFactory { +public class AbstractNode { static String localHost = null; String node; String host; String alive; String cookie; static String defaultCookie = null; - final OtpTransportFactory transportFactory; // Node types static final int NTYPE_R6 = 110; // 'n' post-r5, all nodes @@ -102,207 +100,168 @@ int distLow = 5; // Cannot talk to nodes before R6 int creation = 0; int flags = dFlagExtendedReferences | dFlagExtendedPidsPorts - | dFlagBitBinaries | dFlagNewFloats | dFlagFunTags - | dflagNewFunTags | dFlagUtf8Atoms | dFlagMapTag; + | dFlagBitBinaries | dFlagNewFloats | dFlagFunTags + | dflagNewFunTags | dFlagUtf8Atoms | dFlagMapTag; /* initialize hostname and default cookie */ static { - try { - localHost = InetAddress.getLocalHost().getHostName(); - /* - * Make sure it's a short name, i.e. strip of everything after first - * '.' - */ - final int dot = localHost.indexOf("."); - if (dot != -1) { - localHost = localHost.substring(0, dot); - } - } catch (final UnknownHostException e) { - localHost = "localhost"; - } + try { + localHost = InetAddress.getLocalHost().getHostName(); + /* + * Make sure it's a short name, i.e. strip of everything after first + * '.' + */ + final int dot = localHost.indexOf("."); + if (dot != -1) { + localHost = localHost.substring(0, dot); + } + } catch (final UnknownHostException e) { + localHost = "localhost"; + } - final String homeDir = getHomeDir(); - final String dotCookieFilename = homeDir + File.separator + final String homeDir = getHomeDir(); + final String dotCookieFilename = homeDir + File.separator + ".erlang.cookie"; - BufferedReader br = null; + BufferedReader br = null; - try { - final File dotCookieFile = new File(dotCookieFilename); + try { + final File dotCookieFile = new File(dotCookieFilename); - br = new BufferedReader(new FileReader(dotCookieFile)); - final String line = br.readLine(); - if (line == null) { - defaultCookie = ""; - } else { - defaultCookie = line.trim(); - } - } catch (final IOException e) { - defaultCookie = ""; - } finally { - try { - if (br != null) { - br.close(); - } - } catch (final IOException e) { - } - } + br = new BufferedReader(new FileReader(dotCookieFile)); + defaultCookie = br.readLine().trim(); + } catch (final IOException e) { + defaultCookie = ""; + } finally { + try { + if (br != null) { + br.close(); + } + } catch (final IOException e) { + } + } } - protected AbstractNode(final OtpTransportFactory transportFactory) { - this.transportFactory = transportFactory; + protected AbstractNode() { } /** - * Create a node with the given name and default cookie and transport - * factory. + * Create a node with the given name and the default cookie. */ protected AbstractNode(final String node) { - this(node, defaultCookie, new OtpSocketTransportFactory()); + this(node, defaultCookie); } /** - * Create a node with the given name, transport factory and the default - * cookie. - */ - protected AbstractNode(final String node, - final OtpTransportFactory transportFactory) { - this(node, defaultCookie, transportFactory); - } - - /** - * Create a node with the given name, cookie and default transport factory. + * Create a node with the given name and cookie. */ protected AbstractNode(final String name, final String cookie) { - this(name, cookie, new OtpSocketTransportFactory()); - } + this.cookie = cookie; - /** - * Create a node with the given name, cookie and transport factory. - */ - protected AbstractNode(final String name, final String cookie, - final OtpTransportFactory transportFactory) { - this.cookie = cookie; - this.transportFactory = transportFactory; - - final int i = name.indexOf('@', 0); - if (i < 0) { - alive = name; - host = localHost; - } else { - alive = name.substring(0, i); - host = name.substring(i + 1, name.length()); - } - - if (alive.length() > 0xff) { - alive = alive.substring(0, 0xff); - } + final int i = name.indexOf('@', 0); + if (i < 0) { + alive = name; + host = localHost; + } else { + alive = name.substring(0, i); + host = name.substring(i + 1, name.length()); + } + + if (alive.length() > 0xff) { + alive = alive.substring(0, 0xff); + } - node = alive + "@" + host; + node = alive + "@" + host; } /** * Get the name of this node. - * + * * @return the name of the node represented by this object. */ public String node() { - return node; + return node; } /** * Get the hostname part of the nodename. Nodenames are composed of two * parts, an alivename and a hostname, separated by '@'. This method returns * the part of the nodename following the '@'. - * + * * @return the hostname component of the nodename. */ public String host() { - return host; + return host; } /** * Get the alivename part of the hostname. Nodenames are composed of two * parts, an alivename and a hostname, separated by '@'. This method returns * the part of the nodename preceding the '@'. - * + * * @return the alivename component of the nodename. */ public String alive() { - return alive; + return alive; } /** * Get the authorization cookie used by this node. - * + * * @return the authorization cookie used by this node. */ public String cookie() { - return cookie; + return cookie; } // package scope int type() { - return ntype; + return ntype; } // package scope int distHigh() { - return distHigh; + return distHigh; } // package scope int distLow() { - return distLow; + return distLow; } // package scope: useless information? int proto() { - return proto; + return proto; } // package scope int creation() { - return creation; + return creation; } /** * Set the authorization cookie used by this node. - * + * * @return the previous authorization cookie used by this node. */ public String setCookie(final String cookie) { - final String prev = this.cookie; - this.cookie = cookie; - return prev; + final String prev = this.cookie; + this.cookie = cookie; + return prev; } @Override public String toString() { - return node(); + return node(); } private static String getHomeDir() { - final String home = System.getProperty("user.home"); - if (System.getProperty("os.name").toLowerCase().contains("windows")) { - final String drive = System.getenv("HOMEDRIVE"); - final String path = System.getenv("HOMEPATH"); - return drive != null && path != null ? drive + path : home; - } - return home; - } - - public OtpTransport createTransport(final String addr, final int port) - throws IOException { - return transportFactory.createTransport(addr, port); - } - - public OtpTransport createTransport(final InetAddress addr, final int port) - throws IOException { - return transportFactory.createTransport(addr, port); - } - - public OtpServerTransport createServerTransport(final int port) - throws IOException { - return transportFactory.createServerTransport(port); + final String home = System.getProperty("user.home"); + if (System.getProperty("os.name").toLowerCase().contains("windows")) { + final String drive = System.getenv("HOMEDRIVE"); + final String path = System.getenv("HOMEPATH"); + return (drive != null && path != null) ? drive + path : home; + } else { + return home; + } } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/GenericQueue.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/GenericQueue.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/GenericQueue.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/GenericQueue.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ -/* +/* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -35,128 +34,128 @@ private int count; private void init() { - head = null; - tail = null; - count = 0; + head = null; + tail = null; + count = 0; } /** Create an empty queue */ public GenericQueue() { - init(); - status = open; + init(); + status = open; } /** Clear a queue */ public void flush() { - init(); + init(); } public void close() { - status = closing; + status = closing; } /** * Add an object to the tail of the queue. - * + * * @param o - * Object to insert in the queue + * Object to insert in the queue */ public synchronized void put(final Object o) { - final Bucket b = new Bucket(o); + final Bucket b = new Bucket(o); - if (tail != null) { - tail.setNext(b); - tail = b; - } else { - // queue was empty but has one element now - head = tail = b; - } - count++; + if (tail != null) { + tail.setNext(b); + tail = b; + } else { + // queue was empty but has one element now + head = tail = b; + } + count++; - // notify any waiting tasks - notify(); + // notify any waiting tasks + notify(); } /** * Retrieve an object from the head of the queue, or block until one * arrives. - * + * * @return The object at the head of the queue. */ public synchronized Object get() { - Object o = null; + Object o = null; - while ((o = tryGet()) == null) { - try { - this.wait(); - } catch (final InterruptedException e) { - } - } - return o; + while ((o = tryGet()) == null) { + try { + this.wait(); + } catch (final InterruptedException e) { + } + } + return o; } /** * Retrieve an object from the head of the queue, blocking until one arrives * or until timeout occurs. - * + * * @param timeout - * Maximum time to block on queue, in ms. Use 0 to poll the - * queue. - * + * Maximum time to block on queue, in ms. Use 0 to poll the + * queue. + * * @exception InterruptedException - * if the operation times out. - * + * if the operation times out. + * * @return The object at the head of the queue, or null if none arrived in * time. */ public synchronized Object get(final long timeout) - throws InterruptedException { - if (status == closed) { - return null; - } - - long currentTime = System.currentTimeMillis(); - final long stopTime = currentTime + timeout; - Object o = null; - - while (true) { - if ((o = tryGet()) != null) { - return o; - } - - currentTime = System.currentTimeMillis(); - if (stopTime <= currentTime) { - throw new InterruptedException("Get operation timed out"); - } - - try { - this.wait(stopTime - currentTime); - } catch (final InterruptedException e) { - // ignore, but really should retry operation instead - } - } + throws InterruptedException { + if (status == closed) { + return null; + } + + long currentTime = System.currentTimeMillis(); + final long stopTime = currentTime + timeout; + Object o = null; + + while (true) { + if ((o = tryGet()) != null) { + return o; + } + + currentTime = System.currentTimeMillis(); + if (stopTime <= currentTime) { + throw new InterruptedException("Get operation timed out"); + } + + try { + this.wait(stopTime - currentTime); + } catch (final InterruptedException e) { + // ignore, but really should retry operation instead + } + } } // attempt to retrieve message from queue head public Object tryGet() { - Object o = null; + Object o = null; - if (head != null) { - o = head.getContents(); - head = head.getNext(); - count--; - - if (head == null) { - tail = null; - count = 0; - } - } + if (head != null) { + o = head.getContents(); + head = head.getNext(); + count--; + + if (head == null) { + tail = null; + count = 0; + } + } - return o; + return o; } public synchronized int getCount() { - return count; + return count; } /* @@ -164,24 +163,24 @@ * The container holds the queued object and a reference to the next Bucket. */ class Bucket { - private Bucket next; - private final Object contents; + private Bucket next; + private final Object contents; - public Bucket(final Object o) { - next = null; - contents = o; - } - - public void setNext(final Bucket newNext) { - next = newNext; - } - - public Bucket getNext() { - return next; - } - - public Object getContents() { - return contents; - } + public Bucket(final Object o) { + next = null; + contents = o; + } + + public void setNext(final Bucket newNext) { + next = newNext; + } + + public Bucket getNext() { + return next; + } + + public Object getContents() { + return contents; + } } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/java_files erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/java_files --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/java_files 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/java_files 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2000-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -54,13 +53,7 @@ OtpOutputStream \ OtpPeer \ OtpSelf \ - OtpServer \ - OtpServerSocketTransport \ - OtpServerTransport \ - OtpSocketTransport \ - OtpSocketTransportFactory \ - OtpTransport \ - OtpTransportFactory + OtpServer ERL = \ OtpErlangAtom \ diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/jinterface.app.src erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/jinterface.app.src --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/jinterface.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/jinterface.app.src 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2014. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% This is an -*- erlang -*- file. -%% - -{application, jinterface, - [ - {description, "Jinterface"}, - {vsn, "%VSN%"}, - {modules, []}, - {registered, []}, - {applications, []}, - {env, []}, - {runtime_dependencies, []} - ] -}. diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/jinterface.appup.src erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/jinterface.appup.src --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/jinterface.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/jinterface.appup.src 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -%% -*- erlang -*- -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2014. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -{"%VSN%", [], []}. diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Link.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Link.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Link.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Link.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -26,34 +25,33 @@ private int hashCodeValue = 0; public Link(final OtpErlangPid local, final OtpErlangPid remote) { - this.local = local; - this.remote = remote; + this.local = local; + this.remote = remote; } public OtpErlangPid local() { - return local; + return local; } public OtpErlangPid remote() { - return remote; + return remote; } public boolean contains(final OtpErlangPid pid) { - return local.equals(pid) || remote.equals(pid); + return local.equals(pid) || remote.equals(pid); } - public boolean equals(final OtpErlangPid alocal, final OtpErlangPid aremote) { - return local.equals(alocal) && remote.equals(aremote) - || local.equals(aremote) && remote.equals(alocal); + public boolean equals(final OtpErlangPid local, final OtpErlangPid remote) { + return this.local.equals(local) && this.remote.equals(remote) + || this.local.equals(remote) && this.remote.equals(local); } - - @Override + public int hashCode() { - if (hashCodeValue == 0) { - final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(5); - hash.combine(local.hashCode() + remote.hashCode()); - hashCodeValue = hash.valueOf(); - } - return hashCodeValue; + if (hashCodeValue == 0) { + OtpErlangObject.Hash hash = new OtpErlangObject.Hash(5); + hash.combine(local.hashCode() + remote.hashCode()); + hashCodeValue = hash.valueOf(); + } + return hashCodeValue; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Links.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Links.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Links.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Links.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -25,100 +24,100 @@ int count; Links() { - this(10); + this(10); } Links(final int initialSize) { - links = new Link[initialSize]; - count = 0; + links = new Link[initialSize]; + count = 0; } synchronized void addLink(final OtpErlangPid local, - final OtpErlangPid remote) { - if (find(local, remote) == -1) { - if (count >= links.length) { - final Link[] tmp = new Link[count * 2]; - System.arraycopy(links, 0, tmp, 0, count); - links = tmp; - } - links[count++] = new Link(local, remote); - } + final OtpErlangPid remote) { + if (find(local, remote) == -1) { + if (count >= links.length) { + final Link[] tmp = new Link[count * 2]; + System.arraycopy(links, 0, tmp, 0, count); + links = tmp; + } + links[count++] = new Link(local, remote); + } } synchronized void removeLink(final OtpErlangPid local, - final OtpErlangPid remote) { - int i; + final OtpErlangPid remote) { + int i; - if ((i = find(local, remote)) != -1) { - count--; - links[i] = links[count]; - links[count] = null; - } + if ((i = find(local, remote)) != -1) { + count--; + links[i] = links[count]; + links[count] = null; + } } synchronized boolean exists(final OtpErlangPid local, - final OtpErlangPid remote) { - return find(local, remote) != -1; + final OtpErlangPid remote) { + return find(local, remote) != -1; } synchronized int find(final OtpErlangPid local, final OtpErlangPid remote) { - for (int i = 0; i < count; i++) { - if (links[i].equals(local, remote)) { - return i; - } - } - return -1; + for (int i = 0; i < count; i++) { + if (links[i].equals(local, remote)) { + return i; + } + } + return -1; } int count() { - return count; + return count; } /* all local pids get notified about broken connection */ synchronized OtpErlangPid[] localPids() { - OtpErlangPid[] ret = null; - if (count != 0) { - ret = new OtpErlangPid[count]; - for (int i = 0; i < count; i++) { - ret[i] = links[i].local(); - } - } - return ret; + OtpErlangPid[] ret = null; + if (count != 0) { + ret = new OtpErlangPid[count]; + for (int i = 0; i < count; i++) { + ret[i] = links[i].local(); + } + } + return ret; } /* all remote pids get notified about failed pid */ synchronized OtpErlangPid[] remotePids() { - OtpErlangPid[] ret = null; - if (count != 0) { - ret = new OtpErlangPid[count]; - for (int i = 0; i < count; i++) { - ret[i] = links[i].remote(); - } - } - return ret; + OtpErlangPid[] ret = null; + if (count != 0) { + ret = new OtpErlangPid[count]; + for (int i = 0; i < count; i++) { + ret[i] = links[i].remote(); + } + } + return ret; } /* clears the link table, returns a copy */ synchronized Link[] clearLinks() { - Link[] ret = null; - if (count != 0) { - ret = new Link[count]; - for (int i = 0; i < count; i++) { - ret[i] = links[i]; - links[i] = null; - } - count = 0; - } - return ret; + Link[] ret = null; + if (count != 0) { + ret = new Link[count]; + for (int i = 0; i < count; i++) { + ret[i] = links[i]; + links[i] = null; + } + count = 0; + } + return ret; } /* returns a copy of the link table */ synchronized Link[] links() { - Link[] ret = null; - if (count != 0) { - ret = new Link[count]; - System.arraycopy(links, 0, ret, 0, count); - } - return ret; + Link[] ret = null; + if (count != 0) { + ret = new Link[count]; + System.arraycopy(links, 0, ret, 0, count); + } + return ret; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ # # Copyright Ericsson AB 2000-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -33,18 +32,6 @@ include $(ERL_TOP)/lib/jinterface/vsn.mk VSN=$(JINTERFACE_VSN) -# - -EBINDIR=$(ERL_TOP)/lib/jinterface/ebin - -APP_FILE= jinterface.app -APP_SRC= $(APP_FILE).src -APP_TARGET= $(EBINDIR)/$(APP_FILE) - -APPUP_FILE= jinterface.appup -APPUP_SRC= $(APPUP_FILE).src -APPUP_TARGET= $(EBINDIR)/$(APPUP_FILE) - # ---------------------------------------------------- # Release directory specification # ---------------------------------------------------- @@ -58,7 +45,7 @@ # all java sourcefiles listed in common include file include $(ERL_TOP)/lib/jinterface/java_src/$(JAVA_CLASS_SUBDIR)/java_files -TARGET_FILES= $(JAVA_FILES:%=$(JAVA_DEST_ROOT)$(JAVA_CLASS_SUBDIR)%.class) $(APP_TARGET) $(APPUP_TARGET) +TARGET_FILES= $(JAVA_FILES:%=$(JAVA_DEST_ROOT)$(JAVA_CLASS_SUBDIR)%.class) JAVA_SRC= $(JAVA_FILES:%=%.java) JARFILE= OtpErlang.jar @@ -79,7 +66,7 @@ JARFLAGS=-cfv endif -JAVA_OPTIONS = -Xlint +JAVA_OPTIONS = ifeq ($(TESTROOT),) RELEASE_PATH="$(ERL_TOP)/release/$(TARGET)" @@ -92,11 +79,6 @@ # Make Rules # ---------------------------------------------------- -$(APP_TARGET): $(APP_SRC) $(ERL_TOP)/lib/jinterface/vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(JINTERFACE_VSN);' $< > $@ -$(APPUP_TARGET): $(APPUP_SRC) $(ERL_TOP)/lib/jinterface/vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(JINTERFACE_VSN);' $< > $@ - debug opt: make_dirs $(JAVA_DEST_ROOT)$(JARFILE) make_dirs: @@ -124,9 +106,6 @@ $(V_at)$(INSTALL_DATA) $(JAVA_SRC) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang" $(V_at)$(INSTALL_DIR) "$(RELSYSDIR)/priv" $(V_at)$(INSTALL_DATA) $(JAVA_DEST_ROOT)$(JARFILE) "$(RELSYSDIR)/priv" - $(V_at)$(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(V_at)$(INSTALL_DATA) $(APP_TARGET) "$(RELSYSDIR)/ebin/$(APP_FILE)" - $(V_at)$(INSTALL_DATA) $(APPUP_TARGET) "$(RELSYSDIR)/ebin/$(APPUP_FILE)" release_docs_spec: @@ -134,3 +113,4 @@ # ---------------------------------------------------- + diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpAuthException.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpAuthException.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpAuthException.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpAuthException.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -23,7 +22,7 @@ * Exception raised when a node attempts to establish a communication channel * when it is not authorized to do so, or when a node sends a message containing * an invalid cookie on an established channel. - * + * * @see OtpConnection */ public class OtpAuthException extends OtpException { @@ -33,6 +32,6 @@ * Provides a detailed message. */ public OtpAuthException(final String s) { - super(s); + super(s); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpConnection.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpConnection.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpConnection.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpConnection.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,46 +1,46 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; import java.io.IOException; +import java.net.Socket; /** * Maintains a connection between a Java process and a remote Erlang, Java or C * node. The object maintains connection state and allows data to be sent to and * received from the peer. - * + * *

    * Once a connection is established between the local node and a remote node, * the connection object can be used to send and receive messages between the * nodes and make rpc calls (assuming that the remote node is a real Erlang * node). - * + * *

    * The various receive methods are all blocking and will return only when a * valid message has been received or an exception is raised. - * + * *

    * If an exception occurs in any of the methods in this class, the connection * will be closed and must be explicitely reopened in order to resume * communication with the peer. - * + * *

    * It is not possible to create an instance of this class directly. * OtpConnection objects are returned by {@link OtpSelf#connect(OtpPeer) @@ -55,66 +55,66 @@ * OtpSelf#accept() OtpSelf.accept()} to create a connection based on data * received when handshaking with the peer node, when the remote node is the * connection intitiator. - * + * * @exception java.io.IOException if it was not possible to connect to the * peer. - * + * * @exception OtpAuthException if handshake resulted in an authentication * error */ // package scope - OtpConnection(final OtpSelf self, final OtpTransport s) - throws IOException, OtpAuthException { - super(self, s); - this.self = self; - queue = new GenericQueue(); - start(); + OtpConnection(final OtpSelf self, final Socket s) throws IOException, + OtpAuthException { + super(self, s); + this.self = self; + queue = new GenericQueue(); + start(); } /* * Intiate and open a connection to a remote node. - * + * * @exception java.io.IOException if it was not possible to connect to the * peer. - * + * * @exception OtpAuthException if handshake resulted in an authentication * error. */ // package scope OtpConnection(final OtpSelf self, final OtpPeer other) throws IOException, - OtpAuthException { - super(self, other); - this.self = self; - queue = new GenericQueue(); - start(); + OtpAuthException { + super(self, other); + this.self = self; + queue = new GenericQueue(); + start(); } @Override public void deliver(final Exception e) { - queue.put(e); + queue.put(e); } @Override public void deliver(final OtpMsg msg) { - queue.put(msg); + queue.put(msg); } /** * Get information about the node at the peer end of this connection. - * + * * @return the {@link OtpPeer Node} representing the peer node. */ public OtpPeer peer() { - return peer; + return peer; } /** * Get information about the node at the local end of this connection. - * + * * @return the {@link OtpSelf Node} representing the local node. */ public OtpSelf self() { - return self; + return self; } /** @@ -122,412 +122,414 @@ * this connection. */ public int msgCount() { - return queue.getCount(); + return queue.getCount(); } /** * Receive a message from a remote process. This method blocks until a valid * message is received or an exception is raised. - * + * *

    * If the remote node sends a message that cannot be decoded properly, the * connection is closed and the method throws an exception. - * + * * @return an object containing a single Erlang term. - * + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. - * + * if the connection is not active or a communication + * error occurs. + * * @exception OtpErlangExit - * if an exit signal is received from a process on the peer - * node. - * + * if an exit signal is received from a process on the + * peer node. + * * @exception OtpAuthException - * if the remote node sends a message containing an invalid - * cookie. + * if the remote node sends a message containing an + * invalid cookie. */ public OtpErlangObject receive() throws IOException, OtpErlangExit, - OtpAuthException { - try { - return receiveMsg().getMsg(); - } catch (final OtpErlangDecodeException e) { - close(); - throw new IOException(e.getMessage()); - } + OtpAuthException { + try { + return receiveMsg().getMsg(); + } catch (final OtpErlangDecodeException e) { + close(); + throw new IOException(e.getMessage()); + } } /** * Receive a message from a remote process. This method blocks at most for * the specified time, until a valid message is received or an exception is * raised. - * + * *

    * If the remote node sends a message that cannot be decoded properly, the * connection is closed and the method throws an exception. - * + * * @param timeout - * the time in milliseconds that this operation will block. - * Specify 0 to poll the queue. - * + * the time in milliseconds that this operation will block. + * Specify 0 to poll the queue. + * * @return an object containing a single Erlang term. - * + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. - * + * if the connection is not active or a communication + * error occurs. + * * @exception OtpErlangExit - * if an exit signal is received from a process on the peer - * node. - * + * if an exit signal is received from a process on the + * peer node. + * * @exception OtpAuthException - * if the remote node sends a message containing an invalid - * cookie. - * + * if the remote node sends a message containing an + * invalid cookie. + * * @exception InterruptedException - * if no message if the method times out before a message - * becomes available. + * if no message if the method times out before a message + * becomes available. */ public OtpErlangObject receive(final long timeout) - throws InterruptedException, IOException, OtpErlangExit, - OtpAuthException { - try { - return receiveMsg(timeout).getMsg(); - } catch (final OtpErlangDecodeException e) { - close(); - throw new IOException(e.getMessage()); - } + throws InterruptedException, IOException, OtpErlangExit, + OtpAuthException { + try { + return receiveMsg(timeout).getMsg(); + } catch (final OtpErlangDecodeException e) { + close(); + throw new IOException(e.getMessage()); + } } /** * Receive a raw (still encoded) message from a remote process. This message * blocks until a valid message is received or an exception is raised. - * + * *

    * If the remote node sends a message that cannot be decoded properly, the * connection is closed and the method throws an exception. - * + * * @return an object containing a raw (still encoded) Erlang term. - * + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. - * + * if the connection is not active or a communication + * error occurs. + * * @exception OtpErlangExit - * if an exit signal is received from a process on the peer - * node, or if the connection is lost for any reason. - * + * if an exit signal is received from a process on the + * peer node, or if the connection is lost for any + * reason. + * * @exception OtpAuthException - * if the remote node sends a message containing an invalid - * cookie. + * if the remote node sends a message containing an + * invalid cookie. */ public OtpInputStream receiveBuf() throws IOException, OtpErlangExit, - OtpAuthException { - return receiveMsg().getMsgBuf(); + OtpAuthException { + return receiveMsg().getMsgBuf(); } /** * Receive a raw (still encoded) message from a remote process. This message * blocks at most for the specified time until a valid message is received * or an exception is raised. - * + * *

    * If the remote node sends a message that cannot be decoded properly, the * connection is closed and the method throws an exception. - * + * * @param timeout - * the time in milliseconds that this operation will block. - * Specify 0 to poll the queue. - * + * the time in milliseconds that this operation will block. + * Specify 0 to poll the queue. + * * @return an object containing a raw (still encoded) Erlang term. - * + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. - * + * if the connection is not active or a communication + * error occurs. + * * @exception OtpErlangExit - * if an exit signal is received from a process on the peer - * node, or if the connection is lost for any reason. - * + * if an exit signal is received from a process on the + * peer node, or if the connection is lost for any + * reason. + * * @exception OtpAuthException - * if the remote node sends a message containing an invalid - * cookie. - * + * if the remote node sends a message containing an + * invalid cookie. + * * @exception InterruptedException - * if no message if the method times out before a message - * becomes available. + * if no message if the method times out before a message + * becomes available. */ public OtpInputStream receiveBuf(final long timeout) - throws InterruptedException, IOException, OtpErlangExit, - OtpAuthException { - return receiveMsg(timeout).getMsgBuf(); + throws InterruptedException, IOException, OtpErlangExit, + OtpAuthException { + return receiveMsg(timeout).getMsgBuf(); } /** * Receive a messge complete with sender and recipient information. - * + * * @return an {@link OtpMsg OtpMsg} containing the header information about * the sender and recipient, as well as the actual message contents. - * + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. - * + * if the connection is not active or a communication + * error occurs. + * * @exception OtpErlangExit - * if an exit signal is received from a process on the peer - * node, or if the connection is lost for any reason. - * + * if an exit signal is received from a process on the + * peer node, or if the connection is lost for any + * reason. + * * @exception OtpAuthException - * if the remote node sends a message containing an invalid - * cookie. + * if the remote node sends a message containing an + * invalid cookie. */ public OtpMsg receiveMsg() throws IOException, OtpErlangExit, - OtpAuthException { - final Object o = queue.get(); + OtpAuthException { + final Object o = queue.get(); - if (o instanceof OtpMsg) { - return (OtpMsg) o; - } else if (o instanceof IOException) { - throw (IOException) o; - } else if (o instanceof OtpErlangExit) { - throw (OtpErlangExit) o; - } else if (o instanceof OtpAuthException) { - throw (OtpAuthException) o; - } + if (o instanceof OtpMsg) { + return (OtpMsg) o; + } else if (o instanceof IOException) { + throw (IOException) o; + } else if (o instanceof OtpErlangExit) { + throw (OtpErlangExit) o; + } else if (o instanceof OtpAuthException) { + throw (OtpAuthException) o; + } - return null; + return null; } /** * Receive a messge complete with sender and recipient information. This * method blocks at most for the specified time. - * + * * @param timeout - * the time in milliseconds that this operation will block. - * Specify 0 to poll the queue. - * + * the time in milliseconds that this operation will block. + * Specify 0 to poll the queue. + * * @return an {@link OtpMsg OtpMsg} containing the header information about * the sender and recipient, as well as the actual message contents. - * + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. - * + * if the connection is not active or a communication + * error occurs. + * * @exception OtpErlangExit - * if an exit signal is received from a process on the peer - * node, or if the connection is lost for any reason. - * + * if an exit signal is received from a process on the + * peer node, or if the connection is lost for any + * reason. + * * @exception OtpAuthException - * if the remote node sends a message containing an invalid - * cookie. - * + * if the remote node sends a message containing an + * invalid cookie. + * * @exception InterruptedException - * if no message if the method times out before a message - * becomes available. + * if no message if the method times out before a message + * becomes available. */ public OtpMsg receiveMsg(final long timeout) throws InterruptedException, - IOException, OtpErlangExit, OtpAuthException { - final Object o = queue.get(timeout); + IOException, OtpErlangExit, OtpAuthException { + final Object o = queue.get(timeout); - if (o instanceof OtpMsg) { - return (OtpMsg) o; - } else if (o instanceof IOException) { - throw (IOException) o; - } else if (o instanceof OtpErlangExit) { - throw (OtpErlangExit) o; - } else if (o instanceof OtpAuthException) { - throw (OtpAuthException) o; - } + if (o instanceof OtpMsg) { + return (OtpMsg) o; + } else if (o instanceof IOException) { + throw (IOException) o; + } else if (o instanceof OtpErlangExit) { + throw (OtpErlangExit) o; + } else if (o instanceof OtpAuthException) { + throw (OtpAuthException) o; + } - return null; + return null; } /** * Send a message to a process on a remote node. - * + * * @param dest - * the Erlang PID of the remote process. + * the Erlang PID of the remote process. * @param msg - * the message to send. - * + * the message to send. + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. + * if the connection is not active or a communication + * error occurs. */ - @SuppressWarnings("resource") public void send(final OtpErlangPid dest, final OtpErlangObject msg) - throws IOException { - // encode and send the message - super.sendBuf(self.pid(), dest, new OtpOutputStream(msg)); + throws IOException { + // encode and send the message + super.sendBuf(self.pid(), dest, new OtpOutputStream(msg)); } /** * Send a message to a named process on a remote node. - * + * * @param dest - * the name of the remote process. + * the name of the remote process. * @param msg - * the message to send. - * + * the message to send. + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. + * if the connection is not active or a communication + * error occurs. */ - @SuppressWarnings("resource") public void send(final String dest, final OtpErlangObject msg) - throws IOException { - // encode and send the message - super.sendBuf(self.pid(), dest, new OtpOutputStream(msg)); + throws IOException { + // encode and send the message + super.sendBuf(self.pid(), dest, new OtpOutputStream(msg)); } /** * Send a pre-encoded message to a named process on a remote node. - * + * * @param dest - * the name of the remote process. + * the name of the remote process. * @param payload - * the encoded message to send. - * + * the encoded message to send. + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. + * if the connection is not active or a communication + * error occurs. */ public void sendBuf(final String dest, final OtpOutputStream payload) - throws IOException { - super.sendBuf(self.pid(), dest, payload); + throws IOException { + super.sendBuf(self.pid(), dest, payload); } /** * Send a pre-encoded message to a process on a remote node. - * + * * @param dest - * the Erlang PID of the remote process. + * the Erlang PID of the remote process. * @param payload - * the encoded message to send. - * + * the encoded message to send. + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. + * if the connection is not active or a communication + * error occurs. */ public void sendBuf(final OtpErlangPid dest, final OtpOutputStream payload) - throws IOException { - super.sendBuf(self.pid(), dest, payload); + throws IOException { + super.sendBuf(self.pid(), dest, payload); } /** * Send an RPC request to the remote Erlang node. This convenience function * creates the following message and sends it to 'rex' on the remote node: - * + * *

          * { self, { call, Mod, Fun, Args, user } }
          * 
    - * + * *

    * Note that this method has unpredicatble results if the remote node is not * an Erlang node. *

    - * + * * @param mod - * the name of the Erlang module containing the function to be - * called. + * the name of the Erlang module containing the function to + * be called. * @param fun - * the name of the function to call. + * the name of the function to call. * @param args - * an array of Erlang terms, to be used as arguments to the - * function. - * + * an array of Erlang terms, to be used as arguments to the + * function. + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. + * if the connection is not active or a communication + * error occurs. */ public void sendRPC(final String mod, final String fun, - final OtpErlangObject[] args) throws IOException { - sendRPC(mod, fun, new OtpErlangList(args)); + final OtpErlangObject[] args) throws IOException { + sendRPC(mod, fun, new OtpErlangList(args)); } /** * Send an RPC request to the remote Erlang node. This convenience function * creates the following message and sends it to 'rex' on the remote node: - * + * *
          * { self, { call, Mod, Fun, Args, user } }
          * 
    - * + * *

    * Note that this method has unpredicatble results if the remote node is not * an Erlang node. *

    - * + * * @param mod - * the name of the Erlang module containing the function to be - * called. + * the name of the Erlang module containing the function to + * be called. * @param fun - * the name of the function to call. + * the name of the function to call. * @param args - * a list of Erlang terms, to be used as arguments to the - * function. - * + * a list of Erlang terms, to be used as arguments to the + * function. + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. + * if the connection is not active or a communication + * error occurs. */ public void sendRPC(final String mod, final String fun, - final OtpErlangList args) throws IOException { - final OtpErlangObject[] rpc = new OtpErlangObject[2]; - final OtpErlangObject[] call = new OtpErlangObject[5]; - - /* {self, { call, Mod, Fun, Args, user}} */ - - call[0] = new OtpErlangAtom("call"); - call[1] = new OtpErlangAtom(mod); - call[2] = new OtpErlangAtom(fun); - call[3] = args; - call[4] = new OtpErlangAtom("user"); + final OtpErlangList args) throws IOException { + final OtpErlangObject[] rpc = new OtpErlangObject[2]; + final OtpErlangObject[] call = new OtpErlangObject[5]; + + /* {self, { call, Mod, Fun, Args, user}} */ + + call[0] = new OtpErlangAtom("call"); + call[1] = new OtpErlangAtom(mod); + call[2] = new OtpErlangAtom(fun); + call[3] = args; + call[4] = new OtpErlangAtom("user"); - rpc[0] = self.pid(); - rpc[1] = new OtpErlangTuple(call); + rpc[0] = self.pid(); + rpc[1] = new OtpErlangTuple(call); - send("rex", new OtpErlangTuple(rpc)); + send("rex", new OtpErlangTuple(rpc)); } /** * Receive an RPC reply from the remote Erlang node. This convenience * function receives a message from the remote node, and expects it to have * the following format: - * + * *
          * { rex, Term }
          * 
    - * + * * @return the second element of the tuple if the received message is a * two-tuple, otherwise null. No further error checking is * performed. - * + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. - * + * if the connection is not active or a communication + * error occurs. + * * @exception OtpErlangExit - * if an exit signal is received from a process on the peer - * node. - * + * if an exit signal is received from a process on the + * peer node. + * * @exception OtpAuthException - * if the remote node sends a message containing an invalid - * cookie. + * if the remote node sends a message containing an + * invalid cookie. */ public OtpErlangObject receiveRPC() throws IOException, OtpErlangExit, - OtpAuthException { + OtpAuthException { - final OtpErlangObject msg = receive(); + final OtpErlangObject msg = receive(); - if (msg instanceof OtpErlangTuple) { - final OtpErlangTuple t = (OtpErlangTuple) msg; - if (t.arity() == 2) { - return t.elementAt(1); // obs: second element - } - } + if (msg instanceof OtpErlangTuple) { + final OtpErlangTuple t = (OtpErlangTuple) msg; + if (t.arity() == 2) { + return t.elementAt(1); // obs: second element + } + } - return null; + return null; } /** @@ -535,48 +537,48 @@ * remote node. If the link is still active when the remote process * terminates, an exit signal will be sent to this connection. Use * {@link #unlink unlink()} to remove the link. - * + * * @param dest - * the Erlang PID of the remote process. - * + * the Erlang PID of the remote process. + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. + * if the connection is not active or a communication + * error occurs. */ public void link(final OtpErlangPid dest) throws IOException { - super.sendLink(self.pid(), dest); + super.sendLink(self.pid(), dest); } /** * Remove a link between the local node and the specified process on the - * remote node. This method deactivates links created with {@link #link - * link()}. - * + * remote node. This method deactivates links created with + * {@link #link link()}. + * * @param dest - * the Erlang PID of the remote process. - * + * the Erlang PID of the remote process. + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. + * if the connection is not active or a communication + * error occurs. */ public void unlink(final OtpErlangPid dest) throws IOException { - super.sendUnlink(self.pid(), dest); + super.sendUnlink(self.pid(), dest); } /** * Send an exit signal to a remote process. - * + * * @param dest - * the Erlang PID of the remote process. + * the Erlang PID of the remote process. * @param reason - * an Erlang term describing the exit reason. - * + * an Erlang term describing the exit reason. + * * @exception java.io.IOException - * if the connection is not active or a communication error - * occurs. + * if the connection is not active or a communication + * error occurs. */ public void exit(final OtpErlangPid dest, final OtpErlangObject reason) - throws IOException { - super.sendExit2(self.pid(), dest, reason); + throws IOException { + super.sendExit2(self.pid(), dest, reason); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpCookedConnection.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpCookedConnection.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpCookedConnection.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpCookedConnection.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,25 +1,25 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; import java.io.IOException; +import java.net.Socket; /** *

    @@ -27,29 +27,29 @@ * node. The object maintains connection state and allows data to be sent to and * received from the peer. *

    - * + * *

    * Once a connection is established between the local node and a remote node, * the connection object can be used to send and receive messages between the * nodes. *

    - * + * *

    * The various receive methods are all blocking and will return only when a * valid message has been received or an exception is raised. *

    - * + * *

    * If an exception occurs in any of the methods in this class, the connection * will be closed and must be reopened in order to resume communication with the * peer. *

    - * + * *

    * The message delivery methods in this class deliver directly to * {@link OtpMbox mailboxes} in the {@link OtpNode OtpNode} class. *

    - * + * *

    * It is not possible to create an instance of this class directly. * OtpCookedConnection objects are created as needed by the underlying mailbox @@ -70,45 +70,45 @@ * OtpSelf#accept() OtpSelf.accept()} to create a connection based on data * received when handshaking with the peer node, when the remote node is the * connection intitiator. - * + * * @exception java.io.IOException if it was not possible to connect to the * peer. - * + * * @exception OtpAuthException if handshake resulted in an authentication * error */ // package scope - OtpCookedConnection(final OtpNode self, final OtpTransport s) - throws IOException, OtpAuthException { - super(self, s); - this.self = self; - links = new Links(25); - start(); + OtpCookedConnection(final OtpNode self, final Socket s) throws IOException, + OtpAuthException { + super(self, s); + this.self = self; + links = new Links(25); + start(); } /* * Intiate and open a connection to a remote node. - * + * * @exception java.io.IOException if it was not possible to connect to the * peer. - * + * * @exception OtpAuthException if handshake resulted in an authentication * error. */ // package scope OtpCookedConnection(final OtpNode self, final OtpPeer other) - throws IOException, OtpAuthException { - super(self, other); - this.self = self; - links = new Links(25); - start(); + throws IOException, OtpAuthException { + super(self, other); + this.self = self; + links = new Links(25); + start(); } // pass the error to the node @Override public void deliver(final Exception e) { - self.deliverError(this, e); - return; + self.deliverError(this, e); + return; } /* @@ -118,110 +118,108 @@ */ @Override public void deliver(final OtpMsg msg) { - final boolean delivered = self.deliver(msg); + final boolean delivered = self.deliver(msg); - switch (msg.type()) { - case OtpMsg.linkTag: - if (delivered) { - links.addLink(msg.getRecipientPid(), msg.getSenderPid()); - } else { - try { - // no such pid - send exit to sender - super.sendExit(msg.getRecipientPid(), msg.getSenderPid(), - new OtpErlangAtom("noproc")); - } catch (final IOException e) { - } - } - break; - - case OtpMsg.unlinkTag: - case OtpMsg.exitTag: - links.removeLink(msg.getRecipientPid(), msg.getSenderPid()); - break; - - case OtpMsg.exit2Tag: - break; - } + switch (msg.type()) { + case OtpMsg.linkTag: + if (delivered) { + links.addLink(msg.getRecipientPid(), msg.getSenderPid()); + } else { + try { + // no such pid - send exit to sender + super.sendExit(msg.getRecipientPid(), msg.getSenderPid(), + new OtpErlangAtom("noproc")); + } catch (final IOException e) { + } + } + break; + + case OtpMsg.unlinkTag: + case OtpMsg.exitTag: + links.removeLink(msg.getRecipientPid(), msg.getSenderPid()); + break; + + case OtpMsg.exit2Tag: + break; + } - return; + return; } /* * send to pid */ - @SuppressWarnings("resource") void send(final OtpErlangPid from, final OtpErlangPid dest, - final OtpErlangObject msg) throws IOException { - // encode and send the message - sendBuf(from, dest, new OtpOutputStream(msg)); + final OtpErlangObject msg) throws IOException { + // encode and send the message + sendBuf(from, dest, new OtpOutputStream(msg)); } /* * send to remote name dest is recipient's registered name, the nodename is * implied by the choice of connection. */ - @SuppressWarnings("resource") void send(final OtpErlangPid from, final String dest, - final OtpErlangObject msg) throws IOException { - // encode and send the message - sendBuf(from, dest, new OtpOutputStream(msg)); + final OtpErlangObject msg) throws IOException { + // encode and send the message + sendBuf(from, dest, new OtpOutputStream(msg)); } @Override public void close() { - super.close(); - breakLinks(); + super.close(); + breakLinks(); } @Override protected void finalize() { - close(); + close(); } /* * this one called by dying/killed process */ void exit(final OtpErlangPid from, final OtpErlangPid to, - final OtpErlangObject reason) { - try { - super.sendExit(from, to, reason); - } catch (final Exception e) { - } + final OtpErlangObject reason) { + try { + super.sendExit(from, to, reason); + } catch (final Exception e) { + } } /* * this one called explicitely by user code => use exit2 */ void exit2(final OtpErlangPid from, final OtpErlangPid to, - final OtpErlangObject reason) { - try { - super.sendExit2(from, to, reason); - } catch (final Exception e) { - } + final OtpErlangObject reason) { + try { + super.sendExit2(from, to, reason); + } catch (final Exception e) { + } } /* * snoop for outgoing links and update own table */ synchronized void link(final OtpErlangPid from, final OtpErlangPid to) - throws OtpErlangExit { - try { - super.sendLink(from, to); - links.addLink(from, to); - } catch (final IOException e) { - throw new OtpErlangExit("noproc", to); - } + throws OtpErlangExit { + try { + super.sendLink(from, to); + links.addLink(from, to); + } catch (final IOException e) { + throw new OtpErlangExit("noproc", to); + } } /* * snoop for outgoing unlinks and update own table */ synchronized void unlink(final OtpErlangPid from, final OtpErlangPid to) { - links.removeLink(from, to); - try { - super.sendUnlink(from, to); - } catch (final IOException e) { - } + links.removeLink(from, to); + try { + super.sendUnlink(from, to); + } catch (final IOException e) { + } } /* @@ -229,18 +227,18 @@ * through this connection */ synchronized void breakLinks() { - if (links != null) { - final Link[] l = links.clearLinks(); + if (links != null) { + final Link[] l = links.clearLinks(); - if (l != null) { - final int len = l.length; + if (l != null) { + final int len = l.length; - for (int i = 0; i < len; i++) { - // send exit "from" remote pids to local ones - self.deliver(new OtpMsg(OtpMsg.exitTag, l[i].remote(), l[i] - .local(), new OtpErlangAtom("noconnection"))); - } - } - } + for (int i = 0; i < len; i++) { + // send exit "from" remote pids to local ones + self.deliver(new OtpMsg(OtpMsg.exitTag, l[i].remote(), l[i] + .local(), new OtpErlangAtom("noconnection"))); + } + } + } } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpEpmd.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpEpmd.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpEpmd.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpEpmd.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2013. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -22,19 +21,20 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.InetAddress; +import java.net.Socket; /** * Provides methods for registering, unregistering and looking up nodes with the * Erlang portmapper daemon (Epmd). For each registered node, Epmd maintains * information about the port on which incoming connections are accepted, as - * well as which versions of the Erlang communication protocol the node + * well as which versions of the Erlang communication protocolt the node * supports. - * + * *

    * Nodes wishing to contact other nodes must first request information from Epmd * before a connection can be set up, however this is done automatically by * {@link OtpSelf#connect(OtpPeer) OtpSelf.connect()} when necessary. - * + * *

    * The methods {@link #publishPort(OtpLocalNode) publishPort()} and * {@link #unPublishPort(OtpLocalNode) unPublishPort()} will fail if an Epmd @@ -42,33 +42,32 @@ * {@link #lookupPort(AbstractNode) lookupPort()} will fail if there is no Epmd * process running on the host where the specified node is running. See the * Erlang documentation for information about starting Epmd. - * + * *

    * This class contains only static methods, there are no constructors. */ public class OtpEpmd { private static class EpmdPort { - private static int epmdPort = 0; - - public static int get() { - if (epmdPort == 0) { - String env; - try { - env = System.getenv("ERL_EPMD_PORT"); - } catch (final java.lang.SecurityException e) { - env = null; - } - epmdPort = env != null ? Integer.parseInt(env) : 4369; - } - return epmdPort; - } - - public static void set(final int port) { - epmdPort = port; - } + private static int epmdPort = 0; + + public static int get() { + if (epmdPort == 0) { + String env; + try { + env = System.getenv("ERL_EPMD_PORT"); + } + catch (java.lang.SecurityException e) { + env = null; + } + epmdPort = (env != null) ? Integer.parseInt(env) : 4369; + } + return epmdPort; + } + public static void set(int port) { + epmdPort = port; + } } - // common values private static final byte stopReq = (byte) 115; @@ -82,16 +81,16 @@ private static final int traceThreshold = 4; static { - // debug this connection? - final String trace = System.getProperties().getProperty( - "OtpConnection.trace"); - try { - if (trace != null) { - traceLevel = Integer.valueOf(trace).intValue(); - } - } catch (final NumberFormatException e) { - traceLevel = 0; - } + // debug this connection? + final String trace = System.getProperties().getProperty( + "OtpConnection.trace"); + try { + if (trace != null) { + traceLevel = Integer.valueOf(trace).intValue(); + } + } catch (final NumberFormatException e) { + traceLevel = 0; + } } // only static methods: no public constructors @@ -99,50 +98,51 @@ private OtpEpmd() { } + /** - * Set the port number to be used to contact the epmd process. Only needed - * when the default port is not desired and system environment variable - * ERL_EPMD_PORT can not be read (applet). + * Set the port number to be used to contact the epmd process. + * Only needed when the default port is not desired and system environment + * variable ERL_EPMD_PORT can not be read (applet). */ - public static void useEpmdPort(final int port) { - EpmdPort.set(port); + public static void useEpmdPort(int port) { + EpmdPort.set(port); } /** * Determine what port a node listens for incoming connections on. - * + * * @return the listen port for the specified node, or 0 if the node was not * registered with Epmd. - * + * * @exception java.io.IOException * if there was no response from the name server. */ public static int lookupPort(final AbstractNode node) throws IOException { - return r4_lookupPort(node); + return r4_lookupPort(node); } /** * Register with Epmd, so that other nodes are able to find and connect to * it. - * + * * @param node * the server node that should be registered with Epmd. - * + * * @return true if the operation was successful. False if the node was * already registered. - * + * * @exception java.io.IOException * if there was no response from the name server. */ public static boolean publishPort(final OtpLocalNode node) - throws IOException { - OtpTransport s = null; + throws IOException { + Socket s = null; - s = r4_publish(node); + s = r4_publish(node); - node.setEpmd(s); + node.setEpmd(s); - return s != null; + return s != null; } // Ask epmd to close his end of the connection. @@ -151,285 +151,274 @@ /** * Unregister from Epmd. Other nodes wishing to connect will no longer be * able to. - * + * *

    * This method does not report any failures. */ public static void unPublishPort(final OtpLocalNode node) { - OtpTransport s = null; + Socket s = null; - try { - s = node.createTransport((String) null, EpmdPort.get()); - @SuppressWarnings("resource") - final OtpOutputStream obuf = new OtpOutputStream(); - obuf.write2BE(node.alive().length() + 1); - obuf.write1(stopReq); - obuf.writeN(node.alive().getBytes()); - obuf.writeToAndFlush(s.getOutputStream()); - // don't even wait for a response (is there one?) - if (traceLevel >= traceThreshold) { - System.out.println("-> UNPUBLISH " + node + " port=" - + node.port()); - System.out.println("<- OK (assumed)"); - } - } catch (final Exception e) {/* ignore all failures */ - } finally { - try { - if (s != null) { - s.close(); - } - } catch (final IOException e) { /* ignore close failure */ - } - s = null; - } + try { + s = new Socket((String) null, EpmdPort.get()); + final OtpOutputStream obuf = new OtpOutputStream(); + obuf.write2BE(node.alive().length() + 1); + obuf.write1(stopReq); + obuf.writeN(node.alive().getBytes()); + obuf.writeTo(s.getOutputStream()); + // don't even wait for a response (is there one?) + if (traceLevel >= traceThreshold) { + System.out.println("-> UNPUBLISH " + node + " port=" + + node.port()); + System.out.println("<- OK (assumed)"); + } + } catch (final Exception e) {/* ignore all failures */ + } finally { + try { + if (s != null) { + s.close(); + } + } catch (final IOException e) { /* ignore close failure */ + } + s = null; + } } private static int r4_lookupPort(final AbstractNode node) - throws IOException { - int port = 0; - OtpTransport s = null; - - try { - @SuppressWarnings("resource") - final OtpOutputStream obuf = new OtpOutputStream(); - s = node.createTransport(node.host(), EpmdPort.get()); - - // build and send epmd request - // length[2], tag[1], alivename[n] (length = n+1) - obuf.write2BE(node.alive().length() + 1); - obuf.write1(port4req); - obuf.writeN(node.alive().getBytes()); - - // send request - obuf.writeToAndFlush(s.getOutputStream()); - - if (traceLevel >= traceThreshold) { - System.out.println("-> LOOKUP (r4) " + node); - } - - // receive and decode reply - // resptag[1], result[1], port[2], ntype[1], proto[1], - // disthigh[2], distlow[2], nlen[2], alivename[n], - // elen[2], edata[m] - final byte[] tmpbuf = new byte[100]; - - final int n = s.getInputStream().read(tmpbuf); - - if (n < 0) { - s.close(); - throw new IOException("Nameserver not responding on " - + node.host() + " when looking up " + node.alive()); - } - - @SuppressWarnings("resource") - final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); - - final int response = ibuf.read1(); - if (response == port4resp) { - final int result = ibuf.read1(); - if (result == 0) { - port = ibuf.read2BE(); - - node.ntype = ibuf.read1(); - node.proto = ibuf.read1(); - node.distHigh = ibuf.read2BE(); - node.distLow = ibuf.read2BE(); - // ignore rest of fields - } - } - } catch (final IOException e) { - if (traceLevel >= traceThreshold) { - System.out.println("<- (no response)"); - } - throw new IOException("Nameserver not responding on " + node.host() - + " when looking up " + node.alive(), e); - } catch (final OtpErlangDecodeException e) { - if (traceLevel >= traceThreshold) { - System.out.println("<- (invalid response)"); - } - throw new IOException("Nameserver not responding on " + node.host() - + " when looking up " + node.alive()); - } finally { - try { - if (s != null) { - s.close(); - } - } catch (final IOException e) { /* ignore close errors */ - } - s = null; - } - - if (traceLevel >= traceThreshold) { - if (port == 0) { - System.out.println("<- NOT FOUND"); - } else { - System.out.println("<- PORT " + port); - } - } - return port; + throws IOException { + int port = 0; + Socket s = null; + + try { + final OtpOutputStream obuf = new OtpOutputStream(); + s = new Socket(node.host(), EpmdPort.get()); + + // build and send epmd request + // length[2], tag[1], alivename[n] (length = n+1) + obuf.write2BE(node.alive().length() + 1); + obuf.write1(port4req); + obuf.writeN(node.alive().getBytes()); + + // send request + obuf.writeTo(s.getOutputStream()); + + if (traceLevel >= traceThreshold) { + System.out.println("-> LOOKUP (r4) " + node); + } + + // receive and decode reply + // resptag[1], result[1], port[2], ntype[1], proto[1], + // disthigh[2], distlow[2], nlen[2], alivename[n], + // elen[2], edata[m] + final byte[] tmpbuf = new byte[100]; + + final int n = s.getInputStream().read(tmpbuf); + + if (n < 0) { + s.close(); + throw new IOException("Nameserver not responding on " + + node.host() + " when looking up " + node.alive()); + } + + final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); + + final int response = ibuf.read1(); + if (response == port4resp) { + final int result = ibuf.read1(); + if (result == 0) { + port = ibuf.read2BE(); + + node.ntype = ibuf.read1(); + node.proto = ibuf.read1(); + node.distHigh = ibuf.read2BE(); + node.distLow = ibuf.read2BE(); + // ignore rest of fields + } + } + } catch (final IOException e) { + if (traceLevel >= traceThreshold) { + System.out.println("<- (no response)"); + } + throw new IOException("Nameserver not responding on " + node.host() + + " when looking up " + node.alive()); + } catch (final OtpErlangDecodeException e) { + if (traceLevel >= traceThreshold) { + System.out.println("<- (invalid response)"); + } + throw new IOException("Nameserver not responding on " + node.host() + + " when looking up " + node.alive()); + } finally { + try { + if (s != null) { + s.close(); + } + } catch (final IOException e) { /* ignore close errors */ + } + s = null; + } + + if (traceLevel >= traceThreshold) { + if (port == 0) { + System.out.println("<- NOT FOUND"); + } else { + System.out.println("<- PORT " + port); + } + } + return port; } /* - * this function will get an exception if it tries to talk to a very old - * epmd, or if something else happens that it cannot forsee. In both cases - * we return an exception. We no longer support r3, so the exception is - * fatal. If we manage to successfully communicate with an r4 epmd, we - * return either the socket, or null, depending on the result. + * this function will get an exception if it tries to talk to a + * very old epmd, or if something else happens that it cannot + * forsee. In both cases we return an exception. We no longer + * support r3, so the exception is fatal. If we manage to + * successfully communicate with an r4 epmd, we return either the + * socket, or null, depending on the result. */ - private static OtpTransport r4_publish(final OtpLocalNode node) - throws IOException { - OtpTransport s = null; - - try { - @SuppressWarnings("resource") - final OtpOutputStream obuf = new OtpOutputStream(); - s = node.createTransport((String) null, EpmdPort.get()); - - obuf.write2BE(node.alive().length() + 13); - - obuf.write1(publish4req); - obuf.write2BE(node.port()); - - obuf.write1(node.type()); - - obuf.write1(node.proto()); - obuf.write2BE(node.distHigh()); - obuf.write2BE(node.distLow()); - - obuf.write2BE(node.alive().length()); - obuf.writeN(node.alive().getBytes()); - obuf.write2BE(0); // No extra - - // send request - obuf.writeToAndFlush(s.getOutputStream()); - - if (traceLevel >= traceThreshold) { - System.out.println("-> PUBLISH (r4) " + node + " port=" - + node.port()); - } - - // get reply - final byte[] tmpbuf = new byte[100]; - final int n = s.getInputStream().read(tmpbuf); - - if (n < 0) { - s.close(); - throw new IOException("Nameserver not responding on " - + node.host() + " when publishing " + node.alive()); - } - - @SuppressWarnings("resource") - final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); - - final int response = ibuf.read1(); - if (response == publish4resp) { - final int result = ibuf.read1(); - if (result == 0) { - node.creation = ibuf.read2BE(); - if (traceLevel >= traceThreshold) { - System.out.println("<- OK"); - } - return s; // success - } - } - } catch (final IOException e) { - // epmd closed the connection = fail - if (s != null) { - s.close(); - } - if (traceLevel >= traceThreshold) { - System.out.println("<- (no response)"); - } - throw new IOException("Nameserver not responding on " + node.host() - + " when publishing " + node.alive()); - } catch (final OtpErlangDecodeException e) { - s.close(); - if (traceLevel >= traceThreshold) { - System.out.println("<- (invalid response)"); - } - throw new IOException("Nameserver not responding on " + node.host() - + " when publishing " + node.alive()); - } - - s.close(); - return null; + private static Socket r4_publish(final OtpLocalNode node) + throws IOException { + Socket s = null; + + try { + final OtpOutputStream obuf = new OtpOutputStream(); + s = new Socket((String) null, EpmdPort.get()); + + obuf.write2BE(node.alive().length() + 13); + + obuf.write1(publish4req); + obuf.write2BE(node.port()); + + obuf.write1(node.type()); + + obuf.write1(node.proto()); + obuf.write2BE(node.distHigh()); + obuf.write2BE(node.distLow()); + + obuf.write2BE(node.alive().length()); + obuf.writeN(node.alive().getBytes()); + obuf.write2BE(0); // No extra + + // send request + obuf.writeTo(s.getOutputStream()); + + if (traceLevel >= traceThreshold) { + System.out.println("-> PUBLISH (r4) " + node + " port=" + + node.port()); + } + + // get reply + final byte[] tmpbuf = new byte[100]; + final int n = s.getInputStream().read(tmpbuf); + + if (n < 0) { + if (s != null) { + s.close(); + } + throw new IOException("Nameserver not responding on " + + node.host() + " when publishing " + node.alive()); + } + + final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); + + final int response = ibuf.read1(); + if (response == publish4resp) { + final int result = ibuf.read1(); + if (result == 0) { + node.creation = ibuf.read2BE(); + if (traceLevel >= traceThreshold) { + System.out.println("<- OK"); + } + return s; // success + } + } + } catch (final IOException e) { + // epmd closed the connection = fail + if (s != null) { + s.close(); + } + if (traceLevel >= traceThreshold) { + System.out.println("<- (no response)"); + } + throw new IOException("Nameserver not responding on " + node.host() + + " when publishing " + node.alive()); + } catch (final OtpErlangDecodeException e) { + if (s != null) { + s.close(); + } + if (traceLevel >= traceThreshold) { + System.out.println("<- (invalid response)"); + } + throw new IOException("Nameserver not responding on " + node.host() + + " when publishing " + node.alive()); + } + + if (s != null) { + s.close(); + } + return null; } public static String[] lookupNames() throws IOException { - return lookupNames(InetAddress.getByName(null), - new OtpSocketTransportFactory()); - } - - public static String[] lookupNames( - final OtpTransportFactory transportFactory) throws IOException { - return lookupNames(InetAddress.getByName(null), transportFactory); + return lookupNames(InetAddress.getByName(null)); } public static String[] lookupNames(final InetAddress address) - throws IOException { - return lookupNames(address, new OtpSocketTransportFactory()); - } + throws IOException { + Socket s = null; - public static String[] lookupNames(final InetAddress address, - final OtpTransportFactory transportFactory) throws IOException { - OtpTransport s = null; - - try { - @SuppressWarnings("resource") - final OtpOutputStream obuf = new OtpOutputStream(); - try { - s = transportFactory.createTransport(address, EpmdPort.get()); - - obuf.write2BE(1); - obuf.write1(names4req); - // send request - obuf.writeToAndFlush(s.getOutputStream()); - - if (traceLevel >= traceThreshold) { - System.out.println("-> NAMES (r4) "); - } - - // get reply - final byte[] buffer = new byte[256]; - final ByteArrayOutputStream out = new ByteArrayOutputStream(256); - while (true) { - final int bytesRead = s.getInputStream().read(buffer); - if (bytesRead == -1) { - break; - } - out.write(buffer, 0, bytesRead); - } - final byte[] tmpbuf = out.toByteArray(); - @SuppressWarnings("resource") - final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); - ibuf.read4BE(); // read port int - // final int port = ibuf.read4BE(); - // check if port = epmdPort - - final int n = tmpbuf.length; - final byte[] buf = new byte[n - 4]; - System.arraycopy(tmpbuf, 4, buf, 0, n - 4); - final String all = OtpErlangString.newString(buf); - return all.split("\n"); - } finally { - if (s != null) { - s.close(); - } - } - - } catch (final IOException e) { - if (traceLevel >= traceThreshold) { - System.out.println("<- (no response)"); - } - throw new IOException( - "Nameserver not responding when requesting names"); - } catch (final OtpErlangDecodeException e) { - if (traceLevel >= traceThreshold) { - System.out.println("<- (invalid response)"); - } - throw new IOException( - "Nameserver not responding when requesting names"); - } + try { + final OtpOutputStream obuf = new OtpOutputStream(); + try { + s = new Socket(address, EpmdPort.get()); + + obuf.write2BE(1); + obuf.write1(names4req); + // send request + obuf.writeTo(s.getOutputStream()); + + if (traceLevel >= traceThreshold) { + System.out.println("-> NAMES (r4) "); + } + + // get reply + final byte[] buffer = new byte[256]; + final ByteArrayOutputStream out = new ByteArrayOutputStream(256); + while (true) { + final int bytesRead = s.getInputStream().read(buffer); + if (bytesRead == -1) { + break; + } + out.write(buffer, 0, bytesRead); + } + final byte[] tmpbuf = out.toByteArray(); + final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); + ibuf.read4BE(); // read port int + // final int port = ibuf.read4BE(); + // check if port = epmdPort + + final int n = tmpbuf.length; + final byte[] buf = new byte[n - 4]; + System.arraycopy(tmpbuf, 4, buf, 0, n - 4); + final String all = OtpErlangString.newString(buf); + return all.split("\n"); + } finally { + if (s != null) { + s.close(); + } + } + + } catch (final IOException e) { + if (traceLevel >= traceThreshold) { + System.out.println("<- (no response)"); + } + throw new IOException( + "Nameserver not responding when requesting names"); + } catch (final OtpErlangDecodeException e) { + if (traceLevel >= traceThreshold) { + System.out.println("<- (invalid response)"); + } + throw new IOException( + "Nameserver not responding when requesting names"); + } } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,32 +1,34 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2013. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang atoms. Atoms can be created from * strings whose length is not more than {@link #maxAtomLength maxAtomLength} * characters. */ -public class OtpErlangAtom extends OtpErlangObject { +public class OtpErlangAtom extends OtpErlangObject implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = -3204386396807876641L; + static final long serialVersionUID = -3204386396807876641L; /** The maximun allowed length of an atom, in characters */ public static final int maxAtomLength = 0xff; // one byte length @@ -35,71 +37,72 @@ /** * Create an atom from the given string. - * + * * @param atom - * the string to create the atom from. - * + * the string to create the atom from. + * * @exception java.lang.IllegalArgumentException - * if the string is null or contains more than - * {@link #maxAtomLength maxAtomLength} characters. + * if the string is null or contains more than + * {@link #maxAtomLength maxAtomLength} characters. */ public OtpErlangAtom(final String atom) { - if (atom == null) { - throw new java.lang.IllegalArgumentException("null string value"); - } - - if (atom.codePointCount(0, atom.length()) > maxAtomLength) { - throw new java.lang.IllegalArgumentException("Atom may not exceed " - + maxAtomLength + " characters: " + atom); - } - this.atom = atom; + if (atom == null) { + throw new java.lang.IllegalArgumentException( + "null string value"); + } + + if (atom.codePointCount(0, atom.length()) > maxAtomLength) { + throw new java.lang.IllegalArgumentException("Atom may not exceed " + + maxAtomLength + " characters: " + atom); + } + this.atom = atom; } /** * Create an atom from a stream containing an atom encoded in Erlang * external format. - * + * * @param buf - * the stream containing the encoded atom. - * + * the stream containing the encoded atom. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang atom. + * if the buffer does not contain a valid external + * representation of an Erlang atom. */ public OtpErlangAtom(final OtpInputStream buf) - throws OtpErlangDecodeException { - atom = buf.read_atom(); + throws OtpErlangDecodeException { + atom = buf.read_atom(); } /** * Create an atom whose value is "true" or "false". */ public OtpErlangAtom(final boolean t) { - atom = String.valueOf(t); + atom = String.valueOf(t); } /** * Get the actual string contained in this object. - * + * * @return the raw string contained in this object, without regard to Erlang * quoting rules. - * + * * @see #toString */ public String atomValue() { - return atom; + return atom; } /** * The boolean value of this atom. - * + * * @return the value of this atom expressed as a boolean value. If the atom * consists of the characters "true" (independent of case) the value * will be true. For any other values, the value will be false. - * + * */ public boolean booleanValue() { - return Boolean.valueOf(atomValue()).booleanValue(); + return Boolean.valueOf(atomValue()).booleanValue(); } /** @@ -107,91 +110,93 @@ * between this method and {link #atomValue atomValue()} is that the * printname is quoted and escaped where necessary, according to the Erlang * rules for atom naming. - * + * * @return the printname representation of this atom object. - * + * * @see #atomValue */ @Override public String toString() { - if (atomNeedsQuoting(atom)) { - return "'" + escapeSpecialChars(atom) + "'"; - } - return atom; + if (atomNeedsQuoting(atom)) { + return "'" + escapeSpecialChars(atom) + "'"; + } else { + return atom; + } } /** * Determine if two atoms are equal. - * + * * @param o - * the other object to compare to. - * + * the other object to compare to. + * * @return true if the atoms are equal, false otherwise. */ @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangAtom)) { - return false; - } + if (!(o instanceof OtpErlangAtom)) { + return false; + } - final OtpErlangAtom other = (OtpErlangAtom) o; - return atom.compareTo(other.atom) == 0; + final OtpErlangAtom atom = (OtpErlangAtom) o; + return this.atom.compareTo(atom.atom) == 0; } - + @Override protected int doHashCode() { - return atom.hashCode(); + return atom.hashCode(); } /** * Convert this atom to the equivalent Erlang external representation. - * + * * @param buf - * an output stream to which the encoded atom should be written. + * an output stream to which the encoded atom should be + * written. */ @Override public void encode(final OtpOutputStream buf) { - buf.write_atom(atom); + buf.write_atom(atom); } /* the following four predicates are helpers for the toString() method */ private boolean isErlangDigit(final char c) { - return c >= '0' && c <= '9'; + return c >= '0' && c <= '9'; } private boolean isErlangUpper(final char c) { - return c >= 'A' && c <= 'Z' || c == '_'; + return c >= 'A' && c <= 'Z' || c == '_'; } private boolean isErlangLower(final char c) { - return c >= 'a' && c <= 'z'; + return c >= 'a' && c <= 'z'; } private boolean isErlangLetter(final char c) { - return isErlangLower(c) || isErlangUpper(c); + return isErlangLower(c) || isErlangUpper(c); } // true if the atom should be displayed with quotation marks private boolean atomNeedsQuoting(final String s) { - char c; + char c; - if (s.length() == 0) { - return true; - } - if (!isErlangLower(s.charAt(0))) { - return true; - } - - final int len = s.length(); - for (int i = 1; i < len; i++) { - c = s.charAt(i); - - if (!isErlangLetter(c) && !isErlangDigit(c) && c != '@') { - return true; - } - } - return false; + if (s.length() == 0) { + return true; + } + if (!isErlangLower(s.charAt(0))) { + return true; + } + + final int len = s.length(); + for (int i = 1; i < len; i++) { + c = s.charAt(i); + + if (!isErlangLetter(c) && !isErlangDigit(c) && c != '@') { + return true; + } + } + return false; } /* @@ -200,80 +205,80 @@ * printable. */ private String escapeSpecialChars(final String s) { - char c; - final StringBuffer so = new StringBuffer(); + char c; + final StringBuffer so = new StringBuffer(); - final int len = s.length(); - for (int i = 0; i < len; i++) { - c = s.charAt(i); - - /* - * note that some of these escape sequences are unique to Erlang, - * which is why the corresponding 'case' values use octal. The - * resulting string is, of course, in Erlang format. - */ - - switch (c) { - // some special escape sequences - case '\b': - so.append("\\b"); - break; - - case 0177: - so.append("\\d"); - break; - - case 033: - so.append("\\e"); - break; - - case '\f': - so.append("\\f"); - break; - - case '\n': - so.append("\\n"); - break; - - case '\r': - so.append("\\r"); - break; - - case '\t': - so.append("\\t"); - break; - - case 013: - so.append("\\v"); - break; - - case '\\': - so.append("\\\\"); - break; - - case '\'': - so.append("\\'"); - break; - - case '\"': - so.append("\\\""); - break; - - default: - // some other character classes - if (c < 027) { - // control chars show as "\^@", "\^A" etc - so.append("\\^" + (char) ('A' - 1 + c)); - } else if (c > 126) { - // 8-bit chars show as \345 \344 \366 etc - so.append("\\" + Integer.toOctalString(c)); - } else { - // character is printable without modification! - so.append(c); - } - } - } - return new String(so); + final int len = s.length(); + for (int i = 0; i < len; i++) { + c = s.charAt(i); + + /* + * note that some of these escape sequences are unique to Erlang, + * which is why the corresponding 'case' values use octal. The + * resulting string is, of course, in Erlang format. + */ + + switch (c) { + // some special escape sequences + case '\b': + so.append("\\b"); + break; + + case 0177: + so.append("\\d"); + break; + + case 033: + so.append("\\e"); + break; + + case '\f': + so.append("\\f"); + break; + + case '\n': + so.append("\\n"); + break; + + case '\r': + so.append("\\r"); + break; + + case '\t': + so.append("\\t"); + break; + + case 013: + so.append("\\v"); + break; + + case '\\': + so.append("\\\\"); + break; + + case '\'': + so.append("\\'"); + break; + + case '\"': + so.append("\\\""); + break; + + default: + // some other character classes + if (c < 027) { + // control chars show as "\^@", "\^A" etc + so.append("\\^" + (char) ('A' - 1 + c)); + } else if (c > 126) { + // 8-bit chars show as \345 \344 \366 etc + so.append("\\" + Integer.toOctalString(c)); + } else { + // character is printable without modification! + so.append(c); + } + } + } + return new String(so); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,86 +1,88 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang binaries. Anything that can be * represented as a sequence of bytes can be made into an Erlang binary. */ -public class OtpErlangBinary extends OtpErlangBitstr { +public class OtpErlangBinary extends OtpErlangBitstr implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = -3781009633593609217L; + static final long serialVersionUID = -3781009633593609217L; /** * Create a binary from a byte array - * + * * @param bin - * the array of bytes from which to create the binary. + * the array of bytes from which to create the binary. */ public OtpErlangBinary(final byte[] bin) { - super(bin); + super(bin); } /** * Create a binary from a stream containing a binary encoded in Erlang * external format. - * + * * @param buf - * the stream containing the encoded binary. - * + * the stream containing the encoded binary. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang binary. + * if the buffer does not contain a valid external + * representation of an Erlang binary. */ public OtpErlangBinary(final OtpInputStream buf) - throws OtpErlangDecodeException { - super(new byte[0]); - bin = buf.read_binary(); - pad_bits = 0; + throws OtpErlangDecodeException { + super(new byte[0]); + bin = buf.read_binary(); + pad_bits = 0; } /** * Create a binary from an arbitrary Java Object. The object must implement * java.io.Serializable or java.io.Externalizable. - * + * * @param o - * the object to serialize and create this binary from. + * the object to serialize and create this binary from. */ public OtpErlangBinary(final Object o) { - super(o); + super(o); } /** * Convert this binary to the equivalent Erlang external representation. - * + * * @param buf - * an output stream to which the encoded binary should be - * written. + * an output stream to which the encoded binary should be + * written. */ @Override public void encode(final OtpOutputStream buf) { - buf.write_binary(bin); + buf.write_binary(bin); } @Override public Object clone() { - final OtpErlangBinary that = (OtpErlangBinary) super.clone(); - return that; + final OtpErlangBinary that = (OtpErlangBinary) super.clone(); + return that; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBitstr.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBitstr.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBitstr.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBitstr.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,284 +1,285 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2007-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.Serializable; /** * Provides a Java representation of Erlang bitstrs. An Erlang bitstr is an * Erlang binary with a length not an integral number of bytes (8-bit). Anything * can be represented as a sequence of bytes can be made into an Erlang bitstr. */ -public class OtpErlangBitstr extends OtpErlangObject { +public class OtpErlangBitstr extends OtpErlangObject implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = -3781009633593609217L; + static final long serialVersionUID = -3781009633593609217L; protected byte[] bin; protected int pad_bits; /** * Create a bitstr from a byte array - * + * * @param bin - * the array of bytes from which to create the bitstr. + * the array of bytes from which to create the bitstr. */ public OtpErlangBitstr(final byte[] bin) { - this.bin = new byte[bin.length]; - System.arraycopy(bin, 0, this.bin, 0, bin.length); - pad_bits = 0; + this.bin = new byte[bin.length]; + System.arraycopy(bin, 0, this.bin, 0, bin.length); + pad_bits = 0; } /** * Create a bitstr with pad bits from a byte array. - * + * * @param bin - * the array of bytes from which to create the bitstr. + * the array of bytes from which to create the bitstr. * @param pad_bits - * the number of unused bits in the low end of the last byte. + * the number of unused bits in the low end of the last byte. */ public OtpErlangBitstr(final byte[] bin, final int pad_bits) { - this.bin = new byte[bin.length]; - System.arraycopy(bin, 0, this.bin, 0, bin.length); - this.pad_bits = pad_bits; - - check_bitstr(this.bin, this.pad_bits); - } - - private void check_bitstr(final byte[] abin, final int a_pad_bits) { - if (a_pad_bits < 0 || 7 < a_pad_bits) { - throw new java.lang.IllegalArgumentException( - "Padding must be in range 0..7"); - } - if (a_pad_bits != 0 && abin.length == 0) { - throw new java.lang.IllegalArgumentException( - "Padding on zero length bitstr"); - } - if (abin.length != 0) { - // Make sure padding is zero - abin[abin.length - 1] &= ~((1 << a_pad_bits) - 1); - } + this.bin = new byte[bin.length]; + System.arraycopy(bin, 0, this.bin, 0, bin.length); + this.pad_bits = pad_bits; + + check_bitstr(this.bin, this.pad_bits); + } + + private void check_bitstr(final byte[] bin, final int pad_bits) { + if (pad_bits < 0 || 7 < pad_bits) { + throw new java.lang.IllegalArgumentException( + "Padding must be in range 0..7"); + } + if (pad_bits != 0 && bin.length == 0) { + throw new java.lang.IllegalArgumentException( + "Padding on zero length bitstr"); + } + if (bin.length != 0) { + // Make sure padding is zero + bin[bin.length - 1] &= ~((1 << pad_bits) - 1); + } } /** * Create a bitstr from a stream containing a bitstr encoded in Erlang * external format. - * + * * @param buf - * the stream containing the encoded bitstr. - * + * the stream containing the encoded bitstr. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang bitstr. + * if the buffer does not contain a valid external + * representation of an Erlang bitstr. */ public OtpErlangBitstr(final OtpInputStream buf) - throws OtpErlangDecodeException { - final int pbs[] = { 0 }; // This is ugly just to get a value-result - // parameter - bin = buf.read_bitstr(pbs); - pad_bits = pbs[0]; + throws OtpErlangDecodeException { + final int pbs[] = { 0 }; // This is ugly just to get a value-result + // parameter + bin = buf.read_bitstr(pbs); + pad_bits = pbs[0]; - check_bitstr(bin, pad_bits); + check_bitstr(bin, pad_bits); } /** * Create a bitstr from an arbitrary Java Object. The object must implement * java.io.Serializable or java.io.Externalizable. - * + * * @param o - * the object to serialize and create this bitstr from. + * the object to serialize and create this bitstr from. */ public OtpErlangBitstr(final Object o) { - try { - bin = toByteArray(o); - pad_bits = 0; - } catch (final IOException e) { - throw new java.lang.IllegalArgumentException( - "Object must implement Serializable"); - } + try { + bin = toByteArray(o); + pad_bits = 0; + } catch (final IOException e) { + throw new java.lang.IllegalArgumentException( + "Object must implement Serializable"); + } } private static byte[] toByteArray(final Object o) - throws java.io.IOException { + throws java.io.IOException { - if (o == null) { - return null; - } + if (o == null) { + return null; + } - /* need to synchronize use of the shared baos */ - final java.io.ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final java.io.ObjectOutputStream oos = new java.io.ObjectOutputStream( - baos); + /* need to synchronize use of the shared baos */ + final java.io.ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final java.io.ObjectOutputStream oos = new java.io.ObjectOutputStream( + baos); - oos.writeObject(o); - oos.flush(); + oos.writeObject(o); + oos.flush(); - return baos.toByteArray(); + return baos.toByteArray(); } private static Object fromByteArray(final byte[] buf) { - if (buf == null) { - return null; - } - - try { - final java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream( - buf); - final java.io.ObjectInputStream ois = new java.io.ObjectInputStream( - bais); - return ois.readObject(); - } catch (final java.lang.ClassNotFoundException e) { - } catch (final java.io.IOException e) { - } + if (buf == null) { + return null; + } + + try { + final java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream( + buf); + final java.io.ObjectInputStream ois = new java.io.ObjectInputStream( + bais); + return ois.readObject(); + } catch (final java.lang.ClassNotFoundException e) { + } catch (final java.io.IOException e) { + } - return null; + return null; } /** * Get the byte array from a bitstr, padded with zero bits in the little end * of the last byte. - * + * * @return the byte array containing the bytes for this bitstr. */ public byte[] binaryValue() { - return bin; + return bin; } /** * Get the size in whole bytes of the bitstr, rest bits in the last byte not * counted. - * + * * @return the number of bytes contained in the bintstr. */ public int size() { - if (pad_bits == 0) { - return bin.length; - } - if (bin.length == 0) { - throw new java.lang.IllegalStateException("Impossible length"); - } - return bin.length - 1; + if (pad_bits == 0) { + return bin.length; + } + if (bin.length == 0) { + throw new java.lang.IllegalStateException("Impossible length"); + } + return bin.length - 1; } /** * Get the number of pad bits in the last byte of the bitstr. The pad bits * are zero and in the little end. - * + * * @return the number of pad bits in the bitstr. */ public int pad_bits() { - return pad_bits; + return pad_bits; } /** * Get the java Object from the bitstr. If the bitstr contains a serialized * Java object, then this method will recreate the object. - * - * + * + * * @return the java Object represented by this bitstr, or null if the bitstr * does not represent a Java Object. */ public Object getObject() { - if (pad_bits != 0) { - return null; - } - return fromByteArray(bin); + if (pad_bits != 0) { + return null; + } + return fromByteArray(bin); } /** * Get the string representation of this bitstr object. A bitstr is printed * as #Bin<N>, where N is the number of bytes contained in the object * or #bin<N-M> if there are M pad bits. - * + * * @return the Erlang string representation of this bitstr. */ @Override public String toString() { - if (pad_bits == 0) { - return "#Bin<" + bin.length + ">"; - } - if (bin.length == 0) { - throw new java.lang.IllegalStateException("Impossible length"); - } - return "#Bin<" + bin.length + "-" + pad_bits + ">"; + if (pad_bits == 0) { + return "#Bin<" + bin.length + ">"; + } + if (bin.length == 0) { + throw new java.lang.IllegalStateException("Impossible length"); + } + return "#Bin<" + bin.length + "-" + pad_bits + ">"; } /** * Convert this bitstr to the equivalent Erlang external representation. - * + * * @param buf - * an output stream to which the encoded bitstr should be - * written. + * an output stream to which the encoded bitstr should be + * written. */ @Override public void encode(final OtpOutputStream buf) { - buf.write_bitstr(bin, pad_bits); + buf.write_bitstr(bin, pad_bits); } /** * Determine if two bitstrs are equal. Bitstrs are equal if they have the * same byte length and tail length, and the array of bytes is identical. - * + * * @param o - * the bitstr to compare to. - * + * the bitstr to compare to. + * * @return true if the bitstrs contain the same bits, false otherwise. */ @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangBitstr)) { - return false; - } - - final OtpErlangBitstr that = (OtpErlangBitstr) o; - if (pad_bits != that.pad_bits) { - return false; - } - - final int len = bin.length; - if (len != that.bin.length) { - return false; - } - - for (int i = 0; i < len; i++) { - if (bin[i] != that.bin[i]) { - return false; // early exit - } - } + if (!(o instanceof OtpErlangBitstr)) { + return false; + } + + final OtpErlangBitstr that = (OtpErlangBitstr) o; + if (pad_bits != that.pad_bits) { + return false; + } + + final int len = bin.length; + if (len != that.bin.length) { + return false; + } + + for (int i = 0; i < len; i++) { + if (bin[i] != that.bin[i]) { + return false; // early exit + } + } - return true; + return true; } - + @Override protected int doHashCode() { - final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(15); - hash.combine(bin); - hash.combine(pad_bits); - return hash.valueOf(); + OtpErlangObject.Hash hash = new OtpErlangObject.Hash(15); + hash.combine(bin); + hash.combine(pad_bits); + return hash.valueOf(); } - + @Override public Object clone() { - final OtpErlangBitstr that = (OtpErlangBitstr) super.clone(); - that.bin = bin.clone(); - that.pad_bits = pad_bits; - return that; + final OtpErlangBitstr that = (OtpErlangBitstr) super.clone(); + that.bin = bin.clone(); + that.pad_bits = pad_bits; + return that; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBoolean.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBoolean.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBoolean.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBoolean.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,40 +1,42 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang booleans, which are special cases of * atoms with values 'true' and 'false'. */ -public class OtpErlangBoolean extends OtpErlangAtom { +public class OtpErlangBoolean extends OtpErlangAtom implements Serializable, + Cloneable { // don't change this! static final long serialVersionUID = 1087178844844988393L; /** * Create a boolean from the given value - * + * * @param t - * the boolean value to represent as an atom. + * the boolean value to represent as an atom. */ public OtpErlangBoolean(final boolean t) { - super(t); + super(t); } /** @@ -42,13 +44,13 @@ * external format. The value of the boolean will be true if the atom * represented by the stream is "true" without regard to case. For other * atom values, the boolean will have the value false. - * + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang atom. + * if the buffer does not contain a valid external + * representation of an Erlang atom. */ public OtpErlangBoolean(final OtpInputStream buf) - throws OtpErlangDecodeException { - super(buf); + throws OtpErlangDecodeException { + super(buf); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangByte.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangByte.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangByte.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangByte.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,59 +1,61 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang integral types. */ -public class OtpErlangByte extends OtpErlangLong { +public class OtpErlangByte extends OtpErlangLong implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = 5778019796466613446L; + static final long serialVersionUID = 5778019796466613446L; /** * Create an Erlang integer from the given value. - * + * * @param b - * the byte value to use. + * the byte value to use. */ public OtpErlangByte(final byte b) { - super(b); + super(b); } /** * Create an Erlang integer from a stream containing an integer encoded in * Erlang external format. - * + * * @param buf - * the stream containing the encoded value. - * + * the stream containing the encoded value. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang integer. - * + * if the buffer does not contain a valid external + * representation of an Erlang integer. + * * @exception OtpErlangRangeException - * if the value is too large to be represented as a byte. + * if the value is too large to be represented as a byte. */ public OtpErlangByte(final OtpInputStream buf) - throws OtpErlangRangeException, OtpErlangDecodeException { - super(buf); + throws OtpErlangRangeException, OtpErlangDecodeException { + super(buf); - byteValue(); + final byte i = byteValue(); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangChar.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangChar.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangChar.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangChar.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,59 +1,61 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang integral types. */ -public class OtpErlangChar extends OtpErlangLong { +public class OtpErlangChar extends OtpErlangLong implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = 3225337815669398204L; + static final long serialVersionUID = 3225337815669398204L; /** * Create an Erlang integer from the given value. - * + * * @param c - * the char value to use. + * the char value to use. */ public OtpErlangChar(final char c) { - super(c); + super(c); } /** * Create an Erlang integer from a stream containing an integer encoded in * Erlang external format. - * + * * @param buf - * the stream containing the encoded value. - * + * the stream containing the encoded value. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang integer. - * + * if the buffer does not contain a valid external + * representation of an Erlang integer. + * * @exception OtpErlangRangeException - * if the value is too large to be represented as a char. + * if the value is too large to be represented as a char. */ public OtpErlangChar(final OtpInputStream buf) - throws OtpErlangRangeException, OtpErlangDecodeException { - super(buf); + throws OtpErlangRangeException, OtpErlangDecodeException { + super(buf); - charValue(); + final char i = charValue(); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDecodeException.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDecodeException.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDecodeException.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDecodeException.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -23,16 +22,14 @@ * Exception raised when an attempt is made to create an Erlang term by decoding * a sequence of bytes that does not represent the type of term that was * requested. - * + * * @see OtpInputStream */ public class OtpErlangDecodeException extends OtpErlangException { - private static final long serialVersionUID = 1L; - /** * Provides a detailed message. */ public OtpErlangDecodeException(final String msg) { - super(msg); + super(msg); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,33 +1,35 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang floats and doubles. Erlang defines * only one floating point numeric type, however this class and its subclass * {@link OtpErlangFloat} are used to provide representations corresponding to * the Java types Double and Float. */ -public class OtpErlangDouble extends OtpErlangObject { +public class OtpErlangDouble extends OtpErlangObject implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = 132947104811974021L; + static final long serialVersionUID = 132947104811974021L; private final double d; @@ -35,95 +37,96 @@ * Create an Erlang float from the given double value. */ public OtpErlangDouble(final double d) { - this.d = d; + this.d = d; } /** * Create an Erlang float from a stream containing a double encoded in * Erlang external format. - * + * * @param buf - * the stream containing the encoded value. - * + * the stream containing the encoded value. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang float. + * if the buffer does not contain a valid external + * representation of an Erlang float. */ public OtpErlangDouble(final OtpInputStream buf) - throws OtpErlangDecodeException { - d = buf.read_double(); + throws OtpErlangDecodeException { + d = buf.read_double(); } /** * Get the value, as a double. - * + * * @return the value of this object, as a double. */ public double doubleValue() { - return d; + return d; } /** * Get the value, as a float. - * + * * @return the value of this object, as a float. - * + * * @exception OtpErlangRangeException - * if the value cannot be represented as a float. + * if the value cannot be represented as a float. */ public float floatValue() throws OtpErlangRangeException { - final float f = (float) d; + final float f = (float) d; - if (f != d) { - throw new OtpErlangRangeException("Value too large for float: " + d); - } + if (f != d) { + throw new OtpErlangRangeException("Value too large for float: " + d); + } - return f; + return f; } /** * Get the string representation of this double. - * + * * @return the string representation of this double. */ @Override public String toString() { - return "" + d; + return "" + d; } /** * Convert this double to the equivalent Erlang external representation. - * + * * @param buf - * an output stream to which the encoded value should be written. + * an output stream to which the encoded value should be + * written. */ @Override public void encode(final OtpOutputStream buf) { - buf.write_double(d); + buf.write_double(d); } /** * Determine if two floats are equal. Floats are equal if they contain the * same value. - * + * * @param o - * the float to compare to. - * + * the float to compare to. + * * @return true if the floats have the same value. */ @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangDouble)) { - return false; - } + if (!(o instanceof OtpErlangDouble)) { + return false; + } - final OtpErlangDouble other = (OtpErlangDouble) o; - return d == other.d; + final OtpErlangDouble d = (OtpErlangDouble) o; + return this.d == d.d; } - + @Override protected int doHashCode() { - final Double v = new Double(d); - return v.hashCode(); + Double v = new Double(d); + return v.hashCode(); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangException.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangException.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangException.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangException.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -29,13 +28,13 @@ * Provides no message. */ public OtpErlangException() { - super(); + super(); } /** * Provides a detailed message. */ public OtpErlangException(final String msg) { - super(msg); + super(msg); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangExit.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangExit.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangExit.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangExit.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -22,13 +21,13 @@ /** * Exception raised when a communication channel is broken. This can be caused * for a number of reasons, for example: - * + * *

      - *
    • an error in communication has occurred - *
    • a remote process has sent an exit signal - *
    • a linked process has exited + *
    • an error in communication has occurred + *
    • a remote process has sent an exit signal + *
    • a linked process has exited *
    - * + * * @see OtpConnection */ @@ -40,13 +39,13 @@ /** * Create an OtpErlangExit exception with the given reason. - * + * * @param reason - * the reason this exit signal has been sent. + * the reason this exit signal has been sent. */ public OtpErlangExit(final OtpErlangObject reason) { - super(reason.toString()); - this.reason = reason; + super(reason.toString()); + this.reason = reason; } /** @@ -54,29 +53,29 @@ * Equivalent to OtpErlangExit(new * OtpErlangAtom(reason). *

    - * + * * @param reason - * the reason this exit signal has been sent. - * + * the reason this exit signal has been sent. + * * @see #OtpErlangExit(OtpErlangObject) */ public OtpErlangExit(final String reason) { - this(new OtpErlangAtom(reason)); + this(new OtpErlangAtom(reason)); } /** * Create an OtpErlangExit exception with the given reason and sender pid. - * + * * @param reason - * the reason this exit signal has been sent. - * + * the reason this exit signal has been sent. + * * @param pid - * the pid that sent this exit. + * the pid that sent this exit. */ public OtpErlangExit(final OtpErlangObject reason, final OtpErlangPid pid) { - super(reason.toString()); - this.reason = reason; - this.pid = pid; + super(reason.toString()); + this.reason = reason; + this.pid = pid; } /** @@ -84,30 +83,30 @@ * Equivalent to OtpErlangExit(new OtpErlangAtom(reason), * pid). *

    - * + * * @param reason - * the reason this exit signal has been sent. - * + * the reason this exit signal has been sent. + * * @param pid - * the pid that sent this exit. - * + * the pid that sent this exit. + * * @see #OtpErlangExit(OtpErlangObject, OtpErlangPid) */ public OtpErlangExit(final String reason, final OtpErlangPid pid) { - this(new OtpErlangAtom(reason), pid); + this(new OtpErlangAtom(reason), pid); } /** * Get the reason associated with this exit signal. */ public OtpErlangObject reason() { - return reason; + return reason; } /** * Get the pid that sent this exit. */ public OtpErlangPid pid() { - return pid; + return pid; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangExternalFun.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangExternalFun.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangExternalFun.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangExternalFun.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,21 +1,20 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -28,47 +27,47 @@ private final int arity; public OtpErlangExternalFun(final String module, final String function, - final int arity) { - super(); - this.module = module; - this.function = function; - this.arity = arity; + final int arity) { + super(); + this.module = module; + this.function = function; + this.arity = arity; } public OtpErlangExternalFun(final OtpInputStream buf) - throws OtpErlangDecodeException { - final OtpErlangExternalFun f = buf.read_external_fun(); - module = f.module; - function = f.function; - arity = f.arity; + throws OtpErlangDecodeException { + final OtpErlangExternalFun f = buf.read_external_fun(); + module = f.module; + function = f.function; + arity = f.arity; } @Override public void encode(final OtpOutputStream buf) { - buf.write_external_fun(module, function, arity); + buf.write_external_fun(module, function, arity); } @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangExternalFun)) { - return false; - } - final OtpErlangExternalFun f = (OtpErlangExternalFun) o; - return module.equals(f.module) && function.equals(f.function) - && arity == f.arity; + if (!(o instanceof OtpErlangExternalFun)) { + return false; + } + final OtpErlangExternalFun f = (OtpErlangExternalFun) o; + return module.equals(f.module) && function.equals(f.function) + && arity == f.arity; } @Override protected int doHashCode() { - final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(14); - hash.combine(module.hashCode(), function.hashCode()); - hash.combine(arity); - return hash.valueOf(); + OtpErlangObject.Hash hash = new OtpErlangObject.Hash(14); + hash.combine(module.hashCode(), function.hashCode()); + hash.combine(arity); + return hash.valueOf(); } - + @Override public String toString() { - return "#Fun<" + module + "." + function + "." + arity + ">"; + return "#Fun<" + module + "." + function + "." + arity + ">"; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFloat.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFloat.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFloat.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFloat.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,56 +1,58 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang floats and doubles. */ -public class OtpErlangFloat extends OtpErlangDouble { +public class OtpErlangFloat extends OtpErlangDouble implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = -2231546377289456934L; + static final long serialVersionUID = -2231546377289456934L; /** * Create an Erlang float from the given float value. */ public OtpErlangFloat(final float f) { - super(f); + super(f); } /** * Create an Erlang float from a stream containing a float encoded in Erlang * external format. - * + * * @param buf - * the stream containing the encoded value. - * + * the stream containing the encoded value. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang float. - * + * if the buffer does not contain a valid external + * representation of an Erlang float. + * * @exception OtpErlangRangeException - * if the value cannot be represented as a Java float. + * if the value cannot be represented as a Java float. */ public OtpErlangFloat(final OtpInputStream buf) - throws OtpErlangDecodeException, OtpErlangRangeException { - super(buf); + throws OtpErlangDecodeException, OtpErlangRangeException { + super(buf); - floatValue(); + final float f = floatValue(); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,27 +1,27 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; import java.util.Arrays; -public class OtpErlangFun extends OtpErlangObject { +public class OtpErlangFun extends OtpErlangObject implements Serializable { // don't change this! private static final long serialVersionUID = -3423031125356706472L; @@ -35,97 +35,97 @@ private final byte[] md5; public OtpErlangFun(final OtpInputStream buf) - throws OtpErlangDecodeException { - final OtpErlangFun f = buf.read_fun(); - pid = f.pid; - module = f.module; - arity = f.arity; - md5 = f.md5; - index = f.index; - old_index = f.old_index; - uniq = f.uniq; - freeVars = f.freeVars; + throws OtpErlangDecodeException { + final OtpErlangFun f = buf.read_fun(); + pid = f.pid; + module = f.module; + arity = f.arity; + md5 = f.md5; + index = f.index; + old_index = f.old_index; + uniq = f.uniq; + freeVars = f.freeVars; } public OtpErlangFun(final OtpErlangPid pid, final String module, - final long index, final long uniq, final OtpErlangObject[] freeVars) { - this.pid = pid; - this.module = module; - arity = -1; - md5 = null; - this.index = index; - old_index = 0; - this.uniq = uniq; - this.freeVars = freeVars; + final long index, final long uniq, final OtpErlangObject[] freeVars) { + this.pid = pid; + this.module = module; + arity = -1; + md5 = null; + this.index = index; + old_index = 0; + this.uniq = uniq; + this.freeVars = freeVars; } public OtpErlangFun(final OtpErlangPid pid, final String module, - final int arity, final byte[] md5, final int index, - final long old_index, final long uniq, - final OtpErlangObject[] freeVars) { - this.pid = pid; - this.module = module; - this.arity = arity; - this.md5 = md5; - this.index = index; - this.old_index = old_index; - this.uniq = uniq; - this.freeVars = freeVars; + final int arity, final byte[] md5, final int index, + final long old_index, final long uniq, + final OtpErlangObject[] freeVars) { + this.pid = pid; + this.module = module; + this.arity = arity; + this.md5 = md5; + this.index = index; + this.old_index = old_index; + this.uniq = uniq; + this.freeVars = freeVars; } @Override public void encode(final OtpOutputStream buf) { - buf.write_fun(pid, module, old_index, arity, md5, index, uniq, freeVars); + buf + .write_fun(pid, module, old_index, arity, md5, index, uniq, + freeVars); } @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangFun)) { - return false; - } - final OtpErlangFun f = (OtpErlangFun) o; - if (!pid.equals(f.pid) || !module.equals(f.module) || arity != f.arity) { - return false; - } - if (md5 == null) { - if (f.md5 != null) { - return false; - } - } else { - if (!Arrays.equals(md5, f.md5)) { - return false; - } - } - if (index != f.index || uniq != f.uniq) { - return false; - } - if (freeVars == null) { - return f.freeVars == null; - } - return Arrays.equals(freeVars, f.freeVars); + if (!(o instanceof OtpErlangFun)) { + return false; + } + final OtpErlangFun f = (OtpErlangFun) o; + if (!pid.equals(f.pid) || !module.equals(f.module) || arity != f.arity) { + return false; + } + if (md5 == null) { + if (f.md5 != null) { + return false; + } + } else { + if (!Arrays.equals(md5, f.md5)) { + return false; + } + } + if (index != f.index || uniq != f.uniq) { + return false; + } + if (freeVars == null) { + return f.freeVars == null; + } + return Arrays.equals(freeVars, f.freeVars); } - + @Override protected int doHashCode() { - final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(1); - hash.combine(pid.hashCode(), module.hashCode()); - hash.combine(arity); - if (md5 != null) { - hash.combine(md5); - } - hash.combine(index); - hash.combine(uniq); - if (freeVars != null) { - for (final OtpErlangObject o : freeVars) { - hash.combine(o.hashCode(), 1); - } - } - return hash.valueOf(); + OtpErlangObject.Hash hash = new OtpErlangObject.Hash(1); + hash.combine(pid.hashCode(), module.hashCode()); + hash.combine(arity); + if (md5 != null) hash.combine(md5); + hash.combine(index); + hash.combine(uniq); + if (freeVars != null) { + for (OtpErlangObject o: freeVars) { + hash.combine(o.hashCode(), 1); + } + } + return hash.valueOf(); } - + @Override public String toString() { - return "#Fun<" + module + "." + old_index + "." + uniq + ">"; + return "#Fun<" + module + "." + old_index + "." + uniq + ">"; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangInt.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangInt.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangInt.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangInt.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,59 +1,61 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang integral types. */ -public class OtpErlangInt extends OtpErlangLong { +public class OtpErlangInt extends OtpErlangLong implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = 1229430977614805556L; + static final long serialVersionUID = 1229430977614805556L; /** * Create an Erlang integer from the given value. - * + * * @param i - * the int value to use. + * the int value to use. */ public OtpErlangInt(final int i) { - super(i); + super(i); } /** * Create an Erlang integer from a stream containing an integer encoded in * Erlang external format. - * + * * @param buf - * the stream containing the encoded value. - * + * the stream containing the encoded value. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang integer. - * + * if the buffer does not contain a valid external + * representation of an Erlang integer. + * * @exception OtpErlangRangeException - * if the value is too large to be represented as an int. + * if the value is too large to be represented as an int. */ public OtpErlangInt(final OtpInputStream buf) - throws OtpErlangRangeException, OtpErlangDecodeException { - super(buf); + throws OtpErlangRangeException, OtpErlangDecodeException { + super(buf); - intValue(); + final int j = intValue(); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,38 +1,38 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; import java.util.Iterator; import java.util.NoSuchElementException; /** * Provides a Java representation of Erlang lists. Lists are created from zero * or more arbitrary Erlang terms. - * + * *

    * The arity of the list is the number of elements it contains. */ public class OtpErlangList extends OtpErlangObject implements - Iterable { + Iterable, Serializable, Cloneable { // don't change this! - private static final long serialVersionUID = 5999112769036676548L; + static final long serialVersionUID = 5999112769036676548L; private static final OtpErlangObject[] NO_ELEMENTS = new OtpErlangObject[0]; @@ -44,69 +44,69 @@ * Create an empty list. */ public OtpErlangList() { - elems = NO_ELEMENTS; + elems = NO_ELEMENTS; } /** - * Create a list of Erlang integers representing Unicode codePoints. This - * method does not check if the string contains valid code points. - * + * Create a list of Erlang integers representing Unicode codePoints. + * This method does not check if the string contains valid code points. + * * @param str * the characters from which to create the list. */ public OtpErlangList(final String str) { - if (str == null || str.length() == 0) { - elems = NO_ELEMENTS; - } else { - final int[] codePoints = OtpErlangString.stringToCodePoints(str); - elems = new OtpErlangObject[codePoints.length]; - for (int i = 0; i < elems.length; i++) { - elems[i] = new OtpErlangInt(codePoints[i]); - } - } + if (str == null || str.length() == 0) { + elems = NO_ELEMENTS; + } else { + final int[] codePoints = OtpErlangString.stringToCodePoints(str); + elems = new OtpErlangObject[codePoints.length]; + for (int i = 0; i < elems.length; i++) { + elems[i] = new OtpErlangInt(codePoints[i]); + } + } } /** * Create a list containing one element. - * + * * @param elem * the elememet to make the list from. */ public OtpErlangList(final OtpErlangObject elem) { - elems = new OtpErlangObject[] { elem }; + elems = new OtpErlangObject[] { elem }; } /** * Create a list from an array of arbitrary Erlang terms. - * + * * @param elems * the array of terms from which to create the list. */ public OtpErlangList(final OtpErlangObject[] elems) { - this(elems, 0, elems.length); + this(elems, 0, elems.length); } /** * Create a list from an array of arbitrary Erlang terms. Tail can be * specified, if not null, the list will not be proper. - * + * * @param elems * array of terms from which to create the list * @param lastTail * @throws OtpErlangException */ public OtpErlangList(final OtpErlangObject[] elems, - final OtpErlangObject lastTail) throws OtpErlangException { - this(elems, 0, elems.length); - if (elems.length == 0 && lastTail != null) { - throw new OtpErlangException("Bad list, empty head, non-empty tail"); - } - this.lastTail = lastTail; + final OtpErlangObject lastTail) throws OtpErlangException { + this(elems, 0, elems.length); + if (elems.length == 0 && lastTail != null) { + throw new OtpErlangException("Bad list, empty head, non-empty tail"); + } + this.lastTail = lastTail; } /** * Create a list from an array of arbitrary Erlang terms. - * + * * @param elems * the array of terms from which to create the list. * @param start @@ -115,152 +115,153 @@ * the number of terms to insert. */ public OtpErlangList(final OtpErlangObject[] elems, final int start, - final int count) { - if (elems != null && count > 0) { - this.elems = new OtpErlangObject[count]; - System.arraycopy(elems, start, this.elems, 0, count); - } else { - this.elems = NO_ELEMENTS; - } + final int count) { + if (elems != null && count > 0) { + this.elems = new OtpErlangObject[count]; + System.arraycopy(elems, start, this.elems, 0, count); + } else { + this.elems = NO_ELEMENTS; + } } /** * Create a list from a stream containing an list encoded in Erlang external * format. - * + * * @param buf * the stream containing the encoded list. - * + * * @exception OtpErlangDecodeException * if the buffer does not contain a valid external * representation of an Erlang list. */ public OtpErlangList(final OtpInputStream buf) - throws OtpErlangDecodeException { - final int arity = buf.read_list_head(); - if (arity > 0) { - elems = new OtpErlangObject[arity]; - for (int i = 0; i < arity; i++) { - elems[i] = buf.read_any(); - } - /* discard the terminating nil (empty list) or read tail */ - if (buf.peek1() == OtpExternal.nilTag) { - buf.read_nil(); - } else { - lastTail = buf.read_any(); - } - } else { - elems = NO_ELEMENTS; - } + throws OtpErlangDecodeException { + final int arity = buf.read_list_head(); + if (arity > 0) { + elems = new OtpErlangObject[arity]; + for (int i = 0; i < arity; i++) { + elems[i] = buf.read_any(); + } + /* discard the terminating nil (empty list) or read tail */ + if (buf.peek1() == OtpExternal.nilTag) { + buf.read_nil(); + } else { + lastTail = buf.read_any(); + } + } else { + elems = NO_ELEMENTS; + } } /** * Get the arity of the list. - * + * * @return the number of elements contained in the list. */ public int arity() { - return elems.length; + return elems.length; } /** * Get the specified element from the list. - * + * * @param i * the index of the requested element. List elements are numbered * as array elements, starting at 0. - * + * * @return the requested element, of null if i is not a valid element index. */ public OtpErlangObject elementAt(final int i) { - if (i >= arity() || i < 0) { - return null; - } - return elems[i]; + if (i >= arity() || i < 0) { + return null; + } + return elems[i]; } /** * Get all the elements from the list as an array. - * + * * @return an array containing all of the list's elements. */ public OtpErlangObject[] elements() { - if (arity() == 0) { - return NO_ELEMENTS; - } - final OtpErlangObject[] res = new OtpErlangObject[arity()]; - System.arraycopy(elems, 0, res, 0, res.length); - return res; + if (arity() == 0) { + return NO_ELEMENTS; + } else { + final OtpErlangObject[] res = new OtpErlangObject[arity()]; + System.arraycopy(elems, 0, res, 0, res.length); + return res; + } } /** * Get the string representation of the list. - * + * * @return the string representation of the list. */ @Override public String toString() { - return toString(0); + return toString(0); } protected String toString(final int start) { - final StringBuffer s = new StringBuffer(); - s.append("["); + final StringBuffer s = new StringBuffer(); + s.append("["); - for (int i = start; i < arity(); i++) { - if (i > start) { - s.append(","); - } - s.append(elems[i].toString()); - } - if (lastTail != null) { - s.append("|").append(lastTail.toString()); - } - s.append("]"); + for (int i = start; i < arity(); i++) { + if (i > start) { + s.append(","); + } + s.append(elems[i].toString()); + } + if (lastTail != null) { + s.append("|").append(lastTail.toString()); + } + s.append("]"); - return s.toString(); + return s.toString(); } /** * Convert this list to the equivalent Erlang external representation. Note * that this method never encodes lists as strings, even when it is possible * to do so. - * + * * @param buf * An output stream to which the encoded list should be written. - * + * */ @Override public void encode(final OtpOutputStream buf) { - encode(buf, 0); + encode(buf, 0); } protected void encode(final OtpOutputStream buf, final int start) { - final int arity = arity() - start; + final int arity = arity() - start; - if (arity > 0) { - buf.write_list_head(arity); + if (arity > 0) { + buf.write_list_head(arity); - for (int i = start; i < arity + start; i++) { - buf.write_any(elems[i]); - } - } - if (lastTail == null) { - buf.write_nil(); - } else { - buf.write_any(lastTail); - } + for (int i = start; i < arity + start; i++) { + buf.write_any(elems[i]); + } + } + if (lastTail == null) { + buf.write_nil(); + } else { + buf.write_any(lastTail); + } } /** * Determine if two lists are equal. Lists are equal if they have the same * arity and all of the elements are equal. - * + * * @param o * the list to compare to. - * + * * @return true if the lists have the same arity and all the elements are * equal. */ @@ -268,282 +269,237 @@ @Override public boolean equals(final Object o) { - /* - * Be careful to use methods even for "this", so that equals work also - * for sublists - */ - - if (!(o instanceof OtpErlangList)) { - return false; - } - - final OtpErlangList l = (OtpErlangList) o; - - final int a = arity(); - if (a != l.arity()) { - return false; - } - for (int i = 0; i < a; i++) { - if (!elementAt(i).equals(l.elementAt(i))) { - return false; // early exit - } - } - final OtpErlangObject otherTail = l.getLastTail(); - if (getLastTail() == null && otherTail == null) { - return true; - } - if (getLastTail() == null) { - return false; - } - return getLastTail().equals(l.getLastTail()); - } - - @Override - public boolean match(final OtpErlangObject term, final T bindings) { - if (!(term instanceof OtpErlangList)) { - return false; - } - final OtpErlangList that = (OtpErlangList) term; - - final int thisArity = this.arity(); - final int thatArity = that.arity(); - final OtpErlangObject thisTail = this.getLastTail(); - final OtpErlangObject thatTail = that.getLastTail(); - - if (thisTail == null) { - if (thisArity != thatArity || thatTail != null) { - return false; - } - } else { - if (thisArity > thatArity) { - return false; - } - } - for (int i = 0; i < thisArity; i++) { - if (!elementAt(i).match(that.elementAt(i), bindings)) { - return false; - } - } - if (thisTail == null) { - return true; - } - return thisTail.match(that.getNthTail(thisArity), bindings); - } - - @Override - public OtpErlangObject bind(final T binds) throws OtpErlangException { - final OtpErlangList list = (OtpErlangList) this.clone(); - - final int a = list.elems.length; - for (int i = 0; i < a; i++) { - list.elems[i] = list.elems[i].bind(binds); - } - - if (list.lastTail != null) { - list.lastTail = list.lastTail.bind(binds); - } - - return list; + /* + * Be careful to use methods even for "this", so that equals work also + * for sublists + */ + + if (!(o instanceof OtpErlangList)) { + return false; + } + + final OtpErlangList l = (OtpErlangList) o; + + final int a = arity(); + if (a != l.arity()) { + return false; + } + for (int i = 0; i < a; i++) { + if (!elementAt(i).equals(l.elementAt(i))) { + return false; // early exit + } + } + final OtpErlangObject otherTail = l.getLastTail(); + if (getLastTail() == null && otherTail == null) { + return true; + } + if (getLastTail() == null) { + return false; + } + return getLastTail().equals(l.getLastTail()); } public OtpErlangObject getLastTail() { - return lastTail; + return lastTail; } - + @Override protected int doHashCode() { - final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(4); - final int a = arity(); - if (a == 0) { - return (int) 3468870702L; - } - for (int i = 0; i < a; i++) { - hash.combine(elementAt(i).hashCode()); - } - final OtpErlangObject t = getLastTail(); - if (t != null) { - final int h = t.hashCode(); - hash.combine(h, h); - } - return hash.valueOf(); + OtpErlangObject.Hash hash = new OtpErlangObject.Hash(4); + final int a = arity(); + if (a == 0) { + return (int)3468870702L; + } + for (int i = 0; i < a; i++) { + hash.combine(elementAt(i).hashCode()); + } + final OtpErlangObject t = getLastTail(); + if (t != null) { + int h = t.hashCode(); + hash.combine(h, h); + } + return hash.valueOf(); } - + @Override public Object clone() { - try { - return new OtpErlangList(elements(), getLastTail()); - } catch (final OtpErlangException e) { - throw new AssertionError(this); - } + try { + return new OtpErlangList(elements(), getLastTail()); + } catch (final OtpErlangException e) { + return null; + } } public Iterator iterator() { - return iterator(0); + return iterator(0); } private Iterator iterator(final int start) { - return new Itr(start); + return new Itr(start); } /** * @return true if the list is proper, i.e. the last tail is nil */ public boolean isProper() { - return lastTail == null; + return lastTail == null; } public OtpErlangObject getHead() { - if (arity() > 0) { - return elems[0]; - } - return null; + if (arity() > 0) { + return elems[0]; + } + return null; } public OtpErlangObject getTail() { - return getNthTail(1); + return getNthTail(1); } public OtpErlangObject getNthTail(final int n) { - final int arity = arity(); - if (arity >= n) { - if (arity == n && lastTail != null) { - return lastTail; - } - return new SubList(this, n); - } - return null; + final int arity = arity(); + if (arity >= n) { + if (arity == n && lastTail != null) { + return lastTail; + } else { + return new SubList(this, n); + } + } + return null; } /** - * Convert a list of integers into a Unicode string, interpreting each - * integer as a Unicode code point value. - * - * @return A java.lang.String object created through its constructor - * String(int[], int, int). + * Convert a list of integers into a Unicode string, + * interpreting each integer as a Unicode code point value. + * + * @return A java.lang.String object created through its + * constructor String(int[], int, int). * * @exception OtpErlangException - * for non-proper and non-integer lists. + * for non-proper and non-integer lists. * * @exception OtpErlangRangeException - * if any integer does not fit into a Java int. + * if any integer does not fit into a Java int. * * @exception java.security.InvalidParameterException - * if any integer is not within the Unicode range. + * if any integer is not within the Unicode range. * * @see String#String(int[], int, int) * */ public String stringValue() throws OtpErlangException { - if (!isProper()) { - throw new OtpErlangException("Non-proper list: " + this); - } - final int[] values = new int[arity()]; - for (int i = 0; i < values.length; ++i) { - final OtpErlangObject o = elementAt(i); - if (!(o instanceof OtpErlangLong)) { - throw new OtpErlangException("Non-integer term: " + o); - } - final OtpErlangLong l = (OtpErlangLong) o; - values[i] = l.intValue(); - } - return new String(values, 0, values.length); + if (! isProper()) { + throw new OtpErlangException("Non-proper list: " + this); + } + final int[] values = new int[arity()]; + for (int i = 0; i < values.length; ++i) { + final OtpErlangObject o = elementAt(i); + if (! (o instanceof OtpErlangLong)) { + throw new OtpErlangException("Non-integer term: " + o); + } + final OtpErlangLong l = (OtpErlangLong) o; + values[i] = l.intValue(); + } + return new String(values, 0, values.length); } + + public static class SubList extends OtpErlangList { - private static final long serialVersionUID = OtpErlangList.serialVersionUID; + private static final long serialVersionUID = OtpErlangList.serialVersionUID; - private final int start; + private final int start; - private final OtpErlangList parent; + private final OtpErlangList parent; - private SubList(final OtpErlangList parent, final int start) { - super(); - this.parent = parent; - this.start = start; - } - - @Override - public int arity() { - return parent.arity() - start; - } - - @Override - public OtpErlangObject elementAt(final int i) { - return parent.elementAt(i + start); - } - - @Override - public OtpErlangObject[] elements() { - final int n = parent.arity() - start; - final OtpErlangObject[] res = new OtpErlangObject[n]; - for (int i = 0; i < res.length; i++) { - res[i] = parent.elementAt(i + start); - } - return res; - } - - @Override - public boolean isProper() { - return parent.isProper(); - } - - @Override - public OtpErlangObject getHead() { - return parent.elementAt(start); - } - - @Override - public OtpErlangObject getNthTail(final int n) { - return parent.getNthTail(n + start); - } - - @Override - public String toString() { - return parent.toString(start); - } - - @Override - public void encode(final OtpOutputStream stream) { - parent.encode(stream, start); - } - - @Override - public OtpErlangObject getLastTail() { - return parent.getLastTail(); - } - - @Override - public Iterator iterator() { - return parent.iterator(start); - } + private SubList(final OtpErlangList parent, final int start) { + super(); + this.parent = parent; + this.start = start; + } + + @Override + public int arity() { + return parent.arity() - start; + } + + @Override + public OtpErlangObject elementAt(final int i) { + return parent.elementAt(i + start); + } + + @Override + public OtpErlangObject[] elements() { + final int n = parent.arity() - start; + final OtpErlangObject[] res = new OtpErlangObject[n]; + for (int i = 0; i < res.length; i++) { + res[i] = parent.elementAt(i + start); + } + return res; + } + + @Override + public boolean isProper() { + return parent.isProper(); + } + + @Override + public OtpErlangObject getHead() { + return parent.elementAt(start); + } + + @Override + public OtpErlangObject getNthTail(final int n) { + return parent.getNthTail(n + start); + } + + @Override + public String toString() { + return parent.toString(start); + } + + @Override + public void encode(final OtpOutputStream stream) { + parent.encode(stream, start); + } + + @Override + public OtpErlangObject getLastTail() { + return parent.getLastTail(); + } + + @Override + public Iterator iterator() { + return parent.iterator(start); + } } private class Itr implements Iterator { - /** - * Index of element to be returned by subsequent call to next. - */ - private int cursor; - - private Itr(final int cursor) { - this.cursor = cursor; - } - - public boolean hasNext() { - return cursor < elems.length; - } - - public OtpErlangObject next() { - try { - return elems[cursor++]; - } catch (final IndexOutOfBoundsException e) { - throw new NoSuchElementException(); - } - } - - public void remove() { - throw new UnsupportedOperationException( - "OtpErlangList cannot be modified!"); - } + /** + * Index of element to be returned by subsequent call to next. + */ + private int cursor; + + private Itr(final int cursor) { + this.cursor = cursor; + } + + public boolean hasNext() { + return cursor < elems.length; + } + + public OtpErlangObject next() { + try { + return elems[cursor++]; + } catch (final IndexOutOfBoundsException e) { + throw new NoSuchElementException(); + } + } + + public void remove() { + throw new UnsupportedOperationException( + "OtpErlangList cannot be modified!"); + } } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,391 +1,399 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; import java.math.BigInteger; /** * Provides a Java representation of Erlang integral types. Erlang does not * distinguish between different integral types, however this class and its - * subclasses {@link OtpErlangByte}, {@link OtpErlangChar}, {@link OtpErlangInt} - * , and {@link OtpErlangShort} attempt to map the Erlang types onto the various - * Java integral types. Two additional classes, {@link OtpErlangUInt} and - * {@link OtpErlangUShort} are provided for Corba compatibility. See the - * documentation for IC for more information. + * subclasses {@link OtpErlangByte}, {@link OtpErlangChar}, + * {@link OtpErlangInt}, and {@link OtpErlangShort} attempt to map the Erlang + * types onto the various Java integral types. Two additional classes, + * {@link OtpErlangUInt} and {@link OtpErlangUShort} are provided for Corba + * compatibility. See the documentation for IC for more information. */ -public class OtpErlangLong extends OtpErlangObject { +public class OtpErlangLong extends OtpErlangObject implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = 1610466859236755096L; + static final long serialVersionUID = 1610466859236755096L; private long val; private BigInteger bigVal = null; /** * Create an Erlang integer from the given value. - * + * * @param l - * the long value to use. + * the long value to use. */ public OtpErlangLong(final long l) { - val = l; + val = l; } /** * Create an Erlang integer from the given value. - * + * * @param v - * the big integer value to use. + * the big integer value to use. */ public OtpErlangLong(final BigInteger v) { - if (v == null) { - throw new java.lang.NullPointerException(); - } - if (v.bitLength() < 64) { - val = v.longValue(); - } else { - bigVal = v; - } + if (v == null) { + throw new java.lang.NullPointerException(); + } + if (v.bitLength() < 64) { + val = v.longValue(); + } else { + bigVal = v; + } } /** * Create an Erlang integer from a stream containing an integer encoded in * Erlang external format. - * + * * @param buf - * the stream containing the encoded value. - * + * the stream containing the encoded value. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang integer. + * if the buffer does not contain a valid external + * representation of an Erlang integer. */ public OtpErlangLong(final OtpInputStream buf) - throws OtpErlangDecodeException { - final byte[] b = buf.read_integer_byte_array(); - try { - val = OtpInputStream.byte_array_to_long(b, false); - } catch (final OtpErlangDecodeException e) { - bigVal = new BigInteger(b); - } + throws OtpErlangDecodeException { + final byte[] b = buf.read_integer_byte_array(); + try { + val = OtpInputStream.byte_array_to_long(b, false); + } catch (final OtpErlangDecodeException e) { + bigVal = new BigInteger(b); + } } /** * Get this number as a BigInteger. - * + * * @return the value of this number, as a BigInteger. */ public BigInteger bigIntegerValue() { - if (bigVal != null) { - return bigVal; - } - return BigInteger.valueOf(val); + if (bigVal != null) { + return bigVal; + } else { + return BigInteger.valueOf(val); + } } /** * Get this number as a long, or rather truncate all but the least * significant 64 bits from the 2's complement representation of this number * and return them as a long. - * + * * @return the value of this number, as a long. */ public long longValue() { - if (bigVal != null) { - return bigVal.longValue(); - } - return val; + if (bigVal != null) { + return bigVal.longValue(); + } else { + return val; + } } /** * Determine if this value can be represented as a long without truncation. - * + * * @return true if this value fits in a long, false otherwise. */ public boolean isLong() { - // To just chech this.bigVal is a wee bit to simple, since - // there just might have be a mean bignum that arrived on - // a stream, and was a long disguised as more than 8 byte integer. - if (bigVal != null) { - return bigVal.bitLength() < 64; - } - return true; + // To just chech this.bigVal is a wee bit to simple, since + // there just might have be a mean bignum that arrived on + // a stream, and was a long disguised as more than 8 byte integer. + if (bigVal != null) { + return bigVal.bitLength() < 64; + } + return true; } /** * Determine if this value can be represented as an unsigned long without * truncation, that is if the value is non-negative and its bit pattern * completely fits in a long. - * + * * @return true if this value is non-negative and fits in a long false * otherwise. */ public boolean isULong() { - // Here we have the same problem as for isLong(), plus - // the whole range 1<<63 .. (1<<64-1) is allowed. - if (bigVal != null) { - return bigVal.signum() >= 0 && bigVal.bitLength() <= 64; - } - return val >= 0; + // Here we have the same problem as for isLong(), plus + // the whole range 1<<63 .. (1<<64-1) is allowed. + if (bigVal != null) { + return bigVal.signum() >= 0 && bigVal.bitLength() <= 64; + } + return val >= 0; } /** * Returns the number of bits in the minimal two's-complement representation * of this BigInteger, excluding a sign bit. - * + * * @return number of bits in the minimal two's-complement representation of * this BigInteger, excluding a sign bit. */ public int bitLength() { - if (bigVal != null) { - return bigVal.bitLength(); - } - if (val == 0 || val == -1) { - return 0; - } - // Binary search for bit length - int i = 32; // mask length - long m = (1L << i) - 1; // AND mask with ones in little end - if (val < 0) { - m = ~m; // OR mask with ones in big end - for (int j = i >> 1; j > 0; j >>= 1) { // mask delta - if ((val | m) == val) { // mask >= enough - i -= j; - m >>= j; // try less bits - } else { - i += j; - m <<= j; // try more bits - } - } - if ((val | m) != val) { - i++; // mask < enough - } - } else { - for (int j = i >> 1; j > 0; j >>= 1) { // mask delta - if ((val & m) == val) { // mask >= enough - i -= j; - m >>= j; // try less bits - } else { - i += j; - m = m << j | m; // try more bits - } - } - if ((val & m) != val) { - i++; // mask < enough - } - } - return i; + if (bigVal != null) { + return bigVal.bitLength(); + } + if (val == 0 || val == -1) { + return 0; + } else { + // Binary search for bit length + int i = 32; // mask length + long m = (1L << i) - 1; // AND mask with ones in little end + if (val < 0) { + m = ~m; // OR mask with ones in big end + for (int j = i >> 1; j > 0; j >>= 1) { // mask delta + if ((val | m) == val) { // mask >= enough + i -= j; + m >>= j; // try less bits + } else { + i += j; + m <<= j; // try more bits + } + } + if ((val | m) != val) { + i++; // mask < enough + } + } else { + for (int j = i >> 1; j > 0; j >>= 1) { // mask delta + if ((val & m) == val) { // mask >= enough + i -= j; + m >>= j; // try less bits + } else { + i += j; + m = m << j | m; // try more bits + } + } + if ((val & m) != val) { + i++; // mask < enough + } + } + return i; + } } /** * Return the signum function of this object. - * + * * @return -1, 0 or 1 as the value is negative, zero or positive. */ public int signum() { - if (bigVal != null) { - return bigVal.signum(); - } - return val > 0 ? 1 : val < 0 ? -1 : 0; + if (bigVal != null) { + return bigVal.signum(); + } else { + return val > 0 ? 1 : val < 0 ? -1 : 0; + } } /** * Get this number as an int. - * + * * @return the value of this number, as an int. - * + * * @exception OtpErlangRangeException - * if the value is too large to be represented as an int. + * if the value is too large to be represented as an int. */ public int intValue() throws OtpErlangRangeException { - final long l = longValue(); - final int i = (int) l; + final long l = longValue(); + final int i = (int) l; - if (i != l) { - throw new OtpErlangRangeException("Value too large for int: " + val); - } + if (i != l) { + throw new OtpErlangRangeException("Value too large for int: " + val); + } - return i; + return i; } /** * Get this number as a non-negative int. - * + * * @return the value of this number, as an int. - * + * * @exception OtpErlangRangeException - * if the value is too large to be represented as an int, or - * if the value is negative. + * if the value is too large to be represented as an int, + * or if the value is negative. */ public int uIntValue() throws OtpErlangRangeException { - final long l = longValue(); - final int i = (int) l; + final long l = longValue(); + final int i = (int) l; - if (i != l) { - throw new OtpErlangRangeException("Value too large for int: " + val); - } else if (i < 0) { - throw new OtpErlangRangeException("Value not positive: " + val); - } + if (i != l) { + throw new OtpErlangRangeException("Value too large for int: " + val); + } else if (i < 0) { + throw new OtpErlangRangeException("Value not positive: " + val); + } - return i; + return i; } /** * Get this number as a short. - * + * * @return the value of this number, as a short. - * + * * @exception OtpErlangRangeException - * if the value is too large to be represented as a short. + * if the value is too large to be represented as a + * short. */ public short shortValue() throws OtpErlangRangeException { - final long l = longValue(); - final short i = (short) l; + final long l = longValue(); + final short i = (short) l; - if (i != l) { - throw new OtpErlangRangeException("Value too large for short: " - + val); - } + if (i != l) { + throw new OtpErlangRangeException("Value too large for short: " + + val); + } - return i; + return i; } /** * Get this number as a non-negative short. - * + * * @return the value of this number, as a short. - * + * * @exception OtpErlangRangeException - * if the value is too large to be represented as a short, or - * if the value is negative. + * if the value is too large to be represented as a + * short, or if the value is negative. */ public short uShortValue() throws OtpErlangRangeException { - final long l = longValue(); - final short i = (short) l; + final long l = longValue(); + final short i = (short) l; - if (i != l) { - throw new OtpErlangRangeException("Value too large for short: " - + val); - } else if (i < 0) { - throw new OtpErlangRangeException("Value not positive: " + val); - } + if (i != l) { + throw new OtpErlangRangeException("Value too large for short: " + + val); + } else if (i < 0) { + throw new OtpErlangRangeException("Value not positive: " + val); + } - return i; + return i; } /** * Get this number as a char. - * + * * @return the char value of this number. - * + * * @exception OtpErlangRangeException - * if the value is too large to be represented as a char. + * if the value is too large to be represented as a char. */ public char charValue() throws OtpErlangRangeException { - final long l = longValue(); - final char i = (char) l; + final long l = longValue(); + final char i = (char) l; - if (i != l) { - throw new OtpErlangRangeException("Value too large for char: " - + val); - } + if (i != l) { + throw new OtpErlangRangeException("Value too large for char: " + + val); + } - return i; + return i; } /** * Get this number as a byte. - * + * * @return the byte value of this number. - * + * * @exception OtpErlangRangeException - * if the value is too large to be represented as a byte. + * if the value is too large to be represented as a byte. */ public byte byteValue() throws OtpErlangRangeException { - final long l = longValue(); - final byte i = (byte) l; + final long l = longValue(); + final byte i = (byte) l; - if (i != l) { - throw new OtpErlangRangeException("Value too large for byte: " - + val); - } + if (i != l) { + throw new OtpErlangRangeException("Value too large for byte: " + + val); + } - return i; + return i; } /** * Get the string representation of this number. - * + * * @return the string representation of this number. */ @Override public String toString() { - if (bigVal != null) { - return "" + bigVal; - } - return "" + val; + if (bigVal != null) { + return "" + bigVal; + } else { + return "" + val; + } } /** * Convert this number to the equivalent Erlang external representation. - * + * * @param buf - * an output stream to which the encoded number should be - * written. + * an output stream to which the encoded number should be + * written. */ @Override public void encode(final OtpOutputStream buf) { - if (bigVal != null) { - buf.write_big_integer(bigVal); - } else { - buf.write_long(val); - } + if (bigVal != null) { + buf.write_big_integer(bigVal); + } else { + buf.write_long(val); + } } /** * Determine if two numbers are equal. Numbers are equal if they contain the * same value. - * + * * @param o - * the number to compare to. - * + * the number to compare to. + * * @return true if the numbers have the same value. */ @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangLong)) { - return false; - } - - final OtpErlangLong that = (OtpErlangLong) o; - - if (bigVal != null && that.bigVal != null) { - return bigVal.equals(that.bigVal); - } else if (bigVal == null && that.bigVal == null) { - return val == that.val; - } - return false; + if (!(o instanceof OtpErlangLong)) { + return false; + } + + final OtpErlangLong that = (OtpErlangLong) o; + + if (bigVal != null && that.bigVal != null) { + return bigVal.equals(that.bigVal); + } else if (bigVal == null && that.bigVal == null) { + return val == that.val; + } + return false; } - + @Override protected int doHashCode() { - if (bigVal != null) { - return bigVal.hashCode(); - } - return BigInteger.valueOf(val).hashCode(); + if (bigVal != null) { + return bigVal.hashCode(); + } else { + return BigInteger.valueOf(val).hashCode(); + } } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangMap.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangMap.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangMap.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangMap.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,77 +3,61 @@ * * Copyright Ericsson AB 2000-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ package com.ericsson.otp.erlang; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; +import java.io.Serializable; /** * Provides a Java representation of Erlang maps. Maps are created from one or * more arbitrary Erlang terms. - * + * *

    * The arity of the map is the number of elements it contains. The keys and * values can be retrieved as arrays and the value for a key can be queried. - * + * */ -public class OtpErlangMap extends OtpErlangObject { +public class OtpErlangMap extends OtpErlangObject implements Serializable, + Cloneable { // don't change this! private static final long serialVersionUID = -6410770117696198497L; - private OtpMap map; + private static final OtpErlangObject[] NO_ELEMENTS = new OtpErlangObject[0]; - private static class OtpMap - extends LinkedHashMap { - private static final long serialVersionUID = -2666505810905455082L; - - public OtpMap() { - super(); - } - } - - /** - * Create an empty map. - */ - public OtpErlangMap() { - map = new OtpMap(); - } + private OtpErlangObject[] keys = NO_ELEMENTS; + private OtpErlangObject[] values = NO_ELEMENTS; /** * Create a map from an array of keys and an array of values. - * + * * @param keys * the array of terms to create the map keys from. * @param values * the array of terms to create the map values from. - * + * * @exception java.lang.IllegalArgumentException * if any array is empty (null) or contains null elements. */ public OtpErlangMap(final OtpErlangObject[] keys, - final OtpErlangObject[] values) { - this(keys, 0, keys.length, values, 0, values.length); + final OtpErlangObject[] values) { + this(keys, 0, keys.length, values, 0, values.length); } /** * Create a map from an array of terms. - * + * * @param keys * the array of terms to create the map from. * @param kstart @@ -86,280 +70,228 @@ * the offset of the first value to insert. * @param vcount * the number of values to insert. - * + * * @exception java.lang.IllegalArgumentException * if any array is empty (null) or contains null elements. * @exception java.lang.IllegalArgumentException * if kcount and vcount differ. */ public OtpErlangMap(final OtpErlangObject[] keys, final int kstart, - final int kcount, final OtpErlangObject[] values, final int vstart, - final int vcount) { - if (keys == null || values == null) { - throw new java.lang.IllegalArgumentException( - "Map content can't be null"); - } else if (kcount != vcount) { - throw new java.lang.IllegalArgumentException( - "Map keys and values must have same arity"); - } - map = new OtpMap(); - OtpErlangObject key, val; - for (int i = 0; i < vcount; i++) { - if ((key = keys[kstart + i]) == null) { - throw new java.lang.IllegalArgumentException( - "Map key cannot be null (element" + (kstart + i) + ")"); - } - if ((val = values[vstart + i]) == null) { - throw new java.lang.IllegalArgumentException( - "Map value cannot be null (element" + (vstart + i) - + ")"); - } - put(key, val); - } + final int kcount, final OtpErlangObject[] values, final int vstart, + final int vcount) { + if (keys == null || values == null) { + throw new java.lang.IllegalArgumentException( + "Map content can't be null"); + } else if (kcount != vcount) { + throw new java.lang.IllegalArgumentException( + "Map keys and values must have same arity"); + } else if (vcount < 1) { + this.keys = NO_ELEMENTS; + this.values = NO_ELEMENTS; + } else { + this.keys = new OtpErlangObject[vcount]; + for (int i = 0; i < vcount; i++) { + if (keys[kstart + i] != null) { + this.keys[i] = keys[kstart + i]; + } else { + throw new java.lang.IllegalArgumentException( + "Map key cannot be null (element" + (kstart + i) + + ")"); + } + } + this.values = new OtpErlangObject[vcount]; + for (int i = 0; i < vcount; i++) { + if (values[vstart + i] != null) { + this.values[i] = values[vstart + i]; + } else { + throw new java.lang.IllegalArgumentException( + "Map value cannot be null (element" + (vstart + i) + + ")"); + } + } + } } /** * Create a map from a stream containing a map encoded in Erlang external * format. - * + * * @param buf * the stream containing the encoded map. - * + * * @exception OtpErlangDecodeException * if the buffer does not contain a valid external * representation of an Erlang map. */ public OtpErlangMap(final OtpInputStream buf) - throws OtpErlangDecodeException { - final int arity = buf.read_map_head(); + throws OtpErlangDecodeException { + final int arity = buf.read_map_head(); - if (arity > 0) { - map = new OtpMap(); - for (int i = 0; i < arity; i++) { - OtpErlangObject key, val; - key = buf.read_any(); - val = buf.read_any(); - put(key, val); - } - } else { - map = new OtpMap(); - } + if (arity > 0) { + keys = new OtpErlangObject[arity]; + values = new OtpErlangObject[arity]; + + for (int i = 0; i < arity; i++) { + keys[i] = buf.read_any(); + values[i] = buf.read_any(); + } + } else { + keys = NO_ELEMENTS; + values = NO_ELEMENTS; + } } /** * Get the arity of the map. - * + * * @return the number of elements contained in the map. */ public int arity() { - return map.size(); - } - - /** - * Put value corresponding to key into the map. For detailed behavior - * description see {@link Map#put(Object, Object)}. - * - * @param key - * key to associate value with - * @param value - * value to associate with key - * @return previous value associated with key or null - */ - public OtpErlangObject put(final OtpErlangObject key, - final OtpErlangObject value) { - return map.put(key, value); - } - - /** - * removes mapping for the key if present. - * - * @param key - * key for which mapping is to be remove - * @return value associated with key or null - */ - public OtpErlangObject remove(final OtpErlangObject key) { - return map.remove(key); + return keys.length; } /** * Get the specified value from the map. - * + * * @param key * the key of the requested value. - * + * * @return the requested value, of null if key is not a valid key. */ public OtpErlangObject get(final OtpErlangObject key) { - return map.get(key); + if (key == null) { + return null; + } + for (int i = 0; i < keys.length; i++) { + if (key.equals(keys[i])) { + return values[i]; + } + } + return null; } /** * Get all the keys from the map as an array. - * + * * @return an array containing all of the map's keys. */ public OtpErlangObject[] keys() { - return map.keySet().toArray(new OtpErlangObject[arity()]); + final OtpErlangObject[] res = new OtpErlangObject[arity()]; + System.arraycopy(keys, 0, res, 0, res.length); + return res; } /** * Get all the values from the map as an array. - * + * * @return an array containing all of the map's values. */ public OtpErlangObject[] values() { - return map.values().toArray(new OtpErlangObject[arity()]); - } - - /** - * make Set view of the map key-value pairs - * - * @return a set containing key-value pairs - */ - public Set> entrySet() { - return map.entrySet(); + final OtpErlangObject[] res = new OtpErlangObject[arity()]; + System.arraycopy(values, 0, res, 0, res.length); + return res; } /** * Get the string representation of the map. - * + * * @return the string representation of the map. */ @Override public String toString() { - final StringBuffer s = new StringBuffer(); - - s.append("#{"); + int i; + final StringBuffer s = new StringBuffer(); + final int arity = values.length; + + s.append("#{"); + + for (i = 0; i < arity; i++) { + if (i > 0) { + s.append(","); + } + s.append(keys[i].toString()); + s.append(" => "); + s.append(values[i].toString()); + } - boolean first = true; - for (final Map.Entry e : entrySet()) { - if (first) { - first = false; - } else { - s.append(","); - } - s.append(e.getKey().toString()); - s.append(" => "); - s.append(e.getValue().toString()); - } + s.append("}"); - s.append("}"); - - return s.toString(); + return s.toString(); } /** * Convert this map to the equivalent Erlang external representation. - * + * * @param buf * an output stream to which the encoded map should be written. */ @Override public void encode(final OtpOutputStream buf) { - final int arity = arity(); + final int arity = values.length; - buf.write_map_head(arity); + buf.write_map_head(arity); - for (final Map.Entry e : entrySet()) { - buf.write_any(e.getKey()); - buf.write_any(e.getValue()); - } + for (int i = 0; i < arity; i++) { + buf.write_any(keys[i]); + buf.write_any(values[i]); + } } /** * Determine if two maps are equal. Maps are equal if they have the same * arity and all of the elements are equal. - * + * * @param o * the map to compare to. - * + * * @return true if the maps have the same arity and all the elements are * equal. */ @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangMap)) { - return false; - } - - final OtpErlangMap t = (OtpErlangMap) o; - final int a = arity(); - - if (a != t.arity()) { - return false; - } - if (a == 0) { - return true; - } - - OtpErlangObject key, val; - for (final Map.Entry e : entrySet()) { - key = e.getKey(); - val = e.getValue(); - final OtpErlangObject v = t.get(key); - if (v == null || !val.equals(v)) { - return false; - } - } - - return true; - } - - @Override - public boolean match(final OtpErlangObject term, final T binds) { - if (!(term instanceof OtpErlangMap)) { - return false; - } - - final OtpErlangMap t = (OtpErlangMap) term; - final int a = arity(); - - if (a > t.arity()) { - return false; - } - if (a == 0) { - return true; - } - - OtpErlangObject key, val; - for (final Map.Entry e : entrySet()) { - key = e.getKey(); - val = e.getValue(); - final OtpErlangObject v = t.get(key); - if (v == null || !val.match(v, binds)) { - return false; - } - } - - return true; - } - - @Override - public OtpErlangObject bind(final T binds) throws OtpErlangException { - final OtpErlangMap ret = new OtpErlangMap(); - - OtpErlangObject key, val; - for (final Map.Entry e : entrySet()) { - key = e.getKey(); - val = e.getValue(); - ret.put(key, val.bind(binds)); - } + if (!(o instanceof OtpErlangMap)) { + return false; + } + + final OtpErlangMap t = (OtpErlangMap) o; + final int a = arity(); + + if (a != t.arity()) { + return false; + } + + for (int i = 0; i < a; i++) { + if (!keys[i].equals(t.keys[i])) { + return false; // early exit + } + } + for (int i = 0; i < a; i++) { + if (!values[i].equals(t.values[i])) { + return false; // early exit + } + } - return ret; + return true; } @Override protected int doHashCode() { - final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(9); - hash.combine(map.hashCode()); - return hash.valueOf(); + final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(9); + final int a = arity(); + hash.combine(a); + for (int i = 0; i < a; i++) { + hash.combine(keys[i].hashCode()); + } + for (int i = 0; i < a; i++) { + hash.combine(values[i].hashCode()); + } + return hash.valueOf(); } @Override - @SuppressWarnings("unchecked") public Object clone() { - final OtpErlangMap newMap = (OtpErlangMap) super.clone(); - newMap.map = (OtpMap) map.clone(); - return newMap; + final OtpErlangMap newMap = (OtpErlangMap) super.clone(); + newMap.values = values.clone(); + return newMap; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangObject.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangObject.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangObject.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangObject.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -27,7 +26,7 @@ */ public abstract class OtpErlangObject implements Serializable, Cloneable { protected int hashCodeValue = 0; - + // don't change this! static final long serialVersionUID = -8435938572339430044L; @@ -43,9 +42,10 @@ * Convert the object according to the rules of the Erlang external format. * This is mainly used for sending Erlang terms in messages, however it can * also be used for storing terms to disk. - * + * * @param buf - * an output stream to which the encoded term should be written. + * an output stream to which the encoded term should be + * written. */ public abstract void encode(OtpOutputStream buf); @@ -54,176 +54,137 @@ * corresponding Erlang data type object. This method is normally used when * Erlang terms are received in messages, however it can also be used for * reading terms from disk. - * + * * @param buf - * an input stream containing one or more encoded Erlang terms. - * + * an input stream containing one or more encoded Erlang + * terms. + * * @return an object representing one of the Erlang data types. - * + * * @exception OtpErlangDecodeException - * if the stream does not contain a valid representation of - * an Erlang term. + * if the stream does not contain a valid representation + * of an Erlang term. */ public static OtpErlangObject decode(final OtpInputStream buf) - throws OtpErlangDecodeException { - return buf.read_any(); + throws OtpErlangDecodeException { + return buf.read_any(); } /** * Determine if two Erlang objects are equal. In general, Erlang objects are * equal if the components they consist of are equal. - * + * * @param o - * the object to compare to. - * + * the object to compare to. + * * @return true if the objects are identical. */ @Override public abstract boolean equals(Object o); - - /** - * Perform match operation against given term. - * - * @param term - * the object to match - * @param binds - * variable bindings - * @return true if match succeeded - */ - public boolean match(final OtpErlangObject term, final T binds) { - return equals(term); - } - - /** - * Make new Erlang term replacing variables with the respective values from - * bindings argument(s). - * - * @param binds - * variable bindings - * @return new term - * @throws OtpErlangException - */ - public OtpErlangObject bind(final T binds) throws OtpErlangException { - return this; - } - + @Override public int hashCode() { - if (hashCodeValue == 0) { - hashCodeValue = doHashCode(); - } - return hashCodeValue; + if (hashCodeValue == 0) { + hashCodeValue = doHashCode(); + } + return hashCodeValue; } - + protected int doHashCode() { - return super.hashCode(); + return super.hashCode(); } - + @Override public Object clone() { - try { - return super.clone(); - } catch (final CloneNotSupportedException e) { - /* cannot happen */ - throw new InternalError(e.toString()); - } + try { + return super.clone(); + } catch (final CloneNotSupportedException e) { + /* cannot happen */ + throw new InternalError(e.toString()); + } } protected final static class Hash { - int abc[] = { 0, 0, 0 }; - - /* - * Hash function suggested by Bob Jenkins. The same as in the Erlang VM - * (beam); utils.c. - */ - - private final static int HASH_CONST[] = { 0, // not used - 0x9e3779b9, // the golden ratio; an arbitrary value - 0x3c6ef372, // (hashHConst[1] * 2) % (1<<32) - 0xdaa66d2b, // 1 3 - 0x78dde6e4, // 1 4 - 0x1715609d, // 1 5 - 0xb54cda56, // 1 6 - 0x5384540f, // 1 7 - 0xf1bbcdc8, // 1 8 - 0x8ff34781, // 1 9 - 0x2e2ac13a, // 1 10 - 0xcc623af3, // 1 11 - 0x6a99b4ac, // 1 12 - 0x08d12e65, // 1 13 - 0xa708a81e, // 1 14 - 0x454021d7, // 1 15 - }; - - protected Hash(final int i) { - abc[0] = abc[1] = HASH_CONST[i]; - abc[2] = 0; - } - - // protected Hash() { - // Hash(1); - // } - - private void mix() { - abc[0] -= abc[1]; - abc[0] -= abc[2]; - abc[0] ^= abc[2] >>> 13; - abc[1] -= abc[2]; - abc[1] -= abc[0]; - abc[1] ^= abc[0] << 8; - abc[2] -= abc[0]; - abc[2] -= abc[1]; - abc[2] ^= abc[1] >>> 13; - abc[0] -= abc[1]; - abc[0] -= abc[2]; - abc[0] ^= abc[2] >>> 12; - abc[1] -= abc[2]; - abc[1] -= abc[0]; - abc[1] ^= abc[0] << 16; - abc[2] -= abc[0]; - abc[2] -= abc[1]; - abc[2] ^= abc[1] >>> 5; - abc[0] -= abc[1]; - abc[0] -= abc[2]; - abc[0] ^= abc[2] >>> 3; - abc[1] -= abc[2]; - abc[1] -= abc[0]; - abc[1] ^= abc[0] << 10; - abc[2] -= abc[0]; - abc[2] -= abc[1]; - abc[2] ^= abc[1] >>> 15; - } - - protected void combine(final int a) { - abc[0] += a; - mix(); - } - - protected void combine(final long a) { - combine((int) (a >>> 32), (int) a); - } - - protected void combine(final int a, final int b) { - abc[0] += a; - abc[1] += b; - mix(); - } - - protected void combine(final byte b[]) { - int j, k; - for (j = 0, k = 0; j + 4 < b.length; j += 4, k += 1, k %= 3) { - abc[k] += (b[j + 0] & 0xFF) + (b[j + 1] << 8 & 0xFF00) - + (b[j + 2] << 16 & 0xFF0000) + (b[j + 3] << 24); - mix(); - } - for (int n = 0, m = 0xFF; j < b.length; j++, n += 8, m <<= 8) { - abc[k] += b[j] << n & m; - } - mix(); - } - - protected int valueOf() { - return abc[2]; - } + int abc[] = {0, 0, 0}; + + /* Hash function suggested by Bob Jenkins. + * The same as in the Erlang VM (beam); utils.c. + */ + + private final static int HASH_CONST[] = { + 0, // not used + 0x9e3779b9, // the golden ratio; an arbitrary value + 0x3c6ef372, // (hashHConst[1] * 2) % (1<<32) + 0xdaa66d2b, // 1 3 + 0x78dde6e4, // 1 4 + 0x1715609d, // 1 5 + 0xb54cda56, // 1 6 + 0x5384540f, // 1 7 + 0xf1bbcdc8, // 1 8 + 0x8ff34781, // 1 9 + 0x2e2ac13a, // 1 10 + 0xcc623af3, // 1 11 + 0x6a99b4ac, // 1 12 + 0x08d12e65, // 1 13 + 0xa708a81e, // 1 14 + 0x454021d7, // 1 15 + }; + + protected Hash(int i) { + abc[0] = abc[1] = HASH_CONST[i]; + abc[2] = 0; + } + + //protected Hash() { + // Hash(1); + //} + + private void mix() { + abc[0] -= abc[1]; abc[0] -= abc[2]; abc[0] ^= (abc[2]>>>13); + abc[1] -= abc[2]; abc[1] -= abc[0]; abc[1] ^= (abc[0]<<8); + abc[2] -= abc[0]; abc[2] -= abc[1]; abc[2] ^= (abc[1]>>>13); + abc[0] -= abc[1]; abc[0] -= abc[2]; abc[0] ^= (abc[2]>>>12); + abc[1] -= abc[2]; abc[1] -= abc[0]; abc[1] ^= (abc[0]<<16); + abc[2] -= abc[0]; abc[2] -= abc[1]; abc[2] ^= (abc[1]>>>5); + abc[0] -= abc[1]; abc[0] -= abc[2]; abc[0] ^= (abc[2]>>>3); + abc[1] -= abc[2]; abc[1] -= abc[0]; abc[1] ^= (abc[0]<<10); + abc[2] -= abc[0]; abc[2] -= abc[1]; abc[2] ^= (abc[1]>>>15); + } + + protected void combine(int a) { + abc[0] += a; + mix(); + } + + protected void combine(long a) { + combine((int)(a >>> 32), (int) a); + } + + protected void combine(int a, int b) { + abc[0] += a; + abc[1] += b; + mix(); + } + + protected void combine(byte b[]) { + int j, k; + for (j = 0, k = 0; + j + 4 < b.length; + j += 4, k += 1, k %= 3) { + abc[k] += ((int)b[j+0] & 0xFF) + ((int)b[j+1]<<8 & 0xFF00) + + ((int)b[j+2]<<16 & 0xFF0000) + ((int)b[j+3]<<24); + mix(); + } + for (int n = 0, m = 0xFF; + j < b.length; + j++, n += 8, m <<= 8) { + abc[k] += (int)b[j]< { +public class OtpErlangPid extends OtpErlangObject implements Serializable, + Cloneable, Comparable { // don't change this! - private static final long serialVersionUID = 1664394142301803659L; + static final long serialVersionUID = 1664394142301803659L; private final String node; private final int id; @@ -34,170 +36,175 @@ /** * Create a unique Erlang PID belonging to the local node. - * + * * @param self - * the local node. - * + * the local node. + * * @deprecated use OtpLocalNode:createPid() instead */ @Deprecated public OtpErlangPid(final OtpLocalNode self) { - final OtpErlangPid p = self.createPid(); + final OtpErlangPid p = self.createPid(); - id = p.id; - serial = p.serial; - creation = p.creation; - node = p.node; + id = p.id; + serial = p.serial; + creation = p.creation; + node = p.node; } /** * Create an Erlang PID from a stream containing a PID encoded in Erlang * external format. - * + * * @param buf - * the stream containing the encoded PID. - * + * the stream containing the encoded PID. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang PID. + * if the buffer does not contain a valid external + * representation of an Erlang PID. */ public OtpErlangPid(final OtpInputStream buf) - throws OtpErlangDecodeException { - final OtpErlangPid p = buf.read_pid(); + throws OtpErlangDecodeException { + final OtpErlangPid p = buf.read_pid(); - node = p.node(); - id = p.id(); - serial = p.serial(); - creation = p.creation(); + node = p.node(); + id = p.id(); + serial = p.serial(); + creation = p.creation(); } /** * Create an Erlang pid from its components. - * + * * @param node - * the nodename. - * + * the nodename. + * * @param id - * an arbitrary number. Only the low order 15 bits will be used. - * + * an arbitrary number. Only the low order 15 bits will be + * used. + * * @param serial - * another arbitrary number. Only the low order 13 bits will be - * used. - * + * another arbitrary number. Only the low order 13 bits will + * be used. + * * @param creation - * yet another arbitrary number. Only the low order 2 bits will - * be used. + * yet another arbitrary number. Only the low order 2 bits + * will be used. */ public OtpErlangPid(final String node, final int id, final int serial, - final int creation) { - this.node = node; - this.id = id & 0x7fff; // 15 bits - this.serial = serial & 0x1fff; // 13 bits - this.creation = creation & 0x03; // 2 bits + final int creation) { + this.node = node; + this.id = id & 0x7fff; // 15 bits + this.serial = serial & 0x1fff; // 13 bits + this.creation = creation & 0x03; // 2 bits } /** * Get the serial number from the PID. - * + * * @return the serial number from the PID. */ public int serial() { - return serial; + return serial; } /** * Get the id number from the PID. - * + * * @return the id number from the PID. */ public int id() { - return id; + return id; } /** * Get the creation number from the PID. - * + * * @return the creation number from the PID. */ public int creation() { - return creation; + return creation; } /** * Get the node name from the PID. - * + * * @return the node name from the PID. */ public String node() { - return node; + return node; } /** * Get the string representation of the PID. Erlang PIDs are printed as * #Pid<node.id.serial> - * + * * @return the string representation of the PID. */ @Override public String toString() { - return "#Pid<" + node.toString() + "." + id + "." + serial + ">"; + return "#Pid<" + node.toString() + "." + id + "." + serial + ">"; } /** * Convert this PID to the equivalent Erlang external representation. - * + * * @param buf - * an output stream to which the encoded PID should be written. + * an output stream to which the encoded PID should be + * written. */ @Override public void encode(final OtpOutputStream buf) { - buf.write_pid(node, id, serial, creation); + buf.write_pid(node, id, serial, creation); } /** * Determine if two PIDs are equal. PIDs are equal if their components are * equal. - * + * * @param o - * the other PID to compare to. - * + * the other PID to compare to. + * * @return true if the PIDs are equal, false otherwise. */ @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangPid)) { - return false; - } + if (!(o instanceof OtpErlangPid)) { + return false; + } - final OtpErlangPid pid = (OtpErlangPid) o; + final OtpErlangPid pid = (OtpErlangPid) o; - return creation == pid.creation && serial == pid.serial && id == pid.id - && node.compareTo(pid.node) == 0; + return creation == pid.creation && serial == pid.serial && id == pid.id + && node.compareTo(pid.node) == 0; } - + @Override protected int doHashCode() { - final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(5); - hash.combine(creation, serial); - hash.combine(id, node.hashCode()); - return hash.valueOf(); + OtpErlangObject.Hash hash = new OtpErlangObject.Hash(5); + hash.combine(creation, serial); + hash.combine(id, node.hashCode()); + return hash.valueOf(); } - + public int compareTo(final Object o) { - if (!(o instanceof OtpErlangPid)) { - return -1; - } - - final OtpErlangPid pid = (OtpErlangPid) o; - if (creation == pid.creation) { - if (serial == pid.serial) { - if (id == pid.id) { - return node.compareTo(pid.node); - } - return id - pid.id; - } - return serial - pid.serial; - } - return creation - pid.creation; + if (!(o instanceof OtpErlangPid)) { + return -1; + } + + final OtpErlangPid pid = (OtpErlangPid) o; + if (creation == pid.creation) { + if (serial == pid.serial) { + if (id == pid.id) { + return node.compareTo(pid.node); + } else { + return id - pid.id; + } + } else { + return serial - pid.serial; + } + } else { + return creation - pid.creation; + } } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangPort.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangPort.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangPort.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangPort.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,30 +1,32 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang ports. */ -public class OtpErlangPort extends OtpErlangObject { +public class OtpErlangPort extends OtpErlangObject implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = 4037115468007644704L; + static final long serialVersionUID = 4037115468007644704L; private final String node; private final int id; @@ -33,134 +35,135 @@ /* * Create a unique Erlang port belonging to the local node. Since it isn't * meaninful to do so, this constructor is private... - * + * * @param self the local node. - * + * * @deprecated use OtpLocalNode:createPort() instead */ - @SuppressWarnings("unused") private OtpErlangPort(final OtpSelf self) { - final OtpErlangPort p = self.createPort(); + final OtpErlangPort p = self.createPort(); - id = p.id; - creation = p.creation; - node = p.node; + id = p.id; + creation = p.creation; + node = p.node; } /** * Create an Erlang port from a stream containing a port encoded in Erlang * external format. - * + * * @param buf - * the stream containing the encoded port. - * + * the stream containing the encoded port. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang port. + * if the buffer does not contain a valid external + * representation of an Erlang port. */ public OtpErlangPort(final OtpInputStream buf) - throws OtpErlangDecodeException { - final OtpErlangPort p = buf.read_port(); + throws OtpErlangDecodeException { + final OtpErlangPort p = buf.read_port(); - node = p.node(); - id = p.id(); - creation = p.creation(); + node = p.node(); + id = p.id(); + creation = p.creation(); } /** * Create an Erlang port from its components. - * + * * @param node - * the nodename. - * + * the nodename. + * * @param id - * an arbitrary number. Only the low order 28 bits will be used. - * + * an arbitrary number. Only the low order 28 bits will be + * used. + * * @param creation - * another arbitrary number. Only the low order 2 bits will be - * used. + * another arbitrary number. Only the low order 2 bits will + * be used. */ public OtpErlangPort(final String node, final int id, final int creation) { - this.node = node; - this.id = id & 0xfffffff; // 28 bits - this.creation = creation & 0x03; // 2 bits + this.node = node; + this.id = id & 0xfffffff; // 28 bits + this.creation = creation & 0x03; // 2 bits } /** * Get the id number from the port. - * + * * @return the id number from the port. */ public int id() { - return id; + return id; } /** * Get the creation number from the port. - * + * * @return the creation number from the port. */ public int creation() { - return creation; + return creation; } /** * Get the node name from the port. - * + * * @return the node name from the port. */ public String node() { - return node; + return node; } /** * Get the string representation of the port. Erlang ports are printed as * #Port<node.id>. - * + * * @return the string representation of the port. */ @Override public String toString() { - return "#Port<" + node + "." + id + ">"; + return "#Port<" + node + "." + id + ">"; } /** * Convert this port to the equivalent Erlang external representation. - * + * * @param buf - * an output stream to which the encoded port should be written. + * an output stream to which the encoded port should be + * written. */ @Override public void encode(final OtpOutputStream buf) { - buf.write_port(node, id, creation); + buf.write_port(node, id, creation); } /** * Determine if two ports are equal. Ports are equal if their components are * equal. - * + * * @param o - * the other port to compare to. - * + * the other port to compare to. + * * @return true if the ports are equal, false otherwise. */ @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangPort)) { - return false; - } + if (!(o instanceof OtpErlangPort)) { + return false; + } - final OtpErlangPort port = (OtpErlangPort) o; + final OtpErlangPort port = (OtpErlangPort) o; - return creation == port.creation && id == port.id - && node.compareTo(port.node) == 0; + return creation == port.creation && id == port.id + && node.compareTo(port.node) == 0; } - + @Override protected int doHashCode() { - final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(6); - hash.combine(creation); - hash.combine(id, node.hashCode()); - return hash.valueOf(); + OtpErlangObject.Hash hash = new OtpErlangObject.Hash(6); + hash.combine(creation); + hash.combine(id, node.hashCode()); + return hash.valueOf(); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangRangeException.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangRangeException.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangRangeException.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangRangeException.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -22,7 +21,7 @@ /** * Exception raised when an attempt is made to create an Erlang term with data * that is out of range for the term in question. - * + * * @see OtpErlangByte * @see OtpErlangChar * @see OtpErlangInt @@ -38,6 +37,6 @@ * Provides a detailed message. */ public OtpErlangRangeException(final String msg) { - super(msg); + super(msg); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangRef.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangRef.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangRef.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangRef.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,32 +1,34 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang refs. There are two styles of Erlang * refs, old style (one id value) and new style (array of id values). This class * manages both types. */ -public class OtpErlangRef extends OtpErlangObject { +public class OtpErlangRef extends OtpErlangObject implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = -7022666480768586521L; + static final long serialVersionUID = -7022666480768586521L; private final String node; private final int creation; @@ -37,201 +39,203 @@ /** * Create a unique Erlang ref belonging to the local node. - * + * * @param self - * the local node. - * + * the local node. + * * @deprecated use OtpLocalNode:createRef() instead */ @Deprecated public OtpErlangRef(final OtpLocalNode self) { - final OtpErlangRef r = self.createRef(); + final OtpErlangRef r = self.createRef(); - ids = r.ids; - creation = r.creation; - node = r.node; + ids = r.ids; + creation = r.creation; + node = r.node; } /** * Create an Erlang ref from a stream containing a ref encoded in Erlang * external format. - * + * * @param buf - * the stream containing the encoded ref. - * + * the stream containing the encoded ref. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang ref. + * if the buffer does not contain a valid external + * representation of an Erlang ref. */ public OtpErlangRef(final OtpInputStream buf) - throws OtpErlangDecodeException { - final OtpErlangRef r = buf.read_ref(); + throws OtpErlangDecodeException { + final OtpErlangRef r = buf.read_ref(); - node = r.node(); - creation = r.creation(); + node = r.node(); + creation = r.creation(); - ids = r.ids(); + ids = r.ids(); } /** * Create an old style Erlang ref from its components. - * + * * @param node - * the nodename. - * + * the nodename. + * * @param id - * an arbitrary number. Only the low order 18 bits will be used. - * + * an arbitrary number. Only the low order 18 bits will be + * used. + * * @param creation - * another arbitrary number. Only the low order 2 bits will be - * used. + * another arbitrary number. Only the low order 2 bits will + * be used. */ public OtpErlangRef(final String node, final int id, final int creation) { - this.node = node; - ids = new int[1]; - ids[0] = id & 0x3ffff; // 18 bits - this.creation = creation & 0x03; // 2 bits + this.node = node; + ids = new int[1]; + ids[0] = id & 0x3ffff; // 18 bits + this.creation = creation & 0x03; // 2 bits } /** * Create a new style Erlang ref from its components. - * + * * @param node - * the nodename. - * + * the nodename. + * * @param ids - * an array of arbitrary numbers. Only the low order 18 bits of - * the first number will be used. If the array contains only one - * number, an old style ref will be written instead. At most - * three numbers will be read from the array. - * + * an array of arbitrary numbers. Only the low order 18 bits + * of the first number will be used. If the array contains + * only one number, an old style ref will be written instead. + * At most three numbers will be read from the array. + * * @param creation - * another arbitrary number. Only the low order 2 bits will be - * used. + * another arbitrary number. Only the low order 2 bits will + * be used. */ public OtpErlangRef(final String node, final int[] ids, final int creation) { - this.node = node; - this.creation = creation & 0x03; // 2 bits + this.node = node; + this.creation = creation & 0x03; // 2 bits - // use at most 82 bits (18 + 32 + 32) - int len = ids.length; - this.ids = new int[3]; - this.ids[0] = 0; - this.ids[1] = 0; - this.ids[2] = 0; - - if (len > 3) { - len = 3; - } - System.arraycopy(ids, 0, this.ids, 0, len); - this.ids[0] &= 0x3ffff; // only 18 significant bits in first number + // use at most 82 bits (18 + 32 + 32) + int len = ids.length; + this.ids = new int[3]; + this.ids[0] = 0; + this.ids[1] = 0; + this.ids[2] = 0; + + if (len > 3) { + len = 3; + } + System.arraycopy(ids, 0, this.ids, 0, len); + this.ids[0] &= 0x3ffff; // only 18 significant bits in first number } /** * Get the id number from the ref. Old style refs have only one id number. * If this is a new style ref, the first id number is returned. - * + * * @return the id number from the ref. */ public int id() { - return ids[0]; + return ids[0]; } /** * Get the array of id numbers from the ref. If this is an old style ref, * the array is of length 1. If this is a new style ref, the array has * length 3. - * + * * @return the array of id numbers from the ref. */ public int[] ids() { - return ids; + return ids; } /** * Determine whether this is a new style ref. - * + * * @return true if this ref is a new style ref, false otherwise. */ public boolean isNewRef() { - return ids.length > 1; + return ids.length > 1; } /** * Get the creation number from the ref. - * + * * @return the creation number from the ref. */ public int creation() { - return creation; + return creation; } /** * Get the node name from the ref. - * + * * @return the node name from the ref. */ public String node() { - return node; + return node; } /** * Get the string representation of the ref. Erlang refs are printed as * #Ref<node.id> - * + * * @return the string representation of the ref. */ @Override public String toString() { - String s = "#Ref<" + node; + String s = "#Ref<" + node; - for (int i = 0; i < ids.length; i++) { - s += "." + ids[i]; - } + for (int i = 0; i < ids.length; i++) { + s += "." + ids[i]; + } - s += ">"; + s += ">"; - return s; + return s; } /** * Convert this ref to the equivalent Erlang external representation. - * + * * @param buf - * an output stream to which the encoded ref should be written. + * an output stream to which the encoded ref should be + * written. */ @Override public void encode(final OtpOutputStream buf) { - buf.write_ref(node, ids, creation); + buf.write_ref(node, ids, creation); } /** * Determine if two refs are equal. Refs are equal if their components are * equal. New refs and old refs are considered equal if the node, creation * and first id numnber are equal. - * + * * @param o - * the other ref to compare to. - * + * the other ref to compare to. + * * @return true if the refs are equal, false otherwise. */ @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangRef)) { - return false; - } - - final OtpErlangRef ref = (OtpErlangRef) o; - - if (!(node.equals(ref.node()) && creation == ref.creation())) { - return false; - } - - if (isNewRef() && ref.isNewRef()) { - return ids[0] == ref.ids[0] && ids[1] == ref.ids[1] - && ids[2] == ref.ids[2]; - } - return ids[0] == ref.ids[0]; + if (!(o instanceof OtpErlangRef)) { + return false; + } + + final OtpErlangRef ref = (OtpErlangRef) o; + + if (!(node.equals(ref.node()) && creation == ref.creation())) { + return false; + } + + if (isNewRef() && ref.isNewRef()) { + return ids[0] == ref.ids[0] && ids[1] == ref.ids[1] + && ids[2] == ref.ids[2]; + } + return ids[0] == ref.ids[0]; } /** @@ -243,18 +247,18 @@ @Override protected int doHashCode() { - final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(7); - hash.combine(creation, ids[0]); - if (isNewRef()) { - hash.combine(ids[1], ids[2]); - } - return hash.valueOf(); + OtpErlangObject.Hash hash = new OtpErlangObject.Hash(7); + hash.combine(creation, ids[0]); + if (isNewRef()) { + hash.combine(ids[1], ids[2]); + } + return hash.valueOf(); } - + @Override public Object clone() { - final OtpErlangRef newRef = (OtpErlangRef) super.clone(); - newRef.ids = ids.clone(); - return newRef; + final OtpErlangRef newRef = (OtpErlangRef) super.clone(); + newRef.ids = ids.clone(); + return newRef; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangShort.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangShort.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangShort.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangShort.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,60 +1,63 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang integral types. */ -public class OtpErlangShort extends OtpErlangLong { +public class OtpErlangShort extends OtpErlangLong implements Serializable, + Cloneable { // don't change this! static final long serialVersionUID = 7162345156603088099L; /** * Create an Erlang integer from the given value. - * + * * @param s - * the short value to use. + * the short value to use. */ public OtpErlangShort(final short s) { - super(s); + super(s); } /** * Create an Erlang integer from a stream containing an integer encoded in * Erlang external format. - * + * * @param buf - * the stream containing the encoded value. - * + * the stream containing the encoded value. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang integer. - * + * if the buffer does not contain a valid external + * representation of an Erlang integer. + * * @exception OtpErlangRangeException - * if the value is too large to be represented as a short. + * if the value is too large to be represented as a + * short. */ public OtpErlangShort(final OtpInputStream buf) - throws OtpErlangRangeException, OtpErlangDecodeException { - super(buf); + throws OtpErlangRangeException, OtpErlangDecodeException { + super(buf); - shortValue(); + final short j = shortValue(); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,32 +1,34 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2012. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; +import java.lang.Character; import java.io.UnsupportedEncodingException; /** * Provides a Java representation of Erlang strings. */ -public class OtpErlangString extends OtpErlangObject { +public class OtpErlangString extends OtpErlangObject implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = -7053595217604929233L; + static final long serialVersionUID = -7053595217604929233L; private final String str; @@ -34,74 +36,75 @@ * Create an Erlang string from the given string. */ public OtpErlangString(final String str) { - this.str = str; + this.str = str; } /** * Create an Erlang string from a list of integers. * * @throws OtpErlangException - * for non-proper and non-integer lists. + * for non-proper and non-integer lists. * @throws OtpErlangRangeException - * if an integer in the list is not a valid Unicode code point - * according to Erlang. + * if an integer in the list is not + * a valid Unicode code point according to Erlang. */ - public OtpErlangString(final OtpErlangList list) throws OtpErlangException { - final String s = list.stringValue(); - final int n = s.length(); - for (int i = 0; i < n; i = s.offsetByCodePoints(i, 1)) { - final int cp = s.codePointAt(i); - if (!isValidCodePoint(cp)) { - throw new OtpErlangRangeException("Invalid CodePoint: " + cp); - } - } - str = s; + public OtpErlangString(final OtpErlangList list) + throws OtpErlangException { + String s = list.stringValue(); + final int n = s.length(); + for (int i = 0; i < n; i = s.offsetByCodePoints(i, 1)) { + int cp = s.codePointAt(i); + if (! isValidCodePoint(cp)) { + throw new OtpErlangRangeException("Invalid CodePoint: " + cp); + } + } + str = s; } /** * Create an Erlang string from a stream containing a string encoded in * Erlang external format. - * + * * @param buf * the stream containing the encoded string. - * + * * @exception OtpErlangDecodeException * if the buffer does not contain a valid external * representation of an Erlang string. */ public OtpErlangString(final OtpInputStream buf) - throws OtpErlangDecodeException { - str = buf.read_string(); + throws OtpErlangDecodeException { + str = buf.read_string(); } /** * Get the actual string contained in this object. - * + * * @return the raw string contained in this object, without regard to Erlang * quoting rules. - * + * * @see #toString */ public String stringValue() { - return str; + return str; } /** * Get the printable version of the string contained in this object. - * + * * @return the string contained in this object, quoted. - * + * * @see #stringValue */ @Override public String toString() { - return "\"" + str + "\""; + return "\"" + str + "\""; } /** * Convert this string to the equivalent Erlang external representation. - * + * * @param buf * an output stream to which the encoded string should be * written. @@ -109,48 +112,47 @@ @Override public void encode(final OtpOutputStream buf) { - buf.write_string(str); + buf.write_string(str); } /** * Determine if two strings are equal. They are equal if they represent the * same sequence of characters. This method can be used to compare * OtpErlangStrings with each other and with Strings. - * + * * @param o * the OtpErlangString or String to compare to. - * + * * @return true if the strings consist of the same sequence of characters, * false otherwise. */ @Override public boolean equals(final Object o) { - if (o instanceof String) { - return str.compareTo((String) o) == 0; - } else if (o instanceof OtpErlangString) { - return str.compareTo(((OtpErlangString) o).str) == 0; - } + if (o instanceof String) { + return str.compareTo((String) o) == 0; + } else if (o instanceof OtpErlangString) { + return str.compareTo(((OtpErlangString) o).str) == 0; + } - return false; + return false; } - - @Override + protected int doHashCode() { - return str.hashCode(); + return str.hashCode(); } /** * Create Unicode code points from a String. + * + * @param s + * a String to convert to an Unicode code point array * - * @param s - * a String to convert to an Unicode code point array - * - * @return the corresponding array of integers representing Unicode code - * points + * @return the corresponding array of integers representing + * Unicode code points */ - public static int[] stringToCodePoints(final String s) { + public static int[] stringToCodePoints(final String s) { final int m = s.codePointCount(0, s.length()); final int[] codePoints = new int[m]; int j = 0; @@ -163,34 +165,34 @@ } /** - * Validate a code point according to Erlang definition; Unicode 3.0. That - * is; valid in the range U+0..U+10FFFF, but not in the range U+D800..U+DFFF - * (surrogat pairs). + * Validate a code point according to Erlang definition; Unicode 3.0. + * That is; valid in the range U+0..U+10FFFF, but not in the range + * U+D800..U+DFFF (surrogat pairs). * - * @param cp - * the code point value to validate + * @param cp + * the code point value to validate * - * @return true if the code point is valid, false otherwise. + * @return true if the code point is valid, + * false otherwise. */ public static boolean isValidCodePoint(final int cp) { - // Erlang definition of valid Unicode code points; - // Unicode 3.0, XML, et.al. - return cp >>> 16 <= 0x10 // in 0..10FFFF; Unicode range - && (cp & ~0x7FF) != 0xD800; // not in D800..DFFF; surrogate - // range + // Erlang definition of valid Unicode code points; + // Unicode 3.0, XML, et.al. + return (cp>>>16) <= 0x10 // in 0..10FFFF; Unicode range + && (cp & ~0x7FF) != 0xD800; // not in D800..DFFF; surrogate range } /** - * Construct a String from a Latin-1 (ISO-8859-1) encoded byte array, if - * Latin-1 is available, otherwise use the default encoding. + * Construct a String from a Latin-1 (ISO-8859-1) encoded byte array, + * if Latin-1 is available, otherwise use the default encoding. * */ public static String newString(final byte[] bytes) { - try { - return new String(bytes, "ISO-8859-1"); - } catch (final UnsupportedEncodingException e) { - } - return new String(bytes); + try { + return new String(bytes, "ISO-8859-1"); + } catch (final UnsupportedEncodingException e) { + } + return new String(bytes); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,36 +1,38 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2013. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang tuples. Tuples are created from one * or more arbitrary Erlang terms. - * + * *

    * The arity of the tuple is the number of elements it contains. Elements are * indexed from 0 to (arity-1) and can be retrieved individually by using the * appropriate index. */ -public class OtpErlangTuple extends OtpErlangObject { +public class OtpErlangTuple extends OtpErlangObject implements Serializable, + Cloneable { // don't change this! - private static final long serialVersionUID = 9163498658004915935L; + static final long serialVersionUID = 9163498658004915935L; private static final OtpErlangObject[] NO_ELEMENTS = new OtpErlangObject[0]; @@ -38,248 +40,222 @@ /** * Create a unary tuple containing the given element. - * + * * @param elem - * the element to create the tuple from. - * + * the element to create the tuple from. + * * @exception java.lang.IllegalArgumentException - * if the element is null. + * if the element is null. */ public OtpErlangTuple(final OtpErlangObject elem) { - if (elem == null) { - throw new java.lang.IllegalArgumentException( - "Tuple element cannot be null"); - } - elems = new OtpErlangObject[] { elem }; + if (elem == null) { + throw new java.lang.IllegalArgumentException( + "Tuple element cannot be null"); + } else { + elems = new OtpErlangObject[] { elem }; + } } /** * Create a tuple from an array of terms. - * + * * @param elems - * the array of terms to create the tuple from. - * + * the array of terms to create the tuple from. + * * @exception java.lang.IllegalArgumentException - * if the array is empty (null) or contains null elements. + * if the array is empty (null) or contains null + * elements. */ public OtpErlangTuple(final OtpErlangObject[] elems) { - this(elems, 0, elems.length); + this(elems, 0, elems.length); } /** * Create a tuple from an array of terms. - * + * * @param elems - * the array of terms to create the tuple from. + * the array of terms to create the tuple from. * @param start - * the offset of the first term to insert. + * the offset of the first term to insert. * @param count - * the number of terms to insert. - * + * the number of terms to insert. + * * @exception java.lang.IllegalArgumentException - * if the array is empty (null) or contains null elements. + * if the array is empty (null) or contains null + * elements. */ public OtpErlangTuple(final OtpErlangObject[] elems, final int start, - final int count) { - if (elems == null) { - throw new java.lang.IllegalArgumentException( - "Tuple content can't be null"); - } else if (count < 1) { - this.elems = NO_ELEMENTS; - } else { - this.elems = new OtpErlangObject[count]; - for (int i = 0; i < count; i++) { - if (elems[start + i] != null) { - this.elems[i] = elems[start + i]; - } else { - throw new java.lang.IllegalArgumentException( - "Tuple element cannot be null (element" - + (start + i) + ")"); - } - } - } + final int count) { + if (elems == null) { + throw new java.lang.IllegalArgumentException( + "Tuple content can't be null"); + } else if (count < 1) { + this.elems = NO_ELEMENTS; + } else { + this.elems = new OtpErlangObject[count]; + for (int i = 0; i < count; i++) { + if (elems[start + i] != null) { + this.elems[i] = elems[start + i]; + } else { + throw new java.lang.IllegalArgumentException( + "Tuple element cannot be null (element" + + (start + i) + ")"); + } + } + } } /** * Create a tuple from a stream containing an tuple encoded in Erlang * external format. - * + * * @param buf - * the stream containing the encoded tuple. - * + * the stream containing the encoded tuple. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang tuple. + * if the buffer does not contain a valid external + * representation of an Erlang tuple. */ public OtpErlangTuple(final OtpInputStream buf) - throws OtpErlangDecodeException { - final int arity = buf.read_tuple_head(); + throws OtpErlangDecodeException { + final int arity = buf.read_tuple_head(); - if (arity > 0) { - elems = new OtpErlangObject[arity]; + if (arity > 0) { + elems = new OtpErlangObject[arity]; - for (int i = 0; i < arity; i++) { - elems[i] = buf.read_any(); - } - } else { - elems = NO_ELEMENTS; - } + for (int i = 0; i < arity; i++) { + elems[i] = buf.read_any(); + } + } else { + elems = NO_ELEMENTS; + } } /** * Get the arity of the tuple. - * + * * @return the number of elements contained in the tuple. */ public int arity() { - return elems.length; + return elems.length; } /** * Get the specified element from the tuple. - * + * * @param i - * the index of the requested element. Tuple elements are - * numbered as array elements, starting at 0. - * + * the index of the requested element. Tuple elements are + * numbered as array elements, starting at 0. + * * @return the requested element, of null if i is not a valid element index. */ public OtpErlangObject elementAt(final int i) { - if (i >= arity() || i < 0) { - return null; - } - return elems[i]; + if (i >= arity() || i < 0) { + return null; + } + return elems[i]; } /** * Get all the elements from the tuple as an array. - * + * * @return an array containing all of the tuple's elements. */ public OtpErlangObject[] elements() { - final OtpErlangObject[] res = new OtpErlangObject[arity()]; - System.arraycopy(elems, 0, res, 0, res.length); - return res; + final OtpErlangObject[] res = new OtpErlangObject[arity()]; + System.arraycopy(elems, 0, res, 0, res.length); + return res; } /** * Get the string representation of the tuple. - * + * * @return the string representation of the tuple. */ @Override public String toString() { - int i; - final StringBuffer s = new StringBuffer(); - final int arity = elems.length; - - s.append("{"); - - for (i = 0; i < arity; i++) { - if (i > 0) { - s.append(","); - } - s.append(elems[i].toString()); - } + int i; + final StringBuffer s = new StringBuffer(); + final int arity = elems.length; + + s.append("{"); + + for (i = 0; i < arity; i++) { + if (i > 0) { + s.append(","); + } + s.append(elems[i].toString()); + } - s.append("}"); + s.append("}"); - return s.toString(); + return s.toString(); } /** * Convert this tuple to the equivalent Erlang external representation. - * + * * @param buf - * an output stream to which the encoded tuple should be written. + * an output stream to which the encoded tuple should be + * written. */ @Override public void encode(final OtpOutputStream buf) { - final int arity = elems.length; + final int arity = elems.length; - buf.write_tuple_head(arity); + buf.write_tuple_head(arity); - for (int i = 0; i < arity; i++) { - buf.write_any(elems[i]); - } + for (int i = 0; i < arity; i++) { + buf.write_any(elems[i]); + } } /** * Determine if two tuples are equal. Tuples are equal if they have the same * arity and all of the elements are equal. - * + * * @param o - * the tuple to compare to. - * + * the tuple to compare to. + * * @return true if the tuples have the same arity and all the elements are * equal. */ @Override public boolean equals(final Object o) { - if (!(o instanceof OtpErlangTuple)) { - return false; - } - - final OtpErlangTuple t = (OtpErlangTuple) o; - final int a = arity(); - - if (a != t.arity()) { - return false; - } - - for (int i = 0; i < a; i++) { - if (!elems[i].equals(t.elems[i])) { - return false; // early exit - } - } - - return true; - } - - @Override - public boolean match(final OtpErlangObject term, final T bindings) { - if (!(term instanceof OtpErlangTuple)) { - return false; - } - final OtpErlangTuple t = (OtpErlangTuple) term; - final int a = elems.length; - if (a != t.elems.length) { - return false; - } - for (int i = 0; i < a; i++) { - if (!elems[i].match(t.elems[i], bindings)) { - return false; - } - } - return true; - } + if (!(o instanceof OtpErlangTuple)) { + return false; + } + + final OtpErlangTuple t = (OtpErlangTuple) o; + final int a = arity(); + + if (a != t.arity()) { + return false; + } + + for (int i = 0; i < a; i++) { + if (!elems[i].equals(t.elems[i])) { + return false; // early exit + } + } - @Override - public OtpErlangObject bind(final T binds) throws OtpErlangException { - final OtpErlangTuple tuple = (OtpErlangTuple) this.clone(); - final int a = tuple.elems.length; - for (int i = 0; i < a; i++) { - final OtpErlangObject e = tuple.elems[i]; - tuple.elems[i] = e.bind(binds); - } - return tuple; + return true; } - - @Override + protected int doHashCode() { - final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(9); - final int a = arity(); - hash.combine(a); - for (int i = 0; i < a; i++) { - hash.combine(elems[i].hashCode()); - } - return hash.valueOf(); + OtpErlangObject.Hash hash = new OtpErlangObject.Hash(9); + final int a = arity(); + hash.combine(a); + for (int i = 0; i < a; i++) { + hash.combine(elems[i].hashCode()); + } + return hash.valueOf(); } - + @Override public Object clone() { - final OtpErlangTuple newTuple = (OtpErlangTuple) super.clone(); - newTuple.elems = elems.clone(); - return newTuple; + final OtpErlangTuple newTuple = (OtpErlangTuple) super.clone(); + newTuple.elems = elems.clone(); + return newTuple; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangUInt.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangUInt.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangUInt.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangUInt.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,65 +1,67 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang integral types. */ -public class OtpErlangUInt extends OtpErlangLong { +public class OtpErlangUInt extends OtpErlangLong implements Serializable, + Cloneable { // don't change this! static final long serialVersionUID = -1450956122937471885L; /** * Create an Erlang integer from the given value. - * + * * @param i - * the non-negative int value to use. - * + * the non-negative int value to use. + * * @exception OtpErlangRangeException - * if the value is negative. + * if the value is negative. */ public OtpErlangUInt(final int i) throws OtpErlangRangeException { - super(i); + super(i); - uIntValue(); + final int j = uIntValue(); } /** * Create an Erlang integer from a stream containing an integer encoded in * Erlang external format. - * + * * @param buf - * the stream containing the encoded value. - * + * the stream containing the encoded value. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang integer. - * + * if the buffer does not contain a valid external + * representation of an Erlang integer. + * * @exception OtpErlangRangeException - * if the value is too large to be represented as an int, or - * the value is negative. + * if the value is too large to be represented as an int, + * or the value is negative. */ public OtpErlangUInt(final OtpInputStream buf) - throws OtpErlangRangeException, OtpErlangDecodeException { - super(buf); + throws OtpErlangRangeException, OtpErlangDecodeException { + super(buf); - uIntValue(); + final int j = uIntValue(); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangUShort.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangUShort.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangUShort.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangUShort.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,65 +1,67 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; +import java.io.Serializable; + /** * Provides a Java representation of Erlang integral types. */ -public class OtpErlangUShort extends OtpErlangLong { +public class OtpErlangUShort extends OtpErlangLong implements Serializable, + Cloneable { // don't change this! static final long serialVersionUID = 300370950578307246L; /** * Create an Erlang integer from the given value. - * + * * @param s - * the non-negative short value to use. - * + * the non-negative short value to use. + * * @exception OtpErlangRangeException - * if the value is negative. + * if the value is negative. */ public OtpErlangUShort(final short s) throws OtpErlangRangeException { - super(s); + super(s); - uShortValue(); + final short j = uShortValue(); } /** * Create an Erlang integer from a stream containing an integer encoded in * Erlang external format. - * + * * @param buf - * the stream containing the encoded value. - * + * the stream containing the encoded value. + * * @exception OtpErlangDecodeException - * if the buffer does not contain a valid external - * representation of an Erlang integer. - * + * if the buffer does not contain a valid external + * representation of an Erlang integer. + * * @exception OtpErlangRangeException - * if the value is too large to be represented as a short, or - * the value is negative. + * if the value is too large to be represented as a + * short, or the value is negative. */ public OtpErlangUShort(final OtpInputStream buf) - throws OtpErlangRangeException, OtpErlangDecodeException { - super(buf); + throws OtpErlangRangeException, OtpErlangDecodeException { + super(buf); - uShortValue(); + final short j = uShortValue(); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpException.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpException.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpException.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpException.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -23,19 +22,17 @@ * Base class for the other OTP exception classes. */ public abstract class OtpException extends Exception { - private static final long serialVersionUID = 1L; - /** * Provides no message. */ public OtpException() { - super(); + super(); } /** * Provides a detailed message. */ public OtpException(final String msg) { - super(msg); + super(msg); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpExternal.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpExternal.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpExternal.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpExternal.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2013. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2013. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -26,7 +25,7 @@ /** * Provides a stream for decoding Erlang terms from external format. - * + * *

    * Note that this class is not synchronized, if you need synchronization you * must provide it yourself. @@ -41,1214 +40,1213 @@ * @param buf */ public OtpInputStream(final byte[] buf) { - this(buf, 0); + this(buf, 0); } /** * Create a stream from a buffer containing encoded Erlang terms. - * + * * @param flags */ public OtpInputStream(final byte[] buf, final int flags) { - super(buf); - this.flags = flags; + super(buf); + this.flags = flags; } /** * Create a stream from a buffer containing encoded Erlang terms at the * given offset and length. - * + * * @param flags */ public OtpInputStream(final byte[] buf, final int offset, final int length, - final int flags) { - super(buf, offset, length); - this.flags = flags; + final int flags) { + super(buf, offset, length); + this.flags = flags; } /** * Get the current position in the stream. - * + * * @return the current position in the stream. */ public int getPos() { - return super.pos; + return super.pos; } /** * Set the current position in the stream. - * + * * @param pos * the position to move to in the stream. If pos indicates a * position beyond the end of the stream, the position is move to * the end of the stream instead. If pos is negative, the * position is moved to the beginning of the stream instead. - * + * * @return the previous position in the stream. */ - public int setPos(final int pos) { - final int oldpos = super.pos; + public int setPos(int pos) { + final int oldpos = super.pos; - int apos = pos; - if (pos > super.count) { - apos = super.count; - } else if (pos < 0) { - apos = 0; - } + if (pos > super.count) { + pos = super.count; + } else if (pos < 0) { + pos = 0; + } - super.pos = apos; + super.pos = pos; - return oldpos; + return oldpos; } /** * Read an array of bytes from the stream. The method reads at most * buf.length bytes from the input stream. - * + * * @return the number of bytes read. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ - public int readN(final byte[] abuf) throws OtpErlangDecodeException { - return this.readN(abuf, 0, abuf.length); + public int readN(final byte[] buf) throws OtpErlangDecodeException { + return this.readN(buf, 0, buf.length); } /** * Read an array of bytes from the stream. The method reads at most len * bytes from the input stream into offset off of the buffer. - * + * * @return the number of bytes read. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ - public int readN(final byte[] abuf, final int off, final int len) - throws OtpErlangDecodeException { - if (len == 0 && available() == 0) { - return 0; - } - final int i = super.read(abuf, off, len); - if (i < 0) { - throw new OtpErlangDecodeException("Cannot read from input stream"); - } - return i; + public int readN(final byte[] buf, final int off, final int len) + throws OtpErlangDecodeException { + if (len == 0 && available() == 0) { + return 0; + } + final int i = super.read(buf, off, len); + if (i < 0) { + throw new OtpErlangDecodeException("Cannot read from input stream"); + } + return i; } /** * Alias for peek1() */ public int peek() throws OtpErlangDecodeException { - return peek1(); + return peek1(); } /** * Look ahead one position in the stream without consuming the byte found * there. - * + * * @return the next byte in the stream, as an integer. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ public int peek1() throws OtpErlangDecodeException { - int i; - try { - i = super.buf[super.pos]; - if (i < 0) { - i += 256; - } - - return i; - } catch (final Exception e) { - throw new OtpErlangDecodeException("Cannot read from input stream"); - } + int i; + try { + i = super.buf[super.pos]; + if (i < 0) { + i += 256; + } + + return i; + } catch (final Exception e) { + throw new OtpErlangDecodeException("Cannot read from input stream"); + } } public int peek1skip_version() throws OtpErlangDecodeException { - int i = peek1(); - if (i == OtpExternal.versionTag) { - read1(); - i = peek1(); - } - return i; + int i = peek1(); + if (i == OtpExternal.versionTag) { + read1(); + i = peek1(); + } + return i; } /** * Read a one byte integer from the stream. - * + * * @return the byte read, as an integer. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ public int read1() throws OtpErlangDecodeException { - int i; - i = super.read(); + int i; + i = super.read(); - if (i < 0) { - throw new OtpErlangDecodeException("Cannot read from input stream"); - } + if (i < 0) { + throw new OtpErlangDecodeException("Cannot read from input stream"); + } - return i; + return i; } public int read1skip_version() throws OtpErlangDecodeException { - int tag = read1(); - if (tag == OtpExternal.versionTag) { - tag = read1(); - } - return tag; + int tag = read1(); + if (tag == OtpExternal.versionTag) { + tag = read1(); + } + return tag; } /** * Read a two byte big endian integer from the stream. - * + * * @return the bytes read, converted from big endian to an integer. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ public int read2BE() throws OtpErlangDecodeException { - final byte[] b = new byte[2]; - try { - super.read(b); - } catch (final IOException e) { - throw new OtpErlangDecodeException("Cannot read from input stream"); - } - return (b[0] << 8 & 0xff00) + (b[1] & 0xff); + final byte[] b = new byte[2]; + try { + super.read(b); + } catch (final IOException e) { + throw new OtpErlangDecodeException("Cannot read from input stream"); + } + ; + return (b[0] << 8 & 0xff00) + (b[1] & 0xff); } /** * Read a four byte big endian integer from the stream. - * + * * @return the bytes read, converted from big endian to an integer. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ public int read4BE() throws OtpErlangDecodeException { - final byte[] b = new byte[4]; - try { - super.read(b); - } catch (final IOException e) { - throw new OtpErlangDecodeException("Cannot read from input stream"); - } - return (b[0] << 24 & 0xff000000) + (b[1] << 16 & 0xff0000) - + (b[2] << 8 & 0xff00) + (b[3] & 0xff); + final byte[] b = new byte[4]; + try { + super.read(b); + } catch (final IOException e) { + throw new OtpErlangDecodeException("Cannot read from input stream"); + } + ; + return (b[0] << 24 & 0xff000000) + (b[1] << 16 & 0xff0000) + + (b[2] << 8 & 0xff00) + (b[3] & 0xff); } /** * Read a two byte little endian integer from the stream. - * + * * @return the bytes read, converted from little endian to an integer. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ public int read2LE() throws OtpErlangDecodeException { - final byte[] b = new byte[2]; - try { - super.read(b); - } catch (final IOException e) { - throw new OtpErlangDecodeException("Cannot read from input stream"); - } - return (b[1] << 8 & 0xff00) + (b[0] & 0xff); + final byte[] b = new byte[2]; + try { + super.read(b); + } catch (final IOException e) { + throw new OtpErlangDecodeException("Cannot read from input stream"); + } + ; + return (b[1] << 8 & 0xff00) + (b[0] & 0xff); } /** * Read a four byte little endian integer from the stream. - * + * * @return the bytes read, converted from little endian to an integer. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ public int read4LE() throws OtpErlangDecodeException { - final byte[] b = new byte[4]; - try { - super.read(b); - } catch (final IOException e) { - throw new OtpErlangDecodeException("Cannot read from input stream"); - } - return (b[3] << 24 & 0xff000000) + (b[2] << 16 & 0xff0000) - + (b[1] << 8 & 0xff00) + (b[0] & 0xff); + final byte[] b = new byte[4]; + try { + super.read(b); + } catch (final IOException e) { + throw new OtpErlangDecodeException("Cannot read from input stream"); + } + ; + return (b[3] << 24 & 0xff000000) + (b[2] << 16 & 0xff0000) + + (b[1] << 8 & 0xff00) + (b[0] & 0xff); } /** * Read a little endian integer from the stream. - * + * * @param n * the number of bytes to read - * + * * @return the bytes read, converted from little endian to an integer. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ - public long readLE(final int n) throws OtpErlangDecodeException { - final byte[] b = new byte[n]; - try { - super.read(b); - } catch (final IOException e) { - throw new OtpErlangDecodeException("Cannot read from input stream"); - } - long v = 0; - int i = n; - while (i-- > 0) { - v = v << 8 | (long) b[i] & 0xff; - } - return v; + public long readLE(int n) throws OtpErlangDecodeException { + final byte[] b = new byte[n]; + try { + super.read(b); + } catch (final IOException e) { + throw new OtpErlangDecodeException("Cannot read from input stream"); + } + ; + long v = 0; + while (n-- > 0) { + v = v << 8 | (long) b[n] & 0xff; + } + return v; } /** * Read a bigendian integer from the stream. - * + * * @param n * the number of bytes to read - * + * * @return the bytes read, converted from big endian to an integer. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ public long readBE(final int n) throws OtpErlangDecodeException { - final byte[] b = new byte[n]; - try { - super.read(b); - } catch (final IOException e) { - throw new OtpErlangDecodeException("Cannot read from input stream"); - } - long v = 0; - for (int i = 0; i < n; i++) { - v = v << 8 | (long) b[i] & 0xff; - } - return v; + final byte[] b = new byte[n]; + try { + super.read(b); + } catch (final IOException e) { + throw new OtpErlangDecodeException("Cannot read from input stream"); + } + ; + long v = 0; + for (int i = 0; i < n; i++) { + v = v << 8 | (long) b[i] & 0xff; + } + return v; } /** * Read an Erlang atom from the stream and interpret the value as a boolean. - * + * * @return true if the atom at the current position in the stream contains * the value 'true' (ignoring case), false otherwise. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not an atom. */ public boolean read_boolean() throws OtpErlangDecodeException { - return Boolean.valueOf(read_atom()).booleanValue(); + return Boolean.valueOf(read_atom()).booleanValue(); } /** * Read an Erlang atom from the stream. - * + * * @return a String containing the value of the atom. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not an atom. */ - @SuppressWarnings("fallthrough") public String read_atom() throws OtpErlangDecodeException { - int tag; - int len = -1; - byte[] strbuf; - String atom; - - tag = read1skip_version(); - - switch (tag) { - - case OtpExternal.atomTag: - len = read2BE(); - strbuf = new byte[len]; - this.readN(strbuf); - try { - atom = new String(strbuf, "ISO-8859-1"); - } catch (final java.io.UnsupportedEncodingException e) { - throw new OtpErlangDecodeException( - "Failed to decode ISO-8859-1 atom"); - } - if (atom.length() > OtpExternal.maxAtomLength) { - /* - * Throwing an exception would be better I think, but truncation - * seems to be the way it has been done in other parts of OTP... - */ - atom = atom.substring(0, OtpExternal.maxAtomLength); - } - break; - - case OtpExternal.smallAtomUtf8Tag: - len = read1(); - // fall-through - case OtpExternal.atomUtf8Tag: - if (len < 0) { - len = read2BE(); - } - strbuf = new byte[len]; - this.readN(strbuf); - try { - atom = new String(strbuf, "UTF-8"); - } catch (final java.io.UnsupportedEncodingException e) { - throw new OtpErlangDecodeException( - "Failed to decode UTF-8 atom"); - } - if (atom.codePointCount(0, atom.length()) > OtpExternal.maxAtomLength) { - /* - * Throwing an exception would be better I think, but truncation - * seems to be the way it has been done in other parts of OTP... - */ - final int[] cps = OtpErlangString.stringToCodePoints(atom); - atom = new String(cps, 0, OtpExternal.maxAtomLength); - } - break; - - default: - throw new OtpErlangDecodeException( - "wrong tag encountered, expected " + OtpExternal.atomTag - + ", or " + OtpExternal.atomUtf8Tag + ", got " - + tag); - } + int tag; + int len = -1; + byte[] strbuf; + String atom; + + tag = read1skip_version(); + + switch (tag) { + + case OtpExternal.atomTag: + len = read2BE(); + strbuf = new byte[len]; + this.readN(strbuf); + try { + atom = new String(strbuf, "ISO-8859-1"); + } catch (final java.io.UnsupportedEncodingException e) { + throw new OtpErlangDecodeException( + "Failed to decode ISO-8859-1 atom"); + } + if (atom.length() > OtpExternal.maxAtomLength) { + /* + * Throwing an exception would be better I think, + * but truncation seems to be the way it has + * been done in other parts of OTP... + */ + atom = atom.substring(0, OtpExternal.maxAtomLength); + } + break; + + case OtpExternal.smallAtomUtf8Tag: + len = read1(); + /* fall through */ + case OtpExternal.atomUtf8Tag: + if (len < 0) { + len = read2BE(); + } + strbuf = new byte[len]; + this.readN(strbuf); + try { + atom = new String(strbuf, "UTF-8"); + } catch (final java.io.UnsupportedEncodingException e) { + throw new OtpErlangDecodeException( + "Failed to decode UTF-8 atom"); + } + if (atom.codePointCount(0, atom.length()) > OtpExternal.maxAtomLength) { + /* + * Throwing an exception would be better I think, + * but truncation seems to be the way it has + * been done in other parts of OTP... + */ + final int[] cps = OtpErlangString.stringToCodePoints(atom); + atom = new String(cps, 0, OtpExternal.maxAtomLength); + } + break; + + default: + throw new OtpErlangDecodeException( + "wrong tag encountered, expected " + OtpExternal.atomTag + + ", or " + OtpExternal.atomUtf8Tag + ", got " + tag); + } - return atom; + return atom; } /** * Read an Erlang binary from the stream. - * + * * @return a byte array containing the value of the binary. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not a binary. */ public byte[] read_binary() throws OtpErlangDecodeException { - int tag; - int len; - byte[] bin; + int tag; + int len; + byte[] bin; - tag = read1skip_version(); + tag = read1skip_version(); - if (tag != OtpExternal.binTag) { - throw new OtpErlangDecodeException( - "Wrong tag encountered, expected " + OtpExternal.binTag - + ", got " + tag); - } + if (tag != OtpExternal.binTag) { + throw new OtpErlangDecodeException( + "Wrong tag encountered, expected " + OtpExternal.binTag + + ", got " + tag); + } - len = read4BE(); + len = read4BE(); - bin = new byte[len]; - this.readN(bin); + bin = new byte[len]; + this.readN(bin); - return bin; + return bin; } /** * Read an Erlang bitstr from the stream. - * + * * @param pad_bits * an int array whose first element will be set to the number of * pad bits in the last byte. - * + * * @return a byte array containing the value of the bitstr. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not a bitstr. */ public byte[] read_bitstr(final int pad_bits[]) - throws OtpErlangDecodeException { - int tag; - int len; - byte[] bin; - - tag = read1skip_version(); - - if (tag != OtpExternal.bitBinTag) { - throw new OtpErlangDecodeException( - "Wrong tag encountered, expected " + OtpExternal.bitBinTag - + ", got " + tag); - } - - len = read4BE(); - bin = new byte[len]; - final int tail_bits = read1(); - if (tail_bits < 0 || 7 < tail_bits) { - throw new OtpErlangDecodeException( - "Wrong tail bit count in bitstr: " + tail_bits); - } - if (len == 0 && tail_bits != 0) { - throw new OtpErlangDecodeException( - "Length 0 on bitstr with tail bit count: " + tail_bits); - } - this.readN(bin); + throws OtpErlangDecodeException { + int tag; + int len; + byte[] bin; + + tag = read1skip_version(); + + if (tag != OtpExternal.bitBinTag) { + throw new OtpErlangDecodeException( + "Wrong tag encountered, expected " + OtpExternal.bitBinTag + + ", got " + tag); + } + + len = read4BE(); + bin = new byte[len]; + final int tail_bits = read1(); + if (tail_bits < 0 || 7 < tail_bits) { + throw new OtpErlangDecodeException( + "Wrong tail bit count in bitstr: " + tail_bits); + } + if (len == 0 && tail_bits != 0) { + throw new OtpErlangDecodeException( + "Length 0 on bitstr with tail bit count: " + tail_bits); + } + this.readN(bin); - pad_bits[0] = 8 - tail_bits; - return bin; + pad_bits[0] = 8 - tail_bits; + return bin; } /** * Read an Erlang float from the stream. - * + * * @return the float value. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not a float. */ public float read_float() throws OtpErlangDecodeException { - final double d = read_double(); - return (float) d; + final double d = read_double(); + return (float) d; } /** * Read an Erlang float from the stream. - * + * * @return the float value, as a double. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not a float. */ public double read_double() throws OtpErlangDecodeException { - int tag; + int tag; - // parse the stream - tag = read1skip_version(); + // parse the stream + tag = read1skip_version(); - switch (tag) { - case OtpExternal.newFloatTag: { - return Double.longBitsToDouble(readBE(8)); - } - case OtpExternal.floatTag: { - BigDecimal val; - int epos; - int exp; - final byte[] strbuf = new byte[31]; - String str; - - // get the string - this.readN(strbuf); - str = OtpErlangString.newString(strbuf); - - // find the exponent prefix 'e' in the string - epos = str.indexOf('e', 0); - - if (epos < 0) { - throw new OtpErlangDecodeException("Invalid float format: '" - + str + "'"); - } - - // remove the sign from the exponent, if positive - String estr = str.substring(epos + 1).trim(); - - if (estr.substring(0, 1).equals("+")) { - estr = estr.substring(1); - } - - // now put the mantissa and exponent together - exp = Integer.valueOf(estr).intValue(); - val = new BigDecimal(str.substring(0, epos)).movePointRight(exp); - - return val.doubleValue(); - } - default: - throw new OtpErlangDecodeException( - "Wrong tag encountered, expected " - + OtpExternal.newFloatTag + ", got " + tag); - } + switch (tag) { + case OtpExternal.newFloatTag: { + return Double.longBitsToDouble(readBE(8)); + } + case OtpExternal.floatTag: { + BigDecimal val; + int epos; + int exp; + final byte[] strbuf = new byte[31]; + String str; + + // get the string + this.readN(strbuf); + str = OtpErlangString.newString(strbuf); + + // find the exponent prefix 'e' in the string + epos = str.indexOf('e', 0); + + if (epos < 0) { + throw new OtpErlangDecodeException("Invalid float format: '" + + str + "'"); + } + + // remove the sign from the exponent, if positive + String estr = str.substring(epos + 1).trim(); + + if (estr.substring(0, 1).equals("+")) { + estr = estr.substring(1); + } + + // now put the mantissa and exponent together + exp = Integer.valueOf(estr).intValue(); + val = new BigDecimal(str.substring(0, epos)).movePointRight(exp); + + return val.doubleValue(); + } + default: + throw new OtpErlangDecodeException( + "Wrong tag encountered, expected " + + OtpExternal.newFloatTag + ", got " + tag); + } } /** * Read one byte from the stream. - * + * * @return the byte read. - * + * * @exception OtpErlangDecodeException * if the next byte cannot be read. */ public byte read_byte() throws OtpErlangDecodeException { - final long l = this.read_long(false); - final byte i = (byte) l; + final long l = this.read_long(false); + final byte i = (byte) l; - if (l != i) { - throw new OtpErlangDecodeException("Value does not fit in byte: " - + l); - } + if (l != i) { + throw new OtpErlangDecodeException("Value does not fit in byte: " + + l); + } - return i; + return i; } /** * Read a character from the stream. - * + * * @return the character value. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not an integer that can * be represented as a char. */ public char read_char() throws OtpErlangDecodeException { - final long l = this.read_long(true); - final char i = (char) l; + final long l = this.read_long(true); + final char i = (char) l; - if (l != (i & 0xffffL)) { - throw new OtpErlangDecodeException("Value does not fit in char: " - + l); - } + if (l != (i & 0xffffL)) { + throw new OtpErlangDecodeException("Value does not fit in char: " + + l); + } - return i; + return i; } /** * Read an unsigned integer from the stream. - * + * * @return the integer value. - * + * * @exception OtpErlangDecodeException * if the next term in the stream can not be represented as a * positive integer. */ public int read_uint() throws OtpErlangDecodeException { - final long l = this.read_long(true); - final int i = (int) l; + final long l = this.read_long(true); + final int i = (int) l; - if (l != (i & 0xFFFFffffL)) { - throw new OtpErlangDecodeException("Value does not fit in uint: " - + l); - } + if (l != (i & 0xFFFFffffL)) { + throw new OtpErlangDecodeException("Value does not fit in uint: " + + l); + } - return i; + return i; } /** * Read an integer from the stream. - * + * * @return the integer value. - * + * * @exception OtpErlangDecodeException * if the next term in the stream can not be represented as * an integer. */ public int read_int() throws OtpErlangDecodeException { - final long l = this.read_long(false); - final int i = (int) l; + final long l = this.read_long(false); + final int i = (int) l; - if (l != i) { - throw new OtpErlangDecodeException("Value does not fit in int: " - + l); - } + if (l != i) { + throw new OtpErlangDecodeException("Value does not fit in int: " + + l); + } - return i; + return i; } /** * Read an unsigned short from the stream. - * + * * @return the short value. - * + * * @exception OtpErlangDecodeException * if the next term in the stream can not be represented as a * positive short. */ public short read_ushort() throws OtpErlangDecodeException { - final long l = this.read_long(true); - final short i = (short) l; + final long l = this.read_long(true); + final short i = (short) l; - if (l != (i & 0xffffL)) { - throw new OtpErlangDecodeException("Value does not fit in ushort: " - + l); - } + if (l != (i & 0xffffL)) { + throw new OtpErlangDecodeException("Value does not fit in ushort: " + + l); + } - return i; + return i; } /** * Read a short from the stream. - * + * * @return the short value. - * + * * @exception OtpErlangDecodeException * if the next term in the stream can not be represented as a * short. */ public short read_short() throws OtpErlangDecodeException { - final long l = this.read_long(false); - final short i = (short) l; + final long l = this.read_long(false); + final short i = (short) l; - if (l != i) { - throw new OtpErlangDecodeException("Value does not fit in short: " - + l); - } + if (l != i) { + throw new OtpErlangDecodeException("Value does not fit in short: " + + l); + } - return i; + return i; } /** * Read an unsigned long from the stream. - * + * * @return the long value. - * + * * @exception OtpErlangDecodeException * if the next term in the stream can not be represented as a * positive long. */ public long read_ulong() throws OtpErlangDecodeException { - return this.read_long(true); + return this.read_long(true); } /** * Read a long from the stream. - * + * * @return the long value. - * + * * @exception OtpErlangDecodeException * if the next term in the stream can not be represented as a * long. */ public long read_long() throws OtpErlangDecodeException { - return this.read_long(false); + return this.read_long(false); } public long read_long(final boolean unsigned) - throws OtpErlangDecodeException { - final byte[] b = read_integer_byte_array(); - return OtpInputStream.byte_array_to_long(b, unsigned); + throws OtpErlangDecodeException { + final byte[] b = read_integer_byte_array(); + return OtpInputStream.byte_array_to_long(b, unsigned); } /** * Read an integer from the stream. - * + * * @return the value as a big endian 2's complement byte array. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not an integer. */ public byte[] read_integer_byte_array() throws OtpErlangDecodeException { - int tag; - byte[] nb; + int tag; + byte[] nb; - tag = read1skip_version(); + tag = read1skip_version(); - switch (tag) { - case OtpExternal.smallIntTag: - nb = new byte[2]; - nb[0] = 0; - nb[1] = (byte) read1(); - break; - - case OtpExternal.intTag: - nb = new byte[4]; - if (this.readN(nb) != 4) { // Big endian - throw new OtpErlangDecodeException( - "Cannot read from intput stream"); - } - break; - - case OtpExternal.smallBigTag: - case OtpExternal.largeBigTag: - int arity; - int sign; - if (tag == OtpExternal.smallBigTag) { - arity = read1(); - sign = read1(); - } else { - arity = read4BE(); - sign = read1(); - if (arity + 1 < 0) { - throw new OtpErlangDecodeException( - "Value of largeBig does not fit in BigInteger, arity " - + arity + " sign " + sign); - } - } - nb = new byte[arity + 1]; - // Value is read as little endian. The big end is augumented - // with one zero byte to make the value 2's complement positive. - if (this.readN(nb, 0, arity) != arity) { - throw new OtpErlangDecodeException( - "Cannot read from intput stream"); - } - // Reverse the array to make it big endian. - for (int i = 0, j = nb.length; i < j--; i++) { - // Swap [i] with [j] - final byte b = nb[i]; - nb[i] = nb[j]; - nb[j] = b; - } - if (sign != 0) { - // 2's complement negate the big endian value in the array - int c = 1; // Carry - for (int j = nb.length; j-- > 0;) { - c = (~nb[j] & 0xFF) + c; - nb[j] = (byte) c; - c >>= 8; - } - } - break; - - default: - throw new OtpErlangDecodeException("Not valid integer tag: " + tag); - } + switch (tag) { + case OtpExternal.smallIntTag: + nb = new byte[2]; + nb[0] = 0; + nb[1] = (byte) read1(); + break; + + case OtpExternal.intTag: + nb = new byte[4]; + if (this.readN(nb) != 4) { // Big endian + throw new OtpErlangDecodeException( + "Cannot read from intput stream"); + } + break; + + case OtpExternal.smallBigTag: + case OtpExternal.largeBigTag: + int arity; + int sign; + if (tag == OtpExternal.smallBigTag) { + arity = read1(); + sign = read1(); + } else { + arity = read4BE(); + sign = read1(); + if (arity + 1 < 0) { + throw new OtpErlangDecodeException( + "Value of largeBig does not fit in BigInteger, arity " + + arity + " sign " + sign); + } + } + nb = new byte[arity + 1]; + // Value is read as little endian. The big end is augumented + // with one zero byte to make the value 2's complement positive. + if (this.readN(nb, 0, arity) != arity) { + throw new OtpErlangDecodeException( + "Cannot read from intput stream"); + } + // Reverse the array to make it big endian. + for (int i = 0, j = nb.length; i < j--; i++) { + // Swap [i] with [j] + final byte b = nb[i]; + nb[i] = nb[j]; + nb[j] = b; + } + if (sign != 0) { + // 2's complement negate the big endian value in the array + int c = 1; // Carry + for (int j = nb.length; j-- > 0;) { + c = (~nb[j] & 0xFF) + c; + nb[j] = (byte) c; + c >>= 8; + } + } + break; + + default: + throw new OtpErlangDecodeException("Not valid integer tag: " + tag); + } - return nb; + return nb; } public static long byte_array_to_long(final byte[] b, final boolean unsigned) - throws OtpErlangDecodeException { - long v; - switch (b.length) { - case 0: - v = 0; - break; - case 2: - v = ((b[0] & 0xFF) << 8) + (b[1] & 0xFF); - v = (short) v; // Sign extend - if (v < 0 && unsigned) { - throw new OtpErlangDecodeException("Value not unsigned: " + v); - } - break; - case 4: - v = ((b[0] & 0xFF) << 24) + ((b[1] & 0xFF) << 16) - + ((b[2] & 0xFF) << 8) + (b[3] & 0xFF); - v = (int) v; // Sign extend - if (v < 0 && unsigned) { - throw new OtpErlangDecodeException("Value not unsigned: " + v); - } - break; - default: - int i = 0; - final byte c = b[i]; - // Skip non-essential leading bytes - if (unsigned) { - if (c < 0) { - throw new OtpErlangDecodeException("Value not unsigned: " - + Arrays.toString(b)); - } - while (b[i] == 0) { - i++; // Skip leading zero sign bytes - } - } else { - if (c == 0 || c == -1) { // Leading sign byte - i = 1; - // Skip all leading sign bytes - while (i < b.length && b[i] == c) { - i++; - } - if (i < b.length) { - // Check first non-sign byte to see if its sign - // matches the whole number's sign. If not one more - // byte is needed to represent the value. - if (((c ^ b[i]) & 0x80) != 0) { - i--; - } - } - } - } - if (b.length - i > 8) { - // More than 64 bits of value - throw new OtpErlangDecodeException( - "Value does not fit in long: " + Arrays.toString(b)); - } - // Convert the necessary bytes - for (v = c < 0 ? -1 : 0; i < b.length; i++) { - v = v << 8 | b[i] & 0xFF; - } - } - return v; + throws OtpErlangDecodeException { + long v; + switch (b.length) { + case 0: + v = 0; + break; + case 2: + v = ((b[0] & 0xFF) << 8) + (b[1] & 0xFF); + v = (short) v; // Sign extend + if (v < 0 && unsigned) { + throw new OtpErlangDecodeException("Value not unsigned: " + v); + } + break; + case 4: + v = ((b[0] & 0xFF) << 24) + ((b[1] & 0xFF) << 16) + + ((b[2] & 0xFF) << 8) + (b[3] & 0xFF); + v = (int) v; // Sign extend + if (v < 0 && unsigned) { + throw new OtpErlangDecodeException("Value not unsigned: " + v); + } + break; + default: + int i = 0; + final byte c = b[i]; + // Skip non-essential leading bytes + if (unsigned) { + if (c < 0) { + throw new OtpErlangDecodeException("Value not unsigned: " + + Arrays.toString(b)); + } + while (b[i] == 0) { + i++; // Skip leading zero sign bytes + } + } else { + if (c == 0 || c == -1) { // Leading sign byte + i = 1; + // Skip all leading sign bytes + while (i < b.length && b[i] == c) { + i++; + } + if (i < b.length) { + // Check first non-sign byte to see if its sign + // matches the whole number's sign. If not one more + // byte is needed to represent the value. + if (((c ^ b[i]) & 0x80) != 0) { + i--; + } + } + } + } + if (b.length - i > 8) { + // More than 64 bits of value + throw new OtpErlangDecodeException( + "Value does not fit in long: " + Arrays.toString(b)); + } + // Convert the necessary bytes + for (v = c < 0 ? -1 : 0; i < b.length; i++) { + v = v << 8 | b[i] & 0xFF; + } + } + return v; } /** * Read a list header from the stream. - * + * * @return the arity of the list. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not a list. */ public int read_list_head() throws OtpErlangDecodeException { - int arity = 0; - final int tag = read1skip_version(); + int arity = 0; + final int tag = read1skip_version(); - switch (tag) { - case OtpExternal.nilTag: - arity = 0; - break; - - case OtpExternal.stringTag: - arity = read2BE(); - break; - - case OtpExternal.listTag: - arity = read4BE(); - break; - - default: - throw new OtpErlangDecodeException("Not valid list tag: " + tag); - } + switch (tag) { + case OtpExternal.nilTag: + arity = 0; + break; + + case OtpExternal.stringTag: + arity = read2BE(); + break; + + case OtpExternal.listTag: + arity = read4BE(); + break; + + default: + throw new OtpErlangDecodeException("Not valid list tag: " + tag); + } - return arity; + return arity; } /** * Read a tuple header from the stream. - * + * * @return the arity of the tuple. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not a tuple. */ public int read_tuple_head() throws OtpErlangDecodeException { - int arity = 0; - final int tag = read1skip_version(); + int arity = 0; + final int tag = read1skip_version(); - // decode the tuple header and get arity - switch (tag) { - case OtpExternal.smallTupleTag: - arity = read1(); - break; - - case OtpExternal.largeTupleTag: - arity = read4BE(); - break; - - default: - throw new OtpErlangDecodeException("Not valid tuple tag: " + tag); - } + // decode the tuple header and get arity + switch (tag) { + case OtpExternal.smallTupleTag: + arity = read1(); + break; + + case OtpExternal.largeTupleTag: + arity = read4BE(); + break; + + default: + throw new OtpErlangDecodeException("Not valid tuple tag: " + tag); + } - return arity; + return arity; } /** * Read an empty list from the stream. - * + * * @return zero (the arity of the list). - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not an empty list. */ public int read_nil() throws OtpErlangDecodeException { - int arity = 0; - final int tag = read1skip_version(); + int arity = 0; + final int tag = read1skip_version(); - switch (tag) { - case OtpExternal.nilTag: - arity = 0; - break; - - default: - throw new OtpErlangDecodeException("Not valid nil tag: " + tag); - } + switch (tag) { + case OtpExternal.nilTag: + arity = 0; + break; + + default: + throw new OtpErlangDecodeException("Not valid nil tag: " + tag); + } - return arity; + return arity; } /** * Read an Erlang PID from the stream. - * + * * @return the value of the PID. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not an Erlang PID. */ public OtpErlangPid read_pid() throws OtpErlangDecodeException { - String node; - int id; - int serial; - int creation; - int tag; - - tag = read1skip_version(); - - if (tag != OtpExternal.pidTag) { - throw new OtpErlangDecodeException( - "Wrong tag encountered, expected " + OtpExternal.pidTag - + ", got " + tag); - } - - node = read_atom(); - id = read4BE() & 0x7fff; // 15 bits - serial = read4BE() & 0x1fff; // 13 bits - creation = read1() & 0x03; // 2 bits + String node; + int id; + int serial; + int creation; + int tag; + + tag = read1skip_version(); + + if (tag != OtpExternal.pidTag) { + throw new OtpErlangDecodeException( + "Wrong tag encountered, expected " + OtpExternal.pidTag + + ", got " + tag); + } + + node = read_atom(); + id = read4BE() & 0x7fff; // 15 bits + serial = read4BE() & 0x1fff; // 13 bits + creation = read1() & 0x03; // 2 bits - return new OtpErlangPid(node, id, serial, creation); + return new OtpErlangPid(node, id, serial, creation); } /** * Read an Erlang port from the stream. - * + * * @return the value of the port. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not an Erlang port. */ public OtpErlangPort read_port() throws OtpErlangDecodeException { - String node; - int id; - int creation; - int tag; - - tag = read1skip_version(); - - if (tag != OtpExternal.portTag) { - throw new OtpErlangDecodeException( - "Wrong tag encountered, expected " + OtpExternal.portTag - + ", got " + tag); - } - - node = read_atom(); - id = read4BE() & 0xfffffff; // 28 bits - creation = read1() & 0x03; // 2 bits + String node; + int id; + int creation; + int tag; + + tag = read1skip_version(); + + if (tag != OtpExternal.portTag) { + throw new OtpErlangDecodeException( + "Wrong tag encountered, expected " + OtpExternal.portTag + + ", got " + tag); + } + + node = read_atom(); + id = read4BE() & 0xfffffff; // 28 bits + creation = read1() & 0x03; // 2 bits - return new OtpErlangPort(node, id, creation); + return new OtpErlangPort(node, id, creation); } /** * Read an Erlang reference from the stream. - * + * * @return the value of the reference - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not an Erlang reference. */ public OtpErlangRef read_ref() throws OtpErlangDecodeException { - String node; - int id; - int creation; - int tag; - - tag = read1skip_version(); - - switch (tag) { - case OtpExternal.refTag: - node = read_atom(); - id = read4BE() & 0x3ffff; // 18 bits - creation = read1() & 0x03; // 2 bits - return new OtpErlangRef(node, id, creation); - - case OtpExternal.newRefTag: - final int arity = read2BE(); - node = read_atom(); - creation = read1() & 0x03; // 2 bits - - final int[] ids = new int[arity]; - for (int i = 0; i < arity; i++) { - ids[i] = read4BE(); - } - ids[0] &= 0x3ffff; // first id gets truncated to 18 bits - return new OtpErlangRef(node, ids, creation); - - default: - throw new OtpErlangDecodeException( - "Wrong tag encountered, expected ref, got " + tag); - } + String node; + int id; + int creation; + int tag; + + tag = read1skip_version(); + + switch (tag) { + case OtpExternal.refTag: + node = read_atom(); + id = read4BE() & 0x3ffff; // 18 bits + creation = read1() & 0x03; // 2 bits + return new OtpErlangRef(node, id, creation); + + case OtpExternal.newRefTag: + final int arity = read2BE(); + node = read_atom(); + creation = read1() & 0x03; // 2 bits + + final int[] ids = new int[arity]; + for (int i = 0; i < arity; i++) { + ids[i] = read4BE(); + } + ids[0] &= 0x3ffff; // first id gets truncated to 18 bits + return new OtpErlangRef(node, ids, creation); + + default: + throw new OtpErlangDecodeException( + "Wrong tag encountered, expected ref, got " + tag); + } } public OtpErlangFun read_fun() throws OtpErlangDecodeException { - final int tag = read1skip_version(); - if (tag == OtpExternal.funTag) { - final int nFreeVars = read4BE(); - final OtpErlangPid pid = read_pid(); - final String module = read_atom(); - final long index = read_long(); - final long uniq = read_long(); - final OtpErlangObject[] freeVars = new OtpErlangObject[nFreeVars]; - for (int i = 0; i < nFreeVars; ++i) { - freeVars[i] = read_any(); - } - return new OtpErlangFun(pid, module, index, uniq, freeVars); - } else if (tag == OtpExternal.newFunTag) { - read4BE(); - final int arity = read1(); - final byte[] md5 = new byte[16]; - readN(md5); - final int index = read4BE(); - final int nFreeVars = read4BE(); - final String module = read_atom(); - final long oldIndex = read_long(); - final long uniq = read_long(); - final OtpErlangPid pid = read_pid(); - final OtpErlangObject[] freeVars = new OtpErlangObject[nFreeVars]; - for (int i = 0; i < nFreeVars; ++i) { - freeVars[i] = read_any(); - } - return new OtpErlangFun(pid, module, arity, md5, index, oldIndex, - uniq, freeVars); - } else { - throw new OtpErlangDecodeException( - "Wrong tag encountered, expected fun, got " + tag); - } + final int tag = read1skip_version(); + if (tag == OtpExternal.funTag) { + final int nFreeVars = read4BE(); + final OtpErlangPid pid = read_pid(); + final String module = read_atom(); + final long index = read_long(); + final long uniq = read_long(); + final OtpErlangObject[] freeVars = new OtpErlangObject[nFreeVars]; + for (int i = 0; i < nFreeVars; ++i) { + freeVars[i] = read_any(); + } + return new OtpErlangFun(pid, module, index, uniq, freeVars); + } else if (tag == OtpExternal.newFunTag) { + final int n = read4BE(); + final int arity = read1(); + final byte[] md5 = new byte[16]; + readN(md5); + final int index = read4BE(); + final int nFreeVars = read4BE(); + final String module = read_atom(); + final long oldIndex = read_long(); + final long uniq = read_long(); + final OtpErlangPid pid = read_pid(); + final OtpErlangObject[] freeVars = new OtpErlangObject[nFreeVars]; + for (int i = 0; i < nFreeVars; ++i) { + freeVars[i] = read_any(); + } + return new OtpErlangFun(pid, module, arity, md5, index, oldIndex, + uniq, freeVars); + } else { + throw new OtpErlangDecodeException( + "Wrong tag encountered, expected fun, got " + tag); + } } public OtpErlangExternalFun read_external_fun() - throws OtpErlangDecodeException { - final int tag = read1skip_version(); - if (tag != OtpExternal.externalFunTag) { - throw new OtpErlangDecodeException( - "Wrong tag encountered, expected external fun, got " + tag); - } - final String module = read_atom(); - final String function = read_atom(); - final int arity = (int) read_long(); - return new OtpErlangExternalFun(module, function, arity); + throws OtpErlangDecodeException { + final int tag = read1skip_version(); + if (tag != OtpExternal.externalFunTag) { + throw new OtpErlangDecodeException( + "Wrong tag encountered, expected external fun, got " + tag); + } + final String module = read_atom(); + final String function = read_atom(); + final int arity = (int) read_long(); + return new OtpErlangExternalFun(module, function, arity); } /** * Read a string from the stream. - * + * * @return the value of the string. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not a string. */ public String read_string() throws OtpErlangDecodeException { - int tag; - int len; - byte[] strbuf; - int[] intbuf; - tag = read1skip_version(); - switch (tag) { - case OtpExternal.stringTag: - len = read2BE(); - strbuf = new byte[len]; - this.readN(strbuf); - return OtpErlangString.newString(strbuf); - case OtpExternal.nilTag: - return ""; - case OtpExternal.listTag: // List when unicode + - len = read4BE(); - intbuf = new int[len]; - for (int i = 0; i < len; i++) { - intbuf[i] = read_int(); - if (!OtpErlangString.isValidCodePoint(intbuf[i])) { - throw new OtpErlangDecodeException("Invalid CodePoint: " - + intbuf[i]); - } - } - read_nil(); - return new String(intbuf, 0, intbuf.length); - default: - throw new OtpErlangDecodeException( - "Wrong tag encountered, expected " + OtpExternal.stringTag - + " or " + OtpExternal.listTag + ", got " + tag); - } + int tag; + int len; + byte[] strbuf; + int[] intbuf; + tag = read1skip_version(); + switch (tag) { + case OtpExternal.stringTag: + len = read2BE(); + strbuf = new byte[len]; + this.readN(strbuf); + return OtpErlangString.newString(strbuf); + case OtpExternal.nilTag: + return ""; + case OtpExternal.listTag: // List when unicode + + len = read4BE(); + intbuf = new int[len]; + for (int i = 0; i < len; i++) { + intbuf[i] = read_int(); + if (! OtpErlangString.isValidCodePoint(intbuf[i])) { + throw new OtpErlangDecodeException + ("Invalid CodePoint: " + intbuf[i]); + } + } + read_nil(); + return new String(intbuf, 0, intbuf.length); + default: + throw new OtpErlangDecodeException( + "Wrong tag encountered, expected " + OtpExternal.stringTag + + " or " + OtpExternal.listTag + ", got " + tag); + } } /** * Read a compressed term from the stream - * + * * @return the resulting uncompressed term. - * + * * @exception OtpErlangDecodeException * if the next term in the stream is not a compressed term. */ public OtpErlangObject read_compressed() throws OtpErlangDecodeException { - final int tag = read1skip_version(); + final int tag = read1skip_version(); - if (tag != OtpExternal.compressedTag) { - throw new OtpErlangDecodeException( - "Wrong tag encountered, expected " - + OtpExternal.compressedTag + ", got " + tag); - } - - final int size = read4BE(); - final byte[] abuf = new byte[size]; - final java.util.zip.InflaterInputStream is = new java.util.zip.InflaterInputStream( - this, new java.util.zip.Inflater(), size); - int curPos = 0; - try { - int curRead; - while (curPos < size - && (curRead = is.read(abuf, curPos, size - curPos)) != -1) { - curPos += curRead; - } - if (curPos != size) { - throw new OtpErlangDecodeException("Decompression gave " - + curPos + " bytes, not " + size); - } - } catch (final IOException e) { - throw new OtpErlangDecodeException("Cannot read from input stream"); - } - - @SuppressWarnings("resource") - final OtpInputStream ois = new OtpInputStream(abuf, flags); - return ois.read_any(); + if (tag != OtpExternal.compressedTag) { + throw new OtpErlangDecodeException( + "Wrong tag encountered, expected " + + OtpExternal.compressedTag + ", got " + tag); + } + + final int size = read4BE(); + final byte[] buf = new byte[size]; + final java.util.zip.InflaterInputStream is = + new java.util.zip.InflaterInputStream(this, new java.util.zip.Inflater(), size); + int curPos = 0; + try { + int curRead; + while(curPos < size && (curRead = is.read(buf, curPos, size - curPos)) != -1) { + curPos += curRead; + } + if (curPos != size) { + throw new OtpErlangDecodeException("Decompression gave " + + curPos + " bytes, not " + size); + } + } catch (final IOException e) { + throw new OtpErlangDecodeException("Cannot read from input stream"); + } + + final OtpInputStream ois = new OtpInputStream(buf, flags); + return ois.read_any(); } /** * Read an arbitrary Erlang term from the stream. - * + * * @return the Erlang term. - * + * * @exception OtpErlangDecodeException * if the stream does not contain a known Erlang type at the * next position. */ public OtpErlangObject read_any() throws OtpErlangDecodeException { - // calls one of the above functions, depending on o - final int tag = peek1skip_version(); + // calls one of the above functions, depending on o + final int tag = peek1skip_version(); - switch (tag) { - case OtpExternal.smallIntTag: - case OtpExternal.intTag: - case OtpExternal.smallBigTag: - case OtpExternal.largeBigTag: - return new OtpErlangLong(this); - - case OtpExternal.atomTag: - case OtpExternal.smallAtomUtf8Tag: - case OtpExternal.atomUtf8Tag: - return new OtpErlangAtom(this); - - case OtpExternal.floatTag: - case OtpExternal.newFloatTag: - return new OtpErlangDouble(this); - - case OtpExternal.refTag: - case OtpExternal.newRefTag: - return new OtpErlangRef(this); + switch (tag) { + case OtpExternal.smallIntTag: + case OtpExternal.intTag: + case OtpExternal.smallBigTag: + case OtpExternal.largeBigTag: + return new OtpErlangLong(this); + + case OtpExternal.atomTag: + case OtpExternal.smallAtomUtf8Tag: + case OtpExternal.atomUtf8Tag: + return new OtpErlangAtom(this); + + case OtpExternal.floatTag: + case OtpExternal.newFloatTag: + return new OtpErlangDouble(this); + + case OtpExternal.refTag: + case OtpExternal.newRefTag: + return new OtpErlangRef(this); case OtpExternal.mapTag: return new OtpErlangMap(this); - case OtpExternal.portTag: - return new OtpErlangPort(this); + case OtpExternal.portTag: + return new OtpErlangPort(this); - case OtpExternal.pidTag: - return new OtpErlangPid(this); + case OtpExternal.pidTag: + return new OtpErlangPid(this); - case OtpExternal.stringTag: - return new OtpErlangString(this); + case OtpExternal.stringTag: + return new OtpErlangString(this); - case OtpExternal.listTag: - case OtpExternal.nilTag: - if ((flags & DECODE_INT_LISTS_AS_STRINGS) != 0) { - final int savePos = getPos(); - try { - return new OtpErlangString(this); - } catch (final OtpErlangDecodeException e) { - } - setPos(savePos); - } - return new OtpErlangList(this); - - case OtpExternal.smallTupleTag: - case OtpExternal.largeTupleTag: - return new OtpErlangTuple(this); - - case OtpExternal.binTag: - return new OtpErlangBinary(this); - - case OtpExternal.bitBinTag: - return new OtpErlangBitstr(this); - - case OtpExternal.compressedTag: - return read_compressed(); - - case OtpExternal.newFunTag: - case OtpExternal.funTag: - return new OtpErlangFun(this); - - case OtpExternal.externalFunTag: - return new OtpErlangExternalFun(this); - - default: - throw new OtpErlangDecodeException("Uknown data type: " + tag); - } + case OtpExternal.listTag: + case OtpExternal.nilTag: + if ((flags & DECODE_INT_LISTS_AS_STRINGS) != 0) { + final int savePos = getPos(); + try { + return new OtpErlangString(this); + } catch (final OtpErlangDecodeException e) { + } + setPos(savePos); + } + return new OtpErlangList(this); + + case OtpExternal.smallTupleTag: + case OtpExternal.largeTupleTag: + return new OtpErlangTuple(this); + + case OtpExternal.binTag: + return new OtpErlangBinary(this); + + case OtpExternal.bitBinTag: + return new OtpErlangBitstr(this); + + case OtpExternal.compressedTag: + return read_compressed(); + + case OtpExternal.newFunTag: + case OtpExternal.funTag: + return new OtpErlangFun(this); + + default: + throw new OtpErlangDecodeException("Uknown data type: " + tag); + } } public int read_map_head() throws OtpErlangDecodeException { diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpLocalNode.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpLocalNode.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpLocalNode.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpLocalNode.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -30,103 +29,89 @@ private int refId[]; protected int port; - protected OtpTransport epmd; + protected java.net.Socket epmd; - /** - * Create a node with the given name and the default cookie. - */ - protected OtpLocalNode(final String node) { - super(node); - init(); + protected OtpLocalNode() { + super(); + init(); } /** - * Create a node with the given name, transport factory and the default - * cookie. + * Create a node with the given name and the default cookie. */ - protected OtpLocalNode(final String node, - final OtpTransportFactory transportFactory) { - super(node, transportFactory); - init(); + protected OtpLocalNode(final String node) { + super(node); + init(); } /** * Create a node with the given name and cookie. */ protected OtpLocalNode(final String node, final String cookie) { - super(node, cookie); - init(); - } - - /** - * Create a node with the given name, cookie and transport factory. - */ - protected OtpLocalNode(final String node, final String cookie, - final OtpTransportFactory transportFactory) { - super(node, cookie, transportFactory); - init(); + super(node, cookie); + init(); } private void init() { - serial = 0; - pidCount = 1; - portCount = 1; - refId = new int[3]; - refId[0] = 1; - refId[1] = 0; - refId[2] = 0; + serial = 0; + pidCount = 1; + portCount = 1; + refId = new int[3]; + refId[0] = 1; + refId[1] = 0; + refId[2] = 0; } /** * Get the port number used by this node. - * + * * @return the port number this server node is accepting connections on. */ public int port() { - return port; + return port; } /** * Set the Epmd socket after publishing this nodes listen port to Epmd. - * + * * @param s - * The socket connecting this node to Epmd. + * The socket connecting this node to Epmd. */ - protected void setEpmd(final OtpTransport s) { - epmd = s; + protected void setEpmd(final java.net.Socket s) { + epmd = s; } /** * Get the Epmd socket. - * + * * @return The socket connecting this node to Epmd. */ - protected OtpTransport getEpmd() { - return epmd; + protected java.net.Socket getEpmd() { + return epmd; } /** * Create an Erlang {@link OtpErlangPid pid}. Erlang pids are based upon * some node specific information; this method creates a pid using the * information in this node. Each call to this method produces a unique pid. - * + * * @return an Erlang pid. */ public synchronized OtpErlangPid createPid() { - final OtpErlangPid p = new OtpErlangPid(node, pidCount, serial, - creation); + final OtpErlangPid p = new OtpErlangPid(node, pidCount, serial, + creation); - pidCount++; - if (pidCount > 0x7fff) { - pidCount = 0; - - serial++; - if (serial > 0x1fff) { /* 13 bits */ - serial = 0; - } - } + pidCount++; + if (pidCount > 0x7fff) { + pidCount = 0; + + serial++; + if (serial > 0x1fff) { /* 13 bits */ + serial = 0; + } + } - return p; + return p; } /** @@ -135,18 +120,18 @@ * information in this node. Each call to this method produces a unique * port. It may not be meaningful to create a port in a non-Erlang * environment, but this method is provided for completeness. - * + * * @return an Erlang port. */ public synchronized OtpErlangPort createPort() { - final OtpErlangPort p = new OtpErlangPort(node, portCount, creation); + final OtpErlangPort p = new OtpErlangPort(node, portCount, creation); - portCount++; - if (portCount > 0xfffffff) { /* 28 bits */ - portCount = 0; - } + portCount++; + if (portCount > 0xfffffff) { /* 28 bits */ + portCount = 0; + } - return p; + return p; } /** @@ -154,23 +139,23 @@ * based upon some node specific information; this method creates a * reference using the information in this node. Each call to this method * produces a unique reference. - * + * * @return an Erlang reference. */ public synchronized OtpErlangRef createRef() { - final OtpErlangRef r = new OtpErlangRef(node, refId, creation); + final OtpErlangRef r = new OtpErlangRef(node, refId, creation); - // increment ref ids (3 ints: 18 + 32 + 32 bits) - refId[0]++; - if (refId[0] > 0x3ffff) { - refId[0] = 0; - - refId[1]++; - if (refId[1] == 0) { - refId[2]++; - } - } + // increment ref ids (3 ints: 18 + 32 + 32 bits) + refId[0]++; + if (refId[0] > 0x3ffff) { + refId[0] = 0; + + refId[1]++; + if (refId[1] == 0) { + refId[2]++; + } + } - return r; + return r; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2012. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -24,7 +23,7 @@ * Provides a simple mechanism for exchanging messages with Erlang processes or * other instances of this class. *

    - * + * *

    * Each mailbox is associated with a unique {@link OtpErlangPid pid} that * contains information necessary for delivery of messages. When sending @@ -34,7 +33,7 @@ * message contents. The sender can determine his own pid by calling * {@link #self() self()}. *

    - * + * *

    * Mailboxes can be named, either at creation or later. Messages can be sent to * named mailboxes and named Erlang processes without knowing the @@ -42,7 +41,7 @@ * order to set up initial communication between parts of an application. Each * mailbox can have at most one name. *

    - * + * *

    * Since this class was intended for communication with Erlang, all of the send * methods take {@link OtpErlangObject OtpErlangObject} arguments. However this @@ -50,14 +49,14 @@ * implement one of java.io.Serializable or java.io.Externalizable) by * encapsulating the object in a {@link OtpErlangBinary OtpErlangBinary}. *

    - * + * *

    * Messages to remote nodes are externalized for transmission, and as a result * the recipient receives a copy of the original Java object. To ensure * consistent behaviour when messages are sent between local mailboxes, such * messages are cloned before delivery. *

    - * + * *

    * Additionally, mailboxes can be linked in much the same way as Erlang * processes. If a link is active when a mailbox is {@link #close closed}, any @@ -69,14 +68,14 @@ * close mailboxes if you are using links instead of relying on finalization to * notify other parties in a timely manner. *

    - * + * *

    * When retrieving messages from a mailbox that has received an exit signal, an * {@link OtpErlangExit OtpErlangExit} exception will be raised. Note that the * exception is queued in the mailbox along with other messages, and will not be * raised until it reaches the head of the queue and is about to be retrieved. *

    - * + * */ public class OtpMbox { OtpNode home; @@ -88,17 +87,17 @@ // package constructor: called by OtpNode:createMbox(name) // to create a named mbox OtpMbox(final OtpNode home, final OtpErlangPid self, final String name) { - this.self = self; - this.home = home; - this.name = name; - queue = new GenericQueue(); - links = new Links(10); + this.self = self; + this.home = home; + this.name = name; + queue = new GenericQueue(); + links = new Links(10); } // package constructor: called by OtpNode:createMbox() // to create an anonymous OtpMbox(final OtpNode home, final OtpErlangPid self) { - this(home, self, null); + this(home, self, null); } /** @@ -106,18 +105,18 @@ * Get the identifying {@link OtpErlangPid pid} associated with this * mailbox. *

    - * + * *

    * The {@link OtpErlangPid pid} associated with this mailbox uniquely * identifies the mailbox and can be used to address the mailbox. You can * send the {@link OtpErlangPid pid} to a remote communicating part so that * he can know where to send his response. *

    - * + * * @return the self pid for this mailbox. */ public OtpErlangPid self() { - return self; + return self; } /** @@ -128,305 +127,305 @@ * name; if the mailbox already had a name, calling this method will * supercede that name. *

    - * - * @param aname - * the name to register for the mailbox. Specify null to - * unregister the existing name from this mailbox. - * + * + * @param name + * the name to register for the mailbox. Specify null to + * unregister the existing name from this mailbox. + * * @return true if the name was available, or false otherwise. */ - public synchronized boolean registerName(final String aname) { - return home.registerName(aname, this); + public synchronized boolean registerName(final String name) { + return home.registerName(name, this); } /** * Get the registered name of this mailbox. - * + * * @return the registered name of this mailbox, or null if the mailbox had * no registered name. */ public String getName() { - return name; + return name; } /** * Block until a message arrives for this mailbox. - * + * * @return an {@link OtpErlangObject OtpErlangObject} representing the body * of the next message waiting in this mailbox. - * + * * @exception OtpErlangDecodeException - * if the message can not be decoded. - * + * if the message can not be decoded. + * * @exception OtpErlangExit - * if a linked {@link OtpErlangPid pid} has exited or has - * sent an exit signal to this mailbox. + * if a linked {@link OtpErlangPid pid} has exited or has + * sent an exit signal to this mailbox. */ public OtpErlangObject receive() throws OtpErlangExit, - OtpErlangDecodeException { - try { - return receiveMsg().getMsg(); - } catch (final OtpErlangExit e) { - throw e; - } catch (final OtpErlangDecodeException f) { - throw f; - } + OtpErlangDecodeException { + try { + return receiveMsg().getMsg(); + } catch (final OtpErlangExit e) { + throw e; + } catch (final OtpErlangDecodeException f) { + throw f; + } } /** * Wait for a message to arrive for this mailbox. - * + * * @param timeout - * the time, in milliseconds, to wait for a message before - * returning null. - * + * the time, in milliseconds, to wait for a message before + * returning null. + * * @return an {@link OtpErlangObject OtpErlangObject} representing the body * of the next message waiting in this mailbox. - * + * * @exception OtpErlangDecodeException - * if the message can not be decoded. - * + * if the message can not be decoded. + * * @exception OtpErlangExit - * if a linked {@link OtpErlangPid pid} has exited or has - * sent an exit signal to this mailbox. + * if a linked {@link OtpErlangPid pid} has exited or has + * sent an exit signal to this mailbox. */ public OtpErlangObject receive(final long timeout) throws OtpErlangExit, - OtpErlangDecodeException { - try { - final OtpMsg m = receiveMsg(timeout); - if (m != null) { - return m.getMsg(); - } - } catch (final OtpErlangExit e) { - throw e; - } catch (final OtpErlangDecodeException f) { - throw f; - } catch (final InterruptedException g) { - } - return null; + OtpErlangDecodeException { + try { + final OtpMsg m = receiveMsg(timeout); + if (m != null) { + return m.getMsg(); + } + } catch (final OtpErlangExit e) { + throw e; + } catch (final OtpErlangDecodeException f) { + throw f; + } catch (final InterruptedException g) { + } + return null; } /** * Block until a message arrives for this mailbox. - * + * * @return a byte array representing the still-encoded body of the next * message waiting in this mailbox. - * + * * @exception OtpErlangExit - * if a linked {@link OtpErlangPid pid} has exited or has - * sent an exit signal to this mailbox. - * + * if a linked {@link OtpErlangPid pid} has exited or has + * sent an exit signal to this mailbox. + * */ public OtpInputStream receiveBuf() throws OtpErlangExit { - return receiveMsg().getMsgBuf(); + return receiveMsg().getMsgBuf(); } /** * Wait for a message to arrive for this mailbox. - * + * * @param timeout - * the time, in milliseconds, to wait for a message before - * returning null. - * + * the time, in milliseconds, to wait for a message before + * returning null. + * * @return a byte array representing the still-encoded body of the next * message waiting in this mailbox. - * + * * @exception OtpErlangExit - * if a linked {@link OtpErlangPid pid} has exited or has - * sent an exit signal to this mailbox. - * + * if a linked {@link OtpErlangPid pid} has exited or has + * sent an exit signal to this mailbox. + * * @exception InterruptedException - * if no message if the method times out before a message - * becomes available. + * if no message if the method times out before a message + * becomes available. */ public OtpInputStream receiveBuf(final long timeout) - throws InterruptedException, OtpErlangExit { - final OtpMsg m = receiveMsg(timeout); - if (m != null) { - return m.getMsgBuf(); - } + throws InterruptedException, OtpErlangExit { + final OtpMsg m = receiveMsg(timeout); + if (m != null) { + return m.getMsgBuf(); + } - return null; + return null; } /** * Block until a message arrives for this mailbox. - * + * * @return an {@link OtpMsg OtpMsg} containing the header information as * well as the body of the next message waiting in this mailbox. - * + * * @exception OtpErlangExit - * if a linked {@link OtpErlangPid pid} has exited or has - * sent an exit signal to this mailbox. - * + * if a linked {@link OtpErlangPid pid} has exited or has + * sent an exit signal to this mailbox. + * */ public OtpMsg receiveMsg() throws OtpErlangExit { - final OtpMsg m = (OtpMsg) queue.get(); + final OtpMsg m = (OtpMsg) queue.get(); - switch (m.type()) { - case OtpMsg.exitTag: - case OtpMsg.exit2Tag: - try { - final OtpErlangObject o = m.getMsg(); - throw new OtpErlangExit(o, m.getSenderPid()); - } catch (final OtpErlangDecodeException e) { - throw new OtpErlangExit("unknown", m.getSenderPid()); - } - - default: - return m; - } + switch (m.type()) { + case OtpMsg.exitTag: + case OtpMsg.exit2Tag: + try { + final OtpErlangObject o = m.getMsg(); + throw new OtpErlangExit(o, m.getSenderPid()); + } catch (final OtpErlangDecodeException e) { + throw new OtpErlangExit("unknown", m.getSenderPid()); + } + + default: + return m; + } } /** * Wait for a message to arrive for this mailbox. - * + * * @param timeout - * the time, in milliseconds, to wait for a message. - * + * the time, in milliseconds, to wait for a message. + * * @return an {@link OtpMsg OtpMsg} containing the header information as * well as the body of the next message waiting in this mailbox. - * + * * @exception OtpErlangExit - * if a linked {@link OtpErlangPid pid} has exited or has - * sent an exit signal to this mailbox. - * + * if a linked {@link OtpErlangPid pid} has exited or has + * sent an exit signal to this mailbox. + * * @exception InterruptedException - * if no message if the method times out before a message - * becomes available. + * if no message if the method times out before a message + * becomes available. */ public OtpMsg receiveMsg(final long timeout) throws InterruptedException, - OtpErlangExit { - final OtpMsg m = (OtpMsg) queue.get(timeout); + OtpErlangExit { + final OtpMsg m = (OtpMsg) queue.get(timeout); - if (m == null) { - return null; - } - - switch (m.type()) { - case OtpMsg.exitTag: - case OtpMsg.exit2Tag: - try { - final OtpErlangObject o = m.getMsg(); - throw new OtpErlangExit(o, m.getSenderPid()); - } catch (final OtpErlangDecodeException e) { - throw new OtpErlangExit("unknown", m.getSenderPid()); - } - - default: - return m; - } + if (m == null) { + return null; + } + + switch (m.type()) { + case OtpMsg.exitTag: + case OtpMsg.exit2Tag: + try { + final OtpErlangObject o = m.getMsg(); + throw new OtpErlangExit(o, m.getSenderPid()); + } catch (final OtpErlangDecodeException e) { + throw new OtpErlangExit("unknown", m.getSenderPid()); + } + + default: + return m; + } } /** * Send a message to a remote {@link OtpErlangPid pid}, representing either * another {@link OtpMbox mailbox} or an Erlang process. - * + * * @param to - * the {@link OtpErlangPid pid} identifying the intended - * recipient of the message. - * + * the {@link OtpErlangPid pid} identifying the intended + * recipient of the message. + * * @param msg - * the body of the message to send. - * + * the body of the message to send. + * */ public void send(final OtpErlangPid to, final OtpErlangObject msg) { - try { - final String node = to.node(); - if (node.equals(home.node())) { - home.deliver(new OtpMsg(to, (OtpErlangObject) msg.clone())); - } else { - final OtpCookedConnection conn = home.getConnection(node); - if (conn == null) { - return; - } - conn.send(self, to, msg); - } - } catch (final Exception e) { - } + try { + final String node = to.node(); + if (node.equals(home.node())) { + home.deliver(new OtpMsg(to, (OtpErlangObject) msg.clone())); + } else { + final OtpCookedConnection conn = home.getConnection(node); + if (conn == null) { + return; + } + conn.send(self, to, msg); + } + } catch (final Exception e) { + } } /** * Send a message to a named mailbox created from the same node as this * mailbox. - * - * @param aname - * the registered name of recipient mailbox. - * + * + * @param name + * the registered name of recipient mailbox. + * * @param msg - * the body of the message to send. - * + * the body of the message to send. + * */ - public void send(final String aname, final OtpErlangObject msg) { - home.deliver(new OtpMsg(self, aname, (OtpErlangObject) msg.clone())); + public void send(final String name, final OtpErlangObject msg) { + home.deliver(new OtpMsg(self, name, (OtpErlangObject) msg.clone())); } /** * Send a message to a named mailbox created from another node. - * - * @param aname - * the registered name of recipient mailbox. - * + * + * @param name + * the registered name of recipient mailbox. + * * @param node - * the name of the remote node where the recipient mailbox is - * registered. - * + * the name of the remote node where the recipient mailbox is + * registered. + * * @param msg - * the body of the message to send. - * + * the body of the message to send. + * */ - public void send(final String aname, final String node, - final OtpErlangObject msg) { - try { - final String currentNode = home.node(); - if (node.equals(currentNode)) { - send(aname, msg); - } else if (node.indexOf('@', 0) < 0 - && node.equals(currentNode.substring(0, - currentNode.indexOf('@', 0)))) { - send(aname, msg); - } else { - // other node - final OtpCookedConnection conn = home.getConnection(node); - if (conn == null) { - return; - } - conn.send(self, aname, msg); - } - } catch (final Exception e) { - } + public void send(final String name, final String node, + final OtpErlangObject msg) { + try { + final String currentNode = home.node(); + if (node.equals(currentNode)) { + send(name, msg); + } else if (node.indexOf('@', 0) < 0 + && node.equals(currentNode.substring(0, currentNode + .indexOf('@', 0)))) { + send(name, msg); + } else { + // other node + final OtpCookedConnection conn = home.getConnection(node); + if (conn == null) { + return; + } + conn.send(self, name, msg); + } + } catch (final Exception e) { + } } /** * Close this mailbox with the given reason. - * + * *

    * After this operation, the mailbox will no longer be able to receive * messages. Any delivered but as yet unretrieved messages can still be * retrieved however. *

    - * + * *

    * If there are links from this mailbox to other {@link OtpErlangPid pids}, * they will be broken when this method is called and exit signals will be * sent. *

    - * + * * @param reason - * an Erlang term describing the reason for the exit. + * an Erlang term describing the reason for the exit. */ public void exit(final OtpErlangObject reason) { - home.closeMbox(this, reason); + home.closeMbox(this, reason); } /** * Equivalent to exit(new OtpErlangAtom(reason)). - * + * * @see #exit(OtpErlangObject) */ public void exit(final String reason) { - exit(new OtpErlangAtom(reason)); + exit(new OtpErlangAtom(reason)); } /** @@ -435,17 +434,17 @@ * does not cause any links to be broken, except indirectly if the remote * {@link OtpErlangPid pid} exits as a result of this exit signal. *

    - * + * * @param to - * the {@link OtpErlangPid pid} to which the exit signal should - * be sent. - * + * the {@link OtpErlangPid pid} to which the exit signal + * should be sent. + * * @param reason - * an Erlang term indicating the reason for the exit. + * an Erlang term indicating the reason for the exit. */ // it's called exit, but it sends exit2 public void exit(final OtpErlangPid to, final OtpErlangObject reason) { - exit(2, to, reason); + exit(2, to, reason); } /** @@ -453,38 +452,38 @@ * Equivalent to exit(to, new * OtpErlangAtom(reason)). *

    - * + * * @see #exit(OtpErlangPid, OtpErlangObject) */ public void exit(final OtpErlangPid to, final String reason) { - exit(to, new OtpErlangAtom(reason)); + exit(to, new OtpErlangAtom(reason)); } // this function used internally when "process" dies // since Erlang discerns between exit and exit/2. private void exit(final int arity, final OtpErlangPid to, - final OtpErlangObject reason) { - try { - final String node = to.node(); - if (node.equals(home.node())) { - home.deliver(new OtpMsg(OtpMsg.exitTag, self, to, reason)); - } else { - final OtpCookedConnection conn = home.getConnection(node); - if (conn == null) { - return; - } - switch (arity) { - case 1: - conn.exit(self, to, reason); - break; - - case 2: - conn.exit2(self, to, reason); - break; - } - } - } catch (final Exception e) { - } + final OtpErlangObject reason) { + try { + final String node = to.node(); + if (node.equals(home.node())) { + home.deliver(new OtpMsg(OtpMsg.exitTag, self, to, reason)); + } else { + final OtpCookedConnection conn = home.getConnection(node); + if (conn == null) { + return; + } + switch (arity) { + case 1: + conn.exit(self, to, reason); + break; + + case 2: + conn.exit2(self, to, reason); + break; + } + } + } catch (final Exception e) { + } } /** @@ -493,7 +492,7 @@ * this method multiple times will not result in more than one link being * created. *

    - * + * *

    * If the remote process subsequently exits or the mailbox is closed, a * subsequent attempt to retrieve a message through this mailbox will cause @@ -501,42 +500,42 @@ * if the sending mailbox is closed, the linked mailbox or process will * receive an exit signal. *

    - * + * *

    * If the remote process cannot be reached in order to set the link, the * exception is raised immediately. *

    - * + * * @param to - * the {@link OtpErlangPid pid} representing the object to link - * to. - * + * the {@link OtpErlangPid pid} representing the object to + * link to. + * * @exception OtpErlangExit - * if the {@link OtpErlangPid pid} referred to does not exist - * or could not be reached. - * + * if the {@link OtpErlangPid pid} referred to does not + * exist or could not be reached. + * */ public void link(final OtpErlangPid to) throws OtpErlangExit { - try { - final String node = to.node(); - if (node.equals(home.node())) { - if (!home.deliver(new OtpMsg(OtpMsg.linkTag, self, to))) { - throw new OtpErlangExit("noproc", to); - } - } else { - final OtpCookedConnection conn = home.getConnection(node); - if (conn != null) { - conn.link(self, to); - } else { - throw new OtpErlangExit("noproc", to); - } - } - } catch (final OtpErlangExit e) { - throw e; - } catch (final Exception e) { - } + try { + final String node = to.node(); + if (node.equals(home.node())) { + if (!home.deliver(new OtpMsg(OtpMsg.linkTag, self, to))) { + throw new OtpErlangExit("noproc", to); + } + } else { + final OtpCookedConnection conn = home.getConnection(node); + if (conn != null) { + conn.link(self, to); + } else { + throw new OtpErlangExit("noproc", to); + } + } + } catch (final OtpErlangExit e) { + throw e; + } catch (final Exception e) { + } - links.addLink(self, to); + links.addLink(self, to); } /** @@ -546,58 +545,58 @@ * this method once will remove all links between this mailbox and the * remote {@link OtpErlangPid pid}. *

    - * + * * @param to - * the {@link OtpErlangPid pid} representing the object to unlink - * from. - * + * the {@link OtpErlangPid pid} representing the object to + * unlink from. + * */ public void unlink(final OtpErlangPid to) { - links.removeLink(self, to); + links.removeLink(self, to); - try { - final String node = to.node(); - if (node.equals(home.node())) { - home.deliver(new OtpMsg(OtpMsg.unlinkTag, self, to)); - } else { - final OtpCookedConnection conn = home.getConnection(node); - if (conn != null) { - conn.unlink(self, to); - } - } - } catch (final Exception e) { - } + try { + final String node = to.node(); + if (node.equals(home.node())) { + home.deliver(new OtpMsg(OtpMsg.unlinkTag, self, to)); + } else { + final OtpCookedConnection conn = home.getConnection(node); + if (conn != null) { + conn.unlink(self, to); + } + } + } catch (final Exception e) { + } } /** *

    * Create a connection to a remote node. *

    - * + * *

    * Strictly speaking, this method is not necessary simply to set up a * connection, since connections are created automatically first time a * message is sent to a {@link OtpErlangPid pid} on the remote node. *

    - * + * *

    * This method makes it possible to wait for a node to come up, however, or * check that a node is still alive. *

    - * + * *

    * This method calls a method with the same name in {@link OtpNode#ping * Otpnode} but is provided here for convenience. *

    - * + * * @param node - * the name of the node to ping. - * + * the name of the node to ping. + * * @param timeout - * the time, in milliseconds, before reporting failure. + * the time, in milliseconds, before reporting failure. */ public boolean ping(final String node, final long timeout) { - return home.ping(node, timeout); + return home.ping(node, timeout); } /** @@ -605,78 +604,78 @@ * Get a list of all known registered names on the same {@link OtpNode node} * as this mailbox. *

    - * + * *

    * This method calls a method with the same name in {@link OtpNode#getNames * Otpnode} but is provided here for convenience. *

    - * + * * @return an array of Strings containing all registered names on this * {@link OtpNode node}. */ public String[] getNames() { - return home.getNames(); + return home.getNames(); } /** * Determine the {@link OtpErlangPid pid} corresponding to a registered name * on this {@link OtpNode node}. - * + * *

    * This method calls a method with the same name in {@link OtpNode#whereis * Otpnode} but is provided here for convenience. *

    - * + * * @return the {@link OtpErlangPid pid} corresponding to the registered * name, or null if the name is not known on this node. */ - public OtpErlangPid whereis(final String aname) { - return home.whereis(aname); + public OtpErlangPid whereis(final String name) { + return home.whereis(name); } /** * Close this mailbox. - * + * *

    * After this operation, the mailbox will no longer be able to receive * messages. Any delivered but as yet unretrieved messages can still be * retrieved however. *

    - * + * *

    * If there are links from this mailbox to other {@link OtpErlangPid pids}, * they will be broken when this method is called and exit signals with * reason 'normal' will be sent. *

    - * + * *

    * This is equivalent to {@link #exit(String) exit("normal")}. *

    */ public void close() { - home.closeMbox(this); + home.closeMbox(this); } @Override protected void finalize() { - close(); - queue.flush(); + close(); + queue.flush(); } /** * Determine if two mailboxes are equal. - * + * * @return true if both Objects are mailboxes with the same identifying * {@link OtpErlangPid pids}. */ @Override public boolean equals(final Object o) { - if (!(o instanceof OtpMbox)) { - return false; - } + if (!(o instanceof OtpMbox)) { + return false; + } - final OtpMbox m = (OtpMbox) o; - return m.self.equals(self); + final OtpMbox m = (OtpMbox) o; + return m.self.equals(self); } @Override @@ -686,43 +685,43 @@ /* * called by OtpNode to deliver message to this mailbox. - * + * * About exit and exit2: both cause exception to be raised upon receive(). * However exit (not 2) causes any link to be removed as well, while exit2 * leaves any links intact. */ void deliver(final OtpMsg m) { - switch (m.type()) { - case OtpMsg.linkTag: - links.addLink(self, m.getSenderPid()); - break; - - case OtpMsg.unlinkTag: - links.removeLink(self, m.getSenderPid()); - break; - - case OtpMsg.exitTag: - links.removeLink(self, m.getSenderPid()); - queue.put(m); - break; - - case OtpMsg.exit2Tag: - default: - queue.put(m); - break; - } + switch (m.type()) { + case OtpMsg.linkTag: + links.addLink(self, m.getSenderPid()); + break; + + case OtpMsg.unlinkTag: + links.removeLink(self, m.getSenderPid()); + break; + + case OtpMsg.exitTag: + links.removeLink(self, m.getSenderPid()); + queue.put(m); + break; + + case OtpMsg.exit2Tag: + default: + queue.put(m); + break; + } } // used to break all known links to this mbox void breakLinks(final OtpErlangObject reason) { - final Link[] l = links.clearLinks(); + final Link[] l = links.clearLinks(); - if (l != null) { - final int len = l.length; + if (l != null) { + final int len = l.length; - for (int i = 0; i < len; i++) { - exit(1, l[i].remote(), reason); - } - } + for (int i = 0; i < len; i++) { + exit(1, l[i].remote(), reason); + } + } } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMD5.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMD5.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMD5.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMD5.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -47,37 +46,37 @@ */ private final long state[] = { 0x67452301L, 0xefcdab89L, 0x98badcfeL, - 0x10325476L }; + 0x10325476L }; private final long count[] = { 0L, 0L }; private final int buffer[]; public OtpMD5() { - buffer = new int[64]; - int i; - for (i = 0; i < 64; ++i) { - buffer[i] = 0; - } + buffer = new int[64]; + int i; + for (i = 0; i < 64; ++i) { + buffer[i] = 0; + } } private int[] to_bytes(final String s) { - final char tmp[] = s.toCharArray(); - final int ret[] = new int[tmp.length]; - int i; - - for (i = 0; i < tmp.length; ++i) { - ret[i] = tmp[i] & 0xFF; - } - return ret; + final char tmp[] = s.toCharArray(); + final int ret[] = new int[tmp.length]; + int i; + + for (i = 0; i < tmp.length; ++i) { + ret[i] = tmp[i] & 0xFF; + } + return ret; } private int[] clean_bytes(final int bytes[]) { - final int ret[] = new int[bytes.length]; - int i; + final int ret[] = new int[bytes.length]; + int i; - for (i = 0; i < bytes.length; ++i) { - ret[i] = bytes[i] & 0xFF; - } - return ret; + for (i = 0; i < bytes.length; ++i) { + ret[i] = bytes[i] & 0xFF; + } + return ret; } /* @@ -85,83 +84,79 @@ */ private long shl(final long what, final int steps) { - return what << steps & 0xFFFFFFFFL; + return what << steps & 0xFFFFFFFFL; } private long shr(final long what, final int steps) { - return what >>> steps; + return what >>> steps; } private long plus(final long a, final long b) { - return a + b & 0xFFFFFFFFL; + return a + b & 0xFFFFFFFFL; } - private long not(final long x) { - return ~x & 0xFFFFFFFFL; + private long not(long x) { + return ~x & 0xFFFFFFFFL; } - private void to_buffer(final int to_start, final int[] from, - final int from_start, final int num) { - int ix = num; - int to_ix = to_start; - int from_ix = from_start; - while (ix-- > 0) { - buffer[to_ix++] = from[from_ix++]; - } + private void to_buffer(int to_start, final int[] from, int from_start, + int num) { + while (num-- > 0) { + buffer[to_start++] = from[from_start++]; + } } private void do_update(final int bytes[]) { - int index = (int) (count[0] >>> 3 & 0x3F); - final long inlen = bytes.length; - final long addcount = shl(inlen, 3); - final long partlen = 64 - index; - int i; + int index = (int) (count[0] >>> 3 & 0x3F); + final long inlen = bytes.length; + final long addcount = shl(inlen, 3); + final long partlen = 64 - index; + int i; - count[0] = plus(count[0], addcount); + count[0] = plus(count[0], addcount); - if (count[0] < addcount) { - ++count[1]; - } + if (count[0] < addcount) { + ++count[1]; + } - count[1] = plus(count[1], shr(inlen, 29)); + count[1] = plus(count[1], shr(inlen, 29)); - // dumpstate(); + /* dumpstate(); */ - if (inlen >= partlen) { - to_buffer(index, bytes, 0, (int) partlen); - transform(buffer, 0); + if (inlen >= partlen) { + to_buffer(index, bytes, 0, (int) partlen); + transform(buffer, 0); - for (i = (int) partlen; i + 63 < inlen; i += 64) { - transform(bytes, i); - } + for (i = (int) partlen; i + 63 < inlen; i += 64) { + transform(bytes, i); + } - index = 0; - } else { - i = 0; - } + index = 0; + } else { + i = 0; + } - /* dumpstate(); */ + /* dumpstate(); */ - to_buffer(index, bytes, i, (int) inlen - i); + to_buffer(index, bytes, i, (int) inlen - i); - /* dumpstate(); */ + /* dumpstate(); */ } - @SuppressWarnings("unused") private void dumpstate() { - System.out.println("state = {" + state[0] + ", " + state[1] + ", " - + state[2] + ", " + state[3] + "}"); - System.out.println("count = {" + count[0] + ", " + count[1] + "}"); - System.out.print("buffer = {"); - int i; - for (i = 0; i < 64; ++i) { - if (i > 0) { - System.out.print(", "); - } - System.out.print(buffer[i]); - } - System.out.println("}"); + System.out.println("state = {" + state[0] + ", " + state[1] + ", " + + state[2] + ", " + state[3] + "}"); + System.out.println("count = {" + count[0] + ", " + count[1] + "}"); + System.out.print("buffer = {"); + int i; + for (i = 0; i < 64; ++i) { + if (i > 0) { + System.out.print(", "); + } + System.out.print(buffer[i]); + } + System.out.println("}"); } /* @@ -169,191 +164,191 @@ */ private long F(final long x, final long y, final long z) { - return x & y | not(x) & z; + return x & y | not(x) & z; } private long G(final long x, final long y, final long z) { - return x & z | y & not(z); + return x & z | y & not(z); } private long H(final long x, final long y, final long z) { - return x ^ y ^ z; + return x ^ y ^ z; } private long I(final long x, final long y, final long z) { - return y ^ (x | not(z)); + return y ^ (x | not(z)); } private long ROTATE_LEFT(final long x, final long n) { - return shl(x, (int) n) | shr(x, (int) (32 - n)); + return shl(x, (int) n) | shr(x, (int) (32 - n)); } - private long FF(final long a, final long b, final long c, final long d, - final long x, final long s, final long ac) { - long tmp = plus(a, plus(plus(F(b, c, d), x), ac)); - tmp = ROTATE_LEFT(tmp, s); - return plus(tmp, b); + private long FF(long a, final long b, final long c, final long d, + final long x, final long s, final long ac) { + a = plus(a, plus(plus(F(b, c, d), x), ac)); + a = ROTATE_LEFT(a, s); + return plus(a, b); } - private long GG(final long a, final long b, final long c, final long d, - final long x, final long s, final long ac) { - long tmp = plus(a, plus(plus(G(b, c, d), x), ac)); - tmp = ROTATE_LEFT(tmp, s); - return plus(tmp, b); + private long GG(long a, final long b, final long c, final long d, + final long x, final long s, final long ac) { + a = plus(a, plus(plus(G(b, c, d), x), ac)); + a = ROTATE_LEFT(a, s); + return plus(a, b); } - private long HH(final long a, final long b, final long c, final long d, - final long x, final long s, final long ac) { - long tmp = plus(a, plus(plus(H(b, c, d), x), ac)); - tmp = ROTATE_LEFT(tmp, s); - return plus(tmp, b); + private long HH(long a, final long b, final long c, final long d, + final long x, final long s, final long ac) { + a = plus(a, plus(plus(H(b, c, d), x), ac)); + a = ROTATE_LEFT(a, s); + return plus(a, b); } - private long II(final long a, final long b, final long c, final long d, - final long x, final long s, final long ac) { - long tmp = plus(a, plus(plus(I(b, c, d), x), ac)); - tmp = ROTATE_LEFT(tmp, s); - return plus(tmp, b); + private long II(long a, final long b, final long c, final long d, + final long x, final long s, final long ac) { + a = plus(a, plus(plus(I(b, c, d), x), ac)); + a = ROTATE_LEFT(a, s); + return plus(a, b); } private void decode(final long output[], final int input[], - final int in_from, final int len) { - int i, j; + final int in_from, final int len) { + int i, j; - for (i = 0, j = 0; j < len; i++, j += 4) { - output[i] = input[j + in_from] | shl(input[j + in_from + 1], 8) - | shl(input[j + in_from + 2], 16) - | shl(input[j + in_from + 3], 24); - } + for (i = 0, j = 0; j < len; i++, j += 4) { + output[i] = input[j + in_from] | shl(input[j + in_from + 1], 8) + | shl(input[j + in_from + 2], 16) + | shl(input[j + in_from + 3], 24); + } } private void transform(final int block[], final int from) { - long a = state[0]; - long b = state[1]; - long c = state[2]; - long d = state[3]; - final long x[] = new long[16]; - - decode(x, block, from, 64); - - a = FF(a, b, c, d, x[0], S11, 0xd76aa478L); /* 1 */ - d = FF(d, a, b, c, x[1], S12, 0xe8c7b756L); /* 2 */ - c = FF(c, d, a, b, x[2], S13, 0x242070dbL); /* 3 */ - b = FF(b, c, d, a, x[3], S14, 0xc1bdceeeL); /* 4 */ - a = FF(a, b, c, d, x[4], S11, 0xf57c0fafL); /* 5 */ - d = FF(d, a, b, c, x[5], S12, 0x4787c62aL); /* 6 */ - c = FF(c, d, a, b, x[6], S13, 0xa8304613L); /* 7 */ - b = FF(b, c, d, a, x[7], S14, 0xfd469501L); /* 8 */ - a = FF(a, b, c, d, x[8], S11, 0x698098d8L); /* 9 */ - d = FF(d, a, b, c, x[9], S12, 0x8b44f7afL); /* 10 */ - c = FF(c, d, a, b, x[10], S13, 0xffff5bb1L); /* 11 */ - b = FF(b, c, d, a, x[11], S14, 0x895cd7beL); /* 12 */ - a = FF(a, b, c, d, x[12], S11, 0x6b901122L); /* 13 */ - d = FF(d, a, b, c, x[13], S12, 0xfd987193L); /* 14 */ - c = FF(c, d, a, b, x[14], S13, 0xa679438eL); /* 15 */ - b = FF(b, c, d, a, x[15], S14, 0x49b40821L); /* 16 */ - - /* Round 2 */ - a = GG(a, b, c, d, x[1], S21, 0xf61e2562L); /* 17 */ - d = GG(d, a, b, c, x[6], S22, 0xc040b340L); /* 18 */ - c = GG(c, d, a, b, x[11], S23, 0x265e5a51L); /* 19 */ - b = GG(b, c, d, a, x[0], S24, 0xe9b6c7aaL); /* 20 */ - a = GG(a, b, c, d, x[5], S21, 0xd62f105dL); /* 21 */ - d = GG(d, a, b, c, x[10], S22, 0x2441453L); /* 22 */ - c = GG(c, d, a, b, x[15], S23, 0xd8a1e681L); /* 23 */ - b = GG(b, c, d, a, x[4], S24, 0xe7d3fbc8L); /* 24 */ - a = GG(a, b, c, d, x[9], S21, 0x21e1cde6L); /* 25 */ - d = GG(d, a, b, c, x[14], S22, 0xc33707d6L); /* 26 */ - c = GG(c, d, a, b, x[3], S23, 0xf4d50d87L); /* 27 */ - b = GG(b, c, d, a, x[8], S24, 0x455a14edL); /* 28 */ - a = GG(a, b, c, d, x[13], S21, 0xa9e3e905L); /* 29 */ - d = GG(d, a, b, c, x[2], S22, 0xfcefa3f8L); /* 30 */ - c = GG(c, d, a, b, x[7], S23, 0x676f02d9L); /* 31 */ - b = GG(b, c, d, a, x[12], S24, 0x8d2a4c8aL); /* 32 */ - - /* Round 3 */ - a = HH(a, b, c, d, x[5], S31, 0xfffa3942L); /* 33 */ - d = HH(d, a, b, c, x[8], S32, 0x8771f681L); /* 34 */ - c = HH(c, d, a, b, x[11], S33, 0x6d9d6122L); /* 35 */ - b = HH(b, c, d, a, x[14], S34, 0xfde5380cL); /* 36 */ - a = HH(a, b, c, d, x[1], S31, 0xa4beea44L); /* 37 */ - d = HH(d, a, b, c, x[4], S32, 0x4bdecfa9L); /* 38 */ - c = HH(c, d, a, b, x[7], S33, 0xf6bb4b60L); /* 39 */ - b = HH(b, c, d, a, x[10], S34, 0xbebfbc70L); /* 40 */ - a = HH(a, b, c, d, x[13], S31, 0x289b7ec6L); /* 41 */ - d = HH(d, a, b, c, x[0], S32, 0xeaa127faL); /* 42 */ - c = HH(c, d, a, b, x[3], S33, 0xd4ef3085L); /* 43 */ - b = HH(b, c, d, a, x[6], S34, 0x4881d05L); /* 44 */ - a = HH(a, b, c, d, x[9], S31, 0xd9d4d039L); /* 45 */ - d = HH(d, a, b, c, x[12], S32, 0xe6db99e5L); /* 46 */ - c = HH(c, d, a, b, x[15], S33, 0x1fa27cf8L); /* 47 */ - b = HH(b, c, d, a, x[2], S34, 0xc4ac5665L); /* 48 */ - - /* Round 4 */ - a = II(a, b, c, d, x[0], S41, 0xf4292244L); /* 49 */ - d = II(d, a, b, c, x[7], S42, 0x432aff97L); /* 50 */ - c = II(c, d, a, b, x[14], S43, 0xab9423a7L); /* 51 */ - b = II(b, c, d, a, x[5], S44, 0xfc93a039L); /* 52 */ - a = II(a, b, c, d, x[12], S41, 0x655b59c3L); /* 53 */ - d = II(d, a, b, c, x[3], S42, 0x8f0ccc92L); /* 54 */ - c = II(c, d, a, b, x[10], S43, 0xffeff47dL); /* 55 */ - b = II(b, c, d, a, x[1], S44, 0x85845dd1L); /* 56 */ - a = II(a, b, c, d, x[8], S41, 0x6fa87e4fL); /* 57 */ - d = II(d, a, b, c, x[15], S42, 0xfe2ce6e0L); /* 58 */ - c = II(c, d, a, b, x[6], S43, 0xa3014314L); /* 59 */ - b = II(b, c, d, a, x[13], S44, 0x4e0811a1L); /* 60 */ - a = II(a, b, c, d, x[4], S41, 0xf7537e82L); /* 61 */ - d = II(d, a, b, c, x[11], S42, 0xbd3af235L); /* 62 */ - c = II(c, d, a, b, x[2], S43, 0x2ad7d2bbL); /* 63 */ - b = II(b, c, d, a, x[9], S44, 0xeb86d391L); /* 64 */ - - state[0] = plus(state[0], a); - state[1] = plus(state[1], b); - state[2] = plus(state[2], c); - state[3] = plus(state[3], d); + long a = state[0]; + long b = state[1]; + long c = state[2]; + long d = state[3]; + final long x[] = new long[16]; + + decode(x, block, from, 64); + + a = FF(a, b, c, d, x[0], S11, 0xd76aa478L); /* 1 */ + d = FF(d, a, b, c, x[1], S12, 0xe8c7b756L); /* 2 */ + c = FF(c, d, a, b, x[2], S13, 0x242070dbL); /* 3 */ + b = FF(b, c, d, a, x[3], S14, 0xc1bdceeeL); /* 4 */ + a = FF(a, b, c, d, x[4], S11, 0xf57c0fafL); /* 5 */ + d = FF(d, a, b, c, x[5], S12, 0x4787c62aL); /* 6 */ + c = FF(c, d, a, b, x[6], S13, 0xa8304613L); /* 7 */ + b = FF(b, c, d, a, x[7], S14, 0xfd469501L); /* 8 */ + a = FF(a, b, c, d, x[8], S11, 0x698098d8L); /* 9 */ + d = FF(d, a, b, c, x[9], S12, 0x8b44f7afL); /* 10 */ + c = FF(c, d, a, b, x[10], S13, 0xffff5bb1L); /* 11 */ + b = FF(b, c, d, a, x[11], S14, 0x895cd7beL); /* 12 */ + a = FF(a, b, c, d, x[12], S11, 0x6b901122L); /* 13 */ + d = FF(d, a, b, c, x[13], S12, 0xfd987193L); /* 14 */ + c = FF(c, d, a, b, x[14], S13, 0xa679438eL); /* 15 */ + b = FF(b, c, d, a, x[15], S14, 0x49b40821L); /* 16 */ + + /* Round 2 */ + a = GG(a, b, c, d, x[1], S21, 0xf61e2562L); /* 17 */ + d = GG(d, a, b, c, x[6], S22, 0xc040b340L); /* 18 */ + c = GG(c, d, a, b, x[11], S23, 0x265e5a51L); /* 19 */ + b = GG(b, c, d, a, x[0], S24, 0xe9b6c7aaL); /* 20 */ + a = GG(a, b, c, d, x[5], S21, 0xd62f105dL); /* 21 */ + d = GG(d, a, b, c, x[10], S22, 0x2441453L); /* 22 */ + c = GG(c, d, a, b, x[15], S23, 0xd8a1e681L); /* 23 */ + b = GG(b, c, d, a, x[4], S24, 0xe7d3fbc8L); /* 24 */ + a = GG(a, b, c, d, x[9], S21, 0x21e1cde6L); /* 25 */ + d = GG(d, a, b, c, x[14], S22, 0xc33707d6L); /* 26 */ + c = GG(c, d, a, b, x[3], S23, 0xf4d50d87L); /* 27 */ + b = GG(b, c, d, a, x[8], S24, 0x455a14edL); /* 28 */ + a = GG(a, b, c, d, x[13], S21, 0xa9e3e905L); /* 29 */ + d = GG(d, a, b, c, x[2], S22, 0xfcefa3f8L); /* 30 */ + c = GG(c, d, a, b, x[7], S23, 0x676f02d9L); /* 31 */ + b = GG(b, c, d, a, x[12], S24, 0x8d2a4c8aL); /* 32 */ + + /* Round 3 */ + a = HH(a, b, c, d, x[5], S31, 0xfffa3942L); /* 33 */ + d = HH(d, a, b, c, x[8], S32, 0x8771f681L); /* 34 */ + c = HH(c, d, a, b, x[11], S33, 0x6d9d6122L); /* 35 */ + b = HH(b, c, d, a, x[14], S34, 0xfde5380cL); /* 36 */ + a = HH(a, b, c, d, x[1], S31, 0xa4beea44L); /* 37 */ + d = HH(d, a, b, c, x[4], S32, 0x4bdecfa9L); /* 38 */ + c = HH(c, d, a, b, x[7], S33, 0xf6bb4b60L); /* 39 */ + b = HH(b, c, d, a, x[10], S34, 0xbebfbc70L); /* 40 */ + a = HH(a, b, c, d, x[13], S31, 0x289b7ec6L); /* 41 */ + d = HH(d, a, b, c, x[0], S32, 0xeaa127faL); /* 42 */ + c = HH(c, d, a, b, x[3], S33, 0xd4ef3085L); /* 43 */ + b = HH(b, c, d, a, x[6], S34, 0x4881d05L); /* 44 */ + a = HH(a, b, c, d, x[9], S31, 0xd9d4d039L); /* 45 */ + d = HH(d, a, b, c, x[12], S32, 0xe6db99e5L); /* 46 */ + c = HH(c, d, a, b, x[15], S33, 0x1fa27cf8L); /* 47 */ + b = HH(b, c, d, a, x[2], S34, 0xc4ac5665L); /* 48 */ + + /* Round 4 */ + a = II(a, b, c, d, x[0], S41, 0xf4292244L); /* 49 */ + d = II(d, a, b, c, x[7], S42, 0x432aff97L); /* 50 */ + c = II(c, d, a, b, x[14], S43, 0xab9423a7L); /* 51 */ + b = II(b, c, d, a, x[5], S44, 0xfc93a039L); /* 52 */ + a = II(a, b, c, d, x[12], S41, 0x655b59c3L); /* 53 */ + d = II(d, a, b, c, x[3], S42, 0x8f0ccc92L); /* 54 */ + c = II(c, d, a, b, x[10], S43, 0xffeff47dL); /* 55 */ + b = II(b, c, d, a, x[1], S44, 0x85845dd1L); /* 56 */ + a = II(a, b, c, d, x[8], S41, 0x6fa87e4fL); /* 57 */ + d = II(d, a, b, c, x[15], S42, 0xfe2ce6e0L); /* 58 */ + c = II(c, d, a, b, x[6], S43, 0xa3014314L); /* 59 */ + b = II(b, c, d, a, x[13], S44, 0x4e0811a1L); /* 60 */ + a = II(a, b, c, d, x[4], S41, 0xf7537e82L); /* 61 */ + d = II(d, a, b, c, x[11], S42, 0xbd3af235L); /* 62 */ + c = II(c, d, a, b, x[2], S43, 0x2ad7d2bbL); /* 63 */ + b = II(b, c, d, a, x[9], S44, 0xeb86d391L); /* 64 */ + + state[0] = plus(state[0], a); + state[1] = plus(state[1], b); + state[2] = plus(state[2], c); + state[3] = plus(state[3], d); } public void update(final int bytes[]) { - do_update(clean_bytes(bytes)); + do_update(clean_bytes(bytes)); } public void update(final String s) { - do_update(to_bytes(s)); + do_update(to_bytes(s)); } private int[] encode(final long[] input, final int len) { - final int output[] = new int[len]; - int i, j; - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (int) (input[i] & 0xff); - output[j + 1] = (int) (input[i] >>> 8 & 0xff); - output[j + 2] = (int) (input[i] >>> 16 & 0xff); - output[j + 3] = (int) (input[i] >>> 24 & 0xff); - } - return output; + final int output[] = new int[len]; + int i, j; + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (int) (input[i] & 0xff); + output[j + 1] = (int) (input[i] >>> 8 & 0xff); + output[j + 2] = (int) (input[i] >>> 16 & 0xff); + output[j + 3] = (int) (input[i] >>> 24 & 0xff); + } + return output; } public int[] final_bytes() { - final int bits[] = encode(count, 8); - int index, padlen; - int padding[], i; - int[] digest; - - index = (int) (count[0] >>> 3 & 0x3f); - padlen = index < 56 ? 56 - index : 120 - index; - /* padlen > 0 */ - padding = new int[padlen]; - padding[0] = 0x80; - for (i = 1; i < padlen; ++i) { - padding[i] = 0; - } + final int bits[] = encode(count, 8); + int index, padlen; + int padding[], i; + int[] digest; + + index = (int) (count[0] >>> 3 & 0x3f); + padlen = index < 56 ? 56 - index : 120 - index; + /* padlen > 0 */ + padding = new int[padlen]; + padding[0] = 0x80; + for (i = 1; i < padlen; ++i) { + padding[i] = 0; + } - do_update(padding); + do_update(padding); - do_update(bits); + do_update(bits); - digest = encode(state, 16); + digest = encode(state, 16); - return digest; + return digest; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2010. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -23,25 +22,23 @@ *

    * Provides a carrier for Erlang messages. *

    - * + * *

    * Instances of this class are created to package header and payload information * in received Erlang messages so that the recipient can obtain both parts with * a single call to {@link OtpMbox#receiveMsg receiveMsg()}. *

    - * + * *

    - * The header information that is available is as follows: - *

      - *
    • a tag indicating the type of message - *
    • the intended recipient of the message, either as a {@link OtpErlangPid - * pid} or as a String, but never both. - *
    • (sometimes) the sender of the message. Due to some eccentric + * The header information that is available is as follows:
        + *
      • a tag indicating the type of message + *
      • the intended recipient of the message, either as a + * {@link OtpErlangPid pid} or as a String, but never both. + *
      • (sometimes) the sender of the message. Due to some eccentric * characteristics of the Erlang distribution protocol, not all messages have * information about the sending process. In particular, only messages whose tag - * is {@link OtpMsg#regSendTag regSendTag} contain sender information. - *
      - * + * is {@link OtpMsg#regSendTag regSendTag} contain sender information.
    + * *

    * Message are sent using the Erlang external format (see separate * documentation). When a message is received and delivered to the recipient @@ -71,87 +68,86 @@ // send has receiver pid but no sender information OtpMsg(final OtpErlangPid to, final OtpInputStream paybuf) { - tag = sendTag; - from = null; - this.to = to; - toName = null; - this.paybuf = paybuf; - payload = null; + tag = sendTag; + from = null; + this.to = to; + toName = null; + this.paybuf = paybuf; + payload = null; } // send has receiver pid but no sender information OtpMsg(final OtpErlangPid to, final OtpErlangObject payload) { - tag = sendTag; - from = null; - this.to = to; - toName = null; - paybuf = null; - this.payload = payload; + tag = sendTag; + from = null; + this.to = to; + toName = null; + paybuf = null; + this.payload = payload; } // send_reg has sender pid and receiver name OtpMsg(final OtpErlangPid from, final String toName, - final OtpInputStream paybuf) { - tag = regSendTag; - this.from = from; - this.toName = toName; - to = null; - this.paybuf = paybuf; - payload = null; + final OtpInputStream paybuf) { + tag = regSendTag; + this.from = from; + this.toName = toName; + to = null; + this.paybuf = paybuf; + payload = null; } // send_reg has sender pid and receiver name OtpMsg(final OtpErlangPid from, final String toName, - final OtpErlangObject payload) { - tag = regSendTag; - this.from = from; - this.toName = toName; - to = null; - paybuf = null; - this.payload = payload; + final OtpErlangObject payload) { + tag = regSendTag; + this.from = from; + this.toName = toName; + to = null; + paybuf = null; + this.payload = payload; } // exit (etc) has from, to, reason OtpMsg(final int tag, final OtpErlangPid from, final OtpErlangPid to, - final OtpErlangObject reason) { - this.tag = tag; - this.from = from; - this.to = to; - paybuf = null; - payload = reason; + final OtpErlangObject reason) { + this.tag = tag; + this.from = from; + this.to = to; + paybuf = null; + payload = reason; } // special case when reason is an atom (i.e. most of the time) OtpMsg(final int tag, final OtpErlangPid from, final OtpErlangPid to, - final String reason) { - this.tag = tag; - this.from = from; - this.to = to; - paybuf = null; - payload = new OtpErlangAtom(reason); + final String reason) { + this.tag = tag; + this.from = from; + this.to = to; + paybuf = null; + payload = new OtpErlangAtom(reason); } // other message types (link, unlink) - OtpMsg(final int tag, final OtpErlangPid from, final OtpErlangPid to) { - // convert TT-tags to equiv non-TT versions - int atag = tag; - if (tag > 10) { - atag -= 10; - } - - this.tag = atag; - this.from = from; - this.to = to; + OtpMsg(int tag, final OtpErlangPid from, final OtpErlangPid to) { + // convert TT-tags to equiv non-TT versions + if (tag > 10) { + tag -= 10; + } + + this.tag = tag; + this.from = from; + this.to = to; } /** * Get the payload from this message without deserializing it. - * + * * @return the serialized Erlang term contained in this message. - * + * */ OtpInputStream getMsgBuf() { - return paybuf; + return paybuf; } /** @@ -160,37 +156,36 @@ * type of message. Valid values are the ``tag'' constants defined in this * class. *

    - * + * *

    * The tab identifies not only the type of message but also the content of * the OtpMsg object, since different messages have different components, as * follows: *

    - * + * *
      - *
    • sendTag identifies a "normal" message. The recipient is a - * {@link OtpErlangPid Pid} and it is available through - * {@link #getRecipientPid getRecipientPid()}. Sender information is not - * available. The message body can be retrieved with {@link #getMsg - * getMsg()}.
    • - * - *
    • regSendTag also identifies a "normal" message. The recipient here is + *
    • sendTag identifies a "normal" message. The recipient is a + * {@link OtpErlangPid Pid} and it is available through {@link + * #getRecipientPid getRecipientPid()}. Sender information is not available. + * The message body can be retrieved with {@link #getMsg getMsg()}.
    • + * + *
    • regSendTag also identifies a "normal" message. The recipient here is * a String and it is available through {@link #getRecipientName * getRecipientName()}. Sender information is available through * #getSenderPid getSenderPid()}. The message body can be retrieved with - * {@link #getMsg getMsg()}.
    • - * - *
    • linkTag identifies a link request. The Pid of the sender is - * available, as well as the Pid to which the link should be made.
    • - * - *
    • exitTag and exit2Tag messages are sent as a result of broken links. + * {@link #getMsg getMsg()}.
    • + * + *
    • linkTag identifies a link request. The Pid of the sender is + * available, as well as the Pid to which the link should be made.
    • + * + *
    • exitTag and exit2Tag messages are sent as a result of broken links. * Both sender and recipient Pids and are available through the * corresponding methods, and the "reason" is available through - * {@link #getMsg getMsg()}.
    • + * {@link #getMsg getMsg()}. *
    */ public int type() { - return tag; + return tag; } /** @@ -198,42 +193,42 @@ * Deserialize and return a new copy of the message contained in this * OtpMsg. *

    - * + * *

    * The first time this method is called the actual payload is deserialized * and the Erlang term is created. Calling this method subsequent times will * not cuase the message to be deserialized additional times, instead the * same Erlang term object will be returned. *

    - * + * * @return an Erlang term. - * + * * @exception OtpErlangDecodeException - * if the byte stream could not be deserialized. - * + * if the byte stream could not be deserialized. + * */ public OtpErlangObject getMsg() throws OtpErlangDecodeException { - if (payload == null) { - payload = paybuf.read_any(); - } - return payload; + if (payload == null) { + payload = paybuf.read_any(); + } + return payload; } /** *

    * Get the name of the recipient for this message. *

    - * + * *

    * Messages are sent to Pids or names. If this message was sent to a name * then the name is returned by this method. *

    - * + * * @return the name of the recipient, or null if the recipient was in fact a * Pid. */ public String getRecipientName() { - return toName; + return toName; } /** @@ -241,18 +236,18 @@ * Get the Pid of the recipient for this message, if it is a sendTag * message. *

    - * + * *

    * Messages are sent to Pids or names. If this message was sent to a Pid * then the Pid is returned by this method. The recipient Pid is also * available for link, unlink and exit messages. *

    - * + * * @return the Pid of the recipient, or null if the recipient was in fact a * name. */ public OtpErlangPid getRecipientPid() { - return to; + return to; } /** @@ -260,36 +255,36 @@ * Get the name of the recipient for this message, if it is a regSendTag * message. *

    - * + * *

    * Messages are sent to Pids or names. If this message was sent to a name * then the name is returned by this method. *

    - * + * * @return the Pid of the recipient, or null if the recipient was in fact a * name. */ public Object getRecipient() { - if (toName != null) { - return toName; - } - return to; + if (toName != null) { + return toName; + } + return to; } /** *

    * Get the Pid of the sender of this message. *

    - * + * *

    * For messages sent to names, the Pid of the sender is included with the * message. The sender Pid is also available for link, unlink and exit * messages. It is not available for sendTag messages sent to Pids. *

    - * + * * @return the Pid of the sender, or null if it was not available. */ public OtpErlangPid getSenderPid() { - return from; + return from; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNode.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNode.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNode.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNode.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,26 +1,27 @@ -/* +/* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2012. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; import java.io.IOException; import java.lang.ref.WeakReference; +import java.net.ServerSocket; +import java.net.Socket; import java.util.Collection; import java.util.Enumeration; import java.util.Hashtable; @@ -35,21 +36,21 @@ * communication mechanism is automatic and hidden from the application * programmer. *

    - * + * *

    * Once an instance of this class has been created, obtain one or more mailboxes * in order to send or receive messages. The first message sent to a given node * will cause a connection to be set up to that node. Any messages received will * be delivered to the appropriate mailboxes. *

    - * + * *

    * To shut down the node, call {@link #close close()}. This will prevent the * node from accepting additional connections and it will cause all existing * connections to be closed. Any unread messages in existing mailboxes can still * be read, however no new messages will be delivered to the mailboxes. *

    - * + * *

    * Note that the use of this class requires that Epmd (Erlang Port Mapper * Daemon) is running on each cooperating host. This class does not start Epmd @@ -73,7 +74,7 @@ OtpNodeStatus handler; // flags - private int connFlags = 0; + private int flags = 0; /** *

    @@ -82,156 +83,74 @@ * directory. The home directory is obtained from the System property * "user.home". *

    - * + * *

    * If the file does not exist, an empty string is used. This method makes no * attempt to create the file. *

    - * + * * @param node * the name of this node. - * + * * @exception IOException * if communication could not be initialized. - * + * */ public OtpNode(final String node) throws IOException { - super(node); - - init(0); - } - - /** - *

    - * Create a node using the default cookie. The default cookie is found by - * reading the first line of the .erlang.cookie file in the user's home - * directory. The home directory is obtained from the System property - * "user.home". - *

    - * - *

    - * If the file does not exist, an empty string is used. This method makes no - * attempt to create the file. - *

    - * - * @param node - * the name of this node. - * - * @param transportFactory - * the transport factory to use when creating connections. - * - * @exception IOException - * if communication could not be initialized. - * - */ - public OtpNode(final String node, - final OtpTransportFactory transportFactory) throws IOException { - super(node, transportFactory); - - init(0); + this(node, defaultCookie, 0); } /** * Create a node. - * + * * @param node * the name of this node. - * + * * @param cookie * the authorization cookie that will be used by this node when * it communicates with other nodes. - * + * * @exception IOException * if communication could not be initialized. - * + * */ public OtpNode(final String node, final String cookie) throws IOException { - this(node, cookie, 0); - } - - /** - * Create a node. - * - * @param node - * the name of this node. - * - * @param cookie - * the authorization cookie that will be used by this node when - * it communicates with other nodes. - * - * @param transportFactory - * the transport factory to use when creating connections. - * - * @exception IOException - * if communication could not be initialized. - * - */ - public OtpNode(final String node, final String cookie, - final OtpTransportFactory transportFactory) throws IOException { - this(node, cookie, 0, transportFactory); + this(node, cookie, 0); } /** * Create a node. - * + * * @param node * the name of this node. - * + * * @param cookie * the authorization cookie that will be used by this node when * it communicates with other nodes. - * + * * @param port * the port number you wish to use for incoming connections. * Specifying 0 lets the system choose an available port. - * + * * @exception IOException * if communication could not be initialized. - * + * */ public OtpNode(final String node, final String cookie, final int port) - throws IOException { - super(node, cookie); + throws IOException { + super(node, cookie); - init(port); + init(port); } - /** - * Create a node. - * - * @param node - * the name of this node. - * - * @param cookie - * the authorization cookie that will be used by this node when - * it communicates with other nodes. - * - * @param port - * the port number you wish to use for incoming connections. - * Specifying 0 lets the system choose an available port. - * - * @param transportFactory - * the transport factory to use when creating connections. - * - * @exception IOException - * if communication could not be initialized. - * - */ - public OtpNode(final String node, final String cookie, final int port, - final OtpTransportFactory transportFactory) throws IOException { - super(node, cookie, transportFactory); - - init(port); - } - - private synchronized void init(final int aport) throws IOException { - if (!initDone) { - connections = new Hashtable(17, - (float) 0.95); - mboxes = new Mailboxes(); - acceptor = new Acceptor(aport); - initDone = true; - } + private synchronized void init(final int port) throws IOException { + if (!initDone) { + connections = new Hashtable(17, + (float) 0.95); + mboxes = new Mailboxes(); + acceptor = new Acceptor(port); + initDone = true; + } } /** @@ -239,24 +158,24 @@ * and close all existing connections. */ public synchronized void close() { - acceptor.quit(); - OtpCookedConnection conn; - final Collection coll = connections.values(); - final Iterator it = coll.iterator(); - - mboxes.clear(); - - while (it.hasNext()) { - conn = it.next(); - it.remove(); - conn.close(); - } - initDone = false; + acceptor.quit(); + OtpCookedConnection conn; + final Collection coll = connections.values(); + final Iterator it = coll.iterator(); + + mboxes.clear(); + + while (it.hasNext()) { + conn = it.next(); + it.remove(); + conn.close(); + } + initDone = false; } @Override protected void finalize() { - close(); + close(); } /** @@ -264,65 +183,65 @@ * receive messages with other, similar mailboxes and with Erlang processes. * Messages can be sent to this mailbox by using its associated * {@link OtpMbox#self() pid}. - * + * * @return a mailbox. */ public OtpMbox createMbox() { - return mboxes.create(); + return mboxes.create(); } /** * Close the specified mailbox with reason 'normal'. - * + * * @param mbox * the mailbox to close. - * + * *

    * After this operation, the mailbox will no longer be able to * receive messages. Any delivered but as yet unretrieved * messages can still be retrieved however. *

    - * + * *

    * If there are links from the mailbox to other * {@link OtpErlangPid pids}, they will be broken when this * method is called and exit signals with reason 'normal' will be * sent. *

    - * + * */ public void closeMbox(final OtpMbox mbox) { - closeMbox(mbox, new OtpErlangAtom("normal")); + closeMbox(mbox, new OtpErlangAtom("normal")); } /** * Close the specified mailbox with the given reason. - * + * * @param mbox * the mailbox to close. * @param reason * an Erlang term describing the reason for the termination. - * + * *

    * After this operation, the mailbox will no longer be able to * receive messages. Any delivered but as yet unretrieved * messages can still be retrieved however. *

    - * + * *

    * If there are links from the mailbox to other * {@link OtpErlangPid pids}, they will be broken when this * method is called and exit signals with the given reason will * be sent. *

    - * + * */ public void closeMbox(final OtpMbox mbox, final OtpErlangObject reason) { - if (mbox != null) { - mboxes.remove(mbox); - mbox.name = null; - mbox.breakLinks(reason); - } + if (mbox != null) { + mboxes.remove(mbox); + mbox.name = null; + mbox.breakLinks(reason); + } } /** @@ -330,16 +249,16 @@ * with other, similar mailboxes and with Erlang processes. Messages can be * sent to this mailbox by using its registered name or the associated * {@link OtpMbox#self() pid}. - * + * * @param name * a name to register for this mailbox. The name must be unique * within this OtpNode. - * + * * @return a mailbox, or null if the name was already in use. - * + * */ public OtpMbox createMbox(final String name) { - return mboxes.create(name); + return mboxes.create(name); } /** @@ -350,58 +269,58 @@ * name; if the mailbox already had a name, calling this method will * supercede that name. *

    - * + * * @param name * the name to register for the mailbox. Specify null to * unregister the existing name from this mailbox. - * + * * @param mbox * the mailbox to associate with the name. - * + * * @return true if the name was available, or false otherwise. */ public boolean registerName(final String name, final OtpMbox mbox) { - return mboxes.register(name, mbox); + return mboxes.register(name, mbox); } /** * Get a list of all known registered names on this node. - * + * * @return an array of Strings, containins all known registered names on * this node. */ public String[] getNames() { - return mboxes.names(); + return mboxes.names(); } /** * Determine the {@link OtpErlangPid pid} corresponding to a registered name * on this node. - * + * * @return the {@link OtpErlangPid pid} corresponding to the registered * name, or null if the name is not known on this node. */ public OtpErlangPid whereis(final String name) { - final OtpMbox m = mboxes.get(name); - if (m != null) { - return m.self(); - } - return null; + final OtpMbox m = mboxes.get(name); + if (m != null) { + return m.self(); + } + return null; } /** * Register interest in certain system events. The {@link OtpNodeStatus * OtpNodeStatus} handler object contains callback methods, that will be * called when certain events occur. - * - * @param ahandler + * + * @param handler * the callback object to register. To clear the handler, specify * null as the handler to use. - * + * */ - public synchronized void registerStatusHandler(final OtpNodeStatus ahandler) { - handler = ahandler; + public synchronized void registerStatusHandler(final OtpNodeStatus handler) { + this.handler = handler; } /** @@ -410,7 +329,7 @@ * setting up a connection to the remote node (if possible). Only a single * outgoing message is sent; the timeout is how long to wait for a response. *

    - * + * *

    * Only a single attempt is made to connect to the remote node, so for * example it is not possible to specify an extremely long timeout and @@ -418,73 +337,74 @@ * wait for a remote node to be started, the following construction may be * useful: *

    - * + * *
          * // ping every 2 seconds until positive response
          * while (!me.ping(him, 2000))
          *     ;
          * 
    - * - * @param anode + * + * @param node * the name of the node to ping. - * + * * @param timeout * the time, in milliseconds, to wait for response before * returning false. - * + * * @return true if the node was alive and the correct ping response was * returned. false if the correct response was not returned on time. */ /* * internal info about the message formats... - * + * * the request: -> REG_SEND {6,#Pid,'',net_kernel} * {'$gen_call',{#Pid,#Ref},{is_auth,bingo@aule}} - * + * * the reply: <- SEND {2,'',#Pid} {#Ref,yes} */ - public boolean ping(final String anode, final long timeout) { - if (anode.equals(node)) { - return true; - } else if (anode.indexOf('@', 0) < 0 - && anode.equals(node.substring(0, node.indexOf('@', 0)))) { - return true; - } - - // other node - OtpMbox mbox = null; - try { - mbox = createMbox(); - mbox.send("net_kernel", anode, getPingTuple(mbox)); - final OtpErlangObject reply = mbox.receive(timeout); - - final OtpErlangTuple t = (OtpErlangTuple) reply; - final OtpErlangAtom a = (OtpErlangAtom) t.elementAt(1); - return "yes".equals(a.atomValue()); - } catch (final Exception e) { - } finally { - closeMbox(mbox); - } - return false; + public boolean ping(final String node, final long timeout) { + if (node.equals(this.node)) { + return true; + } else if (node.indexOf('@', 0) < 0 + && node.equals(this.node + .substring(0, this.node.indexOf('@', 0)))) { + return true; + } + + // other node + OtpMbox mbox = null; + try { + mbox = createMbox(); + mbox.send("net_kernel", node, getPingTuple(mbox)); + final OtpErlangObject reply = mbox.receive(timeout); + + final OtpErlangTuple t = (OtpErlangTuple) reply; + final OtpErlangAtom a = (OtpErlangAtom) t.elementAt(1); + return "yes".equals(a.atomValue()); + } catch (final Exception e) { + } finally { + closeMbox(mbox); + } + return false; } /* create the outgoing ping message */ private OtpErlangTuple getPingTuple(final OtpMbox mbox) { - final OtpErlangObject[] ping = new OtpErlangObject[3]; - final OtpErlangObject[] pid = new OtpErlangObject[2]; - final OtpErlangObject[] anode = new OtpErlangObject[2]; + final OtpErlangObject[] ping = new OtpErlangObject[3]; + final OtpErlangObject[] pid = new OtpErlangObject[2]; + final OtpErlangObject[] node = new OtpErlangObject[2]; - pid[0] = mbox.self(); - pid[1] = createRef(); + pid[0] = mbox.self(); + pid[1] = createRef(); - anode[0] = new OtpErlangAtom("is_auth"); - anode[1] = new OtpErlangAtom(node()); + node[0] = new OtpErlangAtom("is_auth"); + node[1] = new OtpErlangAtom(node()); - ping[0] = new OtpErlangAtom("$gen_call"); - ping[1] = new OtpErlangTuple(pid); - ping[2] = new OtpErlangTuple(anode); + ping[0] = new OtpErlangAtom("$gen_call"); + ping[1] = new OtpErlangTuple(pid); + ping[2] = new OtpErlangTuple(node); - return new OtpErlangTuple(ping); + return new OtpErlangTuple(ping); } /* @@ -492,27 +412,27 @@ * pings. */ private boolean netKernel(final OtpMsg m) { - OtpMbox mbox = null; - try { - final OtpErlangTuple t = (OtpErlangTuple) m.getMsg(); - final OtpErlangTuple req = (OtpErlangTuple) t.elementAt(1); // actual - // request - - final OtpErlangPid pid = (OtpErlangPid) req.elementAt(0); // originating - // pid - - final OtpErlangObject[] pong = new OtpErlangObject[2]; - pong[0] = req.elementAt(1); // his #Ref - pong[1] = new OtpErlangAtom("yes"); - - mbox = createMbox(); - mbox.send(pid, new OtpErlangTuple(pong)); - return true; - } catch (final Exception e) { - } finally { - closeMbox(mbox); - } - return false; + OtpMbox mbox = null; + try { + final OtpErlangTuple t = (OtpErlangTuple) m.getMsg(); + final OtpErlangTuple req = (OtpErlangTuple) t.elementAt(1); // actual + // request + + final OtpErlangPid pid = (OtpErlangPid) req.elementAt(0); // originating + // pid + + final OtpErlangObject[] pong = new OtpErlangObject[2]; + pong[0] = req.elementAt(1); // his #Ref + pong[1] = new OtpErlangAtom("yes"); + + mbox = createMbox(); + mbox.send(pid, new OtpErlangTuple(pong)); + return true; + } catch (final Exception e) { + } finally { + closeMbox(mbox); + } + return false; } /* @@ -520,31 +440,32 @@ * delivered successfully, or false otherwise. */ boolean deliver(final OtpMsg m) { - OtpMbox mbox = null; + OtpMbox mbox = null; - try { - final int t = m.type(); + try { + final int t = m.type(); - if (t == OtpMsg.regSendTag) { - final String name = m.getRecipientName(); - /* special case for netKernel requests */ - if (name.equals("net_kernel")) { - return netKernel(m); - } - mbox = mboxes.get(name); - } else { - mbox = mboxes.get(m.getRecipientPid()); - } - - if (mbox == null) { - return false; - } - mbox.deliver(m); - } catch (final Exception e) { - return false; - } + if (t == OtpMsg.regSendTag) { + final String name = m.getRecipientName(); + /* special case for netKernel requests */ + if (name.equals("net_kernel")) { + return netKernel(m); + } else { + mbox = mboxes.get(name); + } + } else { + mbox = mboxes.get(m.getRecipientPid()); + } + + if (mbox == null) { + return false; + } + mbox.deliver(m); + } catch (final Exception e) { + return false; + } - return true; + return true; } /* @@ -552,86 +473,86 @@ * specified by the application */ void deliverError(final OtpCookedConnection conn, final Exception e) { - removeConnection(conn); - remoteStatus(conn.name, false, e); + removeConnection(conn); + remoteStatus(conn.name, false, e); } /* * find or create a connection to the given node */ - OtpCookedConnection getConnection(final String anode) { - OtpPeer peer = null; - OtpCookedConnection conn = null; - - synchronized (connections) { - // first just try looking up the name as-is - conn = connections.get(anode); - - if (conn == null) { - // in case node had no '@' add localhost info and try again - peer = new OtpPeer(anode); - conn = connections.get(peer.node()); - - if (conn == null) { - try { - conn = new OtpCookedConnection(this, peer); - conn.setFlags(connFlags); - addConnection(conn); - } catch (final Exception e) { - /* false = outgoing */ - connAttempt(peer.node(), false, e); - } - } - } - return conn; - } + OtpCookedConnection getConnection(final String node) { + OtpPeer peer = null; + OtpCookedConnection conn = null; + + synchronized (connections) { + // first just try looking up the name as-is + conn = connections.get(node); + + if (conn == null) { + // in case node had no '@' add localhost info and try again + peer = new OtpPeer(node); + conn = connections.get(peer.node()); + + if (conn == null) { + try { + conn = new OtpCookedConnection(this, peer); + conn.setFlags(flags); + addConnection(conn); + } catch (final Exception e) { + /* false = outgoing */ + connAttempt(peer.node(), false, e); + } + } + } + return conn; + } } void addConnection(final OtpCookedConnection conn) { - if (conn != null && conn.name != null) { - connections.put(conn.name, conn); - remoteStatus(conn.name, true, null); - } + if (conn != null && conn.name != null) { + connections.put(conn.name, conn); + remoteStatus(conn.name, true, null); + } } private void removeConnection(final OtpCookedConnection conn) { - if (conn != null && conn.name != null) { - connections.remove(conn.name); - } + if (conn != null && conn.name != null) { + connections.remove(conn.name); + } } /* use these wrappers to call handler functions */ - private synchronized void remoteStatus(final String anode, - final boolean up, final Object info) { - if (handler == null) { - return; - } - try { - handler.remoteStatus(anode, up, info); - } catch (final Exception e) { - } - } - - synchronized void localStatus(final String anode, final boolean up, - final Object info) { - if (handler == null) { - return; - } - try { - handler.localStatus(anode, up, info); - } catch (final Exception e) { - } - } - - synchronized void connAttempt(final String anode, final boolean incoming, - final Object info) { - if (handler == null) { - return; - } - try { - handler.connAttempt(anode, incoming, info); - } catch (final Exception e) { - } + private synchronized void remoteStatus(final String node, final boolean up, + final Object info) { + if (handler == null) { + return; + } + try { + handler.remoteStatus(node, up, info); + } catch (final Exception e) { + } + } + + synchronized void localStatus(final String node, final boolean up, + final Object info) { + if (handler == null) { + return; + } + try { + handler.localStatus(node, up, info); + } catch (final Exception e) { + } + } + + synchronized void connAttempt(final String node, final boolean incoming, + final Object info) { + if (handler == null) { + return; + } + try { + handler.connAttempt(node, incoming, info); + } catch (final Exception e) { + } } /* @@ -639,248 +560,248 @@ * references */ public class Mailboxes { - // mbox pids here - private Hashtable> byPid = null; - // mbox names here - private Hashtable> byName = null; - - public Mailboxes() { - byPid = new Hashtable>(17, - (float) 0.95); - byName = new Hashtable>(17, - (float) 0.95); - } - - public OtpMbox create(final String name) { - OtpMbox m = null; - - synchronized (byName) { - if (get(name) != null) { - return null; - } - final OtpErlangPid pid = createPid(); - m = new OtpMbox(OtpNode.this, pid, name); - byPid.put(pid, new WeakReference(m)); - byName.put(name, new WeakReference(m)); - } - return m; - } - - public OtpMbox create() { - final OtpErlangPid pid = createPid(); - final OtpMbox m = new OtpMbox(OtpNode.this, pid); - byPid.put(pid, new WeakReference(m)); - return m; - } - - public void clear() { - byPid.clear(); - byName.clear(); - } - - public String[] names() { - String allnames[] = null; - - synchronized (byName) { - final int n = byName.size(); - final Enumeration keys = byName.keys(); - allnames = new String[n]; - - int i = 0; - while (keys.hasMoreElements()) { - allnames[i++] = keys.nextElement(); - } - } - return allnames; - } - - public boolean register(final String name, final OtpMbox mbox) { - if (name == null) { - if (mbox.name != null) { - byName.remove(mbox.name); - mbox.name = null; - } - } else { - synchronized (byName) { - if (get(name) != null) { - return false; - } - byName.put(name, new WeakReference(mbox)); - mbox.name = name; - } - } - return true; - } - - /* - * look up a mailbox based on its name. If the mailbox has gone out of - * scope we also remove the reference from the hashtable so we don't - * find it again. - */ - public OtpMbox get(final String name) { - final WeakReference wr = byName.get(name); - - if (wr != null) { - final OtpMbox m = wr.get(); - - if (m != null) { - return m; - } - byName.remove(name); - } - return null; - } - - /* - * look up a mailbox based on its pid. If the mailbox has gone out of - * scope we also remove the reference from the hashtable so we don't - * find it again. - */ - public OtpMbox get(final OtpErlangPid pid) { - final WeakReference wr = byPid.get(pid); - - if (wr != null) { - final OtpMbox m = wr.get(); - - if (m != null) { - return m; - } - byPid.remove(pid); - } - return null; - } - - public void remove(final OtpMbox mbox) { - byPid.remove(mbox.self); - if (mbox.name != null) { - byName.remove(mbox.name); - } - } + // mbox pids here + private Hashtable> byPid = null; + // mbox names here + private Hashtable> byName = null; + + public Mailboxes() { + byPid = new Hashtable>(17, + (float) 0.95); + byName = new Hashtable>(17, + (float) 0.95); + } + + public OtpMbox create(final String name) { + OtpMbox m = null; + + synchronized (byName) { + if (get(name) != null) { + return null; + } + final OtpErlangPid pid = createPid(); + m = new OtpMbox(OtpNode.this, pid, name); + byPid.put(pid, new WeakReference(m)); + byName.put(name, new WeakReference(m)); + } + return m; + } + + public OtpMbox create() { + final OtpErlangPid pid = createPid(); + final OtpMbox m = new OtpMbox(OtpNode.this, pid); + byPid.put(pid, new WeakReference(m)); + return m; + } + + public void clear() { + byPid.clear(); + byName.clear(); + } + + public String[] names() { + String allnames[] = null; + + synchronized (byName) { + final int n = byName.size(); + final Enumeration keys = byName.keys(); + allnames = new String[n]; + + int i = 0; + while (keys.hasMoreElements()) { + allnames[i++] = keys.nextElement(); + } + } + return allnames; + } + + public boolean register(final String name, final OtpMbox mbox) { + if (name == null) { + if (mbox.name != null) { + byName.remove(mbox.name); + mbox.name = null; + } + } else { + synchronized (byName) { + if (get(name) != null) { + return false; + } + byName.put(name, new WeakReference(mbox)); + mbox.name = name; + } + } + return true; + } + + /* + * look up a mailbox based on its name. If the mailbox has gone out of + * scope we also remove the reference from the hashtable so we don't + * find it again. + */ + public OtpMbox get(final String name) { + final WeakReference wr = byName.get(name); + + if (wr != null) { + final OtpMbox m = wr.get(); + + if (m != null) { + return m; + } + byName.remove(name); + } + return null; + } + + /* + * look up a mailbox based on its pid. If the mailbox has gone out of + * scope we also remove the reference from the hashtable so we don't + * find it again. + */ + public OtpMbox get(final OtpErlangPid pid) { + final WeakReference wr = byPid.get(pid); + + if (wr != null) { + final OtpMbox m = wr.get(); + + if (m != null) { + return m; + } + byPid.remove(pid); + } + return null; + } + + public void remove(final OtpMbox mbox) { + byPid.remove(mbox.self); + if (mbox.name != null) { + byName.remove(mbox.name); + } + } } /* * this thread simply listens for incoming connections */ public class Acceptor extends Thread { - private final OtpServerTransport sock; - private final int acceptorPort; - private volatile boolean done = false; - - Acceptor(final int port) throws IOException { - sock = createServerTransport(port); - acceptorPort = sock.getLocalPort(); - OtpNode.this.port = acceptorPort; - - setDaemon(true); - setName("acceptor"); - publishPort(); - start(); - } - - private boolean publishPort() throws IOException { - if (getEpmd() != null) { - return false; // already published - } - OtpEpmd.publishPort(OtpNode.this); - return true; - } - - private void unPublishPort() { - // unregister with epmd - OtpEpmd.unPublishPort(OtpNode.this); - - // close the local descriptor (if we have one) - closeSock(epmd); - epmd = null; - } - - public void quit() { - unPublishPort(); - done = true; - closeSock(sock); - localStatus(node, false, null); - } - - private void closeSock(final OtpServerTransport s) { - try { - if (s != null) { - s.close(); - } - } catch (final Exception e) { - } - } - - private void closeSock(final OtpTransport s) { - try { - if (s != null) { - s.close(); - } - } catch (final Exception e) { - } - } - - public int port() { - return acceptorPort; - } - - @Override - public void run() { - OtpTransport newsock = null; - OtpCookedConnection conn = null; - - localStatus(node, true, null); - - accept_loop: while (!done) { - conn = null; - - try { - newsock = sock.accept(); - } catch (final Exception e) { - // Problem in java1.2.2: accept throws SocketException - // when socket is closed. This will happen when - // acceptor.quit() - // is called. acceptor.quit() will call localStatus(...), so - // we have to check if that's where we come from. - if (!done) { - localStatus(node, false, e); - } - break accept_loop; - } - - try { - synchronized (connections) { - conn = new OtpCookedConnection(OtpNode.this, newsock); - conn.setFlags(connFlags); - addConnection(conn); - } - } catch (final OtpAuthException e) { - if (conn != null && conn.name != null) { - connAttempt(conn.name, true, e); - } else { - connAttempt("unknown", true, e); - } - closeSock(newsock); - } catch (final IOException e) { - if (conn != null && conn.name != null) { - connAttempt(conn.name, true, e); - } else { - connAttempt("unknown", true, e); - } - closeSock(newsock); - } catch (final Exception e) { - closeSock(newsock); - closeSock(sock); - localStatus(node, false, e); - break accept_loop; - } - } // while - - // if we have exited loop we must do this too - unPublishPort(); - } + private final ServerSocket sock; + private final int port; + private volatile boolean done = false; + + Acceptor(final int port) throws IOException { + sock = new ServerSocket(port); + this.port = sock.getLocalPort(); + OtpNode.this.port = this.port; + + setDaemon(true); + setName("acceptor"); + publishPort(); + start(); + } + + private boolean publishPort() throws IOException { + if (getEpmd() != null) { + return false; // already published + } + OtpEpmd.publishPort(OtpNode.this); + return true; + } + + private void unPublishPort() { + // unregister with epmd + OtpEpmd.unPublishPort(OtpNode.this); + + // close the local descriptor (if we have one) + closeSock(epmd); + epmd = null; + } + + public void quit() { + unPublishPort(); + done = true; + closeSock(sock); + localStatus(node, false, null); + } + + private void closeSock(final ServerSocket s) { + try { + if (s != null) { + s.close(); + } + } catch (final Exception e) { + } + } + + private void closeSock(final Socket s) { + try { + if (s != null) { + s.close(); + } + } catch (final Exception e) { + } + } + + public int port() { + return port; + } + + @Override + public void run() { + Socket newsock = null; + OtpCookedConnection conn = null; + + localStatus(node, true, null); + + accept_loop: while (!done) { + conn = null; + + try { + newsock = sock.accept(); + } catch (final Exception e) { + // Problem in java1.2.2: accept throws SocketException + // when socket is closed. This will happen when + // acceptor.quit() + // is called. acceptor.quit() will call localStatus(...), so + // we have to check if that's where we come from. + if (!done) { + localStatus(node, false, e); + } + break accept_loop; + } + + try { + synchronized (connections) { + conn = new OtpCookedConnection(OtpNode.this, newsock); + conn.setFlags(flags); + addConnection(conn); + } + } catch (final OtpAuthException e) { + if (conn != null && conn.name != null) { + connAttempt(conn.name, true, e); + } else { + connAttempt("unknown", true, e); + } + closeSock(newsock); + } catch (final IOException e) { + if (conn != null && conn.name != null) { + connAttempt(conn.name, true, e); + } else { + connAttempt("unknown", true, e); + } + closeSock(newsock); + } catch (final Exception e) { + closeSock(newsock); + closeSock(sock); + localStatus(node, false, e); + break accept_loop; + } + } // while + + // if we have exited loop we must do this too + unPublishPort(); + } } public void setFlags(final int flags) { - connFlags = flags; + this.flags = flags; } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNodeStatus.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNodeStatus.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNodeStatus.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNodeStatus.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -26,13 +25,13 @@ * with your {@link OtpNode OtpNode} when you wish to be notified about such * status changes and other similar events. *

    - * + * *

    * This class provides default handers that ignore all events. Applications are * expected to extend this class in order to act on events that are deemed * interesting. *

    - * + * *

    * Note that this class is likely to change in the near future *

    @@ -43,57 +42,59 @@ /** * Notify about remote node status changes. - * + * * @param node - * the node whose status change is being indicated by this call. - * + * the node whose status change is being indicated by this + * call. + * * @param up - * true if the node has come up, false if it has gone down. - * + * true if the node has come up, false if it has gone down. + * * @param info - * additional info that may be available, for example an - * exception that was raised causing the event in question (may - * be null). - * + * additional info that may be available, for example an + * exception that was raised causing the event in question + * (may be null). + * */ public void remoteStatus(final String node, final boolean up, - final Object info) { + final Object info) { } /** * Notify about local node exceptions. - * + * * @param node - * the node whose status change is being indicated by this call. - * + * the node whose status change is being indicated by this + * call. + * * @param up - * true if the node has come up, false if it has gone down. - * + * true if the node has come up, false if it has gone down. + * * @param info - * additional info that may be available, for example an - * exception that was raised causing the event in question (may - * be null). + * additional info that may be available, for example an + * exception that was raised causing the event in question + * (may be null). */ public void localStatus(final String node, final boolean up, - final Object info) { + final Object info) { } /** * Notify about failed connection attempts. - * + * * @param node - * The name of the remote node - * + * The name of the remote node + * * @param incoming - * The direction of the connection attempt, i.e. true for - * incoming, false for outgoing. - * + * The direction of the connection attempt, i.e. true for + * incoming, false for outgoing. + * * @param info - * additional info that may be available, for example an - * exception that was raised causing the event in question (may - * be null). + * additional info that may be available, for example an + * exception that was raised causing the event in question + * (may be null). */ public void connAttempt(final String node, final boolean incoming, - final Object info) { + final Object info) { } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2013. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -22,38 +21,32 @@ // import java.io.OutputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.math.BigInteger; import java.text.DecimalFormat; +import java.util.Arrays; import java.util.zip.Deflater; /** * Provides a stream for encoding Erlang terms to external format, for * transmission or storage. - * + * *

    * Note that this class is not synchronized, if you need synchronization you * must provide it yourself. - * + * */ public class OtpOutputStream extends ByteArrayOutputStream { /** The default initial size of the stream. * */ public static final int defaultInitialSize = 2048; - /** - * The default increment used when growing the stream (increment at least - * this much). * - */ + /** The default increment used when growing the stream (increment at least this much). * */ public static final int defaultIncrement = 2048; // static formats, used to encode floats and doubles - @SuppressWarnings("unused") private static final DecimalFormat eform = new DecimalFormat("e+00;e-00"); - @SuppressWarnings("unused") private static final BigDecimal ten = new BigDecimal(10.0); - @SuppressWarnings("unused") private static final BigDecimal one = new BigDecimal(1.0); private int fixedSize = Integer.MAX_VALUE; @@ -62,66 +55,66 @@ * Create a stream with the default initial size (2048 bytes). */ public OtpOutputStream() { - this(defaultInitialSize); + this(defaultInitialSize); } /** * Create a stream with the specified initial size. */ public OtpOutputStream(final int size) { - super(size); + super(size); } /** * Create a stream containing the encoded version of the given Erlang term. */ public OtpOutputStream(final OtpErlangObject o) { - this(); - write_any(o); + this(); + write_any(o); } // package scope /* * Get the contents of the output stream as an input stream instead. This is * used internally in {@link OtpCconnection} for tracing outgoing packages. - * + * * @param offset where in the output stream to read data from when creating * the input stream. The offset is necessary because header contents start 5 * bytes into the header buffer, whereas payload contents start at the * beginning - * + * * @return an input stream containing the same raw data. */ OtpInputStream getOtpInputStream(final int offset) { - return new OtpInputStream(super.buf, offset, super.count - offset, 0); + return new OtpInputStream(super.buf, offset, super.count - offset, 0); } /** * Get the current position in the stream. - * + * * @return the current position in the stream. */ public int getPos() { - return super.count; + return super.count; } /** * Trims the capacity of this OtpOutputStream instance to be the - * buffer's current size. An application can use this operation to minimize + * buffer's current size. An application can use this operation to minimize * the storage of an OtpOutputStream instance. */ public void trimToSize() { - resize(super.count); + resize(super.count); } - private void resize(final int size) { - if (size < super.buf.length) { - final byte[] tmp = new byte[size]; - System.arraycopy(super.buf, 0, tmp, 0, size); - super.buf = tmp; - } else if (size > super.buf.length) { - ensureCapacity(size); - } + private void resize(int size) { + if (size < super.buf.length) { + final byte[] tmp = new byte[size]; + System.arraycopy(super.buf, 0, tmp, 0, size); + super.buf = tmp; + } else if (size > super.buf.length) { + ensureCapacity(size); + } } /** @@ -129,247 +122,227 @@ * necessary, to ensure that it can hold at least the number of elements * specified by the minimum capacity argument. * - * @param minCapacity - * the desired minimum capacity + * @param minCapacity the desired minimum capacity */ - public void ensureCapacity(final int minCapacity) { - if (minCapacity > fixedSize) { - throw new IllegalArgumentException( - "Trying to increase fixed-size buffer"); - } - final int oldCapacity = super.buf.length; - if (minCapacity > oldCapacity) { - int newCapacity = oldCapacity * 3 / 2 + 1; - if (newCapacity < oldCapacity + defaultIncrement) { - newCapacity = oldCapacity + defaultIncrement; - } - if (newCapacity < minCapacity) { - newCapacity = minCapacity; - } - newCapacity = Math.min(fixedSize, newCapacity); - // minCapacity is usually close to size, so this is a win: - final byte[] tmp = new byte[newCapacity]; - System.arraycopy(super.buf, 0, tmp, 0, super.count); - super.buf = tmp; - } + public void ensureCapacity(int minCapacity) { + if (minCapacity > fixedSize) { + throw new IllegalArgumentException("Trying to increase fixed-size buffer"); + } + int oldCapacity = super.buf.length; + if (minCapacity > oldCapacity) { + int newCapacity = (oldCapacity * 3)/2 + 1; + if (newCapacity < oldCapacity + defaultIncrement) + newCapacity = oldCapacity + defaultIncrement; + if (newCapacity < minCapacity) + newCapacity = minCapacity; + newCapacity = Math.min(fixedSize, newCapacity); + // minCapacity is usually close to size, so this is a win: + final byte[] tmp = new byte[newCapacity]; + System.arraycopy(super.buf, 0, tmp, 0, super.count); + super.buf = tmp; + } } /** * Write one byte to the stream. - * + * * @param b * the byte to write. - * + * */ public void write(final byte b) { - ensureCapacity(super.count + 1); - super.buf[super.count++] = b; + ensureCapacity(super.count + 1); + super.buf[super.count++] = b; } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see java.io.ByteArrayOutputStream#write(byte[]) */ @Override - public void write(final byte[] abuf) { - // don't assume that super.write(byte[]) calls write(buf, 0, buf.length) - write(abuf, 0, abuf.length); + public void write(final byte[] buf) { + // don't assume that super.write(byte[]) calls write(buf, 0, buf.length) + write(buf, 0, buf.length); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see java.io.ByteArrayOutputStream#write(int) */ @Override - public synchronized void write(final int b) { - ensureCapacity(super.count + 1); - super.buf[super.count] = (byte) b; - count += 1; + public synchronized void write(int b) { + ensureCapacity(super.count + 1); + super.buf[super.count] = (byte) b; + count += 1; } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see java.io.ByteArrayOutputStream#write(byte[], int, int) */ @Override - public synchronized void write(final byte[] b, final int off, final int len) { - if (off < 0 || off > b.length || len < 0 || off + len - b.length > 0) { - throw new IndexOutOfBoundsException(); - } - ensureCapacity(super.count + len); - System.arraycopy(b, off, super.buf, super.count, len); - super.count += len; - } - - @Override - public synchronized void writeTo(OutputStream out) throws IOException { - super.writeTo(out); - } - - public synchronized void writeToAndFlush(OutputStream out) throws IOException { - super.writeTo(out); - out.flush(); + public synchronized void write(byte[] b, int off, int len) { + if ((off < 0) || (off > b.length) || (len < 0) + || ((off + len) - b.length > 0)) { + throw new IndexOutOfBoundsException(); + } + ensureCapacity(super.count + len); + System.arraycopy(b, off, super.buf, super.count, len); + super.count += len; } /** * Write the low byte of a value to the stream. - * + * * @param n * the value to use. - * + * */ public void write1(final long n) { - write((byte) (n & 0xff)); + write((byte) (n & 0xff)); } /** * Write an array of bytes to the stream. - * + * * @param bytes * the array of bytes to write. - * + * */ public void writeN(final byte[] bytes) { - write(bytes); + write(bytes); } /** * Get the current capacity of the stream. As bytes are added the capacity * of the stream is increased automatically, however this method returns the * current size. - * + * * @return the size of the internal buffer used by the stream. */ public int length() { - return super.buf.length; + return super.buf.length; } /** * Get the number of bytes in the stream. - * + * * @return the number of bytes in the stream. - * + * * @deprecated As of Jinterface 1.4, replaced by super.size(). * @see #size() */ @Deprecated public int count() { - return count; + return count; } /** * Write the low two bytes of a value to the stream in big endian order. - * + * * @param n * the value to use. */ public void write2BE(final long n) { - write((byte) ((n & 0xff00) >> 8)); - write((byte) (n & 0xff)); + write((byte) ((n & 0xff00) >> 8)); + write((byte) (n & 0xff)); } /** * Write the low four bytes of a value to the stream in big endian order. - * + * * @param n * the value to use. */ public void write4BE(final long n) { - write((byte) ((n & 0xff000000) >> 24)); - write((byte) ((n & 0xff0000) >> 16)); - write((byte) ((n & 0xff00) >> 8)); - write((byte) (n & 0xff)); + write((byte) ((n & 0xff000000) >> 24)); + write((byte) ((n & 0xff0000) >> 16)); + write((byte) ((n & 0xff00) >> 8)); + write((byte) (n & 0xff)); } /** * Write the low eight (all) bytes of a value to the stream in big endian * order. - * + * * @param n * the value to use. */ public void write8BE(final long n) { - write((byte) (n >> 56 & 0xff)); - write((byte) (n >> 48 & 0xff)); - write((byte) (n >> 40 & 0xff)); - write((byte) (n >> 32 & 0xff)); - write((byte) (n >> 24 & 0xff)); - write((byte) (n >> 16 & 0xff)); - write((byte) (n >> 8 & 0xff)); - write((byte) (n & 0xff)); + write((byte) (n >> 56 & 0xff)); + write((byte) (n >> 48 & 0xff)); + write((byte) (n >> 40 & 0xff)); + write((byte) (n >> 32 & 0xff)); + write((byte) (n >> 24 & 0xff)); + write((byte) (n >> 16 & 0xff)); + write((byte) (n >> 8 & 0xff)); + write((byte) (n & 0xff)); } /** * Write any number of bytes in little endian format. - * + * * @param n * the value to use. * @param b * the number of bytes to write from the little end. */ - public void writeLE(final long n, final int b) { - long v = n; - for (int i = 0; i < b; i++) { - write((byte) (v & 0xff)); - v >>= 8; - } + public void writeLE(long n, final int b) { + for (int i = 0; i < b; i++) { + write((byte) (n & 0xff)); + n >>= 8; + } } /** * Write the low two bytes of a value to the stream in little endian order. - * + * * @param n * the value to use. */ public void write2LE(final long n) { - write((byte) (n & 0xff)); - write((byte) ((n & 0xff00) >> 8)); + write((byte) (n & 0xff)); + write((byte) ((n & 0xff00) >> 8)); } /** * Write the low four bytes of a value to the stream in little endian order. - * + * * @param n * the value to use. */ public void write4LE(final long n) { - write((byte) (n & 0xff)); - write((byte) ((n & 0xff00) >> 8)); - write((byte) ((n & 0xff0000) >> 16)); - write((byte) ((n & 0xff000000) >> 24)); + write((byte) (n & 0xff)); + write((byte) ((n & 0xff00) >> 8)); + write((byte) ((n & 0xff0000) >> 16)); + write((byte) ((n & 0xff000000) >> 24)); } /** * Write the low eight bytes of a value to the stream in little endian * order. - * + * * @param n * the value to use. */ public void write8LE(final long n) { - write((byte) (n & 0xff)); - write((byte) (n >> 8 & 0xff)); - write((byte) (n >> 16 & 0xff)); - write((byte) (n >> 24 & 0xff)); - write((byte) (n >> 32 & 0xff)); - write((byte) (n >> 40 & 0xff)); - write((byte) (n >> 48 & 0xff)); - write((byte) (n >> 56 & 0xff)); + write((byte) (n & 0xff)); + write((byte) (n >> 8 & 0xff)); + write((byte) (n >> 16 & 0xff)); + write((byte) (n >> 24 & 0xff)); + write((byte) (n >> 32 & 0xff)); + write((byte) (n >> 40 & 0xff)); + write((byte) (n >> 48 & 0xff)); + write((byte) (n >> 56 & 0xff)); } /** * Write the low four bytes of a value to the stream in bif endian order, at * the specified position. If the position specified is beyond the end of * the stream, this method will have no effect. - * + * * Normally this method should be used in conjunction with {@link #size() * size()}, when is is necessary to insert data into the stream before it is * known what the actual value should be. For example: - * + * *

          * int pos = s.size();
          *    s.write4BE(0); // make space for length data,
    @@ -378,495 +351,501 @@
          *    // later... when we know the length value
          *    s.poke4BE(pos, length);
          * 
    - * - * + * + * * @param offset * the position in the stream. * @param n * the value to use. */ public void poke4BE(final int offset, final long n) { - if (offset < super.count) { - buf[offset + 0] = (byte) ((n & 0xff000000) >> 24); - buf[offset + 1] = (byte) ((n & 0xff0000) >> 16); - buf[offset + 2] = (byte) ((n & 0xff00) >> 8); - buf[offset + 3] = (byte) (n & 0xff); - } + if (offset < super.count) { + buf[offset + 0] = (byte) ((n & 0xff000000) >> 24); + buf[offset + 1] = (byte) ((n & 0xff0000) >> 16); + buf[offset + 2] = (byte) ((n & 0xff00) >> 8); + buf[offset + 3] = (byte) (n & 0xff); + } } /** * Write a string to the stream as an Erlang atom. - * + * * @param atom * the string to write. */ public void write_atom(final String atom) { - String enc_atom; - byte[] bytes; - boolean isLatin1 = true; - - if (atom.codePointCount(0, atom.length()) <= OtpExternal.maxAtomLength) { - enc_atom = atom; - } else { - /* - * Throwing an exception would be better I think, but truncation - * seems to be the way it has been done in other parts of OTP... - */ - enc_atom = new String(OtpErlangString.stringToCodePoints(atom), 0, - OtpExternal.maxAtomLength); - } - - for (int offset = 0; offset < enc_atom.length();) { - final int cp = enc_atom.codePointAt(offset); - if ((cp & ~0xFF) != 0) { - isLatin1 = false; - break; - } - offset += Character.charCount(cp); - } - try { - if (isLatin1) { - bytes = enc_atom.getBytes("ISO-8859-1"); - write1(OtpExternal.atomTag); - write2BE(bytes.length); - } else { - bytes = enc_atom.getBytes("UTF-8"); - final int length = bytes.length; - if (length < 256) { - write1(OtpExternal.smallAtomUtf8Tag); - write1(length); - } else { - write1(OtpExternal.atomUtf8Tag); - write2BE(length); - } - } - writeN(bytes); - } catch (final java.io.UnsupportedEncodingException e) { - /* - * Sigh, why didn't the API designer add an OtpErlangEncodeException - * to these encoding functions?!? Instead of changing the API we - * write an invalid atom and let it fail for whoever trying to - * decode this... Sigh, again... - */ - write1(OtpExternal.smallAtomUtf8Tag); - write1(2); - write2BE(0xffff); /* Invalid UTF-8 */ - } + String enc_atom; + byte[] bytes; + boolean isLatin1 = true; + + if (atom.codePointCount(0, atom.length()) <= OtpExternal.maxAtomLength) { + enc_atom = atom; + } + else { + /* + * Throwing an exception would be better I think, + * but truncation seems to be the way it has + * been done in other parts of OTP... + */ + enc_atom = new String(OtpErlangString.stringToCodePoints(atom), + 0, OtpExternal.maxAtomLength); + } + + for (int offset = 0; offset < enc_atom.length();) { + final int cp = enc_atom.codePointAt(offset); + if ((cp & ~0xFF) != 0) { + isLatin1 = false; + break; + } + offset += Character.charCount(cp); + } + try { + if (isLatin1) { + bytes = enc_atom.getBytes("ISO-8859-1"); + write1(OtpExternal.atomTag); + write2BE(bytes.length); + } + else { + bytes = enc_atom.getBytes("UTF-8"); + final int length = bytes.length; + if (length < 256) { + write1(OtpExternal.smallAtomUtf8Tag); + write1(length); + } + else { + write1(OtpExternal.atomUtf8Tag); + write2BE(length); + } + } + writeN(bytes); + } catch (final java.io.UnsupportedEncodingException e) { + /* + * Sigh, why didn't the API designer add an + * OtpErlangEncodeException to these encoding + * functions?!? Instead of changing the API we + * write an invalid atom and let it fail for + * whoever trying to decode this... Sigh, + * again... + */ + write1(OtpExternal.smallAtomUtf8Tag); + write1(2); + write2BE(0xffff); /* Invalid UTF-8 */ + } } /** * Write an array of bytes to the stream as an Erlang binary. - * + * * @param bin * the array of bytes to write. */ public void write_binary(final byte[] bin) { - write1(OtpExternal.binTag); - write4BE(bin.length); - writeN(bin); + write1(OtpExternal.binTag); + write4BE(bin.length); + writeN(bin); } /** * Write an array of bytes to the stream as an Erlang bitstr. - * + * * @param bin * the array of bytes to write. * @param pad_bits * the number of zero pad bits at the low end of the last byte */ public void write_bitstr(final byte[] bin, final int pad_bits) { - if (pad_bits == 0) { - write_binary(bin); - return; - } - write1(OtpExternal.bitBinTag); - write4BE(bin.length); - write1(8 - pad_bits); - writeN(bin); + if (pad_bits == 0) { + write_binary(bin); + return; + } + write1(OtpExternal.bitBinTag); + write4BE(bin.length); + write1(8 - pad_bits); + writeN(bin); } /** * Write a boolean value to the stream as the Erlang atom 'true' or 'false'. - * + * * @param b * the boolean value to write. */ public void write_boolean(final boolean b) { - write_atom(String.valueOf(b)); + write_atom(String.valueOf(b)); } /** * Write a single byte to the stream as an Erlang integer. The byte is * really an IDL 'octet', that is, unsigned. - * + * * @param b * the byte to use. */ public void write_byte(final byte b) { - this.write_long(b & 0xffL, true); + this.write_long(b & 0xffL, true); } /** * Write a character to the stream as an Erlang integer. The character may * be a 16 bit character, kind of IDL 'wchar'. It is up to the Erlang side * to take care of souch, if they should be used. - * + * * @param c * the character to use. */ public void write_char(final char c) { - this.write_long(c & 0xffffL, true); + this.write_long(c & 0xffffL, true); } /** * Write a double value to the stream. - * + * * @param d * the double to use. */ public void write_double(final double d) { - write1(OtpExternal.newFloatTag); - write8BE(Double.doubleToLongBits(d)); + write1(OtpExternal.newFloatTag); + write8BE(Double.doubleToLongBits(d)); } /** * Write a float value to the stream. - * + * * @param f * the float to use. */ public void write_float(final float f) { - write_double(f); + write_double(f); } - public void write_big_integer(final BigInteger v) { - if (v.bitLength() < 64) { - this.write_long(v.longValue(), true); - return; - } - final int signum = v.signum(); - BigInteger val = v; - if (signum < 0) { - val = val.negate(); - } - final byte[] magnitude = val.toByteArray(); - final int n = magnitude.length; - // Reverse the array to make it little endian. - for (int i = 0, j = n; i < j--; i++) { - // Swap [i] with [j] - final byte b = magnitude[i]; - magnitude[i] = magnitude[j]; - magnitude[j] = b; - } - if ((n & 0xFF) == n) { - write1(OtpExternal.smallBigTag); - write1(n); // length - } else { - write1(OtpExternal.largeBigTag); - write4BE(n); // length - } - write1(signum < 0 ? 1 : 0); // sign - // Write the array - writeN(magnitude); + public void write_big_integer(BigInteger v) { + if (v.bitLength() < 64) { + this.write_long(v.longValue(), true); + return; + } + final int signum = v.signum(); + if (signum < 0) { + v = v.negate(); + } + final byte[] magnitude = v.toByteArray(); + final int n = magnitude.length; + // Reverse the array to make it little endian. + for (int i = 0, j = n; i < j--; i++) { + // Swap [i] with [j] + final byte b = magnitude[i]; + magnitude[i] = magnitude[j]; + magnitude[j] = b; + } + if ((n & 0xFF) == n) { + write1(OtpExternal.smallBigTag); + write1(n); // length + } else { + write1(OtpExternal.largeBigTag); + write4BE(n); // length + } + write1(signum < 0 ? 1 : 0); // sign + // Write the array + writeN(magnitude); } void write_long(final long v, final boolean unsigned) { - /* - * If v<0 and unsigned==true the value - * java.lang.Long.MAX_VALUE-java.lang.Long.MIN_VALUE+1+v is written, i.e - * v is regarded as unsigned two's complement. - */ - if ((v & 0xffL) == v) { - // will fit in one byte - write1(OtpExternal.smallIntTag); - write1(v); - } else { - // note that v != 0L - if (v < 0 && unsigned || v < OtpExternal.erlMin - || v > OtpExternal.erlMax) { - // some kind of bignum - final long abs = unsigned ? v : v < 0 ? -v : v; - final int sign = unsigned ? 0 : v < 0 ? 1 : 0; - int n; - long mask; - for (mask = 0xFFFFffffL, n = 4; (abs & mask) != abs; n++, mask = mask << 8 | 0xffL) { - // count nonzero bytes - } - write1(OtpExternal.smallBigTag); - write1(n); // length - write1(sign); // sign - writeLE(abs, n); // value. obs! little endian - } else { - write1(OtpExternal.intTag); - write4BE(v); - } - } + /* + * If v<0 and unsigned==true the value + * java.lang.Long.MAX_VALUE-java.lang.Long.MIN_VALUE+1+v is written, i.e + * v is regarded as unsigned two's complement. + */ + if ((v & 0xffL) == v) { + // will fit in one byte + write1(OtpExternal.smallIntTag); + write1(v); + } else { + // note that v != 0L + if (v < 0 && unsigned || v < OtpExternal.erlMin + || v > OtpExternal.erlMax) { + // some kind of bignum + final long abs = unsigned ? v : v < 0 ? -v : v; + final int sign = unsigned ? 0 : v < 0 ? 1 : 0; + int n; + long mask; + for (mask = 0xFFFFffffL, n = 4; (abs & mask) != abs; n++, mask = mask << 8 | 0xffL) { + ; // count nonzero bytes + } + write1(OtpExternal.smallBigTag); + write1(n); // length + write1(sign); // sign + writeLE(abs, n); // value. obs! little endian + } else { + write1(OtpExternal.intTag); + write4BE(v); + } + } } /** * Write a long to the stream. - * + * * @param l * the long to use. */ public void write_long(final long l) { - this.write_long(l, false); + this.write_long(l, false); } /** * Write a positive long to the stream. The long is interpreted as a two's * complement unsigned long even if it is negative. - * + * * @param ul * the long to use. */ public void write_ulong(final long ul) { - this.write_long(ul, true); + this.write_long(ul, true); } /** * Write an integer to the stream. - * + * * @param i * the integer to use. */ public void write_int(final int i) { - this.write_long(i, false); + this.write_long(i, false); } /** * Write a positive integer to the stream. The integer is interpreted as a * two's complement unsigned integer even if it is negative. - * + * * @param ui * the integer to use. */ public void write_uint(final int ui) { - this.write_long(ui & 0xFFFFffffL, true); + this.write_long(ui & 0xFFFFffffL, true); } /** * Write a short to the stream. - * + * * @param s * the short to use. */ public void write_short(final short s) { - this.write_long(s, false); + this.write_long(s, false); } /** * Write a positive short to the stream. The short is interpreted as a two's * complement unsigned short even if it is negative. - * + * * @param us * the short to use. */ public void write_ushort(final short us) { - this.write_long(us & 0xffffL, true); + this.write_long(us & 0xffffL, true); } /** * Write an Erlang list header to the stream. After calling this method, you * must write 'arity' elements to the stream followed by nil, or it will not * be possible to decode it later. - * + * * @param arity * the number of elements in the list. */ public void write_list_head(final int arity) { - if (arity == 0) { - write_nil(); - } else { - write1(OtpExternal.listTag); - write4BE(arity); - } + if (arity == 0) { + write_nil(); + } else { + write1(OtpExternal.listTag); + write4BE(arity); + } } /** * Write an empty Erlang list to the stream. */ public void write_nil() { - write1(OtpExternal.nilTag); + write1(OtpExternal.nilTag); } /** * Write an Erlang tuple header to the stream. After calling this method, * you must write 'arity' elements to the stream or it will not be possible * to decode it later. - * + * * @param arity * the number of elements in the tuple. */ public void write_tuple_head(final int arity) { - if (arity < 0xff) { - write1(OtpExternal.smallTupleTag); - write1(arity); - } else { - write1(OtpExternal.largeTupleTag); - write4BE(arity); - } + if (arity < 0xff) { + write1(OtpExternal.smallTupleTag); + write1(arity); + } else { + write1(OtpExternal.largeTupleTag); + write4BE(arity); + } } /** * Write an Erlang PID to the stream. - * + * * @param node * the nodename. - * + * * @param id * an arbitrary number. Only the low order 15 bits will be used. - * + * * @param serial * another arbitrary number. Only the low order 13 bits will be * used. - * + * * @param creation * yet another arbitrary number. Only the low order 2 bits will * be used. - * + * */ public void write_pid(final String node, final int id, final int serial, - final int creation) { - write1(OtpExternal.pidTag); - write_atom(node); - write4BE(id & 0x7fff); // 15 bits - write4BE(serial & 0x1fff); // 13 bits - write1(creation & 0x3); // 2 bits + final int creation) { + write1(OtpExternal.pidTag); + write_atom(node); + write4BE(id & 0x7fff); // 15 bits + write4BE(serial & 0x1fff); // 13 bits + write1(creation & 0x3); // 2 bits } /** * Write an Erlang port to the stream. - * + * * @param node * the nodename. - * + * * @param id * an arbitrary number. Only the low order 28 bits will be used. - * + * * @param creation * another arbitrary number. Only the low order 2 bits will be * used. - * + * */ public void write_port(final String node, final int id, final int creation) { - write1(OtpExternal.portTag); - write_atom(node); - write4BE(id & 0xfffffff); // 28 bits - write1(creation & 0x3); // 2 bits + write1(OtpExternal.portTag); + write_atom(node); + write4BE(id & 0xfffffff); // 28 bits + write1(creation & 0x3); // 2 bits } /** * Write an old style Erlang ref to the stream. - * + * * @param node * the nodename. - * + * * @param id * an arbitrary number. Only the low order 18 bits will be used. - * + * * @param creation * another arbitrary number. Only the low order 2 bits will be * used. - * + * */ public void write_ref(final String node, final int id, final int creation) { - write1(OtpExternal.refTag); - write_atom(node); - write4BE(id & 0x3ffff); // 18 bits - write1(creation & 0x3); // 2 bits + write1(OtpExternal.refTag); + write_atom(node); + write4BE(id & 0x3ffff); // 18 bits + write1(creation & 0x3); // 2 bits } /** * Write a new style (R6 and later) Erlang ref to the stream. - * + * * @param node * the nodename. - * + * * @param ids * an array of arbitrary numbers. Only the low order 18 bits of * the first number will be used. If the array contains only one * number, an old style ref will be written instead. At most * three numbers will be read from the array. - * + * * @param creation * another arbitrary number. Only the low order 2 bits will be * used. - * + * */ public void write_ref(final String node, final int[] ids, final int creation) { - int arity = ids.length; - if (arity > 3) { - arity = 3; // max 3 words in ref - } - - if (arity == 1) { - // use old method - this.write_ref(node, ids[0], creation); - } else { - // r6 ref - write1(OtpExternal.newRefTag); - - // how many id values - write2BE(arity); - - write_atom(node); - - // note: creation BEFORE id in r6 ref - write1(creation & 0x3); // 2 bits - - // first int gets truncated to 18 bits - write4BE(ids[0] & 0x3ffff); - - // remaining ones are left as is - for (int i = 1; i < arity; i++) { - write4BE(ids[i]); - } - } + int arity = ids.length; + if (arity > 3) { + arity = 3; // max 3 words in ref + } + + if (arity == 1) { + // use old method + this.write_ref(node, ids[0], creation); + } else { + // r6 ref + write1(OtpExternal.newRefTag); + + // how many id values + write2BE(arity); + + write_atom(node); + + // note: creation BEFORE id in r6 ref + write1(creation & 0x3); // 2 bits + + // first int gets truncated to 18 bits + write4BE(ids[0] & 0x3ffff); + + // remaining ones are left as is + for (int i = 1; i < arity; i++) { + write4BE(ids[i]); + } + } } /** * Write a string to the stream. - * + * * @param s * the string to write. */ public void write_string(final String s) { - final int len = s.length(); + final int len = s.length(); - switch (len) { - case 0: - write_nil(); - break; - default: - if (len <= 65535 && is8bitString(s)) { // 8-bit string - try { - final byte[] bytebuf = s.getBytes("ISO-8859-1"); - write1(OtpExternal.stringTag); - write2BE(len); - writeN(bytebuf); - } catch (final UnsupportedEncodingException e) { - write_nil(); // it should never ever get here... - } - } else { // unicode or longer, must code as list - final int[] codePoints = OtpErlangString.stringToCodePoints(s); - write_list_head(codePoints.length); - for (final int codePoint : codePoints) { - write_int(codePoint); - } - write_nil(); - } - } + switch (len) { + case 0: + write_nil(); + break; + default: + if (len <= 65535 && is8bitString(s)) { // 8-bit string + try { + final byte[] bytebuf = s.getBytes("ISO-8859-1"); + write1(OtpExternal.stringTag); + write2BE(len); + writeN(bytebuf); + } catch (final UnsupportedEncodingException e) { + write_nil(); // it should never ever get here... + } + } else { // unicode or longer, must code as list + final char[] charbuf = s.toCharArray(); + final int[] codePoints = OtpErlangString.stringToCodePoints(s); + write_list_head(codePoints.length); + for (final int codePoint : codePoints) { + write_int(codePoint); + } + write_nil(); + } + } } private boolean is8bitString(final String s) { - for (int i = 0; i < s.length(); ++i) { - final char c = s.charAt(i); - if (c < 0 || c > 255) { - return false; - } - } - return true; + for (int i = 0; i < s.length(); ++i) { + final char c = s.charAt(i); + if (c < 0 || c > 255) { + return false; + } + } + return true; } /** @@ -876,7 +855,7 @@ * the Erlang term to write. */ public void write_compressed(final OtpErlangObject o) { - write_compressed(o, Deflater.DEFAULT_COMPRESSION); + write_compressed(o, Deflater.DEFAULT_COMPRESSION); } /** @@ -887,128 +866,113 @@ * @param level * the compression level (0..9) */ - public void write_compressed(final OtpErlangObject o, final int level) { - @SuppressWarnings("resource") - final OtpOutputStream oos = new OtpOutputStream(o); - /* - * similar to erts_term_to_binary() in external.c: We don't want to - * compress if compression actually increases the size. Since - * compression uses 5 extra bytes (COMPRESSED tag + size), don't - * compress if the original term is smaller. - */ - if (oos.size() < 5) { - // fast path for small terms - try { - oos.writeToAndFlush(this); - // if the term is written as a compressed term, the output - // stream is closed, so we do this here, too - close(); - } catch (final IOException e) { - throw new java.lang.IllegalArgumentException( - "Intermediate stream failed for Erlang object " + o); - } - } else { - final int startCount = super.count; - // we need destCount bytes for an uncompressed term - // -> if compression uses more, use the uncompressed term! - final int destCount = startCount + oos.size(); - fixedSize = destCount; - final Deflater def = new Deflater(level); - final java.util.zip.DeflaterOutputStream dos = new java.util.zip.DeflaterOutputStream( - this, def); - try { - write1(OtpExternal.compressedTag); - write4BE(oos.size()); - oos.writeTo(dos); - dos.close(); // note: closes this, too! - } catch (final IllegalArgumentException e) { - /* - * Discard further un-compressed data (if not called, there may - * be memory leaks). - * - * After calling java.util.zip.Deflater.end(), the deflater - * should not be used anymore, not even the close() method of - * dos. Calling dos.close() before def.end() is prevented since - * an unfinished DeflaterOutputStream will try to deflate its - * unprocessed data to the (fixed) byte array which is prevented - * by ensureCapacity() and would also unnecessarily process - * further data that is discarded anyway. - * - * Since we are re-using the byte array of this object below, we - * must not call close() in e.g. a finally block either (with or - * without a call to def.end()). - */ - def.end(); - // could not make the value smaller than originally - // -> reset to starting count, write uncompressed - super.count = startCount; - try { - oos.writeTo(this); - // if the term is written as a compressed term, the output - // stream is closed, so we do this here, too - close(); - } catch (final IOException e2) { - throw new java.lang.IllegalArgumentException( - "Intermediate stream failed for Erlang object " + o); - } - } catch (final IOException e) { - throw new java.lang.IllegalArgumentException( - "Intermediate stream failed for Erlang object " + o); - } finally { - fixedSize = Integer.MAX_VALUE; - } - } + public void write_compressed(final OtpErlangObject o, int level) { + final OtpOutputStream oos = new OtpOutputStream(o); + /* + * similar to erts_term_to_binary() in external.c: + * We don't want to compress if compression actually increases the size. + * Since compression uses 5 extra bytes (COMPRESSED tag + size), don't + * compress if the original term is smaller. + */ + if (oos.size() < 5) { + // fast path for small terms + try { + oos.writeTo(this); + // if the term is written as a compressed term, the output + // stream is closed, so we do this here, too + this.close(); + } catch (IOException e) { + throw new java.lang.IllegalArgumentException( + "Intermediate stream failed for Erlang object " + o); + } + } else { + int startCount = super.count; + // we need destCount bytes for an uncompressed term + // -> if compression uses more, use the uncompressed term! + int destCount = startCount + oos.size(); + this.fixedSize = destCount; + Deflater def = new Deflater(level); + final java.util.zip.DeflaterOutputStream dos = new java.util.zip.DeflaterOutputStream( + this, def); + try { + write1(OtpExternal.compressedTag); + write4BE(oos.size()); + oos.writeTo(dos); + dos.close(); // note: closes this, too! + } catch (final IllegalArgumentException e) { + // discard further un-compressed data + // -> if not called, there may be memory leaks! + def.end(); + // could not make the value smaller than originally + // -> reset to starting count, write uncompressed + super.count = startCount; + try { + oos.writeTo(this); + // if the term is written as a compressed term, the output + // stream is closed, so we do this here, too + this.close(); + } catch (IOException e2) { + throw new java.lang.IllegalArgumentException( + "Intermediate stream failed for Erlang object " + o); + } + } catch (final IOException e) { + throw new java.lang.IllegalArgumentException( + "Intermediate stream failed for Erlang object " + o); + } finally { + this.fixedSize = Integer.MAX_VALUE; + } + } } /** * Write an arbitrary Erlang term to the stream. - * + * * @param o * the Erlang term to write. */ public void write_any(final OtpErlangObject o) { - // calls one of the above functions, depending on o - o.encode(this); + // calls one of the above functions, depending on o + o.encode(this); } public void write_fun(final OtpErlangPid pid, final String module, - final long old_index, final int arity, final byte[] md5, - final long index, final long uniq, final OtpErlangObject[] freeVars) { - if (arity == -1) { - write1(OtpExternal.funTag); - write4BE(freeVars.length); - pid.encode(this); - write_atom(module); - write_long(index); - write_long(uniq); - for (final OtpErlangObject fv : freeVars) { - fv.encode(this); - } - } else { - write1(OtpExternal.newFunTag); - final int saveSizePos = getPos(); - write4BE(0); // this is where we patch in the size - write1(arity); - writeN(md5); - write4BE(index); - write4BE(freeVars.length); - write_atom(module); - write_long(old_index); - write_long(uniq); - pid.encode(this); - for (final OtpErlangObject fv : freeVars) { - fv.encode(this); - } - poke4BE(saveSizePos, getPos() - saveSizePos); - } + final long old_index, final int arity, final byte[] md5, + final long index, final long uniq, final OtpErlangObject[] freeVars) { + if (arity == -1) { + write1(OtpExternal.funTag); + write4BE(freeVars.length); + pid.encode(this); + write_atom(module); + write_long(index); + write_long(uniq); + for (final OtpErlangObject fv : freeVars) { + fv.encode(this); + } + } else { + write1(OtpExternal.newFunTag); + final int saveSizePos = getPos(); + write4BE(0); // this is where we patch in the size + write1(arity); + writeN(md5); + write4BE(index); + write4BE(freeVars.length); + write_atom(module); + write_long(old_index); + write_long(uniq); + pid.encode(this); + for (final OtpErlangObject fv : freeVars) { + fv.encode(this); + } + poke4BE(saveSizePos, getPos() - saveSizePos); + } } public void write_external_fun(final String module, final String function, - final int arity) { - write1(OtpExternal.externalFunTag); - write_atom(module); - write_atom(function); - write_long(arity); + final int arity) { + write1(OtpExternal.externalFunTag); + write_atom(module); + write_atom(function); + write_long(arity); } public void write_map_head(final int arity) { diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpPeer.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpPeer.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpPeer.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpPeer.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -29,72 +28,59 @@ */ public class OtpPeer extends AbstractNode { int distChoose = 0; /* - * this is set by OtpConnection and is the highest - * common protocol version we both support - */ + * this is set by OtpConnection and is the highest + * common protocol version we both support + */ - OtpPeer(final OtpTransportFactory transportFactory) { - super(transportFactory); + OtpPeer() { + super(); } /** * Create a peer node. - * + * * @param node - * the name of the node. + * the name of the node. */ public OtpPeer(final String node) { - super(node); - } - - /** - * Create a peer node with custom transport factory. - * - * @param node - * the name of the node. - * @param transportFactory - * custom transport factory - */ - public OtpPeer(final String node, final OtpTransportFactory - transportFactory) { - super(node, transportFactory); + super(node); } /** * Create a connection to a remote node. - * + * * @param self - * the local node from which you wish to connect. - * + * the local node from which you wish to connect. + * * @return a connection to the remote node. - * + * * @exception java.net.UnknownHostException - * if the remote host could not be found. - * + * if the remote host could not be found. + * * @exception java.io.IOException - * if it was not possible to connect to the remote node. - * + * if it was not possible to connect to the remote node. + * * @exception OtpAuthException - * if the connection was refused by the remote node. - * + * if the connection was refused by the remote node. + * * @deprecated Use the corresponding method in {@link OtpSelf} instead. */ @Deprecated public OtpConnection connect(final OtpSelf self) throws IOException, - UnknownHostException, OtpAuthException { - return new OtpConnection(self, this); + UnknownHostException, OtpAuthException { + return new OtpConnection(self, this); } // package /* * Get the port number used by the remote node. - * + * * @return the port number used by the remote node, or 0 if the node was not * registered with the port mapper. - * + * * @exception java.io.IOException if the port mapper could not be contacted. */ int port() throws IOException { - return OtpEpmd.lookupPort(this); + return OtpEpmd.lookupPort(this); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSelf.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSelf.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSelf.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSelf.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,53 +1,54 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; import java.io.IOException; +import java.net.ServerSocket; +import java.net.Socket; import java.net.UnknownHostException; /** * Represents an OTP node. It is used to connect to remote nodes or accept * incoming connections from remote nodes. - * + * *

    * When the Java node will be connecting to a remote Erlang, Java or C node, it * must first identify itself as a node by creating an instance of this class, * after which it may connect to the remote node. - * + * *

    * When you create an instance of this class, it will bind a socket to a port so * that incoming connections can be accepted. However the port number will not * be made available to other nodes wishing to connect until you explicitely * register with the port mapper daemon by calling {@link #publishPort()}. *

    - * + * *
      * OtpSelf self = new OtpSelf("client", "authcookie"); // identify self
      * OtpPeer other = new OtpPeer("server"); // identify peer
    - *
    + * 
      * OtpConnection conn = self.connect(other); // connect to peer
      * 
    - * + * */ public class OtpSelf extends OtpLocalNode { - private final OtpServerTransport sock; + private final ServerSocket sock; private final OtpErlangPid pid; /** @@ -57,154 +58,47 @@ * directory. The home directory is obtained from the System property * "user.home". *

    - * + * *

    * If the file does not exist, an empty string is used. This method makes no * attempt to create the file. *

    - * + * * @param node - * the name of this node. - * - * @exception IOException - * in case of server transport failure - * + * the name of this node. + * */ public OtpSelf(final String node) throws IOException { - this(node, defaultCookie, 0); - } - - /** - *

    - * Create a self node using the default cookie and custom transport factory. - * The default cookie is found by reading the first line of the - * .erlang.cookie file in the user's home directory. The home directory is - * obtained from the System property "user.home". - *

    - * - *

    - * If the file does not exist, an empty string is used. This method makes no - * attempt to create the file. - *

    - * - * @param node - * the name of this node. - * - * @param transportFactory - * the transport factory to use when creating connections. - * - * @exception IOException - * in case of server transport failure - * - */ - public OtpSelf(final String node, - final OtpTransportFactory transportFactory) throws IOException { - this(node, defaultCookie, 0, transportFactory); + this(node, defaultCookie, 0); } /** * Create a self node. - * + * * @param node - * the name of this node. - * + * the name of this node. + * * @param cookie - * the authorization cookie that will be used by this node when - * it communicates with other nodes. - * - * @exception IOException - * in case of server transport failure + * the authorization cookie that will be used by this node + * when it communicates with other nodes. */ public OtpSelf(final String node, final String cookie) throws IOException { - this(node, cookie, 0); + this(node, cookie, 0); } - /** - * Create a self node. - * - * @param node - * the name of this node. - * - * @param cookie - * the authorization cookie that will be used by this node when - * it communicates with other nodes. - * - * @param transportFactory - * the transport factory to use when creating connections. - * - * @exception IOException - * in case of server transport failure - */ - public OtpSelf(final String node, final String cookie, - final OtpTransportFactory transportFactory) throws IOException { - this(node, cookie, 0, transportFactory); - } - - /** - * Create a self node. - * - * @param node - * the name of this node. - * - * @param cookie - * the authorization cookie that will be used by this node when - * it communicates with other nodes. - * - * @param port - * the port number you wish to use for incoming connections. - * Specifying 0 lets the system choose an available port. - * - * @exception IOException - * in case of server transport failure - */ public OtpSelf(final String node, final String cookie, final int port) - throws IOException { - super(node, cookie); - - sock = createServerTransport(port); + throws IOException { + super(node, cookie); - if (port != 0) { - this.port = port; - } else { - this.port = sock.getLocalPort(); - } + sock = new ServerSocket(port); - pid = createPid(); - } - - /** - * Create a self node. - * - * @param node - * the name of this node. - * - * @param cookie - * the authorization cookie that will be used by this node when - * it communicates with other nodes. - * - * @param port - * the port number you wish to use for incoming connections. - * Specifying 0 lets the system choose an available port. - * - * @param transportFactory - * the transport factory to use when creating connections. - * - * @exception IOException - * in case of server transport failure - */ - public OtpSelf(final String node, final String cookie, final int port, - final OtpTransportFactory transportFactory) throws IOException { - super(node, cookie, transportFactory); - - sock = createServerTransport(port); - - if (port != 0) { - this.port = port; - } else { - this.port = sock.getLocalPort(); - } + if (port != 0) { + this.port = port; + } else { + this.port = sock.getLocalPort(); + } - pid = createPid(); + pid = createPid(); } /** @@ -212,12 +106,12 @@ * messages sent by this node. Anonymous messages are those sent via send * methods in {@link OtpConnection OtpConnection} that do not specify a * sender. - * + * * @return the Erlang PID that will be used as the sender id in all * anonymous messages sent by this node. */ public OtpErlangPid pid() { - return pid; + return pid; } /** @@ -225,31 +119,31 @@ * connect to this one. This method establishes a connection to the Erlang * port mapper (Epmd) and registers the server node's name and port so that * remote nodes are able to connect. - * + * *

    * This method will fail if an Epmd process is not running on the localhost. * See the Erlang documentation for information about starting Epmd. - * + * *

    * Note that once this method has been called, the node is expected to be * available to accept incoming connections. For that reason you should make * sure that you call {@link #accept()} shortly after calling * {@link #publishPort()}. When you no longer intend to accept connections * you should call {@link #unPublishPort()}. - * + * * @return true if the operation was successful, false if the node was * already registered. - * + * * @exception java.io.IOException - * if the port mapper could not be contacted. + * if the port mapper could not be contacted. */ public boolean publishPort() throws IOException { - if (getEpmd() != null) { - return false; // already published - } + if (getEpmd() != null) { + return false; // already published + } - OtpEpmd.publishPort(this); - return getEpmd() != null; + OtpEpmd.publishPort(this); + return getEpmd() != null; } /** @@ -257,71 +151,71 @@ * mapper, thus preventing any new connections from remote nodes. */ public void unPublishPort() { - // unregister with epmd - OtpEpmd.unPublishPort(this); + // unregister with epmd + OtpEpmd.unPublishPort(this); - // close the local descriptor (if we have one) - try { - if (super.epmd != null) { - super.epmd.close(); - } - } catch (final IOException e) {/* ignore close errors */ - } - super.epmd = null; + // close the local descriptor (if we have one) + try { + if (super.epmd != null) { + super.epmd.close(); + } + } catch (final IOException e) {/* ignore close errors */ + } + super.epmd = null; } /** * Accept an incoming connection from a remote node. A call to this method * will block until an incoming connection is at least attempted. - * + * * @return a connection to a remote node. - * + * * @exception java.io.IOException - * if a remote node attempted to connect but no common - * protocol was found. - * + * if a remote node attempted to connect but no common + * protocol was found. + * * @exception OtpAuthException - * if a remote node attempted to connect, but was not - * authorized to connect. + * if a remote node attempted to connect, but was not + * authorized to connect. */ public OtpConnection accept() throws IOException, OtpAuthException { - OtpTransport newsock = null; + Socket newsock = null; - while (true) { - try { - newsock = sock.accept(); - return new OtpConnection(this, newsock); - } catch (final IOException e) { - try { - if (newsock != null) { - newsock.close(); - } - } catch (final IOException f) {/* ignore close errors */ - } - throw e; - } - } + while (true) { + try { + newsock = sock.accept(); + return new OtpConnection(this, newsock); + } catch (final IOException e) { + try { + if (newsock != null) { + newsock.close(); + } + } catch (final IOException f) {/* ignore close errors */ + } + throw e; + } + } } /** * Open a connection to a remote node. - * + * * @param other - * the remote node to which you wish to connect. - * + * the remote node to which you wish to connect. + * * @return a connection to the remote node. - * + * * @exception java.net.UnknownHostException - * if the remote host could not be found. - * + * if the remote host could not be found. + * * @exception java.io.IOException - * if it was not possible to connect to the remote node. - * + * if it was not possible to connect to the remote node. + * * @exception OtpAuthException - * if the connection was refused by the remote node. + * if the connection was refused by the remote node. */ public OtpConnection connect(final OtpPeer other) throws IOException, - UnknownHostException, OtpAuthException { - return new OtpConnection(this, other); + UnknownHostException, OtpAuthException { + return new OtpConnection(this, other); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServer.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServer.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServer.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServer.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2000-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -24,89 +23,88 @@ /** * Represents a local OTP client or server node. It is used when you want other * nodes to be able to establish connections to this one. - * + * * When you create an instance of this class, it will bind a socket to a port so * that incoming connections can be accepted. However the port number will not * be made available to other nodes wishing to connect until you explicitely * register with the port mapper daemon by calling {@link #publishPort()}. - * + * *

    * When the Java node will be connecting to a remote Erlang, Java or C node, it * must first identify itself as a node by creating an instance of this class, * after which it may connect to the remote node. - * + * *

    * Setting up a connection may be done as follows: - * - * + * + * *

      * OtpServer self = new OtpServer("server", "cookie"); // identify self
      * self.publishPort(); // make port information available
    - *
    + * 
      * OtpConnection conn = self.accept(); // get incoming connection
      * 
    - * + * * @see OtpSelf - * - * @deprecated the functionality of this class has been moved to {@link OtpSelf} - * . + * + * @deprecated the functionality of this class has been moved to {@link OtpSelf}. */ @Deprecated public class OtpServer extends OtpSelf { /** * Create an {@link OtpServer} from an existing {@link OtpSelf}. - * + * * @param self - * an existing self node. - * + * an existing self node. + * * @exception java.io.IOException - * if a ServerSocket could not be created. - * + * if a ServerSocket could not be created. + * */ public OtpServer(final OtpSelf self) throws IOException { - super(self.node(), self.cookie()); + super(self.node(), self.cookie()); } /** * Create an OtpServer, using a vacant port chosen by the operating system. * To determine what port was chosen, call the object's {@link #port()} * method. - * + * * @param node - * the name of the node. - * + * the name of the node. + * * @param cookie - * the authorization cookie that will be used by this node when - * accepts connections from remote nodes. - * + * the authorization cookie that will be used by this node + * when accepts connections from remote nodes. + * * @exception java.io.IOException - * if a ServerSocket could not be created. - * + * if a ServerSocket could not be created. + * */ public OtpServer(final String node, final String cookie) throws IOException { - super(node, cookie); + super(node, cookie); } /** * Create an OtpServer, using the specified port number. - * + * * @param node - * a name for this node, as above. - * + * a name for this node, as above. + * * @param cookie - * the authorization cookie that will be used by this node when - * accepts connections from remote nodes. - * + * the authorization cookie that will be used by this node + * when accepts connections from remote nodes. + * * @param port - * the port number to bind the socket to. - * + * the port number to bind the socket to. + * * @exception java.io.IOException - * if a ServerSocket could not be created or if the chosen - * port number was not available. - * + * if a ServerSocket could not be created or if the + * chosen port number was not available. + * */ public OtpServer(final String node, final String cookie, final int port) - throws IOException { - super(node, cookie, port); + throws IOException { + super(node, cookie, port); } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServerSocketTransport.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServerSocketTransport.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServerSocketTransport.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServerSocketTransport.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -package com.ericsson.otp.erlang; - -import java.io.IOException; -import java.net.ServerSocket; -import java.net.Socket; - -/** - * Default socket-based server transport - * - * @author Dmitriy Kargapolov - */ -public class OtpServerSocketTransport implements OtpServerTransport { - - /** - * Underlying server socket - */ - private final ServerSocket socket; - - /** - * @see ServerSocket#ServerSocket(int) - */ - public OtpServerSocketTransport(final int port) throws IOException { - socket = new ServerSocket(port); - } - - /** - * @see ServerSocket#getLocalPort() - */ - public int getLocalPort() { - return socket.getLocalPort(); - } - - /** - * @see ServerSocket#accept() - */ - public OtpTransport accept() throws IOException { - final Socket sock = socket.accept(); - sock.setTcpNoDelay(true); - return new OtpSocketTransport(sock); - } - - /** - * @see ServerSocket#close() - */ - public void close() throws IOException { - socket.close(); - } - -} diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServerTransport.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServerTransport.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServerTransport.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpServerTransport.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -package com.ericsson.otp.erlang; - -import java.io.IOException; -import java.net.ServerSocket; - -/** - * Server-side connection-oriented transport interface. - * - * @author Dmitriy Kargapolov - */ -public interface OtpServerTransport { - - /** - * @see ServerSocket#getLocalPort() - */ - int getLocalPort(); - - /** - * @see ServerSocket#accept() - */ - OtpTransport accept() throws IOException; - - /** - * @see ServerSocket#close() - */ - void close() throws IOException; -} diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSocketTransportFactory.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSocketTransportFactory.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSocketTransportFactory.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSocketTransportFactory.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -package com.ericsson.otp.erlang; - -import java.io.IOException; -import java.net.InetAddress; - -/** - * Default socket-based transport factory - * - * @author Dmitriy Kargapolov - */ -public class OtpSocketTransportFactory implements OtpTransportFactory { - - /** - * @see OtpTransportFactory#createTransport(String, int) - */ - public OtpTransport createTransport(final String addr, final int port) - throws IOException { - return new OtpSocketTransport(addr, port); - } - - /** - * @see OtpTransportFactory#createTransport(InetAddress, int) - */ - public OtpTransport createTransport(final InetAddress addr, final int port) - throws IOException { - return new OtpSocketTransport(addr, port); - } - - /** - * @see OtpTransportFactory#createServerTransport(int) - */ - public OtpServerTransport createServerTransport(final int port) - throws IOException { - return new OtpServerSocketTransport(port); - } - -} diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSocketTransport.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSocketTransport.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSocketTransport.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSocketTransport.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -package com.ericsson.otp.erlang; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.Socket; -import java.net.UnknownHostException; - -/** - * Default socket-based client transport - * - * @author Dmitriy Kargapolov - */ -public class OtpSocketTransport implements OtpTransport { - - /** - * Underlying socket - */ - private final Socket socket; - - /** - * @see Socket#Socket(String, int) - */ - public OtpSocketTransport(final String addr, final int port) - throws UnknownHostException, IOException { - socket = new Socket(addr, port); - socket.setTcpNoDelay(true); - } - - /** - * @see Socket#Socket(InetAddress, int) - */ - public OtpSocketTransport(final InetAddress addr, final int port) - throws UnknownHostException, IOException { - socket = new Socket(addr, port); - socket.setTcpNoDelay(true); - } - - /** - * Socket wrapping constructor - * - * @param s - * socket to wrap - */ - public OtpSocketTransport(final Socket s) { - socket = s; - } - - /** - * @see Socket#getInputStream() - */ - public InputStream getInputStream() throws IOException { - return socket.getInputStream(); - } - - /** - * @see Socket#getOutputStream() - */ - public OutputStream getOutputStream() throws IOException { - return socket.getOutputStream(); - } - - /** - * @see Socket#close() - */ - public void close() throws IOException { - socket.close(); - } -} diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSystem.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSystem.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSystem.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpSystem.java 2014-09-16 19:10:57.000000000 +0000 @@ -1,20 +1,19 @@ /* * %CopyrightBegin% - * + * * Copyright Ericsson AB 2004-2009. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * * %CopyrightEnd% */ package com.ericsson.otp.erlang; @@ -25,27 +24,27 @@ static { - final String rel = System.getProperty("OtpCompatRel", "0"); + final String rel = System.getProperty("OtpCompatRel", "0"); - try { + try { - switch (Integer.parseInt(rel)) { - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 0: - default: - break; - } - } catch (final NumberFormatException e) { - /* Ignore ... */ - } + switch (Integer.parseInt(rel)) { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 0: + default: + break; + } + } catch (final NumberFormatException e) { + /* Ignore ... */ + } } diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpTransportFactory.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpTransportFactory.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpTransportFactory.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpTransportFactory.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -package com.ericsson.otp.erlang; - -import java.io.IOException; -import java.net.InetAddress; - -/** - * Factory class used to create client- and server-side transport instances. One - * static instance of class implementing this interface is created when program - * loaded. Default implementation used is {@link OtpSocketTransportFactory}. - * JInterface user can specify custom transport factory implementing this - * interface in the following ways: - *
    - *
    defining static class as internal to class holding main() method
    - *
    In the systems, where main class can be retrieved with - * System.getProperty("sun.java.command"), user can define static - * class OtpErlangSystemTuner internal to the main class, providing at - * least one static method with the name getOtpTransportFactory, with no - * parameters, returning object of class implementing - * OtpTransportFactory, for example: - * - *
    - * 
    - * public class MyMainClass {
    - * 
    - *     public static class OtpErlangSystemTuner {
    - *         ...
    - *         public static OtpTransportFactory getOtpTransportFactory() {
    - *             return new MyTransportFactory();
    - *         }
    - *     }
    - * 
    - *     public static class MyTransportFactory implements OtpTransportFactory {
    - *         ...
    - *     }
    - * 
    - *     public static void main(String[] args) {
    - *         ...
    - *     }
    - * }
    - * 
    - * 
    - * 
    - * - *
    - * - *
    specifying factory class in the system properties
    - *
    User-defined transport factory class may be specified via system property - * OtpTransportFactory, for example: - * - *
    - * 
    - * package com.my.company;
    - * 
    - * public static class MyTransportFactory implements OtpTransportFactory {
    - *     ...
    - * }
    - * 
    - * - * In such case program may be run with - * -DOtpTransportFactory=com.my.company.MyTransportFactory, or other way of - * setting system property before execution of static initializers may be - * used.
    - *
    - * - * @author Dmitriy Kargapolov - */ -public interface OtpTransportFactory { - - /** - * Create instance of {@link OtpTransport} - * - * @param addr - * host name or IP address string - * @param port - * port number - * @return new socket object - * @throws IOException - */ - public abstract OtpTransport createTransport(String addr, int port) - throws IOException; - - /** - * Create instance of {@link OtpTransport} - * - * @param addr - * peer address - * @param port - * port number - * @return new socket object - * @throws IOException - */ - public abstract OtpTransport createTransport(InetAddress addr, int port) - throws IOException; - - /** - * Create instance of {@link OtpServerTransport} - * - * @param port - * port number to listen on - * @return new socket object - * @throws IOException - */ - public OtpServerTransport createServerTransport(int port) - throws IOException; -} diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpTransport.java erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpTransport.java --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpTransport.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpTransport.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -package com.ericsson.otp.erlang; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; - -/** - * Client-side connection-oriented transport interface. - * - * @author Dmitriy Kargapolov - */ -public interface OtpTransport { - - /** - * @see Socket#getInputStream() - */ - public abstract InputStream getInputStream() throws IOException; - - /** - * @see Socket#getOutputStream() - */ - public abstract OutputStream getOutputStream() throws IOException; - - /** - * @see Socket#close() - */ - public abstract void close() throws IOException; - -} diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/package.html erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/package.html --- erlang-18.2-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/package.html 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/com/ericsson/otp/erlang/package.html 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ Copyright Ericsson AB 2000-2009. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. %CopyrightEnd% --> diff -Nru erlang-18.2-dfsg/lib/jinterface/java_src/Makefile erlang-17.3-dfsg/lib/jinterface/java_src/Makefile --- erlang-18.2-dfsg/lib/jinterface/java_src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/java_src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/jinterface/Makefile erlang-17.3-dfsg/lib/jinterface/Makefile --- erlang-18.2-dfsg/lib/jinterface/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/jinterface/.project erlang-17.3-dfsg/lib/jinterface/.project --- erlang-18.2-dfsg/lib/jinterface/.project 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/.project 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ - - - jinterface - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff -Nru erlang-18.2-dfsg/lib/jinterface/.settings/org.eclipse.jdt.core.prefs erlang-17.3-dfsg/lib/jinterface/.settings/org.eclipse.jdt.core.prefs --- erlang-18.2-dfsg/lib/jinterface/.settings/org.eclipse.jdt.core.prefs 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/.settings/org.eclipse.jdt.core.prefs 1970-01-01 00:00:00.000000000 +0000 @@ -1,296 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=80 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=true -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff -Nru erlang-18.2-dfsg/lib/jinterface/.settings/org.eclipse.jdt.ui.prefs erlang-17.3-dfsg/lib/jinterface/.settings/org.eclipse.jdt.ui.prefs --- erlang-18.2-dfsg/lib/jinterface/.settings/org.eclipse.jdt.ui.prefs 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/.settings/org.eclipse.jdt.ui.prefs 1970-01-01 00:00:00.000000000 +0000 @@ -1,121 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_functional_interfaces=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=false -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.insert_inferred_type_arguments=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=true -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=true -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_redundant_type_arguments=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=true -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_anonymous_class_creation=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_lambda=true -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup.use_type_arguments=false -cleanup_profile=_jinterface -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_jinterface -formatter_settings_version=12 -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_functional_interfaces=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.insert_inferred_type_arguments=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=true -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=true -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_redundant_type_arguments=false -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_anonymous_class_creation=false -sp_cleanup.use_blocks=true -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_lambda=false -sp_cleanup.use_parentheses_in_expressions=true -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true -sp_cleanup.use_type_arguments=false diff -Nru erlang-18.2-dfsg/lib/jinterface/test/.classpath erlang-17.3-dfsg/lib/jinterface/test/.classpath --- erlang-18.2-dfsg/lib/jinterface/test/.classpath 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/.classpath 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface.spec erlang-17.3-dfsg/lib/jinterface/test/jinterface.spec --- erlang-18.2-dfsg/lib/jinterface/test/jinterface.spec 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface.spec 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 2006-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/BooleanAtom.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/BooleanAtom.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/BooleanAtom.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/BooleanAtom.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/CoreMatchBind.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/CoreMatchBind.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/CoreMatchBind.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/CoreMatchBind.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,585 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2000-2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -import com.ericsson.otp.erlang.OtpErlangException; -import com.ericsson.otp.erlang.OtpErlangInt; -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangMap; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangTuple; -import com.ericsson.otp.erlang.OtpOutputStream; - -public class CoreMatchBind { - - @SuppressWarnings("serial") - private static class DumbObject extends OtpErlangObject { - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - - @Override - public void encode(final OtpOutputStream buf) { - fail("unexpected encode() call"); - } - - @Override - public boolean equals(final Object o) { - fail("unexpected equals() call"); - return false; - } - - } - - @SuppressWarnings("serial") - private static class BoundObject extends OtpErlangObject { - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - - @Override - public void encode(final OtpOutputStream buf) { - fail("unexpected encode() call"); - } - - @Override - public boolean equals(final Object o) { - fail("unexpected equals() call"); - return false; - } - - } - - @SuppressWarnings("serial") - private static class TestObject extends OtpErlangObject { - - private final Binder binder; - private DumbObject dumb; - private boolean flag; - private BoundObject obj; - - public TestObject(final boolean flag, final Binder binder, - final DumbObject dumb) { - this.flag = flag; - this.binder = binder; - this.dumb = dumb; - } - - public TestObject(final Binder binder, final BoundObject obj) { - this.binder = binder; - this.obj = obj; - } - - public DumbObject getDumb() { - return dumb; - } - - @Override - public String toString() { - return flag ? "T" : "F"; - } - - @Override - public void encode(final OtpOutputStream buf) { - fail("unexpected encode() call"); - } - - @Override - public boolean equals(final Object o) { - if (obj == null) { - fail("unexpected equals() call"); - } - return o == obj; - } - - @Override - public boolean match(final OtpErlangObject term, final T binds) { - if (binds != binder) { - fail("invalid binder"); - } - if (term != dumb) { - fail("invalid object"); - } - return flag; - } - - @Override - public OtpErlangObject bind(final T binds) - throws OtpErlangException { - if (binds != binder) { - fail("invalid binder"); - } - return obj; - } - - } - - /* - * "always matched" object - */ - @SuppressWarnings("serial") - private static class Any extends OtpErlangObject { - - @Override - public String toString() { - return "any"; - } - - @Override - public void encode(final OtpOutputStream buf) { - fail("unexpected encode() call"); - } - - @Override - public boolean equals(final Object o) { - fail("unexpected equals() call"); - return false; - } - - @Override - public boolean match(final OtpErlangObject term, final T binds) { - return true; - } - } - - private static class Binder { - // make object pair for match() testing - TestObject makeTest(final boolean flag) { - return new TestObject(flag, this, new DumbObject()); - } - - // make object pair for bind() testing - TestObject makeTest() { - return new TestObject(this, new BoundObject()); - } - } - - private static void isNotNull(final Object o) throws Exception { - if (o == null) { - throw new Exception("not null expected"); - } - } - - private static void fail(final String string) { - System.err.println(string); - new Throwable().printStackTrace(System.err); - System.exit(1); - } - - private static void isT(final boolean b) throws Exception { - if (!b) { - throw new Exception("true expected"); - } - } - - private static void isF(final boolean b) throws Exception { - if (b) { - throw new Exception("false expected"); - } - } - - private static void equals(final OtpErlangObject a, final OtpErlangObject b) - throws Exception { - if (!a.equals(b)) { - throw new Exception(a + " != " + b); - } - } - - /* - * scalar match test - match particular test object (producing given result) - * against particular dumb object passing particular bindings object; ensure - * all participants are used as expected in match behavior, check result. - */ - private static void scalar_match_test() throws Exception { - final Binder bind = new Binder(); - - final TestObject t = bind.makeTest(true); - isT(t.match(t.getDumb(), bind)); - - final TestObject f = bind.makeTest(false); - isF(f.match(f.getDumb(), bind)); - } - - /* - * scalar bind test - ensure right object generated based on bindings - */ - private static void scalar_bind_test() throws Exception { - final Binder bind = new Binder(); - final TestObject t = bind.makeTest(); - final OtpErlangObject o = t.bind(bind); - isNotNull(o); - equals(t, o); - } - - /* - * used by tuple_arity_match_test() - */ - private static OtpErlangObject mkTuplePattern(final int n) { - final Any a[] = new Any[n]; - for (int i = 0; i < n; i++) { - a[i] = new Any(); - } - return new OtpErlangTuple(a); - } - - /* - * used by tuple_arity_match_test() - */ - private static OtpErlangObject mkTupleObject(final int n) { - final DumbObject a[] = new DumbObject[n]; - for (int i = 0; i < n; i++) { - a[i] = new DumbObject(); - } - return new OtpErlangTuple(a); - } - - /* - * ensure only tuples of the same arity can match - */ - private static void tuple_arity_match_test(final int m, final int n) - throws Exception { - final Binder bind = new Binder(); - for (int i = m; i < n; i++) { - for (int j = m; j < n; j++) { - final OtpErlangObject p = mkTuplePattern(i); - final OtpErlangObject o = mkTupleObject(j); - if (i == j) { - isT(p.match(o, bind)); - } else { - isF(p.match(o, bind)); - } - } - } - } - - /* - * tuple match test - ensure elements of tuple are matched to corresponding - * elements of tested object and result is logical "and" over all elements. - */ - private static void tuple_match_test(final int n) throws Exception { - final Binder bind = new Binder(); - final int max = 1 << n; - final TestObject a[] = new TestObject[n]; - final DumbObject d[] = new DumbObject[n]; - for (int k = 0; k < max; k++) { - for (int m = 1, i = 0; m < max; m = m << 1, i++) { - d[i] = new DumbObject(); - a[i] = new TestObject((k & m) != 0, bind, d[i]); - } - final OtpErlangObject tpl = new OtpErlangTuple(a); - final OtpErlangObject obj = new OtpErlangTuple(d); - if (k + 1 < max) { - isF(tpl.match(obj, bind)); - } else { - isT(tpl.match(obj, bind)); - } - } - } - - /* - * tuple bind test - ensure result is a tuple where each element is a result - * of binding of corresponding pattern element using provided bindings. - */ - private static void tuple_bind_test(final int n) throws Exception { - final Binder bind = new Binder(); - final TestObject a[] = new TestObject[n]; - final OtpErlangObject b[] = new OtpErlangObject[n]; - for (int i = 0; i < n; i++) { - a[i] = bind.makeTest(); - b[i] = a[i].obj; - } - final OtpErlangObject t = new OtpErlangTuple(a); - final OtpErlangObject o = t.bind(bind); - isNotNull(o); - equals(t, o); - } - - private static OtpErlangObject mkListPattern(final int n, final boolean tail) - throws OtpErlangException { - final Any a[] = new Any[n]; - for (int i = 0; i < n; i++) { - a[i] = new Any(); - } - return tail ? new OtpErlangList(a, new Any()) : new OtpErlangList(a); - } - - private static OtpErlangObject mkListObject(final int n, final boolean tail) - throws OtpErlangException { - final DumbObject a[] = new DumbObject[n]; - for (int i = 0; i < n; i++) { - a[i] = new DumbObject(); - } - return tail ? new OtpErlangList(a, new DumbObject()) - : new OtpErlangList(a); - } - - /* - * ensure only lists of the same arity and same tail presence can match - */ - private static void list_arity_match_test(final int m, final int n) - throws Exception { - final Binder bind = new Binder(); - for (int i = m; i < n; i++) { - for (int j = m; j < n; j++) { - for (int k = 0; k < 2; k++) { - if (i == 0 && k == 1) { - continue; - } - for (int l = 0; l < 2; l++) { - if (j == 0 && l == 1) { - continue; - } - final OtpErlangObject p = mkListPattern(i, k == 1); - final OtpErlangObject o = mkListObject(j, l == 1); - if (i == j && k == l || k == 1 && i <= j) { - isT(p.match(o, bind)); - } else { - isF(p.match(o, bind)); - } - } - } - } - } - } - - /* - * lists match test - ensure elements of lists are matched to corresponding - * elements of tested object and result is logical "and" over all elements, - * count tails as well - */ - private static void list_match_test(final int n) throws Exception { - final Binder bind = new Binder(); - final int max = 1 << n; - final TestObject a[] = new TestObject[n]; - final DumbObject d[] = new DumbObject[n]; - final DumbObject e[] = new DumbObject[n + 1]; - for (int k = 0; k < max; k++) { - for (int m = 1, i = 0; m < max; m = m << 1, i++) { - d[i] = new DumbObject(); - e[i] = d[i]; - a[i] = new TestObject((k & m) != 0, bind, d[i]); - } - for (int i = n; i < n + 1; i++) { - e[i] = new DumbObject(); - } - final OtpErlangObject lst = new OtpErlangList(a); - final OtpErlangObject obj = new OtpErlangList(d); - final OtpErlangObject ext = new OtpErlangList(e); - final OtpErlangObject eTl = new OtpErlangList(e, new DumbObject()); - - if (n > 0) { - final DumbObject dTail = new DumbObject(); - final TestObject tTail = new TestObject(true, bind, dTail); - final TestObject fTail = new TestObject(false, bind, dTail); - final OtpErlangObject fTailLst = new OtpErlangList(a, fTail); - final OtpErlangObject tTailLst = new OtpErlangList(a, tTail); - final OtpErlangObject tailObj = new OtpErlangList(d, dTail); - - // match lists with non-matching tails is always false - isF(fTailLst.match(tailObj, bind)); - - // match list with no tail to list with tail is always false - isF(lst.match(tailObj, bind)); - - // matching lists with matching tails - if (k + 1 < max) { - isF(tTailLst.match(tailObj, bind)); - } else { - isT(tTailLst.match(tailObj, bind)); - } - - // matching shorter pattern with last tail to longer list - // with or with no extra tail; matching list pattern - // with last tail to same length list with no tail. - final Any aTail = new Any(); - final OtpErlangObject shortLst = new OtpErlangList(a, aTail); - if (k + 1 < max) { - isF(shortLst.match(obj, bind)); // same arity - isF(shortLst.match(ext, bind)); // pattern arity is less - isF(shortLst.match(eTl, bind)); // - } else { - isT(shortLst.match(obj, bind)); // same arity - isT(shortLst.match(ext, bind)); // pattern arity is less - isT(shortLst.match(eTl, bind)); // - } - } - - // matching lists with no tails - if (k + 1 < max) { - isF(lst.match(obj, bind)); - } else { - isT(lst.match(obj, bind)); - } - - // extra-length object, no tail in "pattern" - isF(lst.match(ext, bind)); - } - } - - /* - * list bind test - ensure result is a list where each element is a result - * of binding of corresponding pattern element using provided bindings. - */ - private static void list_bind_test(final int n) throws Exception { - final Binder bind = new Binder(); - final TestObject a[] = new TestObject[n]; - final OtpErlangObject b[] = new OtpErlangObject[n]; - for (int i = 0; i < n; i++) { - a[i] = bind.makeTest(); - b[i] = a[i].obj; - } - OtpErlangObject t = new OtpErlangList(a); - OtpErlangObject o = t.bind(bind); - isNotNull(o); - equals(t, o); - if (n > 0) { - // improper list case - t = new OtpErlangList(a, bind.makeTest()); - o = t.bind(bind); - isNotNull(o); - equals(t, o); - } - } - - /* - * map match test - object may have more keys than pattern - */ - private static void map_match_test(final int m, final int n) - throws Exception { - final Binder bind = new Binder(); - - // pattern side - m elements - final OtpErlangObject k1[] = new OtpErlangObject[m]; - final TestObject a[] = new TestObject[m]; - - // object side - n elements - final OtpErlangObject k2[] = new OtpErlangObject[n]; - final DumbObject d[] = new DumbObject[n]; - - final int max = Math.max(m, n); - final int mskHi = 1 << max; - final int full = (1 << m) - 1; - for (int k = 0; k < mskHi; k++) { - for (int msk = 1, i = 0; msk < mskHi; msk = msk << 1, i++) { - if (i < n) { - k2[i] = new OtpErlangInt(i); - d[i] = new DumbObject(); - } - if (i < m) { - k1[i] = new OtpErlangInt(i); - a[i] = new TestObject((k & msk) != 0, bind, i < n ? d[i] - : new DumbObject()); - } - } - final OtpErlangObject map = new OtpErlangMap(k1, a); // m items - final OtpErlangObject obj = new OtpErlangMap(k2, d); // n items - if ((k & full) == full && m <= n) { - isT(map.match(obj, bind)); - } else { - isF(map.match(obj, bind)); - } - } - } - - /* - * map bind test - ensure result is a map where each element is a result of - * binding of corresponding pattern element using provided bindings. - */ - private static void map_bind_test(final int n) throws Exception { - final Binder bind = new Binder(); - final TestObject a[] = new TestObject[n]; - final OtpErlangObject b[] = new OtpErlangObject[n]; - final OtpErlangObject k[] = new OtpErlangObject[n]; - for (int i = 0; i < n; i++) { - a[i] = bind.makeTest(); - b[i] = a[i].obj; - k[i] = new OtpErlangInt(i); - } - final OtpErlangObject t = new OtpErlangMap(k, a); - final OtpErlangObject o = t.bind(bind); - isNotNull(o); - equals(t, o); - } - - public static void main(final String[] args) { - try { - scalar_match_test(); - System.out.println("scalar_match_test() passed"); - - scalar_bind_test(); - System.out.println("scalar_bind_test() passed"); - - for (int m = 0; m < 16; m++) { - for (int n = 0; n < 16; n++) { - tuple_arity_match_test(m, n); - } - } - System.out.println("tuple_arity_match_test() passed"); - - for (int n = 0; n < 16; n++) { - tuple_match_test(n); - } - System.out.println("tuple_match_test() passed"); - - for (int n = 0; n < 16; n++) { - tuple_bind_test(n); - } - System.out.println("tuple_bind_test() passed"); - - for (int m = 0; m < 16; m++) { - for (int n = 0; n < 16; n++) { - list_arity_match_test(m, n); - } - } - System.out.println("list_arity_match_test() passed"); - - for (int n = 0; n < 16; n++) { - list_match_test(n); - } - System.out.println("list_match_test() passed"); - - for (int n = 0; n < 16; n++) { - list_bind_test(n); - } - System.out.println("list_bind_test() passed"); - - for (int m = 0; m < 12; m++) { - for (int n = 0; n < 12; n++) { - map_match_test(m, n); - } - } - System.out.println("map_match_test() passed"); - - for (int n = 0; n < 16; n++) { - map_bind_test(n); - } - System.out.println("map_bind_test() passed"); - - } catch (final Exception e) { - e.printStackTrace(); - System.exit(1); - } - - System.out.println("ok"); - } -} diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/FunEquals.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/FunEquals.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/FunEquals.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/FunEquals.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,26 +3,23 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -import com.ericsson.otp.erlang.OtpErlangAtom; -import com.ericsson.otp.erlang.OtpErlangFun; -import com.ericsson.otp.erlang.OtpErlangLong; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangPid; +import java.util.Arrays; + +import com.ericsson.otp.erlang.*; public class FunEquals { diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/GetNames.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/GetNames.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/GetNames.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/GetNames.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,25 +3,22 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ import java.util.ArrayList; - -import com.ericsson.otp.erlang.OtpMbox; -import com.ericsson.otp.erlang.OtpNode; +import com.ericsson.otp.erlang.*; class GetNames { @@ -40,7 +37,7 @@ OtpMbox mbox3 = node.createMbox(); node.registerName("mbox3",mbox3); - ArrayList existing_names = new ArrayList(); + ArrayList existing_names = new ArrayList(); existing_names.add("mbox3"); existing_names.add("mbox2"); existing_names.add("mbox1"); diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -39,7 +38,6 @@ CLASSPATH = .@PS@$(JINTERFACE_CLASSPATH)@PS@ JAVA_FILES = \ - TransportFactoryTest.java \ Nodename.java \ RegisterAndWhereis.java \ GetNames.java \ @@ -50,8 +48,7 @@ MboxLinkUnlink.java \ NodeStatusHandler.java \ Maps.java \ - FunEquals.java \ - CoreMatchBind.java + FunEquals.java CLASS_FILES = $(JAVA_FILES:.java=.class) diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/Maps.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/Maps.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/Maps.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/Maps.java 2014-09-16 19:10:57.000000000 +0000 @@ -13,17 +13,16 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxLinkUnlink.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxLinkUnlink.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxLinkUnlink.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxLinkUnlink.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,29 +3,21 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -import com.ericsson.otp.erlang.OtpErlangAtom; -import com.ericsson.otp.erlang.OtpErlangExit; -import com.ericsson.otp.erlang.OtpErlangLong; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangPid; -import com.ericsson.otp.erlang.OtpErlangTuple; -import com.ericsson.otp.erlang.OtpMbox; -import com.ericsson.otp.erlang.OtpNode; +import com.ericsson.otp.erlang.*; class MboxLinkUnlink { @@ -74,10 +66,7 @@ OtpErlangObject[] msg = {mainMbox.self(),mbox.self()}; mbox.send("erl_link_server", erlNode, new OtpErlangTuple(msg)); OtpErlangObject o = mbox.receive(1000); - if (o == null) { - System.exit(1); - return; - } + if (o == null) System.exit(1); OtpErlangTuple tuple = (OtpErlangTuple)o; int tag = (int)((OtpErlangLong)tuple.elementAt(0)).longValue(); @@ -102,7 +91,6 @@ expected = tuple.elementAt(2); mbox.receive(1000); System.exit(2); - break; case erl_link_java_exit: dbg("Java got \"erl_link_java_exit\""); mbox.exit(tuple.elementAt(2)); @@ -116,7 +104,6 @@ expected = tuple.elementAt(2); mbox.receive(1000); System.exit(3); - break; case internal_link_linking_exits: dbg("Java got \"internal_link_linking_exits\""); mbox2 = node.createMbox(); @@ -126,7 +113,6 @@ expected = tuple.elementAt(2); mbox2.receive(1000); // hanging waiting for exit System.exit(4); // got someting other than exit - break; case internal_link_linked_exits: dbg("Java got \"internal_link_linked_exits\""); mbox2 = node.createMbox(); @@ -136,7 +122,6 @@ expected = tuple.elementAt(2); mbox.receive(1000); // hanging waiting for exit System.exit(5); // got someting other than exit - break; case internal_unlink_linking_exits: dbg("Java got \"internal_unlink_linking_exits\""); mbox2 = node.createMbox(); diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxPing.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxPing.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxPing.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxPing.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxSendReceive.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxSendReceive.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxSendReceive.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/MboxSendReceive.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,28 +3,21 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -import com.ericsson.otp.erlang.OtpErlangAtom; -import com.ericsson.otp.erlang.OtpErlangLong; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangPid; -import com.ericsson.otp.erlang.OtpErlangTuple; -import com.ericsson.otp.erlang.OtpMbox; -import com.ericsson.otp.erlang.OtpNode; +import com.ericsson.otp.erlang.*; class MboxSendReceive { @@ -42,7 +35,6 @@ private static final int java_internal_send_receive_different_nodes = 3; private static final int java_internal_send_receive_self = 4; - @SuppressWarnings("null") public static void main(String argv[]) { String cookie = argv[0]; diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/Nodename.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/Nodename.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/Nodename.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/Nodename.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/NodePing.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/NodePing.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/NodePing.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/NodePing.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/NodeStatusHandler.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/NodeStatusHandler.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/NodeStatusHandler.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/NodeStatusHandler.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,29 +3,21 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ -import com.ericsson.otp.erlang.OtpErlangAtom; -import com.ericsson.otp.erlang.OtpErlangBoolean; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; -import com.ericsson.otp.erlang.OtpMbox; -import com.ericsson.otp.erlang.OtpNode; -import com.ericsson.otp.erlang.OtpNodeStatus; +import com.ericsson.otp.erlang.*; public class NodeStatusHandler extends OtpNodeStatus { /* @@ -94,10 +86,7 @@ } OtpErlangObject o = mbox.receive(recTime); - if (o == null) { - System.exit(2); - return; - } + if (o == null) System.exit(2); if (! ((OtpErlangAtom)o).atomValue().equals("done")) System.exit(3); @@ -111,7 +100,6 @@ - @Override public void remoteStatus(String node, boolean up, Object info) { try { dbg("Got remoteStatus: " + node + " " + up + " " + info); @@ -132,7 +120,6 @@ } - @Override public void localStatus(String node, boolean up, Object info) { try { dbg("Got localStatus: " + node + " " + up + " " + info); @@ -154,7 +141,6 @@ -@Override public void connAttempt(String node, boolean incoming, Object info) { try { dbg("Got connAttempt: " + node + " " + incoming + " " + info); diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/RegisterAndWhereis.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/RegisterAndWhereis.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/RegisterAndWhereis.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/RegisterAndWhereis.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/TransportFactoryTest.java erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/TransportFactoryTest.java --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE_data/TransportFactoryTest.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE_data/TransportFactoryTest.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2015. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - */ - -import java.io.IOException; -import java.net.InetAddress; - -import com.ericsson.otp.erlang.OtpSelf; -import com.ericsson.otp.erlang.OtpServerTransport; -import com.ericsson.otp.erlang.OtpSocketTransportFactory; -import com.ericsson.otp.erlang.OtpTransport; -import com.ericsson.otp.erlang.OtpTransportFactory; - -/** - * @author Dmitriy Kargapolov - */ -public class TransportFactoryTest { - - /** - * example of custom transport factory wrapping default one - */ - public static class TransportFactory implements OtpTransportFactory { - - OtpSocketTransportFactory tf = new OtpSocketTransportFactory(); - - public OtpTransport createTransport(final String addr, final int port) - throws IOException { - clientOk = true; - System.out.println("creating transport to " + addr + ", " + port); - return tf.createTransport(addr, port); - } - - public OtpTransport createTransport(final InetAddress addr, - final int port) throws IOException { - clientOk = true; - System.out.println("creating transport to " + addr + ", " + port); - return tf.createTransport(addr, port); - } - - public OtpServerTransport createServerTransport(final int port) - throws IOException { - serverOk = true; - System.out.println("creating server transport to " + port); - return tf.createServerTransport(port); - } - - } - - static boolean serverOk = false; - static boolean clientOk = false; - - public static void main(final String[] args) throws IOException { - - // check server transport - final OtpSelf self = new OtpSelf("local", new TransportFactory()); - if (!serverOk) { - fail("custom server transport was not created"); - } - System.out.println("accepting connections on " + self.port()); - - // check client transport - try { - self.publishPort(); - } catch (final Exception e) { - } - if (!clientOk) { - fail("custom client transport was not created"); - } - } - - private static void fail(final String string) { - System.err.println(string); - System.exit(1); - } -} diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE.erl erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE.erl --- erlang-18.2-dfsg/lib/jinterface/test/jinterface_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jinterface_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,8 +22,7 @@ init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2]). --export([transport_factory/1, - nodename/1, register_and_whereis/1, get_names/1, boolean_atom/1, +-export([nodename/1, register_and_whereis/1, get_names/1, boolean_atom/1, node_ping/1, mbox_ping/1, java_erlang_send_receive/1, java_internal_send_receive_same_node/1, @@ -41,8 +39,7 @@ status_handler_localStatus/1, status_handler_remoteStatus/1, status_handler_connAttempt/1, maps/1, - fun_equals/1, - core_match_bind/1 + fun_equals/1 ]). -include_lib("common_test/include/ct.hrl"). @@ -106,14 +103,12 @@ fundamental() -> [ - transport_factory, % TransportFactoryTest.java nodename, % Nodename.java register_and_whereis, % RegisterAndWhereis.java get_names, % GetNames.java boolean_atom, % BooleanAtom.java maps, % Maps.java - fun_equals, % FunEquals.java - core_match_bind % CoreMatchBind.java + fun_equals % FunEquals.java ]. ping() -> @@ -206,16 +201,6 @@ %%%----------------------------------------------------------------- %%% TEST CASES %%%----------------------------------------------------------------- -transport_factory(doc) -> - ["TransportFactoryTest.java: Test custom OTP Transport Factory"]; -transport_factory(suite) -> - []; -transport_factory(Config) when is_list(Config) -> - ok = jitu:java(?config(java, Config), - ?config(data_dir, Config), - "TransportFactoryTest"). - -%%%----------------------------------------------------------------- nodename(doc) -> ["Nodename.java: " "Test OtpNode.node(), OtpNode.alive() and OtpNode.host()"]; @@ -720,18 +705,6 @@ []). %%%----------------------------------------------------------------- -core_match_bind(doc) -> - ["CoreMatchBind.java: " - "Test OtpErlangObject.match() and bind()"]; -core_match_bind(suite) -> - []; -core_match_bind(Config) when is_list(Config) -> - ok = jitu:java(?config(java, Config), - ?config(data_dir, Config), - "CoreMatchBind", - []). - -%%%----------------------------------------------------------------- %%% INTERNAL FUNCTIONS %%%----------------------------------------------------------------- send_receive(TestCaseTag,Fun,Config) -> diff -Nru erlang-18.2-dfsg/lib/jinterface/test/jitu.erl erlang-17.3-dfsg/lib/jinterface/test/jitu.erl --- erlang-18.2-dfsg/lib/jinterface/test/jitu.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/jitu.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -118,7 +117,10 @@ end, es(Dir++PS++ filename:join([code:lib_dir(jinterface),"priv","OtpErlang.jar"])++PS++ - os:getenv("CLASSPATH", ""), + case os:getenv("CLASSPATH") of + false -> ""; + Classpath -> Classpath + end, Quote, EscSpace). diff -Nru erlang-18.2-dfsg/lib/jinterface/test/Makefile erlang-17.3-dfsg/lib/jinterface/test/Makefile --- erlang-18.2-dfsg/lib/jinterface/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/jinterface/test/nc_SUITE_data/connection_server.java erlang-17.3-dfsg/lib/jinterface/test/nc_SUITE_data/connection_server.java --- erlang-18.2-dfsg/lib/jinterface/test/nc_SUITE_data/connection_server.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/nc_SUITE_data/connection_server.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2010. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/jinterface/test/nc_SUITE_data/echo_server.java erlang-17.3-dfsg/lib/jinterface/test/nc_SUITE_data/echo_server.java --- erlang-18.2-dfsg/lib/jinterface/test/nc_SUITE_data/echo_server.java 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/nc_SUITE_data/echo_server.java 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2004-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -149,13 +148,11 @@ final String atomValue = ((OtpErlangAtom) t).atomValue(); if (atomValue.equals("binary") && i instanceof OtpErlangBinary) { final OtpErlangBinary b = (OtpErlangBinary) i; - @SuppressWarnings("resource") final OtpInputStream bis = new OtpInputStream(b.binaryValue(), 0); final OtpErlangObject o = bis.read_any(); return o; } else if (atomValue.equals("compress")) { - @SuppressWarnings("resource") final OtpOutputStream oos = new OtpOutputStream(); oos.write1(OtpExternal.versionTag); oos.write_compressed(i); @@ -209,7 +206,6 @@ && i instanceof OtpErlangString) { final OtpErlangString s = (OtpErlangString) i; final String ss = s.stringValue().substring(3, 6); - @SuppressWarnings("unused") final int[] cps = OtpErlangString.stringToCodePoints(ss); return s; } else if (atomValue.equals("utf8")) { diff -Nru erlang-18.2-dfsg/lib/jinterface/test/nc_SUITE_data/Makefile.src erlang-17.3-dfsg/lib/jinterface/test/nc_SUITE_data/Makefile.src --- erlang-18.2-dfsg/lib/jinterface/test/nc_SUITE_data/Makefile.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/nc_SUITE_data/Makefile.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/jinterface/test/nc_SUITE.erl erlang-17.3-dfsg/lib/jinterface/test/nc_SUITE.erl --- erlang-18.2-dfsg/lib/jinterface/test/nc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/nc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -215,7 +214,6 @@ 0.0, math:sqrt(2), <<1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,31:5>>, - "{}", RandomBin1k, RandomBin1M, RandomBin10M, @@ -245,7 +243,6 @@ 0.0, math:sqrt(2), <<1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,31:5>>, - "{}", RandomBin1k, RandomBin1M, RandomBin10M, diff -Nru erlang-18.2-dfsg/lib/jinterface/test/.project erlang-17.3-dfsg/lib/jinterface/test/.project --- erlang-18.2-dfsg/lib/jinterface/test/.project 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/.project 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ - - - jinterface_tests - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff -Nru erlang-18.2-dfsg/lib/jinterface/test/.settings/org.eclipse.jdt.core.prefs erlang-17.3-dfsg/lib/jinterface/test/.settings/org.eclipse.jdt.core.prefs --- erlang-18.2-dfsg/lib/jinterface/test/.settings/org.eclipse.jdt.core.prefs 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/test/.settings/org.eclipse.jdt.core.prefs 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff -Nru erlang-18.2-dfsg/lib/jinterface/vsn.mk erlang-17.3-dfsg/lib/jinterface/vsn.mk --- erlang-18.2-dfsg/lib/jinterface/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/jinterface/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -JINTERFACE_VSN = 1.6.1 +JINTERFACE_VSN = 1.5.10 diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/application.xml erlang-17.3-dfsg/lib/kernel/doc/src/application.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/application.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/application.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -60,9 +59,8 @@ - tuple_of(T) -

    - A tuple where the elements are of type T.

    + tuple_of(T) +

    A tuple where the elements are of type T.

    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/app.xml erlang-17.3-dfsg/lib/kernel/doc/src/app.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/app.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/app.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -191,7 +190,7 @@ start phases must be a subset of the set of phases defined for the primary application. Refer to OTP Design Principles for more information.

    - runtime_dependencies + runtime_dependencies

    A list of application versions that the application depends on. An example of such an application version is "kernel-3.0". Application versions specified as runtime diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/auth.xml erlang-17.3-dfsg/lib/kernel/doc/src/auth.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/auth.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/auth.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -50,7 +49,7 @@ be established in this case. Returns no if Node does not exist or communication is not authorized (it has another cookie than auth thinks it has).

    -

    Use net_adm:ping(Node) +

    Use net_adm:ping(Node) instead.

    @@ -71,7 +70,7 @@

    Use - erlang:set_cookie(node(), Cookie) + erlang:set_cookie(node(), Cookie) instead.

    @@ -94,8 +93,8 @@

    Sets the magic cookie of Node to Cookie, and verifies the status of the authorization. Equivalent to calling - erlang:set_cookie(Node, Cookie), followed by - auth:is_auth(Node).

    + erlang:set_cookie(Node, Cookie), followed by + auth:is_auth(Node).

    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/book.xml erlang-17.3-dfsg/lib/kernel/doc/src/book.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/code.xml erlang-17.3-dfsg/lib/kernel/doc/src/code.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/code.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/code.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -180,7 +179,7 @@ example, the call erl_prim_loader:list_dir( "/otp/root/lib/mnesia-4.4.7.ez/mnesia-4.4.7/examples/bench)" would list the contents of a directory inside an archive. - See erl_prim_loader(3).

    + See erl_prim_loader(3)

    .

    An application archive file and a regular application directory may coexist. This may be useful when there is a need of having @@ -230,7 +229,7 @@ -code_path_choice Choice. If the flag is set to relaxed, the code server will instead choose a suitable directory depending on the actual file structure. If there exists a regular - application ebin directory, it will be chosen. But if it does + application ebin directory,situation it will be chosen. But if it does not exist, the ebin directory in the archive is chosen if it exists. If neither of them exists the original directory will be chosen.

    @@ -242,7 +241,7 @@ particular useful to set the flag to relaxed when you want to elaborate with code loading from archives without editing the boot script. The default is relaxed. See init(3)

    + marker="erts:init">init(3)

    @@ -282,9 +281,9 @@

    From the R12B release, functions in this module will generally fail with an exception if they are passed an incorrect type (for instance, an integer or a tuple - where an atom was expected). An error tuple will be returned if the type of the argument + where an atom was expected). An error tuple will be returned if type of argument was correct, but there was some other error (for instance, a non-existing directory - was given to set_path/1).

    + given to set_path/1.

    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/config.xml erlang-17.3-dfsg/lib/kernel/doc/src/config.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/config.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/config.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/disk_log.xml erlang-17.3-dfsg/lib/kernel/doc/src/disk_log.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/disk_log.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/disk_log.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -233,11 +232,11 @@ - Asynchronously log an item onto a disk log. + Asynchronously log an item onto a disk log.

    The alog/2 and balog/2 functions asynchronously append an item to a disk log. The function alog/2 is @@ -288,8 +287,8 @@ - Block a disk log. + Block a disk log.

    With a call to block/1,2 a process can block a log. If the blocking process is not an owner of the log, a temporary @@ -663,8 +662,8 @@ - Close a disk log on one node. + Close a disk log on one node.

    The function lclose/1 closes a local log or an individual distributed log on the current node. @@ -744,7 +743,6 @@ - Open a disk log file. @@ -754,6 +752,7 @@ + Open a disk log file.

    The ArgL parameter is a list of options which have the following meanings:

    @@ -1043,8 +1042,8 @@
    - Flush the contents of a disk log to the disk. + Flush the contents of a disk log to the disk.

    The sync/1 function ensures that the contents of the log are actually written to the disk. @@ -1086,8 +1085,8 @@ - Unblock a disk log. + Unblock a disk log.

    The unblock/1 function unblocks a log. A log can only be unblocked by the blocking process. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/erlang_stub.xml erlang-17.3-dfsg/lib/kernel/doc/src/erlang_stub.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/erlang_stub.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/erlang_stub.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/erl_boot_server.xml erlang-17.3-dfsg/lib/kernel/doc/src/erl_boot_server.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/erl_boot_server.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/erl_boot_server.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/erl_ddll.xml erlang-17.3-dfsg/lib/kernel/doc/src/erl_ddll.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/erl_ddll.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/erl_ddll.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -388,14 +387,14 @@ remove a monitor.

    The function accepts the following parameters:

    - Tag + Tag

    The monitor tag is always driver as this function can only be used to create driver monitors. In the future, driver monitors will be integrated with process monitors, why this parameter has to be given for consistence.

    - Item + Item

    The Item parameter specifies which driver one wants to monitor (the name of the driver) as well as @@ -642,7 +641,7 @@

    The function accepts the following parameters:

    - Path + Path

    The filesystem path to the directory where the driver object file is situated. The filename of the object file @@ -665,7 +664,7 @@ to have only one loader of a driver one wants to upgrade in a running system!

    - Name + Name

    The name parameter is the name of the driver to be used in subsequent calls to open_port. The @@ -678,14 +677,14 @@ with this Name parameter, much as a beam-file's module name much correspond to its filename.

    - OptionList + OptionList

    A number of options can be specified to control the loading operation. The options are given as a list of two-tuples, the tuples having the following values and meanings:

    - {driver_options, DriverOptionList} + {driver_options, DriverOptionList}

    This option is to provide options that will change its general behavior and will "stick" to the driver @@ -701,7 +700,7 @@ when the last user calls try_unload/2, or the last process having loaded the driver exits.

    - {monitor, MonitorOption} + {monitor, MonitorOption}

    A MonitorOption tells try_load/3 to trigger a driver monitor under certain @@ -732,7 +731,7 @@ {monitor, pending_driver} in production code (see the monitor discussion above).

    - {reload, ReloadOption} + {reload,ReloadOption}

    This option is used when one wants to reload a driver from disk, most often in a @@ -910,13 +909,13 @@

    The function accepts the following parameters:

    - Name + Name

    The name parameter is the name of the driver to be unloaded. The name can be specified either as an iolist() or as an atom().

    - OptionList + OptionList

    The OptionList argument can be used to specify certain behavior regarding ports as well as triggering @@ -934,7 +933,7 @@ unloads, one should use the driver option kill_ports when loading the driver instead.

    - {monitor, MonitorOption} + {monitor, MonitorOption}

    This option creates a driver monitor if the condition given in MonitorOption is true. The valid diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/erl_prim_loader_stub.xml erlang-17.3-dfsg/lib/kernel/doc/src/erl_prim_loader_stub.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/erl_prim_loader_stub.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/erl_prim_loader_stub.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/error_handler.xml erlang-17.3-dfsg/lib/kernel/doc/src/error_handler.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/error_handler.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/error_handler.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/error_logger.xml erlang-17.3-dfsg/lib/kernel/doc/src/error_logger.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/error_logger.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/error_logger.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -59,11 +58,12 @@ specific events. (add_report_handler/1,2). Also, there is a useful event handler in STDLIB for multi-file logging of events, see log_mf_h(3).

    -

    Warning events were introduced in Erlang/OTP R9C and are enabled - by default as of 18.0. To retain backwards compatibility with existing - user defined event handlers, these may be tagged as errors or info - using the command line flag ]]>, thus - showing up as error or info reports in the logs.

    +

    Warning events was introduced in Erlang/OTP R9C. To retain + backwards compatibility, these are by default tagged as errors, + thus showing up as error reports in the logs. By using + the command line flag ]]>, they can instead + be tagged as warnings or info. Tagging them as warnings may + require rewriting existing user defined event handlers.

    @@ -132,7 +132,7 @@

    Returns the current mapping for warning events. Events sent using warning_msg/1,2 or warning_report/1,2 - are tagged as errors, warnings (default) or info, depending + are tagged as errors (default), warnings or info, depending on the value of the command line flag +W.

     os$ erl
    @@ -140,25 +140,25 @@
     
     Eshell V5.4.8  (abort with ^G)
     1> error_logger:warning_map().
    -warning
    -2> error_logger:warning_msg("Warnings tagged as: ~p~n", [warning]).
    +error
    +2> error_logger:warning_msg("Warnings tagged as: ~p~n", [error]).
     
    -=WARNING REPORT==== 11-Aug-2005::15:31:55 ===
    -Warnings tagged as: warning
    +=ERROR REPORT==== 11-Aug-2005::15:31:23 ===
    +Warnings tagged as: error
     ok
     3> 
     User switch command
      --> q
    -os$ erl +W e
    +os$ erl +W w
     Erlang (BEAM) emulator version 5.4.8 [hipe] [threads:0] [kernel-poll]
     
     Eshell V5.4.8  (abort with ^G)
     1> error_logger:warning_map().
    -error
    -2> error_logger:warning_msg("Warnings tagged as: ~p~n", [error]).
    +warning
    +2> error_logger:warning_msg("Warnings tagged as: ~p~n", [warning]).
     
    -=ERROR REPORT==== 11-Aug-2005::15:31:23 ===
    -Warnings tagged as: error
    +=WARNING REPORT==== 11-Aug-2005::15:31:55 ===
    +Warnings tagged as: warning
     ok
    @@ -299,12 +299,12 @@ - Enable or disable error printouts to a file + Enable or disable error printouts to a file

    Enables or disables printout of standard events to a file.

    This is done by adding or deleting the standard event handler diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/file.xml erlang-17.3-dfsg/lib/kernel/doc/src/file.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/file.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/file.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -87,10 +86,9 @@ - fd() + fd() -

    - A file descriptor representing a file opened in A file descriptor representing a file opened in raw mode.

    @@ -492,7 +490,7 @@ List files in a directory -

    Lists all files in a directory, except files +

    Lists all files in a directory, except files with "raw" names. Returns {ok, Filenames} if successful. Otherwise, it returns {error, Reason}. @@ -1194,8 +1192,8 @@ and read_line/1 are the only ways to read from a file opened in raw mode (although they work for normally opened files, too).

    -

    For files where encoding is set to something else than latin1, one character might be represented by more than one byte on the file. The parameter Number always denotes the number of characters read from the file, while the position in the file might be moved much more than this number when reading a Unicode file.

    -

    Also, if encoding is set to something else than latin1, the read/3 call will fail if the data contains characters larger than 255, which is why the io(3) module is to be preferred when reading such a file.

    +

    For files where encoding is set to something else than latin1, one character might be represented by more than one byte on the file. The parameter Number always denotes the number of characters read from the file, why the position in the file might be moved a lot more than this number when reading a Unicode file.

    +

    Also if encoding is set to something else than latin1, the read/3 call will fail if the data contains characters larger than 255, why the io(3) module is to be preferred when reading such a file.

    The function returns:

    {ok, Data} @@ -1285,8 +1283,6 @@ or before unix time epoch which is 1970-01-01 00:00 UTC. Default is {time, local}.

    -

    If the raw option is set, the file server will not be called - and only informations about local files will be returned.

    Since file times is stored in posix time on most OS it is @@ -1308,15 +1304,15 @@

    The current system access to the file.

    - atime = date_time() | integer() >= 0 + atime = date_time() | integer() >= 0

    The last time the file was read.

    - mtime = date_time() | integer() >= 0 + mtime = date_time() | integer() >= 0

    The last time the file was written.

    - ctime = date_time() | integer() >=0 + ctime = date_time() | integer() >=0

    The interpretation of this time field depends on the operating system. On Unix, it is the last time @@ -1513,8 +1509,6 @@ the link will be returned in the file_info record and the type field of the record will be set to symlink.

    -

    If the raw option is set, the file server will not be called - and only informations about local files will be returned.

    If Name is not a symbolic link, this function returns exactly the same result as read_file_info/1. On platforms that do not support symbolic links, this function @@ -1695,9 +1689,9 @@

    Makes sure that any buffers kept by the operating system (not by the Erlang runtime system) are written to disk. In - many ways it resembles fsync but it does not update - some of the file's metadata such as the access time. On - some platforms this function has no effect.

    + many ways it's resembles fsync but it not requires to update + some of file's metadata such as the access time. On + some platforms, this function might have no effect.

    Applications that access databases or log files often write a tiny data fragment (e.g., one line in a log file) and then call fsync() immediately in order to ensure that the written @@ -1705,11 +1699,11 @@ will always initiate two write operations: one for the newly written data and another one in order to update the modification time stored in the inode. If the modification time is not a part - of the transaction concept, fdatasync() can be used to avoid + of the transaction concept fdatasync() can be used to avoid unnecessary inode disk write operations.

    -

    Available only in some POSIX systems, this call results in a - call to fsync(), or has no effect in systems not implementing - the fdatasync() syscall.

    +

    Available only in some POSIX systems. This call results in a + call to fsync(), or has no effect, in systems not implementing + the fdatasync syscall.

    @@ -1746,7 +1740,7 @@ See gen_tcp:controlling_process/2

    If the OS used does not support sendfile, an Erlang fallback using file:read and gen_tcp:send is used.

    -

    The option list can contain the following options:

    +

    The option list can contain the following options: chunk_size The chunk size used by the erlang fallback to send @@ -1761,6 +1755,7 @@ the sendfile call will return {error,einval}. Introduced in Erlang/OTP 17.0. Default is false. +

    @@ -1851,21 +1846,20 @@ Type local will interpret the time set as local, universal will interpret it as universal time and posix must be seconds since or before unix time epoch which is 1970-01-01 00:00 UTC. - Default is {time, local}.

    -

    If the raw option is set, the file server will not be called - and only informations about local files will be returned.

    + Default is {time, local}. +

    The following fields are used from the record, if they are given.

    - atime = date_time() | integer() >= 0 + atime = date_time() | integer() >= 0

    The last time the file was read.

    - mtime = date_time() | integer() >= 0 + mtime = date_time() | integer() >= 0

    The last time the file was written.

    - ctime = date_time() | integer() >= 0 + ctime = date_time() | integer() >= 0

    On Unix, any value give for this field will be ignored (the "ctime" for the file will be set to the current diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/gen_sctp.xml erlang-17.3-dfsg/lib/kernel/doc/src/gen_sctp.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/gen_sctp.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/gen_sctp.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -77,10 +76,9 @@ - assoc_id() + assoc_id() -

    - An opaque term returned in for example #sctp_paddr_change{} +

    An opaque term returned in for example #sctp_paddr_change{} that identifies an association for an SCTP socket. The term is opaque except for the special value 0 that has a meaning such as "the whole endpoint" or "all future associations". @@ -99,10 +97,9 @@ - sctp_socket() + sctp_socket() -

    - Socket identifier returned from open/*.

    +

    Socket identifier returned from open/*.

    @@ -148,7 +145,7 @@ Addr and Port. The Timeout, is expressed in milliseconds. A socket can be associated with multiple peers.

    -

    WARNING:Using a value of Timeout less than +

    WARNING:Using a value of Timeout less than the maximum time taken by the OS to establish an association (around 4.5 minutes if the default values from RFC 4960 are used) can result in inconsistent or incorrect return values. This is especially @@ -172,7 +169,7 @@

    The number of outbound and inbound streams can be set by giving an sctp_initmsg option to connect as in:

    -
      connect(Socket, Ip, Port>,
    +
      connect(Socket, Ip, Port,
             [{sctp_initmsg,#sctp_initmsg{num_ostreams=OutStreams,
                                          max_instreams=MaxInStreams}}])        

    All options Opt are set on the socket before the @@ -964,7 +961,7 @@

      #sctp_paddrinfo{
             assoc_id  = assoc_id(),
             address   = {IP, Port},
    -        state     = inactive | active | unconfirmed,
    +        state     = inactive | active,
             cwnd      = integer(),
             srtt      = integer(),
             rto       = integer(),
    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/gen_tcp.xml erlang-17.3-dfsg/lib/kernel/doc/src/gen_tcp.xml
    --- erlang-18.2-dfsg/lib/kernel/doc/src/gen_tcp.xml	2015-12-15 20:10:35.000000000 +0000
    +++ erlang-17.3-dfsg/lib/kernel/doc/src/gen_tcp.xml	2014-09-16 19:10:57.000000000 +0000
    @@ -8,17 +8,16 @@
           Ericsson AB. All Rights Reserved.
         
         
    -      Licensed under the Apache License, Version 2.0 (the "License");
    -      you may not use this file except in compliance with the License.
    -      You may obtain a copy of the License at
    - 
    -          http://www.apache.org/licenses/LICENSE-2.0
    -
    -      Unless required by applicable law or agreed to in writing, software
    -      distributed under the License is distributed on an "AS IS" BASIS,
    -      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -      See the License for the specific language governing permissions and
    -      limitations under the License.
    +      The contents of this file are subject to the Erlang Public License,
    +      Version 1.1, (the "License"); you may not use this file except in
    +      compliance with the License. You should have received a copy of the
    +      Erlang Public License along with this software. If not, it can be
    +      retrieved online at http://www.erlang.org/.
    +    
    +      Software distributed under the License is distributed on an "AS IS"
    +      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
    +      the License for the specific language governing rights and limitations
    +      under the License.
         
         
     
    @@ -78,10 +77,9 @@
           
         
         
    -      socket()
    +      socket()
           
    -        

    - As returned by accept/1,2 and connect/3,4.

    +

    As returned by accept/1,2 and connect/3,4.

    @@ -349,22 +347,11 @@ - Asynchronously close a socket + Immediately close a socket -

    Close a socket in one or two directions.

    +

    Immediately close a socket in one or two directions.

    How == write means closing the socket for writing, reading from it is still possible.

    -

    If How == read, or there is no outgoing - data buffered in the Socket port, - then the socket is shutdown immediately and any error encountered - is returned in Reason.

    -

    If there is data buffered in the socket port, then the attempt - to shutdown the socket is postponed until that data is written to the - kernel socket send buffer. Any errors encountered will result - in the socket being closed and {error, closed} being returned - on the next - recv/2 or - send/2.

    To be able to handle that the peer has done a shutdown on the write side, the {exit_on_close, false} option is useful.

    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/gen_udp.xml erlang-17.3-dfsg/lib/kernel/doc/src/gen_udp.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/gen_udp.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/gen_udp.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -43,9 +42,9 @@ - socket() + socket() -

    As returned by open/1,2.

    +

    As returned by open/1,2.

    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/global_group.xml erlang-17.3-dfsg/lib/kernel/doc/src/global_group.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/global_group.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/global_group.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/global.xml erlang-17.3-dfsg/lib/kernel/doc/src/global.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/global.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/global.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/heart.xml erlang-17.3-dfsg/lib/kernel/doc/src/heart.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/heart.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/heart.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -79,16 +78,6 @@
     % erl -heart -env ERL_CRASH_DUMP_SECONDS 10 ...
    - -

    If a regular core dump is wanted, let heart know by setting the kill signal to abort - using the environment variable . - If unset, or not set to , the default behaviour will be a kill - signal using . -

    - -
    -% erl -heart -env HEART_KILL_SIGNAL SIGABRT ...
    -

    Furthermore, has the following behaviour on heart: diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/inet_res.xml erlang-17.3-dfsg/lib/kernel/doc/src/inet_res.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/inet_res.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/inet_res.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@

    - 20092015 + 20092013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -77,11 +76,8 @@ query is tried for the alt_nameservers.

    -
    - Resolver Types -

    The following data types concern the resolver:

    -
    +

    Resolver types:

    @@ -91,13 +87,8 @@ -
    -
    - DNS Types -

    - The following data types concern the DNS client:

    -
    - + +

    DNS types:

    A string with no adjacent dots.

    @@ -114,7 +105,7 @@

    This is the start of a hiearchy of opaque data structures that can be examined with access functions in inet_dns that return lists of {Field,Value} tuples. The arity 2 functions - just return the value for a given field.

    + just return the value for a given field.
     dns_msg() = DnsMsg
         inet_dns:msg(DnsMsg) ->
    @@ -162,19 +153,18 @@
                          | {version, integer()}
                          | {z, integer()}
                          | {data, dns_data()} ]
    -    inet_dns:rr(DnsRr, Field) -> Value
    + inet_dns:rr(DnsRr, Field) -> Value -

    There is an info function for the types above:

    +There is an info function for the types above: -
     inet_dns:record_type(dns_msg()) -> msg;
     inet_dns:record_type(dns_header()) -> header;
     inet_dns:record_type(dns_query()) -> dns_query;
     inet_dns:record_type(dns_rr()) -> rr;
    -inet_dns:record_type(_) -> undefined.
    +inet_dns:record_type(_) -> undefined. -

    So; inet_dns:(inet_dns:record_type(X))(X) will convert -any of these data structures into a {Field,Value} list.

    +So; inet_dns:(inet_dns:record_type(X))(X) will convert +any of these data structures into a {Field,Value} list.

    @@ -281,7 +271,7 @@

    Resolve a DNS record of the given type and class for the given name. The returned dns_msg() can be examined using access functions in inet_db as described - in DNS Types. + in DNS types.

    If Name is an ip_address(), the domain name to query for is generated as the standard reverse diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/inet.xml erlang-17.3-dfsg/lib/kernel/doc/src/inet.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/inet.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/inet.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@

    - 19972015 + 19972013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -117,9 +116,8 @@ - socket() -

    - See gen_tcp(3) + socket() +

    See gen_tcp(3) and gen_udp(3).

    @@ -140,7 +138,7 @@ Return a list of IP configuration parameters -

    Returns the state of the Inet configuration database in +

    Returns the state of the Inet configuration database in form of a list of recorded configuration parameters. (See the ERTS User's Guide, Inet configuration, for more information). Only parameters with other than default values are returned.

    @@ -223,7 +221,7 @@

    Do not rely too much on the order of Flag atoms or - Ifopt tuples. There are some rules, though:

    + Ifopt tuples. There are some rules, though: Immediately after {addr,_} follows {netmask,_} @@ -239,6 +237,7 @@ tuple concerns that address. +

    The {hwaddr,_} tuple is not returned on Solaris since the hardware address historically belongs to the link layer and only @@ -259,8 +258,8 @@ -

    Gets one or more options for a socket. - See setopts/2 +

    Gets one or more options for a socket. + See setopts/2 for a list of available options.

    The number of elements in the returned OptionValues list does not necessarily correspond to the number of options @@ -279,14 +278,14 @@ by the protocol level, the option number and either a binary or the size, in bytes, of the buffer in which the option value is to be stored. A binary - should be used when the underlying getsockopt requires + should be used when the underlying getsockopt requires input in the argument field, in which case the size of the binary should correspond to the required buffer size of the return value. The supplied values in a RawOptReq correspond to the second, third and fourth/fifth parameters to the getsockopt call in the C socket API. The value stored - in the buffer is returned as a binary ValueBin + in the buffer is returned as a binary ValueBin where all values are coded in the native endianess.

    Asking for and inspecting raw socket options require low level information about the current operating system and TCP @@ -307,7 +306,7 @@ value to be a 32 bit integer. We could use the following code to retrieve the value:

    + get_tcpi_sacked(Sock) -> {ok,[{raw,_,_,Info}]} = inet:getopts(Sock,[{raw,6,11,92}]), <<_:28/binary,TcpiSacked:32/native,_/binary>> = Info, TcpiSacked.]]> @@ -333,23 +332,23 @@ recv_avg -

    Average size of packets in bytes received by the socket.

    +

    Average size of packets in bytes received to the socket.

    recv_cnt -

    Number of packets received by the socket.

    +

    Number of packets received to the socket.

    recv_dvi -

    Average packet size deviation in bytes received by the socket.

    +

    Average packet size deviation in bytes received to the socket.

    recv_max -

    The size of the largest packet in bytes received by the socket.

    +

    The size of the largest packet in bytes received to the socket.

    recv_oct -

    Number of bytes received by the socket.

    +

    Number of bytes received to the socket.

    send_avg @@ -379,14 +378,14 @@ Convert IPv6 / IPV4 adress to ascii -

    Parses an ip_address() and returns an IPv4 or IPv6 address string.

    +

    Parses an ip_address() and returns an IPv4 or IPv6 address string.

    Parse an IPv4 address -

    Parses an IPv4 address string and returns an ip4_address(). +

    Parses an IPv4 address string and returns an ip4_address(). Accepts a shortened IPv4 shortened address string.

    @@ -394,14 +393,14 @@ Parse an IPv4 address strict. -

    Parses an IPv4 address string containing four fields, i.e not shortened, and returns an ip4_address().

    +

    Parses an IPv4 address string containing four fields, i.e not shortened, and returns an ip4_address().

    Parse an IPv6 address -

    Parses an IPv6 address string and returns an ip6_address(). +

    Parses an IPv6 address string and returns an ip6_address(). If an IPv4 address string is passed, an IPv4-mapped IPv6 address is returned.

    @@ -409,22 +408,22 @@ Parse an IPv6 address strict. -

    Parses an IPv6 address string and returns an ip6_address(). - Does not accept IPv4 adresses.

    +

    Parses an IPv6 address string and returns an ip6_address(). + Does not accept IPv4 adresses.

    Parse an IPv4 or IPv6 address. -

    Parses an IPv4 or IPv6 address string and returns an ip4_address() or ip6_address(). Accepts a shortened IPv4 address string.

    +

    Parses an IPv4 or IPv6 address string and returns an ip4_address() or ip6_address(). Accepts a shortened IPv4 address string.

    Parse an IPv4 or IPv6 address strict. -

    Parses an IPv4 or IPv6 address string and returns an ip4_address() or ip6_address(). Does not accept a shortened IPv4 address string.

    +

    Parses an IPv4 or IPv6 address string and returns an ip4_address() or ip6_address(). Does not accept a shortened IPv4 address string.

    @@ -614,20 +613,15 @@ - {buffer, Size} + {buffer, Size} -

    The size of the user-level software buffer used by - the driver. Not to be confused with sndbuf - and recbuf options which correspond to - the kernel socket buffers. It is recommended - to have val(buffer) >= max(val(sndbuf),val(recbuf)) to - avoid performance issues due to unnecessary copying. - In fact, the val(buffer) is automatically set to - the above maximum when sndbuf or recbuf values are set. - However, since the actual sizes set for sndbuf and recbuf - usually becomes larger, you are encouraged to use - inet:getopts/2 - to analyze the behavior of your operating system.

    +

    Determines the size of the user-level software buffer used by + the driver. Not to be confused with sndbuf + and recbuf options which correspond to + the kernel socket buffers. It is recommended + to have val(buffer) >= max(val(sndbuf),val(recbuf)). + In fact, the val(buffer) is automatically set to + the above maximum when sndbuf or recbuf values are set.

    {delay_send, Boolean} @@ -862,10 +856,10 @@ CAP_SYS_ADMIN according to the documentation for setns(2). However, during testing also CAP_SYS_PTRACE and CAP_DAC_READ_SEARCH has proven to be necessary. - Example:

    + Example: setcap cap_sys_admin,cap_sys_ptrace,cap_dac_read_search+epi beam.smp -

    Note also that the filesystem containing the virtual machine + Note also that the filesystem containing the virtual machine executable (beam.smp in the example above) has to be local, mounted without the nosetuid flag, support extended attributes and that @@ -981,11 +975,6 @@ indicated length are accepted and not considered invalid due to internal buffer limitations.

    - {line_delimiter, Char}(TCP/IP sockets) - -

    Sets the line delimiting character for line oriented protocols - (line). Default value is $\n.

    -
    {priority, Priority}

    Set the protocol-defined priority for all packets to be sent @@ -1009,12 +998,8 @@ {recbuf, Size} -

    The minimum size of the receive buffer to use for - the socket. You are encouraged to use - inet:getopts/2, - to retrieve the actual size set by your operating system. - -

    +

    Gives the size of the receive buffer to use for + the socket.

    {reuseaddr, Boolean} @@ -1043,56 +1028,22 @@ - {show_econnreset, Boolean}(TCP/IP sockets) - -

    When this option is set to false, as it is by - default, an RST that is received from the TCP peer is treated - as a normal close (as though a FIN was sent). A caller - to gen_tcp:recv/2 - will get {error, closed}. In active - mode the controlling process will receive a - {tcp_close, Socket} message, indicating that the - peer has closed the connection.

    -

    Setting this option to true will allow you to - distinguish between a connection that was closed normally, - and one which was aborted (intentionally or unintentionally) - by the TCP peer. A call to - gen_tcp:recv/2 - will return {error, econnreset}. In - active mode, the controlling process will receive a - {tcp_error, Socket, econnreset} message - before the usual {tcp_closed, Socket}, as is - the case for any other socket error. Calls to - gen_tcp:send/2 - will also return {error, econnreset} when it - is detected that a TCP peer has sent an RST.

    -

    A connected socket returned from - gen_tcp:accept/1 - will inherit the show_econnreset setting from the - listening socket.

    - -
    - {sndbuf, Size} -

    The minimum size of the send buffer to use for the socket. - You are encouraged to use - inet:getopts/2, - to retrieve the actual size set by your operating system. -

    +

    Gives the size of the send buffer to use for the socket.

    {priority, Integer} -

    Sets the SO_PRIORITY socket level option on platforms where - this is implemented. The behaviour and allowed range varies on - different systems. The option is ignored on platforms where the +

    Sets the SO_PRIORITY socket level option on platforms where + this is implemented. The behaviour and allowed range varies on + different systems. The option is ignored on platforms where the option is not implemented. Use with caution.

    {tos, Integer} -

    Sets IP_TOS IP level options on platforms where this is - implemented. The behaviour and allowed range varies on different - systems. The option is ignored on platforms where the option is +

    Sets IP_TOS IP level options on platforms where this is + implemented. The behaviour and allowed range varies on different + systems. The option is ignored on platforms where the option is not implemented. Use with caution.

    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/init_stub.xml erlang-17.3-dfsg/lib/kernel/doc/src/init_stub.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/init_stub.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/init_stub.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/kernel_app.xml erlang-17.3-dfsg/lib/kernel/doc/src/kernel_app.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/kernel_app.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/kernel_app.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19962015 + 19962014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -43,7 +42,6 @@ erl_boot_server erl_ddll error_logger - error_logger_format_depth file global global_group @@ -153,42 +151,6 @@ - error_logger_format_depth = Depth - - -

    This parameter can be used to limit the size of the - formatted output from the error logger event handlers.

    - -

    This configuration parameter was introduced in OTP 18.1. - It is currently experimental. Based on user feedback it - may be changed or improved in future releases, for example - to gain better control over how to limit the size of the - formatted output. We have no plans to entirely remove this - new feature, unless it turns out to be completely - useless. In OTP 19, the default may be changed to limit the - formatted output.

    - -

    Depth is a positive integer that is the maximum - depth to which terms are printed by the error logger event - handlers included in OTP. Specifically, the two event handlers - defined by the Kernel application and the two event - handlers in the SASL application will use this - configuration parameter. (If you have implemented you own - error handlers, this configuration parameter will have no - effect on them.)

    - -

    The way Depth is used, is that format strings - string passed to the event handlers will be rewritten. - The "~p" and "~w" format controls will be replaced with - "~P" and "~W", respectively, and Depth will be - used as the depth parameter. See - io:format/2.

    - -

    A reasonable starting value for Depth is - 30. You should test crashing various processes in your - application and examine the logs from the crashes, and then - either increase or decrease the value.

    -
    global_groups = [GroupTuple]

    Defines global groups, see @@ -226,18 +188,6 @@

    Define the First..Last port range for the listener socket of a distributed Erlang node.

    - {inet_dist_listen_options, Opts} - -

    Define a list of extra socket options to be used when opening the - listening socket for a distributed Erlang node. - See gen_tcp:listen/2

    -
    - {inet_dist_connect_options, Opts} - -

    Define a list of extra socket options to be used when connecting to - other distributed Erlang nodes. - See gen_tcp:connect/4

    -
    inet_parse_error_log = silent

    If this configuration parameter is set, no diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/Makefile erlang-17.3-dfsg/lib/kernel/doc/src/Makefile --- erlang-18.2-dfsg/lib/kernel/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/net_adm.xml erlang-17.3-dfsg/lib/kernel/doc/src/net_adm.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/net_adm.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/net_adm.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -89,8 +88,8 @@ - Lookup and connect to all nodes at all hosts in .hosts.erlang + Lookup and connect to all nodes at all hosts in .hosts.erlang

    This function calls names(Host) for all hosts which are specified in the Erlang host file .hosts.erlang, @@ -110,8 +109,8 @@ - Lookup and connect to all nodes at specified hosts + Lookup and connect to all nodes at specified hosts

    As world/0,1, but the hosts are given as argument instead of being read from .hosts.erlang.

    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/net_kernel.xml erlang-17.3-dfsg/lib/kernel/doc/src/net_kernel.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/net_kernel.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/net_kernel.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/notes_history.xml erlang-17.3-dfsg/lib/kernel/doc/src/notes_history.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/notes.xml erlang-17.3-dfsg/lib/kernel/doc/src/notes.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,341 +30,6 @@

    This document describes the changes made to the Kernel application.

    -
    Kernel 4.1.1 - -
    Fixed Bugs and Malfunctions - - -

    - Host name lookups though inet_res, the Erlang DNS - resolver, are now done case insensitively according to - RFC 4343. Patch by Holger Weiß.

    -

    - Own Id: OTP-12836

    -
    - -

    - IPv6 distribution handler has been updated to share code - with IPv4 so that all features are supported in IPv6 as - well. A bug when using an IPv4 address as hostname has - been fixed.

    -

    - Own Id: OTP-13040

    -
    - -

    - Caching of host names in the internal DNS resolver - inet_res has been made character case insensitive for - host names according to RFC 4343.

    -

    - Own Id: OTP-13083

    -
    - -

    Cooked file mode buffering has been fixed so - file:position/2 now works according to Posix on Posix - systems i.e. when file:position/2 returns an error the - file pointer is unaffected.

    The Windows system - documentation, however, is unclear on this point so the - documentation of file:position/2 still does not promise - anything.

    Cooked file mode file:pread/2,3 and - file:pwrite/2,3 have been corrected to honor character - encoding like the combination of file:position/2 and - file:read/2 or file:write/2 already does. This is - probably not very useful since the character - representation on the caller's side is latin1, - period.

    -

    - Own Id: OTP-13155 Aux Id: PR#646

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Add {line_delim, byte()} option to inet:setopts/2 and - decode_packet/3

    -

    - Own Id: OTP-12837

    -
    -
    -
    - -
    - -
    Kernel 4.1 - -
    Improvements and New Features - - -

    A mechanism for limiting the amount of text that the - built-in error logger events will produce has been - introduced. It is useful for limiting both the size of - log files and the CPU time used to produce them.

    -

    This mechanism is experimental in the sense that it - may be changed if it turns out that it does not solve the - problem it is supposed to solve. In that case, there may - be backward incompatible improvements to this - mechanism.

    -

    See the documentation for the config parameter - error_logger_format_depth in the Kernel - application for information about how to turn on this - feature.

    -

    - Own Id: OTP-12864

    -
    -
    -
    - -
    - -
    Kernel 4.0 - -
    Fixed Bugs and Malfunctions - - -

    - Fix error handling in file:read_line/1 for Unicode - contents.

    -

    - Own Id: OTP-12144

    -
    - -

    - Introduce os:getenv/2 which is similar to - os:getenv/1 but returns the passed default value - if the required environment variable is undefined.

    -

    - Own Id: OTP-12342

    -
    - -

    - It is now possible to paste text in JCL mode (using - Ctrl-Y) that has been copied in the previous shell - session. Also a bug that caused the JCL mode to crash - when pasting text has been fixed.

    -

    - Own Id: OTP-12673

    -
    - -

    - Ensure that each segment of an IPv6 address when parsed - from a string has a maximum of 4 hex digits

    -

    - Own Id: OTP-12773

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - New BIF: erlang:get_keys/0, lists all keys - associated with the process dictionary. Note: - erlang:get_keys/0 is auto-imported.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-12151 Aux Id: seq12521

    -
    - -

    - The internal group to user_drv protocol has been changed - to be synchronous in order to guarantee that output sent - to a process implementing the user_drv protocol is - printed before replying. This protocol is used by the - standard_output device and the ssh application when - acting as a client.

    -

    - This change changes the previous unlimited buffer when - printing to standard_io and other devices that end up in - user_drv to 1KB.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-12240

    -
    - -

    The inflateInit/2 and deflateInit/6 - functions now accepts a WindowBits argument equal to 8 - and -8.

    -

    - Own Id: OTP-12564

    -
    - -

    - Map error logger warnings to warning messages by default.

    -

    - Own Id: OTP-12755

    -
    - -

    - Map beam error logger warnings to warning messages by - default. Previously these messages were mapped to the - error channel by default.

    -

    - Own Id: OTP-12781

    -
    - -

    - gen_tcp:shutdown/2 is now asynchronous

    -

    - This solves the following problems with the old - implementation:

    -

    - It doesn't block when the TCP peer is idle or slow. This - is the expected behaviour when shutdown() is called: the - caller needs to be able to continue reading from the - socket, not be prevented from doing so.

    -

    - It doesn't truncate the output. The current version of - gen_tcp:shutdown/2 will truncate any outbound data in the - driver queue after about 10 seconds if the TCP peer is - idle of slow. Worse yet, it doesn't even inform anyone - that the data has been truncated: 'ok' is returned to the - caller; and a FIN rather than an RST is sent to the TCP - peer.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-12797

    -
    - -

    - There are many cases where user code needs to be able to - distinguish between a socket that was closed normally and - one that was aborted. Setting the option - {show_econnreset, true} enables the user to receive - ECONNRESET errors on both active and passive sockets.

    -

    - Own Id: OTP-12843

    -
    -
    -
    - -
    - -
    Kernel 3.2.0.1 -
    Fixed Bugs and Malfunctions - - -

    The 'raw' socket option could not be used multiple times - in one call to any e.g gen_tcp function because only one - of the occurrences were used. This bug has been fixed, - and also a small bug concerning propagating error codes - from within inet:setopts/2.

    -

    Own Id: OTP-11482 Aux Id: seq12872

    -
    -
    -
    -
    - - -
    Kernel 3.2 - -
    Fixed Bugs and Malfunctions - - -

    - A bug causing an infinite loop in hostname resolving has - been corrected. To trigger this bug you would have to - enter an bogus search method from a configuration file - e.g .inetrc.

    -

    - Bug pinpointed by Emil Holmström

    -

    - Own Id: OTP-12133

    -
    - -

    - The standard_error process now handles the getopts I/O - protocol request correctly and stores its encoding in the - same way as standard_io.

    -

    - Also, io:put_chars(standard_error, [oops]) could - previously crash the standard_error process. This is now - corrected.

    -

    - Own Id: OTP-12424

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Configuration parameters for the Kernel application that - allows setting socket options for the distribution - sockets have been added. See the application Kernel - documentation; parameters 'inet_dist_listen_options' and - 'inet_dist_connect_options'.

    -

    - Own Id: OTP-12476 Aux Id: OTP-12476

    -
    -
    -
    - -
    - -
    Kernel 3.1 - -
    Fixed Bugs and Malfunctions - - -

    - Make sure to install .hrl files when needed

    -

    - Own Id: OTP-12197

    -
    - -

    - Removed the undocumented application environment variable - 'raw_files' from the kernel application. This variable - was checked (by call to application:get_env/2) each time - a raw file was to be opened in the file module.

    -

    - Own Id: OTP-12276

    -
    - -

    - A bug has been fixed when using the netns option to - gen_udp, which accidentally only worked if it was the - last option.

    -

    - Own Id: OTP-12314

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Updated documentation for inet buffer size options.

    -

    - Own Id: OTP-12296

    -
    - -

    - Introduce new option 'raw' in file_info and link_info - functions. This option allows the caller not to go - through the file server for information about files - guaranteed to be local.

    -

    - Own Id: OTP-12325

    -
    -
    -
    - -
    -
    Kernel 3.0.3
    Fixed Bugs and Malfunctions @@ -1298,7 +962,7 @@

    Fix returned error from gen_tcp:accept/1,2 when - running out of ports.

    + running out of ports

    The {error, enfile} return value is badly misleading and confusing for this case, since the Posix ENFILE errno @@ -1307,7 +971,7 @@ {error, system_limit}, which is consistent with e.g. various file(3) functions. inet:format_error/1 has also been updated to support system_limit in the same manner - as file:format_error/1. (Thanks to Per Hedeland)

    + as file:format_error/1. (Thanks to Per Hedeland)

    Own Id: OTP-9990

    @@ -1502,6 +1166,7 @@ Own Id: OTP-9764

    +

    Correct callback spec in application module

    Refine warning about callback specs with extra ranges

    Cleanup @@ -1512,7 +1177,7 @@ analysis

    Fix crash in Dialyzer

    Variable substitution was not generalizing any unknown variables.

    - +

    Own Id: OTP-9776

    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/os.xml erlang-17.3-dfsg/lib/kernel/doc/src/os.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/os.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/os.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -101,19 +100,6 @@ - - Get the value of an environment variable - -

    Returns the Value of the environment variable - VarName, or DefaultValue if the environment variable - is undefined.

    -

    If Unicode file name encoding is in effect (see the erl manual - page), the strings (both VarName and - Value) may contain characters with codepoints > 255.

    -
    -
    - Return the process identifier of the emulator process @@ -143,49 +129,14 @@ - - Current OS system time - -

    Returns current - OS system time - in native - time unit.

    - -

    This time is not a monotonically increasing time.

    -
    -
    - - - Current OS system time - -

    Returns current - OS system time - converted into the Unit passed as argument.

    - -

    Calling os:system_time(Unit) is equivalent to: - erlang:convert_time_unit(os:system_time(), - native, Unit).

    - -

    This time is not a monotonically increasing time.

    -
    -
    - - Current OS system time on the erlang:timestamp/0 format Timestamp = {MegaSecs, Secs, MicroSecs} + Returna a timestamp from the OS in the erlang:now/0 format -

    Returns current - OS system time - in the same format as erlang:timestamp/0. - The tuple can be used together with the function - calendar:now_to_universal_time/1 - or calendar:now_to_local_time/1 to - get calendar time. Using the calendar time together with the MicroSecs part of the return - tuple from this function allows you to log timestamps in high resolution and consistent with the - time in the rest of the operating system.

    -

    Example of code formatting a string in the format "DD Mon YYYY HH:MM:SS.mmmmmm", where - DD is the day of month, Mon is the textual month name, YYYY is the year, HH:MM:SS is the time and - mmmmmm is the microseconds in six positions:

    +

    Returns a tuple in the same format as erlang:now/0. The difference is that this function returns what the operating system thinks (a.k.a. the wall clock time) without any attempts at time correction. The result of two different calls to this function is not guaranteed to be different.

    +

    The most obvious use for this function is logging. The tuple can be used together with the function calendar:now_to_universal_time/1 +or calendar:now_to_local_time/1 to get calendar time. Using the calendar time together with the MicroSecs part of the return tuple from this function allows you to log timestamps in high resolution and consistent with the time in the rest of the operating system.

    +

    Example of code formatting a string in the format "DD Mon YYYY HH:MM:SS.mmmmmm", where DD is the day of month, Mon is the textual month name, YYYY is the year, HH:MM:SS is the time and mmmmmm is the microseconds in six positions:

    -module(print_time). -export([format_utc_timestamp/0]). @@ -204,9 +155,6 @@ 1> io:format("~s~n",[print_time:format_utc_timestamp()]). 29 Apr 2009 9:55:30.051711
    -

    OS system time can also be retreived by - os:system_time/0, - and os:system_time/1.

    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/part_notes_history.xml erlang-17.3-dfsg/lib/kernel/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/part_notes.xml erlang-17.3-dfsg/lib/kernel/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/pg2.xml erlang-17.3-dfsg/lib/kernel/doc/src/pg2.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/pg2.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/pg2.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -35,8 +34,11 @@ pg2 Distributed Named Process Groups -

    This module implements process groups. Each message may be sent - to one, some, or all members of the group. +

    This module implements process groups. The groups in this + module differ from the groups in the module pg in several + ways. In pg, each message is sent to all members in the + group. In this module, each message may be sent to one, some, or + all members.

    A group of processes can be accessed by a common name. For example, if there is a group named foobar, there can be a @@ -158,7 +160,8 @@

    See Also -

    kernel(6)

    +

    kernel(6), + pg(3)

    diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/ref_man.xml erlang-17.3-dfsg/lib/kernel/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/ref_man.xml.src erlang-17.3-dfsg/lib/kernel/doc/src/ref_man.xml.src --- erlang-18.2-dfsg/lib/kernel/doc/src/ref_man.xml.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/ref_man.xml.src 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/rpc.xml erlang-17.3-dfsg/lib/kernel/doc/src/rpc.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/rpc.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/rpc.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/seq_trace.xml erlang-17.3-dfsg/lib/kernel/doc/src/seq_trace.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/seq_trace.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/seq_trace.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/user.xml erlang-17.3-dfsg/lib/kernel/doc/src/user.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/user.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/user.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/wrap_log_reader.xml erlang-17.3-dfsg/lib/kernel/doc/src/wrap_log_reader.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/wrap_log_reader.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/wrap_log_reader.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/kernel/doc/src/zlib_stub.xml erlang-17.3-dfsg/lib/kernel/doc/src/zlib_stub.xml --- erlang-18.2-dfsg/lib/kernel/doc/src/zlib_stub.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/doc/src/zlib_stub.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/kernel/examples/Makefile erlang-17.3-dfsg/lib/kernel/examples/Makefile --- erlang-18.2-dfsg/lib/kernel/examples/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/examples/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/kernel/examples/uds_dist/c_src/uds_drv.c erlang-17.3-dfsg/lib/kernel/examples/uds_dist/c_src/uds_drv.c --- erlang-18.2-dfsg/lib/kernel/examples/uds_dist/c_src/uds_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/examples/uds_dist/c_src/uds_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/kernel/examples/uds_dist/src/uds_dist.erl erlang-17.3-dfsg/lib/kernel/examples/uds_dist/src/uds_dist.erl --- erlang-18.2-dfsg/lib/kernel/examples/uds_dist/src/uds_dist.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/examples/uds_dist/src/uds_dist.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/kernel/include/dist.hrl erlang-17.3-dfsg/lib/kernel/include/dist.hrl --- erlang-18.2-dfsg/lib/kernel/include/dist.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/include/dist.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/include/dist_util.hrl erlang-17.3-dfsg/lib/kernel/include/dist_util.hrl --- erlang-18.2-dfsg/lib/kernel/include/dist_util.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/include/dist_util.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/include/file.hrl erlang-17.3-dfsg/lib/kernel/include/file.hrl --- erlang-18.2-dfsg/lib/kernel/include/file.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/include/file.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/include/inet.hrl erlang-17.3-dfsg/lib/kernel/include/inet.hrl --- erlang-18.2-dfsg/lib/kernel/include/inet.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/include/inet.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/include/inet_sctp.hrl erlang-17.3-dfsg/lib/kernel/include/inet_sctp.hrl --- erlang-18.2-dfsg/lib/kernel/include/inet_sctp.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/include/inet_sctp.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/include/net_address.hrl erlang-17.3-dfsg/lib/kernel/include/net_address.hrl --- erlang-18.2-dfsg/lib/kernel/include/net_address.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/include/net_address.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/Makefile erlang-17.3-dfsg/lib/kernel/Makefile --- erlang-18.2-dfsg/lib/kernel/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/kernel/src/application_controller.erl erlang-17.3-dfsg/lib/kernel/src/application_controller.erl --- erlang-18.2-dfsg/lib/kernel/src/application_controller.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/application_controller.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -491,8 +490,7 @@ %% called during start-up of any app. case check_conf_data(ConfData) of ok -> - _ = ets:new(ac_tab, [set, public, named_table, - {read_concurrency,true}]), + _ = ets:new(ac_tab, [set, public, named_table]), S = #state{conf_data = ConfData}, {ok, KAppl} = make_appl(Kernel), case catch load(S, KAppl) of @@ -1617,6 +1615,7 @@ [{make_term(Key), make_term(Val)} | conv(T)]; conv(_) -> []. +%%% Fix some day: eliminate the duplicated code here make_term(Str) -> case erl_scan:string(Str) of {ok, Tokens, _} -> @@ -1624,17 +1623,16 @@ {ok, Term} -> Term; {error, {_,M,Reason}} -> - handle_make_term_error(M, Reason, Str) + error_logger:format("application_controller: ~ts: ~ts~n", + [M:format_error(Reason), Str]), + throw({error, {bad_environment_value, Str}}) end; {error, {_,M,Reason}, _} -> - handle_make_term_error(M, Reason, Str) + error_logger:format("application_controller: ~ts: ~ts~n", + [M:format_error(Reason), Str]), + throw({error, {bad_environment_value, Str}}) end. -handle_make_term_error(Mod, Reason, Str) -> - error_logger:format("application_controller: ~ts: ~ts~n", - [Mod:format_error(Reason), Str]), - throw({error, {bad_environment_value, Str}}). - get_env_i(Name, #state{conf_data = ConfData}) when is_list(ConfData) -> case lists:keyfind(Name, 1, ConfData) of {_Name, Env} -> Env; diff -Nru erlang-18.2-dfsg/lib/kernel/src/application.erl erlang-17.3-dfsg/lib/kernel/src/application.erl --- erlang-18.2-dfsg/lib/kernel/src/application.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/application.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/application_master.erl erlang-17.3-dfsg/lib/kernel/src/application_master.erl --- erlang-18.2-dfsg/lib/kernel/src/application_master.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/application_master.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -104,9 +103,9 @@ %%% The reason for not using the logical structrure is that %%% the application start function is synchronous, and %%% that the AM is GL. This means that if AM executed the start -%%% function, and this function uses io, deadlock would occur. -%%% Therefore, this function is executed by the process X. -%%% Also, AM needs three loops; +%%% function, and this function uses spawn_request/1 +%%% or io, deadlock would occur. Therefore, this function is +%%% executed by the process X. Also, AM needs three loops; %%% init_loop (waiting for the start function to return) %%% main_loop %%% terminate_loop (waiting for the process to die) diff -Nru erlang-18.2-dfsg/lib/kernel/src/application_master.hrl erlang-17.3-dfsg/lib/kernel/src/application_master.hrl --- erlang-18.2-dfsg/lib/kernel/src/application_master.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/application_master.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/application_starter.erl erlang-17.3-dfsg/lib/kernel/src/application_starter.erl --- erlang-18.2-dfsg/lib/kernel/src/application_starter.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/application_starter.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/auth.erl erlang-17.3-dfsg/lib/kernel/src/auth.erl --- erlang-18.2-dfsg/lib/kernel/src/auth.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/auth.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -371,8 +370,8 @@ %% Creates a new, random cookie. create_cookie(Name) -> - Seed = abs(erlang:monotonic_time() - bxor erlang:unique_integer()), + {_, S1, S2} = now(), + Seed = S2*10000+S1, Cookie = random_cookie(20, Seed, []), case file:open(Name, [write, raw]) of {ok, File} -> diff -Nru erlang-18.2-dfsg/lib/kernel/src/code.erl erlang-17.3-dfsg/lib/kernel/src/code.erl --- erlang-18.2-dfsg/lib/kernel/src/code.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/code.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -108,7 +107,7 @@ -spec make_stub_module(Module, Beam, Info) -> Module when Module :: module(), Beam :: binary(), - Info :: {list(), list(), binary()}. + Info :: {list(), list()}. make_stub_module(_, _, _) -> erlang:nif_error(undef). @@ -340,8 +339,7 @@ ok end, %% Quietly load native code for all modules loaded so far - Architecture = erlang:system_info(hipe_architecture), - load_native_code_for_all_loaded(Architecture), + catch load_native_code_for_all_loaded(), Ok2; Other -> Other @@ -552,43 +550,18 @@ _ -> false end. -%%% -%%% Silently load native code for all modules loaded so far. -%%% - -load_native_code_for_all_loaded(undefined) -> - ok; -load_native_code_for_all_loaded(Architecture) -> - try hipe_unified_loader:chunk_name(Architecture) of - ChunkTag -> - Loaded = all_loaded(), - _ = spawn(fun() -> load_all_native(Loaded, ChunkTag) end), - ok - catch - _:_ -> - ok - end. - -load_all_native(Loaded, ChunkTag) -> - catch load_all_native_1(Loaded, ChunkTag). - -load_all_native_1([{_,preloaded}|T], ChunkTag) -> - load_all_native_1(T, ChunkTag); -load_all_native_1([{Mod,BeamFilename}|T], ChunkTag) -> - case code:is_module_native(Mod) of - false -> - %% prim_file is faster than file and the file server may - %% not be started yet. - {ok,Beam} = prim_file:read_file(BeamFilename), - case code:get_chunk(Beam, ChunkTag) of - undefined -> - ok; - NativeCode when is_binary(NativeCode) -> - _ = load_native_partial(Mod, NativeCode), - ok - end; - true -> ok - end, - load_all_native_1(T, ChunkTag); -load_all_native_1([], _) -> - ok. +-spec load_native_code_for_all_loaded() -> ok. +load_native_code_for_all_loaded() -> + Architecture = erlang:system_info(hipe_architecture), + ChunkName = hipe_unified_loader:chunk_name(Architecture), + lists:foreach(fun({Module, BeamFilename}) -> + case code:is_module_native(Module) of + false -> + case beam_lib:chunks(BeamFilename, [ChunkName]) of + {ok,{_,[{_,Bin}]}} when is_binary(Bin) -> + load_native_partial(Module, Bin); + {error, beam_lib, _} -> ok + end; + true -> ok + end + end, all_loaded()). diff -Nru erlang-18.2-dfsg/lib/kernel/src/code_server.erl erlang-17.3-dfsg/lib/kernel/src/code_server.erl --- erlang-18.2-dfsg/lib/kernel/src/code_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/code_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -325,15 +324,12 @@ do_load_binary(Mod, File, Bin, Caller, S); handle_call({load_native_partial,Mod,Bin}, {_From,_Tag}, S) -> - Architecture = erlang:system_info(hipe_architecture), - Result = (catch hipe_unified_loader:load(Mod, Bin, Architecture)), + Result = (catch hipe_unified_loader:load(Mod, Bin)), Status = hipe_result_to_status(Result), {reply,Status,S}; handle_call({load_native_sticky,Mod,Bin,WholeModule}, {_From,_Tag}, S) -> - Architecture = erlang:system_info(hipe_architecture), - Result = (catch hipe_unified_loader:load_module(Mod, Bin, WholeModule, - Architecture)), + Result = (catch hipe_unified_loader:load_module(Mod, Bin, WholeModule)), Status = hipe_result_to_status(Result), {reply,Status,S}; @@ -1260,43 +1256,33 @@ try_load_module_1(File, Mod, Bin, Caller, #state{moddb=Db}=St) -> case is_sticky(Mod, Db) of true -> %% Sticky file reject the load - error_msg("Can't load module '~w' that resides in sticky dir\n",[Mod]), + error_msg("Can't load module that resides in sticky dir\n",[]), {reply,{error,sticky_directory},St}; false -> - Architecture = erlang:system_info(hipe_architecture), - try_load_module_2(File, Mod, Bin, Caller, Architecture, St) - end. - -try_load_module_2(File, Mod, Bin, Caller, undefined, St) -> - try_load_module_3(File, Mod, Bin, Caller, undefined, St); -try_load_module_2(File, Mod, Bin, Caller, Architecture, - #state{moddb=Db}=St) -> - case catch load_native_code(Mod, Bin, Architecture) of - {module,Mod} = Module -> - ets:insert(Db, {Mod,File}), - {reply,Module,St}; - no_native -> - try_load_module_3(File, Mod, Bin, Caller, Architecture, St); - Error -> - error_msg("Native loading of ~ts failed: ~p\n", [File,Error]), - {reply,ok,St} - end. - -try_load_module_3(File, Mod, Bin, Caller, Architecture, - #state{moddb=Db}=St) -> - case erlang:load_module(Mod, Bin) of - {module,Mod} = Module -> - ets:insert(Db, {Mod,File}), - post_beam_load(Mod, Architecture), - {reply,Module,St}; - {error,on_load} -> - handle_on_load(Mod, File, Caller, St); - {error,What} = Error -> - error_msg("Loading of ~ts failed: ~p\n", [File, What]), - {reply,Error,St} + case catch load_native_code(Mod, Bin) of + {module,Mod} = Module -> + ets:insert(Db, {Mod,File}), + {reply,Module,St}; + no_native -> + case erlang:load_module(Mod, Bin) of + {module,Mod} = Module -> + ets:insert(Db, {Mod,File}), + post_beam_load(Mod), + {reply,Module,St}; + {error,on_load} -> + handle_on_load(Mod, File, Caller, St); + {error,What} = Error -> + error_msg("Loading of ~ts failed: ~p\n", [File, What]), + {reply,Error,St} + end; + Error -> + error_msg("Native loading of ~ts failed: ~p\n", + [File,Error]), + {reply,ok,St} + end end. -load_native_code(Mod, Bin, Architecture) -> +load_native_code(Mod, Bin) -> %% During bootstrapping of Open Source Erlang, we don't have any hipe %% loader modules, but the Erlang emulator might be hipe enabled. %% Therefore we must test for that the loader modules are available @@ -1305,8 +1291,7 @@ false -> no_native; true -> - Result = hipe_unified_loader:load_native_code(Mod, Bin, - Architecture), + Result = hipe_unified_loader:load_native_code(Mod, Bin), case Result of {module,_} -> put(?ANY_NATIVE_CODE_LOADED, true); @@ -1325,12 +1310,12 @@ {error,Result} end. -post_beam_load(Mod, Architecture) -> - %% post_beam_load/2 can potentially be very expensive because it +post_beam_load(Mod) -> + %% post_beam_load/1 can potentially be very expensive because it %% blocks multi-scheduling; thus we want to avoid the call if we %% know that it is not needed. case get(?ANY_NATIVE_CODE_LOADED) of - true -> hipe_unified_loader:post_beam_load(Mod, Architecture); + true -> hipe_unified_loader:post_beam_load(Mod); false -> ok end. diff -Nru erlang-18.2-dfsg/lib/kernel/src/disk_log_1.erl erlang-17.3-dfsg/lib/kernel/src/disk_log_1.erl --- erlang-18.2-dfsg/lib/kernel/src/disk_log_1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/disk_log_1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/disk_log.erl erlang-17.3-dfsg/lib/kernel/src/disk_log.erl --- erlang-18.2-dfsg/lib/kernel/src/disk_log.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/disk_log.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/disk_log.hrl erlang-17.3-dfsg/lib/kernel/src/disk_log.hrl --- erlang-18.2-dfsg/lib/kernel/src/disk_log.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/disk_log.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/disk_log_server.erl erlang-17.3-dfsg/lib/kernel/src/disk_log_server.erl --- erlang-18.2-dfsg/lib/kernel/src/disk_log_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/disk_log_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/disk_log_sup.erl erlang-17.3-dfsg/lib/kernel/src/disk_log_sup.erl --- erlang-18.2-dfsg/lib/kernel/src/disk_log_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/disk_log_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/dist_ac.erl erlang-17.3-dfsg/lib/kernel/src/dist_ac.erl --- erlang-18.2-dfsg/lib/kernel/src/dist_ac.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/dist_ac.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/dist_util.erl erlang-17.3-dfsg/lib/kernel/src/dist_util.erl --- erlang-18.2-dfsg/lib/kernel/src/dist_util.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/dist_util.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -299,7 +298,7 @@ exit(Reason). %% Use this line to debug connection. %% Set net_kernel verbose = 1 as well. -%% exit({Reason, ?MODULE, _Line, _Data, erlang:timestamp()}). +%% exit({Reason, ?MODULE, _Line, _Data, erlang:now()}). flush_down() -> @@ -374,9 +373,7 @@ %% gen_challenge() returns a "random" number %% --------------------------------------------------------------- gen_challenge() -> - A = erlang:phash2([erlang:node()]), - B = erlang:monotonic_time(), - C = erlang:unique_integer(), + {A,B,C} = erlang:now(), {D,_} = erlang:statistics(reductions), {E,_} = erlang:statistics(runtime), {F,_} = erlang:statistics(wall_clock), diff -Nru erlang-18.2-dfsg/lib/kernel/src/erl_boot_server.erl erlang-17.3-dfsg/lib/kernel/src/erl_boot_server.erl --- erlang-18.2-dfsg/lib/kernel/src/erl_boot_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/erl_boot_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/erl_ddll.erl erlang-17.3-dfsg/lib/kernel/src/erl_ddll.erl --- erlang-18.2-dfsg/lib/kernel/src/erl_ddll.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/erl_ddll.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/erl_distribution.erl erlang-17.3-dfsg/lib/kernel/src/erl_distribution.erl --- erlang-18.2-dfsg/lib/kernel/src/erl_distribution.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/erl_distribution.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,6 +22,7 @@ -export([start_link/0,start_link/1,init/1,start/1,stop/0]). +%-define(DBG,io:format("~p:~p~n",[?MODULE,?LINE])). -define(DBG,erlang:display([?MODULE,?LINE])). start_link() -> diff -Nru erlang-18.2-dfsg/lib/kernel/src/erl_epmd.erl erlang-17.3-dfsg/lib/kernel/src/erl_epmd.erl --- erlang-18.2-dfsg/lib/kernel/src/erl_epmd.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/erl_epmd.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/erl_epmd.hrl erlang-17.3-dfsg/lib/kernel/src/erl_epmd.hrl --- erlang-18.2-dfsg/lib/kernel/src/erl_epmd.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/erl_epmd.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/erl_reply.erl erlang-17.3-dfsg/lib/kernel/src/erl_reply.erl --- erlang-18.2-dfsg/lib/kernel/src/erl_reply.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/erl_reply.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/error_handler.erl erlang-17.3-dfsg/lib/kernel/src/error_handler.erl --- erlang-18.2-dfsg/lib/kernel/src/error_handler.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/error_handler.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/error_logger.erl erlang-17.3-dfsg/lib/kernel/src/error_logger.erl --- erlang-18.2-dfsg/lib/kernel/src/error_logger.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/error_logger.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/erts_debug.erl erlang-17.3-dfsg/lib/kernel/src/erts_debug.erl --- erlang-18.2-dfsg/lib/kernel/src/erts_debug.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/erts_debug.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -21,7 +20,7 @@ %% Low-level debugging support. EXPERIMENTAL! --export([size/1,df/1,df/2,df/3,ic/1]). +-export([size/1,df/1,df/2,df/3]). %% This module contains the following *experimental* BIFs: %% disassemble/1 @@ -34,7 +33,7 @@ -export([breakpoint/2, disassemble/1, display/1, dist_ext_to_term/2, dump_monitors/1, dump_links/1, flat_size/1, get_internal_state/1, instructions/0, lock_counters/1, - map_info/1, same/2, set_internal_state/2]). + same/2, set_internal_state/2]). -spec breakpoint(MFA, Flag) -> non_neg_integer() when MFA :: {Module :: module(), @@ -115,19 +114,6 @@ instructions() -> erlang:nif_error(undef). --spec ic(F) -> Result when - F :: function(), - Result :: term(). - -ic(F) when is_function(F) -> - Is0 = erlang:system_info(instruction_counts), - R = F(), - Is1 = erlang:system_info(instruction_counts), - Is = lists:keysort(2,[{I,C1 - C0}||{{I,C1},{I,C0}} <- lists:zip(Is1,Is0)]), - _ = [io:format("~12w ~w~n", [C,I])||{I,C}<-Is], - io:format("Total: ~w~n",[lists:sum([C||{_I,C}<-Is])]), - R. - -spec lock_counters(info) -> term(); (clear) -> ok; ({copy_save, boolean()}) -> boolean(); @@ -178,10 +164,8 @@ -spec size(term()) -> non_neg_integer(). --record(s, {seen, maps}). - size(Term) -> - {Sum,_} = size(Term, #s{seen=gb_trees:empty(),maps=[]}, 0), + {Sum,_} = size(Term, gb_trees:empty(), 0), Sum. size([H|T]=Term, Seen0, Sum0) -> @@ -225,24 +209,10 @@ tuple_size(I+1, Sz, Tuple, Seen, Sum). map_size(Map,Seen0,Sum0) -> - %% Danger: - %% The internal nodes from erts_internal:map_hashmap_children/1 - %% is not allowed to leak anywhere. They are only allowed in - %% containers (cons cells and tuples, not maps), in gc and - %% in erts_debug:same/2 - case erts_internal:map_type(Map) of - flatmap -> - Kt = erts_internal:map_to_tuple_keys(Map), - Vs = maps:values(Map), - {Sum1,Seen1} = size(Kt,Seen0,Sum0), - fold_size(Vs,Seen1,Sum1+length(Vs)+3); - hashmap -> - Cs = erts_internal:map_hashmap_children(Map), - fold_size(Cs,Seen0,Sum0+length(Cs)+2); - hashmap_node -> - Cs = erts_internal:map_hashmap_children(Map), - fold_size(Cs,Seen0,Sum0+length(Cs)+1) - end. + Kt = erts_internal:map_to_tuple_keys(Map), + Vs = maps:values(Map), + {Sum1,Seen1} = size(Kt,Seen0,Sum0), + fold_size(Vs,Seen1,Sum1+length(Vs)+3). fun_size(Fun, Seen, Sum) -> case erlang:fun_info(Fun, type) of @@ -259,18 +229,13 @@ fold_size(T, Seen, Sum); fold_size([], Seen, Sum) -> {Sum,Seen}. -remember_term(Term, #s{maps=Ms}=S) when is_map(Term) -> - case is_term_seen(Term, Ms) of - false -> S#s{maps=[Term|Ms]}; - true -> seen - end; -remember_term(Term, #s{seen=T}=S) -> - case gb_trees:lookup(Term,T) of - none -> S#s{seen=gb_trees:insert(Term,[Term],T)}; +remember_term(Term, Seen) -> + case gb_trees:lookup(Term, Seen) of + none -> gb_trees:insert(Term, [Term], Seen); {value,Terms} -> case is_term_seen(Term, Terms) of - false -> S#s{seen=gb_trees:update(Term,[Term|Terms],T)}; - true -> seen + false -> gb_trees:update(Term, [Term|Terms], Seen); + true -> seen end end. @@ -348,9 +313,3 @@ io:put_chars(File, binary_to_list(Str)), cont_dis(File, erts_debug:disassemble(Addr), MFA); cont_dis(_, {_,_,_}, _) -> ok. - --spec map_info(Map) -> list() when - Map :: map(). - -map_info(_) -> - erlang:nif_error(undef). diff -Nru erlang-18.2-dfsg/lib/kernel/src/file.erl erlang-17.3-dfsg/lib/kernel/src/file.erl --- erlang-18.2-dfsg/lib/kernel/src/file.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/file.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -115,7 +114,7 @@ -type sendfile_option() :: {chunk_size, non_neg_integer()} | {use_threads, boolean()}. -type file_info_option() :: {'time', 'local'} | {'time', 'universal'} - | {'time', 'posix'} | raw. + | {'time', 'posix'}. %%% BIFs -export([native_name_encoding/0]). @@ -243,19 +242,7 @@ Reason :: posix() | badarg. read_file_info(Name, Opts) when is_list(Opts) -> - Args = [file_name(Name), Opts], - case check_args(Args) of - ok -> - case lists:member(raw, Opts) of - true -> - [FileName|_] = Args, - ?PRIM_FILE:read_file_info(FileName, Opts); - false -> - call(read_file_info, Args) - end; - Error -> - Error - end. + check_and_call(read_file_info, [file_name(Name), Opts]). -spec altname(Name :: name_all()) -> any(). @@ -277,19 +264,7 @@ Reason :: posix() | badarg. read_link_info(Name, Opts) when is_list(Opts) -> - Args = [file_name(Name), Opts], - case check_args(Args) of - ok -> - case lists:member(raw, Opts) of - true -> - [FileName|_] = Args, - ?PRIM_FILE:read_link_info(FileName, Opts); - false -> - call(read_link_info, Args) - end; - Error -> - Error - end. + check_and_call(read_link_info, [file_name(Name),Opts]). -spec read_link(Name) -> {ok, Filename} | {error, Reason} when @@ -323,19 +298,7 @@ Reason :: posix() | badarg. write_file_info(Name, Info = #file_info{}, Opts) when is_list(Opts) -> - Args = [file_name(Name), Info, Opts], - case check_args(Args) of - ok -> - case lists:member(raw, Opts) of - true -> - [FileName|_] = Args, - ?PRIM_FILE:write_file_info(FileName, Info, Opts); - false -> - call(write_file_info, Args) - end; - Error -> - Error - end. + check_and_call(write_file_info, [file_name(Name), Info, Opts]). -spec list_dir(Dir) -> {ok, Filenames} | {error, Reason} when Dir :: name_all(), @@ -421,12 +384,26 @@ %% Obsolete, undocumented, local node only, don't use!. %% XXX to be removed. raw_read_file_info(Name) -> - read_file_info(Name, [raw]). + Args = [file_name(Name)], + case check_args(Args) of + ok -> + [FileName] = Args, + ?PRIM_FILE:read_file_info(FileName); + Error -> + Error + end. %% Obsolete, undocumented, local node only, don't use!. %% XXX to be removed. raw_write_file_info(Name, #file_info{} = Info) -> - write_file_info(Name, Info, [raw]). + Args = [file_name(Name)], + case check_args(Args) of + ok -> + [FileName] = Args, + ?PRIM_FILE:write_file_info(FileName, Info); + Error -> + Error + end. %%%----------------------------------------------------------------- %%% File io server functions. @@ -446,15 +423,21 @@ case lists:member(raw, ModeList) of %% Raw file, use ?PRIM_FILE to handle this file true -> - Args = [file_name(Item) | ModeList], - case check_args(Args) of - ok -> - [FileName | _] = Args, - %% We rely on the returned Handle (in {ok, Handle}) - %% being a pid() or a #file_descriptor{} - ?PRIM_FILE:open(FileName, ModeList); - Error -> - Error + %% check if raw file mode is disabled + case catch application:get_env(kernel, raw_files) of + {ok,false} -> + open(Item, lists:delete(raw, ModeList)); + _ -> % undefined | {ok,true} + Args = [file_name(Item) | ModeList], + case check_args(Args) of + ok -> + [FileName | _] = Args, + %% We rely on the returned Handle (in {ok, Handle}) + %% being a pid() or a #file_descriptor{} + ?PRIM_FILE:open(FileName, ModeList); + Error -> + Error + end end; false -> case lists:member(ram, ModeList) of diff -Nru erlang-18.2-dfsg/lib/kernel/src/file_io_server.erl erlang-17.3-dfsg/lib/kernel/src/file_io_server.erl --- erlang-18.2-dfsg/lib/kernel/src/file_io_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/file_io_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2015. All Rights Reserved. +%% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -206,8 +205,8 @@ file_request({advise,Offset,Length,Advise}, #state{handle=Handle}=State) -> case ?PRIM_FILE:advise(Handle, Offset, Length, Advise) of - {error,Reason}=Reply -> - {stop,Reason,Reply,State}; + {error,_}=Reply -> + {stop,normal,Reply,State}; Reply -> {reply,Reply,State} end; @@ -215,91 +214,62 @@ #state{handle = Handle} = State) -> Reply = ?PRIM_FILE:allocate(Handle, Offset, Length), {reply, Reply, State}; -file_request({pread,At,Sz}, State) - when At =:= cur; - At =:= {cur,0} -> - case get_chars(Sz, latin1, State) of - {reply,Reply,NewState} - when is_list(Reply); - is_binary(Reply) -> - {reply,{ok,Reply},NewState}; - Other -> - Other - end; file_request({pread,At,Sz}, - #state{handle=Handle,buf=Buf}=State) -> + #state{handle=Handle,buf=Buf,read_mode=ReadMode}=State) -> case position(Handle, At, Buf) of - {error,_} = Reply -> - {error,Reply,State}; - _ -> - case get_chars(Sz, latin1, State#state{buf= <<>>}) of - {reply,Reply,NewState} - when is_list(Reply); - is_binary(Reply) -> - {reply,{ok,Reply},NewState}; - Other -> - Other - end - end; -file_request({pwrite,At,Data}, - #state{buf= <<>>}=State) - when At =:= cur; - At =:= {cur,0} -> - put_chars(Data, latin1, State); + {ok,_Offs} -> + case ?PRIM_FILE:read(Handle, Sz) of + {ok,Bin} when ReadMode =:= list -> + std_reply({ok,binary_to_list(Bin)}, State); + Reply -> + std_reply(Reply, State) + end; + Reply -> + std_reply(Reply, State) + end; file_request({pwrite,At,Data}, #state{handle=Handle,buf=Buf}=State) -> case position(Handle, At, Buf) of - {error,_} = Reply -> - {error,Reply,State}; - _ -> - put_chars(Data, latin1, State) + {ok,_Offs} -> + std_reply(?PRIM_FILE:write(Handle, Data), State); + Reply -> + std_reply(Reply, State) end; file_request(datasync, #state{handle=Handle}=State) -> case ?PRIM_FILE:datasync(Handle) of - {error,Reason}=Reply -> - {stop,Reason,Reply,State}; + {error,_}=Reply -> + {stop,normal,Reply,State}; Reply -> {reply,Reply,State} end; file_request(sync, #state{handle=Handle}=State) -> case ?PRIM_FILE:sync(Handle) of - {error,Reason}=Reply -> - {stop,Reason,Reply,State}; + {error,_}=Reply -> + {stop,normal,Reply,State}; Reply -> {reply,Reply,State} end; file_request(close, #state{handle=Handle}=State) -> - case ?PRIM_FILE:close(Handle) of - {error,Reason}=Reply -> - {stop,Reason,Reply,State#state{buf= <<>>}}; - Reply -> - {stop,normal,Reply,State#state{buf= <<>>}} - end; + {stop,normal,?PRIM_FILE:close(Handle),State#state{buf= <<>>}}; file_request({position,At}, #state{handle=Handle,buf=Buf}=State) -> - case position(Handle, At, Buf) of - {error,_} = Reply -> - {error,Reply,State}; - Reply -> - std_reply(Reply, State) - end; + std_reply(position(Handle, At, Buf), State); file_request(truncate, #state{handle=Handle}=State) -> case ?PRIM_FILE:truncate(Handle) of - {error,Reason}=Reply -> - {stop,Reason,Reply,State#state{buf= <<>>}}; + {error,_Reason}=Reply -> + {stop,normal,Reply,State#state{buf= <<>>}}; Reply -> - std_reply(Reply, State) + {reply,Reply,State} end; file_request(Unknown, #state{}=State) -> Reason = {request, Unknown}, {error,{error,Reason},State}. -%% Standard reply and clear buffer std_reply({error,_}=Reply, State) -> {error,Reply,State#state{buf= <<>>}}; std_reply(Reply, State) -> @@ -315,8 +285,8 @@ io_request({put_chars, Enc, Chars}, #state{handle=Handle,buf=Buf}=State) -> case position(Handle, cur, Buf) of - {error,Reason}=Reply -> - {stop,Reason,Reply,State}; + {error,_}=Reply -> + {stop,normal,Reply,State#state{buf= <<>>}}; _ -> put_chars(Chars, Enc, State#state{buf= <<>>}) end; @@ -337,18 +307,18 @@ #state{}=State) -> get_chars(N, Enc, State); -io_request({get_line,OutEnc,_Prompt}, #state{buf=Buf, read_mode=Mode, unic=InEnc} = State0) -> - try - %% Minimize the encoding conversions - WorkEnc = case InEnc of - {_,_} -> OutEnc; %% utf16 or utf32 - _ -> InEnc %% Byte oriented utf8 or latin1 - end, - {Res, State} = get_line(start, convert_enc(Buf, InEnc, WorkEnc), WorkEnc, State0), - {reply, cast(Res, Mode, WorkEnc, OutEnc), State} - catch exit:ExError -> - {stop,ExError,{error,ExError},State0#state{buf= <<>>}} - end; +%% +%% This optimization gives almost nothing - needs more working... +%% Disabled for now. /PaN +%% +%% io_request({get_line,Enc,_Prompt}, +%% #state{unic=latin1}=State) -> +%% get_line(Enc,State); + +io_request({get_line,Enc,_Prompt}, + #state{}=State) -> + get_chars(io_lib, collect_line, [], Enc, State); + io_request({setopts, Opts}, #state{}=State) when is_list(Opts) -> @@ -397,63 +367,75 @@ %% I/O request put_chars %% put_chars(Chars, latin1, #state{handle=Handle, unic=latin1}=State) -> - NewState = State#state{buf = <<>>}, case ?PRIM_FILE:write(Handle, Chars) of - {error,Reason}=Reply -> - {stop,Reason,Reply,NewState}; + {error,_}=Reply -> + {stop,normal,Reply,State}; Reply -> - {reply,Reply,NewState} + {reply,Reply,State} end; put_chars(Chars, InEncoding, #state{handle=Handle, unic=OutEncoding}=State) -> - NewState = State#state{buf = <<>>}, case unicode:characters_to_binary(Chars,InEncoding,OutEncoding) of Bin when is_binary(Bin) -> case ?PRIM_FILE:write(Handle, Bin) of - {error,Reason}=Reply -> - {stop,Reason,Reply,NewState}; + {error,_}=Reply -> + {stop,normal,Reply,State}; Reply -> - {reply,Reply,NewState} + {reply,Reply,State} end; {error,_,_} -> - {stop,no_translation, - {error,{no_translation, InEncoding, OutEncoding}}, - NewState} - end. - -get_line(S, {<<>>, Cont}, OutEnc, - #state{handle=Handle, read_mode=Mode, unic=InEnc}=State) -> - case ?PRIM_FILE:read(Handle, read_size(Mode)) of - {ok,Bin} -> - get_line(S, convert_enc([Cont, Bin], InEnc, OutEnc), OutEnc, State); - eof -> - get_line(S, {eof, Cont}, OutEnc, State); - {error,Reason}=Error -> - {stop,Reason,Error,State} - end; -get_line(S0, {Buf, BCont}, OutEnc, #state{unic=InEnc}=State) -> - case io_lib:collect_line(S0, Buf, OutEnc, []) of - {stop, Result, Cont0} -> - %% Convert both buffers back to file InEnc encoding - {Cont, <<>>} = convert_enc(Cont0, OutEnc, InEnc), - {Result, State#state{buf=cast_binary([Cont, BCont])}}; - S -> - get_line(S, {<<>>, BCont}, OutEnc, State) - end. - -convert_enc(Bins, Enc, Enc) -> - {cast_binary(Bins), <<>>}; -convert_enc(eof, _, _) -> - {<<>>, <<>>}; -convert_enc(Bin, InEnc, OutEnc) -> - case unicode:characters_to_binary(Bin, InEnc, OutEnc) of - Res when is_binary(Res) -> - {Res, <<>>}; - {incomplete, Res, Cont} -> - {Res, Cont}; - {error, _, _} -> - exit({no_translation, InEnc, OutEnc}) + {stop,normal,{error,{no_translation, InEncoding, OutEncoding}},State} end. +%% +%% Process the I/O request get_line for latin1 encoding of file specially +%% Unfortunately this function gives almost nothing, it needs more work +%% I disable it for now /PaN +%% +%% srch(<<>>,_,_) -> +%% nomatch; +%% srch(<>,X,N) -> +%% {match,N}; +%% srch(<<_:8,T/binary>>,X,N) -> +%% srch(T,X,N+1). +%% get_line(OutEnc, #state{handle=Handle,buf = <<>>,unic=latin1}=State) -> +%% case ?PRIM_FILE:read(Handle,?READ_SIZE_BINARY) of +%% {ok, B} -> +%% get_line(OutEnc, State#state{buf = B}); +%% eof -> +%% {reply,eof,State}; +%% {error,Reason}=Error -> +%% {stop,Reason,Error,State} +%% end; +%% get_line(OutEnc, #state{handle=Handle,buf=Buf,read_mode=ReadMode,unic=latin1}=State) -> +%% case srch(Buf,$\n,0) of +%% nomatch -> +%% case ?PRIM_FILE:read(Handle,?READ_SIZE_BINARY) of +%% {ok, B} -> +%% get_line(OutEnc,State#state{buf = <>}); +%% eof -> +%% std_reply(cast(Buf, ReadMode,latin1,OutEnc), State); +%% {error,Reason}=Error -> +%% {stop,Reason,Error,State#state{buf= <<>>}} +%% end; +%% {match,Pos} when Pos >= 1-> +%% PosP1 = Pos + 1, +%% <> = Buf, +%% PosM1 = Pos - 1, +%% Res = case Res0 of +%% <> -> +%% cat(Chomped, <<"\n">>, ReadMode,latin1,OutEnc); +%% _Other -> +%% cast(Res0, ReadMode,latin1,OutEnc) +%% end, +%% {reply,Res,State#state{buf=NewBuf}}; +%% {match,Pos} -> +%% PosP1 = Pos + 1, +%% <> = Buf, +%% {reply,Res,State#state{buf=NewBuf}} +%% end; +%% get_line(_, #state{}=State) -> +%% {error,{error,get_line},State}. + %% %% Process the I/O request get_chars %% @@ -658,6 +640,8 @@ %% Convert error code to make it look as before err_func(io_lib, get_until, {_,F,_}) -> + F; +err_func(_, F, _) -> F. @@ -729,8 +713,6 @@ binary_to_list(B1)++binary_to_list(B2). %% Cast binary to list or binary -cast(eof, _, _, _) -> - eof; cast(B, binary, latin1, latin1) -> B; cast(B, binary, InEncoding, OutEncoding) -> @@ -754,8 +736,6 @@ %% Convert buffer to binary cast_binary(Binary) when is_binary(Binary) -> Binary; -cast_binary([<<>>|List]) -> - cast_binary(List); cast_binary(List) when is_list(List) -> list_to_binary(List); cast_binary(_EOF) -> @@ -917,14 +897,11 @@ %% Compensates ?PRIM_FILE:position/2 for the number of bytes %% we have buffered -position(Handle, At, Buf) -> - ?PRIM_FILE:position( - Handle, - case At of - cur -> - {cur, -byte_size(Buf)}; - {cur, Offs} -> - {cur, Offs-byte_size(Buf)}; - _ -> - At - end). + +position(Handle, cur, Buf) -> + position(Handle, {cur, 0}, Buf); +position(Handle, {cur, Offs}, Buf) when is_binary(Buf) -> + ?PRIM_FILE:position(Handle, {cur, Offs-byte_size(Buf)}); +position(Handle, At, _Buf) -> + ?PRIM_FILE:position(Handle, At). + diff -Nru erlang-18.2-dfsg/lib/kernel/src/file_server.erl erlang-17.3-dfsg/lib/kernel/src/file_server.erl --- erlang-18.2-dfsg/lib/kernel/src/file_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/file_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/gen_sctp.erl erlang-17.3-dfsg/lib/kernel/src/gen_sctp.erl --- erlang-18.2-dfsg/lib/kernel/src/gen_sctp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/gen_sctp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/gen_tcp.erl erlang-17.3-dfsg/lib/kernel/src/gen_tcp.erl --- erlang-18.2-dfsg/lib/kernel/src/gen_tcp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/gen_tcp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -59,7 +58,6 @@ {reuseaddr, boolean()} | {send_timeout, non_neg_integer() | infinity} | {send_timeout_close, boolean()} | - {show_econnreset, boolean()} | {sndbuf, non_neg_integer()} | {tos, non_neg_integer()} | {ipv6_v6only, boolean()}. @@ -91,7 +89,6 @@ reuseaddr | send_timeout | send_timeout_close | - show_econnreset | sndbuf | tos | ipv6_v6only. diff -Nru erlang-18.2-dfsg/lib/kernel/src/gen_udp.erl erlang-17.3-dfsg/lib/kernel/src/gen_udp.erl --- erlang-18.2-dfsg/lib/kernel/src/gen_udp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/gen_udp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -79,7 +78,7 @@ ipv6_v6only. -type socket() :: port(). --export_type([option/0, option_name/0, socket/0]). +-export_type([option/0, option_name/0]). -spec open(Port) -> {ok, Socket} | {error, Reason} when Port :: inet:port_number(), diff -Nru erlang-18.2-dfsg/lib/kernel/src/global.erl erlang-17.3-dfsg/lib/kernel/src/global.erl --- erlang-18.2-dfsg/lib/kernel/src/global.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/global.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -882,12 +881,11 @@ false -> resend_pre_connect(Node), - %% erlang:unique_integer([monotonic]) is used as a tag to - %% separate different synch sessions + %% now() is used as a tag to separate different synch sessions %% from each others. Global could be confused at bursty nodeups %% because it couldn't separate the messages between the different %% synch sessions started by a nodeup. - MyTag = erlang:unique_integer([monotonic]), + MyTag = now(), put({sync_tag_my, Node}, MyTag), ?trace({sending_nodeup_to_locker, {node,Node},{mytag,MyTag}}), S1#state.the_locker ! {nodeup, Node, MyTag}, @@ -1774,8 +1772,8 @@ S#multi{known = Known, the_boss = TheBoss}. random_element(L) -> - E = abs(erlang:monotonic_time() - bxor erlang:unique_integer()) rem length(L), + {A,B,C} = now(), + E = (A+B+C) rem length(L), lists:nth(E+1, L). exclude_known(Others, Known) -> @@ -2074,10 +2072,9 @@ end, case get(random_seed) of undefined -> - _ = random:seed(erlang:phash2([erlang:node()]), - erlang:monotonic_time(), - erlang:unique_integer()), - ok; + {A1, A2, A3} = now(), + _ = random:seed(A1, A2, A3 + erlang:phash(node(), 100000)), + ok; _ -> ok end, %% First time 1/4 seconds, then doubling each time up to 8 seconds max. @@ -2109,7 +2106,7 @@ S#state{trace = [trace_message(M, X) | S#state.trace]}. trace_message(M, X) -> - {node(), erlang:timestamp(), M, nodes(), X}. + {node(), now(), M, nodes(), X}. %%----------------------------------------------------------------- %% Each sync process corresponds to one call to sync. Each such diff -Nru erlang-18.2-dfsg/lib/kernel/src/global_group.erl erlang-17.3-dfsg/lib/kernel/src/global_group.erl --- erlang-18.2-dfsg/lib/kernel/src/global_group.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/global_group.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/global_search.erl erlang-17.3-dfsg/lib/kernel/src/global_search.erl --- erlang-18.2-dfsg/lib/kernel/src/global_search.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/global_search.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/group.erl erlang-17.3-dfsg/lib/kernel/src/group.erl --- erlang-18.2-dfsg/lib/kernel/src/group.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/group.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -112,13 +111,8 @@ server_loop(Drv, Shell, Buf0) -> receive {io_request,From,ReplyAs,Req} when is_pid(From) -> - %% This io_request may cause a transition to a couple of - %% selective receive loops elsewhere in this module. - Buf = io_request(Req, From, ReplyAs, Drv, Buf0), - server_loop(Drv, Shell, Buf); - {reply,{{From,ReplyAs},Reply}} -> - io_reply(From, ReplyAs, Reply), - server_loop(Drv, Shell, Buf0); + Buf = io_request(Req, From, ReplyAs, Drv, Buf0), + server_loop(Drv, Shell, Buf); {driver_id,ReplyTo} -> ReplyTo ! {self(),driver_id,Drv}, server_loop(Drv, Shell, Buf0); @@ -178,13 +172,10 @@ io_request(Req, From, ReplyAs, Drv, Buf0) -> - case io_request(Req, Drv, {From,ReplyAs}, Buf0) of + case io_request(Req, Drv, Buf0) of {ok,Reply,Buf} -> io_reply(From, ReplyAs, Reply), Buf; - {noreply,Buf} -> - %% We expect a {reply,_} message from the Drv when request is done - Buf; {error,Reply,Buf} -> io_reply(From, ReplyAs, Reply), Buf; @@ -205,85 +196,78 @@ %% io_request({put_chars,unicode,Binary}, Drv, Buf) when is_binary(Binary) -> %% send_drv(Drv, {put_chars,Binary}), %% {ok,ok,Buf}; -%% -%% These put requests have to be synchronous to the driver as otherwise -%% there is no guarantee that the data has actually been printed. -io_request({put_chars,unicode,Chars}, Drv, From, Buf) -> +io_request({put_chars,unicode,Chars}, Drv, Buf) -> case catch unicode:characters_to_binary(Chars,utf8) of Binary when is_binary(Binary) -> - send_drv(Drv, {put_chars_sync, unicode, Binary, {From,ok}}), - {noreply,Buf}; + send_drv(Drv, {put_chars, unicode, Binary}), + {ok,ok,Buf}; _ -> {error,{error,{put_chars, unicode,Chars}},Buf} end; -io_request({put_chars,unicode,M,F,As}, Drv, From, Buf) -> +io_request({put_chars,unicode,M,F,As}, Drv, Buf) -> case catch apply(M, F, As) of Binary when is_binary(Binary) -> - send_drv(Drv, {put_chars_sync, unicode, Binary, {From,ok}}), - {noreply,Buf}; + send_drv(Drv, {put_chars, unicode,Binary}), + {ok,ok,Buf}; Chars -> case catch unicode:characters_to_binary(Chars,utf8) of B when is_binary(B) -> - send_drv(Drv, {put_chars_sync, unicode, B, {From,ok}}), - {noreply,Buf}; + send_drv(Drv, {put_chars, unicode,B}), + {ok,ok,Buf}; _ -> {error,{error,F},Buf} end end; -io_request({put_chars,latin1,Binary}, Drv, From, Buf) when is_binary(Binary) -> - send_drv(Drv, {put_chars_sync, unicode, - unicode:characters_to_binary(Binary,latin1), - {From,ok}}), - {noreply,Buf}; -io_request({put_chars,latin1,Chars}, Drv, From, Buf) -> +io_request({put_chars,latin1,Binary}, Drv, Buf) when is_binary(Binary) -> + send_drv(Drv, {put_chars, unicode,unicode:characters_to_binary(Binary,latin1)}), + {ok,ok,Buf}; +io_request({put_chars,latin1,Chars}, Drv, Buf) -> case catch unicode:characters_to_binary(Chars,latin1) of Binary when is_binary(Binary) -> - send_drv(Drv, {put_chars_sync, unicode, Binary, {From,ok}}), - {noreply,Buf}; + send_drv(Drv, {put_chars, unicode,Binary}), + {ok,ok,Buf}; _ -> {error,{error,{put_chars,latin1,Chars}},Buf} end; -io_request({put_chars,latin1,M,F,As}, Drv, From, Buf) -> +io_request({put_chars,latin1,M,F,As}, Drv, Buf) -> case catch apply(M, F, As) of Binary when is_binary(Binary) -> - send_drv(Drv, {put_chars_sync, unicode, - unicode:characters_to_binary(Binary,latin1), - {From,ok}}), - {noreply,Buf}; + send_drv(Drv, {put_chars, unicode,unicode:characters_to_binary(Binary,latin1)}), + {ok,ok,Buf}; Chars -> case catch unicode:characters_to_binary(Chars,latin1) of B when is_binary(B) -> - send_drv(Drv, {put_chars_sync, unicode, B, {From,ok}}), - {noreply,Buf}; + send_drv(Drv, {put_chars, unicode,B}), + {ok,ok,Buf}; _ -> {error,{error,F},Buf} end end; -io_request({get_chars,Encoding,Prompt,N}, Drv, _From, Buf) -> +io_request({get_chars,Encoding,Prompt,N}, Drv, Buf) -> get_chars(Prompt, io_lib, collect_chars, N, Drv, Buf, Encoding); -io_request({get_line,Encoding,Prompt}, Drv, _From, Buf) -> +io_request({get_line,Encoding,Prompt}, Drv, Buf) -> get_chars(Prompt, io_lib, collect_line, [], Drv, Buf, Encoding); -io_request({get_until,Encoding, Prompt,M,F,As}, Drv, _From, Buf) -> +io_request({get_until,Encoding, Prompt,M,F,As}, Drv, Buf) -> get_chars(Prompt, io_lib, get_until, {M,F,As}, Drv, Buf, Encoding); -io_request({get_password,_Encoding},Drv,_From,Buf) -> +io_request({get_password,_Encoding},Drv,Buf) -> get_password_chars(Drv, Buf); -io_request({setopts,Opts}, Drv, _From, Buf) when is_list(Opts) -> +io_request({setopts,Opts}, Drv, Buf) when is_list(Opts) -> setopts(Opts, Drv, Buf); -io_request(getopts, Drv, _From, Buf) -> +io_request(getopts, Drv, Buf) -> getopts(Drv, Buf); -io_request({requests,Reqs}, Drv, From, Buf) -> - io_requests(Reqs, {ok,ok,Buf}, From, Drv); +io_request({requests,Reqs}, Drv, Buf) -> + io_requests(Reqs, {ok,ok,Buf}, Drv); %% New in R12 -io_request({get_geometry,columns},Drv,_From,Buf) -> +io_request({get_geometry,columns},Drv,Buf) -> case get_tty_geometry(Drv) of {W,_H} -> {ok,W,Buf}; _ -> {error,{error,enotsup},Buf} end; -io_request({get_geometry,rows},Drv,_From,Buf) -> +io_request({get_geometry,rows},Drv,Buf) -> case get_tty_geometry(Drv) of {_W,H} -> {ok,H,Buf}; @@ -292,49 +276,38 @@ end; %% BC with pre-R13 -io_request({put_chars,Chars}, Drv, From, Buf) -> - io_request({put_chars,latin1,Chars}, Drv, From, Buf); -io_request({put_chars,M,F,As}, Drv, From, Buf) -> - io_request({put_chars,latin1,M,F,As}, Drv, From, Buf); -io_request({get_chars,Prompt,N}, Drv, From, Buf) -> - io_request({get_chars,latin1,Prompt,N}, Drv, From, Buf); -io_request({get_line,Prompt}, Drv, From, Buf) -> - io_request({get_line,latin1,Prompt}, Drv, From, Buf); -io_request({get_until, Prompt,M,F,As}, Drv, From, Buf) -> - io_request({get_until,latin1, Prompt,M,F,As}, Drv, From, Buf); -io_request(get_password,Drv,From,Buf) -> - io_request({get_password,latin1},Drv,From,Buf); +io_request({put_chars,Chars}, Drv, Buf) -> + io_request({put_chars,latin1,Chars}, Drv, Buf); +io_request({put_chars,M,F,As}, Drv, Buf) -> + io_request({put_chars,latin1,M,F,As}, Drv, Buf); +io_request({get_chars,Prompt,N}, Drv, Buf) -> + io_request({get_chars,latin1,Prompt,N}, Drv, Buf); +io_request({get_line,Prompt}, Drv, Buf) -> + io_request({get_line,latin1,Prompt}, Drv, Buf); +io_request({get_until, Prompt,M,F,As}, Drv, Buf) -> + io_request({get_until,latin1, Prompt,M,F,As}, Drv, Buf); +io_request(get_password,Drv,Buf) -> + io_request({get_password,latin1},Drv,Buf); -io_request(_, _Drv, _From, Buf) -> +io_request(_, _Drv, Buf) -> {error,{error,request},Buf}. -%% Status = io_requests(RequestList, PrevStat, From, Drv) -%% Process a list of output requests as long as -%% the previous status is 'ok' or noreply. -%% -%% We use undefined as the From for all but the last request -%% in order to discards acknowledgements from those requests. -%% -io_requests([R|Rs], {noreply,Buf}, From, Drv) -> - ReqFrom = if Rs =:= [] -> From; true -> undefined end, - io_requests(Rs, io_request(R, Drv, ReqFrom, Buf), From, Drv); -io_requests([R|Rs], {ok,ok,Buf}, From, Drv) -> - ReqFrom = if Rs =:= [] -> From; true -> undefined end, - io_requests(Rs, io_request(R, Drv, ReqFrom, Buf), From, Drv); -io_requests([_|_], Error, _From, _Drv) -> +%% Status = io_requests(RequestList, PrevStat, Drv) +%% Process a list of output requests as long as the previous status is 'ok'. + +io_requests([R|Rs], {ok,ok,Buf}, Drv) -> + io_requests(Rs, io_request(R, Drv, Buf), Drv); +io_requests([_|_], Error, _Drv) -> Error; -io_requests([], Stat, _From, _) -> +io_requests([], Stat, _) -> Stat. %% io_reply(From, ReplyAs, Reply) %% The function for sending i/o command acknowledgement. %% The ACK contains the return value. -io_reply(undefined, _ReplyAs, _Reply) -> - %% Ignore these replies as they are generated from io_requests/4. - ok; io_reply(From, ReplyAs, Reply) -> From ! {io_reply,ReplyAs,Reply}, ok. @@ -646,10 +619,6 @@ io_request(Req, From, ReplyAs, Drv, []), %WRONG!!! send_drv_reqs(Drv, edlin:redraw_line(Cont)), get_line1({more_chars,Cont,[]}, Drv, Ls, Encoding); - {reply,{{From,ReplyAs},Reply}} -> - %% We take care of replies from puts here as well - io_reply(From, ReplyAs, Reply), - more_data(What, Cont0, Drv, Ls, Encoding); {'EXIT',Drv,interrupt} -> interrupted; {'EXIT',Drv,_} -> @@ -672,10 +641,6 @@ {io_request,From,ReplyAs,Req} when is_pid(From) -> io_request(Req, From, ReplyAs, Drv, []), get_line_echo_off1({Chars,[]}, Drv); - {reply,{{From,ReplyAs},Reply}} when From =/= undefined -> - %% We take care of replies from puts here as well - io_reply(From, ReplyAs, Reply), - get_line_echo_off1({Chars,[]},Drv); {'EXIT',Drv,interrupt} -> interrupted; {'EXIT',Drv,_} -> @@ -825,10 +790,6 @@ %% set to []. But do we expect anything but plain output? get_password1({Chars, []}, Drv); - {reply,{{From,ReplyAs},Reply}} -> - %% We take care of replies from puts here as well - io_reply(From, ReplyAs, Reply), - get_password1({Chars, []},Drv); {'EXIT',Drv,interrupt} -> interrupted; {'EXIT',Drv,_} -> diff -Nru erlang-18.2-dfsg/lib/kernel/src/heart.erl erlang-17.3-dfsg/lib/kernel/src/heart.erl --- erlang-18.2-dfsg/lib/kernel/src/heart.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/heart.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -26,7 +25,7 @@ %%%-------------------------------------------------------------------- %%% This is a rewrite of pre_heart from BS.3. %%% -%%% The purpose of this process-module is to act as a supervisor +%%% The purpose of this process-module is to act as an supervisor %%% of the entire erlang-system. This 'heart' beats with a frequence %%% satisfying an external port program *not* reboot the entire %%% system. If however the erlang-emulator would hang, a reboot is diff -Nru erlang-18.2-dfsg/lib/kernel/src/hipe_unified_loader.erl erlang-17.3-dfsg/lib/kernel/src/hipe_unified_loader.erl --- erlang-18.2-dfsg/lib/kernel/src/hipe_unified_loader.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/hipe_unified_loader.erl 2014-09-16 19:10:57.000000000 +0000 @@ -43,10 +43,10 @@ -export([chunk_name/1, %% Only the code and code_server modules may call the entries below! - load_native_code/3, - post_beam_load/2, - load_module/4, - load/3]). + load_native_code/2, + post_beam_load/1, + load_module/3, + load/2]). %%-define(DEBUG,true). -define(DO_ASSERT,true). @@ -82,57 +82,58 @@ %% HW32 %% HiPE, x86, Win32 end. -word_size(Architecture) -> - case Architecture of - amd64 -> 8; - ppc64 -> 8; - _ -> 4 - end. - %%======================================================================== --spec load_native_code(Mod, binary(), hipe_architecture()) -> - 'no_native' | {'module', Mod} when Mod :: atom(). +-spec load_native_code(Mod, binary()) -> 'no_native' | {'module', Mod} + when Mod :: atom(). %% @doc %% Loads the native code of a module Mod. %% Returns {module,Mod} on success (for compatibility with %% code:load_file/1) and the atom `no_native' on failure. -load_native_code(_Mod, _Bin, undefined) -> - no_native; -load_native_code(Mod, Bin, Architecture) when is_atom(Mod), is_binary(Bin) -> - %% patch_to_emu(Mod), - case code:get_chunk(Bin, chunk_name(Architecture)) of - undefined -> no_native; - NativeCode when is_binary(NativeCode) -> - erlang:system_flag(multi_scheduling, block), - try - OldReferencesToPatch = patch_to_emu_step1(Mod), - case load_module(Mod, NativeCode, Bin, OldReferencesToPatch, - Architecture) of - bad_crc -> no_native; - Result -> Result - end - after - erlang:system_flag(multi_scheduling, unblock) +load_native_code(Mod, Bin) when is_atom(Mod), is_binary(Bin) -> + Architecture = erlang:system_info(hipe_architecture), + try chunk_name(Architecture) of + ChunkTag -> + %% patch_to_emu(Mod), + case code:get_chunk(Bin, ChunkTag) of + undefined -> no_native; + NativeCode when is_binary(NativeCode) -> + erlang:system_flag(multi_scheduling, block), + try + OldReferencesToPatch = patch_to_emu_step1(Mod), + case load_module(Mod, NativeCode, Bin, OldReferencesToPatch) of + bad_crc -> no_native; + Result -> Result + end + after + erlang:system_flag(multi_scheduling, unblock) + end end + catch + _:_ -> + %% Unknown HiPE architecture. Can't happen (in principle). + no_native end. %%======================================================================== --spec post_beam_load(atom(), hipe_architecture()) -> 'ok'. +-spec post_beam_load(atom()) -> 'ok'. -%% does nothing on a hipe-disabled system -post_beam_load(_Mod, undefined) -> - ok; -post_beam_load(Mod, _) when is_atom(Mod) -> - erlang:system_flag(multi_scheduling, block), - try - patch_to_emu(Mod) - after - erlang:system_flag(multi_scheduling, unblock) - end, - ok. +post_beam_load(Mod) when is_atom(Mod) -> + Architecture = erlang:system_info(hipe_architecture), + try chunk_name(Architecture) of + _ChunkTag -> + erlang:system_flag(multi_scheduling, block), + try + patch_to_emu(Mod) + after + erlang:system_flag(multi_scheduling, unblock) + end + catch + _:_ -> + ok + end. %%======================================================================== @@ -147,55 +148,52 @@ %%======================================================================== --spec load_module(Mod, binary(), _, hipe_architecture()) -> - 'bad_crc' | {'module', Mod} when Mod :: atom(). - -load_module(Mod, Bin, Beam, Architecture) -> +-spec load_module(Mod, binary(), _) -> 'bad_crc' | {'module', Mod} + when Mod :: atom(). +load_module(Mod, Bin, Beam) -> erlang:system_flag(multi_scheduling, block), try - load_module_nosmp(Mod, Bin, Beam, Architecture) + load_module_nosmp(Mod, Bin, Beam) after erlang:system_flag(multi_scheduling, unblock) end. -load_module_nosmp(Mod, Bin, Beam, Architecture) -> - load_module(Mod, Bin, Beam, [], Architecture). +load_module_nosmp(Mod, Bin, Beam) -> + load_module(Mod, Bin, Beam, []). -load_module(Mod, Bin, Beam, OldReferencesToPatch, Architecture) -> +load_module(Mod, Bin, Beam, OldReferencesToPatch) -> ?debug_msg("************ Loading Module ~w ************\n",[Mod]), %% Loading a whole module, let the BEAM loader patch closures. put(hipe_patch_closures, false), - load_common(Mod, Bin, Beam, OldReferencesToPatch, Architecture). + load_common(Mod, Bin, Beam, OldReferencesToPatch). %%======================================================================== --spec load(Mod, binary(), hipe_architecture()) -> - 'bad_crc' | {'module', Mod} when Mod :: atom(). +-spec load(Mod, binary()) -> 'bad_crc' | {'module', Mod} when Mod :: atom(). -load(Mod, Bin, Architecture) -> +load(Mod, Bin) -> erlang:system_flag(multi_scheduling, block), try - load_nosmp(Mod, Bin, Architecture) + load_nosmp(Mod, Bin) after erlang:system_flag(multi_scheduling, unblock) end. -load_nosmp(Mod, Bin, Architecture) -> +load_nosmp(Mod, Bin) -> ?debug_msg("********* Loading funs in module ~w *********\n",[Mod]), %% Loading just some functions in a module; patch closures separately. put(hipe_patch_closures, true), - load_common(Mod, Bin, [], [], Architecture). + load_common(Mod, Bin, [], []). %%------------------------------------------------------------------------ -load_common(Mod, Bin, Beam, OldReferencesToPatch, Architecture) -> +load_common(Mod, Bin, Beam, OldReferencesToPatch) -> %% Unpack the binary. [{Version, CheckSum}, ConstAlign, ConstSize, ConstMap, LabelMap, ExportMap, CodeSize, CodeBinary, Refs, 0,[] % ColdSize, CRrefs ] = binary_to_term(Bin), - MD5 = erlang:md5(Bin), % use md5 of actual running code for module_info ?debug_msg("***** ErLLVM *****~nVersion: ~s~nCheckSum: ~w~nConstAlign: ~w~n" ++ "ConstSize: ~w~nConstMap: ~w~nLabelMap: ~w~nExportMap ~w~nRefs ~w~n", [Version, CheckSum, ConstAlign, ConstSize, ConstMap, LabelMap, ExportMap, @@ -213,21 +211,18 @@ bad_crc; true -> put(closures_to_patch, []), - WordSize = word_size(Architecture), - WriteWord = write_word_fun(WordSize), %% Create data segment {ConstAddr,ConstMap2} = - create_data_segment(ConstAlign, ConstSize, ConstMap, WriteWord), + create_data_segment(ConstAlign, ConstSize, ConstMap), %% Find callees for which we may need trampolines. - CalleeMFAs = find_callee_mfas(Refs, Architecture), + CalleeMFAs = find_callee_mfas(Refs), %% Write the code to memory. {CodeAddress,Trampolines} = enter_code(CodeSize, CodeBinary, CalleeMFAs, Mod, Beam), %% Construct CalleeMFA-to-trampoline mapping. - TrampolineMap = mk_trampoline_map(CalleeMFAs, Trampolines, - Architecture), + TrampolineMap = mk_trampoline_map(CalleeMFAs, Trampolines), %% Patch references to code labels in data seg. - ok = patch_consts(LabelMap, ConstAddr, CodeAddress, WriteWord), + ok = patch_consts(LabelMap, ConstAddr, CodeAddress), %% Find out which functions are being loaded (and where). %% Note: Addresses are sorted descending. {MFAs,Addresses} = exports(ExportMap, CodeAddress), @@ -259,8 +254,7 @@ AddressesOfClosuresToPatch = calculate_addresses(ClosurePatches, CodeAddress, Addresses), export_funs(Addresses), - export_funs(Mod, MD5, BeamBinary, - Addresses, AddressesOfClosuresToPatch) + export_funs(Mod, BeamBinary, Addresses, AddressesOfClosuresToPatch) end, %% Redirect references to the old module to the new module's BEAM stub. patch_to_emu_step2(OldReferencesToPatch), @@ -279,26 +273,14 @@ %% Scan the list of patches and build a set (returned as a tuple) %% of the callees for which we may need trampolines. %% -find_callee_mfas(Patches, Architecture) when is_list(Patches) -> - case needs_trampolines(Architecture) of - true -> find_callee_mfas(Patches, gb_sets:empty(), - no_erts_trampolines(Architecture)); - _ -> [] - end. - -needs_trampolines(Architecture) -> - case Architecture of - arm -> true; - powerpc -> true; - ppc64 -> true; - _ -> false - end. - -no_erts_trampolines(Architecture) -> - case Architecture of - powerpc -> true; - ppc64 -> true; - _ -> false +find_callee_mfas(Patches) when is_list(Patches) -> + case erlang:system_info(hipe_architecture) of + amd64 -> []; + arm -> find_callee_mfas(Patches, gb_sets:empty(), false); + powerpc -> find_callee_mfas(Patches, gb_sets:empty(), true); + ppc64 -> find_callee_mfas(Patches, gb_sets:empty(), true); + ultrasparc -> []; + x86 -> [] end. find_callee_mfas([{Type,Data}|Patches], MFAs, SkipErtsSyms) -> @@ -334,9 +316,14 @@ %%---------------------------------------------------------------- %% -mk_trampoline_map([], [], _) -> []; % archs not using trampolines -mk_trampoline_map(CalleeMFAs, Trampolines, Architecture) -> - SizeofLong = word_size(Architecture), +mk_trampoline_map([], []) -> []; % archs not using trampolines +mk_trampoline_map(CalleeMFAs, Trampolines) -> + SizeofLong = + case erlang:system_info(hipe_architecture) of + amd64 -> 8; + ppc64 -> 8; + _ -> 4 + end, mk_trampoline_map(tuple_size(CalleeMFAs), CalleeMFAs, Trampolines, SizeofLong, gb_trees:empty()). @@ -443,9 +430,9 @@ export_funs([]) -> ok. -export_funs(Mod, MD5, Beam, Addresses, ClosuresToPatch) -> +export_funs(Mod, Beam, Addresses, ClosuresToPatch) -> Fs = [{F,A,Address} || #fundef{address=Address, mfa={_M,F,A}} <- Addresses], - Mod = code:make_stub_module(Mod, Beam, {Fs,ClosuresToPatch,MD5}), + Mod = code:make_stub_module(Mod, Beam, {Fs,ClosuresToPatch}), ok. %%======================================================================== @@ -632,24 +619,22 @@ %%---------------------------------------------------------------- %% Patch references to code labels in the data segment. %% -patch_consts(Labels, DataAddress, CodeAddress, WriteWord) -> +patch_consts(Labels, DataAddress, CodeAddress) -> lists:foreach(fun (L) -> - patch_label_or_labels(L, DataAddress, CodeAddress, - WriteWord) + patch_label_or_labels(L, DataAddress, CodeAddress) end, Labels). -patch_label_or_labels({Pos,Offset}, DataAddress, CodeAddress, WriteWord) -> +patch_label_or_labels({Pos,Offset}, DataAddress, CodeAddress) -> ?ASSERT(assert_local_patch(CodeAddress+Offset)), - WriteWord(DataAddress+Pos, CodeAddress+Offset); -patch_label_or_labels({sorted,Base,UnOrderdList}, DataAddress, CodeAddress, - WriteWord) -> - sort_and_write(UnOrderdList, Base, DataAddress, CodeAddress, WriteWord). + write_word(DataAddress+Pos, CodeAddress+Offset); +patch_label_or_labels({sorted,Base,UnOrderdList}, DataAddress, CodeAddress) -> + sort_and_write(UnOrderdList, Base, DataAddress, CodeAddress). -sort_and_write(UnOrderdList, Base, DataAddress, CodeAddress, WriteWord) -> +sort_and_write(UnOrderdList, Base, DataAddress, CodeAddress) -> WriteAndInc = fun ({_, Offset}, DataPos) -> ?ASSERT(assert_local_patch(CodeAddress+Offset)), - WriteWord(DataPos, CodeAddress+Offset) + write_word(DataPos, CodeAddress+Offset) end, lists:foldl(WriteAndInc, DataAddress+Base, sort_on_representation(UnOrderdList)). @@ -675,18 +660,17 @@ %% XXX: It appears this is used for inserting both code addresses %% and other data. In HiPE, code addresses are still 32-bit on %% some 64-bit machines. -write_word_fun(WordSize) -> - case WordSize of - 8 -> - fun (DataAddress, DataWord) -> - hipe_bifs:write_u64(DataAddress, DataWord), - DataAddress+8 - end; - 4 -> - fun (DataAddress, DataWord) -> - hipe_bifs:write_u32(DataAddress, DataWord), - DataAddress+4 - end +write_word(DataAddress, DataWord) -> + case erlang:system_info(hipe_architecture) of + amd64 -> + hipe_bifs:write_u64(DataAddress, DataWord), + DataAddress+8; + ppc64 -> + hipe_bifs:write_u64(DataAddress, DataWord), + DataAddress+8; + _ -> + hipe_bifs:write_u32(DataAddress, DataWord), + DataAddress+4 end. %%-------------------------------------------------------------------- @@ -702,31 +686,30 @@ %% memory, and produces a ConstMap2 mapping each constant's ConstNo to %% its runtime address, tagged if the constant is a term. %% -create_data_segment(DataAlign, DataSize, DataList, WriteWord) -> +create_data_segment(DataAlign, DataSize, DataList) -> %%io:format("create_data_segment: \nDataAlign: ~p\nDataSize: ~p\nDataList: ~p\n",[DataAlign,DataSize,DataList]), DataAddress = hipe_bifs:alloc_data(DataAlign, DataSize), - enter_data(DataList, [], DataAddress, DataSize, WriteWord). + enter_data(DataList, [], DataAddress, DataSize). -enter_data(List, ConstMap2, DataAddress, DataSize, WriteWord) -> +enter_data(List, ConstMap2, DataAddress, DataSize) -> case List of [ConstNo,Offset,Type,Data|Rest] when is_integer(Offset) -> %%?msg("Const ~w\n",[[ConstNo,Offset,Type,Data]]), ?ASSERT((Offset >= 0) and (Offset =< DataSize)), - Res = enter_datum(Type, Data, DataAddress+Offset, WriteWord), - enter_data(Rest, [{ConstNo,Res}|ConstMap2], DataAddress, DataSize, - WriteWord); + Res = enter_datum(Type, Data, DataAddress+Offset), + enter_data(Rest, [{ConstNo,Res}|ConstMap2], DataAddress, DataSize); [] -> {DataAddress, ConstMap2} end. -enter_datum(Type, Data, Address, WriteWord) -> +enter_datum(Type, Data, Address) -> case ?EXT2CONST_TYPE(Type) of term -> %% Address is unused for terms hipe_bifs:term_to_word(hipe_bifs:merge_term(Data)); sorted_block -> L = lists:sort([hipe_bifs:term_to_word(Term) || Term <- Data]), - write_words(L, Address, WriteWord), + write_words(L, Address), Address; block -> case Data of @@ -734,7 +717,7 @@ write_bytes(Lbls, Address); {Lbls, SortOrder} -> SortedLbls = [Lbl || {_,Lbl} <- lists:sort(group(Lbls, SortOrder))], - write_words(SortedLbls, Address, WriteWord); + write_words(SortedLbls, Address); Lbls -> write_bytes(Lbls, Address) end, @@ -749,9 +732,9 @@ bytes_to_32(B4,B3,B2,B1) -> (B4 bsl 24) bor (B3 bsl 16) bor (B2 bsl 8) bor B1. -write_words([W|Rest], Addr, WriteWord) -> - write_words(Rest, WriteWord(Addr, W), WriteWord); -write_words([], Addr, _) when is_integer(Addr) -> true. +write_words([W|Rest], Addr) -> + write_words(Rest, write_word(Addr, W)); +write_words([], Addr) when is_integer(Addr) -> true. write_bytes([B|Rest], Addr) -> hipe_bifs:write_u8(Addr, B), @@ -827,7 +810,7 @@ %%---------------------------------------------------------------- %% Change callers of the given module to instead trap to BEAM. -%% load_native_code/3 calls this just before loading native code. +%% load_native_code/2 calls this just before loading native code. %% patch_to_emu(Mod) -> patch_to_emu_step2(patch_to_emu_step1(Mod)). @@ -844,6 +827,7 @@ %% were added as the result of dynamic apply calls. We must %% purge them too, but we have no explicit record of them. %% Therefore invalidate all native addresses for the module. + %% emu_make_stubs/1 will repair the ones for compiled static calls. hipe_bifs:invalidate_funinfo_native_addresses(MFAs), %% Find all call sites that call these MFAs. As a side-effect, %% create native stubs for any MFAs that are referred. @@ -857,6 +841,7 @@ %% Step 2 must occur after the new BEAM stub module is created. patch_to_emu_step2(ReferencesToPatch) -> + emu_make_stubs(ReferencesToPatch), redirect(ReferencesToPatch). -spec is_loaded(Module::atom()) -> boolean(). @@ -867,6 +852,21 @@ catch _:_ -> false end. +-ifdef(notdef). +emu_make_stubs([{MFA,_Refs}|Rest]) -> + make_stub(MFA), + emu_make_stubs(Rest); +emu_make_stubs([]) -> + []. + +make_stub({_,_,A} = MFA) -> + EmuAddress = hipe_bifs:get_emu_address(MFA), + StubAddress = hipe_bifs:make_native_stub(EmuAddress, A), + hipe_bifs:set_funinfo_native_address(MFA, StubAddress). +-else. +emu_make_stubs(_) -> []. +-endif. + %%-------------------------------------------------------------------- %% Given a list of MFAs, tag them with their referred_from references. %% The resulting {MFA,Refs} list is later passed to redirect/1, once diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet6_sctp.erl erlang-17.3-dfsg/lib/kernel/src/inet6_sctp.erl --- erlang-18.2-dfsg/lib/kernel/src/inet6_sctp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet6_sctp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet6_tcp_dist.erl erlang-17.3-dfsg/lib/kernel/src/inet6_tcp_dist.erl --- erlang-18.2-dfsg/lib/kernel/src/inet6_tcp_dist.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet6_tcp_dist.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,6 +23,28 @@ -export([listen/1, accept/1, accept_connection/5, setup/5, close/1, select/1, is_node_name/1]). +%% internal exports + +-export([accept_loop/2,do_accept/6,do_setup/6, getstat/1,tick/1]). + +-import(error_logger,[error_msg/2]). + +-include("net_address.hrl"). + + + +-define(to_port(Socket, Data, Opts), + case inet6_tcp:send(Socket, Data, Opts) of + {error, closed} -> + self() ! {tcp_closed, Socket}, + {error, closed}; + R -> + R + end). + + +-include("dist.hrl"). +-include("dist_util.hrl"). %% ------------------------------------------------------------ %% Select this protocol based on node name @@ -31,7 +52,14 @@ %% ------------------------------------------------------------ select(Node) -> - inet_tcp_dist:gen_select(inet6_tcp, Node). + case split_node(atom_to_list(Node), $@, []) of + [_, Host] -> + case inet:getaddr(Host,inet6) of + {ok,_} -> true; + _ -> false + end; + _ -> false + end. %% ------------------------------------------------------------ %% Create the listen socket, i.e. the port that this erlang @@ -39,14 +67,59 @@ %% ------------------------------------------------------------ listen(Name) -> - inet_tcp_dist:gen_listen(inet6_tcp, Name). + case inet6_tcp:listen(0, [{active, false}, {packet,2}]) of + {ok, Socket} -> + TcpAddress = get_tcp_address(Socket), + {_,Port} = TcpAddress#net_address.address, + case erl_epmd:register_node(Name, Port) of + {ok, Creation} -> + {ok, {Socket, TcpAddress, Creation}}; + Error -> + Error + end; + Error -> + Error + end. %% ------------------------------------------------------------ %% Accepts new connection attempts from other Erlang nodes. %% ------------------------------------------------------------ accept(Listen) -> - inet_tcp_dist:gen_accept(inet6_tcp, Listen). + spawn_opt(?MODULE, accept_loop, [self(), Listen], [link, {priority, max}]). + +accept_loop(Kernel, Listen) -> + case inet6_tcp:accept(Listen) of + {ok, Socket} -> + Kernel ! {accept,self(),Socket,inet6,tcp}, + _ = controller(Kernel, Socket), + accept_loop(Kernel, Listen); + Error -> + exit(Error) + end. + +controller(Kernel, Socket) -> + receive + {Kernel, controller, Pid} -> + flush_controller(Pid, Socket), + inet6_tcp:controlling_process(Socket, Pid), + flush_controller(Pid, Socket), + Pid ! {self(), controller}; + {Kernel, unsupported_protocol} -> + exit(unsupported_protocol) + end. + +flush_controller(Pid, Socket) -> + receive + {tcp, Socket, Data} -> + Pid ! {tcp, Socket, Data}, + flush_controller(Pid, Socket); + {tcp_closed, Socket} -> + Pid ! {tcp_closed, Socket}, + flush_controller(Pid, Socket) + after 0 -> + ok + end. %% ------------------------------------------------------------ %% Accepts a new connection attempt from another Erlang node. @@ -54,7 +127,85 @@ %% ------------------------------------------------------------ accept_connection(AcceptPid, Socket, MyNode, Allowed, SetupTime) -> - inet_tcp_dist:gen_accept_connection(inet6_tcp, AcceptPid, Socket, MyNode, Allowed, SetupTime). + spawn_opt(?MODULE, do_accept, + [self(), AcceptPid, Socket, MyNode, Allowed, SetupTime], + [link, {priority, max}]). + +do_accept(Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) -> + receive + {AcceptPid, controller} -> + Timer = dist_util:start_timer(SetupTime), + case check_ip(Socket) of + true -> + HSData = #hs_data{ + kernel_pid = Kernel, + this_node = MyNode, + socket = Socket, + timer = Timer, + this_flags = 0, + allowed = Allowed, + f_send = fun(S,D) -> inet6_tcp:send(S,D) end, + f_recv = fun(S,N,T) -> inet6_tcp:recv(S,N,T) + end, + f_setopts_pre_nodeup = + fun(S) -> + inet:setopts(S, + [{active, false}, + {packet, 4}, + nodelay()]) + end, + f_setopts_post_nodeup = + fun(S) -> + inet:setopts(S, + [{active, true}, + {deliver, port}, + {packet, 4}, + nodelay()]) + end, + f_getll = fun(S) -> + inet:getll(S) + end, + f_address = fun get_remote_id/2, + mf_tick = fun ?MODULE:tick/1, + mf_getstat = fun ?MODULE:getstat/1 + }, + dist_util:handshake_other_started(HSData); + {false,IP} -> + error_msg("** Connection attempt from " + "disallowed IP ~w ** ~n", [IP]), + ?shutdown(no_node) + end + end. + + +%% we may not always want the nodelay behaviour +%% for performance reasons + +nodelay() -> + case application:get_env(kernel, dist_nodelay) of + undefined -> + {nodelay, true}; + {ok, true} -> + {nodelay, true}; + {ok, false} -> + {nodelay, false}; + _ -> + {nodelay, true} + end. + + +%% ------------------------------------------------------------ +%% Get remote information about a Socket. +%% ------------------------------------------------------------ + +get_remote_id(Socket, Node) -> + {ok, Address} = inet:peername(Socket), + [_, Host] = split_node(atom_to_list(Node), $@, []), + #net_address { + address = Address, + host = Host, + protocol = tcp, + family = inet6 }. %% ------------------------------------------------------------ %% Setup a new connection to another Erlang node. @@ -62,13 +213,214 @@ %% ------------------------------------------------------------ setup(Node, Type, MyNode, LongOrShortNames,SetupTime) -> - inet_tcp_dist:gen_setup(inet6_tcp, Node, Type, MyNode, LongOrShortNames, SetupTime). + spawn_opt(?MODULE, do_setup, + [self(), Node, Type, MyNode, LongOrShortNames, SetupTime], + [link, {priority, max}]). + +do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) -> + ?trace("~p~n",[{?MODULE,self(),setup,Node}]), + [Name, Address] = splitnode(Node, LongOrShortNames), + case inet:getaddr(Address, inet6) of + {ok, Ip} -> + Timer = dist_util:start_timer(SetupTime), + case erl_epmd:port_please(Name, Ip) of + {port, TcpPort, Version} -> + ?trace("port_please(~p) -> version ~p~n", + [Node,Version]), + dist_util:reset_timer(Timer), + case inet6_tcp:connect(Ip, TcpPort, + [{active, false}, + {packet,2}]) of + {ok, Socket} -> + HSData = #hs_data{ + kernel_pid = Kernel, + other_node = Node, + this_node = MyNode, + socket = Socket, + timer = Timer, + this_flags = 0, + other_version = Version, + f_send = fun inet6_tcp:send/2, + f_recv = fun inet6_tcp:recv/3, + f_setopts_pre_nodeup = + fun(S) -> + inet:setopts + (S, + [{active, false}, + {packet, 4}, + nodelay()]) + end, + f_setopts_post_nodeup = + fun(S) -> + inet:setopts + (S, + [{active, true}, + {deliver, port}, + {packet, 4}, + nodelay()]) + end, + f_getll = fun inet:getll/1, + f_address = + fun(_,_) -> + #net_address { + address = {Ip,TcpPort}, + host = Address, + protocol = tcp, + family = inet6} + end, + mf_tick = fun ?MODULE:tick/1, + mf_getstat = fun ?MODULE:getstat/1, + request_type = Type + }, + dist_util:handshake_we_started(HSData); + _ -> + %% Other Node may have closed since + %% port_please ! + ?trace("other node (~p) " + "closed since port_please.~n", + [Node]), + ?shutdown(Node) + end; + _ -> + ?trace("port_please (~p) " + "failed.~n", [Node]), + ?shutdown(Node) + end; + __Other -> + ?trace("inet_getaddr(~p) " + "failed (~p).~n", [Node,__Other]), + ?shutdown(Node) + end. %% %% Close a socket. %% close(Socket) -> inet6_tcp:close(Socket). + + +%% If Node is illegal terminate the connection setup!! +splitnode(Node, LongOrShortNames) -> + case split_node(atom_to_list(Node), $@, []) of + [Name|Tail] when Tail =/= [] -> + Host = lists:append(Tail), + case split_node(Host, $., []) of + [_] when LongOrShortNames =:= longnames -> + case inet_parse:ipv6strict_address(Host) of + {ok, _} -> + [Name, Host]; + _ -> + error_msg("** System running to use " + "fully qualified " + "hostnames **~n" + "** Hostname ~s is illegal **~n", + [Host]), + ?shutdown(Node) + end; + L when length(L) > 1, LongOrShortNames =:= shortnames -> + error_msg("** System NOT running to use fully qualified " + "hostnames **~n" + "** Hostname ~s is illegal **~n", + [Host]), + ?shutdown(Node); + _ -> + [Name, Host] + end; + [_] -> + error_msg("** Nodename ~p illegal, no '@' character **~n", + [Node]), + ?shutdown(Node); + _ -> + error_msg("** Nodename ~p illegal **~n", [Node]), + ?shutdown(Node) + end. + +split_node([Chr|T], Chr, Ack) -> [lists:reverse(Ack)|split_node(T, Chr, [])]; +split_node([H|T], Chr, Ack) -> split_node(T, Chr, [H|Ack]); +split_node([], _, Ack) -> [lists:reverse(Ack)]. + +%% ------------------------------------------------------------ +%% Fetch local information about a Socket. +%% ------------------------------------------------------------ +get_tcp_address(Socket) -> + {ok, Address} = inet:sockname(Socket), + {ok, Host} = inet:gethostname(), + #net_address { + address = Address, + host = Host, + protocol = tcp, + family = inet6 + }. + +%% ------------------------------------------------------------ +%% Do only accept new connection attempts from nodes at our +%% own LAN, if the check_ip environment parameter is true. +%% ------------------------------------------------------------ +check_ip(Socket) -> + case application:get_env(check_ip) of + {ok, true} -> + case get_ifs(Socket) of + {ok, IFs, IP} -> + check_ip(IFs, IP); + _ -> + ?shutdown(no_node) + end; + _ -> + true + end. + +get_ifs(Socket) -> + case inet:peername(Socket) of + {ok, {IP, _}} -> + case inet:getif(Socket) of + {ok, IFs} -> {ok, IFs, IP}; + Error -> Error + end; + Error -> + Error + end. + +check_ip([{OwnIP, _, Netmask}|IFs], PeerIP) -> + case {mask(Netmask, PeerIP), mask(Netmask, OwnIP)} of + {M, M} -> true; + _ -> check_ip(IFs, PeerIP) + end; +check_ip([], PeerIP) -> + {false, PeerIP}. +mask({M1,M2,M3,M4,M5,M6,M7,M8}, {IP1,IP2,IP3,IP4,IP5,IP6,IP7,IP8}) -> + {M1 band IP1, + M2 band IP2, + M3 band IP3, + M4 band IP4, + M5 band IP5, + M6 band IP6, + M7 band IP7, + M8 band IP8 }. + is_node_name(Node) when is_atom(Node) -> - inet_tcp_dist:is_node_name(Node). + case split_node(atom_to_list(Node), $@, []) of + [_,_Host] -> true; + _ -> false + end; +is_node_name(_Node) -> + false. +tick(Sock) -> + ?to_port(Sock,[],[force]). +getstat(Socket) -> + case inet:getstat(Socket, [recv_cnt, send_cnt, send_pend]) of + {ok, Stat} -> + split_stat(Stat,0,0,0); + Error -> + Error + end. + +split_stat([{recv_cnt, R}|Stat], _, W, P) -> + split_stat(Stat, R, W, P); +split_stat([{send_cnt, W}|Stat], R, _, P) -> + split_stat(Stat, R, W, P); +split_stat([{send_pend, P}|Stat], R, W, _) -> + split_stat(Stat, R, W, P); +split_stat([], R, W, P) -> + {ok, R, W, P}. + diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet6_tcp.erl erlang-17.3-dfsg/lib/kernel/src/inet6_tcp.erl --- erlang-18.2-dfsg/lib/kernel/src/inet6_tcp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet6_tcp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,29 +24,10 @@ -export([controlling_process/2]). -export([fdopen/2]). --export([family/0, mask/2, parse_address/1]). -export([getserv/1, getaddr/1, getaddr/2, getaddrs/1, getaddrs/2]). -include("inet_int.hrl"). -%% my address family -family() -> inet6. - -%% Apply netmask on address -mask({M1,M2,M3,M4,M5,M6,M7,M8}, {IP1,IP2,IP3,IP4,IP5,IP6,IP7,IP8}) -> - {M1 band IP1, - M2 band IP2, - M3 band IP3, - M4 band IP4, - M5 band IP5, - M6 band IP6, - M7 band IP7, - M8 band IP8 }. - -%% Parse address string -parse_address(Host) -> - inet_parse:ipv6strict_address(Host). - %% inet_tcp port lookup getserv(Port) when is_integer(Port) -> {ok, Port}; getserv(Name) when is_atom(Name) -> inet:getservbyname(Name,tcp). diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet6_udp.erl erlang-17.3-dfsg/lib/kernel/src/inet6_udp.erl --- erlang-18.2-dfsg/lib/kernel/src/inet6_udp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet6_udp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_boot.hrl erlang-17.3-dfsg/lib/kernel/src/inet_boot.hrl --- erlang-18.2-dfsg/lib/kernel/src/inet_boot.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_boot.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_config.erl erlang-17.3-dfsg/lib/kernel/src/inet_config.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_config.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_config.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -114,7 +113,13 @@ {unix,_} -> %% The Etc variable enables us to run tests with other %% configuration files than the normal ones - Etc = os:getenv("ERL_INET_ETC_DIR", ?DEFAULT_ETC), + Etc = + case os:getenv("ERL_INET_ETC_DIR") of + false -> + ?DEFAULT_ETC; + _EtcDir -> + _EtcDir + end, case inet_db:res_option(resolv_conf) of undefined -> inet_db:res_option( @@ -147,7 +152,11 @@ do_load_resolv({unix,Type}, longnames) -> %% The Etc variable enables us to run tests with other %% configuration files than the normal ones - Etc = os:getenv("ERL_INET_ETC_DIR", ?DEFAULT_ETC), + Etc = case os:getenv("ERL_INET_ETC_DIR") of + false -> ?DEFAULT_ETC; + _EtcDir -> + _EtcDir + end, load_resolv(filename:join(Etc, ?DEFAULT_RESOLV), resolv), case Type of freebsd -> %% we may have to check version (2.2.2) @@ -298,7 +307,10 @@ win32_load_from_registry(Type) -> %% The TcpReg variable enables us to run tests with other registry configurations than %% the normal ones - TcpReg = os:getenv("ERL_INET_ETC_DIR", ""), + TcpReg = case os:getenv("ERL_INET_ETC_DIR") of + false -> []; + _TReg -> _TReg + end, {ok, Reg} = win32reg:open([read]), {TcpIp,HFileKey} = case Type of diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_config.hrl erlang-17.3-dfsg/lib/kernel/src/inet_config.hrl --- erlang-18.2-dfsg/lib/kernel/src/inet_config.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_config.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_db.erl erlang-17.3-dfsg/lib/kernel/src/inet_db.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_db.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_db.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -633,22 +632,20 @@ hostent_by_domain(Domain, Type) -> ?dbg("hostent_by_domain: ~p~n", [Domain]), - hostent_by_domain(stripdot(Domain), [], [], Type). + hostent_by_domain(stripdot(Domain), [], Type). -hostent_by_domain(Domain, Aliases, LAliases, Type) -> +hostent_by_domain(Domain, Aliases, Type) -> case lookup_type(Domain, Type) of [] -> case lookup_cname(Domain) of [] -> {error, nxdomain}; [CName | _] -> - LDomain = tolower(Domain), - case lists:member(CName, [LDomain | LAliases]) of + case lists:member(CName, [Domain | Aliases]) of true -> {error, nxdomain}; false -> - hostent_by_domain(CName, [Domain | Aliases], - [LDomain | LAliases], Type) + hostent_by_domain(CName, [Domain | Aliases], Type) end end; Addrs -> @@ -673,26 +670,24 @@ %% match data field directly and cache RRs. %% res_hostent_by_domain(Domain, Type, Rec) -> - RRs = lists:map(fun lower_rr/1, Rec#dns_rec.anlist), - res_cache_answer(Rec#dns_rec{anlist = RRs}), + res_cache_answer(Rec), + RRs = Rec#dns_rec.anlist, ?dbg("res_hostent_by_domain: ~p - ~p~n", [Domain, RRs]), - res_hostent_by_domain(stripdot(Domain), [], [], Type, RRs). + res_hostent_by_domain(stripdot(Domain), [], Type, RRs). -res_hostent_by_domain(Domain, Aliases, LAliases, Type, RRs) -> - LDomain = tolower(Domain), - case res_lookup_type(LDomain, Type, RRs) of +res_hostent_by_domain(Domain, Aliases, Type, RRs) -> + case res_lookup_type(Domain, Type, RRs) of [] -> - case res_lookup_type(LDomain, ?S_CNAME, RRs) of + case res_lookup_type(Domain, ?S_CNAME, RRs) of [] -> {error, nxdomain}; [CName | _] -> - case lists:member(tolower(CName), [LDomain | LAliases]) of + case lists:member(CName, [Domain | Aliases]) of true -> {error, nxdomain}; false -> res_hostent_by_domain(CName, [Domain | Aliases], - [LDomain | LAliases], Type, - RRs) + Type, RRs) end end; Addrs -> @@ -725,8 +720,7 @@ %% res_gethostbyaddr(IP, Rec) -> {ok, {IP1, HType, HLen}} = dnt(IP), - RRs = lists:map(fun lower_rr/1, Rec#dns_rec.anlist), - res_cache_answer(Rec#dns_rec{anlist = RRs}), + res_cache_answer(Rec), ent_gethostbyaddr(Rec#dns_rec.anlist, IP1, HType, HLen). ent_gethostbyaddr(RRs, IP, AddrType, Length) -> @@ -1378,12 +1372,13 @@ ets:insert(Cache, RR). times() -> - erlang:convert_time_unit(erlang:monotonic_time() - erlang:system_info(start_time),native,seconds). + {Mega,Secs,_} = erlang:now(), + Mega*1000000 + Secs. %% lookup and remove old entries do_lookup_rr(Domain, Class, Type) -> - match_rr(#dns_rr{domain = tolower(Domain), class = Class,type = Type, + match_rr(#dns_rr{domain = Domain, class = Class,type = Type, cnt = '_', tm = '_', ttl = '_', bm = '_', func = '_', data = '_'}). @@ -1405,11 +1400,6 @@ [RR | filter_rr(RRs, Time)]; filter_rr([], _Time) -> []. -%% Lower case the domain name before storage. -%% -lower_rr(#dns_rr{domain=Domain}=RR) when is_list(Domain) -> - RR#dns_rr { domain = tolower(Domain) }; -lower_rr(RR) -> RR. %% %% Case fold upper-case to lower-case according to RFC 4343 diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_dns.erl erlang-17.3-dfsg/lib/kernel/src/inet_dns.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_dns.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_dns.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_dns.hrl erlang-17.3-dfsg/lib/kernel/src/inet_dns.hrl --- erlang-18.2-dfsg/lib/kernel/src/inet_dns.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_dns.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_dns_record_adts.pl erlang-17.3-dfsg/lib/kernel/src/inet_dns_record_adts.pl --- erlang-18.2-dfsg/lib/kernel/src/inet_dns_record_adts.pl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_dns_record_adts.pl 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2009-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -57,8 +56,7 @@ $" = ','; $\ = "\n"; -foreach my $Name (sort keys %Names) { - my $r = $Names{$Name}; +while( my ($Name, $r) = each(%Names)) { # Create substitutions for this Name my ($Record, @Fields) = @{ $r }; my @FieldMatchValues; @@ -111,8 +109,7 @@ for my $i ( 0 .. $#INDEX ) { my $line = $INDEX[$i]; if ($line =~ s/^[*]//) { - foreach my $Name (sort keys %Names) { - my $r = $Names{$Name}; + while( my ($Name, $r) = each(%Names)) { my ($Record) = @{ $r }; $_ = $line; s/Name\b/$Name/g; diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet.erl erlang-17.3-dfsg/lib/kernel/src/inet.erl --- erlang-18.2-dfsg/lib/kernel/src/inet.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -655,7 +654,7 @@ multicast_if, multicast_ttl, multicast_loop, exit_on_close, high_watermark, low_watermark, high_msgq_watermark, low_msgq_watermark, - send_timeout, send_timeout_close, show_econnreset + send_timeout, send_timeout_close ]. %% Return a list of statistics options @@ -671,10 +670,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% connect_options() -> [tos, priority, reuseaddr, keepalive, linger, sndbuf, recbuf, nodelay, - header, active, packet, packet_size, buffer, mode, deliver, line_delimiter, + header, active, packet, packet_size, buffer, mode, deliver, exit_on_close, high_watermark, low_watermark, high_msgq_watermark, - low_msgq_watermark, send_timeout, send_timeout_close, delay_send, raw, - show_econnreset]. + low_msgq_watermark, send_timeout, send_timeout_close, delay_send, raw]. connect_options(Opts, Family) -> BaseOpts = @@ -692,15 +690,14 @@ case con_opt(Opts, BaseOpts, connect_options()) of {ok, R} -> {ok, R#connect_opts { - opts = lists:reverse(R#connect_opts.opts), ifaddr = translate_ip(R#connect_opts.ifaddr, Family) }}; Error -> Error end. -con_opt([{raw,A,B,C}|Opts],#connect_opts{} = R,As) -> +con_opt([{raw,A,B,C}|Opts],R,As) -> con_opt([{raw,{A,B,C}}|Opts],R,As); -con_opt([Opt | Opts], #connect_opts{} = R, As) -> +con_opt([Opt | Opts], R, As) -> case Opt of {ip,IP} -> con_opt(Opts, R#connect_opts { ifaddr = IP }, As); {ifaddr,IP} -> con_opt(Opts, R#connect_opts { ifaddr = IP }, As); @@ -722,15 +719,13 @@ {active,N} when is_integer(N), N < 32768, N >= -32768 -> NOpts = lists:keydelete(active, 1, R#connect_opts.opts), con_opt(Opts, R#connect_opts { opts = [{active,N}|NOpts] }, As); - {line_delimiter,C} when is_integer(C), C >= 0, C =< 255 -> - con_add(line_delimiter, C, R, Opts, As); {Name,Val} when is_atom(Name) -> con_add(Name, Val, R, Opts, As); _ -> {error, badarg} end; -con_opt([], #connect_opts{} = R, _) -> +con_opt([], R, _) -> {ok, R}. -con_add(Name, Val, #connect_opts{} = R, Opts, AllOpts) -> +con_add(Name, Val, R, Opts, AllOpts) -> case add_opt(Name, Val, R#connect_opts.opts, AllOpts) of {ok, SOpts} -> con_opt(Opts, R#connect_opts { opts = SOpts }, AllOpts); @@ -745,7 +740,7 @@ header, active, packet, buffer, mode, deliver, backlog, ipv6_v6only, exit_on_close, high_watermark, low_watermark, high_msgq_watermark, low_msgq_watermark, send_timeout, send_timeout_close, delay_send, - packet_size, raw, show_econnreset]. + packet_size, raw]. listen_options(Opts, Family) -> BaseOpts = @@ -763,15 +758,14 @@ case list_opt(Opts, BaseOpts, listen_options()) of {ok, R} -> {ok, R#listen_opts { - opts = lists:reverse(R#listen_opts.opts), ifaddr = translate_ip(R#listen_opts.ifaddr, Family) }}; Error -> Error end. -list_opt([{raw,A,B,C}|Opts], #listen_opts{} = R, As) -> +list_opt([{raw,A,B,C}|Opts], R, As) -> list_opt([{raw,{A,B,C}}|Opts], R, As); -list_opt([Opt | Opts], #listen_opts{} = R, As) -> +list_opt([Opt | Opts], R, As) -> case Opt of {ip,IP} -> list_opt(Opts, R#listen_opts { ifaddr = IP }, As); {ifaddr,IP} -> list_opt(Opts, R#listen_opts { ifaddr = IP }, As); @@ -797,10 +791,10 @@ {Name,Val} when is_atom(Name) -> list_add(Name, Val, R, Opts, As); _ -> {error, badarg} end; -list_opt([], #listen_opts{} = R, _SockOpts) -> +list_opt([], R, _SockOpts) -> {ok, R}. -list_add(Name, Val, #listen_opts{} = R, Opts, As) -> +list_add(Name, Val, R, Opts, As) -> case add_opt(Name, Val, R#listen_opts.opts, As) of {ok, SOpts} -> list_opt(Opts, R#listen_opts { opts = SOpts }, As); @@ -822,15 +816,14 @@ case udp_opt(Opts, #udp_opts { }, udp_options()) of {ok, R} -> {ok, R#udp_opts { - opts = lists:reverse(R#udp_opts.opts), ifaddr = translate_ip(R#udp_opts.ifaddr, Family) }}; Error -> Error end. -udp_opt([{raw,A,B,C}|Opts], #udp_opts{} = R, As) -> +udp_opt([{raw,A,B,C}|Opts], R, As) -> udp_opt([{raw,{A,B,C}}|Opts], R, As); -udp_opt([Opt | Opts], #udp_opts{} = R, As) -> +udp_opt([Opt | Opts], R, As) -> case Opt of {ip,IP} -> udp_opt(Opts, R#udp_opts { ifaddr = IP }, As); {ifaddr,IP} -> udp_opt(Opts, R#udp_opts { ifaddr = IP }, As); @@ -845,7 +838,7 @@ BinNS = filename2binary(NS), case prim_inet:is_sockopt_val(netns, BinNS) of true -> - udp_opt(Opts, R#udp_opts { fd = [{netns,BinNS}] }, As); + list_opt(Opts, R#udp_opts { fd = [{netns,BinNS}] }, As); false -> {error, badarg} end; @@ -855,10 +848,10 @@ {Name,Val} when is_atom(Name) -> udp_add(Name, Val, R, Opts, As); _ -> {error, badarg} end; -udp_opt([], #udp_opts{} = R, _SockOpts) -> +udp_opt([], R, _SockOpts) -> {ok, R}. -udp_add(Name, Val, #udp_opts{} = R, Opts, As) -> +udp_add(Name, Val, R, Opts, As) -> case add_opt(Name, Val, R#udp_opts.opts, As) of {ok, SOpts} -> udp_opt(Opts, R#udp_opts { opts = SOpts }, As); @@ -896,16 +889,13 @@ sctp_options(Opts, Mod) -> case sctp_opt(Opts, Mod, #sctp_opts{}, sctp_options()) of {ok,#sctp_opts{ifaddr=undefined}=SO} -> - {ok, - SO#sctp_opts{ - opts=lists:reverse(SO#sctp_opts.opts), - ifaddr=Mod:translate_ip(?SCTP_DEF_IFADDR)}}; - {ok,SO} -> - {ok,SO#sctp_opts{opts=lists:reverse(SO#sctp_opts.opts)}}; + {ok,SO#sctp_opts{ifaddr=Mod:translate_ip(?SCTP_DEF_IFADDR)}}; + {ok,_}=OK -> + OK; Error -> Error end. -sctp_opt([Opt|Opts], Mod, #sctp_opts{} = R, As) -> +sctp_opt([Opt|Opts], Mod, R, As) -> case Opt of {ip,IP} -> sctp_opt_ifaddr(Opts, Mod, R, As, IP); @@ -948,7 +938,7 @@ {ok, R} end. -sctp_opt(Opts, Mod, #sctp_opts{} = R, As, Name, Val) -> +sctp_opt(Opts, Mod, R, As, Name, Val) -> case add_opt(Name, Val, R#sctp_opts.opts, As) of {ok,SocketOpts} -> sctp_opt(Opts, Mod, R#sctp_opts{opts=SocketOpts}, As); @@ -973,8 +963,6 @@ case lists:member(Name, As) of true -> case prim_inet:is_sockopt_val(Name, Val) of - true when Name =:= raw -> - {ok, [{Name,Val} | Opts]}; true -> Opts1 = lists:keydelete(Name, 1, Opts), {ok, [{Name,Val} | Opts1]}; @@ -1082,7 +1070,7 @@ gethostbyname_tm_native(Name, Type, Timer, Opts); gethostbyname_tm(Name, Type, Timer, [native|_]=Opts) -> gethostbyname_tm_native(Name, Type, Timer, Opts); -gethostbyname_tm(Name, Type, Timer, [_|Opts]) -> +gethostbyname_tm(Name, Type, Timer, [_|_]=Opts) -> gethostbyname_tm(Name, Type, Timer, Opts); %% Make sure we always can look up our own hostname. gethostbyname_tm(Name, Type, Timer, []) -> @@ -1539,28 +1527,26 @@ _ -> case prim_inet:getopt(S, active) of {ok, A0} -> - SetOptRes = - case A0 of - false -> ok; - _ -> prim_inet:setopt(S, active, false) - end, - case {tcp_sync_input(S, NewOwner, false), SetOptRes} of - {true, _} -> %% socket already closed + case A0 of + false -> ok; + _ -> ok = prim_inet:setopt(S, active, false) + end, + case tcp_sync_input(S, NewOwner, false) of + true -> %% socket already closed, ok; - {false, ok} -> + false -> try erlang:port_connect(S, NewOwner) of true -> unlink(S), %% unlink from port case A0 of false -> ok; - _ -> prim_inet:setopt(S, active, A0) - end + _ -> ok = prim_inet:setopt(S, active, A0) + end, + ok catch error:Reason -> {error, Reason} - end; - {false, Error} -> - Error + end end; Error -> Error diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_gethost_native.erl erlang-17.3-dfsg/lib/kernel/src/inet_gethost_native.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_gethost_native.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_gethost_native.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_hosts.erl erlang-17.3-dfsg/lib/kernel/src/inet_hosts.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_hosts.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_hosts.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_int.hrl erlang-17.3-dfsg/lib/kernel/src/inet_int.hrl --- erlang-18.2-dfsg/lib/kernel/src/inet_int.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_int.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -148,8 +147,6 @@ -define(INET_LOPT_MSGQ_HIWTRMRK, 36). -define(INET_LOPT_MSGQ_LOWTRMRK, 37). -define(INET_LOPT_NETNS, 38). --define(INET_LOPT_TCP_SHOW_ECONNRESET, 39). --define(INET_LOPT_LINE_DELIM, 40). % Specific SCTP options: separate range: -define(SCTP_OPT_RTOINFO, 100). -define(SCTP_OPT_ASSOCINFO, 101). diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_parse.erl erlang-17.3-dfsg/lib/kernel/src/inet_parse.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_parse.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_parse.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -676,22 +675,28 @@ ipv6_addr_done(Ar) -> list_to_tuple(lists:reverse(Ar)). -%% Collect 1-4 Hex digits -hex(Cs) -> hex(Cs, [], 4). +%% Collect Hex digits +hex(Cs) -> hex(Cs, []). %% -hex([C|Cs], R, N) when C >= $0, C =< $9, N > 0 -> - hex(Cs, [C|R], N-1); -hex([C|Cs], R, N) when C >= $a, C =< $f, N > 0 -> - hex(Cs, [C|R], N-1); -hex([C|Cs], R, N) when C >= $A, C =< $F, N > 0 -> - hex(Cs, [C|R], N-1); -hex(Cs, [_|_]=R, _) when is_list(Cs) -> +hex([C|Cs], R) when C >= $0, C =< $9 -> + hex(Cs, [C|R]); +hex([C|Cs], R) when C >= $a, C =< $f -> + hex(Cs, [C|R]); +hex([C|Cs], R) when C >= $A, C =< $F -> + hex(Cs, [C|R]); +hex(Cs, [_|_]=R) when is_list(Cs) -> {lists:reverse(R),Cs}; -hex(_, _, _) -> +hex(_, _) -> erlang:error(badarg). %% Hex string to integer -hex_to_int(Cs) -> erlang:list_to_integer(Cs, 16). +hex_to_int(Cs0) -> + case strip0(Cs0) of + Cs when length(Cs) =< 4 -> + erlang:list_to_integer("0"++Cs, 16); + _ -> + erlang:error(badarg) + end. %% Dup onto head of existing list dup(0, _, L) -> diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_res.erl erlang-17.3-dfsg/lib/kernel/src/inet_res.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_res.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_res.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -716,10 +715,10 @@ udp_recv(#sock{inet6=I}, {A,B,C,D,E,F,G,H}=IP, Port, Timeout, Decode) when ?ip6(A,B,C,D,E,F,G,H), ?port(Port) -> - do_udp_recv(I, IP, Port, Timeout, Decode, time_now(), Timeout); + do_udp_recv(I, IP, Port, Timeout, Decode, erlang:now(), Timeout); udp_recv(#sock{inet=I}, {A,B,C,D}=IP, Port, Timeout, Decode) when ?ip(A,B,C,D), ?port(Port) -> - do_udp_recv(I, IP, Port, Timeout, Decode, time_now(), Timeout). + do_udp_recv(I, IP, Port, Timeout, Decode, erlang:now(), Timeout). do_udp_recv(_I, _IP, _Port, 0, _Decode, _Start, _T) -> timeout; @@ -743,7 +742,7 @@ NewTimeout = erlang:max(0, Timeout - 50), do_udp_recv(I, IP, Port, NewTimeout, Decode, Start, T); false -> - Now = time_now(), + Now = erlang:now(), NewT = erlang:max(0, Timeout - now_ms(Now, Start)), do_udp_recv(I, IP, Port, Timeout, Decode, Start, NewT); Result -> @@ -1058,9 +1057,5 @@ end. -compile({inline, [now_ms/2]}). -now_ms(Int1, Int0) -> - Int1 - Int0. - --compile({inline, [time_now/0]}). -time_now() -> - erlang:monotonic_time(1000). +now_ms({Meg1,Sec1,Mic1}, {Meg0,Sec0,Mic0}) -> + ((Meg1-Meg0)*1000000 + (Sec1-Sec0))*1000 + ((Mic1-Mic0) div 1000). diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_res.hrl erlang-17.3-dfsg/lib/kernel/src/inet_res.hrl --- erlang-18.2-dfsg/lib/kernel/src/inet_res.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_res.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_sctp.erl erlang-17.3-dfsg/lib/kernel/src/inet_sctp.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_sctp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_sctp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -134,18 +133,15 @@ Timeout = inet:timeout(Timer), receive {sctp,S,Addr,Port,{_,#sctp_assoc_change{state=St}=Ev}} -> - SetOptRes = - case Active of - once -> prim_inet:setopt(S, active, once); - _ -> ok - end, - case {St, SetOptRes} of - {comm_up, ok} -> + case Active of + once -> + ok = prim_inet:setopt(S, active, once); + _ -> ok + end, + if St =:= comm_up -> {ok,Ev}; - {_, ok} -> - {error,Ev}; - {_, Error} -> - Error + true -> + {error,Ev} end after Timeout -> {error,timeout} diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_tcp_dist.erl erlang-17.3-dfsg/lib/kernel/src/inet_tcp_dist.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_tcp_dist.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_tcp_dist.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,13 +23,9 @@ -export([listen/1, accept/1, accept_connection/5, setup/5, close/1, select/1, is_node_name/1]). -%% Generalized dist API --export([gen_listen/2, gen_accept/2, gen_accept_connection/6, - gen_setup/6, gen_select/2]). - %% internal exports --export([accept_loop/3,do_accept/7,do_setup/7,getstat/1]). +-export([accept_loop/2,do_accept/6,do_setup/6,getstat/1,tick/1]). -import(error_logger,[error_msg/2]). @@ -38,6 +33,15 @@ +-define(to_port(Socket, Data, Opts), + case inet_tcp:send(Socket, Data, Opts) of + {error, closed} -> + self() ! {tcp_closed, Socket}, + {error, closed}; + R -> + R + end). + -include("dist.hrl"). -include("dist_util.hrl"). @@ -48,15 +52,8 @@ %% ------------------------------------------------------------ select(Node) -> - gen_select(inet_tcp, Node). - -gen_select(Driver, Node) -> case split_node(atom_to_list(Node), $@, []) of - [_, Host] -> - case inet:getaddr(Host, Driver:family()) of - {ok,_} -> true; - _ -> false - end; + [_,_Host] -> true; _ -> false end. @@ -66,12 +63,9 @@ %% ------------------------------------------------------------ listen(Name) -> - gen_listen(inet_tcp, Name). - -gen_listen(Driver, Name) -> - case do_listen(Driver, [{active, false}, {packet,2}, {reuseaddr, true}]) of + case do_listen([{active, false}, {packet,2}, {reuseaddr, true}]) of {ok, Socket} -> - TcpAddress = get_tcp_address(Driver, Socket), + TcpAddress = get_tcp_address(Socket), {_,Port} = TcpAddress#net_address.address, case erl_epmd:register_node(Name, Port) of {ok, Creation} -> @@ -83,7 +77,7 @@ Error end. -do_listen(Driver, Options) -> +do_listen(Options0) -> {First,Last} = case application:get_env(kernel,inet_dist_listen_min) of {ok,N} when is_integer(N) -> case application:get_env(kernel, @@ -96,59 +90,46 @@ _ -> {0,0} end, - do_listen(Driver, First, Last, listen_options([{backlog,128}|Options])). + Options = case application:get_env(kernel, inet_dist_use_interface) of + {ok, Ip} -> + [{ip, Ip} | Options0]; + _ -> + Options0 + end, + do_listen(First, Last, [{backlog,128}|Options]). -do_listen(_Driver, First,Last,_) when First > Last -> +do_listen(First,Last,_) when First > Last -> {error,eaddrinuse}; -do_listen(Driver, First,Last,Options) -> - case Driver:listen(First, Options) of +do_listen(First,Last,Options) -> + case inet_tcp:listen(First, Options) of {error, eaddrinuse} -> - do_listen(Driver, First+1,Last,Options); + do_listen(First+1,Last,Options); Other -> Other end. -listen_options(Opts0) -> - Opts1 = - case application:get_env(kernel, inet_dist_use_interface) of - {ok, Ip} -> - [{ip, Ip} | Opts0]; - _ -> - Opts0 - end, - case application:get_env(kernel, inet_dist_listen_options) of - {ok,ListenOpts} -> - ListenOpts ++ Opts1; - _ -> - Opts1 - end. - - %% ------------------------------------------------------------ %% Accepts new connection attempts from other Erlang nodes. %% ------------------------------------------------------------ accept(Listen) -> - gen_accept(inet_tcp, Listen). - -gen_accept(Driver, Listen) -> - spawn_opt(?MODULE, accept_loop, [Driver, self(), Listen], [link, {priority, max}]). + spawn_opt(?MODULE, accept_loop, [self(), Listen], [link, {priority, max}]). -accept_loop(Driver, Kernel, Listen) -> - case Driver:accept(Listen) of +accept_loop(Kernel, Listen) -> + case inet_tcp:accept(Listen) of {ok, Socket} -> - Kernel ! {accept,self(),Socket,Driver:family(),tcp}, - _ = controller(Driver, Kernel, Socket), - accept_loop(Driver, Kernel, Listen); + Kernel ! {accept,self(),Socket,inet,tcp}, + _ = controller(Kernel, Socket), + accept_loop(Kernel, Listen); Error -> exit(Error) end. -controller(Driver, Kernel, Socket) -> +controller(Kernel, Socket) -> receive {Kernel, controller, Pid} -> flush_controller(Pid, Socket), - Driver:controlling_process(Socket, Pid), + inet_tcp:controlling_process(Socket, Pid), flush_controller(Pid, Socket), Pid ! {self(), controller}; {Kernel, unsupported_protocol} -> @@ -173,18 +154,15 @@ %% ------------------------------------------------------------ accept_connection(AcceptPid, Socket, MyNode, Allowed, SetupTime) -> - gen_accept_connection(inet_tcp, AcceptPid, Socket, MyNode, Allowed, SetupTime). - -gen_accept_connection(Driver, AcceptPid, Socket, MyNode, Allowed, SetupTime) -> spawn_opt(?MODULE, do_accept, - [Driver, self(), AcceptPid, Socket, MyNode, Allowed, SetupTime], + [self(), AcceptPid, Socket, MyNode, Allowed, SetupTime], [link, {priority, max}]). -do_accept(Driver, Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) -> +do_accept(Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) -> receive {AcceptPid, controller} -> Timer = dist_util:start_timer(SetupTime), - case check_ip(Driver, Socket) of + case check_ip(Socket) of true -> HSData = #hs_data{ kernel_pid = Kernel, @@ -193,8 +171,9 @@ timer = Timer, this_flags = 0, allowed = Allowed, - f_send = fun Driver:send/2, - f_recv = fun Driver:recv/3, + f_send = fun(S,D) -> inet_tcp:send(S,D) end, + f_recv = fun(S,N,T) -> inet_tcp:recv(S,N,T) + end, f_setopts_pre_nodeup = fun(S) -> inet:setopts(S, @@ -213,8 +192,8 @@ f_getll = fun(S) -> inet:getll(S) end, - f_address = fun(S, Node) -> get_remote_id(Driver, S, Node) end, - mf_tick = fun(S) -> tick(Driver, S) end, + f_address = fun get_remote_id/2, + mf_tick = fun ?MODULE:tick/1, mf_getstat = fun ?MODULE:getstat/1 }, dist_util:handshake_other_started(HSData); @@ -240,18 +219,18 @@ _ -> {nodelay, true} end. - + %% ------------------------------------------------------------ %% Get remote information about a Socket. %% ------------------------------------------------------------ -get_remote_id(Driver, Socket, Node) -> +get_remote_id(Socket, Node) -> case inet:peername(Socket) of {ok,Address} -> case split_node(atom_to_list(Node), $@, []) of [_,Host] -> #net_address{address=Address,host=Host, - protocol=tcp,family=Driver:family()}; + protocol=tcp,family=inet}; _ -> %% No '@' or more than one '@' in node name. ?shutdown(no_node) @@ -266,18 +245,14 @@ %% ------------------------------------------------------------ setup(Node, Type, MyNode, LongOrShortNames,SetupTime) -> - gen_setup(inet_tcp, Node, Type, MyNode, LongOrShortNames, SetupTime). - -gen_setup(Driver, Node, Type, MyNode, LongOrShortNames, SetupTime) -> spawn_opt(?MODULE, do_setup, - [Driver, self(), Node, Type, MyNode, LongOrShortNames, SetupTime], + [self(), Node, Type, MyNode, LongOrShortNames, SetupTime], [link, {priority, max}]). -do_setup(Driver, Kernel, Node, Type, MyNode, LongOrShortNames, SetupTime) -> +do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) -> ?trace("~p~n",[{inet_tcp_dist,self(),setup,Node}]), - [Name, Address] = splitnode(Driver, Node, LongOrShortNames), - AddressFamily = Driver:family(), - case inet:getaddr(Address, AddressFamily) of + [Name, Address] = splitnode(Node, LongOrShortNames), + case inet:getaddr(Address, inet) of {ok, Ip} -> Timer = dist_util:start_timer(SetupTime), case erl_epmd:port_please(Name, Ip) of @@ -285,11 +260,9 @@ ?trace("port_please(~p) -> version ~p~n", [Node,Version]), dist_util:reset_timer(Timer), - case - Driver:connect( - Ip, TcpPort, - connect_options([{active, false}, {packet, 2}])) - of + case inet_tcp:connect(Ip, TcpPort, + [{active, false}, + {packet,2}]) of {ok, Socket} -> HSData = #hs_data{ kernel_pid = Kernel, @@ -299,8 +272,8 @@ timer = Timer, this_flags = 0, other_version = Version, - f_send = fun Driver:send/2, - f_recv = fun Driver:recv/3, + f_send = fun inet_tcp:send/2, + f_recv = fun inet_tcp:recv/3, f_setopts_pre_nodeup = fun(S) -> inet:setopts @@ -325,9 +298,9 @@ address = {Ip,TcpPort}, host = Address, protocol = tcp, - family = AddressFamily} + family = inet} end, - mf_tick = fun(S) -> tick(Driver, S) end, + mf_tick = fun ?MODULE:tick/1, mf_getstat = fun ?MODULE:getstat/1, request_type = Type }, @@ -351,14 +324,6 @@ ?shutdown(Node) end. -connect_options(Opts) -> - case application:get_env(kernel, inet_dist_connect_options) of - {ok,ConnectOpts} -> - ConnectOpts ++ Opts; - _ -> - Opts - end. - %% %% Close a socket. %% @@ -367,23 +332,18 @@ %% If Node is illegal terminate the connection setup!! -splitnode(Driver, Node, LongOrShortNames) -> +splitnode(Node, LongOrShortNames) -> case split_node(atom_to_list(Node), $@, []) of [Name|Tail] when Tail =/= [] -> Host = lists:append(Tail), case split_node(Host, $., []) of [_] when LongOrShortNames =:= longnames -> - case Driver:parse_address(Host) of - {ok, _} -> - [Name, Host]; - _ -> - error_msg("** System running to use " - "fully qualified " - "hostnames **~n" - "** Hostname ~s is illegal **~n", - [Host]), - ?shutdown(Node) - end; + error_msg("** System running to use " + "fully qualified " + "hostnames **~n" + "** Hostname ~s is illegal **~n", + [Host]), + ?shutdown(Node); L when length(L) > 1, LongOrShortNames =:= shortnames -> error_msg("** System NOT running to use fully qualified " "hostnames **~n" @@ -409,26 +369,26 @@ %% ------------------------------------------------------------ %% Fetch local information about a Socket. %% ------------------------------------------------------------ -get_tcp_address(Driver, Socket) -> +get_tcp_address(Socket) -> {ok, Address} = inet:sockname(Socket), {ok, Host} = inet:gethostname(), #net_address { address = Address, host = Host, protocol = tcp, - family = Driver:family() + family = inet }. %% ------------------------------------------------------------ %% Do only accept new connection attempts from nodes at our %% own LAN, if the check_ip environment parameter is true. %% ------------------------------------------------------------ -check_ip(Driver, Socket) -> +check_ip(Socket) -> case application:get_env(check_ip) of {ok, true} -> case get_ifs(Socket) of {ok, IFs, IP} -> - check_ip(Driver, IFs, IP); + check_ip(IFs, IP); _ -> ?shutdown(no_node) end; @@ -447,14 +407,20 @@ Error end. -check_ip(Driver, [{OwnIP, _, Netmask}|IFs], PeerIP) -> - case {Driver:mask(Netmask, PeerIP), Driver:mask(Netmask, OwnIP)} of +check_ip([{OwnIP, _, Netmask}|IFs], PeerIP) -> + case {mask(Netmask, PeerIP), mask(Netmask, OwnIP)} of {M, M} -> true; - _ -> check_ip(Driver, IFs, PeerIP) + _ -> check_ip(IFs, PeerIP) end; -check_ip(_Driver, [], PeerIP) -> +check_ip([], PeerIP) -> {false, PeerIP}. +mask({M1,M2,M3,M4}, {IP1,IP2,IP3,IP4}) -> + {M1 band IP1, + M2 band IP2, + M3 band IP3, + M4 band IP4}. + is_node_name(Node) when is_atom(Node) -> case split_node(atom_to_list(Node), $@, []) of [_, _Host] -> true; @@ -463,14 +429,8 @@ is_node_name(_Node) -> false. -tick(Driver, Socket) -> - case Driver:send(Socket, [], [force]) of - {error, closed} -> - self() ! {tcp_closed, Socket}, - {error, closed}; - R -> - R - end. +tick(Sock) -> + ?to_port(Sock,[],[force]). getstat(Socket) -> case inet:getstat(Socket, [recv_cnt, send_cnt, send_pend]) of diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_tcp.erl erlang-17.3-dfsg/lib/kernel/src/inet_tcp.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_tcp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_tcp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,24 +26,10 @@ -export([controlling_process/2]). -export([fdopen/2]). --export([family/0, mask/2, parse_address/1]). -export([getserv/1, getaddr/1, getaddr/2, getaddrs/1, getaddrs/2]). --include("inet_int.hrl"). - -%% my address family -family() -> inet. -%% Apply netmask on address -mask({M1,M2,M3,M4}, {IP1,IP2,IP3,IP4}) -> - {M1 band IP1, - M2 band IP2, - M3 band IP3, - M4 band IP4}. - -%% Parse address string -parse_address(Host) -> - inet_parse:ipv4strict_address(Host). +-include("inet_int.hrl"). %% inet_tcp port lookup getserv(Port) when is_integer(Port) -> {ok, Port}; diff -Nru erlang-18.2-dfsg/lib/kernel/src/inet_udp.erl erlang-17.3-dfsg/lib/kernel/src/inet_udp.erl --- erlang-18.2-dfsg/lib/kernel/src/inet_udp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/inet_udp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/kernel.app.src erlang-17.3-dfsg/lib/kernel/src/kernel.app.src --- erlang-18.2-dfsg/lib/kernel/src/kernel.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/kernel.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -116,6 +115,6 @@ {applications, []}, {env, [{error_logger, tty}]}, {mod, {kernel, []}}, - {runtime_dependencies, ["erts-7.0", "stdlib-2.6", "sasl-2.6"]} + {runtime_dependencies, ["erts-6.1.2", "stdlib-2.0", "sasl-2.4"]} ] }. diff -Nru erlang-18.2-dfsg/lib/kernel/src/kernel.appup.src erlang-17.3-dfsg/lib/kernel/src/kernel.appup.src --- erlang-18.2-dfsg/lib/kernel/src/kernel.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/kernel.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,26 +1,25 @@ %% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", %% Up from - max one major revision back - [{<<"4\\.[0-1](\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.* - {<<"3\\.[0-2](\\.[0-9]+)*">>,[restart_new_emulator]}], % OTP-17 + [{<<"3\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17 + {<<"2\\.16(\\.[0-9]+)*">>,[restart_new_emulator]}],%% R16 %% Down to - max one major revision back - [{<<"4\\.[0-1](\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.* - {<<"3\\.[0-2](\\.[0-9]+)*">>,[restart_new_emulator]}] % OTP-17 + [{<<"3\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17 + {<<"2\\.16(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R16 }. diff -Nru erlang-18.2-dfsg/lib/kernel/src/kernel_config.erl erlang-17.3-dfsg/lib/kernel/src/kernel_config.erl --- erlang-18.2-dfsg/lib/kernel/src/kernel_config.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/kernel_config.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/kernel.erl erlang-17.3-dfsg/lib/kernel/src/kernel.erl --- erlang-18.2-dfsg/lib/kernel/src/kernel.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/kernel.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -118,7 +117,7 @@ [{local, kernel_safe_sup}, ?MODULE, safe]}, permanent, infinity, supervisor, [?MODULE]}, {ok, {SupFlags, - [Code, File, StdError, User, + [File, Code, StdError, User, Config, SafeSupervisor]}}; _ -> Rpc = {rex, {rpc, start_link, []}, @@ -140,8 +139,8 @@ [{local, kernel_safe_sup}, ?MODULE, safe]}, permanent, infinity, supervisor, [?MODULE]}, {ok, {SupFlags, - [Code, Rpc, Global, InetDb | DistAC] ++ - [NetSup, Glo_grp, File, + [Rpc, Global, InetDb | DistAC] ++ + [NetSup, Glo_grp, File, Code, StdError, User, Config, SafeSupervisor] ++ Timer}} end; init(safe) -> diff -Nru erlang-18.2-dfsg/lib/kernel/src/Makefile erlang-17.3-dfsg/lib/kernel/src/Makefile --- erlang-18.2-dfsg/lib/kernel/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -123,7 +122,6 @@ ../include/net_address.hrl INTERNAL_HRL_FILES= application_master.hrl disk_log.hrl \ - erl_epmd.hrl hipe_ext_format.hrl \ inet_dns.hrl inet_res.hrl \ inet_boot.hrl inet_config.hrl inet_int.hrl \ inet_dns_record_adts.hrl diff -Nru erlang-18.2-dfsg/lib/kernel/src/net_adm.erl erlang-17.3-dfsg/lib/kernel/src/net_adm.erl --- erlang-18.2-dfsg/lib/kernel/src/net_adm.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/net_adm.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/net.erl erlang-17.3-dfsg/lib/kernel/src/net.erl --- erlang-18.2-dfsg/lib/kernel/src/net.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/net.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/net_kernel.erl erlang-17.3-dfsg/lib/kernel/src/net_kernel.erl --- erlang-18.2-dfsg/lib/kernel/src/net_kernel.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/net_kernel.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/os.erl erlang-17.3-dfsg/lib/kernel/src/os.erl --- erlang-18.2-dfsg/lib/kernel/src/os.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/os.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,8 +26,7 @@ %%% BIFs --export([getenv/0, getenv/1, getenv/2, getpid/0, putenv/2, system_time/0, system_time/1, - timestamp/0, unsetenv/1]). +-export([getenv/0, getenv/1, getpid/0, putenv/2, timestamp/0, unsetenv/1]). -spec getenv() -> [string()]. @@ -41,19 +39,6 @@ getenv(_) -> erlang:nif_error(undef). --spec getenv(VarName, DefaultValue) -> Value when - VarName :: string(), - DefaultValue :: string(), - Value :: string(). - -getenv(VarName, DefaultValue) -> - case os:getenv(VarName) of - false -> - DefaultValue; - Value -> - Value - end. - -spec getpid() -> Value when Value :: string(). @@ -67,17 +52,6 @@ putenv(_, _) -> erlang:nif_error(undef). --spec system_time() -> integer(). - -system_time() -> - erlang:nif_error(undef). - --spec system_time(Unit) -> integer() when - Unit :: erlang:time_unit(). - -system_time(_Unit) -> - erlang:nif_error(undef). - -spec timestamp() -> Timestamp when Timestamp :: erlang:timestamp(). @@ -111,7 +85,10 @@ Name :: string(), Filename :: string(). find_executable(Name) -> - find_executable(Name, os:getenv("PATH", "")). + case os:getenv("PATH") of + false -> find_executable(Name, []); + Path -> find_executable(Name, Path) + end. -spec find_executable(Name, Path) -> Filename | 'false' when Name :: string(), diff -Nru erlang-18.2-dfsg/lib/kernel/src/pg2.erl erlang-17.3-dfsg/lib/kernel/src/pg2.erl --- erlang-18.2-dfsg/lib/kernel/src/pg2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/pg2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -141,22 +140,19 @@ [Pid] -> Pid; [] -> + {_,_,X} = erlang:now(), case get_members(Name) of [] -> {error, {no_process, Name}}; Members -> - random_element(Members) + lists:nth((X rem length(Members))+1, Members) end; Members when is_list(Members) -> - random_element(Members); + {_,_,X} = erlang:now(), + lists:nth((X rem length(Members))+1, Members); Else -> Else end. -random_element(List) -> - X = abs(erlang:monotonic_time() - bxor erlang:unique_integer()), - lists:nth((X rem length(List)) + 1, List). - %%% %%% Callback functions from gen_server %%% diff -Nru erlang-18.2-dfsg/lib/kernel/src/ram_file.erl erlang-17.3-dfsg/lib/kernel/src/ram_file.erl --- erlang-18.2-dfsg/lib/kernel/src/ram_file.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/ram_file.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/rpc.erl erlang-17.3-dfsg/lib/kernel/src/rpc.erl --- erlang-18.2-dfsg/lib/kernel/src/rpc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/rpc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,7 +22,7 @@ %% facility %% This code used to reside in net.erl, but has now been moved to -%% a separate module. +%% a searate module. -define(NAME, rex). diff -Nru erlang-18.2-dfsg/lib/kernel/src/seq_trace.erl erlang-17.3-dfsg/lib/kernel/src/seq_trace.erl --- erlang-18.2-dfsg/lib/kernel/src/seq_trace.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/seq_trace.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/standard_error.erl erlang-17.3-dfsg/lib/kernel/src/standard_error.erl --- erlang-18.2-dfsg/lib/kernel/src/standard_error.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/standard_error.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -64,7 +63,7 @@ run(Port). run(P) -> - put(encoding, latin1), + put(unicode,false), server_loop(P). server_loop(Port) -> @@ -96,47 +95,25 @@ io_reply(From, ReplyAs, Reply). %% New in R13B -%% Encoding option (unicode/latin1) -io_request({put_chars,unicode,Chars}, Port) -> - case wrap_characters_to_binary(Chars, unicode, get(encoding)) of - error -> - {error,{error,put_chars}}; - Bin -> - put_chars(Bin, Port) - end; -io_request({put_chars,unicode,Mod,Func,Args}, Port) -> - case catch apply(Mod, Func, Args) of - Data when is_list(Data); is_binary(Data) -> - case wrap_characters_to_binary(Data, unicode, get(encoding)) of - Bin when is_binary(Bin) -> - put_chars(Bin, Port); - error -> - {error,{error,put_chars}} - end; - _ -> - {error,{error,put_chars}} - end; -io_request({put_chars,latin1,Chars}, Port) -> - case catch unicode:characters_to_binary(Chars, latin1, get(encoding)) of - Data when is_binary(Data) -> - put_chars(Data, Port); - _ -> - {error,{error,put_chars}} - end; -io_request({put_chars,latin1,Mod,Func,Args}, Port) -> - case catch apply(Mod, Func, Args) of - Data when is_list(Data); is_binary(Data) -> - case - catch unicode:characters_to_binary(Data, latin1, get(encoding)) - of - Bin when is_binary(Bin) -> - put_chars(Bin, Port); - _ -> - {error,{error,put_chars}} - end; - _ -> - {error,{error,put_chars}} - end; +% Wide characters (Unicode) +io_request({put_chars,Encoding,Chars}, Port) -> % Binary new in R9C + put_chars(wrap_characters_to_binary(Chars,Encoding, + case get(unicode) of + true -> unicode; + _ -> latin1 + end), Port); +io_request({put_chars,Encoding,Mod,Func,Args}, Port) -> + Result = case catch apply(Mod,Func,Args) of + Data when is_list(Data); is_binary(Data) -> + wrap_characters_to_binary(Data,Encoding, + case get(unicode) of + true -> unicode; + _ -> latin1 + end); + Undef -> + Undef + end, + put_chars(Result, Port); %% BC if called from pre-R13 node io_request({put_chars,Chars}, Port) -> io_request({put_chars,latin1,Chars}, Port); @@ -157,10 +134,10 @@ _ -> {error,{error,enotsup}} end; -io_request(getopts, _Port) -> - getopts(); -io_request({setopts,Opts}, _Port) when is_list(Opts) -> - setopts(Opts); +io_request({getopts,[]}, Port) -> + getopts(Port); +io_request({setopts,Opts}, Port) when is_list(Opts) -> + setopts(Opts, Port); io_request({requests,Reqs}, Port) -> io_requests(Reqs, {ok,ok}, Port); io_request(R, _Port) -> %Unknown request @@ -199,48 +176,47 @@ %% put_chars put_chars(Chars, Port) when is_binary(Chars) -> _ = put_port(Chars, Port), - {ok,ok}. + {ok,ok}; +put_chars(Chars, Port) -> + case catch list_to_binary(Chars) of + Binary when is_binary(Binary) -> + put_chars(Binary, Port); + _ -> + {error,{error,put_chars}} + end. %% setopts -setopts(Opts0) -> - Opts = expand_encoding(Opts0), +setopts(Opts0,Port) -> + Opts = proplists:unfold( + proplists:substitute_negations( + [{latin1,unicode}], + Opts0)), case check_valid_opts(Opts) of - true -> - do_setopts(Opts); - false -> - {error,{error,enotsup}} + true -> + do_setopts(Opts,Port); + false -> + {error,{error,enotsup}} end. - check_valid_opts([]) -> true; -check_valid_opts([{encoding,Valid}|T]) when Valid =:= unicode; - Valid =:= utf8; Valid =:= latin1 -> +check_valid_opts([{unicode,Valid}|T]) when Valid =:= true; Valid =:= utf8; Valid =:= false -> check_valid_opts(T); check_valid_opts(_) -> false. -expand_encoding([]) -> - []; -expand_encoding([latin1 | T]) -> - [{encoding,latin1} | expand_encoding(T)]; -expand_encoding([unicode | T]) -> - [{encoding,unicode} | expand_encoding(T)]; -expand_encoding([H|T]) -> - [H|expand_encoding(T)]. - -do_setopts(Opts) -> - case proplists:get_value(encoding, Opts) of - Valid when Valid =:= unicode; Valid =:= utf8 -> - put(encoding, unicode); - latin1 -> - put(encoding, latin1); - undefined -> - ok +do_setopts(Opts, _Port) -> + case proplists:get_value(unicode,Opts) of + Valid when Valid =:= true; Valid =:= utf8 -> + put(unicode,true); + false -> + put(unicode,false); + undefined -> + ok end, {ok,ok}. -getopts() -> - Uni = {encoding,get(encoding)}, +getopts(_Port) -> + Uni = {unicode, get(unicode) =:= true}, {ok,[Uni]}. wrap_characters_to_binary(Chars,From,To) -> @@ -251,17 +227,17 @@ _Else -> 16#10ffff end, - case catch unicode:characters_to_list(Chars, From) of - L when is_list(L) -> - unicode:characters_to_binary( - [ case X of - $\n when TrNl -> - "\r\n"; - High when High > Limit -> - ["\\x{",erlang:integer_to_list(X, 16),$}]; - Low -> - Low - end || X <- L ], unicode, To); - _ -> - error - end. + unicode:characters_to_binary( + [ case X of + $\n -> + if + TrNl -> + "\r\n"; + true -> + $\n + end; + High when High > Limit -> + ["\\x{",erlang:integer_to_list(X, 16),$}]; + Ordinary -> + Ordinary + end || X <- unicode:characters_to_list(Chars,From) ],unicode,To). diff -Nru erlang-18.2-dfsg/lib/kernel/src/user_drv.erl erlang-17.3-dfsg/lib/kernel/src/user_drv.erl --- erlang-18.2-dfsg/lib/kernel/src/user_drv.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/user_drv.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,7 +29,6 @@ -define(OP_INSC,2). -define(OP_DELC,3). -define(OP_BEEP,4). --define(OP_PUTC_SYNC,5). % Control op -define(CTRL_OP_GET_WINSIZE,100). -define(CTRL_OP_GET_UNICODE_STATE,101). @@ -134,9 +132,8 @@ flatten(io_lib:format("~ts\n", [erlang:system_info(system_version)]))}, Iport, Oport), - %% Enter the server loop. - server_loop(Iport, Oport, Curr, User, Gr, {false, queue:new()}). + server_loop(Iport, Oport, Curr, User, Gr). rem_sh_opts(Node) -> [{expand_fun,fun(B)-> rpc:call(Node,edlin_expand,expand,[B]) end}]. @@ -161,41 +158,42 @@ User end. -server_loop(Iport, Oport, User, Gr, IOQueue) -> +server_loop(Iport, Oport, User, Gr) -> Curr = gr_cur_pid(Gr), put(current_group, Curr), - server_loop(Iport, Oport, Curr, User, Gr, IOQueue). + server_loop(Iport, Oport, Curr, User, Gr). -server_loop(Iport, Oport, Curr, User, Gr, {Resp, IOQ} = IOQueue) -> +server_loop(Iport, Oport, Curr, User, Gr) -> receive {Iport,{data,Bs}} -> BsBin = list_to_binary(Bs), Unicode = unicode:characters_to_list(BsBin,utf8), - port_bytes(Unicode, Iport, Oport, Curr, User, Gr, IOQueue); + port_bytes(Unicode, Iport, Oport, Curr, User, Gr); {Iport,eof} -> Curr ! {self(),eof}, - server_loop(Iport, Oport, Curr, User, Gr, IOQueue); - Req when element(1,Req) =:= User orelse element(1,Req) =:= Curr, - tuple_size(Req) =:= 2 orelse tuple_size(Req) =:= 3 -> - %% We match {User|Curr,_}|{User|Curr,_,_} - NewQ = handle_req(Req, Iport, Oport, IOQueue), - server_loop(Iport, Oport, Curr, User, Gr, NewQ); - {Oport,ok} -> - %% We get this ok from the port, in io_request we store - %% info about where to send reply at head of queue - {Origin,Reply} = Resp, - Origin ! {reply,Reply}, - NewQ = handle_req(next, Iport, Oport, {false, IOQ}), - server_loop(Iport, Oport, Curr, User, Gr, NewQ); + server_loop(Iport, Oport, Curr, User, Gr); + {User,Req} -> % never block from user! + io_request(Req, Iport, Oport), + server_loop(Iport, Oport, Curr, User, Gr); + {Curr,tty_geometry} -> + Curr ! {self(),tty_geometry,get_tty_geometry(Iport)}, + server_loop(Iport, Oport, Curr, User, Gr); + {Curr,get_unicode_state} -> + Curr ! {self(),get_unicode_state,get_unicode_state(Iport)}, + server_loop(Iport, Oport, Curr, User, Gr); + {Curr,set_unicode_state, Bool} -> + Curr ! {self(),set_unicode_state,set_unicode_state(Iport,Bool)}, + server_loop(Iport, Oport, Curr, User, Gr); + {Curr,Req} -> + io_request(Req, Iport, Oport), + server_loop(Iport, Oport, Curr, User, Gr); {'EXIT',Iport,_R} -> - server_loop(Iport, Oport, Curr, User, Gr, IOQueue); + server_loop(Iport, Oport, Curr, User, Gr); {'EXIT',Oport,_R} -> - server_loop(Iport, Oport, Curr, User, Gr, IOQueue); - {'EXIT',User,shutdown} -> % force data to port - server_loop(Iport, Oport, Curr, User, Gr, IOQueue); + server_loop(Iport, Oport, Curr, User, Gr); {'EXIT',User,_R} -> % keep 'user' alive NewU = start_user(), - server_loop(Iport, Oport, Curr, NewU, gr_set_num(Gr, 1, NewU, {}), IOQueue); + server_loop(Iport, Oport, Curr, NewU, gr_set_num(Gr, 1, NewU, {})); {'EXIT',Pid,R} -> % shell and group leader exit case gr_cur_pid(Gr) of Pid when R =/= die , @@ -215,88 +213,53 @@ {ok,Gr2} = gr_set_cur(gr_set_num(Gr1, Ix, Pid1, {shell,start,Params}), Ix), put(current_group, Pid1), - server_loop(Iport, Oport, Pid1, User, Gr2, IOQueue); + server_loop(Iport, Oport, Pid1, User, Gr2); _ -> % remote shell io_requests([{put_chars,unicode,"(^G to start new job) ***\n"}], Iport, Oport), - server_loop(Iport, Oport, Curr, User, Gr1, IOQueue) + server_loop(Iport, Oport, Curr, User, Gr1) end; _ -> % not current, just remove it - server_loop(Iport, Oport, Curr, User, gr_del_pid(Gr, Pid), IOQueue) + server_loop(Iport, Oport, Curr, User, gr_del_pid(Gr, Pid)) end; _X -> %% Ignore unknown messages. - server_loop(Iport, Oport, Curr, User, Gr, IOQueue) + server_loop(Iport, Oport, Curr, User, Gr) end. -%% We always handle geometry and unicode requests -handle_req({Curr,tty_geometry},Iport,_Oport,IOQueue) -> - Curr ! {self(),tty_geometry,get_tty_geometry(Iport)}, - IOQueue; -handle_req({Curr,get_unicode_state},Iport,_Oport,IOQueue) -> - Curr ! {self(),get_unicode_state,get_unicode_state(Iport)}, - IOQueue; -handle_req({Curr,set_unicode_state, Bool},Iport,_Oport,IOQueue) -> - Curr ! {self(),set_unicode_state,set_unicode_state(Iport,Bool)}, - IOQueue; -handle_req(next,Iport,Oport,{false,IOQ}=IOQueue) -> - case queue:out(IOQ) of - {empty,_} -> - IOQueue; - {{value,{Origin,Req}},ExecQ} -> - case io_request(Req, Iport, Oport) of - ok -> - handle_req(next,Iport,Oport,{false,ExecQ}); - Reply -> - {{Origin,Reply}, ExecQ} - end - end; -handle_req(Msg,Iport,Oport,{false,IOQ}=IOQueue) -> - empty = queue:peek(IOQ), - {Origin,Req} = Msg, - case io_request(Req, Iport, Oport) of - ok -> - IOQueue; - Reply -> - {{Origin,Reply}, IOQ} - end; -handle_req(Msg,_Iport,_Oport,{Resp, IOQ}) -> - %% All requests are queued when we have outstanding sync put_chars - {Resp, queue:in(Msg,IOQ)}. - %% port_bytes(Bytes, InPort, OutPort, CurrentProcess, UserProcess, Group) %% Check the Bytes from the port to see if it contains a ^G. If so, %% either escape to switch_loop or restart the shell. Otherwise send %% the bytes to Curr. -port_bytes([$\^G|_Bs], Iport, Oport, _Curr, User, Gr, IOQueue) -> - handle_escape(Iport, Oport, User, Gr, IOQueue); +port_bytes([$\^G|_Bs], Iport, Oport, _Curr, User, Gr) -> + handle_escape(Iport, Oport, User, Gr); -port_bytes([$\^C|_Bs], Iport, Oport, Curr, User, Gr, IOQueue) -> - interrupt_shell(Iport, Oport, Curr, User, Gr, IOQueue); +port_bytes([$\^C|_Bs], Iport, Oport, Curr, User, Gr) -> + interrupt_shell(Iport, Oport, Curr, User, Gr); -port_bytes([B], Iport, Oport, Curr, User, Gr, IOQueue) -> +port_bytes([B], Iport, Oport, Curr, User, Gr) -> Curr ! {self(),{data,[B]}}, - server_loop(Iport, Oport, Curr, User, Gr, IOQueue); -port_bytes(Bs, Iport, Oport, Curr, User, Gr, IOQueue) -> + server_loop(Iport, Oport, Curr, User, Gr); +port_bytes(Bs, Iport, Oport, Curr, User, Gr) -> case member($\^G, Bs) of true -> - handle_escape(Iport, Oport, User, Gr, IOQueue); + handle_escape(Iport, Oport, User, Gr); false -> Curr ! {self(),{data,Bs}}, - server_loop(Iport, Oport, Curr, User, Gr, IOQueue) + server_loop(Iport, Oport, Curr, User, Gr) end. -interrupt_shell(Iport, Oport, Curr, User, Gr, IOQueue) -> +interrupt_shell(Iport, Oport, Curr, User, Gr) -> case gr_get_info(Gr, Curr) of undefined -> ok; % unknown _ -> exit(Curr, interrupt) end, - server_loop(Iport, Oport, Curr, User, Gr, IOQueue). + server_loop(Iport, Oport, Curr, User, Gr). -handle_escape(Iport, Oport, User, Gr, IOQueue) -> +handle_escape(Iport, Oport, User, Gr) -> case application:get_env(stdlib, shell_esc) of {ok,abort} -> Pid = gr_cur_pid(Gr), @@ -315,14 +278,11 @@ Pid1 = group:start(self(), {shell,start,[]}), io_request({put_chars,unicode,"\n"}, Iport, Oport), server_loop(Iport, Oport, User, - gr_add_cur(Gr1, Pid1, {shell,start,[]}), IOQueue); + gr_add_cur(Gr1, Pid1, {shell,start,[]})); _ -> % {ok,jcl} | undefined io_request({put_chars,unicode,"\nUser switch command\n"}, Iport, Oport), - %% init edlin used by switch command and have it copy the - %% text buffer from current group process - edlin:init(gr_cur_pid(Gr)), - server_loop(Iport, Oport, User, switch_loop(Iport, Oport, Gr), IOQueue) + server_loop(Iport, Oport, User, switch_loop(Iport, Oport, Gr)) end. switch_loop(Iport, Oport, Gr) -> @@ -532,12 +492,9 @@ io_request(Request, Iport, Oport) -> try io_command(Request) of - {command,_} = Command -> + Command -> Oport ! {self(),Command}, - ok; - {Command,Reply} -> - Oport ! {self(),Command}, - Reply + ok catch {requests,Rs} -> io_requests(Rs, Iport, Oport); @@ -554,13 +511,6 @@ put_int16(N, Tail) -> [(N bsr 8)band 255,N band 255|Tail]. -%% When a put_chars_sync command is used, user_drv guarantees that -%% the bytes have been put in the buffer of the port before an acknowledgement -%% is sent back to the process sending the request. This command was added in -%% OTP 18 to make sure that data sent from io:format is actually printed -%% to the console before the vm stops when calling erlang:halt(integer()). -io_command({put_chars_sync, unicode,Cs,Reply}) -> - {{command,[?OP_PUTC_SYNC|unicode:characters_to_binary(Cs,utf8)]},Reply}; io_command({put_chars, unicode,Cs}) -> {command,[?OP_PUTC|unicode:characters_to_binary(Cs,utf8)]}; io_command({move_rel,N}) -> diff -Nru erlang-18.2-dfsg/lib/kernel/src/user.erl erlang-17.3-dfsg/lib/kernel/src/user.erl --- erlang-18.2-dfsg/lib/kernel/src/user.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/user.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/user_sup.erl erlang-17.3-dfsg/lib/kernel/src/user_sup.erl --- erlang-18.2-dfsg/lib/kernel/src/user_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/user_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/src/wrap_log_reader.erl erlang-17.3-dfsg/lib/kernel/src/wrap_log_reader.erl --- erlang-18.2-dfsg/lib/kernel/src/wrap_log_reader.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/src/wrap_log_reader.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/appinc1.erl erlang-17.3-dfsg/lib/kernel/test/appinc1.erl --- erlang-18.2-dfsg/lib/kernel/test/appinc1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/appinc1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/appinc1x.erl erlang-17.3-dfsg/lib/kernel/test/appinc1x.erl --- erlang-18.2-dfsg/lib/kernel/test/appinc1x.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/appinc1x.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/appinc2A.erl erlang-17.3-dfsg/lib/kernel/test/appinc2A.erl --- erlang-18.2-dfsg/lib/kernel/test/appinc2A.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/appinc2A.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/appinc2B.erl erlang-17.3-dfsg/lib/kernel/test/appinc2B.erl --- erlang-18.2-dfsg/lib/kernel/test/appinc2B.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/appinc2B.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/appinc2.erl erlang-17.3-dfsg/lib/kernel/test/appinc2.erl --- erlang-18.2-dfsg/lib/kernel/test/appinc2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/appinc2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/appinc2top.erl erlang-17.3-dfsg/lib/kernel/test/appinc2top.erl --- erlang-18.2-dfsg/lib/kernel/test/appinc2top.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/appinc2top.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/app_start_error.erl erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/app_start_error.erl --- erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/app_start_error.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/app_start_error.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/group_leader.erl erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/group_leader.erl --- erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/group_leader.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/group_leader.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/group_leader_sup.erl erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/group_leader_sup.erl --- erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/group_leader_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/group_leader_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/trans_abnormal_sup.erl erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/trans_abnormal_sup.erl --- erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/trans_abnormal_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/trans_abnormal_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/transient.erl erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/transient.erl --- erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/transient.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/transient.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/trans_normal_sup.erl erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/trans_normal_sup.erl --- erlang-18.2-dfsg/lib/kernel/test/application_SUITE_data/trans_normal_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/application_SUITE_data/trans_normal_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/application_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/application_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/application_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/application_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -2700,7 +2699,10 @@ node_name(Name, Config) -> U = "_", - L = integer_to_list(erlang:unique_integer([positive])), + {{Y,M,D}, {H,Min,S}} = calendar:now_to_local_time(now()), + Date = io_lib:format("~4w_~2..0w_~2..0w__~2..0w_~2..0w_~2..0w", + [Y,M,D, H,Min,S]), + L = lists:flatten(Date), lists:concat([Name,U,?testcase,U,U,L]). stop_node_nice(Node) when is_atom(Node) -> diff -Nru erlang-18.2-dfsg/lib/kernel/test/bif_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/bif_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/bif_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/bif_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,7 +32,6 @@ spawn_failures/1, run_fun/1, - decode_packet_delim/1, wilderness/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -517,15 +515,6 @@ {value,{heap_size,HS}} = lists:keysearch(heap_size, 1, PI), ?line {Ls, P, FA, HS}. -decode_packet_delim(doc) -> - ["Test erlang:packet_delim/3 with {line_delimiter,0} option"]; -decode_packet_delim(suite) -> - []; -decode_packet_delim(Config) when is_list(Config) -> - {ok,<<"abc",0>>,<<"efg",0>>} = - erlang:decode_packet(line, <<"abc",0,"efg",0>>, [{line_delimiter, 0}]), - {more, undefined} = erlang:decode_packet(line, <<"abc",0,"efg",0>>, []). - % This testcase should probably be moved somewhere else wilderness(doc) -> ["Test that memory allocation command line options affecting the" diff -Nru erlang-18.2-dfsg/lib/kernel/test/ch.erl erlang-17.3-dfsg/lib/kernel/test/ch.erl --- erlang-18.2-dfsg/lib/kernel/test/ch.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/ch.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/ch_sup.erl erlang-17.3-dfsg/lib/kernel/test/ch_sup.erl --- erlang-18.2-dfsg/lib/kernel/test/ch_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/ch_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/cleanup.erl erlang-17.3-dfsg/lib/kernel/test/cleanup.erl --- erlang-18.2-dfsg/lib/kernel/test/cleanup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/cleanup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/code_a_test.erl erlang-17.3-dfsg/lib/kernel/test/code_a_test.erl --- erlang-18.2-dfsg/lib/kernel/test/code_a_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/code_a_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/code_b_test.erl erlang-17.3-dfsg/lib/kernel/test/code_b_test.erl --- erlang-18.2-dfsg/lib/kernel/test/code_b_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/code_b_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_app.erl erlang-17.3-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_app.erl --- erlang-18.2-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict.erl erlang-17.3-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict.erl --- erlang-18.2-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_sup.erl erlang-17.3-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_sup.erl --- erlang-18.2-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/code_SUITE_data/code_archive_dict-1.0/src/code_archive_dict_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-b/ebin/lists.erl erlang-17.3-dfsg/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-b/ebin/lists.erl --- erlang-18.2-dfsg/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-b/ebin/lists.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-b/ebin/lists.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-c/ebin/code_SUITE_mult_root_module.erl erlang-17.3-dfsg/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-c/ebin/code_SUITE_mult_root_module.erl --- erlang-18.2-dfsg/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-c/ebin/code_SUITE_mult_root_module.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/code_SUITE_data/mult_lib_roots/first_root/my_dummy_app-c/ebin/code_SUITE_mult_root_module.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/code_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/code_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/code_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/code_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -811,6 +810,14 @@ {unicode,characters_to_binary,3}, {filename,filename_string_to_binary,1}|_]) -> 0; check_funs({'$M_EXPR','$F_EXPR',_}, + [{code_server,load_native_code,4}, + {code_server,load_native_code_1,2}, + {code_server,load_native_code,2}, + {code_server,try_load_module,4}, + {code_server,do_load_binary,4}, + {code_server,handle_call,3}, + {code_server,loop,1}|_]) -> 0; +check_funs({'$M_EXPR','$F_EXPR',_}, [{code_server,do_mod_call,4}, {code_server,handle_call,3}|_]) -> 0; check_funs({'$M_EXPR','$F_EXPR',_}, @@ -859,14 +866,8 @@ check_funs({'$M_EXPR',module_info,1}, [{hipe_unified_loader,patch_to_emu_step1,1} | _]) -> 0; check_funs({'$M_EXPR','$F_EXPR',2}, - [{hipe_unified_loader,write_words,3} | _]) -> 0; -check_funs({'$M_EXPR','$F_EXPR',2}, - [{hipe_unified_loader,patch_label_or_labels,4} | _]) -> 0; -check_funs({'$M_EXPR','$F_EXPR',2}, - [{hipe_unified_loader,sort_and_write,5} | _]) -> 0; -check_funs({'$M_EXPR','$F_EXPR',2}, [{lists,foldl,3}, - {hipe_unified_loader,sort_and_write,5} | _]) -> 0; + {hipe_unified_loader,sort_and_write,4} | _]) -> 0; check_funs({'$M_EXPR','$F_EXPR',1}, [{lists,foreach,2}, {hipe_unified_loader,patch_consts,3} | _]) -> 0; @@ -1395,9 +1396,8 @@ {tuple,6,[{atom,6,Mod},{call,6,{atom,6,self},[]}]}}, {'receive',7,[{clause,8,[{atom,8,go}],[],[{atom,8,ok}]}]}]}]}, {function,11,ok,0,[{clause,11,[],[],[{atom,11,true}]}]}], - Forms1 = erl_parse:new_anno(Forms), - {ok,Mod,Bin} = compile:forms(Forms1, [report]), - [io:put_chars(erl_pp:form(F)) || F <- Forms1], + {ok,Mod,Bin} = compile:forms(Forms, [report]), + [io:put_chars(erl_pp:form(F)) || F <- Forms], {Pid1,Ref1} = spawn_monitor(fun() -> code:load_binary(Mod, File, Bin), @@ -1653,7 +1653,9 @@ init(Tester) -> {ok, Tester}. -handle_event({warning_msg, _GL, Msg}, Tester) -> +handle_event({error, _GL, {emulator, _, _}}, Tester) -> + {ok, Tester}; +handle_event({error, _GL, Msg}, Tester) -> Tester ! Msg, {ok, Tester}; handle_event(_Event, State) -> diff -Nru erlang-18.2-dfsg/lib/kernel/test/disk_log_SUITE_data/wrap_log_test.erl erlang-17.3-dfsg/lib/kernel/test/disk_log_SUITE_data/wrap_log_test.erl --- erlang-18.2-dfsg/lib/kernel/test/disk_log_SUITE_data/wrap_log_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/disk_log_SUITE_data/wrap_log_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/disk_log_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/disk_log_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/disk_log_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/disk_log_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/erl_boot_server_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/erl_boot_server_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/erl_boot_server_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/erl_boot_server_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/erl_distribution_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/erl_distribution_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/erl_distribution_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/erl_distribution_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,8 +26,7 @@ -export([tick/1, tick_change/1, illegal_nodenames/1, hidden_node/1, table_waste/1, net_setuptime/1, - inet_dist_options_options/1, - + monitor_nodes_nodedown_reason/1, monitor_nodes_complex_nodedown_reason/1, monitor_nodes_node_type/1, @@ -40,8 +38,7 @@ monitor_nodes_many/1]). %% Performs the test at another node. --export([get_socket_priorities/0, - tick_cli_test/1, tick_cli_test1/1, +-export([tick_cli_test/1, tick_cli_test1/1, tick_serv_test/2, tick_serv_test1/1, keep_conn/1, time_ping/1]). @@ -65,8 +62,7 @@ all() -> [tick, tick_change, illegal_nodenames, hidden_node, - table_waste, net_setuptime, inet_dist_options_options, - {group, monitor_nodes}]. + table_waste, net_setuptime, {group, monitor_nodes}]. groups() -> [{monitor_nodes, [], @@ -236,10 +232,11 @@ Res. time_ping(Node) -> - T0 = erlang:monotonic_time(), + T0 = erlang:now(), pang = net_adm:ping(Node), - T1 = erlang:monotonic_time(), - erlang:convert_time_unit(T1 - T0, native, milli_seconds). + T1 = erlang:now(), + time_diff(T0,T1). + %% Keep the connection with the client node up. %% This is neccessary as the client node runs with much shorter @@ -276,15 +273,13 @@ erlang:monitor_node(Node, true), sleep(2), rpc:call(Node, erlang, time, []), %% simulate action on the connection - T1 = erlang:monotonic_time(), + T1 = now(), receive {nodedown, Node} -> - T2 = erlang:monotonic_time(), + T2 = now(), receive {whats_the_result, From} -> - Diff = erlang:convert_time_unit(T2-T1, native, - milli_seconds), - case Diff of + case time_diff(T1, T2) of T when T > 8000, T < 16000 -> From ! {tick_test, T}; T -> @@ -559,71 +554,6 @@ end. - -inet_dist_options_options(suite) -> []; -inet_dist_options_options(doc) -> - ["Check the kernel inet_dist_{listen,connect}_options options"]; -inet_dist_options_options(Config) when is_list(Config) -> - Prio = 1, - case gen_udp:open(0, [{priority,Prio}]) of - {ok,Socket} -> - case inet:getopts(Socket, [priority]) of - {ok,[{priority,Prio}]} -> - ok = gen_udp:close(Socket), - do_inet_dist_options_options(Prio); - _ -> - ok = gen_udp:close(Socket), - {skip, - "Can not set priority "++integer_to_list(Prio)++ - " on socket"} - end; - {error,_} -> - {skip, "Can not set priority on socket"} - end. - -do_inet_dist_options_options(Prio) -> - PriorityString0 = "[{priority,"++integer_to_list(Prio)++"}]", - PriorityString = - case os:cmd("echo [{a,1}]") of - "[{a,1}]"++_ -> - PriorityString0; - _ -> - %% Some shells need quoting of [{}] - "'"++PriorityString0++"'" - end, - InetDistOptions = - "-hidden " - "-kernel inet_dist_connect_options "++PriorityString++" " - "-kernel inet_dist_listen_options "++PriorityString, - ?line {ok,Node1} = - start_node(inet_dist_options_1, InetDistOptions), - ?line {ok,Node2} = - start_node(inet_dist_options_2, InetDistOptions), - %% - ?line pong = - rpc:call(Node1, net_adm, ping, [Node2]), - ?line PrioritiesNode1 = - rpc:call(Node1, ?MODULE, get_socket_priorities, []), - ?line PrioritiesNode2 = - rpc:call(Node2, ?MODULE, get_socket_priorities, []), - ?line ?t:format("PrioritiesNode1 = ~p", [PrioritiesNode1]), - ?line ?t:format("PrioritiesNode2 = ~p", [PrioritiesNode2]), - ?line Elevated = [P || P <- PrioritiesNode1, P =:= Prio], - ?line Elevated = [P || P <- PrioritiesNode2, P =:= Prio], - ?line [_|_] = Elevated, - %% - ?line stop_node(Node2), - ?line stop_node(Node1), - ok. - -get_socket_priorities() -> - [Priority || - {ok,[{priority,Priority}]} <- - [inet:getopts(Port, [priority]) || - Port <- erlang:ports(), - element(2, erlang:port_info(Port, name)) =:= "tcp_inet"]]. - - %% %% Testcase: @@ -1210,6 +1140,19 @@ ?line ?t:format("Messages: ~p~n", [Messages]), ?line ok. +%% Time difference in milliseconds !! +time_diff({TimeM, TimeS, TimeU}, {CurM, CurS, CurU}) when CurM > TimeM -> + ((CurM - TimeM) * 1000000000) + sec_diff({TimeS, TimeU}, {CurS, CurU}); +time_diff({_, TimeS, TimeU}, {_, CurS, CurU}) -> + sec_diff({TimeS, TimeU}, {CurS, CurU}). + +sec_diff({TimeS, TimeU}, {CurS, CurU}) when CurS > TimeS -> + ((CurS - TimeS) * 1000) + micro_diff(TimeU, CurU); +sec_diff({_, TimeU}, {_, CurU}) -> + micro_diff(TimeU, CurU). + +micro_diff(TimeU, CurU) -> + trunc(CurU/1000) - trunc(TimeU/1000). sleep(T) -> receive after T * 1000 -> ok end. @@ -1256,12 +1199,16 @@ get_nodenames(0, _, Acc) -> Acc; get_nodenames(N, T, Acc) -> - U = erlang:unique_integer([positive]), + {A, B, C} = now(), get_nodenames(N-1, T, [list_to_atom(atom_to_list(T) ++ "-" - ++ ?MODULE_STRING + ++ atom_to_list(?MODULE) ++ "-" - ++ integer_to_list(U)) | Acc]). + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) + ++ "-" + ++ integer_to_list(C)) | Acc]). get_numbered_nodenames(N, T) -> get_numbered_nodenames(N, T, []). @@ -1269,12 +1216,16 @@ get_numbered_nodenames(0, _, Acc) -> Acc; get_numbered_nodenames(N, T, Acc) -> - U = erlang:unique_integer([positive]), + {A, B, C} = now(), NL = [list_to_atom(atom_to_list(T) ++ integer_to_list(N) ++ "-" - ++ ?MODULE_STRING + ++ atom_to_list(?MODULE) + ++ "-" + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) ++ "-" - ++ integer_to_list(U)) | Acc], + ++ integer_to_list(C)) | Acc], get_numbered_nodenames(N-1, T, NL). wait_until(Fun) -> diff -Nru erlang-18.2-dfsg/lib/kernel/test/erl_distribution_wb_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/erl_distribution_wb_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/erl_distribution_wb_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/erl_distribution_wb_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -452,8 +451,11 @@ %% MD5 hashing %% +%% This is no proper random number, but that is not really important in +%% this test gen_challenge() -> - rand:uniform(1000000). + {_,_,N} = erlang:now(), + N. %% Generate a message digest from Challenge number and Cookie gen_digest(Challenge, Cookie) when is_integer(Challenge), is_atom(Cookie) -> @@ -710,9 +712,13 @@ get_nodenames(0, _, Acc) -> Acc; get_nodenames(N, T, Acc) -> - U = erlang:unique_integer([positive]), - get_nodenames(N-1, T, [list_to_atom(?MODULE_STRING + {A, B, C} = now(), + get_nodenames(N-1, T, [list_to_atom(atom_to_list(?MODULE) ++ "-" ++ atom_to_list(T) ++ "-" - ++ integer_to_list(U)) | Acc]). + ++ integer_to_list(A) + ++ "-" + ++ integer_to_list(B) + ++ "-" + ++ integer_to_list(C)) | Acc]). diff -Nru erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict_app.erl erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict_app.erl --- erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict.erl erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict.erl --- erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict_sup.erl erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict_sup.erl --- erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dict-1.0/src/primary_archive_dict_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy_app.erl erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy_app.erl --- erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy.erl erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy.erl --- erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy_sup.erl erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy_sup.erl --- erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE_data/primary_archive/primary_archive_dummy/src/primary_archive_dummy_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/erl_prim_loader_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/erl_prim_loader_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/error_handler_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/error_handler_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/error_handler_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/error_handler_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/error_logger_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/error_logger_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/error_logger_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/error_logger_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,7 +32,7 @@ error_report/1, info_report/1, error/1, info/1, emulator/1, tty/1, logfile/1, add/1, delete/1]). --export([generate_error/2]). +-export([generate_error/0]). -export([init/1, handle_event/2, handle_call/2, handle_info/2, @@ -211,16 +210,13 @@ emulator(doc) -> []; emulator(Config) when is_list(Config) -> ?line error_logger:add_report_handler(?MODULE, self()), - Msg = "Error in process ~p on node ~p with exit value:~n~p~n", - Error = {badmatch,4}, - Stack = [{module, function, 2, []}], - Pid = spawn(?MODULE, generate_error, [Error, Stack]), - reported(error, Msg, [Pid, node(), {Error, Stack}]), + spawn(?MODULE, generate_error, []), + reported(emulator), ?line my_yes = error_logger:delete_report_handler(?MODULE), ok. -generate_error(Error, Stack) -> - erlang:raise(error, Error, Stack). +generate_error() -> + erlang:error({badmatch,4}). %%----------------------------------------------------------------- %% We don't enables or disables tty error logging here. We do not @@ -284,6 +280,15 @@ test_server:messages_get(), ok after 1000 -> + test_server:fail(no_report_received) + end. + +reported(emulator) -> + receive + {error, "~s~n", String} when is_list(String) -> + test_server:messages_get(), + ok + after 1000 -> test_server:fail(no_report_received) end. diff -Nru erlang-18.2-dfsg/lib/kernel/test/error_logger_warn_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/error_logger_warn_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/error_logger_warn_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/error_logger_warn_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -22,8 +21,8 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2,end_per_testcase/2, - basic/1,warnings_info/1,warnings_errors/1, - rb_basic/1,rb_warnings_info/1,rb_warnings_errors/1, + basic/1,warnings_info/1,warnings_warnings/1, + rb_basic/1,rb_warnings_info/1,rb_warnings_warnings/1, rb_trunc/1,rb_utc/1,file_utc/1]). %% Internal exports. @@ -49,8 +48,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [basic, warnings_info, warnings_errors, rb_basic, - rb_warnings_info, rb_warnings_errors, rb_trunc, + [basic, warnings_info, warnings_warnings, rb_basic, + rb_warnings_info, rb_warnings_warnings, rb_trunc, rb_utc, file_utc]. groups() -> @@ -70,7 +69,7 @@ init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), + ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), @@ -89,11 +88,11 @@ put(elw_config,Config), warnings_info(). -warnings_errors(doc) -> - ["Tests mapping warnings to errors functionality"]; -warnings_errors(Config) when is_list(Config) -> +warnings_warnings(doc) -> + ["Tests mapping warnings to warnings functionality"]; +warnings_warnings(Config) when is_list(Config) -> put(elw_config,Config), - warnings_errors(). + warnings_warnings(). rb_basic(doc) -> ["Tests basic rb functionality"]; @@ -107,11 +106,11 @@ put(elw_config,Config), rb_warnings_info(). -rb_warnings_errors(doc) -> - ["Tests warnings as errors rb functionality"]; -rb_warnings_errors(Config) when is_list(Config) -> +rb_warnings_warnings(doc) -> + ["Tests warnings as warnings rb functionality"]; +rb_warnings_warnings(Config) when is_list(Config) -> put(elw_config,Config), - rb_warnings_errors(). + rb_warnings_warnings(). rb_trunc(doc) -> ["Tests rb functionality on truncated data"]; @@ -160,9 +159,6 @@ rpc:call(Node,error_logger,add_report_handler,[?MODULE,[self()]]). -warning_map(Node) -> - rpc:call(Node,error_logger,warning_map,[]). - format(Node,A,B) -> rpc:call(Node,error_logger,format,[A,B]). error_msg(Node,A,B) -> @@ -185,81 +181,80 @@ basic() -> - Node = start_node(nn(),[]), - ok = install_relay(Node), - Self = self(), - GL = group_leader(), - warning = warning_map(Node), - format(Node,"~p~n",[Self]), - ?EXPECT({handle_event,{error,GL,{_,"~p~n",[Self]}}}), - error_msg(Node,"~p~n",[Self]), - ?EXPECT({handle_event,{error,GL,{_,"~p~n",[Self]}}}), - warning_msg(Node,"~p~n",[Self]), - ?EXPECT({handle_event,{warning_msg,GL,{_,"~p~n",[Self]}}}), - info_msg(Node,"~p~n",[Self]), - ?EXPECT({handle_event,{info_msg,GL,{_,"~p~n",[Self]}}}), - Report = [{self,Self},{gl,GL},make_ref()], - error_report(Node,Report), - ?EXPECT({handle_event,{error_report,GL,{_,std_error,Report}}}), - warning_report(Node,Report), - ?EXPECT({handle_event,{warning_report,GL,{_,std_warning,Report}}}), - info_report(Node,Report), - ?EXPECT({handle_event,{info_report,GL,{_,std_info,Report}}}), - stop_node(Node), + ?line Node = start_node(nn(),[]), + ?line ok = install_relay(Node), + ?line Self = self(), + ?line GL = group_leader(), + ?line format(Node,"~p~n",[Self]), + ?line ?EXPECT({handle_event,{error,GL,{_,"~p~n",[Self]}}}), + ?line error_msg(Node,"~p~n",[Self]), + ?line ?EXPECT({handle_event,{error,GL,{_,"~p~n",[Self]}}}), + ?line warning_msg(Node,"~p~n",[Self]), + ?line ?EXPECT({handle_event,{error,GL,{_,"~p~n",[Self]}}}), + ?line info_msg(Node,"~p~n",[Self]), + ?line ?EXPECT({handle_event,{info_msg,GL,{_,"~p~n",[Self]}}}), + ?line Report = [{self,Self},{gl,GL},make_ref()], + ?line error_report(Node,Report), + ?line ?EXPECT({handle_event,{error_report,GL,{_,std_error,Report}}}), + ?line warning_report(Node,Report), + ?line ?EXPECT({handle_event,{error_report,GL,{_,std_error,Report}}}), + ?line info_report(Node,Report), + ?line ?EXPECT({handle_event,{info_report,GL,{_,std_info,Report}}}), + + ?line stop_node(Node), ok. warnings_info() -> - Node = start_node(nn(),"+Wi"), - ok = install_relay(Node), - Self = self(), - GL = group_leader(), - info = warning_map(Node), - Report = [{self,Self},{gl,GL},make_ref()], - warning_msg(Node,"~p~n",[Self]), - ?EXPECT({handle_event,{info_msg,GL,{_,"~p~n",[Self]}}}), - warning_report(Node,Report), - ?EXPECT({handle_event,{info_report,GL,{_,std_info,Report}}}), - stop_node(Node), - ok. - -warnings_errors() -> - Node = start_node(nn(),"+We"), - ok = install_relay(Node), - Self = self(), - GL = group_leader(), - error = warning_map(Node), - Report = [{self,Self},{gl,GL},make_ref()], - warning_msg(Node,"~p~n",[Self]), - ?EXPECT({handle_event,{error,GL,{_,"~p~n",[Self]}}}), - warning_report(Node,Report), - ?EXPECT({handle_event,{error_report,GL,{_,std_error,Report}}}), - stop_node(Node), + ?line Node = start_node(nn(),"+Wi"), + ?line ok = install_relay(Node), + ?line Self = self(), + ?line GL = group_leader(), + ?line Report = [{self,Self},{gl,GL},make_ref()], + ?line warning_msg(Node,"~p~n",[Self]), + ?line ?EXPECT({handle_event,{info_msg,GL,{_,"~p~n",[Self]}}}), + ?line warning_report(Node,Report), + ?line ?EXPECT({handle_event,{info_report,GL,{_,std_info,Report}}}), + ?line stop_node(Node), + ok. + +warnings_warnings() -> + ?line Node = start_node(nn(),"+Ww"), + ?line ok = install_relay(Node), + ?line Self = self(), + ?line GL = group_leader(), + ?line Report = [{self,Self},{gl,GL},make_ref()], + ?line warning_msg(Node,"~p~n",[Self]), + ?line ?EXPECT({handle_event,{warning_msg,GL,{_,"~p~n",[Self]}}}), + ?line warning_report(Node,Report), + ?line ?EXPECT({handle_event,{warning_report,GL,{_,std_warning,Report}}}), + ?line stop_node(Node), ok. - + + % RB... quote(String) -> case os:type() of - {win32,_} -> - "\\\""++String++"\\\""; - _ -> - "'\""++String++"\"'" + {win32,_} -> + "\\\""++String++"\\\""; + _ -> + "'\""++String++"\"'" end. iquote(String) -> case os:type() of - {win32,_} -> - "\\\""++String++"\\\""; - _ -> - "\""++String++"\"" + {win32,_} -> + "\\\""++String++"\\\""; + _ -> + "\""++String++"\"" end. oquote(String) -> case os:type() of - {win32,_} -> - "\""++String++"\""; - _ -> - "'"++String++"'" + {win32,_} -> + "\""++String++"\""; + _ -> + "'"++String++"'" end. @@ -269,18 +264,18 @@ findstrc(String,File) -> case string:str(File,String) of - N when is_integer(N), - N > 0 -> - S2 = lists:sublist(File,N,length(File)), - case string:str(S2,"\n") of - 0 -> - 1; - M -> - S3 = lists:sublist(S2,M,length(S2)), - 1 + findstrc(String,S3) - end; - _ -> - 0 + N when is_integer(N), + N > 0 -> + S2 = lists:sublist(File,N,length(File)), + case string:str(S2,"\n") of + 0 -> + 1; + M -> + S3 = lists:sublist(S2,M,length(S2)), + 1 + findstrc(String,S3) + end; + _ -> + 0 end. % Doesn't count empty lines @@ -354,182 +349,175 @@ % Tests rb_basic() -> - clean_rd(), + ?line clean_rd(), % Behold, the magic parameters to activate rb logging... - Node = start_node(nn(),"-boot start_sasl -sasl error_logger_mf_dir "++ - quote(rd())++" error_logger_mf_maxbytes 5000 " - "error_logger_mf_maxfiles 5"), - Self = self(), - GL = group_leader(), - warning = warning_map(Node), - Report = [{self,Self},{gl,GL},make_ref()], - fake_gl(Node,warning_msg,"~p~n",[Self]), - fake_gl(Node,warning_report,Report), - nice_stop_node(Node), - application:start(sasl), - rb:start([{report_dir, rd()}]), - rb:list(), - true = (one_rb_lines([error]) =:= 0), - true = (one_rb_lines([error_report]) =:= 0), - 0 = one_rb_findstr([error],pid_to_list(Self)), - 0 = one_rb_findstr([error_report],pid_to_list(Self)), - 1 = one_rb_findstr([warning_msg],pid_to_list(Self)), - 1 = one_rb_findstr([warning_report],pid_to_list(Self)), - 0 = one_rb_findstr([info_msg],pid_to_list(Self)), - 0 = one_rb_findstr([info_report],pid_to_list(Self)), - 2 = one_rb_findstr([],pid_to_list(Self)), - true = (one_rb_findstr([progress],"===") > 4), - rb:stop(), - application:stop(sasl), - stop_node(Node), + ?line Node = start_node(nn(),"-boot start_sasl -sasl error_logger_mf_dir "++ + quote(rd())++" error_logger_mf_maxbytes 5000 " + "error_logger_mf_maxfiles 5"), + ?line Self = self(), + ?line GL = group_leader(), + ?line Report = [{self,Self},{gl,GL},make_ref()], + ?line fake_gl(Node,warning_msg,"~p~n",[Self]), + ?line fake_gl(Node,warning_report,Report), + ?line nice_stop_node(Node), + ?line application:start(sasl), + ?line rb:start([{report_dir, rd()}]), + ?line rb:list(), + ?line true = (one_rb_lines([error]) > 1), + ?line true = (one_rb_lines([error_report]) > 1), + ?line 1 = one_rb_findstr([error],pid_to_list(Self)), + ?line 1 = one_rb_findstr([error_report],pid_to_list(Self)), + ?line 2 = one_rb_findstr([],pid_to_list(Self)), + ?line true = (one_rb_findstr([progress],"===") > 4), + ?line rb:stop(), + ?line application:stop(sasl), + ?line stop_node(Node), ok. rb_warnings_info() -> - clean_rd(), - Node = start_node(nn(),"+W i -boot start_sasl -sasl error_logger_mf_dir "++ - quote(rd())++" error_logger_mf_maxbytes 5000 " - "error_logger_mf_maxfiles 5"), - Self = self(), - GL = group_leader(), - info = warning_map(Node), - Report = [{self,Self},{gl,GL},make_ref()], - fake_gl(Node,warning_msg,"~p~n",[Self]), - fake_gl(Node,warning_report,Report), - nice_stop_node(Node), - application:start(sasl), - rb:start([{report_dir, rd()}]), - rb:list(), - true = (one_rb_lines([error]) =:= 0), - true = (one_rb_lines([error_report]) =:= 0), - 0 = one_rb_findstr([error],pid_to_list(Self)), - 0 = one_rb_findstr([error_report],pid_to_list(Self)), - 0 = one_rb_findstr([warning_msg],pid_to_list(Self)), - 0 = one_rb_findstr([warning_report],pid_to_list(Self)), - 1 = one_rb_findstr([info_msg],pid_to_list(Self)), - 1 = one_rb_findstr([info_report],pid_to_list(Self)), - 2 = one_rb_findstr([],pid_to_list(Self)), - true = (one_rb_findstr([progress],"===") > 4), - rb:stop(), - application:stop(sasl), - stop_node(Node), - ok. - -rb_warnings_errors() -> - clean_rd(), - Node = start_node(nn(),"+W e -boot start_sasl -sasl error_logger_mf_dir "++ - quote(rd())++" error_logger_mf_maxbytes 5000 " - "error_logger_mf_maxfiles 5"), - Self = self(), - GL = group_leader(), - error = warning_map(Node), - Report = [{self,Self},{gl,GL},make_ref()], - fake_gl(Node,warning_msg,"~p~n",[Self]), - fake_gl(Node,warning_report,Report), - nice_stop_node(Node), - application:start(sasl), - rb:start([{report_dir, rd()}]), - rb:list(), - true = (one_rb_lines([error]) > 1), - true = (one_rb_lines([error_report]) > 1), - 1 = one_rb_findstr([error],pid_to_list(Self)), - 1 = one_rb_findstr([error_report],pid_to_list(Self)), - 0 = one_rb_findstr([warning_msg],pid_to_list(Self)), - 0 = one_rb_findstr([warning_report],pid_to_list(Self)), - 0 = one_rb_findstr([info_msg],pid_to_list(Self)), - 0 = one_rb_findstr([info_report],pid_to_list(Self)), - 2 = one_rb_findstr([],pid_to_list(Self)), - true = (one_rb_findstr([progress],"===") > 4), - rb:stop(), - application:stop(sasl), - stop_node(Node), + ?line clean_rd(), + ?line Node = start_node(nn(),"+W i -boot start_sasl -sasl error_logger_mf_dir "++ + quote(rd())++" error_logger_mf_maxbytes 5000 " + "error_logger_mf_maxfiles 5"), + ?line Self = self(), + ?line GL = group_leader(), + ?line Report = [{self,Self},{gl,GL},make_ref()], + ?line fake_gl(Node,warning_msg,"~p~n",[Self]), + ?line fake_gl(Node,warning_report,Report), + ?line nice_stop_node(Node), + ?line application:start(sasl), + ?line rb:start([{report_dir, rd()}]), + ?line rb:list(), + ?line true = (one_rb_lines([error]) =:= 0), + ?line true = (one_rb_lines([error_report]) =:= 0), + ?line 0 = one_rb_findstr([error],pid_to_list(Self)), + ?line 0 = one_rb_findstr([error_report],pid_to_list(Self)), + ?line 0 = one_rb_findstr([warning_msg],pid_to_list(Self)), + ?line 0 = one_rb_findstr([warning_report],pid_to_list(Self)), + ?line 1 = one_rb_findstr([info_msg],pid_to_list(Self)), + ?line 1 = one_rb_findstr([info_report],pid_to_list(Self)), + ?line 2 = one_rb_findstr([],pid_to_list(Self)), + ?line true = (one_rb_findstr([progress],"===") > 4), + ?line rb:stop(), + ?line application:stop(sasl), + ?line stop_node(Node), + ok. + +rb_warnings_warnings() -> + ?line clean_rd(), + ?line Node = start_node(nn(),"+W w -boot start_sasl -sasl error_logger_mf_dir "++ + quote(rd())++" error_logger_mf_maxbytes 5000 " + "error_logger_mf_maxfiles 5"), + ?line Self = self(), + ?line GL = group_leader(), + ?line Report = [{self,Self},{gl,GL},make_ref()], + ?line fake_gl(Node,warning_msg,"~p~n",[Self]), + ?line fake_gl(Node,warning_report,Report), + ?line nice_stop_node(Node), + ?line application:start(sasl), + ?line rb:start([{report_dir, rd()}]), + ?line rb:list(), + ?line true = (one_rb_lines([error]) =:= 0), + ?line true = (one_rb_lines([error_report]) =:= 0), + ?line 0 = one_rb_findstr([error],pid_to_list(Self)), + ?line 0 = one_rb_findstr([error_report],pid_to_list(Self)), + ?line 1 = one_rb_findstr([warning_msg],pid_to_list(Self)), + ?line 1 = one_rb_findstr([warning_report],pid_to_list(Self)), + ?line 0 = one_rb_findstr([info_msg],pid_to_list(Self)), + ?line 0 = one_rb_findstr([info_report],pid_to_list(Self)), + ?line 2 = one_rb_findstr([],pid_to_list(Self)), + ?line true = (one_rb_findstr([progress],"===") > 4), + ?line rb:stop(), + ?line application:stop(sasl), + ?line stop_node(Node), ok. rb_trunc() -> - clean_rd(), - Node = start_node(nn(),"-boot start_sasl -sasl error_logger_mf_dir "++ - quote(rd())++" error_logger_mf_maxbytes 5000 " - "error_logger_mf_maxfiles 5"), - Self = self(), - GL = group_leader(), - Report = [{self,Self},{gl,GL},make_ref()], - fake_gl(Node,warning_msg,"~p~n",[Self]), - fake_gl(Node,warning_report,Report), - nice_stop_node(Node), - application:start(sasl), - {ok,File} = file:read_file(rf()), - S=byte_size(File)-2, - <>=File, - file:write_file(rf(),TFile), - rb:start([{report_dir, rd()}]), - rb:list(), - true = (one_rb_lines([error]) =:= 0), - true = (one_rb_lines([error_report]) =:= 0), - 0 = one_rb_findstr([error],pid_to_list(Self)), - 0 = one_rb_findstr([error_report],pid_to_list(Self)), - 1 = one_rb_findstr([warning_msg],pid_to_list(Self)), - 0 = one_rb_findstr([warning_report],pid_to_list(Self)), - 0 = one_rb_findstr([info_msg],pid_to_list(Self)), - 0 = one_rb_findstr([info_report],pid_to_list(Self)), - 1 = one_rb_findstr([],pid_to_list(Self)), - true = (one_rb_findstr([progress],"===") > 4), - rb:stop(), - application:stop(sasl), - stop_node(Node), + ?line clean_rd(), + ?line Node = start_node(nn(),"+W w -boot start_sasl -sasl error_logger_mf_dir "++ + quote(rd())++" error_logger_mf_maxbytes 5000 " + "error_logger_mf_maxfiles 5"), + ?line Self = self(), + ?line GL = group_leader(), + ?line Report = [{self,Self},{gl,GL},make_ref()], + ?line fake_gl(Node,warning_msg,"~p~n",[Self]), + ?line fake_gl(Node,warning_report,Report), + ?line nice_stop_node(Node), + ?line application:start(sasl), + ?line {ok,File} = file:read_file(rf()), + ?line S=byte_size(File)-2, + ?line <>=File, + ?line file:write_file(rf(),TFile), + ?line rb:start([{report_dir, rd()}]), + ?line rb:list(), + ?line true = (one_rb_lines([error]) =:= 0), + ?line true = (one_rb_lines([error_report]) =:= 0), + ?line 0 = one_rb_findstr([error],pid_to_list(Self)), + ?line 0 = one_rb_findstr([error_report],pid_to_list(Self)), + ?line 1 = one_rb_findstr([warning_msg],pid_to_list(Self)), + ?line 0 = one_rb_findstr([warning_report],pid_to_list(Self)), + ?line 0 = one_rb_findstr([info_msg],pid_to_list(Self)), + ?line 0 = one_rb_findstr([info_report],pid_to_list(Self)), + ?line 1 = one_rb_findstr([],pid_to_list(Self)), + ?line true = (one_rb_findstr([progress],"===") > 4), + ?line rb:stop(), + ?line application:stop(sasl), + ?line stop_node(Node), ok. rb_utc() -> - clean_rd(), - Node = start_node(nn(),"-boot start_sasl -sasl error_logger_mf_dir "++ - quote(rd())++" error_logger_mf_maxbytes 5000 " - "error_logger_mf_maxfiles 5 -sasl utc_log true"), - Self = self(), - GL = group_leader(), - Report = [{self,Self},{gl,GL},make_ref()], - fake_gl(Node,warning_msg,"~p~n",[Self]), - fake_gl(Node,warning_report,Report), - nice_stop_node(Node), - application:stop(sasl), - UtcLog=case application:get_env(sasl,utc_log) of - {ok,true} -> - true; - _AllOthers -> - application:set_env(sasl,utc_log,true), - false - end, - application:start(sasl), - rb:start([{report_dir, rd()}]), - rb:list(), - Pr=one_rb_findstr([progress],"==="), - Wm=one_rb_findstr([warning_msg],"==="), - Wr=one_rb_findstr([warning_report],"==="), - Sum=Pr+Wm+Wr, - Sum=one_rb_findstr([],"UTC"), - rb:stop(), - application:stop(sasl), - application:set_env(sasl,utc_log,UtcLog), - stop_node(Node), + ?line clean_rd(), + ?line Node = start_node(nn(),"+W w -boot start_sasl -sasl error_logger_mf_dir "++ + quote(rd())++" error_logger_mf_maxbytes 5000 " + "error_logger_mf_maxfiles 5 -sasl utc_log true"), + ?line Self = self(), + ?line GL = group_leader(), + ?line Report = [{self,Self},{gl,GL},make_ref()], + ?line fake_gl(Node,warning_msg,"~p~n",[Self]), + ?line fake_gl(Node,warning_report,Report), + ?line nice_stop_node(Node), + ?line application:stop(sasl), + ?line UtcLog=case application:get_env(sasl,utc_log) of + {ok,true} -> + true; + _AllOthers -> + application:set_env(sasl,utc_log,true), + false + end, + ?line application:start(sasl), + ?line rb:start([{report_dir, rd()}]), + ?line rb:list(), + ?line Pr=one_rb_findstr([progress],"==="), + ?line Wm=one_rb_findstr([warning_msg],"==="), + ?line Wr=one_rb_findstr([warning_report],"==="), + ?line Sum=Pr+Wm+Wr, + ?line Sum=one_rb_findstr([],"UTC"), + ?line rb:stop(), + ?line application:stop(sasl), + ?line application:set_env(sasl,utc_log,UtcLog), + ?line stop_node(Node), ok. file_utc() -> - file:delete(lf()), - SS="-stdlib utc_log true -kernel error_logger "++ oquote("{file,"++iquote(lf())++"}"), + ?line file:delete(lf()), + ?line SS="+W w -stdlib utc_log true -kernel error_logger "++ oquote("{file,"++iquote(lf())++"}"), %erlang:display(SS), - Node = start_node(nn(),SS), + ?line Node = start_node(nn(),SS), %erlang:display(rpc:call(Node,application,get_env,[kernel,error_logger])), - Self = self(), - GL = group_leader(), - fake_gl(Node,error_msg,"~p~n",[Self]), - fake_gl(Node,warning_msg,"~p~n",[Self]), - fake_gl(Node,info_msg,"~p~n",[Self]), - Report = [{self,Self},{gl,GL},make_ref()], - fake_gl(Node,error_report,Report), - fake_gl(Node,warning_report,Report), - fake_gl(Node,info_report,Report), - nice_stop_node(Node), - receive after 5000 -> ok end, % Let the node die, needed - 6 = findstr("UTC",lf()), - 2 = findstr("WARNING",lf()), - 2 = findstr("ERROR",lf()), - 2 = findstr("INFO",lf()), - stop_node(Node), + ?line Self = self(), + ?line GL = group_leader(), + ?line fake_gl(Node,error_msg,"~p~n",[Self]), + ?line fake_gl(Node,warning_msg,"~p~n",[Self]), + ?line fake_gl(Node,info_msg,"~p~n",[Self]), + ?line Report = [{self,Self},{gl,GL},make_ref()], + ?line fake_gl(Node,error_report,Report), + ?line fake_gl(Node,warning_report,Report), + ?line fake_gl(Node,info_report,Report), + ?line nice_stop_node(Node), + ?line receive after 5000 -> ok end, % Let the node die, needed + ?line 6 = findstr("UTC",lf()), + ?line 2 = findstr("WARNING",lf()), + ?line 2 = findstr("ERROR",lf()), + ?line 2 = findstr("INFO",lf()), + ?line stop_node(Node), ok. diff -Nru erlang-18.2-dfsg/lib/kernel/test/file_name_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/file_name_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/file_name_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/file_name_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/file_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/file_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/file_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/file_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -48,7 +47,7 @@ -export([cur_dir_0/1, cur_dir_1/1, make_del_dir/1, list_dir/1,list_dir_error/1, untranslatable_names/1, untranslatable_names_error/1, - pos1/1, pos2/1, pos3/1]). + pos1/1, pos2/1]). -export([close/1, consult1/1, path_consult/1, delete/1]). -export([ eval1/1, path_eval/1, script1/1, path_script/1, open1/1, @@ -80,7 +79,6 @@ -export([interleaved_read_write/1]). --export([unicode/1]). -export([altname/1]). -export([large_file/1, large_write/1]). @@ -95,8 +93,6 @@ -export([old_io_protocol/1]). --export([unicode_mode/1]). - %% Debug exports -export([create_file_slow/2, create_file/2, create_bin/2]). -export([verify_file/2, verify_bin/3]). @@ -109,21 +105,18 @@ -include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). --define(THROW_ERROR(RES), throw({fail, ?LINE, RES})). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [unicode, altname, read_write_file, {group, dirs}, + [altname, read_write_file, {group, dirs}, {group, files}, delete, rename, names, {group, errors}, {group, compression}, {group, links}, copy, delayed_write, read_ahead, segment_read, segment_write, ipread, pid2name, interleaved_read_write, otp_5814, otp_10852, large_file, large_write, read_line_1, read_line_2, read_line_3, - read_line_4, standard_io, old_io_protocol, - unicode_mode - ]. + read_line_4, standard_io, old_io_protocol]. groups() -> [{dirs, [], [make_del_dir, cur_dir_0, cur_dir_1, @@ -137,7 +130,7 @@ [open1, old_modes, new_modes, path_open, close, access, read_write, pread_write, append, open_errors, exclusive]}, - {pos, [], [pos1, pos2, pos3]}, + {pos, [], [pos1, pos2]}, {file_info, [], [file_info_basic_file, file_info_basic_directory, file_info_bad, file_info_times, file_write_file_info]}, @@ -354,152 +347,7 @@ [] = flush(), ok. -unicode_mode(suite) -> []; -unicode_mode(doc) -> [""]; -unicode_mode(Config) -> - Dir = {dir, ?config(priv_dir,Config)}, - OptVariants = [[Dir], - [Dir, {encoding, utf8}], - [Dir, binary], - [Dir, binary, {encoding, utf8}] - ], - ReadVariants = [{read, fun(Fd) -> um_read(Fd, fun(Fd1) -> file:read(Fd1, 1024) end) end}, - {read_line, fun(Fd) -> um_read(Fd, fun(Fd1) -> file:read_line(Fd1) end) end} - %%{pread, fun(Fd) -> file:pread(Fd, 0, 1024) end}, - %%{preadl, fun(Fd) -> file:pread(Fd, [{0, 1024}]) end}, - ], - - _ = [read_write_0("ASCII: list: Hello World", Read, Opt) || - Opt <- OptVariants, Read <- ReadVariants], - _ = [read_write_0("LATIN1: list: åäöÅÄÖ", Read, Opt) || - Opt <- OptVariants, Read <- ReadVariants], - _ = [read_write_0(<<"ASCII: bin: Hello World">>, Read, Opt) || - Opt <- OptVariants, Read <- ReadVariants], - _ = [read_write_0(<<"LATIN1: bin: åäöÅÄÖ">>, Read, Opt) || - Opt <- OptVariants, Read <- ReadVariants], - %% These will be double encoded if option is encoding utf-8 - _ = [read_write_0(<<"UTF8: bin: Ωß"/utf8>>, Read, Opt) || - Opt <- OptVariants, Read <- ReadVariants], - %% These should not work (with encoding set to utf-8) - %% according to file's documentation - _ = [read_write_0("UTF8: list: Ωß", Read, Opt) || - Opt <- OptVariants, Read <- ReadVariants], - ok. - -read_write_0(Str, {Func, ReadFun}, Options) -> - try - Res = read_write_1(Str, ReadFun, Options), - io:format("~p: ~ts ~p '~p'~n", [Func, Str, tl(Options), Res]), - ok - catch {fail, Line, ReadBytes = [_|_]} -> - io:format("~p:~p: ~p ERROR: ~w vs~n ~w~n - ~p~n", - [?MODULE, Line, Func, Str, ReadBytes, Options]), - exit({error, ?LINE}); - {fail, Line, ReadBytes} -> - io:format("~p:~p: ~p ERROR: ~ts vs~n ~w~n - ~p~n", - [?MODULE, Line, Func, Str, ReadBytes, Options]), - exit({error, ?LINE}); - error:What -> - io:format("~p:??: ~p ERROR: ~p from~n ~w~n ~p~n", - [?MODULE, Func, What, Str, Options]), - - io:format("\t~p~n", [erlang:get_stacktrace()]), - exit({error, ?LINE}) - end. - -read_write_1(Str0, ReadFun, [{dir,Dir}|Options]) -> - File = um_filename(Str0, Dir, Options), - Pre = "line 1\n", Post = "\nlast line\n", - Str = case is_list(Str0) andalso lists:max(Str0) > 255 of - false -> %% Normal case Use options - {ok, FdW} = file:open(File, [write|Options]), - IO = [Pre, Str0, Post], - ok = file:write(FdW, IO), - case is_binary(Str0) of - true -> iolist_to_binary(IO); - false -> lists:append(IO) - end; - true -> %% Test unicode lists - {ok, FdW} = file:open(File, [write]), - Utf8 = unicode:characters_to_binary([Pre, Str0, Post]), - file:write(FdW, Utf8), - {unicode, Utf8} - end, - file:close(FdW), - {ok, FdR} = file:open(File, [read|Options]), - ReadRes = ReadFun(FdR), - file:close(FdR), - Res = um_check(Str, ReadRes, Options), - file:delete(File), - Res. - - -um_read(Fd, Fun) -> - um_read(Fd, Fun, []). - -um_read(Fd, Fun, Acc) -> - case Fun(Fd) of - eof -> - case is_binary(hd(Acc)) of - true -> {ok, iolist_to_binary(lists:reverse(Acc))}; - false -> {ok, lists:append(lists:reverse(Acc))} - end; - {ok, Data} -> - um_read(Fd, Fun, [Data|Acc]); - Error -> - Error - end. - -um_check(Str, {ok, Str}, _) -> ok; -um_check(Bin, {ok, Res}, _Options) when is_binary(Bin), is_list(Res) -> - case list_to_binary(Res) of - Bin -> ok; - _ -> ?THROW_ERROR(Res) - end; -um_check(Str, {ok, Res}, _Options) when is_list(Str), is_binary(Res) -> - case iolist_to_binary(Str) of - Res -> ok; - _ -> ?THROW_ERROR(Res) - end; -um_check({unicode, Utf8Bin}, Res, Options) -> - um_check_unicode(Utf8Bin, Res, - proplists:get_value(binary, Options, false), - proplists:get_value(encoding, Options, none)); -um_check(_Str, Res, _Options) -> - ?THROW_ERROR(Res). - -um_check_unicode(Utf8Bin, {ok, Utf8Bin}, true, none) -> - ok; -um_check_unicode(Utf8Bin, {ok, List = [_|_]}, false, none) -> - case binary_to_list(Utf8Bin) == List of - true -> ok; - false -> ?THROW_ERROR(List) - end; -um_check_unicode(_Utf8Bin, {error, {no_translation, unicode, latin1}}, _, _) -> - no_translation; -um_check_unicode(_Utf8Bin, Error = {error, _}, _, _Unicode) -> - ?THROW_ERROR(Error); -um_check_unicode(_Utf8Bin, {ok, _ListOrBin}, _, _UTF8_) -> - %% List = if is_binary(ListOrBin) -> unicode:characters_to_list(ListOrBin); - %% true -> ListOrBin - %% end, - %% io:format("In: ~w~n", [binary_to_list(Utf8Bin)]), - %% io:format("Ut: ~w~n", [List]), - ?THROW_ERROR({shoud_be, no_translation}). - -um_filename(Bin, Dir, Options) when is_binary(Bin) -> - um_filename(binary_to_list(Bin), Dir, Options); -um_filename(Str = [_|_], Dir, Options) -> - Name = hd(string:tokens(Str, ":")), - Enc = atom_to_list(proplists:get_value(encoding, Options, latin1)), - File = case lists:member(binary, Options) of - true -> - "test_" ++ Name ++ "_bin_enc_" ++ Enc; - false -> - "test_" ++ Name ++ "_list_enc_" ++ Enc - end, - filename:join(Dir, File). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -576,7 +424,7 @@ ?line ok = ?FILE_MODULE:del_dir(NewDir), ?line {error, enoent} = ?FILE_MODULE:del_dir(NewDir), % Make sure we are not in a directory directly under test_server - % as that would result in eacces errors when trying to delete '..', + % as that would result in eacess errors when trying to delere '..', % because there are processes having that directory as current. ?line ok = ?FILE_MODULE:make_dir(NewDir), ?line {ok,CurrentDir} = file:get_cwd(), @@ -1371,27 +1219,6 @@ ?line test_server:timetrap_cancel(Dog), ok. -pos3(suite) -> []; -pos3(doc) -> ["When it does not use raw mode, file:position had a bug."]; -pos3(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), - ?line RootDir = ?config(data_dir, Config), - ?line Name = filename:join(RootDir, "realmen.html.gz"), - - ?line {ok, Fd} = ?FILE_MODULE:open(Name, [read, binary]), - ?line {ok, _} = ?FILE_MODULE:read(Fd, 5), - ?line {error, einval} = ?FILE_MODULE:position(Fd, {bof, -1}), - - %% Here ok had returned =( - ?line {error, einval} = ?FILE_MODULE:position(Fd, {cur, -10}), - %% That test is actually questionable since file:position/2 - %% is documented to leave the file position undefined after - %% it has returned an error. But on Posix systems the position - %% is guaranteed to be unchanged after an error return. On e.g - %% Windows there is nothing stated about this in the documentation. - - ?line test_server:timetrap_cancel(Dog), - ok. file_info_basic_file(suite) -> []; file_info_basic_file(doc) -> []; @@ -1409,10 +1236,9 @@ %% Test that the file has the expected attributes. %% The times are tricky, so we will save them to a separate test case. - {ok,FileInfo} = ?FILE_MODULE:read_file_info(Name), - {ok,FileInfo} = ?FILE_MODULE:read_file_info(Name, [raw]), - #file_info{size=Size,type=Type,access=Access, - atime=AccessTime,mtime=ModifyTime} = FileInfo, + ?line {ok,#file_info{size=Size,type=Type,access=Access, + atime=AccessTime,mtime=ModifyTime}} = + ?FILE_MODULE:read_file_info(Name), ?line io:format("Access ~p, Modify ~p", [AccessTime, ModifyTime]), ?line Size = 7, ?line Type = regular, @@ -1454,10 +1280,9 @@ test_server:timetrap_cancel(Dog). test_directory(Name, ExpectedAccess) -> - {ok,FileInfo} = ?FILE_MODULE:read_file_info(Name), - {ok,FileInfo} = ?FILE_MODULE:read_file_info(Name, [raw]), - #file_info{size=Size,type=Type,access=Access, - atime=AccessTime,mtime=ModifyTime} = FileInfo, + ?line {ok,#file_info{size=Size,type=Type,access=Access, + atime=AccessTime,mtime=ModifyTime}} = + ?FILE_MODULE:read_file_info(Name), ?line io:format("Testing directory ~s", [Name]), ?line io:format("Directory size is ~p", [Size]), ?line io:format("Access ~p", [Access]), @@ -1482,11 +1307,11 @@ file_info_bad(Config) when is_list(Config) -> ?line Dog = test_server:timetrap(test_server:seconds(5)), ?line RootDir = filename:join([?config(priv_dir, Config)]), - FileName = filename:join(RootDir, atom_to_list(?MODULE) ++ "_nonexistent"), - {error,enoent} = ?FILE_MODULE:read_file_info(FileName), - {error,enoent} = ?FILE_MODULE:read_file_info(FileName, [raw]), + ?line {error, enoent} = + ?FILE_MODULE:read_file_info( + filename:join(RootDir, + atom_to_list(?MODULE)++ "_nonexistent")), ?line {error, enoent} = ?FILE_MODULE:read_file_info(""), - {error, enoent} = ?FILE_MODULE:read_file_info("", [raw]), ?line [] = flush(), ?line test_server:timetrap_cancel(Dog), ok. @@ -1521,16 +1346,8 @@ ?line io:put_chars(Fd1,"foo"), %% check that the file got a modify date max a few seconds away from now - {ok,FileInfo1} = ?FILE_MODULE:read_file_info(Name), - {ok,FileInfo1Raw} = ?FILE_MODULE:read_file_info(Name, [raw]), - - %% We assert that everything but the size is the same, on some OSs the - %% size may not have been flushed to disc and we do not want to do a - %% sync to force it. - FileInfo1Raw = FileInfo1#file_info{ size = FileInfo1Raw#file_info.size }, - - #file_info{type=regular,atime=AccTime1,mtime=ModTime1} = FileInfo1, - + ?line {ok,#file_info{type=regular,atime=AccTime1,mtime=ModTime1}} = + ?FILE_MODULE:read_file_info(Name), ?line Now = erlang:localtime(), %??? ?line io:format("Now ~p",[Now]), ?line io:format("Open file Acc ~p Mod ~p",[AccTime1,ModTime1]), @@ -1546,10 +1363,9 @@ %% close the file, and watch the modify date change ?line ok = ?FILE_MODULE:close(Fd1), - {ok,FileInfo2} = ?FILE_MODULE:read_file_info(Name), - {ok,FileInfo2} = ?FILE_MODULE:read_file_info(Name, [raw]), - #file_info{size=Size,type=regular,access=Access, - atime=AccTime2,mtime=ModTime2} = FileInfo2, + ?line {ok,#file_info{size=Size,type=regular,access=Access, + atime=AccTime2,mtime=ModTime2}} = + ?FILE_MODULE:read_file_info(Name), ?line io:format("Closed file Acc ~p Mod ~p",[AccTime2,ModTime2]), ?line true = time_dist(ModTime1,ModTime2) >= 0, @@ -1558,10 +1374,9 @@ ?line Access = read_write, %% Do some directory checking - {ok,FileInfo3} = ?FILE_MODULE:read_file_info(RootDir), - {ok,FileInfo3} = ?FILE_MODULE:read_file_info(RootDir, [raw]), - #file_info{size=DSize,type=directory,access=DAccess, - atime=AccTime3,mtime=ModTime3} = FileInfo3, + ?line {ok,#file_info{size=DSize,type=directory,access=DAccess, + atime=AccTime3,mtime=ModTime3}} = + ?FILE_MODULE:read_file_info(RootDir), %% this dir was modified only a few secs ago ?line io:format("Dir Acc ~p; Mod ~p; Now ~p", [AccTime3, ModTime3, Now]), ?line true = abs(time_dist(Now,ModTime3)) < 5, @@ -1634,12 +1449,6 @@ ?line ?FILE_MODULE:write_file_info(Name1, #file_info{mode=8#400}), ?line {error, eacces} = ?FILE_MODULE:write_file(Name1, "hello again"), - %% Same with raw. - ?FILE_MODULE:write_file_info(Name1, #file_info{mode=8#600}, [raw]), - ok = ?FILE_MODULE:write_file(Name1, "hello again"), - ?FILE_MODULE:write_file_info(Name1, #file_info{mode=8#400}, [raw]), - {error,eacces} = ?FILE_MODULE:write_file(Name1, "hello again"), - %% Write the times again. %% Note: Seconds must be even; see note in file_info_times/1. @@ -2783,40 +2592,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -unicode(Config) when is_list(Config) -> - Dir = ?config(priv_dir, Config), - Name = filename:join(Dir, "data-utf8.txt"), - Txt = lists:seq(128, 255), - D = unicode:characters_to_binary(Txt, latin1, latin1), - {ok,Fd1} = - ?FILE_MODULE:open(Name, [write,read,binary,{encoding,unicode}]), - ok = ?FILE_MODULE:truncate(Fd1), - ok = ?FILE_MODULE:write(Fd1, Txt), - {ok,0} = ?FILE_MODULE:position(Fd1, bof), - {ok,D} = ?FILE_MODULE:read(Fd1, 129), - {ok,0} = ?FILE_MODULE:position(Fd1, bof), - {ok,D1} = ?FILE_MODULE:read(Fd1, 64), - {ok,Pos} = ?FILE_MODULE:position(Fd1, cur), - {ok,D2} = ?FILE_MODULE:pread(Fd1, {cur,0}, 65), - D = <>, - {ok,D1} = ?FILE_MODULE:pread(Fd1, bof, 64), - {ok,Pos} = ?FILE_MODULE:position(Fd1, Pos), - {ok,D2} = ?FILE_MODULE:read(Fd1, 64), - ok = ?FILE_MODULE:close(Fd1), - %% - RawD = unicode:characters_to_binary(Txt, latin1, unicode), - {ok,RawD} = ?FILE_MODULE:read_file(Name), - %% - {ok,Fd2} = ?FILE_MODULE:open(Name, [read,{encoding,unicode}]), - {ok,Txt} = ?FILE_MODULE:read(Fd2, 129), - {Txt1,Txt2} = lists:split(64, Txt), - {ok,Txt2} = ?FILE_MODULE:pread(Fd2, Pos, 65), - {ok,0} = ?FILE_MODULE:position(Fd2, bof), - {ok,Txt1} = ?FILE_MODULE:read(Fd2, 64), - ok = ?FILE_MODULE:close(Fd2). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - altname(doc) -> "Test the file:altname/1 function"; altname(suite) -> @@ -2875,9 +2650,7 @@ %% since they are not used on symbolic links. ?line {ok, Info} = ?FILE_MODULE:read_link_info(Name), - {ok,Info} = ?FILE_MODULE:read_link_info(Name, [raw]), ?line {ok, Info} = ?FILE_MODULE:read_link_info(Alias), - {ok,Info} = ?FILE_MODULE:read_link_info(Alias, [raw]), ?line #file_info{links = 2, type = regular} = Info, ?line {error, eexist} = ?FILE_MODULE:make_link(Name, Alias), @@ -2897,7 +2670,6 @@ ?line {ok, #file_info{type=directory}} = ?FILE_MODULE:read_link_info("."), - {ok, #file_info{type=directory}} = ?FILE_MODULE:read_link_info(".", [raw]), ?line [] = flush(), ?line test_server:timetrap_cancel(Dog), @@ -2928,15 +2700,11 @@ {skipped, "Windows user not privileged to create symlinks"}; ok -> ?line {ok, Info1} = ?FILE_MODULE:read_file_info(Name), - {ok,Info1} = ?FILE_MODULE:read_file_info(Name, [raw]), ?line {ok, Info1} = ?FILE_MODULE:read_file_info(Alias), - {ok,Info1} = ?FILE_MODULE:read_file_info(Alias, [raw]), ?line {ok, Info1} = ?FILE_MODULE:read_link_info(Name), - {ok,Info1} = ?FILE_MODULE:read_link_info(Name, [raw]), ?line #file_info{links = 1, type = regular} = Info1, ?line {ok, Info2} = ?FILE_MODULE:read_link_info(Alias), - {ok,Info2} = ?FILE_MODULE:read_link_info(Alias, [raw]), ?line #file_info{links=1, type=symlink} = Info2, ?line {ok, Name} = ?FILE_MODULE:read_link(Alias), {ok, Name} = ?FILE_MODULE:read_link_all(Alias), @@ -3971,7 +3739,7 @@ receive {Parent, start, Ts} -> ok end, Stat = iterate(response_stat(response_stat(init, Ts), - micro_ts()), + erlang:now()), done, fun (S) -> erlang:yield(), @@ -3979,12 +3747,12 @@ {Parent, stop} -> done after 0 -> - response_stat(S, micro_ts()) + response_stat(S, erlang:now()) end end), - Parent ! {self(), stopped, response_stat(Stat, micro_ts())} + Parent ! {self(), stopped, response_stat(Stat, erlang:now())} end), - Child ! {Parent, start, micro_ts()}, + ?line Child ! {Parent, start, erlang:now()}, ?line Result = apply(Module, Function, Arguments), ?line Child ! {Parent, stop}, ?line {N, Sum, _, M, Max} = receive {Child, stopped, X} -> X end, @@ -3998,13 +3766,12 @@ [Mean_ms, Max_ms, M, (N-1)])), ?line {Result, Comment}. -micro_ts() -> - erlang:monotonic_time(micro_seconds). + response_stat(init, Ts) -> {0, 0, Ts, 0, 0}; -response_stat({N, Sum, Ts0, M, Max}, Ts) -> - D = Ts - Ts0, +response_stat({N, Sum, {A1, B1, C1}, M, Max}, {A2, B2, C2} = Ts) -> + D = C2-C1 + 1000000*((B2-B1) + 1000000*(A2-A1)), if D > Max -> {N+1, Sum+D, Ts, N, D}; true -> diff -Nru erlang-18.2-dfsg/lib/kernel/test/gen_sctp_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/gen_sctp_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/gen_sctp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/gen_sctp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/gen_tcp_api_SUITE_data/gen_tcp_api_SUITE.c erlang-17.3-dfsg/lib/kernel/test/gen_tcp_api_SUITE_data/gen_tcp_api_SUITE.c --- erlang-18.2-dfsg/lib/kernel/test/gen_tcp_api_SUITE_data/gen_tcp_api_SUITE.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/gen_tcp_api_SUITE_data/gen_tcp_api_SUITE.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2009-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -27,10 +26,8 @@ #ifdef __WIN32__ #include -#define sock_close(s) closesocket(s) #else #include -#define sock_close(s) close(s) #endif #define sock_open(af, type, proto) socket((af), (type), (proto)) @@ -49,7 +46,7 @@ enif_get_int(env, argv[0], &fd); - sock_close(fd); + close(fd); return enif_make_int(env, fd); } diff -Nru erlang-18.2-dfsg/lib/kernel/test/gen_tcp_api_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/gen_tcp_api_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/gen_tcp_api_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/gen_tcp_api_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -31,9 +30,8 @@ init_per_testcase/2, end_per_testcase/2, t_connect_timeout/1, t_accept_timeout/1, t_connect_bad/1, - t_recv_timeout/1, t_recv_eof/1, t_recv_delim/1, + t_recv_timeout/1, t_recv_eof/1, t_shutdown_write/1, t_shutdown_both/1, t_shutdown_error/1, - t_shutdown_async/1, t_fdopen/1, t_fdconnect/1, t_implicit_inet6/1]). -export([getsockfd/0,closesockfd/1]). @@ -43,12 +41,12 @@ all() -> [{group, t_accept}, {group, t_connect}, {group, t_recv}, t_shutdown_write, t_shutdown_both, t_shutdown_error, - t_shutdown_async, t_fdopen, t_fdconnect, t_implicit_inet6]. + t_fdopen, t_fdconnect, t_implicit_inet6]. groups() -> [{t_accept, [], [t_accept_timeout]}, {t_connect, [], [t_connect_timeout, t_connect_bad]}, - {t_recv, [], [t_recv_timeout, t_recv_eof, t_recv_delim]}]. + {t_recv, [], [t_recv_timeout, t_recv_eof]}]. @@ -131,21 +129,6 @@ ?line {error, closed} = gen_tcp:recv(Client, 0), ok. -t_recv_delim(doc) -> "Test using message delimiter $X"; -t_recv_delim(suite) -> []; -t_recv_delim(Config) when is_list(Config) -> - {ok, L} = gen_tcp:listen(0, []), - {ok, Port} = inet:port(L), - Opts = [{active,false},{packet,line},{line_delimiter,$X}], - {ok, Client} = gen_tcp:connect(localhost, Port, Opts), - {ok, A} = gen_tcp:accept(L), - ok = gen_tcp:send(A, "abcXefgX"), - {ok, "abcX"} = gen_tcp:recv(Client, 0, 0), - {ok, "efgX"} = gen_tcp:recv(Client, 0, 0), - ok = gen_tcp:close(Client), - ok = gen_tcp:close(A), - ok. - %%% gen_tcp:shutdown/2 t_shutdown_write(Config) when is_list(Config) -> @@ -172,34 +155,7 @@ ?line ok = gen_tcp:close(L), ?line {error, closed} = gen_tcp:shutdown(L, read_write), ok. - -t_shutdown_async(Config) when is_list(Config) -> - ?line {OS, _} = os:type(), - ?line {ok, L} = gen_tcp:listen(0, [{sndbuf, 4096}]), - ?line {ok, Port} = inet:port(L), - ?line {ok, Client} = gen_tcp:connect(localhost, Port, - [{recbuf, 4096}, - {active, false}]), - ?line {ok, S} = gen_tcp:accept(L), - ?line PayloadSize = 1024 * 1024, - ?line Payload = lists:duplicate(PayloadSize, $.), - ?line ok = gen_tcp:send(S, Payload), - ?line case erlang:port_info(S, queue_size) of - {queue_size, N} when N > 0 -> ok; - {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T -> ?t:fail({unexpected, T}) - end, - - ?line ok = gen_tcp:shutdown(S, write), - ?line {ok, Buf} = gen_tcp:recv(Client, PayloadSize), - ?line {error, closed} = gen_tcp:recv(Client, 0), - ?line case length(Buf) of - PayloadSize -> ok; - Sz -> ?t:fail({payload_size, - {expected, PayloadSize}, - {received, Sz}}) - end. - + %%% gen_tcp:fdopen/2 diff -Nru erlang-18.2-dfsg/lib/kernel/test/gen_tcp_echo_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/gen_tcp_echo_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/gen_tcp_echo_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/gen_tcp_echo_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/gen_tcp_misc_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/gen_tcp_misc_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/gen_tcp_misc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/gen_tcp_misc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -32,11 +31,6 @@ init_per_testcase/2, end_per_testcase/2, otp_3924/1, otp_3924_sender/4, closed_socket/1, shutdown_active/1, shutdown_passive/1, shutdown_pending/1, - show_econnreset_active/1, show_econnreset_active_once/1, - show_econnreset_passive/1, econnreset_after_sync_send/1, - econnreset_after_async_send_active/1, - econnreset_after_async_send_active_once/1, - econnreset_after_async_send_passive/1, linger_zero/1, default_options/1, http_bad_packet/1, busy_send/1, busy_disconnect_passive/1, busy_disconnect_active/1, fill_sendq/1, partial_recv_and_close/1, @@ -44,9 +38,7 @@ % Accept tests primitive_accept/1,multi_accept_close_listen/1,accept_timeout/1, accept_timeouts_in_order/1,accept_timeouts_in_order2/1, - accept_timeouts_in_order3/1,accept_timeouts_in_order4/1, - accept_timeouts_in_order5/1,accept_timeouts_in_order6/1, - accept_timeouts_in_order7/1,accept_timeouts_mixed/1, + accept_timeouts_in_order3/1,accept_timeouts_mixed/1, killing_acceptor/1,killing_multi_acceptors/1,killing_multi_acceptors2/1, several_accepts_in_one_go/1, accept_system_limit/1, active_once_closed/1, send_timeout/1, send_timeout_active/1, @@ -68,19 +60,19 @@ [{watchdog, Dog}|Config]; init_per_testcase(iter_max_socks, Config) when is_list(Config) -> Dog = case os:type() of - {win32,_} -> - test_server:timetrap(test_server:minutes(30)); - _Else -> - test_server:timetrap(test_server:seconds(240)) - end, + {win32,_} -> + test_server:timetrap(test_server:minutes(30)); + _Else -> + test_server:timetrap(test_server:seconds(240)) + end, [{watchdog, Dog}|Config]; init_per_testcase(accept_system_limit, Config) when is_list(Config) -> case os:type() of - {ose,_} -> - {skip,"Skip in OSE"}; - _ -> - Dog = test_server:timetrap(test_server:seconds(240)), - [{watchdog,Dog}|Config] + {ose,_} -> + {skip,"Skip in OSE"}; + _ -> + Dog = test_server:timetrap(test_server:seconds(240)), + [{watchdog,Dog}|Config] end; init_per_testcase(wrapping_oct, Config) when is_list(Config) -> Dog = test_server:timetrap(test_server:seconds(600)), @@ -100,11 +92,6 @@ iter_max_socks, passive_sockets, active_n, accept_closed_by_other_process, otp_3924, closed_socket, shutdown_active, shutdown_passive, shutdown_pending, - show_econnreset_active, show_econnreset_active_once, - show_econnreset_passive, econnreset_after_sync_send, - econnreset_after_async_send_active, - econnreset_after_async_send_active_once, - econnreset_after_async_send_passive, linger_zero, default_options, http_bad_packet, busy_send, busy_disconnect_passive, busy_disconnect_active, fill_sendq, partial_recv_and_close, @@ -112,9 +99,7 @@ so_priority, primitive_accept, multi_accept_close_listen, accept_timeout, accept_timeouts_in_order, accept_timeouts_in_order2, - accept_timeouts_in_order3, accept_timeouts_in_order4, - accept_timeouts_in_order5, accept_timeouts_in_order6, - accept_timeouts_in_order7, accept_timeouts_mixed, + accept_timeouts_in_order3, accept_timeouts_mixed, killing_acceptor, killing_multi_acceptors, killing_multi_acceptors2, several_accepts_in_one_go, accept_system_limit, active_once_closed, send_timeout, send_timeout_active, otp_7731, @@ -136,6 +121,8 @@ end_per_group(_GroupName, Config) -> Config. + + default_options(doc) -> ["Tests kernel application variables inet_default_listen_options and " "inet_default_connect_options"]; @@ -143,68 +130,69 @@ []; default_options(Config) when is_list(Config) -> %% First check the delay_send option - {true,true,true}=do_delay_send_1(), - {false,false,false}=do_delay_send_2(), - {true,false,false}=do_delay_send_3(), - {false,false,false}=do_delay_send_4(), - {false,false,false}=do_delay_send_5(), - {false,true,true}=do_delay_send_6(), + ?line {true,true,true}=do_delay_send_1(), + ?line {false,false,false}=do_delay_send_2(), + ?line {true,false,false}=do_delay_send_3(), + ?line {false,false,false}=do_delay_send_4(), + ?line {false,false,false}=do_delay_send_5(), + ?line {false,true,true}=do_delay_send_6(), %% Now lets start some nodes with different combinations of options: - {true,true,true} = do_delay_on_other_node("", fun do_delay_send_1/0), - {true,false,false} = + ?line {true,true,true} = do_delay_on_other_node("", + fun do_delay_send_1/0), + ?line {true,false,false} = do_delay_on_other_node("-kernel inet_default_connect_options " "\"[{delay_send,true}]\"", fun do_delay_send_2/0), - {false,true,true} = + ?line {false,true,true} = do_delay_on_other_node("-kernel inet_default_listen_options " "\"[{delay_send,true}]\"", fun do_delay_send_2/0), - {true,true,true} = + ?line {true,true,true} = do_delay_on_other_node("-kernel inet_default_listen_options " "\"[{delay_send,true}]\"", fun do_delay_send_3/0), - {true,true,true} = + ?line {true,true,true} = do_delay_on_other_node("-kernel inet_default_connect_options " "\"[{delay_send,true}]\"", fun do_delay_send_6/0), - {false,false,false} = + ?line {false,false,false} = do_delay_on_other_node("-kernel inet_default_connect_options " "\"[{delay_send,true}]\"", fun do_delay_send_5/0), - {false,true,true} = + ?line {false,true,true} = do_delay_on_other_node("-kernel inet_default_connect_options " "\"[{delay_send,true}]\" " "-kernel inet_default_listen_options " "\"[{delay_send,true}]\"", fun do_delay_send_5/0), - {true,false,false} = + ?line {true,false,false} = do_delay_on_other_node("-kernel inet_default_connect_options " "\"[{delay_send,true}]\" " "-kernel inet_default_listen_options " "\"[{delay_send,true}]\"", fun do_delay_send_4/0), - {true,true,true} = + ?line {true,true,true} = do_delay_on_other_node("-kernel inet_default_connect_options " "\"{delay_send,true}\" " "-kernel inet_default_listen_options " "\"{delay_send,true}\"", fun do_delay_send_2/0), %% Active is to dangerous and is supressed - {true,true,true} = + ?line {true,true,true} = do_delay_on_other_node("-kernel inet_default_connect_options " "\"{active,false}\" " "-kernel inet_default_listen_options " "\"{active,false}\"", fun do_delay_send_7/0), - {true,true,true} = + ?line {true,true,true} = do_delay_on_other_node("-kernel inet_default_connect_options " "\"[{active,false},{delay_send,true}]\" " "-kernel inet_default_listen_options " "\"[{active,false},{delay_send,true}]\"", fun do_delay_send_7/0), - {true,true,true} = + ?line {true,true,true} = do_delay_on_other_node("-kernel inet_default_connect_options " "\"[{active,false},{delay_send,true}]\" " "-kernel inet_default_listen_options " @@ -216,10 +204,12 @@ do_delay_on_other_node(XArgs, Function) -> Dir = filename:dirname(code:which(?MODULE)), {ok,Node} = test_server:start_node(test_default_options_slave,slave, - [{args,"-pa " ++ Dir ++ " " ++ XArgs}]), + [{args,"-pa " ++ Dir ++ " " ++ + XArgs}]), Res = rpc:call(Node,erlang,apply,[Function,[]]), test_server:stop_node(Node), Res. + do_delay_send_1() -> {ok,LS}=gen_tcp:listen(0,[{delay_send,true}]), @@ -311,6 +301,8 @@ gen_tcp:close(S), gen_tcp:close(LS), {B1,B2,B3}. + + controlling_process(doc) -> ["Open a listen port and change controlling_process for it", @@ -321,18 +313,18 @@ {ok,S} = gen_tcp:listen(0,[]), Pid2 = spawn(?MODULE,not_owner,[S]), Pid2 ! {self(),2,control}, - {error, E} = receive {2,_E} -> + ?line {error, E} = receive {2,_E} -> _E after 10000 -> timeout end, io:format("received ~p~n",[E]), Pid = spawn(?MODULE,not_owner,[S]), - ok = gen_tcp:controlling_process(S,Pid), + ?line ok = gen_tcp:controlling_process(S,Pid), Pid ! {self(),1,control}, - ok = receive {1,ok} -> - ok - after 1000 -> timeout - end, + ?line ok = receive {1,ok} -> + ok + after 1000 -> timeout + end, Pid ! close. not_owner(S) -> @@ -385,7 +377,7 @@ {tcp_closed, Client} -> ok after 5000 -> - test_server:fail(never_closed) + ?line test_server:fail(never_closed) end. @@ -394,30 +386,30 @@ "to the other end."]; close_with_pending_output(suite) -> []; close_with_pending_output(Config) when is_list(Config) -> - {ok, L} = gen_tcp:listen(0, [binary, {active, false}]), - {ok, {_, Port}} = inet:sockname(L), - Packets = 16, - Total = 2048*Packets, + ?line {ok, L} = gen_tcp:listen(0, [binary, {active, false}]), + ?line {ok, {_, Port}} = inet:sockname(L), + ?line Packets = 16, + ?line Total = 2048*Packets, case start_remote(close_pending) of {ok, Node} -> - {ok, Host} = inet:gethostname(), - spawn_link(Node, ?MODULE, sender, [Port, Packets, Host]), - {ok, A} = gen_tcp:accept(L), - case gen_tcp:recv(A, Total) of + ?line {ok, Host} = inet:gethostname(), + ?line spawn_link(Node, ?MODULE, sender, [Port, Packets, Host]), + ?line {ok, A} = gen_tcp:accept(L), + ?line case gen_tcp:recv(A, Total) of {ok, Bin} when byte_size(Bin) == Total -> gen_tcp:close(A), gen_tcp:close(L); {ok, Bin} -> - test_server:fail({small_packet, + ?line test_server:fail({small_packet, byte_size(Bin)}); Error -> - test_server:fail({unexpected, Error}) + ?line test_server:fail({unexpected, Error}) end, ok; {error, no_remote_hosts} -> {skipped,"No remote hosts"}; {error, Other} -> - ?t:fail({failed_to_start_slave_node, Other}) + ?line ?t:fail({failed_to_start_slave_node, Other}) end. sender(Port, Packets, Host) -> @@ -564,62 +556,63 @@ otp_3924_1(MaxDelay). otp_3924_1(MaxDelay) -> - {ok, Node} = start_node(otp_3924), - DataLen = 100*1024, - Data = otp_3924_data(DataLen), + ?line {ok, Node} = start_node(otp_3924), + ?line DataLen = 100*1024, + ?line Data = otp_3924_data(DataLen), % Repeat the test a couple of times to prevent the test from passing % by chance. - repeat(10, fun(N) -> - ok = otp_3924(MaxDelay, Node, Data, DataLen, N) - end), - test_server:stop_node(Node), + repeat(10, + fun (N) -> + ?line ok = otp_3924(MaxDelay, Node, Data, DataLen, N) + end), + ?line test_server:stop_node(Node), ok. otp_3924(MaxDelay, Node, Data, DataLen, N) -> - {ok, L} = gen_tcp:listen(0, [list, {active, false}]), - {ok, {_, Port}} = inet:sockname(L), - {ok, Host} = inet:gethostname(), - Sender = spawn_link(Node, - ?MODULE, - otp_3924_sender, - [self(), Host, Port, Data]), - Data = otp_3924_receive_data(L, Sender, MaxDelay, DataLen, N), - ok = gen_tcp:close(L). + ?line {ok, L} = gen_tcp:listen(0, [list, {active, false}]), + ?line {ok, {_, Port}} = inet:sockname(L), + ?line {ok, Host} = inet:gethostname(), + ?line Sender = spawn_link(Node, + ?MODULE, + otp_3924_sender, + [self(), Host, Port, Data]), + ?line Data = otp_3924_receive_data(L, Sender, MaxDelay, DataLen, N), + ?line ok = gen_tcp:close(L). otp_3924_receive_data(LSock, Sender, MaxDelay, Len, N) -> - OP = process_flag(priority, max), - OTE = process_flag(trap_exit, true), - TimeoutRef = make_ref(), - Data = (catch begin - Sender ! start, - {ok, Sock} = gen_tcp:accept(LSock), - D = otp_3924_receive_data(Sock, - TimeoutRef, - MaxDelay, - Len, - [], - 0), - ok = gen_tcp:close(Sock), - D - end), - unlink(Sender), - process_flag(trap_exit, OTE), - process_flag(priority, OP), + ?line OP = process_flag(priority, max), + ?line OTE = process_flag(trap_exit, true), + ?line TimeoutRef = make_ref(), + ?line Data = (catch begin + ?line Sender ! start, + ?line {ok, Sock} = gen_tcp:accept(LSock), + ?line D = otp_3924_receive_data(Sock, + TimeoutRef, + MaxDelay, + Len, + [], + 0), + ?line ok = gen_tcp:close(Sock), + D + end), + ?line unlink(Sender), + ?line process_flag(trap_exit, OTE), + ?line process_flag(priority, OP), receive {'EXIT', _, TimeoutRef} -> - test_server:fail({close_not_fast_enough,MaxDelay,N}); + ?line test_server:fail({close_not_fast_enough,MaxDelay,N}); {'EXIT', Sender, Reason} -> - test_server:fail({sender_exited, Reason}); + ?line test_server:fail({sender_exited, Reason}); {'EXIT', _Other, Reason} -> - test_server:fail({linked_process_exited, Reason}) + ?line test_server:fail({linked_process_exited, Reason}) after 0 -> case Data of {'EXIT', {A,B}} -> - test_server:fail({A,B,N}); + ?line test_server:fail({A,B,N}); {'EXIT', Failure} -> - test_server:fail(Failure); + ?line test_server:fail(Failure); _ -> - Data + ?line Data end end. @@ -630,12 +623,12 @@ NewAccLen = AccLen + length(Data), if NewAccLen == Len -> - {ok, TRef} = timer:exit_after(MaxDelay, + ?line {ok, TRef} = timer:exit_after(MaxDelay, self(), TimeoutRef), - {error, closed} = gen_tcp:recv(Sock, 0), - timer:cancel(TRef), - lists:flatten([Acc, Data]); + ?line {error, closed} = gen_tcp:recv(Sock, 0), + ?line timer:cancel(TRef), + ?line lists:flatten([Acc, Data]); NewAccLen > Len -> exit({received_too_much, NewAccLen}); true -> @@ -720,8 +713,8 @@ "is called."]; get_status(suite) -> []; get_status(Config) when is_list(Config) -> - {ok,{socket,Pid,_,_}} = gen_tcp:listen(5678,[]), - {status,Pid,_,_} = sys:get_status(Pid). + ?line {ok,{socket,Pid,_,_}} = gen_tcp:listen(5678,[]), + ?line {status,Pid,_,_} = sys:get_status(Pid). -define(RECOVER_SLEEP, 60000). -define(RETRY_SLEEP, 15000). @@ -751,19 +744,19 @@ MS = max_socks(), [MS|do_iter_max_socks(N-1, failed)]; do_iter_max_socks(N, First) when is_integer(First) -> - MS = max_socks(), + ?line MS = max_socks(), if MS == First -> - [MS|do_iter_max_socks(N-1, First)]; + ?line [MS|do_iter_max_socks(N-1, First)]; true -> - io:format("Sleeping for ~p seconds...~n", + ?line io:format("Sleeping for ~p seconds...~n", [?RETRY_SLEEP/1000]), - ?t:sleep(?RETRY_SLEEP), - io:format("Trying again...~n", []), - RetryMS = max_socks(), - if RetryMS == First -> - [RetryMS|do_iter_max_socks(N-1, First)]; + ?line ?t:sleep(?RETRY_SLEEP), + ?line io:format("Trying again...~n", []), + ?line RetryMS = max_socks(), + ?line if RetryMS == First -> + ?line [RetryMS|do_iter_max_socks(N-1, First)]; true -> - [RetryMS|do_iter_max_socks(N-1, failed)] + ?line [RetryMS|do_iter_max_socks(N-1, failed)] end end. @@ -775,7 +768,7 @@ all_equal(Rule, [Rule | T]) -> all_equal(Rule, T); all_equal(_, [_ | _]) -> - ?t:sleep(?RECOVER_SLEEP), % Wait a while and *hope* that we'll + ?line ?t:sleep(?RECOVER_SLEEP), % Wait a while and *hope* that we'll % recover so other tests won't be % affected. ?t:fail(max_socket_mismatch); @@ -783,9 +776,9 @@ ok. max_socks() -> - Socks = open_socks(), - N = length(Socks), - lists:foreach(fun(S) -> ok = gen_tcp:close(S) end, Socks), + ?line Socks = open_socks(), + ?line N = length(Socks), + ?line lists:foreach(fun(S) -> ok = gen_tcp:close(S) end, Socks), io:format("Got ~p sockets", [N]), N. @@ -824,18 +817,18 @@ ["Tests that when 'the other side' on a passive socket closes, the connecting", "side still can read until the end of data."]; passive_sockets(Config) when is_list(Config) -> - spawn_link(?MODULE, passive_sockets_server, - [[{active,false}],self()]), - receive - {socket,Port} -> ok - end, + ?line spawn_link(?MODULE, passive_sockets_server, + [[{active,false}],self()]), + ?line receive + {socket,Port} -> ok + end, ?t:sleep(500), - case gen_tcp:connect("localhost", Port, [{active, false}]) of - {ok, Sock} -> - passive_sockets_read(Sock); - Error -> - ?t:fail({"Could not connect to server", Error}) - end. + ?line case gen_tcp:connect("localhost", Port, [{active, false}]) of + {ok, Sock} -> + passive_sockets_read(Sock); + Error -> + ?t:fail({"Could not connect to server", Error}) + end. %% %% Read until we get an {error, closed}. If we get another error, this test case @@ -854,58 +847,58 @@ end. passive_sockets_server(Opts, Parent) -> - case gen_tcp:listen(0, Opts) of - {ok, LSock} -> - {ok,{_,Port}} = inet:sockname(LSock), - Parent ! {socket,Port}, - passive_sockets_server_accept(LSock); - Error -> - ?t:fail({"Could not create listen socket", Error}) - end. + ?line case gen_tcp:listen(0, Opts) of + {ok, LSock} -> + {ok,{_,Port}} = inet:sockname(LSock), + Parent ! {socket,Port}, + passive_sockets_server_accept(LSock); + Error -> + ?t:fail({"Could not create listen socket", Error}) + end. passive_sockets_server_accept(Sock) -> - case gen_tcp:accept(Sock) of - {ok, Socket} -> - ?t:sleep(500), % Simulate latency - passive_sockets_server_send(Socket, 5), - passive_sockets_server_accept(Sock); - Error -> - ?t:fail({"Could not accept connection", Error}) - end. + ?line case gen_tcp:accept(Sock) of + {ok, Socket} -> + ?t:sleep(500), % Simulate latency + passive_sockets_server_send(Socket, 5), + passive_sockets_server_accept(Sock); + Error -> + ?t:fail({"Could not accept connection", Error}) + end. passive_sockets_server_send(Socket, 0) -> io:format("Closing other end..~n", []), gen_tcp:close(Socket); passive_sockets_server_send(Socket, X) -> - Data = lists:duplicate(1024*X, $a), - case gen_tcp:send(Socket, Data) of - ok -> - ?t:sleep(50), % Simulate some processing. - passive_sockets_server_send(Socket, X-1); - {error, _Reason} -> - ?t:fail("Failed to send data") - end. + ?line Data = lists:duplicate(1024*X, $a), + ?line case gen_tcp:send(Socket, Data) of + ok -> + ?t:sleep(50), % Simulate some processing. + passive_sockets_server_send(Socket, X-1); + {error, _Reason} -> + ?t:fail("Failed to send data") + end. accept_closed_by_other_process(doc) -> ["Tests the return value from gen_tcp:accept when ", "the socket is closed from another process. (OTP-3817)"]; accept_closed_by_other_process(Config) when is_list(Config) -> - Parent = self(), - {ok, ListenSocket} = gen_tcp:listen(0, []), - Child = + ?line Parent = self(), + ?line {ok, ListenSocket} = gen_tcp:listen(0, []), + ?line Child = spawn_link( fun() -> Parent ! {self(), gen_tcp:accept(ListenSocket)} end), - receive after 1000 -> ok end, - ok = gen_tcp:close(ListenSocket), - receive - {Child, {error, closed}} -> - ok; - {Child, Other} -> - ?t:fail({"Wrong result of gen_tcp:accept", Other}) - end. + ?line receive after 1000 -> ok end, + ?line ok = gen_tcp:close(ListenSocket), + ?line receive + {Child, {error, closed}} -> + ok; + {Child, Other} -> + ?t:fail({"Wrong result of gen_tcp:accept", Other}) + end. repeat(N, Fun) -> repeat(N, N, Fun). @@ -922,9 +915,9 @@ closed_socket(doc) -> ["Tests the response when using a closed socket as argument"]; closed_socket(Config) when is_list(Config) -> - {ok, LS1} = gen_tcp:listen(0, []), - erlang:yield(), - ok = gen_tcp:close(LS1), + ?line {ok, LS1} = gen_tcp:listen(0, []), + ?line erlang:yield(), + ?line ok = gen_tcp:close(LS1), %% If the following delay is uncommented, the result error values %% below will change from {error, einval} to {error, closed} since %% inet_db then will have noticed that the socket is closed. @@ -932,18 +925,19 @@ %% in inet_db processes the 'EXIT' message from the port, %% the socket is unregistered. %% - %% test_server:sleep(test_server:seconds(2)), + %% ?line test_server:sleep(test_server:seconds(2)), %% - {error, R_send} = gen_tcp:send(LS1, "data"), - {error, R_recv} = gen_tcp:recv(LS1, 17), - {error, R_accept} = gen_tcp:accept(LS1), - {error, R_controlling_process} = + ?line {error, R_send} = gen_tcp:send(LS1, "data"), + ?line {error, R_recv} = gen_tcp:recv(LS1, 17), + ?line {error, R_accept} = gen_tcp:accept(LS1), + ?line {error, R_controlling_process} = gen_tcp:controlling_process(LS1, self()), %% - ok = io:format("R_send = ~p~n", [R_send]), - ok = io:format("R_recv = ~p~n", [R_recv]), - ok = io:format("R_accept = ~p~n", [R_accept]), - ok = io:format("R_controlling_process = ~p~n", [R_controlling_process]), + ?line ok = io:format("R_send = ~p~n", [R_send]), + ?line ok = io:format("R_recv = ~p~n", [R_recv]), + ?line ok = io:format("R_accept = ~p~n", [R_accept]), + ?line ok = io:format("R_controlling_process = ~p~n", + [R_controlling_process]), ok. %%% @@ -951,27 +945,28 @@ %%% shutdown_active(Config) when is_list(Config) -> - shutdown_common(true). + ?line shutdown_common(true). shutdown_passive(Config) when is_list(Config) -> - shutdown_common(false). + ?line shutdown_common(false). shutdown_common(Active) -> - P = sort_server(Active), + ?line P = sort_server(Active), io:format("Sort server port: ~p\n", [P]), - do_sort(P, []), - do_sort(P, ["glurf"]), - do_sort(P, ["abc","nisse","dum"]), - - do_sort(P, [lists:reverse(integer_to_list(I)) || I <- lists:seq(25, 255)]), - do_sort(P, [lists:reverse(integer_to_list(I)) || I <- lists:seq(77, 999)]), - do_sort(P, [lists:reverse(integer_to_list(I)) || I <- lists:seq(25, 55)]), - do_sort(P, []), - do_sort(P, ["apa"]), - do_sort(P, ["kluns","gorilla"]), - do_sort(P, [lists:reverse(integer_to_list(I)) || I <- lists:seq(25, 1233)]), - do_sort(P, []), + ?line do_sort(P, []), + ?line do_sort(P, ["glurf"]), + ?line do_sort(P, ["abc","nisse","dum"]), + + ?line do_sort(P, [lists:reverse(integer_to_list(I)) || I <- lists:seq(25, 255)]), + ?line do_sort(P, [lists:reverse(integer_to_list(I)) || I <- lists:seq(77, 999)]), + ?line do_sort(P, [lists:reverse(integer_to_list(I)) || I <- lists:seq(25, 55)]), + ?line do_sort(P, []), + ?line do_sort(P, ["apa"]), + ?line do_sort(P, ["kluns","gorilla"]), + ?line do_sort(P, [lists:reverse(integer_to_list(I)) || I <- lists:seq(25, 1233)]), + ?line do_sort(P, []), + receive Any -> ?t:fail({unexpected_message,Any}) @@ -990,14 +985,14 @@ sort_server(Active) -> Opts = [{exit_on_close,false},{packet,line},{active,Active}], - {ok,L} = gen_tcp:listen(0, Opts), + ?line {ok,L} = gen_tcp:listen(0, Opts), Go = make_ref(), - Pid = spawn_link(fun() -> - receive Go -> sort_server_1(L, Active) end - end), - ok = gen_tcp:controlling_process(L, Pid), - Pid ! Go, - {ok,Port} = inet:port(L), + ?line Pid = spawn_link(fun() -> + receive Go -> sort_server_1(L, Active) end + end), + ?line ok = gen_tcp:controlling_process(L, Pid), + ?line Pid ! Go, + ?line {ok,Port} = inet:port(L), Port. sort_server_1(L, Active) -> @@ -1047,17 +1042,17 @@ Data = [<>,ones(N),42], P = a_server(), io:format("Server port: ~p\n", [P]), - {ok,S} = gen_tcp:connect(localhost, P, []), - gen_tcp:send(S, Data), - gen_tcp:shutdown(S, write), - receive - {tcp,S,Msg} -> - io:format("~p\n", [Msg]), - N = list_to_integer(Msg) - 5; - Other -> - ?t:fail({unexpected,Other}) - end, - ok. + ?line {ok,S} = gen_tcp:connect(localhost, P, []), + ?line gen_tcp:send(S, Data), + ?line gen_tcp:shutdown(S, write), + ?line receive + {tcp,S,Msg} -> + io:format("~p\n", [Msg]), + ?line N = list_to_integer(Msg) - 5; + Other -> + ?t:fail({unexpected,Other}) + end, + ok. ones(0) -> []; ones(1) -> [1]; @@ -1070,10 +1065,10 @@ end. a_server() -> - {ok,L} = gen_tcp:listen(0, [{exit_on_close,false},{active,false}]), - Pid = spawn_link(fun() -> a_server(L) end), - ok = gen_tcp:controlling_process(L, Pid), - {ok,Port} = inet:port(L), + ?line {ok,L} = gen_tcp:listen(0, [{exit_on_close,false},{active,false}]), + ?line Pid = spawn_link(fun() -> a_server(L) end), + ?line ok = gen_tcp:controlling_process(L, Pid), + ?line {ok,Port} = inet:port(L), Port. a_server(L) -> @@ -1090,328 +1085,24 @@ gen_tcp:close(S) end. -%% -%% Test 'show_econnreset' option -%% - -show_econnreset_active(Config) when is_list(Config) -> - %% First confirm everything works with option turned off. - {ok, L} = gen_tcp:listen(0, []), - {ok, Port} = inet:port(L), - {ok, Client} = gen_tcp:connect(localhost, Port, [{active, false}]), - {ok, S} = gen_tcp:accept(L), - ok = gen_tcp:close(L), - ok = inet:setopts(Client, [{linger, {true, 0}}]), - ok = gen_tcp:close(Client), - receive - {tcp_closed, S} -> - ok; - Other -> - ?t:fail({unexpected1, Other}) - after 1000 -> - ?t:fail({timeout, {server, no_tcp_closed}}) - end, - - %% Now test with option switched on. - %% Note: We are also testing that the show_econnreset option is - %% inherited from the listening socket by the accepting socket. - {ok, L1} = gen_tcp:listen(0, [{show_econnreset, true}]), - {ok, Port1} = inet:port(L1), - {ok, Client1} = gen_tcp:connect(localhost, Port1, [{active, false}]), - {ok, S1} = gen_tcp:accept(L1), - ok = gen_tcp:close(L1), - ok = inet:setopts(Client1, [{linger, {true, 0}}]), - ok = gen_tcp:close(Client1), - receive - {tcp_error, S1, econnreset} -> - receive - {tcp_closed, S1} -> - ok; - Other1 -> - ?t:fail({unexpected2, Other1}) - after 1 -> - ?t:fail({timeout, {server, no_tcp_closed}}) - end; - Other2 -> - ?t:fail({unexpected3, Other2}) - after 1000 -> - ?t:fail({timeout, {server, no_tcp_error}}) - end. - -show_econnreset_active_once(Config) when is_list(Config) -> - %% Now test using {active, once} - {ok, L} = gen_tcp:listen(0, - [{active, false}, - {show_econnreset, true}]), - {ok, Port} = inet:port(L), - {ok, Client} = gen_tcp:connect(localhost, Port, [{active, false}]), - {ok, S} = gen_tcp:accept(L), - ok = gen_tcp:close(L), - ok = inet:setopts(Client, [{linger, {true, 0}}]), - ok = gen_tcp:close(Client), - ok = ?t:sleep(20), - ok = receive Msg -> {unexpected_msg, Msg} after 0 -> ok end, - ok = inet:setopts(S, [{active, once}]), - receive - {tcp_error, S, econnreset} -> - receive - {tcp_closed, S} -> - ok; - Other1 -> - ?t:fail({unexpected1, Other1}) - after 1 -> - ?t:fail({timeout, {server, no_tcp_closed}}) - end; - Other2 -> - ?t:fail({unexpected2, Other2}) - after 1000 -> - ?t:fail({timeout, {server, no_tcp_error}}) - end. - -show_econnreset_passive(Config) when is_list(Config) -> - %% First confirm everything works with option turned off. - {ok, L} = gen_tcp:listen(0, [{active, false}]), - {ok, Port} = inet:port(L), - {ok, Client} = gen_tcp:connect(localhost, Port, [{active, false}]), - {ok, S} = gen_tcp:accept(L), - ok = gen_tcp:close(L), - ok = inet:setopts(S, [{linger, {true, 0}}]), - ok = gen_tcp:close(S), - ok = ?t:sleep(1), - {error, closed} = gen_tcp:recv(Client, 0), - - %% Now test with option switched on. - {ok, L1} = gen_tcp:listen(0, [{active, false}]), - {ok, Port1} = inet:port(L1), - {ok, Client1} = gen_tcp:connect(localhost, Port1, - [{active, false}, - {show_econnreset, true}]), - {ok, S1} = gen_tcp:accept(L1), - ok = gen_tcp:close(L1), - ok = inet:setopts(S1, [{linger, {true, 0}}]), - ok = gen_tcp:close(S1), - ok = ?t:sleep(1), - {error, econnreset} = gen_tcp:recv(Client1, 0). - -econnreset_after_sync_send(Config) when is_list(Config) -> - %% First confirm everything works with option turned off. - {ok, L} = gen_tcp:listen(0, [{active, false}]), - {ok, Port} = inet:port(L), - {ok, Client} = gen_tcp:connect(localhost, Port, [{active, false}]), - {ok, S} = gen_tcp:accept(L), - ok = gen_tcp:close(L), - ok = inet:setopts(S, [{linger, {true, 0}}]), - ok = gen_tcp:close(S), - ok = ?t:sleep(20), - {error, closed} = gen_tcp:send(Client, "Whatever"), - - %% Now test with option switched on. - {ok, L1} = gen_tcp:listen(0, [{active, false}]), - {ok, Port1} = inet:port(L1), - {ok, Client1} = gen_tcp:connect(localhost, Port1, - [{active, false}, - {show_econnreset, true}]), - {ok, S1} = gen_tcp:accept(L1), - ok = gen_tcp:close(L1), - ok = inet:setopts(S1, [{linger, {true, 0}}]), - ok = gen_tcp:close(S1), - ok = ?t:sleep(20), - {error, econnreset} = gen_tcp:send(Client1, "Whatever"). - -econnreset_after_async_send_active(Config) when is_list(Config) -> - {OS, _} = os:type(), - Payload = lists:duplicate(1024 * 1024, $.), - - %% First confirm everything works with option turned off. - {ok, L} = gen_tcp:listen(0, [{active, false}, {recbuf, 4096}]), - {ok, Port} = inet:port(L), - {ok, Client} = gen_tcp:connect(localhost, Port, [{sndbuf, 4096}]), - {ok, S} = gen_tcp:accept(L), - ok = gen_tcp:close(L), - ok = gen_tcp:send(Client, Payload), - case erlang:port_info(Client, queue_size) of - {queue_size, N} when N > 0 -> ok; - {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T -> ?t:fail(T) - end, - ok = gen_tcp:send(S, "Whatever"), - ok = ?t:sleep(20), - ok = inet:setopts(S, [{linger, {true, 0}}]), - ok = gen_tcp:close(S), - ok = ?t:sleep(20), - receive - {tcp, Client, "Whatever"} -> - receive - {tcp_closed, Client} -> - ok; - Other1 -> - ?t:fail({unexpected1, Other1}) - end; - Other2 -> - ?t:fail({unexpected2, Other2}) - end, - - %% Now test with option switched on. - {ok, L1} = gen_tcp:listen(0, [{active, false}, {recbuf, 4096}]), - {ok, Port1} = inet:port(L1), - {ok, Client1} = gen_tcp:connect(localhost, Port1, - [{sndbuf, 4096}, - {show_econnreset, true}]), - {ok, S1} = gen_tcp:accept(L1), - ok = gen_tcp:close(L1), - ok = gen_tcp:send(Client1, Payload), - case erlang:port_info(Client1, queue_size) of - {queue_size, N1} when N1 > 0 -> ok; - {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T1 -> ?t:fail(T1) - end, - ok = gen_tcp:send(S1, "Whatever"), - ok = ?t:sleep(20), - ok = inet:setopts(S1, [{linger, {true, 0}}]), - ok = gen_tcp:close(S1), - ok = ?t:sleep(20), - receive - {tcp, Client1, "Whatever"} -> - receive - {tcp_error, Client1, econnreset} -> - receive - {tcp_closed, Client1} -> - ok; - Other3 -> - ?t:fail({unexpected3, Other3}) - end; - Other4 -> - ?t:fail({unexpected4, Other4}) - end; - Other5 -> - ?t:fail({unexpected5, Other5}) - end. - -econnreset_after_async_send_active_once(Config) when is_list(Config) -> - {OS, _} = os:type(), - {ok, L} = gen_tcp:listen(0, [{active, false}, {recbuf, 4096}]), - {ok, Port} = inet:port(L), - {ok, Client} = gen_tcp:connect(localhost, Port, - [{active, false}, - {sndbuf, 4096}, - {show_econnreset, true}]), - {ok,S} = gen_tcp:accept(L), - ok = gen_tcp:close(L), - Payload = lists:duplicate(1024 * 1024, $.), - ok = gen_tcp:send(Client, Payload), - case erlang:port_info(Client, queue_size) of - {queue_size, N} when N > 0 -> ok; - {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T -> ?t:fail(T) - end, - ok = gen_tcp:send(S, "Whatever"), - ok = ?t:sleep(20), - ok = inet:setopts(S, [{linger, {true, 0}}]), - ok = gen_tcp:close(S), - ok = ?t:sleep(20), - ok = receive Msg -> {unexpected_msg, Msg} after 0 -> ok end, - ok = inet:setopts(Client, [{active, once}]), - receive - {tcp_error, Client, econnreset} -> - receive - {tcp_closed, Client} -> - ok; - Other -> - ?t:fail({unexpected1, Other}) - end; - Other -> - ?t:fail({unexpected2, Other}) - end. - -econnreset_after_async_send_passive(Config) when is_list(Config) -> - {OS, _} = os:type(), - Payload = lists:duplicate(1024 * 1024, $.), - - %% First confirm everything works with option turned off. - {ok, L} = gen_tcp:listen(0, [{active, false}, {recbuf, 4096}]), - {ok, Port} = inet:port(L), - {ok, Client} = gen_tcp:connect(localhost, Port, - [{active, false}, - {sndbuf, 4096}]), - {ok, S} = gen_tcp:accept(L), - ok = gen_tcp:close(L), - ok = inet:setopts(S, [{linger, {true, 0}}]), - ok = gen_tcp:send(S, "Whatever"), - ok = gen_tcp:send(Client, Payload), - case erlang:port_info(Client, queue_size) of - {queue_size, N} when N > 0 -> ok; - {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T -> ?t:fail(T) - end, - ok = gen_tcp:close(S), - ok = ?t:sleep(20), - {error, closed} = gen_tcp:recv(Client, 0), - - %% Now test with option switched on. - {ok, L1} = gen_tcp:listen(0, [{active, false}, {recbuf, 4096}]), - {ok, Port1} = inet:port(L1), - {ok, Client1} = gen_tcp:connect(localhost, Port1, - [{active, false}, - {sndbuf, 4096}, - {show_econnreset, true}]), - {ok, S1} = gen_tcp:accept(L1), - ok = gen_tcp:close(L1), - ok = inet:setopts(S1, [{linger, {true, 0}}]), - ok = gen_tcp:send(S1, "Whatever"), - ok = gen_tcp:send(Client1, Payload), - ok = gen_tcp:close(S1), - ok = ?t:sleep(20), - {error, econnreset} = gen_tcp:recv(Client1, 0). - -%% -%% Test {linger {true, 0}} aborts a connection -%% - -linger_zero(Config) when is_list(Config) -> - %% All the econnreset tests will prove that {linger, {true, 0}} aborts - %% a connection when the driver queue is empty. We will test here - %% that it also works when the driver queue is not empty. - {OS, _} = os:type(), - {ok, L} = gen_tcp:listen(0, [{active, false}, - {recbuf, 4096}, - {show_econnreset, true}]), - {ok, Port} = inet:port(L), - {ok, Client} = gen_tcp:connect(localhost, Port, - [{active, false}, - {sndbuf, 4096}]), - {ok, S} = gen_tcp:accept(L), - ok = gen_tcp:close(L), - PayloadSize = 1024 * 1024, - Payload = lists:duplicate(PayloadSize, $.), - ok = gen_tcp:send(Client, Payload), - case erlang:port_info(Client, queue_size) of - {queue_size, N} when N > 0 -> ok; - {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T -> ?t:fail(T) - end, - ok = inet:setopts(Client, [{linger, {true, 0}}]), - ok = gen_tcp:close(Client), - ok = ?t:sleep(1), - undefined = erlang:port_info(Client, connected), - {error, econnreset} = gen_tcp:recv(S, PayloadSize). - %% Thanks to Luke Gorrie. Tests for a very specific problem with %% corrupt data. The testcase will be killed by the timetrap timeout %% if the bug is present. http_bad_packet(Config) when is_list(Config) -> - {ok,L} = gen_tcp:listen(0, [{active, false}, - binary, - {reuseaddr, true}, - {packet, http}]), - {ok,Port} = inet:port(L), - spawn_link(fun() -> erlang:yield(), http_bad_client(Port) end), - case gen_tcp:accept(L) of - {ok,S} -> - http_worker(S); - Err -> - exit({accept,Err}) - end. + ?line {ok,L} = gen_tcp:listen(0, + [{active, false}, + binary, + {reuseaddr, true}, + {packet, http}]), + ?line {ok,Port} = inet:port(L), + ?line spawn_link(fun() -> erlang:yield(), http_bad_client(Port) end), + ?line case gen_tcp:accept(L) of + {ok,S} -> + http_worker(S); + Err -> + exit({accept,Err}) + end. http_worker(S) -> case gen_tcp:recv(S, 0, 30000) of @@ -1431,9 +1122,9 @@ %% Fill send queue and then start receiving. %% busy_send(Config) when is_list(Config) -> - Master = self(), - Msg = <<"the quick brown fox jumps over a lazy dog~n">>, - Server = + ?line Master = self(), + ?line Msg = <<"the quick brown fox jumps over a lazy dog~n">>, + ?line Server = spawn_link(fun () -> {ok,L} = gen_tcp:listen (0, [{active,false},binary, @@ -1443,42 +1134,45 @@ busy_send_client(Port, Master, Msg)}, busy_send_srv(L, Master, Msg) end), - io:format("~p Server~n", [Server]), - receive - {Server,client,Client} -> - io:format("~p Client~n", [Client]), - busy_send_loop(Server, Client, 0) - end. + ?line io:format("~p Server~n", [Server]), + ?line receive + {Server,client,Client} -> + ?line io:format("~p Client~n", [Client]), + ?line busy_send_loop(Server, Client, 0) + end. busy_send_loop(Server, Client, N) -> %% Master %% - receive {Server,send} -> + ?line receive {Server,send} -> busy_send_loop(Server, Client, N+1) after 2000 -> %% Send queue full, sender blocked %% -> stop sender and release client - io:format("Send timeout, time to receive...~n", []), - Server ! {self(),close}, - Client ! {self(),recv,N+1}, - receive - {Server,send} -> - busy_send_2(Server, Client, N+1) - after 10000 -> - %% If this happens, see busy_send_srv - ?t:fail({timeout,{server,not_send,flush([])}}) - end - end. + ?line io:format("Send timeout, time to receive...~n", []), + ?line Server ! {self(),close}, + ?line Client ! {self(),recv,N+1}, + ?line receive + {Server,send} -> + ?line busy_send_2(Server, Client, N+1) + after 10000 -> + %% If this happens, see busy_send_srv + ?t:fail({timeout,{server,not_send,flush([])}}) + end + end. busy_send_2(Server, Client, _N) -> %% Master %% - receive - {Server,[closed]} -> - receive {Client,[0,{error,closed}]} -> ok end - after 10000 -> - ?t:fail({timeout,{server,not_closed,flush([])}}) - end. + ?line receive + {Server,[closed]} -> + ?line receive + {Client,[0,{error,closed}]} -> + ok + end + after 10000 -> + ?t:fail({timeout,{server,not_closed,flush([])}}) + end. busy_send_srv(L, Master, Msg) -> %% Server @@ -1534,7 +1228,7 @@ busy_disconnect_passive(Config) when is_list(Config) -> MuchoData = list_to_binary(ones(64*1024)), - [do_busy_disconnect_passive(MuchoData) || _ <- lists:seq(1, 10)], + ?line [do_busy_disconnect_passive(MuchoData) || _ <- lists:seq(1, 10)], ok. do_busy_disconnect_passive(MuchoData) -> @@ -1542,8 +1236,8 @@ busy_disconnect_passive_send(S, MuchoData). busy_disconnect_passive_send(S, Data) -> - case gen_tcp:send(S, Data) of - ok -> busy_disconnect_passive_send(S, Data); + ?line case gen_tcp:send(S, Data) of + ok -> ?line busy_disconnect_passive_send(S, Data); {error,closed} -> ok end. @@ -1554,7 +1248,7 @@ %%% busy_disconnect_active(Config) when is_list(Config) -> MuchoData = list_to_binary(ones(64*1024)), - [do_busy_disconnect_active(MuchoData) || _ <- lists:seq(1, 10)], + ?line [do_busy_disconnect_active(MuchoData) || _ <- lists:seq(1, 10)], ok. do_busy_disconnect_active(MuchoData) -> @@ -1562,21 +1256,21 @@ busy_disconnect_active_send(S, MuchoData). busy_disconnect_active_send(S, Data) -> - case gen_tcp:send(S, Data) of - ok -> busy_disconnect_active_send(S, Data); + ?line case gen_tcp:send(S, Data) of + ok -> ?line busy_disconnect_active_send(S, Data); {error,closed} -> receive {tcp_closed,S} -> ok; - _Other -> ?t:fail() + _Other -> ?line ?t:fail() end end. busy_disconnect_prepare_server(ConnectOpts) -> - Sender = self(), - Server = spawn_link(fun() -> busy_disconnect_server(Sender) end), + ?line Sender = self(), + ?line Server = spawn_link(fun() -> busy_disconnect_server(Sender) end), receive {port,Server,Port} -> ok end, - {ok,S} = gen_tcp:connect(localhost, Port, ConnectOpts), + ?line {ok,S} = gen_tcp:connect(localhost, Port, ConnectOpts), Server ! {Sender,sending}, S. @@ -1610,8 +1304,8 @@ %%% Fill send queue %%% fill_sendq(Config) when is_list(Config) -> - Master = self(), - Server = + ?line Master = self(), + ?line Server = spawn_link(fun () -> {ok,L} = gen_tcp:listen (0, [{active,false},binary, @@ -1621,12 +1315,12 @@ fill_sendq_client(Port, Master)}, fill_sendq_srv(L, Master) end), - io:format("~p Server~n", [Server]), - receive {Server,client,Client} -> - io:format("~p Client~n", [Client]), - receive {Server,reader,Reader} -> - io:format("~p Reader~n", [Reader]), - fill_sendq_loop(Server, Client, Reader) + ?line io:format("~p Server~n", [Server]), + ?line receive {Server,client,Client} -> + ?line io:format("~p Client~n", [Client]), + ?line receive {Server,reader,Reader} -> + ?line io:format("~p Reader~n", [Reader]), + ?line fill_sendq_loop(Server, Client, Reader) end end. @@ -1637,21 +1331,21 @@ fill_sendq_loop(Server, Client, Reader) after 2000 -> %% Send queue full, sender blocked -> close client. - io:format("Send timeout, closing Client...~n", []), - Client ! {self(),close}, - receive {Server,[{error,closed}]} -> - io:format("Got server closed.~n"), - receive {Reader,[{error,closed}]} -> - io:format + ?line io:format("Send timeout, closing Client...~n", []), + ?line Client ! {self(),close}, + ?line receive {Server,[{error,closed}]} -> + ?line io:format("Got server closed.~n"), + ?line receive {Reader,[{error,closed}]} -> + ?line io:format ("Got reader closed.~n"), ok after 3000 -> ?t:fail({timeout,{closed,reader}}) end; {Reader,[{error,closed}]} -> - io:format("Got reader closed.~n"), - receive {Server,[{error,closed}]} -> - io:format("Got server closed~n"), + ?line io:format("Got reader closed.~n"), + ?line receive {Server,[{error,closed}]} -> + ?line io:format("Got server closed~n"), ok after 3000 -> ?t:fail({timeout,{closed,server}}) @@ -1722,39 +1416,39 @@ %%% a closed socket. %%% partial_recv_and_close(Config) when is_list(Config) -> - Msg = "the quick brown fox jumps over a lazy dog 0123456789\n", - Len = length(Msg), - {ok,L} = gen_tcp:listen(0, [{active,false}]), - {ok,P} = inet:port(L), - {ok,S} = gen_tcp:connect("localhost", P, [{active,false}]), - {ok,A} = gen_tcp:accept(L), - ok = gen_tcp:send(S, Msg), - ok = gen_tcp:close(S), - {error,closed} = gen_tcp:recv(A, Len+1), + ?line Msg = "the quick brown fox jumps over a lazy dog 0123456789\n", + ?line Len = length(Msg), + ?line {ok,L} = gen_tcp:listen(0, [{active,false}]), + ?line {ok,P} = inet:port(L), + ?line {ok,S} = gen_tcp:connect("localhost", P, [{active,false}]), + ?line {ok,A} = gen_tcp:accept(L), + ?line ok = gen_tcp:send(S, Msg), + ?line ok = gen_tcp:close(S), + ?line {error,closed} = gen_tcp:recv(A, Len+1), ok. %%% Try to receive more than available number of bytes from %%% a closed socket, this time waiting in the recv before closing. %%% partial_recv_and_close_2(Config) when is_list(Config) -> - Msg = "the quick brown fox jumps over a lazy dog 0123456789\n", - Len = length(Msg), - {ok,L} = gen_tcp:listen(0, [{active,false}]), - {ok,P} = inet:port(L), - Server = self(), - Client = + ?line Msg = "the quick brown fox jumps over a lazy dog 0123456789\n", + ?line Len = length(Msg), + ?line {ok,L} = gen_tcp:listen(0, [{active,false}]), + ?line {ok,P} = inet:port(L), + ?line Server = self(), + ?line Client = spawn_link( fun () -> receive after 2000 -> ok end, {ok,S} = gen_tcp:connect("localhost", P, [{active,false}]), - ok = gen_tcp:send(S, Msg), + ?line ok = gen_tcp:send(S, Msg), receive {Server,close} -> ok end, receive after 2000 -> ok end, - ok = gen_tcp:close(S) + ?line ok = gen_tcp:close(S) end), - {ok,A} = gen_tcp:accept(L), - Client ! {Server,close}, - {error,closed} = gen_tcp:recv(A, Len+1), + ?line {ok,A} = gen_tcp:accept(L), + ?line Client ! {Server,close}, + ?line {error,closed} = gen_tcp:recv(A, Len+1), ok. %%% Here we tests that gen_tcp:recv/2 will return {error,closed} following @@ -1777,151 +1471,151 @@ receive {port,Port} -> ok end, - Much = ones(8*64*1024), - {ok,S} = gen_tcp:connect(localhost, Port, [{active,false}]), + ?line Much = ones(8*64*1024), + ?line {ok,S} = gen_tcp:connect(localhost, Port, [{active,false}]), %% Send a lot of data (most of it will be queued). The receiver will read one byte %% and close the connection. The write operation will fail. - gen_tcp:send(S, Much), + ?line gen_tcp:send(S, Much), %% We should always get {error,closed} here. - {error,closed} = gen_tcp:recv(S, 0). + ?line {error,closed} = gen_tcp:recv(S, 0). test_prio_put_get() -> Tos = 3 bsl 5, - {ok,L1} = gen_tcp:listen(0, [{active,false}]), - ok = inet:setopts(L1,[{priority,3}]), - ok = inet:setopts(L1,[{tos,Tos}]), - {ok,[{priority,3},{tos,Tos}]} = inet:getopts(L1,[priority,tos]), - ok = inet:setopts(L1,[{priority,3}]), % Dont destroy each other - {ok,[{priority,3},{tos,Tos}]} = inet:getopts(L1,[priority,tos]), - ok = inet:setopts(L1,[{reuseaddr,true}]), % Dont let others destroy - {ok,[{priority,3},{tos,Tos}]} = inet:getopts(L1,[priority,tos]), - gen_tcp:close(L1), + ?line {ok,L1} = gen_tcp:listen(0, [{active,false}]), + ?line ok = inet:setopts(L1,[{priority,3}]), + ?line ok = inet:setopts(L1,[{tos,Tos}]), + ?line {ok,[{priority,3},{tos,Tos}]} = inet:getopts(L1,[priority,tos]), + ?line ok = inet:setopts(L1,[{priority,3}]), % Dont destroy each other + ?line {ok,[{priority,3},{tos,Tos}]} = inet:getopts(L1,[priority,tos]), + ?line ok = inet:setopts(L1,[{reuseaddr,true}]), % Dont let others destroy + ?line {ok,[{priority,3},{tos,Tos}]} = inet:getopts(L1,[priority,tos]), + ?line gen_tcp:close(L1), ok. test_prio_accept() -> - {ok,Sock}=gen_tcp:listen(0,[binary,{packet,0},{active,false}, - {reuseaddr,true},{priority,4}]), - {ok,Port} = inet:port(Sock), - {ok,Sock2}=gen_tcp:connect("localhost",Port,[binary,{packet,0}, - {active,false}, - {reuseaddr,true}, - {priority,4}]), - {ok,Sock3}=gen_tcp:accept(Sock), - {ok,[{priority,4}]} = inet:getopts(Sock,[priority]), - {ok,[{priority,4}]} = inet:getopts(Sock2,[priority]), - {ok,[{priority,4}]} = inet:getopts(Sock3,[priority]), - gen_tcp:close(Sock), - gen_tcp:close(Sock2), - gen_tcp:close(Sock3), + ?line {ok,Sock}=gen_tcp:listen(0,[binary,{packet,0},{active,false}, + {reuseaddr,true},{priority,4}]), + ?line {ok,Port} = inet:port(Sock), + ?line {ok,Sock2}=gen_tcp:connect("localhost",Port,[binary,{packet,0}, + {active,false}, + {reuseaddr,true}, + {priority,4}]), + ?line {ok,Sock3}=gen_tcp:accept(Sock), + ?line {ok,[{priority,4}]} = inet:getopts(Sock,[priority]), + ?line {ok,[{priority,4}]} = inet:getopts(Sock2,[priority]), + ?line {ok,[{priority,4}]} = inet:getopts(Sock3,[priority]), + ?line gen_tcp:close(Sock), + ?line gen_tcp:close(Sock2), + ?line gen_tcp:close(Sock3), ok. test_prio_accept2() -> Tos1 = 4 bsl 5, Tos2 = 3 bsl 5, - {ok,Sock}=gen_tcp:listen(0,[binary,{packet,0},{active,false}, - {reuseaddr,true},{priority,4}, - {tos,Tos1}]), - {ok,Port} = inet:port(Sock), - {ok,Sock2}=gen_tcp:connect("localhost",Port,[binary,{packet,0}, - {active,false}, - {reuseaddr,true}, - {priority,4}, - {tos,Tos2}]), - {ok,Sock3}=gen_tcp:accept(Sock), - {ok,[{priority,4},{tos,Tos1}]} = inet:getopts(Sock,[priority,tos]), - {ok,[{priority,4},{tos,Tos2}]} = inet:getopts(Sock2,[priority,tos]), - {ok,[{priority,4},{tos,Tos1}]} = inet:getopts(Sock3,[priority,tos]), - gen_tcp:close(Sock), - gen_tcp:close(Sock2), - gen_tcp:close(Sock3), + ?line {ok,Sock}=gen_tcp:listen(0,[binary,{packet,0},{active,false}, + {reuseaddr,true},{priority,4}, + {tos,Tos1}]), + ?line {ok,Port} = inet:port(Sock), + ?line {ok,Sock2}=gen_tcp:connect("localhost",Port,[binary,{packet,0}, + {active,false}, + {reuseaddr,true}, + {priority,4}, + {tos,Tos2}]), + ?line {ok,Sock3}=gen_tcp:accept(Sock), + ?line {ok,[{priority,4},{tos,Tos1}]} = inet:getopts(Sock,[priority,tos]), + ?line {ok,[{priority,4},{tos,Tos2}]} = inet:getopts(Sock2,[priority,tos]), + ?line {ok,[{priority,4},{tos,Tos1}]} = inet:getopts(Sock3,[priority,tos]), + ?line gen_tcp:close(Sock), + ?line gen_tcp:close(Sock2), + ?line gen_tcp:close(Sock3), ok. test_prio_accept3() -> Tos1 = 4 bsl 5, Tos2 = 3 bsl 5, - {ok,Sock}=gen_tcp:listen(0,[binary,{packet,0},{active,false}, - {reuseaddr,true}, - {tos,Tos1}]), - {ok,Port} = inet:port(Sock), - {ok,Sock2}=gen_tcp:connect("localhost",Port,[binary,{packet,0}, - {active,false}, - {reuseaddr,true}, - {tos,Tos2}]), - {ok,Sock3}=gen_tcp:accept(Sock), - {ok,[{priority,0},{tos,Tos1}]} = inet:getopts(Sock,[priority,tos]), - {ok,[{priority,0},{tos,Tos2}]} = inet:getopts(Sock2,[priority,tos]), - {ok,[{priority,0},{tos,Tos1}]} = inet:getopts(Sock3,[priority,tos]), - gen_tcp:close(Sock), - gen_tcp:close(Sock2), - gen_tcp:close(Sock3), + ?line {ok,Sock}=gen_tcp:listen(0,[binary,{packet,0},{active,false}, + {reuseaddr,true}, + {tos,Tos1}]), + ?line {ok,Port} = inet:port(Sock), + ?line {ok,Sock2}=gen_tcp:connect("localhost",Port,[binary,{packet,0}, + {active,false}, + {reuseaddr,true}, + {tos,Tos2}]), + ?line {ok,Sock3}=gen_tcp:accept(Sock), + ?line {ok,[{priority,0},{tos,Tos1}]} = inet:getopts(Sock,[priority,tos]), + ?line {ok,[{priority,0},{tos,Tos2}]} = inet:getopts(Sock2,[priority,tos]), + ?line {ok,[{priority,0},{tos,Tos1}]} = inet:getopts(Sock3,[priority,tos]), + ?line gen_tcp:close(Sock), + ?line gen_tcp:close(Sock2), + ?line gen_tcp:close(Sock3), ok. test_prio_accept_async() -> Tos1 = 4 bsl 5, Tos2 = 3 bsl 5, Ref = make_ref(), - spawn(?MODULE,priority_server,[{self(),Ref}]), - Port = receive - {Ref,P} -> P - after 5000 -> ?t:fail({error,"helper process timeout"}) - end, - receive - after 3000 -> ok - end, - {ok,Sock2}=gen_tcp:connect("localhost",Port,[binary,{packet,0}, - {active,false}, - {reuseaddr,true}, - {priority,4}, - {tos,Tos2}]), - receive - {Ref,{ok,[{priority,4},{tos,Tos1}]}} -> - ok; - {Ref,Error} -> - ?t:fail({missmatch,Error}) - after 5000 -> ?t:fail({error,"helper process timeout"}) - end, - receive - {Ref,{ok,[{priority,4},{tos,Tos1}]}} -> - ok; - {Ref,Error2} -> - ?t:fail({missmatch,Error2}) - after 5000 -> ?t:fail({error,"helper process timeout"}) - end, - - {ok,[{priority,4},{tos,Tos2}]} = inet:getopts(Sock2,[priority,tos]), - catch gen_tcp:close(Sock2), + ?line spawn(?MODULE,priority_server,[{self(),Ref}]), + ?line Port = receive + {Ref,P} -> P + after 5000 -> ?t:fail({error,"helper process timeout"}) + end, + ?line receive + after 3000 -> ok + end, + ?line {ok,Sock2}=gen_tcp:connect("localhost",Port,[binary,{packet,0}, + {active,false}, + {reuseaddr,true}, + {priority,4}, + {tos,Tos2}]), + ?line receive + {Ref,{ok,[{priority,4},{tos,Tos1}]}} -> + ok ; + {Ref,Error} -> + ?t:fail({missmatch,Error}) + after 5000 -> ?t:fail({error,"helper process timeout"}) + end, + ?line receive + {Ref,{ok,[{priority,4},{tos,Tos1}]}} -> + ok ; + {Ref,Error2} -> + ?t:fail({missmatch,Error2}) + after 5000 -> ?t:fail({error,"helper process timeout"}) + end, + + ?line {ok,[{priority,4},{tos,Tos2}]} = inet:getopts(Sock2,[priority,tos]), + ?line catch gen_tcp:close(Sock2), ok. priority_server({Parent,Ref}) -> Tos1 = 4 bsl 5, - {ok,Sock}=gen_tcp:listen(0,[binary,{packet,0},{active,false}, - {reuseaddr,true},{priority,4}, - {tos,Tos1}]), - {ok,Port} = inet:port(Sock), + ?line {ok,Sock}=gen_tcp:listen(0,[binary,{packet,0},{active,false}, + {reuseaddr,true},{priority,4}, + {tos,Tos1}]), + ?line {ok,Port} = inet:port(Sock), Parent ! {Ref,Port}, - {ok,Sock3}=gen_tcp:accept(Sock), + ?line {ok,Sock3}=gen_tcp:accept(Sock), Parent ! {Ref, inet:getopts(Sock,[priority,tos])}, Parent ! {Ref, inet:getopts(Sock3,[priority,tos])}, ok. test_prio_fail() -> - {ok,L} = gen_tcp:listen(0, [{active,false}]), - {error,_} = inet:setopts(L,[{priority,1000}]), + ?line {ok,L} = gen_tcp:listen(0, [{active,false}]), + ?line {error,_} = inet:setopts(L,[{priority,1000}]), % This error could only happen in linux kernels earlier than 2.6.24.4 % Privilege check is now disabled and IP_TOS can never fail (only silently % be masked). -% {error,_} = inet:setopts(L,[{tos,6 bsl 5}]), - gen_tcp:close(L), +% ?line {error,_} = inet:setopts(L,[{tos,6 bsl 5}]), + ?line gen_tcp:close(L), ok. test_prio_udp() -> Tos = 3 bsl 5, - {ok,S} = gen_udp:open(0,[{active,false},binary,{tos, Tos}, - {priority,3}]), - {ok,[{priority,3},{tos,Tos}]} = inet:getopts(S,[priority,tos]), - gen_udp:close(S), + ?line {ok,S} = gen_udp:open(0,[{active,false},binary,{tos, Tos}, + {priority,3}]), + ?line {ok,[{priority,3},{tos,Tos}]} = inet:getopts(S,[priority,tos]), + ?line gen_udp:close(S), ok. so_priority(doc) -> @@ -1929,9 +1623,9 @@ so_priority(suite) -> []; so_priority(Config) when is_list(Config) -> - {ok,L} = gen_tcp:listen(0, [{active,false}]), - ok = inet:setopts(L,[{priority,1}]), - case inet:getopts(L,[priority]) of + ?line {ok,L} = gen_tcp:listen(0, [{active,false}]), + ?line ok = inet:setopts(L,[{priority,1}]), + ?line case inet:getopts(L,[priority]) of {ok,[{priority,1}]} -> gen_tcp:close(L), test_prio_put_get(), @@ -1947,7 +1641,7 @@ {unix,linux} -> case os:version() of {X,Y,_} when (X > 2) or ((X =:= 2) and (Y >= 4)) -> - ?t:fail({error, + ?line ?t:fail({error, "so_priority should work on this " "OS, but does not"}); _ -> @@ -1961,21 +1655,21 @@ %% Accept test utilities (suites are below) millis() -> - erlang:monotonic_time(milli_seconds). + {A,B,C}=erlang:now(), + (A*1000000*1000)+(B*1000)+(C div 1000). -collect_accepts(0,_) -> []; -collect_accepts(N,Tmo) -> +collect_accepts(Tmo) -> A = millis(), receive {accepted,P,Msg} -> - [{P,Msg}] ++ collect_accepts(N-1,Tmo-(millis() - A)) + [{P,Msg}] ++ collect_accepts(Tmo-(millis() - A)) after Tmo -> [] end. --define(EXPECT_ACCEPTS(Pattern,N,Timeout), +-define(EXPECT_ACCEPTS(Pattern,Timeout), (fun() -> - case collect_accepts(if N =:= infinity -> -1; true -> N end,Timeout) of + case collect_accepts(Timeout) of Pattern -> ok; Other -> @@ -2011,20 +1705,20 @@ primitive_accept(doc) -> ["Test singular accept"]; primitive_accept(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - {ok,PortNo}=inet:port(LS), - Parent = self(), - F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end, - P = spawn(F), - gen_tcp:connect("localhost",PortNo,[]), - receive - {accepted,P,{ok,P0}} when is_port(P0) -> - ok; - {accepted,P,Other0} -> - {error,Other0} - after 500 -> - {error,timeout} - end. + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line {ok,PortNo}=inet:port(LS), + ?line Parent = self(), + ?line F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end, + ?line P = spawn(F), + ?line gen_tcp:connect("localhost",PortNo,[]), + ?line receive + {accepted,P,{ok,P0}} when is_port(P0) -> + ok; + {accepted,P,Other0} -> + {error,Other0} + after 500 -> + {error,timeout} + end. multi_accept_close_listen(suite) -> @@ -2032,175 +1726,111 @@ multi_accept_close_listen(doc) -> ["Closing listen socket when multi-accepting"]; multi_accept_close_listen(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end, - spawn(F), - spawn(F), - spawn(F), - spawn(F), - gen_tcp:close(LS), - ok = ?EXPECT_ACCEPTS([{_,{error,closed}},{_,{error,closed}}, - {_,{error,closed}},{_,{error,closed}}],4,500). + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line Parent = self(), + ?line F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end, + ?line spawn(F), + ?line spawn(F), + ?line spawn(F), + ?line spawn(F), + ?line gen_tcp:close(LS), + ?line ?EXPECT_ACCEPTS([{_,{error,closed}},{_,{error,closed}}, + {_,{error,closed}},{_,{error,closed}}], 500). accept_timeout(suite) -> []; accept_timeout(doc) -> ["Single accept with timeout"]; accept_timeout(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS,1000)} end, - P = spawn(F), - ok = ?EXPECT_ACCEPTS([{P,{error,timeout}}],1,2000). + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line Parent = self(), + ?line F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS,1000)} end, + ?line P = spawn(F), + ?line ?EXPECT_ACCEPTS([{P,{error,timeout}}],2000). accept_timeouts_in_order(suite) -> []; accept_timeouts_in_order(doc) -> ["Check that multi-accept timeouts happen in the correct order"]; accept_timeouts_in_order(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - P1 = spawn(mktmofun(1000,Parent,LS)), - P2 = spawn(mktmofun(1200,Parent,LS)), - P3 = spawn(mktmofun(1300,Parent,LS)), - P4 = spawn(mktmofun(1400,Parent,LS)), - ok = ?EXPECT_ACCEPTS([{P1,{error,timeout}},{P2,{error,timeout}}, - {P3,{error,timeout}},{P4,{error,timeout}}],infinity,2000). + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line Parent = self(), + ?line P1 = spawn(mktmofun(1000,Parent,LS)), + ?line P2 = spawn(mktmofun(1200,Parent,LS)), + ?line P3 = spawn(mktmofun(1300,Parent,LS)), + ?line P4 = spawn(mktmofun(1400,Parent,LS)), + ?line ?EXPECT_ACCEPTS([{P1,{error,timeout}},{P2,{error,timeout}}, + {P3,{error,timeout}},{P4,{error,timeout}}], 2000). accept_timeouts_in_order2(suite) -> []; accept_timeouts_in_order2(doc) -> ["Check that multi-accept timeouts happen in the correct order (more)"]; accept_timeouts_in_order2(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - P1 = spawn(mktmofun(1400,Parent,LS)), - P2 = spawn(mktmofun(1300,Parent,LS)), - P3 = spawn(mktmofun(1200,Parent,LS)), - P4 = spawn(mktmofun(1000,Parent,LS)), - ok = ?EXPECT_ACCEPTS([{P4,{error,timeout}},{P3,{error,timeout}}, - {P2,{error,timeout}},{P1,{error,timeout}}],infinity,2000). + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line Parent = self(), + ?line P1 = spawn(mktmofun(1400,Parent,LS)), + ?line P2 = spawn(mktmofun(1300,Parent,LS)), + ?line P3 = spawn(mktmofun(1200,Parent,LS)), + ?line P4 = spawn(mktmofun(1000,Parent,LS)), + ?line ?EXPECT_ACCEPTS([{P4,{error,timeout}},{P3,{error,timeout}}, + {P2,{error,timeout}},{P1,{error,timeout}}], 2000). accept_timeouts_in_order3(suite) -> []; accept_timeouts_in_order3(doc) -> ["Check that multi-accept timeouts happen in the correct order (even more)"]; accept_timeouts_in_order3(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - P1 = spawn(mktmofun(1200,Parent,LS)), - P2 = spawn(mktmofun(1400,Parent,LS)), - P3 = spawn(mktmofun(1300,Parent,LS)), - P4 = spawn(mktmofun(1000,Parent,LS)), - ok = ?EXPECT_ACCEPTS([{P4,{error,timeout}},{P1,{error,timeout}}, - {P3,{error,timeout}},{P2,{error,timeout}}],infinity,2000). - -accept_timeouts_in_order4(suite) -> - []; -accept_timeouts_in_order4(doc) -> - ["Check that multi-accept timeouts happen in the correct order after " - "mixing millsec and sec timeouts"]; -accept_timeouts_in_order4(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - P1 = spawn(mktmofun(200,Parent,LS)), - P2 = spawn(mktmofun(400,Parent,LS)), - P3 = spawn(mktmofun(1000,Parent,LS)), - P4 = spawn(mktmofun(600,Parent,LS)), - ok = ?EXPECT_ACCEPTS([{P1,{error,timeout}},{P2,{error,timeout}}, - {P4,{error,timeout}},{P3,{error,timeout}}],infinity,2000). - -accept_timeouts_in_order5(suite) -> - []; -accept_timeouts_in_order5(doc) -> - ["Check that multi-accept timeouts happen in the correct order after " - "mixing millsec and sec timeouts (more)"]; -accept_timeouts_in_order5(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - P1 = spawn(mktmofun(400,Parent,LS)), - P2 = spawn(mktmofun(1000,Parent,LS)), - P3 = spawn(mktmofun(600,Parent,LS)), - P4 = spawn(mktmofun(200,Parent,LS)), - ok = ?EXPECT_ACCEPTS([{P4,{error,timeout}},{P1,{error,timeout}}, - {P3,{error,timeout}},{P2,{error,timeout}}],infinity,2000). - -accept_timeouts_in_order6(suite) -> - []; -accept_timeouts_in_order6(doc) -> - ["Check that multi-accept timeouts happen in the correct order after " - "mixing millsec and sec timeouts (even more)"]; -accept_timeouts_in_order6(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - P1 = spawn(mktmofun(1000,Parent,LS)), - P2 = spawn(mktmofun(400,Parent,LS)), - P3 = spawn(mktmofun(600,Parent,LS)), - P4 = spawn(mktmofun(200,Parent,LS)), - ok = ?EXPECT_ACCEPTS([{P4,{error,timeout}},{P2,{error,timeout}}, - {P3,{error,timeout}},{P1,{error,timeout}}],infinity,2000). - -accept_timeouts_in_order7(suite) -> - []; -accept_timeouts_in_order7(doc) -> - ["Check that multi-accept timeouts happen in the correct order after " - "mixing millsec and sec timeouts (even more++)"]; -accept_timeouts_in_order7(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - P1 = spawn(mktmofun(1000,Parent,LS)), - P2 = spawn(mktmofun(200,Parent,LS)), - P3 = spawn(mktmofun(1200,Parent,LS)), - P4 = spawn(mktmofun(600,Parent,LS)), - P5 = spawn(mktmofun(400,Parent,LS)), - P6 = spawn(mktmofun(800,Parent,LS)), - P7 = spawn(mktmofun(1600,Parent,LS)), - P8 = spawn(mktmofun(1400,Parent,LS)), - ok = ?EXPECT_ACCEPTS([{P2,{error,timeout}},{P5,{error,timeout}}, - {P4,{error,timeout}},{P6,{error,timeout}}, - {P1,{error,timeout}},{P3,{error,timeout}}, - {P8,{error,timeout}},{P7,{error,timeout}}],infinity,2000). + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line Parent = self(), + ?line P1 = spawn(mktmofun(1200,Parent,LS)), + ?line P2 = spawn(mktmofun(1400,Parent,LS)), + ?line P3 = spawn(mktmofun(1300,Parent,LS)), + ?line P4 = spawn(mktmofun(1000,Parent,LS)), + ?line ?EXPECT_ACCEPTS([{P4,{error,timeout}},{P1,{error,timeout}}, + {P3,{error,timeout}},{P2,{error,timeout}}], 2000). accept_timeouts_mixed(suite) -> []; accept_timeouts_mixed(doc) -> ["Check that multi-accept timeouts behave correctly when mixed with successful timeouts"]; accept_timeouts_mixed(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - {ok,PortNo}=inet:port(LS), - P1 = spawn(mktmofun(1000,Parent,LS)), - wait_until_accepting(P1,500), - P2 = spawn(mktmofun(2000,Parent,LS)), - wait_until_accepting(P2,500), - P3 = spawn(mktmofun(3000,Parent,LS)), - wait_until_accepting(P3,500), - P4 = spawn(mktmofun(4000,Parent,LS)), - wait_until_accepting(P4,500), - ok = ?EXPECT_ACCEPTS([{P1,{error,timeout}}],infinity,1500), - {ok,_}=gen_tcp:connect("localhost",PortNo,[]), - ok = ?EXPECT_ACCEPTS([{P2,{ok,Port0}}] when is_port(Port0),infinity,100), - ok = ?EXPECT_ACCEPTS([{P3,{error,timeout}}],infinity,2000), - gen_tcp:connect("localhost",PortNo,[]), - ok = ?EXPECT_ACCEPTS([{P4,{ok,Port1}}] when is_port(Port1),infinity,100). + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line Parent = self(), + ?line {ok,PortNo}=inet:port(LS), + ?line P1 = spawn(mktmofun(1000,Parent,LS)), + ?line wait_until_accepting(P1,500), + ?line P2 = spawn(mktmofun(2000,Parent,LS)), + ?line wait_until_accepting(P2,500), + ?line P3 = spawn(mktmofun(3000,Parent,LS)), + ?line wait_until_accepting(P3,500), + ?line P4 = spawn(mktmofun(4000,Parent,LS)), + ?line wait_until_accepting(P4,500), + ?line ok = ?EXPECT_ACCEPTS([{P1,{error,timeout}}],1500), + ?line {ok,_}=gen_tcp:connect("localhost",PortNo,[]), + ?line ok = ?EXPECT_ACCEPTS([{P2,{ok,Port0}}] when is_port(Port0),100), + ?line ok = ?EXPECT_ACCEPTS([{P3,{error,timeout}}],2000), + ?line gen_tcp:connect("localhost",PortNo,[]), + ?line ?EXPECT_ACCEPTS([{P4,{ok,Port1}}] when is_port(Port1),100). killing_acceptor(suite) -> []; killing_acceptor(doc) -> ["Check that single acceptor behaves as expected when killed"]; killing_acceptor(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Pid = spawn(fun() -> erlang:display({accepted,self(),gen_tcp:accept(LS)}) end), - receive after 100 -> ok - end, - {ok,L1} = prim_inet:getstatus(LS), - true = lists:member(accepting, L1), - exit(Pid,kill), - receive after 100 -> ok - end, - {ok,L2} = prim_inet:getstatus(LS), - false = lists:member(accepting, L2), + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line Pid = spawn(fun() -> erlang:display({accepted,self(),gen_tcp:accept(LS)}) end), + ?line receive after 100 -> + ok + end, + ?line {ok,L1} = prim_inet:getstatus(LS), + ?line true = lists:member(accepting, L1), + ?line exit(Pid,kill), + ?line receive after 100 -> + ok + end, + ?line {ok,L2} = prim_inet:getstatus(LS), + ?line false = lists:member(accepting, L2), ok. killing_multi_acceptors(suite) -> @@ -2208,24 +1838,26 @@ killing_multi_acceptors(doc) -> ["Check that multi acceptors behaves as expected when killed"]; killing_multi_acceptors(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end, - F2 = mktmofun(1000,Parent,LS), - Pid = spawn(F), - Pid2 = spawn(F2), - receive after 100 -> ok - end, - {ok,L1} = prim_inet:getstatus(LS), - true = lists:member(accepting, L1), - exit(Pid,kill), - receive after 100 -> ok - end, - {ok,L2} = prim_inet:getstatus(LS), - true = lists:member(accepting, L2), - ok = ?EXPECT_ACCEPTS([{Pid2,{error,timeout}}],1,1000), - {ok,L3} = prim_inet:getstatus(LS), - false = lists:member(accepting, L3), + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line Parent = self(), + ?line F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end, + ?line F2 = mktmofun(1000,Parent,LS), + ?line Pid = spawn(F), + ?line Pid2 = spawn(F2), + ?line receive after 100 -> + ok + end, + ?line {ok,L1} = prim_inet:getstatus(LS), + ?line true = lists:member(accepting, L1), + ?line exit(Pid,kill), + ?line receive after 100 -> + ok + end, + ?line {ok,L2} = prim_inet:getstatus(LS), + ?line true = lists:member(accepting, L2), + ?line ok = ?EXPECT_ACCEPTS([{Pid2,{error,timeout}}],1000), + ?line {ok,L3} = prim_inet:getstatus(LS), + ?line false = lists:member(accepting, L3), ok. killing_multi_acceptors2(suite) -> @@ -2233,36 +1865,40 @@ killing_multi_acceptors2(doc) -> ["Check that multi acceptors behaves as expected when killed (more)"]; killing_multi_acceptors2(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - {ok,PortNo}=inet:port(LS), - F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end, - F2 = mktmofun(1000,Parent,LS), - Pid = spawn(F), - Pid2 = spawn(F), - receive after 100 -> ok - end, - {ok,L1} = prim_inet:getstatus(LS), - true = lists:member(accepting, L1), - exit(Pid,kill), - receive after 100 -> ok - end, - {ok,L2} = prim_inet:getstatus(LS), - true = lists:member(accepting, L2), - exit(Pid2,kill), - receive after 100 -> ok - end, - {ok,L3} = prim_inet:getstatus(LS), - false = lists:member(accepting, L3), - Pid3 = spawn(F2), - receive after 100 -> ok - end, - {ok,L4} = prim_inet:getstatus(LS), - true = lists:member(accepting, L4), - gen_tcp:connect("localhost",PortNo,[]), - ok = ?EXPECT_ACCEPTS([{Pid3,{ok,Port}}] when is_port(Port),1,100), - {ok,L5} = prim_inet:getstatus(LS), - false = lists:member(accepting, L5), + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line Parent = self(), + ?line {ok,PortNo}=inet:port(LS), + ?line F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end, + ?line F2 = mktmofun(1000,Parent,LS), + ?line Pid = spawn(F), + ?line Pid2 = spawn(F), + ?line receive after 100 -> + ok + end, + ?line {ok,L1} = prim_inet:getstatus(LS), + ?line true = lists:member(accepting, L1), + ?line exit(Pid,kill), + ?line receive after 100 -> + ok + end, + ?line {ok,L2} = prim_inet:getstatus(LS), + ?line true = lists:member(accepting, L2), + ?line exit(Pid2,kill), + ?line receive after 100 -> + ok + end, + ?line {ok,L3} = prim_inet:getstatus(LS), + ?line false = lists:member(accepting, L3), + ?line Pid3 = spawn(F2), + ?line receive after 100 -> + ok + end, + ?line {ok,L4} = prim_inet:getstatus(LS), + ?line true = lists:member(accepting, L4), + ?line gen_tcp:connect("localhost",PortNo,[]), + ?line ok = ?EXPECT_ACCEPTS([{Pid3,{ok,Port}}] when is_port(Port),100), + ?line {ok,L5} = prim_inet:getstatus(LS), + ?line false = lists:member(accepting, L5), ok. several_accepts_in_one_go(suite) -> @@ -2271,19 +1907,33 @@ ["checks that multi-accept works when more than one accept can be " "done at once (wb test of inet_driver)"]; several_accepts_in_one_go(Config) when is_list(Config) -> - {ok,LS}=gen_tcp:listen(0,[]), - Parent = self(), - {ok,PortNo}=inet:port(LS), - F1 = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end, - F2 = fun() -> Parent ! {connected,self(),gen_tcp:connect("localhost",PortNo,[])} end, - Ns = lists:seq(1,8), - _ = [spawn(F1) || _ <- Ns], - ok = ?EXPECT_ACCEPTS([],1,500), % wait for tmo - _ = [spawn(F2) || _ <- Ns], - ok = ?EXPECT_ACCEPTS([{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}}],8,15000), - ok = ?EXPECT_CONNECTS([{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}}],1000), + ?line {ok,LS}=gen_tcp:listen(0,[]), + ?line Parent = self(), + ?line {ok,PortNo}=inet:port(LS), + ?line F1 = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end, + ?line F2 = fun() -> Parent ! {connected,self(),gen_tcp:connect("localhost",PortNo,[])} end, + ?line spawn(F1), + ?line spawn(F1), + ?line spawn(F1), + ?line spawn(F1), + ?line spawn(F1), + ?line spawn(F1), + ?line spawn(F1), + ?line spawn(F1), + ?line ok = ?EXPECT_ACCEPTS([],500), + ?line spawn(F2), + ?line spawn(F2), + ?line spawn(F2), + ?line spawn(F2), + ?line spawn(F2), + ?line spawn(F2), + ?line spawn(F2), + ?line spawn(F2), + ?line ok = ?EXPECT_ACCEPTS([{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}}],15000), + ?line ok = ?EXPECT_CONNECTS([{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}}],1000), ok. + flush(Msgs) -> erlang:yield(), receive Msg -> flush([Msg|Msgs]) @@ -2318,13 +1968,13 @@ ["Check that accept returns {error, system_limit} " "(and not {error, enfile}) when running out of ports"]; accept_system_limit(Config) when is_list(Config) -> - {ok, LS} = gen_tcp:listen(0, []), - {ok, TcpPort} = inet:port(LS), + ?line {ok, LS} = gen_tcp:listen(0, []), + ?line {ok, TcpPort} = inet:port(LS), Me = self(), - Connector = spawn_link(fun () -> connector(TcpPort, Me) end), + ?line Connector = spawn_link(fun () -> connector(TcpPort, Me) end), receive {Connector, sync} -> Connector ! {self(), continue} end, - ok = acceptor(LS, false, []), - Connector ! stop, + ?line ok = acceptor(LS, false, []), + ?line Connector ! stop, ok. acceptor(LS, GotSL, A) -> @@ -2371,49 +2021,49 @@ ["Check that active once and tcp_close messages behave as expected"]; active_once_closed(Config) when is_list(Config) -> (fun() -> - {Loop,A} = setup_closed_ao(), - Loop({{error,closed},{error,econnaborted}}, + ?line {Loop,A} = setup_closed_ao(), + ?line Loop({{error,closed},{error,econnaborted}}, fun() -> gen_tcp:send(A,"Hello") end), - ok = inet:setopts(A,[{active,once}]), - ok = receive {tcp_closed, A} -> ok after 1000 -> error end, - {error,einval} = inet:setopts(A,[{active,once}]), - ok = receive {tcp_closed, A} -> error after 1000 -> ok end + ?line ok = inet:setopts(A,[{active,once}]), + ?line ok = receive {tcp_closed, A} -> ok after 1000 -> error end, + ?line {error,einval} = inet:setopts(A,[{active,once}]), + ?line ok = receive {tcp_closed, A} -> error after 1000 -> ok end end)(), (fun() -> - {Loop,A} = setup_closed_ao(), - Loop({{error,closed},{error,econnaborted}}, + ?line {Loop,A} = setup_closed_ao(), + ?line Loop({{error,closed},{error,econnaborted}}, fun() -> gen_tcp:send(A,"Hello") end), - ok = inet:setopts(A,[{active,true}]), - ok = receive {tcp_closed, A} -> ok after 1000 -> error end, - {error,einval} = inet:setopts(A,[{active,true}]), - ok = receive {tcp_closed, A} -> error after 1000 -> ok end + ?line ok = inet:setopts(A,[{active,true}]), + ?line ok = receive {tcp_closed, A} -> ok after 1000 -> error end, + ?line {error,einval} = inet:setopts(A,[{active,true}]), + ?line ok = receive {tcp_closed, A} -> error after 1000 -> ok end end)(), (fun() -> - {Loop,A} = setup_closed_ao(), - Loop({{error,closed},{error,econnaborted}}, + ?line {Loop,A} = setup_closed_ao(), + ?line Loop({{error,closed},{error,econnaborted}}, fun() -> gen_tcp:send(A,"Hello") end), - ok = inet:setopts(A,[{active,true}]), - ok = receive {tcp_closed, A} -> ok after 1000 -> error end, - {error,einval} = inet:setopts(A,[{active,once}]), - ok = receive {tcp_closed, A} -> error after 1000 -> ok end + ?line ok = inet:setopts(A,[{active,true}]), + ?line ok = receive {tcp_closed, A} -> ok after 1000 -> error end, + ?line {error,einval} = inet:setopts(A,[{active,once}]), + ?line ok = receive {tcp_closed, A} -> error after 1000 -> ok end end)(), (fun() -> - {Loop,A} = setup_closed_ao(), - Loop({{error,closed},{error,econnaborted}}, + ?line {Loop,A} = setup_closed_ao(), + ?line Loop({{error,closed},{error,econnaborted}}, fun() -> gen_tcp:send(A,"Hello") end), - ok = inet:setopts(A,[{active,once}]), - ok = receive {tcp_closed, A} -> ok after 1000 -> error end, - {error,einval} = inet:setopts(A,[{active,true}]), - ok = receive {tcp_closed, A} -> error after 1000 -> ok end + ?line ok = inet:setopts(A,[{active,once}]), + ?line ok = receive {tcp_closed, A} -> ok after 1000 -> error end, + ?line {error,einval} = inet:setopts(A,[{active,true}]), + ?line ok = receive {tcp_closed, A} -> error after 1000 -> ok end end)(), (fun() -> - {Loop,A} = setup_closed_ao(), - Loop({{error,closed},{error,econnaborted}}, + ?line {Loop,A} = setup_closed_ao(), + ?line Loop({{error,closed},{error,econnaborted}}, fun() -> gen_tcp:send(A,"Hello") end), - ok = inet:setopts(A,[{active,false}]), - ok = receive {tcp_closed, A} -> error after 1000 -> ok end, - ok = inet:setopts(A,[{active,once}]), - ok = receive {tcp_closed, A} -> ok after 1000 -> error end + ?line ok = inet:setopts(A,[{active,false}]), + ?line ok = receive {tcp_closed, A} -> error after 1000 -> ok end, + ?line ok = inet:setopts(A,[{active,once}]), + ?line ok = receive {tcp_closed, A} -> ok after 1000 -> error end end)(). send_timeout(suite) -> @@ -2422,10 +2072,10 @@ ["Test the send_timeout socket option"]; send_timeout(Config) when is_list(Config) -> %% Basic - BasicFun = + BasicFun = fun(AutoClose) -> - {Loop,A,RNode} = setup_timeout_sink(1000, AutoClose), - {error,timeout} = + ?line {Loop,A,RNode} = setup_timeout_sink(1000, AutoClose), + ?line {error,timeout} = Loop(fun() -> Res = gen_tcp:send(A,<<1:10000>>), %%erlang:display(Res), @@ -2433,63 +2083,64 @@ end), %% Check that the socket is not busy/closed... Error = after_send_timeout(AutoClose), - {error,Error} = gen_tcp:send(A,<<"Hej">>), - test_server:stop_node(RNode) + ?line {error,Error} = gen_tcp:send(A,<<"Hej">>), + ?line test_server:stop_node(RNode) end, BasicFun(false), BasicFun(true), %% Check timeout length - Self = self(), - Pid = spawn(fun() -> - {Loop,A,RNode} = setup_timeout_sink(1000, true), - {error,timeout} = Loop(fun() -> - Res = gen_tcp:send(A,<<1:10000>>), - %%erlang:display(Res), - Self ! Res, - Res - end), - test_server:stop_node(RNode) - end), - Diff = get_max_diff(), - io:format("Max time for send: ~p~n",[Diff]), - true = (Diff > 500) and (Diff < 1500), + ?line Self = self(), + ?line Pid = + spawn(fun() -> + {Loop,A,RNode} = setup_timeout_sink(1000, true), + {error,timeout} = + Loop(fun() -> + Res = gen_tcp:send(A,<<1:10000>>), + %%erlang:display(Res), + Self ! Res, + Res + end), + test_server:stop_node(RNode) + end), + ?line Diff = get_max_diff(), + ?line io:format("Max time for send: ~p~n",[Diff]), + ?line true = (Diff > 500) and (Diff < 1500), %% Let test_server slave die... - Mon = erlang:monitor(process, Pid), - receive {'DOWN',Mon,process,Pid,_} -> ok end, + ?line Mon = erlang:monitor(process, Pid), + ?line receive {'DOWN',Mon,process,Pid,_} -> ok end, %% Check that parallell writers do not hang forever - ParaFun = + ParaFun = fun(AutoClose) -> - {Loop,A,RNode} = setup_timeout_sink(1000, AutoClose), + ?line {Loop,A,RNode} = setup_timeout_sink(1000, AutoClose), SenderFun = fun() -> - {error,Error} = + {error,Error} = Loop(fun() -> gen_tcp:send(A, <<1:10000>>) end), Self ! {error,Error} end, - spawn_link(SenderFun), - spawn_link(SenderFun), - receive - {error,timeout} -> ok - after 10000 -> - exit(timeout) - end, + ?line spawn_link(SenderFun), + ?line spawn_link(SenderFun), + ?line receive + {error,timeout} -> ok + after 10000 -> + ?line exit(timeout) + end, NextErr = after_send_timeout(AutoClose), - receive - {error,NextErr} -> ok - after 10000 -> - exit(timeout) - end, - {error,NextErr} = gen_tcp:send(A,<<"Hej">>), - test_server:stop_node(RNode) + ?line receive + {error,NextErr} -> ok + after 10000 -> + ?line exit(timeout) + end, + ?line {error,NextErr} = gen_tcp:send(A,<<"Hej">>), + ?line test_server:stop_node(RNode) end, ParaFun(false), ParaFun(true), ok. - mad_sender(S) -> - U = rand:uniform(1000000), - case gen_tcp:send(S, integer_to_list(U)) of + {_, _, USec} = now(), + case gen_tcp:send(S, integer_to_list(USec)) of ok -> mad_sender(S); Err -> @@ -2515,25 +2166,25 @@ %% Basic BasicFun = fun(AutoClose) -> - {Loop,A,RNode,C} = setup_active_timeout_sink(1, AutoClose), + ?line {Loop,A,RNode,C} = setup_active_timeout_sink(1, AutoClose), inet:setopts(A, [{active, once}]), - Mad = spawn_link(RNode,fun() -> mad_sender(C) end), - {error,timeout} = - Loop(fun() -> - receive - {tcp, _Sock, _Data} -> - inet:setopts(A, [{active, once}]), - Res = gen_tcp:send(A,lists:duplicate(1000, $a)), - %erlang:display(Res), - Res; - Err -> - io:format("sock closed: ~p~n", [Err]), - Err - end - end), - unlink(Mad), + ?line Mad = spawn_link(RNode,fun() -> mad_sender(C) end), + ?line {error,timeout} = + Loop(fun() -> + receive + {tcp, _Sock, _Data} -> + inet:setopts(A, [{active, once}]), + Res = gen_tcp:send(A,lists:duplicate(1000, $a)), + %erlang:display(Res), + Res; + Err -> + io:format("sock closed: ~p~n", [Err]), + Err + end + end), + unlink(Mad), exit(Mad,kill), - test_server:stop_node(RNode) + ?line test_server:stop_node(RNode) end, BasicFun(false), flush(), @@ -2557,10 +2208,10 @@ end. get_max_diff(Max) -> - T1 = millis(), + T1 = millistamp(), receive ok -> - Diff = millis() - T1, + Diff = millistamp() - T1, if Diff > Max -> get_max_diff(Diff); @@ -2568,7 +2219,7 @@ get_max_diff(Max) end; {error,timeout} -> - Diff = millis() - T1, + Diff = millistamp() - T1, if Diff > Max -> Diff; @@ -2576,29 +2227,29 @@ Max end after 10000 -> - exit(timeout) + exit(timeout) end. setup_closed_ao() -> Dir = filename:dirname(code:which(?MODULE)), {ok,R} = test_server:start_node(test_default_options_slave,slave, - [{args,"-pa " ++ Dir}]), + [{args,"-pa " ++ Dir}]), Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))), {ok, L} = gen_tcp:listen(0, [{active,false},{packet,2}]), - Fun = fun(F) -> - receive - {From,X} when is_function(X) -> - From ! {self(),X()}, F(F); - die -> ok - end - end, + Fun = fun(F) -> + receive + {From,X} when is_function(X) -> + From ! {self(),X()}, F(F); + die -> ok + end + end, Pid = rpc:call(R,erlang,spawn,[fun() -> Fun(Fun) end]), {ok, Port} = inet:port(L), - Remote = fun(Fu) -> - Pid ! {self(), Fu}, - receive {Pid,X} -> X - end - end, + Remote = fun(Fu) -> + Pid ! {self(), Fu}, + receive {Pid,X} -> X + end + end, {ok, C} = Remote(fun() -> gen_tcp:connect(Host,Port, [{active,false},{packet,2}]) @@ -2606,109 +2257,113 @@ {ok,A} = gen_tcp:accept(L), gen_tcp:send(A,"Hello"), {ok, "Hello"} = Remote(fun() -> gen_tcp:recv(C,0) end), - ok = Remote(fun() -> gen_tcp:close(C) end), - Loop2 = fun(_,_,_,0) -> + ok = Remote(fun() -> gen_tcp:close(C) end), + Loop2 = fun(_,_,_,0) -> {failure, timeout}; - (L2,{MA,MB},F2,N) -> - case F2() of - MA -> MA; - MB -> MB; - Other -> io:format("~p~n",[Other]), - receive after 1000 -> ok end, - L2(L2,{MA,MB},F2,N-1) - end + (L2,{MA,MB},F2,N) -> + case F2() of + MA -> MA; + MB -> MB; + Other -> io:format("~p~n",[Other]), + receive after 1000 -> ok end, + L2(L2,{MA,MB},F2,N-1) + end end, Loop = fun(Match2,F3) -> Loop2(Loop2,Match2,F3,10) end, test_server:stop_node(R), {Loop,A}. setup_timeout_sink(Timeout, AutoClose) -> - Dir = filename:dirname(code:which(?MODULE)), - {ok,R} = test_server:start_node(test_default_options_slave,slave, - [{args,"-pa " ++ Dir}]), - Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))), - {ok, L} = gen_tcp:listen(0, [{active,false},{packet,2}, + ?line Dir = filename:dirname(code:which(?MODULE)), + ?line {ok,R} = test_server:start_node(test_default_options_slave,slave, + [{args,"-pa " ++ Dir}]), + ?line Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))), + ?line {ok, L} = gen_tcp:listen(0, [{active,false},{packet,2}, {send_timeout,Timeout}, {send_timeout_close,AutoClose}]), - Fun = fun(F) -> - receive - {From,X} when is_function(X) -> - From ! {self(),X()}, F(F); - die -> ok - end - end, - Pid = rpc:call(R,erlang,spawn,[fun() -> Fun(Fun) end]), - {ok, Port} = inet:port(L), - Remote = fun(Fu) -> - Pid ! {self(), Fu}, - receive {Pid,X} -> X - end + ?line Fun = fun(F) -> + receive + {From,X} when is_function(X) -> + From ! {self(),X()}, F(F); + die -> ok + end + end, + ?line Pid = rpc:call(R,erlang,spawn,[fun() -> Fun(Fun) end]), + ?line {ok, Port} = inet:port(L), + ?line Remote = fun(Fu) -> + Pid ! {self(), Fu}, + receive {Pid,X} -> X + end end, - {ok, C} = Remote(fun() -> + ?line {ok, C} = Remote(fun() -> gen_tcp:connect(Host,Port, - [{active,false},{packet,2}]) + [{active,false},{packet,2}]) end), - {ok,A} = gen_tcp:accept(L), - gen_tcp:send(A,"Hello"), - {ok, "Hello"} = Remote(fun() -> gen_tcp:recv(C,0) end), - Loop2 = fun(_,_,0) -> - {failure, timeout}; - (L2,F2,N) -> + ?line {ok,A} = gen_tcp:accept(L), + ?line gen_tcp:send(A,"Hello"), + ?line {ok, "Hello"} = Remote(fun() -> gen_tcp:recv(C,0) end), + ?line Loop2 = fun(_,_,0) -> + {failure, timeout}; + (L2,F2,N) -> Ret = F2(), io:format("~p~n",[Ret]), case Ret of - ok -> receive after 1 -> ok end, + ok -> receive after 1 -> ok end, L2(L2,F2,N-1); Other -> Other - end + end end, - Loop = fun(F3) -> Loop2(Loop2,F3,1000) end, + ?line Loop = fun(F3) -> Loop2(Loop2,F3,1000) end, {Loop,A,R}. setup_active_timeout_sink(Timeout, AutoClose) -> - Dir = filename:dirname(code:which(?MODULE)), - {ok,R} = test_server:start_node(test_default_options_slave,slave, - [{args,"-pa " ++ Dir}]), - Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))), - {ok, L} = gen_tcp:listen(0, [binary,{active,false},{packet,0},{nodelay, true},{keepalive, true}, + ?line Dir = filename:dirname(code:which(?MODULE)), + ?line {ok,R} = test_server:start_node(test_default_options_slave,slave, + [{args,"-pa " ++ Dir}]), + ?line Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))), + ?line {ok, L} = gen_tcp:listen(0, [binary,{active,false},{packet,0},{nodelay, true},{keepalive, true}, {send_timeout,Timeout}, {send_timeout_close,AutoClose}]), - Fun = fun(F) -> - receive - {From,X} when is_function(X) -> - From ! {self(),X()}, F(F); - die -> ok - end - end, - Pid = rpc:call(R,erlang,spawn,[fun() -> Fun(Fun) end]), - {ok, Port} = inet:port(L), - Remote = fun(Fu) -> - Pid ! {self(), Fu}, - receive {Pid,X} -> X - end + ?line Fun = fun(F) -> + receive + {From,X} when is_function(X) -> + From ! {self(),X()}, F(F); + die -> ok + end + end, + ?line Pid = rpc:call(R,erlang,spawn,[fun() -> Fun(Fun) end]), + ?line {ok, Port} = inet:port(L), + ?line Remote = fun(Fu) -> + Pid ! {self(), Fu}, + receive {Pid,X} -> X + end end, - {ok, C} = Remote(fun() -> + ?line {ok, C} = Remote(fun() -> gen_tcp:connect(Host,Port, - [{active,false}]) + [{active,false}]) end), - {ok,A} = gen_tcp:accept(L), - gen_tcp:send(A,"Hello"), - {ok, "H"++_} = Remote(fun() -> gen_tcp:recv(C,0) end), - Loop2 = fun(_,_,0) -> - {failure, timeout}; - (L2,F2,N) -> + ?line {ok,A} = gen_tcp:accept(L), + ?line gen_tcp:send(A,"Hello"), + ?line {ok, "H"++_} = Remote(fun() -> gen_tcp:recv(C,0) end), + ?line Loop2 = fun(_,_,0) -> + {failure, timeout}; + (L2,F2,N) -> Ret = F2(), io:format("~p~n",[Ret]), case Ret of - ok -> receive after 1 -> ok end, + ok -> receive after 1 -> ok end, L2(L2,F2,N-1); Other -> Other - end + end end, - Loop = fun(F3) -> Loop2(Loop2,F3,1000) end, + ?line Loop = fun(F3) -> Loop2(Loop2,F3,1000) end, {Loop,A,R,C}. +millistamp() -> + {Mega, Secs, Micros} = erlang:now(), + (Micros div 1000) + Secs * 1000 + Mega * 1000000000. + has_superfluous_schedulers() -> case {erlang:system_info(schedulers), erlang:system_info(logical_processors)} of @@ -2723,22 +2378,22 @@ "Leaking message from inet_drv {inet_reply,P,ok} " "when a socket sending resumes working after a send_timeout"; otp_7731(Config) when is_list(Config) -> - ServerPid = spawn_link(?MODULE, otp_7731_server, [self()]), - receive {ServerPid, ready, PortNum} -> ok end, + ?line ServerPid = spawn_link(?MODULE, otp_7731_server, [self()]), + ?line receive {ServerPid, ready, PortNum} -> ok end, - {ok, Socket} = gen_tcp:connect("localhost", PortNum, - [binary, {active, false}, {packet, raw}, - {send_timeout, 1000}]), + ?line {ok, Socket} = gen_tcp:connect("localhost", PortNum, + [binary, {active, false}, {packet, raw}, + {send_timeout, 1000}]), otp_7731_send(Socket), io:format("Sending complete...\n",[]), ServerPid ! {self(), recv}, - receive {ServerPid, ok} -> ok end, - + receive {ServerPid, ok} -> ok end, + io:format("Client waiting for leaking messages...\n",[]), %% Now make sure inet_drv does not leak any internal messages. receive Msg -> - test_server:fail({unexpected, Msg}) + ?line test_server:fail({unexpected, Msg}) after 1000 -> ok end, @@ -2748,15 +2403,15 @@ otp_7731_send(Socket) -> Bin = <<1:10000>>, io:format("Client sending ~p bytes...\n",[size(Bin)]), - case gen_tcp:send(Socket, Bin) of - ok -> otp_7731_send(Socket); - {error,timeout} -> ok - end. + ?line case gen_tcp:send(Socket, Bin) of + ok -> otp_7731_send(Socket); + {error,timeout} -> ok + end. otp_7731_server(ClientPid) -> - {ok, LSocket} = gen_tcp:listen(0, [binary, {packet, raw}, - {active, false}]), - {ok, {_, PortNum}} = inet:sockname(LSocket), + ?line {ok, LSocket} = gen_tcp:listen(0, [binary, {packet, raw}, + {active, false}]), + ?line {ok, {_, PortNum}} = inet:sockname(LSocket), io:format("Listening on ~w with port number ~p\n", [LSocket, PortNum]), ClientPid ! {self(), ready, PortNum}, @@ -2778,7 +2433,7 @@ otp_7731_recv(Socket) -> - case gen_tcp:recv(Socket, 0, 1000) of + ?line case gen_tcp:recv(Socket, 0, 1000) of {ok, Bin} -> io:format("Server received ~p bytes\n",[size(Bin)]), otp_7731_recv(Socket); @@ -2797,21 +2452,21 @@ register(zombie_collector,self()), Calls = 10, Server = spawn_link(?MODULE, zombie_server,[self(), Calls]), - {Server, ready, PortNum} = receive Msg -> Msg end, + ?line {Server, ready, PortNum} = receive Msg -> Msg end, io:format("Ports before = ~p\n",[lists:sort(erlang:ports())]), zombie_client_loop(Calls, PortNum), Ports = lists:sort(zombie_collector(Calls,[])), Server ! terminate, io:format("Collected ports = ~p\n",[Ports]), - [] = zombies_alive(Ports, 10), + ?line [] = zombies_alive(Ports, 10), timer:sleep(1000), ok. zombie_client_loop(0, _) -> ok; zombie_client_loop(N, PortNum) when is_integer(PortNum) -> - {ok, Socket} = gen_tcp:connect("localhost", PortNum, - [binary, {active, false}, {packet, raw}]), - gen_tcp:close(Socket), % to make server recv fail + ?line {ok, Socket} = gen_tcp:connect("localhost", PortNum, + [binary, {active, false}, {packet, raw}]), + ?line gen_tcp:close(Socket), % to make server recv fail zombie_client_loop(N-1, PortNum). @@ -2840,19 +2495,19 @@ end. zombie_server(Pid, Calls) -> - {ok, LSocket} = gen_tcp:listen(0, [binary, {packet, raw}, - {active, false}, {backlog, Calls}]), - {ok, {_, PortNum}} = inet:sockname(LSocket), + ?line {ok, LSocket} = gen_tcp:listen(0, [binary, {packet, raw}, + {active, false}, {backlog, Calls}]), + ?line {ok, {_, PortNum}} = inet:sockname(LSocket), io:format("Listening on ~w with port number ~p\n", [LSocket, PortNum]), BigBin = list_to_binary(lists:duplicate(100*1024, 77)), Pid ! {self(), ready, PortNum}, zombie_accept_loop(LSocket, BigBin, Calls), - terminate = receive Msg -> Msg end. + ?line terminate = receive Msg -> Msg end. zombie_accept_loop(_, _, 0) -> ok; zombie_accept_loop(Socket, BigBin, Calls) -> - case gen_tcp:accept(Socket) of + ?line case gen_tcp:accept(Socket) of {ok, NewSocket} -> spawn_link(fun() -> zombie_serve_client(NewSocket, BigBin) end), zombie_accept_loop(Socket, BigBin, Calls-1); @@ -2862,27 +2517,29 @@ zombie_serve_client(Socket, Bin) -> %%io:format("Got connection on ~p\n",[Socket]), - gen_tcp:send(Socket, Bin), + ?line gen_tcp:send(Socket, Bin), %%io:format("Sent data, waiting for reply on ~p\n",[Socket]), - case gen_tcp:recv(Socket, 4) of + ?line case gen_tcp:recv(Socket, 4) of {error,closed} -> ok; {error,econnaborted} -> ok % may be returned on Windows end, %%io:format("Closing ~p\n",[Socket]), - gen_tcp:close(Socket), + ?line gen_tcp:close(Socket), zombie_collector ! {closed, Socket}. + + otp_7816(suite) -> []; otp_7816(doc) -> "Hanging send on windows when sending iolist with more than 16 binaries."; otp_7816(Config) when is_list(Config) -> Client = self(), - Server = spawn_link(fun()-> otp_7816_server(Client) end), - receive {Server, ready, PortNum} -> ok end, + ?line Server = spawn_link(fun()-> otp_7816_server(Client) end), + ?line receive {Server, ready, PortNum} -> ok end, - {ok, Socket} = gen_tcp:connect("localhost", PortNum, - [binary, {active, false}, {packet, 4}, - {send_timeout, 10}]), + ?line {ok, Socket} = gen_tcp:connect("localhost", PortNum, + [binary, {active, false}, {packet, 4}, + {send_timeout, 10}]), %% We use the undocumented feature that sending can be resumed after %% a send_timeout without any data loss if the peer starts to receive data. %% Unless of course the 7816-bug is in affect, in which case the write event @@ -2892,9 +2549,9 @@ io:format("Sending complete...\n",[]), - ok = gen_tcp:close(Socket), + ?line ok = gen_tcp:close(Socket), Server ! {self(), closed}, - {Server, closed} = receive M -> M end. + ?line {Server, closed} = receive M -> M end. otp_7816_send(Socket, BinNr, BinSize, Server) -> @@ -2902,7 +2559,7 @@ SentBytes = otp_7816_send_data(Socket, Data, 0) * BinNr * BinSize, io:format("Client sent ~p bytes...\n",[SentBytes]), Server ! {self(),recv,SentBytes}, - {Server, ok} = receive M -> M end. + ?line {Server, ok} = receive M -> M end. @@ -2917,15 +2574,15 @@ otp_7816_server(Client) -> - {ok, LSocket} = gen_tcp:listen(0, [binary, {packet, 4}, + ?line {ok, LSocket} = gen_tcp:listen(0, [binary, {packet, 4}, {active, false}]), - {ok, {_, PortNum}} = inet:sockname(LSocket), + ?line {ok, {_, PortNum}} = inet:sockname(LSocket), io:format("Listening on ~w with port number ~p\n", [LSocket, PortNum]), Client ! {self(), ready, PortNum}, - {ok, CSocket} = gen_tcp:accept(LSocket), + ?line {ok, CSocket} = gen_tcp:accept(LSocket), io:format("Server got connection...\n",[]), - gen_tcp:close(LSocket), + ?line gen_tcp:close(LSocket), otp_7816_server_loop(CSocket), @@ -2939,13 +2596,13 @@ {Client, recv, RecvBytes} -> io:format("Server start receiving...\n",[]), - ok = otp_7816_recv(CSocket, RecvBytes), + ?line ok = otp_7816_recv(CSocket, RecvBytes), Client ! {self(), ok}, otp_7816_server_loop(CSocket); {Client, closed} -> - {error, closed} = gen_tcp:recv(CSocket, 0, 1000), + ?line {error, closed} = gen_tcp:recv(CSocket, 0, 1000), Client ! {self(), closed} end. @@ -2954,7 +2611,7 @@ io:format("Server got all.\n",[]), ok; otp_7816_recv(CSocket, BytesLeft) -> - case gen_tcp:recv(CSocket, 0, 1000) of + ?line case gen_tcp:recv(CSocket, 0, 1000) of {ok, Bin} when byte_size(Bin) =< BytesLeft -> io:format("Server received ~p of ~p bytes.\n",[size(Bin), BytesLeft]), otp_7816_recv(CSocket, BytesLeft - byte_size(Bin)); @@ -2966,8 +2623,8 @@ otp_8102(doc) -> ["Receive a packet with a faulty packet header"]; otp_8102(suite) -> []; otp_8102(Config) when is_list(Config) -> - {ok, LSocket} = gen_tcp:listen(0, []), - {ok, {_, PortNum}} = inet:sockname(LSocket), + ?line {ok, LSocket} = gen_tcp:listen(0, []), + ?line {ok, {_, PortNum}} = inet:sockname(LSocket), io:format("Listening on ~w with port number ~p\n", [LSocket, PortNum]), [otp_8102_do(LSocket, PortNum, otp_8102_packet(Type,Size)) @@ -2987,18 +2644,18 @@ otp_8102_do(LSocket, PortNum, {Bin,PType}) -> io:format("Connect with packet option ~p ...\n",[PType]), - {ok, RSocket} = gen_tcp:connect("localhost", PortNum, [binary, + ?line {ok, RSocket} = gen_tcp:connect("localhost", PortNum, [binary, {packet,PType}, {active,true}]), - {ok, SSocket} = gen_tcp:accept(LSocket), + ?line {ok, SSocket} = gen_tcp:accept(LSocket), io:format("Got connection, sending ~p...\n",[Bin]), - ok = gen_tcp:send(SSocket, Bin), + ?line ok = gen_tcp:send(SSocket, Bin), io:format("Sending complete...\n",[]), - {tcp_error,RSocket,emsgsize} = receive M -> M end, + ?line {tcp_error,RSocket,emsgsize} = receive M -> M end, io:format("Got error msg, ok.\n",[]), gen_tcp:close(SSocket), @@ -3007,61 +2664,61 @@ otp_9389(doc) -> ["Verify packet_size handles long HTTP header lines"]; otp_9389(suite) -> []; otp_9389(Config) when is_list(Config) -> - {ok, LS} = gen_tcp:listen(0, [{active,false}]), - {ok, {_, PortNum}} = inet:sockname(LS), + ?line {ok, LS} = gen_tcp:listen(0, [{active,false}]), + ?line {ok, {_, PortNum}} = inet:sockname(LS), io:format("Listening on ~w with port number ~p\n", [LS, PortNum]), OrigLinkHdr = "/" ++ string:chars($S, 8192), _Server = spawn_link( fun() -> - {ok, S} = gen_tcp:accept(LS), - ok = inet:setopts(S, [{packet_size, 16384}]), - ok = otp_9389_loop(S, OrigLinkHdr), - ok = gen_tcp:close(S) + ?line {ok, S} = gen_tcp:accept(LS), + ?line ok = inet:setopts(S, [{packet_size, 16384}]), + ?line ok = otp_9389_loop(S, OrigLinkHdr), + ?line ok = gen_tcp:close(S) end), - {ok, S} = gen_tcp:connect("localhost", PortNum, + ?line {ok, S} = gen_tcp:connect("localhost", PortNum, [binary, {active, false}]), Req = "GET / HTTP/1.1\r\n" ++ "Host: localhost\r\n" ++ "Link: " ++ OrigLinkHdr ++ "\r\n\r\n", - ok = gen_tcp:send(S, Req), - ok = inet:setopts(S, [{packet, http}]), - {ok, {http_response, {1,1}, 200, "OK"}} = gen_tcp:recv(S, 0), - ok = inet:setopts(S, [{packet, httph}, {packet_size, 16384}]), - {ok, {http_header, _, 'Content-Length', _, "0"}} = gen_tcp:recv(S, 0), - {ok, {http_header, _, "Link", _, LinkHdr}} = gen_tcp:recv(S, 0), - true = (LinkHdr == OrigLinkHdr), + ?line ok = gen_tcp:send(S, Req), + ?line ok = inet:setopts(S, [{packet, http}]), + ?line {ok, {http_response, {1,1}, 200, "OK"}} = gen_tcp:recv(S, 0), + ?line ok = inet:setopts(S, [{packet, httph}, {packet_size, 16384}]), + ?line {ok, {http_header, _, 'Content-Length', _, "0"}} = gen_tcp:recv(S, 0), + ?line {ok, {http_header, _, "Link", _, LinkHdr}} = gen_tcp:recv(S, 0), + ?line true = (LinkHdr == OrigLinkHdr), ok = gen_tcp:close(S), ok = gen_tcp:close(LS), ok. otp_9389_loop(S, OrigLinkHdr) -> - ok = inet:setopts(S, [{active,once},{packet,http}]), + ?line ok = inet:setopts(S, [{active,once},{packet,http}]), receive {http, S, {http_request, 'GET', _, _}} -> - ok = otp_9389_loop(S, OrigLinkHdr, undefined) + ?line ok = otp_9389_loop(S, OrigLinkHdr, undefined) after 3000 -> - error({timeout,request_line}) + ?line error({timeout,request_line}) end. otp_9389_loop(S, OrigLinkHdr, ok) -> - Resp = "HTTP/1.1 200 OK\r\nContent-length: 0\r\n" ++ + ?line Resp = "HTTP/1.1 200 OK\r\nContent-length: 0\r\n" ++ "Link: " ++ OrigLinkHdr ++ "\r\n\r\n", - ok = gen_tcp:send(S, Resp); + ?line ok = gen_tcp:send(S, Resp); otp_9389_loop(S, OrigLinkHdr, State) -> - ok = inet:setopts(S, [{active,once}, {packet,httph}]), + ?line ok = inet:setopts(S, [{active,once}, {packet,httph}]), receive {http, S, http_eoh} -> - otp_9389_loop(S, OrigLinkHdr, ok); + ?line otp_9389_loop(S, OrigLinkHdr, ok); {http, S, {http_header, _, "Link", _, LinkHdr}} -> - LinkHdr = OrigLinkHdr, - otp_9389_loop(S, OrigLinkHdr, State); + ?line LinkHdr = OrigLinkHdr, + ?line otp_9389_loop(S, OrigLinkHdr, State); {http, S, {http_header, _, _Hdr, _, _Val}} -> - otp_9389_loop(S, OrigLinkHdr, State); + ?line otp_9389_loop(S, OrigLinkHdr, State); {http, S, {http_error, Err}} -> - error({error, Err}) + ?line error({error, Err}) after 3000 -> - error({timeout,header}) + ?line error({timeout,header}) end. wrapping_oct(doc) -> @@ -3072,7 +2729,7 @@ {ok,Sock} = gen_tcp:listen(0,[{active,false},{mode,binary}]), {ok,Port} = inet:port(Sock), spawn_link(?MODULE,oct_acceptor,[Sock]), - Res = oct_datapump(Port,16#10000FFFF), + Res = oct_datapump(Port,16#1FFFFFFFF), gen_tcp:close(Sock), ok = Res, ok. diff -Nru erlang-18.2-dfsg/lib/kernel/test/gen_udp_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/gen_udp_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/gen_udp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/gen_udp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/global_group_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/global_group_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/global_group_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/global_group_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/global_SUITE_data/global_trace.erl erlang-17.3-dfsg/lib/kernel/test/global_SUITE_data/global_trace.erl --- erlang-18.2-dfsg/lib/kernel/test/global_SUITE_data/global_trace.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/global_SUITE_data/global_trace.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/global_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/global_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/global_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/global_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/heart_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/heart_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/heart_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/heart_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -563,15 +562,13 @@ generate(Module, Attributes, FunStrings) -> FunForms = function_forms(FunStrings), Forms = [ - {attribute,a(1),module,Module}, - {attribute,a(2),export,[FA || {FA,_} <- FunForms]} - ] ++ [{attribute, a(3), A, V}|| {A, V} <- Attributes] ++ + {attribute,1,module,Module}, + {attribute,2,export,[FA || {FA,_} <- FunForms]} + ] ++ [{attribute, 3, A, V}|| {A, V} <- Attributes] ++ [ Function || {_, Function} <- FunForms], {ok, Module, Bin} = compile:forms(Forms), Bin. -a(L) -> - erl_anno:new(L). function_forms([]) -> []; function_forms([S|Ss]) -> diff -Nru erlang-18.2-dfsg/lib/kernel/test/ignore_cores.erl erlang-17.3-dfsg/lib/kernel/test/ignore_cores.erl --- erlang-18.2-dfsg/lib/kernel/test/ignore_cores.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/ignore_cores.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/inet_res_SUITE_data/run-named erlang-17.3-dfsg/lib/kernel/test/inet_res_SUITE_data/run-named --- erlang-18.2-dfsg/lib/kernel/test/inet_res_SUITE_data/run-named 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/inet_res_SUITE_data/run-named 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2009-2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/lib/kernel/test/inet_res_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/inet_res_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/inet_res_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/inet_res_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/inet_sockopt_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/inet_sockopt_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/inet_sockopt_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/inet_sockopt_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -52,7 +51,6 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, simple/1, loop_all/1, simple_raw/1, simple_raw_getbin/1, - multiple_raw/1, multiple_raw_getbin/1, doc_examples_raw/1,doc_examples_raw_getbin/1, large_raw/1,large_raw_getbin/1,combined/1,combined_getbin/1, ipv6_v6only_udp/1, ipv6_v6only_tcp/1, ipv6_v6only_sctp/1, @@ -66,7 +64,6 @@ all() -> [simple, loop_all, simple_raw, simple_raw_getbin, - multiple_raw, multiple_raw_getbin, doc_examples_raw, doc_examples_raw_getbin, large_raw, large_raw_getbin, combined, combined_getbin, ipv6_v6only_udp, ipv6_v6only_tcp, ipv6_v6only_sctp, @@ -187,84 +184,6 @@ nintbin2int(<>) -> Int; nintbin2int(<<>>) -> 0. - - -multiple_raw(suite) -> []; -multiple_raw(doc) -> "Test setopt/getopt of multiple raw options."; -multiple_raw(Config) when is_list(Config) -> - do_multiple_raw(Config,false). -multiple_raw_getbin(suite) -> []; -multiple_raw_getbin(doc) -> "Test setopt/getopt of multiple raw options, " - "with binaries in getopt."; -multiple_raw_getbin(Config) when is_list(Config) -> - do_multiple_raw(Config,true). - -do_multiple_raw(Config, Binary) -> - Port = start_helper(Config), - SolSocket = ask_helper(Port, ?C_GET_SOL_SOCKET), - SoKeepalive = ask_helper(Port, ?C_GET_SO_KEEPALIVE), - SoKeepaliveTrue = {raw,SolSocket,SoKeepalive,<<1:32/native>>}, - SoKeepaliveFalse = {raw,SolSocket,SoKeepalive,<<0:32/native>>}, - SoReuseaddr = ask_helper(Port, ?C_GET_SO_REUSEADDR), - SoReuseaddrTrue = {raw,SolSocket,SoReuseaddr,<<1:32/native>>}, - SoReuseaddrFalse = {raw,SolSocket,SoReuseaddr,<<0:32/native>>}, - {S1,S2} = - create_socketpair( - [SoReuseaddrFalse,SoKeepaliveTrue], - [SoKeepaliveFalse,SoReuseaddrTrue]), - {ok,[{reuseaddr,false},{keepalive,true}]} = - inet:getopts(S1, [reuseaddr,keepalive]), - {ok, - [{raw,SolSocket,SoReuseaddr,S1R1}, - {raw,SolSocket,SoKeepalive,S1K1}]} = - inet:getopts( - S1, - [{raw,SolSocket,SoReuseaddr,binarify(4, Binary)}, - {raw,SolSocket,SoKeepalive,binarify(4, Binary)}]), - true = nintbin2int(S1R1) =:= 0, - true = nintbin2int(S1K1) =/= 0, - {ok,[{keepalive,false},{reuseaddr,true}]} = - inet:getopts(S2, [keepalive,reuseaddr]), - {ok, - [{raw,SolSocket,SoKeepalive,S2K1}, - {raw,SolSocket,SoReuseaddr,S2R1}]} = - inet:getopts( - S2, - [{raw,SolSocket,SoKeepalive,binarify(4, Binary)}, - {raw,SolSocket,SoReuseaddr,binarify(4, Binary)}]), - true = nintbin2int(S2K1) =:= 0, - true = nintbin2int(S2R1) =/= 0, - %% - ok = inet:setopts( - S1, [SoReuseaddrTrue,SoKeepaliveFalse]), - ok = inet:setopts( - S2, [SoKeepaliveTrue,SoReuseaddrFalse]), - {ok, - [{raw,SolSocket,SoReuseaddr,S1R2}, - {raw,SolSocket,SoKeepalive,S1K2}]} = - inet:getopts( - S1, - [{raw,SolSocket,SoReuseaddr,binarify(4, Binary)}, - {raw,SolSocket,SoKeepalive,binarify(4, Binary)}]), - true = nintbin2int(S1R2) =/= 0, - true = nintbin2int(S1K2) =:= 0, - {ok, - [{raw,SolSocket,SoKeepalive,S2K2}, - {raw,SolSocket,SoReuseaddr,S2R2}]} = - inet:getopts( - S2, - [{raw,SolSocket,SoKeepalive,binarify(4, Binary)}, - {raw,SolSocket,SoReuseaddr,binarify(4, Binary)}]), - true = nintbin2int(S2K2) =/= 0, - true = nintbin2int(S2R2) =:= 0, - %% - gen_tcp:close(S1), - gen_tcp:close(S2), - stop_helper(Port), - ok. - - - doc_examples_raw(suite) -> []; doc_examples_raw(doc) -> "Test that the example code from the documentation " "works"; diff -Nru erlang-18.2-dfsg/lib/kernel/test/inet_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/inet_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/inet_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/inet_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -37,10 +36,9 @@ gethostnative_parallell/1, cname_loop/1, gethostnative_soft_restart/0, gethostnative_soft_restart/1, gethostnative_debug_level/0, gethostnative_debug_level/1, - lookup_bad_search_option/1, getif/1, getif_ifr_name_overflow/1,getservbyname_overflow/1, getifaddrs/1, - parse_strict_address/1, simple_netns/1, simple_netns_open/1]). + parse_strict_address/1, simple_netns/1]). -export([get_hosts/1, get_ipv6_hosts/1, parse_hosts/1, parse_address/1, kill_gethost/0, parallell_gethost/0, test_netns/0]). @@ -54,9 +52,8 @@ ipv4_to_ipv6, host_and_addr, {group, parse}, t_gethostnative, gethostnative_parallell, cname_loop, gethostnative_debug_level, gethostnative_soft_restart, - lookup_bad_search_option, getif, getif_ifr_name_overflow, getservbyname_overflow, - getifaddrs, parse_strict_address, simple_netns, simple_netns_open]. + getifaddrs, parse_strict_address, simple_netns]. groups() -> [{parse, [], [parse_hosts, parse_address]}]. @@ -89,30 +86,10 @@ end_per_group(_GroupName, Config) -> Config. -init_per_testcase(lookup_bad_search_option, Config) -> - Db = inet_db, - Key = res_lookup, - %% The bad option can not enter through inet_db:set_lookup/1, - %% but through e.g .inetrc. - Prev = ets:lookup(Db, Key), - ets:delete(Db, Key), - ets:insert(Db, {Key,[lookup_bad_search_option]}), - ?t:format("Misconfigured resolver lookup order", []), - Dog = test_server:timetrap(test_server:seconds(60)), - [{Key,Prev},{watchdog,Dog}|Config]; init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(60)), [{watchdog,Dog}|Config]. -end_per_testcase(lookup_bad_search_option, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - Db = inet_db, - Key = res_lookup, - Prev = ?config(Key, Config), - ets:delete(Db, Key), - ets:insert(Db, Prev), - ?t:format("Restored resolver lookup order", []); end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). @@ -121,37 +98,36 @@ required(v4). t_gethostbyaddr(doc) -> "Test the inet:gethostbyaddr/1 function."; t_gethostbyaddr(Config) when is_list(Config) -> - {Name,FullName,IPStr,{A,B,C,D}=IP,Aliases,_,_} = ct:get_config(test_host_ipv4_only), - Rname = integer_to_list(D) ++ "." ++ - integer_to_list(C) ++ "." ++ - integer_to_list(B) ++ "." ++ - integer_to_list(A) ++ ".in-addr.arpa", - {ok,HEnt} = inet:gethostbyaddr(IPStr), - {ok,HEnt} = inet:gethostbyaddr(IP), - {error,Error} = inet:gethostbyaddr(Name), - ok = io:format("Failure reason: ~p: ~s", [error,inet:format_error(Error)]), - HEnt_ = HEnt#hostent{h_addrtype = inet, - h_length = 4, - h_addr_list = [IP]}, - HEnt_ = HEnt, + ?line {Name,FullName,IPStr,{A,B,C,D}=IP,Aliases,_,_} = + ct:get_config(test_host_ipv4_only), + ?line Rname = integer_to_list(D) ++ "." ++ + integer_to_list(C) ++ "." ++ + integer_to_list(B) ++ "." ++ + integer_to_list(A) ++ ".in-addr.arpa", + ?line {ok,HEnt} = inet:gethostbyaddr(IPStr), + ?line {ok,HEnt} = inet:gethostbyaddr(IP), + ?line {error,Error} = inet:gethostbyaddr(Name), + ?line ok = io:format("Failure reason: ~p: ~s", + [error,inet:format_error(Error)]), + ?line HEnt_ = HEnt#hostent{h_addrtype = inet, + h_length = 4, + h_addr_list = [IP]}, + ?line HEnt_ = HEnt, case {os:type(),os:version()} of - {{unix,freebsd},{5,0,0}} -> - %% The alias list seems to be buggy in FreeBSD 5.0.0. - check_elems([{HEnt#hostent.h_name,[Name,FullName]}]), - io:format("Buggy alias list: ~p", [HEnt#hostent.h_aliases]), - ok; - _ -> - io:format("alias list: ~p", [HEnt#hostent.h_aliases]), - io:format("check alias list: ~p", [[Aliases,[Rname]]]), - io:format("name: ~p", [HEnt#hostent.h_name]), - io:format("check name: ~p", [[Name,FullName]]), - check_elems([{HEnt#hostent.h_name,[Name,FullName]}, - {HEnt#hostent.h_aliases,[[],Aliases,[Rname]]}]) + {{unix,freebsd},{5,0,0}} -> + %% The alias list seems to be buggy in FreeBSD 5.0.0. + ?line check_elems([{HEnt#hostent.h_name,[Name,FullName]}]), + io:format("Buggy alias list: ~p", [HEnt#hostent.h_aliases]), + ok; + _ -> + ?line check_elems([{HEnt#hostent.h_name,[Name,FullName]}, + {HEnt#hostent.h_aliases,[[],Aliases,[Rname]]}]) end, - {_DName, _DFullName, DIPStr, DIP, _, _, _} = ct:get_config(test_dummy_host), - {error,nxdomain} = inet:gethostbyaddr(DIPStr), - {error,nxdomain} = inet:gethostbyaddr(DIP), + ?line {_DName, _DFullName, DIPStr, DIP, _, _, _} = + ct:get_config(test_dummy_host), + ?line {error,nxdomain} = inet:gethostbyaddr(DIPStr), + ?line {error,nxdomain} = inet:gethostbyaddr(DIP), ok. t_gethostbyaddr_v6() -> required(v6). @@ -571,11 +547,8 @@ "::-1", "::g", "f:f11::10100:2", - "f:f11::01100:2", "::17000", - "::01700", "10000::", - "01000::", "::8:7:6:5:4:3:2:1", "8:7:6:5:4:3:2:1::", "8:7:6:5:4::3:2:1", @@ -935,19 +908,6 @@ -lookup_bad_search_option(suite) -> - []; -lookup_bad_search_option(doc) -> - ["Test lookup with erroneously configured lookup option (OTP-12133)"]; -lookup_bad_search_option(Config) when is_list(Config) -> - %% Manipulation of resolver config is done in init_per_testcase - %% and end_per_testcase to ensure cleanup. - {ok,Hostname} = inet:gethostname(), - {ok,_Hent} = inet:gethostbyname(Hostname), % Will hang loop for this bug - ok. - - - getif(suite) -> []; getif(doc) -> @@ -1168,32 +1128,6 @@ ok. -simple_netns_open(Config) when is_list(Config) -> - case gen_udp:open(0, [binary,{netns,"/"},inet]) of - {ok,U} -> - ok = gen_udp:close(U); - {error,E1} when E1 =:= einval; E1 =:= eperm -> - ok - end, - case gen_tcp:listen(0, [binary,{netns,"/"},inet]) of - {ok,T} -> - ok = gen_tcp:close(T); - {error,E2} when E2 =:= einval; E2 =:= eperm -> - ok - end, - try gen_sctp:open(0, [binary,{netns,"/"},inet]) of - {ok,S} -> - ok = gen_sctp:close(S); - {error,E3} - when E3 =:= einval; E3 =:= eperm; E3 =:= eprotonosupport -> - ok - catch - error:badarg -> - %% Some older platforms does not allow netns for sctp - ok - end. - - %% Manual test to be run outside test_server in an emulator %% started by root, in a machine with setns() support... test_netns() -> diff -Nru erlang-18.2-dfsg/lib/kernel/test/init_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/init_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/init_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/init_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/interactive_shell_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/interactive_shell_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/interactive_shell_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/interactive_shell_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -49,7 +48,12 @@ []. init_per_suite(Config) -> - Term = os:getenv("TERM", "dumb"), + Term = case os:getenv("TERM") of + List when is_list(List) -> + List; + _ -> + "dumb" + end, os:putenv("TERM","vt100"), DefShell = get_default_shell(), [{default_shell,DefShell},{term,Term}|Config]. @@ -292,7 +296,6 @@ ctrl_keys(_Conf) when is_list(_Conf) -> Cu=[$\^u], Cw=[$\^w], - Cy=[$\^y], Home=[27,$O,$H], End=[27,$O,$F], rtnode([{putline,""}, @@ -305,8 +308,6 @@ {putline,"world\"."++Home++"\"hello "}, % test {getline,"\"hello world\""}, {putline,"world"++Home++"\"hello "++End++"\"."}, % test - {getline,"\"hello world\""}, - {putline,"\"hello world\""++Cu++Cy++"."}, {getline,"\"hello world\""}] ++wordLeft()++wordRight(),[]). @@ -719,7 +720,8 @@ end. millistamp() -> - erlang:monotonic_time(milli_seconds). + {Mega, Secs, Micros} = erlang:now(), + (Micros div 1000) + Secs * 1000 + Mega * 1000000000. get_data_within(Port, X, Acc) when X =< 0 -> ?dbg({get_data_within, X, Acc, ?LINE}), diff -Nru erlang-18.2-dfsg/lib/kernel/test/kernel_config_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/kernel_config_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/kernel_config_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/kernel_config_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/kernel_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/kernel_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/kernel_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/kernel_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -80,29 +79,17 @@ appup_tests(_App,{[],[]}) -> {skip,"no previous releases available"}; -appup_tests(App,{OkVsns0,NokVsns}) -> +appup_tests(App,{OkVsns,NokVsns}) -> application:load(App), {_,_,Vsn} = lists:keyfind(App,1,application:loaded_applications()), AppupFileName = atom_to_list(App) ++ ".appup", AppupFile = filename:join([code:lib_dir(App),ebin,AppupFileName]), {ok,[{Vsn,UpFrom,DownTo}=AppupScript]} = file:consult(AppupFile), ct:log("~p~n",[AppupScript]), - OkVsns = - case OkVsns0 -- [Vsn] of - OkVsns0 -> - OkVsns0; - Ok -> - ct:log("Current version, ~p, is same as in previous release.~n" - "Removing this from the list of ok versions.", - [Vsn]), - Ok - end, - ct:log("Testing that appup allows upgrade from these versions: ~p~n", - [OkVsns]), + ct:log("Testing ok versions: ~p~n",[OkVsns]), check_appup(OkVsns,UpFrom,{ok,[restart_new_emulator]}), check_appup(OkVsns,DownTo,{ok,[restart_new_emulator]}), - ct:log("Testing that appup does not allow upgrade from these versions: ~p~n", - [NokVsns]), + ct:log("Testing not ok versions: ~p~n",[NokVsns]), check_appup(NokVsns,UpFrom,error), check_appup(NokVsns,DownTo,error), ok. diff -Nru erlang-18.2-dfsg/lib/kernel/test/loose_node.erl erlang-17.3-dfsg/lib/kernel/test/loose_node.erl --- erlang-18.2-dfsg/lib/kernel/test/loose_node.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/loose_node.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/Makefile erlang-17.3-dfsg/lib/kernel/test/Makefile --- erlang-18.2-dfsg/lib/kernel/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -78,8 +77,7 @@ ignore_cores \ zlib_SUITE \ loose_node \ - sendfile_SUITE \ - standard_error_SUITE + sendfile_SUITE APP_FILES = \ appinc.app \ diff -Nru erlang-18.2-dfsg/lib/kernel/test/myApp.erl erlang-17.3-dfsg/lib/kernel/test/myApp.erl --- erlang-18.2-dfsg/lib/kernel/test/myApp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/myApp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/os_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/os_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/os_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/os_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/pdict_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/pdict_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/pdict_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/pdict_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -32,7 +31,7 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, - simple/1, complicated/1, heavy/1, simple_all_keys/1, info/1]). + simple/1, complicated/1, heavy/1, info/1]). -export([init_per_testcase/2, end_per_testcase/2]). -export([other_process/2]). @@ -47,7 +46,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [simple, complicated, heavy, simple_all_keys, info]. + [simple, complicated, heavy, info]. groups() -> []. @@ -71,7 +70,6 @@ []; simple(Config) when is_list(Config) -> XX = get(), - ok = match_keys(XX), erase(), L = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p, q,r,s,t,u,v,x,y,z,'A','B','C','D'], @@ -107,7 +105,6 @@ complicated(Config) when is_list(Config) -> Previous = get(), - ok = match_keys(Previous), Previous = erase(), N = case ?t:is_debug() of false -> 500000; @@ -116,10 +113,8 @@ comp_1(N), comp_2(N), N = comp_3(lists:sort(get()), 1), - ok = match_keys(get()), comp_4(get()), [] = get(), - [] = get_keys(), [put(Key, Value) || {Key,Value} <- Previous], ok. @@ -165,26 +160,6 @@ [put(Key, Value) || {Key,Value} <- XX], ok. -simple_all_keys(Config) when is_list(Config) -> - erase(), - ok = simple_all_keys_add_loop(1000), - [] = get_keys(), - [] = get(), - ok. - -simple_all_keys_add_loop(0) -> - simple_all_keys_del_loop(erlang:get_keys()); -simple_all_keys_add_loop(N) -> - put(gen_key(N),value), - ok = match_keys(get()), - simple_all_keys_add_loop(N-1). - -simple_all_keys_del_loop([]) -> ok; -simple_all_keys_del_loop([K|Ks]) -> - value = erase(K), - ok = match_keys(get()), - simple_all_keys_del_loop(Ks). - info(doc) -> ["Tests process_info(Pid, dictionary)"]; info(suite) -> @@ -364,8 +339,3 @@ [A,B,Module,Line]), exit({no_match,{A,B},Module,Line}) end. - -match_keys(All) -> - Ks = lists:sort([K||{K,_}<-All]), - Ks = lists:sort(erlang:get_keys()), - ok. diff -Nru erlang-18.2-dfsg/lib/kernel/test/pg2_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/pg2_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/pg2_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/pg2_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %%---------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/kernel/test/prim_file_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/prim_file_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/prim_file_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/prim_file_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -263,7 +262,7 @@ ?line {error, enoent} = ?PRIM_FILE_call(del_dir, Handle, [NewDir]), % Make sure we are not in a directory directly under test_server - % as that would result in eacces errors when trying to delete '..', + % as that would result in eacess errors when trying to delere '..', % because there are processes having that directory as current. ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir]), ?line {ok, CurrentDir} = ?PRIM_FILE_call(get_cwd, Handle, []), diff -Nru erlang-18.2-dfsg/lib/kernel/test/ram_file_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/ram_file_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/ram_file_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/ram_file_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/rpc_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/rpc_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/rpc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/rpc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -457,33 +456,32 @@ call_benchmark(Config) when is_list(Config) -> Timetrap = ?t:timetrap(?t:seconds(120)), - PA = filename:dirname(code:which(?MODULE)), - {ok, Node} = ?t:start_node(rpc_SUITE_call_benchmark, slave, - [{args, "-pa " ++ PA}]), + ?line PA = filename:dirname(code:which(?MODULE)), + ?line {ok, Node} = ?t:start_node(rpc_SUITE_call_benchmark, slave, + [{args, "-pa " ++ PA}]), Iter = case erlang:system_info(modified_timing_level) of undefined -> 10000; - _ -> 500 %Modified timing - spawn is slower + _ -> 500 %Moified timing - spawn is slower end, - Res = do_call_benchmark(Node, Iter), - ?t:stop_node(Node), + ?line do_call_benchmark(Node, Iter), ?t:timetrap_cancel(Timetrap), - Res. + ok. do_call_benchmark(Node, M) when is_integer(M), M > 0 -> - {Micros,ok} = timer:tc(fun() -> - do_call_benchmark(Node, 0, M) - end), - Calls = 3*M, - S = io_lib:format("~p RPC calls/second", [Calls*1000000 div Micros]), - {comment,lists:flatten(S)}. - -do_call_benchmark(_Node, M, M) -> - ok; -do_call_benchmark(Node, I, M) -> - Node = rpc:call(Node, erlang, node, []), - _ = rpc:call(Node, erlang, whereis, [rex]), - 3 = rpc:call(Node, erlang, '+', [1,2]), - do_call_benchmark(Node, I+1, M). + do_call_benchmark(Node, erlang:now(), 0, M). + +do_call_benchmark(Node, {A,B,C}, M, M) -> + ?line {D,E,F} = erlang:now(), + ?line T = float(D-A)*1000000.0 + float(E-B) + float(F-C)*0.000001, + ?line Q = 3.0 * float(M) / T, + ?line ?t:stop_node(Node), + {comment, + lists:flatten([float_to_list(Q)," RPC calls per second"])}; +do_call_benchmark(Node, Then, I, M) -> + ?line Node = rpc:call(Node, erlang, node, []), + ?line _ = rpc:call(Node, erlang, whereis, [rex]), + ?line 3 = rpc:call(Node, erlang, '+', [1,2]), + ?line do_call_benchmark(Node, Then, I+1, M). async_call(Config) when is_list(Config) -> Dog = ?t:timetrap(?t:seconds(120)), diff -Nru erlang-18.2-dfsg/lib/kernel/test/sendfile_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/sendfile_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/sendfile_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/sendfile_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/seq_trace_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/seq_trace_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/seq_trace_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/seq_trace_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/standard_error_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/standard_error_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/standard_error_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/standard_error_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2014. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - --module(standard_error_SUITE). - --export([all/0,suite/0]). --export([badarg/1,getopts/1,output/1]). - -suite() -> - [{ct_hooks,[ts_install_cth]}]. - -all() -> - [badarg,getopts,output]. - -badarg(Config) when is_list(Config) -> - {'EXIT',{badarg,_}} = (catch io:put_chars(standard_error, [oops])), - true = erlang:is_process_alive(whereis(standard_error)), - ok. - -getopts(Config) when is_list(Config) -> - [{encoding,latin1}] = io:getopts(standard_error), - ok. - -%% Test that writing a lot of output to standard_error does not cause the -%% processes handling it to terminate like this: -%% -%% =ERROR REPORT==== 9-Aug-2015::23:19:23 === -%% ** Generic server standard_error_sup terminating -%% ** Last message in was {'EXIT',<0.28.0>,eagain} -%% ** When Server state == {state,standard_error,undefined,<0.28.0>, -%% {local,standard_error_sup}} -%% ** Reason for termination == -%% ** eagain -%% -%% This problem, observed with Erlang 18.0.2, was fixed in fd_driver by -%% properly handling EAGAIN if it arises on file descriptor writes. -%% -output(Config) when is_list(Config) -> - Ref = monitor(process, standard_error_sup), - Chars = [ [["1234567890" || _ <- lists:seq(1,10)], $\s, - integer_to_list(L), $\r, $\n] || L <- lists:seq(1, 100) ], - ok = io:put_chars(standard_error, Chars), - receive - {'DOWN', Ref, process, _, _} -> - error(standard_error_noproc) - after - 500 -> - ok - end. diff -Nru erlang-18.2-dfsg/lib/kernel/test/topApp2.erl erlang-17.3-dfsg/lib/kernel/test/topApp2.erl --- erlang-18.2-dfsg/lib/kernel/test/topApp2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/topApp2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/topApp3.erl erlang-17.3-dfsg/lib/kernel/test/topApp3.erl --- erlang-18.2-dfsg/lib/kernel/test/topApp3.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/topApp3.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/topApp.erl erlang-17.3-dfsg/lib/kernel/test/topApp.erl --- erlang-18.2-dfsg/lib/kernel/test/topApp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/topApp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/wrap_log_reader_SUITE_data/wrap_log_test.erl erlang-17.3-dfsg/lib/kernel/test/wrap_log_reader_SUITE_data/wrap_log_test.erl --- erlang-18.2-dfsg/lib/kernel/test/wrap_log_reader_SUITE_data/wrap_log_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/wrap_log_reader_SUITE_data/wrap_log_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/wrap_log_reader_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/wrap_log_reader_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/wrap_log_reader_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/wrap_log_reader_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/kernel/test/zlib_SUITE.erl erlang-17.3-dfsg/lib/kernel/test/zlib_SUITE.erl --- erlang-18.2-dfsg/lib/kernel/test/zlib_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/test/zlib_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -83,7 +82,7 @@ api_deflateSetDictionary, api_deflateReset, api_deflateParams, api_deflate, api_deflateEnd, api_inflateInit, api_inflateSetDictionary, - api_inflateSync, api_inflateReset, api_inflate, api_inflateChunk, + api_inflateSync, api_inflateReset, api_inflate, api_inflateEnd, api_setBufsz, api_getBufsz, api_crc32, api_adler32, api_getQSize, api_un_compress, api_un_zip, api_g_un_zip]}, @@ -147,6 +146,8 @@ ?m(?BARG, zlib:deflateInit(Z1,default,deflated,-20,8,default)), ?m(?BARG, zlib:deflateInit(Z1,default,deflated,-7,8,default)), ?m(?BARG, zlib:deflateInit(Z1,default,deflated,7,8,default)), + ?m(?BARG, zlib:deflateInit(Z1,default,deflated,-8,8,default)), + ?m(?BARG, zlib:deflateInit(Z1,default,deflated,8,8,default)), ?m(?BARG, zlib:deflateInit(Z1,default,deflated,-15,0,default)), ?m(?BARG, zlib:deflateInit(Z1,default,deflated,-15,10,default)), @@ -168,7 +169,7 @@ ?m(ok, zlib:deflateInit(Z12,default,deflated,-Wbits,8,default)), ?m(ok,zlib:close(Z11)), ?m(ok,zlib:close(Z12)) - end, lists:seq(8, 15)), + end, lists:seq(9, 15)), lists:foreach(fun(MemLevel) -> ?line Z = zlib:open(), @@ -276,7 +277,7 @@ ?m(ok, zlib:inflateInit(Z12,-Wbits)), ?m(ok,zlib:close(Z11)), ?m(ok,zlib:close(Z12)) - end, lists:seq(8,15)), + end, lists:seq(9,15)), ?m(?BARG, zlib:inflateInit(gurka, -15)), ?m(?BARG, zlib:inflateInit(Z1, 7)), ?m(?BARG, zlib:inflateInit(Z1, -7)), @@ -356,39 +357,6 @@ ?m({'EXIT',{data_error,_}}, zlib:inflate(Z1, <<2,1,2,1,2>>)), ?m(ok, zlib:close(Z1)). -api_inflateChunk(doc) -> "Test inflateChunk"; -api_inflateChunk(suite) -> []; -api_inflateChunk(Config) when is_list(Config) -> - ChunkSize = 1024, - Data = << <<(I rem 150)>> || I <- lists:seq(1, 3 * ChunkSize) >>, - Part1 = binary:part(Data, 0, ChunkSize), - Part2 = binary:part(Data, ChunkSize, ChunkSize), - Part3 = binary:part(Data, ChunkSize * 2, ChunkSize), - ?line Compressed = zlib:compress(Data), - ?line Z1 = zlib:open(), - ?line zlib:setBufSize(Z1, ChunkSize), - ?m(ok, zlib:inflateInit(Z1)), - ?m([], zlib:inflateChunk(Z1, <<>>)), - ?m({more, Part1}, zlib:inflateChunk(Z1, Compressed)), - ?m({more, Part2}, zlib:inflateChunk(Z1)), - ?m(Part3, zlib:inflateChunk(Z1)), - ?m(ok, zlib:inflateEnd(Z1)), - - ?m(ok, zlib:inflateInit(Z1)), - ?m({more, Part1}, zlib:inflateChunk(Z1, Compressed)), - - ?m(ok, zlib:inflateReset(Z1)), - - ?line zlib:setBufSize(Z1, size(Data)), - ?m(Data, zlib:inflateChunk(Z1, Compressed)), - ?m(ok, zlib:inflateEnd(Z1)), - - ?m(ok, zlib:inflateInit(Z1)), - ?m(?BARG, zlib:inflateChunk(gurka, Compressed)), - ?m(?BARG, zlib:inflateChunk(Z1, 4384)), - ?m({'EXIT',{data_error,_}}, zlib:inflateEnd(Z1)), - ?m(ok, zlib:close(Z1)). - api_inflateEnd(doc) -> "Test inflateEnd"; api_inflateEnd(suite) -> []; api_inflateEnd(Config) when is_list(Config) -> diff -Nru erlang-18.2-dfsg/lib/kernel/vsn.mk erlang-17.3-dfsg/lib/kernel/vsn.mk --- erlang-18.2-dfsg/lib/kernel/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/kernel/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -KERNEL_VSN = 4.1.1 +KERNEL_VSN = 3.0.3 diff -Nru erlang-18.2-dfsg/lib/Makefile erlang-17.3-dfsg/lib/Makefile --- erlang-18.2-dfsg/lib/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/megaco/aclocal.m4 erlang-17.3-dfsg/lib/megaco/aclocal.m4 --- erlang-18.2-dfsg/lib/megaco/aclocal.m4 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/megaco/aclocal.m4 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ dnl dnl %CopyrightBegin% dnl -dnl Copyright Ericsson AB 1998-2015. All Rights Reserved. +dnl Copyright Ericsson AB 1998-2013. All Rights Reserved. dnl -dnl Licensed under the Apache License, Version 2.0 (the "License"); -dnl you may not use this file except in compliance with the License. -dnl You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. +dnl +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. dnl dnl %CopyrightEnd% dnl @@ -61,6 +60,7 @@ dnl Cross compilation variables AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigaltstack, [have working sigaltstack(): yes|no (only used when cross compiling)]) @@ -142,18 +142,18 @@ AC_MSG_CHECKING(for mixed cygwin or msys and native VC++ environment) if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then - if test -x /usr/bin/msys-?.0.dll; then - CFLAGS="-O2" - MIXED_MSYS=yes - AC_MSG_RESULT([MSYS and VC]) - MIXED_MSYS_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" - elif test -x /usr/bin/cygpath; then + if test -x /usr/bin/cygpath; then CFLAGS="-O2" MIXED_CYGWIN=yes AC_MSG_RESULT([Cygwin and VC]) MIXED_CYGWIN_VC=yes CPPFLAGS="$CPPFLAGS -DERTS_MIXED_CYGWIN_VC" + elif test -x /usr/bin/msysinfo; then + CFLAGS="-O2" + MIXED_MSYS=yes + AC_MSG_RESULT([MSYS and VC]) + MIXED_MSYS_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" else AC_MSG_RESULT([undeterminable]) AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!) @@ -246,31 +246,31 @@ return 1; lbl2: return 2; -],ac_cv_prog_emu_cc="$CC",ac_cv_prog_emu_cc=no) +],ac_cv_prog_emu_cc=$CC,ac_cv_prog_emu_cc=no) -if test "$ac_cv_prog_emu_cc" = no; then +if test $ac_cv_prog_emu_cc = no; then for ac_progname in emu_cc.sh gcc-4.2 gcc; do IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_progname"; then - ac_cv_prog_emu_cc="$ac_dir/$ac_progname" + if test -f $ac_dir/$ac_progname; then + ac_cv_prog_emu_cc=$ac_dir/$ac_progname break fi done IFS="$ac_save_ifs" - if test "$ac_cv_prog_emu_cc" != no; then + if test $ac_cv_prog_emu_cc != no; then break fi done fi -if test "$ac_cv_prog_emu_cc" != no; then - save_CC="$CC" +if test $ac_cv_prog_emu_cc != no; then + save_CC=$CC save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS - CC="$ac_cv_prog_emu_cc" + CC=$ac_cv_prog_emu_cc CFLAGS="" CPPFLAGS="" AC_TRY_COMPILE([],[ @@ -291,17 +291,17 @@ return 1; lbl2: return 2; - ],ac_cv_prog_emu_cc="$CC",ac_cv_prog_emu_cc=no) + ],ac_cv_prog_emu_cc=$CC,ac_cv_prog_emu_cc=no) CC=$save_CC CFLAGS=$save_CFLAGS CPPFLAGS=$save_CPPFLAGS fi ]) -if test "$ac_cv_prog_emu_cc" = no; then +if test $ac_cv_prog_emu_cc = no; then AC_DEFINE(NO_JUMP_TABLE,[],[Defined if no found C compiler can handle jump tables]) - EMU_CC="$CC" + EMU_CC=$CC else - EMU_CC="$ac_cv_prog_emu_cc" + EMU_CC=$ac_cv_prog_emu_cc fi AC_SUBST(EMU_CC) ]) @@ -559,7 +559,7 @@ AC_DEFUN(LM_SYS_MULTICAST, [AC_CACHE_CHECK([for multicast support], ac_cv_sys_multicast_support, -[AC_EGREP_CPP(^yes$, +[AC_EGREP_CPP(yes, [#include #include #include @@ -724,250 +724,6 @@ ])# AC_C_DOUBLE_MIDDLE_ENDIAN -AC_DEFUN(ERL_MONOTONIC_CLOCK, -[ - if test "$3" = "yes"; then - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_BOOTTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_PRECISE" - else - default_resolution_clock_gettime_monotonic="CLOCK_HIGHRES CLOCK_UPTIME CLOCK_MONOTONIC" - low_resolution_clock_gettime_monotonic="CLOCK_MONOTONIC_COARSE CLOCK_UPTIME_FAST" - high_resolution_clock_gettime_monotonic="CLOCK_UPTIME_PRECISE" - fi - - case "$1" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_monotonic="$high_resolution_clock_gettime_monotonic" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_monotonic="$low_resolution_clock_gettime_monotonic" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_monotonic="$2" - ;; - *) - check_msg="custom " - prefer_resolution_clock_gettime_monotonic="$2" - ;; - esac - - AC_CACHE_CHECK([for clock_gettime(CLOCK_MONOTONIC_RAW, _)], erl_cv_clock_gettime_monotonic_raw, - [ - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_monotonic_raw=yes, - erl_cv_clock_gettime_monotonic_raw=no) - ]) - - AC_CACHE_CHECK([for clock_gettime() with ${check_msg}monotonic clock type], erl_cv_clock_gettime_monotonic_$1, - [ - for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_monotonic_$1=$clock_type, - erl_cv_clock_gettime_monotonic_$1=no) - test $erl_cv_clock_gettime_monotonic_$1 = no || break - done - ]) - - AC_CHECK_FUNCS([clock_getres clock_get_attributes gethrtime]) - - AC_CACHE_CHECK([for mach clock_get_time() with monotonic clock type], erl_cv_mach_clock_get_time_monotonic, - [ - AC_TRY_COMPILE([ -#include -#include - ], - [ - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - ], - erl_cv_mach_clock_get_time_monotonic=yes, - erl_cv_mach_clock_get_time_monotonic=no) - ]) - - erl_corrected_monotonic_clock=no - case $erl_cv_clock_gettime_monotonic_$1-$ac_cv_func_gethrtime-$erl_cv_mach_clock_get_time_monotonic-$host_os in - *-*-*-win32) - erl_monotonic_clock_func=WindowsAPI - ;; - CLOCK_*-*-*-linux*) - case $erl_cv_clock_gettime_monotonic_$1-$erl_cv_clock_gettime_monotonic_raw in - CLOCK_BOOTTIME-yes|CLOCK_MONOTONIC-yes) - erl_corrected_monotonic_clock=yes - ;; - *) - # We don't trust CLOCK_MONOTONIC to be NTP - # adjusted on linux systems that do not have - # CLOCK_MONOTONIC_RAW (although it seems to - # be...) - ;; - esac - erl_monotonic_clock_func=clock_gettime - ;; - no-no-no-linux*) - erl_monotonic_clock_func=times - ;; - CLOCK_*-*-*-*) - erl_monotonic_clock_func=clock_gettime - ;; - no-yes-*-*) - erl_monotonic_clock_func=gethrtime - ;; - no-no-yes-*) - erl_monotonic_clock_func=mach_clock_get_time - ;; - no-no-no-*) - erl_monotonic_clock_func=none - ;; - esac - - erl_monotonic_clock_low_resolution=no - erl_monotonic_clock_lib= - erl_monotonic_clock_id= - case $erl_monotonic_clock_func in - clock_gettime) - erl_monotonic_clock_id=$erl_cv_clock_gettime_monotonic_$1 - for low_res_id in $low_resolution_clock_gettime_monotonic; do - if test $erl_monotonic_clock_id = $low_res_id; then - erl_monotonic_clock_low_resolution=yes - break - fi - done - AC_CHECK_LIB(rt, clock_gettime, [erl_monotonic_clock_lib="-lrt"]) - ;; - mach_clock_get_time) - erl_monotonic_clock_id=SYSTEM_CLOCK - ;; - times) - erl_monotonic_clock_low_resolution=yes - ;; - *) - ;; - esac - -]) - -AC_DEFUN(ERL_WALL_CLOCK, -[ - default_resolution_clock_gettime_wall="CLOCK_REALTIME" - low_resolution_clock_gettime_wall="CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST" - high_resolution_clock_gettime_wall="CLOCK_REALTIME_PRECISE" - - case "$1" in - high_resolution) - check_msg="high resolution " - prefer_resolution_clock_gettime_wall="$high_resolution_clock_gettime_wall" - ;; - low_resolution) - check_msg="low resolution " - prefer_resolution_clock_gettime_wall="$low_resolution_clock_gettime_wall" - ;; - custom_resolution) - check_msg="custom resolution " - prefer_resolution_clock_gettime_wall="$2" - ;; - *) - check_msg="" - prefer_resolution_clock_gettime_wall= - ;; - esac - - AC_CACHE_CHECK([for clock_gettime() with ${check_msg}wall clock type], erl_cv_clock_gettime_wall_$1, - [ - for clock_type in $prefer_resolution_clock_gettime_wall $default_resolution_clock_gettime_wall $high_resolution_clock_gettime_wall $low_resolution_clock_gettime_wall; do - AC_TRY_COMPILE([ -#include - ], - [ - struct timespec ts; - long long result; - clock_gettime($clock_type,&ts); - result = ((long long) ts.tv_sec) * 1000000000LL + - ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_wall_$1=$clock_type, - erl_cv_clock_gettime_wall_$1=no) - test $erl_cv_clock_gettime_wall_$1 = no || break - done - ]) - - AC_CHECK_FUNCS([clock_getres clock_get_attributes gettimeofday]) - - AC_CACHE_CHECK([for mach clock_get_time() with wall clock type], erl_cv_mach_clock_get_time_wall, - [ - AC_TRY_COMPILE([ -#include -#include - ], - [ - kern_return_t res; - clock_serv_t clk_srv; - mach_timespec_t time_spec; - - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &clk_srv); - res = clock_get_time(clk_srv, &time_spec); - mach_port_deallocate(mach_task_self(), clk_srv); - ], - erl_cv_mach_clock_get_time_wall=yes, - erl_cv_mach_clock_get_time_wall=no) - ]) - - erl_wall_clock_low_resolution=no - erl_wall_clock_id= - case $1-$erl_cv_clock_gettime_wall_$1-$erl_cv_mach_clock_get_time_wall-$ac_cv_func_gettimeofday-$host_os in - *-*-*-*-win32) - erl_wall_clock_func=WindowsAPI - erl_wall_clock_low_resolution=yes - ;; - high_resolution-no-yes-*-*) - erl_wall_clock_func=mach_clock_get_time - erl_wall_clock_id=CALENDAR_CLOCK - ;; - *-CLOCK_*-*-*-*) - erl_wall_clock_func=clock_gettime - erl_wall_clock_id=$erl_cv_clock_gettime_wall_$1 - for low_res_id in $low_resolution_clock_gettime_wall; do - if test $erl_wall_clock_id = $low_res_id; then - erl_wall_clock_low_resolution=yes - break - fi - done - ;; - *-no-*-yes-*) - erl_wall_clock_func=gettimeofday - ;; - *) - erl_wall_clock_func=none - ;; - esac -]) - dnl ---------------------------------------------------------------------- dnl dnl LM_CHECK_THR_LIB @@ -1152,226 +908,24 @@ ]) -AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OP__, -[ - # $1 - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]]" - case $1 in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, __ATOMIC_RELAXED); res = $1(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = $1(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = $1(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = $1(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - AC_MSG_ERROR([Internal error: missing implementation for $1]) - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - AC_CACHE_CHECK([for 32-bit $1()], ethr_cv_32bit_$1, - [ - ethr_cv_32bit_$1=no - AC_TRY_LINK([], [$atomic32_call], [ethr_cv_32bit_$1=yes]) - ]) - AC_CACHE_CHECK([for 64-bit $1()], ethr_cv_64bit_$1, - [ - ethr_cv_64bit_$1=no - AC_TRY_LINK([], [$atomic64_call], [ethr_cv_64bit_$1=yes]) - ]) - AC_CACHE_CHECK([for 128-bit $1()], ethr_cv_128bit_$1, - [ - ethr_cv_128bit_$1=no - AC_TRY_LINK([], [$atomic128_call], [ethr_cv_128bit_$1=yes]) - ]) - - case $ethr_cv_128bit_$1-$ethr_cv_64bit_$1-$ethr_cv_32bit_$1 in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - AC_DEFINE_UNQUOTED([ETHR_HAVE_$1], [$have_atomic_ops], [Define as a bitmask corresponding to the word sizes that $1() can handle on your system]) -]) - -AC_DEFUN(ETHR_CHK_IF_NOOP, +AC_DEFUN(ETHR_CHK_SYNC_OP, [ - ethr_test_filename="chk_if_$1$3_noop_config1test.$$" - cat > "${ethr_test_filename}.c" < "${ethr_test_filename}.c" </dev/null 2>&1; then - ethr_$1$3_noop=yes - else - ethr_$1$3_noop=no - fi - rm -f "${ethr_test_filename}.c" "${ethr_test_filename}1.o" "${ethr_test_filename}2.o" -]) - -AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OPS, -[ - AC_CHECK_SIZEOF(short) - AC_CHECK_SIZEOF(int) - AC_CHECK_SIZEOF(long) - AC_CHECK_SIZEOF(long long) - AC_CHECK_SIZEOF(__int128_t) - - if test "$ac_cv_sizeof_short" = "4"; then - gcc_atomic_type32="short" - elif test "$ac_cv_sizeof_int" = "4"; then - gcc_atomic_type32="int" - elif test "$ac_cv_sizeof_long" = "4"; then - gcc_atomic_type32="long" - else - AC_MSG_ERROR([No 32-bit type found]) - fi - - if test "$ac_cv_sizeof_int" = "8"; then - gcc_atomic_type64="int" - elif test "$ac_cv_sizeof_long" = "8"; then - gcc_atomic_type64="long" - elif test "$ac_cv_sizeof_long_long" = "8"; then - gcc_atomic_type64="long long" - else - AC_MSG_ERROR([No 64-bit type found]) - fi - - if test "$ac_cv_sizeof___int128_t" = "16"; then - gcc_atomic_type128="__int128_t" - else - gcc_atomic_type128="#error " - fi - AC_CACHE_CHECK([for a working __sync_synchronize()], ethr_cv___sync_synchronize, - [ - ethr_cv___sync_synchronize=no - AC_TRY_LINK([], - [ __sync_synchronize(); ], - [ethr_cv___sync_synchronize=yes]) - if test $ethr_cv___sync_synchronize = yes; then - # - # Old gcc versions on at least x86 have a buggy - # __sync_synchronize() which does not emit a - # memory barrier. We try to detect this by - # compiling to assembly with and without - # __sync_synchronize() and compare the results. - # - ETHR_CHK_IF_NOOP(__sync_synchronize, [()], []) - if test $ethr___sync_synchronize_noop = yes; then - # Got a buggy implementation of - # __sync_synchronize... - ethr_cv___sync_synchronize="no; buggy implementation" - fi - fi - ]) - - if test "$ethr_cv___sync_synchronize" = "yes"; then - have_sync_synchronize_value="~0" - else - have_sync_synchronize_value="0" - fi - AC_DEFINE_UNQUOTED([ETHR_HAVE___sync_synchronize], [$have_sync_synchronize_value], [Define as a bitmask corresponding to the word sizes that __sync_synchronize() can handle on your system]) - - ETHR_CHK_GCC_ATOMIC_OP__(__sync_add_and_fetch) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_fetch_and_and) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_fetch_and_or) - ETHR_CHK_GCC_ATOMIC_OP__(__sync_val_compare_and_swap) - - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_store_n) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_load_n) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_add_fetch) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_fetch_and) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_fetch_or) - ETHR_CHK_GCC_ATOMIC_OP__(__atomic_compare_exchange_n) - - ethr_have_gcc_native_atomics=no - ethr_arm_dbm_instr_val=0 - case "$GCC-$host_cpu" in - yes-arm*) - AC_CACHE_CHECK([for ARM DMB instruction], ethr_cv_arm_dbm_instr, - [ - ethr_cv_arm_dbm_instr=no - AC_TRY_LINK([], - [ - __asm__ __volatile__("dmb sy" : : : "memory"); - __asm__ __volatile__("dmb st" : : : "memory"); - ], - [ethr_cv_arm_dbm_instr=yes]) - ]) - if test $ethr_cv_arm_dbm_instr = yes; then - ethr_arm_dbm_instr_val=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi;; - *) - ;; + AC_MSG_CHECKING([for $3-bit $1()]) + case "$2" in + "1") sync_call="$1(&var);";; + "2") sync_call="$1(&var, ($4) 0);";; + "3") sync_call="$1(&var, ($4) 0, ($4) 0);";; esac - AC_DEFINE_UNQUOTED([ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION], [$ethr_arm_dbm_instr_val], [Define as a boolean indicating whether you have a gcc compatible compiler capable of generating the ARM DMB instruction, and are compiling for an ARM processor with ARM DMB instruction support, or not]) - test $ethr_cv_32bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_64bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - if test "$ethr_cv___sync_synchronize" = "yes"; then - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi - ethr_have_gcc_atomic_builtins=0 - if test $ethr_have_gcc_native_atomics = yes; then - ethr_native_atomic_implementation=gcc_sync - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_have_gcc_atomic_builtins = 1 && ethr_native_atomic_implementation=gcc_atomic_sync - fi - AC_DEFINE_UNQUOTED([ETHR_HAVE_GCC___ATOMIC_BUILTINS], [$ethr_have_gcc_atomic_builtins], [Define as a boolean indicating whether you have a gcc __atomic builtins or not]) - test $ethr_have_gcc_native_atomics = yes && ethr_have_native_atomics=yes + have_sync_op=no + AC_TRY_LINK([], + [ + $4 res; + volatile $4 var; + res = $sync_call + ], + [have_sync_op=yes]) + test $have_sync_op = yes && $5 + AC_MSG_RESULT([$have_sync_op]) ]) AC_DEFUN(ETHR_CHK_INTERLOCKED, @@ -1451,16 +1005,6 @@ test $enable_prefer_gcc_native_ethr_impls = yes && AC_DEFINE(ETHR_PREFER_GCC_NATIVE_IMPLS, 1, [Define if you prefer gcc native ethread implementations]) -AC_ARG_ENABLE(trust-gcc-atomic-builtins-memory-barriers, - AS_HELP_STRING([--enable-trust-gcc-atomic-builtins-memory-barriers], - [trust gcc atomic builtins memory barriers]), -[ case "$enableval" in - yes) trust_gcc_atomic_builtins_mbs=1 ;; - *) trust_gcc_atomic_builtins_mbs=0 ;; - esac ], trust_gcc_atomic_builtins_mbs=0) - -AC_DEFINE_UNQUOTED(ETHR_TRUST_GCC_ATOMIC_BUILTINS_MEMORY_BARRIERS, [$trust_gcc_atomic_builtins_mbs], [Define as a boolean indicating whether you trust gcc's __atomic_* builtins memory barrier implementations, or not]) - AC_ARG_WITH(libatomic_ops, AS_HELP_STRING([--with-libatomic_ops=PATH], [specify and prefer usage of libatomic_ops in the ethread library])) @@ -1472,33 +1016,12 @@ LM_CHECK_THR_LIB ERL_INTERNAL_LIBS -ERL_MONOTONIC_CLOCK(try_find_pthread_compatible, CLOCK_HIGHRES CLOCK_MONOTONIC, no) - -case $erl_monotonic_clock_func in - clock_gettime) - AC_DEFINE(ETHR_HAVE_CLOCK_GETTIME_MONOTONIC, [1], [Define if you have a clock_gettime() with a monotonic clock]) - ;; - mach_clock_get_time) - AC_DEFINE(ETHR_HAVE_MACH_CLOCK_GET_TIME, [1], [Define if you have a mach clock_get_time() with a monotonic clock]) - ;; - gethrtime) - AC_DEFINE(ETHR_HAVE_GETHRTIME, [1], [Define if you have a monotonic gethrtime()]) - ;; - *) - ;; -esac - -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(ETHR_MONOTONIC_CLOCK_ID, [$erl_monotonic_clock_id], [Define to the monotonic clock id to use]) -fi - -ethr_native_atomic_implementation=none ethr_have_native_atomics=no ethr_have_native_spinlock=no ETHR_THR_LIB_BASE="$THR_LIB_NAME" ETHR_THR_LIB_BASE_TYPE="$THR_LIB_TYPE" ETHR_DEFS="$THR_DEFS" -ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS $erl_monotonic_clock_lib" +ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS" ETHR_LIBS= ETHR_LIB_NAME= @@ -1577,10 +1100,7 @@ ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange128], [4], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE128, 1, [Define if you have _InterlockedCompareExchange128()])) fi - if test "$ethr_have_native_atomics" = "yes"; then - ethr_native_atomic_implementation=windows - ethr_have_native_spinlock=yes - fi + test "$ethr_have_native_atomics" = "yes" && ethr_have_native_spinlock=yes ;; pthread|ose_threads) @@ -1809,50 +1329,6 @@ AC_DEFINE(ETHR_HAVE_PTHREAD_ATTR_SETGUARDSIZE, 1, \ [Define if you have the pthread_attr_setguardsize function.])) - if test "x$erl_monotonic_clock_id" != "x"; then - AC_MSG_CHECKING(whether pthread_cond_timedwait() can use the monotonic clock $erl_monotonic_clock_id for timeout) - pthread_cond_timedwait_monotonic=no - AC_TRY_LINK([ - #if defined(ETHR_NEED_NPTL_PTHREAD_H) - # include - #elif defined(ETHR_HAVE_MIT_PTHREAD_H) - # include - #elif defined(ETHR_HAVE_PTHREAD_H) - # include - #endif - #ifdef ETHR_TIME_WITH_SYS_TIME - # include - # include - #else - # ifdef ETHR_HAVE_SYS_TIME_H - # include - # else - # include - # endif - #endif - #if defined(ETHR_HAVE_MACH_CLOCK_GET_TIME) - # include - # include - #endif - ], - [ - int res; - pthread_condattr_t attr; - pthread_cond_t cond; - struct timespec cond_timeout; - pthread_mutex_t mutex; - res = pthread_condattr_init(&attr); - res = pthread_condattr_setclock(&attr, ETHR_MONOTONIC_CLOCK_ID); - res = pthread_cond_init(&cond, &attr); - res = pthread_cond_timedwait(&cond, &mutex, &cond_timeout); - ], - [pthread_cond_timedwait_monotonic=yes]) - AC_MSG_RESULT([$pthread_cond_timedwait_monotonic]) - if test $pthread_cond_timedwait_monotonic = yes; then - AC_DEFINE(ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC, [1], [Define if pthread_cond_timedwait() can be used with a monotonic clock]) - fi - fi - linux_futex=no AC_MSG_CHECKING([for Linux futexes]) AC_TRY_LINK([ @@ -1873,62 +1349,56 @@ AC_MSG_RESULT([$linux_futex]) test $linux_futex = yes && AC_DEFINE(ETHR_HAVE_LINUX_FUTEX, 1, [Define if you have a linux futex implementation.]) - pthread_setname=no - AC_MSG_CHECKING([for pthread_setname_np]) - old_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Werror" - AC_TRY_LINK([#define __USE_GNU - #include ], - [pthread_setname_np(pthread_self(), "name");], - pthread_setname=linux) - AC_TRY_LINK([#define __USE_GNU - #include ], - [pthread_set_name_np(pthread_self(), "name");], - pthread_setname=bsd) - AC_TRY_LINK([#define _DARWIN_C_SOURCE - #include ], - [pthread_setname_np("name");], - pthread_setname=darwin) - AC_MSG_RESULT([$pthread_setname]) - case $pthread_setname in - linux) AC_DEFINE(ETHR_HAVE_PTHREAD_SETNAME_NP_2, 1, - [Define if you have linux style pthread_setname_np]);; - bsd) AC_DEFINE(ETHR_HAVE_PTHREAD_SET_NAME_NP_2, 1, - [Define if you have bsd style pthread_set_name_np]);; - darwin) AC_DEFINE(ETHR_HAVE_PTHREAD_SETNAME_NP_1, 1, - [Define if you have darwin style pthread_setname_np]);; - *) ;; - esac + fi - pthread_getname=no - AC_MSG_CHECKING([for pthread_getname_np]) - AC_TRY_LINK([#define __USE_GNU - #define _DARWIN_C_SOURCE - #include ], - [char buff[256]; pthread_getname_np(pthread_self(), buff, 256);], - pthread_getname=linux) - AC_TRY_LINK([#define __USE_GNU - #define _DARWIN_C_SOURCE - #include ], - [char buff[256]; pthread_getname_np(pthread_self(), buff);], - pthread_getname=ibm) - AC_MSG_RESULT([$pthread_getname]) - case $pthread_getname in - linux) AC_DEFINE(ETHR_HAVE_PTHREAD_GETNAME_NP_3, 1, - [Define if you have linux style pthread_getname_np]);; - ibm) AC_DEFINE(ETHR_HAVE_PTHREAD_GETNAME_NP_2, 1, - [Define if you have ibm style pthread_getname_np]);; - *) ;; - esac - CFLAGS=$old_CFLAGS + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(long) + AC_CHECK_SIZEOF(long long) + AC_CHECK_SIZEOF(__int128_t) + + if test "$ac_cv_sizeof_int" = "4"; then + int32="int" + elif test "$ac_cv_sizeof_long" = "4"; then + int32="long" + elif test "$ac_cv_sizeof_long_long" = "4"; then + int32="long long" + else + AC_MSG_ERROR([No 32-bit type found]) + fi - fi ## test "x$THR_LIB_NAME" = "xpthread" + if test "$ac_cv_sizeof_int" = "8"; then + int64="int" + elif test "$ac_cv_sizeof_long" = "8"; then + int64="long" + elif test "$ac_cv_sizeof_long_long" = "8"; then + int64="long long" + else + AC_MSG_ERROR([No 64-bit type found]) + fi + + int128=no + if test "$ac_cv_sizeof___int128_t" = "16"; then + int128="__int128_t" + fi if test "X$disable_native_ethr_impls" = "Xyes"; then ethr_have_native_atomics=no else + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32, 1, [Define if you have __sync_val_compare_and_swap() for 32-bit integers])) + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_SYNC_OP([__sync_add_and_fetch], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_ADD_AND_FETCH32, 1, [Define if you have __sync_add_and_fetch() for 32-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_and], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_AND32, 1, [Define if you have __sync_fetch_and_and() for 32-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_or], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_OR32, 1, [Define if you have __sync_fetch_and_or() for 32-bit integers])) + + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64, 1, [Define if you have __sync_val_compare_and_swap() for 64-bit integers])) + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_SYNC_OP([__sync_add_and_fetch], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_ADD_AND_FETCH64, 1, [Define if you have __sync_add_and_fetch() for 64-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_and], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_AND64, 1, [Define if you have __sync_fetch_and_and() for 64-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_or], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_OR64, 1, [Define if you have __sync_fetch_and_or() for 64-bit integers])) - ETHR_CHK_GCC_ATOMIC_OPS([]) + if test $int128 != no; then + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [128], [$int128], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP128, 1, [Define if you have __sync_val_compare_and_swap() for 128-bit integers])) + fi AC_MSG_CHECKING([for a usable libatomic_ops implementation]) case "x$with_libatomic_ops" in @@ -1951,34 +1421,11 @@ int z; AO_nop_full(); -#if defined(AO_HAVE_store) AO_store(&x, (AO_t) 0); -#elif defined(AO_HAVE_store_release) - AO_store_release(&x, (AO_t) 0); -#else -#error No store -#endif -#if defined(AO_HAVE_load) z = AO_load(&x); -#elif defined(AO_HAVE_load_acquire) - z = AO_load_acquire(&x); -#else -#error No load -#endif -#if defined(AO_HAVE_compare_and_swap_full) z = AO_compare_and_swap_full(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap_release) - z = AO_compare_and_swap_release(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap_acquire) - z = AO_compare_and_swap_acquire(&x, (AO_t) 0, (AO_t) 1); -#elif defined(AO_HAVE_compare_and_swap) - z = AO_compare_and_swap(&x, (AO_t) 0, (AO_t) 1); -#else -#error No compare_and_swap -#endif ], [ethr_have_native_atomics=yes - ethr_native_atomic_implementation=libatomic_ops ethr_have_libatomic_ops=yes]) AC_MSG_RESULT([$ethr_have_libatomic_ops]) if test $ethr_have_libatomic_ops = yes; then @@ -2010,19 +1457,15 @@ *) AC_MSG_ERROR([Unsupported Sparc memory order: $with_sparc_memory_order]);; esac - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; i86pc | i*86 | x86_64 | amd64) if test "$enable_x86_out_of_order" = "yes"; then AC_DEFINE(ETHR_X86_OUT_OF_ORDER, 1, [Define if x86/x86_64 out of order instructions should be synchronized]) fi - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; macppc | ppc | powerpc | "Power Macintosh") - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; tile) - ethr_native_atomic_implementation=ethread ethr_have_native_atomics=yes;; *) ;; @@ -2195,233 +1638,109 @@ ]) + dnl ---------------------------------------------------------------------- dnl dnl ERL_TIME_CORRECTION dnl -dnl Check for primitives that can be used for implementing -dnl erts_os_monotonic_time() and erts_os_system_time() +dnl In the presence of a high resolution realtime timer Erlang can adapt +dnl its view of time relative to this timer. On solaris such a timer is +dnl available with the syscall gethrtime(). On other OS's a fallback +dnl solution using times() is implemented. (However on e.g. FreeBSD times() +dnl is implemented using gettimeofday so it doesn't make much sense to +dnl use it there...) On second thought, it seems to be safer to do it the +dnl other way around. I.e. only use times() on OS's where we know it will +dnl work... dnl AC_DEFUN(ERL_TIME_CORRECTION, -[ - -AC_ARG_WITH(clock-resolution, -AS_HELP_STRING([--with-clock-resolution=high|low|default], - [specify wanted clock resolution])) - -AC_ARG_WITH(clock-gettime-realtime-id, -AS_HELP_STRING([--with-clock-gettime-realtime-id=CLOCKID], - [specify clock id to use with clock_gettime() for realtime time)])) - -AC_ARG_WITH(clock-gettime-monotonic-id, -AS_HELP_STRING([--with-clock-gettime-monotonic-id=CLOCKID], - [specify clock id to use with clock_gettime() for monotonic time)])) - -AC_ARG_ENABLE(prefer-elapsed-monotonic-time-during-suspend, -AS_HELP_STRING([--enable-prefer-elapsed-monotonic-time-during-suspend], - [Prefer an OS monotonic time source with elapsed time during suspend]) -AS_HELP_STRING([--disable-prefer-elapsed-monotonic-time-during-suspend], - [Do not prefer an OS monotonic time source with elapsed time during suspend]), -[ case "$enableval" in - yes) prefer_elapsed_monotonic_time_during_suspend=yes ;; - *) prefer_elapsed_monotonic_time_during_suspend=no ;; - esac ], prefer_elapsed_monotonic_time_during_suspend=no) - -AC_ARG_ENABLE(gettimeofday-as-os-system-time, - AS_HELP_STRING([--enable-gettimeofday-as-os-system-time], - [Force usage of gettimeofday() for OS system time]), -[ case "$enableval" in - yes) force_gettimeofday_os_system_time=yes ;; - *) force_gettimeofday_os_system_time=no ;; - esac ], force_gettimeofday_os_system_time=no) - -case "$with_clock_resolution" in - ""|no|yes) - with_clock_resolution=default;; - high|low|default) - ;; - *) - AC_MSG_ERROR([Invalid wanted clock resolution: $with_clock_resolution]) - ;; -esac - -if test "$force_gettimeofday_os_system_time" = "yes"; then - - AC_CHECK_FUNCS([gettimeofday]) - if test "$ac_cv_func_gettimeofday" = "yes"; then - AC_DEFINE(OS_SYSTEM_TIME_GETTIMEOFDAY, [1], [Define if you want to implement erts_os_system_time() using gettimeofday()]) - else - AC_MSG_ERROR([No gettimeofday() available]) - fi - -else # $force_gettimeofday_os_system_time != yes - -case "$with_clock_gettime_realtime_id" in - ""|no) - with_clock_gettime_realtime_id=no - ;; - CLOCK_*CPUTIME*) - AC_MSG_ERROR([Invalid clock_gettime() realtime clock id: Refusing to use the cputime clock id $with_clock_gettime_realtime_id as realtime clock id]) - ;; - CLOCK_MONOTONIC*|CLOCK_BOOTTIME*|CLOCK_UPTIME*|CLOCK_HIGHRES*) - AC_MSG_ERROR([Invalid clock_gettime() realtime clock id: Refusing to use the monotonic clock id $with_clock_gettime_realtime_id as realtime clock id]) - ;; - CLOCK_*) - ;; - *) - AC_MSG_ERROR([Invalid clock_gettime() clock id: $with_clock_gettime_realtime_id]) - ;; -esac - -case "$with_clock_resolution-$with_clock_gettime_realtime_id" in - high-no) - ERL_WALL_CLOCK(high_resolution);; - low-no) - ERL_WALL_CLOCK(low_resolution);; - default-no) - ERL_WALL_CLOCK(default_resolution);; - *) - ERL_WALL_CLOCK(custom_resolution, $with_clock_gettime_realtime_id);; -esac - -case "$erl_wall_clock_func-$erl_wall_clock_id-$with_clock_gettime_realtime_id" in - *-*-no) - ;; - clock_gettime-$with_clock_gettime_realtime_id-$with_clock_gettime_realtime_id) - ;; - *) - AC_MSG_ERROR([$with_clock_gettime_realtime_id as clock id to clock_gettime() doesn't compile]) - ;; -esac - -case $erl_wall_clock_func in - none) - AC_MSG_ERROR([No wall clock source found]) - ;; - mach_clock_get_time) - AC_DEFINE(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_system_time() using mach clock_get_time()]) - ;; - clock_gettime) - AC_DEFINE(OS_SYSTEM_TIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_system_time() using clock_gettime()]) - ;; - gettimeofday) - AC_DEFINE(OS_SYSTEM_TIME_GETTIMEOFDAY, [1], [Define if you want to implement erts_os_system_time() using gettimeofday()]) - ;; - *) - ;; -esac - -if test "x$erl_wall_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(WALL_CLOCK_ID_STR, ["$erl_wall_clock_id"], [Define as a string of wall clock id to use]) - AC_DEFINE_UNQUOTED(WALL_CLOCK_ID, [$erl_wall_clock_id], [Define to wall clock id to use]) -fi - -fi # $force_gettimeofday_os_system_time != yes - -case "$with_clock_gettime_monotonic_id" in - ""|no) - with_clock_gettime_monotonic_id=no - ;; - CLOCK_*CPUTIME*) - AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the cputime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) - ;; - CLOCK_REALTIME*|CLOCK_TAI*) - AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the realtime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) - ;; - CLOCK_*) - ;; - *) - AC_MSG_ERROR([Invalid clock_gettime() clock id: $with_clock_gettime_monotonic_id]) - ;; -esac - -case "$with_clock_resolution-$with_clock_gettime_monotonic_id" in - high-no) - ERL_MONOTONIC_CLOCK(high_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - low-no) - ERL_MONOTONIC_CLOCK(low_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - default-no) - ERL_MONOTONIC_CLOCK(default_resolution, undefined, $prefer_elapsed_monotonic_time_during_suspend);; - *) - ERL_MONOTONIC_CLOCK(custom_resolution, $with_clock_gettime_monotonic_id, $prefer_elapsed_monotonic_time_during_suspend);; -esac - -case "$erl_monotonic_clock_func-$erl_monotonic_clock_id-$with_clock_gettime_monotonic_id" in - *-*-no) - ;; - clock_gettime-$with_clock_gettime_monotonic_id-$with_clock_gettime_monotonic_id) - ;; - *) - AC_MSG_ERROR([$with_clock_gettime_monotonic_id as clock id to clock_gettime() doesn't compile]) - ;; -esac - -case $erl_monotonic_clock_func in - times) - AC_DEFINE(OS_MONOTONIC_TIME_USING_TIMES, [1], [Define if you want to implement erts_os_monotonic_time() using times()]) - ;; - mach_clock_get_time) - AC_DEFINE(OS_MONOTONIC_TIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_monotonic_time() using mach clock_get_time()]) - ;; - clock_gettime) - AC_DEFINE(OS_MONOTONIC_TIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_monotonic_time() using clock_gettime()]) - ;; - gethrtime) - AC_DEFINE(OS_MONOTONIC_TIME_USING_GETHRTIME, [1], [Define if you want to implement erts_os_monotonic_time() using gethrtime()]) - ;; - *) - ;; -esac - -if test $erl_corrected_monotonic_clock = yes; then - AC_DEFINE(ERTS_HAVE_CORRECTED_OS_MONOTONIC_TIME, [1], [Define if OS monotonic clock is corrected]) -fi - -if test $erl_monotonic_clock_low_resolution = yes; then - AC_DEFINE(ERTS_HAVE_LOW_RESOLUTION_OS_MONOTONIC_LOW, [1], [Define if you have a low resolution OS monotonic clock]) -fi - -xrtlib="$erl_monotonic_clock_lib" -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(MONOTONIC_CLOCK_ID_STR, ["$erl_monotonic_clock_id"], [Define as a string of monotonic clock id to use]) - AC_DEFINE_UNQUOTED(MONOTONIC_CLOCK_ID, [$erl_monotonic_clock_id], [Define to monotonic clock id to use]) +[if test x$ac_cv_func_gethrtime = x; then + AC_CHECK_FUNC(gethrtime) fi - -if test $erl_cv_clock_gettime_monotonic_raw = yes; then - AC_DEFINE(HAVE_CLOCK_GETTIME_MONOTONIC_RAW, [1], [Define if you have clock_gettime(CLOCK_MONOTONIC_RAW, _)]) +if test x$clock_gettime_correction = xunknown; then + AC_TRY_COMPILE([#include ], + [struct timespec ts; + long long result; + clock_gettime(CLOCK_MONOTONIC,&ts); + result = ((long long) ts.tv_sec) * 1000000000LL + + ((long long) ts.tv_nsec);], + clock_gettime_compiles=yes, + clock_gettime_compiles=no) +else + clock_gettime_compiles=no fi + -ERL_MONOTONIC_CLOCK(high_resolution, undefined, no) +AC_CACHE_CHECK([how to correct for time adjustments], erl_cv_time_correction, +[ +case $clock_gettime_correction in + yes) + erl_cv_time_correction=clock_gettime;; + no|unknown) + case $ac_cv_func_gethrtime in + yes) + erl_cv_time_correction=hrtime ;; + no) + case $host_os in + linux*) + case $clock_gettime_correction in + unknown) + if test x$clock_gettime_compiles = xyes; then + if test X$cross_compiling != Xyes; then + linux_kernel_vsn_=`uname -r` + case $linux_kernel_vsn_ in + [[0-1]].*|2.[[0-5]]|2.[[0-5]].*) + erl_cv_time_correction=times ;; + *) + erl_cv_time_correction=clock_gettime;; + esac + else + case X$erl_xcomp_linux_clock_gettime_correction in + X) + erl_cv_time_correction=cross;; + Xyes|Xno) + if test $erl_xcomp_linux_clock_gettime_correction = yes; then + erl_cv_time_correction=clock_gettime + else + erl_cv_time_correction=times + fi;; + *) + AC_MSG_ERROR([Bad erl_xcomp_linux_clock_gettime_correction value: $erl_xcomp_linux_clock_gettime_correction]);; + esac + fi + else + erl_cv_time_correction=times + fi + ;; + *) + erl_cv_time_correction=times ;; + esac + ;; + *) + erl_cv_time_correction=none ;; + esac + ;; + esac + ;; +esac +]) -case $$erl_monotonic_clock_low_resolution-$erl_monotonic_clock_func in - no-mach_clock_get_time) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_hrtime() using mach clock_get_time()]) - ;; - no-clock_gettime) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_CLOCK_GETTIME, [1], [Define if you want to implement erts_os_hrtime() using clock_gettime()]) - ;; - no-gethrtime) - monotonic_hrtime=yes - AC_DEFINE(SYS_HRTIME_USING_GETHRTIME, [1], [Define if you want to implement erts_os_hrtime() using gethrtime()]) +xrtlib="" +case $erl_cv_time_correction in + times) + AC_DEFINE(CORRECT_USING_TIMES,[], + [Define if you do not have a high-res. timer & want to use times() instead]) ;; - *) - monotonic_hrtime=no + clock_gettime|cross) + if test $erl_cv_time_correction = cross; then + erl_cv_time_correction=clock_gettime + AC_MSG_WARN([result clock_gettime guessed because of cross compilation]) + fi + xrtlib="-lrt" + AC_DEFINE(GETHRTIME_WITH_CLOCK_GETTIME,[1], + [Define if you want to use clock_gettime to simulate gethrtime]) ;; esac - -if test $monotonic_hrtime = yes; then - AC_DEFINE(HAVE_MONOTONIC_ERTS_SYS_HRTIME, [1], [Define if you have a monotonic erts_os_hrtime() implementation]) -fi - -if test "x$erl_monotonic_clock_id" != "x"; then - AC_DEFINE_UNQUOTED(HRTIME_CLOCK_ID_STR, ["$erl_monotonic_clock_id"], [Define as a string of monotonic clock id to use]) - AC_DEFINE_UNQUOTED(HRTIME_CLOCK_ID, [$erl_monotonic_clock_id], [Define to monotonic clock id to use]) -fi - - dnl dnl Check if gethrvtime is working, and if to use procfs ioctl dnl or (yet to be written) write to the procfs ctl file. @@ -2494,7 +1813,6 @@ esac ]) -LIBRT=$xrtlib case $erl_gethrvtime in procfs_ioctl) AC_DEFINE(HAVE_GETHRVTIME_PROCFS_IOCTL,[1], @@ -2541,33 +1859,43 @@ exit(0); return 0; } ], - erl_clock_gettime_cpu_time=yes, - erl_clock_gettime_cpu_time=no, + erl_clock_gettime=yes, + erl_clock_gettime=no, [ case X$erl_xcomp_clock_gettime_cpu_time in - X) erl_clock_gettime_cpu_time=cross;; - Xyes|Xno) erl_clock_gettime_cpu_time=$erl_xcomp_clock_gettime_cpu_time;; + X) erl_clock_gettime=cross;; + Xyes|Xno) erl_clock_gettime=$erl_xcomp_clock_gettime_cpu_time;; *) AC_MSG_ERROR([Bad erl_xcomp_clock_gettime_cpu_time value: $erl_xcomp_clock_gettime_cpu_time]);; esac ]) LIBS=$save_libs - AC_MSG_RESULT($erl_clock_gettime_cpu_time) - case $erl_clock_gettime_cpu_time in - yes) - AC_DEFINE(HAVE_CLOCK_GETTIME_CPU_TIME,[], - [define if clock_gettime() works for getting process time]) - LIBRT=-lrt - ;; - cross) - erl_clock_gettime_cpu_time=no - AC_MSG_WARN([result no guessed because of cross compilation]) + case $host_os in + linux*) + AC_MSG_RESULT([no; not stable]) + LIBRT=$xrtlib ;; *) + AC_MSG_RESULT($erl_clock_gettime) + case $erl_clock_gettime in + yes) + AC_DEFINE(HAVE_CLOCK_GETTIME,[], + [define if clock_gettime() works for getting process time]) + LIBRT=-lrt + ;; + cross) + erl_clock_gettime=no + AC_MSG_WARN([result no guessed because of cross compilation]) + LIBRT=$xrtlib + ;; + *) + LIBRT=$xrtlib + ;; + esac ;; esac + AC_SUBST(LIBRT) ;; esac -AC_SUBST(LIBRT) ])dnl dnl ---------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/megaco/configure.in erlang-17.3-dfsg/lib/megaco/configure.in --- erlang-18.2-dfsg/lib/megaco/configure.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/megaco/configure.in 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ dnl dnl Copyright Ericsson AB 2001-2013. All Rights Reserved. dnl -dnl Licensed under the Apache License, Version 2.0 (the "License"); -dnl you may not use this file except in compliance with the License. -dnl You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. +dnl +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. dnl dnl %CopyrightEnd% dnl diff -Nru erlang-18.2-dfsg/lib/megaco/doc/src/book.xml erlang-17.3-dfsg/lib/megaco/doc/src/book.xml --- erlang-18.2-dfsg/lib/megaco/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/megaco/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/megaco/doc/src/files.mk erlang-17.3-dfsg/lib/megaco/doc/src/files.mk --- erlang-18.2-dfsg/lib/megaco/doc/src/files.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/megaco/doc/src/files.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2001-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/megaco/doc/src/index.html.src erlang-17.3-dfsg/lib/megaco/doc/src/index.html.src --- erlang-18.2-dfsg/lib/megaco/doc/src/index.html.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/megaco/doc/src/index.html.src 2014-09-16 19:10:57.000000000 +0000 @@ -2,17 +2,16 @@ diff -Nru erlang-18.2-dfsg/lib/percept/priv/server_root/scripts/percept_area_select.js erlang-17.3-dfsg/lib/percept/priv/server_root/scripts/percept_area_select.js --- erlang-18.2-dfsg/lib/percept/priv/server_root/scripts/percept_area_select.js 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/priv/server_root/scripts/percept_area_select.js 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/percept/priv/server_root/scripts/percept_error_handler.js erlang-17.3-dfsg/lib/percept/priv/server_root/scripts/percept_error_handler.js --- erlang-18.2-dfsg/lib/percept/priv/server_root/scripts/percept_error_handler.js 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/priv/server_root/scripts/percept_error_handler.js 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/percept/priv/server_root/scripts/percept_select_all.js erlang-17.3-dfsg/lib/percept/priv/server_root/scripts/percept_select_all.js --- erlang-18.2-dfsg/lib/percept/priv/server_root/scripts/percept_select_all.js 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/priv/server_root/scripts/percept_select_all.js 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2007-2009. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/percept/src/egd.erl erlang-17.3-dfsg/lib/percept/src/egd.erl --- erlang-18.2-dfsg/lib/percept/src/egd.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/egd.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/src/egd_font.erl erlang-17.3-dfsg/lib/percept/src/egd_font.erl --- erlang-18.2-dfsg/lib/percept/src/egd_font.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/egd_font.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/src/egd.hrl erlang-17.3-dfsg/lib/percept/src/egd.hrl --- erlang-18.2-dfsg/lib/percept/src/egd.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/egd.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/src/egd_png.erl erlang-17.3-dfsg/lib/percept/src/egd_png.erl --- erlang-18.2-dfsg/lib/percept/src/egd_png.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/egd_png.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/src/egd_primitives.erl erlang-17.3-dfsg/lib/percept/src/egd_primitives.erl --- erlang-18.2-dfsg/lib/percept/src/egd_primitives.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/egd_primitives.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/src/egd_render.erl erlang-17.3-dfsg/lib/percept/src/egd_render.erl --- erlang-18.2-dfsg/lib/percept/src/egd_render.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/egd_render.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/src/Makefile erlang-17.3-dfsg/lib/percept/src/Makefile --- erlang-18.2-dfsg/lib/percept/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2007-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% @@ -51,8 +50,6 @@ #HRL_FILES= ../include/ -INTERNAL_HRL_FILES= egd.hrl percept.hrl - ERL_FILES= $(MODULES:%=%.erl) TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET) @@ -98,7 +95,6 @@ release_spec: opt $(INSTALL_DIR) "$(RELSYSDIR)/src" $(INSTALL_DATA) $(ERL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(INTERNAL_HRL_FILES) "$(RELSYSDIR)/src" # $(INSTALL_DIR) "$(RELSYSDIR)/include" # $(INSTALL_DATA) $(HRL_FILES) "$(RELSYSDIR)/include" $(INSTALL_DIR) "$(RELSYSDIR)/ebin" diff -Nru erlang-18.2-dfsg/lib/percept/src/percept_analyzer.erl erlang-17.3-dfsg/lib/percept/src/percept_analyzer.erl --- erlang-18.2-dfsg/lib/percept/src/percept_analyzer.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/percept_analyzer.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/src/percept.app.src erlang-17.3-dfsg/lib/percept/src/percept.app.src --- erlang-18.2-dfsg/lib/percept/src/percept.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/percept.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/percept/src/percept.appup.src erlang-17.3-dfsg/lib/percept/src/percept.appup.src --- erlang-18.2-dfsg/lib/percept/src/percept.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/percept.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/percept/src/percept_db.erl erlang-17.3-dfsg/lib/percept/src/percept_db.erl --- erlang-18.2-dfsg/lib/percept/src/percept_db.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/percept_db.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/src/percept.erl erlang-17.3-dfsg/lib/percept/src/percept.erl --- erlang-18.2-dfsg/lib/percept/src/percept.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/percept.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -320,6 +319,10 @@ {alias,{"/images/", filename:join([Root, "images"]) ++ "/"}}, {alias,{"/css/", filename:join([Root, "css"]) ++ "/"}}, + % Logs + %{transfer_log, filename:join([Path, "logs", "transfer.log"])}, + %{error_log, filename:join([Path, "logs", "error.log"])}, + % Configs {default_type,"text/plain"}, {directory_index,["index.html"]}, @@ -328,9 +331,12 @@ mod_esi, mod_actions, mod_cgi, + mod_include, mod_dir, mod_get, mod_head + % mod_log, + % mod_disk_log ]}, {com_type,ip_comm}, {server_name, Servername}, diff -Nru erlang-18.2-dfsg/lib/percept/src/percept_graph.erl erlang-17.3-dfsg/lib/percept/src/percept_graph.erl --- erlang-18.2-dfsg/lib/percept/src/percept_graph.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/percept_graph.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/src/percept.hrl erlang-17.3-dfsg/lib/percept/src/percept.hrl --- erlang-18.2-dfsg/lib/percept/src/percept.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/percept.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/percept/src/percept_html.erl erlang-17.3-dfsg/lib/percept/src/percept_html.erl --- erlang-18.2-dfsg/lib/percept/src/percept_html.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/percept_html.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/src/percept_image.erl erlang-17.3-dfsg/lib/percept/src/percept_image.erl --- erlang-18.2-dfsg/lib/percept/src/percept_image.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/src/percept_image.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/percept/test/egd_SUITE.erl erlang-17.3-dfsg/lib/percept/test/egd_SUITE.erl --- erlang-18.2-dfsg/lib/percept/test/egd_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/test/egd_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/percept/test/ipc_tree.erl erlang-17.3-dfsg/lib/percept/test/ipc_tree.erl --- erlang-18.2-dfsg/lib/percept/test/ipc_tree.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/test/ipc_tree.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/percept/test/Makefile erlang-17.3-dfsg/lib/percept/test/Makefile --- erlang-18.2-dfsg/lib/percept/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2007-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/percept/test/percept_db_SUITE.erl erlang-17.3-dfsg/lib/percept/test/percept_db_SUITE.erl --- erlang-18.2-dfsg/lib/percept/test/percept_db_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/test/percept_db_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/percept/test/percept_SUITE.erl erlang-17.3-dfsg/lib/percept/test/percept_SUITE.erl --- erlang-18.2-dfsg/lib/percept/test/percept_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/test/percept_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/percept/vsn.mk erlang-17.3-dfsg/lib/percept/vsn.mk --- erlang-18.2-dfsg/lib/percept/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/percept/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -PERCEPT_VSN = 0.8.11 +PERCEPT_VSN = 0.8.9 diff -Nru erlang-18.2-dfsg/lib/public_key/asn1/Makefile erlang-17.3-dfsg/lib/public_key/asn1/Makefile --- erlang-18.2-dfsg/lib/public_key/asn1/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/asn1/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2008-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -67,7 +66,7 @@ EXTRA_ERLC_FLAGS = ERL_COMPILE_FLAGS += $(EXTRA_ERLC_FLAGS) -ASN_FLAGS = -bber +der +noobj +asn1config +ASN_FLAGS = -bber +der +compact_bit_string +noobj +asn1config # ---------------------------------------------------- # Targets diff -Nru erlang-18.2-dfsg/lib/public_key/asn1/PKIX1Explicit88.asn1 erlang-17.3-dfsg/lib/public_key/asn1/PKIX1Explicit88.asn1 --- erlang-18.2-dfsg/lib/public_key/asn1/PKIX1Explicit88.asn1 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/asn1/PKIX1Explicit88.asn1 2014-09-16 19:10:57.000000000 +0000 @@ -86,22 +86,22 @@ id-at-generationQualifier AttributeType ::= { id-at 44 } X520name ::= CHOICE { - teletexString TeletexString (SIZE (1..ub-name-teletex)), - printableString PrintableString (SIZE (1..ub-name-printable)), - universalString UniversalString (SIZE (1..ub-name-universal)), - utf8String UTF8String (SIZE (1..ub-name-utf8)), - bmpString BMPString (SIZE (1..ub-name-universal)) } + teletexString TeletexString (SIZE (1..ub-name)), + printableString PrintableString (SIZE (1..ub-name)), + universalString UniversalString (SIZE (1..ub-name)), + utf8String UTF8String (SIZE (1..ub-name)), + bmpString BMPString (SIZE (1..ub-name)) } -- Naming attributes of type X520CommonName id-at-commonName AttributeType ::= { id-at 3 } X520CommonName ::= CHOICE { - teletexString TeletexString (SIZE (1..ub-common-name-teletex)), - printableString PrintableString (SIZE (1..ub-common-name-printable)), - universalString UniversalString (SIZE (1..ub-common-name-universal)), - utf8String UTF8String (SIZE (1..ub-common-name-utf8)), - bmpString BMPString (SIZE (1..ub-common-name-universal)) } + teletexString TeletexString (SIZE (1..ub-common-name)), + printableString PrintableString (SIZE (1..ub-common-name)), + universalString UniversalString (SIZE (1..ub-common-name)), + utf8String UTF8String (SIZE (1..ub-common-name)), + bmpString BMPString (SIZE (1..ub-common-name)) } -- Naming attributes of type X520LocalityName @@ -110,9 +110,9 @@ X520LocalityName ::= CHOICE { teletexString TeletexString (SIZE (1..ub-locality-name)), printableString PrintableString (SIZE (1..ub-locality-name)), - universalString UniversalString (SIZE (1..ub-locality-name-universal)), - utf8String UTF8String (SIZE (1..ub-locality-name-utf8)), - bmpString BMPString (SIZE (1..ub-locality-name-universal)) } + universalString UniversalString (SIZE (1..ub-locality-name)), + utf8String UTF8String (SIZE (1..ub-locality-name)), + bmpString BMPString (SIZE (1..ub-locality-name)) } -- Naming attributes of type X520StateOrProvinceName @@ -121,9 +121,9 @@ X520StateOrProvinceName ::= CHOICE { teletexString TeletexString (SIZE (1..ub-state-name)), printableString PrintableString (SIZE (1..ub-state-name)), - universalString UniversalString (SIZE (1..ub-state-name-universal)), - utf8String UTF8String (SIZE (1..ub-state-name-utf8)), - bmpString BMPString (SIZE(1..ub-state-name-universal)) } + universalString UniversalString (SIZE (1..ub-state-name)), + utf8String UTF8String (SIZE (1..ub-state-name)), + bmpString BMPString (SIZE(1..ub-state-name)) } -- Naming attributes of type X520OrganizationName @@ -131,15 +131,15 @@ X520OrganizationName ::= CHOICE { teletexString TeletexString - (SIZE (1..ub-organization-name-teletex)), + (SIZE (1..ub-organization-name)), printableString PrintableString - (SIZE (1..ub-organization-name-printable)), + (SIZE (1..ub-organization-name)), universalString UniversalString - (SIZE (1..ub-organization-name-universal)), + (SIZE (1..ub-organization-name)), utf8String UTF8String - (SIZE (1..ub-organization-name-utf8)), + (SIZE (1..ub-organization-name)), bmpString BMPString - (SIZE (1..ub-organization-name-universal)) } + (SIZE (1..ub-organization-name)) } -- Naming attributes of type X520OrganizationalUnitName @@ -147,26 +147,26 @@ X520OrganizationalUnitName ::= CHOICE { teletexString TeletexString - (SIZE (1..ub-organizational-unit-name-teletex)), + (SIZE (1..ub-organizational-unit-name)), printableString PrintableString - (SIZE (1..ub-organizational-unit-name-printable)), + (SIZE (1..ub-organizational-unit-name)), universalString UniversalString - (SIZE (1..ub-organizational-unit-name-universal)), + (SIZE (1..ub-organizational-unit-name)), utf8String UTF8String - (SIZE (1..ub-organizational-unit-name-utf8)), + (SIZE (1..ub-organizational-unit-name)), bmpString BMPString - (SIZE (1..ub-organizational-unit-name-universal)) } + (SIZE (1..ub-organizational-unit-name)) } -- Naming attributes of type X520Title id-at-title AttributeType ::= { id-at 12 } X520Title ::= CHOICE { - teletexString TeletexString (SIZE (1..ub-title-teletex)), - printableString PrintableString (SIZE (1..ub-title-printable)), - universalString UniversalString (SIZE (1..ub-title-universal)), - utf8String UTF8String (SIZE (1..ub-title-utf8)), - bmpString BMPString (SIZE (1..ub-title-universal)) } + teletexString TeletexString (SIZE (1..ub-title)), + printableString PrintableString (SIZE (1..ub-title)), + universalString UniversalString (SIZE (1..ub-title)), + utf8String UTF8String (SIZE (1..ub-title)), + bmpString BMPString (SIZE (1..ub-title)) } -- Naming attributes of type X520dnQualifier @@ -193,9 +193,9 @@ X520Pseudonym ::= CHOICE { teletexString TeletexString (SIZE (1..ub-pseudonym)), printableString PrintableString (SIZE (1..ub-pseudonym)), - universalString UniversalString (SIZE (1..ub-pseudonym-universal)), - utf8String UTF8String (SIZE (1..ub-pseudonym-utf8)), - bmpString BMPString (SIZE (1..ub-pseudonym-universal)) } + universalString UniversalString (SIZE (1..ub-pseudonym)), + utf8String UTF8String (SIZE (1..ub-pseudonym)), + bmpString BMPString (SIZE (1..ub-pseudonym)) } -- Naming attributes of type DomainComponent (from RFC 2247) @@ -363,7 +363,7 @@ printable PrintableString (SIZE (1..ub-domain-name-length)) } OrganizationName ::= PrintableString - (SIZE (1..ub-organization-name-printable)) + (SIZE (1..ub-organization-name-length)) -- see also teletex-organization-name NumericUserIdentifier ::= NumericString @@ -386,7 +386,7 @@ -- see also teletex-organizational-unit-names OrganizationalUnitName ::= PrintableString (SIZE - (1..ub-organizational-unit-name-printable)) + (1..ub-organizational-unit-name-length)) -- Built-in Domain-defined Attributes @@ -415,16 +415,16 @@ common-name INTEGER ::= 1 -CommonName ::= PrintableString (SIZE (1..ub-common-name-printable)) +CommonName ::= PrintableString (SIZE (1..ub-common-name-length)) teletex-common-name INTEGER ::= 2 -TeletexCommonName ::= TeletexString (SIZE (1..ub-common-name-teletex)) +TeletexCommonName ::= TeletexString (SIZE (1..ub-common-name-length)) teletex-organization-name INTEGER ::= 3 TeletexOrganizationName ::= - TeletexString (SIZE (1..ub-organization-name-teletex)) + TeletexString (SIZE (1..ub-organization-name-length)) teletex-personal-name INTEGER ::= 4 @@ -445,7 +445,7 @@ (1..ub-organizational-units) OF TeletexOrganizationalUnitName TeletexOrganizationalUnitName ::= TeletexString - (SIZE (1..ub-organizational-unit-name-teletex)) + (SIZE (1..ub-organizational-unit-name-length)) pds-name INTEGER ::= 7 @@ -570,39 +570,16 @@ -- Upper Bounds ub-name INTEGER ::= 32768 -ub-name-teletex INTEGER ::= 65536 -ub-name-printable INTEGER ::= 65536 -ub-name-universal INTEGER ::= 131072 -ub-name-utf8 INTEGER ::= 131072 ub-common-name INTEGER ::= 64 -ub-common-name-teletex INTEGER::= 128 -ub-common-name-printable INTEGER ::= 128 -ub-common-name-universal INTEGER ::= 256 -ub-common-name-utf8 INTEGER ::= 256 ub-locality-name INTEGER ::= 128 -ub-locality-name-utf8 INTEGER ::= 256 -ub-locality-name-universal INTEGER ::= 256 ub-state-name INTEGER ::= 128 -ub-state-name-universal INTEGER ::= 256 -ub-state-name-utf8 INTEGER ::= 256 ub-organization-name INTEGER ::= 64 -ub-organization-name-printable INTEGER ::= 128 -ub-organization-name-teletex INTEGER ::= 128 -ub-organization-name-universal INTEGER ::= 256 -ub-organization-name-utf8 INTEGER ::= 256 ub-organizational-unit-name INTEGER ::= 64 -ub-organizational-unit-name-printable INTEGER ::= 128 -ub-organizational-unit-name-teletex INTEGER ::= 128 -ub-organizational-unit-name-universal INTEGER ::= 256 -ub-organizational-unit-name-utf8 INTEGER ::= 256 ub-title INTEGER ::= 64 -ub-title-teletex INTEGER ::= 128 -ub-title-printable INTEGER ::= 128 -ub-title-universal INTEGER ::= 256 -ub-title-utf8 INTEGER ::= 256 ub-serial-number INTEGER ::= 64 ub-match INTEGER ::= 128 ub-emailaddress-length INTEGER ::= 255 +ub-common-name-length INTEGER ::= 64 ub-country-name-alpha-length INTEGER ::= 2 ub-country-name-numeric-length INTEGER ::= 3 ub-domain-defined-attributes INTEGER ::= 4 @@ -617,14 +594,14 @@ ub-initials-length INTEGER ::= 5 ub-integer-options INTEGER ::= 256 ub-numeric-user-id-length INTEGER ::= 32 +ub-organization-name-length INTEGER ::= 64 +ub-organizational-unit-name-length INTEGER ::= 32 ub-organizational-units INTEGER ::= 4 ub-pds-name-length INTEGER ::= 16 ub-pds-parameter-length INTEGER ::= 30 ub-pds-physical-address-lines INTEGER ::= 6 ub-postal-code-length INTEGER ::= 16 ub-pseudonym INTEGER ::= 128 -ub-pseudonym-utf8 INTEGER ::= 256 -ub-pseudonym-universal INTEGER ::= 256 ub-surname-length INTEGER ::= 40 ub-terminal-id-length INTEGER ::= 24 ub-unformatted-address-length INTEGER ::= 180 diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/book.xml erlang-17.3-dfsg/lib/public_key/doc/src/book.xml --- erlang-18.2-dfsg/lib/public_key/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/cert_records.xml erlang-17.3-dfsg/lib/public_key/doc/src/cert_records.xml --- erlang-18.2-dfsg/lib/public_key/doc/src/cert_records.xml 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/cert_records.xml 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,690 @@ + + + + +
    + + 2008 + 2014 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Certificate records + Ingela Anderton Andin + + + + + 2008-02-06 + A + cert_records.xml +
    + +

    This chapter briefly describes erlang records derived from ASN1 + specifications used to handle X509 certificates and CertificationRequest. + The intent is to describe the data types +and not to specify the semantics of each component. For information on the +semantics, please see RFC 5280 and + PKCS-10. +

    + +

    Use the following include directive to get access to the + records and constant macros (OIDs) described in the following sections.

    + + -include_lib("public_key/include/public_key.hrl"). + +

    The used ASN1 specifications are available asn1 subdirectory + of the application public_key. +

    + +
    + Common Data Types + +

    Common non standard erlang + data types used to described the record fields in the + below sections are defined in public key reference manual or + follows here.

    + +

    time() = uct_time() | general_time()

    + +

    uct_time() = {utcTime, "YYMMDDHHMMSSZ"}

    + +

    general_time() = {generalTime, "YYYYMMDDHHMMSSZ"}

    + +

    + general_name() = {rfc822Name, string()} | {dNSName, string()} + | {x400Address, string()} | {directoryName, + {rdnSequence, [#AttributeTypeAndValue'{}]}} | + | {eidPartyName, special_string()} + | {eidPartyName, special_string(), special_string()} + | {uniformResourceIdentifier, string()} | {ipAddress, string()} | + {registeredId, oid()} | {otherName, term()} +

    + +

    + special_string() = + {teletexString, string()} | {printableString, string()} | + {universalString, string()} | {utf8String, binary()} | + {bmpString, string()} +

    + +

    + dist_reason() = unused | keyCompromise | cACompromise | + affiliationChanged | superseded | cessationOfOperation | + certificateHold | privilegeWithdrawn | + aACompromise +

    +
    + +
    + PKIX Certificates + +#'Certificate'{ + tbsCertificate, % #'TBSCertificate'{} + signatureAlgorithm, % #'AlgorithmIdentifier'{} + signature % {0, binary()} - ASN1 compact bitstring + }. + +#'TBSCertificate'{ + version, % v1 | v2 | v3 + serialNumber, % integer() + signature, % #'AlgorithmIdentifier'{} + issuer, % {rdnSequence, [#AttributeTypeAndValue'{}]} + validity, % #'Validity'{} + subject, % {rdnSequence, [#AttributeTypeAndValue'{}]} + subjectPublicKeyInfo, % #'SubjectPublicKeyInfo'{} + issuerUniqueID, % binary() | asn1_novalue + subjectUniqueID, % binary() | asn1_novalue + extensions % [#'Extension'{}] + }. + +#'AlgorithmIdentifier'{ + algorithm, % oid() + parameters % der_encoded() + }. + + + +#'OTPCertificate'{ + tbsCertificate, % #'OTPTBSCertificate'{} + signatureAlgorithm, % #'SignatureAlgorithm' + signature % {0, binary()} - ASN1 compact bitstring + }. + +#'OTPTBSCertificate'{ + version, % v1 | v2 | v3 + serialNumber, % integer() + signature, % #'SignatureAlgorithm' + issuer, % {rdnSequence, [#AttributeTypeAndValue'{}]} + validity, % #'Validity'{} + subject, % {rdnSequence, [#AttributeTypeAndValue'{}]} + subjectPublicKeyInfo, % #'OTPSubjectPublicKeyInfo'{} + issuerUniqueID, % binary() | asn1_novalue + subjectUniqueID, % binary() | asn1_novalue + extensions % [#'Extension'{}] + }. + +#'SignatureAlgorithm'{ + algorithm, % id_signature_algorithm() + parameters % asn1_novalue | #'Dss-Parms'{} + }. + + +

    id_signature_algorithm() = ?oid_name_as_erlang_atom for available +oid names see table below. Ex: ?'id-dsa-with-sha1'

    + + + OID name + + + id-dsa-with-sha1 + + + id-dsaWithSHA1 (ISO alt oid to above) + + + md2WithRSAEncryption + + + md5WithRSAEncryption + + + sha1WithRSAEncryption + + + sha-1WithRSAEncryption (ISO alt oid to above) + + + sha224WithRSAEncryption + + + sha256WithRSAEncryption + + + sha512WithRSAEncryption + + + ecdsa-with-SHA1 + + Signature algorithm oids +
    + + +#'AttributeTypeAndValue'{ + type, % id_attributes() + value % term() + }. + + +

    id_attributes()

    + + + OID name + Value type + + + id-at-name + special_string() + + + id-at-surname + special_string() + + + id-at-givenName + special_string() + + + id-at-initials + special_string() + + + id-at-generationQualifier + special_string() + + + id-at-commonName + special_string() + + + id-at-localityName + special_string() + + + id-at-stateOrProvinceName + special_string() + + + id-at-organizationName + special_string() + + + id-at-title + special_string() + + + id-at-dnQualifier + {printableString, string()} + + + id-at-countryName + {printableString, string()} + + + id-at-serialNumber + {printableString, string()} + + + id-at-pseudonym + special_string() + + Attribute oids +
    + + +#'Validity'{ + notBefore, % time() + notAfter % time() + }. + +#'SubjectPublicKeyInfo'{ + algorithm, % #AlgorithmIdentifier{} + subjectPublicKey % binary() + }. + +#'SubjectPublicKeyInfoAlgorithm'{ + algorithm, % id_public_key_algorithm() + parameters % public_key_params() + }. + + +

    id_public_key_algorithm()

    + + + OID name + + + rsaEncryption + + + id-dsa + + + dhpublicnumber + + + id-keyExchangeAlgorithm + + + id-ecPublicKey + + Public key algorithm oids +
    + + +#'Extension'{ + extnID, % id_extensions() | oid() + critical, % boolean() + extnValue % der_encoded() + }. + + +

    id_extensions() + Standard Certificate Extensions, + Private Internet Extensions, + CRL Extensions and + CRL Entry Extensions. +

    + +
    + +
    + + Standard certificate extensions + + + + OID name + Value type + + + id-ce-authorityKeyIdentifier + #'AuthorityKeyIdentifier'{} + + + id-ce-subjectKeyIdentifier + oid() + + + id-ce-keyUsage + [key_usage()] + + + id-ce-privateKeyUsagePeriod + #'PrivateKeyUsagePeriod'{} + + + id-ce-certificatePolicies + #'PolicyInformation'{} + + + + id-ce-policyMappings + #'PolicyMappings_SEQOF'{} + + + + id-ce-subjectAltName + general_name() + + + + id-ce-issuerAltName + general_name() + + + + id-ce-subjectDirectoryAttributes + [#'Attribute'{}] + + + + id-ce-basicConstraints + #'BasicConstraints'{} + + + id-ce-nameConstraints + #'NameConstraints'{} + + + id-ce-policyConstraints + #'PolicyConstraints'{} + + + id-ce-extKeyUsage + [id_key_purpose()] + + + + id-ce-cRLDistributionPoints + [#'DistributionPoint'{}] + + + + id-ce-inhibitAnyPolicy + integer() + + + + id-ce-freshestCRL + [#'DistributionPoint'{}] + + + + Standard Certificate Extensions +
    + +

    + key_usage() = digitalSignature | nonRepudiation | keyEncipherment| + dataEncipherment | keyAgreement | keyCertSign | cRLSign | encipherOnly | + decipherOnly +

    + +

    id_key_purpose()

    + + + + OID name + + + id-kp-serverAuth + + + id-kp-clientAuth + + + id-kp-codeSigning + + + id-kp-emailProtection + + + id-kp-timeStamping + + + id-kp-OCSPSigning + + Key purpose oids +
    + + +#'AuthorityKeyIdentifier'{ + keyIdentifier, % oid() + authorityCertIssuer, % general_name() + authorityCertSerialNumber % integer() + }. + +#'PrivateKeyUsagePeriod'{ + notBefore, % general_time() + notAfter % general_time() + }. + +#'PolicyInformation'{ + policyIdentifier, % oid() + policyQualifiers % [#PolicyQualifierInfo{}] + }. + +#'PolicyQualifierInfo'{ + policyQualifierId, % oid() + qualifier % string() | #'UserNotice'{} + }. + +#'UserNotice'{ + noticeRef, % #'NoticeReference'{} + explicitText % string() + }. + +#'NoticeReference'{ + organization, % string() + noticeNumbers % [integer()] + }. + +#'PolicyMappings_SEQOF'{ + issuerDomainPolicy, % oid() + subjectDomainPolicy % oid() + }. + +#'Attribute'{ + type, % oid() + values % [der_encoded()] + }). + +#'BasicConstraints'{ + cA, % boolean() + pathLenConstraint % integer() + }). + +#'NameConstraints'{ + permittedSubtrees, % [#'GeneralSubtree'{}] + excludedSubtrees % [#'GeneralSubtree'{}] + }). + +#'GeneralSubtree'{ + base, % general_name() + minimum, % integer() + maximum % integer() + }). + +#'PolicyConstraints'{ + requireExplicitPolicy, % integer() + inhibitPolicyMapping % integer() + }). + +#'DistributionPoint'{ + distributionPoint, % {fullName, [general_name()]} | {nameRelativeToCRLIssuer, + [#AttributeTypeAndValue{}]} + reasons, % [dist_reason()] + cRLIssuer % [general_name()] + }). + + +
    + +
    + + Private Internet Extensions + + + + OID name + Value type + + + id-pe-authorityInfoAccess + [#'AccessDescription'{}] + + + id-pe-subjectInfoAccess + [#'AccessDescription'{}] + + Private Internet Extensions +
    + + +#'AccessDescription'{ + accessMethod, % oid() + accessLocation % general_name() + }). + + +
    + +
    + CRL and CRL Extensions Profile + + +#'CertificateList'{ + tbsCertList, % #'TBSCertList{} + signatureAlgorithm, % #'AlgorithmIdentifier'{} + signature % {0, binary()} - ASN1 compact bitstring + }). + +#'TBSCertList'{ + version, % v2 (if defined) + signature, % #AlgorithmIdentifier{} + issuer, % {rdnSequence, [#AttributeTypeAndValue'{}]} + thisUpdate, % time() + nextUpdate, % time() + revokedCertificates, % [#'TBSCertList_revokedCertificates_SEQOF'{}] + crlExtensions % [#'Extension'{}] + }). + +#'TBSCertList_revokedCertificates_SEQOF'{ + userCertificate, % integer() + revocationDate, % timer() + crlEntryExtensions % [#'Extension'{}] + }). + + +
    + + CRL Extensions + + + + OID name + Value type + + + id-ce-authorityKeyIdentifier + #'AuthorityKeyIdentifier{} + + + id-ce-issuerAltName + {rdnSequence, [#AttributeTypeAndValue'{}]} + + + id-ce-cRLNumber + integer() + + + id-ce-deltaCRLIndicator + integer() + + + id-ce-issuingDistributionPoint + #'IssuingDistributionPoint'{} + + + id-ce-freshestCRL + [#'Distributionpoint'{}] + + + CRL Extensions +
    + + +#'IssuingDistributionPoint'{ + distributionPoint, % {fullName, [general_name()]} | {nameRelativeToCRLIssuer, + [#AttributeTypeAndValue'{}]} + onlyContainsUserCerts, % boolean() + onlyContainsCACerts, % boolean() + onlySomeReasons, % [dist_reason()] + indirectCRL, % boolean() + onlyContainsAttributeCerts % boolean() + }). + +
    + +
    + + CRL Entry Extensions + + + + OID name + Value type + + + id-ce-cRLReason + crl_reason() + + + id-ce-holdInstructionCode + oid() + + + id-ce-invalidityDate + general_time() + + + id-ce-certificateIssuer + general_name() + + CRL Entry Extensions +
    +

    + crl_reason() = unspecified | keyCompromise | cACompromise | + affiliationChanged | superseded | cessationOfOperation | + certificateHold | removeFromCRL | privilegeWithdrawn | + aACompromise +

    +
    + +
    + + PKCS#10 Certification Request + +#'CertificationRequest'{ + certificationRequestInfo #'CertificationRequestInfo'{}, + signatureAlgorithm #'CertificationRequest_signatureAlgorithm'{}}. + signature {0, binary()} - ASN1 compact bitstring + } + +#'CertificationRequestInfo'{ + version atom(), + subject {rdnSequence, [#AttributeTypeAndValue'{}]} , + subjectPKInfo #'CertificationRequestInfo_subjectPKInfo'{}, + attributes [#'AttributePKCS-10' {}] + } + +#'CertificationRequestInfo_subjectPKInfo'{ + algorithm #'CertificationRequestInfo_subjectPKInfo_algorithm'{} + subjectPublicKey {0, binary()} - ASN1 compact bitstring + } + +#'CertificationRequestInfo_subjectPKInfo_algorithm'{ + algorithm = oid(), + parameters = der_encoded() +} + +#'CertificationRequest_signatureAlgorithm'{ + algorithm = oid(), + parameters = der_encoded() + } + +#'AttributePKCS-10'{ + type = oid(), + values = [der_encoded()] +} + +
    + +
    +
    diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/introduction.xml erlang-17.3-dfsg/lib/public_key/doc/src/introduction.xml --- erlang-18.2-dfsg/lib/public_key/doc/src/introduction.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/introduction.xml 2014-09-16 19:10:57.000000000 +0000 @@ -5,21 +5,20 @@
    2008 - 2015 + 2013 Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -37,28 +36,27 @@
    Purpose -

    The Public Key application deals with public-key related file - formats, digital signatures, and +

    public_key deals with public key related file formats, digital + signatures and X-509 certificates. It is a library application that - provides encode/decode, sign/verify, encrypt/decrypt, and similar - functionality. It does not read or write files, it expects or returns + provides encode/decode, sign/verify, encrypt/decrypt and similar + functionality, it does not read or write files it expects or returns file contents or partial file contents as binaries.

    Prerequisites -

    It is assumed that the reader is familiar with the Erlang programming - language and has a basic understanding of the concepts of using public-keys - and digital certificates.

    +

    It is assumed that the reader has a basic understanding + of the concepts of using public keys and digital certificates.

    - Performance Tips -

    The Public Key decode- and encode-functions try to use the NIFs - in the ASN.1 compilers runtime modules, if they can be found. - Thus, to have the ASN1 application in the - path of your system gives the best performance.

    + Performance tips +

    The public_key decode and encode functions will try to use the NIFs + which are in the ASN1 compilers runtime modules if they can be found. + So for the best performance you want to have the ASN1 application in the + path of your system.

    diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/Makefile erlang-17.3-dfsg/lib/public_key/doc/src/Makefile --- erlang-18.2-dfsg/lib/public_key/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2008-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -43,7 +42,8 @@ XML_PART_FILES = part.xml part_notes.xml XML_CHAPTER_FILES = \ introduction.xml \ - public_key_records.xml \ + public_key_records.xml \ + cert_records.xml \ using_public_key.xml \ notes.xml diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/notes.xml erlang-17.3-dfsg/lib/public_key/doc/src/notes.xml --- erlang-18.2-dfsg/lib/public_key/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -35,107 +34,6 @@ notes.xml
    -
    Public_Key 1.1 - -
    Improvements and New Features - - -

    - The 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384' and - 'ecdsa-sha2-nistp521' signature algorithms for ssh are - implemented. See RFC 5656.

    -

    - Own Id: OTP-12936

    -
    - -

    - There is now a file (public_key/priv/moduli) which lists - size-generator-modulus triples. The purpose is to give - servers the possibility to select the crypto primes - randomly among a list of pregenerated triples. This - reduces the risk for some attacks on diffie-hellman - negotiation.

    -

    - See the reference manual for public_key:dh_gex_group/4 - where the handling of this is described.

    -

    - The ssh server (ssh:daemon) uses this.

    -

    - Own Id: OTP-13054 Aux Id: OTP-13052

    -
    - -

    - Add different upper bounds for diffrent string types as - suggested by comment in PKIX1Explicit88.

    -

    - Own Id: OTP-13132

    -
    -
    -
    - -
    - -
    Public_Key 1.0.1 - -
    Improvements and New Features - - -

    - Document enhancements

    -

    - Own Id: OTP-12986

    -
    -
    -
    - -
    - -
    Public_Key 1.0 - -
    Improvements and New Features - - -

    - public_key: Remove legacy switch compact_bit_string

    -

    - E.i bitstrings will not be decode as {Unused, Binary}, - they are now Erlang bitstrings.

    -

    - Also the compact_bit_string implies the - legacy_erlang_types switch So removing the switch will - also make OCTET STRING values be represented as binaries.

    -

    - Undecoded open type will now be wrapped in a - asn1_OPENTYPE tuple.

    -

    - This will change some values in records returned by the - public_key API making this change a potentiall - incompatibility.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-12110

    -
    -
    -
    - -
    - -
    Public_Key 0.23 - -
    Improvements and New Features - - -

    - Improve/extend support for CRL handling.

    -

    - Own Id: OTP-12547 Aux Id: OTP-10362

    -
    -
    -
    - -
    -
    Public_Key 0.22.1
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/part_notes.xml erlang-17.3-dfsg/lib/public_key/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/public_key/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/part.xml erlang-17.3-dfsg/lib/public_key/doc/src/part.xml --- erlang-18.2-dfsg/lib/public_key/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -32,14 +31,15 @@ part.xml -

    This application provides an API to public-key infrastructure +

    This application provides an API to public key infrastructure from RFC - 5280 (X.509 certificates) and public-key formats defined by + 5280 (X.509 certificates) and public key formats defined by the - PKCS standard.

    + PKCS-standard

    + diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/public_key_records.xml erlang-17.3-dfsg/lib/public_key/doc/src/public_key_records.xml --- erlang-18.2-dfsg/lib/public_key/doc/src/public_key_records.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/public_key_records.xml 2014-09-16 19:10:57.000000000 +0000 @@ -5,26 +5,25 @@
    2008 - 2015 + 2014 Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. - Public-Key Records + Public key records Ingela Anderton Andin @@ -35,85 +34,28 @@ public_key_records.xml
    -

    This chapter briefly describes Erlang records derived from ASN.1 - specifications used to handle public key infrastructure. - The scope is to describe the data types of each component, - not the semantics. For information on the - semantics, refer to the relevant standards and RFCs linked in the sections below.

    +

    This chapter briefly describes Erlang records derived from ASN1 + specifications used to handle public and private keys. + The intent is to describe the data types + and not to specify the semantics of each component. For information on the + semantics, please see the relevant standards and RFCs.

    Use the following include directive to get access to the - records and constant macros described in the following sections:

    + records and constant macros described in the following sections.

    -include_lib("public_key/include/public_key.hrl"). -
    - Data Types +
    + Common Data Types

    Common non-standard Erlang - data types used to describe the record fields in the - following sections and which are not defined in the Public Key Reference Manual - follows here:

    - - - time() = -

    uct_time() | general_time()

    - - uct_time() = -

    {utcTime, "YYMMDDHHMMSSZ"}

    - - general_time() = -

    {generalTime, "YYYYMMDDHHMMSSZ"}

    - - general_name() = -

    {rfc822Name, string()}

    -

    | {dNSName, string()}

    -

    | {x400Address, string()}

    -

    | {directoryName, {rdnSequence, [#AttributeTypeAndValue'{}]}}

    -

    | {eidPartyName, special_string()}

    -

    | {eidPartyName, special_string(), special_string()}

    -

    | {uniformResourceIdentifier, string()}

    -

    | {ipAddress, string()}

    -

    | {registeredId, oid()}

    -

    | {otherName, term()}

    -
    - - special_string() = -

    {teletexString, string()}

    -

    | {printableString, string()}

    -

    | {universalString, string()}

    -

    | {utf8String, binary()}

    -

    | {bmpString, string()}

    -
    - - dist_reason() = -

    unused

    -

    | keyCompromise

    -

    | cACompromise

    -

    | affiliationChanged

    -

    | superseded

    -

    | cessationOfOperation

    -

    | certificateHold

    -

    | privilegeWithdrawn

    -

    | aACompromise

    -
    - - OID_macro() = -

    ?OID_name()

    -
    - - OID_name() = -

    atom()

    -
    - -
    - + data types used to described the record fields in the + below sections are defined in public key reference manual

    - +
    - RSA -

    Erlang representation of - Rivest-Shamir-Adleman cryptosystem (RSA) keys follows:

    + RSA as defined by the PKCS-1 standard and <url href="http://www.ietf.org/rfc/rfc3447.txt"> RFC 3447 </url> #'RSAPublicKey'{ @@ -138,13 +80,16 @@ prime, % integer() exponent, % integer() coefficient % integer() - }. + }. +
    - DSA -

    Erlang representation of Digigital Signature Algorithm (DSA) keys

    + DSA as defined by + <url href="http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf"> Digital Signature Standard (NIST FIPS PUB 186-2) </url> + + #'DSAPrivateKey',{ version, % integer() @@ -159,18 +104,18 @@ p, % integer() q, % integer() g % integer() - }. - + }. +
    - ECDSA -

    Erlang representation of Elliptic Curve Digital Signature Algorithm (ECDSA) keys follows:

    + ECC (Elliptic Curve) <url href="http://www.ietf.org/rfc/rfc3447.txt"> RFC 5480 </url> + #'ECPrivateKey'{ version, % integer() - privateKey, % binary() + privateKey, % octet_string() parameters, % der_encoded() - {'EcpkParameters', #'ECParameters'{}} | {'EcpkParameters', {namedCurve, oid()}} | {'EcpkParameters', 'NULL'} % Inherited by CA @@ -181,14 +126,14 @@ version, % integer() fieldID, % #'FieldID'{} curve, % #'Curve'{} - base, % binary() + base, % octet_string() order, % integer() cofactor % integer() }. #'Curve'{ - a, % binary() - b, % binary() + a, % octet_string() + b, % octet_string() seed % bitstring() - optional }. @@ -199,644 +144,10 @@ }. #'ECPoint'{ - point % binary() - the public key - }. -
    - -
    - PKIX Certificates -

    Erlang representation of PKIX certificates derived from ASN.1 - specifications see also X509 certificates (RFC 5280), also referred to as plain type, are as follows:

    - -#'Certificate'{ - tbsCertificate, % #'TBSCertificate'{} - signatureAlgorithm, % #'AlgorithmIdentifier'{} - signature % bitstring() - }. - -#'TBSCertificate'{ - version, % v1 | v2 | v3 - serialNumber, % integer() - signature, % #'AlgorithmIdentifier'{} - issuer, % {rdnSequence, [#AttributeTypeAndValue'{}]} - validity, % #'Validity'{} - subject, % {rdnSequence, [#AttributeTypeAndValue'{}]} - subjectPublicKeyInfo, % #'SubjectPublicKeyInfo'{} - issuerUniqueID, % binary() | asn1_novalue - subjectUniqueID, % binary() | asn1_novalue - extensions % [#'Extension'{}] - }. - -#'AlgorithmIdentifier'{ - algorithm, % oid() - parameters % der_encoded() - }. - -

    Erlang alternate representation of PKIX certificate, also referred to as otp type

    - - -#'OTPCertificate'{ - tbsCertificate, % #'OTPTBSCertificate'{} - signatureAlgorithm, % #'SignatureAlgorithm' - signature % bitstring() - }. - -#'OTPTBSCertificate'{ - version, % v1 | v2 | v3 - serialNumber, % integer() - signature, % #'SignatureAlgorithm' - issuer, % {rdnSequence, [#AttributeTypeAndValue'{}]} - validity, % #'Validity'{} - subject, % {rdnSequence, [#AttributeTypeAndValue'{}]} - subjectPublicKeyInfo, % #'OTPSubjectPublicKeyInfo'{} - issuerUniqueID, % binary() | asn1_novalue - subjectUniqueID, % binary() | asn1_novalue - extensions % [#'Extension'{}] - }. - -#'SignatureAlgorithm'{ - algorithm, % id_signature_algorithm() - parameters % asn1_novalue | #'Dss-Parms'{} - }. - -

    id_signature_algorithm() = OID_macro()

    - -

    The available OID names are as follows:

    - - - OID Name - - - id-dsa-with-sha1 - - - id-dsaWithSHA1 (ISO or OID to above) - - - md2WithRSAEncryption - - - md5WithRSAEncryption - - - sha1WithRSAEncryption - - - sha-1WithRSAEncryption (ISO or OID to above) - - - sha224WithRSAEncryption - - - sha256WithRSAEncryption - - - sha512WithRSAEncryption - - - ecdsa-with-SHA1 - - Signature Algorithm OIDs -
    - -

    The data type 'AttributeTypeAndValue', is represented as - the following erlang record:

    - - -#'AttributeTypeAndValue'{ - type, % id_attributes() - value % term() - }. - -

    The attribute OID name atoms and their corresponding value types -are as follows:

    - - - OID Name - Value Type - - - id-at-name - special_string() - - - id-at-surname - special_string() - - - id-at-givenName - special_string() - - - id-at-initials - special_string() - - - id-at-generationQualifier - special_string() - - - id-at-commonName - special_string() - - - id-at-localityName - special_string() - - - id-at-stateOrProvinceName - special_string() - - - id-at-organizationName - special_string() - - - id-at-title - special_string() - - - id-at-dnQualifier - {printableString, string()} - - - id-at-countryName - {printableString, string()} - - - id-at-serialNumber - {printableString, string()} - - - id-at-pseudonym - special_string() - - Attribute OIDs -
    - -

    The data types 'Validity', 'SubjectPublicKeyInfo', and -'SubjectPublicKeyInfoAlgorithm' are represented as the following Erlang records:

    - - -#'Validity'{ - notBefore, % time() - notAfter % time() - }. - -#'SubjectPublicKeyInfo'{ - algorithm, % #AlgorithmIdentifier{} - subjectPublicKey % binary() - }. - -#'SubjectPublicKeyInfoAlgorithm'{ - algorithm, % id_public_key_algorithm() - parameters % public_key_params() - }. - -

    The public-key algorithm OID name atoms are as follows:

    - - - OID Name - - - rsaEncryption - - - id-dsa - - - dhpublicnumber - - - id-keyExchangeAlgorithm - - - id-ecPublicKey - - Public-Key Algorithm OIDs -
    - - -#'Extension'{ - extnID, % id_extensions() | oid() - critical, % boolean() - extnValue % der_encoded() - }. - -

    id_extensions() - Standard Certificate Extensions, - Private Internet Extensions, - CRL Extensions and - CRL Entry Extensions. -

    - -
    - -
    - - Standard Certificate Extensions - -

    The standard certificate extensions OID name atoms and their - corresponding value types are as follows:

    - - - - OID Name - Value Type - - - id-ce-authorityKeyIdentifier - #'AuthorityKeyIdentifier'{} - - - id-ce-subjectKeyIdentifier - oid() - - - id-ce-keyUsage - [key_usage()] - - - id-ce-privateKeyUsagePeriod - #'PrivateKeyUsagePeriod'{} - - - id-ce-certificatePolicies - #'PolicyInformation'{} - - - - id-ce-policyMappings - #'PolicyMappings_SEQOF'{} - - - - id-ce-subjectAltName - general_name() - - - - id-ce-issuerAltName - general_name() - - - - id-ce-subjectDirectoryAttributes - [#'Attribute'{}] - - - - id-ce-basicConstraints - #'BasicConstraints'{} - - - id-ce-nameConstraints - #'NameConstraints'{} - - - id-ce-policyConstraints - #'PolicyConstraints'{} - - - id-ce-extKeyUsage - [id_key_purpose()] - - - - id-ce-cRLDistributionPoints - [#'DistributionPoint'{}] - - - - id-ce-inhibitAnyPolicy - integer() - - - - id-ce-freshestCRL - [#'DistributionPoint'{}] - - - - Standard Certificate Extensions -
    - -

    Here:

    - - key_usage() - =

    digitalSignature

    -

    | nonRepudiation

    -

    | keyEncipherment

    -

    | dataEncipherment

    -

    | keyAgreement

    -

    | keyCertSign

    -

    | cRLSign

    -

    | encipherOnly

    -

    | decipherOnly

    -
    -
    - -

    And for id_key_purpose():

    - - - - OID Name - - - id-kp-serverAuth - - - id-kp-clientAuth - - - id-kp-codeSigning - - - id-kp-emailProtection - - - id-kp-timeStamping - - - id-kp-OCSPSigning - - Key Purpose OIDs -
    - - -#'AuthorityKeyIdentifier'{ - keyIdentifier, % oid() - authorityCertIssuer, % general_name() - authorityCertSerialNumber % integer() - }. - -#'PrivateKeyUsagePeriod'{ - notBefore, % general_time() - notAfter % general_time() - }. - -#'PolicyInformation'{ - policyIdentifier, % oid() - policyQualifiers % [#PolicyQualifierInfo{}] - }. - -#'PolicyQualifierInfo'{ - policyQualifierId, % oid() - qualifier % string() | #'UserNotice'{} - }. - -#'UserNotice'{ - noticeRef, % #'NoticeReference'{} - explicitText % string() - }. - -#'NoticeReference'{ - organization, % string() - noticeNumbers % [integer()] - }. - -#'PolicyMappings_SEQOF'{ - issuerDomainPolicy, % oid() - subjectDomainPolicy % oid() - }. + point % octet_string() - the public key + }. -#'Attribute'{ - type, % oid() - values % [der_encoded()] - }). - -#'BasicConstraints'{ - cA, % boolean() - pathLenConstraint % integer() - }). - -#'NameConstraints'{ - permittedSubtrees, % [#'GeneralSubtree'{}] - excludedSubtrees % [#'GeneralSubtree'{}] - }). - -#'GeneralSubtree'{ - base, % general_name() - minimum, % integer() - maximum % integer() - }). - -#'PolicyConstraints'{ - requireExplicitPolicy, % integer() - inhibitPolicyMapping % integer() - }). - -#'DistributionPoint'{ - distributionPoint, % {fullName, [general_name()]} | {nameRelativeToCRLIssuer, - [#AttributeTypeAndValue{}]} - reasons, % [dist_reason()] - cRLIssuer % [general_name()] - }). - -
    - -
    - - Private Internet Extensions - -

    The private internet extensions OID name atoms and their corresponding value - types are as follows:

    - - - - OID Name - Value Type - - - id-pe-authorityInfoAccess - [#'AccessDescription'{}] - - - id-pe-subjectInfoAccess - [#'AccessDescription'{}] - - Private Internet Extensions -
    - - -#'AccessDescription'{ - accessMethod, % oid() - accessLocation % general_name() - }). - -
    - -
    - CRL and CRL Extensions Profile - -

    Erlang representation of CRL and CRL extensions profile - derived from ASN.1 specifications and RFC 5280 are as follows:

    - - -#'CertificateList'{ - tbsCertList, % #'TBSCertList{} - signatureAlgorithm, % #'AlgorithmIdentifier'{} - signature % bitstring() - }). - -#'TBSCertList'{ - version, % v2 (if defined) - signature, % #AlgorithmIdentifier{} - issuer, % {rdnSequence, [#AttributeTypeAndValue'{}]} - thisUpdate, % time() - nextUpdate, % time() - revokedCertificates, % [#'TBSCertList_revokedCertificates_SEQOF'{}] - crlExtensions % [#'Extension'{}] - }). - -#'TBSCertList_revokedCertificates_SEQOF'{ - userCertificate, % integer() - revocationDate, % timer() - crlEntryExtensions % [#'Extension'{}] - }). - -
    - - CRL Extensions - -

    The CRL extensions OID name atoms and their corresponding value types are as follows:

    - - - - - OID Name - Value Type - - - id-ce-authorityKeyIdentifier - #'AuthorityKeyIdentifier{} - - - id-ce-issuerAltName - {rdnSequence, [#AttributeTypeAndValue'{}]} - - - id-ce-cRLNumber - integer() - - - id-ce-deltaCRLIndicator - integer() - - - id-ce-issuingDistributionPoint - #'IssuingDistributionPoint'{} - - - id-ce-freshestCRL - [#'Distributionpoint'{}] - - - CRL Extensions -
    - -

    Here, the data type 'IssuingDistributionPoint' is represented as - the following Erlang record:

    + +
    - -#'IssuingDistributionPoint'{ - distributionPoint, % {fullName, [general_name()]} | {nameRelativeToCRLIssuer, - [#AttributeTypeAndValue'{}]} - onlyContainsUserCerts, % boolean() - onlyContainsCACerts, % boolean() - onlySomeReasons, % [dist_reason()] - indirectCRL, % boolean() - onlyContainsAttributeCerts % boolean() - }). -
    - -
    - - CRL Entry Extensions - -

    The CRL entry extensions OID name atoms and their corresponding value types are as follows:

    - - - - OID Name - Value Type - - - id-ce-cRLReason - crl_reason() - - - id-ce-holdInstructionCode - oid() - - - id-ce-invalidityDate - general_time() - - - id-ce-certificateIssuer - general_name() - - CRL Entry Extensions -
    - - -

    Here:

    - - crl_reason() - =

    unspecified

    -

    | keyCompromise

    -

    | cACompromise

    -

    | affiliationChanged

    -

    | superseded

    -

    | cessationOfOperation

    -

    | certificateHold

    -

    | removeFromCRL

    -

    | privilegeWithdrawn

    -

    | aACompromise

    -
    -
    - -
    - -
    - - PKCS#10 Certification Request -

    Erlang representation of a PKCS#10 certification request - derived from ASN.1 specifications and RFC 5280 are as follows:

    - -#'CertificationRequest'{ - certificationRequestInfo #'CertificationRequestInfo'{}, - signatureAlgorithm #'CertificationRequest_signatureAlgorithm'{}}. - signature bitstring() - } - -#'CertificationRequestInfo'{ - version atom(), - subject {rdnSequence, [#AttributeTypeAndValue'{}]} , - subjectPKInfo #'CertificationRequestInfo_subjectPKInfo'{}, - attributes [#'AttributePKCS-10' {}] - } - -#'CertificationRequestInfo_subjectPKInfo'{ - algorithm #'CertificationRequestInfo_subjectPKInfo_algorithm'{} - subjectPublicKey bitstring() - } - -#'CertificationRequestInfo_subjectPKInfo_algorithm'{ - algorithm = oid(), - parameters = der_encoded() -} - -#'CertificationRequest_signatureAlgorithm'{ - algorithm = oid(), - parameters = der_encoded() - } - -#'AttributePKCS-10'{ - type = oid(), - values = [der_encoded()] -} -
    -
    diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/public_key.xml erlang-17.3-dfsg/lib/public_key/doc/src/public_key.xml --- erlang-18.2-dfsg/lib/public_key/doc/src/public_key.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/public_key.xml 2014-09-16 19:10:57.000000000 +0000 @@ -5,21 +5,20 @@
    2008 - 2015 + 2014 Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -32,11 +31,11 @@
    public_key - API module for public-key infrastructure. + API module for public key infrastructure. -

    This module provides functions to handle public-key infrastructure. It can - encode/decode different file formats (PEM, OpenSSH), sign and verify digital signatures, - and validate certificate paths and certificate revocation lists. +

    This module provides functions to handle public key infrastructure. It can + encode/decode different file formats (PEM, openssh), sign and verify digital signatures and validate + certificate paths and certificate revocation lists.

    @@ -44,157 +43,92 @@ public_key - Public Key requires the Crypto and ASN1 applications, - the latter as OTP R16 (hopefully the runtime dependency on ASN1 will + public_key requires the crypto and asn1 applications, the latter since R16 (hopefully the runtime dependency on asn1 will be removed again in the future). Supports RFC 5280 - - Internet X.509 Public-Key Infrastructure Certificate and Certificate Revocation List - (CRL) Profile - Supports PKCS-1 - - RSA Cryptography Standard - Supports DSS - - Digital Signature Standard (DSA - Digital Signature Algorithm) - Supports - PKCS-3 - - Diffie-Hellman Key Agreement Standard - Supports PKCS-5 - - Password-Based Cryptography Standard - Supports PKCS-8 - - Private-Key Information Syntax Standard - Supports PKCS-10 - - Certification Request Syntax Standard + Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile + Supports PKCS-1 - RSA Cryptography Standard + Supports DSS- Digital Signature Standard (DSA - Digital Signature Algorithm) + Supports PKCS-3 - Diffie-Hellman Key Agreement Standard + Supports PKCS-5 - Password-Based Cryptography Standard + Supports PKCS-8 - Private-Key Information Syntax Standard + Supports PKCS-10 - Certification Request Syntax Standard
    - DATA TYPES + COMMON DATA TYPES -

    All records used in this Reference Manual +

    All records used in this manual are generated from ASN.1 specifications and are documented in the User's Guide. See Public-key Records. + marker="public_key_records">Public key records and X.509 Certificate records.

    Use the following include directive to get access to the - records and constant macros described here and in the User's Guide:

    + records and constant macros described here and in the User's Guide.

    -include_lib("public_key/include/public_key.hrl"). -

    The following data types are used in the functions for public_key:

    - - - oid() -

    Object identifier, a tuple of integers as generated by the ASN.1 compiler.

    +

    Data Types

    + +

    oid() - Object Identifier, a tuple of integers as generated by the ASN1 compiler.

    - boolean() = -

    true | false

    - - string() = -

    [bytes()]

    +

    boolean() = true | false

    - der_encoded() = -

    binary()

    +

    string() = [bytes()]

    - pki_asn1_type() = - -

    'Certificate'

    -

    | 'RSAPrivateKey'

    -

    | 'RSAPublicKey'

    -

    | 'DSAPrivateKey'

    -

    | 'DSAPublicKey'

    -

    | 'DHParameter'

    -

    | 'SubjectPublicKeyInfo'

    -

    | 'PrivateKeyInfo'

    -

    | 'CertificationRequest'

    -

    | 'CertificateList'

    -

    | 'ECPrivateKey'

    -

    | 'EcpkParameters'

    -
    - - pem_entry () = -

    {pki_asn1_type(), binary(), %% DER or encrypted DER not_encrypted

    -

    | cipher_info()}

    - - cipher_info() = -

    {"RC2-CBC" | "DES-CBC" | "DES-EDE3-CBC", crypto:rand_bytes(8)

    -

    | {#'PBEParameter{}, digest_type()} | #'PBES2-params'{}}

    -
    - - public_key() = -

    rsa_public_key() | dsa_public_key() | ec_public_key()

    - - private_key() = -

    rsa_private_key() | dsa_private_key() | ec_private_key()

    +

    der_encoded() = binary()

    + +

    pki_asn1_type() = 'Certificate' | 'RSAPrivateKey'| 'RSAPublicKey' | + 'DSAPrivateKey' | 'DSAPublicKey' | 'DHParameter' | + 'SubjectPublicKeyInfo' | 'PrivateKeyInfo' | + 'CertificationRequest' | 'ECPrivateKey' | 'EcpkParameters'

    + +

    pem_entry () = {pki_asn1_type(), binary(), %% DER or encrypted DER + not_encrypted | cipher_info()}

    - rsa_public_key() = -

    #'RSAPublicKey'{}

    +

    cipher_info() = {"RC2-CBC | "DES-CBC" | "DES-EDE3-CBC", + crypto:rand_bytes(8) | {#'PBEParameter{}, digest_type()} |#'PBES2-params'{}}

    + +

    public_key() = rsa_public_key() | dsa_public_key() | ec_public_key()

    +

    private_key() = rsa_private_key() | dsa_private_key() | ec_private_key()

    +

    rsa_public_key() = #'RSAPublicKey'{}

    - rsa_private_key() = -

    #'RSAPrivateKey'{}

    +

    rsa_private_key() = #'RSAPrivateKey'{}

    - dsa_public_key() = -

    {integer(), #'Dss-Parms'{}}

    +

    dsa_public_key() = {integer(), #'Dss-Parms'{}}

    - dsa_private_key() = -

    #'DSAPrivateKey'{}

    +

    dsa_private_key() = #'DSAPrivateKey'{}

    - ec_public_key() -

    = {#'ECPoint'{}, #'EcpkParameters'{} | {namedCurve, oid()}}

    +

    ec_public_key() = {#'ECPoint'{}, #'EcpkParameters'{} | + {namedCurve, oid()}}

    + +

    ec_private_key() = #'ECPrivateKey'{}

    - ec_private_key() = -

    #'ECPrivateKey'{}

    +

    public_crypt_options() = [{rsa_pad, rsa_padding()}].

    - public_crypt_options() = -

    [{rsa_pad, rsa_padding()}]

    +

    rsa_padding() = 'rsa_pkcs1_padding' | 'rsa_pkcs1_oaep_padding' | + 'rsa_no_padding'

    - rsa_padding() = - -

    'rsa_pkcs1_padding'

    -

    | 'rsa_pkcs1_oaep_padding'

    -

    | 'rsa_no_padding'

    -
    +

    digest_type() - Union of below digest types

    + +

    rsa_digest_type() = 'md5' | 'sha' | 'sha224' | 'sha256' | 'sha384' | + 'sha512'

    - digest_type() = -

    Union of rsa_digest_type(), dss_digest_type(), - and ecdsa_digest_type().

    +

    dss_digest_type() = 'sha'

    - rsa_digest_type() = -

    'md5' | 'sha' | 'sha224' | 'sha256' | 'sha384' | 'sha512'

    +

    ecdsa_digest_type() = 'sha'| 'sha224' | 'sha256' | 'sha384' | 'sha512'

    - dss_digest_type() = -

    'sha'

    +

    crl_reason() = unspecified | keyCompromise | cACompromise | + affiliationChanged | superseded | cessationOfOperation | + certificateHold | privilegeWithdrawn | aACompromise

    - ecdsa_digest_type() = -

    'sha'| 'sha224' | 'sha256' | 'sha384' | 'sha512'

    - - crl_reason() = - -

    unspecified

    -

    | keyCompromise

    -

    | cACompromise

    -

    | affiliationChanged

    -

    | superseded

    -

    | cessationOfOperation

    -

    | certificateHold

    -

    | privilegeWithdrawn

    -

    | aACompromise

    -
    - - issuer_name() = -

    {rdnSequence,[#'AttributeTypeAndValue'{}]}

    -
    - - ssh_file() = - -

    openssh_public_key

    -

    | rfc4716_public_key

    -

    | known_hosts

    -

    | auth_keys

    -
    -
    - +

    ssh_file() = openssh_public_key | rfc4716_public_key | known_hosts | + auth_keys

    @@ -202,12 +136,12 @@ - + - + @@ -215,13 +149,13 @@ - + - + - - + +
    @@ -230,27 +164,27 @@ compute_key(OthersKey, MyKey)-> compute_key(OthersKey, MyKey, Params)-> - Computes shared secret. + Compute shared secret OthersKey = #'ECPoint'{} | binary(), MyKey = #'ECPrivateKey'{} | binary() Params = #'DHParameter'{} -

    Computes shared secret.

    +

    Compute shared secret

    decrypt_private(CipherText, Key) -> binary() decrypt_private(CipherText, Key, Options) -> binary() - Public-key decryption. + Public key decryption. CipherText = binary() Key = rsa_private_key() Options = public_crypt_options() -

    Public-key decryption using the private key. See also Public key decryption using the private key. See also crypto:private_decrypt/4

    @@ -258,187 +192,156 @@ decrypt_public(CipherText, Key) - > binary() decrypt_public(CipherText, Key, Options) - > binary() - Public-key decryption. + CipherText = binary() Key = rsa_public_key() Options = public_crypt_options() -

    Public-key decryption using the public key. See also Public key decryption using the public key. See also crypto:public_decrypt/4

    der_decode(Asn1type, Der) -> term() - Decodes a public-key ASN.1 DER encoded entity. + Decodes a public key ASN.1 DER encoded entity. Asn1Type = atom() - ASN.1 type present in the Public Key applications - ASN.1 specifications. + ASN.1 type present in the public_key applications + asn1 specifications. Der = der_encoded() -

    Decodes a public-key ASN.1 DER encoded entity.

    +

    Decodes a public key ASN.1 DER encoded entity.

    der_encode(Asn1Type, Entity) -> der_encoded() - Encodes a public-key entity with ASN.1 DER encoding. + Encodes a public key entity with asn1 DER encoding. Asn1Type = atom() - ASN.1 type present in the Public Key applications + Asn1 type present in the public_key applications ASN.1 specifications. Entity = term() - Erlang representation of Asn1Type + The erlang representation of Asn1Type -

    Encodes a public-key entity with ASN.1 DER encoding.

    +

    Encodes a public key entity with ASN.1 DER encoding.

    - dh_gex_group(MinSize, SuggestedSize, MaxSize, Groups) -> {ok, {Size,Group}} | {error,Error} - Selects a group for Diffie-Hellman key exchange - - MinSize = positive_integer() - SuggestedSize = positive_integer() - MaxSize = positive_integer() - Groups = undefined | [{Size,[{G,P}]}] - Size = positive_integer() - Group = {G,P} - G = positive_integer() - P = positive_integer() - - -

    Selects a group for Diffie-Hellman key exchange with the key size in the range MinSize...MaxSize - and as close to SuggestedSize as possible. If Groups == undefined a default set will be - used, otherwise the group is selected from Groups.

    -

    First a size, as close as possible to SuggestedSize, is selected. Then one group with that key size - is randomly selected from the specified set of groups. If no size within the limits of MinSize - and MaxSize is available, {error,no_group_found} is returned.

    -

    The default set of groups is listed in lib/public_key/priv/moduli. This file may be regenerated like this:

    -
    -	$> cd $ERL_TOP/lib/public_key/priv/
    -	$> generate
    -         ---- wait until all background jobs has finished. It may take several days !
    -	$> cat moduli-* > moduli
    -	$> cd ..; make 
    -      
    -
    -
    - - - encrypt_private(PlainText, Key) -> binary() - Public-key encryption using the private key. - - PlainText = binary() - Key = rsa_private_key() - - -

    Public-key encryption using the private key. - See also crypto:private_encrypt/4.

    -
    -
    - - - encrypt_public(PlainText, Key) -> binary() - Public-key encryption using the public key. - - PlainText = binary() - Key = rsa_public_key() - - -

    Public-key encryption using the public key. See also crypto:public_encrypt/4.

    -
    -
    - - generate_key(Params) -> {Public::binary(), Private::binary()} | #'ECPrivateKey'{} - Generates a new keypair. + Generates a new keypair - Params = #'DHParameter'{} | {namedCurve, oid()} | #'ECParameters'{} + Params = #'DHParameter'{} | {namedCurve, oid()} | #'ECParameters'{} -

    Generates a new keypair.

    +

    Generates a new keypair

    pem_decode(PemBin) -> [pem_entry()] - Decodes PEM binary data and returns - entries as ASN.1 DER encoded entities. + Decode PEM binary data and return + entries as ASN.1 DER encoded entities. PemBin = binary() Example {ok, PemBin} = file:read_file("cert.pem"). -

    Decodes PEM binary data and returns +

    Decode PEM binary data and return entries as ASN.1 DER encoded entities.

    pem_encode(PemEntries) -> binary() - Creates a PEM binary. + Creates a PEM binary PemEntries = [pem_entry()] -

    Creates a PEM binary.

    +

    Creates a PEM binary

    pem_entry_decode(PemEntry) -> term() pem_entry_decode(PemEntry, Password) -> term() - Decodes a PEM entry. + Decodes a pem entry. - PemEntry = pem_entry() - Password = string() + PemEntry = pem_entry() + Password = string() -

    Decodes a PEM entry. pem_decode/1 returns a list of PEM - entries. Notice that if the PEM entry is of type - 'SubjectPublickeyInfo', it is further decoded to an - rsa_public_key() or dsa_public_key().

    +

    Decodes a PEM entry. pem_decode/1 returns a list of PEM + entries. Note that if the PEM entry is of type + 'SubjectPublickeyInfo' it will be further decoded to an + rsa_public_key() or dsa_public_key().

    pem_entry_encode(Asn1Type, Entity) -> pem_entry() pem_entry_encode(Asn1Type, Entity, {CipherInfo, Password}) -> pem_entry() - Creates a PEM entry that can be fed to pem_encode/1. + Creates a PEM entry that can be fed to pem_encode/1. Asn1Type = pki_asn1_type() Entity = term() - Erlang representation of - Asn1Type. If Asn1Type is 'SubjectPublicKeyInfo', - Entity must be either an rsa_public_key() or a - dsa_public_key() and this function creates the appropriate + The Erlang representation of + Asn1Type. If Asn1Type is 'SubjectPublicKeyInfo' + then Entity must be either an rsa_public_key() or a + dsa_public_key() and this function will create the appropriate 'SubjectPublicKeyInfo' entry. CipherInfo = cipher_info() Password = string() -

    Creates a PEM entry that can be feed to pem_encode/1.

    +

    Creates a PEM entry that can be feed to pem_encode/1.

    + + + encrypt_private(PlainText, Key) -> binary() + Public key encryption using the private key. + + PlainText = binary() + Key = rsa_private_key() + + +

    Public key encryption using the private key. + See also crypto:private_encrypt/4

    +
    +
    + + + encrypt_public(PlainText, Key) -> binary() + Public key encryption using the public key. + + PlainText = binary() + Key = rsa_public_key() + + +

    Public key encryption using the public key. See also crypto:public_encrypt/4

    +
    +
    pkix_decode_cert(Cert, otp|plain) -> #'Certificate'{} | #'OTPCertificate'{} - Decodes an ASN.1 DER-encoded PKIX x509 certificate. + Decodes an ASN.1 DER encoded PKIX x509 certificate. Cert = der_encoded() -

    Decodes an ASN.1 DER-encoded PKIX certificate. Option otp - uses the customized ASN.1 specification OTP-PKIX.asn1 for +

    Decodes an ASN.1 DER encoded PKIX certificate. The otp option + will use the customized ASN.1 specification OTP-PKIX.asn1 for decoding and also recursively decode most of the standard parts.

    @@ -450,99 +353,98 @@ certificate. Asn1Type = atom() - The ASN.1 type can be 'Certificate', 'OTPCertificate' or a subtype of either. + The ASN.1 type can be 'Certificate', 'OTPCertificate' or a subtype of either . Entity = #'Certificate'{} | #'OTPCertificate'{} | a valid subtype

    DER encodes a PKIX x509 certificate or part of such a certificate. This function must be used for encoding certificates or parts of certificates - that are decoded/created in the otp format, whereas for the plain format this - function directly calls der_encode/2.

    + that are decoded/created in the otp format, whereas for the plain format this + function will directly call der_encode/2.

    pkix_is_issuer(Cert, IssuerCert) -> boolean() - Checks if IssuerCert issued Cert. + Checks if IssuerCert issued Cert - Cert = der_encoded() | #'OTPCertificate'{} | #'CertificateList'{} - IssuerCert = der_encoded() | #'OTPCertificate'{} + Cert = der_encode() | #'OTPCertificate'{} + IssuerCert = der_encode() | #'OTPCertificate'{} -

    Checks if IssuerCert issued Cert.

    +

    Checks if IssuerCert issued Cert

    pkix_is_fixed_dh_cert(Cert) -> boolean() - Checks if a certificate is a fixed Diffie-Hellman certificate. + Checks if a Certificate is a fixed Diffie-Hellman Cert. - Cert = der_encoded() | #'OTPCertificate'{} + Cert = der_encode() | #'OTPCertificate'{} -

    Checks if a certificate is a fixed Diffie-Hellman certificate.

    +

    Checks if a Certificate is a fixed Diffie-Hellman Cert.

    pkix_is_self_signed(Cert) -> boolean() - Checks if a certificate is self-signed. + Checks if a Certificate is self signed. - Cert = der_encoded() | #'OTPCertificate'{} + Cert = der_encode() | #'OTPCertificate'{} -

    Checks if a certificate is self-signed.

    +

    Checks if a Certificate is self signed.

    pkix_issuer_id(Cert, IssuedBy) -> {ok, IssuerID} | {error, Reason} - Returns the issuer id. + Returns the issuer id. - Cert = der_encoded() | #'OTPCertificate'{} + Cert = der_encode() | #'OTPCertificate'{} IssuedBy = self | other - IssuerID = {integer(), issuer_name()} + IssuerID = {integer(), {rdnSequence, [#'AttributeTypeAndValue'{}]}} The issuer id consists of the serial number and the issuers name. Reason = term() - - -

    Returns the issuer id.

    -
    + + +

    Returns the issuer id.

    +
    - - + pkix_normalize_name(Issuer) -> Normalized - Normalizes an issuer name so that it can be easily - compared to another issuer name. + Normalizes a issuer name so that it can be easily + compared to another issuer name. - Issuer = issuer_name() - Normalized = issuer_name() + Issuer = {rdnSequence,[#'AttributeTypeAndValue'{}]} + Normalized = {rdnSequence, [#'AttributeTypeAndValue'{}]} -

    Normalizes an issuer name so that it can be easily +

    Normalizes a issuer name so that it can be easily compared to another issuer name.

    pkix_path_validation(TrustedCert, CertChain, Options) -> {ok, {PublicKeyInfo, PolicyTree}} | {error, {bad_cert, Reason}} - Performs a basic path validation according to RFC 5280. + Performs a basic path validation according to RFC 5280. - TrustedCert = #'OTPCertificate'{} | der_encoded() | atom() - Normally a trusted certificate, but it can also be a path-validation + TrustedCert = #'OTPCertificate'{} | der_encode() | atom() + Normally a trusted certificate but it can also be a path validation error that can be discovered while - constructing the input to this function and that is to be run through the verify_fun. - Examples are unknown_ca and selfsigned_peer. + constructing the input to this function and that should be run through the verify_fun. + For example unknown_ca or selfsigned_peer - CertChain = [der_encoded()] - A list of DER-encoded certificates in trust order ending with the peer certificate. - Options = proplists:proplist() + CertChain = [der_encode()] + A list of DER encoded certificates in trust order ending with the peer certificate. + Options = proplists:proplist() PublicKeyInfo = {?'rsaEncryption' | ?'id-dsa', rsa_public_key() | integer(), 'NULL' | 'Dss-Parms'{}} - PolicyTree = term() - At the moment this is always an empty list as policies are not currently supported. - Reason = cert_expired | invalid_issuer | invalid_signature | name_not_permitted | + PolicyTree = term() + At the moment this will always be an empty list as Policies are not currently supported + Reason = cert_expired | invalid_issuer | invalid_signature | name_not_permitted | missing_basic_constraint | invalid_key_usage | {revoked, crl_reason()} | atom() @@ -550,17 +452,17 @@

    Performs a basic path validation according to RFC 5280. - However, CRL validation is done separately by pkix_crls_validate/3 and is to be called - from the supplied verify_fun. + However CRL validation is done separately by pkix_crls_validate/3 and should be called + from the supplied verify_fun

    -

    Available options:

    - +

    Available options are:

    + {verify_fun, fun()} -

    The fun must be defined as:

    +

    The fun should be defined as:

    fun(OtpCert :: #'OTPCertificate'{}, @@ -573,112 +475,98 @@ {unknown, UserState :: term()}. -

    If the verify callback fun returns {fail, Reason}, the +

    If the verify callback fun returns {fail, Reason}, the verification process is immediately stopped. If the verify - callback fun returns {valid, UserState}, the verification - process is continued. This can be used to accept specific path - validation errors, such as selfsigned_peer, as well as - verifying application-specific extensions. If called with an - extension unknown to the user application, the return value - {unknown, UserState} is to be used.

    + callback fun returns {valid, UserState}, the verification + process is continued, this can be used to accept specific path + validation errors such as selfsigned_peer as well as + verifying application specific extensions. If called with an + extension unknown to the user application the return value + {unknown, UserState} should be used.

    {max_path_length, integer()} The max_path_length is the maximum number of non-self-issued - intermediate certificates that can follow the peer certificate - in a valid certification path. So, if max_path_length is 0, the PEER must - be signed by the trusted ROOT-CA directly, if it is 1, the path can - be PEER, CA, ROOT-CA, if it is 2, the path can - be PEER, CA, CA, ROOT-CA, and so on. + intermediate certificates that may follow the peer certificate + in a valid certification path. So if max_path_length is 0 the PEER must + be signed by the trusted ROOT-CA directly, if 1 the path can + be PEER, CA, ROOT-CA, if it is 2 PEER, CA, CA, ROOT-CA and so + on.
    -

    Possible reasons for a bad certificate:

    +

    Possible reasons for a bad certificate are:

    cert_expired -

    Certificate is no longer valid as its expiration date has passed.

    + The certificate is no longer valid as its expiration date has passed. invalid_issuer -

    Certificate issuer name does not match the name of the issuer certificate in the chain.

    + The certificate issuer name does not match the name of the issuer certificate in the chain. invalid_signature -

    Certificate was not signed by its issuer certificate in the chain.

    + The certificate was not signed by its issuer certificate in the chain. name_not_permitted -

    Invalid Subject Alternative Name extension.

    + Invalid Subject Alternative Name extension. missing_basic_constraint -

    Certificate, required to have the basic constraints extension, does not have - a basic constraints extension.

    + Certificate, required to have the basic constraints extension, does not have + a basic constraints extension. invalid_key_usage -

    Certificate key is used in an invalid way according to the key-usage extension.

    + Certificate key is used in an invalid way according to the key usage extension. {revoked, crl_reason()} -

    Certificate has been revoked.

    + Certificate has been revoked. atom() -

    Application-specific error reason that is to be checked by the verify_fun.

    + Application specific error reason that should be checked by the verify_fun
    - - pkix_crl_issuer(CRL) -> issuer_name() - Returns the issuer of the CRL. - - CRL = der_encoded() | #'CertificateList'{} - - -

    Returns the issuer of the CRL.

    -
    -
    - pkix_crls_validate(OTPCertificate, DPAndCRLs, Options) -> CRLStatus() - Performs CRL validation. + Performs CRL validation. - OTPCertificate = #'OTPCertificate'{} - DPAndCRLs = [{DP::#'DistributionPoint'{}, {DerCRL::der_encoded(), CRL::#'CertificateList'{}}}] - Options = proplists:proplist() - CRLStatus() = valid | {bad_cert, revocation_status_undetermined} | + OTPCertificate = #'OTPCertificate'{} + DPAndCRLs = [{DP::#'DistributionPoint'{}, {DerCRL::der_encoded(), CRL::#'CertificateList'{}}}] + Options = proplists:proplist() + CRLStatus() = valid | {bad_cert, revocation_status_undetermined} | {bad_cert, {revoked, crl_reason()}} -

    Performs CRL validation. It is intended to be called from +

    Performs CRL validation. It is intended to be called from the verify fun of pkix_path_validation/3 - .

    - -

    Available options:

    - +

    - +

    Available options are:

    {update_crl, fun()} -

    The fun has the following type specification:

    +

    The fun has the following type spec:

    fun(#'DistributionPoint'{}, #'CertificateList'{}) -> #'CertificateList'{} -

    The fun uses the information in the distribution point to access - the latest possible version of the CRL. If this fun is not specified, - Public Key uses the default implementation: +

    The fun should use the information in the distribution point to acesses + the lates possible version of the CRL. If this fun is not specified + public_key will use the default implementation:

    fun(_DP, CRL) -> CRL end
    {issuer_fun, fun()} -

    The fun has the following type specification:

    +

    The fun has the following type spec:

    fun(#'DistributionPoint'{}, #'CertificateList'{}, {rdnSequence,[#'AttributeTypeAndValue'{}]}, term()) -> {ok, #'OTPCertificate'{}, [der_encoded]} -

    The fun returns the root certificate and certificate chain +

    The fun should return the root certificate and certificate chain that has signed the CRL.

    fun(DP, CRL, Issuer, UserState) -> {ok, RootCert, CertChain} @@ -686,130 +574,91 @@
    - - - pkix_crl_verify(CRL, Cert) -> boolean() - Verify that Cert is the CRL signer. - - CRL = der_encoded() | #'CertificateList'{} - Cert = der_encoded() | #'OTPCertificate'{} - - -

    Verify that Cert is the CRL signer.

    -
    -
    - - pkix_dist_point(Cert) -> DistPoint - Creates a distribution point for CRLs issued by the same issuer as Cert. - - Cert = der_encoded() | #'OTPCertificate'{} - DistPoint = #'DistributionPoint'{} - - -

    Creates a distribution point for CRLs issued by the same issuer as Cert. - Can be used as input to pkix_crls_validate/3 -

    -
    -
    - - - pkix_dist_points(Cert) -> DistPoints - Extracts distribution points from the certificates extensions. - - Cert = der_encoded() | #'OTPCertificate'{} - DistPoints = [#'DistributionPoint'{}] - - -

    Extracts distribution points from the certificates extensions.

    -
    -
    - - pkix_sign(#'OTPTBSCertificate'{}, Key) -> der_encoded() + pkix_sign(#'OTPTBSCertificate'{}, Key) -> der_encode() Signs certificate. - Key = rsa_private_key() | dsa_private_key() + Key = rsa_public_key() | dsa_public_key() -

    Signs an 'OTPTBSCertificate'. Returns the corresponding - DER-encoded certificate.

    +

    Signs a 'OTPTBSCertificate'. Returns the corresponding + der encoded certificate.

    pkix_sign_types(AlgorithmId) -> {DigestType, SignatureType} - Translates signature algorithm OID to Erlang digest and signature algorithm types. + Translates signature algorithm oid to erlang digest and signature algorithm types. AlgorithmId = oid() - Signature OID from a certificate or a certificate revocation list. - DigestType = rsa_digest_type() | dss_digest_type() - SignatureType = rsa | dsa | ecdsa + Signature oid from a certificate or a certificate revocation list + DigestType = rsa_digest_type() | dss_digest_type() + SignatureType = rsa | dsa -

    Translates signature algorithm OID to Erlang digest and signature types. +

    Translates signature algorithm oid to erlang digest and signature types.

    pkix_verify(Cert, Key) -> boolean() - Verifies PKIX x.509 certificate signature. + Verify pkix x.509 certificate signature. - Cert = der_encoded() - Key = rsa_public_key() | dsa_public_key() | ec_public_key() + Cert = der_encode() + Key = rsa_public_key() | dsa_public_key() -

    Verifies PKIX x.509 certificate signature.

    +

    Verify PKIX x.509 certificate signature.

    sign(Msg, DigestType, Key) -> binary() - Creates a digital signature. + Create digital signature. Msg = binary() | {digest,binary()} - The Msg is either the binary "plain text" data to be - signed or it is the hashed value of "plain text", that is, the + The msg is either the binary "plain text" data to be + signed or it is the hashed value of "plain text" i.e. the digest. DigestType = rsa_digest_type() | dss_digest_type() | ecdsa_digest_type() Key = rsa_private_key() | dsa_private_key() | ec_private_key() -

    Creates a digital signature.

    +

    Creates a digital signature.

    ssh_decode(SshBin, Type) -> [{public_key(), Attributes::list()}] - Decodes an SSH file-binary. + Decodes a ssh file-binary. SshBin = binary() Example {ok, SshBin} = file:read_file("known_hosts"). - Type = public_key | ssh_file() - If Type is public_key the binary can be either - an RFC4716 public key or an OpenSSH public key. + Type = public_key | ssh_file() + If Type is public_key the binary may be either + a rfc4716 public key or a openssh public key. -

    Decodes an SSH file-binary. In the case of know_hosts or - auth_keys, the binary can include one or more lines of the +

    Decodes a ssh file-binary. In the case of know_hosts or + auth_keys the binary may include one or more lines of the file. Returns a list of public keys and their attributes, possible attribute values depends on the file type represented by the binary.

    - RFC4716 attributes - see RFC 4716. -

    {headers, [{string(), utf8_string()}]}

    - auth_key attributes - see manual page for sshd. + rfc4716 attributes - see RFC 4716 + {headers, [{string(), utf8_string()}]} + auth_key attributes - see man sshd {comment, string()} {options, [string()]} -

    {bits, integer()} - In SSH version 1 files.

    - known_host attributes - see manual page for sshd. + {bits, integer()} - In ssh version 1 files + known_host attributes - see man sshd {hostnames, [string()]} {comment, string()} -

    {bits, integer()} - In SSH version 1 files.

    + {bits, integer()} - In ssh version 1 files
    @@ -817,16 +666,16 @@ ssh_encode([{Key, Attributes}], Type) -> binary() - Encodes a list of SSH file entries to a binary. + Encodes a list of ssh file entries to a binary. Key = public_key() Attributes = list() Type = ssh_file() -

    Encodes a list of SSH file entries (public keys and attributes) to a binary. Possible - attributes depend on the file type, see ssh_decode/2 .

    +

    Encodes a list of ssh file entries (public keys and attributes) to a binary. Possible + attributes depends on the file type, see ssh_decode/2

    @@ -835,14 +684,14 @@ Verifies a digital signature. Msg = binary() | {digest,binary()} - The Msg is either the binary "plain text" data - or it is the hashed value of "plain text", that is, the digest. + The msg is either the binary "plain text" data + or it is the hashed value of "plain text" i.e. the digest. DigestType = rsa_digest_type() | dss_digest_type() | ecdsa_digest_type() Signature = binary() Key = rsa_public_key() | dsa_public_key() | ec_public_key() -

    Veryfies a digital signature.

    +

    Verifies a digital signature

    diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/ref_man.xml erlang-17.3-dfsg/lib/public_key/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/public_key/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -32,8 +31,8 @@ ref_man.xml -

    The public_key application provides functions to handle public-key infrastructure - from RFC 3280 (X.509 certificates) and parts of the PKCS standard. +

    Provides functions to handle public key infrastructure + from RFC 3280 (X.509 certificates) and some parts of the PKCS-standard.

    diff -Nru erlang-18.2-dfsg/lib/public_key/doc/src/using_public_key.xml erlang-17.3-dfsg/lib/public_key/doc/src/using_public_key.xml --- erlang-18.2-dfsg/lib/public_key/doc/src/using_public_key.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/doc/src/using_public_key.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,65 +8,62 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. Getting Started - - - - using_public_key.xml -

    This section describes examples of how to use the - Public Key API. Keys and certificates used in the following - sections are generated only for testing the Public Key - application.

    +
    + General information -

    Some shell printouts in the following examples - are abbreviated for increased readability.

    +

    This chapter is dedicated to showing some + examples of how to use the public_key API. Keys and certificates + used in the following sections are generated only for the purpose + of testing the public key application.

    - -
    - PEM Files -

    Public-key data (keys, certificates, and so on) can be stored in - Privacy Enhanced Mail (PEM) format. - The PEM files have the following structure:

    +

    Note that some shell printouts, in the following examples, + have been abbreviated for increased readability.

    - - <text> - -----BEGIN <SOMETHING>----- - <Attribute> : <Value> - <Base64 encoded DER data> - -----END <SOMETHING>----- - <text> +
    -

    A file can contain several BEGIN/END blocks. Text lines between - blocks are ignored. Attributes, if present, are ignored except - for Proc-Type and DEK-Info, which are used when DER - data is encrypted.

    +
    + PEM files +

    Public key data (keys, certificates etc) may be stored in PEM format. PEM files + comes from the Private Enhanced Mail Internet standard and has a + structure that looks like this:

    + + <text> + -----BEGIN <SOMETHING>----- + <Attribute> : <Value> + <Base64 encoded DER data> + -----END <SOMETHING>----- + <text> + +

    A file can contain several BEGIN/END blocks. Text lines between + blocks are ignored. Attributes, if present, are currently ignored except + for Proc-Type and DEK-Info that are used when the DER data is + encrypted.

    - DSA Private Key -

    A DSA private key can look as follows:

    -

    File handling is not done by the Public Key application.

    + DSA private key +

    Note file handling is not done by the public_key application.

    1> {ok, PemBin} = file:read_file("dsa.pem"). {ok,<<"-----BEGIN DSA PRIVATE KEY-----\nMIIBuw"...>>} -

    The following PEM file has only one entry, a private DSA key:

    +

    This PEM file only has one entry, a private DSA key.

    2> [DSAEntry] = public_key:pem_decode(PemBin). [{'DSAPrivateKey',<<48,130,1,187,2,1,0,2,129,129,0,183, 179,230,217,37,99,144,157,21,228,204, @@ -83,20 +80,21 @@
    - RSA Private Key with Password -

    An RSA private key encrypted with a password can look as follows:

    + RSA private key encrypted with a password. 1> {ok, PemBin} = file:read_file("rsa.pem"). {ok,<<"Bag Attribut"...>>} -

    The following PEM file has only one entry, a private RSA key:

    +

    This PEM file only has one entry a private RSA key.

    2>[RSAEntry] = public_key:pem_decode(PemBin). [{'RSAPrivateKey',<<224,108,117,203,152,40,15,77,128,126, 221,195,154,249,85,208,202,251,109, 119,120,57,29,89,19,9,...>>, - {"DES-EDE3-CBC",<<"kÙeø¼pµL">>}}] + {"DES-EDE3-CBC",<<"kÙeø¼pµL">>}}] + +
    -

    In this following example, the password is "abcd1234":

    +

    In this example the password is "abcd1234".

    3> Key = public_key:pem_entry_decode(RSAEntry, "abcd1234"). #'RSAPrivateKey'{version = 'two-prime', modulus = 1112355156729921663373...2737107, @@ -112,12 +110,11 @@
    X509 Certificates -

    The following is an example of X509 certificates:

    1> {ok, PemBin} = file:read_file("cacerts.pem"). {ok,<<"-----BEGIN CERTIFICATE-----\nMIIC7jCCAl"...>>} -

    The following file includes two certificates:

    +

    This file includes two certificates

    2> [CertEntry1, CertEntry2] = public_key:pem_decode(PemBin). [{'Certificate',<<48,130,2,238,48,130,2,87,160,3,2,1,2,2, 9,0,230,145,97,214,191,2,120,150,48,13, @@ -127,7 +124,7 @@ 1,48,13,6,9,42,134,72,134,247,...>>>, not_encrypted}] -

    Certificates can be decoded as usual:

    +

    Certificates may of course be decoded as usual ...

    2> Cert = public_key:pem_entry_decode(CertEntry1). #'Certificate'{ tbsCertificate = @@ -213,24 +210,24 @@ algorithm = {1,2,840,113549,1,1,5}, parameters = <<5,0>>}, signature = - <<163,186,7,163,216,152,63,47,154,234,139,73,154,96,120, - 165,2,52,196,195,109,167,192,...>>} + {0, + <<163,186,7,163,216,152,63,47,154,234,139,73,154,96,120, + 165,2,52,196,195,109,167,192,...>>}} +
    -

    Parts of certificates can be decoded with - public_key:der_decode/2, using the ASN.1 type of that part. - However, an application-specific certificate extension requires - application-specific ASN.1 decode/encode-functions. - In the recent example, the first value of rdnSequence is - of ASN.1 type 'X520CommonName'. ({2,5,4,3} = ?id-at-commonName):

    +

    Parts of certificates can be decoded with + public_key:der_decode/2 using that parts ASN.1 type. + Although application specific certificate + extension requires application specific ASN.1 decode/encode-functions. + Example, the first value of the rdnSequence above is of ASN.1 type + 'X520CommonName'. ({2,5,4,3} = ?id-at-commonName)

    public_key:der_decode('X520CommonName', <<19,8,101,114,108,97,110,103,67,65>>). {printableString,"erlangCA"} -

    However, certificates can also be decoded using pkix_decode_cert/2, - which can customize and recursively decode standard parts of a certificate:

    - +

    ... but certificates can also be decode using the pkix_decode_cert/2 that + can customize and recursively decode standard parts of a certificate.

    3>{_, DerCert, _} = CertEntry1. - 4> public_key:pkix_decode_cert(DerCert, otp). #'OTPCertificate'{ tbsCertificate = @@ -317,27 +314,30 @@ algorithm = {1,2,840,113549,1,1,5}, parameters = 'NULL'}, signature = + {0, <<163,186,7,163,216,152,63,47,154,234,139,73,154,96,120, - 165,2,52,196,195,109,167,192,...>>} + 165,2,52,196,195,109,167,192,...>>}} + -

    This call is equivalent to public_key:pem_entry_decode(CertEntry1):

    +

    This call is equivalent to public_key:pem_entry_decode(CertEntry1)

    5> public_key:pkix_decode_cert(DerCert, plain). -#'Certificate'{ ...} +#'Certificate'{ ...} +
    - Encoding Public-Key Data to PEM Format + Encoding public key data to PEM format -

    If you have public-key data and want to create a PEM file - this can be done by calling functions - public_key:pem_entry_encode/2 and pem_encode/1 and - saving the result to a file. For example, assume that you have - PubKey = 'RSAPublicKey'{}. Then you can create a PEM-"RSA PUBLIC KEY" - file (ASN.1 type 'RSAPublicKey') or a PEM-"PUBLIC KEY" file - ('SubjectPublicKeyInfo' ASN.1 type).

    +

    If you have public key data and and want to create a PEM file + you can do that by calling the functions + public_key:pem_entry_encode/2 and pem_encode/1 and then saving the + result to a file. For example assume you have PubKey = + 'RSAPublicKey'{} then you can create a PEM-"RSA PUBLIC KEY" file + (ASN.1 type 'RSAPublicKey') or a PEM-"PUBLIC KEY" file + ('SubjectPublicKeyInfo' ASN.1 type).

    -

    The second element of the PEM-entry is the ASN.1 DER encoded - key data:

    +

    The second element of the PEM-entry will be the ASN.1 DER encoded + key data.

    1> PemEntry = public_key:pem_entry_encode('RSAPublicKey', RSAPubKey). {'RSAPublicKey', <<48,72,...>>, not_encrypted} @@ -348,7 +348,7 @@ 3> file:write_file("rsa_pub_key.pem", PemBin). ok -

    or:

    +

    or

    1> PemEntry = public_key:pem_entry_encode('SubjectPublicKeyInfo', RSAPubKey). {'SubjectPublicKeyInfo', <<48,92...>>, not_encrypted} @@ -363,108 +363,96 @@
    - RSA Public-Key Cryptography -

    Suppose you have the following private key and a corresponding public key:

    - - PrivateKey = #'RSAPrivateKey{}' and - the plaintext Msg = binary() - PublicKey = #'RSAPublicKey'{} - - -

    Then you can proceed as follows:

    + RSA public key cryptography +

    Suppose you have PrivateKey = #'RSAPrivateKey{}' and the + plaintext Msg = binary() and the corresponding public key + PublicKey = #'RSAPublicKey'{} then you can do the following. + Note that you normally will only do one of the encrypt or + decrypt operations and the peer will do the other. +

    -

    Encrypt with the private key:

    +

    Encrypt with the private key

    RsaEncrypted = public_key:encrypt_private(Msg, PrivateKey), Msg = public_key:decrypt_public(RsaEncrypted, PublicKey), -

    Encrypt with the public key:

    +

    Encrypt with the public key

    RsaEncrypted = public_key:encrypt_public(Msg, PublicKey), Msg = public_key:decrypt_private(RsaEncrypted, PrivateKey), - -

    You normally do only one of the encrypt or decrypt operations, - and the peer does the other. This normaly used in legacy applications - as a primitive digital signature. -

    -
    - Digital Signatures + Digital signatures -

    Suppose you have the following private key and a corresponding public key:

    - - - PrivateKey = #'RSAPrivateKey{}' or - #'DSAPrivateKey'{} and the plaintext Msg = binary() - PublicKey = #'RSAPublicKey'{} or - {integer(), #'DssParams'{}} - -

    Then you can proceed as follows:

    +

    Suppose you have PrivateKey = #'RSAPrivateKey{}'or + #'DSAPrivateKey'{} and the plaintext Msg = binary() and the + corresponding public key PublicKey = #'RSAPublicKey'{} or + {integer(), #'DssParams'{}} then you can do the following. Note + that you normally will only do one of the sign or verify operations + and the peer will do the other.

    Signature = public_key:sign(Msg, sha, PrivateKey), true = public_key:verify(Msg, sha, Signature, PublicKey), -

    You normally do only one of the sign or verify operations, - and the peer does the other.

    - -

    It can be appropriate to calculate the message digest before - calling sign or verify, and then use none as - second argument:

    +

    It might be appropriate to calculate the message digest before + calling sign or verify and then you can use the none as second + argument.

    Digest = crypto:sha(Msg), Signature = public_key:sign(Digest, none, PrivateKey), -true = public_key:verify(Digest, none, Signature, PublicKey), +true = public_key:verify(Digest, none, Signature, PublicKey), +
    - SSH Files + SSH files

    SSH typically uses PEM files for private keys but has its - own file format for storing public keys. The public_key - application can be used to parse the content of SSH public-key files.

    + own file format for storing public keys. The erlang public_key + application can be used to parse the content of SSH public key files.

    - RFC 4716 SSH Public-Key Files + RFC 4716 SSH public key files

    RFC 4716 SSH files looks confusingly like PEM files, - but there are some differences:

    + but there are some differences.

    1> {ok, SshBin} = file:read_file("ssh2_rsa_pub"). {ok, <<"---- BEGIN SSH2 PUBLIC KEY ----\nAAAA"...>>} -

    This is equivalent to calling public_key:ssh_decode(SshBin, rfc4716_public_key): +

    This is equivalent to calling public_key:ssh_decode(SshBin, rfc4716_public_key).

    2> public_key:ssh_decode(SshBin, public_key). [{#'RSAPublicKey'{modulus = 794430685...91663, - publicExponent = 35}, []}] + publicExponent = 35}, []}] +
    - OpenSSH Public-Key Format -

    OpenSSH public-key format looks as follows:

    + Openssh public key format 1> {ok, SshBin} = file:read_file("openssh_dsa_pub"). {ok,<<"ssh-dss AAAAB3Nza"...>>} -

    This is equivalent to calling public_key:ssh_decode(SshBin, openssh_public_key): +

    This is equivalent to calling public_key:ssh_decode(SshBin, openssh_public_key).

    2> public_key:ssh_decode(SshBin, public_key). [{{15642692...694280725, #'Dss-Parms'{p = 17291273936...696123221, q = 1255626590179665817295475654204371833735706001853, g = 10454211196...480338645}}, - [{comment,"dhopson@VMUbuntu-DSH"}]}] + [{comment,"dhopson@VMUbuntu-DSH"}]}] +
    - Known Hosts - OpenSSH Format -

    Known hosts - OpenSSH format looks as follows:

    + Known hosts - openssh format + 1> {ok, SshBin} = file:read_file("known_hosts"). {ok,<<"hostname.domain.com,192.168.0.1 ssh-rsa AAAAB...>>} -

    Returns a list of public keys and their related attributes. - Each pair of key and attribute corresponds to one entry in - the known hosts file:

    +

    Returns a list of public keys and their related attributes + each pair of key and attributes corresponds to one entry in + the known hosts file.

    2> public_key:ssh_decode(SshBin, known_hosts). [{#'RSAPublicKey'{modulus = 1498979460408...72721699, @@ -473,19 +461,19 @@ {#'RSAPublicKey'{modulus = 14989794604088...2721699, publicExponent = 35}, [{comment,"foo@bar.com"}, - {hostnames,["|1|BWO5qDxk/cFH0wa05JLdHn+j6xQ=|rXQvIxh5cDD3C43k5DPDamawVNA="]}]}] + {hostnames,["|1|BWO5qDxk/cFH0wa05JLdHn+j6xQ=|rXQvIxh5cDD3C43k5DPDamawVNA="]}]}] +
    - Authorized Keys - OpenSSH Format -

    Authorized keys - OpenSSH format looks as follows:

    + Authorized keys - openssh format 1> {ok, SshBin} = file:read_file("auth_keys"). {ok, <<"command=\"dump /home\",no-pty,no-port-forwarding ssh-rsa AAA...>>} -

    Returns a list of public keys and their related attributes. - Each pair of key and attribute corresponds to one entry in - the authorized key file:

    +

    Returns a list of public keys and their related attributes + each pair of key and attributes corresponds to one entry in + the authorized key file.

    2> public_key:ssh_decode(SshBin, auth_keys). [{#'RSAPublicKey'{modulus = 794430685...691663, @@ -497,15 +485,16 @@ #'Dss-Parms'{p = 17291273936185...763696123221, q = 1255626590179665817295475654204371833735706001853, g = 10454211195705...60511039590076780999046480338645}}, - [{comment,"dhopson@VMUbuntu-DSH"}]}] + [{comment,"dhopson@VMUbuntu-DSH"}]}] +
    - Creating an SSH File from Public-Key Data + Creating an SSH file from public key data

    If you got a public key PubKey and a related list of attributes Attributes as returned - by ssh_decode/2, you can create a new SSH file, for example:

    + by ssh_decode/2 you can create a new ssh file for example

    N> SshBin = public_key:ssh_encode([{PubKey, Attributes}], openssh_public_key), <<"ssh-rsa "...>> N+1> file:write_file("id_rsa.pub", SshBin). diff -Nru erlang-18.2-dfsg/lib/public_key/include/public_key.hrl erlang-17.3-dfsg/lib/public_key/include/public_key.hrl --- erlang-18.2-dfsg/lib/public_key/include/public_key.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/include/public_key.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/public_key/Makefile erlang-17.3-dfsg/lib/public_key/Makefile --- erlang-18.2-dfsg/lib/public_key/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2008-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/public_key/priv/convert.escript erlang-17.3-dfsg/lib/public_key/priv/convert.escript --- erlang-18.2-dfsg/lib/public_key/priv/convert.escript 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/priv/convert.escript 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -#!/usr/bin/env escript -%% -*- erlang -*- - -main([InFile,OutFile]) -> - {ok,In} = file:open(InFile,read), - {ok,Out} = file:open(OutFile,write), - write_file(Out, read_file(In)), - file:close(In), - file:close(Out). - -write_file(D, {ok,Ms}) -> - io:format(D,'-define(dh_default_groups,~n ~p~n ).~n',[Ms]). - -one_line(Line, Acc) when is_binary(Line) -> - one_line(binary_to_list(Line), Acc); -one_line("#"++_, Acc) -> - Acc; -one_line(Line, Acc) when is_list(Line) -> - try - [_Time,_Type,_Tests,_Tries,Size,G,P] = string:tokens(Line," \r\n"), - [{list_to_integer(Size), - {list_to_integer(G), list_to_integer(P,16)} - } | Acc] - catch - _:_ -> io:format("*** skip line ~p",[Line]), - Acc - end. - - -collect_per_size(L) -> - lists:foldr( - fun({Sz,GP}, [{Sz,GPs}|Acc]) -> [{Sz,[GP|GPs]}|Acc]; - ({Sz,GP}, Acc) -> [{Sz,[GP]}|Acc] - end, [], lists:sort(L)). - - -read_file(D) -> - read_file(D, []). - -read_file(D, Acc) -> - case io:get_line(D,"") of - {error,Error} -> - {error,Error}; - eof -> - {ok, collect_per_size(Acc)}; - Data -> - read_file(D, one_line(Data,Acc)) - end. - - diff -Nru erlang-18.2-dfsg/lib/public_key/priv/generate erlang-17.3-dfsg/lib/public_key/priv/generate --- erlang-18.2-dfsg/lib/public_key/priv/generate 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/priv/generate 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -#!/bin/bash - -# Generate ssh moduli files for the sizes in $moduli - -moduli="1024 1536 2048 3072 4096 6144 7168 8192" - -# In arg 1: size -# Out: a file "moduli-$1" (for example: $1=2048 -> file "moduli.2048" -function one_modulus() { - candidates=candidate-$1 - ssh-keygen -G $candidates -b $1 - ssh-keygen -T moduli-$1 -f $candidates - rm $candidates -} - - -# Generate in background -for m in $moduli -do - one_modulus $m & -done - -# When all files moduli-* are generated, do: -# cat moduli-* > moduli - diff -Nru erlang-18.2-dfsg/lib/public_key/priv/moduli erlang-17.3-dfsg/lib/public_key/priv/moduli --- erlang-18.2-dfsg/lib/public_key/priv/moduli 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/priv/moduli 1970-01-01 00:00:00.000000000 +0000 @@ -1,193 +0,0 @@ -20151021104105 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D182EB7 -20151021104106 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D27F94F -20151021104107 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D398EB7 -20151021104108 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D4B850F -20151021104108 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D4BF35B -20151021104108 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D5031DF -20151021104109 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D5A4933 -20151021104110 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D6434BF -20151021104111 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D70676B -20151021104111 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D7235E3 -20151021104113 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9D963493 -20151021104114 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9DAABAA7 -20151021104115 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9DC2E333 -20151021104116 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9DE16A7B -20151021104117 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9DE2C5D3 -20151021104118 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9DFF382F -20151021104119 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9E158F13 -20151021104122 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9E4D9FEB -20151021104123 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9E5C1FDB -20151021104126 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9E9BB69B -20151021104126 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9E9F62D3 -20151021104127 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9EAA1C27 -20151021104128 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9EBC3313 -20151021104129 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9EC0733B -20151021104130 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9EDB7AD3 -20151021104132 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9EF56457 -20151021104132 2 6 100 1023 5 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9EF5A9CF -20151021104133 2 6 100 1023 2 CF973CD39DC7D62F2C45AAC5180491104C76E0FE5D80A10E6C06AE442F1F373167B0FCBC931F3C157B10A5557008FDE20D68051E6A4DB11CEE0B0749F76D7134B937A59DA998C42BC234A5C1A3CFCD70E624D253D7694076F7B1FD7B8D3427849C9377B3555796ACA58C69DFF542EEEC9859D3ADCE5CC88DF6F7817C9F13CBB3 -20151021104218 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17BAAFFDF -20151021104222 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17BCB6D93 -20151021104225 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17BE660BB -20151021104226 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17BE676C3 -20151021104229 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17BF3E23B -20151021104230 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17BF95757 -20151021104241 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17C59BEA7 -20151021104242 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17C6231B3 -20151021104244 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17C6879BF -20151021104250 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17C9B678F -20151021104252 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17CA66A4B -20151021104253 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17CAB5543 -20151021104256 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17CB96933 -20151021104300 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17CDA8493 -20151021104308 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17D18C0C7 -20151021104310 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17D1DA5BF -20151021104318 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17D4AB15F -20151021104325 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17D7DE42F -20151021104329 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17DA03D3B -20151021104335 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17DD88BFF -20151021104338 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17DE82B5F -20151021104342 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17E07AF43 -20151021104343 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17E091E6F -20151021104346 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17E28B90F -20151021104347 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17E2A24F3 -20151021104401 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17EB074A7 -20151021104403 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17EC01B0F -20151021104406 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17ED2186F -20151021104407 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17ED55AAB -20151021104411 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17EF58773 -20151021104414 2 6 100 1535 5 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17F0B3267 -20151021104423 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17F4DF61B -20151021104434 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17F9BBB0B -20151021104442 2 6 100 1535 2 CA8FA8EC4B042248C2F4430EE03A77F23899363D2D20972D2BA94033EF18619FD18260B0903BA8B8F385791338369E285FEF46A7FAFF6B02B6888E9810A9C02A3C6FF7F7F85C81205FBE5A387E8A8AA2F42782671F0F86E1C68D3718D03FD517AE44C99FDCD955EF4C762E6245FBA81A9AB492A107A1E72A0FE6A4FE179B00986C4614F66805F921AE05185D52679F3E262B2A0B41812638C7F0421AEDF59BED23860E3FB5A521A11EA2A1E4D483132C857ED7328B9852BB4437C0D17FDD6AFB -20151021104350 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE5E381EF -20151021104414 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE641C193 -20151021104422 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE659F523 -20151021104427 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE660E217 -20151021104438 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE6842F73 -20151021104441 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE689683B -20151021104455 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE6C41E3B -20151021104512 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE71E3BFF -20151021104525 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE75C804F -20151021104527 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE75DC48B -20151021104535 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE7738983 -20151021104543 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE787027B -20151021104610 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE8075A1B -20151021104625 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE84F79B3 -20151021104628 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE859F617 -20151021104641 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE8948E2F -20151021104646 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE8A571B3 -20151021104659 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE8CEA637 -20151021104705 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE8E590FF -20151021104707 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE8E7943F -20151021104731 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE95A975F -20151021104741 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE985F923 -20151021104745 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE996E20B -20151021104806 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BE9FACFD7 -20151021104827 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BEA562C43 -20151021104839 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BEA8F25E3 -20151021104939 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BEBB1DA0B -20151021104941 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BEBB86153 -20151021105002 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BEC1B8883 -20151021105019 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BEC71316F -20151021105035 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BECB1D113 -20151021105042 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BECC3F3AB -20151021105045 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BECCC109B -20151021105101 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BED16353B -20151021105106 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BED24854F -20151021105109 2 6 100 2047 2 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BED2AE4B3 -20151021105116 2 6 100 2047 5 F7693FC11FDDEAA493D3BA36F1FFF9264AA9952209203192A88A697BE9D0E306E306A27430BD87AB9EE9DB4BC78C41950C2EB0E5E4C686E8B1BA6D6A2B1FE91EF40C5EA32C51018323E1D305FE637F35ACABDBFC40AD683F779570A76869EB90015A342B2D1F7C81602688081FCAAA8D623090258D9C5C729C8CDDC0C12CA2D561DD987DB79B6AD7A2A509EBC383BF223FD95BC5A2FCC26FB3F3A0DD3FDC1228E338D3290235A596F9465F7BF490974847E616229A9E60B8F4AA161C52F655843CCCAE8821B40C426B535DE087964778652BBD4EC601C0456AE7128B593FCC64402C891227AE6EE88CC839416FBF462B4852999C646BE0BED7D8CF2BED472CF7 -20151021104612 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E360CD0C3 -20151021104628 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3620FBE7 -20151021104701 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E36490F57 -20151021105014 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E377ACADB -20151021105125 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E37E6DE07 -20151021105320 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E38C2387F -20151021105649 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3A61E46B -20151021105815 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3B0A6A4B -20151021105848 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3B47D2C3 -20151021105948 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3BBBB953 -20151021110011 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3BE3B83B -20151021110036 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3C0A3F1B -20151021110201 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3CB1970F -20151021110208 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3CB70C2B -20151021110235 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3CE4E4DF -20151021110424 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3DB68CD7 -20151021110525 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3E290717 -20151021110655 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3ED6DA83 -20151021110731 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3F14C563 -20151021110831 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E3F85477F -20151021111418 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E420DE56B -20151021111430 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E421DBA2F -20151021111624 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E42F39A93 -20151021111916 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E44302363 -20151021112222 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E4585795F -20151021112245 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E45A1DAFF -20151021112339 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E4601674F -20151021112437 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E46691977 -20151021112521 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E46AF3AD3 -20151021112532 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E46BCAE97 -20151021112708 2 6 100 3071 2 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E476520D3 -20151021112724 2 6 100 3071 5 EF9230A29EC5925FD89310E8F3002A60977FBF02543B6BE08667D8E970AD2468FF1B0892B7310073860FA7145250E6FE7A3902CBE70CC7DB0776031A0868780D47644BD8CD714E41B2AC2D744A51ECA4877FE3D2F496D8E6FC03F2F05B29284DA8682F9BCC93CC16846DF724BFAB53FAAC8492CFBFDCBA92A2F12C221E7FAFC4D8AF54156F649C44869592721FDC2AA65BEDC19DCD2CDD9E14F147F18F900A90B48D6D83197BBFE501FC4F19AE7C16D70DDCE3C757970D1CAFB474A0EA215E747E45C05E90935B721058DDF1BFE23C603A367E66C7E096547952663AFFC9A2B8F6292E12E81A6A61A47D032F7EF62DF4A9998D7B21A7917CC89BA68EB1D40BD9625087754618DC06AA486258DBEAA4B177A82ED0D9E2D9442C89D5354B04712F5159CE4EC6EDD608A5BB25700D24EA16E49A20931891C796B53227698132B5E9321905B81BBB7303BAE12DAB4C864A7B305FE9D6B196921F4890229171DE6DF09FA4D1067255F9D0F05F72DDAA6EB55E73F93EEA17B31A46CB33662E477B3317 -20151021105143 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156BA7321EB -20151021105537 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156BB3AF34B -20151021105816 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156BBC51883 -20151021110444 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156BD1A86C7 -20151021111341 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156BEDB7BBB -20151021111438 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156BF0297AB -20151021111935 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156BFF381FF -20151021113820 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C433A1BF -20151021113833 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C43B426B -20151021113900 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C45007D3 -20151021113921 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C45D8C3B -20151021113941 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C4685D5F -20151021114203 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C4F95D97 -20151021114417 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C57ED2FF -20151021114645 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C612EC33 -20151021114825 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C67219F7 -20151021114922 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C6A942BB -20151021115945 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156C91E14DB -20151021120515 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CA5F5DB3 -20151021120715 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CAD0D497 -20151021121027 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CB8F9D6F -20151021121241 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CC0F677F -20151021121518 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CC9CC647 -20151021121600 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CCC0ADC3 -20151021121734 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CD1BC68B -20151021121759 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CD2A7DBF -20151021122003 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CDA3D323 -20151021122542 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CED8D107 -20151021122856 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156CF8DFEE7 -20151021123548 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156D11CAC4F -20151021123633 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156D1426BBB -20151021124201 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156D2A62F0B -20151021124454 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156D353F0FB -20151021124620 2 6 100 4095 5 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156D3AE526F -20151021125224 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156D535C4CB -20151021130254 2 6 100 4095 2 C8842271626E53546E0C712FA265713F2EE073C20A0723C96B6B182B1EAACC96233D4A199BD0E85F264078A513AD2454F284B8DF543D85019D1E70F2FF54BA43EFBC64AF465C170C3E376F5EC328F98E33E1ED8BED84FA097ABE584152B0E9827ED5CC2B1D4F5ECF2DC46F45C59816D02698EA26F319311E2B6973E83C37021CC8B416AEF653896A1764EE0CEE718A45E8B47CB960BD5907D0E843E8A8E7D4698363C3C3FB3ADC512368B72CAF16510C69052EA2AF51BE00BC8CA04DF1F00A00CC2CA4D74254A1E8738460FD244DDB446CB36554B0A24EEF3710E44DBCF39881E7D3F9AE223388084E7A49A3CB12612AE36416C0EB5628DF1477FEE4A5CF77CDC09AA0E2C989C0B7D1310AFA44B81DA79A65226C7EA510057991EABF9388DC5EA9F52FEA5D3B0872843F50878740794E523E9DC60E0EA1FC8746A7B2AA31FCA89AAA2FA907BED116C69D98F912DD5089BECF28577064225DE96FC214ED1794E7CCE8024F94036D915A123A464C951DA96A5ED7F286F205BEE71BDE2D133FD1891B31178FF25D31611A5B7839F0E68EAF0F8901A571E6917C580F31842A9F19C47E0638483B7947DDCD7864660AC2F8B2C430F1E7FC0F22FA51F96F0499332C5AD3FF9DC7F4332DD5BCCA820CC779B90C0F4C5F0CA52E96FAA187361753FBADC5C80D0492CD80A3EEA5D578772DA9FC1C0E10A0203098AF36D0ED2156D7B5CA43 -20151021111833 2 6 100 6143 5 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B239959D5A7 -20151021112931 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B239A078C1B -20151021123021 2 6 100 6143 5 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B239EC676DF -20151021131523 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23A2B9FC6B -20151021141029 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23A7BD762B -20151021143421 2 6 100 6143 5 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23A9C3EFDF -20151021144912 2 6 100 6143 5 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23AB1077AF -20151021145200 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23AB49943B -20151021145825 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23ABE06353 -20151021150910 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23ACDA0223 -20151021153131 2 6 100 6143 5 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23AE91738F -20151021154038 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23AF40D013 -20151021154300 2 6 100 6143 5 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23AF75AD97 -20151021155008 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23B01C9553 -20151021162240 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23B319431B -20151021162649 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23B35A3D2B -20151021163640 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23B439E263 -20151021171004 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23B748B983 -20151021172144 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23B8609B5B -20151021173002 2 6 100 6143 5 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23B9021E9F -20151021182612 2 6 100 6143 2 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23BE0C1EDB -20151021190053 2 6 100 6143 5 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23C120FF97 -20151021192934 2 6 100 6143 5 FD9E6B52785CD7BE64D396A599DA4B97CD0BB49183F932A97694D80CA553354DBC26E77B8A0EC002257AADDF6AD27819CE64A06416E4A80B6EA92F28EA8D5B96C774109EEE5816B4B18F84368D1B41864C11AA73D6881675D779B174F6B4E344303F3EFD11BD7DE468467242372FD00908F296F5A2B20E2684F9122D08A46D647B05E298F0BCDAB60468349CCA6DA1B9FEBBC69D256FB9A3F1980F68466364FCEF1C98C1405191A6737A3627BA7F7313A8A18FC0B8521BF3430B1C6805CB44BCEB39904DD30130D24B225B598ED83C5FD757B80189FD9D5C2F9596687C40BAB1C6ED6244944629849D074A4C33FB15DDB3F9760FC59C44BEBB0EC032177147F61789769DAAAE2123CE488F7ECF19BDA051925BA9ED11EAA72DF70C9ECC8F714B4C35728E6679E66A1B56CCAE0FBBD3F9EBF950D4D623ED78E77CC3AD604E91F304EA78CE876F036214BD6F1977BD04C9ADD707D7A3BCCE87AD5D5A11C95E7025B0EA9C649DCB37942A3970A4FB04C284E4DDB4DC90163353B98B1C254FFD28443353F17A87C02E0BDB9F05424CC44C86309F1D73706F039CDAAC3EDC1A64F38FB42707D351DB5360C2680ADC1CC8D1C4AD312ACC904382C26BE33DA0E61429A5940820356ED28586BEB629ED1521D12D25B4DA01926295F3DA504DC9F431B719AC63277BE675E6F6DD4F7499CA11A23744577D653941963E8DAB610F7F226DB52CE5C683F72AEED2B6CE35ED07C29410397A6F7F606477CCC0EDE18CD0D96A7863BC4606193A8799B5AC1EEE6AC5EE36AC3077EC8DAB30EE94434B45B78BC13D96F74D6C4056EAA528CD3C68D308344808819B12F2BFB95A5C1A7DEEE188BF139216DDB7D757D7A50D3C46CE18881D776D617DCFFAA62276045373AA4D9446D7570338F99C0CA8A08851B4F9D388B4C275D3F9B7BA25F235D4329F63F7457C2EB5C68CE2A96D19766F0ED8E19F66DF3C5E29A38795B2F92291BB6EAB6F70A7E89DC9691F28486E9CF87FF11D5DF2E6B030A30B5D476AD59A34EE7262712ED96CEF4A5CAC3F08B3563D44683F746DA094C9CDB34427AF8D8CC2AE1B23C3BEB637 -20151021113847 2 6 100 8191 2 DC61EF13E4F3FC10CC946EEABC33F83EFCB35E0F47E4EC25C1CCBB2C7B502B2EFB0691AA231C8476DD51BA73204E6EA10B1A970FE2CF14AF01E72E1AEA87519A91D00D1499189F94A6CDA9E29C05F11F17FE74A4919A710A2787E180744465DF81C62AA65662FDA46FA6175E8A31E5B29E66DED6701C8FC4217E91D733FE94380F046680967D4CEA7BAC8F3916CDF96AA2C474FAD9650F48403FD0B5B756D34667D36A07767FA33027AE55484D0F701C3CA16632F413A14E4B8645AFAF15B78978C19A7661EDC569BEC72394B1204B166A48FCD5F56BE29840C7794CA6D3440356F15858CDCA9B429C7EA92E17242893FDC8C9C63841A382C32F20CFAB121B4BCAFD7BF9EF07FBF7CDFFECA0CEF3A49C3E2B24FA836F3318435255655E1B281071F62D5E4CD63361299B7828F72936E3FEA9E8044562A6F6ADD5321187C3101E4669C6271598FE1A866C93FE2870A4CEB9254BA32A4719E439317EA42200A335B5CFFA7946A7D0F1BD1A69AA11288B73C71C80B77FE3707CB077DDDEA5CA36A449FAB230C9625A0B12F8275D3FF82F5DA380E7A3F11B6F155FE7E91AC960BD95D9B13F7423AB9B15CC3C4DC34EF296033F009468EA16A721AD659F56C18516025050749ABF05E6D3EBD9778142A530979291F46DAA399A86B7BCDF09CC3E6EEF101419762A306DB45AEFC96C64E83F28338D55905F6A387E0F515E580C3A9B35330E21C32198CDEE3AFB355967A098F635FCA7C49CB4E1E82464B2B390EF1F259E40B9A06235C0273F76284FE6BD534EF3AF7CB01A4A5252B8B94CADC2850B2E56D53F9A31D7C029DF967D0A30C05BC64E119BED6076818FABC8CDD93F3255693E14EFC1A740A5D63A5E847FFE87BAB1DDE0506E1762EA61EFA9F9756151ECCCADD91B98A961A901A2D8B01ABDDD29EC804E8C8D28214BBA26048F924CA66316696E51A49D02FF034D20E44914B1115339CAD3819E0CB1640F0084886FEDDE5E28C29DC48ED30A8C3D789734338F5A9DF42584326E536FD1CF30BC85B8DCBD6120D127C98FE4B3614074F13C2CA4854E6D794156C185C40EB3DA7619CE96ADAF0941BD5499848B034C2B11DFECC0BDFA81C594241F759EF53FC7CDE7F2DE4F23CF81A5A0B7D62E31DABB9198D40307F7824DD130B7D1B80E9B6D322FEEDB5ACE34944F0BFB7D016762A9B2E173BFDD69303766AFBAB45FAB75D05430B4A3515858C4B7F04E23414E4AD03842CB0A20D8FF4B59B7C852BA9A5BE982A8ADA5CB70C36CE2A4D2C31A7015C9F3275E43D192C1B2924424088907A057DA7F2D32A2149922AB2E33F2147D637A3508911CB3FEA5E1AAB4525BACF27B6DD7A3E0AFA978FC3A39DE8882FB22688C3CCC92B6E69ACB0BBF575AB3368E51A2F6A20C414C6F146727CC0045F29061E695D29F7C030CE6929EB3AD11A5CBD0CDEE37347869A3 -20151021133636 2 6 100 8191 2 DC61EF13E4F3FC10CC946EEABC33F83EFCB35E0F47E4EC25C1CCBB2C7B502B2EFB0691AA231C8476DD51BA73204E6EA10B1A970FE2CF14AF01E72E1AEA87519A91D00D1499189F94A6CDA9E29C05F11F17FE74A4919A710A2787E180744465DF81C62AA65662FDA46FA6175E8A31E5B29E66DED6701C8FC4217E91D733FE94380F046680967D4CEA7BAC8F3916CDF96AA2C474FAD9650F48403FD0B5B756D34667D36A07767FA33027AE55484D0F701C3CA16632F413A14E4B8645AFAF15B78978C19A7661EDC569BEC72394B1204B166A48FCD5F56BE29840C7794CA6D3440356F15858CDCA9B429C7EA92E17242893FDC8C9C63841A382C32F20CFAB121B4BCAFD7BF9EF07FBF7CDFFECA0CEF3A49C3E2B24FA836F3318435255655E1B281071F62D5E4CD63361299B7828F72936E3FEA9E8044562A6F6ADD5321187C3101E4669C6271598FE1A866C93FE2870A4CEB9254BA32A4719E439317EA42200A335B5CFFA7946A7D0F1BD1A69AA11288B73C71C80B77FE3707CB077DDDEA5CA36A449FAB230C9625A0B12F8275D3FF82F5DA380E7A3F11B6F155FE7E91AC960BD95D9B13F7423AB9B15CC3C4DC34EF296033F009468EA16A721AD659F56C18516025050749ABF05E6D3EBD9778142A530979291F46DAA399A86B7BCDF09CC3E6EEF101419762A306DB45AEFC96C64E83F28338D55905F6A387E0F515E580C3A9B35330E21C32198CDEE3AFB355967A098F635FCA7C49CB4E1E82464B2B390EF1F259E40B9A06235C0273F76284FE6BD534EF3AF7CB01A4A5252B8B94CADC2850B2E56D53F9A31D7C029DF967D0A30C05BC64E119BED6076818FABC8CDD93F3255693E14EFC1A740A5D63A5E847FFE87BAB1DDE0506E1762EA61EFA9F9756151ECCCADD91B98A961A901A2D8B01ABDDD29EC804E8C8D28214BBA26048F924CA66316696E51A49D02FF034D20E44914B1115339CAD3819E0CB1640F0084886FEDDE5E28C29DC48ED30A8C3D789734338F5A9DF42584326E536FD1CF30BC85B8DCBD6120D127C98FE4B3614074F13C2CA4854E6D794156C185C40EB3DA7619CE96ADAF0941BD5499848B034C2B11DFECC0BDFA81C594241F759EF53FC7CDE7F2DE4F23CF81A5A0B7D62E31DABB9198D40307F7824DD130B7D1B80E9B6D322FEEDB5ACE34944F0BFB7D016762A9B2E173BFDD69303766AFBAB45FAB75D05430B4A3515858C4B7F04E23414E4AD03842CB0A20D8FF4B59B7C852BA9A5BE982A8ADA5CB70C36CE2A4D2C31A7015C9F3275E43D192C1B2924424088907A057DA7F2D32A2149922AB2E33F2147D637A3508911CB3FEA5E1AAB4525BACF27B6DD7A3E0AFA978FC3A39DE8882FB22688C3CCC92B6E69ACB0BBF575AB3368E51A2F6A20C414C6F146727CC0045F29061E695D29F7C030CE6929EB3AD11A5CBD0CDEE373914ECA3 -20151021140108 2 6 100 8191 5 DC61EF13E4F3FC10CC946EEABC33F83EFCB35E0F47E4EC25C1CCBB2C7B502B2EFB0691AA231C8476DD51BA73204E6EA10B1A970FE2CF14AF01E72E1AEA87519A91D00D1499189F94A6CDA9E29C05F11F17FE74A4919A710A2787E180744465DF81C62AA65662FDA46FA6175E8A31E5B29E66DED6701C8FC4217E91D733FE94380F046680967D4CEA7BAC8F3916CDF96AA2C474FAD9650F48403FD0B5B756D34667D36A07767FA33027AE55484D0F701C3CA16632F413A14E4B8645AFAF15B78978C19A7661EDC569BEC72394B1204B166A48FCD5F56BE29840C7794CA6D3440356F15858CDCA9B429C7EA92E17242893FDC8C9C63841A382C32F20CFAB121B4BCAFD7BF9EF07FBF7CDFFECA0CEF3A49C3E2B24FA836F3318435255655E1B281071F62D5E4CD63361299B7828F72936E3FEA9E8044562A6F6ADD5321187C3101E4669C6271598FE1A866C93FE2870A4CEB9254BA32A4719E439317EA42200A335B5CFFA7946A7D0F1BD1A69AA11288B73C71C80B77FE3707CB077DDDEA5CA36A449FAB230C9625A0B12F8275D3FF82F5DA380E7A3F11B6F155FE7E91AC960BD95D9B13F7423AB9B15CC3C4DC34EF296033F009468EA16A721AD659F56C18516025050749ABF05E6D3EBD9778142A530979291F46DAA399A86B7BCDF09CC3E6EEF101419762A306DB45AEFC96C64E83F28338D55905F6A387E0F515E580C3A9B35330E21C32198CDEE3AFB355967A098F635FCA7C49CB4E1E82464B2B390EF1F259E40B9A06235C0273F76284FE6BD534EF3AF7CB01A4A5252B8B94CADC2850B2E56D53F9A31D7C029DF967D0A30C05BC64E119BED6076818FABC8CDD93F3255693E14EFC1A740A5D63A5E847FFE87BAB1DDE0506E1762EA61EFA9F9756151ECCCADD91B98A961A901A2D8B01ABDDD29EC804E8C8D28214BBA26048F924CA66316696E51A49D02FF034D20E44914B1115339CAD3819E0CB1640F0084886FEDDE5E28C29DC48ED30A8C3D789734338F5A9DF42584326E536FD1CF30BC85B8DCBD6120D127C98FE4B3614074F13C2CA4854E6D794156C185C40EB3DA7619CE96ADAF0941BD5499848B034C2B11DFECC0BDFA81C594241F759EF53FC7CDE7F2DE4F23CF81A5A0B7D62E31DABB9198D40307F7824DD130B7D1B80E9B6D322FEEDB5ACE34944F0BFB7D016762A9B2E173BFDD69303766AFBAB45FAB75D05430B4A3515858C4B7F04E23414E4AD03842CB0A20D8FF4B59B7C852BA9A5BE982A8ADA5CB70C36CE2A4D2C31A7015C9F3275E43D192C1B2924424088907A057DA7F2D32A2149922AB2E33F2147D637A3508911CB3FEA5E1AAB4525BACF27B6DD7A3E0AFA978FC3A39DE8882FB22688C3CCC92B6E69ACB0BBF575AB3368E51A2F6A20C414C6F146727CC0045F29061E695D29F7C030CE6929EB3AD11A5CBD0CDEE373A17959F diff -Nru erlang-18.2-dfsg/lib/public_key/src/Makefile erlang-17.3-dfsg/lib/public_key/src/Makefile --- erlang-18.2-dfsg/lib/public_key/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2008-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -50,7 +49,7 @@ HRL_FILES = $(INCLUDE)/public_key.hrl -INTERNAL_HRL_FILES = pubkey_moduli.hrl +INTERNAL_HRL_FILES = ERL_FILES = $(MODULES:%=%.erl) @@ -86,11 +85,6 @@ debug opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(HRL_FILES) -$(EBIN)/pubkey_ssh.$(EMULATOR): pubkey_moduli.hrl - -pubkey_moduli.hrl: ../priv/moduli - escript ../priv/convert.escript $< $@ - clean: rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) rm -f core diff -Nru erlang-18.2-dfsg/lib/public_key/src/pubkey_cert.erl erlang-17.3-dfsg/lib/public_key/src/pubkey_cert.erl --- erlang-18.2-dfsg/lib/public_key/src/pubkey_cert.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/src/pubkey_cert.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2014. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,9 +28,8 @@ validate_issuer/4, validate_names/6, validate_extensions/4, normalize_general_name/1, is_self_signed/1, - is_issuer/2, issuer_id/2, distribution_points/1, - is_fixed_dh_cert/1, verify_data/1, verify_fun/4, - select_extension/2, match_name/3, + is_issuer/2, issuer_id/2, is_fixed_dh_cert/1, + verify_data/1, verify_fun/4, select_extension/2, match_name/3, extensions_list/1, cert_auth_key_id/1, time_str_2_gregorian_sec/1]). -define(NULL, 0). @@ -274,16 +272,6 @@ SerialNr = TBSCert#'OTPTBSCertificate'.serialNumber, {ok, {SerialNr, normalize_general_name(Issuer)}}. -distribution_points(Otpcert) -> - TBSCert = Otpcert#'OTPCertificate'.tbsCertificate, - Extensions = extensions_list(TBSCert#'OTPTBSCertificate'.extensions), - case select_extension(?'id-ce-cRLDistributionPoints', Extensions) of - undefined -> - []; - #'Extension'{extnValue = Value} -> - Value - end. - %%-------------------------------------------------------------------- -spec is_fixed_dh_cert(#'OTPCertificate'{}) -> boolean(). %% @@ -308,9 +296,7 @@ %% -------------------------------------------------------------------- verify_fun(Otpcert, Result, UserState0, VerifyFun) -> case VerifyFun(Otpcert, Result, UserState0) of - {valid, UserState} -> - UserState; - {valid_peer, UserState} -> + {valid,UserState} -> UserState; {fail, Reason} -> case Reason of @@ -446,7 +432,7 @@ Extensions. extract_verify_data(OtpCert, DerCert) -> - Signature = OtpCert#'OTPCertificate'.signature, + {_, Signature} = OtpCert#'OTPCertificate'.signature, SigAlgRec = OtpCert#'OTPCertificate'.signatureAlgorithm, SigAlg = SigAlgRec#'SignatureAlgorithm'.algorithm, PlainText = encoded_tbs_cert(DerCert), diff -Nru erlang-18.2-dfsg/lib/public_key/src/pubkey_cert_records.erl erlang-17.3-dfsg/lib/public_key/src/pubkey_cert_records.erl --- erlang-18.2-dfsg/lib/public_key/src/pubkey_cert_records.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/src/pubkey_cert_records.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -218,8 +217,8 @@ %%% SubjectPublicKey decode_supportedPublicKey(#'OTPSubjectPublicKeyInfo'{algorithm= PA = - #'PublicKeyAlgorithm'{algorithm=Algo}, - subjectPublicKey = SPK0}) -> + #'PublicKeyAlgorithm'{algorithm=Algo}, + subjectPublicKey = {0,SPK0}}) -> Type = supportedPublicKeyAlgorithms(Algo), SPK = case Type of 'ECPoint' -> #'ECPoint'{point = SPK0}; @@ -239,7 +238,7 @@ {ok, SPK1} = 'OTP-PUB-KEY':encode(Type, SPK0), SPK1 end, - #'OTPSubjectPublicKeyInfo'{subjectPublicKey = SPK, algorithm=PA}. + #'OTPSubjectPublicKeyInfo'{subjectPublicKey = {0,SPK}, algorithm=PA}. %%% Extensions diff -Nru erlang-18.2-dfsg/lib/public_key/src/pubkey_crl.erl erlang-17.3-dfsg/lib/public_key/src/pubkey_crl.erl --- erlang-18.2-dfsg/lib/public_key/src/pubkey_crl.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/src/pubkey_crl.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -42,10 +41,10 @@ CRLIssuer = TBSCRL#'TBSCertList'.issuer, AltNames = case pubkey_cert:select_extension(?'id-ce-subjectAltName', TBSCert#'OTPTBSCertificate'.extensions) of - #'Extension'{extnValue = Value} -> - Value; - _ -> - [] + undefined -> + []; + Ext -> + Ext#'Extension'.extnValue end, revoked_status(DP, IDP, {directoryName, CRLIssuer}, [ {directoryName, CertIssuer} | AltNames], SerialNumber, Revoked, @@ -474,7 +473,7 @@ extension_value(Extension, ExtType, Extensions) -> case pubkey_cert:select_extension(Extension, Extensions) of #'Extension'{extnValue = Value} -> - public_key:der_decode(ExtType, iolist_to_binary(Value)); + public_key:der_decode(ExtType, list_to_binary(Value)); _ -> undefined end. @@ -566,7 +565,7 @@ {Key, KeyParams}) end. extract_crl_verify_data(CRL, DerCRL) -> - Signature = CRL#'CertificateList'.signature, + {0, Signature} = CRL#'CertificateList'.signature, #'AlgorithmIdentifier'{algorithm = SigAlg} = CRL#'CertificateList'.signatureAlgorithm, PlainText = encoded_tbs_crl(DerCRL), diff -Nru erlang-18.2-dfsg/lib/public_key/src/pubkey_moduli.hrl erlang-17.3-dfsg/lib/public_key/src/pubkey_moduli.hrl --- erlang-18.2-dfsg/lib/public_key/src/pubkey_moduli.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/src/pubkey_moduli.hrl 1970-01-01 00:00:00.000000000 +0000 @@ -1,395 +0,0 @@ --define(dh_default_groups, - [{1023, - [{2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840821904219}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840822843699}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840824293227}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840824411619}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840826770579}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840829698867}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840831699579}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840831788499}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840835116819}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840838791147}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840839741403}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840843908763}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840844149459}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840846037779}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840846316347}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840848087763}, - {2, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840851778483}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840818511543}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840819546447}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840820698807}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840821875983}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840822182367}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840823493823}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840828115623}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840833652783}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840844852263}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840849785943}, - {5, - 145775197456487668749161655795234893413202527697104473695831577761647854852108768430387864189919819365658842431613137268371680467610991509847733954019734973873643148023271112285230508466838215139872267855676600969961870846186166681894080056503367717025795010132090088184706677576861830882312093982840849803727}]}, - {1535, - [{2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891121581459}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891123347643}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891123353283}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891124232763}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891131462067}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891135933003}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891136255299}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891137177907}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891139347603}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891152305467}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891159084867}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891161343219}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891172563627}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891174672243}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891180467739}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891185564427}, - {2, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891189869307}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891119456223}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891124590423}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891130908327}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891131873727}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891135211407}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891143426247}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891143747007}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891146699103}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891150054447}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891155995647}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891157019487}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891159178863}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891161250063}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891170145447}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891171171087}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891172350063}, - {5, - 1907170736023124811736411458785042542925115668082539810200109305735683587893811083066646767750558659131374424885053147631157680241645866111036024727506041045267916677127337026486727329498794109266986160904622741269220273376068857149157352410555723198695322554668593076155279812272319710239217381596287633268687131658367273821116604691564975255858007378139664922713363377579390448226123206847441877045380881530736814422784905045609836858066127174749699891176092263}]}, - {2047, - [{2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127673160083}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127674746147}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127677513587}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127677855803}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127681703483}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127691773067}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127693199747}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127694475899}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127702886939}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127707613619}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127713247667}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127727962403}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127729070603}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127741606979}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127745340899}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127764392459}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127764820307}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127771318403}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127781167379}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127782355883}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127782887579}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127787746619}, - {2, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127789102259}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127666983407}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127675200023}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127687609343}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127691690063}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127708300823}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127712140847}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127715948087}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127717449983}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127717581887}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127725119327}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127735619543}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127776932207}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127788684623}, - {5, - 31232761562882516094884070611630050950237146275890833609093891047897843797997552232718257871173954549538774751038496595396925563385404720255716837933677220581287383288516914691172469244029925326629700819138694871356510866851914242889526314963319760427147424913618697965734069376105953045113129440174661252504850768513753786509136822851125652952326518541742866669959696723616260017966174003560432807987735744247115916855658422620715728754034819398357826714599804921184478793666674492366199879602022266103884178166633701002913239714329019644011011091883511432521179210877235289776043130356321939953141370575127790955767}]}, - {3071, - [{2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199506260163}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199530244827}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199578944619}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199589988939}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199594013379}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199601609043}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199604230203}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199606755099}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199618079787}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199653718659}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199657776483}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199707657579}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199722711699}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199743456099}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199785339603}, - {2, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199797260499}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199507581927}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199510208343}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199537327623}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199551703167}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199617722127}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199621084383}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199634824407}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199642326807}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199665149823}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199708695087}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199765825887}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199767685887}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199773947727}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199780743543}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199786221207}, - {5, - 5436771231278176260464207572014249237436628003751950430443256176419437109283409279325055179822137303309588375578210454771206339795059466564724705882357808020147943371370952376862400031959913112146741735409727429098983569717815170493079969998376532776669142518838712137720503257349411673630616846814922326748760377074686267404617800626017790893617723327526800481821613452766006640701474488365374399399907853664959711238779541522615905232982411502798277910194792404145749492189947629774082615011566526902465295439792626194825661087612449173617161800099003448528272624654517679417559537997833575275437573873218238645979906696208545848771753496507149936213366692226040978858284500769836334638725943292501159483097128028975365907974867494222456802766986272374880246378778326493320216426233834650917807239104899121676291950634433590565261175675893968032464664959347175273331523630462401583678513811133107339834284448366199798706967}]}, - {4095, - [{2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328641094123}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328654189387}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328663242883}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328715041723}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328717604779}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328805204587}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328806565843}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328807451707}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328836115507}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328845968059}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328887178459}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328908234163}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328948166083}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328954136203}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328963052323}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024329023777723}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024329047093003}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024329058480379}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024329090057419}, - {2, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024329132001859}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328685618887}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328733393407}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328804704703}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328808160607}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328817663383}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328826409727}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328842353143}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328915670167}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328928173423}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328936548223}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328945813063}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328955100607}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328983302407}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024328995176167}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024329021303887}, - {5, - 818034524162384276004384029858643530286875094391273833506734966261806257117433972760379103507630310628953496150318170372254219924175532996281953750642804369831900894594960807970232131410638888573275563720690293481410915588408505771183615664441221559618326229227448328879290185035795866796496147000467456347856187771645103733376761936369144682074588463621004219054111244232031965820058057143484947957179035662640791007685559024477920075136419228662974090561346329074935312181886940693299380892129818458511403741106419480550004799657220331973244248753744516935739033770420884365608406478656143540532371463443324228730693491647103274058971797182813283112583029849186056551355376851686616057869624968077484471229044125401535456699914745876082047459812392122562460031611344154642406382436701361983114768023990405077450124649862159757605118611426368650203370143674925598905779061402007525955196464201496773278952462368223659263492419274489020447849336502432222101793313731259141617677580646998184158969477474527427664187763741360356528830301163614618231141541403007931347398186427059736520580903587497382362610721261644208653717495736748724114113311672504064943864203789205551568648546606356374830209356446449765364678719909024329064403567}]}, - {6143, - [{2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255204878912539}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205024824427}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205108938283}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205168452667}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205178336083}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205194695203}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205234987027}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205249389907}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205299503899}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205303762219}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205318419043}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205369723267}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205388065627}, - {2, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205483192027}, - {5, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255204867528103}, - {5, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255204958533343}, - {5, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205142917087}, - {5, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205164709807}, - {5, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205223494543}, - {5, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205238451607}, - {5, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205398650527}, - {5, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205534891927}, - {5, - 33437583241773200736998306224385528803766612787425393970240448895665693432965804079937003812356294308539203151272072972277375104789647202046031197278230667153631409232762771720006125219920706956123725594446372009116332714804701277193618508630316668034287884909832516041233220775901611206642660372233947390606274902141826658826141733970432621047550484555565916575805826057191334266474445170275718783081560666447409216535181360674632456526571101451968821169633558969474691730611539132286052022835952896201555123627380799302110683026529909820807288537680562845821392314996440379370705723540964585839337801927778062852215686895319024767481042895138442976855163068747380166531199300232551267526017036164413600564815784019785977970949693984340717238729942561030179919817420833573731051545887599723662578148436252999801801184946912344055039296858955344284666098693644023712197329293309829111260795234865981993976990661827891668714260305572784933890804266304027991177237933956448650403587826112875783795940606993503972135788451776288043780405914188427059396997568948159052168252857826777287128664074216861215783789478700515409553239441062015685435438583826256963919799489374587339208720501219592669600392307850331252795823771544828155101319705650241344450112892458324477254048023146580514471110326358407290566960742849415447980366665653434043627949138890739742819993505594819520369919793246819138042045825632762369551350013672323292476735446079801969860131404566127284762569608997426987715169971180098109830736446816299192620247945607493820377482306775990092969824710142555863464957556013639252952281232650874597306442373552573476420189325342908686488322042941568296395918651660523487617863085692837653979094810691084612642444899086069505869007138363971482049103042831515780578797971864682660432869186605371682266108433970938695484953644215301255205578782263}]}, - {8191, - [{2, - 938991641448887958659860711024139841840373070892857314837350127283993531354468803860225599873491818506054401963417489724433963777795696041544477412963807403300832656512849715212168703537706302853428971073305304224008208665300028518281475780493382070018498379488833882168221853720545474425047940975435356027594634176129712250061883354535324982741923143373986406603949677080360223989497048086447454366625852264609369284140522273595340921542019308988041920995057608746115976973659704188342646944998285431473302075966106608530908140377765357842459486869512398523240695806503711124427370056638597159539032058092571318621818616699716647464298881944582194013388150591419588422793657857267906072494480713650129757905856314362270238621284311461743652666256381611674809565144562467655186251867429369336740018623120262859220669942243740953355278814789244133782043857008487446798345197999966787658254507117076710455244182794239065255535191498857182705725985655379455993825553257619502588673174759329362518373537685585117537004065137523099625519490356398330532110250061129576411957409731201790054967354938147031111368166150009421041430118523249245874882140875551501824754839814848195806919150975076831338899823813371473496616326897054534509843640848822974414341233324307292275820287661792887177523563243279340678632061899626115667671047274195425889742755327012266774742591229119994211561599405909368902449776535330722644597809098307346948888547387746758109319767106289995123864514603259977184876246412673772519845777697496361969177346826245108557971745523905955370437517039028495325595180934057507336816903052766590118820327869839202378278312909402987412274414739124292902164277499512007446916921747463997761815820546816791093343347969046462095463611789365326128045878985464594892022442144072282717352526544915821855299863549245012366815543939396712522935345161074836470227392836664033041735035699615758782980717425699108612161567924880267630103820215946940542401779795959759774248414245436455737309858403883625882609790799283421857564831362243562647683958370353023343221966296655134926556805244483888769178095889844741765908328185625663202823312608064683035802724504683124396450612201783060593269112984065572954508643688374585823409316161924407053191442613988480926581084892323451281350937867676271858142177713557970909833234285545964647506859724327822527317869059455132036566677244407755994867168874825546516623190701762311472512591018622127119388239627852234680483324150442403}, - {2, - 938991641448887958659860711024139841840373070892857314837350127283993531354468803860225599873491818506054401963417489724433963777795696041544477412963807403300832656512849715212168703537706302853428971073305304224008208665300028518281475780493382070018498379488833882168221853720545474425047940975435356027594634176129712250061883354535324982741923143373986406603949677080360223989497048086447454366625852264609369284140522273595340921542019308988041920995057608746115976973659704188342646944998285431473302075966106608530908140377765357842459486869512398523240695806503711124427370056638597159539032058092571318621818616699716647464298881944582194013388150591419588422793657857267906072494480713650129757905856314362270238621284311461743652666256381611674809565144562467655186251867429369336740018623120262859220669942243740953355278814789244133782043857008487446798345197999966787658254507117076710455244182794239065255535191498857182705725985655379455993825553257619502588673174759329362518373537685585117537004065137523099625519490356398330532110250061129576411957409731201790054967354938147031111368166150009421041430118523249245874882140875551501824754839814848195806919150975076831338899823813371473496616326897054534509843640848822974414341233324307292275820287661792887177523563243279340678632061899626115667671047274195425889742755327012266774742591229119994211561599405909368902449776535330722644597809098307346948888547387746758109319767106289995123864514603259977184876246412673772519845777697496361969177346826245108557971745523905955370437517039028495325595180934057507336816903052766590118820327869839202378278312909402987412274414739124292902164277499512007446916921747463997761815820546816791093343347969046462095463611789365326128045878985464594892022442144072282717352526544915821855299863549245012366815543939396712522935345161074836470227392836664033041735035699615758782980717425699108612161567924880267630103820215946940542401779795959759774248414245436455737309858403883625882609790799283421857564831362243562647683958370353023343221966296655134926556805244483888769178095889844741765908328185625663202823312608064683035802724504683124396450612201783060593269112984065572954508643688374585823409316161924407053191442613988480926581084892323451281350937867676271858142177713557970909833234285545964647506859724327822527317869059455132036566677244407755994867168874825546516623190701762311472512591018622127119388239627852234680483324227808419}, - {5, - 938991641448887958659860711024139841840373070892857314837350127283993531354468803860225599873491818506054401963417489724433963777795696041544477412963807403300832656512849715212168703537706302853428971073305304224008208665300028518281475780493382070018498379488833882168221853720545474425047940975435356027594634176129712250061883354535324982741923143373986406603949677080360223989497048086447454366625852264609369284140522273595340921542019308988041920995057608746115976973659704188342646944998285431473302075966106608530908140377765357842459486869512398523240695806503711124427370056638597159539032058092571318621818616699716647464298881944582194013388150591419588422793657857267906072494480713650129757905856314362270238621284311461743652666256381611674809565144562467655186251867429369336740018623120262859220669942243740953355278814789244133782043857008487446798345197999966787658254507117076710455244182794239065255535191498857182705725985655379455993825553257619502588673174759329362518373537685585117537004065137523099625519490356398330532110250061129576411957409731201790054967354938147031111368166150009421041430118523249245874882140875551501824754839814848195806919150975076831338899823813371473496616326897054534509843640848822974414341233324307292275820287661792887177523563243279340678632061899626115667671047274195425889742755327012266774742591229119994211561599405909368902449776535330722644597809098307346948888547387746758109319767106289995123864514603259977184876246412673772519845777697496361969177346826245108557971745523905955370437517039028495325595180934057507336816903052766590118820327869839202378278312909402987412274414739124292902164277499512007446916921747463997761815820546816791093343347969046462095463611789365326128045878985464594892022442144072282717352526544915821855299863549245012366815543939396712522935345161074836470227392836664033041735035699615758782980717425699108612161567924880267630103820215946940542401779795959759774248414245436455737309858403883625882609790799283421857564831362243562647683958370353023343221966296655134926556805244483888769178095889844741765908328185625663202823312608064683035802724504683124396450612201783060593269112984065572954508643688374585823409316161924407053191442613988480926581084892323451281350937867676271858142177713557970909833234285545964647506859724327822527317869059455132036566677244407755994867168874825546516623190701762311472512591018622127119388239627852234680483324244759967}]}] - ). diff -Nru erlang-18.2-dfsg/lib/public_key/src/pubkey_pbe.erl erlang-17.3-dfsg/lib/public_key/src/pubkey_pbe.erl --- erlang-18.2-dfsg/lib/public_key/src/pubkey_pbe.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/src/pubkey_pbe.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -107,8 +106,9 @@ %%-------------------------------------------------------------------- decrypt_parameters(#'EncryptedPrivateKeyInfo_encryptionAlgorithm'{ algorithm = Oid, parameters = Param}) -> - decrypt_parameters(Oid, decode_handle_open_type_wrapper(Param)). + decrypt_parameters(Oid, Param). + %%-------------------------------------------------------------------- -spec encrypt_parameters({Cipher::string(), Params::term()}) -> #'EncryptedPrivateKeyInfo_encryptionAlgorithm'{}. @@ -129,7 +129,7 @@ password_to_key_and_iv(Password, _Cipher, {#'PBEParameter'{salt = Salt, iterationCount = Count}, Hash}) -> <> - = pbdkdf1(Password, Salt, Count, Hash), + = pbdkdf1(Password, erlang:iolist_to_binary(Salt), Count, Hash), {Key, IV}; password_to_key_and_iv(Password, Cipher, Salt) -> KeyLen = derived_key_length(Cipher, undefined), @@ -151,15 +151,15 @@ do_pbdkdf1(Result, Count-1 , <>, Hash). iv(#'PBES2-params_encryptionScheme'{algorithm = Algo, - parameters = ASN1IV}) - when (Algo == ?'desCBC') or - (Algo == ?'des-EDE3-CBC') -> - <> = decode_handle_open_type_wrapper(ASN1IV), + parameters = ASNIV}) when (Algo == ?'desCBC') or + (Algo == ?'des-EDE3-CBC') -> + %% This is an so called open ASN1-type that in this + %% case will be an octet-string of length 8 + <> = ASNIV, IV; iv(#'PBES2-params_encryptionScheme'{algorithm = ?'rc2CBC', - parameters = ASN1IV}) -> - {ok, #'RC2-CBC-Parameter'{iv = IV}} - = 'PKCS-FRAME':decode('RC2-CBC-Parameter', decode_handle_open_type_wrapper(ASN1IV)), + parameters = ASN1IV}) -> + {ok, #'RC2-CBC-Parameter'{iv = IV}} = 'PKCS-FRAME':decode('RC2-CBC-Parameter', ASN1IV), iolist_to_binary(IV). blocks(1, N, Index, Password, Salt, Count, Prf, PrfHash, PrfLen, Acc) -> @@ -200,13 +200,13 @@ {ok, Der} ='PKCS-FRAME':encode('PBES2-params', Params), #'EncryptedPrivateKeyInfo_encryptionAlgorithm'{ algorithm = ?'id-PBES2', - parameters = encode_handle_open_type_wrapper(Der)}; + parameters = Der}; encrypt_parameters(Cipher, {#'PBEParameter'{} = Params, Hash}) -> {ok, Der} ='PKCS-FRAME':encode('PBEParameter', Params), #'EncryptedPrivateKeyInfo_encryptionAlgorithm'{ algorithm = pbe1_oid(Cipher, Hash), - parameters = encode_handle_open_type_wrapper(Der)}. + parameters = Der}. pbe1_oid("RC2-CBC", sha) -> ?'pbeWithSHA1AndRC2-CBC'; @@ -277,8 +277,3 @@ ceiling(Float) -> erlang:round(Float + 0.5). - -decode_handle_open_type_wrapper({asn1_OPENTYPE, Type}) -> - Type. -encode_handle_open_type_wrapper(Type) -> - {asn1_OPENTYPE, Type}. diff -Nru erlang-18.2-dfsg/lib/public_key/src/pubkey_pem.erl erlang-17.3-dfsg/lib/public_key/src/pubkey_pem.erl --- erlang-18.2-dfsg/lib/public_key/src/pubkey_pem.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/src/pubkey_pem.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -144,7 +143,8 @@ encryptedData = Data} = public_key:der_decode('EncryptedPrivateKeyInfo', Der), DecryptParams = pubkey_pbe:decrypt_parameters(AlgorithmInfo), - {'PrivateKeyInfo', Data, DecryptParams}. + {'PrivateKeyInfo', iolist_to_binary(Data), DecryptParams}. + encode_encrypted_private_keyinfo(EncData, EncryptParmams) -> AlgorithmInfo = pubkey_pbe:encrypt_parameters(EncryptParmams), diff -Nru erlang-18.2-dfsg/lib/public_key/src/pubkey_ssh.erl erlang-17.3-dfsg/lib/public_key/src/pubkey_ssh.erl --- erlang-18.2-dfsg/lib/public_key/src/pubkey_ssh.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/src/pubkey_ssh.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,34 +3,26 @@ %% %% Copyright Ericsson AB 2011-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% -module(pubkey_ssh). -include("public_key.hrl"). --include("pubkey_moduli.hrl"). - --export([decode/2, encode/2, - dh_gex_group/4, - dh_gex_group_sizes/0 - ]). +-export([decode/2, encode/2]). -define(UINT32(X), X:32/unsigned-big-integer). --define(STRING(X), ?UINT32((size(X))), (X)/binary). - %% Max encoded line length is 72, but conformance examples use 68 %% Comment from rfc 4716: "The following are some examples of public %% key files that are compliant (note that the examples all wrap @@ -38,16 +30,13 @@ %% are still compliant.)" So we choose to use 68 also. -define(ENCODED_LINE_LENGTH, 68). - %%==================================================================== %% Internal application API %%==================================================================== %%-------------------------------------------------------------------- -spec decode(binary(), public_key | public_key:ssh_file()) -> - [{public_key:public_key(), Attributes::list()}] - ; (binary(), ssh2_pubkey) -> public_key:public_key() - . + [{public_key:public_key(), Attributes::list()}]. %% %% Description: Decodes a ssh file-binary. %%-------------------------------------------------------------------- @@ -60,71 +49,21 @@ end; decode(Bin, rfc4716_public_key) -> rfc4716_decode(Bin); -decode(Bin, ssh2_pubkey) -> - ssh2_pubkey_decode(Bin); decode(Bin, Type) -> openssh_decode(Bin, Type). %%-------------------------------------------------------------------- -spec encode([{public_key:public_key(), Attributes::list()}], public_key:ssh_file()) -> - binary() - ; (public_key:public_key(), ssh2_pubkey) -> binary() - . + binary(). %% %% Description: Encodes a list of ssh file entries. %%-------------------------------------------------------------------- -encode(Bin, ssh2_pubkey) -> - ssh2_pubkey_encode(Bin); encode(Entries, Type) -> iolist_to_binary(lists:map(fun({Key, Attributes}) -> do_encode(Type, Key, Attributes) end, Entries)). %%-------------------------------------------------------------------- --spec dh_gex_group(integer(), integer(), integer(), - undefined | [{integer(),[{integer(),integer()}]}]) -> - {ok,{integer(),{integer(),integer()}}} | {error,any()} . -%% -%% Description: Returns Generator and Modulus given MinSize, WantedSize -%% and MaxSize -%%-------------------------------------------------------------------- -dh_gex_group(Min, N, Max, undefined) -> - dh_gex_group(Min, N, Max, ?dh_default_groups); -dh_gex_group(Min, N, Max, Groups) -> - case select_by_keylen(Min-10, N, Max+10, Groups) of - {ok,{Sz,GPs}} -> - {ok, {Sz,lists:nth(crypto:rand_uniform(1, 1+length(GPs)), GPs)}}; - Other -> - Other - end. - -dh_gex_group_sizes()-> - [KeyLen || {KeyLen,_} <- ?dh_default_groups]. - -%% Select the one with K closest to N but within the interval [Min,Max] - -select_by_keylen(Min, N, Max, [{K,_Gs}|Groups]) when K < Min -> - select_by_keylen(Min, N, Max, Groups); -select_by_keylen(Min, N, Max, [{K,Gs}|Groups]) when K =< Max -> - {ok, select_by_keylen(Min, N, Max, Groups, {K,Gs})}; -select_by_keylen(_Min, _N, _Max, _) -> - {error,no_group_found}. - -select_by_keylen(_Min, _N, Max, [{K,_Gs}|_Groups], GPprev) when K > Max -> - GPprev; -select_by_keylen(Min, N, Max, [{K,Gs}|Groups], {Kprev,GsPrev}) -> - if - N == K -> {K,Gs}; - N > K -> select_by_keylen(Min, N, Max, Groups, {K,Gs}); - N < K, (K-N) < (N-Kprev) -> {K,Gs}; - N < K -> {Kprev,GsPrev} - end; -select_by_keylen(_Min, _N, _Max, [],GPprev) -> - %% is between Min and Max - GPprev. - - -%%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- begin_marker() -> @@ -190,12 +129,7 @@ {erlint(SizeY, Y), #'Dss-Parms'{p = erlint(SizeP, P), q = erlint(SizeQ, Q), - g = erlint(SizeG, G)}}; -rfc4716_pubkey_decode(<>) -> - <<"ecdsa-sha2-", Id/binary>> = ECDSA_SHA2_etc, - {#'ECPoint'{point = Q}, {namedCurve,public_key:ssh_curvename2oid(Id)}}. + g = erlint(SizeG, G)}}. openssh_decode(Bin, FileType) -> Lines = binary:split(Bin, <<"\n">>, [global]), @@ -249,42 +183,46 @@ end; do_openssh_decode(openssh_public_key = FileType, [Line | Lines], Acc) -> - [KeyType, Base64Enc | Comment0] = split_n(2, Line, []), - KnownKeyType = - case KeyType of - <<"ssh-rsa">> -> true; - <<"ssh-dss">> -> true; - <<"ecdsa-sha2-",Curve/binary>> -> is_ssh_curvename(Curve); - _ -> false - end, - - case Comment0 of - [] when KnownKeyType==true -> + case split_n(2, Line, []) of + [KeyType, Base64Enc] when KeyType == <<"ssh-rsa">>; + KeyType == <<"ssh-dss">> -> do_openssh_decode(FileType, Lines, [{openssh_pubkey_decode(KeyType, Base64Enc), []} | Acc]); - _ when KnownKeyType==true -> + [KeyType, Base64Enc | Comment0] when KeyType == <<"ssh-rsa">>; + KeyType == <<"ssh-dss">> -> Comment = string:strip(string_decode(iolist_to_binary(Comment0)), right, $\n), do_openssh_decode(FileType, Lines, [{openssh_pubkey_decode(KeyType, Base64Enc), [{comment, Comment}]} | Acc]) end. - decode_comment([]) -> []; decode_comment(Comment) -> [{comment, string_decode(iolist_to_binary(Comment))}]. +openssh_pubkey_decode(<<"ssh-rsa">>, Base64Enc) -> + <> + = base64:mime_decode(Base64Enc), + #'RSAPublicKey'{modulus = erlint(SizeN, N), + publicExponent = erlint(SizeE, E)}; -openssh_pubkey_decode(Type, Base64Enc) -> - try - ssh2_pubkey_decode(Type, base64:mime_decode(Base64Enc)) - catch - _:_ -> - {Type, base64:mime_decode(Base64Enc)} - end. - +openssh_pubkey_decode(<<"ssh-dss">>, Base64Enc) -> + <> + = base64:mime_decode(Base64Enc), + {erlint(SizeY, Y), + #'Dss-Parms'{p = erlint(SizeP, P), + q = erlint(SizeQ, Q), + g = erlint(SizeG, G)}}; +openssh_pubkey_decode(KeyType, Base64Enc) -> + {KeyType, base64:mime_decode(Base64Enc)}. erlint(MPIntSize, MPIntValue) -> Bits= MPIntSize * 8, @@ -408,9 +346,10 @@ line_end(Comment) -> [" ", Comment, "\n"]. -key_type(#'RSAPublicKey'{}) -> <<"ssh-rsa">>; -key_type({_, #'Dss-Parms'{}}) -> <<"ssh-dss">>; -key_type({#'ECPoint'{}, {namedCurve,Curve}}) -> <<"ecdsa-sha2-", (public_key:oid2ssh_curvename(Curve))/binary>>. +key_type(#'RSAPublicKey'{}) -> + <<"ssh-rsa">>; +key_type({_, #'Dss-Parms'{}}) -> + <<"ssh-dss">>. comma_list_encode([Option], []) -> Option; @@ -440,49 +379,20 @@ PBin/binary, QBin/binary, GBin/binary, - YBin/binary>>; -ssh2_pubkey_encode(Key={#'ECPoint'{point = Q}, {namedCurve,OID}}) -> - TypeStr = key_type(Key), - StrLen = size(TypeStr), - IdB = public_key:oid2ssh_curvename(OID), - <>. + YBin/binary>>. - -ssh2_pubkey_decode(Bin = <>) -> - ssh2_pubkey_decode(Type, Bin). - -ssh2_pubkey_decode(<<"ssh-rsa">>, - <>) -> - #'RSAPublicKey'{modulus = erlint(SizeN, N), - publicExponent = erlint(SizeE, E)}; - -ssh2_pubkey_decode(<<"ssh-dss">>, - <>) -> - {erlint(SizeY, Y), - #'Dss-Parms'{p = erlint(SizeP, P), - q = erlint(SizeQ, Q), - g = erlint(SizeG, G)}}; -ssh2_pubkey_decode(<<"ecdsa-sha2-",Id/binary>>, - <>) -> - <<"ecdsa-sha2-", Id/binary>> = ECDSA_SHA2_etc, - {#'ECPoint'{point = Q}, {namedCurve,public_key:ssh_curvename2oid(Id)}}. - - - -is_key_field(<<"ssh-dss">>) -> true; -is_key_field(<<"ssh-rsa">>) -> true; -is_key_field(<<"ecdsa-sha2-",Id/binary>>) -> is_ssh_curvename(Id); -is_key_field(_) -> false. +is_key_field(<<"ssh-dss">>) -> + true; +is_key_field(<<"ssh-rsa">>) -> + true; +is_key_field(<<"ecdsa-sha2-nistp256">>) -> + true; +is_key_field(<<"ecdsa-sha2-nistp384">>) -> + true; +is_key_field(<<"ecdsa-sha2-nistp521">>) -> + true; +is_key_field(_) -> + false. is_bits_field(Part) -> try list_to_integer(binary_to_list(Part)) of @@ -596,14 +506,3 @@ list_to_binary(Ds); int_to_bin_neg(X,Ds) -> int_to_bin_neg(X bsr 8, [(X band 255)|Ds]). - - -string(X) when is_binary(X) -> - << ?STRING(X) >>; -string(X) -> - << ?STRING(list_to_binary(X)) >>. - -is_ssh_curvename(Id) -> try public_key:ssh_curvename2oid(Id) of _ -> true - catch _:_ -> false - end. - diff -Nru erlang-18.2-dfsg/lib/public_key/src/public_key.appup.src erlang-17.3-dfsg/lib/public_key/src/public_key.appup.src --- erlang-18.2-dfsg/lib/public_key/src/public_key.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/src/public_key.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/public_key/src/public_key.erl erlang-17.3-dfsg/lib/public_key/src/public_key.erl --- erlang-18.2-dfsg/lib/public_key/src/public_key.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/src/public_key.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -35,8 +34,6 @@ decrypt_private/2, decrypt_private/3, encrypt_public/2, encrypt_public/3, decrypt_public/2, decrypt_public/3, - dh_gex_group/4, - dh_gex_group_sizes/0, sign/3, verify/4, generate_key/1, compute_key/2, compute_key/3, @@ -49,12 +46,7 @@ pkix_normalize_name/1, pkix_path_validation/3, ssh_decode/2, ssh_encode/2, - ssh_curvename2oid/1, oid2ssh_curvename/1, - pkix_crls_validate/3, - pkix_dist_point/1, - pkix_dist_points/1, - pkix_crl_verify/2, - pkix_crl_issuer/1 + pkix_crls_validate/3 ]). -export_type([public_key/0, private_key/0, pem_entry/0, @@ -118,13 +110,13 @@ iolist_to_binary(pubkey_pem:encode(PemEntries)). %%-------------------------------------------------------------------- --spec pem_entry_decode(pem_entry(), string()) -> term(). +-spec pem_entry_decode(pem_entry(), [string()]) -> term(). % %% Description: Decodes a pem entry. pem_decode/1 returns a list of %% pem entries. %%-------------------------------------------------------------------- pem_entry_decode({'SubjectPublicKeyInfo', Der, _}) -> - {_, {'AlgorithmIdentifier', AlgId, Params}, Key0} + {_, {'AlgorithmIdentifier', AlgId, Params}, {0, Key0}} = der_decode('SubjectPublicKeyInfo', Der), KeyType = pubkey_cert_records:supportedPublicKeyAlgorithms(AlgId), case KeyType of @@ -150,16 +142,14 @@ pem_entry_decode({Asn1Type, CryptDer, {Cipher, {#'PBEParameter'{},_}}} = PemEntry, Password) when is_atom(Asn1Type) andalso is_binary(CryptDer) andalso - is_list(Cipher) andalso - is_list(Password) -> + is_list(Cipher) -> do_pem_entry_decode(PemEntry, Password); pem_entry_decode({Asn1Type, CryptDer, {Cipher, Salt}} = PemEntry, Password) when is_atom(Asn1Type) andalso is_binary(CryptDer) andalso is_list(Cipher) andalso is_binary(Salt) andalso - ((erlang:byte_size(Salt) == 8) or (erlang:byte_size(Salt) == 16)) andalso - is_list(Password) -> + ((erlang:byte_size(Salt) == 8) or (erlang:byte_size(Salt) == 16)) -> do_pem_entry_decode(PemEntry, Password). @@ -172,14 +162,14 @@ pem_entry_encode('SubjectPublicKeyInfo', Entity=#'RSAPublicKey'{}) -> Der = der_encode('RSAPublicKey', Entity), Spki = {'SubjectPublicKeyInfo', - {'AlgorithmIdentifier', ?'rsaEncryption', ?DER_NULL}, Der}, + {'AlgorithmIdentifier', ?'rsaEncryption', ?DER_NULL}, {0, Der}}, pem_entry_encode('SubjectPublicKeyInfo', Spki); pem_entry_encode('SubjectPublicKeyInfo', {DsaInt, Params=#'Dss-Parms'{}}) when is_integer(DsaInt) -> KeyDer = der_encode('DSAPublicKey', DsaInt), ParamDer = der_encode('DSAParams', {params, Params}), Spki = {'SubjectPublicKeyInfo', - {'AlgorithmIdentifier', ?'id-dsa', ParamDer}, KeyDer}, + {'AlgorithmIdentifier', ?'id-dsa', ParamDer}, {0, KeyDer}}, pem_entry_encode('SubjectPublicKeyInfo', Spki); pem_entry_encode(Asn1Type, Entity) when is_atom(Asn1Type) -> Der = der_encode(Asn1Type, Entity), @@ -238,7 +228,7 @@ (Asn1Type == 'EncryptedPrivateKeyInfo') -> try {ok, Encoded} = 'PKCS-FRAME':encode(Asn1Type, Entity), - Encoded + iolist_to_binary(Encoded) catch error:{badmatch, {error, _}} = Error -> erlang:error(Error) @@ -247,7 +237,7 @@ der_encode(Asn1Type, Entity) when is_atom(Asn1Type) -> try {ok, Encoded} = 'OTP-PUB-KEY':encode(Asn1Type, Entity), - Encoded + iolist_to_binary(Encoded) catch error:{badmatch, {error, _}} = Error -> erlang:error(Error) @@ -375,13 +365,6 @@ crypto:private_encrypt(rsa, PlainText, format_rsa_private_key(Key), Padding). %%-------------------------------------------------------------------- -dh_gex_group_sizes() -> - pubkey_ssh:dh_gex_group_sizes(). - -dh_gex_group(Min, N, Max, Groups) -> - pubkey_ssh:dh_gex_group(Min, N, Max, Groups). - -%%-------------------------------------------------------------------- -spec generate_key(#'DHParameter'{} | {namedCurve, Name ::oid()} | #'ECParameters'{}) -> {Public::binary(), Private::binary()} | #'ECPrivateKey'{}. @@ -402,7 +385,7 @@ compute_key(#'ECPoint'{point = Point}, #'ECPrivateKey'{privateKey = PrivKey, parameters = Param}) -> ECCurve = ec_curve_spec(Param), - crypto:compute_key(ecdh, Point, PrivKey, ECCurve). + crypto:compute_key(ecdh, Point, list_to_binary(PrivKey), ECCurve). compute_key(PubKey, PrivKey, #'DHParameter'{prime = P, base = G}) -> crypto:compute_key(dh, PubKey, PrivKey, [P, G]). @@ -457,7 +440,7 @@ sign(DigestOrPlainText, DigestType, #'ECPrivateKey'{privateKey = PrivKey, parameters = Param}) -> ECCurve = ec_curve_spec(Param), - crypto:sign(ecdsa, DigestType, DigestOrPlainText, [PrivKey, ECCurve]); + crypto:sign(ecdsa, DigestType, DigestOrPlainText, [list_to_binary(PrivKey), ECCurve]); %% Backwards compatible sign(Digest, none, #'DSAPrivateKey'{} = Key) -> @@ -469,51 +452,22 @@ | dsa_public_key() | ec_public_key()) -> boolean(). %% Description: Verifies a digital signature. %%-------------------------------------------------------------------- -verify(DigestOrPlainText, DigestType, Signature, Key) when is_binary(Signature) -> - do_verify(DigestOrPlainText, DigestType, Signature, Key); -verify(_,_,_,_) -> - %% If Signature is a bitstring and not a binary we know already at this - %% point that the signature is invalid. - false. - -%%-------------------------------------------------------------------- --spec pkix_dist_point(der_encoded() | #'OTPCertificate'{}) -> - #'DistributionPoint'{}. -%% Description: Creates a distribution point for CRLs issued by the same issuer as Cert. -%%-------------------------------------------------------------------- -pkix_dist_point(OtpCert) when is_binary(OtpCert) -> - pkix_dist_point(pkix_decode_cert(OtpCert, otp)); -pkix_dist_point(OtpCert) -> - Issuer = public_key:pkix_normalize_name( - pubkey_cert_records:transform( - OtpCert#'OTPCertificate'.tbsCertificate#'OTPTBSCertificate'.issuer, encode)), - - TBSCert = OtpCert#'OTPCertificate'.tbsCertificate, - Extensions = pubkey_cert:extensions_list(TBSCert#'OTPTBSCertificate'.extensions), - AltNames = case pubkey_cert:select_extension(?'id-ce-issuerAltName', Extensions) of - undefined -> - []; - #'Extension'{extnValue = Value} -> - Value - end, - Point = {fullName, [{directoryName, Issuer} | AltNames]}, - #'DistributionPoint'{cRLIssuer = asn1_NOVALUE, - reasons = asn1_NOVALUE, - distributionPoint = Point}. -%%-------------------------------------------------------------------- --spec pkix_dist_points(der_encoded() | #'OTPCertificate'{}) -> - [#'DistributionPoint'{}]. -%% Description: Extracts distributionpoints specified in the certificates extensions. -%%-------------------------------------------------------------------- -pkix_dist_points(OtpCert) when is_binary(OtpCert) -> - pkix_dist_points(pkix_decode_cert(OtpCert, otp)); -pkix_dist_points(OtpCert) -> - Value = pubkey_cert:distribution_points(OtpCert), - lists:foldl(fun(Point, Acc0) -> - DistPoint = pubkey_cert_records:transform(Point, decode), - [DistPoint | Acc0] - end, - [], Value). +verify(DigestOrPlainText, DigestType, Signature, + #'RSAPublicKey'{modulus = Mod, publicExponent = Exp}) -> + crypto:verify(rsa, DigestType, DigestOrPlainText, Signature, + [Exp, Mod]); + +verify(DigestOrPlaintext, DigestType, Signature, {#'ECPoint'{point = Point}, Param}) -> + ECCurve = ec_curve_spec(Param), + crypto:verify(ecdsa, DigestType, DigestOrPlaintext, Signature, [Point, ECCurve]); + +%% Backwards compatibility +verify(Digest, none, Signature, {_, #'Dss-Parms'{}} = Key ) -> + verify({digest,Digest}, sha, Signature, Key); + +verify(DigestOrPlainText, sha = DigestType, Signature, {Key, #'Dss-Parms'{p = P, q = Q, g = G}}) + when is_integer(Key), is_binary(Signature) -> + crypto:verify(dss, DigestType, DigestOrPlainText, Signature, [P, Q, G, Key]). %%-------------------------------------------------------------------- -spec pkix_sign(#'OTPTBSCertificate'{}, @@ -531,7 +485,7 @@ Signature = sign(Msg, DigestType, Key), Cert = #'OTPCertificate'{tbsCertificate= TBSCert, signatureAlgorithm = SigAlg, - signature = Signature + signature = {0, Signature} }, pkix_encode('OTPCertificate', Cert, otp). @@ -557,25 +511,6 @@ verify(PlainText, DigestType, Signature, Key). %%-------------------------------------------------------------------- --spec pkix_crl_verify(CRL::binary() | #'CertificateList'{}, Cert::binary() | #'OTPCertificate'{}) -> boolean(). -%% -%% Description: Verify that Cert is the CRL signer. -%%-------------------------------------------------------------------- -pkix_crl_verify(CRL, Cert) when is_binary(CRL) -> - pkix_crl_verify(der_decode('CertificateList', CRL), Cert); -pkix_crl_verify(CRL, Cert) when is_binary(Cert) -> - pkix_crl_verify(CRL, pkix_decode_cert(Cert, otp)); -pkix_crl_verify(#'CertificateList'{} = CRL, #'OTPCertificate'{} = Cert) -> - TBSCert = Cert#'OTPCertificate'.tbsCertificate, - PublicKeyInfo = TBSCert#'OTPTBSCertificate'.subjectPublicKeyInfo, - PublicKey = PublicKeyInfo#'OTPSubjectPublicKeyInfo'.subjectPublicKey, - AlgInfo = PublicKeyInfo#'OTPSubjectPublicKeyInfo'.algorithm, - PublicKeyParams = AlgInfo#'PublicKeyAlgorithm'.parameters, - pubkey_crl:verify_crl_signature(CRL, - der_encode('CertificateList', CRL), - PublicKey, PublicKeyParams). - -%%-------------------------------------------------------------------- -spec pkix_is_issuer(Cert :: der_encoded()| #'OTPCertificate'{} | #'CertificateList'{}, IssuerCert :: der_encoded()| #'OTPCertificate'{}) -> boolean(). @@ -629,27 +564,17 @@ % %% Description: Returns the issuer id. %%-------------------------------------------------------------------- -pkix_issuer_id(#'OTPCertificate'{} = OtpCert, Signed) when (Signed == self) or - (Signed == other) -> - pubkey_cert:issuer_id(OtpCert, Signed); -pkix_issuer_id(Cert, Signed) when is_binary(Cert) -> +pkix_issuer_id(#'OTPCertificate'{} = OtpCert, self) -> + pubkey_cert:issuer_id(OtpCert, self); + +pkix_issuer_id(#'OTPCertificate'{} = OtpCert, other) -> + pubkey_cert:issuer_id(OtpCert, other); + +pkix_issuer_id(Cert, Signed) when is_binary(Cert) -> OtpCert = pkix_decode_cert(Cert, otp), pkix_issuer_id(OtpCert, Signed). %%-------------------------------------------------------------------- --spec pkix_crl_issuer(CRL::binary()| #'CertificateList'{}) -> - {rdnSequence, - [#'AttributeTypeAndValue'{}]}. -% -%% Description: Returns the issuer. -%%-------------------------------------------------------------------- -pkix_crl_issuer(CRL) when is_binary(CRL) -> - pkix_crl_issuer(der_decode('CertificateList', CRL)); -pkix_crl_issuer(#'CertificateList'{} = CRL) -> - pubkey_cert_records:transform( - CRL#'CertificateList'.tbsCertList#'TBSCertList'.issuer, decode). - -%%-------------------------------------------------------------------- -spec pkix_normalize_name({rdnSequence, [#'AttributeTypeAndValue'{}]}) -> {rdnSequence, @@ -721,9 +646,7 @@ %%-------------------------------------------------------------------- --spec ssh_decode(binary(), public_key | ssh_file()) -> [{public_key(), Attributes::list()}] - ; (binary(), ssh2_pubkey) -> public_key() - . +-spec ssh_decode(binary(), public_key | ssh_file()) -> [{public_key(), Attributes::list()}]. %% %% Description: Decodes a ssh file-binary. In the case of know_hosts %% or auth_keys the binary may include one or more lines of the @@ -736,15 +659,12 @@ Type == rfc4716_public_key; Type == openssh_public_key; Type == auth_keys; - Type == known_hosts; - Type == ssh2_pubkey -> + Type == known_hosts -> pubkey_ssh:decode(SshBin, Type). %%-------------------------------------------------------------------- --spec ssh_encode([{public_key(), Attributes::list()}], ssh_file()) -> binary() - ; (public_key(), ssh2_pubkey) -> binary() - . -%% +-spec ssh_encode([{public_key(), Attributes::list()}], ssh_file()) -> + binary(). %% Description: Encodes a list of ssh file entries (public keys and %% attributes) to a binary. Possible attributes depends on the file %% type. @@ -753,49 +673,12 @@ Type == rfc4716_public_key; Type == openssh_public_key; Type == auth_keys; - Type == known_hosts; - Type == ssh2_pubkey -> + Type == known_hosts -> pubkey_ssh:encode(Entries, Type). %%-------------------------------------------------------------------- --spec ssh_curvename2oid(binary()) -> oid(). - -%% Description: Converts from the ssh name of elliptic curves to -%% the OIDs. -%%-------------------------------------------------------------------- -ssh_curvename2oid(<<"nistp256">>) -> ?'secp256r1'; -ssh_curvename2oid(<<"nistp384">>) -> ?'secp384r1'; -ssh_curvename2oid(<<"nistp521">>) -> ?'secp521r1'. - -%%-------------------------------------------------------------------- --spec oid2ssh_curvename(oid()) -> binary(). - -%% Description: Converts from elliptic curve OIDs to the ssh name. -%%-------------------------------------------------------------------- -oid2ssh_curvename(?'secp256r1') -> <<"nistp256">>; -oid2ssh_curvename(?'secp384r1') -> <<"nistp384">>; -oid2ssh_curvename(?'secp521r1') -> <<"nistp521">>. - -%%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- -do_verify(DigestOrPlainText, DigestType, Signature, - #'RSAPublicKey'{modulus = Mod, publicExponent = Exp}) -> - crypto:verify(rsa, DigestType, DigestOrPlainText, Signature, - [Exp, Mod]); - -do_verify(DigestOrPlaintext, DigestType, Signature, {#'ECPoint'{point = Point}, Param}) -> - ECCurve = ec_curve_spec(Param), - crypto:verify(ecdsa, DigestType, DigestOrPlaintext, Signature, [Point, ECCurve]); - -%% Backwards compatibility -do_verify(Digest, none, Signature, {_, #'Dss-Parms'{}} = Key ) -> - verify({digest,Digest}, sha, Signature, Key); - -do_verify(DigestOrPlainText, sha = DigestType, Signature, {Key, #'Dss-Parms'{p = P, q = Q, g = G}}) - when is_integer(Key), is_binary(Signature) -> - crypto:verify(dss, DigestType, DigestOrPlainText, Signature, [P, Q, G, Key]). - do_pem_entry_encode(Asn1Type, Entity, CipherInfo, Password) -> Der = der_encode(Asn1Type, Entity), DecryptDer = pubkey_pem:cipher(Der, CipherInfo, Password), @@ -1028,14 +911,13 @@ ec_curve_spec( #'ECParameters'{fieldID = FieldId, curve = PCurve, base = Base, order = Order, cofactor = CoFactor }) -> Field = {pubkey_cert_records:supportedCurvesTypes(FieldId#'FieldID'.fieldType), FieldId#'FieldID'.parameters}, - Curve = {PCurve#'Curve'.a, PCurve#'Curve'.b, none}, - {Field, Curve, Base, Order, CoFactor}; + Curve = {erlang:list_to_binary(PCurve#'Curve'.a), erlang:list_to_binary(PCurve#'Curve'.b), none}, + {Field, Curve, erlang:list_to_binary(Base), Order, CoFactor}; ec_curve_spec({namedCurve, OID}) -> pubkey_cert_records:namedCurves(OID). ec_key({PubKey, PrivateKey}, Params) -> #'ECPrivateKey'{version = 1, - privateKey = PrivateKey, + privateKey = binary_to_list(PrivateKey), parameters = Params, - publicKey = PubKey}. - + publicKey = {0, PubKey}}. diff -Nru erlang-18.2-dfsg/lib/public_key/test/erl_make_certs.erl erlang-17.3-dfsg/lib/public_key/test/erl_make_certs.erl --- erlang-18.2-dfsg/lib/public_key/test/erl_make_certs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/test/erl_make_certs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011-2014. All Rights Reserved. +%% Copyright Ericsson AB 2011-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -115,7 +114,7 @@ #'DSAPrivateKey'{p=P, q=Q, g=G, y=Y} -> public_key:pkix_verify(DerEncodedCert, {Y, #'Dss-Parms'{p=P, q=Q, g=G}}); #'ECPrivateKey'{version = _Version, privateKey = _PrivKey, - parameters = Params, publicKey = PubKey} -> + parameters = Params, publicKey = {0, PubKey}} -> public_key:pkix_verify(DerEncodedCert, {#'ECPoint'{point = PubKey}, Params}) end. @@ -205,7 +204,7 @@ Subject. subject(undefined, IsRootCA) -> - User = if IsRootCA -> "RootCA"; true -> os:getenv("USER", "test_user") end, + User = if IsRootCA -> "RootCA"; true -> user() end, Opts = [{email, User ++ "@erlang.org"}, {name, User}, {city, "Stockholm"}, @@ -216,6 +215,14 @@ subject(Opts, _) -> subject(Opts). +user() -> + case os:getenv("USER") of + false -> + "test_user"; + User -> + User + end. + subject(SubjectOpts) when is_list(SubjectOpts) -> Encode = fun(Opt) -> {Type,Value} = subject_enc(Opt), @@ -260,8 +267,9 @@ Filter = fun({Key, _}, D) -> lists:keydelete(Key, 1, D) end, Exts ++ lists:foldl(Filter, Def, Exts). -extension({_, undefined}) -> []; + +extension({_, undefined}) -> []; extension({basic_constraints, Data}) -> case Data of default -> @@ -278,11 +286,9 @@ #'Extension'{extnID = ?'id-ce-basicConstraints', extnValue = Data} end; - extension({key_usage, default}) -> #'Extension'{extnID = ?'id-ce-keyUsage', extnValue = [keyCertSign], critical = true}; - extension({Id, Data, Critical}) -> #'Extension'{extnID = Id, extnValue = Data, critical = Critical}. @@ -299,7 +305,7 @@ publickey(#'ECPrivateKey'{version = _Version, privateKey = _PrivKey, parameters = Params, - publicKey = PubKey}) -> + publicKey = {0, PubKey}}) -> Algo = #'PublicKeyAlgorithm'{algorithm= ?'id-ecPublicKey', parameters=Params}, #'OTPSubjectPublicKeyInfo'{algorithm = Algo, subjectPublicKey = #'ECPoint'{point = PubKey}}. @@ -324,14 +330,14 @@ {Type, 'NULL'}; sign_algorithm(#'DSAPrivateKey'{p=P, q=Q, g=G}, _Opts) -> {?'id-dsa-with-sha1', {params,#'Dss-Parms'{p=P, q=Q, g=G}}}; -sign_algorithm(#'ECPrivateKey'{parameters = Parms}, Opts) -> +sign_algorithm(#'ECPrivateKey'{}, Opts) -> Type = case proplists:get_value(digest, Opts, sha1) of sha1 -> ?'ecdsa-with-SHA1'; sha512 -> ?'ecdsa-with-SHA512'; sha384 -> ?'ecdsa-with-SHA384'; sha256 -> ?'ecdsa-with-SHA256' end, - {Type, Parms}. + {Type, 'NULL'}. make_key(rsa, _Opts) -> %% (OBS: for testing only) @@ -408,9 +414,9 @@ {PubKey, PrivKey} = crypto:generate_key(ecdh, CurveId), #'ECPrivateKey'{version = 1, - privateKey = PrivKey, + privateKey = binary_to_list(PrivKey), parameters = {namedCurve, pubkey_cert_records:namedCurves(CurveId)}, - publicKey = PubKey}. + publicKey = {0, PubKey}}. %% See fips_186-3.pdf dsa_search(T, P0, Q, Iter) when Iter > 0 -> @@ -479,3 +485,5 @@ PemBin = public_key:pem_encode(Entries), file:write_file(File, PemBin). + + diff -Nru erlang-18.2-dfsg/lib/public_key/test/Makefile erlang-17.3-dfsg/lib/public_key/test/Makefile --- erlang-18.2-dfsg/lib/public_key/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2008-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/public_key/test/pbe_SUITE.erl erlang-17.3-dfsg/lib/public_key/test/pbe_SUITE.erl --- erlang-18.2-dfsg/lib/public_key/test/pbe_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/test/pbe_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/public_key/test/pkits_SUITE.erl erlang-17.3-dfsg/lib/public_key/test/pkits_SUITE.erl --- erlang-18.2-dfsg/lib/public_key/test/pkits_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/test/pkits_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE_data/crl_signer.pem erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE_data/crl_signer.pem --- erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE_data/crl_signer.pem 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE_data/crl_signer.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ ------BEGIN CERTIFICATE----- -MIID8zCCAtugAwIBAgIJAKU8w89SmyPyMA0GCSqGSIb3DQEBBAUAMIGGMREwDwYD -VQQDEwhlcmxhbmdDQTETMBEGA1UECxMKRXJsYW5nIE9UUDEUMBIGA1UEChMLRXJp -Y3Nzb24gQUIxEjAQBgNVBAcTCVN0b2NraG9sbTELMAkGA1UEBhMCU0UxJTAjBgkq -hkiG9w0BCQEWFnBldGVyQGVyaXguZXJpY3Nzb24uc2UwHhcNMTUwMjIzMTMyNTMx -WhcNMTUwMzI1MTMyNTMxWjCBhjERMA8GA1UEAxMIZXJsYW5nQ0ExEzARBgNVBAsT -CkVybGFuZyBPVFAxFDASBgNVBAoTC0VyaWNzc29uIEFCMRIwEAYDVQQHEwlTdG9j -a2hvbG0xCzAJBgNVBAYTAlNFMSUwIwYJKoZIhvcNAQkBFhZwZXRlckBlcml4LmVy -aWNzc29uLnNlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyzwkmKzy -WTLOafHmgqZVENdt3OYECPA4BamVKyEdi8zgXI0S71wzPZ+XvuGbHDTBzsTHf71L -xRQgoG30tv5jqWSlfh8iyS6fO+FHxBKd+xg6hLJXk5PCUa5X1D4BO8B4aapEzev+ -T8+pTaOLeVPdfGfKp0yWF50eCpdSF/kMCCIIA8QNSahfcwuLbEEzUNZof6YPZBNm -e+XUMXCjpb/mU7krfu8nLaspG1HgxQqErEEBzGJE7mguqSVETK/xpGXEMTNIuj8N -ziFrfqAezDob3z48xHUaHKZRBb9NIxWIjVxkTYaqOtf9UNCT96CHeZ7rk9iNscQu -USabMIamFY8cNQIDAQABo2IwYDAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIB -BjAdBgNVHQ4EFgQUm2M3f6UBEIsHI1HIvphbBz60RsAwIQYDVR0RBBowGIEWcGV0 -ZXJAZXJpeC5lcmljc3Nvbi5zZTANBgkqhkiG9w0BAQQFAAOCAQEAPmm0V36HZySF -BoV03DGyeFUSeMtO0DO058NaXXv2VNPpUXT72Mt1ovXNvVFcReggb01polF7TFFI -4NRb6qbsLPxny29Clf/9WKY4zDhbb2MIy8yueoOyyeNQtrzY+iQjo4q9U+Aa6xj1 -pxmG1URDfOmCgX33ItCrZXFGa4ic0HrbWgJMDNo4lSOiio8bl3IYN4vBcobRfhDs -pw5jochE5ZpPh4i76Pg6D99EFkNaLyQioWEu4n2OxR0EBSFLJkVJQ0alUx18AKio -bje+h5nzRgTm5HApYzcorF57KfUKPDaW1Q6tRckRyHApueDuK8p49ITQE71lmkLc -ywxoJMrNnA== ------END CERTIFICATE----- - diff -Nru erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE_data/idp_cert.pem erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE_data/idp_cert.pem --- erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE_data/idp_cert.pem 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE_data/idp_cert.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFGjCCBAKgAwIBAgIBAzANBgkqhkiG9w0BAQQFADCBgzEOMAwGA1UEAxMFb3Rw -Q0ExEzARBgNVBAsTCkVybGFuZyBPVFAxFDASBgNVBAoTC0VyaWNzc29uIEFCMQsw -CQYDVQQGEwJTRTESMBAGA1UEBxMJU3RvY2tob2xtMSUwIwYJKoZIhvcNAQkBFhZw -ZXRlckBlcml4LmVyaWNzc29uLnNlMB4XDTE1MDIyMzEzMjUzMVoXDTI1MDEwMTEz -MjUzMVowgYQxDzANBgNVBAMTBnNlcnZlcjETMBEGA1UECxMKRXJsYW5nIE9UUDEU -MBIGA1UEChMLRXJpY3Nzb24gQUIxCzAJBgNVBAYTAlNFMRIwEAYDVQQHEwlTdG9j -a2hvbG0xJTAjBgkqhkiG9w0BCQEWFnBldGVyQGVyaXguZXJpY3Nzb24uc2UwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDK8EDdNZEebdfxb57e3UA8uTCq -TsFtJv5tyjnZtSFsGDrwrZYjRMOCJFh8Yv6Ddq4mZiAvUCJxMzW4zVzraMmmQC8z -Hi3xQyuIq2UCW3ESxLvchCcuSjNOWke0z+rXHzA8Yz9y1fqhhO6AF8q5lLwGo+VQ -sJkVV8QwB9UXZN4pAc3zTeqZkGCrNY/ZIgtCrk4jw7sY/gumS8BjhXCYGyFZRDvX -jzIXQx6jn7/2huNbEAiBXbYYAMd7OEwhpHHAWOVA6g+/TNydgRO3W4xVmlEhDpYs -bnMV/Tq570E1bhz1XWb642K2MnxI74g8FXmhN6x6P8d4zU/eFcs+gxO0X6KzAgMB -AAGjggGUMIIBkDAJBgNVHRMEAjAAMAsGA1UdDwQEAwIF4DAdBgNVHQ4EFgQUo8dr -DDQXK25dB6qMY8dNIjAKIPEwgbMGA1UdIwSBqzCBqIAU5YMIq7A5eYQhQsHsc/XC -7GeZ+kuhgYykgYkwgYYxETAPBgNVBAMTCGVybGFuZ0NBMRMwEQYDVQQLEwpFcmxh -bmcgT1RQMRQwEgYDVQQKEwtFcmljc3NvbiBBQjESMBAGA1UEBxMJU3RvY2tob2xt -MQswCQYDVQQGEwJTRTElMCMGCSqGSIb3DQEJARYWcGV0ZXJAZXJpeC5lcmljc3Nv -bi5zZYIBATAhBgNVHREEGjAYgRZwZXRlckBlcml4LmVyaWNzc29uLnNlMCEGA1Ud -EgQaMBiBFnBldGVyQGVyaXguZXJpY3Nzb24uc2UwWwYDVR0fBFQwUjAkoCKgIIYe -aHR0cDovL2xvY2FsaG9zdC9vdHBDQS9jcmwucGVtMCqgKKAmhiRodHRwOi8vbG9j -YWxob3N0OjM3ODEzL290cENBL2NybC5wZW0wDQYJKoZIhvcNAQEEBQADggEBACwq -o4nQTTereSIL8ZLQHweJKXYstTaZrRrAaoRUe9oClY7H++zXmMa8iZvUqqdT3fXW -4KMXXyoB1o+cLxLnAPKOiFFL9rcbaeAMxZMIrTaFDQsOXAPVqJLSWWS5I5LsNvS6 -MlB6O6+0binTyilDKg683VV9nKNiNdL8WzGa5ig+HvK6xUpJwpOTmDmfdg09zQ+8 -aCbJrthXg0tNnGIorttAd2wFvmLUezoJrlfwLChB0M/qa+RVRCFMiPvkWupo5eVK -Malwpz2xp2rAUlb6qQY7eI6lV8JsVK06QxBmUHP68Y9kYT5/gy5ketjOB0Ypin05 -6+3VrZKFxrkqKaEoL50= ------END CERTIFICATE----- diff -Nru erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE_data/idp_crl.pem erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE_data/idp_crl.pem --- erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE_data/idp_crl.pem 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE_data/idp_crl.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ ------BEGIN X509 CRL----- -MIIC3TCCAcUCAQEwDQYJKoZIhvcNAQEEBQAwgYYxETAPBgNVBAMTCGVybGFuZ0NB -MRMwEQYDVQQLEwpFcmxhbmcgT1RQMRQwEgYDVQQKEwtFcmljc3NvbiBBQjESMBAG -A1UEBxMJU3RvY2tob2xtMQswCQYDVQQGEwJTRTElMCMGCSqGSIb3DQEJARYWcGV0 -ZXJAZXJpeC5lcmljc3Nvbi5zZRcNMTUwMjIzMTMyNTMxWhcNMTUwMjI0MTMyNTMx -WqCCAQgwggEEMIG7BgNVHSMEgbMwgbCAFJtjN3+lARCLByNRyL6YWwc+tEbAoYGM -pIGJMIGGMREwDwYDVQQDEwhlcmxhbmdDQTETMBEGA1UECxMKRXJsYW5nIE9UUDEU -MBIGA1UEChMLRXJpY3Nzb24gQUIxEjAQBgNVBAcTCVN0b2NraG9sbTELMAkGA1UE -BhMCU0UxJTAjBgkqhkiG9w0BCQEWFnBldGVyQGVyaXguZXJpY3Nzb24uc2WCCQCl -PMPPUpsj8jA4BgNVHRwBAf8ELjAsoCqgKIYmaHR0cDovL2xvY2FsaG9zdDo4MDAw -L2VybGFuZ0NBL2NybC5wZW0wCgYDVR0UBAMCAQEwDQYJKoZIhvcNAQEEBQADggEB -AE9WKJhW1oivBEE91akeDcYCtSVp98F7DxzQyJTBLQJGMEXSg8G/oAp64F4qs3oV -LXS5YFYwxjD9tXByGVEJoIUUMtfMeCvZMgd2V8mBlAJiyHkTrFFA8PgBv+htrJji -nrheAhrEedqZbqwmrcU34h9fWHp0Zl6UDYyF3I/S0/5ilIz3DvNZ9SBfKKt3DYeW -hon7qpNo6YrtEzbXyOaa2mFX9c1w39LBZ1FdY0jEzUfh2eImBLxnBjZArNxzYuU8 -a+lNMjc6JUAJwITS6C1YfI4ECsqXe0K/n90pMcm/jgiGFCZhVbXq+Nrm/24qPKBA -zqoNos7aV7LEYLYOjknaIhY= ------END X509 CRL----- diff -Nru erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE_data/openssh_ecdsa_pub erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE_data/openssh_ecdsa_pub --- erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE_data/openssh_ecdsa_pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE_data/openssh_ecdsa_pub 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIJrVlKYIT+MlxxRx5BFXisHHkcGMAAKv2dguUeOsutsYyzs9JAczvl6c+Sypra5+qOi2LHPXw6GGluuXcOssOM= uabhnil@elxadlj3q32 diff -Nru erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE_data/ssh2_ecdsa_pub erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE_data/ssh2_ecdsa_pub --- erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE_data/ssh2_ecdsa_pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE_data/ssh2_ecdsa_pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -Comment: "256-bit ECDSA, converted by uabhnil@elxadlj3q32 from OpenSSH" -AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIJrVlKYIT+MlxxRx5 -BFXisHHkcGMAAKv2dguUeOsutsYyzs9JAczvl6c+Sypra5+qOi2LHPXw6GGluuXcOssOM= - ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE.erl erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE.erl --- erlang-18.2-dfsg/lib/public_key/test/public_key_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/test/public_key_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -43,16 +42,14 @@ encrypt_decrypt, {group, sign_verify}, pkix, pkix_countryname, pkix_emailaddress, pkix_path_validation, - pkix_iso_rsa_oid, pkix_iso_dsa_oid, pkix_crl]. + pkix_iso_rsa_oid, pkix_iso_dsa_oid]. groups() -> [{pem_decode_encode, [], [dsa_pem, rsa_pem, encrypted_pem, dh_pem, cert_pem, pkcs7_pem, pkcs10_pem]}, {ssh_public_key_decode_encode, [], - [ssh_rsa_public_key, ssh_dsa_public_key, ssh_ecdsa_public_key, - ssh_rfc4716_rsa_comment, ssh_rfc4716_dsa_comment, - ssh_rfc4716_rsa_subject, - ssh_known_hosts, + [ssh_rsa_public_key, ssh_dsa_public_key, ssh_rfc4716_rsa_comment, + ssh_rfc4716_dsa_comment, ssh_rfc4716_rsa_subject, ssh_known_hosts, ssh_auth_keys, ssh1_known_hosts, ssh1_auth_keys, ssh_openssh_public_key_with_comment, ssh_openssh_public_key_long_header]}, {sign_verify, [], [rsa_sign_verify, dsa_sign_verify]} @@ -293,32 +290,6 @@ public_key:ssh_decode(EncodedOpenSsh, public_key). %%-------------------------------------------------------------------- - -ssh_ecdsa_public_key() -> - [{doc, "ssh ecdsa public key decode/encode"}]. -ssh_ecdsa_public_key(Config) when is_list(Config) -> - Datadir = ?config(data_dir, Config), - - {ok, ECDSARawSsh2} = file:read_file(filename:join(Datadir, "ssh2_ecdsa_pub")), - [{PubKey, Attributes1}] = public_key:ssh_decode(ECDSARawSsh2, public_key), - [{PubKey, Attributes1}] = public_key:ssh_decode(ECDSARawSsh2, rfc4716_public_key), - - {ok, ECDSARawOpenSsh} = file:read_file(filename:join(Datadir, "openssh_ecdsa_pub")), - [{PubKey, Attributes2}] = public_key:ssh_decode(ECDSARawOpenSsh, public_key), - [{PubKey, Attributes2}] = public_key:ssh_decode(ECDSARawOpenSsh, openssh_public_key), - - %% Can not check EncodedSSh == ECDSARawSsh2 and EncodedOpenSsh - %% = ECDSARawOpenSsh as line breakpoints may differ - - EncodedSSh = public_key:ssh_encode([{PubKey, Attributes1}], rfc4716_public_key), - EncodedOpenSsh = public_key:ssh_encode([{PubKey, Attributes2}], openssh_public_key), - - [{PubKey, Attributes1}] = - public_key:ssh_decode(EncodedSSh, public_key), - [{PubKey, Attributes2}] = - public_key:ssh_decode(EncodedOpenSsh, public_key). - -%%-------------------------------------------------------------------- ssh_rfc4716_rsa_comment() -> [{doc, "Test comment header and rsa key"}]. ssh_rfc4716_rsa_comment(Config) when is_list(Config) -> @@ -741,42 +712,6 @@ {_, dsa} = public_key:pkix_sign_types(SigAlg#'SignatureAlgorithm'.algorithm). %%-------------------------------------------------------------------- - -pkix_crl() -> - [{doc, "test pkix_crl_* functions"}]. - -pkix_crl(Config) when is_list(Config) -> - Datadir = ?config(data_dir, Config), - {ok, PemCRL} = file:read_file(filename:join(Datadir, "idp_crl.pem")), - [{_, CRL, _}] = public_key:pem_decode(PemCRL), - - {ok, IDPPemCert} = file:read_file(filename:join(Datadir, "idp_cert.pem")), - [{_, IDPCert, _}] = public_key:pem_decode(IDPPemCert), - - {ok, SignPemCert} = file:read_file(filename:join(Datadir, "crl_signer.pem")), - [{_, SignCert, _}] = public_key:pem_decode(SignPemCert), - - OTPIDPCert = public_key:pkix_decode_cert(IDPCert, otp), - OTPSignCert = public_key:pkix_decode_cert(SignCert, otp), - ERLCRL = public_key:der_decode('CertificateList',CRL), - - {rdnSequence,_} = public_key:pkix_crl_issuer(CRL), - {rdnSequence,_} = public_key:pkix_crl_issuer(ERLCRL), - - true = public_key:pkix_crl_verify(CRL, SignCert), - true = public_key:pkix_crl_verify(ERLCRL, OTPSignCert), - - [#'DistributionPoint'{}|_] = public_key:pkix_dist_points(IDPCert), - [#'DistributionPoint'{}|_] = public_key:pkix_dist_points(OTPIDPCert), - - #'DistributionPoint'{cRLIssuer = asn1_NOVALUE, - reasons = asn1_NOVALUE, - distributionPoint = Point} = public_key:pkix_dist_point(IDPCert), - #'DistributionPoint'{cRLIssuer = asn1_NOVALUE, - reasons = asn1_NOVALUE, - distributionPoint = Point} = public_key:pkix_dist_point(OTPIDPCert). - -%%-------------------------------------------------------------------- %% Internal functions ------------------------------------------------ %%-------------------------------------------------------------------- asn1_encode_decode({Asn1Type, Der, not_encrypted} = Entry) -> diff -Nru erlang-18.2-dfsg/lib/public_key/vsn.mk erlang-17.3-dfsg/lib/public_key/vsn.mk --- erlang-18.2-dfsg/lib/public_key/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/public_key/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -PUBLIC_KEY_VSN = 1.1 +PUBLIC_KEY_VSN = 0.22.1 diff -Nru erlang-18.2-dfsg/lib/reltool/bin/reltool.escript erlang-17.3-dfsg/lib/reltool/bin/reltool.escript --- erlang-18.2-dfsg/lib/reltool/bin/reltool.escript 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/bin/reltool.escript 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/doc/src/book.xml erlang-17.3-dfsg/lib/reltool/doc/src/book.xml --- erlang-18.2-dfsg/lib/reltool/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/reltool/doc/src/files.mk erlang-17.3-dfsg/lib/reltool/doc/src/files.mk --- erlang-18.2-dfsg/lib/reltool/doc/src/files.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/doc/src/files.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2009-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/doc/src/Makefile erlang-17.3-dfsg/lib/reltool/doc/src/Makefile --- erlang-18.2-dfsg/lib/reltool/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/doc/src/notes.xml erlang-17.3-dfsg/lib/reltool/doc/src/notes.xml --- erlang-18.2-dfsg/lib/reltool/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -38,23 +37,7 @@ thus constitutes one section in this document. The title of each section is the version number of Reltool.

    -
    Reltool 0.7 - -
    Improvements and New Features - - -

    - Change license text from Erlang Public License to Apache - Public License v2

    -

    - Own Id: OTP-12845

    -
    -
    -
    - -
    - -
    Reltool 0.6.6 +
    Reltool 0.6.6
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/reltool/doc/src/part.xml erlang-17.3-dfsg/lib/reltool/doc/src/part.xml --- erlang-18.2-dfsg/lib/reltool/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/reltool/doc/src/ref_man.xml erlang-17.3-dfsg/lib/reltool/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/reltool/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/reltool/doc/src/reltool_examples.xml erlang-17.3-dfsg/lib/reltool/doc/src/reltool_examples.xml --- erlang-18.2-dfsg/lib/reltool/doc/src/reltool_examples.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/doc/src/reltool_examples.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may noot use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/reltool/doc/src/reltool_intro.xml erlang-17.3-dfsg/lib/reltool/doc/src/reltool_intro.xml --- erlang-18.2-dfsg/lib/reltool/doc/src/reltool_intro.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/doc/src/reltool_intro.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/reltool/doc/src/reltool_usage.xml erlang-17.3-dfsg/lib/reltool/doc/src/reltool_usage.xml --- erlang-18.2-dfsg/lib/reltool/doc/src/reltool_usage.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/doc/src/reltool_usage.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/reltool/doc/src/reltool.xml erlang-17.3-dfsg/lib/reltool/doc/src/reltool.xml --- erlang-18.2-dfsg/lib/reltool/doc/src/reltool.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/doc/src/reltool.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/reltool/examples/Makefile erlang-17.3-dfsg/lib/reltool/examples/Makefile --- erlang-18.2-dfsg/lib/reltool/examples/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/examples/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/reltool/Makefile erlang-17.3-dfsg/lib/reltool/Makefile --- erlang-18.2-dfsg/lib/reltool/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/files.mk erlang-17.3-dfsg/lib/reltool/src/files.mk --- erlang-18.2-dfsg/lib/reltool/src/files.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/files.mk 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/Makefile erlang-17.3-dfsg/lib/reltool/src/Makefile --- erlang-18.2-dfsg/lib/reltool/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool.app.src erlang-17.3-dfsg/lib/reltool/src/reltool.app.src --- erlang-18.2-dfsg/lib/reltool/src/reltool.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 2009-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -37,5 +36,5 @@ {applications, [stdlib, kernel]}, {env, []}, {runtime_dependencies, ["wx-1.2","tools-2.6.14","stdlib-2.0","sasl-2.4", - "kernel-3.0","erts-7.0"]} + "kernel-3.0","erts-6.0"]} ]}. diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool.appup.src erlang-17.3-dfsg/lib/reltool/src/reltool.appup.src --- erlang-18.2-dfsg/lib/reltool/src/reltool.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool_app_win.erl erlang-17.3-dfsg/lib/reltool/src/reltool_app_win.erl --- erlang-18.2-dfsg/lib/reltool/src/reltool_app_win.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool_app_win.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool.erl erlang-17.3-dfsg/lib/reltool/src/reltool.erl --- erlang-18.2-dfsg/lib/reltool/src/reltool.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool_fgraph.erl erlang-17.3-dfsg/lib/reltool/src/reltool_fgraph.erl --- erlang-18.2-dfsg/lib/reltool/src/reltool_fgraph.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool_fgraph.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool_fgraph.hrl erlang-17.3-dfsg/lib/reltool/src/reltool_fgraph.hrl --- erlang-18.2-dfsg/lib/reltool/src/reltool_fgraph.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool_fgraph.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool_fgraph_win.erl erlang-17.3-dfsg/lib/reltool/src/reltool_fgraph_win.erl --- erlang-18.2-dfsg/lib/reltool/src/reltool_fgraph_win.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool_fgraph_win.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -253,10 +252,10 @@ ticker_loop(Pid, Time) -> receive after Time -> Pid ! {self(), redraw}, - T0 = erlang:monotonic_time(), + T0 = now(), receive {Pid, ok} -> ok end, - T1 = erlang:monotonic_time(), - D = erlang:convert_time_unit(T1-T0, native, milli_seconds), + T1 = now(), + D = timer:now_diff(T1, T0)/1000, case round(40 - D) of Ms when Ms < 0 -> %io:format("ticker: wait is 0 ms [fg ~7s ms] [fps ~7s]~n", diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool.hrl erlang-17.3-dfsg/lib/reltool/src/reltool.hrl --- erlang-18.2-dfsg/lib/reltool/src/reltool.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool_mod_win.erl erlang-17.3-dfsg/lib/reltool/src/reltool_mod_win.erl --- erlang-18.2-dfsg/lib/reltool/src/reltool_mod_win.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool_mod_win.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool_server.erl erlang-17.3-dfsg/lib/reltool/src/reltool_server.erl --- erlang-18.2-dfsg/lib/reltool/src/reltool_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool_sys_win.erl erlang-17.3-dfsg/lib/reltool/src/reltool_sys_win.erl --- erlang-18.2-dfsg/lib/reltool/src/reltool_sys_win.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool_sys_win.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool_target.erl erlang-17.3-dfsg/lib/reltool/src/reltool_target.erl --- erlang-18.2-dfsg/lib/reltool/src/reltool_target.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool_target.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/src/reltool_utils.erl erlang-17.3-dfsg/lib/reltool/src/reltool_utils.erl --- erlang-18.2-dfsg/lib/reltool/src/reltool_utils.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/src/reltool_utils.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -55,7 +54,12 @@ code:root_dir(). erl_libs() -> - string:tokens(os:getenv("ERL_LIBS", ""), ":;"). + case os:getenv("ERL_LIBS") of + false -> + []; + LibStr -> + string:tokens(LibStr, ":;") + end. lib_dirs(Dir) -> case erl_prim_loader:list_dir(Dir) of diff -Nru erlang-18.2-dfsg/lib/reltool/test/Makefile erlang-17.3-dfsg/lib/reltool/test/Makefile --- erlang-18.2-dfsg/lib/reltool/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_app_SUITE.erl erlang-17.3-dfsg/lib/reltool/test/reltool_app_SUITE.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_app_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_app_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_manual_gui_SUITE_data/faulty_app_file/a-1.0/src/a.erl erlang-17.3-dfsg/lib/reltool/test/reltool_manual_gui_SUITE_data/faulty_app_file/a-1.0/src/a.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_manual_gui_SUITE_data/faulty_app_file/a-1.0/src/a.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_manual_gui_SUITE_data/faulty_app_file/a-1.0/src/a.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_manual_gui_SUITE_data/faulty_app_file/a-1.0/src/a_sup.erl erlang-17.3-dfsg/lib/reltool/test/reltool_manual_gui_SUITE_data/faulty_app_file/a-1.0/src/a_sup.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_manual_gui_SUITE_data/faulty_app_file/a-1.0/src/a_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_manual_gui_SUITE_data/faulty_app_file/a-1.0/src/a_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_manual_gui_SUITE.erl erlang-17.3-dfsg/lib/reltool/test/reltool_manual_gui_SUITE.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_manual_gui_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_manual_gui_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE_data/escript/someapp-1.0/src/mymod.erl erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE_data/escript/someapp-1.0/src/mymod.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE_data/escript/someapp-1.0/src/mymod.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE_data/escript/someapp-1.0/src/mymod.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE_data/faulty_app_file/a-1.0/src/a.erl erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE_data/faulty_app_file/a-1.0/src/a.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE_data/faulty_app_file/a-1.0/src/a.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE_data/faulty_app_file/a-1.0/src/a.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE_data/faulty_app_file/a-1.0/src/a_sup.erl erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE_data/faulty_app_file/a-1.0/src/a_sup.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE_data/faulty_app_file/a-1.0/src/a_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE_data/faulty_app_file/a-1.0/src/a_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a.erl erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a_sup.erl erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a_sup.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE_data/slim/a-1.0/src/a_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE.erl erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_server_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_server_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -1206,9 +1205,14 @@ RootDir = code:root_dir(), Erl = filename:join([RootDir, "bin", "erl"]), + EscapedQuote = + case os:type() of + {win32,_} -> "\\\""; + _ -> "\"" + end, Args = ["-boot_var", "RELTOOL_EXT_LIB", TargetLibDir, "-boot", filename:join(TargetRelVsnDir,RelName), - "-sasl", "releases_dir", "\""++TargetRelDir++"\""], + "-sasl", "releases_dir", EscapedQuote++TargetRelDir++EscapedQuote], {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl, Args)), ?msym(RootDir, rpc:call(Node, code, root_dir, [])), wait_for_app(Node,sasl,50), @@ -2514,7 +2518,10 @@ %% Library functions erl_libs() -> - string:tokens(os:getenv("ERL_LIBS", ""), ":;"). + case os:getenv("ERL_LIBS") of + false -> []; + LibStr -> string:tokens(LibStr, ":;") + end. datadir(Config) -> %% Removes the trailing slash... diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_test_lib.erl erlang-17.3-dfsg/lib/reltool/test/reltool_test_lib.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_test_lib.hrl erlang-17.3-dfsg/lib/reltool/test/reltool_test_lib.hrl --- erlang-18.2-dfsg/lib/reltool/test/reltool_test_lib.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_test_lib.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/test/reltool_wx_SUITE.erl erlang-17.3-dfsg/lib/reltool/test/reltool_wx_SUITE.erl --- erlang-18.2-dfsg/lib/reltool/test/reltool_wx_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/reltool_wx_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/test/rtt erlang-17.3-dfsg/lib/reltool/test/rtt --- erlang-18.2-dfsg/lib/reltool/test/rtt 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/rtt 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/test/rtt.erl erlang-17.3-dfsg/lib/reltool/test/rtt.erl --- erlang-18.2-dfsg/lib/reltool/test/rtt.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/test/rtt.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/reltool/vsn.mk erlang-17.3-dfsg/lib/reltool/vsn.mk --- erlang-18.2-dfsg/lib/reltool/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/reltool/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -RELTOOL_VSN = 0.7 +RELTOOL_VSN = 0.6.6 diff -Nru erlang-18.2-dfsg/lib/runtime_tools/c_src/dtrace_user.d erlang-17.3-dfsg/lib/runtime_tools/c_src/dtrace_user.d --- erlang-18.2-dfsg/lib/runtime_tools/c_src/dtrace_user.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/c_src/dtrace_user.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * Copyright Scott Lystig Fritchie 2011-2012. * All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/c_src/dyntrace.c erlang-17.3-dfsg/lib/runtime_tools/c_src/dyntrace.c --- erlang-18.2-dfsg/lib/runtime_tools/c_src/dyntrace.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/c_src/dyntrace.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/c_src/Makefile.in erlang-17.3-dfsg/lib/runtime_tools/c_src/Makefile.in --- erlang-18.2-dfsg/lib/runtime_tools/c_src/Makefile.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/c_src/Makefile.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1999-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/runtime_tools/c_src/trace_file_drv.c erlang-17.3-dfsg/lib/runtime_tools/c_src/trace_file_drv.c --- erlang-18.2-dfsg/lib/runtime_tools/c_src/trace_file_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/c_src/trace_file_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2011. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ @@ -327,11 +326,9 @@ | O_BINARY #endif , 0777)) < 0) { - int saved_errno = errno; if (wrap) driver_free(wrap); driver_free(data); - errno = saved_errno; return ERL_DRV_ERROR_ERRNO; } @@ -527,19 +524,14 @@ ** A write wrapper that regards it as an error if not all data was written. */ static int do_write(FILETYPE fd, unsigned char *buff, int siz) { - int w; - while (1) { - w = write(fd, buff, siz); - if (w < 0 && errno == EINTR) - continue; - else if (w != siz) { - if (w >= 0) { - errno = ENOSPC; - } - return -1; + int w = write(fd, buff, siz); + if (w != siz) { + if (w >= 0) { + errno = ENOSPC; } - return siz; + return -1; } + return siz; } /* @@ -634,10 +626,8 @@ */ static int wrap_file(TraceFileData *data) { if (my_flush(data) < 0) { - int saved_errno = errno; close(data->fd); data->fd = -1; - errno = saved_errno; return -1; } close(data->fd); @@ -653,15 +643,12 @@ next_name(&data->wrap->del); } next_name(&data->wrap->cur); -try_open: data->fd = open(data->wrap->cur.name, O_WRONLY | O_TRUNC | O_CREAT #ifdef O_BINARY | O_BINARY #endif , 0777); if (data->fd < 0) { - if (errno == EINTR) - goto try_open; data->fd = -1; return -1; } diff -Nru erlang-18.2-dfsg/lib/runtime_tools/c_src/trace_ip_drv.c erlang-17.3-dfsg/lib/runtime_tools/c_src/trace_ip_drv.c --- erlang-18.2-dfsg/lib/runtime_tools/c_src/trace_ip_drv.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/c_src/trace_ip_drv.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 1999-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/book.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/book.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/dbg.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/dbg.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/dbg.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/dbg.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -168,8 +167,7 @@ If the Item is a pid(), the corresponding process is traced. The process may be a remote process (on another Erlang node). The node must be in the list of - traced nodes (see n/1 and - tracer/0/2/3). + traced nodes (seen/1 and tracer/0/2/3). If the Item is the atom all, all processes in the system as well as all processes created hereafter are to be traced. This also affects all nodes added with the @@ -650,7 +648,7 @@

    If Nodename is the local node, the error reason cant_add_local_node is returned.

    -

    If a trace port (see trace_port/2) is +

    If a trace port (seetrace_port/2) is running on the local node, remote nodes can not be traced with a tracer process. The error reason cant_trace_remote_pid_to_local_port is returned. A @@ -763,7 +761,7 @@ type which is independent of the tracer on the trace control node.

    -

    For details, see tracer/2.

    +

    For details, seetracer/2.

    @@ -1030,9 +1028,9 @@ Stop the dbgserver and the tracing of all processes.

    Stops the dbg server and clears all trace flags for - all processes and all local trace patterns for all functions. Also + all processes and all trace patterns for all functions. Also shuts down all trace clients and closes all trace ports.

    -

    Note that no global trace patterns are affected by this +

    Note that no trace patterns are affected by this function.

    @@ -1040,7 +1038,8 @@ stop_clear() -> ok Stop the dbgserver and the tracing of all processes, and clears trace patterns. -

    Same as stop/0, but also clears all trace patterns on global functions calls.

    +

    Same as stop/0, but also clears all trace patterns on local + and global functions calls.

    diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/dyntrace.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/dyntrace.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/dyntrace.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/dyntrace.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/erts_alloc_config.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/erts_alloc_config.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/erts_alloc_config.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/erts_alloc_config.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/Makefile erlang-17.3-dfsg/lib/runtime_tools/doc/src/Makefile --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1999-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/notes_history.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/notes_history.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/notes.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/notes.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -32,87 +31,6 @@

    This document describes the changes made to the Runtime_Tools application.

    -
    Runtime_Tools 1.9.2 - -
    Improvements and New Features - - -

    - Clarified dbg:stop documentation

    -

    - Own Id: OTP-13078

    -
    -
    -
    - -
    - -
    Runtime_Tools 1.9.1 - -
    Fixed Bugs and Malfunctions - - -

    - The trace_file_drv did not handle EINTR - correct which caused it to fail when the runtime system - received a signal.

    -

    - Own Id: OTP-12890 Aux Id: seq12885

    -
    -
    -
    - -
    - -
    Runtime_Tools 1.9 - -
    Improvements and New Features - - -

    - Change license text from Erlang Public License to Apache - Public License v2

    -

    - Own Id: OTP-12845

    -
    -
    -
    - -
    - -
    Runtime_Tools 1.8.16 - -
    Fixed Bugs and Malfunctions - - -

    - The trace process started by dbg would not always - terminate when dbg:stop/0 was called.

    -

    - Own Id: OTP-12517

    -
    -
    -
    - -
    - -
    Runtime_Tools 1.8.15 - -
    Fixed Bugs and Malfunctions - - -

    - Add nif_version to erlang:system_info/1 in - order to get the NIF API version of the runtime system in - a way similar to driver_version.

    -

    - Own Id: OTP-12298

    -
    -
    -
    - -
    -
    Runtime_Tools 1.8.14
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/part_notes_history.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/part_notes.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/part.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/part.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/ref_man.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/runtime_tools_app.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/runtime_tools_app.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/runtime_tools_app.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/runtime_tools_app.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/doc/src/system_information.xml erlang-17.3-dfsg/lib/runtime_tools/doc/src/system_information.xml --- erlang-18.2-dfsg/lib/runtime_tools/doc/src/system_information.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/doc/src/system_information.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/dist.d erlang-17.3-dfsg/lib/runtime_tools/examples/dist.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/dist.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/dist.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/dist.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/dist.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/dist.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/dist.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/driver1.d erlang-17.3-dfsg/lib/runtime_tools/examples/driver1.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/driver1.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/driver1.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/driver1.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/driver1.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/driver1.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/driver1.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/efile_drv.d erlang-17.3-dfsg/lib/runtime_tools/examples/efile_drv.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/efile_drv.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/efile_drv.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/efile_drv.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/efile_drv.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/efile_drv.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/efile_drv.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/function-calls.d erlang-17.3-dfsg/lib/runtime_tools/examples/function-calls.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/function-calls.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/function-calls.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/function-calls.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/function-calls.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/function-calls.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/function-calls.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/garbage-collection.d erlang-17.3-dfsg/lib/runtime_tools/examples/garbage-collection.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/garbage-collection.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/garbage-collection.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/garbage-collection.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/garbage-collection.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/garbage-collection.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/garbage-collection.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/memory1.d erlang-17.3-dfsg/lib/runtime_tools/examples/memory1.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/memory1.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/memory1.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/memory1.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/memory1.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/memory1.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/memory1.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/messages.d erlang-17.3-dfsg/lib/runtime_tools/examples/messages.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/messages.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/messages.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/messages.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/messages.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/messages.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/messages.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/port1.d erlang-17.3-dfsg/lib/runtime_tools/examples/port1.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/port1.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/port1.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/port1.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/port1.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/port1.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/port1.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/process-scheduling.d erlang-17.3-dfsg/lib/runtime_tools/examples/process-scheduling.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/process-scheduling.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/process-scheduling.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/process-scheduling.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/process-scheduling.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/process-scheduling.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/process-scheduling.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/spawn-exit.d erlang-17.3-dfsg/lib/runtime_tools/examples/spawn-exit.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/spawn-exit.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/spawn-exit.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/spawn-exit.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/spawn-exit.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/spawn-exit.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/spawn-exit.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/user-probe.d erlang-17.3-dfsg/lib/runtime_tools/examples/user-probe.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/user-probe.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/user-probe.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/user-probe-n.d erlang-17.3-dfsg/lib/runtime_tools/examples/user-probe-n.d --- erlang-18.2-dfsg/lib/runtime_tools/examples/user-probe-n.d 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/user-probe-n.d 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ * * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/user-probe-n.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/user-probe-n.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/user-probe-n.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/user-probe-n.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/examples/user-probe.systemtap erlang-17.3-dfsg/lib/runtime_tools/examples/user-probe.systemtap --- erlang-18.2-dfsg/lib/runtime_tools/examples/user-probe.systemtap 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/examples/user-probe.systemtap 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/runtime_tools/include/observer_backend.hrl erlang-17.3-dfsg/lib/runtime_tools/include/observer_backend.hrl --- erlang-18.2-dfsg/lib/runtime_tools/include/observer_backend.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/include/observer_backend.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/runtime_tools/Makefile erlang-17.3-dfsg/lib/runtime_tools/Makefile --- erlang-18.2-dfsg/lib/runtime_tools/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1999-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/appmon_info.erl erlang-17.3-dfsg/lib/runtime_tools/src/appmon_info.erl --- erlang-18.2-dfsg/lib/runtime_tools/src/appmon_info.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/appmon_info.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/dbg.erl erlang-17.3-dfsg/lib/runtime_tools/src/dbg.erl --- erlang-18.2-dfsg/lib/runtime_tools/src/dbg.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/dbg.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -779,50 +778,50 @@ tracer_loop(Handler, HandlerData). tracer_loop(Handler, Hdata) -> - {State, Suspended, Traces} = recv_all_traces(), - NewHdata = handle_traces(Suspended, Traces, Handler, Hdata), - case State of - done -> - exit(normal); - loop -> - tracer_loop(Handler, NewHdata) + receive + Msg -> + %% Don't match in receive to avoid giving EXIT message higher + %% priority than the trace messages. + case Msg of + {'EXIT',_Pid,_Reason} -> + ok; + Trace -> + NewData = recv_all_traces(Trace, Handler, Hdata), + tracer_loop(Handler, NewData) + end end. + +recv_all_traces(Trace, Handler, Hdata) -> + Suspended = suspend(Trace, []), + recv_all_traces(Suspended, Handler, Hdata, [Trace]). -recv_all_traces() -> - recv_all_traces([], [], infinity). - -recv_all_traces(Suspended0, Traces, Timeout) -> +recv_all_traces(Suspended0, Handler, Hdata, Traces) -> receive Trace when is_tuple(Trace), element(1, Trace) == trace -> Suspended = suspend(Trace, Suspended0), - recv_all_traces(Suspended, [Trace|Traces], 0); + recv_all_traces(Suspended, Handler, Hdata, [Trace|Traces]); Trace when is_tuple(Trace), element(1, Trace) == trace_ts -> Suspended = suspend(Trace, Suspended0), - recv_all_traces(Suspended, [Trace|Traces], 0); + recv_all_traces(Suspended, Handler, Hdata, [Trace|Traces]); Trace when is_tuple(Trace), element(1, Trace) == seq_trace -> Suspended = suspend(Trace, Suspended0), - recv_all_traces(Suspended, [Trace|Traces], 0); + recv_all_traces(Suspended, Handler, Hdata, [Trace|Traces]); Trace when is_tuple(Trace), element(1, Trace) == drop -> Suspended = suspend(Trace, Suspended0), - recv_all_traces(Suspended, [Trace|Traces], 0); - {'EXIT', _Pid, _Reason} -> - {done, Suspended0, Traces}; + recv_all_traces(Suspended, Handler, Hdata, [Trace|Traces]); Other -> %%% Is this really a good idea? io:format(user,"** tracer received garbage: ~p~n", [Other]), - recv_all_traces(Suspended0, Traces, Timeout) - after Timeout -> - {loop, Suspended0, Traces} - end. - -handle_traces(Suspended, Traces, Handler, Hdata) -> - case catch invoke_handler(Traces, Handler, Hdata) of - {'EXIT',Reason} -> - resume(Suspended), - exit({trace_handler_crashed,Reason}); - NewHdata -> - resume(Suspended), - NewHdata + recv_all_traces(Suspended0, Handler, Hdata, Traces) + after 0 -> + case catch invoke_handler(Traces, Handler, Hdata) of + {'EXIT',Reason} -> + resume(Suspended0), + exit({trace_handler_crashed,Reason}); + NewHdata -> + resume(Suspended0), + NewHdata + end end. invoke_handler([Tr|Traces], Handler, Hdata0) -> diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/erts_alloc_config.erl erlang-17.3-dfsg/lib/runtime_tools/src/erts_alloc_config.erl --- erlang-18.2-dfsg/lib/runtime_tools/src/erts_alloc_config.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/erts_alloc_config.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson AB. %% diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/Makefile erlang-17.3-dfsg/lib/runtime_tools/src/Makefile --- erlang-18.2-dfsg/lib/runtime_tools/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1999-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/observer_backend.erl erlang-17.3-dfsg/lib/runtime_tools/src/observer_backend.erl --- erlang-18.2-dfsg/lib/runtime_tools/src/observer_backend.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/observer_backend.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -249,7 +248,7 @@ SchedulerWallTime = erlang:statistics(scheduler_wall_time), ProcInfo = etop_collect(processes(), []), - Collector ! {self(),#etop_info{now = erlang:timestamp(), + Collector ! {self(),#etop_info{now = now(), n_procs = length(ProcInfo), run_queue = erlang:statistics(run_queue), runtime = SchedulerWallTime, diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/percept_profile.erl erlang-17.3-dfsg/lib/runtime_tools/src/percept_profile.erl --- erlang-18.2-dfsg/lib/runtime_tools/src/percept_profile.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/percept_profile.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -120,7 +119,7 @@ undefined -> {error, not_started}; Port -> - erlang:port_command(Port, erlang:term_to_binary({profile_stop, erlang:timestamp()})), + erlang:port_command(Port, erlang:term_to_binary({profile_stop, erlang:now()})), %% trace delivered? erlang:port_close(Port), ok @@ -140,7 +139,7 @@ erlang:system_flag(multi_scheduling, block), Port = (dbg:trace_port(file, Filename))(), % Send start time - erlang:port_command(Port, erlang:term_to_binary({profile_start, erlang:timestamp()})), + erlang:port_command(Port, erlang:term_to_binary({profile_start, erlang:now()})), erlang:system_flag(multi_scheduling, unblock), %% Register Port diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/runtime_tools.app.src erlang-17.3-dfsg/lib/runtime_tools/src/runtime_tools.app.src --- erlang-18.2-dfsg/lib/runtime_tools/src/runtime_tools.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/runtime_tools.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -28,6 +27,6 @@ {env, []}, {mod, {runtime_tools, []}}, {runtime_dependencies, ["stdlib-2.0","mnesia-4.12","kernel-3.0", - "erts-7.0"]}]}. + "erts-6.0"]}]}. diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/runtime_tools.appup.src erlang-17.3-dfsg/lib/runtime_tools/src/runtime_tools.appup.src --- erlang-18.2-dfsg/lib/runtime_tools/src/runtime_tools.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/runtime_tools.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/runtime_tools.erl erlang-17.3-dfsg/lib/runtime_tools/src/runtime_tools.erl --- erlang-18.2-dfsg/lib/runtime_tools/src/runtime_tools.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/runtime_tools.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/runtime_tools_sup.erl erlang-17.3-dfsg/lib/runtime_tools/src/runtime_tools_sup.erl --- erlang-18.2-dfsg/lib/runtime_tools/src/runtime_tools_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/runtime_tools_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/runtime_tools/src/system_information.erl erlang-17.3-dfsg/lib/runtime_tools/src/system_information.erl --- erlang-18.2-dfsg/lib/runtime_tools/src/system_information.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/src/system_information.erl 2014-09-16 19:10:57.000000000 +0000 @@ -2,17 +2,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -372,7 +371,6 @@ logical_processors_online, logical_processors_available, driver_version, - nif_version, emu_args, ethread_info, beam_jump_table, @@ -578,7 +576,10 @@ false -> ""; true -> ".smp" end, - Beam = os:getenv("EMU", "beam"), + Beam = case os:getenv("EMU") of + false -> "beam"; + Value -> Value + end, Beam ++ Type ++ Flavor. %% Check runtime dependencies... diff -Nru erlang-18.2-dfsg/lib/runtime_tools/test/dbg_SUITE_data/dbg_test.erl erlang-17.3-dfsg/lib/runtime_tools/test/dbg_SUITE_data/dbg_test.erl --- erlang-18.2-dfsg/lib/runtime_tools/test/dbg_SUITE_data/dbg_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/test/dbg_SUITE_data/dbg_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/runtime_tools/test/dbg_SUITE_data/exref_td.erl erlang-17.3-dfsg/lib/runtime_tools/test/dbg_SUITE_data/exref_td.erl --- erlang-18.2-dfsg/lib/runtime_tools/test/dbg_SUITE_data/exref_td.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/test/dbg_SUITE_data/exref_td.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/runtime_tools/test/dbg_SUITE.erl erlang-17.3-dfsg/lib/runtime_tools/test/dbg_SUITE.erl --- erlang-18.2-dfsg/lib/runtime_tools/test/dbg_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/test/dbg_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -26,7 +25,7 @@ ip_port/1, file_port/1, file_port2/1, file_port_schedfix/1, ip_port_busy/1, wrap_port/1, wrap_port_time/1, with_seq_trace/1, dead_suspend/1, local_trace/1, - saved_patterns/1, tracer_exit_on_stop/1]). + saved_patterns/1]). -export([init_per_testcase/2, end_per_testcase/2]). -export([tracee1/1, tracee2/1]). -export([dummy/0, exported/1]). @@ -48,7 +47,7 @@ [big, tiny, simple, message, distributed, ip_port, file_port, file_port2, file_port_schedfix, ip_port_busy, wrap_port, wrap_port_time, with_seq_trace, dead_suspend, - local_trace, saved_patterns, tracer_exit_on_stop]. + local_trace, saved_patterns]. groups() -> []. @@ -743,38 +742,6 @@ dummy() -> ok. -%% Test that a tracer process does not ignore an exit signal message when it has -%% received (but not handled) trace messages -tracer_exit_on_stop(_) -> - %% Tracer blocks waiting for fun to complete so that the trace message and - %% the exit signal message from the dbg process are in its message queue. - Fun = fun() -> - ?MODULE:dummy(), - Ref = erlang:trace_delivered(self()), - receive {trace_delivered, _, Ref} -> stop() end - end, - {ok, _} = dbg:tracer(process, {fun spawn_once_handler/2, {self(), Fun}}), - {ok, Tracer} = dbg:get_tracer(), - MRef = monitor(process, Tracer), - {ok, _} = dbg:p(self(), [call]), - {ok, _} = dbg:p(new, [call]), - {ok, _} = dbg:tp(?MODULE, dummy, []), - ?MODULE:dummy(), - receive {'DOWN', MRef, _, _, normal} -> ok end, - [{trace,_,call,{?MODULE, dummy,[]}}, - {trace,_,call,{?MODULE, dummy,[]}}] = flush(), - ok. - -spawn_once_handler(Event, {Pid, done} = State) -> - Pid ! Event, - State; -spawn_once_handler(Event, {Pid, Fun}) -> - {_, Ref} = spawn_monitor(Fun), - receive - {'DOWN', Ref, _, _, _} -> - Pid ! Event, - {Pid, done} - end. %% %% Support functions diff -Nru erlang-18.2-dfsg/lib/runtime_tools/test/dyntrace_SUITE.erl erlang-17.3-dfsg/lib/runtime_tools/test/dyntrace_SUITE.erl --- erlang-18.2-dfsg/lib/runtime_tools/test/dyntrace_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/test/dyntrace_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/runtime_tools/test/erts_alloc_config_SUITE.erl erlang-17.3-dfsg/lib/runtime_tools/test/erts_alloc_config_SUITE.erl --- erlang-18.2-dfsg/lib/runtime_tools/test/erts_alloc_config_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/test/erts_alloc_config_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -80,7 +79,12 @@ SbctMod = " +MBsbct 1024 +MHsbct 4096", %% Make sure we have enabled allocators - ZFlgs = os:getenv("ERL_ZFLAGS", "") ++ " +Mea max +Mea config", + ZFlgs = case os:getenv("ERL_ZFLAGS") of + FlgString when is_list(FlgString) -> + FlgString; + _ -> + "" + end ++ " +Mea max +Mea config", ?line os:putenv("ERL_ZFLAGS", ZFlgs ++ SbctMod), diff -Nru erlang-18.2-dfsg/lib/runtime_tools/test/runtime_tools_SUITE.erl erlang-17.3-dfsg/lib/runtime_tools/test/runtime_tools_SUITE.erl --- erlang-18.2-dfsg/lib/runtime_tools/test/runtime_tools_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/test/runtime_tools_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/runtime_tools/test/system_information_SUITE_data/information_test_report.dat erlang-17.3-dfsg/lib/runtime_tools/test/system_information_SUITE_data/information_test_report.dat --- erlang-18.2-dfsg/lib/runtime_tools/test/system_information_SUITE_data/information_test_report.dat 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/test/system_information_SUITE_data/information_test_report.dat 2014-09-16 19:10:57.000000000 +0000 @@ -9720,7 +9720,6 @@ {logical_processors_online,4}, {logical_processors_available,4}, {driver_version,"2.1"}, - {nif_version,"1.1"}, {taints,[]}]}, {erts_compile_info, [{ldflags,[]}, diff -Nru erlang-18.2-dfsg/lib/runtime_tools/test/system_information_SUITE.erl erlang-17.3-dfsg/lib/runtime_tools/test/system_information_SUITE.erl --- erlang-18.2-dfsg/lib/runtime_tools/test/system_information_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/test/system_information_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -2,17 +2,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/runtime_tools/vsn.mk erlang-17.3-dfsg/lib/runtime_tools/vsn.mk --- erlang-18.2-dfsg/lib/runtime_tools/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/runtime_tools/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -RUNTIME_TOOLS_VSN = 1.9.2 +RUNTIME_TOOLS_VSN = 1.8.14 diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/alarm_handler.xml erlang-17.3-dfsg/lib/sasl/doc/src/alarm_handler.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/alarm_handler.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/alarm_handler.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -37,92 +36,94 @@ alarm_handler An Alarm Handling Process -

    The alarm handler process is a - gen_event - event manager process that receives alarms in the system. - This process is not intended to be a complete alarm handler. - It defines a place to which alarms can be sent. One simple event - handler is installed in the alarm handler at startup, but users - are encouraged to write and install their own handlers.

    +

    The alarm handler process is a gen_event event manager + process which receives alarms in the system. This process is not + intended to be a complete alarm handler. It defines a + place to which alarms can be sent. One simple event handler is + installed in the alarm handler at start-up, but users are + encouraged to write and install their own handlers. +

    The simple event handler sends all alarms as info reports to - the error logger, and saves all in a list. This list can be - passed to a user-defined event handler, which can be installed - later. The list can grow large if many alarms are generated. - This is a good reason to install a better user-defined - handler.

    -

    Functions are provided to set and clear alarms. The alarm - format is defined by the user. For example, an event handler - for SNMP can be defined, together with an alarm Management - Information Base (MIB).

    -

    The alarm handler is part of the SASL application.

    + the error logger, and saves all of them in a list which can be + passed to a user defined event handler, which may be installed at + a later stage. The list can grow large if many alarms are + generated. So it is a good reason to install a better user defined + handler. +

    +

    There are functions to set and clear alarms. The format of + alarms are defined by the user. For example, an event handler + for SNMP could be defined, together with an alarm MIB. +

    +

    The alarm handler is part of the SASL application. +

    When writing new event handlers for the alarm handler, the - following events must be handled:

    + following events must be handled: +

    {set_alarm, {AlarmId, AlarmDescr}}

    This event is generated by - alarm_handler:set_alarm({AlarmId, AlarmDecsr}).

    + alarm_handler:set_alarm({AlarmId, AlarmDecsr}). +

    {clear_alarm, AlarmId}

    This event is - generated by alarm_handler:clear_alarm(AlarmId).

    + generated by alarm_handler:clear_alarm(AlarmId). +

    The default simple handler is called alarm_handler and - it can be exchanged by calling - gen_event:swap_handler/3 - as gen_event:swap_handler(alarm_handler, {alarm_handler, swap}, - {NewHandler, Args}). NewHandler:init({Args, {alarm_handler, - Alarms}}) is called. For more details, see - gen_event(3) - in STDLIB.

    + it may be exchanged by calling gen_event:swap_handler/3 + as gen_event:swap_handler(alarm_handler, {alarm_handler, swap}, {NewHandler, Args}). NewHandler:init({Args, {alarm_handler, Alarms}}) is called. Refer to gen_event(3) + for further details. +

    - clear_alarm(AlarmId) -> void() - Clears the specified alarms. + Clear the specified alarms AlarmId = term() -

    Sends event clear_alarm to all event handlers.

    +

    Sends the clear_alarm event to all event handlers.

    When receiving this event, the default simple handler - clears the latest received alarm with id AlarmId.

    + clears the latest received alarm with id AlarmId. +

    - get_alarms() -> [alarm()] - Gets all active alarms. + Get all active alarms

    Returns a list of all active alarms. This function can only - be used when the simple handler is installed.

    + be used when the simple handler is installed. +

    - set_alarm(alarm()) - Sets an alarm with an id. + Set an alarm with an id alarm() = {AlarmId, AlarmDescription} AlarmId = term() AlarmDescription = term() -

    Sends event set_alarm to all event handlers.

    +

    Sends the set_alarm event to all event handlers.

    When receiving this event, the default simple handler - stores the alarm. AlarmId identifies the alarm - and is used when the alarm is cleared.

    + stores the alarm. The AlarmId identifies the alarm + and is used when the alarm is cleared. +

    See Also -

    error_logger(3), - gen_event(3)

    +

    error_logger(3), gen_event(3) +

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/appup.xml erlang-17.3-dfsg/lib/sasl/doc/src/appup.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/appup.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/appup.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -29,85 +28,78 @@ appup - Application upgrade file + Application upgrade file.

    The application upgrade file defines how an application is upgraded or downgraded in a running system.

    -

    This file is used by the functions in - systools - when generating a release upgrade file relup.

    +

    This file is used by the functions in systools when + generating a release upgrade file relup.

    - File Syntax -

    The application upgrade file is to be called - Application.appup, where Application is the - application name. The file is to be located in the ebin + FILE SYNTAX +

    The application upgrade file should be called + Application.appup where Application is the name of + the application. The file should be located in the ebin directory for the application.

    The .appup file contains one single Erlang term, which defines the instructions used to upgrade or downgrade - the application. The file has the following syntax:

    + the application. The file has the following syntax:

    {Vsn, [{UpFromVsn, Instructions}, ...], - [{DownToVsn, Instructions}, ...]}. - - Vsn = string() -

    Current application version.

    - UpFromVsn = string() | binary() -

    An earlier - application version to upgrade from. If it is a - string, it is interpreted as a specific version - number. If it is a binary, it is interpreted as a - regular expression that can match multiple version - numbers.

    - DownToVsn = string() | binary() -

    An earlier - application version to downgrade to. If it is a - string, it is interpreted as a specific version - number. If it is a binary, it is interpreted as a - regular expression that can match multiple version - numbers.

    - Instructions -

    A list of release upgrade instructions, see - Release - Upgrade Instructions. It is recommended to use + [{DownToVsn, Instructions}, ...]}. + + + +

    Vsn = string() is the current version of + the application.

    + + +

    UpFromVsn = string() | binary() is an earlier + version of the application to upgrade from. If it is a + string, it will be interpreted as a specific version + number. If it is a binary, it will be interpreted as a + regular expression which can match multiple version + numbers.

    +
    + +

    DownToVsn = string() | binary() is an earlier + version of the application to downgrade to. If it is a + string, it will be interpreted as a specific version + number. If it is a binary, it will be interpreted as a + regular expression which can match multiple version + numbers.

    +
    + +

    Instructions is a list of release upgrade instructions, see below. It is recommended to use high-level instructions only. These are automatically translated to low-level instructions by systools when - creating the relup file.

    - -

    To avoid duplication of upgrade instructions, it is - allowed to use regular expressions to specify UpFromVsn - and DownToVsn. To be considered a regular expression, the - version identifier must be specified as a binary. For example, - the following match all versions 2.1.x, where x is - any number:

    - -<<"2\\.1\\.[0-9]+">> -

    Notice that the regular expression must match the complete - version string, so this example works for, for example, - 2.1.1, but not for 2.1.1.1.

    + creating the relup file.

    + + +

    In order to avoid duplication of upgrade instructions it is + allowed to use regular expressions to specify the UpFromVsn + and DownToVsn. To be considered a regular expression, the + version identifier must be specified as a binary, e.g.

    + <<"2\\.1\\.[0-9]+">> +

    will match all versions 2.1.x, where x is any number.

    +

    Note that the regular expression must match the complete + version string, so the above example will work for for + e.g. 2.1.1, but not for 2.1.1.1

    - - Release Upgrade Instructions + RELEASE UPGRADE INSTRUCTIONS

    Release upgrade instructions are interpreted by the release handler when an upgrade or downgrade is made. For more - information about release handling, see - OTP - Design Principles in System Documentation.

    -

    A process is said to use a module Mod if + information about release handling, refer to OTP Design Principles.

    +

    A process is said to use a module Mod, if Mod is listed in the Modules part of the child - specification used to start the process, see - supervisor(3). - In the case of - gen_event, - an event manager process is said to use Mod if Mod - is an installed event handler.

    - -
    - High-Level Instructions + specification used to start the process, see supervisor(3). + In the case of gen_event, an event manager process is said to use + Mod if Mod is an installed event handler.

    +

    High-level instructions

     {update, Mod}
     {update, Mod, supervisor}
    @@ -123,68 +115,52 @@
       Change = soft | {advanced,Extra}
         Extra = term()
       PrePurge = PostPurge = soft_purge | brutal_purge
    -  DepMods = [Mod]
    -

    Synchronized code replacement of processes using module - Mod.

    -

    All those processes are suspended using - sys:suspend, - the new module version is loaded, and - then the processes are resumed using - sys:resume.

    - - Change -

    Defaults to soft and defines the type of - code change. If it is set to {advanced,Extra}, implemented - processes using - gen_server, - gen_fsm, or - gen_event - transform their internal state by calling the callback function - code_change. Special processes call the callback + DepMods = [Mod] + +

    Synchronized code replacement of processes using the module + Mod. All those processes are suspended using + sys:suspend, the new version of the module is loaded and + then the processes are resumed using sys:resume.

    +

    Change defaults to soft and defines the type of + code change. If it is set to {advanced,Extra}, processes + implemented using gen_server, gen_fsm or gen_event will transform + their internal state by calling the callback function + code_change. Special processes will call the callback function system_code_change/4. In both cases, the term - Extra is passed as an argument to the callback - function.

    - PrePurge -

    Defaults to brutal_purge. It controls - what action to take with processes executing old code - before loading the new module version. If the value + Extra is passed as an argument to the callback function.

    +

    PrePurge defaults to brutal_purge and controls + what action to take with processes that are executing old code + before loading the new version of the module. If the value is brutal_purge, the processes are killed. If the value is - soft_purge, - release_handler:install_release/1 - returns {error,{old_processes,Mod}}.

    - PostPurge -

    Defaults to brutal_purge. It controls + soft_purge, release_handler:install_release/1 + returns {error,{old_processes,Mod}}.

    +

    PostPurge defaults to brutal_purge and controls what action to take with processes that are executing old code - when the new module version has been loaded. If the value + when the new version of the module has been loaded. If the value is brutal_purge, the code is purged when the release is made permanent and the processes are killed. If the value is - soft_purge, the release handler purges the old code - when no remaining processes execute the code.

    - DepMods -

    Defaults to [] and defines other modules that - Mod is dependent on. In the relup file, instructions - for suspending processes using Mod come before + soft_purge, the release handler will purge the old code + when no remaining processes execute the code.

    +

    DepMods defaults to [] and defines which other modules + Mod is dependent on. In relup, instructions for + suspending processes using Mod will come before instructions for suspending processes using modules in - DepMods when upgrading, and conversely when downgrading. + DepMods when upgrading, and vice versa when downgrading. In case of circular dependencies, the order of the instructions in - the appup file is kept.

    - Timeout -

    Defines the time-out when suspending processes. - If no value or default is specified, the default value for - sys:suspend - is used.

    - ModType -

    Defaults to dynamic. It specifies if - the code is "dynamic", that is, if a process using the module - spontaneously switches to new code, or if it is "static". - When doing an advanced update and upgrade, the new version of a + the appup script is kept.

    +

    Timeout defines the timeout when suspending processes. + If no value or default is given, the default value for + sys:suspend is used.

    +

    ModType defaults to dynamic and specifies if + the code is "dynamic", that is if a process using the module does + spontaneously switch to new code, or if it is "static". + When doing an advanced update and upgrading, the new version of a dynamic module is loaded before the process is asked to change code. When downgrading, the process is asked to change code before loading the new version. For static modules, the new version is loaded before the process is asked to change code, both in the case of upgrading and downgrading. Callback modules are - dynamic.

    -
    + dynamic.

    update with argument supervisor is used when changing the start specification of a supervisor.

    @@ -193,229 +169,226 @@
     {load_module, Mod, PrePurge, PostPurge, DepMods}
       Mod = atom()
       PrePurge = PostPurge = soft_purge | brutal_purge
    -  DepMods = [Mod]
    + DepMods = [Mod] +

    Simple code replacement of the module Mod.

    -

    For a description of PrePurge and PostPurge, - see update above.

    -

    DepMods defaults to [] and defines which other modules - Mod is dependent on. In the relup file, instructions for - loading these modules come before the instruction for loading - Mod when upgrading, and conversely when downgrading.

    +

    See update above for a description of PrePurge and + PostPurge.

    +

    DepMods defaults to [] and defines which other modules + Mod is dependent on. In relup, instructions for + loading these modules will come before the instruction for loading + Mod when upgrading, and vice versa when downgrading.

     {add_module, Mod}
    -{add_module, Mod, DepMods}
       Mod = atom()
    -  DepMods = [Mod]
    +

    Loads a new module Mod.

    -

    DepMods defaults to [] and defines which other modules - Mod is dependent on. In the relup file, instructions - related to these modules come before the instruction for - loading Mod when upgrading, and conversely when - downgrading.

     {delete_module, Mod}
    -{delete_module, Mod, DepMods}
    -  Mod = atom()
    + Mod = atom() +

    Deletes a module Mod using the low-level instructions remove and purge.

    -

    DepMods defaults to [] and defines which other modules - Mod is dependent on. In the relup file, instructions - related to these modules come before the instruction for - removing Mod when upgrading, and conversely when - downgrading.

     {add_application, Application}
     {add_application, Application, Type}
       Application = atom()
    -  Type = permanent | transient | temporary | load | none
    + Type = permanent | transient | temporary | load | none +

    Adding an application means that the modules defined by the modules key in the .app file are loaded using add_module.

    Type defaults to permanent and specifies the start type of the application. If Type = permanent | transient | temporary, - the application is loaded and started in the corresponding way, see - application(3). - If Type = load, the application is only loaded. - If Type = none, the application is not loaded and not - started, although the code for its modules is loaded.

    + the application will be loaded and started in the corresponding way, + see application(3). If Type = load, the application will + only be loaded. If Type = none, the application will be neither + loaded nor started, although the code for its modules will be loaded.

     {remove_application, Application}
    -  Application = atom()
    + Application = atom() +

    Removing an application means that the application is stopped, - the modules are unloaded using delete_module, and then + the modules are unloaded using delete_module and then the application specification is unloaded from the application controller.

     {restart_application, Application}
    -  Application = atom()
    + Application = atom() +

    Restarting an application means that the application is - stopped and then started again, similar to using the instructions + stopped and then started again similar to using the instructions remove_application and add_application in sequence.

    -
    - -
    - Low-Level Instructions +

    Low-level instructions

     {load_object_code, {App, Vsn, [Mod]}}
       App = Mod = atom()
    -  Vsn = string()
    -

    Reads each Mod from directory App-Vsn/ebin as - a binary. It does not load the modules. The instruction is to be - placed first in the script to read all new code from the file - to make the suspend-load-resume cycle less time-consuming.

    + Vsn = string() + +

    Reads each Mod from the directory App-Vsn/ebin as + a binary. It does not load the modules. The instruction should be + placed first in the script in order to read all new code from file + to make the suspend-load-resume cycle less time consuming. After + this instruction has been executed, the code server with the new + version of App.

    -point_of_no_return
    +point_of_no_return +

    If a crash occurs after this instruction, the system cannot - recover and is restarted from the old release version. - The instruction must only occur once in a script. It is to be + recover and is restarted from the old version of the release. + The instruction must only occur once in a script. It should be placed after all load_object_code instructions.

     {load, {Mod, PrePurge, PostPurge}}
       Mod = atom()
    -  PrePurge = PostPurge = soft_purge | brutal_purge
    + PrePurge = PostPurge = soft_purge | brutal_purge +

    Before this instruction occurs, Mod must have been loaded using load_object_code. This instruction loads the module. - PrePurge is ignored. For a description of PostPurge, - see the high-level instruction update earlier.

    + PrePurge is ignored. See the high-level instruction + update for a description of PostPurge.

     {remove, {Mod, PrePurge, PostPurge}}
       Mod = atom()
    -  PrePurge = PostPurge = soft_purge | brutal_purge
    + PrePurge = PostPurge = soft_purge | brutal_purge +

    Makes the current version of Mod old. - PrePurge is ignored. For a description of PostPurge, - see the high-level instruction update earlier.

    + PrePurge is ignored. See the high-level instruction + update for a description of PostPurge.

     {purge, [Mod]}
    -  Mod = atom()
    -

    Purges each module Mod, that is, removes the old code. - Notice that any process executing purged code is killed.

    + Mod = atom() + +

    Purges each module Mod, that is removes the old code. + Note that any process executing purged code is killed.

     {suspend, [Mod | {Mod, Timeout}]}
       Mod = atom()
    -  Timeout = int()>0 | default | infinity
    + Timeout = int()>0 | default | infinity +

    Tries to suspend all processes using a module Mod. If a - process does not respond, it is ignored. This can cause + process does not respond, it is ignored. This may cause the process to die, either because it crashes when it spontaneously switches to new code, or as a result of a purge operation. If no Timeout is specified or default is - specified, the default value for - sys:suspend - is used.

    + given, the default value for sys:suspend is used.

     {resume, [Mod]}
    -  Mod = atom()
    + Mod = atom() +

    Resumes all suspended processes using a module Mod.

     {code_change, [{Mod, Extra}]}
     {code_change, Mode, [{Mod, Extra}]}
       Mod = atom()
       Mode = up | down
    -  Extra = term()
    + Extra = term() +

    Mode defaults to up and specifies if it is an - upgrade or downgrade. This instruction sends a code_change - system message to all processes using a module Mod by - calling function - sys:change_code, - passing term Extra as argument.

    + upgrade or downgrade.

    +

    This instruction sends a code_change system message to + all processes using a module Mod by calling the function + sys:change_code, passing the term Extra as argument.

     {stop, [Mod]}
    -  Mod = atom()
    + Mod = atom() +

    Stops all processes using a module Mod by calling - supervisor:terminate_child/2. - This instruction is useful + supervisor:terminate_child/2. The instruction is useful when the simplest way to change code is to stop and restart the - processes that run the code.

    + processes which run the code.

     {start, [Mod]}
    -  Mod = atom()
    + Mod = atom() +

    Starts all stopped processes using a module Mod by calling - supervisor:restart_child/2.

    + supervisor:restart_child/2.

     {sync_nodes, Id, [Node]}
     {sync_nodes, Id, {M, F, A}}
       Id = term()
       Node = node()
       M = F = atom()
    -  A = [term()]
    + A = [term()] +

    apply(M, F, A) must return a list of nodes.

    -

    This instruction synchronizes the release installation with other - nodes. Each Node must evaluate this command with the same +

    The instruction synchronizes the release installation with other + nodes. Each Node must evaluate this command, with the same Id. The local node waits for all other nodes to evaluate - the instruction before execution continues. If a node goes + the instruction before execution continues. In case a node goes down, it is considered to be an unrecoverable error, and the local node is restarted from the old release. There is no - time-out for this instruction, which means that it can hang + timeout for this instruction, which means that it may hang forever.

     {apply, {M, F, A}}
       M = F = atom()
    -  A = [term()]
    -

    Evaluates apply(M, F, A).

    -

    If the instruction appears before instruction - point_of_no_return, a failure is caught. - release_handler:install_release/1 - then returns {error,{'EXIT',Reason}}, unless {error,Error} - is thrown or returned. Then it returns {error,Error}.

    -

    If the instruction appears after instruction - point_of_no_return and the function call fails, the - system is restarted.

    -
    -restart_new_emulator
    -

    This instruction is used when the application ERTS, - Kernel, STDLIB, or SASL is + A = [term()] + +

    Evaluates apply(M, F, A). If the instruction appears + before the point_of_no_return instruction, a failure is + caught. release_handler:install_release/1 then returns + {error,{'EXIT',Reason}}, unless {error,Error} is + thrown or returned. Then it returns {error,Error}.

    +

    If the instruction appears after the point_of_no_return + instruction, and the function call fails, the system is + restarted.

    +
    +restart_new_emulator
    +    
    +

    This instruction is used when erts, kernel, stdlib or sasl is upgraded. It shuts down the current emulator and starts a new one. All processes are terminated gracefully, and the new - version of ERTS, Kernel, STDLIB, and - SASL are used when the emulator restarts. - Only one restart_new_emulator instruction is allowed - in the relup file, and it must be placed first. - systools:make_relup/3,4 - ensures this when the relup file is generated. The rest of the - instructions in the relup file is executed after the - restart as a part of the boot script.

    -

    An info report is written when the upgrade is completed. - To programmatically determine if the upgrade is complete, + version of erts, kernel, stdlib and sasl are used when the + emulator restarts. Only one restart_new_emulator + instruction is allowed in the relup, and it shall be placed + first. systools:make_relup/3,4 + will ensure this when the relup is generated. The rest of the + relup script is executed after the restart as a part of the boot + script.

    +

    An info report will be written when the upgrade is + completed. To programatically find out if the upgrade is + complete, call - release_handler:which_releases/0,1 and check if the + release_handler:which_releases/0,1 and check if the expected release has status current.

    The new release must still be made permanent after the upgrade - is completed, otherwise the old emulator is started if there is + is completed. Otherwise, the old emulator is started in case of an emulator restart.

    -

    As stated earlier, instruction restart_new_emulator - causes the emulator to be restarted with new versions of - ERTS, Kernel, STDLIB, and SASL. - However, all other applications do at startup run their old - versions in this new emulator. This is usually no problem, - but every now and then incompatible changes occur to the - core applications, which can cause - trouble in this setting. Such incompatible changes (when - functions are removed) are normally preceded by a deprecation - over two major releases. To ensure that your application is not - crashed by an incompatible change, always remove any call to - deprecated functions as soon as possible.

    +

    As stated above, the restart_new_emulator + instruction causes the emulator to be restarted with new + versions of erts, kernel, stdlib and + sasl. All other applications, however, will at startup + be running their old versions in this new emulator. In most + cases this is no problem, but every now and then there will be + incompatible changes to the core applications which may cause + trouble in this setting. Such incompatible changes (when + functions are removed) are normally preceded by a deprecation + over two major releases. To make sure your application is not + crashed by an incompatible change, always remove any call to + deprecated functions as soon as possible.

    -restart_emulator
    +restart_emulator +

    This instruction is similar to restart_new_emulator, - except it must be placed at the end of the relup file. - It is not related to an upgrade of the emulator or the core + except it shall be placed at the end of the relup script. It is + not related to an upgrade of the emulator or the core applications, but can be used by any application when a complete - reboot of the system is required.

    -

    When generating the relup file, - systools:make_relup/3,4 + reboot of the system is reqiured. When generating the + relup, systools:make_relup/3,4 ensures that there is only one restart_emulator - instruction and that it is the last instruction in the - relup file.

    -
    + instruction and that it is the last instruction of the + relup.

    - See Also -

    release_handler(3), - relup(4), - supervisor(3), - systools(3)

    + SEE ALSO +

    relup(4), + release_handler(3), + supervisor(3), + systools(3)

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/book.xml erlang-17.3-dfsg/lib/sasl/doc/src/book.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,21 +8,20 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. - System Architecture Support Libraries (SASL) + System Application Support Libraries (SASL) OTP Team 1999-04-22 @@ -31,7 +30,7 @@ - System Architecture Support Libraries (SASL) + System Application Support Libraries (SASL) diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/error_logging.xml erlang-17.3-dfsg/lib/sasl/doc/src/error_logging.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/error_logging.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/error_logging.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,93 +30,89 @@ 1999-04-13 B error_logging.xml - -

    The SASL application introduces three types of reports:

    + +

    The SASL application introduces three types of reports:

    - Supervisor report - Progress report - Crash report + supervisor report + progress report + crash report. -

    When the SASL application is started, it adds a handler that - formats and writes these reports, as specified in the configuration - parameters for SASL, that is, the environment variables - in the SASL application specification, which is found in the - .app file of SASL. For details, see the - sasl(6) application in the - Reference Manual and the app(4) - file in the Kernel Reference Manual.

    +

    When the SASL application is started, it adds a handler that + formats and writes these reports, as specified in the + configuration parameters for sasl, i.e the environment variables + in the SASL application specification, which is found in the + .app file of SASL. See + sasl(Application), and app(File) + in the Kernel Reference Manual + for the details.

    Supervisor Report -

    A supervisor report is issued when a supervised child terminates - unexpectedly. A supervisor report contains the following +

    A supervisor report is issued when a supervised child terminates in + an unexpected way. A supervisor report contains the following items:

    - Supervisor -

    Name of the reporting supervisor.

    - Context -

    Indicates in which phase the child terminated + Supervisor. + The name of the reporting supervisor. + Context. + Indicates in which phase the child terminated from the supervisor's point of view. This can be - start_error, child_terminated, or - shutdown_error.

    - Reason -

    Termination reason.

    - Offender -

    Start specification for the child.

    + start_error, child_terminated, or + shutdown_error. + Reason. + The termination reason. + Offender. + The start specification for the child.
    Progress Report -

    A progress report is issued when a supervisor starts or - restarts a child. A progress report contains the following items:

    +

    A progress report is issued whenever a supervisor starts or + restarts. A progress report contains the following items:

    - Supervisor -

    Name of the reporting supervisor.

    - Started -

    Start specification for the successfully - started child.

    + Supervisor. + The name of the reporting supervisor. + Started. + The start specification for the successfully + started child.
    Crash Report -

    Processes started with functions - proc_lib:spawn or - proc_lib:spawn_link - are wrapped within a catch. A crash report is issued when such - a process terminates with an unexpected reason, which is any reason - other than normal, shutdown, or {shutdown,Term}. - Processes using behaviors - gen_server or - gen_fsm - are examples of such processes. A crash report contains the following items:

    +

    Processes started with the proc_lib:spawn or + proc_lib:spawn_link functions are wrapped within a + catch. A crash report is issued whenever such a process + terminates with an unexpected reason, which is any reason other + than normal or shutdown. Processes using the + gen_server and gen_fsm behaviours are examples of + such processes. A crash report contains the following items:

    - Crasher -

    Information about the crashing process, such - as initial function call, exit reason, and message queue.

    - Neighbours -

    Information about processes that are linked to the crashing + Crasher. + Information about the crashing process is reported, such + as initial function call, exit reason, and message queue. + Neighbours. + Information about processes which are linked to the crashing process and do not trap exits. These processes are the - neighbours that terminate because of this process + neighbours which will terminate because of this process crash. The information gathered is the same as the information - for Crasher, described in the previous item.

    + for Crasher, shown in the previous item.
    - Example -

    The following example shows the reports generated - when a process crashes. The example process is a + An Example +

    The following example shows the reports which are generated + when a process crashes. The example process is an permanent process supervised by the test_sup supervisor. A division by zero is executed and the error is first reported by the faulty process. A crash report is - generated, as the process was started using function - proc_lib:spawn/3. - The supervisor generates a - supervisor report showing the crashed process. A + generated as the process was started using the + proc_lib:spawn/3 function. The supervisor generates a + supervisor report showing the process that has crashed, and then a progress report is generated when the process is finally - restarted.

    + re-started.

             =ERROR REPORT==== 27-May-1996::13:38:56 ===
             <0.63.0>: Divide by zero !
    @@ -150,6 +145,7 @@
             {shutdown,200},
             {child_type,worker}]
             
    +        
             =PROGRESS REPORT==== 27-May-1996::13:38:56 ===
             Supervisor: {local,test_sup}
             Started:  [{pid,<0.64.0>},
    @@ -157,66 +153,64 @@
             {mfa,{test,t,[]}},
             {restart_type,permanent},
             {shutdown,200},
    -        {child_type,worker}]
    + {child_type,worker}] +
    Multi-File Error Report Logging -

    Multi-file error report logging is used to store error messages - received by error_logger. The error messages +

    Multi-file error report logging is used to store error messages, + which are received by the error_logger. The error messages are stored in several files and each file is smaller than a - specified number of kilobytes. No more than a specified number - of files exist at the same time. The logging is very fast, as + specified amount of kilobytes, and no more than a specified number + of files exist at the same time. The logging is very fast because each error message is written as a binary term.

    -

    For more details, see the - sasl(6) - application in the Reference Manual.

    +

    Refer to + sasl application in the Reference Manual for more details.

    Report Browser

    The report browser is used to browse and format error reports - written by the error logger handler - log_mf_h - defined in STDLIB.

    + written by the error logger handler log_mf_h defined in + stdlib.

    The log_mf_h handler writes all reports to a - report logging directory, which is specified when - configuring the SASL application.

    + report logging directory. This directory is specified when + configuring the SASL application.

    If the report browser is - used offline, the reports can be copied to another directory - specified when starting the browser. If no such directory - is specified, the browser reads reports from the SASL + used off-line, the reports can be copied to another directory + which is specified when starting the browser. If no such directory + is specified, the browser reads reports from the SASL error_logger_mf_dir.

    - Starting Report Browser -

    Start the rb_server with function - rb:start([Options]) - as shown in the following example:

    + Starting the Report Browser +

    Start the rb_server with the function + rb:start([Options]) as shown in the following + example:

    -        5> rb:start([{max, 20}]).
    +
    +        5>rb:start([{max, 20}]).
             rb: reading report...done.
             rb: reading report...done.
             rb: reading report...done.
             rb: reading report...done.
    -        {ok,<0.199.0>}
    +
    - Online Help -

    Enter command - rb:help() - to access the report browser online help system.

    + On-line Help +

    Enter the command rb:help(). to access the report + browser on-line help system.

    - List Reports in Server -

    Use function - rb:list() - to list all loaded reports:

    + List Reports in the Server +

    The function rb:list() lists all loaded reports:

    -        4> rb:list().
    +
    +        4>rb:list().
             No                Type          Process       Date     Time
             ==                ====          =======       ====     ====
             20            progress         <0.17.0> 1996-10-16 16:14:54
    @@ -239,15 +233,17 @@
             3            progress         <0.14.0> 1996-10-16 16:16:36
             2               error         <0.15.0> 1996-10-16 16:17:04
             1            progress         <0.14.0> 1996-10-16 16:17:09
    -        ok
    + ok +
    Show Reports -

    Use function - rb:show(Number) - to show details of a specific report:

    +

    To show details of a specific report, use the function + rb:show(Number):

    +
    +10> rb:show(1).
     7> rb:show(4).
             
     PROGRESS REPORT  <0.20.0>                                   1996-10-16 16:16:36
    @@ -262,7 +258,7 @@
     {child_type,worker}]
             
     ok
    -8> rb:show(9).
    +8> rb:show(9).
             
     CRASH REPORT  <0.24.0>                                      1996-10-16 16:16:21
     ===============================================================================
    @@ -290,17 +286,19 @@
     stack_size                                                               142
     reductions                                                                54
     
    -ok
    +ok +
    - Search Reports -

    All reports containing a common pattern can be shown. - Suppose a process crashes because it tries to call a - non-existing function release_handler:mbj_func/1. - The reports can then be shown as follows:

    + Search the Reports +

    It is possible to show all reports which contain a common + pattern. Suppose a process crashes because it tries to call a + non-existing function release_handler:mbj_func. We could + then show reports as follows:

    -12> rb:grep("mbj_func").
    +
    +12>rb:grep("mbj_func").          
     Found match in report number 11
             
     ERROR REPORT  <0.24.0>                                      1996-10-16 16:16:21
    @@ -369,17 +367,19 @@
     shutdown                                                                2000
     child_type                                                            worker
             
    -ok
    +ok +
    - Stop Server -

    Use function - rb:stop() - to stop the rb_server:

    + Stop the Server +

    Stop the rb_server with the function + rb:stop():

    -13> rb:stop().
    -ok
    + +13>rb:stop(). +ok +
    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/Makefile erlang-17.3-dfsg/lib/sasl/doc/src/Makefile --- erlang-18.2-dfsg/lib/sasl/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/notes_history.xml erlang-17.3-dfsg/lib/sasl/doc/src/notes_history.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/notes.xml erlang-17.3-dfsg/lib/sasl/doc/src/notes.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,85 +30,6 @@

    This document describes the changes made to the SASL application.

    -
    SASL 2.6.1 - -
    Improvements and New Features - - -

    - Documentation improvements

    -

    - Own Id: OTP-13000

    -
    -
    -
    - -
    - -
    SASL 2.6 - -
    Improvements and New Features - - -

    A mechanism for limiting the amount of text that the - built-in error logger events will produce has been - introduced. It is useful for limiting both the size of - log files and the CPU time used to produce them.

    -

    This mechanism is experimental in the sense that it - may be changed if it turns out that it does not solve the - problem it is supposed to solve. In that case, there may - be backward incompatible improvements to this - mechanism.

    -

    See the documentation for the config parameter - error_logger_format_depth in the Kernel - application for information about how to turn on this - feature.

    -

    - Own Id: OTP-12864

    -
    -
    -
    - -
    - -
    SASL 2.5 - -
    Fixed Bugs and Malfunctions - - -

    - The undocumented upgrade instruction - {remove_module,PrePurge,PostPurge,DepMods} is - removed. This instruction was added for symmetry reasons - in OTP R7B, but was never documented or tested.

    -

    - The existing instruction {add_module,Mod,DepMods} - is now documented, and the complementing instruction - {delete_module,Mod,DepMods} is added.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-11540

    -
    -
    -
    - - -
    Improvements and New Features - - -

    The sasl_error_logger configuration parameter - now supports the value {file,FileName,Modes} which - allows the log file to be opened in other mode than write - (for example, append mode).

    -

    - Own Id: OTP-12778

    -
    -
    -
    - -
    -
    SASL 2.4.1
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/overload.xml erlang-17.3-dfsg/lib/sasl/doc/src/overload.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/overload.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/overload.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -35,88 +34,98 @@ overload An Overload Regulation Process -

    overload is a process that indirectly regulates the CPU +

    overload is a process which indirectly regulates CPU usage in the system. The idea is that a main application calls - function - request/0 - before starting a major job and + the request/0 function before starting a major job, and proceeds with the job if the return value is positive; otherwise - the job must not be started.

    -

    overload is part of the SASL application and all - configuration parameters are defined there.

    -

    A set of two intensities are maintained, the total intensity - and the accept intensity. For that purpose, - there are two configuration parameters, MaxIntensity - and Weight; both are measured in 1/second.

    + the job must not be started. +

    +

    overload is part of the sasl application, and all + configuration parameters are defined there. +

    +

    A set of two intensities are maintained, the total intensity and the accept intensity. For that purpose + there are two configuration parameters, the MaxIntensity + and the Weight value (both are measured in 1/second). +

    Then total and accept intensities are calculated as follows. Assume that the time of the current call to - request/0 is T(n) and that the time of the - previous call was T(n-1).

    + request/0 is T(n), and that the time of the + previous call was T(n-1). +

    The current total intensity, denoted - TI(n), is calculated according to the formula

    -

    TI(n) = exp(-Weight*(T(n) - T(n-1)) * TI(n-1) + Weight,

    -

    where TI(n-1) is the previous total intensity.

    + TI(n), is calculated according to the formula, +

    +

    TI(n) = exp(-Weight*(T(n) - T(n-1)) * TI(n-1) + Weight, +

    +

    where TI(n-1) is the previous total intensity. +

    The current accept intensity, denoted - AI(n), is determined by the formula

    -

    AI(n) = exp(-Weight*(T(n) - T(n-1)) * AI(n-1) + Weight,

    -

    where AI(n-1) is the previous accept intensity, - if the value of exp(-Weight*(T(n) - T(n-1)) * AI(n-1) - is less than MaxIntensity. Otherwise the value is

    -

    AI(n) = exp(-Weight*(T(n) - T(n-1)) * AI(n-1)

    + AI(n), is determined by the formula, +

    +

    AI(n) = exp(-Weight*(T(n) - T(n-1)) * AI(n-1) + Weight, +

    +

    where AI(n-1) is the previous accept intensity, + provided that the value of exp(-Weight*(T(n) - T(n-1)) * AI(n-1) is less than MaxIntensity; otherwise the + value is +

    +

    AI(n) = exp(-Weight*(T(n) - T(n-1)) * AI(n-1). +

    The value of configuration parameter Weight controls the - speed with which the calculations of intensities react to + speed with which the calculations of intensities will react to changes in the underlying input intensity. The inverted value of - Weight, T = 1/Weight, can be thought of as the - "time constant" of the intensity calculation formulas. For example, - if Weight = 0.1, a change in the underlying input intensity is - reflected in total intensity and accept intensity within - about 10 seconds.

    + Weight, +

    +

    T = 1/Weight

    +

    can be thought of as the "time constant" + of the intensity calculation formulas. For example, if Weight = 0.1, then a change in the underlying input intensity will be + reflected in the total and accept intensities within + approximately 10 seconds. +

    The overload process defines one alarm, which it sets using - alarm_handler:set_alarm(Alarm). Alarm is defined - as follows:

    + alarm_handler:set_alarm(Alarm). Alarm is defined + as: +

    {overload, []} -

    This alarm is set when the current accept intensity exceeds - MaxIntensity.

    +

    This alarm is set when the current accept intensity exceeds + MaxIntensity. +

    -

    A new request is not accepted until the current accept - intensity has fallen below MaxIntensity. To prevent the - overload process from generating many set/reset alarms, the - alarm is not reset until the current accept intensity has fallen - below 75% of MaxIntensity; it is not until then that - the alarm can be set again.

    +

    A new overload alarm is not set until the current accept + intensity has fallen below MaxIntensity. To prevent the + overload process from generating a lot of set/reset alarms, the + alarm is not reset until the current accept intensity has fallen + below 75% of MaxIntensity, and it is not until then that + the alarm can be set again. +

    - request() -> accept | reject - Requests to proceed with current job. + Request to proceed with current job

    Returns accept or reject depending on the - current value of the accept intensity.

    + current value of the accept intensity.

    The application - calling this function is to proceed with the job in + calling this function should be processed with the job in question if the return value is accept; otherwise it - is not to continue with that job.

    + should not continue with that job. +

    - get_overload_info() -> OverloadInfo - Returns current overload information data. + Return current overload information data - OverloadInfo = [{total_intensity, TotalIntensity}, - {accept_intensity, AcceptIntensity}, {max_intensity, - MaxIntensity}, {weight, Weight}, {total_requests, - TotalRequests}, {accepted_requests, AcceptedRequests}]. + OverloadInfo = [{total_intensity, TotalIntensity}, {accept_intensity, AcceptIntensity}, {max_intensity, MaxIntensity}, {weight, Weight}, {total_requests, TotalRequests}, {accepted_requests, AcceptedRequests}]. TotalIntensity = float() > 0 AcceptIntensity = float() > 0 MaxIntensity = float() > 0 @@ -125,22 +134,18 @@ AcceptedRequests = integer() -

    Returns:

    - - Current total and accept intensities - Configuration parameters - Absolute counts of the total number of requests - Accepted number of requests (since the overload - process was started) - +

    Returns the current total and accept intensities, the + configuration parameters, and absolute counts of the total + number of requests, and accepted number of requests (since + the overload process was started).

    See Also -

    alarm_handler(3), - sasl(6)

    +

    alarm_handler(3), sasl(3) +

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/part_notes_history.xml erlang-17.3-dfsg/lib/sasl/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/part_notes.xml erlang-17.3-dfsg/lib/sasl/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/part.xml erlang-17.3-dfsg/lib/sasl/doc/src/part.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -30,9 +29,8 @@ part.xml -

    The System Architecture Support Libraries SASL application - provides support for alarm handling, release handling, and - related functions.

    +

    The System Architecture Support Libraries, SASL, + provides support for alarm and release handling etc.

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/rb.xml erlang-17.3-dfsg/lib/sasl/doc/src/rb.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/rb.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/rb.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -35,252 +34,241 @@ rb The Report Browser Tool -

    The Report Browser (RB) tool is used to browse and +

    The Report Browser (RB) tool makes it possible to browse and format error reports written by the error logger handler - log_mf_h - in STDLIB.

    + log_mf_h. +

    - filter(Filters) filter(Filters, Dates) - Filters reports and displays them on the screen. + Filter reports and displays them on the screen Filters = [filter()] - filter() = {Key, Value} | {Key, Value, no} | {Key, RegExp, re} | - {Key, RegExp, re, no} + filter() = {Key, Value} | {Key, Value, no} | {Key, RegExp, re} | {Key, RegExp, re, no} Key = term() Value = term() - RegExp = string() | {string(), Options} | re:mp() | {re:mp(), Options} + RegExp = string() | {string, Options} | mp(), {mp(), Options} Dates = {DateFrom, DateTo} | {DateFrom, from} | {DateTo, to} - DateFrom = DateTo = calendar:datetime() + DateFrom = DateTo = {date(), time()} + date() and time() are the same type as in the calendar module -

    Displays the reports that match the provided filters.

    -

    When a filter includes the no atom, it excludes the - reports that match that filter.

    -

    The reports are matched using the - proplists - module in STDLIB. The report must be a proplist - to be matched against any of the filters.

    -

    If the filter has the form {Key, RegExp, re}, the - report must contain an element with key equal to Key and - the value must match the regular expression RegExp.

    -

    If parameter Dates is specified, the reports are filtered - according to the date when they occurred. If Dates has - the form {DateFrom, from}, reports that occurred after - DateFrom are displayed.

    -

    If Dates has the form {DateTo, to}, reports that - occurred before DateTo are displayed.

    -

    If two Dates are specified, reports that occurred between - those dates are returned.

    -

    To filter only by dates, specify the empty list as the Filters - parameter.

    -

    For details about parameter RegExp, see rb:grep/1.

    -

    For details about data type mp(), see - re:mp().

    -

    For details about data type datetime(), see - calendar:datetime().

    +

    This function displays the reports that match the provided filters.

    +

    + When a filter includes the no atom it will exclude the reports that match + that filter. +

    +

    + The reports are matched using the proplists module. The report must be a proplist + to be matched against any of the filters(). +

    +

    + If the filter is of the form {Key, RegExp, re} the report must contain an element with + key = Key and Value must match the RegExp regular expression. +

    +

    + If the Dates parameter is provided, then the reports are filtered according to the date + when they occurred. If Dates is of the form {DateFrom, from} then reports that occurred + after DateFrom are displayed. +

    +

    + If Dates is of the form {DateTo, to} then reports that occurred before DateTo + are displayed. +

    +

    + If two Dates are provided, then reports that occurred between those dates are returned. +

    +

    + If you only want to filter only by dates, then you can provide the empty list as the Filters + parameter. +

    +

    + See rb:grep/1 for more information on the RegExp parameter. +

    - grep(RegExp) - Searches the reports for a regular expression. + Search the reports for a regular expression - RegExp = string() | {string(), Options} | re:mp() | {re:mp(), Options} + RegExp = string() | {string, Options} | mp(), {mp(), Options} -

    All reports matching the regular expression RegExp - are displayed. RegExp can be any of the following:

    - - A string containing the regular expression - A tuple with the string and the options for compilation - A compiled regular expression - A compiled regular expression and the options for running it - -

    For a definition of valid regular expressions and options, see - the re module in - STDLIB and in particular function re:run/3.

    -

    For details about data type mp(), see - re:mp().

    +

    All reports containing the regular expression RegExp + are printed. +

    +

    RegExp can be a string containing the regular + expression; a tuple with the string and the options for + compilation; a compiled regular expression; a compiled + regular expression and the options for running it. + Refer to the module re and specially the function re:run/3 + for a definition of valid regular expressions and options. +

    - h() help() - Displays help information. + Print help information -

    Displays online help information.

    +

    Prints the on-line help information. +

    - list() list(Type) - Lists all reports. + List all reports Type = type() type() = error | error_report | info_msg | info_report | - warning_msg | warning_report | crash_report | - supervisor_report | progress + warning_msg | warning_report | crash_report | + supervisor_report | progress -

    Lists all reports loaded in +

    This function lists all reports loaded in the rb_server. Each report is given a unique number that - can be used as a reference to the report in function - show/1.

    -

    If no Type is specified, all reports are listed.

    + can be used as a reference to the report in the + show/1 function. +

    +

    If no Type is given, all reports are listed. +

    - log_list() log_list(Type) - Logs report lists. + Log reports list Type = type() type() = error | error_report | info_msg | info_report | - warning_msg | warning_report | crash_report | - supervisor_report | progress + warning_msg | warning_report | crash_report | + supervisor_report | progress -

    Same as functions - list/0 or - list/1, - but the result is printed to a log file, if set; otherwise - to standard_io.

    -

    If no Type is specified, all reports are listed.

    +

    Same as list/0 or list/1 functions + but result is printed to logfile, if set, otherwise to standard_io. +

    +

    If no Type is given, all reports are listed. +

    - rescan() rescan(Options) - Rescans the report directory. + Rescan the report directory Options = [opt()]

    Rescans the report directory. Options is the same as - for function - start/1.

    + for start(). +

    - show() show(Report) - Displays reports. + Show reports - Report = integer() | type() + Report = int() | type() -

    If argument type is specified, all loaded reports of this - type are displayed. If an integer argument is specified, the - report with this reference number is displayed. If no argument - is specified, all reports are displayed.

    +

    If a type argument is given, all loaded reports of this + type are printed. If an integer argument is given, the + report with this reference number is printed. If no argument + is given, all reports are shown. +

    - start() start(Options) - Starts the rb_server. + Start the RB server Options = [opt()] - opt() = {start_log, FileName} | {max, MaxNoOfReports} | - {report_dir, DirString} | {type, ReportType} | - {abort_on_error, Bool} + opt() = {start_log, FileName} | {max, MaxNoOfReports} | {report_dir, DirString} | {type, ReportType} | {abort_on_error, Bool} FileName = string() | atom() | pid() - MaxNoOfReports = integer() | all + MaxNoOfReports = int() | all DirString = string() ReportType = type() | [type()] | all - Bool = boolean() + Bool = true | false -

    Function start/1 starts rb_server with the - specified options, whereas function start/0 starts with - default options. rb_server must be started before - reports can be browsed. When rb_server is +

    The function start/1 starts the rb_server + with the specified options, while start/0 starts with + default options. The rb_server must be started before + reports can be browsed. When the rb_server is started, the files in the specified directory are scanned. The other functions assume that the server has - started.

    -

    Options:

    - - {start_log, FileName} -

    Starts logging to file, - registered name, or io_device. All reports are printed - to the specified destination. Default is standard_io. - Option {start_log, standard_error} is not allowed and - will be replaced by default standard_io.

    - {max, MaxNoOfReports} -

    Controls how many reports - rb_server is to read at startup. This option is - useful, as the directory can contain a large amount of reports. If this - option is specified, the MaxNoOfReports latest reports - are read. Default is all.

    - {report_dir, DirString} -

    Defines the directory where - the error log files are located. Default is - the directory specified by application environment - variable error_logger_mf_dir, - see sasl(6).

    - {type, ReportType} -

    Controls what kind of reports - rb_server is to read at startup. ReportType - is a supported type, all, or a list of supported - types. Default is all.

    - {abort_on_error, Bool} -

    Specifies if - logging is to be ended if rb encounters an unprintable - report. (You can get a report with an incorrect form if function - error_logger, error_msg, or - info_msg has been called with an invalid format string)

    - - If Bool is true, rb stops logging - (and prints an error message to stdout) if it encounters - a badly formatted report. If logging to file is enabled, an - error message is appended to the log file as well. - If Bool is false (the default value), rb - prints an error message to stdout for every bad report it - encounters, but the logging process is never ended. All printable - reports are written. If logging to file is enabled, rb prints - * UNPRINTABLE REPORT * in the log file at the location of an - unprintable report. -
    -
    + started. +

    +

    {start_log, FileName} starts logging to file, + registered name or io_device. All reports will be printed + to the named file. The default is standard_io. + The option {start_log, standard_error} is not allowed and + will be replaced by default standard_io. +

    +

    {max, MaxNoOfReports}. Controls how many reports the + rb_server should read on start-up. This option is + useful as the directory may contain 20.000 reports. If this + option is given, the MaxNoOfReports latest reports + will be read. The default is 'all'. +

    +

    {report_dir, DirString}. Defines the directory where + the error log files are located. The default is {sasl, error_logger_mf_dir}.

    +

    {type, ReportType}. Controls what kind of reports the + rb_server should read on start-up. ReportType + is a supported type, 'all', or a list of supported + types. The default is 'all'. +

    +

    {abort_on_error, Bool}. This option specifies whether + or not logging should be aborted if rb encounters an unprintable + report. (You may get a report on incorrect form if the + error_logger function error_msg or + info_msg has been called with an invalid format string). + If Bool is true, rb will stop logging (and print an + error message to stdout) if it encounters a badly formatted report. + If logging to file is enabled, an error message will be appended to + the log file as well. + If Bool is false (which is the default value), rb will + print an error message to stdout for every bad report it + encounters, but the logging process is never aborted. All printable + reports will be written. If logging to file is enabled, rb prints + * UNPRINTABLE REPORT * in the log file at the location of an + unprintable report. +

    - start_log(FileName) - Redirects all output to FileName. + Redirect all output to FileName FileName = string() | atom() | pid()

    Redirects all report output from the RB tool to the - specified file, registered name, or io_device.

    + specified file, registered name or io_device. +

    - stop() - Stops the rb_server. + Stop the RB server -

    Stops rb_server.

    +

    Stops the rb_server. +

    - stop_log() - Stops logging to file. + Stop logging to file -

    Closes the log file. The output from the RB tool is - directed to standard_io.

    +

    Closes the log file. The output from the RB tool will be + directed to standard_io. +

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/ref_man.xml erlang-17.3-dfsg/lib/sasl/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -30,8 +29,8 @@ application.xml -

    The SASL application provides support for alarm handling, - release handling, and related functions.

    +

    The System Architecture Support Libraries application, SASL, + provides support for alarm and release handling etc.

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/release_handler.xml erlang-17.3-dfsg/lib/sasl/doc/src/release_handler.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/release_handler.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/release_handler.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,115 +30,109 @@ release_handler Unpacking and Installation of Release Packages -

    The release handler process belongs to the SASL - application, which is responsible for release handling, +

    The release handler is a process belonging to the SASL + application which is responsible for release handling, that is, unpacking, installation, and removal of release packages.

    -

    An introduction to release handling and an example is provided in - OTP Design - Principles in System Documentation.

    +

    An introduction to release handling and a usage example can be + found in + Design Principles. +

    A release package is a compressed tar file containing code for a certain version of a release, created by calling - systools:make_tar/1,2. - The release package is to be located in the $ROOT/releases - directory of the previous version of the release, where + systools:make_tar/1,2. + The release package should be placed in the $ROOT/releases + directory of the previous version of the release where $ROOT is the installation root directory, - code:root_dir(). - Another releases directory can be specified using the SASL - configuration parameter releases_dir or the OS environment + code:root_dir(). + Another releases directory can be specified using the SASL + configuration parameter releases_dir, or the OS environment variable RELDIR. The release handler must have write access - to this directory to install the new release. + to this directory in order to install the new release. The persistent state of the release handler is stored there in a file called RELEASES.

    -

    A release package is always to contain:

    - - A release resource file, Name.rel - A boot script, Name.boot - -

    The .rel file contains information about the release: its name, - version, and which ERTS and application versions it uses.

    -

    A release package can also contain:

    - - A release upgrade file, relup - A system configuration file, sys.config - -

    The relup file contains instructions for how to upgrade - to, or downgrade from, this version of the release.

    +

    A release package should always contain the release resource file + Name.rel and a boot script Name.boot. It may contain + a release upgrade file relup and a system configuration + file sys.config. The .rel file contains information + about the release: its name, version, and which ERTS and + application versions it uses. The relup file contains + scripts for how to upgrade to, or downgrade from, this version of + the release.

    The release package can be unpacked, which extracts the files. An unpacked release can be installed. The currently used version of the release is then upgraded or downgraded to the specified version by evaluating the instructions - in the relup file. An installed release can be made - permanent. Only one permanent release can exist in - the system, and this release is used if the system + in relup. An installed release can be made + permanent. There can only be one permanent release in + the system, and this is the release that is used if the system is restarted. An installed release, except the permanent one, can be removed. When a release is removed, all files - belonging to that release only are deleted.

    -

    Each release version has a status, which can be + that belong to that release only are deleted.

    +

    Each version of the release has a status. The status can be unpacked, current, permanent, or old. - There is always one latest release, which either has status - permanent (normal case) or current (installed, but - not yet made permanent). The meaning of the status values are - illustrated in the following table:

    + There is always one latest release which either has status + permanent (normal case), or current (installed, but + not yet made permanent). The following table illustrates + the meaning of the status values:

    -        Status     Action                NextStatus
    -        -------------------------------------------
    -        -          unpack                unpacked
    -        unpacked   install               current
    -                   remove                -
    -        current    make_permanent        permanent
    -                   install other         old
    -                   remove                -
    -        permanent  make other permanent  old
    -                   install               permanent
    -        old        reboot_old            permanent
    -                   install               current
    -                   remove                -
    +Status Action NextStatus +------------------------------------------- + - unpack unpacked +unpacked install current + remove - +current make_permanent permanent + install other old + remove - +permanent make other permanent old + install permanent +old reboot_old permanent + install current + remove - +

    The release handler process is a locally registered process on each node. When a release is installed in a distributed system, the release handler on each node must be called. The release - installation can be synchronized between nodes. From an operator - view, it can be unsatisfactory to specify each node. The aim is + installation may be synchronized between nodes. From an operator + view, it may be unsatisfactory to specify each node. The aim is to install one release package in the system, no matter how many - nodes there are. It is recommended that - software management functions are written that take care of - this problem. Such a function can have knowledge of the system + nodes there are. If this is the case, it is recommended that + software management functions are written which take care of + this problem. Such a function may have knowledge of the system architecture, so it can contact each individual release handler to install the package.

    -

    For release handling to work properly, the runtime system must - know which release it is running. It - must also be able to change (in runtime) which boot script and - system configuration file are to be used if the system is +

    For release handling to work properly, the runtime system needs + to have knowledge about which release it is currently running. It + must also be able to change (in run-time) which boot script and + system configuration file should be used if the system is restarted. This is taken care of automatically if Erlang is - started as an embedded system. Read about this in - Embedded System in - System Documentation. In this case, the system - configuration file sys.config is mandatory.

    -

    The installation of a new release can restart the system. Which - program to use is specified by the SASL configuration - parameter start_prg, which defaults + started as an embedded system. Read about this in Embedded System. In this case, the system configuration file + sys.config is mandatory.

    +

    The installation of a new release may restart the system. Which + program to use is specified by the SASL configuration + parameter start_prg which defaults to $ROOT/bin/start.

    The emulator restart on Windows NT expects that the system is started using the erlsrv program (as a service). - Furthermore, the release handler expects that the service is named - NodeName_Release, where NodeName is - the first part of the Erlang node name (up to, but not including - the "@") and Release is the current release version. - The release handler furthermore expects that a + Furthermore the release handler expects that the service is named + NodeName_Release, where NodeName is + the first part of the Erlang nodename (up to, but not including + the "@") and Release is the current version of + the release. The release handler furthermore expects that a program like start_erl.exe is specified as "machine" to - erlsrv. During upgrading with restart, a new service - is registered and started. The new service is set to - automatic and the old service is removed when the new release + erlsrv. During upgrading with restart, a new service will + be registered and started. The new service will be set to + automatic and the old service removed as soon as the new release is made permanent.

    -

    The release handler at a node running on a diskless machine, +

    The release handler at a node which runs on a diskless machine, or with a read-only file system, must be configured accordingly - using the following SASL configuration parameters (for - details, see sasl(6)):

    + using the following sasl configuration parameters (see + sasl(6) for details):

    masters -

    This node uses some master nodes to store - and fetch release information. All master nodes must be - operational whenever release information is written by this +

    This node uses a number of master nodes in order to store + and fetch release information. All master nodes must be up + and running whenever release information is written by this node.

    client_directory @@ -151,25 +144,24 @@

    This parameter specifies if the Erlang emulator is statically installed at the client node. A node with a static - emulator cannot dynamically switch to a new emulator, as + emulator cannot dynamically switch to a new emulator because the executable files are statically written into memory.

    -

    The release handler can also be used to unpack and +

    It is also possible to use the release handler to unpack and install release packages when not running Erlang as an embedded - system. However, in this case the user must somehow ensure that + system, but in this case the user must somehow make sure that correct boot scripts and configuration files are used if - the system must be restarted.

    -

    Functions are provided for using another file structure + the system needs to be restarted.

    +

    There are additional functions for using another file structure than the structure defined in OTP. These functions can be used to test a release upgrade locally.

    - check_install_release(Vsn) -> {ok, OtherVsn, Descr} | {error, Reason} check_install_release(Vsn,Opts) -> {ok, OtherVsn, Descr} | {error, Reason} - Checks installation of a release in the system. + Check installation of a release in the system. Vsn = OtherVsn = string() Opts = [Opt] @@ -180,29 +172,27 @@

    Checks if the specified version Vsn of the release can be installed. The release must not have status - current. Issues warnings if relup file or - sys.config is not present. If relup file is present, + current. Issues warnings if relup or + sys.config are not present. If relup is present, its contents are checked and {error,Reason} is returned if an error is found. Also checks that all required - applications are present and that all new code can be loaded; - {error,Reason} is returned if an error is found.

    -

    Evaluates all instructions that occur before + applications are present and that all new code can be loaded, + or {error,Reason} is returned.

    +

    This function evaluates all instructions that occur before the point_of_no_return instruction in the release upgrade script.

    -

    Returns the same as - install_release/1. - Descr defaults to "" if no relup file is found.

    -

    If option purge is specified, all old code that can - be soft-purged is purged after all other checks are - successfully completed. This can be useful to +

    Returns the same as install_release/1. Descr + defaults to "" if no relup file is found.

    +

    If the option purge is given, all old code that can + be soft purged will be purged after all other checks are + successfully completed. This can be useful in order to reduce the time needed by install_release/1.

    + marker="#install_release/1">install_release.

    - create_RELEASES(Root, RelDir, RelFile, AppDirs) -> ok | {error, Reason} - Creates an initial RELEASES file. + Create an initial RELEASES file. Root = RelDir = RelFile = string() AppDirs = [{App, Vsn, Dir}] @@ -211,55 +201,52 @@ Reason = term() -

    Creates an initial RELEASES file to be used by the - release handler. This file must exist to install new +

    Creates an initial RELEASES file to be used by the release + handler. This file must exist in order to install new releases.

    Root is the root of the installation ($ROOT) as - described earlier. RelDir is the directory where - the RELEASES file is to be created (normally + described above. RelDir is the the directory where + the RELEASES file should be created (normally $ROOT/releases). RelFile is the name of the .rel file that describes the initial release, including the extension .rel.

    AppDirs can be used to specify from where the modules - for the specified applications are to be loaded. App is + for the specified applications should be loaded. App is the name of an application, Vsn is the version, and Dir is the name of the directory where App-Vsn - is located. The corresponding modules are to be located under + is located. The corresponding modules should be located under Dir/App-Vsn/ebin. The directories for applications not specified in AppDirs are assumed to be located in $ROOT/lib.

    - install_file(Vsn, File) -> ok | {error, Reason} - Installs a release file in the release structure. + Install a release file in the release structure. Vsn = File = string() Reason = term() -

    Installs a release-dependent file in the release structure. - The release-dependent file must be in +

    Installs a release dependent file in the release structure. + A release dependent file is a file that must be in the release structure when a new release is installed: - start.boot, relup, and sys.config.

    + start.boot, relup and sys.config.

    The function can be called, for example, when these files - are generated at the target. The function is to be called after - set_unpacked/2 - has been called.

    + are generated at the target. It should be called after + set_unpacked/2 has been called.

    - install_release(Vsn) -> {ok, OtherVsn, Descr} | {error, Reason} install_release(Vsn, [Opt]) -> {ok, OtherVsn, Descr} | {continue_after_restart, OtherVsn, Descr} | {error, Reason} - Installs a release in the system. + Install a release in the system. Vsn = OtherVsn = string() Opt = {error_action, Action} | {code_change_timeout, Timeout}    | {suspend_timeout, Timeout} | {update_paths, Bool}  Action = restart | reboot -  Timeout = default | infinity | pos_integer() +  Timeout = default | infinity | int()>0  Bool = boolean() Descr = term() Reason = {illegal_option, Opt} | {already_installed, Vsn} | {change_appl_data, term()} | {missing_base_app, OtherVsn, App} | {could_not_create_hybrid_boot, term()} | term() @@ -274,7 +261,7 @@ version and a script {Vsn,Descr2,Instructions2} in this file for downgrading to Vsn.

    If a script is found, the first thing that happens is that - the application specifications are updated according to + the applications specifications are updated according to the .app files and sys.config belonging to the release version Vsn.

    After the application specifications have been updated, @@ -283,120 +270,101 @@ OtherVsn and Descr are the version (UpFromVsn or Vsn) and description (Descr1 or Descr2) as specified in the script.

    -

    If {continue_after_restart,OtherVsn,Descr} is - returned, the emulator is restarted - before the upgrade instructions are executed. This - occurs if the emulator or any of the applications - Kernel, STDLIB, or SASL - are updated. The new emulator version - and these core applications execute after the restart. - For all other applications the old versions are - started and the upgrade is performed as normal by +

    If {continue_after_restart,OtherVsn,Descr} is + returned, it means that the emulator will be restarted + before the upgrade instructions are executed. This will + happen if the emulator or any of the applications kernel, + stdlib or sasl are updated. The new version of the emulator + and these core applications will execute after the restart, + but for all other applications the old versions will be + started and the upgrade will be performed as normal by executing the upgrade instructions.

    If a recoverable error occurs, the function returns {error,Reason} and the original application specifications are restored. If a non-recoverable error occurs, the system is restarted.

    -

    Options:

    - - error_action -

    Defines if the node is to be - restarted - (init:restart()) - or rebooted - (init:reboot()) - if there is an error during - the installation. Default is restart.

    - code_change_timeout -

    Defines the time-out - for all calls to - stdlib:sys:change_code. - If no value is specified or default is specified, the - default value defined in sys is used.

    - suspend_timeout -

    Defines the time-out for - all calls to - stdlib:sys:suspend. - If no value is specified, the values defined by the Timeout - parameter of the upgrade or suspend instructions are used. - If default is specified, the default value defined in - sys is used.

    - {update_paths,Bool} -

    Indicates if all - application code paths are to be updated (Bool==true) - or if only code paths for modified applications are to be - updated (Bool==false, default). This option has only - effect for other application directories than the default - $ROOT/lib/App-Vsn, that is, application directories - specified in argument AppDirs in a call to - create_RELEASES/4 or - set_unpacked/2.

    -

    Example:

    -

    In the current version CurVsn of a release, the - application directory of myapp is - $ROOT/lib/myapp-1.0. A new version NewVsn is - unpacked outside the release handler and the release - handler is informed about this with a call as follows:

    - +

    The option error_action defines if the node should be + restarted (init:restart()) or rebooted + (init:reboot()) in case of an error during + the installation. Default is restart.

    +

    The option code_change_timeout defines the timeout + for all calls to sys:change_code. If no value is + specified or default is given, the default value + defined in sys is used.

    +

    The option suspend_timeout defines the timeout for + all calls to sys:suspend. If no value is specified, + the values defined by the Timeout parameter of + the upgrade or suspend instructions are used. + If default is specified, the default value defined in + sys is used.

    +

    The option {update_paths,Bool} indicates if all + application code paths should be updated (Bool==true), + or if only code paths for modified applications should be + updated (Bool==false, default). This option only has + effect for other application directories than the default + $ROOT/lib/App-Vsn, that is, application directories + provided in the AppDirs argument in a call to + create_RELEASES/4 or set_unpacked/2.

    +

    Example: In the current version CurVsn of a release, + the application directory of myapp is + $ROOT/lib/myapp-1.0. A new version NewVsn is + unpacked outside the release handler, and the release handler + is informed about this with a call to:

    + release_handler:set_unpacked(RelFile, [{myapp,"1.0","/home/user"},...]). -=> {ok,NewVsn} -

    If NewVsn is installed with option - {update_paths,true}, then - kernel:code:lib_dir(myapp) - returns /home/user/myapp-1.0.

    -
    +=> {ok,NewVsn} + +

    If NewVsn is installed with the option + {update_paths,true}, afterwards + code:lib_dir(myapp) will return + /home/user/myapp-1.0.

    -

    Installing a new release can be time consuming if +

    Installing a new release might be quite time consuming if there are many processes in the system. The reason is that each process must be checked for references to old code - before a module can be purged. This check can lead to + before a module can be purged. This check might lead to garbage collections and copying of data.

    -

    To speed up the execution of - install_release, - first call check_install_release, - using option purge. This does the same - check for old code. Then purges all modules that can be - soft-purged. The purged modules do then no longer have any - old code, and - install_release - does not need to do the +

    If you wish to speed up the execution of + install_release, then you may call check_install_release + first, using the option purge. This will do the same + check for old code, and then purge all modules that can be + soft purged. The purged modules will then no longer have any + old code, and install_release will not need to do the checks.

    -

    This does not reduce the overall time for the - upgrade, but it allows checks and purge to be executed +

    Obviously, this will not reduce the overall time for the + upgrade, but it will allow checks and purge to be executed in the background before the real upgrade is started.

    When upgrading the emulator from a version older than OTP - R15, an attempt is made to load new application beam - code into the old emulator. Sometimes the new beam - format cannot be read by the old emulator, so the code - loading fails and the complete upgrade is terminated. To - overcome this problem, the new application code is to be - compiled with the old emulator. For more information about - emulator upgrade from pre OTP R15 versions, see - Design - Principles in System Documentation.

    + R15, there will be an attempt to load new application beam + code into the old emulator. In some cases, the new beam + format can not be read by the old emulator, and so the code + loading will fail and terminate the complete upgrade. To + overcome this problem, the new application code should be + compiled with the old emulator. See Design + Principles for more information about emulator + upgrade from pre OTP R15 versions.

    - make_permanent(Vsn) -> ok | {error, Reason} - Makes the specified release version permanent. + Make the specified release version permanent. Vsn = string() Reason = {bad_status, Status} | term() -

    Makes the specified release version Vsn +

    Makes the specified version Vsn of the release permanent.

    - remove_release(Vsn) -> ok | {error, Reason} - Removes a release from the system. + Remove a release from the system. Vsn = string() Reason = {permanent, Vsn} | client_node | term() @@ -406,26 +374,23 @@ The release must not be the permanent release. Removes only the files and directories not in use by another release.

    -
    reboot_old_release(Vsn) -> ok | {error, Reason} - Reboots the system from an old release. + Reboot the system from an old release. Vsn = string() Reason = {bad_status, Status} | term()

    Reboots the system by making the old release permanent, and - calls - init:reboot() - directly. The release must have status old.

    + calls init:reboot() directly. The release must have + status old.

    - set_removed(Vsn) -> ok | {error, Reason} - Marks a release as removed. + Mark a release as removed. Vsn = string() Reason = {permanent, Vsn} | term() @@ -437,10 +402,9 @@ not delete any files.

    - set_unpacked(RelFile, AppDirs) -> {ok, Vsn} | {error, Reason} - Marks a release as unpacked. + Mark a release as unpacked. RelFile = string() AppDirs = [{App, Vsn, Dir}] @@ -454,19 +418,18 @@ the release is unpacked. Vsn is extracted from the release resource file RelFile.

    AppDirs can be used to specify from where the modules - for the specified applications are to be loaded. App is + for the specified applications should be loaded. App is the name of an application, Vsn is the version, and Dir is the name of the directory where App-Vsn - is located. The corresponding modules are to be located under + is located. The corresponding modules should be located under Dir/App-Vsn/ebin. The directories for applications not specified in AppDirs are assumed to be located in $ROOT/lib.

    - unpack_release(Name) -> {ok, Vsn} | {error, Reason} - Unpacks a release package. + Unpack a release package. Name = Vsn = string() Reason = client_node | term() @@ -474,15 +437,14 @@

    Unpacks a release package Name.tar.gz located in the releases directory.

    -

    Performs some checks on the package, for example, checks - that all mandatory files are present, and extracts its +

    Performs some checks on the package - for example checks + that all mandatory files are present - and extracts its contents.

    - which_releases() -> [{Name, Vsn, Apps, Status}] - Returns all known releases. + Return all known releases Name = Vsn = string() Apps = ["App-Vsn"] @@ -492,18 +454,16 @@

    Returns all releases known to the release handler.

    - which_releases(Status) -> [{Name, Vsn, Apps, Status}] - Returns all known releases of a specific status. + Return all known releases of a specific status Name = Vsn = string() Apps = ["App-Vsn"] Status = unpacked | current | permanent | old -

    Returns all releases, known to the release handler, of a - specific status.

    +

    Returns all releases known to the release handler of a specific status.

    @@ -512,8 +472,7 @@ Application Upgrade/Downgrade

    The following functions can be used to test upgrade and downgrade of single applications (instead of upgrading/downgrading an entire - release). A script corresponding to the instructions in the - relup file is created + release). A script corresponding to relup is created on-the-fly, based on the .appup file for the application, and evaluated exactly in the same way as release_handler does.

    @@ -522,22 +481,20 @@ of .appup files. They are not run within the context of the release_handler process. They must therefore not be used together with calls to - install_release/1,2, - as this causes the + install_release/1,2, as this will cause release_handler to end up in an inconsistent state.

    -

    No persistent information is updated, so these functions can +

    No persistent information is updated, why these functions can be used on any Erlang node, embedded or not. Also, using these - functions does not affect which code is loaded if there is + functions does not affect which code will be loaded in case of a reboot.

    -

    If the upgrade or downgrade fails, the application can end up +

    If the upgrade or downgrade fails, the application may end up in an inconsistent state.

    - upgrade_app(App, Dir) -> {ok, Unpurged} | restart_emulator | {error, Reason} - Upgrades to a new application version. + Upgrade to a new application version App = atom() Dir = string() @@ -548,46 +505,39 @@

    Upgrades an application App from the current version to a new version located in Dir according to - the .appup file.

    + the .appup script.

    App is the name of the application, which must be started. Dir is the new library directory of - App. The corresponding modules as well as - the .app and .appup files are to be located + App, the corresponding modules as well as + the .app and .appup files should be located under Dir/ebin.

    The function looks in the .appup file and tries to find an upgrade script from the current version of the application using - upgrade_script/2. + upgrade_script/2. This script is evaluated using - eval_appup_script/4, + eval_appup_script/4, exactly in the same way as - install_release/1,2 + install_release/1,2 does.

    -

    Returns one of the following:

    - - {ok, Unpurged} if evaluating the script is - successful, where Unpurged is a list of unpurged - modules - restart_emulator if this instruction is - encountered in the script - {error, Reason} if an error occurred when - finding or evaluating the script - +

    Returns {ok, Unpurged} if evaluating the script is + successful, where Unpurged is a list of unpurged + modules, or restart_emulator if this instruction is + encountered in the script, or {error, Reason} if + an error occurred when finding or evaluating the script.

    If the restart_new_emulator instruction is found in - the script, - upgrade_app/2 - returns {error,restart_new_emulator}. This because - restart_new_emulator requires a new version of the - emulator to be started before the rest of the upgrade - instructions can be executed, and this can only be done by - install_release/1,2.

    + the script, upgrade_app/2 will return + {error,restart_new_emulator}. The reason for this is + that this instruction requires that a new version of the + emulator is started before the rest of the upgrade + instructions can be executed, and this can only be done by + install_release/1,2.

    - downgrade_app(App, Dir) -> downgrade_app(App, OldVsn, Dir) -> {ok, Unpurged} | restart_emulator | {error, Reason} - Downgrades to a previous application version. + Downgrade to a previous application version App = atom() Dir = OldVsn = string() @@ -598,124 +548,110 @@

    Downgrades an application App from the current version to a previous version OldVsn located in - Dir according to the .appup file.

    + Dir according to the .appup script.

    App is the name of the application, which must be - started. OldVsn is the previous application version - and can be omitted if Dir is of + started. OldVsn is the previous version of + the application and can be omitted if Dir is of the format "App-OldVsn". Dir is the library - directory of the previous version of App. - The corresponding modules and the old .app file - are to be located under Dir/ebin. The .appup - file is to be located in the ebin directory of + directory of this previous version of App, + the corresponding modules as well as the old .app file + should be located under Dir/ebin. The .appup + file should be located in the ebin directory of the current library directory of the application - (code:lib_dir(App)).

    + (code:lib_dir(App)).

    The function looks in the .appup file and tries to - find a downgrade script to the previous version of + find an downgrade script to the previous version of the application using - downgrade_script/3. + downgrade_script/3. This script is evaluated using - eval_appup_script/4, + eval_appup_script/4, exactly in the same way as - install_release/1,2 + install_release/1,2 does.

    -

    Returns one of the following:

    - - {ok, Unpurged} if evaluating the script is - successful, where Unpurged is a list of unpurged - modules - restart_emulator if this instruction is - encountered in the script - {error, Reason} if an error occurred when - finding or evaluating the script - +

    Returns {ok, Unpurged} if evaluating the script is + successful, where Unpurged is a list of unpurged + modules, or restart_emulator if this instruction is + encountered in the script, or {error, Reason} if + an error occurred when finding or evaluating the script.

    - upgrade_script(App, Dir) -> {ok, NewVsn, Script} - Finds an application upgrade script. + Find an application upgrade script App = atom() Dir = string() NewVsn = string() - Script = Instructions + Script = Instructions -- see appup(4)

    Tries to find an application upgrade script for App from the current version to a new version located in Dir.

    The upgrade script can then be evaluated using - eval_appup_script/4. + eval_appup_script/4. It is recommended to use - upgrade_app/2 - instead, but this function (upgrade_script) is useful - to inspect the contents of the script.

    + upgrade_app/2 + instead, but this function is useful in order to inspect + the contents of the script.

    App is the name of the application, which must be started. Dir is the new library directory of - App. The corresponding modules as well as - the .app and .appup files are to be located + App, the corresponding modules as well as + the .app and .appup files should be located under Dir/ebin.

    The function looks in the .appup file and tries to - find an upgrade script from the current application version. - High-level instructions are translated to - low-level instructions. The instructions are sorted in - the same manner as when generating a relup file.

    + find an upgrade script from the current version of + the application. High-level instructions are translated to + low-level instructions and the instructions are sorted in + the same manner as when generating a relup script.

    Returns {ok, NewVsn, Script} if successful, where - NewVsn is the new application version. - For details about Script, see - appup(4).

    + NewVsn is the new application version.

    Failure: If a script cannot be found, the function fails with an appropriate error reason.

    - downgrade_script(App, OldVsn, Dir) -> {ok, Script} - Finds an application downgrade script. + Find an application downgrade script App = atom() OldVsn = Dir = string() - Script = Instructions + Script = Instructions -- see appup(4)

    Tries to find an application downgrade script for App from the current version to a previous version OldVsn located in Dir.

    The downgrade script can then be evaluated using - eval_appup_script/4. + eval_appup_script/4. It is recommended to use - downgrade_app/2,3 - instead, but this function (downgrade_script) is useful - to inspect the contents of the script.

    + downgrade_app/2,3 + instead, but this function is useful in order to inspect + the contents of the script.

    App is the name of the application, which must be started. Dir is the previous library directory of - App. The corresponding modules and - the old .app file are to be located under - Dir/ebin. The .appup file is to be located in + App, the corresponding modules as well as + the old .app file should be located under + Dir/ebin. The .appup file should be located in the ebin directory of the current library - directory of the application - (code:lib_dir(App)).

    + directory of the application (code:lib_dir(App)).

    The function looks in the .appup file and tries to - find a downgrade script from the current application version. - High-level instructions are translated to - low-level instructions. The instructions are sorted in - the same manner as when generating a relup file.

    -

    Returns {ok, Script} if successful. - For details about Script, see - appup(4).

    + find an downgrade script from the current version of + the application. High-level instructions are translated to + low-level instructions and the instructions are sorted in + the same manner as when generating a relup script.

    +

    Returns {ok, Script} if successful.

    Failure: If a script cannot be found, the function fails with an appropriate error reason.

    - eval_appup_script(App, ToVsn, ToDir, Script) -> {ok, Unpurged} | restart_emulator | {error, Reason} - Evaluates an application upgrade or downgrade script. + Evaluate an application upgrade or downgrade script App = atom() ToVsn = ToDir = string() - Script - See upgrade_script/2, downgrade_script/3 + Script -- see upgrade_script/2, downgrade_script/3 Unpurged = [Module]  Module = atom() Reason = term() @@ -723,100 +659,114 @@

    Evaluates an application upgrade or downgrade script Script, the result from calling - upgrade_script/2 or - downgrade_script/3, + upgrade_script/2 or + downgrade_script/3, exactly in the same way as - install_release/1,2 + install_release/1,2 does.

    App is the name of the application, which must be started. ToVsn is the version to be upgraded/downgraded to, and ToDir is the library directory of this version. The corresponding modules as well as the .app and - .appup files are to be located under Dir/ebin.

    -

    Returns one of the following:

    - - {ok, Unpurged} if evaluating the script is - successful, where Unpurged is a list of unpurged - modules - restart_emulator if this instruction is - encountered in the script - {error, Reason} if an error occurred when - finding or evaluating the script - -

    If the restart_new_emulator instruction is found in - the script, - eval_appup_script/4 - returns {error,restart_new_emulator}. This because - restart_new_emulator requires a new version of the - emulator to be started before the rest of the upgrade - instructions can be executed, and this can only be done by - install_release/1,2.

    + .appup files should be located under Dir/ebin.

    +

    Returns {ok, Unpurged} if evaluating the script is + successful, where Unpurged is a list of unpurged + modules, or restart_emulator if this instruction is + encountered in the script, or {error, Reason} if + an error occurred when evaluating the script.

    +

    If the restart_new_emulator instruction is found in + the script, eval_appup_script/4 will return + {error,restart_new_emulator}. The reason for this is + that this instruction requires that a new version of the + emulator is started before the rest of the upgrade + instructions can be executed, and this can only be done by + install_release/1,2.

    Typical Error Reasons - - {bad_masters, Masters} -

    The master nodes Masters are not alive.

    - {bad_rel_file, File} -

    Specified .rel file File cannot be read or - does not contain a single term.

    - {bad_rel_data, Data} -

    Specified .rel file does not contain a recognized - release specification, but another term Data.

    - {bad_relup_file, File} -

    Specified relup file Relup contains bad - data.

    - {cannot_extract_file, Name, Reason} -

    Problems when extracting from a tar file, - erl_tar:extract/2 - returned {error, {Name, Reason}}.

    - {existing_release, Vsn} -

    Specified release version Vsn is already - in use.

    - {Master, Reason, When} -

    Some operation, indicated by the term When, failed - on the master node Master with the specified error - reason Reason.

    - {no_matching_relup, Vsn, CurrentVsn} -

    Cannot find a script for upgrading/downgrading between - CurrentVsn and Vsn.

    - {no_such_directory, Path} -

    The directory Pathdoes not exist.

    - {no_such_file, Path} -

    The path Path (file or directory) does not - exist.

    - {no_such_file, {Master, Path}} -

    The path Path (file or directory) does not exist at - the master node Master.

    - {no_such_release, Vsn} -

    The specified release version Vsn does not - exist.

    - {not_a_directory, Path} -

    Path exists but is not a directory.

    - {Posix, File} -

    Some file operation failed for File. Posix - is an atom named from the Posix error codes, such as - enoent, eacces, or eisdir. See - file(3) - in Kernel.

    - Posix -

    Some file operation failed, as for the previous item in - the list.

    -
    + + +

    {bad_masters, Masters} - The master nodes + Masters are not alive.

    +
    + +

    {bad_rel_file, File} - Specified .rel file + File can not be read, or does not contain a single + term.

    +
    + +

    {bad_rel_data, Data} - Specified .rel file + does not contain a recognized release specification, but + another term Data.

    +
    + +

    {bad_relup_file, File} - Specified relup file + Relup contains bad data.

    +
    + +

    {cannot_extract_file, Name, Reason} - Problems when + extracting from a tar file, erl_tar:extract/2 returned + {error, {Name, Reason}}.

    +
    + +

    {existing_release, Vsn} - Specified release version + Vsn is already in use.

    +
    + +

    {Master, Reason, When} - Some operation, indicated by + the term When, failed on the master node Master + with the specified error reason Reason.

    +
    + +

    {no_matching_relup, Vsn, CurrentVsn} - Cannot find a + script for up/downgrading between CurrentVsn and + Vsn.

    +
    + +

    {no_such_directory, Path} - The directory Path + does not exist.

    +
    + +

    {no_such_file, Path} - The path Path (file or + directory) does not exist.

    +
    + +

    {no_such_file, {Master, Path}} - The path Path + (file or directory) does not exist at the master node + Master.

    +
    + +

    {no_such_release, Vsn} - The specified version + Vsn of the release does not exist.

    +
    + +

    {not_a_directory, Path} - Path exists, but is + not a directory.

    +
    + +

    {Posix, File} - Some file operation failed for + File. Posix is an atom named from the Posix + error codes, such as enoent, eacces or + eisdir. See file(3).

    +
    + +

    Posix - Some file operation failed, as above.

    +
    +
    - See Also -

    OTP Design Principles, - config(4), - rel(4), - relup(4), - script(4), - sys(3), - systools(3)

    + SEE ALSO +

    OTP Design Principles, + config(4), + relup(4), + rel(4), + script(4), + sys(3), + systools(3)

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/relup.xml erlang-17.3-dfsg/lib/sasl/doc/src/relup.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/relup.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/relup.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -36,53 +35,59 @@

    The release upgrade file describes how a release is upgraded in a running system.

    This file is automatically generated by - systools:make_relup/3,4, - using a release resource file - (.rel), application resource files (.app), and + systools:make_relup/3,4, using a release resource file + (.rel), application resource files (.app) and application upgrade files (.appup) as input.

    - File Syntax -

    In a target system, the release upgrade file is to be located in - directory $ROOT/releases/Vsn.

    + FILE SYNTAX +

    In a target system, the release upgrade file should be located in + the OTP_ROOT/erts-EVsn/Vsn directory.

    The relup file contains one single Erlang term, which defines the instructions used to upgrade the release. The file has the following syntax:

    {Vsn, [{UpFromVsn, Descr, Instructions}, ...], - [{DownToVsn, Descr, Instructions}, ...]}. - - Vsn = string() -

    Current release version.

    - UpFromVsn = string() -

    Earlier version of the release to upgrade from.

    - Descr = term() -

    A user-defined parameter passed - from the function - systools:make_relup/3,4. - It is used in the return value of - release_handler:install_release/1,2.

    - Instructions -

    A list of low-level release upgrade instructions, see - appup(4). - It consists of the release upgrade instructions from + [{DownToVsn, Descr, Instructions}, ...]}. + + + +

    Vsn = string() is the current version of the release.

    +
    + +

    UpFromVsn = string() is an earlier version of the release + to upgrade from.

    +
    + +

    Descr = term() is a user defined parameter passed + from the systools:make_relup/3,4 function. It will + be used in the return value of + release_handler:install_release/1,2.

    +
    + +

    Instructions is a list of low-level release upgrade + instructions, see appup(4).

    +

    It consists of the release upgrade instructions from the respective application upgrade files (high-level instructions are translated to low-level instructions), in the same order - as in the start script.

    - DownToVsn = string() -

    Earlier version of the release to downgrade to.

    -
    + as in the start script.

    + + +

    DownToVsn = string() is an earlier version of the release + to downgrade to.

    +
    + +

    When upgrading from UpFromVsn with + release_handler:install_release/1,2, there does not have to be + an exact match of versions, but UpFromVsn can be a sub-string + of the current release version.

    - See Also -

    app(4), - appup(4), - rel(4), - release_handler(3), - systools(3)

    + SEE ALSO +

    app(4), appup(4), rel(4), release_handler(3), systools(3)

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/rel.xml erlang-17.3-dfsg/lib/sasl/doc/src/rel.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/rel.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/rel.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -33,65 +32,74 @@ rel Release resource file -

    The release resource file specifies which applications +

    The release resource file specifies which applications are are included in a release (system) based on Erlang/OTP.

    -

    This file is used by the functions in - systools - when generating start scripts (.script, .boot) and - release upgrade files (relup).

    +

    This file is used by the functions in systools when generating + start scripts (.script, .boot) and release upgrade + files (relup).

    - File Syntax -

    The release resource file is to be called Name.rel.

    + FILE SYNTAX +

    The release resource file should be called Name.rel.

    The .rel file contains one single Erlang term, which is - called a release specification. The file has the + called a release specification. The file has the following syntax:

    {release, {RelName,Vsn}, {erts, EVsn}, [{Application, AppVsn} | {Application, AppVsn, Type} | {Application, AppVsn, IncApps} | - {Application, AppVsn, Type, IncApps}]}. - - RelName = string() -

    Release name.

    - Vsn = string() -

    Release version.

    - EVsn = string() -

    ERTS version the release is intended for.

    - Application = atom() -

    Name of an application included in the release.

    - AppVsn = string() -

    Version of an application included in the release.

    - Type = permanent | transient | temporary | load | none -

    Start type of an application included in the release.

    -

    If Type = permanent | transient | temporary, the - application is loaded and started in the corresponding way, see - application(3).

    -

    If Type = load, the application is only loaded.

    -

    If Type = none, the application is not loaded and not - started, although the code for its modules is loaded.

    -

    Defaults to permanent

    - IncApps = [atom()] -

    A list of applications that are included by an application - included in the release. The list must be a subset of the - included applications + {Application, AppVsn, Type, IncApps}]}. + + + +

    RelName = string() is the name of the release.

    +
    + +

    Vsn = string() is the version of the release.

    +
    + +

    EVsn = string() is the version of ERTS the release is + intended for.

    +
    + +

    Application = atom() is the name of an application + included in the release.

    +
    + +

    AppVsn = string() is the version of an application + included in the release.

    +
    + +

    Type = permanent | transient | temporary | load | none + is the start type of an application included in the release.

    +

    If Type = permanent | transient | temporary, + the application will be loaded and started in the corresponding + way, see application(3). If Type = load, + the application will only be loaded. If Type = none, + the application will be neither loaded nor started, although + the code for its modules will be loaded. + Defaults to permanent

    +
    + +

    IncApps = [atom()] is a list of applications that are + included by an application included in the release.

    +

    The list must be a subset of the included applications specified in the application resource file (Application.app) and overrides this value. Defaults - to the same value as in the application resource file.

    -
    + to the same value as in the application resource file.

    + + -

    The list of applications must contain the Kernel and - STDLIB applications.

    +

    The list of applications must contain the kernel and + stdlib applications.

    - See Also -

    application(3), - relup(4), - systools(3)

    + SEE ALSO +

    application(3), relup(4), systools(3)

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/sasl_app.xml erlang-17.3-dfsg/lib/sasl/doc/src/sasl_app.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/sasl_app.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/sasl_app.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -27,11 +26,12 @@ - - sasl - The SASL application - -

    The SASL application provides the following services:

    + + sasl + The SASL Application + +

    This section describes the SASL (System Architecture Support Libraries) + application which provides the following services:

    alarm_handler overload @@ -39,147 +39,123 @@ release_handler systools -

    The SASL application also includes error_logger event - handlers for formatting SASL error and crash reports.

    +

    The SASL application also includes error_logger event + handlers for formatting SASL error and crash reports.

    + -

    The SASL application in OTP has nothing to do with +

    The SASL application in OTP has nothing to do with "Simple Authentication and Security Layer" (RFC 4422).

    +
    Error Logger Event Handlers

    The following error logger event handlers are used by - the SASL application.

    + the SASL application.

    sasl_report_tty_h -

    Formats and writes supervisor reports, crash - reports, and progress reports to stdio. - This error logger event handler uses - error_logger_format_depth - in the Kernel application to limit how much detail is - printed in crash and supervisor reports.

    +

    Formats and writes supervisor reports, crash reports and progress reports to stdio.

    sasl_report_file_h -

    Formats and writes supervisor reports, crash - report, and progress report to a single file. - This error logger event handler uses - error_logger_format_depth - in the Kernel application to limit the details - printed in crash and supervisor reports.

    +

    Formats and writes supervisor reports, crash report and progress report to a single file.

    log_mf_h -

    This error logger writes all events sent to the - error logger to disk. Multiple files and log rotation are - used. For efficiency reasons, each event is written as a - binary. For more information about this handler, - see the STDLIB Reference - Manual.

    -

    To activate this event handler, three SASL - configuration parameters must be set, - error_logger_mf_dir, error_logger_mf_maxbytes, - and error_logger_mf_maxfiles. The next section provides - more information about the configuration parameters.

    +

    This error logger writes all events sent to + the error logger to disk.

    +

    To activate this event handler, the following three sasl + configuration parameters must be set: + error_logger_mf_dir, error_logger_mf_maxbytes + and error_logger_mf_maxfiles. See below for more + information about the configuration parameters.

    Configuration -

    The following configuration parameters are defined for the SASL - application. For more information about configuration parameters, see - app(4) in Kernel.

    -

    All configuration parameters are optional.

    +

    The following configuration parameters are defined for the SASL + application. See app(4) for more information about + configuration parameters:

    - + ]]> -

    Value is one of the following:

    +

    Value is one of:

    tty -

    Installs sasl_report_tty_h in the error logger. - This is the default option.

    + Installs sasl_report_tty_h in the error logger. + This is the default option. {file,FileName} -

    Installs sasl_report_file_h in the error logger. - All reports go to file FileName, which is a - string.

    - {file,FileName,Modes} -

    Same as {file,FileName}, except that Modes - allows you to specify the modes used for opening the FileName - given to the file:open/2 - call. When not specified, Modes defaults to [write]. - Use [append] to have the FileName open in append mode. - FileName is a string.

    + Installs sasl_report_file_h in the error logger. + This makes all reports go to the file FileName. + FileName is a string. false -

    No SASL error logger handler is installed.

    + +

    No SASL error logger handler is installed.

    +
    - + ]]>

    Restricts the error logging performed by the specified - sasl_error_logger to error reports or progress reports, + sasl_error_logger to error reports, progress reports, or both. Default is all.

    - + ]]> -

    Specifies in which directory log_mf_h is to store - its files. If this parameter is undefined or false, +

    Specifies in which directory the files are stored. If this + parameter is undefined or false, the log_mf_h handler is not installed.

    - + ]]> -

    Specifies the maximum size of each individual file written - by log_mf_h. If this parameter is undefined, - the log_mf_h handler is not installed.

    +

    Specifies how large each individual file can be. If this + parameter is undefined, the log_mf_h handler is not + installed.

    - + ]]> -

    Specifies the number of files used by log_mf_h. If - this parameter is undefined, the log_mf_h handler is - not installed.

    +

    Specifies how many files are used. If this parameter is + undefined, the log_mf_h handler is not installed.

    - 0 ]]> + 0 ]]> -

    Specifies the maximum intensity - for overload. Default +

    Specifies the maximum intensity for overload. Default is 0.8.

    - 0 ]]> + 0 ]]> -

    Specifies the overload - weight. Default is 0.1.

    +

    Specifies the overload weight. Default is 0.1.

    - + ]]> -

    Specifies the program to be used when restarting the system - during release installation. Default is - $OTP_ROOT/bin/start.

    +

    Specifies which program should be used when restarting + the system. Default is $OTP_ROOT/bin/start.

    - + ]]> -

    Specifies the nodes used by this node to read/write release - information. This parameter is ignored if parameter - client_directory is not set.

    +

    Specifies which nodes this node uses to read/write release + information. This parameter is ignored if + the client_directory parameter is not set.

    - + ]]>

    This parameter specifies the client directory at the master - nodes. For details, see - Release Handling - in OTP Design Principles. This parameter is - ignored if parameter masters is not set.

    + nodes. Refer to Release Handling in OTP Design Principles for more information. This parameter is + ignored if the masters parameter is not set.

    - + ]]>

    Indicates if the Erlang emulator is statically installed. A node with a static emulator cannot switch dynamically to a - new emulator, as the executable files are written into memory - statically. This parameter is ignored if parameters masters - and client_directory are not set.

    + new emulator as the executable files are written into memory + statically. This parameter is ignored if the masters + and client_directory parameters are not set.

    - + ]]>

    Indicates where the releases directory is located. The release handler writes all its files to this directory. @@ -187,7 +163,7 @@ RELDIR is used. By default, this is $OTP_ROOT/releases.

    - + ]]>

    If set to true, all dates in textual log outputs are displayed in Universal Coordinated Time with the string @@ -198,13 +174,13 @@

    See Also -

    alarm_handler(3), - error_logger(3), - log_mf_h(3), - overload(3), - rb(3), - release_handler(3), - systools(3)

    +

    alarm_handler(3), + error_logger(3), + log_mf_h(3), + overload(3), + rb(3), + release_handler(3), + systools(3)

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/sasl_intro.xml erlang-17.3-dfsg/lib/sasl/doc/src/sasl_intro.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/sasl_intro.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/sasl_intro.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,32 +30,22 @@
    - Scope -

    The SASL application provides support for:

    + About This Document +

    The SASL (System Architecture Support Libraries) + application provides support for:

    - Error logging - Alarm handling - Overload regulation - Release handling - Report browsing + error logging + alarm handling + overload regulation + release handling + report browsing. -

    Section - SASL Error Logging - describes the error - handler that produces the supervisor, progress, and crash - reports, which can be written to screen or to a specified file. - It also describes the Report Browser (RB).

    -

    The sections about release structure and release handling have - been moved to section - OTP Design Principles - in System Documentation.

    -
    - -
    - Prerequisites -

    It is assumed that the reader is familiar with the Erlang - programming language.

    +

    In this document, "SASL Error Logging" describes the error + handler which produces the supervisor, progress, and crash + reports which can be written to screen, or to a specified file. + It also describes the report browser rb.

    +

    The chapters about release structure and release handling have + been moved to OTP Design Principles.

    - diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/script.xml erlang-17.3-dfsg/lib/sasl/doc/src/script.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/script.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/script.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -37,21 +36,25 @@ script Boot script -

    The boot script describes how the Erlang runtime system - is started. It contains instructions on which code to load and - which processes and applications to start.

    -

    Command erl -boot Name starts the system with a boot +

    The boot script describes how the Erlang runtime system is + started. It contains instructions on which code to load and + which processes and applications to start. +

    +

    The command erl -boot Name starts the system with a boot file called Name.boot, which is generated from the - Name.script file, using - systools:script2boot/1.

    + Name.script file, using systools:script2boot/1. +

    The .script file is generated by systools from a - .rel file and from .app files.

    + .rel file and .app files. +

    - File Syntax -

    The boot script is stored in a file with extension - .script. The file has the following syntax:

    + FILE SYNTAX +

    The boot script is stored in a file with the extension + .script

    +

    The file has the following syntax: +

    {script, {Name, Vsn}, [ @@ -66,97 +69,100 @@ ... {apply, {Mod, Func, Args}}, ... - {progress, started}]}. - - Name = string() -

    Defines the system name.

    - Vsn = string() -

    Defines the system version.

    - {progress, Term} -

    Sets the "progress" of the initialization - program. The - init:get_status/0 - function returns the current value of the progress, which is - {InternalStatus,Term}.

    - {path, [Dir]} -

    Dir is a string. This + {progress, started}]}. + + Name = string() defines the name of the system. + + Vsn = string() defines the version of the system. + + {progress, Term} sets the "progress" of the + initialization program. The function init:get_status() + returns the current value of the progress, which is + {InternalStatus,Term}. + + +

    {path, [Dir]} where Dir is a string. This argument sets the load path of the system to [Dir]. The load path used to load modules is obtained from the initial load path, which is given in the script file, together with - any path flags that were supplied in the command-line - arguments. The command-line arguments modify the path as + any path flags which were supplied in the command line + arguments. The command line arguments modify the path as follows:

    -pa Dir1 Dir2 ... DirN adds the directories Dir1, Dir2, ..., DirN to the front of the initial - load path. + load path. +
    -pz Dir1 Dir2 ... DirN adds the directories Dir1, Dir2, ..., DirN to the end of the initial - load path. + load path. +

    -path Dir1 Dir2 ... DirN defines a set of - directories Dir1, Dir2, ..., DirN, which replace + directories Dir1, Dir2, ..., DirN which replaces the search path given in the script file. Directory names in the path are interpreted as follows:

    Directory names starting with / are assumed - to be absolute path names. + to be absolute path names. +
    Directory names not starting with / are - assumed to be relative the current working directory. + assumed to be relative the current working directory. + The special $ROOT variable can only be used - in the script, not as a command-line argument. The + in the script, not as a command line argument. The given directory is relative the Erlang installation - directory. + directory. + - - {primLoad, [Mod]} -

    Loads the modules [Mod] - from the directories specified in Path. The script - interpreter fetches the appropriate module by calling - - erl_prim_loader:get_file(Mod). A fatal error - that terminates the system occurs if the module cannot be - located.

    - {kernel_load_completed} -

    Indicates that all modules - that must be loaded before any processes - are started are loaded. In interactive mode, all - {primLoad,[Mod]} commands interpreted after this - command are ignored, and these modules are loaded on demand. - In embedded mode, kernel_load_completed is ignored, and - all modules are loaded during system start.

    - {kernelProcess, Name, {Mod, Func, Args}} -

    Starts the - "kernel process" Name - by evaluating apply(Mod, Func, Args). The start function is - to return {ok, Pid} or ignore. The init - process monitors the behavior of Pid and terminates - the system if Pid dies. Kernel processes are key - components of the runtime system. Users do not normally add - new kernel processes.

    - {apply, {Mod, Func, Args}}. -

    The init process - evaluates apply(Mod, Func, Args). The system - terminates if this results in an error. The boot procedure - hangs if this function never returns.

    -
    + + {primLoad, [Mod]} loads the modules [Mod] + from the directories specified in Path. The script + interpreter fetches the appropriate module by calling the + function erl_prim_loader:get_file(Mod). A fatal error + which terminates the system will occur if the module cannot be + located. + + {kernel_load_completed} indicates that all modules + which must be loaded before any processes + are started are loaded. In interactive mode, all + {primLoad,[Mod]} commands interpreted after this + command are ignored, and these modules are loaded on demand. + In embedded mode, kernel_load_completed is ignored, and + all modules are loaded during system start. + + {kernelProcess, Name, {Mod, Func, Args}} starts a + "kernel process". The kernel process Name is started + by evaluating apply(Mod, Func, Args) which is expected + to return {ok, Pid} or ignore. The init + process monitors the behaviour of Pid and terminates + the system if Pid dies. Kernel processes are key + components of the runtime system. Users do not normally add + new kernel processes. + + {apply, {Mod, Func, Args}}. The init process simply + evaluates apply(Mod, Func, Args). The system + terminates if this results in an error. The boot procedure + hangs if this function never returns. + + -

    In an interactive system, the code loader provides - demand-driven code loading, but in an embedded system - the code loader loads all code immediately. The same - version of code - is used in both cases. The code server calls - init:get_argument(mode) - to determine if it is to run in demand mode or non-demand - driven mode.

    +

    In the interactive system the code loader provides + demand driven code loading, but in the embedded system + the code loader loads all the code immediately. The same + version of code is used in both cases. The code server + calls init:get_argument(mode) to find out if it should + run in demand mode, or non-demand driven mode. +

    - See Also -

    systools(3)

    + SEE ALSO +

    systools(3) +

    diff -Nru erlang-18.2-dfsg/lib/sasl/doc/src/systools.xml erlang-17.3-dfsg/lib/sasl/doc/src/systools.xml --- erlang-18.2-dfsg/lib/sasl/doc/src/systools.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/doc/src/systools.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -31,18 +30,17 @@ systools - A Set of Release Handling Tools + A Set of Release Handling Tools.

    This module contains functions to generate boot scripts - (.boot, .script), a release upgrade file + (.boot, .script), release upgrade scripts (relup), and release packages.

    - make_relup(Name, UpFrom, DownTo) -> Result make_relup(Name, UpFrom, DownTo, [Opt]) -> Result - Generates a release upgrade file relup. + Generate a release upgrade file relup. Name = string() UpFrom = DownTo = [Name | {Name,Descr}] @@ -51,94 +49,93 @@ | warnings_as_errors  Dir = string() Result = ok | error | {ok,Relup,Module,Warnings} | {error,Module,Error} -  Relup, see relup(4) +  Relup - see relup(4)  Module = atom()  Warnings = Error = term() -

    Generates a release upgrade file relup containing instructions - for upgrading from or downgrading to one or more previous releases. - The instructions are used by - release_handler - when installing a new version of a release in runtime.

    -

    By default, relup file is located in the current working - directory. If option {outdir,Dir} is specified, - the relup file is located in Dir instead.

    +

    Generates a release upgrade file relup containing a + script which describes how to upgrade the system from a number + of previous releases, and how to downgrade to a number of + previous releases. The script is used by + release_handler when installing a new version of a + release in run-time.

    +

    By default, relup is placed in the current working + directory. If the option {outdir,Dir} is provided, + relup is placed in Dir instead.

    The release resource file Name.rel is compared with - all release resource files Name2.rel, specified in - UpFrom and DownTo. For each such pair, the - following is deducted:

    + all release resource files Name2.rel specified in + UpFrom and DownTo. For each such pair, it is + deducted:

    -

    Which applications to be deleted, that is, - applications listed in Name.rel but not - in Name2.rel

    +

    Which applications should be deleted, that is + applications which are listed in Name.rel but not + in Name2.rel.

    -

    Which applications to be added, that is, applications - listed in Name2.rel but not in Name.rel

    +

    Which applications should be added, that is applications + which are listed in Name2.rel but not in + Name.rel.

    -

    Which applications to be upgraded/downgraded, that - is, applications listed in both Name.rel and - Name2.rel but with different versions

    +

    Which applications should be upgraded/downgraded, that + is applications listed in both Name.rel and + Name2.rel, but with different versions.

    If the emulator needs to be restarted after upgrading or - downgrading, that is, if the ERTS version differs - between Name.rel and Name2.rel

    + downgrading, that is if the ERTS version differs between + Name.rel and Name2.rel.

    -

    Instructions for this are added to the relup file in +

    Instructions for this are added to the relup script in the above order. Instructions for upgrading or downgrading between application versions are fetched from the relevant application upgrade files App.appup, sorted in the same order as when generating a boot script, see - make_script/1,2. - High-level instructions are translated - into low-level instructions and the result is printed to the - relup file.

    -

    The optional Descr parameter is included "as is" in - the relup file, see - relup(4). Defaults to + make_script/1,2. High-level instructions are translated + into low-level instructions and the result is printed to + relup.

    +

    The optional Descr parameter is included as-is in + the relup script, see relup(4). Defaults to the empty list.

    All the files are searched for in the code path. It is - assumed that the .app and .appup files for an - application are located in the same directory.

    -

    If option {path,[Dir]} is specified, this path is - appended to the current path. Wildcard * is - expanded to all matching directories, for example, - lib/*/ebin.

    -

    If option restart_emulator is specified, a + assumed that the .app and .appup file for an + application is located in the same directory.

    +

    If the option {path,[Dir]} is provided, this path is + appended to the current path. The wildcard * is + expanded to all matching directories. + Example: lib/*/ebin.

    +

    If the restart_emulator option is supplied, a low-level instruction to restart the emulator is appended to - the relup file. This ensures that a complete reboot of + the relup scripts. This ensures that a complete reboot of the system is done when the system is upgraded or downgraded.

    -

    If an upgrade includes a change from an emulator earlier - than OTP R15 to OTP R15 or later, the warning - pre_R15_emulator_upgrade is issued. For more information - about this, see - Design - Principles in System Documentation.

    +

    If an upgrade includes a change from an emulator earlier + than OTP R15 to OTP R15 or later, the warning + pre_R15_emulator_upgrade is issued. See Design + Principles for more information about this.

    By default, errors and warnings are printed to tty and - the function returns ok or error. If option - silent is specified, the function instead either returns - {ok,Relup,Module,Warnings}, where Relup is - the release upgrade file, or {error,Module,Error}. - Warnings and errors can be converted to strings by calling + the function returns ok or error. If the option + silent is provided, the function instead returns + {ok,Relup,Module,Warnings} where Relup is + the release upgrade script, or it returns + {error,Module,Error}. Warnings and errors can be + converted to strings by calling Module:format_warning(Warnings) or Module:format_error(Error).

    -

    If option noexec is specified, the function returns +

    If the option noexec is provided, the function returns the same values as for silent but no relup file is created.

    -

    If option warnings_as_errors is specified, warnings - are treated as errors.

    +

    If the option warnings_as_errors is provided, warnings + are treated as errors.

    - make_script(Name) -> Result make_script(Name, [Opt]) -> Result - Generates a boot script .script/.boot. + Generate a boot script .script/.boot. Name = string() Opt = src_tests | {path,[Dir]} | local | {variables,[Var]} | exref | @@ -155,117 +152,114 @@

    Generates a boot script Name.script and its binary version, the boot file Name.boot. The boot file - specifies which code to be loaded and which applications - to be started when the Erlang runtime system is started. - See script(4).

    -

    The release resource file Name.rel is read to determine - which applications are included in the release. Then - the relevant application resource files App.app are read - to determine which modules to be loaded, and if and - how the applications are to be started. (Keys modules - and mod, see - app(4).

    -

    By default, the boot script and boot file are located in + specifies which code should be loaded and which applications + should be started when the Erlang runtime system is started. + See script(4).

    +

    The release resource file Name.rel is read to find + out which applications are included in the release. Then + the relevant application resource files App.app are + read to find out which modules should be loaded and if and + how the application should be started. (Keys modules + and mod, see app(4)).

    +

    By default, the boot script and boot file are placed in the same directory as Name.rel. That is, in the current working directory unless Name contains a path. If - option {outdir,Dir} is specified, they are located + the option {outdir,Dir} is provided, they are placed in Dir instead.

    -

    The correctness of each application is checked as follows:

    +

    The correctness of each application is checked:

    The version of an application specified in - the .rel file is to be the same as the version + the .rel file should be the same as the version specified in the .app file.

    -

    There are to be no undefined applications, that is, - dependencies to applications that are not included in - the release. (Key applications in the .app +

    There should be no undefined applications, that is, + dependencies to applications which are not included in + the release. (Key applications in .app file).

    -

    There are to be no circular dependencies among +

    There should be no circular dependencies among the applications.

    -

    There are to be no duplicated modules, that is, modules with +

    There should be no duplicated modules, that is, modules with the same name but belonging to different applications.

    -

    If option src_tests is specified, a +

    If the src_tests option is specified, a warning is issued if the source code for a module is - missing or is newer than the object code.

    + missing or newer than the object code.

    The applications are sorted according to the dependencies between the applications. Where there are no dependencies, the order in the .rel file is kept.

    -

    The function fails if the mandatory - applications Kernel and STDLIB are not - included in the .rel file and have start - type permanent (which is default).

    -

    If SASL is not included as an application in - the .rel file, a warning is issued because such a - release cannot be used in an upgrade. To turn off this - warning, add option no_warn_sasl.

    +

    The function will fail if the mandatory + applications kernel and stdlib are not + included in the .rel file and have start + type permanent (default).

    +

    If sasl is not included as an application in + the .rel file, a warning is emitted because such a + release can not be used in an upgrade. To turn off this + warning, add the option no_warn_sasl.

    All files are searched for in the current path. It is assumed that the .app and .beam files for an - application are located in the same directory. The .erl + application is located in the same directory. The .erl files are also assumed to be located in this directory, unless - it is an ebin directory in which case they can be + it is an ebin directory in which case they may be located in the corresponding src directory.

    -

    If option {path,[Dir]} is specified, this path is +

    If the option {path,[Dir]} is provided, this path is appended to the current path. A directory in the path can be - specified with a wildcard *, this is expanded to all + given with a wildcard *, this is expanded to all matching directories. Example: "lib/*/ebin".

    In the generated boot script all application directories are - structured as App-Vsn/ebin. They are assumed to be located + structured as App-Vsn/ebin and assumed to be located in $ROOT/lib, where $ROOT is the root directory - of the installed release. If option local is - specified, the actual directories where the applications were + of the installed release. If the local option is + supplied, the actual directories where the applications were found are used instead. This is a useful way to test a generated boot script locally.

    -

    Option variables can be used to specify an +

    The variables option can be used to specify an installation directory other than $ROOT/lib for some of the applications. If a variable {VarName,Prefix} is specified and an application is found in a directory - Prefix/Rest/App[-Vsn]/ebin, this application gets + Prefix/Rest/App[-Vsn]/ebin, this application will get the path VarName/Rest/App-Vsn/ebin in the boot script. If an application is found in a directory Prefix/Rest, - the path is VarName/Rest/App-Vsn/ebin. When + the path will be VarName/Rest/App-Vsn/ebin. When starting Erlang, all variables VarName are given - values using command-line flag boot_var.

    -

    Example: If option {variables,[{"TEST","lib"}]} - is specified and myapp.app is found in - lib/myapp/ebin, the path to this application in - the boot script is "$TEST/myapp-1/ebin". If - myapp.app is found in lib/test, the path - is $TEST/test/myapp-1/ebin.

    + values using the boot_var command line flag.

    +

    Example: If the option {variables,[{"TEST","lib"}]} is + supplied, and myapp.app is found in + lib/myapp/ebin, then the path to this application in + the boot script will be "$TEST/myapp-1/ebin". If + myapp.app is found in lib/test, then the path + will be $TEST/test/myapp-1/ebin.

    The checks performed before the boot script is generated can be extended with some cross reference checks by specifying - option exref. These checks are performed with + the exref option. These checks are performed with the Xref tool. All applications, or the applications specified with {exref,[App]}, are checked by Xref and - warnings are issued for calls to undefined functions.

    + warnings are generated for calls to undefined functions.

    By default, errors and warnings are printed to tty and - the function returns ok or error. If option - silent is specified, the function instead returns + the function returns ok or error. If the option + silent is provided, the function instead returns {ok,Module,Warnings} or {error,Module,Error}. Warnings and errors can be converted to strings by calling Module:format_warning(Warnings) or Module:format_error(Error).

    -

    If option warnings_as_errors is specified, warnings - are treated as errors.

    -

    If option no_dot_erlang is specified, the instruction to - load the .erlang file during boot is not - included.

    +

    If the option warnings_as_errors is provided, warnings + are treated as errors.

    +

    If the option no_dot_erlang is provided, the instruction to + load the .erlang file during boot is NOT included.

    - make_tar(Name) -> Result make_tar(Name, [Opt]) -> Result - Creates a release package. + Create a release package. Name = string() Opt = {dirs,[IncDir]} | {path,[Dir]} | {variables,[Var]} | {var_tar,VarTar} | {erts,Dir} | src_tests | exref | {exref,[App]} | silent | {outdir,Dir} @@ -281,91 +275,90 @@  Warning = Error = term() -

    Creates a release package file Name.tar.gz. +

    Creates a release package file Name.tar.gz. file. This file must be uncompressed and unpacked on the target - system using - release_handler - before the new release can be installed.

    -

    The release resource file Name.rel is read to determine + system using the release_handler, before the new + release can be installed.

    +

    The release resource file Name.rel is read to find out which applications are included in the release. Then the relevant application resource files App.app are - read to determine the version and modules of each application - (keys vsn and modules, see - app(4)).

    -

    By default, the release package file is located in the same + read to find out the version and modules of each application. + (Keys vsn and modules, see app(4)).

    +

    By default, the release package file is placed in the same directory as Name.rel. That is, in the current working - directory unless Name contains a path. If option - {outdir,Dir} is specified, it is located in Dir + directory unless Name contains a path. If the option + {outdir,Dir} is provided, it is placed in Dir instead.

    By default, the release package contains the directories lib/App-Vsn/ebin and lib/App-Vsn/priv for each - included application. If more directories are to be included, - option dirs is specified, for example, + included application. If more directories, the option + dirs is supplied. Example: {dirs,[src,examples]}.

    All these files are searched for in the current path. If - option {path,[Dir]} is specified, this path is - appended to the current path. Wildcard * is + the option {path,[Dir]} is provided, this path is + appended to the current path. The wildcard * is expanded to all matching directories. Example: "lib/*/ebin".

    -

    Option variables can be used to specify an +

    The variables option can be used to specify an installation directory other than lib for some of - the applications. If variable {VarName,Prefix} is - specified and an application is found in directory - Prefix/Rest/App[-Vsn]/ebin, this application is + the applications. If a variable {VarName,Prefix} is + specified and an application is found in a directory + Prefix/Rest/App[-Vsn]/ebin, this application will be packed into a separate VarName.tar.gz file as Rest/App-Vsn/ebin.

    -

    Example: If option {variables,[{"TEST","lib"}]} - is specified and myapp.app is located in - lib/myapp-1/ebin, application myapp is +

    Example: If the option {variables,[{"TEST","lib"}]} is + supplied, and myapp.app is found in + lib/myapp-1/ebin, the the application myapp is included in TEST.tar.gz:

     % tar tf TEST.tar
     myapp-1/ebin/myapp.app
    -...
    -

    Option {var_tar,VarTar} can be used to specify if - and where a separate package is to be stored. In this option - VarTar is one of the following:

    - - include -

    Each separate (variable) package is included in the - main ReleaseName.tar.gz file. This is the - default.

    - ownfile -

    Each separate (variable) package is - generated as a separate file in the same directory as - the ReleaseName.tar.gz file.

    - omit -

    No separate (variable) packages are - generated. Applications that are found underneath a - variable directory are ignored.

    -
    -

    A directory releases is also included in +... + +

    The {var_tar,VarTar} option can be used to specify if + and where a separate package should be stored. In this option, + VarTar is:

    + + +

    include. Each separate (variable) package is + included in the main ReleaseName.tar.gz file. This + is the default.

    +
    + +

    ownfile. Each separate (variable) package is + generated as separate files in the same directory as + the ReleaseName.tar.gz file.

    +
    + +

    omit. No separate (variable) packages are + generated and applications which are found underneath a + variable directory are ignored.

    +
    +
    +

    A directory called releases is also included in the release package, containing Name.rel and a - subdirectory RelVsn. RelVsn is + subdirectory called RelVsn. RelVsn is the release version as specified in Name.rel.

    releases/RelVsn contains the boot script Name.boot renamed to start.boot and, if found, the files relup and sys.config. These files are searched for in the same directory as Name.rel, in the current working directory, and in any directories - specified using option path.

    -

    If the release package is to contain a new Erlang runtime + specified using the path option.

    +

    If the release package should contain a new Erlang runtime system, the bin directory of the specified runtime system {erts,Dir} is copied to erts-ErtsVsn/bin.

    -

    All checks with function - make_script - are performed before the release package is created. - Options src_tests and exref are also +

    All checks performed with the make_script function + are performed before the release package is created. The + src_tests and exref options are also valid here.

    The return value and the handling of errors and warnings - are the same as described for - make_script.

    + are the same as described for make_script above.

    - script2boot(File) -> ok | error - Generates a binary version of a boot script. + Generate a binary version of a boot script. File = string() @@ -373,24 +366,17 @@

    The Erlang runtime system requires that the contents of the script used to boot the system is a binary Erlang term. This function transforms the File.script boot script - to a binary term, which is stored in the File.boot - file.

    -

    A boot script generated using - make_script - is already transformed to the binary form.

    + to a binary term which is stored in the file File.boot.

    +

    A boot script generated using the make_script + function is already transformed to the binary form.

    - See Also -

    app(4), - appup(4), - erl(1), - rel(4), - release_handler(3), - relup(4), - script(4)

    + SEE ALSO +

    app(4), appup(4), erl(1), rel(4), release_handler(3), relup(4), + script(4)

    diff -Nru erlang-18.2-dfsg/lib/sasl/examples/src/Makefile erlang-17.3-dfsg/lib/sasl/examples/src/Makefile --- erlang-18.2-dfsg/lib/sasl/examples/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/examples/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/sasl/examples/src/target_system.erl erlang-17.3-dfsg/lib/sasl/examples/src/target_system.erl --- erlang-18.2-dfsg/lib/sasl/examples/src/target_system.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/examples/src/target_system.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/Makefile erlang-17.3-dfsg/lib/sasl/Makefile --- erlang-18.2-dfsg/lib/sasl/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/sasl/src/alarm_handler.erl erlang-17.3-dfsg/lib/sasl/src/alarm_handler.erl --- erlang-18.2-dfsg/lib/sasl/src/alarm_handler.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/alarm_handler.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/erlsrv.erl erlang-17.3-dfsg/lib/sasl/src/erlsrv.erl --- erlang-18.2-dfsg/lib/sasl/src/erlsrv.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/erlsrv.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/format_lib_supp.erl erlang-17.3-dfsg/lib/sasl/src/format_lib_supp.erl --- erlang-18.2-dfsg/lib/sasl/src/format_lib_supp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/format_lib_supp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/Makefile erlang-17.3-dfsg/lib/sasl/src/Makefile --- erlang-18.2-dfsg/lib/sasl/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/sasl/src/misc_supp.erl erlang-17.3-dfsg/lib/sasl/src/misc_supp.erl --- erlang-18.2-dfsg/lib/sasl/src/misc_supp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/misc_supp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/overload.erl erlang-17.3-dfsg/lib/sasl/src/overload.erl --- erlang-18.2-dfsg/lib/sasl/src/overload.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/overload.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/rb.erl erlang-17.3-dfsg/lib/sasl/src/rb.erl --- erlang-18.2-dfsg/lib/sasl/src/rb.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/rb.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/rb_format_supp.erl erlang-17.3-dfsg/lib/sasl/src/rb_format_supp.erl --- erlang-18.2-dfsg/lib/sasl/src/rb_format_supp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/rb_format_supp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/release_handler_1.erl erlang-17.3-dfsg/lib/sasl/src/release_handler_1.erl --- erlang-18.2-dfsg/lib/sasl/src/release_handler_1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/release_handler_1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/release_handler.erl erlang-17.3-dfsg/lib/sasl/src/release_handler.erl --- erlang-18.2-dfsg/lib/sasl/src/release_handler.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/release_handler.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/sasl.app.src erlang-17.3-dfsg/lib/sasl/src/sasl.app.src --- erlang-18.2-dfsg/lib/sasl/src/sasl.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/sasl.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -46,6 +45,6 @@ {env, [{sasl_error_logger, tty}, {errlog_type, all}]}, {mod, {sasl, []}}, - {runtime_dependencies, ["tools-2.6.14","stdlib-2.6","kernel-4.1", + {runtime_dependencies, ["tools-2.6.14","stdlib-2.0","kernel-3.0", "erts-6.0"]}]}. diff -Nru erlang-18.2-dfsg/lib/sasl/src/sasl.appup.src erlang-17.3-dfsg/lib/sasl/src/sasl.appup.src --- erlang-18.2-dfsg/lib/sasl/src/sasl.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/sasl.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,24 +3,23 @@ %% %% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", %% Up from - max one major revision back - [{<<"2\\.[5-6](\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.* - {<<"2\\.4(\\.[0-9]+)*">>,[restart_new_emulator]}], % OTP-17 + [{<<"2\\.4(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17 + {<<"2\\.3(\\.[0-9]+)*">>,[restart_new_emulator]}], %% R16 %% Down to - max one major revision back - [{<<"2\\.[5-6](\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.* - {<<"2\\.4(\\.[0-9]+)*">>,[restart_new_emulator]}] % OTP-17 + [{<<"2\\.4(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17 + {<<"2\\.3(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R16 }. diff -Nru erlang-18.2-dfsg/lib/sasl/src/sasl.erl erlang-17.3-dfsg/lib/sasl/src/sasl.erl --- erlang-18.2-dfsg/lib/sasl/src/sasl.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/sasl.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -56,9 +55,7 @@ case application:get_env(sasl, sasl_error_logger) of {ok, false} -> undefined; {ok, tty} -> tty; - {ok, {file, File}} when is_list(File) -> {file, File, [write]}; - {ok, {file, File, Modes}} when is_list(File), is_list(Modes) -> - {file, File, Modes}; + {ok, {file, File}} when is_list(File) -> {file, File}; {ok, Bad} -> exit({bad_config, {sasl, {sasl_error_logger, Bad}}}); _ -> undefined end. @@ -128,9 +125,9 @@ error_logger:delete_report_handler(mod(Type)). mod(tty) -> sasl_report_tty_h; -mod({file, _File, _Modes}) -> sasl_report_file_h. +mod({file, _File}) -> sasl_report_file_h. -args({file, File, Modes}, Type) -> {File, Modes, type(Type)}; +args({file, File}, Type) -> {File, type(Type)}; args(_, Type) -> type(Type). type(error) -> error; diff -Nru erlang-18.2-dfsg/lib/sasl/src/sasl_report.erl erlang-17.3-dfsg/lib/sasl/src/sasl_report.erl --- erlang-18.2-dfsg/lib/sasl/src/sasl_report.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/sasl_report.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -62,53 +61,27 @@ Context = sup_get(errorContext, Report), Reason = sup_get(reason, Report), Offender = sup_get(offender, Report), - {FmtString,Args} = supervisor_format([Name,Context,Reason,Offender]), - write_report_action(IO, Fd, Head, FmtString, Args); + FmtString = " Supervisor: ~p~n Context: ~p~n Reason: " + "~80.18p~n Offender: ~80.18p~n~n", + write_report_action(IO, Fd, Head ++ FmtString, + [Name,Context,Reason,Offender]); write_report2(IO, Fd, Head, progress, Report) -> Format = format_key_val(Report), - write_report_action(IO, Fd, Head, "~s", [Format]); + write_report_action(IO, Fd, Head ++ "~s", [Format]); write_report2(IO, Fd, Head, crash_report, Report) -> - Depth = get_depth(), - Format = proc_lib:format(Report, latin1, Depth), - write_report_action(IO, Fd, Head, "~s", [Format]). - -supervisor_format(Args0) -> - case get_depth() of - unlimited -> - {" Supervisor: ~p~n" - " Context: ~p~n" - " Reason: ~80.18p~n" - " Offender: ~80.18p~n~n", - Args0}; - Depth -> - [A,B,C,D] = Args0, - Args = [A,Depth,B,Depth,C,Depth,D,Depth], - {" Supervisor: ~P~n" - " Context: ~P~n" - " Reason: ~80.18P~n" - " Offender: ~80.18P~n~n", - Args} - end. - -write_report_action(IO, Fd, Head, Format, Args) -> - S = [Head|io_lib:format(Format, Args)], - case IO of - io -> io:put_chars(Fd, S); - io_lib -> S - end. + Format = proc_lib:format(Report), + write_report_action(IO, Fd, Head ++ "~s", [Format]). + +write_report_action(io, Fd, Format, Args) -> + io:format(Fd, Format, Args); +write_report_action(io_lib, _Fd, Format, Args) -> + io_lib:format(Format, Args). format_key_val([{Tag,Data}|Rep]) -> io_lib:format(" ~16w: ~p~n",[Tag,Data]) ++ format_key_val(Rep); format_key_val(_) -> []. -get_depth() -> - case application:get_env(kernel, error_logger_format_depth) of - {ok, Depth} when is_integer(Depth) -> - max(10, Depth); - undefined -> - unlimited - end. sup_get(Tag, Report) -> case lists:keysearch(Tag, 1, Report) of diff -Nru erlang-18.2-dfsg/lib/sasl/src/sasl_report_file_h.erl erlang-17.3-dfsg/lib/sasl/src/sasl_report_file_h.erl --- erlang-18.2-dfsg/lib/sasl/src/sasl_report_file_h.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/sasl_report_file_h.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,9 +28,9 @@ handle_event/2, handle_call/2, handle_info/2, terminate/2]). -init({File, Modes, Type}) when is_list(Modes) -> +init({File, Type}) -> process_flag(trap_exit, true), - case file:open(File, Modes) of + case file:open(File, [write]) of {ok,Fd} -> {ok, {Fd, File, Type}}; What -> diff -Nru erlang-18.2-dfsg/lib/sasl/src/sasl_report_tty_h.erl erlang-17.3-dfsg/lib/sasl/src/sasl_report_tty_h.erl --- erlang-18.2-dfsg/lib/sasl/src/sasl_report_tty_h.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/sasl_report_tty_h.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/si.erl erlang-17.3-dfsg/lib/sasl/src/si.erl --- erlang-18.2-dfsg/lib/sasl/src/si.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/si.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/si_sasl_supp.erl erlang-17.3-dfsg/lib/sasl/src/si_sasl_supp.erl --- erlang-18.2-dfsg/lib/sasl/src/si_sasl_supp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/si_sasl_supp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/systools.erl erlang-17.3-dfsg/lib/sasl/src/systools.erl --- erlang-18.2-dfsg/lib/sasl/src/systools.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/systools.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/systools.hrl erlang-17.3-dfsg/lib/sasl/src/systools.hrl --- erlang-18.2-dfsg/lib/sasl/src/systools.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/systools.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/systools_lib.erl erlang-17.3-dfsg/lib/sasl/src/systools_lib.erl --- erlang-18.2-dfsg/lib/sasl/src/systools_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/systools_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/systools_make.erl erlang-17.3-dfsg/lib/sasl/src/systools_make.erl --- erlang-18.2-dfsg/lib/sasl/src/systools_make.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/systools_make.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/src/systools_rc.erl erlang-17.3-dfsg/lib/sasl/src/systools_rc.erl --- erlang-18.2-dfsg/lib/sasl/src/systools_rc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/systools_rc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,6 +32,7 @@ %% {load_module, Mod, PrePurge, PostPurge, [Mod]} %% {add_module, Mod} %% {add_module, Mod, [Mod]} +%% {remove_module, Mod, PrePurge, PostPurge, [Mod]} %% {restart_application, Appl} %% {add_application, Appl, Type} %% {remove_application, Appl} @@ -59,7 +59,7 @@ %% High-level instructions that contain dependencies %% --define(DEP_INSTRS, [update, load_module, add_module, delete_module]). +-define(DEP_INSTRS, [update, load_module, add_module, remove_module]). %%----------------------------------------------------------------- %% translate_scripts(Scripts, Appls, PreAppls) -> Res @@ -107,6 +107,9 @@ {update, Mod, Change, Mods} when Change==soft, is_list(Mods) -> {update, Mod, Change, brutal_purge,brutal_purge, Mods}; + {delete_module, Mod} -> + [{remove, {Mod, brutal_purge, brutal_purge}}, + {purge, [Mod]}]; {add_application, Application} -> {add_application, Application, permanent}; _ -> @@ -298,8 +301,6 @@ PostPurge, Mods}; ({add_module, Mod}) -> {add_module, Mod, []}; - ({delete_module, Mod}) -> - {delete_module, Mod, []}; (I) -> I end, Script). @@ -411,7 +412,7 @@ %%----------------------------------------------------------------- %%----------------------------------------------------------------- -%% Translates update, load_module and delete_module, and reorder the +%% Translates update, load_module and remove_module, and reorder the %% instructions according to dependencies. Leaves other instructions %% unchanged. %%----------------------------------------------------------------- @@ -537,7 +538,7 @@ %% Instructions are in order of dependency. %% Appls = [#application] %% -%% Instructions translated are: update, load_module, and delete_module +%% Instructions translated are: update, load_module, and remove_module %% %% Before = [{load_object_code, ...}] %% After = [{suspend, ...}] ++ CodeInstrs ++ [{resume, ...}] @@ -575,19 +576,17 @@ end, RevUpdateMods)}] end, - LoadRemoveInstrs0 = + LoadRemoveInstrs = filtermap(fun({update, Mod, _, _, _, PreP, PostP, _}) -> {true, {load, {Mod, PreP, PostP}}}; ({load_module, Mod, PreP, PostP, _}) -> {true, {load, {Mod, PreP, PostP}}}; - ({delete_module, Mod, _}) -> - {true,[{remove, {Mod, brutal_purge, brutal_purge}}, - {purge, [Mod]}]}; + ({remove_module, Mod, PreP, PostP, _}) -> + {true, {remove, {Mod, PreP, PostP}}}; (_) -> false end, Instructions), - LoadRemoveInstrs = lists:flatten(LoadRemoveInstrs0), - RevLoadRemoveInstrs = lists:flatten(lists:reverse(LoadRemoveInstrs0)), + RevLoadRemoveInstrs = lists:reverse(LoadRemoveInstrs), %% The order of loading object code is unimportant. The order %% chosen is the order of dependency. @@ -782,10 +781,10 @@ check_mod(Mod), check_list(Mods), lists:foreach(fun(M) -> check_mod(M) end, Mods); -check_op({delete_module, Mod}) -> - check_mod(Mod); -check_op({delete_module, Mod, Mods}) -> +check_op({remove_module, Mod, PrePurge, PostPurge, Mods}) -> check_mod(Mod), + check_purge(PrePurge), + check_purge(PostPurge), check_list(Mods), lists:foreach(fun(M) -> check_mod(M) end, Mods); check_op({remove_application, Appl}) -> diff -Nru erlang-18.2-dfsg/lib/sasl/src/systools_relup.erl erlang-17.3-dfsg/lib/sasl/src/systools_relup.erl --- erlang-18.2-dfsg/lib/sasl/src/systools_relup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/src/systools_relup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/test/alarm_handler_SUITE.erl erlang-17.3-dfsg/lib/sasl/test/alarm_handler_SUITE.erl --- erlang-18.2-dfsg/lib/sasl/test/alarm_handler_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/alarm_handler_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/test/installer.erl erlang-17.3-dfsg/lib/sasl/test/installer.erl --- erlang-18.2-dfsg/lib/sasl/test/installer.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/installer.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/test/Makefile erlang-17.3-dfsg/lib/sasl/test/Makefile --- erlang-18.2-dfsg/lib/sasl/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2011-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -29,13 +28,11 @@ alarm_handler_SUITE \ installer \ release_handler_SUITE \ - sasl_report_SUITE \ - sasl_report_suite_supervisor \ systools_SUITE \ systools_rc_SUITE \ overload_SUITE \ rb_SUITE \ - rh_test_lib \ + rh_test_lib ERL_FILES= $(MODULES:%=%.erl) diff -Nru erlang-18.2-dfsg/lib/sasl/test/overload_SUITE.erl erlang-17.3-dfsg/lib/sasl/test/overload_SUITE.erl --- erlang-18.2-dfsg/lib/sasl/test/overload_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/overload_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/test/rb_SUITE.erl erlang-17.3-dfsg/lib/sasl/test/rb_SUITE.erl --- erlang-18.2-dfsg/lib/sasl/test/rb_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/rb_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/c/aa.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/c/aa.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/c/aa.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/c/aa.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/c/b.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/c/b.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/c/b.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/c/b.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/c/c_sup.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/c/c_sup.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/c/c_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/c/c_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.0/src/a.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.0/src/a.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.0/src/a.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.0/src/a.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.0/src/a_sup.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.0/src/a_sup.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.0/src/a_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.0/src/a_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.1/src/a.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.1/src/a.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.1/src/a.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.1/src/a.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.1/src/a_sup.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.1/src/a_sup.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.1/src/a_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.1/src/a_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.2/src/a.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.2/src/a.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.2/src/a.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.2/src/a.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.2/src/a_sup.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.2/src/a_sup.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.2/src/a_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-1.2/src/a_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/b-2.0/ebin/b.appup erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/b-2.0/ebin/b.appup --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/b-2.0/ebin/b.appup 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/b-2.0/ebin/b.appup 2014-09-16 19:10:57.000000000 +0000 @@ -1,6 +1,6 @@ %% -*- erlang -*- {"2.0", - [{"1.0",[{delete_module,b_lib}, - {update,b_server,{advanced,[]},soft_purge,soft_purge,[]}]}], + [{"1.0",[{remove_module,b_lib,soft_purge,soft_purge,[]}, + {update,b_server,{advanced,[]}}]}], [{"1.0",[{add_module,b_lib}, - {update,b_server,{advanced,[]},soft_purge,soft_purge,[]}]}]}. + {update,b_server,{advanced,[]}}]}]}. diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/installer-1.0/src/installer.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/installer-1.0/src/installer.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/installer-1.0/src/installer.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/installer-1.0/src/installer.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/README erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/README --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/README 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/lib/README 2014-09-16 19:10:57.000000000 +0000 @@ -21,7 +21,7 @@ b-2.0: can be upgraded to from b-1.0. -Removes b_lib (brutal_purge) and updates b_server (soft_purge) +Removes b_lib (soft_purge) and updates b_server (brutal_purge) * The diff in purge method is important for test "check_and_purge", in order to check that the purge option to check_install_release works for both methods. diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_atom.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_atom.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_atom.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_atom.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_list.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_list.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_list.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_list.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_numeric.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_numeric.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_numeric.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_numeric.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_string.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_string.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_string.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_string.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_tuple.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_tuple.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_tuple.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/otp_2740/vsn_tuple.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/regexp_appup/app1/ebin/app1.app erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/regexp_appup/app1/ebin/app1.app --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/regexp_appup/app1/ebin/app1.app 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/regexp_appup/app1/ebin/app1.app 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% This is an -*- erlang -*- file. -%% -{application, app1, - [ - {description, "Test that release_handler can read appup with regexp"}, - {vsn, "1.1"}, - {modules, []}, - {registered, []}, - {applications, []} - ] -}. diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/regexp_appup/app1/ebin/app1.appup erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/regexp_appup/app1/ebin/app1.appup --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/regexp_appup/app1/ebin/app1.appup 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/regexp_appup/app1/ebin/app1.appup 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -%% -*- erlang -*- -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -{"1.1", - %% Up from - [{<<"1(\\.[0-9]+)*">>,[{restart_application,app1}]}], - %% Down to - [{<<"1(\\.[0-9]+)*">>,[{restart_application,app1}]}] -}. diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/target_system.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/target_system.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE_data/target_system.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE_data/target_system.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE.erl erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE.erl --- erlang-18.2-dfsg/lib/sasl/test/release_handler_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/release_handler_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011-2015. All Rights Reserved. +%% Copyright Ericsson AB 2011-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -1803,17 +1802,11 @@ %%%----------------------------------------------------------------- %%% OTP-10463, Bug - release_handler could not handle regexp in appup %%% files. -otp_10463_upgrade_script_regexp(Config) -> - DataDir = ?config(data_dir,Config), - code:add_path(filename:join([DataDir,regexp_appup,app1,ebin])), - application:start(app1), - {ok,"1.1",_} = release_handler:upgrade_script(app1,code:lib_dir(app1)), - ok. - -otp_10463_upgrade_script_regexp(cleanup,Config) -> - DataDir = ?config(data_dir,Config), - application:stop(app1), - code:del_path(filename:join([DataDir,regexp_appup,app1,ebin])), +otp_10463_upgrade_script_regexp(_Config) -> + %% Assuming that kernel always has a regexp in it's appup + KernelVsn = vsn(kernel,current), + {ok,KernelVsn,_} = + release_handler:upgrade_script(kernel,code:lib_dir(kernel)), ok. no_dot_erlang(Conf) -> diff -Nru erlang-18.2-dfsg/lib/sasl/test/sasl_report_SUITE.erl erlang-17.3-dfsg/lib/sasl/test/sasl_report_SUITE.erl --- erlang-18.2-dfsg/lib/sasl/test/sasl_report_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/sasl_report_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,141 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% --module(sasl_report_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). --export([gen_server_crash/1]). - --export([crash_me/0,start_link/0,init/1,handle_cast/2,terminate/2]). - --include_lib("test_server/include/test_server.hrl"). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [gen_server_crash]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -gen_server_crash(Config) -> - try - do_gen_server_crash(Config) - after - error_logger:tty(true), - ok = application:unset_env(sasl, sasl_error_logger), - ok = application:unset_env(kernel, error_logger_format_depth), - error_logger:add_report_handler(cth_log_redirect) - end, - ok. - -do_gen_server_crash(Config) -> - PrivDir = ?config(priv_dir, Config), - LogDir = filename:join(PrivDir, ?MODULE), - KernelLog = filename:join(LogDir, "kernel.log"), - SaslLog = filename:join(LogDir, "sasl.log"), - ok = filelib:ensure_dir(SaslLog), - - error_logger:delete_report_handler(cth_log_redirect), - error_logger:tty(false), - application:stop(sasl), - ok = application:set_env(sasl, sasl_error_logger, {file,SaslLog}, - [{persistent,true}]), - application:set_env(kernel, error_logger_format_depth, 30), - error_logger:logfile({open,KernelLog}), - application:start(sasl), - io:format("~p\n", [gen_event:which_handlers(error_logger)]), - - crash_me(), - - error_logger:logfile(close), - - check_file(KernelLog, 70000, 150000), - check_file(SaslLog, 50000, 100000), - - ok. - -check_file(File, Min, Max) -> - {ok,Bin} = file:read_file(File), - Base = filename:basename(File), - io:format("*** Contents of ~s ***\n", [Base]), - io:put_chars([Bin,"\n"]), - Sz = byte_size(Bin), - io:format("Size: ~p (allowed range is ~p..~p)\n", - [Sz,Min,Max]), - if - Sz < Min -> - %% Truncated? Other problem? - ?t:fail({too_short,Base}); - Sz > Max -> - %% Truncation doesn't work? - ?t:fail({too_big,Base}); - true -> - ok - end. - -%%% -%%% gen_server that crashes. -%%% - -crash_me() -> - {ok,SuperPid} = supervisor:start_link(sasl_report_suite_supervisor, []), - [{Id,Pid,_,_}] = supervisor:which_children(SuperPid), - HugeData = gb_sets:from_list(lists:seq(1, 100000)), - gen_server:cast(Pid, HugeData), - Ref = monitor(process, Pid), - receive - {'DOWN',Ref,process,Pid,_} -> - supervisor:terminate_child(SuperPid, Id), - unlink(SuperPid), - exit(SuperPid, kill), - ok - end. - -start_link() -> - gen_server:start_link(?MODULE, [], []). - -init(_) -> - St = <<0:100000/unit:8>>, - {ok,St}. - -handle_cast(Big, St) -> - Seq = lists:seq(1, 10000), - self() ! Seq, - self() ! Seq, - self() ! Seq, - self() ! Seq, - self() ! Seq, - x = Big, - {noreply,St}. - -terminate(_, _) -> - ok. diff -Nru erlang-18.2-dfsg/lib/sasl/test/sasl_report_suite_supervisor.erl erlang-17.3-dfsg/lib/sasl/test/sasl_report_suite_supervisor.erl --- erlang-18.2-dfsg/lib/sasl/test/sasl_report_suite_supervisor.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/sasl_report_suite_supervisor.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - --module(sasl_report_suite_supervisor). - --behaviour(supervisor). - -%% API --export([start_link/0]). - -%% Supervisor callbacks --export([init/1]). - --define(SERVER, ?MODULE). - -%%%=================================================================== -%%% API functions -%%%=================================================================== - -%%-------------------------------------------------------------------- -%% @doc -%% Starts the supervisor -%% -%% @spec start_link() -> {ok, Pid} | ignore | {error, Error} -%% @end -%%-------------------------------------------------------------------- -start_link() -> - supervisor:start_link({local, ?SERVER}, ?MODULE, []). - -%%%=================================================================== -%%% Supervisor callbacks -%%%=================================================================== - -%%-------------------------------------------------------------------- -%% @private -%% @doc -%% Whenever a supervisor is started using supervisor:start_link/[2,3], -%% this function is called by the new process to find out about -%% restart strategy, maximum restart intensity, and child -%% specifications. -%% -%% @spec init(Args) -> {ok, {SupFlags, [ChildSpec]}} | -%% ignore | -%% {error, Reason} -%% @end -%%-------------------------------------------------------------------- -init([]) -> - - SupFlags = #{strategy => one_for_one, - intensity => 1, - period => 5}, - - AChild = #{id => 'sasl_report_suit_supervisor', - start => {sasl_report_SUITE, start_link, []}, - restart => permanent, - shutdown => 5000, - type => worker, - modules => [sasl_report_SUITE]}, - - {ok, {SupFlags, [AChild]}}. diff -Nru erlang-18.2-dfsg/lib/sasl/test/sasl_SUITE.erl erlang-17.3-dfsg/lib/sasl/test/sasl_SUITE.erl --- erlang-18.2-dfsg/lib/sasl/test/sasl_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/sasl_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,12 +26,10 @@ %% Test cases must be exported. -export([app_test/1, appup_test/1, - log_mf_h_env/1, - log_file/1, - utc_log/1]). + log_mf_h_env/1]). all() -> - [log_mf_h_env, log_file, app_test, appup_test, utc_log]. + [log_mf_h_env, app_test, appup_test]. groups() -> []. @@ -60,29 +57,17 @@ appup_tests(_App,{[],[]}) -> {skip,"no previous releases available"}; -appup_tests(App,{OkVsns0,NokVsns}) -> +appup_tests(App,{OkVsns,NokVsns}) -> application:load(App), {_,_,Vsn} = lists:keyfind(App,1,application:loaded_applications()), AppupFileName = atom_to_list(App) ++ ".appup", AppupFile = filename:join([code:lib_dir(App),ebin,AppupFileName]), {ok,[{Vsn,UpFrom,DownTo}=AppupScript]} = file:consult(AppupFile), ct:log("~p~n",[AppupScript]), - OkVsns = - case OkVsns0 -- [Vsn] of - OkVsns0 -> - OkVsns0; - Ok -> - ct:log("Current version, ~p, is same as in previous release.~n" - "Removing this from the list of ok versions.", - [Vsn]), - Ok - end, - ct:log("Testing that appup allows upgrade from these versions: ~p~n", - [OkVsns]), + ct:log("Testing ok versions: ~p~n",[OkVsns]), check_appup(OkVsns,UpFrom,{ok,[restart_new_emulator]}), check_appup(OkVsns,DownTo,{ok,[restart_new_emulator]}), - ct:log("Testing that appup does not allow upgrade from these versions: ~p~n", - [NokVsns]), + ct:log("Testing not ok versions: ~p~n",[NokVsns]), check_appup(NokVsns,UpFrom,error), check_appup(NokVsns,DownTo,error), ok. @@ -154,9 +139,10 @@ log_mf_h_env(Config) -> PrivDir = ?config(priv_dir,Config), LogDir = filename:join(PrivDir,sasl_SUITE_log_dir), - ok = filelib:ensure_dir(LogDir), + ok = file:make_dir(LogDir), application:stop(sasl), - clear_env(sasl), + SaslEnv = application:get_all_env(sasl), + lists:foreach(fun({E,_V}) -> application:unset_env(sasl,E) end, SaslEnv), ok = application:set_env(sasl,error_logger_mf_dir,LogDir), match_error(missing_config,application:start(sasl)), @@ -180,107 +166,6 @@ ok = application:set_env(sasl,error_logger_mf_dir,LogDir), ok = application:start(sasl). -log_file(Config) -> - PrivDir = ?config(priv_dir,Config), - LogDir = filename:join(PrivDir,sasl_SUITE_log_dir), - File = filename:join(LogDir, "file.log"), - ok = filelib:ensure_dir(File), - application:stop(sasl), - clear_env(sasl), - - _ = test_log_file(File, {file,File}), - _ = test_log_file(File, {file,File,[write]}), - - ok = file:write_file(File, <<"=PROGRESS preserve me\n">>), - <<"=PROGRESS preserve me\n",_/binary>> = - test_log_file(File, {file,File,[append]}), - - ok = application:set_env(sasl,sasl_error_logger, tty, - [{persistent, false}]), - ok = application:start(sasl). - -test_log_file(File, Arg) -> - ok = application:set_env(sasl, sasl_error_logger, Arg, - [{persistent, true}]), - ok = application:start(sasl), - application:stop(sasl), - {ok,Bin} = file:read_file(File), - ok = file:delete(File), - Lines0 = binary:split(Bin, <<"\n">>, [trim_all,global]), - Lines = [L || L <- Lines0, - binary:match(L, <<"=PROGRESS">>) =:= {0,9}], - io:format("~p:\n~p\n", [Arg,Lines]), - - %% There must be at least four PROGRESS lines. - if - length(Lines) >= 4 -> ok; - true -> ?t:fail() - end, - Bin. - -%% Make a basic test of utc_log. -utc_log(Config) -> - PrivDir = ?config(priv_dir, Config), - LogDir = filename:join(PrivDir, sasl_SUITE_log_dir), - Log = filename:join(LogDir, "utc.log"), - ok = filelib:ensure_dir(Log), - - application:stop(sasl), - clear_env(sasl), - - %% Test that the UTC marker gets added to PROGRESS lines - %% when the utc_log configuration variable is set to true. - ok = application:set_env(sasl, sasl_error_logger, {file,Log}, - [{persistent,true}]), - ok = application:set_env(sasl, utc_log, true, [{persistent,true}]), - ok = application:start(sasl), - application:stop(sasl), - - verify_utc_log(Log, true), - - %% Test that no UTC markers gets added to PROGRESS lines - %% when the utc_log configuration variable is set to false. - ok = application:set_env(sasl, utc_log, false, [{persistent,true}]), - ok = application:start(sasl), - application:stop(sasl), - - verify_utc_log(Log, false), - - %% Test that no UTC markers gets added to PROGRESS lines - %% when the utc_log configuration variable is unset. - ok = application:unset_env(sasl, utc_log, [{persistent,true}]), - ok = application:start(sasl), - application:stop(sasl), - - verify_utc_log(Log, false), - - %% Change back to the standard TTY error logger. - ok = application:set_env(sasl,sasl_error_logger, tty, - [{persistent, false}]), - ok = application:start(sasl). - -verify_utc_log(Log, UTC) -> - {ok,Bin} = file:read_file(Log), - ok = file:delete(Log), - - Lines0 = binary:split(Bin, <<"\n">>, [trim_all,global]), - Lines = [L || L <- Lines0, - binary:match(L, <<"=PROGRESS">>) =:= {0,9}], - Setting = application:get_env(sasl, utc_log), - io:format("utc_log ~p:\n~p\n", [Setting,Lines]), - Filtered = [L || L <- Lines, - binary:match(L, <<" UTC ===">>) =:= nomatch], - %% Filtered now contains all lines WITHOUT any UTC markers. - case UTC of - false -> - %% No UTC marker on the PROGRESS line. - Filtered = Lines; - true -> - %% Each PROGRESS line must have an UTC marker. - [] = Filtered - end, - ok. - %%----------------------------------------------------------------- %% Internal @@ -288,7 +173,3 @@ ok; match_error(Expected,Actual) -> ?t:fail({unexpected_return,Expected,Actual}). - -clear_env(App) -> - [application:unset_env(App,Opt) || {Opt,_} <- application:get_all_env(App)], - ok. diff -Nru erlang-18.2-dfsg/lib/sasl/test/systools_rc_SUITE.erl erlang-17.3-dfsg/lib/sasl/test/systools_rc_SUITE.erl --- erlang-18.2-dfsg/lib/sasl/test/systools_rc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/systools_rc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,16 +22,14 @@ -include_lib("sasl/src/systools.hrl"). -export([all/0,groups/0,init_per_group/2,end_per_group/2, syntax_check/1, translate/1, translate_app/1, - translate_emulator_restarts/1, - translate_add_delete_module/1]). + translate_emulator_restarts/1]). %%----------------------------------------------------------------- %% erl -compile systools_rc_SUITE @i ../src/ @i ../../test_server/include/ %% c(systools_rc_SUITE, [{i, "../src"}, {i, "../../test_server/include"}]). %%----------------------------------------------------------------- all() -> - [syntax_check, translate, translate_app, translate_emulator_restarts, - translate_add_delete_module]. + [syntax_check, translate, translate_app, translate_emulator_restarts]. groups() -> []. @@ -710,59 +707,3 @@ restart_emulator] = X6, ok. - -translate_add_delete_module(_Config) -> - PreApps = - [#application{name = test, - description = "TEST", - vsn = "0.1", - modules = [foo,bar,baz,old_mod], - regs = [], - mod = {sasl, []}}], - Apps = - [#application{name = test, - description = "TEST", - vsn = "1.0", - modules = [foo,bar,baz,new_mod], - regs = [], - mod = {sasl, []}}], - S1 = [ - {delete_module, old_mod}, - {add_module, new_mod}, - {load_module, foo} - ], - {ok, X1} = systools_rc:translate_scripts([S1], Apps, PreApps), - [{load_object_code,{test,"1.0",[new_mod,foo]}}, - point_of_no_return, - {remove,{old_mod,brutal_purge,brutal_purge}}, - {purge,[old_mod]}, - {load,{new_mod,brutal_purge,brutal_purge}}, - {load,{foo,brutal_purge,brutal_purge}}] = X1, - - S2 = [ - {delete_module, old_mod}, - {add_module, new_mod, [foo]}, - {load_module, foo} - ], - {ok, X2} = systools_rc:translate_scripts([S2], Apps, PreApps), - [{load_object_code,{test,"1.0",[new_mod,foo]}}, - point_of_no_return, - {remove,{old_mod,brutal_purge,brutal_purge}}, - {purge,[old_mod]}, - {load,{foo,brutal_purge,brutal_purge}}, - {load,{new_mod,brutal_purge,brutal_purge}}] = X2, - - S3 = [ - {delete_module, old_mod, [new_mod]}, - {add_module, new_mod, [foo]}, - {load_module, foo} - ], - {ok, X3} = systools_rc:translate_scripts([S3], Apps, PreApps), - [{load_object_code,{test,"1.0",[new_mod,foo]}}, - point_of_no_return, - {load,{foo,brutal_purge,brutal_purge}}, - {load,{new_mod,brutal_purge,brutal_purge}}, - {remove,{old_mod,brutal_purge,brutal_purge}}, - {purge,[old_mod]}] = X3, - - ok. diff -Nru erlang-18.2-dfsg/lib/sasl/test/systools_SUITE.erl erlang-17.3-dfsg/lib/sasl/test/systools_SUITE.erl --- erlang-18.2-dfsg/lib/sasl/test/systools_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/systools_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/sasl/test/test_lib.hrl erlang-17.3-dfsg/lib/sasl/test/test_lib.hrl --- erlang-18.2-dfsg/lib/sasl/test/test_lib.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/test/test_lib.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,3 +1,3 @@ -define(ertsvsn,"4.4"). --define(kernelvsn,"3.0"). --define(stdlibvsn,"2.0"). +-define(kernelvsn,"2.16.4"). +-define(stdlibvsn,"1.19.4"). diff -Nru erlang-18.2-dfsg/lib/sasl/vsn.mk erlang-17.3-dfsg/lib/sasl/vsn.mk --- erlang-18.2-dfsg/lib/sasl/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/sasl/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -SASL_VSN = 2.6.1 +SASL_VSN = 2.4.1 diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/book.xml erlang-17.3-dfsg/lib/snmp/doc/src/book.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/files.mk erlang-17.3-dfsg/lib/snmp/doc/src/files.mk --- erlang-18.2-dfsg/lib/snmp/doc/src/files.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/files.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2001-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/index.html.src erlang-17.3-dfsg/lib/snmp/doc/src/index.html.src --- erlang-18.2-dfsg/lib/snmp/doc/src/index.html.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/index.html.src 2014-09-16 19:10:57.000000000 +0000 @@ -2,17 +2,16 @@ - - - -

    [compiler] Refinement of type Opaque was not allowed.

    -

    MIB constructs such as 'SYNTAX Opaque (SIZE(0..65535))' - was previously not allowed, - see the standard ALARM-MIB for eaxmple.

    -

    Own Id: OTP-12066

    -

    Aux Id: Seq 12669

    -
    - -
    - -
    - -
    - Fixed Bugs and Malfunctions -

    -

    - - - -
    - -
    - Incompatibilities -

    -

    - - -
    -
    - - -
    SNMP 5.1
    Improvements and New Features diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/part_notes_history.xml erlang-17.3-dfsg/lib/snmp/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/part_notes.xml erlang-17.3-dfsg/lib/snmp/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/part.xml erlang-17.3-dfsg/lib/snmp/doc/src/part.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/ref_man.xml erlang-17.3-dfsg/lib/snmp/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_conf.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_conf.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_conf.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_conf.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_discovery_handler.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_discovery_handler.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_discovery_handler.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_discovery_handler.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_advanced_agent.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_advanced_agent.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_advanced_agent.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_advanced_agent.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -340,7 +339,7 @@ SEQUENCE { empDepNo INTEGER, empName DisplayString, - empTelNo DisplayString, + empTelNo DisplayString empStatus RowStatus } diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_error_io.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_error_io.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_error_io.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_error_io.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_error_logger.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_error_logger.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_error_logger.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_error_logger.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_error_report.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_error_report.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_error_report.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_error_report.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_error.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_error.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_error.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_error.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_agent_config_files.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_agent_config_files.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_agent_config_files.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_agent_config_files.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_agent_funct_descr.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_agent_funct_descr.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_agent_funct_descr.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_agent_funct_descr.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_agent_netif.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_agent_netif.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_agent_netif.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_agent_netif.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -76,7 +75,8 @@ {Domain, Addr} tuple where Domain is transportDomainUdpIpv4 or transportDomainUdpIpv4, and Addr is an - {IpAddr,IpPort} tuple.

    + {IpAddr, + IpPort} tuple.

    diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_local_db.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_local_db.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_local_db.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_local_db.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_mib_data.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_mib_data.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_mib_data.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_mib_data.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_mib_storage.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_mib_storage.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_mib_storage.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_mib_storage.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_mpd.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_mpd.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_mpd.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_mpd.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_network_interface_filter.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_network_interface_filter.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_network_interface_filter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_network_interface_filter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_network_interface.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_network_interface.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_network_interface.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_network_interface.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_notification_delivery_info_receiver.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_notification_delivery_info_receiver.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_notification_delivery_info_receiver.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_notification_delivery_info_receiver.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_notification_filter.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_notification_filter.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_notification_filter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_notification_filter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_app_a.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_app_a.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_app_a.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_app_a.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_app_b.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_app_b.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_app_b.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_app_b.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_app.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_app.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_app.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_app.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -135,16 +134,16 @@

    Agent specific config options and types:

    - - ]]> + + ]]>

    If master, one master agent is started. Otherwise, no agents are started.

    Default is master.

    - - ]]> + + ]]>

    agent_discovery_opt() = {terminating, agent_terminating_discovery_opts()} | @@ -156,8 +155,8 @@

    For defaults see the options in agent_discovery_opt().

    - - ]]> + + ]]>

    agent_terminating_discovery_opt() = {enable, boolean()} | @@ -174,8 +173,8 @@ - - ]]> + + ]]>

    agent_originating_discovery_opt() = {enable, boolean()}

    @@ -188,39 +187,38 @@
    - - ]]> + + ]]>

    If true, the agent is multi-threaded, with one thread for each get request.

    Default is false.

    - - ]]> + + ]]>

    Defines where the SNMP agent internal db files are stored.

    - - - ]]> + + ]]>

    Defines the maximum number of varbinds allowed in a Get-BULK response.

    Default is 1000.

    - - ]]> + + ]]>

    local_db_opt() = {repair, agent_repair()} | {auto_save, agent_auto_save()} | {verbosity, verbosity()}

    Defines options specific for the SNMP agent local database.

    For defaults see the options in local_db_opt().

    - - ]]> + + ]]>

    When starting snmpa_local_db it always tries to open an existing database. If false, and some errors occur, a new @@ -230,16 +228,16 @@

    Default is true.

    - - ]]> + + ]]>

    The auto save interval. The table is flushed to disk whenever not accessed for this amount of time.

    Default is 5000.

    - - ]]> + + ]]>

    agent_net_if_opt() = {module, agent_net_if_module()} | {verbosity, verbosity()} | {options, agent_net_if_options()}

    Defines options specific for the SNMP agent network interface @@ -247,8 +245,8 @@

    For defaults see the options in agent_net_if_opt().

    - - ]]> + + ]]>

    Module which handles the network interface part for the SNMP agent. Must implement the @@ -256,8 +254,8 @@

    Default is snmpa_net_if.

    - - ]]> + + ]]>

    agent_net_if_option() = {bind_to, bind_to()} | {sndbuf, sndbuf()} | @@ -271,15 +269,15 @@

    For defaults see the options in agent_net_if_option().

    - - ]]> + + ]]>

    Max number of simultaneous requests handled by the agent.

    Default is infinity.

    - - ]]> + + ]]>

    agent_net_if_filter_option() = {module, agent_net_if_filter_module()}

    These options are actually specific to the used module. @@ -289,8 +287,8 @@ agent_net_if_filter_option().

    - - ]]> + + ]]>

    Module which handles the network interface filter part for the SNMP agent. Must implement the @@ -298,8 +296,8 @@

    Default is snmpa_net_if_filter.

    - - ]]> + + ]]>

    Specifies a list of MIBs (including path) that defines which MIBs are initially loaded into the SNMP master agent.

    @@ -313,8 +311,8 @@

    Default is [].

    - - ]]> + + ]]>

    mib_storage_opt() = {module, mib_storage_module()} | {options, mib_storage_options()}

    This option specifies how basic mib data is stored. @@ -323,8 +321,8 @@

    Default is [{module, snmpa_mib_storage_ets}].

    - - + +

    Defines the mib storage module of the SNMP agent as defined by the snmpa_mib_storage @@ -338,8 +336,8 @@

    Default module is snmpa_mib_storage_ets.

    - - ]]> + + ]]>

    This is implementattion depended. That is, it depends on the module. For each module a specific set of options are valid. @@ -428,16 +426,16 @@ - - ]]> + + ]]>

    mib_server_opt() = {mibentry_override, mibentry_override()} | {trapentry_override, trapentry_override()} | {verbosity, verbosity()} | {cache, mibs_cache()} | {data_module, mib_server_data_module()}

    Defines options specific for the SNMP agent mib server.

    For defaults see the options in mib_server_opt().

    - - ]]> + + ]]>

    If this value is false, then when loading a mib each mib- entry is checked prior to installation of the mib. @@ -446,8 +444,8 @@

    Default is false.

    - - ]]> + + ]]>

    If this value is false, then when loading a mib each trap is checked prior to installation of the mib. @@ -456,12 +454,11 @@

    Default is false.

    + - - ]]> + ]]>

    Defines the backend data module of the SNMP agent mib-server as defined by the @@ -478,24 +475,24 @@

    Default module is snmpa_mib_data_tttn.

    - - ]]> + + ]]>

    Shall the agent utilize the mib server lookup cache or not.

    Default is true (in which case the mibs_cache_opts() default values apply).

    - - ]]> + + ]]>

    mibs_cache_opt() = {autogc, mibs_cache_autogc()} | {gclimit, mibs_cache_gclimit()} | {age, mibs_cache_age()}

    Defines options specific for the SNMP agent mib server cache.

    For defaults see the options in mibs_cache_opt().

    - - ]]> + + ]]>

    Defines if the mib server shall perform cache gc automatically or leave it to the user (see @@ -503,8 +500,8 @@

    Default is true.

    - - 0 ]]> + + 0 ]]>

    Defines how old the entries in the cache will be allowed to become before they are GC'ed (assuming GC is performed). @@ -513,8 +510,8 @@

    Default is 10 timutes.

    - - 0 | infinity ]]> + + 0 | infinity ]]>

    When performing a GC, this is the max number of cache entries that will be deleted from the cache.

    @@ -524,8 +521,8 @@

    Default is 100.

    - - ]]> + + ]]>

    Defines an error report module, implementing the snmpa_error_report @@ -534,38 +531,38 @@

    Default is snmpa_error_logger.

    - - symbolic_store() = [symbolic_store_opt()] + + symbolic_store() = [symbolic_store_opt()]

    symbolic_store_opt() = {verbosity, verbosity()}

    Defines options specific for the SNMP agent symbolic store.

    For defaults see the options in symbolic_store_opt().

    - - target_cache() = [target_cache_opt()] + + target_cache() = [target_cache_opt()]

    target_cache_opt() = {verbosity, verbosity()}

    Defines options specific for the SNMP agent target cache.

    For defaults see the options in target_cache_opt().

    - - ]]> + + ]]>

    agent_config_opt() = {dir, agent_config_dir()} | {force_load, force_load()} | {verbosity, verbosity()}

    Defines specific config related options for the SNMP agent.

    For defaults see the options in agent_config_opt().

    - - ]]> + + ]]>

    Defines where the SNMP agent configuration files are stored.

    - - ]]> + + ]]>

    If true the configuration files are re-read during start-up, and the contents of the configuration @@ -579,18 +576,18 @@

    Manager specific config options and types:

    - - ]]> + + ]]>

    server_opt() = {timeout, server_timeout()} | {verbosity, verbosity()}

    Specifies the options for the manager server process.

    Default is silence.

    - - ]]> + + ]]> -

    Asynchronous request cleanup time. For every requests, +

    Asynchroneous request cleanup time. For every requests, some info is stored internally, in order to be able to deliver the reply (when it arrives) to the proper destination. If the reply arrives, this info will be deleted. But if @@ -608,44 +605,44 @@

    Default is 30000.

    - - ]]> + + ]]>

    manager_config_opt() = {dir, manager_config_dir()} | {db_dir, manager_db_dir()} | {db_init_error, db_init_error()} | {repair, manager_repair()} | {auto_save, manager_auto_save()} | {verbosity, verbosity()}

    Defines specific config related options for the SNMP manager.

    For defaults see the options in manager_config_opt().

    - - ]]> + + ]]>

    Defines where the SNMP manager configuration files are stored.

    - - ]]> + + ]]>

    Defines where the SNMP manager store persistent data.

    - - ]]> + + ]]>

    Defines the repair option for the persistent database (if and how the table is repaired when opened).

    Default is true.

    - - ]]> + + ]]>

    The auto save interval. The table is flushed to disk whenever not accessed for this amount of time.

    Default is 5000.

    - - ]]> + + ]]>

    This option defines how the manager will handle the sending of response (acknowledgment) to received inform-requests.

    @@ -674,16 +671,16 @@

    Default is auto.

    - - ]]> + + ]]>

    Specifies a list of MIBs (including path) and defines which MIBs are initially loaded into the SNMP manager.

    Default is [].

    - - ]]> + + ]]>

    manager_net_if_opt() = {module, manager_net_if_module()} | {verbosity, verbosity()} | @@ -693,8 +690,8 @@

    For defaults see the options in manager_net_if_opt().

    - - ]]> + + ]]>

    manager_net_if_option() = {bind_to, bind_to()} | {sndbuf, sndbuf()} | @@ -707,8 +704,8 @@

    For defaults see the options in manager_net_if_option().

    - - ]]> + + ]]>

    The module which handles the network interface part for the SNMP manager. It must implement the @@ -716,8 +713,8 @@

    Default is snmpm_net_if.

    - - ]]> + + ]]>

    manager_net_if_filter_option() = {module, manager_net_if_filter_module()}

    These options are actually specific to the used module. @@ -727,8 +724,8 @@ manager_net_if_filter_option().

    - - ]]> + + ]]>

    Module which handles the network interface filter part for the SNMP manager. Must implement the @@ -736,16 +733,16 @@

    Default is snmpm_net_if_filter.

    - - ]]> + + ]]>

    The module implementing the default user. See the snmpm_user behaviour.

    Default is snmpm_user_default.

    - - ]]> + + ]]>

    Data for the default user. Passed to the user module when calling the callback functions.

    @@ -756,8 +753,8 @@

    Common config types:

    - - restart_type() = permanent | transient | temporary + + restart_type() = permanent | transient | temporary

    See supervisor documentation for more info.

    @@ -765,8 +762,8 @@ for the manager.

    - - db_init_error() = terminate | create | create_db_and_dir + + db_init_error() = terminate | create | create_db_and_dir

    Defines what to do if the agent or manager is unable to open an existing database file. terminate means that the @@ -778,31 +775,31 @@

    Default is terminate.

    - - ]]> + + ]]>

    Defines the Erlang priority for all SNMP processes.

    Default is normal.

    - - ]]> + + ]]>

    version() = v1 | v2 | v3

    Which SNMP versions shall be accepted/used.

    Default is [v1,v2,v3].

    - - ]]> + + ]]>

    Verbosity for a SNMP process. This specifies now much debug info is printed.

    Default is silence.

    - - ]]> + + ]]>

    If true, net_if binds to the IP address. If false, net_if listens on any IP address on the host @@ -810,8 +807,8 @@

    Default is false.

    - - ]]> + + ]]>

    If true, net_if does not specify that the IP and port address should be reusable. If false, @@ -819,30 +816,30 @@

    Default is false.

    - - ]]> + + ]]>

    Receive buffer size.

    Default value is defined by gen_udp.

    - - ]]> + + ]]>

    Send buffer size.

    Default value is defined by gen_udp.

    - - ]]> + + ]]>

    note_store_opt() = {timeout, note_store_timeout()} | {verbosity, verbosity()}

    Specifies the start-up verbosity for the SNMP note store.

    For defaults see the options in note_store_opt().

    - - ]]> + + ]]>

    Note cleanup time. When storing a note in the note store, each note is given lifetime. Every timeout the note_store @@ -852,8 +849,8 @@ - - ]]> + + ]]>

    audit_trail_log_opt() = {type, atl_type()} | {dir, atl_dir()} | {size, atl_size()} | {repair, atl_repair()} | {seqno, atl_seqno()}

    If present, this option specifies the options for the @@ -863,8 +860,8 @@

    If not present, audit trail logging is not used.

    - - ]]> + + ]]>

    Specifies what type of an audit trail log should be used. The effect of the type is actually different for the the agent @@ -885,16 +882,16 @@

    Default is read_write.

    - - ]]> + + ]]>

    Specifies where the audit trail log should be stored.

    If audit_trail_log specifies that logging should take place, this parameter must be defined.

    - - ]]> + + ]]>

    Specifies the size of the audit trail log. This parameter is sent to disk_log.

    @@ -902,8 +899,8 @@ take place, this parameter must be defined.

    - - ]]> + + ]]>

    Specifies if and how the audit trail log shall be repaired when opened. Unless this parameter has the value snmp_repair @@ -915,8 +912,8 @@

    Default is true.

    - - ]]> + + ]]>

    Specifies if the audit trail log entries will be (sequence) numbered or not. The range of the sequence numbers are according diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_supervisor.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_supervisor.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa_supervisor.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa_supervisor.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_audit_trail_log.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_audit_trail_log.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_audit_trail_log.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_audit_trail_log.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpa.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpa.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpa.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpa.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -622,12 +621,12 @@

    Converts an Audit Trail Log to a readable format and prints it on stdio. LogName defaults to "snmpa_log". - LogFile defaults to "snmpa.log".

    + LogFile defaults to "snmpa.log".

    The Block option indicates if the log should be blocked during conversion. This could be usefull when converting large logs (when otherwise the log could wrap during conversion). Defaults to true.

    -

    See snmp:log_to_io + See snmp:log_to_io for more info.

    diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpc_cmd.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpc_cmd.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpc_cmd.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpc_cmd.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_community_mib.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_community_mib.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_community_mib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_community_mib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_config.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_config.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_config.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_config.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -130,16 +129,16 @@

    Agent specific config options and types:

    - - ]]> + + ]]>

    If master, one master agent is started. Otherwise, no agents are started.

    Default is master.

    - - ]]> + + ]]>

    agent_discovery_opt() = {terminating, agent_terminating_discovery_opts()} | @@ -151,8 +150,8 @@

    For defaults see the options in agent_discovery_opt().

    - - ]]> + + ]]>

    agent_terminating_discovery_opt() = {enable, boolean()} | @@ -169,8 +168,8 @@ - - ]]> + + ]]>

    agent_originating_discovery_opt() = {enable, boolean()}

    @@ -183,38 +182,38 @@
    - - ]]> + + ]]>

    If true, the agent is multi-threaded, with one thread for each get request.

    Default is false.

    - - ]]> + + ]]>

    Defines where the SNMP agent internal db files are stored.

    - - ]]> + + ]]>

    Defines the maximum number of varbinds allowed in a Get-BULK response.

    Default is 1000.

    - - ]]> + + ]]>

    local_db_opt() = {repair, agent_repair()} | {auto_save, agent_auto_save()} | {verbosity, verbosity()}

    Defines options specific for the SNMP agent local database.

    For defaults see the options in local_db_opt().

    - - ]]> + + ]]>

    When starting snmpa_local_db it always tries to open an existing database. If false, and some errors occur, a new @@ -224,16 +223,16 @@

    Default is true.

    - - ]]> + + ]]>

    The auto save interval. The table is flushed to disk whenever not accessed for this amount of time.

    Default is 5000.

    - - ]]> + + ]]>

    agent_net_if_option() = {module, agent_net_if_module()} | {verbosity, verbosity()} | @@ -243,8 +242,8 @@

    For defaults see the options in agent_net_if_opt().

    - - ]]> + + ]]>

    Module which handles the network interface part for the SNMP agent. Must implement the @@ -252,8 +251,8 @@

    Default is snmpa_net_if.

    - - ]]> + + ]]>

    agent_net_if_option() = {bind_to, bind_to()} | {sndbuf, sndbuf()} | @@ -267,15 +266,15 @@

    For defaults see the options in agent_net_if_option().

    - - ]]> + + ]]>

    Max number of simultaneous requests handled by the agent.

    Default is infinity.

    - - ]]> + + ]]>

    These options are actually specific to the used module. @@ -284,8 +283,8 @@

    For defaults see the options in agent_net_if_filter_option().

    - - ]]> + + ]]>

    Module which handles the network interface filter part for the SNMP agent. Must implement the @@ -294,8 +293,8 @@

    Default is snmpa_net_if_filter.

    - - ]]> + + ]]>

    Specifies a list of MIBs (including path) that defines which MIBs are initially loaded into the SNMP master agent.

    @@ -309,8 +308,8 @@

    Default is [].

    - - ]]> + + ]]>

    mib_storage_opt() = {module, mib_storage_module()} | {options, mib_storage_options()}

    This option specifies how basic mib data is stored. @@ -319,8 +318,8 @@

    Default is [{module, snmpa_mib_storage_ets}].

    - - + +

    Defines the mib storage module of the SNMP agent as defined by the snmpa_mib_storage @@ -334,8 +333,8 @@

    Default module is snmpa_mib_storage_ets.

    - - ]]> + + ]]>

    This is implementattion depended. That is, it depends on the module. For each module a specific set of options are valid. @@ -429,8 +428,8 @@ This is the old format which is "supported", but not documented, in so far as it will be converted to the new format if found. - - ]]> + + ]]>

    Specifies how info retrieved from the mibs will be stored.

    If mib_storage is {ets, Dir}, the table will also be @@ -456,16 +455,16 @@ --> - - ]]> + + ]]>

    mib_server_opt() = {mibentry_override, mibentry_override()} | {trapentry_override, trapentry_override()} | {verbosity, verbosity()} | {cache, mibs_cache()} | {data_module, mib_server_data_module()}

    Defines options specific for the SNMP agent mib server.

    For defaults see the options in mib_server_opt().

    - - ]]> + + ]]>

    If this value is false, then when loading a mib each mib- entry is checked prior to installation of the mib. @@ -474,8 +473,8 @@

    Default is false.

    - - ]]> + + ]]>

    If this value is false, then when loading a mib each trap is checked prior to installation of the mib. @@ -484,13 +483,11 @@

    Default is false.

    - + - - ]]> + ]]>

    Defines the backend data module of the SNMP agent mib-server as defined by the @@ -507,24 +504,24 @@

    Default module is snmpa_mib_data_tttn.

    - - ]]> + + ]]>

    Shall the agent utilize the mib server lookup cache or not.

    Default is true (in which case the mibs_cache_opts() default values apply).

    - - ]]> + + ]]>

    mibs_cache_opt() = {autogc, mibs_cache_autogc()} | {gclimit, mibs_cache_gclimit()} | {age, mibs_cache_age()}

    Defines options specific for the SNMP agent mib server cache.

    For defaults see the options in mibs_cache_opt().

    - - ]]> + + ]]>

    Defines if the mib server shall perform cache gc automatically or leave it to the user (see @@ -532,8 +529,8 @@

    Default is true.

    - - 0 ]]> + + 0 ]]>

    Defines how old the entries in the cache will be allowed to become before they are GC'ed (assuming GC is performed). @@ -542,8 +539,8 @@

    Default is 10 timutes.

    - - 0 | infinity ]]> + + 0 | infinity ]]>

    When performing a GC, this is the max number of cache entries that will be deleted from the cache.

    @@ -553,8 +550,8 @@

    Default is 100.

    - - ]]> + + ]]>

    Defines an error report module, implementing the snmpa_error_report @@ -563,38 +560,38 @@

    Default is snmpa_error_logger.

    - - symbolic_store() = [symbolic_store_opt()] + + symbolic_store() = [symbolic_store_opt()]

    symbolic_store_opt() = {verbosity, verbosity()}

    Defines options specific for the SNMP agent symbolic store.

    For defaults see the options in symbolic_store_opt().

    - - target_cache() = [target_cache_opt()] + + target_cache() = [target_cache_opt()]

    target_cache_opt() = {verbosity, verbosity()}

    Defines options specific for the SNMP agent target cache.

    For defaults see the options in target_cache_opt().

    - - ]]> + + ]]>

    agent_config_opt() = {dir, agent_config_dir()} | {force_load, force_load()} | {verbosity, verbosity()}

    Defines specific config related options for the SNMP agent.

    For defaults see the options in agent_config_opt().

    - - ]]> + + ]]>

    Defines where the SNMP agent configuration files are stored.

    - - ]]> + + ]]>

    If true the configuration files are re-read during start-up, and the contents of the configuration @@ -608,18 +605,18 @@

    Manager specific config options and types:

    - - ]]> + + ]]>

    server_opt() = {timeout, server_timeout()} | {verbosity, verbosity()}

    Specifies the options for the manager server process.

    Default is silence.

    - - ]]> + + ]]> -

    Asynchronous request cleanup time. For every requests, +

    Asynchroneous request cleanup time. For every requests, some info is stored internally, in order to be able to deliver the reply (when it arrives) to the proper destination. If the reply arrives, this info will be deleted. But if @@ -637,44 +634,44 @@

    Default is 30000.

    - - ]]> + + ]]>

    manager_config_opt() = {dir, manager_config_dir()} | {db_dir, manager_db_dir()} | {db_init_error, db_init_error()} | {repair, manager_repair()} | {auto_save, manager_auto_save()} | {verbosity, verbosity()}

    Defines specific config related options for the SNMP manager.

    For defaults see the options in manager_config_opt().

    - - ]]> + + ]]>

    Defines where the SNMP manager configuration files are stored.

    - - ]]> + + ]]>

    Defines where the SNMP manager store persistent data.

    - - ]]> + + ]]>

    Defines the repair option for the persistent database (if and how the table is repaired when opened).

    Default is true.

    - - ]]> + + ]]>

    The auto save interval. The table is flushed to disk whenever not accessed for this amount of time.

    Default is 5000.

    - - ]]> + + ]]>

    This option defines how the manager will handle the sending of response (acknowledgment) to received inform-requests.

    @@ -703,16 +700,16 @@

    Default is auto.

    - - ]]> + + ]]>

    Specifies a list of MIBs (including path) and defines which MIBs are initially loaded into the SNMP manager.

    Default is [].

    - - ]]> + + ]]>

    manager_net_if_opt() = {module, manager_net_if_module()} | {verbosity, verbosity()} | @@ -722,8 +719,8 @@

    For defaults see the options in manager_net_if_opt().

    - - ]]> + + ]]>

    manager_net_if_option() = {bind_to, bind_to()} | {sndbuf, sndbuf()} | @@ -736,8 +733,8 @@

    For defaults see the options in manager_net_if_option().

    - - ]]> + + ]]>

    The module which handles the network interface part for the SNMP manager. It must implement the @@ -745,8 +742,8 @@

    Default is snmpm_net_if.

    - - ]]> + + ]]>

    manager_net_if_filter_option() = {module, manager_net_if_filter_module()}

    These options are actually specific to the used module. @@ -756,8 +753,8 @@ manager_net_if_filter_option().

    - - ]]> + + ]]>

    Module which handles the network interface filter part for the SNMP manager. Must implement the @@ -765,16 +762,16 @@

    Default is snmpm_net_if_filter.

    - - ]]> + + ]]>

    The module implementing the default user. See the snmpm_user behaviour.

    Default is snmpm_user_default.

    - - ]]> + + ]]>

    Data for the default user. Passed to the user when calling the callback functions.

    @@ -785,8 +782,8 @@

    Common config types:

    - - restart_type() = permanent | transient | temporary + + restart_type() = permanent | transient | temporary

    See supervisor documentation for more info.

    @@ -794,8 +791,8 @@ for the manager.

    - - db_init_error() = terminate | create | create_db_and_dir + + db_init_error() = terminate | create | create_db_and_dir

    Defines what to do if the agent is unable to open an existing database file. terminate means that the @@ -807,31 +804,31 @@

    Default is terminate.

    - - ]]> + + ]]>

    Defines the Erlang priority for all SNMP processes.

    Default is normal.

    - - ]]> + + ]]>

    version() = v1 | v2 | v3

    Which SNMP versions shall be accepted/used.

    Default is [v1,v2,v3].

    - - ]]> + + ]]>

    Verbosity for a SNMP process. This specifies now much debug info is printed.

    Default is silence.

    - - ]]> + + ]]>

    If true, net_if binds to the IP address. If false, net_if listens on any IP address on the host @@ -839,8 +836,8 @@

    Default is false.

    - - ]]> + + ]]>

    If true, net_if does not specify that the IP and port address should be reusable. If false, @@ -848,30 +845,30 @@

    Default is false.

    - - ]]> + + ]]>

    Receive buffer size.

    Default value is defined by gen_udp.

    - - ]]> + + ]]>

    Send buffer size.

    Default value is defined by gen_udp.

    - - ]]> + + ]]>

    note_store_opt() = {timeout, note_store_timeout()} | {verbosity, verbosity()}

    Specifies the options for the SNMP note store.

    For defaults see the options in note_store_opt().

    - - ]]> + + ]]>

    Note cleanup time. When storing a note in the note store, each note is given lifetime. Every timeout the note_store @@ -880,8 +877,8 @@

    Default is 30000.

    - - ]]> + + ]]>

    audit_trail_log_opt() = {type, atl_type()} | {dir, atl_dir()} | {size, atl_size()} | {repair, atl_repair()} | {seqno, atl_seqno()}

    If present, this option specifies the options for the @@ -891,8 +888,8 @@

    If not present, audit trail logging is not used.

    - - ]]> + + ]]>

    Specifies what type of an audit trail log should be used. The effect of the type is actually different for the the agent @@ -913,16 +910,16 @@

    Default is read_write.

    - - ]]> + + ]]>

    Specifies where the audit trail log should be stored.

    If audit_trail_log specifies that logging should take place, this parameter must be defined.

    - - ]]> + + ]]>

    Specifies the size of the audit trail log. This parameter is sent to disk_log.

    @@ -930,8 +927,8 @@ take place, this parameter must be defined.

    - - ]]> + + ]]>

    Specifies if and how the audit trail log shall be repaired when opened. Unless this parameter has the value snmp_repair @@ -943,8 +940,8 @@

    Default is true.

    - - ]]> + + ]]>

    Specifies if the audit trail log entries will be (sequence) numbered or not. The range of the sequence numbers are according diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpc.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpc.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpc.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpc.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_def_instr_functions.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_def_instr_functions.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_def_instr_functions.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_def_instr_functions.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_framework_mib.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_framework_mib.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_framework_mib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_framework_mib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_generic.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_generic.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_generic.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_generic.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_impl_example_agent.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_impl_example_agent.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_impl_example_agent.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_impl_example_agent.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_impl_example_manager.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_impl_example_manager.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_impl_example_manager.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_impl_example_manager.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_index.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_index.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_index.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_index.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_instr_functions.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_instr_functions.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_instr_functions.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_instr_functions.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_intro.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_intro.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_intro.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_intro.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_manager_config_files.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_manager_config_files.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_manager_config_files.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_manager_config_files.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_manager_funct_descr.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_manager_funct_descr.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_manager_funct_descr.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_manager_funct_descr.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_manager_netif.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_manager_netif.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_manager_netif.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_manager_netif.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -75,7 +74,8 @@

    In this section a Domain field is the transport domain i.e one of transportDomainUdpIpv4 or transportDomainUdpIpv6, and an Addr field is an - {IpAddr,IpPort} tuple.

    + {IpAddr, + IpPort} tuple.

    Net if must send the following message when it receives an SNMP PDU from the network that is aimed for the MasterAgent: diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpm_conf.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpm_conf.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpm_conf.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpm_conf.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_mib_compiler.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_mib_compiler.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_mib_compiler.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_mib_compiler.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpm_mpd.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpm_mpd.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpm_mpd.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpm_mpd.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpm_network_interface_filter.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpm_network_interface_filter.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpm_network_interface_filter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpm_network_interface_filter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpm_network_interface.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpm_network_interface.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpm_network_interface.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpm_network_interface.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpm_user.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpm_user.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpm_user.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpm_user.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmpm.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmpm.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmpm.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmpm.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -1241,12 +1240,12 @@

    Converts an Audit Trail Log to a readable text file. OutFile defaults to "./snmpm_log.txt". LogName defaults to "snmpm_log". - LogFile defaults to "snmpm.log".

    + LogFile defaults to "snmpm.log".

    The Block argument indicates if the log should be blocked during conversion. This could be usefull when converting large logs (when otherwise the log could wrap during conversion). Defaults to true.

    -

    See snmp:log_to_txt + See snmp:log_to_txt for more info.

    @@ -1280,12 +1279,12 @@

    Converts an Audit Trail Log to a readable format and prints it on stdio. LogName defaults to "snmpm_log". - LogFile defaults to "snmpm.log".

    + LogFile defaults to "snmpm.log".

    The Block argument indicates if the log should be blocked during conversion. This could be usefull when converting large logs (when otherwise the log could wrap during conversion). Defaults to true.

    -

    See snmp:log_to_io + See snmp:log_to_io for more info.

    diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_notification_mib.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_notification_mib.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_notification_mib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_notification_mib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_pdus.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_pdus.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_pdus.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_pdus.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_standard_mib.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_standard_mib.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_standard_mib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_standard_mib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_target_mib.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_target_mib.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_target_mib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_target_mib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_user_based_sm_mib.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_user_based_sm_mib.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_user_based_sm_mib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_user_based_sm_mib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp_view_based_acm_mib.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp_view_based_acm_mib.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp_view_based_acm_mib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp_view_based_acm_mib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/doc/src/snmp.xml erlang-17.3-dfsg/lib/snmp/doc/src/snmp.xml --- erlang-18.2-dfsg/lib/snmp/doc/src/snmp.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/doc/src/snmp.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/snmp/examples/ex1/ex1.erl erlang-17.3-dfsg/lib/snmp/examples/ex1/ex1.erl --- erlang-18.2-dfsg/lib/snmp/examples/ex1/ex1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/examples/ex1/ex1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% Ericsson AB, All Rights Reserved %% %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson AB. %% diff -Nru erlang-18.2-dfsg/lib/snmp/examples/ex1/Makefile erlang-17.3-dfsg/lib/snmp/examples/ex1/Makefile --- erlang-18.2-dfsg/lib/snmp/examples/ex1/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/examples/ex1/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1996-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/examples/ex2/Makefile erlang-17.3-dfsg/lib/snmp/examples/ex2/Makefile --- erlang-18.2-dfsg/lib/snmp/examples/ex2/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/examples/ex2/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2006-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/examples/ex2/snmp_ex2_manager.erl erlang-17.3-dfsg/lib/snmp/examples/ex2/snmp_ex2_manager.erl --- erlang-18.2-dfsg/lib/snmp/examples/ex2/snmp_ex2_manager.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/examples/ex2/snmp_ex2_manager.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/examples/ex2/snmp_ex2_simple_standard_test.erl erlang-17.3-dfsg/lib/snmp/examples/ex2/snmp_ex2_simple_standard_test.erl --- erlang-18.2-dfsg/lib/snmp/examples/ex2/snmp_ex2_simple_standard_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/examples/ex2/snmp_ex2_simple_standard_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/examples/Makefile erlang-17.3-dfsg/lib/snmp/examples/Makefile --- erlang-18.2-dfsg/lib/snmp/examples/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/examples/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/examples/subdirs.mk erlang-17.3-dfsg/lib/snmp/examples/subdirs.mk --- erlang-18.2-dfsg/lib/snmp/examples/subdirs.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/examples/subdirs.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/include/snmp_tables.hrl erlang-17.3-dfsg/lib/snmp/include/snmp_tables.hrl --- erlang-18.2-dfsg/lib/snmp/include/snmp_tables.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/include/snmp_tables.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/include/snmp_types.hrl erlang-17.3-dfsg/lib/snmp/include/snmp_types.hrl --- erlang-18.2-dfsg/lib/snmp/include/snmp_types.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/include/snmp_types.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/include/SNMPv2-TC.hrl erlang-17.3-dfsg/lib/snmp/include/SNMPv2-TC.hrl --- erlang-18.2-dfsg/lib/snmp/include/SNMPv2-TC.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/include/SNMPv2-TC.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/Makefile erlang-17.3-dfsg/lib/snmp/Makefile --- erlang-18.2-dfsg/lib/snmp/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1996-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/mibs/Makefile.in erlang-17.3-dfsg/lib/snmp/mibs/Makefile.in --- erlang-18.2-dfsg/lib/snmp/mibs/Makefile.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/mibs/Makefile.in 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1996-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/priv/conf/agent/files.mk erlang-17.3-dfsg/lib/snmp/priv/conf/agent/files.mk --- erlang-18.2-dfsg/lib/snmp/priv/conf/agent/files.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/priv/conf/agent/files.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2001-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/priv/conf/agent/Makefile erlang-17.3-dfsg/lib/snmp/priv/conf/agent/Makefile --- erlang-18.2-dfsg/lib/snmp/priv/conf/agent/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/priv/conf/agent/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1996-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/priv/conf/Makefile erlang-17.3-dfsg/lib/snmp/priv/conf/Makefile --- erlang-18.2-dfsg/lib/snmp/priv/conf/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/priv/conf/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/priv/conf/manager/files.mk erlang-17.3-dfsg/lib/snmp/priv/conf/manager/files.mk --- erlang-18.2-dfsg/lib/snmp/priv/conf/manager/files.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/priv/conf/manager/files.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/priv/conf/manager/Makefile erlang-17.3-dfsg/lib/snmp/priv/conf/manager/Makefile --- erlang-18.2-dfsg/lib/snmp/priv/conf/manager/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/priv/conf/manager/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/priv/conf/subdirs.mk erlang-17.3-dfsg/lib/snmp/priv/conf/subdirs.mk --- erlang-18.2-dfsg/lib/snmp/priv/conf/subdirs.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/priv/conf/subdirs.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/depend.mk erlang-17.3-dfsg/lib/snmp/src/agent/depend.mk --- erlang-18.2-dfsg/lib/snmp/src/agent/depend.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/depend.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/Makefile erlang-17.3-dfsg/lib/snmp/src/agent/Makefile --- erlang-18.2-dfsg/lib/snmp/src/agent/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1996-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/modules.mk erlang-17.3-dfsg/lib/snmp/src/agent/modules.mk --- erlang-18.2-dfsg/lib/snmp/src/agent/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_acm.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_acm.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_acm.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_acm.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_agent.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_agent.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_agent.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_agent.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_agent_sup.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_agent_sup.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_agent_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_agent_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_app.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_app.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_atl.hrl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_atl.hrl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_atl.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_atl.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_authentication_service.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_authentication_service.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_authentication_service.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_authentication_service.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_conf.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_conf.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_conf.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_conf.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_discovery_handler_default.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_discovery_handler_default.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_discovery_handler_default.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_discovery_handler_default.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_discovery_handler.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_discovery_handler.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_discovery_handler.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_discovery_handler.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_error.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_error.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_error.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_error.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_error_io.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_error_io.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_error_io.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_error_io.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_error_logger.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_error_logger.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_error_logger.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_error_logger.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_error_report.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_error_report.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_error_report.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_error_report.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_general_db.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_general_db.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_general_db.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_general_db.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_internal.hrl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_internal.hrl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_local_db.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_local_db.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_local_db.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_local_db.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_data.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_data.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_data.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_data.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_data_ttln.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_data_ttln.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_data_ttln.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_data_ttln.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_data_tttn.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_data_tttn.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_data_tttn.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_data_tttn.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_lib.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_lib.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_storage_dets.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_storage_dets.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_storage_dets.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_storage_dets.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_storage.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_storage.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_storage.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_storage.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_storage_ets.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_storage_ets.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_storage_ets.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_storage_ets.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_storage_mnesia.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_storage_mnesia.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mib_storage_mnesia.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mib_storage_mnesia.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_misc_sup.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_misc_sup.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_misc_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_misc_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mpd.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mpd.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_mpd.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_mpd.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -76,9 +75,8 @@ init(Vsns) -> ?vlog("init -> entry with" "~n Vsns: ~p", [Vsns]), - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A,B,C} = erlang:now(), + random:seed(A,B,C), ets:insert(snmp_agent_table, {msg_id, random:uniform(2147483647)}), ets:insert(snmp_agent_table, {req_id, random:uniform(2147483647)}), init_counters(), @@ -773,7 +771,21 @@ ContextEngineID, ContextName, SecData}, LocalEngineID, Log). +%% req_id(#scopedPdu{data = #pdu{request_id = ReqId}}) -> +%% ?vtrace("Report ReqId: ~p",[ReqId]), +%% ReqId; +%% req_id(_) -> +%% 0. % RFC2572, 7.1.3.c.4 + +%% maybe_generate_discovery1_report_msg() -> +%% case (catch DiscoveryHandler:handle_discovery1(Ip, Udp, EngineId)) of +%% {ok, Entry} when is_record(Entry, snmp_discovery_data1) -> +%% ok; +%% ignore -> +%% ok; +%% {error, Reason} -> + %% Response to stage 1 discovery message (terminating, i.e. from the manager) generate_discovery1_report_msg(MsgID, MsgSecurityModel, SecName, SecLevel, diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_net_if.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_net_if.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_net_if.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_net_if.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -298,14 +297,14 @@ Fd = list_to_integer(FdStr), ?vdebug("socket_open(~p, [~p | ~p]) Fd: ~p", [Domain, IpPort, Opts, Fd]), - gen_udp_open(0, [{fd, Fd} | Opts]); + gen_udp_open(IpPort, [{fd, Fd} | Opts]); error -> case init:get_argument(snmpa_fd) of {ok, [[FdStr]]} -> Fd = list_to_integer(FdStr), ?vdebug("socket_open(~p, [~p | ~p]) Fd: ~p", [Domain, IpPort, Opts, Fd]), - gen_udp_open(0, [{fd, Fd} | Opts]); + gen_udp_open(IpPort, [{fd, Fd} | Opts]); error -> ?vdebug("socket_open(~p, [~p | ~p])", [Domain, IpPort, Opts]), @@ -675,7 +674,7 @@ #state{mpd_state = MpdState, note_store = NS, log = Log} = S, #transport{socket = Socket} = Transport, From, Packet) -> - put(n1, erlang:monotonic_time(micro_seconds)), + put(n1, erlang:now()), LogF = fun(Type, Data) -> log(Log, Type, Data, From) @@ -1380,7 +1379,15 @@ %%% DEBUG FUNCTIONS %%%----------------------------------------------------------------- time_in_agent() -> - erlang:monotonic_time(micro_seconds) - get(n1). + subtr(erlang:now(), get(n1)). + +subtr({X1,Y1,Z1}, {X1,Y1,Z2}) -> + Z1 - Z2; +subtr({X1,Y1,Z1}, {X1,Y2,Z2}) -> + ((Y1-Y2) * 1000000) + (Z1 - Z2); +subtr({X1,Y1,Z1}, {X2,Y2,Z2}) -> + ((X1 - X2) * 1000000000000) + ((Y1 - Y2) * 1000000) + (Z1 - Z2). + %% ---------------------------------------------------------------- @@ -1630,3 +1637,10 @@ %% ---------------------------------------------------------------- + +% i(F) -> +% i(F, []). + +% i(F, A) -> +% io:format("~p: " ++ F ++ "~n", [?MODULE|A]). + diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_net_if_filter.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_net_if_filter.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_net_if_filter.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_net_if_filter.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_network_interface.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_network_interface.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_network_interface.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_network_interface.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_network_interface_filter.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_network_interface_filter.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_network_interface_filter.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_network_interface_filter.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_notification_delivery_info_receiver.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_notification_delivery_info_receiver.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_notification_delivery_info_receiver.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_notification_delivery_info_receiver.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_notification_filter.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_notification_filter.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_notification_filter.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_notification_filter.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_set.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_set.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_set.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_set.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_set_lib.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_set_lib.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_set_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_set_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_set_mechanism.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_set_mechanism.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_set_mechanism.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_set_mechanism.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_supervisor.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_supervisor.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_supervisor.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_supervisor.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_svbl.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_svbl.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_svbl.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_svbl.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_symbolic_store.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_symbolic_store.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_symbolic_store.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_symbolic_store.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_target_cache.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_target_cache.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_target_cache.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_target_cache.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_trap.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_trap.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_trap.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_trap.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_usm.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_usm.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_usm.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_usm.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -646,9 +645,8 @@ ets:insert(snmp_agent_table, {usm_des_salt, 0}), 0; _ -> % it doesn't exist, initialize - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A1,A2,A3} = erlang:now(), + random:seed(A1,A2,A3), R = random:uniform(4294967295), ets:insert(snmp_agent_table, {usm_des_salt, R}), R @@ -679,9 +677,8 @@ ets:insert(snmp_agent_table, {usm_aes_salt, 0}), 0; _ -> % it doesn't exist, initialize - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A1,A2,A3} = erlang:now(), + random:seed(A1,A2,A3), R = random:uniform(36893488147419103231), ets:insert(snmp_agent_table, {usm_aes_salt, R}), R diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_vacm.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_vacm.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_vacm.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_vacm.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -306,8 +305,8 @@ %% time dumping the table. unique_table_name(Pre) -> %% We want something that is guaranteed to be unique, - %% therefor we use erlang:timestamp() instead of os:timestamp() - unique_table_name(Pre, erlang:timestamp()). + %% therefor we use erlang:now() instead of os:timestamp() + unique_table_name(Pre, erlang:now()). unique_table_name(Pre, {_A, _B, C} = Now) -> {Date, Time} = calendar:now_to_datetime(Now), @@ -446,3 +445,6 @@ user_err(F, A) -> snmpa_error:user_err(F, A). + +% config_err(F, A) -> +% snmpa_error:config_err(F, A). diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_vacm.hrl erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_vacm.hrl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmpa_vacm.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmpa_vacm.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_community_mib.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_community_mib.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_community_mib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_community_mib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_framework_mib.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_framework_mib.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_framework_mib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_framework_mib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_generic.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_generic.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_generic.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_generic.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_generic_mnesia.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_generic_mnesia.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_generic_mnesia.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_generic_mnesia.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_index.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_index.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_index.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_index.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_notification_mib.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_notification_mib.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_notification_mib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_notification_mib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_shadow_table.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_shadow_table.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_shadow_table.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_shadow_table.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -77,7 +76,7 @@ end. update(Name, UpdateFunc, Interval) -> - CurrentTime = snmp_misc:now(ms), + CurrentTime = get_time(), case mnesia:dirty_read({time_stamp, Name}) of [#time_stamp{data = Expire}] when CurrentTime =< Expire -> ok; _ -> @@ -118,6 +117,9 @@ update(Name, UpdateFunc, Interval), snmp_generic:table_func(Op, RowIndex, Cols, {Name, mnesia}). +get_time() -> + {M,S,U} = erlang:now(), + 1000000000 * M + 1000 * S + (U div 1000). %%----------------------------------------------------------------- %% Urrk. @@ -181,3 +183,5 @@ error_msg(F, A) -> ?snmpa_error(F, A). + + diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_standard_mib.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_standard_mib.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_standard_mib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_standard_mib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -547,9 +546,8 @@ %%----------------------------------------------------------------- snmp_set_serial_no(new) -> snmp_generic:variable_func(new, {snmpSetSerialNo, volatile}), - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A1,A2,A3} = erlang:now(), + random:seed(A1,A2,A3), Val = random:uniform(2147483648) - 1, snmp_generic:variable_func(set, Val, {snmpSetSerialNo, volatile}); diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_target_mib.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_target_mib.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_target_mib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_target_mib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2015. All Rights Reserved. +%% Copyright Ericsson AB 1998-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -347,6 +346,13 @@ error({invalid_target_params, X}). + +%% maybe_create_table(Name) -> +%% case snmpa_local_db:table_exists(db(Name)) of +%% true -> ok; +%% _ -> snmpa_local_db:table_create(db(Name)) +%% end. + init_tabs(Addrs, Params) -> ?vdebug("create target address table",[]), AddrDB = db(snmpTargetAddrTable), @@ -673,9 +679,8 @@ snmpTargetSpinLock(new) -> snmp_generic:variable_func(new, {snmpTargetSpinLock, volatile}), - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A1,A2,A3} = erlang:now(), + random:seed(A1,A2,A3), Val = random:uniform(2147483648) - 1, snmp_generic:variable_func(set, Val, {snmpTargetSpinLock, volatile}); @@ -1075,3 +1080,5 @@ config_err(F, A) -> snmpa_error:config_err("[TARGET-MIB]: " ++ F, A). + + diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_user_based_sm_mib.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_user_based_sm_mib.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_user_based_sm_mib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_user_based_sm_mib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -440,9 +439,8 @@ usmUserSpinLock(new) -> snmp_generic:variable_func(new, {usmUserSpinLock, volatile}), - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A1,A2,A3} = erlang:now(), + random:seed(A1,A2,A3), Val = random:uniform(2147483648) - 1, snmp_generic:variable_func(set, Val, {usmUserSpinLock, volatile}); @@ -1193,7 +1191,29 @@ -define(i8(Int), Int band 255). mk_random(Len) when Len =< 20 -> - binary_to_list(crypto:strong_rand_bytes(Len)). + %% Use of yield(): + %% This will either schedule another process, or fail and invoke + %% the error_handler (in old versions). In either case, it is + %% safe to assume that now, reductions and garbage_collection have + %% changed in a non-deterministically way. + {_,_,A} = erlang:now(), + catch erlang:yield(), + {_,_,B} = erlang:now(), + catch erlang:yield(), + {_,_,C} = erlang:now(), + {D,_} = erlang:statistics(reductions), + {E,_} = erlang:statistics(runtime), + {F,_} = erlang:statistics(wall_clock), + {G,H,_} = erlang:statistics(garbage_collection), + catch erlang:yield(), + {_,_,C2} = erlang:now(), + {D2,_} = erlang:statistics(reductions), + {_,H2,_} = erlang:statistics(garbage_collection), + %% X(N) means we can use N bits from variable X: + %% A(16) B(16) C(16) D(16) E(8) F(16) G(8) H(16) + Rnd20 = [?i16(A),?i16(B),?i16(C),?i16(D),?i8(E),?i16(F), + ?i8(G),?i16(H),?i16(C2),?i16(D2),?i16(H2)], + lists:sublist(Rnd20, Len). split(0, Rest, FirstRev) -> {lists:reverse(FirstRev), Rest}; diff -Nru erlang-18.2-dfsg/lib/snmp/src/agent/snmp_view_based_acm_mib.erl erlang-17.3-dfsg/lib/snmp/src/agent/snmp_view_based_acm_mib.erl --- erlang-18.2-dfsg/lib/snmp/src/agent/snmp_view_based_acm_mib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/agent/snmp_view_based_acm_mib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -846,9 +845,8 @@ vacmViewSpinLock(new) -> snmp_generic:variable_func(new, volatile_db(vacmViewSpinLock)), - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A1,A2,A3} = erlang:now(), + random:seed(A1,A2,A3), Val = random:uniform(2147483648) - 1, snmp_generic:variable_func(set, Val, volatile_db(vacmViewSpinLock)); @@ -1135,3 +1133,4 @@ config_err(F, A) -> snmpa_error:config_err("[VIEW-BASED-ACM-MIB]: " ++ F, A). + diff -Nru erlang-18.2-dfsg/lib/snmp/src/app/depend.mk erlang-17.3-dfsg/lib/snmp/src/app/depend.mk --- erlang-18.2-dfsg/lib/snmp/src/app/depend.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/app/depend.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/app/Makefile erlang-17.3-dfsg/lib/snmp/src/app/Makefile --- erlang-18.2-dfsg/lib/snmp/src/app/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/app/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2003-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/app/modules.mk erlang-17.3-dfsg/lib/snmp/src/app/modules.mk --- erlang-18.2-dfsg/lib/snmp/src/app/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/app/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/app/snmp_app.erl erlang-17.3-dfsg/lib/snmp/src/app/snmp_app.erl --- erlang-18.2-dfsg/lib/snmp/src/app/snmp_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/app/snmp_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/app/snmp.app.src erlang-17.3-dfsg/lib/snmp/src/app/snmp.app.src --- erlang-18.2-dfsg/lib/snmp/src/app/snmp.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/app/snmp.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -138,5 +137,5 @@ %% before snmp. {applications, [kernel, stdlib]}, {mod, {snmp_app, []}}, - {runtime_dependencies, ["stdlib-2.5","runtime_tools-1.8.14","mnesia-4.12", + {runtime_dependencies, ["stdlib-2.0","runtime_tools-1.8.14","mnesia-4.12", "kernel-3.0","erts-6.0","crypto-3.3"]}]}. diff -Nru erlang-18.2-dfsg/lib/snmp/src/app/snmp_app_sup.erl erlang-17.3-dfsg/lib/snmp/src/app/snmp_app_sup.erl --- erlang-18.2-dfsg/lib/snmp/src/app/snmp_app_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/app/snmp_app_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/app/snmp.appup.src erlang-17.3-dfsg/lib/snmp/src/app/snmp.appup.src --- erlang-18.2-dfsg/lib/snmp/src/app/snmp.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/app/snmp.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,16 +28,9 @@ %% {update, snmpa_local_db, soft, soft_purge, soft_purge, []} %% {add_module, snmpm_net_if_mt} [ - {"5.2", [{load_module, snmp_conf, soft_purge, soft_purge, []}]}, - {"5.1.2", [ % Only runtime dependencies change - ]}, - {"5.1.1", [{restart_application, snmp}]}, - {"5.1", [ % Only compiler changes - ]}, {"5.0", [{restart_application, snmp}]}, {"4.25.1", [{restart_application, snmp}]}, {"4.25.0.1", [{restart_application, snmp}]}, - {"4.25.0.0.1", [{restart_application, snmp}]}, {"4.25", [{restart_application, snmp}]}, {"4.24.2", [{restart_application, snmp}]}, {"4.24.1", [{restart_application, snmp}]}, @@ -51,16 +43,9 @@ %% {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} [ - {"5.2", [{load_module, snmp_conf, soft_purge, soft_purge, []}]}, - {"5.1.2", [ % Only runtime dependencies change - ]}, - {"5.1.1", [{restart_application, snmp}]}, - {"5.1", [ % Only compiler changes - ]}, {"5.0", [{restart_application, snmp}]}, {"4.25.1", [{restart_application, snmp}]}, {"4.25.0.1", [{restart_application, snmp}]}, - {"4.25.0.0.1", [{restart_application, snmp}]}, {"4.25", [{restart_application, snmp}]}, {"4.24.2", [{restart_application, snmp}]}, {"4.24.1", [{restart_application, snmp}]}, diff -Nru erlang-18.2-dfsg/lib/snmp/src/app/snmp.erl erlang-17.3-dfsg/lib/snmp/src/app/snmp.erl --- erlang-18.2-dfsg/lib/snmp/src/app/snmp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/app/snmp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/app/snmp_internal.hrl erlang-17.3-dfsg/lib/snmp/src/app/snmp_internal.hrl --- erlang-18.2-dfsg/lib/snmp/src/app/snmp_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/app/snmp_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/depend.mk erlang-17.3-dfsg/lib/snmp/src/compile/depend.mk --- erlang-18.2-dfsg/lib/snmp/src/compile/depend.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/depend.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/Makefile erlang-17.3-dfsg/lib/snmp/src/compile/Makefile --- erlang-18.2-dfsg/lib/snmp/src/compile/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/modules.mk erlang-17.3-dfsg/lib/snmp/src/compile/modules.mk --- erlang-18.2-dfsg/lib/snmp/src/compile/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/snmpc.erl erlang-17.3-dfsg/lib/snmp/src/compile/snmpc.erl --- erlang-18.2-dfsg/lib/snmp/src/compile/snmpc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/snmpc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -410,9 +409,8 @@ %%---------------------------------------------------------------------- init(From, MibFileName, Options) -> - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A,B,C} = now(), + random:seed(A,B,C), put(options, Options), put(verbosity, get_verbosity(Options)), put(description, get_description(Options)), diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/snmpc.hrl erlang-17.3-dfsg/lib/snmp/src/compile/snmpc.hrl --- erlang-18.2-dfsg/lib/snmp/src/compile/snmpc.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/snmpc.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_lib.erl erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_lib.erl --- erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -140,7 +139,6 @@ allow_size_rfc1902('Unsigned32') -> true; allow_size_rfc1902('OCTET STRING') -> true; allow_size_rfc1902('Gauge32') -> true; -allow_size_rfc1902('Opaque') -> true; allow_size_rfc1902(_) -> false. guess_integer_type() -> diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_lib.hrl erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_lib.hrl --- erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_lib.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_lib.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_mib_gram.yrl erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_mib_gram.yrl --- erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_mib_gram.yrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_mib_gram.yrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_mib_to_hrl.erl erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_mib_to_hrl.erl --- erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_mib_to_hrl.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_mib_to_hrl.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_misc.erl erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_misc.erl --- erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_misc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_misc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_misc.hrl erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_misc.hrl --- erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_misc.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_misc.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/snmpc.src erlang-17.3-dfsg/lib/snmp/src/compile/snmpc.src --- erlang-18.2-dfsg/lib/snmp/src/compile/snmpc.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/snmpc.src 2014-09-16 19:10:57.000000000 +0000 @@ -5,17 +5,16 @@ %% %% Copyright Ericsson AB 2008-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_tok.erl erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_tok.erl --- erlang-18.2-dfsg/lib/snmp/src/compile/snmpc_tok.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/compile/snmpc_tok.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/Makefile erlang-17.3-dfsg/lib/snmp/src/Makefile --- erlang-18.2-dfsg/lib/snmp/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/depend.mk erlang-17.3-dfsg/lib/snmp/src/manager/depend.mk --- erlang-18.2-dfsg/lib/snmp/src/manager/depend.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/depend.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/Makefile erlang-17.3-dfsg/lib/snmp/src/manager/Makefile --- erlang-18.2-dfsg/lib/snmp/src/manager/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/modules.mk erlang-17.3-dfsg/lib/snmp/src/manager/modules.mk --- erlang-18.2-dfsg/lib/snmp/src/manager/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_atl.hrl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_atl.hrl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_atl.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_atl.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_conf.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_conf.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_conf.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_conf.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_config.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_config.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_config.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_config.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -521,7 +520,7 @@ -%% --- asynchronous get-request --- +%% --- asynchroneous get-request --- %% %% The reply will be delivered to the user %% through a call to handle_pdu/5 @@ -589,7 +588,7 @@ %% -%% --- asynchronous get_next-request --- +%% --- asynchroneous get_next-request --- %% async_get_next2(UserId, TargetName, Oids) -> @@ -655,7 +654,7 @@ %% -%% --- asynchronous set-request --- +%% --- asynchroneous set-request --- %% async_set2(UserId, TargetName, VarsAndVals) -> @@ -747,7 +746,7 @@ %% -%% --- asynchronous get-bulk --- +%% --- asynchroneous get-bulk --- %% async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) -> diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_internal.hrl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_internal.hrl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_misc_sup.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_misc_sup.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_misc_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_misc_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_mpd.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_mpd.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_mpd.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_mpd.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -68,9 +67,8 @@ %%%----------------------------------------------------------------- init(Vsns) -> ?vdebug("init -> entry with ~p", [Vsns]), - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A,B,C} = erlang:now(), + random:seed(A,B,C), snmpm_config:cre_counter(msg_id, random:uniform(2147483647)), snmpm_config:cre_counter(req_id, random:uniform(2147483647)), init_counters(), @@ -898,6 +896,17 @@ is_known_engine_id(EngineID, {Addr, Port}) -> snmpm_config:is_known_engine_id(EngineID, Addr, Port). +%% is_known_engine_id(EngineID, Addr, Port) -> +%% snmpm_config:is_known_engine_id(EngineID, Addr, Port). + +% get_agent_engine_id(Addr, Port) -> +% case snmpm_config:get_agent_engine_id(Addr, Port) of +% {ok, Id} -> +% Id; +% _Error -> +% "" +% end. + %%----------------------------------------------------------------- %% Sequence number (msg-id & req-id) functions diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_net_if.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_net_if.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_net_if.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_net_if.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -320,7 +319,7 @@ Socket end. -socket_params(Domain, {IpAddr, IpPort} = Addr, BindTo, CommonSocketOpts) -> +socket_params(Domain, {IpAddr, IpPort}, BindTo, CommonSocketOpts) -> Family = snmp_conf:tdomain_to_family(Domain), SocketOpts = case Family of @@ -331,7 +330,7 @@ end, case Family of inet -> - case init:get_argument(snmpm_fd) of + case init:get_argument(snmp_fd) of {ok, [[FdStr]]} -> Fd = list_to_integer(FdStr), case BindTo of @@ -341,18 +340,15 @@ {0, [{fd, Fd} | SocketOpts]} end; error -> - socket_params(SocketOpts, Addr, BindTo) + {IpPort, [{ip, IpAddr} | SocketOpts]} end; _ -> - socket_params(SocketOpts, Addr, BindTo) - end. -%% -socket_params(SocketOpts, {IpAddr, IpPort}, BindTo) -> - case BindTo of - true -> - {IpPort, [{ip, IpAddr} | SocketOpts]}; - _ -> - {IpPort, SocketOpts} + case BindTo of + true -> + {IpPort, [{ip, IpAddr} | SocketOpts]}; + _ -> + {IpPort, SocketOpts} + end end. common_socket_opts(Opts) -> @@ -490,6 +486,11 @@ put(verbosity, Verbosity), {reply, ok, State}; +%% handle_call({system_info_updated, What}, _From, State) -> +%% ?vlog("received system_info_updated request with What = ~p", [What]), +%% {NewState, Reply} = handle_system_info_updated(State, What), +%% {reply, Reply, NewState}; + handle_call(get_log_type, _From, State) -> ?vlog("received get-log-type request", []), Reply = (catch handle_get_log_type(State)), @@ -812,7 +813,7 @@ ok; [] -> RePdu = make_response_pdu(Pdu), - Expire = snmp_misc:now(ms) + To, + Expire = t() + To, Rec = {Key, Expire, {Vsn, ACM, RePdu}}, ets:insert(snmpm_inform_request_table, Rec) end. @@ -872,7 +873,7 @@ handle_inform_response_gc(#state{irb = IRB} = State) -> ets:safe_fixtable(snmpm_inform_request_table, true), - do_irgc(ets:first(snmpm_inform_request_table), snmp_misc:now(ms)), + do_irgc(ets:first(snmpm_inform_request_table), t()), ets:safe_fixtable(snmpm_inform_request_table, false), State#state{irgc = irgc_start(IRB)}. @@ -1019,6 +1020,110 @@ State. +%% mk_discovery_msg('version-3', Pdu, _VsnHdr, UserName) -> +%% ScopedPDU = #scopedPdu{contextEngineID = "", +%% contextName = "", +%% data = Pdu}, +%% Bytes = snmp_pdus:enc_scoped_pdu(ScopedPDU), +%% MsgID = get(msg_id), +%% put(msg_id,MsgID+1), +%% UsmSecParams = +%% #usmSecurityParameters{msgAuthoritativeEngineID = "", +%% msgAuthoritativeEngineBoots = 0, +%% msgAuthoritativeEngineTime = 0, +%% msgUserName = UserName, +%% msgPrivacyParameters = "", +%% msgAuthenticationParameters = ""}, +%% SecBytes = snmp_pdus:enc_usm_security_parameters(UsmSecParams), +%% PduType = Pdu#pdu.type, +%% Hdr = #v3_hdr{msgID = MsgID, +%% msgMaxSize = 1000, +%% msgFlags = snmp_misc:mk_msg_flags(PduType, 0), +%% msgSecurityModel = ?SEC_USM, +%% msgSecurityParameters = SecBytes}, +%% Msg = #message{version = 'version-3', vsn_hdr = Hdr, data = Bytes}, +%% case (catch snmp_pdus:enc_message_only(Msg)) of +%% {'EXIT', Reason} -> +%% error("Encoding error. Pdu: ~w. Reason: ~w",[Pdu, Reason]), +%% error; +%% L when list(L) -> +%% {Msg, L} +%% end; +%% mk_discovery_msg(Version, Pdu, {Com, _, _, _, _}, UserName) -> +%% Msg = #message{version = Version, vsn_hdr = Com, data = Pdu}, +%% case catch snmp_pdus:enc_message(Msg) of +%% {'EXIT', Reason} -> +%% error("Encoding error. Pdu: ~w. Reason: ~w",[Pdu, Reason]), +%% error; +%% L when list(L) -> +%% {Msg, L} +%% end. + + +%% mk_msg('version-3', Pdu, {Context, User, EngineID, CtxEngineId, SecLevel}, +%% MsgData) -> +%% %% Code copied from snmp_mpd.erl +%% {MsgId, SecName, SecData} = +%% if +%% tuple(MsgData), Pdu#pdu.type == 'get-response' -> +%% MsgData; +%% true -> +%% Md = get(msg_id), +%% put(msg_id, Md + 1), +%% {Md, User, []} +%% end, +%% ScopedPDU = #scopedPdu{contextEngineID = CtxEngineId, +%% contextName = Context, +%% data = Pdu}, +%% ScopedPDUBytes = snmp_pdus:enc_scoped_pdu(ScopedPDU), + +%% PduType = Pdu#pdu.type, +%% V3Hdr = #v3_hdr{msgID = MsgId, +%% msgMaxSize = 1000, +%% msgFlags = snmp_misc:mk_msg_flags(PduType, SecLevel), +%% msgSecurityModel = ?SEC_USM}, +%% Message = #message{version = 'version-3', vsn_hdr = V3Hdr, +%% data = ScopedPDUBytes}, +%% SecEngineID = case PduType of +%% 'get-response' -> snmp_framework_mib:get_engine_id(); +%% _ -> EngineID +%% end, +%% case catch snmp_usm:generate_outgoing_msg(Message, SecEngineID, +%% SecName, SecData, SecLevel) of +%% {'EXIT', Reason} -> +%% error("Encoding error. Pdu: ~w. Reason: ~w",[Pdu, Reason]), +%% error; +%% {error, Reason} -> +%% error("Encoding error. Pdu: ~w. Reason: ~w",[Pdu, Reason]), +%% error; +%% Packet -> +%% Packet +%% end; +%% mk_msg(Version, Pdu, {Com, _User, _EngineID, _Ctx, _SecLevel}, _SecData) -> +%% Msg = #message{version = Version, vsn_hdr = Com, data = Pdu}, +%% case catch snmp_pdus:enc_message(Msg) of +%% {'EXIT', Reason} -> +%% error("Encoding error. Pdu: ~w. Reason: ~w",[Pdu, Reason]), +%% error; +%% B when list(B) -> +%% B +%% end. + + +%% handle_system_info_updated(#state{log = {Log, _OldType}} = State, +%% audit_trail_log_type = _What) -> +%% %% Just to make sure, check that ATL is actually enabled +%% case snmpm_config:system_info(audit_trail_log) of +%% {ok, true} -> +%% {ok, Type} = snmpm_config:system_info(audit_trail_log_type), +%% NewState = State#state{log = {Log, Type}}, +%% {NewState, ok}; +%% _ -> +%% {State, {error, {adt_not_enabled}}} +%% end; +%% handle_system_info_updated(_State, _What) -> +%% ok. + handle_get_log_type(#state{log = {_Log, Value}} = State) -> %% Just to make sure, check that ATL is actually enabled case snmpm_config:system_info(audit_trail_log) of @@ -1149,6 +1254,13 @@ %% ------------------------------------------------------------------- +t() -> + {A,B,C} = erlang:now(), + A*1000000000+B*1000+(C div 1000). + + +%% ------------------------------------------------------------------- + %% info_msg(F, A) -> %% ?snmpm_info("NET-IF server: " ++ F, A). @@ -1186,6 +1298,8 @@ _ -> undefined end. +%% proc_mem(_) -> +%% undefined. get_port_info(Id) -> @@ -1265,6 +1379,20 @@ inc(Name) -> inc(Name, 1). inc(Name, N) -> snmpm_config:incr_stats_counter(Name, N). +%% get_counters() -> +%% Counters = counters(), +%% get_counters(Counters, []). + +%% get_counters([], Acc) -> +%% lists:reverse(Acc); +%% get_counters([Counter|Counters], Acc) -> +%% case snmpm_config:get_stats_counter(Counter) of +%% {ok, CounterVal} -> +%% get_counters(Counters, [{Counter, CounterVal}|Acc]); +%% _ -> +%% get_counters(Counters, Acc) +%% end. + %% ---------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_net_if_filter.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_net_if_filter.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_net_if_filter.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_net_if_filter.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_net_if_mt.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_net_if_mt.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_net_if_mt.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_net_if_mt.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_network_interface.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_network_interface.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_network_interface.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_network_interface.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_network_interface_filter.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_network_interface_filter.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_network_interface_filter.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_network_interface_filter.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_server.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_server.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -468,6 +467,27 @@ call({cancel_async_request, UserId, ReqId}). +%% discovery(UserId, BAddr) -> +%% discovery(UserId, BAddr, ?SNMP_AGENT_PORT, [], +%% ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO). + +%% discovery(UserId, BAddr, Config) when is_list(Config) -> +%% discovery(UserId, BAddr, ?SNMP_AGENT_PORT, Config, +%% ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO); + +%% discovery(UserId, BAddr, Expire) when is_integer(Expire) -> +%% discovery(UserId, BAddr, ?SNMP_AGENT_PORT, [], Expire, ?EXTRA_INFO). + +%% discovery(UserId, BAddr, Config, Expire) -> +%% discovery(UserId, BAddr, ?SNMP_AGENT_PORT, Config, Expire, ?EXTRA_INFO). + +%% discovery(UserId, BAddr, Port, Config, Expire) -> +%% discovery(UserId, BAddr, Port, Config, Expire, ?EXTRA_INFO). + +%% discovery(UserId, BAddr, Port, Config, Expire, ExtraInfo) -> +%% call({discovery, self(), UserId, BAddr, Port, Config, Expire, ExtraInfo}). + + verbosity(Verbosity) -> case ?vvalidate(Verbosity) of Verbosity -> @@ -907,6 +927,14 @@ {reply, Reply, State}; +%% handle_call({discovery, Pid, UserId, BAddr, Port, Config, Expire, ExtraInfo}, +%% _From, State) -> +%% ?vlog("received discovery request", []), +%% Reply = (catch handle_discovery(Pid, UserId, BAddr, Port, Config, +%% Expire, ExtraInfo, State)), +%% {reply, Reply, State}; + + handle_call({load_mib, Mib}, _From, State) -> ?vlog("received load_mib request", []), case snmpm_config:load_mib(Mib) of @@ -960,6 +988,13 @@ IsStarted = is_started(State), {reply, IsStarted, State}; +%% handle_call({system_info_updated, Target, What}, _From, State) -> +%% ?vlog("received system_info_updated request: " +%% "~n Target: ~p" +%% "~n What: ~p", [Target, What]), +%% Reply = handle_system_info_updated(State, Target, What), +%% {reply, Reply, State}; + handle_call(get_log_type, _From, State) -> ?vlog("received get_log_type request", []), Reply = handle_get_log_type(State), @@ -1007,6 +1042,11 @@ handle_snmp_error(Domain, Addr, ReqId, Reason, State), {noreply, State}; +%% handle_info({snmp_error, ReqId, Pdu, Reason, Addr, Port}, State) -> +%% ?vlog("received snmp_error message", []), +%% handle_snmp_error(Pdu, ReqId, Reason, Addr, Port, State), +%% {noreply, State}; + handle_info({snmp_pdu, Pdu, Domain, Addr}, State) -> ?vlog("received snmp_pdu message", []), @@ -1371,7 +1411,7 @@ address = Addr, type = get, data = MsgData, - expire = snmp_misc:now(ms) + Expire}, + expire = t() + Expire}, ets:insert(snmpm_request_table, Req), gct_activate(State#state.gct), @@ -1420,7 +1460,7 @@ address = Addr, type = get_next, data = MsgData, - expire = snmp_misc:now(ms) + Expire}, + expire = t() + Expire}, ets:insert(snmpm_request_table, Req), gct_activate(State#state.gct), @@ -1476,7 +1516,7 @@ address = Addr, type = get_bulk, data = MsgData, - expire = snmp_misc:now(ms) + Expire}, + expire = t() + Expire}, ets:insert(snmpm_request_table, Req), gct_activate(State#state.gct), {ok, ReqId}; @@ -1524,7 +1564,7 @@ address = Addr, type = set, data = MsgData, - expire = snmp_misc:now(ms) + Expire}, + expire = t() + Expire}, ets:insert(snmpm_request_table, Req), gct_activate(State#state.gct), @@ -1560,6 +1600,18 @@ ?vlog("handle_cancel_async_request -> not found", []), {error, not_found} end. + + +%% handle_system_info_updated(#state{net_if = Pid, net_if_mod = Mod} = _State, +%% net_if = _Target, What) -> +%% case (catch Mod:system_info_updated(Pid, What)) of +%% {'EXIT', _} -> +%% {error, not_supported}; +%% Else -> +%% Else +%% end; +%% handle_system_info_updated(_State, Target, What) -> +%% {error, {bad_target, Target, What}}. handle_get_log_type(#state{net_if = Pid, net_if_mod = Mod}) -> case (catch Mod:get_log_type(Pid)) of @@ -1577,6 +1629,47 @@ Else end. + +%% handle_discovery(Pid, UserId, BAddr, Port, Config, Expire, ExtraInfo, State) -> +%% ?vtrace("handle_discovery -> entry with" +%% "~n Pid: ~p" +%% "~n UserId: ~p" +%% "~n BAddr: ~p" +%% "~n Port: ~p" +%% "~n Config: ~p" +%% "~n Expire: ~p", +%% [Pid, UserId, BAddr, Port, Config, Expire]), +%% case agent_data(default, default, "", Config) of +%% {ok, Addr, Port, Vsn, MsgData} -> +%% ?vtrace("handle_discovery -> send a ~p disco message", [Vsn]), +%% ReqId = send_discovery(Vsn, MsgData, BAddr, Port, ExtraInfo, +%% State), +%% ?vdebug("handle_discovery -> ReqId: ~p", [ReqId]), +%% MonRef = erlang:monitor(process, Pid), +%% ?vtrace("handle_discovery -> MonRef: ~p", [MonRef]), +%% Req = #request{id = ReqId, +%% user_id = UserId, +%% target = TargetName, +%% addr = BAddr, +%% port = Port, +%% type = get, +%% data = MsgData, +%% mon = MonRef, +%% discovery = true, +%% expire = t() + Expire}, +%% ets:insert(snmpm_request_table, Req), +%% gct_activate(State#state.gct), +%% {ok, ReqId}; + +%% Error -> +%% ?vinfo("failed retrieving agent data for discovery (get):" +%% "~n BAddr: ~p" +%% "~n Port: ~p" +%% "~n Error: ~p", [BAddr, Port, Error]), +%% Error +%% end. + + handle_sync_timeout(ReqId, From, State) -> ?vtrace("handle_sync_timeout -> entry with" "~n ReqId: ~p" @@ -1600,7 +1693,7 @@ Req = Req0#request{ref = undefined, mon = undefined, from = undefined, - expire = snmp_misc:now(ms)}, + expire = t()}, ets:insert(snmpm_request_table, Req), gct_activate(State#state.gct), ok; @@ -2023,8 +2116,7 @@ ok; InvalidResult -> - CallbackArgs = - [Domain_or_Ip, Addr_or_Port, Type, SnmpInfo, DefData], + CallbackArgs = [Domain, Addr, Type, SnmpInfo, DefData], handle_invalid_result(handle_agent, CallbackArgs, InvalidResult) catch @@ -2120,8 +2212,7 @@ end; T:E -> - CallbackArgs = - [Domain_or_Ip, Addr_or_Port, Type, SnmpInfo, DefData], + CallbackArgs = [Domain, Addr, Type, SnmpInfo, DefData], handle_invalid_result(handle_agent, CallbackArgs, T, E) end. @@ -2933,7 +3024,7 @@ handle_gc(GCT) -> ets:safe_fixtable(snmpm_request_table, true), - case do_gc(ets:first(snmpm_request_table), snmp_misc:now(ms)) of + case do_gc(ets:first(snmpm_request_table), t()) of 0 -> gct_deactivate(GCT); _ -> @@ -3007,11 +3098,23 @@ Mod:send_pdu(NetIf, Pdu, Vsn, MsgData, Domain, Addr, ExtraInfo), Pdu#pdu.request_id. +%% send_discovery(Vsn, MsgData, Addr, Port, ExtraInfo, +%% #state{net_if = NetIf, +%% net_if_mod = Mod}) -> +%% Pdu = make_discovery_pdu(), +%% Mod:send_pdu(NetIf, Pdu, Vsn, MsgData, Addr, Port, ExtraInfo), +%% Pdu#pdu.request_id. + + %%---------------------------------------------------------------------- %% %%---------------------------------------------------------------------- +%% make_discovery_pdu() -> +%% Oids = [?sysObjectID_instance, ?sysDescr_instance, ?sysUpTime_instance], +%% make_pdu_impl(get, Oids). + make_pdu(set, VarsAndVals, MiniMIB) -> VBs = [var_and_value_to_varbind(VAV, MiniMIB) || VAV <- VarsAndVals], make_pdu_impl(set, VBs); @@ -3294,7 +3397,7 @@ gct(State, Timeout). gct(#gct{parent = Parent, state = active} = State, Timeout) -> - T = snmp_misc:now(ms), + T = t(), receive {stop, Parent} -> ok; @@ -3352,7 +3455,7 @@ end. new_timeout(T1, T2) -> - case T1 - (snmp_misc:now(ms) - T2) of + case T1 - (t() - T2) of T when (T > 0) -> T; _ -> @@ -3372,6 +3475,11 @@ maybe_demonitor(MonRef) -> erlang:demonitor(MonRef). +%% Time in milli seconds +t() -> + {A,B,C} = erlang:now(), + A*1000000000+B*1000+(C div 1000). + mk_target_name(Domain, Addr, Config) -> snmpm_config:mk_target_name(Domain, Addr, Config). @@ -3410,6 +3518,12 @@ call(Req, To) -> gen_server:call(?SERVER, Req, To). +%% cast(Msg) -> +%% gen_server:cast(?SERVER, Msg). + +%% info_msg(F, A) -> +%% ?snmpm_info("Server: " ++ F, A). + warning_msg(F, A) -> ?snmpm_warning("Server: " ++ F, A). @@ -3485,3 +3599,20 @@ %%---------------------------------------------------------------------- + + +%%---------------------------------------------------------------------- +%% Debug +%%---------------------------------------------------------------------- + +% sz(L) when is_list(L) -> +% length(lists:flatten(L)); +% sz(B) when is_binary(B) -> +% size(B). + +%% p(F) -> +%% p(F, []). + +%% p(F, A) -> +%% io:format("~w:" ++ F ++ "~n", [?MODULE | A]). + diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_server_sup.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_server_sup.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_server_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_server_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_supervisor.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_supervisor.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_supervisor.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_supervisor.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_user_default.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_user_default.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_user_default.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_user_default.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_user.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_user.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_user.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_user.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_user_old.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_user_old.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_user_old.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_user_old.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_usm.erl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_usm.erl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_usm.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_usm.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_usm.hrl erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_usm.hrl --- erlang-18.2-dfsg/lib/snmp/src/manager/snmpm_usm.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/manager/snmpm_usm.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/depend.mk erlang-17.3-dfsg/lib/snmp/src/misc/depend.mk --- erlang-18.2-dfsg/lib/snmp/src/misc/depend.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/depend.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/Makefile erlang-17.3-dfsg/lib/snmp/src/misc/Makefile --- erlang-18.2-dfsg/lib/snmp/src/misc/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2003-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/modules.mk erlang-17.3-dfsg/lib/snmp/src/misc/modules.mk --- erlang-18.2-dfsg/lib/snmp/src/misc/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_conf.erl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_conf.erl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_conf.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_conf.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -1005,8 +1004,6 @@ do_check_imask(IMask), {ok, IMask}. -do_check_imask([]) -> - ok; do_check_imask([0|IMask]) -> do_check_imask(IMask); do_check_imask([1|IMask]) -> diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_config.erl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_config.erl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_config.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_config.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_debug.hrl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_debug.hrl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_debug.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_debug.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_log.erl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_log.erl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_log.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_log.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_mini_mib.erl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_mini_mib.erl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_mini_mib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_mini_mib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_misc.erl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_misc.erl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_misc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_misc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -102,14 +101,21 @@ %% Returns time in ms = sec/1000 % now() -> now(ms). now(ms) -> - erlang:monotonic_time(milli_seconds); - + Now = erlang:now(), + element(1,Now)*1000000000+ + element(2,Now)*1000+ + (element(3,Now) div 1000); %% Returns time in cs = sec/100 now(cs) -> - erlang:monotonic_time(100); - + Now = erlang:now(), + element(1,Now)*100000000+ + element(2,Now)*100+ + (element(3,Now) div 10000); now(sec) -> - erlang:monotonic_time(seconds). + Now = erlang:now(), + element(1,Now)*1000000+ + element(2,Now)+ + (element(3,Now) div 1000000). is_crypto_supported(Alg) -> @@ -473,3 +479,7 @@ io_lib:format("~w", [NVal]); format_val(_, _, Val, _MiniMib) -> io_lib:format("~p", [Val]). + + + + diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_note_store.erl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_note_store.erl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_note_store.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_note_store.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_pdus.erl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_pdus.erl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_pdus.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_pdus.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_usm.erl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_usm.erl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_usm.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_usm.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_verbosity.erl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_verbosity.erl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_verbosity.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_verbosity.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2015. All Rights Reserved. +%% Copyright Ericsson AB 2000-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -70,7 +69,7 @@ timestamp() -> - format_timestamp(os:timestamp()). + format_timestamp(now()). format_timestamp({_N1, _N2, N3} = Now) -> {Date, Time} = calendar:now_to_datetime(Now), @@ -163,3 +162,4 @@ validate(debug) -> debug; validate(trace) -> trace; validate(_) -> silence. + diff -Nru erlang-18.2-dfsg/lib/snmp/src/misc/snmp_verbosity.hrl erlang-17.3-dfsg/lib/snmp/src/misc/snmp_verbosity.hrl --- erlang-18.2-dfsg/lib/snmp/src/misc/snmp_verbosity.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/misc/snmp_verbosity.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/src/subdirs.mk erlang-17.3-dfsg/lib/snmp/src/subdirs.mk --- erlang-18.2-dfsg/lib/snmp/src/subdirs.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/src/subdirs.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2003-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/subdirs.mk erlang-17.3-dfsg/lib/snmp/subdirs.mk --- erlang-18.2-dfsg/lib/snmp/subdirs.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/subdirs.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2003-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_bl_test.erl erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_bl_test.erl --- erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_bl_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_bl_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_ms_test.erl erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_ms_test.erl --- erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_ms_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_ms_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_mt_test.erl erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_mt_test.erl --- erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_mt_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_mt_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_v1_test.erl erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_v1_test.erl --- erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_v1_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_v1_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_v2_test.erl erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_v2_test.erl --- erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_v2_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_v2_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_v3_test.erl erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_v3_test.erl --- erlang-18.2-dfsg/lib/snmp/test/exp/snmp_agent_v3_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/exp/snmp_agent_v3_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/klas3.erl erlang-17.3-dfsg/lib/snmp/test/klas3.erl --- erlang-18.2-dfsg/lib/snmp/test/klas3.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/klas3.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/Makefile erlang-17.3-dfsg/lib/snmp/test/Makefile --- erlang-18.2-dfsg/lib/snmp/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1997-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/test/modules.mk erlang-17.3-dfsg/lib/snmp/test/modules.mk --- erlang-18.2-dfsg/lib/snmp/test/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/test/sa.erl erlang-17.3-dfsg/lib/snmp/test/sa.erl --- erlang-18.2-dfsg/lib/snmp/test/sa.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/sa.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_agent_mibs_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_agent_mibs_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_agent_mibs_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_agent_mibs_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_agent_nfilter_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_agent_nfilter_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_agent_nfilter_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_agent_nfilter_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_agent_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_agent_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_agent_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_agent_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2015. All Rights Reserved. +%% Copyright Ericsson AB 2003-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -427,6 +426,10 @@ -include_lib("snmp/include/snmp_types.hrl"). -include_lib("snmp/src/agent/snmpa_atl.hrl"). +%% -include_lib("snmp/include/SNMP-COMMUNITY-MIB.hrl"). +%% -include_lib("snmp/include/SNMP-VIEW-BASED-ACM-MIB.hrl"). +%% -include_lib("snmp/include/SNMP-USER-BASED-SM-MIB.hrl"). + -define(klas1, [1,3,6,1,2,1,7]). -define(klas2, [1,3,6,1,2,1,9]). @@ -1609,8 +1612,7 @@ create_local_db_dir(Config) when is_list(Config) -> ?P(create_local_db_dir), DataDir = snmp_test_lib:lookup(data_dir, Config), - UName = erlang:unique_integer([positive]), - T = {UName, UName, UName}, + T = erlang:now(), [As,Bs,Cs] = [integer_to_list(I) || I <- tuple_to_list(T)], DbDir = filename:join([DataDir, As, Bs, Cs]), ok = del_dir(DbDir, 3), @@ -2446,6 +2448,10 @@ ]. +%% multiple_reqs_3(_X) -> +%% {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. + + mul_cases_2() -> [ mul_get_2, @@ -3194,18 +3200,19 @@ %% 4.1.3:2 gn([[tTooBig]]), io:format("We currently don't handle tooBig correct!!!\n"), - +% ?line ?expect3(tooBig, 0, [{[tTooBig], 'NULL'}]), ?line ?expect3(tooBig, 0, any), %% 4.1.3:3 gn([[tGenErr1]]), - +% ?line expect(40, genErr, 1, [{[tGenErr1], 'NULL'}]), ?line ?expect3(genErr, 1, any), gn([[tGenErr2]]), - +% ?line ?expect3(genErr, 1, [{[tGenErr2], 'NULL'}]), ?line ?expect3(genErr, 1, any), gn([[sysDescr], [tGenErr3]]), - +% ?line ?expect3(genErr, 2, [{[sysDescr], 'NULL'}, +% {[tGenErr3], 'NULL'}]). ?line ?expect3(genErr, 2, any). v1_set_p() -> @@ -3444,7 +3451,8 @@ %% Req. OLD-SNMPEA-MIB table_test() -> io:format("Testing simple get, next and set on communityTable...~n"), - +%% {[147,214,36,45], "public", 2, readWrite}. +%% {[147,214,36,45], "standard trap", 2, read}. Key1c3 = [intCommunityViewIndex,get(mip),is("public")], Key2c3 = [intCommunityViewIndex,get(mip),is("standard trap")], Key1c4 = [intCommunityAccess,get(mip),is("public")], @@ -3612,6 +3620,8 @@ %% Req: system group, OLD-SNMPEA-MIB, Klas1 big_test() -> + %% put(sname, {?MODULE, big_test}), + %% put(verbosity, trace), ?DBG("big_test -> testing simple next/get/set @ master agent...",[]), simple_standard_test(), @@ -5681,7 +5691,8 @@ loop_mib_1(Config) when is_list(Config) -> ?P(loop_mib_1), ?LOG("loop_mib_1 -> initiate case",[]), - + %% snmpa:verbosity(master_agent,debug), + %% snmpa:verbosity(mib_server,info), {_SaNode, _MgrNode, _MibDir} = init_case(Config), ?DBG("loop_mib_1 -> ~n" "\tSaNode: ~p~n" @@ -6632,6 +6643,7 @@ %% {ok, AgentNode} = start_node(agent), + %% {ok, SubAgentNode} = start_node(sub_agent), {ok, ManagerNode} = start_node(manager), %% -- @@ -6642,9 +6654,16 @@ AgentMnesiaDir = join([AgentDbDir, "mnesia"]), mnesia_init(AgentNode, AgentMnesiaDir), + %% SubAgentDir = ?config(sub_agent_dir, Config), + %% SubAgentMnesiaDir = join([SubAgentDir, "mnesia"]), + %% mnesia_init(SubAgentNode, SubAgentMnesiaDir), + + %% ok = mnesia_create_schema(AgentNode, [AgentNode, SubAgentNode]), + %% ok = mnesia:create_schema([AgentNode, SubAgentNode]), mnesia_create_schema(AgentNode, [AgentNode]), mnesia_start(AgentNode), + %% mnesia_start(SubAgentNode), %% -- %% Host & IP @@ -6730,6 +6749,11 @@ ?DBG("otp8395(fin) -> stop agent node", []), stop_node(AgentNode), + + %% SubAgentNode = ?config(sub_agent_node, Config), + %% stop_node(SubAgentNode), + + %% - %% Stop the manager node %% @@ -6946,6 +6970,20 @@ %% process_options(Defaults, Opts, []). Defaults. +%% process_options([], _Opts, Acc) -> +%% lists:reverse(Acc); +%% process_options([{Key, DefaultValue}|Defaults], Opts, Acc) -> +%% case lists:keysearch(Key, 1, Opts) of +%% {value, {Key, Value}} when is_list-> + + +%% snmp_app_env_init(Node, Entity, Conf) -> +%% rpc:call(Node, snmp_app_env_init, [Entity, Conf]). + +%% snmp_app_env_init(Entity, Conf) -> +%% application:unload(snmp), +%% application:load(snmp), +%% application:set_env(snmp, Entity, Conf). start_stdalone_agent(Node, Config) -> rpc:call(Node, ?MODULE, start_stdalone_agent, [Config]). @@ -7025,6 +7063,9 @@ tree_size_bytes, db_memory]}], verify_info(Info, Keys), + %% OldInfo = snmpa:old_info_format(Info), + %% ?DBG("info_test1 -> OldInfo: ~n~p", [OldInfo]), + %% verify_old_info(OldInfo), ok. verify_info([], []) -> @@ -7066,6 +7107,21 @@ Info -> verify_subinfo(Info, Keys) end. + +%% verify_old_info(Info) -> +%% Keys = [vsns, subagents, loaded_mibs, +%% tree_size_bytes, process_memory, db_memory], +%% verify_old_info(Keys, Info). + +%% verify_old_info([], _) -> +%% ok; +%% verify_old_info([Key|Keys], Info) -> +%% case lists:keymember(Key, 1, Info) of +%% true -> +%% verify_old_info(Keys, Info); +%% false -> +%% ?FAIL({missing_old_info, Key}) +%% end. %% Index String - string used in index is(S) -> [length(S) | S]. @@ -7128,6 +7184,8 @@ reset_usm_mgr(Dir) -> snmp_agent_test_lib:reset_usm_mgr(Dir). +%% update_community(Vsns, Dir) -> +%% snmp_agent_test_lib:update_community(Vsns, Dir). update_vacm(Vsn, Dir) -> snmp_agent_test_lib:update_vacm(Vsn, Dir). @@ -7138,6 +7196,8 @@ write_target_addr_conf(Dir, Conf) -> snmp_agent_test_lib:write_target_addr_conf(Dir, Conf). +%% write_target_addr_conf(Dir, ManagerIp, UDP, Vsns) -> +%% snmp_agent_test_lib:write_target_addr_conf(Dir, ManagerIp, UDP, Vsns). rewrite_target_addr_conf(Dir, NewPort) -> snmp_agent_test_lib:rewrite_target_addr_conf(Dir, NewPort). @@ -7158,6 +7218,10 @@ write_notify_conf(Dir) -> snmp_agent_test_lib:write_notify_conf(Dir). +%% write_view_conf(Dir) -> +%% snmp_agent_test_lib:write_view_conf(Dir). + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% copy_file(From, To) -> @@ -7317,6 +7381,9 @@ end. +%% regs() -> +%% lists:sort(registered()). + %% ------ join(Parts) -> diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_agent_test_lib.erl erlang-17.3-dfsg/lib/snmp/test/snmp_agent_test_lib.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_agent_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_agent_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_app_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_app_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_app_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_app_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2015. All Rights Reserved. +%% Copyright Ericsson AB 2003-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,6 +32,8 @@ modules/1, exportall/1, app_depend/1, + undef_funcs/1, + start_and_stop_empty/1, start_and_stop_with_agent/1, @@ -58,6 +59,7 @@ modules, exportall, app_depend, + undef_funcs, {group, start_and_stop} ], Cases. @@ -129,6 +131,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Test server callbacks +init_per_testcase(undef_funcs, Config) -> + Config2 = lists:keydelete(watchdog, 1, Config), + [{watchdog, ?WD_START(?MINS(10))} | Config2]; init_per_testcase(_Case, Config) -> Config. @@ -288,6 +293,88 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +undef_funcs(suite) -> + []; +undef_funcs(doc) -> + []; +undef_funcs(Config) when is_list(Config) -> + App = snmp, + AppFile = key1search(app_file, Config), + Mods = key1search(modules, AppFile), + Root = code:root_dir(), + LibDir = code:lib_dir(App), + EbinDir = filename:join([LibDir,"ebin"]), + XRefTestName = undef_funcs_make_name(App, xref_test_name), + {ok, XRef} = xref:start(XRefTestName), + ok = xref:set_default(XRef, + [{verbose,false},{warnings,false}]), + XRefName = undef_funcs_make_name(App, xref_name), + {ok, XRefName} = xref:add_release(XRef, Root, {name,XRefName}), + {ok, App} = xref:replace_application(XRef, App, EbinDir), + {ok, Undefs} = xref:analyze(XRef, undefined_function_calls), + xref:stop(XRef), + analyze_undefined_function_calls(Undefs, Mods, []). + +valid_undef(crypto = CalledMod) -> + case (catch CalledMod:version()) of + Version when is_list(Version) -> + %% The called module was crypto and the version + %% function returns a valid value. + %% This means that the function is + %% actually undefined... + true; + _ -> + %% The called module was crypto but the version + %% function does *not* return a valid value. + %% This means the crypto was not actually not + %% build, which is an case snmp handles. + false + end; +valid_undef(_) -> + true. + + +analyze_undefined_function_calls([], _, []) -> + ok; +analyze_undefined_function_calls([], _, AppUndefs) -> + exit({suite_failed, {undefined_function_calls, AppUndefs}}); +analyze_undefined_function_calls([{{Mod, _F, _A}, _C} = AppUndef|Undefs], + AppModules, AppUndefs) -> + %% Check that this module is our's + case lists:member(Mod,AppModules) of + true -> + {Calling,Called} = AppUndef, + {Mod1,Func1,Ar1} = Calling, + {Mod2,Func2,Ar2} = Called, + %% If the called module is crypto, then we will *not* + %% fail if crypto is not built (since crypto is actually + %% not built for all platforms) + case valid_undef(Mod2) of + true -> + io:format("undefined function call: " + "~n ~w:~w/~w calls ~w:~w/~w~n", + [Mod1,Func1,Ar1,Mod2,Func2,Ar2]), + analyze_undefined_function_calls( + Undefs, AppModules, [AppUndef|AppUndefs]); + false -> + io:format("skipping ~p (calling ~w:~w/~w)~n", + [Mod, Mod2, Func2, Ar2]), + analyze_undefined_function_calls(Undefs, + AppModules, AppUndefs) + end; + false -> + io:format("dropping ~p~n", [Mod]), + analyze_undefined_function_calls(Undefs, AppModules, AppUndefs) + end. + +%% This function is used simply to avoid cut-and-paste errors later... +undef_funcs_make_name(App, PostFix) -> + list_to_atom(atom_to_list(App) ++ "_" ++ atom_to_list(PostFix)). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_appup_mgr.erl erlang-17.3-dfsg/lib/snmp/test/snmp_appup_mgr.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_appup_mgr.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_appup_mgr.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2015. All Rights Reserved. +%% Copyright Ericsson AB 2003-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -141,7 +140,7 @@ {ok, ReqId} = snmpm:ag(?USER_ID, Host, Port, Oids), p("issued get-request (~w) for: ~s", [ReqId, oid_descs(Descs)]), ReqTimer = erlang:send_after(?REQ_TIMEOUT, self(), {req_timeout, ReqId}), - {ReqId, erlang:monotonic_time(micro_seconds), ReqTimer}. + {ReqId, erlang:now(), ReqTimer}. oid_descs([]) -> []; @@ -164,7 +163,7 @@ handle_snmp(#state{ids = IDs0} = S, {error, ReqId, Reason}) -> case lists:keysearch(ReqId, 1, IDs0) of {value, {ReqId, T, Ref}} -> - Diff = erlang:monotonic_time(micro_seconds) - T, + Diff = timer:now_diff(erlang:now(), T), p("SNMP error regarding outstanding request after ~w microsec:" "~n ReqId: ~w" "~n Reason: ~w", [Diff, ReqId, Reason]), @@ -188,7 +187,7 @@ handle_snmp(#state{ids = IDs0} = S, {pdu, Addr, Port, ReqId, SnmpResponse}) -> case lists:keysearch(ReqId, 1, IDs0) of {value, {ReqId, T, Ref}} -> - Diff = erlang:monotonic_time(micro_seconds) - T, + Diff = timer:now_diff(erlang:now(), T), p("SNMP pdu regarding outstanding request after ~w microsec:" "~n ReqId: ~w" "~n Addr: ~w" diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_appup_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_appup_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_appup_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_appup_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_compiler_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_compiler_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_compiler_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_compiler_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_conf_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_conf_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_conf_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_conf_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2015. All Rights Reserved. +%% Copyright Ericsson AB 2003-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -118,7 +117,7 @@ {b, mandatory}, {d, {value, 20202}}, {e, {value, "kalle"}}], - ?line {ok, _L1} = verify_mandatory(A1, B1), + ?line {ok, L1} = verify_mandatory(A1, B1), ?DBG("check_mandatory -> L1: ~p", [L1]), A2 = [{a, hej}, {c, 10}, {d, 10101}, {f, 10.88}], B2 = [{a, {value, hejsan}}, diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_log_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_log_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_log_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_log_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2015. All Rights Reserved. +%% Copyright Ericsson AB 2003-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -634,11 +633,11 @@ log_reader_log_to(Reader, fun() -> I = disk_log:info(Log), - T1 = snmp_misc:now(ms), + T1 = t(), R = snmp_log:log_to_txt(Log, LogFile, Dir, Mibs, TxtFile), - T2 = snmp_misc:now(ms), - io:format(user, + T2 = t(), + io:format(user, "Time converting file: ~w ms~n", [T2 - T1]), {R, I} @@ -705,10 +704,10 @@ log_writer_stop(Pid) -> Pid ! {stop, self()}, - _T1 = snmp_misc:now(ms), + _T1 = t(), receive {'EXIT', Pid, normal} -> - _T2 = snmp_misc:now(ms), + _T2 = t(), ?DBG("it took ~w ms to stop the writer", [_T2 - _T1]), ok after 60000 -> @@ -722,10 +721,10 @@ log_writer_sleep(Pid, Time) -> Pid ! {sleep, Time, self()}, - _T1 = snmp_misc:now(ms), + _T1 = t(), receive {sleeping, Pid} -> - _T2 = snmp_misc:now(ms), + _T2 = t(), ?DBG("it took ~w ms to put the writer to sleep", [_T2 - _T1]), ok; {'EXIT', Pid, Reason} -> @@ -794,10 +793,10 @@ log_reader_start() -> Pid = spawn_link(?MODULE, log_reader_main, [self()]), - _T1 = snmp_misc:now(ms), + _T1 = t(), receive {started, Pid} -> - _T2 = snmp_misc:now(ms), + _T2 = t(), ?DBG("it took ~w ms to start the reader", [_T2 - _T1]), {ok, Pid}; {'EXIT', Pid, Reason} -> @@ -808,10 +807,10 @@ log_reader_stop(Pid) -> Pid ! {stop, self()}, - _T1 = snmp_misc:now(ms), + _T1 = t(), receive {'EXIT', Pid, normal} -> - _T2 = snmp_misc:now(ms), + _T2 = t(), ?DBG("it took ~w ms to put the reader to eleep", [_T2 - _T1]), ok after 1000 -> @@ -1125,3 +1124,8 @@ p(Case) -> io:format(user, "test case: ~w~n", [Case]). + +%% Time in milli sec +t() -> + {A,B,C} = erlang:now(), + A*1000000000+B*1000+(C div 1000). diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_manager_config_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_manager_config_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_manager_config_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_manager_config_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -2170,6 +2169,7 @@ %% -- p("done"), ok. +%% ?SKIP(not_yet_implemented). %% @@ -2259,9 +2259,8 @@ ?line {ok, _Pid} = snmpm_config:start_link(Opts), %% Random init - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A,B,C} = erlang:now(), + random:seed(A,B,C), StartVal = random:uniform(2147483647), IncVal = 42, diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_manager_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_manager_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_manager_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_manager_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_manager_user.erl erlang-17.3-dfsg/lib/snmp/test/snmp_manager_user.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_manager_user.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_manager_user.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_manager_user_old.erl erlang-17.3-dfsg/lib/snmp/test/snmp_manager_user_old.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_manager_user_old.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_manager_user_old.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_manager_user_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_manager_user_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_manager_user_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_manager_user_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_manager_user_test_lib.erl erlang-17.3-dfsg/lib/snmp/test/snmp_manager_user_test_lib.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_manager_user_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_manager_user_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_note_store_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_note_store_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_note_store_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_note_store_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_pdus_test.erl erlang-17.3-dfsg/lib/snmp/test/snmp_pdus_test.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_pdus_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_pdus_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_SUITE.erl erlang-17.3-dfsg/lib/snmp/test/snmp_SUITE.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_test_lib.erl erlang-17.3-dfsg/lib/snmp/test/snmp_test_lib.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2015. All Rights Reserved. +%% Copyright Ericsson AB 2002-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -31,7 +30,7 @@ lookup/2, replace_config/3, set_config/3, get_config/2, get_config/3]). -export([fail/3, skip/3]). --export([hours/1, minutes/1, seconds/1, sleep/1]). +-export([millis/0, millis_diff/2, hours/1, minutes/1, seconds/1, sleep/1]). -export([flush_mqueue/0, trap_exit/0, trap_exit/1]). -export([ping/1, local_nodes/0, nodes_on/1]). -export([start_node/2]). @@ -335,6 +334,14 @@ %% Time related function %% +millis() -> + erlang:now(). + +millis_diff(A,B) -> + T1 = (element(1,A)*1000000) + element(2,A) + (element(3,A)/1000000), + T2 = (element(1,B)*1000000) + element(2,B) + (element(3,B)/1000000), + T1 - T2. + hours(N) -> trunc(N * 1000 * 60 * 60). minutes(N) -> trunc(N * 1000 * 60). seconds(N) -> trunc(N * 1000). @@ -621,3 +628,4 @@ io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w ~w", [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]), lists:flatten(FormatDate). + diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_test_lib.hrl erlang-17.3-dfsg/lib/snmp/test/snmp_test_lib.hrl --- erlang-18.2-dfsg/lib/snmp/test/snmp_test_lib.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_test_lib.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,22 +1,21 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% +%% 2002-2014 +%% Ericsson AB, All Rights Reserved +%% +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson AB. -%% %CopyrightEnd% +%% %% %%---------------------------------------------------------------------- %% Purpose: Define common macros for testing @@ -74,6 +73,8 @@ -endif. -define(SLEEP(MSEC), snmp_test_lib:sleep(MSEC)). +-define(M(), snmp_test_lib:millis()). +-define(MDIFF(A,B), snmp_test_lib:millis_diff(A,B)). %% - Process utility macros - @@ -148,3 +149,4 @@ -define(PRINT(P,F,A), snmp_test_lib:print(P,?MODULE,?LINE,F,A)). + diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_test_manager.erl erlang-17.3-dfsg/lib/snmp/test/snmp_test_manager.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_test_manager.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_test_manager.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_test_mgr_counter_server.erl erlang-17.3-dfsg/lib/snmp/test/snmp_test_mgr_counter_server.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_test_mgr_counter_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_test_mgr_counter_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_test_mgr.erl erlang-17.3-dfsg/lib/snmp/test/snmp_test_mgr.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_test_mgr.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_test_mgr.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -162,7 +161,7 @@ get_timeout(os:type()) end. -get_timeout(_) -> 10000. % Trying to improve test results % 3500. +get_timeout(_) -> 3500. %%---------------------------------------------------------------------- %% Receives a trap from the agent. @@ -189,9 +188,8 @@ init({Options, CallerPid}) -> put(sname, mgr), put(verbosity, debug), - random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()), + {A1,A2,A3} = erlang:now(), + random:seed(A1,A2,A3), case (catch is_options_ok(Options)) of true -> put(debug, get_value(debug, Options, false)), @@ -1137,3 +1135,4 @@ formated_timestamp() -> snmp_test_lib:formated_timestamp(). + diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_test_mgr_misc.erl erlang-17.3-dfsg/lib/snmp/test/snmp_test_mgr_misc.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_test_mgr_misc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_test_mgr_misc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_test_server.erl erlang-17.3-dfsg/lib/snmp/test/snmp_test_server.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_test_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_test_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_test_suite.erl erlang-17.3-dfsg/lib/snmp/test/snmp_test_suite.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_test_suite.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_test_suite.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_to_snmpnet_SUITE_data/start_stop_wrapper erlang-17.3-dfsg/lib/snmp/test/snmp_to_snmpnet_SUITE_data/start_stop_wrapper --- erlang-18.2-dfsg/lib/snmp/test/snmp_to_snmpnet_SUITE_data/start_stop_wrapper 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_to_snmpnet_SUITE_data/start_stop_wrapper 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2014-2014. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/lib/snmp/test/snmp_to_snmpnet_SUITE.erl erlang-17.3-dfsg/lib/snmp/test/snmp_to_snmpnet_SUITE.erl --- erlang-18.2-dfsg/lib/snmp/test/snmp_to_snmpnet_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/snmp_to_snmpnet_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/test1.erl erlang-17.3-dfsg/lib/snmp/test/test1.erl --- erlang-18.2-dfsg/lib/snmp/test/test1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/test1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/test2.erl erlang-17.3-dfsg/lib/snmp/test/test2.erl --- erlang-18.2-dfsg/lib/snmp/test/test2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/test2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/test/test_config/Makefile erlang-17.3-dfsg/lib/snmp/test/test_config/Makefile --- erlang-18.2-dfsg/lib/snmp/test/test_config/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/test_config/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 1997-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/test/test_config/modules.mk erlang-17.3-dfsg/lib/snmp/test/test_config/modules.mk --- erlang-18.2-dfsg/lib/snmp/test/test_config/modules.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/test_config/modules.mk 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ # # Copyright Ericsson AB 2004-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/snmp/test/test_config/snmp_test_config.erl erlang-17.3-dfsg/lib/snmp/test/test_config/snmp_test_config.erl --- erlang-18.2-dfsg/lib/snmp/test/test_config/snmp_test_config.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/test/test_config/snmp_test_config.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/snmp/vsn.mk erlang-17.3-dfsg/lib/snmp/vsn.mk --- erlang-18.2-dfsg/lib/snmp/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/snmp/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -2,23 +2,22 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 1997-2015. All Rights Reserved. +# Copyright Ericsson AB 1997-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% APPLICATION = snmp -SNMP_VSN = 5.2.1 +SNMP_VSN = 5.1 PRE_VSN = APP_VSN = "$(APPLICATION)-$(SNMP_VSN)$(PRE_VSN)" diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/book.xml erlang-17.3-dfsg/lib/ssh/doc/src/book.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/introduction.xml erlang-17.3-dfsg/lib/ssh/doc/src/introduction.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/introduction.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/introduction.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,198 +9,47 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. Introduction OTP team - - - - - - introduction.xml -

    SSH is a protocol for secure remote logon and - other secure network services over an insecure network.

    +
    - Scope and Purpose + Purpose -

    SSH provides a single, full-duplex, and byte-oriented connection between +

    Secure Shell (SSH) is a protocol for secure remote login and + other secure network services over an insecure network. SSH + provides a single, full-duplex, byte-oriented connection between client and server. The protocol also provides privacy, integrity, - server authentication, and man-in-the-middle protection.

    + server authentication and man-in-the-middle protection.

    -

    The ssh application is an implementation of the SSH Transport, Connection and Authentication - Layer Protocols in Erlang. It provides the following:

    - - API functions to write customized SSH clients and servers applications - The Erlang shell available over SSH - An SFTP client (ssh_sftp) - and server (ssh_sftpd) - +

    The Erlang SSH application is an implementation of the SSH + protocol in Erlang which offers API functions to write customized + SSH clients and servers as well as making the Erlang shell + available via SSH. Also included in the SSH application are an + SFTP (SSH File Transfer Protocol) client ssh_sftp and server ssh_sftpd.

    Prerequisites -

    It is assumed that the reader is familiar with the Erlang programming language, - concepts of OTP, and has a basic understanding of public keys.

    -
    - -
    - SSH Protocol Overview - -

    Conceptually, the SSH protocol can be partitioned into four - layers:

    - - - SSH Protocol Architecture - - -
    - Transport Protocol - -

    The SSH Transport Protocol is a secure, low-level transport. - It provides strong encryption, cryptographic host - authentication, and integrity protection. A minimum of - Message Authentication Code (MAC) and encryption - algorithms are supported. For details, see the - ssh(3) manual page in ssh.

    -
    - -
    - Authentication Protocol - -

    The SSH Authentication Protocol is a general-purpose user - authentication protocol run over the SSH Transport Layer - Protocol. The ssh application supports user authentication as follows: -

    - - - Using public key technology. RSA and DSA, X509-certificates - are not supported. - - - Using keyboard-interactive authentication. - This is suitable for interactive authentication methods - that do not need any special software support on the client side. - Instead, all authentication data is entered from the keyboard. - - - Using a pure password-based authentication scheme. - Here, the plain text password is encrypted before sent - over the network. - - -

    Several configuration options for - authentication handling are available in - ssh:connect/[3,4] - and ssh:daemon/[2,3].

    -

    - The public key handling can be customized by implementing - the following behaviours from ssh:

    - - Module - ssh_client_key_api. - - Module - ssh_server_key_api. - - -
    - -
    - Connection Protocol - -

    The SSH Connection Protocol provides application-support - services over the transport pipe, for example, channel multiplexing, - flow control, remote program execution, signal propagation, and - connection forwarding. Functions for handling the SSH - Connection Protocol can be found in the module ssh_connection in ssh. -

    -
    - -
    - Channels - -

    All terminal sessions, forwarded connections, and so on, are - channels. Multiple channels are multiplexed into a single - connection. All channels are flow-controlled. This means that no - data is sent to a channel peer until a message is received to - indicate that window space is available. - The initial window size specifies how many bytes of channel - data that can be sent to the channel peer without adjusting the - window. Typically, an SSH client opens a channel, sends data (commands), - receives data (control information), and then closes the channel. - The ssh_channel behaviour - handles generic parts of SSH channel management. This makes it easy - to write your own SSH client/server processes that use flow-control - and thus opens for more focus on the application logic. -

    - -

    Channels come in the following three flavors:

    - - - Subsystem - Named services that can be run as - part of an SSH server, such as SFTP (ssh_sftpd), that is built into the - SSH daemon (server) by default, but it can be disabled. The Erlang ssh - daemon can be configured to run any Erlang- - implemented SSH subsystem. - - Shell - Interactive shell. By default the - Erlang daemon runs the Erlang shell. The shell can be customized by - providing your own read-eval-print loop. You can also provide your - own Command-Line Interface (CLI) implementation, - but that is much more work. - - Exec - One-time remote execution of commands. See function - ssh_connection:exec/4 - for more information. - -
    - - - +

    It is assumed that the reader is familiar with the concepts of OTP + and has a basic understanding of public keys.

    -
    - Where to Find More Information -

    - For detailed information about the SSH protocol, refer to the - following Request for Comments(RFCs): -

    - - - RFC 4250 - - Protocol Assigned Numbers - RFC 4251 - - Protocol Architecture - RFC 4252 - - Authentication Protocol - RFC 4253 - - Transport Layer Protocol - RFC 4254 - - Connection Protocol - RFC 4255 - - Key Fingerprints - RFC 4344 - - Transport Layer Encryption Modes - RFC 4716 - - Public Key File Format - -
    diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/Makefile erlang-17.3-dfsg/lib/ssh/doc/src/Makefile --- erlang-18.2-dfsg/lib/ssh/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/notes.xml erlang-17.3-dfsg/lib/ssh/doc/src/notes.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 20042015 + 20042014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -30,873 +29,6 @@ notes.xml
    -
    Ssh 4.2 - -
    Fixed Bugs and Malfunctions - - -

    - Better error handling in ssh_file. There was some rare - errors when a NFS-mounted file was opened by ssh_file and - then remotely deleted during reading. That caused an - endless loop.

    -

    - That bug is now fixed.

    -

    - Own Id: OTP-12699 Aux Id: OTP-11688

    -
    - -

    - Fixed a bug in the compression algorithm - zlib@openssh.com.

    -

    - Own Id: OTP-12759

    -
    - -

    - It is now possible to start more than one daemon with a - file descriptor given in option fd. Each daemon must of - course have a unique file descriptor.

    -

    - Own Id: OTP-12966 Aux Id: seq12945

    -
    - -

    - Fixed a bug that caused the option dh_gex_limit to - be ignored.

    -

    - Own Id: OTP-13029

    -
    - -

    - A problem is fixed with the ssh:connect option - pref_public_key_algs specifying user keys.

    -

    - Own Id: OTP-13158

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Document updates in the ssh reference manual: app doc - file and ssh_connection.

    -

    - Own Id: OTP-12003

    -
    - -

    - The authorization phase is made stateful to prevent ssh - acting on messages sent in wrong order.

    -

    - Own Id: OTP-12787

    -
    - -

    - Testcases for bad message lengths and for bad subfield - lengths added.

    -

    - Own Id: OTP-12792 Aux Id: Codenomicon #5214, 6166

    -
    - -

    - The 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384' and - 'ecdsa-sha2-nistp521' signature algorithms for ssh are - implemented. See RFC 5656.

    -

    - Own Id: OTP-12936

    -
    - -

    - The crypto algorithms 'aes192-ctr' and 'aes256-ctr' are - implemented. See RFC 4344.

    -

    - Own Id: OTP-12939

    -
    - -

    - The ciphers and macs AEAD_AES_128_GCM and - AEAD_AES_256_GCM are implemented but not enabled per - default. See the SSH App Reference Manual and RFC5647 for - details.

    -

    - The ciphers aes128-gcm@openssh.com and - aes256-gcm@openssh.com are also implemented and available - in the default configuration.

    -

    - Own Id: OTP-13018

    -
    - -

    - The ssh:daemon option dh_gex_groups is extended to read a - user provided ssh moduli file with generator-modulus - pairs. The file is in openssh format.

    -

    - Own Id: OTP-13052 Aux Id: OTP-13054

    -
    - -

    - There is now a file (public_key/priv/moduli) which lists - size-generator-modulus triples. The purpose is to give - servers the possibility to select the crypto primes - randomly among a list of pregenerated triples. This - reduces the risk for some attacks on diffie-hellman - negotiation.

    -

    - See the reference manual for public_key:dh_gex_group/4 - where the handling of this is described.

    -

    - The ssh server (ssh:daemon) uses this.

    -

    - Own Id: OTP-13054 Aux Id: OTP-13052

    -
    - -

    - The ssh:daemon option pwdfun now also takes a fun/4. This - enables the user to 1) check userid-password in another - way than the builtin algorithm, 2) implement rate - limiting per user or source IP or IP+Port, and 3) - implement blocking of missbehaving peers.

    -

    - The old fun/2 still works as previously.

    -

    - Own Id: OTP-13055 Aux Id: OTP-13053

    -
    - -

    - There is now a new option to make the server limit the - size range of moduli available for the diffie-hellman - group exchange negotiation. See option - {dh_gex_limits,{Min,Max}} in ssh:daemon/3.

    -

    - Own Id: OTP-13066

    -
    - -

    - Ecdh key exchange now validates compressed and - uncompressed keys as defined in rfc5656

    -

    - Own Id: OTP-13067

    -
    - -

    - Search order for the .ssh directory are changed so - $HOME is tried before - init:get_argument(home).

    -

    - Own Id: OTP-13109

    -
    - -

    - The sftp receive window handling is optimized so it will - not update the remote end too often. This makes "sftp - mget" considerable faster.

    -

    - Own Id: OTP-13130

    -
    - -

    - The option key_cb is extended to take an optional - list that is passed to the callback module as an option. - With this it is possible to have different keys depending - on which host that is connected. Another possibility is - to write a callback module that fetches keys etc from a - database.

    -

    - Thanks to Vipin Nair.

    -

    - Own Id: OTP-13156

    -
    -
    -
    - -
    - -
    Ssh 4.1.3 - -
    Known Bugs and Problems - - -

    - SSH_MSG_KEX_DH_GEX_REQUEST_OLD implemented to make PuTTY - work with erl server.

    -

    - Own Id: OTP-13140

    -
    -
    -
    - -
    - -
    Ssh 4.1.2 - -
    Fixed Bugs and Malfunctions - - -

    - Add a 1024 group to the list of key group-exchange groups

    -

    - Own Id: OTP-13046

    -
    -
    -
    - -
    - -
    Ssh 4.1.1 - -
    Improvements and New Features - - -

    - A new option max_channels limits the number of - channels with active server-side subsystems that are - accepted.

    -

    - Own Id: OTP-13036

    -
    -
    -
    - -
    - -
    Ssh 4.1 - -
    Fixed Bugs and Malfunctions - - -

    - Send an understandable disconnect message when the key - exchange phase can't find a common algorithm. There are - also some test cases added.

    -

    - Own Id: OTP-11531

    -
    - -

    - The third parameter in ssh_sftp:write_file is now - accepting iolists again. Unicode handling adjusted.

    -

    - Own Id: OTP-12853 Aux Id: seq12891

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - First part of ssh test suite re-organization and - extension.

    -

    - Own Id: OTP-12230

    -
    - -

    - The key exchange algorithms 'ecdh-sha2-nistp256', - 'ecdh-sha2-nistp384' and 'ecdh-sha2-nistp521' are - implemented. See RFC 5656.

    -

    - This raises the security level considerably.

    -

    - Own Id: OTP-12622 Aux Id: OTP-12671, OTP-12672

    -
    - -

    - The key exchange algorithm 'diffie-hellman-group14-sha1' - is implemented. See RFC 4253.

    -

    - This raises the security level.

    -

    - Own Id: OTP-12671 Aux Id: OTP-12672, OTP-12622

    -
    - -

    - The key exchange algorithms - 'diffie-hellman-group-exchange-sha1' and - 'diffie-hellman-group-exchange-sha256' are implemented. - See RFC 4419.

    -

    - This raises the security level.

    -

    - Own Id: OTP-12672 Aux Id: OTP-12671, OTP-12622

    -
    - -

    - Adding random length extra padding as recommended in RFC - 4253 section 6.

    -

    - Own Id: OTP-12831

    -
    - -

    - New test library for low-level protocol testing. There is - also a test suite using it for some preliminary tests. - The intention is to build on that for more testing of - individual ssh messages. See - lib/ssh/test/ssh_trpt_test_lib.erl and - ssh_protocol_SUITE.erl in the same directory.

    -

    - Own Id: OTP-12858

    -
    - -

    - Increased default values for - diffie-hellman-group-exchange-sha* to Min = 1024, N = - 6144, Max = 8192.

    -

    - Added 6144 and 8192 bit default gex groups.

    -

    - Own Id: OTP-12937

    -
    - -

    - The mac algorithm 'hmac-sha2-512' is implemented. See RFC - 6668.

    -

    - Own Id: OTP-12938

    -
    -
    -
    - -
    - -
    Ssh 4.0 - -
    Fixed Bugs and Malfunctions - - -

    - Ssh crashed if a message was sent on a channel with - packet_size = 0.

    -

    - A new option for ssh:daemon is also introduced: - minimal_remote_max_packet_size. This option sets - the least max packet size declaration that the daemon - will accept from a client. The default value is 0 to - maintain compatibility with OpenSSH and the rfc:s.

    -

    - Own Id: OTP-12645 Aux Id: seq12816

    -
    - -

    - Included test of the 'e' and 'f' parameters in - diffie-hellman key exchange as specified in rfc 4253 - section 8.

    -

    - Own Id: OTP-12649

    -
    - -

    - Fixes the bug that once the rekey_limit bytes (by - default, 1GB) had been transmitted the connection was - rekeyed every minute, not after the next transferred - 'rekey_limit' chunk.

    -

    - Thanks to Simon Cornish for the report and the fix!

    -

    - Own Id: OTP-12692

    -
    - -

    - Fixes a bug that causes an SFTP connection to always fail - when {timeout, Timeout} option is used with - ssh_sftp:start_channel.

    -

    - Thanks to Simon Cornish

    -

    - Own Id: OTP-12708

    -
    - -

    - Fix various ssh key exchange problems.

    -

    - Thanks to Simon Cornish

    -

    - Own Id: OTP-12760 Aux Id: pull req - 715

    -
    - -

    - The options system_dir and user_dir assumes - that the value is a path to a directory which is - readable. This is now checked early, so ssh:daemon - and ssh:connect will fail with an error message - immediately.

    -

    - Own Id: OTP-12788

    -
    - -

    - A daemon now checks that a client doesn't try to - authorize with methods not in the option auth_methods.

    -

    - Own Id: OTP-12790

    -
    - -

    - Disconnectfun now should trigger on all disconnects.

    -

    - Own Id: OTP-12811

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Better usage of binary matching in ssh_auth.erl and - ssh_message.erl

    -

    - Own Id: OTP-11697

    -
    - -

    - A new option 'preferred_algorithms' is available for - ssh:daemon and ssh:connect.

    -

    - This option defines the algorithms presented to the peer - in the algorithm negotiation phase of the ssh protocol.

    -

    - The default list can be obtained from the new function - ssh:default_algorithms/0.

    -

    - *** INCOMPATIBILITY with removed undocumented options - 'role' and 'compression' ***

    -

    - Own Id: OTP-12029

    -
    - -

    - The internal group to user_drv protocol has been changed - to be synchronous in order to guarantee that output sent - to a process implementing the user_drv protocol is - printed before replying. This protocol is used by the - standard_output device and the ssh application when - acting as a client.

    -

    - This change changes the previous unlimited buffer when - printing to standard_io and other devices that end up in - user_drv to 1KB.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-12240

    -
    - -

    - If ssh_connection:subsystem/4 fails we do not want to - crash but rather terminate gracefully.

    -

    - Own Id: OTP-12648 Aux Id: seq12834

    -
    - -

    - New option id_string for ssh:daemon and - ssh:connect for limiting banner grabbing attempts.

    -

    - The possible values are: {id_string,string()} and - {id_string,random}. The latter will make ssh - generate a random nonsence id-string for each new - connection.

    -

    - Own Id: OTP-12659

    -
    - -

    - To enable the ssh daemon to run in a virtualized - environment, where there can be more that one server that - has the same ip-address and port, we add a new option - profile.

    -

    - Own Id: OTP-12675

    -
    - -

    - Upgrade test suite added.

    -

    - Own Id: OTP-12676

    -
    - -

    - A new option for handling the SSH_MSG_DEBUG message's - printouts. A fun could be given in the options that will - be called whenever the SSH_MSG_DEBUG message arrives. - This enables the user to format the printout or just - discard it.

    -

    - Own Id: OTP-12738 Aux Id: seq12860

    -
    - -

    - Testcase improvements and corrections:

    -

    - * Add testcases for the disconnectfun option on - both server and client sides

    -

    - * Timeout testcases adjusted for slow machines where they - sometimes failed

    -

    - Own Id: OTP-12786

    -
    - -

    - The option disconnectfun can now be used both on - the client and server side.

    -

    - Own Id: OTP-12789

    -
    - -

    - A new option unknown_msgfun/2 for ssh:connect and - ssh:daemon for handling unknown messages. With the option - it is possible to intercept before an INFO log message is - generated.

    -

    - One usage is to filter out messages that are not wanted - in the error logger as info reports. An example of such a - message is the 'etimedout' tcp error message that will be - received if a connection has keep_alive and the peer is - restarted.

    -

    - Own Id: OTP-12813 Aux Id: seq12881

    -
    -
    -
    - -
    - -
    Ssh 3.2.4 - -
    Fixed Bugs and Malfunctions - - -

    - Gracefully terminate if sockets is unexpectedly closed.

    -

    - Own Id: OTP-12782

    -
    - -

    - Made Codenomicon Defensics test suite pass:

    - limit number of algorithms in kexinit - message check 'e' and 'f' parameters in - kexdh implement 'keyboard-interactive' user - authentication on server side return plain - text message to bad version exchange message - -

    - Own Id: OTP-12784

    -
    -
    -
    - -
    - -
    Ssh 3.2.3 - -
    Fixed Bugs and Malfunctions - - -

    - A new option for handling the SSH_MSG_DEBUG message's - printouts. A fun could be given in the options that will - be called whenever the SSH_MSG_DEBUG message arrives. - This enables the user to format the printout or just - discard it.

    -

    - Own Id: OTP-12738 Aux Id: seq12860

    -
    -
    -
    - -
    - -
    Ssh 3.2.2 - -
    Improvements and New Features - - -

    - New option id_string for ssh:daemon and - ssh:connect for limiting banner grabbing attempts.

    -

    - The possible values are: {id_string,string()} and - {id_string,random}. The latter will make ssh - generate a random nonsence id-string for each new - connection.

    -

    - Own Id: OTP-12659

    -
    -
    -
    - -
    - -
    Ssh 3.2.1 - -
    Fixed Bugs and Malfunctions - - -

    - Ssh crashed if a message was sent on a channel with - packet_size = 0.

    -

    - A new option for ssh:daemon is also introduced: - minimal_remote_max_packet_size. This option sets - the least max packet size declaration that the daemon - will accept from a client. The default value is 0 to - maintain compatibility with OpenSSH and the rfc:s.

    -

    - Own Id: OTP-12645 Aux Id: seq12816

    -
    -
    -
    - -
    - -
    Ssh 3.2 - -
    Fixed Bugs and Malfunctions - - -

    - If a channel is closed by the peer while using a function - with call semantics in ssh_connection.erl return {error, - closed}. Document that the functions can return {error, - timeout | closed} and not only ssh_request_status()

    -

    - Own Id: OTP-12004

    -
    - -

    - Bug that causes ssh:connect to return - {error,int()} instead of {error,timeout} - when ssh handshake takes too long time.

    -

    - Own Id: OTP-12369

    -
    - -

    - Documentation corrections. (Thanks to Rabbe Fogelholm)

    -

    - Own Id: OTP-12399

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Example of ssh_connection:exec added.

    -

    - Own Id: OTP-12558

    -
    -
    -
    - -
    - -
    Ssh 3.1 - -
    Fixed Bugs and Malfunctions - - -

    - Make sure the clean rule for ssh, ssl, eunit and otp_mibs - actually removes generated files.

    -

    - Own Id: OTP-12200

    -
    - -

    - Improved Property Tests (Thanks to Thomas, John and - Tobias at QuviQ)

    -

    - Own Id: OTP-12256

    -
    - -

    - Correct typo of renegotiate that could cause rekeying to - fail

    -

    - Own Id: OTP-12277 Aux Id: seq12736

    -
    - -

    - The {timeout, Timeout} option passed to - ssh_sftp:start_channel was not applied to the early - phases of the SSH protocol. This patch passes the Timeout - through to ssh:connect. In case the timeout occurs during - these phases, {error, timeout} is returned. (Thanks to - Simon Cornish)

    -

    - Own Id: OTP-12306

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Added API functions ptty_alloc/3 and ptty_alloc/4, to - allocate a pseudo tty.

    -

    - Own Id: OTP-11542 Aux Id: seq12493, OTP-11631

    -
    - -

    - Supports tar file creation on other media than file - systems mounted on the local machine.

    -

    - The erl_tar api is extended with - erl_tar:init/3 that enables usage of user provided - media storage routines. A ssh-specific set of such - routines is hidden in the new function - ssh_sftp:open_tar/3 to simplify creating a tar - archive on a remote ssh server.

    -

    - A chunked file reading option is added to - erl_tar:add/3,4 to save memory on e.g small - embedded systems. The size of the slices read from a file - in that case can be specified.

    -

    - Own Id: OTP-12180 Aux Id: seq12715

    -
    - -

    - Always send SSH_DISCONNECT protocol messages when peer - sends corrupt messages.

    -

    - Own Id: OTP-12185

    -
    - -

    - Hooks for funs that can change binaries sent to remote - sites from erl_tar for renote tar file creation are - added. See ssh_sftp:open_tar/3,4 for details. The - hooks could also be used to read remote tar files that - need transformation before file extraction.

    -

    - Those hooks are intended for encryption and decryption of - tar files. Effort is put into memory, disk and network - resource economy.

    -

    - Own Id: OTP-12312 Aux Id: OTP-12180

    -
    -
    -
    - -
    - -
    Ssh 3.0.8 - -
    Fixed Bugs and Malfunctions - - -

    - Fixes of login blocking after port scanning.

    -

    - Own Id: OTP-12247 Aux Id: seq12726

    -
    -
    -
    - -
    - -
    Ssh 3.0.7 - -
    Fixed Bugs and Malfunctions - - -

    - Add option sftp_vsn to SFTP

    -

    - Own Id: OTP-12227

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Fix option user_interaction to work as expected. When - password authentication is implemented with ssh - keyboard-interactive method and the password is already - supplied, so that we do not need to query user, then - connections should succeed even though user_interaction - option is set to false.

    -

    - Own Id: OTP-11329 Aux Id: seq12420, seq12335

    -
    -
    -
    - -
    - -
    Ssh 3.0.6 - -
    Fixed Bugs and Malfunctions - - -

    - Gracefully handle bad data from the client when expecting - ssh version exchange.

    -

    - Own Id: OTP-12157 Aux Id: seq12706

    -
    - -

    - When restarting an ssh daemon, that was stopped with - ssh:stop_listner/ [1,2] new options given shall replace - old ones.

    -

    - Own Id: OTP-12168 Aux Id: seq12711

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - ssh now has a format_status function to avoid printing - sensitive information in error loggs.

    -

    - Own Id: OTP-12030

    -
    -
    -
    - - -
    Known Bugs and Problems - - -

    - The option parallel_login didn't work with the - value true. All logins were serial.

    -

    - Own Id: OTP-12194

    -
    -
    -
    - -
    -
    Ssh 3.0.5
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/part_notes.xml erlang-17.3-dfsg/lib/ssh/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/ref_man.xml erlang-17.3-dfsg/lib/ssh/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -29,8 +28,8 @@ ref_man.xml -

    The ssh application is an Erlang implementation of the - Secure Shell Protocol (SSH) as defined by RFC 4250 - 4254.

    +

    The SSH application is an erlang implementation of the + secure shell protocol (SSH) as defined by RFC 4250 - 4254

    diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/ssh_app.xml erlang-17.3-dfsg/lib/ssh/doc/src/ssh_app.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/ssh_app.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/ssh_app.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,316 +4,97 @@
    - 20122015 + 20122013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + SSH - - - - - ssh_app.xml
    SSH - The ssh application implements the Secure Shell (SSH) protocol and - provides an SSH File Transfer Protocol (SFTP) client and server. - -

    The ssh application is an implementation of the SSH protocol in Erlang. - ssh offers API functions to write customized SSH clients and servers as well as - making the Erlang shell available over SSH. An SFTP client, ssh_sftp, and server, - ssh_sftpd, are also included.

    -
    + The ssh application implements the SSH (Secure Shell) protocol and + provides an SFTP (SSH File Transfer Protocol) client and server. -
    +
    DEPENDENCIES -

    The ssh application uses the applications - public_key and - crypto - to handle public keys and encryption. Hence, these - applications must be loaded for the ssh application to work. In - an embedded environment this means that they must be started with - application:start/1,2 before the - ssh application is started. +

    The ssh application uses the Erlang applications public_key and + crypto to handle public keys and encryption, hence these + applications needs to be loaded for the ssh application to work. In + an embedded environment that means they need to be started with + application:start/[1,2] before the ssh application is started.

    -
    +
    CONFIGURATION -

    The ssh application does not have an application- - specific configuration file, as described in application(3). - However, by default it use the following configuration files - from OpenSSH:

    - - known_hosts - authorized_keys - authorized_keys2 - id_dsa - id_rsa - id_ecdsa - ssh_host_dsa_key - ssh_host_rsa_key - ssh_host_ecdsa_key - -

    By default, ssh looks for id_dsa, id_rsa, - id_ecdsa_key, - known_hosts, and authorized_keys in ~/.ssh, - and for the host key files in /etc/ssh. These locations can be changed - by the options user_dir and system_dir. -

    -

    Public key handling can also be customized through a callback module that - implements the behaviors - ssh_client_key_api and - ssh_server_key_api. -

    +

    The ssh application does not currently have an application + specific configuration file as described in application(3), + however it will by default use the following configuration files + from openssh: known_hosts, authorized_keys, authorized_keys2, + id_dsa and id_rsa, ssh_host_dsa_key and ssh_host_rsa_key. By + default Erlang SSH will look for id_dsa, id_rsa, known_hosts + and authorized_keys in ~/.ssh, and the host key files in /etc/ssh + . These locations may be changed by the options user_dir and + system_dir. Public key handling may also be customized by + providing a callback module implementing the behaviors + ssh_client_key_api and + ssh_server_key_api. +

    -
    -
    - Public Keys -

    id_dsa, id_rsa and id_ecdsa are the users private key files. - Notice that the public key is part of the private key so the ssh - application does not use the id_<*>.pub files. These are - for the user's convenience when it is needed to convey the user's +

    + PUBLIC KEYS +

    + id_dsa and id_rsa are the users private key files, note that + the public key is part of the private key so the ssh + application will not use the id_<*>.pub files. These are + for the users convenience when he/she needs to convey their public key.

    -
    -
    - Known Hosts -

    The known_hosts file contains a list of approved servers and - their public keys. Once a server is listed, it can be verified +

    + +
    + KNOW HOSTS +

    The known_hosts file contains a list of approved servers and + their public keys. Once a server is listed, it can be verified without user interaction.

    -
    -
    - Authorized Keys -

    The authorized_key file keeps track of the user's authorized - public keys. The most common use of this file is to let users - log in without entering their password, which is supported by the - Erlang ssh daemon. -

    -
    -
    - Host Keys -

    RSA and DSA host keys are supported and are - expected to be found in files named ssh_host_rsa_key, - ssh_host_dsa_key and ssh_host_ecdsa_key. -

    -
    -
    - ERROR LOGGER AND EVENT HANDLERS -

    The ssh application uses the default OTP error logger to log unexpected errors or print information about special events.

    -
    +
    -
    - - SUPPORTED SPECIFICATIONS AND STANDARDS -

    The supported SSH version is 2.0.

    -
    -
    - Algorithms -

    The actual set of algorithms may vary depending on which OpenSSL crypto library that is installed on the machine. - For the list on a particular installation, use the command - ssh:default_algorithms/0. - The user may override the default algorithm configuration both on the server side and the client side. - See the option preferred_algorithms in the ssh:daemon/1,2,3 and - ssh:connect/3,4 functions. -

    - -

    Supported algorithms are:

    - - - Key exchange algorithms - - - ecdh-sha2-nistp256 - ecdh-sha2-nistp384 - ecdh-sha2-nistp521 - diffie-hellman-group-exchange-sha1 - diffie-hellman-group-exchange-sha256 - diffie-hellman-group14-sha1 - diffie-hellman-group1-sha1 - - - - Public key algorithms - - - ecdsa-sha2-nistp256 - ecdsa-sha2-nistp384 - ecdsa-sha2-nistp521 - ssh-rsa - ssh-dss - - - - MAC algorithms - - - hmac-sha2-256 - hmac-sha2-512 - hmac-sha1 - - - - Encryption algorithms (ciphers) - - - aes128-gcm@openssh.com (AEAD_AES_128_GCM) - aes256-gcm@openssh.com (AEAD_AES_256_GCM) - aes128-ctr - aes192-ctr - aes256-ctr - aes128-cbc - 3des-cbc - -

    Following the internet de-facto standard, the cipher and mac algorithm AEAD_AES_128_GCM is selected when the - cipher aes128-gcm@openssh.com is negotiated. The cipher and mac algorithm AEAD_AES_256_GCM is selected when the - cipher aes256-gcm@openssh.com is negotiated. -

    -

    See the text at the description of the rfc 5647 further down - for more information. -

    -
    - - Compression algorithms - - - none - zlib@openssh.com - zlib - - -
    -
    -
    - Unicode support -

    Unicode filenames are supported if the emulator and the underlaying OS support it. See section DESCRIPTION in the - file manual page in kernel for information about this subject. -

    -

    The shell and the cli both support unicode. -

    -
    - -
    - Rfcs -

    The following rfc:s are supported:

    - - RFC 4251, The Secure Shell (SSH) Protocol Architecture. -

    Except

    - - 9.4.6 Host-Based Authentication - 9.5.2 Proxy Forwarding - 9.5.3 X11 Forwarding - -

    - - - RFC 4252, The Secure Shell (SSH) Authentication Protocol. -

    Except

    - - 9. Host-Based Authentication: "hostbased" - -

    - - - RFC 4253, The Secure Shell (SSH) Transport Layer Protocol. -

    -
    - - RFC 4254, The Secure Shell (SSH) Connection Protocol. -

    Except

    - - 6.3. X11 Forwarding - 7. TCP/IP Port Forwarding - -

    - - - RFC 4256, Generic Message Exchange Authentication for - the Secure Shell Protocol (SSH). -

    Except

    - - num-prompts > 1 - password changing - other identification methods than userid-password - -

    - - - RFC 4419, Diffie-Hellman Group Exchange for - the Secure Shell (SSH) Transport Layer Protocol. -

    - - - RFC 4716, The Secure Shell (SSH) Public Key File Format. -

    - - - RFC 5647, AES Galois Counter Mode for - the Secure Shell Transport Layer Protocol. -

    There is an ambiguity in the synchronized selection of cipher and mac algorithm. - This is resolved by OpenSSH in the ciphers aes128-gcm@openssh.com and aes256-gcm@openssh.com which are implemented. - If the explicit ciphers and macs AEAD_AES_128_GCM or AEAD_AES_256_GCM are needed, - they could be enabled with the option preferred_algorithms. -

    - -

    - If the client or the server is not Erlang/OTP, it is the users responsibility to check that - other implementation has the same interpretation of AEAD_AES_*_GCM as the Erlang/OTP SSH before - enabling them. The aes*-gcm@openssh.com variants are always safe to use since they lack the - ambiguity. -

    -
    -

    The second paragraph in section 5.1 is resolved as:

    - - If the negotiated cipher is AEAD_AES_128_GCM, the mac algorithm is set to AEAD_AES_128_GCM. - If the negotiated cipher is AEAD_AES_256_GCM, the mac algorithm is set to AEAD_AES_256_GCM. - If the mac algorithm is AEAD_AES_128_GCM, the cipher is set to AEAD_AES_128_GCM. - If the mac algorithm is AEAD_AES_256_GCM, the cipher is set to AEAD_AES_256_GCM. - -

    The first rule that matches when read in order from the top is applied

    -
    - - RFC 5656, Elliptic Curve Algorithm Integration in - the Secure Shell Transport Layer. -

    Except

    - - 5. ECMQV Key Exchange - 6.4. ECMQV Key Exchange and Verification Method Name - 7.2. ECMQV Message Numbers - 10.2. Recommended Curves - -

    - - - RFC 6668, SHA-2 Data Integrity Verification for - the Secure Shell (SSH) Transport Layer Protocol -

    Comment: Defines hmac-sha2-256 and hmac-sha2-512 +

    + AUTHORIZED KEYS +

    The authorized key file keeps track of the user's authorized + public keys. The most common use of this file is to let users + log in without entering their password which is supported by the + Erlang SSH daemon.

    - - - +
    +
    + HOST KEYS +

    Currently rsa and dsa host keys are supported and are + expected to be found in files named ssh_host_rsa_key and + ssh_host_dsa_key. +

    +
    SEE ALSO -

    application(3)

    +

    application(3)

    diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/ssh_channel.xml erlang-17.3-dfsg/lib/ssh/doc/src/ssh_channel.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/ssh_channel.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/ssh_channel.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,99 +9,83 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. ssh_channel - - - - ssh_channel -behaviour(ssh_channel).

    SSH services (clients and servers) are implemented as channels - that are multiplexed over an SSH connection and communicates over + that are multiplexed over an SSH connection and communicates via the SSH Connection Protocol. This module provides a callback API - that takes care of generic channel aspects, such as flow control - and close messages. It lets the callback functions take care of + that takes care of generic channel aspects such as flow control + and close messages and lets the callback functions take care of the service (application) specific parts. This behavior also ensures that the channel process honors the principal of an OTP-process so that it can be part of a supervisor tree. This is a requirement of channel processes implementing a subsystem that will be added to - the ssh applications supervisor tree. + the SSH applications supervisor tree.

    -

    When implementing an ssh subsystem, use - -behaviour(ssh_daemon_channel) instead of -behaviour(ssh_channel). - The reason is that the only relevant callback functions for subsystems are - init/1, handle_ssh_msg/2, handle_msg/2, and terminate/2. - So, the ssh_daemon_channel behaviour is a limited version of the - ssh_channel behaviour. -

    +

    When implementing a SSH subsystem use the + -behaviour(ssh_daemon_channel). instead of -behaviour(ssh_channel). + as the only relevant callback functions for subsystems are + init/1, handle_ssh_msg/2, handle_msg/2 and terminate/2, so the ssh_daemon_channel + behaviour is limited version of the ssh_channel behaviour. +

    - DATA TYPES + DATA TYPES -

    Type definitions that are used more than once in this module, - or abstractions to indicate the intended use of the data - type, or both:

    +

    Type definitions that are used more than once in this module + and/or abstractions to indicate the intended use of the data + type:

    - - boolean() = -

    true | false

    - string() = -

    list of ASCII characters

    - timeout() = -

    infinity | integer() in milliseconds

    - ssh_connection_ref() = -

    opaque() -as returned by - ssh:connect/3 or sent to an SSH channel process

    - ssh_channel_id() = -

    integer()

    - ssh_data_type_code() = -

    1 ("stderr") | 0 ("normal") are - the valid values, - see RFC 4254 - Section 5.2

    -
    +

    boolean() = true | false

    +

    string() = list of ASCII characters

    +

    timeout() = infinity | integer() - in milliseconds.

    +

    ssh_connection_ref() - opaque to the user returned by + ssh:connect/3 or sent to an SSH channel process

    +

    ssh_channel_id() = integer()

    +

    ssh_data_type_code() = 1 ("stderr") | 0 ("normal") are + currently valid values see RFC 4254 section 5.2.

    call(ChannelRef, Msg) -> call(ChannelRef, Msg, Timeout) -> Reply | {error, Reason} - Makes a synchronous call to a channel. + Makes a synchronous call to a channel. ChannelRef = pid() - As returned by ssh_channel:start_link/4 - Msg = term() - Timeout = timeout() - Reply = term() - Reason = closed | timeout + As returned by start_link/4 + Msg = term() + Timeout = timeout() + Reply = term() + Reason = closed | timeout

    Makes a synchronous call to the channel process by sending - a message and waiting until a reply arrives, or a time-out - occurs. The channel calls Module:handle_call/3 - to handle the message. If the channel process does not exist, + to handle the message. If the channel process does not exist {error, closed} is returned.

    @@ -112,14 +96,14 @@ Sends an asynchronous message to the channel ChannelRef and returns ok. - ChannelRef = pid() - As returned by ssh_channel:start_link/4 - Msg = term() + ChannelRef = pid() + As returned by start_link/4 + Msg = term()

    Sends an asynchronous message to the channel process and returns ok immediately, ignoring if the destination node or - channel process does not exist. The channel calls + channel process does not exist. The channel will call Module:handle_cast/2 to handle the message.

    @@ -128,32 +112,31 @@ enter_loop(State) -> _ - Makes an existing process an ssh_channel process. + Makes an existing process an ssh_channel process. - State = term() - as returned by ssh_channel:init/1 + State = term() - as returned by ssh_channel:init/1 -

    Makes an existing process an ssh_channel - process. Does not return, instead the calling process - enters the ssh_channel process receive loop and become an - ssh_channel process. The process must have been started using - one of the start functions in proc_lib, see the proc_lib(3) manual page in stdlib. - The user is responsible for any initialization of the process - and must call ssh_channel:init/1. +

    Makes an existing process an ssh_channel + process. Does not return, instead the calling process will + enter the ssh_channel process receive loop and become an + ssh_channel process. The process must have been started using + one of the start functions in proc_lib, see proc_lib(3). The + user is responsible for any initialization of the process + and needs to call ssh_channel:init/1

    init(Options) -> {ok, State} | {ok, State, Timeout} | {stop, Reason} - Initiates an ssh_channel process. + Initiates a ssh_channel process. Options = [{Option, Value}] State = term() - Timeout = timeout() - Reason = term() + Timeout = timeout() + Reason = term()

    @@ -161,47 +144,48 @@

    -

    The module that implements the channel behaviour.

    + The module that implements the channel behaviour. -

    The list of arguments to the init function of the callback module.

    + The list of arguments to the callback module's + init function. -

    Reference to the ssh connection as returned by ssh:connect/3

    + Reference to the ssh connection as returned by ssh:connect/3 -

    Id of the ssh channel.

    + Id of the SSH channel.

    This function is normally not called by the - user. The user only needs to call if the + user. The user only needs to call if for some reason the channel process needs to be started with help of proc_lib instead of calling ssh_channel:start/4 or - ssh_channel:start_link/4.

    + ssh_channel:start_link/4

    reply(Client, Reply) -> _ - Sends a reply to a client. + Send a reply to a client. - Client = opaque() + Client - opaque to the user, see explanation below Reply = term() -

    This function can be used by a channel to send a +

    This function can be used by a channel to explicitly send a reply to a client that called call/[2,3] when the reply cannot be defined in the return value of Module:handle_call/3.

    Client must be the From argument provided to the callback function handle_call/3. Reply is an arbitrary term, - which is given back to the client as the return value of - ssh_channel:call/[2,3].

    + which will be given back to the client as the return value of + ssh_channel:call/[2,3].>

    @@ -209,25 +193,24 @@ start(SshConnection, ChannelId, ChannelCb, CbInitArgs) -> start_link(SshConnection, ChannelId, ChannelCb, CbInitArgs) -> {ok, ChannelRef} | {error, Reason} - Starts a process that handles an SSH channel. + Starts a processes that handles a SSH channel. SshConnection = ssh_connection_ref() - ChannelId = ssh_channel_id() - As returned by - - ssh_connection:session_channel/[2,4]. + ChannelId = ssh_channel_id() + As returned by cannot be defined in the return value of + ssh_connection:session_channel/[2,4] ChannelCb = atom() - Name of the module implementing the service-specific parts + The name of the module implementing the service specific parts of the channel. CbInitArgs = [term()] - Argument list for the init function in the callback module. + Argument list for the init function in the callback module. ChannelRef = pid() -

    Starts a process that handles an SSH channel. It is - called internally, by the ssh daemon, or explicitly by the ssh - client implementations. The behavior sets the - trap_exit flag to true. +

    Starts a processes that handles an SSH channel. It will be + called internally by the SSH daemon or explicitly by the SSH + client implementations. The behavior will set the + trap_exit flag to true.

    @@ -236,19 +219,19 @@
    - CALLBACK TIME-OUTS + CALLBACK TIMEOUTS -

    The time-out values that can be returned by the callback functions - have the same semantics as in a gen_server. - If the time-out occurs, handle_msg/2 - is called as handle_msg(timeout, State).

    +

    The timeout values that may be returned by the callback functions + has the same semantics as in a gen_server + If the timeout occurs handle_msg/2 + will be called as handle_msg(timeout, State).

    Module:code_change(OldVsn, State, Extra) -> {ok, NewState} - Converts process state when code is changed. + Converts process state when code is changed. OldVsn = term() In the case of an upgrade, OldVsn is Vsn, and @@ -258,31 +241,31 @@ Module. If no such attribute is defined, the version is the checksum of the BEAM file. State = term() - Internal state of the channel. + The internal state of the channel. Extra = term() - Passed "as-is" from the {advanced,Extra} + Passed as-is from the {advanced,Extra} part of the update instruction. -

    Converts process state when code is changed.

    +

    Converts process state when code is changed.

    -

    This function is called by a client-side channel when it - is to update its internal state during a release - upgrade or downgrade, that is, when the instruction - {update,Module,Change,...}, where - Change={advanced,Extra}, is given in the appup - file. For more information, refer to Section 9.11.6 - Release Handling Instructions in the - System Documentation. +

    This function is called by a client side channel when it + should update its internal state during a release + upgrade/downgrade, i.e. when the instruction + {update,Module,Change,...} where + Change={advanced,Extra} is given in the appup + file. See OTP + Design Principles for more information.

    Soft upgrade according to the OTP release concept is not straight forward for the server side, as subsystem - channel processes are spawned by the ssh application and - hence added to its supervisor tree. The subsystem channels can - be upgraded when upgrading the user application, if the callback - functions can handle two versions of the state, but this function - cannot be used in the normal way.

    + channel processes are spawned by the SSH application and + hence added to its supervisor tree. It could be possible to + upgrade the subsystem channels, when upgrading the user + application, if the callback functions can handle two + versions of the state, but this function can not be used in + the normal way.

    @@ -291,38 +274,36 @@ Module:init(Args) -> {ok, State} | {ok, State, timeout()} | {stop, Reason} - Makes necessary initializations and returns the + Makes necessary initializations and returns the initial channel state if the initializations succeed. - Args = term() - Last argument to ssh_channel:start_link/4. - State = term() - Reason = term() + Args = term() + Last argument to ssh_channel:start_link/4. + State = term() + Reason = term() -

    Makes necessary initializations and returns the initial channel +

    Makes necessary initializations and returns the initial channel state if the initializations succeed.

    -

    For more detailed information on time-outs, see Section - CALLBACK TIME-OUTS.

    +

    For more detailed information on timeouts see the section + CALLBACK TIMEOUTS.

    Module:handle_call(Msg, From, State) -> Result - Handles messages sent by calling - ssh_channel:call/[2,3]. + Handles messages sent by calling + ssh_channel:call/[2,3] Msg = term() - From = opaque() - Is to be used as argument to - ssh_channel:reply/2 + From = opaque to the user should be used as argument to + ssh_channel:reply/2 State = term() Result = {reply, Reply, NewState} | {reply, Reply, NewState, timeout()} | {noreply, NewState} | {noreply , NewState, timeout()} | {stop, Reason, Reply, NewState} | {stop, Reason, NewState} - Reply = term() - Will be the return value of ssh_channel:call/[2,3] + Reply = term() - will be the return value of ssh_channel:call/[2,3] NewState = term() Reason = term() @@ -330,15 +311,15 @@

    Handles messages sent by calling ssh_channel:call/[2,3]

    -

    For more detailed information on time-outs,, see Section - CALLBACK TIME-OUTS.

    +

    For more detailed information on timeouts see the section + CALLBACK TIMEOUTS.

    Module:handle_cast(Msg, State) -> Result - Handles messages sent by calling - ssh_channel:cact/2. + Handles messages sent by calling + ssh_channel:cact/2 Msg = term() State = term() @@ -348,11 +329,11 @@ Reason = term() -

    Handles messages sent by calling - ssh_channel:cast/2. +

    Handles messages sent by calling + ssh_channel:cast/2

    -

    For more detailed information on time-outs, see Section - CALLBACK TIME-OUTS.

    +

    For more detailed information on timeouts see the section + CALLBACK TIMEOUTS.

    @@ -360,33 +341,33 @@ Module:handle_msg(Msg, State) -> {ok, State} | {stop, ChannelId, State} - Handles other messages than SSH connection protocol, - call, or cast messages sent to the channel. + Handle other messages than SSH connection protocol, + call or cast messages sent to the channel. Msg = timeout | term() ChannelId = ssh_channel_id() State = term() -

    Handles other messages than SSH Connection Protocol, call, or +

    Handle other messages than ssh connection protocol, call or cast messages sent to the channel.

    -

    Possible Erlang 'EXIT' messages is to be handled by this - function and all channels are to handle the following message.

    +

    Possible erlang 'EXIT'-messages should be handled by this + function and all channels should handle the following message.

    -

    This is the first message that the channel receives. - It is sent just before the This is the first messages that will be received by + the channel, it is sent just before the ssh_channel:init/1 function - returns successfully. This is especially useful if the + returns successfully. This is especially useful if the server wants to send a message to the client without first receiving a message from it. If the message is not - useful for your particular scenario, ignore it by - immediately returning {ok, State}. -

    + useful for your particular scenario just ignore it by + immediately returning {ok, State}. +
    @@ -394,44 +375,42 @@ Module:handle_ssh_msg(Msg, State) -> {ok, State} | {stop, ChannelId, State} - Handles ssh connection protocol messages. + Handles ssh connection protocol messages. - Msg = ssh_connection:event() + Msg = ssh_connection:event() ChannelId = ssh_channel_id() State = term() -

    Handles SSH Connection Protocol messages that may need - service-specific attention. For details, - see ssh_connection:event(). +

    Handles SSH connection protocol messages that may need + service specific attention.

    -

    The following message is taken care of by the - ssh_channel behavior.

    +

    The following message is completely taken care of by the + SSH channel behavior

    -

    The channel behavior sends a close message to the - other side, if such a message has not already been sent. - Then it terminates the channel with reason normal.

    + The channel behavior will send a close message to the + other side if such a message has not already been sent and + then terminate the channel with reason normal.
    Module:terminate(Reason, State) -> _ - Does cleaning up before channel process termination. - + Reason = term() State = term()

    This function is called by a channel process when it is - about to terminate. Before this function is called, ssh_connection:close/2 - is called, if it has not been called earlier. - This function does any necessary cleaning + will be called if it has not been called earlier. + This function should do any necessary cleaning up. When it returns, the channel process terminates with reason Reason. The return value is ignored.

    diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/ssh_client_key_api.xml erlang-17.3-dfsg/lib/ssh/doc/src/ssh_client_key_api.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/ssh_client_key_api.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/ssh_client_key_api.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,127 +9,116 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. ssh_client_key_api - - - - ssh_client_key_api -behaviour(ssh_client_key_api). -

    Behavior describing the API for public key handling of an SSH client. By implementing - the callbacks defined in this behavior, the public key handling of an SSH client can - be customized. By default the ssh application implements this behavior - with help of the standard OpenSSH files, - see the ssh(6) application manual.

    +

    Behavior describing the API for an SSH client's public key handling. + By implementing the callbacks defined. + in this behavior it is possible to customize the SSH client's public key + handling. By default the SSH application implements this behavior + with help of the standard openssh files, see ssh(6).

    - DATA TYPES + DATA TYPES -

    Type definitions that are used more than once in this module, - or abstractions to indicate the intended use of the data - type, or both. For more details on public key data types, - refer to Section 2 Public Key Records in the - public_key user's guide: +

    Type definitions that are used more than once in this module + and/or abstractions to indicate the intended use of the data + type. For more details on public key data types + see the public_key user's guide.

    - - boolean() = -

    true | false

    - string() = -

    [byte()]

    - public_key() = -

    #'RSAPublicKey'{}| {integer(), #'Dss-Parms'{}}| term()

    - private_key() = -

    #'RSAPrivateKey'{} | #'DSAPrivateKey'{} | term()

    - public_key_algorithm() = -

    'ssh-rsa'| 'ssh-dss' | atom()

    -
    + +

    boolean() = true | false

    +

    string() = [byte()]

    +

    public_key() = #'RSAPublicKey'{}| {integer(), #'Dss-Parms'{}}| term()

    +

    private_key() = #'RSAPrivateKey'{} | #'DSAPrivateKey'{} | term()

    +

    public_key_algorithm() = 'ssh-rsa'| 'ssh-dss' | atom()

    +
    Module:add_host_key(HostNames, Key, ConnectOptions) -> ok | {error, Reason} - Adds a host key to the set of trusted host keys. + Adds a host key to the set of trusted host keys HostNames = string() - Description of the host that owns the PublicKey. + Description of the host that owns the PublicKey - Key = public_key() - Normally an RSA or DSA public key, but handling of other public keys can be added. + Key = public_key() + Normally an RSA or DSA public key but handling of other public keys can be added - ConnectOptions = proplists:proplist() - Options provided to ssh:connect/[3,4] - Reason = term(). + ConnectOptions = proplists:proplist() + Options provided to ssh:connect/[3,4] + Reason = term() -

    Adds a host key to the set of trusted host keys.

    +

    Adds a host key to the set of trusted host keys

    Module:is_host_key(Key, Host, Algorithm, ConnectOptions) -> Result - Checks if a host key is trusted. + Checks if a host key is trusted Key = public_key() - Normally an RSA or DSA public key, but handling of other public keys can be added. + Normally an RSA or DSA public key but handling of other public keys can be added Host = string() - Description of the host. + Description of the host Algorithm = public_key_algorithm() - Host key algorithm. Is to support 'ssh-rsa'| 'ssh-dss', but more algorithms + Host key algorithm. Should support 'ssh-rsa'| 'ssh-dss' but additional algorithms can be handled. - ConnectOptions = proplists:proplist() - Options provided to ssh:connect/[3,4]. + ConnectOptions = proplists:proplist() + Options provided to ssh:connect/[3,4] - Result = boolean() + Result = boolean() -

    Checks if a host key is trusted.

    +

    Checks if a host key is trusted

    Module:user_key(Algorithm, ConnectOptions) -> {ok, PrivateKey} | {error, Reason} - Fetches the users public key matching the Algorithm. + Fetches the users "public key" matching the Algorithm. Algorithm = public_key_algorithm() - Host key algorithm. Is to support 'ssh-rsa'| 'ssh-dss' but more algorithms + Host key algorithm. Should support 'ssh-rsa'| 'ssh-dss' but additional algorithms can be handled. - ConnectOptions = proplists:proplist() - Options provided to ssh:connect/[3,4] + ConnectOptions = proplists:proplist() + Options provided to ssh:connect/[3,4] - PrivateKey = private_key() - Private key of the user matching the Algorithm. + PrivateKey = private_key() + The private key of the user matching the Algorithm - Reason = term() + Reason = term() -

    Fetches the users public key matching the Algorithm.

    -

    The private key contains the public key.

    - +

    Fetches the users "public key" matching the Algorithm. +

    The private key contains the public key

    +

    diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/ssh_connection.xml erlang-17.3-dfsg/lib/ssh/doc/src/ssh_connection.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/ssh_connection.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/ssh_connection.xml 2014-09-16 19:10:57.000000000 +0000 @@ -5,194 +5,174 @@
    2008 - 2015 + 2013 Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. ssh_connection - - -
    ssh_connection - - This module provides API functions to send SSH Connection Protocol - events to the other side of an SSH channel. + This module provides API functions to send SSH Connection Protocol + events to the other side of an SSH channel. -

    The SSH Connection Protocol - is used by clients and servers, that is, SSH channels, to communicate over the - SSH connection. The API functions in this module send SSH Connection Protocol events, - which are received as messages by the remote channel. - If the receiving channel is an Erlang process, the - messages have the format - . - If the ssh_channel behavior is used to - implement the channel process, these messages are handled by - handle_ssh_msg/2.

    +

    The SSH Connection Protocol is used by clients and servers + (i.e. SSH channels) to communicate over the SSH connection. The + API functions in this module sends SSH Connection Protocol events + that are received as messages by the remote channel. + In the case that the receiving channel is an Erlang process the + message will be on the following format + . If the ssh_channel behavior is used to + implement the channel process these will be handled by + handle_ssh_msg/2 .

    - DATA TYPES + DATA TYPES -

    Type definitions that are used more than once in this module, - or abstractions to indicate the intended use of the data - type, or both:

    +

    Type definitions that are used more than once in this module and/or + abstractions to indicate the intended use of the data type:

    - - boolean() = -

    true | false

    - string() = -

    list of ASCII characters

    - timeout() = -

    infinity | integer() in milliseconds

    - ssh_connection_ref() = -

    opaque() -as returned by - ssh:connect/3 or sent to an SSH channel processes

    - ssh_channel_id() = -

    integer()

    - ssh_data_type_code() = -

    1 ("stderr") | 0 ("normal") are - valid values, see - RFC 4254 Section 5.2.

    - ssh_request_status() = -

    success | failure

    - event() = -

    {ssh_cm, ssh_connection_ref(), ssh_event_msg()}

    - ssh_event_msg() = -

    data_events() | status_events() | terminal_events()

    - reason() = -

    timeout | closed

    -
    +

    boolean() = true | false

    +

    string() = list of ASCII characters

    +

    timeout() = infinity | integer() - in milliseconds.

    +

    ssh_connection_ref() - opaque to the user returned by + ssh:connect/3 or sent to an SSH channel processes

    +

    ssh_channel_id() = integer()

    +

    ssh_data_type_code() = 1 ("stderr") | 0 ("normal") are + currently valid values see RFC 4254 section 5.2.

    +

    ssh_request_status() = success | failure

    +

    event() = {ssh_cm, ssh_connection_ref(), ssh_event_msg()}

    +

    ssh_event_msg() = data_events() | status_events() | terminal_events()

    - data_events() + data_events() - -

    Data has arrived on the channel. This event is sent as a - result of calling - ssh_connection:send/[3,4,5].

    + + Data has arrived on the channel. This event is sent as + result of calling ssh_connection:send/[3,4,5] -

    Indicates that the other side sends no more data. - This event is sent as a result of calling ssh_connection:send_eof/2. -

    + Indicates that the other side will not send any more + data. This event is sent as result of calling ssh_connection:send_eof/2 +
    - status_events() + status_events() -

    A signal can be delivered to the remote process/service - using the following message. Some systems do not support - signals, in which case they are to ignore this message. There is - currently no function to generate this event as the signals - referred to are on OS-level and not something generated by an - Erlang program.

    - - - -

    A remote execution can terminate violently because of a signal. - Then this message can be received. For details on valid string - values, see RFC 4254 - Section 6.10, which shows a special case of these signals.

    + A signal can be delivered to the remote process/service + using the following message. Some systems will not support + signals, in which case they should ignore this message. There is + currently no funtion to generate this event as the signals + refered to are on OS-level and not something generated by an + Erlang program. + + + + A remote execution may terminate violently due to a signal + then this message may be received. For details on valid string + values see RFC 4254 section 6.10. Special case of the signals + mentioned above. - -

    When the command running at the other end terminates, the + + When the command running at the other end terminates, the following message can be sent to return the exit status of the - command. A zero exit_status usually means that the command - terminated successfully. This event is sent as a result of calling + command. A zero 'exit_status' usually means that the command + terminated successfully. This event is sent as result of calling - ssh_connection:exit_status/3.

    + ssh_connection:exit_status/3
    -

    This event is sent as a result of calling - ssh_connection:close/2. - Both the handling of this event and sending it are taken care of by the - ssh_channel behavior.

    + This event is sent as result of calling + ssh_connection:close/2 Both the handling of this + event and sending of it will be taken care of by the + ssh_channel behavior.
    - terminal_events() + terminal_events() -

    Channels implementing a shell and command execution on the - server side are to handle the following messages that can be sent by client- - channel processes.

    - -

    Events that include a WantReply expect the event handling - process to call - ssh_connection:reply_request/4 - with the boolean value of WantReply as the second argument.

    +

    Channels implementing a shell and command execution on the + server side should handle the following messages that may be sent by client channel processes.

    + +

    Events that includes a WantReply expects the event handling + process to call ssh_connection:reply_request/4 + with the boolean value of WantReply as the second + argument.

    - -

    Environment variables can be passed to the shell/command - to be started later. This event is sent as a result of calling ssh_connection:setenv/5. -

    + + Environment variables may be passed to the shell/command + to be started later. This event is sent as result of calling ssh_connection:setenv/5 + -

    A pseudo-terminal has been requested for the - session. Terminal is the value of the TERM environment - variable value, that is, vt100. Zero dimension parameters must - be ignored. The character/row dimensions override the pixel - dimensions (when non-zero). Pixel dimensions refer to the - drawable area of the window. Opcode in the + boolean() = WantReply, {string() = Terminal, integer() = CharWidth, + integer() = RowHeight, integer() = PixelWidth, integer() = PixelHight, + [{atom() | integer() = Opcode, + integer() = Value}] = TerminalModes}}]]> + A pseudo-terminal has been requested for the + session. Terminal is the value of the TERM environment + variable value (e.g., vt100). Zero dimension parameters must + be ignored. The character/row dimensions override the pixel + dimensions (when nonzero). Pixel dimensions refer to the + drawable area of the window. The Opcode in the TerminalModes list is the mnemonic name, represented - as a lowercase Erlang atom, defined in - RFC 4254, Section 8. - It can also be an Opcode if the mnemonic name is not listed in the - RFC. Example: OP code: 53, mnemonic name ECHO erlang atom: - echo. This event is sent as a result of calling ssh_connection:ptty_alloc/4.

    - - -

    This message requests that the user default shell - is started at the other end. This event is sent as a result of calling - ssh_connection:shell/2. -

    - - -

    When the window (terminal) size changes on the client - side, it can send a message to the server side to inform it of - the new dimensions. No API function generates this event.

    + as an lowercase erlang atom, defined in + RFC 4254 section 8, + or the opcode if the mnemonic name is not listed in the + RFC. Example OP code: 53, mnemonic name ECHO erlang atom: + echo. There is currently no API function to generate this + event.
    + + + This message will request that the user's default shell + be started at the other end. This event is sent as result of calling ssh_connection:shell/2 + + + + When the window (terminal) size changes on the client + side, it MAY send a message to the server side to inform it of + the new dimensions. There is currently no API function to generate this + event. -

    This message requests that the server starts - execution of the given command. This event is sent as a result of calling ssh_connection:exec/4 . -

    + boolean() = WantReply, string() = Cmd}]]> + This message will request that the server starts + execution of the given command. This event is sent as result of calling ssh_connection:exec/4 + @@ -202,83 +182,80 @@ adjust_window(ConnectionRef, ChannelId, NumOfBytes) -> ok - Adjusts the SSH flow control window. + Adjusts the SSH flowcontrol window. - ConnectionRef = ssh_connection_ref() - ChannelId = ssh_channel_id() - NumOfBytes = integer() + ConnectionRef = ssh_connection_ref() + ChannelId = ssh_channel_id() + NumOfBytes = integer() -

    Adjusts the SSH flow control window. This is to be done by both the - client- and server-side channel processes.

    +

    Adjusts the SSH flowcontrol window. This shall be done by both client and server side channel processes.

    -

    Channels implemented with the ssh_channel - behavior do not normally need to call this function as flow control - is handled by the behavior. The behavior adjusts the window every time +

    Channels implemented with the ssh_channel + behavior will normaly not need to call this function as flow control + will be handled by the behavior. The behavior will adjust the window every time the callback - handle_ssh_msg/2 returns after processing channel data.

    + handle_ssh_msg/2 has returned after processing channel data

    close(ConnectionRef, ChannelId) -> ok - Sends a close message on the channel ChannelId. + Sends a close message on the channel ChannelId. - ConnectionRef = ssh_connection_ref() - ChannelId = ssh_channel_id() + ConnectionRef = ssh_connection_ref() + ChannelId = ssh_channel_id() -

    A server- or client-channel process can choose to close their session by - sending a close event. +

    A server or client channel process can choose to close their session by sending a close event.

    -

    This function is called by the ssh_channel - behavior when the channel is terminated, see ssh_channel(3). Thus, channels implemented - with the behavior are not to call this function explicitly.

    +

    This function will be called by the ssh_channel + behavior when the channel is terminated see ssh_channel(3) so channels implemented with the + behavior should not call this function explicitly.

    - exec(ConnectionRef, ChannelId, Command, TimeOut) -> ssh_request_status() | - {error, reason()} - Requests that the server starts the execution of the given command. + exec(ConnectionRef, ChannelId, Command, TimeOut) -> ssh_request_status() + Request that the server start the execution of the given command. - ConnectionRef = ssh_connection_ref() - ChannelId = ssh_channel_id() - Command = string() - Timeout = timeout() + ConnectionRef = ssh_connection_ref() + ChannelId = ssh_channel_id() + Command = string() + Timeout = timeout() -

    Is to be called by a client-channel process to request that the server starts - executing the given command. The result is several messages according to the - following pattern. The last message is a channel close message, as the exec - request is a one-time execution that closes the channel when it is done.

    +

    Should be called by a client channel process to request that the server starts execution of the + given command, the result will be several messages according to the following pattern. Note + that the last message will be a channel close message, as the exec request is a one time + execution that closes the channel when it is done.

    - N x {ssh_cm, ssh_connection_ref(), - {data, ssh_channel_id(), ssh_data_type_code(), Data :: binary()}} -

    The result of executing the command can be only one line - or thousands of lines depending on the command.

    + N x {ssh_cm, ssh_connection_ref(), + {data, ssh_channel_id(), ssh_data_type_code(), binary() = Data}} + The result of executing the command may be only one line + or thousands of lines depending on the command. 0 or 1 x {ssh_cm, ssh_connection_ref(), {eof, ssh_channel_id()}} -

    Indicates that no more data is to be sent.

    + Indicates that no more data will be sent. 0 or 1 x {ssh_cm, ssh_connection_ref(), {exit_signal, - ssh_channel_id(), ExitSignal :: string(), ErrorMsg :: string(), LanguageString :: string()}} -

    Not all systems send signals. For details on valid string - values, see RFC 4254, Section 6.10

    + ssh_channel_id(), string() = ExitSignal, string() = ErrorMsg, string() = LanguageString}} + Not all systems send signals. For details on valid string + values see RFC 4254 section 6.10 0 or 1 x {ssh_cm, ssh_connection_ref(), {exit_status, - ssh_channel_id(), ExitStatus :: integer()}} -

    It is recommended by the SSH Connection Protocol to send this - message, but that is not always the case.

    + ssh_channel_id(), integer() = ExitStatus}} + It is recommended by the ssh connection protocol that this + message shall be sent, but that may not always be the case. - 1 x {ssh_cm, ssh_connection_ref(), + 1 x {ssh_cm, ssh_connection_ref(), {closed, ssh_channel_id()}} -

    Indicates that the ssh_channel started for the - execution of the command has now been shut down.

    + Indicates that the ssh channel started for the + execution of the command has now been shutdown.
    @@ -287,72 +264,32 @@ exit_status(ConnectionRef, ChannelId, Status) -> ok Sends the exit status of a command to the client. - ConnectionRef = ssh_connection_ref() - ChannelId = ssh_channel_id() - Status = integer() + ConnectionRef = ssh_connection_ref() + ChannelId = ssh_channel_id() + Status = integer() -

    Is to be called by a server-channel process to send the exit status of a command - to the client.

    +

    Should be called by a server channel process to sends the exit status of a command to the client.

    - - ptty_alloc(ConnectionRef, ChannelId, Options) -> - ptty_alloc(ConnectionRef, ChannelId, Options, Timeout) -> > ssh_request_status() | - {error, reason()} - Sends an SSH Connection Protocol pty_req, - to allocate a pseudo-terminal. - - ConnectionRef = ssh_connection_ref() - ChannelId = ssh_channel_id() - Options = proplists:proplist() - - -

    Sends an SSH Connection Protocol pty_req, to allocate a pseudo-terminal. - Is to be called by an SSH client process.

    -

    Options:

    - - - {term, string()} -

    Defaults to os:getenv("TERM") or vt100 - if it is undefined.

    - - {width, integer()} -

    Defaults to 80 if pixel_width is not defined.

    - - {height, integer()} -

    Defaults to 24 if pixel_height is not defined.

    - - {pixel_width, integer()} -

    Is disregarded if width is defined.

    - - {pixel_height, integer()} -

    Is disregarded if height is defined.

    - - {pty_opts, [{posix_atom(), integer()}]} -

    Option can be an empty list. Otherwise, see possible POSIX names - in Section 8 in RFC 4254.

    -
    -
    -
    -
    - reply_request(ConnectionRef, WantReply, Status, ChannelId) -> ok - Sends status replies to requests that want such replies. + Send status replies to requests that want such replies. - ConnectionRef = ssh_connection_ref() - WantReply = boolean() - Status = ssh_request_status() - ChannelId = ssh_channel_id() + ConnectionRef = ssh_connection_ref() + WantReply = boolean() + Status = ssh_request_status() + ChannelId = ssh_channel_id()

    Sends status replies to requests where the requester has - stated that it wants a status report, that is, WantReply = true. - If WantReply is false, calling this function becomes a - "noop". Is to be called while handling an SSH Connection - Protocol message containing a WantReply boolean value.

    + stated that they want a status report e.i . WantReply = true, + if WantReply is false calling this function will be a + "noop". Should be called while handling an ssh connection + protocol message containing a WantReply boolean + value. +

    @@ -362,103 +299,98 @@ send(ConnectionRef, ChannelId, Type, Data) -> send(ConnectionRef, ChannelId, Type, Data, TimeOut) -> ok | {error, timeout} | {error, closed} - Sends channel data. + Sends channel data - ConnectionRef = ssh_connection_ref() - ChannelId = ssh_channel_id() - Data = binary() - Type = ssh_data_type_code() - Timeout = timeout() + ConnectionRef = ssh_connection_ref() + ChannelId = ssh_channel_id() + Data = binary() + Type = ssh_data_type_code() + Timeout = timeout() -

    Is to be called by client- and server-channel processes to send data to each other. -

    -

    The function subsystem/4 and subsequent - calls of send/3,4,5 must be executed in the same process. +

    Should be called by client- and server channel processes to send data to each other.

    send_eof(ConnectionRef, ChannelId) -> ok | {error, closed} - Sends EOF on channel ChannelId. + Sends eof on the channel ChannelId. - ConnectionRef = ssh_connection_ref() - ChannelId = ssh_channel_id() + ConnectionRef = ssh_connection_ref() + ChannelId = ssh_channel_id() -

    Sends EOF on channel ChannelId.

    +

    Sends eof on the channel ChannelId. +

    - session_channel(ConnectionRef, Timeout) -> + session_channel(ConnectionRef, Timeout) -> session_channel(ConnectionRef, InitialWindowSize, - MaxPacketSize, Timeout) -> {ok, ssh_channel_id()} | {error, reason()} - Opens a channel for an SSH session. + MaxPacketSize, Timeout) -> {ok, ssh_channel_id()} | {error, Reason} + Opens a channel for a ssh session. - ConnectionRef = ssh_connection_ref() - InitialWindowSize = integer() - MaxPacketSize = integer() - Timeout = timeout() - Reason = term() + ConnectionRef = ssh_connection_ref() + InitialWindowSize = integer() + MaxPacketSize = integer() + Timeout = timeout() + Reason = term()

    Opens a channel for an SSH session. The channel id returned from this function - is the id used as input to the other functions in this module.

    + is the id used as input to the other funtions in this module. +

    - setenv(ConnectionRef, ChannelId, Var, Value, TimeOut) -> ssh_request_status() | - {error, reason()} - Environment variables can be passed to the + setenv(ConnectionRef, ChannelId, Var, Value, TimeOut) -> ssh_request_status() + Environment variables may be passed to the shell/command to be started later. - ConnectionRef = ssh_connection_ref() - ChannelId = ssh_channel_id() - Var = string() - Value = string() - Timeout = timeout() + ConnectionRef = ssh_connection_ref() + ChannelId = ssh_channel_id() + Var = string() + Value = string() + Timeout = timeout() -

    Environment variables can be passed before starting the - shell/command. Is to be called by a client channel processes.

    +

    Environment variables may be passed before starting the + shell/command. Should be called by a client channel processes. +

    - shell(ConnectionRef, ChannelId) -> ssh_request_status() | {error, closed} + shell(ConnectionRef, ChannelId) -> ssh_request_status() - Requests that the user default shell (typically defined in - /etc/passwd in Unix systems) is to be executed at the server end. + Requests that the user's default shell (typically + defined in /etc/passwd in UNIX systems) shall be executed at the server + end. - ConnectionRef = ssh_connection_ref() - ChannelId = ssh_channel_id() + ConnectionRef = ssh_connection_ref() + ChannelId = ssh_channel_id() -

    Is to be called by a client channel process to request that the user default - shell (typically defined in /etc/passwd in Unix systems) is executed - at the server end.

    +

    Should be called by a client channel process to request that the user's default shell (typically + defined in /etc/passwd in UNIX systems) shall be executed at the server end. +

    - subsystem(ConnectionRef, ChannelId, Subsystem, Timeout) -> ssh_request_status() | - {error, reason()} - Requests to execute a predefined subsystem on the server. + subsystem(ConnectionRef, ChannelId, Subsystem, Timeout) -> ssh_request_status() + - ConnectionRef = ssh_connection_ref() - ChannelId = ssh_channel_id() - Subsystem = string() - Timeout = timeout() + ConnectionRef = ssh_connection_ref() + ChannelId = ssh_channel_id() + Subsystem = string() + Timeout = timeout() -

    Is to be called by a client-channel process for requesting to execute a predefined - subsystem on the server. -

    -

    The function subsystem/4 and subsequent calls of - send/3,4,5 must be executed in the same process. +

    Should be called by a client channel process for requesting to execute a predefined subsystem on the server.

    diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/ssh_server_key_api.xml erlang-17.3-dfsg/lib/ssh/doc/src/ssh_server_key_api.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/ssh_server_key_api.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/ssh_server_key_api.xml 2014-09-16 19:10:57.000000000 +0000 @@ -5,100 +5,86 @@
    2012 - 2015 + 2013 Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. ssh_server_key_api - - - -
    ssh_server_key_api -behaviour(ssh_server_key_api). -

    Behaviour describing the API for public key handling of an SSH server. By implementing - the callbacks defined in this behavior, the public key handling of an SSH server can - be customized. By default the SSH application implements this behavior - with help of the standard OpenSSH files, - see the ssh(6) application manual.

    +

    Behaviour describing the API for an SSH server's public key handling. By implementing the callbacks defined + in this behavior it is possible to customize the SSH server's public key + handling. By default the SSH application implements this behavior + with help of the standard openssh files, see ssh(6).

    - DATA TYPES + DATA TYPES -

    Type definitions that are used more than once in this module, - or abstractions to indicate the intended use of the data - type, or both. For more details on public key data types, - refer to Section 2 Public Key Records in the - public_key user's guide. +

    Type definitions that are used more than once in this module + and/or abstractions to indicate the intended use of the data + type. For more details on public key data types + see the public_key user's guide.

    - - boolean() = -

    true | false

    - string() = -

    [byte()]

    - public_key() = -

    #'RSAPublicKey'{}| {integer(), #'Dss-Parms'{}}| term()

    - private_key() = -

    #'RSAPrivateKey'{} | #'DSAPrivateKey'{} | term()

    - public_key_algorithm() = -

    'ssh-rsa'| 'ssh-dss' | atom()

    -
    +

    boolean() = true | false

    +

    string() = [byte()]

    +

    public_key() = #'RSAPublicKey'{} | {integer(), #'Dss-Parms'{}} | term()

    +

    private_key() = #'RSAPrivateKey'{} | #'DSAPrivateKey'{} | term()

    +

    public_key_algorithm() = 'ssh-rsa' | 'ssh-dss' | atom()

    - + Module:host_key(Algorithm, DaemonOptions) -> {ok, Key} | {error, Reason} - Fetches the host’s private key. + Fetches the hosts private key Algorithm = public_key_algorithm() - Host key algorithm. Is to support 'ssh-rsa' | 'ssh-dss', but more algorithms + Host key algorithm. Should support 'ssh-rsa' | 'ssh-dss' but additional algorithms can be handled. - DaemonOptions = proplists:proplist() - Options provided to ssh:daemon/[2,3]. - Key = private_key() - Private key of the host matching the Algorithm. - Reason = term() + DaemonOptions = proplists:proplist() + Options provided to ssh:daemon/[2,3] + Key = private_key() + The private key of the host matching the Algorithm + Reason = term() -

    Fetches the private key of the host.

    +

    Fetches the hosts private key

    Module:is_auth_key(Key, User, DaemonOptions) -> Result - Checks if the user key is authorized. + Checks if the user key is authorized - Key = public_key() - Normally an RSA or DSA public key, but handling of other public keys can be added - User = string() - User owning the public key. - DaemonOptions = proplists:proplist() - Options provided to ssh:daemon/[2,3]. - Result = boolean() + Key = public_key() + Normally an RSA or DSA public key but handling of other public keys can be added + User = string() + The user owning the public key + DaemonOptions = proplists:proplist() + Options provided to ssh:daemon/[2,3] + Result = boolean() -

    Checks if the user key is authorized.

    +

    Checks if the user key is authorized

    diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/ssh_sftpd.xml erlang-17.3-dfsg/lib/ssh/doc/src/ssh_sftpd.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/ssh_sftpd.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/ssh_sftpd.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,88 +8,81 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. ssh_sftpd - - 2005-09-22 - ssh_sftpd.sgml ssh_sftpd - Specifies the channel process to handle an SFTP subsystem. + Specifies the channel process to handle an sftp subsystem. -

    Specifies a channel process to handle an SFTP subsystem.

    +

    Specifies a channel process to handle a sftp subsystem.

    - DATA TYPES - - subsystem_spec() = -

    {subsystem_name(), {channel_callback(), channel_init_args()}}

    - subsystem_name() = -

    "sftp"

    - channel_callback() = -

    atom() - Name of the Erlang module implementing the subsystem using the - ssh_channel behavior, see the - ssh_channel(3) manual page.

    - channel_init_args() = -

    list() - The one given as argument to function subsystem_spec/1.

    -
    + DATA TYPES +

    subsystem_spec() = {subsystem_name(), {channel_callback(), channel_init_args()}}

    +

    subsystem_name() = "sftp"

    +

    channel_callback() = atom() - Name of the erlang module implementing the + subsystem using the ssh_channel behavior see + ssh_channel(3)

    +

    channel_init_args() = list() - The one given as argument to function + subsystem_spec/1.

    subsystem_spec(Options) -> subsystem_spec() - Returns the subsystem specification that allows an SSH daemon to handle the subsystem "sftp". + Returns the subsystem specification that allows an ssh daemon to handle the subsystem "sftp". Options = [{Option, Value}] -

    Is to be used together with ssh:daemon/[1,2,3]

    -

    Options:

    +

    Should be used together with ssh:daemon/[1,2,3]

    +

    Options are:

    -

    Sets the initial current working directory for the server.

    +

    Sets the initial current working directory for the + server.

    Determines which module to call for accessing - the file server. The default value is ssh_sftpd_file, which uses the - file and filelib - APIs to access the standard OTP file server. This option can be used to plug in + the file server. The default value is ssh_sftpd_file that uses the + file and filelib API:s to access the standard OTP file + server. This option may be used to plug in other file servers.

    The default value is 0, which means that there is no upper limit. - If supplied, the number of filenames returned to the SFTP client per READDIR + If supplied, the number of filenames returned to the sftp client per READDIR request is limited to at most the given value.

    -

    Sets the SFTP root directory. Then the user cannot see any files - above this root. If, for example, the root directory is set to /tmp, - then the user sees this directory as /. If the user then writes - cd /etc, the user moves to /tmp/etc. +

    Sets the sftp root directory. The user will then not be + able to see any files above this root. If for instance + the root is set to /tmp the user will see this + directory as / and if the user does cd /etc + the user will end up in /tmp/etc.

    -

    Sets the SFTP version to use. Defaults to 5. Version 6 is under +

    Sets the sftp version to use, defaults to 5. Version 6 is under development and limited.

    diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/ssh_sftp.xml erlang-17.3-dfsg/lib/ssh/doc/src/ssh_sftp.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/ssh_sftp.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/ssh_sftp.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,196 +4,139 @@
    - 20052015 + 20052013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. ssh_sftp OTP - 2005-09-22 - ssh_sftp.sgml
    ssh_sftp SFTP client. -

    This module implements an SSH FTP (SFTP) client. SFTP is a +

    This module implements an SFTP (SSH FTP) client. SFTP is a secure, encrypted file transfer service available for SSH.

    - DATA TYPES -

    Type definitions that are used more than once in this module, - or abstractions to indicate the intended use of the data type, or both: + DATA TYPES +

    Type definitions that are used more than once in this module + and/or abstractions to indicate the intended use of the data type:

    - - - ssh_connection_ref() = -

    opaque() - as returned by ssh:connect/3

    - timeout() -

    = infinity | integer() in milliseconds. Default infinity.

    -
    +

    ssh_connection_ref() - opaque to the user + returned by ssh:connect/3

    +

    timeout() = infinity | integer() - in milliseconds.

    - Time-outs -

    If the request functions for the SFTP channel return {error, timeout}, - it does not guarantee that the request never reached the server and was - not performed. It only means that no answer was received from the - server within the expected time.

    + TIMEOUTS +

    If the request functions for the SFTP channel return {error, timeout} + it does not guarantee that the request did not reach the server and was + not performed, it only means that we did not receive an answer from the + server within the time that was expected.

    - - apread(ChannelPid, Handle, Position, Len) -> {async, N} | {error, Reason} - Reads asynchronously from an open file. - - ChannelPid = pid() - Handle = term() - Position = integer() - Len = integer() - N = term() - Reason = term() - - -

    The function reads from a specified position, - combining the and functions.

    -

    ssh_sftp:apread/4

    -
    - - - apwrite(ChannelPid, Handle, Position, Data) -> ok | {error, Reason} - Writes asynchronously to an open file. - - ChannelPid = pid() - Handle = term() - Position = integer() - Len = integer() - Data = binary() - Timeout = timeout() - Reason = term() - - -

    writes on a specified position, combining - the and operations.

    -

    ssh_sftp:awrite/3

    -
    - - - aread(ChannelPid, Handle, Len) -> {async, N} | {error, Error} - Reads asynchronously from an open file. - - ChannelPid = pid() - Handle = term() - Position = integer() - Len = integer() - N = term() - Reason = term() - - -

    Reads from an open file, without waiting for the result. If the - handle is valid, the function returns , where N - is a term guaranteed to be unique between calls of . - The actual data is sent as a message to the calling process. This - message has the form , where - is the result from the read, either , - , or .

    -
    -
    - - - - awrite(ChannelPid, Handle, Data) -> ok | {error, Reason} - Writes asynchronously to an open file. + start_channel(ConnectionRef) -> + start_channel(ConnectionRef, Options) -> + start_channel(Host, Options) -> + start_channel(Host, Port, Options) -> {ok, Pid} | {ok, Pid, ConnectionRef} | + {error, Reason} + Starts a SFTP client - ChannelPid = pid() - Handle = term() - Position = integer() - Len = integer() - Data = binary() - Timeout = timeout() + Host = string() + ConnectionRef = ssh_connection_ref() + Port = integer() + Options = [{Option, Value}] Reason = term() -

    Writes to an open file, without waiting for the result. If the - handle is valid, the function returns , where N - is a term guaranteed to be unique between calls of - . The result of the operation is sent - as a message to the calling process. This message has the form - , where is the result - from the write, either , or .

    +

    If no connection reference is provided, a connection is set + up and the new connection is returned. An SSH channel process + is started to handle the communication with the SFTP server. + The returned pid for this process should be used as input to + all other API functions in this module.

    + +

    Options are:

    + + + +

    The timeout is passed to the ssh_channel start function, + and defaults to infinity.

    +
    +
    +

    All other options are directly passed to + ssh:connect/3 or ignored if a + connection is already provided.

    - close(ChannelPid, Handle) -> - close(ChannelPid, Handle, Timeout) -> ok | {error, Reason} - Closes an open handle. + stop_channel(ChannelPid) -> ok + Stops the SFTP client channel. ChannelPid = pid() - Handle = term() - Timeout = timeout() - Reason = term() -

    Closes a handle to an open file or directory on the server.

    +

    Stops an SFTP channel. Does not close the SSH connetion. + Use ssh:close/1 to close it.

    - + - delete(ChannelPid, Name) -> - delete(ChannelPid, Name, Timeout) -> ok | {error, Reason} - Deletes a file. + read_file(ChannelPid, File) -> + read_file(ChannelPid, File, Timeout) -> {ok, Data} | {error, Reason} + Read a file - ChannelPid = pid() - Name = string() + ChannelPid = pid() + File = string() + Data = binary() Timeout = timeout() - Reason = term() + Reason = term() -

    Deletes the file specified by , like - file:delete/1

    +

    Reads a file from the server, and returns the data in a binary, + like .

    - - del_dir(ChannelPid, Name) -> - del_dir(ChannelPid, Name, Timeout) -> ok | {error, Reason} - Deletes an empty directory. + write_file(ChannelPid, File, Iolist) -> + write_file(ChannelPid, File, Iolist, Timeout) -> ok | {error, Reason} + Write a file ChannelPid = pid() - Name = string() + File = string() + Iolist = iolist() Timeout = timeout() Reason = term() -

    Deletes a directory specified by . - The directory must be empty before it can be successfully deleted. -

    +

    Writes a file to the server, like + . The file is created if + it does not exist or is owerwritten if it does.

    - - - list_dir(ChannelPid, Path) -> + + list_dir(ChannelPid, Path) -> list_dir(ChannelPid, Path, Timeout) -> {ok, Filenames} | {error, Reason} - Lists the directory. + List directory ChannelPid = pid() Path = string() @@ -207,139 +150,169 @@ filenames as a list of strings.

    - - make_dir(ChannelPid, Name) -> - make_dir(ChannelPid, Name, Timeout) -> ok | {error, Reason} - Creates a directory. + open(ChannelPid, File, Mode) -> + open(ChannelPid, File, Mode, Timeout) -> {ok, Handle} | {error, Reason} + Open a file and return a handle ChannelPid = pid() - Name = string() + File = string() + Mode = [Modeflag] + Modeflag = read | write | creat | trunc | append | binary Timeout = timeout() + Handle = term() Reason = term() -

    Creates a directory specified by . - must be a full path to a new directory. The directory can only be - created in an existing directory.

    +

    Opens a file on the server, and returns a handle that + can be used for reading or writing.

    - - make_symlink(ChannelPid, Name, Target) -> - make_symlink(ChannelPid, Name, Target, Timeout) -> ok | {error, Reason} - Creates a symbolic link. + opendir(ChannelPid, Path) -> + opendir(ChannelPid, Path, Timeout) -> {ok, Handle} | {error, Reason} + Open a directory and return a handle ChannelPid = pid() - Name = string() - Target = string() + Path = string() + Timeout = timeout() Reason = term() -

    Creates a symbolic link pointing to with the - name , like - file:make_symlink/2

    +

    Opens a handle to a directory on the server, the handle + can be used for reading directory contents.

    - - - open(ChannelPid, File, Mode) -> - open(ChannelPid, File, Mode, Timeout) -> {ok, Handle} | {error, Reason} - Opens a file and returns a handle. + + close(ChannelPid, Handle) -> + close(ChannelPid, Handle, Timeout) -> ok | {error, Reason} + Close an open handle ChannelPid = pid() - File = string() - Mode = [Modeflag] - Modeflag = read | write | creat | trunc | append | binary + Handle = term() Timeout = timeout() - Handle = term() Reason = term() -

    Opens a file on the server and returns a handle, which - can be used for reading or writing.

    +

    Closes a handle to an open file or directory on the server.

    - opendir(ChannelPid, Path) -> - opendir(ChannelPid, Path, Timeout) -> {ok, Handle} | {error, Reason} - Opens a directory and returns a handle. + read(ChannelPid, Handle, Len) -> + read(ChannelPid, Handle, Len, Timeout) -> {ok, Data} | eof | {error, Error} + pread(ChannelPid, Handle, Position, Len) -> + pread(ChannelPid, Handle, Position, Len, Timeout) -> {ok, Data} | eof | {error, Error} + Read from an open file ChannelPid = pid() - Path = string() + Handle = term() + Position = integer() + Len = integer() Timeout = timeout() + Data = string() | binary() Reason = term() -

    Opens a handle to a directory on the server. The handle - can be used for reading directory contents.

    +

    Reads bytes from the file referenced by + . Returns , , or + . If the file is opened with , + is a binary, otherwise it is a string.

    +

    If the file is read past eof, only the remaining bytes + will be read and returned. If no bytes are read, + is returned.

    +

    The function reads from a specified position, + combining the and functions.

    - - open_tar(ChannelPid, Path, Mode) -> - open_tar(ChannelPid, Path, Mode, Timeout) -> {ok, Handle} | {error, Reason} - Opens a tar file on the server to which ChannelPid - is connected and returns a handle. + aread(ChannelPid, Handle, Len) -> {async, N} | {error, Error} + apread(ChannelPid, Handle, Position, Len) -> {async, N} | {error, Error} + Read asynchronously from an open file ChannelPid = pid() - Path = string() - Mode = [read] | [write] | [read,EncryptOpt] | [write,DecryptOpt] - EncryptOpt = {crypto,{InitFun,EncryptFun,CloseFun}} - DecryptOpt = {crypto,{InitFun,DecryptFun}} - InitFun = (fun() -> {ok,CryptoState}) | (fun() -> {ok,CryptoState,ChunkSize}) - CryptoState = any() - ChunkSize = undefined | pos_integer() - EncryptFun = (fun(PlainBin,CryptoState) -> EncryptResult) - EncryptResult = {ok,EncryptedBin,CryptoState} | {ok,EncryptedBin,CryptoState,ChunkSize} - PlainBin = binary() - EncryptedBin = binary() - DecryptFun = (fun(EncryptedBin,CryptoState) -> DecryptResult) - DecryptResult = {ok,PlainBin,CryptoState} | {ok,PlainBin,CryptoState,ChunkSize} - CloseFun = (fun(PlainBin,CryptoState) -> {ok,EncryptedBin}) + Handle = term() + Position = integer() + Len = integer() + N = term() + Reason = term() + + +

    Reads from an open file, without waiting for the result. If the + handle is valid, the function returns , where N + is a term guaranteed to be unique between calls of . + The actual data is sent as a message to the calling process. This + message has the form , where + is the result from the read, either , + or , or .

    +

    The function reads from a specified position, + combining the and functions.

    +
    +
    + + write(ChannelPid, Handle, Data) -> + write(ChannelPid, Handle, Data, Timeout) -> ok | {error, Error} + pwrite(ChannelPid, Handle, Position, Data) -> ok + pwrite(ChannelPid, Handle, Position, Data, Timeout) -> ok | {error, Error} + Write to an open file + + ChannelPid = pid() + Handle = term() + Position = integer() + Data = iolist() Timeout = timeout() Reason = term() -

    Opens a handle to a tar file on the server, associated with ChannelPid. - The handle can be used for remote tar creation and extraction, as defined by the - erl_tar:init/3 function. -

    - -

    For code exampel see Section - SFTP Client with TAR Compression and Encryption in - the ssh Users Guide.

    - -

    The crypto mode option is applied to the generated stream of bytes prior to sending - them to the SFTP server. This is intended for encryption but can be used for other - purposes. -

    -

    The InitFun is applied once - prior to any other crypto operation. The returned CryptoState is then folded into - repeated applications of the EncryptFun or DecryptFun. The binary returned - from those funs are sent further to the remote SFTP server. Finally, if doing encryption, - the CloseFun is applied to the last piece of data. The CloseFun is - responsible for padding (if needed) and encryption of that last piece. -

    -

    The ChunkSize defines the size of the PlainBins that EncodeFun is applied - to. If the ChunkSize is undefined, the size of the PlainBins varies, - because this is intended for stream crypto, whereas a fixed ChunkSize is intended for block crypto. - ChunkSizes can be changed in the return from the EncryptFun or - DecryptFun. The value can be changed between pos_integer() and undefined. -

    - +

    Writes to the file referenced by . + The file should be opened with or + flag. Returns if successful or S + otherwise.

    +

    Typical error reasons are:

    + + + +

    The file is not opened for writing.

    +
    + + +

    There is a no space left on the device.

    +
    +
    - - position(ChannelPid, Handle, Location) -> + awrite(ChannelPid, Handle, Data) -> ok | {error, Reason} + apwrite(ChannelPid, Handle, Position, Data) -> ok | {error, Reason} + Write asynchronously to an open file + + ChannelPid = pid() + Handle = term() + Position = integer() + Len = integer() + Data = binary() + Timeout = timeout() + Reason = term() + + +

    Writes to an open file, without waiting for the result. If the + handle is valid, the function returns , where N + is a term guaranteed to be unique between calls of + . The result of the operation is sent + as a message to the calling process. This message has the form + , where is the result + from the write, either , or .

    +

    The writes on a specified position, combining + the and operations.

    +
    +
    + + position(ChannelPid, Handle, Location) -> position(ChannelPid, Handle, Location, Timeout) -> {ok, NewPosition | {error, Error} - Sets the file position of a file. + Seek position in open file ChannelPid = pid() Handle = term() - Location = Offset - | {bof, Offset} | {cur, Offset} | {eof, Offset} | bof | cur | eof + Location = Offset | {bof, Offset} | {cur, Offset} | {eof, Offset} | bof | cur | eof Offset = integer() Timeout = timeout() NewPosition = integer() @@ -369,119 +342,66 @@ -

    The same as eariler with 0, - that is, . -

    +

    The same as above with 0.

    - - pread(ChannelPid, Handle, Position, Len) -> - pread(ChannelPid, Handle, Position, Len, Timeout) -> {ok, Data} | eof | {error, Error} - Reads from an open file. + read_file_info(ChannelPid, Name) -> + read_file_info(ChannelPid, Name, Timeout) -> {ok, FileInfo} | {error, Reason} + Get information about a file ChannelPid = pid() + Name = string() Handle = term() - Position = integer() - Len = integer() Timeout = timeout() - Data = string() | binary() + FileInfo = record() Reason = term() -

    The function reads from a specified position, - combining the and functions.

    -

    ssh_sftp:read/4

    +

    Returns a record from the file specified by + or , like .

    - - pwrite(ChannelPid, Handle, Position, Data) -> ok - pwrite(ChannelPid, Handle, Position, Data, Timeout) -> ok | {error, Error} - Writes to an open file. - - ChannelPid = pid() - Handle = term() - Position = integer() - Data = iolist() - Timeout = timeout() - Reason = term() - - -

    The function writes to a specified position, - combining the and functions.

    -

    ssh_sftp:write/3

    -
    -
    - - - - read(ChannelPid, Handle, Len) -> - read(ChannelPid, Handle, Len, Timeout) -> {ok, Data} | eof | {error, Error} - Reads from an open file. + read_link_info(ChannelPid, Name) -> {ok, FileInfo} | {error, Reason} + read_link_info(ChannelPid, Name, Timeout) -> {ok, FileInfo} | {error, Reason} + Get information about a symbolic link ChannelPid = pid() + Name = string() Handle = term() - Position = integer() - Len = integer() Timeout = timeout() - Data = string() | binary() + FileInfo = record() Reason = term() -

    Reads bytes from the file referenced by - . Returns , , or - . If the file is opened with , - is a binary, otherwise it is a string.

    -

    If the file is read past eof, only the remaining bytes - are read and returned. If no bytes are read, - is returned.

    -
    -
    - - - read_file(ChannelPid, File) -> - read_file(ChannelPid, File, Timeout) -> {ok, Data} | {error, Reason} - Reads a file. - - ChannelPid = pid() - File = string() - Data = binary() - Timeout = timeout() - Reason = term() - - -

    Reads a file from the server, and returns the data in a binary, - like - file:read_file/1

    +

    Returns a record from the symbolic + link specified by or , like + .

    - - - read_file_info(ChannelPid, Name) -> - read_file_info(ChannelPid, Name, Timeout) -> {ok, FileInfo} | {error, Reason} - Gets information about a file. + + write_file_info(ChannelPid, Name, Info) -> + write_file_info(ChannelPid, Name, Info, Timeout) -> ok | {error, Reason} + Write information for a file ChannelPid = pid() Name = string() - Handle = term() + Info = record() Timeout = timeout() - FileInfo = record() Reason = term() -

    Returns a record from the file specified by - or , - like file:read_file_info/2

    +

    Writes file information from a record to the + file specified by , like .

    - - - read_link(ChannelPid, Name) -> + + read_link(ChannelPid, Name) -> read_link(ChannelPid, Name, Timeout) -> {ok, Target} | {error, Reason} - Reads symbolic link. + Read symbolic link ChannelPid = pid() Name = string() @@ -490,34 +410,28 @@

    Reads the link target from the symbolic link specified - by , like - file:read_link/1

    + by , like .

    - - - read_link_info(ChannelPid, Name) -> {ok, FileInfo} | {error, Reason} - read_link_info(ChannelPid, Name, Timeout) -> {ok, FileInfo} | {error, Reason} - Gets information about a symbolic link. + + make_symlink(ChannelPid, Name, Target) -> + make_symlink(ChannelPid, Name, Target, Timeout) -> ok | {error, Reason} + Create symbolic link ChannelPid = pid() Name = string() - Handle = term() - Timeout = timeout() - FileInfo = record() + Target = string() Reason = term() -

    Returns a record from the symbolic - link specified by or , like - file:read_link_info/2

    +

    Creates a symbolic link pointing to with the + name , like .

    - - rename(ChannelPid, OldName, NewName) -> + rename(ChannelPid, OldName, NewName) -> rename(ChannelPid, OldName, NewName, Timeout) -> ok | {error, Reason} - Renames a file. + Rename a file ChannelPid = pid() OldName = string() @@ -526,138 +440,59 @@ Reason = term() -

    Renames a file named and gives it the name - , like - file:rename/2

    -
    -
    - - - start_channel(ConnectionRef) -> - start_channel(ConnectionRef, Options) -> - start_channel(Host, Options) -> - start_channel(Host, Port, Options) -> {ok, Pid} | {ok, Pid, ConnectionRef} | - {error, Reason} - Starts an SFTP client. - - Host = string() - ConnectionRef = ssh_connection_ref() - Port = integer() - Options = [{Option, Value}] - Reason = term() - - -

    If no connection reference is provided, a connection is set - up, and the new connection is returned. An SSH channel process - is started to handle the communication with the SFTP server. - The returned pid for this process is to be used as input to - all other API functions in this module.

    - -

    Options:

    - - - -

    The time-out is passed to the ssh_channel start function, - and defaults to infinity.

    -
    - - - - -

    - Desired SFTP protocol version. - The actual version is the minimum of - the desired version and the maximum supported - versions by the SFTP server. -

    -
    -
    -

    All other options are directly passed to - ssh:connect/3 or ignored if a - connection is already provided.

    -
    -
    - - - stop_channel(ChannelPid) -> ok - Stops the SFTP client channel. - - ChannelPid = pid() - - -

    Stops an SFTP channel. Does not close the SSH connection. - Use ssh:close/1 to close it.

    +

    Renames a file named , and gives it the name + , like

    - - write(ChannelPid, Handle, Data) -> - write(ChannelPid, Handle, Data, Timeout) -> ok | {error, Error} - Writes to an open file. + delete(ChannelPid, Name) -> + delete(ChannelPid, Name, Timeout) -> ok | {error, Reason} + Delete a file ChannelPid = pid() - Handle = term() - Position = integer() - Data = iolist() + Name = string() Timeout = timeout() Reason = term() -

    Writes to the file referenced by . - The file is to be opened with or - flag. Returns if successful or - otherwise.

    -

    Typical error reasons:

    - - - -

    File is not opened for writing.

    -
    - - -

    No space is left on the device.

    -
    -
    +

    Deletes the file specified by , like +

    - - write_file(ChannelPid, File, Iolist) -> - write_file(ChannelPid, File, Iolist, Timeout) -> ok | {error, Reason} - Writes a file. + make_dir(ChannelPid, Name) -> + make_dir(ChannelPid, Name, Timeout) -> ok | {error, Reason} + Create a directory ChannelPid = pid() - File = string() - Iolist = iolist() + Name = string() Timeout = timeout() Reason = term() -

    Writes a file to the server, like file:write_file/2 The - file is created if it does not exist. The file is overwritten - if it exists.

    +

    Creates a directory specified by . should + be a full path to a new directory. The directory can only be + created in an existing directory.

    - - write_file_info(ChannelPid, Name, Info) -> - write_file_info(ChannelPid, Name, Info, Timeout) -> ok | {error, Reason} - Writes information for a file. + del_dir(ChannelPid, Name) -> + del_dir(ChannelPid, Name, Timeout) -> ok | {error, Reason} + Delete an empty directory ChannelPid = pid() Name = string() - Info = record() Timeout = timeout() Reason = term() -

    Writes file information from a record to the - file specified by , like - file:write_file_info/[2,3]

    +

    Deletes a directory specified by . + Note that the directory must be empty before it can be successfully deleted +

    -
    +
    + diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/ssh.xml erlang-17.3-dfsg/lib/ssh/doc/src/ssh.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/ssh.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/ssh.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,118 +4,72 @@
    - 20042015 + 20042014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. ssh - - 2007-10-06 -
    ssh - Main API of the ssh application + Main API of the SSH application -

    Interface module for the ssh application.

    -

    See ssh(6) for details of supported version, - algorithms and unicode support.

    +

    Interface module for the SSH application.

    -
    - OPTIONS -

    The exact behaviour of some functions can be adjusted with the use of options which are documented together - with the functions. Generally could each option be used at most one time in each function call. If given two or more - times, the effect is not predictable unless explicitly documented.

    -

    The options are of different kinds:

    - - Limits -

    which alters limits in the system, for example number of simultaneous login attempts.

    - - Timeouts -

    which give some defined behaviour if too long time elapses before a given event or action, - for example time to wait for an answer.

    - - Callbacks -

    which gives the caller of the function the possibility to execute own code on some events, - for example calling an own logging function or to perform an own login function

    - - Behaviour -

    which changes the systems behaviour.

    -
    -
    +
    + SSH + + SSH requires the crypto and public_key applications. + Supported SSH version is 2.0 + Supported MAC algorithms: hmac-sha2-256 and hmac-sha1 + Supported encryption algorithms: aes128-ctr, aes128-cb and 3des-cbc + Supports unicode filenames if the emulator and the underlaying OS supports it. See the DESCRIPTION section in file for information about this subject + Supports unicode in shell and cli + + +
    +
    - DATA TYPES + DATA TYPES

    Type definitions that are used more than once in - this module, or abstractions to indicate the intended use of the data - type, or both:

    - - boolean() = -

    true | false

    - string() = -

    [byte()]

    - ssh_daemon_ref() = -

    opaque() - - as returned by ssh:daemon/[1,2,3]

    - ssh_connection_ref() = -

    opaque() - as returned by ssh:connect/3

    - ip_address() = -

    inet::ip_address

    - subsystem_spec() = -

    {subsystem_name(), - {channel_callback(), channel_init_args()}}

    - subsystem_name() = -

    string()

    - channel_callback() = -

    atom() - Name of the Erlang module - implementing the subsystem using the ssh_channel behavior, see - ssh_channel(3)

    - key_cb() = - -

    atom() | {atom(), list()}

    -

    atom() - Name of the erlang module implementing the behaviours - ssh_client_key_api or - ssh_client_key_api as the - case maybe.

    -

    list() - List of options that can be passed to the callback module.

    -
    - channel_init_args() = -

    list()

    - - algs_list() = -

    list( alg_entry() )

    - - alg_entry() = -

    {kex, simple_algs()} | {public_key, simple_algs()} | {cipher, double_algs()} | {mac, double_algs()} | {compression, double_algs()}

    - - simple_algs() = -

    list( atom() )

    - - double_algs() = -

    [{client2serverlist,simple_algs()},{server2client,simple_algs()}] | simple_algs()

    -
    -
    + this module and/or abstractions to indicate the intended use of the data + type:

    +

    boolean() = true | false

    +

    string() = [byte()]

    +

    ssh_daemon_ref() - opaque to the user + returned by ssh:daemon/[1,2,3]

    +

    ssh_connection_ref() - opaque to the user + returned by ssh:connect/3

    +

    ip_address() - inet::ip_address()

    +

    subsystem_spec() = {subsystem_name(), + {channel_callback(), channel_init_args()}}

    +

    subsystem_name() = string()

    +

    channel_callback() = atom() - Name of the erlang module + implementing the subsystem using the ssh_channel behavior see + ssh_channel(3)

    +

    channel_init_args() = list()

    +
    close(ConnectionRef) -> ok - Closes an SSH connection. + Closes an SSH connection ConnectionRef = ssh_connection_ref() @@ -127,219 +81,135 @@ connect(Host, Port, Options) -> connect(Host, Port, Options, Timeout) -> {ok, ssh_connection_ref()} | {error, Reason} - Connects to an SSH server. + Connect to an ssh server. Host = string() Port = integer() - is default, the assigned well-known port + The default is , the assigned well known port number for SSH. Options = [{Option, Value}] - Timeout = infinity | integer() - Negotiation time-out in milli-seconds. The default value is infinity. - For connection time-out, use option {connect_timeout, timeout()}. + Timeout = infinity | integer(milliseconds) + Negotiation timeout, for connection timeout use the option {connect_timeout, timeout()}.

    Connects to an SSH server. No channel is started. This is done by calling - - ssh_connection:session_channel/[2, 4].

    -

    Options:

    + ssh_connection:session_channel/[2, 4].

    +

    Options are:

    - -

    IP version to use.

    -
    + IP version to use. -

    Sets the user directory, that is, the directory containing - ssh configuration files for the user, such as +

    Sets the user directory i.e. the directory containing + ssh configuration files for the user such as , , and + id_dsa]]> and . Defaults to the directory normally referred to as - .

    +

    -

    If the user DSA key is protected by a passphrase, it can be +

    If the user dsa key is protected by a passphrase it can be supplied with this option.

    -

    If the user RSA key is protected by a passphrase, it can be +

    If the user rsa key is protected by a passphrase it can be supplied with this option.

    -

    When true, hosts are added to the +

    When true hosts are added to the file without asking the user. - Defaults to false. + Defaults to false.

    -

    If false, disables the client to connect to the server - if any user interaction is needed, such as accepting - the server to be added to the known_hosts file, or - supplying a password. Defaults to true. +

    If false disables the client to connect to the server + if any user interaction is needed such as accepting that + the server will be added to the known_hosts file or + supplying a password. Defaults to true. Even if user interaction is allowed it can be - suppressed by other options, such as silently_accept_hosts - and password. However, those optins are not always desirable - to use from a security point of view.

    + suppressed by other options such as silently_accept_hosts and + password. Do note that it may not always be desirable to use + those options from a security point of view.

    - - _}]]> - -

    Provides a fun to implement your own logging when a server disconnects the client.

    -
    - - report | skip }]]> - -

    Provides a fun to implement your own logging or other action when an unexpected message arrives. - If the fun returns report the usual info report is issued but if skip is returned no - report is generated.

    -

    Peer is in the format of {Host,Port}.

    -
    - - -

    This option will be removed in OTP 20, but is kept for compatibility. It is ignored if - the preferred pref_public_key_algs option is used.

    -

    Sets the preferred public key algorithm to use for user - authentication. If the preferred algorithm fails, - the other algorithm is tried. If {public_key_alg, 'ssh-rsa'} is set, it is translated - to {pref_public_key_algs, ['ssh-rsa','ssh-dss']}. If it is - {public_key_alg, 'ssh-dss'}, it is translated - to {pref_public_key_algs, ['ssh-dss','ssh-rsa']}. -

    + authentication. If the the preferred algorithm fails for + some reason, the other algorithm is tried. The default is + to try first.

    - -

    List of user (client) public key algorithms to try to use.

    -

    The default value is - -

    -

    If there is no public key of a specified type available, the corresponding entry is ignored.

    -
    - - - -

    List of algorithms to use in the algorithm negotiation. The default algs_list() can - be obtained from default_algorithms/0. -

    -

    If an alg_entry() is missing in the algs_list(), the default value is used for that entry.

    -

    Here is an example of this option:

    - -{preferred_algorithms, - [{public_key,['ssh-rsa','ssh-dss']}, - {cipher,[{client2server,['aes128-ctr']}, - {server2client,['aes128-cbc','3des-cbc']}]}, - {mac,['hmac-sha2-256','hmac-sha1']}, - {compression,[none,zlib]} -} - -

    The example specifies different algorithms in the two directions (client2server and server2client), - for cipher but specifies the same algorithms for mac and compression in both directions. - The kex (key exchange) is implicit but public_key is set explicitly.

    - - -

    Changing the values can make a connection less secure. Do not change unless you - know exactly what you are doing. If you do not understand the values then you - are not supposed to change them.

    -
    -
    - - - -

    Sets the three diffie-hellman-group-exchange parameters that guides the connected server in choosing a group. - See RFC 4419 for the function of thoose. The default value is {1024, 6144, 8192}. -

    +

    List of public key algorithms to try to use, 'ssh-rsa' and 'ssh-dss' available. + Will override

    - -

    Sets a time-out on the transport layer - connection. For gen_tcp the time is in milli-seconds and the default value is - infinity.

    +

    Sets a timeout on the transport layer + connection. Defaults to infinity.

    -

    Provides a username. If this option is not given, ssh +

    Provides a user name. If this option is not given, ssh reads from the environment ( or - on UNIX, + on unix, on Windows).

    -

    Provides a password for password authentication. - If this option is not given, the user is asked for a - password, if the password authentication method is +

    Provide a password for password authentication. If + this option is not given, the user will be asked for a + password if the password authentication method is attempted.

    - + -

    Module implementing the behaviour ssh_client_key_api. Can be used to - customize the handling of public keys. If callback options are provided - along with the module name, they are made available to the callback - module via the options passed to it under the key 'key_cb_private'. +

    Module implementing the behaviour ssh_client_key_api. + Can be used to customize the handling of public keys.

    -

    If true, the client does not print anything on authorization.

    -
    - - - -

    The string that the client presents to a connected server initially. The default value is "Erlang/VSN" where VSN is the ssh application version number. -

    -

    The value random will cause a random string to be created at each connection attempt. This is to make it a bit more difficult for a malicious peer to find the ssh software brand and version. -

    +

    If true, the client will not print out anything on authorization.

    - -

    Allows an existing file descriptor to be used - (by passing it on to the transport protocol).

    +

    Allow an existing file descriptor to be used + (simply passed on to the transport protocol).

    -

    Provides, in bytes, when rekeying is to be initiated. - Defaults to once per each GB and once per hour.

    +

    Provide, in bytes, when rekeying should be initiated, + defaults to one time each GB and one time per hour.

    -

    Sets a time-out on a connection when no channels are active. - Defaults to infinity.

    - _}]]> - -

    Provide a fun to implement your own logging of the SSH message SSH_MSG_DEBUG. The last three parameters are from the message, see RFC4253, section 11.3. The ConnectionRef is the reference to the connection on which the message arrived. The return value from the fun is not checked.

    -

    The default behaviour is ignore the message. - To get a printout for each message with AlwaysDisplay = true, use for example {ssh_msg_debug_fun, fun(_,true,M,_)-> io:format("DEBUG: ~p~n", [M]) end}

    -
    - +

    Sets a timeout on connection when no channels are active, default is infinity

    connection_info(ConnectionRef, [Option]) ->[{Option, - Value}] - Retrieves information about a connection. + Value}] + Retrieves information about a connection. Option = client_version | server_version | user | peer | sockname Value = [option_value()] - option_value() = {{Major::integer(), Minor::integer()}, VersionString::string()} | - User::string() | Peer::{inet:hostname(), {inet::ip_adress(), inet::port_number()}} | - Sockname::{inet::ip_adress(), inet::port_number()} + option_value() = {{Major::integer(), Minor::integer()}, VersionString::string()} | User::string() | + Peer::{inet:hostname(), {inet::ip_adress(), inet::port_number()}} | + Sockname::{inet::ip_adress(), inet::port_number()} () -

    Retrieves information about a connection.

    +

    Retrieves information about a connection. +

    @@ -360,360 +230,155 @@

    Starts a server listening for SSH connections on the given port.

    -

    Options:

    +

    Options are:

    -

    IP version to use when the host address is specified as any.

    - + IP version to use when the host address is specified as any. + -

    Provides specifications for handling of subsystems. The - "sftp" subsystem specification is retrieved by calling - ssh_sftpd:subsystem_spec/1. If the subsystems option is - not present, the value of - [ssh_sftpd:subsystem_spec([])] is used. - The option can be set to the empty list if - you do not want the daemon to run any subsystems.

    + Provides specifications for handling of subsystems. The + "sftp" subsystem spec can be retrieved by calling + ssh_sftpd:subsystem_spec/1. If the subsystems option in + not present the value of + [ssh_sftpd:subsystem_spec([])] will be used. It is + of course possible to set the option to the empty list if + you do not want the daemon to run any subsystems at all.
    pid() | fun(string() = User, ip_address() = PeerAddr) -> pid()}]]> -

    Defines the read-eval-print loop used when a shell is - requested by the client. The default is to use the Erlang shell: -

    + Defines the read-eval-print loop used when a shell is + requested by the client. Default is to use the erlang shell: +
    -

    Provides your own CLI implementation, that is, a channel callback - module that implements a shell and command execution. The shell - read-eval-print loop can be customized, using the - option shell. This means less work than implementing - an own CLI channel. If set to no_cli, the CLI channels - are disabled and only subsystem channels are allowed.

    + Provides your own CLI implementation, i.e. a channel callback + module that implements a shell and command execution. Note + that you may customize the shell read-eval-print loop using the + option shell which is much less work than implementing + your own CLI channel. If set to no_cli you will disable + CLI channels and only subsystem channels will be allowed.
    - + -

    Sets the user directory. That is, the directory containing - ssh configuration files for the user, such as +

    Sets the user directory i.e. the directory containing + ssh configuration files for the user such as , , and + id_dsa]]> and . Defaults to the directory normally referred to as - .

    +

    Sets the system directory, containing the host key files - that identify the host keys for ssh. Defaults to - . For security reasons, - this directory is normally accessible only to the root user.

    + that identifies the host keys for ssh. The default is + , note that for security reasons + this directory is normally only accessible by the root user.

    - -

    Comma-separated string that determines which - authentication methods that the server is to support and - in what order they are tried. Defaults to +

    Comma separated string that determines which + authentication methodes that the server should support and + in what order they will be tried. Defaults to

    - - -
    where: -
    PromptTexts = kb_int_tuple() | fun(Peer::{IP::tuple(),Port::integer()}, User::string(), Service::string()) -> kb_int_tuple() -
    kb_int_tuple() = {Name::string(), Instruction::string(), Prompt::string(), Echo::boolean()} -
    - -

    Sets the text strings that the daemon sends to the client for presentation to the user when using keyboar-interactive authentication. If the fun/3 is used, it is called when the actual authentication occurs and may therefore return dynamic data like time, remote ip etc.

    -

    The parameter Echo guides the client about need to hide the password.

    -

    The default value is: - {auth_method_kb_interactive_data, {"SSH server", "Enter password for \""++User++"\"", "password: ", false}>

    -
    - -

    Provides passwords for password authentication. The passwords - are used when someone tries to connect to the server and - public key user-authentication fails. The option provides - a list of valid usernames and the corresponding passwords. +

    Provide passwords for password authentication.They will + be used when someone tries to connect to the server and + public key user authentication fails. The option provides + a list of valid user names and the corresponding password.

    -

    Provides a global password that authenticates any +

    Provide a global password that will authenticate any user. From a security perspective this option makes the server very vulnerable.

    - - + boolean()}]]> -

    List of algorithms to use in the algorithm negotiation. The default algs_list() can - be obtained from default_algorithms/0. -

    -

    If an alg_entry() is missing in the algs_list(), the default value is used for that entry.

    -

    Here is an example of this option:

    - -{preferred_algorithms, - [{public_key,['ssh-rsa','ssh-dss']}, - {cipher,[{client2server,['aes128-ctr']}, - {server2client,['aes128-cbc','3des-cbc']}]}, - {mac,['hmac-sha2-256','hmac-sha1']}, - {compression,[none,zlib]} -} - -

    The example specifies different algorithms in the two directions (client2server and server2client), - for cipher but specifies the same algorithms for mac and compression in both directions. - The kex (key exchange) is implicit but public_key is set explicitly.

    - - -

    Changing the values can make a connection less secure. Do not change unless you - know exactly what you are doing. If you do not understand the values then you - are not supposed to change them.

    -
    -
    - - - -

    Defines the groups the server may choose among when diffie-hellman-group-exchange is negotiated. - See RFC 4419 for details. The three variants of this option are: -

    - - {Size=integer(),G=integer(),P=integer()} - The groups are given explicitly in this list. There may be several elements with the same Size. - In such a case, the server will choose one randomly in the negotiated Size. - - {file,filename()} - The file must have one or more three-tuples {Size=integer(),G=integer(),P=integer()} - terminated by a dot. The file is read when the daemon starts. - - {ssh_moduli_file,filename()} - The file must be in - ssh-keygen moduli file format. - The file is read when the daemon starts. - - -

    The default list is fetched from the - public_key application. -

    -
    - - - -

    Limits what a client can ask for in diffie-hellman-group-exchange. - The limits will be - {MaxUsed = min(MaxClient,Max), MinUsed = max(MinClient,Min)} where MaxClient and - MinClient are the values proposed by a connecting client. -

    -

    The default value is {0,infinity}. -

    -

    If MaxUsed < MinUsed in a key exchange, it will fail with a disconnect. -

    -

    See RFC 4419 for the function of the Max and Min values.

    -
    - - boolean() | disconnect | {boolean(),any()} }]]> - -

    Provides a function for password validation. This could used for calling an external system or if - passwords should be stored as a hash. The fun returns: -

    - - true if the user and password is valid and - false otherwise. - -

    This fun can also be used to make delays in authentication tries for example by calling - timer:sleep/1. To facilitate counting of failed tries - the State variable could be used. This state is per connection only. The first time the pwdfun - is called for a connection, the State variable has the value undefined. - The pwdfun can return - in addition to the values above - a new state - as: -

    - - {true, NewState:any()} if the user and password is valid or - {false, NewState:any()} if the user or password is invalid - -

    A third usage is to block login attempts from a missbehaving peer. The State described above - can be used for this. In addition to the responses above, the following return value is introduced: -

    - - disconnect if the connection should be closed immediately after sending a SSH_MSG_DISCONNECT - message. - -
    - - boolean()}]]> - -

    Provides a function for password validation. This function is called - with user and password as strings, and returns +

    Provide a function for password validation. This is called + with user and password as strings, and should return if the password is valid and otherwise.

    -

    This option ({pwdfun,fun/2}) is the same as a subset of the previous - ({pwdfun,fun/4}). It is kept for compatibility.

    -

    Maximum time in milliseconds for the authentication negotiation. - Defaults to 120000 (2 minutes). If the client fails to log in within this time, - the connection is closed. +

    Max time in milliseconds for the authentication negotiation. The default value is 2 minutes. If the client fails to login within this time, the connection is closed.

    -

    The maximum number of simultaneous sessions that are accepted at any time - for this daemon. This includes sessions that are being authorized. - Thus, if set to N, and N clients have connected but not started - the login process, connection attempt N+1 is aborted. - If N connections are authenticated and still logged in, no more logins - are accepted until one of the existing ones log out. +

    The maximum number of simultaneous sessions that are accepted at any time for this daemon. This includes sessions that are being authorized. So if set to N, and N clients have connected but not started the login process, the N+1 connection attempt will be aborted. If N connections are authenticated and still logged in, no more loggins will be accepted until one of the existing ones log out.

    -

    The counter is per listening port. Thus, if two daemons are started, one with - {max_sessions,N} and the other with {max_sessions,M}, in total - N+M connections are accepted for the whole ssh application. +

    The counter is per listening port, so if two daemons are started, one with {max_sessions,N} and the other with {max_sessions,M} there will be in total N+M connections accepted for the whole ssh application.

    -

    Notice that if parallel_login is false, only one client - at a time can be in the authentication phase. +

    Note that if parallel_login is false, only one client at a time may be in the authentication phase.

    -

    By default, this option is not set. This means that the number is not limited. -

    -
    - - - -

    The maximum number of channels with active remote subsystem that are accepted for - each connection to this daemon

    -

    By default, this option is not set. This means that the number is not limited. +

    As default, the option is not set. This means that the number is not limited.

    - -

    If set to false (the default value), only one login is handled at a time. - If set to true, an unlimited number of login attempts are allowed simultaneously. +

    If set to false (the default value), only one login is handled a time. If set to true, an unlimited number of login attempts will be allowed simultanously.

    -

    If the max_sessions option is set to N and parallel_login - is set to true, the maximum number of simultaneous login attempts at any time is - limited to N-K, where K is the number of authenticated connections present - at this daemon. +

    If the max_sessions option is set to N and parallel_login is set to true, the max number of simultaneous login attempts at any time is limited to N-K where K is the number of authenticated connections present at this daemon.

    -

    Do not enable parallel_logins without protecting the server by other means, - for example, by the max_sessions option or a firewall configuration. If set to - true, there is no protection against DOS attacks.

    +

    Do not enable parallel_logins without protecting the server by other means, for example the max_sessions option or a firewall configuration. If set to true, there is no protection against DOS attacks.

    - + -

    The least maximum packet size that the daemon will accept in channel open requests from the client. The default value is 0. +

    Module implementing the behaviour ssh_server_key_api. + Can be used to customize the handling of public keys.

    - - - -

    The string the daemon will present to a connecting peer initially. The default value is "Erlang/VSN" where VSN is the ssh application version number. -

    -

    The value random will cause a random string to be created at each connection attempt. This is to make it a bit more difficult for a malicious peer to find the ssh software brand and version. -

    -
    - - - -

    Module implementing the behaviour ssh_server_key_api. Can be used to - customize the handling of public keys. If callback options are provided - along with the module name, they are made available to the callback - module via the options passed to it under the key 'key_cb_private'. -

    -
    - - {profile, atom()} - -

    Used together with ip-address and port to - uniquely identify a ssh daemon. This can be useful in a - virtualized environment, where there can be more that one - server that has the same ip-address and - port. If this property is not explicitly set, it is - assumed that the the ip-address and port - uniquely identifies the SSH daemon. -

    -
    - -

    Allows an existing file-descriptor to be used - (passed on to the transport protocol).

    - _}]]> +

    Allow an existing file-descriptor to be used + (simply passed on to the transport protocol).

    + _}]]> -

    Provides a fun to implement your own logging when a user fails to authenticate.

    +

    Provide a fun to implement your own logging when a user fails to authenticate.

    - _}]]> + _}]]> -

    Provides a fun to implement your own logging when a user authenticates to the server.

    +

    Provide a fun to implement your own logging when a user authenticates to the server.

    _}]]> -

    Provides a fun to implement your own logging when a user disconnects from the server.

    +

    Provide a fun to implement your own logging when a user disconnects from the server.

    - - report | skip }]]> - -

    Provides a fun to implement your own logging or other action when an unexpected message arrives. - If the fun returns report the usual info report is issued but if skip is returned no - report is generated.

    -

    Peer is in the format of {Host,Port}.

    -
    - - _}]]> - -

    Provide a fun to implement your own logging of the SSH message SSH_MSG_DEBUG. The last three parameters are from the message, see RFC4253, section 11.3. The ConnectionRef is the reference to the connection on which the message arrived. The return value from the fun is not checked.

    -

    The default behaviour is ignore the message. - To get a printout for each message with AlwaysDisplay = true, use for example {ssh_msg_debug_fun, fun(_,true,M,_)-> io:format("DEBUG: ~p~n", [M]) end}

    -
    - -
    -
    -
    - - - default_algorithms() -> algs_list() - Get a list declaring the supported algorithms - -

    Returns a key-value list, where the keys are the different types of algorithms and the values are the - algorithms themselves. An example:

    - -20> ssh:default_algorithms(). -[{kex,['diffie-hellman-group1-sha1']}, - {public_key,['ssh-rsa','ssh-dss']}, - {cipher,[{client2server,['aes128-ctr','aes128-cbc','3des-cbc']}, - {server2client,['aes128-ctr','aes128-cbc','3des-cbc']}]}, - {mac,[{client2server,['hmac-sha2-256','hmac-sha1']}, - {server2client,['hmac-sha2-256','hmac-sha1']}]}, - {compression,[{client2server,[none,zlib]}, - {server2client,[none,zlib]}]}] -21> - +
    + shell(Host) -> shell(Host, Option) -> shell(Host, Port, Option) -> _ - Starts an interactive shell over an SSH server. + - Host = string() - Port = integer() - Options - see ssh:connect/3 + Host = string() + Port = integer() + Options - see ssh:connect/3 -

    Starts an interactive shell over an SSH server on the +

    Starts an interactive shell via an SSH server on the given Host. The function waits for user input, - and does not return until the remote shell is ended (that is, + and will not return until the remote shell is ended (i.e. exit from the shell).

    @@ -722,29 +387,28 @@ start() -> start(Type) -> ok | {error, Reason} - Starts the SSH application. + Starts the SSH application. Type = permanent | transient | temporary Reason = term() -

    Utility function that starts the applications crypto, public_key, - and ssh. Default type is temporary. - For more information, see the application(3) - manual page in kernel.

    +

    Utility function that starts crypto, public_key and the SSH + application. Defult type is temporary. + See also application(3) +

    stop() -> ok | {error, Reason} - Stops the ssh application. + Stops the SSH application. Reason = term() -

    Stops the ssh application. - For more information, see the application(3) - manual page in kernel.

    +

    Stops the SSH application. See also + application(3)

    @@ -768,7 +432,7 @@ stop_listener(DaemonRef) -> stop_listener(Address, Port) -> ok Stops the listener, but leaves existing connections started - by the listener operational. + by the listener up and running. DaemonRef = ssh_daemon_ref() Address = ip_address() @@ -776,7 +440,7 @@

    Stops the listener, but leaves existing connections started - by the listener operational.

    + by the listener up and running.

    diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/usersguide.xml erlang-17.3-dfsg/lib/ssh/doc/src/usersguide.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/usersguide.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/usersguide.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,32 +8,30 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. SSH User's Guide OTP Team - 2012-10-11 - usersguide.xml -

    The Erlang Secure Shell (SSH) application, ssh, implements the SSH Transport Layer Protocol and - provides SSH File Transfer Protocol (SFTP) clients and servers. +

    The SSH application implements the SSH (Secure Shell) protocol and + provides an SFTP (Secret File Transfer Protocol) client and server.

    + diff -Nru erlang-18.2-dfsg/lib/ssh/doc/src/using_ssh.xml erlang-17.3-dfsg/lib/ssh/doc/src/using_ssh.xml --- erlang-18.2-dfsg/lib/ssh/doc/src/using_ssh.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/doc/src/using_ssh.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,84 +9,77 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. - Getting Started - - - - - + Getting started using_ssh.xml
    - General Information -

    The following examples use the utility function - ssh:start/0 to start - all needed applications (crypto, public_key, and ssh). - All examples are run in an Erlang shell, or in a bash shell, using openssh - to illustrate how the ssh application can be used. The - examples are run as the user otptest on a local network where the - user is authorized to log in over ssh to the host tarlop. -

    -

    If nothing else is stated, it is presumed that the otptest user - has an entry in the authorized_keys file of tarlop - (allowed to log in over ssh without entering a password). - Also, tarlop is a known host in the known_hosts - file of the user otptest. This means that host-verification - can be done without user-interaction. + General information +

    The examples in the following sections use the utility function + ssh:start/0 that starts + all needed applications (crypto, public_key and ssh). All examples + are run in an Erlang shell, or in a bash shell using openssh to + illustrate how the erlang ssh application can be used. The + examples are run as the user otptest on a local network where the + user is authorized to login in over ssh to the host "tarlop". If + nothing else is stated it is persumed that the otptest user has an + entry in tarlop's authorized_keys file (may log in via ssh without + entering a password). Also tarlop is a known host in the user + otptest's known_hosts file so that host verification can be done + without user interaction.

    - Using the Erlang ssh Terminal Client + Using the Erlang SSH Terminal Client -

    The user otptest, which has bash as default shell, uses the - ssh:shell/1 client to connect to the openssh daemon running on a - host called tarlop:

    +

    The user otptest, that has bash as default shell, uses the + ssh:shell/1 client to connect to the openssh daemon running on a + host called tarlop. Note that currently this client is very simple + and you should not be expected to be as fancy as the openssh + client.

    1> ssh:start(). ok 2> {ok, S} = ssh:shell("tarlop"). - otptest@tarlop:> pwd + >pwd /home/otptest - otptest@tarlop:> exit + >exit logout 3>
    - - Running an Erlang ssh Daemon + Running an Erlang SSH Daemon -

    The system_dir option must be a directory containing a host - key file and it defaults to /etc/ssh. For details, see Section +

    The option system_dir must be a directory containing a host + key file and it defaults to /etc/ssh. For details see section Configuration Files in ssh(6).

    -

    Normally, the /etc/ssh directory is only readable by root.

    +

    Normally the /etc/ssh directory is only readable by root.

    -

    The option user_dir defaults to directory users ~/.ssh.

    +

    The option user_dir defaults to the users ~/.ssh directory

    -

    Step 1. To run the example without root privileges, - generate new keys and host keys:

    +

    In the following example we generate new keys and host keys as + to be able to run the example without having root privilages

    $bash> ssh-keygen -t rsa -f /tmp/ssh_daemon/ssh_host_rsa_key @@ -95,22 +88,19 @@ [...] -

    Step 2. Create the file /tmp/otptest_user/.ssh/authorized_keys - and add the content of /tmp/otptest_user/.ssh/id_rsa.pub.

    - -

    Step 3. Start the Erlang ssh daemon:

    +

    Create the file /tmp/otptest_user/.ssh/authorized_keys and add the content + of /tmp/otptest_user/.ssh/id_rsa.pub Now we can do

    1> ssh:start(). ok - 2> {ok, Sshd} = ssh:daemon(8989, [{system_dir, "/tmp/ssh_daemon"}, - {user_dir, "/tmp/otptest_user/.ssh"}]). + 2> {ok, Sshd} = ssh:daemon(8989, [{system_dir, "/tmp/ssh_daemon"}, + {user_dir, "/tmp/otptest_user/.ssh"}]). {ok,<0.54.0>} 3> -

    Step 4. Use the openssh client from a shell to connect - to the Erlang ssh daemon:

    +

    Use the openssh client from a shell to connect to the Erlang ssh daemon.

    $bash> ssh tarlop -p 8989 -i /tmp/otptest_user/.ssh/id_rsa\ @@ -123,12 +113,9 @@ 1> -

    There are two ways of shutting down an ssh daemon, - see Step 5a and Step 5b.

    +

    There are two ways of shutting down an SSH daemon

    -

    Step 5a. Shut down the Erlang ssh daemon so that it - stops the listener but leaves existing connections, started by the listener, - operational:

    +

    1: Stops the listener, but leaves existing connections started by the listener up and running.

    3> ssh:stop_listener(Sshd). @@ -136,8 +123,7 @@ 4> -

    Step 5b. Shut down the Erlang ssh daemon so that it - stops the listener and all connections started by the listener:

    +

    2: Stops the listener and all connections started by the listener.

    3> ssh:stop_daemon(Sshd) @@ -148,18 +134,17 @@
    - One-Time Execution + One Time Execution -

    In the following example, the Erlang shell is the client process - that receives the channel replies.

    +

    In the following example the Erlang shell is the client process + that receives the channel replies.

    -

    The number of received messages in this example depends on which OS - and which shell that is used on the machine running the ssh daemon. - See also ssh_connection:exec/4. +

    If you run this example + in your environment you may get fewer or more messages back as + this depends on the OS and shell on the machine running the ssh + daemon. See also ssh_connection:exec/4

    -

    Do a one-time execution of a remote command over ssh:

    - 1> ssh:start(). ok @@ -177,8 +162,7 @@ 6> -

    Notice that only the channel is closed. The connection is still up and can - handle other channels:

    +

    Note only the channel is closed the connection is still up and can handle other channels

    6> {ok, NewChannelId} = ssh_connection:session_channel(ConnectionRef, infinity). @@ -188,22 +172,19 @@
    - SFTP Server - -

    Start the Erlang ssh daemon with the SFTP subsystem:

    + SFTP (SSH File Transport Protocol) server 1> ssh:start(). ok - 2> ssh:daemon(8989, [{system_dir, "/tmp/ssh_daemon"}, - {user_dir, "/tmp/otptest_user/.ssh"}, - {subsystems, [ssh_sftpd:subsystem_spec([{cwd, "/tmp/sftp/example"}]) - ]}]). + 2> ssh:daemon(8989, [{system_dir, "/tmp/ssh_daemon"}, + {user_dir, "/tmp/otptest_user/.ssh"}, + {subsystems, [ssh_sftpd:subsystem_spec([{cwd, "/tmp/sftp/example"}])]}]). {ok,<0.54.0>} 3> -

    Run the OpenSSH SFTP client:

    +

    Run the openssh sftp client

    $bash> sftp -oPort=8989 -o IdentityFile=/tmp/otptest_user/.ssh/id_rsa\ @@ -216,9 +197,7 @@
    - SFTP Client - -

    Fetch a file with the Erlang SFTP client:

    + SFTP (SSH File Transport Protocol) client 1> ssh:start(). @@ -231,77 +210,10 @@
    - SFTP Client with TAR Compression and Encryption - -

    Example of writing and then reading a tar file follows:

    - - {ok,HandleWrite} = ssh_sftp:open_tar(ChannelPid, ?tar_file_name, [write]), - ok = erl_tar:add(HandleWrite, .... ), - ok = erl_tar:add(HandleWrite, .... ), - ... - ok = erl_tar:add(HandleWrite, .... ), - ok = erl_tar:close(HandleWrite), - - %% And for reading - {ok,HandleRead} = ssh_sftp:open_tar(ChannelPid, ?tar_file_name, [read]), - {ok,NameValueList} = erl_tar:extract(HandleRead,[memory]), - ok = erl_tar:close(HandleRead), - - -

    The previous write and read example can be extended with encryption and decryption as follows:

    - -%% First three parameters depending on which crypto type we select: -Key = <<"This is a 256 bit key. abcdefghi">>, -Ivec0 = crypto:strong_rand_bytes(16), -DataSize = 1024, % DataSize rem 16 = 0 for aes_cbc - -%% Initialization of the CryptoState, in this case it is the Ivector. -InitFun = fun() -> {ok, Ivec0, DataSize} end, - -%% How to encrypt: -EncryptFun = - fun(PlainBin,Ivec) -> - EncryptedBin = crypto:block_encrypt(aes_cbc256, Key, Ivec, PlainBin), - {ok, EncryptedBin, crypto:next_iv(aes_cbc,EncryptedBin)} - end, - -%% What to do with the very last block: -CloseFun = - fun(PlainBin, Ivec) -> - EncryptedBin = crypto:block_encrypt(aes_cbc256, Key, Ivec, - pad(16,PlainBin) %% Last chunk - ), - {ok, EncryptedBin} - end, - -Cw = {InitFun,EncryptFun,CloseFun}, -{ok,HandleWrite} = ssh_sftp:open_tar(ChannelPid, ?tar_file_name, [write,{crypto,Cw}]), -ok = erl_tar:add(HandleWrite, .... ), -ok = erl_tar:add(HandleWrite, .... ), -... -ok = erl_tar:add(HandleWrite, .... ), -ok = erl_tar:close(HandleWrite), - -%% And for decryption (in this crypto example we could use the same InitFun -%% as for encryption): -DecryptFun = - fun(EncryptedBin,Ivec) -> - PlainBin = crypto:block_decrypt(aes_cbc256, Key, Ivec, EncryptedBin), - {ok, PlainBin, crypto:next_iv(aes_cbc,EncryptedBin)} - end, - -Cr = {InitFun,DecryptFun}, -{ok,HandleRead} = ssh_sftp:open_tar(ChannelPid, ?tar_file_name, [read,{crypto,Cw}]), -{ok,NameValueList} = erl_tar:extract(HandleRead,[memory]), -ok = erl_tar:close(HandleRead), - -
    - -
    - Creating a Subsystem + Creating a subsystem -

    A small ssh subsystem that echoes N bytes can be implemented as shown - in the following example:

    +

    A very small SSH subsystem that echos N bytes could be implemented like this. + See also ssh_channel(3)

    -module(ssh_echo_server). @@ -355,16 +267,14 @@ ok. -

    The subsystem can be run on the host tarlop with the generated keys, - as described in Section - Running an Erlang ssh Daemon:

    +

    And run like this on the host tarlop with the keys generated in section 3.3

    1> ssh:start(). ok - 2> ssh:daemon(8989, [{system_dir, "/tmp/ssh_daemon"}, - {user_dir, "/tmp/otptest_user/.ssh"} - {subsystems, [{"echo_n", {ssh_echo_server, [10]}}]}]). + 2> ssh:daemon(8989, [{system_dir, "/tmp/ssh_daemon"}, + {user_dir, "/tmp/otptest_user/.ssh"} + {subsystems, [{"echo_n", {ssh_echo_server, [10]}}]}]). {ok,<0.54.0>} 3> @@ -383,7 +293,6 @@ {ssh_msg, <0.57.0>, {closed, 0}} 7> {error, closed} = ssh_connection:send(ConnectionRef, ChannelId, "10", infinity).
    -

    See also ssh_channel(3).

    diff -Nru erlang-18.2-dfsg/lib/ssh/examples/Makefile erlang-17.3-dfsg/lib/ssh/examples/Makefile --- erlang-18.2-dfsg/lib/ssh/examples/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/examples/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2005-2015. All Rights Reserved. +# Copyright Ericsson AB 2005-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -39,8 +38,7 @@ MODULES = \ - ssh_sample_cli \ - ssh_device.erl + ssh_sample_cli ERL_FILES= $(MODULES:=.erl) diff -Nru erlang-18.2-dfsg/lib/ssh/examples/ssh_device.erl erlang-17.3-dfsg/lib/ssh/examples/ssh_device.erl --- erlang-18.2-dfsg/lib/ssh/examples/ssh_device.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/examples/ssh_device.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2005-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - --module(ssh_device). - -%% api --export([ssh_device/5]). - -%%% I wrote this because of i think a fully ssh client sample will be easy to start the ssh module better than -%%% go though each function file. -ssh_device(Host, Port, User, Pass, Cmd) -> - ssh:start(), - case ssh:connect(Host, Port, - [{user, User}, {password, Pass}, - {silently_accept_hosts, true}, {quiet_mode, true}]) - of - {ok, Conn} -> - {ok, ChannelId} = ssh_connection:session_channel(Conn, - infinity), - ssh_connection:exec(Conn, ChannelId, Cmd, infinity), - Init_rep = <<>>, - wait_for_response(Conn, Host, Init_rep), - ssh:close(Conn); - {error, nxdomain} -> - {error,nxdomain} - end. - -%%-------------------------------------------------------------------- -%%% Internal application API -%%-------------------------------------------------------------------- -wait_for_response(Conn, Host, Acc) -> - receive - {ssh_cm, Conn, Msg} -> - case Msg of - {closed, _ChannelId} -> - {ok,Acc}; - {data, _, _, A} -> - Acc2 = <>, - wait_for_response(Conn, Host, Acc2); - _ -> - wait_for_response(Conn, Host, Acc) - end - after - 5000 -> - {error,timeout} - end. diff -Nru erlang-18.2-dfsg/lib/ssh/examples/ssh_sample_cli.erl erlang-17.3-dfsg/lib/ssh/examples/ssh_sample_cli.erl --- erlang-18.2-dfsg/lib/ssh/examples/ssh_sample_cli.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/examples/ssh_sample_cli.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/Makefile erlang-17.3-dfsg/lib/ssh/Makefile --- erlang-18.2-dfsg/lib/ssh/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/ssh/src/Makefile erlang-17.3-dfsg/lib/ssh/src/Makefile --- erlang-18.2-dfsg/lib/ssh/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -66,7 +65,7 @@ ssh_cli \ ssh_file \ ssh_io \ - ssh_info \ + ssh_math \ ssh_message \ ssh_no_io \ ssh_sftp \ @@ -75,7 +74,7 @@ ssh_transport \ ssh_xfer -HRL_FILES = +PUBLIC_HRL_FILES= ssh.hrl ssh_userauth.hrl ssh_xfer.hrl ERL_FILES= \ $(MODULES:%=%.erl) \ @@ -95,7 +94,7 @@ APPUP_SRC= $(APPUP_FILE).src APPUP_TARGET= $(EBIN)/$(APPUP_FILE) -INTERNAL_HRL_FILES = ssh_auth.hrl ssh_connect.hrl ssh_transport.hrl ssh.hrl ssh_userauth.hrl ssh_xfer.hrl +INTERNAL_HRL_FILES = ssh_auth.hrl ssh_connect.hrl ssh_transport.hrl # ---------------------------------------------------- # FLAGS @@ -116,7 +115,7 @@ debug opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) clean: - rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(BEHAVIOUR_TARGET_FILES) + rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk @@ -140,82 +139,7 @@ $(INSTALL_DATA) $(BEHAVIOUR_TARGET_FILES) $(TARGET_FILES) $(APP_TARGET) \ $(APPUP_TARGET) "$(RELSYSDIR)/ebin" $(INSTALL_DIR) "$(RELSYSDIR)/include" - + $(INSTALL_DATA) $(PUBLIC_HRL_FILES) "$(RELSYSDIR)/include" release_docs_spec: - -deps: - erlc -M $(ERL_FILES) \ - | sed 's@$(ERL_TOP)/lib@../..@g' \ - | sed 's/\.$(EMULATOR)/\.$$\(EMULATOR\)/' \ - | sed 's@^ssh_@$$(EBIN)/ssh_@' - -ssh.$(EMULATOR): ssh.erl ssh.hrl ssh_connect.hrl \ - ../../public_key/include/public_key.hrl \ - ../../public_key/include/OTP-PUB-KEY.hrl \ - ../../public_key/include/PKCS-FRAME.hrl \ - ../../kernel/include/file.hrl -$(EBIN)/ssh_sup.$(EMULATOR): ssh_sup.erl -sshc_sup.$(EMULATOR): sshc_sup.erl -sshd_sup.$(EMULATOR): sshd_sup.erl ssh.hrl -$(EBIN)/ssh_connection_sup.$(EMULATOR): ssh_connection_sup.erl -$(EBIN)/ssh_connection.$(EMULATOR): ssh_connection.erl ssh.hrl ssh_connect.hrl \ - ssh_transport.hrl -$(EBIN)/ssh_connection_handler.$(EMULATOR): ssh_connection_handler.erl ssh.hrl \ - ssh_transport.hrl ssh_auth.hrl ssh_connect.hrl -$(EBIN)/ssh_shell.$(EMULATOR): ssh_shell.erl ssh_connect.hrl -$(EBIN)/ssh_system_sup.$(EMULATOR): ssh_system_sup.erl ssh.hrl -$(EBIN)/ssh_subsystem_sup.$(EMULATOR): ssh_subsystem_sup.erl -$(EBIN)/ssh_channel_sup.$(EMULATOR): ssh_channel_sup.erl -$(EBIN)/ssh_acceptor_sup.$(EMULATOR): ssh_acceptor_sup.erl ssh.hrl -$(EBIN)/ssh_acceptor.$(EMULATOR): ssh_acceptor.erl ssh.hrl -$(EBIN)/ssh_app.$(EMULATOR): ssh_app.erl -$(EBIN)/ssh_auth.$(EMULATOR): ssh_auth.erl \ - ../../public_key/include/public_key.hrl \ - ../../public_key/include/OTP-PUB-KEY.hrl \ - ../../public_key/include/PKCS-FRAME.hrl \ - ssh.hrl ssh_auth.hrl ssh_transport.hrl -$(EBIN)/ssh_bits.$(EMULATOR): ssh_bits.erl ssh.hrl -$(EBIN)/ssh_cli.$(EMULATOR): ssh_cli.erl ssh.hrl ssh_connect.hrl -$(EBIN)/ssh_file.$(EMULATOR): ssh_file.erl \ - ../../public_key/include/public_key.hrl \ - ../../public_key/include/OTP-PUB-KEY.hrl \ - ../../public_key/include/PKCS-FRAME.hrl \ - ../../kernel/include/file.hrl ssh.hrl -$(EBIN)/ssh_io.$(EMULATOR): ssh_io.erl ssh.hrl -$(EBIN)/ssh_info.$(EMULATOR): ssh_info.erl -$(EBIN)/ssh_message.$(EMULATOR): ssh_message.erl \ - ../../public_key/include/public_key.hrl \ - ../../public_key/include/OTP-PUB-KEY.hrl \ - ../../public_key/include/PKCS-FRAME.hrl \ - ssh.hrl ssh_connect.hrl ssh_auth.hrl ssh_transport.hrl -$(EBIN)/ssh_no_io.$(EMULATOR): ssh_no_io.erl ssh_transport.hrl -$(EBIN)/ssh_sftp.$(EMULATOR): ssh_sftp.erl \ - ../../kernel/include/file.hrl ssh.hrl \ - ssh_xfer.hrl -$(EBIN)/ssh_sftpd.$(EMULATOR): ssh_sftpd.erl \ - ../../kernel/include/file.hrl ssh.hrl \ - ssh_xfer.hrl -$(EBIN)/ssh_sftpd_file.$(EMULATOR): ssh_sftpd_file.erl -$(EBIN)/ssh_transport.$(EMULATOR): ssh_transport.erl \ - ../../public_key/include/public_key.hrl \ - ../../public_key/include/OTP-PUB-KEY.hrl \ - ../../public_key/include/PKCS-FRAME.hrl \ - ../../kernel/include/inet.hrl \ - ssh_transport.hrl ssh.hrl -$(EBIN)/ssh_xfer.$(EMULATOR): ssh_xfer.erl ssh.hrl ssh_xfer.hrl -$(EBIN)/ssh_sftpd_file_api.$(EMULATOR): ssh_sftpd_file_api.erl -$(EBIN)/ssh_channel.$(EMULATOR): ssh_channel.erl ssh_connect.hrl -$(EBIN)/ssh_daemon_channel.$(EMULATOR): ssh_daemon_channel.erl -$(EBIN)/ssh_client_key_api.$(EMULATOR): ssh_client_key_api.erl \ - ../../public_key/include/public_key.hrl \ - ../../public_key/include/OTP-PUB-KEY.hrl \ - ../../public_key/include/PKCS-FRAME.hrl \ - ssh.hrl -$(EBIN)/ssh_server_key_api.$(EMULATOR): ssh_server_key_api.erl \ - ../../public_key/include/public_key.hrl \ - ../../public_key/include/OTP-PUB-KEY.hrl \ - ../../public_key/include/PKCS-FRAME.hrl \ - ssh.hrl - diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_acceptor.erl erlang-17.3-dfsg/lib/ssh/src/ssh_acceptor.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_acceptor.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_acceptor.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -22,11 +21,8 @@ -module(ssh_acceptor). --include("ssh.hrl"). - %% Internal application API --export([start_link/5, - number_of_connections/1]). +-export([start_link/5]). %% spawn export -export([acceptor_init/6, acceptor_loop/6]). @@ -46,7 +42,7 @@ acceptor_init(Parent, Port, Address, SockOpts, Opts, AcceptTimeout) -> {_, Callback, _} = proplists:get_value(transport, Opts, {tcp, gen_tcp, tcp_closed}), - case (catch do_socket_listen(Callback, Port, [{active, false} | SockOpts])) of + case (catch do_socket_listen(Callback, Port, SockOpts)) of {ok, ListenSocket} -> proc_lib:init_ack(Parent, {ok, self()}), acceptor_loop(Callback, @@ -56,12 +52,7 @@ error end. -do_socket_listen(Callback, Port0, Opts) -> - Port = - case proplists:get_value(fd, Opts) of - undefined -> Port0; - _ -> 0 - end, +do_socket_listen(Callback, Port, Opts) -> case Callback:listen(Port, Opts) of {error, nxdomain} -> Callback:listen(Port, lists:delete(inet6, Opts)); @@ -90,10 +81,8 @@ end. handle_connection(Callback, Address, Port, Options, Socket) -> + SystemSup = ssh_system_sup:system_supervisor(Address, Port), SSHopts = proplists:get_value(ssh_opts, Options, []), - Profile = proplists:get_value(profile, SSHopts, ?DEFAULT_PROFILE), - SystemSup = ssh_system_sup:system_supervisor(Address, Port, Profile), - MaxSessions = proplists:get_value(max_sessions,SSHopts,infinity), case number_of_connections(SystemSup) < MaxSessions of true -> @@ -151,6 +140,5 @@ number_of_connections(SystemSup) -> length([X || {R,X,supervisor,[ssh_subsystem_sup]} <- supervisor:which_children(SystemSup), - is_pid(X), is_reference(R) ]). diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_acceptor_sup.erl erlang-17.3-dfsg/lib/ssh/src/ssh_acceptor_sup.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_acceptor_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_acceptor_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2014. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,9 +26,7 @@ -module(ssh_acceptor_sup). -behaviour(supervisor). --include("ssh.hrl"). - --export([start_link/1, start_child/2, stop_child/4]). +-export([start_link/1, start_child/2, stop_child/2]). %% Supervisor callback -export([init/1]). @@ -48,19 +45,18 @@ {error, already_present} -> Address = proplists:get_value(address, ServerOpts), Port = proplists:get_value(port, ServerOpts), - Profile = proplists:get_value(profile, - proplists:get_value(ssh_opts, ServerOpts), ?DEFAULT_PROFILE), - stop_child(AccSup, Address, Port, Profile), + Name = id(Address, Port), + supervisor:delete_child(?MODULE, Name), supervisor:start_child(AccSup, Spec); Reply -> Reply end. -stop_child(AccSup, Address, Port, Profile) -> - Name = id(Address, Port, Profile), - case supervisor:terminate_child(AccSup, Name) of +stop_child(Address, Port) -> + Name = id(Address, Port), + case supervisor:terminate_child(?MODULE, Name) of ok -> - supervisor:delete_child(AccSup, Name); + supervisor:delete_child(?MODULE, Name); Error -> Error end. @@ -82,8 +78,7 @@ Address = proplists:get_value(address, ServerOpts), Port = proplists:get_value(port, ServerOpts), Timeout = proplists:get_value(timeout, ServerOpts, ?DEFAULT_TIMEOUT), - Profile = proplists:get_value(profile, proplists:get_value(ssh_opts, ServerOpts), ?DEFAULT_PROFILE), - Name = id(Address, Port, Profile), + Name = id(Address, Port), SocketOpts = proplists:get_value(socket_opts, ServerOpts), StartFunc = {ssh_acceptor, start_link, [Port, Address, [{active, false}, @@ -95,11 +90,6 @@ Type = worker, {Name, StartFunc, Restart, Shutdown, Type, Modules}. -id(Address, Port, Profile) -> - case is_list(Address) of - true -> - {ssh_acceptor_sup, any, Port, Profile}; - false -> - {ssh_acceptor_sup, Address, Port, Profile} - end. +id(Address, Port) -> + {ssh_acceptor_sup, Address, Port}. diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_app.erl erlang-17.3-dfsg/lib/ssh/src/ssh_app.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh.app.src erlang-17.3-dfsg/lib/ssh/src/ssh.app.src --- erlang-18.2-dfsg/lib/ssh/src/ssh.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -23,7 +23,7 @@ sshd_sup, ssh_file, ssh_io, - ssh_info, + ssh_math, ssh_no_io, ssh_server_key_api, ssh_sftp, @@ -39,7 +39,7 @@ {applications, [kernel, stdlib, crypto, public_key]}, {env, []}, {mod, {ssh_app, []}}, - {runtime_dependencies, ["stdlib-2.3","public_key-0.22","kernel-3.0", + {runtime_dependencies, ["stdlib-2.0","public_key-0.22","kernel-3.0", "erts-6.0","crypto-3.3"]}]}. diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh.appup.src erlang-17.3-dfsg/lib/ssh/src/ssh.appup.src --- erlang-18.2-dfsg/lib/ssh/src/ssh.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,28 +1,43 @@ %% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% {"%VSN%", [ + {"3.0.2", [{load_module, ssh_message, soft_purge, soft_purge, []}, + {load_module, ssh_connection_handler, soft_purge, soft_purge, []}, + {load_module, ssh_io, soft_purge, soft_purge, []}]}, + {"3.0.1", [{load_module, ssh, soft_purge, soft_purge, []}, + {load_module, ssh_acceptor, soft_purge, soft_purge, []}, + {load_module, ssh_message, soft_purge, soft_purge, []}, + {load_module, ssh_connection_handler, soft_purge, soft_purge, []}, + {load_module, ssh_io, soft_purge, soft_purge, []}]}, {<<".*">>, [{restart_application, ssh}]} ], [ + {"3.0.2", [{load_module, ssh_message, soft_purge, soft_purge, []}, + {load_module, ssh_connection_handler, soft_purge, soft_purge, []}, + {load_module, ssh_io, soft_purge, soft_purge, []}]}, + {"3.0.1", [{load_module, ssh, soft_purge, soft_purge, []}, + {load_module, ssh_acceptor, soft_purge, soft_purge, []}, + {load_module, ssh_message, soft_purge, soft_purge, []}, + {load_module, ssh_connection_handler, soft_purge, soft_purge, []}, + {load_module, ssh_io, soft_purge, soft_purge, []}]}, {<<".*">>, [{restart_application, ssh}]} ] }. diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_auth.erl erlang-17.3-dfsg/lib/ssh/src/ssh_auth.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_auth.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_auth.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2014. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -41,29 +40,27 @@ session_id = SessionId, service = Service, opts = Opts} = Ssh]) -> + Hash = sha, %% Maybe option?! KeyCb = proplists:get_value(key_cb, Opts, ssh_file), + case KeyCb:user_key(Alg, Opts) of - {ok, PrivKey} -> - StrAlgo = atom_to_list(Alg), - case encode_public_key(StrAlgo, ssh_transport:extract_public_key(PrivKey)) of - not_ok -> - not_ok; - PubKeyBlob -> - SigData = build_sig_data(SessionId, - User, Service, PubKeyBlob, StrAlgo), - Sig = ssh_transport:sign(SigData, Hash, PrivKey), - SigBlob = list_to_binary([?string(StrAlgo), ?binary(Sig)]), - ssh_transport:ssh_packet( - #ssh_msg_userauth_request{user = User, - service = Service, - method = "publickey", - data = [?TRUE, - ?string(StrAlgo), - ?binary(PubKeyBlob), - ?binary(SigBlob)]}, - Ssh) - end; + {ok, Key} -> + StrAlgo = algorithm_string(Alg), + PubKeyBlob = encode_public_key(Key), + SigData = build_sig_data(SessionId, + User, Service, PubKeyBlob, StrAlgo), + Sig = ssh_transport:sign(SigData, Hash, Key), + SigBlob = list_to_binary([?string(StrAlgo), ?binary(Sig)]), + ssh_transport:ssh_packet( + #ssh_msg_userauth_request{user = User, + service = Service, + method = "publickey", + data = [?TRUE, + ?string(StrAlgo), + ?binary(PubKeyBlob), + ?binary(SigBlob)]}, + Ssh); _Error -> not_ok end. @@ -118,21 +115,36 @@ service = "ssh-connection", method = "none", data = <<>>}, - Algs0 = proplists:get_value(pref_public_key_algs, Opts, ?SUPPORTED_USER_KEYS), - %% The following line is not strictly correct. The call returns the - %% supported HOST key types while we are interested in USER keys. However, - %% they "happens" to be the same (for now). This could change.... - %% There is no danger as long as the set of user keys is a subset of the set - %% of host keys. - CryptoSupported = ssh_transport:supported_algorithms(public_key), - Algs = [A || A <- Algs0, - lists:member(A, CryptoSupported)], - - Prefs = method_preference(Algs), - ssh_transport:ssh_packet(Msg, Ssh#ssh{user = User, - userauth_preference = Prefs, - userauth_methods = none, - service = "ssh-connection"}); + case proplists:get_value(pref_public_key_algs, Opts, false) of + false -> + FirstAlg = proplists:get_value(public_key_alg, Opts, ?PREFERRED_PK_ALG), + SecondAlg = other_alg(FirstAlg), + AllowUserInt = proplists:get_value(user_interaction, Opts, true), + Prefs = method_preference(FirstAlg, SecondAlg, AllowUserInt), + ssh_transport:ssh_packet(Msg, Ssh#ssh{user = User, + userauth_preference = Prefs, + userauth_methods = none, + service = "ssh-connection"}); + Algs -> + FirstAlg = lists:nth(1, Algs), + case length(Algs) =:= 2 of + true -> + SecondAlg = other_alg(FirstAlg), + AllowUserInt = proplists:get_value(user_interaction, Opts, true), + Prefs = method_preference(FirstAlg, SecondAlg, AllowUserInt), + ssh_transport:ssh_packet(Msg, Ssh#ssh{user = User, + userauth_preference = Prefs, + userauth_methods = none, + service = "ssh-connection"}); + _ -> + AllowUserInt = proplists:get_value(user_interaction, Opts, true), + Prefs = method_preference(FirstAlg, AllowUserInt), + ssh_transport:ssh_packet(Msg, Ssh#ssh{user = User, + userauth_preference = Prefs, + userauth_methods = none, + service = "ssh-connection"}) + end + end; {error, no_user} -> ErrStr = "Could not determine the users name", throw(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_ILLEGAL_USER_NAME, @@ -159,7 +171,7 @@ not_ok -> userauth_request_msg(Ssh); Result -> - {Pref,Result} + Result end; false -> userauth_request_msg(Ssh) @@ -175,44 +187,23 @@ handle_userauth_request(#ssh_msg_userauth_request{user = User, service = "ssh-connection", method = "password", - data = <>}, _, - #ssh{opts = Opts, - userauth_supported_methods = Methods} = Ssh) -> + data = Data}, _, + #ssh{opts = Opts} = Ssh) -> + <<_:8, ?UINT32(Sz), BinPwd:Sz/binary>> = Data, Password = unicode:characters_to_list(BinPwd), - case check_password(User, Password, Opts, Ssh) of - {true,Ssh1} -> + case check_password(User, Password, Opts) of + true -> {authorized, User, - ssh_transport:ssh_packet(#ssh_msg_userauth_success{}, Ssh1)}; - {false,Ssh1} -> + ssh_transport:ssh_packet(#ssh_msg_userauth_success{}, Ssh)}; + false -> {not_authorized, {User, {error,"Bad user or password"}}, ssh_transport:ssh_packet(#ssh_msg_userauth_failure{ - authentications = Methods, - partial_success = false}, Ssh1)} + authentications = "", + partial_success = false}, Ssh)} end; handle_userauth_request(#ssh_msg_userauth_request{user = User, service = "ssh-connection", - method = "password", - data = <> - }, _, - #ssh{userauth_supported_methods = Methods} = Ssh) -> - %% Password change without us having sent SSH_MSG_USERAUTH_PASSWD_CHANGEREQ (because we never do) - %% RFC 4252 says: - %% SSH_MSG_USERAUTH_FAILURE without partial success - The password - %% has not been changed. Either password changing was not supported, - %% or the old password was bad. - - {not_authorized, {User, {error,"Password change not supported"}}, - ssh_transport:ssh_packet(#ssh_msg_userauth_failure{ - authentications = Methods, - partial_success = false}, Ssh)}; - -handle_userauth_request(#ssh_msg_userauth_request{user = User, - service = "ssh-connection", method = "none"}, _, #ssh{userauth_supported_methods = Methods} = Ssh) -> {not_authorized, {User, undefined}, @@ -224,9 +215,7 @@ service = "ssh-connection", method = "publickey", data = Data}, - SessionId, - #ssh{opts = Opts, - userauth_supported_methods = Methods} = Ssh) -> + SessionId, #ssh{opts = Opts} = Ssh) -> <> = Data, Alg = binary_to_list(BAlg), @@ -241,7 +230,7 @@ false -> {not_authorized, {User, undefined}, ssh_transport:ssh_packet(#ssh_msg_userauth_failure{ - authentications = Methods, + authentications="publickey,password", partial_success = false}, Ssh)} end; ?FALSE -> @@ -253,64 +242,6 @@ handle_userauth_request(#ssh_msg_userauth_request{user = User, service = "ssh-connection", - method = "keyboard-interactive", - data = _}, - _, #ssh{opts = Opts, - kb_tries_left = KbTriesLeft, - userauth_supported_methods = Methods} = Ssh) -> - case KbTriesLeft of - N when N<1 -> - {not_authorized, {User, {authmethod, "keyboard-interactive"}}, - ssh_transport:ssh_packet( - #ssh_msg_userauth_failure{authentications = Methods, - partial_success = false}, Ssh)}; - - _ -> - %% RFC4256 - %% The data field contains: - %% - language tag (deprecated). If =/=[] SHOULD use it however. We skip - %% it for simplicity. - %% - submethods. "... the user can give a hint of which actual methods - %% he wants to use. ...". It's a "MAY use" so we skip - %% it. It also needs an understanding between the client - %% and the server. - %% - %% "The server MUST reply with an SSH_MSG_USERAUTH_SUCCESS, - %% SSH_MSG_USERAUTH_FAILURE, or SSH_MSG_USERAUTH_INFO_REQUEST message." - Default = {"SSH server", - "Enter password for \""++User++"\"", - "password: ", - false}, - - {Name, Instruction, Prompt, Echo} = - case proplists:get_value(auth_method_kb_interactive_data, Opts) of - undefined -> - Default; - {_,_,_,_}=V -> - V; - F when is_function(F) -> - {_,PeerName} = Ssh#ssh.peer, - F(PeerName, User, "ssh-connection") - end, - EchoEnc = case Echo of - true -> <>; - false -> <> - end, - Msg = #ssh_msg_userauth_info_request{name = unicode:characters_to_list(Name), - instruction = unicode:characters_to_list(Instruction), - language_tag = "", - num_prompts = 1, - data = <> - }, - {not_authorized, {User, undefined}, - ssh_transport:ssh_packet(Msg, Ssh#ssh{user = User - })} - end; - -handle_userauth_request(#ssh_msg_userauth_request{user = User, - service = "ssh-connection", method = Other}, _, #ssh{userauth_supported_methods = Methods} = Ssh) -> {not_authorized, {User, {authmethod, Other}}, @@ -318,8 +249,6 @@ #ssh_msg_userauth_failure{authentications = Methods, partial_success = false}, Ssh)}. - - handle_userauth_info_request( #ssh_msg_userauth_info_request{name = Name, instruction = Instr, @@ -327,31 +256,15 @@ data = Data}, IoCb, #ssh{opts = Opts} = Ssh) -> PromptInfos = decode_keyboard_interactive_prompts(NumPrompts,Data), - Responses = keyboard_interact_get_responses(IoCb, Opts, + Resps = keyboard_interact_get_responses(IoCb, Opts, Name, Instr, PromptInfos), + RespBin = list_to_binary( + lists:map(fun(S) -> <> end, + Resps)), {ok, ssh_transport:ssh_packet( #ssh_msg_userauth_info_response{num_responses = NumPrompts, - data = Responses}, Ssh)}. - -handle_userauth_info_response(#ssh_msg_userauth_info_response{num_responses = 1, - data = <>}, - #ssh{opts = Opts, - kb_tries_left = KbTriesLeft, - user = User, - userauth_supported_methods = Methods} = Ssh) -> - case check_password(User, unicode:characters_to_list(Password), Opts, Ssh) of - {true,Ssh1} -> - {authorized, User, - ssh_transport:ssh_packet(#ssh_msg_userauth_success{}, Ssh1)}; - {false,Ssh1} -> - {not_authorized, {User, {error,"Bad user or password"}}, - ssh_transport:ssh_packet(#ssh_msg_userauth_failure{ - authentications = Methods, - partial_success = false}, - Ssh1#ssh{kb_tries_left = max(KbTriesLeft-1, 0)} - )} - end; + data = RespBin}, Ssh)}. handle_userauth_info_response(#ssh_msg_userauth_info_response{}, _Auth) -> @@ -360,23 +273,29 @@ "keyboard-interactive", language = "en"}). - %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- -method_preference(Algs) -> - lists:foldr(fun(A, Acc) -> - [{"publickey", ?MODULE, publickey_msg, [A]} | Acc] - end, - [{"password", ?MODULE, password_msg, []}, - {"keyboard-interactive", ?MODULE, keyboard_interactive_msg, []}, - {"keyboard-interactive", ?MODULE, keyboard_interactive_msg, []}, - {"keyboard-interactive", ?MODULE, keyboard_interactive_msg, []}, - {"keyboard-interactive", ?MODULE, keyboard_interactive_msg, []}, - {"keyboard-interactive", ?MODULE, keyboard_interactive_msg, []}, - {"keyboard-interactive", ?MODULE, keyboard_interactive_msg, []} - ], - Algs). +method_preference(Alg1, Alg2, true) -> + [{"publickey", ?MODULE, publickey_msg, [Alg1]}, + {"publickey", ?MODULE, publickey_msg,[Alg2]}, + {"password", ?MODULE, password_msg, []}, + {"keyboard-interactive", ?MODULE, keyboard_interactive_msg, []} + ]; +method_preference(Alg1, Alg2, false) -> + [{"publickey", ?MODULE, publickey_msg, [Alg1]}, + {"publickey", ?MODULE, publickey_msg,[Alg2]}, + {"password", ?MODULE, password_msg, []} + ]. +method_preference(Alg1, true) -> + [{"publickey", ?MODULE, publickey_msg, [Alg1]}, + {"password", ?MODULE, password_msg, []}, + {"keyboard-interactive", ?MODULE, keyboard_interactive_msg, []} + ]; +method_preference(Alg1, false) -> + [{"publickey", ?MODULE, publickey_msg, [Alg1]}, + {"password", ?MODULE, password_msg, []} + ]. user_name(Opts) -> Env = case os:type() of @@ -397,34 +316,13 @@ {ok, User} end. -check_password(User, Password, Opts, Ssh) -> +check_password(User, Password, Opts) -> case proplists:get_value(pwdfun, Opts) of undefined -> Static = get_password_option(Opts, User), - {Password == Static, Ssh}; - - Checker when is_function(Checker,2) -> - {Checker(User, Password), Ssh}; - - Checker when is_function(Checker,4) -> - #ssh{pwdfun_user_state = PrivateState, - peer = {_,PeerAddr={_,_}} - } = Ssh, - case Checker(User, Password, PeerAddr, PrivateState) of - true -> - {true,Ssh}; - false -> - {false,Ssh}; - {true,NewState} -> - {true, Ssh#ssh{pwdfun_user_state=NewState}}; - {false,NewState} -> - {false, Ssh#ssh{pwdfun_user_state=NewState}}; - disconnect -> - throw(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_SERVICE_NOT_AVAILABLE, - description = - "Unable to connect using the available authentication methods", - language = ""}) - end + Password == Static; + Cheker -> + Cheker(User, Password) end. get_password_option(Opts, User) -> @@ -461,35 +359,44 @@ ?binary(KeyBlob)], list_to_binary(Sig). - +algorithm_string('ssh-rsa') -> + "ssh-rsa"; +algorithm_string('ssh-dss') -> + "ssh-dss". decode_keyboard_interactive_prompts(_NumPrompts, Data) -> ssh_message:decode_keyboard_interactive_prompts(Data, []). keyboard_interact_get_responses(IoCb, Opts, Name, Instr, PromptInfos) -> NumPrompts = length(PromptInfos), - keyboard_interact_get_responses(proplists:get_value(user_interaction, Opts, true), - proplists:get_value(keyboard_interact_fun, Opts), - proplists:get_value(password, Opts, undefined), IoCb, Name, - Instr, PromptInfos, Opts, NumPrompts). - -keyboard_interact_get_responses(_, undefined, Password, _, _, _, _, _, - 1) when Password =/= undefined -> - [Password]; %% Password auth implemented with keyboard-interaction and passwd is known -keyboard_interact_get_responses(_, _, _, _, _, _, _, _, 0) -> - [""]; -keyboard_interact_get_responses(false, undefined, undefined, _, _, _, [Prompt|_], Opts, _) -> - ssh_no_io:read_line(Prompt, Opts); %% Throws error as keyboard interaction is not allowed -keyboard_interact_get_responses(true, undefined, _,IoCb, Name, Instr, PromptInfos, Opts, _) -> - keyboard_interact(IoCb, Name, Instr, PromptInfos, Opts); -keyboard_interact_get_responses(true, Fun, _Pwd, _IoCb, Name, Instr, PromptInfos, _Opts, NumPrompts) -> - keyboard_interact_fun(Fun, Name, Instr, PromptInfos, NumPrompts). + case proplists:get_value(keyboard_interact_fun, Opts) of + undefined when NumPrompts == 1 -> + %% Special case/fallback for just one prompt + %% (assumed to be the password prompt) + case proplists:get_value(password, Opts) of + undefined -> keyboard_interact(IoCb, Name, Instr, PromptInfos, Opts); + PW -> [PW] + end; + undefined -> + keyboard_interact(IoCb, Name, Instr, PromptInfos, Opts); + KbdInteractFun -> + Prompts = lists:map(fun({Prompt, _Echo}) -> Prompt end, + PromptInfos), + case KbdInteractFun(Name, Instr, Prompts) of + Rs when length(Rs) == NumPrompts -> + Rs; + Rs -> + erlang:error({mismatching_number_of_responses, + {got,Rs}, + {expected,NumPrompts}}) + end + end. keyboard_interact(IoCb, Name, Instr, Prompts, Opts) -> - if Name /= "" -> IoCb:format("~s~n", [Name]); + if Name /= "" -> IoCb:format("~s", [Name]); true -> ok end, - if Instr /= "" -> IoCb:format("~s~n", [Instr]); + if Instr /= "" -> IoCb:format("~s", [Instr]); true -> ok end, lists:map(fun({Prompt, true}) -> IoCb:read_line(Prompt, Opts); @@ -497,33 +404,33 @@ end, Prompts). -keyboard_interact_fun(KbdInteractFun, Name, Instr, PromptInfos, NumPrompts) -> - Prompts = lists:map(fun({Prompt, _Echo}) -> Prompt end, - PromptInfos), - case KbdInteractFun(Name, Instr, Prompts) of - Rs when length(Rs) == NumPrompts -> - Rs; - Rs -> - throw({mismatching_number_of_responses, - {got,Rs}, - {expected, NumPrompts}, - #ssh_msg_disconnect{code = ?SSH_DISCONNECT_SERVICE_NOT_AVAILABLE, - description = "User interaction failed", - language = "en"}}) - end. - -decode_public_key_v2(Bin, _Type) -> - try - public_key:ssh_decode(Bin, ssh2_pubkey) - of - Key -> {ok, Key} - catch - _:_ -> {error, bad_format} - end. - -encode_public_key(_Alg, Key) -> - try - public_key:ssh_encode(Key, ssh2_pubkey) - catch - _:_ -> not_ok - end. +other_alg('ssh-rsa') -> + 'ssh-dss'; +other_alg('ssh-dss') -> + 'ssh-rsa'. +decode_public_key_v2(<> + ,"ssh-rsa") -> + E = ssh_bits:erlint(Len1, BinE), + N = ssh_bits:erlint(Len2, BinN), + {ok, #'RSAPublicKey'{publicExponent = E, modulus = N}}; +decode_public_key_v2(<> + , "ssh-dss") -> + P = ssh_bits:erlint(Len1, BinP), + Q = ssh_bits:erlint(Len2, BinQ), + G = ssh_bits:erlint(Len3, BinG), + Y = ssh_bits:erlint(Len4, BinY), + {ok, {Y, #'Dss-Parms'{p = P, q = Q, g = G}}}; + +decode_public_key_v2(_, _) -> + {error, bad_format}. + +encode_public_key(#'RSAPrivateKey'{publicExponent = E, modulus = N}) -> + ssh_bits:encode(["ssh-rsa",E,N], [string,mpint,mpint]); +encode_public_key(#'DSAPrivateKey'{p = P, q = Q, g = G, y = Y}) -> + ssh_bits:encode(["ssh-dss",P,Q,G,Y], [string,mpint,mpint,mpint,mpint]). diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_auth.hrl erlang-17.3-dfsg/lib/ssh/src/ssh_auth.hrl --- erlang-18.2-dfsg/lib/ssh/src/ssh_auth.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_auth.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -22,6 +21,9 @@ %%% Description: Ssh User Authentication Protocol +-define(SUPPORTED_AUTH_METHODS, "publickey,keyboard-interactive,password"). + +-define(PREFERRED_PK_ALG, 'ssh-rsa'). -define(SSH_MSG_USERAUTH_REQUEST, 50). -define(SSH_MSG_USERAUTH_FAILURE, 51). diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_bits.erl erlang-17.3-dfsg/lib/ssh/src/ssh_bits.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_bits.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_bits.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,7 +26,7 @@ -include("ssh.hrl"). -export([encode/2]). --export([mpint/1, string/1, name_list/1]). +-export([mpint/1, erlint/2, string/1, name_list/1]). -export([random/1]). -define(name_list(X), @@ -146,7 +145,11 @@ enc([], [],_) -> []. - +erlint(Len, BinInt) -> + Sz = Len*8, + <> = BinInt, + Int. + %% %% Create a binary with constant bytes %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_channel.erl erlang-17.3-dfsg/lib/ssh/src/ssh_channel.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_channel.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_channel.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -68,8 +67,7 @@ %% Internal application API -export([cache_create/0, cache_lookup/2, cache_update/2, cache_delete/1, cache_delete/2, cache_foldl/3, - cache_find/2, - get_print_info/1]). + cache_find/2]). -record(state, { cm, @@ -192,14 +190,6 @@ %% {stop, Reason, State} %% Description: Handling call messages %%-------------------------------------------------------------------- -handle_call(get_print_info, _From, State) -> - Reply = - {{State#state.cm, - State#state.channel_id}, - io_lib:format('CB=~p',[State#state.channel_cb]) - }, - {reply, Reply, State}; - handle_call(Request, From, #state{channel_cb = Module, channel_state = ChannelState} = State) -> try Module:handle_call(Request, From, ChannelState) of @@ -343,9 +333,6 @@ Channel end. -get_print_info(Pid) -> - call(Pid, get_print_info, 1000). - %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_channel_sup.erl erlang-17.3-dfsg/lib/ssh/src/ssh_channel_sup.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_channel_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_channel_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_client_key_api.erl erlang-17.3-dfsg/lib/ssh/src/ssh_client_key_api.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_client_key_api.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_client_key_api.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_client_key.erl erlang-17.3-dfsg/lib/ssh/src/ssh_client_key.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_client_key.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_client_key.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_cli.erl erlang-17.3-dfsg/lib/ssh/src/ssh_cli.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_cli.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_cli.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -99,7 +98,7 @@ Pty = Pty0#ssh_pty{width = Width, height = Height, pixel_width = PixWidth, pixel_height = PixHeight}, - {Chars, NewBuf} = io_request({window_change, Pty0}, Buf, Pty, undefined), + {Chars, NewBuf} = io_request({window_change, Pty0}, Buf, Pty), write_chars(ConnectionHandler, ChannelId, Chars), {ok, State#state{pty = Pty, buf = NewBuf}}; @@ -189,7 +188,7 @@ handle_msg({Group, Req}, #state{group = Group, buf = Buf, pty = Pty, cm = ConnectionHandler, channel = ChannelId} = State) -> - {Chars, NewBuf} = io_request(Req, Buf, Pty, Group), + {Chars, NewBuf} = io_request(Req, Buf, Pty), write_chars(ConnectionHandler, ChannelId, Chars), {ok, State#state{buf = NewBuf}}; @@ -264,49 +263,40 @@ %%% displaying device... %%% We are *not* really unicode aware yet, we just filter away characters %%% beyond the latin1 range. We however handle the unicode binaries... -io_request({window_change, OldTty}, Buf, Tty, _Group) -> +io_request({window_change, OldTty}, Buf, Tty) -> window_change(Tty, OldTty, Buf); -io_request({put_chars, Cs}, Buf, Tty, _Group) -> +io_request({put_chars, Cs}, Buf, Tty) -> put_chars(bin_to_list(Cs), Buf, Tty); -io_request({put_chars, unicode, Cs}, Buf, Tty, _Group) -> +io_request({put_chars, unicode, Cs}, Buf, Tty) -> put_chars(unicode:characters_to_list(Cs,unicode), Buf, Tty); -io_request({insert_chars, Cs}, Buf, Tty, _Group) -> +io_request({insert_chars, Cs}, Buf, Tty) -> insert_chars(bin_to_list(Cs), Buf, Tty); -io_request({insert_chars, unicode, Cs}, Buf, Tty, _Group) -> +io_request({insert_chars, unicode, Cs}, Buf, Tty) -> insert_chars(unicode:characters_to_list(Cs,unicode), Buf, Tty); -io_request({move_rel, N}, Buf, Tty, _Group) -> +io_request({move_rel, N}, Buf, Tty) -> move_rel(N, Buf, Tty); -io_request({delete_chars,N}, Buf, Tty, _Group) -> +io_request({delete_chars,N}, Buf, Tty) -> delete_chars(N, Buf, Tty); -io_request(beep, Buf, _Tty, _Group) -> +io_request(beep, Buf, _Tty) -> {[7], Buf}; %% New in R12 -io_request({get_geometry,columns},Buf,Tty, _Group) -> +io_request({get_geometry,columns},Buf,Tty) -> {ok, Tty#ssh_pty.width, Buf}; -io_request({get_geometry,rows},Buf,Tty, _Group) -> +io_request({get_geometry,rows},Buf,Tty) -> {ok, Tty#ssh_pty.height, Buf}; -io_request({requests,Rs}, Buf, Tty, Group) -> - io_requests(Rs, Buf, Tty, [], Group); -io_request(tty_geometry, Buf, Tty, Group) -> - io_requests([{move_rel, 0}, {put_chars, unicode, [10]}], - Buf, Tty, [], Group); +io_request({requests,Rs}, Buf, Tty) -> + io_requests(Rs, Buf, Tty, []); +io_request(tty_geometry, Buf, Tty) -> + io_requests([{move_rel, 0}, {put_chars, unicode, [10]}], Buf, Tty, []); %{[], Buf}; - -%% New in 18 -io_request({put_chars_sync, Class, Cs, Reply}, Buf, Tty, Group) -> - %% We handle these asynchronous for now, if we need output guarantees - %% we have to handle these synchronously - Group ! {reply, Reply}, - io_request({put_chars, Class, Cs}, Buf, Tty, Group); - -io_request(_R, Buf, _Tty, _Group) -> +io_request(_R, Buf, _Tty) -> {[], Buf}. -io_requests([R|Rs], Buf, Tty, Acc, Group) -> - {Chars, NewBuf} = io_request(R, Buf, Tty, Group), - io_requests(Rs, NewBuf, Tty, [Acc|Chars], Group); -io_requests([], Buf, _Tty, Acc, _Group) -> +io_requests([R|Rs], Buf, Tty, Acc) -> + {Chars, NewBuf} = io_request(R, Buf, Tty), + io_requests(Rs, NewBuf, Tty, [Acc|Chars]); +io_requests([], Buf, _Tty, Acc) -> {Acc, Buf}. %%% return commands for cursor navigation, assume everything is ansi diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_connect.hrl erlang-17.3-dfsg/lib/ssh/src/ssh_connect.hrl --- erlang-18.2-dfsg/lib/ssh/src/ssh_connect.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_connect.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2014. All Rights Reserved. +%% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,7 +26,6 @@ -define(DEFAULT_PACKET_SIZE, 32768). -define(DEFAULT_WINDOW_SIZE, 2*?DEFAULT_PACKET_SIZE). -define(DEFAULT_TIMEOUT, 5000). --define(MAX_PROTO_VERSION, 255). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% @@ -166,10 +164,6 @@ recipient_channel }). --define(TERMINAL_WIDTH, 80). --define(TERMINAL_HEIGHT, 24). --define(DEFAULT_TERMINAL, "vt100"). - -define(TTY_OP_END,0). %% Indicates end of options. -define(VINTR,1). %% Interrupt character; 255 if none. Similarly for the %% other characters. Not all of these characters are @@ -248,9 +242,6 @@ local_id, %% local channel id recv_window_size, - recv_window_pending = 0, %% Sum of window size updates that has not - %% yet been sent. This limits the number - %% of sent update msgs. recv_packet_size, recv_close = false, diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_connection.erl erlang-17.3-dfsg/lib/ssh/src/ssh_connection.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_connection.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_connection.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,11 +32,11 @@ %% API -export([session_channel/2, session_channel/4, exec/4, shell/2, subsystem/4, send/3, send/4, send/5, - send_eof/2, adjust_window/3, setenv/5, close/2, reply_request/4, - ptty_alloc/3, ptty_alloc/4]). + send_eof/2, adjust_window/3, setenv/5, close/2, reply_request/4]). %% Potential API currently unsupported and not tested --export([window_change/4, window_change/6, +-export([open_pty/3, open_pty/7, + open_pty/9, window_change/4, window_change/6, direct_tcpip/6, direct_tcpip/8, tcpip_forward/3, cancel_tcpip_forward/3, signal/3, exit_status/3]). @@ -57,8 +56,8 @@ %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- --spec session_channel(pid(), timeout()) -> {ok, channel_id()} | {error, timeout | closed}. --spec session_channel(pid(), integer(), integer(), timeout()) -> {ok, channel_id()} | {error, timeout | closed}. +-spec session_channel(pid(), timeout()) -> {ok, channel_id()} | {error, term()}. +-spec session_channel(pid(), integer(), integer(), timeout()) -> {ok, channel_id()} | {error, term()}. %% Description: Opens a channel for a ssh session. A session is a %% remote execution of a program. The program may be a shell, an @@ -82,8 +81,7 @@ end. %%-------------------------------------------------------------------- --spec exec(pid(), channel_id(), string(), timeout()) -> - success | failure | {error, timeout | closed}. +-spec exec(pid(), channel_id(), string(), timeout()) -> success | failure. %% Description: Will request that the server start the %% execution of the given command. @@ -103,8 +101,8 @@ ssh_connection_handler:request(ConnectionHandler, self(), ChannelId, "shell", false, <<>>, 0). %%-------------------------------------------------------------------- --spec subsystem(pid(), channel_id(), string(), timeout()) -> - success | failure | {error, timeout | closed}. +-spec subsystem(pid(), channel_id(), string(), timeout()) -> + success | failure | {error, timeout}. %% %% Description: Executes a predefined subsystem. %%-------------------------------------------------------------------- @@ -144,7 +142,7 @@ ssh_connection_handler:send_eof(ConnectionHandler, Channel). %%-------------------------------------------------------------------- --spec adjust_window(pid(), channel_id(), integer()) -> ok | {error, closed}. +-spec adjust_window(pid(), channel_id(), integer()) -> ok. %% %% %% Description: Adjusts the ssh flowcontrol window. @@ -153,8 +151,7 @@ ssh_connection_handler:adjust_window(ConnectionHandler, Channel, Bytes). %%-------------------------------------------------------------------- --spec setenv(pid(), channel_id(), string(), string(), timeout()) -> - success | failure | {error, timeout | closed}. +-spec setenv(pid(), channel_id(), string(), string(), timeout()) -> success | failure. %% %% %% Description: Environment variables may be passed to the shell/command to be @@ -186,30 +183,6 @@ ok. %%-------------------------------------------------------------------- --spec ptty_alloc(pid(), channel_id(), proplists:proplist()) -> - success | failiure | {error, closed}. --spec ptty_alloc(pid(), channel_id(), proplists:proplist(), timeout()) -> - success | failiure | {error, timeout} | {error, closed}. - -%% -%% -%% Description: Sends a ssh connection protocol pty_req. -%%-------------------------------------------------------------------- -ptty_alloc(ConnectionHandler, Channel, Options) -> - ptty_alloc(ConnectionHandler, Channel, Options, infinity). -ptty_alloc(ConnectionHandler, Channel, Options0, TimeOut) -> - Options = backwards_compatible(Options0, []), - {Width, PixWidth} = pty_default_dimensions(width, Options), - {Height, PixHeight} = pty_default_dimensions(height, Options), - pty_req(ConnectionHandler, Channel, - proplists:get_value(term, Options, os:getenv("TERM", ?DEFAULT_TERMINAL)), - proplists:get_value(width, Options, Width), - proplists:get_value(height, Options, Height), - proplists:get_value(pixel_widh, Options, PixWidth), - proplists:get_value(pixel_height, Options, PixHeight), - proplists:get_value(pty_opts, Options, []), TimeOut - ). -%%-------------------------------------------------------------------- %% Not yet officialy supported! The following functions are part of the %% initial contributed ssh application. They are untested. Do we want them? %% Should they be documented and tested? @@ -232,6 +205,23 @@ ssh_connection_handler:request(ConnectionHandler, Channel, "exit-status", false, [?uint32(Status)], 0). +open_pty(ConnectionHandler, Channel, TimeOut) -> + open_pty(ConnectionHandler, Channel, + os:getenv("TERM"), 80, 24, [], TimeOut). + +open_pty(ConnectionHandler, Channel, Term, Width, Height, PtyOpts, TimeOut) -> + open_pty(ConnectionHandler, Channel, Term, Width, + Height, 0, 0, PtyOpts, TimeOut). + +open_pty(ConnectionHandler, Channel, Term, Width, Height, + PixWidth, PixHeight, PtyOpts, TimeOut) -> + ssh_connection_handler:request(ConnectionHandler, + Channel, "pty-req", true, + [?string(Term), + ?uint32(Width), ?uint32(Height), + ?uint32(PixWidth),?uint32(PixHeight), + encode_pty_opts(PtyOpts)], TimeOut). + direct_tcpip(ConnectionHandler, RemoteHost, RemotePort, OrigIP, OrigPort, Timeout) -> direct_tcpip(ConnectionHandler, RemoteHost, RemotePort, OrigIP, OrigPort, @@ -328,7 +318,9 @@ SendDataType, SendData)} end, SendList), - FlowCtrlMsgs = flow_control(Replies, Channel, Cache), + FlowCtrlMsgs = flow_control(Replies, + Channel, + Cache), {{replies, Replies ++ FlowCtrlMsgs}, Connection}; _ -> gen_fsm:reply(From, {error, closed}), @@ -470,31 +462,18 @@ handle_msg(#ssh_msg_channel_open{channel_type = "session" = Type, sender_channel = RemoteId, initial_window_size = WindowSz, - maximum_packet_size = PacketSz}, - #connection{options = SSHopts} = Connection0, - server) -> - MinAcceptedPackSz = proplists:get_value(minimal_remote_max_packet_size, SSHopts, 0), - - if - MinAcceptedPackSz =< PacketSz -> - try setup_session(Connection0, RemoteId, - Type, WindowSz, PacketSz) of - Result -> - Result - catch _:_ -> - FailMsg = channel_open_failure_msg(RemoteId, - ?SSH_OPEN_CONNECT_FAILED, - "Connection refused", "en"), - {{replies, [{connection_reply, FailMsg}]}, - Connection0} - end; - - MinAcceptedPackSz > PacketSz -> + maximum_packet_size = PacketSz}, Connection0, server) -> + + try setup_session(Connection0, RemoteId, + Type, WindowSz, PacketSz) of + Result -> + Result + catch _:_ -> FailMsg = channel_open_failure_msg(RemoteId, - ?SSH_OPEN_ADMINISTRATIVELY_PROHIBITED, - lists:concat(["Maximum packet size below ",MinAcceptedPackSz, - " not supported"]), "en"), - {{replies, [{connection_reply, FailMsg}]}, Connection0} + ?SSH_OPEN_CONNECT_FAILED, + "Connection refused", "en"), + {{replies, [{connection_reply, FailMsg}]}, + Connection0} end; handle_msg(#ssh_msg_channel_open{channel_type = "session", @@ -514,57 +493,41 @@ initial_window_size = RWindowSz, maximum_packet_size = RPacketSz, data = Data}, - #connection{channel_cache = Cache, - options = SSHopts} = Connection0, server) -> + #connection{channel_cache = Cache} = Connection0, server) -> <> = Data, - MinAcceptedPackSz = proplists:get_value(minimal_remote_max_packet_size, SSHopts, 0), - - if - MinAcceptedPackSz =< RPacketSz -> - case bound_channel(Address, Port, Connection0) of - undefined -> - FailMsg = channel_open_failure_msg(RemoteId, - ?SSH_OPEN_CONNECT_FAILED, - "Connection refused", "en"), - {{replies, - [{connection_reply, FailMsg}]}, Connection0}; - ChannelPid -> - {ChannelId, Connection1} = new_channel_id(Connection0), - LWindowSz = ?DEFAULT_WINDOW_SIZE, - LPacketSz = ?DEFAULT_PACKET_SIZE, - Channel = #channel{type = Type, - sys = "none", - user = ChannelPid, - local_id = ChannelId, - recv_window_size = LWindowSz, - recv_packet_size = LPacketSz, - send_window_size = RWindowSz, - send_packet_size = RPacketSz, - send_buf = queue:new() - }, - ssh_channel:cache_update(Cache, Channel), - OpenConfMsg = channel_open_confirmation_msg(RemoteId, ChannelId, - LWindowSz, LPacketSz), - {OpenMsg, Connection} = - reply_msg(Channel, Connection1, - {open, Channel, {forwarded_tcpip, - decode_ip(Address), Port, - decode_ip(Orig), OrigPort}}), - {{replies, [{connection_reply, OpenConfMsg}, - OpenMsg]}, Connection} - end; - - MinAcceptedPackSz > RPacketSz -> + case bound_channel(Address, Port, Connection0) of + undefined -> FailMsg = channel_open_failure_msg(RemoteId, - ?SSH_OPEN_ADMINISTRATIVELY_PROHIBITED, - lists:concat(["Maximum packet size below ",MinAcceptedPackSz, - " not supported"]), "en"), - {{replies, [{connection_reply, FailMsg}]}, Connection0} + ?SSH_OPEN_CONNECT_FAILED, + "Connection refused", "en"), + {{replies, + [{connection_reply, FailMsg}]}, Connection0}; + ChannelPid -> + {ChannelId, Connection1} = new_channel_id(Connection0), + LWindowSz = ?DEFAULT_WINDOW_SIZE, + LPacketSz = ?DEFAULT_PACKET_SIZE, + Channel = #channel{type = Type, + sys = "none", + user = ChannelPid, + local_id = ChannelId, + recv_window_size = LWindowSz, + recv_packet_size = LPacketSz, + send_window_size = RWindowSz, + send_packet_size = RPacketSz}, + ssh_channel:cache_update(Cache, Channel), + OpenConfMsg = channel_open_confirmation_msg(RemoteId, ChannelId, + LWindowSz, LPacketSz), + {OpenMsg, Connection} = + reply_msg(Channel, Connection1, + {open, Channel, {forwarded_tcpip, + decode_ip(Address), Port, + decode_ip(Orig), OrigPort}}), + {{replies, [{connection_reply, OpenConfMsg}, + OpenMsg]}, Connection} end; - handle_msg(#ssh_msg_channel_open{channel_type = "forwarded-tcpip", sender_channel = RemoteId}, Connection, client) -> @@ -662,7 +625,7 @@ ReplyMsg = {subsystem, ChannelId, WantReply, binary_to_list(SsName)}, try - {ok, Pid} = start_subsystem(SsName, Connection, Channel0, ReplyMsg), + {ok, Pid} = start_subsytem(SsName, Connection, Channel0, ReplyMsg), erlang:monitor(process, Pid), Channel = Channel0#channel{user = Pid}, ssh_channel:cache_update(Cache, Channel), @@ -935,32 +898,18 @@ end end. -start_channel(Cb, Id, Args, SubSysSup, Opts) -> - start_channel(Cb, Id, Args, SubSysSup, undefined, Opts). +start_channel(Cb, Id, Args, SubSysSup) -> + start_channel(Cb, Id, Args, SubSysSup, undefined). -start_channel(Cb, Id, Args, SubSysSup, Exec, Opts) -> +start_channel(Cb, Id, Args, SubSysSup, Exec) -> ChildSpec = child_spec(Cb, Id, Args, Exec), ChannelSup = ssh_subsystem_sup:channel_supervisor(SubSysSup), - assert_limit_num_channels_not_exceeded(ChannelSup, Opts), ssh_channel_sup:start_child(ChannelSup, ChildSpec). -assert_limit_num_channels_not_exceeded(ChannelSup, Opts) -> - MaxNumChannels = proplists:get_value(max_channels, Opts, infinity), - NumChannels = length([x || {_,_,worker,[ssh_channel]} <- - supervisor:which_children(ChannelSup)]), - if - %% Note that NumChannels is BEFORE starting a new one - NumChannels < MaxNumChannels -> - ok; - true -> - throw(max_num_channels_exceeded) - end. - %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- -setup_session(#connection{channel_cache = Cache - } = Connection0, +setup_session(#connection{channel_cache = Cache} = Connection0, RemoteId, Type, WindowSize, PacketSize) -> {ChannelId, Connection} = new_channel_id(Connection0), @@ -972,7 +921,6 @@ recv_packet_size = ?DEFAULT_PACKET_SIZE, send_window_size = WindowSize, send_packet_size = PacketSize, - send_buf = queue:new(), remote_id = RemoteId }, ssh_channel:cache_update(Cache, Channel), @@ -1011,19 +959,17 @@ start_cli(#connection{cli_spec = no_cli}, _) -> {error, cli_disabled}; -start_cli(#connection{options = Options, - cli_spec = {CbModule, Args}, - exec = Exec, +start_cli(#connection{cli_spec = {CbModule, Args}, exec = Exec, sub_system_supervisor = SubSysSup}, ChannelId) -> - start_channel(CbModule, ChannelId, Args, SubSysSup, Exec, Options). + start_channel(CbModule, ChannelId, Args, SubSysSup, Exec). -start_subsystem(BinName, #connection{options = Options, +start_subsytem(BinName, #connection{options = Options, sub_system_supervisor = SubSysSup}, #channel{local_id = ChannelId}, _ReplyMsg) -> Name = binary_to_list(BinName), case check_subsystem(Name, Options) of {Callback, Opts} when is_atom(Callback), Callback =/= none -> - start_channel(Callback, ChannelId, Opts, SubSysSup, Options); + start_channel(Callback, ChannelId, Opts, SubSysSup); {Other, _} when Other =/= none -> {error, legacy_option_not_supported} end. @@ -1070,96 +1016,64 @@ update_send_window(Channel, _, undefined, #connection{channel_cache = Cache}) -> - do_update_send_window(Channel, Cache); + do_update_send_window(Channel, Channel#channel.send_buf, Cache); -update_send_window(#channel{send_buf = SendBuffer} = Channel, DataType, Data, +update_send_window(Channel, DataType, Data, #connection{channel_cache = Cache}) -> - do_update_send_window(Channel#channel{send_buf = queue:in({DataType, Data}, SendBuffer)}, - Cache). + do_update_send_window(Channel, Channel#channel.send_buf ++ [{DataType, Data}], Cache). + +do_update_send_window(Channel0, Buf0, Cache) -> + {Buf1, NewSz, Buf2} = get_window(Buf0, + Channel0#channel.send_packet_size, + Channel0#channel.send_window_size), -do_update_send_window(Channel0, Cache) -> - {SendMsgs, Channel} = get_window(Channel0, []), + Channel = Channel0#channel{send_window_size = NewSz, send_buf = Buf2}, ssh_channel:cache_update(Cache, Channel), - {SendMsgs, Channel}. + {Buf1, Channel}. -get_window(#channel{send_window_size = 0 - } = Channel, Acc) -> - {lists:reverse(Acc), Channel}; -get_window(#channel{send_packet_size = 0 - } = Channel, Acc) -> - {lists:reverse(Acc), Channel}; -get_window(#channel{send_buf = Buffer, - send_packet_size = PacketSize, - send_window_size = WindowSize0 - } = Channel, Acc0) -> - case queue:out(Buffer) of - {{value, {_, Data} = Msg}, NewBuffer} -> - case handle_send_window(Msg, size(Data), PacketSize, WindowSize0, Acc0) of - {WindowSize, Acc, {_, <<>>}} -> - {lists:reverse(Acc), Channel#channel{send_window_size = WindowSize, - send_buf = NewBuffer}}; - {WindowSize, Acc, Rest} -> - get_window(Channel#channel{send_window_size = WindowSize, - send_buf = queue:in_r(Rest, NewBuffer)}, Acc) - end; - {empty, NewBuffer} -> - {[], Channel#channel{send_buf = NewBuffer}} - end. +get_window(Bs, PSz, WSz) -> + get_window(Bs, PSz, WSz, []). -handle_send_window(Msg = {Type, Data}, Size, PacketSize, WindowSize, Acc) when Size =< WindowSize -> - case Size =< PacketSize of - true -> - {WindowSize - Size, [Msg | Acc], {Type, <<>>}}; - false -> - <> = Data, - {WindowSize - PacketSize, [{Type, Msg1} | Acc], {Type, Msg2}} +get_window(Bs, _PSz, 0, Acc) -> + {lists:reverse(Acc), 0, Bs}; +get_window([B0 = {DataType, Bin} | Bs], PSz, WSz, Acc) -> + BSz = size(Bin), + if BSz =< WSz -> %% will fit into window + if BSz =< PSz -> %% will fit into a packet + get_window(Bs, PSz, WSz-BSz, [B0|Acc]); + true -> %% split into packet size + <> = Bin, + get_window([setelement(2, B0, Bin2) | Bs], + PSz, WSz-PSz, + [{DataType, Bin1}|Acc]) + end; + WSz =< PSz -> %% use rest of window + <> = Bin, + get_window([setelement(2, B0, Bin2) | Bs], + PSz, WSz-WSz, + [{DataType, Bin1}|Acc]); + true -> %% use packet size + <> = Bin, + get_window([setelement(2, B0, Bin2) | Bs], + PSz, WSz-PSz, + [{DataType, Bin1}|Acc]) end; -handle_send_window({Type, Data}, _, PacketSize, WindowSize, Acc) when WindowSize =< PacketSize -> - <> = Data, - {WindowSize - WindowSize, [{Type, Msg1} | Acc], {Type, Msg2}}; -handle_send_window({Type, Data}, _, PacketSize, WindowSize, Acc) -> - <> = Data, - {WindowSize - PacketSize, [{Type, Msg1} | Acc], {Type, Msg2}}. +get_window([], _PSz, WSz, Acc) -> + {lists:reverse(Acc), WSz, []}. flow_control(Channel, Cache) -> flow_control([window_adjusted], Channel, Cache). - + flow_control([], Channel, Cache) -> ssh_channel:cache_update(Cache, Channel), []; + flow_control([_|_], #channel{flow_control = From, - send_buf = Buffer} = Channel, Cache) when From =/= undefined -> - case queue:is_empty(Buffer) of - true -> - ssh_channel:cache_update(Cache, Channel#channel{flow_control = undefined}), - [{flow_control, Cache, Channel, From, ok}]; - false -> - [] - end; + send_buf = []} = Channel, Cache) when From =/= undefined -> + [{flow_control, Cache, Channel, From, ok}]; flow_control(_,_,_) -> - []. + []. -pty_req(ConnectionHandler, Channel, Term, Width, Height, - PixWidth, PixHeight, PtyOpts, TimeOut) -> - ssh_connection_handler:request(ConnectionHandler, - Channel, "pty-req", true, - [?string(Term), - ?uint32(Width), ?uint32(Height), - ?uint32(PixWidth),?uint32(PixHeight), - encode_pty_opts(PtyOpts)], TimeOut). - -pty_default_dimensions(Dimension, Options) -> - case proplists:get_value(Dimension, Options, 0) of - N when is_integer(N), N > 0 -> - {N, 0}; - _ -> - case proplists:get_value(list_to_atom("pixel_" ++ atom_to_list(Dimension)), Options, 0) of - N when is_integer(N), N > 0 -> - {0, N}; - _ -> - {?TERMINAL_WIDTH, 0} - end - end. encode_pty_opts(Opts) -> Bin = list_to_binary(encode_pty_opts2(Opts)), @@ -1357,11 +1271,3 @@ {ok,A} -> A end. -backwards_compatible([], Acc) -> - Acc; -backwards_compatible([{hight, Value} | Rest], Acc) -> - backwards_compatible(Rest, [{height, Value} | Acc]); -backwards_compatible([{pixel_hight, Value} | Rest], Acc) -> - backwards_compatible(Rest, [{height, Value} | Acc]); -backwards_compatible([Value| Rest], Acc) -> - backwards_compatible(Rest, [ Value | Acc]). diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_connection_handler.erl erlang-17.3-dfsg/lib/ssh/src/ssh_connection_handler.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_connection_handler.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_connection_handler.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -34,7 +33,7 @@ -include("ssh_transport.hrl"). -include("ssh_auth.hrl"). -include("ssh_connect.hrl"). --compile(export_all). + -export([start_link/3]). %% Internal application API @@ -42,21 +41,14 @@ global_request/4, send/5, send_eof/2, info/1, info/2, connection_info/2, channel_info/3, adjust_window/3, close/2, stop/1, renegotiate/1, renegotiate_data/1, - start_connection/4, - get_print_info/1]). + start_connection/4]). %% gen_fsm callbacks --export([hello/2, kexinit/2, key_exchange/2, - key_exchange_dh_gex_init/2, key_exchange_dh_gex_reply/2, - new_keys/2, - service_request/2, connected/2, - userauth/2, - userauth_keyboard_interactive/2, - userauth_keyboard_interactive_info_response/2, - error/2]). +-export([hello/2, kexinit/2, key_exchange/2, new_keys/2, + userauth/2, connected/2]). -export([init/1, handle_event/3, - handle_sync_event/4, handle_info/3, terminate/3, format_status/2, code_change/4]). + handle_sync_event/4, handle_info/3, terminate/3, code_change/4]). -record(state, { role, @@ -76,30 +68,17 @@ undecoded_packet_length, % integer() key_exchange_init_msg, % #ssh_msg_kexinit{} renegotiate = false, % boolean() - last_size_rekey = 0, - event_queue = [], connection_queue, address, port, - opts, - recbuf + opts }). --type state_name() :: hello | kexinit | key_exchange | key_exchange_dh_gex_init | - key_exchange_dh_gex_reply | new_keys | service_request | - userauth | userauth_keyboard_interactive | - userauth_keyboard_interactive_info_response | - connection. - +-type state_name() :: hello | kexinit | key_exchange | new_keys | userauth | connection. -type gen_fsm_state_return() :: {next_state, state_name(), term()} | {next_state, state_name(), term(), timeout()} | {stop, term(), term()}. --type gen_fsm_sync_return() :: {next_state, state_name(), term()} | - {next_state, state_name(), term(), timeout()} | - {reply, term(), state_name(), term()} | - {stop, term(), term(), term()}. - %%==================================================================== %% Internal application API %%==================================================================== @@ -124,22 +103,12 @@ end; start_connection(server = Role, Socket, Options, Timeout) -> - SSH_Opts = proplists:get_value(ssh_opts, Options, []), try - case proplists:get_value(parallel_login, SSH_Opts, false) of + case proplists:get_value(parallel_login, Options, false) of true -> - HandshakerPid = - spawn_link(fun() -> - receive - {do_handshake, Pid} -> - handshake(Pid, erlang:monitor(process,Pid), Timeout) - end - end), - ChildPid = start_the_connection_child(HandshakerPid, Role, Socket, Options), - HandshakerPid ! {do_handshake, ChildPid}; + spawn(fun() -> start_server_connection(Role, Socket, Options, Timeout) end); false -> - ChildPid = start_the_connection_child(self(), Role, Socket, Options), - handshake(ChildPid, erlang:monitor(process,ChildPid), Timeout) + start_server_connection(Role, Socket, Options, Timeout) end catch exit:{noproc, _} -> @@ -148,14 +117,16 @@ {error, Error} end. -start_the_connection_child(UserPid, Role, Socket, Options) -> + +start_server_connection(server = Role, Socket, Options, Timeout) -> Sups = proplists:get_value(supervisors, Options), ConnectionSup = proplists:get_value(connection_sup, Sups), - Opts = [{supervisors, Sups}, {user_pid, UserPid} | proplists:get_value(ssh_opts, Options, [])], + Opts = [{supervisors, Sups}, {user_pid, self()} | proplists:get_value(ssh_opts, Options, [])], {ok, Pid} = ssh_connection_sup:start_child(ConnectionSup, [Role, Socket, Opts]), {_, Callback, _} = proplists:get_value(transport, Options, {tcp, gen_tcp, tcp_closed}), socket_control(Socket, Pid, Callback), - Pid. + Ref = erlang:monitor(process, Pid), + handshake(Pid, Ref, Timeout). start_link(Role, Socket, Options) -> @@ -191,23 +162,9 @@ State#state{ssh_params = Ssh}) catch _:Error -> - gen_fsm:enter_loop(?MODULE, [], error, {Error, State}) + gen_fsm:enter_loop(?MODULE, [], error, {Error, State0}) end. -%% Temporary fix for the Nessus error. SYN-> <-SYNACK ACK-> RST-> ? -error(_Event, {Error,State=#state{}}) -> - case Error of - {badmatch,{error,enotconn}} -> - %% {error,enotconn} probably from inet:peername in - %% init_ssh(server,..)/5 called from init/1 - {stop, {shutdown,"TCP connenction to server was prematurely closed by the client"}, State}; - _ -> - {stop, {shutdown,{init,Error}}, State} - end; -error(Event, State) -> - %% State deliberately not checked beeing #state. This is a panic-clause... - {stop, {shutdown,{init,{spurious_error,Event}}}, State}. - %%-------------------------------------------------------------------- -spec open_channel(pid(), string(), iodata(), integer(), integer(), timeout()) -> {open, channel_id()} | {error, term()}. @@ -274,9 +231,6 @@ %%-------------------------------------------------------------------- -spec connection_info(pid(), [atom()]) -> proplists:proplist(). %%-------------------------------------------------------------------- -get_print_info(ConnectionHandler) -> - sync_send_all_state_event(ConnectionHandler, get_print_info, 1000). - connection_info(ConnectionHandler, Options) -> sync_send_all_state_event(ConnectionHandler, {connection_info, Options}). @@ -307,13 +261,8 @@ -spec close(pid(), channel_id()) -> ok. %%-------------------------------------------------------------------- close(ConnectionHandler, ChannelId) -> - case sync_send_all_state_event(ConnectionHandler, {close, ChannelId}) of - ok -> - ok; - {error, closed} -> - ok - end. - + sync_send_all_state_event(ConnectionHandler, {close, ChannelId}). + %%-------------------------------------------------------------------- -spec stop(pid()) -> ok | {error, term()}. %%-------------------------------------------------------------------- @@ -344,42 +293,28 @@ hello(socket_control, #state{socket = Socket, ssh_params = Ssh} = State) -> VsnMsg = ssh_transport:hello_version_msg(string_version(Ssh)), send_msg(VsnMsg, State), - case getopt(recbuf, Socket) of - {ok, Size} -> - inet:setopts(Socket, [{packet, line}, {active, once}, {recbuf, ?MAX_PROTO_VERSION}]), - {next_state, hello, State#state{recbuf = Size}}; - {error, Reason} -> - {stop, {shutdown, Reason}, State} - end; + inet:setopts(Socket, [{packet, line}, {active, once}]), + {next_state, hello, State}; -hello({info_line, _Line},#state{role = client, socket = Socket} = State) -> - %% The server may send info lines before the version_exchange +hello({info_line, _Line},#state{socket = Socket} = State) -> inet:setopts(Socket, [{active, once}]), {next_state, hello, State}; -hello({info_line, _Line},#state{role = server, - socket = Socket, - transport_cb = Transport } = State) -> - %% as openssh - Transport:send(Socket, "Protocol mismatch."), - {stop, {shutdown,"Protocol mismatch in version exchange."}, State}; - hello({version_exchange, Version}, #state{ssh_params = Ssh0, - socket = Socket, - recbuf = Size} = State) -> + socket = Socket} = State) -> {NumVsn, StrVsn} = ssh_transport:handle_hello_version(Version), case handle_version(NumVsn, StrVsn, Ssh0) of {ok, Ssh1} -> - inet:setopts(Socket, [{packet,0}, {mode,binary}, {active, once}, {recbuf, Size}]), + inet:setopts(Socket, [{packet,0}, {mode,binary}, {active, once}]), {KeyInitMsg, SshPacket, Ssh} = ssh_transport:key_exchange_init_msg(Ssh1), send_msg(SshPacket, State), {next_state, kexinit, next_packet(State#state{ssh_params = Ssh, key_exchange_init_msg = KeyInitMsg})}; not_supported -> - DisconnectMsg = + DisconnectMsg = #ssh_msg_disconnect{code = - ?SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED, + ?SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED, description = "Protocol version " ++ StrVsn ++ " not supported", language = "en"}, @@ -427,91 +362,59 @@ send_msg(NewKeys, State), {next_state, new_keys, next_packet(State#state{ssh_params = Ssh})}; -key_exchange(#ssh_msg_kex_dh_gex_request{} = Msg, - #state{ssh_params = #ssh{role = server} = Ssh0} = State) -> - {ok, GexGroup, Ssh} = ssh_transport:handle_kex_dh_gex_request(Msg, Ssh0), - send_msg(GexGroup, State), - {next_state, key_exchange_dh_gex_init, next_packet(State#state{ssh_params = Ssh})}; - -key_exchange(#ssh_msg_kex_dh_gex_request_old{} = Msg, - #state{ssh_params = #ssh{role = server} = Ssh0} = State) -> - {ok, GexGroup, Ssh} = ssh_transport:handle_kex_dh_gex_request(Msg, Ssh0), - send_msg(GexGroup, State), - {next_state, key_exchange_dh_gex_init, next_packet(State#state{ssh_params = Ssh})}; - key_exchange(#ssh_msg_kex_dh_gex_group{} = Msg, - #state{ssh_params = #ssh{role = client} = Ssh0} = State) -> - {ok, KexGexInit, Ssh} = ssh_transport:handle_kex_dh_gex_group(Msg, Ssh0), - send_msg(KexGexInit, State), - {next_state, key_exchange_dh_gex_reply, next_packet(State#state{ssh_params = Ssh})}; - -key_exchange(#ssh_msg_kex_ecdh_init{} = Msg, #state{ssh_params = #ssh{role = server} = Ssh0} = State) -> - {ok, KexEcdhReply, Ssh1} = ssh_transport:handle_kex_ecdh_init(Msg, Ssh0), - send_msg(KexEcdhReply, State), + {ok, NextKexMsg, Ssh1} = ssh_transport:handle_kex_dh_gex_group(Msg, Ssh0), + send_msg(NextKexMsg, State), {ok, NewKeys, Ssh} = ssh_transport:new_keys_message(Ssh1), send_msg(NewKeys, State), {next_state, new_keys, next_packet(State#state{ssh_params = Ssh})}; -key_exchange(#ssh_msg_kex_ecdh_reply{} = Msg, +key_exchange(#ssh_msg_kex_dh_gex_request{} = Msg, #state{ssh_params = #ssh{role = client} = Ssh0} = State) -> - {ok, NewKeys, Ssh} = ssh_transport:handle_kex_ecdh_reply(Msg, Ssh0), - send_msg(NewKeys, State), - {next_state, new_keys, next_packet(State#state{ssh_params = Ssh})}. + {ok, NextKexMsg, Ssh} = ssh_transport:handle_kex_dh_gex_request(Msg, Ssh0), + send_msg(NextKexMsg, State), + {next_state, new_keys, next_packet(State#state{ssh_params = Ssh})}; -%%-------------------------------------------------------------------- --spec key_exchange_dh_gex_init(#ssh_msg_kex_dh_gex_init{}, #state{}) -> gen_fsm_state_return(). -%%-------------------------------------------------------------------- -key_exchange_dh_gex_init(#ssh_msg_kex_dh_gex_init{} = Msg, - #state{ssh_params = #ssh{role = server} = Ssh0} = State) -> - {ok, KexGexReply, Ssh1} = ssh_transport:handle_kex_dh_gex_init(Msg, Ssh0), - send_msg(KexGexReply, State), - {ok, NewKeys, Ssh} = ssh_transport:new_keys_message(Ssh1), +key_exchange(#ssh_msg_kex_dh_gex_reply{} = Msg, + #state{ssh_params = #ssh{role = client} = Ssh0} = State) -> + {ok, NewKeys, Ssh} = ssh_transport:handle_kex_dh_gex_reply(Msg, Ssh0), send_msg(NewKeys, State), {next_state, new_keys, next_packet(State#state{ssh_params = Ssh})}. %%-------------------------------------------------------------------- --spec key_exchange_dh_gex_reply(#ssh_msg_kex_dh_gex_reply{}, #state{}) -> gen_fsm_state_return(). -%%-------------------------------------------------------------------- -key_exchange_dh_gex_reply(#ssh_msg_kex_dh_gex_reply{} = Msg, - #state{ssh_params = #ssh{role = client} = Ssh0} = State) -> - {ok, NewKeys, Ssh1} = ssh_transport:handle_kex_dh_gex_reply(Msg, Ssh0), - send_msg(NewKeys, State), - {next_state, new_keys, next_packet(State#state{ssh_params = Ssh1})}. - -%%-------------------------------------------------------------------- -spec new_keys(#ssh_msg_newkeys{}, #state{}) -> gen_fsm_state_return(). %%-------------------------------------------------------------------- new_keys(#ssh_msg_newkeys{} = Msg, #state{ssh_params = Ssh0} = State0) -> {ok, Ssh} = ssh_transport:handle_new_keys(Msg, Ssh0), - after_new_keys(next_packet(State0#state{ssh_params = Ssh})). + {NextStateName, State} = + after_new_keys(State0#state{ssh_params = Ssh}), + {next_state, NextStateName, next_packet(State)}. %%-------------------------------------------------------------------- --spec service_request(#ssh_msg_service_request{} | #ssh_msg_service_accept{}, - #state{}) -> gen_fsm_state_return(). +-spec userauth(#ssh_msg_service_request{} | #ssh_msg_service_accept{} | + #ssh_msg_userauth_request{} | #ssh_msg_userauth_info_request{} | + #ssh_msg_userauth_info_response{} | #ssh_msg_userauth_success{} | + #ssh_msg_userauth_failure{} | #ssh_msg_userauth_banner{}, + #state{}) -> gen_fsm_state_return(). %%-------------------------------------------------------------------- -service_request(#ssh_msg_service_request{name = "ssh-userauth"} = Msg, + +userauth(#ssh_msg_service_request{name = "ssh-userauth"} = Msg, #state{ssh_params = #ssh{role = server, session_id = SessionId} = Ssh0} = State) -> {ok, {Reply, Ssh}} = ssh_auth:handle_userauth_request(Msg, SessionId, Ssh0), send_msg(Reply, State), {next_state, userauth, next_packet(State#state{ssh_params = Ssh})}; -service_request(#ssh_msg_service_accept{name = "ssh-userauth"}, - #state{ssh_params = #ssh{role = client, - service = "ssh-userauth"} = Ssh0} = - State) -> +userauth(#ssh_msg_service_accept{name = "ssh-userauth"}, + #state{ssh_params = #ssh{role = client, + service = "ssh-userauth"} = Ssh0} = + State) -> {Msg, Ssh} = ssh_auth:init_userauth_request_msg(Ssh0), send_msg(Msg, State), - {next_state, userauth, next_packet(State#state{auth_user = Ssh#ssh.user, ssh_params = Ssh})}. + {next_state, userauth, next_packet(State#state{auth_user = Ssh#ssh.user, ssh_params = Ssh})}; -%%-------------------------------------------------------------------- --spec userauth(#ssh_msg_userauth_request{} | #ssh_msg_userauth_info_request{} | - #ssh_msg_userauth_info_response{} | #ssh_msg_userauth_success{} | - #ssh_msg_userauth_failure{} | #ssh_msg_userauth_banner{}, - #state{}) -> gen_fsm_state_return(). -%%-------------------------------------------------------------------- userauth(#ssh_msg_userauth_request{service = "ssh-connection", method = "none"} = Msg, #state{ssh_params = #ssh{session_id = SessionId, role = server, @@ -528,28 +431,32 @@ service = "ssh-connection", peer = {_, Address}} = Ssh0, opts = Opts, starter = Pid} = State) -> - case lists:member(Method, Ssh0#ssh.userauth_methods) of - true -> - case ssh_auth:handle_userauth_request(Msg, SessionId, Ssh0) of - {authorized, User, {Reply, Ssh}} -> - send_msg(Reply, State), - Pid ! ssh_connected, - connected_fun(User, Address, Method, Opts), - {next_state, connected, - next_packet(State#state{auth_user = User, ssh_params = Ssh#ssh{authenticated = true}})}; - {not_authorized, {User, Reason}, {Reply, Ssh}} when Method == "keyboard-interactive" -> - retry_fun(User, Address, Reason, Opts), - send_msg(Reply, State), - {next_state, userauth_keyboard_interactive, next_packet(State#state{ssh_params = Ssh})}; - {not_authorized, {User, Reason}, {Reply, Ssh}} -> - retry_fun(User, Address, Reason, Opts), - send_msg(Reply, State), - {next_state, userauth, next_packet(State#state{ssh_params = Ssh})} - end; - false -> - userauth(Msg#ssh_msg_userauth_request{method="none"}, State) + case ssh_auth:handle_userauth_request(Msg, SessionId, Ssh0) of + {authorized, User, {Reply, Ssh}} -> + send_msg(Reply, State), + Pid ! ssh_connected, + connected_fun(User, Address, Method, Opts), + {next_state, connected, + next_packet(State#state{auth_user = User, ssh_params = Ssh})}; + {not_authorized, {User, Reason}, {Reply, Ssh}} -> + retry_fun(User, Address, Reason, Opts), + send_msg(Reply, State), + {next_state, userauth, next_packet(State#state{ssh_params = Ssh})} end; +userauth(#ssh_msg_userauth_info_request{} = Msg, + #state{ssh_params = #ssh{role = client, + io_cb = IoCb} = Ssh0} = State) -> + {ok, {Reply, Ssh}} = ssh_auth:handle_userauth_info_request(Msg, IoCb, Ssh0), + send_msg(Reply, State), + {next_state, userauth, next_packet(State#state{ssh_params = Ssh})}; + +userauth(#ssh_msg_userauth_info_response{} = Msg, + #state{ssh_params = #ssh{role = server} = Ssh0} = State) -> + {ok, {Reply, Ssh}} = ssh_auth:handle_userauth_info_response(Msg, Ssh0), + send_msg(Reply, State), + {next_state, userauth, next_packet(State#state{ssh_params = Ssh})}; + userauth(#ssh_msg_userauth_success{}, #state{ssh_params = #ssh{role = client} = Ssh, starter = Pid} = State) -> Pid ! ssh_connected, @@ -576,25 +483,19 @@ {disconnect, DisconnectMsg, {Msg, Ssh}} -> send_msg(Msg, State), handle_disconnect(DisconnectMsg, State#state{ssh_params = Ssh}); - {"keyboard-interactive", {Msg, Ssh}} -> - send_msg(Msg, State), - {next_state, userauth_keyboard_interactive, next_packet(State#state{ssh_params = Ssh})}; - {_Method, {Msg, Ssh}} -> + {Msg, Ssh} -> send_msg(Msg, State), {next_state, userauth, next_packet(State#state{ssh_params = Ssh})} end; %% The prefered authentication method failed try next method -userauth(#ssh_msg_userauth_failure{}, +userauth(#ssh_msg_userauth_failure{}, #state{ssh_params = #ssh{role = client} = Ssh0} = State) -> case ssh_auth:userauth_request_msg(Ssh0) of {disconnect, DisconnectMsg,{Msg, Ssh}} -> send_msg(Msg, State), handle_disconnect(DisconnectMsg, State#state{ssh_params = Ssh}); - {"keyboard-interactive", {Msg, Ssh}} -> - send_msg(Msg, State), - {next_state, userauth_keyboard_interactive, next_packet(State#state{ssh_params = Ssh})}; - {_Method, {Msg, Ssh}} -> + {Msg, Ssh} -> send_msg(Msg, State), {next_state, userauth, next_packet(State#state{ssh_params = Ssh})} end; @@ -609,61 +510,15 @@ io:format("~s", [Msg]), {next_state, userauth, next_packet(State)}. - - -userauth_keyboard_interactive(#ssh_msg_userauth_info_request{} = Msg, - #state{ssh_params = #ssh{role = client, - io_cb = IoCb} = Ssh0} = State) -> - {ok, {Reply, Ssh}} = ssh_auth:handle_userauth_info_request(Msg, IoCb, Ssh0), - send_msg(Reply, State), - {next_state, userauth_keyboard_interactive_info_response, next_packet(State#state{ssh_params = Ssh})}; - -userauth_keyboard_interactive(#ssh_msg_userauth_info_response{} = Msg, - #state{ssh_params = #ssh{role = server, - peer = {_, Address}} = Ssh0, - opts = Opts, starter = Pid} = State) -> - case ssh_auth:handle_userauth_info_response(Msg, Ssh0) of - {authorized, User, {Reply, Ssh}} -> - send_msg(Reply, State), - Pid ! ssh_connected, - connected_fun(User, Address, "keyboard-interactive", Opts), - {next_state, connected, - next_packet(State#state{auth_user = User, ssh_params = Ssh#ssh{authenticated = true}})}; - {not_authorized, {User, Reason}, {Reply, Ssh}} -> - retry_fun(User, Address, Reason, Opts), - send_msg(Reply, State), - {next_state, userauth, next_packet(State#state{ssh_params = Ssh})} - end; -userauth_keyboard_interactive(Msg = #ssh_msg_userauth_failure{}, - #state{ssh_params = Ssh0 = - #ssh{role = client, - userauth_preference = Prefs0}} - = State) -> - Prefs = [{Method,M,F,A} || {Method,M,F,A} <- Prefs0, - Method =/= "keyboard-interactive"], - userauth(Msg, State#state{ssh_params = Ssh0#ssh{userauth_preference=Prefs}}). - - - -userauth_keyboard_interactive_info_response(Msg=#ssh_msg_userauth_failure{}, - #state{ssh_params = #ssh{role = client}} = State) -> - userauth(Msg, State); - -userauth_keyboard_interactive_info_response(Msg=#ssh_msg_userauth_success{}, - #state{ssh_params = #ssh{role = client}} = State) -> - userauth(Msg, State). - %%-------------------------------------------------------------------- -spec connected({#ssh_msg_kexinit{}, binary()}, %%| %% #ssh_msg_kexdh_init{}, #state{}) -> gen_fsm_state_return(). %%-------------------------------------------------------------------- -connected({#ssh_msg_kexinit{}, _Payload} = Event, #state{ssh_params = Ssh0} = State0) -> - {KeyInitMsg, SshPacket, Ssh} = ssh_transport:key_exchange_init_msg(Ssh0), - State = State0#state{ssh_params = Ssh, - key_exchange_init_msg = KeyInitMsg, - renegotiate = true}, - send_msg(SshPacket, State), - kexinit(Event, State). +connected({#ssh_msg_kexinit{}, _Payload} = Event, State) -> + kexinit(Event, State#state{renegotiate = true}). +%% ; +%% connected(#ssh_msg_kexdh_init{} = Event, State) -> +%% key_exchange(Event, State#state{renegotiate = true}). %%-------------------------------------------------------------------- -spec handle_event(#ssh_msg_disconnect{} | #ssh_msg_ignore{} | #ssh_msg_debug{} | @@ -675,23 +530,50 @@ %%-------------------------------------------------------------------- handle_event(#ssh_msg_disconnect{description = Desc} = DisconnectMsg, _StateName, #state{} = State) -> - handle_disconnect(peer, DisconnectMsg, State), + handle_disconnect(DisconnectMsg, State), {stop, {shutdown, Desc}, State}; handle_event(#ssh_msg_ignore{}, StateName, State) -> {next_state, StateName, next_packet(State)}; -handle_event(#ssh_msg_debug{always_display = Display, message = DbgMsg, language=Lang}, - StateName, #state{opts = Opts} = State) -> - F = proplists:get_value(ssh_msg_debug_fun, Opts, - fun(_ConnRef, _AlwaysDisplay, _Msg, _Language) -> ok end - ), - catch F(self(), Display, DbgMsg, Lang), +handle_event(#ssh_msg_debug{always_display = true, message = DbgMsg}, + StateName, State) -> + io:format("DEBUG: ~p\n", [DbgMsg]), + {next_state, StateName, next_packet(State)}; + +handle_event(#ssh_msg_debug{}, StateName, State) -> {next_state, StateName, next_packet(State)}; handle_event(#ssh_msg_unimplemented{}, StateName, State) -> {next_state, StateName, next_packet(State)}; +handle_event({adjust_window, ChannelId, Bytes}, StateName, + #state{connection_state = + #connection{channel_cache = Cache}} = State0) -> + State = + case ssh_channel:cache_lookup(Cache, ChannelId) of + #channel{recv_window_size = WinSize, remote_id = Id} = Channel -> + ssh_channel:cache_update(Cache, Channel#channel{recv_window_size = + WinSize + Bytes}), + Msg = ssh_connection:channel_adjust_window_msg(Id, Bytes), + send_replies([{connection_reply, Msg}], State0); + undefined -> + State0 + end, + {next_state, StateName, next_packet(State)}; + +handle_event({reply_request, success, ChannelId}, StateName, + #state{connection_state = + #connection{channel_cache = Cache}} = State0) -> + State = case ssh_channel:cache_lookup(Cache, ChannelId) of + #channel{remote_id = RemoteId} -> + Msg = ssh_connection:channel_success_msg(RemoteId), + send_replies([{connection_reply, Msg}], State0); + undefined -> + State0 + end, + {next_state, StateName, State}; + handle_event(renegotiate, connected, #state{ssh_params = Ssh0} = State) -> {KeyInitMsg, SshPacket, Ssh} = ssh_transport:key_exchange_init_msg(Ssh0), @@ -703,13 +585,13 @@ renegotiate = true})}; handle_event(renegotiate, StateName, State) -> - %% Already in key-exchange so safe to ignore + timer:apply_after(?REKEY_TIMOUT, gen_fsm, send_all_state_event, [self(), renegotiatie]), + %% Allready in keyexcahange so ignore {next_state, StateName, State}; %% Rekey due to sent data limit reached? handle_event(data_size, connected, #state{ssh_params = Ssh0} = State) -> - {ok, [{send_oct,Sent0}]} = inet:getstat(State#state.socket, [send_oct]), - Sent = Sent0 - State#state.last_size_rekey, + {ok, [{send_oct,Sent}]} = inet:getstat(State#state.socket, [send_oct]), MaxSent = proplists:get_value(rekey_limit, State#state.opts, 1024000000), timer:apply_after(?REKEY_DATA_TIMOUT, gen_fsm, send_all_state_event, [self(), data_size]), case Sent >= MaxSent of @@ -719,59 +601,11 @@ {next_state, kexinit, next_packet(State#state{ssh_params = Ssh, key_exchange_init_msg = KeyInitMsg, - renegotiate = true, - last_size_rekey = Sent0})}; + renegotiate = true})}; _ -> {next_state, connected, next_packet(State)} end; handle_event(data_size, StateName, State) -> - %% Already in key-exchange so safe to ignore - {next_state, StateName, State}; - -handle_event(Event, StateName, State) when StateName /= connected -> - Events = [{event, Event} | State#state.event_queue], - {next_state, StateName, State#state{event_queue = Events}}; - -handle_event({adjust_window, ChannelId, Bytes}, StateName, - #state{connection_state = - #connection{channel_cache = Cache}} = State0) -> - State = - case ssh_channel:cache_lookup(Cache, ChannelId) of - #channel{recv_window_size = WinSize, - recv_window_pending = Pending, - recv_packet_size = PktSize} = Channel - when (WinSize-Bytes) >= 2*PktSize -> - %% The peer can send at least two more *full* packet, no hurry. - ssh_channel:cache_update(Cache, - Channel#channel{recv_window_pending = Pending + Bytes}), - State0; - - #channel{recv_window_size = WinSize, - recv_window_pending = Pending, - remote_id = Id} = Channel -> - %% Now we have to update the window - we can't receive so many more pkts - ssh_channel:cache_update(Cache, - Channel#channel{recv_window_size = - WinSize + Bytes + Pending, - recv_window_pending = 0}), - Msg = ssh_connection:channel_adjust_window_msg(Id, Bytes + Pending), - send_replies([{connection_reply, Msg}], State0); - - undefined -> - State0 - end, - {next_state, StateName, next_packet(State)}; - -handle_event({reply_request, success, ChannelId}, StateName, - #state{connection_state = - #connection{channel_cache = Cache}} = State0) -> - State = case ssh_channel:cache_lookup(Cache, ChannelId) of - #channel{remote_id = RemoteId} -> - Msg = ssh_connection:channel_success_msg(RemoteId), - send_replies([{connection_reply, Msg}], State0); - undefined -> - State0 - end, {next_state, StateName, State}; handle_event({request, ChannelPid, ChannelId, Type, Data}, StateName, State0) -> @@ -802,62 +636,8 @@ sockname]} | {channel_info, channel_id(), [recv_window | send_window]} | {close, channel_id()} | stop, term(), state_name(), #state{}) - -> gen_fsm_sync_return(). + -> gen_fsm_state_return(). %%-------------------------------------------------------------------- -handle_sync_event(get_print_info, _From, StateName, State) -> - Reply = - try - {inet:sockname(State#state.socket), - inet:peername(State#state.socket) - } - of - {{ok,Local}, {ok,Remote}} -> {{Local,Remote},io_lib:format("statename=~p",[StateName])}; - _ -> {{"-",0},"-"} - catch - _:_ -> {{"?",0},"?"} - end, - {reply, Reply, StateName, State}; - -handle_sync_event({connection_info, Options}, _From, StateName, State) -> - Info = ssh_info(Options, State, []), - {reply, Info, StateName, State}; - -handle_sync_event({channel_info, ChannelId, Options}, _From, StateName, - #state{connection_state = #connection{channel_cache = Cache}} = State) -> - case ssh_channel:cache_lookup(Cache, ChannelId) of - #channel{} = Channel -> - Info = ssh_channel_info(Options, Channel, []), - {reply, Info, StateName, State}; - undefined -> - {reply, [], StateName, State} - end; - -handle_sync_event({info, ChannelPid}, _From, StateName, - #state{connection_state = - #connection{channel_cache = Cache}} = State) -> - Result = ssh_channel:cache_foldl( - fun(Channel, Acc) when ChannelPid == all; - Channel#channel.user == ChannelPid -> - [Channel | Acc]; - (_, Acc) -> - Acc - end, [], Cache), - {reply, {ok, Result}, StateName, State}; - -handle_sync_event(stop, _, _StateName, #state{connection_state = Connection0, - role = Role} = State0) -> - {disconnect, _Reason, {{replies, Replies}, Connection}} = - ssh_connection:handle_msg(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION, - description = "User closed down connection", - language = "en"}, Connection0, Role), - State = send_replies(Replies, State0), - {stop, normal, ok, State#state{connection_state = Connection}}; - - -handle_sync_event(Event, From, StateName, State) when StateName /= connected -> - Events = [{sync, Event, From} | State#state.event_queue], - {next_state, StateName, State#state{event_queue = Events}}; - handle_sync_event({request, ChannelPid, ChannelId, Type, Data, Timeout}, From, StateName, State0) -> {{replies, Replies}, State1} = handle_request(ChannelPid, ChannelId, Type, Data, @@ -927,9 +707,7 @@ user = ChannelPid, local_id = ChannelId, recv_window_size = InitialWindowSize, - recv_packet_size = MaxPacketSize, - send_buf = queue:new() - }, + recv_packet_size = MaxPacketSize}, ssh_channel:cache_update(Cache, Channel), State = add_request(true, ChannelId, From, State2), start_timeout(ChannelId, From, Timeout), @@ -960,6 +738,32 @@ end, {reply, Reply, StateName, next_packet(State)}; +handle_sync_event({connection_info, Options}, _From, StateName, State) -> + Info = ssh_info(Options, State, []), + {reply, Info, StateName, State}; + +handle_sync_event({channel_info, ChannelId, Options}, _From, StateName, + #state{connection_state = #connection{channel_cache = Cache}} = State) -> + case ssh_channel:cache_lookup(Cache, ChannelId) of + #channel{} = Channel -> + Info = ssh_channel_info(Options, Channel, []), + {reply, Info, StateName, State}; + undefined -> + {reply, [], StateName, State} + end; + +handle_sync_event({info, ChannelPid}, _From, StateName, + #state{connection_state = + #connection{channel_cache = Cache}} = State) -> + Result = ssh_channel:cache_foldl( + fun(Channel, Acc) when ChannelPid == all; + Channel#channel.user == ChannelPid -> + [Channel | Acc]; + (_, Acc) -> + Acc + end, [], Cache), + {reply, {ok, Result}, StateName, State}; + handle_sync_event({close, ChannelId}, _, StateName, #state{connection_state = #connection{channel_cache = Cache}} = State0) -> @@ -974,7 +778,19 @@ undefined -> State0 end, - {reply, ok, StateName, next_packet(State)}. + {reply, ok, StateName, next_packet(State)}; + +handle_sync_event(stop, _, _StateName, #state{connection_state = Connection0, + role = Role, + opts = Opts} = State0) -> + {disconnect, Reason, {{replies, Replies}, Connection}} = + ssh_connection:handle_msg(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION, + description = "User closed down connection", + language = "en"}, Connection0, Role), + State = send_replies(Replies, State0), + SSHOpts = proplists:get_value(ssh_opts, Opts), + disconnect_fun(Reason, SSHOpts), + {stop, normal, ok, State#state{connection_state = Connection}}. %%-------------------------------------------------------------------- -spec handle_info({atom(), port(), binary()} | {atom(), port()} | @@ -991,55 +807,57 @@ transport_protocol = Protocol} = State) -> event({info_line, Info}, hello, State); -handle_info({Protocol, Socket, Data}, StateName, +handle_info({Protocol, Socket, Data}, Statename, #state{socket = Socket, transport_protocol = Protocol, - ssh_params = Ssh0, - decoded_data_buffer = DecData0, - encoded_data_buffer = EncData0, - undecoded_packet_length = RemainingSshPacketLen0} = State0) -> - Encoded = <>, - try ssh_transport:handle_packet_part(DecData0, Encoded, RemainingSshPacketLen0, Ssh0) - of - {get_more, DecBytes, EncDataRest, RemainingSshPacketLen, Ssh1} -> - {next_state, StateName, - next_packet(State0#state{encoded_data_buffer = EncDataRest, - decoded_data_buffer = DecBytes, - undecoded_packet_length = RemainingSshPacketLen, - ssh_params = Ssh1})}; - {decoded, MsgBytes, EncDataRest, Ssh1} -> - generate_event(MsgBytes, StateName, - State0#state{ssh_params = Ssh1, - %% Important to be set for - %% next_packet -%%% FIXME: the following three seem to always be set in generate_event! - decoded_data_buffer = <<>>, - undecoded_packet_length = undefined, - encoded_data_buffer = EncDataRest}, - EncDataRest); - {bad_mac, Ssh1} -> - DisconnectMsg = - #ssh_msg_disconnect{code = ?SSH_DISCONNECT_PROTOCOL_ERROR, - description = "Bad mac", - language = ""}, - handle_disconnect(DisconnectMsg, State0#state{ssh_params=Ssh1}); + ssh_params = #ssh{decrypt_block_size = BlockSize, + recv_mac_size = MacSize} = Ssh0, + decoded_data_buffer = <<>>, + encoded_data_buffer = EncData0} = State0) -> + + %% Implementations SHOULD decrypt the length after receiving the + %% first 8 (or cipher block size, whichever is larger) bytes of a + %% packet. (RFC 4253: Section 6 - Binary Packet Protocol) + case size(EncData0) + size(Data) >= erlang:max(8, BlockSize) of + true -> + {Ssh, SshPacketLen, DecData, EncData} = - {error, {exceeds_max_size,PacketLen}} -> - DisconnectMsg = - #ssh_msg_disconnect{code = ?SSH_DISCONNECT_PROTOCOL_ERROR, - description = "Bad packet length " - ++ integer_to_list(PacketLen), - language = ""}, - handle_disconnect(DisconnectMsg, State0) - catch - _:_ -> - DisconnectMsg = - #ssh_msg_disconnect{code = ?SSH_DISCONNECT_PROTOCOL_ERROR, - description = "Bad packet", - language = ""}, - handle_disconnect(DisconnectMsg, State0) + ssh_transport:decrypt_first_block(<>, Ssh0), + case SshPacketLen > ?SSH_MAX_PACKET_SIZE of + true -> + DisconnectMsg = + #ssh_msg_disconnect{code = + ?SSH_DISCONNECT_PROTOCOL_ERROR, + description = "Bad packet length " + ++ integer_to_list(SshPacketLen), + language = "en"}, + handle_disconnect(DisconnectMsg, State0); + false -> + RemainingSshPacketLen = + (SshPacketLen + ?SSH_LENGHT_INDICATOR_SIZE) - + BlockSize + MacSize, + State = State0#state{ssh_params = Ssh}, + handle_ssh_packet_data(RemainingSshPacketLen, + DecData, EncData, Statename, + State) + end; + false -> + {next_state, Statename, + next_packet(State0#state{encoded_data_buffer = + <>})} end; - + +handle_info({Protocol, Socket, Data}, Statename, + #state{socket = Socket, + transport_protocol = Protocol, + decoded_data_buffer = DecData, + encoded_data_buffer = EncData, + undecoded_packet_length = Len} = + State) when is_integer(Len) -> + handle_ssh_packet_data(Len, DecData, <>, + Statename, State); + handle_info({CloseTag, _Socket}, _StateName, #state{transport_close_tag = CloseTag, ssh_params = #ssh{role = _Role, opts = _Opts}} = State) -> @@ -1077,38 +895,15 @@ #connection{channel_cache = Cache}} = State) -> {next_state, StateName, check_cache(State, Cache)}; -handle_info(UnexpectedMessage, StateName, #state{opts = Opts, - ssh_params = SshParams} = State) -> - case unexpected_fun(UnexpectedMessage, Opts, SshParams) of - report -> - Msg = lists:flatten( - io_lib:format( - "Unexpected message '~p' received in state '~p'\n" - "Role: ~p\n" - "Peer: ~p\n" - "Local Address: ~p\n", [UnexpectedMessage, StateName, - SshParams#ssh.role, SshParams#ssh.peer, - proplists:get_value(address, SshParams#ssh.opts)])), - error_logger:info_report(Msg); - - skip -> - ok; - - Other -> - Msg = lists:flatten( - io_lib:format("Call to fun in 'unexpectedfun' failed:~n" - "Return: ~p\n" - "Message: ~p\n" - "Role: ~p\n" - "Peer: ~p\n" - "Local Address: ~p\n", [Other, UnexpectedMessage, - SshParams#ssh.role, - element(2,SshParams#ssh.peer), - proplists:get_value(address, SshParams#ssh.opts)] - )), - - error_logger:error_report(Msg) - end, +handle_info(UnexpectedMessage, StateName, #state{ssh_params = SshParams} = State) -> + Msg = lists:flatten(io_lib:format( + "Unexpected message '~p' received in state '~p'\n" + "Role: ~p\n" + "Peer: ~p\n" + "Local Address: ~p\n", [UnexpectedMessage, StateName, + SshParams#ssh.role, SshParams#ssh.peer, + proplists:get_value(address, SshParams#ssh.opts)])), + error_logger:info_report(Msg), {next_state, StateName, State}. %%-------------------------------------------------------------------- @@ -1117,14 +912,10 @@ terminate(normal, _, #state{transport_cb = Transport, connection_state = Connection, socket = Socket}) -> - terminate_subsystem(Connection), + terminate_subsytem(Connection), (catch Transport:close(Socket)), ok; -terminate({shutdown,{init,Reason}}, StateName, State) -> - error_logger:info_report(io_lib:format("Erlang ssh in connection handler init: ~p~n",[Reason])), - terminate(normal, StateName, State); - %% Terminated by supervisor terminate(shutdown, StateName, #state{ssh_params = Ssh0} = State) -> DisconnectMsg = @@ -1140,13 +931,11 @@ {SshPacket, Ssh} = ssh_transport:ssh_packet(Msg, Ssh0), send_msg(SshPacket, State), terminate(normal, StateName, State#state{ssh_params = Ssh}); - terminate({shutdown, _}, StateName, State) -> terminate(normal, StateName, State); - terminate(Reason, StateName, #state{ssh_params = Ssh0, starter = _Pid, connection_state = Connection} = State) -> - terminate_subsystem(Connection), + terminate_subsytem(Connection), log_error(Reason), DisconnectMsg = #ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION, @@ -1156,43 +945,12 @@ send_msg(SshPacket, State), terminate(normal, StateName, State#state{ssh_params = Ssh}). - -terminate_subsystem(#connection{system_supervisor = SysSup, +terminate_subsytem(#connection{system_supervisor = SysSup, sub_system_supervisor = SubSysSup}) when is_pid(SubSysSup) -> ssh_system_sup:stop_subsystem(SysSup, SubSysSup); -terminate_subsystem(_) -> +terminate_subsytem(_) -> ok. -format_status(normal, [_, State]) -> - [{data, [{"StateData", State}]}]; -format_status(terminate, [_, State]) -> - SshParams0 = (State#state.ssh_params), - SshParams = SshParams0#ssh{c_keyinit = "***", - s_keyinit = "***", - send_mac_key = "***", - send_mac_size = "***", - recv_mac_key = "***", - recv_mac_size = "***", - encrypt_keys = "***", - encrypt_ctx = "***", - decrypt_keys = "***", - decrypt_ctx = "***", - compress_ctx = "***", - decompress_ctx = "***", - shared_secret = "***", - exchanged_hash = "***", - session_id = "***", - keyex_key = "***", - keyex_info = "***", - available_host_keys = "***"}, - [{data, [{"StateData", State#state{decoded_data_buffer = "***", - encoded_data_buffer = "***", - key_exchange_init_msg = "***", - opts = "***", - recbuf = "***", - ssh_params = SshParams - }}]}]. - %%-------------------------------------------------------------------- -spec code_change(OldVsn::term(), state_name(), Oldstate::term(), Extra::term()) -> {ok, state_name(), #state{}}. @@ -1260,16 +1018,13 @@ opts = Options, userauth_supported_methods = AuthMethods, peer = {PeerName, PeerAddr}, - available_host_keys = supported_host_keys(Role, KeyCb, Options), - random_length_padding = proplists:get_value(max_random_length_padding, - Options, - (#ssh{})#ssh.random_length_padding) + available_host_keys = supported_host_keys(Role, KeyCb, Options) }; init_ssh(server = Role, Vsn, Version, Options, Socket) -> + AuthMethods = proplists:get_value(auth_methods, Options, ?SUPPORTED_AUTH_METHODS), - AuthMethodsAsList = string:tokens(AuthMethods, ","), {ok, PeerAddr} = inet:peername(Socket), KeyCb = proplists:get_value(key_cb, Options, ssh_file), @@ -1280,45 +1035,60 @@ io_cb = proplists:get_value(io_cb, Options, ssh_io), opts = Options, userauth_supported_methods = AuthMethods, - userauth_methods = AuthMethodsAsList, - kb_tries_left = 3, peer = {undefined, PeerAddr}, - available_host_keys = supported_host_keys(Role, KeyCb, Options), - random_length_padding = proplists:get_value(max_random_length_padding, - Options, - (#ssh{})#ssh.random_length_padding) + available_host_keys = supported_host_keys(Role, KeyCb, Options) }. supported_host_keys(client, _, Options) -> try - case proplists:get_value(public_key, - proplists:get_value(preferred_algorithms,Options,[]) - ) of - undefined -> - ssh_transport:default_algorithms(public_key); - L -> - L -- (L--ssh_transport:default_algorithms(public_key)) + case extract_algs(proplists:get_value(pref_public_key_algs, Options, false), []) of + false -> + ["ssh-rsa", "ssh-dss"]; + Algs -> + Algs end - of - [] -> - {stop, {shutdown, "No public key algs"}}; - Algs -> - [atom_to_list(A) || A<-Algs] catch exit:Reason -> {stop, {shutdown, Reason}} end; supported_host_keys(server, KeyCb, Options) -> - [atom_to_list(A) || A <- proplists:get_value(public_key, - proplists:get_value(preferred_algorithms,Options,[]), - ssh_transport:default_algorithms(public_key) - ), - available_host_key(KeyCb, A, Options) - ]. - -%% Alg :: atom() -available_host_key(KeyCb, Alg, Opts) -> - element(1, catch KeyCb:host_key(Alg, Opts)) == ok. + lists:foldl(fun(Type, Acc) -> + case available_host_key(KeyCb, Type, Options) of + {error, _} -> + Acc; + Alg -> + [Alg | Acc] + end + end, [], + %% Prefered alg last so no need to reverse + ["ssh-dss", "ssh-rsa"]). +extract_algs(false, _) -> + false; +extract_algs([],[]) -> + false; +extract_algs([], NewList) -> + lists:reverse(NewList); +extract_algs([H|T], NewList) -> + case H of + 'ssh-dss' -> + extract_algs(T, ["ssh-dss"|NewList]); + 'ssh-rsa' -> + extract_algs(T, ["ssh-rsa"|NewList]) + end. +available_host_key(KeyCb, "ssh-dss"= Alg, Opts) -> + case KeyCb:host_key('ssh-dss', Opts) of + {ok, _} -> + Alg; + Other -> + Other + end; +available_host_key(KeyCb, "ssh-rsa" = Alg, Opts) -> + case KeyCb:host_key('ssh-rsa', Opts) of + {ok, _} -> + Alg; + Other -> + Other + end. send_msg(Msg, #state{socket = Socket, transport_cb = Transport}) -> Transport:send(Socket, Msg). @@ -1341,14 +1111,7 @@ gen_fsm:send_all_state_event(FsmPid, Event). sync_send_all_state_event(FsmPid, Event) -> - sync_send_all_state_event(FsmPid, Event, infinity). - -sync_send_all_state_event(FsmPid, Event, Timeout) -> - try gen_fsm:sync_send_all_state_event(FsmPid, Event, Timeout) of - {closed, _Channel} -> - {error, closed}; - Result -> - Result + try gen_fsm:sync_send_all_state_event(FsmPid, Event, infinity) catch exit:{noproc, _} -> {error, closed}; @@ -1376,9 +1139,10 @@ handle_disconnect(DisconnectMsg, State); throw:{ErrorToDisplay, #ssh_msg_disconnect{} = DisconnectMsg} -> handle_disconnect(DisconnectMsg, State, ErrorToDisplay); - _C:_Error -> + _:Error -> + log_error(Error), handle_disconnect(#ssh_msg_disconnect{code = error_code(StateName), - description = "Invalid state", + description = "Internal error", language = "en"}, State) end. error_code(key_exchange) -> @@ -1392,6 +1156,7 @@ #state{ role = Role, starter = User, + opts = Opts, renegotiate = Renegotiation, connection_state = Connection0} = State0, EncData) when Byte == ?SSH_MSG_GLOBAL_REQUEST; @@ -1408,94 +1173,48 @@ Byte == ?SSH_MSG_CHANNEL_REQUEST; Byte == ?SSH_MSG_CHANNEL_SUCCESS; Byte == ?SSH_MSG_CHANNEL_FAILURE -> - try - ssh_message:decode(Msg) - of - ConnectionMsg -> - State1 = generate_event_new_state(State0, EncData), - try ssh_connection:handle_msg(ConnectionMsg, Connection0, Role) of - {{replies, Replies0}, Connection} -> - if StateName == connected -> - Replies = Replies0, - State2 = State1; - true -> - {ConnReplies, Replies} = - lists:splitwith(fun not_connected_filter/1, Replies0), - Q = State1#state.event_queue ++ ConnReplies, - State2 = State1#state{ event_queue = Q } - end, - State = send_replies(Replies, State2#state{connection_state = Connection}), - {next_state, StateName, next_packet(State)}; - {noreply, Connection} -> - {next_state, StateName, next_packet(State1#state{connection_state = Connection})}; - {disconnect, {_, Reason}, {{replies, Replies}, Connection}} when - Role == client andalso ((StateName =/= connected) and (not Renegotiation)) -> - State = send_replies(Replies, State1#state{connection_state = Connection}), - User ! {self(), not_connected, Reason}, - {stop, {shutdown, normal}, - next_packet(State#state{connection_state = Connection})}; - {disconnect, _Reason, {{replies, Replies}, Connection}} -> - State = send_replies(Replies, State1#state{connection_state = Connection}), - {stop, {shutdown, normal}, State#state{connection_state = Connection}} - catch - _:Error -> - {disconnect, _Reason, {{replies, Replies}, Connection}} = - ssh_connection:handle_msg( - #ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION, - description = "Internal error", - language = "en"}, Connection0, Role), - State = send_replies(Replies, State1#state{connection_state = Connection}), - {stop, {shutdown, Error}, State#state{connection_state = Connection}} - end - + ConnectionMsg = ssh_message:decode(Msg), + State1 = generate_event_new_state(State0, EncData), + try ssh_connection:handle_msg(ConnectionMsg, Connection0, Role) of + {{replies, Replies}, Connection} -> + State = send_replies(Replies, State1#state{connection_state = Connection}), + {next_state, StateName, next_packet(State)}; + {noreply, Connection} -> + {next_state, StateName, next_packet(State1#state{connection_state = Connection})}; + {disconnect, {_, Reason}, {{replies, Replies}, Connection}} when + Role == client andalso ((StateName =/= connected) and (not Renegotiation)) -> + State = send_replies(Replies, State1#state{connection_state = Connection}), + User ! {self(), not_connected, Reason}, + {stop, {shutdown, normal}, + next_packet(State#state{connection_state = Connection})}; + {disconnect, Reason, {{replies, Replies}, Connection}} -> + State = send_replies(Replies, State1#state{connection_state = Connection}), + SSHOpts = proplists:get_value(ssh_opts, Opts), + disconnect_fun(Reason, SSHOpts), + {stop, {shutdown, normal}, State#state{connection_state = Connection}} catch - _:_ -> - handle_disconnect( - #ssh_msg_disconnect{code = ?SSH_DISCONNECT_PROTOCOL_ERROR, - description = "Bad packet received", - language = ""}, State0) + _:Error -> + {disconnect, Reason, {{replies, Replies}, Connection}} = + ssh_connection:handle_msg( + #ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION, + description = "Internal error", + language = "en"}, Connection0, Role), + State = send_replies(Replies, State1#state{connection_state = Connection}), + SSHOpts = proplists:get_value(ssh_opts, Opts), + disconnect_fun(Reason, SSHOpts), + {stop, {shutdown, Error}, State#state{connection_state = Connection}} end; generate_event(Msg, StateName, State0, EncData) -> - try - Event = ssh_message:decode(set_prefix_if_trouble(Msg,State0)), - State = generate_event_new_state(State0, EncData), - case Event of - #ssh_msg_kexinit{} -> - %% We need payload for verification later. - event({Event, Msg}, StateName, State); - _ -> - event(Event, StateName, State) - end - catch - _C:_E -> - DisconnectMsg = - #ssh_msg_disconnect{code = ?SSH_DISCONNECT_PROTOCOL_ERROR, - description = "Encountered unexpected input", - language = "en"}, - handle_disconnect(DisconnectMsg, State0) - end. - - -set_prefix_if_trouble(Msg = <>, #state{ssh_params=SshParams}) - when Op == 30; - Op == 31 - -> - case catch atom_to_list(kex(SshParams)) of - "ecdh-sha2-" ++ _ -> - <<"ecdh",Msg/binary>>; - "diffie-hellman-group-exchange-" ++ _ -> - <<"dh_gex",Msg/binary>>; - "diffie-hellman-group" ++ _ -> - <<"dh",Msg/binary>>; - _ -> - Msg - end; -set_prefix_if_trouble(Msg, _) -> - Msg. - -kex(#ssh{algorithms=#alg{kex=Kex}}) -> Kex; -kex(_) -> undefined. + Event = ssh_message:decode(Msg), + State = generate_event_new_state(State0, EncData), + case Event of + #ssh_msg_kexinit{} -> + %% We need payload for verification later. + event({Event, Msg}, StateName, State); + _ -> + event(Event, StateName, State) + end. handle_request(ChannelPid, ChannelId, Type, Data, WantReply, From, @@ -1591,7 +1310,6 @@ = State) -> {Id, State#state{connection_state = Connection#connection{channel_id_seed = Id + 1}}}. - generate_event_new_state(#state{ssh_params = #ssh{recv_sequence = SeqNum0} = Ssh} = State, EncData) -> @@ -1622,68 +1340,69 @@ State. after_new_keys(#state{renegotiate = true} = State) -> - State1 = State#state{renegotiate = false, event_queue = []}, - lists:foldr(fun after_new_keys_events/2, {next_state, connected, State1}, State#state.event_queue); + {connected, State#state{renegotiate = false}}; after_new_keys(#state{renegotiate = false, ssh_params = #ssh{role = client} = Ssh0} = State) -> {Msg, Ssh} = ssh_auth:service_request_msg(Ssh0), send_msg(Msg, State), - {next_state, service_request, State#state{ssh_params = Ssh}}; + {userauth, State#state{ssh_params = Ssh}}; after_new_keys(#state{renegotiate = false, ssh_params = #ssh{role = server}} = State) -> - {next_state, service_request, State}. - -after_new_keys_events({sync, _Event, From}, {stop, _Reason, _StateData}=Terminator) -> - gen_fsm:reply(From, {error, closed}), - Terminator; -after_new_keys_events(_, {stop, _Reason, _StateData}=Terminator) -> - Terminator; -after_new_keys_events({sync, Event, From}, {next_state, StateName, StateData}) -> - case handle_sync_event(Event, From, StateName, StateData) of - {reply, Reply, NextStateName, NewStateData} -> - gen_fsm:reply(From, Reply), - {next_state, NextStateName, NewStateData}; - {next_state, NextStateName, NewStateData}-> - {next_state, NextStateName, NewStateData}; - {stop, Reason, Reply, NewStateData} -> - gen_fsm:reply(From, Reply), - {stop, Reason, NewStateData} - end; -after_new_keys_events({event, Event}, {next_state, StateName, StateData}) -> - case handle_event(Event, StateName, StateData) of - {next_state, NextStateName, NewStateData}-> - {next_state, NextStateName, NewStateData}; - {stop, Reason, NewStateData} -> - {stop, Reason, NewStateData} - end; -after_new_keys_events({connection_reply, _Data} = Reply, {StateName, State}) -> - NewState = send_replies([Reply], State), - {next_state, StateName, NewState}. + {userauth, State}. +handle_ssh_packet_data(RemainingSshPacketLen, DecData, EncData, StateName, + State) -> + EncSize = size(EncData), + case RemainingSshPacketLen > EncSize of + true -> + {next_state, StateName, + next_packet(State#state{decoded_data_buffer = DecData, + encoded_data_buffer = EncData, + undecoded_packet_length = + RemainingSshPacketLen})}; + false -> + handle_ssh_packet(RemainingSshPacketLen, StateName, + State#state{decoded_data_buffer = DecData, + encoded_data_buffer = EncData}) + + end. -handle_disconnect(DisconnectMsg, State) -> - handle_disconnect(own, DisconnectMsg, State). +handle_ssh_packet(Length, StateName, #state{decoded_data_buffer = DecData0, + encoded_data_buffer = EncData0, + ssh_params = Ssh0, + transport_protocol = _Protocol, + socket = _Socket} = State0) -> + {Ssh1, DecData, EncData, Mac} = + ssh_transport:unpack(EncData0, Length, Ssh0), + SshPacket = <>, + case ssh_transport:is_valid_mac(Mac, SshPacket, Ssh1) of + true -> + PacketData = ssh_transport:msg_data(SshPacket), + {Ssh1, Msg} = ssh_transport:decompress(Ssh1, PacketData), + generate_event(Msg, StateName, + State0#state{ssh_params = Ssh1, + %% Important to be set for + %% next_packet + decoded_data_buffer = <<>>}, EncData); + false -> + DisconnectMsg = + #ssh_msg_disconnect{code = ?SSH_DISCONNECT_PROTOCOL_ERROR, + description = "Bad mac", + language = "en"}, + handle_disconnect(DisconnectMsg, State0) + end. -handle_disconnect(#ssh_msg_disconnect{} = DisconnectMsg, State, Error) -> - handle_disconnect(own, DisconnectMsg, State, Error); -handle_disconnect(Type, #ssh_msg_disconnect{description = Desc} = Msg, #state{connection_state = Connection0, role = Role} = State0) -> +handle_disconnect(#ssh_msg_disconnect{description = Desc} = Msg, #state{connection_state = Connection0, + role = Role} = State0) -> {disconnect, _, {{replies, Replies}, Connection}} = ssh_connection:handle_msg(Msg, Connection0, Role), - State = send_replies(disconnect_replies(Type, Msg, Replies), State0), - disconnect_fun(Desc, State#state.opts), + State = send_replies(Replies, State0), {stop, {shutdown, Desc}, State#state{connection_state = Connection}}. - -handle_disconnect(Type, #ssh_msg_disconnect{description = Desc} = Msg, #state{connection_state = Connection0, - role = Role} = State0, ErrorMsg) -> +handle_disconnect(#ssh_msg_disconnect{description = Desc} = Msg, #state{connection_state = Connection0, + role = Role} = State0, ErrorMsg) -> {disconnect, _, {{replies, Replies}, Connection}} = ssh_connection:handle_msg(Msg, Connection0, Role), - State = send_replies(disconnect_replies(Type, Msg, Replies), State0), - disconnect_fun(Desc, State#state.opts), + State = send_replies(Replies, State0), {stop, {shutdown, {Desc, ErrorMsg}}, State#state{connection_state = Connection}}. -disconnect_replies(own, Msg, Replies) -> - [{connection_reply, Msg} | Replies]; -disconnect_replies(peer, _, Replies) -> - Replies. - counterpart_versions(NumVsn, StrVsn, #ssh{role = server} = Ssh) -> Ssh#ssh{c_vsn = NumVsn , c_version = StrVsn}; counterpart_versions(NumVsn, StrVsn, #ssh{role = client} = Ssh) -> @@ -1770,11 +1489,6 @@ error_logger:error_report(Report), "Internal error". -not_connected_filter({connection_reply, _Data}) -> - true; -not_connected_filter(_) -> - false. - send_replies([], State) -> State; send_replies([{connection_reply, Data} | Rest], #state{ssh_params = Ssh0} = State) -> @@ -1795,8 +1509,6 @@ send_reply({flow_control, From, Msg}) -> gen_fsm:reply(From, Msg). -disconnect_fun({disconnect,Msg}, Opts) -> - disconnect_fun(Msg, Opts); disconnect_fun(_, undefined) -> ok; disconnect_fun(Reason, Opts) -> @@ -1807,15 +1519,6 @@ catch Fun(Reason) end. -unexpected_fun(UnexpectedMessage, Opts, #ssh{peer={_,Peer}}) -> - case proplists:get_value(unexpectedfun, Opts) of - undefined -> - report; - Fun -> - catch Fun(UnexpectedMessage, Peer) - end. - - check_cache(#state{opts = Opts} = State, Cache) -> %% Check the number of entries in Cache case proplists:get_value(size, ets:info(Cache)) of @@ -1876,19 +1579,10 @@ {error, Reason} after Timeout -> stop(Pid), - {error, timeout} + {error, Timeout} end. start_timeout(_,_, infinity) -> ok; start_timeout(Channel, From, Time) -> erlang:send_after(Time, self(), {timeout, {Channel, From}}). - -getopt(Opt, Socket) -> - case inet:getopts(Socket, [Opt]) of - {ok, [{Opt, Value}]} -> - {ok, Value}; - Other -> - {error, {unexpected_getopts_return, Other}} - end. - diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_connection_sup.erl erlang-17.3-dfsg/lib/ssh/src/ssh_connection_sup.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_connection_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_connection_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/sshc_sup.erl erlang-17.3-dfsg/lib/ssh/src/sshc_sup.erl --- erlang-18.2-dfsg/lib/ssh/src/sshc_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/sshc_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_daemon_channel.erl erlang-17.3-dfsg/lib/ssh/src/ssh_daemon_channel.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_daemon_channel.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_daemon_channel.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/sshd_sup.erl erlang-17.3-dfsg/lib/ssh/src/sshd_sup.erl --- erlang-18.2-dfsg/lib/ssh/src/sshd_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/sshd_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,10 +26,8 @@ -behaviour(supervisor). --include("ssh.hrl"). - -export([start_link/1, start_child/1, stop_child/1, - stop_child/3, system_name/1]). + stop_child/2, system_name/1]). %% Supervisor callback -export([init/1]). @@ -43,14 +40,13 @@ start_child(ServerOpts) -> Address = proplists:get_value(address, ServerOpts), - Port = proplists:get_value(port, ServerOpts), - Profile = proplists:get_value(profile, proplists:get_value(ssh_opts, ServerOpts), ?DEFAULT_PROFILE), - case ssh_system_sup:system_supervisor(Address, Port, Profile) of + Port = proplists:get_value(port, ServerOpts), + case ssh_system_sup:system_supervisor(Address, Port) of undefined -> Spec = child_spec(Address, Port, ServerOpts), case supervisor:start_child(?MODULE, Spec) of {error, already_present} -> - Name = id(Address, Port, Profile), + Name = id(Address, Port), supervisor:delete_child(?MODULE, Name), supervisor:start_child(?MODULE, Spec); Reply -> @@ -64,8 +60,8 @@ stop_child(Name) -> supervisor:terminate_child(?MODULE, Name). -stop_child(Address, Port, Profile) -> - Name = id(Address, Port, Profile), +stop_child(Address, Port) -> + Name = id(Address, Port), stop_child(Name). system_name(SysSup) -> @@ -91,8 +87,7 @@ %%% Internal functions %%%========================================================================= child_spec(Address, Port, ServerOpts) -> - Profile = proplists:get_value(profile, proplists:get_value(ssh_opts, ServerOpts), ?DEFAULT_PROFILE), - Name = id(Address, Port,Profile), + Name = id(Address, Port), StartFunc = {ssh_system_sup, start_link, [ServerOpts]}, Restart = temporary, Shutdown = infinity, @@ -100,13 +95,8 @@ Type = supervisor, {Name, StartFunc, Restart, Shutdown, Type, Modules}. -id(Address, Port, Profile) -> - case is_list(Address) of - true -> - {server, ssh_system_sup, any, Port, Profile}; - false -> - {server, ssh_system_sup, Address, Port, Profile} - end. +id(Address, Port) -> + {server, ssh_system_sup, Address, Port}. system_name([], _ ) -> undefined; diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh.erl erlang-17.3-dfsg/lib/ssh/src/ssh.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,16 +24,12 @@ -include("ssh.hrl"). -include("ssh_connect.hrl"). -include_lib("public_key/include/public_key.hrl"). --include_lib("kernel/include/file.hrl"). -export([start/0, start/1, stop/0, connect/3, connect/4, close/1, connection_info/2, channel_info/3, daemon/1, daemon/2, daemon/3, - default_algorithms/0, - stop_listener/1, stop_listener/2, stop_listener/3, - stop_daemon/1, stop_daemon/2, stop_daemon/3, - shell/1, shell/2, shell/3 - ]). + stop_listener/1, stop_listener/2, stop_daemon/1, stop_daemon/2, + shell/1, shell/2, shell/3]). %%-------------------------------------------------------------------- -spec start() -> ok | {error, term()}. @@ -118,9 +113,9 @@ ssh_connection_handler:channel_info(ConnectionRef, ChannelId, Options). %%-------------------------------------------------------------------- --spec daemon(integer()) -> {ok, pid()} | {error, term()}. --spec daemon(integer(), proplists:proplist()) -> {ok, pid()} | {error, term()}. --spec daemon(any | inet:ip_address(), integer(), proplists:proplist()) -> {ok, pid()} | {error, term()}. +-spec daemon(integer()) -> {ok, pid()}. +-spec daemon(integer(), proplists:proplist()) -> {ok, pid()}. +-spec daemon(any | inet:ip_address(), integer(), proplists:proplist()) -> {ok, pid()}. %% Description: Starts a server listening for SSH connections %% on the given port. @@ -162,9 +157,7 @@ stop_listener(SysSup) -> ssh_system_sup:stop_listener(SysSup). stop_listener(Address, Port) -> - stop_listener(Address, Port, ?DEFAULT_PROFILE). -stop_listener(Address, Port, Profile) -> - ssh_system_sup:stop_listener(Address, Port, Profile). + ssh_system_sup:stop_listener(Address, Port). %%-------------------------------------------------------------------- -spec stop_daemon(pid()) -> ok. @@ -176,9 +169,8 @@ stop_daemon(SysSup) -> ssh_system_sup:stop_system(SysSup). stop_daemon(Address, Port) -> - ssh_system_sup:stop_system(Address, Port, ?DEFAULT_PROFILE). -stop_daemon(Address, Port, Profile) -> - ssh_system_sup:stop_system(Address, Port, Profile). + ssh_system_sup:stop_system(Address, Port). + %%-------------------------------------------------------------------- -spec shell(string()) -> _. -spec shell(string(), proplists:proplist()) -> _. @@ -202,7 +194,6 @@ {ok, ConnectionRef} -> case ssh_connection:session_channel(ConnectionRef, infinity) of {ok,ChannelId} -> - success = ssh_connection:ptty_alloc(ConnectionRef, ChannelId, []), Args = [{channel_cb, ssh_shell}, {init_args,[ConnectionRef, ChannelId]}, {cm, ConnectionRef}, {channel_id, ChannelId}], @@ -216,11 +207,6 @@ end. %%-------------------------------------------------------------------- -%%-------------------------------------------------------------------- -default_algorithms() -> - ssh_transport:default_algorithms(). - -%%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- fix_idle_time(SshOptions) -> @@ -235,29 +221,11 @@ {error, _Reason} = Error -> Error; {SocketOptions, SshOptions}-> - try - do_start_daemon(Host, Port,[{role, server} |SshOptions] , [Inet | SocketOptions]) - catch - throw:bad_fd -> {error,bad_fd}; - _C:_E -> {error,{cannot_start_daemon,_C,_E}} - end + do_start_daemon(Host, Port,[{role, server} |SshOptions] , [Inet | SocketOptions]) end. -do_start_daemon(Host0, Port0, Options, SocketOptions) -> - {Host,Port} = try - case proplists:get_value(fd, SocketOptions) of - undefined -> - {Host0,Port0}; - Fd when Port0==0 -> - find_hostport(Fd); - _ -> - {Host0,Port0} - end - catch - _:_ -> throw(bad_fd) - end, - Profile = proplists:get_value(profile, Options, ?DEFAULT_PROFILE), - case ssh_system_sup:system_supervisor(Host, Port, Profile) of +do_start_daemon(Host, Port, Options, SocketOptions) -> + case ssh_system_sup:system_supervisor(Host, Port) of undefined -> %% It would proably make more sense to call the %% address option host but that is a too big change at the @@ -266,40 +234,27 @@ {port, Port}, {role, server}, {socket_opts, SocketOptions}, {ssh_opts, Options}]) of + {ok, SysSup} -> + {ok, SysSup}; {error, {already_started, _}} -> {error, eaddrinuse}; - Result = {Code, _} when (Code == ok) or (Code == error) -> - Result + {error, R} -> + {error, R} catch exit:{noproc, _} -> {error, ssh_not_started} end; Sup -> - AccPid = ssh_system_sup:acceptor_supervisor(Sup), - case ssh_acceptor_sup:start_child(AccPid, [{address, Host}, - {port, Port}, {role, server}, - {socket_opts, SocketOptions}, - {ssh_opts, Options}]) of - {error, {already_started, _}} -> - {error, eaddrinuse}; + case ssh_system_sup:restart_acceptor(Host, Port) of {ok, _} -> {ok, Sup}; - Other -> - Other + _ -> + {error, eaddrinuse} end end. -find_hostport(Fd) -> - %% Using internal functions inet:open/8 and inet:close/0. - %% Don't try this at home unless you know what you are doing! - {ok,S} = inet:open(Fd, {0,0,0,0}, 0, [], tcp, inet, stream, inet_tcp), - {ok, HostPort} = inet:sockname(S), - ok = inet:close(S), - HostPort. - - handle_options(Opts) -> - try handle_option(algs_compatibility(proplists:unfold(Opts)), [], []) of + try handle_option(proplists:unfold(Opts), [], []) of {Inet, Ssh} -> {handle_ip(Inet), Ssh} catch @@ -307,30 +262,6 @@ Error end. - -algs_compatibility(Os0) -> - %% Take care of old options 'public_key_alg' and 'pref_public_key_algs' - case proplists:get_value(public_key_alg, Os0) of - undefined -> - Os0; - A when is_atom(A) -> - %% Skip public_key_alg if pref_public_key_algs is defined: - Os = lists:keydelete(public_key_alg, 1, Os0), - case proplists:get_value(pref_public_key_algs,Os) of - undefined when A == 'ssh-rsa' ; A==ssh_rsa -> - [{pref_public_key_algs,['ssh-rsa','ssh-dss']} | Os]; - undefined when A == 'ssh-dss' ; A==ssh_dsa -> - [{pref_public_key_algs,['ssh-dss','ssh-rsa']} | Os]; - undefined -> - throw({error, {eoptions, {public_key_alg,A} }}); - _ -> - Os - end; - V -> - throw({error, {eoptions, {public_key_alg,V} }}) - end. - - handle_option([], SocketOptions, SshOptions) -> {SocketOptions, SshOptions}; handle_option([{system_dir, _} = Opt | Rest], SocketOptions, SshOptions) -> @@ -343,6 +274,8 @@ handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{user_interaction, _} = Opt | Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); +handle_option([{public_key_alg, _} = Opt | Rest], SocketOptions, SshOptions) -> + handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{connect_timeout, _} = Opt | Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{user, _} = Opt | Rest], SocketOptions, SshOptions) -> @@ -357,13 +290,11 @@ handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{pwdfun, _} = Opt | Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{key_cb, {Module, Options}} | Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option({key_cb, Module}), - handle_ssh_priv_option({key_cb_private, Options}) | - SshOptions]); -handle_option([{key_cb, Module} | Rest], SocketOptions, SshOptions) -> - handle_option([{key_cb, {Module, []}} | Rest], SocketOptions, SshOptions); -handle_option([{keyboard_interact_fun, _} = Opt | Rest], SocketOptions, SshOptions) -> +handle_option([{key_cb, _} = Opt | Rest], SocketOptions, SshOptions) -> + handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); +handle_option([{role, _} = Opt | Rest], SocketOptions, SshOptions) -> + handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); +handle_option([{compression, _} = Opt | Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); %%Backwards compatibility handle_option([{allow_user_interaction, Value} | Rest], SocketOptions, SshOptions) -> @@ -374,12 +305,8 @@ handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{disconnectfun, _} = Opt | Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{unexpectedfun, _} = Opt | Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{failfun, _} = Opt | Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{ssh_msg_debug_fun, _} = Opt | Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); %%Backwards compatibility should not be underscore between ip and v6 in API handle_option([{ip_v6_disabled, Value} | Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option({ipv6_disabled, Value}) | SshOptions]); @@ -397,16 +324,8 @@ handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{auth_methods, _} = Opt | Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{auth_method_kb_interactive_data, _} = Opt | Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{pref_public_key_algs, _} = Opt | Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{preferred_algorithms,_} = Opt | Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{dh_gex_groups,_} = Opt | Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{dh_gex_limits,_} = Opt | Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{quiet_mode, _} = Opt|Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{idle_time, _} = Opt | Rest], SocketOptions, SshOptions) -> @@ -415,107 +334,35 @@ handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{max_sessions, _} = Opt|Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{max_channels, _} = Opt|Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{negotiation_timeout, _} = Opt|Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); handle_option([{parallel_login, _} = Opt|Rest], SocketOptions, SshOptions) -> handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -%% (Is handled by proplists:unfold above:) -%% handle_option([parallel_login|Rest], SocketOptions, SshOptions) -> -%% handle_option(Rest, SocketOptions, [handle_ssh_option({parallel_login,true}) | SshOptions]); -handle_option([{minimal_remote_max_packet_size, _} = Opt|Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{id_string, _ID} = Opt|Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{profile, _ID} = Opt|Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); -handle_option([{max_random_length_padding, _Bool} = Opt|Rest], SocketOptions, SshOptions) -> - handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]); +handle_option([parallel_login|Rest], SocketOptions, SshOptions) -> + handle_option(Rest, SocketOptions, [handle_ssh_option({parallel_login,true}) | SshOptions]); handle_option([Opt | Rest], SocketOptions, SshOptions) -> handle_option(Rest, [handle_inet_option(Opt) | SocketOptions], SshOptions). - -handle_ssh_option({minimal_remote_max_packet_size, Value} = Opt) when is_integer(Value), Value >=0 -> - Opt; handle_ssh_option({system_dir, Value} = Opt) when is_list(Value) -> - check_dir(Opt); + Opt; handle_ssh_option({user_dir, Value} = Opt) when is_list(Value) -> - check_dir(Opt); + Opt; handle_ssh_option({user_dir_fun, Value} = Opt) when is_function(Value) -> Opt; handle_ssh_option({silently_accept_hosts, Value} = Opt) when is_boolean(Value) -> Opt; handle_ssh_option({user_interaction, Value} = Opt) when is_boolean(Value) -> Opt; -handle_ssh_option({preferred_algorithms,[_|_]} = Opt) -> - handle_pref_algs(Opt); - -handle_ssh_option({dh_gex_groups,L0}) when is_list(L0) -> - {dh_gex_groups, - collect_per_size( - lists:foldl( - fun({N,G,P}, Acc) when is_integer(N),N>0, - is_integer(G),G>0, - is_integer(P),P>0 -> - [{N,{G,P}} | Acc]; - ({N,{G,P}}, Acc) when is_integer(N),N>0, - is_integer(G),G>0, - is_integer(P),P>0 -> - [{N,{G,P}} | Acc]; - ({N,GPs}, Acc) when is_list(GPs) -> - lists:foldr(fun({Gi,Pi}, Acci) when is_integer(Gi),Gi>0, - is_integer(Pi),Pi>0 -> - [{N,{Gi,Pi}} | Acci] - end, Acc, GPs) - end, [], L0))}; - -handle_ssh_option({dh_gex_groups,{Tag,File=[C|_]}}=Opt) when is_integer(C), C>0, - Tag == file ; - Tag == ssh_moduli_file -> - {ok,GroupDefs} = - case Tag of - file -> - file:consult(File); - ssh_moduli_file -> - case file:open(File,[read]) of - {ok,D} -> - try - {ok,Moduli} = read_moduli_file(D, 1, []), - file:close(D), - {ok, Moduli} - catch - _:_ -> - throw({error, {{eoptions, Opt}, "Bad format in file "++File}}) - end; - {error,enoent} -> - throw({error, {{eoptions, Opt}, "File not found:"++File}}); - {error,Error} -> - throw({error, {{eoptions, Opt}, io_lib:format("Error reading file ~s: ~p",[File,Error])}}) - end - end, - - try - handle_ssh_option({dh_gex_groups,GroupDefs}) - catch - _:_ -> - throw({error, {{eoptions, Opt}, "Bad format in file: "++File}}) - end; - - -handle_ssh_option({dh_gex_limits,{Min,Max}} = Opt) when is_integer(Min), Min>0, - is_integer(Max), Max>=Min -> - %% Server - Opt; -handle_ssh_option({dh_gex_limits,{Min,I,Max}} = Opt) when is_integer(Min), Min>0, - is_integer(I), I>=Min, - is_integer(Max), Max>=I -> - %% Client +handle_ssh_option({public_key_alg, ssh_dsa}) -> + {public_key_alg, 'ssh-dss'}; +handle_ssh_option({public_key_alg, ssh_rsa}) -> + {public_key_alg, 'ssh-rsa'}; +handle_ssh_option({public_key_alg, Value} = Opt) when Value == 'ssh-rsa'; Value == 'ssh-dss' -> Opt; handle_ssh_option({pref_public_key_algs, Value} = Opt) when is_list(Value), length(Value) >= 1 -> - case handle_user_pref_pubkey_algs(Value, []) of + case handle_pref_algs(Value, []) of {true, NewOpts} -> - {pref_public_key_algs, NewOpts}; + NewOpts; _ -> throw({error, {eoptions, Opt}}) end; @@ -523,8 +370,6 @@ Opt; handle_ssh_option({max_sessions, Value} = Opt) when is_integer(Value), Value>0 -> Opt; -handle_ssh_option({max_channels, Value} = Opt) when is_integer(Value), Value>0 -> - Opt; handle_ssh_option({negotiation_timeout, Value} = Opt) when is_integer(Value); Value == infinity -> Opt; handle_ssh_option({parallel_login, Value} = Opt) when Value==true ; Value==false -> @@ -539,17 +384,10 @@ Opt; handle_ssh_option({user_passwords, Value} = Opt) when is_list(Value)-> Opt; -handle_ssh_option({pwdfun, Value} = Opt) when is_function(Value,2) -> - Opt; -handle_ssh_option({pwdfun, Value} = Opt) when is_function(Value,4) -> +handle_ssh_option({pwdfun, Value} = Opt) when is_function(Value) -> Opt; handle_ssh_option({key_cb, Value} = Opt) when is_atom(Value) -> Opt; -handle_ssh_option({key_cb, {CallbackMod, CallbackOptions}} = Opt) when is_atom(CallbackMod), - is_list(CallbackOptions) -> - Opt; -handle_ssh_option({keyboard_interact_fun, Value} = Opt) when is_function(Value,3) -> - Opt; handle_ssh_option({compression, Value} = Opt) when is_atom(Value) -> Opt; handle_ssh_option({exec, {Module, Function, _}} = Opt) when is_atom(Module), @@ -559,25 +397,14 @@ Opt; handle_ssh_option({auth_methods, Value} = Opt) when is_list(Value) -> Opt; -handle_ssh_option({auth_method_kb_interactive_data, {Name,Instruction,Prompt,Echo}} = Opt) when is_list(Name), - is_list(Instruction), - is_list(Prompt), - is_boolean(Echo) -> - Opt; -handle_ssh_option({auth_method_kb_interactive_data, F} = Opt) when is_function(F,3) -> - Opt; handle_ssh_option({infofun, Value} = Opt) when is_function(Value) -> Opt; handle_ssh_option({connectfun, Value} = Opt) when is_function(Value) -> Opt; -handle_ssh_option({disconnectfun, Value} = Opt) when is_function(Value) -> - Opt; -handle_ssh_option({unexpectedfun, Value} = Opt) when is_function(Value,2) -> +handle_ssh_option({disconnectfun , Value} = Opt) when is_function(Value) -> Opt; handle_ssh_option({failfun, Value} = Opt) when is_function(Value) -> Opt; -handle_ssh_option({ssh_msg_debug_fun, Value} = Opt) when is_function(Value,4) -> - Opt; handle_ssh_option({ipv6_disabled, Value} = Opt) when is_boolean(Value) -> throw({error, {{ipv6_disabled, Opt}, option_no_longer_valid_use_inet_option_instead}}); @@ -602,21 +429,9 @@ Opt; handle_ssh_option({rekey_limit, Value} = Opt) when is_integer(Value) -> Opt; -handle_ssh_option({id_string, random}) -> - {id_string, {random,2,5}}; %% 2 - 5 random characters -handle_ssh_option({id_string, ID} = Opt) when is_list(ID) -> - Opt; -handle_ssh_option({max_random_length_padding, Value} = Opt) when is_integer(Value), - Value =< 255 -> - Opt; -handle_ssh_option({profile, Value} = Opt) when is_atom(Value) -> - Opt; handle_ssh_option(Opt) -> throw({error, {eoptions, Opt}}). -handle_ssh_priv_option({key_cb_private, Value} = Opt) when is_list(Value) -> - Opt. - handle_inet_option({active, _} = Opt) -> throw({error, {{eoptions, Opt}, "SSH has built in flow control, " "and active is handled internally, user is not allowed" @@ -630,83 +445,23 @@ %% Option verified by inet handle_inet_option(Opt) -> Opt. - - %% Check preferred algs - -handle_pref_algs({preferred_algorithms,Algs}) -> - try alg_duplicates(Algs, [], []) of - [] -> - {preferred_algorithms, - [try ssh_transport:supported_algorithms(Key) - of - DefAlgs -> handle_pref_alg(Key,Vals,DefAlgs) - catch - _:_ -> throw({error, {{eoptions, {preferred_algorithms,Key}}, - "Bad preferred_algorithms key"}}) - end || {Key,Vals} <- Algs] - }; - - Dups -> - throw({error, {{eoptions, {preferred_algorithms,Dups}}, "Duplicates found"}}) - catch - _:_ -> - throw({error, {{eoptions, preferred_algorithms}, "Malformed"}}) +handle_pref_algs([], Acc) -> + {true, lists:reverse(Acc)}; +handle_pref_algs([H|T], Acc) -> + case H of + ssh_dsa -> + handle_pref_algs(T, ['ssh-dss'| Acc]); + ssh_rsa -> + handle_pref_algs(T, ['ssh-rsa'| Acc]); + 'ssh-dss' -> + handle_pref_algs(T, ['ssh-dss'| Acc]); + 'ssh-rsa' -> + handle_pref_algs(T, ['ssh-rsa'| Acc]); + _ -> + false end. -alg_duplicates([{K,V}|KVs], Ks, Dups0) -> - Dups = - case lists:member(K,Ks) of - true -> - [K|Dups0]; - false -> - Dups0 - end, - case V--lists:usort(V) of - [] -> - alg_duplicates(KVs, [K|Ks], Dups); - Ds -> - alg_duplicates(KVs, [K|Ks], Dups++Ds) - end; -alg_duplicates([], _Ks, Dups) -> - Dups. - -handle_pref_alg(Key, - Vs=[{client2server,C2Ss=[_|_]},{server2client,S2Cs=[_|_]}], - [{client2server,Sup_C2Ss},{server2client,Sup_S2Cs}] - ) -> - chk_alg_vs(Key, C2Ss, Sup_C2Ss), - chk_alg_vs(Key, S2Cs, Sup_S2Cs), - {Key, Vs}; - -handle_pref_alg(Key, - Vs=[{server2client,[_|_]},{client2server,[_|_]}], - Sup=[{client2server,_},{server2client,_}] - ) -> - handle_pref_alg(Key, lists:reverse(Vs), Sup); - -handle_pref_alg(Key, - Vs=[V|_], - Sup=[{client2server,_},{server2client,_}] - ) when is_atom(V) -> - handle_pref_alg(Key, [{client2server,Vs},{server2client,Vs}], Sup); - -handle_pref_alg(Key, - Vs=[V|_], - Sup=[S|_] - ) when is_atom(V), is_atom(S) -> - chk_alg_vs(Key, Vs, Sup), - {Key, Vs}; - -handle_pref_alg(Key, Vs, _) -> - throw({error, {{eoptions, {preferred_algorithms,[{Key,Vs}]}}, "Badly formed list"}}). - -chk_alg_vs(OptKey, Values, SupportedValues) -> - case (Values -- SupportedValues) of - [] -> Values; - Bad -> throw({error, {{eoptions, {OptKey,Bad}}, "Unsupported value(s) found"}}) - end. - handle_ip(Inet) -> %% Default to ipv4 case lists:member(inet, Inet) of true -> @@ -719,74 +474,4 @@ [inet | Inet] end end. - -check_dir({_,Dir} = Opt) -> - case directory_exist_readable(Dir) of - ok -> - Opt; - {error,Error} -> - throw({error, {eoptions,{Opt,Error}}}) - end. - -directory_exist_readable(Dir) -> - case file:read_file_info(Dir) of - {ok, #file_info{type = directory, - access = Access}} -> - case Access of - read -> ok; - read_write -> ok; - _ -> {error, eacces} - end; - - {ok, #file_info{}}-> - {error, enotdir}; - - {error, Error} -> - {error, Error} - end. - - - -collect_per_size(L) -> - lists:foldr( - fun({Sz,GP}, [{Sz,GPs}|Acc]) -> [{Sz,[GP|GPs]}|Acc]; - ({Sz,GP}, Acc) -> [{Sz,[GP]}|Acc] - end, [], lists:sort(L)). - -read_moduli_file(D, I, Acc) -> - case io:get_line(D,"") of - {error,Error} -> - {error,Error}; - eof -> - {ok, Acc}; - "#" ++ _ -> read_moduli_file(D, I+1, Acc); - <<"#",_/binary>> -> read_moduli_file(D, I+1, Acc); - Data -> - Line = if is_binary(Data) -> binary_to_list(Data); - is_list(Data) -> Data - end, - try - [_Time,_Type,_Tests,_Tries,Size,G,P] = string:tokens(Line," \r\n"), - M = {list_to_integer(Size), - {list_to_integer(G), list_to_integer(P,16)} - }, - read_moduli_file(D, I+1, [M|Acc]) - catch - _:_ -> - read_moduli_file(D, I+1, Acc) - end - end. - -handle_user_pref_pubkey_algs([], Acc) -> - {true, lists:reverse(Acc)}; -handle_user_pref_pubkey_algs([H|T], Acc) -> - case lists:member(H, ?SUPPORTED_USER_KEYS) of - true -> - handle_user_pref_pubkey_algs(T, [H| Acc]); - - false when H==ssh_dsa -> handle_user_pref_pubkey_algs(T, ['ssh-dss'| Acc]); - false when H==ssh_rsa -> handle_user_pref_pubkey_algs(T, ['ssh-rsa'| Acc]); - - false -> - false - end. + diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_file.erl erlang-17.3-dfsg/lib/ssh/src/ssh_file.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_file.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_file.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -52,20 +51,8 @@ %% so probably we could hardcod Password = ignore, but %% we keep it as an undocumented option for now. Password = proplists:get_value(identity_pass_phrase(Algorithm), Opts, ignore), - case decode(File, Password) of - {ok,Key} -> - case {Key,Algorithm} of - {#'RSAPrivateKey'{}, 'ssh-rsa'} -> {ok,Key}; - {#'DSAPrivateKey'{}, 'ssh-dss'} -> {ok,Key}; - {#'ECPrivateKey'{parameters = {namedCurve, ?'secp256r1'}}, 'ecdsa-sha2-nistp256'} -> {ok,Key}; - {#'ECPrivateKey'{parameters = {namedCurve, ?'secp384r1'}}, 'ecdsa-sha2-nistp384'} -> {ok,Key}; - {#'ECPrivateKey'{parameters = {namedCurve, ?'secp521r1'}}, 'ecdsa-sha2-nistp521'} -> {ok,Key}; - _ -> - {error,bad_keytype_in_file} - end; - Other -> - Other - end. + decode(File, Password). + is_auth_key(Key, User,Opts) -> case lookup_user_key(Key, User, Opts) of @@ -93,15 +80,16 @@ %% Internal functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -file_base_name('ssh-rsa' ) -> "ssh_host_rsa_key"; -file_base_name('ssh-dss' ) -> "ssh_host_dsa_key"; -file_base_name('ecdsa-sha2-nistp256') -> "ssh_host_ecdsa_key"; -file_base_name('ecdsa-sha2-nistp384') -> "ssh_host_ecdsa_key"; -file_base_name('ecdsa-sha2-nistp521') -> "ssh_host_ecdsa_key"; -file_base_name(_ ) -> "ssh_host_key". +file_base_name('ssh-rsa') -> + "ssh_host_rsa_key"; +file_base_name('ssh-dss') -> + "ssh_host_dsa_key"; +file_base_name(_) -> + "ssh_host_key". decode(File, Password) -> - try {ok, decode_ssh_file(read_ssh_file(File), Password)} + try + {ok, decode_ssh_file(read_ssh_file(File), Password)} catch throw:Reason -> {error, Reason}; @@ -221,32 +209,29 @@ {ok, Fd} -> Res = lookup_host_key_fd(Fd, KeyToMatch, Host, Alg), file:close(Fd), - Res; - {error, enoent} -> - {error, not_found}; - Error -> - Error - end. + {ok, Res}; + {error, enoent} -> {error, not_found}; + Error -> Error + end. + +identity_key_filename('ssh-dss') -> + "id_dsa"; +identity_key_filename('ssh-rsa') -> + "id_rsa". + +identity_pass_phrase("ssh-dss") -> + dsa_pass_phrase; +identity_pass_phrase('ssh-dss') -> + dsa_pass_phrase; +identity_pass_phrase('ssh-rsa') -> + rsa_pass_phrase; +identity_pass_phrase("ssh-rsa") -> + rsa_pass_phrase. -identity_key_filename('ssh-dss' ) -> "id_dsa"; -identity_key_filename('ssh-rsa' ) -> "id_rsa"; -identity_key_filename('ecdsa-sha2-nistp256') -> "id_ecdsa"; -identity_key_filename('ecdsa-sha2-nistp384') -> "id_ecdsa"; -identity_key_filename('ecdsa-sha2-nistp521') -> "id_ecdsa". - -identity_pass_phrase("ssh-dss" ) -> dsa_pass_phrase; -identity_pass_phrase("ssh-rsa" ) -> rsa_pass_phrase; -identity_pass_phrase("ecdsa-sha2-"++_) -> ecdsa_pass_phrase; -identity_pass_phrase(P) when is_atom(P) -> - identity_pass_phrase(atom_to_list(P)). - lookup_host_key_fd(Fd, KeyToMatch, Host, KeyType) -> case io:get_line(Fd, '') of eof -> {error, not_found}; - {error,Error} -> - %% Rare... For example NFS errors - {error,Error}; Line -> case ssh_decode_line(Line, known_hosts) of [{Key, Attributes}] -> @@ -267,7 +252,7 @@ Host1 = host_name(Host), case lists:member(Host1, HostList) andalso key_match(Key, KeyType) of true when KeyToMatch == Key -> - {ok,Key}; + Key; _ -> lookup_host_key_fd(Fd, KeyToMatch, Host, KeyType) end. @@ -281,13 +266,6 @@ true; key_match({_, #'Dss-Parms'{}}, 'ssh-dss') -> true; -key_match({#'ECPoint'{},{namedCurve,Curve}}, Alg) -> - case atom_to_list(Alg) of - "ecdsa-sha2-"++IdS -> - Curve == public_key:ssh_curvename2oid(list_to_binary(IdS)); - _ -> - false - end; key_match(_, _) -> false. @@ -314,9 +292,6 @@ case io:get_line(Fd, '') of eof -> {error, not_found}; - {error,Error} -> - %% Rare... For example NFS errors - {error,Error}; Line -> case ssh_decode_line(Line, auth_keys) of [{AuthKey, _}] -> @@ -336,18 +311,8 @@ is_auth_key(_,_) -> false. - -default_user_dir() -> - try - default_user_dir(os:getenv("HOME")) - catch - _:_ -> - default_user_dir(init:get_argument(home)) - end. - -default_user_dir({ok,[[Home|_]]}) -> - default_user_dir(Home); -default_user_dir(Home) when is_list(Home) -> +default_user_dir()-> + {ok,[[Home|_]]} = init:get_argument(home), UserDir = filename:join(Home, ".ssh"), ok = filelib:ensure_dir(filename:join(UserDir, "dummy")), {ok,Info} = file:read_file_info(UserDir), diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh.hrl erlang-17.3-dfsg/lib/ssh/src/ssh.hrl --- erlang-18.2-dfsg/lib/ssh/src/ssh.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,26 +28,20 @@ -define(SSH_DEFAULT_PORT, 22). -define(SSH_MAX_PACKET_SIZE, (256*1024)). +-define(SSH_LENGHT_INDICATOR_SIZE, 4). -define(REKEY_TIMOUT, 3600000). -define(REKEY_DATA_TIMOUT, 60000). --define(DEFAULT_PROFILE, default). - --define(SUPPORTED_AUTH_METHODS, "publickey,keyboard-interactive,password"). --define(SUPPORTED_USER_KEYS, ['ssh-rsa','ssh-dss','ecdsa-sha2-nistp256','ecdsa-sha2-nistp384','ecdsa-sha2-nistp521']). -define(FALSE, 0). -define(TRUE, 1). %% basic binary constructors --define(BOOLEAN(X), (X):8/unsigned-big-integer). --define(BYTE(X), (X):8/unsigned-big-integer). --define(UINT16(X), (X):16/unsigned-big-integer). --define(UINT32(X), (X):32/unsigned-big-integer). --define(UINT64(X), (X):64/unsigned-big-integer). +-define(BOOLEAN(X), X:8/unsigned-big-integer). +-define(BYTE(X), X:8/unsigned-big-integer). +-define(UINT16(X), X:16/unsigned-big-integer). +-define(UINT32(X), X:32/unsigned-big-integer). +-define(UINT64(X), X:64/unsigned-big-integer). -define(STRING(X), ?UINT32((size(X))), (X)/binary). --define(DEC_BIN(X,Len), ?UINT32(Len), X:Len/binary ). --define(DEC_MPINT(I,Len), ?UINT32(Len), I:Len/big-signed-integer-unit:8 ). - %% building macros -define(boolean(X), case X of @@ -129,18 +122,15 @@ recv_sequence = 0, keyex_key, keyex_info, - random_length_padding = 255, % From RFC 4253 section 6. %% User auth user, service, userauth_quiet_mode, % boolean() - userauth_supported_methods, % string() eg "keyboard-interactive,password" - userauth_methods, % list( string() ) eg ["keyboard-interactive", "password"] - kb_tries_left = 0, % integer(), num tries left for "keyboard-interactive" + userauth_supported_methods , % + userauth_methods, userauth_preference, available_host_keys, - pwdfun_user_state, authenticated = false }). diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_info.erl erlang-17.3-dfsg/lib/ssh/src/ssh_info.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_info.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_info.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,203 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% -%%---------------------------------------------------------------------- -%% Purpose: Print some info of a running ssh aplication. -%%---------------------------------------------------------------------- - --module(ssh_info). - --compile(export_all). - -print() -> - print(user). - -print(D) -> - try supervisor:which_children(ssh_sup) - of - _ -> - io:nl(D), - print_general(D), - io:nl(D), - underline(D, "Client part", $=), - print_clients(D), - io:nl(D), - underline(D, "Server part", $=), - print_servers(D), - io:nl(D), - %% case os:type() of - %% {unix,_} -> - %% io:nl(), - %% underline("Linux part", $=), - %% underline("Listening"), - %% catch io:format(os:cmd("netstat -tpln")), - %% io:nl(), - %% underline("Other"), - %% catch io:format(os:cmd("netstat -tpn")); - %% _ -> ok - %% end, - underline(D, "Supervisors", $=), - walk_sups(D, ssh_sup), - io:nl(D) - catch - _:_ -> - io:format(D,"Ssh not found~n",[]) - end. - -%%%================================================================ -print_general(D) -> - {_Name, Slogan, Ver} = lists:keyfind(ssh,1,application:which_applications()), - underline(D, io_lib:format("~s ~s", [Slogan, Ver]), $=), - io:format(D, 'This printout is generated ~s. ~n',[datetime()]). - -%%%================================================================ -print_clients(D) -> - PrintClient = fun(X) -> print_client(D,X) end, - try - lists:foreach(PrintClient, supervisor:which_children(sshc_sup)) - catch - C:E -> - io:format(D, '***FAILED: ~p:~p~n',[C,E]) - end. - -print_client(D, {undefined,Pid,supervisor,[ssh_connection_handler]}) -> - {{Local,Remote},_Str} = ssh_connection_handler:get_print_info(Pid), - io:format(D, " Local=~s Remote=~s ConnectionRef=~p~n",[fmt_host_port(Local),fmt_host_port(Remote),Pid]); -print_client(D, Other) -> - io:format(D, " [[Other 1: ~p]]~n",[Other]). - - -%%%================================================================ -print_servers(D) -> - PrintServer = fun(X) -> print_server(D,X) end, - try - lists:foreach(PrintServer, supervisor:which_children(sshd_sup)) - catch - C:E -> - io:format(D, '***FAILED: ~p:~p~n',[C,E]) - end. - -print_server(D, {{server,ssh_system_sup,LocalHost,LocalPort},Pid,supervisor,[ssh_system_sup]}) when is_pid(Pid) -> - io:format(D, 'Local=~s (~p children)~n',[fmt_host_port({LocalHost,LocalPort}), - ssh_acceptor:number_of_connections(Pid)]), - PrintSystemSup = fun(X) -> print_system_sup(D,X) end, - lists:foreach(PrintSystemSup, supervisor:which_children(Pid)); -print_server(D, Other) -> - io:format(D, " [[Other 2: ~p]]~n",[Other]). - -print_system_sup(D, {Ref,Pid,supervisor,[ssh_subsystem_sup]}) when is_reference(Ref), - is_pid(Pid) -> - PrintChannels = fun(X) -> print_channels(D,X) end, - lists:foreach(PrintChannels, supervisor:which_children(Pid)); -print_system_sup(D, {{ssh_acceptor_sup,LocalHost,LocalPort}, Pid,supervisor, [ssh_acceptor_sup]}) when is_pid(Pid) -> - io:format(D, " [Acceptor for ~s]~n",[fmt_host_port({LocalHost,LocalPort})]); -print_system_sup(D, Other) -> - io:format(D, " [[Other 3: ~p]]~n",[Other]). - -print_channels(D, {{server,ssh_channel_sup,_,_},Pid,supervisor,[ssh_channel_sup]}) when is_pid(Pid) -> - PrintChannel = fun(X) -> print_channel(D,X) end, - lists:foreach(PrintChannel, supervisor:which_children(Pid)); -print_channels(D, Other) -> - io:format(D, " [[Other 4: ~p]]~n",[Other]). - - -print_channel(D, {Ref,Pid,worker,[ssh_channel]}) when is_reference(Ref), - is_pid(Pid) -> - {{ConnManager,ChannelID}, Str} = ssh_channel:get_print_info(Pid), - {{Local,Remote},StrM} = ssh_connection_handler:get_print_info(ConnManager), - io:format(D, ' ch ~p: ~s ~s',[ChannelID, StrM, Str]), - io:format(D, " Local=~s Remote=~s~n",[fmt_host_port(Local),fmt_host_port(Remote)]); -print_channel(D, Other) -> - io:format(D, " [[Other 5: ~p]]~n",[Other]). - -%%%================================================================ --define(inc(N), (N+4)). - -walk_sups(D, StartPid) -> - io:format(D, "Start at ~p, ~s.~n",[StartPid,dead_or_alive(StartPid)]), - walk_sups(D, children(StartPid), _Indent=?inc(0)). - -walk_sups(D, [H={_,Pid,_,_}|T], Indent) -> - indent(D, Indent), io:format(D, '~200p ~p is ~s~n',[H,Pid,dead_or_alive(Pid)]), - case H of - {_,_,supervisor,[ssh_connection_handler]} -> ok; - {_,Pid,supervisor,_} -> walk_sups(D, children(Pid), ?inc(Indent)); - _ -> ok - end, - walk_sups(D, T, Indent); -walk_sups(_D, [], _) -> - ok. - -dead_or_alive(Name) when is_atom(Name) -> - case whereis(Name) of - undefined -> - "**UNDEFINED**"; - Pid -> - dead_or_alive(Pid) - end; -dead_or_alive(Pid) when is_pid(Pid) -> - case process_info(Pid) of - undefined -> "**DEAD**"; - _ -> "alive" - end. - -indent(D, I) -> io:format(D,'~*c',[I,$ ]). - -children(Pid) -> - Parent = self(), - Helper = spawn(fun() -> - Parent ! {self(),supervisor:which_children(Pid)} - end), - receive - {Helper,L} when is_list(L) -> - L - after - 2000 -> - catch exit(Helper, kill), - [] - end. - -%%%================================================================ -underline(D, Str) -> - underline(D, Str, $-). - -underline(D, Str, LineChar) -> - Len = lists:flatlength(Str), - io:format(D, '~s~n',[Str]), - line(D,Len,LineChar). - -line(D, Len, Char) -> - io:format(D, '~*c~n', [Len,Char]). - - -datetime() -> - {{YYYY,MM,DD}, {H,M,S}} = calendar:now_to_universal_time(erlang:timestamp()), - lists:flatten(io_lib:format('~4w-~2..0w-~2..0w ~2..0w:~2..0w:~2..0w UTC',[YYYY,MM,DD, H,M,S])). - - -fmt_host_port({{A,B,C,D},Port}) -> io_lib:format('~p.~p.~p.~p:~p',[A,B,C,D,Port]); -fmt_host_port({Host,Port}) -> io_lib:format('~s:~p',[Host,Port]). - - - -nyi(D) -> - io:format(D,'Not yet implemented~n',[]), - nyi. diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_io.erl erlang-17.3-dfsg/lib/ssh/src/ssh_io.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_io.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_io.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2014. All Rights Reserved. +%% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -74,9 +73,7 @@ listify(A) when is_atom(A) -> atom_to_list(A); listify(L) when is_list(L) -> - L; -listify(B) when is_binary(B) -> - binary_to_list(B). + L. format(Fmt, Args) -> io:format(Fmt, Args). diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_math.erl erlang-17.3-dfsg/lib/ssh/src/ssh_math.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_math.erl 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_math.erl 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,41 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2005-2013. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%% + +%%% Description: SSH math utilities + +-module(ssh_math). + +-export([ipow/3]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% INTEGER utils +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% calculate A^B mod M +ipow(A, B, M) when M > 0, B >= 0 -> + crypto:bytes_to_integer(crypto:mod_pow(A, B, M)). + + + + + diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_message.erl erlang-17.3-dfsg/lib/ssh/src/ssh_message.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_message.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_message.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2014. All Rights Reserved. +%% Copyright Ericsson AB 2013-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,7 +29,7 @@ -include("ssh_auth.hrl"). -include("ssh_transport.hrl"). --export([encode/1, decode/1, decode_keyboard_interactive_prompts/2]). +-export([encode/1, decode/1, encode_host_key/1, decode_keyboard_interactive_prompts/2]). encode(#ssh_msg_global_request{ name = Name, @@ -163,15 +162,8 @@ encode(#ssh_msg_userauth_info_response{ num_responses = Num, data = Data}) -> - Responses = lists:map(fun("") -> - <<>>; - (Response) -> - ssh_bits:encode([Response], [string]) - end, Data), - Start = ssh_bits:encode([?SSH_MSG_USERAUTH_INFO_RESPONSE, Num], - [byte, uint32]), - iolist_to_binary([Start, Responses]); - + ssh_bits:encode([?SSH_MSG_USERAUTH_INFO_RESPONSE, Num, Data], + [byte, uint32, '...']); encode(#ssh_msg_disconnect{ code = Code, description = Desc, @@ -227,8 +219,8 @@ f = F, h_sig = Signature }) -> - EncKey = public_key:ssh_encode(Key, ssh2_pubkey), - EncSign = encode_signature(Key, Signature), + EncKey = encode_host_key(Key), + EncSign = encode_sign(Key, Signature), ssh_bits:encode([?SSH_MSG_KEXDH_REPLY, EncKey, F, EncSign], [byte, binary, mpint, binary]); encode(#ssh_msg_kex_dh_gex_request{ @@ -237,7 +229,7 @@ max = Max }) -> ssh_bits:encode([?SSH_MSG_KEX_DH_GEX_REQUEST, Min, N, Max], - [byte, uint32, uint32, uint32]); + [byte, uint32, uint32, uint32, uint32]); encode(#ssh_msg_kex_dh_gex_request_old{n = N}) -> ssh_bits:encode([?SSH_MSG_KEX_DH_GEX_REQUEST_OLD, N], [byte, uint32]); @@ -255,17 +247,9 @@ f = F, h_sig = Signature }) -> - EncKey = public_key:ssh_encode(Key, ssh2_pubkey), - EncSign = encode_signature(Key, Signature), - ssh_bits:encode([?SSH_MSG_KEX_DH_GEX_REPLY, EncKey, F, EncSign], [byte, binary, mpint, binary]); - -encode(#ssh_msg_kex_ecdh_init{q_c = Q_c}) -> - ssh_bits:encode([?SSH_MSG_KEX_ECDH_INIT, Q_c], [byte, mpint]); - -encode(#ssh_msg_kex_ecdh_reply{public_host_key = Key, q_s = Q_s, h_sig = Sign}) -> - EncKey = public_key:ssh_encode(Key, ssh2_pubkey), - EncSign = encode_signature(Key, Sign), - ssh_bits:encode([?SSH_MSG_KEX_ECDH_REPLY, EncKey, Q_s, EncSign], [byte, binary, mpint, binary]); + EncKey = encode_host_key(Key), + EncSign = encode_sign(Key, Signature), + ssh_bits:encode([?SSH_MSG_KEXDH_REPLY, EncKey, F, EncSign], [byte, binary, mpint, binary]); encode(#ssh_msg_ignore{data = Data}) -> ssh_bits:encode([?SSH_MSG_IGNORE, Data], [byte, string]); @@ -280,7 +264,8 @@ %% Connection Messages -decode(<>) -> +decode(<>) -> #ssh_msg_global_request{ name = Name, want_reply = erl_boolean(Bool), @@ -291,7 +276,8 @@ decode(<>) -> #ssh_msg_request_failure{}; decode(<>) -> #ssh_msg_channel_open{ channel_type = binary_to_list(Type), @@ -311,7 +297,7 @@ data = Data }; decode(<> ) -> + ?UINT32(Len0), Desc:Len0/binary, ?UINT32(Len1), Lang:Len1/binary >>) -> #ssh_msg_channel_open_failure{ recipient_channel = Recipient, reason = Reason, @@ -324,13 +310,13 @@ bytes_to_add = Bytes }; -decode(<>) -> +decode(<>) -> #ssh_msg_channel_data{ recipient_channel = Recipient, data = Data }; decode(<>) -> + ?UINT32(DataType), ?UINT32(Len), Data:Len/binary>>) -> #ssh_msg_channel_extended_data{ recipient_channel = Recipient, data_type_code = DataType, @@ -345,7 +331,8 @@ recipient_channel = Recipient }; decode(<>) -> + ?UINT32(Len), RequestType:Len/binary, + ?BYTE(Bool), Data/binary>>) -> #ssh_msg_channel_request{ recipient_channel = Recipient, request_type = unicode:characters_to_list(RequestType), @@ -363,7 +350,9 @@ %%% Auth Messages decode(<>) -> #ssh_msg_userauth_request{ user = unicode:characters_to_list(User), @@ -373,7 +362,7 @@ }; decode(<>) -> #ssh_msg_userauth_failure { authentications = unicode:characters_to_list(Auths), @@ -383,14 +372,16 @@ decode(<>) -> #ssh_msg_userauth_success{}; -decode(<>) -> +decode(<>) -> #ssh_msg_userauth_banner{ message = Banner, language = Lang }; -decode(<>) -> #ssh_msg_userauth_info_request{ name = Name, @@ -400,14 +391,15 @@ data = Data}; %%% Unhandled message, also masked by same 1:st byte value as ?SSH_MSG_USERAUTH_INFO_REQUEST: -decode(<>) -> +decode(<>) -> #ssh_msg_userauth_passwd_changereq{ prompt = Prompt, languge = Lang }; %%% Unhandled message, also masked by same 1:st byte value as ?SSH_MSG_USERAUTH_INFO_REQUEST: -decode(<>) -> +decode(<>) -> #ssh_msg_userauth_pk_ok{ algorithm_name = Alg, key_blob = KeyBlob @@ -422,71 +414,47 @@ decode(<>) -> decode_kex_init(Data, [Cookie, ssh_msg_kexinit], 10); -decode(<<"dh",?BYTE(?SSH_MSG_KEXDH_INIT), ?DEC_MPINT(E,__0)>>) -> - #ssh_msg_kexdh_init{e = E +decode(<>) -> + #ssh_msg_kexdh_init{e = erlint(Len, E) }; - -decode(<<"dh", ?BYTE(?SSH_MSG_KEXDH_REPLY), ?DEC_BIN(Key,__0), ?DEC_MPINT(F,__1), ?DEC_BIN(Hashsign,__2)>>) -> - #ssh_msg_kexdh_reply{ - public_host_key = public_key:ssh_decode(Key, ssh2_pubkey), - f = F, - h_sig = decode_signature(Hashsign) - }; - decode(<>) -> #ssh_msg_kex_dh_gex_request{ min = Min, n = N, max = Max }; - -decode(<<"dh_gex",?BYTE(?SSH_MSG_KEX_DH_GEX_REQUEST_OLD), ?UINT32(N)>>) -> +decode(<>) -> #ssh_msg_kex_dh_gex_request_old{ n = N }; - -decode(<<"dh_gex",?BYTE(?SSH_MSG_KEX_DH_GEX_GROUP), ?DEC_MPINT(Prime,__0), ?DEC_MPINT(Generator,__1) >>) -> +decode(<>) -> #ssh_msg_kex_dh_gex_group{ p = Prime, g = Generator }; - -decode(<>) -> - #ssh_msg_kex_dh_gex_init{ - e = E - }; - -decode(<>) -> - #ssh_msg_kex_dh_gex_reply{ - public_host_key = public_key:ssh_decode(Key, ssh2_pubkey), - f = F, - h_sig = decode_signature(Hashsign) - }; - -decode(<<"ecdh",?BYTE(?SSH_MSG_KEX_ECDH_INIT), ?DEC_MPINT(Q_c,__0)>>) -> - #ssh_msg_kex_ecdh_init{ - q_c = Q_c - }; - -decode(<<"ecdh",?BYTE(?SSH_MSG_KEX_ECDH_REPLY), - ?DEC_BIN(Key,__1), ?DEC_MPINT(Q_s,__2), ?DEC_BIN(Sig,__3)>>) -> - #ssh_msg_kex_ecdh_reply{ - public_host_key = public_key:ssh_decode(Key, ssh2_pubkey), - q_s = Q_s, - h_sig = decode_signature(Sig) +decode(<>) -> + #ssh_msg_kexdh_reply{ + public_host_key = decode_host_key(Key), + f = erlint(Len1, F), + h_sig = decode_sign(Hashsign) }; -decode(<>) -> +decode(<>) -> #ssh_msg_service_request{ name = unicode:characters_to_list(Service) }; -decode(<>) -> +decode(<>) -> #ssh_msg_service_accept{ name = unicode:characters_to_list(Service) }; -decode(<>) -> +decode(<>) -> #ssh_msg_disconnect{ code = Code, description = unicode:characters_to_list(Desc), @@ -494,7 +462,8 @@ }; %% Accept bad disconnects from ancient openssh clients that doesn't send language tag. Use english as a work-around. -decode(<>) -> +decode(<>) -> #ssh_msg_disconnect{ code = Code, description = unicode:characters_to_list(Desc), @@ -504,25 +473,21 @@ decode(<>) -> #ssh_msg_newkeys{}; -decode(<>) -> +decode(<>) -> #ssh_msg_ignore{data = Data}; decode(<>) -> #ssh_msg_unimplemented{sequence = Seq}; -decode(<>) -> +decode(<>) -> #ssh_msg_debug{always_display = erl_boolean(Bool), message = Msg, language = Lang}. -%%%================================================================ -%%% -%%% Helper functions -%%% - decode_keyboard_interactive_prompts(<<>>, Acc) -> lists:reverse(Acc); -decode_keyboard_interactive_prompts(<>, +decode_keyboard_interactive_prompts(<>, Acc) -> decode_keyboard_interactive_prompts(Bin, [{Prompt, erl_boolean(Bool)} | Acc]). @@ -533,30 +498,45 @@ decode_kex_init(<>, Acc, 0) -> list_to_tuple(lists:reverse([X, erl_boolean(Bool) | Acc])); -decode_kex_init(<>, Acc, 0) -> - %% The mandatory trailing UINT32 is missing. Assume the value it anyhow must have - %% See rfc 4253 7.1 - X = 0, - list_to_tuple(lists:reverse([X, erl_boolean(Bool) | Acc])); -decode_kex_init(<>, Acc, N) -> +decode_kex_init(<>, Acc, N) -> Names = string:tokens(unicode:characters_to_list(Data), ","), decode_kex_init(Rest, [Names | Acc], N -1). +erlint(MPIntSize, MPIntValue) -> + Bits = MPIntSize * 8, + <> = MPIntValue, + Integer. -%%%================================================================ -%%% -%%% Signature decode/encode -%%% - -decode_signature(<>) -> +decode_sign(<>) -> Signature. +decode_host_key(<>) -> + decode_host_key(Alg, Rest). -encode_signature(#'RSAPublicKey'{}, Signature) -> +decode_host_key(<<"ssh-rsa">>, <>) -> + #'RSAPublicKey'{publicExponent = erlint(Len0, E), + modulus = erlint(Len1, N)}; + +decode_host_key(<<"ssh-dss">>, + <>) -> + {erlint(Len3, Y), #'Dss-Parms'{p = erlint(Len0, P), q = erlint(Len1, Q), + g = erlint(Len2, G)}}. + +encode_host_key(#'RSAPublicKey'{modulus = N, publicExponent = E}) -> + ssh_bits:encode(["ssh-rsa", E, N], [string, mpint, mpint]); +encode_host_key({Y, #'Dss-Parms'{p = P, q = Q, g = G}}) -> + ssh_bits:encode(["ssh-dss", P, Q, G, Y], + [string, mpint, mpint, mpint, mpint]); +encode_host_key(#'RSAPrivateKey'{modulus = N, publicExponent = E}) -> + ssh_bits:encode(["ssh-rsa", E, N], [string, mpint, mpint]); +encode_host_key(#'DSAPrivateKey'{y = Y, p = P, q = Q, g = G}) -> + ssh_bits:encode(["ssh-dss", P, Q, G, Y], + [string, mpint, mpint, mpint, mpint]). +encode_sign(#'RSAPrivateKey'{}, Signature) -> ssh_bits:encode(["ssh-rsa", Signature],[string, binary]); -encode_signature({_, #'Dss-Parms'{}}, Signature) -> - ssh_bits:encode(["ssh-dss", Signature],[string, binary]); -encode_signature({#'ECPoint'{}, {namedCurve,OID}}, Signature) -> - CurveName = public_key:oid2ssh_curvename(OID), - ssh_bits:encode([<<"ecdsa-sha2-",CurveName/binary>>, Signature], [binary,binary]). - +encode_sign(#'DSAPrivateKey'{}, Signature) -> + ssh_bits:encode(["ssh-dss", Signature],[string, binary]). diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_no_io.erl erlang-17.3-dfsg/lib/ssh/src/ssh_no_io.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_no_io.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_no_io.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_server_key_api.erl erlang-17.3-dfsg/lib/ssh/src/ssh_server_key_api.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_server_key_api.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_server_key_api.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_server_key.erl erlang-17.3-dfsg/lib/ssh/src/ssh_server_key.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_server_key.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_server_key.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_sftpd.erl erlang-17.3-dfsg/lib/ssh/src/ssh_sftpd.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_sftpd.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_sftpd.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2015. All Rights Reserved. +%% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,7 +29,6 @@ -include("ssh.hrl"). -include("ssh_xfer.hrl"). --include("ssh_connect.hrl"). %% For ?DEFAULT_PACKET_SIZE and ?DEFAULT_WINDOW_SIZE %%-------------------------------------------------------------------- %% External exports @@ -48,7 +46,6 @@ file_handler, % atom() - callback module file_state, % state for the file callback module max_files, % integer >= 0 max no files sent during READDIR - options, % from the subsystem declaration handles % list of open handles %% handle is either {, directory, {Path, unread|eof}} or %% {, file, {Path, IoDevice}} @@ -123,7 +120,6 @@ MaxLength = proplists:get_value(max_files, Options, 0), Vsn = proplists:get_value(sftpd_vsn, Options, 5), {ok, State#state{cwd = CWD, root = Root, max_files = MaxLength, - options = Options, handles = [], pending = <<>>, xf = #ssh_xfer{vsn = Vsn, ext = []}}}. @@ -167,9 +163,7 @@ %% Description: Handles other messages %%-------------------------------------------------------------------- handle_msg({ssh_channel_up, ChannelId, ConnectionManager}, - #state{xf = Xf, - options = Options} = State) -> - maybe_increase_recv_window(ConnectionManager, ChannelId, Options), + #state{xf =Xf} = State) -> {ok, State#state{xf = Xf#ssh_xfer{cm = ConnectionManager, channel = ChannelId}}}. @@ -565,73 +559,56 @@ send_status({error, E}, ReqId, State1) end. -sftp_to_erlang_flag(read, Vsn) when Vsn == 3; - Vsn == 4 -> - read; -sftp_to_erlang_flag(write, Vsn) when Vsn == 3; - Vsn == 4 -> - write; -sftp_to_erlang_flag(append, Vsn) when Vsn == 3; - Vsn == 4 -> - append; -sftp_to_erlang_flag(creat, Vsn) when Vsn == 3; - Vsn == 4 -> - write; -sftp_to_erlang_flag(trunc, Vsn) when Vsn == 3; - Vsn == 4 -> - write; -sftp_to_erlang_flag(excl, Vsn) when Vsn == 3; - Vsn == 4 -> - read; -sftp_to_erlang_flag(create_new, Vsn) when Vsn > 4 -> - write; -sftp_to_erlang_flag(create_truncate, Vsn) when Vsn > 4 -> - write; -sftp_to_erlang_flag(open_existing, Vsn) when Vsn > 4 -> - read; -sftp_to_erlang_flag(open_or_create, Vsn) when Vsn > 4 -> - write; -sftp_to_erlang_flag(truncate_existing, Vsn) when Vsn > 4 -> - write; -sftp_to_erlang_flag(append_data, Vsn) when Vsn > 4 -> - append; -sftp_to_erlang_flag(append_data_atomic, Vsn) when Vsn > 4 -> - append; -sftp_to_erlang_flag(_, _) -> - read. +decode_4_open_flag(create_new) -> + [write]; +decode_4_open_flag(create_truncate) -> + [write]; +decode_4_open_flag(truncate_existing) -> + [write]; +decode_4_open_flag(open_existing) -> + [read]. + +decode_4_flags([OpenFlag | Flags]) -> + decode_4_flags(Flags, decode_4_open_flag(OpenFlag)). + +decode_4_flags([], Flags) -> + Flags; +decode_4_flags([append_data|R], _Flags) -> + decode_4_flags(R, [append]); +decode_4_flags([append_data_atomic|R], _Flags) -> + decode_4_flags(R, [append]); +decode_4_flags([_|R], Flags) -> + decode_4_flags(R, Flags). + +decode_4_access_flag(read_data) -> + [read]; +decode_4_access_flag(list_directory) -> + [read]; +decode_4_access_flag(write_data) -> + [write]; +decode_4_access_flag(add_file) -> + [write]; +decode_4_access_flag(add_subdirectory) -> + [read]; +decode_4_access_flag(append_data) -> + [append]; +decode_4_access_flag(write_attributes) -> + [write]; +decode_4_access_flag(_) -> + [read]. -sftp_to_erlang_flags(Flags, Vsn) -> +decode_4_acess([_ | _] = Flags) -> lists:map(fun(Flag) -> - sftp_to_erlang_flag(Flag, Vsn) - end, Flags). - -sftp_to_erlang_access_flag(read_data, _) -> - read; -sftp_to_erlang_access_flag(list_directory, _) -> - read; -sftp_to_erlang_access_flag(write_data, _) -> - write; -sftp_to_erlang_access_flag(append_data, _) -> - append; -sftp_to_erlang_access_flag(add_subdirectory, _) -> - read; -sftp_to_erlang_access_flag(add_file, _) -> - write; -sftp_to_erlang_access_flag(write_attributes, _) -> - write; -sftp_to_erlang_access_flag(_, _) -> - read. -sftp_to_erlang_access_flags(Flags, Vsn) -> - lists:map(fun(Flag) -> - sftp_to_erlang_access_flag(Flag, Vsn) - end, Flags). + [decode_4_access_flag(Flag)] + end, Flags); +decode_4_acess([]) -> + []. open(Vsn, ReqId, Data, State) when Vsn =< 3 -> <> = Data, Path = unicode:characters_to_list(BPath), - FlagBits = ssh_xfer:decode_open_flags(Vsn, PFlags), - Flags = lists:usort(sftp_to_erlang_flags(FlagBits, Vsn)), + Flags = ssh_xfer:decode_open_flags(Vsn, PFlags), do_open(ReqId, State, Path, Flags); open(Vsn, ReqId, Data, State) when Vsn >= 4 -> < @@ -939,18 +919,3 @@ {Status, FS1} = FileMod:rename(Path, Path2, FS0), State1 = State0#state{file_state = FS1}, send_status(Status, ReqId, State1). - - -maybe_increase_recv_window(ConnectionManager, ChannelId, Options) -> - WantedRecvWindowSize = - proplists:get_value(recv_window_size, Options, 1000000), - NumPkts = WantedRecvWindowSize div ?DEFAULT_PACKET_SIZE, - Increment = NumPkts*?DEFAULT_PACKET_SIZE - ?DEFAULT_WINDOW_SIZE, - - if - Increment > 0 -> - ssh_connection:adjust_window(ConnectionManager, ChannelId, - Increment); - Increment =< 0 -> - do_nothing - end. diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_sftpd_file_api.erl erlang-17.3-dfsg/lib/ssh/src/ssh_sftpd_file_api.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_sftpd_file_api.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_sftpd_file_api.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_sftpd_file.erl erlang-17.3-dfsg/lib/ssh/src/ssh_sftpd_file.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_sftpd_file.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_sftpd_file.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_sftp.erl erlang-17.3-dfsg/lib/ssh/src/ssh_sftp.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_sftp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_sftp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2014. All Rights Reserved. +%% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -34,8 +33,8 @@ -export([start_channel/1, start_channel/2, start_channel/3, stop_channel/1]). --export([open/3, open_tar/3, opendir/2, close/2, readdir/2, pread/4, read/3, - open/4, open_tar/4, opendir/3, close/3, readdir/3, pread/5, read/4, +-export([open/3, opendir/2, close/2, readdir/2, pread/4, read/3, + open/4, opendir/3, close/3, readdir/3, pread/5, read/4, apread/4, aread/3, pwrite/4, write/3, apwrite/4, awrite/3, pwrite/5, write/4, position/3, real_path/2, read_file_info/2, get_file_info/2, @@ -58,8 +57,7 @@ rep_buf = <<>>, req_id, req_list = [], %% {ReqId, Fun} - inf, %% list of fileinf, - opts + inf %% list of fileinf }). -record(fileinf, @@ -70,18 +68,6 @@ mode }). --record(bufinf, - { - mode, % read | write (=from or to buffer by user) - crypto_state, - crypto_fun, % For encode or decode depending on the mode field - size = 0, % # bytes "before" the current buffer for the postion call - - chunksize, % The size of the chunks to be sent or received - enc_text_buf = <<>>, % Encrypted text - plain_text_buf = <<>> % Decrypted text - }). - -define(FILEOP_TIMEOUT, infinity). -define(NEXT_REQID(S), @@ -99,11 +85,10 @@ start_channel(Host, []). start_channel(Cm, Opts) when is_pid(Cm) -> Timeout = proplists:get_value(timeout, Opts, infinity), - {_, SftpOpts} = handle_options(Opts, [], []), case ssh_xfer:attach(Cm, []) of {ok, ChannelId, Cm} -> case ssh_channel:start(Cm, ChannelId, - ?MODULE, [Cm, ChannelId, SftpOpts]) of + ?MODULE, [Cm, ChannelId, Timeout]) of {ok, Pid} -> case wait_for_version_negotiation(Pid, Timeout) of ok -> @@ -112,7 +97,7 @@ TimeOut end; {error, Reason} -> - {error, format_channel_start_error(Reason)}; + {error, Reason}; ignore -> {error, ignore} end; @@ -123,12 +108,11 @@ start_channel(Host, Opts) -> start_channel(Host, 22, Opts). start_channel(Host, Port, Opts) -> - {SshOpts, SftpOpts} = handle_options(Opts, [], []), - Timeout = proplists:get_value(timeout, SftpOpts, infinity), - case ssh_xfer:connect(Host, Port, SshOpts, Timeout) of + Timeout = proplists:get_value(timeout, Opts, infinity), + case ssh_xfer:connect(Host, Port, proplists:delete(timeout, Opts)) of {ok, ChannelId, Cm} -> case ssh_channel:start(Cm, ChannelId, ?MODULE, [Cm, - ChannelId, SftpOpts]) of + ChannelId, Timeout]) of {ok, Pid} -> case wait_for_version_negotiation(Pid, Timeout) of ok -> @@ -137,7 +121,7 @@ TimeOut end; {error, Reason} -> - {error, format_channel_start_error(Reason)}; + {error, Reason}; ignore -> {error, ignore} end; @@ -175,77 +159,6 @@ open(Pid, File, Mode, FileOpTimeout) -> call(Pid, {open, false, File, Mode}, FileOpTimeout). -open_tar(Pid, File, Mode) -> - open_tar(Pid, File, Mode, ?FILEOP_TIMEOUT). -open_tar(Pid, File, Mode, FileOpTimeout) -> - case {lists:member(write,Mode), - lists:member(read,Mode), - Mode -- [read,write]} of - {true,false,[]} -> - {ok,Handle} = open(Pid, File, [write], FileOpTimeout), - erl_tar:init(Pid, write, - fun(write, {_,Data}) -> - write_to_remote_tar(Pid, Handle, to_bin(Data), FileOpTimeout); - (position, {_,Pos}) -> - position(Pid, Handle, Pos, FileOpTimeout); - (close, _) -> - close(Pid, Handle, FileOpTimeout) - end); - {true,false,[{crypto,{CryptoInitFun,CryptoEncryptFun,CryptoEndFun}}]} -> - {ok,SftpHandle} = open(Pid, File, [write], FileOpTimeout), - BI = #bufinf{mode = write, - crypto_fun = CryptoEncryptFun}, - {ok,BufHandle} = open_buf(Pid, CryptoInitFun, BI, FileOpTimeout), - erl_tar:init(Pid, write, - fun(write, {_,Data}) -> - write_buf(Pid, SftpHandle, BufHandle, to_bin(Data), FileOpTimeout); - (position, {_,Pos}) -> - position_buf(Pid, SftpHandle, BufHandle, Pos, FileOpTimeout); - (close, _) -> - {ok,#bufinf{ - plain_text_buf = PlainBuf0, - enc_text_buf = EncBuf0, - crypto_state = CState0 - }} = call(Pid, {get_bufinf,BufHandle}, FileOpTimeout), - {ok,EncTextTail} = CryptoEndFun(PlainBuf0, CState0), - EncTextBuf = <>, - case write(Pid, SftpHandle, EncTextBuf, FileOpTimeout) of - ok -> - call(Pid, {erase_bufinf,BufHandle}, FileOpTimeout), - close(Pid, SftpHandle, FileOpTimeout); - Other -> - Other - end - end); - {false,true,[]} -> - {ok,Handle} = open(Pid, File, [read,binary], FileOpTimeout), - erl_tar:init(Pid, read, - fun(read2, {_,Len}) -> - read_repeat(Pid, Handle, Len, FileOpTimeout); - (position, {_,Pos}) -> - position(Pid, Handle, Pos, FileOpTimeout); - (close, _) -> - close(Pid, Handle, FileOpTimeout) - end); - {false,true,[{crypto,{CryptoInitFun,CryptoDecryptFun}}]} -> - {ok,SftpHandle} = open(Pid, File, [read,binary], FileOpTimeout), - BI = #bufinf{mode = read, - crypto_fun = CryptoDecryptFun}, - {ok,BufHandle} = open_buf(Pid, CryptoInitFun, BI, FileOpTimeout), - erl_tar:init(Pid, read, - fun(read2, {_,Len}) -> - read_buf(Pid, SftpHandle, BufHandle, Len, FileOpTimeout); - (position, {_,Pos}) -> - position_buf(Pid, SftpHandle, BufHandle, Pos, FileOpTimeout); - (close, _) -> - call(Pid, {erase_bufinf,BufHandle}, FileOpTimeout), - close(Pid, SftpHandle, FileOpTimeout) - end); - _ -> - {error,{illegal_mode,Mode}} - end. - - opendir(Pid, Path) -> opendir(Pid, Path, ?FILEOP_TIMEOUT). opendir(Pid, Path, FileOpTimeout) -> @@ -439,7 +352,7 @@ write_file(Pid, Name, List, ?FILEOP_TIMEOUT). write_file(Pid, Name, List, FileOpTimeout) when is_list(List) -> - write_file(Pid, Name, list_to_binary(List), FileOpTimeout); + write_file(Pid, Name, unicode:characters_to_binary(List), FileOpTimeout); write_file(Pid, Name, Bin, FileOpTimeout) -> case open(Pid, Name, [write, binary], FileOpTimeout) of {ok, Handle} -> @@ -479,8 +392,7 @@ %% %% Description: %%-------------------------------------------------------------------- -init([Cm, ChannelId, Options]) -> - Timeout = proplists:get_value(timeout, Options, infinity), +init([Cm, ChannelId, Timeout]) -> erlang:monitor(process, Cm), case ssh_connection:subsystem(Cm, ChannelId, "sftp", Timeout) of success -> @@ -489,12 +401,11 @@ {ok, #state{xf = Xf, req_id = 0, rep_buf = <<>>, - inf = new_inf(), - opts = Options}}; + inf = new_inf()}}; failure -> - {stop, {shutdown, "server failed to start sftp subsystem"}}; + {stop, "server failed to start sftp subsystem"}; Error -> - {stop, {shutdown, Error}} + {stop, Error} end. %%-------------------------------------------------------------------- @@ -509,12 +420,12 @@ %%-------------------------------------------------------------------- handle_call({{timeout, infinity}, wait_for_version_negotiation}, From, #state{xf = #ssh_xfer{vsn = undefined} = Xf} = State) -> - {noreply, State#state{xf = Xf#ssh_xfer{vsn = {wait, From, undefined}}}}; + {noreply, State#state{xf = Xf#ssh_xfer{vsn = From}}}; handle_call({{timeout, Timeout}, wait_for_version_negotiation}, From, #state{xf = #ssh_xfer{vsn = undefined} = Xf} = State) -> - TRef = erlang:send_after(Timeout, self(), {timeout, undefined, From}), - {noreply, State#state{xf = Xf#ssh_xfer{vsn = {wait, From, TRef}}}}; + timer:send_after(Timeout, {timeout, undefined, From}), + {noreply, State#state{xf = Xf#ssh_xfer{vsn = From}}}; handle_call({_, wait_for_version_negotiation}, _, State) -> {reply, ok, State}; @@ -531,15 +442,6 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}. -do_handle_call({get_bufinf,BufHandle}, _From, S=#state{inf=I0}) -> - {reply, dict:find(BufHandle,I0), S}; - -do_handle_call({put_bufinf,BufHandle,B}, _From, S=#state{inf=I0}) -> - {reply, ok, S#state{inf=dict:store(BufHandle,B,I0)}}; - -do_handle_call({erase_bufinf,BufHandle}, _From, S=#state{inf=I0}) -> - {reply, ok, S#state{inf=dict:erase(BufHandle,I0)}}; - do_handle_call({open, Async,FileName,Mode}, From, #state{xf = XF} = State) -> {Access,Flags,Attrs} = open_mode(XF#ssh_xfer.vsn, Mode), ReqID = State#state.req_id, @@ -611,7 +513,8 @@ fun({ok,Data}, State2) -> case get_mode(Handle, State2) of binary -> {{ok,Data}, State2}; - text -> {{ok,binary_to_list(Data)}, State2} + text -> + {{ok,unicode:characters_to_list(Data)}, State2} end; (Rep, State2) -> {Rep, State2} @@ -643,7 +546,12 @@ do_handle_call({pwrite,Async,Handle,At,Data0}, From, State) -> case lseek_position(Handle, At, State) of {ok,Offset} -> - Data = to_bin(Data0), + Data = if + is_binary(Data0) -> + Data0; + is_list(Data0) -> + list_to_binary(Data0) + end, ReqID = State#state.req_id, Size = size(Data), ssh_xfer:write(?XF(State),ReqID,Handle,Offset,Data), @@ -656,7 +564,12 @@ do_handle_call({write,Async,Handle,Data0}, From, State) -> case lseek_position(Handle, cur, State) of {ok,Offset} -> - Data = to_bin(Data0), + Data = if + is_binary(Data0) -> + Data0; + is_list(Data0) -> + list_to_binary(Data0) + end, ReqID = State#state.req_id, Size = size(Data), ssh_xfer:write(?XF(State),ReqID,Handle,Offset,Data), @@ -794,9 +707,8 @@ %% %% Description: Handles channel messages %%-------------------------------------------------------------------- -handle_msg({ssh_channel_up, _, _}, #state{opts = Options, xf = Xf} = State) -> - Version = proplists:get_value(sftp_vsn, Options, ?SSH_SFTP_PROTOCOL_VERSION), - ssh_xfer:protocol_version_request(Xf, Version), +handle_msg({ssh_channel_up, _, _}, #state{xf = Xf} = State) -> + ssh_xfer:protocol_version_request(Xf), {ok, State}; %% Version negotiation timed out @@ -842,15 +754,6 @@ %%==================================================================== %% Internal functions %%==================================================================== -handle_options([], Sftp, Ssh) -> - {Ssh, Sftp}; -handle_options([{timeout, _} = Opt | Rest], Sftp, Ssh) -> - handle_options(Rest, [Opt | Sftp], Ssh); -handle_options([{sftp_vsn, _} = Opt| Rest], Sftp, Ssh) -> - handle_options(Rest, [Opt | Sftp], Ssh); -handle_options([Opt | Rest], Sftp, Ssh) -> - handle_options(Rest, Sftp, [Opt | Ssh]). - call(Pid, Msg, TimeOut) -> ssh_channel:call(Pid, {{timeout, TimeOut}, Msg}, infinity). @@ -865,12 +768,7 @@ case Xf#ssh_xfer.vsn of undefined -> ok; - {wait, From, TRef} -> - if is_reference(TRef) -> - erlang:cancel_timer(TRef); - true -> - ok - end, + From -> ssh_channel:reply(From, ok) end, State#state{xf = Xf#ssh_xfer{vsn = Version, ext = Ext}, rep_buf = Rest}; @@ -1213,212 +1111,5 @@ end; lseek_pos(_, _, _) -> {error, einval}. + -%%%================================================================ -%%% -to_bin(Data) when is_list(Data) -> list_to_binary(Data); -to_bin(Data) when is_binary(Data) -> Data. - - -read_repeat(Pid, Handle, Len, FileOpTimeout) -> - {ok,{_WindowSz,PacketSz}} = recv_window(Pid, FileOpTimeout), - read_rpt(Pid, Handle, Len, PacketSz, FileOpTimeout, <<>>). - -read_rpt(Pid, Handle, WantedLen, PacketSz, FileOpTimeout, Acc) when WantedLen > 0 -> - case read(Pid, Handle, min(WantedLen,PacketSz), FileOpTimeout) of - {ok, Data} -> - read_rpt(Pid, Handle, WantedLen-size(Data), PacketSz, FileOpTimeout, <>); - eof -> - {ok, Acc}; - Error -> - Error - end; -read_rpt(_Pid, _Handle, WantedLen, _PacketSz, _FileOpTimeout, Acc) when WantedLen >= 0 -> - {ok,Acc}. - - -write_to_remote_tar(_Pid, _SftpHandle, <<>>, _FileOpTimeout) -> - ok; -write_to_remote_tar(Pid, SftpHandle, Bin, FileOpTimeout) -> - {ok,{_Window,Packet}} = send_window(Pid, FileOpTimeout), - write_file_loop(Pid, SftpHandle, 0, Bin, size(Bin), Packet, FileOpTimeout). - -position_buf(Pid, SftpHandle, BufHandle, Pos, FileOpTimeout) -> - {ok,#bufinf{mode = Mode, - plain_text_buf = Buf0, - size = Size}} = call(Pid, {get_bufinf,BufHandle}, FileOpTimeout), - case Pos of - {cur,0} when Mode==write -> - {ok,Size+size(Buf0)}; - - {cur,0} when Mode==read -> - {ok,Size}; - - _ when Mode==read, is_integer(Pos) -> - Skip = Pos-Size, - if - Skip < 0 -> - {error, cannot_rewind}; - Skip == 0 -> - %% Optimization - {ok,Pos}; - Skip > 0 -> - case read_buf(Pid, SftpHandle, BufHandle, Skip, FileOpTimeout) of - %% A bit innefficient to fetch the bufinf again, but there are lots of - %% other more important optimizations waiting.... - {ok,_} -> - {ok,Pos}; - Other -> - Other - end - end; - - _ -> - {error,{not_yet_implemented,{pos,Pos}}} - end. - -read_buf(Pid, SftpHandle, BufHandle, WantedLen, FileOpTimeout) -> - {ok,{_Window,Packet}} = send_window(Pid, FileOpTimeout), - {ok,B0} = call(Pid, {get_bufinf,BufHandle}, FileOpTimeout), - case do_the_read_buf(Pid, SftpHandle, WantedLen, Packet, FileOpTimeout, B0) of - {ok,ResultBin,B} -> - call(Pid, {put_bufinf,BufHandle,B}, FileOpTimeout), - {ok,ResultBin}; - {error,Error} -> - {error,Error}; - {eof,B} -> - call(Pid, {put_bufinf,BufHandle,B}, FileOpTimeout), - eof - end. - -do_the_read_buf(_Pid, _SftpHandle, WantedLen, _Packet, _FileOpTimeout, - B=#bufinf{plain_text_buf=PlainBuf0, - size = Size}) - when size(PlainBuf0) >= WantedLen -> - %% We already have the wanted number of bytes decoded and ready! - <> = PlainBuf0, - {ok,ResultBin,B#bufinf{plain_text_buf=PlainBuf, - size = Size + WantedLen}}; - -do_the_read_buf(Pid, SftpHandle, WantedLen, Packet, FileOpTimeout, - B0=#bufinf{plain_text_buf = PlainBuf0, - enc_text_buf = EncBuf0, - chunksize = undefined - }) - when size(EncBuf0) > 0 -> - %% We have (at least) one decodable byte waiting for decodeing. - {ok,DecodedBin,B} = apply_crypto(EncBuf0, B0), - do_the_read_buf(Pid, SftpHandle, WantedLen, Packet, FileOpTimeout, - B#bufinf{plain_text_buf = <>, - enc_text_buf = <<>> - }); - -do_the_read_buf(Pid, SftpHandle, WantedLen, Packet, FileOpTimeout, - B0=#bufinf{plain_text_buf = PlainBuf0, - enc_text_buf = EncBuf0, - chunksize = ChunkSize0 - }) - when size(EncBuf0) >= ChunkSize0 -> - %% We have (at least) one chunk of decodable bytes waiting for decodeing. - <> = EncBuf0, - {ok,DecodedBin,B} = apply_crypto(ToDecode, B0), - do_the_read_buf(Pid, SftpHandle, WantedLen, Packet, FileOpTimeout, - B#bufinf{plain_text_buf = <>, - enc_text_buf = EncBuf - }); - -do_the_read_buf(Pid, SftpHandle, WantedLen, Packet, FileOpTimeout, B=#bufinf{enc_text_buf = EncBuf0}) -> - %% We must read more bytes and append to the buffer of encoded bytes. - case read(Pid, SftpHandle, Packet, FileOpTimeout) of - {ok,EncryptedBin} -> - do_the_read_buf(Pid, SftpHandle, WantedLen, Packet, FileOpTimeout, - B#bufinf{enc_text_buf = <>}); - eof -> - {eof,B}; - Other -> - Other - end. - - -write_buf(Pid, SftpHandle, BufHandle, PlainBin, FileOpTimeout) -> - {ok,{_Window,Packet}} = send_window(Pid, FileOpTimeout), - {ok,B0=#bufinf{plain_text_buf=PTB}} = call(Pid, {get_bufinf,BufHandle}, FileOpTimeout), - case do_the_write_buf(Pid, SftpHandle, Packet, FileOpTimeout, - B0#bufinf{plain_text_buf = <>}) of - {ok, B} -> - call(Pid, {put_bufinf,BufHandle,B}, FileOpTimeout), - ok; - {error,Error} -> - {error,Error} - end. - -do_the_write_buf(Pid, SftpHandle, Packet, FileOpTimeout, - B=#bufinf{enc_text_buf = EncBuf0, - size = Size}) - when size(EncBuf0) >= Packet -> - <> = EncBuf0, - case write(Pid, SftpHandle, BinToWrite, FileOpTimeout) of - ok -> - do_the_write_buf(Pid, SftpHandle, Packet, FileOpTimeout, - B#bufinf{enc_text_buf = EncBuf, - size = Size + Packet}); - Other -> - Other - end; - -do_the_write_buf(Pid, SftpHandle, Packet, FileOpTimeout, - B0=#bufinf{plain_text_buf = PlainBuf0, - enc_text_buf = EncBuf0, - chunksize = undefined}) - when size(PlainBuf0) > 0 -> - {ok,EncodedBin,B} = apply_crypto(PlainBuf0, B0), - do_the_write_buf(Pid, SftpHandle, Packet, FileOpTimeout, - B#bufinf{plain_text_buf = <<>>, - enc_text_buf = <>}); - -do_the_write_buf(Pid, SftpHandle, Packet, FileOpTimeout, - B0=#bufinf{plain_text_buf = PlainBuf0, - enc_text_buf = EncBuf0, - chunksize = ChunkSize0 - }) - when size(PlainBuf0) >= ChunkSize0 -> - <> = PlainBuf0, - {ok,EncodedBin,B} = apply_crypto(ToEncode, B0), - do_the_write_buf(Pid, SftpHandle, Packet, FileOpTimeout, - B#bufinf{plain_text_buf = PlainBuf, - enc_text_buf = <>}); - -do_the_write_buf(_Pid, _SftpHandle, _Packet, _FileOpTimeout, B) -> - {ok,B}. - -apply_crypto(In, B=#bufinf{crypto_state = CState0, - crypto_fun = F}) -> - case F(In,CState0) of - {ok,EncodedBin,CState} -> - {ok, EncodedBin, B#bufinf{crypto_state=CState}}; - {ok,EncodedBin,CState,ChunkSize} -> - {ok, EncodedBin, B#bufinf{crypto_state=CState, - chunksize=ChunkSize}} - end. - -open_buf(Pid, CryptoInitFun, BufInfo0, FileOpTimeout) -> - case CryptoInitFun() of - {ok,CryptoState} -> - open_buf1(Pid, BufInfo0, FileOpTimeout, CryptoState, undefined); - {ok,CryptoState,ChunkSize} -> - open_buf1(Pid, BufInfo0, FileOpTimeout, CryptoState, ChunkSize); - Other -> - Other - end. - -open_buf1(Pid, BufInfo0, FileOpTimeout, CryptoState, ChunkSize) -> - BufInfo = BufInfo0#bufinf{crypto_state = CryptoState, - chunksize = ChunkSize}, - BufHandle = make_ref(), - call(Pid, {put_bufinf,BufHandle,BufInfo}, FileOpTimeout), - {ok,BufHandle}. - -format_channel_start_error({shutdown, Reason}) -> - Reason; -format_channel_start_error(Reason) -> - Reason. diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_shell.erl erlang-17.3-dfsg/lib/ssh/src/ssh_shell.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_shell.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_shell.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_subsystem_sup.erl erlang-17.3-dfsg/lib/ssh/src/ssh_subsystem_sup.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_subsystem_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_subsystem_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_sup.erl erlang-17.3-dfsg/lib/ssh/src/ssh_sup.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_system_sup.erl erlang-17.3-dfsg/lib/ssh/src/ssh_system_sup.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_system_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_system_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2014. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,15 +28,13 @@ -behaviour(supervisor). --include("ssh.hrl"). - -export([start_link/1, stop_listener/1, - stop_listener/3, stop_system/1, - stop_system/3, system_supervisor/3, + stop_listener/2, stop_system/1, + stop_system/2, system_supervisor/2, subsystem_supervisor/1, channel_supervisor/1, connection_supervisor/1, - acceptor_supervisor/1, start_subsystem/2, restart_subsystem/3, - restart_acceptor/3, stop_subsystem/2]). + acceptor_supervisor/1, start_subsystem/2, restart_subsystem/2, + restart_acceptor/2, stop_subsystem/2]). %% Supervisor callback -export([init/1]). @@ -48,15 +45,14 @@ start_link(ServerOpts) -> Address = proplists:get_value(address, ServerOpts), Port = proplists:get_value(port, ServerOpts), - Profile = proplists:get_value(profile, proplists:get_value(ssh_opts, ServerOpts), ?DEFAULT_PROFILE), - Name = make_name(Address, Port, Profile), + Name = make_name(Address, Port), supervisor:start_link({local, Name}, ?MODULE, [ServerOpts]). stop_listener(SysSup) -> stop_acceptor(SysSup). -stop_listener(Address, Port, Profile) -> - Name = make_name(Address, Port, Profile), +stop_listener(Address, Port) -> + Name = make_name(Address, Port), stop_acceptor(whereis(Name)). stop_system(SysSup) -> @@ -64,12 +60,12 @@ spawn(fun() -> sshd_sup:stop_child(Name) end), ok. -stop_system(Address, Port, Profile) -> - spawn(fun() -> sshd_sup:stop_child(Address, Port, Profile) end), +stop_system(Address, Port) -> + spawn(fun() -> sshd_sup:stop_child(Address, Port) end), ok. -system_supervisor(Address, Port, Profile) -> - Name = make_name(Address, Port, Profile), +system_supervisor(Address, Port) -> + Name = make_name(Address, Port), whereis(Name). subsystem_supervisor(SystemSup) -> @@ -107,9 +103,9 @@ end. -restart_subsystem(Address, Port, Profile) -> - SysSupName = make_name(Address, Port, Profile), - SubSysName = id(ssh_subsystem_sup, Address, Port, Profile), +restart_subsystem(Address, Port) -> + SysSupName = make_name(Address, Port), + SubSysName = id(ssh_subsystem_sup, Address, Port), case supervisor:terminate_child(SysSupName, SubSysName) of ok -> supervisor:restart_child(SysSupName, SubSysName); @@ -117,9 +113,9 @@ Error end. -restart_acceptor(Address, Port, Profile) -> - SysSupName = make_name(Address, Port, Profile), - AcceptorName = id(ssh_acceptor_sup, Address, Port, Profile), +restart_acceptor(Address, Port) -> + SysSupName = make_name(Address, Port), + AcceptorName = id(ssh_acceptor_sup, Address, Port), supervisor:restart_child(SysSupName, AcceptorName). %%%========================================================================= @@ -141,8 +137,7 @@ ssh_acceptor_child_spec(ServerOpts) -> Address = proplists:get_value(address, ServerOpts), Port = proplists:get_value(port, ServerOpts), - Profile = proplists:get_value(profile, proplists:get_value(ssh_opts, ServerOpts), ?DEFAULT_PROFILE), - Name = id(ssh_acceptor_sup, Address, Port, Profile), + Name = id(ssh_acceptor_sup, Address, Port), StartFunc = {ssh_acceptor_sup, start_link, [ServerOpts]}, Restart = transient, Shutdown = infinity, @@ -160,23 +155,12 @@ {Name, StartFunc, Restart, Shutdown, Type, Modules}. -id(Sup, Address, Port, Profile) -> - case is_list(Address) of - true -> - {Sup, any, Port, Profile}; - false -> - {Sup, Address, Port, Profile} - end. +id(Sup, Address, Port) -> + {Sup, Address, Port}. -make_name(Address, Port, Profile) -> - case is_list(Address) of - true -> - list_to_atom(lists:flatten(io_lib:format("ssh_system_~p_~p_~p_sup", - [any, Port, Profile]))); - false -> - list_to_atom(lists:flatten(io_lib:format("ssh_system_~p_~p_~p_sup", - [Address, Port, Profile]))) - end. +make_name(Address, Port) -> + list_to_atom(lists:flatten(io_lib:format("ssh_system_~p_~p_sup", + [Address, Port]))). ssh_subsystem_sup([{_, Child, _, [ssh_subsystem_sup]} | _]) -> Child; @@ -189,9 +173,8 @@ ssh_acceptor_sup(Rest). stop_acceptor(Sup) -> - [{Name, AcceptorSup}] = - [{SupName, ASup} || {SupName, ASup, _, [ssh_acceptor_sup]} <- + [Name] = + [SupName || {SupName, _, _, [ssh_acceptor_sup]} <- supervisor:which_children(Sup)], - supervisor:terminate_child(AcceptorSup, Name). - + supervisor:terminate_child(Sup, Name). diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_transport.erl erlang-17.3-dfsg/lib/ssh/src/ssh_transport.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_transport.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_transport.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2014. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -31,139 +30,26 @@ -include("ssh.hrl"). -export([versions/2, hello_version_msg/1]). --export([next_seqnum/1, - supported_algorithms/0, supported_algorithms/1, - default_algorithms/0, default_algorithms/1, - handle_packet_part/4, +-export([next_seqnum/1, decrypt_first_block/2, decrypt_blocks/3, + is_valid_mac/3, handle_hello_version/1, key_exchange_init_msg/1, key_init/3, new_keys_message/1, handle_kexinit_msg/3, handle_kexdh_init/2, - handle_kex_dh_gex_group/2, handle_kex_dh_gex_init/2, handle_kex_dh_gex_reply/2, + handle_kex_dh_gex_group/2, handle_kex_dh_gex_reply/2, handle_new_keys/2, handle_kex_dh_gex_request/2, handle_kexdh_reply/2, - handle_kex_ecdh_init/2, - handle_kex_ecdh_reply/2, - extract_public_key/1, - ssh_packet/2, pack/2, + unpack/3, decompress/2, ssh_packet/2, pack/2, msg_data/1, sign/3, verify/4]). -%%% For test suites --export([pack/3]). --export([decompress/2, decrypt_blocks/3, is_valid_mac/3 ]). % FIXME: remove - -%%%---------------------------------------------------------------------------- -%%% -%%% There is a difference between supported and default algorithms. The -%%% SUPPORTED algorithms can be handled (maybe untested...). The DEFAULT ones -%%% are announced in ssh_msg_kexinit and in ssh:default_algorithms/0 to the -%%% user. -%%% -%%% A supported algorithm can be requested in the option 'preferred_algorithms', -%%% but may give unexpected results before being promoted to default. -%%% -%%% This makes it possible to add experimental algorithms (in supported_algorithms) -%%% and test them without letting the default users know about them. -%%% - -default_algorithms() -> [{K,default_algorithms(K)} || K <- algo_classes()]. - -algo_classes() -> [kex, public_key, cipher, mac, compression]. - - -default_algorithms(cipher) -> - supported_algorithms(cipher, same(['AEAD_AES_128_GCM', - 'AEAD_AES_256_GCM'])); -default_algorithms(mac) -> - supported_algorithms(mac, same(['AEAD_AES_128_GCM', - 'AEAD_AES_256_GCM'])); -default_algorithms(Alg) -> - supported_algorithms(Alg, []). - - -supported_algorithms() -> [{K,supported_algorithms(K)} || K <- algo_classes()]. - -supported_algorithms(kex) -> - select_crypto_supported( - [ - {'ecdh-sha2-nistp256', [{public_keys,ecdh}, {ec_curve,secp256r1}, {hashs,sha256}]}, - {'ecdh-sha2-nistp384', [{public_keys,ecdh}, {ec_curve,secp384r1}, {hashs,sha384}]}, - {'diffie-hellman-group14-sha1', [{public_keys,dh}, {hashs,sha}]}, - {'diffie-hellman-group-exchange-sha256', [{public_keys,dh}, {hashs,sha256}]}, - {'diffie-hellman-group-exchange-sha1', [{public_keys,dh}, {hashs,sha}]}, - {'ecdh-sha2-nistp521', [{public_keys,ecdh}, {ec_curve,secp521r1}, {hashs,sha512}]}, - {'diffie-hellman-group1-sha1', [{public_keys,dh}, {hashs,sha}]} - ]); -supported_algorithms(public_key) -> - select_crypto_supported( - [{'ecdsa-sha2-nistp256', [{public_keys,ecdsa}, {hashs,sha256}, {ec_curve,secp256r1}]}, - {'ecdsa-sha2-nistp384', [{public_keys,ecdsa}, {hashs,sha384}, {ec_curve,secp384r1}]}, - {'ecdsa-sha2-nistp521', [{public_keys,ecdsa}, {hashs,sha512}, {ec_curve,secp521r1}]}, - {'ssh-rsa', [{public_keys,rsa}, {hashs,sha} ]}, - {'ssh-dss', [{public_keys,dss}, {hashs,sha} ]} - ]); - -supported_algorithms(cipher) -> - same( - select_crypto_supported( - [{'aes256-ctr', [{ciphers,{aes_ctr,256}}]}, - {'aes192-ctr', [{ciphers,{aes_ctr,192}}]}, - {'aes128-ctr', [{ciphers,{aes_ctr,128}}]}, - {'aes128-cbc', [{ciphers,aes_cbc128}]}, - {'aes128-gcm@openssh.com', [{ciphers,{aes_gcm,128}}]}, - {'aes256-gcm@openssh.com', [{ciphers,{aes_gcm,256}}]}, - {'AEAD_AES_128_GCM', [{ciphers,{aes_gcm,128}}]}, - {'AEAD_AES_256_GCM', [{ciphers,{aes_gcm,256}}]}, - {'3des-cbc', [{ciphers,des3_cbc}]} - ] - )); -supported_algorithms(mac) -> - same( - select_crypto_supported( - [{'hmac-sha2-256', [{hashs,sha256}]}, - {'hmac-sha2-512', [{hashs,sha512}]}, - {'hmac-sha1', [{hashs,sha}]}, - {'AEAD_AES_128_GCM', [{ciphers,{aes_gcm,128}}]}, - {'AEAD_AES_256_GCM', [{ciphers,{aes_gcm,256}}]} - ] - )); -supported_algorithms(compression) -> - same(['none', - 'zlib@openssh.com', - 'zlib' - ]). - -%%%---------------------------------------------------------------------------- versions(client, Options)-> Vsn = proplists:get_value(vsn, Options, ?DEFAULT_CLIENT_VERSION), - {Vsn, format_version(Vsn, software_version(Options))}; + Version = format_version(Vsn), + {Vsn, Version}; versions(server, Options) -> Vsn = proplists:get_value(vsn, Options, ?DEFAULT_SERVER_VERSION), - {Vsn, format_version(Vsn, software_version(Options))}. - -software_version(Options) -> - case proplists:get_value(id_string, Options) of - undefined -> - "Erlang"++ssh_vsn(); - {random,Nlo,Nup} -> - random_id(Nlo,Nup); - ID -> - ID - end. - -ssh_vsn() -> - try {ok,L} = application:get_all_key(ssh), - proplists:get_value(vsn,L,"") - of - "" -> ""; - VSN when is_list(VSN) -> "/" ++ VSN; - _ -> "" - catch - _:_ -> "" - end. - -random_id(Nlo, Nup) -> - [crypto:rand_uniform($a,$z+1) || _<- lists:duplicate(crypto:rand_uniform(Nlo,Nup+1),x) ]. + Version = format_version(Vsn), + {Vsn, Version}. hello_version_msg(Data) -> [Data,"\r\n"]. @@ -171,6 +57,12 @@ next_seqnum(SeqNum) -> (SeqNum + 1) band 16#ffffffff. +decrypt_first_block(Bin, #ssh{decrypt_block_size = BlockSize} = Ssh0) -> + <> = Bin, + {Ssh, <> = DecData} = + decrypt(Ssh0, EncBlock), + {Ssh, PacketLen, DecData, EncData}. + decrypt_blocks(Bin, Length, Ssh0) -> <> = Bin, {Ssh, DecData} = decrypt(Ssh0, EncBlocks), @@ -185,26 +77,21 @@ yes_no(Ssh, Prompt) -> (Ssh#ssh.io_cb):yes_no(Prompt, Ssh). -format_version({Major,Minor}, SoftwareVersion) -> +format_version({Major,Minor}) -> "SSH-" ++ integer_to_list(Major) ++ "." ++ - integer_to_list(Minor) ++ "-" ++ SoftwareVersion. + integer_to_list(Minor) ++ "-Erlang". handle_hello_version(Version) -> - try - StrVersion = trim_tail(Version), - case string:tokens(Version, "-") of - [_, "2.0" | _] -> - {{2,0}, StrVersion}; - [_, "1.99" | _] -> - {{2,0}, StrVersion}; - [_, "1.3" | _] -> - {{1,3}, StrVersion}; - [_, "1.5" | _] -> - {{1,5}, StrVersion} - end - catch - error:_ -> - {undefined, "unknown version"} + StrVersion = trim_tail(Version), + case string:tokens(Version, "-") of + [_, "2.0" | _] -> + {{2,0}, StrVersion}; + [_, "1.99" | _] -> + {{2,0}, StrVersion}; + [_, "1.3" | _] -> + {{1,3}, StrVersion}; + [_, "1.5" | _] -> + {{1,5}, StrVersion} end. key_exchange_init_msg(Ssh0) -> @@ -214,45 +101,62 @@ kex_init(#ssh{role = Role, opts = Opts, available_host_keys = HostKeyAlgs}) -> Random = ssh_bits:random(16), - PrefAlgs = - case proplists:get_value(preferred_algorithms,Opts) of - undefined -> - default_algorithms(); - Algs0 -> - Algs0 - end, - kexinit_message(Role, Random, PrefAlgs, HostKeyAlgs). + Compression = case proplists:get_value(compression, Opts, none) of + openssh_zlib -> ["zlib@openssh.com", "none"]; + zlib -> ["zlib", "none"]; + none -> ["none", "zlib"] + end, + kexinit_messsage(Role, Random, Compression, HostKeyAlgs). key_init(client, Ssh, Value) -> Ssh#ssh{c_keyinit = Value}; key_init(server, Ssh, Value) -> Ssh#ssh{s_keyinit = Value}. +available_ssh_algos() -> + Supports = crypto:supports(), + CipherAlgos = [{aes_ctr, "aes128-ctr"}, {aes_cbc128, "aes128-cbc"}, {des3_cbc, "3des-cbc"}], + Ciphers = [SshAlgo || + {CryptoAlgo, SshAlgo} <- CipherAlgos, + lists:member(CryptoAlgo, proplists:get_value(ciphers, Supports, []))], + HashAlgos = [{sha256, "hmac-sha2-256"}, {sha, "hmac-sha1"}], + Hashs = [SshAlgo || + {CryptoAlgo, SshAlgo} <- HashAlgos, + lists:member(CryptoAlgo, proplists:get_value(hashs, Supports, []))], + {Ciphers, Hashs}. + +kexinit_messsage(client, Random, Compression, HostKeyAlgs) -> + {CipherAlgs, HashAlgs} = available_ssh_algos(), + #ssh_msg_kexinit{ + cookie = Random, + kex_algorithms = ["diffie-hellman-group1-sha1"], + server_host_key_algorithms = HostKeyAlgs, + encryption_algorithms_client_to_server = CipherAlgs, + encryption_algorithms_server_to_client = CipherAlgs, + mac_algorithms_client_to_server = HashAlgs, + mac_algorithms_server_to_client = HashAlgs, + compression_algorithms_client_to_server = Compression, + compression_algorithms_server_to_client = Compression, + languages_client_to_server = [], + languages_server_to_client = [] + }; -kexinit_message(_Role, Random, Algs, HostKeyAlgs) -> +kexinit_messsage(server, Random, Compression, HostKeyAlgs) -> + {CipherAlgs, HashAlgs} = available_ssh_algos(), #ssh_msg_kexinit{ cookie = Random, - kex_algorithms = to_strings( get_algs(kex,Algs) ), + kex_algorithms = ["diffie-hellman-group1-sha1"], server_host_key_algorithms = HostKeyAlgs, - encryption_algorithms_client_to_server = c2s(cipher,Algs), - encryption_algorithms_server_to_client = s2c(cipher,Algs), - mac_algorithms_client_to_server = c2s(mac,Algs), - mac_algorithms_server_to_client = s2c(mac,Algs), - compression_algorithms_client_to_server = c2s(compression,Algs), - compression_algorithms_server_to_client = s2c(compression,Algs), + encryption_algorithms_client_to_server = CipherAlgs, + encryption_algorithms_server_to_client = CipherAlgs, + mac_algorithms_client_to_server = HashAlgs, + mac_algorithms_server_to_client = HashAlgs, + compression_algorithms_client_to_server = Compression, + compression_algorithms_server_to_client = Compression, languages_client_to_server = [], languages_server_to_client = [] }. -c2s(Key, Algs) -> x2y(client2server, Key, Algs). -s2c(Key, Algs) -> x2y(server2client, Key, Algs). - -x2y(DirectionKey, Key, Algs) -> to_strings(proplists:get_value(DirectionKey, get_algs(Key,Algs))). - -get_algs(Key, Algs) -> proplists:get_value(Key, Algs, default_algorithms(Key)). - -to_strings(L) -> lists:map(fun erlang:atom_to_list/1, L). - new_keys_message(Ssh0) -> {SshPacket, Ssh} = ssh_packet(#ssh_msg_newkeys{}, Ssh0), @@ -267,411 +171,136 @@ Ssh0#ssh{algorithms = Algoritms}); _ -> %% TODO: Correct code? - throw(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, + throw(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_PROTOCOL_ERROR, description = "Selection of key exchange" " algorithm failed", - language = ""}) + language = "en"}) end; handle_kexinit_msg(#ssh_msg_kexinit{} = CounterPart, #ssh_msg_kexinit{} = Own, #ssh{role = server} = Ssh) -> {ok, Algoritms} = select_algorithm(server, CounterPart, Own), - case verify_algorithm(Algoritms) of - true -> - {ok, Ssh#ssh{algorithms = Algoritms}}; - _ -> - throw(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Selection of key exchange" - " algorithm failed", - language = ""}) - end. + {ok, Ssh#ssh{algorithms = Algoritms}}. %% TODO: diffie-hellman-group14-sha1 should also be supported. %% Maybe check more things ... +verify_algorithm(#alg{kex = 'diffie-hellman-group1-sha1'}) -> + true; +verify_algorithm(#alg{kex = 'diffie-hellman-group-exchange-sha1'}) -> + true; +verify_algorithm(_) -> + false. -verify_algorithm(#alg{kex = undefined}) -> false; -verify_algorithm(#alg{hkey = undefined}) -> false; -verify_algorithm(#alg{send_mac = undefined}) -> false; -verify_algorithm(#alg{recv_mac = undefined}) -> false; -verify_algorithm(#alg{encrypt = undefined}) -> false; -verify_algorithm(#alg{decrypt = undefined}) -> false; -verify_algorithm(#alg{compress = undefined}) -> false; -verify_algorithm(#alg{decompress = undefined}) -> false; -verify_algorithm(#alg{kex = Kex}) -> lists:member(Kex, supported_algorithms(kex)). - -%%%---------------------------------------------------------------- -%%% -%%% Key exchange initialization -%%% -key_exchange_first_msg(Kex, Ssh0) when Kex == 'diffie-hellman-group1-sha1' ; - Kex == 'diffie-hellman-group14-sha1' -> - {G, P} = dh_group(Kex), - {Public, Private} = generate_key(dh, [P,G]), +key_exchange_first_msg('diffie-hellman-group1-sha1', Ssh0) -> + {G, P} = dh_group1(), + {Private, Public} = dh_gen_key(G, P, 1024), {SshPacket, Ssh1} = ssh_packet(#ssh_msg_kexdh_init{e = Public}, Ssh0), {ok, SshPacket, Ssh1#ssh{keyex_key = {{Private, Public}, {G, P}}}}; -key_exchange_first_msg(Kex, Ssh0=#ssh{opts=Opts}) when Kex == 'diffie-hellman-group-exchange-sha1' ; - Kex == 'diffie-hellman-group-exchange-sha256' -> - {Min,NBits,Max} = - proplists:get_value(dh_gex_limits, Opts, {?DEFAULT_DH_GROUP_MIN, - ?DEFAULT_DH_GROUP_NBITS, - ?DEFAULT_DH_GROUP_MAX}), +key_exchange_first_msg('diffie-hellman-group-exchange-sha1', Ssh0) -> + Min = ?DEFAULT_DH_GROUP_MIN, + NBits = ?DEFAULT_DH_GROUP_NBITS, + Max = ?DEFAULT_DH_GROUP_MAX, {SshPacket, Ssh1} = ssh_packet(#ssh_msg_kex_dh_gex_request{min = Min, - n = NBits, - max = Max}, + n = NBits, max = Max}, Ssh0), {ok, SshPacket, - Ssh1#ssh{keyex_info = {Min, Max, NBits}}}; - -key_exchange_first_msg(Kex, Ssh0) when Kex == 'ecdh-sha2-nistp256' ; - Kex == 'ecdh-sha2-nistp384' ; - Kex == 'ecdh-sha2-nistp521' -> - Curve = ecdh_curve(Kex), - {Public, Private} = generate_key(ecdh, Curve), - {SshPacket, Ssh1} = ssh_packet(#ssh_msg_kex_ecdh_init{q_c=Public}, Ssh0), - {ok, SshPacket, - Ssh1#ssh{keyex_key = {{Public,Private},Curve}}}. - -%%%---------------------------------------------------------------- -%%% -%%% diffie-hellman-group1-sha1 -%%% diffie-hellman-group14-sha1 -%%% -handle_kexdh_init(#ssh_msg_kexdh_init{e = E}, - Ssh0 = #ssh{algorithms = #alg{kex=Kex}}) -> - %% server - {G, P} = dh_group(Kex), - if - 1= - {Public, Private} = generate_key(dh, [P,G]), - K = compute_key(dh, E, Private, [P,G]), - MyPrivHostKey = get_host_key(Ssh0), - MyPubHostKey = extract_public_key(MyPrivHostKey), - H = kex_h(Ssh0, MyPubHostKey, E, Public, K), - H_SIG = sign_host_key(Ssh0, MyPrivHostKey, H), - {SshPacket, Ssh1} = - ssh_packet(#ssh_msg_kexdh_reply{public_host_key = MyPubHostKey, - f = Public, - h_sig = H_SIG - }, Ssh0), - {ok, SshPacket, Ssh1#ssh{keyex_key = {{Private, Public}, {G, P}}, - shared_secret = K, - exchanged_hash = H, - session_id = sid(Ssh1, H)}}; - - true -> - throw({{error,bad_e_from_peer}, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Key exchange failed, 'e' out of bounds", - language = ""} - }) - end. - -handle_kexdh_reply(#ssh_msg_kexdh_reply{public_host_key = PeerPubHostKey, - f = F, - h_sig = H_SIG}, - #ssh{keyex_key = {{Private, Public}, {G, P}}} = Ssh0) -> - %% client - if - 1= - K = compute_key(dh, F, Private, [P,G]), - H = kex_h(Ssh0, PeerPubHostKey, Public, F, K), - - case verify_host_key(Ssh0, PeerPubHostKey, H, H_SIG) of - ok -> - {SshPacket, Ssh} = ssh_packet(#ssh_msg_newkeys{}, Ssh0), - {ok, SshPacket, Ssh#ssh{shared_secret = K, - exchanged_hash = H, - session_id = sid(Ssh, H)}}; - Error -> - throw({Error, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Key exchange failed", - language = "en"} - }) - end; - - true -> - throw({{error,bad_f_from_peer}, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Key exchange failed, 'f' out of bounds", - language = ""} - }) - end. + Ssh1#ssh{keyex_info = {Min, Max, NBits}}}. -%%%---------------------------------------------------------------- -%%% -%%% diffie-hellman-group-exchange-sha1 -%%% -handle_kex_dh_gex_request(#ssh_msg_kex_dh_gex_request{min = Min0, - n = NBits, - max = Max0}, - Ssh0=#ssh{opts=Opts}) when Min0= - %% server - {Min, Max} = adjust_gex_min_max(Min0, Max0, Opts), - case public_key:dh_gex_group(Min, NBits, Max, - proplists:get_value(dh_gex_groups,Opts)) of - {ok, {_Sz, {G,P}}} -> - {Public, Private} = generate_key(dh, [P,G]), - {SshPacket, Ssh} = - ssh_packet(#ssh_msg_kex_dh_gex_group{p = P, g = G}, Ssh0), - {ok, SshPacket, - Ssh#ssh{keyex_key = {{Private, Public}, {G, P}}, - keyex_info = {Min, Max, NBits} - }}; - {error,_} -> - throw(#ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_PROTOCOL_ERROR, - description = "No possible diffie-hellman-group-exchange group found", - language = ""}) - end; - -handle_kex_dh_gex_request(#ssh_msg_kex_dh_gex_request_old{n = NBits}, - Ssh0=#ssh{opts=Opts}) -> - %% server - %% - %% This message was in the draft-00 of rfc4419 - %% (https://tools.ietf.org/html/draft-ietf-secsh-dh-group-exchange-00) - %% In later drafts and the rfc is "is used for backward compatibility". - %% Unfortunatly the rfc does not specify how to treat the parameter n - %% if there is no group of that modulus length :( - %% The draft-00 however specifies that n is the "... number of bits - %% the subgroup should have at least". - %% Further, it says that "Servers and clients SHOULD support groups - %% with a modulus length of k bits, where 1024 <= k <= 8192." - %% - Min0 = NBits, - Max0 = 8192, - {Min, Max} = adjust_gex_min_max(Min0, Max0, Opts), - case public_key:dh_gex_group(Min, NBits, Max, - proplists:get_value(dh_gex_groups,Opts)) of - {ok, {_Sz, {G,P}}} -> - {Public, Private} = generate_key(dh, [P,G]), - {SshPacket, Ssh} = - ssh_packet(#ssh_msg_kex_dh_gex_group{p = P, g = G}, Ssh0), - {ok, SshPacket, - Ssh#ssh{keyex_key = {{Private, Public}, {G, P}}, - keyex_info = {-1, -1, NBits} % flag for kex_h hash calc - }}; - {error,_} -> - throw(#ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_PROTOCOL_ERROR, - description = "No possible diffie-hellman-group-exchange group found", - language = ""}) - end; - -handle_kex_dh_gex_request(_, _) -> - throw({{error,bad_ssh_msg_kex_dh_gex_request}, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Key exchange failed, bad values in ssh_msg_kex_dh_gex_request", - language = ""} - }). - - -adjust_gex_min_max(Min0, Max0, Opts) -> - case proplists:get_value(dh_gex_limits, Opts) of - undefined -> - {Min0, Max0}; - {Min1, Max1} -> - Min2 = max(Min0, Min1), - Max2 = min(Max0, Max1), - if - Min2 =< Max2 -> - {Min2, Max2}; - Max2 < Min2 -> - throw(#ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_PROTOCOL_ERROR, - description = "No possible diffie-hellman-group-exchange group possible", - language = ""}) - end - end. - +handle_kexdh_init(#ssh_msg_kexdh_init{e = E}, Ssh0) -> + {G, P} = dh_group1(), + {Private, Public} = dh_gen_key(G, P, 1024), + K = ssh_math:ipow(E, Private, P), + Key = get_host_key(Ssh0), + H = kex_h(Ssh0, Key, E, Public, K), + H_SIG = sign_host_key(Ssh0, Key, H), + {SshPacket, Ssh1} = ssh_packet(#ssh_msg_kexdh_reply{public_host_key = Key, + f = Public, + h_sig = H_SIG + }, Ssh0), + + {ok, SshPacket, Ssh1#ssh{keyex_key = {{Private, Public}, {G, P}}, + shared_secret = K, + exchanged_hash = H, + session_id = sid(Ssh1, H)}}. handle_kex_dh_gex_group(#ssh_msg_kex_dh_gex_group{p = P, g = G}, Ssh0) -> - %% client - {Public, Private} = generate_key(dh, [P,G]), + {Private, Public} = dh_gen_key(G,P,1024), {SshPacket, Ssh1} = - ssh_packet(#ssh_msg_kex_dh_gex_init{e = Public}, Ssh0), % Pub = G^Priv mod P (def) - + ssh_packet(#ssh_msg_kex_dh_gex_init{e = Public}, Ssh0), {ok, SshPacket, Ssh1#ssh{keyex_key = {{Private, Public}, {G, P}}}}. -handle_kex_dh_gex_init(#ssh_msg_kex_dh_gex_init{e = E}, - #ssh{keyex_key = {{Private, Public}, {G, P}}, - keyex_info = {Min, Max, NBits}} = - Ssh0) -> - %% server - if - 1= - K = compute_key(dh, E, Private, [P,G]), - if - 1 - MyPrivHostKey = get_host_key(Ssh0), - MyPubHostKey = extract_public_key(MyPrivHostKey), - H = kex_h(Ssh0, MyPubHostKey, Min, NBits, Max, P, G, E, Public, K), - H_SIG = sign_host_key(Ssh0, MyPrivHostKey, H), - {SshPacket, Ssh} = - ssh_packet(#ssh_msg_kex_dh_gex_reply{public_host_key = MyPubHostKey, - f = Public, - h_sig = H_SIG}, Ssh0), - {ok, SshPacket, Ssh#ssh{shared_secret = K, - exchanged_hash = H, - session_id = sid(Ssh, H) - }}; - true -> - throw({{error,bad_K}, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Key exchange failed, 'K' out of bounds", - language = ""} - }) - end; - true -> - throw({{error,bad_e_from_peer}, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Key exchange failed, 'e' out of bounds", - language = ""} - }) - end. - -handle_kex_dh_gex_reply(#ssh_msg_kex_dh_gex_reply{public_host_key = PeerPubHostKey, - f = F, - h_sig = H_SIG}, - #ssh{keyex_key = {{Private, Public}, {G, P}}, - keyex_info = {Min, Max, NBits}} = - Ssh0) -> - %% client - if - 1= - K = compute_key(dh, F, Private, [P,G]), - if - 1 - H = kex_h(Ssh0, PeerPubHostKey, Min, NBits, Max, P, G, Public, F, K), - - case verify_host_key(Ssh0, PeerPubHostKey, H, H_SIG) of - ok -> - {SshPacket, Ssh} = ssh_packet(#ssh_msg_newkeys{}, Ssh0), - {ok, SshPacket, Ssh#ssh{shared_secret = K, - exchanged_hash = H, - session_id = sid(Ssh, H)}}; - _Error -> - throw(#ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Key exchange failed", - language = ""} - ) - end; - - true -> - throw({{error,bad_K}, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Key exchange failed, 'K' out of bounds", - language = ""} - }) - end; - true -> - throw({{error,bad_f_from_peer}, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Key exchange failed, 'f' out of bounds", - language = ""} - }) - end. - -%%%---------------------------------------------------------------- -%%% -%%% diffie-hellman-ecdh-sha2-* -%%% -handle_kex_ecdh_init(#ssh_msg_kex_ecdh_init{q_c = PeerPublic}, - Ssh0 = #ssh{algorithms = #alg{kex=Kex}}) -> - %% at server - Curve = ecdh_curve(Kex), - {MyPublic, MyPrivate} = generate_key(ecdh, Curve), - try - compute_key(ecdh, PeerPublic, MyPrivate, Curve) - of - K -> - MyPrivHostKey = get_host_key(Ssh0), - MyPubHostKey = extract_public_key(MyPrivHostKey), - H = kex_h(Ssh0, Curve, MyPubHostKey, PeerPublic, MyPublic, K), - H_SIG = sign_host_key(Ssh0, MyPrivHostKey, H), - {SshPacket, Ssh1} = - ssh_packet(#ssh_msg_kex_ecdh_reply{public_host_key = MyPubHostKey, - q_s = MyPublic, - h_sig = H_SIG}, - Ssh0), - {ok, SshPacket, Ssh1#ssh{keyex_key = {{MyPublic,MyPrivate},Curve}, - shared_secret = K, - exchanged_hash = H, - session_id = sid(Ssh1, H)}} - catch - _:_ -> - throw({{error,invalid_peer_public_key}, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Peer ECDH public key is invalid", - language = ""} - }) - end. - -handle_kex_ecdh_reply(#ssh_msg_kex_ecdh_reply{public_host_key = PeerPubHostKey, - q_s = PeerPublic, - h_sig = H_SIG}, - #ssh{keyex_key = {{MyPublic,MyPrivate}, Curve}} = Ssh0 - ) -> - %% at client - try - compute_key(ecdh, PeerPublic, MyPrivate, Curve) - of - K -> - H = kex_h(Ssh0, Curve, PeerPubHostKey, MyPublic, PeerPublic, K), - case verify_host_key(Ssh0, PeerPubHostKey, H, H_SIG) of - ok -> - {SshPacket, Ssh} = ssh_packet(#ssh_msg_newkeys{}, Ssh0), - {ok, SshPacket, Ssh#ssh{shared_secret = K, - exchanged_hash = H, - session_id = sid(Ssh, H)}}; - Error -> - throw({Error, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Key exchange failed", - language = ""} - }) - end - catch - _:_ -> - throw({{error,invalid_peer_public_key}, - #ssh_msg_disconnect{ - code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = "Peer ECDH public key is invalid", - language = ""} - }) - end. - - -%%%---------------------------------------------------------------- handle_new_keys(#ssh_msg_newkeys{}, Ssh0) -> try install_alg(Ssh0) of #ssh{} = Ssh -> {ok, Ssh} catch - _C:_Error -> %% TODO: Throw earlier .... + error:_Error -> %% TODO: Throw earlier .... throw(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_PROTOCOL_ERROR, description = "Install alg failed", language = "en"}) end. + +%% %% Select algorithms +handle_kexdh_reply(#ssh_msg_kexdh_reply{public_host_key = HostKey, f = F, + h_sig = H_SIG}, + #ssh{keyex_key = {{Private, Public}, {_G, P}}} = Ssh0) -> + K = ssh_math:ipow(F, Private, P), + H = kex_h(Ssh0, HostKey, Public, F, K), + + case verify_host_key(Ssh0, HostKey, H, H_SIG) of + ok -> + {SshPacket, Ssh} = ssh_packet(#ssh_msg_newkeys{}, Ssh0), + {ok, SshPacket, Ssh#ssh{shared_secret = K, + exchanged_hash = H, + session_id = sid(Ssh, H)}}; + Error -> + Disconnect = #ssh_msg_disconnect{ + code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, + description = "Key exchange failed", + language = "en"}, + throw({Error, Disconnect}) + end. + +handle_kex_dh_gex_request(#ssh_msg_kex_dh_gex_request{min = _Min, + n = _NBits, + max = _Max}, Ssh0) -> + {G,P} = dh_group1(), %% TODO real imp this seems to be a hack?! + {Private, Public} = dh_gen_key(G, P, 1024), + {SshPacket, Ssh} = + ssh_packet(#ssh_msg_kex_dh_gex_group{p = P, g = G}, Ssh0), + {ok, SshPacket, + Ssh#ssh{keyex_key = {{Private, Public}, {G, P}}}}. + +handle_kex_dh_gex_reply(#ssh_msg_kex_dh_gex_reply{public_host_key = HostKey, + f = F, + h_sig = H_SIG}, + #ssh{keyex_key = {{Private, Public}, {G, P}}, + keyex_info = {Min, Max, NBits}} = + Ssh0) -> + K = ssh_math:ipow(F, Private, P), + H = kex_h(Ssh0, HostKey, Min, NBits, Max, P, G, Public, F, K), + + case verify_host_key(Ssh0, HostKey, H, H_SIG) of + ok -> + {SshPacket, Ssh} = ssh_packet(#ssh_msg_newkeys{}, Ssh0), + {ok, SshPacket, Ssh#ssh{shared_secret = K, + exchanged_hash = H, + session_id = sid(Ssh, H)}}; + _Error -> + Disconnect = #ssh_msg_disconnect{ + code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, + description = "Key exchange failed", + language = "en"}, + throw(Disconnect) + end. + %% select session id sid(#ssh{session_id = undefined}, H) -> H; @@ -685,49 +314,33 @@ #ssh{key_cb = Mod, opts = Opts, algorithms = ALG} = SSH, case Mod:host_key(ALG#alg.hkey, Opts) of - {ok, #'RSAPrivateKey'{} = Key} -> Key; - {ok, #'DSAPrivateKey'{} = Key} -> Key; - {ok, #'ECPrivateKey'{} = Key} -> Key; + {ok, #'RSAPrivateKey'{} = Key} -> + Key; + {ok, #'DSAPrivateKey'{} = Key} -> + Key; Result -> exit({error, {Result, unsupported_key_type}}) end. -sign_host_key(_Ssh, PrivateKey, H) -> - sign(H, sign_host_key_sha(PrivateKey), PrivateKey). - -sign_host_key_sha(#'ECPrivateKey'{parameters = {namedCurve,OID}}) -> sha(OID); -sign_host_key_sha(#'RSAPrivateKey'{}) -> sha; -sign_host_key_sha(#'DSAPrivateKey'{}) -> sha. - - -extract_public_key(#'RSAPrivateKey'{modulus = N, publicExponent = E}) -> - #'RSAPublicKey'{modulus = N, publicExponent = E}; -extract_public_key(#'DSAPrivateKey'{y = Y, p = P, q = Q, g = G}) -> - {Y, #'Dss-Parms'{p=P, q=Q, g=G}}; -extract_public_key(#'ECPrivateKey'{parameters = {namedCurve,OID}, - publicKey = Q}) -> - {#'ECPoint'{point=Q}, {namedCurve,OID}}. - +sign_host_key(_Ssh, #'RSAPrivateKey'{} = Private, H) -> + Hash = sha, %% Option ?! + _Signature = sign(H, Hash, Private); +sign_host_key(_Ssh, #'DSAPrivateKey'{} = Private, H) -> + Hash = sha, %% Option ?! + _RawSignature = sign(H, Hash, Private). verify_host_key(SSH, PublicKey, Digest, Signature) -> - case verify(Digest, host_key_sha(PublicKey), Signature, PublicKey) of + case verify(Digest, sha, Signature, PublicKey) of false -> {error, bad_signature}; true -> known_host_key(SSH, PublicKey, public_algo(PublicKey)) end. - -host_key_sha(#'RSAPublicKey'{}) -> sha; -host_key_sha({_, #'Dss-Parms'{}}) -> sha; -host_key_sha({#'ECPoint'{},{namedCurve,OID}}) -> sha(OID). - -public_algo(#'RSAPublicKey'{}) -> 'ssh-rsa'; -public_algo({_, #'Dss-Parms'{}}) -> 'ssh-dss'; -public_algo({#'ECPoint'{},{namedCurve,OID}}) -> - Curve = public_key:oid2ssh_curvename(OID), - list_to_atom("ecdsa-sha2-" ++ binary_to_list(Curve)). - +public_algo(#'RSAPublicKey'{}) -> + 'ssh-rsa'; +public_algo({_, #'Dss-Parms'{}}) -> + 'ssh-dss'. accepted_host(Ssh, PeerName, Opts) -> case proplists:get_value(silently_accept_hosts, Opts, false) of @@ -760,12 +373,8 @@ %% The first algorithm in each list MUST be the preferred (guessed) %% algorithm. Each string MUST contain at least one algorithm name. select_algorithm(Role, Client, Server) -> - {Encrypt0, Decrypt0} = select_encrypt_decrypt(Role, Client, Server), - {SendMac0, RecvMac0} = select_send_recv_mac(Role, Client, Server), - - {Encrypt, SendMac} = aead_gcm_simultan(Encrypt0, SendMac0), - {Decrypt, RecvMac} = aead_gcm_simultan(Decrypt0, RecvMac0), - + {Encrypt, Decrypt} = select_encrypt_decrypt(Role, Client, Server), + {SendMac, RecvMac} = select_send_recv_mac(Role, Client, Server), {Compression, Decompression} = select_compression_decompression(Role, Client, Server), @@ -796,38 +405,6 @@ s_lng = S_Lng}, {ok, Alg}. - -%%% It is an agreed problem with RFC 5674 that if the selection is -%%% Cipher = AEAD_AES_x_GCM and -%%% Mac = AEAD_AES_y_GCM (where x =/= y) -%%% then it is undefined what length should be selected. -%%% -%%% If only one of the two lengths (128,256) is available, I claim that -%%% there is no such ambiguity. - -%%% From https://anongit.mindrot.org/openssh.git/plain/PROTOCOL -%%% (read Nov 20, 2015) -%%% 1.6 transport: AES-GCM -%%% -%%% OpenSSH supports the AES-GCM algorithm as specified in RFC 5647. -%%% Because of problems with the specification of the key exchange -%%% the behaviour of OpenSSH differs from the RFC as follows: -%%% -%%% AES-GCM is only negotiated as the cipher algorithms -%%% "aes128-gcm@openssh.com" or "aes256-gcm@openssh.com" and never as -%%% an MAC algorithm. Additionally, if AES-GCM is selected as the cipher -%%% the exchanged MAC algorithms are ignored and there doesn't have to be -%%% a matching MAC. - -aead_gcm_simultan('aes128-gcm@openssh.com', _) -> {'AEAD_AES_128_GCM', 'AEAD_AES_128_GCM'}; -aead_gcm_simultan('aes256-gcm@openssh.com', _) -> {'AEAD_AES_256_GCM', 'AEAD_AES_256_GCM'}; -aead_gcm_simultan('AEAD_AES_128_GCM', _) -> {'AEAD_AES_128_GCM', 'AEAD_AES_128_GCM'}; -aead_gcm_simultan('AEAD_AES_256_GCM', _) -> {'AEAD_AES_256_GCM', 'AEAD_AES_256_GCM'}; -aead_gcm_simultan(_, 'AEAD_AES_128_GCM') -> {'AEAD_AES_128_GCM', 'AEAD_AES_128_GCM'}; -aead_gcm_simultan(_, 'AEAD_AES_256_GCM') -> {'AEAD_AES_256_GCM', 'AEAD_AES_256_GCM'}; -aead_gcm_simultan(Cipher, Mac) -> {Cipher,Mac}. - - select_encrypt_decrypt(client, Client, Server) -> Encrypt = select(Client#ssh_msg_kexinit.encryption_algorithms_client_to_server, @@ -862,18 +439,18 @@ Compression = select(Client#ssh_msg_kexinit.compression_algorithms_client_to_server, Server#ssh_msg_kexinit.compression_algorithms_client_to_server), - Decompression = + Decomprssion = select(Client#ssh_msg_kexinit.compression_algorithms_server_to_client, Server#ssh_msg_kexinit.compression_algorithms_server_to_client), - {Compression, Decompression}; + {Compression, Decomprssion}; select_compression_decompression(server, Client, Server) -> - Decompression = + Decomprssion = select(Client#ssh_msg_kexinit.compression_algorithms_client_to_server, Server#ssh_msg_kexinit.compression_algorithms_client_to_server), Compression = select(Client#ssh_msg_kexinit.compression_algorithms_server_to_client, Server#ssh_msg_kexinit.compression_algorithms_server_to_client), - {Compression, Decompression}. + {Compression, Decomprssion}. install_alg(SSH) -> SSH1 = alg_final(SSH), @@ -915,16 +492,10 @@ {ok,SSH6} = decompress_final(SSH5), SSH6. -select_all(CL, SL) when length(CL) + length(SL) < ?MAX_NUM_ALGORITHMS -> +select_all(CL, SL) -> A = CL -- SL, %% algortihms only used by client %% algorithms used by client and server (client pref) - lists:map(fun(ALG) -> list_to_atom(ALG) end, (CL -- A)); -select_all(CL, SL) -> - Err = lists:concat(["Received too many algorithms (",length(CL),"+",length(SL)," >= ",?MAX_NUM_ALGORITHMS,")."]), - throw(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_PROTOCOL_ERROR, - description = Err, - language = ""}). - + lists:map(fun(ALG) -> list_to_atom(ALG) end, (CL -- A)). select([], []) -> none; @@ -944,147 +515,58 @@ BinMsg = ssh_message:encode(Msg), pack(BinMsg, Ssh). -pack(Data, Ssh=#ssh{}) -> - pack(Data, Ssh, 0). - -%%% Note: pack/3 is only to be called from tests that wants -%%% to deliberetly send packets with wrong PacketLength! -%%% Use pack/2 for all other purposes! -pack(PlainText, - #ssh{send_sequence = SeqNum, - send_mac = MacAlg, - send_mac_key = MacKey, - encrypt = CryptoAlg} = Ssh0, PacketLenDeviationForTests) when is_binary(PlainText) -> - - {Ssh1, CompressedPlainText} = compress(Ssh0, PlainText), - {EcryptedPacket, MAC, Ssh3} = - case pkt_type(CryptoAlg) of - common -> - PaddingLen = padding_length(4+1+size(CompressedPlainText), Ssh0), - Padding = ssh_bits:random(PaddingLen), - PlainPacketLen = 1 + PaddingLen + size(CompressedPlainText) + PacketLenDeviationForTests, - PlainPacketData = <>, - {Ssh2, EcryptedPacket0} = encrypt(Ssh1, PlainPacketData), - MAC0 = mac(MacAlg, MacKey, SeqNum, PlainPacketData), - {EcryptedPacket0, MAC0, Ssh2}; - aead -> - PaddingLen = padding_length(1+size(CompressedPlainText), Ssh0), - Padding = ssh_bits:random(PaddingLen), - PlainPacketLen = 1 + PaddingLen + size(CompressedPlainText) + PacketLenDeviationForTests, - PlainPacketData = <>, - {Ssh2, {EcryptedPacket0,MAC0}} = encrypt(Ssh1, {<>,PlainPacketData}), - {<>, MAC0, Ssh2} +pack(Data0, #ssh{encrypt_block_size = BlockSize, + send_sequence = SeqNum, send_mac = MacAlg, + send_mac_key = MacKey} + = Ssh0) when is_binary(Data0) -> + {Ssh1, Data} = compress(Ssh0, Data0), + PL = (BlockSize - ((4 + 1 + size(Data)) rem BlockSize)) rem BlockSize, + PaddingLen = if PL < 4 -> PL + BlockSize; + true -> PL + end, + Padding = ssh_bits:random(PaddingLen), + PacketLen = 1 + PaddingLen + size(Data), + PacketData = <>, + {Ssh2, EncPacket} = encrypt(Ssh1, PacketData), + MAC = mac(MacAlg, MacKey, SeqNum, PacketData), + Packet = [EncPacket, MAC], + Ssh = Ssh2#ssh{send_sequence = (SeqNum+1) band 16#ffffffff}, + {Packet, Ssh}. + +unpack(EncodedSoFar, ReminingLenght, #ssh{recv_mac_size = MacSize} = Ssh0) -> + SshLength = ReminingLenght - MacSize, + {NoMac, Mac, Rest} = case MacSize of + 0 -> + <> = EncodedSoFar, + {NoMac0, <<>>, Rest0}; + _ -> + <> = EncodedSoFar, + {NoMac0, Mac0, Rest0} + end, + {Ssh1, DecData, <<>>} = + case SshLength of + 0 -> + {Ssh0, <<>>, <<>>}; + _ -> + decrypt_blocks(NoMac, SshLength, Ssh0) end, - FinalPacket = [EcryptedPacket, MAC], - Ssh = Ssh3#ssh{send_sequence = (SeqNum+1) band 16#ffffffff}, - {FinalPacket, Ssh}. - - -padding_length(Size, #ssh{encrypt_block_size = BlockSize, - random_length_padding = RandomLengthPadding}) -> - PL = (BlockSize - (Size rem BlockSize)) rem BlockSize, - MinPaddingLen = if PL < 4 -> PL + BlockSize; - true -> PL - end, - PadBlockSize = max(BlockSize,4), - MaxExtraBlocks = (max(RandomLengthPadding,MinPaddingLen) - MinPaddingLen) div PadBlockSize, - ExtraPaddingLen = try crypto:rand_uniform(0,MaxExtraBlocks)*PadBlockSize - catch _:_ -> 0 - end, - MinPaddingLen + ExtraPaddingLen. - + {Ssh1, DecData, Rest, Mac}. - -handle_packet_part(<<>>, Encrypted0, undefined, #ssh{decrypt = CryptoAlg} = Ssh0) -> - %% New ssh packet - case get_length(pkt_type(CryptoAlg), Encrypted0, Ssh0) of - get_more -> - %% too short to get the length - {get_more, <<>>, Encrypted0, undefined, Ssh0}; - - {ok, PacketLen, _, _, _} when PacketLen > ?SSH_MAX_PACKET_SIZE -> - %% far too long message than expected - {error, {exceeds_max_size,PacketLen}}; - - {ok, PacketLen, Decrypted, Encrypted1, - #ssh{recv_mac_size = MacSize} = Ssh1} -> - %% enough bytes so we got the length and can calculate how many - %% more bytes to expect for a full packet - TotalNeeded = (4 + PacketLen + MacSize), - handle_packet_part(Decrypted, Encrypted1, TotalNeeded, Ssh1) - end; - -handle_packet_part(DecryptedPfx, EncryptedBuffer, TotalNeeded, Ssh0) - when (size(DecryptedPfx)+size(EncryptedBuffer)) < TotalNeeded -> - %% need more bytes to finalize the packet - {get_more, DecryptedPfx, EncryptedBuffer, TotalNeeded, Ssh0}; - -handle_packet_part(DecryptedPfx, EncryptedBuffer, TotalNeeded, - #ssh{recv_mac_size = MacSize, - decrypt = CryptoAlg} = Ssh0) -> - %% enough bytes to decode the packet. - DecryptLen = TotalNeeded - size(DecryptedPfx) - MacSize, - <> = EncryptedBuffer, - case pkt_type(CryptoAlg) of - common -> - {Ssh1, DecryptedSfx} = decrypt(Ssh0, EncryptedSfx), - DecryptedPacket = <>, - case is_valid_mac(Mac, DecryptedPacket, Ssh1) of - false -> - {bad_mac, Ssh1}; - true -> - {Ssh, DecompressedPayload} = decompress(Ssh1, payload(DecryptedPacket)), - {decoded, DecompressedPayload, NextPacketBytes, Ssh} - end; - aead -> - PacketLenBin = DecryptedPfx, - case decrypt(Ssh0, {PacketLenBin,EncryptedSfx,Mac}) of - {Ssh1, error} -> - {bad_mac, Ssh1}; - {Ssh1, DecryptedSfx} -> - DecryptedPacket = <>, - {Ssh, DecompressedPayload} = decompress(Ssh1, payload(DecryptedPacket)), - {decoded, DecompressedPayload, NextPacketBytes, Ssh} - end - end. - - -get_length(common, EncryptedBuffer, #ssh{decrypt_block_size = BlockSize} = Ssh0) -> - case size(EncryptedBuffer) >= erlang:max(8, BlockSize) of - true -> - <> = EncryptedBuffer, - {Ssh, - <> = Decrypted} = decrypt(Ssh0, EncBlock), - {ok, PacketLen, Decrypted, EncryptedRest, Ssh}; - false -> - get_more - end; -get_length(aead, EncryptedBuffer, Ssh) -> - case size(EncryptedBuffer) >= 4 of - true -> - <> = EncryptedBuffer, - {ok, PacketLen, <>, EncryptedRest, Ssh}; - false -> - get_more - end. - -pkt_type('AEAD_AES_128_GCM') -> aead; -pkt_type('AEAD_AES_256_GCM') -> aead; -pkt_type(_) -> common. - -payload(<>) -> - PayloadLen = PacketLen - PaddingLen - 1, - <> = PayloadAndPadding, - Payload. +msg_data(PacketData) -> + <> = PacketData, + DataLen = Len - PaddingLen - 1, + <<_:32, _:8, Data:DataLen/binary, + _:PaddingLen/binary>> = PacketData, + Data. sign(SigData, Hash, #'DSAPrivateKey'{} = Key) -> DerSignature = public_key:sign(SigData, Hash, Key), #'Dss-Sig-Value'{r = R, s = S} = public_key:der_decode('Dss-Sig-Value', DerSignature), <>; -sign(SigData, Hash, Key = #'ECPrivateKey'{}) -> - DerEncodedSign = public_key:sign(SigData, Hash, Key), - #'ECDSA-Sig-Value'{r=R, s=S} = public_key:der_decode('ECDSA-Sig-Value', DerEncodedSign), - ssh_bits:encode([R,S], [mpint,mpint]); sign(SigData, Hash, Key) -> public_key:sign(SigData, Hash, Key). @@ -1092,48 +574,59 @@ <> = Sig, Signature = public_key:der_encode('Dss-Sig-Value', #'Dss-Sig-Value'{r = R, s = S}), public_key:verify(PlainText, Hash, Signature, Key); -verify(PlainText, Hash, Sig, {#'ECPoint'{},_} = Key) -> - <> = Sig, - Sval = #'ECDSA-Sig-Value'{r=R, s=S}, - DerEncodedSig = public_key:der_encode('ECDSA-Sig-Value',Sval), - public_key:verify(PlainText, Hash, DerEncodedSig, Key); verify(PlainText, Hash, Sig, Key) -> public_key:verify(PlainText, Hash, Sig, Key). +%% public key algorithms +%% +%% ssh-dss REQUIRED sign Raw DSS Key +%% ssh-rsa RECOMMENDED sign Raw RSA Key +%% x509v3-sign-rsa OPTIONAL sign X.509 certificates (RSA key) +%% x509v3-sign-dss OPTIONAL sign X.509 certificates (DSS key) +%% spki-sign-rsa OPTIONAL sign SPKI certificates (RSA key) +%% spki-sign-dss OPTIONAL sign SPKI certificates (DSS key) +%% pgp-sign-rsa OPTIONAL sign OpenPGP certificates (RSA key) +%% pgp-sign-dss OPTIONAL sign OpenPGP certificates (DSS key) +%% + +%% key exchange +%% +%% diffie-hellman-group1-sha1 REQUIRED +%% +%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% %% Encryption +%% +%% chiphers +%% +%% 3des-cbc REQUIRED +%% three-key 3DES in CBC mode +%% blowfish-cbc OPTIONAL Blowfish in CBC mode +%% twofish256-cbc OPTIONAL Twofish in CBC mode, +%% with 256-bit key +%% twofish-cbc OPTIONAL alias for "twofish256-cbc" (this +%% is being retained for +%% historical reasons) +%% twofish192-cbc OPTIONAL Twofish with 192-bit key +%% twofish128-cbc OPTIONAL Twofish with 128-bit key +%% aes256-cbc OPTIONAL AES in CBC mode, +%% with 256-bit key +%% aes192-cbc OPTIONAL AES with 192-bit key +%% aes128-cbc RECOMMENDED AES with 128-bit key +%% serpent256-cbc OPTIONAL Serpent in CBC mode, with +%% 256-bit key +%% serpent192-cbc OPTIONAL Serpent with 192-bit key +%% serpent128-cbc OPTIONAL Serpent with 128-bit key +%% arcfour OPTIONAL the ARCFOUR stream cipher +%% idea-cbc OPTIONAL IDEA in CBC mode +%% cast128-cbc OPTIONAL CAST-128 in CBC mode +%% none OPTIONAL no encryption; NOT RECOMMENDED %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% encrypt_init(#ssh{encrypt = none} = Ssh) -> {ok, Ssh}; -encrypt_init(#ssh{encrypt = 'AEAD_AES_128_GCM', role = client} = Ssh) -> - IV = hash(Ssh, "A", 12*8), - <> = hash(Ssh, "C", 128), - {ok, Ssh#ssh{encrypt_keys = K, - encrypt_block_size = 16, - encrypt_ctx = IV}}; -encrypt_init(#ssh{encrypt = 'AEAD_AES_128_GCM', role = server} = Ssh) -> - IV = hash(Ssh, "B", 12*8), - <> = hash(Ssh, "D", 128), - {ok, Ssh#ssh{encrypt_keys = K, - encrypt_block_size = 16, - encrypt_ctx = IV}}; -encrypt_init(#ssh{encrypt = 'AEAD_AES_256_GCM', role = client} = Ssh) -> - IV = hash(Ssh, "A", 12*8), - <> = hash(Ssh, "C", 256), - {ok, Ssh#ssh{encrypt_keys = K, - encrypt_block_size = 16, - encrypt_ctx = IV}}; -encrypt_init(#ssh{encrypt = 'AEAD_AES_256_GCM', role = server} = Ssh) -> - IV = hash(Ssh, "B", 12*8), - <> = hash(Ssh, "D", 256), - {ok, Ssh#ssh{encrypt_keys = K, - encrypt_block_size = 16, - encrypt_ctx = IV}}; encrypt_init(#ssh{encrypt = '3des-cbc', role = client} = Ssh) -> IV = hash(Ssh, "A", 64), <> = hash(Ssh, "C", 192), @@ -1159,46 +652,18 @@ encrypt_block_size = 16, encrypt_ctx = IV}}; encrypt_init(#ssh{encrypt = 'aes128-ctr', role = client} = Ssh) -> - IV = hash(Ssh, "A", 128), + IV = hash(Ssh, "A", 128), <> = hash(Ssh, "C", 128), State = crypto:stream_init(aes_ctr, K, IV), {ok, Ssh#ssh{encrypt_keys = K, encrypt_block_size = 16, encrypt_ctx = State}}; -encrypt_init(#ssh{encrypt = 'aes192-ctr', role = client} = Ssh) -> - IV = hash(Ssh, "A", 128), - <> = hash(Ssh, "C", 192), - State = crypto:stream_init(aes_ctr, K, IV), - {ok, Ssh#ssh{encrypt_keys = K, - encrypt_block_size = 16, - encrypt_ctx = State}}; -encrypt_init(#ssh{encrypt = 'aes256-ctr', role = client} = Ssh) -> - IV = hash(Ssh, "A", 128), - <> = hash(Ssh, "C", 256), - State = crypto:stream_init(aes_ctr, K, IV), - {ok, Ssh#ssh{encrypt_keys = K, - encrypt_block_size = 16, - encrypt_ctx = State}}; encrypt_init(#ssh{encrypt = 'aes128-ctr', role = server} = Ssh) -> - IV = hash(Ssh, "B", 128), + IV = hash(Ssh, "B", 128), <> = hash(Ssh, "D", 128), State = crypto:stream_init(aes_ctr, K, IV), {ok, Ssh#ssh{encrypt_keys = K, encrypt_block_size = 16, - encrypt_ctx = State}}; -encrypt_init(#ssh{encrypt = 'aes192-ctr', role = server} = Ssh) -> - IV = hash(Ssh, "B", 128), - <> = hash(Ssh, "D", 192), - State = crypto:stream_init(aes_ctr, K, IV), - {ok, Ssh#ssh{encrypt_keys = K, - encrypt_block_size = 16, - encrypt_ctx = State}}; -encrypt_init(#ssh{encrypt = 'aes256-ctr', role = server} = Ssh) -> - IV = hash(Ssh, "B", 128), - <> = hash(Ssh, "D", 256), - State = crypto:stream_init(aes_ctr, K, IV), - {ok, Ssh#ssh{encrypt_keys = K, - encrypt_block_size = 16, encrypt_ctx = State}}. encrypt_final(Ssh) -> @@ -1210,18 +675,6 @@ encrypt(#ssh{encrypt = none} = Ssh, Data) -> {Ssh, Data}; -encrypt(#ssh{encrypt = 'AEAD_AES_128_GCM', - encrypt_keys = K, - encrypt_ctx = IV0} = Ssh, Data={_AAD,_Ptext}) -> - Enc = {_Ctext,_Ctag} = crypto:block_encrypt(aes_gcm, K, IV0, Data), - IV = next_gcm_iv(IV0), - {Ssh#ssh{encrypt_ctx = IV}, Enc}; -encrypt(#ssh{encrypt = 'AEAD_AES_256_GCM', - encrypt_keys = K, - encrypt_ctx = IV0} = Ssh, Data={_AAD,_Ptext}) -> - Enc = {_Ctext,_Ctag} = crypto:block_encrypt(aes_gcm, K, IV0, Data), - IV = next_gcm_iv(IV0), - {Ssh#ssh{encrypt_ctx = IV}, Enc}; encrypt(#ssh{encrypt = '3des-cbc', encrypt_keys = {K1,K2,K3}, encrypt_ctx = IV0} = Ssh, Data) -> @@ -1237,14 +690,6 @@ encrypt(#ssh{encrypt = 'aes128-ctr', encrypt_ctx = State0} = Ssh, Data) -> {State, Enc} = crypto:stream_encrypt(State0,Data), - {Ssh#ssh{encrypt_ctx = State}, Enc}; -encrypt(#ssh{encrypt = 'aes192-ctr', - encrypt_ctx = State0} = Ssh, Data) -> - {State, Enc} = crypto:stream_encrypt(State0,Data), - {Ssh#ssh{encrypt_ctx = State}, Enc}; -encrypt(#ssh{encrypt = 'aes256-ctr', - encrypt_ctx = State0} = Ssh, Data) -> - {State, Enc} = crypto:stream_encrypt(State0,Data), {Ssh#ssh{encrypt_ctx = State}, Enc}. @@ -1254,30 +699,6 @@ decrypt_init(#ssh{decrypt = none} = Ssh) -> {ok, Ssh}; -decrypt_init(#ssh{decrypt = 'AEAD_AES_128_GCM', role = client} = Ssh) -> - IV = hash(Ssh, "B", 12*8), - <> = hash(Ssh, "D", 128), - {ok, Ssh#ssh{decrypt_keys = K, - decrypt_block_size = 16, - decrypt_ctx = IV}}; -decrypt_init(#ssh{decrypt = 'AEAD_AES_128_GCM', role = server} = Ssh) -> - IV = hash(Ssh, "A", 12*8), - <> = hash(Ssh, "C", 128), - {ok, Ssh#ssh{decrypt_keys = K, - decrypt_block_size = 16, - decrypt_ctx = IV}}; -decrypt_init(#ssh{decrypt = 'AEAD_AES_256_GCM', role = client} = Ssh) -> - IV = hash(Ssh, "B", 12*8), - <> = hash(Ssh, "D", 256), - {ok, Ssh#ssh{decrypt_keys = K, - decrypt_block_size = 16, - decrypt_ctx = IV}}; -decrypt_init(#ssh{decrypt = 'AEAD_AES_256_GCM', role = server} = Ssh) -> - IV = hash(Ssh, "A", 12*8), - <> = hash(Ssh, "C", 256), - {ok, Ssh#ssh{decrypt_keys = K, - decrypt_block_size = 16, - decrypt_ctx = IV}}; decrypt_init(#ssh{decrypt = '3des-cbc', role = client} = Ssh) -> {IV, KD} = {hash(Ssh, "B", 64), hash(Ssh, "D", 192)}, @@ -1309,40 +730,12 @@ {ok, Ssh#ssh{decrypt_keys = K, decrypt_block_size = 16, decrypt_ctx = State}}; -decrypt_init(#ssh{decrypt = 'aes192-ctr', role = client} = Ssh) -> - IV = hash(Ssh, "B", 128), - <> = hash(Ssh, "D", 192), - State = crypto:stream_init(aes_ctr, K, IV), - {ok, Ssh#ssh{decrypt_keys = K, - decrypt_block_size = 16, - decrypt_ctx = State}}; -decrypt_init(#ssh{decrypt = 'aes256-ctr', role = client} = Ssh) -> - IV = hash(Ssh, "B", 128), - <> = hash(Ssh, "D", 256), - State = crypto:stream_init(aes_ctr, K, IV), - {ok, Ssh#ssh{decrypt_keys = K, - decrypt_block_size = 16, - decrypt_ctx = State}}; decrypt_init(#ssh{decrypt = 'aes128-ctr', role = server} = Ssh) -> IV = hash(Ssh, "A", 128), <> = hash(Ssh, "C", 128), State = crypto:stream_init(aes_ctr, K, IV), {ok, Ssh#ssh{decrypt_keys = K, decrypt_block_size = 16, - decrypt_ctx = State}}; -decrypt_init(#ssh{decrypt = 'aes192-ctr', role = server} = Ssh) -> - IV = hash(Ssh, "A", 128), - <> = hash(Ssh, "C", 192), - State = crypto:stream_init(aes_ctr, K, IV), - {ok, Ssh#ssh{decrypt_keys = K, - decrypt_block_size = 16, - decrypt_ctx = State}}; -decrypt_init(#ssh{decrypt = 'aes256-ctr', role = server} = Ssh) -> - IV = hash(Ssh, "A", 128), - <> = hash(Ssh, "C", 256), - State = crypto:stream_init(aes_ctr, K, IV), - {ok, Ssh#ssh{decrypt_keys = K, - decrypt_block_size = 16, decrypt_ctx = State}}. @@ -1352,22 +745,8 @@ decrypt_ctx = undefined, decrypt_block_size = 8}}. -decrypt(Ssh, <<>>) -> - {Ssh, <<>>}; decrypt(#ssh{decrypt = none} = Ssh, Data) -> {Ssh, Data}; -decrypt(#ssh{decrypt = 'AEAD_AES_128_GCM', - decrypt_keys = K, - decrypt_ctx = IV0} = Ssh, Data = {_AAD,_Ctext,_Ctag}) -> - Dec = crypto:block_decrypt(aes_gcm, K, IV0, Data), % Dec = PlainText | error - IV = next_gcm_iv(IV0), - {Ssh#ssh{decrypt_ctx = IV}, Dec}; -decrypt(#ssh{decrypt = 'AEAD_AES_256_GCM', - decrypt_keys = K, - decrypt_ctx = IV0} = Ssh, Data = {_AAD,_Ctext,_Ctag}) -> - Dec = crypto:block_decrypt(aes_gcm, K, IV0, Data), % Dec = PlainText | error - IV = next_gcm_iv(IV0), - {Ssh#ssh{decrypt_ctx = IV}, Dec}; decrypt(#ssh{decrypt = '3des-cbc', decrypt_keys = Keys, decrypt_ctx = IV0} = Ssh, Data) -> {K1, K2, K3} = Keys, @@ -1382,20 +761,8 @@ decrypt(#ssh{decrypt = 'aes128-ctr', decrypt_ctx = State0} = Ssh, Data) -> {State, Enc} = crypto:stream_decrypt(State0,Data), - {Ssh#ssh{decrypt_ctx = State}, Enc}; -decrypt(#ssh{decrypt = 'aes192-ctr', - decrypt_ctx = State0} = Ssh, Data) -> - {State, Enc} = crypto:stream_decrypt(State0,Data), - {Ssh#ssh{decrypt_ctx = State}, Enc}; -decrypt(#ssh{decrypt = 'aes256-ctr', - decrypt_ctx = State0} = Ssh, Data) -> - {State, Enc} = crypto:stream_decrypt(State0,Data), {Ssh#ssh{decrypt_ctx = State}, Enc}. - -next_gcm_iv(<>) -> <>. - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Compression %% @@ -1478,54 +845,49 @@ {Ssh, list_to_binary(Decompressed)}. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% %% MAC calculation %% +%% hmac-sha1 REQUIRED HMAC-SHA1 (digest length = key +%% length = 20) +%% hmac-sha1-96 RECOMMENDED first 96 bits of HMAC-SHA1 (digest +%% length = 12, key length = 20) +%% hmac-md5 OPTIONAL HMAC-MD5 (digest length = key +%% length = 16) +%% hmac-md5-96 OPTIONAL first 96 bits of HMAC-MD5 (digest +%% length = 12, key length = 16) +%% none OPTIONAL no MAC; NOT RECOMMENDED +%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% send_mac_init(SSH) -> - case pkt_type(SSH#ssh.send_mac) of - common -> - case SSH#ssh.role of - client -> - KeySize = mac_key_size(SSH#ssh.send_mac), - Key = hash(SSH, "E", KeySize), - {ok, SSH#ssh { send_mac_key = Key }}; - server -> - KeySize = mac_key_size(SSH#ssh.send_mac), - Key = hash(SSH, "F", KeySize), - {ok, SSH#ssh { send_mac_key = Key }} - end; - aead -> - %% Not applicable - {ok, SSH} + case SSH#ssh.role of + client -> + KeySize =mac_key_size(SSH#ssh.send_mac), + Key = hash(SSH, "E", KeySize), + {ok, SSH#ssh { send_mac_key = Key }}; + server -> + KeySize = mac_key_size(SSH#ssh.send_mac), + Key = hash(SSH, "F", KeySize), + {ok, SSH#ssh { send_mac_key = Key }} end. send_mac_final(SSH) -> - {ok, SSH#ssh {send_mac = none, - send_mac_key = undefined }}. - + {ok, SSH#ssh { send_mac = none, send_mac_key = undefined }}. recv_mac_init(SSH) -> - case pkt_type(SSH#ssh.recv_mac) of - common -> - case SSH#ssh.role of - client -> - Key = hash(SSH, "F", mac_key_size(SSH#ssh.recv_mac)), - {ok, SSH#ssh { recv_mac_key = Key }}; - server -> - Key = hash(SSH, "E", mac_key_size(SSH#ssh.recv_mac)), - {ok, SSH#ssh { recv_mac_key = Key }} - end; - aead -> - %% Not applicable - {ok, SSH} + case SSH#ssh.role of + client -> + Key = hash(SSH, "F", mac_key_size(SSH#ssh.recv_mac)), + {ok, SSH#ssh { recv_mac_key = Key }}; + server -> + Key = hash(SSH, "E", mac_key_size(SSH#ssh.recv_mac)), + {ok, SSH#ssh { recv_mac_key = Key }} end. recv_mac_final(SSH) -> {ok, SSH#ssh { recv_mac = none, recv_mac_key = undefined }}. -mac(none, _ , _, _) -> +mac(none, _ , _, _) -> <<>>; mac('hmac-sha1', Key, SeqNum, Data) -> crypto:hmac(sha, Key, [<>, Data]); @@ -1536,9 +898,7 @@ mac('hmac-md5-96', Key, SeqNum, Data) -> crypto:hmac(md5, Key, [<>, Data], mac_digest_size('hmac-md5-96')); mac('hmac-sha2-256', Key, SeqNum, Data) -> - crypto:hmac(sha256, Key, [<>, Data]); -mac('hmac-sha2-512', Key, SeqNum, Data) -> - crypto:hmac(sha512, Key, [<>, Data]). + crypto:hmac(sha256, Key, [<>, Data]). %% return N hash bytes (HASH) hash(SSH, Char, Bits) -> @@ -1546,20 +906,8 @@ case SSH#ssh.kex of 'diffie-hellman-group1-sha1' -> fun(Data) -> crypto:hash(sha, Data) end; - 'diffie-hellman-group14-sha1' -> - fun(Data) -> crypto:hash(sha, Data) end; - 'diffie-hellman-group-exchange-sha1' -> fun(Data) -> crypto:hash(sha, Data) end; - 'diffie-hellman-group-exchange-sha256' -> - fun(Data) -> crypto:hash(sha256, Data) end; - - 'ecdh-sha2-nistp256' -> - fun(Data) -> crypto:hash(sha256,Data) end; - 'ecdh-sha2-nistp384' -> - fun(Data) -> crypto:hash(sha384,Data) end; - 'ecdh-sha2-nistp521' -> - fun(Data) -> crypto:hash(sha512,Data) end; _ -> exit({bad_algorithm,SSH#ssh.kex}) end, @@ -1583,36 +931,22 @@ hash(K, H, <>, N-128, HASH). kex_h(SSH, Key, E, F, K) -> - KeyBin = public_key:ssh_encode(Key, ssh2_pubkey), L = ssh_bits:encode([SSH#ssh.c_version, SSH#ssh.s_version, SSH#ssh.c_keyinit, SSH#ssh.s_keyinit, - KeyBin, E,F,K], + ssh_message:encode_host_key(Key), E,F,K], [string,string,binary,binary,binary, mpint,mpint,mpint]), - crypto:hash(sha((SSH#ssh.algorithms)#alg.kex), L). -%% crypto:hash(sha,L). - -kex_h(SSH, Curve, Key, Q_c, Q_s, K) -> - KeyBin = public_key:ssh_encode(Key, ssh2_pubkey), - L = ssh_bits:encode([SSH#ssh.c_version, SSH#ssh.s_version, - SSH#ssh.c_keyinit, SSH#ssh.s_keyinit, - KeyBin, Q_c, Q_s, K], - [string,string,binary,binary,binary, - mpint,mpint,mpint]), - crypto:hash(sha(Curve), L). + crypto:hash(sha,L). + kex_h(SSH, Key, Min, NBits, Max, Prime, Gen, E, F, K) -> - KeyBin = public_key:ssh_encode(Key, ssh2_pubkey), L = if Min==-1; Max==-1 -> - %% flag from 'ssh_msg_kex_dh_gex_request_old' - %% It was like this before that message was supported, - %% why? Ts = [string,string,binary,binary,binary, uint32, mpint,mpint,mpint,mpint,mpint], ssh_bits:encode([SSH#ssh.c_version,SSH#ssh.s_version, SSH#ssh.c_keyinit,SSH#ssh.s_keyinit, - KeyBin, NBits, Prime, Gen, E,F,K], + ssh_message:encode_host_key(Key), NBits, Prime, Gen, E,F,K], Ts); true -> Ts = [string,string,binary,binary,binary, @@ -1620,30 +954,16 @@ mpint,mpint,mpint,mpint,mpint], ssh_bits:encode([SSH#ssh.c_version,SSH#ssh.s_version, SSH#ssh.c_keyinit,SSH#ssh.s_keyinit, - KeyBin, Min, NBits, Max, + ssh_message:encode_host_key(Key), Min, NBits, Max, Prime, Gen, E,F,K], Ts) end, - crypto:hash(sha((SSH#ssh.algorithms)#alg.kex), L). + crypto:hash(sha,L). - -sha(secp256r1) -> sha256; -sha(secp384r1) -> sha384; -sha(secp521r1) -> sha512; -sha('diffie-hellman-group1-sha1') -> sha; -sha('diffie-hellman-group14-sha1') -> sha; -sha('diffie-hellman-group-exchange-sha1') -> sha; -sha('diffie-hellman-group-exchange-sha256') -> sha256; -sha(?'secp256r1') -> sha(secp256r1); -sha(?'secp384r1') -> sha(secp384r1); -sha(?'secp521r1') -> sha(secp521r1). - - mac_key_size('hmac-sha1') -> 20*8; mac_key_size('hmac-sha1-96') -> 20*8; mac_key_size('hmac-md5') -> 16*8; mac_key_size('hmac-md5-96') -> 16*8; mac_key_size('hmac-sha2-256')-> 32*8; -mac_key_size('hmac-sha2-512')-> 512; mac_key_size(none) -> 0. mac_digest_size('hmac-sha1') -> 20; @@ -1651,9 +971,6 @@ mac_digest_size('hmac-md5') -> 20; mac_digest_size('hmac-md5-96') -> 12; mac_digest_size('hmac-sha2-256') -> 32; -mac_digest_size('hmac-sha2-512') -> 64; -mac_digest_size('AEAD_AES_128_GCM') -> 16; -mac_digest_size('AEAD_AES_256_GCM') -> 16; mac_digest_size(none) -> 0. peer_name({Host, _}) -> @@ -1665,91 +982,12 @@ %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dh_group('diffie-hellman-group1-sha1') -> ?dh_group1; -dh_group('diffie-hellman-group14-sha1') -> ?dh_group14. - -%%%---------------------------------------------------------------- -generate_key(Algorithm, Args) -> - {Public,Private} = crypto:generate_key(Algorithm, Args), - {crypto:bytes_to_integer(Public), crypto:bytes_to_integer(Private)}. - - -compute_key(Algorithm, OthersPublic, MyPrivate, Args) -> - Shared = crypto:compute_key(Algorithm, OthersPublic, MyPrivate, Args), - crypto:bytes_to_integer(Shared). - - -ecdh_curve('ecdh-sha2-nistp256') -> secp256r1; -ecdh_curve('ecdh-sha2-nistp384') -> secp384r1; -ecdh_curve('ecdh-sha2-nistp521') -> secp521r1. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% -%% Utils for default_algorithms/1 and supported_algorithms/1 -%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -supported_algorithms(Key, [{client2server,BL1},{server2client,BL2}]) -> - [{client2server,As1},{server2client,As2}] = supported_algorithms(Key), - [{client2server,As1--BL1},{server2client,As2--BL2}]; -supported_algorithms(Key, BlackList) -> - supported_algorithms(Key) -- BlackList. - - -select_crypto_supported(L) -> - Sup = [{ec_curve,crypto_supported_curves()} | crypto:supports()], - [Name || {Name,CryptoRequires} <- L, - crypto_supported(CryptoRequires, Sup)]. - -crypto_supported_curves() -> - try crypto:ec_curves() - catch _:_ -> [] - end. - -crypto_supported(Conditions, Supported) -> - lists:all( fun({Tag,CryptoName}) when is_atom(CryptoName) -> - crypto_name_supported(Tag,CryptoName,Supported); - ({Tag,{Name,Len}}) when is_integer(Len) -> - crypto_name_supported(Tag,Name,Supported) andalso - len_supported(Name,Len) - end, Conditions). - -crypto_name_supported(Tag, CryptoName, Supported) -> - lists:member(CryptoName, proplists:get_value(Tag,Supported,[])). - -len_supported(Name, Len) -> - try - case Name of - aes_ctr -> - {_, <<_/binary>>} = - %% Test encryption - crypto:stream_encrypt(crypto:stream_init(Name, <<0:Len>>, <<0:128>>), <<"">>); - aes_gcm -> - {<<_/binary>>, <<_/binary>>} = - crypto:block_encrypt(Name, - _Key = <<0:Len>>, - _IV = <<0:12/unsigned-unit:8>>, - {<<"AAD">>,"PT"}) - end - of - _ -> true - catch - _:_ -> false - end. - - -same(Algs) -> [{client2server,Algs}, {server2client,Algs}]. - +dh_group1() -> + {2, 16#FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF}. -%% default_algorithms(kex) -> % Example of how to disable an algorithm -%% supported_algorithms(kex, ['ecdh-sha2-nistp521']); - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% -%% Other utils -%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +dh_gen_key(G, P, _) -> + {Public, Private} = crypto:generate_key(dh, [P, G]), + {crypto:bytes_to_integer(Private), crypto:bytes_to_integer(Public)}. trim_tail(Str) -> lists:reverse(trim_head(lists:reverse(Str))). diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_transport.hrl erlang-17.3-dfsg/lib/ssh/src/ssh_transport.hrl --- erlang-18.2-dfsg/lib/ssh/src/ssh_transport.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_transport.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,12 +28,9 @@ -define(DEFAULT_CLIENT_VERSION, {2, 0}). -define(DEFAULT_SERVER_VERSION, {2, 0}). - --define(MAX_NUM_ALGORITHMS, 200). - --define(DEFAULT_DH_GROUP_MIN, 1024). --define(DEFAULT_DH_GROUP_NBITS, 2048). --define(DEFAULT_DH_GROUP_MAX, 8192). +-define(DEFAULT_DH_GROUP_MIN, 512). +-define(DEFAULT_DH_GROUP_NBITS, 1024). +-define(DEFAULT_DH_GROUP_MAX, 4096). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% @@ -112,9 +108,8 @@ %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% diffie-hellman-group1-sha1 | diffie-hellman-group14-sha1 - --define(SSH_MSG_KEXDH_INIT, 30). +%% diffie-hellman-group1-sha1 +-define(SSH_MSG_KEXDH_INIT, 30). -define(SSH_MSG_KEXDH_REPLY, 31). -record(ssh_msg_kexdh_init, @@ -138,7 +133,7 @@ %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% diffie-hellman-group-exchange-sha1 | diffie-hellman-group-exchange-sha256 +%% diffie-hellman-group-exchange-sha1 -define(SSH_MSG_KEX_DH_GEX_REQUEST_OLD, 30). -define(SSH_MSG_KEX_DH_GEX_REQUEST, 34). -define(SSH_MSG_KEX_DH_GEX_GROUP, 31). @@ -175,36 +170,7 @@ h_sig }). -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% -%% KEY ECDH messages -%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% ecdh-sha2-nistp256 | ecdh-sha2-nistp384 | ecdh-sha2-nistp521 - --define(SSH_MSG_KEX_ECDH_INIT, 30). --define(SSH_MSG_KEX_ECDH_REPLY, 31). - --record(ssh_msg_kex_ecdh_init, - { - q_c % string (client's ephemeral public key octet string) - }). - --record(ssh_msg_kex_ecdh_reply, - { - public_host_key, % string (server's public host key) (k_s) - q_s, % string (server's ephemeral public key octet string) - h_sig % string (the signature on the exchange hash) - }). - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% %% error codes -%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -define(SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT, 1). -define(SSH_DISCONNECT_PROTOCOL_ERROR, 2). -define(SSH_DISCONNECT_KEY_EXCHANGE_FAILED, 3). @@ -222,20 +188,48 @@ -define(SSH_DISCONNECT_ILLEGAL_USER_NAME, 15). -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% -%% groups -%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%%% rfc 2489, ch 6.2 -%%% Size 1024 --define(dh_group1, - {2, 16#FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF}). - -%%% rfc 3526, ch3 -%%% Size 2048 --define(dh_group14, - {2, 16#FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF}). +%%%---------------------------------------------------------------------- +%%% # DH_14_xxx +%%% Description: Oakley group 14 prime numbers and generator. Used in +%%% diffie-hellman-group1-sha1 key exchange method. +%%%---------------------------------------------------------------------- +%%%---------------------------------------------------------------------- +%%% # DH_14_P +%%% Description: Prime for this group +%%%---------------------------------------------------------------------- + +-define(DH_14_P, + <<000,000,000,129,000,255,255,255,255,255,255,255,255,201,015,218, + 162,033,104,194,052,196,198,098,139,128,220,028,209,041,002,078, + 008,138,103,204,116,002,011,190,166,059,019,155,034,081,074,008, + 121,142,052,004,221,239,149,025,179,205,058,067,027,048,043,010, + 109,242,095,020,055,079,225,053,109,109,081,194,069,228,133,181, + 118,098,094,126,198,244,076,066,233,166,055,237,107,011,255,092, + 182,244,006,183,237,238,056,107,251,090,137,159,165,174,159,036, + 017,124,075,031,230,073,040,102,081,236,230,083,129,255,255,255, + 255,255,255,255,255>>). + +%%%---------------------------------------------------------------------- +%%% # DH_14_G +%%% Description: Generator for DH_14_P. +%%%---------------------------------------------------------------------- + +-define(DH_14_G, <<0,0,0,1,2>>). + +%%%---------------------------------------------------------------------- +%%% # DH_14_Q +%%% Description: Group order (DH_14_P - 1) / 2. +%%%---------------------------------------------------------------------- + +-define(DH_14_Q, + <<000,000,000,128,127,255,255,255,255,255,255,255,228,135,237,081, + 016,180,097,026,098,099,049,069,192,110,014,104,148,129,039,004, + 069,051,230,058,001,005,223,083,029,137,205,145,040,165,004,060, + 199,026,002,110,247,202,140,217,230,157,033,141,152,021,133,054, + 249,047,138,027,167,240,154,182,182,168,225,034,242,066,218,187, + 049,047,063,099,122,038,033,116,211,027,246,181,133,255,174,091, + 122,003,091,246,247,028,053,253,173,068,207,210,215,079,146,008, + 190,037,143,243,036,148,051,040,246,115,041,192,255,255,255,255, + 255,255,255,255>>). -endif. % -ifdef(ssh_transport). diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_userauth.hrl erlang-17.3-dfsg/lib/ssh/src/ssh_userauth.hrl --- erlang-18.2-dfsg/lib/ssh/src/ssh_userauth.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_userauth.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_xfer.erl erlang-17.3-dfsg/lib/ssh/src/ssh_xfer.erl --- erlang-18.2-dfsg/lib/ssh/src/ssh_xfer.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_xfer.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2014. All Rights Reserved. +%% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,12 +23,12 @@ -module(ssh_xfer). --export([attach/2, connect/3, connect/4]). +-export([attach/2, connect/3]). -export([open/6, opendir/3, readdir/3, close/3, read/5, write/5, rename/5, remove/3, mkdir/4, rmdir/3, realpath/3, extended/4, stat/4, fstat/4, lstat/4, setstat/4, readlink/3, fsetstat/4, symlink/4, - protocol_version_request/2, + protocol_version_request/1, xf_reply/2, xf_send_reply/3, xf_send_names/3, xf_send_name/4, xf_send_status/3, xf_send_status/4, xf_send_status/5, @@ -59,13 +58,6 @@ Error -> Error end. -connect(Host, Port, Opts, Timeout) -> - case ssh:connect(Host, Port, Opts, Timeout) of - {ok, CM} -> open_xfer(CM, [{timeout, Timeout}|Opts]); - {error, Timeout} -> {error, timeout}; - Error -> Error - end. - open_xfer(CM, Opts) -> TMO = proplists:get_value(timeout, Opts, infinity), case ssh_connection:session_channel(CM, ?XFER_WINDOW_SIZE, ?XFER_PACKET_SIZE, TMO) of @@ -75,8 +67,8 @@ Error end. -protocol_version_request(XF, Version) -> - xf_request(XF, ?SSH_FXP_INIT, <>). +protocol_version_request(XF) -> + xf_request(XF, ?SSH_FXP_INIT, <>). open(XF, ReqID, FileName, Access, Flags, Attrs) -> Vsn = XF#ssh_xfer.vsn, diff -Nru erlang-18.2-dfsg/lib/ssh/src/ssh_xfer.hrl erlang-17.3-dfsg/lib/ssh/src/ssh_xfer.hrl --- erlang-18.2-dfsg/lib/ssh/src/ssh_xfer.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/src/ssh_xfer.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/test/Makefile erlang-17.3-dfsg/lib/ssh/test/Makefile --- erlang-18.2-dfsg/lib/ssh/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2004-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -32,28 +31,16 @@ # ---------------------------------------------------- MODULES= \ - ssh_algorithms_SUITE \ - ssh_options_SUITE \ - ssh_renegotiate_SUITE \ - \ + ssh_test_lib \ ssh_basic_SUITE \ - \ - ssh_connection_SUITE \ - ssh_protocol_SUITE \ + ssh_to_openssh_SUITE \ ssh_sftp_SUITE \ ssh_sftpd_SUITE \ ssh_sftpd_erlclient_SUITE \ - ssh_sup_SUITE \ - ssh_to_openssh_SUITE \ - ssh_upgrade_SUITE \ - ssh_test_lib \ - ssh_key_cb \ - ssh_key_cb_options \ - ssh_trpt_test_lib \ + ssh_connection_SUITE \ ssh_echo_server \ ssh_peername_sockname_server \ - ssh_test_cli \ - ssh_relay + ssh_test_cli HRL_FILES_NEEDED_IN_TEST= \ $(ERL_TOP)/lib/ssh/src/ssh.hrl \ diff -Nru erlang-18.2-dfsg/lib/ssh/test/property_test/ssh_eqc_client_server.erl erlang-17.3-dfsg/lib/ssh/test/property_test/ssh_eqc_client_server.erl --- erlang-18.2-dfsg/lib/ssh/test/property_test/ssh_eqc_client_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/property_test/ssh_eqc_client_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,10 +32,6 @@ -else. -%% Limit the testing time on CI server... this needs to be improved in % from total budget. --define(TESTINGTIME(Prop), eqc:testing_time(30,Prop)). - - -include_lib("eqc/include/eqc.hrl"). -include_lib("eqc/include/eqc_statem.hrl"). -eqc_group_commands(true). @@ -80,9 +75,7 @@ -define(SUBSYSTEMS, ["echo1", "echo2", "echo3", "echo4"]). --define(SERVER_ADDRESS, { {127,1,0,choose(1,254)}, % IP - choose(1024,65535) % Port - }). +-define(SERVER_ADDRESS, { {127,1,1,1}, inet_port({127,1,1,1}) }). -define(SERVER_EXTRA_OPTIONS, [{parallel_login,bool()}] ). @@ -104,7 +97,7 @@ %% To be called as eqc:quickcheck( ssh_eqc_client_server:prop_seq() ). prop_seq() -> - ?TESTINGTIME(do_prop_seq(?SSH_DIR)). + do_prop_seq(?SSH_DIR). %% To be called from a common_test test suite prop_seq(CT_Config) -> @@ -112,10 +105,9 @@ do_prop_seq(DataDir) -> - setup_rsa(DataDir), - ?FORALL(Cmds,commands(?MODULE), + ?FORALL(Cmds,commands(?MODULE, #state{data_dir=DataDir}), begin - {H,Sf,Result} = run_commands(?MODULE,Cmds,[{data_dir,DataDir}]), + {H,Sf,Result} = run_commands(?MODULE,Cmds), present_result(?MODULE, Cmds, {H,Sf,Result}, Result==ok) end). @@ -124,35 +116,33 @@ SSHdir). %%%---- prop_parallel() -> - ?TESTINGTIME(do_prop_parallel(?SSH_DIR)). + do_prop_parallel(?SSH_DIR). %% To be called from a common_test test suite prop_parallel(CT_Config) -> do_prop_parallel(full_path(?SSH_DIR, CT_Config)). do_prop_parallel(DataDir) -> - setup_rsa(DataDir), - ?FORALL(Cmds,parallel_commands(?MODULE), + ?FORALL(Cmds,parallel_commands(?MODULE, #state{data_dir=DataDir}), begin - {H,Sf,Result} = run_parallel_commands(?MODULE,Cmds,[{data_dir,DataDir}]), + {H,Sf,Result} = run_parallel_commands(?MODULE,Cmds), present_result(?MODULE, Cmds, {H,Sf,Result}, Result==ok) end). %%%---- prop_parallel_multi() -> - ?TESTINGTIME(do_prop_parallel_multi(?SSH_DIR)). + do_prop_parallel_multi(?SSH_DIR). %% To be called from a common_test test suite prop_parallel_multi(CT_Config) -> do_prop_parallel_multi(full_path(?SSH_DIR, CT_Config)). do_prop_parallel_multi(DataDir) -> - setup_rsa(DataDir), ?FORALL(Repetitions,?SHRINK(1,[10]), - ?FORALL(Cmds,parallel_commands(?MODULE), + ?FORALL(Cmds,parallel_commands(?MODULE, #state{data_dir=DataDir}), ?ALWAYS(Repetitions, begin - {H,Sf,Result} = run_parallel_commands(?MODULE,Cmds,[{data_dir,DataDir}]), + {H,Sf,Result} = run_parallel_commands(?MODULE,Cmds), present_result(?MODULE, Cmds, {H,Sf,Result}, Result==ok) end))). @@ -161,12 +151,14 @@ %%% called when using commands/1 initial_state() -> - #state{}. + S = initial_state(#state{}), + S#state{initialized=true}. %%% called when using commands/2 -initial_state(DataDir) -> +initial_state(S) -> application:stop(ssh), - ssh:start(). + ssh:start(), + setup_rsa(S#state.data_dir). %%%---------------- weight(S, ssh_send) -> 5*length([C || C<-S#state.channels, has_subsyst(C)]); @@ -180,7 +172,7 @@ initial_state_pre(S) -> not S#state.initialized. -initial_state_args(_) -> [{var,data_dir}]. +initial_state_args(S) -> [S]. initial_state_next(S, _, _) -> S#state{initialized=true}. @@ -188,17 +180,10 @@ %%% Start a new daemon %%% Precondition: not more than ?MAX_NUM_SERVERS started -%%% This is a bit funny because we need to pick an IP address and Port to -%%% run the server on, but there is no way to atomically select a free Port! -%%% -%%% Therefore we just grab one IP-Port pair randomly and try to start the ssh server -%%% on that pair. If it fails, we just forget about it and goes on. Yes, it -%%% is a waste of cpu cycles, but at least it works! - ssh_server_pre(S) -> S#state.initialized andalso length(S#state.servers) < ?MAX_NUM_SERVERS. -ssh_server_args(_) -> [?SERVER_ADDRESS, {var,data_dir}, ?SERVER_EXTRA_OPTIONS]. +ssh_server_args(S) -> [?SERVER_ADDRESS, S#state.data_dir, ?SERVER_EXTRA_OPTIONS]. ssh_server({IP,Port}, DataDir, ExtraOptions) -> ok(ssh:daemon(IP, Port, @@ -209,10 +194,8 @@ | ExtraOptions ])). -ssh_server_post(_S, _Args, {error,eaddrinuse}) -> true; ssh_server_post(_S, _Args, Result) -> is_ok(Result). -ssh_server_next(S, {error,eaddrinuse}, _) -> S; ssh_server_next(S, Result, [{IP,Port},_,_]) -> S#state{servers=[#srvr{ref = Result, address = IP, @@ -258,16 +241,15 @@ ssh_open_connection_pre(S) -> S#state.servers /= []. -ssh_open_connection_args(S) -> [oneof(S#state.servers), {var,data_dir}]. +ssh_open_connection_args(S) -> [oneof(S#state.servers), S#state.data_dir]. ssh_open_connection(#srvr{address=Ip, port=Port}, DataDir) -> ok(ssh:connect(ensure_string(Ip), Port, [ {silently_accept_hosts, true}, {user_dir, user_dir(DataDir)}, - {user_interaction, false}, - {connect_timeout, 2000} - ], 2000)). + {user_interaction, false} + ])). ssh_open_connection_post(_S, _Args, Result) -> is_ok(Result). @@ -587,6 +569,12 @@ %%%================================================================ %%% The rest is taken and modified from ssh_test_lib.erl +inet_port(IpAddress)-> + {ok, Socket} = gen_tcp:listen(0, [{ip,IpAddress},{reuseaddr,true}]), + {ok, Port} = inet:port(Socket), + gen_tcp:close(Socket), + Port. + setup_rsa(Dir) -> erase_dir(system_dir(Dir)), erase_dir(user_dir(Dir)), diff -Nru erlang-18.2-dfsg/lib/ssh/test/property_test/ssh_eqc_encode_decode.erl erlang-17.3-dfsg/lib/ssh/test/property_test/ssh_eqc_encode_decode.erl --- erlang-18.2-dfsg/lib/ssh/test/property_test/ssh_eqc_encode_decode.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/property_test/ssh_eqc_encode_decode.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -26,6 +25,8 @@ -proptest(eqc). -proptest([triq,proper]). +-include_lib("ct_property_test.hrl"). + -ifndef(EQC). -ifndef(PROPER). -ifndef(TRIQ). diff -Nru erlang-18.2-dfsg/lib/ssh/test/property_test/ssh_eqc_subsys.erl erlang-17.3-dfsg/lib/ssh/test/property_test/ssh_eqc_subsys.erl --- erlang-18.2-dfsg/lib/ssh/test/property_test/ssh_eqc_subsys.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/property_test/ssh_eqc_subsys.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_dsa erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_dsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_dsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_dsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBvAIBAAKBgQDfi2flSTZZofwT4yQT0NikX/LGNT7UPeB/XEWe/xovEYCElfaQ -APFixXvEgXwoojmZ5kiQRKzLM39wBP0jPERLbnZXfOOD0PDnw0haMh7dD7XKVMod -/EigVgHf/qBdM2M8yz1s/rRF7n1UpLSypziKjkzCm7JoSQ2zbWIPdmBIXwIVAMgP -kpr7Sq3O7sHdb8D601DRjoExAoGAMOQxDfB2Fd8ouz6G96f/UOzRMI/Kdv8kYYKW -JIGY+pRYrLPyYzUeJznwZreOJgrczAX+luHnKFWJ2Dnk5CyeXk67Wsr7pJ/4MBMD -OKeIS0S8qoSBN8+Krp79fgA+yS3IfqbkJLtLu4EBaCX4mKQIX4++k44d4U5lc8pt -+9hlEI8CgYEAznKxx9kyC6bVo7LUYKaGhofRFt0SYFc5PVmT2VUGRs1R6+6DPD+e -uEO6IhFct7JFSRbP9p0JD4Uk+3zlZF+XX6b2PsZkeV8f/02xlNGUSmEzCSiNg1AX -Cy/WusYhul0MncWCHMcOZB5rIvU/aP5EJJtn3xrRaz6u0SThF6AnT34CFQC63czE -ZU8w8Q+H7z0j+a+70x2iAw== ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIJfCaBKIIKhjbJl5F8BedqlXOQYDX5ba9Skypllmx/w+oAoGCCqGSM49 -AwEHoUQDQgAE49RbK2xQ/19ji3uDPM7uT4692LbwWF1TiaA9vUuebMGazoW/98br -N9xZu0L1AWwtEjs3kmJDTB7eJEGXnjUAcQ== ------END EC PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa256 erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa256 --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa256 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa256 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIJfCaBKIIKhjbJl5F8BedqlXOQYDX5ba9Skypllmx/w+oAoGCCqGSM49 -AwEHoUQDQgAE49RbK2xQ/19ji3uDPM7uT4692LbwWF1TiaA9vUuebMGazoW/98br -N9xZu0L1AWwtEjs3kmJDTB7eJEGXnjUAcQ== ------END EC PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa256.pub erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa256.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa256.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa256.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOPUWytsUP9fY4t7gzzO7k+Ovdi28FhdU4mgPb1LnmzBms6Fv/fG6zfcWbtC9QFsLRI7N5JiQ0we3iRBl541AHE= uabhnil@elxadlj3q32 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa.pub erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_ecdsa.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOPUWytsUP9fY4t7gzzO7k+Ovdi28FhdU4mgPb1LnmzBms6Fv/fG6zfcWbtC9QFsLRI7N5JiQ0we3iRBl541AHE= uabhnil@elxadlj3q32 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_rsa erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_rsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_rsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/id_rsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQD1OET+3O/Bvj/dtjxDTXmj1oiJt4sIph5kGy0RfjoPrZfaS+CU -DhakCmS6t2ivxWFgtpKWaoGMZMJqWj6F6ZsumyFl3FPBtujwY/35cgifrI9Ns4Tl -zR1uuengNBmV+WRQ5cd9F2qS6Z8aDQihzt0r8JUqLcK+VQbrmNzboCCQQwIDAQAB -AoGAPQEyqPTt8JUT7mRXuaacjFXiweAXhp9NEDpyi9eLOjtFe9lElZCrsUOkq47V -TGUeRKEm9qSodfTbKPoqc8YaBJGJPhUaTAcha+7QcDdfHBvIsgxvU7ePVnlpXRp3 -CCUEMPhlnx6xBoTYP+fRU0e3+xJIPVyVCqX1jAdUMkzfRoECQQD6ux7B1QJAIWyK -SGkbDUbBilNmzCFNgIpOP6PA+bwfi5d16diTpra5AX09keQABAo/KaP1PdV8Vg0p -z4P3A7G3AkEA+l+AKG6m0kQTTBMJDqOdVPYwe+5GxunMaqmhokpEbuGsrZBl5Dvd -WpcBjR7jmenrhKZRIuA+Fz5HPo/UQJPl1QJBAKxstDkeED8j/S2XoFhPKAJ+6t39 -sUVICVTIZQeXdmzHJXCcUSkw8+WEhakqw/3SyW0oaK2FSWQJFWJUZ+8eJj8CQEh3 -xeduB5kKnS9CvzdeghZqX6QvVosSdtlUmfUYW/BgH5PpHKTP8wTaeld3XldZTpMJ -dKiMkUw2+XYROVUrubUCQD+Na1LhULlpn4ISEtIEfqpdlUhxDgO15Wg8USmsng+x -ICliVOSQtwaZjm8kwaFt0W7XnpnDxbRs37vIEbIMWak= ------END RSA PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_dsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_dsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_dsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_dsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQCClaHzE2ul0gKSUxah5W0W8UiJLy4hXngKEqpaUq9SSdVdY2LK -wVfKH1gt5iuaf1FfzOhsIC9G/GLnjYttXZc92cv/Gfe3gR+s0ni2++MX+T++mE/Q -diltXv/Hp27PybS67SmiFW7I+RWnT2OKlMPtw2oUuKeztCe5UWjaj/y5FQIVAPLA -l9RpiU30Z87NRAHY3NTRaqtrAoGANMRxw8UfdtNVR0CrQj3AgPaXOGE4d+G4Gp4X -skvnCHycSVAjtYxebUkzUzt5Q6f/IabuLUdge3gXrc8BetvrcKbp+XZgM0/Vj2CF -Ymmy3in6kzGZq7Fw1sZaku6AOU8vLa5woBT2vAcHLLT1bLAzj7viL048T6MfjrOP -ef8nHvACgYBhDWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah -/XcF3DeRF+eEoz48wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+U -ykSTXYUbtsfTNRFQGBW2/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0CgIVAN4wtL5W -Lv62jKcdskxNyz2NQoBx ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_dsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_dsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_dsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_dsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1kc3MAAACBAIKVofMTa6XSApJTFqHlbRbxSIkvLiFeeAoSqlpSr1JJ1V1j -YsrBV8ofWC3mK5p/UV/M6GwgL0b8YueNi21dlz3Zy/8Z97eBH6zSeLb74xf5P76YT9B2 -KW1e/8enbs/JtLrtKaIVbsj5FadPY4qUw+3DahS4p7O0J7lRaNqP/LkVAAAAFQDywJfU -aYlN9GfOzUQB2NzU0WqrawAAAIA0xHHDxR9201VHQKtCPcCA9pc4YTh34bganheyS+cI -fJxJUCO1jF5tSTNTO3lDp/8hpu4tR2B7eBetzwF62+twpun5dmAzT9WPYIViabLeKfqT -MZmrsXDWxlqS7oA5Ty8trnCgFPa8BwcstPVssDOPu+IvTjxPox+Os495/yce8AAAAIBh -DWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah/XcF3DeRF+eEoz48 -wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+UykSTXYUbtsfTNRFQGBW2 -/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0Cg== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_ecdsa_key256 erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_ecdsa_key256 --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_ecdsa_key256 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_ecdsa_key256 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIMe4MDoit0t8RzSVPwkCBemQ9fhXL+xnTSAWISw8HNCioAoGCCqGSM49 -AwEHoUQDQgAEo2q7U3P6r0W5WGOLtM78UQtofM9UalEhiZeDdiyylsR/RR17Op0s -VPGSADLmzzgcucLEKy17j2S+oz42VUJy5A== ------END EC PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_ecdsa_key256.pub erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_ecdsa_key256.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_ecdsa_key256.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_ecdsa_key256.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKNqu1Nz+q9FuVhji7TO/FELaHzPVGpRIYmXg3YsspbEf0UdezqdLFTxkgAy5s84HLnCxCste49kvqM+NlVCcuQ= uabhnil@elxadlj3q32 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_rsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_rsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_rsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_rsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8semM4q843337 -zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RWRWzjaxSB -6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4QIDAQAB -AoGANmvJzJO5hkLuvyDZHKfAnGTtpifcR1wtSa9DjdKUyn8vhKF0mIimnbnYQEmW -NUUb3gXCZLi9PvkpRSVRrASDOZwcjoU/Kvww163vBUVb2cOZfFhyn6o2Sk88Tt++ -udH3hdjpf9i7jTtUkUe+QYPsia+wgvvrmn4QrahLAH86+kECQQDx5gFeXTME3cnW -WMpFz3PPumduzjqgqMMWEccX4FtQkMX/gyGa5UC7OHFyh0N/gSWvPbRHa8A6YgIt -n8DO+fh5AkEAzbqX4DOn8NY6xJIi42q7l/2jIA0RkB6P7YugW5NblhqBZ0XDnpA5 -sMt+rz+K07u9XZtxgh1xi7mNfwY6lEAMqQJBAJBEauCKmRj35Z6OyeQku59SPsnY -+SJEREVvSNw2lH9SOKQQ4wPsYlTGbvKtNVZgAcen91L5MmYfeckYE/fdIZECQQCt -64zxsTnM1I8iFxj/gP/OYlJBikrKt8udWmjaghzvLMEw+T2DExJyb9ZNeT53+UMB -m6O+B/4xzU/djvp+0hbhAkAemIt+rA5kTmYlFndhpvzkSSM8a2EXsO4XIPgGWCTT -tQKS/tTly0ADMjN/TVy11+9d6zcqadNVuHXHGtR4W0GR ------END RSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_rsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_rsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_rsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE_data/ssh_host_rsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1yc2EAAAADAQABAAAAgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8 -semM4q843337zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RW -RWzjaxSB6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4Q== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_algorithms_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_algorithms_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,376 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% - --module(ssh_algorithms_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("ssh/src/ssh_transport.hrl"). - -%% Note: This directive should only be used in test suites. --compile(export_all). - --define(TIMEOUT, 50000). - -%%-------------------------------------------------------------------- -%% Common Test interface functions ----------------------------------- -%%-------------------------------------------------------------------- - -suite() -> - [{ct_hooks,[ts_install_cth]}]. - -all() -> - %% [{group,kex},{group,cipher}... etc - [{group,C} || C <- tags()]. - - -groups() -> - ErlAlgos = extract_algos(ssh:default_algorithms()), - SshcAlgos = extract_algos(ssh_test_lib:default_algorithms(sshc)), - SshdAlgos = extract_algos(ssh_test_lib:default_algorithms(sshd)), - - DoubleAlgos = - [{Tag, double(Algs)} || {Tag,Algs} <- ErlAlgos, - length(Algs) > 1, - lists:member(Tag, two_way_tags())], - TagGroupSet = - [{Tag, [], group_members_for_tag(Tag,Algs,DoubleAlgos)} - || {Tag,Algs} <- ErlAlgos, - lists:member(Tag,tags()) - ], - - AlgoTcSet = - [{Alg, [parallel], specific_test_cases(Tag,Alg,SshcAlgos,SshdAlgos)} - || {Tag,Algs} <- ErlAlgos ++ DoubleAlgos, - Alg <- Algs], - - TagGroupSet ++ AlgoTcSet. - -tags() -> [kex,cipher,mac,compression]. -two_way_tags() -> [cipher,mac,compression]. - -%%-------------------------------------------------------------------- -init_per_suite(Config) -> - ct:log("os:getenv(\"HOME\") = ~p~n" - "init:get_argument(home) = ~p", - [os:getenv("HOME"), init:get_argument(home)]), - ct:log("~n~n" - "OS ssh:~n=======~n~p~n~n~n" - "Erl ssh:~n========~n~p~n~n~n" - "Installed ssh client:~n=====================~n~p~n~n~n" - "Installed ssh server:~n=====================~n~p~n~n~n" - "Misc values:~n============~n" - " -- Default dh group exchange parameters ({min,def,max}): ~p~n" - " -- dh_default_groups: ~p~n" - " -- Max num algorithms: ~p~n" - ,[os:cmd("ssh -V"), - ssh:default_algorithms(), - ssh_test_lib:default_algorithms(sshc), - ssh_test_lib:default_algorithms(sshd), - {?DEFAULT_DH_GROUP_MIN,?DEFAULT_DH_GROUP_NBITS,?DEFAULT_DH_GROUP_MAX}, - public_key:dh_gex_group_sizes(), - ?MAX_NUM_ALGORITHMS - ]), - ct:log("all() ->~n ~p.~n~ngroups()->~n ~p.~n",[all(),groups()]), - catch crypto:stop(), - case catch crypto:start() of - ok -> - ssh:start(), - [{std_simple_sftp_size,25000} % Sftp transferred data size - | setup_pubkey(Config)]; - _Else -> - {skip, "Crypto could not be started!"} - end. -end_per_suite(_Config) -> - ssh:stop(), - crypto:stop(). - - -init_per_group(Group, Config) -> - case lists:member(Group, tags()) of - true -> - %% A tag group - Tag = Group, - ct:comment("==== ~p ====",[Tag]), - Config; - false -> - %% An algorithm group - Tag = proplists:get_value(name, - hd(?config(tc_group_path, Config))), - Alg = Group, - PA = - case split(Alg) of - [_] -> - [Alg]; - [A1,A2] -> - [{client2server,[A1]}, - {server2client,[A2]}] - end, - ct:log("Init tests for tag=~p alg=~p",[Tag,PA]), - PrefAlgs = {preferred_algorithms,[{Tag,PA}]}, - start_std_daemon([PrefAlgs], - [{pref_algs,PrefAlgs} | Config]) - end. - -end_per_group(_Alg, Config) -> - case ?config(srvr_pid,Config) of - Pid when is_pid(Pid) -> - ssh:stop_daemon(Pid), - ct:log("stopped ~p",[?config(srvr_addr,Config)]); - _ -> - ok - end. - - - -init_per_testcase(sshc_simple_exec, Config) -> - start_pubkey_daemon([?config(pref_algs,Config)], Config); - -init_per_testcase(_TC, Config) -> - Config. - - -end_per_testcase(sshc_simple_exec, Config) -> - case ?config(srvr_pid,Config) of - Pid when is_pid(Pid) -> - ssh:stop_daemon(Pid), - ct:log("stopped ~p",[?config(srvr_addr,Config)]); - _ -> - ok - end; -end_per_testcase(_TC, Config) -> - Config. - - -%%-------------------------------------------------------------------- -%% Test Cases -------------------------------------------------------- -%%-------------------------------------------------------------------- -%% A simple sftp transfer -simple_sftp(Config) -> - {Host,Port} = ?config(srvr_addr, Config), - ssh_test_lib:std_simple_sftp(Host, Port, Config). - -%%-------------------------------------------------------------------- -%% A simple exec call -simple_exec(Config) -> - {Host,Port} = ?config(srvr_addr, Config), - ssh_test_lib:std_simple_exec(Host, Port, Config). - -%%-------------------------------------------------------------------- -%% Testing if no group matches -simple_exec_groups_no_match_too_small(Config) -> - try simple_exec_group({400,500,600}, Config) - of - _ -> ct:fail("Exec though no group available") - catch - error:{badmatch,{error,"No possible diffie-hellman-group-exchange group found"}} -> - ok - end. - -simple_exec_groups_no_match_too_large(Config) -> - try simple_exec_group({9200,9500,9700}, Config) - of - _ -> ct:fail("Exec though no group available") - catch - error:{badmatch,{error,"No possible diffie-hellman-group-exchange group found"}} -> - ok - end. - -%%-------------------------------------------------------------------- -%% Testing all default groups -simple_exec_groups(Config) -> - Sizes = interpolate( public_key:dh_gex_group_sizes() ), - lists:foreach( - fun(Sz) -> - ct:log("Try size ~p",[Sz]), - ct:comment(Sz), - case simple_exec_group(Sz, Config) of - expected -> ct:log("Size ~p ok",[Sz]); - _ -> ct:log("Size ~p not ok",[Sz]) - end - end, Sizes), - ct:comment("~p",[lists:map(fun({_,I,_}) -> I; - (I) -> I - end,Sizes)]). - - -interpolate([I1,I2|Is]) -> - OneThird = (I2-I1) div 3, - [I1, - {I1, I1 + OneThird, I2}, - {I1, I1 + 2*OneThird, I2} | interpolate([I2|Is])]; -interpolate(Is) -> - Is. - -%%-------------------------------------------------------------------- -%% Use the ssh client of the OS to connect -sshc_simple_exec(Config) -> - PrivDir = ?config(priv_dir, Config), - KnownHosts = filename:join(PrivDir, "known_hosts"), - {Host,Port} = ?config(srvr_addr, Config), - Cmd = lists:concat(["ssh -p ",Port, - " -C -o UserKnownHostsFile=",KnownHosts, - " ",Host," 1+1."]), - ct:log("~p",[Cmd]), - SshPort = open_port({spawn, Cmd}, [binary]), - receive - {SshPort,{data, <<"2\n">>}} -> - ok - after ?TIMEOUT -> - ct:fail("Did not receive answer") - end. - -%%-------------------------------------------------------------------- -%% Connect to the ssh server of the OS -sshd_simple_exec(_Config) -> - ConnectionRef = ssh_test_lib:connect(22, [{silently_accept_hosts, true}, - {user_interaction, false}]), - {ok, ChannelId0} = ssh_connection:session_channel(ConnectionRef, infinity), - success = ssh_connection:exec(ConnectionRef, ChannelId0, - "echo testing", infinity), - Data0 = {ssh_cm, ConnectionRef, {data, ChannelId0, 0, <<"testing\n">>}}, - case ssh_test_lib:receive_exec_result(Data0) of - expected -> - ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId0); - {unexpected_msg,{ssh_cm, ConnectionRef, {exit_status, ChannelId0, 0}} - = ExitStatus0} -> - ct:log("0: Collected data ~p", [ExitStatus0]), - ssh_test_lib:receive_exec_result(Data0, - ConnectionRef, ChannelId0); - Other0 -> - ct:fail(Other0) - end, - - {ok, ChannelId1} = ssh_connection:session_channel(ConnectionRef, infinity), - success = ssh_connection:exec(ConnectionRef, ChannelId1, - "echo testing1", infinity), - Data1 = {ssh_cm, ConnectionRef, {data, ChannelId1, 0, <<"testing1\n">>}}, - case ssh_test_lib:receive_exec_result(Data1) of - expected -> - ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId1); - {unexpected_msg,{ssh_cm, ConnectionRef, {exit_status, ChannelId1, 0}} - = ExitStatus1} -> - ct:log("0: Collected data ~p", [ExitStatus1]), - ssh_test_lib:receive_exec_result(Data1, - ConnectionRef, ChannelId1); - Other1 -> - ct:fail(Other1) - end. - -%%%================================================================ -%%% -%%% Lib functions -%%% - -%%%---------------------------------------------------------------- -%%% -%%% For construction of the result of all/0 and groups/0 -%%% -group_members_for_tag(Tag, Algos, DoubleAlgos) -> - [{group,Alg} || Alg <- Algos++proplists:get_value(Tag,DoubleAlgos,[])]. - -double(Algs) -> [concat(A1,A2) || A1 <- Algs, - A2 <- Algs, - A1 =/= A2]. - -concat(A1, A2) -> list_to_atom(lists:concat([A1," + ",A2])). - -split(Alg) -> ssh_test_lib:to_atoms(string:tokens(atom_to_list(Alg), " + ")). - -specific_test_cases(Tag, Alg, SshcAlgos, SshdAlgos) -> - [simple_exec, simple_sftp] ++ - case supports(Tag, Alg, SshcAlgos) of - true -> - case ssh_test_lib:ssh_type() of - openSSH -> - [sshc_simple_exec]; - _ -> - [] - end; - false -> - [] - end ++ - case supports(Tag, Alg, SshdAlgos) of - true -> - [sshd_simple_exec]; - _ -> - [] - end ++ - case {Tag,Alg} of - {kex,_} when Alg == 'diffie-hellman-group-exchange-sha1' ; - Alg == 'diffie-hellman-group-exchange-sha256' -> - [simple_exec_groups, - simple_exec_groups_no_match_too_large, - simple_exec_groups_no_match_too_small - ]; - _ -> - [] - end. - -supports(Tag, Alg, Algos) -> - lists:all(fun(A) -> - lists:member(A, proplists:get_value(Tag, Algos,[])) - end, - split(Alg)). - - -extract_algos(Spec) -> - [{Tag,get_atoms(List)} || {Tag,List} <- Spec]. - -get_atoms(L) -> - lists:usort( - [ A || X <- L, - A <- case X of - {_,L1} when is_list(L1) -> L1; - Y when is_atom(Y) -> [Y] - end]). - -%%%---------------------------------------------------------------- -%%% -%%% Test case related -%%% -start_std_daemon(Opts, Config) -> - {Pid, Host, Port} = ssh_test_lib:std_daemon(Config, Opts), - ct:log("started ~p:~p ~p",[Host,Port,Opts]), - [{srvr_pid,Pid},{srvr_addr,{Host,Port}} | Config]. - -start_pubkey_daemon(Opts, Config) -> - {Pid, Host, Port} = ssh_test_lib:std_daemon1(Config, Opts), - ct:log("started1 ~p:~p ~p",[Host,Port,Opts]), - [{srvr_pid,Pid},{srvr_addr,{Host,Port}} | Config]. - - -setup_pubkey(Config) -> - DataDir = ?config(data_dir, Config), - UserDir = ?config(priv_dir, Config), - ssh_test_lib:setup_dsa(DataDir, UserDir), - ssh_test_lib:setup_rsa(DataDir, UserDir), - ssh_test_lib:setup_ecdsa("256", DataDir, UserDir), - Config. - - -simple_exec_group(I, Config) when is_integer(I) -> - simple_exec_group({I,I,I}, Config); -simple_exec_group({Min,I,Max}, Config) -> - {Host,Port} = ?config(srvr_addr, Config), - ssh_test_lib:std_simple_exec(Host, Port, Config, - [{dh_gex_limits,{Min,I,Max}}]). - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256 erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256 --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIJfCaBKIIKhjbJl5F8BedqlXOQYDX5ba9Skypllmx/w+oAoGCCqGSM49 -AwEHoUQDQgAE49RbK2xQ/19ji3uDPM7uT4692LbwWF1TiaA9vUuebMGazoW/98br -N9xZu0L1AWwtEjs3kmJDTB7eJEGXnjUAcQ== ------END EC PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256.pub erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOPUWytsUP9fY4t7gzzO7k+Ovdi28FhdU4mgPb1LnmzBms6Fv/fG6zfcWbtC9QFsLRI7N5JiQ0we3iRBl541AHE= uabhnil@elxadlj3q32 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384 erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384 --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MIGkAgEBBDCYXb6OSAZyXRfLXOtMo43za197Hdc/T0YKjgQQjwDt6rlRwqTh7v7S -PV2kXwNGdWigBwYFK4EEACKhZANiAARN2khlJUOOIiwsWHEALwDieeZR96qL4pUd -ci7aeGaczdUK5jOA9D9zmBZtSYTfO8Cr7ekVghDlcWAIJ/BXcswgQwSEQ6wyfaTF -8FYfyr4l3u9IirsnyaFzeIgeoNis8Gw= ------END EC PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384.pub erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBE3aSGUlQ44iLCxYcQAvAOJ55lH3qovilR1yLtp4ZpzN1QrmM4D0P3OYFm1JhN87wKvt6RWCEOVxYAgn8FdyzCBDBIRDrDJ9pMXwVh/KviXe70iKuyfJoXN4iB6g2KzwbA== uabhnil@elxadlj3q32 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521 erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521 --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MIHbAgEBBEFMadoz4ckEcClfqXa2tiUuYkJdDfwq+/iFQcpt8ESuEd26IY/vm47Q -9UzbPkO4ou8xkNsQ3WvCRQBBWtn5O2kUU6AHBgUrgQQAI6GBiQOBhgAEAde5BRu5 -01/jS0jRk212xsb2DxPrxNpgp6IMCV8TA4Eps+8bSqHB091nLiBcP422HXYfuCd7 -XDjSs8ihcmhp0hCRASLqZR9EzW9W/SOt876May1Huj5X+WSO6RLe7vPn9vmf7kHf -pip6m7M7qp2qGgQ3q2vRwS2K/O6156ohiOlmuuFs ------END EC PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521.pub erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHXuQUbudNf40tI0ZNtdsbG9g8T68TaYKeiDAlfEwOBKbPvG0qhwdPdZy4gXD+Nth12H7gne1w40rPIoXJoadIQkQEi6mUfRM1vVv0jrfO+jGstR7o+V/lkjukS3u7z5/b5n+5B36YqepuzO6qdqhoEN6tr0cEtivzuteeqIYjpZrrhbA== uabhnil@elxadlj3q32 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256 erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256 --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIMe4MDoit0t8RzSVPwkCBemQ9fhXL+xnTSAWISw8HNCioAoGCCqGSM49 -AwEHoUQDQgAEo2q7U3P6r0W5WGOLtM78UQtofM9UalEhiZeDdiyylsR/RR17Op0s -VPGSADLmzzgcucLEKy17j2S+oz42VUJy5A== ------END EC PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256.pub erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKNqu1Nz+q9FuVhji7TO/FELaHzPVGpRIYmXg3YsspbEf0UdezqdLFTxkgAy5s84HLnCxCste49kvqM+NlVCcuQ= uabhnil@elxadlj3q32 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384 erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384 --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MIGkAgEBBDArxbDfh3p1okrD9wQw6jJ4d4DdlBPD5GqXE8bIeRJiK41Sh40LgvPw -mkqEDSXK++CgBwYFK4EEACKhZANiAAScl43Ih2lWTDKrSox5ve5uiTXil4smsup3 -CfS1XPjKxgBAmlfBim8izbdrT0BFdQzz2joduNMtpt61wO4rGs6jm0UP7Kim9PC7 -Hneb/99fIYopdMH5NMnk60zGO1uZ2vc= ------END EC PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384.pub erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBJyXjciHaVZMMqtKjHm97m6JNeKXiyay6ncJ9LVc+MrGAECaV8GKbyLNt2tPQEV1DPPaOh240y2m3rXA7isazqObRQ/sqKb08Lsed5v/318hiil0wfk0yeTrTMY7W5na9w== uabhnil@elxadlj3q32 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521 erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521 --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MIHcAgEBBEIB8O1BFkl2HQjQLRLonEZ97da/h39DMa9/0/hvPZWAI8gUPEQcHxRx -U7b09p3Zh+EBbMFq8+1ae9ds+ZTxE4WFSvKgBwYFK4EEACOhgYkDgYYABAAlWVjq -Bzg7Wt4gE6UNb1lRE2cnlmH2L/A5uo6qZRx5lPnSKOxEhxSb/Oay1+9d6KRdrh6/ -vlhd9SHDBhLcAPDvWgBnJIEj92Q3pXX4JtoitL0yl+SvvU+vUh966mzHShHzj8p5 -ccOgPkPNoA70yrpGzkIhPezpZOQdCaOXj/jFqNCTDg== ------END EC PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521.pub erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAAlWVjqBzg7Wt4gE6UNb1lRE2cnlmH2L/A5uo6qZRx5lPnSKOxEhxSb/Oay1+9d6KRdrh6/vlhd9SHDBhLcAPDvWgBnJIEj92Q3pXX4JtoitL0yl+SvvU+vUh966mzHShHzj8p5ccOgPkPNoA70yrpGzkIhPezpZOQdCaOXj/jFqNCTDg== uabhnil@elxadlj3q32 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_basic_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_basic_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,52 +23,9 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("kernel/include/inet.hrl"). --include_lib("kernel/include/file.hrl"). %% Note: This directive should only be used in test suites. -%%-compile(export_all). - -%%% Test cases --export([ - app_test/1, - appup_test/1, - cli/1, - close/1, - daemon_already_started/1, - daemon_opt_fd/1, - multi_daemon_opt_fd/1, - double_close/1, - exec/1, - exec_compressed/1, - exec_key_differs1/1, - exec_key_differs2/1, - exec_key_differs3/1, - exec_key_differs_fail/1, - idle_time/1, - inet6_option/1, - inet_option/1, - internal_error/1, - known_hosts/1, - misc_ssh_options/1, - openssh_zlib_basic_test/1, - packet_size_zero/1, - pass_phrase/1, - peername_sockname/1, - send/1, - shell/1, - shell_no_unicode/1, - shell_unicode_string/1, - ssh_info_print/1, - key_callback/1, - key_callback_options/1 - ]). - -%%% Common test callbacks --export([suite/0, all/0, groups/0, - init_per_suite/1, end_per_suite/1, - init_per_group/2, end_per_group/2, - init_per_testcase/2, end_per_testcase/2 - ]). +-compile(export_all). -define(NEWLINE, <<"\r\n">>). @@ -85,51 +41,45 @@ appup_test, {group, dsa_key}, {group, rsa_key}, - {group, ecdsa_sha2_nistp256_key}, - {group, ecdsa_sha2_nistp384_key}, - {group, ecdsa_sha2_nistp521_key}, {group, dsa_pass_key}, {group, rsa_pass_key}, - {group, host_user_key_differs}, - {group, key_cb}, {group, internal_error}, daemon_already_started, + server_password_option, + server_userpassword_option, double_close, - daemon_opt_fd, - multi_daemon_opt_fd, - packet_size_zero, - ssh_info_print + ssh_connect_timeout, + ssh_connect_arg4_timeout, + {group, hardening_tests} ]. groups() -> [{dsa_key, [], basic_tests()}, {rsa_key, [], basic_tests()}, - {ecdsa_sha2_nistp256_key, [], basic_tests()}, - {ecdsa_sha2_nistp384_key, [], basic_tests()}, - {ecdsa_sha2_nistp521_key, [], basic_tests()}, - {host_user_key_differs, [], [exec_key_differs1, - exec_key_differs2, - exec_key_differs3, - exec_key_differs_fail]}, {dsa_pass_key, [], [pass_phrase]}, {rsa_pass_key, [], [pass_phrase]}, - {key_cb, [], [key_callback, key_callback_options]}, - {internal_error, [], [internal_error]} + {internal_error, [], [internal_error]}, + {hardening_tests, [], [ssh_connect_nonegtimeout_connected_parallel, + ssh_connect_nonegtimeout_connected_sequential, + ssh_connect_negtimeout_parallel, + ssh_connect_negtimeout_sequential, + max_sessions_ssh_connect_parallel, + max_sessions_ssh_connect_sequential, + max_sessions_sftp_start_channel_parallel, + max_sessions_sftp_start_channel_sequential + ]} ]. basic_tests() -> [send, close, peername_sockname, - exec, exec_compressed, - shell, shell_no_unicode, shell_unicode_string, - cli, known_hosts, - idle_time, openssh_zlib_basic_test, - misc_ssh_options, inet_option, inet6_option]. + exec, exec_compressed, shell, cli, known_hosts, + idle_time, rekey, openssh_zlib_basic_test, + misc_ssh_options, inet_option]. %%-------------------------------------------------------------------- init_per_suite(Config) -> - catch crypto:stop(), case catch crypto:start() of ok -> Config; @@ -140,6 +90,8 @@ ssh:stop(), crypto:stop(). %%-------------------------------------------------------------------- +init_per_group(hardening_tests, Config) -> + init_per_group(dsa_key, Config); init_per_group(dsa_key, Config) -> DataDir = ?config(data_dir, Config), PrivDir = ?config(priv_dir, Config), @@ -150,39 +102,6 @@ PrivDir = ?config(priv_dir, Config), ssh_test_lib:setup_rsa(DataDir, PrivDir), Config; -init_per_group(ecdsa_sha2_nistp256_key, Config) -> - case lists:member('ecdsa-sha2-nistp256', - ssh_transport:default_algorithms(public_key)) of - true -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - ssh_test_lib:setup_ecdsa("256", DataDir, PrivDir), - Config; - false -> - {skip, unsupported_pub_key} - end; -init_per_group(ecdsa_sha2_nistp384_key, Config) -> - case lists:member('ecdsa-sha2-nistp384', - ssh_transport:default_algorithms(public_key)) of - true -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - ssh_test_lib:setup_ecdsa("384", DataDir, PrivDir), - Config; - false -> - {skip, unsupported_pub_key} - end; -init_per_group(ecdsa_sha2_nistp521_key, Config) -> - case lists:member('ecdsa-sha2-nistp521', - ssh_transport:default_algorithms(public_key)) of - true -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - ssh_test_lib:setup_ecdsa("521", DataDir, PrivDir), - Config; - false -> - {skip, unsupported_pub_key} - end; init_per_group(rsa_pass_key, Config) -> DataDir = ?config(data_dir, Config), PrivDir = ?config(priv_dir, Config), @@ -193,77 +112,17 @@ PrivDir = ?config(priv_dir, Config), ssh_test_lib:setup_dsa_pass_pharse(DataDir, PrivDir, "Password"), [{pass_phrase, {dsa_pass_phrase, "Password"}}| Config]; -init_per_group(host_user_key_differs, Config) -> - Data = ?config(data_dir, Config), - Sys = filename:join(?config(priv_dir, Config), system_rsa), - SysUsr = filename:join(Sys, user), - Usr = filename:join(?config(priv_dir, Config), user_ecdsa_256), - file:make_dir(Sys), - file:make_dir(SysUsr), - file:make_dir(Usr), - file:copy(filename:join(Data, "ssh_host_rsa_key"), filename:join(Sys, "ssh_host_rsa_key")), - file:copy(filename:join(Data, "ssh_host_rsa_key.pub"), filename:join(Sys, "ssh_host_rsa_key.pub")), - file:copy(filename:join(Data, "id_ecdsa256"), filename:join(Usr, "id_ecdsa")), - file:copy(filename:join(Data, "id_ecdsa256.pub"), filename:join(Usr, "id_ecdsa.pub")), - ssh_test_lib:setup_ecdsa_auth_keys("256", Usr, SysUsr), - ssh_test_lib:setup_rsa_known_host(Sys, Usr), - Config; -init_per_group(key_cb, Config) -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - ssh_test_lib:setup_dsa(DataDir, PrivDir), - Config; init_per_group(internal_error, Config) -> DataDir = ?config(data_dir, Config), PrivDir = ?config(priv_dir, Config), ssh_test_lib:setup_dsa(DataDir, PrivDir), file:delete(filename:join(PrivDir, "system/ssh_host_dsa_key")), Config; -init_per_group(dir_options, Config) -> - PrivDir = ?config(priv_dir, Config), - %% Make unreadable dir: - Dir_unreadable = filename:join(PrivDir, "unread"), - ok = file:make_dir(Dir_unreadable), - {ok,F1} = file:read_file_info(Dir_unreadable), - ok = file:write_file_info(Dir_unreadable, - F1#file_info{mode = F1#file_info.mode band (bnot 8#00444)}), - %% Make readable file: - File_readable = filename:join(PrivDir, "file"), - ok = file:write_file(File_readable, <<>>), - - %% Check: - case {file:read_file_info(Dir_unreadable), - file:read_file_info(File_readable)} of - {{ok, Id=#file_info{type=directory, access=Md}}, - {ok, If=#file_info{type=regular, access=Mf}}} -> - AccessOK = - case {Md, Mf} of - {read, _} -> false; - {read_write, _} -> false; - {_, read} -> true; - {_, read_write} -> true; - _ -> false - end, - - case AccessOK of - true -> - %% Save: - [{unreadable_dir, Dir_unreadable}, - {readable_file, File_readable} - | Config]; - false -> - ct:log("File#file_info : ~p~n" - "Dir#file_info : ~p",[If,Id]), - {skip, "File or dir mode settings failed"} - end; - - NotDirFile -> - ct:log("{Dir,File} -> ~p",[NotDirFile]), - {skip, "File/Dir creation failed"} - end; init_per_group(_, Config) -> Config. +end_per_group(hardening_tests, Config) -> + end_per_group(dsa_key, Config); end_per_group(dsa_key, Config) -> PrivDir = ?config(priv_dir, Config), ssh_test_lib:clean_dsa(PrivDir), @@ -280,10 +139,6 @@ PrivDir = ?config(priv_dir, Config), ssh_test_lib:clean_rsa(PrivDir), Config; -end_per_group(key_cb, Config) -> - PrivDir = ?config(priv_dir, Config), - ssh_test_lib:clean_dsa(PrivDir), - Config; end_per_group(internal_error, Config) -> PrivDir = ?config(priv_dir, Config), ssh_test_lib:clean_dsa(PrivDir), @@ -292,33 +147,6 @@ end_per_group(_, Config) -> Config. %%-------------------------------------------------------------------- -init_per_testcase(TC, Config) when TC==shell_no_unicode ; - TC==shell_unicode_string -> - PrivDir = ?config(priv_dir, Config), - UserDir = ?config(priv_dir, Config), - SysDir = ?config(data_dir, Config), - ssh:start(), - Sftpd = {_Pid, _Host, Port} = - ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, PrivDir}, - {user_passwords, [{"foo", "bar"}]}]), - ct:sleep(500), - IO = ssh_test_lib:start_io_server(), - Shell = ssh_test_lib:start_shell(Port, IO, UserDir, - [{silently_accept_hosts, true}, - {user,"foo"},{password,"bar"}]), - ct:log("IO=~p, Shell=~p, self()=~p",[IO,Shell,self()]), - ct:log("file:native_name_encoding() = ~p,~nio:getopts() = ~p", - [file:native_name_encoding(),io:getopts()]), - wait_for_erlang_first_line([{io,IO}, {shell,Shell}, {sftpd, Sftpd} | Config]); - -init_per_testcase(inet6_option, Config) -> - case ssh_test_lib:has_inet6_address() of - true -> - init_per_testcase('__default__', Config); - false -> - {skip,"No ipv6 interface address"} - end; init_per_testcase(_TestCase, Config) -> ssh:start(), Config. @@ -328,15 +156,6 @@ UserDir = filename:join(?config(priv_dir, Config), nopubkey), ssh_test_lib:del_dirs(UserDir), end_per_testcase(Config); -end_per_testcase(TC, Config) when TC==shell_no_unicode ; - TC==shell_unicode_string -> - case ?config(sftpd, Config) of - {Pid, _, _} -> - ssh:stop_daemon(Pid), - ssh:stop(); - _ -> - ssh:stop() - end; end_per_testcase(_TestCase, Config) -> end_per_testcase(Config). end_per_testcase(_Config) -> @@ -346,18 +165,21 @@ %%-------------------------------------------------------------------- %% Test Cases -------------------------------------------------------- %%-------------------------------------------------------------------- -%%% Application consistency test. +app_test() -> + [{doc, "App lication consistency test."}]. app_test(Config) when is_list(Config) -> ?t:app_test(ssh), ok. %%-------------------------------------------------------------------- -%%% Appup file consistency test. +appup_test() -> + [{doc, "Appup file consistency test."}]. appup_test(Config) when is_list(Config) -> ok = ?t:appup_test(ssh). %%-------------------------------------------------------------------- -%%% Test that we can set some misc options not tested elsewhere -%%% some options not yet present are not decided if we should support or -%%% if they need thier own test case. +misc_ssh_options() -> + [{doc, "Test that we can set some misc options not tested elsewhere, " + "some options not yet present are not decided if we should support or " + "if they need thier own test case."}]. misc_ssh_options(Config) when is_list(Config) -> SystemDir = filename:join(?config(priv_dir, Config), system), UserDir = ?config(priv_dir, Config), @@ -371,7 +193,8 @@ basic_test([{client_opts, CMiscOpt1}, {server_opts, SMiscOpt1}]). %%-------------------------------------------------------------------- -%%% Test configuring IPv4 +inet_option() -> + [{doc, "Test configuring IPv4"}]. inet_option(Config) when is_list(Config) -> SystemDir = filename:join(?config(priv_dir, Config), system), UserDir = ?config(priv_dir, Config), @@ -387,7 +210,8 @@ {server_opts, [{inet, inet} | ServerOpts]}]). %%-------------------------------------------------------------------- -%%% Test configuring IPv6 +inet6_option() -> + [{doc, "Test configuring IPv6"}]. inet6_option(Config) when is_list(Config) -> SystemDir = filename:join(?config(priv_dir, Config), system), UserDir = ?config(priv_dir, Config), @@ -403,7 +227,8 @@ {server_opts, [{inet, inet6} | ServerOpts]}]). %%-------------------------------------------------------------------- -%%% Test api function ssh_connection:exec +exec() -> + [{doc, "Test api function ssh_connection:exec"}]. exec(Config) when is_list(Config) -> process_flag(trap_exit, true), SystemDir = filename:join(?config(priv_dir, Config), system), @@ -444,41 +269,37 @@ ssh:stop_daemon(Pid). %%-------------------------------------------------------------------- -%%% Test that compression option works +exec_compressed() -> + [{doc, "Test that compression option works"}]. exec_compressed(Config) when is_list(Config) -> - case ssh_test_lib:ssh_supports(zlib, compression) of - false -> - {skip, "zlib compression is not supported"}; - - true -> - process_flag(trap_exit, true), - SystemDir = filename:join(?config(priv_dir, Config), system), - UserDir = ?config(priv_dir, Config), - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},{user_dir, UserDir}, - {preferred_algorithms,[{compression, [zlib]}]}, - {failfun, fun ssh_test_lib:failfun/2}]), - - ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user_dir, UserDir}, - {user_interaction, false}]), - {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), - success = ssh_connection:exec(ConnectionRef, ChannelId, - "1+1.", infinity), - Data = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"2\n">>}}, - case ssh_test_lib:receive_exec_result(Data) of - expected -> - ok; - Other -> - ct:fail(Other) - end, - ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId), - ssh:stop_daemon(Pid) - end. + process_flag(trap_exit, true), + SystemDir = filename:join(?config(priv_dir, Config), system), + UserDir = ?config(priv_dir, Config), + + {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},{user_dir, UserDir}, + {compression, zlib}, + {failfun, fun ssh_test_lib:failfun/2}]), + + ConnectionRef = + ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, + {user_dir, UserDir}, + {user_interaction, false}]), + {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), + success = ssh_connection:exec(ConnectionRef, ChannelId, + "1+1.", infinity), + Data = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"2\n">>}}, + case ssh_test_lib:receive_exec_result(Data) of + expected -> + ok; + Other -> + ct:fail(Other) + end, + ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId), + ssh:stop_daemon(Pid). %%-------------------------------------------------------------------- -%%% Idle timeout test +idle_time() -> + [{doc, "Idle timeout test"}]. idle_time(Config) -> SystemDir = filename:join(?config(priv_dir, Config), system), UserDir = ?config(priv_dir, Config), @@ -498,9 +319,31 @@ {error, closed} = ssh_connection:session_channel(ConnectionRef, 1000) end, ssh:stop_daemon(Pid). +%%-------------------------------------------------------------------- +rekey() -> + [{doc, "Idle timeout test"}]. +rekey(Config) -> + SystemDir = filename:join(?config(priv_dir, Config), system), + UserDir = ?config(priv_dir, Config), + {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, + {user_dir, UserDir}, + {failfun, fun ssh_test_lib:failfun/2}, + {rekey_limit, 0}]), + ConnectionRef = + ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, + {user_dir, UserDir}, + {user_interaction, false}, + {rekey_limit, 0}]), + receive + after 200000 -> + %%By this time rekeying would have been done + ssh:close(ConnectionRef), + ssh:stop_daemon(Pid) + end. %%-------------------------------------------------------------------- -%%% Test that ssh:shell/2 works +shell() -> + [{doc, "Test that ssh:shell/2 works"}]. shell(Config) when is_list(Config) -> process_flag(trap_exit, true), SystemDir = filename:join(?config(priv_dir, Config), system), @@ -516,87 +359,13 @@ {'EXIT', _, _} -> ct:fail(no_ssh_connection); ErlShellStart -> - ct:log("Erlang shell start: ~p~n", [ErlShellStart]), + ct:pal("Erlang shell start: ~p~n", [ErlShellStart]), do_shell(IO, Shell) - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. - -%%-------------------------------------------------------------------- -%%% Test that we could user different types of host pubkey and user pubkey -exec_key_differs1(Config) -> exec_key_differs(Config, ['ecdsa-sha2-nistp256']). - -exec_key_differs2(Config) -> exec_key_differs(Config, ['ssh-dss','ecdsa-sha2-nistp256']). - -exec_key_differs3(Config) -> exec_key_differs(Config, ['ecdsa-sha2-nistp384','ecdsa-sha2-nistp256']). - - - -exec_key_differs(Config, UserPKAlgs) -> - case lists:usort(['ssh-rsa'|UserPKAlgs]) - -- ssh_transport:supported_algorithms(public_key) - of - [] -> - process_flag(trap_exit, true), - SystemDir = filename:join(?config(priv_dir, Config), system_rsa), - SystemUserDir = filename:join(SystemDir, user), - UserDir = filename:join(?config(priv_dir, Config), user_ecdsa_256), - - {_Pid, _Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, - {user_dir, SystemUserDir}, - {preferred_algorithms, - [{public_key,['ssh-rsa']}]}]), - ct:sleep(500), - - IO = ssh_test_lib:start_io_server(), - Shell = ssh_test_lib:start_shell(Port, IO, UserDir, - [{preferred_algorithms,[{public_key,['ssh-rsa']}]}, - {pref_public_key_algs,UserPKAlgs} - ]), - - - receive - {'EXIT', _, _} -> - ct:fail(no_ssh_connection); - ErlShellStart -> - ct:log("Erlang shell start: ~p~n", [ErlShellStart]), - do_shell(IO, Shell) - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end; - - UnsupportedPubKeys -> - {skip, io_lib:format("~p unsupported",[UnsupportedPubKeys])} - end. - -%%-------------------------------------------------------------------- -exec_key_differs_fail(Config) when is_list(Config) -> - process_flag(trap_exit, true), - SystemDir = filename:join(?config(priv_dir, Config), system_rsa), - SystemUserDir = filename:join(SystemDir, user), - UserDir = filename:join(?config(priv_dir, Config), user_ecdsa_256), - - {_Pid, _Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, - {user_dir, SystemUserDir}, - {preferred_algorithms, - [{public_key,['ssh-rsa']}]}]), - ct:sleep(500), - - IO = ssh_test_lib:start_io_server(), - ssh_test_lib:start_shell(Port, IO, UserDir, - [{preferred_algorithms,[{public_key,['ssh-rsa']}]}, - {pref_public_key_algs,['ssh-dss']}]), - receive - {'EXIT', _, _} -> - ok; - ErlShellStart -> - ct:log("Erlang shell start: ~p~n", [ErlShellStart]), - ct:fail(connection_not_rejected) - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end. %%-------------------------------------------------------------------- +cli() -> + [{doc, ""}]. cli(Config) when is_list(Config) -> process_flag(trap_exit, true), SystemDir = filename:join(?config(priv_dir, Config), system), @@ -622,20 +391,17 @@ {ssh_cm, ConnectionRef, {data,0,0, <<"\r\nYou are accessing a dummy, type \"q\" to exit\r\n\n">>}} -> ok = ssh_connection:send(ConnectionRef, ChannelId, <<"q">>) - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, receive {ssh_cm, ConnectionRef,{closed, ChannelId}} -> ok - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end. %%-------------------------------------------------------------------- -%%% Test that get correct error message if you try to start a daemon -%%% on an adress that already runs a daemon see also seq10667 +daemon_already_started() -> + [{doc, "Test that get correct error message if you try to start a daemon", + "on an adress that already runs a daemon see also seq10667"}]. daemon_already_started(Config) when is_list(Config) -> SystemDir = ?config(data_dir, Config), UserDir = ?config(priv_dir, Config), @@ -650,7 +416,78 @@ ssh:stop_daemon(Pid). %%-------------------------------------------------------------------- -%%% check that known_hosts is updated correctly +server_password_option() -> + [{doc, "validate to server that uses the 'password' option"}]. +server_password_option(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth + file:make_dir(UserDir), + SysDir = ?config(data_dir, Config), + {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, + {user_dir, UserDir}, + {password, "morot"}]), + + ConnectionRef = + ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, + {user, "foo"}, + {password, "morot"}, + {user_interaction, false}, + {user_dir, UserDir}]), + + Reason = "Unable to connect using the available authentication methods", + + {error, Reason} = + ssh:connect(Host, Port, [{silently_accept_hosts, true}, + {user, "vego"}, + {password, "foo"}, + {user_interaction, false}, + {user_dir, UserDir}]), + + ct:pal("Test of wrong password: Error msg: ~p ~n", [Reason]), + + ssh:close(ConnectionRef), + ssh:stop_daemon(Pid). + +%%-------------------------------------------------------------------- + +server_userpassword_option() -> + [{doc, "validate to server that uses the 'password' option"}]. +server_userpassword_option(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth + file:make_dir(UserDir), + SysDir = ?config(data_dir, Config), + {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, + {user_dir, PrivDir}, + {user_passwords, [{"vego", "morot"}]}]), + + ConnectionRef = + ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, + {user, "vego"}, + {password, "morot"}, + {user_interaction, false}, + {user_dir, UserDir}]), + ssh:close(ConnectionRef), + + Reason = "Unable to connect using the available authentication methods", + + {error, Reason} = + ssh:connect(Host, Port, [{silently_accept_hosts, true}, + {user, "foo"}, + {password, "morot"}, + {user_interaction, false}, + {user_dir, UserDir}]), + {error, Reason} = + ssh:connect(Host, Port, [{silently_accept_hosts, true}, + {user, "vego"}, + {password, "foo"}, + {user_interaction, false}, + {user_dir, UserDir}]), + ssh:stop_daemon(Pid). + +%%-------------------------------------------------------------------- +known_hosts() -> + [{doc, "check that known_hosts is updated correctly"}]. known_hosts(Config) when is_list(Config) -> SystemDir = ?config(data_dir, Config), PrivDir = ?config(priv_dir, Config), @@ -676,7 +513,8 @@ ssh:stop_daemon(Pid). %%-------------------------------------------------------------------- -%%% Test that we can use keyes protected by pass phrases +pass_phrase() -> + [{doc, "Test that we can use keyes protected by pass phrases"}]. pass_phrase(Config) when is_list(Config) -> process_flag(trap_exit, true), SystemDir = filename:join(?config(priv_dir, Config), system), @@ -695,75 +533,27 @@ ssh:stop_daemon(Pid). %%-------------------------------------------------------------------- -%%% Test that we can use key callback -key_callback(Config) when is_list(Config) -> - process_flag(trap_exit, true), - SystemDir = filename:join(?config(priv_dir, Config), system), - UserDir = ?config(priv_dir, Config), - NoPubKeyDir = filename:join(UserDir, "nopubkey"), - file:make_dir(NoPubKeyDir), - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, - {user_dir, UserDir}, - {failfun, fun ssh_test_lib:failfun/2}]), - - ConnectOpts = [{silently_accept_hosts, true}, - {user_dir, NoPubKeyDir}, - {user_interaction, false}, - {key_cb, ssh_key_cb}], - - ConnectionRef = ssh_test_lib:connect(Host, Port, ConnectOpts), - - {ok, _ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), - ssh:stop_daemon(Pid). - - -%%-------------------------------------------------------------------- -%%% Test that we can use key callback with callback options -key_callback_options(Config) when is_list(Config) -> - process_flag(trap_exit, true), - SystemDir = filename:join(?config(priv_dir, Config), system), - UserDir = ?config(priv_dir, Config), - - NoPubKeyDir = filename:join(UserDir, "nopubkey"), - file:make_dir(NoPubKeyDir), - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, - {user_dir, UserDir}, - {failfun, fun ssh_test_lib:failfun/2}]), - {ok, PrivKey} = file:read_file(filename:join(UserDir, "id_dsa")), - - ConnectOpts = [{silently_accept_hosts, true}, - {user_dir, NoPubKeyDir}, - {user_interaction, false}, - {key_cb, {ssh_key_cb_options, [{priv_key, PrivKey}]}}], - - ConnectionRef = ssh_test_lib:connect(Host, Port, ConnectOpts), - - {ok, _ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), - ssh:stop_daemon(Pid). - - -%%-------------------------------------------------------------------- -%%% Test that client does not hang if disconnects due to internal error +internal_error() -> + [{doc,"Test that client does not hang if disconnects due to internal error"}]. internal_error(Config) when is_list(Config) -> process_flag(trap_exit, true), SystemDir = filename:join(?config(priv_dir, Config), system), UserDir = ?config(priv_dir, Config), {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, - {user_dir, UserDir}, - {failfun, fun ssh_test_lib:failfun/2}]), + {user_dir, UserDir}, + {failfun, fun ssh_test_lib:failfun/2}]), {error, Error} = - ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user_dir, UserDir}, - {user_interaction, false}]), + ssh:connect(Host, Port, [{silently_accept_hosts, true}, + {user_dir, UserDir}, + {user_interaction, false}]), check_error(Error), ssh:stop_daemon(Pid). %%-------------------------------------------------------------------- -%%% Test ssh_connection:send/3 +send() -> + [{doc, "Test ssh_connection:send/3"}]. send(Config) when is_list(Config) -> process_flag(trap_exit, true), SystemDir = filename:join(?config(priv_dir, Config), system), @@ -783,7 +573,8 @@ %%-------------------------------------------------------------------- -%%% Test ssh:connection_info([peername, sockname]) +peername_sockname() -> + [{doc, "Test ssh:connection_info([peername, sockname])"}]. peername_sockname(Config) when is_list(Config) -> process_flag(trap_exit, true), SystemDir = filename:join(?config(priv_dir, Config), system), @@ -805,13 +596,13 @@ ssh:connection_info(ConnectionRef, [peer]), [{sockname, {HostSockClient,PortSockClient} = ClientSock}] = ssh:connection_info(ConnectionRef, [sockname]), - ct:log("Client: ~p ~p", [ClientPeer, ClientSock]), + ct:pal("Client: ~p ~p", [ClientPeer, ClientSock]), receive {ssh_cm, ConnectionRef, {data, ChannelId, _, Response}} -> {PeerNameSrv,SockNameSrv} = binary_to_term(Response), {HostPeerSrv,PortPeerSrv} = PeerNameSrv, {HostSockSrv,PortSockSrv} = SockNameSrv, - ct:log("Server: ~p ~p", [PeerNameSrv, SockNameSrv]), + ct:pal("Server: ~p ~p", [PeerNameSrv, SockNameSrv]), host_equal(HostPeerSrv, HostSockClient), PortPeerSrv = PortSockClient, host_equal(HostSockSrv, HostPeerClient), @@ -819,7 +610,7 @@ host_equal(HostSockSrv, Host), PortSockSrv = Port after 10000 -> - ct:fail("timeout ~p:~p",[?MODULE,?LINE]) + throw(timeout) end. host_equal(H1, H2) -> @@ -833,7 +624,8 @@ %%-------------------------------------------------------------------- -%%% Client receives close when server closes +close() -> + [{doc, "Client receives close when server closes"}]. close(Config) when is_list(Config) -> process_flag(trap_exit, true), SystemDir = filename:join(?config(priv_dir, Config), system), @@ -853,11 +645,12 @@ {ssh_cm, Client,{closed, ChannelId}} -> ok after 5000 -> - ct:fail("timeout ~p:~p",[?MODULE,?LINE]) + ct:fail(timeout) end. %%-------------------------------------------------------------------- -%%% Simulate that we try to close an already closed connection +double_close() -> + [{doc, "Simulate that we try to close an already closed connection"}]. double_close(Config) when is_list(Config) -> SystemDir = ?config(data_dir, Config), PrivDir = ?config(priv_dir, Config), @@ -878,220 +671,296 @@ ok = ssh:close(CM). %%-------------------------------------------------------------------- -daemon_opt_fd(Config) -> - SystemDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - - {ok,S1} = gen_tcp:listen(0,[]), - {ok,Fd1} = prim_inet:getfd(S1), - - {ok,Pid1} = ssh:daemon(0, [{system_dir, SystemDir}, - {fd,Fd1}, - {user_dir, UserDir}, - {user_passwords, [{"vego", "morot"}]}, - {failfun, fun ssh_test_lib:failfun/2}]), +ssh_connect_timeout() -> + [{doc, "Test connect_timeout option in ssh:connect/4"}]. +ssh_connect_timeout(_Config) -> + ConnTimeout = 2000, + {error,{faked_transport,connect,TimeoutToTransport}} = + ssh:connect("localhost", 12345, + [{transport,{tcp,?MODULE,tcp_closed}}, + {connect_timeout,ConnTimeout}], + 1000), + case TimeoutToTransport of + ConnTimeout -> ok; + Other -> + ct:log("connect_timeout is ~p but transport received ~p",[ConnTimeout,Other]), + {fail,"ssh:connect/4 wrong connect_timeout received in transport"} + end. - {ok,{_Host1,Port1}} = inet:sockname(S1), - {ok, C1} = ssh:connect("localhost", Port1, [{silently_accept_hosts, true}, - {user_dir, UserDir}, - {user, "vego"}, - {password, "morot"}, - {user_interaction, false}]), - exit(C1, {shutdown, normal}), - ssh:stop_daemon(Pid1), - gen_tcp:close(S1). +%% Help for the test above +connect(_Host, _Port, _Opts, Timeout) -> + {error, {faked_transport,connect,Timeout}}. %%-------------------------------------------------------------------- -multi_daemon_opt_fd(Config) -> - SystemDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), +ssh_connect_arg4_timeout() -> + [{doc, "Test fourth argument in ssh:connect/4"}]. +ssh_connect_arg4_timeout(_Config) -> + Timeout = 1000, + Parent = self(), + %% start the server + Server = spawn(fun() -> + {ok,Sl} = gen_tcp:listen(0,[]), + {ok,{_,Port}} = inet:sockname(Sl), + Parent ! {port,self(),Port}, + Rsa = gen_tcp:accept(Sl), + ct:log("Server gen_tcp:accept got ~p",[Rsa]), + receive after 2*Timeout -> ok end %% let client timeout first + end), + + %% Get listening port + Port = receive + {port,Server,ServerPort} -> ServerPort + end, + + %% try to connect with a timeout, but "supervise" it + Client = spawn(fun() -> + T0 = now(), + Rc = ssh:connect("localhost",Port,[],Timeout), + ct:log("Client ssh:connect got ~p",[Rc]), + Parent ! {done,self(),Rc,T0} + end), - Test = - fun() -> - {ok,S} = gen_tcp:listen(0,[]), - {ok,Fd} = prim_inet:getfd(S), + %% Wait for client reaction on the connection try: + receive + {done, Client, {error,_E}, T0} -> + Msp = ms_passed(T0, now()), + exit(Server,hasta_la_vista___baby), + Low = 0.9*Timeout, + High = 1.1*Timeout, + ct:log("Timeout limits: ~p--~p, timeout was ~p, expected ~p",[Low,High,Msp,Timeout]), + if + Low ok; + true -> {fail, "timeout not within limits"} + end; + {done, Client, {ok,_Ref}, _T0} -> + {fail,"ssh-connected ???"} + after + 5000 -> + exit(Server,hasta_la_vista___baby), + exit(Client,hasta_la_vista___baby), + {fail, "Didn't timeout"} + end. - {ok,Pid} = ssh:daemon(0, [{system_dir, SystemDir}, - {fd,Fd}, - {user_dir, UserDir}, - {user_passwords, [{"vego", "morot"}]}, - {failfun, fun ssh_test_lib:failfun/2}]), - {ok,{_Host,Port}} = inet:sockname(S), - {ok, C} = ssh:connect("localhost", Port, [{silently_accept_hosts, true}, - {user_dir, UserDir}, - {user, "vego"}, - {password, "morot"}, - {user_interaction, false}]), - {S,Pid,C} - end, - - Tests = [Test(),Test(),Test(),Test(),Test(),Test()], - - [begin - gen_tcp:close(S), - ssh:stop_daemon(Pid), - exit(C, {shutdown, normal}) - end || {S,Pid,C} <- Tests]. +%% Help function +%% N2-N1 +ms_passed(N1={_,_,M1}, N2={_,_,M2}) -> + {0,{0,Min,Sec}} = calendar:time_difference(calendar:now_to_local_time(N1), + calendar:now_to_local_time(N2)), + 1000 * (Min*60 + Sec + (M2-M1)/1000000). %%-------------------------------------------------------------------- -packet_size_zero(Config) -> - SystemDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), +ssh_connect_negtimeout_parallel(Config) -> ssh_connect_negtimeout(Config,true). +ssh_connect_negtimeout_sequential(Config) -> ssh_connect_negtimeout(Config,false). + +ssh_connect_negtimeout(Config, Parallel) -> + process_flag(trap_exit, true), + SystemDir = filename:join(?config(priv_dir, Config), system), + UserDir = ?config(priv_dir, Config), + NegTimeOut = 2000, % ms + ct:log("Parallel: ~p",[Parallel]), - {Server, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, - {user_dir, UserDir}, - {user_passwords, [{"vego", "morot"}]}]), - Conn = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user_dir, UserDir}, - {user_interaction, false}, - {user, "vego"}, - {password, "morot"}]), + {_Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},{user_dir, UserDir}, + {parallel_login, Parallel}, + {negotiation_timeout, NegTimeOut}, + {failfun, fun ssh_test_lib:failfun/2}]), + + {ok,Socket} = gen_tcp:connect(Host, Port, []), + ct:pal("And now sleeping 1.2*NegTimeOut (~p ms)...", [round(1.2 * NegTimeOut)]), + receive after round(1.2 * NegTimeOut) -> ok end, + + case inet:sockname(Socket) of + {ok,_} -> ct:fail("Socket not closed"); + {error,_} -> ok + end. - {ok,Chan} = ssh_connection:session_channel(Conn, 1000, _MaxPacketSize=0, 60000), - ok = ssh_connection:shell(Conn, Chan), +%%-------------------------------------------------------------------- +ssh_connect_nonegtimeout_connected_parallel() -> + [{doc, "Test that ssh connection does not timeout if the connection is established (parallel)"}]. +ssh_connect_nonegtimeout_connected_parallel(Config) -> + ssh_connect_nonegtimeout_connected(Config, true). + +ssh_connect_nonegtimeout_connected_sequential() -> + [{doc, "Test that ssh connection does not timeout if the connection is established (non-parallel)"}]. +ssh_connect_nonegtimeout_connected_sequential(Config) -> + ssh_connect_nonegtimeout_connected(Config, false). - ssh:close(Conn), - ssh:stop_daemon(Server), +ssh_connect_nonegtimeout_connected(Config, Parallel) -> + process_flag(trap_exit, true), + SystemDir = filename:join(?config(priv_dir, Config), system), + UserDir = ?config(priv_dir, Config), + NegTimeOut = 20000, % ms + ct:log("Parallel: ~p",[Parallel]), + + {_Pid, _Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},{user_dir, UserDir}, + {parallel_login, Parallel}, + {negotiation_timeout, NegTimeOut}, + {failfun, fun ssh_test_lib:failfun/2}]), + ct:sleep(500), + + IO = ssh_test_lib:start_io_server(), + Shell = ssh_test_lib:start_shell(Port, IO, UserDir), receive - {ssh_cm,Conn,{data,Chan,_Type,_Msg1}} = M -> - ct:log("Got ~p",[M]), - ct:fail(doesnt_obey_max_packet_size_0) - after 5000 -> - ok - end. - -%%-------------------------------------------------------------------- -shell_no_unicode(Config) -> - new_do_shell(?config(io,Config), - [new_prompt, - {type,"io:format(\"hej ~p~n\",[42])."}, - {expect,"hej 42"} - ]). - -%%-------------------------------------------------------------------- -shell_unicode_string(Config) -> - new_do_shell(?config(io,Config), - [new_prompt, - {type,"io:format(\"ã“ã«ã¡ã‚~ts~n\",[\"四二\"])."}, - {expect,"ã“ã«ã¡ã‚四二"}, - {expect,"ok"} - ]). + {'EXIT', _, _} -> + ct:fail(no_ssh_connection); + ErlShellStart -> + ct:pal("---Erlang shell start: ~p~n", [ErlShellStart]), + one_shell_op(IO, NegTimeOut), + one_shell_op(IO, NegTimeOut), + ct:pal("And now sleeping 1.2*NegTimeOut (~p ms)...", [round(1.2 * NegTimeOut)]), + receive after round(1.2 * NegTimeOut) -> ok end, + one_shell_op(IO, NegTimeOut) + end, + exit(Shell, kill). -%%-------------------------------------------------------------------- -%%% Test basic connection with openssh_zlib -openssh_zlib_basic_test(Config) -> - case ssh_test_lib:ssh_supports(['zlib@openssh.com',none], compression) of - {false,L} -> - {skip, io_lib:format("~p compression is not supported",[L])}; - - true -> - SystemDir = filename:join(?config(priv_dir, Config), system), - UserDir = ?config(priv_dir, Config), - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, - {user_dir, UserDir}, - {preferred_algorithms,[{compression, ['zlib@openssh.com']}]}, - {failfun, fun ssh_test_lib:failfun/2}]), - ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user_dir, UserDir}, - {user_interaction, false}, - {preferred_algorithms,[{compression, ['zlib@openssh.com', - none]}]} - ]), - ok = ssh:close(ConnectionRef), - ssh:stop_daemon(Pid) +one_shell_op(IO, TimeOut) -> + ct:pal("One shell op: Waiting for prompter"), + receive + ErlPrompt0 -> ct:log("Erlang prompt: ~p~n", [ErlPrompt0]) + after TimeOut -> ct:fail("Timeout waiting for promter") + end, + + IO ! {input, self(), "2*3*7.\r\n"}, + receive + Echo0 -> ct:log("Echo: ~p ~n", [Echo0]) + after TimeOut -> ct:fail("Timeout waiting for echo") + end, + + receive + ?NEWLINE -> ct:log("NEWLINE received", []) + after TimeOut -> + receive Any1 -> ct:log("Bad NEWLINE: ~p",[Any1]) + after 0 -> ct:fail("Timeout waiting for NEWLINE") + end + end, + + receive + Result0 -> ct:log("Result: ~p~n", [Result0]) + after TimeOut -> ct:fail("Timeout waiting for result") end. %%-------------------------------------------------------------------- -ssh_info_print(Config) -> - %% Just check that ssh_print:info() crashes - PrivDir = ?config(priv_dir, Config), - PrintFile = filename:join(PrivDir,info), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - Parent = self(), - UnexpFun = fun(Msg,_Peer) -> - Parent ! {unexpected,Msg,self()}, - skip - end, - ConnFun = fun(_,_,_) -> Parent ! {connect,self()} end, - - {DaemonRef, Host, Port} = - ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {unexpectedfun, UnexpFun}, - {connectfun, ConnFun}, - {failfun, fun ssh_test_lib:failfun/2}]), - ClientConnRef1 = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_dir, UserDir}, - {unexpectedfun, UnexpFun}, - {user_interaction, false}]), - ClientConnRef2 = +openssh_zlib_basic_test() -> + [{doc, "Test basic connection with openssh_zlib"}]. +openssh_zlib_basic_test(Config) -> + SystemDir = filename:join(?config(priv_dir, Config), system), + UserDir = ?config(priv_dir, Config), + + {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, + {user_dir, UserDir}, + {failfun, fun ssh_test_lib:failfun/2}]), + ConnectionRef = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, {user_dir, UserDir}, - {unexpectedfun, UnexpFun}, - {user_interaction, false}]), - receive - {connect,DaemonConnRef} -> - ct:log("DaemonRef=~p, DaemonConnRef=~p, ClientConnRefs=~p",[DaemonRef, DaemonConnRef, - [ClientConnRef1,ClientConnRef2] - ]) - after 2000 -> - ok - end, - - {ok,D} = file:open(PrintFile, write), - ssh_info:print(D), - ok = file:close(D), + {user_interaction, false}, + {compression, openssh_zlib}]), + ok = ssh:close(ConnectionRef), + ssh:stop_daemon(Pid). - {ok,Bin} = file:read_file(PrintFile), - ct:log("~s",[Bin]), +%%-------------------------------------------------------------------- - receive - {unexpected, Msg, Pid} -> - ct:log("~p got unexpected msg ~p",[Pid,Msg]), - ct:log("process_info(~p) = ~n~p",[Pid,process_info(Pid)]), - ok = ssh:close(ClientConnRef1), - ok = ssh:close(ClientConnRef2), - ok = ssh:stop_daemon(DaemonRef), - {fail,"unexpected msg"} - after 1000 -> - ok = ssh:close(ClientConnRef1), - ok = ssh:close(ClientConnRef2), - ok = ssh:stop_daemon(DaemonRef) +max_sessions_ssh_connect_parallel(Config) -> + max_sessions(Config, true, connect_fun(ssh__connect,Config)). +max_sessions_ssh_connect_sequential(Config) -> + max_sessions(Config, false, connect_fun(ssh__connect,Config)). + +max_sessions_sftp_start_channel_parallel(Config) -> + max_sessions(Config, true, connect_fun(ssh_sftp__start_channel, Config)). +max_sessions_sftp_start_channel_sequential(Config) -> + max_sessions(Config, false, connect_fun(ssh_sftp__start_channel, Config)). + + +%%%---- helpers: +connect_fun(ssh__connect, Config) -> + fun(Host,Port) -> + ssh_test_lib:connect(Host, Port, + [{silently_accept_hosts, true}, + {user_dir, ?config(priv_dir,Config)}, + {user_interaction, false}, + {user, "carni"}, + {password, "meat"} + ]) + %% ssh_test_lib returns R when ssh:connect returns {ok,R} + end; +connect_fun(ssh_sftp__start_channel, _Config) -> + fun(Host,Port) -> + {ok,_Pid,ConnRef} = + ssh_sftp:start_channel(Host, Port, + [{silently_accept_hosts, true}, + {user, "carni"}, + {password, "meat"} + ]), + ConnRef end. +max_sessions(Config, ParallelLogin, Connect) when is_function(Connect,2) -> + SystemDir = filename:join(?config(priv_dir, Config), system), + UserDir = ?config(priv_dir, Config), + MaxSessions = 5, + {Pid, Host, Port} = ssh_test_lib:daemon([ + {system_dir, SystemDir}, + {user_dir, UserDir}, + {user_passwords, [{"carni", "meat"}]}, + {parallel_login, ParallelLogin}, + {max_sessions, MaxSessions} + ]), + + try [Connect(Host,Port) || _ <- lists:seq(1,MaxSessions)] + of + Connections -> + %% Step 1 ok: could set up max_sessions connections + ct:log("Connections up: ~p",[Connections]), + [_|_] = Connections, + + %% Now try one more than alowed: + ct:pal("Info Report might come here...",[]), + try Connect(Host,Port) + of + _ConnectionRef1 -> + ssh:stop_daemon(Pid), + {fail,"Too many connections accepted"} + catch + error:{badmatch,{error,"Connection closed"}} -> + %% Step 2 ok: could not set up max_sessions+1 connections + %% This is expected + %% Now stop one connection and try to open one more + ok = ssh:close(hd(Connections)), + try Connect(Host,Port) + of + _ConnectionRef1 -> + %% Step 3 ok: could set up one more connection after killing one + %% Thats good. + ssh:stop_daemon(Pid), + ok + catch + error:{badmatch,{error,"Connection closed"}} -> + %% Bad indeed. Could not set up one more connection even after killing + %% one existing. Very bad. + ssh:stop_daemon(Pid), + {fail,"Does not decrease # active sessions"} + end + end + catch + error:{badmatch,{error,"Connection closed"}} -> + ssh:stop_daemon(Pid), + {fail,"Too few connections accepted"} + end. + %%-------------------------------------------------------------------- %% Internal functions ------------------------------------------------ %%-------------------------------------------------------------------- + %% Due to timing the error message may or may not be delivered to %% the "tcp-application" before the socket closed message is recived -check_error("Invalid state") -> +check_error("Internal error") -> ok; check_error("Connection closed") -> ok; -check_error("Selection of key exchange algorithm failed") -> - ok; check_error(Error) -> ct:fail(Error). @@ -1107,38 +976,28 @@ do_shell(IO, Shell) -> receive ErlPrompt0 -> - ct:log("Erlang prompt: ~p~n", [ErlPrompt0]) + ct:pal("Erlang prompt: ~p~n", [ErlPrompt0]) end, IO ! {input, self(), "1+1.\r\n"}, receive Echo0 -> - ct:log("Echo: ~p ~n", [Echo0]) - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) + ct:pal("Echo: ~p ~n", [Echo0]) end, receive ?NEWLINE -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, receive Result0 = <<"2">> -> - ct:log("Result: ~p~n", [Result0]) - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) + ct:pal("Result: ~p~n", [Result0]) end, receive ?NEWLINE -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, receive ErlPrompt1 -> - ct:log("Erlang prompt: ~p~n", [ErlPrompt1]) - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) + ct:pal("Erlang prompt: ~p~n", [ErlPrompt1]) end, exit(Shell, kill). %%Does not seem to work in the testserver! @@ -1149,7 +1008,7 @@ %% end, %% receive %% Echo1 -> - %% ct:log("Echo: ~p ~n", [Echo1]) + %% ct:pal("Echo: ~p ~n", [Echo1]) %% end, %% receive %% ?NEWLINE -> @@ -1157,98 +1016,9 @@ %% end, %% receive %% Result1 -> - %% ct:log("Result: ~p~n", [Result1]) + %% ct:pal("Result: ~p~n", [Result1]) %% end, %% receive %% {'EXIT', Shell, killed} -> %% ok %% end. - - -%%-------------------------------------------------------------------- -wait_for_erlang_first_line(Config) -> - receive - {'EXIT', _, _} -> - {fail,no_ssh_connection}; - <<"Eshell ",_/binary>> = _ErlShellStart -> - ct:log("Erlang shell start: ~p~n", [_ErlShellStart]), - Config; - Other -> - ct:log("Unexpected answer from ssh server: ~p",[Other]), - {fail,unexpected_answer} - after 10000 -> - ct:log("No answer from ssh-server"), - {fail,timeout} - end. - - - -new_do_shell(IO, List) -> new_do_shell(IO, 0, List). - -new_do_shell(IO, N, [new_prompt|More]) -> - new_do_shell(IO, N+1, More); - -new_do_shell(IO, N, Ops=[{Order,Arg}|More]) -> - Pfx = prompt_prefix(), - PfxSize = size(Pfx), - receive - _X = <<"\r\n">> -> - ct:log("Skip newline ~p",[_X]), - new_do_shell(IO, N, Ops); - - < ">> when (P1-$0)==N -> - new_do_shell_prompt(IO, N, Order, Arg, More); - - < ">> when (P1-$0)*10 + (P2-$0) == N -> - new_do_shell_prompt(IO, N, Order, Arg, More); - - < ">> when (P1-$0)*100 + (P2-$0)*10 + (P3-$0) == N -> - new_do_shell_prompt(IO, N, Order, Arg, More); - - Err when element(1,Err)==error -> - ct:fail("new_do_shell error: ~p~n",[Err]); - - RecBin when Order==expect ; Order==expect_echo -> - ct:log("received ~p",[RecBin]), - RecStr = string:strip(unicode:characters_to_list(RecBin)), - ExpStr = string:strip(Arg), - case lists:prefix(ExpStr, RecStr) of - true when Order==expect -> - ct:log("Matched ~ts",[RecStr]), - new_do_shell(IO, N, More); - true when Order==expect_echo -> - ct:log("Matched echo ~ts",[RecStr]), - new_do_shell(IO, N, More); - false -> - ct:fail("*** Expected ~p, but got ~p",[string:strip(ExpStr),RecStr]) - end - after 30000 -> - ct:log("Meassage queue of ~p:~n~p", - [self(), erlang:process_info(self(), messages)]), - case Order of - expect -> ct:fail("timeout, expected ~p",[string:strip(Arg)]); - type -> ct:fail("timeout, no prompt") - end - end; - -new_do_shell(_, _, []) -> - ok. - -prompt_prefix() -> - case node() of - nonode@nohost -> <<>>; - Node -> list_to_binary( - lists:concat(["(",Node,")"])) - end. - - -new_do_shell_prompt(IO, N, type, Str, More) -> - ct:log("Matched prompt ~p to trigger sending of next line to server",[N]), - IO ! {input, self(), Str++"\r\n"}, - ct:log("Promt '~p> ', Sent ~ts",[N,Str++"\r\n"]), - new_do_shell(IO, N, [{expect_echo,Str}|More]); % expect echo of the sent line -new_do_shell_prompt(IO, N, Op, Str, More) -> - ct:log("Matched prompt ~p",[N]), - new_do_shell(IO, N, [{Op,Str}|More]). - -%%-------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_connection_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_connection_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_connection_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_connection_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -22,7 +21,6 @@ -module(ssh_connection_SUITE). -include_lib("common_test/include/ct.hrl"). --include_lib("ssh/src/ssh_connect.hrl"). -compile(export_all). @@ -33,41 +31,25 @@ %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- -%% suite() -> -%% [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}]. all() -> [ - {group, openssh}, + {group, openssh_payload}, interrupted_send, start_shell, start_shell_exec, - start_shell_exec_fun, - gracefull_invalid_version, - gracefull_invalid_start, - gracefull_invalid_long_start, - gracefull_invalid_long_start_no_nl, - stop_listener, - start_subsystem_on_closed_channel, - max_channels_option + start_shell_exec_fun ]. groups() -> - [{openssh, [], payload() ++ ptty()}]. - -payload() -> - [simple_exec, - small_cat, - big_cat, - send_after_exit]. - -ptty() -> - [ptty_alloc_default, - ptty_alloc, - ptty_alloc_pixel]. - + [{openssh_payload, [], [simple_exec, + small_cat, + big_cat, + send_after_exit + ]}]. %%-------------------------------------------------------------------- init_per_suite(Config) -> - catch crypto:stop(), case catch crypto:start() of ok -> Config; @@ -79,14 +61,13 @@ crypto:stop(). %%-------------------------------------------------------------------- -init_per_group(openssh, Config) -> +init_per_group(openssh_payload, _Config) -> case gen_tcp:connect("localhost", 22, []) of {error,econnrefused} -> {skip,"No openssh deamon"}; {ok, Socket} -> - gen_tcp:close(Socket), - ssh_test_lib:openssh_sanity_check(Config) - end; + gen_tcp:close(Socket) + end; init_per_group(_, Config) -> Config. @@ -97,7 +78,7 @@ init_per_testcase(_TestCase, Config) -> %% To make sure we start clean as it is not certain that %% end_per_testcase will be run! - end_per_testcase(Config), + ssh:stop(), ssh:start(), Config. @@ -120,28 +101,20 @@ receive {ssh_cm, ConnectionRef, {data, ChannelId0, 0, <<"testing\n">>}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, %% receive close messages receive {ssh_cm, ConnectionRef, {eof, ChannelId0}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, receive {ssh_cm, ConnectionRef, {exit_status, ChannelId0, 0}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, receive {ssh_cm, ConnectionRef,{closed, ChannelId0}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end. %%-------------------------------------------------------------------- @@ -163,28 +136,20 @@ receive {ssh_cm, ConnectionRef, {data, ChannelId0, 0, Data}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, %% receive close messages receive {ssh_cm, ConnectionRef, {eof, ChannelId0}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, receive {ssh_cm, ConnectionRef, {exit_status, ChannelId0, 0}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, receive {ssh_cm, ConnectionRef,{closed, ChannelId0}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end. %%-------------------------------------------------------------------- big_cat() -> @@ -203,7 +168,7 @@ %% pre-adjust receive window so the other end doesn't block ssh_connection:adjust_window(ConnectionRef, ChannelId0, size(Data)), - ct:log("sending ~p byte binary~n",[size(Data)]), + ct:pal("sending ~p byte binary~n",[size(Data)]), ok = ssh_connection:send(ConnectionRef, ChannelId0, Data, 10000), ok = ssh_connection:send_eof(ConnectionRef, ChannelId0), @@ -214,11 +179,11 @@ {ok, Other} -> case size(Data) =:= size(Other) of true -> - ct:log("received and sent data are same" - "size but do not match~n",[]); + ct:pal("received and sent data are same" + "size but do not match~n",[]); false -> - ct:log("sent ~p but only received ~p~n", - [size(Data), size(Other)]) + ct:pal("sent ~p but only received ~p~n", + [size(Data), size(Other)]) end, ct:fail(receive_data_mismatch); Else -> @@ -228,15 +193,11 @@ %% receive close messages (eof already consumed) receive {ssh_cm, ConnectionRef, {exit_status, ChannelId0, 0}} -> - ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) + ok end, receive {ssh_cm, ConnectionRef,{closed, ChannelId0}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end. %%-------------------------------------------------------------------- @@ -255,20 +216,14 @@ receive {ssh_cm, ConnectionRef, {eof, ChannelId0}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, receive {ssh_cm, ConnectionRef, {exit_status, ChannelId0, _ExitStatus}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, receive {ssh_cm, ConnectionRef,{closed, ChannelId0}} -> ok - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, case ssh_connection:send(ConnectionRef, ChannelId0, Data, 2000) of {error, closed} -> ok; @@ -281,43 +236,6 @@ end. %%-------------------------------------------------------------------- -ptty_alloc_default() -> - [{doc, "Test sending PTTY alloc message with only defaults."}]. - -ptty_alloc_default(Config) when is_list(Config) -> - ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true}, - {user_interaction, false}]), - {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), - success = ssh_connection:ptty_alloc(ConnectionRef, ChannelId, []), - ssh:close(ConnectionRef). - -%%-------------------------------------------------------------------- -ptty_alloc() -> - [{doc, "Test sending PTTY alloc message with width,height options."}]. - -ptty_alloc(Config) when is_list(Config) -> - ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true}, - {user_interaction, false}]), - {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), - success = ssh_connection:ptty_alloc(ConnectionRef, ChannelId, - [{term, os:getenv("TERM", ?DEFAULT_TERMINAL)}, {width, 70}, {height, 20}]), - ssh:close(ConnectionRef). - - -%%-------------------------------------------------------------------- -ptty_alloc_pixel() -> - [{doc, "Test sending PTTY alloc message pixel options."}]. - -ptty_alloc_pixel(Config) when is_list(Config) -> - ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true}, - {user_interaction, false}]), - {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), - success = ssh_connection:ptty_alloc(ConnectionRef, ChannelId, - [{term, os:getenv("TERM", ?DEFAULT_TERMINAL)}, {pixel_widh, 630}, {pixel_hight, 470}]), - ssh:close(ConnectionRef). - -%%-------------------------------------------------------------------- - interrupted_send() -> [{doc, "Use a subsystem that echos n char and then sends eof to cause a channel exit partway through a large send."}]. @@ -332,10 +250,10 @@ {subsystems, [{"echo_n", {ssh_echo_server, [4000000]}}]}]), ConnectionRef = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, false}, - {user_dir, UserDir}]), + {user, "foo"}, + {password, "morot"}, + {user_interaction, false}, + {user_dir, UserDir}]), {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), @@ -370,24 +288,24 @@ file:make_dir(UserDir), SysDir = ?config(data_dir, Config), {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {shell, fun(U, H) -> start_our_shell(U, H) end} ]), + {user_dir, UserDir}, + {password, "morot"}, + {shell, fun(U, H) -> start_our_shell(U, H) end} ]), ConnectionRef = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, true}, - {user_dir, UserDir}]), + {user, "foo"}, + {password, "morot"}, + {user_interaction, true}, + {user_dir, UserDir}]), {ok, ChannelId0} = ssh_connection:session_channel(ConnectionRef, infinity), ok = ssh_connection:shell(ConnectionRef,ChannelId0), receive - {ssh_cm,ConnectionRef, {data, ChannelId0, 0, <<"Enter command\r\n">>}} -> - ok + {ssh_cm,ConnectionRef, {data, ChannelId, 0, <<"Enter command\r\n">>}} -> + ok after 5000 -> - ct:fail("CLI Timeout") + ct:fail("CLI Timeout") end, ssh:close(ConnectionRef), @@ -402,25 +320,25 @@ file:make_dir(UserDir), SysDir = ?config(data_dir, Config), {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {exec, {?MODULE,ssh_exec,[]}} ]), + {user_dir, UserDir}, + {password, "morot"}, + {exec, {?MODULE,ssh_exec,[]}} ]), ConnectionRef = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, true}, - {user_dir, UserDir}]), + {user, "foo"}, + {password, "morot"}, + {user_interaction, true}, + {user_dir, UserDir}]), {ok, ChannelId0} = ssh_connection:session_channel(ConnectionRef, infinity), success = ssh_connection:exec(ConnectionRef, ChannelId0, - "testing", infinity), + "testing", infinity), receive - {ssh_cm, ConnectionRef, {data, _ChannelId, 0, <<"testing\r\n">>}} -> - ok + {ssh_cm,ConnectionRef, {data, ChannelId, 0, <<"testing\r\n">>}} -> + ok after 5000 -> - ct:fail("Exec Timeout") + ct:fail("Exec Timeout") end, ssh:close(ConnectionRef), @@ -436,292 +354,30 @@ file:make_dir(UserDir), SysDir = ?config(data_dir, Config), {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {exec, fun ssh_exec/1}]), + {user_dir, UserDir}, + {password, "morot"}, + {exec, fun ssh_exec/1}]), ConnectionRef = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, true}, - {user_dir, UserDir}]), + {user, "foo"}, + {password, "morot"}, + {user_interaction, true}, + {user_dir, UserDir}]), {ok, ChannelId0} = ssh_connection:session_channel(ConnectionRef, infinity), success = ssh_connection:exec(ConnectionRef, ChannelId0, - "testing", infinity), + "testing", infinity), receive - {ssh_cm, ConnectionRef, {data, _ChannelId, 0, <<"testing\r\n">>}} -> - ok + {ssh_cm,ConnectionRef, {data, ChannelId, 0, <<"testing\r\n">>}} -> + ok after 5000 -> - ct:fail("Exec Timeout") + ct:fail("Exec Timeout") end, ssh:close(ConnectionRef), ssh:stop_daemon(Pid). - -%%-------------------------------------------------------------------- - -gracefull_invalid_version(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - - {_Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}]), - - {ok, S} = gen_tcp:connect(Host, Port, []), - ok = gen_tcp:send(S, ["SSH-8.-1","\r\n"]), - receive - Verstring -> - ct:log("Server version: ~p~n", [Verstring]), - receive - {tcp_closed, S} -> - ok - end - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. - -gracefull_invalid_start(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - {_Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}]), - - {ok, S} = gen_tcp:connect(Host, Port, []), - ok = gen_tcp:send(S, ["foobar","\r\n"]), - receive - Verstring -> - ct:log("Server version: ~p~n", [Verstring]), - receive - {tcp_closed, S} -> - ok - end - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. - -gracefull_invalid_long_start(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - {_Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}]), - - {ok, S} = gen_tcp:connect(Host, Port, []), - ok = gen_tcp:send(S, [lists:duplicate(257, $a), "\r\n"]), - receive - Verstring -> - ct:log("Server version: ~p~n", [Verstring]), - receive - {tcp_closed, S} -> - ok - end - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. - - -gracefull_invalid_long_start_no_nl(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - {_Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}]), - - {ok, S} = gen_tcp:connect(Host, Port, []), - ok = gen_tcp:send(S, [lists:duplicate(257, $a), "\r\n"]), - receive - Verstring -> - ct:log("Server version: ~p~n", [Verstring]), - receive - {tcp_closed, S} -> - ok - end - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. - -stop_listener() -> - [{doc, "start ssh daemon, setup connections, stop listener, restart listner"}]. - -stop_listener(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - - {Pid0, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {exec, fun ssh_exec/1}]), - - ConnectionRef0 = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, true}, - {user_dir, UserDir}]), - - {ok, ChannelId0} = ssh_connection:session_channel(ConnectionRef0, infinity), - - ssh:stop_listener(Host, Port), - - {error, _} = ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, true}, - {user_dir, UserDir}]), - success = ssh_connection:exec(ConnectionRef0, ChannelId0, - "testing", infinity), - receive - {ssh_cm, ConnectionRef0, {data, ChannelId0, 0, <<"testing\r\n">>}} -> - ok - after 5000 -> - ct:fail("Exec Timeout") - end, - - {ok, HostAddr} = inet:getaddr(Host, inet), - case ssh_test_lib:daemon(HostAddr, Port, [{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "potatis"}, - {exec, fun ssh_exec/1}]) of - {Pid1, HostAddr, Port} -> - ConnectionRef1 = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "potatis"}, - {user_interaction, true}, - {user_dir, UserDir}]), - {error, _} = ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, true}, - {user_dir, UserDir}]), - ssh:close(ConnectionRef0), - ssh:close(ConnectionRef1), - ssh:stop_daemon(Pid0), - ssh:stop_daemon(Pid1); - Error -> - ct:fail({unexpected, Error}) - end. - -start_subsystem_on_closed_channel(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {subsystems, [{"echo_n", {ssh_echo_server, [4000000]}}]}]), - - ConnectionRef = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, false}, - {user_dir, UserDir}]), - - {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), - - ok = ssh_connection:close(ConnectionRef, ChannelId), - - {error, closed} = ssh_connection:subsystem(ConnectionRef, ChannelId, "echo_n", infinity), - - ssh:close(ConnectionRef), - ssh:stop_daemon(Pid). - -%%-------------------------------------------------------------------- -max_channels_option() -> - [{doc, "Test max_channels option"}]. - -max_channels_option(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {max_channels, 3}, - {subsystems, [{"echo_n", {ssh_echo_server, [4000000]}}]} - ]), - - ConnectionRef = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, true}, - {user_dir, UserDir}]), - - {ok, ChannelId0} = ssh_connection:session_channel(ConnectionRef, infinity), - {ok, ChannelId1} = ssh_connection:session_channel(ConnectionRef, infinity), - {ok, ChannelId2} = ssh_connection:session_channel(ConnectionRef, infinity), - {ok, ChannelId3} = ssh_connection:session_channel(ConnectionRef, infinity), - {ok, ChannelId4} = ssh_connection:session_channel(ConnectionRef, infinity), - {ok, ChannelId5} = ssh_connection:session_channel(ConnectionRef, infinity), - {ok, _ChannelId6} = ssh_connection:session_channel(ConnectionRef, infinity), - - %%%---- shell - ok = ssh_connection:shell(ConnectionRef,ChannelId0), - receive - {ssh_cm,ConnectionRef, {data, ChannelId0, 0, <<"Eshell",_/binary>>}} -> - ok - after 5000 -> - ct:fail("CLI Timeout") - end, - - %%%---- subsystem "echo_n" - success = ssh_connection:subsystem(ConnectionRef, ChannelId1, "echo_n", infinity), - - %%%---- exec #1 - success = ssh_connection:exec(ConnectionRef, ChannelId2, "testing1.\n", infinity), - receive - {ssh_cm, ConnectionRef, {data, ChannelId2, 0, <<"testing1",_/binary>>}} -> - ok - after 5000 -> - ct:fail("Exec #1 Timeout") - end, - - %%%---- ptty - success = ssh_connection:ptty_alloc(ConnectionRef, ChannelId3, []), - - %%%---- exec #2 - failure = ssh_connection:exec(ConnectionRef, ChannelId4, "testing2.\n", infinity), - - %%%---- close the shell - ok = ssh_connection:send(ConnectionRef, ChannelId0, "exit().\n", 5000), - - %%%---- wait for the subsystem to terminate - receive - {ssh_cm,ConnectionRef,{closed,ChannelId0}} -> ok - after 5000 -> - ct:log("Timeout waiting for '{ssh_cm,~p,{closed,~p}}'~n" - "Message queue:~n~p", - [ConnectionRef,ChannelId0,erlang:process_info(self(),messages)]), - ct:fail("exit Timeout",[]) - end, - - %%%---- exec #3 - success = ssh_connection:exec(ConnectionRef, ChannelId5, "testing3.\n", infinity), - receive - {ssh_cm, ConnectionRef, {data, ChannelId5, 0, <<"testing3",_/binary>>}} -> - ok - after 5000 -> - ct:fail("Exec #3 Timeout") - end, - - ssh:close(ConnectionRef), - ssh:stop_daemon(Pid). - %%-------------------------------------------------------------------- %% Internal functions ------------------------------------------------ %%-------------------------------------------------------------------- @@ -757,14 +413,14 @@ end. %%%------------------------------------------------------------------- -%% This is taken from the ssh example code. +% This is taken from the ssh example code. start_our_shell(_User, _Peer) -> spawn(fun() -> - io:format("Enter command\n") - %% Don't actually loop, just exit + io:format("Enter command\n") + %% Don't actually loop, just exit end). ssh_exec(Cmd) -> spawn(fun() -> - io:format(Cmd ++ "\n") + io:format(Cmd ++ "\n") end). diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_echo_server.erl erlang-17.3-dfsg/lib/ssh/test/ssh_echo_server.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_echo_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_echo_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_key_cb.erl erlang-17.3-dfsg/lib/ssh/test/ssh_key_cb.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_key_cb.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_key_cb.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% -%%---------------------------------------------------------------------- - -%% Note: This module is used by ssh_basic_SUITE - --module(ssh_key_cb). --behaviour(ssh_client_key_api). --compile(export_all). - -add_host_key(_, _, _) -> - ok. - -is_host_key(_, _, _, _) -> - true. - -user_key('ssh-dss', Opts) -> - UserDir = proplists:get_value(user_dir, Opts), - KeyFile = filename:join(filename:dirname(UserDir), "id_dsa"), - {ok, KeyBin} = file:read_file(KeyFile), - [Entry] = public_key:pem_decode(KeyBin), - Key = public_key:pem_entry_decode(Entry), - {ok, Key}; - -user_key(_Alg, _Opt) -> - {error, "Not Supported"}. diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_key_cb_options.erl erlang-17.3-dfsg/lib/ssh/test/ssh_key_cb_options.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_key_cb_options.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_key_cb_options.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% -%%---------------------------------------------------------------------- - -%% Note: This module is used by ssh_basic_SUITE - --module(ssh_key_cb_options). --behaviour(ssh_client_key_api). --compile(export_all). - -add_host_key(_, _, _) -> - ok. - -is_host_key(_, _, _, _) -> - true. - -user_key('ssh-dss', Opts) -> - KeyCbOpts = proplists:get_value(key_cb_private, Opts), - KeyBin = proplists:get_value(priv_key, KeyCbOpts), - [Entry] = public_key:pem_decode(KeyBin), - Key = public_key:pem_entry_decode(Entry), - {ok, Key}; - -user_key(_Alg, _Opt) -> - {error, "Not Supported"}. diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/id_dsa erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/id_dsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/id_dsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/id_dsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBvAIBAAKBgQDfi2flSTZZofwT4yQT0NikX/LGNT7UPeB/XEWe/xovEYCElfaQ -APFixXvEgXwoojmZ5kiQRKzLM39wBP0jPERLbnZXfOOD0PDnw0haMh7dD7XKVMod -/EigVgHf/qBdM2M8yz1s/rRF7n1UpLSypziKjkzCm7JoSQ2zbWIPdmBIXwIVAMgP -kpr7Sq3O7sHdb8D601DRjoExAoGAMOQxDfB2Fd8ouz6G96f/UOzRMI/Kdv8kYYKW -JIGY+pRYrLPyYzUeJznwZreOJgrczAX+luHnKFWJ2Dnk5CyeXk67Wsr7pJ/4MBMD -OKeIS0S8qoSBN8+Krp79fgA+yS3IfqbkJLtLu4EBaCX4mKQIX4++k44d4U5lc8pt -+9hlEI8CgYEAznKxx9kyC6bVo7LUYKaGhofRFt0SYFc5PVmT2VUGRs1R6+6DPD+e -uEO6IhFct7JFSRbP9p0JD4Uk+3zlZF+XX6b2PsZkeV8f/02xlNGUSmEzCSiNg1AX -Cy/WusYhul0MncWCHMcOZB5rIvU/aP5EJJtn3xrRaz6u0SThF6AnT34CFQC63czE -ZU8w8Q+H7z0j+a+70x2iAw== ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/id_rsa erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/id_rsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/id_rsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/id_rsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQD1OET+3O/Bvj/dtjxDTXmj1oiJt4sIph5kGy0RfjoPrZfaS+CU -DhakCmS6t2ivxWFgtpKWaoGMZMJqWj6F6ZsumyFl3FPBtujwY/35cgifrI9Ns4Tl -zR1uuengNBmV+WRQ5cd9F2qS6Z8aDQihzt0r8JUqLcK+VQbrmNzboCCQQwIDAQAB -AoGAPQEyqPTt8JUT7mRXuaacjFXiweAXhp9NEDpyi9eLOjtFe9lElZCrsUOkq47V -TGUeRKEm9qSodfTbKPoqc8YaBJGJPhUaTAcha+7QcDdfHBvIsgxvU7ePVnlpXRp3 -CCUEMPhlnx6xBoTYP+fRU0e3+xJIPVyVCqX1jAdUMkzfRoECQQD6ux7B1QJAIWyK -SGkbDUbBilNmzCFNgIpOP6PA+bwfi5d16diTpra5AX09keQABAo/KaP1PdV8Vg0p -z4P3A7G3AkEA+l+AKG6m0kQTTBMJDqOdVPYwe+5GxunMaqmhokpEbuGsrZBl5Dvd -WpcBjR7jmenrhKZRIuA+Fz5HPo/UQJPl1QJBAKxstDkeED8j/S2XoFhPKAJ+6t39 -sUVICVTIZQeXdmzHJXCcUSkw8+WEhakqw/3SyW0oaK2FSWQJFWJUZ+8eJj8CQEh3 -xeduB5kKnS9CvzdeghZqX6QvVosSdtlUmfUYW/BgH5PpHKTP8wTaeld3XldZTpMJ -dKiMkUw2+XYROVUrubUCQD+Na1LhULlpn4ISEtIEfqpdlUhxDgO15Wg8USmsng+x -ICliVOSQtwaZjm8kwaFt0W7XnpnDxbRs37vIEbIMWak= ------END RSA PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_dsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_dsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_dsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_dsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQCClaHzE2ul0gKSUxah5W0W8UiJLy4hXngKEqpaUq9SSdVdY2LK -wVfKH1gt5iuaf1FfzOhsIC9G/GLnjYttXZc92cv/Gfe3gR+s0ni2++MX+T++mE/Q -diltXv/Hp27PybS67SmiFW7I+RWnT2OKlMPtw2oUuKeztCe5UWjaj/y5FQIVAPLA -l9RpiU30Z87NRAHY3NTRaqtrAoGANMRxw8UfdtNVR0CrQj3AgPaXOGE4d+G4Gp4X -skvnCHycSVAjtYxebUkzUzt5Q6f/IabuLUdge3gXrc8BetvrcKbp+XZgM0/Vj2CF -Ymmy3in6kzGZq7Fw1sZaku6AOU8vLa5woBT2vAcHLLT1bLAzj7viL048T6MfjrOP -ef8nHvACgYBhDWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah -/XcF3DeRF+eEoz48wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+U -ykSTXYUbtsfTNRFQGBW2/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0CgIVAN4wtL5W -Lv62jKcdskxNyz2NQoBx ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_dsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_dsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_dsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_dsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1kc3MAAACBAIKVofMTa6XSApJTFqHlbRbxSIkvLiFeeAoSqlpSr1JJ1V1j -YsrBV8ofWC3mK5p/UV/M6GwgL0b8YueNi21dlz3Zy/8Z97eBH6zSeLb74xf5P76YT9B2 -KW1e/8enbs/JtLrtKaIVbsj5FadPY4qUw+3DahS4p7O0J7lRaNqP/LkVAAAAFQDywJfU -aYlN9GfOzUQB2NzU0WqrawAAAIA0xHHDxR9201VHQKtCPcCA9pc4YTh34bganheyS+cI -fJxJUCO1jF5tSTNTO3lDp/8hpu4tR2B7eBetzwF62+twpun5dmAzT9WPYIViabLeKfqT -MZmrsXDWxlqS7oA5Ty8trnCgFPa8BwcstPVssDOPu+IvTjxPox+Os495/yce8AAAAIBh -DWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah/XcF3DeRF+eEoz48 -wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+UykSTXYUbtsfTNRFQGBW2 -/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0Cg== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_rsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_rsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_rsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_rsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8semM4q843337 -zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RWRWzjaxSB -6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4QIDAQAB -AoGANmvJzJO5hkLuvyDZHKfAnGTtpifcR1wtSa9DjdKUyn8vhKF0mIimnbnYQEmW -NUUb3gXCZLi9PvkpRSVRrASDOZwcjoU/Kvww163vBUVb2cOZfFhyn6o2Sk88Tt++ -udH3hdjpf9i7jTtUkUe+QYPsia+wgvvrmn4QrahLAH86+kECQQDx5gFeXTME3cnW -WMpFz3PPumduzjqgqMMWEccX4FtQkMX/gyGa5UC7OHFyh0N/gSWvPbRHa8A6YgIt -n8DO+fh5AkEAzbqX4DOn8NY6xJIi42q7l/2jIA0RkB6P7YugW5NblhqBZ0XDnpA5 -sMt+rz+K07u9XZtxgh1xi7mNfwY6lEAMqQJBAJBEauCKmRj35Z6OyeQku59SPsnY -+SJEREVvSNw2lH9SOKQQ4wPsYlTGbvKtNVZgAcen91L5MmYfeckYE/fdIZECQQCt -64zxsTnM1I8iFxj/gP/OYlJBikrKt8udWmjaghzvLMEw+T2DExJyb9ZNeT53+UMB -m6O+B/4xzU/djvp+0hbhAkAemIt+rA5kTmYlFndhpvzkSSM8a2EXsO4XIPgGWCTT -tQKS/tTly0ADMjN/TVy11+9d6zcqadNVuHXHGtR4W0GR ------END RSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_rsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_rsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_rsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE_data/ssh_host_rsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1yc2EAAAADAQABAAAAgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8 -semM4q843337zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RW -RWzjaxSB6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4Q== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_options_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_options_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,1191 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% - --module(ssh_options_SUITE). - -%%% This test suite tests different options for the ssh functions - - --include_lib("common_test/include/ct.hrl"). --include_lib("kernel/include/file.hrl"). - - -%%% Test cases --export([connectfun_disconnectfun_client/1, - disconnectfun_option_client/1, - disconnectfun_option_server/1, - id_string_no_opt_client/1, - id_string_no_opt_server/1, - id_string_own_string_client/1, - id_string_own_string_server/1, - id_string_random_client/1, - id_string_random_server/1, - max_sessions_sftp_start_channel_parallel/1, - max_sessions_sftp_start_channel_sequential/1, - max_sessions_ssh_connect_parallel/1, - max_sessions_ssh_connect_sequential/1, - server_password_option/1, - server_userpassword_option/1, - server_pwdfun_option/1, - server_pwdfun_4_option/1, - server_pwdfun_4_option_repeat/1, - ssh_connect_arg4_timeout/1, - ssh_connect_negtimeout_parallel/1, - ssh_connect_negtimeout_sequential/1, - ssh_connect_nonegtimeout_connected_parallel/1, - ssh_connect_nonegtimeout_connected_sequential/1, - ssh_connect_timeout/1, connect/4, - ssh_daemon_minimal_remote_max_packet_size_option/1, - ssh_msg_debug_fun_option_client/1, - ssh_msg_debug_fun_option_server/1, - system_dir_option/1, - unexpectedfun_option_client/1, - unexpectedfun_option_server/1, - user_dir_option/1, - connectfun_disconnectfun_server/1 - ]). - -%%% Common test callbacks --export([suite/0, all/0, groups/0, - init_per_suite/1, end_per_suite/1, - init_per_group/2, end_per_group/2, - init_per_testcase/2, end_per_testcase/2 - ]). - - --define(NEWLINE, <<"\r\n">>). - -%%-------------------------------------------------------------------- -%% Common Test interface functions ----------------------------------- -%%-------------------------------------------------------------------- - -suite() -> - [{ct_hooks,[ts_install_cth]}]. - -all() -> - [connectfun_disconnectfun_server, - connectfun_disconnectfun_client, - server_password_option, - server_userpassword_option, - server_pwdfun_option, - server_pwdfun_4_option, - server_pwdfun_4_option_repeat, - {group, dir_options}, - ssh_connect_timeout, - ssh_connect_arg4_timeout, - ssh_daemon_minimal_remote_max_packet_size_option, - ssh_msg_debug_fun_option_client, - ssh_msg_debug_fun_option_server, - disconnectfun_option_server, - disconnectfun_option_client, - unexpectedfun_option_server, - unexpectedfun_option_client, - id_string_no_opt_client, - id_string_own_string_client, - id_string_random_client, - id_string_no_opt_server, - id_string_own_string_server, - id_string_random_server, - {group, hardening_tests} - ]. - -groups() -> - [{hardening_tests, [], [ssh_connect_nonegtimeout_connected_parallel, - ssh_connect_nonegtimeout_connected_sequential, - ssh_connect_negtimeout_parallel, - ssh_connect_negtimeout_sequential, - max_sessions_ssh_connect_parallel, - max_sessions_ssh_connect_sequential, - max_sessions_sftp_start_channel_parallel, - max_sessions_sftp_start_channel_sequential - ]}, - {dir_options, [], [user_dir_option, - system_dir_option]} - ]. - - -%%-------------------------------------------------------------------- -init_per_suite(Config) -> - catch crypto:stop(), - case catch crypto:start() of - ok -> - Config; - _Else -> - {skip, "Crypto could not be started!"} - end. -end_per_suite(_Config) -> - ssh:stop(), - crypto:stop(). -%%-------------------------------------------------------------------- -init_per_group(hardening_tests, Config) -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - ssh_test_lib:setup_dsa(DataDir, PrivDir), - Config; -init_per_group(dir_options, Config) -> - PrivDir = ?config(priv_dir, Config), - %% Make unreadable dir: - Dir_unreadable = filename:join(PrivDir, "unread"), - ok = file:make_dir(Dir_unreadable), - {ok,F1} = file:read_file_info(Dir_unreadable), - ok = file:write_file_info(Dir_unreadable, - F1#file_info{mode = F1#file_info.mode band (bnot 8#00444)}), - %% Make readable file: - File_readable = filename:join(PrivDir, "file"), - ok = file:write_file(File_readable, <<>>), - - %% Check: - case {file:read_file_info(Dir_unreadable), - file:read_file_info(File_readable)} of - {{ok, Id=#file_info{type=directory, access=Md}}, - {ok, If=#file_info{type=regular, access=Mf}}} -> - AccessOK = - case {Md, Mf} of - {read, _} -> false; - {read_write, _} -> false; - {_, read} -> true; - {_, read_write} -> true; - _ -> false - end, - - case AccessOK of - true -> - %% Save: - [{unreadable_dir, Dir_unreadable}, - {readable_file, File_readable} - | Config]; - false -> - ct:log("File#file_info : ~p~n" - "Dir#file_info : ~p",[If,Id]), - {skip, "File or dir mode settings failed"} - end; - - NotDirFile -> - ct:log("{Dir,File} -> ~p",[NotDirFile]), - {skip, "File/Dir creation failed"} - end; -init_per_group(_, Config) -> - Config. - -end_per_group(_, Config) -> - Config. -%%-------------------------------------------------------------------- -init_per_testcase(_TestCase, Config) -> - ssh:start(), - Config. - -end_per_testcase(TestCase, Config) when TestCase == server_password_option; - TestCase == server_userpassword_option; - TestCase == server_pwdfun_option; - TestCase == server_pwdfun_4_option -> - UserDir = filename:join(?config(priv_dir, Config), nopubkey), - ssh_test_lib:del_dirs(UserDir), - end_per_testcase(Config); -end_per_testcase(_TestCase, Config) -> - end_per_testcase(Config). - -end_per_testcase(_Config) -> - ssh:stop(), - ok. - -%%-------------------------------------------------------------------- -%% Test Cases -------------------------------------------------------- -%%-------------------------------------------------------------------- -%%-------------------------------------------------------------------- - -%%% validate to server that uses the 'password' option -server_password_option(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}]), - - ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, false}, - {user_dir, UserDir}]), - - Reason = "Unable to connect using the available authentication methods", - - {error, Reason} = - ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "vego"}, - {password, "foo"}, - {user_interaction, false}, - {user_dir, UserDir}]), - - ct:log("Test of wrong password: Error msg: ~p ~n", [Reason]), - - ssh:close(ConnectionRef), - ssh:stop_daemon(Pid). - -%%-------------------------------------------------------------------- - -%%% validate to server that uses the 'password' option -server_userpassword_option(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, PrivDir}, - {user_passwords, [{"vego", "morot"}]}]), - - ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "vego"}, - {password, "morot"}, - {user_interaction, false}, - {user_dir, UserDir}]), - ssh:close(ConnectionRef), - - Reason = "Unable to connect using the available authentication methods", - - {error, Reason} = - ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, false}, - {user_dir, UserDir}]), - {error, Reason} = - ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "vego"}, - {password, "foo"}, - {user_interaction, false}, - {user_dir, UserDir}]), - ssh:stop_daemon(Pid). - -%%-------------------------------------------------------------------- -%%% validate to server that uses the 'pwdfun' option -server_pwdfun_option(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - CHKPWD = fun("foo",Pwd) -> Pwd=="bar"; - (_,_) -> false - end, - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, PrivDir}, - {pwdfun,CHKPWD}]), - ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "bar"}, - {user_interaction, false}, - {user_dir, UserDir}]), - ssh:close(ConnectionRef), - - Reason = "Unable to connect using the available authentication methods", - - {error, Reason} = - ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, false}, - {user_dir, UserDir}]), - {error, Reason} = - ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "vego"}, - {password, "foo"}, - {user_interaction, false}, - {user_dir, UserDir}]), - ssh:stop_daemon(Pid). - - -%%-------------------------------------------------------------------- -%%% validate to server that uses the 'pwdfun/4' option -server_pwdfun_4_option(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - PWDFUN = fun("foo",Pwd,{_,_},undefined) -> Pwd=="bar"; - ("fie",Pwd,{_,_},undefined) -> {Pwd=="bar",new_state}; - ("bandit",_,_,_) -> disconnect; - (_,_,_,_) -> false - end, - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, PrivDir}, - {pwdfun,PWDFUN}]), - ConnectionRef1 = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "bar"}, - {user_interaction, false}, - {user_dir, UserDir}]), - ssh:close(ConnectionRef1), - - ConnectionRef2 = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "fie"}, - {password, "bar"}, - {user_interaction, false}, - {user_dir, UserDir}]), - ssh:close(ConnectionRef2), - - Reason = "Unable to connect using the available authentication methods", - - {error, Reason} = - ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, false}, - {user_dir, UserDir}]), - {error, Reason} = - ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "fie"}, - {password, "morot"}, - {user_interaction, false}, - {user_dir, UserDir}]), - {error, Reason} = - ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "vego"}, - {password, "foo"}, - {user_interaction, false}, - {user_dir, UserDir}]), - - {error, Reason} = - ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "bandit"}, - {password, "pwd breaking"}, - {user_interaction, false}, - {user_dir, UserDir}]), - ssh:stop_daemon(Pid). - - -%%-------------------------------------------------------------------- -server_pwdfun_4_option_repeat(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - %% Test that the state works - Parent = self(), - PWDFUN = fun("foo",P="bar",_,S) -> Parent!{P,S},true; - (_,P,_,S=undefined) -> Parent!{P,S},{false,1}; - (_,P,_,S) -> Parent!{P,S}, {false,S+1} - end, - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, PrivDir}, - {auth_methods,"keyboard-interactive"}, - {pwdfun,PWDFUN}]), - - %% Try with passwords "incorrect", "Bad again" and finally "bar" - KIFFUN = fun(_,_,_) -> - K={k,self()}, - case get(K) of - undefined -> - put(K,1), - ["incorrect"]; - 2 -> - put(K,3), - ["bar"]; - S-> - put(K,S+1), - ["Bad again"] - end - end, - - ConnectionRef2 = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {keyboard_interact_fun, KIFFUN}, - {user_dir, UserDir}]), - ssh:close(ConnectionRef2), - ssh:stop_daemon(Pid), - - lists:foreach(fun(Expect) -> - receive - Expect -> ok; - Other -> ct:fail("Expect: ~p~nReceived ~p",[Expect,Other]) - after - 2000 -> ct:fail("Timeout expecting ~p",[Expect]) - end - end, [{"incorrect",undefined}, - {"Bad again",1}, - {"bar",2}]). - -%%-------------------------------------------------------------------- -system_dir_option(Config) -> - DirUnread = proplists:get_value(unreadable_dir,Config), - FileRead = proplists:get_value(readable_file,Config), - - case ssh_test_lib:daemon([{system_dir, DirUnread}]) of - {error,{eoptions,{{system_dir,DirUnread},eacces}}} -> - ok; - {Pid1,_Host1,Port1} when is_pid(Pid1),is_integer(Port1) -> - ssh:stop_daemon(Pid1), - ct:fail("Didn't detect that dir is unreadable", []) - end, - - case ssh_test_lib:daemon([{system_dir, FileRead}]) of - {error,{eoptions,{{system_dir,FileRead},enotdir}}} -> - ok; - {Pid2,_Host2,Port2} when is_pid(Pid2),is_integer(Port2) -> - ssh:stop_daemon(Pid2), - ct:fail("Didn't detect that option is a plain file", []) - end. - - -user_dir_option(Config) -> - DirUnread = proplists:get_value(unreadable_dir,Config), - FileRead = proplists:get_value(readable_file,Config), - %% Any port will do (beware, implementation knowledge!): - Port = 65535, - - case ssh:connect("localhost", Port, [{user_dir, DirUnread}]) of - {error,{eoptions,{{user_dir,DirUnread},eacces}}} -> - ok; - {error,econnrefused} -> - ct:fail("Didn't detect that dir is unreadable", []) - end, - - case ssh:connect("localhost", Port, [{user_dir, FileRead}]) of - {error,{eoptions,{{user_dir,FileRead},enotdir}}} -> - ok; - {error,econnrefused} -> - ct:fail("Didn't detect that option is a plain file", []) - end. - -%%-------------------------------------------------------------------- -%%% validate client that uses the 'ssh_msg_debug_fun' option -ssh_msg_debug_fun_option_client(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {failfun, fun ssh_test_lib:failfun/2}]), - Parent = self(), - DbgFun = fun(ConnRef,Displ,Msg,Lang) -> Parent ! {msg_dbg,{ConnRef,Displ,Msg,Lang}} end, - - ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_dir, UserDir}, - {user_interaction, false}, - {ssh_msg_debug_fun,DbgFun}]), - %% Beware, implementation knowledge: - gen_fsm:send_all_state_event(ConnectionRef,{ssh_msg_debug,false,<<"Hello">>,<<>>}), - receive - {msg_dbg,X={ConnectionRef,false,<<"Hello">>,<<>>}} -> - ct:log("Got expected dbg msg ~p",[X]), - ssh:stop_daemon(Pid); - {msg_dbg,X={_,false,<<"Hello">>,<<>>}} -> - ct:log("Got dbg msg but bad ConnectionRef (~p expected) ~p",[ConnectionRef,X]), - ssh:stop_daemon(Pid), - {fail, "Bad ConnectionRef received"}; - {msg_dbg,X} -> - ct:log("Got bad dbg msg ~p",[X]), - ssh:stop_daemon(Pid), - {fail,"Bad msg received"} - after 1000 -> - ssh:stop_daemon(Pid), - {fail,timeout} - end. - -%%-------------------------------------------------------------------- -connectfun_disconnectfun_server(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - - Parent = self(), - Ref = make_ref(), - ConnFun = fun(_,_,_) -> Parent ! {connect,Ref} end, - DiscFun = fun(R) -> Parent ! {disconnect,Ref,R} end, - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {failfun, fun ssh_test_lib:failfun/2}, - {disconnectfun, DiscFun}, - {connectfun, ConnFun}]), - ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_dir, UserDir}, - {user_interaction, false}]), - receive - {connect,Ref} -> - ssh:close(ConnectionRef), - receive - {disconnect,Ref,R} -> - ct:log("Disconnect result: ~p",[R]), - ssh:stop_daemon(Pid) - after 2000 -> - {fail, "No disconnectfun action"} - end - after 2000 -> - {fail, "No connectfun action"} - end. - -%%-------------------------------------------------------------------- -connectfun_disconnectfun_client(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - - Parent = self(), - Ref = make_ref(), - DiscFun = fun(R) -> Parent ! {disconnect,Ref,R} end, - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {failfun, fun ssh_test_lib:failfun/2}]), - _ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_dir, UserDir}, - {disconnectfun, DiscFun}, - {user_interaction, false}]), - ssh:stop_daemon(Pid), - receive - {disconnect,Ref,R} -> - ct:log("Disconnect result: ~p",[R]) - after 2000 -> - {fail, "No disconnectfun action"} - end. - -%%-------------------------------------------------------------------- -%%% validate client that uses the 'ssh_msg_debug_fun' option -ssh_msg_debug_fun_option_server(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - - Parent = self(), - DbgFun = fun(ConnRef,Displ,Msg,Lang) -> Parent ! {msg_dbg,{ConnRef,Displ,Msg,Lang}} end, - ConnFun = fun(_,_,_) -> Parent ! {connection_pid,self()} end, - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {failfun, fun ssh_test_lib:failfun/2}, - {connectfun, ConnFun}, - {ssh_msg_debug_fun, DbgFun}]), - _ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_dir, UserDir}, - {user_interaction, false}]), - receive - {connection_pid,Server} -> - %% Beware, implementation knowledge: - gen_fsm:send_all_state_event(Server,{ssh_msg_debug,false,<<"Hello">>,<<>>}), - receive - {msg_dbg,X={_,false,<<"Hello">>,<<>>}} -> - ct:log("Got expected dbg msg ~p",[X]), - ssh:stop_daemon(Pid); - {msg_dbg,X} -> - ct:log("Got bad dbg msg ~p",[X]), - ssh:stop_daemon(Pid), - {fail,"Bad msg received"} - after 3000 -> - ssh:stop_daemon(Pid), - {fail,timeout2} - end - after 3000 -> - ssh:stop_daemon(Pid), - {fail,timeout1} - end. - -%%-------------------------------------------------------------------- -disconnectfun_option_server(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - - Parent = self(), - DisConnFun = fun(Reason) -> Parent ! {disconnect,Reason} end, - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {failfun, fun ssh_test_lib:failfun/2}, - {disconnectfun, DisConnFun}]), - ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_dir, UserDir}, - {user_interaction, false}]), - ssh:close(ConnectionRef), - receive - {disconnect,Reason} -> - ct:log("Server detected disconnect: ~p",[Reason]), - ssh:stop_daemon(Pid), - ok - after 3000 -> - receive - X -> ct:log("received ~p",[X]) - after 0 -> ok - end, - {fail,"Timeout waiting for disconnect"} - end. - -%%-------------------------------------------------------------------- -disconnectfun_option_client(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - - Parent = self(), - DisConnFun = fun(Reason) -> Parent ! {disconnect,Reason} end, - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {failfun, fun ssh_test_lib:failfun/2}]), - _ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_dir, UserDir}, - {user_interaction, false}, - {disconnectfun, DisConnFun}]), - ssh:stop_daemon(Pid), - receive - {disconnect,Reason} -> - ct:log("Client detected disconnect: ~p",[Reason]), - ok - after 3000 -> - receive - X -> ct:log("received ~p",[X]) - after 0 -> ok - end, - {fail,"Timeout waiting for disconnect"} - end. - -%%-------------------------------------------------------------------- -unexpectedfun_option_server(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - - Parent = self(), - ConnFun = fun(_,_,_) -> Parent ! {connection_pid,self()} end, - UnexpFun = fun(Msg,Peer) -> - Parent ! {unexpected,Msg,Peer,self()}, - skip - end, - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {failfun, fun ssh_test_lib:failfun/2}, - {connectfun, ConnFun}, - {unexpectedfun, UnexpFun}]), - _ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_dir, UserDir}, - {user_interaction, false}]), - receive - {connection_pid,Server} -> - %% Beware, implementation knowledge: - Server ! unexpected_message, - receive - {unexpected, unexpected_message, {{_,_,_,_},_}, _} -> ok; - {unexpected, unexpected_message, Peer, _} -> ct:fail("Bad peer ~p",[Peer]); - M = {unexpected, _, _, _} -> ct:fail("Bad msg ~p",[M]) - after 3000 -> - ssh:stop_daemon(Pid), - {fail,timeout2} - end - after 3000 -> - ssh:stop_daemon(Pid), - {fail,timeout1} - end. - -%%-------------------------------------------------------------------- -unexpectedfun_option_client(Config) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - SysDir = ?config(data_dir, Config), - - Parent = self(), - UnexpFun = fun(Msg,Peer) -> - Parent ! {unexpected,Msg,Peer,self()}, - skip - end, - - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir}, - {user_dir, UserDir}, - {password, "morot"}, - {failfun, fun ssh_test_lib:failfun/2}]), - ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_dir, UserDir}, - {user_interaction, false}, - {unexpectedfun, UnexpFun}]), - %% Beware, implementation knowledge: - ConnectionRef ! unexpected_message, - - receive - {unexpected, unexpected_message, {{_,_,_,_},_}, ConnectionRef} -> - ok; - {unexpected, unexpected_message, Peer, ConnectionRef} -> - ct:fail("Bad peer ~p",[Peer]); - M = {unexpected, _, _, _} -> - ct:fail("Bad msg ~p",[M]) - after 3000 -> - ssh:stop_daemon(Pid), - {fail,timeout} - end. - -%%-------------------------------------------------------------------- -%%% Test connect_timeout option in ssh:connect/4 -ssh_connect_timeout(_Config) -> - ConnTimeout = 2000, - {error,{faked_transport,connect,TimeoutToTransport}} = - ssh:connect("localhost", 12345, - [{transport,{tcp,?MODULE,tcp_closed}}, - {connect_timeout,ConnTimeout}], - 1000), - case TimeoutToTransport of - ConnTimeout -> ok; - Other -> - ct:log("connect_timeout is ~p but transport received ~p",[ConnTimeout,Other]), - {fail,"ssh:connect/4 wrong connect_timeout received in transport"} - end. - -%% Plugin function for the test above -connect(_Host, _Port, _Opts, Timeout) -> - {error, {faked_transport,connect,Timeout}}. - -%%-------------------------------------------------------------------- -%%% Test fourth argument in ssh:connect/4 -ssh_connect_arg4_timeout(_Config) -> - Timeout = 1000, - Parent = self(), - %% start the server - Server = spawn(fun() -> - {ok,Sl} = gen_tcp:listen(0,[]), - {ok,{_,Port}} = inet:sockname(Sl), - Parent ! {port,self(),Port}, - Rsa = gen_tcp:accept(Sl), - ct:log("Server gen_tcp:accept got ~p",[Rsa]), - receive after 2*Timeout -> ok end %% let client timeout first - end), - - %% Get listening port - Port = receive - {port,Server,ServerPort} -> ServerPort - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end, - - %% try to connect with a timeout, but "supervise" it - Client = spawn(fun() -> - T0 = erlang:monotonic_time(), - Rc = ssh:connect("localhost",Port,[],Timeout), - ct:log("Client ssh:connect got ~p",[Rc]), - Parent ! {done,self(),Rc,T0} - end), - - %% Wait for client reaction on the connection try: - receive - {done, Client, {error,timeout}, T0} -> - Msp = ms_passed(T0), - exit(Server,hasta_la_vista___baby), - Low = 0.9*Timeout, - High = 2.5*Timeout, - ct:log("Timeout limits: ~.4f - ~.4f ms, timeout " - "was ~.4f ms, expected ~p ms",[Low,High,Msp,Timeout]), - if - Low ok; - true -> {fail, "timeout not within limits"} - end; - - {done, Client, {error,Other}, _T0} -> - ct:log("Error message \"~p\" from the client is unexpected.",[{error,Other}]), - {fail, "Unexpected error message"}; - - {done, Client, {ok,_Ref}, _T0} -> - {fail,"ssh-connected ???"} - after - 5000 -> - exit(Server,hasta_la_vista___baby), - exit(Client,hasta_la_vista___baby), - {fail, "Didn't timeout"} - end. - -%% Help function, elapsed milliseconds since T0 -ms_passed(T0) -> - %% OTP 18 - erlang:convert_time_unit(erlang:monotonic_time() - T0, - native, - micro_seconds) / 1000. - -%%-------------------------------------------------------------------- -ssh_daemon_minimal_remote_max_packet_size_option(Config) -> - SystemDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - - {Server, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, - {user_dir, UserDir}, - {user_passwords, [{"vego", "morot"}]}, - {failfun, fun ssh_test_lib:failfun/2}, - {minimal_remote_max_packet_size, 14}]), - Conn = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user_dir, UserDir}, - {user_interaction, false}, - {user, "vego"}, - {password, "morot"}]), - - %% Try the limits of the minimal_remote_max_packet_size: - {ok, _ChannelId} = ssh_connection:session_channel(Conn, 100, 14, infinity), - {open_error,_,"Maximum packet size below 14 not supported",_} = - ssh_connection:session_channel(Conn, 100, 13, infinity), - - ssh:close(Conn), - ssh:stop_daemon(Server). - -%%-------------------------------------------------------------------- -%% This test try every algorithm by connecting to an Erlang server -id_string_no_opt_client(Config) -> - {Server, _Host, Port} = fake_daemon(Config), - {error,_} = ssh:connect("localhost", Port, [], 1000), - receive - {id,Server,"SSH-2.0-Erlang/"++Vsn} -> - true = expected_ssh_vsn(Vsn); - {id,Server,Other} -> - ct:fail("Unexpected id: ~s.",[Other]) - after 5000 -> - {fail,timeout} - end. - -%%-------------------------------------------------------------------- -id_string_own_string_client(Config) -> - {Server, _Host, Port} = fake_daemon(Config), - {error,_} = ssh:connect("localhost", Port, [{id_string,"Pelle"}], 1000), - receive - {id,Server,"SSH-2.0-Pelle\r\n"} -> - ok; - {id,Server,Other} -> - ct:fail("Unexpected id: ~s.",[Other]) - after 5000 -> - {fail,timeout} - end. - -%%-------------------------------------------------------------------- -id_string_random_client(Config) -> - {Server, _Host, Port} = fake_daemon(Config), - {error,_} = ssh:connect("localhost", Port, [{id_string,random}], 1000), - receive - {id,Server,Id="SSH-2.0-Erlang"++_} -> - ct:fail("Unexpected id: ~s.",[Id]); - {id,Server,Rnd="SSH-2.0-"++_} -> - ct:log("Got correct ~s",[Rnd]); - {id,Server,Id} -> - ct:fail("Unexpected id: ~s.",[Id]) - after 5000 -> - {fail,timeout} - end. - -%%-------------------------------------------------------------------- -id_string_no_opt_server(Config) -> - {_Server, Host, Port} = ssh_test_lib:std_daemon(Config, []), - {ok,S1}=gen_tcp:connect(Host,Port,[{active,false},{packet,line}]), - {ok,"SSH-2.0-Erlang/"++Vsn} = gen_tcp:recv(S1, 0, 2000), - true = expected_ssh_vsn(Vsn). - -%%-------------------------------------------------------------------- -id_string_own_string_server(Config) -> - {_Server, Host, Port} = ssh_test_lib:std_daemon(Config, [{id_string,"Olle"}]), - {ok,S1}=gen_tcp:connect(Host,Port,[{active,false},{packet,line}]), - {ok,"SSH-2.0-Olle\r\n"} = gen_tcp:recv(S1, 0, 2000). - -%%-------------------------------------------------------------------- -id_string_random_server(Config) -> - {_Server, Host, Port} = ssh_test_lib:std_daemon(Config, [{id_string,random}]), - {ok,S1}=gen_tcp:connect(Host,Port,[{active,false},{packet,line}]), - {ok,"SSH-2.0-"++Rnd} = gen_tcp:recv(S1, 0, 2000), - case Rnd of - "Erlang"++_ -> ct:log("Id=~p",[Rnd]), - {fail,got_default_id}; - "Olle\r\n" -> {fail,got_previous_tests_value}; - _ -> ct:log("Got ~s.",[Rnd]) - end. - -%%-------------------------------------------------------------------- -ssh_connect_negtimeout_parallel(Config) -> ssh_connect_negtimeout(Config,true). -ssh_connect_negtimeout_sequential(Config) -> ssh_connect_negtimeout(Config,false). - -ssh_connect_negtimeout(Config, Parallel) -> - process_flag(trap_exit, true), - SystemDir = filename:join(?config(priv_dir, Config), system), - UserDir = ?config(priv_dir, Config), - NegTimeOut = 2000, % ms - ct:log("Parallel: ~p",[Parallel]), - - {_Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},{user_dir, UserDir}, - {parallel_login, Parallel}, - {negotiation_timeout, NegTimeOut}, - {failfun, fun ssh_test_lib:failfun/2}]), - - {ok,Socket} = gen_tcp:connect(Host, Port, []), - - Factor = 2, - ct:log("And now sleeping ~p*NegTimeOut (~p ms)...", [Factor, round(Factor * NegTimeOut)]), - ct:sleep(round(Factor * NegTimeOut)), - - case inet:sockname(Socket) of - {ok,_} -> ct:fail("Socket not closed"); - {error,_} -> ok - end. - -%%-------------------------------------------------------------------- -%%% Test that ssh connection does not timeout if the connection is established (parallel) -ssh_connect_nonegtimeout_connected_parallel(Config) -> - ssh_connect_nonegtimeout_connected(Config, true). - -%%% Test that ssh connection does not timeout if the connection is established (non-parallel) -ssh_connect_nonegtimeout_connected_sequential(Config) -> - ssh_connect_nonegtimeout_connected(Config, false). - - -ssh_connect_nonegtimeout_connected(Config, Parallel) -> - process_flag(trap_exit, true), - SystemDir = filename:join(?config(priv_dir, Config), system), - UserDir = ?config(priv_dir, Config), - NegTimeOut = 20000, % ms - ct:log("Parallel: ~p",[Parallel]), - - {_Pid, _Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},{user_dir, UserDir}, - {parallel_login, Parallel}, - {negotiation_timeout, NegTimeOut}, - {failfun, fun ssh_test_lib:failfun/2}]), - ct:log("~p Listen ~p:~p",[_Pid,_Host,Port]), - ct:sleep(500), - - IO = ssh_test_lib:start_io_server(), - Shell = ssh_test_lib:start_shell(Port, IO, UserDir), - receive - Error = {'EXIT', _, _} -> - ct:log("~p",[Error]), - ct:fail(no_ssh_connection); - ErlShellStart -> - ct:log("---Erlang shell start: ~p~n", [ErlShellStart]), - one_shell_op(IO, NegTimeOut), - one_shell_op(IO, NegTimeOut), - - Factor = 2, - ct:log("And now sleeping ~p*NegTimeOut (~p ms)...", [Factor, round(Factor * NegTimeOut)]), - ct:sleep(round(Factor * NegTimeOut)), - - one_shell_op(IO, NegTimeOut) - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end, - exit(Shell, kill). - - -one_shell_op(IO, TimeOut) -> - ct:log("One shell op: Waiting for prompter"), - receive - ErlPrompt0 -> ct:log("Erlang prompt: ~p~n", [ErlPrompt0]) - after TimeOut -> ct:fail("Timeout waiting for promter") - end, - - IO ! {input, self(), "2*3*7.\r\n"}, - receive - Echo0 -> ct:log("Echo: ~p ~n", [Echo0]) - after TimeOut -> ct:fail("Timeout waiting for echo") - end, - - receive - ?NEWLINE -> ct:log("NEWLINE received", []) - after TimeOut -> - receive Any1 -> ct:log("Bad NEWLINE: ~p",[Any1]) - after 0 -> ct:fail("Timeout waiting for NEWLINE") - end - end, - - receive - Result0 -> ct:log("Result: ~p~n", [Result0]) - after TimeOut -> ct:fail("Timeout waiting for result") - end. - -%%-------------------------------------------------------------------- -max_sessions_ssh_connect_parallel(Config) -> - max_sessions(Config, true, connect_fun(ssh__connect,Config)). -max_sessions_ssh_connect_sequential(Config) -> - max_sessions(Config, false, connect_fun(ssh__connect,Config)). - -max_sessions_sftp_start_channel_parallel(Config) -> - max_sessions(Config, true, connect_fun(ssh_sftp__start_channel, Config)). -max_sessions_sftp_start_channel_sequential(Config) -> - max_sessions(Config, false, connect_fun(ssh_sftp__start_channel, Config)). - - -%%%---- helpers: -connect_fun(ssh__connect, Config) -> - fun(Host,Port) -> - ssh_test_lib:connect(Host, Port, - [{silently_accept_hosts, true}, - {user_dir, ?config(priv_dir,Config)}, - {user_interaction, false}, - {user, "carni"}, - {password, "meat"} - ]) - %% ssh_test_lib returns R when ssh:connect returns {ok,R} - end; -connect_fun(ssh_sftp__start_channel, _Config) -> - fun(Host,Port) -> - {ok,_Pid,ConnRef} = - ssh_sftp:start_channel(Host, Port, - [{silently_accept_hosts, true}, - {user, "carni"}, - {password, "meat"} - ]), - ConnRef - end. - - -max_sessions(Config, ParallelLogin, Connect0) when is_function(Connect0,2) -> - Connect = fun(Host,Port) -> - R = Connect0(Host,Port), - ct:log("Connect(~p,~p) -> ~p",[Host,Port,R]), - R - end, - SystemDir = filename:join(?config(priv_dir, Config), system), - UserDir = ?config(priv_dir, Config), - MaxSessions = 5, - {Pid, Host, Port} = ssh_test_lib:daemon([ - {system_dir, SystemDir}, - {user_dir, UserDir}, - {user_passwords, [{"carni", "meat"}]}, - {parallel_login, ParallelLogin}, - {max_sessions, MaxSessions} - ]), - ct:log("~p Listen ~p:~p for max ~p sessions",[Pid,Host,Port,MaxSessions]), - try [Connect(Host,Port) || _ <- lists:seq(1,MaxSessions)] - of - Connections -> - %% Step 1 ok: could set up max_sessions connections - ct:log("Connections up: ~p",[Connections]), - [_|_] = Connections, - - %% Now try one more than alowed: - ct:log("Info Report might come here...",[]), - try Connect(Host,Port) - of - _ConnectionRef1 -> - ssh:stop_daemon(Pid), - {fail,"Too many connections accepted"} - catch - error:{badmatch,{error,"Connection closed"}} -> - %% Step 2 ok: could not set up max_sessions+1 connections - %% This is expected - %% Now stop one connection and try to open one more - ok = ssh:close(hd(Connections)), - receive after 250 -> ok end, % sleep so the supervisor has time to count down. Not nice... - try Connect(Host,Port) - of - _ConnectionRef1 -> - %% Step 3 ok: could set up one more connection after killing one - %% Thats good. - ssh:stop_daemon(Pid), - ok - catch - error:{badmatch,{error,"Connection closed"}} -> - %% Bad indeed. Could not set up one more connection even after killing - %% one existing. Very bad. - ssh:stop_daemon(Pid), - {fail,"Does not decrease # active sessions"} - end - end - catch - error:{badmatch,{error,"Connection closed"}} -> - ssh:stop_daemon(Pid), - {fail,"Too few connections accepted"} - end. - -%%-------------------------------------------------------------------- -%% Internal functions ------------------------------------------------ -%%-------------------------------------------------------------------- - -expected_ssh_vsn(Str) -> - try - {ok,L} = application:get_all_key(ssh), - proplists:get_value(vsn,L,"")++"\r\n" - of - Str -> true; - "\r\n" -> true; - _ -> false - catch - _:_ -> true %% ssh not started so we dont't know - end. - - -fake_daemon(_Config) -> - Parent = self(), - %% start the server - Server = spawn(fun() -> - {ok,Sl} = gen_tcp:listen(0,[{packet,line}]), - {ok,{Host,Port}} = inet:sockname(Sl), - ct:log("fake_daemon listening on ~p:~p~n",[Host,Port]), - Parent ! {sockname,self(),Host,Port}, - Rsa = gen_tcp:accept(Sl), - ct:log("Server gen_tcp:accept got ~p",[Rsa]), - {ok,S} = Rsa, - receive - {tcp, S, Id} -> Parent ! {id,self(),Id} - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end - end), - %% Get listening host and port - receive - {sockname,Server,ServerHost,ServerPort} -> {Server, ServerHost, ServerPort} - after - 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_peername_sockname_server.erl erlang-17.3-dfsg/lib/ssh/test/ssh_peername_sockname_server.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_peername_sockname_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_peername_sockname_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_property_test_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_property_test_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_property_test_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_property_test_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/dh_group_test erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/dh_group_test --- erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/dh_group_test 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/dh_group_test 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -{2222, 5, 61}. -{1111, 7, 91}. - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/dh_group_test.moduli erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/dh_group_test.moduli --- erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/dh_group_test.moduli 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/dh_group_test.moduli 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -20151021104105 2 6 100 2222 5 B7 -20151021104106 2 6 100 1111 5 4F - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/id_dsa erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/id_dsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/id_dsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/id_dsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBvAIBAAKBgQDfi2flSTZZofwT4yQT0NikX/LGNT7UPeB/XEWe/xovEYCElfaQ -APFixXvEgXwoojmZ5kiQRKzLM39wBP0jPERLbnZXfOOD0PDnw0haMh7dD7XKVMod -/EigVgHf/qBdM2M8yz1s/rRF7n1UpLSypziKjkzCm7JoSQ2zbWIPdmBIXwIVAMgP -kpr7Sq3O7sHdb8D601DRjoExAoGAMOQxDfB2Fd8ouz6G96f/UOzRMI/Kdv8kYYKW -JIGY+pRYrLPyYzUeJznwZreOJgrczAX+luHnKFWJ2Dnk5CyeXk67Wsr7pJ/4MBMD -OKeIS0S8qoSBN8+Krp79fgA+yS3IfqbkJLtLu4EBaCX4mKQIX4++k44d4U5lc8pt -+9hlEI8CgYEAznKxx9kyC6bVo7LUYKaGhofRFt0SYFc5PVmT2VUGRs1R6+6DPD+e -uEO6IhFct7JFSRbP9p0JD4Uk+3zlZF+XX6b2PsZkeV8f/02xlNGUSmEzCSiNg1AX -Cy/WusYhul0MncWCHMcOZB5rIvU/aP5EJJtn3xrRaz6u0SThF6AnT34CFQC63czE -ZU8w8Q+H7z0j+a+70x2iAw== ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/id_rsa erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/id_rsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/id_rsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/id_rsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQD1OET+3O/Bvj/dtjxDTXmj1oiJt4sIph5kGy0RfjoPrZfaS+CU -DhakCmS6t2ivxWFgtpKWaoGMZMJqWj6F6ZsumyFl3FPBtujwY/35cgifrI9Ns4Tl -zR1uuengNBmV+WRQ5cd9F2qS6Z8aDQihzt0r8JUqLcK+VQbrmNzboCCQQwIDAQAB -AoGAPQEyqPTt8JUT7mRXuaacjFXiweAXhp9NEDpyi9eLOjtFe9lElZCrsUOkq47V -TGUeRKEm9qSodfTbKPoqc8YaBJGJPhUaTAcha+7QcDdfHBvIsgxvU7ePVnlpXRp3 -CCUEMPhlnx6xBoTYP+fRU0e3+xJIPVyVCqX1jAdUMkzfRoECQQD6ux7B1QJAIWyK -SGkbDUbBilNmzCFNgIpOP6PA+bwfi5d16diTpra5AX09keQABAo/KaP1PdV8Vg0p -z4P3A7G3AkEA+l+AKG6m0kQTTBMJDqOdVPYwe+5GxunMaqmhokpEbuGsrZBl5Dvd -WpcBjR7jmenrhKZRIuA+Fz5HPo/UQJPl1QJBAKxstDkeED8j/S2XoFhPKAJ+6t39 -sUVICVTIZQeXdmzHJXCcUSkw8+WEhakqw/3SyW0oaK2FSWQJFWJUZ+8eJj8CQEh3 -xeduB5kKnS9CvzdeghZqX6QvVosSdtlUmfUYW/BgH5PpHKTP8wTaeld3XldZTpMJ -dKiMkUw2+XYROVUrubUCQD+Na1LhULlpn4ISEtIEfqpdlUhxDgO15Wg8USmsng+x -ICliVOSQtwaZjm8kwaFt0W7XnpnDxbRs37vIEbIMWak= ------END RSA PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_dsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_dsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_dsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_dsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQCClaHzE2ul0gKSUxah5W0W8UiJLy4hXngKEqpaUq9SSdVdY2LK -wVfKH1gt5iuaf1FfzOhsIC9G/GLnjYttXZc92cv/Gfe3gR+s0ni2++MX+T++mE/Q -diltXv/Hp27PybS67SmiFW7I+RWnT2OKlMPtw2oUuKeztCe5UWjaj/y5FQIVAPLA -l9RpiU30Z87NRAHY3NTRaqtrAoGANMRxw8UfdtNVR0CrQj3AgPaXOGE4d+G4Gp4X -skvnCHycSVAjtYxebUkzUzt5Q6f/IabuLUdge3gXrc8BetvrcKbp+XZgM0/Vj2CF -Ymmy3in6kzGZq7Fw1sZaku6AOU8vLa5woBT2vAcHLLT1bLAzj7viL048T6MfjrOP -ef8nHvACgYBhDWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah -/XcF3DeRF+eEoz48wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+U -ykSTXYUbtsfTNRFQGBW2/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0CgIVAN4wtL5W -Lv62jKcdskxNyz2NQoBx ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_dsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_dsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_dsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_dsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1kc3MAAACBAIKVofMTa6XSApJTFqHlbRbxSIkvLiFeeAoSqlpSr1JJ1V1j -YsrBV8ofWC3mK5p/UV/M6GwgL0b8YueNi21dlz3Zy/8Z97eBH6zSeLb74xf5P76YT9B2 -KW1e/8enbs/JtLrtKaIVbsj5FadPY4qUw+3DahS4p7O0J7lRaNqP/LkVAAAAFQDywJfU -aYlN9GfOzUQB2NzU0WqrawAAAIA0xHHDxR9201VHQKtCPcCA9pc4YTh34bganheyS+cI -fJxJUCO1jF5tSTNTO3lDp/8hpu4tR2B7eBetzwF62+twpun5dmAzT9WPYIViabLeKfqT -MZmrsXDWxlqS7oA5Ty8trnCgFPa8BwcstPVssDOPu+IvTjxPox+Os495/yce8AAAAIBh -DWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah/XcF3DeRF+eEoz48 -wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+UykSTXYUbtsfTNRFQGBW2 -/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0Cg== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_rsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_rsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_rsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_rsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8semM4q843337 -zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RWRWzjaxSB -6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4QIDAQAB -AoGANmvJzJO5hkLuvyDZHKfAnGTtpifcR1wtSa9DjdKUyn8vhKF0mIimnbnYQEmW -NUUb3gXCZLi9PvkpRSVRrASDOZwcjoU/Kvww163vBUVb2cOZfFhyn6o2Sk88Tt++ -udH3hdjpf9i7jTtUkUe+QYPsia+wgvvrmn4QrahLAH86+kECQQDx5gFeXTME3cnW -WMpFz3PPumduzjqgqMMWEccX4FtQkMX/gyGa5UC7OHFyh0N/gSWvPbRHa8A6YgIt -n8DO+fh5AkEAzbqX4DOn8NY6xJIi42q7l/2jIA0RkB6P7YugW5NblhqBZ0XDnpA5 -sMt+rz+K07u9XZtxgh1xi7mNfwY6lEAMqQJBAJBEauCKmRj35Z6OyeQku59SPsnY -+SJEREVvSNw2lH9SOKQQ4wPsYlTGbvKtNVZgAcen91L5MmYfeckYE/fdIZECQQCt -64zxsTnM1I8iFxj/gP/OYlJBikrKt8udWmjaghzvLMEw+T2DExJyb9ZNeT53+UMB -m6O+B/4xzU/djvp+0hbhAkAemIt+rA5kTmYlFndhpvzkSSM8a2EXsO4XIPgGWCTT -tQKS/tTly0ADMjN/TVy11+9d6zcqadNVuHXHGtR4W0GR ------END RSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_rsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_rsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_rsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE_data/ssh_host_rsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1yc2EAAAADAQABAAAAgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8 -semM4q843337zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RW -RWzjaxSB6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4Q== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_protocol_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_protocol_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,646 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% - -%% - --module(ssh_protocol_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("kernel/include/inet.hrl"). --include_lib("ssh/src/ssh.hrl"). % ?UINT32, ?BYTE, #ssh{} ... --include_lib("ssh/src/ssh_transport.hrl"). --include_lib("ssh/src/ssh_auth.hrl"). - -%% Note: This directive should only be used in test suites. --compile(export_all). - --define(NEWLINE, <<"\r\n">>). --define(REKEY_DATA_TMO, 65000). - --define(v(Key, Config), proplists:get_value(Key, Config)). --define(v(Key, Config, Default), proplists:get_value(Key, Config, Default)). - - -%%-------------------------------------------------------------------- -%% Common Test interface functions ----------------------------------- -%%-------------------------------------------------------------------- - -suite() -> - [{ct_hooks,[ts_install_cth]}]. - -all() -> - [{group,tool_tests}, - {group,kex}, - {group,service_requests}, - {group,packet_size_error}, - {group,field_size_error} - ]. - -groups() -> - [{tool_tests, [], [lib_works_as_client, - lib_works_as_server, - lib_match, - lib_no_match - ]}, - {packet_size_error, [], [packet_length_too_large, - packet_length_too_short]}, - - {field_size_error, [], [service_name_length_too_large, - service_name_length_too_short]}, - - {kex, [], [no_common_alg_server_disconnects, - no_common_alg_client_disconnects, - gex_client_init_option_groups, - gex_server_gex_limit, - gex_client_init_option_groups_moduli_file, - gex_client_init_option_groups_file, - gex_client_old_request_exact, - gex_client_old_request_noexact - ]}, - {service_requests, [], [bad_service_name, - bad_long_service_name, - bad_very_long_service_name, - empty_service_name, - bad_service_name_then_correct - ]} - ]. - - -init_per_suite(Config) -> - start_std_daemon( setup_dirs( start_apps(Config))). - -end_per_suite(Config) -> - stop_apps(Config). - - - -init_per_testcase(no_common_alg_server_disconnects, Config) -> - start_std_daemon(Config, [{preferred_algorithms,[{public_key,['ssh-rsa']}]}]); - -init_per_testcase(TC, Config) when TC == gex_client_init_option_groups ; - TC == gex_client_init_option_groups_moduli_file ; - TC == gex_client_init_option_groups_file ; - TC == gex_server_gex_limit ; - TC == gex_client_old_request_exact ; - TC == gex_client_old_request_noexact -> - Opts = case TC of - gex_client_init_option_groups -> - [{dh_gex_groups, [{2345, 3, 41}]}]; - gex_client_init_option_groups_file -> - DataDir = ?config(data_dir, Config), - F = filename:join(DataDir, "dh_group_test"), - [{dh_gex_groups, {file,F}}]; - gex_client_init_option_groups_moduli_file -> - DataDir = ?config(data_dir, Config), - F = filename:join(DataDir, "dh_group_test.moduli"), - [{dh_gex_groups, {ssh_moduli_file,F}}]; - _ when TC == gex_server_gex_limit ; - TC == gex_client_old_request_exact ; - TC == gex_client_old_request_noexact -> - [{dh_gex_groups, [{ 500, 3, 17}, - {1000, 7, 91}, - {3000, 5, 61}]}, - {dh_gex_limits,{500,1500}} - ]; - _ -> - [] - end, - start_std_daemon(Config, - [{preferred_algorithms, ssh:default_algorithms()} - | Opts]); -init_per_testcase(_TestCase, Config) -> - check_std_daemon_works(Config, ?LINE). - -end_per_testcase(no_common_alg_server_disconnects, Config) -> - stop_std_daemon(Config); -end_per_testcase(TC, Config) when TC == gex_client_init_option_groups ; - TC == gex_client_init_option_groups_moduli_file ; - TC == gex_client_init_option_groups_file ; - TC == gex_server_gex_limit ; - TC == gex_client_old_request_exact ; - TC == gex_client_old_request_noexact -> - stop_std_daemon(Config); -end_per_testcase(_TestCase, Config) -> - check_std_daemon_works(Config, ?LINE). - -%%%-------------------------------------------------------------------- -%%% Test Cases -------------------------------------------------------- -%%%-------------------------------------------------------------------- - -%%%-------------------------------------------------------------------- -%%% Connect to an erlang server and check that the testlib acts as a client. -lib_works_as_client(Config) -> - %% Connect and negotiate keys - {ok,InitialState} = ssh_trpt_test_lib:exec( - [{set_options, [print_ops, print_seqnums, print_messages]}] - ), - {ok,AfterKexState} = connect_and_kex(Config, InitialState), - - %% Do the authentcation - {User,Pwd} = server_user_password(Config), - {ok,EndState} = - ssh_trpt_test_lib:exec( - [{send, #ssh_msg_service_request{name = "ssh-userauth"}}, - {match, #ssh_msg_service_accept{name = "ssh-userauth"}, receive_msg}, - {send, #ssh_msg_userauth_request{user = User, - service = "ssh-connection", - method = "password", - data = <> - }}, - {match, #ssh_msg_userauth_success{_='_'}, receive_msg} - ], AfterKexState), - - %% Disconnect - {ok,_} = - ssh_trpt_test_lib:exec( - [{send, #ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION, - description = "End of the fun", - language = "" - }}, - close_socket - ], EndState). - - -%%-------------------------------------------------------------------- -%%% Connect an erlang client and check that the testlib can act as a server. -lib_works_as_server(Config) -> - {User,_Pwd} = server_user_password(Config), - - %% Create a listening socket as server socket: - {ok,InitialState} = ssh_trpt_test_lib:exec(listen), - HostPort = ssh_trpt_test_lib:server_host_port(InitialState), - - %% Start a process handling one connection on the server side: - spawn_link( - fun() -> - {ok,_} = - ssh_trpt_test_lib:exec( - [{set_options, [print_ops, print_messages]}, - {accept, [{system_dir, system_dir(Config)}, - {user_dir, user_dir(Config)}]}, - receive_hello, - {send, hello}, - - {send, ssh_msg_kexinit}, - {match, #ssh_msg_kexinit{_='_'}, receive_msg}, - - {match, #ssh_msg_kexdh_init{_='_'}, receive_msg}, - {send, ssh_msg_kexdh_reply}, - - {send, #ssh_msg_newkeys{}}, - {match, #ssh_msg_newkeys{_='_'}, receive_msg}, - - {match, #ssh_msg_service_request{name="ssh-userauth"}, receive_msg}, - {send, #ssh_msg_service_accept{name="ssh-userauth"}}, - - {match, #ssh_msg_userauth_request{service="ssh-connection", - method="none", - user=User, - _='_'}, receive_msg}, - - {send, #ssh_msg_userauth_failure{authentications = "password", - partial_success = false}}, - - {match, #ssh_msg_userauth_request{service="ssh-connection", - method="password", - user=User, - _='_'}, receive_msg}, - {send, #ssh_msg_userauth_success{}}, - close_socket, - print_state - ], - InitialState) - end), - - %% and finally connect to it with a regular Erlang SSH client: - {ok,_} = std_connect(HostPort, Config, - [{preferred_algorithms,[{kex,['diffie-hellman-group1-sha1']}]}] - ). - -%%-------------------------------------------------------------------- -%%% Matching -lib_match(_Config) -> - {ok,_} = - ssh_trpt_test_lib:exec([{set_options, [print_ops]}, - {match, abc, abc}, - {match, '$a', {cde,fgh}}, - {match, {cde,fgh}, '$a'}, - {match, '_', {cde,fgh}}, - {match, [a,'$a',b], [a,{cde,fgh},b]}, - {match, [a,'$a'|'$b'], [a,{cde,fgh},b,c]}, - {match, '$b', [b,c]} - ]). - -%%-------------------------------------------------------------------- -%%% Not matching -lib_no_match(_Config) -> - case ssh_trpt_test_lib:exec([{set_options, [print_ops]}, - {match, '$x', b}, - {match, a, '$x'}]) - of - {ok,_} -> {fail,"Unexpected match"}; - {error, {_Op,{expected,a,b},_State}} -> ok - end. - -%%-------------------------------------------------------------------- -%%% Algo negotiation fail. This should result in a ssh_msg_disconnect -%%% being sent from the server. -no_common_alg_server_disconnects(Config) -> - {ok,_} = - ssh_trpt_test_lib:exec( - [{set_options, [print_ops, {print_messages,detail}]}, - {connect, - server_host(Config),server_port(Config), - [{silently_accept_hosts, true}, - {user_dir, user_dir(Config)}, - {user_interaction, false}, - {preferred_algorithms,[{public_key,['ssh-dss']}]} - ]}, - receive_hello, - {send, hello}, - {match, #ssh_msg_kexinit{_='_'}, receive_msg}, - {send, ssh_msg_kexinit}, % with server unsupported 'ssh-dss' ! - {match, - {'or',[#ssh_msg_disconnect{code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, _='_'}, - tcp_closed, - {tcp_error,econnaborted} - ]}, - receive_msg} - ] - ). - -%%-------------------------------------------------------------------- -%%% Algo negotiation fail. This should result in a ssh_msg_disconnect -%%% being sent from the client. -no_common_alg_client_disconnects(Config) -> - %% Create a listening socket as server socket: - {ok,InitialState} = ssh_trpt_test_lib:exec(listen), - HostPort = ssh_trpt_test_lib:server_host_port(InitialState), - Parent = self(), - - %% Start a process handling one connection on the server side: - Pid = - spawn_link( - fun() -> - Parent ! - {result,self(), - ssh_trpt_test_lib:exec( - [{set_options, [print_ops, {print_messages,detail}]}, - {accept, [{system_dir, system_dir(Config)}, - {user_dir, user_dir(Config)}]}, - receive_hello, - {send, hello}, - {match, #ssh_msg_kexinit{_='_'}, receive_msg}, - {send, #ssh_msg_kexinit{ % with unsupported "SOME-UNSUPPORTED" - cookie = 247381486335508958743193106082599558706, - kex_algorithms = ["diffie-hellman-group1-sha1"], - server_host_key_algorithms = ["SOME-UNSUPPORTED"], % SIC! - encryption_algorithms_client_to_server = ["aes128-ctr"], - encryption_algorithms_server_to_client = ["aes128-ctr"], - mac_algorithms_client_to_server = ["hmac-sha2-256"], - mac_algorithms_server_to_client = ["hmac-sha2-256"], - compression_algorithms_client_to_server = ["none"], - compression_algorithms_server_to_client = ["none"], - languages_client_to_server = [], - languages_server_to_client = [], - first_kex_packet_follows = false, - reserved = 0 - }}, - {match, - {'or',[#ssh_msg_disconnect{code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, _='_'}, - tcp_closed]}, - receive_msg} - ], - InitialState) - } - end), - - %% and finally connect to it with a regular Erlang SSH client - %% which of course does not support SOME-UNSUPPORTED as pub key algo: - Result = std_connect(HostPort, Config, [{preferred_algorithms,[{public_key,['ssh-dss']}]}]), - ct:log("Result of connect is ~p",[Result]), - - receive - {result,Pid,{ok,_}} -> - ok; - {result,Pid,{error,{Op,ExecResult,S}}} -> - ct:log("ERROR!~nOp = ~p~nExecResult = ~p~nState =~n~s", - [Op,ExecResult,ssh_trpt_test_lib:format_msg(S)]), - {fail, ExecResult}; - X -> - ct:log("¤¤¤¤¤"), - ct:fail(X) - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. - -%%%-------------------------------------------------------------------- -gex_client_init_option_groups(Config) -> - do_gex_client_init(Config, {2000, 2048, 4000}, - {3,41}). - -gex_client_init_option_groups_file(Config) -> - do_gex_client_init(Config, {2000, 2048, 4000}, - {5,61}). - -gex_client_init_option_groups_moduli_file(Config) -> - do_gex_client_init(Config, {2000, 2048, 4000}, - {5,16#B7}). - -gex_server_gex_limit(Config) -> - do_gex_client_init(Config, {1000, 3000, 4000}, - {7,91}). - - -do_gex_client_init(Config, {Min,N,Max}, {G,P}) -> - {ok,_} = - ssh_trpt_test_lib:exec( - [{set_options, [print_ops, print_seqnums, print_messages]}, - {connect, - server_host(Config),server_port(Config), - [{silently_accept_hosts, true}, - {user_dir, user_dir(Config)}, - {user_interaction, false}, - {preferred_algorithms,[{kex,['diffie-hellman-group-exchange-sha1']}]} - ]}, - receive_hello, - {send, hello}, - {send, ssh_msg_kexinit}, - {match, #ssh_msg_kexinit{_='_'}, receive_msg}, - {send, #ssh_msg_kex_dh_gex_request{min = Min, - n = N, - max = Max}}, - {match, #ssh_msg_kex_dh_gex_group{p=P, g=G, _='_'}, receive_msg} - ] - ). - -%%%-------------------------------------------------------------------- -gex_client_old_request_exact(Config) -> do_gex_client_init_old(Config, 500, {3,17}). -gex_client_old_request_noexact(Config) -> do_gex_client_init_old(Config, 800, {7,91}). - -do_gex_client_init_old(Config, N, {G,P}) -> - {ok,_} = - ssh_trpt_test_lib:exec( - [{set_options, [print_ops, print_seqnums, print_messages]}, - {connect, - server_host(Config),server_port(Config), - [{silently_accept_hosts, true}, - {user_dir, user_dir(Config)}, - {user_interaction, false}, - {preferred_algorithms,[{kex,['diffie-hellman-group-exchange-sha1']}]} - ]}, - receive_hello, - {send, hello}, - {send, ssh_msg_kexinit}, - {match, #ssh_msg_kexinit{_='_'}, receive_msg}, - {send, #ssh_msg_kex_dh_gex_request_old{n = N}}, - {match, #ssh_msg_kex_dh_gex_group{p=P, g=G, _='_'}, receive_msg} - ] - ). - -%%%-------------------------------------------------------------------- -bad_service_name(Config) -> - bad_service_name(Config, "kfglkjf"). - -bad_long_service_name(Config) -> - bad_service_name(Config, - lists:duplicate(?SSH_MAX_PACKET_SIZE div 2, $a)). - -bad_very_long_service_name(Config) -> - bad_service_name(Config, - lists:duplicate(4*?SSH_MAX_PACKET_SIZE, $a)). - -empty_service_name(Config) -> - bad_service_name(Config, ""). - -bad_service_name_then_correct(Config) -> - {ok,InitialState} = connect_and_kex(Config), - {ok,_} = - ssh_trpt_test_lib:exec( - [{set_options, [print_ops, print_seqnums, print_messages]}, - {send, #ssh_msg_service_request{name = "kdjglkfdjgkldfjglkdfjglkfdjglkj"}}, - {send, #ssh_msg_service_request{name = "ssh-connection"}}, - {match, {'or',[#ssh_msg_disconnect{_='_'}, - tcp_closed - ]}, - receive_msg} - ], InitialState). - - -bad_service_name(Config, Name) -> - {ok,InitialState} = connect_and_kex(Config), - {ok,_} = - ssh_trpt_test_lib:exec( - [{set_options, [print_ops, print_seqnums, print_messages]}, - {send, #ssh_msg_service_request{name = Name}}, - {match, {'or',[#ssh_msg_disconnect{_='_'}, - tcp_closed - ]}, - receive_msg} - ], InitialState). - -%%%-------------------------------------------------------------------- -packet_length_too_large(Config) -> bad_packet_length(Config, +4). - -packet_length_too_short(Config) -> bad_packet_length(Config, -4). - -bad_packet_length(Config, LengthExcess) -> - PacketFun = - fun(Msg, Ssh) -> - BinMsg = ssh_message:encode(Msg), - ssh_transport:pack(BinMsg, Ssh, LengthExcess) - end, - {ok,InitialState} = connect_and_kex(Config), - {ok,_} = - ssh_trpt_test_lib:exec( - [{set_options, [print_ops, print_seqnums, print_messages]}, - {send, {special, - #ssh_msg_service_request{name="ssh-userauth"}, - PacketFun}}, - %% Prohibit remote decoder starvation: - {send, #ssh_msg_service_request{name="ssh-userauth"}}, - {match, {'or',[#ssh_msg_disconnect{_='_'}, - tcp_closed, - {tcp_error,econnaborted} - ]}, - receive_msg} - ], InitialState). - -%%%-------------------------------------------------------------------- -service_name_length_too_large(Config) -> bad_service_name_length(Config, +4). - -service_name_length_too_short(Config) -> bad_service_name_length(Config, -4). - - -bad_service_name_length(Config, LengthExcess) -> - PacketFun = - fun(#ssh_msg_service_request{name=Service}, Ssh) -> - BinName = list_to_binary(Service), - BinMsg = - <>, - ssh_transport:pack(BinMsg, Ssh) - end, - {ok,InitialState} = connect_and_kex(Config), - {ok,_} = - ssh_trpt_test_lib:exec( - [{set_options, [print_ops, print_seqnums, print_messages]}, - {send, {special, - #ssh_msg_service_request{name="ssh-userauth"}, - PacketFun} }, - %% Prohibit remote decoder starvation: - {send, #ssh_msg_service_request{name="ssh-userauth"}}, - {match, {'or',[#ssh_msg_disconnect{_='_'}, - tcp_closed, - {tcp_error,econnaborted} - ]}, - receive_msg} - ], InitialState). - -%%%================================================================ -%%%==== Internal functions ======================================== -%%%================================================================ - -%%%---- init_suite and end_suite --------------------------------------- -start_apps(Config) -> - catch crypto:stop(), - case catch crypto:start() of - ok -> - catch ssh:stop(), - ok = ssh:start(), - [{stop_apps, - fun() -> - ssh:stop(), - crypto:stop() - end} | Config]; - _Else -> - {skip, "Crypto could not be started!"} - end. - - -stop_apps(Config) -> - (?v(stop_apps, Config, fun()-> ok end))(), - ssh:stop(). - - -setup_dirs(Config) -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - ssh_test_lib:setup_rsa(DataDir, PrivDir), - Config. - -system_dir(Config) -> filename:join(?config(priv_dir, Config), system). - -user_dir(Config) -> ?config(priv_dir, Config). - -%%%---------------------------------------------------------------- -start_std_daemon(Config) -> - start_std_daemon(Config, []). - -start_std_daemon(Config, ExtraOpts) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - UserPasswords = [{"user1","pwd1"}], - Options = [%%{preferred_algorithms,[{public_key,['ssh-rsa']}]}, %% For some test cases - {system_dir, system_dir(Config)}, - {user_dir, UserDir}, - {user_passwords, UserPasswords}, - {failfun, fun ssh_test_lib:failfun/2} - | ExtraOpts], - Ref = {Server, Host, Port} = ssh_test_lib:daemon(Options), - ct:log("Std server ~p started at ~p:~p~nOptions=~p",[Server, Host, Port, Options]), - [{server,Ref}, {user_passwords, UserPasswords} | Config]. - - -stop_std_daemon(Config) -> - ssh:stop_daemon(server_pid(Config)), - ct:log("Std server ~p at ~p:~p stopped", [server_pid(Config), server_host(Config), server_port(Config)]), - lists:keydelete(server, 1, Config). - - -check_std_daemon_works(Config, Line) -> - case std_connect(Config) of - {ok,C} -> - ct:log("Server ~p:~p ~p is ok at line ~p", - [server_host(Config), server_port(Config), - server_pid(Config), Line]), - ok = ssh:close(C), - Config; - Error = {error,_} -> - ct:fail("Standard server ~p:~p ~p is ill at line ~p: ~p", - [server_host(Config), server_port(Config), - server_pid(Config), Line, Error]) - end. - -server_pid(Config) -> element(1,?v(server,Config)). -server_host(Config) -> element(2,?v(server,Config)). -server_port(Config) -> element(3,?v(server,Config)). - -server_user_password(Config) -> server_user_password(1, Config). - -server_user_password(N, Config) -> lists:nth(N, ?v(user_passwords,Config)). - - -std_connect(Config) -> - std_connect({server_host(Config), server_port(Config)}, Config). - -std_connect({Host,Port}, Config) -> - std_connect({Host,Port}, Config, []). - -std_connect({Host,Port}, Config, Opts) -> - std_connect(Host, Port, Config, Opts). - -std_connect(Host, Port, Config, Opts) -> - {User,Pwd} = server_user_password(Config), - ssh:connect(Host, Port, - %% Prefere User's Opts to the default opts - [O || O = {Tag,_} <- [{user,User},{password,Pwd}, - {silently_accept_hosts, true}, - {user_dir, user_dir(Config)}, - {user_interaction, false}], - not lists:keymember(Tag, 1, Opts) - ] ++ Opts, - 30000). - -%%%---------------------------------------------------------------- -connect_and_kex(Config) -> - connect_and_kex(Config, ssh_trpt_test_lib:exec([]) ). - -connect_and_kex(Config, InitialState) -> - ssh_trpt_test_lib:exec( - [{connect, - server_host(Config),server_port(Config), - [{preferred_algorithms,[{kex,['diffie-hellman-group1-sha1']}]}, - {silently_accept_hosts, true}, - {user_dir, user_dir(Config)}, - {user_interaction, false}]}, - receive_hello, - {send, hello}, - {send, ssh_msg_kexinit}, - {match, #ssh_msg_kexinit{_='_'}, receive_msg}, - {send, ssh_msg_kexdh_init}, - {match,# ssh_msg_kexdh_reply{_='_'}, receive_msg}, - {send, #ssh_msg_newkeys{}}, - {match, #ssh_msg_newkeys{_='_'}, receive_msg} - ], - InitialState). diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_relay.erl erlang-17.3-dfsg/lib/ssh/test/ssh_relay.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_relay.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_relay.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,407 +0,0 @@ -%%%------------------------------------------------------------------- -%%% @author Simon Cornish -%%% @copyright (C) 2015, Simon Cornish -%%% @doc -%%% Provide manipulatable TCP-level relaying for testing SSH -%%% @end -%%% Created : 7 May 2015 by Simon Cornish -%%%------------------------------------------------------------------- --module(ssh_relay). - --behaviour(gen_server). - -%% API --export([start_link/4]). --export([stop/1]). --export([hold/4, release/2, release_next/3]). - -%% gen_server callbacks --export([init/1, handle_call/3, handle_cast/2, handle_info/2, - terminate/2, code_change/3]). - --record(hold, { - port, - n, - tmo, - tref, - q = [] - }). - --record(state, { - local_addr, - local_port, - peer_addr, - peer_port, - lpid, - local, - peer, - tx_hold, - rx_hold - }). - --define(ACCEPT_TMO, 200). -%%%=================================================================== -%%% API -%%%=================================================================== -%%-------------------------------------------------------------------- -%% @doc -%% Hold N (or 'all') messages in given direction. -%% Messages will be released after the N+1th message or -%% Tmo ms or 'infinity' -%% -%% Dir is 'tx' for direction local -> peer -%% and 'rx' for direction peer -> local -%% -%% An Error, ealready, is returned if there is already a hold -%% in the given direction -%% -%% @spec hold(Srv, Dir, N, Tmo) -> ok | {error, Error} -%% @end -%%-------------------------------------------------------------------- -hold(Srv, Dir, N, Tmo) -> - gen_server:call(Srv, {hold, Dir, N, Tmo}). - -%%-------------------------------------------------------------------- -%% @doc -%% Release all held messages in given direction. -%% -%% An Error, enoent, is returned if there is no hold -%% in the given direction -%% -%% @spec release(Srv, Dir) -> ok | {error, Error} -%% @end -%%-------------------------------------------------------------------- -release(Srv, Dir) -> - gen_server:call(Srv, {release, Dir}). - -%%-------------------------------------------------------------------- -%% @doc -%% Release all held messages in given direction after the -%% next message in the trigger direction -%% -%% An Error, enoent, is returned if there is no hold -%% in the given direction -%% -%% @spec release_next(Srv, Dir, TriggerDir) -> ok | {error, Error} -%% @end -%%-------------------------------------------------------------------- -release_next(Srv, Dir, TriggerDir) -> - gen_server:call(Srv, {release_next, Dir, TriggerDir}). - -%%-------------------------------------------------------------------- -%% @doc -%% Starts the server -%% -%% @spec start_link() -> {ok, Pid} | ignore | {error, Error} -%% @end -%%-------------------------------------------------------------------- -start_link(ListenAddr, ListenPort, PeerAddr, PeerPort) -> - gen_server:start_link(?MODULE, [ListenAddr, ListenPort, PeerAddr, PeerPort], []). - -stop(Srv) -> - unlink(Srv), - Srv ! stop. - -%%%=================================================================== -%%% gen_server callbacks -%%%=================================================================== - -%%-------------------------------------------------------------------- -%% @private -%% @doc -%% Initializes the server -%% -%% @spec init(Args) -> {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% @end -%%-------------------------------------------------------------------- -init([ListenAddr, ListenPort, PeerAddr, PeerPort | _Options]) -> - IfAddr = case ListenAddr of - {0,0,0,0} -> - []; - _ -> - [{ifaddr, ListenAddr}] - end, - case gen_tcp:listen(ListenPort, [{reuseaddr, true}, {backlog, 1}, {active, false}, binary | IfAddr]) of - {ok, LSock} -> - Parent = self(), - {LPid, _LMod} = spawn_monitor(fun() -> listen(Parent, LSock) end), - S = #state{local_addr = ListenAddr, - local_port = ListenPort, - lpid = LPid, - peer_addr = PeerAddr, - peer_port = PeerPort - }, - {ok, S}; - Error -> - {stop, Error} - end. - -%%-------------------------------------------------------------------- -%% @private -%% @doc -%% Handling call messages -%% -%% @spec handle_call(Request, From, State) -> -%% {reply, Reply, State} | -%% {reply, Reply, State, Timeout} | -%% {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, Reply, State} | -%% {stop, Reason, State} -%% @end -%%-------------------------------------------------------------------- -handle_call({hold, Dir, N, Tmo}, _From, State) -> - case Dir of - tx -> - do_hold(#state.tx_hold, State#state.peer, N, Tmo, State); - rx -> - do_hold(#state.rx_hold, State#state.local, N, Tmo, State); - _ -> - {reply, {error, einval}, State} - end; -handle_call({release, Dir}, _From, State) -> - case Dir of - tx -> - do_release(#state.tx_hold, State); - rx -> - do_release(#state.rx_hold, State); - _ -> - {reply, {error, einval}, State} - end; -handle_call({release_next, _Dir, _TriggerDir}, _From, State) -> - {reply, {error, nyi}, State}; - -handle_call(Request, _From, State) -> - Reply = {unhandled, Request}, - {reply, Reply, State}. - -%%-------------------------------------------------------------------- -%% @private -%% @doc -%% Handling cast messages -%% -%% @spec handle_cast(Msg, State) -> {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} -%% @end -%%-------------------------------------------------------------------- -handle_cast(_Msg, State) -> - {noreply, State}. - -%%-------------------------------------------------------------------- -%% @private -%% @doc -%% Handling all non call/cast messages -%% -%% @spec handle_info(Info, State) -> {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} -%% @end -%%-------------------------------------------------------------------- -handle_info({tcp, Local, Data}, S) when S#state.local == Local -> - S1 = do_local(Data, S), - {noreply, S1}; - -handle_info({tcp_error, Local, Error}, S) when S#state.local == Local -> - S1 = do_local({error, Error}, S), - {noreply, S1}; - -handle_info({tcp_closed, Local}, S) when S#state.local == Local -> - S1 = do_local(closed, S), - {noreply, S1}; - -handle_info({tcp, Peer, Data}, S) when S#state.peer == Peer -> - S1 = do_peer(Data, S), - {noreply, S1}; - -handle_info({tcp_error, Peer, Error}, S) when S#state.peer == Peer -> - S1 = do_peer({error, Error}, S), - {noreply, S1}; - -handle_info({tcp_closed, Peer}, S) when S#state.peer == Peer -> - S1 = do_peer(closed, S), - {noreply, S1}; - -handle_info({accept, Local}, S) -> - S1 = do_accept(Local, S), - {noreply, S1}; - -handle_info({activate, Local}, State) -> - inet:setopts(Local, [{active, true}]), - {noreply, State}; - -handle_info({release, Pos}, S) -> - {reply, _, S1} = do_release(Pos,S), - {noreply, S1}; - -handle_info(stop, State) -> - {stop, normal, State}; - -handle_info({'DOWN', _Ref, _process, LPid, Reason}, S) when S#state.lpid == LPid -> - io:format("Acceptor has finished: ~p~n", [Reason]), - {noreply, S}; - -handle_info(_Info, State) -> - io:format("Unhandled info: ~p~n", [_Info]), - {noreply, State}. - -%%-------------------------------------------------------------------- -%% @private -%% @doc -%% This function is called by a gen_server when it is about to -%% terminate. It should be the opposite of Module:init/1 and do any -%% necessary cleaning up. When it returns, the gen_server terminates -%% with Reason. The return value is ignored. -%% -%% @spec terminate(Reason, State) -> void() -%% @end -%%-------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%-------------------------------------------------------------------- -%% @private -%% @doc -%% Convert process state when code is changed -%% -%% @spec code_change(OldVsn, State, Extra) -> {ok, NewState} -%% @end -%%-------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%%=================================================================== -%%% Internal functions -%%%=================================================================== -do_hold(Pos, _Port, _N, _Tmo, S) when element(Pos, S) /= undefined -> - {reply, {error, ealready}, S}; -do_hold(Pos, Port, N, Tmo, S) -> - TRef = if is_integer(Tmo) andalso Tmo > 0 -> - erlang:send_after(Tmo, self(), {release, Pos}); - true -> - undefined - end, - Hold = #hold{port = Port, n = N, tmo = Tmo, tref = TRef}, - {reply, ok, setelement(Pos, S, Hold)}. - -do_release(HPos, S) when element(HPos, S) == undefined -> - {reply, {error, enoent}, S}; -do_release(HPos, S) -> - #hold{port = Port, tref = TRef, q = Q} = element(HPos, S), - lists:foreach(fun(M) -> gen_tcp:send(Port, M), erlang:yield() end, Q), - catch erlang:cancel_timer(TRef), - receive - {release, HPos} -> ok - after 0 -> - ok - end, - {reply, ok, setelement(HPos, S, undefined)}. - -listen(Parent, LSock) -> - monitor(process, Parent), - do_listen(Parent, LSock). - -do_listen(Parent, LSock) -> - %% So annoying there is no select-like sematic for this - case gen_tcp:accept(LSock, ?ACCEPT_TMO) of - {ok, Sock} -> - Parent ! {accept, Sock}, - gen_tcp:controlling_process(Sock, Parent), - Parent ! {activate, Sock}, - do_flush(Parent, Sock), - gen_tcp:close(LSock); - {error, timeout} -> - receive - DOWN when element(1, DOWN) == 'DOWN' -> - ok; - stop -> - ok - after 1 -> - do_listen(Parent, LSock) - end; - Error -> - gen_tcp:close(LSock), - exit({accept,Error}) - end. - -do_flush(Parent, Sock) -> - receive - {Tcp, Sock, _} = Msg when Tcp == tcp; Tcp == tcp_error -> - Parent ! Msg, - do_flush(Parent, Sock); - {tcp_closed, Sock} = Msg -> - Parent ! Msg, - do_flush(Parent, Sock) - after 1 -> - ok - end. - -do_accept(Local, S) -> - case gen_tcp:connect(S#state.peer_addr, S#state.peer_port, [{active, true}, binary]) of - {ok, Peer} -> - S#state{local = Local, peer = Peer}; - Error -> - exit({connect, Error}) - end. - -do_local(Data, S) when is_binary(Data) -> - TxH = S#state.tx_hold, - if TxH == undefined -> - gen_tcp:send(S#state.peer, Data), - S; - TxH#hold.n == 0 -> - lists:foreach(fun(M) -> gen_tcp:send(S#state.peer, M) end, TxH#hold.q), - gen_tcp:send(S#state.peer, Data), - catch erlang:cancel_timer(TxH#hold.tref), - TxP = #state.tx_hold, - receive - {release, TxP} -> - ok - after 0 -> - ok - end, - S#state{tx_hold = undefined}; - true -> - Q = TxH#hold.q ++ [Data], - N = if is_integer(TxH#hold.n) -> - TxH#hold.n -1; - true -> - TxH#hold.n - end, - S#state{tx_hold = TxH#hold{q = Q, n = N}} - end; -do_local(Error, _S) -> - exit({local, Error}). - -do_peer(Data, S) when is_binary(Data) -> - RxH = S#state.rx_hold, - if RxH == undefined -> - gen_tcp:send(S#state.local, Data), - S; - RxH#hold.n == 0 -> - lists:foreach(fun(M) -> gen_tcp:send(S#state.local, M) end, RxH#hold.q), - gen_tcp:send(S#state.local, Data), - catch erlang:cancel_timer(RxH#hold.tref), - RxP = #state.rx_hold, - receive - {release, RxP} -> - ok - after 0 -> - ok - end, - S#state{rx_hold = undefined}; - true -> - Q = RxH#hold.q ++ [Data], - N = if is_integer(RxH#hold.n) -> - RxH#hold.n -1; - true -> - RxH#hold.n - end, - S#state{rx_hold = RxH#hold{q = Q, n = N}} - end; -do_peer(Error, _S) -> - exit({peer, Error}). - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/id_dsa erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/id_dsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/id_dsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/id_dsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBvAIBAAKBgQDfi2flSTZZofwT4yQT0NikX/LGNT7UPeB/XEWe/xovEYCElfaQ -APFixXvEgXwoojmZ5kiQRKzLM39wBP0jPERLbnZXfOOD0PDnw0haMh7dD7XKVMod -/EigVgHf/qBdM2M8yz1s/rRF7n1UpLSypziKjkzCm7JoSQ2zbWIPdmBIXwIVAMgP -kpr7Sq3O7sHdb8D601DRjoExAoGAMOQxDfB2Fd8ouz6G96f/UOzRMI/Kdv8kYYKW -JIGY+pRYrLPyYzUeJznwZreOJgrczAX+luHnKFWJ2Dnk5CyeXk67Wsr7pJ/4MBMD -OKeIS0S8qoSBN8+Krp79fgA+yS3IfqbkJLtLu4EBaCX4mKQIX4++k44d4U5lc8pt -+9hlEI8CgYEAznKxx9kyC6bVo7LUYKaGhofRFt0SYFc5PVmT2VUGRs1R6+6DPD+e -uEO6IhFct7JFSRbP9p0JD4Uk+3zlZF+XX6b2PsZkeV8f/02xlNGUSmEzCSiNg1AX -Cy/WusYhul0MncWCHMcOZB5rIvU/aP5EJJtn3xrRaz6u0SThF6AnT34CFQC63czE -ZU8w8Q+H7z0j+a+70x2iAw== ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/id_rsa erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/id_rsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/id_rsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/id_rsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQD1OET+3O/Bvj/dtjxDTXmj1oiJt4sIph5kGy0RfjoPrZfaS+CU -DhakCmS6t2ivxWFgtpKWaoGMZMJqWj6F6ZsumyFl3FPBtujwY/35cgifrI9Ns4Tl -zR1uuengNBmV+WRQ5cd9F2qS6Z8aDQihzt0r8JUqLcK+VQbrmNzboCCQQwIDAQAB -AoGAPQEyqPTt8JUT7mRXuaacjFXiweAXhp9NEDpyi9eLOjtFe9lElZCrsUOkq47V -TGUeRKEm9qSodfTbKPoqc8YaBJGJPhUaTAcha+7QcDdfHBvIsgxvU7ePVnlpXRp3 -CCUEMPhlnx6xBoTYP+fRU0e3+xJIPVyVCqX1jAdUMkzfRoECQQD6ux7B1QJAIWyK -SGkbDUbBilNmzCFNgIpOP6PA+bwfi5d16diTpra5AX09keQABAo/KaP1PdV8Vg0p -z4P3A7G3AkEA+l+AKG6m0kQTTBMJDqOdVPYwe+5GxunMaqmhokpEbuGsrZBl5Dvd -WpcBjR7jmenrhKZRIuA+Fz5HPo/UQJPl1QJBAKxstDkeED8j/S2XoFhPKAJ+6t39 -sUVICVTIZQeXdmzHJXCcUSkw8+WEhakqw/3SyW0oaK2FSWQJFWJUZ+8eJj8CQEh3 -xeduB5kKnS9CvzdeghZqX6QvVosSdtlUmfUYW/BgH5PpHKTP8wTaeld3XldZTpMJ -dKiMkUw2+XYROVUrubUCQD+Na1LhULlpn4ISEtIEfqpdlUhxDgO15Wg8USmsng+x -ICliVOSQtwaZjm8kwaFt0W7XnpnDxbRs37vIEbIMWak= ------END RSA PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_dsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_dsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_dsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_dsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQCClaHzE2ul0gKSUxah5W0W8UiJLy4hXngKEqpaUq9SSdVdY2LK -wVfKH1gt5iuaf1FfzOhsIC9G/GLnjYttXZc92cv/Gfe3gR+s0ni2++MX+T++mE/Q -diltXv/Hp27PybS67SmiFW7I+RWnT2OKlMPtw2oUuKeztCe5UWjaj/y5FQIVAPLA -l9RpiU30Z87NRAHY3NTRaqtrAoGANMRxw8UfdtNVR0CrQj3AgPaXOGE4d+G4Gp4X -skvnCHycSVAjtYxebUkzUzt5Q6f/IabuLUdge3gXrc8BetvrcKbp+XZgM0/Vj2CF -Ymmy3in6kzGZq7Fw1sZaku6AOU8vLa5woBT2vAcHLLT1bLAzj7viL048T6MfjrOP -ef8nHvACgYBhDWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah -/XcF3DeRF+eEoz48wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+U -ykSTXYUbtsfTNRFQGBW2/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0CgIVAN4wtL5W -Lv62jKcdskxNyz2NQoBx ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_dsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_dsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_dsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_dsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1kc3MAAACBAIKVofMTa6XSApJTFqHlbRbxSIkvLiFeeAoSqlpSr1JJ1V1j -YsrBV8ofWC3mK5p/UV/M6GwgL0b8YueNi21dlz3Zy/8Z97eBH6zSeLb74xf5P76YT9B2 -KW1e/8enbs/JtLrtKaIVbsj5FadPY4qUw+3DahS4p7O0J7lRaNqP/LkVAAAAFQDywJfU -aYlN9GfOzUQB2NzU0WqrawAAAIA0xHHDxR9201VHQKtCPcCA9pc4YTh34bganheyS+cI -fJxJUCO1jF5tSTNTO3lDp/8hpu4tR2B7eBetzwF62+twpun5dmAzT9WPYIViabLeKfqT -MZmrsXDWxlqS7oA5Ty8trnCgFPa8BwcstPVssDOPu+IvTjxPox+Os495/yce8AAAAIBh -DWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah/XcF3DeRF+eEoz48 -wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+UykSTXYUbtsfTNRFQGBW2 -/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0Cg== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_rsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_rsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_rsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_rsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8semM4q843337 -zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RWRWzjaxSB -6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4QIDAQAB -AoGANmvJzJO5hkLuvyDZHKfAnGTtpifcR1wtSa9DjdKUyn8vhKF0mIimnbnYQEmW -NUUb3gXCZLi9PvkpRSVRrASDOZwcjoU/Kvww163vBUVb2cOZfFhyn6o2Sk88Tt++ -udH3hdjpf9i7jTtUkUe+QYPsia+wgvvrmn4QrahLAH86+kECQQDx5gFeXTME3cnW -WMpFz3PPumduzjqgqMMWEccX4FtQkMX/gyGa5UC7OHFyh0N/gSWvPbRHa8A6YgIt -n8DO+fh5AkEAzbqX4DOn8NY6xJIi42q7l/2jIA0RkB6P7YugW5NblhqBZ0XDnpA5 -sMt+rz+K07u9XZtxgh1xi7mNfwY6lEAMqQJBAJBEauCKmRj35Z6OyeQku59SPsnY -+SJEREVvSNw2lH9SOKQQ4wPsYlTGbvKtNVZgAcen91L5MmYfeckYE/fdIZECQQCt -64zxsTnM1I8iFxj/gP/OYlJBikrKt8udWmjaghzvLMEw+T2DExJyb9ZNeT53+UMB -m6O+B/4xzU/djvp+0hbhAkAemIt+rA5kTmYlFndhpvzkSSM8a2EXsO4XIPgGWCTT -tQKS/tTly0ADMjN/TVy11+9d6zcqadNVuHXHGtR4W0GR ------END RSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_rsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_rsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_rsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE_data/ssh_host_rsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1yc2EAAAADAQABAAAAgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8 -semM4q843337zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RW -RWzjaxSB6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4Q== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_renegotiate_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_renegotiate_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,254 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - --module(ssh_renegotiate_SUITE). - --include_lib("common_test/include/ct.hrl"). - -%% Note: This directive should only be used in test suites. --compile(export_all). - --define(REKEY_DATA_TMO, 65000). -%%-------------------------------------------------------------------- -%% Common Test interface functions ----------------------------------- -%%-------------------------------------------------------------------- - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> [{group,default_algs}, - {group,aes_gcm} - ]. - -groups() -> [{default_algs, [], tests()}, - {aes_gcm, [], tests()} - ]. - -tests() -> [rekey, rekey_limit, renegotiate1, renegotiate2]. - -%%-------------------------------------------------------------------- -init_per_suite(Config) -> - catch crypto:stop(), - case catch crypto:start() of - ok -> - Config; - _Else -> - {skip, "Crypto could not be started!"} - end. -end_per_suite(_Config) -> - ssh:stop(), - crypto:stop(). - -%%-------------------------------------------------------------------- -init_per_group(aes_gcm, Config) -> - case lists:member({client2server,['aes128-gcm@openssh.com']}, - ssh_transport:supported_algorithms(cipher)) of - true -> - [{preferred_algorithms, [{cipher,[{client2server,['aes128-gcm@openssh.com']}, - {server2client,['aes128-gcm@openssh.com']}]}]} - | Config]; - false -> - {skip, "aes_gcm not supported"} - end; -init_per_group(_, Config) -> - [{preferred_algorithms, ssh:default_algorithms()} | Config]. - - -end_per_group(_, Config) -> - Config. - -%%-------------------------------------------------------------------- -init_per_testcase(_TestCase, Config) -> - ssh:start(), - Config. - -end_per_testcase(_TestCase, _Config) -> - ssh:stop(), - ok. - -%%-------------------------------------------------------------------- -%% Test Cases -------------------------------------------------------- -%%-------------------------------------------------------------------- - -%%% Idle timeout test - -rekey(Config) -> - {Pid, Host, Port} = - ssh_test_lib:std_daemon(Config, - [{rekey_limit, 0}]), - ConnectionRef = - ssh_test_lib:std_connect(Config, Host, Port, - [{rekey_limit, 0}]), - Kex1 = get_kex_init(ConnectionRef), - receive - after ?REKEY_DATA_TMO -> - %%By this time rekeying would have been done - Kex2 = get_kex_init(ConnectionRef), - false = (Kex2 == Kex1), - ssh:close(ConnectionRef), - ssh:stop_daemon(Pid) - end. - -%%-------------------------------------------------------------------- - -%%% Test rekeying by data volume - -rekey_limit(Config) -> - UserDir = ?config(priv_dir, Config), - DataFile = filename:join(UserDir, "rekey.data"), - - Algs = ?config(preferred_algorithms, Config), - {Pid, Host, Port} = ssh_test_lib:std_daemon(Config,[{max_random_length_padding,0}, - {preferred_algorithms,Algs}]), - - ConnectionRef = ssh_test_lib:std_connect(Config, Host, Port, [{rekey_limit, 6000}, - {max_random_length_padding,0}]), - {ok, SftpPid} = ssh_sftp:start_channel(ConnectionRef), - - Kex1 = get_kex_init(ConnectionRef), - - timer:sleep(?REKEY_DATA_TMO), - Kex1 = get_kex_init(ConnectionRef), - - Data = lists:duplicate(159000,1), - ok = ssh_sftp:write_file(SftpPid, DataFile, Data), - - timer:sleep(?REKEY_DATA_TMO), - Kex2 = get_kex_init(ConnectionRef), - - false = (Kex2 == Kex1), - - timer:sleep(?REKEY_DATA_TMO), - Kex2 = get_kex_init(ConnectionRef), - - ok = ssh_sftp:write_file(SftpPid, DataFile, "hi\n"), - - timer:sleep(?REKEY_DATA_TMO), - Kex2 = get_kex_init(ConnectionRef), - - false = (Kex2 == Kex1), - - timer:sleep(?REKEY_DATA_TMO), - Kex2 = get_kex_init(ConnectionRef), - - ssh_sftp:stop_channel(SftpPid), - ssh:close(ConnectionRef), - ssh:stop_daemon(Pid). - -%%-------------------------------------------------------------------- - -%%% Test rekeying with simulataneous send request - -renegotiate1(Config) -> - UserDir = ?config(priv_dir, Config), - DataFile = filename:join(UserDir, "renegotiate1.data"), - - Algs = ?config(preferred_algorithms, Config), - {Pid, Host, DPort} = ssh_test_lib:std_daemon(Config,[{max_random_length_padding,0}, - {preferred_algorithms,Algs}]), - - RPort = ssh_test_lib:inet_port(), - {ok,RelayPid} = ssh_relay:start_link({0,0,0,0}, RPort, Host, DPort), - - - ConnectionRef = ssh_test_lib:std_connect(Config, Host, RPort, [{max_random_length_padding,0}]), - {ok, SftpPid} = ssh_sftp:start_channel(ConnectionRef), - - Kex1 = get_kex_init(ConnectionRef), - - {ok, Handle} = ssh_sftp:open(SftpPid, DataFile, [write]), - - ok = ssh_sftp:write(SftpPid, Handle, "hi\n"), - - ssh_relay:hold(RelayPid, rx, 20, 1000), - ssh_connection_handler:renegotiate(ConnectionRef), - spawn(fun() -> ok=ssh_sftp:write(SftpPid, Handle, "another hi\n") end), - - timer:sleep(2000), - - Kex2 = get_kex_init(ConnectionRef), - - false = (Kex2 == Kex1), - - ssh_relay:stop(RelayPid), - ssh_sftp:stop_channel(SftpPid), - ssh:close(ConnectionRef), - ssh:stop_daemon(Pid). - -%%-------------------------------------------------------------------- - -%%% Test rekeying with inflight messages from peer - -renegotiate2(Config) -> - UserDir = ?config(priv_dir, Config), - DataFile = filename:join(UserDir, "renegotiate2.data"), - - Algs = ?config(preferred_algorithms, Config), - {Pid, Host, DPort} = ssh_test_lib:std_daemon(Config,[{max_random_length_padding,0}, - {preferred_algorithms,Algs}]), - - RPort = ssh_test_lib:inet_port(), - {ok,RelayPid} = ssh_relay:start_link({0,0,0,0}, RPort, Host, DPort), - - ConnectionRef = ssh_test_lib:std_connect(Config, Host, RPort, [{max_random_length_padding,0}]), - {ok, SftpPid} = ssh_sftp:start_channel(ConnectionRef), - - Kex1 = get_kex_init(ConnectionRef), - - {ok, Handle} = ssh_sftp:open(SftpPid, DataFile, [write]), - - ok = ssh_sftp:write(SftpPid, Handle, "hi\n"), - - ssh_relay:hold(RelayPid, rx, 20, infinity), - spawn(fun() -> ok=ssh_sftp:write(SftpPid, Handle, "another hi\n") end), - %% need a small pause here to ensure ssh_sftp:write is executed - ct:sleep(10), - ssh_connection_handler:renegotiate(ConnectionRef), - ssh_relay:release(RelayPid, rx), - - timer:sleep(2000), - - Kex2 = get_kex_init(ConnectionRef), - - false = (Kex2 == Kex1), - - ssh_relay:stop(RelayPid), - ssh_sftp:stop_channel(SftpPid), - ssh:close(ConnectionRef), - ssh:stop_daemon(Pid). - -%%-------------------------------------------------------------------- -%% Internal functions ------------------------------------------------ -%%-------------------------------------------------------------------- -%% get_kex_init - helper function to get key_exchange_init_msg -get_kex_init(Conn) -> - %% First, validate the key exchange is complete (StateName == connected) - {connected,S} = sys:get_state(Conn), - %% Next, walk through the elements of the #state record looking - %% for the #ssh_msg_kexinit record. This method is robust against - %% changes to either record. The KEXINIT message contains a cookie - %% unique to each invocation of the key exchange procedure (RFC4253) - SL = tuple_to_list(S), - case lists:keyfind(ssh_msg_kexinit, 1, SL) of - false -> - throw(not_found); - KexInit -> - KexInit - end. - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_sftpd_erlclient_SUITE_data/ssh_sftpd_file_alt.erl erlang-17.3-dfsg/lib/ssh/test/ssh_sftpd_erlclient_SUITE_data/ssh_sftpd_file_alt.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_sftpd_erlclient_SUITE_data/ssh_sftpd_file_alt.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_sftpd_erlclient_SUITE_data/ssh_sftpd_file_alt.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -53,7 +52,6 @@ init_per_suite(Config) -> catch ssh:stop(), - catch crypto:stop(), case catch crypto:start() of ok -> DataDir = ?config(data_dir, Config), @@ -159,7 +157,7 @@ NumOfPorts = length(erlang:ports()), - ct:log("Number of open ports: ~p~n", [NumOfPorts]), + ct:pal("Number of open ports: ~p~n", [NumOfPorts]), {ok, <<_/binary>>} = ssh_sftp:read_file(Sftp, FileName), @@ -255,14 +253,14 @@ {ok, Bin} = ssh_sftp:read_file(Sftp, FileName), {ok, Listing} = ssh_sftp:list_dir(Sftp, "."), - ct:log("Listing: ~p~n", [Listing]). + ct:pal("Listing: ~p~n", [Listing]). %%-------------------------------------------------------------------- list_dir_limited(Config) when is_list(Config) -> {Sftp, _} = ?config(sftp, Config), {ok, Listing} = ssh_sftp:list_dir(Sftp, "."), - ct:log("Listing: ~p~n", [Listing]). + ct:pal("Listing: ~p~n", [Listing]). %%-------------------------------------------------------------------- ver6_basic() -> diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_sftpd_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_sftpd_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_sftpd_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_sftpd_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2015. All Rights Reserved. +%% Copyright Ericsson AB 2006-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -57,8 +56,7 @@ retrieve_attributes, set_attributes, links, - ver3_rename, - ver3_open_flags, + ver3_rename, relpath, sshd_read_file, ver6_basic]. @@ -69,7 +67,6 @@ %%-------------------------------------------------------------------- init_per_suite(Config) -> - catch crypto:stop(), case (catch crypto:start()) of ok -> DataDir = ?config(data_dir, Config), @@ -152,7 +149,7 @@ {ok, <>, _} = reply(Cm, Channel), - ct:log("Client: ~p Server ~p~n", [ProtocolVer, Version]), + ct:pal("Client: ~p Server ~p~n", [ProtocolVer, Version]), [{sftp, {Cm, Channel}}, {sftpd, Sftpd }| Config]. @@ -196,39 +193,6 @@ ?ACE4_READ_DATA bor ?ACE4_READ_ATTRIBUTES, ?SSH_FXF_OPEN_EXISTING). -ver3_open_flags() -> - [{doc, "Test open flags"}]. -ver3_open_flags(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - FileName = filename:join(PrivDir, "not_exist.txt"), - {Cm, Channel} = ?config(sftp, Config), - ReqId = 0, - - {ok, <>, _} = - open_file_v3(FileName, Cm, Channel, ReqId, - ?SSH_FXF_CREAT bor ?SSH_FXF_TRUNC), - {ok, <>, _} = close(Handle, ReqId, - Cm, Channel), - - NewFileName = filename:join(PrivDir, "not_exist2.txt"), - NewReqId = ReqId + 1, - {ok, <>, _} = - open_file_v3(NewFileName, Cm, Channel, NewReqId, - ?SSH_FXF_CREAT bor ?SSH_FXF_EXCL), - {ok, <>, _} = close(NewHandle, NewReqId, - Cm, Channel), - - NewFileName1 = filename:join(PrivDir, "test.txt"), - NewReqId1 = NewReqId + 1, - {ok, <>, _} = - open_file_v3(NewFileName1, Cm, Channel, NewReqId1, - ?SSH_FXF_READ bor ?SSH_FXF_WRITE bor ?SSH_FXF_APPEND), - {ok, <>, _} = close(NewHandle1, NewReqId1, - Cm, Channel). - %%-------------------------------------------------------------------- open_close_dir() -> [{doc,"Test SSH_FXP_OPENDIR and SSH_FXP_CLOSE commands"}]. @@ -418,7 +382,7 @@ RealPath = filename:absname(binary_to_list(Path)), AbsPrivDir = filename:absname(PrivDir), - ct:log("Path: ~p PrivDir: ~p~n", [RealPath, AbsPrivDir]), + ct:pal("Path: ~p PrivDir: ~p~n", [RealPath, AbsPrivDir]), true = RealPath == AbsPrivDir end. @@ -447,7 +411,7 @@ true = binary_to_list(Path) == FileName, - ct:log("Path: ~p~n", [binary_to_list(Path)]) + ct:pal("Path: ~p~n", [binary_to_list(Path)]) end. %%-------------------------------------------------------------------- @@ -548,10 +512,10 @@ %% Can not test that NewPermissions = Permissions as %% on Unix platforms, other bits than those listed in the %% API may be set. - ct:log("Org: ~p New: ~p~n", [OrigPermissions, NewPermissions]), + ct:pal("Org: ~p New: ~p~n", [OrigPermissions, NewPermissions]), true = OrigPermissions =/= NewPermissions, - ct:log("Try to open the file"), + ct:pal("Try to open the file"), NewReqId = 2, {ok, <>, _} = open_file(FileName, Cm, Channel, NewReqId, @@ -563,7 +527,7 @@ NewReqId1 = 3, - ct:log("Set original permissions on the now open file"), + ct:pal("Set original permissions on the now open file"), {ok, <>, _} = @@ -683,8 +647,6 @@ closed; {ssh_cm, Cm, Msg} -> ct:fail(Msg) - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end. @@ -700,16 +662,6 @@ ?SSH_FXP_OPEN, Data/binary>>), reply(Cm, Channel). -open_file_v3(File, Cm, Channel, ReqId, Flags) -> - - Data = list_to_binary([?uint32(ReqId), - ?binary(list_to_binary(File)), - ?uint32(Flags), - ?REG_ATTERS]), - Size = 1 + size(Data), - ssh_connection:send(Cm, Channel, <>), - reply(Cm, Channel). close(Handle, ReqId, Cm , Channel) -> @@ -788,7 +740,7 @@ case reply(Cm, Channel) of {ok, <>, _} -> - ct:log("Count: ~p Listing: ~p~n", + ct:pal("Count: ~p Listing: ~p~n", [Count, binary_to_list(Listing)]), read_dir(Handle, Cm, Channel, ReqId); {ok, < - [{group, not_unicode}, - {group, unicode} + [{group, erlang_server}, + {group, openssh_server}, + sftp_nonexistent_subsystem ]. init_per_suite(Config) -> - catch crypto:stop(), case (catch crypto:start()) of ok -> - ct:log("file:native_name_encoding() = ~p,~nio:getopts() = ~p", - [file:native_name_encoding(),io:getopts()]), ssh:start(), Config; _ -> @@ -62,162 +62,40 @@ %%-------------------------------------------------------------------- groups() -> - [{not_unicode, [], [{group,erlang_server}, - {group,openssh_server}, - sftp_nonexistent_subsystem]}, - - {unicode, [], [{group,erlang_server}, - {group,openssh_server}, - sftp_nonexistent_subsystem]}, - - {erlang_server, [], [{group,write_read_tests}, - version_option, - {group,remote_tar}]}, - - {openssh_server, [], [{group,write_read_tests}, - {group,remote_tar}]}, - - {remote_tar, [], [create_empty_tar, - ascii_filename_ascii_contents_to_tar, - ascii_filename_unicode_contents_to_tar, - unicode_filename_ascii_contents_to_tar, - files_to_tar, - big_file_to_tar, files_chunked_to_tar, - directory_to_tar, binaries_to_tar, null_crypto_tar, - simple_crypto_tar_small, simple_crypto_tar_big, - read_tar, read_null_crypto_tar, read_crypto_tar, - aes_cbc256_crypto_tar, aes_ctr_stream_crypto_tar - ]}, - - {write_read_tests, [], [open_close_file, open_close_dir, read_file, read_dir, - write_file, write_file_iolist, write_big_file, sftp_read_big_file, - rename_file, mk_rm_dir, remove_file, links, - retrieve_attributes, set_attributes, async_read, - async_write, position, pos_read, pos_write - ]} - ]. - -init_per_group(not_unicode, Config) -> - ct:comment("Begin ~p",[grps(Config)]), - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - [{user, "Alladin"}, - {passwd, "Sesame"}, - {data, <<"Hello world!">>}, - {filename, filename:join(PrivDir, "sftp.txt")}, - {testfile, filename:join(PrivDir, "test.txt")}, - {linktest, filename:join(PrivDir, "link_test.txt")}, - {tar_filename, filename:join(PrivDir, "sftp_tar_test.tar")}, - {tar_F1_txt, "f1.txt"}, - {datadir_tar, filename:join(DataDir,"sftp_tar_test_data")} - | Config]; - -init_per_group(unicode, Config) -> - case file:native_name_encoding() of - utf8 -> - ct:comment("Begin ~p",[grps(Config)]), - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - NewConfig = - [{user, "Ã¥ke高兴"}, - {passwd, "ärlig日本ã˜ã‚“"}, - {data, <<"foobar Ã¥ 一二三四ã„ã¡ã«ã•ã‚“ã¡">>}, - {filename, filename:join(PrivDir, "sftp瑞点.txt")}, - {testfile, filename:join(PrivDir, "testãƒãƒ³ã‚¹.txt")}, - {linktest, filename:join(PrivDir, "link_test語.txt")}, - {tar_filename, filename:join(PrivDir, "sftp_tar_test一二三.tar")}, - {tar_F1_txt, "F一.txt"}, - {tar_F3_txt, "f3.txt"}, - {tar_F4_txt, "gå››.txt"}, - {datadir_tar, filename:join(DataDir,"sftp_tar_test_data_高兴")} - | lists:foldl(fun(K,Cf) -> lists:keydelete(K,1,Cf) end, - Config, - [user, passwd, data, - filename, testfile, linktest, - tar_filename, tar_F1_txt, datadir_tar - ] - ) - ], - FN = fn(?config(tar_F1_txt,NewConfig), NewConfig), - case catch file:read_file(FN) of - {ok,FN_contents} -> - ct:log("Readable file:read_file(~tp) ->~n~tp",[FN,FN_contents]), - NewConfig; - Other -> - ct:log("Unreadable file:read_file(~tp) ->~n~p",[FN,Other]), - {skip, "Not unicode file reading"} - end; - - _ -> - {skip, "Not unicode file encoding"} - end; - + [{erlang_server, [], [open_close_file, open_close_dir, read_file, read_dir, + write_file, rename_file, mk_rm_dir, remove_file, links, + retrieve_attributes, set_attributes, async_read, + async_write, position, pos_read, pos_write]}, + {openssh_server, [], [open_close_file, open_close_dir, read_file, read_dir, + write_file, rename_file, mk_rm_dir, remove_file, links, + retrieve_attributes, set_attributes, async_read, + async_write, position, pos_read, pos_write]}]. + init_per_group(erlang_server, Config) -> - ct:comment("Begin ~p",[grps(Config)]), PrivDir = ?config(priv_dir, Config), SysDir = ?config(data_dir, Config), - User = ?config(user, Config), - Passwd = ?config(passwd, Config), - Sftpd = {_, HostX, PortX} = + Sftpd = ssh_test_lib:daemon([{system_dir, SysDir}, {user_dir, PrivDir}, {user_passwords, - [{User, Passwd}]}]), - [{peer, {fmt_host(HostX),PortX}}, {group, erlang_server}, {sftpd, Sftpd} | Config]; + [{?USER, ?PASSWD}]}]), + [{group, erlang_server}, {sftpd, Sftpd} | Config]; init_per_group(openssh_server, Config) -> - ct:comment("Begin ~p",[grps(Config)]), Host = ssh_test_lib:hostname(), - case (catch ssh_sftp:start_channel(Host, + case (catch ssh_sftp:start_channel(Host, [{user_interaction, false}, {silently_accept_hosts, true}])) of {ok, _ChannelPid, Connection} -> - [{peer, {_HostName,{IPx,Portx}}}] = ssh:connection_info(Connection,[peer]), ssh:close(Connection), - [{peer, {fmt_host(IPx),Portx}}, {group, openssh_server} | Config]; - {error,"Key exchange failed"} -> - {skip, "openssh server doesn't support the tested kex algorithm"}; + [{group, openssh_server} | Config]; _ -> {skip, "No openssh server"} - end; - -init_per_group(remote_tar, Config) -> - ct:comment("Begin ~p",[grps(Config)]), - {Host,Port} = ?config(peer, Config), - ct:log("Server (~p) at ~p:~p",[?config(group,Config),Host,Port]), - User = ?config(user, Config), - Passwd = ?config(passwd, Config), - {ok, Connection} = - case ?config(group, Config) of - erlang_server -> - ssh:connect(Host, Port, - [{user, User}, - {password, Passwd}, - {user_interaction, false}, - {silently_accept_hosts, true}]); - openssh_server -> - ssh:connect(Host, Port, - [{user_interaction, false}, - {silently_accept_hosts, true}]) - end, - [{remote_tar, true}, - {connection, Connection} | Config]; - -init_per_group(write_read_tests, Config) -> - ct:comment("Begin ~p",[grps(Config)]), - Config. - -grps(Config) -> - proplists:get_all_values( - name, - lists:flatten([proplists:get_value(tc_group_properties,Config,[]), - proplists:get_value(tc_group_path,Config,[])])). + end. end_per_group(erlang_server, Config) -> - ct:comment("End ~p",[grps(Config)]), Config; end_per_group(_, Config) -> - ct:comment("End ~p",[grps(Config)]), Config. %%-------------------------------------------------------------------- @@ -225,81 +103,48 @@ init_per_testcase(sftp_nonexistent_subsystem, Config) -> PrivDir = ?config(priv_dir, Config), SysDir = ?config(data_dir, Config), - User = ?config(user, Config), - Passwd = ?config(passwd, Config), Sftpd = ssh_test_lib:daemon([{system_dir, SysDir}, {user_dir, PrivDir}, {subsystems, []}, {user_passwords, - [{User, Passwd}]} + [{?USER, ?PASSWD}]} ]), [{sftpd, Sftpd} | Config]; -init_per_testcase(version_option, Config) -> +init_per_testcase(Case, Config) -> prep(Config), TmpConfig0 = lists:keydelete(watchdog, 1, Config), TmpConfig = lists:keydelete(sftp, 1, TmpConfig0), Dog = ct:timetrap(?default_timeout), - {_,Host, Port} = ?config(sftpd, Config), - User = ?config(user, Config), - Passwd = ?config(passwd, Config), - {ok, ChannelPid, Connection} = - ssh_sftp:start_channel(Host, Port, - [{sftp_vsn, 3}, - {user, User}, - {password, Passwd}, - {user_interaction, false}, - {silently_accept_hosts, true}]), - Sftp = {ChannelPid, Connection}, - [{sftp,Sftp}, {watchdog, Dog} | TmpConfig]; - -init_per_testcase(Case, Config0) -> - prep(Config0), - Config1 = lists:keydelete(watchdog, 1, Config0), - Config2 = lists:keydelete(sftp, 1, Config1), - Dog = ct:timetrap(2 * ?default_timeout), - User = ?config(user, Config0), - Passwd = ?config(passwd, Config0), - - Config = - case ?config(group,Config2) of - erlang_server -> - {_,Host, Port} = ?config(sftpd, Config2), - {ok, ChannelPid, Connection} = - ssh_sftp:start_channel(Host, Port, - [{user, User}, - {password, Passwd}, - {user_interaction, false}, - {silently_accept_hosts, true}] - ), - Sftp = {ChannelPid, Connection}, - [{sftp, Sftp}, {watchdog, Dog} | Config2]; - openssh_server when Case == links -> - {skip, "known bug in openssh"}; - openssh_server -> - Host = ssh_test_lib:hostname(), - {ok, ChannelPid, Connection} = - ssh_sftp:start_channel(Host, - [{user_interaction, false}, - {silently_accept_hosts, true}]), - Sftp = {ChannelPid, Connection}, - [{sftp, Sftp}, {watchdog, Dog} | Config2] - end, - - case catch ?config(remote_tar,Config) of - %% The 'catch' is for the case of Config={skip,...} - true -> - %% Provide a ChannelPid independent of the sftp-channel already opened. - {ok,ChPid2} = ssh_sftp:start_channel(?config(connection,Config)), - [{channel_pid2,ChPid2} | Config]; - _ -> - Config + + case ?config(group, Config) of + erlang_server -> + {_,Host, Port} = ?config(sftpd, Config), + {ok, ChannelPid, Connection} = + ssh_sftp:start_channel(Host, Port, + [{user, ?USER}, + {password, ?PASSWD}, + {user_interaction, false}, + {silently_accept_hosts, true}]), + Sftp = {ChannelPid, Connection}, + [{sftp, Sftp}, {watchdog, Dog} | TmpConfig]; + openssh_server when Case == links -> + {skip, "known bug in openssh"}; + openssh_server -> + Host = ssh_test_lib:hostname(), + {ok, ChannelPid, Connection} = + ssh_sftp:start_channel(Host, + [{user_interaction, false}, + {silently_accept_hosts, true}]), + Sftp = {ChannelPid, Connection}, + [{sftp, Sftp}, {watchdog, Dog} | TmpConfig] end. end_per_testcase(sftp_nonexistent_subsystem, Config) -> Config; end_per_testcase(rename_file, Config) -> - NewFileName = ?config(testfile, Config), + PrivDir = ?config(priv_dir, Config), + NewFileName = filename:join(PrivDir, "test.txt"), file:delete(NewFileName), end_per_testcase(Config); end_per_testcase(_, Config) -> @@ -308,7 +153,6 @@ end_per_testcase(Config) -> {Sftp, Connection} = ?config(sftp, Config), ssh_sftp:stop_channel(Sftp), - catch ssh_sftp:stop_channel(?config(channel_pid2, Config)), ssh:close(Connection). %%-------------------------------------------------------------------- @@ -317,7 +161,8 @@ open_close_file() -> [{doc, "Test API functions open/3 and close/2"}]. open_close_file(Config) when is_list(Config) -> - FileName = ?config(filename, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, "sftp.txt"), {Sftp, _} = ?config(sftp, Config), @@ -338,7 +183,7 @@ open_close_dir(Config) when is_list(Config) -> PrivDir = ?config(priv_dir, Config), {Sftp, _} = ?config(sftp, Config), - FileName = ?config(filename, Config), + FileName = filename:join(PrivDir, "sftp.txt"), {ok, Handle} = ssh_sftp:opendir(Sftp, PrivDir), ok = ssh_sftp:close(Sftp, Handle), @@ -348,10 +193,10 @@ read_file() -> [{doc, "Test API funtion read_file/2"}]. read_file(Config) when is_list(Config) -> - FileName = ?config(filename, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, "sftp.txt"), {Sftp, _} = ?config(sftp, Config), {ok, Data} = ssh_sftp:read_file(Sftp, FileName), - {ok, Data} = ssh_sftp:read_file(Sftp, FileName), {ok, Data} = file:read_file(FileName). %%-------------------------------------------------------------------- @@ -361,69 +206,26 @@ PrivDir = ?config(priv_dir, Config), {Sftp, _} = ?config(sftp, Config), {ok, Files} = ssh_sftp:list_dir(Sftp, PrivDir), - ct:log("sftp list dir: ~p~n", [Files]). + ct:pal("sftp list dir: ~p~n", [Files]). %%-------------------------------------------------------------------- write_file() -> [{doc, "Test API function write_file/2"}]. write_file(Config) when is_list(Config) -> - FileName = ?config(filename, Config), - {Sftp, _} = ?config(sftp, Config), - - Data = list_to_binary("Hej hopp!"), - ssh_sftp:write_file(Sftp, FileName, [Data]), - {ok, Data} = file:read_file(FileName). - -%%-------------------------------------------------------------------- -write_file_iolist() -> - [{doc, "Test API function write_file/2 with iolists"}]. -write_file_iolist(Config) when is_list(Config) -> - FileName = ?config(filename, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, "sftp.txt"), {Sftp, _} = ?config(sftp, Config), Data = list_to_binary("Hej hopp!"), - lists:foreach( - fun(D) -> - ssh_sftp:write_file(Sftp, FileName, [D]), - Expected = if is_binary(D) -> D; - is_list(D) -> list_to_binary(D) - end, - {ok, Expected} = file:read_file(FileName) - end, - [Data, [Data,Data], [[Data],[Data]], [[[Data]],[[[[Data]],Data]]], - [[[[Data]],Data],binary_to_list(Data)], - [[[[Data]],Data],[[binary_to_list(Data)],[[binary_to_list(Data)]]]] - ]). - -%%-------------------------------------------------------------------- -write_big_file() -> - [{doc, "Test API function write_file/2 with big data"}]. -write_big_file(Config) when is_list(Config) -> - FileName = ?config(filename, Config), - {Sftp, _} = ?config(sftp, Config), - - Data = list_to_binary(lists:duplicate(750000,"a")), ssh_sftp:write_file(Sftp, FileName, [Data]), {ok, Data} = file:read_file(FileName). %%-------------------------------------------------------------------- -sftp_read_big_file() -> - [{doc, "Test API function read_file/2 with big data"}]. -sftp_read_big_file(Config) when is_list(Config) -> - FileName = ?config(filename, Config), - {Sftp, _} = ?config(sftp, Config), - - Data = list_to_binary(lists:duplicate(750000,"a")), - ct:log("Data size to write is ~p bytes",[size(Data)]), - ssh_sftp:write_file(Sftp, FileName, [Data]), - {ok, Data} = ssh_sftp:read_file(Sftp, FileName). - -%%-------------------------------------------------------------------- remove_file() -> [{doc,"Test API function delete/2"}]. remove_file(Config) when is_list(Config) -> PrivDir = ?config(priv_dir, Config), - FileName = ?config(filename, Config), + FileName = filename:join(PrivDir, "sftp.txt"), {Sftp, _} = ?config(sftp, Config), {ok, Files} = ssh_sftp:list_dir(Sftp, PrivDir), @@ -437,17 +239,17 @@ [{doc, "Test API function rename_file/2"}]. rename_file(Config) when is_list(Config) -> PrivDir = ?config(priv_dir, Config), - FileName = ?config(filename, Config), - NewFileName = ?config(testfile, Config), + FileName = filename:join(PrivDir, "sftp.txt"), + NewFileName = filename:join(PrivDir, "test.txt"), {Sftp, _} = ?config(sftp, Config), {ok, Files} = ssh_sftp:list_dir(Sftp, PrivDir), - ct:log("FileName: ~p, Files: ~p~n", [FileName, Files]), + ct:pal("FileName: ~p, Files: ~p~n", [FileName, Files]), true = lists:member(filename:basename(FileName), Files), false = lists:member(filename:basename(NewFileName), Files), ok = ssh_sftp:rename(Sftp, FileName, NewFileName), {ok, NewFiles} = ssh_sftp:list_dir(Sftp, PrivDir), - ct:log("FileName: ~p, Files: ~p~n", [FileName, NewFiles]), + ct:pal("FileName: ~p, Files: ~p~n", [FileName, NewFiles]), false = lists:member(filename:basename(FileName), NewFiles), true = lists:member(filename:basename(NewFileName), NewFiles). @@ -458,7 +260,7 @@ mk_rm_dir(Config) when is_list(Config) -> PrivDir = ?config(priv_dir, Config), {Sftp, _} = ?config(sftp, Config), - + DirName = filename:join(PrivDir, "test"), ok = ssh_sftp:make_dir(Sftp, DirName), ok = ssh_sftp:del_dir(Sftp, DirName), @@ -475,8 +277,9 @@ {skip, "Links are not fully supported by windows"}; _ -> {Sftp, _} = ?config(sftp, Config), - FileName = ?config(filename, Config), - LinkFileName = ?config(linktest, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, "sftp.txt"), + LinkFileName = filename:join(PrivDir, "link_test.txt"), ok = ssh_sftp:make_symlink(Sftp, LinkFileName, FileName), {ok, FileName} = ssh_sftp:read_link(Sftp, LinkFileName) @@ -486,20 +289,22 @@ retrieve_attributes() -> [{doc, "Test API function read_file_info/3"}]. retrieve_attributes(Config) when is_list(Config) -> - FileName = ?config(filename, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, "sftp.txt"), {Sftp, _} = ?config(sftp, Config), {ok, FileInfo} = ssh_sftp:read_file_info(Sftp, FileName), {ok, NewFileInfo} = file:read_file_info(FileName), %% TODO comparison. There are some differences now is that ok? - ct:log("SFTP: ~p FILE: ~p~n", [FileInfo, NewFileInfo]). + ct:pal("SFTP: ~p FILE: ~p~n", [FileInfo, NewFileInfo]). %%-------------------------------------------------------------------- set_attributes() -> [{doc,"Test API function write_file_info/3"}]. set_attributes(Config) when is_list(Config) -> - FileName = ?config(testfile, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, "test.txt"), {Sftp, _} = ?config(sftp, Config), {ok,Fd} = file:open(FileName, write), @@ -515,26 +320,26 @@ [{doc,"Test API aread/3"}]. async_read(Config) when is_list(Config) -> {Sftp, _} = ?config(sftp, Config), + PrivDir = ?config(priv_dir, Config), - FileName = ?config(filename, Config), + FileName = filename:join(PrivDir, "sftp.txt"), {ok, Handle} = ssh_sftp:open(Sftp, FileName, [read]), {async, Ref} = ssh_sftp:aread(Sftp, Handle, 20), receive {async_reply, Ref, {ok, Data}} -> - ct:log("Data: ~p~n", [Data]), + ct:pal("Data: ~p~n", [Data]), ok; Msg -> ct:fail(Msg) - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end. %%-------------------------------------------------------------------- async_write() -> [{doc,"Test API awrite/3"}]. async_write(Config) when is_list(Config) -> {Sftp, _} = ?config(sftp, Config), - FileName = ?config(testfile, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, "test.txt"), {ok, Handle} = ssh_sftp:open(Sftp, FileName, [write]), Data = list_to_binary("foobar"), {async, Ref} = ssh_sftp:awrite(Sftp, Handle, Data), @@ -551,7 +356,8 @@ position() -> [{doc, "Test API functions position/3"}]. position(Config) when is_list(Config) -> - FileName = ?config(testfile, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, "test.txt"), {Sftp, _} = ?config(sftp, Config), Data = list_to_binary("1234567890"), @@ -580,7 +386,8 @@ pos_read() -> [{doc,"Test API functions pread/3 and apread/3"}]. pos_read(Config) when is_list(Config) -> - FileName = ?config(testfile, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, "test.txt"), {Sftp, _} = ?config(sftp, Config), Data = list_to_binary("Hej hopp!"), ssh_sftp:write_file(Sftp, FileName, [Data]), @@ -595,8 +402,6 @@ ok; Msg -> ct:fail(Msg) - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, NewData1 = "hopp", @@ -607,7 +412,8 @@ pos_write() -> [{doc,"Test API functions pwrite/4 and apwrite/4"}]. pos_write(Config) when is_list(Config) -> - FileName = ?config(testfile, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, "test.txt"), {Sftp, _} = ?config(sftp, Config), {ok, Handle} = ssh_sftp:open(Sftp, FileName, [write]), @@ -622,8 +428,6 @@ ok; Msg -> ct:fail(Msg) - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end, ok = ssh_sftp:pwrite(Sftp, Handle, eof, list_to_binary("!")), @@ -636,423 +440,30 @@ [{doc, "Try to execute sftp subsystem on a server that does not support it"}]. sftp_nonexistent_subsystem(Config) when is_list(Config) -> {_,Host, Port} = ?config(sftpd, Config), - User = ?config(user, Config), - Passwd = ?config(passwd, Config), {error,"server failed to start sftp subsystem"} = ssh_sftp:start_channel(Host, Port, [{user_interaction, false}, - {user, User}, - {password, Passwd}, + {user, ?USER}, {password, ?PASSWD}, {silently_accept_hosts, true}]). %%-------------------------------------------------------------------- -version_option() -> - [{doc, "Test API option sftp_vsn"}]. -version_option(Config) when is_list(Config) -> - open_close_dir(Config). - -%%-------------------------------------------------------------------- -create_empty_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write]), - erl_tar:close(Handle), - {ChPid,_} = ?config(sftp,Config), - {ok, #file_info{type=regular}} = - ssh_sftp:read_file_info(ChPid, TarFileName). - -%%-------------------------------------------------------------------- -files_to_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write]), - F1 = ?config(tar_F1_txt, Config), - ok = erl_tar:add(Handle, fn(F1,Config), F1, [verbose]), - ok = erl_tar:add(Handle, fn("f2.txt",Config), "f2.txt", [verbose]), - ok = erl_tar:close(Handle), - chk_tar([F1, "f2.txt"], Config). - -%%-------------------------------------------------------------------- -ascii_filename_ascii_contents_to_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write]), - ok = erl_tar:add(Handle, fn("f2.txt",Config), "f2.txt", [verbose]), - ok = erl_tar:close(Handle), - chk_tar(["f2.txt"], Config). - -%%-------------------------------------------------------------------- -ascii_filename_unicode_contents_to_tar(Config) -> - case ?config(tar_F3_txt, Config) of - undefined -> - {skip, "Unicode test"}; - Fn -> - ChPid2 = ?config(channel_pid2, Config), - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write]), - ok = erl_tar:add(Handle, fn(Fn,Config), Fn, [verbose]), - ok = erl_tar:close(Handle), - chk_tar([Fn], Config) - end. - -%%-------------------------------------------------------------------- -unicode_filename_ascii_contents_to_tar(Config) -> - case ?config(tar_F4_txt, Config) of - undefined -> - {skip, "Unicode test"}; - Fn -> - ChPid2 = ?config(channel_pid2, Config), - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write]), - ok = erl_tar:add(Handle, fn(Fn,Config), Fn, [verbose]), - ok = erl_tar:close(Handle), - chk_tar([Fn], Config) - end. - -%%-------------------------------------------------------------------- -big_file_to_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write]), - ok = erl_tar:add(Handle, fn("big.txt",Config), "big.txt", [verbose]), - ok = erl_tar:close(Handle), - chk_tar(["big.txt"], Config). - - -%%-------------------------------------------------------------------- -files_chunked_to_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write]), - F1 = ?config(tar_F1_txt, Config), - ok = erl_tar:add(Handle, fn(F1,Config), F1, [verbose,{chunks,2}]), - ok = erl_tar:close(Handle), - chk_tar([F1], Config). - -%%-------------------------------------------------------------------- -directory_to_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write]), - ok = erl_tar:add(Handle, fn("d1",Config), "d1", [verbose]), - ok = erl_tar:close(Handle), - chk_tar(["d1"], Config). - -%%-------------------------------------------------------------------- -binaries_to_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write]), - Bin = <<"A binary">>, - ok = erl_tar:add(Handle, Bin, "b1", [verbose]), - ok = erl_tar:close(Handle), - chk_tar([{"b1",Bin}], Config). - -%%-------------------------------------------------------------------- -null_crypto_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - Cinit = fun() -> {ok, no_state, _SendSize=5} end, - Cenc = fun(Bin,CState) -> {ok,Bin,CState,_SendSize=5} end, - Cend = fun(Bin,_CState) -> {ok,Bin} end, - C = {Cinit,Cenc,Cend}, - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write,{crypto,C}]), - Bin = <<"A binary">>, - F1 = ?config(tar_F1_txt, Config), - ok = erl_tar:add(Handle, Bin, "b1", [verbose]), - ok = erl_tar:add(Handle, fn(F1,Config), F1, [verbose,{chunks,2}]), - ok = erl_tar:add(Handle, fn("big.txt",Config), "big.txt", [verbose,{chunks,15000}]), - ok = erl_tar:close(Handle), - chk_tar([{"b1",Bin}, F1, "big.txt"], Config). - -%%-------------------------------------------------------------------- -simple_crypto_tar_small(Config) -> - ChPid2 = ?config(channel_pid2, Config), - Cinit = fun() -> {ok, no_state, _Size=6} end, - Cenc = fun(Bin,CState) -> {ok,stuff(Bin),CState,_SendSize=5} end, - Cdec = fun(Bin,CState) -> {ok,unstuff(Bin),CState,_Size=4} end, - Cend = fun(Bin,_CState) -> {ok,stuff(Bin)} end, - C = {Cinit,Cenc,Cend}, - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write,{crypto,C}]), - Bin = <<"A binary">>, - F1 = ?config(tar_F1_txt, Config), - ok = erl_tar:add(Handle, Bin, "b1", [verbose]), - ok = erl_tar:add(Handle, fn(F1,Config), F1, [verbose,{chunks,2}]), - ok = erl_tar:close(Handle), - chk_tar([{"b1",Bin}, F1], Config, [{crypto,{Cinit,Cdec}}]). - -%%-------------------------------------------------------------------- -simple_crypto_tar_big(Config) -> - ChPid2 = ?config(channel_pid2, Config), - Cinit = fun() -> {ok, no_state, _SendSize=6} end, - Cenc = fun(Bin,CState) -> {ok,stuff(Bin),CState,_SendSize=5} end, - Cdec = fun(Bin,CState) -> {ok,unstuff(Bin),CState,_SendSize=4} end, - Cend = fun(Bin,_CState) -> {ok,stuff(Bin)} end, - C = {Cinit,Cenc,Cend}, - TarFileName = ?config(tar_filename, Config), - {ok,Handle} = ssh_sftp:open_tar(ChPid2, TarFileName, [write,{crypto,C}]), - Bin = <<"A binary">>, - F1 = ?config(tar_F1_txt, Config), - ok = erl_tar:add(Handle, Bin, "b1", [verbose]), - ok = erl_tar:add(Handle, fn(F1,Config), F1, [verbose,{chunks,2}]), - ok = erl_tar:add(Handle, fn("big.txt",Config), "big.txt", [verbose,{chunks,15000}]), - ok = erl_tar:close(Handle), - chk_tar([{"b1",Bin}, F1, "big.txt"], Config, [{crypto,{Cinit,Cdec}}]). - -stuff(Bin) -> << <> || <> <= Bin >>. - -unstuff(Bin) -> << <> || <> <= Bin >>. - -%%-------------------------------------------------------------------- -read_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - NameBins = lists:sort( - [{"b1",<<"A binary">>}, - {"b2",list_to_binary(lists:duplicate(750000,"a"))} - ]), - TarFileName = ?config(tar_filename, Config), - {ok,HandleWrite} = ssh_sftp:open_tar(ChPid2, TarFileName, [write]), - [ok = erl_tar:add(HandleWrite, Bin, Name, [verbose]) - || {Name,Bin} <- NameBins], - ok = erl_tar:close(HandleWrite), - - chk_tar(NameBins, Config). - -%%-------------------------------------------------------------------- -read_null_crypto_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - NameBins = lists:sort( - [{"b1",<<"A binary">>}, - {"b2",list_to_binary(lists:duplicate(750000,"a"))} - ]), - Cinitw = fun() -> {ok, no_state, _SendSize=5} end, - Cinitr = fun() -> {ok, no_state, _FetchSize=42} end, - Cenc = fun(Bin,CState) -> {ok,Bin,CState,_SendSize=42*42} end, - Cdec = fun(Bin,CState) -> {ok,Bin,CState,_FetchSize=19} end, - Cendw = fun(Bin,_CState) -> {ok,Bin} end, - Cw = {Cinitw,Cenc,Cendw}, - Cr = {Cinitr,Cdec}, - - TarFileName = ?config(tar_filename, Config), - {ok,HandleWrite} = ssh_sftp:open_tar(ChPid2, TarFileName, [write,{crypto,Cw}]), - [ok = erl_tar:add(HandleWrite, Bin, Name, [verbose]) - || {Name,Bin} <- NameBins], - ok = erl_tar:close(HandleWrite), - - chk_tar(NameBins, Config, [{crypto,Cr}]). - -%%-------------------------------------------------------------------- -read_crypto_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - NameBins = lists:sort( - [{"b1",<<"A binary">>}, - {"b2",list_to_binary(lists:duplicate(750000,"a"))} - ]), - Cinitw = fun() -> {ok, no_state, _SendSize=5} end, - Cinitr = fun() -> {ok, no_state, _FetchSize=42} end, - - Cenc = fun(Bin,CState) -> {ok,stuff(Bin),CState,_SendSize=42*42} end, - Cdec = fun(Bin,CState) -> {ok,unstuff(Bin),CState,_FetchSize=120} end, - Cendw = fun(Bin,_CState) -> {ok,stuff(Bin)} end, - Cw = {Cinitw,Cenc,Cendw}, - Cr = {Cinitr,Cdec}, - - TarFileName = ?config(tar_filename, Config), - {ok,HandleWrite} = ssh_sftp:open_tar(ChPid2, TarFileName, [write,{crypto,Cw}]), - [ok = erl_tar:add(HandleWrite, Bin, Name, [verbose]) - || {Name,Bin} <- NameBins], - ok = erl_tar:close(HandleWrite), - - chk_tar(NameBins, Config, [{crypto,Cr}]). - -%%-------------------------------------------------------------------- -aes_cbc256_crypto_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - NameBins = lists:sort( - [{"b1",<<"A binary">>}, - {"b2",list_to_binary(lists:duplicate(750000,"a"))}, - {"d1",fn("d1",Config)} % Dir - ]), - Key = <<"This is a 256 bit key. Boring...">>, - Ivec0 = crypto:rand_bytes(16), - DataSize = 1024, % data_size rem 16 = 0 for aes_cbc - - Cinitw = fun() -> {ok, Ivec0, DataSize} end, - Cinitr = fun() -> {ok, Ivec0, DataSize} end, - - Cenc = fun(PlainBin,Ivec) -> - CipherBin = crypto:block_encrypt(aes_cbc256, Key, Ivec, PlainBin), - {ok, CipherBin, crypto:next_iv(aes_cbc,CipherBin), DataSize} - end, - Cdec = fun(CipherBin,Ivec) -> - PlainBin = crypto:block_decrypt(aes_cbc256, Key, Ivec, CipherBin), - {ok, PlainBin, crypto:next_iv(aes_cbc,CipherBin), DataSize} - end, - - Cendw = fun(PlainBin, _) when PlainBin == <<>> -> {ok, <<>>}; - (PlainBin, Ivec) -> - CipherBin = crypto:block_encrypt(aes_cbc256, Key, Ivec, - pad(16,PlainBin)), %% Last chunk - {ok, CipherBin} - end, - - Cw = {Cinitw,Cenc,Cendw}, - TarFileName = ?config(tar_filename, Config), - {ok,HandleWrite} = ssh_sftp:open_tar(ChPid2, TarFileName, [write,{crypto,Cw}]), - [ok = erl_tar:add(HandleWrite, Bin, Name, [verbose]) || {Name,Bin} <- NameBins], - ok = erl_tar:close(HandleWrite), - - Cr = {Cinitr,Cdec}, - chk_tar(NameBins, Config, [{crypto,Cr}]). - - -pad(BlockSize, Bin) -> - PadSize = (BlockSize - (size(Bin) rem BlockSize)) rem BlockSize, - list_to_binary( lists:duplicate(PadSize,0) ). - -%%-------------------------------------------------------------------- -aes_ctr_stream_crypto_tar(Config) -> - ChPid2 = ?config(channel_pid2, Config), - NameBins = lists:sort( - [{"b1",<<"A binary">>}, - {"b2",list_to_binary(lists:duplicate(750000,"a"))}, - {"d1",fn("d1",Config)} % Dir - ]), - Key = <<"This is a 256 bit key. Boring...">>, - Ivec0 = crypto:rand_bytes(16), - - Cinitw = Cinitr = fun() -> {ok, crypto:stream_init(aes_ctr,Key,Ivec0)} end, - - Cenc = fun(PlainBin,State) -> - {NewState,CipherBin} = crypto:stream_encrypt(State, PlainBin), - {ok, CipherBin, NewState} - end, - Cdec = fun(CipherBin,State) -> - {NewState,PlainBin} = crypto:stream_decrypt(State, CipherBin), - {ok, PlainBin, NewState} - end, - - Cendw = fun(PlainBin, _) when PlainBin == <<>> -> {ok, <<>>}; - (PlainBin, Ivec) -> - CipherBin = crypto:block_encrypt(aes_cbc256, Key, Ivec, - pad(16,PlainBin)), %% Last chunk - {ok, CipherBin} - end, - - Cw = {Cinitw,Cenc,Cendw}, - TarFileName = ?config(tar_filename, Config), - {ok,HandleWrite} = ssh_sftp:open_tar(ChPid2, TarFileName, [write,{crypto,Cw}]), - [ok = erl_tar:add(HandleWrite, Bin, Name, [verbose]) || {Name,Bin} <- NameBins], - ok = erl_tar:close(HandleWrite), - - Cr = {Cinitr,Cdec}, - chk_tar(NameBins, Config, [{crypto,Cr}]). - -%%-------------------------------------------------------------------- %% Internal functions ------------------------------------------------ %%-------------------------------------------------------------------- prep(Config) -> - DataDir = ?config(data_dir, Config), - TestFile = ?config(filename, Config), - TestFile1 = ?config(testfile, Config), - TestLink = ?config(linktest, Config), - TarFileName = ?config(tar_filename, Config), + PrivDir = ?config(priv_dir, Config), + TestFile = filename:join(PrivDir, "sftp.txt"), + TestFile1 = filename:join(PrivDir, "test.txt"), + TestLink = filename:join(PrivDir, "link_test.txt"), file:delete(TestFile), file:delete(TestFile1), file:delete(TestLink), - file:delete(TarFileName), %% Initial config + DataDir = ?config(data_dir, Config), FileName = filename:join(DataDir, "sftp.txt"), file:copy(FileName, TestFile), Mode = 8#00400 bor 8#00200 bor 8#00040, % read & write owner, read group {ok, FileInfo} = file:read_file_info(TestFile), ok = file:write_file_info(TestFile, FileInfo#file_info{mode = Mode}). - -chk_tar(Items, Config) -> - chk_tar(Items, Config, []). - -chk_tar(Items, Config, Opts) -> - TarFileName = ?config(tar_filename, Config), - chk_tar(Items, TarFileName, Config, Opts). - -chk_tar(Items, TarFileName, Config, Opts) when is_list(Opts) -> - tar_size(TarFileName, Config), - {ChPid,_} = ?config(sftp,Config), - {ok,HandleRead} = ssh_sftp:open_tar(ChPid, TarFileName, [read|Opts]), - {ok,NameValueList} = erl_tar:extract(HandleRead,[memory,verbose]), - ok = erl_tar:close(HandleRead), - case {lists:sort(expand_items(Items,Config)), lists:sort(NameValueList)} of - {L,L} -> - true; - {Expect,Actual} -> - ct:log("Expect: ~p",[Expect]), ct:log("Actual: ~p",[Actual]), - case erl_tar:table(TarFileName) of - {ok,Names} -> ct:log("names: ~p",[Names]); - Other -> ct:log("~p",[Other]) - end, - ct:log("~s",[analyze_report(Expect, Actual)]), - ct:fail(bad_tar_contents) - end. - -analyze_report([E={NameE,BinE}|Es], [A={NameA,BinA}|As]) -> - if - NameE == NameA, - BinE =/= BinA-> - [["Component ",NameE," differs. \n Expected: ",BinE,"\n Actual: ",BinA,"\n\n"] - | analyze_report(Es,As)]; - - NameE < NameA -> - [["Component ",NameE," is missing.\n\n"] - | analyze_report(Es,[A|As])]; - - NameE > NameA -> - [["Component ",NameA," is not expected.\n\n"] - | analyze_report([E|Es],As)]; - true -> - analyze_report(Es, As) - end; -analyze_report([{NameE,_BinE}|Es], []) -> - [["Component ",NameE," missing.\n\n"] | analyze_report(Es,[])]; -analyze_report([], [{NameA,_BinA}|As]) -> - [["Component ",NameA," not expected.\n\n"] | analyze_report([],As)]; -analyze_report([], []) -> - "". - -tar_size(TarFileName, Config) -> - {ChPid,_} = ?config(sftp,Config), - {ok,Data} = ssh_sftp:read_file(ChPid, TarFileName), - io:format('Tar file ~p is~n ~p bytes.~n',[TarFileName, size(Data)]). - -expand_items(Items, Config) -> - lists:flatten( - [case Item of - {_Name,Bin} when is_binary(Bin) -> - Item; - {Name,FileName} when is_list(FileName) -> - read_item_contents(Name, fn(FileName,Config)); - FileName when is_list(FileName) -> - read_item_contents(FileName, fn(FileName,Config)) - end || Item <- Items]). - -read_item_contents(ItemName, FileName) -> - case file:read_file(FileName) of - {ok,Bin} -> - {ItemName, Bin}; - {error,eisdir} -> - {ok,FileNames} = file:list_dir(FileName), - [read_item_contents(filename:join(ItemName,Name), - filename:join(FileName,Name)) - || Name<-FileNames] - end. - -fn(Name, Config) -> - Dir = ?config(datadir_tar, Config), - filename:join(Dir,Name). - -fmt_host({A,B,C,D}) -> lists:concat([A,".",B,".",C,".",D]); -fmt_host(S) -> S. - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/id_dsa erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/id_dsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/id_dsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/id_dsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBvAIBAAKBgQDfi2flSTZZofwT4yQT0NikX/LGNT7UPeB/XEWe/xovEYCElfaQ -APFixXvEgXwoojmZ5kiQRKzLM39wBP0jPERLbnZXfOOD0PDnw0haMh7dD7XKVMod -/EigVgHf/qBdM2M8yz1s/rRF7n1UpLSypziKjkzCm7JoSQ2zbWIPdmBIXwIVAMgP -kpr7Sq3O7sHdb8D601DRjoExAoGAMOQxDfB2Fd8ouz6G96f/UOzRMI/Kdv8kYYKW -JIGY+pRYrLPyYzUeJznwZreOJgrczAX+luHnKFWJ2Dnk5CyeXk67Wsr7pJ/4MBMD -OKeIS0S8qoSBN8+Krp79fgA+yS3IfqbkJLtLu4EBaCX4mKQIX4++k44d4U5lc8pt -+9hlEI8CgYEAznKxx9kyC6bVo7LUYKaGhofRFt0SYFc5PVmT2VUGRs1R6+6DPD+e -uEO6IhFct7JFSRbP9p0JD4Uk+3zlZF+XX6b2PsZkeV8f/02xlNGUSmEzCSiNg1AX -Cy/WusYhul0MncWCHMcOZB5rIvU/aP5EJJtn3xrRaz6u0SThF6AnT34CFQC63czE -ZU8w8Q+H7z0j+a+70x2iAw== ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/id_rsa erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/id_rsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/id_rsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/id_rsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQD1OET+3O/Bvj/dtjxDTXmj1oiJt4sIph5kGy0RfjoPrZfaS+CU -DhakCmS6t2ivxWFgtpKWaoGMZMJqWj6F6ZsumyFl3FPBtujwY/35cgifrI9Ns4Tl -zR1uuengNBmV+WRQ5cd9F2qS6Z8aDQihzt0r8JUqLcK+VQbrmNzboCCQQwIDAQAB -AoGAPQEyqPTt8JUT7mRXuaacjFXiweAXhp9NEDpyi9eLOjtFe9lElZCrsUOkq47V -TGUeRKEm9qSodfTbKPoqc8YaBJGJPhUaTAcha+7QcDdfHBvIsgxvU7ePVnlpXRp3 -CCUEMPhlnx6xBoTYP+fRU0e3+xJIPVyVCqX1jAdUMkzfRoECQQD6ux7B1QJAIWyK -SGkbDUbBilNmzCFNgIpOP6PA+bwfi5d16diTpra5AX09keQABAo/KaP1PdV8Vg0p -z4P3A7G3AkEA+l+AKG6m0kQTTBMJDqOdVPYwe+5GxunMaqmhokpEbuGsrZBl5Dvd -WpcBjR7jmenrhKZRIuA+Fz5HPo/UQJPl1QJBAKxstDkeED8j/S2XoFhPKAJ+6t39 -sUVICVTIZQeXdmzHJXCcUSkw8+WEhakqw/3SyW0oaK2FSWQJFWJUZ+8eJj8CQEh3 -xeduB5kKnS9CvzdeghZqX6QvVosSdtlUmfUYW/BgH5PpHKTP8wTaeld3XldZTpMJ -dKiMkUw2+XYROVUrubUCQD+Na1LhULlpn4ISEtIEfqpdlUhxDgO15Wg8USmsng+x -ICliVOSQtwaZjm8kwaFt0W7XnpnDxbRs37vIEbIMWak= ------END RSA PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_dsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_dsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_dsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_dsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQCClaHzE2ul0gKSUxah5W0W8UiJLy4hXngKEqpaUq9SSdVdY2LK -wVfKH1gt5iuaf1FfzOhsIC9G/GLnjYttXZc92cv/Gfe3gR+s0ni2++MX+T++mE/Q -diltXv/Hp27PybS67SmiFW7I+RWnT2OKlMPtw2oUuKeztCe5UWjaj/y5FQIVAPLA -l9RpiU30Z87NRAHY3NTRaqtrAoGANMRxw8UfdtNVR0CrQj3AgPaXOGE4d+G4Gp4X -skvnCHycSVAjtYxebUkzUzt5Q6f/IabuLUdge3gXrc8BetvrcKbp+XZgM0/Vj2CF -Ymmy3in6kzGZq7Fw1sZaku6AOU8vLa5woBT2vAcHLLT1bLAzj7viL048T6MfjrOP -ef8nHvACgYBhDWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah -/XcF3DeRF+eEoz48wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+U -ykSTXYUbtsfTNRFQGBW2/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0CgIVAN4wtL5W -Lv62jKcdskxNyz2NQoBx ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_dsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_dsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_dsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_dsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1kc3MAAACBAIKVofMTa6XSApJTFqHlbRbxSIkvLiFeeAoSqlpSr1JJ1V1j -YsrBV8ofWC3mK5p/UV/M6GwgL0b8YueNi21dlz3Zy/8Z97eBH6zSeLb74xf5P76YT9B2 -KW1e/8enbs/JtLrtKaIVbsj5FadPY4qUw+3DahS4p7O0J7lRaNqP/LkVAAAAFQDywJfU -aYlN9GfOzUQB2NzU0WqrawAAAIA0xHHDxR9201VHQKtCPcCA9pc4YTh34bganheyS+cI -fJxJUCO1jF5tSTNTO3lDp/8hpu4tR2B7eBetzwF62+twpun5dmAzT9WPYIViabLeKfqT -MZmrsXDWxlqS7oA5Ty8trnCgFPa8BwcstPVssDOPu+IvTjxPox+Os495/yce8AAAAIBh -DWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah/XcF3DeRF+eEoz48 -wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+UykSTXYUbtsfTNRFQGBW2 -/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0Cg== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_rsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_rsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_rsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_rsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8semM4q843337 -zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RWRWzjaxSB -6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4QIDAQAB -AoGANmvJzJO5hkLuvyDZHKfAnGTtpifcR1wtSa9DjdKUyn8vhKF0mIimnbnYQEmW -NUUb3gXCZLi9PvkpRSVRrASDOZwcjoU/Kvww163vBUVb2cOZfFhyn6o2Sk88Tt++ -udH3hdjpf9i7jTtUkUe+QYPsia+wgvvrmn4QrahLAH86+kECQQDx5gFeXTME3cnW -WMpFz3PPumduzjqgqMMWEccX4FtQkMX/gyGa5UC7OHFyh0N/gSWvPbRHa8A6YgIt -n8DO+fh5AkEAzbqX4DOn8NY6xJIi42q7l/2jIA0RkB6P7YugW5NblhqBZ0XDnpA5 -sMt+rz+K07u9XZtxgh1xi7mNfwY6lEAMqQJBAJBEauCKmRj35Z6OyeQku59SPsnY -+SJEREVvSNw2lH9SOKQQ4wPsYlTGbvKtNVZgAcen91L5MmYfeckYE/fdIZECQQCt -64zxsTnM1I8iFxj/gP/OYlJBikrKt8udWmjaghzvLMEw+T2DExJyb9ZNeT53+UMB -m6O+B/4xzU/djvp+0hbhAkAemIt+rA5kTmYlFndhpvzkSSM8a2EXsO4XIPgGWCTT -tQKS/tTly0ADMjN/TVy11+9d6zcqadNVuHXHGtR4W0GR ------END RSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_rsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_rsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_rsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE_data/ssh_host_rsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1yc2EAAAADAQABAAAAgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8 -semM4q843337zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RW -RWzjaxSB6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4Q== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_sup_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_sup_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,193 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ssh_sup_SUITE). --include_lib("common_test/include/ct.hrl"). --include_lib("ssh/src/ssh.hrl"). - -%% Note: This directive should only be used in test suites. --compile(export_all). - --define(WAIT_FOR_SHUTDOWN, 500). --define(USER, "Alladin"). --define(PASSWD, "Sesame"). - -%%-------------------------------------------------------------------- -%% Common Test interface functions ----------------------------------- -%%-------------------------------------------------------------------- - -all() -> - [default_tree, sshc_subtree, sshd_subtree, sshd_subtree_profile]. - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -init_per_suite(Config) -> - Port = ssh_test_lib:inet_port(node()), - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - [{userdir, UserDir},{port, Port}, {host, "localhost"}, {host_ip, any} | Config]. - -end_per_suite(_) -> - ok. - -init_per_testcase(sshc_subtree, Config) -> - ssh:start(), - SystemDir = ?config(data_dir, Config), - {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, - {failfun, fun ssh_test_lib:failfun/2}, - {user_passwords, - [{?USER, ?PASSWD}]}]), - [{server, {Pid, Host, Port}} | Config]; -init_per_testcase(Case, Config) -> - end_per_testcase(Case, Config), - ssh:start(), - Config. -end_per_testcase(sshc_subtree, Config) -> - {Pid,_,_} = ?config(server, Config), - ssh:stop_daemon(Pid), - ssh:stop(); -end_per_testcase(_, _Config) -> - ssh:stop(). - -%%------------------------------------------------------------------------- -%% Test cases -%%------------------------------------------------------------------------- -default_tree() -> - [{doc, "Makes sure the correct processes are started and linked," - "in the default case."}]. -default_tree(Config) when is_list(Config) -> - TopSupChildren = supervisor:which_children(ssh_sup), - 2 = length(TopSupChildren), - {value, {sshc_sup, _, supervisor,[sshc_sup]}} = - lists:keysearch(sshc_sup, 1, TopSupChildren), - {value, {sshd_sup, _,supervisor,[sshd_sup]}} = - lists:keysearch(sshd_sup, 1, TopSupChildren), - [] = supervisor:which_children(sshc_sup), - [] = supervisor:which_children(sshd_sup). - -sshc_subtree() -> - [{doc, "Make sure the sshc subtree is correct"}]. -sshc_subtree(Config) when is_list(Config) -> - {_Pid, Host, Port} = ?config(server, Config), - UserDir = ?config(userdir, Config), - - [] = supervisor:which_children(sshc_sup), - {ok, Pid1} = ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user_interaction, false}, - {user, ?USER}, {password, ?PASSWD},{user_dir, UserDir}]), - [{_, _,supervisor,[ssh_connection_handler]}] = - supervisor:which_children(sshc_sup), - {ok, Pid2} = ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user_interaction, false}, - {user, ?USER}, {password, ?PASSWD}, {user_dir, UserDir}]), - [{_,_,supervisor,[ssh_connection_handler]}, - {_,_,supervisor,[ssh_connection_handler]}] = - supervisor:which_children(sshc_sup), - ssh:close(Pid1), - [{_,_,supervisor,[ssh_connection_handler]}] = - supervisor:which_children(sshc_sup), - ssh:close(Pid2), - ct:sleep(?WAIT_FOR_SHUTDOWN), - [] = supervisor:which_children(sshc_sup). - -sshd_subtree() -> - [{doc, "Make sure the sshd subtree is correct"}]. -sshd_subtree(Config) when is_list(Config) -> - HostIP = ?config(host_ip, Config), - Port = ?config(port, Config), - SystemDir = ?config(data_dir, Config), - ssh:daemon(HostIP, Port, [{system_dir, SystemDir}, - {failfun, fun ssh_test_lib:failfun/2}, - {user_passwords, - [{?USER, ?PASSWD}]}]), - [{{server,ssh_system_sup, HostIP, Port, ?DEFAULT_PROFILE}, - Daemon, supervisor, - [ssh_system_sup]}] = - supervisor:which_children(sshd_sup), - check_sshd_system_tree(Daemon, Config), - ssh:stop_daemon(HostIP, Port), - ct:sleep(?WAIT_FOR_SHUTDOWN), - [] = supervisor:which_children(sshd_sup). - -sshd_subtree_profile() -> - [{doc, "Make sure the sshd subtree using profile option is correct"}]. -sshd_subtree_profile(Config) when is_list(Config) -> - HostIP = ?config(host_ip, Config), - Port = ?config(port, Config), - Profile = ?config(profile, Config), - SystemDir = ?config(data_dir, Config), - - {ok, _} = ssh:daemon(HostIP, Port, [{system_dir, SystemDir}, - {failfun, fun ssh_test_lib:failfun/2}, - {user_passwords, - [{?USER, ?PASSWD}]}, - {profile, Profile}]), - [{{server,ssh_system_sup, HostIP,Port,Profile}, - Daemon, supervisor, - [ssh_system_sup]}] = - supervisor:which_children(sshd_sup), - check_sshd_system_tree(Daemon, Config), - ssh:stop_daemon(HostIP, Port, Profile), - ct:sleep(?WAIT_FOR_SHUTDOWN), - [] = supervisor:which_children(sshd_sup). - - -check_sshd_system_tree(Daemon, Config) -> - Host = ?config(host, Config), - Port = ?config(port, Config), - UserDir = ?config(userdir, Config), - {ok, Client} = ssh:connect(Host, Port, [{silently_accept_hosts, true}, - {user_interaction, false}, - {user, ?USER}, {password, ?PASSWD},{user_dir, UserDir}]), - - [{_,SubSysSup, supervisor,[ssh_subsystem_sup]}, - {{ssh_acceptor_sup,_,_,_}, AccSup, supervisor,[ssh_acceptor_sup]}] - = supervisor:which_children(Daemon), - - [{{server,ssh_connection_sup, _,_}, - ConnectionSup, supervisor, - [ssh_connection_sup]}, - {{server,ssh_channel_sup,_ ,_}, - ChannelSup,supervisor, - [ssh_channel_sup]}] = supervisor:which_children(SubSysSup), - - [{{ssh_acceptor_sup,_,_,_},_,worker,[ssh_acceptor]}] = - supervisor:which_children(AccSup), - - [{_, _, worker,[ssh_connection_handler]}] = - supervisor:which_children(ConnectionSup), - - [] = supervisor:which_children(ChannelSup), - - ssh_sftp:start_channel(Client), - - [{_, _,worker,[ssh_channel]}] = - supervisor:which_children(ChannelSup), - ssh:close(Client). - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_test_lib.erl erlang-17.3-dfsg/lib/ssh/test/ssh_test_lib.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,8 +26,6 @@ -include_lib("public_key/include/public_key.hrl"). -include_lib("common_test/include/ct.hrl"). --include_lib("ssh/src/ssh_transport.hrl"). - -define(TIMEOUT, 50000). @@ -67,61 +64,6 @@ end. -std_daemon(Config, ExtraOpts) -> - PrivDir = ?config(priv_dir, Config), - UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth - file:make_dir(UserDir), - std_daemon1(Config, - ExtraOpts ++ - [{user_dir, UserDir}, - {user_passwords, [{"usr1","pwd1"}]}]). - -std_daemon1(Config, ExtraOpts) -> - SystemDir = ?config(data_dir, Config), - {_Server, _Host, _Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, - {failfun, fun ssh_test_lib:failfun/2} - | ExtraOpts]). - -std_connect(Config, Host, Port, ExtraOpts) -> - UserDir = ?config(priv_dir, Config), - _ConnectionRef = - ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true}, - {user_dir, UserDir}, - {user, "usr1"}, - {password, "pwd1"}, - {user_interaction, false} - | ExtraOpts]). - -std_simple_sftp(Host, Port, Config) -> - std_simple_sftp(Host, Port, Config, []). - -std_simple_sftp(Host, Port, Config, Opts) -> - UserDir = ?config(priv_dir, Config), - DataFile = filename:join(UserDir, "test.data"), - ConnectionRef = ssh_test_lib:std_connect(Config, Host, Port, Opts), - {ok, ChannelRef} = ssh_sftp:start_channel(ConnectionRef), - Data = crypto:rand_bytes(proplists:get_value(std_simple_sftp_size,Config,10)), - ok = ssh_sftp:write_file(ChannelRef, DataFile, Data), - {ok,ReadData} = file:read_file(DataFile), - ok = ssh:close(ConnectionRef), - Data == ReadData. - -std_simple_exec(Host, Port, Config) -> - std_simple_exec(Host, Port, Config, []). - -std_simple_exec(Host, Port, Config, Opts) -> - ConnectionRef = ssh_test_lib:std_connect(Config, Host, Port, Opts), - {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), - success = ssh_connection:exec(ConnectionRef, ChannelId, "23+21-2.", infinity), - Data = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"42\n">>}}, - case ssh_test_lib:receive_exec_result(Data) of - expected -> - ok; - Other -> - ct:fail(Other) - end, - ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId). - start_shell(Port, IOServer, UserDir) -> start_shell(Port, IOServer, UserDir, []). @@ -154,18 +96,16 @@ {input, TestCase, Line} -> loop_io_server(TestCase, Buff0 ++ [Line]); {io_request, From, ReplyAs, Request} -> -%%ct:log("~p",[{io_request, From, ReplyAs, Request}]), +%%ct:pal("~p",[{io_request, From, ReplyAs, Request}]), {ok, Reply, Buff} = io_request(Request, TestCase, From, ReplyAs, Buff0), -%%ct:log("io_request(~p)-->~p",[Request,{ok, Reply, Buff}]), +%%ct:pal("io_request(~p)-->~p",[Request,{ok, Reply, Buff}]), io_reply(From, ReplyAs, Reply), loop_io_server(TestCase, Buff); {'EXIT',_, _} -> erlang:display('ssh_test_lib:loop_io_server/2 EXIT'), ok - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. + end. io_request({put_chars, Chars}, TestCase, _, _, Buff) -> reply(TestCase, Chars), @@ -173,9 +113,6 @@ io_request({put_chars, unicode, Chars}, TestCase, _, _, Buff) when is_binary(Chars) -> reply(TestCase, Chars), {ok, ok, Buff}; -io_request({put_chars, unicode, io_lib, format, [Fmt,Args]}, TestCase, _, _, Buff) -> - reply(TestCase, io_lib:format(Fmt,Args)), - {ok, ok, Buff}; io_request({put_chars, Enc, Chars}, TestCase, _, _, Buff) -> reply(TestCase, unicode:characters_to_binary(Chars,Enc,latin1)), {ok, ok, Buff}; @@ -193,29 +130,27 @@ io_reply(_, _, []) -> ok; io_reply(From, ReplyAs, Reply) -> -%%ct:log("io_reply ~p sending ~p ! ~p",[self(),From, {io_reply, ReplyAs, Reply}]), +%%ct:pal("io_reply ~p sending ~p ! ~p",[self(),From, {io_reply, ReplyAs, Reply}]), From ! {io_reply, ReplyAs, Reply}. reply(_, []) -> ok; reply(TestCase, Result) -> -%%ct:log("reply ~p sending ~p ! ~p",[self(), TestCase, Result]), +%%ct:pal("reply ~p sending ~p ! ~p",[self(), TestCase, Result]), TestCase ! Result. receive_exec_result(Msg) -> - ct:log("Expect data! ~p", [Msg]), + ct:pal("Expect data! ~p", [Msg]), receive {ssh_cm,_,{data,_,1, Data}} -> - ct:log("StdErr: ~p~n", [Data]), + ct:pal("StdErr: ~p~n", [Data]), receive_exec_result(Msg); Msg -> - ct:log("1: Collected data ~p", [Msg]), + ct:pal("1: Collected data ~p", [Msg]), expected; Other -> - ct:log("Other ~p", [Other]), + ct:pal("Other ~p", [Other]), {unexpected_msg, Other} - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) end. @@ -226,15 +161,15 @@ case receive_exec_result(ExitStatus) of {unexpected_msg, Eof} -> %% Open ssh seems to not allways send these messages %% in the same order! - ct:log("2: Collected data ~p", [Eof]), + ct:pal("2: Collected data ~p", [Eof]), case receive_exec_result(ExitStatus) of expected -> expected = receive_exec_result(Closed); {unexpected_msg, Closed} -> - ct:log("3: Collected data ~p", [Closed]) + ct:pal("3: Collected data ~p", [Closed]) end; expected -> - ct:log("4: Collected data ~p", [ExitStatus]), + ct:pal("4: Collected data ~p", [ExitStatus]), expected = receive_exec_result(Eof), expected = receive_exec_result(Closed); Other -> @@ -296,7 +231,6 @@ file:make_dir(System), file:copy(filename:join(DataDir, "ssh_host_dsa_key"), filename:join(System, "ssh_host_dsa_key")), file:copy(filename:join(DataDir, "ssh_host_dsa_key.pub"), filename:join(System, "ssh_host_dsa_key.pub")), -ct:log("DataDir ~p:~n ~p~n~nSystDir ~p:~n ~p~n~nUserDir ~p:~n ~p",[DataDir, file:list_dir(DataDir), System, file:list_dir(System), UserDir, file:list_dir(UserDir)]), setup_dsa_known_host(DataDir, UserDir), setup_dsa_auth_keys(DataDir, UserDir). @@ -305,21 +239,10 @@ System = filename:join(UserDir, "system"), file:make_dir(System), file:copy(filename:join(DataDir, "ssh_host_rsa_key"), filename:join(System, "ssh_host_rsa_key")), - file:copy(filename:join(DataDir, "ssh_host_rsa_key.pub"), filename:join(System, "ssh_host_rsa_key.pub")), -ct:log("DataDir ~p:~n ~p~n~nSystDir ~p:~n ~p~n~nUserDir ~p:~n ~p",[DataDir, file:list_dir(DataDir), System, file:list_dir(System), UserDir, file:list_dir(UserDir)]), + file:copy(filename:join(DataDir, "ssh_host_rsa_key"), filename:join(System, "ssh_host_rsa_key.pub")), setup_rsa_known_host(DataDir, UserDir), setup_rsa_auth_keys(DataDir, UserDir). -setup_ecdsa(Size, DataDir, UserDir) -> - file:copy(filename:join(DataDir, "id_ecdsa"++Size), filename:join(UserDir, "id_ecdsa")), - System = filename:join(UserDir, "system"), - file:make_dir(System), - file:copy(filename:join(DataDir, "ssh_host_ecdsa_key"++Size), filename:join(System, "ssh_host_ecdsa_key")), - file:copy(filename:join(DataDir, "ssh_host_ecdsa_key"++Size++".pub"), filename:join(System, "ssh_host_ecdsa_key.pub")), -ct:log("DataDir ~p:~n ~p~n~nSystDir ~p:~n ~p~n~nUserDir ~p:~n ~p",[DataDir, file:list_dir(DataDir), System, file:list_dir(System), UserDir, file:list_dir(UserDir)]), - setup_ecdsa_known_host(Size, System, UserDir), - setup_ecdsa_auth_keys(Size, UserDir, UserDir). - clean_dsa(UserDir) -> del_dirs(filename:join(UserDir, "system")), file:delete(filename:join(UserDir,"id_dsa")), @@ -371,11 +294,6 @@ [{Key, _}] = public_key:ssh_decode(SshBin, public_key), setup_known_hosts(Key, UserDir). -setup_ecdsa_known_host(_Size, SystemDir, UserDir) -> - {ok, SshBin} = file:read_file(filename:join(SystemDir, "ssh_host_ecdsa_key.pub")), - [{Key, _}] = public_key:ssh_decode(SshBin, public_key), - setup_known_hosts(Key, UserDir). - setup_known_hosts(Key, UserDir) -> {ok, Hostname} = inet:gethostname(), {ok, {A, B, C, D}} = inet:getaddr(Hostname, inet), @@ -403,14 +321,6 @@ PKey = #'RSAPublicKey'{publicExponent = E, modulus = N}, setup_auth_keys([{ PKey, [{comment, "Test"}]}], UserDir). -setup_ecdsa_auth_keys(_Size, Dir, UserDir) -> - {ok, Pem} = file:read_file(filename:join(Dir, "id_ecdsa")), - ECDSA = public_key:pem_entry_decode(hd(public_key:pem_decode(Pem))), - #'ECPrivateKey'{publicKey = Q, - parameters = Param = {namedCurve,_Id0}} = ECDSA, - PKey = #'ECPoint'{point = Q}, - setup_auth_keys([{ {PKey,Param}, [{comment, "Test"}]}], UserDir). - setup_auth_keys(Keys, Dir) -> AuthKeys = public_key:ssh_encode(Keys, auth_keys), AuthKeysFile = filename:join(Dir, "authorized_keys"), @@ -445,216 +355,3 @@ {ok, Socket} = rpc:call(Node, gen_tcp, listen, [0, [{reuseaddr, true}]]), {ok, Port} = rpc:call(Node, inet, port, [Socket]), {Port, Socket}. - -openssh_sanity_check(Config) -> - ssh:start(), - case ssh:connect("localhost", 22, [{password,""}]) of - {ok, Pid} -> - ssh:close(Pid), - ssh:stop(), - Config; - Err -> - Str = lists:append(io_lib:format("~p", [Err])), - ssh:stop(), - {skip, Str} - end. - -openssh_supports(ClientOrServer, Tag, Alg) when ClientOrServer == sshc ; - ClientOrServer == sshd -> - SSH_algos = ssh_test_lib:default_algorithms(ClientOrServer), - L = proplists:get_value(Tag, SSH_algos, []), - lists:member(Alg, L) orelse - lists:member(Alg, proplists:get_value(client2server, L, [])) orelse - lists:member(Alg, proplists:get_value(server2client, L, [])). - -%%-------------------------------------------------------------------- -%% Check if we have a "newer" ssh client that supports these test cases - -ssh_client_supports_Q() -> - ErlPort = open_port({spawn, "ssh -Q cipher"}, [exit_status, stderr_to_stdout]), - 0 == check_ssh_client_support2(ErlPort). - -check_ssh_client_support2(P) -> - receive - {P, {data, _A}} -> - check_ssh_client_support2(P); - {P, {exit_status, E}} -> - E - after 5000 -> - - ct:log("Openssh command timed out ~n"), - -1 - end. - -%%%-------------------------------------------------------------------- -%%% Probe a server or a client about algorithm support - -default_algorithms(sshd) -> - default_algorithms(sshd, "localhost", 22); - -default_algorithms(sshc) -> - default_algorithms(sshc, []). - -default_algorithms(sshd, Host, Port) -> - try run_fake_ssh( - ssh_trpt_test_lib:exec( - [{connect,Host,Port, [{silently_accept_hosts, true}, - {user_interaction, false}]}])) - catch - _C:_E -> - ct:log("***~p:~p: ~p:~p",[?MODULE,?LINE,_C,_E]), - [] - end. - -default_algorithms(sshc, DaemonOptions) -> - Parent = self(), - %% Start a process handling one connection on the server side: - Srvr = - spawn_link( - fun() -> - Parent ! - {result, self(), - try - {ok,InitialState} = ssh_trpt_test_lib:exec(listen), - Parent ! {hostport,self(),ssh_trpt_test_lib:server_host_port(InitialState)}, - run_fake_ssh( - ssh_trpt_test_lib:exec([{accept, DaemonOptions}], - InitialState)) - catch - _C:_E -> - ct:log("***~p:~p: ~p:~p",[?MODULE,?LINE,_C,_E]), - [] - end} - end), - - receive - {hostport,Srvr,{_Host,Port}} -> - spawn(fun()-> os:cmd(lists:concat(["ssh -o \"StrictHostKeyChecking no\" -p ",Port," localhost"])) end) - after ?TIMEOUT -> - ct:fail("No server respons 1") - end, - - receive - {result,Srvr,L} -> - L - after ?TIMEOUT -> - ct:fail("No server respons 2") - end. - - -run_fake_ssh({ok,InitialState}) -> - KexInitPattern = - #ssh_msg_kexinit{ - kex_algorithms = '$kex_algorithms', - server_host_key_algorithms = '$server_host_key_algorithms', - encryption_algorithms_client_to_server = '$encryption_algorithms_client_to_server', - encryption_algorithms_server_to_client = '$encryption_algorithms_server_to_client', - mac_algorithms_client_to_server = '$mac_algorithms_client_to_server', - mac_algorithms_server_to_client = '$mac_algorithms_server_to_client', - compression_algorithms_client_to_server = '$compression_algorithms_client_to_server', - compression_algorithms_server_to_client = '$compression_algorithms_server_to_client', - _ = '_' - }, - {ok,E} = ssh_trpt_test_lib:exec([{set_options,[silent]}, - {send, hello}, - receive_hello, - {send, ssh_msg_kexinit}, - {match, KexInitPattern, receive_msg}, - close_socket - ], - InitialState), - [Kex, PubKey, EncC2S, EncS2C, MacC2S, MacS2C, CompC2S, CompS2C] = - ssh_trpt_test_lib:instantiate(['$kex_algorithms', - '$server_host_key_algorithms', - '$encryption_algorithms_client_to_server', - '$encryption_algorithms_server_to_client', - '$mac_algorithms_client_to_server', - '$mac_algorithms_server_to_client', - '$compression_algorithms_client_to_server', - '$compression_algorithms_server_to_client' - ], E), - [{kex, to_atoms(Kex)}, - {public_key, to_atoms(PubKey)}, - {cipher, [{client2server, to_atoms(EncC2S)}, - {server2client, to_atoms(EncS2C)}]}, - {mac, [{client2server, to_atoms(MacC2S)}, - {server2client, to_atoms(MacS2C)}]}, - {compression, [{client2server, to_atoms(CompC2S)}, - {server2client, to_atoms(CompS2C)}]}]. - - -%%-------------------------------------------------------------------- -sshc(Tag) -> - to_atoms( - string:tokens(os:cmd(lists:concat(["ssh -Q ",Tag])), "\n") - ). - -ssh_type() -> - case os:find_executable("ssh") of - false -> not_found; - _ -> - case os:cmd("ssh -V") of - "OpenSSH" ++ _ -> - openSSH; - Str -> - ct:log("ssh client ~p is unknown",[Str]), - unknown - end - end. - -algo_intersection([], _) -> []; -algo_intersection(_, []) -> []; -algo_intersection(L1=[A1|_], L2=[A2|_]) when is_atom(A1), is_atom(A2) -> - true = lists:all(fun erlang:is_atom/1, L1++L2), - lists:foldr(fun(A,Acc) -> - case lists:member(A,L2) of - true -> [A|Acc]; - false -> Acc - end - end, [], L1); -algo_intersection([{K,V1}|T1], L2) -> - case lists:keysearch(K,1,L2) of - {value, {K,V2}} -> - [{K,algo_intersection(V1,V2)} | algo_intersection(T1,L2)]; - false -> - algo_intersection(T1,L2) - end; -algo_intersection(_, _) -> - []. - - -to_atoms(L) -> lists:map(fun erlang:list_to_atom/1, L). - -%%%---------------------------------------------------------------- -ssh_supports(Alg, SshDefaultAlg_tag) -> - SupAlgs = - case proplists:get_value(SshDefaultAlg_tag, - ssh:default_algorithms()) of - [{_K1,L1}, {_K2,L2}] -> - lists:usort(L1++L2); - L -> - L - end, - if - is_atom(Alg) -> - lists:member(Alg, SupAlgs); - is_list(Alg) -> - case Alg--SupAlgs of - [] -> - true; - UnSup -> - {false,UnSup} - end - end. - -%%%---------------------------------------------------------------- -has_inet6_address() -> - try - [throw(6) || {ok,L} <- [inet:getifaddrs()], - {_,L1} <- L, - {addr,{_,_,_,_,_,_,_,_}} <- L1] - of - [] -> false - catch - throw:6 -> true - end. diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_to_openssh_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_to_openssh_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_to_openssh_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_to_openssh_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -45,26 +44,29 @@ groups() -> [{erlang_client, [], [erlang_shell_client_openssh_server, + erlang_client_openssh_server_exec, erlang_client_openssh_server_exec_compressed, erlang_client_openssh_server_setenv, erlang_client_openssh_server_publickey_rsa, erlang_client_openssh_server_publickey_dsa, erlang_client_openssh_server_password, - erlang_client_openssh_server_kexs, erlang_client_openssh_server_nonexistent_subsystem ]}, - {erlang_server, [], [erlang_server_openssh_client_public_key_dsa]} + {erlang_server, [], [erlang_server_openssh_client_exec, + erlang_server_openssh_client_exec_compressed, + erlang_server_openssh_client_pulic_key_dsa, + erlang_server_openssh_client_cipher_suites, + erlang_server_openssh_client_macs]} ]. init_per_suite(Config) -> - catch crypto:stop(), case catch crypto:start() of ok -> case gen_tcp:connect("localhost", 22, []) of {error,econnrefused} -> {skip,"No openssh deamon"}; _ -> - ssh_test_lib:openssh_sanity_check(Config) + Config end; _Else -> {skip,"Could not start crypto!"} @@ -79,11 +81,6 @@ UserDir = ?config(priv_dir, Config), ssh_test_lib:setup_dsa_known_host(DataDir, UserDir), Config; -init_per_group(erlang_client, Config) -> - CommonAlgs = ssh_test_lib:algo_intersection( - ssh:default_algorithms(), - ssh_test_lib:default_algorithms(sshd)), - [{common_algs,CommonAlgs} | Config]; init_per_group(_, Config) -> Config. @@ -94,11 +91,12 @@ end_per_group(_, Config) -> Config. +init_per_testcase(erlang_server_openssh_client_cipher_suites, Config) -> + check_ssh_client_support(Config); + +init_per_testcase(erlang_server_openssh_client_macs, Config) -> + check_ssh_client_support(Config); -init_per_testcase(erlang_server_openssh_client_public_key_dsa, Config) -> - chk_key(sshc, 'ssh-dss', ".ssh/id_dsa", Config); -init_per_testcase(erlang_client_openssh_server_publickey_dsa, Config) -> - chk_key(sshd, 'ssh-dss', ".ssh/id_dsa", Config); init_per_testcase(_TestCase, Config) -> ssh:start(), Config. @@ -107,27 +105,6 @@ ssh:stop(), ok. - -chk_key(Pgm, Name, File, Config) -> - case ssh_test_lib:openssh_supports(Pgm, public_key, Name) of - true -> - {skip,lists:concat(["openssh client does not support ",Name])}; - false -> - {ok,[[Home]]} = init:get_argument(home), - KeyFile = filename:join(Home, File), - case file:read_file(KeyFile) of - {ok, Pem} -> - case public_key:pem_decode(Pem) of - [{_,_, not_encrypted}] -> - init_per_testcase('__default__',Config); - _ -> - {skip, {error, "Has pass phrase can not be used by automated test case"}} - end; - _ -> - {skip, lists:concat(["no ~/",File])} - end - end. - %%-------------------------------------------------------------------- %% Test Cases -------------------------------------------------------- %%-------------------------------------------------------------------- @@ -142,9 +119,22 @@ IO ! {input, self(), "echo Hej\n"}, receive_hej(), IO ! {input, self(), "exit\n"}, - receive_logout(), - receive_normal_exit(Shell). - + receive + <<"logout">> -> + receive + <<"Connection closed">> -> + ok + end; + Other0 -> + ct:fail({unexpected_msg, Other0}) + end, + receive + {'EXIT', Shell, normal} -> + ok; + Other1 -> + ct:fail({unexpected_msg, Other1}) + end. + %-------------------------------------------------------------------- erlang_client_openssh_server_exec() -> [{doc, "Test api function ssh_connection:exec"}]. @@ -161,7 +151,7 @@ ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId0); {unexpected_msg,{ssh_cm, ConnectionRef, {exit_status, ChannelId0, 0}} = ExitStatus0} -> - ct:log("0: Collected data ~p", [ExitStatus0]), + ct:pal("0: Collected data ~p", [ExitStatus0]), ssh_test_lib:receive_exec_result(Data0, ConnectionRef, ChannelId0); Other0 -> @@ -177,7 +167,7 @@ ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId1); {unexpected_msg,{ssh_cm, ConnectionRef, {exit_status, ChannelId1, 0}} = ExitStatus1} -> - ct:log("0: Collected data ~p", [ExitStatus1]), + ct:pal("0: Collected data ~p", [ExitStatus1]), ssh_test_lib:receive_exec_result(Data1, ConnectionRef, ChannelId1); Other1 -> @@ -189,81 +179,184 @@ [{doc, "Test that compression option works"}]. erlang_client_openssh_server_exec_compressed(Config) when is_list(Config) -> - CompressAlgs = [zlib, 'zlib@openssh.com',none], - case ssh_test_lib:ssh_supports(CompressAlgs, compression) of - {false,L} -> - {skip, io_lib:format("~p compression is not supported",[L])}; - - true -> - ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true}, - {user_interaction, false}, - {preferred_algorithms, - [{compression,CompressAlgs}]}]), - {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), - success = ssh_connection:exec(ConnectionRef, ChannelId, - "echo testing", infinity), - Data = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"testing\n">>}}, - case ssh_test_lib:receive_exec_result(Data) of - expected -> - ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId); - {unexpected_msg,{ssh_cm, ConnectionRef, - {exit_status, ChannelId, 0}} = ExitStatus} -> - ct:log("0: Collected data ~p", [ExitStatus]), - ssh_test_lib:receive_exec_result(Data, ConnectionRef, ChannelId); - Other -> - ct:fail(Other) - end + ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true}, + {user_interaction, false}, + {compression, zlib}]), + {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), + success = ssh_connection:exec(ConnectionRef, ChannelId, + "echo testing", infinity), + Data = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"testing\n">>}}, + case ssh_test_lib:receive_exec_result(Data) of + expected -> + ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId); + {unexpected_msg,{ssh_cm, ConnectionRef, + {exit_status, ChannelId, 0}} = ExitStatus} -> + ct:pal("0: Collected data ~p", [ExitStatus]), + ssh_test_lib:receive_exec_result(Data, ConnectionRef, ChannelId); + Other -> + ct:fail(Other) end. %%-------------------------------------------------------------------- -erlang_client_openssh_server_kexs() -> - [{doc, "Test that we can connect with different KEXs."}]. - -erlang_client_openssh_server_kexs(Config) when is_list(Config) -> - KexAlgos = try proplists:get_value(kex, ?config(common_algs,Config)) - catch _:_ -> [] - end, - comment(KexAlgos), - case KexAlgos of - [] -> {skip, "No common kex algorithms"}; - _ -> - Success = - lists:foldl( - fun(Kex, Acc) -> - ConnectionRef = - ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true}, - {user_interaction, false}, - {preferred_algorithms, - [{kex,[Kex]}]}]), - - {ok, ChannelId} = - ssh_connection:session_channel(ConnectionRef, infinity), - success = - ssh_connection:exec(ConnectionRef, ChannelId, - "echo testing", infinity), - - ExpectedData = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"testing\n">>}}, - case ssh_test_lib:receive_exec_result(ExpectedData) of - expected -> - ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId), - Acc; - {unexpected_msg,{ssh_cm, ConnectionRef, - {exit_status, ChannelId, 0}} = ExitStatus} -> - ct:log("0: Collected data ~p", [ExitStatus]), - ssh_test_lib:receive_exec_result(ExpectedData, ConnectionRef, ChannelId), - Acc; - Other -> - ct:log("~p failed: ~p",[Kex,Other]), - false - end - end, true, KexAlgos), - case Success of - true -> - ok; - false -> - {fail, "Kex failed for one or more algos"} - end - end. +erlang_server_openssh_client_exec() -> + [{doc, "Test that exec command works."}]. + +erlang_server_openssh_client_exec(Config) when is_list(Config) -> + SystemDir = ?config(data_dir, Config), + PrivDir = ?config(priv_dir, Config), + KnownHosts = filename:join(PrivDir, "known_hosts"), + + {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, + {failfun, fun ssh_test_lib:failfun/2}]), + + + ct:sleep(500), + + Cmd = "ssh -p " ++ integer_to_list(Port) ++ + " -o UserKnownHostsFile=" ++ KnownHosts ++ " " ++ Host ++ " 1+1.", + + ct:pal("Cmd: ~p~n", [Cmd]), + + SshPort = open_port({spawn, Cmd}, [binary]), + + receive + {SshPort,{data, <<"2\n">>}} -> + ok + after ?TIMEOUT -> + ct:fail("Did not receive answer") + + end, + ssh:stop_daemon(Pid). + +%%-------------------------------------------------------------------- +erlang_server_openssh_client_cipher_suites() -> + [{doc, "Test that we can connect with different cipher suites."}]. + +erlang_server_openssh_client_cipher_suites(Config) when is_list(Config) -> + SystemDir = ?config(data_dir, Config), + PrivDir = ?config(priv_dir, Config), + KnownHosts = filename:join(PrivDir, "known_hosts"), + + {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, + {failfun, fun ssh_test_lib:failfun/2}]), + + + ct:sleep(500), + + Supports = crypto:supports(), + Ciphers = proplists:get_value(ciphers, Supports), + Tests = [ + {"3des-cbc", lists:member(des3_cbc, Ciphers)}, + {"aes128-cbc", lists:member(aes_cbc128, Ciphers)}, + {"aes128-ctr", lists:member(aes_ctr, Ciphers)}, + {"aes256-cbc", false} + ], + lists:foreach(fun({Cipher, Expect}) -> + Cmd = "ssh -p " ++ integer_to_list(Port) ++ + " -o UserKnownHostsFile=" ++ KnownHosts ++ " " ++ Host ++ " " ++ + " -c " ++ Cipher ++ " 1+1.", + + ct:pal("Cmd: ~p~n", [Cmd]), + + SshPort = open_port({spawn, Cmd}, [binary, stderr_to_stdout]), + + case Expect of + true -> + receive + {SshPort,{data, <<"2\n">>}} -> + ok + after ?TIMEOUT -> + ct:fail("Did not receive answer") + end; + false -> + receive + {SshPort,{data, <<"no matching cipher found", _/binary>>}} -> + ok + after ?TIMEOUT -> + ct:fail("Did not receive no matching cipher message") + end + end + end, Tests), + + ssh:stop_daemon(Pid). + +%%-------------------------------------------------------------------- +erlang_server_openssh_client_macs() -> + [{doc, "Test that we can connect with different MACs."}]. + +erlang_server_openssh_client_macs(Config) when is_list(Config) -> + SystemDir = ?config(data_dir, Config), + PrivDir = ?config(priv_dir, Config), + KnownHosts = filename:join(PrivDir, "known_hosts"), + + {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, + {failfun, fun ssh_test_lib:failfun/2}]), + + + ct:sleep(500), + + Supports = crypto:supports(), + Hashs = proplists:get_value(hashs, Supports), + MACs = [{"hmac-sha1", lists:member(sha, Hashs)}, + {"hmac-sha2-256", lists:member(sha256, Hashs)}, + {"hmac-md5-96", false}, + {"hmac-ripemd160", false}], + lists:foreach(fun({MAC, Expect}) -> + Cmd = "ssh -p " ++ integer_to_list(Port) ++ + " -o UserKnownHostsFile=" ++ KnownHosts ++ " " ++ Host ++ " " ++ + " -o MACs=" ++ MAC ++ " 1+1.", + + ct:pal("Cmd: ~p~n", [Cmd]), + + SshPort = open_port({spawn, Cmd}, [binary, stderr_to_stdout]), + + case Expect of + true -> + receive + {SshPort,{data, <<"2\n">>}} -> + ok + after ?TIMEOUT -> + ct:fail("Did not receive answer") + end; + false -> + receive + {SshPort,{data, <<"no matching mac found", _/binary>>}} -> + ok + after ?TIMEOUT -> + ct:fail("Did not receive no matching mac message") + end + end + end, MACs), + + ssh:stop_daemon(Pid). + +%%-------------------------------------------------------------------- +erlang_server_openssh_client_exec_compressed() -> + [{doc, "Test that exec command works."}]. + +erlang_server_openssh_client_exec_compressed(Config) when is_list(Config) -> + SystemDir = ?config(data_dir, Config), + PrivDir = ?config(priv_dir, Config), + KnownHosts = filename:join(PrivDir, "known_hosts"), + + {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, + {compression, zlib}, + {failfun, fun ssh_test_lib:failfun/2}]), + + ct:sleep(500), + + Cmd = "ssh -p " ++ integer_to_list(Port) ++ + " -o UserKnownHostsFile=" ++ KnownHosts ++ " -C "++ Host ++ " 1+1.", + SshPort = open_port({spawn, Cmd}, [binary]), + + receive + {SshPort,{data, <<"2\n">>}} -> + ok + after ?TIMEOUT -> + ct:fail("Did not receive answer") + + end, + ssh:stop_daemon(Pid). %%-------------------------------------------------------------------- erlang_client_openssh_server_setenv() -> @@ -293,11 +386,11 @@ {data,0,1, UnxpectedData}}} -> %% Some os may return things as %% ENV_TEST: Undefined variable.\n" - ct:log("UnxpectedData: ~p", [UnxpectedData]), + ct:pal("UnxpectedData: ~p", [UnxpectedData]), ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId); {unexpected_msg,{ssh_cm, ConnectionRef, {exit_status, ChannelId, 0}} = ExitStatus} -> - ct:log("0: Collected data ~p", [ExitStatus]), + ct:pal("0: Collected data ~p", [ExitStatus]), ssh_test_lib:receive_exec_result(Data, ConnectionRef, ChannelId); Other -> @@ -339,20 +432,31 @@ erlang_client_openssh_server_publickey_dsa() -> [{doc, "Validate using dsa publickey."}]. erlang_client_openssh_server_publickey_dsa(Config) when is_list(Config) -> - ConnectionRef = - ssh_test_lib:connect(?SSH_DEFAULT_PORT, - [{public_key_alg, ssh_dsa}, - {user_interaction, false}, - silently_accept_hosts]), - {ok, Channel} = - ssh_connection:session_channel(ConnectionRef, infinity), - ok = ssh_connection:close(ConnectionRef, Channel), - ok = ssh:close(ConnectionRef). - + {ok,[[Home]]} = init:get_argument(home), + KeyFile = filename:join(Home, ".ssh/id_dsa"), + case file:read_file(KeyFile) of + {ok, Pem} -> + case public_key:pem_decode(Pem) of + [{_,_, not_encrypted}] -> + ConnectionRef = + ssh_test_lib:connect(?SSH_DEFAULT_PORT, + [{public_key_alg, ssh_dsa}, + {user_interaction, false}, + silently_accept_hosts]), + {ok, Channel} = + ssh_connection:session_channel(ConnectionRef, infinity), + ok = ssh_connection:close(ConnectionRef, Channel), + ok = ssh:close(ConnectionRef); + _ -> + {skip, {error, "Has pass phrase can not be used by automated test case"}} + end; + _ -> + {skip, "no ~/.ssh/id_dsa"} + end. %%-------------------------------------------------------------------- -erlang_server_openssh_client_public_key_dsa() -> +erlang_server_openssh_client_pulic_key_dsa() -> [{doc, "Validate using dsa publickey."}]. -erlang_server_openssh_client_public_key_dsa(Config) when is_list(Config) -> +erlang_server_openssh_client_pulic_key_dsa(Config) when is_list(Config) -> SystemDir = ?config(data_dir, Config), PrivDir = ?config(priv_dir, Config), KnownHosts = filename:join(PrivDir, "known_hosts"), @@ -360,25 +464,21 @@ {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir}, {public_key_alg, ssh_dsa}, {failfun, fun ssh_test_lib:failfun/2}]), - + ct:sleep(500), Cmd = "ssh -p " ++ integer_to_list(Port) ++ " -o UserKnownHostsFile=" ++ KnownHosts ++ " " ++ Host ++ " 1+1.", - SshPort = open_port({spawn, Cmd}, [binary, stderr_to_stdout]), + SshPort = open_port({spawn, Cmd}, [binary]), receive - {SshPort,{data, <<"2\n">>}} -> + {SshPort,{data, <<"2\n">>}} -> ok after ?TIMEOUT -> - receive - X -> ct:fail("Received: ~p",[X]) - after 0 -> - ct:fail("Did not receive answer") - end + ct:fail("Did not receive answer") end, - ssh:stop_daemon(Pid). + ssh:stop_daemon(Pid). %%-------------------------------------------------------------------- erlang_client_openssh_server_password() -> @@ -388,12 +488,12 @@ UserDir = ?config(data_dir, Config), {error, Reason0} = ssh:connect(any, ?SSH_DEFAULT_PORT, [{silently_accept_hosts, true}, - {user, "foo"}, - {password, "morot"}, - {user_interaction, false}, - {user_dir, UserDir}]), + {user, "foo"}, + {password, "morot"}, + {user_interaction, false}, + {user_dir, UserDir}]), - ct:log("Test of user foo that does not exist. " + ct:pal("Test of user foo that does not exist. " "Error msg: ~p~n", [Reason0]), User = string:strip(os:cmd("whoami"), right, $\n), @@ -407,10 +507,10 @@ {password, "foo"}, {user_interaction, false}, {user_dir, UserDir}]), - ct:log("Test of wrong Pasword. " + ct:pal("Test of wrong Pasword. " "Error msg: ~p~n", [Reason1]); _ -> - ct:log("Whoami failed reason: ~n", []) + ct:pal("Whoami failed reason: ~n", []) end. %%-------------------------------------------------------------------- @@ -437,75 +537,31 @@ %%-------------------------------------------------------------------- receive_hej() -> receive - <<"Hej", _binary>> = Hej -> - ct:log("Expected result: ~p~n", [Hej]); - <<"Hej\n", _binary>> = Hej -> - ct:log("Expected result: ~p~n", [Hej]); - <<"Hej\r\n", _/binary>> = Hej -> - ct:log("Expected result: ~p~n", [Hej]); + <<"Hej\n">> = Hej-> + ct:pal("Expected result: ~p~n", [Hej]); Info -> - Lines = binary:split(Info, [<<"\r\n">>], [global]), - case lists:member(<<"Hej">>, Lines) of - true -> - ct:log("Expected result found in lines: ~p~n", [Lines]), - ok; - false -> - ct:log("Extra info: ~p~n", [Info]), - receive_hej() - end - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. - -receive_logout() -> - receive - <<"logout">> -> - extra_logout(), - receive - <<"Connection closed">> -> - ok - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end; - Info -> - ct:log("Extra info when logging out: ~p~n", [Info]), - receive_logout() - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. - -receive_normal_exit(Shell) -> - receive - {'EXIT', Shell, normal} -> - ok; - <<"\r\n">> -> - receive_normal_exit(Shell); - Other -> - ct:fail({unexpected_msg, Other}) - after - 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE]) - end. - -extra_logout() -> - receive - <<"logout">> -> - ok - after 500 -> - ok + ct:pal("Extra info: ~p~n", [Info]), + receive_hej() end. %%-------------------------------------------------------------------- +%%-------------------------------------------------------------------- %% Check if we have a "newer" ssh client that supports these test cases +%%-------------------------------------------------------------------- check_ssh_client_support(Config) -> - case ssh_test_lib:ssh_client_supports_Q() of - true -> + Port = open_port({spawn, "ssh -Q cipher"}, [exit_status, stderr_to_stdout]), + case check_ssh_client_support2(Port) of + 0 -> % exit status from command (0 == ok) ssh:start(), Config; _ -> {skip, "test case not supported by ssh client"} end. -comment(AtomList) -> - ct:comment( - string:join(lists:map(fun erlang:atom_to_list/1, AtomList), - ", ")). +check_ssh_client_support2(P) -> + receive + {P, {data, _A}} -> + check_ssh_client_support2(P); + {P, {exit_status, E}} -> + E + end. diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_trpt_test_lib.erl erlang-17.3-dfsg/lib/ssh/test/ssh_trpt_test_lib.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_trpt_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_trpt_test_lib.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,772 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ssh_trpt_test_lib). - -%%-compile(export_all). - --export([exec/1, exec/2, - instantiate/2, - format_msg/1, - server_host_port/1 - ] - ). - --include_lib("common_test/include/ct.hrl"). --include_lib("ssh/src/ssh.hrl"). % ?UINT32, ?BYTE, #ssh{} ... --include_lib("ssh/src/ssh_transport.hrl"). --include_lib("ssh/src/ssh_auth.hrl"). - -%%%---------------------------------------------------------------- --record(s, { - socket, - listen_socket, - opts = [], - timeout = 5000, % ms - seen_hello = false, - enc = <<>>, - ssh = #ssh{}, % #ssh{} - alg_neg = {undefined,undefined}, % {own_kexinit, peer_kexinit} - alg, % #alg{} - vars = dict:new(), - reply = [], % Some repy msgs are generated hidden in ssh_transport :[ - prints = [], - return_value - }). - --define(role(S), ((S#s.ssh)#ssh.role) ). - - -server_host_port(S=#s{}) -> - {Host,Port} = ok(inet:sockname(S#s.listen_socket)), - {host(Host), Port}. - - -%%% Options: {print_messages, false} true|detail -%%% {print_seqnums,false} true -%%% {print_ops,false} true - -exec(L) -> exec(L, #s{}). - -exec(L, S) when is_list(L) -> lists:foldl(fun exec/2, S, L); - -exec(Op, S0=#s{}) -> - S1 = init_op_traces(Op, S0), - try seqnum_trace( - op(Op, S1)) - of - S = #s{} -> - case proplists:get_value(silent,S#s.opts) of - true -> ok; - _ -> print_traces(S) - end, - {ok,S} - catch - {fail,Reason,Se} -> - report_trace('', Reason, Se), - {error,{Op,Reason,Se}}; - - throw:Term -> - report_trace(throw, Term, S1), - throw(Term); - - error:Error -> - report_trace(error, Error, S1), - error(Error); - - exit:Exit -> - report_trace(exit, Exit, S1), - exit(Exit) - end; -exec(Op, {ok,S=#s{}}) -> exec(Op, S); -exec(_, Error) -> Error. - - -%%%---- Server ops -op(listen, S) when ?role(S) == undefined -> op({listen,0}, S); - -op({listen,Port}, S) when ?role(S) == undefined -> - S#s{listen_socket = ok(gen_tcp:listen(Port, mangle_opts([]))), - ssh = (S#s.ssh)#ssh{role=server} - }; - -op({accept,Opts}, S) when ?role(S) == server -> - {ok,Socket} = gen_tcp:accept(S#s.listen_socket, S#s.timeout), - {Host,_Port} = ok(inet:sockname(Socket)), - S#s{socket = Socket, - ssh = init_ssh(server,Socket,[{host,host(Host)}|Opts]), - return_value = ok}; - -%%%---- Client ops -op({connect,Host,Port,Opts}, S) when ?role(S) == undefined -> - Socket = ok(gen_tcp:connect(host(Host), Port, mangle_opts([]))), - S#s{socket = Socket, - ssh = init_ssh(client, Socket, [{host,host(Host)}|Opts]), - return_value = ok}; - -%%%---- ops for both client and server -op(close_socket, S) -> - catch tcp_gen:close(S#s.socket), - catch tcp_gen:close(S#s.listen_socket), - S#s{socket = undefined, - listen_socket = undefined, - return_value = ok}; - -op({set_options,Opts}, S) -> - S#s{opts = Opts}; - -op({send,X}, S) -> - send(S, instantiate(X,S)); - -op(receive_hello, S0) when S0#s.seen_hello =/= true -> - case recv(S0) of - S1=#s{return_value={hello,_}} -> S1; - S1=#s{} -> op(receive_hello, receive_wait(S1)) - end; - -op(receive_msg, S) when S#s.seen_hello == true -> - try recv(S) - catch - {tcp,Exc} -> - S1 = opt(print_messages, S, - fun(X) when X==true;X==detail -> {"Recv~n~p~n",[Exc]} end), - S1#s{return_value=Exc} - end; - - -op({expect,timeout,E}, S0) -> - try op(E, S0) - of - S=#s{} -> fail({expected,timeout,S#s.return_value}, S) - catch - {receive_timeout,_} -> S0#s{return_value=timeout} - end; - -op({match,M,E}, S0) -> - {Val,S2} = op_val(E, S0), - case match(M, Val, S2) of - {true,S3} -> - opt(print_ops,S3, - fun(true) -> - case dict:fold( - fun(K,V,Acc) -> - case dict:find(K,S0#s.vars) of - error -> [{K,V}|Acc]; - _ -> Acc - end - end, [], S3#s.vars) - of - [] -> {"Matches! No new bindings.",[]}; - New -> - Width = lists:max([length(atom_to_list(K)) || {K,_} <- New]), - {lists:flatten( - ["Matches! New bindings:~n" | - [io_lib:format(" ~*s = ~p~n",[Width,K,V]) || {K,V}<-New]]), - []} - end - end); - false -> - fail({expected,M,Val}, - opt(print_ops,S2,fun(true) -> {"nomatch!!~n",[]} end) - ) - end; - -op({print,E}, S0) -> - {Val,S} = op_val(E, S0), - io:format("Result of ~p ~p =~n~s~n",[?role(S0),E,format_msg(Val)]), - S; - -op(print_state, S) -> - io:format("State(~p)=~n~s~n",[?role(S), format_msg(S)]), - S; - -op('$$', S) -> - %% For matching etc - S. - - -op_val(E, S0) -> - case catch op(E, S0) of - {'EXIT',{function_clause,[{ssh_trpt_test_lib,op,[E,S0],_}|_]}} -> - {instantiate(E,S0), S0}; - S=#s{} -> - {S#s.return_value, S}; - F={fail,receive_timeout,_St} -> - throw(F) - end. - - -fail(Reason, {Fmt,Args}, S) when is_list(Fmt), is_list(Args) -> - fail(Reason, save_prints({Fmt,Args}, S)). - -fail(Reason, S) -> - throw({fail, Reason, S}). - -%%%---------------------------------------------------------------- -%% No optimizations :) - -match('$$', V, S) -> - match(S#s.return_value, V, S); - -match('_', _, S) -> - {true, S}; - -match({'or',[P]}, V, S) -> match(P,V,S); -match({'or',[Ph|Pt]}, V, S) -> - case match(Ph,V,S) of - false -> match({'or',Pt}, V, S); - {true,S} -> {true,S} - end; - -match(P, V, S) when is_atom(P) -> - case atom_to_list(P) of - "$"++_ -> - %% Variable - case dict:find(P,S#s.vars) of - {ok,Val} -> match(Val, V, S); - error -> {true,S#s{vars = dict:store(P,V,S#s.vars)}} - end; - _ when P==V -> - {true,S}; - _ -> - false - end; - -match(P, V, S) when P==V -> - {true, S}; - -match(P, V, S) when is_tuple(P), - is_tuple(V) -> - match(tuple_to_list(P), tuple_to_list(V), S); - -match([Hp|Tp], [Hv|Tv], S0) -> - case match(Hp, Hv, S0) of - {true,S} -> match(Tp, Tv, S); - false -> false - end; - -match(_, _, _) -> - false. - - - -instantiate('$$', S) -> - S#s.return_value; % FIXME: What if $$ or $... in return_value? - -instantiate(A, S) when is_atom(A) -> - case atom_to_list(A) of - "$"++_ -> - %% Variable - case dict:find(A,S#s.vars) of - {ok,Val} -> Val; % FIXME: What if $$ or $... in Val? - error -> throw({unbound,A}) - end; - _ -> - A - end; - -instantiate(T, S) when is_tuple(T) -> - list_to_tuple( instantiate(tuple_to_list(T),S) ); - -instantiate([H|T], S) -> - [instantiate(H,S) | instantiate(T,S)]; - -instantiate(X, _S) -> - X. - -%%%================================================================ -%%% -init_ssh(Role, Socket, Options0) -> - Options = [{user_interaction,false} - | Options0], - ssh_connection_handler:init_ssh(Role, - {2,0}, - lists:concat(["SSH-2.0-ErlangTestLib ",Role]), - Options, Socket). - -mangle_opts(Options) -> - SysOpts = [{reuseaddr, true}, - {active, false}, - {mode, binary} - ], - SysOpts ++ lists:foldl(fun({K,_},Opts) -> - lists:keydelete(K,1,Opts) - end, Options, SysOpts). - -host({0,0,0,0}) -> "localhost"; -host(H) -> H. - -%%%---------------------------------------------------------------- -send(S=#s{ssh=C}, hello) -> - Hello = case ?role(S) of - client -> C#ssh.c_version; - server -> C#ssh.s_version - end ++ "\r\n", - send(S, list_to_binary(Hello)); - -send(S0, ssh_msg_kexinit) -> - {Msg, _Bytes, _C0} = ssh_transport:key_exchange_init_msg(S0#s.ssh), - send(S0, Msg); - -send(S0=#s{alg_neg={undefined,PeerMsg}}, Msg=#ssh_msg_kexinit{}) -> - S1 = opt(print_messages, S0, - fun(X) when X==true;X==detail -> {"Send~n~s~n",[format_msg(Msg)]} end), - S2 = case PeerMsg of - #ssh_msg_kexinit{} -> - try ssh_transport:handle_kexinit_msg(PeerMsg, Msg, S1#s.ssh) of - {ok,Cx} when ?role(S1) == server -> - S1#s{alg = Cx#ssh.algorithms}; - {ok,_NextKexMsgBin,Cx} when ?role(S1) == client -> - S1#s{alg = Cx#ssh.algorithms} - catch - Class:Exc -> - save_prints({"Algoritm negotiation failed at line ~p:~p~n~p:~s~nPeer: ~s~n Own: ~s~n", - [?MODULE,?LINE,Class,format_msg(Exc),format_msg(PeerMsg),format_msg(Msg)]}, - S1) - end; - undefined -> - S1 - end, - {Bytes, C} = ssh_transport:ssh_packet(Msg, S2#s.ssh), - send_bytes(Bytes, S2#s{return_value = Msg, - alg_neg = {Msg,PeerMsg}, - ssh = C}); - -send(S0, ssh_msg_kexdh_init) when ?role(S0) == client -> - {OwnMsg, PeerMsg} = S0#s.alg_neg, - {ok, NextKexMsgBin, C} = - try ssh_transport:handle_kexinit_msg(PeerMsg, OwnMsg, S0#s.ssh) - catch - Class:Exc -> - fail("Algoritm negotiation failed!", - {"Algoritm negotiation failed at line ~p:~p~n~p:~s~nPeer: ~s~n Own: ~s", - [?MODULE,?LINE,Class,format_msg(Exc),format_msg(PeerMsg),format_msg(OwnMsg)]}, - S0) - end, - S = opt(print_messages, S0, - fun(X) when X==true;X==detail -> - #ssh{keyex_key = {{_Private, Public}, {_G, _P}}} = C, - Msg = #ssh_msg_kexdh_init{e = Public}, - {"Send (reconstructed)~n~s~n",[format_msg(Msg)]} - end), - send_bytes(NextKexMsgBin, S#s{ssh = C}); - -send(S0, ssh_msg_kexdh_reply) -> - Bytes = proplists:get_value(ssh_msg_kexdh_reply, S0#s.reply), - S = opt(print_messages, S0, - fun(X) when X==true;X==detail -> - {{_Private, Public}, _} = (S0#s.ssh)#ssh.keyex_key, - Msg = #ssh_msg_kexdh_reply{public_host_key = 'Key', - f = Public, - h_sig = 'H_SIG' - }, - {"Send (reconstructed)~n~s~n",[format_msg(Msg)]} - end), - send_bytes(Bytes, S#s{return_value = Bytes}); - -send(S0, Line) when is_binary(Line) -> - S = opt(print_messages, S0, - fun(X) when X==true;X==detail -> {"Send line~n~p~n",[Line]} end), - send_bytes(Line, S#s{return_value = Line}); - -send(S0, {special,Msg,PacketFun}) when is_tuple(Msg), - is_function(PacketFun,2) -> - S = opt(print_messages, S0, - fun(X) when X==true;X==detail -> {"Send~n~s~n",[format_msg(Msg)]} end), - {Packet, C} = PacketFun(Msg, S#s.ssh), - send_bytes(Packet, S#s{ssh = C, %%inc_send_seq_num(C), - return_value = Msg}); - -send(S0, Msg) when is_tuple(Msg) -> - S = opt(print_messages, S0, - fun(X) when X==true;X==detail -> {"Send~n~s~n",[format_msg(Msg)]} end), - {Packet, C} = ssh_transport:ssh_packet(Msg, S#s.ssh), - send_bytes(Packet, S#s{ssh = C, %%inc_send_seq_num(C), - return_value = Msg}). - -send_bytes(B, S0) -> - S = opt(print_messages, S0, fun(detail) -> {"Send bytes~n~p~n",[B]} end), - ok(gen_tcp:send(S#s.socket, B)), - S. - -%%%---------------------------------------------------------------- -recv(S0 = #s{}) -> - S1 = receive_poll(S0), - case S1#s.seen_hello of - {more,Seen} -> - %% Has received parts of a line. Has not seen a complete hello. - try_find_crlf(Seen, S1); - false -> - %% Must see hello before binary messages - try_find_crlf(<<>>, S1); - true -> - %% Has seen hello, therefore no more crlf-messages are alowed. - S = receive_binary_msg(S1), - case PeerMsg = S#s.return_value of - #ssh_msg_kexinit{} -> - case S#s.alg_neg of - {undefined,undefined} -> - S#s{alg_neg = {undefined,PeerMsg}}; - - {undefined,_} -> - fail("2 kexint received!!", S); - - {OwnMsg, _} -> - try ssh_transport:handle_kexinit_msg(PeerMsg, OwnMsg, S#s.ssh) of - {ok,C} when ?role(S) == server -> - S#s{alg_neg = {OwnMsg, PeerMsg}, - alg = C#ssh.algorithms, - ssh = C}; - {ok,_NextKexMsgBin,C} when ?role(S) == client -> - S#s{alg_neg = {OwnMsg, PeerMsg}, - alg = C#ssh.algorithms} - catch - Class:Exc -> - save_prints({"Algoritm negotiation failed at line ~p:~p~n~p:~s~nPeer: ~s~n Own: ~s~n", - [?MODULE,?LINE,Class,format_msg(Exc),format_msg(PeerMsg),format_msg(OwnMsg)]}, - S#s{alg_neg = {OwnMsg, PeerMsg}}) - end - end; - - #ssh_msg_kexdh_init{} -> % Always the server - {ok, Reply, C} = ssh_transport:handle_kexdh_init(PeerMsg, S#s.ssh), - S#s{ssh = C, - reply = [{ssh_msg_kexdh_reply,Reply} | S#s.reply] - }; - #ssh_msg_kexdh_reply{} -> - {ok, _NewKeys, C} = ssh_transport:handle_kexdh_reply(PeerMsg, S#s.ssh), - S#s{ssh=C#ssh{send_sequence=S#s.ssh#ssh.send_sequence}}; % Back the number - #ssh_msg_newkeys{} -> - {ok, C} = ssh_transport:handle_new_keys(PeerMsg, S#s.ssh), - S#s{ssh=C}; - _ -> - S - end - end. - -%%%================================================================ -try_find_crlf(Seen, S0) -> - case erlang:decode_packet(line,S0#s.enc,[]) of - {more,_} -> - Line = <>, - S0#s{seen_hello = {more,Line}, - enc = <<>>, % didn't find a complete line - % -> no more characters to test - return_value = {more,Line} - }; - {ok,Used,Rest} -> - Line = <>, - case handle_hello(Line, S0) of - false -> - S = opt(print_messages, S0, - fun(X) when X==true;X==detail -> {"Recv info~n~p~n",[Line]} end), - S#s{seen_hello = false, - enc = Rest, - return_value = {info,Line}}; - S1=#s{} -> - S = opt(print_messages, S1, - fun(X) when X==true;X==detail -> {"Recv hello~n~p~n",[Line]} end), - S#s{seen_hello = true, - enc = Rest, - return_value = {hello,Line}} - end - end. - - -handle_hello(Bin, S=#s{ssh=C}) -> - case {ssh_transport:handle_hello_version(binary_to_list(Bin)), - ?role(S)} - of - {{undefined,_}, _} -> false; - {{Vp,Vs}, client} -> S#s{ssh = C#ssh{s_vsn=Vp, s_version=Vs}}; - {{Vp,Vs}, server} -> S#s{ssh = C#ssh{c_vsn=Vp, c_version=Vs}} - end. - -receive_binary_msg(S0=#s{ssh=C0=#ssh{decrypt_block_size = BlockSize, - recv_mac_size = MacSize - } - }) -> - case size(S0#s.enc) >= max(8,BlockSize) of - false -> - %% Need more bytes to decode the packet_length field - Remaining = max(8,BlockSize) - size(S0#s.enc), - receive_binary_msg( receive_wait(Remaining, S0) ); - true -> - %% Has enough bytes to decode the packet_length field - {_, <>, _} = - ssh_transport:decrypt_blocks(S0#s.enc, BlockSize, C0), % FIXME: BlockSize should be at least 4 - - %% FIXME: Check that ((4+PacketLen) rem BlockSize) == 0 ? - - S1 = if - PacketLen > ?SSH_MAX_PACKET_SIZE -> - fail({too_large_message,PacketLen},S0); % FIXME: disconnect - - ((4+PacketLen) rem BlockSize) =/= 0 -> - fail(bad_packet_length_modulo, S0); % FIXME: disconnect - - size(S0#s.enc) >= (4 + PacketLen + MacSize) -> - %% has the whole packet - S0; - - true -> - %% need more bytes to get have the whole packet - Remaining = (4 + PacketLen + MacSize) - size(S0#s.enc), - receive_wait(Remaining, S0) - end, - - %% Decrypt all, including the packet_length part (re-use the initial #ssh{}) - {C1, SshPacket = <>, EncRest} = - ssh_transport:decrypt_blocks(S1#s.enc, PacketLen+4, C0), - - PayloadLen = PacketLen - 1 - PadLen, - <> = Tail, - - {C2, Payload} = ssh_transport:decompress(C1, CompressedPayload), - - <> = EncRest, - - case {ssh_transport:is_valid_mac(Mac, SshPacket, C2), - catch ssh_message:decode(set_prefix_if_trouble(Payload,S1))} - of - {false, _} -> fail(bad_mac,S1); - {_, {'EXIT',_}} -> fail(decode_failed,S1); - - {true, Msg} -> - C3 = case Msg of - #ssh_msg_kexinit{} -> - ssh_transport:key_init(opposite_role(C2), C2, Payload); - _ -> - C2 - end, - S2 = opt(print_messages, S1, - fun(X) when X==true;X==detail -> {"Recv~n~s~n",[format_msg(Msg)]} end), - S3 = opt(print_messages, S2, - fun(detail) -> {"decrypted bytes ~p~n",[SshPacket]} end), - S3#s{ssh = inc_recv_seq_num(C3), - enc = Rest, - return_value = Msg - } - end - end. - - -set_prefix_if_trouble(Msg = <>, #s{alg=#alg{kex=Kex}}) - when Op == 30; - Op == 31 - -> - case catch atom_to_list(Kex) of - "ecdh-sha2-" ++ _ -> - <<"ecdh",Msg/binary>>; - "diffie-hellman-group-exchange-" ++ _ -> - <<"dh_gex",Msg/binary>>; - "diffie-hellman-group" ++ _ -> - <<"dh",Msg/binary>>; - _ -> - Msg - end; -set_prefix_if_trouble(Msg, _) -> - Msg. - - -receive_poll(S=#s{socket=Sock}) -> - inet:setopts(Sock, [{active,once}]), - receive - {tcp,Sock,Data} -> - receive_poll( S#s{enc = <<(S#s.enc)/binary,Data/binary>>} ); - {tcp_closed,Sock} -> - throw({tcp,tcp_closed}); - {tcp_error, Sock, Reason} -> - throw({tcp,{tcp_error,Reason}}) - after 0 -> - S - end. - -receive_wait(S=#s{socket=Sock, - timeout=Timeout}) -> - inet:setopts(Sock, [{active,once}]), - receive - {tcp,Sock,Data} -> - S#s{enc = <<(S#s.enc)/binary,Data/binary>>}; - {tcp_closed,Sock} -> - throw({tcp,tcp_closed}); - {tcp_error, Sock, Reason} -> - throw({tcp,{tcp_error,Reason}}) - after Timeout -> - fail(receive_timeout,S) - end. - -receive_wait(N, S=#s{socket=Sock, - timeout=Timeout, - enc=Enc0}) when N>0 -> - inet:setopts(Sock, [{active,once}]), - receive - {tcp,Sock,Data} -> - receive_wait(N-size(Data), S#s{enc = <>}); - {tcp_closed,Sock} -> - throw({tcp,tcp_closed}); - {tcp_error, Sock, Reason} -> - throw({tcp,{tcp_error,Reason}}) - after Timeout -> - fail(receive_timeout, S) - end; -receive_wait(_N, S) -> - S. - -%% random_padding_len(PaddingLen1, ChunkSize) -> -%% MaxAdditionalRandomPaddingLen = % max 255 bytes padding totaö -%% (255 - PaddingLen1) - ((255 - PaddingLen1) rem ChunkSize), -%% AddLen0 = crypto:rand_uniform(0,MaxAdditionalRandomPaddingLen), -%% AddLen0 - (AddLen0 rem ChunkSize). % preserve the blocking - -inc_recv_seq_num(C=#ssh{recv_sequence=N}) -> C#ssh{recv_sequence=(N+1) band 16#ffffffff}. -%%%inc_send_seq_num(C=#ssh{send_sequence=N}) -> C#ssh{send_sequence=(N+1) band 16#ffffffff}. - -opposite_role(#ssh{role=R}) -> opposite_role(R); -opposite_role(client) -> server; -opposite_role(server) -> client. - -ok(ok) -> ok; -ok({ok,R}) -> R; -ok({error,E}) -> erlang:error(E). - - -%%%================================================================ -%%% -%%% Formating of records -%%% - -format_msg(M) -> format_msg(M, 0). - -format_msg(M, I0) -> - case fields(M) of - undefined -> io_lib:format('~p',[M]); - Fields -> - [Name|Args] = tuple_to_list(M), - Head = io_lib:format('#~p{',[Name]), - I = lists:flatlength(Head)+I0, - NL = io_lib:format('~n~*c',[I,$ ]), - Sep = io_lib:format(',~n~*c',[I,$ ]), - Tail = [begin - S0 = io_lib:format('~p = ',[F]), - I1 = I + lists:flatlength(S0), - [S0,format_msg(A,I1)] - end - || {F,A} <- lists:zip(Fields,Args)], - [[Head|string:join(Tail,Sep)],NL,"}"] - end. - -fields(M) -> - case M of - #ssh_msg_debug{} -> record_info(fields, ssh_msg_debug); - #ssh_msg_disconnect{} -> record_info(fields, ssh_msg_disconnect); - #ssh_msg_ignore{} -> record_info(fields, ssh_msg_ignore); - #ssh_msg_kex_dh_gex_group{} -> record_info(fields, ssh_msg_kex_dh_gex_group); - #ssh_msg_kex_dh_gex_init{} -> record_info(fields, ssh_msg_kex_dh_gex_init); - #ssh_msg_kex_dh_gex_reply{} -> record_info(fields, ssh_msg_kex_dh_gex_reply); - #ssh_msg_kex_dh_gex_request{} -> record_info(fields, ssh_msg_kex_dh_gex_request); - #ssh_msg_kex_dh_gex_request_old{} -> record_info(fields, ssh_msg_kex_dh_gex_request_old); - #ssh_msg_kexdh_init{} -> record_info(fields, ssh_msg_kexdh_init); - #ssh_msg_kexdh_reply{} -> record_info(fields, ssh_msg_kexdh_reply); - #ssh_msg_kexinit{} -> record_info(fields, ssh_msg_kexinit); - #ssh_msg_newkeys{} -> record_info(fields, ssh_msg_newkeys); - #ssh_msg_service_accept{} -> record_info(fields, ssh_msg_service_accept); - #ssh_msg_service_request{} -> record_info(fields, ssh_msg_service_request); - #ssh_msg_unimplemented{} -> record_info(fields, ssh_msg_unimplemented); - #ssh_msg_userauth_request{} -> record_info(fields, ssh_msg_userauth_request); - #ssh_msg_userauth_failure{} -> record_info(fields, ssh_msg_userauth_failure); - #ssh_msg_userauth_success{} -> record_info(fields, ssh_msg_userauth_success); - #ssh_msg_userauth_banner{} -> record_info(fields, ssh_msg_userauth_banner); - #ssh_msg_userauth_passwd_changereq{} -> record_info(fields, ssh_msg_userauth_passwd_changereq); - #ssh_msg_userauth_pk_ok{} -> record_info(fields, ssh_msg_userauth_pk_ok); - #ssh_msg_userauth_info_request{} -> record_info(fields, ssh_msg_userauth_info_request); - #ssh_msg_userauth_info_response{} -> record_info(fields, ssh_msg_userauth_info_response); - #s{} -> record_info(fields, s); - #ssh{} -> record_info(fields, ssh); - #alg{} -> record_info(fields, alg); - _ -> undefined - end. - -%%%================================================================ -%%% -%%% Trace handling -%%% - -init_op_traces(Op, S0) -> - opt(print_ops, S0#s{prints=[]}, - fun(true) -> - case ?role(S0) of - undefined -> {"-- ~p~n",[Op]}; - Role -> {"-- ~p ~p~n",[Role,Op]} - end - end - ). - -report_trace(Class, Term, S) -> - print_traces( - opt(print_ops, S, - fun(true) -> {"~s ~p",[Class,Term]} end) - ). - -seqnum_trace(S) -> - opt(print_seqnums, S, - fun(true) when S#s.ssh#ssh.send_sequence =/= S#s.ssh#ssh.send_sequence, - S#s.ssh#ssh.recv_sequence =/= S#s.ssh#ssh.recv_sequence -> - {"~p seq num: send ~p->~p, recv ~p->~p~n", - [?role(S), - S#s.ssh#ssh.send_sequence, S#s.ssh#ssh.send_sequence, - S#s.ssh#ssh.recv_sequence, S#s.ssh#ssh.recv_sequence - ]}; - (true) when S#s.ssh#ssh.send_sequence =/= S#s.ssh#ssh.send_sequence -> - {"~p seq num: send ~p->~p~n", - [?role(S), - S#s.ssh#ssh.send_sequence, S#s.ssh#ssh.send_sequence]}; - (true) when S#s.ssh#ssh.recv_sequence =/= S#s.ssh#ssh.recv_sequence -> - {"~p seq num: recv ~p->~p~n", - [?role(S), - S#s.ssh#ssh.recv_sequence, S#s.ssh#ssh.recv_sequence]} - end). - -print_traces(S) when S#s.prints == [] -> S; -print_traces(S) -> - Len = length(S#s.prints), - ct:log("~s", - [lists:foldl( - fun({Fmt,Args}, Acc) -> - [case Len-length(Acc)-1 of - 0 -> - io_lib:format(Fmt,Args); - _N -> - io_lib:format(lists:concat(['~p --------~n',Fmt]), - [Len-length(Acc)-1|Args]) - end | Acc] - end, "", S#s.prints)] - ). - -opt(Flag, S, Fun) when is_function(Fun,1) -> - try Fun(proplists:get_value(Flag,S#s.opts)) - of P={Fmt,Args} when is_list(Fmt), is_list(Args) -> - save_prints(P, S) - catch _:_ -> - S - end. - -save_prints({Fmt,Args}, S) -> - S#s{prints = [{Fmt,Args}|S#s.prints]}. diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/sftp.txt erlang-17.3-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/sftp.txt --- erlang-18.2-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/sftp.txt 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/sftp.txt 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1 @@ +åäöÅÄÖ瑞語 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/sftp瑞点.txt erlang-17.3-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/sftp瑞点.txt --- erlang-18.2-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/sftp瑞点.txt 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/sftp瑞点.txt 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1 @@ +åäöÅÄÖ瑞語 diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/ssh_host_dsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/ssh_host_dsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/ssh_host_dsa_key 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/ssh_host_dsa_key 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,13 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBuwIBAAKBgQCClaHzE2ul0gKSUxah5W0W8UiJLy4hXngKEqpaUq9SSdVdY2LK +wVfKH1gt5iuaf1FfzOhsIC9G/GLnjYttXZc92cv/Gfe3gR+s0ni2++MX+T++mE/Q +diltXv/Hp27PybS67SmiFW7I+RWnT2OKlMPtw2oUuKeztCe5UWjaj/y5FQIVAPLA +l9RpiU30Z87NRAHY3NTRaqtrAoGANMRxw8UfdtNVR0CrQj3AgPaXOGE4d+G4Gp4X +skvnCHycSVAjtYxebUkzUzt5Q6f/IabuLUdge3gXrc8BetvrcKbp+XZgM0/Vj2CF +Ymmy3in6kzGZq7Fw1sZaku6AOU8vLa5woBT2vAcHLLT1bLAzj7viL048T6MfjrOP +ef8nHvACgYBhDWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah +/XcF3DeRF+eEoz48wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+U +ykSTXYUbtsfTNRFQGBW2/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0CgIVAN4wtL5W +Lv62jKcdskxNyz2NQoBx +-----END DSA PRIVATE KEY----- + diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/ssh_host_dsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/ssh_host_dsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/ssh_host_dsa_key.pub 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_unicode_SUITE_data/ssh_host_dsa_key.pub 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,11 @@ +---- BEGIN SSH2 PUBLIC KEY ---- +AAAAB3NzaC1kc3MAAACBAIKVofMTa6XSApJTFqHlbRbxSIkvLiFeeAoSqlpSr1JJ1V1j +YsrBV8ofWC3mK5p/UV/M6GwgL0b8YueNi21dlz3Zy/8Z97eBH6zSeLb74xf5P76YT9B2 +KW1e/8enbs/JtLrtKaIVbsj5FadPY4qUw+3DahS4p7O0J7lRaNqP/LkVAAAAFQDywJfU +aYlN9GfOzUQB2NzU0WqrawAAAIA0xHHDxR9201VHQKtCPcCA9pc4YTh34bganheyS+cI +fJxJUCO1jF5tSTNTO3lDp/8hpu4tR2B7eBetzwF62+twpun5dmAzT9WPYIViabLeKfqT +MZmrsXDWxlqS7oA5Ty8trnCgFPa8BwcstPVssDOPu+IvTjxPox+Os495/yce8AAAAIBh +DWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah/XcF3DeRF+eEoz48 +wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+UykSTXYUbtsfTNRFQGBW2 +/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0Cg== +---- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_unicode_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_unicode_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_unicode_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_unicode_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,587 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2005-2014. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%% gerl +fnu +%% ct:run_test([{suite,"ssh_unicode_SUITE"}, {logdir,"LOG"}]). + +-module(ssh_unicode_SUITE). + +%% Note: This directive should only be used in test suites. +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). +-include_lib("kernel/include/file.hrl"). + +% Default timetrap timeout +-define(default_timeout, ?t:minutes(1)). + +-define(USER, "Ã¥ke高兴"). +-define(PASSWD, "ärlig日本ã˜ã‚“"). +-define('sftp.txt', "sftp瑞点.txt"). +-define('test.txt', "testãƒãƒ³ã‚¹.txt"). +-define('link_test.txt', "link_test語.txt"). + +-define(bindata, unicode:characters_to_binary("foobar Ã¥ 一二三四ã„ã¡ã«ã•ã‚“ã¡") ). + +-define(NEWLINE, <<"\r\n">>). + +%%-------------------------------------------------------------------- +%% Common Test interface functions ----------------------------------- +%%-------------------------------------------------------------------- + +%% suite() -> +%% [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, sftp}, + {group, shell} + ]. + + +init_per_suite(Config) -> + case {file:native_name_encoding(), (catch crypto:start())} of + {utf8, ok} -> + ssh:start(), + Config; + {utf8, _} -> + {skip,"Could not start crypto!"}; + _ -> + {skip,"Not unicode filename enabled emulator"} + end. + +end_per_suite(Config) -> + ssh:stop(), + crypto:stop(), + Config. + +%%-------------------------------------------------------------------- +groups() -> + [{shell, [], [shell_no_unicode, shell_unicode_string]}, + {sftp, [], [open_close_file, open_close_dir, read_file, read_dir, + write_file, rename_file, mk_rm_dir, remove_file, links, + retrieve_attributes, set_attributes, async_read, async_read_bin, + async_write + %% , position, pos_read, pos_write + ]}]. + +init_per_group(Group, Config) when Group==sftp + ; Group==shell -> + PrivDir = ?config(priv_dir, Config), + SysDir = ?config(data_dir, Config), + Sftpd = + ssh_test_lib:daemon([{system_dir, SysDir}, + {user_dir, PrivDir}, + {user_passwords, [{?USER, ?PASSWD}]}]), + [{group,Group}, {sftpd, Sftpd} | Config]; + +init_per_group(Group, Config) -> + [{group,Group} | Config]. + + +end_per_group(erlang_server, Config) -> + Config; +end_per_group(_, Config) -> + Config. + +%%-------------------------------------------------------------------- +init_per_testcase(_Case, Config) -> + prep(Config), + TmpConfig0 = lists:keydelete(watchdog, 1, Config), + TmpConfig = lists:keydelete(sftp, 1, TmpConfig0), + Dog = ct:timetrap(?default_timeout), + + case ?config(group, Config) of + sftp -> + {_Pid, Host, Port} = ?config(sftpd, Config), + {ok, ChannelPid, Connection} = + ssh_sftp:start_channel(Host, Port, + [{user, ?USER}, + {password, ?PASSWD}, + {user_interaction, false}, + {silently_accept_hosts, true}]), + Sftp = {ChannelPid, Connection}, + [{sftp, Sftp}, {watchdog, Dog} | TmpConfig]; + shell -> + UserDir = ?config(priv_dir, Config), + process_flag(trap_exit, true), + {_Pid, _Host, Port} = ?config(sftpd, Config), + ct:sleep(500), + IO = ssh_test_lib:start_io_server(), + Shell = ssh_test_lib:start_shell(Port, IO, UserDir, + [{silently_accept_hosts, true}, + {user,?USER},{password,?PASSWD}]), +%%ct:pal("IO=~p, Shell=~p, self()=~p",[IO,Shell,self()]), + wait_for_erlang_first_line([{io,IO}, {shell,Shell} | Config]) + end. + + +wait_for_erlang_first_line(Config) -> + receive + {'EXIT', _, _} -> + {fail,no_ssh_connection}; + <<"Eshell ",_/binary>> = ErlShellStart -> +%% ct:pal("Erlang shell start: ~p~n", [ErlShellStart]), + Config; + Other -> + ct:pal("Unexpected answer from ssh server: ~p",[Other]), + {fail,unexpected_answer} + after 10000 -> + ct:pal("No answer from ssh-server"), + {fail,timeout} + end. + + + +end_per_testcase(rename_file, Config) -> + PrivDir = ?config(priv_dir, Config), + NewFileName = filename:join(PrivDir, ?'test.txt'), + file:delete(NewFileName), + end_per_testcase(Config); +end_per_testcase(_TC, Config) -> + end_per_testcase(Config). + +end_per_testcase(Config) -> + catch exit(?config(shell,Config), kill), + case ?config(sftp, Config) of + {Sftp, Connection} -> + ssh_sftp:stop_channel(Sftp), + ssh:close(Connection); + _ -> + ok + end. + +%%-------------------------------------------------------------------- +%% Test Cases -------------------------------------------------------- + +-define(chk_expected(Received,Expected), + (fun(R_,E_) when R_==E_ -> ok; + (R_,E_) -> ct:pal("Expected: ~p~nReceived: ~p~n", [E_,R_]), + E_ = R_ + end)(Received,Expected)). + +-define(receive_chk(Ref,Expected), + (fun(E__) -> + receive + {async_reply, Ref, Received} when Received==E__ -> + ?chk_expected(Received, E__); + {async_reply, Ref, Received} when Received=/=E__ -> + ct:pal("Expected: ~p~nReceived: ~p~n", [E__,Received]), + E__ = Received; + Msg -> + ct:pal("Expected (Ref=~p): ~p", [Ref,E__]), + ct:fail(Msg) + end + end)(Expected)). + +%%-------------------------------------------------------------------- + + +open_close_file() -> + [{doc, "Test API functions open/3 and close/2"}]. +open_close_file(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'sftp.txt'), + {Sftp, _} = ?config(sftp, Config), + + lists:foreach( + fun(Mode) -> + ct:log("Mode: ~p",[Mode]), + %% list_dir(PrivDir), + ok = open_close_file(Sftp, FileName, Mode) + end, + [ + [read], + [write], + [write, creat], + [write, trunc], + [append], + [read, binary] + ]). + +open_close_file(Server, File, Mode) -> + {ok, Handle} = ssh_sftp:open(Server, File, Mode), + ok = ssh_sftp:close(Server, Handle). + +%%-------------------------------------------------------------------- +open_close_dir() -> + [{doc, "Test API functions opendir/2 and close/2"}]. +open_close_dir(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + {Sftp, _} = ?config(sftp, Config), + FileName = filename:join(PrivDir, ?'sftp.txt'), + + {ok, Handle} = ssh_sftp:opendir(Sftp, PrivDir), + ok = ssh_sftp:close(Sftp, Handle), + {error, _} = ssh_sftp:opendir(Sftp, FileName). + +%%-------------------------------------------------------------------- +read_file() -> + [{doc, "Test API funtion read_file/2"}]. +read_file(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'sftp.txt'), + {Sftp, _} = ?config(sftp, Config), + ?chk_expected(ssh_sftp:read_file(Sftp,FileName), file:read_file(FileName)). + +%%-------------------------------------------------------------------- +read_dir() -> + [{doc,"Test API function list_dir/2"}]. +read_dir(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + {Sftp, _} = ?config(sftp, Config), + {ok, Files} = ssh_sftp:list_dir(Sftp, PrivDir), + ct:pal("sftp list dir: ~ts~n", [Files]). + +%%-------------------------------------------------------------------- +write_file() -> + [{doc, "Test API function write_file/2"}]. +write_file(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'sftp.txt'), + {Sftp, _} = ?config(sftp, Config), + ok = ssh_sftp:write_file(Sftp, FileName, [?bindata]), + ?chk_expected(file:read_file(FileName), {ok,?bindata}). + +%%-------------------------------------------------------------------- +remove_file() -> + [{doc,"Test API function delete/2"}]. +remove_file(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'sftp.txt'), + {Sftp, _} = ?config(sftp, Config), + + {ok, Files} = ssh_sftp:list_dir(Sftp, PrivDir), + true = lists:member(filename:basename(FileName), Files), + ok = ssh_sftp:delete(Sftp, FileName), + {ok, NewFiles} = ssh_sftp:list_dir(Sftp, PrivDir), + false = lists:member(filename:basename(FileName), NewFiles), + {error, _} = ssh_sftp:delete(Sftp, FileName). +%%-------------------------------------------------------------------- +rename_file() -> + [{doc, "Test API function rename_file/2"}]. +rename_file(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'sftp.txt'), + NewFileName = filename:join(PrivDir, ?'test.txt'), + + {Sftp, _} = ?config(sftp, Config), + {ok, Files} = ssh_sftp:list_dir(Sftp, PrivDir), + ct:pal("FileName: ~ts~nFiles: ~ts~n", [FileName, [[$\n,$ ,F]||F<-Files] ]), + true = lists:member(filename:basename(FileName), Files), + false = lists:member(filename:basename(NewFileName), Files), + ok = ssh_sftp:rename(Sftp, FileName, NewFileName), + {ok, NewFiles} = ssh_sftp:list_dir(Sftp, PrivDir), + ct:pal("FileName: ~ts, Files: ~ts~n", [FileName, [[$\n,F]||F<-NewFiles] ]), + + false = lists:member(filename:basename(FileName), NewFiles), + true = lists:member(filename:basename(NewFileName), NewFiles). + +%%-------------------------------------------------------------------- +mk_rm_dir() -> + [{doc,"Test API functions make_dir/2, del_dir/2"}]. +mk_rm_dir(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + {Sftp, _} = ?config(sftp, Config), + + DirName = filename:join(PrivDir, "test"), + ok = ssh_sftp:make_dir(Sftp, DirName), + ok = ssh_sftp:del_dir(Sftp, DirName), + NewDirName = filename:join(PrivDir, "foo/bar"), + {error, _} = ssh_sftp:make_dir(Sftp, NewDirName), + {error, _} = ssh_sftp:del_dir(Sftp, PrivDir). + +%%-------------------------------------------------------------------- +links() -> + [{doc,"Tests API function make_symlink/3"}]. +links(Config) when is_list(Config) -> + case os:type() of + {win32, _} -> + {skip, "Links are not fully supported by windows"}; + _ -> + {Sftp, _} = ?config(sftp, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'sftp.txt'), + LinkFileName = filename:join(PrivDir, ?'link_test.txt'), + + ok = ssh_sftp:make_symlink(Sftp, LinkFileName, FileName), + {ok, FileName} = ssh_sftp:read_link(Sftp, LinkFileName) + end. + +%%-------------------------------------------------------------------- +retrieve_attributes() -> + [{doc, "Test API function read_file_info/3"}]. +retrieve_attributes(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'sftp.txt'), + + {Sftp, _} = ?config(sftp, Config), + {ok, FileInfo} = ssh_sftp:read_file_info(Sftp, FileName), + {ok, NewFileInfo} = file:read_file_info(FileName), + + %% TODO comparison. There are some differences now is that ok? + ct:pal("SFTP: ~p~nFILE: ~p~n", [FileInfo, NewFileInfo]). + +%%-------------------------------------------------------------------- +set_attributes() -> + [{doc,"Test API function write_file_info/3"}]. +set_attributes(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'test.txt'), + + {Sftp, _} = ?config(sftp, Config), + {ok,Fd} = file:open(FileName, write), + io:put_chars(Fd,"foo"), + ok = ssh_sftp:write_file_info(Sftp, FileName, #file_info{mode=8#400}), + {error, eacces} = file:write_file(FileName, "hello again"), + ssh_sftp:write_file_info(Sftp, FileName, #file_info{mode=8#600}), + ok = file:write_file(FileName, "hello again"). + +%%-------------------------------------------------------------------- + +async_read() -> + [{doc,"Test API aread/3"}]. +async_read(Config) when is_list(Config) -> + do_async_read(Config, false). + +async_read_bin() -> + [{doc,"Test API aread/3"}]. +async_read_bin(Config) when is_list(Config) -> + do_async_read(Config, true). + +do_async_read(Config, BinaryFlag) -> + {Sftp, _} = ?config(sftp, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'sftp.txt'), + {ok,ExpDataBin} = file:read_file(FileName), + ExpData = case BinaryFlag of + true -> ExpDataBin; + false -> binary_to_list(ExpDataBin) + end, + {ok, Handle} = ssh_sftp:open(Sftp, FileName, [read|case BinaryFlag of + true -> [binary]; + false -> [] + end]), + {async, Ref} = ssh_sftp:aread(Sftp, Handle, 20), + ?receive_chk(Ref, {ok,ExpData}). + +%%-------------------------------------------------------------------- +async_write() -> + [{doc,"Test API awrite/3"}]. +async_write(Config) when is_list(Config) -> + {Sftp, _} = ?config(sftp, Config), + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'test.txt'), + {ok, Handle} = ssh_sftp:open(Sftp, FileName, [write]), + Expected = ?bindata, + {async, Ref} = ssh_sftp:awrite(Sftp, Handle, Expected), + + receive + {async_reply, Ref, ok} -> + {ok, Data} = file:read_file(FileName), + ?chk_expected(Data, Expected); + Msg -> + ct:fail(Msg) + end. + +%%-------------------------------------------------------------------- + +position() -> + [{doc, "Test API functions position/3"}]. +position(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'test.txt'), + {Sftp, _} = ?config(sftp, Config), + + Data = list_to_binary("1234567890"), + ssh_sftp:write_file(Sftp, FileName, [Data]), + {ok, Handle} = ssh_sftp:open(Sftp, FileName, [read]), + + {ok, 3} = ssh_sftp:position(Sftp, Handle, {bof, 3}), + {ok, "4"} = ssh_sftp:read(Sftp, Handle, 1), + + {ok, 10} = ssh_sftp:position(Sftp, Handle, eof), + eof = ssh_sftp:read(Sftp, Handle, 1), + + {ok, 6} = ssh_sftp:position(Sftp, Handle, {bof, 6}), + {ok, "7"} = ssh_sftp:read(Sftp, Handle, 1), + + {ok, 9} = ssh_sftp:position(Sftp, Handle, {cur, 2}), + {ok, "0"} = ssh_sftp:read(Sftp, Handle, 1), + + {ok, 0} = ssh_sftp:position(Sftp, Handle, bof), + {ok, "1"} = ssh_sftp:read(Sftp, Handle, 1), + + {ok, 1} = ssh_sftp:position(Sftp, Handle, cur), + {ok, "2"} = ssh_sftp:read(Sftp, Handle, 1). + +%%-------------------------------------------------------------------- +pos_read() -> + [{doc,"Test API functions pread/3 and apread/3"}]. +pos_read(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'test.txt'), + {Sftp, _} = ?config(sftp, Config), + Data = ?bindata, + ssh_sftp:write_file(Sftp, FileName, [Data]), + + {ok, Handle} = ssh_sftp:open(Sftp, FileName, [read]), + {async, Ref} = ssh_sftp:apread(Sftp, Handle, {bof,5}, 4), + + ?receive_chk(Ref, {ok,binary_part(Data,5,4)}), + ?chk_expected(ssh_sftp:pread(Sftp,Handle,{bof,4},4), {ok,binary_part(Data,4,4)}). + + +%%-------------------------------------------------------------------- +pos_write() -> + [{doc,"Test API functions pwrite/4 and apwrite/4"}]. +pos_write(Config) when is_list(Config) -> + PrivDir = ?config(priv_dir, Config), + FileName = filename:join(PrivDir, ?'test.txt'), + {Sftp, _} = ?config(sftp, Config), + + {ok, Handle} = ssh_sftp:open(Sftp, FileName, [write]), + + Data = unicode:characters_to_list("å†è§"), + ssh_sftp:write_file(Sftp, FileName, [Data]), + + NewData = unicode:characters_to_list(" ã•ã‚ˆã†ãªã‚‰"), + {async, Ref} = ssh_sftp:apwrite(Sftp, Handle, {bof, 2}, NewData), + ?receive_chk(Ref, ok), + + ok = ssh_sftp:pwrite(Sftp, Handle, eof, unicode:characters_to_list(" adjö ")), + + ?chk_expected(ssh_sftp:read_file(Sftp,FileName), + {ok,unicode:characters_to_binary("å†è§ ã•ã‚ˆã†ãªã‚‰ adjö ")}). + +%%-------------------------------------------------------------------- +sftp_nonexistent_subsystem() -> + [{doc, "Try to execute sftp subsystem on a server that does not support it"}]. +sftp_nonexistent_subsystem(Config) when is_list(Config) -> + {_,Host, Port} = ?config(sftpd, Config), + {error,"server failed to start sftp subsystem"} = + ssh_sftp:start_channel(Host, Port, + [{user_interaction, false}, + {user, ?USER}, + {password, ?PASSWD}, + {silently_accept_hosts, true}]). + +%%-------------------------------------------------------------------- +shell_no_unicode(Config) -> + do_shell(?config(io,Config), + [new_prompt, + {type,"io:format(\"hej ~p~n\",[42])."}, + {expect,"hej 42"} + ]). + +%%-------------------------------------------------------------------- +shell_unicode_string(Config) -> + do_shell(?config(io,Config), + [new_prompt, + {type,"io:format(\"ã“ã«ã¡ã‚~ts~n\",[\"四二\"])."}, + {expect,"ã“ã«ã¡ã‚四二"}, + {expect,"ok"} + ]). + +%%-------------------------------------------------------------------- +%% Internal functions ------------------------------------------------ +%%-------------------------------------------------------------------- +prep(Config) -> + PrivDir = ?config(priv_dir, Config), + TestFile = filename:join(PrivDir, ?'sftp.txt'), + TestFile1 = filename:join(PrivDir, ?'test.txt'), + TestLink = filename:join(PrivDir, ?'link_test.txt'), + + file:delete(TestFile), + file:delete(TestFile1), + file:delete(TestLink), + + %% Initial config + DataDir = ?config(data_dir, Config), + FileName = filename:join(DataDir, ?'sftp.txt'), + {ok,_BytesCopied} = file:copy(FileName, TestFile), + Mode = 8#00400 bor 8#00200 bor 8#00040, % read & write owner, read group + {ok, FileInfo} = file:read_file_info(TestFile), + ok = file:write_file_info(TestFile, + FileInfo#file_info{mode = Mode}). + + +%% list_dir(Dir) -> +%% ct:pal("prep/1: ls(~p):~n~p~n~ts",[Dir, file:list_dir(Dir), +%% begin +%% {ok,DL} = file:list_dir(Dir), +%% [[$\n|FN] || FN <- DL] +%% end]). + + +%%-------------------------------------------------------------------- +do_shell(IO, List) -> do_shell(IO, 0, List). + +do_shell(IO, N, [new_prompt|More]) -> + do_shell(IO, N+1, More); + +do_shell(IO, N, Ops=[{Order,Arg}|More]) -> + receive + X = <<"\r\n">> -> +%% ct:pal("Skip newline ~p",[X]), + do_shell(IO, N, Ops); + + < ">> when (P1-$0)==N -> + do_shell_prompt(IO, N, Order, Arg, More); + + < ">> when (P1-$0)*10 + (P2-$0) == N -> + do_shell_prompt(IO, N, Order, Arg, More); + + Err when element(1,Err)==error -> + ct:fail("do_shell error: ~p~n",[Err]); + + RecBin when Order==expect ; Order==expect_echo -> +%% ct:pal("received ~p",[RecBin]), + RecStr = string:strip(unicode:characters_to_list(RecBin)), + ExpStr = string:strip(Arg), + case lists:prefix(ExpStr, RecStr) of + true when Order==expect -> + ct:pal("Matched ~ts",[RecStr]), + do_shell(IO, N, More); + true when Order==expect_echo -> + ct:pal("Matched echo ~ts",[RecStr]), + do_shell(IO, N, More); + false -> + ct:fail("*** Expected ~p, but got ~p",[string:strip(ExpStr),RecStr]) + end + after 10000 -> + case Order of + expect -> ct:fail("timeout, expected ~p",[string:strip(Arg)]); + type -> ct:fail("timeout, no prompt") + end + end; + +do_shell(_, _, []) -> + ok. + + +do_shell_prompt(IO, N, type, Str, More) -> +%% ct:pal("Matched prompt ~p to trigger sending of next line to server",[N]), + IO ! {input, self(), Str++"\r\n"}, + ct:pal("Promt '~p> ', Sent ~ts",[N,Str++"\r\n"]), + do_shell(IO, N, [{expect_echo,Str}|More]); % expect echo of the sent line +do_shell_prompt(IO, N, Op, Str, More) -> +%% ct:pal("Matched prompt ~p",[N]), + do_shell(IO, N, [{Op,Str}|More]). + +%%-------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/id_dsa erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/id_dsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/id_dsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/id_dsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBvAIBAAKBgQDfi2flSTZZofwT4yQT0NikX/LGNT7UPeB/XEWe/xovEYCElfaQ -APFixXvEgXwoojmZ5kiQRKzLM39wBP0jPERLbnZXfOOD0PDnw0haMh7dD7XKVMod -/EigVgHf/qBdM2M8yz1s/rRF7n1UpLSypziKjkzCm7JoSQ2zbWIPdmBIXwIVAMgP -kpr7Sq3O7sHdb8D601DRjoExAoGAMOQxDfB2Fd8ouz6G96f/UOzRMI/Kdv8kYYKW -JIGY+pRYrLPyYzUeJznwZreOJgrczAX+luHnKFWJ2Dnk5CyeXk67Wsr7pJ/4MBMD -OKeIS0S8qoSBN8+Krp79fgA+yS3IfqbkJLtLu4EBaCX4mKQIX4++k44d4U5lc8pt -+9hlEI8CgYEAznKxx9kyC6bVo7LUYKaGhofRFt0SYFc5PVmT2VUGRs1R6+6DPD+e -uEO6IhFct7JFSRbP9p0JD4Uk+3zlZF+XX6b2PsZkeV8f/02xlNGUSmEzCSiNg1AX -Cy/WusYhul0MncWCHMcOZB5rIvU/aP5EJJtn3xrRaz6u0SThF6AnT34CFQC63czE -ZU8w8Q+H7z0j+a+70x2iAw== ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/id_rsa erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/id_rsa --- erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/id_rsa 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/id_rsa 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQD1OET+3O/Bvj/dtjxDTXmj1oiJt4sIph5kGy0RfjoPrZfaS+CU -DhakCmS6t2ivxWFgtpKWaoGMZMJqWj6F6ZsumyFl3FPBtujwY/35cgifrI9Ns4Tl -zR1uuengNBmV+WRQ5cd9F2qS6Z8aDQihzt0r8JUqLcK+VQbrmNzboCCQQwIDAQAB -AoGAPQEyqPTt8JUT7mRXuaacjFXiweAXhp9NEDpyi9eLOjtFe9lElZCrsUOkq47V -TGUeRKEm9qSodfTbKPoqc8YaBJGJPhUaTAcha+7QcDdfHBvIsgxvU7ePVnlpXRp3 -CCUEMPhlnx6xBoTYP+fRU0e3+xJIPVyVCqX1jAdUMkzfRoECQQD6ux7B1QJAIWyK -SGkbDUbBilNmzCFNgIpOP6PA+bwfi5d16diTpra5AX09keQABAo/KaP1PdV8Vg0p -z4P3A7G3AkEA+l+AKG6m0kQTTBMJDqOdVPYwe+5GxunMaqmhokpEbuGsrZBl5Dvd -WpcBjR7jmenrhKZRIuA+Fz5HPo/UQJPl1QJBAKxstDkeED8j/S2XoFhPKAJ+6t39 -sUVICVTIZQeXdmzHJXCcUSkw8+WEhakqw/3SyW0oaK2FSWQJFWJUZ+8eJj8CQEh3 -xeduB5kKnS9CvzdeghZqX6QvVosSdtlUmfUYW/BgH5PpHKTP8wTaeld3XldZTpMJ -dKiMkUw2+XYROVUrubUCQD+Na1LhULlpn4ISEtIEfqpdlUhxDgO15Wg8USmsng+x -ICliVOSQtwaZjm8kwaFt0W7XnpnDxbRs37vIEbIMWak= ------END RSA PRIVATE KEY----- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/known_hosts erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/known_hosts --- erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/known_hosts 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/known_hosts 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_dsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_dsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_dsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_dsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQCClaHzE2ul0gKSUxah5W0W8UiJLy4hXngKEqpaUq9SSdVdY2LK -wVfKH1gt5iuaf1FfzOhsIC9G/GLnjYttXZc92cv/Gfe3gR+s0ni2++MX+T++mE/Q -diltXv/Hp27PybS67SmiFW7I+RWnT2OKlMPtw2oUuKeztCe5UWjaj/y5FQIVAPLA -l9RpiU30Z87NRAHY3NTRaqtrAoGANMRxw8UfdtNVR0CrQj3AgPaXOGE4d+G4Gp4X -skvnCHycSVAjtYxebUkzUzt5Q6f/IabuLUdge3gXrc8BetvrcKbp+XZgM0/Vj2CF -Ymmy3in6kzGZq7Fw1sZaku6AOU8vLa5woBT2vAcHLLT1bLAzj7viL048T6MfjrOP -ef8nHvACgYBhDWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah -/XcF3DeRF+eEoz48wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+U -ykSTXYUbtsfTNRFQGBW2/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0CgIVAN4wtL5W -Lv62jKcdskxNyz2NQoBx ------END DSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_dsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_dsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_dsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_dsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1kc3MAAACBAIKVofMTa6XSApJTFqHlbRbxSIkvLiFeeAoSqlpSr1JJ1V1j -YsrBV8ofWC3mK5p/UV/M6GwgL0b8YueNi21dlz3Zy/8Z97eBH6zSeLb74xf5P76YT9B2 -KW1e/8enbs/JtLrtKaIVbsj5FadPY4qUw+3DahS4p7O0J7lRaNqP/LkVAAAAFQDywJfU -aYlN9GfOzUQB2NzU0WqrawAAAIA0xHHDxR9201VHQKtCPcCA9pc4YTh34bganheyS+cI -fJxJUCO1jF5tSTNTO3lDp/8hpu4tR2B7eBetzwF62+twpun5dmAzT9WPYIViabLeKfqT -MZmrsXDWxlqS7oA5Ty8trnCgFPa8BwcstPVssDOPu+IvTjxPox+Os495/yce8AAAAIBh -DWFQJ1mf99sg92LalVq1dHLmVXb3PTJDfCO/Gz5NFmj9EZbAtdah/XcF3DeRF+eEoz48 -wQF/ExVxSMIhLdL+o+ElpVhlM7Yii+T7dPhkQfEul6zZXu+UykSTXYUbtsfTNRFQGBW2 -/GfnEc0mnIxfn9v10NEWMzlq5z9wT9P0Cg== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_rsa_key erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_rsa_key --- erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_rsa_key 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_rsa_key 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8semM4q843337 -zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RWRWzjaxSB -6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4QIDAQAB -AoGANmvJzJO5hkLuvyDZHKfAnGTtpifcR1wtSa9DjdKUyn8vhKF0mIimnbnYQEmW -NUUb3gXCZLi9PvkpRSVRrASDOZwcjoU/Kvww163vBUVb2cOZfFhyn6o2Sk88Tt++ -udH3hdjpf9i7jTtUkUe+QYPsia+wgvvrmn4QrahLAH86+kECQQDx5gFeXTME3cnW -WMpFz3PPumduzjqgqMMWEccX4FtQkMX/gyGa5UC7OHFyh0N/gSWvPbRHa8A6YgIt -n8DO+fh5AkEAzbqX4DOn8NY6xJIi42q7l/2jIA0RkB6P7YugW5NblhqBZ0XDnpA5 -sMt+rz+K07u9XZtxgh1xi7mNfwY6lEAMqQJBAJBEauCKmRj35Z6OyeQku59SPsnY -+SJEREVvSNw2lH9SOKQQ4wPsYlTGbvKtNVZgAcen91L5MmYfeckYE/fdIZECQQCt -64zxsTnM1I8iFxj/gP/OYlJBikrKt8udWmjaghzvLMEw+T2DExJyb9ZNeT53+UMB -m6O+B/4xzU/djvp+0hbhAkAemIt+rA5kTmYlFndhpvzkSSM8a2EXsO4XIPgGWCTT -tQKS/tTly0ADMjN/TVy11+9d6zcqadNVuHXHGtR4W0GR ------END RSA PRIVATE KEY----- - diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_rsa_key.pub erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_rsa_key.pub --- erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_rsa_key.pub 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE_data/ssh_host_rsa_key.pub 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1yc2EAAAADAQABAAAAgQDCZX+4FBDwZIh9y/Uxee1VJnEXlowpz2yDKwj8 -semM4q843337zbNfxHmladB1lpz2NqyxI175xMIJuDxogyZdsOxGnFAzAnthR4dqL/RW -RWzjaxSB6IAO9SPYVVlrpZ+1hsjLW79fwXK/yc8VdhRuWTeQiRgYY2ek8+OKbOqz4Q== ----- END SSH2 PUBLIC KEY ---- diff -Nru erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE.erl erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE.erl --- erlang-18.2-dfsg/lib/ssh/test/ssh_upgrade_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/test/ssh_upgrade_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,207 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2014-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% --module(ssh_upgrade_SUITE). - -%% Note: This directive should only be used in test suites. --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --record(state, { - config, - root_dir, - server, - client, - connection, - soft - }). - - -%%%================================================================ -%%% -%%% CommonTest callbacks -%%% -all() -> - [ - minor_upgrade, - major_upgrade - ]. - -init_per_suite(Config0) -> - catch crypto:stop(), - try {crypto:start(), erlang:system_info({wordsize, internal}) == - erlang:system_info({wordsize, external})} of - {ok, true} -> - case ct_release_test:init(Config0) of - {skip, Reason} -> - {skip, Reason}; - Config -> - ssh:start(), - Config - end; - {ok, false} -> - {skip, "Test server will not handle halfwordemulator correctly. Skip as halfwordemulator is deprecated"} - catch _:_ -> - {skip, "Crypto did not start"} - end. - -end_per_suite(Config) -> - ct_release_test:cleanup(Config), - ssh:stop(), - crypto:stop(), - UserDir = ?config(priv_dir, Config), - ssh_test_lib:clean_rsa(UserDir). - -init_per_testcase(_TestCase, Config) -> - Config. -end_per_testcase(_TestCase, Config) -> - Config. - -%%%================================================================ -%%% -%%% Test cases -%%% -major_upgrade(Config) when is_list(Config) -> - ct_release_test:upgrade(ssh, major,{?MODULE, #state{config = Config}}, Config). - -minor_upgrade(Config) when is_list(Config) -> - ct_release_test:upgrade(ssh, minor,{?MODULE, #state{config = Config}}, Config). - -%%%================================================================ -%%% -%%% ct_release_test callbacks -%%% - -%%%---------------------------------------------------------------- -%%% Initialyze system before upgrade test starts. -%%% Called by ct_release_test:upgrade/4 -upgrade_init(CTData, State) -> - {ok, AppUp={_, _, Up, _Down}} = ct_release_test:get_appup(CTData, ssh), - ct:log("AppUp: ~p", [AppUp]), - ct:log("Up: ~p", [Up]), - case Soft = is_soft(Up) of - %% It is symmetrical, if upgrade is soft so is downgrade - true -> - setup_server_client(State#state{soft = Soft}); - false -> - State#state{soft = Soft} - end. - -%%%---------------------------------------------------------------- -%%% Check that upgrade was successful -%%% Called by ct_release_test:upgrade/4 -upgrade_upgraded(_, #state{soft=false} = State) -> - test_hard(State, "upgrade"); - -upgrade_upgraded(_, State) -> - test_soft(State, "upgrade1"). - -%%%---------------------------------------------------------------- -%%% Check that downgrade was successful. -%%% Called by ct_release_test:upgrade/4 -upgrade_downgraded(_, #state{soft=false} = State) -> - test_hard(State, "downgrade"); - -upgrade_downgraded(_, #state{soft=true} = State) -> - test_soft(State, "downgrade1"). - -%%%================================================================ -%%% -%%% Private functions -%%% - -is_soft([{restart_application, ssh}]) -> - false; -is_soft(_) -> - true. - - -test_hard(State0, FileName) -> - ct:log("test_hard State0=~p, FileName=~p",[State0, FileName]), - State = setup_server_client(State0), - test_connection(FileName, random_contents(), State). - -test_soft(State0, FileName) -> - ct:log("test_soft State0=~p, FileName=~p",[State0, FileName]), - State = test_connection(FileName, random_contents(), State0), - setup_server_client( close(State) ). - - -setup_server_client(#state{config=Config} = State) -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - - FtpRootDir = filename:join(PrivDir, "ftp_root"), - catch file:make_dir(FtpRootDir), - - SFTP = ssh_sftpd:subsystem_spec([{root,FtpRootDir},{cwd,FtpRootDir}]), - - {Server,Host,Port} = ssh_test_lib:daemon([{system_dir,DataDir}, - {user_passwords,[{"hej","hopp"}]}, - {subsystems,[SFTP]}]), - - {ok, ChannelPid, Connection} = - ssh_sftp:start_channel(Host, Port, [{user_interaction,false}, - {silently_accept_hosts,true}, - {user_dir,DataDir}, - {user,"hej"}, - {password,"hopp"}]), - State#state{server = Server, - client = ChannelPid, - connection = Connection}. - - -test_connection(FileName, FileContents, - #state{client = ChannelPid, - root_dir = FtpRootDir} = State) -> - ct:log("test_connection Writing with ssh_sftp:write_file",[]), - case ssh_sftp:write_file(ChannelPid, FileName, FileContents) of - ok -> - case ssh_sftp:read_file(ChannelPid, FileName) of - {ok,FileContents} -> - State; - {ok,Unexpected} -> - ct:fail("Expected ~p but got ~p from sftp:read_file(~p,..) in RootDir ~p", - [FileContents,Unexpected,FileName,FtpRootDir] - ); - Other -> - ct:fail("ssh_sftp:read_file(~p,~p) -> ~p~n" - "ssh_sftp:list_dir(~p,\".\") -> ~p", - [ChannelPid,FileName,Other, - ChannelPid, catch ssh_sftp:list_dir(ChannelPid, ".")]) - end; - - Other -> - ct:fail("ssh_sftp:write_file(~p,~p,~p) -> ~p",[ChannelPid,FileName,FileContents,Other]) - end. - - -close(#state{server = Server, - connection = Connection} = State) -> - ssh:close(Connection), - ssh:stop_daemon(Server), - State#state{server = undefined, - client = undefined, - connection = undefined}. - - -random_contents() -> list_to_binary( random_chars(3) ). - -random_chars(N) -> [crypto:rand_uniform($a,$z) || _<-lists:duplicate(N,x)]. diff -Nru erlang-18.2-dfsg/lib/ssh/vsn.mk erlang-17.3-dfsg/lib/ssh/vsn.mk --- erlang-18.2-dfsg/lib/ssh/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssh/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1,5 +1,5 @@ #-*-makefile-*- ; force emacs to enter makefile-mode -SSH_VSN = 4.2 - +SSH_VSN = 3.0.5 APP_VSN = "ssh-$(SSH_VSN)" + diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/book.xml erlang-17.3-dfsg/lib/ssl/doc/src/book.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/Makefile erlang-17.3-dfsg/lib/ssl/doc/src/Makefile --- erlang-18.2-dfsg/lib/ssl/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1999-2015. All Rights Reserved. +# Copyright Ericsson AB 1999-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -38,7 +37,7 @@ # Target Specs # ---------------------------------------------------- XML_APPLICATION_FILES = refman.xml -XML_REF3_FILES = ssl.xml ssl_crl_cache.xml ssl_crl_cache_api.xml ssl_session_cache_api.xml +XML_REF3_FILES = ssl.xml ssl_session_cache_api.xml XML_REF6_FILES = ssl_app.xml XML_PART_FILES = release_notes.xml usersguide.xml diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/notes.xml erlang-17.3-dfsg/lib/ssl/doc/src/notes.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -26,375 +25,7 @@ notes.xml

    This document describes the changes made to the SSL application.

    - - -
    SSL 7.2 - -
    Fixed Bugs and Malfunctions - - -

    - Honor distribution port range options

    -

    - Own Id: OTP-12838

    -
    - -

    - Correct supervisor specification in TLS distribution.

    -

    - Own Id: OTP-13134

    -
    - -

    - Correct cache timeout

    -

    - Own Id: OTP-13141

    -
    - -

    - Avoid crash and restart of ssl process when key file does - not exist.

    -

    - Own Id: OTP-13144

    -
    - -

    - Enable passing of raw socket options on the format - {raw,_,_,_} to the underlying socket.

    -

    - Own Id: OTP-13166

    -
    - -

    - Hibernation with small or a zero timeout will now work as - expected

    -

    - Own Id: OTP-13189

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Add upper limit for session cache, configurable on ssl - application level.

    -

    - If upper limit is reached, invalidate the current cache - entries, e.i the session lifetime is the max time a - session will be keept, but it may be invalidated earlier - if the max limit for the table is reached. This will keep - the ssl manager process well behaved, not exhusting - memeory. Invalidating the entries will incrementally - empty the cache to make room for fresh sessions entries.

    -

    - Own Id: OTP-12392

    -
    - -

    - Use new time functions to measure passed time.

    -

    - Own Id: OTP-12457

    -
    - -

    - Improved error handling in TLS distribution

    -

    - Own Id: OTP-13142

    -
    - -

    - Distribution over TLS now honors the nodelay distribution - flag

    -

    - Own Id: OTP-13143

    -
    -
    -
    - -
    - -
    SSL 7.1 -
    Fixed Bugs and Malfunctions - - -

    - Add DER encoded ECPrivateKey as valid input format for - key option.

    -

    - Own Id: OTP-12974

    -
    - -

    - Correct return value of default session callback module

    -

    - This error had the symptom that the client check for - unique session would always fail, potentially making the - client session table grow a lot and causing long setup - times.

    -

    - Own Id: OTP-12980

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Add possibility to downgrade an SSL/TLS connection to a - tcp connection, and give back the socket control to a - user process.

    -

    - This also adds the possibility to specify a timeout to - the ssl:close function.

    -

    - Own Id: OTP-11397

    -
    - -

    - Add application setting to be able to change fatal alert - shutdown timeout, also shorten the default timeout. The - fatal alert timeout is the number of milliseconds between - sending of a fatal alert and closing the connection. - Waiting a little while improves the peers chances to - properly receiving the alert so it may shutdown - gracefully.

    -

    - Own Id: OTP-12832

    -
    -
    -
    - -
    - -
    SSL 7.0 - -
    Fixed Bugs and Malfunctions - - -

    - Ignore signature_algorithm (TLS 1.2 extension) sent to - TLS 1.0 or TLS 1.1 server

    -

    - Own Id: OTP-12670

    -
    - -

    - Improve error handling in TLS distribution module to - avoid lingering sockets.

    -

    - Own Id: OTP-12799 Aux Id: Tom Briden

    -
    - -

    - Add option {client_renegotiation, boolean()} option to - the server-side of the SSL application.

    -

    - Own Id: OTP-12815

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Add new API functions to handle CRL-verification

    -

    - Own Id: OTP-10362 Aux Id: kunagi-215 [126]

    -
    - -

    - Remove default support for SSL-3.0, due to Poodle - vunrability in protocol specification.

    -

    - Add padding check for TLS-1.0 to remove Poodle - vunrability from TLS 1.0, also add the option - padding_check. This option only affects TLS-1.0 - connections and if set to false it disables the block - cipher padding check to be able to interoperate with - legacy software.

    -

    - Remove default support for RC4 cipher suites, as they are - consider too weak.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-12390

    -
    - -

    - Add support for TLS ALPN (Application-Layer Protocol - Negotiation) extension.

    -

    - Own Id: OTP-12580

    -
    - -

    - Add SNI (Server Name Indication) support for the server - side.

    -

    - Own Id: OTP-12736

    -
    -
    -
    - -
    - -
    SSL 6.0.1.1 -
    Fixed Bugs and Malfunctions - - -

    - Gracefully ignore proprietary hash_sign algorithms

    -

    - Own Id: OTP-12829

    -
    -
    -
    -
    - - -
    SSL 6.0.1 - -
    Fixed Bugs and Malfunctions - - -

    - Terminate gracefully when receving bad input to premaster - secret calculation

    -

    - Own Id: OTP-12783

    -
    -
    -
    - -
    - -
    SSL 6.0 - -
    Fixed Bugs and Malfunctions - - -

    - Exclude self-signed trusted anchor certificates from - certificate prospective certification path according to - RFC 3280.

    -

    - This will avoid some unnecessary certificate processing.

    -

    - Own Id: OTP-12449

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Separate client and server session cache internally.

    -

    - Avoid session table growth when client starts many - connections in such a manner that many connections are - started before session reuse is possible. Only save a new - session in client if there is no equivalent session - already stored.

    -

    - Own Id: OTP-11365

    -
    - -

    - The PEM cache is now validated by a background process, - instead of always keeping it if it is small enough and - clearing it otherwise. That strategy required that small - caches where cleared by API function if a file changes on - disk.

    -

    - However export the API function to clear the cache as it - may still be useful.

    -

    - Own Id: OTP-12391

    -
    - -

    - Add padding check for TLS-1.0 to remove Poodle - vulnerability from TLS 1.0, also add the option - padding_check. This option only affects TLS-1.0 - connections and if set to false it disables the block - cipher padding check to be able to interoperate with - legacy software.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-12420

    -
    - -

    - Add support for TLS_FALLBACK_SCSV used to prevent - undesired TLS version downgrades. If used by a client - that is vulnerable to the POODLE attack, and the server - also supports TLS_FALLBACK_SCSV, the attack can be - prevented.

    -

    - Own Id: OTP-12458

    -
    -
    -
    - -
    - -
    SSL 5.3.8 - -
    Fixed Bugs and Malfunctions - - -

    - Make sure the clean rule for ssh, ssl, eunit and otp_mibs - actually removes generated files.

    -

    - Own Id: OTP-12200

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Change code to reflect that state data may be secret to - avoid breaking dialyzer contracts.

    -

    - Own Id: OTP-12341

    -
    -
    -
    - -
    - -
    SSL 5.3.7 - -
    Fixed Bugs and Malfunctions - - -

    - Handle the fact that servers may send an empty SNI - extension to the client.

    -

    - Own Id: OTP-12198

    -
    -
    -
    - -
    - -
    SSL 5.3.6 +
    SSL 5.3.6
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/pkix_certs.xml erlang-17.3-dfsg/lib/ssl/doc/src/pkix_certs.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/pkix_certs.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/pkix_certs.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/refman.xml erlang-17.3-dfsg/lib/ssl/doc/src/refman.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/refman.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/refman.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19992015 + 19992013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -29,10 +28,23 @@ B refman.sgml
    + +

    The SSL application provides secure communication over + sockets. +

    +

    This product includes software developed by the OpenSSL Project for + use in the OpenSSL Toolkit (http://www.openssl.org/). +

    +

    This product includes cryptographic software written by Eric Young + (eay@cryptsoft.com). +

    +

    This product includes software written by Tim Hudson + (tjh@cryptsoft.com). +

    +

    For full OpenSSL and SSLeay license texts, see Licenses.

    +
    - -
    diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/release_notes.xml erlang-17.3-dfsg/lib/ssl/doc/src/release_notes.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/release_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/release_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/ssl_app.xml erlang-17.3-dfsg/lib/ssl/doc/src/ssl_app.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/ssl_app.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/ssl_app.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,145 +4,89 @@
    - 19992015 + 19992013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. ssl - - - - ssl_app.sgml
    ssl - The ssl application provides secure communication over + The SSL application provides secure communication over sockets. - -

    - The ssl application is an implementation of the SSL/TLS protocol in Erlang. -

    - - Supported SSL/TLS-versions are SSL-3.0, TLS-1.0, - TLS-1.1, and TLS-1.2. - For security reasons SSL-2.0 is not supported. - For security reasons SSL-3.0 is no longer supported by default, - but can be configured. - Ephemeral Diffie-Hellman cipher suites are supported, - but not Diffie Hellman Certificates cipher suites. - Elliptic Curve cipher suites are supported if the Crypto - application supports it and named curves are used. - - Export cipher suites are not supported as the - U.S. lifted its export restrictions in early 2000. - IDEA cipher suites are not supported as they have - become deprecated by the latest TLS specification so it is not - motivated to implement them. - CRL validation is supported. - Policy certificate extensions are not supported. - 'Server Name Indication' extension client side - (RFC 6066, Section 3) is supported. - -
    -
    DEPENDENCIES -

    The SSL application uses the public_key and - Crypto application to handle public keys and encryption, hence - these applications must be loaded for the SSL application to work. - In an embedded environment this means they must be started with - application:start/[1,2] before the SSL application is - started.

    +

    The ssl application uses the Erlang applications public_key and + crypto to handle public keys and encryption, hence these + applications needs to be loaded for the ssl application to work. In + an embedded environment that means they need to be started with + application:start/[1,2] before the ssl application is started. +

    - CONFIGURATION -

    The application environment configuration parameters in this section - are defined for the SSL application. For more information - about configuration parameters, see the - application(3) - manual page in Kernel.

    - -

    The environment parameters can be set on the command line, - for example:

    - -

    erl -ssl protocol_version "['tlsv1.2', 'tlsv1.1']"

    - + ENVIRONMENT +

    The following application environment configuration parameters + are defined for the SSL application. See application(3)for more + information about configuration parameters. +

    +

    Note that the environment parameters can be set on the command line, + for instance,

    +

    erl ... -ssl protocol_version '[sslv3, tlsv1]' .... +

    - protocol_version = ssl:protocol()]]> -

    Protocol supported by started clients and - servers. If this option is not set, it defaults to all - protocols currently supported by the SSL application. - This option can be overridden by the version option - to ssl:connect/[2,3] and ssl:listen/2.

    + ]]>. + +

    Protocol that will be supported by started clients and + servers. If this option is not set it will default to all + protocols currently supported by the erlang ssl application. + Note that this option may be overridden by the version option + to ssl:connect/[2,3] and ssl:listen/2. +

    +
    ]]> -

    Maximum lifetime of the session data in seconds.

    - - ]]> -

    Name of the session cache callback module that implements - the ssl_session_cache_api behavior. Defaults to - ssl_session_cache.

    - - ]]> - -

    List of extra user-defined arguments to the init function - in the session cache callback module. Defaults to [].

    - - ]]>
    - ]]>
    -

    Limits the growth of the clients/servers session cache, - if the maximum number of sessions is reached, the current cache entries will - be invalidated regardless of their remaining lifetime. Defaults to 1000. -

    - - ]]> -

    - Number of milliseconds between PEM cache validations. +

    The lifetime of session data in seconds.

    - ssl:clear_pem_cache/0 -
    - ]]> + + ]]> + +

    + Name of session cache callback module that implements + the ssl_session_cache_api behavior, defaults to + ssl_session_cache.erl. +

    +
    + + ]]>

    - Number of milliseconds between sending of a fatal alert and - closing the connection. Waiting a little while improves the - peers chances to properly receiving the alert so it may - shutdown gracefully. Defaults to 5000 milliseconds. + List of arguments to the init function in session cache + callback module, defaults to [].

    -
    - ERROR LOGGER AND EVENT HANDLERS -

    The SSL application uses the default OTP error logger to log - unexpected errors and TLS alerts. The logging of TLS alerts may be - turned off with the log_alert option.

    -
    - -
    SEE ALSO

    application(3)

    diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/ssl_crl_cache_api.xml erlang-17.3-dfsg/lib/ssl/doc/src/ssl_crl_cache_api.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/ssl_crl_cache_api.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/ssl_crl_cache_api.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ - - - - -
    - - 20152015 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ssl_crl_cache_api - ssl_crl_cache_api.xml -
    - - ssl_crl_cache_api - API for a SSL/TLS CRL (Certificate Revocation List) cache. - -

    - When SSL/TLS performs certificate path validation according to - RFC 5280 - it should also perform CRL validation checks. To enable the CRL - checks the application needs access to CRLs. A database of CRLs - can be set up in many different ways. This module provides the - behavior of the API needed to integrate an arbitrary CRL cache - with the erlang ssl application. It is also used by the - application itself to provide a simple default implementation of - a CRL cache. -

    -
    - -
    - DATA TYPES - -

    The following data types are used in the functions below: -

    - - - - cache_ref() = - opaque() - dist_point() = -

    #'DistributionPoint'{} see X509 certificates records

    - -
    - -
    - - - fresh_crl(DistributionPoint, CRL) -> FreshCRL - fun fresh_crl/2 will be used as input option update_crl to - public_key:pkix_crls_validate/3 - - DistributionPoint = dist_point() - CRL = [public_key:der_encoded()] - FreshCRL = [public_key:der_encoded()] - - -

    fun fresh_crl/2 will be used as input option update_crl to - public_key:pkix_crls_validate/3

    -
    -
    - - - lookup(DistributionPoint, DbHandle) -> not_available | CRLs - - - DistributionPoint = dist_point() - DbHandle = cache_ref() - CRLs = [public_key:der_encoded()] - -

    Lookup the CRLs belonging to the distribution point Distributionpoint. - This function may choose to only look in the cache or to follow distribution point - links depending on how the cache is administrated.

    -
    -
    - - - select(Issuer, DbHandle) -> CRLs - Select the CRLs in the cache that are issued by Issuer - - Issuer = public_key:issuer_name() - DbHandle = cache_ref() - - -

    Select the CRLs in the cache that are issued by Issuer

    -
    -
    -
    -
    diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/ssl_crl_cache.xml erlang-17.3-dfsg/lib/ssl/doc/src/ssl_crl_cache.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/ssl_crl_cache.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/ssl_crl_cache.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ - - - - -
    - - 20152015 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ssl_crl_cache - ssl_crl_cache.xml -
    - - ssl_crl_cache - CRL cache - -

    - Implements an internal CRL (Certificate Revocation List) cache. - In addition to implementing the ssl_crl_cache_api behaviour - the following functions are available. -

    -
    - - - - delete(Entries) -> ok | {error, Reason} - - - Entries = http_uri:uri() | {file, string()} | {der, [ public_key:der_encoded() ]} - Reason = term() - - -

    Delete CRLs from the ssl applications local cache.

    -
    -
    - - insert(CRLSrc) -> ok | {error, Reason} - insert(URI, CRLSrc) -> ok | {error, Reason} - - - CRLSrc = {file, string()} | {der, [ public_key:der_encoded() ]} - URI = http_uri:uri() - Reason = term() - - -

    Insert CRLs into the ssl applications local cache.

    -
    -
    -
    -
    \ No newline at end of file diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/ssl_distribution.xml erlang-17.3-dfsg/lib/ssl/doc/src/ssl_distribution.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/ssl_distribution.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/ssl_distribution.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -32,20 +31,23 @@ B ssl_distribution.xml -

    This section describes how the Erlang distribution can use - SSL to get extra verification and security.

    +

    This chapter describes how the Erlang distribution can use + SSL to get additional verification and security. +

    -

    The Erlang distribution can in theory use almost any - connection-based protocol as bearer. However, a module that - implements the protocol-specific parts of the connection setup is - needed. The default distribution module is inet_tcp_dist - in the Kernel application. When starting an +

    + Introduction +

    The Erlang distribution can in theory use almost any connection + based protocol as bearer. A module that implements the protocol + specific parts of the connection setup is however needed. The + default distribution module is inet_tcp_dist which is + included in the Kernel application. When starting an Erlang node distributed, net_kernel uses this module to - set up listen ports and connections.

    + setup listen ports and connections.

    -

    In the SSL application, an exra distribution - module, inet_tls_dist, can be used as an - alternative. All distribution connections will use SSL and +

    In the SSL application there is an additional distribution + module, inet_tls_dist which can be used as an + alternative. All distribution connections will be using SSL and all participating Erlang nodes in a distributed system must use this distribution module.

    @@ -53,45 +55,35 @@ SSL connection setup. Erlang node cookies are however always used, as they can be used to differentiate between two different Erlang networks.

    - -

    To set up Erlang distribution over SSL:

    +

    Setting up Erlang distribution over SSL involves some simple but + necessary steps:

    - Step 1: Build boot scripts including the - SSL application. - Step 2: Specify the distribution module for - net_kernel. - Step 3: Specify the security options and other - SSL options. - Step 4: Set up the environment to always use SSL. + Building boot scripts including the SSL application + Specifying the distribution module for net_kernel + Specifying security options and other SSL options - -

    The following sections describe these steps.

    +

    The rest of this chapter describes the above mentioned steps in + more detail.

    +
    - Building Boot Scripts Including the ssl Application + Building boot scripts including the SSL application

    Boot scripts are built using the systools utility in the - sasl application. For more information on systools, - see the sasl documentation. This is only an example of + SASL application. Refer to the SASL documentations + for more information on systools. This is only an example of what can be done.

    -

    The simplest boot script possible includes only the Kernel - and STDLIB applications. Such a script is located in the - bin directory of the Erlang distribution. The source for the - script is found under the Erlang installation top directory under - /start_clean.rel]]>.

    - -

    Do the following:

    - -

    Copy that script to another location (and preferably another - name).

    -

    Add the applications Crypto, Public Key, and - SSL with their current version numbers after the - STDLIB application.

    -
    +

    The simplest boot script possible includes only the Kernel + and STDLIB applications. Such a script is located in the + Erlang distributions bin directory. The source for the script + can be found under the Erlang installation top directory under + /start_clean.rel]]>. Copy that + script to another location (and preferably another name) + and add the applications crypto, public_key and SSL with their current version numbers + after the STDLIB application.

    +

    An example .rel file with SSL added may look like this:

    -

    The following shows an example .rel file with SSL - added:

    {release, {"OTP APN 181 01","R15A"}, {erts, "5.9"}, [{kernel,"2.15"}, @@ -102,29 +94,23 @@ ]}. -

    The version numbers differ in your system. Whenever one of the - applications included in the script is upgraded, change the script.

    +

    Note that the version numbers surely will differ in your system. + Whenever one of the applications included in the script is + upgraded, the script has to be changed.

    +

    Assuming the above .rel file is stored in a file + start_ssl.rel in the current directory, a boot script + can be built like this:

    -

    Do the following:

    - -

    Build the boot script.

    -

    Assuming the .rel file is stored in a file - start_ssl.rel in the current directory, a boot script - can be built as follows:

    -
    1> systools:make_script("start_ssl",[]). -

    There is now a start_ssl.boot file in the current - directory.

    +

    There will now be a file start_ssl.boot in the current + directory. To test the boot script, start Erlang with the + -boot command line parameter specifying this boot script + (with its full path but without the .boot suffix), in + Unix it could look like this:

    +

    -

    Do the following:

    - -

    Test the boot script. To do this, start Erlang with the - -boot command-line parameter specifying this boot script - (with its full path, but without the .boot suffix). In - UNIX it can look as follows:

    -
    whereis(ssl_manager). <0.41.0> ]]> +

    The whereis function call verifies that the SSL + application is really started.

    -

    The whereis function-call verifies that the SSL - application is started.

    - -

    As an alternative to building a bootscript, you can explicitly +

    As an alternative to building a bootscript, one can explicitly add the path to the SSL ebin directory on the command - line. This is done with command-line option -pa. This + line. This is done with the command line option -pa. This works as the SSL application does not need to be started for the distribution to come up, as a clone of the SSL application is - hooked into the Kernel application. So, as long as the - SSL application code can be reached, the distribution starts. - The -pa method is only recommended for testing purposes.

    + hooked into the kernel application, so as long as the + SSL applications code can be reached, the distribution will + start. The -pa method is only recommended for testing + purposes.

    -

    The clone of the SSL application must +

    Note that the clone of the SSL application is necessary to enable the use of the SSL code in such an early bootstage as - needed to set up the distribution. However, this makes it + needed to setup the distribution, however this will make it impossible to soft upgrade the SSL application.

    - Specifying Distribution Module for net_kernel + Specifying distribution module for net_kernel

    The distribution module for SSL is named inet_tls_dist - and is specified on the command line with option -proto_dist. - The argument to -proto_dist is to be the module - name without suffix _dist. So, this distribution + and is specified on the command line with the -proto_dist + option. The argument to -proto_dist should be the module + name without the _dist suffix, so this distribution module is specified with -proto_dist inet_tls on the command line.

    +

    -

    Extending the command line gives the following:

    +

    Extending the command line from above gives us the following:

    $ erl -boot /home/me/ssl/start_ssl -proto_dist inet_tls -

    For the distribution to be started, give the emulator a name as well:

    +

    For the distribution to actually be started, we need to give +the emulator a name as well:

    $ erl -boot /home/me/ssl/start_ssl -proto_dist inet_tls -sname ssl_test Erlang (BEAM) emulator version 5.0 [source] Eshell V5.0 (abort with ^G) (ssl_test@myhost)1> - -

    However, a node started in this way refuses to talk - to other nodes, as no SSL parameters are supplied - (see the next section).

    +

    Note however that a node started in this way will refuse to talk + to other nodes, as no ssl parameters are supplied + (see below).

    - Specifying SSL Options -

    For SSL to work, at least - a public key and a certificate must be specified for the server - side. In the following example, the PEM-files consist of two - entries, the server certificate and its private key.

    - -

    On the erl command line you can specify options that the - SSL distribution adds when creating a socket.

    - -

    The simplest SSL options in the following list can be specified - by adding the - prefix server_ or client_ to the option name:

    - - certfile - keyfile - password - cacertfile - verify - reuse_sessions - secure_renegotiate - depth - hibernate_after - ciphers (use old string format) - - -

    The server can also take the options dhfile and - fail_if_no_peer_cert (also prefixed).

    - -

    client_-prefixed options are used when the distribution - initiates a connection to another node. server_-prefixed - options are used when accepting a connection from a remote node.

    - -

    More complex options, such as verify_fun, are currently not - available, but a mechanism to handle such options may be added in - a future release.

    - -

    Raw socket options, such as packet and size must not - be specified on the command line.

    - -

    The command-line argument for specifying the SSL options is named - -ssl_dist_opt and is to be followed by pairs of - SSL options and their values. Argument -ssl_dist_opt can + Specifying SSL options

    For SSL to work, at least + a public key and certificate needs to be specified for the server + side. In the following example the PEM-files consists of two + entries the servers certificate and its private key.

    + +

    On the erl command line one can specify options that the + SSL distribution will add when creating a socket.

    + +

    One can specify the simpler SSL options certfile, keyfile, + password, cacertfile, verify, reuse_sessions, + secure_renegotiate, depth, hibernate_after and ciphers (use old + string format) by adding the prefix server_ or client_ to the + option name. The server can also take the options dhfile and + fail_if_no_peer_cert (also prefixed). + client_-prfixed options are used when the distribution initiates a + connection to another node and the server_-prefixed options are used + when accepting a connection from a remote node.

    + +

    More complex options such as verify_fun are not available at + the moment but a mechanism to handle such options may be added in + a future release.

    + +

    Raw socket options such as packet and size must not be specified on + the command line

    . + +

    The command line argument for specifying the SSL options is named + -ssl_dist_opt and should be followed by pairs of + SSL options and their values. The -ssl_dist_opt argument can be repeated any number of times.

    -

    An example command line can now look as follows +

    An example command line would now look something like this (line breaks in the command are for readability, - and are not be there when typed):

    + they should not be there when typed):

    $ erl -boot /home/me/ssl/start_ssl -proto_dist inet_tls -ssl_dist_opt server_certfile "/home/me/ssl/erlserver.pem" @@ -234,20 +207,20 @@ Eshell V5.0 (abort with ^G) (ssl_test@myhost)1> -

    A node started in this way is fully functional, using SSL +

    A node started in this way will be fully functional, using SSL as the distribution protocol.

    - Setting up Environment to Always Use SSL -

    A convenient way to specify arguments to Erlang is to use environment - variable ERL_FLAGS. All the flags needed to - use the SSL distribution can be specified in that variable and are - then interpreted as command-line arguments for all + Setting up environment to always use SSL +

    A convenient way to specify arguments to Erlang is to use the + ERL_FLAGS environment variable. All the flags needed to + use SSL distribution can be specified in that variable and will + then be interpreted as command line arguments for all subsequent invocations of Erlang.

    - -

    In a Unix (Bourne) shell, it can look as follows (line breaks are for - readability, they are not to be there when typed):

    +

    +

    In a Unix (Bourne) shell it could look like this (line breaks for + readability, they should not be there when typed):

    $ ERL_FLAGS="-boot /home/me/ssl/start_ssl -proto_dist inet_tls -ssl_dist_opt server_certfile /home/me/ssl/erlserver.pem @@ -267,8 +240,7 @@ {ssl_dist_opt,["server_secure_renegotiate","true", "client_secure_renegotiate","true"] {home,["/home/me"]}] -

    The init:get_arguments() call verifies that the correct - arguments are supplied to the emulator.

    + arguments are supplied to the emulator.

    diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/ssl_introduction.xml erlang-17.3-dfsg/lib/ssl/doc/src/ssl_introduction.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/ssl_introduction.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/ssl_introduction.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ - - - - -
    - - 2015 - 2015 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - Introduction - OTP team - - 2015-03-05 - A - ssl_introduction.xml -
    - -
    - Purpose -

    Transport Layer Security (TLS) and its predecessor, the Secure - Sockets Layer (SSL), are cryptographic protocols designed to - provide communications security over a computer network. The protocols use - use X.509 certificates and hence public key (asymmetric) cryptography to - authenticate the counterpart with whom they communicate, - and to exchange a symmetric key for payload encryption. The protocol provides - data/message confidentiality (encryption), integrity (through message authentication code checks) - and host verification (through certificate path validation).

    -
    - -
    - Prerequisites -

    It is assumed that the reader is familiar with the Erlang - programming language, the concepts of OTP, and has a basic - understanding of SSL/TLS.

    -
    - -
    diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/ssl_protocol.xml erlang-17.3-dfsg/lib/ssl/doc/src/ssl_protocol.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/ssl_protocol.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/ssl_protocol.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,60 +4,50 @@
    - 20032015 + 20032013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. - TLS and its Predecessor, SSL - - - - - - - + Transport Layer Security (TLS) and its predecessor, Secure Socket Layer (SSL) ssl_protocol.xml
    -

    The Erlang SSL application implements the SSL/TLS protocol - for the currently supported versions, see the - ssl(3) manual page. +

    The erlang SSL application currently implements the protocol SSL/TLS + for currently supported versions see ssl(3)

    -

    By default SSL/TLS is run over the TCP/IP protocol even - though you can plug in any other reliable transport protocol - with the same Application Programming Interface (API) as the - gen_tcp module in Kernel.

    +

    By default erlang SSL is run over the TCP/IP protocol even + though you could plug in any other reliable transport protocol + with the same API as gen_tcp.

    -

    If a client and a server wants to use an upgrade mechanism, such as - defined by RFC 2817, to upgrade a regular TCP/IP connection to an SSL - connection, this is supported by the Erlang SSL application API. This can be - useful for, for example, supporting HTTP and HTTPS on the same port and +

    If a client and server wants to use an upgrade mechanism, such as + defined by RFC2817, to upgrade a regular TCP/IP connection to an SSL + connection the erlang SSL API supports this. This can be useful for + things such as supporting HTTP and HTTPS on the same port and implementing virtual hosting.

    - Security Overview + Security overview -

    To achieve authentication and privacy, the client and server - perform a TLS handshake procedure before transmitting or receiving - any data. During the handshake, they agree on a protocol version and - cryptographic algorithms, generate shared secrets using public - key cryptographies, and optionally authenticate each other with +

    To achieve authentication and privacy the client and server will + perform a TLS Handshake procedure before transmitting or receiving + any data. During the handshake they agree on a protocol version and + cryptographic algorithms, they generate shared secrets using public + key cryptographics and optionally authenticate each other with digital certificates.

    @@ -65,21 +55,20 @@ Data Privacy and Integrity

    A symmetric key algorithm has one key only. The key is - used for both encryption and decryption. These algorithms are fast, - compared to public key algorithms (using two keys, one public and one - private) and are therefore typically used for encrypting bulk + used for both encryption and decryption. These algorithms are fast + compared to public key algorithms (using two keys, a public and a + private one) and are therefore typically used for encrypting bulk data.

    The keys for the symmetric encryption are generated uniquely for each connection and are based on a secret negotiated - in the TLS handshake.

    + in the TLS handshake.

    -

    The TLS handshake protocol and data transfer is run on top of - the TLS Record Protocol, which uses a keyed-hash Message - Authenticity Code (MAC), or a Hash-based MAC (HMAC), - to protect the message data - integrity. From the TLS RFC: "A Message Authentication Code is a +

    The TLS handshake protocol and data transfer is run on top of + the TLS Record Protocol that uses a keyed-hash MAC (Message + Authenticity Code), or HMAC, to protect the message's data + integrity. From the TLS RFC "A Message Authentication Code is a one-way hash computed from a message and some secret data. It is difficult to forge without knowing the secret data. Its purpose is to detect if the message has been altered." @@ -93,43 +82,40 @@ passport. The holder of the certificate is called the subject. The certificate is signed with the private key of the issuer of the certificate. A chain - of trust is built by having the issuer in its turn being - certified by another certificate, and so on, until you reach the - so called root certificate, which is self-signed, that is, issued + of trust is build by having the issuer in its turn being + certified by another certificate and so on until you reach the + so called root certificate that is self signed i.e. issued by itself.

    -

    Certificates are issued by Certification Authorities (CAs) only. - A handful of top CAs in the world issue root certificates. You can - examine several of these certificates by clicking +

    Certificates are issued by certification + authorities (CAs) only. There are a handful of + top CAs in the world that issue root certificates. You can + examine the certificates of several of them by clicking through the menus of your web browser.

    - Peer Authentication + Authentication of Sender -

    Authentication of the peer is done by public key path - validation as defined in RFC 3280. This means basically - the following:

    - - Each certificate in the certificate chain is issued by the - previous one. - The certificates attributes are valid. - The root certificate is a trusted certificate that is present - in the trusted certificate database kept by the peer. - +

    Authentication of the sender is done by public key path + validation as defined in RFC 3280. Simplified that means that + each certificate in the certificate chain is issued by the one + before, the certificates attributes are valid ones, and the + root cert is a trusted cert that is present in the trusted + certs database kept by the peer.

    -

    The server always sends a certificate chain as part of - the TLS handshake, but the client only sends one if requested - by the server. If the client does not have - an appropriate certificate, it can send an "empty" certificate +

    The server will always send a certificate chain as part of + the TLS handshake, but the client will only send one if + the server requests it. If the client does not have + an appropriate certificate it may send an "empty" certificate to the server.

    -

    The client can choose to accept some path evaluation errors, - for example, a web browser can ask the user whether to - accept an unknown CA root certificate. The server, if it requests - a certificate, does however not accept any path validation - errors. It is configurable if the server is to accept +

    The client may choose to accept some path evaluation errors + for instance a web browser may ask the user if they want to + accept an unknown CA root certificate. The server, if it request + a certificate, will on the other hand not accept any path validation + errors. It is configurable if the server should accept or reject an "empty" certificate as response to a certificate request.

    @@ -137,24 +123,25 @@
    TLS Sessions -

    From the TLS RFC: "A TLS session is an association between a - client and a server. Sessions are created by the handshake +

    From the TLS RFC "A TLS session is an association between a + client and a server. Sessions are created by the handshake protocol. Sessions define a set of cryptographic security parameters, which can be shared among multiple connections. Sessions are used to avoid the expensive negotiation of new security parameters for each connection."

    Session data is by default kept by the SSL application in a - memory storage, hence session data is lost at application - restart or takeover. Users can define their own callback module + memory storage hence session data will be lost at application + restart or takeover. Users may define their own callback module to handle session data storage if persistent data storage is - required. Session data is also invalidated after 24 hours - from it was saved, for security reasons. The amount of time the - session data is to be saved can be configured.

    - -

    By default the SSL clients try to reuse an available session and - by default the SSL servers agree to reuse sessions when clients - ask for it.

    + required. Session data will also be invalidated after 24 hours + from it was saved, for security reasons. It is of course + possible to configure the amount of time the session data should be + saved.

    + +

    SSL clients will by default try to reuse an available session, + SSL servers will by default agree to reuse sessions when clients + ask to do so.

    diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/ssl_session_cache_api.xml erlang-17.3-dfsg/lib/ssl/doc/src/ssl_session_cache_api.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/ssl_session_cache_api.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/ssl_session_cache_api.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,76 +4,59 @@
    - 19992015 + 19992013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. ssl - - - - ssl_session_cache_api.xml
    ssl_session_cache_api - TLS session cache API + Defines the API for the TLS session cache so + that the data storage scheme can be replaced by + defining a new callback module implementing this API. - -

    - Defines the API for the TLS session cache so - that the data storage scheme can be replaced by - defining a new callback module implementing this API. -

    -
    - DATA TYPES - -

    The following data types are used in the functions for - ssl_session_cache_api:

    - - - cache_ref() = -

    opaque()

    - - key() = -

    {partialkey(), session_id()}

    + Common Data Types - partialkey() = -

    opaque()

    - - session_id() = -

    binary()

    +

    The following data types are used in the functions below: +

    - session() = -

    opaque()

    -
    +

    cache_ref() = opaque()

    + +

    key() = {partialkey(), session_id()}

    + +

    partialkey() = opaque()

    + +

    session_id() = binary()

    +

    session() = opaque()

    +
    delete(Cache, Key) -> _ - Deletes a cache entry. + - Cache = cache_ref() - Key = key() + Cache = cache_ref() + Key = key() -

    Deletes a cache entry. Is only called from the cache +

    Deletes a cache entry. Will only be called from the cache handling process.

    @@ -86,50 +69,41 @@ -

    Calls Fun(Elem, AccIn) on successive elements of the - cache, starting with AccIn == Acc0. Fun/2 must - return a new accumulator, which is passed to the next call. - The function returns the final value of the accumulator. - Acc0 is returned if the cache is empty. +

    Calls Fun(Elem, AccIn) on successive elements of the + cache, starting with AccIn == Acc0. Fun/2 must return a new + accumulator which is passed to the next call. The function returns + the final value of the accumulator. Acc0 is returned if the cache is + empty.

    - init(Args) -> opaque() - Returns cache reference. + init() -> opaque() + Return cache reference - Args = proplists:proplist() + -

    Includes property {role, client | server}. - Currently this is the only predefined property, - there can also be user-defined properties. See also - application environment variable - session_cb_init_args. -

    Performs possible initializations of the cache and returns - a reference to it that is used as parameter to the other - API functions. Is called by the cache handling processes - init function, hence putting the same requirements on it - as a normal process init function. This function is - called twice when starting the SSL application, once with - the role client and once with the role server, as the SSL - application must be prepared to take on both roles. + a reference to it that will be used as parameter to the other + api functions. Will be called by the cache handling processes + init function, hence putting the same requirements on it as + a normal process init function.

    lookup(Cache, Key) -> Entry - Looks up a cache entry. + Looks up a cache entry. - Cache = cache_ref() - Key = key() - Entry = session() | undefined + Cache = cache_ref() + Key = key() + Entry = session() | undefined -

    Looks up a cache entry. Is to be callable from any +

    Looks up a cache entry. Should be callable from any process.

    @@ -137,14 +111,14 @@ select_session(Cache, PartialKey) -> [session()] - Selects sessions that can be reused. + >Selects sessions that could be reused. - Cache = cache_ref() - PartialKey = partialkey() - Session = session() + Cache = cache_ref() + PartialKey = partialkey() + Session = session() -

    Selects sessions that can be reused. Is to be callable +

    Selects sessions that could be reused. Should be callable from any process.

    @@ -155,7 +129,7 @@ Called by the process that handles the cache when it is about to terminate. - Cache = term() - as returned by init/0 + Cache = term() - as returned by init/0

    Takes care of possible cleanup that is needed when the @@ -166,15 +140,15 @@ update(Cache, Key, Session) -> _ - Caches a new session or updates an already cached one. + Caches a new session or updates a already cached one. - Cache = cache_ref() - Key = key() - Session = session() + Cache = cache_ref() + Key = key() + Session = session() -

    Caches a new session or updates an already cached one. Is - only called from the cache handling process. +

    Caches a new session or updates a already cached one. Will + only be called from the cache handling process.

    diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/ssl.xml erlang-17.3-dfsg/lib/ssl/doc/src/ssl.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/ssl.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/ssl.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,275 +4,258 @@
    - 19992015 + 19992014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. ssl - - - - ssl.xml
    ssl Interface Functions for Secure Socket Layer -

    - This module contains interface functions for the SSL/TLS protocol. - For detailed information about the supported standards see - ssl(6). +

    This module contains interface functions to the Secure Socket + Layer.

    - +
    - DATA TYPES -

    The following data types are used in the functions for SSL:

    - - - - boolean() = -

    true | false

    - - option() = -

    socketoption() | ssloption() | transportoption()

    -
    - - socketoption() = -

    proplists:property()

    -

    The default socket options are - [{mode,list},{packet, 0},{header, 0},{active, true}].

    -

    For valid options, see the - inet(3) and - gen_tcp(3) manual pages - in Kernel.

    - - ssloption() = - -

    {verify, verify_type()}

    -

    | {verify_fun, {fun(), term()}}

    -

    | {fail_if_no_peer_cert, boolean()}

    -

    | {depth, integer()}

    -

    | {cert, public_key:der_encoded()}

    -

    | {certfile, path()}

    -

    | {key, {'RSAPrivateKey'| 'DSAPrivateKey' | 'ECPrivateKey' - | 'PrivateKeyInfo', public_key:der_encoded()}}

    -

    | {keyfile, path()}

    -

    | {password, string()}

    -

    | {cacerts, [public_key:der_encoded()]}

    -

    | {cacertfile, path()}

    -

    | {dh, public_key:der_encoded()}

    -

    | {dhfile, path()}

    -

    | {ciphers, ciphers()}

    -

    | {user_lookup_fun, {fun(), term()}}, {psk_identity, string()}, - {srp_identity, {string(), string()}}

    -

    | {reuse_sessions, boolean()}

    -

    | {reuse_session, fun()} {next_protocols_advertised, [binary()]}

    -

    | {client_preferred_next_protocols, {client | server, - [binary()]} | {client | server, [binary()], binary()}}

    -

    | {log_alert, boolean()}

    -

    | {server_name_indication, hostname() | disable}

    -

    | {sni_hosts, [{hostname(), ssloptions()}]}

    -

    | {sni_fun, SNIfun::fun()}

    -
    - - transportoption() = -

    {cb_info, {CallbackModule::atom(), DataTag::atom(), - - ClosedTag::atom(), ErrTag:atom()}}

    -

    Defaults to {gen_tcp, tcp, tcp_closed, tcp_error}. Can be used - to customize the transport layer. The callback module must implement a - reliable transport protocol, behave as gen_tcp, and have functions - corresponding to inet:setopts/2, inet:getopts/2, - inet:peername/1, inet:sockname/1, and inet:port/1. - The callback gen_tcp is treated specially and calls inet - directly.

    - - CallbackModule = -

    atom()

    - DataTag = -

    atom()

    -

    Used in socket data message.

    - ClosedTag = -

    atom()

    -

    Used in socket close message.

    -
    -
    - - verify_type() = -

    verify_none | verify_peer

    - - path() = -

    string()

    -

    Represents a file path.

    + SSL - public_key:der_encoded() = -

    binary()

    -

    ASN.1 DER-encoded entity as an Erlang binary.

    - - host() = -

    hostname() | ipaddress()

    - - hostname() = -

    string()

    - - ip_address() = -

    {N1,N2,N3,N4} % IPv4 | {K1,K2,K3,K4,K5,K6,K7,K8} % IPv6 -

    + + ssl requires the crypto and public_key applications. + Supported SSL/TLS-versions are SSL-3.0, TLS-1.0, + TLS-1.1 and TLS-1.2. + For security reasons sslv2 is not supported. + Ephemeral Diffie-Hellman cipher suites are supported + but not Diffie Hellman Certificates cipher suites. + Elliptic Curve cipher suites are supported if crypto + supports it and named curves are used. + + Export cipher suites are not supported as the + U.S. lifted its export restrictions in early 2000. + IDEA cipher suites are not supported as they have + become deprecated by the latest TLS spec so there is not any + real motivation to implement them. + CRL and policy certificate extensions are not supported + yet. However CRL verification is supported by public_key, only not integrated + in ssl yet. + Support for 'Server Name Indication' extension client side + (RFC 6066 section 3). + + +
    + +
    + COMMON DATA TYPES +

    The following data types are used in the functions below: +

    - sslsocket() = -

    opaque()

    +

    boolean() = true | false

    - protocol() = -

    sslv3 | tlsv1 | 'tlsv1.1' | 'tlsv1.2'

    +

    option() = socketoption() | ssloption() | transportoption()

    - ciphers() = -

    = [ciphersuite()] | string()

    -

    According to old API.

    +

    socketoption() = proplists:property() - The default socket options are + [{mode,list},{packet, 0},{header, 0},{active, true}]. +

    - ciphersuite() = -

    {key_exchange(), cipher(), hash()}

    +

    For valid options + see inet(3) and + gen_tcp(3). +

    + +

    ssloption() = {verify, verify_type()} | + {verify_fun, {fun(), term()}} | + {fail_if_no_peer_cert, boolean()} + {depth, integer()} | + {cert, der_encoded()}| {certfile, path()} | + {key, {'RSAPrivateKey'| 'DSAPrivateKey' | 'ECPrivateKey' |'PrivateKeyInfo', der_encoded()}} | + {keyfile, path()} | {password, string()} | + {cacerts, [der_encoded()]} | {cacertfile, path()} | + |{dh, der_encoded()} | {dhfile, path()} | {ciphers, ciphers()} | + {user_lookup_fun, {fun(), term()}}, {psk_identity, string()}, {srp_identity, {string(), string()}} | + {ssl_imp, ssl_imp()} | {reuse_sessions, boolean()} | {reuse_session, fun()} + {next_protocols_advertised, [binary()]} | + {client_preferred_next_protocols, {client | server, [binary()]} | {client | server, [binary()], binary()}} | + {log_alert, boolean()} | {server_name_indication, hostname() | disable} +

    + +

    transportoption() = {cb_info, {CallbackModule::atom(), DataTag::atom(), ClosedTag::atom(), ErrTag:atom()}} + - defaults to {gen_tcp, tcp, tcp_closed, tcp_error}. Can be used to customize + the transport layer. The callback module must implement a reliable transport + protocol and behave as gen_tcp and in addition have functions corresponding to + inet:setopts/2, inet:getopts/2, inet:peername/1, inet:sockname/1 and inet:port/1. + The callback gen_tcp is treated specially and will call inet directly. +

    + +

          CallbackModule = + atom() +

          DataTag = + atom() - tag used in socket data message.

    +

          ClosedTag = atom() - tag used in + socket close message.

    - key_exchange()= -

    rsa | dhe_dss | dhe_rsa | dh_anon | psk | dhe_psk - | rsa_psk | srp_anon | srp_dss | srp_rsa | ecdh_anon | ecdh_ecdsa - | ecdhe_ecdsa | ecdh_rsa | ecdhe_rsa

    +

    verify_type() = verify_none | verify_peer

    + +

    path() = string() - representing a file path.

    - cipher() = -

    rc4_128 | des_cbc | '3des_ede_cbc' - | aes_128_cbc | aes_256_cbc | aes_128_gcm | aes_256_gcm

    +

    der_encoded() = binary() -Asn1 DER encoded entity as an erlang binary.

    + +

    host() = hostname() | ipaddress()

    + +

    hostname() = string()

    + +

    + ip_address() = {N1,N2,N3,N4} % IPv4 + | {K1,K2,K3,K4,K5,K6,K7,K8} % IPv6

    - hash() = -

    md5 | sha

    +

    sslsocket() - opaque to the user.

    + +

    protocol() = sslv3 | tlsv1 | 'tlsv1.1' | 'tlsv1.2'

    + +

    ciphers() = [ciphersuite()] | string() (according to old API)

    + +

    ciphersuite() = + {key_exchange(), cipher(), hash()}

    + +

    key_exchange() = rsa | dhe_dss | dhe_rsa | dh_anon + | psk | dhe_psk | rsa_psk | srp_anon | srp_dss | srp_rsa + | ecdh_anon | ecdh_ecdsa | ecdhe_ecdsa | ecdh_rsa | ecdhe_rsa +

    + +

    cipher() = rc4_128 | des_cbc | '3des_ede_cbc' + | aes_128_cbc | aes_256_cbc

    - prf_random() = -

    client_random | server_random

    +

    hash() = md5 | sha +

    - srp_param_type() = -

    srp_1024 | srp_1536 | srp_2048 | srp_3072 - | srp_4096 | srp_6144 | srp_8192

    +

    prf_random() = client_random | server_random +

    - SNIfun::fun() -

    = fun(ServerName :: string()) -> ssloptions()

    +

    srp_param_type() = srp_1024 | srp_1536 | srp_2048 | srp_3072 + | srp_4096 | srp_6144 | srp_8192

    -
    SSL OPTION DESCRIPTIONS - COMMON for SERVER and CLIENT -

    The following options have the same meaning in the client and - the server:

    +

    Options described here are options that are have the same + meaning in the client and the server. +

    - {cert, public_key:der_encoded()} -

    The DER-encoded users certificate. If this option - is supplied, it overrides option certfile.

    + {cert, der_encoded()} + The DER encoded users certificate. If this option + is supplied it will override the certfile option. - {certfile, path()} -

    Path to a file containing the user certificate.

    + {certfile, path()} + Path to a file containing the user's certificate. - {key, {'RSAPrivateKey'| 'DSAPrivateKey' | 'ECPrivateKey' - |'PrivateKeyInfo', public_key:der_encoded()}} -

    The DER-encoded user's private key. If this option - is supplied, it overrides option keyfile.

    + {key, {'RSAPrivateKey'| 'DSAPrivateKey' | 'ECPrivateKey' |'PrivateKeyInfo', der_encoded()}} + The DER encoded users private key. If this option + is supplied it will override the keyfile option. - {keyfile, path()} -

    Path to the file containing the user's - private PEM-encoded key. As PEM-files can contain several - entries, this option defaults to the same file as given by - option certfile.

    - - {password, string()} -

    String containing the user's password. Only used if the - private keyfile is password-protected.

    + {keyfile, path()} + Path to file containing user's + private PEM encoded key. As PEM-files may contain several + entries this option defaults to the same file as given by + certfile option. + + {password, string()} + String containing the user's password. + Only used if the private keyfile is password protected. + + + {cacerts, [der_encoded()]} + The DER encoded trusted certificates. If this option + is supplied it will override the cacertfile option. - {ciphers, ciphers()} -

    Supported cipher suites. The function + {ciphers, ciphers()} + The cipher suites that should be supported. The function cipher_suites/0 can be used to find all ciphers that are - supported by default. cipher_suites(all) can be called - to find all available cipher suites. Pre-Shared Key - (RFC 4279 and + supported by default. cipher_suites(all) may be called + to find all available cipher suites. + Pre-Shared Key (RFC 4279 and RFC 5487), - Secure Remote Password - (RFC 5054), RC4 cipher suites, + Secure Remote Password (RFC 5054) and anonymous cipher suites only work if explicitly enabled by - this option; they are supported/enabled by the peer also. - Anonymous cipher suites are supported for testing purposes - only and are not be used when security matters.

    - - {secure_renegotiate, boolean()} -

    Specifies if to reject renegotiation attempt that does - not live up to - RFC 5746. - By default secure_renegotiate is set to false, - that is, secure renegotiation is used if possible, - but it fallback to unsecure renegotiation if the peer - does not support - RFC 5746.

    -
    - - {depth, integer()} -

    Maximum number of non-self-issued - intermediate certificates that can follow the peer certificate - in a valid certification path. So, if depth is 0 the PEER must - be signed by the trusted ROOT-CA directly; if 1 the path can - be PEER, CA, ROOT-CA; if 2 the path can be PEER, CA, CA, - ROOT-CA, and so on. The default value is 1.

    - - {verify_fun, {Verifyfun :: fun(), InitialUserState :: - term()}} -

    The verification fun is to be defined as follows:

    + this option and they are supported/enabled by the peer also. + Note that anonymous cipher suites are supported for testing purposes + only and should not be used when security matters. +
    + + {ssl_imp, new | old} + No longer has any meaning as the old implementation has + been removed, it will be ignored. + + + {secure_renegotiate, boolean()} + Specifies if to reject renegotiation attempt that does + not live up to RFC 5746. By default secure_renegotiate is + set to false i.e. secure renegotiation will be used if possible + but it will fallback to unsecure renegotiation if the peer + does not support RFC 5746. + + + {depth, integer()} + + The depth is the maximum number of non-self-issued + intermediate certificates that may follow the peer certificate + in a valid certification path. So if depth is 0 the PEER must + be signed by the trusted ROOT-CA directly, if 1 the path can + be PEER, CA, ROOT-CA, if it is 2 PEER, CA, CA, ROOT-CA and so + on. The default value is 1. + + + {verify_fun, {Verifyfun :: fun(), InitialUserState :: term()}} + +

    The verification fun should be defined as:

    -fun(OtpCert :: #'OTPCertificate'{}, Event :: {bad_cert, Reason :: atom() | {revoked, -atom()}} | +fun(OtpCert :: #'OTPCertificate'{}, Event :: {bad_cert, Reason :: atom() | {revoked, atom()}} | {extension, #'Extension'{}}, InitialUserState :: term()) -> {valid, UserState :: term()} | {valid_peer, UserState :: term()} | {fail, Reason :: term()} | {unknown, UserState :: term()}. -

    The verification fun is called during the X509-path - validation when an error or an extension unknown to the SSL - application is encountered. It is also called +

    The verify fun will be called during the X509-path + validation when an error or an extension unknown to the ssl + application is encountered. Additionally it will be called when a certificate is considered valid by the path validation to allow access to each certificate in the path to the user - application. It differentiates between the peer - certificate and the CA certificates by using valid_peer or - valid as second argument to the verification fun. See the - public_key User's - Guide for definition of #'OTPCertificate'{} and - #'Extension'{}.

    - - -

    If the verify callback fun returns {fail, Reason}, - the verification process is immediately stopped, an alert is - sent to the peer, and the TLS/SSL handshake terminates.

    -

    If the verify callback fun returns {valid, UserState}, - the verification process continues.

    -

    If the verify callback fun always returns - {valid, UserState}, the TLS/SSL handshake does not - terminate regarding verification failures and the connection is - established.

    -

    If called with an extension unknown to the user application, - return value {unknown, UserState} is to be used.

    -
    + application. Note that it will differentiate between the + peer certificate and CA certificates by using valid_peer or + valid as the second argument to the verify fun. See the public_key User's + Guide for definition of #'OTPCertificate'{} and + #'Extension'{}.

    + +

    If the verify callback fun returns {fail, Reason}, the + verification process is immediately stopped and an alert is + sent to the peer and the TLS/SSL handshake is terminated. If + the verify callback fun returns {valid, UserState}, the + verification process is continued. If the verify callback fun + always returns {valid, UserState}, the TLS/SSL handshake will + not be terminated with respect to verification failures and + the connection will be established. If called with an + extension unknown to the user application, the return value + {unknown, UserState} should be used.

    -

    Default option verify_fun in verify_peer mode:

    +

    The default verify_fun option in verify_peer mode:

    {fun(_,{bad_cert, _} = Reason, _) -> @@ -286,7 +269,7 @@ end, []} -

    Default option verify_fun in mode verify_none:

    +

    The default verify_fun option in verify_none mode:

    {fun(_,{bad_cert, _}, UserState) -> @@ -300,88 +283,49 @@ end, []} -

    The possible path validation errors are given on form - {bad_cert, Reason} where Reason is:

    +

    Possible path validation errors are given on the form {bad_cert, Reason} where Reason is:

    - unknown_ca -

    No trusted CA was found in the trusted store. The trusted CA is - normally a so called ROOT CA, which is a self-signed certificate. Trust can - be claimed for an intermediat CA (trusted anchor does not have to be - self-signed according to X-509) by using option partial_chain.

    -
    - - selfsigned_peer -

    The chain consisted only of one self-signed certificate.

    - - PKIX X-509-path validation error -

    For possible reasons, see public_key:pkix_path_validation/3 -

    + unknown_ca + No trusted CA was found in the trusted store. The trusted CA is + normally a so called ROOT CA that is a self-signed cert. Trust may + be claimed for an intermediat CA (trusted anchor does not have to be self signed + according to X-509) by using the option partial_chain + + selfsigned_peer + The chain consisted only of one self-signed certificate. + + PKIX X-509-path validation error + Possible such reasons see public_key:pkix_path_validation/3
    +
    - {crl_check, boolean() | peer | best_effort } + {partial_chain, fun(Chain::[DerCert]) -> {trusted_ca, DerCert} | unknown_ca - Perform CRL (Certificate Revocation List) verification - - (public_key:pkix_crls_validate/3) on all the certificates during the path validation - (public_key:pkix_path_validation/3) - - of the certificate chain. Defaults to false. - -

    peer - check is only performed on - the peer certificate.

    + Claim an intermediat CA in the chain as trusted. TLS will then perform the public_key:pkix_path_validation/3 + with the selected CA as trusted anchor and the rest of the chain. +
    -

    best_effort - if certificate revocation status can not be determined - it will be accepted as valid.

    + {versions, [protocol()]} + TLS protocol versions that will be supported by started clients and servers. + This option overrides the application environment option protocol_version. If the + environment option is not set it defaults to all versions supported by the SSL application. See also + ssl(6) + -

    The CA certificates specified for the connection will be used to - construct the certificate chain validating the CRLs.

    - -

    The CRLs will be fetched from a local or external cache see - ssl_crl_cache_api(3).

    + {hibernate_after, integer()|undefined} + When an integer-value is specified, the ssl_connection + will go into hibernation after the specified number of milliseconds + of inactivity, thus reducing its memory footprint. When + undefined is specified (this is the default), the process + will never go into hibernation. - {crl_cache, {Module :: atom(), {DbHandle :: internal | term(), Args :: list()}}} + {user_lookup_fun, {Lookupfun :: fun(), UserState :: term()}} -

    Module defaults to ssl_crl_cache with DbHandle internal and an - empty argument list. The following arguments may be specified for the internal cache.

    - - {http, timeout()} -

    - Enables fetching of CRLs specified as http URIs in X509 cerificate extensions. - Requires the OTP inets application.

    -
    -
    -
    - - {partial_chain, fun(Chain::[DerCert]) -> {trusted_ca, DerCert} | - unknown_ca } -

    Claim an intermediate CA in the chain as trusted. TLS then - performs public_key:pkix_path_validation/3 - with the selected CA as trusted anchor and the rest of the chain.

    - - {versions, [protocol()]} -

    TLS protocol versions supported by started clients and servers. - This option overrides the application environment option - protocol_version. If the environment option is not set, it defaults - to all versions, except SSL-3.0, supported by the SSL application. - See also ssl(6).

    - - {hibernate_after, integer()|undefined} -

    When an integer-value is specified, ssl_connection - goes into hibernation after the specified number of milliseconds - of inactivity, thus reducing its memory footprint. When - undefined is specified (this is the default), the process - never goes into hibernation.

    - - {user_lookup_fun, {Lookupfun :: fun(), UserState :: term()}} -

    The lookup fun is to defined as follows:

    - +

    The lookup fun should be defined as:

    fun(psk, PSKIdentity ::string(), UserState :: term()) -> {ok, SharedSecret :: binary()} | error; @@ -389,130 +333,85 @@ {ok, {SRPParams :: srp_param_type(), Salt :: binary(), DerivedKey :: binary()}} | error. -

    For Pre-Shared Key (PSK) cipher suites, the lookup fun is - called by the client and server to determine the shared - secret. When called by the client, PSKIdentity is set to the - hint presented by the server or to undefined. When called by the - server, PSKIdentity is the identity presented by the client.

    - -

    For Secure Remote Password (SRP), the fun is only used by the server to - obtain parameters that it uses to generate its session keys. - DerivedKey is to be derived according to - RFC 2945 and - RFC 5054: - crypto:sha([Salt, crypto:sha([Username, <<$:>>, Password])]) +

    For Pre-Shared Key (PSK) cipher suites, the lookup fun will + be called by the client and server to determine the shared + secret. When called by the client, PSKIdentity will be set to the + hint presented by the server or undefined. When called by the + server, PSKIdentity is the identity presented by the client.

    -
    - {padding_check, boolean()} -

    Affects TLS-1.0 connections only. - If set to false, it disables the block cipher padding check - to be able to interoperate with legacy software.

    +

    For Secure Remote Password (SRP), the fun will only be used by the server to obtain + parameters that it will use to generate its session keys. DerivedKey should be + derived according to RFC 2945 and + RFC 5054: + crypto:sha([Salt, crypto:sha([Username, <<$:>>, Password])]) +

    +
    -

    Using {padding_check, boolean()} makes TLS - vulnerable to the Poodle attack.

    -
    - -
    + +
    SSL OPTION DESCRIPTIONS - CLIENT SIDE -

    The following options are client-specific or have a slightly different - meaning in the client than in the server:

    +

    Options described here are client specific or has a slightly different + meaning in the client than in the server.

    - - {verify, verify_type()} -

    In mode verify_none the default behavior is to allow - all x509-path validation errors. See also option verify_fun.

    + {verify, verify_type()} + In verify_none mode the default behavior will be to + allow all x509-path validation errors. See also the verify_fun + option. + + {reuse_sessions, boolean()} + Specifies if client should try to reuse sessions + when possible. - - {reuse_sessions, boolean()} -

    Specifies if the client is to try to reuse sessions - when possible.

    - - {cacerts, [public_key:der_encoded()]} -

    The DER-encoded trusted certificates. If this option - is supplied it overrides option cacertfile.

    - {cacertfile, path()} -

    Path to a file containing PEM-encoded CA certificates. The CA + {cacertfile, path()} + The path to a file containing PEM encoded CA certificates. The CA certificates are used during server authentication and when building the - client certificate chain.

    -
    - - {alpn_advertised_protocols, [binary()]} - -

    The list of protocols supported by the client to be sent to the - server to be used for an Application-Layer Protocol Negotiation (ALPN). - If the server supports ALPN then it will choose a protocol from this - list; otherwise it will fail the connection with a "no_application_protocol" - alert. A server that does not support ALPN will ignore this value.

    - -

    The list of protocols must not contain an empty binary.

    - -

    The negotiated protocol can be retrieved using the negotiated_protocol/1 function.

    -
    - - {client_preferred_next_protocols, {Precedence :: server | client, ClientPrefs :: [binary()]}}
    - {client_preferred_next_protocols, {Precedence :: server | client, ClientPrefs :: [binary()], Default :: binary()}}
    + client certificate chain. +
    + + {client_preferred_next_protocols, {Precedence :: server | client, ClientPrefs :: [binary()]}} + {client_preferred_next_protocols, {Precedence :: server | client, ClientPrefs :: [binary()], Default :: binary()}} -

    Indicates that the client is to try to perform Next Protocol +

    Indicates the client will try to perform Next Protocol Negotiation.

    -

    If precedence is server, the negotiated protocol is the - first protocol to be shown on the server advertised list, which is +

    If precedence is server the negotiated protocol will be the + first protocol that appears on the server advertised list that is also on the client preference list.

    -

    If precedence is client, the negotiated protocol is the - first protocol to be shown on the client preference list, which is +

    If precedence is client the negotiated protocol will be the + first protocol that appears on the client preference list that is also on the server advertised list.

    If the client does not support any of the server advertised - protocols or the server does not advertise any protocols, the - client falls back to the first protocol in its list or to the - default protocol (if a default is supplied). If the - server does not support Next Protocol Negotiation, the - connection terminates if no default protocol is supplied.

    + protocols or the server does not advertise any protocols the + client will fallback to the first protocol in its list or if a + default is supplied it will fallback to that instead. If the + server does not support Next Protocol Negotiation the + connection will be aborted if no default protocol is supplied.

    - {psk_identity, string()} -

    Specifies the identity the client presents to the server. - The matching secret is found by calling user_lookup_fun.

    + {psk_identity, string()} + Specifies the identity the client presents to the server. The matching secret is + found by calling the user_look_fun. - - {srp_identity, {Username :: string(), Password :: string()} - -

    Specifies the username and password to use to authenticate - to the server.

    - - {server_name_indication, hostname()} -

    Can be specified when upgrading a TCP socket to a TLS - socket to use the TLS Server Name Indication extension.

    - - {server_name_indication, disable} - -

    When starting a TLS connection without upgrade, the Server Name - Indication extension is sent if possible. This option can be - used to disable that behavior.

    + {srp_identity, {Username :: string(), Password :: string()} + Specifies the Username and Password to use to authenticate to the server. - {fallback, boolean()} + {server_name_indication, hostname()} + {server_name_indication, disable} -

    Send special cipher suite TLS_FALLBACK_SCSV to avoid undesired TLS version downgrade. - Defaults to false

    -

    Note this option is not needed in normal TLS usage and should not be used - to implement new clients. But legacy clients that retries connections in the following manner

    - -

    ssl:connect(Host, Port, [...{versions, ['tlsv2', 'tlsv1.1', 'tlsv1', 'sslv3']}])

    -

    ssl:connect(Host, Port, [...{versions, [tlsv1.1', 'tlsv1', 'sslv3']}, {fallback, true}])

    -

    ssl:connect(Host, Port, [...{versions, ['tlsv1', 'sslv3']}, {fallback, true}])

    -

    ssl:connect(Host, Port, [...{versions, ['sslv3']}, {fallback, true}])

    - -

    may use it to avoid undesired TLS version downgrade. Note that TLS_FALLBACK_SCSV must also - be supported by the server for the prevention to work. -

    +

    This option can be specified when upgrading a TCP socket to a TLS + socket to use the TLS Server Name Indication extension.

    +

    When starting a TLS connection without upgrade the Server Name + Indication extension will be sent if possible, this option may also be + used to disable that behavior.

    @@ -520,126 +419,78 @@
    SSL OPTION DESCRIPTIONS - SERVER SIDE -

    The following options are server-specific or have a slightly different - meaning in the server than in the client:

    +

    Options described here are server specific or has a slightly different + meaning in the server than in the client.

    - - {cacerts, [public_key:der_encoded()]} -

    The DER-encoded trusted certificates. If this option - is supplied it overrides option cacertfile.

    - {cacertfile, path()} -

    Path to a file containing PEM-encoded CA + {cacertfile, path()} + The path to a file containing PEM encoded CA certificates. The CA certificates are used to build the server - certificate chain and for client authentication. The CAs are - also used in the list of acceptable client CAs passed to the - client when a certificate is requested. Can be omitted if there - is no need to verify the client and if there are no - intermediate CAs for the server certificate.

    - - {dh, public_key:der_encoded()} -

    The DER-encoded Diffie-Hellman parameters. If specified, - it overrides option dhfile.

    - - {dhfile, path()} -

    Path to a file containing PEM-encoded Diffie Hellman parameters - to be used by the server if a cipher suite using Diffie Hellman key - exchange is negotiated. If not specified, default parameters are used. -

    - - {verify, verify_type()} -

    A server only does x509-path validation in mode verify_peer, - as it then sends a certificate request to the client - (this message is not sent if the verify option is verify_none). - You can then also want to specify option fail_if_no_peer_cert. -

    - - {fail_if_no_peer_cert, boolean()} -

    Used together with {verify, verify_peer} by an SSL server. - If set to true, the server fails if the client does not have - a certificate to send, that is, sends an empty certificate. If set to - false, it fails only if the client sends an invalid - certificate (an empty certificate is considered valid). Defaults to false.

    -
    - - {reuse_sessions, boolean()} -

    Specifies if the server is to agree to reuse sessions - when requested by the clients. See also option reuse_session. -

    - - {reuse_session, fun(SuggestedSessionId, - PeerCert, Compression, CipherSuite) -> boolean()} -

    Enables the SSL server to have a local policy - for deciding if a session is to be reused or not. - Meaningful only if reuse_sessions is set to true. - SuggestedSessionId is a binary(), PeerCert is - a DER-encoded certificate, Compression is an enumeration integer, - and CipherSuite is of type ciphersuite().

    - - {alpn_preferred_protocols, [binary()]} - -

    Indicates the server will try to perform Application-Layer - Protocol Negotiation (ALPN).

    - -

    The list of protocols is in order of preference. The protocol - negotiated will be the first in the list that matches one of the - protocols advertised by the client. If no protocol matches, the - server will fail the connection with a "no_application_protocol" alert.

    - -

    The negotiated protocol can be retrieved using the negotiated_protocol/1 function.

    + certificate chain, and for client authentication. Also the CAs + are used in the list of acceptable client CAs passed to the + client when a certificate is requested. May be omitted if there + is no need to verify the client and if there are not any + intermediate CAs for the server certificate.
    + + {dh, der_encoded()} + The DER encoded Diffie Hellman parameters. If this option + is supplied it will override the dhfile option. + + + {dhfile, path()} + Path to file containing PEM encoded Diffie Hellman parameters, + for the server to use if a cipher suite using Diffie Hellman key exchange + is negotiated. If not specified default parameters will be used. + + + {verify, verify_type()} + Servers only do the x509-path validation in verify_peer + mode, as it then will send a certificate request to the client + (this message is not sent if the verify option is verify_none) + and you may then also want to specify the option + fail_if_no_peer_cert. + + + {fail_if_no_peer_cert, boolean()} + Used together with {verify, verify_peer} by an ssl server. + If set to true, the server will fail if the client does not have + a certificate to send, i.e. sends a empty certificate, if set to + false it will only fail if the client sends an invalid + certificate (an empty certificate is considered valid). + + + {reuse_sessions, boolean()} + Specifies if the server should agree to reuse sessions + when the clients request to do so. See also the reuse_session + option. + + + {reuse_session, fun(SuggestedSessionId, + PeerCert, Compression, CipherSuite) -> boolean()} + Enables the ssl server to have a local policy + for deciding if a session should be reused or not, + only meaningful if reuse_sessions is set to true. + SuggestedSessionId is a binary(), PeerCert is a DER encoded + certificate, Compression is an enumeration integer + and CipherSuite is of type ciphersuite(). + - {next_protocols_advertised, Protocols :: [binary()]} -

    List of protocols to send to the client if the client indicates that - it supports the Next Protocol extension. The client can select a protocol + {next_protocols_advertised, Protocols :: [binary()]} + The list of protocols to send to the client if the client indicates + it supports the Next Protocol extension. The client may select a protocol that is not on this list. The list of protocols must not contain an empty - binary. If the server negotiates a Next Protocol, it can be accessed - using the negotiated_next_protocol/1 method.

    - - {psk_identity, string()} -

    Specifies the server identity hint, which the server presents to - the client.

    - - {log_alert, boolean()} -

    If set to false, error reports are not displayed.

    - - {honor_cipher_order, boolean()} -

    If set to true, use the server preference for cipher - selection. If set to false (the default), use the client - preference.

    - - {sni_hosts, [{hostname(), ssloptions()}]} -

    If the server receives a SNI (Server Name Indication) from the client - matching a host listed in the sni_hosts option, the speicific options for - that host will override previously specified options. - - The option sni_fun, and sni_hosts are mutually exclusive.

    - - {sni_fun, SNIfun::fun()} -

    If the server receives a SNI (Server Name Indication) from the client, - the given function will be called to retrive ssloptions() for indicated server. - These options will be merged into predefined ssloptions(). - - The function should be defined as: - fun(ServerName :: string()) -> ssloptions() - and can be specified as a fun or as named fun module:function/1 - - The option sni_fun, and sni_hosts are mutually exclusive.

    - - {client_renegotiation, boolean()} - In protocols that support client-initiated renegotiation, the cost - of resources of such an operation is higher for the server than the - client. This can act as a vector for denial of service attacks. The SSL - application already takes measures to counter-act such attempts, - but client-initiated renegotiation can be stricly disabled by setting - this option to false. The default value is true. - Note that disabling renegotiation can result in long-lived connections - becoming unusable due to limits on the number of messages the underlying - cipher suite can encipher. + binary. If the server negotiates a Next Protocol it can be accessed + using negotiated_next_protocol/1 method. - {honor_cipher_order, boolean()} + {psk_identity, string()} + Specifies the server identity hint the server presents to the client. + + {log_alert, boolean()} + If false, error reports will not be displayed. + {honor_cipher_order, boolean()} If true, use the server's preference for cipher selection. If false (the default), use the client's preference. @@ -649,66 +500,60 @@
    General -

    When an SSL socket is in active mode (the default), data from the +

    When an ssl socket is in active mode (the default), data from the socket is delivered to the owner of the socket in the form of - messages:

    - + messages: +

    -

    {ssl, Socket, Data}

    -

    {ssl_closed, Socket}

    -

    {ssl_error, Socket, Reason}

    + {ssl, Socket, Data} + + {ssl_closed, Socket} + + + {ssl_error, Socket, Reason} +
    - -

    A Timeout argument specifies a time-out in milliseconds. The - default value for argument Timeout is infinity.

    + +

    A Timeout argument specifies a timeout in milliseconds. The + default value for a Timeout argument is infinity. +

    cipher_suites() -> cipher_suites(Type) -> ciphers() - Returns a list of supported cipher suites. + Returns a list of supported cipher suites Type = erlang | openssl | all +

    Returns a list of supported cipher suites. - cipher_suites() is equivalent to cipher_suites(erlang). - Type openssl is provided for backwards compatibility with the - old SSL, which used OpenSSL. cipher_suites(all) returns + cipher_suites() is equivalent to cipher_suites(erlang). + Type openssl is provided for backwards compatibility with + old ssl that used openssl. cipher_suites(all) returns all available cipher suites. The cipher suites not present - in cipher_suites(erlang) but included in - cipher_suites(all) are not used unless explicitly configured - by the user.

    + in cipher_suites(erlang) but in included in cipher_suites(all) + will not be used unless explicitly configured by the user. +

    - - - clear_pem_cache() -> ok - Clears the pem cache - -

    PEM files, used by ssl API-functions, are cached. The - cache is regularly checked to see if any cache entries should be - invalidated, however this function provides a way to - unconditionally clear the whole cache. -

    -
    -
    - + connect(Socket, SslOptions) -> connect(Socket, SslOptions, Timeout) -> {ok, SslSocket} | {error, Reason} - Upgrades a gen_tcp, or - equivalent, connected socket to an SSL socket. + Upgrades a gen_tcp, or + equivalent, connected socket to an ssl socket. - Socket = socket() - SslOptions = [ssloption()] + Socket = socket() + SslOptions = [ssloption()] Timeout = integer() | infinity SslSocket = sslsocket() Reason = term() -

    Upgrades a gen_tcp, or equivalent, - connected socket to an SSL socket, that is, performs the +

    Upgrades a gen_tcp, or equivalent, + connected socket to an ssl socket i.e. performs the client-side ssl handshake.

    @@ -717,7 +562,7 @@ connect(Host, Port, Options) -> connect(Host, Port, Options, Timeout) -> {ok, SslSocket} | {error, Reason} - Opens an SSL connection to Host, Port. + Opens an ssl connection to Host, Port. Host = host() Port = integer() @@ -726,124 +571,72 @@ SslSocket = sslsocket() Reason = term() -

    Opens an SSL connection to Host, Port.

    +

    Opens an ssl connection to Host, Port.

    close(SslSocket) -> ok | {error, Reason} - Closes an SSL connection. - - SslSocket = sslsocket() - Reason = term() - -

    Closes an SSL connection.

    -
    -
    - - - close(SslSocket, How) -> ok | {ok, port()} | {error, Reason} - Closes an SSL connection. + Close an ssl connection SslSocket = sslsocket() - How = timeout() | {NewController::pid(), timeout()} Reason = term() -

    Closes or downgrades an SSL connection, in the later case the transport - connection will be handed over to the NewController process after reciving - the TLS close alert from the peer. The retuned transport socket will have - the following options set [{active, false}, {packet, 0}, {mode, binary}].

    -
    -
    - - - connection_info(SslSocket) -> - {ok, {ProtocolVersion, CipherSuite}} | {error, Reason} - Returns the Negotiated Protocol version and cipher suite. - - - CipherSuite = ciphersuite() - ProtocolVersion = protocol() - -

    Returns the Negotiated Protocol version and cipher suite.

    +

    Close an ssl connection.

    controlling_process(SslSocket, NewOwner) -> ok | {error, Reason} + Assigns a new controlling process to the - SSL socket. + ssl-socket. + SslSocket = sslsocket() NewOwner = pid() Reason = term() -

    Assigns a new controlling process to the SSL socket. A - controlling process is the owner of an SSL socket, and receives - all messages from the socket.

    +

    Assigns a new controlling process to the ssl-socket. A + controlling process is the owner of an ssl-socket, and receives + all messages from the socket.

    - connection_information(SslSocket) -> - {ok, Info} | {error, Reason} - Returns all the connection information. + connection_info(SslSocket) -> + {ok, {ProtocolVersion, CipherSuite}} | {error, Reason} + Returns the negotiated protocol version and cipher suite. - Info = [InfoTuple] - InfoTuple = {protocol, Protocol} | {cipher_suite, CipherSuite} | {sni_hostname, SNIHostname} CipherSuite = ciphersuite() ProtocolVersion = protocol() - SNIHostname = string() - Reason = term() -

    Return all the connection information containing negotiated protocol version, cipher suite, and the hostname of SNI extension. - Info will be a proplists containing all the connection information on success, otherwise {error, Reason} will be returned.

    +

    Returns the negotiated protocol version and cipher suite.

    - - connection_information(SslSocket, Items) -> - {ok, Info} | {error, Reason} - Returns the requested connection information. - - - Items = [Item] - Item = protocol | cipher_suite | sni_hostname - Info = [InfoTuple] - InfoTuple = {protocol, Protocol} | {cipher_suite, CipherSuite} | {sni_hostname, SNIHostname} - CipherSuite = ciphersuite() - ProtocolVersion = protocol() - SNIHostname = string() - Reason = term() - -

    Returns the connection information you requested. The connection information you can request contains protocol, cipher_suite, and sni_hostname. - {ok, Info} will be returned if it executes sucessfully. The Info is a proplists containing the information you requested. - Otherwise, {error, Reason} will be returned.

    -
    -
    - - + format_error(Reason) -> string() - Returns an error string. + Return an error string. Reason = term() -

    Presents the error returned by an SSL function as a printable string.

    +

    Presents the error returned by an ssl function as a printable string.

    getopts(Socket, OptionNames) -> {ok, [socketoption()]} | {error, Reason} - Gets the values of the specified options. + Get the value of the specified options. Socket = sslsocket() OptionNames = [atom()] -

    Gets the values of the specified socket options. +

    Get the value of the specified socket options.

    @@ -851,49 +644,34 @@ listen(Port, Options) -> {ok, ListenSocket} | {error, Reason} - Creates an SSL listen socket. + Creates an ssl listen socket. Port = integer() Options = options() ListenSocket = sslsocket() -

    Creates an SSL listen socket.

    +

    Creates an ssl listen socket.

    - negotiated_protocol(Socket) -> {ok, Protocol} | {error, protocol_not_negotiated} - Returns the protocol negotiated through ALPN or NPN extensions. - - Socket = sslsocket() - Protocol = binary() - - -

    - Returns the protocol negotiated through ALPN or NPN extensions. -

    -
    -
    - - peercert(Socket) -> {ok, Cert} | {error, Reason} - Returns the peer certificate. + Return the peer certificate. Socket = sslsocket() Cert = binary() -

    The peer certificate is returned as a DER-encoded binary. - The certificate can be decoded with - public_key:pkix_decode_cert/2.

    +

    The peer certificate is returned as a DER encoded binary. + The certificate can be decoded with public_key:pkix_decode_cert/2. +

    - peername(Socket) -> {ok, {Address, Port}} | {error, Reason} - Returns the peer address and port. + Return peer address and port. Socket = sslsocket() Address = ipaddress() @@ -903,32 +681,12 @@

    Returns the address and port number of the peer.

    - - - prf(Socket, Secret, Label, Seed, WantedLength) -> {ok, binary()} | {error, reason()} - Uses a session Pseudo-Random Function to generate key material. - - Socket = sslsocket() - Secret = binary() | master_secret - Label = binary() - Seed = [binary() | prf_random()] - WantedLength = non_neg_integer() - - -

    Uses the Pseudo-Random Function (PRF) of a TLS session to generate - extra key material. It either takes user-generated values for - Secret and Seed or atoms directing it to use a specific - value from the session security parameters.

    -

    Can only be used with TLS connections; {error, undefined} - is returned for SSLv3 connections.

    -
    -
    recv(Socket, Length) -> recv(Socket, Length, Timeout) -> {ok, Data} | {error, Reason} - Receives data on a socket. + Receive data on a socket. Socket = sslsocket() Length = integer() @@ -936,43 +694,63 @@ Data = [char()] | binary() -

    Receives a packet from a socket in passive - mode. A closed socket is indicated by return value +

    This function receives a packet from a socket in passive + mode. A closed socket is indicated by a return value {error, closed}.

    -

    Argument Length is meaningful only when - the socket is in mode raw and denotes the number of +

    The Length argument is only meaningful when + the socket is in raw mode and denotes the number of bytes to read. If Length = 0, all available bytes are returned. If Length > 0, exactly Length bytes are returned, or an error; possibly discarding less than Length bytes of data when the socket gets closed from the other side.

    -

    Optional argument Timeout specifies a time-out in +

    The optional Timeout parameter specifies a timeout in milliseconds. The default value is infinity.

    + prf(Socket, Secret, Label, Seed, WantedLength) -> {ok, binary()} | {error, reason()} + Use a sessions pseudo random function to generate key material. + + Socket = sslsocket() + Secret = binary() | master_secret + Label = binary() + Seed = [binary() | prf_random()] + WantedLength = non_neg_integer() + + +

    Use the pseudo random function (PRF) of a TLS session to generate + additional key material. It either takes user generated values for + Secret and Seed or atoms directing it use a specific + value from the session security parameters.

    +

    This function can only be used with TLS connections, {error, undefined} + is returned for SSLv3 connections.

    +
    +
    + + renegotiate(Socket) -> ok | {error, Reason} - Initiates a new handshake. + Initiates a new handshake. Socket = sslsocket()

    Initiates a new handshake. A notable return value is {error, renegotiation_rejected} indicating that the peer - refused to go through with the renegotiation, but the connection + refused to go through with the renegotiation but the connection is still active using the previously negotiated session.

    send(Socket, Data) -> ok | {error, Reason} - Writes data to a socket. + Write data to a socket. Socket = sslsocket() Data = iodata() -

    Writes Data to Socket.

    +

    Writes Data to Socket.

    A notable return value is {error, closed} indicating that the socket is closed.

    @@ -980,31 +758,31 @@ setopts(Socket, Options) -> ok | {error, Reason} - Sets socket options. + Set socket options. Socket = sslsocket() Options = [socketoption]() -

    Sets options according to Options for socket - Socket.

    +

    Sets options according to Options for the socket + Socket.

    shutdown(Socket, How) -> ok | {error, Reason} - Immediately closes a socket. + Immediately close a socket Socket = sslsocket() How = read | write | read_write Reason = reason() -

    Immediately closes a socket in one or two directions.

    +

    Immediately close a socket in one or two directions.

    How == write means closing the socket for writing, reading from it is still possible.

    To be able to handle that the peer has done a shutdown on - the write side, option {exit_on_close, false} + the write side, the {exit_on_close, false} option is useful.

    @@ -1012,16 +790,16 @@ ssl_accept(Socket) -> ssl_accept(Socket, Timeout) -> ok | {error, Reason} - Performs server-side SSL/TLS handshake. + Perform server-side SSL/TLS handshake Socket = sslsocket() Timeout = integer() Reason = term() -

    Performs the SSL/TLS server-side handshake.

    -

    Socket is a socket as returned by - ssl:transport_accept/[1,2] +

    Performs the SSL/TLS server-side handshake Socket is a socket as returned + by ssl:transport_accept/[1,2]

    @@ -1029,7 +807,7 @@ ssl_accept(Socket, SslOptions) -> ssl_accept(Socket, SslOptions, Timeout) -> {ok, Socket} | ok | {error, Reason} - Performs server-side SSL/TLS handshake. + Perform server-side SSL/TLS handshake Socket = socket() | sslsocket() SslOptions = ssloptions() @@ -1037,19 +815,17 @@ Reason = term() -

    If Socket is a socket(): upgrades a gen_tcp, - or equivalent, socket to an SSL socket, that is, performs - the SSL/TLS server-side handshake and returns the SSL socket.

    +

    If Socket is a socket() - upgrades a gen_tcp, or equivalent, socket to an ssl socket + i.e. performs the SSL/TLS server-side handshake and returns the ssl socket. +

    -

    The listen socket is to be in mode {active, false} +

    Note that the listen socket should be in {active, false} mode before telling the client that the server is ready to upgrade - by calling this function, else the upgrade succeeds or does not - succeed depending on timing.

    + by calling this function, otherwise the upgrade may + or may not succeed depending on timing.

    -

    If Socket is an sslsocket(): provides extra SSL/TLS - options to those specified in - ssl:listen/2 and then performs - the SSL/TLS handshake. +

    If Socket is an sslsocket() - provides additional SSL/TLS options to those specified in ssl:listen/2 and then performs the SSL/TLS handshake.

    @@ -1057,14 +833,14 @@ sockname(Socket) -> {ok, {Address, Port}} | {error, Reason} - Returns the local address and port. + Return the local address and port. Socket = sslsocket() Address = ipaddress() Port = integer() -

    Returns the local address and port number of socket +

    Returns the local address and port number of the socket Socket.

    @@ -1072,21 +848,22 @@ start() -> start(Type) -> ok | {error, Reason} - Starts the SSL application. + Starts the Ssl application. - Type = permanent | transient | temporary + Type = permanent | transient | temporary -

    Starts the SSL application. Default type - is temporary.

    +

    Starts the Ssl application. Default type + is temporary. + application(3)

    - stop() -> ok - Stops the SSL application. + Stops the Ssl application. -

    Stops the SSL application.

    +

    Stops the Ssl application. + application(3)

    @@ -1094,8 +871,8 @@ transport_accept(ListenSocket) -> transport_accept(ListenSocket, Timeout) -> {ok, NewSocket} | {error, Reason} - Accepts an incoming connection and - prepares for ssl_accept. + Accept an incoming connection and + prepare for ssl_accept ListenSocket = NewSocket = sslsocket() Timeout = integer() @@ -1104,66 +881,66 @@

    Accepts an incoming connection request on a listen socket. ListenSocket must be a socket returned from - ssl:listen/2. - The socket returned is to be passed to + ssl:listen/2. + The socket returned should be passed to ssl:ssl_accept[2,3] - to complete handshaking, that is, + to complete handshaking i.e establishing the SSL/TLS connection.

    The socket returned can only be used with - ssl:ssl_accept[2,3]. - No traffic can be sent or received before that call.

    + ssl:ssl_accept[2,3] + no traffic can be sent or received before that call.

    The accepted socket inherits the options set for - ListenSocket in - ssl:listen/2.

    + ListenSocket in ssl:listen/2.

    The default value for Timeout is infinity. If - Timeout is specified and no connection is accepted + Timeout is specified, and no connection is accepted within the given time, {error, timeout} is returned.

    - versions() -> [versions_info()] + versions() -> + [{SslAppVer, SupportedSslVer, AvailableSslVsn}] Returns version information relevant for the - SSL application. + ssl application. - versions_info() = {app_vsn, string()} | {supported | available, [protocol()] + SslAppVer = string() + SupportedSslVer = [protocol()] + AvailableSslVsn = [protocol()] -

    Returns version information relevant for the SSL - application.

    - - app_vsn - The application version of the SSL application. - - supported - TLS/SSL versions supported by default. - Overridden by a version option on - connect/[2,3,4], - listen/2, and ssl_accept/[1,2,3]. - For the negotiated TLS/SSL version, see ssl:connection_info/1 - . - - available - All TLS/SSL versions supported by the SSL application. - TLS 1.2 requires sufficient support from the Crypto - application. - +

    + Returns version information relevant for the + ssl application.

    - + + negotiated_next_protocol(Socket) -> {ok, Protocol} | {error, next_protocol_not_negotiated} + Returns the Next Protocol negotiated. + + Socket = sslsocket() + Protocol = binary() + + +

    + Returns the Next Protocol negotiated. +

    +
    +
    +
    SEE ALSO -

    inet(3) and - gen_tcp(3) +

    inet(3) and + gen_tcp(3)

    + diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/usersguide.xml erlang-17.3-dfsg/lib/ssl/doc/src/usersguide.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/usersguide.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/usersguide.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,33 +8,29 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. SSL User's Guide OTP Team - 2003-05-26 - usersguide.sgml -

    The Secure Socket Layer (SSL) application provides secure communication over +

    The SSL application provides secure communication over sockets.

    - diff -Nru erlang-18.2-dfsg/lib/ssl/doc/src/using_ssl.xml erlang-17.3-dfsg/lib/ssl/doc/src/using_ssl.xml --- erlang-18.2-dfsg/lib/ssl/doc/src/using_ssl.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/doc/src/using_ssl.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,145 +8,139 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. - Using SSL API - - - - - - - + Using the SSL API using_ssl.xml -

    To see relevant version information for ssl, call - ssl:versions/0 - .

    - -

    To see all supported cipher suites, call ssl:cipher_suites(all) . - The available cipher suites for a connection depend on your certificate. - Specific cipher suites that you want your connection to use can also be - specified. Default is to use the strongest available.

    + +
    + General information +

    To see relevant version information for ssl you can + call ssl:versions/0

    + +

    To see all supported cipher suites + call ssl:cipher_suites/0. Note that available cipher suites + for a connection will depend on your certificate. It is also + possible to specify a specific cipher suite(s) that you + want your connection to use. Default is to use the strongest + available.

    + +
    - Setting up Connections + Setting up connections -

    This section shows a small example of how to set up client/server connections - using the Erlang shell. The returned value of the sslsocket is abbreviated - with [...] as it can be fairly large and is opaque.

    +

    Here follows some small example of how to set up client/server connections + using the erlang shell. The returned value of the sslsocket has been abbreviated with + [...] as it can be fairly large and is opaque.

    - Minimal Example + Minmal example -

    The minimal setup is not the most secure setup of SSL.

    +

    The minimal setup is not the most secure setup of ssl.

    - -

    To set up client/server connections:

    - -

    Step 1: Start the server side:

    + +

    Start server side

    1 server> ssl:start(). ok -

    Step 2: Create an SSL listen socket:

    +

    Create an ssl listen socket

    2 server> {ok, ListenSocket} = ssl:listen(9999, [{certfile, "cert.pem"}, {keyfile, "key.pem"},{reuseaddr, true}]). {ok,{sslsocket, [...]}} -

    Step 3: Do a transport accept on the SSL listen socket:

    +

    Do a transport accept on the ssl listen socket

    3 server> {ok, Socket} = ssl:transport_accept(ListenSocket). {ok,{sslsocket, [...]}} -

    Step 4: Start the client side:

    +

    Start client side

    1 client> ssl:start(). ok 2 client> {ok, Socket} = ssl:connect("localhost", 9999, [], infinity). {ok,{sslsocket, [...]}} -

    Step 5: Do the SSL handshake:

    +

    Do the ssl handshake

    4 server> ok = ssl:ssl_accept(Socket). ok -

    Step 6: Send a message over SSL:

    +

    Send a messag over ssl

    5 server> ssl:send(Socket, "foo"). ok -

    Step 7: Flush the shell message queue to see that the message - was sent on the server side:

    +

    Flush the shell message queue to see that we got the message + sent on the server side

    3 client> flush(). Shell got {ssl,{sslsocket,[...]},"foo"} ok
    - Upgrade Example + Upgrade example -

    To upgrade a TCP/IP connection to an SSL connection, the - client and server must agree to do so. The agreement - can be accomplished by using a protocol, for example, the one used by HTTP - specified in RFC 2817.

    - -

    To upgrade to an SSL connection:

    +

    To upgrade a TCP/IP connection to an ssl connection the + client and server have to aggre to do so. Agreement + may be accompliced by using a protocol such the one used by HTTP + specified in RFC 2817.

    -

    Step 1: Start the server side:

    +

    Start server side

    1 server> ssl:start(). ok -

    Step 2: Create a normal TCP listen socket:

    +

    Create a normal tcp listen socket

    2 server> {ok, ListenSocket} = gen_tcp:listen(9999, [{reuseaddr, true}]). {ok, #Port<0.475>} -

    Step 3: Accept client connection:

    +

    Accept client connection

    3 server> {ok, Socket} = gen_tcp:accept(ListenSocket). {ok, #Port<0.476>} -

    Step 4: Start the client side:

    +

    Start client side

    1 client> ssl:start(). ok 2 client> {ok, Socket} = gen_tcp:connect("localhost", 9999, [], infinity). -

    Step 5: Ensure active is set to false before trying - to upgrade a connection to an SSL connection, otherwise - SSL handshake messages can be delivered to the wrong process:

    +

    Make sure active is set to false before trying + to upgrade a connection to an ssl connection, otherwhise + ssl handshake messages may be deliverd to the wrong process.

    4 server> inet:setopts(Socket, [{active, false}]). ok -

    Step 6: Do the SSL handshake:

    +

    Do the ssl handshake.

    5 server> {ok, SSLSocket} = ssl:ssl_accept(Socket, [{cacertfile, "cacerts.pem"}, {certfile, "cert.pem"}, {keyfile, "key.pem"}]). {ok,{sslsocket,[...]}} -

    Step 7: Upgrade to an SSL connection. The client and server - must agree upon the upgrade. The server must call - ssl:accept/2 before the client calls ssl:connect/3.

    +

    Upgrade to an ssl connection. Note that the client and server + must agree upon the upgrade and the server must call + ssl:accept/2 before the client calls ssl:connect/3.

    3 client>{ok, SSLSocket} = ssl:connect(Socket, [{cacertfile, "cacerts.pem"}, {certfile, "cert.pem"}, {keyfile, "key.pem"}], infinity). {ok,{sslsocket,[...]}} -

    Step 8: Send a message over SSL:

    +

    Send a messag over ssl

    4 client> ssl:send(SSLSocket, "foo"). ok -

    Step 9: Set active true on the SSL socket:

    +

    Set active true on the ssl socket

    4 server> ssl:setopts(SSLSocket, [{active, true}]). ok -

    Step 10: Flush the shell message queue to see that the message - was sent on the client side:

    +

    Flush the shell message queue to see that we got the message + sent on the client side

    5 server> flush(). Shell got {ssl,{sslsocket,[...]},"foo"} ok diff -Nru erlang-18.2-dfsg/lib/ssl/examples/certs/Makefile erlang-17.3-dfsg/lib/ssl/examples/certs/Makefile --- erlang-18.2-dfsg/lib/ssl/examples/certs/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/examples/certs/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2003-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/ssl/examples/src/client_server.erl erlang-17.3-dfsg/lib/ssl/examples/src/client_server.erl --- erlang-18.2-dfsg/lib/ssl/examples/src/client_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/examples/src/client_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/examples/src/Makefile erlang-17.3-dfsg/lib/ssl/examples/src/Makefile --- erlang-18.2-dfsg/lib/ssl/examples/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/examples/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2003-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/ssl/Makefile erlang-17.3-dfsg/lib/ssl/Makefile --- erlang-18.2-dfsg/lib/ssl/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1999-2011. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/ssl/src/dtls_connection.erl erlang-17.3-dfsg/lib/ssl/src/dtls_connection.erl --- erlang-18.2-dfsg/lib/ssl/src/dtls_connection.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/dtls_connection.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -145,9 +144,9 @@ process_flag(trap_exit, true), State0 = initial_state(Role, Host, Port, Socket, Options, User, CbInfo), Handshake = ssl_handshake:init_handshake_history(), - TimeStamp = erlang:monotonic_time(), + TimeStamp = calendar:datetime_to_gregorian_seconds({date(), time()}), try ssl_config:init(SSLOpts0, Role) of - {ok, Ref, CertDbHandle, FileRefHandle, CacheHandle, CRLDbInfo, OwnCert, Key, DHParams} -> + {ok, Ref, CertDbHandle, FileRefHandle, CacheHandle, OwnCert, Key, DHParams} -> Session = State0#state.session, State = State0#state{ tls_handshake_history = Handshake, @@ -156,7 +155,6 @@ file_ref_db = FileRefHandle, cert_db_ref = Ref, cert_db = CertDbHandle, - crl_db = CRLDbInfo, session_cache = CacheHandle, private_key = Key, diffie_hellman_params = DHParams}, @@ -229,9 +227,9 @@ case dtls_handshake:hello(Hello, SslOptions, ConnectionStates0, Renegotiation) of #alert{} = Alert -> handle_own_alert(Alert, ReqVersion, hello, State); - {Version, NewId, ConnectionStates, ProtoExt, Protocol} -> + {Version, NewId, ConnectionStates, NextProtocol} -> ssl_connection:handle_session(Hello, - Version, NewId, ConnectionStates, ProtoExt, Protocol, State) + Version, NewId, ConnectionStates, NextProtocol, State) end; hello(Msg, State) -> @@ -515,7 +513,6 @@ user_data_buffer = <<>>, session_cache_cb = SessionCacheCb, renegotiation = {false, first}, - allow_renegotiate = SSLOptions#ssl_options.client_renegotiation, start_or_recv_from = undefined, send_queue = queue:new(), protocol_cb = ?MODULE diff -Nru erlang-18.2-dfsg/lib/ssl/src/dtls_connection.hrl erlang-17.3-dfsg/lib/ssl/src/dtls_connection.hrl --- erlang-18.2-dfsg/lib/ssl/src/dtls_connection.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/dtls_connection.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/dtls_connection_sup.erl erlang-17.3-dfsg/lib/ssl/src/dtls_connection_sup.erl --- erlang-18.2-dfsg/lib/ssl/src/dtls_connection_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/dtls_connection_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/dtls.erl erlang-17.3-dfsg/lib/ssl/src/dtls.erl --- erlang-18.2-dfsg/lib/ssl/src/dtls.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/dtls.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/dtls_handshake.erl erlang-17.3-dfsg/lib/ssl/src/dtls_handshake.erl --- erlang-18.2-dfsg/lib/ssl/src/dtls_handshake.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/dtls_handshake.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% -module(dtls_handshake). @@ -182,8 +181,8 @@ SslOpt, ConnectionStates0, Renegotiation) of #alert{} = Alert -> Alert; - {ConnectionStates, ProtoExt, Protocol} -> - {Version, SessionId, ConnectionStates, ProtoExt, Protocol} + {ConnectionStates, Protocol} -> + {Version, SessionId, ConnectionStates, Protocol} end. dtls_fragment(Mss, MsgType, Len, MsgSeq, Bin, Offset, Acc) diff -Nru erlang-18.2-dfsg/lib/ssl/src/dtls_handshake.hrl erlang-17.3-dfsg/lib/ssl/src/dtls_handshake.hrl --- erlang-18.2-dfsg/lib/ssl/src/dtls_handshake.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/dtls_handshake.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/dtls_record.erl erlang-17.3-dfsg/lib/ssl/src/dtls_record.erl --- erlang-18.2-dfsg/lib/ssl/src/dtls_record.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/dtls_record.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -121,26 +120,6 @@ end. encode_plain_text(Type, Version, Data, - #connection_states{current_write = - #connection_state{ - epoch = Epoch, - sequence_number = Seq, - compression_state=CompS0, - security_parameters= - #security_parameters{ - cipher_type = ?AEAD, - compression_algorithm=CompAlg} - }= WriteState0} = ConnectionStates) -> - {Comp, CompS1} = ssl_record:compress(CompAlg, Data, CompS0), - WriteState1 = WriteState0#connection_state{compression_state = CompS1}, - AAD = calc_aad(Type, Version, Epoch, Seq), - {CipherFragment, WriteState} = ssl_record:cipher_aead(dtls_v1:corresponding_tls_version(Version), - Comp, WriteState1, AAD), - CipherText = encode_tls_cipher_text(Type, Version, Epoch, Seq, CipherFragment), - {CipherText, ConnectionStates#connection_states{current_write = - WriteState#connection_state{sequence_number = Seq +1}}}; - -encode_plain_text(Type, Version, Data, #connection_states{current_write=#connection_state{ epoch = Epoch, sequence_number = Seq, @@ -162,44 +141,16 @@ sequence_number = Seq, fragment = CipherFragment} = CipherText, #connection_states{current_read = - #connection_state{ - compression_state = CompressionS0, - security_parameters= - #security_parameters{ - cipher_type = ?AEAD, - compression_algorithm=CompAlg} - } = ReadState0}= ConnnectionStates0) -> - AAD = calc_aad(Type, Version, Epoch, Seq), - case ssl_record:decipher_aead(dtls_v1:corresponding_tls_version(Version), - CipherFragment, ReadState0, AAD) of - {PlainFragment, ReadState1} -> - {Plain, CompressionS1} = ssl_record:uncompress(CompAlg, - PlainFragment, CompressionS0), - ConnnectionStates = ConnnectionStates0#connection_states{ - current_read = ReadState1#connection_state{ - compression_state = CompressionS1}}, - {CipherText#ssl_tls{fragment = Plain}, ConnnectionStates}; - #alert{} = Alert -> - Alert - end; - -decode_cipher_text(#ssl_tls{type = Type, version = Version, - epoch = Epoch, - sequence_number = Seq, - fragment = CipherFragment} = CipherText, - #connection_states{current_read = - #connection_state{ - compression_state = CompressionS0, - security_parameters= - #security_parameters{ - compression_algorithm=CompAlg} - } = ReadState0}= ConnnectionStates0) -> + #connection_state{compression_state = CompressionS0, + security_parameters = SecParams} = ReadState0} + = ConnnectionStates0) -> + CompressAlg = SecParams#security_parameters.compression_algorithm, {PlainFragment, Mac, ReadState1} = ssl_record:decipher(dtls_v1:corresponding_tls_version(Version), - CipherFragment, ReadState0, true), + CipherFragment, ReadState0), MacHash = calc_mac_hash(ReadState1, Type, Version, Epoch, Seq, PlainFragment), case ssl_record:is_correct_mac(Mac, MacHash) of true -> - {Plain, CompressionS1} = ssl_record:uncompress(CompAlg, + {Plain, CompressionS1} = ssl_record:uncompress(CompressAlg, PlainFragment, CompressionS0), ConnnectionStates = ConnnectionStates0#connection_states{ current_read = ReadState1#connection_state{ @@ -417,7 +368,3 @@ mac_hash(Version, MacAlg, MacSecret, SeqNo, Type, Length, Fragment) -> dtls_v1:mac_hash(Version, MacAlg, MacSecret, SeqNo, Type, Length, Fragment). - -calc_aad(Type, {MajVer, MinVer}, Epoch, SeqNo) -> - NewSeq = (Epoch bsl 48) + SeqNo, - <>. diff -Nru erlang-18.2-dfsg/lib/ssl/src/dtls_record.hrl erlang-17.3-dfsg/lib/ssl/src/dtls_record.hrl --- erlang-18.2-dfsg/lib/ssl/src/dtls_record.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/dtls_record.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/dtls_v1.erl erlang-17.3-dfsg/lib/ssl/src/dtls_v1.erl --- erlang-18.2-dfsg/lib/ssl/src/dtls_v1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/dtls_v1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/inet_tls_dist.erl erlang-17.3-dfsg/lib/ssl/src/inet_tls_dist.erl --- erlang-18.2-dfsg/lib/ssl/src/inet_tls_dist.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/inet_tls_dist.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,7 +29,7 @@ childspecs() -> {ok, [{ssl_dist_sup,{ssl_dist_sup, start_link, []}, - permanent, infinity, supervisor, [ssl_dist_sup]}]}. + permanent, 2000, worker, [ssl_dist_sup]}]}. select(Node) -> case split_node(atom_to_list(Node), $@, []) of diff -Nru erlang-18.2-dfsg/lib/ssl/src/Makefile erlang-17.3-dfsg/lib/ssl/src/Makefile --- erlang-18.2-dfsg/lib/ssl/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1999-2015. All Rights Reserved. +# Copyright Ericsson AB 1999-2014. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -39,8 +38,7 @@ # ---------------------------------------------------- BEHAVIOUR_MODULES= \ - ssl_session_cache_api \ - ssl_crl_cache_api + ssl_session_cache_api MODULES= \ ssl \ @@ -67,8 +65,6 @@ ssl_manager \ ssl_session \ ssl_session_cache \ - ssl_crl\ - ssl_crl_cache \ ssl_socket \ ssl_listen_tracker_sup \ tls_record \ @@ -122,7 +118,7 @@ debug opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) clean: - rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(BEHAVIOUR_TARGET_FILES) + rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk @@ -168,5 +164,5 @@ $(EBIN)/ssl_session_cache_api.$(EMULATOR): ssl_internal.hrl ssl_handshake.hrl $(EBIN)/ssl_ssl3.$(EMULATOR): ssl_internal.hrl ssl_record.hrl ssl_cipher.hrl $(EBIN)/ssl_tls1.$(EMULATOR): ssl_internal.hrl ssl_record.hrl ssl_cipher.hrl -$(EBIN)/ssl_cache.$(EMULATOR): ssl_cache.erl ssl_internal.hrl ../../public_key/include/public_key.hrl + diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_alert.erl erlang-17.3-dfsg/lib/ssl/src/ssl_alert.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_alert.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_alert.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -162,9 +161,5 @@ "bad certificate hash value"; description_txt(?UNKNOWN_PSK_IDENTITY) -> "unknown psk identity"; -description_txt(?INAPPROPRIATE_FALLBACK) -> - "inappropriate fallback"; -description_txt(?NO_APPLICATION_PROTOCOL) -> - "no application protocol"; description_txt(Enum) -> lists:flatten(io_lib:format("unsupported/unknown alert: ~p", [Enum])). diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_alert.hrl erlang-17.3-dfsg/lib/ssl/src/ssl_alert.hrl --- erlang-18.2-dfsg/lib/ssl/src/ssl_alert.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_alert.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -59,7 +58,6 @@ %% protocol_version(70), %% insufficient_security(71), %% internal_error(80), -%% inappropriate_fallback(86), %% user_canceled(90), %% no_renegotiation(100), %% RFC 4366 @@ -70,8 +68,6 @@ %% bad_certificate_hash_value(114), %% RFC 4366 %% unknown_psk_identity(115), -%% RFC 7301 -%% no_application_protocol(120), %% (255) %% } AlertDescription; @@ -97,7 +93,6 @@ -define(PROTOCOL_VERSION, 70). -define(INSUFFICIENT_SECURITY, 71). -define(INTERNAL_ERROR, 80). --define(INAPPROPRIATE_FALLBACK, 86). -define(USER_CANCELED, 90). -define(NO_RENEGOTIATION, 100). -define(UNSUPPORTED_EXTENSION, 110). @@ -106,7 +101,6 @@ -define(BAD_CERTIFICATE_STATUS_RESPONSE, 113). -define(BAD_CERTIFICATE_HASH_VALUE, 114). -define(UNKNOWN_PSK_IDENTITY, 115). --define(NO_APPLICATION_PROTOCOL, 120). -define(ALERT_REC(Level,Desc), #alert{level=Level,description=Desc,where={?FILE, ?LINE}}). diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_api.hrl erlang-17.3-dfsg/lib/ssl/src/ssl_api.hrl --- erlang-18.2-dfsg/lib/ssl/src/ssl_api.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_api.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -50,8 +49,6 @@ {srp_identity, {string(), string()}} | {ciphers, ciphers()} | {ssl_imp, ssl_imp()} | {reuse_sessions, boolean()} | {reuse_session, fun()} | {hibernate_after, integer()|undefined} | - {alpn_advertised_protocols, [binary()]} | - {alpn_preferred_protocols, [binary()]} | {next_protocols_advertised, list(binary())} | {client_preferred_next_protocols, binary(), client | server, list(binary())}. diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_app.erl erlang-17.3-dfsg/lib/ssl/src/ssl_app.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl.app.src erlang-17.3-dfsg/lib/ssl/src/ssl.app.src --- erlang-18.2-dfsg/lib/ssl/src/ssl.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -39,10 +39,6 @@ ssl_manager, ssl_pkix_db, ssl_certificate, - %% CRL handling - ssl_crl, - ssl_crl_cache, - ssl_crl_cache_api, %% App structure ssl_app, ssl_sup, @@ -53,7 +49,7 @@ {applications, [crypto, public_key, kernel, stdlib]}, {env, []}, {mod, {ssl_app, []}}, - {runtime_dependencies, ["stdlib-2.0","public_key-1.0","kernel-3.0", - "erts-7.0","crypto-3.3", "inets-5.10.7"]}]}. + {runtime_dependencies, ["stdlib-2.0","public_key-0.22","kernel-3.0", + "erts-6.0","crypto-3.3"]}]}. diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl.appup.src erlang-17.3-dfsg/lib/ssl/src/ssl.appup.src --- erlang-18.2-dfsg/lib/ssl/src/ssl.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,16 +1,24 @@ %% -*- erlang -*- {"%VSN%", [ - {<<"7\\..*">>, [{restart_application, ssl}]}, - {<<"6\\..*">>, [{restart_application, ssl}]}, - {<<"5\\..*">>, [{restart_application, ssl}]}, + {"5.3.5", [{load_module, ssl, soft_purge, soft_purge, [ssl_connection]}, + {load_module, ssl_handshake, soft_purge, soft_purge, [ssl_certificate]}, + {load_module, ssl_certificate, soft_purge, soft_purge, []}, + {load_module, ssl_connection, soft_purge, soft_purge, [tls_connection]}, + {update, tls_connection, {advanced, {up, "5.3.5", "5.3.6"}}, [ssl_handshake]}]}, + {<<"5\\.3\\.[1-4]($|\\..*)">>, [{restart_application, ssl}]}, + {<<"5\\.[0-2]($|\\..*)">>, [{restart_application, ssl}]}, {<<"4\\..*">>, [{restart_application, ssl}]}, {<<"3\\..*">>, [{restart_application, ssl}]} ], [ - {<<"7\\..*">>, [{restart_application, ssl}]}, - {<<"6\\..*">>, [{restart_application, ssl}]}, - {<<"5\\..*">>, [{restart_application, ssl}]}, + {"5.3.5", [{load_module, ssl, soft_purge, soft_purge,[ssl_certificate]}, + {load_module, ssl_handshake, soft_purge, soft_purge,[ssl_certificate]}, + {load_module, ssl_certificate, soft_purge, soft_purge,[]}, + {load_module, ssl_connection, soft_purge, soft_purge,[tls_connection]}, + {update, tls_connection, {advanced, {down, "5.3.6", "5.3.5"}}, [ssl_handshake]}]}, + {<<"5\\.3\\.[1-4]($|\\..*)">>, [{restart_application, ssl}]}, + {<<"5\\.[0-2]($|\\..*)">>, [{restart_application, ssl}]}, {<<"4\\..*">>, [{restart_application, ssl}]}, {<<"3\\..*">>, [{restart_application, ssl}]} ] diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_certificate.erl erlang-17.3-dfsg/lib/ssl/src/ssl_certificate.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_certificate.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_certificate.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015 All Rights Reserved. +%% Copyright Ericsson AB 2007-2014 All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -34,8 +33,7 @@ -export([trusted_cert_and_path/4, certificate_chain/3, file_to_certificats/2, - file_to_crls/2, - validate/3, + validate_extension/3, is_valid_extkey_usage/2, is_valid_key_usage/2, select_extension/2, @@ -85,19 +83,16 @@ end. %%-------------------------------------------------------------------- --spec certificate_chain(undefined | binary() | #'OTPCertificate'{} , db_handle(), certdb_ref()) -> - {error, no_cert} | {ok, #'OTPCertificate'{} | undefined, [der_cert()]}. +-spec certificate_chain(undefined | binary(), db_handle(), certdb_ref()) -> + {error, no_cert} | {ok, [der_cert()]}. %% %% Description: Return the certificate chain to send to peer. %%-------------------------------------------------------------------- certificate_chain(undefined, _, _) -> {error, no_cert}; -certificate_chain(OwnCert, CertDbHandle, CertsDbRef) when is_binary(OwnCert) -> - ErlCert = public_key:pkix_decode_cert(OwnCert, otp), - certificate_chain(ErlCert, OwnCert, CertDbHandle, CertsDbRef, [OwnCert]); certificate_chain(OwnCert, CertDbHandle, CertsDbRef) -> - DerCert = public_key:pkix_encode('OTPCertificate', OwnCert, otp), - certificate_chain(OwnCert, DerCert, CertDbHandle, CertsDbRef, [DerCert]). + ErlCert = public_key:pkix_decode_cert(OwnCert, otp), + certificate_chain(ErlCert, OwnCert, CertDbHandle, CertsDbRef, [OwnCert]). %%-------------------------------------------------------------------- -spec file_to_certificats(binary(), term()) -> [der_cert()]. %% @@ -106,39 +101,29 @@ file_to_certificats(File, DbHandle) -> {ok, List} = ssl_manager:cache_pem_file(File, DbHandle), [Bin || {'Certificate', Bin, not_encrypted} <- List]. - %%-------------------------------------------------------------------- --spec file_to_crls(binary(), term()) -> [der_cert()]. -%% -%% Description: Return list of DER encoded certificates. -%%-------------------------------------------------------------------- -file_to_crls(File, DbHandle) -> - {ok, List} = ssl_manager:cache_pem_file(File, DbHandle), - [Bin || {'CertificateList', Bin, not_encrypted} <- List]. - -%%-------------------------------------------------------------------- --spec validate(term(), {extension, #'Extension'{}} | {bad_cert, atom()} | valid, - term()) -> {valid, term()} | - {fail, tuple()} | - {unknown, term()}. +-spec validate_extension(term(), {extension, #'Extension'{}} | {bad_cert, atom()} | valid, + term()) -> {valid, term()} | + {fail, tuple()} | + {unknown, term()}. %% %% Description: Validates ssl/tls specific extensions %%-------------------------------------------------------------------- -validate(_,{extension, #'Extension'{extnID = ?'id-ce-extKeyUsage', - extnValue = KeyUse}}, {Role, _,_, _, _}) -> +validate_extension(_,{extension, #'Extension'{extnID = ?'id-ce-extKeyUsage', + extnValue = KeyUse}}, Role) -> case is_valid_extkey_usage(KeyUse, Role) of true -> {valid, Role}; false -> {fail, {bad_cert, invalid_ext_key_usage}} end; -validate(_, {extension, _}, Role) -> - {unknown, Role}; -validate(_, {bad_cert, _} = Reason, _) -> +validate_extension(_, {bad_cert, _} = Reason, _) -> {fail, Reason}; -validate(_, valid, Role) -> +validate_extension(_, {extension, _}, Role) -> + {unknown, Role}; +validate_extension(_, valid, Role) -> {valid, Role}; -validate(_, valid_peer, Role) -> +validate_extension(_, valid_peer, Role) -> {valid, Role}. %%-------------------------------------------------------------------- @@ -209,14 +194,14 @@ %% certificate. The verification of the %% cert chain will fail if guess is %% incorrect. - {ok, undefined, lists:reverse(Chain)} + {ok, lists:reverse(Chain)} end; {{ok, {SerialNr, Issuer}}, SelfSigned} -> certificate_chain(CertDbHandle, CertsDbRef, Chain, SerialNr, Issuer, SelfSigned) end. -certificate_chain(_, _, [RootCert | _] = Chain, _, _, true) -> - {ok, RootCert, lists:reverse(Chain)}; +certificate_chain(_,_, Chain, _SerialNr, _Issuer, true) -> + {ok, lists:reverse(Chain)}; certificate_chain(CertDbHandle, CertsDbRef, Chain, SerialNr, Issuer, _SelfSigned) -> case ssl_manager:lookup_trusted_cert(CertDbHandle, CertsDbRef, @@ -229,7 +214,7 @@ %% The trusted cert may be obmitted from the chain as the %% counter part needs to have it anyway to be able to %% verify it. - {ok, undefined, lists:reverse(Chain)} + {ok, lists:reverse(Chain)} end. find_issuer(OtpCert, CertDbHandle) -> @@ -297,7 +282,7 @@ handle_path({BinCert, OTPCert}, Path, PartialChainHandler) -> case public_key:pkix_is_self_signed(OTPCert) of true -> - {BinCert, lists:delete(BinCert, Path)}; + {BinCert, Path}; false -> handle_incomplete_chain(Path, PartialChainHandler) end. diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_cipher.erl erlang-17.3-dfsg/lib/ssl/src/ssl_cipher.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_cipher.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_cipher.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -34,18 +33,18 @@ -include_lib("public_key/include/public_key.hrl"). -export([security_parameters/2, security_parameters/3, suite_definition/1, - cipher_init/3, decipher/6, cipher/5, decipher_aead/6, cipher_aead/6, + decipher/5, cipher/5, suite/1, suites/1, all_suites/1, - ec_keyed_suites/0, anonymous_suites/1, psk_suites/1, srp_suites/0, - rc4_suites/1, openssl_suite/1, openssl_suite_name/1, filter/2, filter_suites/1, - hash_algorithm/1, sign_algorithm/1, is_acceptable_hash/2, is_fallback/1]). + ec_keyed_suites/0, anonymous_suites/0, psk_suites/1, srp_suites/0, + openssl_suite/1, openssl_suite_name/1, filter/2, filter_suites/1, + hash_algorithm/1, sign_algorithm/1, is_acceptable_hash/2]). -export_type([cipher_suite/0, erl_cipher_suite/0, openssl_cipher_suite/0, key_algo/0]). -type cipher() :: null |rc4_128 | idea_cbc | des40_cbc | des_cbc | '3des_ede_cbc' - | aes_128_cbc | aes_256_cbc | aes_128_gcm | aes_256_gcm | chacha20_poly1305. + | aes_128_cbc | aes_256_cbc. -type hash() :: null | sha | md5 | sha224 | sha256 | sha384 | sha512. -type key_algo() :: null | rsa | dhe_rsa | dhe_dss | ecdhe_ecdsa| ecdh_ecdsa | ecdh_rsa| srp_rsa| srp_dss | psk | dhe_psk | rsa_psk | dh_anon | ecdh_anon | srp_anon. -type erl_cipher_suite() :: {key_algo(), cipher(), hash()}. @@ -89,32 +88,20 @@ hash_size = hash_size(Hash)}. %%-------------------------------------------------------------------- --spec cipher_init(cipher_enum(), binary(), binary()) -> #cipher_state{}. -%% -%% Description: Initializes the #cipher_state according to BCA -%%------------------------------------------------------------------- -cipher_init(?RC4, IV, Key) -> - State = crypto:stream_init(rc4, Key), - #cipher_state{iv = IV, key = Key, state = State}; -cipher_init(?AES_GCM, IV, Key) -> - <> = ssl:random_bytes(8), - #cipher_state{iv = IV, key = Key, nonce = Nonce}; -cipher_init(_BCA, IV, Key) -> - #cipher_state{iv = IV, key = Key}. - -%%-------------------------------------------------------------------- -spec cipher(cipher_enum(), #cipher_state{}, binary(), iodata(), ssl_record:ssl_version()) -> {binary(), #cipher_state{}}. %% %% Description: Encrypts the data and the MAC using chipher described %% by cipher_enum() and updating the cipher state -%% Used for "MAC then Cipher" suites where first an HMAC of the -%% data is calculated and the data plus the HMAC is ecncrypted. %%------------------------------------------------------------------- cipher(?NULL, CipherState, <<>>, Fragment, _Version) -> GenStreamCipherList = [Fragment, <<>>], {GenStreamCipherList, CipherState}; -cipher(?RC4, CipherState = #cipher_state{state = State0}, Mac, Fragment, _Version) -> +cipher(?RC4, CipherState, Mac, Fragment, _Version) -> + State0 = case CipherState#cipher_state.state of + undefined -> crypto:stream_init(rc4, CipherState#cipher_state.key); + S -> S + end, GenStreamCipherList = [Fragment, Mac], {State1, T} = crypto:stream_encrypt(State0, GenStreamCipherList), {T, CipherState#cipher_state{state = State1}}; @@ -126,40 +113,13 @@ block_cipher(fun(<>, IV, T) -> crypto:block_encrypt(des3_cbc, [K1, K2, K3], IV, T) end, block_size(des_cbc), CipherState, Mac, Fragment, Version); -cipher(?AES_CBC, CipherState, Mac, Fragment, Version) -> +cipher(?AES, CipherState, Mac, Fragment, Version) -> block_cipher(fun(Key, IV, T) when byte_size(Key) =:= 16 -> crypto:block_encrypt(aes_cbc128, Key, IV, T); (Key, IV, T) when byte_size(Key) =:= 32 -> crypto:block_encrypt(aes_cbc256, Key, IV, T) end, block_size(aes_128_cbc), CipherState, Mac, Fragment, Version). -%%-------------------------------------------------------------------- --spec cipher_aead(cipher_enum(), #cipher_state{}, integer(), binary(), iodata(), ssl_record:ssl_version()) -> - {binary(), #cipher_state{}}. -%% -%% Description: Encrypts the data and protects associated data (AAD) using chipher -%% described by cipher_enum() and updating the cipher state -%% Use for suites that use authenticated encryption with associated data (AEAD) -%%------------------------------------------------------------------- -cipher_aead(?AES_GCM, CipherState, SeqNo, AAD, Fragment, Version) -> - aead_cipher(aes_gcm, CipherState, SeqNo, AAD, Fragment, Version); -cipher_aead(?CHACHA20_POLY1305, CipherState, SeqNo, AAD, Fragment, Version) -> - aead_cipher(chacha20_poly1305, CipherState, SeqNo, AAD, Fragment, Version). - -aead_cipher(chacha20_poly1305, #cipher_state{key=Key} = CipherState, SeqNo, AAD0, Fragment, _Version) -> - CipherLen = erlang:iolist_size(Fragment), - AAD = <>, - Nonce = <>, - {Content, CipherTag} = crypto:block_encrypt(chacha20_poly1305, Key, Nonce, {AAD, Fragment}), - {<>, CipherState}; -aead_cipher(Type, #cipher_state{key=Key, iv = IV0, nonce = Nonce} = CipherState, _SeqNo, AAD0, Fragment, _Version) -> - CipherLen = erlang:iolist_size(Fragment), - AAD = <>, - <> = IV0, - IV = <>, - {Content, CipherTag} = crypto:block_encrypt(Type, Key, IV, {AAD, Fragment}), - {<>, CipherState#cipher_state{nonce = Nonce + 1}}. - build_cipher_block(BlockSz, Mac, Fragment) -> TotSz = byte_size(Mac) + erlang:iolist_size(Fragment) + 1, {PaddingLength, Padding} = get_padding(TotSz, BlockSz), @@ -183,18 +143,19 @@ {T, CS0#cipher_state{iv=NextIV}}. %%-------------------------------------------------------------------- --spec decipher(cipher_enum(), integer(), #cipher_state{}, binary(), - ssl_record:ssl_version(), boolean()) -> +-spec decipher(cipher_enum(), integer(), #cipher_state{}, binary(), ssl_record:ssl_version()) -> {binary(), binary(), #cipher_state{}} | #alert{}. %% %% Description: Decrypts the data and the MAC using cipher described %% by cipher_enum() and updating the cipher state. -%% Used for "MAC then Cipher" suites where first the data is decrypted -%% and the an HMAC of the decrypted data is checked %%------------------------------------------------------------------- -decipher(?NULL, _HashSz, CipherState, Fragment, _, _) -> +decipher(?NULL, _HashSz, CipherState, Fragment, _) -> {Fragment, <<>>, CipherState}; -decipher(?RC4, HashSz, CipherState = #cipher_state{state = State0}, Fragment, _, _) -> +decipher(?RC4, HashSz, CipherState, Fragment, _) -> + State0 = case CipherState#cipher_state.state of + undefined -> crypto:stream_init(rc4, CipherState#cipher_state.key); + S -> S + end, try crypto:stream_decrypt(State0, Fragment) of {State, Text} -> GSC = generic_stream_cipher_from_bin(Text, HashSz), @@ -210,36 +171,23 @@ ?ALERT_REC(?FATAL, ?BAD_RECORD_MAC) end; -decipher(?DES, HashSz, CipherState, Fragment, Version, PaddingCheck) -> +decipher(?DES, HashSz, CipherState, Fragment, Version) -> block_decipher(fun(Key, IV, T) -> crypto:block_decrypt(des_cbc, Key, IV, T) - end, CipherState, HashSz, Fragment, Version, PaddingCheck); -decipher(?'3DES', HashSz, CipherState, Fragment, Version, PaddingCheck) -> + end, CipherState, HashSz, Fragment, Version); +decipher(?'3DES', HashSz, CipherState, Fragment, Version) -> block_decipher(fun(<>, IV, T) -> crypto:block_decrypt(des3_cbc, [K1, K2, K3], IV, T) - end, CipherState, HashSz, Fragment, Version, PaddingCheck); -decipher(?AES_CBC, HashSz, CipherState, Fragment, Version, PaddingCheck) -> + end, CipherState, HashSz, Fragment, Version); +decipher(?AES, HashSz, CipherState, Fragment, Version) -> block_decipher(fun(Key, IV, T) when byte_size(Key) =:= 16 -> crypto:block_decrypt(aes_cbc128, Key, IV, T); (Key, IV, T) when byte_size(Key) =:= 32 -> crypto:block_decrypt(aes_cbc256, Key, IV, T) - end, CipherState, HashSz, Fragment, Version, PaddingCheck). - -%%-------------------------------------------------------------------- --spec decipher_aead(cipher_enum(), #cipher_state{}, integer(), binary(), binary(), ssl_record:ssl_version()) -> - {binary(), binary(), #cipher_state{}} | #alert{}. -%% -%% Description: Decrypts the data and checks the associated data (AAD) MAC using -%% cipher described by cipher_enum() and updating the cipher state. -%% Use for suites that use authenticated encryption with associated data (AEAD) -%%------------------------------------------------------------------- -decipher_aead(?AES_GCM, CipherState, SeqNo, AAD, Fragment, Version) -> - aead_decipher(aes_gcm, CipherState, SeqNo, AAD, Fragment, Version); -decipher_aead(?CHACHA20_POLY1305, CipherState, SeqNo, AAD, Fragment, Version) -> - aead_decipher(chacha20_poly1305, CipherState, SeqNo, AAD, Fragment, Version). + end, CipherState, HashSz, Fragment, Version). block_decipher(Fun, #cipher_state{key=Key, iv=IV} = CipherState0, - HashSz, Fragment, Version, PaddingCheck) -> + HashSz, Fragment, Version) -> try Text = Fun(Key, IV, Fragment), NextIV = next_iv(Fragment, IV), @@ -247,7 +195,7 @@ Content = GBC#generic_block_cipher.content, Mac = GBC#generic_block_cipher.mac, CipherState1 = CipherState0#cipher_state{iv=GBC#generic_block_cipher.next_iv}, - case is_correct_padding(GBC, Version, PaddingCheck) of + case is_correct_padding(GBC, Version) of true -> {Content, Mac, CipherState1}; false -> @@ -267,35 +215,6 @@ %% bad_record_mac alert to hide the specific type of the error." ?ALERT_REC(?FATAL, ?BAD_RECORD_MAC) end. - -aead_ciphertext_to_state(chacha20_poly1305, SeqNo, _IV, AAD0, Fragment, _Version) -> - CipherLen = size(Fragment) - 16, - <> = Fragment, - AAD = <>, - Nonce = <>, - {Nonce, AAD, CipherText, CipherTag}; -aead_ciphertext_to_state(_, _SeqNo, <>, AAD0, Fragment, _Version) -> - CipherLen = size(Fragment) - 24, - <> = Fragment, - AAD = <>, - Nonce = <>, - {Nonce, AAD, CipherText, CipherTag}. - -aead_decipher(Type, #cipher_state{key = Key, iv = IV} = CipherState, - SeqNo, AAD0, Fragment, Version) -> - try - {Nonce, AAD, CipherText, CipherTag} = aead_ciphertext_to_state(Type, SeqNo, IV, AAD0, Fragment, Version), - case crypto:block_decrypt(Type, Key, Nonce, {AAD, CipherText, CipherTag}) of - Content when is_binary(Content) -> - {Content, CipherState}; - _ -> - ?ALERT_REC(?FATAL, ?BAD_RECORD_MAC) - end - catch - _:_ -> - ?ALERT_REC(?FATAL, ?BAD_RECORD_MAC) - end. - %%-------------------------------------------------------------------- -spec suites(ssl_record:ssl_version()) -> [cipher_suite()]. %% @@ -308,27 +227,16 @@ all_suites(Version) -> suites(Version) - ++ anonymous_suites(Version) - ++ psk_suites(Version) - ++ srp_suites() - ++ rc4_suites(Version). + ++ ssl_cipher:anonymous_suites() + ++ ssl_cipher:psk_suites(Version) + ++ ssl_cipher:srp_suites(). %%-------------------------------------------------------------------- --spec anonymous_suites(ssl_record:ssl_version() | integer()) -> [cipher_suite()]. +-spec anonymous_suites() -> [cipher_suite()]. %% %% Description: Returns a list of the anonymous cipher suites, only supported %% if explicitly set by user. Intended only for testing. %%-------------------------------------------------------------------- - -anonymous_suites({3, N}) -> - anonymous_suites(N); - -anonymous_suites(N) - when N >= 3 -> - [?TLS_DH_anon_WITH_AES_128_GCM_SHA256, - ?TLS_DH_anon_WITH_AES_256_GCM_SHA384 - ] ++ anonymous_suites(0); - -anonymous_suites(_) -> +anonymous_suites() -> [?TLS_DH_anon_WITH_RC4_128_MD5, ?TLS_DH_anon_WITH_DES_CBC_SHA, ?TLS_DH_anon_WITH_3DES_EDE_CBC_SHA, @@ -352,20 +260,13 @@ psk_suites(N) when N >= 3 -> - [ - ?TLS_DHE_PSK_WITH_AES_256_GCM_SHA384, - ?TLS_RSA_PSK_WITH_AES_256_GCM_SHA384, - ?TLS_PSK_WITH_AES_256_GCM_SHA384, - ?TLS_DHE_PSK_WITH_AES_256_CBC_SHA384, - ?TLS_RSA_PSK_WITH_AES_256_CBC_SHA384, - ?TLS_PSK_WITH_AES_256_CBC_SHA384, - ?TLS_DHE_PSK_WITH_AES_128_GCM_SHA256, - ?TLS_RSA_PSK_WITH_AES_128_GCM_SHA256, - ?TLS_PSK_WITH_AES_128_GCM_SHA256, - ?TLS_DHE_PSK_WITH_AES_128_CBC_SHA256, - ?TLS_RSA_PSK_WITH_AES_128_CBC_SHA256, - ?TLS_PSK_WITH_AES_128_CBC_SHA256 - ] ++ psk_suites(0); + psk_suites(0) ++ + [?TLS_DHE_PSK_WITH_AES_256_CBC_SHA384, + ?TLS_RSA_PSK_WITH_AES_256_CBC_SHA384, + ?TLS_PSK_WITH_AES_256_CBC_SHA384, + ?TLS_DHE_PSK_WITH_AES_128_CBC_SHA256, + ?TLS_RSA_PSK_WITH_AES_128_CBC_SHA256, + ?TLS_PSK_WITH_AES_128_CBC_SHA256]; psk_suites(_) -> [?TLS_DHE_PSK_WITH_AES_256_CBC_SHA, @@ -397,24 +298,6 @@ ?TLS_SRP_SHA_WITH_AES_256_CBC_SHA, ?TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA, ?TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA]. -%%-------------------------------------------------------------------- --spec rc4_suites(Version::ssl_record:ssl_version()) -> [cipher_suite()]. -%% -%% Description: Returns a list of the RSA|(ECDH/RSA)| (ECDH/ECDSA) -%% with RC4 cipher suites, only supported if explicitly set by user. -%% Are not considered secure any more. Other RC4 suites already -%% belonged to the user configured only category. -%%-------------------------------------------------------------------- -rc4_suites({3, 0}) -> - [?TLS_RSA_WITH_RC4_128_SHA, - ?TLS_RSA_WITH_RC4_128_MD5]; -rc4_suites({3, N}) when N =< 3 -> - [?TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, - ?TLS_ECDHE_RSA_WITH_RC4_128_SHA, - ?TLS_RSA_WITH_RC4_128_SHA, - ?TLS_RSA_WITH_RC4_128_MD5, - ?TLS_ECDH_ECDSA_WITH_RC4_128_SHA, - ?TLS_ECDH_RSA_WITH_RC4_128_SHA]. %%-------------------------------------------------------------------- -spec suite_definition(cipher_suite()) -> int_cipher_suite(). @@ -535,19 +418,6 @@ %%% TLS 1.2 PSK Cipher Suites RFC 5487 -suite_definition(?TLS_PSK_WITH_AES_128_GCM_SHA256) -> - {psk, aes_128_gcm, null, sha256}; -suite_definition(?TLS_PSK_WITH_AES_256_GCM_SHA384) -> - {psk, aes_256_gcm, null, sha384}; -suite_definition(?TLS_DHE_PSK_WITH_AES_128_GCM_SHA256) -> - {dhe_psk, aes_128_gcm, null, sha256}; -suite_definition(?TLS_DHE_PSK_WITH_AES_256_GCM_SHA384) -> - {dhe_psk, aes_256_gcm, null, sha384}; -suite_definition(?TLS_RSA_PSK_WITH_AES_128_GCM_SHA256) -> - {rsa_psk, aes_128_gcm, null, sha256}; -suite_definition(?TLS_RSA_PSK_WITH_AES_256_GCM_SHA384) -> - {rsa_psk, aes_256_gcm, null, sha384}; - suite_definition(?TLS_PSK_WITH_AES_128_CBC_SHA256) -> {psk, aes_128_cbc, sha256, default_prf}; suite_definition(?TLS_PSK_WITH_AES_256_CBC_SHA384) -> @@ -667,59 +537,7 @@ suite_definition(?TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256) -> {ecdh_rsa, aes_128_cbc, sha256, sha256}; suite_definition(?TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384) -> - {ecdh_rsa, aes_256_cbc, sha384, sha384}; - -%% RFC 5288 AES-GCM Cipher Suites -suite_definition(?TLS_RSA_WITH_AES_128_GCM_SHA256) -> - {rsa, aes_128_gcm, null, sha256}; -suite_definition(?TLS_RSA_WITH_AES_256_GCM_SHA384) -> - {rsa, aes_256_gcm, null, sha384}; -suite_definition(?TLS_DHE_RSA_WITH_AES_128_GCM_SHA256) -> - {dhe_rsa, aes_128_gcm, null, sha256}; -suite_definition(?TLS_DHE_RSA_WITH_AES_256_GCM_SHA384) -> - {dhe_rsa, aes_256_gcm, null, sha384}; -suite_definition(?TLS_DH_RSA_WITH_AES_128_GCM_SHA256) -> - {dh_rsa, aes_128_gcm, null, sha256}; -suite_definition(?TLS_DH_RSA_WITH_AES_256_GCM_SHA384) -> - {dh_rsa, aes_256_gcm, null, sha384}; -suite_definition(?TLS_DHE_DSS_WITH_AES_128_GCM_SHA256) -> - {dhe_dss, aes_128_gcm, null, sha256}; -suite_definition(?TLS_DHE_DSS_WITH_AES_256_GCM_SHA384) -> - {dhe_dss, aes_256_gcm, null, sha384}; -suite_definition(?TLS_DH_DSS_WITH_AES_128_GCM_SHA256) -> - {dh_dss, aes_128_gcm, null, sha256}; -suite_definition(?TLS_DH_DSS_WITH_AES_256_GCM_SHA384) -> - {dh_dss, aes_256_gcm, null, sha384}; -suite_definition(?TLS_DH_anon_WITH_AES_128_GCM_SHA256) -> - {dh_anon, aes_128_gcm, null, sha256}; -suite_definition(?TLS_DH_anon_WITH_AES_256_GCM_SHA384) -> - {dh_anon, aes_256_gcm, null, sha384}; - -%% RFC 5289 ECC AES-GCM Cipher Suites -suite_definition(?TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) -> - {ecdhe_ecdsa, aes_128_gcm, null, sha256}; -suite_definition(?TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384) -> - {ecdhe_ecdsa, aes_256_gcm, null, sha384}; -suite_definition(?TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256) -> - {ecdh_ecdsa, aes_128_gcm, null, sha256}; -suite_definition(?TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384) -> - {ecdh_ecdsa, aes_256_gcm, null, sha384}; -suite_definition(?TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) -> - {ecdhe_rsa, aes_128_gcm, null, sha256}; -suite_definition(?TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) -> - {ecdhe_rsa, aes_256_gcm, null, sha384}; -suite_definition(?TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256) -> - {ecdh_rsa, aes_128_gcm, null, sha256}; -suite_definition(?TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384) -> - {ecdh_rsa, aes_256_gcm, null, sha384}; - -%% draft-agl-tls-chacha20poly1305-04 Chacha20/Poly1305 Suites -suite_definition(?TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256) -> - {ecdhe_rsa, chacha20_poly1305, null, sha256}; -suite_definition(?TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256) -> - {ecdhe_ecdsa, chacha20_poly1305, null, sha256}; -suite_definition(?TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256) -> - {dhe_rsa, chacha20_poly1305, null, sha256}. + {ecdh_rsa, aes_256_cbc, sha384, sha384}. %%-------------------------------------------------------------------- -spec suite(erl_cipher_suite()) -> cipher_suite(). @@ -823,19 +641,6 @@ %%% TLS 1.2 PSK Cipher Suites RFC 5487 -suite({psk, aes_128_gcm, null}) -> - ?TLS_PSK_WITH_AES_128_GCM_SHA256; -suite({psk, aes_256_gcm, null}) -> - ?TLS_PSK_WITH_AES_256_GCM_SHA384; -suite({dhe_psk, aes_128_gcm, null}) -> - ?TLS_DHE_PSK_WITH_AES_128_GCM_SHA256; -suite({dhe_psk, aes_256_gcm, null}) -> - ?TLS_DHE_PSK_WITH_AES_256_GCM_SHA384; -suite({rsa_psk, aes_128_gcm, null}) -> - ?TLS_RSA_PSK_WITH_AES_128_GCM_SHA256; -suite({rsa_psk, aes_256_gcm, null}) -> - ?TLS_RSA_PSK_WITH_AES_256_GCM_SHA384; - suite({psk, aes_128_cbc, sha256}) -> ?TLS_PSK_WITH_AES_128_CBC_SHA256; suite({psk, aes_256_cbc, sha384}) -> @@ -955,60 +760,7 @@ suite({ecdh_rsa, aes_128_cbc, sha256}) -> ?TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256; suite({ecdh_rsa, aes_256_cbc, sha384}) -> - ?TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384; - -%% RFC 5288 AES-GCM Cipher Suites -suite({rsa, aes_128_gcm, null}) -> - ?TLS_RSA_WITH_AES_128_GCM_SHA256; -suite({rsa, aes_256_gcm, null}) -> - ?TLS_RSA_WITH_AES_256_GCM_SHA384; -suite({dhe_rsa, aes_128_gcm, null}) -> - ?TLS_DHE_RSA_WITH_AES_128_GCM_SHA256; -suite({dhe_rsa, aes_256_gcm, null}) -> - ?TLS_DHE_RSA_WITH_AES_256_GCM_SHA384; -suite({dh_rsa, aes_128_gcm, null}) -> - ?TLS_DH_RSA_WITH_AES_128_GCM_SHA256; -suite({dh_rsa, aes_256_gcm, null}) -> - ?TLS_DH_RSA_WITH_AES_256_GCM_SHA384; -suite({dhe_dss, aes_128_gcm, null}) -> - ?TLS_DHE_DSS_WITH_AES_128_GCM_SHA256; -suite({dhe_dss, aes_256_gcm, null}) -> - ?TLS_DHE_DSS_WITH_AES_256_GCM_SHA384; -suite({dh_dss, aes_128_gcm, null}) -> - ?TLS_DH_DSS_WITH_AES_128_GCM_SHA256; -suite({dh_dss, aes_256_gcm, null}) -> - ?TLS_DH_DSS_WITH_AES_256_GCM_SHA384; -suite({dh_anon, aes_128_gcm, null}) -> - ?TLS_DH_anon_WITH_AES_128_GCM_SHA256; -suite({dh_anon, aes_256_gcm, null}) -> - ?TLS_DH_anon_WITH_AES_256_GCM_SHA384; - -%% RFC 5289 ECC AES-GCM Cipher Suites -suite({ecdhe_ecdsa, aes_128_gcm, null}) -> - ?TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256; -suite({ecdhe_ecdsa, aes_256_gcm, null}) -> - ?TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384; -suite({ecdh_ecdsa, aes_128_gcm, null}) -> - ?TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256; -suite({ecdh_ecdsa, aes_256_gcm, null}) -> - ?TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384; -suite({ecdhe_rsa, aes_128_gcm, null}) -> - ?TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256; -suite({ecdhe_rsa, aes_256_gcm, null}) -> - ?TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384; -suite({ecdh_rsa, aes_128_gcm, null}) -> - ?TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256; -suite({ecdh_rsa, aes_256_gcm, null}) -> - ?TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384; - - -%% draft-agl-tls-chacha20poly1305-04 Chacha20/Poly1305 Suites -suite({ecdhe_rsa, chacha20_poly1305, null}) -> - ?TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256; -suite({ecdhe_ecdsa, chacha20_poly1305, null}) -> - ?TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256; -suite({dhe_rsa, chacha20_poly1305, null}) -> - ?TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256. + ?TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384. %%-------------------------------------------------------------------- -spec openssl_suite(openssl_cipher_suite()) -> cipher_suite(). @@ -1123,47 +875,7 @@ openssl_suite("ECDH-RSA-AES128-SHA256") -> ?TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256; openssl_suite("ECDH-RSA-AES256-SHA384") -> - ?TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384; - -%% RFC 5288 AES-GCM Cipher Suites -openssl_suite("AES128-GCM-SHA256") -> - ?TLS_RSA_WITH_AES_128_GCM_SHA256; -openssl_suite("AES256-GCM-SHA384") -> - ?TLS_RSA_WITH_AES_256_GCM_SHA384; -openssl_suite("DHE-RSA-AES128-GCM-SHA256") -> - ?TLS_DHE_RSA_WITH_AES_128_GCM_SHA256; -openssl_suite("DHE-RSA-AES256-GCM-SHA384") -> - ?TLS_DHE_RSA_WITH_AES_256_GCM_SHA384; -openssl_suite("DH-RSA-AES128-GCM-SHA256") -> - ?TLS_DH_RSA_WITH_AES_128_GCM_SHA256; -openssl_suite("DH-RSA-AES256-GCM-SHA384") -> - ?TLS_DH_RSA_WITH_AES_256_GCM_SHA384; -openssl_suite("DHE-DSS-AES128-GCM-SHA256") -> - ?TLS_DHE_DSS_WITH_AES_128_GCM_SHA256; -openssl_suite("DHE-DSS-AES256-GCM-SHA384") -> - ?TLS_DHE_DSS_WITH_AES_256_GCM_SHA384; -openssl_suite("DH-DSS-AES128-GCM-SHA256") -> - ?TLS_DH_DSS_WITH_AES_128_GCM_SHA256; -openssl_suite("DH-DSS-AES256-GCM-SHA384") -> - ?TLS_DH_DSS_WITH_AES_256_GCM_SHA384; - -%% RFC 5289 ECC AES-GCM Cipher Suites -openssl_suite("ECDHE-ECDSA-AES128-GCM-SHA256") -> - ?TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256; -openssl_suite("ECDHE-ECDSA-AES256-GCM-SHA384") -> - ?TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384; -openssl_suite("ECDH-ECDSA-AES128-GCM-SHA256") -> - ?TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256; -openssl_suite("ECDH-ECDSA-AES256-GCM-SHA384") -> - ?TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384; -openssl_suite("ECDHE-RSA-AES128-GCM-SHA256") -> - ?TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256; -openssl_suite("ECDHE-RSA-AES256-GCM-SHA384") -> - ?TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384; -openssl_suite("ECDH-RSA-AES128-GCM-SHA256") -> - ?TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256; -openssl_suite("ECDH-RSA-AES256-GCM-SHA384") -> - ?TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384. + ?TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384. %%-------------------------------------------------------------------- -spec openssl_suite_name(cipher_suite()) -> openssl_cipher_suite(). @@ -1300,46 +1012,6 @@ openssl_suite_name(?TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384) -> "ECDH-RSA-AES256-SHA384"; -%% RFC 5288 AES-GCM Cipher Suites -openssl_suite_name(?TLS_RSA_WITH_AES_128_GCM_SHA256) -> - "AES128-GCM-SHA256"; -openssl_suite_name(?TLS_RSA_WITH_AES_256_GCM_SHA384) -> - "AES256-GCM-SHA384"; -openssl_suite_name(?TLS_DHE_RSA_WITH_AES_128_GCM_SHA256) -> - "DHE-RSA-AES128-GCM-SHA256"; -openssl_suite_name(?TLS_DHE_RSA_WITH_AES_256_GCM_SHA384) -> - "DHE-RSA-AES256-GCM-SHA384"; -openssl_suite_name(?TLS_DH_RSA_WITH_AES_128_GCM_SHA256) -> - "DH-RSA-AES128-GCM-SHA256"; -openssl_suite_name(?TLS_DH_RSA_WITH_AES_256_GCM_SHA384) -> - "DH-RSA-AES256-GCM-SHA384"; -openssl_suite_name(?TLS_DHE_DSS_WITH_AES_128_GCM_SHA256) -> - "DHE-DSS-AES128-GCM-SHA256"; -openssl_suite_name(?TLS_DHE_DSS_WITH_AES_256_GCM_SHA384) -> - "DHE-DSS-AES256-GCM-SHA384"; -openssl_suite_name(?TLS_DH_DSS_WITH_AES_128_GCM_SHA256) -> - "DH-DSS-AES128-GCM-SHA256"; -openssl_suite_name(?TLS_DH_DSS_WITH_AES_256_GCM_SHA384) -> - "DH-DSS-AES256-GCM-SHA384"; - -%% RFC 5289 ECC AES-GCM Cipher Suites -openssl_suite_name(?TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) -> - "ECDHE-ECDSA-AES128-GCM-SHA256"; -openssl_suite_name(?TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384) -> - "ECDHE-ECDSA-AES256-GCM-SHA384"; -openssl_suite_name(?TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256) -> - "ECDH-ECDSA-AES128-GCM-SHA256"; -openssl_suite_name(?TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384) -> - "ECDH-ECDSA-AES256-GCM-SHA384"; -openssl_suite_name(?TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) -> - "ECDHE-RSA-AES128-GCM-SHA256"; -openssl_suite_name(?TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) -> - "ECDHE-RSA-AES256-GCM-SHA384"; -openssl_suite_name(?TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256) -> - "ECDH-RSA-AES128-GCM-SHA256"; -openssl_suite_name(?TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384) -> - "ECDH-RSA-AES256-GCM-SHA384"; - %% No oppenssl name openssl_suite_name(Cipher) -> suite_definition(Cipher). @@ -1423,13 +1095,6 @@ is_acceptable_keyexchange(_, _) -> true. -is_acceptable_cipher(Cipher, Algos) - when Cipher == aes_128_gcm; - Cipher == aes_256_gcm -> - proplists:get_bool(aes_gcm, Algos); -is_acceptable_cipher(Cipher, Algos) - when Cipher == chacha20_poly1305 -> - proplists:get_bool(Cipher, Algos); is_acceptable_cipher(_, _) -> true. @@ -1443,9 +1108,6 @@ is_acceptable_prf(Prf, Algos) -> proplists:get_bool(Prf, Algos). -is_fallback(CipherSuites)-> - lists:member(?TLS_FALLBACK_SCSV, CipherSuites). - %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- @@ -1460,12 +1122,7 @@ ?'3DES'; bulk_cipher_algorithm(Cipher) when Cipher == aes_128_cbc; Cipher == aes_256_cbc -> - ?AES_CBC; -bulk_cipher_algorithm(Cipher) when Cipher == aes_128_gcm; - Cipher == aes_256_gcm -> - ?AES_GCM; -bulk_cipher_algorithm(chacha20_poly1305) -> - ?CHACHA20_POLY1305. + ?AES. type(Cipher) when Cipher == null; Cipher == rc4_128 -> @@ -1475,11 +1132,7 @@ Cipher == '3des_ede_cbc'; Cipher == aes_128_cbc; Cipher == aes_256_cbc -> - ?BLOCK; -type(Cipher) when Cipher == aes_128_gcm; - Cipher == aes_256_gcm; - Cipher == chacha20_poly1305 -> - ?AEAD. + ?BLOCK. key_material(null) -> 0; @@ -1492,12 +1145,6 @@ key_material(aes_128_cbc) -> 16; key_material(aes_256_cbc) -> - 32; -key_material(aes_128_gcm) -> - 16; -key_material(aes_256_gcm) -> - 32; -key_material(chacha20_poly1305) -> 32. expanded_key_material(null) -> @@ -1509,10 +1156,7 @@ expanded_key_material('3des_ede_cbc') -> 24; expanded_key_material(Cipher) when Cipher == aes_128_cbc; - Cipher == aes_256_cbc; - Cipher == aes_128_gcm; - Cipher == aes_256_gcm; - Cipher == chacha20_poly1305 -> + Cipher == aes_256_cbc -> unknown. @@ -1521,25 +1165,16 @@ effective_key_bits(des_cbc) -> 56; effective_key_bits(Cipher) when Cipher == rc4_128; - Cipher == aes_128_cbc; - Cipher == aes_128_gcm -> + Cipher == aes_128_cbc -> 128; effective_key_bits('3des_ede_cbc') -> 168; -effective_key_bits(Cipher) when Cipher == aes_256_cbc; - Cipher == aes_256_gcm; - Cipher == chacha20_poly1305 -> +effective_key_bits(aes_256_cbc) -> 256. iv_size(Cipher) when Cipher == null; - Cipher == rc4_128; - Cipher == chacha20_poly1305-> + Cipher == rc4_128 -> 0; - -iv_size(Cipher) when Cipher == aes_128_gcm; - Cipher == aes_256_gcm -> - 4; - iv_size(Cipher) -> block_size(Cipher). @@ -1548,10 +1183,7 @@ 8; block_size(Cipher) when Cipher == aes_128_cbc; - Cipher == aes_256_cbc; - Cipher == aes_128_gcm; - Cipher == aes_256_gcm; - Cipher == chacha20_poly1305 -> + Cipher == aes_256_cbc -> 16. prf_algorithm(default_prf, {3, N}) when N >= 3 -> @@ -1574,9 +1206,7 @@ hash_algorithm(?SHA224) -> sha224; hash_algorithm(?SHA256) -> sha256; hash_algorithm(?SHA384) -> sha384; -hash_algorithm(?SHA512) -> sha512; -hash_algorithm(Other) when is_integer(Other) andalso ((Other >= 7) and (Other =< 223)) -> unassigned; -hash_algorithm(Other) when is_integer(Other) andalso ((Other >= 224) and (Other =< 255)) -> Other. +hash_algorithm(?SHA512) -> sha512. sign_algorithm(anon) -> ?ANON; sign_algorithm(rsa) -> ?RSA; @@ -1585,9 +1215,7 @@ sign_algorithm(?ANON) -> anon; sign_algorithm(?RSA) -> rsa; sign_algorithm(?DSA) -> dsa; -sign_algorithm(?ECDSA) -> ecdsa; -sign_algorithm(Other) when is_integer(Other) andalso ((Other >= 4) and (Other =< 223)) -> unassigned; -sign_algorithm(Other) when is_integer(Other) andalso ((Other >= 224) and (Other =< 255)) -> Other. +sign_algorithm(?ECDSA) -> ecdsa. hash_size(null) -> 0; @@ -1660,18 +1288,16 @@ #generic_stream_cipher{content=Content, mac=Mac}. +%% For interoperability reasons we do not check the padding content in +%% SSL 3.0 and TLS 1.0 as it is not strictly required and breaks +%% interopability with for instance Google. is_correct_padding(#generic_block_cipher{padding_length = Len, - padding = Padding}, {3, 0}, _) -> - Len == byte_size(Padding); %% Only length check is done in SSL 3.0 spec -%% For interoperability reasons it is possible to disable -%% the padding check when using TLS 1.0, as it is not strictly required -%% in the spec (only recommended), howerver this makes TLS 1.0 vunrable to the Poodle attack -%% so by default this clause will not match -is_correct_padding(GenBlockCipher, {3, 1}, false) -> - is_correct_padding(GenBlockCipher, {3, 0}, false); -%% Padding must be checked in TLS 1.1 and after + padding = Padding}, {3, N}) + when N == 0; N == 1 -> + Len == byte_size(Padding); +%% Padding must be check in TLS 1.1 and after is_correct_padding(#generic_block_cipher{padding_length = Len, - padding = Padding}, _, _) -> + padding = Padding}, _) -> Len == byte_size(Padding) andalso list_to_binary(lists:duplicate(Len, Len)) == Padding. @@ -1711,15 +1337,10 @@ ?TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, ?TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, ?TLS_DHE_RSA_WITH_AES_128_CBC_SHA, - ?TLS_DHE_RSA_WITH_DES_CBC_SHA, - ?TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, - ?TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, - ?TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256]. + ?TLS_DHE_RSA_WITH_DES_CBC_SHA]. psk_rsa_suites() -> - [?TLS_RSA_PSK_WITH_AES_256_GCM_SHA384, - ?TLS_RSA_PSK_WITH_AES_128_GCM_SHA256, - ?TLS_RSA_PSK_WITH_AES_256_CBC_SHA384, + [?TLS_RSA_PSK_WITH_AES_256_CBC_SHA384, ?TLS_RSA_PSK_WITH_AES_128_CBC_SHA256, ?TLS_RSA_PSK_WITH_AES_256_CBC_SHA, ?TLS_RSA_PSK_WITH_AES_128_CBC_SHA, @@ -1739,9 +1360,7 @@ ?TLS_RSA_WITH_AES_128_CBC_SHA, ?TLS_RSA_WITH_RC4_128_SHA, ?TLS_RSA_WITH_RC4_128_MD5, - ?TLS_RSA_WITH_DES_CBC_SHA, - ?TLS_RSA_WITH_AES_128_GCM_SHA256, - ?TLS_RSA_WITH_AES_256_GCM_SHA384]. + ?TLS_RSA_WITH_DES_CBC_SHA]. ecdh_rsa_suites() -> [?TLS_ECDH_RSA_WITH_NULL_SHA, @@ -1750,9 +1369,7 @@ ?TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, ?TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, ?TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, - ?TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, - ?TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, - ?TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384]. + ?TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384]. ecdhe_rsa_suites() -> [?TLS_ECDHE_RSA_WITH_NULL_SHA, @@ -1761,10 +1378,7 @@ ?TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, ?TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, ?TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, - ?TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, - ?TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, - ?TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, - ?TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256]. + ?TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384]. dsa_signed_suites() -> dhe_dss_suites() ++ srp_dss_suites(). @@ -1775,9 +1389,7 @@ ?TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, ?TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, ?TLS_DHE_DSS_WITH_AES_128_CBC_SHA, - ?TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, - ?TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, - ?TLS_DHE_DSS_WITH_AES_256_GCM_SHA384]. + ?TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA]. srp_dss_suites() -> [?TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA, @@ -1801,9 +1413,7 @@ ?TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, ?TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, ?TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, - ?TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, - ?TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, - ?TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384]. + ?TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384]. ecdhe_ecdsa_suites() -> [?TLS_ECDHE_ECDSA_WITH_NULL_SHA, @@ -1812,10 +1422,7 @@ ?TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, ?TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, ?TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, - ?TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, - ?TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, - ?TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, - ?TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256]. + ?TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384]. filter_keyuse(OtpCert, Ciphers, Suites, SignSuites) -> TBSCert = OtpCert#'OTPCertificate'.tbsCertificate, diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_cipher.hrl erlang-17.3-dfsg/lib/ssl/src/ssl_cipher.hrl --- erlang-18.2-dfsg/lib/ssl/src/ssl_cipher.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_cipher.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -47,8 +46,7 @@ -record(cipher_state, { iv, key, - state, - nonce + state }). %%% TLS_NULL_WITH_NULL_NULL is specified and is the initial state of a @@ -357,10 +355,6 @@ %% hello extension data as they should. -define(TLS_EMPTY_RENEGOTIATION_INFO_SCSV, <>). -%% TLS Fallback Signaling Cipher Suite Value (SCSV) for Preventing Protocol -%% Downgrade Attacks --define(TLS_FALLBACK_SCSV, <>). - %%% PSK Cipher Suites RFC 4279 %% TLS_PSK_WITH_RC4_128_SHA = { 0x00, 0x8A }; @@ -401,24 +395,6 @@ %%% TLS 1.2 PSK Cipher Suites RFC 5487 -%% TLS_PSK_WITH_AES_128_GCM_SHA256 = {0x00,0xA8}; --define(TLS_PSK_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_PSK_WITH_AES_256_GCM_SHA384 = {0x00,0xA9}; --define(TLS_PSK_WITH_AES_256_GCM_SHA384, <>). - -%% TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 = {0x00,0xAA}; --define(TLS_DHE_PSK_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 = {0x00,0xAB}; --define(TLS_DHE_PSK_WITH_AES_256_GCM_SHA384, <>). - -%% TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 = {0x00,0xAC}; --define(TLS_RSA_PSK_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 = {0x00,0xAD}; --define(TLS_RSA_PSK_WITH_AES_256_GCM_SHA384, <>). - %% TLS_PSK_WITH_AES_128_CBC_SHA256 = {0x00,0xAE}; -define(TLS_PSK_WITH_AES_128_CBC_SHA256, <>). @@ -484,79 +460,4 @@ %% TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA = { 0xC0,0x22 }; -define(TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA, <>). -%%% AES-GCM Cipher Suites RFC 5288 - -%% TLS_RSA_WITH_AES_128_GCM_SHA256 = {0x00,0x9C} --define(TLS_RSA_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_RSA_WITH_AES_256_GCM_SHA384 = {0x00,0x9D} --define(TLS_RSA_WITH_AES_256_GCM_SHA384, <>). - -%% TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 = {0x00,0x9E} --define(TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 = {0x00,0x9F} --define(TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, <>). - -%% TLS_DH_RSA_WITH_AES_128_GCM_SHA256 = {0x00,0xA0} --define(TLS_DH_RSA_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_DH_RSA_WITH_AES_256_GCM_SHA384 = {0x00,0xA1} --define(TLS_DH_RSA_WITH_AES_256_GCM_SHA384, <>). - -%% TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 = {0x00,0xA2} --define(TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 = {0x00,0xA3} --define(TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, <>). - -%% TLS_DH_DSS_WITH_AES_128_GCM_SHA256 = {0x00,0xA4} --define(TLS_DH_DSS_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_DH_DSS_WITH_AES_256_GCM_SHA384 = {0x00,0xA5} --define(TLS_DH_DSS_WITH_AES_256_GCM_SHA384, <>). - -%% TLS_DH_anon_WITH_AES_128_GCM_SHA256 = {0x00,0xA6} --define(TLS_DH_anon_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_DH_anon_WITH_AES_256_GCM_SHA384 = {0x00,0xA7} --define(TLS_DH_anon_WITH_AES_256_GCM_SHA384, <>). - -%%% ECC AES-GCM Cipher Suites RFC 5289 - -%% TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = {0xC0,0x2B}; --define(TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = {0xC0,0x2C}; --define(TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, <>). - -%% TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 = {0xC0,0x2D}; --define(TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 = {0xC0,0x2E}; --define(TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, <>). - -%% TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = {0xC0,0x2F}; --define(TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = {0xC0,0x30}; --define(TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, <>). - -%% TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 = {0xC0,0x31}; --define(TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, <>). - -%% TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 = {0xC0,0x32}; --define(TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, <>). - -%%% Chacha20/Poly1305 Suites draft-agl-tls-chacha20poly1305-04 - -%% TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = {0xcc, 0x13} --define(TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, <>). - -%% TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = {0xcc, 0x14} --define(TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, <>). - -%% TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = {0xcc, 0x15} --define(TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, <>). - -endif. % -ifdef(ssl_cipher). diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_config.erl erlang-17.3-dfsg/lib/ssl/src/ssl_config.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_config.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_config.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -32,13 +31,13 @@ init_manager_name(SslOpts#ssl_options.erl_dist), - {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, CRLDbHandle, OwnCert} + {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, OwnCert} = init_certificates(SslOpts, Role), PrivateKey = init_private_key(PemCacheHandle, SslOpts#ssl_options.key, SslOpts#ssl_options.keyfile, SslOpts#ssl_options.password, Role), DHParams = init_diffie_hellman(PemCacheHandle, SslOpts#ssl_options.dh, SslOpts#ssl_options.dhfile, Role), - {ok, CertDbRef, CertDbHandle, FileRefHandle, CacheHandle, CRLDbHandle, OwnCert, PrivateKey, DHParams}. + {ok, CertDbRef, CertDbHandle, FileRefHandle, CacheHandle, OwnCert, PrivateKey, DHParams}. init_manager_name(false) -> put(ssl_manager, ssl_manager:manager_name(normal)); @@ -47,11 +46,9 @@ init_certificates(#ssl_options{cacerts = CaCerts, cacertfile = CACertFile, - certfile = CertFile, - cert = Cert, - crl_cache = CRLCache - }, Role) -> - {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, CRLDbInfo} = + certfile = CertFile, + cert = Cert}, Role) -> + {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle} = try Certs = case CaCerts of undefined -> @@ -59,40 +56,39 @@ _ -> {der, CaCerts} end, - {ok, _, _, _, _, _, _} = ssl_manager:connection_init(Certs, Role, CRLCache) + {ok, _, _, _, _, _} = ssl_manager:connection_init(Certs, Role) catch _:Reason -> file_error(CACertFile, {cacertfile, Reason}) end, init_certificates(Cert, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, - CacheHandle, CRLDbInfo, CertFile, Role). + CacheHandle, CertFile, Role). -init_certificates(undefined, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, - CRLDbInfo, <<>>, _) -> - {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, CRLDbInfo, undefined}; +init_certificates(undefined, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, <<>>, _) -> + {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, undefined}; init_certificates(undefined, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, - CacheHandle, CRLDbInfo, CertFile, client) -> + CacheHandle, CertFile, client) -> try %% Ignoring potential proxy-certificates see: %% http://dev.globus.org/wiki/Security/ProxyFileFormat [OwnCert|_] = ssl_certificate:file_to_certificats(CertFile, PemCacheHandle), - {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, CRLDbInfo, OwnCert} + {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, OwnCert} catch _Error:_Reason -> - {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, CRLDbInfo, undefined} + {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, undefined} end; init_certificates(undefined, CertDbRef, CertDbHandle, FileRefHandle, - PemCacheHandle, CacheRef, CRLDbInfo, CertFile, server) -> + PemCacheHandle, CacheRef, CertFile, server) -> try [OwnCert|_] = ssl_certificate:file_to_certificats(CertFile, PemCacheHandle), - {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheRef, CRLDbInfo, OwnCert} + {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheRef, OwnCert} catch _:Reason -> file_error(CertFile, {certfile, Reason}) end; -init_certificates(Cert, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheRef, CRLDbInfo, _, _) -> - {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheRef, CRLDbInfo, Cert}. +init_certificates(Cert, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheRef, _, _) -> + {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheRef, Cert}. init_private_key(_, undefined, <<>>, _Password, _Client) -> undefined; diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_connection.erl erlang-17.3-dfsg/lib/ssl/src/ssl_connection.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_connection.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_connection.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -41,13 +40,12 @@ socket_control/4, socket_control/5]). %% User Events --export([send/2, recv/3, close/2, shutdown/2, - new_user/2, get_opts/2, set_opts/2, session_info/1, - peer_certificate/1, renegotiation/1, negotiated_protocol/1, prf/5, - connection_information/1 +-export([send/2, recv/3, close/1, shutdown/2, + new_user/2, get_opts/2, set_opts/2, info/1, session_info/1, + peer_certificate/1, renegotiation/1, negotiated_next_protocol/1, prf/5 ]). --export([handle_session/7]). +-export([handle_session/6]). %% SSL FSM state functions -export([hello/3, abbreviated/3, certify/3, cipher/3, connection/3]). @@ -163,27 +161,18 @@ sync_send_all_state_event(Pid, {recv, Length, Timeout}). %%-------------------------------------------------------------------- --spec connection_information(pid()) -> {ok, list()} | {error, reason()}. -%% -%% Description: Get the SNI hostname -%%-------------------------------------------------------------------- -connection_information(Pid) when is_pid(Pid) -> - sync_send_all_state_event(Pid, connection_information). - -%%-------------------------------------------------------------------- --spec close(pid(), {close, Timeout::integer() | - {NewController::pid(), Timeout::integer()}}) -> - ok | {ok, port()} | {error, reason()}. +-spec close(pid()) -> ok | {error, reason()}. %% %% Description: Close an ssl connection %%-------------------------------------------------------------------- -close(ConnectionPid, How) -> - case sync_send_all_state_event(ConnectionPid, How) of +close(ConnectionPid) -> + case sync_send_all_state_event(ConnectionPid, close) of {error, closed} -> ok; Other -> Other end. + %%-------------------------------------------------------------------- -spec shutdown(pid(), atom()) -> ok | {error, reason()}. %% @@ -202,12 +191,12 @@ sync_send_all_state_event(ConnectionPid, {new_user, User}). %%-------------------------------------------------------------------- --spec negotiated_protocol(pid()) -> {ok, binary()} | {error, reason()}. +-spec negotiated_next_protocol(pid()) -> {ok, binary()} | {error, reason()}. %% %% Description: Returns the negotiated protocol %%-------------------------------------------------------------------- -negotiated_protocol(ConnectionPid) -> - sync_send_all_state_event(ConnectionPid, negotiated_protocol). +negotiated_next_protocol(ConnectionPid) -> + sync_send_all_state_event(ConnectionPid, negotiated_next_protocol). %%-------------------------------------------------------------------- -spec get_opts(pid(), list()) -> {ok, list()} | {error, reason()}. @@ -225,6 +214,14 @@ sync_send_all_state_event(ConnectionPid, {set_opts, Options}). %%-------------------------------------------------------------------- +-spec info(pid()) -> {ok, {atom(), tuple()}} | {error, reason()}. +%% +%% Description: Returns ssl protocol and cipher used for the connection +%%-------------------------------------------------------------------- +info(ConnectionPid) -> + sync_send_all_state_event(ConnectionPid, info). + +%%-------------------------------------------------------------------- -spec session_info(pid()) -> {ok, list()} | {error, reason()}. %% %% Description: Returns info about the ssl session @@ -261,26 +258,27 @@ handle_session(#server_hello{cipher_suite = CipherSuite, compression_method = Compression}, - Version, NewId, ConnectionStates, ProtoExt, Protocol0, + Version, NewId, ConnectionStates, NextProtocol, #state{session = #session{session_id = OldId}, - negotiated_version = ReqVersion, - negotiated_protocol = CurrentProtocol} = State0) -> + negotiated_version = ReqVersion} = State0) -> {KeyAlgorithm, _, _, _} = ssl_cipher:suite_definition(CipherSuite), PremasterSecret = make_premaster_secret(ReqVersion, KeyAlgorithm), - - {ExpectNPN, Protocol} = case Protocol0 of - undefined -> {false, CurrentProtocol}; - _ -> {ProtoExt =:= npn, Protocol0} - end, - + + NewNextProtocol = case NextProtocol of + undefined -> + State0#state.next_protocol; + _ -> + NextProtocol + end, + State = State0#state{key_algorithm = KeyAlgorithm, negotiated_version = Version, connection_states = ConnectionStates, premaster_secret = PremasterSecret, - expecting_next_protocol_negotiation = ExpectNPN, - negotiated_protocol = Protocol}, + expecting_next_protocol_negotiation = NextProtocol =/= undefined, + next_protocol = NewNextProtocol}, case ssl_session:is_new(OldId, NewId) of true -> @@ -373,7 +371,7 @@ abbreviated(#next_protocol{selected_protocol = SelectedProtocol}, #state{role = server, expecting_next_protocol_negotiation = true} = State0, Connection) -> - {Record, State} = Connection:next_record(State0#state{negotiated_protocol = SelectedProtocol}), + {Record, State} = Connection:next_record(State0#state{next_protocol = SelectedProtocol}), Connection:next_state(abbreviated, abbreviated, Record, State#state{expecting_next_protocol_negotiation = false}); abbreviated(timeout, State, _) -> @@ -413,15 +411,11 @@ role = Role, cert_db = CertDbHandle, cert_db_ref = CertDbRef, - crl_db = CRLDbInfo, ssl_options = Opts} = State, Connection) -> - case ssl_handshake:certify(Cert, CertDbHandle, CertDbRef, - Opts#ssl_options.depth, + case ssl_handshake:certify(Cert, CertDbHandle, CertDbRef, Opts#ssl_options.depth, Opts#ssl_options.verify, Opts#ssl_options.verify_fun, Opts#ssl_options.partial_chain, - Opts#ssl_options.crl_check, - CRLDbInfo, Role) of {PeerCert, PublicKeyInfo} -> handle_peer_cert(Role, PeerCert, PublicKeyInfo, @@ -595,7 +589,7 @@ %% client must send a next protocol message if we are expecting it cipher(#finished{}, #state{role = server, expecting_next_protocol_negotiation = true, - negotiated_protocol = undefined, negotiated_version = Version} = State0, + next_protocol = undefined, negotiated_version = Version} = State0, Connection) -> Connection:handle_own_alert(?ALERT_REC(?FATAL,?UNEXPECTED_MESSAGE), Version, cipher, State0); @@ -625,7 +619,7 @@ cipher(#next_protocol{selected_protocol = SelectedProtocol}, #state{role = server, expecting_next_protocol_negotiation = true, expecting_finished = true} = State0, Connection) -> - {Record, State} = Connection:next_record(State0#state{negotiated_protocol = SelectedProtocol}), + {Record, State} = Connection:next_record(State0#state{next_protocol = SelectedProtocol}), Connection:next_state(cipher, cipher, Record, State#state{expecting_next_protocol_negotiation = false}); cipher(timeout, State, _) -> @@ -707,12 +701,12 @@ {stop, normal, {error, Error}, State0} end; -handle_sync_event({close, _} = Close, _, StateName, #state{protocol_cb = Connection} = State) -> - %% Run terminate before returning so that the reuseaddr - %% inet-option and possible downgrade will work as intended. - Result = Connection:terminate(Close, StateName, State), - {stop, normal, Result, State#state{terminated = true}}; - +handle_sync_event(close, _, StateName, #state{protocol_cb = Connection} = State) -> + %% Run terminate before returning + %% so that the reuseaddr inet-option will work + %% as intended. + (catch Connection:terminate(user_close, StateName, State)), + {stop, normal, ok, State#state{terminated = true}}; handle_sync_event({shutdown, How0}, _, StateName, #state{transport_cb = Transport, negotiated_version = Version, @@ -761,10 +755,10 @@ socket_options = SockOpts} = State) -> OptsReply = get_socket_opts(Transport, Socket, OptTags, SockOpts, []), {reply, OptsReply, StateName, State, get_timeout(State)}; -handle_sync_event(negotiated_protocol, _From, StateName, #state{negotiated_protocol = undefined} = State) -> - {reply, {error, protocol_not_negotiated}, StateName, State, get_timeout(State)}; -handle_sync_event(negotiated_protocol, _From, StateName, #state{negotiated_protocol = SelectedProtocol} = State) -> - {reply, {ok, SelectedProtocol}, StateName, State, get_timeout(State)}; +handle_sync_event(negotiated_next_protocol, _From, StateName, #state{next_protocol = undefined} = State) -> + {reply, {error, next_protocol_not_negotiated}, StateName, State, get_timeout(State)}; +handle_sync_event(negotiated_next_protocol, _From, StateName, #state{next_protocol = NextProtocol} = State) -> + {reply, {ok, NextProtocol}, StateName, State, get_timeout(State)}; handle_sync_event({set_opts, Opts0}, _From, StateName0, #state{socket_options = Opts1, protocol_cb = Connection, @@ -832,6 +826,13 @@ error:Reason -> {error, Reason} end, {reply, Reply, StateName, State, get_timeout(State)}; +handle_sync_event(info, _, StateName, + #state{negotiated_version = Version, + session = #session{cipher_suite = Suite}} = State) -> + + AtomVersion = tls_record:protocol_version(Version), + {reply, {ok, {AtomVersion, ssl:suite_definition(Suite)}}, + StateName, State, get_timeout(State)}; handle_sync_event(session_info, _, StateName, #state{session = #session{session_id = Id, cipher_suite = Suite}} = State) -> @@ -841,10 +842,7 @@ handle_sync_event(peer_certificate, _, StateName, #state{session = #session{peer_certificate = Cert}} = State) -> - {reply, {ok, Cert}, StateName, State, get_timeout(State)}; -handle_sync_event(connection_information, _, StateName, #state{sni_hostname = SNIHostname, session = #session{cipher_suite = CipherSuite}, negotiated_version = Version} = State) -> - {reply, {ok, [{protocol, tls_record:protocol_version(Version)}, {cipher_suite, ssl:suite_definition(CipherSuite)}, {sni_hostname, SNIHostname}]}, StateName, State, get_timeout(State)}. - + {reply, {ok, Cert}, StateName, State, get_timeout(State)}. handle_info({ErrorTag, Socket, econnaborted}, StateName, #state{socket = Socket, transport_cb = Transport, @@ -902,79 +900,74 @@ %% we want to guarantee that Transport:close has been called %% when ssl:close/1 returns. ok; -terminate({shutdown, transport_closed} = Reason, - _StateName, #state{send_queue = SendQueue, protocol_cb = Connection, - socket = Socket, transport_cb = Transport, - renegotiation = Renegotiate} = State) -> +terminate({shutdown, transport_closed}, StateName, #state{send_queue = SendQueue, + renegotiation = Renegotiate} = State) -> + handle_unrecv_data(StateName, State), handle_trusted_certs_db(State), notify_senders(SendQueue), - notify_renegotiater(Renegotiate), - Connection:close(Reason, Socket, Transport, undefined, undefined); -terminate({shutdown, own_alert}, _StateName, #state{send_queue = SendQueue, protocol_cb = Connection, - socket = Socket, transport_cb = Transport, - renegotiation = Renegotiate} = State) -> + notify_renegotiater(Renegotiate); + +terminate({shutdown, own_alert}, _StateName, #state{send_queue = SendQueue, + renegotiation = Renegotiate} = State) -> handle_trusted_certs_db(State), notify_senders(SendQueue), - notify_renegotiater(Renegotiate), - case application:get_env(ssl, alert_timeout) of - {ok, Timeout} when is_integer(Timeout) -> - Connection:close({timeout, Timeout}, Socket, Transport, undefined, undefined); - _ -> - Connection:close({timeout, ?DEFAULT_TIMEOUT}, Socket, Transport, undefined, undefined) - end; + notify_renegotiater(Renegotiate); terminate(Reason, connection, #state{negotiated_version = Version, protocol_cb = Connection, - connection_states = ConnectionStates0, - ssl_options = #ssl_options{padding_check = Check}, + connection_states = ConnectionStates, transport_cb = Transport, socket = Socket, send_queue = SendQueue, renegotiation = Renegotiate} = State) -> handle_trusted_certs_db(State), notify_senders(SendQueue), notify_renegotiater(Renegotiate), - {BinAlert, ConnectionStates} = terminate_alert(Reason, Version, ConnectionStates0), + BinAlert = terminate_alert(Reason, Version, ConnectionStates), Transport:send(Socket, BinAlert), - Connection:close(Reason, Socket, Transport, ConnectionStates, Check); - -terminate(Reason, _StateName, #state{transport_cb = Transport, protocol_cb = Connection, + case Connection of + tls_connection -> + tls_connection:workaround_transport_delivery_problems(Socket, Transport); + _ -> + ok + end; +terminate(_Reason, _StateName, #state{transport_cb = Transport, socket = Socket, send_queue = SendQueue, renegotiation = Renegotiate} = State) -> handle_trusted_certs_db(State), notify_senders(SendQueue), notify_renegotiater(Renegotiate), - Connection:close(Reason, Socket, Transport, undefined, undefined). + Transport:close(Socket). format_status(normal, [_, State]) -> - [{data, [{"StateData", State}]}]; + [{data, [{"StateData", State}]}]; format_status(terminate, [_, State]) -> SslOptions = (State#state.ssl_options), - NewOptions = SslOptions#ssl_options{password = ?SECRET_PRINTOUT, - cert = ?SECRET_PRINTOUT, - cacerts = ?SECRET_PRINTOUT, - key = ?SECRET_PRINTOUT, - dh = ?SECRET_PRINTOUT, - psk_identity = ?SECRET_PRINTOUT, - srp_identity = ?SECRET_PRINTOUT}, - [{data, [{"StateData", State#state{connection_states = ?SECRET_PRINTOUT, - protocol_buffers = ?SECRET_PRINTOUT, - user_data_buffer = ?SECRET_PRINTOUT, - tls_handshake_history = ?SECRET_PRINTOUT, - session = ?SECRET_PRINTOUT, - private_key = ?SECRET_PRINTOUT, - diffie_hellman_params = ?SECRET_PRINTOUT, - diffie_hellman_keys = ?SECRET_PRINTOUT, - srp_params = ?SECRET_PRINTOUT, - srp_keys = ?SECRET_PRINTOUT, - premaster_secret = ?SECRET_PRINTOUT, + NewOptions = SslOptions#ssl_options{password = "***", + cert = "***", + cacerts = "***", + key = "***", + dh = "***", + psk_identity = "***", + srp_identity = "***"}, + [{data, [{"StateData", State#state{connection_states = "***", + protocol_buffers = "***", + user_data_buffer = "***", + tls_handshake_history = "***", + session = "***", + private_key = "***", + diffie_hellman_params = "***", + diffie_hellman_keys = "***", + srp_params = "***", + srp_keys = "***", + premaster_secret = "***", ssl_options = NewOptions }}]}]. %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- ssl_config(Opts, Role, State) -> - {ok, Ref, CertDbHandle, FileRefHandle, CacheHandle, CRLDbInfo, OwnCert, Key, DHParams} = + {ok, Ref, CertDbHandle, FileRefHandle, CacheHandle, OwnCert, Key, DHParams} = ssl_config:init(Opts, Role), Handshake = ssl_handshake:init_handshake_history(), - TimeStamp = erlang:monotonic_time(), + TimeStamp = calendar:datetime_to_gregorian_seconds({date(), time()}), Session = State#state.session, State#state{tls_handshake_history = Handshake, session = Session#session{own_certificate = OwnCert, @@ -982,7 +975,6 @@ file_ref_db = FileRefHandle, cert_db_ref = Ref, cert_db = CertDbHandle, - crl_db = CRLDbInfo, session_cache = CacheHandle, private_key = Key, diffie_hellman_params = DHParams, @@ -1487,11 +1479,11 @@ next_protocol(#state{role = server} = State, _) -> State; -next_protocol(#state{negotiated_protocol = undefined} = State, _) -> +next_protocol(#state{next_protocol = undefined} = State, _) -> State; next_protocol(#state{expecting_next_protocol_negotiation = false} = State, _) -> State; -next_protocol(#state{negotiated_protocol = NextProtocol} = State0, Connection) -> +next_protocol(#state{next_protocol = NextProtocol} = State0, Connection) -> NextProtocolMessage = ssl_handshake:next_protocol(NextProtocol), Connection:send_handshake(NextProtocolMessage, State0). @@ -1764,24 +1756,37 @@ get_timeout(#state{ssl_options=#ssl_options{hibernate_after = HibernateAfter}}) -> HibernateAfter. -terminate_alert(normal, Version, ConnectionStates) -> - ssl_alert:encode(?ALERT_REC(?WARNING, ?CLOSE_NOTIFY), - Version, ConnectionStates); -terminate_alert({Reason, _}, Version, ConnectionStates) when Reason == close; - Reason == shutdown -> - ssl_alert:encode(?ALERT_REC(?WARNING, ?CLOSE_NOTIFY), - Version, ConnectionStates); +terminate_alert(Reason, Version, ConnectionStates) when Reason == normal; + Reason == user_close -> + {BinAlert, _} = ssl_alert:encode(?ALERT_REC(?WARNING, ?CLOSE_NOTIFY), + Version, ConnectionStates), + BinAlert; +terminate_alert({shutdown, _}, Version, ConnectionStates) -> + {BinAlert, _} = ssl_alert:encode(?ALERT_REC(?WARNING, ?CLOSE_NOTIFY), + Version, ConnectionStates), + BinAlert; terminate_alert(_, Version, ConnectionStates) -> - ssl_alert:encode(?ALERT_REC(?FATAL, ?INTERNAL_ERROR), - Version, ConnectionStates). + {BinAlert, _} = ssl_alert:encode(?ALERT_REC(?FATAL, ?INTERNAL_ERROR), + Version, ConnectionStates), + BinAlert. + +handle_unrecv_data(StateName, #state{socket = Socket, transport_cb = Transport, + protocol_cb = Connection} = State) -> + ssl_socket:setopts(Transport, Socket, [{active, false}]), + case Transport:recv(Socket, 0, 0) of + {error, closed} -> + ok; + {ok, Data} -> + Connection:handle_close_alert(Data, StateName, State) + end. handle_trusted_certs_db(#state{ssl_options = #ssl_options{cacertfile = <<>>, cacerts = []}}) -> %% No trusted certs specified ok; handle_trusted_certs_db(#state{cert_db_ref = Ref, cert_db = CertDb, - ssl_options = #ssl_options{cacertfile = <<>>}}) when CertDb =/= undefined -> + ssl_options = #ssl_options{cacertfile = <<>>}}) -> %% Certs provided as DER directly can not be shared %% with other connections and it is safe to delete them when the connection ends. ssl_pkix_db:remove_trusted_certs(Ref, CertDb); diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_connection.hrl erlang-17.3-dfsg/lib/ssl/src/ssl_connection.hrl --- erlang-18.2-dfsg/lib/ssl/src/ssl_connection.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_connection.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,19 @@ + %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -46,31 +46,30 @@ socket :: port(), ssl_options :: #ssl_options{}, socket_options :: #socket_options{}, - connection_states :: #connection_states{} | secret_printout(), - protocol_buffers :: term() | secret_printout() , %% #protocol_buffers{} from tls_record.hrl or dtls_recor.hrl - tls_handshake_history :: ssl_handshake:ssl_handshake_history() | secret_printout(), + connection_states :: #connection_states{}, + protocol_buffers :: term(), %% #protocol_buffers{} from tls_record.hrl or dtls_recor.hrl + tls_handshake_history :: ssl_handshake:ssl_handshake_history(), cert_db :: reference(), - session :: #session{} | secret_printout(), + session :: #session{}, session_cache :: db_handle(), session_cache_cb :: atom(), - crl_db :: term(), negotiated_version :: ssl_record:ssl_version(), client_certificate_requested = false :: boolean(), key_algorithm :: ssl_cipher:key_algo(), hashsign_algorithm = {undefined, undefined}, cert_hashsign_algorithm, - public_key_info :: ssl_handshake:public_key_info(), - private_key :: public_key:private_key() | secret_printout(), - diffie_hellman_params:: #'DHParameter'{} | undefined | secret_printout(), - diffie_hellman_keys :: {PublicKey :: binary(), PrivateKey :: binary()} | #'ECPrivateKey'{} | undefined | secret_printout(), + public_key_info ::ssl_handshake:public_key_info(), + private_key ::public_key:private_key(), + diffie_hellman_params, % PKIX: #'DHParameter'{} relevant for server side + diffie_hellman_keys, % {PublicKey, PrivateKey} psk_identity :: binary(), % server psk identity hint - srp_params :: #srp_user{} | secret_printout(), - srp_keys ::{PublicKey :: binary(), PrivateKey :: binary()} | secret_printout(), - premaster_secret :: binary() | secret_printout() , + srp_params :: #srp_user{}, + srp_keys ::{PublicKey :: binary(), PrivateKey :: binary()}, + premaster_secret :: binary(), file_ref_db :: db_handle(), cert_db_ref :: certdb_ref(), bytes_to_read :: undefined | integer(), %% bytes to read in passive mode - user_data_buffer :: undefined | binary() | secret_printout(), + user_data_buffer :: undefined | binary(), renegotiation :: undefined | {boolean(), From::term() | internal | peer}, start_or_recv_from :: term(), timer :: undefined | reference(), % start_or_recive_timer @@ -79,10 +78,9 @@ allow_renegotiate = true ::boolean(), expecting_next_protocol_negotiation = false ::boolean(), expecting_finished = false ::boolean(), - negotiated_protocol = undefined :: undefined | binary(), + next_protocol = undefined :: undefined | binary(), client_ecc, % {Curves, PointFmt} - tracker :: pid(), %% Tracker process for listen socket - sni_hostname = undefined + tracker :: pid() %% Tracker process for listen socket }). -define(DEFAULT_DIFFIE_HELLMAN_PARAMS, diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_crl_cache_api.erl erlang-17.3-dfsg/lib/ssl/src/ssl_crl_cache_api.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_crl_cache_api.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_crl_cache_api.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% - --module(ssl_crl_cache_api). - --include_lib("public_key/include/public_key.hrl"). - --type db_handle() :: term(). - --callback lookup(#'DistributionPoint'{}, db_handle()) -> not_available | [public_key:der_encoded()]. --callback select(term(), db_handle()) -> [public_key:der_encoded()]. --callback fresh_crl(#'DistributionPoint'{}, public_key:der_encoded()) -> public_key:der_encoded(). diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_crl_cache.erl erlang-17.3-dfsg/lib/ssl/src/ssl_crl_cache.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_crl_cache.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_crl_cache.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,180 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% - -%---------------------------------------------------------------------- -%% Purpose: Simple default CRL cache -%%---------------------------------------------------------------------- - --module(ssl_crl_cache). - --include("ssl_internal.hrl"). --include_lib("public_key/include/public_key.hrl"). - --behaviour(ssl_crl_cache_api). - --export([lookup/2, select/2, fresh_crl/2]). --export([insert/1, insert/2, delete/1]). - -%%==================================================================== -%% Cache callback API -%%==================================================================== - -lookup(#'DistributionPoint'{distributionPoint = {fullName, Names}}, - CRLDbInfo) -> - get_crls(Names, CRLDbInfo); -lookup(_,_) -> - not_available. - -select(Issuer, {{_Cache, Mapping},_}) -> - case ssl_pkix_db:lookup(Issuer, Mapping) of - undefined -> - []; - CRLs -> - CRLs - end. - -fresh_crl(#'DistributionPoint'{distributionPoint = {fullName, Names}}, CRL) -> - case get_crls(Names, undefined) of - not_available -> - CRL; - [NewCRL] -> - NewCRL - end. - -%%==================================================================== -%% API -%%==================================================================== - -insert(CRLs) -> - insert(?NO_DIST_POINT, CRLs). - -insert(URI, {file, File}) when is_list(URI) -> - case file:read_file(File) of - {ok, PemBin} -> - PemEntries = public_key:pem_decode(PemBin), - CRLs = [ CRL || {'CertificateList', CRL, not_encrypted} - <- PemEntries], - do_insert(URI, CRLs); - Error -> - Error - end; -insert(URI, {der, CRLs}) -> - do_insert(URI, CRLs). - -delete({file, File}) -> - case file:read_file(File) of - {ok, PemBin} -> - PemEntries = public_key:pem_decode(PemBin), - CRLs = [ CRL || {'CertificateList', CRL, not_encrypted} - <- PemEntries], - ssl_manager:delete_crls({?NO_DIST_POINT, CRLs}); - Error -> - Error - end; -delete({der, CRLs}) -> - ssl_manager:delete_crls({?NO_DIST_POINT, CRLs}); - -delete(URI) -> - case http_uri:parse(URI) of - {ok, {http, _, _ , _, Path,_}} -> - ssl_manager:delete_crls(string:strip(Path, left, $/)); - _ -> - {error, {only_http_distribution_points_supported, URI}} - end. - -%%-------------------------------------------------------------------- -%%% Internal functions -%%-------------------------------------------------------------------- -do_insert(URI, CRLs) -> - case http_uri:parse(URI) of - {ok, {http, _, _ , _, Path,_}} -> - ssl_manager:insert_crls(string:strip(Path, left, $/), CRLs); - _ -> - {error, {only_http_distribution_points_supported, URI}} - end. - -get_crls([], _) -> - not_available; -get_crls([{uniformResourceIdentifier, "http"++_ = URL} | Rest], - CRLDbInfo) -> - case cache_lookup(URL, CRLDbInfo) of - [] -> - handle_http(URL, Rest, CRLDbInfo); - CRLs -> - CRLs - end; -get_crls([ _| Rest], CRLDbInfo) -> - %% unsupported CRL location - get_crls(Rest, CRLDbInfo). - -http_lookup(URL, Rest, CRLDbInfo, Timeout) -> - case application:ensure_started(inets) of - ok -> - http_get(URL, Rest, CRLDbInfo, Timeout); - _ -> - get_crls(Rest, CRLDbInfo) - end. - -http_get(URL, Rest, CRLDbInfo, Timeout) -> - case httpc:request(get, {URL, [{"connection", "close"}]}, - [{timeout, Timeout}], [{body_format, binary}]) of - {ok, {_Status, _Headers, Body}} -> - case Body of - <<"-----BEGIN", _/binary>> -> - Pem = public_key:pem_decode(Body), - lists:filtermap(fun({'CertificateList', - CRL, not_encrypted}) -> - {true, CRL}; - (_) -> - false - end, Pem); - _ -> - try public_key:der_decode('CertificateList', Body) of - _ -> - [Body] - catch - _:_ -> - get_crls(Rest, CRLDbInfo) - end - end; - {error, _Reason} -> - get_crls(Rest, CRLDbInfo) - end. - -cache_lookup(_, undefined) -> - []; -cache_lookup(URL, {{Cache, _}, _}) -> - {ok, {_, _, _ , _, Path,_}} = http_uri:parse(URL), - case ssl_pkix_db:lookup(string:strip(Path, left, $/), Cache) of - undefined -> - []; - CRLs -> - CRLs - end. - -handle_http(URI, Rest, {_, [{http, Timeout}]} = CRLDbInfo) -> - CRLs = http_lookup(URI, Rest, CRLDbInfo, Timeout), - %% Uncomment to improve performance, but need to - %% implement cache limit and or cleaning to prevent - %% DoS attack possibilities - %%insert(URI, {der, CRLs}), - CRLs; -handle_http(_, Rest, CRLDbInfo) -> - get_crls(Rest, CRLDbInfo). - diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_crl.erl erlang-17.3-dfsg/lib/ssl/src/ssl_crl.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_crl.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_crl.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% - -%---------------------------------------------------------------------- -%% Purpose: CRL handling -%%---------------------------------------------------------------------- - --module(ssl_crl). - --include("ssl_alert.hrl"). --include("ssl_internal.hrl"). --include_lib("public_key/include/public_key.hrl"). - --export([trusted_cert_and_path/3]). - -trusted_cert_and_path(CRL, {SerialNumber, Issuer},{Db, DbRef} = DbHandle) -> - case ssl_pkix_db:lookup_trusted_cert(Db, DbRef, SerialNumber, Issuer) of - undefined -> - trusted_cert_and_path(CRL, issuer_not_found, DbHandle); - {ok, {_, OtpCert}} -> - {ok, Root, Chain} = ssl_certificate:certificate_chain(OtpCert, Db, DbRef), - {ok, Root, lists:reverse(Chain)} - end; - -trusted_cert_and_path(CRL, issuer_not_found, {Db, DbRef} = DbHandle) -> - try find_issuer(CRL, DbHandle) of - OtpCert -> - {ok, Root, Chain} = ssl_certificate:certificate_chain(OtpCert, Db, DbRef), - {ok, Root, lists:reverse(Chain)} - catch - throw:_ -> - {error, issuer_not_found} - end. - -find_issuer(CRL, {Db,_}) -> - Issuer = public_key:pkix_normalize_name(public_key:pkix_crl_issuer(CRL)), - IsIssuerFun = - fun({_Key, {_Der,ErlCertCandidate}}, Acc) -> - verify_crl_issuer(CRL, ErlCertCandidate, Issuer, Acc); - (_, Acc) -> - Acc - end, - - try ssl_pkix_db:foldl(IsIssuerFun, issuer_not_found, Db) of - issuer_not_found -> - {error, issuer_not_found} - catch - {ok, IssuerCert} -> - IssuerCert - end. - - -verify_crl_issuer(CRL, ErlCertCandidate, Issuer, NotIssuer) -> - TBSCert = ErlCertCandidate#'OTPCertificate'.tbsCertificate, - case public_key:pkix_normalize_name(TBSCert#'OTPTBSCertificate'.subject) of - Issuer -> - case public_key:pkix_crl_verify(CRL, ErlCertCandidate) of - true -> - throw({ok, ErlCertCandidate}); - false -> - NotIssuer - end; - _ -> - NotIssuer - end. diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_dist_sup.erl erlang-17.3-dfsg/lib/ssl/src/ssl_dist_sup.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_dist_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_dist_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -70,7 +69,7 @@ Name = ssl_connection_dist, StartFunc = {tls_connection_sup, start_link_dist, []}, Restart = permanent, - Shutdown = infinity, + Shutdown = 4000, Modules = [tls_connection_sup], Type = supervisor, {Name, StartFunc, Restart, Shutdown, Type, Modules}. diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl.erl erlang-17.3-dfsg/lib/ssl/src/ssl.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -34,18 +33,14 @@ listen/2, transport_accept/1, transport_accept/2, ssl_accept/1, ssl_accept/2, ssl_accept/3, controlling_process/2, peername/1, peercert/1, sockname/1, - close/1, close/2, shutdown/2, recv/2, recv/3, send/2, getopts/2, setopts/2 + close/1, shutdown/2, recv/2, recv/3, send/2, getopts/2, setopts/2 ]). %% SSL/TLS protocol handling -export([cipher_suites/0, cipher_suites/1, suite_definition/1, connection_info/1, versions/0, session_info/1, format_error/1, - renegotiate/1, prf/5, negotiated_protocol/1, negotiated_next_protocol/1, - connection_information/1, connection_information/2]). + renegotiate/1, prf/5, negotiated_next_protocol/1]). %% Misc --export([random_bytes/1, handle_options/2]). - --deprecated({negotiated_next_protocol, 1, next_major_release}). --deprecated({connection_info, 1, next_major_release}). +-export([random_bytes/1]). -include("ssl_api.hrl"). -include("ssl_internal.hrl"). @@ -99,8 +94,7 @@ connect(Socket, SslOptions) when is_port(Socket) -> connect(Socket, SslOptions, infinity). -connect(Socket, SslOptions0, Timeout) when is_port(Socket), - (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) -> +connect(Socket, SslOptions0, Timeout) when is_port(Socket) -> {Transport,_,_,_} = proplists:get_value(cb_info, SslOptions0, {gen_tcp, tcp, tcp_closed, tcp_error}), EmulatedOptions = ssl_socket:emulated_options(), @@ -126,7 +120,7 @@ connect(Host, Port, Options) -> connect(Host, Port, Options, infinity). -connect(Host, Port, Options, Timeout) when (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) -> +connect(Host, Port, Options, Timeout) -> try handle_options(Options) of {ok, Config} -> do_connect(Host,Port,Config,Timeout) @@ -176,7 +170,7 @@ #config{transport_info = {Transport,_,_, _} =CbInfo, connection_cb = ConnectionCb, ssl = SslOpts, - emulated = Tracker}}}, Timeout) when (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) -> + emulated = Tracker}}}, Timeout) -> case Transport:accept(ListenSocket, Timeout) of {ok, Socket} -> {ok, EmOpts} = ssl_socket:get_emulated_opts(Tracker), @@ -209,16 +203,15 @@ ssl_accept(ListenSocket) -> ssl_accept(ListenSocket, infinity). -ssl_accept(#sslsocket{} = Socket, Timeout) when (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) -> +ssl_accept(#sslsocket{} = Socket, Timeout) -> ssl_connection:handshake(Socket, Timeout); ssl_accept(ListenSocket, SslOptions) when is_port(ListenSocket) -> ssl_accept(ListenSocket, SslOptions, infinity). -ssl_accept(#sslsocket{} = Socket, [], Timeout) when (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity)-> +ssl_accept(#sslsocket{} = Socket, [], Timeout) -> ssl_accept(#sslsocket{} = Socket, Timeout); -ssl_accept(#sslsocket{fd = {_, _, _, Tracker}} = Socket, SslOpts0, Timeout) when - (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity)-> +ssl_accept(#sslsocket{fd = {_, _, _, Tracker}} = Socket, SslOpts0, Timeout) -> try {ok, EmOpts, InheritedSslOpts} = ssl_socket:get_all_opts(Tracker), SslOpts = handle_options(SslOpts0, InheritedSslOpts), @@ -226,8 +219,7 @@ catch Error = {error, _Reason} -> Error end; -ssl_accept(Socket, SslOptions, Timeout) when is_port(Socket), - (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) -> +ssl_accept(Socket, SslOptions, Timeout) when is_port(Socket) -> {Transport,_,_,_} = proplists:get_value(cb_info, SslOptions, {gen_tcp, tcp, tcp_closed, tcp_error}), EmulatedOptions = ssl_socket:emulated_options(), @@ -250,27 +242,11 @@ %% Description: Close an ssl connection %%-------------------------------------------------------------------- close(#sslsocket{pid = Pid}) when is_pid(Pid) -> - ssl_connection:close(Pid, {close, ?DEFAULT_TIMEOUT}); + ssl_connection:close(Pid); close(#sslsocket{pid = {ListenSocket, #config{transport_info={Transport,_, _, _}}}}) -> Transport:close(ListenSocket). %%-------------------------------------------------------------------- --spec close(#sslsocket{}, integer() | {pid(), integer()}) -> term(). -%% -%% Description: Close an ssl connection -%%-------------------------------------------------------------------- -close(#sslsocket{pid = TLSPid}, - {Pid, Timeout} = DownGrade) when is_pid(TLSPid), - is_pid(Pid), - (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) -> - ssl_connection:close(TLSPid, {close, DownGrade}); -close(#sslsocket{pid = TLSPid}, Timeout) when is_pid(TLSPid), - (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) -> - ssl_connection:close(TLSPid, {close, Timeout}); -close(#sslsocket{pid = {ListenSocket, #config{transport_info={Transport,_, _, _}}}}, _) -> - Transport:close(ListenSocket). - -%%-------------------------------------------------------------------- -spec send(#sslsocket{}, iodata()) -> ok | {error, reason()}. %% %% Description: Sends data over the ssl connection @@ -288,8 +264,7 @@ %%-------------------------------------------------------------------- recv(Socket, Length) -> recv(Socket, Length, infinity). -recv(#sslsocket{pid = Pid}, Length, Timeout) when is_pid(Pid), - (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity)-> +recv(#sslsocket{pid = Pid}, Length, Timeout) when is_pid(Pid) -> ssl_connection:recv(Pid, Length, Timeout); recv(#sslsocket{pid = {Listen, #config{transport_info = {Transport, _, _, _}}}}, _,_) when is_port(Listen)-> @@ -309,42 +284,16 @@ is_pid(NewOwner) -> Transport:controlling_process(Listen, NewOwner). - -%%-------------------------------------------------------------------- --spec connection_information(#sslsocket{}) -> {ok, list()} | {error, reason()}. -%% -%% Description: Return SSL information for the connection -%%-------------------------------------------------------------------- -connection_information(#sslsocket{pid = Pid}) when is_pid(Pid) -> ssl_connection:connection_information(Pid); -connection_information(#sslsocket{pid = {Listen, _}}) when is_port(Listen) -> {error, enotconn}. - - -%%-------------------------------------------------------------------- --spec connection_information(#sslsocket{}, [atom]) -> {ok, list()} | {error, reason()}. -%% -%% Description: Return SSL information for the connection -%%-------------------------------------------------------------------- -connection_information(#sslsocket{} = SSLSocket, Items) -> - case connection_information(SSLSocket) of - {ok, I} -> - {ok, lists:filter(fun({K, _}) -> lists:foldl(fun(K1, Acc) when K1 =:= K -> Acc + 1; (_, Acc) -> Acc end, 0, Items) > 0 end, I)}; - E -> - E - end. - %%-------------------------------------------------------------------- -spec connection_info(#sslsocket{}) -> {ok, {tls_record:tls_atom_version(), ssl_cipher:erl_cipher_suite()}} | {error, reason()}. %% %% Description: Returns ssl protocol and cipher used for the connection %%-------------------------------------------------------------------- -connection_info(#sslsocket{} = SSLSocket) -> - case connection_information(SSLSocket) of - {ok, Result} -> - {ok, {proplists:get_value(protocol, Result), proplists:get_value(cipher_suite, Result)}}; - Error -> - Error - end. +connection_info(#sslsocket{pid = Pid}) when is_pid(Pid) -> + ssl_connection:info(Pid); +connection_info(#sslsocket{pid = {Listen, _}}) when is_port(Listen) -> + {error, enotconn}. %%-------------------------------------------------------------------- -spec peername(#sslsocket{}) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, reason()}. @@ -381,27 +330,13 @@ {KeyExchange, Cipher, Hash}. %%-------------------------------------------------------------------- --spec negotiated_protocol(#sslsocket{}) -> {ok, binary()} | {error, reason()}. -%% -%% Description: Returns the protocol that has been negotiated. If no -%% protocol has been negotiated will return {error, protocol_not_negotiated} -%%-------------------------------------------------------------------- -negotiated_protocol(#sslsocket{pid = Pid}) -> - ssl_connection:negotiated_protocol(Pid). - -%%-------------------------------------------------------------------- -spec negotiated_next_protocol(#sslsocket{}) -> {ok, binary()} | {error, reason()}. %% %% Description: Returns the next protocol that has been negotiated. If no %% protocol has been negotiated will return {error, next_protocol_not_negotiated} %%-------------------------------------------------------------------- -negotiated_next_protocol(Socket) -> - case negotiated_protocol(Socket) of - {error, protocol_not_negotiated} -> - {error, next_protocol_not_negotiated}; - Res -> - Res - end. +negotiated_next_protocol(#sslsocket{pid = Pid}) -> + ssl_connection:negotiated_next_protocol(Pid). %%-------------------------------------------------------------------- -spec cipher_suites(erlang | openssl | all) -> [ssl_cipher:erl_cipher_suite()] | @@ -418,8 +353,12 @@ || S <- ssl_cipher:filter_suites(ssl_cipher:suites(Version))]; cipher_suites(all) -> Version = tls_record:highest_protocol_version([]), - ssl_cipher:filter_suites([suite_definition(S) - || S <-ssl_cipher:all_suites(Version)]). + Supported = ssl_cipher:all_suites(Version) + ++ ssl_cipher:anonymous_suites() + ++ ssl_cipher:psk_suites(Version) + ++ ssl_cipher:srp_suites(), + ssl_cipher:filter_suites([suite_definition(S) || S <- Supported]). + cipher_suites() -> cipher_suites(erlang). @@ -515,7 +454,7 @@ versions() -> Vsns = tls_record:supported_protocol_versions(), SupportedVsns = [tls_record:protocol_version(Vsn) || Vsn <- Vsns], - AvailableVsns = ?ALL_AVAILABLE_VERSIONS, + AvailableVsns = ?ALL_SUPPORTED_VERSIONS, %% TODO Add DTLS versions when supported [{ssl_app, ?VSN}, {supported, SupportedVsns}, {available, AvailableVsns}]. @@ -706,14 +645,9 @@ reuse_session = handle_option(reuse_session, Opts, ReuseSessionFun), reuse_sessions = handle_option(reuse_sessions, Opts, true), secure_renegotiate = handle_option(secure_renegotiate, Opts, false), - client_renegotiation = handle_option(client_renegotiation, Opts, true), renegotiate_at = handle_option(renegotiate_at, Opts, ?DEFAULT_RENEGOTIATE_AT), hibernate_after = handle_option(hibernate_after, Opts, undefined), erl_dist = handle_option(erl_dist, Opts, false), - alpn_advertised_protocols = - handle_option(alpn_advertised_protocols, Opts, undefined), - alpn_preferred_protocols = - handle_option(alpn_preferred_protocols, Opts, undefined), next_protocols_advertised = handle_option(next_protocols_advertised, Opts, undefined), next_protocol_selector = @@ -721,14 +655,8 @@ handle_option(client_preferred_next_protocols, Opts, undefined)), log_alert = handle_option(log_alert, Opts, true), server_name_indication = handle_option(server_name_indication, Opts, undefined), - sni_hosts = handle_option(sni_hosts, Opts, []), - sni_fun = handle_option(sni_fun, Opts, undefined), honor_cipher_order = handle_option(honor_cipher_order, Opts, false), - protocol = proplists:get_value(protocol, Opts, tls), - padding_check = proplists:get_value(padding_check, Opts, true), - fallback = proplists:get_value(fallback, Opts, false), - crl_check = handle_option(crl_check, Opts, false), - crl_cache = handle_option(crl_cache, Opts, {ssl_crl_cache, {internal, []}}) + protocol = proplists:get_value(protocol, Opts, tls) }, CbInfo = proplists:get_value(cb_info, Opts, {gen_tcp, tcp, tcp_closed, tcp_error}), @@ -737,13 +665,11 @@ depth, cert, certfile, key, keyfile, password, cacerts, cacertfile, dh, dhfile, user_lookup_fun, psk_identity, srp_identity, ciphers, - reuse_session, reuse_sessions, ssl_imp, client_renegotiation, + reuse_session, reuse_sessions, ssl_imp, cb_info, renegotiate_at, secure_renegotiate, hibernate_after, - erl_dist, alpn_advertised_protocols, sni_hosts, sni_fun, - alpn_preferred_protocols, next_protocols_advertised, + erl_dist, next_protocols_advertised, client_preferred_next_protocols, log_alert, - server_name_indication, honor_cipher_order, padding_check, crl_check, crl_cache, - fallback], + server_name_indication, honor_cipher_order], SockOpts = lists:foldl(fun(Key, PropList) -> proplists:delete(Key, PropList) @@ -756,18 +682,6 @@ inet_user = SockOpts, transport_info = CbInfo, connection_cb = ConnetionCb }}. -handle_option(sni_fun, Opts, Default) -> - OptFun = validate_option(sni_fun, - proplists:get_value(sni_fun, Opts, Default)), - OptHosts = proplists:get_value(sni_hosts, Opts, undefined), - case {OptFun, OptHosts} of - {Default, _} -> - Default; - {_, undefined} -> - OptFun; - _ -> - throw({error, {conflict_options, [sni_fun, sni_hosts]}}) - end; handle_option(OptionName, Opts, Default) -> validate_option(OptionName, proplists:get_value(OptionName, Opts, Default)). @@ -824,7 +738,6 @@ KeyType == dsa; %% Backwards compatibility KeyType == 'RSAPrivateKey'; KeyType == 'DSAPrivateKey'; - KeyType == 'ECPrivateKey'; KeyType == 'PrivateKeyInfo' -> {KeyType, Value}; @@ -880,8 +793,6 @@ validate_option(secure_renegotiate, Value) when is_boolean(Value) -> Value; -validate_option(client_renegotiation, Value) when is_boolean(Value) -> - Value; validate_option(renegotiate_at, Value) when is_integer(Value) -> erlang:min(Value, ?DEFAULT_RENEGOTIATE_AT); @@ -891,20 +802,6 @@ Value; validate_option(erl_dist,Value) when is_boolean(Value) -> Value; -validate_option(Opt, Value) - when Opt =:= alpn_advertised_protocols orelse Opt =:= alpn_preferred_protocols, - is_list(Value) -> - case tls_record:highest_protocol_version([]) of - {3,0} -> - throw({error, {options, {not_supported_in_sslv3, {Opt, Value}}}}); - _ -> - validate_binary_list(Opt, Value), - Value - end; -validate_option(Opt, Value) - when Opt =:= alpn_advertised_protocols orelse Opt =:= alpn_preferred_protocols, - Value =:= undefined -> - undefined; validate_option(client_preferred_next_protocols = Opt, {Precedence, PreferredProtocols} = Value) when is_list(PreferredProtocols) -> case tls_record:highest_protocol_version([]) of @@ -948,41 +845,11 @@ disable; validate_option(server_name_indication, undefined) -> undefined; -validate_option(sni_hosts, []) -> - []; -validate_option(sni_hosts, [{Hostname, SSLOptions} | Tail]) when is_list(Hostname) -> - RecursiveSNIOptions = proplists:get_value(sni_hosts, SSLOptions, undefined), - case RecursiveSNIOptions of - undefined -> - [{Hostname, validate_options(SSLOptions)} | validate_option(sni_hosts, Tail)]; - _ -> - throw({error, {options, {sni_hosts, RecursiveSNIOptions}}}) - end; -validate_option(sni_fun, undefined) -> - undefined; -validate_option(sni_fun, Fun) when is_function(Fun) -> - Fun; validate_option(honor_cipher_order, Value) when is_boolean(Value) -> Value; -validate_option(padding_check, Value) when is_boolean(Value) -> - Value; -validate_option(fallback, Value) when is_boolean(Value) -> - Value; -validate_option(crl_check, Value) when is_boolean(Value) -> - Value; -validate_option(crl_check, Value) when (Value == best_effort) or (Value == peer) -> - Value; -validate_option(crl_cache, {Cb, {_Handle, Options}} = Value) when is_atom(Cb) and is_list(Options) -> - Value; validate_option(Opt, Value) -> throw({error, {options, {Opt, Value}}}). - -validate_options([]) -> - []; -validate_options([{Opt, Value} | Tail]) -> - [{Opt, validate_option(Opt, Value)} | validate_options(Tail)]. - validate_npn_ordering(client) -> ok; validate_npn_ordering(server) -> @@ -1085,7 +952,10 @@ binary_cipher_suites(Version, Ciphers); binary_cipher_suites(Version, [Cipher0 | _] = Ciphers0) when is_binary(Cipher0) -> - All = ssl_cipher:all_suites(Version), + All = ssl_cipher:suites(Version) + ++ ssl_cipher:anonymous_suites() + ++ ssl_cipher:psk_suites(Version) + ++ ssl_cipher:srp_suites(), case [Cipher || Cipher <- Ciphers0, lists:member(Cipher, All)] of [] -> %% Defaults to all supported suites that does @@ -1190,8 +1060,6 @@ assert_proplist([{Key,_} | Rest]) when is_atom(Key) -> assert_proplist(Rest); %% Handle exceptions -assert_proplist([{raw,_,_,_} | Rest]) -> - assert_proplist(Rest); assert_proplist([inet | Rest]) -> assert_proplist(Rest); assert_proplist([inet6 | Rest]) -> @@ -1253,14 +1121,8 @@ new_ssl_options(Rest, Opts#ssl_options{ renegotiate_at = validate_option(renegotiate_at, Value)}, RecordCB); new_ssl_options([{secure_renegotiate, Value} | Rest], #ssl_options{} = Opts, RecordCB) -> new_ssl_options(Rest, Opts#ssl_options{secure_renegotiate = validate_option(secure_renegotiate, Value)}, RecordCB); -new_ssl_options([{client_renegotiation, Value} | Rest], #ssl_options{} = Opts, RecordCB) -> - new_ssl_options(Rest, Opts#ssl_options{client_renegotiation = validate_option(client_renegotiation, Value)}, RecordCB); new_ssl_options([{hibernate_after, Value} | Rest], #ssl_options{} = Opts, RecordCB) -> new_ssl_options(Rest, Opts#ssl_options{hibernate_after = validate_option(hibernate_after, Value)}, RecordCB); -new_ssl_options([{alpn_advertised_protocols, Value} | Rest], #ssl_options{} = Opts, RecordCB) -> - new_ssl_options(Rest, Opts#ssl_options{alpn_advertised_protocols = validate_option(alpn_advertised_protocols, Value)}, RecordCB); -new_ssl_options([{alpn_preferred_protocols, Value} | Rest], #ssl_options{} = Opts, RecordCB) -> - new_ssl_options(Rest, Opts#ssl_options{alpn_preferred_protocols = validate_option(alpn_preferred_protocols, Value)}, RecordCB); new_ssl_options([{next_protocols_advertised, Value} | Rest], #ssl_options{} = Opts, RecordCB) -> new_ssl_options(Rest, Opts#ssl_options{next_protocols_advertised = validate_option(next_protocols_advertised, Value)}, RecordCB); new_ssl_options([{client_preferred_next_protocols, Value} | Rest], #ssl_options{} = Opts, RecordCB) -> @@ -1320,4 +1182,3 @@ Value -> throw({error, {options, {verify, Value}}}) end. - diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_handshake.erl erlang-17.3-dfsg/lib/ssl/src/ssl_handshake.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_handshake.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_handshake.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -50,7 +49,7 @@ finished/5, next_protocol/1]). %% Handle handshake messages --export([certify/10, client_certificate_verify/6, certificate_verify/6, verify_signature/5, +-export([certify/8, client_certificate_verify/6, certificate_verify/6, verify_signature/5, master_secret/5, server_key_exchange_hash/2, verify_connection/6, init_handshake_history/0, update_handshake_history/2, verify_server_key/5 ]). @@ -137,7 +136,6 @@ hash_signs = advertised_hash_signs(Version), ec_point_formats = EcPointFormats, elliptic_curves = EllipticCurves, - alpn = encode_alpn(SslOpts#ssl_options.alpn_advertised_protocols, Renegotiation), next_protocol_negotiation = encode_client_protocol_negotiation(SslOpts#ssl_options.next_protocol_selector, Renegotiation), @@ -151,7 +149,7 @@ certificate(OwnCert, CertDbHandle, CertDbRef, client) -> Chain = case ssl_certificate:certificate_chain(OwnCert, CertDbHandle, CertDbRef) of - {ok, _, CertChain} -> + {ok, CertChain} -> CertChain; {error, _} -> %% If no suitable certificate is available, the client @@ -163,7 +161,7 @@ certificate(OwnCert, CertDbHandle, CertDbRef, server) -> case ssl_certificate:certificate_chain(OwnCert, CertDbHandle, CertDbRef) of - {ok, _, Chain} -> + {ok, Chain} -> #certificate{asn1_certificates = Chain}; {error, _} -> ?ALERT_REC(?FATAL, ?INTERNAL_ERROR) @@ -244,7 +242,7 @@ dh_public = PublicKey} }; -key_exchange(client, _Version, {ecdh, #'ECPrivateKey'{publicKey = ECPublicKey}}) -> +key_exchange(client, _Version, {ecdh, #'ECPrivateKey'{publicKey = {0, ECPublicKey}}}) -> #client_key_exchange{ exchange_keys = #client_ec_diffie_hellman_public{ dh_public = ECPublicKey} @@ -285,7 +283,7 @@ enc_server_key_exchange(Version, ServerDHParams, HashSign, ClientRandom, ServerRandom, PrivateKey); -key_exchange(server, Version, {ecdh, #'ECPrivateKey'{publicKey = ECPublicKey, +key_exchange(server, Version, {ecdh, #'ECPrivateKey'{publicKey = {0, ECPublicKey}, parameters = ECCurve}, HashSign, ClientRandom, ServerRandom, PrivateKey}) -> ServerECParams = #server_ecdh_params{curve = ECCurve, public = ECPublicKey}, @@ -385,24 +383,49 @@ %%-------------------------------------------------------------------- -spec certify(#certificate{}, db_handle(), certdb_ref(), integer() | nolimit, - verify_peer | verify_none, {fun(), term}, fun(), term(), term(), + verify_peer | verify_none, {fun(), term}, fun(), client | server) -> {der_cert(), public_key_info()} | #alert{}. %% %% Description: Handles a certificate handshake message %%-------------------------------------------------------------------- certify(#certificate{asn1_certificates = ASN1Certs}, CertDbHandle, CertDbRef, - MaxPathLen, _Verify, ValidationFunAndState0, PartialChain, CRLCheck, CRLDbHandle, Role) -> + MaxPathLen, _Verify, VerifyFunAndState, PartialChain, Role) -> [PeerCert | _] = ASN1Certs, - - ValidationFunAndState = validation_fun_and_state(ValidationFunAndState0, Role, - CertDbHandle, CertDbRef, CRLCheck, CRLDbHandle), + + ValidationFunAndState = + case VerifyFunAndState of + undefined -> + {fun(OtpCert, ExtensionOrVerifyResult, SslState) -> + ssl_certificate:validate_extension(OtpCert, + ExtensionOrVerifyResult, SslState) + end, Role}; + {Fun, UserState0} -> + {fun(OtpCert, {extension, _} = Extension, {SslState, UserState}) -> + case ssl_certificate:validate_extension(OtpCert, + Extension, + SslState) of + {valid, NewSslState} -> + {valid, {NewSslState, UserState}}; + {fail, Reason} -> + apply_user_fun(Fun, OtpCert, Reason, UserState, + SslState); + {unknown, _} -> + apply_user_fun(Fun, OtpCert, + Extension, UserState, SslState) + end; + (OtpCert, VerifyResult, {SslState, UserState}) -> + apply_user_fun(Fun, OtpCert, VerifyResult, UserState, + SslState) + end, {Role, UserState0}} + end, try - {TrustedCert, CertPath} = + {TrustedErlCert, CertPath} = ssl_certificate:trusted_cert_and_path(ASN1Certs, CertDbHandle, CertDbRef, PartialChain), - case public_key:pkix_path_validation(TrustedCert, - CertPath, - [{max_path_length, MaxPathLen}, + case public_key:pkix_path_validation(TrustedErlCert, + CertPath, + [{max_path_length, + MaxPathLen}, {verify_fun, ValidationFunAndState}]) of {ok, {PublicKeyInfo,_}} -> {PeerCert, PublicKeyInfo}; @@ -477,27 +500,19 @@ %% end. premaster_secret(OtherPublicDhKey, MyPrivateKey, #'DHParameter'{} = Params) -> - try - public_key:compute_key(OtherPublicDhKey, MyPrivateKey, Params) - catch - error:computation_failed -> - throw(?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER)) - end; + public_key:compute_key(OtherPublicDhKey, MyPrivateKey, Params); + premaster_secret(PublicDhKey, PrivateDhKey, #server_dh_params{dh_p = Prime, dh_g = Base}) -> - try - crypto:compute_key(dh, PublicDhKey, PrivateDhKey, [Prime, Base]) - catch - error:computation_failed -> - throw(?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER)) - end; + crypto:compute_key(dh, PublicDhKey, PrivateDhKey, [Prime, Base]); premaster_secret(#client_srp_public{srp_a = ClientPublicKey}, ServerKey, #srp_user{prime = Prime, verifier = Verifier}) -> case crypto:compute_key(srp, ClientPublicKey, ServerKey, {host, [Verifier, Prime, '6a']}) of error -> - throw(?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER)); + ?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER); PremasterSecret -> PremasterSecret end; + premaster_secret(#server_srp_params{srp_n = Prime, srp_g = Generator, srp_s = Salt, srp_b = Public}, ClientKeys, {Username, Password}) -> case ssl_srp_primes:check_srp_params(Generator, Prime) of @@ -505,19 +520,21 @@ DerivedKey = crypto:hash(sha, [Salt, crypto:hash(sha, [Username, <<$:>>, Password])]), case crypto:compute_key(srp, Public, ClientKeys, {user, [DerivedKey, Prime, Generator, '6a']}) of error -> - throw(?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER)); + ?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER); PremasterSecret -> PremasterSecret end; _ -> - throw(?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER)) + ?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER) end; + premaster_secret(#client_rsa_psk_identity{ identity = PSKIdentity, exchange_keys = #encrypted_premaster_secret{premaster_secret = EncPMS} }, #'RSAPrivateKey'{} = Key, PSKLookup) -> PremasterSecret = premaster_secret(EncPMS, Key), psk_secret(PSKIdentity, PSKLookup, PremasterSecret); + premaster_secret(#server_dhe_psk_params{ hint = IdentityHint, dh_params = #server_dh_params{dh_y = PublicDhKey} = Params}, @@ -525,6 +542,7 @@ LookupFun) -> PremasterSecret = premaster_secret(PublicDhKey, PrivateDhKey, Params), psk_secret(IdentityHint, LookupFun, PremasterSecret); + premaster_secret({rsa_psk, PSKIdentity}, PSKLookup, RSAPremasterSecret) -> psk_secret(PSKIdentity, PSKLookup, RSAPremasterSecret). @@ -533,10 +551,13 @@ dh_public = PublicDhKey}, PrivateKey, #'DHParameter'{} = Params, PSKLookup) -> PremasterSecret = premaster_secret(PublicDhKey, PrivateKey, Params), psk_secret(PSKIdentity, PSKLookup, PremasterSecret). + premaster_secret(#client_psk_identity{identity = PSKIdentity}, PSKLookup) -> psk_secret(PSKIdentity, PSKLookup); + premaster_secret({psk, PSKIdentity}, PSKLookup) -> psk_secret(PSKIdentity, PSKLookup); + premaster_secret(#'ECPoint'{} = ECPoint, #'ECPrivateKey'{} = ECDHKeys) -> public_key:compute_key(ECPoint, ECDHKeys); premaster_secret(EncSecret, #'RSAPrivateKey'{} = RSAPrivateKey) -> @@ -581,10 +602,11 @@ %%-------------------------------------------------------------------- select_hashsign(_, undefined, _Version) -> {null, anon}; -%% The signature_algorithms extension was introduced with TLS 1.2. Ignore it if we have -%% negotiated a lower version. -select_hashsign(#hash_sign_algos{hash_sign_algos = HashSigns}, Cert, {Major, Minor} = Version) - when Major >= 3 andalso Minor >= 3 -> +select_hashsign(undefined, Cert, Version) -> + #'OTPCertificate'{tbsCertificate = TBSCert} = public_key:pkix_decode_cert(Cert, otp), + #'OTPSubjectPublicKeyInfo'{algorithm = {_,Algo, _}} = TBSCert#'OTPTBSCertificate'.subjectPublicKeyInfo, + select_hashsign_algs(undefined, Algo, Version); +select_hashsign(#hash_sign_algos{hash_sign_algos = HashSigns}, Cert, Version) -> #'OTPCertificate'{tbsCertificate = TBSCert} =public_key:pkix_decode_cert(Cert, otp), #'OTPSubjectPublicKeyInfo'{algorithm = {_,Algo, _}} = TBSCert#'OTPTBSCertificate'.subjectPublicKeyInfo, DefaultHashSign = {_, Sign} = select_hashsign_algs(undefined, Algo, Version), @@ -602,11 +624,7 @@ DefaultHashSign; [HashSign| _] -> HashSign - end; -select_hashsign(_, Cert, Version) -> - #'OTPCertificate'{tbsCertificate = TBSCert} = public_key:pkix_decode_cert(Cert, otp), - #'OTPSubjectPublicKeyInfo'{algorithm = {_,Algo, _}} = TBSCert#'OTPTBSCertificate'.subjectPublicKeyInfo, - select_hashsign_algs(undefined, Algo, Version). + end. %%-------------------------------------------------------------------- -spec select_hashsign_algs(#hash_sign_algos{}| undefined, oid(), ssl_record:ssl_version()) -> @@ -771,11 +789,6 @@ Size = byte_size(Acc), <>; -encode_hello_extensions([#alpn{extension_data = ExtensionData} | Rest], Acc) -> - Len = byte_size(ExtensionData), - ExtLen = Len + 2, - encode_hello_extensions(Rest, <>); encode_hello_extensions([#next_protocol_negotiation{extension_data = ExtensionData} | Rest], Acc) -> Len = byte_size(ExtensionData), encode_hello_extensions(Rest, < dec_server_key(ServerKey, key_exchange_alg(Type), Version). -%% -%% Description: Encode and decode functions for ALPN extension data. -%%-------------------------------------------------------------------- - -%% While the RFC opens the door to allow ALPN during renegotiation, in practice -%% this does not work and it is recommended to ignore any ALPN extension during -%% renegotiation, as done here. -encode_alpn(_, true) -> - undefined; -encode_alpn(undefined, _) -> - undefined; -encode_alpn(Protocols, _) -> - #alpn{extension_data = lists:foldl(fun encode_protocol/2, <<>>, Protocols)}. - -decode_alpn(undefined) -> - undefined; -decode_alpn(#alpn{extension_data=Data}) -> - decode_protocols(Data, []). - encode_client_protocol_negotiation(undefined, _) -> undefined; encode_client_protocol_negotiation(_, false) -> @@ -1155,10 +1149,8 @@ #hello_extensions{renegotiation_info = Info, srp = SRP, ec_point_formats = ECCFormat, - alpn = ALPN, next_protocol_negotiation = NextProtocolNegotiation}, Version, - #ssl_options{secure_renegotiate = SecureRenegotation, - alpn_preferred_protocols = ALPNPreferredProtocols} = Opts, + #ssl_options{secure_renegotiate = SecureRenegotation} = Opts, #session{cipher_suite = NegotiatedCipherSuite, compression_method = Compression} = Session0, ConnectionStates0, Renegotiation) -> @@ -1167,34 +1159,19 @@ Random, NegotiatedCipherSuite, ClientCipherSuites, Compression, ConnectionStates0, Renegotiation, SecureRenegotation), - + ProtocolsToAdvertise = handle_next_protocol_extension(NextProtocolNegotiation, Renegotiation, Opts), + ServerHelloExtensions = #hello_extensions{ renegotiation_info = renegotiation_info(RecordCB, server, ConnectionStates, Renegotiation), - ec_point_formats = server_ecc_extension(Version, ECCFormat) + ec_point_formats = server_ecc_extension(Version, ECCFormat), + next_protocol_negotiation = + encode_protocols_advertised_on_server(ProtocolsToAdvertise) }, - - %% If we receive an ALPN extension and have ALPN configured for this connection, - %% we handle it. Otherwise we check for the NPN extension. - if - ALPN =/= undefined, ALPNPreferredProtocols =/= undefined -> - case handle_alpn_extension(ALPNPreferredProtocols, decode_alpn(ALPN)) of - #alert{} = Alert -> - Alert; - Protocol -> - {Session, ConnectionStates, Protocol, - ServerHelloExtensions#hello_extensions{alpn=encode_alpn([Protocol], Renegotiation)}} - end; - true -> - ProtocolsToAdvertise = handle_next_protocol_extension(NextProtocolNegotiation, Renegotiation, Opts), - {Session, ConnectionStates, undefined, - ServerHelloExtensions#hello_extensions{next_protocol_negotiation= - encode_protocols_advertised_on_server(ProtocolsToAdvertise)}} - end. + {Session, ConnectionStates, ServerHelloExtensions}. handle_server_hello_extensions(RecordCB, Random, CipherSuite, Compression, #hello_extensions{renegotiation_info = Info, - alpn = ALPN, next_protocol_negotiation = NextProtocolNegotiation}, Version, #ssl_options{secure_renegotiate = SecureRenegotation, next_protocol_selector = NextProtoSelector}, @@ -1203,23 +1180,11 @@ CipherSuite, undefined, Compression, ConnectionStates0, Renegotiation, SecureRenegotation), - - %% If we receive an ALPN extension then this is the protocol selected, - %% otherwise handle the NPN extension. - case decode_alpn(ALPN) of - %% ServerHello contains exactly one protocol: the one selected. - %% We also ignore the ALPN extension during renegotiation (see encode_alpn/2). - [Protocol] when not Renegotiation -> - {ConnectionStates, alpn, Protocol}; - undefined -> - case handle_next_protocol(NextProtocolNegotiation, NextProtoSelector, Renegotiation) of - #alert{} = Alert -> - Alert; - Protocol -> - {ConnectionStates, npn, Protocol} - end; - _ -> %% {error, _Reason} or a list of 0/2+ protocols. - ?ALERT_REC(?FATAL, ?HANDSHAKE_FAILURE) + case handle_next_protocol(NextProtocolNegotiation, NextProtoSelector, Renegotiation) of + #alert{} = Alert -> + Alert; + Protocol -> + {ConnectionStates, Protocol} end. select_version(RecordCB, ClientVersion, Versions) -> @@ -1327,11 +1292,10 @@ hash_signs = HashSigns, ec_point_formats = EcPointFormats, elliptic_curves = EllipticCurves, - alpn = ALPN, next_protocol_negotiation = NextProtocolNegotiation, sni = Sni}) -> [Ext || Ext <- [RenegotiationInfo, SRP, HashSigns, - EcPointFormats, EllipticCurves, ALPN, NextProtocolNegotiation, Sni], Ext =/= undefined]. + EcPointFormats, EllipticCurves, NextProtocolNegotiation, Sni], Ext =/= undefined]. srp_user(#ssl_options{srp_identity = {UserName, _}}) -> #srp{username = UserName}; @@ -1410,66 +1374,15 @@ %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- -validation_fun_and_state({Fun, UserState0}, Role, CertDbHandle, CertDbRef, CRLCheck, CRLDbHandle) -> - {fun(OtpCert, {extension, _} = Extension, {SslState, UserState}) -> - case ssl_certificate:validate(OtpCert, - Extension, - SslState) of - {valid, NewSslState} -> - {valid, {NewSslState, UserState}}; - {fail, Reason} -> - apply_user_fun(Fun, OtpCert, Reason, UserState, - SslState); - {unknown, _} -> - apply_user_fun(Fun, OtpCert, - Extension, UserState, SslState) - end; - (OtpCert, VerifyResult, {SslState, UserState}) -> - apply_user_fun(Fun, OtpCert, VerifyResult, UserState, - SslState) - end, {{Role, CertDbHandle, CertDbRef, CRLCheck, CRLDbHandle}, UserState0}}; -validation_fun_and_state(undefined, Role, CertDbHandle, CertDbRef, CRLCheck, CRLDbHandle) -> - {fun(OtpCert, {extension, _} = Extension, SslState) -> - ssl_certificate:validate(OtpCert, - Extension, - SslState); - (OtpCert, VerifyResult, SslState) when (VerifyResult == valid) or (VerifyResult == valid_peer) -> - case crl_check(OtpCert, CRLCheck, CertDbHandle, CertDbRef, CRLDbHandle, VerifyResult) of - valid -> - {VerifyResult, SslState}; - Reason -> - {fail, Reason} - end; - (OtpCert, VerifyResult, SslState) -> - ssl_certificate:validate(OtpCert, - VerifyResult, - SslState) - end, {Role, CertDbHandle, CertDbRef, CRLCheck, CRLDbHandle}}. - -apply_user_fun(Fun, OtpCert, VerifyResult, UserState0, - {_, CertDbHandle, CertDbRef, CRLCheck, CRLDbHandle} = SslState) when - (VerifyResult == valid) or (VerifyResult == valid_peer) -> - case Fun(OtpCert, VerifyResult, UserState0) of - {Valid, UserState} when (Valid == valid) or (Valid == valid_peer) -> - case crl_check(OtpCert, CRLCheck, CertDbHandle, CertDbRef, CRLDbHandle, VerifyResult) of - valid -> - {Valid, {SslState, UserState}}; - Result -> - apply_user_fun(Fun, OtpCert, Result, UserState, SslState) - end; - {fail, _} = Fail -> - Fail - end; apply_user_fun(Fun, OtpCert, ExtensionOrError, UserState0, SslState) -> case Fun(OtpCert, ExtensionOrError, UserState0) of - {Valid, UserState} when (Valid == valid) or (Valid == valid_peer)-> - {Valid, {SslState, UserState}}; + {valid, UserState} -> + {valid, {SslState, UserState}}; {fail, _} = Fail -> Fail; {unknown, UserState} -> {unknown, {SslState, UserState}} end. - path_validation_alert({bad_cert, cert_expired}) -> ?ALERT_REC(?FATAL, ?CERTIFICATE_EXPIRED); path_validation_alert({bad_cert, invalid_issuer}) -> @@ -1480,10 +1393,8 @@ ?ALERT_REC(?FATAL, ?BAD_CERTIFICATE); path_validation_alert({bad_cert, unknown_critical_extension}) -> ?ALERT_REC(?FATAL, ?UNSUPPORTED_CERTIFICATE); -path_validation_alert({bad_cert, {revoked, _}}) -> +path_validation_alert({bad_cert, cert_revoked}) -> ?ALERT_REC(?FATAL, ?CERTIFICATE_REVOKED); -path_validation_alert({bad_cert, revocation_status_undetermined}) -> - ?ALERT_REC(?FATAL, ?BAD_CERTIFICATE); path_validation_alert({bad_cert, selfsigned_peer}) -> ?ALERT_REC(?FATAL, ?BAD_CERTIFICATE); path_validation_alert({bad_cert, unknown_ca}) -> @@ -1524,7 +1435,6 @@ master_secret(_RecordCB, Version, MasterSecret, #security_parameters{ - bulk_cipher_algorithm = BCA, client_random = ClientRandom, server_random = ServerRandom, hash_size = HashSize, @@ -1543,8 +1453,8 @@ ssl_record:set_mac_secret(ClientWriteMacSecret, ServerWriteMacSecret, Role, ConnStates1), - ClientCipherState = ssl_cipher:cipher_init(BCA, ClientIV, ClientWriteKey), - ServerCipherState = ssl_cipher:cipher_init(BCA, ServerIV, ServerWriteKey), + ClientCipherState = #cipher_state{iv = ClientIV, key = ClientWriteKey}, + ServerCipherState = #cipher_state{iv = ServerIV, key = ServerWriteKey}, {MasterSecret, ssl_record:set_pending_cipher_state(ConnStates2, ClientCipherState, ServerCipherState, Role)}. @@ -1769,10 +1679,6 @@ dec_hello_extensions(<<>>, Acc) -> Acc; -dec_hello_extensions(<>, Acc) - when Len + 2 =:= ExtLen -> - ALPN = #alpn{extension_data = ExtensionData}, - dec_hello_extensions(Rest, Acc#hello_extensions{alpn = ALPN}); dec_hello_extensions(<>, Acc) -> NextP = #next_protocol_negotiation{extension_data = ExtensionData}, dec_hello_extensions(Rest, Acc#hello_extensions{next_protocol_negotiation = NextP}); @@ -1826,9 +1732,6 @@ #ec_point_formats{ec_point_format_list = ECPointFormats}}); -dec_hello_extensions(<>, Acc) when Len == 0 -> - dec_hello_extensions(Rest, Acc#hello_extensions{sni = ""}); %% Server may send an empy SNI - dec_hello_extensions(<>, Acc) -> <> = ExtData, @@ -1853,19 +1756,18 @@ dec_sni(_) -> undefined. decode_next_protocols({next_protocol_negotiation, Protocols}) -> - decode_protocols(Protocols, []). - -decode_protocols(<<>>, Acc) -> + decode_next_protocols(Protocols, []). +decode_next_protocols(<<>>, Acc) -> lists:reverse(Acc); -decode_protocols(<>, Acc) -> +decode_next_protocols(<>, Acc) -> case Len of 0 -> - {error, invalid_protocols}; + {error, invalid_next_protocols}; _ -> - decode_protocols(Rest, [Protocol|Acc]) + decode_next_protocols(Rest, [Protocol|Acc]) end; -decode_protocols(_Bytes, _Acc) -> - {error, invalid_protocols}. +decode_next_protocols(_Bytes, _Acc) -> + {error, invalid_next_protocols}. %% encode/decode stream of certificate data to/from list of certificate data certs_to_list(ASN1Certs) -> @@ -1919,17 +1821,6 @@ %%-------------Extension handling -------------------------------- -%% Receive protocols, choose one from the list, return it. -handle_alpn_extension(_, {error, _Reason}) -> - ?ALERT_REC(?FATAL, ?HANDSHAKE_FAILURE); -handle_alpn_extension([], _) -> - ?ALERT_REC(?FATAL, ?NO_APPLICATION_PROTOCOL); -handle_alpn_extension([ServerProtocol|Tail], ClientProtocols) -> - case lists:member(ServerProtocol, ClientProtocols) of - true -> ServerProtocol; - false -> handle_alpn_extension(Tail, ClientProtocols) - end. - handle_next_protocol(undefined, _NextProtocolSelector, _Renegotiating) -> undefined; @@ -2039,7 +1930,7 @@ #alert{} = Alert -> Alert; _ -> - throw(?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER)) + ?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER) end. psk_secret(PSKIdentity, PSKLookup, PremasterSecret) -> @@ -2051,7 +1942,7 @@ #alert{} = Alert -> Alert; _ -> - throw(?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER)) + ?ALERT_REC(?FATAL, ?ILLEGAL_PARAMETER) end. handle_psk_identity(_PSKIdentity, LookupFun) @@ -2059,70 +1950,3 @@ error; handle_psk_identity(PSKIdentity, {Fun, UserState}) -> Fun(psk, PSKIdentity, UserState). - -crl_check(_, false, _,_,_, _) -> - valid; -crl_check(_, peer, _, _,_, valid) -> %% Do not check CAs with this option. - valid; -crl_check(OtpCert, Check, CertDbHandle, CertDbRef, {Callback, CRLDbHandle}, _) -> - Options = [{issuer_fun, {fun(_DP, CRL, Issuer, DBInfo) -> - ssl_crl:trusted_cert_and_path(CRL, Issuer, DBInfo) - end, {CertDbHandle, CertDbRef}}}, - {update_crl, fun(DP, CRL) -> Callback:fresh_crl(DP, CRL) end} - ], - case dps_and_crls(OtpCert, Callback, CRLDbHandle, ext) of - no_dps -> - case dps_and_crls(OtpCert, Callback, CRLDbHandle, same_issuer) of - [] -> - valid; %% No relevant CRL existed - DpsAndCRls -> - crl_check_same_issuer(OtpCert, Check, DpsAndCRls, Options) - end; - DpsAndCRLs -> %% This DP list may be empty if relevant CRLs existed - %% but could not be retrived, will result in {bad_cert, revocation_status_undetermined} - case public_key:pkix_crls_validate(OtpCert, DpsAndCRLs, Options) of - {bad_cert, revocation_status_undetermined} -> - crl_check_same_issuer(OtpCert, Check, dps_and_crls(OtpCert, Callback, - CRLDbHandle, same_issuer), Options); - Other -> - Other - end - end. - -crl_check_same_issuer(OtpCert, best_effort, Dps, Options) -> - case public_key:pkix_crls_validate(OtpCert, Dps, Options) of - {bad_cert, revocation_status_undetermined} -> - valid; - Other -> - Other - end; -crl_check_same_issuer(OtpCert, _, Dps, Options) -> - public_key:pkix_crls_validate(OtpCert, Dps, Options). - -dps_and_crls(OtpCert, Callback, CRLDbHandle, ext) -> - case public_key:pkix_dist_points(OtpCert) of - [] -> - no_dps; - DistPoints -> - distpoints_lookup(DistPoints, Callback, CRLDbHandle) - end; - -dps_and_crls(OtpCert, Callback, CRLDbHandle, same_issuer) -> - DP = #'DistributionPoint'{distributionPoint = {fullName, GenNames}} = - public_key:pkix_dist_point(OtpCert), - CRLs = lists:flatmap(fun({directoryName, Issuer}) -> - Callback:select(Issuer, CRLDbHandle); - (_) -> - [] - end, GenNames), - [{DP, {CRL, public_key:der_decode('CertificateList', CRL)}} || CRL <- CRLs]. - -distpoints_lookup([], _, _) -> - []; -distpoints_lookup([DistPoint | Rest], Callback, CRLDbHandle) -> - case Callback:lookup(DistPoint, CRLDbHandle) of - not_available -> - distpoints_lookup(Rest, Callback, CRLDbHandle); - CRLs -> - [{DistPoint, {CRL, public_key:der_decode('CertificateList', CRL)}} || CRL <- CRLs] - end. diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_handshake.hrl erlang-17.3-dfsg/lib/ssl/src/ssl_handshake.hrl --- erlang-18.2-dfsg/lib/ssl/src/ssl_handshake.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_handshake.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -96,7 +95,6 @@ -record(hello_extensions, { renegotiation_info, hash_signs, % supported combinations of hashes/signature algos - alpn, next_protocol_negotiation = undefined, % [binary()] srp, ec_point_formats, @@ -303,14 +301,6 @@ }). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Application-Layer Protocol Negotiation RFC 7301 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - --define(ALPN_EXT, 16). - --record(alpn, {extension_data}). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Next Protocol Negotiation %% (http://tools.ietf.org/html/draft-agl-tls-nextprotoneg-02) %% (http://technotes.googlecode.com/git/nextprotoneg.html) diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_internal.hrl erlang-17.3-dfsg/lib/ssl/src/ssl_internal.hrl --- erlang-18.2-dfsg/lib/ssl/src/ssl_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,8 +24,6 @@ -include_lib("public_key/include/public_key.hrl"). --define(SECRET_PRINTOUT, "***"). - -type reason() :: term(). -type reply() :: term(). -type msg() :: term(). @@ -39,7 +36,6 @@ -type issuer() :: tuple(). -type serialnumber() :: integer(). -type cert_key() :: {reference(), integer(), issuer()}. --type secret_printout() :: list(). %% basic binary constructors -define(BOOLEAN(X), X:8/unsigned-big-integer). @@ -62,25 +58,17 @@ -define(CDR_HDR_SIZE, 12). -define(DEFAULT_TIMEOUT, 5000). --define(NO_DIST_POINT, "http://dummy/no_distribution_point"). --define(NO_DIST_POINT_PATH, "dummy/no_distribution_point"). %% Common enumerate values in for SSL-protocols -define(NULL, 0). -define(TRUE, 0). -define(FALSE, 1). -%% sslv3 is considered insecure due to lack of padding check (Poodle attack) -%% Keep as interop with legacy software but do not support as default --define(ALL_AVAILABLE_VERSIONS, ['tlsv1.2', 'tlsv1.1', tlsv1, sslv3]). --define(ALL_SUPPORTED_VERSIONS, ['tlsv1.2', 'tlsv1.1', tlsv1]). --define(MIN_SUPPORTED_VERSIONS, ['tlsv1.1', tlsv1]). +-define(ALL_SUPPORTED_VERSIONS, ['tlsv1.2', 'tlsv1.1', tlsv1, sslv3]). +-define(MIN_SUPPORTED_VERSIONS, ['tlsv1.1', tlsv1, sslv3]). -define(ALL_DATAGRAM_SUPPORTED_VERSIONS, ['dtlsv1.2', dtlsv1]). -define(MIN_DATAGRAM_SUPPORTED_VERSIONS, ['dtlsv1.2', dtlsv1]). --define('24H_in_msec', 86400000). --define('24H_in_sec', 86400). - -record(ssl_options, { protocol :: tls | dtls, versions :: [ssl_record:ssl_version()], %% ssl_record:atom_version() in API @@ -93,16 +81,16 @@ validate_extensions_fun, depth :: integer(), certfile :: binary(), - cert :: public_key:der_encoded() | secret_printout(), + cert :: public_key:der_encoded(), keyfile :: binary(), - key :: {'RSAPrivateKey' | 'DSAPrivateKey' | 'ECPrivateKey' | 'PrivateKeyInfo', public_key:der_encoded()} | secret_printout(), - password :: string() | secret_printout(), - cacerts :: [public_key:der_encoded()] | secret_printout(), + key :: {'RSAPrivateKey' | 'DSAPrivateKey' | 'ECPrivateKey' | 'PrivateKeyInfo', public_key:der_encoded()}, + password :: string(), + cacerts :: [public_key:der_encoded()], cacertfile :: binary(), - dh :: public_key:der_encoded() | secret_printout(), - dhfile :: binary() | secret_printout(), + dh :: public_key:der_encoded(), + dhfile :: binary(), user_lookup_fun, % server option, fun to lookup the user - psk_identity :: binary() | secret_printout() , + psk_identity :: binary(), srp_identity, % client option {User, Password} ciphers, % %% Local policy for the server if it want's to reuse the session @@ -114,28 +102,19 @@ reuse_sessions :: boolean(), renegotiate_at, secure_renegotiate, - client_renegotiation, %% undefined if not hibernating, or number of ms of %% inactivity after which ssl_connection will go into %% hibernation hibernate_after :: boolean(), %% This option should only be set to true by inet_tls_dist erl_dist = false :: boolean(), - alpn_advertised_protocols = undefined :: [binary()] | undefined , - alpn_preferred_protocols = undefined :: [binary()] | undefined, - next_protocols_advertised = undefined :: [binary()] | undefined, + next_protocols_advertised = undefined, %% [binary()], next_protocol_selector = undefined, %% fun([binary()]) -> binary()) log_alert :: boolean(), server_name_indication = undefined, - sni_hosts :: [{inet:hostname(), [tuple()]}], - sni_fun :: function() | undefined, %% Should the server prefer its own cipher order over the one provided by %% the client? - honor_cipher_order = false :: boolean(), - padding_check = true :: boolean(), - fallback = false :: boolean(), - crl_check :: boolean() | peer | best_effort, - crl_cache + honor_cipher_order = false }). -record(socket_options, diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_listen_tracker_sup.erl erlang-17.3-dfsg/lib/ssl/src/ssl_listen_tracker_sup.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_listen_tracker_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_listen_tracker_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_manager.erl erlang-17.3-dfsg/lib/ssl/src/ssl_manager.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_manager.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_manager.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,15 +26,14 @@ %% Internal application API -export([start_link/1, start_link_dist/1, - connection_init/3, cache_pem_file/2, + connection_init/2, cache_pem_file/2, lookup_trusted_cert/4, new_session_id/1, clean_cert_db/2, register_session/2, register_session/3, invalidate_session/2, - insert_crls/2, insert_crls/3, delete_crls/1, delete_crls/2, - invalidate_session/3, invalidate_pem/1, clear_pem_cache/0, manager_name/1]). + invalidate_session/3, clear_pem_cache/0, manager_name/1]). % Spawn export --export([init_session_validator/1, init_pem_cache_validator/1]). +-export([init_session_validator/1]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, @@ -46,27 +44,22 @@ -include_lib("kernel/include/file.hrl"). -record(state, { - session_cache_client :: db_handle(), - session_cache_server :: db_handle(), - session_cache_cb :: atom(), - session_lifetime :: integer(), - certificate_db :: db_handle(), - session_validation_timer :: reference(), - last_delay_timer = {undefined, undefined},%% Keep for testing purposes - last_pem_check :: erlang:timestamp(), - clear_pem_cache :: integer(), - session_cache_client_max :: integer(), - session_cache_server_max :: integer(), - session_server_invalidator :: undefined | pid(), - session_client_invalidator :: undefined | pid() + session_cache, + session_cache_cb, + session_lifetime, + certificate_db, + session_validation_timer, + last_delay_timer = {undefined, undefined}%% Keep for testing purposes }). +-define('24H_in_msec', 86400000). +-define('24H_in_sec', 86400). -define(GEN_UNIQUE_ID_MAX_TRIES, 10). -define(SESSION_VALIDATION_INTERVAL, 60000). -define(CLEAR_PEM_CACHE, 120000). -define(CLEAN_SESSION_DB, 60000). -define(CLEAN_CERT_DB, 500). --define(DEFAULT_MAX_SESSION_CACHE, 1000). +-define(NOT_TO_BIG, 10). %%==================================================================== %% API @@ -91,8 +84,7 @@ %%-------------------------------------------------------------------- start_link(Opts) -> DistMangerName = manager_name(normal), - gen_server:start_link({local, DistMangerName}, - ?MODULE, [DistMangerName, Opts], []). + gen_server:start_link({local, DistMangerName}, ?MODULE, [DistMangerName, Opts], []). %%-------------------------------------------------------------------- -spec start_link_dist(list()) -> {ok, pid()} | ignore | {error, term()}. @@ -102,25 +94,22 @@ %%-------------------------------------------------------------------- start_link_dist(Opts) -> DistMangerName = manager_name(dist), - gen_server:start_link({local, DistMangerName}, - ?MODULE, [DistMangerName, Opts], []). + gen_server:start_link({local, DistMangerName}, ?MODULE, [DistMangerName, Opts], []). %%-------------------------------------------------------------------- --spec connection_init(binary()| {der, list()}, client | server, - {Cb :: atom(), Handle:: term()}) -> - {ok, certdb_ref(), db_handle(), db_handle(), - db_handle(), db_handle(), CRLInfo::term()}. +-spec connection_init(binary()| {der, list()}, client | server) -> + {ok, certdb_ref(), db_handle(), db_handle(), db_handle(), db_handle()}. %% %% Description: Do necessary initializations for a new connection. %%-------------------------------------------------------------------- -connection_init({der, _} = Trustedcerts, Role, CRLCache) -> - call({connection_init, Trustedcerts, Role, CRLCache}); +connection_init({der, _} = Trustedcerts, Role) -> + call({connection_init, Trustedcerts, Role}); -connection_init(<<>> = Trustedcerts, Role, CRLCache) -> - call({connection_init, Trustedcerts, Role, CRLCache}); +connection_init(<<>> = Trustedcerts, Role) -> + call({connection_init, Trustedcerts, Role}); -connection_init(Trustedcerts, Role, CRLCache) -> - call({connection_init, Trustedcerts, Role, CRLCache}). +connection_init(Trustedcerts, Role) -> + call({connection_init, Trustedcerts, Role}). %%-------------------------------------------------------------------- -spec cache_pem_file(binary(), term()) -> {ok, term()} | {error, reason()}. @@ -128,13 +117,14 @@ %% Description: Cache a pem file and return its content. %%-------------------------------------------------------------------- cache_pem_file(File, DbHandle) -> - case ssl_pkix_db:lookup_cached_pem(DbHandle, File) of + MD5 = crypto:hash(md5, File), + case ssl_pkix_db:lookup_cached_pem(DbHandle, MD5) of [{Content,_}] -> {ok, Content}; [Content] -> - {ok, Content}; + {ok, Content}; undefined -> - call({cache_pem, File}) + call({cache_pem, {MD5, File}}) end. %%-------------------------------------------------------------------- @@ -173,8 +163,7 @@ %% be called by ssl-connection processes. %%-------------------------------------------------------------------- clean_cert_db(Ref, File) -> - erlang:send_after(?CLEAN_CERT_DB, get(ssl_manager), - {clean_cert_db, Ref, File}), + erlang:send_after(?CLEAN_CERT_DB, get(ssl_manager), {clean_cert_db, Ref, File}), ok. %%-------------------------------------------------------------------- @@ -202,28 +191,6 @@ invalidate_session(Port, Session) -> cast({invalidate_session, Port, Session}). --spec invalidate_pem(File::binary()) -> ok. -invalidate_pem(File) -> - cast({invalidate_pem, File}). - -insert_crls(Path, CRLs)-> - insert_crls(Path, CRLs, normal). -insert_crls(?NO_DIST_POINT_PATH = Path, CRLs, ManagerType)-> - put(ssl_manager, manager_name(ManagerType)), - cast({insert_crls, Path, CRLs}); -insert_crls(Path, CRLs, ManagerType)-> - put(ssl_manager, manager_name(ManagerType)), - call({insert_crls, Path, CRLs}). - -delete_crls(Path)-> - delete_crls(Path, normal). -delete_crls(?NO_DIST_POINT_PATH = Path, ManagerType)-> - put(ssl_manager, manager_name(ManagerType)), - cast({delete_crls, Path}); -delete_crls(Path, ManagerType)-> - put(ssl_manager, manager_name(ManagerType)), - call({delete_crls, Path}). - %%==================================================================== %% gen_server callbacks %%==================================================================== @@ -242,29 +209,15 @@ SessionLifeTime = proplists:get_value(session_lifetime, Opts, ?'24H_in_sec'), CertDb = ssl_pkix_db:create(), - ClientSessionCache = - CacheCb:init([{role, client} | - proplists:get_value(session_cb_init_args, Opts, [])]), - ServerSessionCache = - CacheCb:init([{role, server} | - proplists:get_value(session_cb_init_args, Opts, [])]), + SessionCache = CacheCb:init(proplists:get_value(session_cb_init_args, Opts, [])), Timer = erlang:send_after(SessionLifeTime * 1000 + 5000, self(), validate_sessions), - Interval = pem_check_interval(), - erlang:send_after(Interval, self(), clear_pem_cache), + erlang:send_after(?CLEAR_PEM_CACHE, self(), clear_pem_cache), {ok, #state{certificate_db = CertDb, - session_cache_client = ClientSessionCache, - session_cache_server = ServerSessionCache, + session_cache = SessionCache, session_cache_cb = CacheCb, session_lifetime = SessionLifeTime, - session_validation_timer = Timer, - last_pem_check = os:timestamp(), - clear_pem_cache = Interval, - session_cache_client_max = - max_session_cache_size(session_cache_client_max), - session_cache_server_max = - max_session_cache_size(session_cache_server_max) - }}. + session_validation_timer = Timer}}. %%-------------------------------------------------------------------- -spec handle_call(msg(), from(), #state{}) -> {reply, reply(), #state{}}. @@ -277,40 +230,33 @@ %% %% Description: Handling call messages %%-------------------------------------------------------------------- -handle_call({{connection_init, <<>>, Role, {CRLCb, UserCRLDb}}, _Pid}, _From, - #state{certificate_db = [CertDb, FileRefDb, PemChace | _] = Db} = State) -> - Ref = make_ref(), - Result = {ok, Ref, CertDb, FileRefDb, PemChace, - session_cache(Role, State), {CRLCb, crl_db_info(Db, UserCRLDb)}}, - {reply, Result, State#state{certificate_db = Db}}; - -handle_call({{connection_init, Trustedcerts, Role, {CRLCb, UserCRLDb}}, Pid}, _From, - #state{certificate_db = [CertDb, FileRefDb, PemChace | _] = Db} = State) -> - case add_trusted_certs(Pid, Trustedcerts, Db) of - {ok, Ref} -> - {reply, {ok, Ref, CertDb, FileRefDb, PemChace, session_cache(Role, State), - {CRLCb, crl_db_info(Db, UserCRLDb)}}, State}; - {error, _} = Error -> - {reply, Error, State} - end; - -handle_call({{insert_crls, Path, CRLs}, _}, _From, - #state{certificate_db = Db} = State) -> - ssl_pkix_db:add_crls(Db, Path, CRLs), - {reply, ok, State}; - -handle_call({{delete_crls, CRLsOrPath}, _}, _From, - #state{certificate_db = Db} = State) -> - ssl_pkix_db:remove_crls(Db, CRLsOrPath), - {reply, ok, State}; +handle_call({{connection_init, <<>>, _Role}, _Pid}, _From, + #state{certificate_db = [CertDb, FileRefDb, PemChace], + session_cache = Cache} = State) -> + Result = {ok, make_ref(),CertDb, FileRefDb, PemChace, Cache}, + {reply, Result, State}; + +handle_call({{connection_init, Trustedcerts, _Role}, Pid}, _From, + #state{certificate_db = [CertDb, FileRefDb, PemChace] = Db, + session_cache = Cache} = State) -> + Result = + try + {ok, Ref} = ssl_pkix_db:add_trusted_certs(Pid, Trustedcerts, Db), + {ok, Ref, CertDb, FileRefDb, PemChace, Cache} + catch + _:Reason -> + {error, Reason} + end, + {reply, Result, State}; -handle_call({{new_session_id, Port}, _}, +handle_call({{new_session_id,Port}, _}, _, #state{session_cache_cb = CacheCb, - session_cache_server = Cache} = State) -> + session_cache = Cache} = State) -> Id = new_id(Port, ?GEN_UNIQUE_ID_MAX_TRIES, Cache, CacheCb), {reply, Id, State}; -handle_call({{cache_pem,File}, _Pid}, _, + +handle_call({{cache_pem, File}, _Pid}, _, #state{certificate_db = Db} = State) -> try ssl_pkix_db:cache_pem_file(File, Db) of Result -> @@ -319,8 +265,7 @@ _:Reason -> {reply, {error, Reason}, State} end; -handle_call({unconditionally_clear_pem_cache, _},_, - #state{certificate_db = [_,_,PemChace | _]} = State) -> +handle_call({unconditionally_clear_pem_cache, _},_, #state{certificate_db = [_,_,PemChace]} = State) -> ssl_pkix_db:clear(PemChace), {reply, ok, State}. @@ -332,40 +277,33 @@ %% %% Description: Handling cast messages %%-------------------------------------------------------------------- -handle_cast({register_session, Host, Port, Session}, State0) -> - State = ssl_client_register_session(Host, Port, Session, State0), +handle_cast({register_session, Host, Port, Session}, + #state{session_cache = Cache, + session_cache_cb = CacheCb} = State) -> + TimeStamp = calendar:datetime_to_gregorian_seconds({date(), time()}), + NewSession = Session#session{time_stamp = TimeStamp}, + CacheCb:update(Cache, {{Host, Port}, + NewSession#session.session_id}, NewSession), {noreply, State}; -handle_cast({register_session, Port, Session}, State0) -> - State = server_register_session(Port, Session, State0), +handle_cast({register_session, Port, Session}, + #state{session_cache = Cache, + session_cache_cb = CacheCb} = State) -> + TimeStamp = calendar:datetime_to_gregorian_seconds({date(), time()}), + NewSession = Session#session{time_stamp = TimeStamp}, + CacheCb:update(Cache, {Port, NewSession#session.session_id}, NewSession), {noreply, State}; handle_cast({invalidate_session, Host, Port, #session{session_id = ID} = Session}, - #state{session_cache_client = Cache, + #state{session_cache = Cache, session_cache_cb = CacheCb} = State) -> invalidate_session(Cache, CacheCb, {{Host, Port}, ID}, Session, State); handle_cast({invalidate_session, Port, #session{session_id = ID} = Session}, - #state{session_cache_server = Cache, + #state{session_cache = Cache, session_cache_cb = CacheCb} = State) -> - invalidate_session(Cache, CacheCb, {Port, ID}, Session, State); - - -handle_cast({insert_crls, Path, CRLs}, - #state{certificate_db = Db} = State) -> - ssl_pkix_db:add_crls(Db, Path, CRLs), - {noreply, State}; - -handle_cast({delete_crls, CRLsOrPath}, - #state{certificate_db = Db} = State) -> - ssl_pkix_db:remove_crls(Db, CRLsOrPath), - {noreply, State}; - -handle_cast({invalidate_pem, File}, - #state{certificate_db = [_, _, PemCache | _]} = State) -> - ssl_pkix_db:remove(File, PemCache), - {noreply, State}. + invalidate_session(Cache, CacheCb, {Port, ID}, Session, State). %%-------------------------------------------------------------------- -spec handle_info(msg(), #state{}) -> {noreply, #state{}}. @@ -376,32 +314,33 @@ %% Description: Handling all non call/cast messages %%------------------------------------------------------------------- handle_info(validate_sessions, #state{session_cache_cb = CacheCb, - session_cache_client = ClientCache, - session_cache_server = ServerCache, + session_cache = Cache, session_lifetime = LifeTime } = State) -> Timer = erlang:send_after(?SESSION_VALIDATION_INTERVAL, self(), validate_sessions), - start_session_validator(ClientCache, CacheCb, LifeTime), - start_session_validator(ServerCache, CacheCb, LifeTime), + start_session_validator(Cache, CacheCb, LifeTime), {noreply, State#state{session_validation_timer = Timer}}; - -handle_info({delayed_clean_session, Key, Cache}, #state{session_cache_cb = CacheCb - } = State) -> +handle_info({delayed_clean_session, Key}, #state{session_cache = Cache, + session_cache_cb = CacheCb + } = State) -> CacheCb:delete(Cache, Key), {noreply, State}; -handle_info(clear_pem_cache, #state{certificate_db = [_,_,PemChace | _], - clear_pem_cache = Interval, - last_pem_check = CheckPoint} = State) -> - NewCheckPoint = os:timestamp(), - start_pem_cache_validator(PemChace, CheckPoint), - erlang:send_after(Interval, self(), clear_pem_cache), - {noreply, State#state{last_pem_check = NewCheckPoint}}; +handle_info(clear_pem_cache, #state{certificate_db = [_,_,PemChace]} = State) -> + case ssl_pkix_db:db_size(PemChace) of + N when N < ?NOT_TO_BIG -> + ok; + _ -> + ssl_pkix_db:clear(PemChace) + end, + erlang:send_after(?CLEAR_PEM_CACHE, self(), clear_pem_cache), + {noreply, State}; + handle_info({clean_cert_db, Ref, File}, - #state{certificate_db = [CertDb,RefDb, PemCache | _]} = State) -> + #state{certificate_db = [CertDb,RefDb, PemCache]} = State) -> case ssl_pkix_db:lookup(Ref, RefDb) of undefined -> %% Alredy cleaned @@ -411,10 +350,10 @@ end, {noreply, State}; -handle_info({'EXIT', Pid, _}, #state{session_client_invalidator = Pid} = State) -> - {noreply, State#state{session_client_invalidator = undefined}}; -handle_info({'EXIT', Pid, _}, #state{session_server_invalidator = Pid} = State) -> - {noreply, State#state{session_server_invalidator = undefined}}; +handle_info({'EXIT', _, _}, State) -> + %% Session validator died!! Do we need to take any action? + %% maybe error log + {noreply, State}; handle_info(_Info, State) -> {noreply, State}. @@ -428,14 +367,12 @@ %% The return value is ignored. %%-------------------------------------------------------------------- terminate(_Reason, #state{certificate_db = Db, - session_cache_client = ClientSessionCache, - session_cache_server = ServerSessionCache, + session_cache = SessionCache, session_cache_cb = CacheCb, session_validation_timer = Timer}) -> erlang:cancel_timer(Timer), ssl_pkix_db:remove(Db), - catch CacheCb:terminate(ClientSessionCache), - catch CacheCb:terminate(ServerSessionCache), + CacheCb:terminate(SessionCache), ok. %%-------------------------------------------------------------------- @@ -495,15 +432,7 @@ ?CLEAN_SESSION_DB end. -max_session_cache_size(CacheType) -> - case application:get_env(ssl, CacheType) of - {ok, Size} when is_integer(Size) -> - Size; - _ -> - ?DEFAULT_MAX_SESSION_CACHE - end. - -invalidate_session(Cache, CacheCb, Key, Session, State) -> +invalidate_session(Cache, CacheCb, Key, Session, #state{last_delay_timer = LastTimer} = State) -> case CacheCb:lookup(Cache, Key) of undefined -> %% Session is already invalidated {noreply, State}; @@ -511,23 +440,15 @@ CacheCb:delete(Cache, Key), {noreply, State}; _ -> - delayed_invalidate_session(CacheCb, Cache, Key, Session, State) + %% When a registered session is invalidated we need to wait a while before deleting + %% it as there might be pending connections that rightfully needs to look + %% up the session data but new connections should not get to use this session. + CacheCb:update(Cache, Key, Session#session{is_resumable = false}), + TRef = + erlang:send_after(delay_time(), self(), {delayed_clean_session, Key}), + {noreply, State#state{last_delay_timer = last_delay_timer(Key, TRef, LastTimer)}} end. -delayed_invalidate_session(CacheCb, Cache, Key, Session, - #state{last_delay_timer = LastTimer} = State) -> - %% When a registered session is invalidated we need to - %% wait a while before deleting it as there might be - %% pending connections that rightfully needs to look up - %% the session data but new connections should not get to - %% use this session. - CacheCb:update(Cache, Key, Session#session{is_resumable = false}), - TRef = - erlang:send_after(delay_time(), self(), - {delayed_clean_session, Key, Cache}), - {noreply, State#state{last_delay_timer = - last_delay_timer(Key, TRef, LastTimer)}}. - last_delay_timer({{_,_},_}, TRef, {LastServer, _}) -> {LastServer, TRef}; last_delay_timer({_,_}, TRef, {_, LastClient}) -> @@ -546,12 +467,12 @@ Id = crypto:rand_bytes(?NUM_OF_SESSION_ID_BYTES), case CacheCb:lookup(Cache, {Port, Id}) of undefined -> - Now = erlang:monotonic_time(), + Now = calendar:datetime_to_gregorian_seconds({date(), time()}), %% New sessions can not be set to resumable %% until handshake is compleate and the %% other session values are set. CacheCb:update(Cache, {Port, Id}, #session{session_id = Id, - is_resumable = new, + is_resumable = false, time_stamp = Now}), Id; _ -> @@ -561,9 +482,10 @@ clean_cert_db(Ref, CertDb, RefDb, PemCache, File) -> case ssl_pkix_db:ref_count(Ref, RefDb, 0) of 0 -> - case ssl_pkix_db:lookup_cached_pem(PemCache, File) of + MD5 = crypto:hash(md5, File), + case ssl_pkix_db:lookup_cached_pem(PemCache, MD5) of [{Content, Ref}] -> - ssl_pkix_db:insert(File, Content, PemCache); + ssl_pkix_db:insert(MD5, Content, PemCache); _ -> ok end, @@ -572,142 +494,3 @@ _ -> ok end. - -ssl_client_register_session(Host, Port, Session, #state{session_cache_client = Cache, - session_cache_cb = CacheCb, - session_cache_client_max = Max, - session_client_invalidator = Pid0} = State) -> - TimeStamp = erlang:monotonic_time(), - NewSession = Session#session{time_stamp = TimeStamp}, - - case CacheCb:select_session(Cache, {Host, Port}) of - no_session -> - Pid = do_register_session({{Host, Port}, - NewSession#session.session_id}, - NewSession, Max, Pid0, Cache, CacheCb), - State#state{session_client_invalidator = Pid}; - Sessions -> - register_unique_session(Sessions, NewSession, {Host, Port}, State) - end. - -server_register_session(Port, Session, #state{session_cache_server_max = Max, - session_cache_server = Cache, - session_cache_cb = CacheCb, - session_server_invalidator = Pid0} = State) -> - TimeStamp = erlang:monotonic_time(), - NewSession = Session#session{time_stamp = TimeStamp}, - Pid = do_register_session({Port, NewSession#session.session_id}, - NewSession, Max, Pid0, Cache, CacheCb), - State#state{session_server_invalidator = Pid}. - -do_register_session(Key, Session, Max, Pid, Cache, CacheCb) -> - try CacheCb:size(Cache) of - N when N > Max -> - invalidate_session_cache(Pid, CacheCb, Cache); - _ -> - CacheCb:update(Cache, Key, Session), - Pid - catch - error:undef -> - CacheCb:update(Cache, Key, Session), - Pid - end. - - -%% Do not let dumb clients create a gigantic session table -%% for itself creating big delays at connection time. -register_unique_session(Sessions, Session, PartialKey, - #state{session_cache_client_max = Max, - session_cache_client = Cache, - session_cache_cb = CacheCb, - session_client_invalidator = Pid0} = State) -> - case exists_equivalent(Session , Sessions) of - true -> - State; - false -> - Pid = do_register_session({PartialKey, - Session#session.session_id}, - Session, Max, Pid0, Cache, CacheCb), - State#state{session_client_invalidator = Pid} - end. - -exists_equivalent(_, []) -> - false; -exists_equivalent(#session{ - peer_certificate = PeerCert, - own_certificate = OwnCert, - compression_method = Compress, - cipher_suite = CipherSuite, - srp_username = SRP, - ecc = ECC} , - [#session{ - peer_certificate = PeerCert, - own_certificate = OwnCert, - compression_method = Compress, - cipher_suite = CipherSuite, - srp_username = SRP, - ecc = ECC} | _]) -> - true; -exists_equivalent(Session, [ _ | Rest]) -> - exists_equivalent(Session, Rest). - -start_pem_cache_validator(PemCache, CheckPoint) -> - spawn_link(?MODULE, init_pem_cache_validator, - [[get(ssl_manager), PemCache, CheckPoint]]). - -init_pem_cache_validator([SslManagerName, PemCache, CheckPoint]) -> - put(ssl_manager, SslManagerName), - ssl_pkix_db:foldl(fun pem_cache_validate/2, - CheckPoint, PemCache). - -pem_cache_validate({File, _}, CheckPoint) -> - case file:read_file_info(File, []) of - {ok, #file_info{mtime = Time}} -> - case is_before_checkpoint(Time, CheckPoint) of - true -> - ok; - false -> - invalidate_pem(File) - end; - _ -> - invalidate_pem(File) - end, - CheckPoint. - -pem_check_interval() -> - case application:get_env(ssl, ssl_pem_cache_clean) of - {ok, Interval} when is_integer(Interval) -> - Interval; - _ -> - ?CLEAR_PEM_CACHE - end. - -is_before_checkpoint(Time, CheckPoint) -> - calendar:datetime_to_gregorian_seconds( - calendar:now_to_datetime(CheckPoint)) - - calendar:datetime_to_gregorian_seconds(Time) > 0. - -add_trusted_certs(Pid, Trustedcerts, Db) -> - try - ssl_pkix_db:add_trusted_certs(Pid, Trustedcerts, Db) - catch - _:Reason -> - {error, Reason} - end. - -session_cache(client, #state{session_cache_client = Cache}) -> - Cache; -session_cache(server, #state{session_cache_server = Cache}) -> - Cache. - -crl_db_info([_,_,_,Local], {internal, Info}) -> - {Local, Info}; -crl_db_info(_, UserCRLDb) -> - UserCRLDb. - -%% Only start a session invalidator if there is not -%% one already active -invalidate_session_cache(undefined, CacheCb, Cache) -> - start_session_validator(Cache, CacheCb, {invalidate_before, erlang:monotonic_time()}); -invalidate_session_cache(Pid, _CacheCb, _Cache) -> - Pid. diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_pkix_db.erl erlang-17.3-dfsg/lib/ssl/src/ssl_pkix_db.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_pkix_db.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_pkix_db.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -28,9 +27,9 @@ -include_lib("public_key/include/public_key.hrl"). -include_lib("kernel/include/file.hrl"). --export([create/0, add_crls/3, remove_crls/2, remove/1, add_trusted_certs/3, +-export([create/0, remove/1, add_trusted_certs/3, remove_trusted_certs/2, insert/3, remove/2, clear/1, db_size/1, - ref_count/3, lookup_trusted_cert/4, foldl/3, select_cert_by_issuer/2, + ref_count/3, lookup_trusted_cert/4, foldl/3, lookup_cached_pem/2, cache_pem_file/2, cache_pem_file/3, lookup/2]). @@ -52,24 +51,16 @@ ets:new(ssl_otp_cacertificate_db, [set, public]), %% Let connection processes call ref_count/3 directly ets:new(ssl_otp_ca_file_ref, [set, public]), - ets:new(ssl_otp_pem_cache, [set, protected]), - %% Default cache - {ets:new(ssl_otp_crl_cache, [set, protected]), - ets:new(ssl_otp_crl_issuer_mapping, [bag, protected])} + ets:new(ssl_otp_pem_cache, [set, protected]) ]. %%-------------------------------------------------------------------- --spec remove([db_handle()]) -> ok. +-spec remove([db_handle()]) -> ok. %% %% Description: Removes database db %%-------------------------------------------------------------------- remove(Dbs) -> - lists:foreach(fun({Db0, Db1}) -> - true = ets:delete(Db0), - true = ets:delete(Db1); - (undefined) -> - ok; - (Db) -> + lists:foreach(fun(Db) -> true = ets:delete(Db) end, Dbs). @@ -90,10 +81,10 @@ {ok, Certs} end. -lookup_cached_pem([_, _, PemChache | _], File) -> - lookup_cached_pem(PemChache, File); -lookup_cached_pem(PemChache, File) -> - lookup(File, PemChache). +lookup_cached_pem([_, _, PemChache], MD5) -> + lookup_cached_pem(PemChache, MD5); +lookup_cached_pem(PemChache, MD5) -> + lookup(MD5, PemChache). %%-------------------------------------------------------------------- -spec add_trusted_certs(pid(), {erlang:timestamp(), string()} | @@ -103,42 +94,42 @@ %% runtime database. Returns Ref that should be handed to lookup_trusted_cert %% together with the cert serialnumber and issuer. %%-------------------------------------------------------------------- -add_trusted_certs(_Pid, {der, DerList}, [CertDb, _,_ | _]) -> +add_trusted_certs(_Pid, {der, DerList}, [CerDb, _,_]) -> NewRef = make_ref(), - add_certs_from_der(DerList, NewRef, CertDb), + add_certs_from_der(DerList, NewRef, CerDb), {ok, NewRef}; -add_trusted_certs(_Pid, File, [CertsDb, RefDb, PemChache | _] = Db) -> - case lookup_cached_pem(Db, File) of +add_trusted_certs(_Pid, File, [CertsDb, RefDb, PemChache] = Db) -> + MD5 = crypto:hash(md5, File), + case lookup_cached_pem(Db, MD5) of [{_Content, Ref}] -> ref_count(Ref, RefDb, 1), {ok, Ref}; [Content] -> Ref = make_ref(), update_counter(Ref, 1, RefDb), - insert(File, {Content, Ref}, PemChache), + insert(MD5, {Content, Ref}, PemChache), add_certs_from_pem(Content, Ref, CertsDb), {ok, Ref}; undefined -> - new_trusted_cert_entry(File, Db) + new_trusted_cert_entry({MD5, File}, Db) end. %%-------------------------------------------------------------------- %% %% Description: Cache file as binary in DB %%-------------------------------------------------------------------- --spec cache_pem_file(binary(), [db_handle()]) -> {ok, term()}. -cache_pem_file(File, [_CertsDb, _RefDb, PemChache | _]) -> +-spec cache_pem_file({binary(), binary()}, [db_handle()]) -> {ok, term()}. +cache_pem_file({MD5, File}, [_CertsDb, _RefDb, PemChache]) -> {ok, PemBin} = file:read_file(File), Content = public_key:pem_decode(PemBin), - insert(File, Content, PemChache), + insert(MD5, Content, PemChache), {ok, Content}. - --spec cache_pem_file(reference(), binary(), [db_handle()]) -> {ok, term()}. -cache_pem_file(Ref, File, [_CertsDb, _RefDb, PemChache| _]) -> +-spec cache_pem_file(reference(), {binary(), binary()}, [db_handle()]) -> {ok, term()}. +cache_pem_file(Ref, {MD5, File}, [_CertsDb, _RefDb, PemChache]) -> {ok, PemBin} = file:read_file(File), Content = public_key:pem_decode(PemBin), - insert(File, {Content, Ref}, PemChache), + insert(MD5, {Content, Ref}, PemChache), {ok, Content}. %%-------------------------------------------------------------------- @@ -159,15 +150,6 @@ ok. %%-------------------------------------------------------------------- --spec remove(term(), term(), db_handle()) -> ok. -%% -%% Description: Removes an element in a . -%%-------------------------------------------------------------------- -remove(Key, Data, Db) -> - ets:delete_object(Db, {Key, Data}), - ok. - -%%-------------------------------------------------------------------- -spec lookup(term(), db_handle()) -> [term()] | undefined. %% %% Description: Looks up an element in a . @@ -194,10 +176,6 @@ foldl(Fun, Acc0, Cache) -> ets:foldl(Fun, Acc0, Cache). - -select_cert_by_issuer(Cache, Issuer) -> - ets:select(Cache, [{{{'_','_', Issuer},{'_', '$1'}},[],['$$']}]). - %%-------------------------------------------------------------------- -spec ref_count(term(), db_handle(), integer()) -> integer(). %% @@ -267,39 +245,9 @@ error_logger:info_report(Report) end. -new_trusted_cert_entry(File, [CertsDb, RefDb, _ | _] = Db) -> +new_trusted_cert_entry(FileRef, [CertsDb, RefDb, _] = Db) -> Ref = make_ref(), update_counter(Ref, 1, RefDb), - {ok, Content} = cache_pem_file(Ref, File, Db), + {ok, Content} = cache_pem_file(Ref, FileRef, Db), add_certs_from_pem(Content, Ref, CertsDb), {ok, Ref}. - -add_crls([_,_,_, {_, Mapping} | _], ?NO_DIST_POINT, CRLs) -> - [add_crls(CRL, Mapping) || CRL <- CRLs]; -add_crls([_,_,_, {Cache, Mapping} | _], Path, CRLs) -> - insert(Path, CRLs, Cache), - [add_crls(CRL, Mapping) || CRL <- CRLs]. - -add_crls(CRL, Mapping) -> - insert(crl_issuer(CRL), CRL, Mapping). - -remove_crls([_,_,_, {_, Mapping} | _], {?NO_DIST_POINT, CRLs}) -> - [rm_crls(CRL, Mapping) || CRL <- CRLs]; - -remove_crls([_,_,_, {Cache, Mapping} | _], Path) -> - case lookup(Path, Cache) of - undefined -> - ok; - CRLs -> - remove(Path, Cache), - [rm_crls(CRL, Mapping) || CRL <- CRLs] - end. - -rm_crls(CRL, Mapping) -> - remove(crl_issuer(CRL), CRL, Mapping). - -crl_issuer(DerCRL) -> - CRL = public_key:der_decode('CertificateList', DerCRL), - TBSCRL = CRL#'CertificateList'.tbsCertList, - TBSCRL#'TBSCertList'.issuer. - diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_record.erl erlang-17.3-dfsg/lib/ssl/src/ssl_record.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_record.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_record.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -49,8 +48,7 @@ -export([compress/3, uncompress/3, compressions/0]). %% Payload encryption/decryption --export([cipher/4, decipher/4, is_correct_mac/2, - cipher_aead/4, decipher_aead/4]). +-export([cipher/4, decipher/3, is_correct_mac/2]). -export_type([ssl_version/0, ssl_atom_version/0]). @@ -379,25 +377,7 @@ ssl_cipher:cipher(BulkCipherAlgo, CipherS0, MacHash, Fragment, Version), {CipherFragment, WriteState0#connection_state{cipher_state = CipherS1}}. %%-------------------------------------------------------------------- --spec cipher_aead(ssl_version(), iodata(), #connection_state{}, MacHash::binary()) -> - {CipherFragment::binary(), #connection_state{}}. -%% -%% Description: Payload encryption -%%-------------------------------------------------------------------- -cipher_aead(Version, Fragment, - #connection_state{cipher_state = CipherS0, - sequence_number = SeqNo, - security_parameters= - #security_parameters{bulk_cipher_algorithm = - BulkCipherAlgo} - } = WriteState0, AAD) -> - - {CipherFragment, CipherS1} = - ssl_cipher:cipher_aead(BulkCipherAlgo, CipherS0, SeqNo, AAD, Fragment, Version), - {CipherFragment, WriteState0#connection_state{cipher_state = CipherS1}}. - -%%-------------------------------------------------------------------- --spec decipher(ssl_version(), binary(), #connection_state{}, boolean()) -> {binary(), binary(), #connection_state{}} | #alert{}. +-spec decipher(ssl_version(), binary(), #connection_state{}) -> {binary(), binary(), #connection_state{}} | #alert{}. %% %% Description: Payload decryption %%-------------------------------------------------------------------- @@ -407,33 +387,14 @@ BulkCipherAlgo, hash_size = HashSz}, cipher_state = CipherS0 - } = ReadState, PaddingCheck) -> - case ssl_cipher:decipher(BulkCipherAlgo, HashSz, CipherS0, CipherFragment, Version, PaddingCheck) of + } = ReadState) -> + case ssl_cipher:decipher(BulkCipherAlgo, HashSz, CipherS0, CipherFragment, Version) of {PlainFragment, Mac, CipherS1} -> CS1 = ReadState#connection_state{cipher_state = CipherS1}, {PlainFragment, Mac, CS1}; #alert{} = Alert -> Alert end. -%%-------------------------------------------------------------------- --spec decipher_aead(ssl_version(), binary(), #connection_state{}, binary()) -> {binary(), binary(), #connection_state{}} | #alert{}. -%% -%% Description: Payload decryption -%%-------------------------------------------------------------------- -decipher_aead(Version, CipherFragment, - #connection_state{sequence_number = SeqNo, - security_parameters = - #security_parameters{bulk_cipher_algorithm = - BulkCipherAlgo}, - cipher_state = CipherS0 - } = ReadState, AAD) -> - case ssl_cipher:decipher_aead(BulkCipherAlgo, CipherS0, SeqNo, AAD, CipherFragment, Version) of - {PlainFragment, CipherS1} -> - CS1 = ReadState#connection_state{cipher_state = CipherS1}, - {PlainFragment, CS1}; - #alert{} = Alert -> - Alert - end. %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_record.hrl erlang-17.3-dfsg/lib/ssl/src/ssl_record.hrl --- erlang-18.2-dfsg/lib/ssl/src/ssl_record.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_record.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -91,14 +90,11 @@ -define('3DES', 4). -define(DES40, 5). -define(IDEA, 6). --define(AES_CBC, 7). --define(AES_GCM, 8). --define(CHACHA20_POLY1305, 9). +-define(AES, 7). %% CipherType -define(STREAM, 0). -define(BLOCK, 1). --define(AEAD, 2). %% IsExportable %-define(TRUE, 0). %% Already defined by ssl_internal.hrl diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_session_cache_api.erl erlang-17.3-dfsg/lib/ssl/src/ssl_session_cache_api.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_session_cache_api.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_session_cache_api.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,4 +32,3 @@ -callback delete(db_handle(), key()) -> any(). -callback foldl(fun(), term(), db_handle()) -> term(). -callback select_session(db_handle(), {host(), inet:port_number()} | inet:port_number()) -> [#session{}]. --callback size(db_handle()) -> integer(). diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_session_cache.erl erlang-17.3-dfsg/lib/ssl/src/ssl_session_cache.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_session_cache.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_session_cache.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2014. All Rights Reserved. +%% Copyright Ericsson AB 2008-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,13 +26,13 @@ -include("ssl_internal.hrl"). -export([init/1, terminate/1, lookup/2, update/3, delete/2, foldl/3, - select_session/2, size/1]). + select_session/2]). %%-------------------------------------------------------------------- %% Description: Return table reference. Called by ssl_manager process. %%-------------------------------------------------------------------- -init(Options) -> - ets:new(cache_name(proplists:get_value(role, Options)), [ordered_set, protected]). +init(_) -> + ets:new(cache_name(), [ordered_set, protected]). %%-------------------------------------------------------------------- %% Description: Handles cache table at termination of ssl manager. @@ -83,16 +82,10 @@ %%-------------------------------------------------------------------- select_session(Cache, PartialKey) -> ets:select(Cache, - [{{{PartialKey,'_'}, '$1'},[],['$1']}]). - -%%-------------------------------------------------------------------- -%% Description: Returns the cache size -%%-------------------------------------------------------------------- -size(Cache) -> - ets:info(Cache, size). + [{{{PartialKey,'$1'}, '$2'},[],['$$']}]). %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- -cache_name(Name) -> - list_to_atom(atom_to_list(Name) ++ "_ssl_otp_session_cache"). +cache_name() -> + ssl_otp_session_cache. diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_session.erl erlang-17.3-dfsg/lib/ssl/src/ssl_session.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_session.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_session.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -31,6 +30,8 @@ %% Internal application API -export([is_new/2, client_id/4, server_id/6, valid_session/2]). +-define('24H_in_sec', 8640). + -type seconds() :: integer(). %%-------------------------------------------------------------------- @@ -61,16 +62,13 @@ SessionId end. --spec valid_session(#session{}, seconds() | {invalidate_before, integer()}) -> boolean(). +-spec valid_session(#session{}, seconds()) -> boolean(). %% %% Description: Check that the session has not expired %%-------------------------------------------------------------------- -valid_session(#session{time_stamp = TimeStamp}, {invalidate_before, Before}) -> - TimeStamp > Before; valid_session(#session{time_stamp = TimeStamp}, LifeTime) -> - Now = erlang:monotonic_time(), - Lived = erlang:convert_time_unit(Now-TimeStamp, native, seconds), - Lived < LifeTime. + Now = calendar:datetime_to_gregorian_seconds({date(), time()}), + Now - TimeStamp < LifeTime. server_id(Port, <<>>, _SslOpts, _Cert, _, _) -> {ssl_manager:new_session_id(Port), undefined}; @@ -101,14 +99,14 @@ no_session; select_session(Sessions, #ssl_options{ciphers = Ciphers}, OwnCert) -> IsNotResumable = - fun(Session) -> + fun([_Id, Session]) -> not (resumable(Session#session.is_resumable) andalso lists:member(Session#session.cipher_suite, Ciphers) andalso (OwnCert == Session#session.own_certificate)) end, case lists:dropwhile(IsNotResumable, Sessions) of [] -> no_session; - [Session | _] -> Session#session.session_id + [[Id, _]|_] -> Id end. is_resumable(_, _, #ssl_options{reuse_sessions = false}, _, _, _, _) -> diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_socket.erl erlang-17.3-dfsg/lib/ssl/src/ssl_socket.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_socket.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_socket.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_srp.hrl erlang-17.3-dfsg/lib/ssl/src/ssl_srp.hrl --- erlang-18.2-dfsg/lib/ssl/src/ssl_srp.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_srp.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_sup.erl erlang-17.3-dfsg/lib/ssl/src/ssl_sup.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_tls_dist_proxy.erl erlang-17.3-dfsg/lib/ssl/src/ssl_tls_dist_proxy.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_tls_dist_proxy.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_tls_dist_proxy.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -48,47 +47,6 @@ connect(Ip, Port) -> gen_server:call(?MODULE, {connect, Ip, Port}, infinity). - -do_listen(Options) -> - {First,Last} = case application:get_env(kernel,inet_dist_listen_min) of - {ok,N} when is_integer(N) -> - case application:get_env(kernel, - inet_dist_listen_max) of - {ok,M} when is_integer(M) -> - {N,M}; - _ -> - {N,N} - end; - _ -> - {0,0} - end, - do_listen(First, Last, listen_options([{backlog,128}|Options])). - -do_listen(First,Last,_) when First > Last -> - {error,eaddrinuse}; -do_listen(First,Last,Options) -> - case gen_tcp:listen(First, Options) of - {error, eaddrinuse} -> - do_listen(First+1,Last,Options); - Other -> - Other - end. - -listen_options(Opts0) -> - Opts1 = - case application:get_env(kernel, inet_dist_use_interface) of - {ok, Ip} -> - [{ip, Ip} | Opts0]; - _ -> - Opts0 - end, - case application:get_env(kernel, inet_dist_listen_options) of - {ok,ListenOpts} -> - ListenOpts ++ Opts1; - _ -> - Opts1 - end. - %%==================================================================== %% gen_server callbacks %%==================================================================== @@ -103,17 +61,13 @@ handle_call({listen, Name}, _From, State) -> case gen_tcp:listen(0, [{active, false}, {packet,?PPRE}]) of {ok, Socket} -> - {ok, World} = do_listen([{active, false}, binary, {packet,?PPRE}, {reuseaddr, true}]), + {ok, World} = gen_tcp:listen(0, [{active, false}, binary, {packet,?PPRE}]), {ok, TcpAddress} = get_tcp_address(Socket), {ok, WorldTcpAddress} = get_tcp_address(World), {_,Port} = WorldTcpAddress#net_address.address, - case erl_epmd:register_node(Name, Port) of - {ok, Creation} -> - {reply, {ok, {Socket, TcpAddress, Creation}}, - State#state{listen={Socket, World}}}; - {error, _} = Error -> - {reply, Error, State} - end; + {ok, Creation} = erl_epmd:register_node(Name, Port), + {reply, {ok, {Socket, TcpAddress, Creation}}, + State#state{listen={Socket, World}}}; Error -> {reply, Error, State} end; @@ -179,7 +133,6 @@ Extra ! {accept,self(),Socket,inet,proxy}, receive {_Kernel, controller, Pid} -> - inet:setopts(Socket, [nodelay()]), ok = gen_tcp:controlling_process(Socket, Pid), flush_old_controller(Pid, Socket), Pid ! {self(), controller}; @@ -213,7 +166,7 @@ accept_loop(Proxy, Type, Listen, Extra). try_connect(Port) -> - case gen_tcp:connect({127,0,0,1}, Port, [{active, false}, {packet,?PPRE}, nodelay()]) of + case gen_tcp:connect({127,0,0,1}, Port, [{active, false}, {packet,?PPRE}]) of R = {ok, _S} -> R; {error, _R} -> @@ -223,7 +176,7 @@ setup_proxy(Ip, Port, Parent) -> process_flag(trap_exit, true), Opts = get_ssl_options(client), - case ssl:connect(Ip, Port, [{active, true}, binary, {packet,?PPRE}, nodelay()] ++ Opts) of + case ssl:connect(Ip, Port, [{active, true}, binary, {packet,?PPRE}] ++ Opts) of {ok, World} -> {ok, ErtsL} = gen_tcp:listen(0, [{active, true}, {ip, {127,0,0,1}}, binary, {packet,?PPRE}]), {ok, #net_address{address={_,LPort}}} = get_tcp_address(ErtsL), @@ -239,41 +192,25 @@ Parent ! {self(), Err} end. - -%% we may not always want the nodelay behaviour -%% %% for performance reasons - -nodelay() -> - case application:get_env(kernel, dist_nodelay) of - undefined -> - {nodelay, true}; - {ok, true} -> - {nodelay, true}; - {ok, false} -> - {nodelay, false}; - _ -> - {nodelay, true} - end. - setup_connection(World, ErtsListen) -> process_flag(trap_exit, true), {ok, TcpAddress} = get_tcp_address(ErtsListen), {_Addr,Port} = TcpAddress#net_address.address, - {ok, Erts} = gen_tcp:connect({127,0,0,1}, Port, [{active, true}, binary, {packet,?PPRE}, nodelay()]), - ssl:setopts(World, [{active,true}, {packet,?PPRE}, nodelay()]), + {ok, Erts} = gen_tcp:connect({127,0,0,1}, Port, [{active, true}, binary, {packet,?PPRE}]), + ssl:setopts(World, [{active,true}, {packet,?PPRE}]), loop_conn_setup(World, Erts). loop_conn_setup(World, Erts) -> receive {ssl, World, Data = <<$a, _/binary>>} -> gen_tcp:send(Erts, Data), - ssl:setopts(World, [{packet,?PPOST}, nodelay()]), - inet:setopts(Erts, [{packet,?PPOST}, nodelay()]), + ssl:setopts(World, [{packet,?PPOST}]), + inet:setopts(Erts, [{packet,?PPOST}]), loop_conn(World, Erts); {tcp, Erts, Data = <<$a, _/binary>>} -> ssl:send(World, Data), - ssl:setopts(World, [{packet,?PPOST}, nodelay()]), - inet:setopts(Erts, [{packet,?PPOST}, nodelay()]), + ssl:setopts(World, [{packet,?PPOST}]), + inet:setopts(Erts, [{packet,?PPOST}]), loop_conn(World, Erts); {ssl, World, Data = <<_, _/binary>>} -> gen_tcp:send(Erts, Data), @@ -290,10 +227,7 @@ {tcp_closed, Erts} -> ssl:close(World); {ssl_closed, World} -> - gen_tcp:close(Erts); - {ssl_error, World, _} -> - - ssl:close(World) + gen_tcp:close(Erts) end. loop_conn(World, Erts) -> @@ -307,9 +241,7 @@ {tcp_closed, Erts} -> ssl:close(World); {ssl_closed, World} -> - gen_tcp:close(Erts); - {ssl_error, World, _} -> - ssl:close(World) + gen_tcp:close(Erts) end. get_ssl_options(Type) -> diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_v2.erl erlang-17.3-dfsg/lib/ssl/src/ssl_v2.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_v2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_v2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/ssl_v3.erl erlang-17.3-dfsg/lib/ssl/src/ssl_v3.erl --- erlang-18.2-dfsg/lib/ssl/src/ssl_v3.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/ssl_v3.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -144,7 +143,9 @@ ?TLS_DHE_RSA_WITH_AES_128_CBC_SHA, ?TLS_DHE_DSS_WITH_AES_128_CBC_SHA, ?TLS_RSA_WITH_AES_128_CBC_SHA, - ?TLS_DHE_RSA_WITH_DES_CBC_SHA, + %%?TLS_RSA_WITH_IDEA_CBC_SHA, + ?TLS_RSA_WITH_RC4_128_SHA, + ?TLS_RSA_WITH_RC4_128_MD5, ?TLS_RSA_WITH_DES_CBC_SHA ]. diff -Nru erlang-18.2-dfsg/lib/ssl/src/tls_connection.erl erlang-17.3-dfsg/lib/ssl/src/tls_connection.erl --- erlang-18.2-dfsg/lib/ssl/src/tls_connection.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/tls_connection.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -54,7 +53,7 @@ %% Alert and close handling -export([send_alert/2, handle_own_alert/4, handle_close_alert/3, handle_normal_shutdown/3, handle_unexpected_message/3, - close/5, alert_user/6, alert_user/9 + workaround_transport_delivery_problems/2, alert_user/6, alert_user/9 ]). %% Data handling @@ -168,10 +167,9 @@ Cache, CacheCb, Renegotiation, Cert), Version = Hello#client_hello.client_version, - HelloVersion = tls_record:lowest_protocol_version(SslOpts#ssl_options.versions), Handshake0 = ssl_handshake:init_handshake_history(), {BinMsg, ConnectionStates, Handshake} = - encode_handshake(Hello, HelloVersion, ConnectionStates0, Handshake0), + encode_handshake(Hello, Version, ConnectionStates0, Handshake0), Transport:send(Socket, BinMsg), State1 = State0#state{connection_states = ConnectionStates, negotiated_version = Version, %% Requested version @@ -190,29 +188,21 @@ renegotiation = {Renegotiation, _}, session_cache = Cache, session_cache_cb = CacheCb, - negotiated_protocol = CurrentProtocol, ssl_options = SslOpts}) -> case tls_handshake:hello(Hello, SslOpts, {Port, Session0, Cache, CacheCb, ConnectionStates0, Cert}, Renegotiation) of - #alert{} = Alert -> - handle_own_alert(Alert, ClientVersion, hello, State); {Version, {Type, Session}, - ConnectionStates, Protocol0, ServerHelloExt} -> - - Protocol = case Protocol0 of - undefined -> CurrentProtocol; - _ -> Protocol0 - end, - + ConnectionStates, ServerHelloExt} -> HashSign = ssl_handshake:select_hashsign(HashSigns, Cert, Version), ssl_connection:hello({common_client_hello, Type, ServerHelloExt, HashSign}, State#state{connection_states = ConnectionStates, negotiated_version = Version, session = Session, - client_ecc = {EllipticCurves, EcPointFormats}, - negotiated_protocol = Protocol}, ?MODULE) + client_ecc = {EllipticCurves, EcPointFormats}}, ?MODULE); + #alert{} = Alert -> + handle_own_alert(Alert, ClientVersion, hello, State) end; -hello(Hello = #server_hello{}, +hello(Hello, #state{connection_states = ConnectionStates0, negotiated_version = ReqVersion, role = client, @@ -221,9 +211,9 @@ case tls_handshake:hello(Hello, SslOptions, ConnectionStates0, Renegotiation) of #alert{} = Alert -> handle_own_alert(Alert, ReqVersion, hello, State); - {Version, NewId, ConnectionStates, ProtoExt, Protocol} -> + {Version, NewId, ConnectionStates, NextProtocol} -> ssl_connection:handle_session(Hello, - Version, NewId, ConnectionStates, ProtoExt, Protocol, State) + Version, NewId, ConnectionStates, NextProtocol, State) end; hello(Msg, State) -> @@ -394,30 +384,12 @@ user_data_buffer = <<>>, session_cache_cb = SessionCacheCb, renegotiation = {false, first}, - allow_renegotiate = SSLOptions#ssl_options.client_renegotiation, start_or_recv_from = undefined, send_queue = queue:new(), protocol_cb = ?MODULE, tracker = Tracker }. - -update_ssl_options_from_sni(OrigSSLOptions, SNIHostname) -> - SSLOption = - case OrigSSLOptions#ssl_options.sni_fun of - undefined -> - proplists:get_value(SNIHostname, - OrigSSLOptions#ssl_options.sni_hosts); - SNIFun -> - SNIFun(SNIHostname) - end, - case SSLOption of - undefined -> - undefined; - _ -> - ssl:handle_options(SSLOption, OrigSSLOptions) - end. - next_state(Current,_, #alert{} = Alert, #state{negotiated_version = Version} = State) -> handle_own_alert(Alert, Version, Current, State); @@ -446,17 +418,15 @@ %% This message should not be included in handshake %% message hashes. Already in negotiation so it will be ignored! ?MODULE:SName(Packet, State); - ({#client_hello{} = Packet, Raw}, {next_state, connection = SName, HState0}) -> - HState = handle_sni_extension(Packet, HState0), + ({#client_hello{} = Packet, Raw}, {next_state, connection = SName, State}) -> Version = Packet#client_hello.client_version, Hs0 = ssl_handshake:init_handshake_history(), Hs1 = ssl_handshake:update_handshake_history(Hs0, Raw), - ?MODULE:SName(Packet, HState#state{tls_handshake_history=Hs1, - renegotiation = {true, peer}}); - ({Packet, Raw}, {next_state, SName, HState0 = #state{tls_handshake_history=Hs0}}) -> - HState = handle_sni_extension(Packet, HState0), + ?MODULE:SName(Packet, State#state{tls_handshake_history=Hs1, + renegotiation = {true, peer}}); + ({Packet, Raw}, {next_state, SName, State = #state{tls_handshake_history=Hs0}}) -> Hs1 = ssl_handshake:update_handshake_history(Hs0, Raw), - ?MODULE:SName(Packet, HState#state{tls_handshake_history=Hs1}); + ?MODULE:SName(Packet, State#state{tls_handshake_history=Hs1}); (_, StopState) -> StopState end, try @@ -512,9 +482,8 @@ next_record(#state{protocol_buffers = #protocol_buffers{tls_packets = [], tls_cipher_texts = [CT | Rest]} = Buffers, - connection_states = ConnStates0, - ssl_options = #ssl_options{padding_check = Check}} = State) -> - case tls_record:decode_cipher_text(CT, ConnStates0, Check) of + connection_states = ConnStates0} = State) -> + case tls_record:decode_cipher_text(CT, ConnStates0) of {Plain, ConnStates} -> {Plain, State#state{protocol_buffers = Buffers#protocol_buffers{tls_cipher_texts = Rest}, @@ -925,7 +894,8 @@ try %% Try to tell the other side {BinMsg, _} = ssl_alert:encode(Alert, Version, ConnectionStates), - Transport:send(Socket, BinMsg) + Transport:send(Socket, BinMsg), + workaround_transport_delivery_problems(Socket, Transport) catch _:_ -> %% Can crash if we are in a uninitialized state ignore end, @@ -977,57 +947,21 @@ invalidate_session(server, _, Port, Session) -> ssl_manager:invalidate_session(Port, Session). -%% User downgrades connection -%% When downgrading an TLS connection to a transport connection -%% we must recive the close message before releasing the -%% transport socket. -close({close, {Pid, Timeout}}, Socket, Transport, ConnectionStates, Check) when is_pid(Pid) -> - ssl_socket:setopts(Transport, Socket, [{active, false}, {packet, ssl_tls}]), - case Transport:recv(Socket, 0, Timeout) of - {ok, {ssl_tls, Socket, ?ALERT, Version, Fragment}} -> - case tls_record:decode_cipher_text(#ssl_tls{type = ?ALERT, - version = Version, - fragment = Fragment - }, ConnectionStates, Check) of - {#ssl_tls{fragment = Plain}, _} -> - [Alert| _] = decode_alerts(Plain), - downgrade(Alert, Transport, Socket, Pid) - end; - {error, timeout} -> - {error, timeout}; - _ -> - {error, no_tls_close} - end; -%% User closes or recursive call! -close({close, Timeout}, Socket, Transport = gen_tcp, _,_) -> - ssl_socket:setopts(Transport, Socket, [{active, false}]), - Transport:shutdown(Socket, write), - _ = Transport:recv(Socket, 0, Timeout), - ok; -%% Peer closed socket -close({shutdown, transport_closed}, Socket, Transport = gen_tcp, ConnectionStates, Check) -> - close({close, 0}, Socket, Transport, ConnectionStates, Check); -%% We generate fatal alert -close({shutdown, own_alert}, Socket, Transport = gen_tcp, ConnectionStates, Check) -> +workaround_transport_delivery_problems(Socket, gen_tcp = Transport) -> %% Standard trick to try to make sure all %% data sent to the tcp port is really delivered to the %% peer application before tcp port is closed so that the peer will %% get the correct TLS alert message and not only a transport close. - %% Will return when other side has closed or after timout millisec + ssl_socket:setopts(Transport, Socket, [{active, false}]), + Transport:shutdown(Socket, write), + %% Will return when other side has closed or after 30 s %% e.g. we do not want to hang if something goes wrong %% with the network but we want to maximise the odds that %% peer application gets all data sent on the tcp connection. - close({close, ?DEFAULT_TIMEOUT}, Socket, Transport, ConnectionStates, Check); -%% Other -close(_, Socket, Transport, _,_) -> + Transport:recv(Socket, 0, 30000); +workaround_transport_delivery_problems(Socket, Transport) -> Transport:close(Socket). -downgrade(#alert{description = ?CLOSE_NOTIFY}, Transport, Socket, Pid) -> - ssl_socket:setopts(Transport, Socket, [{active, false}, {packet, 0}, {mode, binary}]), - Transport:controlling_process(Socket, Pid), - {ok, Socket}; -downgrade(_, _,_,_) -> - {error, no_tls_close}. - + convert_state(#state{ssl_options = Options} = State, up, "5.3.5", "5.3.6") -> State#state{ssl_options = convert_options_partial_chain(Options, up)}; convert_state(#state{ssl_options = Options} = State, down, "5.3.6", "5.3.5") -> @@ -1038,32 +972,3 @@ list_to_tuple(Head ++ [{partial_chain, fun(_) -> unknown_ca end}] ++ Tail); convert_options_partial_chain(Options, down) -> list_to_tuple(proplists:delete(partial_chain, tuple_to_list(Options))). - -handle_sni_extension(#client_hello{extensions = HelloExtensions}, State0) -> - case HelloExtensions#hello_extensions.sni of - undefined -> - State0; - #sni{hostname = Hostname} -> - NewOptions = update_ssl_options_from_sni(State0#state.ssl_options, Hostname), - case NewOptions of - undefined -> - State0; - _ -> - {ok, Ref, CertDbHandle, FileRefHandle, CacheHandle, CRLDbHandle, OwnCert, Key, DHParams} = - ssl_config:init(NewOptions, State0#state.role), - State0#state{ - session = State0#state.session#session{own_certificate = OwnCert}, - file_ref_db = FileRefHandle, - cert_db_ref = Ref, - cert_db = CertDbHandle, - crl_db = CRLDbHandle, - session_cache = CacheHandle, - private_key = Key, - diffie_hellman_params = DHParams, - ssl_options = NewOptions, - sni_hostname = Hostname - } - end - end; -handle_sni_extension(_, State0) -> - State0. diff -Nru erlang-18.2-dfsg/lib/ssl/src/tls_connection.hrl erlang-17.3-dfsg/lib/ssl/src/tls_connection.hrl --- erlang-18.2-dfsg/lib/ssl/src/tls_connection.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/tls_connection.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/tls_connection_sup.erl erlang-17.3-dfsg/lib/ssl/src/tls_connection_sup.erl --- erlang-18.2-dfsg/lib/ssl/src/tls_connection_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/tls_connection_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/tls.erl erlang-17.3-dfsg/lib/ssl/src/tls.erl --- erlang-18.2-dfsg/lib/ssl/src/tls.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/tls.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/tls_handshake.erl erlang-17.3-dfsg/lib/ssl/src/tls_handshake.erl --- erlang-18.2-dfsg/lib/ssl/src/tls_handshake.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/tls_handshake.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,7 +28,6 @@ -include("tls_record.hrl"). -include("ssl_alert.hrl"). -include("ssl_internal.hrl"). --include("ssl_cipher.hrl"). -include_lib("public_key/include/public_key.hrl"). -export([client_hello/8, hello/4, @@ -49,28 +47,22 @@ %%-------------------------------------------------------------------- client_hello(Host, Port, ConnectionStates, #ssl_options{versions = Versions, - ciphers = UserSuites, - fallback = Fallback + ciphers = UserSuites } = SslOpts, Cache, CacheCb, Renegotiation, OwnCert) -> Version = tls_record:highest_protocol_version(Versions), Pending = ssl_record:pending_connection_state(ConnectionStates, read), SecParams = Pending#connection_state.security_parameters, - AvailableCipherSuites = ssl_handshake:available_suites(UserSuites, Version), + CipherSuites = ssl_handshake:available_suites(UserSuites, Version), Extensions = ssl_handshake:client_hello_extensions(Host, Version, - AvailableCipherSuites, + CipherSuites, SslOpts, ConnectionStates, Renegotiation), - CipherSuites = - case Fallback of - true -> - [?TLS_FALLBACK_SCSV | ssl_handshake:cipher_suites(AvailableCipherSuites, Renegotiation)]; - false -> - ssl_handshake:cipher_suites(AvailableCipherSuites, Renegotiation) - end, - Id = ssl_session:client_id({Host, Port, SslOpts}, Cache, CacheCb, OwnCert), + + Id = ssl_session:client_id({Host, Port, SslOpts}, Cache, CacheCb, OwnCert), + #client_hello{session_id = Id, client_version = Version, - cipher_suites = CipherSuites, + cipher_suites = ssl_handshake:cipher_suites(CipherSuites, Renegotiation), compression_methods = ssl_record:compressions(), random = SecParams#security_parameters.client_random, extensions = Extensions @@ -79,14 +71,12 @@ %%-------------------------------------------------------------------- -spec hello(#server_hello{} | #client_hello{}, #ssl_options{}, #connection_states{} | {inet:port_number(), #session{}, db_handle(), - atom(), #connection_states{}, - binary() | undefined}, + atom(), #connection_states{}, binary() | undefined}, boolean()) -> - {tls_record:tls_version(), session_id(), - #connection_states{}, alpn | npn, binary() | undefined}| - {tls_record:tls_version(), {resumed | new, #session{}}, - #connection_states{}, binary() | undefined, - #hello_extensions{}} | + {tls_record:tls_version(), session_id(), #connection_states{}, binary() | undefined}| + {tls_record:tls_version(), {resumed | new, #session{}}, #connection_states{}, + [binary()] | undefined, + [ssl_handshake:oid()] | undefined, [ssl_handshake:oid()] | undefined} | #alert{}. %% %% Description: Handles a recieved hello message @@ -106,22 +96,33 @@ end; hello(#client_hello{client_version = ClientVersion, - cipher_suites = CipherSuites} = Hello, + session_id = SugesstedId, + cipher_suites = CipherSuites, + compression_methods = Compressions, + random = Random, + extensions = #hello_extensions{elliptic_curves = Curves} = HelloExt}, #ssl_options{versions = Versions} = SslOpts, - Info, Renegotiation) -> + {Port, Session0, Cache, CacheCb, ConnectionStates0, Cert}, Renegotiation) -> Version = ssl_handshake:select_version(tls_record, ClientVersion, Versions), - case ssl_cipher:is_fallback(CipherSuites) of - true -> - Highest = tls_record:highest_protocol_version(Versions), - case tls_record:is_higher(Highest, Version) of - true -> - ?ALERT_REC(?FATAL, ?INAPPROPRIATE_FALLBACK); - false -> - handle_client_hello(Version, Hello, SslOpts, Info, Renegotiation) + case tls_record:is_acceptable_version(Version, Versions) of + true -> + ECCCurve = ssl_handshake:select_curve(Curves, ssl_handshake:supported_ecc(Version)), + {Type, #session{cipher_suite = CipherSuite} = Session1} + = ssl_handshake:select_session(SugesstedId, CipherSuites, Compressions, + Port, Session0#session{ecc = ECCCurve}, Version, + SslOpts, Cache, CacheCb, Cert), + case CipherSuite of + no_suite -> + ?ALERT_REC(?FATAL, ?INSUFFICIENT_SECURITY); + _ -> + handle_client_hello_extensions(Version, Type, Random, CipherSuites, HelloExt, + SslOpts, Session1, ConnectionStates0, + Renegotiation) end; false -> - handle_client_hello(Version, Hello, SslOpts, Info, Renegotiation) + ?ALERT_REC(?FATAL, ?PROTOCOL_VERSION) end. + %%-------------------------------------------------------------------- -spec encode_handshake(tls_handshake(), tls_record:tls_version()) -> iolist(). %% @@ -148,32 +149,6 @@ %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- -handle_client_hello(Version, #client_hello{session_id = SugesstedId, - cipher_suites = CipherSuites, - compression_methods = Compressions, - random = Random, - extensions = #hello_extensions{elliptic_curves = Curves} = HelloExt}, - #ssl_options{versions = Versions} = SslOpts, - {Port, Session0, Cache, CacheCb, ConnectionStates0, Cert}, Renegotiation) -> - case tls_record:is_acceptable_version(Version, Versions) of - true -> - ECCCurve = ssl_handshake:select_curve(Curves, ssl_handshake:supported_ecc(Version)), - {Type, #session{cipher_suite = CipherSuite} = Session1} - = ssl_handshake:select_session(SugesstedId, CipherSuites, Compressions, - Port, Session0#session{ecc = ECCCurve}, Version, - SslOpts, Cache, CacheCb, Cert), - case CipherSuite of - no_suite -> - ?ALERT_REC(?FATAL, ?INSUFFICIENT_SECURITY); - _ -> - handle_client_hello_extensions(Version, Type, Random, CipherSuites, HelloExt, - SslOpts, Session1, ConnectionStates0, - Renegotiation) - end; - false -> - ?ALERT_REC(?FATAL, ?PROTOCOL_VERSION) - end. - get_tls_handshake_aux(Version, <>, Acc) -> Raw = <>, @@ -249,10 +224,8 @@ try ssl_handshake:handle_client_hello_extensions(tls_record, Random, CipherSuites, HelloExt, Version, SslOpts, Session0, ConnectionStates0, Renegotiation) of - #alert{} = Alert -> - Alert; - {Session, ConnectionStates, Protocol, ServerHelloExt} -> - {Version, {Type, Session}, ConnectionStates, Protocol, ServerHelloExt} + {Session, ConnectionStates, ServerHelloExt} -> + {Version, {Type, Session}, ConnectionStates, ServerHelloExt} catch throw:Alert -> Alert end. @@ -265,7 +238,7 @@ SslOpt, ConnectionStates0, Renegotiation) of #alert{} = Alert -> Alert; - {ConnectionStates, ProtoExt, Protocol} -> - {Version, SessionId, ConnectionStates, ProtoExt, Protocol} + {ConnectionStates, Protocol} -> + {Version, SessionId, ConnectionStates, Protocol} end. diff -Nru erlang-18.2-dfsg/lib/ssl/src/tls_handshake.hrl erlang-17.3-dfsg/lib/ssl/src/tls_handshake.hrl --- erlang-18.2-dfsg/lib/ssl/src/tls_handshake.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/tls_handshake.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/tls_record.erl erlang-17.3-dfsg/lib/ssl/src/tls_record.erl --- erlang-18.2-dfsg/lib/ssl/src/tls_record.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/tls_record.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -35,15 +34,14 @@ -export([get_tls_records/2]). %% Decoding --export([decode_cipher_text/3]). +-export([decode_cipher_text/2]). %% Encoding -export([encode_plain_text/4]). %% Protocol version handling --export([protocol_version/1, lowest_protocol_version/1, lowest_protocol_version/2, - highest_protocol_version/1, highest_protocol_version/2, - is_higher/2, supported_protocol_versions/0, +-export([protocol_version/1, lowest_protocol_version/2, + highest_protocol_version/1, supported_protocol_versions/0, is_acceptable_version/1, is_acceptable_version/2]). -export_type([tls_version/0, tls_atom_version/0]). @@ -134,23 +132,6 @@ sequence_number = Seq, compression_state=CompS0, security_parameters= - #security_parameters{ - cipher_type = ?AEAD, - compression_algorithm=CompAlg} - }= WriteState0} = ConnectionStates) -> - {Comp, CompS1} = ssl_record:compress(CompAlg, Data, CompS0), - WriteState1 = WriteState0#connection_state{compression_state = CompS1}, - AAD = calc_aad(Type, Version, WriteState1), - {CipherFragment, WriteState} = ssl_record:cipher_aead(Version, Comp, WriteState1, AAD), - CipherText = encode_tls_cipher_text(Type, Version, CipherFragment), - {CipherText, ConnectionStates#connection_states{current_write = WriteState#connection_state{sequence_number = Seq +1}}}; - -encode_plain_text(Type, Version, Data, - #connection_states{current_write = - #connection_state{ - sequence_number = Seq, - compression_state=CompS0, - security_parameters= #security_parameters{compression_algorithm=CompAlg} }= WriteState0} = ConnectionStates) -> {Comp, CompS1} = ssl_record:compress(CompAlg, Data, CompS0), @@ -161,51 +142,24 @@ {CipherText, ConnectionStates#connection_states{current_write = WriteState#connection_state{sequence_number = Seq +1}}}. %%-------------------------------------------------------------------- --spec decode_cipher_text(#ssl_tls{}, #connection_states{}, boolean()) -> +-spec decode_cipher_text(#ssl_tls{}, #connection_states{}) -> {#ssl_tls{}, #connection_states{}}| #alert{}. %% %% Description: Decode cipher text %%-------------------------------------------------------------------- decode_cipher_text(#ssl_tls{type = Type, version = Version, - fragment = CipherFragment} = CipherText, - #connection_states{current_read = - #connection_state{ - compression_state = CompressionS0, - sequence_number = Seq, - security_parameters= - #security_parameters{ - cipher_type = ?AEAD, - compression_algorithm=CompAlg} - } = ReadState0} = ConnnectionStates0, _) -> - AAD = calc_aad(Type, Version, ReadState0), - case ssl_record:decipher_aead(Version, CipherFragment, ReadState0, AAD) of - {PlainFragment, ReadState1} -> - {Plain, CompressionS1} = ssl_record:uncompress(CompAlg, - PlainFragment, CompressionS0), - ConnnectionStates = ConnnectionStates0#connection_states{ - current_read = ReadState1#connection_state{ - sequence_number = Seq + 1, - compression_state = CompressionS1}}, - {CipherText#ssl_tls{fragment = Plain}, ConnnectionStates}; - #alert{} = Alert -> - Alert - end; - -decode_cipher_text(#ssl_tls{type = Type, version = Version, - fragment = CipherFragment} = CipherText, - #connection_states{current_read = - #connection_state{ - compression_state = CompressionS0, - sequence_number = Seq, - security_parameters= - #security_parameters{compression_algorithm=CompAlg} - } = ReadState0} = ConnnectionStates0, PaddingCheck) -> - case ssl_record:decipher(Version, CipherFragment, ReadState0, PaddingCheck) of + fragment = CipherFragment} = CipherText, ConnnectionStates0) -> + ReadState0 = ConnnectionStates0#connection_states.current_read, + #connection_state{compression_state = CompressionS0, + sequence_number = Seq, + security_parameters = SecParams} = ReadState0, + CompressAlg = SecParams#security_parameters.compression_algorithm, + case ssl_record:decipher(Version, CipherFragment, ReadState0) of {PlainFragment, Mac, ReadState1} -> MacHash = calc_mac_hash(Type, Version, PlainFragment, ReadState1), case ssl_record:is_correct_mac(Mac, MacHash) of true -> - {Plain, CompressionS1} = ssl_record:uncompress(CompAlg, + {Plain, CompressionS1} = ssl_record:uncompress(CompressAlg, PlainFragment, CompressionS0), ConnnectionStates = ConnnectionStates0#connection_states{ current_read = ReadState1#connection_state{ @@ -258,18 +212,6 @@ Version; lowest_protocol_version(_,Version) -> Version. - -%%-------------------------------------------------------------------- --spec lowest_protocol_version([tls_version()]) -> tls_version(). -%% -%% Description: Lowest protocol version present in a list -%%-------------------------------------------------------------------- -lowest_protocol_version([]) -> - lowest_protocol_version(); -lowest_protocol_version(Versions) -> - [Ver | Vers] = Versions, - lowest_list_protocol_version(Ver, Vers). - %%-------------------------------------------------------------------- -spec highest_protocol_version([tls_version()]) -> tls_version(). %% @@ -279,35 +221,18 @@ highest_protocol_version(); highest_protocol_version(Versions) -> [Ver | Vers] = Versions, - highest_list_protocol_version(Ver, Vers). + highest_protocol_version(Ver, Vers). -%%-------------------------------------------------------------------- --spec highest_protocol_version(tls_version(), tls_version()) -> tls_version(). -%% -%% Description: Highest protocol version of two given versions -%%-------------------------------------------------------------------- -highest_protocol_version(Version = {M, N}, {M, O}) when N > O -> - Version; -highest_protocol_version({M, _}, - Version = {M, _}) -> - Version; -highest_protocol_version(Version = {M,_}, - {N, _}) when M > N -> +highest_protocol_version(Version, []) -> Version; -highest_protocol_version(_,Version) -> - Version. - -%%-------------------------------------------------------------------- --spec is_higher(V1 :: tls_version(), V2::tls_version()) -> boolean(). -%% -%% Description: Is V1 > V2 -%%-------------------------------------------------------------------- -is_higher({M, N}, {M, O}) when N > O -> - true; -is_higher({M, _}, {N, _}) when M > N -> - true; -is_higher(_, _) -> - false. +highest_protocol_version(Version = {N, M}, [{N, O} | Rest]) when M > O -> + highest_protocol_version(Version, Rest); +highest_protocol_version({M, _}, [Version = {M, _} | Rest]) -> + highest_protocol_version(Version, Rest); +highest_protocol_version(Version = {M,_}, [{N,_} | Rest]) when M > N -> + highest_protocol_version(Version, Rest); +highest_protocol_version(_, [Version | Rest]) -> + highest_protocol_version(Version, Rest). %%-------------------------------------------------------------------- -spec supported_protocol_versions() -> [tls_version()]. @@ -342,17 +267,8 @@ Vsns; supported_protocol_versions([_|_] = Vsns) -> - case sufficient_tlsv1_2_crypto_support() of - true -> - Vsns; - false -> - case Vsns -- ['tlsv1.2'] of - [] -> - ?MIN_SUPPORTED_VERSIONS; - NewVsns -> - NewVsns - end - end. + Vsns. + %%-------------------------------------------------------------------- %% %% Description: ssl version 2 is not acceptable security risks are too big. @@ -375,17 +291,6 @@ %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- - -lowest_list_protocol_version(Ver, []) -> - Ver; -lowest_list_protocol_version(Ver1, [Ver2 | Rest]) -> - lowest_list_protocol_version(lowest_protocol_version(Ver1, Ver2), Rest). - -highest_list_protocol_version(Ver, []) -> - Ver; -highest_list_protocol_version(Ver1, [Ver2 | Rest]) -> - highest_list_protocol_version(highest_protocol_version(Ver1, Ver2), Rest). - encode_tls_cipher_text(Type, {MajVer, MinVer}, Fragment) -> Length = erlang:iolist_size(Fragment), [<>, Fragment]. @@ -404,10 +309,6 @@ highest_protocol_version() -> highest_protocol_version(supported_protocol_versions()). -lowest_protocol_version() -> - lowest_protocol_version(supported_protocol_versions()). - - sufficient_tlsv1_2_crypto_support() -> CryptoSupport = crypto:supports(), proplists:get_bool(sha256, proplists:get_value(hashs, CryptoSupport)). @@ -421,7 +322,3 @@ mac_hash(Version, SecPars#security_parameters.mac_algorithm, MacSecret, SeqNo, Type, Length, PlainFragment). - -calc_aad(Type, {MajVer, MinVer}, - #connection_state{sequence_number = SeqNo}) -> - <>. diff -Nru erlang-18.2-dfsg/lib/ssl/src/tls_record.hrl erlang-17.3-dfsg/lib/ssl/src/tls_record.hrl --- erlang-18.2-dfsg/lib/ssl/src/tls_record.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/tls_record.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/ssl/src/tls_v1.erl erlang-17.3-dfsg/lib/ssl/src/tls_v1.erl --- erlang-18.2-dfsg/lib/ssl/src/tls_v1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/src/tls_v1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -209,55 +208,38 @@ ?TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, ?TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, ?TLS_RSA_WITH_AES_128_CBC_SHA, + + ?TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, + ?TLS_ECDHE_RSA_WITH_RC4_128_SHA, + ?TLS_RSA_WITH_RC4_128_SHA, + ?TLS_RSA_WITH_RC4_128_MD5, ?TLS_DHE_RSA_WITH_DES_CBC_SHA, + ?TLS_ECDH_ECDSA_WITH_RC4_128_SHA, + ?TLS_ECDH_RSA_WITH_RC4_128_SHA, + ?TLS_RSA_WITH_DES_CBC_SHA ]; suites(3) -> [ - ?TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, - ?TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, - - ?TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, - ?TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, ?TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, ?TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, - ?TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, - ?TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, ?TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, ?TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, - ?TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, - ?TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, - ?TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, ?TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, ?TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, - ?TLS_RSA_WITH_AES_256_GCM_SHA384, ?TLS_RSA_WITH_AES_256_CBC_SHA256, - ?TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, - ?TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, ?TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, ?TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, - ?TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, - ?TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, ?TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, ?TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, - ?TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, - ?TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, ?TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, ?TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, - ?TLS_RSA_WITH_AES_128_GCM_SHA256, ?TLS_RSA_WITH_AES_128_CBC_SHA256 - - %% not supported - %% ?TLS_DH_RSA_WITH_AES_256_GCM_SHA384, - %% ?TLS_DH_DSS_WITH_AES_256_GCM_SHA384, - %% ?TLS_DH_RSA_WITH_AES_128_GCM_SHA256, - %% ?TLS_DH_DSS_WITH_AES_128_GCM_SHA256 ] ++ suites(2). - %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/ssl/test/erl_make_certs.erl erlang-17.3-dfsg/lib/ssl/test/erl_make_certs.erl --- erlang-18.2-dfsg/lib/ssl/test/erl_make_certs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/erl_make_certs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2011-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -115,7 +114,7 @@ #'DSAPrivateKey'{p=P, q=Q, g=G, y=Y} -> public_key:pkix_verify(DerEncodedCert, {Y, #'Dss-Parms'{p=P, q=Q, g=G}}); #'ECPrivateKey'{version = _Version, privateKey = _PrivKey, - parameters = Params, publicKey = PubKey} -> + parameters = Params, publicKey = {0, PubKey}} -> public_key:pkix_verify(DerEncodedCert, {#'ECPoint'{point = PubKey}, Params}) end. @@ -205,7 +204,7 @@ Subject. subject(undefined, IsRootCA) -> - User = if IsRootCA -> "RootCA"; true -> os:getenv("USER", "test_user") end, + User = if IsRootCA -> "RootCA"; true -> user() end, Opts = [{email, User ++ "@erlang.org"}, {name, User}, {city, "Stockholm"}, @@ -216,6 +215,14 @@ subject(Opts, _) -> subject(Opts). +user() -> + case os:getenv("USER") of + false -> + "test_user"; + User -> + User + end. + subject(SubjectOpts) when is_list(SubjectOpts) -> Encode = fun(Opt) -> {Type,Value} = subject_enc(Opt), @@ -293,7 +300,7 @@ publickey(#'ECPrivateKey'{version = _Version, privateKey = _PrivKey, parameters = Params, - publicKey = PubKey}) -> + publicKey = {0, PubKey}}) -> Algo = #'PublicKeyAlgorithm'{algorithm= ?'id-ecPublicKey', parameters=Params}, #'OTPSubjectPublicKeyInfo'{algorithm = Algo, subjectPublicKey = #'ECPoint'{point = PubKey}}. @@ -402,9 +409,9 @@ {PubKey, PrivKey} = crypto:generate_key(ecdh, CurveId), #'ECPrivateKey'{version = 1, - privateKey = PrivKey, + privateKey = binary_to_list(PrivKey), parameters = {namedCurve, pubkey_cert_records:namedCurves(CurveId)}, - publicKey = PubKey}. + publicKey = {0, PubKey}}. %% See fips_186-3.pdf dsa_search(T, P0, Q, Iter) when Iter > 0 -> diff -Nru erlang-18.2-dfsg/lib/ssl/test/make_certs.erl erlang-17.3-dfsg/lib/ssl/test/make_certs.erl --- erlang-18.2-dfsg/lib/ssl/test/make_certs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/make_certs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -82,7 +81,7 @@ create_rnd(DataDir, PrivDir), % For all requests rootCA(PrivDir, "erlangCA", C), intermediateCA(PrivDir, "otpCA", "erlangCA", C), - endusers(PrivDir, "otpCA", ["client", "server", "revoked", "a.server", "b.server"], C), + endusers(PrivDir, "otpCA", ["client", "server", "revoked"], C), endusers(PrivDir, "erlangCA", ["localhost"], C), %% Create keycert files SDir = filename:join([PrivDir, "server"]), @@ -116,16 +115,16 @@ do_append_files(Fs, RF). rootCA(Root, Name, C) -> - create_ca_dir(Root, Name, ca_cnf(Root, C#config{commonName = Name})), - create_self_signed_cert(Root, Name, req_cnf(Root, C#config{commonName = Name}), C), + create_ca_dir(Root, Name, ca_cnf(C#config{commonName = Name})), + create_self_signed_cert(Root, Name, req_cnf(C#config{commonName = Name}), C), file:copy(filename:join([Root, Name, "cert.pem"]), filename:join([Root, Name, "cacerts.pem"])), gencrl(Root, Name, C). intermediateCA(Root, CA, ParentCA, C) -> - create_ca_dir(Root, CA, ca_cnf(Root, C#config{commonName = CA})), + create_ca_dir(Root, CA, ca_cnf(C#config{commonName = CA})), CARoot = filename:join([Root, CA]), CnfFile = filename:join([CARoot, "req.cnf"]), - file:write_file(CnfFile, req_cnf(Root, C#config{commonName = CA})), + file:write_file(CnfFile, req_cnf(C#config{commonName = CA})), KeyFile = filename:join([CARoot, "private", "key.pem"]), ReqFile = filename:join([CARoot, "req.pem"]), create_req(Root, CnfFile, KeyFile, ReqFile, C), @@ -147,7 +146,7 @@ UsrRoot = filename:join([Root, User]), file:make_dir(UsrRoot), CnfFile = filename:join([UsrRoot, "req.cnf"]), - file:write_file(CnfFile, req_cnf(Root, C#config{commonName = User})), + file:write_file(CnfFile, req_cnf(C#config{commonName = User})), KeyFile = filename:join([UsrRoot, "key.pem"]), ReqFile = filename:join([UsrRoot, "req.pem"]), create_req(Root, CnfFile, KeyFile, ReqFile, C), @@ -325,9 +324,8 @@ ok end, receive - {Port, {exit_status, 0}} -> - ok; - {Port, {exit_status, Status}} -> + {Port, {exit_status, Status}} when Status /= 0 -> + %% io:fwrite("exit status: ~w~n", [Status]), exit({eval_cmd, Cmd, Status}) after 0 -> ok @@ -337,10 +335,10 @@ %% Contents of configuration files %% -req_cnf(Root, C) -> +req_cnf(C) -> ["# Purpose: Configuration for requests (end users and CAs)." "\n" - "ROOTDIR = " ++ Root ++ "\n" + "ROOTDIR = $ENV::ROOTDIR\n" "\n" "[req]\n" @@ -371,10 +369,10 @@ "subjectKeyIdentifier = hash\n" "subjectAltName = email:copy\n"]. -ca_cnf(Root, C = #config{issuing_distribution_point = true}) -> +ca_cnf(C) -> ["# Purpose: Configuration for CAs.\n" "\n" - "ROOTDIR = " ++ Root ++ "\n" + "ROOTDIR = $ENV::ROOTDIR\n" "default_ca = ca\n" "\n" @@ -448,83 +446,5 @@ "subjectAltName = email:copy\n" "issuerAltName = issuer:copy\n" "crlDistributionPoints=@crl_section\n" - ]; - -ca_cnf(Root, C = #config{issuing_distribution_point = false}) -> - ["# Purpose: Configuration for CAs.\n" - "\n" - "ROOTDIR = " ++ Root ++ "\n" - "default_ca = ca\n" - "\n" - - "[ca]\n" - "dir = $ROOTDIR/", C#config.commonName, "\n" - "certs = $dir/certs\n" - "crl_dir = $dir/crl\n" - "database = $dir/index.txt\n" - "new_certs_dir = $dir/newcerts\n" - "certificate = $dir/cert.pem\n" - "serial = $dir/serial\n" - "crl = $dir/crl.pem\n", - ["crlnumber = $dir/crlnumber\n" || C#config.v2_crls], - "private_key = $dir/private/key.pem\n" - "RANDFILE = $dir/private/RAND\n" - "\n" - "x509_extensions = user_cert\n", - ["crl_extensions = crl_ext\n" || C#config.v2_crls], - "unique_subject = no\n" - "default_days = 3600\n" - "default_md = md5\n" - "preserve = no\n" - "policy = policy_match\n" - "\n" - - "[policy_match]\n" - "commonName = supplied\n" - "organizationalUnitName = optional\n" - "organizationName = match\n" - "countryName = match\n" - "localityName = match\n" - "emailAddress = supplied\n" - "\n" - - "[crl_ext]\n" - "authorityKeyIdentifier=keyid:always,issuer:always\n", - %["issuingDistributionPoint=critical, @idpsec\n" || C#config.issuing_distribution_point], - - %"[idpsec]\n" - %"fullname=URI:http://localhost:8000/",C#config.commonName,"/crl.pem\n" - - "[user_cert]\n" - "basicConstraints = CA:false\n" - "keyUsage = nonRepudiation, digitalSignature, keyEncipherment\n" - "subjectKeyIdentifier = hash\n" - "authorityKeyIdentifier = keyid,issuer:always\n" - "subjectAltName = email:copy\n" - "issuerAltName = issuer:copy\n" - %"crlDistributionPoints=@crl_section\n" - - %%"[crl_section]\n" - %% intentionally invalid - %%"URI.1=http://localhost/",C#config.commonName,"/crl.pem\n" - %%"URI.2=http://localhost:",integer_to_list(C#config.crl_port),"/",C#config.commonName,"/crl.pem\n" - %%"\n" - - "[user_cert_digital_signature_only]\n" - "basicConstraints = CA:false\n" - "keyUsage = digitalSignature\n" - "subjectKeyIdentifier = hash\n" - "authorityKeyIdentifier = keyid,issuer:always\n" - "subjectAltName = email:copy\n" - "issuerAltName = issuer:copy\n" - "\n" - - "[ca_cert]\n" - "basicConstraints = critical,CA:true\n" - "keyUsage = cRLSign, keyCertSign\n" - "subjectKeyIdentifier = hash\n" - "authorityKeyIdentifier = keyid:always,issuer:always\n" - "subjectAltName = email:copy\n" - "issuerAltName = issuer:copy\n" - %"crlDistributionPoints=@crl_section\n" ]. + diff -Nru erlang-18.2-dfsg/lib/ssl/test/Makefile erlang-17.3-dfsg/lib/ssl/test/Makefile --- erlang-18.2-dfsg/lib/ssl/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1999-2015. All Rights Reserved. +# Copyright Ericsson AB 1999-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -37,9 +36,7 @@ MODULES = \ ssl_test_lib \ - ssl_alpn_handshake_SUITE \ ssl_basic_SUITE \ - ssl_bench_SUITE \ ssl_cipher_SUITE \ ssl_certificate_verify_SUITE\ ssl_crl_SUITE\ @@ -49,12 +46,9 @@ ssl_npn_handshake_SUITE \ ssl_packet_SUITE \ ssl_payload_SUITE \ - ssl_pem_cache_SUITE \ ssl_session_cache_SUITE \ ssl_to_openssl_SUITE \ ssl_ECC_SUITE \ - ssl_upgrade_SUITE\ - ssl_sni_SUITE \ make_certs\ erl_make_certs @@ -136,7 +130,7 @@ release_tests_spec: opt $(INSTALL_DIR) "$(RELSYSDIR)" $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(HRL_FILES_NEEDED_IN_TEST) $(COVER_FILE) "$(RELSYSDIR)" - $(INSTALL_DATA) ssl.spec ssl_bench.spec ssl.cover "$(RELSYSDIR)" + $(INSTALL_DATA) ssl.spec ssl.cover "$(RELSYSDIR)" chmod -R u+w "$(RELSYSDIR)" @tar cf - *_SUITE_data | (cd "$(RELSYSDIR)"; tar xf -) diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_alpn_handshake_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_alpn_handshake_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_alpn_handshake_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_alpn_handshake_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,419 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% --module(ssl_alpn_handshake_SUITE). - -%% Note: This directive should only be used in test suites. --compile(export_all). --include_lib("common_test/include/ct.hrl"). - --define(SLEEP, 500). - -%%-------------------------------------------------------------------- -%% Common Test interface functions ----------------------------------- -%%-------------------------------------------------------------------- - -all() -> - [{group, 'tlsv1.2'}, - {group, 'tlsv1.1'}, - {group, 'tlsv1'}, - {group, 'sslv3'}]. - -groups() -> - [ - {'tlsv1.2', [], alpn_tests()}, - {'tlsv1.1', [], alpn_tests()}, - {'tlsv1', [], alpn_tests()}, - {'sslv3', [], alpn_not_supported()} - ]. - -alpn_tests() -> - [empty_protocols_are_not_allowed, - protocols_must_be_a_binary_list, - empty_client, - empty_server, - empty_client_empty_server, - no_matching_protocol, - client_alpn_and_server_alpn, - client_alpn_and_server_no_support, - client_no_support_and_server_alpn, - client_alpn_npn_and_server_alpn, - client_alpn_npn_and_server_alpn_npn, - client_alpn_and_server_alpn_npn, - client_renegotiate, - session_reused - ]. - -alpn_not_supported() -> - [alpn_not_supported_client, - alpn_not_supported_server - ]. - -init_per_suite(Config) -> - catch crypto:stop(), - try crypto:start() of - ok -> - ssl:start(), - {ok, _} = make_certs:all(?config(data_dir, Config), - ?config(priv_dir, Config)), - ssl_test_lib:cert_options(Config) - catch _:_ -> - {skip, "Crypto did not start"} - end. - -end_per_suite(_Config) -> - ssl:stop(), - application:unload(ssl), - application:stop(crypto). - - -init_per_group(GroupName, Config) -> - case ssl_test_lib:is_tls_version(GroupName) of - true -> - case ssl_test_lib:sufficient_crypto_support(GroupName) of - true -> - ssl_test_lib:init_tls_version(GroupName), - Config; - false -> - {skip, "Missing crypto support"} - end; - _ -> - ssl:start(), - Config - end. - -end_per_group(_GroupName, Config) -> - Config. - -init_per_testcase(_TestCase, Config) -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:timetrap({seconds, 10}), - Config. - -end_per_testcase(_TestCase, Config) -> - Config. - -%%-------------------------------------------------------------------- -%% Test Cases -------------------------------------------------------- -%%-------------------------------------------------------------------- - -empty_protocols_are_not_allowed(Config) when is_list(Config) -> - {error, {options, {alpn_preferred_protocols, {invalid_protocol, <<>>}}}} - = (catch ssl:listen(9443, - [{alpn_preferred_protocols, [<<"foo/1">>, <<"">>]}])), - {error, {options, {alpn_advertised_protocols, {invalid_protocol, <<>>}}}} - = (catch ssl:connect({127,0,0,1}, 9443, - [{alpn_advertised_protocols, [<<"foo/1">>, <<"">>]}])). - -%-------------------------------------------------------------------------------- - -protocols_must_be_a_binary_list(Config) when is_list(Config) -> - Option1 = {alpn_preferred_protocols, hello}, - {error, {options, Option1}} = (catch ssl:listen(9443, [Option1])), - Option2 = {alpn_preferred_protocols, [<<"foo/1">>, hello]}, - {error, {options, {alpn_preferred_protocols, {invalid_protocol, hello}}}} - = (catch ssl:listen(9443, [Option2])), - Option3 = {alpn_advertised_protocols, hello}, - {error, {options, Option3}} = (catch ssl:connect({127,0,0,1}, 9443, [Option3])), - Option4 = {alpn_advertised_protocols, [<<"foo/1">>, hello]}, - {error, {options, {alpn_advertised_protocols, {invalid_protocol, hello}}}} - = (catch ssl:connect({127,0,0,1}, 9443, [Option4])). - -%-------------------------------------------------------------------------------- - -empty_client(Config) when is_list(Config) -> - run_failing_handshake(Config, - [{alpn_advertised_protocols, []}], - [{alpn_preferred_protocols, [<<"spdy/2">>, <<"spdy/3">>, <<"http/2">>]}], - {connect_failed,{tls_alert,"no application protocol"}}). - -%-------------------------------------------------------------------------------- - -empty_server(Config) when is_list(Config) -> - run_failing_handshake(Config, - [{alpn_advertised_protocols, [<<"http/1.0">>, <<"http/1.1">>]}], - [{alpn_preferred_protocols, []}], - {connect_failed,{tls_alert,"no application protocol"}}). - -%-------------------------------------------------------------------------------- - -empty_client_empty_server(Config) when is_list(Config) -> - run_failing_handshake(Config, - [{alpn_advertised_protocols, []}], - [{alpn_preferred_protocols, []}], - {connect_failed,{tls_alert,"no application protocol"}}). - -%-------------------------------------------------------------------------------- - -no_matching_protocol(Config) when is_list(Config) -> - run_failing_handshake(Config, - [{alpn_advertised_protocols, [<<"http/1.0">>, <<"http/1.1">>]}], - [{alpn_preferred_protocols, [<<"spdy/2">>, <<"spdy/3">>, <<"http/2">>]}], - {connect_failed,{tls_alert,"no application protocol"}}). - -%-------------------------------------------------------------------------------- - -client_alpn_and_server_alpn(Config) when is_list(Config) -> - run_handshake(Config, - [{alpn_advertised_protocols, [<<"http/1.0">>, <<"http/1.1">>]}], - [{alpn_preferred_protocols, [<<"spdy/2">>, <<"http/1.1">>, <<"http/1.0">>]}], - {ok, <<"http/1.1">>}). - -%-------------------------------------------------------------------------------- - -client_alpn_and_server_no_support(Config) when is_list(Config) -> - run_handshake(Config, - [{alpn_advertised_protocols, [<<"http/1.0">>, <<"http/1.1">>]}], - [], - {error, protocol_not_negotiated}). - -%-------------------------------------------------------------------------------- - -client_no_support_and_server_alpn(Config) when is_list(Config) -> - run_handshake(Config, - [], - [{alpn_preferred_protocols, [<<"spdy/2">>, <<"http/1.1">>, <<"http/1.0">>]}], - {error, protocol_not_negotiated}). - -%-------------------------------------------------------------------------------- - -client_alpn_npn_and_server_alpn(Config) when is_list(Config) -> - run_handshake(Config, - [{alpn_advertised_protocols, [<<"http/1.0">>, <<"http/1.1">>]}, - {client_preferred_next_protocols, {client, [<<"spdy/2">>], <<"spdy/3">>}}], - [{alpn_preferred_protocols, [<<"spdy/2">>, <<"http/1.1">>, <<"http/1.0">>]}], - {ok, <<"http/1.1">>}). - -%-------------------------------------------------------------------------------- - -client_alpn_npn_and_server_alpn_npn(Config) when is_list(Config) -> - run_handshake(Config, - [{alpn_advertised_protocols, [<<"http/1.0">>, <<"http/1.1">>]}, - {client_preferred_next_protocols, {client, [<<"spdy/2">>], <<"spdy/3">>}}], - [{alpn_preferred_protocols, [<<"spdy/2">>, <<"http/1.1">>, <<"http/1.0">>]}, - {next_protocols_advertised, [<<"spdy/2">>, <<"http/1.0">>]}], - {ok, <<"http/1.1">>}). - -%-------------------------------------------------------------------------------- - -client_alpn_and_server_alpn_npn(Config) when is_list(Config) -> - run_handshake(Config, - [{alpn_advertised_protocols, [<<"http/1.0">>, <<"http/1.1">>]}], - [{alpn_preferred_protocols, [<<"spdy/2">>, <<"http/1.1">>, <<"http/1.0">>]}, - {next_protocols_advertised, [<<"spdy/2">>, <<"http/1.0">>]}], - {ok, <<"http/1.1">>}). - -%-------------------------------------------------------------------------------- - -client_renegotiate(Config) when is_list(Config) -> - Data = "hello world", - - ClientOpts0 = ?config(client_opts, Config), - ClientOpts = [{alpn_advertised_protocols, [<<"http/1.0">>]}] ++ ClientOpts0, - ServerOpts0 = ?config(server_opts, Config), - ServerOpts = [{alpn_preferred_protocols, [<<"spdy/2">>, <<"http/1.1">>, <<"http/1.0">>]}] ++ ServerOpts0, - ExpectedProtocol = {ok, <<"http/1.0">>}, - - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {?MODULE, ssl_receive_and_assert_alpn, [ExpectedProtocol, Data]}}, - {options, ServerOpts}]), - - Port = ssl_test_lib:inet_port(Server), - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {mfa, {?MODULE, assert_alpn_and_renegotiate_and_send_data, [ExpectedProtocol, Data]}}, - {options, ClientOpts}]), - - ssl_test_lib:check_result(Server, ok, Client, ok). - -%-------------------------------------------------------------------------------- - -session_reused(Config) when is_list(Config)-> - ClientOpts0 = ?config(client_opts, Config), - ClientOpts = [{alpn_advertised_protocols, [<<"http/1.0">>]}] ++ ClientOpts0, - ServerOpts0 = ?config(server_opts, Config), - ServerOpts = [{alpn_preferred_protocols, [<<"spdy/2">>, <<"http/1.1">>, <<"http/1.0">>]}] ++ ServerOpts0, - - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {ssl_test_lib, session_info_result, []}}, - {options, ServerOpts}]), - - Port = ssl_test_lib:inet_port(Server), - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {mfa, {ssl_test_lib, no_result_msg, []}}, - {options, ClientOpts}]), - - SessionInfo = - receive - {Server, Info} -> - Info - end, - - Server ! {listen, {mfa, {ssl_test_lib, no_result, []}}}, - - %% Make sure session is registered - ct:sleep(?SLEEP), - - Client1 = - ssl_test_lib:start_client([{node, ClientNode}, - {port, Port}, {host, Hostname}, - {mfa, {ssl_test_lib, session_info_result, []}}, - {from, self()}, {options, ClientOpts}]), - - receive - {Client1, SessionInfo} -> - ok; - {Client1, Other} -> - ct:fail(Other) - end, - - ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - ssl_test_lib:close(Client1). - -%-------------------------------------------------------------------------------- - -alpn_not_supported_client(Config) when is_list(Config) -> - ClientOpts0 = ?config(client_opts, Config), - PrefProtocols = {client_preferred_next_protocols, - {client, [<<"http/1.0">>], <<"http/1.1">>}}, - ClientOpts = [PrefProtocols] ++ ClientOpts0, - {ClientNode, _ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Client = ssl_test_lib:start_client_error([{node, ClientNode}, - {port, 8888}, {host, Hostname}, - {from, self()}, {options, ClientOpts}]), - - ssl_test_lib:check_result(Client, {error, - {options, - {not_supported_in_sslv3, PrefProtocols}}}). - -%-------------------------------------------------------------------------------- - -alpn_not_supported_server(Config) when is_list(Config)-> - ServerOpts0 = ?config(server_opts, Config), - AdvProtocols = {next_protocols_advertised, [<<"spdy/2">>, <<"http/1.1">>, <<"http/1.0">>]}, - ServerOpts = [AdvProtocols] ++ ServerOpts0, - - {error, {options, {not_supported_in_sslv3, AdvProtocols}}} = ssl:listen(0, ServerOpts). - -%%-------------------------------------------------------------------- -%% Internal functions ------------------------------------------------ -%%-------------------------------------------------------------------- - -run_failing_handshake(Config, ClientExtraOpts, ServerExtraOpts, ExpectedResult) -> - ClientOpts = ClientExtraOpts ++ ?config(client_opts, Config), - ServerOpts = ServerExtraOpts ++ ?config(server_opts, Config), - - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {?MODULE, placeholder, []}}, - {options, ServerOpts}]), - - Port = ssl_test_lib:inet_port(Server), - ExpectedResult - = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {mfa, {?MODULE, placeholder, []}}, - {options, ClientOpts}]). - -run_handshake(Config, ClientExtraOpts, ServerExtraOpts, ExpectedProtocol) -> - Data = "hello world", - - ClientOpts0 = ?config(client_opts, Config), - ClientOpts = ClientExtraOpts ++ ClientOpts0, - ServerOpts0 = ?config(server_opts, Config), - ServerOpts = ServerExtraOpts ++ ServerOpts0, - - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {?MODULE, ssl_receive_and_assert_alpn, [ExpectedProtocol, Data]}}, - {options, ServerOpts}]), - - Port = ssl_test_lib:inet_port(Server), - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {mfa, {?MODULE, ssl_send_and_assert_alpn, [ExpectedProtocol, Data]}}, - {options, ClientOpts}]), - - ssl_test_lib:check_result(Server, ok, Client, ok). - -assert_alpn(Socket, Protocol) -> - ct:log("Negotiated Protocol ~p, Expecting: ~p ~n", - [ssl:negotiated_protocol(Socket), Protocol]), - Protocol = ssl:negotiated_protocol(Socket). - -assert_alpn_and_renegotiate_and_send_data(Socket, Protocol, Data) -> - assert_alpn(Socket, Protocol), - ct:log("Renegotiating ~n", []), - ok = ssl:renegotiate(Socket), - ssl:send(Socket, Data), - assert_alpn(Socket, Protocol), - ok. - -ssl_send_and_assert_alpn(Socket, Protocol, Data) -> - assert_alpn(Socket, Protocol), - ssl_send(Socket, Data). - -ssl_receive_and_assert_alpn(Socket, Protocol, Data) -> - assert_alpn(Socket, Protocol), - ssl_receive(Socket, Data). - -ssl_send(Socket, Data) -> - ct:log("Connection info: ~p~n", - [ssl:connection_information(Socket)]), - ssl:send(Socket, Data). - -ssl_receive(Socket, Data) -> - ssl_receive(Socket, Data, []). - -ssl_receive(Socket, Data, Buffer) -> - ct:log("Connection info: ~p~n", - [ssl:connection_information(Socket)]), - receive - {ssl, Socket, MoreData} -> - ct:log("Received ~p~n",[MoreData]), - NewBuffer = Buffer ++ MoreData, - case NewBuffer of - Data -> - ssl:send(Socket, "Got it"), - ok; - _ -> - ssl_receive(Socket, Data, NewBuffer) - end; - Other -> - ct:fail({unexpected_message, Other}) - after 4000 -> - ct:fail({did_not_get, Data}) - end. - -connection_info_result(Socket) -> - ssl:connection_information(Socket). diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_basic_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_basic_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_basic_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_basic_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/.2 %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -35,7 +34,9 @@ -include("tls_record.hrl"). -include("tls_handshake.hrl"). --define(TIMEOUT, 20000). +-define('24H_in_sec', 86400). +-define(TIMEOUT, 60000). +-define(LONG_TIMEOUT, 600000). -define(EXPIRE, 10). -define(SLEEP, 500). -define(RENEGOTIATION_DISABLE_TIME, 12000). @@ -44,6 +45,9 @@ %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- + +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [ {group, basic}, @@ -61,7 +65,7 @@ {'tlsv1.2', [], all_versions_groups()}, {'tlsv1.1', [], all_versions_groups()}, {'tlsv1', [], all_versions_groups() ++ rizzo_tests()}, - {'sslv3', [], all_versions_groups() ++ rizzo_tests() ++ [ciphersuite_vs_version]}, + {'sslv3', [], all_versions_groups() ++ rizzo_tests()}, {api,[], api_tests()}, {session, [], session_tests()}, {renegotiate, [], renegotiate_tests()}, @@ -86,16 +90,13 @@ version_option, connect_twice, connect_dist, - clear_pem_cache, - defaults, - fallback + clear_pem_cache ]. options_tests() -> [der_input, misc_ssl_options, ssl_options_not_proplist, - raw_ssl_option, socket_options, invalid_inet_get_option, invalid_inet_get_option_not_list, @@ -115,6 +116,7 @@ tcp_reuseaddr, honor_server_cipher_order, honor_client_cipher_order, + ciphersuite_vs_version, unordered_protocol_versions_server, unordered_protocol_versions_client ]. @@ -129,14 +131,11 @@ controlling_process, upgrade, upgrade_with_timeout, - downgrade, - close_with_timeout, shutdown, shutdown_write, shutdown_both, shutdown_error, hibernate, - hibernate_right_away, listen_socket, ssl_accept_timeout, ssl_recv_timeout, @@ -162,8 +161,7 @@ client_no_wrap_sequence_number, server_no_wrap_sequence_number, renegotiate_dos_mitigate_active, - renegotiate_dos_mitigate_passive, - renegotiate_dos_mitigate_absolute]. + renegotiate_dos_mitigate_passive]. cipher_tests() -> [cipher_suites, @@ -179,9 +177,6 @@ srp_cipher_suites, srp_anon_cipher_suites, srp_dsa_cipher_suites, - rc4_rsa_cipher_suites, - rc4_ecdh_rsa_cipher_suites, - rc4_ecdsa_cipher_suites, default_reject_anonymous]. cipher_tests_ec() -> @@ -209,17 +204,22 @@ %%-------------------------------------------------------------------- init_per_suite(Config0) -> + Dog = ct:timetrap(?LONG_TIMEOUT *2), catch crypto:stop(), try crypto:start() of ok -> ssl:start(), %% make rsa certs using oppenssl - {ok, _} = make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0)), + Result = + (catch make_certs:all(?config(data_dir, Config0), + ?config(priv_dir, Config0))), + ct:log("Make certs ~p~n", [Result]), + Config1 = ssl_test_lib:make_dsa_cert(Config0), Config2 = ssl_test_lib:make_ecdsa_cert(Config1), - Config = ssl_test_lib:make_ecdh_rsa_cert(Config2), - ssl_test_lib:cert_options(Config) + Config3 = ssl_test_lib:make_ecdh_rsa_cert(Config2), + Config = ssl_test_lib:cert_options(Config3), + [{watchdog, Dog} | Config] catch _:_ -> {skip, "Crypto did not start"} end. @@ -252,11 +252,15 @@ Case == unordered_protocol_versions_server-> case proplists:get_value(supported, ssl:versions()) of ['tlsv1.2' | _] -> - ct:timetrap({seconds, 5}), Config; _ -> {skip, "TLS 1.2 need but not supported on this platform"} end; +init_per_testcase(no_authority_key_identifier, Config) -> + %% Clear cach so that root cert will not + %% be found. + ssl:clear_pem_cache(), + Config; init_per_testcase(protocol_versions, Config) -> ssl:stop(), @@ -264,16 +268,15 @@ %% For backwards compatibility sslv2 should be filtered out. application:set_env(ssl, protocol_version, [sslv2, sslv3, tlsv1]), ssl:start(), - ct:timetrap({seconds, 5}), Config; -init_per_testcase(reuse_session_expired, Config) -> +init_per_testcase(reuse_session_expired, Config0) -> + Config = lists:keydelete(watchdog, 1, Config0), ssl:stop(), application:load(ssl), application:set_env(ssl, session_lifetime, ?EXPIRE), application:set_env(ssl, session_delay_cleanup_time, 500), ssl:start(), - ct:timetrap({seconds, 30}), Config; init_per_testcase(empty_protocol_versions, Config) -> @@ -281,70 +284,16 @@ application:load(ssl), application:set_env(ssl, protocol_version, []), ssl:start(), - ct:timetrap({seconds, 5}), Config; -init_per_testcase(fallback, Config) -> - case tls_record:highest_protocol_version([]) of - {3, N} when N > 1 -> - ct:timetrap({seconds, 5}), - Config; - _ -> - {skip, "Not relevant if highest supported version is less than 3.2"} - end; +%% init_per_testcase(different_ca_peer_sign, Config0) -> +%% ssl_test_lib:make_mix_cert(Config0); -init_per_testcase(TestCase, Config) when TestCase == client_renegotiate; - TestCase == server_renegotiate; - TestCase == client_secure_renegotiate; - TestCase == client_renegotiate_reused_session; - TestCase == server_renegotiate_reused_session; - TestCase == client_no_wrap_sequence_number; - TestCase == server_no_wrap_sequence_number; - TestCase == renegotiate_dos_mitigate_active; - TestCase == renegotiate_dos_mitigate_passive; - TestCase == renegotiate_dos_mitigate_absolute -> +init_per_testcase(_TestCase, Config0) -> ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:timetrap({seconds, 30}), - Config; - -init_per_testcase(TestCase, Config) when TestCase == psk_cipher_suites; - TestCase == psk_with_hint_cipher_suites; - TestCase == ciphers_rsa_signed_certs; - TestCase == ciphers_rsa_signed_certs_openssl_names; - TestCase == versions_option, - TestCase == tcp_connect_big -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - - ct:timetrap({seconds, 30}), - Config; -init_per_testcase(rizzo, Config) -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:timetrap({seconds, 40}), - Config; - -init_per_testcase(TestCase, Config) when TestCase == ssl_accept_timeout; - TestCase == client_closes_socket; - TestCase == downgrade -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:timetrap({seconds, 15}), - Config; -init_per_testcase(clear_pem_cache, Config) -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:timetrap({seconds, 20}), - Config; -init_per_testcase(raw_ssl_option, Config) -> - ct:timetrap({seconds, 5}), - case os:type() of - {unix,linux} -> - Config; - _ -> - {skip, "Raw options are platform-specific"} - end; - -init_per_testcase(_TestCase, Config) -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:timetrap({seconds, 5}), - Config. + Config = lists:keydelete(watchdog, 1, Config0), + Dog = ct:timetrap(?TIMEOUT), + [{watchdog, Dog} | Config]. end_per_testcase(reuse_session_expired, Config) -> application:unset_env(ssl, session_lifetime), @@ -394,7 +343,7 @@ end, Alerts). %%-------------------------------------------------------------------- new_options_in_accept() -> - [{doc,"Test that you can set ssl options in ssl_accept/3 and not only in tcp upgrade"}]. + [{doc,"Test that you can set ssl options in ssl_accept/3 and not tcp upgrade"}]. new_options_in_accept(Config) when is_list(Config) -> ClientOpts = ?config(client_opts, Config), ServerOpts0 = ?config(server_dsa_opts, Config), @@ -412,9 +361,7 @@ {host, Hostname}, {from, self()}, {mfa, {?MODULE, connection_info_result, []}}, - {options, [{versions, [sslv3]}, - {ciphers,[{rsa,rc4_128,sha} - ]} | ClientOpts]}]), + {options, [{versions, [sslv3]} | ClientOpts]}]), ct:log("Testcase ~p, Client ~p Server ~p ~n", [self(), Client, Server]), @@ -428,7 +375,7 @@ %%-------------------------------------------------------------------- connection_info() -> - [{doc,"Test the API function ssl:connection_information/1"}]. + [{doc,"Test the API function ssl:connection_info/1"}]. connection_info(Config) when is_list(Config) -> ClientOpts = ?config(client_opts, Config), ServerOpts = ?config(server_opts, Config), @@ -444,7 +391,7 @@ {from, self()}, {mfa, {?MODULE, connection_info_result, []}}, {options, - [{ciphers,[{rsa,des_cbc,sha,no_export}]} | + [{ciphers,[{rsa,rc4_128,sha,no_export}]} | ClientOpts]}]), ct:log("Testcase ~p, Client ~p Server ~p ~n", @@ -453,7 +400,7 @@ Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - ServerMsg = ClientMsg = {ok, {Version, {rsa, des_cbc, sha}}}, + ServerMsg = ClientMsg = {ok, {Version, {rsa,rc4_128,sha}}}, ssl_test_lib:check_result(Server, ServerMsg, Client, ClientMsg), @@ -682,7 +629,7 @@ {status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)), [_, _,_, _, Prop] = StatusInfo, State = ssl_test_lib:state(Prop), - [_,FilRefDb |_] = element(6, State), + [_,FilRefDb, _] = element(5, State), {Server, Client} = basic_verify_test_no_close(Config), 2 = ets:info(FilRefDb, size), ssl:clear_pem_cache(), @@ -701,34 +648,6 @@ 0 = ets:info(FilRefDb, size). %%-------------------------------------------------------------------- - -fallback() -> - [{doc, "Test TLS_FALLBACK_SCSV downgrade prevention"}]. - -fallback(Config) when is_list(Config) -> - ClientOpts = ?config(client_opts, Config), - ServerOpts = ?config(server_opts, Config), - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - - Server = - ssl_test_lib:start_server_error([{node, ServerNode}, {port, 0}, - {from, self()}, - {options, ServerOpts}]), - - Port = ssl_test_lib:inet_port(Server), - - Client = - ssl_test_lib:start_client_error([{node, ClientNode}, - {port, Port}, {host, Hostname}, - {from, self()}, {options, - [{fallback, true}, - {versions, ['tlsv1']} - | ClientOpts]}]), - - ssl_test_lib:check_result(Server, {error,{tls_alert,"inappropriate fallback"}}, - Client, {error,{tls_alert,"inappropriate fallback"}}). - -%%-------------------------------------------------------------------- peername() -> [{doc,"Test API function peername/1"}]. @@ -1165,23 +1084,6 @@ BadOption]). %%-------------------------------------------------------------------- -raw_ssl_option() -> - [{doc,"Ensure that a single 'raw' option is passed to ssl:listen correctly."}]. - -raw_ssl_option(Config) when is_list(Config) -> - % 'raw' option values are platform-specific; these are the Linux values: - IpProtoTcp = 6, - % Use TCP_KEEPIDLE, because (e.g.) TCP_MAXSEG can't be read back reliably. - TcpKeepIdle = 4, - KeepAliveTimeSecs = 55, - LOptions = [{raw, IpProtoTcp, TcpKeepIdle, <>}], - {ok, LSocket} = ssl:listen(0, LOptions), - % Per http://www.erlang.org/doc/man/inet.html#getopts-2, we have to specify - % exactly which raw option we want, and the size of the buffer. - {ok, [{raw, IpProtoTcp, TcpKeepIdle, <>}]} = ssl:getopts(LSocket, [{raw, IpProtoTcp, TcpKeepIdle, 4}]). - - -%%-------------------------------------------------------------------- versions() -> [{doc,"Test API function versions/0"}]. @@ -1437,53 +1339,6 @@ ssl_test_lib:close(Client). %%-------------------------------------------------------------------- -downgrade() -> - [{doc,"Test that you can downgarde an ssl connection to an tcp connection"}]. -downgrade(Config) when is_list(Config) -> - ClientOpts = ?config(client_opts, Config), - ServerOpts = ?config(server_opts, Config), - - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {?MODULE, tls_downgrade, []}}, - {options, [{active, false} | ServerOpts]}]), - Port = ssl_test_lib:inet_port(Server), - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {mfa, {?MODULE, tls_downgrade, []}}, - {options, [{active, false} |ClientOpts]}]), - - ssl_test_lib:check_result(Server, ok, Client, ok), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client). - -%%-------------------------------------------------------------------- -close_with_timeout() -> - [{doc,"Test normal (not downgrade) ssl:close/2"}]. -close_with_timeout(Config) when is_list(Config) -> - ClientOpts = ?config(client_opts, Config), - ServerOpts = ?config(server_opts, Config), - - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {?MODULE, tls_close, []}}, - {options,[{active, false} | ServerOpts]}]), - Port = ssl_test_lib:inet_port(Server), - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {mfa, {?MODULE, tls_close, []}}, - {options, [{active, false} |ClientOpts]}]), - - ssl_test_lib:check_result(Server, ok, Client, ok). - - -%%-------------------------------------------------------------------- tcp_connect() -> [{doc,"Test what happens when a tcp tries to connect, i,e. a bad (ssl) packet is sent first"}]. @@ -1521,7 +1376,6 @@ {_, ServerNode, Hostname} = ssl_test_lib:run_where(Config), TcpOpts = [binary, {reuseaddr, true}], - Rand = crypto:rand_bytes(?MAX_CIPHER_TEXT_LENGTH+1), Server = ssl_test_lib:start_upgrade_server_error([{node, ServerNode}, {port, 0}, {from, self()}, {timeout, 5000}, @@ -1533,6 +1387,7 @@ {ok, Socket} = gen_tcp:connect(Hostname, Port, [binary, {packet, 0}]), ct:log("Testcase ~p connected to Server ~p ~n", [self(), Server]), + Rand = crypto:rand_bytes(?MAX_CIPHER_TEXT_LENGTH+1), gen_tcp:send(Socket, <>), @@ -1924,32 +1779,6 @@ Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), Ciphers = ssl_test_lib:srp_dss_suites(), run_suites(Ciphers, Version, Config, srp_dsa). -%%------------------------------------------------------------------- -rc4_rsa_cipher_suites()-> - [{doc, "Test the RC4 ciphersuites"}]. -rc4_rsa_cipher_suites(Config) when is_list(Config) -> - NVersion = tls_record:highest_protocol_version([]), - Version = tls_record:protocol_version(NVersion), - Ciphers = ssl_test_lib:rc4_suites(NVersion), - run_suites(Ciphers, Version, Config, rc4_rsa). -%------------------------------------------------------------------- -rc4_ecdh_rsa_cipher_suites()-> - [{doc, "Test the RC4 ciphersuites"}]. -rc4_ecdh_rsa_cipher_suites(Config) when is_list(Config) -> - NVersion = tls_record:highest_protocol_version([]), - Version = tls_record:protocol_version(NVersion), - Ciphers = ssl_test_lib:rc4_suites(NVersion), - run_suites(Ciphers, Version, Config, rc4_ecdh_rsa). - -%%------------------------------------------------------------------- -rc4_ecdsa_cipher_suites()-> - [{doc, "Test the RC4 ciphersuites"}]. -rc4_ecdsa_cipher_suites(Config) when is_list(Config) -> - NVersion = tls_record:highest_protocol_version([]), - Version = tls_record:protocol_version(NVersion), - Ciphers = ssl_test_lib:rc4_suites(NVersion), - run_suites(Ciphers, Version, Config, rc4_ecdsa). - %%-------------------------------------------------------------------- default_reject_anonymous()-> [{doc,"Test that by default anonymous cipher suites are rejected "}]. @@ -2510,7 +2339,7 @@ {status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)), [_, _,_, _, Prop] = StatusInfo, State = ssl_test_lib:state(Prop), - [CADb | _] = element(6, State), + [CADb | _] = element(5, State), [] = ets:tab2list(CADb). %%-------------------------------------------------------------------- @@ -2678,16 +2507,6 @@ ssl_test_lib:close(Client1). %%-------------------------------------------------------------------- -defaults(Config) when is_list(Config)-> - [_, - {supported, Supported}, - {available, Available}] - = ssl:versions(), - true = lists:member(sslv3, Available), - false = lists:member(sslv3, Supported), - false = lists:member({rsa,rc4_128,sha}, ssl:cipher_suites()), - true = lists:member({rsa,rc4_128,sha}, ssl:cipher_suites(all)). -%%-------------------------------------------------------------------- reuseaddr() -> [{doc,"Test reuseaddr option"}]. @@ -2812,8 +2631,6 @@ ssl_test_lib:close(Client). %%-------------------------------------------------------------------- -ciphersuite_vs_version() -> - [{doc,"Test a SSLv3 client can not negotiate a TLSv* cipher suite."}]. ciphersuite_vs_version(Config) when is_list(Config) -> {_ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), @@ -2924,43 +2741,6 @@ ssl_test_lib:close(Client). %%-------------------------------------------------------------------- - -hibernate_right_away() -> - [{doc,"Check that an SSL connection that is configured to hibernate " - "after 0 or 1 milliseconds hibernates as soon as possible and not " - "crashes"}]. - -hibernate_right_away(Config) -> - ClientOpts = ?config(client_opts, Config), - ServerOpts = ?config(server_opts, Config), - - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - - StartServerOpts = [{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {ssl_test_lib, send_recv_result_active, []}}, - {options, ServerOpts}], - StartClientOpts = [return_socket, - {node, ClientNode}, - {host, Hostname}, - {from, self()}, - {mfa, {ssl_test_lib, send_recv_result_active, []}}], - - Server1 = ssl_test_lib:start_server(StartServerOpts), - Port1 = ssl_test_lib:inet_port(Server1), - {Client1, #sslsocket{}} = ssl_test_lib:start_client(StartClientOpts ++ - [{port, Port1}, {options, [{hibernate_after, 0}|ClientOpts]}]), - ssl_test_lib:close(Server1), - ssl_test_lib:close(Client1), - - Server2 = ssl_test_lib:start_server(StartServerOpts), - Port2 = ssl_test_lib:inet_port(Server2), - {Client2, #sslsocket{}} = ssl_test_lib:start_client(StartClientOpts ++ - [{port, Port2}, {options, [{hibernate_after, 1}|ClientOpts]}]), - ssl_test_lib:close(Server2), - ssl_test_lib:close(Client2). - -%%-------------------------------------------------------------------- listen_socket() -> [{doc,"Check error handling and inet compliance when calling API functions with listen sockets."}]. @@ -2976,7 +2756,7 @@ {error, enotconn} = ssl:send(ListenSocket, <<"data">>), {error, enotconn} = ssl:recv(ListenSocket, 0), - {error, enotconn} = ssl:connection_information(ListenSocket), + {error, enotconn} = ssl:connection_info(ListenSocket), {error, enotconn} = ssl:peername(ListenSocket), {error, enotconn} = ssl:peercert(ListenSocket), {error, enotconn} = ssl:session_info(ListenSocket), @@ -3143,36 +2923,8 @@ ssl_test_lib:close(Client). %%-------------------------------------------------------------------- -renegotiate_dos_mitigate_absolute() -> - [{doc, "Mitigate DOS computational attack by not allowing client to initiate renegotiation"}]. -renegotiate_dos_mitigate_absolute(Config) when is_list(Config) -> - ServerOpts = ?config(server_opts, Config), - ClientOpts = ?config(client_opts, Config), - - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - - Server = - ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {ssl_test_lib, send_recv_result_active, []}}, - {options, [{client_renegotiation, false} | ServerOpts]}]), - Port = ssl_test_lib:inet_port(Server), - - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {mfa, {?MODULE, - renegotiate_rejected, - []}}, - {options, ClientOpts}]), - - ssl_test_lib:check_result(Client, ok, Server, ok), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client). - -%%-------------------------------------------------------------------- tcp_error_propagation_in_active_mode() -> - [{doc,"Test that process recives {ssl_error, Socket, closed} when tcp error occurs"}]. + [{doc,"Test that process recives {ssl_error, Socket, closed} when tcp error ocurres"}]. tcp_error_propagation_in_active_mode(Config) when is_list(Config) -> ClientOpts = ?config(client_opts, Config), ServerOpts = ?config(server_opts, Config), @@ -3606,43 +3358,23 @@ renegotiate(Socket, Data). renegotiate_immediately(Socket) -> - receive + receive {ssl, Socket, "Hello world"} -> ok; %% Handle 1/n-1 splitting countermeasure Rizzo/Duong-Beast {ssl, Socket, "H"} -> - receive + receive {ssl, Socket, "ello world"} -> ok end end, ok = ssl:renegotiate(Socket), {error, renegotiation_rejected} = ssl:renegotiate(Socket), - ct:sleep(?RENEGOTIATION_DISABLE_TIME + ?SLEEP), + ct:sleep(?RENEGOTIATION_DISABLE_TIME +1), ok = ssl:renegotiate(Socket), ct:log("Renegotiated again"), ssl:send(Socket, "Hello world"), ok. - -renegotiate_rejected(Socket) -> - receive - {ssl, Socket, "Hello world"} -> - ok; - %% Handle 1/n-1 splitting countermeasure Rizzo/Duong-Beast - {ssl, Socket, "H"} -> - receive - {ssl, Socket, "ello world"} -> - ok - end - end, - {error, renegotiation_rejected} = ssl:renegotiate(Socket), - {error, renegotiation_rejected} = ssl:renegotiate(Socket), - ct:sleep(?RENEGOTIATION_DISABLE_TIME +1), - {error, renegotiation_rejected} = ssl:renegotiate(Socket), - ct:log("Failed to renegotiate again"), - ssl:send(Socket, "Hello world"), - ok. - new_config(PrivDir, ServerOpts0) -> CaCertFile = proplists:get_value(cacertfile, ServerOpts0), @@ -3962,20 +3694,8 @@ ?config(server_ecdsa_opts, Config)}; ecdh_rsa -> {?config(client_opts, Config), - ?config(server_ecdh_rsa_opts, Config)}; - rc4_rsa -> - {?config(client_opts, Config), - [{ciphers, Ciphers} | - ?config(server_opts, Config)]}; - rc4_ecdh_rsa -> - {?config(client_opts, Config), - [{ciphers, Ciphers} | - ?config(server_ecdh_rsa_opts, Config)]}; - rc4_ecdsa -> - {?config(client_opts, Config), - [{ciphers, Ciphers} | - ?config(server_ecdsa_opts, Config)]} - end, + ?config(server_ecdh_rsa_opts, Config)} + end, Result = lists:map(fun(Cipher) -> cipher(Cipher, Version, Config, ClientOpts, ServerOpts) end, @@ -3996,7 +3716,6 @@ cipher(CipherSuite, Version, Config, ClientOpts, ServerOpts) -> %% process_flag(trap_exit, true), ct:log("Testing CipherSuite ~p~n", [CipherSuite]), - ct:log("Server Opts ~p~n", [ServerOpts]), {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), ErlangCipherSuite = erlang_cipher_suite(CipherSuite), @@ -4029,10 +3748,10 @@ end. connection_info_result(Socket) -> - {ok, Info} = ssl:connection_information(Socket, [protocol, cipher_suite]), - {ok, {proplists:get_value(protocol, Info), proplists:get_value(cipher_suite, Info)}}. + ssl:connection_info(Socket). + version_info_result(Socket) -> - {ok, [{version, Version}]} = ssl:connection_information(Socket, [version]), + {ok, {Version, _}} = ssl:connection_info(Socket), {ok, Version}. connect_dist_s(S) -> @@ -4044,33 +3763,6 @@ {ok, Test} = ssl:recv(S, 0, 10000), ok. -tls_downgrade(Socket) -> - ok = ssl_test_lib:send_recv_result(Socket), - case ssl:close(Socket, {self(), 10000}) of - {ok, TCPSocket} -> - inet:setopts(TCPSocket, [{active, true}]), - gen_tcp:send(TCPSocket, "Downgraded"), - receive - {tcp, TCPSocket, <<"Downgraded">>} -> - ok; - {tcp_closed, TCPSocket} -> - ct:pal("Peer timed out, downgrade aborted"), - ok; - Other -> - {error, Other} - end; - {error, timeout} -> - ct:pal("Timed out, downgrade aborted"), - ok; - Fail -> - {error, Fail} - end. - -tls_close(Socket) -> - ok = ssl_test_lib:send_recv_result(Socket), - ok = ssl:close(Socket, 5000). - - %% First two clauses handles 1/n-1 splitting countermeasure Rizzo/Duong-Beast treashold(N, {3,0}) -> (N div 2) + 1; diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_bench.spec erlang-17.3-dfsg/lib/ssl/test/ssl_bench.spec --- erlang-18.2-dfsg/lib/ssl/test/ssl_bench.spec 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_bench.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{suites,"../ssl_test",[ssl_bench_SUITE]}. diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_bench_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_bench_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_bench_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_bench_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,367 +0,0 @@ -%%%------------------------------------------------------------------- -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2014. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% --module(ssl_bench_SUITE). --compile(export_all). --include_lib("common_test/include/ct_event.hrl"). - --define(remote_host, "NETMARKS_REMOTE_HOST"). - -suite() -> [{ct_hooks,[{ts_install_cth,[{nodenames,2}]}]}]. - -all() -> [{group, setup}, {group, payload}]. - -groups() -> - [{setup, [{repeat, 3}], [setup_sequential, setup_concurrent]}, - {payload, [{repeat, 3}], [payload_simple]} - ]. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, _Config) -> - ok. - -init_per_suite(Config) -> - try - Server = setup(ssl, node()), - [{server_node, Server}|Config] - catch _:_ -> - {skipped, "Benchmark machines only"} - end. - -end_per_suite(_Config) -> - ok. - -init_per_testcase(_Func, Conf) -> - Conf. - -end_per_testcase(_Func, _Conf) -> - ok. - - --define(COUNT, 400). --define(TC(Cmd), tc(fun() -> Cmd end, ?MODULE, ?LINE)). - --define(FPROF_CLIENT, false). --define(FPROF_SERVER, false). --define(EPROF_CLIENT, false). --define(EPROF_SERVER, false). --define(PERCEPT_SERVER, false). - -%% Current numbers gives roughly a testcase per minute on todays hardware.. - -setup_sequential(Config) -> - Server = proplists:get_value(server_node, Config), - Server =/= undefined orelse error(no_server), - {ok, Result} = do_test(ssl, setup_connection, ?COUNT * 20, 1, Server), - ct_event:notify(#event{name = benchmark_data, - data=[{value, Result}, - {suite, "ssl"}, {name, "Sequential setup"}]}), - ok. - -setup_concurrent(Config) -> - Server = proplists:get_value(server_node, Config), - Server =/= undefined orelse error(no_server), - {ok, Result} = do_test(ssl, setup_connection, ?COUNT, 100, Server), - ct_event:notify(#event{name = benchmark_data, - data=[{value, Result}, - {suite, "ssl"}, {name, "Concurrent setup"}]}), - ok. - -payload_simple(Config) -> - Server = proplists:get_value(server_node, Config), - Server =/= undefined orelse error(no_server), - {ok, Result} = do_test(ssl, payload, ?COUNT*300, 10, Server), - ct_event:notify(#event{name = benchmark_data, - data=[{value, Result}, - {suite, "ssl"}, {name, "Payload simple"}]}), - ok. - - -ssl() -> - test(ssl, ?COUNT, node()). - -test(Type, Count, Host) -> - Server = setup(Type, Host), - (do_test(Type, setup_connection, Count * 20, 1, Server)), - (do_test(Type, setup_connection, Count, 100, Server)), - (do_test(Type, payload, Count*300, 10, Server)), - ok. - -do_test(Type, TC, Loop, ParallellConnections, Server) -> - _ = ssl:stop(), - {ok, _} = ensure_all_started(ssl, []), - - {ok, {SPid, Host, Port}} = rpc:call(Server, ?MODULE, setup_server_init, - [Type, TC, Loop, ParallellConnections]), - link(SPid), - Me = self(), - Test = fun(Id) -> - CData = client_init(Me, Type, TC, Host, Port), - receive - go -> - ?FPROF_CLIENT andalso Id =:= 1 andalso - start_profile(fprof, [self(),new]), - ?EPROF_CLIENT andalso Id =:= 1 andalso - start_profile(eprof, [ssl_connection_sup, ssl_manager]), - ok = ?MODULE:TC(Loop, Type, CData), - ?FPROF_CLIENT andalso Id =:= 1 andalso - stop_profile(fprof, "test_connection_client_res.fprof"), - ?EPROF_CLIENT andalso Id =:= 1 andalso - stop_profile(eprof, "test_connection_client_res.eprof"), - Me ! self() - end - end, - Spawn = fun(Id) -> - Pid = spawn(fun() -> Test(Id) end), - receive {Pid, init} -> Pid end - end, - Pids = [Spawn(Id) || Id <- lists:seq(ParallellConnections, 1, -1)], - Run = fun() -> - [Pid ! go || Pid <- Pids], - [receive Pid -> ok end || Pid <- Pids] - end, - {TimeInMicro, _} = timer:tc(Run), - TotalTests = ParallellConnections * Loop, - TestPerSecond = 1000000 * TotalTests div TimeInMicro, - io:format("TC ~p ~p ~p ~p 1/s~n", [TC, Type, ParallellConnections, TestPerSecond]), - unlink(SPid), - SPid ! quit, - {ok, TestPerSecond}. - -server_init(ssl, setup_connection, _, _, Server) -> - {ok, Socket} = ssl:listen(0, ssl_opts(listen)), - {ok, {_Host, Port}} = ssl:sockname(Socket), - {ok, Host} = inet:gethostname(), - ?FPROF_SERVER andalso start_profile(fprof, [whereis(ssl_manager), new]), - %%?EPROF_SERVER andalso start_profile(eprof, [ssl_connection_sup, ssl_manager]), - ?EPROF_SERVER andalso start_profile(eprof, [ssl_manager]), - ?PERCEPT_SERVER andalso percept:profile("/tmp/ssl_server.percept"), - Server ! {self(), {init, Host, Port}}, - Test = fun(TSocket) -> - ok = ssl:ssl_accept(TSocket), - ssl:close(TSocket) - end, - setup_server_connection(Socket, Test); -server_init(ssl, payload, Loop, _, Server) -> - {ok, Socket} = ssl:listen(0, ssl_opts(listen)), - {ok, {_Host, Port}} = ssl:sockname(Socket), - {ok, Host} = inet:gethostname(), - Server ! {self(), {init, Host, Port}}, - Test = fun(TSocket) -> - ok = ssl:ssl_accept(TSocket), - Size = byte_size(msg()), - server_echo(TSocket, Size, Loop), - ssl:close(TSocket) - end, - setup_server_connection(Socket, Test); - -server_init(Type, Tc, _, _, Server) -> - io:format("No server init code for ~p ~p~n",[Type, Tc]), - Server ! {self(), no_init}. - -client_init(Master, ssl, setup_connection, Host, Port) -> - Master ! {self(), init}, - {Host, Port, ssl_opts(connect)}; -client_init(Master, ssl, payload, Host, Port) -> - {ok, Sock} = ssl:connect(Host, Port, ssl_opts(connect)), - Master ! {self(), init}, - Size = byte_size(msg()), - {Sock, Size}; -client_init(_Me, Type, Tc, Host, Port) -> - io:format("No client init code for ~p ~p~n",[Type, Tc]), - {Host, Port}. - -setup_server_connection(LSocket, Test) -> - receive quit -> - ?FPROF_SERVER andalso stop_profile(fprof, "test_server_res.fprof"), - ?EPROF_SERVER andalso stop_profile(eprof, "test_server_res.eprof"), - ?PERCEPT_SERVER andalso stop_profile(percept, "/tmp/ssl_server.percept"), - ok - after 0 -> - case ssl:transport_accept(LSocket, 2000) of - {ok, TSocket} -> spawn_link(fun() -> Test(TSocket) end); - {error, timeout} -> ok - end, - setup_server_connection(LSocket, Test) - end. - -server_echo(Socket, Size, Loop) when Loop > 0 -> - {ok, Msg} = ssl:recv(Socket, Size), - ok = ssl:send(Socket, Msg), - server_echo(Socket, Size, Loop-1); -server_echo(_, _, _) -> ok. - -setup_connection(N, ssl, Env = {Host, Port, Opts}) when N > 0 -> - case ssl:connect(Host, Port, Opts) of - {ok, Sock} -> - ssl:close(Sock), - setup_connection(N-1, ssl, Env); - {error, Error} -> - io:format("Error: ~p (~p)~n",[Error, length(erlang:ports())]), - setup_connection(N, ssl, Env) - end; -setup_connection(_, _, _) -> - ok. - -payload(Loop, ssl, D = {Socket, Size}) when Loop > 0 -> - ok = ssl:send(Socket, msg()), - {ok, _} = ssl:recv(Socket, Size), - payload(Loop-1, ssl, D); -payload(_, _, {Socket, _}) -> - ssl:close(Socket). - -msg() -> - <<"Hello", - 0:(512*8), - "asdlkjsafsdfoierwlejsdlkfjsdf", - 1:(512*8), - "asdlkjsafsdfoierwlejsdlkfjsdf">>. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -setup(_Type, nonode@nohost) -> - exit(dist_not_enabled); -setup(Type, _This) -> - Host = case os:getenv(?remote_host) of - false -> - {ok, This} = inet:gethostname(), - This; - RemHost -> - RemHost - end, - Node = list_to_atom("perf_server@" ++ Host), - SlaveArgs = case init:get_argument(pa) of - {ok, PaPaths} -> - lists:append([" -pa " ++ P || [P] <- PaPaths]); - _ -> [] - end, - %% io:format("Slave args: ~p~n",[SlaveArgs]), - Prog = - case os:find_executable("erl") of - false -> "erl"; - P -> P - end, - io:format("Prog = ~p~n", [Prog]), - - case net_adm:ping(Node) of - pong -> ok; - pang -> - {ok, Node} = slave:start(Host, perf_server, SlaveArgs, no_link, Prog) - end, - Path = code:get_path(), - true = rpc:call(Node, code, set_path, [Path]), - ok = rpc:call(Node, ?MODULE, setup_server, [Type, node()]), - io:format("Client (~p) using ~s~n",[node(), code:which(ssl)]), - (Node =:= node()) andalso restrict_schedulers(client), - Node. - -setup_server(_Type, ClientNode) -> - (ClientNode =:= node()) andalso restrict_schedulers(server), - io:format("Server (~p) using ~s~n",[node(), code:which(ssl)]), - ok. - - -ensure_all_started(App, Ack) -> - case application:start(App) of - ok -> {ok, [App|Ack]}; - {error, {not_started, Dep}} -> - {ok, Ack1} = ensure_all_started(Dep, Ack), - ensure_all_started(App, Ack1); - {error, {already_started, _}} -> - {ok, Ack} - end. - -setup_server_init(Type, Tc, Loop, PC) -> - _ = ssl:stop(), - {ok, _} = ensure_all_started(ssl, []), - Me = self(), - Pid = spawn_link(fun() -> server_init(Type, Tc, Loop, PC, Me) end), - Res = receive - {Pid, {init, Host, Port}} -> {ok, {Pid, Host, Port}}; - {Pid, Error} -> {error, Error} - end, - unlink(Pid), - Res. - -restrict_schedulers(Type) -> - %% We expect this to run on 8 core machine - Extra0 = 1, - Extra = if (Type =:= server) -> -Extra0; true -> Extra0 end, - Scheds = erlang:system_info(schedulers), - erlang:system_flag(schedulers_online, (Scheds div 2) + Extra). - -tc(Fun, Mod, Line) -> - case timer:tc(Fun) of - {_,{'EXIT',Reason}} -> - io:format("Process EXITED ~p:~p \n", [Mod, Line]), - exit(Reason); - {_T,R={error,_}} -> - io:format("Process Error ~p:~p \n", [Mod, Line]), - R; - {T,R} -> - io:format("~p:~p: Time: ~p\n", [Mod, Line, T]), - R - end. - -start_profile(eprof, Procs) -> - profiling = eprof:start_profiling(Procs), - io:format("(E)Profiling ...",[]); -start_profile(fprof, Procs) -> - fprof:trace([start, {procs, Procs}]), - io:format("(F)Profiling ...",[]). - -stop_profile(percept, File) -> - percept:stop_profile(), - percept:analyze(File), - {started, _Host, Port} = percept:start_webserver(), - wx:new(), - wx_misc:launchDefaultBrowser("http://" ++ net_adm:localhost() ++ ":" ++ integer_to_list(Port)), - ok; -stop_profile(eprof, File) -> - profiling_stopped = eprof:stop_profiling(), - eprof:log(File), - io:format(".analysed => ~s ~n",[File]), - eprof:analyze(total), - eprof:stop(); -stop_profile(fprof, File) -> - fprof:trace(stop), - io:format("..collect..",[]), - fprof:profile(), - fprof:analyse([{dest, File},{totals, true}]), - io:format(".analysed => ~s ~n",[File]), - fprof:stop(), - ok. - -ssl_opts(listen) -> - [{backlog, 500} | ssl_opts("server")]; -ssl_opts(connect) -> - [{verify, verify_peer} - | ssl_opts("client")]; -ssl_opts(Role) -> - Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), - [{active, false}, - {depth, 2}, - {reuseaddr, true}, - {mode,binary}, - {nodelay, true}, - {ciphers, [{dhe_rsa,aes_256_cbc,sha}]}, - {cacertfile, filename:join([Dir, Role, "cacerts.pem"])}, - {certfile, filename:join([Dir, Role, "cert.pem"])}, - {keyfile, filename:join([Dir, Role, "key.pem"])}]. diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_certificate_verify_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_certificate_verify_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_certificate_verify_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_certificate_verify_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/.2 %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -38,6 +37,9 @@ %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- + +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [{group, active}, {group, passive}, @@ -78,15 +80,20 @@ no_authority_key_identifier]. init_per_suite(Config0) -> + Dog = ct:timetrap(?LONG_TIMEOUT *2), catch crypto:stop(), try crypto:start() of ok -> ssl:start(), %% make rsa certs using oppenssl - {ok, _} = make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0)), - Config = ssl_test_lib:make_dsa_cert(Config0), - ssl_test_lib:cert_options(Config) + Result = + (catch make_certs:all(?config(data_dir, Config0), + ?config(priv_dir, Config0))), + ct:log("Make certs ~p~n", [Result]), + + Config1 = ssl_test_lib:make_dsa_cert(Config0), + Config = ssl_test_lib:cert_options(Config1), + [{watchdog, Dog} | Config] catch _:_ -> {skip, "Crypto did not start"} end. @@ -107,14 +114,6 @@ end_per_group(_GroupName, Config) -> Config. -init_per_testcase(_TestCase, Config) -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:timetrap({seconds, 5}), - Config. - -end_per_testcase(_TestCase, Config) -> - Config. - %%-------------------------------------------------------------------- %% Test Cases -------------------------------------------------------- %%-------------------------------------------------------------------- @@ -444,7 +443,7 @@ {unknown, UserState}; (_, valid, [ChainLen]) -> {valid, [ChainLen + 1]}; - (_, valid_peer, [1]) -> + (_, valid_peer, [2]) -> {fail, "verify_fun_was_always_run"}; (_, valid_peer, UserState) -> {valid, UserState} @@ -483,7 +482,7 @@ {unknown, UserState}; (_, valid, [ChainLen]) -> {valid, [ChainLen + 1]}; - (_, valid_peer, [1]) -> + (_, valid_peer, [2]) -> {fail, "verify_fun_was_always_run"}; (_, valid_peer, UserState) -> {valid, UserState} diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_cipher_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_cipher_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_cipher_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_cipher_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,11 +29,16 @@ -include("ssl_cipher.hrl"). -include("ssl_alert.hrl"). +-define(TIMEOUT, 600000). + %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- + +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> - [aes_decipher_good, aes_decipher_fail, padding_test]. + [aes_decipher_good, aes_decipher_good_tls11, aes_decipher_fail, aes_decipher_fail_tls11]. groups() -> []. @@ -57,9 +61,10 @@ end_per_group(_GroupName, Config) -> Config. -init_per_testcase(_TestCase, Config) -> - ct:timetrap({seconds, 5}), - Config. +init_per_testcase(_TestCase, Config0) -> + Config = lists:keydelete(watchdog, 1, Config0), + Dog = ct:timetrap(?TIMEOUT), + [{watchdog, Dog} | Config]. end_per_testcase(_TestCase, Config) -> Config. @@ -68,122 +73,93 @@ %% Test Cases -------------------------------------------------------- %%-------------------------------------------------------------------- aes_decipher_good() -> - [{doc,"Decipher a known cryptotext using a correct key"}]. + [{doc,"Decipher a known cryptotext."}]. aes_decipher_good(Config) when is_list(Config) -> HashSz = 32, - CipherState = correct_cipher_state(), - decipher_check_good(HashSz, CipherState, {3,0}), - decipher_check_good(HashSz, CipherState, {3,1}), - decipher_check_good(HashSz, CipherState, {3,2}), - decipher_check_good(HashSz, CipherState, {3,3}). + CipherState = #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>, + key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,148>>}, + Fragment = <<220,193,179,139,171,33,143,245,202,47,123,251,13,232,114,8, + 190,162,74,31,186,227,119,155,94,74,119,79,169,193,240,160, + 198,181,81,19,98,162,213,228,74,224,253,168,156,59,195,122, + 108,101,107,242,20,15,169,150,163,107,101,94,93,104,241,165>>, + Content = <<183,139,16,132,10,209,67,86,168,100,61,217,145,57,36,56, "HELLO\n">>, + Mac = <<71,136,212,107,223,200,70,232,127,116,148,205,232,35,158,113,237,174,15,217,192,168,35,8,6,107,107,233,25,174,90,111>>, + Version = {3,0}, + {Content, Mac, _} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version), + Version1 = {3,1}, + {Content, Mac, _} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version1), + ok. + +%%-------------------------------------------------------------------- + +aes_decipher_good_tls11() -> + [{doc,"Decipher a known TLS 1.1 cryptotext."}]. + +%% the fragment is actuall a TLS 1.1 record, with +%% Version = TLS 1.1, we get the correct NextIV in #cipher_state +aes_decipher_good_tls11(Config) when is_list(Config) -> + HashSz = 32, + CipherState = #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>, + key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,148>>}, + Fragment = <<220,193,179,139,171,33,143,245,202,47,123,251,13,232,114,8, + 190,162,74,31,186,227,119,155,94,74,119,79,169,193,240,160, + 198,181,81,19,98,162,213,228,74,224,253,168,156,59,195,122, + 108,101,107,242,20,15,169,150,163,107,101,94,93,104,241,165>>, + Content = <<"HELLO\n">>, + NextIV = <<183,139,16,132,10,209,67,86,168,100,61,217,145,57,36,56>>, + Mac = <<71,136,212,107,223,200,70,232,127,116,148,205,232,35,158,113,237,174,15,217,192,168,35,8,6,107,107,233,25,174,90,111>>, + Version = {3,2}, + {Content, Mac, #cipher_state{iv = NextIV}} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version), + Version1 = {3,2}, + {Content, Mac, #cipher_state{iv = NextIV}} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version1), + ok. %%-------------------------------------------------------------------- + aes_decipher_fail() -> - [{doc,"Decipher a known cryptotext using a incorrect key"}]. + [{doc,"Decipher a known cryptotext."}]. +%% same as above, last byte of key replaced aes_decipher_fail(Config) when is_list(Config) -> HashSz = 32, - CipherState = incorrect_cipher_state(), - decipher_check_fail(HashSz, CipherState, {3,0}), - decipher_check_fail(HashSz, CipherState, {3,1}), - decipher_check_fail(HashSz, CipherState, {3,2}), - decipher_check_fail(HashSz, CipherState, {3,3}). - -%%-------------------------------------------------------------------- -padding_test(Config) when is_list(Config) -> - HashSz = 16, - CipherState = correct_cipher_state(), - pad_test(HashSz, CipherState, {3,0}), - pad_test(HashSz, CipherState, {3,1}), - pad_test(HashSz, CipherState, {3,2}), - pad_test(HashSz, CipherState, {3,3}). - -%%-------------------------------------------------------------------- -% Internal functions -------------------------------------------------------- -%%-------------------------------------------------------------------- -decipher_check_good(HashSz, CipherState, Version) -> - {Content, _NextIV, Mac} = content_nextiv_mac(Version), - {Content, Mac, _} = - ssl_cipher:decipher(?AES_CBC, HashSz, CipherState, aes_fragment(Version), Version, true). - -decipher_check_fail(HashSz, CipherState, Version) -> - {Content, NextIV, Mac} = content_nextiv_mac(Version), - true = {Content, Mac, #cipher_state{iv = NextIV}} =/= - ssl_cipher:decipher(?AES_CBC, HashSz, CipherState, aes_fragment(Version), Version, true). - -pad_test(HashSz, CipherState, {3,0} = Version) -> - %% 3.0 does not have padding test - {Content, NextIV, Mac} = badpad_content_nextiv_mac(Version), - {Content, Mac, #cipher_state{iv = NextIV}} = - ssl_cipher:decipher(?AES_CBC, HashSz, CipherState, badpad_aes_fragment({3,0}), {3,0}, true), - {Content, Mac, #cipher_state{iv = NextIV}} = - ssl_cipher:decipher(?AES_CBC, HashSz, CipherState, badpad_aes_fragment({3,0}), {3,0}, false); -pad_test(HashSz, CipherState, {3,1} = Version) -> - %% 3.1 should have padding test, but may be disabled - {Content, NextIV, Mac} = badpad_content_nextiv_mac(Version), - BadCont = badpad_content(Content), - {Content, Mac, #cipher_state{iv = NextIV}} = - ssl_cipher:decipher(?AES_CBC, HashSz, CipherState, badpad_aes_fragment({3,1}) , {3,1}, false), - {BadCont, Mac, #cipher_state{iv = NextIV}} = - ssl_cipher:decipher(?AES_CBC, HashSz, CipherState, badpad_aes_fragment({3,1}), {3,1}, true); -pad_test(HashSz, CipherState, Version) -> - %% 3.2 and 3.3 must have padding test - {Content, NextIV, Mac} = badpad_content_nextiv_mac(Version), - BadCont = badpad_content(Content), - {BadCont, Mac, #cipher_state{iv = NextIV}} = ssl_cipher:decipher(?AES_CBC, HashSz, CipherState, - badpad_aes_fragment(Version), Version, false), - {BadCont, Mac, #cipher_state{iv = NextIV}} = ssl_cipher:decipher(?AES_CBC, HashSz, CipherState, - badpad_aes_fragment(Version), Version, true). - -aes_fragment({3,N}) when N == 0; N == 1-> - <<197,9,6,109,242,87,80,154,85,250,110,81,119,95,65,185,53,206,216,153,246,169, - 119,177,178,238,248,174,253,220,242,81,33,0,177,251,91,44,247,53,183,198,165, - 63,20,194,159,107>>; - -aes_fragment(_) -> - <<220,193,179,139,171,33,143,245,202,47,123,251,13,232,114,8, - 190,162,74,31,186,227,119,155,94,74,119,79,169,193,240,160, - 198,181,81,19,98,162,213,228,74,224,253,168,156,59,195,122, - 108,101,107,242,20,15,169,150,163,107,101,94,93,104,241,165>>. - -badpad_aes_fragment({3,N}) when N == 0; N == 1 -> - <<186,139,125,10,118,21,26,248,120,108,193,104,87,118,145,79,225,55,228,10,105, - 30,190,37,1,88,139,243,210,99,65,41>>; -badpad_aes_fragment(_) -> - <<137,31,14,77,228,80,76,103,183,125,55,250,68,190,123,131,117,23,229,180,207, - 94,121,137,117,157,109,99,113,61,190,138,131,229,201,120,142,179,172,48,77, - 234,19,240,33,38,91,93>>. - -content_nextiv_mac({3,N}) when N == 0; N == 1 -> - {<<"HELLO\n">>, - <<72,196,247,97,62,213,222,109,210,204,217,186,172,184, 197,148>>, - <<71,136,212,107,223,200,70,232,127,116,148,205,232,35,158,113,237,174,15,217,192,168,35,8,6,107,107,233,25,174,90,111>>}; -content_nextiv_mac(_) -> - {<<"HELLO\n">>, - <<183,139,16,132,10,209,67,86,168,100,61,217,145,57,36,56>>, - <<71,136,212,107,223,200,70,232,127,116,148,205,232,35,158,113,237,174,15,217,192,168,35,8,6,107,107,233,25,174,90,111>>}. - -badpad_content_nextiv_mac({3,N}) when N == 0; N == 1 -> - {<<"HELLO\n">>, - <<225,55,228,10,105,30,190,37,1,88,139,243,210,99,65,41>>, - <<183,139,16,132,10,209,67,86,168,100,61,217,145,57,36,56>> - }; -badpad_content_nextiv_mac(_) -> - {<<"HELLO\n">>, - <<133,211,45,189,179,229,56,86,11,178,239,159,14,160,253,140>>, - <<183,139,16,132,10,209,67,86,168,100,61,217,145,57,36,56>> - }. - -badpad_content(Content) -> - %% BadContent will fail mac test - <<16#F0, Content/binary>>. - -correct_cipher_state() -> - #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>, - key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,148>>}. - -incorrect_cipher_state() -> - #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>, - key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,254>>}. - + CipherState = #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>, + key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,254>>}, + Fragment = <<220,193,179,139,171,33,143,245,202,47,123,251,13,232,114,8, + 190,162,74,31,186,227,119,155,94,74,119,79,169,193,240,160, + 198,181,81,19,98,162,213,228,74,224,253,168,156,59,195,122, + 108,101,107,242,20,15,169,150,163,107,101,94,93,104,241,165>>, + Version = {3,0}, + {Content, Mac, _} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version), + 32 = byte_size(Content), + 32 = byte_size(Mac), + Version1 = {3,1}, + {Content1, Mac1, _} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version1), + 32 = byte_size(Content1), + 32 = byte_size(Mac1), + ok. + +%%-------------------------------------------------------------------- + +aes_decipher_fail_tls11() -> + [{doc,"Decipher a known TLS 1.1 cryptotext."}]. + +%% same as above, last byte of key replaced +%% stricter padding checks in TLS 1.1 mean we get an alert instead +aes_decipher_fail_tls11(Config) when is_list(Config) -> + HashSz = 32, + CipherState = #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>, + key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,254>>}, + Fragment = <<220,193,179,139,171,33,143,245,202,47,123,251,13,232,114,8, + 190,162,74,31,186,227,119,155,94,74,119,79,169,193,240,160, + 198,181,81,19,98,162,213,228,74,224,253,168,156,59,195,122, + 108,101,107,242,20,15,169,150,163,107,101,94,93,104,241,165>>, + Version = {3,2}, + #alert{level = ?FATAL, description = ?BAD_RECORD_MAC} = + ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version), + Version1 = {3,3}, + #alert{level = ?FATAL, description = ?BAD_RECORD_MAC} = + ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version1), + ok. + +%%-------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_crl_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_crl_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_crl_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_crl_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,41 +26,54 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("public_key/include/public_key.hrl"). +-define(TIMEOUT, 120000). +-define(LONG_TIMEOUT, 600000). +-define(SLEEP, 1000). +-define(OPENSSL_RENEGOTIATE, "R\n"). +-define(OPENSSL_QUIT, "Q\n"). +-define(OPENSSL_GARBAGE, "P\n"). +-define(EXPIRE, 10). + %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- + +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [ - {group, check_true}, - {group, check_peer}, - {group, check_best_effort} + {group, basic}, + {group, v1_crl}, + {group, idp_crl} ]. groups() -> - [ - {check_true, [], [{group, v2_crl}, - {group, v1_crl}, - {group, idp_crl}]}, - {check_peer, [], [{group, v2_crl}, - {group, v1_crl}, - {group, idp_crl}]}, - {check_best_effort, [], [{group, v2_crl}, - {group, v1_crl}, - {group, idp_crl}]}, - {v2_crl, [], basic_tests()}, - {v1_crl, [], basic_tests()}, - {idp_crl, [], basic_tests()}]. + [{basic, [], basic_tests()}, + {v1_crl, [], v1_crl_tests()}, + {idp_crl, [], idp_crl_tests()}]. basic_tests() -> [crl_verify_valid, crl_verify_revoked]. +v1_crl_tests() -> + [crl_verify_valid, crl_verify_revoked]. -init_per_suite(Config) -> +idp_crl_tests() -> + [crl_verify_valid, crl_verify_revoked]. + +%%%================================================================ +%%% Suite init/end + +init_per_suite(Config0) -> + Dog = ct:timetrap(?LONG_TIMEOUT *2), case os:find_executable("openssl") of false -> {skip, "Openssl not found"}; _ -> + TLSVersion = ?config(tls_version, Config0), OpenSSL_version = (catch os:cmd("openssl version")), + ct:log("TLS version: ~p~nOpenSSL version: ~p~n~n~p:module_info(): ~p~n~nssl:module_info(): ~p~n", + [TLSVersion, OpenSSL_version, ?MODULE, ?MODULE:module_info(), ssl:module_info()]), case ssl_test_lib:enough_openssl_crl_support(OpenSSL_version) of false -> {skip, io_lib:format("Bad openssl version: ~p",[OpenSSL_version])}; @@ -69,14 +81,16 @@ catch crypto:stop(), try crypto:start() of ok -> + ssl:start(), {ok, Hostname0} = inet:gethostname(), IPfamily = case lists:member(list_to_atom(Hostname0), ct:get_config(ipv6_hosts,[])) of true -> inet6; false -> inet end, - [{ipfamily,IPfamily}, {openssl_version,OpenSSL_version} | Config] - catch _:_ -> + [{ipfamily,IPfamily}, {watchdog, Dog}, {openssl_version,OpenSSL_version} | Config0] + catch _C:_E -> + ct:log("crypto:start() caught ~p:~p",[_C,_E]), {skip, "Crypto did not start"} end end @@ -86,176 +100,443 @@ ssl:stop(), application:stop(crypto). -init_per_group(check_true, Config) -> - [{crl_check, true} | Config]; -init_per_group(check_peer, Config) -> - [{crl_check, peer} | Config]; -init_per_group(check_best_effort, Config) -> - [{crl_check, best_effort} | Config]; -init_per_group(Group, Config0) -> - case is_idp(Group) of - true -> - [{idp_crl, true} | Config0]; - false -> - DataDir = ?config(data_dir, Config0), - CertDir = filename:join(?config(priv_dir, Config0), Group), - {CertOpts, Config} = init_certs(CertDir, Group, Config0), - {ok, _} = make_certs:all(DataDir, CertDir, CertOpts), - [{cert_dir, CertDir}, {idp_crl, false} | Config] - end. +%%%================================================================ +%%% Group init/end -end_per_group(_GroupName, Config) -> - - Config. +init_per_group(Group, Config) -> + ssl:start(), + inets:start(), + CertDir = filename:join(?config(priv_dir, Config), Group), + DataDir = ?config(data_dir, Config), + ServerRoot = make_dir_path([?config(priv_dir,Config), Group, tmp]), + %% start a HTTP server to serve the CRLs + {ok, Httpd} = inets:start(httpd, [{ipfamily, ?config(ipfamily,Config)}, + {server_name, "localhost"}, {port, 0}, + {server_root, ServerRoot}, + {document_root, CertDir}, + {modules, [mod_get]} + ]), + [{port,Port}] = httpd:info(Httpd, [port]), + ct:log("~p:~p~nHTTPD IP family=~p, port=~p~n", [?MODULE, ?LINE, ?config(ipfamily,Config), Port]), + CertOpts = [{crl_port,Port}|cert_opts(Group)], + Result = make_certs:all(DataDir, CertDir, CertOpts), + ct:log("~p:~p~nmake_certs:all(~n DataDir=~p,~n CertDir=~p,~n ServerRoot=~p~n Opts=~p~n) returned ~p~n", [?MODULE,?LINE,DataDir, CertDir, ServerRoot, CertOpts, Result]), + [{make_cert_result, Result}, {cert_dir, CertDir}, {httpd, Httpd} | Config]. + +cert_opts(v1_crl) -> [{v2_crls, false}]; +cert_opts(idp_crl) -> [{issuing_distribution_point, true}]; +cert_opts(_) -> []. -init_per_testcase(Case, Config0) -> - case ?config(idp_crl, Config0) of - true -> - end_per_testcase(Case, Config0), - inets:start(), - ssl:start(), - ServerRoot = make_dir_path([?config(priv_dir, Config0), idp_crl, tmp]), - %% start a HTTP server to serve the CRLs - {ok, Httpd} = inets:start(httpd, [{ipfamily, ?config(ipfamily, Config0)}, - {server_name, "localhost"}, {port, 0}, - {server_root, ServerRoot}, - {document_root, - filename:join(?config(priv_dir, Config0), idp_crl)} - ]), - [{port,Port}] = httpd:info(Httpd, [port]), - Config = [{httpd_port, Port} | Config0], - DataDir = ?config(data_dir, Config), - CertDir = filename:join(?config(priv_dir, Config0), idp_crl), - {CertOpts, Config} = init_certs(CertDir, idp_crl, Config), - {ok, _} = make_certs:all(DataDir, CertDir, CertOpts), - ct:timetrap({seconds, 6}), - [{cert_dir, CertDir} | Config]; - false -> - end_per_testcase(Case, Config0), - ssl:start(), - Config0 - end. +make_dir_path(PathComponents) -> + lists:foldl(fun(F,P0) -> file:make_dir(P=filename:join(P0,F)), P end, + "", + PathComponents). -end_per_testcase(_, Config) -> - case ?config(idp_crl, Config) of - true -> - ssl:stop(), - inets:stop(); - false -> - ssl:stop() - end. + +end_per_group(_GroupName, Config) -> + case ?config(httpd, Config) of + undefined -> ok; + Pid -> + ct:log("Stop httpd ~p",[Pid]), + ok = inets:stop(httpd, Pid) + ,ct:log("Stopped",[]) + end, + inets:stop(), + Config. %%%================================================================ %%% Test cases -%%%================================================================ crl_verify_valid() -> [{doc,"Verify a simple valid CRL chain"}]. crl_verify_valid(Config) when is_list(Config) -> + process_flag(trap_exit, true), PrivDir = ?config(cert_dir, Config), - Check = ?config(crl_check, Config), - ServerOpts = [{keyfile, filename:join([PrivDir, "server", "key.pem"])}, - {certfile, filename:join([PrivDir, "server", "cert.pem"])}, - {cacertfile, filename:join([PrivDir, "server", "cacerts.pem"])}], - ClientOpts = case ?config(idp_crl, Config) of - true -> - [{cacertfile, filename:join([PrivDir, "server", "cacerts.pem"])}, - {crl_check, Check}, - {crl_cache, {ssl_crl_cache, {internal, [{http, 5000}]}}}, - {verify, verify_peer}]; - false -> - [{cacertfile, filename:join([PrivDir, "server", "cacerts.pem"])}, - {crl_check, Check}, - {verify, verify_peer}] - end, + ServerOpts = [{keyfile, filename:join([PrivDir, "server", "key.pem"])}, + {certfile, filename:join([PrivDir, "server", "cert.pem"])}, + {cacertfile, filename:join([PrivDir, "server", "cacerts.pem"])}], + {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), + Data = "From openssl to erlang", + + Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, + {from, self()}, + {mfa, {?MODULE, erlang_ssl_receive, [Data]}}, + %{mfa, {ssl_test_lib, no_result, []}}, + {options, ServerOpts}]), + ct:log("~p:~p~nreturn from ssl_test_lib:start_server:~n~p",[?MODULE,?LINE,Server]), + Port = ssl_test_lib:inet_port(Server), + + CACerts = load_cert(filename:join([PrivDir, "erlangCA", "cacerts.pem"])), + + ClientOpts = [{cacerts, CACerts}, + {verify, verify_peer}, + {verify_fun, {fun validate_function/3, {CACerts, []}}}], + + + ct:log("~p:~p~ncalling ssl_test_lib:start_client",[?MODULE,?LINE]), + Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, + {host, Hostname}, + {from, self()}, + {mfa, {?MODULE, + erlang_ssl_send, [Data]}}, + %{mfa, {ssl_test_lib, no_result, []}}, + {options, ClientOpts}]), + ct:log("~p:~p~nreturn from ssl_test_lib:start_client:~n~p",[?MODULE,?LINE,Client]), + + ssl_test_lib:check_result(Client, ok, Server, ok), - ssl_crl_cache:insert({file, filename:join([PrivDir, "erlangCA", "crl.pem"])}), - ssl_crl_cache:insert({file, filename:join([PrivDir, "otpCA", "crl.pem"])}), - - crl_verify_valid(Hostname, ServerNode, ServerOpts, ClientNode, ClientOpts). + %% Clean close down! Server needs to be closed first !! + ssl_test_lib:close(Server), + ssl_test_lib:close(Client), + process_flag(trap_exit, false). crl_verify_revoked() -> - [{doc,"Verify a simple CRL chain when peer cert is reveoked"}]. -crl_verify_revoked(Config) when is_list(Config) -> + [{doc,"Verify a simple valid CRL chain"}]. +crl_verify_revoked(Config) when is_list(Config) -> + process_flag(trap_exit, true), PrivDir = ?config(cert_dir, Config), - Check = ?config(crl_check, Config), ServerOpts = [{keyfile, filename:join([PrivDir, "revoked", "key.pem"])}, - {certfile, filename:join([PrivDir, "revoked", "cert.pem"])}, - {cacertfile, filename:join([PrivDir, "revoked", "cacerts.pem"])}], + {certfile, filename:join([PrivDir, "revoked", "cert.pem"])}, + {cacertfile, filename:join([PrivDir, "revoked", "cacerts.pem"])}], + ct:log("~p:~p~nserver opts ~p~n", [?MODULE,?LINE, ServerOpts]), {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = ssl_test_lib:start_server_error([{node, ServerNode}, {port, 0}, - {from, self()}, - {options, ServerOpts}]), + Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, + {from, self()}, + %{mfa, {?MODULE, erlang_ssl_receive, [Data]}}, + {mfa, {ssl_test_lib, no_result, []}}, + {options, ServerOpts}]), Port = ssl_test_lib:inet_port(Server), - - ssl_crl_cache:insert({file, filename:join([PrivDir, "erlangCA", "crl.pem"])}), - ssl_crl_cache:insert({file, filename:join([PrivDir, "otpCA", "crl.pem"])}), - - ClientOpts = case ?config(idp_crl, Config) of - true -> - [{cacertfile, filename:join([PrivDir, "revoked", "cacerts.pem"])}, - {crl_cache, {ssl_crl_cache, {internal, [{http, 5000}]}}}, - {crl_check, Check}, - {verify, verify_peer}]; - false -> - [{cacertfile, filename:join([PrivDir, "revoked", "cacerts.pem"])}, - {crl_check, Check}, - {verify, verify_peer}] - end, - - Client = ssl_test_lib:start_client_error([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {options, ClientOpts}]), - receive - {Server, AlertOrColse} -> - ct:pal("Server Alert or Close ~p", [AlertOrColse]) - end, - ssl_test_lib:check_result(Client, {error, {tls_alert, "certificate revoked"}}). + CACerts = load_cert(filename:join([PrivDir, "erlangCA", "cacerts.pem"])), + ClientOpts = [{cacerts, CACerts}, + {verify, verify_peer}, + {verify_fun, {fun validate_function/3, {CACerts, []}}}], -crl_verify_valid(Hostname, ServerNode, ServerOpts, ClientNode, ClientOpts) -> - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {ssl_test_lib, - send_recv_result_active, []}}, - {options, ServerOpts}]), - Port = ssl_test_lib:inet_port(Server), - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, + {connect_failed, _} = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, {from, self()}, - {mfa, {ssl_test_lib, - send_recv_result_active, []}}, + %{mfa, {?MODULE, + %erlang_ssl_receive, [Data]}}, + {mfa, {ssl_test_lib, no_result, []}}, {options, ClientOpts}]), - - ssl_test_lib:check_result(Client, ok, Server, ok), + %% Clean close down! Server needs to be closed first !! ssl_test_lib:close(Server), - ssl_test_lib:close(Client). + process_flag(trap_exit, false). -%%-------------------------------------------------------------------- -%% Internal functions ------------------------------------------------ -%%-------------------------------------------------------------------- -is_idp(idp_crl) -> - true; -is_idp(_) -> - false. - -init_certs(_,v1_crl, Config) -> - {[{v2_crls, false}], Config}; -init_certs(_, idp_crl, Config) -> - Port = ?config(httpd_port, Config), - {[{crl_port,Port}, - {issuing_distribution_point, true}], Config - }; -init_certs(_,_,Config) -> - {[], Config}. +%%%================================================================ +%%% Lib -make_dir_path(PathComponents) -> - lists:foldl(fun(F,P0) -> file:make_dir(P=filename:join(P0,F)), P end, - "", - PathComponents). +erlang_ssl_receive(Socket, Data) -> + ct:log("~p:~p~nConnection info: ~p~n", + [?MODULE,?LINE, ssl:connection_info(Socket)]), + receive + {ssl, Socket, Data} -> + ct:log("~p:~p~nReceived ~p~n",[?MODULE,?LINE, Data]), + %% open_ssl server sometimes hangs waiting in blocking read + ssl:send(Socket, "Got it"), + ok; + {ssl, Socket, Byte} when length(Byte) == 1 -> + erlang_ssl_receive(Socket, tl(Data)); + {Port, {data,Debug}} when is_port(Port) -> + ct:log("~p:~p~nopenssl ~s~n",[?MODULE,?LINE, Debug]), + erlang_ssl_receive(Socket,Data); + Other -> + ct:fail({unexpected_message, Other}) + after 4000 -> + ct:fail({did_not_get, Data}) + end. + + +erlang_ssl_send(Socket, Data) -> + ct:log("~p:~p~nConnection info: ~p~n", + [?MODULE,?LINE, ssl:connection_info(Socket)]), + ssl:send(Socket, Data), + ok. + +load_certs(undefined) -> + undefined; +load_certs(CertDir) -> + case file:list_dir(CertDir) of + {ok, Certs} -> + load_certs(lists:map(fun(Cert) -> filename:join(CertDir, Cert) + end, Certs), []); + {error, _} -> + undefined + end. + +load_certs([], Acc) -> + ct:log("~p:~p~nSuccessfully loaded ~p CA certificates~n", [?MODULE,?LINE, length(Acc)]), + Acc; +load_certs([Cert|Certs], Acc) -> + case filelib:is_dir(Cert) of + true -> + load_certs(Certs, Acc); + _ -> + %ct:log("~p:~p~nLoading certificate ~p~n", [?MODULE,?LINE, Cert]), + load_certs(Certs, load_cert(Cert) ++ Acc) + end. + +load_cert(Cert) -> + {ok, Bin} = file:read_file(Cert), + case filename:extension(Cert) of + ".der" -> + %% no decoding necessary + [Bin]; + _ -> + %% assume PEM otherwise + Contents = public_key:pem_decode(Bin), + [DER || {Type, DER, Cipher} <- Contents, Type == 'Certificate', Cipher == 'not_encrypted'] + end. + +%% @doc Validator function for SSL negotiation. +%% +validate_function(Cert, valid_peer, State) -> + ct:log("~p:~p~nvaliding peer ~p with ~p intermediate certs~n", + [?MODULE,?LINE, get_common_name(Cert), + length(element(2, State))]), + %% peer certificate validated, now check the CRL + Res = (catch check_crl(Cert, State)), + ct:log("~p:~p~nCRL validate result for ~p: ~p~n", + [?MODULE,?LINE, get_common_name(Cert), Res]), + {Res, State}; +validate_function(Cert, valid, {TrustedCAs, IntermediateCerts}=State) -> + case public_key:pkix_is_self_signed(Cert) of + true -> + ct:log("~p:~p~nroot certificate~n",[?MODULE,?LINE]), + %% this is a root cert, no CRL + {valid, {TrustedCAs, [Cert|IntermediateCerts]}}; + false -> + %% check is valid CA certificate, add to the list of + %% intermediates + Res = (catch check_crl(Cert, State)), + ct:log("~p:~p~nCRL intermediate CA validate result for ~p: ~p~n", + [?MODULE,?LINE, get_common_name(Cert), Res]), + {Res, {TrustedCAs, [Cert|IntermediateCerts]}} + end; +validate_function(_Cert, _Event, State) -> + %ct:log("~p:~p~nignoring event ~p~n", [?MODULE,?LINE, _Event]), + {valid, State}. + +%% @doc Given a certificate, find CRL distribution points for the given +%% certificate, fetch, and attempt to validate each CRL through +%% issuer_function/4. +%% +check_crl(Cert, State) -> + %% pull the CRL distribution point(s) out of the certificate, if any + ct:log("~p:~p~ncheck_crl(~n Cert=~p,~nState=~p~n)",[?MODULE,?LINE,Cert,State]), + case pubkey_cert:select_extension( + ?'id-ce-cRLDistributionPoints', + pubkey_cert:extensions_list(Cert#'OTPCertificate'.tbsCertificate#'OTPTBSCertificate'.extensions)) of + undefined -> + ct:log("~p:~p~nno CRL distribution points for ~p~n", + [?MODULE,?LINE, get_common_name(Cert)]), + %% fail; we can't validate if there's no CRL + no_crl; + CRLExtension -> + ct:log("~p:~p~nCRLExtension=~p)",[?MODULE,?LINE,CRLExtension]), + CRLDistPoints = CRLExtension#'Extension'.extnValue, + DPointsAndCRLs = lists:foldl(fun(Point, Acc) -> + %% try to read the CRL over http or from a + %% local file + case fetch_point(Point) of + not_available -> + ct:log("~p:~p~nfetch_point returned~n~p~n)",[?MODULE,?LINE,not_available]), + Acc; + Res -> + ct:log("~p:~p~nfetch_point returned~n~p~n)",[?MODULE,?LINE,Res]), + [{Point, Res} | Acc] + end + end, [], CRLDistPoints), + public_key:pkix_crls_validate(Cert, + DPointsAndCRLs, + [{issuer_fun, + {fun issuer_function/4, State}}]) + end. + +%% @doc Given a list of distribution points for CRLs, certificates and +%% both trusted and intermediary certificates, attempt to build and +%% authority chain back via build_chain to verify that it is valid. +%% +issuer_function(_DP, CRL, _Issuer, {TrustedCAs, IntermediateCerts}) -> + %% XXX the 'Issuer' we get passed here is the AuthorityKeyIdentifier, + %% which we are not currently smart enough to understand + %% Read the CA certs out of the file + ct:log("~p:~p~nissuer_function(~nCRL=~p,~nLast param=~p)",[?MODULE,?LINE,CRL, {TrustedCAs, IntermediateCerts}]), + Certs = [public_key:pkix_decode_cert(DER, otp) || DER <- TrustedCAs], + %% get the real issuer out of the CRL + Issuer = public_key:pkix_normalize_name( + pubkey_cert_records:transform( + CRL#'CertificateList'.tbsCertList#'TBSCertList'.issuer, decode)), + %% assume certificates are ordered from root to tip + case find_issuer(Issuer, IntermediateCerts ++ Certs) of + undefined -> + ct:log("~p:~p~nunable to find certificate matching CRL issuer ~p~n", + [?MODULE,?LINE, Issuer]), + error; + IssuerCert -> + ct:log("~p:~p~nIssuerCert=~p~n)",[?MODULE,?LINE,IssuerCert]), + case build_chain({public_key:pkix_encode('OTPCertificate', + IssuerCert, + otp), + IssuerCert}, IntermediateCerts, Certs, []) of + undefined -> + error; + {OTPCert, Path} -> + {ok, OTPCert, Path} + end + end. + +%% @doc Attempt to build authority chain back using intermediary +%% certificates, falling back on trusted certificates if the +%% intermediary chain of certificates does not fully extend to the +%% root. +%% +%% Returns: {RootCA :: #OTPCertificate{}, Chain :: [der_encoded()]} +%% +build_chain({DER, Cert}, IntCerts, TrustedCerts, Acc) -> + %% check if this cert is self-signed, if it is, we've reached the + %% root of the chain + Issuer = public_key:pkix_normalize_name( + Cert#'OTPCertificate'.tbsCertificate#'OTPTBSCertificate'.issuer), + Subject = public_key:pkix_normalize_name( + Cert#'OTPCertificate'.tbsCertificate#'OTPTBSCertificate'.subject), + case Issuer == Subject of + true -> + case find_issuer(Issuer, TrustedCerts) of + undefined -> + ct:log("~p:~p~nself-signed certificate is NOT trusted~n",[?MODULE,?LINE]), + undefined; + TrustedCert -> + %% return the cert from the trusted list, to prevent + %% issuer spoofing + {TrustedCert, + [public_key:pkix_encode( + 'OTPCertificate', TrustedCert, otp)|Acc]} + end; + false -> + Match = lists:foldl( + fun(C, undefined) -> + S = public_key:pkix_normalize_name(C#'OTPCertificate'.tbsCertificate#'OTPTBSCertificate'.subject), + %% compare the subject to the current issuer + case Issuer == S of + true -> + %% we've found our man + {public_key:pkix_encode('OTPCertificate', C, otp), C}; + false -> + undefined + end; + (_E, A) -> + %% already matched + A + end, undefined, IntCerts), + case Match of + undefined when IntCerts /= TrustedCerts -> + %% continue the chain by using the trusted CAs + ct:log("~p:~p~nRan out of intermediate certs, switching to trusted certs~n",[?MODULE,?LINE]), + build_chain({DER, Cert}, TrustedCerts, TrustedCerts, Acc); + undefined -> + ct:log("Can't construct chain of trust beyond ~p~n", + [?MODULE,?LINE, get_common_name(Cert)]), + %% can't find the current cert's issuer + undefined; + Match -> + build_chain(Match, IntCerts, TrustedCerts, [DER|Acc]) + end + end. + +%% @doc Given a certificate and a list of trusted or intermediary +%% certificates, attempt to find a match in the list or bail with +%% undefined. +find_issuer(Issuer, Certs) -> + lists:foldl( + fun(OTPCert, undefined) -> + %% check if this certificate matches the issuer + Normal = public_key:pkix_normalize_name( + OTPCert#'OTPCertificate'.tbsCertificate#'OTPTBSCertificate'.subject), + case Normal == Issuer of + true -> + OTPCert; + false -> + undefined + end; + (_E, Acc) -> + %% already found a match + Acc + end, undefined, Certs). + +%% @doc Find distribution points for a given CRL and then attempt to +%% fetch the CRL from the first available. +fetch_point(#'DistributionPoint'{distributionPoint={fullName, Names}}) -> + Decoded = [{NameType, + pubkey_cert_records:transform(Name, decode)} + || {NameType, Name} <- Names], + ct:log("~p:~p~ncall fetch(~nDecoded=~p~n)",[?MODULE,?LINE,Decoded]), + fetch(Decoded). + +%% @doc Given a list of locations to retrieve a CRL from, attempt to +%% retrieve either from a file or http resource and bail as soon as +%% it can be found. +%% +%% Currently, only hand a armored PEM or DER encoded file, with +%% defaulting to DER. +%% +fetch([]) -> + not_available; +fetch([{uniformResourceIdentifier, "http"++_=URL}|Rest]) -> + ct:log("~p:~p~ngetting CRL from ~p~n", [?MODULE,?LINE, URL]), + case httpc:request(get, {URL, []}, [], [{body_format, binary}]) of + {ok, {_Status, _Headers, Body}} -> + case Body of + <<"-----BEGIN", _/binary>> -> + ct:log("~p:~p~npublic_key:pem_decode,~nBody=~p~n)",[?MODULE,?LINE,Body]), + [{'CertificateList', + DER, _}=CertList] = public_key:pem_decode(Body), + ct:log("~p:~p~npublic_key:pem_entry_decode,~nCertList=~p~n)",[?MODULE,?LINE,CertList]), + {DER, public_key:pem_entry_decode(CertList)}; + _ -> + ct:log("~p:~p~npublic_key:pem_entry_decode,~nBody=~p~n)",[?MODULE,?LINE,{'CertificateList', Body, not_encrypted}]), + %% assume DER encoded + try + public_key:pem_entry_decode({'CertificateList', Body, not_encrypted}) + of + CertList -> {Body, CertList} + catch + _C:_E -> + ct:log("~p:~p~nfailed DER assumption~nRest=~p", [?MODULE,?LINE,Rest]), + fetch(Rest) + end + end; + {error, _Reason} -> + ct:log("~p:~p~nfailed to get CRL ~p~n", [?MODULE,?LINE, _Reason]), + fetch(Rest); + Other -> + ct:log("~p:~p~nreally failed to get CRL ~p~n", [?MODULE,?LINE, Other]), + fetch(Rest) + end; +fetch([Loc|Rest]) -> + %% unsupported CRL location + ct:log("~p:~p~nunable to fetch CRL from unsupported location ~p~n", + [?MODULE,?LINE, Loc]), + fetch(Rest). + +%% get the common name attribute out of an OTPCertificate record +get_common_name(OTPCert) -> + %% You'd think there'd be an easier way than this giant mess, but I + %% couldn't find one. + {rdnSequence, Subject} = OTPCert#'OTPCertificate'.tbsCertificate#'OTPTBSCertificate'.subject, + case [Attribute#'AttributeTypeAndValue'.value || [Attribute] <- Subject, + Attribute#'AttributeTypeAndValue'.type == ?'id-at-commonName'] of + [Att] -> + case Att of + {teletexString, Str} -> Str; + {printableString, Str} -> Str; + {utf8String, Bin} -> binary_to_list(Bin) + end; + _ -> + unknown + end. diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_dist_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_dist_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_dist_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_dist_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -39,9 +38,12 @@ %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- + +suite() -> + [{ct_hooks,[ts_install_cth]}]. + all() -> - [basic, payload, plain_options, plain_verify_options, nodelay_option, - listen_port_options, listen_options, use_interface]. + [basic, payload, plain_options, plain_verify_options]. groups() -> []. @@ -88,15 +90,17 @@ common_init(Case, Config). common_init(Case, Config) -> - ct:timetrap({seconds, ?DEFAULT_TIMETRAP_SECS}), - [{testcase, Case}|Config]. + Dog = ?t:timetrap(?t:seconds(?DEFAULT_TIMETRAP_SECS)), + [{watchdog, Dog},{testcase, Case}|Config]. end_per_testcase(Case, Config) when is_list(Config) -> Flags = proplists:get_value(old_flags, Config), catch os:putenv("ERL_FLAGS", Flags), common_end(Case, Config). -common_end(_, _Config) -> +common_end(_, Config) -> + Dog = ?config(watchdog, Config), + ?t:timetrap_cancel(Dog), ok. %%-------------------------------------------------------------------- @@ -251,146 +255,6 @@ stop_ssl_node(NH1), stop_ssl_node(NH2), success(Config). -%%-------------------------------------------------------------------- -nodelay_option() -> - [{doc,"Test specifying dist_nodelay option"}]. -nodelay_option(Config) -> - try - %% The default is 'true', so try setting it to 'false'. - application:set_env(kernel, dist_nodelay, false), - basic(Config) - after - application:unset_env(kernel, dist_nodelay) - end. - -listen_port_options() -> - [{doc, "Test specifying listening ports"}]. -listen_port_options(Config) when is_list(Config) -> - %% Start a node, and get the port number it's listening on. - NH1 = start_ssl_node(Config), - Node1 = NH1#node_handle.nodename, - Name1 = lists:takewhile(fun(C) -> C =/= $@ end, atom_to_list(Node1)), - {ok, NodesPorts} = apply_on_ssl_node(NH1, fun net_adm:names/0), - {Name1, Port1} = lists:keyfind(Name1, 1, NodesPorts), - - %% Now start a second node, configuring it to use the same port - %% number. - PortOpt1 = "-kernel inet_dist_listen_min " ++ integer_to_list(Port1) ++ - " inet_dist_listen_max " ++ integer_to_list(Port1), - - try start_ssl_node([{additional_dist_opts, PortOpt1} | Config]) of - #node_handle{} -> - %% If the node was able to start, it didn't take the port - %% option into account. - exit(unexpected_success) - catch - exit:{accept_failed, timeout} -> - %% The node failed to start, as expected. - ok - end, - - %% Try again, now specifying a high max port. - PortOpt2 = "-kernel inet_dist_listen_min " ++ integer_to_list(Port1) ++ - " inet_dist_listen_max 65535", - NH2 = start_ssl_node([{additional_dist_opts, PortOpt2} | Config]), - Node2 = NH2#node_handle.nodename, - Name2 = lists:takewhile(fun(C) -> C =/= $@ end, atom_to_list(Node2)), - {ok, NodesPorts2} = apply_on_ssl_node(NH2, fun net_adm:names/0), - {Name2, Port2} = lists:keyfind(Name2, 1, NodesPorts2), - - %% The new port should be higher: - if Port2 > Port1 -> - ok; - true -> - error({port, Port2, not_higher_than, Port1}) - end, - - stop_ssl_node(NH1), - stop_ssl_node(NH2), - success(Config). -%%-------------------------------------------------------------------- -listen_options() -> - [{doc, "Test inet_dist_listen_options"}]. -listen_options(Config) when is_list(Config) -> - Prio = 1, - case gen_udp:open(0, [{priority,Prio}]) of - {ok,Socket} -> - case inet:getopts(Socket, [priority]) of - {ok,[{priority,Prio}]} -> - ok = gen_udp:close(Socket), - do_listen_options(Prio, Config); - _ -> - ok = gen_udp:close(Socket), - {skip, - "Can not set priority "++integer_to_list(Prio)++ - " on socket"} - end; - {error,_} -> - {skip, "Can not set priority on socket"} - end. - -do_listen_options(Prio, Config) -> - PriorityString0 = "[{priority,"++integer_to_list(Prio)++"}]", - PriorityString = - case os:cmd("echo [{a,1}]") of - "[{a,1}]"++_ -> - PriorityString0; - _ -> - %% Some shells need quoting of [{}] - "'"++PriorityString0++"'" - end, - - Options = "-kernel inet_dist_listen_options " ++ PriorityString, - - NH1 = start_ssl_node([{additional_dist_opts, Options} | Config]), - NH2 = start_ssl_node([{additional_dist_opts, Options} | Config]), - Node2 = NH2#node_handle.nodename, - - pong = apply_on_ssl_node(NH1, fun () -> net_adm:ping(Node2) end), - - PrioritiesNode1 = - apply_on_ssl_node(NH1, fun get_socket_priorities/0), - PrioritiesNode2 = - apply_on_ssl_node(NH2, fun get_socket_priorities/0), - - Elevated1 = [P || P <- PrioritiesNode1, P =:= Prio], - ?t:format("Elevated1: ~p~n", [Elevated1]), - Elevated2 = [P || P <- PrioritiesNode2, P =:= Prio], - ?t:format("Elevated2: ~p~n", [Elevated2]), - [_|_] = Elevated1, - [_|_] = Elevated2, - - stop_ssl_node(NH1), - stop_ssl_node(NH2), - success(Config). -%%-------------------------------------------------------------------- -use_interface() -> - [{doc, "Test inet_dist_use_interface"}]. -use_interface(Config) when is_list(Config) -> - %% Force the node to listen only on the loopback interface. - IpString = "'{127,0,0,1}'", - Options = "-kernel inet_dist_use_interface " ++ IpString, - - %% Start a node, and get the port number it's listening on. - NH1 = start_ssl_node([{additional_dist_opts, Options} | Config]), - Node1 = NH1#node_handle.nodename, - Name = lists:takewhile(fun(C) -> C =/= $@ end, atom_to_list(Node1)), - {ok, NodesPorts} = apply_on_ssl_node(NH1, fun net_adm:names/0), - {Name, Port} = lists:keyfind(Name, 1, NodesPorts), - - %% Now find the socket listening on that port, and check its sockname. - Sockets = apply_on_ssl_node( - NH1, - fun() -> - [inet:sockname(P) || - P <- erlang:ports(), - {ok, Port} =:= (catch inet:port(P))] - end), - %% And check that it's actually listening on localhost. - [{ok,{{127,0,0,1},Port}}] = Sockets, - - stop_ssl_node(NH1), - success(Config). %%-------------------------------------------------------------------- %%% Internal functions ----------------------------------------------- @@ -405,12 +269,6 @@ send_to_tstcntrl(Message) -> send_to_tstsrvr({message, Message}). -get_socket_priorities() -> - [Priority || - {ok,[{priority,Priority}]} <- - [inet:getopts(Port, [priority]) || - Port <- erlang:ports(), - element(2, erlang:port_info(Port, name)) =:= "tcp_inet"]]. %% %% test_server side api @@ -759,7 +617,7 @@ ok = file:make_dir(NodeDir), ok = file:make_dir(RGenDir), make_randfile(RGenDir), - {ok, _} = make_certs:all(RGenDir, NodeDir), + make_certs:all(RGenDir, NodeDir), SDir = filename:join([NodeDir, "server"]), SC = filename:join([SDir, "cert.pem"]), SK = filename:join([SDir, "key.pem"]), diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_ECC_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_ECC_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_ECC_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_ECC_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/.2 %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -32,6 +31,8 @@ %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [ {group, 'tlsv1.2'}, @@ -46,7 +47,7 @@ {'tlsv1', [], all_versions_groups()}, {'erlang_server', [], key_cert_combinations()}, {'erlang_client', [], key_cert_combinations()}, - {'erlang', [], key_cert_combinations() ++ misc()} + {'erlang', [], key_cert_combinations()} ]. all_versions_groups ()-> @@ -65,17 +66,16 @@ client_rsa_server_ecdsa ]. -misc()-> - [client_ecdsa_server_ecdsa_with_raw_key]. - %%-------------------------------------------------------------------- init_per_suite(Config0) -> end_per_suite(Config0), try crypto:start() of ok -> %% make rsa certs using oppenssl - {ok, _} = make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0)), + Result = + (catch make_certs:all(?config(data_dir, Config0), + ?config(priv_dir, Config0))), + ct:log("Make certs ~p~n", [Result]), Config1 = ssl_test_lib:make_ecdsa_cert(Config0), Config2 = ssl_test_lib:make_ecdh_rsa_cert(Config1), ssl_test_lib:cert_options(Config2) @@ -146,7 +146,6 @@ ct:log("Ciphers: ~p~n ", [ ssl:cipher_suites()]), end_per_testcase(TestCase, Config), ssl:start(), - ct:timetrap({seconds, 15}), Config. end_per_testcase(_TestCase, Config) -> @@ -192,32 +191,6 @@ SOpts = ?config(server_ecdsa_verify_opts, Config), basic_test(COpts, SOpts, Config). -client_ecdsa_server_ecdsa_with_raw_key(Config) when is_list(Config) -> - COpts = ?config(client_ecdsa_opts, Config), - SOpts = ?config(server_ecdsa_verify_opts, Config), - ServerCert = proplists:get_value(certfile, SOpts), - ServerKeyFile = proplists:get_value(keyfile, SOpts), - {ok, PemBin} = file:read_file(ServerKeyFile), - PemEntries = public_key:pem_decode(PemBin), - {'ECPrivateKey', Key, not_encrypted} = proplists:lookup('ECPrivateKey', PemEntries), - ServerKey = {'ECPrivateKey', Key}, - ServerCA = proplists:get_value(cacertfile, SOpts), - ClientCert = proplists:get_value(certfile, COpts), - ClientKey = proplists:get_value(keyfile, COpts), - ClientCA = proplists:get_value(cacertfile, COpts), - SType = ?config(server_type, Config), - CType = ?config(client_type, Config), - {Server, Port} = start_server_with_raw_key(SType, - ClientCA, ServerCA, - ServerCert, - ServerKey, - Config), - Client = start_client(CType, Port, ServerCA, ClientCA, - ClientCert, - ClientKey, Config), - check_result(Server, SType, Client, CType), - close(Server, Client). - %%-------------------------------------------------------------------- %% Internal functions ------------------------------------------------ %%-------------------------------------------------------------------- @@ -248,13 +221,10 @@ PrivDir = ?config(priv_dir, Config), NewCA = new_ca(filename:join(PrivDir, "new_ca.pem"), CA, OwnCa), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_client", "-verify", "2", "-port", integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-cert", Cert, "-CAfile", NewCA, - "-key", Key, "-host","localhost", "-msg", "-debug"], - - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + Cmd = "openssl s_client -verify 2 -port " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ Cert ++ " -CAfile " ++ NewCA + ++ " -key " ++ Key ++ " -host localhost -msg -debug", + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), true = port_command(OpenSslPort, "Hello world"), OpenSslPort; start_client(erlang, Port, CA, _, Cert, Key, Config) -> @@ -273,14 +243,16 @@ Port = ssl_test_lib:inet_port(node()), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), ssl_test_lib:version_flag(Version), - "-verify", "2", "-cert", Cert, "-CAfile", NewCA, - "-key", Key, "-msg", "-debug"], - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -verify 2 -cert " ++ Cert ++ " -CAfile " ++ NewCA + ++ " -key " ++ Key ++ " -msg -debug", + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), + ssl_test_lib:wait_for_openssl_server(), true = port_command(OpenSslPort, "Hello world"), {OpenSslPort, Port}; + start_server(erlang, CA, _, Cert, Key, Config) -> + {_, ServerNode, _} = ssl_test_lib:run_where(Config), Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, {from, self()}, @@ -291,17 +263,6 @@ [{verify, verify_peer}, {cacertfile, CA}, {certfile, Cert}, {keyfile, Key}]}]), {Server, ssl_test_lib:inet_port(Server)}. -start_server_with_raw_key(erlang, CA, _, Cert, Key, Config) -> - {_, ServerNode, _} = ssl_test_lib:run_where(Config), - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {ssl_test_lib, - send_recv_result_active, - []}}, - {options, - [{verify, verify_peer}, {cacertfile, CA}, - {certfile, Cert}, {key, Key}]}]), - {Server, ssl_test_lib:inet_port(Server)}. check_result(Server, erlang, Client, erlang) -> ssl_test_lib:check_result(Server, ok, Client, ok); diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_handshake_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_handshake_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_handshake_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_handshake_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -32,54 +31,15 @@ %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [decode_hello_handshake, decode_single_hello_extension_correctly, decode_supported_elliptic_curves_hello_extension_correctly, decode_unknown_hello_extension_correctly, encode_single_hello_sni_extension_correctly, decode_single_hello_sni_extension_correctly, - decode_empty_server_sni_correctly, - select_proper_tls_1_2_rsa_default_hashsign, - ignore_hassign_extension_pre_tls_1_2]. - -%%-------------------------------------------------------------------- -init_per_suite(Config) -> - Config. -end_per_suite(Config) -> - Config. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_,Config) -> - Config. - -init_per_testcase(ignore_hassign_extension_pre_tls_1_2, Config0) -> - catch crypto:stop(), - try crypto:start() of - ok -> - case is_supported(sha512) of - true -> - ssl:start(), - %% make rsa certs using oppenssl - {ok, _} = make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0)), - Config = ssl_test_lib:cert_options(Config0), - ct:timetrap({seconds, 5}), - Config; - false -> - {skip, "Crypto did not support sha512"} - end - catch _:_ -> - {skip, "Crypto did not start"} - end; -init_per_testcase(_, Config0) -> - Config0. - -end_per_testcase(ignore_hassign_extension_pre_tls_1_2, _) -> - crypto:stop(); -end_per_testcase(_TestCase, Config) -> - Config. + select_proper_tls_1_2_rsa_default_hashsign]. %%-------------------------------------------------------------------- %% Test Cases -------------------------------------------------------- @@ -146,13 +106,6 @@ Decoded = ssl_handshake:decode_hello_extensions(SNI), Exts = Decoded. -decode_empty_server_sni_correctly(_Config) -> - Exts = #hello_extensions{sni = ""}, - SNI = <>, - Decoded = ssl_handshake:decode_hello_extensions(SNI), - Exts = Decoded. - - select_proper_tls_1_2_rsa_default_hashsign(_Config) -> % RFC 5246 section 7.4.1.4.1 tells to use {sha1,rsa} as default signature_algorithm for RSA key exchanges {sha, rsa} = ssl_handshake:select_hashsign_algs(undefined, ?rsaEncryption, {3,3}), @@ -160,18 +113,3 @@ {md5sha, rsa} = ssl_handshake:select_hashsign_algs(undefined, ?rsaEncryption, {3,2}), {md5sha, rsa} = ssl_handshake:select_hashsign_algs(undefined, ?rsaEncryption, {3,0}). - -ignore_hassign_extension_pre_tls_1_2(Config) -> - Opts = ?config(server_opts, Config), - CertFile = proplists:get_value(certfile, Opts), - [{_, Cert, _}] = ssl_test_lib:pem_to_der(CertFile), - HashSigns = #hash_sign_algos{hash_sign_algos = [{sha512, rsa}, {sha, dsa}]}, - {sha512, rsa} = ssl_handshake:select_hashsign(HashSigns, Cert, {3,3}), - %%% Ignore - {md5sha, rsa} = ssl_handshake:select_hashsign(HashSigns, Cert, {3,2}), - {md5sha, rsa} = ssl_handshake:select_hashsign(HashSigns, Cert, {3,0}). - -is_supported(Hash) -> - Algos = crypto:supports(), - Hashs = proplists:get_value(hashs, Algos), - lists:member(Hash, Hashs). diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_npn_handshake_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_npn_handshake_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_npn_handshake_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_npn_handshake_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,6 +29,8 @@ %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [{group, 'tlsv1.2'}, {group, 'tlsv1.1'}, @@ -69,8 +70,10 @@ try crypto:start() of ok -> ssl:start(), - {ok, _} = make_certs:all(?config(data_dir, Config), - ?config(priv_dir, Config)), + Result = + (catch make_certs:all(?config(data_dir, Config), + ?config(priv_dir, Config))), + ct:log("Make certs ~p~n", [Result]), ssl_test_lib:cert_options(Config) catch _:_ -> {skip, "Crypto did not start"} @@ -99,15 +102,6 @@ end_per_group(_GroupName, Config) -> Config. -init_per_testcase(_TestCase, Config) -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:log("Ciphers: ~p~n ", [ ssl:cipher_suites()]), - ct:timetrap({seconds, 10}), - Config. - -end_per_testcase(_TestCase, Config) -> - Config. - %%-------------------------------------------------------------------- %% Test Cases -------------------------------------------------------- %%-------------------------------------------------------------------- @@ -178,7 +172,7 @@ run_npn_handshake(Config, [], [{next_protocols_advertised, [<<"spdy/1">>, <<"http/1.1">>, <<"http/1.0">>]}], - {error, protocol_not_negotiated}). + {error, next_protocol_not_negotiated}). %-------------------------------------------------------------------------------- @@ -186,7 +180,7 @@ run_npn_handshake(Config, [{client_preferred_next_protocols, {client, [<<"spdy/2">>], <<"http/1.1">>}}], [], - {error, protocol_not_negotiated}). + {error, next_protocol_not_negotiated}). %-------------------------------------------------------------------------------- renegotiate_from_client_after_npn_handshake(Config) when is_list(Config) -> @@ -317,8 +311,8 @@ assert_npn(Socket, Protocol) -> ct:log("Negotiated Protocol ~p, Expecting: ~p ~n", - [ssl:negotiated_protocol(Socket), Protocol]), - Protocol = ssl:negotiated_protocol(Socket). + [ssl:negotiated_next_protocol(Socket), Protocol]), + Protocol = ssl:negotiated_next_protocol(Socket). assert_npn_and_renegotiate_and_send_data(Socket, Protocol, Data) -> assert_npn(Socket, Protocol), @@ -338,7 +332,7 @@ ssl_send(Socket, Data) -> ct:log("Connection info: ~p~n", - [ssl:connection_information(Socket)]), + [ssl:connection_info(Socket)]), ssl:send(Socket, Data). ssl_receive(Socket, Data) -> @@ -346,7 +340,7 @@ ssl_receive(Socket, Data, Buffer) -> ct:log("Connection info: ~p~n", - [ssl:connection_information(Socket)]), + [ssl:connection_info(Socket)]), receive {ssl, Socket, MoreData} -> ct:log("Received ~p~n",[MoreData]), @@ -366,4 +360,4 @@ connection_info_result(Socket) -> - ssl:connection_information(Socket). + ssl:connection_info(Socket). diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_npn_hello_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_npn_hello_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_npn_hello_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_npn_hello_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -33,6 +32,9 @@ %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- + +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [encode_and_decode_npn_client_hello_test, encode_and_decode_npn_server_hello_test, @@ -41,14 +43,6 @@ create_server_hello_with_advertised_protocols_test, create_server_hello_with_no_advertised_protocols_test]. -init_per_testcase(_TestCase, Config) -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:timetrap({seconds, 5}), - Config. - -end_per_testcase(_TestCase, Config) -> - Config. - %%-------------------------------------------------------------------- %% Test Cases -------------------------------------------------------- %%-------------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_packet_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_packet_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_packet_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_packet_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -38,12 +37,16 @@ -define(uint24(X), << ?UINT24(X) >> ). -define(uint32(X), << ?UINT32(X) >> ). -define(uint64(X), << ?UINT64(X) >> ). +-define(TIMEOUT, 120000). -define(MANY, 1000). -define(SOME, 50). %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- + +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [ {group, 'tlsv1.2'}, @@ -137,8 +140,10 @@ try crypto:start() of ok -> ssl:start(), - {ok, _} = make_certs:all(?config(data_dir, Config), - ?config(priv_dir, Config)), + Result = + (catch make_certs:all(?config(data_dir, Config), + ?config(priv_dir, Config))), + ct:log("Make certs ~p~n", [Result]), ssl_test_lib:cert_options(Config) catch _:_ -> {skip, "Crypto did not start"} @@ -167,9 +172,10 @@ end_per_group(_GroupName, Config) -> Config. -init_per_testcase(_TestCase, Config) -> - ct:timetrap({seconds, 15}), - Config. +init_per_testcase(_TestCase, Config0) -> + Config = lists:keydelete(watchdog, 1, Config0), + Dog = ct:timetrap(?TIMEOUT), + [{watchdog, Dog} | Config]. end_per_testcase(_TestCase, Config) -> diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_payload_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_payload_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_payload_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_payload_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,6 +29,8 @@ %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [ {group, 'tlsv1.2'}, @@ -71,7 +72,7 @@ try crypto:start() of ok -> ssl:start(), - {ok, _} = make_certs:all(?config(data_dir, Config), ?config(priv_dir, Config)), + make_certs:all(?config(data_dir, Config), ?config(priv_dir, Config)), ssl_test_lib:cert_options(Config) catch _:_ -> {skip, "Crypto did not start"} @@ -99,27 +100,10 @@ end_per_group(_GroupName, Config) -> Config. -init_per_testcase(TestCase, Config) when TestCase == server_echos_passive_huge; - TestCase == server_echos_active_once_huge; - TestCase == server_echos_active_huge; - TestCase == client_echos_passive_huge; - TestCase == client_echos_active_once_huge; - TestCase == client_echos_active_huge -> - ct:timetrap({seconds, 90}), - Config; - -init_per_testcase(TestCase, Config) when TestCase == server_echos_passive_big; - TestCase == server_echos_active_once_big; - TestCase == server_echos_active_big; - TestCase == client_echos_passive_big; - TestCase == client_echos_active_once_big; - TestCase == client_echos_active_big -> - ct:timetrap({seconds, 60}), - Config; - -init_per_testcase(_TestCase, Config) -> - ct:timetrap({seconds, 15}), - Config. +init_per_testcase(_TestCase, Config0) -> + Config = lists:keydelete(watchdog, 1, Config0), + Dog = ct:timetrap(?TIMEOUT), + [{watchdog, Dog} | Config]. end_per_testcase(_TestCase, Config) -> Config. diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_pem_cache_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_pem_cache_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_pem_cache_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_pem_cache_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% - --module(ssl_pem_cache_SUITE). - -%% Note: This directive should only be used in test suites. --compile(export_all). - --include_lib("common_test/include/ct.hrl"). --include_lib("kernel/include/file.hrl"). - --define(CLEANUP_INTERVAL, 5000). - -%%-------------------------------------------------------------------- -%% Common Test interface functions ----------------------------------- -%%-------------------------------------------------------------------- -all() -> - [pem_cleanup]. - -groups() -> - []. - -init_per_suite(Config0) -> - catch crypto:stop(), - try crypto:start() of - ok -> - ssl:start(), - %% make rsa certs using oppenssl - {ok, _} = make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0)), - Config1 = ssl_test_lib:make_dsa_cert(Config0), - ssl_test_lib:cert_options(Config1) - catch _:_ -> - {skip, "Crypto did not start"} - end. - -end_per_suite(_Config) -> - application:stop(crypto). - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -init_per_testcase(pem_cleanup = Case, Config) -> - end_per_testcase(Case, Config) , - application:load(ssl), - application:set_env(ssl, ssl_pem_cache_clean, ?CLEANUP_INTERVAL), - ssl:start(), - ct:timetrap({minutes, 1}), - Config. - -end_per_testcase(_TestCase, Config) -> - ssl:stop(), - Config. - -%%-------------------------------------------------------------------- -%% Test Cases -------------------------------------------------------- -%%-------------------------------------------------------------------- -pem_cleanup() -> - [{doc, "Test pem cache invalidate mechanism"}]. -pem_cleanup(Config)when is_list(Config) -> - process_flag(trap_exit, true), - ClientOpts = ?config(client_opts, Config), - ServerOpts = ?config(server_opts, Config), - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - - Server = - ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {ssl_test_lib, no_result, []}}, - {options, ServerOpts}]), - Port = ssl_test_lib:inet_port(Server), - Client = - ssl_test_lib:start_client([{node, ClientNode}, - {port, Port}, {host, Hostname}, - {mfa, {ssl_test_lib, no_result, []}}, - {from, self()}, {options, ClientOpts}]), - - Size = ssl_pkix_db:db_size(get_pem_cache()), - Certfile = proplists:get_value(certfile, ServerOpts), - {ok, FileInfo} = file:read_file_info(Certfile), - Time = later(), - ok = file:write_file_info(Certfile, FileInfo#file_info{mtime = Time}), - ct:sleep(2 * ?CLEANUP_INTERVAL), - Size1 = ssl_pkix_db:db_size(get_pem_cache()), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - false = Size == Size1. - -get_pem_cache() -> - {status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)), - [_, _,_, _, Prop] = StatusInfo, - State = ssl_test_lib:state(Prop), - case element(6, State) of - [_CertDb, _FileRefDb, PemCache| _] -> - PemCache; - _ -> - undefined - end. - -later()-> - DateTime = calendar:now_to_local_time(os:timestamp()), - Gregorian = calendar:datetime_to_gregorian_seconds(DateTime), - calendar:gregorian_seconds_to_datetime(Gregorian + (2 * ?CLEANUP_INTERVAL)). - diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_session_cache_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_session_cache_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_session_cache_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_session_cache_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/.2 %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -31,7 +30,6 @@ -define(SLEEP, 500). -define(TIMEOUT, 60000). -define(LONG_TIMEOUT, 600000). --define(MAX_TABLE_SIZE, 5). -behaviour(ssl_session_cache_api). @@ -43,27 +41,31 @@ %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [session_cleanup, session_cache_process_list, - session_cache_process_mnesia, - client_unique_session, - max_table_size - ]. + session_cache_process_mnesia]. groups() -> []. init_per_suite(Config0) -> + Dog = ct:timetrap(?LONG_TIMEOUT *2), catch crypto:stop(), try crypto:start() of ok -> ssl:start(), - %% make rsa certs using - {ok, _} = make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0)), - Config = ssl_test_lib:make_dsa_cert(Config0), - ssl_test_lib:cert_options(Config) + %% make rsa certs using oppenssl + Result = + (catch make_certs:all(?config(data_dir, Config0), + ?config(priv_dir, Config0))), + ct:log("Make certs ~p~n", [Result]), + + Config1 = ssl_test_lib:make_dsa_cert(Config0), + Config = ssl_test_lib:cert_options(Config1), + [{watchdog, Dog} | Config] catch _:_ -> {skip, "Crypto did not start"} end. @@ -85,41 +87,30 @@ mnesia:start(), init_customized_session_cache(mnesia, Config); -init_per_testcase(session_cleanup, Config) -> +init_per_testcase(session_cleanup, Config0) -> + Config = lists:keydelete(watchdog, 1, Config0), + Dog = ct:timetrap(?TIMEOUT), ssl:stop(), application:load(ssl), application:set_env(ssl, session_lifetime, 5), application:set_env(ssl, session_delay_cleanup_time, ?DELAY), ssl:start(), - ct:timetrap({seconds, 20}), - Config; - -init_per_testcase(client_unique_session, Config) -> - ct:timetrap({seconds, 40}), - Config; - -init_per_testcase(max_table_size, Config) -> - ssl:stop(), - application:load(ssl), - application:set_env(ssl, session_cache_server_max, ?MAX_TABLE_SIZE), - application:set_env(ssl, session_cache_client_max, ?MAX_TABLE_SIZE), - application:set_env(ssl, session_delay_cleanup_time, ?DELAY), - ssl:start(), - ct:timetrap({seconds, 40}), - Config. + [{watchdog, Dog} | Config]; -init_customized_session_cache(Type, Config) -> +init_per_testcase(_TestCase, Config0) -> + Config = lists:keydelete(watchdog, 1, Config0), + Dog = ct:timetrap(?TIMEOUT), + [{watchdog, Dog} | Config]. + +init_customized_session_cache(Type, Config0) -> + Config = lists:keydelete(watchdog, 1, Config0), + Dog = ct:timetrap(?TIMEOUT), ssl:stop(), application:load(ssl), application:set_env(ssl, session_cb, ?MODULE), - application:set_env(ssl, session_cb_init_args, [{type, Type}]), + application:set_env(ssl, session_cb_init_args, [Type]), ssl:start(), - catch (end_per_testcase(list_to_atom("session_cache_process" ++ atom_to_list(Type)), - Config)), - ets:new(ssl_test, [named_table, public, set]), - ets:insert(ssl_test, {type, Type}), - ct:timetrap({seconds, 5}), - Config. + [{watchdog, Dog} | Config]. end_per_testcase(session_cache_process_list, Config) -> application:unset_env(ssl, session_cb), @@ -135,55 +126,16 @@ application:unset_env(ssl, session_delay_cleanup_time), application:unset_env(ssl, session_lifetime), end_per_testcase(default_action, Config); -end_per_testcase(max_table_size, Config) -> - application:unset_env(ssl, session_cach_server_max), - application:unset_env(ssl, session_cach_client_max), - end_per_testcase(default_action, Config); -end_per_testcase(Case, Config) when Case == session_cache_process_list; - Case == session_cache_process_mnesia -> - ets:delete(ssl_test), - Config; -end_per_testcase(_, Config) -> +end_per_testcase(_TestCase, Config) -> Config. %%-------------------------------------------------------------------- %% Test Cases -------------------------------------------------------- %%-------------------------------------------------------------------- -client_unique_session() -> - [{doc, "Test session table does not grow when client " - "sets up many connections"}]. -client_unique_session(Config) when is_list(Config) -> - process_flag(trap_exit, true), - ClientOpts = ?config(client_opts, Config), - ServerOpts = ?config(server_opts, Config), - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = - ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {ssl_test_lib, no_result, []}}, - {tcp_options, [{active, false}]}, - {options, ServerOpts}]), - Port = ssl_test_lib:inet_port(Server), - LastClient = clients_start(Server, - ClientNode, Hostname, Port, ClientOpts, client_unique_session, 20), - receive - {LastClient, {ok, _}} -> - ok - end, - {status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)), - [_, _,_, _, Prop] = StatusInfo, - State = ssl_test_lib:state(Prop), - ClientCache = element(2, State), - - 1 = ssl_session_cache:size(ClientCache), - - ssl_test_lib:close(Server, 500), - ssl_test_lib:close(LastClient). - session_cleanup() -> [{doc, "Test that sessions are cleand up eventually, so that the session table " "does not grow and grow ..."}]. -session_cleanup(Config) when is_list(Config) -> +session_cleanup(Config)when is_list(Config) -> process_flag(trap_exit, true), ClientOpts = ?config(client_opts, Config), ServerOpts = ?config(server_opts, Config), @@ -197,9 +149,9 @@ Port = ssl_test_lib:inet_port(Server), Client = ssl_test_lib:start_client([{node, ClientNode}, - {port, Port}, {host, Hostname}, + {port, Port}, {host, Hostname}, {mfa, {ssl_test_lib, no_result, []}}, - {from, self()}, {options, ClientOpts}]), + {from, self()}, {options, ClientOpts}]), SessionInfo = receive {Server, Info} -> @@ -212,13 +164,12 @@ {status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)), [_, _,_, _, Prop] = StatusInfo, State = ssl_test_lib:state(Prop), - ClientCache = element(2, State), - ServerCache = element(3, State), - SessionTimer = element(7, State), + Cache = element(2, State), + SessionTimer = element(6, State), Id = proplists:get_value(session_id, SessionInfo), - CSession = ssl_session_cache:lookup(ClientCache, {{Hostname, Port}, Id}), - SSession = ssl_session_cache:lookup(ServerCache, {Port, Id}), + CSession = ssl_session_cache:lookup(Cache, {{Hostname, Port}, Id}), + SSession = ssl_session_cache:lookup(Cache, {Port, Id}), true = CSession =/= undefined, true = SSession =/= undefined, @@ -234,14 +185,42 @@ ct:sleep(?SLEEP), %% Make sure clean has had time to run - undefined = ssl_session_cache:lookup(ClientCache, {{Hostname, Port}, Id}), - undefined = ssl_session_cache:lookup(ServerCache, {Port, Id}), + undefined = ssl_session_cache:lookup(Cache, {{Hostname, Port}, Id}), + undefined = ssl_session_cache:lookup(Cache, {Port, Id}), process_flag(trap_exit, false), ssl_test_lib:close(Server), ssl_test_lib:close(Client). +check_timer(Timer) -> + case erlang:read_timer(Timer) of + false -> + {status, _, _, _} = sys:get_status(whereis(ssl_manager)), + timer:sleep(?SLEEP), + {status, _, _, _} = sys:get_status(whereis(ssl_manager)), + ok; + Int -> + ct:sleep(Int), + check_timer(Timer) + end. +get_delay_timers() -> + {status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)), + [_, _,_, _, Prop] = StatusInfo, + State = ssl_test_lib:state(Prop), + case element(7, State) of + {undefined, undefined} -> + ct:sleep(?SLEEP), + get_delay_timers(); + {undefined, _} -> + ct:sleep(?SLEEP), + get_delay_timers(); + {_, undefined} -> + ct:sleep(?SLEEP), + get_delay_timers(); + DelayTimers -> + DelayTimers + end. %%-------------------------------------------------------------------- session_cache_process_list() -> [{doc,"Test reuse of sessions (short handshake)"}]. @@ -254,55 +233,19 @@ session_cache_process(mnesia,Config). %%-------------------------------------------------------------------- - -max_table_size() -> - [{doc,"Test max limit on session table"}]. -max_table_size(Config) when is_list(Config) -> - process_flag(trap_exit, true), - ClientOpts = ?config(client_verification_opts, Config), - ServerOpts = ?config(server_verification_opts, Config), - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = - ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {ssl_test_lib, no_result, []}}, - {tcp_options, [{active, false}]}, - {options, ServerOpts}]), - Port = ssl_test_lib:inet_port(Server), - LastClient = clients_start(Server, - ClientNode, Hostname, Port, ClientOpts, max_table_size, 20), - receive - {LastClient, {ok, _}} -> - ok - end, - ct:sleep(1000), - {status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)), - [_, _,_, _, Prop] = StatusInfo, - State = ssl_test_lib:state(Prop), - ClientCache = element(2, State), - ServerCache = element(3, State), - N = ssl_session_cache:size(ServerCache), - M = ssl_session_cache:size(ClientCache), - ct:pal("~p",[{N, M}]), - ssl_test_lib:close(Server, 500), - ssl_test_lib:close(LastClient), - true = N =< ?MAX_TABLE_SIZE, - true = M =< ?MAX_TABLE_SIZE. - -%%-------------------------------------------------------------------- %%% Session cache API callbacks %%-------------------------------------------------------------------- -init(Opts) -> - case proplists:get_value(type, Opts) of +init([Type]) -> + ets:new(ssl_test, [named_table, public, set]), + ets:insert(ssl_test, {type, Type}), + case Type of list -> spawn(fun() -> session_loop([]) end); mnesia -> mnesia:start(), - Name = atom_to_list(proplists:get_value(role, Opts)), - TabName = list_to_atom(Name ++ "sess_cache"), - {atomic,ok} = mnesia:create_table(TabName, []), - TabName + {atomic,ok} = mnesia:create_table(sess_cache, []), + sess_cache end. session_cb() -> @@ -315,7 +258,7 @@ Cache ! terminate; mnesia -> catch {atomic,ok} = - mnesia:delete_table(Cache) + mnesia:delete_table(sess_cache) end. lookup(Cache, Key) -> @@ -325,10 +268,10 @@ receive {Cache, Res} -> Res end; mnesia -> case mnesia:transaction(fun() -> - mnesia:read(Cache, + mnesia:read(sess_cache, Key, read) end) of - {atomic, [{Cache, Key, Value}]} -> + {atomic, [{sess_cache, Key, Value}]} -> Value; _ -> undefined @@ -342,8 +285,8 @@ mnesia -> {atomic, ok} = mnesia:transaction(fun() -> - mnesia:write(Cache, - {Cache, Key, Value}, write) + mnesia:write(sess_cache, + {sess_cache, Key, Value}, write) end) end. @@ -354,7 +297,7 @@ mnesia -> {atomic, ok} = mnesia:transaction(fun() -> - mnesia:delete(Cache, Key) + mnesia:delete(sess_cache, Key) end) end. @@ -365,7 +308,7 @@ receive {Cache, Res} -> Res end; mnesia -> Foldl = fun() -> - mnesia:foldl(Fun, Acc, Cache) + mnesia:foldl(Fun, Acc, sess_cache) end, {atomic, Res} = mnesia:transaction(Foldl), Res @@ -382,8 +325,8 @@ mnesia -> Sel = fun() -> mnesia:select(Cache, - [{{Cache,{PartialKey,'_'}, '$1'}, - [],['$1']}]) + [{{sess_cache,{PartialKey,'$1'}, '$2'}, + [],['$$']}]) end, {atomic, Res} = mnesia:transaction(Sel), Res @@ -411,8 +354,8 @@ Pid ! {self(), Res}, session_loop(Sess); {Pid,select_session,PKey} -> - Sel = fun({{PKey0, _Id},Session}, Acc) when PKey == PKey0 -> - [Session | Acc]; + Sel = fun({{PKey0, Id},Session}, Acc) when PKey == PKey0 -> + [[Id, Session]|Acc]; (_,Acc) -> Acc end, @@ -427,75 +370,3 @@ session_cache_process(_Type,Config) when is_list(Config) -> ssl_basic_SUITE:reuse_session(Config). - - -clients_start(_Server, ClientNode, Hostname, Port, ClientOpts, Test, 0) -> - %% Make sure session is registered - ct:sleep(?SLEEP * 2), - ssl_test_lib:start_client([{node, ClientNode}, - {port, Port}, {host, Hostname}, - {mfa, {?MODULE, connection_info_result, []}}, - {from, self()}, {options, test_copts(Test, 0, ClientOpts)}]); -clients_start(Server, ClientNode, Hostname, Port, ClientOpts, Test, N) -> - spawn_link(ssl_test_lib, start_client, - [[{node, ClientNode}, - {port, Port}, {host, Hostname}, - {mfa, {ssl_test_lib, no_result, []}}, - {from, self()}, {options, test_copts(Test, N, ClientOpts)}]]), - Server ! listen, - wait_for_server(), - clients_start(Server, ClientNode, Hostname, Port, ClientOpts, Test, N-1). - -connection_info_result(Socket) -> - ssl:connection_information(Socket, [protocol, cipher_suite]). - -check_timer(Timer) -> - case erlang:read_timer(Timer) of - false -> - {status, _, _, _} = sys:get_status(whereis(ssl_manager)), - timer:sleep(?SLEEP), - {status, _, _, _} = sys:get_status(whereis(ssl_manager)), - ok; - Int -> - ct:sleep(Int), - check_timer(Timer) - end. - -get_delay_timers() -> - {status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)), - [_, _,_, _, Prop] = StatusInfo, - State = ssl_test_lib:state(Prop), - case element(8, State) of - {undefined, undefined} -> - ct:sleep(?SLEEP), - get_delay_timers(); - {undefined, _} -> - ct:sleep(?SLEEP), - get_delay_timers(); - {_, undefined} -> - ct:sleep(?SLEEP), - get_delay_timers(); - DelayTimers -> - DelayTimers - end. - -wait_for_server() -> - ct:sleep(100). - - -test_copts(_, 0, ClientOpts) -> - ClientOpts; -test_copts(max_table_size, N, ClientOpts) -> - Version = tls_record:highest_protocol_version([]), - CipherSuites = %%lists:map(fun(X) -> ssl_cipher:suite_definition(X) end, ssl_cipher:filter_suites(ssl_cipher:suites(Version))), -[ Y|| Y = {Alg,_, _, _} <- lists:map(fun(X) -> ssl_cipher:suite_definition(X) end, ssl_cipher:filter_suites(ssl_cipher:suites(Version))), Alg =/= ecdhe_ecdsa, Alg =/= ecdh_ecdsa, Alg =/= ecdh_rsa, Alg =/= ecdhe_rsa, Alg =/= dhe_dss, Alg =/= dss], - case length(CipherSuites) of - M when M >= N -> - Cipher = lists:nth(N, CipherSuites), - ct:pal("~p",[Cipher]), - [{ciphers, [Cipher]} | ClientOpts]; - _ -> - ClientOpts - end; -test_copts(_, _, ClientOpts) -> - ClientOpts. diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_sni_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_sni_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_sni_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_sni_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,186 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ssl_sni_SUITE). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). --include_lib("public_key/include/public_key.hrl"). - -%%-------------------------------------------------------------------- -%% Common Test interface functions ----------------------------------- -%%-------------------------------------------------------------------- - -all() -> [no_sni_header, - sni_match, - sni_no_match, - no_sni_header_fun, - sni_match_fun, - sni_no_match_fun]. - -init_per_suite(Config0) -> - catch crypto:stop(), - try crypto:start() of - ok -> - ssl:start(), - {ok, _} = make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0)), - ssl_test_lib:cert_options(Config0) - catch _:_ -> - {skip, "Crypto did not start"} - end. - -end_per_suite(_) -> - ssl:stop(), - application:stop(crypto). - -init_per_testcase(_TestCase, Config) -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:log("Ciphers: ~p~n ", [ ssl:cipher_suites()]), - ct:timetrap({seconds, 5}), - Config. - -end_per_testcase(_TestCase, Config) -> - Config. - -%%-------------------------------------------------------------------- -%% Test Cases -------------------------------------------------------- -%%-------------------------------------------------------------------- -no_sni_header(Config) -> - run_handshake(Config, undefined, undefined, "server"). - -no_sni_header_fun(Config) -> - run_sni_fun_handshake(Config, undefined, undefined, "server"). - -sni_match(Config) -> - run_handshake(Config, "a.server", "a.server", "a.server"). - -sni_match_fun(Config) -> - run_sni_fun_handshake(Config, "a.server", "a.server", "a.server"). - -sni_no_match(Config) -> - run_handshake(Config, "c.server", undefined, "server"). - -sni_no_match_fun(Config) -> - run_sni_fun_handshake(Config, "c.server", undefined, "server"). - - -%%-------------------------------------------------------------------- -%% Internal Functions ------------------------------------------------ -%%-------------------------------------------------------------------- -ssl_recv(SSLSocket, Expect) -> - ssl_recv(SSLSocket, "", Expect). - -ssl_recv(SSLSocket, CurrentData, ExpectedData) -> - receive - {ssl, SSLSocket, Data} -> - NeweData = CurrentData ++ Data, - case NeweData of - ExpectedData -> - ok; - _ -> - ssl_recv(SSLSocket, NeweData, ExpectedData) - end; - Other -> - ct:fail({unexpected_message, Other}) - after 4000 -> - ct:fail({timeout, CurrentData, ExpectedData}) - end. - -send_and_hostname(SSLSocket) -> - ssl:send(SSLSocket, "OK"), - {ok, [{sni_hostname, Hostname}]} = ssl:connection_information(SSLSocket, [sni_hostname]), - Hostname. - -rdnPart([[#'AttributeTypeAndValue'{type=Type, value=Value} | _] | _], Type) -> - Value; -rdnPart([_ | Tail], Type) -> - rdnPart(Tail, Type); -rdnPart([], _) -> - unknown. - -rdn_to_string({utf8String, Binary}) -> - erlang:binary_to_list(Binary); -rdn_to_string({printableString, String}) -> - String. - -recv_and_certificate(SSLSocket) -> - ssl_recv(SSLSocket, "OK"), - {ok, PeerCert} = ssl:peercert(SSLSocket), - #'OTPCertificate'{tbsCertificate = #'OTPTBSCertificate'{subject = {rdnSequence, Subject}}} - = public_key:pkix_decode_cert(PeerCert, otp), - ct:log("Subject of certificate received from server: ~p", [Subject]), - rdn_to_string(rdnPart(Subject, ?'id-at-commonName')). - -run_sni_fun_handshake(Config, SNIHostname, ExpectedSNIHostname, ExpectedCN) -> - ct:log("Start running handshake for sni_fun, Config: ~p, SNIHostname: ~p, " - "ExpectedSNIHostname: ~p, ExpectedCN: ~p", - [Config, SNIHostname, ExpectedSNIHostname, ExpectedCN]), - [{sni_hosts, ServerSNIConf}] = ?config(sni_server_opts, Config), - SNIFun = fun(Domain) -> proplists:get_value(Domain, ServerSNIConf, undefined) end, - ServerOptions = ?config(server_opts, Config) ++ [{sni_fun, SNIFun}], - ClientOptions = - case SNIHostname of - undefined -> - ?config(client_opts, Config); - _ -> - [{server_name_indication, SNIHostname}] ++ ?config(client_opts, Config) - end, - ct:log("Options: ~p", [[ServerOptions, ClientOptions]]), - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, {mfa, {?MODULE, send_and_hostname, []}}, - {options, ServerOptions}]), - Port = ssl_test_lib:inet_port(Server), - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, {from, self()}, - {mfa, {?MODULE, recv_and_certificate, []}}, - {options, ClientOptions}]), - ssl_test_lib:check_result(Server, ExpectedSNIHostname, Client, ExpectedCN), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client). - -run_handshake(Config, SNIHostname, ExpectedSNIHostname, ExpectedCN) -> - ct:log("Start running handshake, Config: ~p, SNIHostname: ~p, " - "ExpectedSNIHostname: ~p, ExpectedCN: ~p", - [Config, SNIHostname, ExpectedSNIHostname, ExpectedCN]), - ServerOptions = ?config(sni_server_opts, Config) ++ ?config(server_opts, Config), - ClientOptions = - case SNIHostname of - undefined -> - ?config(client_opts, Config); - _ -> - [{server_name_indication, SNIHostname}] ++ ?config(client_opts, Config) - end, - ct:log("Options: ~p", [[ServerOptions, ClientOptions]]), - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, {mfa, {?MODULE, send_and_hostname, []}}, - {options, ServerOptions}]), - Port = ssl_test_lib:inet_port(Server), - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, {from, self()}, - {mfa, {?MODULE, recv_and_certificate, []}}, - {options, ClientOptions}]), - ssl_test_lib:check_result(Server, ExpectedSNIHostname, Client, ExpectedCN), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client). diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl.spec erlang-17.3-dfsg/lib/ssl/test/ssl.spec --- erlang-18.2-dfsg/lib/ssl/test/ssl.spec 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl.spec 2014-09-16 19:10:57.000000000 +0000 @@ -1,4 +1 @@ {suites,"../ssl_test",all}. -{skip_cases, "../ssl_test", - ssl_bench_SUITE, [setup_sequential, setup_concurrent, payload_simple], - "Benchmarks run separately"}. diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_test_lib.erl erlang-17.3-dfsg/lib/ssl/test/ssl_test_lib.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -188,7 +187,6 @@ Transport = proplists:get_value(transport, Opts, ssl), Options = proplists:get_value(options, Opts), ct:log("~p:~p~n~p:connect(~p, ~p)@~p~n", [?MODULE,?LINE, Transport, Host, Port, Node]), - ct:log("SSLOpts: ~p", [Options]), case rpc:call(Node, Transport, connect, [Host, Port, Options]) of {ok, Socket} -> Pid ! {connected, Socket}, @@ -226,17 +224,6 @@ ct:log("~p:~p~nClient faild several times: connection failed: ~p ~n", [?MODULE,?LINE, Reason]), Pid ! {self(), {error, Reason}} end; - {error, econnreset = Reason} -> - case get(retries) of - N when N < 5 -> - ct:log("~p:~p~neconnreset retries=~p sleep ~p",[?MODULE,?LINE, N,?SLEEP]), - put(retries, N+1), - ct:sleep(?SLEEP), - run_client(Opts); - _ -> - ct:log("~p:~p~nClient faild several times: connection failed: ~p ~n", [?MODULE,?LINE, Reason]), - Pid ! {self(), {error, Reason}} - end; {error, Reason} -> ct:log("~p:~p~nClient: connection failed: ~p ~n", [?MODULE,?LINE, Reason]), Pid ! {connect_failed, Reason}; @@ -252,21 +239,7 @@ receive {'DOWN', Monitor, process, Pid, Reason} -> erlang:demonitor(Monitor), - ct:log("~p:~p~nPid: ~p down due to:~p ~n", [?MODULE,?LINE, Pid, Reason]) - - end. - -close(Pid, Timeout) -> - ct:log("~p:~p~n Close ~p ~n", [?MODULE,?LINE, Pid]), - Monitor = erlang:monitor(process, Pid), - Pid ! close, - receive - {'DOWN', Monitor, process, Pid, Reason} -> - erlang:demonitor(Monitor), - ct:log("~p:~p~nPid: ~p down due to:~p ~n", [?MODULE,?LINE, Pid, Reason]) - after - Timeout -> - exit(Pid, kill) + ct:log("~p:~p~nPid: ~p down due to:~p ~n", [?MODULE,?LINE, Pid, Reason]) end. check_result(Server, ServerMsg, Client, ClientMsg) -> @@ -280,6 +253,7 @@ {Port, {data,Debug}} when is_port(Port) -> ct:log("~p:~p~nopenssl ~s~n",[?MODULE,?LINE, Debug]), check_result(Server, ServerMsg, Client, ClientMsg); + Unexpected -> Reason = {{expected, {Client, ClientMsg}}, {expected, {Server, ServerMsg}}, {got, Unexpected}}, @@ -293,9 +267,6 @@ {Port, {data,Debug}} when is_port(Port) -> ct:log("~p:~p~nopenssl ~s~n",[?MODULE,?LINE, Debug]), check_result(Pid,Msg); - %% {Port, {exit_status, Status}} when is_port(Port) -> - %% ct:log("~p:~p Exit status: ~p~n",[?MODULE,?LINE, Status]), - %% check_result(Pid, Msg); Unexpected -> Reason = {{expected, {Pid, Msg}}, {got, Unexpected}}, @@ -380,12 +351,7 @@ BadKeyFile = filename:join([?config(priv_dir, Config), "badkey.pem"]), PskSharedSecret = <<1,2,3,4,5,6,7,8,9,10,11,12,13,14,15>>, - - SNIServerACertFile = filename:join([?config(priv_dir, Config), "a.server", "cert.pem"]), - SNIServerAKeyFile = filename:join([?config(priv_dir, Config), "a.server", "key.pem"]), - SNIServerBCertFile = filename:join([?config(priv_dir, Config), "b.server", "cert.pem"]), - SNIServerBKeyFile = filename:join([?config(priv_dir, Config), "b.server", "key.pem"]), - [{client_opts, []}, + [{client_opts, [{ssl_imp, new},{reuseaddr, true}]}, {client_verification_opts, [{cacertfile, ClientCaCertFile}, {certfile, ClientCertFile}, {keyfile, ClientKeyFile}, @@ -445,17 +411,7 @@ {server_bad_cert, [{ssl_imp, new},{cacertfile, ServerCaCertFile}, {certfile, BadCertFile}, {keyfile, ServerKeyFile}]}, {server_bad_key, [{ssl_imp, new},{cacertfile, ServerCaCertFile}, - {certfile, ServerCertFile}, {keyfile, BadKeyFile}]}, - {sni_server_opts, [{sni_hosts, [ - {"a.server", [ - {certfile, SNIServerACertFile}, - {keyfile, SNIServerAKeyFile} - ]}, - {"b.server", [ - {certfile, SNIServerBCertFile}, - {keyfile, SNIServerBKeyFile} - ]} - ]}]} + {certfile, ServerCertFile}, {keyfile, BadKeyFile}]} | Config]. @@ -804,12 +760,7 @@ rsa_suites(CounterPart) -> ECC = is_sane_ecc(CounterPart), - FIPS = is_fips(CounterPart), - lists:filter(fun({rsa, des_cbc, sha}) when FIPS == true -> - false; - ({dhe_rsa, des_cbc, sha}) when FIPS == true -> - false; - ({rsa, _, _}) -> + lists:filter(fun({rsa, _, _}) -> true; ({dhe_rsa, _, _}) -> true; @@ -860,34 +811,48 @@ false -> "DSS | ECDHE | ECDH" end, - lists:filter(fun(Str) -> string_regex_filter(Str, Names) - end, Ciphers). + lists:filter(fun(Str) -> + case re:run(Str, Names,[]) of + nomatch -> + false; + _ -> + true + end + end, Ciphers). openssl_dsa_suites() -> Ciphers = ssl:cipher_suites(openssl), - lists:filter(fun(Str) -> string_regex_filter(Str, "DSS") + lists:filter(fun(Str) -> + case re:run(Str,"DSS",[]) of + nomatch -> + false; + _ -> + true + end end, Ciphers). openssl_ecdsa_suites() -> Ciphers = ssl:cipher_suites(openssl), - lists:filter(fun(Str) -> string_regex_filter(Str, "ECDHE-ECDSA") + lists:filter(fun(Str) -> + case re:run(Str,"ECDHE-ECDSA",[]) of + nomatch -> + false; + _ -> + true + end end, Ciphers). openssl_ecdh_rsa_suites() -> Ciphers = ssl:cipher_suites(openssl), - lists:filter(fun(Str) -> string_regex_filter(Str, "ECDH-RSA") + lists:filter(fun(Str) -> + case re:run(Str,"ECDH-RSA",[]) of + nomatch -> + false; + _ -> + true + end end, Ciphers). -string_regex_filter(Str, Search) when is_list(Str) -> - case re:run(Str, Search, []) of - nomatch -> - false; - _ -> - true - end; -string_regex_filter(_Str, _Search) -> - false. - anonymous_suites() -> Suites = [{dh_anon, rc4_128, md5}, @@ -895,8 +860,6 @@ {dh_anon, '3des_ede_cbc', sha}, {dh_anon, aes_128_cbc, sha}, {dh_anon, aes_256_cbc, sha}, - {dh_anon, aes_128_gcm, null}, - {dh_anon, aes_256_gcm, null}, {ecdh_anon,rc4_128,sha}, {ecdh_anon,'3des_ede_cbc',sha}, {ecdh_anon,aes_128_cbc,sha}, @@ -922,13 +885,8 @@ {rsa_psk, aes_128_cbc, sha}, {rsa_psk, aes_256_cbc, sha}, {rsa_psk, aes_128_cbc, sha256}, - {rsa_psk, aes_256_cbc, sha384}, - {psk, aes_128_gcm, null}, - {psk, aes_256_gcm, null}, - {dhe_psk, aes_128_gcm, null}, - {dhe_psk, aes_256_gcm, null}, - {rsa_psk, aes_128_gcm, null}, - {rsa_psk, aes_256_gcm, null}], + {rsa_psk, aes_256_cbc, sha384} +], ssl_cipher:filter_suites(Suites). psk_anon_suites() -> @@ -967,10 +925,6 @@ {srp_dss, aes_256_cbc, sha}], ssl_cipher:filter_suites(Suites). -rc4_suites(Version) -> - Suites = ssl_cipher:rc4_suites(Version), - ssl_cipher:filter_suites(Suites). - pem_to_der(File) -> {ok, PemBin} = file:read_file(File), public_key:pem_decode(PemBin). @@ -980,8 +934,7 @@ file:write_file(File, PemBin). cipher_result(Socket, Result) -> - {ok, Info} = ssl:connection_information(Socket), - Result = {ok, {proplists:get_value(protocol, Info), proplists:get_value(cipher_suite, Info)}}, + Result = ssl:connection_info(Socket), ct:log("~p:~p~nSuccessfull connect: ~p~n", [?MODULE,?LINE, Result]), %% Importante to send two packets here %% to properly test "cipher state" handling @@ -1101,9 +1054,6 @@ "OpenSSL 1.0.0" ++ _ -> % Known bug in openssl %% manifests as SSL_CHECK_SERVERHELLO_TLSEXT:tls invalid ecpointformat list false; - "OpenSSL 1.0.1l" ++ _ -> - %% Breaks signature verification - false; "OpenSSL 0.9.8" ++ _ -> % Does not support ECC false; "OpenSSL 0.9.7" ++ _ -> % Does not support ECC @@ -1124,25 +1074,6 @@ is_sane_ecc(_) -> true. -is_fips(openssl) -> - VersionStr = os:cmd("openssl version"), - case re:split(VersionStr, "fips") of - [_] -> - false; - _ -> - true - end; -is_fips(crypto) -> - [{_,_, Bin}] = crypto:info_lib(), - case re:split(Bin, <<"fips">>) of - [_] -> - false; - _ -> - true - end; -is_fips(_) -> - false. - cipher_restriction(Config0) -> case is_sane_ecc(openssl) of false -> @@ -1159,8 +1090,6 @@ check_sane_openssl_version(Version) -> case {Version, os:cmd("openssl version")} of - {_, "OpenSSL 1.0.2" ++ _} -> - true; {_, "OpenSSL 1.0.1" ++ _} -> true; {'tlsv1.2', "OpenSSL 1.0" ++ _} -> @@ -1178,35 +1107,32 @@ enough_openssl_crl_support("OpenSSL 0." ++ _) -> false; enough_openssl_crl_support(_) -> true. -wait_for_openssl_server(Port) -> - wait_for_openssl_server(Port, 10). -wait_for_openssl_server(_, 0) -> - exit(failed_to_connect_to_openssl); -wait_for_openssl_server(Port, N) -> - case gen_tcp:connect("localhost", Port, []) of - {ok, S} -> - gen_tcp:close(S); - _ -> - ct:sleep(?SLEEP), - wait_for_openssl_server(Port, N-1) +wait_for_openssl_server() -> + receive + {Port, {data, Debug}} when is_port(Port) -> + ct:log("~p:~p~nopenssl ~s~n",[?MODULE,?LINE, Debug]), + %% openssl has started make sure + %% it will be in accept. Parsing + %% output is too error prone. (Even + %% more so than sleep!) + ct:sleep(?SLEEP) end. version_flag(tlsv1) -> - "-tls1"; + " -tls1 "; version_flag('tlsv1.1') -> - "-tls1_1"; + " -tls1_1 "; version_flag('tlsv1.2') -> - "-tls1_2"; + " -tls1_2 "; version_flag(sslv3) -> - "-ssl3". + " -ssl3 ". filter_suites(Ciphers0) -> Version = tls_record:highest_protocol_version([]), Supported0 = ssl_cipher:suites(Version) - ++ ssl_cipher:anonymous_suites(Version) + ++ ssl_cipher:anonymous_suites() ++ ssl_cipher:psk_suites(Version) - ++ ssl_cipher:srp_suites() - ++ ssl_cipher:rc4_suites(Version), + ++ ssl_cipher:srp_suites(), Supported1 = ssl_cipher:filter_suites(Supported0), Supported2 = [ssl:suite_definition(S) || S <- Supported1], [Cipher || Cipher <- Ciphers0, lists:member(Cipher, Supported2)]. @@ -1243,9 +1169,3 @@ ct:log("Timeout~n",[]) end end. - -portable_open_port(Exe, Args) -> - AbsPath = os:find_executable(Exe), - ct:pal("open_port({spawn_executable, ~p}, [{args, ~p}, stderr_to_stdout]).", [AbsPath, Args]), - open_port({spawn_executable, AbsPath}, - [{args, Args}, stderr_to_stdout]). diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_to_openssl_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_to_openssl_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_to_openssl_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_to_openssl_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -26,6 +25,8 @@ -include_lib("common_test/include/ct.hrl"). +-define(TIMEOUT, 120000). +-define(LONG_TIMEOUT, 600000). -define(SLEEP, 1000). -define(OPENSSL_RENEGOTIATE, "R\n"). -define(OPENSSL_QUIT, "Q\n"). @@ -36,6 +37,8 @@ %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- +suite() -> [{ct_hooks,[ts_install_cth]}]. + all() -> [ {group, basic}, @@ -47,9 +50,9 @@ groups() -> [{basic, [], basic_tests()}, - {'tlsv1.2', [], all_versions_tests() ++ alpn_tests() ++ npn_tests() ++ sni_server_tests()}, - {'tlsv1.1', [], all_versions_tests() ++ alpn_tests() ++ npn_tests() ++ sni_server_tests()}, - {'tlsv1', [], all_versions_tests()++ alpn_tests() ++ npn_tests() ++ sni_server_tests()}, + {'tlsv1.2', [], all_versions_tests() ++ npn_tests()}, + {'tlsv1.1', [], all_versions_tests() ++ npn_tests()}, + {'tlsv1', [], all_versions_tests()++ npn_tests()}, {'sslv3', [], all_versions_tests()}]. basic_tests() -> @@ -76,18 +79,6 @@ expired_session, ssl2_erlang_server_openssl_client]. -alpn_tests() -> - [erlang_client_alpn_openssl_server_alpn, - erlang_server_alpn_openssl_client_alpn, - erlang_client_alpn_openssl_server, - erlang_client_openssl_server_alpn, - erlang_server_alpn_openssl_client, - erlang_server_openssl_client_alpn, - erlang_client_alpn_openssl_server_alpn_renegotiate, - erlang_server_alpn_openssl_client_alpn_renegotiate, - erlang_client_alpn_npn_openssl_server_alpn_npn, - erlang_server_alpn_npn_openssl_client_alpn_npn]. - npn_tests() -> [erlang_client_openssl_server_npn, erlang_server_openssl_client_npn, @@ -98,29 +89,24 @@ erlang_client_openssl_server_npn_only_client, erlang_client_openssl_server_npn_only_server]. -sni_server_tests() -> - [erlang_server_openssl_client_sni_match, - erlang_server_openssl_client_sni_match_fun, - erlang_server_openssl_client_sni_no_match, - erlang_server_openssl_client_sni_no_match_fun, - erlang_server_openssl_client_sni_no_header, - erlang_server_openssl_client_sni_no_header_fun]. - init_per_suite(Config0) -> + Dog = ct:timetrap(?LONG_TIMEOUT *2), case os:find_executable("openssl") of false -> {skip, "Openssl not found"}; _ -> - ct:pal("Version: ~p", [os:cmd("openssl version")]), catch crypto:stop(), try crypto:start() of ok -> ssl:start(), - {ok, _} = make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0)), + Result = + (catch make_certs:all(?config(data_dir, Config0), + ?config(priv_dir, Config0))), + ct:log("Make certs ~p~n", [Result]), Config1 = ssl_test_lib:make_dsa_cert(Config0), - Config = ssl_test_lib:cert_options(Config1), + Config2 = ssl_test_lib:cert_options(Config1), + Config = [{watchdog, Dog} | Config2], ssl_test_lib:cipher_restriction(Config) catch _:_ -> {skip, "Crypto did not start"} @@ -149,22 +135,19 @@ end_per_group(_GroupName, Config) -> Config. -init_per_testcase(expired_session, Config) -> - ct:timetrap(?EXPIRE * 1000 * 5), +init_per_testcase(expired_session, Config0) -> + Config = lists:keydelete(watchdog, 1, Config0), + Dog = ct:timetrap(?EXPIRE * 1000 * 5), ssl:stop(), application:load(ssl), application:set_env(ssl, session_lifetime, ?EXPIRE), ssl:start(), - Config; + [{watchdog, Dog} | Config]; -init_per_testcase(TestCase, Config) when TestCase == ciphers_rsa_signed_certs; - TestCase == ciphers_dsa_signed_certs -> - ct:timetrap({seconds, 45}), - special_init(TestCase, Config); - -init_per_testcase(TestCase, Config) -> - ct:timetrap({seconds, 10}), - special_init(TestCase, Config). +init_per_testcase(TestCase, Config0) -> + Config = lists:keydelete(watchdog, 1, Config0), + Dog = ct:timetrap(?TIMEOUT), + special_init(TestCase, [{watchdog, Dog} | Config]). special_init(TestCase, Config) when TestCase == erlang_client_openssl_server_renegotiate; @@ -178,36 +161,6 @@ check_sane_openssl_sslv2(Config); special_init(TestCase, Config) - when TestCase == erlang_client_alpn_openssl_server_alpn; - TestCase == erlang_server_alpn_openssl_client_alpn; - TestCase == erlang_client_alpn_openssl_server; - TestCase == erlang_client_openssl_server_alpn; - TestCase == erlang_server_alpn_openssl_client; - TestCase == erlang_server_openssl_client_alpn -> - check_openssl_alpn_support(Config); - -special_init(TestCase, Config) - when TestCase == erlang_client_alpn_openssl_server_alpn_renegotiate; - TestCase == erlang_server_alpn_openssl_client_alpn_renegotiate -> - {ok, Version} = application:get_env(ssl, protocol_version), - case check_sane_openssl_renegotaite(Config, Version) of - {skip, _} = Skip -> - Skip; - _ -> - check_openssl_alpn_support(Config) - end; - -special_init(TestCase, Config) - when TestCase == erlang_client_alpn_npn_openssl_server_alpn_npn; - TestCase == erlang_server_alpn_npn_openssl_client_alpn_npn -> - case check_openssl_alpn_support(Config) of - {skip, _} = Skip -> - Skip; - _ -> - check_openssl_npn_support(Config) - end; - -special_init(TestCase, Config) when TestCase == erlang_client_openssl_server_npn; TestCase == erlang_server_openssl_client_npn; TestCase == erlang_server_openssl_client_npn_only_server; @@ -226,16 +179,6 @@ _ -> check_openssl_npn_support(Config) end; - -special_init(TestCase, Config) - when TestCase == erlang_server_openssl_client_sni_match; - TestCase == erlang_server_openssl_client_sni_no_match; - TestCase == erlang_server_openssl_client_sni_no_header; - TestCase == erlang_server_openssl_client_sni_match_fun; - TestCase == erlang_server_openssl_client_sni_no_match_fun; - TestCase == erlang_server_openssl_client_sni_no_header_fun -> - check_openssl_sni_support(Config); - special_init(_, Config) -> Config. @@ -263,13 +206,14 @@ CertFile = proplists:get_value(certfile, ServerOpts), KeyFile = proplists:get_value(keyfile, ServerOpts), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), - "-cert", CertFile, "-key", KeyFile], + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ + " -cert " ++ CertFile ++ " -key " ++ KeyFile, + + ct:log("openssl cmd: ~p~n", [Cmd]), - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), - ssl_test_lib:wait_for_openssl_server(Port), + ssl_test_lib:wait_for_openssl_server(), Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, @@ -302,11 +246,13 @@ {mfa, {?MODULE, erlang_ssl_receive, [Data]}}, {options, ServerOpts}]), Port = ssl_test_lib:inet_port(Server), + + Cmd = "openssl s_client -port " ++ integer_to_list(Port) ++ + " -host localhost" ++ workaround_openssl_s_clinent(), + + ct:log("openssl cmd: ~p~n", [Cmd]), - Exe = "openssl", - Args = ["s_client", "-connect", "localhost:" ++ integer_to_list(Port) | workaround_openssl_s_clinent()], - - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), true = port_command(OpenSslPort, Data), ssl_test_lib:check_result(Server, ok), @@ -332,14 +278,14 @@ CertFile = proplists:get_value(certfile, ServerOpts), KeyFile = proplists:get_value(keyfile, ServerOpts), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-cert", CertFile, "-key", KeyFile], - - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ CertFile ++ " -key " ++ KeyFile, + + ct:log("openssl cmd: ~p~n", [Cmd]), + + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), - ssl_test_lib:wait_for_openssl_server(Port), + ssl_test_lib:wait_for_openssl_server(), Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, @@ -374,12 +320,12 @@ Port = ssl_test_lib:inet_port(Server), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_client", "-connect", "localhost: " ++ integer_to_list(Port), - ssl_test_lib:version_flag(Version)], + Cmd = "openssl s_client -port " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -host localhost", - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + ct:log("openssl cmd: ~p~n", [Cmd]), + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), true = port_command(OpenSslPort, Data), ssl_test_lib:check_result(Server, ok), @@ -405,15 +351,16 @@ CertFile = proplists:get_value(certfile, ServerOpts), KeyFile = proplists:get_value(keyfile, ServerOpts), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-cert", CertFile, "-CAfile", CaCertFile, - "-key", KeyFile, "-Verify", "2", "-msg"], - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ CertFile ++ " -CAfile " ++ CaCertFile + ++ " -key " ++ KeyFile ++ " -Verify 2 -msg", + + ct:log("openssl cmd: ~p~n", [Cmd]), + + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), - ssl_test_lib:wait_for_openssl_server(Port), + ssl_test_lib:wait_for_openssl_server(), Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, @@ -452,14 +399,13 @@ {options, ServerOpts}]), Port = ssl_test_lib:inet_port(Server), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_client", "-connect", "localhost: " ++ integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-cert", CertFile, - "-CAfile", CaCertFile, - "-key", KeyFile, "-msg"], + Cmd = "openssl s_client -port " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -host localhost " ++ " -cert " ++ CertFile ++ " -CAfile " ++ CaCertFile + ++ " -key " ++ KeyFile ++ " -msg", - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + ct:log("openssl cmd: ~p~n", [Cmd]), + + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), true = port_command(OpenSslPort, Data), ssl_test_lib:check_result(Server, ok), @@ -489,13 +435,12 @@ {options, ServerOpts}]), Port = ssl_test_lib:inet_port(Server), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), + Cmd = "openssl s_client -port " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -host localhost -reconnect", + + ct:log("openssl cmd: ~p~n", [Cmd]), - Exe = "openssl", - Args = ["s_client", "-connect", "localhost:" ++ integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-reconnect"], - - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), true = port_command(OpenSslPort, Data), @@ -526,14 +471,14 @@ KeyFile = proplists:get_value(keyfile, ServerOpts), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-cert", CertFile, "-key", KeyFile, "-msg"], + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ CertFile ++ " -key " ++ KeyFile ++ " -msg", - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), + ct:log("openssl cmd: ~p~n", [Cmd]), + + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), - ssl_test_lib:wait_for_openssl_server(Port), + ssl_test_lib:wait_for_openssl_server(), Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, @@ -575,14 +520,14 @@ CertFile = proplists:get_value(certfile, ServerOpts), KeyFile = proplists:get_value(keyfile, ServerOpts), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-cert", CertFile, "-key", KeyFile, "-msg"], + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ CertFile ++ " -key " ++ KeyFile ++ " -msg", - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), + ct:log("openssl cmd: ~p~n", [Cmd]), - ssl_test_lib:wait_for_openssl_server(Port), + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), + + ssl_test_lib:wait_for_openssl_server(), Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, @@ -621,12 +566,12 @@ {options, [{renegotiate_at, N}, {reuse_sessions, false} | ServerOpts]}]), Port = ssl_test_lib:inet_port(Server), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_client","-connect", "localhost: " ++ integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-msg"], + Cmd = "openssl s_client -port " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -host localhost -msg", + + ct:log("openssl cmd: ~p~n", [Cmd]), - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), true = port_command(OpenSslPort, Data), @@ -656,14 +601,14 @@ CertFile = proplists:get_value(certfile, ServerOpts), KeyFile = proplists:get_value(keyfile, ServerOpts), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-cert", CertFile, "-key", KeyFile, "-msg"], + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ CertFile ++ " -key " ++ KeyFile ++ " -msg", - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), - - ssl_test_lib:wait_for_openssl_server(Port), + ct:log("openssl cmd: ~p~n", [Cmd]), + + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), + + ssl_test_lib:wait_for_openssl_server(), Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, @@ -698,15 +643,15 @@ CaCertFile = proplists:get_value(cacertfile, ServerOpts), KeyFile = proplists:get_value(keyfile, ServerOpts), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-cert", CertFile, "-CAfile", CaCertFile, - "-key", KeyFile, "-Verify", "2"], + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ CertFile ++ " -CAfile " ++ CaCertFile + ++ " -key " ++ KeyFile ++ " -Verify 2", - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), + ct:log("openssl cmd: ~p~n", [Cmd]), - ssl_test_lib:wait_for_openssl_server(Port), + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), + + ssl_test_lib:wait_for_openssl_server(), Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, @@ -749,14 +694,15 @@ CertFile = proplists:get_value(certfile, ClientOpts), KeyFile = proplists:get_value(keyfile, ClientOpts), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_client", "-cert", CertFile, - "-CAfile", CaCertFile, - "-key", KeyFile,"-connect", "localhost:" ++ integer_to_list(Port), - ssl_test_lib:version_flag(Version)], - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + Cmd = "openssl s_client -cert " ++ CertFile ++ " -CAfile " ++ CaCertFile + ++ " -key " ++ KeyFile ++ " -port " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -host localhost", - true = port_command(OpenSslPort, Data), + ct:log("openssl cmd: ~p~n", [Cmd]), + + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), + true = port_command(OpenSslPort, Data), + ssl_test_lib:check_result(Server, ok), %% Clean close down! Server needs to be closed first !! @@ -837,12 +783,14 @@ CertFile = proplists:get_value(certfile, ServerOpts), KeyFile = proplists:get_value(keyfile, ServerOpts), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), ssl_test_lib:version_flag(Version), - "-cert", CertFile, "-key", KeyFile], - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ CertFile ++ " -key " ++ KeyFile ++ "", + + ct:log("openssl cmd: ~p~n", [Cmd]), + + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), - ssl_test_lib:wait_for_openssl_server(Port), + ssl_test_lib:wait_for_openssl_server(), Client0 = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, @@ -891,13 +839,14 @@ CertFile = proplists:get_value(certfile, ServerOpts), KeyFile = proplists:get_value(keyfile, ServerOpts), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), - "-cert", CertFile,"-key", KeyFile], + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ + " -cert " ++ CertFile ++ " -key " ++ KeyFile ++ "", - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), + ct:log("openssl cmd: ~p~n", [Cmd]), + + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), - ssl_test_lib:wait_for_openssl_server(Port), + ssl_test_lib:wait_for_openssl_server(), Client0 = ssl_test_lib:start_client([{node, ClientNode}, @@ -948,11 +897,12 @@ {options, ServerOpts}]), Port = ssl_test_lib:inet_port(Server), - Exe = "openssl", - Args = ["s_client", "-connect", "localhost:" ++ integer_to_list(Port), - "-ssl2", "-msg"], + Cmd = "openssl s_client -port " ++ integer_to_list(Port) ++ + " -host localhost -ssl2 -msg", + + ct:log("openssl cmd: ~p~n", [Cmd]), - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), true = port_command(OpenSslPort, Data), ct:log("Ports ~p~n", [[erlang:port_info(P) || P <- erlang:ports()]]), @@ -974,128 +924,6 @@ process_flag(trap_exit, false). %%-------------------------------------------------------------------- - -erlang_client_alpn_openssl_server_alpn(Config) when is_list(Config) -> - Data = "From openssl to erlang", - start_erlang_client_and_openssl_server_for_alpn_negotiation(Config, Data, fun(Client, OpensslPort) -> - true = port_command(OpensslPort, Data), - - ssl_test_lib:check_result(Client, ok) - end), - ok. - -%%-------------------------------------------------------------------- - -erlang_server_alpn_openssl_client_alpn(Config) when is_list(Config) -> - Data = "From openssl to erlang", - start_erlang_server_and_openssl_client_for_alpn_negotiation(Config, Data, fun(Client, OpensslPort) -> - true = port_command(OpensslPort, Data), - - ssl_test_lib:check_result(Client, ok) - end), - ok. - -%%-------------------------------------------------------------------------- - -erlang_client_alpn_openssl_server(Config) when is_list(Config) -> - Data = "From openssl to erlang", - start_erlang_client_and_openssl_server_with_opts(Config, - [{alpn_advertised_protocols, [<<"spdy/2">>]}], - [], - Data, fun(Server, OpensslPort) -> - true = port_command(OpensslPort, Data), - ssl_test_lib:check_result(Server, ok) - end), - ok. - -%%-------------------------------------------------------------------------- - -erlang_client_openssl_server_alpn(Config) when is_list(Config) -> - Data = "From openssl to erlang", - start_erlang_client_and_openssl_server_with_opts(Config, - [], - ["-alpn", "spdy/2"], - Data, fun(Server, OpensslPort) -> - true = port_command(OpensslPort, Data), - ssl_test_lib:check_result(Server, ok) - end), - ok. - -%%-------------------------------------------------------------------------- - -erlang_server_alpn_openssl_client(Config) when is_list(Config) -> - Data = "From openssl to erlang", - start_erlang_server_and_openssl_client_with_opts(Config, - [{alpn_preferred_protocols, [<<"spdy/2">>]}], - [], - Data, fun(Server, OpensslPort) -> - true = port_command(OpensslPort, Data), - ssl_test_lib:check_result(Server, ok) - end), - ok. - -%%-------------------------------------------------------------------------- - -erlang_server_openssl_client_alpn(Config) when is_list(Config) -> - Data = "From openssl to erlang", - start_erlang_server_and_openssl_client_with_opts(Config, - [], - ["-alpn", "spdy/2"], - Data, fun(Server, OpensslPort) -> - true = port_command(OpensslPort, Data), - ssl_test_lib:check_result(Server, ok) - end), - ok. - -%%-------------------------------------------------------------------- - -erlang_client_alpn_openssl_server_alpn_renegotiate(Config) when is_list(Config) -> - Data = "From openssl to erlang", - start_erlang_client_and_openssl_server_for_alpn_negotiation(Config, Data, fun(Client, OpensslPort) -> - true = port_command(OpensslPort, ?OPENSSL_RENEGOTIATE), - ct:sleep(?SLEEP), - true = port_command(OpensslPort, Data), - - ssl_test_lib:check_result(Client, ok) - end), - ok. - -%%-------------------------------------------------------------------- - -erlang_server_alpn_openssl_client_alpn_renegotiate(Config) when is_list(Config) -> - Data = "From openssl to erlang", - start_erlang_server_and_openssl_client_for_alpn_negotiation(Config, Data, fun(Client, OpensslPort) -> - true = port_command(OpensslPort, ?OPENSSL_RENEGOTIATE), - ct:sleep(?SLEEP), - true = port_command(OpensslPort, Data), - - ssl_test_lib:check_result(Client, ok) - end), - ok. - -%%-------------------------------------------------------------------- - -erlang_client_alpn_npn_openssl_server_alpn_npn(Config) when is_list(Config) -> - Data = "From openssl to erlang", - start_erlang_client_and_openssl_server_for_alpn_npn_negotiation(Config, Data, fun(Client, OpensslPort) -> - true = port_command(OpensslPort, Data), - - ssl_test_lib:check_result(Client, ok) - end), - ok. - -%%-------------------------------------------------------------------- - -erlang_server_alpn_npn_openssl_client_alpn_npn(Config) when is_list(Config) -> - Data = "From openssl to erlang", - start_erlang_server_and_openssl_client_for_alpn_npn_negotiation(Config, Data, fun(Client, OpensslPort) -> - true = port_command(OpensslPort, Data), - - ssl_test_lib:check_result(Client, ok) - end), - ok. - -%%-------------------------------------------------------------------- erlang_client_openssl_server_npn() -> [{doc,"Test erlang client with openssl server doing npn negotiation"}]. @@ -1151,7 +979,7 @@ erlang_client_openssl_server_npn_only_server(Config) when is_list(Config) -> Data = "From openssl to erlang", start_erlang_client_and_openssl_server_with_opts(Config, [], - ["-nextprotoneg", "spdy/2"], Data, fun(Server, OpensslPort) -> + "-nextprotoneg spdy/2", Data, fun(Server, OpensslPort) -> true = port_command(OpensslPort, Data), ssl_test_lib:check_result(Server, ok) end), @@ -1163,7 +991,7 @@ Data = "From openssl to erlang", start_erlang_client_and_openssl_server_with_opts(Config, [{client_preferred_next_protocols, - {client, [<<"spdy/2">>], <<"http/1.1">>}}], [], + {client, [<<"spdy/2">>], <<"http/1.1">>}}], "", Data, fun(Server, OpensslPort) -> true = port_command(OpensslPort, Data), ssl_test_lib:check_result(Server, ok) @@ -1173,7 +1001,7 @@ %%-------------------------------------------------------------------------- erlang_server_openssl_client_npn_only_server(Config) when is_list(Config) -> Data = "From openssl to erlang", - start_erlang_server_and_openssl_client_with_opts(Config, [{next_protocols_advertised, [<<"spdy/2">>]}], [], + start_erlang_server_and_openssl_client_with_opts(Config, [{next_protocols_advertised, [<<"spdy/2">>]}], "", Data, fun(Server, OpensslPort) -> true = port_command(OpensslPort, Data), ssl_test_lib:check_result(Server, ok) @@ -1182,31 +1010,12 @@ erlang_server_openssl_client_npn_only_client(Config) when is_list(Config) -> Data = "From openssl to erlang", - start_erlang_server_and_openssl_client_with_opts(Config, [], ["-nextprotoneg", "spdy/2"], + start_erlang_server_and_openssl_client_with_opts(Config, [], "-nextprotoneg spdy/2", Data, fun(Server, OpensslPort) -> true = port_command(OpensslPort, Data), ssl_test_lib:check_result(Server, ok) end), ok. -%-------------------------------------------------------------------------- -erlang_server_openssl_client_sni_no_header(Config) when is_list(Config) -> - erlang_server_openssl_client_sni_test(Config, undefined, undefined, "server"). - -erlang_server_openssl_client_sni_no_header_fun(Config) when is_list(Config) -> - erlang_server_openssl_client_sni_test_sni_fun(Config, undefined, undefined, "server"). - -erlang_server_openssl_client_sni_match(Config) when is_list(Config) -> - erlang_server_openssl_client_sni_test(Config, "a.server", "a.server", "a.server"). - -erlang_server_openssl_client_sni_match_fun(Config) when is_list(Config) -> - erlang_server_openssl_client_sni_test_sni_fun(Config, "a.server", "a.server", "a.server"). - -erlang_server_openssl_client_sni_no_match(Config) when is_list(Config) -> - erlang_server_openssl_client_sni_test(Config, "c.server", undefined, "server"). - -erlang_server_openssl_client_sni_no_match_fun(Config) when is_list(Config) -> - erlang_server_openssl_client_sni_test_sni_fun(Config, "c.server", undefined, "server"). - %%-------------------------------------------------------------------- %% Internal functions ------------------------------------------------ @@ -1233,94 +1042,6 @@ ct:fail(cipher_suite_failed_see_test_case_log) end. -client_read_check([], _Data) -> - ok; -client_read_check([Hd | T], Data) -> - case binary:match(Data, list_to_binary(Hd)) of - nomatch -> - nomatch; - _ -> - client_read_check(T, Data) - end. -client_check_result(Port, DataExpected, DataReceived) -> - receive - {Port, {data, TheData}} -> - Data = list_to_binary(TheData), - NewData = <>, - ct:log("New Data: ~p", [NewData]), - case client_read_check(DataExpected, NewData) of - ok -> - ok; - _ -> - client_check_result(Port, DataExpected, NewData) - end - after 3000 -> - ct:fail({"Time out on openSSL Client", {expected, DataExpected}, - {got, DataReceived}}) - end. -client_check_result(Port, DataExpected) -> - client_check_result(Port, DataExpected, <<"">>). - -send_and_hostname(SSLSocket) -> - ssl:send(SSLSocket, "OK"), - {ok, [{sni_hostname, Hostname}]} = ssl:connection_information(SSLSocket, [sni_hostname]), - Hostname. - -erlang_server_openssl_client_sni_test(Config, SNIHostname, ExpectedSNIHostname, ExpectedCN) -> - ct:log("Start running handshake, Config: ~p, SNIHostname: ~p, ExpectedSNIHostname: ~p, ExpectedCN: ~p", [Config, SNIHostname, ExpectedSNIHostname, ExpectedCN]), - ServerOptions = ?config(sni_server_opts, Config) ++ ?config(server_opts, Config), - {_, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, {mfa, {?MODULE, send_and_hostname, []}}, - {options, ServerOptions}]), - Port = ssl_test_lib:inet_port(Server), - Exe = "openssl", - ClientArgs = case SNIHostname of - undefined -> - ["s_client", "-connect", Hostname ++ ":" ++ integer_to_list(Port)]; - _ -> - ["s_client", "-connect", Hostname ++ ":" ++ integer_to_list(Port), "-servername", SNIHostname] - end, - ClientPort = ssl_test_lib:portable_open_port(Exe, ClientArgs), - - %% Client check needs to be done befor server check, - %% or server check might consume client messages - ExpectedClientOutput = ["OK", "/CN=" ++ ExpectedCN ++ "/"], - client_check_result(ClientPort, ExpectedClientOutput), - ssl_test_lib:check_result(Server, ExpectedSNIHostname), - ssl_test_lib:close_port(ClientPort), - ssl_test_lib:close(Server), - ok. - - -erlang_server_openssl_client_sni_test_sni_fun(Config, SNIHostname, ExpectedSNIHostname, ExpectedCN) -> - ct:log("Start running handshake for sni_fun, Config: ~p, SNIHostname: ~p, ExpectedSNIHostname: ~p, ExpectedCN: ~p", [Config, SNIHostname, ExpectedSNIHostname, ExpectedCN]), - [{sni_hosts, ServerSNIConf}] = ?config(sni_server_opts, Config), - SNIFun = fun(Domain) -> proplists:get_value(Domain, ServerSNIConf, undefined) end, - ServerOptions = ?config(server_opts, Config) ++ [{sni_fun, SNIFun}], - {_, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, {mfa, {?MODULE, send_and_hostname, []}}, - {options, ServerOptions}]), - Port = ssl_test_lib:inet_port(Server), - Exe = "openssl", - ClientArgs = case SNIHostname of - undefined -> - ["s_client", "-connect", Hostname ++ ":" ++ integer_to_list(Port)]; - _ -> - ["s_client", "-connect", Hostname ++ ":" ++ integer_to_list(Port), "-servername", SNIHostname] - end, - ClientPort = ssl_test_lib:portable_open_port(Exe, ClientArgs), - - %% Client check needs to be done befor server check, - %% or server check might consume client messages - ExpectedClientOutput = ["OK", "/CN=" ++ ExpectedCN ++ "/"], - client_check_result(ClientPort, ExpectedClientOutput), - ssl_test_lib:check_result(Server, ExpectedSNIHostname), - ssl_test_lib:close_port(ClientPort), - ssl_test_lib:close(Server). - - cipher(CipherSuite, Version, Config, ClientOpts, ServerOpts) -> process_flag(trap_exit, true), ct:log("Testing CipherSuite ~p~n", [CipherSuite]), @@ -1330,13 +1051,14 @@ CertFile = proplists:get_value(certfile, ServerOpts), KeyFile = proplists:get_value(keyfile, ServerOpts), - Exe = "openssl", - Args = ["s_server", "-accept", integer_to_list(Port), ssl_test_lib:version_flag(Version), - "-cert", CertFile, "-key", KeyFile], + Cmd = "openssl s_server -accept " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ CertFile ++ " -key " ++ KeyFile ++ "", - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + ct:log("openssl cmd: ~p~n", [Cmd]), - ssl_test_lib:wait_for_openssl_server(Port), + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), + + ssl_test_lib:wait_for_openssl_server(), ConnectionInfo = {ok, {Version, CipherSuite}}, @@ -1392,63 +1114,21 @@ KeyFile = proplists:get_value(keyfile, ServerOpts), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = case OpensslServerOpts of - [] -> - ["s_server", "-accept", - integer_to_list(Port), ssl_test_lib:version_flag(Version), - "-cert", CertFile,"-key", KeyFile]; - [Opt, Value] -> - ["s_server", Opt, Value, "-accept", - integer_to_list(Port), ssl_test_lib:version_flag(Version), - "-cert", CertFile,"-key", KeyFile] - end, - - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), - - ssl_test_lib:wait_for_openssl_server(Port), - - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {mfa, {?MODULE, - erlang_ssl_receive, [Data]}}, - {options, ClientOpts}]), - - Callback(Client, OpensslPort), - - %% Clean close down! Server needs to be closed first !! - ssl_test_lib:close_port(OpensslPort), - - ssl_test_lib:close(Client), - process_flag(trap_exit, false). - -start_erlang_client_and_openssl_server_for_alpn_negotiation(Config, Data, Callback) -> - process_flag(trap_exit, true), - ServerOpts = ?config(server_opts, Config), - ClientOpts0 = ?config(client_opts, Config), - ClientOpts = [{alpn_advertised_protocols, [<<"spdy/2">>]} | ClientOpts0], + Cmd = "openssl s_server " ++ OpensslServerOpts ++ " -accept " ++ + integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ CertFile ++ " -key " ++ KeyFile, - {ClientNode, _, Hostname} = ssl_test_lib:run_where(Config), - - Data = "From openssl to erlang", + ct:log("openssl cmd: ~p~n", [Cmd]), - Port = ssl_test_lib:inet_port(node()), - CertFile = proplists:get_value(certfile, ServerOpts), - KeyFile = proplists:get_value(keyfile, ServerOpts), - Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), - Exe = "openssl", - Args = ["s_server", "-msg", "-alpn", "http/1.1,spdy/2", "-accept", integer_to_list(Port), ssl_test_lib:version_flag(Version), - "-cert", CertFile, "-key" ++ KeyFile], - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), - ssl_test_lib:wait_for_openssl_server(Port), + ssl_test_lib:wait_for_openssl_server(), Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, {from, self()}, {mfa, {?MODULE, - erlang_ssl_receive_and_assert_negotiated_protocol, [<<"spdy/2">>, Data]}}, + erlang_ssl_receive, [Data]}}, {options, ClientOpts}]), Callback(Client, OpensslPort), @@ -1459,41 +1139,11 @@ ssl_test_lib:close(Client), process_flag(trap_exit, false). -start_erlang_server_and_openssl_client_for_alpn_negotiation(Config, Data, Callback) -> - process_flag(trap_exit, true), - ServerOpts0 = ?config(server_opts, Config), - ServerOpts = [{alpn_preferred_protocols, [<<"spdy/2">>]} | ServerOpts0], - - {_, ServerNode, _} = ssl_test_lib:run_where(Config), - - - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {?MODULE, erlang_ssl_receive_and_assert_negotiated_protocol, [<<"spdy/2">>, Data]}}, - {options, ServerOpts}]), - Port = ssl_test_lib:inet_port(Server), - Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - - Exe = "openssl", - Args = ["s_client", "-alpn", "http/1.0,spdy/2" "-msg" "-port", - integer_to_list(Port), ssl_test_lib:version_flag(Version), - "-host", "localhost"], - - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), - - Callback(Server, OpenSslPort), - - ssl_test_lib:close(Server), - - ssl_test_lib:close_port(OpenSslPort), - process_flag(trap_exit, false). - -start_erlang_client_and_openssl_server_for_alpn_npn_negotiation(Config, Data, Callback) -> +start_erlang_client_and_openssl_server_for_npn_negotiation(Config, Data, Callback) -> process_flag(trap_exit, true), ServerOpts = ?config(server_opts, Config), ClientOpts0 = ?config(client_opts, Config), - ClientOpts = [{alpn_advertised_protocols, [<<"spdy/2">>]}, - {client_preferred_next_protocols, {client, [<<"spdy/3">>, <<"http/1.1">>]}} | ClientOpts0], + ClientOpts = [{client_preferred_next_protocols, {client, [<<"spdy/2">>], <<"http/1.1">>}} | ClientOpts0], {ClientNode, _, Hostname} = ssl_test_lib:run_where(Config), @@ -1504,85 +1154,20 @@ KeyFile = proplists:get_value(keyfile, ServerOpts), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_server", "-msg", "-alpn", "http/1.1,spdy/2", "-nextprotoneg", - "spdy/3", "-accept", integer_to_list(Port), ssl_test_lib:version_flag(Version), - "-cert" ++ CertFile ++ "-key" ++ KeyFile], - - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), - - ssl_test_lib:wait_for_openssl_server(Port), - - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {mfa, {?MODULE, - erlang_ssl_receive_and_assert_negotiated_protocol, [<<"spdy/2">>, Data]}}, - {options, ClientOpts}]), - - Callback(Client, OpensslPort), - - %% Clean close down! Server needs to be closed first !! - ssl_test_lib:close_port(OpensslPort), - - ssl_test_lib:close(Client), - process_flag(trap_exit, false). - -start_erlang_server_and_openssl_client_for_alpn_npn_negotiation(Config, Data, Callback) -> - process_flag(trap_exit, true), - ServerOpts0 = ?config(server_opts, Config), - ServerOpts = [{alpn_preferred_protocols, [<<"spdy/2">>]}, - {next_protocols_advertised, [<<"spdy/3">>, <<"http/1.1">>]} | ServerOpts0], - - {_, ServerNode, _} = ssl_test_lib:run_where(Config), - - - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, - {mfa, {?MODULE, erlang_ssl_receive_and_assert_negotiated_protocol, [<<"spdy/2">>, Data]}}, - {options, ServerOpts}]), - Port = ssl_test_lib:inet_port(Server), - Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - Exe = "openssl", - Args = ["s_client", "-alpn", "http/1.1,spdy/2", "-nextprotoneg", "spdy/3", - "-msg", "-port", integer_to_list(Port), ssl_test_lib:version_flag(Version), - "-host", "localhost"], - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), - - Callback(Server, OpenSslPort), + Cmd = "openssl s_server -msg -nextprotoneg http/1.1,spdy/2 -accept " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -cert " ++ CertFile ++ " -key " ++ KeyFile, - ssl_test_lib:close(Server), - ssl_test_lib:close_port(OpenSslPort), - process_flag(trap_exit, false). - -start_erlang_client_and_openssl_server_for_npn_negotiation(Config, Data, Callback) -> - process_flag(trap_exit, true), - ServerOpts = ?config(server_opts, Config), - ClientOpts0 = ?config(client_opts, Config), - ClientOpts = [{client_preferred_next_protocols, {client, [<<"spdy/2">>], <<"http/1.1">>}} | ClientOpts0], + ct:log("openssl cmd: ~p~n", [Cmd]), - {ClientNode, _, Hostname} = ssl_test_lib:run_where(Config), + OpensslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), - Data = "From openssl to erlang", - - Port = ssl_test_lib:inet_port(node()), - CertFile = proplists:get_value(certfile, ServerOpts), - KeyFile = proplists:get_value(keyfile, ServerOpts), - Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - - Exe = "openssl", - Args = ["s_server", "-msg", "-nextprotoneg", "http/1.1,spdy/2", "-accept", integer_to_list(Port), - ssl_test_lib:version_flag(Version), - "-cert", CertFile, "-key", KeyFile], - OpensslPort = ssl_test_lib:portable_open_port(Exe, Args), - - ssl_test_lib:wait_for_openssl_server(Port), + ssl_test_lib:wait_for_openssl_server(), Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, {from, self()}, {mfa, {?MODULE, - erlang_ssl_receive_and_assert_negotiated_protocol, [<<"spdy/2">>, Data]}}, + erlang_ssl_receive_and_assert_npn, [<<"spdy/2">>, Data]}}, {options, ClientOpts}]), Callback(Client, OpensslPort), @@ -1603,16 +1188,16 @@ Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, {from, self()}, - {mfa, {?MODULE, erlang_ssl_receive_and_assert_negotiated_protocol, [<<"spdy/2">>, Data]}}, + {mfa, {?MODULE, erlang_ssl_receive_and_assert_npn, [<<"spdy/2">>, Data]}}, {options, ServerOpts}]), Port = ssl_test_lib:inet_port(Server), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), + Cmd = "openssl s_client -nextprotoneg http/1.0,spdy/2 -msg -port " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -host localhost", - Exe = "openssl", - Args = ["s_client", "-nextprotoneg", "http/1.0,spdy/2", "-msg", "-connect", "localhost:" - ++ integer_to_list(Port), ssl_test_lib:version_flag(Version)], + ct:log("openssl cmd: ~p~n", [Cmd]), - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), Callback(Server, OpenSslPort), @@ -1636,12 +1221,12 @@ {options, ServerOpts}]), Port = ssl_test_lib:inet_port(Server), Version = tls_record:protocol_version(tls_record:highest_protocol_version([])), - - Exe = "openssl", - Args = ["s_client"] ++ OpenSSLClientOpts ++ ["-msg", "-connect", "localhost:" ++ integer_to_list(Port), - ssl_test_lib:version_flag(Version)], + Cmd = "openssl s_client " ++ OpenSSLClientOpts ++ " -msg -port " ++ integer_to_list(Port) ++ ssl_test_lib:version_flag(Version) ++ + " -host localhost", - OpenSslPort = ssl_test_lib:portable_open_port(Exe, Args), + ct:log("openssl cmd: ~p~n", [Cmd]), + + OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]), Callback(Server, OpenSslPort), @@ -1651,15 +1236,15 @@ process_flag(trap_exit, false). -erlang_ssl_receive_and_assert_negotiated_protocol(Socket, Protocol, Data) -> - {ok, Protocol} = ssl:negotiated_protocol(Socket), +erlang_ssl_receive_and_assert_npn(Socket, Protocol, Data) -> + {ok, Protocol} = ssl:negotiated_next_protocol(Socket), erlang_ssl_receive(Socket, Data), - {ok, Protocol} = ssl:negotiated_protocol(Socket), + {ok, Protocol} = ssl:negotiated_next_protocol(Socket), ok. erlang_ssl_receive(Socket, Data) -> ct:log("Connection info: ~p~n", - [ssl:connection_information(Socket)]), + [ssl:connection_info(Socket)]), receive {ssl, Socket, Data} -> io:format("Received ~p~n",[Data]), @@ -1673,19 +1258,21 @@ erlang_ssl_receive(Socket,Data); Other -> ct:fail({unexpected_message, Other}) + after 4000 -> + ct:fail({did_not_get, Data}) end. connection_info(Socket, Version) -> - case ssl:connection_information(Socket, [version]) of - {ok, [{version, Version}] = Info} -> + case ssl:connection_info(Socket) of + {ok, {Version, _} = Info} -> ct:log("Connection info: ~p~n", [Info]), ok; - {ok, [{version, OtherVersion}]} -> + {ok, {OtherVersion, _}} -> {wrong_version, OtherVersion} end. connection_info_result(Socket) -> - ssl:connection_information(Socket). + ssl:connection_info(Socket). delayed_send(Socket, [ErlData, OpenSslData]) -> @@ -1700,14 +1287,6 @@ end. -check_openssl_sni_support(Config) -> - HelpText = os:cmd("openssl s_client --help"), - case string:str(HelpText, "-servername") of - 0 -> - {skip, "Current openssl doesn't support SNI"}; - _ -> - Config - end. check_openssl_npn_support(Config) -> HelpText = os:cmd("openssl s_client --help"), @@ -1718,15 +1297,6 @@ Config end. -check_openssl_alpn_support(Config) -> - HelpText = os:cmd("openssl s_client --help"), - case string:str(HelpText, "alpn") of - 0 -> - {skip, "Openssl not compiled with alpn support"}; - _ -> - Config - end. - check_sane_openssl_renegotaite(Config, Version) when Version == 'tlsv1.1'; Version == 'tlsv1.2' -> case os:cmd("openssl version") of @@ -1745,9 +1315,7 @@ check_sane_openssl_renegotaite(Config). check_sane_openssl_renegotaite(Config) -> - case os:cmd("openssl version") of - "OpenSSL 1.0.0" ++ _ -> - {skip, "Known renegotiation bug in OpenSSL"}; + case os:cmd("openssl version") of "OpenSSL 0.9.8" ++ _ -> {skip, "Known renegotiation bug in OpenSSL"}; "OpenSSL 0.9.7" ++ _ -> @@ -1757,9 +1325,7 @@ end. check_sane_openssl_sslv2(Config) -> - Exe = "openssl", - Args = ["s_client", "-ssl2"], - Port = ssl_test_lib:portable_open_port(Exe, Args), + Port = open_port({spawn, "openssl s_client -ssl2 "}, [stderr_to_stdout]), case supports_sslv2(Port) of true -> Config; @@ -1789,13 +1355,13 @@ %% explicitly specified case os:cmd("openssl version") of "OpenSSL 1.0.1c" ++ _ -> - ["-no_tls1_2"]; + " -no_tls1_2 "; "OpenSSL 1.0.1d" ++ _ -> - ["-no_tls1_2"]; + " -no_tls1_2 "; "OpenSSL 1.0.1e" ++ _ -> - ["-no_tls1_2"]; + " -no_tls1_2 "; "OpenSSL 1.0.1f" ++ _ -> - ["-no_tls1_2"]; + " -no_tls1_2 "; _ -> - [] + "" end. diff -Nru erlang-18.2-dfsg/lib/ssl/test/ssl_upgrade_SUITE.erl erlang-17.3-dfsg/lib/ssl/test/ssl_upgrade_SUITE.erl --- erlang-18.2-dfsg/lib/ssl/test/ssl_upgrade_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/test/ssl_upgrade_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,278 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2014-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% --module(ssl_upgrade_SUITE). - -%% Note: This directive should only be used in test suites. --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --record(state, { - config, - server, - client, - soft, - result_proxy - }). - -all() -> - [ - minor_upgrade, - major_upgrade - ]. - -init_per_suite(Config0) -> - catch crypto:stop(), - try {crypto:start(), erlang:system_info({wordsize, internal}) == erlang:system_info({wordsize, external})} of - {ok, true} -> - case ct_release_test:init(Config0) of - {skip, Reason} -> - {skip, Reason}; - Config -> - {ok, _} = make_certs:all(?config(data_dir, Config), - ?config(priv_dir, Config)), - ssl_test_lib:cert_options(Config) - end; - {ok, false} -> - {skip, "Test server will not handle halfwordemulator correctly. Skip as halfwordemulator is deprecated"} - catch _:_ -> - {skip, "Crypto did not start"} - end. - -end_per_suite(Config) -> - ct_release_test:cleanup(Config), - crypto:stop(). - -init_per_testcase(_TestCase, Config) -> - ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), - ct:timetrap({minutes, 1}), - Config. - -end_per_testcase(_TestCase, Config) -> - Config. - -major_upgrade(Config) when is_list(Config) -> - ct_release_test:upgrade(ssl, major,{?MODULE, #state{config = Config}}, Config). - -minor_upgrade(Config) when is_list(Config) -> - ct_release_test:upgrade(ssl, minor,{?MODULE, #state{config = Config}}, Config). - -upgrade_init(CTData, #state{config = Config} = State) -> - {ok, {_, _, Up, _Down}} = ct_release_test:get_appup(CTData, ssl), - ct:pal("Up: ~p", [Up]), - Soft = is_soft(Up), %% It is symmetrical, if upgrade is soft so is downgrade - Pid = spawn(?MODULE, result_proxy_init, [[]]), - case Soft of - true -> - {Server, Client} = soft_start_connection(Config, Pid), - State#state{server = Server, client = Client, - soft = Soft, - result_proxy = Pid}; - false -> - State#state{soft = Soft, result_proxy = Pid} - end. - -upgrade_upgraded(_, #state{soft = false, config = Config, result_proxy = Pid} = State) -> - ct:pal("Restart upgrade ~n", []), - {Server, Client} = restart_start_connection(Config, Pid), - Result = check_result(Pid, Server, Client), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - ok = Result, - State; - -upgrade_upgraded(_, #state{server = Server0, client = Client0, - config = Config, soft = true, - result_proxy = Pid} = State) -> - ct:pal("Soft upgrade: ~n", []), - Server0 ! changed_version, - Client0 ! changed_version, - Result = check_result(Pid, Server0, Client0), - ssl_test_lib:close(Server0), - ssl_test_lib:close(Client0), - ok = Result, - {Server, Client} = soft_start_connection(Config, Pid), - State#state{server = Server, client = Client}. - -upgrade_downgraded(_, #state{soft = false, config = Config, result_proxy = Pid} = State) -> - ct:pal("Restart downgrade: ~n", []), - {Server, Client} = restart_start_connection(Config, Pid), - Result = check_result(Pid, Server, Client), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - Pid ! stop, - ok = Result, - State; - -upgrade_downgraded(_, #state{server = Server, client = Client, soft = true, result_proxy = Pid} = State) -> - ct:pal("Soft downgrade: ~n", []), - Server ! changed_version, - Client ! changed_version, - Result = check_result(Pid, Server, Client), - Pid ! stop, - ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - ok = Result, - State. - -use_connection(Socket) -> - ssl_test_lib:send_recv_result_active(Socket), - receive - changed_version -> - ssl_test_lib:send_recv_result_active(Socket) - end. - -soft_start_connection(Config, ResulProxy) -> - ClientOpts = ?config(client_verification_opts, Config), - ServerOpts = ?config(server_verification_opts, Config), - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = start_server([{node, ServerNode}, {port, 0}, - {from, ResulProxy}, - {mfa, {?MODULE, use_connection, []}}, - {options, ServerOpts}]), - - Port = inet_port(ResulProxy, Server), - Client = start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, ResulProxy}, - {mfa, {?MODULE, use_connection, []}}, - {options, ClientOpts}]), - {Server, Client}. - -restart_start_connection(Config, ResulProxy) -> - ClientOpts = ?config(client_verification_opts, Config), - ServerOpts = ?config(server_verification_opts, Config), - {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = start_server([{node, ServerNode}, {port, 0}, - {from, ResulProxy}, - {mfa, {ssl_test_lib, send_recv_result_active, []}}, - {options, ServerOpts}]), - Port = inet_port(ResulProxy, Server), - Client = start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, ResulProxy}, - {mfa, {ssl_test_lib, send_recv_result_active, []}}, - {options, ClientOpts}]), - {Server, Client}. - -is_soft([{restart_application, ssl}]) -> - false; -is_soft(_) -> - true. - -result_proxy_init(Args) -> - result_proxy_loop(Args). - -result_proxy_loop(Args) -> - receive - {Pid, {check_result, Server, Client}} -> - Result = do_check_result(Server, ok, Client, ok), - Pid ! {self(), Result}, - result_proxy_loop(Args); - {Pid, port, Server} -> - Port = recv_port(Server), - Pid ! Port, - result_proxy_loop(Args); - {Pid, listen} -> - recv_listen(), - Pid ! ok, - result_proxy_loop(Args); - {Pid, connected} -> - Connected = recv_connected(), - Pid ! Connected, - result_proxy_loop(Args) - end. - -check_result(Pid, Server, Client) -> - Pid ! {self(), {check_result, Server, Client}}, - receive - {Pid, Result} -> - Result - end. - -do_check_result(Server, ServerMsg, Client, ClientMsg) -> - receive - {Server, ServerMsg} -> - do_check_result(Client, ClientMsg); - - {Client, ClientMsg} -> - do_check_result(Server, ServerMsg); - Unexpected -> - {{expected, {Client, ClientMsg}}, - {expected, {Server, ServerMsg}}, {got, Unexpected}} - end. - -do_check_result(Pid, Msg) -> - receive - {Pid, Msg} -> - ok; - Unexpected -> - {{expected, {Pid, Msg}}, - {got, Unexpected}} - end. - -inet_port(Pid, Server) -> - Pid ! {self(), port, Server}, - receive - {port, Port} -> - Port - end. - -recv_port(Server) -> - receive - {Server, {port, Port}} -> - {port, Port} - end. - -recv_connected() -> - receive - {connected, _Socket} -> - ok; - {connect_failed, Reason} -> - {connect_failed, Reason} - end. - - -start_server(Args) -> - Pid = proplists:get_value(from, Args), - Result = spawn_link(ssl_test_lib, run_server, [Args]), - Pid ! {self(), listen}, - receive - ok -> - ok - end, - Result. - -start_client(Args) -> - Pid = proplists:get_value(from, Args), - Result = spawn_link(ssl_test_lib, run_client_init, [lists:delete(return_socket, Args)]), - Pid ! {self(), connected}, - receive - ok -> - Result; - Reason -> - exit(Reason) - end. - -recv_listen()-> - receive - {listen, up} -> - ok - end. diff -Nru erlang-18.2-dfsg/lib/ssl/vsn.mk erlang-17.3-dfsg/lib/ssl/vsn.mk --- erlang-18.2-dfsg/lib/ssl/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/ssl/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -SSL_VSN = 7.2 +SSL_VSN = 5.3.6 diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/array.xml erlang-17.3-dfsg/lib/stdlib/doc/src/array.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/array.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/array.xml 2014-09-16 19:10:57.000000000 +0000 @@ -7,17 +7,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -94,6 +93,9 @@ + +

    array() is equivalent to array(term()).

    +
    @@ -164,7 +166,7 @@ -

    Equivalent to from_list(List, undefined).

    +

    Equivalent to from_list(List, undefined).

    @@ -184,7 +186,7 @@ -

    Equivalent to from_orddict(Orddict, undefined).

    +

    Equivalent to from_orddict(Orddict, undefined).

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/assert_hrl.xml erlang-17.3-dfsg/lib/stdlib/doc/src/assert_hrl.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/assert_hrl.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/assert_hrl.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ - - - - -
    - - 20122015 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - assert.hrl - - - - -
    - assert.hrl - Assert Macros - -

    The include file assert.hrl provides macros for inserting - assertions in your program code.

    -

    These macros are defined in the Stdlib include file - assert.hrl. Include the following directive in the module - from which the function is called:

    - --include_lib("stdlib/include/assert.hrl"). -

    When an assertion succeeds, the assert macro yields the atom - ok. When an assertion fails, an exception of type error is - instead generated. The associated error term will have the form - {Macro, Info}, where Macro is the name of the macro, for - example assertEqual, and Info will be a list of tagged - values such as [{module, M}, {line, L}, ...] giving more - information about the location and cause of the exception. All entries - in the Info list are optional, and you should not rely - programatically on any of them being present.

    - -

    If the macro NOASSERT is defined when the assert.hrl - include file is read by the compiler, the macros will be defined as - equivalent to the atom ok. The test will not be performed, and - there will be no cost at runtime.

    - -

    For example, using erlc to compile your modules, the following - will disable all assertions:

    - -erlc -DNOASSERT=true *.erl -

    (The value of NOASSERT does not matter, only the fact that it - is defined.)

    -

    A few other macros also have effect on the enabling or disabling of - assertions:

    - - If NODEBUG is defined, it implies NOASSERT, unless - DEBUG is also defined, which is assumed to take - precedence. - If ASSERT is defined, it overrides NOASSERT, that - is, the assertions will remain enabled. - -

    If you prefer, you can thus use only DEBUG/NODEBUG as - the main flags to control the behaviour of the assertions (which is - useful if you have other compiler conditionals or debugging macros - controlled by those flags), or you can use ASSERT/NOASSERT - to control only the assert macros.

    - -
    - -
    - Macros - - assert(BoolExpr) -

    Tests that BoolExpr completes normally returning - true.

    -
    - - assertNot(BoolExpr) -

    Tests that BoolExpr completes normally returning - false.

    -
    - - assertMatch(GuardedPattern, Expr) -

    Tests that Expr completes normally yielding a value - that matches GuardedPattern. For example:

    - - ?assertMatch({bork, _}, f()) -

    Note that a guard when ... can be included:

    - - ?assertMatch({bork, X} when X > 0, f()) -
    - - assertNotMatch(GuardedPattern, Expr) -

    Tests that Expr completes normally yielding a value - that does not match GuardedPattern.

    -

    As in assertMatch, GuardedPattern can have a - when part.

    -
    - - assertEqual(ExpectedValue, Expr) -

    Tests that Expr completes normally yielding a value - that is exactly equal to ExpectedValue.

    -
    - - assertNotEqual(ExpectedValue, Expr) -

    Tests that Expr completes normally yielding a value - that is not exactly equal to ExpectedValue.

    -
    - - assertException(Class, Term, Expr) -

    Tests that Expr completes abnormally with an exception - of type Class and with the associated Term. The - assertion fails if Expr raises a different exception or if it - completes normally returning any value.

    -

    Note that both Class and Term can be guarded - patterns, as in assertMatch.

    -
    - - assertNotException(Class, Term, Expr) -

    Tests that Expr does not evaluate abnormally with an - exception of type Class and with the associated Term. - The assertion succeeds if Expr raises a different exception or - if it completes normally returning any value.

    -

    As in assertException, both Class and Term - can be guarded patterns.

    -
    - - assertError(Term, Expr) -

    Equivalent to assertException(error, Term, - Expr)

    -
    - - assertExit(Term, Expr) -

    Equivalent to assertException(exit, Term, Expr)

    -
    - - assertThrow(Term, Expr) -

    Equivalent to assertException(throw, Term, Expr)

    -
    - -
    -
    - -
    - SEE ALSO -

    compile(3)

    -

    erlc(3)

    -
    -
    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/base64.xml erlang-17.3-dfsg/lib/stdlib/doc/src/base64.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/base64.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/base64.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/beam_lib.xml erlang-17.3-dfsg/lib/stdlib/doc/src/beam_lib.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/beam_lib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/beam_lib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 20002015 + 20002013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -71,7 +70,6 @@ using strip/1, strip_files/1 and/or strip_release/1.

    -
    Reconstructing source code

    Here is an example of how to reconstruct source code from @@ -153,6 +151,7 @@ keys.

    +
    @@ -224,13 +223,6 @@ - - Read all chunks from a BEAM file or binary - -

    Reads chunk data for all chunks.

    -
    -
    - Read selected chunks from a BEAM file or binary @@ -258,13 +250,6 @@ - - Creates a BEAM module from a list of chunks - -

    Builds a BEAM module (as a binary) from a list of chunks.

    -
    -
    - Read the BEAM file's module version diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/binary.xml erlang-17.3-dfsg/lib/stdlib/doc/src/binary.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/binary.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/binary.xml 2014-09-16 19:10:57.000000000 +0000 @@ -5,21 +5,20 @@
    2009 - 2014 + 2013 Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved on line at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -299,8 +298,8 @@ - Searches for the first match of a pattern in a binary + Searches for the first match of a pattern in a binary

    Searches for the first occurrence of Pattern in Subject and @@ -353,8 +352,8 @@ - Searches for all matches of a pattern in a binary + Searches for all matches of a pattern in a binary

    Works like match/2, but the Subject is searched until @@ -451,7 +450,7 @@

    In this example, we chose to copy the binary content before - inserting it in the gb_sets:set() if it references a binary more than + inserting it in the gb_set() if it references a binary more than twice the size of the data we're going to keep. Of course different rules for when copying will apply to different programs.

    @@ -579,10 +578,6 @@

    Removes trailing empty parts of the result (as does trim in re:split/3)

    - trim_all - -

    Removes all empty parts of the result.

    - global

    Repeats the split until the Subject is diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/book.xml erlang-17.3-dfsg/lib/stdlib/doc/src/book.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/calendar.xml erlang-17.3-dfsg/lib/stdlib/doc/src/calendar.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/calendar.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/calendar.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -130,11 +129,11 @@ - Compute the number of days from year 0 up to the given date + Compute the number of days from year 0 up to the given date

    This function computes the number of gregorian days starting with year 0 and ending at the given date.

    @@ -271,8 +270,7 @@ Convert now to local date and time

    This function returns local date and time converted from - the return value from - erlang:timestamp/0.

    + the return value from erlang:now().

    @@ -281,8 +279,7 @@ Convert now to date and time

    This function returns Universal Coordinated Time (UTC) - converted from the return value from - erlang:timestamp/0.

    + converted from the return value from erlang:now().

    @@ -347,11 +344,11 @@ - Check if a date is valid + Check if a date is valid

    This function checks if a date is a valid.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/c.xml erlang-17.3-dfsg/lib/stdlib/doc/src/c.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/c.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/c.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -121,12 +120,12 @@
    lc(Files) -> ok - Compile a list of files Files = [File] File = file:filename() + Compile a list of files

    Compiles a list of files by calling compile:file(File, [report_errors, report_warnings]) for each File in Files.

    @@ -233,14 +232,6 @@
    - - Print node uptime - -

    Prints the node uptime (as given by - erlang:statistics(wall_clock)), in human-readable form.

    -
    -
    - xm(ModSpec) -> void() Cross reference check a module diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/dets.xml erlang-17.3-dfsg/lib/stdlib/doc/src/dets.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/dets.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/dets.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -316,20 +315,20 @@ bytes.

    -

    {filename, file:name()}, +

    {filename, file:name()}, the name of the file where objects are stored.

    -

    {keypos, keypos() - }, the position of the key.

    +

    {keypos, keypos()} + , the position of the key.

    {size, integer() >= 0}, the number of objects stored in the table.

    -

    {type, type() - }, the type of the table.

    +

    {type, type()}, + the type of the table.

    @@ -345,12 +344,12 @@ allowed:

    -

    {access, access() - }, the access mode.

    +

    {access, access()} + , the access mode.

    -

    {auto_save, - auto_save()}, the auto save interval.

    +

    {auto_save, + auto_save()}, the auto save interval.

    {bchunk_format, binary()}, an opaque binary @@ -730,16 +729,16 @@ tuples where the following values are allowed:

    -

    {access, - access()}. It is possible to open +

    {access, + access()}. It is possible to open existing tables in read-only mode. A table which is opened in read-only mode is not subjected to the automatic file reparation algorithm if it is later opened after a crash. The default value is read_write.

    -

    {auto_save, - auto_save()}, the auto save +

    {auto_save, + auto_save()}, the auto save interval. If the interval is an integer Time, the table is flushed to disk whenever it is not accessed for Time milliseconds. A table that has been flushed @@ -749,18 +748,18 @@ is 180000 (3 minutes).

    -

    {estimated_no_objects, - no_slots()}. Equivalent to the +

    {estimated_no_objects, + no_slots()}. Equivalent to the min_no_slots option.

    -

    {file, - file:name()}, the name of the file to be +

    {file, + file:name()}, the name of the file to be opened. The default value is the name of the table.

    -

    {max_no_slots, - no_slots()}, the maximum number +

    {max_no_slots, + no_slots()}, the maximum number of slots that will be used. The default value as well as the maximal value is 32 M. Note that a higher value may increase the fragmentation of the table, and conversely, @@ -769,16 +768,16 @@ 9 tables.

    -

    {min_no_slots, - no_slots()}. Application +

    {min_no_slots, + no_slots()}. Application performance can be enhanced with this flag by specifying, when the table is created, the estimated number of different keys that will be stored in the table. The default value as well as the minimum value is 256.

    -

    {keypos, - keypos()}, the position of the +

    {keypos, + keypos()}, the position of the element of each object to be used as key. The default value is 1. The ability to explicitly state the key position is most convenient when we want to store Erlang @@ -815,12 +814,12 @@ already open.

    -

    {type, type()}, +

    {type, type()}, the type of the table. The default value is set.

    -

    {version, - version()}, the version of the format +

    {version, + version()}, the version of the format used for the table. The default value is 9. Tables on the format used before OTP R8 can be created by giving the value 8. A version 8 table can be converted to @@ -1036,8 +1035,8 @@ specification that matches all objects.

    -

    {select, - match_spec()}. As for select +

    {select, + match_spec()}. As for select the table is traversed by calling dets:select/3 and dets:select/1. The difference is that the match specification is explicitly given. This is how to diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/dict.xml erlang-17.3-dfsg/lib/stdlib/doc/src/dict.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/dict.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/dict.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -47,6 +46,9 @@ + +

    dict() is equivalent to dict(term(), term()).

    + @@ -119,7 +121,7 @@ Dict together with an extra argument Acc (short for accumulator). Fun must return a new accumulator which is passed to the next call. Acc0 is - returned if the dict is empty. The evaluation order is + returned if the list is empty. The evaluation order is undefined.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/digraph_utils.xml erlang-17.3-dfsg/lib/stdlib/doc/src/digraph_utils.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/digraph_utils.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/digraph_utils.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -122,9 +121,8 @@ - digraph() -

    - A digraph as returned by digraph:new/0,1.

    + digraph() +

    A digraph as returned by digraph:new/0,1.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/digraph.xml erlang-17.3-dfsg/lib/stdlib/doc/src/digraph.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/digraph.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/digraph.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -103,15 +102,13 @@

    A digraph as returned by new/0,1.

    - edge() -

    + edge()
    - vertex() -

    + vertex()
    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/epp.xml erlang-17.3-dfsg/lib/stdlib/doc/src/epp.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/epp.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/epp.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -39,7 +38,7 @@ by compile to preprocess macros and include files before the actual parsing takes place.

    The Erlang source file encoding is selected by a + id="encoding">encoding is selected by a comment in one of the first two lines of the source file. The first string that matches the regular expression coding\s*[:=]\s*([-a-zA-Z0-9])+ selects the encoding. If diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/erl_anno.xml erlang-17.3-dfsg/lib/stdlib/doc/src/erl_anno.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/erl_anno.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/erl_anno.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,309 +0,0 @@ - - - - -

    - - 2015 - 2015 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - erl_anno - Hans Bolinder - Kenneth Lundin - 1 - - - 2015-02-26 - A - erl_anno.xml -
    - erl_anno - - - Abstract Datatype for the Annotations of the Erlang Compiler - - - -

    This module implements an abstract type that is used by the - Erlang Compiler and its helper modules for holding data such as - column, line number, and text. The data type is a collection of - annotations as - described in the following.

    -

    The Erlang Token Scanner returns tokens with a subset of - the following annotations, depending on the options:

    - - column -

    The column where the token begins.

    - location -

    The line and column where the token begins, or - just the line if the column unknown.

    -
    - text -

    The token's text.

    -
    -

    From the above the following annotation is derived:

    - - line -

    The line where the token begins.

    -
    -

    Furthermore, the following annotations are supported by - this module, and used by various modules:

    - - file -

    A filename.

    - generated -

    A Boolean indicating if the abstract code is - compiler generated. The Erlang Compiler does not emit warnings - for such code.

    -
    - record -

    A Boolean indicating if the origin of the abstract - code is a record. Used by Dialyzer to assign types to tuple - elements.

    -
    -
    -

    The functions - column(), - end_location(), - line(), - location(), and - text() - in the erl_scan module can be used for inspecting - annotations in tokens.

    -

    The functions - map_anno(), - fold_anno(), - mapfold_anno(), - new_anno(), - - anno_from_term(), and - - anno_to_term() in the erl_parse module can be - used for manipulating annotations in abstract code. -

    -
    - - - - anno() -

    A collection of annotations.

    -
    -
    - - - -

    The term representing a collection of annotations. It is - either a location() or a list of key-value pairs.

    -
    -
    - - - - - - -

    To be changed to a non-negative integer in Erlang/OTP 19.0.

    -
    -
    - - - - - - -
    - - - - - Return the column - - -

    Returns the column of the annotations Anno. -

    -
    -
    - - - Return the end location of the text - - -

    Returns the end location of the text of the - annotations Anno. If there is no text, - undefined is returned. -

    -
    -
    - - - Return the filename - - -

    Returns the filename of the annotations Anno. - If there is no filename, undefined is returned. -

    -
    -
    - - - Return annotations given a term - -

    Returns annotations with the representation Term. -

    - -

    See also to_term(). -

    -
    -
    - - - Return the generated Boolean - - -

    Returns true if the annotations Anno - has been marked as generated. The default is to return - false. -

    -
    -
    - - - Test for a collection of annotations - -

    Returns true if Term is a collection of - annotations, false otherwise.

    -
    -
    - - - Return the line - - -

    Returns the line of the annotations Anno. -

    -
    -
    - - - Return the location - - -

    Returns the location of the annotations Anno. -

    -
    -
    - - - Create a new collection of annotations - - -

    Creates a new collection of annotations given a location.

    -
    -
    - - - Modify the filename - - -

    Modifies the filename of the annotations Anno. -

    -
    -
    - - - Modify the generated marker - - -

    Modifies the generated marker of the annotations - Anno. -

    -
    -
    - - - Modify the line - - -

    Modifies the line of the annotations Anno. -

    -
    -
    - - - Modify the location - - -

    Modifies the location of the annotations Anno. -

    -
    -
    - - - Modify the record marker - - -

    Modifies the record marker of the annotations Anno. -

    -
    -
    - - - Modify the text - - -

    Modifies the text of the annotations Anno. -

    -
    -
    - - - Return the text - - -

    Returns the text of the annotations Anno. - If there is no text, undefined is returned. -

    -
    -
    - - - Return the term representing a collection of - annotations - -

    Returns the term representing the annotations Anno. -

    -

    See also from_term(). -

    -
    -
    -
    -
    - See Also -

    erl_scan(3), - erl_parse(3) -

    -
    - diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/erl_eval.xml erlang-17.3-dfsg/lib/stdlib/doc/src/erl_eval.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/erl_eval.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/erl_eval.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/erl_expand_records.xml erlang-17.3-dfsg/lib/stdlib/doc/src/erl_expand_records.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/erl_expand_records.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/erl_expand_records.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/erl_id_trans.xml erlang-17.3-dfsg/lib/stdlib/doc/src/erl_id_trans.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/erl_id_trans.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/erl_id_trans.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/erl_internal.xml erlang-17.3-dfsg/lib/stdlib/doc/src/erl_internal.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/erl_internal.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/erl_internal.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/erl_lint.xml erlang-17.3-dfsg/lib/stdlib/doc/src/erl_lint.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/erl_lint.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/erl_lint.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/erl_parse.xml erlang-17.3-dfsg/lib/stdlib/doc/src/erl_parse.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/erl_parse.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/erl_parse.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19962015 + 19962014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -174,8 +173,8 @@ - Convert an Erlang term into an abstract form + Convert an Erlang term into an abstract form

    Converts the Erlang data structure Data into an abstract form of type AbsTerm.

    @@ -193,97 +192,6 @@ considered a string.

    - - - - Map a function over the annotations of an abstract form - - -

    Modifies the abstract form Abstr by applying - Fun on every collection of annotations of the - abstract form. The abstract form is traversed in a - depth-first, left-to-right, fashion. -

    -
    -
    - - - - Fold a function over the annotations of an abstract form - - -

    Updates an accumulator by applying Fun on - every collection of annotations of the abstract form - Abstr. The first call to Fun has - AccIn as argument, and the returned accumulator - AccOut is passed to the next call, and so on. - The final value of the accumulator is returned. The abstract - form is traversed in a depth-first, left-to-right, fashion. -

    -
    -
    - - - - Map and fold a function over the annotations of an abstract form - - -

    Modifies the abstract form Abstr by applying - Fun on every collection of annotations of the - abstract form, while at the same time updating an - accumulator. The first call to Fun has - AccIn as second argument, and the returned - accumulator AccOut is passed to the next call, - and so on. The modified abstract form as well as the the - final value of the accumulator is returned. The abstract - form is traversed in a depth-first, left-to-right, fashion. -

    -
    -
    - - - - Create new annotations - - -

    Creates an abstract form from a term which has the same - structure as an abstract form, but locations where the - abstract form has annotations. For each location, erl_anno:new/1 is - called, and the annotations replace the location. -

    -
    -
    - - - - Return annotations as terms - - -

    Assumes that Term is a term with the same - structure as an abstract form, but with terms, T say, on - those places where an abstract form has annotations. Returns - an abstract form where every term T has been replaced by the - value returned by calling erl_anno:from_term(T). The - term Term is traversed in a depth-first, - left-to-right, fashion. -

    -
    -
    - - - - Return the representation of annotations - - -

    Returns a term where every collection of annotations Anno of - Abstr has been replaced by the term returned by - calling erl_anno:to_term(Anno). The abstract form is - traversed in a depth-first, left-to-right, fashion. -

    -
    -
    @@ -303,9 +211,8 @@
    See Also

    io(3), - erl_anno(3), - erl_scan(3), - ERTS User's Guide

    + erl_scan(3), + ERTS User's Guide

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/erl_pp.xml erlang-17.3-dfsg/lib/stdlib/doc/src/erl_pp.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/erl_pp.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/erl_pp.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -48,8 +47,8 @@ -

    The optional argument - HookFunction, shown in the functions described below, +

    The optional argument + HookFunction, shown in the functions described below, defines a function which is called when an unknown form occurs where there should be a valid expression.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/erl_scan.xml erlang-17.3-dfsg/lib/stdlib/doc/src/erl_scan.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/erl_scan.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/erl_scan.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19962015 + 19962013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -121,7 +120,7 @@ string(String, StartLocation, []).

    StartLocation indicates the initial location - when scanning starts. If StartLocation is a line, + when scanning starts. If StartLocation is a line attributes() as well as EndLocation and ErrorLocation will be lines. If StartLocation is a pair of a line and a column @@ -133,12 +132,8 @@ line where the token begins, as well as the text of the token (if the text option is given), all of which can be accessed by calling token_info/1,2, attributes_info/1,2, - column/1, - line/1, - location/1, and - text/1.

    + marker="#token_info/1">token_info/1,2 or attributes_info/1,2.

    A token is a tuple containing information about syntactic category, the token attributes, and the actual terminal symbol. For punctuation characters (e.g. ;, @@ -181,10 +176,10 @@ - Re-entrant scanner An opaque continuation + Re-entrant scanner

    This is the re-entrant scanner which scans characters until a dot ('.' followed by a white space) or @@ -242,70 +237,6 @@ - - Return the category - -

    Returns the category of Token. -

    - - - - - Return the symbol - -

    Returns the symbol of Token. -

    -
    -
    - - - Return the column - -

    Returns the column of Token's - collection of annotations. -

    -
    -
    - - - Return the end location of the text - -

    Returns the end location of the text of - Token's collection of annotations. If - there is no text, - undefined is returned. -

    -
    -
    - - - Return the line - -

    Returns the line of Token's collection - of annotations. -

    -
    -
    - - - Return the location - -

    Returns the location of Token's - collection of annotations. -

    -
    -
    - - - Return the text - -

    Returns the text of Token's collection - of annotations. If there is no text, undefined is - returned. -

    -
    -
    - Return information about a token @@ -324,9 +255,9 @@ - Return information about a token + Return information about a token

    Returns a list containing information about the token Token. If one single @@ -345,28 +276,28 @@

    The following TokenInfoTuples with corresponding TokenItems are valid:

    - {category, - category()} + {category, + category()}

    The category of the token.

    - {column, - column()} + {column, + column()}

    The column where the token begins.

    {length, integer() > 0}

    The length of the token's text.

    - {line, - line()} + {line, + line()}

    The line where the token begins.

    - {location, - location()} + {location, + location()}

    The line and column where the token begins, or just the line if the column unknown.

    - {symbol, - symbol()} + {symbol, + symbol()}

    The token's symbol.

    {text, string()} @@ -416,19 +347,19 @@

    The following AttributeInfoTuples with corresponding AttributeItems are valid:

    - {column, - column()} + {column, + column()}

    The column where the token begins.

    {length, integer() > 0}

    The length of the token's text.

    - {line, - line()} + {line, + line()}

    The line where the token begins.

    - {location, - location()} + {location, + location()}

    The line and column where the token begins, or just the line if the column unknown.

    @@ -486,7 +417,6 @@
    See Also

    io(3), - erl_anno(3), - erl_parse(3)

    + erl_parse(3)

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/erl_tar.xml erlang-17.3-dfsg/lib/stdlib/doc/src/erl_tar.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/erl_tar.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/erl_tar.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -81,12 +80,6 @@
    - OTHER STORAGE MEDIA -

    The erl_ftp module normally accesses the tar-file on disk using the file module. When other needs arise, there is a way to define your own low-level Erlang functions to perform the writing and reading on the storage media. See init/3 for usage.

    -

    An example of this is the sftp support in ssh_sftp:open_tar/3. That function opens a tar file on a remote machine using an sftp channel.

    -
    - -
    LIMITATIONS

    For maximum compatibility, it is safe to archive files with names up to 100 characters in length. Such tar files can generally be @@ -106,8 +99,7 @@ TarDescriptor = term() Filename = filename() Options = [Option] - Option = dereference|verbose|{chunks,ChunkSize} - ChunkSize = positive_integer() + Option = dereference|verbose RetValue = ok|{error,{Filename,Reason}} Reason = term() @@ -127,12 +119,6 @@

    Print an informational message about the file being added.

    - {chunks,ChunkSize} - -

    Read data in parts from the file. This is intended for memory-limited - machines that for example builds a tar file on a remote machine over - sftp.

    -
    @@ -403,100 +389,6 @@ - - - init(UserPrivate, AccessMode, Fun) -> {ok,TarDescriptor} | {error,Reason} - - Creates a TarDescriptor used in subsequent tar operations when - defining own low-level storage access functions - - - UserPrivate = term() - AccessMode = [write] | [read] - Fun when AccessMode is [write] = fun(write, {UserPrivate,DataToWrite})->...; - (position,{UserPrivate,Position})->...; - (close, UserPrivate)->... - end - - Fun when AccessMode is [read] = fun(read2, {UserPrivate,Size})->...; - (position,{UserPrivate,Position})->...; - (close, UserPrivate)->... - end - - TarDescriptor = term() - Reason = term() - - -

    The Fun is the definition of what to do when the different - storage operations functions are to be called from the higher tar - handling functions (add/3, add/4, close/1...). -

    -

    The Fun will be called when the tar function wants to do - a low-level operation, like writing a block to a file. The Fun is called - as Fun(Op,{UserPrivate,Parameters...}) where Op is the operation name, - UserPrivate is the term passed as the first argument to init/1 and - Parameters... are the data added by the tar function to be passed down to - the storage handling function. -

    -

    The parameter UserPrivate is typically the result of opening a low level - structure like a file descriptor, a sftp channel id or such. The different Fun - clauses operates on that very term. -

    -

    The fun clauses parameter lists are:

    - - (write, {UserPrivate,DataToWrite}) - Write the term DataToWrite using UserPrivate - (close, UserPrivate) - Close the access. - (read2, {UserPrivate,Size}) - Read using UserPrivate but only Size bytes. Note that there is - only an arity-2 read function, not an arity-1 - - (position,{UserPrivate,Position}) - Sets the position of UserPrivate as defined for files in file:position/2 - - - -

    A complete Fun parameter for reading and writing on files using the - file module could be: -

    - - ExampleFun = - fun(write, {Fd,Data}) -> file:write(Fd, Data); - (position, {Fd,Pos}) -> file:position(Fd, Pos); - (read2, {Fd,Size}) -> file:read(Fd,Size); - (close, Fd) -> file:close(Fd) - end - -

    where Fd was given to the init/3 function as:

    - - {ok,Fd} = file:open(Name,...). - {ok,TarDesc} = erl_tar:init(Fd, [write], ExampleFun), - -

    The TarDesc is then used:

    - - erl_tar:add(TarDesc, SomeValueIwantToAdd, FileNameInTarFile), - ...., - erl_tar:close(TarDesc) - -

    When the erl_tar core wants to e.g. write a piece of Data, it would call - ExampleFun(write,{UserPrivate,Data}). -

    - -

    The example above with file module operations is not necessary to - use directly since that is what the open function - in principle does. -

    -
    - -

    The TarDescriptor term is not a file descriptor. - You should not rely on the specific contents of the TarDescriptor - term, as it may change in future versions as more features are added - to the erl_tar module.

    -
    -
    -
    - table(Name) -> RetValue Retrieve the name of all files in a tar file diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/ets.xml erlang-17.3-dfsg/lib/stdlib/doc/src/ets.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/ets.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/ets.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -132,10 +131,9 @@ - continuation() + continuation() -

    - Opaque continuation used by +

    Opaque continuation used by select/1,3, select_reverse/1,3, @@ -449,21 +447,15 @@ {owner, pid()}

    The pid of the owner of the table.
    - {protection, access()}

    + {protection, access()}

    The table access rights.
    {size, integer() >= 0

    The number of objects inserted in the table.
    - {type, type()}

    + {type, type()}

    The table type.
    - {read_concurrency, boolean()}

    - - Indicates whether the table uses read_concurrency or not.
    - {write_concurrency, boolean()}

    - - Indicates whether the table uses write_concurrency or not.
    @@ -611,7 +603,7 @@

    Returns the last key Key according to Erlang term order in the table Tab of the ordered_set type. If the table is of any other type, the function is synonymous - to first/1. If the table is empty, + to first/2. If the table is empty, '$end_of_table' is returned.

    Use prev/2 to find preceding keys in the table.

    @@ -917,7 +909,7 @@

    {keypos,Pos} - Specifies which element in the stored tuples should be + Specfies which element in the stored tuples should be used as key. By default, it is the first element, i.e. Pos=1. However, this is not always appropriate. In particular, we do not want the first element to be the @@ -1437,9 +1429,7 @@

    Whenever the extended_info option is used, it results in a file not readable by versions of ets prior to that in stdlib-1.15.1

    -

    The sync option, if set to true, ensures that - the content of the file is actually written to the disk before - tab2file returns. Default is {sync, false}.

    +
    @@ -1597,21 +1587,6 @@ - - Return and remove all objects with a given key from an ETS - table. - -

    Returns a list of all objects with the key Key in - the table Tab and removes.

    -

    The given Key is used to identify the object by - either comparing equal the key of an object in an - ordered_set table, or matching in other types of - tables (see lookup/2 and - new/2 for details on the - difference).

    -
    -
    - Fill a Dets table with objects from an ETS table. @@ -1622,19 +1597,15 @@ - - - - Update a counter object in an ETS table. - + Update a counter object in an ETS table.

    This function provides an efficient way to update one or more counters, without the hassle of having to look up an object, update @@ -1675,22 +1646,12 @@ lookup/2 and new/2 for details on the difference).

    -

    If a default object Default is given, it is used - as the object to be updated if the key is missing from the table. The - value in place of the key is ignored and replaced by the proper key - value. The return value is as if the default object had not been used, - that is a single updated element or a list of them.

    The function will fail with reason badarg if:

    the table is not of type set or ordered_set, - no object with the right key exists and no default object were - supplied, + no object with the right key exists, the object has the wrong arity, - the default object arity is smaller than - ]]> - any field from the default object being updated is not an - integer the element to update is not an integer, the element to update is also the key, or, any of Pos, Incr, Threshold or @@ -1701,11 +1662,11 @@ - Updates the Pos:th element of the object with a given key in an ETS table. + Updates the Pos:th element of the object with a given key in an ETS table.

    This function provides an efficient way to update one or more elements within an object, without the hassle of having to look up, diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/filelib.xml erlang-17.3-dfsg/lib/stdlib/doc/src/filelib.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/filelib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/filelib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/filename.xml erlang-17.3-dfsg/lib/stdlib/doc/src/filename.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/filename.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/filename.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/file_sorter.xml erlang-17.3-dfsg/lib/stdlib/doc/src/file_sorter.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/file_sorter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/file_sorter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -106,9 +105,9 @@ file:get_cwd() is used instead. The names of temporary files are derived from the Erlang nodename (node()), the process identifier of the current Erlang - emulator (os:getpid()), and a unique integer - (erlang:unique_integer([positive])); a typical name would be - fs_mynode@myhost_1763_4711.17, where + emulator (os:getpid()), and a timestamp + (erlang:now()); a typical name would be + fs_mynode@myhost_1763_1043_337000_266005.17, where 17 is a sequence number. Existing files will be overwritten. Temporary files are deleted unless some uncaught EXIT signal occurs. @@ -223,82 +222,82 @@ - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/gb_sets.xml erlang-17.3-dfsg/lib/stdlib/doc/src/gb_sets.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/gb_sets.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/gb_sets.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@

    - 20012015 + 20012014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -121,6 +120,9 @@ + +

    set() is equivalent to set(term()).

    +
    @@ -128,6 +130,9 @@ + +

    iter() is equivalent to iter(term()).

    +
    @@ -301,17 +306,6 @@ - - Return an iterator for a set starting from a specified element - -

    Returns an iterator that can be used for traversing the - entries of Set; see next/1. - The difference as compared to the iterator returned by - iterator/1 is that the first element greater than - or equal to Element is returned.

    -
    -
    - Return largest element diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/gb_trees.xml erlang-17.3-dfsg/lib/stdlib/doc/src/gb_trees.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/gb_trees.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/gb_trees.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 20012015 + 20012014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -65,6 +64,9 @@ + +

    tree() is equivalent to tree(term(), term()).

    +
    @@ -72,6 +74,9 @@ + +

    iter() is equivalent to iter(term(), term()).

    +
    @@ -178,17 +183,6 @@ - - Return an iterator for a tree starting from specified key - -

    Returns an iterator that can be used for traversing the - entries of Tree; see next/1. - The difference as compared to the iterator returned by - iterator/1 is that the first key greater than - or equal to Key is returned.

    -
    -
    - Return a list of the keys in a tree diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/gen_event.xml erlang-17.3-dfsg/lib/stdlib/doc/src/gen_event.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/gen_event.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/gen_event.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19962014 + 19962013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -45,7 +44,6 @@
     gen_event module                   Callback module
     ----------------                   ---------------
    -gen_event:start
     gen_event:start_link       ----->  -
     
     gen_event:add_handler
    @@ -179,7 +177,7 @@
           add_handler(EventMgrRef, Handler, Args) -> Result
           Add an event handler to a generic event manager.
           
    -        EventMgrRef = Name | {Name,Node} | {global,GlobalName}
    +        EventMgr = Name | {Name,Node} | {global,GlobalName}
     	| {via,Module,ViaName} | pid()
              Name = Node = atom()
              GlobalName = ViaName = term()
    @@ -225,7 +223,7 @@
           add_sup_handler(EventMgrRef, Handler, Args) -> Result
           Add a supervised event handler to a generic event manager.
           
    -        EventMgrRef = Name | {Name,Node} | {global,GlobalName}
    +        EventMgr = Name | {Name,Node} | {global,GlobalName}
     	| {via,Module,ViaName} | pid()
              Name = Node = atom()
              GlobalName = ViaName = term()
    @@ -458,37 +456,19 @@
         
         
           stop(EventMgrRef) -> ok
    -      stop(EventMgrRef, Reason, Timeout) -> ok
           Terminate a generic event manager.
           
             EventMgrRef = Name | {Name,Node} | {global,GlobalName}
     	| {via,Module,ViaName} | pid()
             Name = Node = atom()
             GlobalName = ViaName = term()
    -        Reason = term()
    -        Timeout = int()>0 | infinity
           
           
    -        

    Orders the event manager EventMgrRef to exit with - the given Reason and waits for it to - terminate. Before terminating, the gen_event will call - Module:terminate(stop,...) - for each installed event handler.

    -

    The function returns ok if the event manager terminates - with the expected reason. Any other reason than normal, - shutdown, or {shutdown,Term} will cause an - error report to be issued using - error_logger:format/2. - The default Reason is normal.

    -

    Timeout is an integer greater than zero which - specifies how many milliseconds to wait for the event manager to - terminate, or the atom infinity to wait - indefinitely. The default value is infinity. If the - event manager has not terminated within the specified time, a - timeout exception is raised.

    -

    If the process does not exist, a noproc exception - is raised.

    -

    See add_handler/3 for a description of EventMgrRef.

    +

    Terminates the event manager EventMgrRef. Before + terminating, the event manager will call + Module:terminate(stop,...) for each installed event + handler.

    +

    See add_handler/3 for a description of the argument.

    @@ -716,7 +696,7 @@ the purposes described below.

    This function is called by a gen_event process when:

    - + One of sys:get_status/1,2 is invoked to get the gen_event status. Opt is set @@ -740,7 +720,7 @@ customises the details of the current state of the event handler. Any term is allowed for Status. The gen_event module uses Status as follows:

    - + When sys:get_status/1,2 is called, gen_event ensures that its return value contains Status in place of the event handler's actual state term. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/gen_fsm.xml erlang-17.3-dfsg/lib/stdlib/doc/src/gen_fsm.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/gen_fsm.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/gen_fsm.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19962014 + 19962013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -44,11 +43,8 @@
     gen_fsm module                    Callback module
     --------------                    ---------------
    -gen_fsm:start
     gen_fsm:start_link                -----> Module:init/1
     
    -gen_fsm:stop                      -----> Module:terminate/3
    -
     gen_fsm:send_event                -----> Module:StateName/2
     
     gen_fsm:send_all_state_event      -----> Module:handle_event/3
    @@ -191,39 +187,6 @@
           
         
         
    -      stop(FsmRef) -> ok
    -      stop(FsmRef, Reason, Timeout) -> ok
    -      Synchronously stop a generic FSM.
    -      
    -        FsmRef = Name | {Name,Node} | {global,GlobalName}
    -	| {via,Module,ViaName} | pid()
    -         Node = atom()
    -         GlobalName = ViaName = term()
    -        Reason = term()
    -        Timeout = int()>0 | infinity
    -      
    -      
    -	

    Orders a generic FSM to exit with the given Reason - and waits for it to terminate. The gen_fsm will call - Module:terminate/3 - before exiting.

    -

    The function returns ok if the generic FSM terminates - with the expected reason. Any other reason than normal, - shutdown, or {shutdown,Term} will cause an - error report to be issued using - error_logger:format/2. - The default Reason is normal.

    -

    Timeout is an integer greater than zero which - specifies how many milliseconds to wait for the generic FSM - to terminate, or the atom infinity to wait - indefinitely. The default value is infinity. If the - generic FSM has not terminated within the specified time, a - timeout exception is raised.

    -

    If the process does not exist, a noproc exception - is raised.

    -
    -
    - send_event(FsmRef, Event) -> ok Send an event asynchronously to a generic FSM. @@ -339,12 +302,11 @@ - reply(Caller, Reply) -> Result + reply(Caller, Reply) -> true Send a reply to a caller. Caller - see below Reply = term() - Result = term()

    This function can be used by a gen_fsm to explicitly send a @@ -359,8 +321,6 @@ which will be given back to the client as the return value of sync_send_event/2,3 or sync_send_all_state_event/2,3.

    -

    The return value Result is not further defined, and - should always be ignored.

    @@ -568,8 +528,7 @@ Module:init/1 for a description of Timeout and hibernate.

    If the function returns {stop,Reason,NewStateData}, the gen_fsm will call - Module:terminate(Reason,StateName,NewStateData) and - terminate.

    + Module:terminate(Reason,NewStateData) and terminate.

    @@ -655,8 +614,7 @@ {stop,Reason,NewStateData}, any reply to From must be given explicitly using gen_fsm:reply/2. The gen_fsm will then call - Module:terminate(Reason,StateName,NewStateData) and - terminate.

    + Module:terminate(Reason,NewStateData) and terminate.

    @@ -805,7 +763,7 @@ module state data.

    This function is called by a gen_fsm process when:

    - + One of sys:get_status/1,2 is invoked to get the gen_fsm status. Opt is set to diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/gen_server.xml erlang-17.3-dfsg/lib/stdlib/doc/src/gen_server.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/gen_server.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/gen_server.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19962014 + 19962013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -44,11 +43,8 @@
     gen_server module            Callback module
     -----------------            ---------------
    -gen_server:start
     gen_server:start_link -----> Module:init/1
     
    -gen_server:stop       -----> Module:terminate/2
    -
     gen_server:call
     gen_server:multi_call -----> Module:handle_call/3
     
    @@ -188,40 +184,6 @@
           
         
         
    -      stop(ServerRef) -> ok
    -      stop(ServerRef, Reason, Timeout) -> ok
    -      Synchronously stop a generic server.
    -      
    -        ServerRef = Name | {Name,Node} | {global,GlobalName}
    -	| {via,Module,ViaName} | pid()
    -         Node = atom()
    -         GlobalName = ViaName = term()
    -        Reason = term()
    -        Timeout = int()>0 | infinity
    -      
    -      
    -	

    Orders a generic server to exit with the - given Reason and waits for it to terminate. The - gen_server will call - Module:terminate/2 - before exiting.

    -

    The function returns ok if the server terminates - with the expected reason. Any other reason than normal, - shutdown, or {shutdown,Term} will cause an - error report to be issued using - error_logger:format/2. - The default Reason is normal.

    -

    Timeout is an integer greater than zero which - specifies how many milliseconds to wait for the server to - terminate, or the atom infinity to wait - indefinitely. The default value is infinity. If the - server has not terminated within the specified time, a - timeout exception is raised.

    -

    If the process does not exist, a noproc exception - is raised.

    -
    -
    - call(ServerRef, Request) -> Reply call(ServerRef, Request, Timeout) -> Reply Make a synchronous call to a generic server. @@ -322,7 +284,7 @@ which may be infinity.

    This problem does not exist if all nodes are Erlang nodes.

    -

    To prevent late answers (after the timeout) from polluting +

    To avoid that late answers (after the timeout) pollutes the caller's message queue, a middleman process is used to do the actual calls. Late answers will then be discarded when they arrive to a terminated process.

    @@ -673,7 +635,7 @@ module state.

    This function is called by a gen_server process when:

    - + One of sys:get_status/1,2 is invoked to get the gen_server status. Opt is set diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/io_lib.xml erlang-17.3-dfsg/lib/stdlib/doc/src/io_lib.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/io_lib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/io_lib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19962014 + 19962013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -60,35 +59,6 @@ - - -

    Description:

    - -

    control_char is the type of control - sequence: $P, $w, and so on;

    -
    -

    args is a list of the arguments used by the - control sequence, or an empty list if the control sequence - does not take any arguments;

    -
    -

    width is the field width;

    -
    -

    adjust is the adjustment;

    -
    -

    precision is the precision of the printed - argument;

    -
    -

    pad_char is the padding character;

    -
    -

    encoding is set to true if the translation - modifier t is present;

    -
    -

    strings is set to false if the modifier - l is present.

    -
    -
    -
    -
    @@ -290,45 +260,6 @@ - - Parse all control sequences in the format string - -

    Returns a list corresponding to the given format string, - where control sequences have been replaced with - corresponding tuples. This list can be passed to io_lib:build_text/1 to have - the same effect as io_lib:format(Format, Args), or to - io_lib:unscan_format/1 - in order to get the corresponding pair of Format and - Args (with every * and corresponding argument - expanded to numeric values).

    -

    A typical use of this function is to replace unbounded-size - control sequences like ~w and ~p with the - depth-limited variants ~W and ~P before - formatting to text, e.g. in a logger.

    -
    -
    - - - Revert a pre-parsed format list to a plain character list - and a list of arguments - -

    See io_lib:scan_format/2 for - details.

    -
    -
    - - - Build the output text for a pre-parsed format list - -

    See io_lib:scan_format/2 for - details.

    -
    -
    - Indentation after printing string diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/io_protocol.xml erlang-17.3-dfsg/lib/stdlib/doc/src/io_protocol.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/io_protocol.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/io_protocol.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -50,7 +49,7 @@

    The original I/O-protocol was simple and flexible. Demands for spacial and execution time efficiency has triggered extensions to the protocol over the years, making the protocol larger and somewhat less easy to -implement than the original. It can certainly be argued that the +implement than the original. It can certainly be argumented that the current protocol is too complex, but this text describes how it looks today, not how it should have looked.

    @@ -77,11 +76,10 @@ the I/O server sends the IO reply to. ReplyAs can be any datum and is returned in the corresponding -io_reply. The io module monitors -the I/O server, and uses the monitor reference as the ReplyAs datum. -A more complicated client +io_reply. The io module simply uses the pid() +of the I/O server as the ReplyAs datum, but a more complicated client could have several outstanding I/O requests to the same I/O server and -would then use different references (or something else) to differentiate among +would then use i.e. a reference() or something else to differentiate among the incoming IO replies. The ReplyAs element should be considered opaque by the I/O server. Note that the pid() of the I/O server is not explicitly present in the io_reply tuple. The reply can be sent from any diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/io.xml erlang-17.3-dfsg/lib/stdlib/doc/src/io.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/io.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/io.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -132,8 +131,8 @@ - Read a specified number of characters + Read a specified number of characters

    Reads Count characters from standard input (IoDevice), prompting it with Prompt. It @@ -162,8 +161,8 @@ - Read a line + Read a line

    Reads a line from the standard input (IoDevice), prompting it with Prompt. It returns:

    @@ -300,8 +299,8 @@ - Read a term + Read a term

    Reads a term Term from the standard input (IoDevice), prompting it with Prompt. It @@ -330,8 +329,8 @@ - Read a term + Read a term

    Reads a term Term from IoDevice, prompting it with Prompt. Reading starts at location @@ -506,8 +505,7 @@

    Writes the data with standard syntax in the same way as ~w, but breaks terms whose printed representation is longer than one line into many lines and indents each - line sensibly. Left justification is not supported. - It also tries to detect lists of + line sensibly. It also tries to detect lists of printable characters and to output these as strings. The Unicode translation modifier is used for determining what characters are printable. For example:

    @@ -698,8 +696,8 @@ - Read formatted input + Read formatted input

    Reads characters from the standard input (IoDevice), prompting it with Prompt. Interprets the characters in @@ -870,8 +868,8 @@ - Read and tokenize Erlang expressions + Read and tokenize Erlang expressions

    Reads data from the standard input (IoDevice), prompting it with Prompt. Reading starts at location @@ -919,8 +917,8 @@ - Read and tokenize an Erlang form + Read and tokenize an Erlang form

    Reads data from the standard input (IoDevice), prompting it with Prompt. Starts reading @@ -939,9 +937,9 @@ - Read, tokenize and parse Erlang expressions + Read, tokenize and parse Erlang expressions

    Reads data from the standard input (IoDevice), prompting it with @@ -990,9 +988,9 @@ - Read, tokenize and parse an Erlang form + Read, tokenize and parse an Erlang form

    Reads data from the standard input (IoDevice), prompting it with Prompt. Starts reading at diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/lib.xml erlang-17.3-dfsg/lib/stdlib/doc/src/lib.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/lib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/lib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/lists.xml erlang-17.3-dfsg/lib/stdlib/doc/src/lists.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/lists.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/lists.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -177,7 +176,7 @@ false -> Acc; true -> [Elem|Acc]; {true,Value} -> [Value|Acc] - end + end, end, [], List1).

    Example:

    @@ -283,8 +282,8 @@
         
         
           
    -      Search for an element in a list of tuples
           1..tuple_size(Tuple)
    +      Search for an element in a list of tuples
           
             

    Searches the list of tuples TupleList for a tuple whose Nth element compares equal to Key. @@ -311,8 +310,8 @@ - Test for membership of a list of tuples 1..tuple_size(Tuple) + Test for membership of a list of tuples

    Returns true if there is a tuple in TupleList whose Nth element compares equal to Key, otherwise @@ -346,8 +345,8 @@ - Search for an element in a list of tuples 1..tuple_size(Tuple) + Search for an element in a list of tuples

    Searches the list of tuples TupleList for a tuple whose Nth element compares equal to Key. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/log_mf_h.xml erlang-17.3-dfsg/lib/stdlib/doc/src/log_mf_h.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/log_mf_h.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/log_mf_h.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/Makefile erlang-17.3-dfsg/lib/stdlib/doc/src/Makefile --- erlang-18.2-dfsg/lib/stdlib/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1997-2015. All Rights Reserved. +# Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -49,7 +48,6 @@ digraph.xml \ digraph_utils.xml \ epp.xml \ - erl_anno.xml \ erl_eval.xml \ erl_expand_records.xml \ erl_id_trans.xml \ @@ -78,12 +76,12 @@ ms_transform.xml \ orddict.xml \ ordsets.xml \ + pg.xml \ pool.xml \ proc_lib.xml \ proplists.xml \ qlc.xml \ queue.xml \ - rand.xml \ random.xml \ re.xml \ sets.xml \ @@ -103,7 +101,7 @@ XML_REF6_FILES = stdlib_app.xml XML_PART_FILES = part.xml part_notes.xml part_notes_history.xml -XML_CHAPTER_FILES = io_protocol.xml unicode_usage.xml notes.xml notes_history.xml assert_hrl.xml +XML_CHAPTER_FILES = io_protocol.xml unicode_usage.xml notes.xml notes_history.xml BOOK_FILES = book.xml diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/maps.xml erlang-17.3-dfsg/lib/stdlib/doc/src/maps.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/maps.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/maps.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. maps Björn-Egil Dahlberg @@ -34,28 +33,6 @@ - - Choose pairs which satisfy a predicate - -

    - Returns a map Map2 for which predicate - Pred holds true in Map1. -

    -

    - The call will fail with a {badmap,Map} exception if - Map1 is not a map or with badarg if - Pred is not a function of arity 2. -

    -

    Example:

    - -> M = #{a => 2, b => 3, c=> 4, "a" => 1, "b" => 2, "c" => 4}, - Pred = fun(K,V) -> is_atom(K) andalso (V rem 2) =:= 0 end, - maps:filter(Pred,M). -#{a => 2,c => 4} -
    -
    - - @@ -63,9 +40,6 @@ Returns a tuple {ok, Value} where Value is the value associated with Key, or error if no value is associated with Key in Map.

    -

    - The call will fail with a {badmap,Map} exception if Map is not a map. -

    Example:

    > Map = #{"hi" => 42}, @@ -121,10 +95,8 @@

    Returns the value Value associated with Key if Map contains Key. -

    -

    - The call will fail with a {badmap,Map} exception if Map is not a map, - or with a {badkey,Key} exception if no value is associated with Key. + If no value is associated with Key then the call will + fail with an exception.

    Example:

    @@ -144,10 +116,6 @@ Map contains Key. If no value is associated with Key then returns Default.

    -

    - The call will fail with a {badmap,Map} exception if Map is not a map. - -

    Example:

    > Map = #{ key1 => val1, key2 => val2 }. @@ -166,9 +134,7 @@

    Returns true if map Map contains Key and returns false if it does not contain the Key. -

    -

    - The call will fail with a {badmap,Map} exception if Map is not a map. + The function will fail with an exception if Map is not a Map.

    Example:

    @@ -188,9 +154,6 @@

    Returns a complete list of keys, in arbitrary order, which resides within Map.

    -

    - The call will fail with a {badmap,Map} exception if Map is not a map. -

    Example:

    > Map = #{42 => value_three,1337 => "value two","a" => 1}, @@ -226,10 +189,6 @@ Merges two maps into a single map Map3. If two keys exists in both maps the value in Map1 will be superseded by the value in Map2.

    -

    - The call will fail with a {badmap,Map} exception if Map1 or - Map2 is not a map. -

    Example:

    > Map1 = #{a => "value_one", b => "value_two"}, @@ -263,10 +222,6 @@ replaced by value Value. The function returns a new map Map2 containing the new association and the old associations in Map1.

    -

    - The call will fail with a {badmap,Map} exception if Map1 is not a map. -

    -

    Example:

    > Map = #{"a" => 1}. @@ -286,9 +241,6 @@ The function removes the Key, if it exists, and its associated value from Map1 and returns a new map Map2 without key Key.

    -

    - The call will fail with a {badmap,Map} exception if Map1 is not a map. -

    Example:

    > Map = #{"a" => 1}. @@ -324,9 +276,6 @@ The fuction returns a list of pairs representing the key-value associations of Map, where the pairs, [{K1,V1}, ..., {Kn,Vn}], are returned in arbitrary order.

    -

    - The call will fail with a {badmap,Map} exception if Map is not a map. -

    Example:

    > Map = #{42 => value_three,1337 => "value two","a" => 1}, @@ -342,11 +291,8 @@

    If Key exists in Map1 the old associated value is replaced by value Value. The function returns a new map Map2 containing - the new associated value. -

    -

    - The call will fail with a {badmap,Map} exception if Map1 is not a map, - or with a {badkey,Key} exception if no value is associated with Key. + the new associated value. If Key does not exist in Map1 an exception is + generated.

    Example:

    @@ -362,10 +308,7 @@

    - Returns a complete list of values, in arbitrary order, contained in map Map. -

    -

    - The call will fail with a {badmap,Map} exception if Map is not a map. + Returns a complete list of values, in arbitrary order, contained in map M.

    Example:

    @@ -387,7 +330,7 @@ > Map = #{42 => value_three,1337 => "value two","a" => 1}, Ks = ["a",42,"other key"], - maps:with(Ks,Map). + maps:without(Ks,Map). #{42 => value_three,"a" => 1}
    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/math.xml erlang-17.3-dfsg/lib/stdlib/doc/src/math.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/math.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/math.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -68,13 +67,12 @@ - - Diverse math functions + Diverse math functions

    A collection of math functions which return floats. Arguments are numbers.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/ms_transform.xml erlang-17.3-dfsg/lib/stdlib/doc/src/ms_transform.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/ms_transform.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/ms_transform.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/notes_history.xml erlang-17.3-dfsg/lib/stdlib/doc/src/notes_history.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/notes.xml erlang-17.3-dfsg/lib/stdlib/doc/src/notes.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,593 +30,6 @@

    This document describes the changes made to the STDLIB application.

    -
    STDLIB 2.7 - -
    Fixed Bugs and Malfunctions - - -

    The Erlang Pretty Printer uses :: for function - type constraints.

    A bug concerning pretty printing - of annotated type union elements in map pair types has - been fixed.

    Some minor issues regarding the - documentation of types and specs have been corrected.

    -

    - Own Id: OTP-13084

    -
    - -

    The shell command rp prints strings as lists - of integers if pretty printing of lists is set to - false.

    -

    - Own Id: OTP-13145

    -
    - -

    - The shell would crash if a bit syntax expression with - conflicting types were given (e.g. if a field type was - given as 'integer-binary'). (Thanks to Aleksei - Magusev for reporting this bug.)

    -

    - Own Id: OTP-13157

    -
    - -

    The rand:export_seed/0 would never return - 'undefined' even if no seed has previously been - created. Fixed to return 'undefined' if there is - no seed in the process dictionary.

    -

    - Own Id: OTP-13162

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Add support for the Delete, Home and End keys in the - Erlang shell.

    -

    - Own Id: OTP-13032

    -
    - -

    beam_lib:all_chunks/1 and - beam_lib:build_module/1 have been documented.

    -

    - Own Id: OTP-13063

    -
    -
    -
    - -
    - -
    STDLIB 2.6 - -
    Fixed Bugs and Malfunctions - - -

    In OTP 18.0, qlc does not handle syntax errors - well. This bug has been fixed.

    -

    - Own Id: OTP-12946

    -
    - -

    - Optimize zip:unzip/2 when uncompressing to memory.

    -

    - Own Id: OTP-12950

    -
    - -

    - The stdlib reference manual is updated to show - correct information about the return value of - gen_fsm:reply/2.

    -

    - Own Id: OTP-12973

    -
    - -

    re:split2,3 and re:replace/3,4 now correctly handles - pre-compiled patterns that have been compiled using the - 'unicode' option.

    -

    - Own Id: OTP-12977

    -
    - -

    - Export shell:catch_exception/1 as documented.

    -

    - Own Id: OTP-12990

    -
    -
    -
    - - -
    Improvements and New Features - - -

    A mechanism for limiting the amount of text that the - built-in error logger events will produce has been - introduced. It is useful for limiting both the size of - log files and the CPU time used to produce them.

    -

    This mechanism is experimental in the sense that it - may be changed if it turns out that it does not solve the - problem it is supposed to solve. In that case, there may - be backward incompatible improvements to this - mechanism.

    -

    See the documentation for the config parameter - error_logger_format_depth in the Kernel - application for information about how to turn on this - feature.

    -

    - Own Id: OTP-12864

    -
    -
    -
    - -
    - -
    STDLIB 2.5 - -
    Fixed Bugs and Malfunctions - - -

    - Fix handling of single dot in filename:join/2

    -

    - The reference manual says that filename:join(A,B) is - equivalent to filename:join([A,B]). In some rare cases - this turns out not to be true. For example:

    -

    - filename:join("/a/.","b") -> "/a/./b" vs - filename:join(["/a/.","b"]) -> "/a/b".

    -

    - This has been corrected. A single dot is now only kept if - it occurs at the very beginning or the very end of the - resulting path.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-12158

    -
    - -

    - The undocumented option generic_debug for - gen_server has been removed.

    -

    - Own Id: OTP-12183

    -
    - -

    - erl_lint:icrt_export/4 has been rewritten to make the - code really follow the scoping rules of Erlang, and not - just in most situations by accident.

    -

    - Own Id: OTP-12186

    -
    - -

    - Add 'trim_all' option to binary:split/3

    -

    - This option can be set to remove _ALL_ empty parts of the - result of a call to binary:split/3.

    -

    - Own Id: OTP-12301

    -
    - -

    Correct orddict(3) regarding evaluation order of - fold() and map().

    -

    - Own Id: OTP-12651 Aux Id: seq12832

    -
    - -

    - Correct maps module error exceptions

    -

    - Bad input to maps module function will now yield the - following exceptions:

    - {badmap, NotMap}, or badarg. - -

    - Own Id: OTP-12657

    -
    - -

    - It is now possible to paste text in JCL mode (using - Ctrl-Y) that has been copied in the previous shell - session. Also a bug that caused the JCL mode to crash - when pasting text has been fixed.

    -

    - Own Id: OTP-12673

    -
    - -

    - Add uptime() shell command.

    -

    - Own Id: OTP-12752

    -
    - -

    - Cache nowarn_bif_clash functions in erl_lint.

    -

    - This patch stores nowarn_bif_clash in the lint record. By - using erlc +'{eprof,lint_module}' when compiling the - erlang parser, we noticed the time spent on - nowarn_function/2 reduced from 30% to 0.01%.

    -

    - Own Id: OTP-12754

    -
    - -

    - Optimize the Erlang Code Linter by using the cached - filename information.

    -

    - Own Id: OTP-12772

    -
    - -

    - If a child of a simple_one_for_one returns ignore from - its start function no longer store the child for any - restart type. It is not possible to restart or delete the - child because the supervisor is a simple_one_for_one.

    -

    - Own Id: OTP-12793

    -
    - -

    - Make ets:file2tab preserve enabled - read_concurrency and write_concurrency - options for tables.

    -

    - Own Id: OTP-12814

    -
    - -

    - There are many cases where user code needs to be able to - distinguish between a socket that was closed normally and - one that was aborted. Setting the option - {show_econnreset, true} enables the user to receive - ECONNRESET errors on both active and passive sockets.

    -

    - Own Id: OTP-12841

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Allow maps for supervisor flags and child specs

    -

    - Earlier, supervisor flags and child specs were given as - tuples. While this is kept for backwards compatibility, - it is now also allowed to give these parameters as maps, - see sup_flags - and child_spec.

    -

    - Own Id: OTP-11043

    -
    - -

    - A new system message, terminate, is added. This - can be sent with sys:terminate/2,3. If the - receiving process handles system messages properly it - will terminate shortly after receiving this message.

    -

    - The new function proc_lib:stop/1,3 utilizes this - new system message and monitors the receiving process in - order to facilitate a synchronous stop mechanism for - 'special processes'.

    -

    - proc_lib:stop/1,3 is used by the following - functions:

    - gen_server:stop/1,3 (new) - gen_fsm:stop/1,3 (new) - gen_event:stop/1,3 (modified to be - synchronous) wx_object:stop/1,3 - (new) -

    - Own Id: OTP-11173 Aux Id: seq12353

    -
    - -

    - Remove the pg module, which has been deprecated - through OTP-17, is now removed from the STDLIB - application. This module has been marked experimental for - more than 15 years, and has largely been superseded by - the pg2 module from the Kernel application.

    -

    - Own Id: OTP-11907

    -
    - -

    - New BIF: erlang:get_keys/0, lists all keys - associated with the process dictionary. Note: - erlang:get_keys/0 is auto-imported.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-12151 Aux Id: seq12521

    -
    - -

    Add three new functions to io_lib-- - scan_format/2, unscan_format/1, and - build_text/1-- which expose the parsed form of the - format control sequences to make it possible to easily - modify or filter the input to io_lib:format/2. - This can e.g. be used in order to replace unbounded-size - control sequences like ~w or ~p with - corresponding depth-limited ~W and ~P - before doing the actual formatting.

    -

    - Own Id: OTP-12167

    -
    - -

    Introduce the erl_anno module, an abstraction - of the second element of tokens and tuples in the - abstract format.

    -

    - Own Id: OTP-12195

    -
    - -

    - Support variables as Map keys in expressions and patterns

    -

    Erlang will accept any expression as keys in Map - expressions and it will accept literals or bound - variables as keys in Map patterns.

    -

    - Own Id: OTP-12218

    -
    - -

    The last traces of Mnemosyne Rules have been removed. -

    -

    - Own Id: OTP-12257

    -
    - -

    - Properly support maps in match_specs

    -

    - Own Id: OTP-12270

    -
    - -

    - New function ets:take/2. Works the same as - ets:delete/2 but also returns the deleted - object(s).

    -

    - Own Id: OTP-12309

    -
    - -

    string:tokens/2 is somewhat faster, especially - if the list of separators only contains one separator - character.

    -

    - Own Id: OTP-12422 Aux Id: seq12774

    -
    - -

    The documentation of the Abstract Format (in the ERTS - User's Guide) has been updated with types and - specification. (Thanks to Anthony Ramine.)

    The - explicit representation of parentheses used in types of - the abstract format has been removed. Instead the new - functions erl_parse:type_inop_prec() and - erl_parse:type_preop_prec() can be used for - inserting parentheses where needed.

    -

    - Own Id: OTP-12492

    -
    - -

    - Prevent zip:zip_open/[12] from leaking file descriptors - if parent process dies.

    -

    - Own Id: OTP-12566

    -
    - -

    - Add a new random number generator, see rand - module. It have better characteristics and an improved - interface.

    -

    - Own Id: OTP-12586 Aux Id: OTP-12501, OTP-12502

    -
    - -

    filename:split/1 when given an empty binary - will now return an empty list, to make it consistent with - return value when given an empty list.

    -

    - Own Id: OTP-12716

    -
    - -

    - Add sync option to ets:tab2file/3.

    -

    - Own Id: OTP-12737 Aux Id: seq12805

    -
    - -

    Add functions gb_sets:iterator_from() and - gb_trees:iterator_from(). (Thanks to Kirill - Kinduk.)

    -

    - Own Id: OTP-12742

    -
    - -

    - Add maps:filter/2 to maps module.

    -

    - Own Id: OTP-12745

    -
    - -

    - Change some internal data structures to Maps in order to - speed up compilation time. Measured speed up is around - 10%-15%.

    -

    - Own Id: OTP-12774

    -
    - -

    Update orddict to use parameterized types and - specs. (Thanks to UENISHI Kota.)

    -

    - Own Id: OTP-12785

    -
    - -

    The assert macros in eunit has been moved out - to stdlib/include/assert.hrl. This files get - included by eunit.hrl. Thus, nothing changes for - eunit users, but the asserts can now also be included - separately.

    -

    - Own Id: OTP-12808

    -
    -
    -
    - -
    - -
    STDLIB 2.4 - -
    Fixed Bugs and Malfunctions - - -

    - Behaviour of character types \d, \w and \s has always - been to not match characters with value above 255, not - 128, i.e. they are limited to ISO-Latin-1 and not ASCII

    -

    - Own Id: OTP-12521

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - c:m/1 now displays the module's MD5 sum.

    -

    - Own Id: OTP-12500

    -
    - -

    - Make ets:i/1 handle binary input from IO server.

    -

    - Own Id: OTP-12550

    -
    -
    -
    - -
    - -
    STDLIB 2.3 - -
    Fixed Bugs and Malfunctions - - -

    - The documentation of string:tokens/2 now explicitly - specifies that adjacent separator characters do not give - any empty strings in the resulting list of tokens.

    -

    - Own Id: OTP-12036

    -
    - -

    - Fix broken deprecation warnings in ssh application

    -

    - Own Id: OTP-12187

    -
    - -

    - Maps: Properly align union typed assoc values in - documentation

    -

    - Own Id: OTP-12190

    -
    - -

    - Fix filelib:wildcard/2 when 'Cwd' ends with a dot

    -

    - Own Id: OTP-12212

    -
    - -

    - Allow Name/Arity syntax in maps values inside - attributes.

    -

    - Own Id: OTP-12213

    -
    - -

    - Fix edlin to correctly save text killed with ctrl-u. - Prior to this fix, entering text into the Erlang shell - and then killing it with ctrl-u followed by yanking it - back with ctrl-y would result in the yanked text being - the reverse of the original killed text.

    -

    - Own Id: OTP-12224

    -
    - -

    - If a callback function was terminated with exit/1, there - would be no stack trace in the ERROR REPORT produced by - gen_server. This has been corrected.

    -

    - To keep the backwards compatibility, the actual exit - reason for the process is not changed.

    -

    - Own Id: OTP-12263 Aux Id: seq12733

    -
    - -

    - Warnings produced by ms_transform could point out - the wrong line number.

    -

    - Own Id: OTP-12264

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Supports tar file creation on other media than file - systems mounted on the local machine.

    -

    - The erl_tar api is extended with - erl_tar:init/3 that enables usage of user provided - media storage routines. A ssh-specific set of such - routines is hidden in the new function - ssh_sftp:open_tar/3 to simplify creating a tar - archive on a remote ssh server.

    -

    - A chunked file reading option is added to - erl_tar:add/3,4 to save memory on e.g small - embedded systems. The size of the slices read from a file - in that case can be specified.

    -

    - Own Id: OTP-12180 Aux Id: seq12715

    -
    - -

    - I/O requests are optimized for long message queues in the - calling process.

    -

    - Own Id: OTP-12315

    -
    -
    -
    - -
    -
    STDLIB 2.2
    Fixed Bugs and Malfunctions @@ -926,7 +338,8 @@ also implemented by the generic behaviours gen_server, gen_event and gen_fsm.

    - The potential incompatibility refers to:

    + The potential incompatibility refers to

    +

    The previous behaviour of intercepting the system message and passing a tuple of size 2 as the last argument to sys:handle_system_msg/6 is no longer @@ -934,7 +347,7 @@ StateFun in sys:replace_state/2,3 fails is changed from being totally silent to possibly (if the callback module does not catch) throw an exception in the - client process. + client process.

    (Thanks to James Fish and Steve Vinoski)

    @@ -1096,28 +509,22 @@

    EEP43: New data type - Maps

    - With Maps you may for instance:

    - - M0 = #{ a => 1, b => 2}, % create - associations - M1 = M0#{ a := 10 }, % update values - M2 = M1#{ "hi" => - "hello"}, % add new associations - #{ "hi" := V1, a := V2, b := V3} = M2. - % match keys with values - + With Maps you may for instance: M0 = + #{ a => 1, b => 2}, % create + associations M1 = M0#{ a := 10 }, % + update values M2 = M1#{ "hi" => + "hello"}, % add new associations #{ + "hi" := V1, a := V2, b := V3} = M2. % match keys with + values

    For information on how to use Maps please see Map Expressions in the Reference Manual.

    The current implementation is without the following - features:

    - - No variable keys - No single value access - No map comprehensions - + features: No variable keys + No single value access No map + comprehensions

    Note that Maps is experimental during OTP 17.0.

    @@ -1868,15 +1275,13 @@ supervisor or for the problematic child.

    This introduces some incompatibilities in stdlib due to - new return values from supervisor:

    - + new return values from supervisor: restart_child/2 can now return {error,restarting} delete_child/2 can now return {error,restarting} which_children/1 returns a list of {Id,Child,Type,Mods}, where Child, in addition to the old pid() or 'undefined', now also can be - 'restarting'. - + 'restarting'.

    *** POTENTIAL INCOMPATIBILITY ***

    @@ -1892,10 +1297,10 @@ Own Id: OTP-9782 Aux Id: seq11964

    -

    Use universal time as base in error logger

    +

    Use universal time as base in error logger

    Previous conversion used the deprecated - calendar:local_time_to_universal_time/1

    + calendar:local_time_to_universal_time/1

    Own Id: OTP-9854

    @@ -2652,10 +2057,10 @@ Own Id: OTP-8989 Aux Id: seq11741

    -

    Fix exception generation in the io module

    +

    Fix exception generation in the io module

    Some functions did not generate correct badarg exception - on a badarg exception.

    + on a badarg exception.

    Own Id: OTP-9045

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/orddict.xml erlang-17.3-dfsg/lib/stdlib/doc/src/orddict.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/orddict.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/orddict.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 20002015 + 20002013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -49,11 +48,8 @@ - -

    Dictionary as returned by new/0.

    -
    - - + +

    As returned by new/0.

    @@ -129,7 +125,8 @@ Orddict together with an extra argument Acc (short for accumulator). Fun must return a new accumulator which is passed to the next call. Acc0 is - returned if the list is empty.

    + returned if the list is empty. The evaluation order is + undefined.

    @@ -153,7 +150,8 @@ Map a function over a dictionary

    map calls Fun on successive keys and values - of Orddict1 to return a new value for each key.

    + of Orddict1 to return a new value for each key. + The evaluation order is undefined.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/ordsets.xml erlang-17.3-dfsg/lib/stdlib/doc/src/ordsets.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/ordsets.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/ordsets.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/part_notes_history.xml erlang-17.3-dfsg/lib/stdlib/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/part_notes.xml erlang-17.3-dfsg/lib/stdlib/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/part.xml erlang-17.3-dfsg/lib/stdlib/doc/src/part.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/pg.xml erlang-17.3-dfsg/lib/stdlib/doc/src/pg.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/pg.xml 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/pg.xml 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,114 @@ + + + + +
    + + 1996 + 2014 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + pg + + + + +
    + pg + Distributed, Named Process Groups + + +

    This module is deprecated and will be removed in Erlang/OTP 18.

    +
    +

    This (experimental) module implements process groups. A process + group is a group of processes that can be accessed by a common + name. For example, a group named foobar can include a set + of processes as members of this group and they can be located on + different nodes.

    +

    When messages are sent to the named group, all members of + the group receive the message. The messages are serialized. If + the process P1 sends the message M1 to the group, + and process P2 simultaneously sends message M2, then + all members of the group receive the two messages in the same + order. If members of a group terminate, they are automatically + removed from the group.

    +

    This module is not complete. The module is inspired by the ISIS + system and the causal order protocol of the ISIS system should + also be implemented. At the moment, all messages are serialized + by sending them through a group master process.

    +
    + + + + Create an empty group + +

    Creates an empty group named PgName on the current + node.

    +
    +
    + + + Create an empty group on another node + +

    Creates an empty group named PgName on the node + Node.

    +
    +
    + + + Join a pid to a process group + +

    Joins the pid Pid to the process group + PgName. + Returns a list of all old members of the group.

    +
    +
    + + + Send a message to all members of a process group + +

    Sends the tuple {pg_message, From, PgName, Msg} to + all members of the process group PgName.

    +

    Failure: {badarg, {PgName, Msg}} + if PgName is + not a process group (a globally registered name).

    +
    +
    + + + Send a message to all members of a process group, except ourselves + +

    Sends the tuple {pg_message, From, PgName, Msg} to + all members of the process group PgName, except + ourselves.

    +

    Failure: {badarg, {PgName, Msg}} + if PgName is + not a process group (a globally registered name).

    +
    +
    + + + Return a list of all members of a process group + +

    Returns a list of all members of the process group + PgName.

    +
    +
    +
    +
    + diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/pool.xml erlang-17.3-dfsg/lib/stdlib/doc/src/pool.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/pool.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/pool.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/proc_lib.xml erlang-17.3-dfsg/lib/stdlib/doc/src/proc_lib.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/proc_lib.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/proc_lib.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19962014 + 19962013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -174,7 +173,7 @@ Used by a process when it has started. -

    This function must be used by a process that has been started by +

    This function must used by a process that has been started by a start[_link]/3,4,5 function. It tells Parent that the process has initialized itself, has started, or has failed to initialize @@ -227,17 +226,6 @@ - - Format a crash report. - -

    This function can be used by a user defined event handler to - format a crash report. When Depth is given as an - positive integer, it will be used in the format string to - limit the output as follows: io_lib:format("~P", - [Term,Depth]).

    -
    - - Extract the initial call of a proc_libspawned process. @@ -310,40 +298,6 @@ proc_lib functions.

    - - - Terminate a process synchronously. - - -

    Equivalent to stop(Process, - normal, infinity).

    -
    -
    - - - Terminate a process synchronously. - - - - -

    Orders the process to exit with the given Reason and - waits for it to terminate.

    -

    The function returns ok if the process exits with - the given Reason within Timeout - milliseconds.

    -

    If the call times out, a timeout exception is - raised.

    -

    If the process does not exist, a noproc - exception is raised.

    -

    The implementation of this function is based on the - terminate system message, and requires that the - process handles system messages correctly. - See sys(3) - and OTP - Design Principles for information about system - messages.

    -
    -
    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/proplists.xml erlang-17.3-dfsg/lib/stdlib/doc/src/proplists.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/proplists.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/proplists.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/qlc.xml erlang-17.3-dfsg/lib/stdlib/doc/src/qlc.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/qlc.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/qlc.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/queue.xml erlang-17.3-dfsg/lib/stdlib/doc/src/queue.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/queue.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/queue.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -96,6 +95,9 @@ + +

    queue() is equivalent to queue(term()).

    +
    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/random.xml erlang-17.3-dfsg/lib/stdlib/doc/src/random.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/random.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/random.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -48,10 +47,7 @@ tuple of three integers.

    It should be noted that this random number generator is not cryptographically strong. If a strong cryptographic random number generator is needed for - example crypto:strong_rand_bytes/1 could be used instead.

    -

    The new and improved rand module should be used - instead of this module.

    + example crypto:rand_bytes/1 could be used instead.

    @@ -74,17 +70,12 @@

    Seeds random number generation with integer values in the process dictionary, and returns the old state.

    -

    One easy way of obtaining a unique value to seed with is to:

    +

    One way of obtaining a seed is to use the BIF now/0:

    -random:seed(erlang:phash2([node()]), - erlang:monotonic_time(), - erlang:unique_integer()) -

    See - erlang:phash2/1, - node/0, - erlang:monotonic_time/0, and - - erlang:unique_integer/0) for details.

    + ... + {A1,A2,A3} = now(), + random:seed(A1, A2, A3), + ...
    @@ -148,7 +139,7 @@

    The implementation changed in R15. Upgrading to R15 will break applications that expect a specific output for a given seed. The output is still deterministic number series, but different compared to releases - older than R15. The seed {0,0,0} will, for example, no longer + older than R15. The seed {0,0,0} will for example no longer produce a flawed series of only zeros.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/rand.xml erlang-17.3-dfsg/lib/stdlib/doc/src/rand.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/rand.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/rand.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,247 +0,0 @@ - - - - -
    - - 2015 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - rand - - - 1 - - - - A - rand.xml -
    - rand - Pseudo random number generation - -

    Random number generator.

    - -

    The module contains several different algorithms and can be - extended with more in the future. The current uniform - distribution algorithms uses the - - scrambled Xorshift algorithms by Sebastiano Vigna and the - normal distribution algorithm uses the - - Ziggurat Method by Marsaglia and Tsang. -

    - -

    The implemented algorithms are:

    - - exsplus Xorshift116+, 58 bits precision and period of 2^116-1. - exs64 Xorshift64*, 64 bits precision and a period of 2^64-1. - exs1024 Xorshift1024*, 64 bits precision and a period of 2^1024-1. - - -

    The current default algorithm is exsplus. The default - may change in future. If a specific algorithm is required make - sure to always use seed/1 - to initialize the state. -

    - -

    Every time a random number is requested, a state is used to - calculate it and a new state produced. The state can either be - implicit or it can be an explicit argument and return value. -

    - -

    The functions with implicit state use the process dictionary - variable rand_seed to remember the current state.

    - -

    If a process calls uniform/0 or - uniform/1 without - setting a seed first, seed/1 - is called automatically with the default algorithm and creates a - non-constant seed.

    - -

    The functions with explicit state never use the process - dictionary.

    - -

    Examples:

    -
    -      %% Simple usage. Creates and seeds the default algorithm
    -      %% with a non-constant seed if not already done.
    -      R0 = rand:uniform(),
    -      R1 = rand:uniform(),
    -
    -      %% Use a given algorithm.
    -      _ = rand:seed(exs1024),
    -      R2 = rand:uniform(),
    -
    -      %% Use a given algorithm with a constant seed.
    -      _ = rand:seed(exs1024, {123, 123534, 345345}),
    -      R3 = rand:uniform(),
    -
    -      %% Use the functional api with non-constant seed.
    -      S0 = rand:seed_s(exsplus),
    -      {R4, S1} = rand:uniform_s(S0),
    -
    -      %% Create a standard normal deviate.
    -      {SND0, S2} = rand:normal_s(S1),
    -    
    - -

    This random number generator is not cryptographically - strong. If a strong cryptographic random number generator is - needed, use one of functions in the - crypto - module, for example crypto:strong_rand_bytes/1.

    -
    - - - - - - - -

    Algorithm dependent state.

    -
    - - - -

    Algorithm dependent state which can be printed or saved to file.

    -
    -
    - - - - - Seed random number generator - - -

    Seeds random number generation with the given algorithm and time dependent - data if AlgOrExpState is an algorithm.

    -

    Otherwise recreates the exported seed in the process - dictionary, and returns the state. - See also: export_seed/0.

    -
    -
    - - - Seed random number generator - -

    Seeds random number generation with the given algorithm and time dependent - data if AlgOrExpState is an algorithm.

    -

    Otherwise recreates the exported seed and returns the state. - See also: export_seed/0.

    -
    -
    - - - Seed the random number generation - -

    Seeds random number generation with the given algorithm and - integers in the process dictionary and returns - the state.

    -
    -
    - - - Seed the random number generation - -

    Seeds random number generation with the given algorithm and - integers and returns the state.

    -
    -
    - - - - Export the random number generation state - -

    Returns the random number state in an external format. - To be used with seed/1.

    -
    -
    - - - - Export the random number generation state - -

    Returns the random number generator state in an external format. - To be used with seed/1.

    -
    -
    - - - - Return a random float - - -

    Returns a random float uniformly distributed in the value - range 0.0 < X < 1.0 and - updates the state in the process dictionary.

    -
    -
    - - - Return a random float - -

    Given a state, uniform_s/1 returns a random float - uniformly distributed in the value range 0.0 < - X < 1.0 and a new state.

    -
    -
    - - - - Return a random integer - - -

    Given an integer N >= 1, - uniform/1 returns a random integer uniformly - distributed in the value range - 1 <= X <= N and - updates the state in the process dictionary.

    -
    -
    - - - Return a random integer - -

    Given an integer N >= 1 and a state, - uniform_s/2 returns a random integer uniformly - distributed in the value range 1 <= X <= - N and a new state.

    -
    -
    - - - - Return a standard normal distributed random float - -

    Returns a standard normal deviate float (that is, the mean - is 0 and the standard deviation is 1) and updates the state in - the process dictionary.

    -
    -
    - - - Return a standard normal distributed random float - -

    Given a state, normal_s/1 returns a standard normal - deviate float (that is, the mean is 0 and the standard - deviation is 1) and a new state.

    -
    -
    - -
    -
    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/ref_man.xml erlang-17.3-dfsg/lib/stdlib/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19962015 + 19962013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -36,7 +35,6 @@ - @@ -47,7 +45,6 @@ - @@ -76,12 +73,12 @@ + - diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/re.xml erlang-17.3-dfsg/lib/stdlib/doc/src/re.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/re.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/re.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved on line at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -151,11 +150,7 @@ no_start_optimize This option disables optimization that may malfunction if "Special start-of-pattern items" are present in the regular expression. A typical example would be when matching "DEFABC" against "(*COMMIT)ABC", where the start optimization of PCRE would skip the subject up to the "A" and would never realize that the (*COMMIT) instruction should have made the matching fail. This option is only relevant if you use "start-of-pattern items", as discussed in the section "PCRE regular expression details" below. ucp - Specifies that Unicode Character Properties should be used when - resolving \B, \b, \D, \d, \S, \s, \W and \w. Without this flag, only - ISO-Latin-1 properties are used. Using Unicode properties hurts - performance, but is semantically correct when working with Unicode - characters beyond the ISO-Latin-1 range. + Specifies that Unicode Character Properties should be used when resolving \B, \b, \D, \d, \S, \s, \Wand \w. Without this flag, only ISO-Latin-1 properties are used. Using Unicode properties hurts performance, but is semantically correct when working with Unicode characters beyond the ISO-Latin-1 range. never_utf Specifies that the (*UTF) and/or (*UTF8) "start-of-pattern items" are forbidden. This flag can not be combined with unicode. Useful if ISO-Latin-1 patterns from an external source are to be compiled. @@ -205,8 +200,8 @@ - Match a subject against regular expression and capture subpatterns See compile/2 above. + Match a subject against regular expression and capture subpatterns

    Executes a regexp matching, returning match/{match, @@ -881,11 +876,11 @@ - + +

    PERL LIKE REGULAR EXPRESSIONS SYNTAX -

    - The following sections contain reference material for the +

    The following sections contain reference material for the regular expressions used by this module. The regular expression reference is based on the PCRE documentation, with changes in cases where the re module behaves differently to the PCRE library.

    @@ -971,7 +966,7 @@

    This has the same effect as setting the ucp option: it causes sequences such as \d and \w to use Unicode properties to determine character types, -instead of recognizing only characters with codes less than 256 via a lookup +instead of recognizing only characters with codes less than 128 via a lookup table.

    @@ -1312,8 +1307,7 @@ low-valued character tables, in Erlang's case (and without the unicode option), the ISO-Latin-1 character set.

    -

    By default, in unicode mode, characters with values greater than 255, -i.e. all characters outside the ISO-Latin-1 character set, never match +

    By default, in unicode mode, characters with values greater than 128 never match \d, \s, or \w, and always match \D, \S, and \W. These sequences retain their original meanings from before UTF support was available, mainly for efficiency reasons. However, if the ucp option is set, the behaviour is changed so that Unicode @@ -1960,10 +1954,10 @@ upper case and lower case versions, so for example, a caseless [aeiou] matches "A" as well as "a", and a caseless [^aeiou] does not match "A", whereas a caseful version would. In a UTF mode, PCRE always understands the concept of -case for characters whose values are less than 256, so caseless matching is +case for characters whose values are less than 128, so caseless matching is always possible. For characters with higher values, the concept of case is supported if PCRE is compiled with Unicode property support, but not otherwise. -If you want to use caseless matching in a UTF mode for characters 256 and +If you want to use caseless matching in a UTF mode for characters 128 and above, you must ensure that PCRE is compiled with Unicode property support as well as with UTF support.

    @@ -1995,7 +1989,7 @@ [][\\^_`wxyzabc], matched caselessly, and in a non-UTF mode, if character tables for a French locale are in use, [\xc8-\xcb] matches accented E characters in both cases. In UTF modes, PCRE supports the concept of case for -characters with values greater than 255 only when it is compiled with Unicode +characters with values greater than 128 only when it is compiled with Unicode property support.

    The character escape sequences \d, \D, \h, \H, \p, \P, \s, \S, \v, @@ -2068,9 +2062,9 @@ syntax [.ch.] and [=ch=] where "ch" is a "collating element", but these are not supported, and an error is given if they are encountered.

    -

    By default, in UTF modes, characters with values greater than 255 do not match +

    By default, in UTF modes, characters with values greater than 128 do not match any of the POSIX character classes. However, if the PCRE_UCP option is passed -to pcre_compile(), some of the classes are changed so that Unicode +to pcre_compile(), some of the classes are changed so that Unicode character properties are used. This is achieved by replacing the POSIX classes by other sequences, as follows:

    @@ -2078,16 +2072,16 @@ [:alnum:] becomes \p{Xan} [:alpha:] becomes \p{L} [:blank:] becomes \h - [:digit:] becomes \p{Nd} + [:digit:] becomes \p{Nd} [:lower:] becomes \p{Ll} [:space:] becomes \p{Xps} - [:upper:] becomes \p{Lu} + [:upper:] becomes \p{Lu} [:word:] becomes \p{Xwd}

    Negated versions, such as [:^alpha:] use \P instead of \p. The other POSIX classes are unchanged, and match only characters with code points less than -256.

    +128.

    @@ -3059,7 +3053,7 @@

    abc #comment \n still comment

    -

    On encountering the # character, pcre_compile() skips along, looking for +

    On encountering the # character, pcre_compile() skips along, looking for a newline in the pattern. The sequence \n is still literal at this stage, so it does not terminate the comment. Only an actual character with the code value 0x0a (the default newline) does so.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/sets.xml erlang-17.3-dfsg/lib/stdlib/doc/src/sets.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/sets.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/sets.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 20002015 + 20002014 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -51,6 +50,9 @@ + +

    set() is equivalent to set(term()).

    +
    @@ -63,7 +65,7 @@ - Test for a Set + Test for an Set

    Returns true if Set is a set of elements, otherwise false.

    @@ -78,22 +80,21 @@
    - Convert a Setinto a list + Convert an Setinto a list -

    Returns the elements of Set as a list. - The order of the returned elements is undefined.

    +

    Returns the elements of Set as a list.

    - Convert a list into a Set + Convert a list into an Set -

    Returns a set of the elements in List.

    +

    Returns an set of the elements in List.

    - Test for membership of a Set + Test for membership of an Set

    Returns true if Element is an element of Set, otherwise false.

    @@ -101,7 +102,7 @@
    - Add an element to a Set + Add an element to an Set

    Returns a new set formed from Set1 with Element inserted.

    @@ -109,7 +110,7 @@
    - Remove an element from a Set + Remove an element from an Set

    Returns Set1, but with Element removed.

    @@ -174,8 +175,7 @@ Fold over set elements

    Fold Function over every element in Set - returning the final value of the accumulator. - The evaluation order is undefined.

    + returning the final value of the accumulator.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/shell_default.xml erlang-17.3-dfsg/lib/stdlib/doc/src/shell_default.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/shell_default.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/shell_default.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/shell.xml erlang-17.3-dfsg/lib/stdlib/doc/src/shell.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/shell.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/shell.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/slave.xml erlang-17.3-dfsg/lib/stdlib/doc/src/slave.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/slave.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/slave.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/sofs.xml erlang-17.3-dfsg/lib/stdlib/doc/src/sofs.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/sofs.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/sofs.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -398,9 +397,8 @@ - tuple_of(T) -

    - A tuple where the elements are of type T.

    + tuple_of(T) +

    A tuple where the elements are of type T.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/specs.xml erlang-17.3-dfsg/lib/stdlib/doc/src/specs.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/specs.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/specs.xml 2014-09-16 19:10:57.000000000 +0000 @@ -11,7 +11,6 @@ - @@ -40,12 +39,12 @@ + - diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/stdlib_app.xml erlang-17.3-dfsg/lib/stdlib/doc/src/stdlib_app.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/stdlib_app.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/stdlib_app.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/string.xml erlang-17.3-dfsg/lib/stdlib/doc/src/string.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/string.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/string.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 19962014 + 19962013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -125,10 +124,6 @@ > tokens("abc defxxghix jkl", "x "). ["abc", "def", "ghi", "jkl"] -

    Note that, as shown in the example above, two or more - adjacent separator characters in String - will be treated as one. That is, there will not be any empty - strings in the resulting list of tokens.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/supervisor_bridge.xml erlang-17.3-dfsg/lib/stdlib/doc/src/supervisor_bridge.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/supervisor_bridge.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/supervisor_bridge.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/supervisor.xml erlang-17.3-dfsg/lib/stdlib/doc/src/supervisor.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/supervisor.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/supervisor.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -38,12 +37,12 @@ the gen_event, gen_fsm, or gen_server behaviours. A supervisor implemented using this module will have a standard set of interface functions and include functionality - for tracing and error reporting. Supervisors are used to build a + for tracing and error reporting. Supervisors are used to build an hierarchical process structure called a supervision tree, a nice way to structure a fault tolerant application. Refer to OTP Design Principles for more information.

    -

    A supervisor expects the definition of which child processes to - supervise to be specified in a callback module exporting a +

    A supervisor assumes the definition of which child processes to + supervise to be located in a callback module exporting a pre-defined set of functions.

    Unless otherwise stated, all functions in this module will fail if the specified supervisor does not exist or if bad arguments @@ -54,30 +53,18 @@ Supervision Principles

    The supervisor is responsible for starting, stopping and monitoring its child processes. The basic idea of a supervisor is - that it shall keep its child processes alive by restarting them + that it should keep its child processes alive by restarting them when necessary.

    -

    The children of a supervisor are defined as a list of +

    The children of a supervisor is defined as a list of child specifications. When the supervisor is started, the child processes are started in order from left to right according to this list. When the supervisor terminates, it first terminates its child processes in reversed start order, from right to left.

    - -

    The properties of a supervisor are defined by the supervisor - flags. This is the type definition for the supervisor flags: -

    -
    sup_flags() = #{strategy => strategy(),         % optional
    -                intensity => non_neg_integer(), % optional
    -                period => pos_integer()}        % optional
    -      
    -

    A supervisor can have one of the following restart - strategies, specified with the strategy key in the - above map: -

    +

    A supervisor can have one of the following restart strategies:

    one_for_one - if one child process terminates and - should be restarted, only that child process is - affected. This is the default restart strategy.

    + should be restarted, only that child process is affected.

    one_for_all - if one child process terminates and @@ -107,53 +94,43 @@ instead the child specification identifier is used, terminate_child/2 will return {error,simple_one_for_one}.

    -

    Because a simple_one_for_one supervisor could have - many children, it shuts them all down asynchronously. This - means that the children will do their cleanup in parallel, - and therefore the order in which they are stopped is not - defined.

    +

    Because a simple_one_for_one supervisor could have many + children, it shuts them all down at same time. So, order in which they + are stopped is not defined. For the same reason, it could have an + overhead with regards to the Shutdown strategy.

    To prevent a supervisor from getting into an infinite loop of - child process terminations and restarts, a maximum restart - intensity is defined using two integer values specified - with the intensity and period keys in the above - map. Assuming the values MaxR for intensity - and MaxT for period, then if more than MaxR - restarts occur within MaxT seconds, the supervisor will - terminate all child processes and then itself. The default value - for intensity is 1, and the default value - for period is 5. + child process terminations and restarts, a maximum restart frequency + is defined using two integer values MaxR + and MaxT. If more than MaxR restarts occur within + MaxT seconds, the supervisor terminates all child + processes and then itself.

    This is the type definition of a child specification:

    -
    child_spec() = #{id => child_id(),       % mandatory
    -                 start => mfargs(),      % mandatory
    -                 restart => restart(),   % optional
    -                 shutdown => shutdown(), % optional
    -                 type => worker(),       % optional
    -                 modules => modules()}   % optional
    -

    The old tuple format is kept for backwards compatibility, - see child_spec(), - but the map is preferred. -

    +
    +child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules}
    + Id = term()
    + StartFunc = {M,F,A}
    +  M = F = atom()
    +  A = [term()]
    + Restart = permanent | transient | temporary
    + Shutdown = brutal_kill | int()>0 | infinity
    + Type = worker | supervisor
    + Modules = [Module] | dynamic
    +  Module = atom()
    -

    id is used to identify the child +

    Id is a name that is used to identify the child specification internally by the supervisor.

    -

    The id key is mandatory.

    -

    Note that this identifier on occations has been called - "name". As far as possible, the terms "identifier" or "id" - are now used but in order to keep backwards compatibility, - some occurences of "name" can still be found, for example - in error messages.

    -

    start defines the function call used to start the - child process. It must be a module-function-arguments +

    StartFunc defines the function call used to start + the child process. It should be a module-function-arguments tuple {M,F,A} used as apply(M,F,A).

    The start function must create and link to the child - process, and must return {ok,Child} or + process, and should return {ok,Child} or {ok,Child,Info} where Child is the pid of the child process and Info an arbitrary term which is ignored by the supervisor.

    @@ -166,23 +143,20 @@ error tuple {error,Error}.

    Note that the start_link functions of the different behaviour modules fulfill the above requirements.

    -

    The start key is mandatory.

    -

    restart defines when a terminated child process - shall be restarted. A permanent child process will - always be restarted, a temporary child process will +

    Restart defines when a terminated child process + should be restarted. A permanent child process should + always be restarted, a temporary child process should never be restarted (even when the supervisor's restart strategy is rest_for_one or one_for_all and a sibling's death causes the temporary process to be terminated) and a - transient child process will be restarted only if + transient child process should be restarted only if it terminates abnormally, i.e. with another exit reason than normal, shutdown or {shutdown,Term}.

    -

    The restart key is optional. If it is not given, the - default value permanent will be used.

    -

    shutdown defines how a child process shall be +

    Shutdown defines how a child process should be terminated. brutal_kill means the child process will be unconditionally terminated using exit(Child,kill). An integer timeout value means that the supervisor will tell @@ -192,45 +166,35 @@ no exit signal is received within the specified number of milliseconds, the child process is unconditionally terminated using exit(Child,kill).

    -

    If the child process is another supervisor, the shutdown time +

    If the child process is another supervisor, Shutdown should be set to infinity to give the subtree ample - time to shut down. It is also allowed to set it to infinity, + time to shutdown. It is also allowed to set it to infinity, if the child process is a worker.

    -

    Be careful when setting the shutdown time to +

    Be careful by setting the Shutdown strategy to infinity when the child process is a worker. Because, in this situation, the termination of the supervision tree depends on the child process, it must be implemented in a safe way and its cleanup procedure must always return.

    Note that all child processes implemented using the standard - OTP behaviour modules automatically adhere to the shutdown + OTP behavior modules automatically adhere to the shutdown protocol.

    -

    The shutdown key is optional. If it is not given, - the default value 5000 will be used if the child is - of type worker; and infinity will be used if - the child is of type supervisor.

    -

    type specifies if the child process is a supervisor or +

    Type specifies if the child process is a supervisor or a worker.

    -

    The type key is optional. If it is not given, the - default value worker will be used.

    -

    modules is used by the release handler during code +

    Modules is used by the release handler during code replacement to determine which processes are using a certain - module. As a rule of thumb, if the child process is a - supervisor, gen_server, or gen_fsm, - this should be a list with one element [Module], - where Module is the callback module. If the child - process is an event manager (gen_event) with a - dynamic set of callback modules, the value dynamic - shall be used. See OTP Design Principles for more - information about release handling.

    -

    The modules key is optional. If it is not given, it - defaults to [M], where M comes from the - child's start {M,F,A}

    + module. As a rule of thumb Modules should be a list + with one element [Module], where Module is + the callback module, if the child process is a supervisor, + gen_server or gen_fsm. If the child process is an event + manager (gen_event) with a dynamic set of callback modules, + Modules should be dynamic. See OTP Design Principles + for more information about release handling.

    Internally, the supervisor also keeps track of the pid @@ -249,20 +213,11 @@ -

    The tuple format is kept for backwards compatibility - only. A map is preferred; see more details - above.

    - -

    The value undefined for A (the - argument list) is only to be used internally - in supervisor. If the restart type of the child - is temporary, then the process is never to be - restarted and therefore there is no need to store the real - argument list. The value undefined will then be - stored instead.

    +

    A (the argument list) has the value + undefined if Restart is temporary.

    @@ -278,12 +233,6 @@ - -

    The tuple format is kept for backwards compatibility - only. A map is preferred; see more details - above.

    -
    - @@ -304,20 +253,20 @@ the supervisor is linked to the calling process (its supervisor).

    The created supervisor process calls Module:init/1 to - find out about restart strategy, maximum restart intensity + find out about restart strategy, maximum restart frequency and child processes. To ensure a synchronized start-up procedure, start_link/2,3 does not return until Module:init/1 has returned and all child processes have been started.

    -

    If SupName={local,Name}, the supervisor is registered +

    If SupName={local,Name} the supervisor is registered locally as Name using register/2. If SupName={global,Name} the supervisor is registered globally as Name using global:register_name/2. If SupName={via,Module,Name} the supervisor is registered as Name using the registry represented by - Module. The Module callback must export the functions + Module. The Module callback should export the functions register_name/2, unregister_name/1 and send/2, - which shall behave like the corresponding functions in global. + which should behave like the corresponding functions in global. Thus, {via,global,Name} is a valid reference.

    If no name is provided, the supervisor is not registered.

    Module is the name of the callback module.

    @@ -325,14 +274,14 @@ the argument to Module:init/1.

    If the supervisor and its child processes are successfully created (i.e. if all child process start functions return - {ok,Child}, {ok,Child,Info}, or ignore), + {ok,Child}, {ok,Child,Info}, or ignore) the function returns {ok,Pid}, where Pid is the pid of the supervisor. If there already exists a process - with the specified SupName, the function returns + with the specified SupName the function returns {error,{already_started,Pid}}, where Pid is the pid of that process.

    If Module:init/1 returns ignore, this function - returns ignore as well, and the supervisor terminates + returns ignore as well and the supervisor terminates with reason normal. If Module:init/1 fails or returns an incorrect value, this function returns {error,Term} where Term @@ -348,12 +297,13 @@ Dynamically add a child process to a supervisor. +

    Dynamically adds a child specification to the supervisor SupRef which starts the corresponding child process.

    -

    SupRef can be:

    +

    SupRef can be:

    the pid, Name, if the supervisor is locally registered, @@ -364,41 +314,35 @@ {via,Module,Name}, if the supervisor is registered through an alternative process registry. -

    ChildSpec must be a valid child specification +

    ChildSpec should be a valid child specification (unless the supervisor is a simple_one_for_one - supervisor; see below). The child process will be started by + supervisor, see below). The child process will be started by using the start function as defined in the child specification.

    -

    In the case of a simple_one_for_one supervisor, +

    If the case of a simple_one_for_one supervisor, the child specification defined in Module:init/1 will - be used, and ChildSpec shall instead be an arbitrary + be used and ChildSpec should instead be an arbitrary list of terms List. The child process will then be started by appending List to the existing start function arguments, i.e. by calling apply(M, F, A++List) where {M,F,A} is the start function defined in the child specification.

    If there already exists a child specification with - the specified identifier, ChildSpec is discarded, and + the specified Id, ChildSpec is discarded and the function returns {error,already_present} or {error,{already_started,Child}}, depending on if the corresponding child process is running or not.

    If the child process start function returns {ok,Child} - or {ok,Child,Info}, the child specification and pid are + or {ok,Child,Info}, the child specification and pid is added to the supervisor and the function returns the same value.

    If the child process start function returns ignore, - the child specification is added to the supervisor (unless the - supervisor is a simple_one_for_one supervisor, see below), - the pid is set to undefined and the function returns - {ok,undefined}. -

    -

    In the case of a simple_one_for_one supervisor, when a child - process start function returns ignore the functions returns - {ok,undefined} and no child is added to the supervisor. -

    + the child specification is added to the supervisor, the pid + is set to undefined and the function returns + {ok,undefined}.

    If the child process start function returns an error tuple or an erroneous value, or if it fails, the child specification is - discarded, and the function returns {error,Error} where + discarded and the function returns {error,Error} where Error is a term containing information about the error and child specification.

    @@ -422,7 +366,7 @@

    If the child is temporary, the child specification is deleted as soon as the process terminates. This means - that delete_child/2 has no meaning, + that delete_child/2 has no meaning and restart_child/2 can not be used for these children.

    @@ -431,13 +375,13 @@ process is alive, but is not a child of the given supervisor, the function will return {error,not_found}. If the child specification - identifier is given instead of a pid(), the + identifier is given instead instead of a pid(), the function will return {error,simple_one_for_one}.

    If successful, the function returns ok. If there is no child specification with the specified Id, the function returns {error,not_found}.

    -

    See start_child/2 - for a description of SupRef.

    +

    See start_child/2 for a description of + SupRef.

    @@ -446,15 +390,15 @@

    Tells the supervisor SupRef to delete the child specification identified by Id. The corresponding child - process must not be running. Use terminate_child/2 to + process must not be running, use terminate_child/2 to terminate it.

    -

    See start_child/2 - for a description of SupRef.

    +

    See start_child/2 for a description of + SupRef.

    If successful, the function returns ok. If the child specification identified by Id exists but the corresponding child process is running or about to be restarted, the function returns {error,running} or - {error,restarting}, respectively. If the child specification + {error,restarting} respectively. If the child specification identified by Id does not exist, the function returns {error,not_found}.

    @@ -466,10 +410,10 @@

    Tells the supervisor SupRef to restart a child process corresponding to the child specification identified by Id. The child - specification must exist, and the corresponding child process + specification must exist and the corresponding child process must not be running.

    Note that for temporary children, the child specification - is automatically deleted when the child terminates; thus + is automatically deleted when the child terminates, and thus it is not possible to restart such children.

    See start_child/2 for a description of SupRef.

    @@ -485,7 +429,7 @@ is added to the supervisor and the function returns the same value.

    If the child process start function returns ignore, - the pid remains set to undefined, and the function + the pid remains set to undefined and the function returns {ok,undefined}.

    If the child process start function returns an error tuple or an erroneous value, or if it fails, the function returns @@ -518,7 +462,7 @@

    Child - the pid of the corresponding child process, the atom restarting if the process is about to be - restarted, or undefined if there is no such process.

    + restarted or undefined if there is no such process.

    Type - as defined in the child specification.

    @@ -531,8 +475,8 @@
    - Return counts for the number of child specifications, - active children, supervisors, and workers. + Return counts for the number of childspecs, active children, + supervisors and workers.

    Returns a property list (see proplists) containing the counts for each of the following elements of the supervisor's @@ -556,8 +500,6 @@ process is still alive.

    -

    See start_child/2 - for a description of SupRef.

    @@ -569,23 +511,11 @@ correct, or {error,Error} otherwise.

    - - - Return the child specification map for the given - child. - -

    Returns the child specification map for the child identified - by Id under supervisor SupRef. The returned - map contains all keys, both mandatory and optional.

    -

    See start_child/2 - for a description of SupRef.

    -
    -
    CALLBACK FUNCTIONS -

    The following functions must be exported from a +

    The following functions should be exported from a supervisor callback module.

    @@ -594,37 +524,33 @@ Return a supervisor specification. Args = term() - Result = {ok,{SupFlags,[ChildSpec]}} | ignore -  SupFlags = sup_flags() + Result = {ok,{{RestartStrategy,MaxR,MaxT},[ChildSpec]}} | ignore +  RestartStrategy = strategy() +  MaxR = integer()>=0 +  MaxT = integer()>0  ChildSpec = child_spec()

    Whenever a supervisor is started using supervisor:start_link/2,3, this function is called by the new process to find out about restart strategy, maximum - restart intensity, and child specifications.

    + restart frequency and child specifications.

    Args is the Args argument provided to the start function.

    -

    SupFlags is the supervisor flags defining the - restart strategy and max restart intensity for the - supervisor. [ChildSpec] is a list of valid child - specifications defining which child processes the supervisor - shall start and monitor. See the discussion about - Supervision Principles above.

    +

    RestartStrategy is the restart strategy and + MaxR and MaxT defines the maximum restart + frequency of the supervisor. [ChildSpec] is a list of + valid child specifications defining which child processes + the supervisor should start and monitor. See the discussion + about Supervision Principles above.

    Note that when the restart strategy is simple_one_for_one, the list of child specifications must be a list with one child specification only. - (The child specification identifier is ignored.) No child process is then started + (The Id is ignored). No child process is then started during the initialization phase, but all children are assumed to be started dynamically using supervisor:start_child/2.

    The function may also return ignore.

    -

    Note that this function might also be called as a part of a - code upgrade procedure. For this reason, the function should - not have any side effects. See - Design - Principles for more information about code upgrade - of supervisors.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/sys.xml erlang-17.3-dfsg/lib/stdlib/doc/src/sys.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/sys.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/sys.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -238,8 +237,8 @@

    These functions are intended only to help with debugging. They are provided for convenience, allowing developers to avoid having to create their own state extraction functions and also avoid having to interactively extract state from the return values of - get_status/1 or - get_status/2 while debugging.

    + get_status/1 or + get_status/2 while debugging.

    The value of State varies for different types of processes. For a gen_server process, the returned State @@ -360,17 +359,6 @@ installed.

    - - - - Terminate the process - -

    This function orders the process to terminate with the - given Reason. The termination is done - asynchronously, so there is no guarantee that the process is - actually terminated when the function returns.

    -
    -
    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/timer.xml erlang-17.3-dfsg/lib/stdlib/doc/src/timer.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/timer.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/timer.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -85,6 +84,7 @@ Send Messageto Pidafter a specified Time. +

    send_after/3 @@ -98,6 +98,7 @@

    Same as send_after(Time, self(), Message).

    +

    @@ -107,6 +108,7 @@ Send an exit signal with Reasonafter a specified Time. +

    exit_after/3 @@ -127,6 +129,7 @@

    Same as exit_after(Time, self(), kill).

    +

    @@ -143,6 +146,7 @@ Send Messagerepeatedly at intervals of Time. +

    send_interval/3 @@ -156,6 +160,7 @@

    Same as send_interval(Time, self(), Message).

    +

    @@ -186,6 +191,7 @@ Function, Arguments) or apply(Fun, Arguments) In microseconds +

    tc/3 @@ -206,18 +212,17 @@ +

    - Calculate time difference between timestamps + Calculate time difference between now/0timestamps In microseconds

    Calculates the time difference Tdiff = T2 - T1 in - microseconds, where T1 and T2 - are timestamp tuples on the same format as returned from - erlang:timestamp/0, - or os:timestamp/0.

    + microseconds, where T1 and T2 probably + are timestamp tuples returned from erlang:now/0.

    @@ -229,7 +234,7 @@ - Converts Minutes to Milliseconds. + Converts Minutesto Milliseconds.

    Return the number of milliseconds in Minutes.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/unicode_usage.xml erlang-17.3-dfsg/lib/stdlib/doc/src/unicode_usage.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/unicode_usage.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/unicode_usage.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -51,8 +50,12 @@ encoded files in several circumstances. Most notable is the support for UTF-8 in files read by file:consult/1, release handler support for UTF-8 and more support for Unicode character sets in the - I/O-system. In Erlang/OTP 17.0, the encoding default for Erlang source files was - switched to UTF-8.

    + I/O-system.

    + +

    In Erlang/OTP 17.0, the encoding default for Erlang source files was + switched to UTF-8 and in Erlang/OTP 18.0 Erlang will support atoms in the full + Unicode range, meaning full Unicode function and module + names

    This guide outlines the current Unicode support and gives a couple of recipes for working with Unicode data.

    @@ -286,8 +289,8 @@ The language Having the source code in UTF-8 also allows you to write string literals containing Unicode characters with code points > - 255, although atoms, module names and function names are - restricted to the ISO-Latin-1 range. Binary + 255, although atoms, module names and function names will be + restricted to the ISO-Latin-1 range until the Erlang/OTP 18.0 release. Binary literals where you use the /utf8 type, can also be expressed using Unicode characters > 255. Having module names using characters other than 7-bit ASCII can cause trouble on @@ -382,7 +385,8 @@ using characters from the ISO-latin-1 character set and atoms are restricted to the same ISO-latin-1 range. These restrictions in the language are of course independent of the encoding of the source - file.

    + file. Erlang/OTP 18.0 is expected to handle functions named in + Unicode as well as Unicode atoms.

    Bit-syntax

    The bit-syntax contains types for coping with binary data in the @@ -851,9 +855,8 @@ expected to be in Unicode.

    If Unicode file names are enabled, the calls to os:getenv/0, - os:getenv/1, - os:putenv/2 and - os:unsetenv/1 + os:getenv/1 and + os:putenv/2 will handle Unicode strings. On Unix-like platforms, the built-in functions will translate environment variables in UTF-8 to/from Unicode strings, possibly with code points > 255. On Windows the diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/unicode.xml erlang-17.3-dfsg/lib/stdlib/doc/src/unicode.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/unicode.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/unicode.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -133,7 +132,7 @@ latin1, or have characters encoded as one of the UTF-encodings, which is given as the InEncoding parameter. Only when the InEncoding is one of the UTF - encodings, integers in the list are allowed to be greater than + encodings, integers in the list are allowed to be grater than 255.

    If InEncoding is latin1, the Data parameter diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/win32reg.xml erlang-17.3-dfsg/lib/stdlib/doc/src/win32reg.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/win32reg.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/win32reg.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/stdlib/doc/src/zip.xml erlang-17.3-dfsg/lib/stdlib/doc/src/zip.xml --- erlang-18.2-dfsg/lib/stdlib/doc/src/zip.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/doc/src/zip.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -126,7 +125,7 @@ -

    The name of a zip file.

    +

    The name of a zip file.

    @@ -136,12 +135,6 @@

    These options are described in create/3.

    - - - -

    As returned by zip_open/2.

    -
    -
    @@ -437,8 +430,6 @@ means that subsequently reading files from the archive will be faster than unzipping files one at a time with unzip.

    The archive must be closed with zip_close/1.

    -

    The ZipHandle will be closed if the - process which originally opened the archive dies.

    diff -Nru erlang-18.2-dfsg/lib/stdlib/examples/erl_id_trans.erl erlang-17.3-dfsg/lib/stdlib/examples/erl_id_trans.erl --- erlang-18.2-dfsg/lib/stdlib/examples/erl_id_trans.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/examples/erl_id_trans.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/stdlib/examples/Makefile erlang-17.3-dfsg/lib/stdlib/examples/Makefile --- erlang-18.2-dfsg/lib/stdlib/examples/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/examples/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/stdlib/include/assert.hrl erlang-17.3-dfsg/lib/stdlib/include/assert.hrl --- erlang-18.2-dfsg/lib/stdlib/include/assert.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/include/assert.hrl 1970-01-01 00:00:00.000000000 +0000 @@ -1,261 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright (C) 2004-2014 Richard Carlsson, Mickaël Rémond -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - --ifndef(ASSERT_HRL). --define(ASSERT_HRL, true). - -%% Asserts are enabled unless NOASSERT is defined, and ASSERT can be used to -%% override it: if both ASSERT and NOASSERT are defined, then ASSERT takes -%% precedence, and NOASSERT will become undefined. -%% -%% Furthermore, if NODEBUG is defined, it implies NOASSERT, unless DEBUG or -%% ASSERT are defined. -%% -%% If asserts are disabled, all assert macros are defined to be the atom -%% 'ok'. If asserts are enabled, all assert macros are defined to yield 'ok' -%% as the result if the test succeeds, and raise an error exception if the -%% test fails. The error term will then have the form {Name, Info} where -%% Name is the name of the macro and Info is a list of tagged tuples. - -%% allow NODEBUG to imply NOASSERT, unless DEBUG --ifdef(NODEBUG). --ifndef(DEBUG). --ifndef(NOASSERT). --define(NOASSERT, true). --endif. --endif. --endif. - -%% allow ASSERT to override NOASSERT --ifdef(ASSERT). --undef(NOASSERT). --endif. - -%% Assert macros must not depend on any non-kernel or stdlib libraries. -%% -%% We must use fun-call wrappers ((fun () -> ... end)()) to avoid -%% exporting local variables, and furthermore we only use variable names -%% prefixed with "__", that hopefully will not be bound outside the fun. -%% It is not possible to nest assert macros. - --ifdef(NOASSERT). --define(assert(BoolExpr),ok). --else. -%% The assert macro is written the way it is so as not to cause warnings -%% for clauses that cannot match, even if the expression is a constant. --define(assert(BoolExpr), - begin - ((fun () -> - case (BoolExpr) of - true -> ok; - __V -> erlang:error({assert, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??BoolExpr)}, - {expected, true}, - case __V of false -> {value, __V}; - _ -> {not_boolean,__V} - end]}) - end - end)()) - end). --endif. - -%% This is the inverse case of assert, for convenience. --ifdef(NOASSERT). --define(assertNot(BoolExpr),ok). --else. --define(assertNot(BoolExpr), - begin - ((fun () -> - case (BoolExpr) of - false -> ok; - __V -> erlang:error({assert, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??BoolExpr)}, - {expected, false}, - case __V of true -> {value, __V}; - _ -> {not_boolean,__V} - end]}) - end - end)()) - end). --endif. - -%% This is mostly a convenience which gives more detailed reports. -%% Note: Guard is a guarded pattern, and can not be used for value. --ifdef(NOASSERT). --define(assertMatch(Guard, Expr), ok). --else. --define(assertMatch(Guard, Expr), - begin - ((fun () -> - case (Expr) of - Guard -> ok; - __V -> erlang:error({assertMatch, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {pattern, (??Guard)}, - {value, __V}]}) - end - end)()) - end). --endif. - -%% This is the inverse case of assertMatch, for convenience. --ifdef(NOASSERT). --define(assertNotMatch(Guard, Expr), ok). --else. --define(assertNotMatch(Guard, Expr), - begin - ((fun () -> - __V = (Expr), - case __V of - Guard -> erlang:error({assertNotMatch, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {pattern, (??Guard)}, - {value, __V}]}); - _ -> ok - end - end)()) - end). --endif. - -%% This is a convenience macro which gives more detailed reports when -%% the expected LHS value is not a pattern, but a computed value --ifdef(NOASSERT). --define(assertEqual(Expect, Expr), ok). --else. --define(assertEqual(Expect, Expr), - begin - ((fun (__X) -> - case (Expr) of - __X -> ok; - __V -> erlang:error({assertEqual, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {expected, __X}, - {value, __V}]}) - end - end)(Expect)) - end). --endif. - -%% This is the inverse case of assertEqual, for convenience. --ifdef(NOASSERT). --define(assertNotEqual(Unexpected, Expr), ok). --else. --define(assertNotEqual(Unexpected, Expr), - begin - ((fun (__X) -> - case (Expr) of - __X -> erlang:error({assertNotEqual, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {value, __X}]}); - _ -> ok - end - end)(Unexpected)) - end). --endif. - -%% Note: Class and Term are patterns, and can not be used for value. -%% Term can be a guarded pattern, but Class cannot. --ifdef(NOASSERT). --define(assertException(Class, Term, Expr), ok). --else. --define(assertException(Class, Term, Expr), - begin - ((fun () -> - try (Expr) of - __V -> erlang:error({assertException, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {pattern, - "{ "++(??Class)++" , "++(??Term) - ++" , [...] }"}, - {unexpected_success, __V}]}) - catch - Class:Term -> ok; - __C:__T -> - erlang:error({assertException, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {pattern, - "{ "++(??Class)++" , "++(??Term) - ++" , [...] }"}, - {unexpected_exception, - {__C, __T, - erlang:get_stacktrace()}}]}) - end - end)()) - end). --endif. - --define(assertError(Term, Expr), ?assertException(error, Term, Expr)). --define(assertExit(Term, Expr), ?assertException(exit, Term, Expr)). --define(assertThrow(Term, Expr), ?assertException(throw, Term, Expr)). - -%% This is the inverse case of assertException, for convenience. -%% Note: Class and Term are patterns, and can not be used for value. -%% Both Class and Term can be guarded patterns. --ifdef(NOASSERT). --define(assertNotException(Class, Term, Expr), ok). --else. --define(assertNotException(Class, Term, Expr), - begin - ((fun () -> - try (Expr) of - _ -> ok - catch - __C:__T -> - case __C of - Class -> - case __T of - Term -> - erlang:error({assertNotException, - [{module, ?MODULE}, - {line, ?LINE}, - {expression, (??Expr)}, - {pattern, - "{ "++(??Class)++" , " - ++(??Term)++" , [...] }"}, - {unexpected_exception, - {__C, __T, - erlang:get_stacktrace() - }}]}); - _ -> ok - end; - _ -> ok - end - end - end)()) - end). --endif. - --endif. % ASSERT_HRL diff -Nru erlang-18.2-dfsg/lib/stdlib/include/erl_bits.hrl erlang-17.3-dfsg/lib/stdlib/include/erl_bits.hrl --- erlang-18.2-dfsg/lib/stdlib/include/erl_bits.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/include/erl_bits.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/include/erl_compile.hrl erlang-17.3-dfsg/lib/stdlib/include/erl_compile.hrl --- erlang-18.2-dfsg/lib/stdlib/include/erl_compile.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/include/erl_compile.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/include/ms_transform.hrl erlang-17.3-dfsg/lib/stdlib/include/ms_transform.hrl --- erlang-18.2-dfsg/lib/stdlib/include/ms_transform.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/include/ms_transform.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/include/qlc.hrl erlang-17.3-dfsg/lib/stdlib/include/qlc.hrl --- erlang-18.2-dfsg/lib/stdlib/include/qlc.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/include/qlc.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/include/zip.hrl erlang-17.3-dfsg/lib/stdlib/include/zip.hrl --- erlang-18.2-dfsg/lib/stdlib/include/zip.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/include/zip.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/Makefile erlang-17.3-dfsg/lib/stdlib/Makefile --- erlang-18.2-dfsg/lib/stdlib/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/stdlib/src/array.erl erlang-17.3-dfsg/lib/stdlib/src/array.erl --- erlang-18.2-dfsg/lib/stdlib/src/array.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/array.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -165,7 +164,7 @@ elements :: elements(_) %% the tuple tree }). --type array() :: array(term()). +-opaque array() :: array(term()). -opaque array(Type) :: #array{default :: Type, elements :: elements(Type)}. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/base64.erl erlang-17.3-dfsg/lib/stdlib/src/base64.erl --- erlang-18.2-dfsg/lib/stdlib/src/base64.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/base64.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/beam_lib.erl erlang-17.3-dfsg/lib/stdlib/src/beam_lib.erl --- erlang-18.2-dfsg/lib/stdlib/src/beam_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/beam_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2015. All Rights Reserved. +%% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -308,17 +307,6 @@ <> = erlang:md5([First|reverse(String)]), {Type,[K1,K2,K3],IVec,8}. --spec build_module(Chunks) -> {'ok', Binary} when - Chunks :: [{chunkid(), dataB()}], - Binary :: binary(). - -build_module(Chunks0) -> - Chunks = list_to_binary(build_chunks(Chunks0)), - Size = byte_size(Chunks), - 0 = Size rem 4, % Assertion: correct padding? - {ok, <<"FOR1", (Size+4):32, "BEAM", Chunks/binary>>}. - - %% %% Local functions %% @@ -430,6 +418,12 @@ end end. +build_module(Chunks0) -> + Chunks = list_to_binary(build_chunks(Chunks0)), + Size = byte_size(Chunks), + 0 = Size rem 4, % Assertion: correct padding? + {ok, <<"FOR1", (Size+4):32, "BEAM", Chunks/binary>>}. + build_chunks([{Id, Data} | Chunks]) -> BId = list_to_binary(Id), Size = byte_size(Data), @@ -658,13 +652,7 @@ {'EXIT', _} -> error({invalid_chunk, File, chunk_name_to_id(Id, File)}); Term -> - try - {AtomTable, {Id, anno_from_term(Term)}} - catch - _:_ -> - error({invalid_chunk, File, - chunk_name_to_id(Id, File)}) - end + {AtomTable, {Id, Term}} end end; chunk_to_data(atoms=Id, _Chunk, _File, Cs, AtomTable0, _Mod) -> @@ -890,22 +878,7 @@ decrypt_abst_1({Type,Key,IVec,_BlockSize}, Bin) -> ok = start_crypto(), NewBin = crypto:block_decrypt(Type, Key, IVec, Bin), - Term = binary_to_term(NewBin), - anno_from_term(Term). - -anno_from_term({raw_abstract_v1, Forms}) -> - {raw_abstract_v1, anno_from_forms(Forms)}; -anno_from_term({Tag, Forms}) when Tag =:= abstract_v1; Tag =:= abstract_v2 -> - try {Tag, anno_from_forms(Forms)} - catch - _:_ -> - {Tag, Forms} - end; -anno_from_term(T) -> - T. - -anno_from_forms(Forms) -> - [erl_parse:anno_from_term(Form) || Form <- Forms]. + binary_to_term(NewBin). start_crypto() -> case crypto:start() of diff -Nru erlang-18.2-dfsg/lib/stdlib/src/binary.erl erlang-17.3-dfsg/lib/stdlib/src/binary.erl --- erlang-18.2-dfsg/lib/stdlib/src/binary.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/binary.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -90,9 +89,9 @@ decode_unsigned(_) -> erlang:nif_error(undef). --spec decode_unsigned(Subject, Endianness) -> Unsigned when +-spec decode_unsigned(Subject, Endianess) -> Unsigned when Subject :: binary(), - Endianness :: big | little, + Endianess :: big | little, Unsigned :: non_neg_integer(). decode_unsigned(_, _) -> @@ -104,9 +103,9 @@ encode_unsigned(_) -> erlang:nif_error(undef). --spec encode_unsigned(Unsigned, Endianness) -> binary() when +-spec encode_unsigned(Unsigned, Endianess) -> binary() when Unsigned :: non_neg_integer(), - Endianness :: big | little. + Endianess :: big | little. encode_unsigned(_, _) -> erlang:nif_error(undef). @@ -216,13 +215,12 @@ Subject :: binary(), Pattern :: binary() | [binary()] | cp(), Options :: [Option], - Option :: {scope, part()} | trim | global | trim_all, + Option :: {scope, part()} | trim | global, Parts :: [binary()]. split(Haystack,Needles,Options) -> try - {Part,Global,Trim,TrimAll} = - get_opts_split(Options,{no,false,false,false}), + {Part,Global,Trim} = get_opts_split(Options,{no,false,false}), Moptlist = case Part of no -> []; @@ -238,24 +236,20 @@ Match -> [Match] end end, - do_split(Haystack,MList,0,Trim,TrimAll) + do_split(Haystack,MList,0,Trim) catch _:_ -> erlang:error(badarg) end. -do_split(H,[],N,true,_) when N >= byte_size(H) -> - []; -do_split(H,[],N,_,true) when N >= byte_size(H) -> +do_split(H,[],N,true) when N >= byte_size(H) -> []; -do_split(H,[],N,_,_) -> +do_split(H,[],N,_) -> [binary:part(H,{N,byte_size(H)-N})]; -do_split(H,[{A,B}|T],N,Trim,TrimAll) -> +do_split(H,[{A,B}|T],N,Trim) -> case binary:part(H,{N,A-N}) of - <<>> when TrimAll == true -> - do_split(H,T,A+B,Trim,TrimAll); <<>> -> - Rest = do_split(H,T,A+B,Trim,TrimAll), + Rest = do_split(H,T,A+B,Trim), case {Trim, Rest} of {true,[]} -> []; @@ -263,7 +257,7 @@ [<<>> | Rest] end; Oth -> - [Oth | do_split(H,T,A+B,Trim,TrimAll)] + [Oth | do_split(H,T,A+B,Trim)] end. @@ -352,16 +346,14 @@ %% Simple helper functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -get_opts_split([],{Part,Global,Trim,TrimAll}) -> - {Part,Global,Trim,TrimAll}; -get_opts_split([{scope,{A,B}} | T],{_Part,Global,Trim,TrimAll}) -> - get_opts_split(T,{{A,B},Global,Trim,TrimAll}); -get_opts_split([global | T],{Part,_Global,Trim,TrimAll}) -> - get_opts_split(T,{Part,true,Trim,TrimAll}); -get_opts_split([trim | T],{Part,Global,_Trim,TrimAll}) -> - get_opts_split(T,{Part,Global,true,TrimAll}); -get_opts_split([trim_all | T],{Part,Global,Trim,_TrimAll}) -> - get_opts_split(T,{Part,Global,Trim,true}); +get_opts_split([],{Part,Global,Trim}) -> + {Part,Global,Trim}; +get_opts_split([{scope,{A,B}} | T],{_Part,Global,Trim}) -> + get_opts_split(T,{{A,B},Global,Trim}); +get_opts_split([global | T],{Part,_Global,Trim}) -> + get_opts_split(T,{Part,true,Trim}); +get_opts_split([trim | T],{Part,Global,_Trim}) -> + get_opts_split(T,{Part,Global,true}); get_opts_split(_,_) -> throw(badopt). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/calendar.erl erlang-17.3-dfsg/lib/stdlib/src/calendar.erl --- erlang-18.2-dfsg/lib/stdlib/src/calendar.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/calendar.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -300,7 +299,7 @@ %% now_to_universal_time(Now) %% now_to_datetime(Now) %% -%% Convert from erlang:timestamp() to UTC. +%% Convert from now() to UTC. %% %% Args: Now = now(); now() = {MegaSec, Sec, MilliSec}, MegaSec = Sec %% = MilliSec = integer() diff -Nru erlang-18.2-dfsg/lib/stdlib/src/c.erl erlang-17.3-dfsg/lib/stdlib/src/c.erl --- erlang-18.2-dfsg/lib/stdlib/src/c.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/c.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -28,7 +27,7 @@ lc_batch/0, lc_batch/1, i/3,pid/3,m/0,m/1, bt/1, q/0, - erlangrc/0,erlangrc/1,bi/1, flush/0, regs/0, uptime/0, + erlangrc/0,erlangrc/1,bi/1, flush/0, regs/0, nregs/0,pwd/0,ls/0,ls/1,cd/1,memory/1,memory/0, xm/1]). -export([display_info/1]). @@ -66,7 +65,6 @@ "q() -- quit - shorthand for init:stop()\n" "regs() -- information about registered processes\n" "nregs() -- information about all registered processes\n" - "uptime() -- print node uptime\n" "xm(M) -- cross reference check a module\n" "y(File) -- generate a Yecc parser\n">>). @@ -511,12 +509,9 @@ {exports,E} = lists:keyfind(exports, 1, L), Time = get_compile_time(L), COpts = get_compile_options(L), - format("Module: ~w~n", [M]), - print_md5(L), - format("Compiled: "), - print_time(Time), - print_object_file(M), + format("Module ~w compiled: ",[M]), print_time(Time), format("Compiler options: ~p~n", [COpts]), + print_object_file(M), format("Exports: ~n",[]), print_exports(keysort(1, E)). print_object_file(Mod) -> @@ -527,12 +522,6 @@ ignore end. -print_md5(L) -> - case lists:keyfind(md5, 1, L) of - {md5,<>} -> io:format("MD5: ~.16b~n",[MD5]); - _ -> ok - end. - get_compile_time(L) -> case get_compile_info(L, time) of {ok,Val} -> Val; @@ -580,8 +569,8 @@ split_print_exports([], []) -> ok. print_time({Year,Month,Day,Hour,Min,_Secs}) -> - format("~s ~w ~w, ", [month(Month),Day,Year]), - format("~.2.0w:~.2.0w~n", [Hour,Min]); + format("Date: ~s ~w ~w, ", [month(Month),Day,Year]), + format("Time: ~.2.0w.~.2.0w~n", [Hour,Min]); print_time(notime) -> format("No compile time info available~n",[]). @@ -776,26 +765,6 @@ memory(TypeSpec) -> erlang:memory(TypeSpec). %% -%% uptime/0 -%% - --spec uptime() -> 'ok'. - -uptime() -> - io:format("~s~n", [uptime(get_uptime())]). - -uptime({D, {H, M, S}}) -> - lists:flatten( - [[ io_lib:format("~p days, ", [D]) || D > 0 ], - [ io_lib:format("~p hours, ", [H]) || D+H > 0 ], - [ io_lib:format("~p minutes and ", [M]) || D+H+M > 0 ], - io_lib:format("~p seconds", [S])]). - -get_uptime() -> - {UpTime, _} = erlang:statistics(wall_clock), - calendar:seconds_to_daystime(UpTime div 1000). - -%% %% Cross Reference Check %% %%-spec xm(module() | file:filename()) -> xref:m/1 return diff -Nru erlang-18.2-dfsg/lib/stdlib/src/dets.erl erlang-17.3-dfsg/lib/stdlib/src/dets.erl --- erlang-18.2-dfsg/lib/stdlib/src/dets.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/dets.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -1964,7 +1963,7 @@ case Head#head.fixed of false -> link(Pid), - Fixed = {utime_now(), [{Pid, 1}]}, + Fixed = {erlang:now(), [{Pid, 1}]}, Ftab = dets_utils:get_freelists(Head), Head#head{fixed = Fixed, freelists = {Ftab, Ftab}}; {TimeStamp, Counters} -> @@ -2840,22 +2839,17 @@ tempfile(Fname) -> Tmp = lists:concat([Fname, ".TMP"]), - case file:delete(Tmp) of - {error, _Reason} -> % typically enoent - ok; - ok -> - assure_no_file(Tmp) - end, - Tmp. + tempfile(Tmp, 10). -assure_no_file(File) -> - case file:read_file_info(File) of - {ok, _FileInfo} -> - %% Wait for some other process to close the file: - timer:sleep(100), - assure_no_file(File); - {error, _} -> - ok +tempfile(Tmp, 0) -> + Tmp; +tempfile(Tmp, N) -> + case file:delete(Tmp) of + {error, eacces} -> % 'dets_process_died' happened anyway... (W-nd-ws) + timer:sleep(1000), + tempfile(Tmp, N-1); + _ -> + Tmp end. %% -> {ok, NewHead} | {try_again, integer()} | Error @@ -3089,14 +3083,14 @@ {Head1, Found, []}; Cache#cache.wrtime =:= undefined -> %% Empty cache. Schedule a delayed write. - Now = time_now(), Me = self(), + Now = now(), Me = self(), Call = ?DETS_CALL(Me, {delayed_write, Now}), erlang:send_after(Cache#cache.delay, Me, Call), {Head1#head{cache = NewCache#cache{wrtime = Now}}, Found, []}; Size0 =:= 0 -> %% Empty cache that has been written after the %% currently scheduled delayed write. - {Head1#head{cache = NewCache#cache{wrtime = time_now()}}, Found, []}; + {Head1#head{cache = NewCache#cache{wrtime = now()}}, Found, []}; true -> %% Cache is not empty, delayed write has been scheduled. {Head1, Found, []} @@ -3159,7 +3153,11 @@ Head#head{cache = NewCache}; true -> %% Yes, schedule a new delayed write. - When = round((LastWrTime - WrTime)/1000), Me = self(), + {MS1,S1,M1} = WrTime, + {MS2,S2,M2} = LastWrTime, + WrT = M1+1000000*(S1+1000000*MS1), + LastWrT = M2+1000000*(S2+1000000*MS2), + When = round((LastWrT - WrT)/1000), Me = self(), Call = ?DETS_CALL(Me, {delayed_write, LastWrTime}), erlang:send_after(When, Me, Call), Head @@ -3271,16 +3269,6 @@ Error end. --compile({inline, [time_now/0]}). -time_now() -> - erlang:monotonic_time(1000000). - --compile({inline, [utime_now/0]}). -utime_now() -> - Time = time_now(), - UniqueCounter = erlang:unique_integer([monotonic]), - {Time, UniqueCounter}. - %%%%%%%%%%%%%%%%% DEBUG functions %%%%%%%%%%%%%%%% file_info(FileName) -> diff -Nru erlang-18.2-dfsg/lib/stdlib/src/dets.hrl erlang-17.3-dfsg/lib/stdlib/src/dets.hrl --- erlang-18.2-dfsg/lib/stdlib/src/dets.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/dets.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/dets_server.erl erlang-17.3-dfsg/lib/stdlib/src/dets_server.erl --- erlang-18.2-dfsg/lib/stdlib/src/dets_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/dets_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2014. All Rights Reserved. +%% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -172,15 +171,9 @@ link(Pid), do_link(Store, FromPid), true = ets:insert(Store, {FromPid, Tab}), - %% do_internal_open() has already done the following: - %% true = ets:insert(?REGISTRY, {Tab, 1, Pid}), - %% true = ets:insert(?OWNERS, {Pid, Tab}), + true = ets:insert(?REGISTRY, {Tab, 1, Pid}), + true = ets:insert(?OWNERS, {Pid, Tab}), {ok, Tab}; - {Reply, internal_open} -> - %% Clean up what do_internal_open() did: - true = ets:delete(?REGISTRY, Tab), - true = ets:delete(?OWNERS, Pid), - Reply; {Reply, _} -> % ok or Error Reply end, @@ -316,12 +309,6 @@ [T, _, _] -> T; [_, _] -> Ref end, - %% Pretend the table is open. If someone else tries to - %% open the file it will always become a pending - %% 'add_user' request. If someone tries to use the table - %% there will be a delay, but that is OK. - true = ets:insert(?REGISTRY, {Tab, 1, Pid}), - true = ets:insert(?OWNERS, {Pid, Tab}), pending_call(Tab, Pid, Ref, From, Args, internal_open, State); Error -> {Error, State} diff -Nru erlang-18.2-dfsg/lib/stdlib/src/dets_sup.erl erlang-17.3-dfsg/lib/stdlib/src/dets_sup.erl --- erlang-18.2-dfsg/lib/stdlib/src/dets_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/dets_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/dets_utils.erl erlang-17.3-dfsg/lib/stdlib/src/dets_utils.erl --- erlang-18.2-dfsg/lib/stdlib/src/dets_utils.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/dets_utils.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -448,7 +447,7 @@ WrTime =:= undefined -> WrTime; true -> - erlang:monotonic_time(1000000) + now() end, PK = family(C#cache.cache), NewC = C#cache{cache = [], csize = 0, inserts = 0, wrtime = NewWrTime}, diff -Nru erlang-18.2-dfsg/lib/stdlib/src/dets_v8.erl erlang-17.3-dfsg/lib/stdlib/src/dets_v8.erl --- erlang-18.2-dfsg/lib/stdlib/src/dets_v8.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/dets_v8.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/dets_v9.erl erlang-17.3-dfsg/lib/stdlib/src/dets_v9.erl --- erlang-18.2-dfsg/lib/stdlib/src/dets_v9.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/dets_v9.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/dict.erl erlang-17.3-dfsg/lib/stdlib/src/dict.erl --- erlang-18.2-dfsg/lib/stdlib/src/dict.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/dict.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -71,7 +70,7 @@ }). --type dict() :: dict(_, _). +-opaque dict() :: dict(_, _). -opaque dict(Key, Value) :: #dict{segs :: segs(Key, Value)}. @@ -418,8 +417,6 @@ %% could have implemented map and filter using fold but these are %% faster. We hope! -fold_dict(F, Acc, #dict{size=0}) when is_function(F, 3) -> - Acc; fold_dict(F, Acc, D) -> Segs = D#dict.segs, fold_segs(F, Acc, Segs, tuple_size(Segs)). @@ -437,8 +434,6 @@ fold_bucket(F, F(Key, Val, Acc), Bkt); fold_bucket(F, Acc, []) when is_function(F, 3) -> Acc. -map_dict(F, #dict{size=0} = Dict) when is_function(F, 2) -> - Dict; map_dict(F, D) -> Segs0 = tuple_to_list(D#dict.segs), Segs1 = map_seg_list(F, Segs0), @@ -458,8 +453,6 @@ [?kv(Key,F(Key, Val))|map_bucket(F, Bkt)]; map_bucket(F, []) when is_function(F, 2) -> []. -filter_dict(F, #dict{size=0} = Dict) when is_function(F, 2) -> - Dict; filter_dict(F, D) -> Segs0 = tuple_to_list(D#dict.segs), {Segs1,Fc} = filter_seg_list(F, Segs0, [], 0), diff -Nru erlang-18.2-dfsg/lib/stdlib/src/digraph.erl erlang-17.3-dfsg/lib/stdlib/src/digraph.erl --- erlang-18.2-dfsg/lib/stdlib/src/digraph.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/digraph.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -37,7 +36,7 @@ -export([get_short_path/3, get_short_cycle/2]). --export_type([graph/0, d_type/0, vertex/0, edge/0, label/0]). +-export_type([graph/0, d_type/0, vertex/0, edge/0]). -record(digraph, {vtab = notable :: ets:tab(), etab = notable :: ets:tab(), diff -Nru erlang-18.2-dfsg/lib/stdlib/src/digraph_utils.erl erlang-17.3-dfsg/lib/stdlib/src/digraph_utils.erl --- erlang-18.2-dfsg/lib/stdlib/src/digraph_utils.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/digraph_utils.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/edlin.erl erlang-17.3-dfsg/lib/stdlib/src/edlin.erl --- erlang-18.2-dfsg/lib/stdlib/src/edlin.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/edlin.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -22,7 +21,7 @@ %% A simple Emacs-like line editor. %% About Latin-1 characters: see the beginning of erl_scan.erl. --export([init/0,init/1,start/1,start/2,edit_line/2,prefix_arg/1]). +-export([init/0,start/1,start/2,edit_line/2,prefix_arg/1]). -export([erase_line/1,erase_inp/1,redraw_line/1]). -export([length_before/1,length_after/1,prompt/1]). -export([current_line/1, current_chars/1]). @@ -45,20 +44,6 @@ init() -> put(kill_buffer, []). -init(Pid) -> - %% copy the kill_buffer from the process Pid - CopiedKillBuf = - case erlang:process_info(Pid, dictionary) of - {dictionary,Dict} -> - case proplists:get_value(kill_buffer, Dict) of - undefined -> []; - Buf -> Buf - end; - undefined -> - [] - end, - put(kill_buffer, CopiedKillBuf). - %% start(Prompt) %% edit(Characters, Continuation) %% Return @@ -227,8 +212,6 @@ key_map($\177, none) -> backward_delete_char; key_map($\177, meta) -> backward_kill_word; key_map($[, meta) -> meta_left_sq_bracket; -key_map($H, meta_left_sq_bracket) -> beginning_of_line; -key_map($F, meta_left_sq_bracket) -> end_of_line; key_map($D, meta_left_sq_bracket) -> backward_char; key_map($C, meta_left_sq_bracket) -> forward_char; % support a few + combinations... @@ -239,10 +222,8 @@ key_map($C, meta_csi) -> forward_word; key_map($D, meta_csi) -> backward_word; key_map($1, meta_left_sq_bracket) -> {csi, "1"}; -key_map($3, meta_left_sq_bracket) -> {csi, "3"}; key_map($5, meta_left_sq_bracket) -> {csi, "5"}; key_map($5, {csi, "1;"}) -> {csi, "1;5"}; -key_map($~, {csi, "3"}) -> forward_delete_char; key_map($C, {csi, "5"}) -> forward_word; key_map($C, {csi, "1;5"}) -> forward_word; key_map($D, {csi, "5"}) -> backward_word; @@ -409,7 +390,7 @@ do_op(end_of_line, Bef, [], Rs) -> {{Bef,[]},Rs}; do_op(ctlu, Bef, Aft, Rs) -> - put(kill_buffer, reverse(Bef)), + put(kill_buffer, Bef), {{[], Aft}, [{delete_chars, -length(Bef)} | Rs]}; do_op(beep, Bef, Aft, Rs) -> {{Bef,Aft},[beep|Rs]}; diff -Nru erlang-18.2-dfsg/lib/stdlib/src/edlin_expand.erl erlang-17.3-dfsg/lib/stdlib/src/edlin_expand.erl --- erlang-18.2-dfsg/lib/stdlib/src/edlin_expand.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/edlin_expand.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/epp.erl erlang-17.3-dfsg/lib/stdlib/src/epp.erl --- erlang-18.2-dfsg/lib/stdlib/src/epp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/epp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -159,7 +158,7 @@ {'ok', AbsForm} | {'eof', Line} | {error, ErrorInfo} when Epp :: epp_handle(), AbsForm :: erl_parse:abstract_form(), - Line :: erl_anno:line(), + Line :: erl_scan:line(), ErrorInfo :: erl_scan:error_info() | erl_parse:error_info(). parse_erl_form(Epp) -> @@ -221,7 +220,7 @@ IncludePath :: [DirectoryName :: file:name()], Form :: erl_parse:abstract_form() | {'error', ErrorInfo} | {'eof',Line}, PredefMacros :: macros(), - Line :: erl_anno:line(), + Line :: erl_scan:line(), ErrorInfo :: erl_scan:error_info() | erl_parse:error_info(), OpenError :: file:posix() | badarg | system_limit. @@ -236,7 +235,7 @@ {'default_encoding', DefEncoding :: source_encoding()} | 'extra'], Form :: erl_parse:abstract_form() | {'error', ErrorInfo} | {'eof',Line}, - Line :: erl_anno:line(), + Line :: erl_scan:line(), ErrorInfo :: erl_scan:error_info() | erl_parse:error_info(), Extra :: [{'encoding', source_encoding() | 'none'}], OpenError :: file:posix() | badarg | system_limit. @@ -258,7 +257,7 @@ -spec parse_file(Epp) -> [Form] when Epp :: epp_handle(), Form :: erl_parse:abstract_form() | {'error', ErrorInfo} | {'eof',Line}, - Line :: erl_anno:line(), + Line :: erl_scan:line(), ErrorInfo :: erl_scan:error_info() | erl_parse:error_info(). parse_file(Epp) -> @@ -281,7 +280,7 @@ {error,E} -> [{error,E}|parse_file(Epp)]; {eof,Location} -> - [{eof,erl_anno:new(Location)}] + [{eof,Location}] end. -spec default_encoding() -> source_encoding(). @@ -548,8 +547,7 @@ path=Path, macs=Ms1, default_encoding=DefEncoding}, From = wait_request(St), - Anno = erl_anno:new(AtLocation), - enter_file_reply(From, Name, Anno, AtLocation, code), + enter_file_reply(From, Name, AtLocation, AtLocation), wait_req_scan(St); {error,E} -> epp_reply(Pid, {error,E}) @@ -561,16 +559,15 @@ predef_macros(File) -> Machine = list_to_atom(erlang:system_info(machine)), - Anno = line1(), dict:from_list([ - {{atom,'FILE'}, {none,[{string,Anno,File}]}}, - {{atom,'LINE'}, {none,[{integer,Anno,1}]}}, + {{atom,'FILE'}, {none,[{string,1,File}]}}, + {{atom,'LINE'}, {none,[{integer,1,1}]}}, {{atom,'MODULE'}, undefined}, {{atom,'MODULE_STRING'}, undefined}, {{atom,'BASE_MODULE'}, undefined}, {{atom,'BASE_MODULE_STRING'}, undefined}, - {{atom,'MACHINE'}, {none,[{atom,Anno,Machine}]}}, - {{atom,Machine}, {none,[{atom,Anno,true}]}} + {{atom,'MACHINE'}, {none,[{atom,1,Machine}]}}, + {{atom,Machine}, {none,[{atom,1,true}]}} ]). %% user_predef(PreDefMacros, Macros) -> @@ -598,9 +595,8 @@ {ok,_Def} -> %% Predefined macros {error,{redefine_predef,M}}; error -> - A = line1(), user_predef(Pdm, - dict:store({atom,M}, [{none, {none,[{atom,A,true}]}}], Ms)) + dict:store({atom,M}, [{none, {none,[{atom,1,true}]}}], Ms)) end; user_predef([Md|_Pdm], _Ms) -> {error,{bad,Md}}; user_predef([], Ms) -> {ok,Ms}. @@ -649,7 +645,7 @@ enter_file(_NewName, Inc, From, St) when length(St#epp.sstk) >= 8 -> - epp_reply(From, {error,{loc(Inc),epp,{depth,"include"}}}), + epp_reply(From, {error,{abs_loc(Inc),epp,{depth,"include"}}}), wait_req_scan(St); enter_file(NewName, Inc, From, St) -> case file:path_open(St#epp.path, NewName, [read]) of @@ -657,7 +653,7 @@ Loc = start_loc(St#epp.location), wait_req_scan(enter_file2(NewF, Pname, From, St, Loc)); {error,_E} -> - epp_reply(From, {error,{loc(Inc),epp,{include,file,NewName}}}), + epp_reply(From, {error,{abs_loc(Inc),epp,{include,file,NewName}}}), wait_req_scan(St) end. @@ -665,9 +661,9 @@ %% Set epp to use this file and "enter" it. enter_file2(NewF, Pname, From, St0, AtLocation) -> - Anno = erl_anno:new(AtLocation), - enter_file_reply(From, Pname, Anno, AtLocation, code), - Ms = dict:store({atom,'FILE'}, {none,[{string,Anno,Pname}]}, St0#epp.macs), + Loc = start_loc(AtLocation), + enter_file_reply(From, Pname, Loc, AtLocation), + Ms = dict:store({atom,'FILE'}, {none,[{string,Loc,Pname}]}, St0#epp.macs), %% update the head of the include path to be the directory of the new %% source file, so that an included file can always include other files %% relative to its current location (this is also how C does it); note @@ -677,20 +673,16 @@ Path = [filename:dirname(Pname) | tl(St0#epp.path)], DefEncoding = St0#epp.default_encoding, _ = set_encoding(NewF, DefEncoding), - #epp{file=NewF,location=AtLocation,name=Pname,name2=Pname,delta=0, + #epp{file=NewF,location=Loc,name=Pname,name2=Pname,delta=0, sstk=[St0|St0#epp.sstk],path=Path,macs=Ms, default_encoding=DefEncoding}. -enter_file_reply(From, Name, LocationAnno, AtLocation, Where) -> - Anno0 = loc_anno(AtLocation), - Anno = case Where of - code -> Anno0; - generated -> erl_anno:set_generated(true, Anno0) - end, - Rep = {ok, [{'-',Anno},{atom,Anno,file},{'(',Anno}, - {string,Anno,file_name(Name)},{',',Anno}, - {integer,Anno,get_line(LocationAnno)},{')',LocationAnno}, - {dot,Anno}]}, +enter_file_reply(From, Name, Location, AtLocation) -> + Attr = loc_attr(AtLocation), + Rep = {ok, [{'-',Attr},{atom,Attr,file},{'(',Attr}, + {string,Attr,file_name(Name)},{',',Attr}, + {integer,Attr,get_line(Location)},{')',Location}, + {dot,Attr}]}, epp_reply(From, Rep). %% Flatten filename to a string. Must be a valid filename. @@ -718,20 +710,18 @@ #epp{location=OldLoc, delta=Delta, name=OldName, name2=OldName2} = OldSt, CurrLoc = add_line(OldLoc, Delta), - Anno = erl_anno:new(CurrLoc), Ms = dict:store({atom,'FILE'}, - {none,[{string,Anno,OldName2}]}, + {none,[{string,CurrLoc,OldName2}]}, St#epp.macs), NextSt = OldSt#epp{sstk=Sts,macs=Ms,uses=St#epp.uses}, - enter_file_reply(From, OldName, Anno, CurrLoc, code), + enter_file_reply(From, OldName, CurrLoc, CurrLoc), case OldName2 =:= OldName of true -> ok; false -> NFrom = wait_request(NextSt), - OldAnno = erl_anno:new(OldLoc), - enter_file_reply(NFrom, OldName2, OldAnno, - CurrLoc, generated) + enter_file_reply(NFrom, OldName2, OldLoc, + neg_line(CurrLoc)) end, wait_req_scan(NextSt); [] -> @@ -828,9 +818,9 @@ %% scan_define(Tokens, DefineToken, From, EppState) -scan_define([{'(',_Lp},{Type,_Lm,M}=Mac,{',',_}=Comma|Toks], _Def, From, St) +scan_define([{'(',_Lp},{Type,_Lm,M}=Mac,{',',Lc}|Toks], _Def, From, St) when Type =:= atom; Type =:= var -> - case catch macro_expansion(Toks, Comma) of + case catch macro_expansion(Toks, Lc) of Expansion when is_list(Expansion) -> case dict:find({atom,M}, St#epp.macs) of {ok, Defs} when is_list(Defs) -> @@ -920,12 +910,10 @@ []; macro_ref([{'?', _}, {'?', _} | Rest]) -> macro_ref(Rest); -macro_ref([{'?', _}, {atom, _, A}=Atom | Rest]) -> - Lm = loc(Atom), +macro_ref([{'?', _}, {atom, Lm, A} | Rest]) -> Arity = count_args(Rest, Lm, A), [{{atom, A}, Arity} | macro_ref(Rest)]; -macro_ref([{'?', _}, {var, _, A}=Var | Rest]) -> - Lm = loc(Var), +macro_ref([{'?', _}, {var, Lm, A} | Rest]) -> Arity = count_args(Rest, Lm, A), [{{atom, A}, Arity} | macro_ref(Rest)]; macro_ref([_Token | Rest]) -> @@ -952,7 +940,7 @@ NewName = expand_var(NewName0), enter_file(NewName, Inc, From, St); scan_include(_Toks, Inc, From, St) -> - epp_reply(From, {error,{loc(Inc),epp,{bad,include}}}), + epp_reply(From, {error,{abs_loc(Inc),epp,{bad,include}}}), wait_req_scan(St). %% scan_include_lib(Tokens, IncludeToken, From, EppState) @@ -967,7 +955,7 @@ scan_include_lib([{'(',_Llp},{string,_Lf,_NewName0},{')',_Lrp},{dot,_Ld}], Inc, From, St) when length(St#epp.sstk) >= 8 -> - epp_reply(From, {error,{loc(Inc),epp,{depth,"include_lib"}}}), + epp_reply(From, {error,{abs_loc(Inc),epp,{depth,"include_lib"}}}), wait_req_scan(St); scan_include_lib([{'(',_Llp},{string,_Lf,NewName0},{')',_Lrp},{dot,_Ld}], Inc, From, St) -> @@ -986,18 +974,18 @@ St, Loc)); {error,_E2} -> epp_reply(From, - {error,{loc(Inc),epp, + {error,{abs_loc(Inc),epp, {include,lib,NewName}}}), wait_req_scan(St) end; _Error -> - epp_reply(From, {error,{loc(Inc),epp, + epp_reply(From, {error,{abs_loc(Inc),epp, {include,lib,NewName}}}), wait_req_scan(St) end end; scan_include_lib(_Toks, Inc, From, St) -> - epp_reply(From, {error,{loc(Inc),epp,{bad,include_lib}}}), + epp_reply(From, {error,{abs_loc(Inc),epp,{bad,include_lib}}}), wait_req_scan(St). %% scan_ifdef(Tokens, IfdefToken, From, EppState) @@ -1100,12 +1088,11 @@ scan_file([{'(',_Llp},{string,_Ls,Name},{',',_Lc},{integer,_Li,Ln},{')',_Lrp}, {dot,_Ld}], Tf, From, St) -> - Anno = erl_anno:new(Ln), - enter_file_reply(From, Name, Anno, loc(Tf), generated), - Ms = dict:store({atom,'FILE'}, {none,[{string,line1(),Name}]}, St#epp.macs), + enter_file_reply(From, Name, Ln, neg_line(abs_loc(Tf))), + Ms = dict:store({atom,'FILE'}, {none,[{string,1,Name}]}, St#epp.macs), Locf = loc(Tf), NewLoc = new_location(Ln, St#epp.location, Locf), - Delta = get_line(element(2, Tf))-Ln + St#epp.delta, + Delta = abs(get_line(element(2, Tf)))-Ln + St#epp.delta, wait_req_scan(St#epp{name2=Name,location=NewLoc,delta=Delta,macs=Ms}); scan_file(_Toks, Tf, From, St) -> epp_reply(From, {error,{loc(Tf),epp,{bad,file}}}), @@ -1166,7 +1153,7 @@ skip_toks(From, St, Sis). %% macro_pars(Tokens, ArgStack) -%% macro_expansion(Tokens, Anno) +%% macro_expansion(Tokens, Line) %% Extract the macro parameters and the expansion from a macro definition. macro_pars([{')',_Lp}, {',',Ld}|Ex], Args) -> @@ -1178,12 +1165,11 @@ false = lists:member(Name, Args), macro_pars(Ts, [Name|Args]). -macro_expansion([{')',_Lp},{dot,_Ld}], _Anno0) -> []; -macro_expansion([{dot,_}=Dot], _Anno0) -> - throw({error,loc(Dot),missing_parenthesis}); -macro_expansion([T|Ts], _Anno0) -> - [T|macro_expansion(Ts, T)]; -macro_expansion([], Anno0) -> throw({error,loc(Anno0),premature_end}). +macro_expansion([{')',_Lp},{dot,_Ld}], _L0) -> []; +macro_expansion([{dot,Ld}], _L0) -> throw({error,Ld,missing_parenthesis}); +macro_expansion([T|Ts], _L0) -> + [T|macro_expansion(Ts, element(2, T))]; +macro_expansion([], L0) -> throw({error,L0,premature_end}). %% expand_macros(Tokens, Macros) %% expand_macro(Tokens, MacroToken, RestTokens) @@ -1253,17 +1239,17 @@ expand_macros(atom, MacT, M, Toks, Ms); %% Special macros expand_macros([{'?',_Lq},{var,Lm,'LINE'}=Tok|Toks], Ms) -> - Line = erl_scan:line(Tok), + {line,Line} = erl_scan:token_info(Tok, line), [{integer,Lm,Line}|expand_macros(Toks, Ms)]; expand_macros([{'?',_Lq},{var,_Lm,M}=MacT|Toks], Ms) -> expand_macros(atom, MacT, M, Toks, Ms); %% Illegal macros expand_macros([{'?',_Lq},Token|_Toks], _Ms) -> - T = case erl_scan:text(Token) of - Text when is_list(Text) -> + T = case erl_scan:token_info(Token, text) of + {text,Text} -> Text; undefined -> - Symbol = erl_scan:symbol(Token), + {symbol,Symbol} = erl_scan:token_info(Token, symbol), io_lib:write(Symbol) end, throw({error,loc(Token),{call,[$?|T]}}); @@ -1397,7 +1383,7 @@ %%% stringify(Ts, L) returns a list of one token: a string which when %%% tokenized would yield the token list Ts. -%% erl_scan:text(T) is not backward compatible with this. +%% erl_scan:token_info(T, text) is not backward compatible with this. %% Note that escaped characters will be replaced by themselves. token_src({dot, _}) -> "."; @@ -1470,29 +1456,36 @@ filename:join(Components). %% The line only. (Other tokens may have the column and text as well...) -loc_anno(Line) when is_integer(Line) -> - erl_anno:new(Line); -loc_anno({Line,_Column}) -> - erl_anno:new(Line). +loc_attr(Line) when is_integer(Line) -> + Line; +loc_attr({Line,_Column}) -> + Line. loc(Token) -> - erl_scan:location(Token). + {location,Location} = erl_scan:token_info(Token, location), + Location. + +abs_loc(Token) -> + loc(setelement(2, Token, abs_line(element(2, Token)))). + +neg_line(L) -> + erl_scan:set_attribute(line, L, fun(Line) -> -abs(Line) end). -add_line(Line, Offset) when is_integer(Line) -> - Line+Offset; -add_line({Line, Column}, Offset) -> - {Line+Offset, Column}. +abs_line(L) -> + erl_scan:set_attribute(line, L, fun(Line) -> abs(Line) end). + +add_line(L, Offset) -> + erl_scan:set_attribute(line, L, fun(Line) -> Line+Offset end). start_loc(Line) when is_integer(Line) -> 1; start_loc({_Line, _Column}) -> - {1, 1}. - -line1() -> - erl_anno:new(1). + {1,1}. -get_line(Anno) -> - erl_anno:line(Anno). +get_line(Line) when is_integer(Line) -> + Line; +get_line({Line,_Column}) -> + Line. %% epp has always output -file attributes when entering and leaving %% included files (-include, -include_lib). Starting with R11B the @@ -1532,15 +1525,14 @@ interpret_file_attribute(Forms) -> interpret_file_attr(Forms, 0, []). -interpret_file_attr([{attribute,Anno,file,{File,Line}}=Form | Forms], +interpret_file_attr([{attribute,Loc,file,{File,Line}}=Form | Forms], Delta, Fs) -> - L = get_line(Anno), - Generated = erl_anno:generated(Anno), + {line, L} = erl_scan:attributes_info(Loc, line), if - Generated -> + L < 0 -> %% -file attribute - interpret_file_attr(Forms, (L + Delta) - Line, Fs); - not Generated -> + interpret_file_attr(Forms, (abs(L) + Delta) - Line, Fs); + true -> %% -include or -include_lib % true = L =:= Line, case Fs of @@ -1551,11 +1543,11 @@ end end; interpret_file_attr([Form0 | Forms], Delta, Fs) -> - F = fun(Anno) -> - Line = erl_anno:line(Anno), - erl_anno:set_line(Line + Delta, Anno) + F = fun(Attrs) -> + F2 = fun(L) -> abs(L) + Delta end, + erl_scan:set_attribute(line, Attrs, F2) end, - Form = erl_parse:map_anno(F, Form0), + Form = erl_lint:modify_line(Form0, F), [Form | interpret_file_attr(Forms, Delta, Fs)]; interpret_file_attr([], _Delta, _Fs) -> []. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_anno.erl erlang-17.3-dfsg/lib/stdlib/src/erl_anno.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_anno.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_anno.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,459 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - --module(erl_anno). - --export([new/1, is_anno/1]). --export([column/1, end_location/1, file/1, generated/1, - line/1, location/1, record/1, text/1]). --export([set_file/2, set_generated/2, set_line/2, set_location/2, - set_record/2, set_text/2]). - -%% To be used when necessary to avoid Dialyzer warnings. --export([to_term/1, from_term/1]). - --export_type([anno/0, line/0, column/0, location/0, text/0]). - --export_type([anno_term/0]). - --define(LN(L), is_integer(L)). --define(COL(C), (is_integer(C) andalso C >= 1)). - -%% Location. --define(LCOLUMN(C), ?COL(C)). --define(LLINE(L), ?LN(L)). - -%% Debug: define DEBUG to make sure that annotations are handled as an -%% opaque type. Note that all abstract code need to be compiled with -%% DEBUG=true. See also ./erl_pp.erl. - -%-define(DEBUG, true). - --type annotation() :: {'file', filename()} - | {'generated', generated()} - | {'location', location()} - | {'record', record()} - | {'text', string()}. - --type anno() :: location() | [annotation(), ...]. --type anno_term() :: term(). - --type column() :: pos_integer(). --type generated() :: boolean(). --type filename() :: file:filename_all(). --type line() :: integer(). --type location() :: line() | {line(), column()}. --type record() :: boolean(). --type text() :: string(). - --ifdef(DEBUG). -%% Anything 'false' accepted by the compiler. --define(ALINE(A), is_reference(A)). --define(ACOLUMN(A), is_reference(A)). --else. --define(ALINE(L), ?LN(L)). --define(ACOLUMN(C), ?COL(C)). --endif. - --spec to_term(Anno) -> anno_term() when - Anno :: anno(). - --ifdef(DEBUG). -to_term(Anno) -> - simplify(Anno). --else. -to_term(Anno) -> - Anno. --endif. - --spec from_term(Term) -> Anno when - Term :: anno_term(), - Anno :: anno(). - --ifdef(DEBUG). -from_term(Term) when is_list(Term) -> - Term; -from_term(Term) -> - [{location, Term}]. --else. -from_term(Term) -> - Term. --endif. - --spec new(Location) -> anno() when - Location :: location(). - -new(Line) when ?LLINE(Line) -> - new_location(Line); -new({Line, Column}=Loc) when ?LLINE(Line), ?LCOLUMN(Column) -> - new_location(Loc); -new(Term) -> - erlang:error(badarg, [Term]). - --ifdef(DEBUG). -new_location(Location) -> - [{location, Location}]. --else. -new_location(Location) -> - Location. --endif. - --spec is_anno(Term) -> boolean() when - Term :: any(). - -is_anno(Line) when ?ALINE(Line) -> - true; -is_anno({Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column) -> - true; -is_anno(Anno) -> - (Anno =/= [] andalso - is_anno1(Anno) andalso - lists:keymember(location, 1, Anno)). - -is_anno1([{Item, Value}|Anno]) -> - is_anno2(Item, Value) andalso is_anno1(Anno); -is_anno1(A) -> - A =:= []. - -is_anno2(location, Line) when ?LN(Line) -> - true; -is_anno2(location, {Line, Column}) when ?LN(Line), ?COL(Column) -> - true; -is_anno2(generated, true) -> - true; -is_anno2(file, Filename) -> - is_filename(Filename); -is_anno2(record, true) -> - true; -is_anno2(text, Text) -> - is_string(Text); -is_anno2(_, _) -> - false. - -is_filename(T) -> - is_list(T) orelse is_binary(T). - -is_string(T) -> - is_list(T). - --spec column(Anno) -> column() | 'undefined' when - Anno :: anno(). - -column({Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column) -> - Column; -column(Line) when ?ALINE(Line) -> - undefined; -column(Anno) -> - case location(Anno) of - {_Line, Column} -> - Column; - _Line -> - undefined - end. - --spec end_location(Anno) -> location() | 'undefined' when - Anno :: anno(). - -end_location(Anno) -> - case text(Anno) of - undefined -> - undefined; - Text -> - case location(Anno) of - {Line, Column} -> - end_location(Text, Line, Column); - Line -> - end_location(Text, Line) - end - end. - --spec file(Anno) -> filename() | 'undefined' when - Anno :: anno(). - -file(Line) when ?ALINE(Line) -> - undefined; -file({Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column) -> - undefined; -file(Anno) -> - anno_info(Anno, file). - --spec generated(Anno) -> generated() when - Anno :: anno(). - -generated(Line) when ?ALINE(Line) -> - Line =< 0; -generated({Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column) -> - Line =< 0; -generated(Anno) -> - _ = anno_info(Anno, generated, false), - {location, Location} = lists:keyfind(location, 1, Anno), - case Location of - {Line, _Column} -> - Line =< 0; - Line -> - Line =< 0 - end. - --spec line(Anno) -> line() when - Anno :: anno(). - -line(Anno) -> - case location(Anno) of - {Line, _Column} -> - Line; - Line -> - Line - end. - --spec location(Anno) -> location() when - Anno :: anno(). - -location(Line) when ?ALINE(Line) -> - abs(Line); -location({Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column) -> - {abs(Line), Column}; -location(Anno) -> - case anno_info(Anno, location) of - Line when Line < 0 -> - -Line; - {Line, Column} when Line < 0 -> - {-Line, Column}; - Location -> - Location - end. - --spec record(Anno) -> record() when - Anno :: anno(). - -record(Line) when ?ALINE(Line) -> - false; -record({Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column) -> - false; -record(Anno) -> - anno_info(Anno, record, false). - --spec text(Anno) -> text() | 'undefined' when - Anno :: anno(). - -text(Line) when ?ALINE(Line) -> - undefined; -text({Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column) -> - undefined; -text(Anno) -> - anno_info(Anno, text). - --spec set_file(File, Anno) -> Anno when - File :: filename(), - Anno :: anno(). - -set_file(File, Anno) -> - set(file, File, Anno). - --spec set_generated(Generated, Anno) -> Anno when - Generated :: generated(), - Anno :: anno(). - -set_generated(true, Line) when ?ALINE(Line) -> - -abs(Line); -set_generated(false, Line) when ?ALINE(Line) -> - abs(Line); -set_generated(true, {Line, Column}) when ?ALINE(Line), - ?ACOLUMN(Column) -> - {-abs(Line),Column}; -set_generated(false, {Line, Column}) when ?ALINE(Line), - ?ACOLUMN(Column) -> - {abs(Line),Column}; -set_generated(Generated, Anno) -> - _ = set(generated, Generated, Anno), - {location, Location} = lists:keyfind(location, 1, Anno), - NewLocation = - case Location of - {Line, Column} when Generated -> - {-abs(Line), Column}; - {Line, Column} when not Generated -> - {abs(Line), Column}; - Line when Generated -> - -abs(Line); - Line when not Generated -> - abs(Line) - end, - lists:keyreplace(location, 1, Anno, {location, NewLocation}). - --spec set_line(Line, Anno) -> Anno when - Line :: line(), - Anno :: anno(). - -set_line(Line, Anno) -> - case location(Anno) of - {_Line, Column} -> - set_location({Line, Column}, Anno); - _Line -> - set_location(Line, Anno) - end. - --spec set_location(Location, Anno) -> Anno when - Location :: location(), - Anno :: anno(). - -set_location(Line, L) when ?ALINE(L), ?LLINE(Line) -> - new_location(fix_line(Line, L)); -set_location(Line, {L, Column}) when ?ALINE(L), ?ACOLUMN(Column), - ?LLINE(Line) -> - new_location(fix_line(Line, L)); -set_location({L, C}=Loc, Line) when ?ALINE(Line), ?LLINE(L), ?LCOLUMN(C) -> - new_location(fix_location(Loc, Line)); -set_location({L, C}=Loc, {Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column), - ?LLINE(L), ?LCOLUMN(C) -> - new_location(fix_location(Loc, Line)); -set_location(Location, Anno) -> - _ = set(location, Location, Anno), - {location, OldLocation} = lists:keyfind(location, 1, Anno), - NewLocation = - case {Location, OldLocation} of - {{_Line, _Column}=Loc, {L, _C}} -> - fix_location(Loc, L); - {Line, {L, _C}} -> - fix_line(Line, L); - {{_Line, _Column}=Loc, L} -> - fix_location(Loc, L); - {Line, L} -> - fix_line(Line, L) - end, - lists:keyreplace(location, 1, Anno, {location, NewLocation}). - -fix_location({Line, Column}, OldLine) -> - {fix_line(Line, OldLine), Column}. - -fix_line(Line, OldLine) when OldLine < 0, Line > 0 -> - -Line; -fix_line(Line, _OldLine) -> - Line. - --spec set_record(Record, Anno) -> Anno when - Record :: record(), - Anno :: anno(). - -set_record(Record, Anno) -> - set(record, Record, Anno). - --spec set_text(Text, Anno) -> Anno when - Text :: text(), - Anno :: anno(). - -set_text(Text, Anno) -> - set(text, Text, Anno). - -set(Item, Value, Anno) -> - case {is_settable(Item, Value), Anno} of - {true, Line} when ?ALINE(Line) -> - set_anno(Item, Value, [{location, Line}]); - {true, {L, C}=Location} when ?ALINE(L), ?ACOLUMN(C) -> - set_anno(Item, Value, [{location, Location}]); - {true, A} when is_list(A), A =/= [] -> - set_anno(Item, Value, Anno); - _ -> - erlang:error(badarg, [Item, Value, Anno]) - end. - -set_anno(Item, Value, Anno) -> - case default(Item, Value) of - true -> - reset(Anno, Item); - false -> - R = case anno_info(Anno, Item) of - undefined -> - [{Item, Value}|Anno]; - _ -> - lists:keyreplace(Item, 1, Anno, {Item, Value}) - end, - simplify(R) - end. - -reset(Anno, Item) -> - A = lists:keydelete(Item, 1, Anno), - reset_simplify(A). - --ifdef(DEBUG). -reset_simplify(A) -> - A. --else. -reset_simplify(A) -> - simplify(A). --endif. - -simplify([{location, Location}]) -> - Location; -simplify(Anno) -> - Anno. - -anno_info(Anno, Item, Default) -> - try lists:keyfind(Item, 1, Anno) of - false -> - Default; - {Item, Value} -> - Value - catch - _:_ -> - erlang:error(badarg, [Anno]) - end. - -anno_info(Anno, Item) -> - try lists:keyfind(Item, 1, Anno) of - {Item, Value} -> - Value; - false -> - undefined - catch - _:_ -> - erlang:error(badarg, [Anno]) - end. - -end_location("", Line, Column) -> - {Line, Column}; -end_location([$\n|String], Line, _Column) -> - end_location(String, Line+1, 1); -end_location([_|String], Line, Column) -> - end_location(String, Line, Column+1). - -end_location("", Line) -> - Line; -end_location([$\n|String], Line) -> - end_location(String, Line+1); -end_location([_|String], Line) -> - end_location(String, Line). - -is_settable(file, File) -> - is_filename(File); -is_settable(generated, Boolean) when Boolean; not Boolean -> - true; -is_settable(location, Line) when ?LLINE(Line) -> - true; -is_settable(location, {Line, Column}) when ?LLINE(Line), ?LCOLUMN(Column) -> - true; -is_settable(record, Boolean) when Boolean; not Boolean -> - true; -is_settable(text, Text) -> - is_string(Text); -is_settable(_, _) -> - false. - -default(generated, false) -> true; -default(record, false) -> true; -default(_, _) -> false. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_bits.erl erlang-17.3-dfsg/lib/stdlib/src/erl_bits.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_bits.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_bits.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_compile.erl erlang-17.3-dfsg/lib/stdlib/src/erl_compile.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_compile.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_compile.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_eval.erl erlang-17.3-dfsg/lib/stdlib/src/erl_eval.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_eval.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_eval.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -247,14 +246,18 @@ %% map expr({map,_,Binding,Es}, Bs0, Lf, Ef, RBs) -> {value, Map0, Bs1} = expr(Binding, Bs0, Lf, Ef, none), - {Vs,Bs2} = eval_map_fields(Es, Bs0, Lf, Ef), - _ = maps:put(k, v, Map0), %Validate map. - Map1 = lists:foldl(fun ({map_assoc,K,V}, Mi) -> - maps:put(K, V, Mi); - ({map_exact,K,V}, Mi) -> - maps:update(K, V, Mi) - end, Map0, Vs), - ret_expr(Map1, merge_bindings(Bs2, Bs1), RBs); + case Map0 of + #{} -> + {Vs,Bs2} = eval_map_fields(Es, Bs0, Lf, Ef), + Map1 = lists:foldl(fun ({map_assoc,K,V}, Mi) -> + maps:put(K, V, Mi); + ({map_exact,K,V}, Mi) -> + maps:update(K, V, Mi) + end, Map0, Vs), + ret_expr(Map1, merge_bindings(Bs2, Bs1), RBs); + _ -> + erlang:raise(error, {badarg,Map0}, stacktrace()) + end; expr({map,_,Es}, Bs0, Lf, Ef, RBs) -> {Vs,Bs} = eval_map_fields(Es, Bs0, Lf, Ef), ret_expr(lists:foldl(fun @@ -480,13 +483,12 @@ find_maxline(LC) -> put('$erl_eval_max_line', 0), - F = fun(A) -> - L = erl_anno:line(A), + F = fun(L) -> case is_integer(L) and (L > get('$erl_eval_max_line')) of true -> put('$erl_eval_max_line', L); false -> ok end end, - _ = erl_parse:map_anno(F, LC), + _ = erl_lint:modify_line(LC, F), erase('$erl_eval_max_line'). hide_calls(LC, MaxLine) -> @@ -496,16 +498,14 @@ %% v/1 and local calls are hidden. hide({value,L,V}, Id, D) -> - A = erl_anno:new(Id), - {{atom,A,ok}, Id+1, dict:store(Id, {value,L,V}, D)}; + {{atom,Id,ok}, Id+1, dict:store(Id, {value,L,V}, D)}; hide({call,L,{atom,_,N}=Atom,Args}, Id0, D0) -> {NArgs, Id, D} = hide(Args, Id0, D0), C = case erl_internal:bif(N, length(Args)) of true -> {call,L,Atom,NArgs}; false -> - A = erl_anno:new(Id), - {call,A,{remote,L,{atom,L,m},{atom,L,f}},NArgs} + {call,Id,{remote,L,{atom,L,m},{atom,L,f}},NArgs} end, {C, Id+1, dict:store(Id, {call,Atom}, D)}; hide(T0, Id0, D0) when is_tuple(T0) -> @@ -518,23 +518,11 @@ hide(E, Id, D) -> {E, Id, D}. -unhide_calls({atom,A,ok}=E, MaxLine, D) -> - L = erl_anno:line(A), - if - L > MaxLine -> - dict:fetch(L, D); - true -> - E - end; -unhide_calls({call,A,{remote,L,{atom,L,m},{atom,L,f}}=F,Args}, MaxLine, D) -> - Line = erl_anno:line(A), - if - Line > MaxLine -> - {call,Atom} = dict:fetch(Line, D), - {call,L,Atom,unhide_calls(Args, MaxLine, D)}; - true -> - {call,A,F,unhide_calls(Args, MaxLine, D)} - end; +unhide_calls({atom,Id,ok}, MaxLine, D) when Id > MaxLine -> + dict:fetch(Id, D); +unhide_calls({call,Id,{remote,L,_M,_F},Args}, MaxLine, D) when Id > MaxLine -> + {call,Atom} = dict:fetch(Id, D), + {call,L,Atom,unhide_calls(Args, MaxLine, D)}; unhide_calls(T, MaxLine, D) when is_tuple(T) -> list_to_tuple(unhide_calls(tuple_to_list(T), MaxLine, D)); unhide_calls([E | Es], MaxLine, D) -> @@ -1184,7 +1172,7 @@ match_map([{map_field_exact, _, K, V}|Fs], Map, Bs0, BBs) -> Vm = try - {value, Ke, _} = expr(K, Bs0), + {value, Ke, _} = expr(K, new_bindings()), maps:get(Ke,Map) catch error:_ -> throw(nomatch) diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_expand_records.erl erlang-17.3-dfsg/lib/stdlib/src/erl_expand_records.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_expand_records.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_expand_records.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2015. All Rights Reserved. +%% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -39,6 +38,8 @@ checked_ra=[] % successfully accessed records }). +-define(REC_OFFSET, 100000000). % A hundred millions. Also in v3_core. + -spec(module(AbsForms, CompileOptions) -> AbsForms when AbsForms :: [erl_parse:abstract_form()], CompileOptions :: [compile:option()]). @@ -148,7 +149,7 @@ pattern({record,Line0,Name,Pfs}, St0) -> Fs = record_fields(Name, St0), {TMs,St1} = pattern_list(pattern_fields(Fs, Pfs), St0), - Line = mark_record(Line0, St1), + Line = record_offset(Line0, St1), {{tuple,Line,[{atom,Line0,Name} | TMs]},St1}; pattern({bin,Line,Es0}, St0) -> {Es1,St1} = pattern_bin(Es0, St0), @@ -242,7 +243,7 @@ expr({atom,Line,false}, St); false -> Fs = record_fields(Name, St), - NLine = no_compiler_warning(Line), + NLine = neg_line(Line), expr({call,NLine,{remote,NLine,{atom,NLine,erlang},{atom,NLine,is_record}}, [Term,{atom,Line,Name},{integer,Line,length(Fs)+1}]}, St) @@ -268,7 +269,7 @@ %% evaluate to a tuple properly. Fs = record_fields(Name, St0), {Var,St} = new_var(Line, St0), - NLine = no_compiler_warning(Line), + NLine = neg_line(Line), expr({block,Line, [{match,Line,Var,Expr}, {call,NLine,{remote,NLine,{atom,NLine,erlang}, @@ -332,7 +333,7 @@ I = index_expr(Line, F, Name, record_fields(Name, St)), expr(I, St); expr({record,Line0,Name,Is}, St) -> - Line = mark_record(Line0, St), + Line = record_offset(Line0, St), expr({tuple,Line,[{atom,Line0,Name} | record_inits(record_fields(Name, St), Is)]}, St); @@ -383,11 +384,21 @@ expr({call,Line,{atom,_La,N}=Atom,As0}, St0) -> {As,St1} = expr_list(As0, St0), Ar = length(As), - case {N,Ar} =:= {record_info,2} andalso not imported(N, Ar, St1) of - true -> - record_info_call(Line, As, St1); - false -> - {{call,Line,Atom,As},St1} + case erl_internal:bif(N, Ar) of + true -> + {{call,Line,Atom,As},St1}; + false -> + case imported(N, Ar, St1) of + {yes,_Mod} -> + {{call,Line,Atom,As},St1}; + no -> + case {N,Ar} of + {record_info,2} -> + record_info_call(Line, As, St1); + _ -> + {{call,Line,Atom,As},St1} + end + end end; expr({call,Line,{remote,Lr,M,F},As0}, St0) -> {[M1,F1 | As1],St1} = expr_list([M,F | As0], St0), @@ -458,7 +469,7 @@ conj([], _E) -> empty; conj([{{Name,_Rp},L,R,Sz} | AL], E) -> - NL = no_compiler_warning(L), + NL = neg_line(L), T1 = {op,NL,'orelse', {call,NL, {remote,NL,{atom,NL,erlang},{atom,NL,is_record}}, @@ -574,8 +585,8 @@ Fs = record_fields(Name, St), I = index_expr(F, Fs, 2), P = record_pattern(2, I, Var, length(Fs)+1, Line, [{atom,Line,Name}]), - NLine = no_compiler_warning(Line), - RLine = mark_record(NLine, St), + NLine = neg_line(Line), + RLine = record_offset(NLine, St), E = {'case',NLine,R, [{clause,NLine,[{tuple,RLine,P}],[],[Var]}, {clause,NLine,[{var,NLine,'_'}],[], @@ -589,8 +600,7 @@ I = index_expr(Line, Index, Name, Fs), {ExpR,St1} = expr(R, St0), %% Just to make comparison simple: - A0 = erl_anno:new(0), - ExpRp = erl_parse:map_anno(fun(_A) -> A0 end, ExpR), + ExpRp = erl_lint:modify_line(ExpR, fun(_L) -> 0 end), RA = {{Name,ExpRp},Line,ExpR,length(Fs)+1}, St2 = St1#exprec{strict_ra = [RA | St1#exprec.strict_ra]}, {{call,Line, @@ -691,11 +701,10 @@ record_match(R, Name, Lr, Fs, Us, St0) -> {Ps,News,St1} = record_upd_fs(Fs, Us, St0), - NLr = no_compiler_warning(Lr), - RLine = mark_record(Lr, St1), + NLr = neg_line(Lr), {{'case',Lr,R, - [{clause,Lr,[{tuple,RLine,[{atom,Lr,Name} | Ps]}],[], - [{tuple,RLine,[{atom,Lr,Name} | News]}]}, + [{clause,Lr,[{tuple,Lr,[{atom,Lr,Name} | Ps]}],[], + [{tuple,Lr,[{atom,Lr,Name} | News]}]}, {clause,NLr,[{var,NLr,'_'}],[], [call_error(NLr, {tuple,NLr,[{atom,NLr,badrecord},{atom,NLr,Name}]})]} ]}, @@ -723,11 +732,7 @@ Us = [T || {_,T} <- Us2], Lr = element(2, hd(Us)), Wildcards = duplicate(length(Fs), {var,Lr,'_'}), - NLr = no_compiler_warning(Lr), - %% Note: calling mark_record() here is not necessary since it is - %% targeted at Dialyzer which always calls the compiler with - %% 'strict_record_updates' meaning that record_setel() will never - %% be called. + NLr = neg_line(Lr), {'case',Lr,R, [{clause,Lr,[{tuple,Lr,[{atom,Lr,Name} | Wildcards]}],[], [foldr(fun ({I,Lf,Val}, Acc) -> @@ -822,7 +827,10 @@ add_imports(_, [], Is) -> Is. imported(F, A, St) -> - orddict:is_key({F,A}, St#exprec.imports). + case orddict:find({F,A}, St#exprec.imports) of + {ok,Mod} -> {yes,Mod}; + error -> no + end. %%% %%% Replace is_record/3 in guards with matching if possible. @@ -956,11 +964,12 @@ end; opt_remove_2(A, _) -> A. -no_compiler_warning(Anno) -> - erl_anno:set_generated(true, Anno). +neg_line(L) -> + erl_parse:set_line(L, fun(Line) -> -abs(Line) end). -mark_record(Anno, St) -> +record_offset(L, St) -> case lists:member(dialyzer, St#exprec.compile) of - true -> erl_anno:set_record(true, Anno); - false -> Anno + true when L >= 0 -> L+?REC_OFFSET; + true when L < 0 -> L-?REC_OFFSET; + false -> L end. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_internal.erl erlang-17.3-dfsg/lib/stdlib/src/erl_internal.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_internal.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_internal.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2014. All Rights Reserved. +%% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -52,8 +51,6 @@ type_test/2,new_type_test/2,old_type_test/2,old_bif/2]). -export([arith_op/2,bool_op/2,comp_op/2,list_op/2,send_op/2,op_type/2]). --export([is_type/2]). - %%--------------------------------------------------------------------------- %% Erlang builtin functions allowed in guards. @@ -296,7 +293,6 @@ bif(garbage_collect, 2) -> true; bif(get, 0) -> true; bif(get, 1) -> true; -bif(get_keys, 0) -> true; bif(get_keys, 1) -> true; bif(group_leader, 0) -> true; bif(group_leader, 2) -> true; @@ -534,53 +530,3 @@ old_bif(unregister, 1) -> true; old_bif(whereis, 1) -> true; old_bif(Name, A) when is_atom(Name), is_integer(A) -> false. - --spec is_type(Name, NumberOfTypeVariables) -> boolean() when - Name :: atom(), - NumberOfTypeVariables :: non_neg_integer(). -%% Returns true if Name/NumberOfTypeVariables is a predefined type. - -is_type(any, 0) -> true; -is_type(arity, 0) -> true; -is_type(atom, 0) -> true; -is_type(binary, 0) -> true; -is_type(bitstring, 0) -> true; -is_type(bool, 0) -> true; -is_type(boolean, 0) -> true; -is_type(byte, 0) -> true; -is_type(char, 0) -> true; -is_type(float, 0) -> true; -is_type(function, 0) -> true; -is_type(identifier, 0) -> true; -is_type(integer, 0) -> true; -is_type(iodata, 0) -> true; -is_type(iolist, 0) -> true; -is_type(list, 0) -> true; -is_type(list, 1) -> true; -is_type(map, 0) -> true; -is_type(maybe_improper_list, 0) -> true; -is_type(maybe_improper_list, 2) -> true; -is_type(mfa, 0) -> true; -is_type(module, 0) -> true; -is_type(neg_integer, 0) -> true; -is_type(nil, 0) -> true; -is_type(no_return, 0) -> true; -is_type(node, 0) -> true; -is_type(non_neg_integer, 0) -> true; -is_type(none, 0) -> true; -is_type(nonempty_improper_list, 2) -> true; -is_type(nonempty_list, 0) -> true; -is_type(nonempty_list, 1) -> true; -is_type(nonempty_maybe_improper_list, 0) -> true; -is_type(nonempty_maybe_improper_list, 2) -> true; -is_type(nonempty_string, 0) -> true; -is_type(number, 0) -> true; -is_type(pid, 0) -> true; -is_type(port, 0) -> true; -is_type(pos_integer, 0) -> true; -is_type(reference, 0) -> true; -is_type(string, 0) -> true; -is_type(term, 0) -> true; -is_type(timeout, 0) -> true; -is_type(tuple, 0) -> true; -is_type(_, _) -> false. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_lint.erl erlang-17.3-dfsg/lib/stdlib/src/erl_lint.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_lint.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_lint.erl 2014-09-16 19:10:57.000000000 +0000 @@ -2,19 +2,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -35,8 +34,6 @@ -import(lists, [member/2,map/2,foldl/3,foldr/3,mapfoldl/3,all/2,reverse/1]). --deprecated([{modify_line, 2, next_major_release}]). - %% bool_option(OnOpt, OffOpt, Default, Options) -> boolean(). %% value_option(Flag, Default, Options) -> Value. %% value_option(Flag, Default, OnOpt, OnVal, OffOpt, OffVal, Options) -> @@ -79,7 +76,7 @@ %%-define(DEBUGF(X,Y), io:format(X, Y)). -define(DEBUGF(X,Y), void). --type line() :: erl_anno:line(). % a convenient alias +-type line() :: erl_scan:line(). % a convenient alias -type fa() :: {atom(), arity()}. % function+arity -type ta() :: {atom(), arity()}. % type+arity @@ -114,28 +111,25 @@ defined=gb_sets:empty() %Defined fuctions :: gb_sets:set(fa()), on_load=[] :: [fa()], %On-load function - on_load_line=erl_anno:new(0) %Line for on_load - :: erl_anno:anno(), + on_load_line=0 :: line(), %Line for on_load clashes=[], %Exported functions named as BIFs not_deprecated=[], %Not considered deprecated func=[], %Current function warn_format=0, %Warn format calls enabled_warnings=[], %All enabled warnings (ordset). - nowarn_bif_clash=[], %All no warn bif clashes (ordset). errors=[], %Current errors warnings=[], %Current warnings file = "" :: string(), %From last file attribute recdef_top=false :: boolean(), %true in record initialisation %outside any fun or lc xqlc= false :: boolean(), %true if qlc.hrl included + new = false :: boolean(), %Has user-defined 'new/N' called= [] :: [{fa(),line()}], %Called functions usage = #usage{} :: #usage{}, specs = dict:new() %Type specifications :: dict:dict(mfa(), line()), callbacks = dict:new() %Callback types :: dict:dict(mfa(), line()), - optional_callbacks = dict:new() %Optional callbacks - :: dict:dict(mfa(), line()), types = dict:new() %Type definitions :: dict:dict(ta(), #typeinfo{}), exp_types=gb_sets:empty() %Exported types @@ -144,7 +138,7 @@ -type lint_state() :: #lint{}. -type error_description() :: term(). --type error_info() :: {erl_anno:line(), module(), error_description()}. +-type error_info() :: {erl_scan:line(), module(), error_description()}. %% format_error(Error) %% Return a string describing the error. @@ -231,8 +225,6 @@ [format_mfa(MFA), Rel, format_mfa(ReplacementMFA)]); format_error({deprecated, {M1, F1, A1}, String}) when is_list(String) -> io_lib:format("~p:~p/~p: ~s", [M1, F1, A1, String]); -format_error({deprecated_type, {M1, F1, A1}, String}) when is_list(String) -> - io_lib:format("~p:~p~s: ~s", [M1, F1, gen_type_paren(A1), String]); format_error({removed, MFA, ReplacementMFA, Rel}) -> io_lib:format("call to ~s will fail, since it was removed in ~s; " "use ~s", [format_mfa(MFA), Rel, format_mfa(ReplacementMFA)]); @@ -245,7 +237,10 @@ "maximum allowed is ~w", [Arity,?MAX_ARGUMENTS]); %% --- patterns and guards --- format_error(illegal_pattern) -> "illegal pattern"; -format_error(illegal_map_key) -> "illegal map key in pattern"; +format_error(illegal_map_key) -> + "illegal map key"; +format_error({illegal_map_key_variable,K}) -> + io_lib:format("illegal use of variable ~w in map",[K]); format_error(illegal_bin_pattern) -> "binary patterns cannot be matched in parallel using '='"; format_error(illegal_expr) -> "illegal expression"; @@ -293,9 +288,6 @@ %% --- binaries --- format_error({undefined_bittype,Type}) -> io_lib:format("bit type ~w undefined", [Type]); -format_error({bittype_mismatch,Val1,Val2,What}) -> - io_lib:format("conflict in ~s specification for bit field: '~p' and '~p'", - [What,Val1,Val2]); format_error(bittype_unit) -> "a bit unit size must not be specified unless a size is specified too"; format_error(illegal_bitsize) -> @@ -321,20 +313,13 @@ io_lib:format("behaviour ~w undefined", [Behaviour]); format_error({undefined_behaviour_callbacks,Behaviour}) -> io_lib:format("behaviour ~w callback functions are undefined", - [Behaviour]); + [Behaviour]); format_error({ill_defined_behaviour_callbacks,Behaviour}) -> io_lib:format("behaviour ~w callback functions erroneously defined", [Behaviour]); -format_error({ill_defined_optional_callbacks,Behaviour}) -> - io_lib:format("behaviour ~w optional callback functions erroneously defined", - [Behaviour]); format_error({behaviour_info, {_M,F,A}}) -> io_lib:format("cannot define callback attibute for ~w/~w when " "behaviour_info is defined",[F,A]); -format_error({redefine_optional_callback, {F, A}}) -> - io_lib:format("optional callback ~w/~w duplicated", [F, A]); -format_error({undefined_callback, {_M, F, A}}) -> - io_lib:format("callback ~w/~w is undefined", [F, A]); %% --- types and specs --- format_error({singleton_typevar, Name}) -> io_lib:format("type variable ~w is only used once (is unbound)", [Name]); @@ -346,10 +331,14 @@ io_lib:format("type ~w~s undefined", [TypeName, gen_type_paren(Arity)]); format_error({unused_type, {TypeName, Arity}}) -> io_lib:format("type ~w~s is unused", [TypeName, gen_type_paren(Arity)]); -format_error({new_builtin_type, {TypeName, Arity}}) -> - io_lib:format("type ~w~s is a new builtin type; " +%% format_error({new_builtin_type, {TypeName, Arity}}) -> +%% io_lib:format("type ~w~s is a new builtin type; " +%% "its (re)definition is allowed only until the next release", +%% [TypeName, gen_type_paren(Arity)]); +format_error({new_var_arity_type, TypeName}) -> + io_lib:format("type ~w is a new builtin type; " "its (re)definition is allowed only until the next release", - [TypeName, gen_type_paren(Arity)]); + [TypeName]); format_error({builtin_type, {TypeName, Arity}}) -> io_lib:format("type ~w~s is a builtin type; it cannot be redefined", [TypeName, gen_type_paren(Arity)]); @@ -363,14 +352,10 @@ io_lib:format("bad ~w type", [Constr]); format_error({redefine_spec, {M, F, A}}) -> io_lib:format("spec for ~w:~w/~w already defined", [M, F, A]); -format_error({redefine_spec, {F, A}}) -> - io_lib:format("spec for ~w/~w already defined", [F, A]); -format_error({redefine_callback, {F, A}}) -> - io_lib:format("callback ~w/~w already defined", [F, A]); -format_error({bad_callback, {M, F, A}}) -> - io_lib:format("explicit module not allowed for callback ~w:~w/~w ", [M, F, A]); -format_error({spec_fun_undefined, {F, A}}) -> - io_lib:format("spec for undefined function ~w/~w", [F, A]); +format_error({redefine_callback, {M, F, A}}) -> + io_lib:format("callback ~w:~w/~w already defined", [M, F, A]); +format_error({spec_fun_undefined, {M, F, A}}) -> + io_lib:format("spec for undefined function ~w:~w/~w", [M, F, A]); format_error({missing_spec, {F,A}}) -> io_lib:format("missing specification for function ~w/~w", [F, A]); format_error(spec_wrong_arity) -> @@ -398,7 +383,9 @@ [TypeName, gen_type_paren(Arity)]); %% --- obsolete? unused? --- format_error({format_error, {Fmt, Args}}) -> - io_lib:format(Fmt, Args). + io_lib:format(Fmt, Args); +format_error({mnemosyne, What}) -> + "mnemosyne " ++ What ++ ", missing transformation". gen_type_paren(Arity) when is_integer(Arity), Arity >= 0 -> gen_type_paren_1(Arity, ")"). @@ -434,13 +421,13 @@ exprs_opt(Exprs, BindingsList, Opts) -> {St0,Vs} = foldl(fun({{record,_SequenceNumber,_Name},Attr0}, {St1,Vs1}) -> - Attr = set_file(Attr0, "none"), + Attr = zip_file_and_line(Attr0, "none"), {attribute_state(Attr, St1),Vs1}; ({V,_}, {St1,Vs1}) -> {St1,[{V,{bound,unused,[]}} | Vs1]} end, {start("nofile",Opts),[]}, BindingsList), Vt = orddict:from_list(Vs), - {_Evt,St} = exprs(set_file(Exprs, "nofile"), Vt, St0), + {_Evt,St} = exprs(zip_file_and_line(Exprs, "nofile"), Vt, St0), return_status(St). used_vars(Exprs, BindingsList) -> @@ -448,7 +435,7 @@ ({V,_Val}, Vs0) -> [{V,{bound,unused,[]}} | Vs0] end, [], BindingsList), Vt = orddict:from_list(Vs), - {Evt,_St} = exprs(set_file(Exprs, "nofile"), Vt, start()), + {Evt,_St} = exprs(zip_file_and_line(Exprs, "nofile"), Vt, start()), {ok, foldl(fun({V,{_,used,_}}, L) -> [V | L]; (_, L) -> L end, [], Evt)}. @@ -573,7 +560,6 @@ warn_format = value_option(warn_format, 1, warn_format, 1, nowarn_format, 0, Opts), enabled_warnings = Enabled, - nowarn_bif_clash = nowarn_function(nowarn_bif_clash, Opts), file = File }. @@ -613,39 +599,34 @@ %% add_warning(ErrorDescriptor, State) -> State' %% add_warning(Line, Error, State) -> State' -add_error(E, St) -> add_lint_error(E, St#lint.file, St). +add_error(E, St) -> St#lint{errors=[{St#lint.file,E}|St#lint.errors]}. -add_error(Anno, E, St) -> - {File,Location} = loc(Anno, St), - add_lint_error({Location,erl_lint,E}, File, St). +add_error(FileLine, E, St) -> + {File,Location} = loc(FileLine), + add_error({Location,erl_lint,E}, St#lint{file = File}). -add_lint_error(E, File, St) -> - St#lint{errors=[{File,E}|St#lint.errors]}. - -add_warning(W, St) -> add_lint_warning(W, St#lint.file, St). +add_warning(W, St) -> St#lint{warnings=[{St#lint.file,W}|St#lint.warnings]}. add_warning(FileLine, W, St) -> - {File,Location} = loc(FileLine, St), - add_lint_warning({Location,erl_lint,W}, File, St). - -add_lint_warning(W, File, St) -> - St#lint{warnings=[{File,W}|St#lint.warnings]}. + {File,Location} = loc(FileLine), + add_warning({Location,erl_lint,W}, St#lint{file = File}). -loc(Anno, St) -> - Location = erl_anno:location(Anno), - case erl_anno:file(Anno) of - undefined -> {St#lint.file,Location}; - File -> {File,Location} +loc(L) -> + case erl_parse:get_attribute(L, location) of + {location,{{File,Line},Column}} -> + {File,{Line,Column}}; + {location,{File,Line}} -> + {File,Line} end. %% forms([Form], State) -> State' forms(Forms0, St0) -> Forms = eval_file_attribute(Forms0, St0), - %% Annotations from now on include the 'file' item. Locals = local_functions(Forms), AutoImportSuppressed = auto_import_suppressed(St0#lint.compile), StDeprecated = disallowed_compile_flags(Forms,St0), + %% Line numbers are from now on pairs {File,Line}. St1 = includes_qlc_hrl(Forms, StDeprecated#lint{locals = Locals, no_auto = AutoImportSuppressed}), St2 = bif_clashes(Forms, St1), @@ -653,6 +634,8 @@ St4 = foldl(fun form/2, pre_scan(Forms, St3), Forms), post_traversal_check(Forms, St4). +pre_scan([{function,_L,new,_A,_Cs} | Fs], St) -> + pre_scan(Fs, St#lint{new=true}); pre_scan([{attribute,L,compile,C} | Fs], St) -> case is_warn_enabled(export_all, St) andalso member(export_all, lists:flatten([C])) of @@ -679,24 +662,15 @@ eval_file_attr([{attribute,_L,file,{File,_Line}}=Form | Forms], _File) -> [Form | eval_file_attr(Forms, File)]; eval_file_attr([Form0 | Forms], File) -> - Form = set_form_file(Form0, File), + Form = zip_file_and_line(Form0, File), [Form | eval_file_attr(Forms, File)]; eval_file_attr([], _File) -> []. -%% Sets the file only on the form. This is used on post-traversal. -%% For the remaining of the AST we rely on #lint.file. - -set_form_file({attribute,L,K,V}, File) -> - {attribute,erl_anno:set_file(File, L),K,V}; -set_form_file({function,L,N,A,C}, File) -> - {function,erl_anno:set_file(File, L),N,A,C}; -set_form_file(Form, _File) -> - Form. - -set_file(T, File) -> - F = fun(Anno) -> erl_anno:set_file(File, Anno) end, - erl_parse:map_anno(F, T). +zip_file_and_line(T, File) -> + F0 = fun(Line) -> {File,Line} end, + F = fun(L) -> erl_parse:set_line(L, F0) end, + modify_line(T, F). %% form(Form, State) -> State' %% Check a form returning the updated State. Handle generic cases here. @@ -753,8 +727,6 @@ spec_decl(L, Fun, Types, St); attribute_state({attribute,L,callback,{Fun,Types}}, St) -> callback_decl(L, Fun, Types, St); -attribute_state({attribute,L,optional_callbacks,Es}, St) -> - optional_callbacks(L, Es, St); attribute_state({attribute,L,on_load,Val}, St) -> on_load(L, Val, St); attribute_state({attribute,_L,_Other,_Val}, St) -> % Ignore others @@ -766,8 +738,6 @@ %% State' %% Allow for record, type and opaque type definitions and spec %% declarations to be intersperced within function definitions. -%% Dialyzer attributes are also allowed everywhere, but are not -%% checked at all. function_state({attribute,L,record,{Name,Fields}}, St) -> record_def(L, Name, Fields, St); @@ -777,12 +747,12 @@ type_def(opaque, L, TypeName, TypeDef, Args, St); function_state({attribute,L,spec,{Fun,Types}}, St) -> spec_decl(L, Fun, Types, St); -function_state({attribute,_L,dialyzer,_Val}, St) -> - St; function_state({attribute,La,Attr,_Val}, St) -> add_error(La, {attribute,Attr}, St); function_state({function,L,N,A,Cs}, St) -> function(L, N, A, Cs, St); +function_state({rule,L,_N,_A,_Cs}, St) -> + add_error(L, {mnemosyne,"rule"}, St); function_state({eof,L}, St) -> eof(L, St). %% eof(LastLine, State) -> @@ -793,7 +763,8 @@ %% bif_clashes(Forms, State0) -> State. -bif_clashes(Forms, #lint{nowarn_bif_clash=Nowarn} = St) -> +bif_clashes(Forms, St) -> + Nowarn = nowarn_function(nowarn_bif_clash, St#lint.compile), Clashes0 = [{Name,Arity} || {function,_L,Name,Arity,_Cs} <- Forms, erl_internal:bif(Name, Arity)], Clashes = ordsets:subtract(ordsets:from_list(Clashes0), Nowarn), @@ -817,11 +788,9 @@ disallowed_compile_flags(Forms, St0) -> %% There are (still) no line numbers in St0#lint.compile. Errors0 = [ {St0#lint.file,{L,erl_lint,disallowed_nowarn_bif_clash}} || - {attribute,A,compile,nowarn_bif_clash} <- Forms, - {_,L} <- [loc(A, St0)] ], + {attribute,[{line,{_,L}}],compile,nowarn_bif_clash} <- Forms ], Errors1 = [ {St0#lint.file,{L,erl_lint,disallowed_nowarn_bif_clash}} || - {attribute,A,compile,{nowarn_bif_clash, {_,_}}} <- Forms, - {_,L} <- [loc(A, St0)] ], + {attribute,[{line,{_,L}}],compile,{nowarn_bif_clash, {_,_}}} <- Forms ], Disabled = (not is_warn_enabled(bif_clash, St0)), Errors = if Disabled andalso Errors0 =:= [] -> @@ -865,73 +834,57 @@ %% Check behaviours for existence and defined functions. behaviour_check(Bs, St0) -> - {AllBfs0, St1} = all_behaviour_callbacks(Bs, [], St0), - St = behaviour_missing_callbacks(AllBfs0, St1), - Exports = exports(St0), - F = fun(Bfs, OBfs) -> - [B || B <- Bfs, - not lists:member(B, OBfs) - orelse gb_sets:is_member(B, Exports)] - end, - %% After fixing missing callbacks new warnings may be emitted. - AllBfs = [{Item,F(Bfs0, OBfs0)} || {Item,Bfs0,OBfs0} <- AllBfs0], + {AllBfs,St1} = all_behaviour_callbacks(Bs, [], St0), + St = behaviour_missing_callbacks(AllBfs, St1), behaviour_conflicting(AllBfs, St). all_behaviour_callbacks([{Line,B}|Bs], Acc, St0) -> - {Bfs0,OBfs0,St} = behaviour_callbacks(Line, B, St0), - all_behaviour_callbacks(Bs, [{{Line,B},Bfs0,OBfs0}|Acc], St); + {Bfs0,St} = behaviour_callbacks(Line, B, St0), + all_behaviour_callbacks(Bs, [{{Line,B},Bfs0}|Acc], St); all_behaviour_callbacks([], Acc, St) -> {reverse(Acc),St}. behaviour_callbacks(Line, B, St0) -> try B:behaviour_info(callbacks) of - undefined -> - St1 = add_warning(Line, {undefined_behaviour_callbacks, B}, St0), - {[], [], St1}; - Funcs -> - case is_fa_list(Funcs) of + Funcs when is_list(Funcs) -> + All = all(fun({FuncName, Arity}) -> + is_atom(FuncName) andalso is_integer(Arity); + ({FuncName, Arity, Spec}) -> + is_atom(FuncName) andalso is_integer(Arity) + andalso is_list(Spec); + (_Other) -> + false + end, + Funcs), + MaybeRemoveSpec = fun({_F,_A}=FA) -> FA; + ({F,A,_S}) -> {F,A}; + (Other) -> Other + end, + if + All =:= true -> + {[MaybeRemoveSpec(F) || F <- Funcs], St0}; true -> - try B:behaviour_info(optional_callbacks) of - undefined -> - {Funcs, [], St0}; - OptFuncs -> - %% OptFuncs should always be OK thanks to - %% sys_pre_expand. - case is_fa_list(OptFuncs) of - true -> - {Funcs, OptFuncs, St0}; - false -> - W = {ill_defined_optional_callbacks, B}, - St1 = add_warning(Line, W, St0), - {Funcs, [], St1} - end - catch - _:_ -> - {Funcs, [], St0} - end; - false -> St1 = add_warning(Line, - {ill_defined_behaviour_callbacks, B}, + {ill_defined_behaviour_callbacks,B}, St0), - {[], [], St1} - end + {[], St1} + end; + undefined -> + St1 = add_warning(Line, {undefined_behaviour_callbacks,B}, St0), + {[], St1}; + _Other -> + St1 = add_warning(Line, {ill_defined_behaviour_callbacks,B}, St0), + {[], St1} catch _:_ -> - St1 = add_warning(Line, {undefined_behaviour, B}, St0), - {[], [], St1} + St1 = add_warning(Line, {undefined_behaviour,B}, St0), + {[], St1} end. -behaviour_missing_callbacks([{{Line,B},Bfs0,OBfs}|T], St0) -> - Bfs = ordsets:subtract(ordsets:from_list(Bfs0), ordsets:from_list(OBfs)), +behaviour_missing_callbacks([{{Line,B},Bfs}|T], St0) -> Exports = gb_sets:to_list(exports(St0)), - Missing = ordsets:subtract(Bfs, Exports), + Missing = ordsets:subtract(ordsets:from_list(Bfs), Exports), St = foldl(fun (F, S0) -> - case is_fa(F) of - true -> - M = {undefined_behaviour_func,F,B}, - add_warning(Line, M, S0); - false -> - S0 % ill_defined_behaviour_callbacks - end + add_warning(Line, {undefined_behaviour_func,F,B}, S0) end, St0, Missing), behaviour_missing_callbacks(T, St); behaviour_missing_callbacks([], St) -> St. @@ -946,7 +899,7 @@ behaviour_add_conflicts(R, St). behaviour_add_conflicts([{Cb,[{FirstLoc,FirstB}|Cs]}|T], St0) -> - FirstL = element(2, loc(FirstLoc, St0)), + FirstL = element(2, loc(FirstLoc)), St = behaviour_add_conflict(Cs, Cb, FirstL, FirstB, St0), behaviour_add_conflicts(T, St); behaviour_add_conflicts([], St) -> St. @@ -1093,9 +1046,10 @@ Used = Usage#usage.used_types, UTAs = dict:fetch_keys(Used), Undef = [{TA,dict:fetch(TA, Used)} || - TA <- UTAs, + {T,_}=TA <- UTAs, not dict:is_key(TA, Def), - not is_default_type(TA)], + not is_default_type(TA), + not is_newly_introduced_var_arity_type(T)], foldl(fun ({TA,L}, St) -> add_error(L, {undefined_type,TA}, St) end, St0, Undef). @@ -1164,7 +1118,7 @@ end, St0#lint.records, UsedRecords), Unused = [{Name,FileLine} || {Name,{FileLine,_Fields}} <- dict:to_list(URecs), - element(1, loc(FileLine, St0)) =:= FirstFile], + element(1, loc(FileLine)) =:= FirstFile], foldl(fun ({N,L}, St) -> add_warning(L, {unused_record, N}, St) end, St0, Unused); @@ -1173,29 +1127,19 @@ end. check_callback_information(#lint{callbacks = Callbacks, - optional_callbacks = OptionalCbs, - defined = Defined} = St0) -> - OptFun = fun({MFA, Line}, St) -> - case dict:is_key(MFA, Callbacks) of - true -> - St; - false -> - add_error(Line, {undefined_callback, MFA}, St) - end - end, - St1 = lists:foldl(OptFun, St0, dict:to_list(OptionalCbs)), - case gb_sets:is_member({behaviour_info, 1}, Defined) of - false -> St1; + defined = Defined} = State) -> + case gb_sets:is_member({behaviour_info,1}, Defined) of + false -> State; true -> case dict:size(Callbacks) of - 0 -> St1; + 0 -> State; _ -> CallbacksList = dict:to_list(Callbacks), FoldL = - fun({Fa, Line}, St) -> + fun({Fa,Line},St) -> add_error(Line, {behaviour_info, Fa}, St) end, - lists:foldl(FoldL, St1, CallbacksList) + lists:foldl(FoldL, State, CallbacksList) end end. @@ -1322,7 +1266,7 @@ error -> no end. --spec on_load(erl_anno:anno(), fa(), lint_state()) -> lint_state(). +-spec on_load(line(), fa(), lint_state()) -> lint_state(). %% Check an on_load directive and remember it. on_load(Line, {Name,Arity}=Fa, #lint{on_load=OnLoad0}=St0) @@ -1357,15 +1301,14 @@ -spec call_function(line(), atom(), arity(), lint_state()) -> lint_state(). %% Add to both called and calls. -call_function(Line, F, A, #lint{usage=Usage0,called=Cd,func=Func,file=File}=St) -> +call_function(Line, F, A, #lint{usage=Usage0,called=Cd,func=Func}=St) -> #usage{calls = Cs} = Usage0, NA = {F,A}, Usage = case Cs of undefined -> Usage0; _ -> Usage0#usage{calls=dict:append(Func, NA, Cs)} end, - Anno = erl_anno:set_file(File, Line), - St#lint{called=[{NA,Anno}|Cd], usage=Usage}. + St#lint{called=[{NA,Line}|Cd], usage=Usage}. %% function(Line, Name, Arity, Clauses, State) -> State. @@ -1461,7 +1404,20 @@ pattern({tuple,_Line,Ps}, Vt, Old, Bvt, St) -> pattern_list(Ps, Vt, Old, Bvt, St); pattern({map,_Line,Ps}, Vt, Old, Bvt, St) -> - pattern_map(Ps, Vt, Old, Bvt, St); + foldl(fun + ({map_field_assoc,L,_,_}, {Psvt,Bvt0,St0}) -> + {Psvt,Bvt0,add_error(L, illegal_pattern, St0)}; + ({map_field_exact,L,KP,VP}, {Psvt,Bvt0,St0}) -> + case is_valid_map_key(KP, pattern, St0) of + true -> + {Pvt,Bvt1,St1} = pattern(VP, Vt, Old, Bvt, St0), + {vtmerge_pat(Pvt, Psvt),vtmerge_pat(Bvt0, Bvt1), St1}; + false -> + {Psvt,Bvt0,add_error(L, illegal_map_key, St0)}; + {false,variable,Var} -> + {Psvt,Bvt0,add_error(L, {illegal_map_key_variable,Var}, St0)} + end + end, {[],[],St}, Ps); %%pattern({struct,_Line,_Tag,Ps}, Vt, Old, Bvt, St) -> %% pattern_list(Ps, Vt, Old, Bvt, St); pattern({record_index,Line,Name,Field}, _Vt, _Old, _Bvt, St) -> @@ -1615,21 +1571,6 @@ erl_internal:arith_op(Op, 2) andalso all(fun is_pattern_expr/1, [A1,A2]); is_pattern_expr_1(_Other) -> false. -pattern_map(Ps, Vt, Old, Bvt, St) -> - foldl(fun - ({map_field_assoc,L,_,_}, {Psvt,Bvt0,St0}) -> - {Psvt,Bvt0,add_error(L, illegal_pattern, St0)}; - ({map_field_exact,L,K,V}, {Psvt,Bvt0,St0}) -> - case is_valid_map_key(K) of - true -> - {Kvt,St1} = expr(K, Vt, St0), - {Vvt,Bvt2,St2} = pattern(V, Vt, Old, Bvt, St1), - {vtmerge_pat(vtmerge_pat(Kvt, Vvt), Psvt), vtmerge_pat(Bvt0, Bvt2), St2}; - false -> - {Psvt,Bvt0,add_error(L, illegal_map_key, St0)} - end - end, {[],[],St}, Ps). - %% pattern_bin([Element], VarTable, Old, BinVarTable, State) -> %% {UpdVarTable,UpdBinVarTable,State}. %% Check a pattern group. BinVarTable are used binsize variables. @@ -1978,10 +1919,10 @@ is_guard_test(Expression, Forms) -> RecordAttributes = [A || A = {attribute, _, record, _D} <- Forms], St0 = foldl(fun(Attr0, St1) -> - Attr = set_file(Attr0, "none"), + Attr = zip_file_and_line(Attr0, "none"), attribute_state(Attr, St1) end, start(), RecordAttributes), - is_guard_test2(set_file(Expression, "nofile"), St0#lint.records). + is_guard_test2(zip_file_and_line(Expression, "nofile"), St0#lint.records). %% is_guard_test2(Expression, RecordDefs :: dict:dict()) -> boolean(). is_guard_test2({call,Line,{atom,Lr,record},[E,A]}, RDs) -> @@ -2144,8 +2085,8 @@ {Cvt,St3} = icrt_clauses(Cs, Vt, St2), %% Csvts = [vtnew(Tevt, Vt)|Cvt], %This is just NEW variables! Csvts = [Tevt|Cvt], - Rvt = icrt_export(Csvts, Vt, {'receive',Line}, St3), - {vtmerge([Tvt,Tevt,Rvt]),St3}; + {Rvt,St4} = icrt_export(Csvts, Vt, {'receive',Line}, St3), + {vtmerge([Tvt,Tevt,Rvt]),St4}; expr({'fun',Line,Body}, Vt, St) -> %%No one can think funs export! case Body of @@ -2256,20 +2197,21 @@ %% passes cannot handle exports in combination with 'after'. {Evt0,St1} = exprs(Es, Vt, St0), TryLine = {'try',Line}, - Uvt = vtunsafe(TryLine, Evt0, Vt), - Evt1 = vtupdate(Uvt, Evt0), + Uvt = vtunsafe(vtnames(vtnew(Evt0, Vt)), TryLine, []), + Evt1 = vtupdate(Uvt, vtsubtract(Evt0, Uvt)), {Sccs,St2} = icrt_clauses(Scs++Ccs, TryLine, vtupdate(Evt1, Vt), St1), Rvt0 = Sccs, - Rvt1 = vtupdate(vtunsafe(TryLine, Rvt0, Vt), Rvt0), + Rvt1 = vtupdate(vtunsafe(vtnames(vtnew(Rvt0, Vt)), TryLine, []), Rvt0), Evt2 = vtmerge(Evt1, Rvt1), {Avt0,St} = exprs(As, vtupdate(Evt2, Vt), St2), - Avt1 = vtupdate(vtunsafe(TryLine, Avt0, Vt), Avt0), + Avt1 = vtupdate(vtunsafe(vtnames(vtnew(Avt0, Vt)), TryLine, []), Avt0), Avt = vtmerge(Evt2, Avt1), {Avt,St}; expr({'catch',Line,E}, Vt, St0) -> %% No new variables added, flag new variables as unsafe. - {Evt,St} = expr(E, Vt, St0), - {vtupdate(vtunsafe({'catch',Line}, Evt, Vt), Evt),St}; + {Evt,St1} = expr(E, Vt, St0), + Uvt = vtunsafe(vtnames(vtnew(Evt, Vt)), {'catch',Line}, []), + {vtupdate(Uvt,vtupdate(Evt, Vt)),St1}; expr({match,_Line,P,E}, Vt, St0) -> {Evt,St1} = expr(E, Vt, St0), {Pvt,Bvt,St2} = pattern(P, vtupdate(Evt, Vt), St1), @@ -2282,8 +2224,9 @@ {Evt1,St1} = expr(L, Vt, St0), Vt1 = vtupdate(Evt1, Vt), {Evt2,St2} = expr(R, Vt1, St1), - Evt3 = vtupdate(vtunsafe({Op,Line}, Evt2, Vt1), Evt2), - {vtmerge(Evt1, Evt3),St2}; + Vt2 = vtmerge(Evt2, Vt1), + {Vt3,St3} = icrt_export([Vt1,Vt2], Vt1, {Op,Line}, St2), + {vtmerge(Evt1, Vt3),St3}; expr({op,_Line,_Op,L,R}, Vt, St) -> expr_list([L,R], Vt, St); %They see the same variables %% The following are not allowed to occur anywhere! @@ -2294,10 +2237,11 @@ %% {UsedVarTable,State} expr_list(Es, Vt, St) -> - foldl(fun (E, {Esvt,St0}) -> - {Evt,St1} = expr(E, Vt, St0), - {vtmerge_pat(Evt, Esvt),St1} - end, {[],St}, Es). + {Vt1,St1} = foldl(fun (E, {Esvt,St0}) -> + {Evt,St1} = expr(E, Vt, St0), + {vtmerge_pat(Evt, Esvt),St1} + end, {[],St}, Es), + {vtmerge(vtnew(Vt1, Vt), vtold(Vt1, Vt)),St1}. record_expr(Line, Rec, Vt, St0) -> St1 = warn_invalid_record(Line, Rec, St0), @@ -2310,13 +2254,18 @@ check_assoc_fields([], St) -> St. -map_fields([{Tag,_,K,V}|Fs], Vt, St, F) when Tag =:= map_field_assoc; - Tag =:= map_field_exact -> - {Pvt,St2} = F([K,V], Vt, St), +map_fields([{Tag,Line,K,V}|Fs], Vt, St, F) when Tag =:= map_field_assoc; + Tag =:= map_field_exact -> + St1 = case is_valid_map_key(K, St) of + true -> St; + false -> add_error(Line, illegal_map_key, St); + {false,variable,Var} -> add_error(Line, {illegal_map_key_variable,Var}, St) + end, + {Pvt,St2} = F([K,V], Vt, St1), {Vts,St3} = map_fields(Fs, Vt, St2, F), {vtupdate(Pvt, Vts),St3}; -map_fields([], _, St, _) -> - {[],St}. +map_fields([], Vt, St, _) -> + {Vt,St}. %% warn_invalid_record(Line, Record, State0) -> State %% Adds warning if the record is invalid. @@ -2370,14 +2319,21 @@ _ -> true end. -%% is_valid_map_key(K,St) -> true | false -%% variables are allowed for patterns only at the top of the tree +%% is_valid_map_key(K,St) -> true | false | {false, Var::atom()} +%% check for value expression without variables + +is_valid_map_key(K,St) -> + is_valid_map_key(K,expr,St). +is_valid_map_key(K,Ctx,St) -> + case expr(K,[],St) of + {[],_} -> + is_valid_map_key_value(K,Ctx); + {[Var|_],_} -> + {false,variable,element(1,Var)} + end. -is_valid_map_key({var,_,_}) -> true; -is_valid_map_key(K) -> is_valid_map_key_value(K). -is_valid_map_key_value(K) -> +is_valid_map_key_value(K,Ctx) -> case K of - {var,_,_} -> false; {char,_,_} -> true; {integer,_,_} -> true; {float,_,_} -> true; @@ -2385,36 +2341,36 @@ {nil,_} -> true; {atom,_,_} -> true; {cons,_,H,T} -> - is_valid_map_key_value(H) andalso - is_valid_map_key_value(T); + is_valid_map_key_value(H,Ctx) andalso + is_valid_map_key_value(T,Ctx); {tuple,_,Es} -> foldl(fun(E,B) -> - B andalso is_valid_map_key_value(E) + B andalso is_valid_map_key_value(E,Ctx) end,true,Es); {map,_,Arg,Ps} -> % only check for value expressions to be valid % invalid map expressions are later checked in % core and kernel - is_valid_map_key_value(Arg) andalso foldl(fun + is_valid_map_key_value(Arg,Ctx) andalso foldl(fun ({Tag,_,Ke,Ve},B) when Tag =:= map_field_assoc; - Tag =:= map_field_exact -> - B andalso is_valid_map_key_value(Ke) - andalso is_valid_map_key_value(Ve); + Tag =:= map_field_exact, Ctx =:= expr -> + B andalso is_valid_map_key_value(Ke,Ctx) + andalso is_valid_map_key_value(Ve,Ctx); (_,_) -> false end,true,Ps); {map,_,Ps} -> foldl(fun ({Tag,_,Ke,Ve},B) when Tag =:= map_field_assoc; - Tag =:= map_field_exact -> - B andalso is_valid_map_key_value(Ke) - andalso is_valid_map_key_value(Ve); + Tag =:= map_field_exact, Ctx =:= expr -> + B andalso is_valid_map_key_value(Ke,Ctx) + andalso is_valid_map_key_value(Ve,Ctx); (_,_) -> false end, true, Ps); {record,_,_,Fs} -> foldl(fun ({record_field,_,Ke,Ve},B) -> - B andalso is_valid_map_key_value(Ke) - andalso is_valid_map_key_value(Ve) + B andalso is_valid_map_key_value(Ke,Ctx) + andalso is_valid_map_key_value(Ve,Ctx) end,true,Fs); {bin,_,Es} -> % only check for value expressions to be valid @@ -2422,9 +2378,9 @@ % core and kernel foldl(fun ({bin_element,_,E,_,_},B) -> - B andalso is_valid_map_key_value(E) + B andalso is_valid_map_key_value(E,Ctx) end,true,Es); - Val -> is_pattern_expr(Val) + _ -> false end. %% record_def(Line, RecordName, [RecField], State) -> State. @@ -2643,7 +2599,7 @@ %% The record field names and such are checked in the record format. %% We only need to check the types. Types = [T || {typed_record_field, _, T} <- Fields], - check_type({type, nowarn(), product, Types}, St0); + check_type({type, -1, product, Types}, St0); type_def(Attr, Line, TypeName, ProtoType, Args, St0) -> TypeDefs = St0#lint.types, Arity = length(Args), @@ -2652,28 +2608,37 @@ StoreType = fun(St) -> NewDefs = dict:store(TypePair, Info, TypeDefs), - CheckType = {type, nowarn(), product, [ProtoType|Args]}, + CheckType = {type, -1, product, [ProtoType|Args]}, check_type(CheckType, St#lint{types=NewDefs}) end, case is_default_type(TypePair) of true -> case is_obsolete_builtin_type(TypePair) of true -> StoreType(St0); - false -> - case is_newly_introduced_builtin_type(TypePair) of - %% allow some types just for bootstrapping - true -> - Warn = {new_builtin_type, TypePair}, - St1 = add_warning(Line, Warn, St0), - StoreType(St1); - false -> - add_error(Line, {builtin_type, TypePair}, St0) - end + false -> add_error(Line, {builtin_type, TypePair}, St0) +%% case is_newly_introduced_builtin_type(TypePair) of +%% %% allow some types just for bootstrapping +%% true -> +%% Warn = {new_builtin_type, TypePair}, +%% St1 = add_warning(Line, Warn, St0), +%% StoreType(St1); +%% false -> +%% add_error(Line, {builtin_type, TypePair}, St0) +%% end end; false -> - case dict:is_key(TypePair, TypeDefs) of + case + dict:is_key(TypePair, TypeDefs) orelse + is_var_arity_type(TypeName) + of true -> - add_error(Line, {redefine_type, TypePair}, St0); + case is_newly_introduced_var_arity_type(TypeName) of + true -> + Warn = {new_var_arity_type, TypeName}, + add_warning(Line, Warn, St0); + false -> + add_error(Line, {redefine_type, TypePair}, St0) + end; false -> St1 = case Attr =:= opaque andalso @@ -2708,11 +2673,9 @@ check_type({paren_type, _L, [Type]}, SeenVars, St) -> check_type(Type, SeenVars, St); check_type({remote_type, L, [{atom, _, Mod}, {atom, _, Name}, Args]}, - SeenVars, St0) -> - St = deprecated_type(L, Mod, Name, Args, St0), - CurrentMod = St#lint.module, + SeenVars, #lint{module=CurrentMod} = St) -> case Mod =:= CurrentMod of - true -> check_type({user_type, L, Name, Args}, SeenVars, St); + true -> check_type({type, L, Name, Args}, SeenVars, St); false -> lists:foldl(fun(T, {AccSeenVars, AccSt}) -> check_type(T, AccSeenVars, AccSt) @@ -2738,7 +2701,7 @@ {type, _, any} -> St; _ -> add_error(L, {type_syntax, 'fun'}, St) end, - check_type({type, nowarn(), product, [Dom, Range]}, SeenVars, St1); + check_type({type, -1, product, [Dom, Range]}, SeenVars, St1); check_type({type, L, range, [From, To]}, SeenVars, St) -> St1 = case {erl_eval:partial_eval(From), erl_eval:partial_eval(To)} of @@ -2746,16 +2709,13 @@ _ -> add_error(L, {type_syntax, range}, St) end, {SeenVars, St1}; -check_type({type, L, map, any}, SeenVars, St) -> - %% To get usage right while map/0 is a newly_introduced_builtin_type. - St1 = used_type({map, 0}, L, St), - {SeenVars, St1}; +check_type({type, _L, map, any}, SeenVars, St) -> {SeenVars, St}; check_type({type, _L, map, Pairs}, SeenVars, St) -> lists:foldl(fun(Pair, {AccSeenVars, AccSt}) -> check_type(Pair, AccSeenVars, AccSt) end, {SeenVars, St}, Pairs); -check_type({type, _L, map_field_assoc, [Dom, Range]}, SeenVars, St) -> - check_type({type, nowarn(), product, [Dom, Range]}, SeenVars, St); +check_type({type, _L, map_field_assoc, Dom, Range}, SeenVars, St) -> + check_type({type, -1, product, [Dom, Range]}, SeenVars, St); check_type({type, _L, tuple, any}, SeenVars, St) -> {SeenVars, St}; check_type({type, _L, any}, SeenVars, St) -> {SeenVars, St}; check_type({type, L, binary, [Base, Unit]}, SeenVars, St) -> @@ -2773,39 +2733,41 @@ check_record_types(L, Atom, Fields, SeenVars, St1); _ -> {SeenVars, add_error(L, {type_syntax, record}, St)} end; -check_type({type, _L, Tag, Args}, SeenVars, St) when Tag =:= product; - Tag =:= union; - Tag =:= tuple -> +check_type({type, _L, product, Args}, SeenVars, St) -> lists:foldl(fun(T, {AccSeenVars, AccSt}) -> check_type(T, AccSeenVars, AccSt) end, {SeenVars, St}, Args); check_type({type, La, TypeName, Args}, SeenVars, St) -> - #lint{module = Module, types=Types} = St, + #lint{usage=Usage, module = Module, types=Types} = St, Arity = length(Args), TypePair = {TypeName, Arity}, - Obsolete = (is_warn_enabled(deprecated_type, St) - andalso obsolete_builtin_type(TypePair)), - St1 = case Obsolete of - {deprecated, Repl, _} when element(1, Repl) =/= Module -> - case dict:find(TypePair, Types) of - {ok, _} -> - used_type(TypePair, La, St); - error -> + St1 = case is_var_arity_type(TypeName) of + true -> St; + false -> + Obsolete = (is_warn_enabled(deprecated_type, St) + andalso obsolete_builtin_type(TypePair)), + IsObsolete = + case Obsolete of + {deprecated, Repl, _} when element(1, Repl) =/= Module -> + case dict:find(TypePair, Types) of + {ok, _} -> false; + error -> true + end; + _ -> false + end, + case IsObsolete of + true -> {deprecated, Replacement, Rel} = Obsolete, Tag = deprecated_builtin_type, W = {Tag, TypePair, Replacement, Rel}, - add_warning(La, W, St) - end; - _ -> St - end, - check_type({type, nowarn(), product, Args}, SeenVars, St1); -check_type({user_type, L, TypeName, Args}, SeenVars, St) -> - Arity = length(Args), - TypePair = {TypeName, Arity}, - St1 = used_type(TypePair, L, St), - lists:foldl(fun(T, {AccSeenVars, AccSt}) -> - check_type(T, AccSeenVars, AccSt) - end, {SeenVars, St1}, Args); + add_warning(La, W, St); + false -> + OldUsed = Usage#usage.used_types, + UsedTypes = dict:store(TypePair, La, OldUsed), + St#lint{usage=Usage#usage{used_types=UsedTypes}} + end + end, + check_type({type, -1, product, Args}, SeenVars, St1); check_type(I, SeenVars, St) -> case erl_eval:partial_eval(I) of {integer,_ILn,_Integer} -> {SeenVars, St}; @@ -2847,23 +2809,95 @@ check_record_types([], _Name, _DefFields, SeenVars, St, _SeenFields) -> {SeenVars, St}. -used_type(TypePair, L, #lint{usage = Usage, file = File} = St) -> - OldUsed = Usage#usage.used_types, - UsedTypes = dict:store(TypePair, erl_anno:set_file(File, L), OldUsed), - St#lint{usage=Usage#usage{used_types=UsedTypes}}. +is_var_arity_type(tuple) -> true; +is_var_arity_type(map) -> true; +is_var_arity_type(product) -> true; +is_var_arity_type(union) -> true; +is_var_arity_type(record) -> true; +is_var_arity_type(_) -> false. + +is_default_type({any, 0}) -> true; +is_default_type({arity, 0}) -> true; +is_default_type({array, 0}) -> true; +is_default_type({atom, 0}) -> true; +is_default_type({atom, 1}) -> true; +is_default_type({binary, 0}) -> true; +is_default_type({binary, 2}) -> true; +is_default_type({bitstring, 0}) -> true; +is_default_type({bool, 0}) -> true; +is_default_type({boolean, 0}) -> true; +is_default_type({byte, 0}) -> true; +is_default_type({char, 0}) -> true; +is_default_type({dict, 0}) -> true; +is_default_type({digraph, 0}) -> true; +is_default_type({float, 0}) -> true; +is_default_type({'fun', 0}) -> true; +is_default_type({'fun', 2}) -> true; +is_default_type({function, 0}) -> true; +is_default_type({gb_set, 0}) -> true; +is_default_type({gb_tree, 0}) -> true; +is_default_type({identifier, 0}) -> true; +is_default_type({integer, 0}) -> true; +is_default_type({integer, 1}) -> true; +is_default_type({iodata, 0}) -> true; +is_default_type({iolist, 0}) -> true; +is_default_type({list, 0}) -> true; +is_default_type({list, 1}) -> true; +is_default_type({maybe_improper_list, 0}) -> true; +is_default_type({maybe_improper_list, 2}) -> true; +is_default_type({mfa, 0}) -> true; +is_default_type({module, 0}) -> true; +is_default_type({neg_integer, 0}) -> true; +is_default_type({nil, 0}) -> true; +is_default_type({no_return, 0}) -> true; +is_default_type({node, 0}) -> true; +is_default_type({non_neg_integer, 0}) -> true; +is_default_type({none, 0}) -> true; +is_default_type({nonempty_list, 0}) -> true; +is_default_type({nonempty_list, 1}) -> true; +is_default_type({nonempty_improper_list, 2}) -> true; +is_default_type({nonempty_maybe_improper_list, 0}) -> true; +is_default_type({nonempty_maybe_improper_list, 2}) -> true; +is_default_type({nonempty_string, 0}) -> true; +is_default_type({number, 0}) -> true; +is_default_type({pid, 0}) -> true; +is_default_type({port, 0}) -> true; +is_default_type({pos_integer, 0}) -> true; +is_default_type({queue, 0}) -> true; +is_default_type({range, 2}) -> true; +is_default_type({reference, 0}) -> true; +is_default_type({set, 0}) -> true; +is_default_type({string, 0}) -> true; +is_default_type({term, 0}) -> true; +is_default_type({timeout, 0}) -> true; +is_default_type({var, 1}) -> true; +is_default_type(_) -> false. -is_default_type({Name, NumberOfTypeVariables}) -> - erl_internal:is_type(Name, NumberOfTypeVariables). +is_newly_introduced_var_arity_type(map) -> true; +is_newly_introduced_var_arity_type(_) -> false. -is_newly_introduced_builtin_type({map, 0}) -> true; -is_newly_introduced_builtin_type({Name, _}) when is_atom(Name) -> false. +%% is_newly_introduced_builtin_type({Name, _}) when is_atom(Name) -> false. is_obsolete_builtin_type(TypePair) -> obsolete_builtin_type(TypePair) =/= no. -%% To keep Dialyzer silent... -obsolete_builtin_type({1, 255}) -> - {deprecated, {2, 255}, ""}; +%% Obsolete in OTP 17.0. +obsolete_builtin_type({array, 0}) -> + {deprecated, {array, array, 1}, "OTP 18.0"}; +obsolete_builtin_type({dict, 0}) -> + {deprecated, {dict, dict, 2}, "OTP 18.0"}; +obsolete_builtin_type({digraph, 0}) -> + {deprecated, {digraph, graph}, "OTP 18.0"}; +obsolete_builtin_type({gb_set, 0}) -> + {deprecated, {gb_sets, set, 1}, "OTP 18.0"}; +obsolete_builtin_type({gb_tree, 0}) -> + {deprecated, {gb_trees, tree, 2}, "OTP 18.0"}; +obsolete_builtin_type({queue, 0}) -> + {deprecated, {queue, queue, 1}, "OTP 18.0"}; +obsolete_builtin_type({set, 0}) -> + {deprecated, {sets, set, 1}, "OTP 18.0"}; +obsolete_builtin_type({tid, 0}) -> + {deprecated, {ets, tid}, "OTP 18.0"}; obsolete_builtin_type({Name, A}) when is_atom(Name), is_integer(A) -> no. %% spec_decl(Line, Fun, Types, State) -> State. @@ -2875,7 +2909,7 @@ end, St1 = St0#lint{specs = dict:store(MFA, Line, Specs)}, case dict:is_key(MFA, Specs) of - true -> add_error(Line, {redefine_spec, MFA0}, St1); + true -> add_error(Line, {redefine_spec, MFA}, St1); false -> check_specs(TypeSpecs, Arity, St1) end. @@ -2883,50 +2917,16 @@ callback_decl(Line, MFA0, TypeSpecs, St0 = #lint{callbacks = Callbacks, module = Mod}) -> - case MFA0 of - {_M, _F, _A} -> add_error(Line, {bad_callback, MFA0}, St0); - {F, Arity} -> - MFA = {Mod, F, Arity}, - St1 = St0#lint{callbacks = dict:store(MFA, Line, Callbacks)}, - case dict:is_key(MFA, Callbacks) of - true -> add_error(Line, {redefine_callback, MFA0}, St1); - false -> check_specs(TypeSpecs, Arity, St1) - end - end. - -%% optional_callbacks(Line, FAs, State) -> State. - -optional_callbacks(Line, Term, St0) -> - try true = is_fa_list(Term), Term of - FAs -> - optional_cbs(Line, FAs, St0) - catch - _:_ -> - St0 % ignore others + MFA = case MFA0 of + {F, Arity} -> {Mod, F, Arity}; + {_M, _F, Arity} -> MFA0 + end, + St1 = St0#lint{callbacks = dict:store(MFA, Line, Callbacks)}, + case dict:is_key(MFA, Callbacks) of + true -> add_error(Line, {redefine_callback, MFA}, St1); + false -> check_specs(TypeSpecs, Arity, St1) end. -optional_cbs(_Line, [], St) -> - St; -optional_cbs(Line, [{F,A}|FAs], St0) -> - #lint{optional_callbacks = OptionalCbs, module = Mod} = St0, - MFA = {Mod, F, A}, - St1 = St0#lint{optional_callbacks = dict:store(MFA, Line, OptionalCbs)}, - St2 = case dict:is_key(MFA, OptionalCbs) of - true -> - add_error(Line, {redefine_optional_callback, {F,A}}, St1); - false -> - St1 - end, - optional_cbs(Line, FAs, St2). - -is_fa_list([E|L]) -> is_fa(E) andalso is_fa_list(L); -is_fa_list([]) -> true; -is_fa_list(_) -> false. - -is_fa({FuncName, Arity}) - when is_atom(FuncName), is_integer(Arity), Arity >= 0 -> true; -is_fa(_) -> false. - check_specs([FunType|Left], Arity, St0) -> {FunType1, CTypes} = case FunType of @@ -2944,22 +2944,16 @@ true -> St0; false -> add_error(L, spec_wrong_arity, St0) end, - St2 = check_type({type, nowarn(), product, [FunType1|CTypes]}, St1), + St2 = check_type({type, -1, product, [FunType1|CTypes]}, St1), check_specs(Left, Arity, St2); check_specs([], _Arity, St) -> St. -nowarn() -> - A0 = erl_anno:new(0), - A1 = erl_anno:set_generated(true, A0), - erl_anno:set_file("", A1). - check_specs_without_function(#lint{module=Mod,defined=Funcs,specs=Specs}=St) -> - Fun = fun({M, F, A}, Line, AccSt) when M =:= Mod -> - FA = {F, A}, - case gb_sets:is_element(FA, Funcs) of + Fun = fun({M, F, A} = MFA, Line, AccSt) when M =:= Mod -> + case gb_sets:is_element({F, A}, Funcs) of true -> AccSt; - false -> add_error(Line, {spec_fun_undefined, FA}, AccSt) + false -> add_error(Line, {spec_fun_undefined, MFA}, AccSt) end; ({_M, _F, _A}, _Line, AccSt) -> AccSt end, @@ -3004,7 +2998,7 @@ UsedTypes = gb_sets:from_list(L), FoldFun = fun(Type, #typeinfo{line = FileLine}, AccSt) -> - case loc(FileLine, AccSt) of + case loc(FileLine) of {FirstFile, _} -> case gb_sets:is_member(Type, UsedTypes) of true -> AccSt; @@ -3038,12 +3032,11 @@ dict:fold(FoldFun, St, Ts). %% icrt_clauses(Clauses, In, ImportVarTable, State) -> -%% {UpdVt,State}. +%% {NewVts,State}. icrt_clauses(Cs, In, Vt, St0) -> {Csvt,St1} = icrt_clauses(Cs, Vt, St0), - UpdVt = icrt_export(Csvt, Vt, In, St1), - {UpdVt,St1}. + icrt_export(Csvt, Vt, In, St1). %% icrt_clauses(Clauses, ImportVarTable, State) -> %% {NewVts,State}. @@ -3053,73 +3046,26 @@ icrt_clause({clause,_Line,H,G,B}, Vt0, St0) -> {Hvt,Binvt,St1} = head(H, Vt0, St0), - Vt1 = vtupdate(Hvt, Binvt), - {Gvt,St2} = guard(G, vtupdate(Vt1, Vt0), St1), + Vt1 = vtupdate(Hvt, vtupdate(Binvt, Vt0)), + {Gvt,St2} = guard(G, Vt1, St1), Vt2 = vtupdate(Gvt, Vt1), - {Bvt,St3} = exprs(B, vtupdate(Vt2, Vt0), St2), + {Bvt,St3} = exprs(B, Vt2, St2), {vtupdate(Bvt, Vt2),St3}. -icrt_export(Vts, Vt, {Tag,Attrs}, St) -> - {_File,Loc} = loc(Attrs, St), - icrt_export(lists:merge(Vts), Vt, {Tag,Loc}, length(Vts), []). - -icrt_export([{V,{{export,_},_,_}}|Vs0], [{V,{{export,_}=S0,_,Ls}}|Vt], - In, I, Acc) -> - %% V was an exported variable and has been used in an expression in at least - %% one clause. Its state needs to be merged from all clauses to silence any - %% exported var warning already emitted. - {VVs,Vs} = lists:partition(fun ({K,_}) -> K =:= V end, Vs0), - S = foldl(fun ({_,{S1,_,_}}, AccS) -> merge_state(AccS, S1) end, S0, VVs), - icrt_export(Vs, Vt, In, I, [{V,{S,used,Ls}}|Acc]); -icrt_export([{V,_}|Vs0], [{V,{_,_,Ls}}|Vt], In, I, Acc) -> - %% V was either unsafe or bound and has now been reused. It may also have - %% been an export but as it was not matched by the previous clause, it means - %% it has been changed to 'bound' in at least one clause because it was used - %% in a pattern. - Vs = lists:dropwhile(fun ({K,_}) -> K =:= V end, Vs0), - icrt_export(Vs, Vt, In, I, [{V,{bound,used,Ls}}|Acc]); -icrt_export([{V1,_}|_]=Vs, [{V2,_}|Vt], In, I, Acc) when V1 > V2 -> - %% V2 was already in scope and has not been reused in any clause. - icrt_export(Vs, Vt, In, I, Acc); -icrt_export([{V,_}|_]=Vs0, Vt, In, I, Acc) -> - %% V is a new variable. - {VVs,Vs} = lists:partition(fun ({K,_}) -> K =:= V end, Vs0), - F = fun ({_,{S,U,Ls}}, {AccI,AccS0,AccLs0}) -> - AccS = case {S,AccS0} of - {{unsafe,_},{unsafe,_}} -> - %% V was found unsafe in a previous clause, mark - %% it as unsafe for the whole parent expression. - {unsafe,In}; - {{unsafe,_},_} -> - %% V was unsafe in a clause, keep that state and - %% generalize it to the whole expression if it - %% is found unsafe in another one. - S; - _ -> - %% V is either bound or exported, keep original - %% state. - AccS0 - end, - AccLs = case U of - used -> AccLs0; - unused -> merge_lines(AccLs0, Ls) - end, - {AccI + 1,AccS,AccLs} - end, - %% Initial state is exported from the current expression. - {Count,S1,Ls} = foldl(F, {0,{export,In},[]}, VVs), - S = case Count of - I -> - %% V was found in all clauses, keep computed state. - S1; - _ -> - %% V was not bound in some clauses, mark as unsafe. - {unsafe,In} - end, - U = case Ls of [] -> used; _ -> unused end, - icrt_export(Vs, Vt, In, I, [{V,{S,U,Ls}}|Acc]); -icrt_export([], _, _, _, Acc) -> - reverse(Acc). +icrt_export(Csvt, Vt, In, St) -> + Vt1 = vtmerge(Csvt), + All = ordsets:subtract(vintersection(Csvt), vtnames(Vt)), + Some = ordsets:subtract(vtnames(Vt1), vtnames(Vt)), + Xvt = vtexport(All, In, []), + Evt = vtunsafe(ordsets:subtract(Some, All), In, Xvt), + Unused = vtmerge([unused_vars(Vt0, Vt, St) || Vt0 <- Csvt]), + %% Exported and unsafe variables may be unused: + Uvt = vtmerge(Evt, Unused), + %% Make exported and unsafe unused variables unused in subsequent code: + Vt2 = vtmerge(Uvt, vtsubtract(Vt1, Uvt)), + %% Forget about old variables which were not used: + Vt3 = vtmerge(vtnew(Vt2, Vt), vt_no_unused(vtold(Vt2, Vt))), + {Vt3,St}. handle_comprehension(E, Qs, Vt0, St0) -> {Vt1, Uvt, St1} = lc_quals(Qs, Vt0, St0), @@ -3217,8 +3163,7 @@ {Cvt,St1} = fun_clause(C, Vt, St0), {vtmerge(Cvt, Bvt0),St1} end, {[],St#lint{recdef_top = false}}, Cs), - Uvt = vt_no_unsafe(vt_no_unused(vtold(Bvt, Vt))), - {Uvt,St2#lint{recdef_top = OldRecDef}}. + {vt_no_unused(vtold(Bvt, Vt)),St2#lint{recdef_top = OldRecDef}}. fun_clause({clause,_Line,H,G,B}, Vt0, St0) -> {Hvt,Binvt,St1} = head(H, Vt0, [], St0), % No imported pattern variables @@ -3332,24 +3277,19 @@ %% exported vars are probably safe, warn only if warn_export_vars is %% set. -expr_var(V, Line, Vt, St) -> +expr_var(V, Line, Vt, St0) -> case orddict:find(V, Vt) of {ok,{bound,_Usage,Ls}} -> - {[{V,{bound,used,Ls}}],St}; + {[{V,{bound,used,Ls}}],St0}; {ok,{{unsafe,In},_Usage,Ls}} -> {[{V,{bound,used,Ls}}], - add_error(Line, {unsafe_var,V,In}, St)}; + add_error(Line, {unsafe_var,V,In}, St0)}; {ok,{{export,From},_Usage,Ls}} -> - case is_warn_enabled(export_vars, St) of - true -> - {[{V,{bound,used,Ls}}], - add_warning(Line, {exported_var,V,From}, St)}; - false -> - {[{V,{{export,From},used,Ls}}],St} - end; + {[{V,{bound,used,Ls}}], + exported_var(Line, V, From, St0)}; error -> {[{V,{bound,used,[Line]}}], - add_error(Line, {unbound_var,V}, St)} + add_error(Line, {unbound_var,V}, St0)} end. exported_var(Line, V, From, St) -> @@ -3413,12 +3353,17 @@ {S, merge_used(U1, U2), merge_lines(L1, L2)} end, Uvt, Vt0). -%% vtunsafe(From, UpdVarTable, VarTable) -> UnsafeVarTable. -%% Return all new variables in UpdVarTable as unsafe. - -vtunsafe({Tag,FileLine}, Uvt, Vt) -> - Line = erl_anno:location(FileLine), - [{V,{{unsafe,{Tag,Line}},U,Ls}} || {V,{_,U,Ls}} <- vtnew(Uvt, Vt)]. +%% vtexport([Variable], From, VarTable) -> VarTable. +%% vtunsafe([Variable], From, VarTable) -> VarTable. +%% Add the variables to VarTable either as exported from From or as unsafe. + +vtexport(Vs, {InTag,FileLine}, Vt0) -> + {_File,Line} = loc(FileLine), + vtupdate([{V,{{export,{InTag,Line}},unused,[]}} || V <- Vs], Vt0). + +vtunsafe(Vs, {InTag,FileLine}, Vt0) -> + {_File,Line} = loc(FileLine), + vtupdate([{V,{{unsafe,{InTag,Line}},unused,[]}} || V <- Vs], Vt0). %% vtmerge(VarTable, VarTable) -> VarTable. %% Merge two variables tables generating a new vartable. Give priority to @@ -3471,6 +3416,8 @@ vtold(New, Old) -> orddict:filter(fun (V, _How) -> orddict:is_key(V, Old) end, New). +vtnames(Vt) -> [ V || {V,_How} <- Vt ]. + vt_no_unsafe(Vt) -> [V || {_,{S,_U,_L}}=V <- Vt, case S of {unsafe,_} -> false; @@ -3479,18 +3426,84 @@ vt_no_unused(Vt) -> [V || {_,{_,U,_L}}=V <- Vt, U =/= unused]. +%% vunion(VarTable1, VarTable2) -> [VarName]. +%% vunion([VarTable]) -> [VarName]. +%% vintersection(VarTable1, VarTable2) -> [VarName]. +%% vintersection([VarTable]) -> [VarName]. +%% Union/intersection of names of vars in VarTable. + +-ifdef(NOTUSED). +vunion(Vs1, Vs2) -> ordsets:union(vtnames(Vs1), vtnames(Vs2)). + +vunion(Vss) -> foldl(fun (Vs, Uvs) -> + ordsets:union(vtnames(Vs), Uvs) + end, [], Vss). + +vintersection(Vs1, Vs2) -> ordsets:intersection(vtnames(Vs1), vtnames(Vs2)). +-endif. + +vintersection([Vs]) -> + vtnames(Vs); %Boundary conditions!!! +vintersection([Vs|Vss]) -> + ordsets:intersection(vtnames(Vs), vintersection(Vss)); +vintersection([]) -> + []. + %% copy_expr(Expr, Line) -> Expr. %% Make a copy of Expr converting all line numbers to Line. -copy_expr(Expr, Anno) -> - erl_parse:map_anno(fun(_A) -> Anno end, Expr). +copy_expr(Expr, Line) -> + modify_line(Expr, fun(_L) -> Line end). %% modify_line(Form, Fun) -> Form %% modify_line(Expression, Fun) -> Expression %% Applies Fun to each line number occurrence. modify_line(T, F0) -> - erl_parse:map_anno(F0, T). + modify_line1(T, F0). + +%% Forms. +modify_line1({function,F,A}, _Mf) -> {function,F,A}; +modify_line1({function,M,F,A}, Mf) -> + {function,modify_line1(M, Mf),modify_line1(F, Mf),modify_line1(A, Mf)}; +modify_line1({attribute,L,record,{Name,Fields}}, Mf) -> + {attribute,Mf(L),record,{Name,modify_line1(Fields, Mf)}}; +modify_line1({attribute,L,spec,{Fun,Types}}, Mf) -> + {attribute,Mf(L),spec,{Fun,modify_line1(Types, Mf)}}; +modify_line1({attribute,L,callback,{Fun,Types}}, Mf) -> + {attribute,Mf(L),callback,{Fun,modify_line1(Types, Mf)}}; +modify_line1({attribute,L,type,{TypeName,TypeDef,Args}}, Mf) -> + {attribute,Mf(L),type,{TypeName,modify_line1(TypeDef, Mf), + modify_line1(Args, Mf)}}; +modify_line1({attribute,L,opaque,{TypeName,TypeDef,Args}}, Mf) -> + {attribute,Mf(L),opaque,{TypeName,modify_line1(TypeDef, Mf), + modify_line1(Args, Mf)}}; +modify_line1({attribute,L,Attr,Val}, Mf) -> {attribute,Mf(L),Attr,Val}; +modify_line1({warning,W}, _Mf) -> {warning,W}; +modify_line1({error,W}, _Mf) -> {error,W}; +%% Expressions. +modify_line1({clauses,Cs}, Mf) -> {clauses,modify_line1(Cs, Mf)}; +modify_line1({typed_record_field,Field,Type}, Mf) -> + {typed_record_field,modify_line1(Field, Mf),modify_line1(Type, Mf)}; +modify_line1({Tag,L}, Mf) -> {Tag,Mf(L)}; +modify_line1({Tag,L,E1}, Mf) -> + {Tag,Mf(L),modify_line1(E1, Mf)}; +modify_line1({Tag,L,E1,E2}, Mf) -> + {Tag,Mf(L),modify_line1(E1, Mf),modify_line1(E2, Mf)}; +modify_line1({bin_element,L,E1,E2,TSL}, Mf) -> + {bin_element,Mf(L),modify_line1(E1, Mf),modify_line1(E2, Mf), TSL}; +modify_line1({Tag,L,E1,E2,E3}, Mf) -> + {Tag,Mf(L),modify_line1(E1, Mf),modify_line1(E2, Mf),modify_line1(E3, Mf)}; +modify_line1({Tag,L,E1,E2,E3,E4}, Mf) -> + {Tag,Mf(L), + modify_line1(E1, Mf), + modify_line1(E2, Mf), + modify_line1(E3, Mf), + modify_line1(E4, Mf)}; +modify_line1([H|T], Mf) -> + [modify_line1(H, Mf)|modify_line1(T, Mf)]; +modify_line1([], _Mf) -> []; +modify_line1(E, _Mf) when not is_tuple(E), not is_list(E) -> E. %% Check a record_info call. We have already checked that it is not %% shadowed by an import. @@ -3560,20 +3573,6 @@ St end. -deprecated_type(L, M, N, As, St) -> - NAs = length(As), - case otp_internal:obsolete_type(M, N, NAs) of - {deprecated, String} when is_list(String) -> - case is_warn_enabled(deprecated_type, St) of - true -> - add_warning(L, {deprecated_type, {M,N,NAs}, String}, St); - false -> - St - end; - no -> - St - end. - obsolete_guard({call,Line,{atom,Lr,F},As}, St0) -> Arity = length(As), case erl_internal:old_type_test(F, Arity) of @@ -3801,7 +3800,8 @@ gb_sets:is_element({Func,Arity},NoAutoSet). %% Predicate to find out if a function specific bif-clash suppression (old deprecated) is present bif_clash_specifically_disabled(St,{F,A}) -> - lists:member({F,A},St#lint.nowarn_bif_clash). + Nowarn = nowarn_function(nowarn_bif_clash, St#lint.compile), + lists:member({F,A},Nowarn). %% Predicate to find out if an autoimported guard_bif is not overriden in some way %% Guard Bif without module name is disallowed if diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_parse.yrl erlang-17.3-dfsg/lib/stdlib/src/erl_parse.yrl --- erlang-18.2-dfsg/lib/stdlib/src/erl_parse.yrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_parse.yrl 2014-09-16 19:10:57.000000000 +0000 @@ -2,19 +2,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -43,6 +42,7 @@ exprs guard atomic strings prefix_op mult_op add_op list_op comp_op +rule rule_clauses rule_clause rule_body binary bin_elements bin_element bit_expr opt_bit_size_expr bit_size_expr opt_bit_type_list bit_type_list bit_type top_type top_type_100 top_types type typed_expr typed_attr_val @@ -54,7 +54,7 @@ Terminals char integer float atom string var -'(' ')' ',' '->' '{' '}' '[' ']' '|' '||' '<-' ';' ':' '#' '.' +'(' ')' ',' '->' ':-' '{' '}' '[' ']' '|' '||' '<-' ';' ':' '#' '.' 'after' 'begin' 'case' 'try' 'catch' 'end' 'fun' 'if' 'of' 'receive' 'when' 'andalso' 'orelse' 'bnot' 'not' @@ -73,6 +73,7 @@ form -> attribute dot : '$1'. form -> function dot : '$1'. +form -> rule dot : '$1'. attribute -> '-' atom attr_val : build_attribute('$2', '$3'). attribute -> '-' atom typed_attr_val : build_typed_attribute('$2','$3'). @@ -93,7 +94,7 @@ typed_attr_val -> expr ',' typed_record_fields : {typed_record, '$1', '$3'}. typed_attr_val -> expr '::' top_type : {type_def, '$1', '$3'}. -typed_record_fields -> '{' typed_exprs '}' : {tuple, ?anno('$1'), '$2'}. +typed_record_fields -> '{' typed_exprs '}' : {tuple, ?line('$1'), '$2'}. typed_exprs -> typed_expr : ['$1']. typed_exprs -> typed_expr ',' typed_exprs : ['$1'|'$3']. @@ -106,93 +107,97 @@ type_sigs -> type_sig ';' type_sigs : ['$1'|'$3']. type_sig -> fun_type : '$1'. -type_sig -> fun_type 'when' type_guards : {type, ?anno('$1'), bounded_fun, +type_sig -> fun_type 'when' type_guards : {type, ?line('$1'), bounded_fun, ['$1','$3']}. type_guards -> type_guard : ['$1']. type_guards -> type_guard ',' type_guards : ['$1'|'$3']. -type_guard -> atom '(' top_types ')' : {type, ?anno('$1'), constraint, +type_guard -> atom '(' top_types ')' : {type, ?line('$1'), constraint, ['$1', '$3']}. type_guard -> var '::' top_type : build_def('$1', '$3'). top_types -> top_type : ['$1']. top_types -> top_type ',' top_types : ['$1'|'$3']. -top_type -> var '::' top_type_100 : {ann_type, ?anno('$1'), ['$1','$3']}. +top_type -> var '::' top_type_100 : {ann_type, ?line('$1'), ['$1','$3']}. top_type -> top_type_100 : '$1'. top_type_100 -> type_200 : '$1'. top_type_100 -> type_200 '|' top_type_100 : lift_unions('$1','$3'). -type_200 -> type_300 '..' type_300 : {type, ?anno('$1'), range, - ['$1', '$3']}. +type_200 -> type_300 '..' type_300 : {type, ?line('$1'), range, + [skip_paren('$1'), + skip_paren('$3')]}. type_200 -> type_300 : '$1'. -type_300 -> type_300 add_op type_400 : ?mkop2('$1', '$2', '$3'). +type_300 -> type_300 add_op type_400 : ?mkop2(skip_paren('$1'), + '$2', skip_paren('$3')). type_300 -> type_400 : '$1'. -type_400 -> type_400 mult_op type_500 : ?mkop2('$1', '$2', '$3'). +type_400 -> type_400 mult_op type_500 : ?mkop2(skip_paren('$1'), + '$2', skip_paren('$3')). type_400 -> type_500 : '$1'. -type_500 -> prefix_op type : ?mkop1('$1', '$2'). +type_500 -> prefix_op type : ?mkop1('$1', skip_paren('$2')). type_500 -> type : '$1'. -type -> '(' top_type ')' : '$2'. +type -> '(' top_type ')' : {paren_type, ?line('$2'), ['$2']}. type -> var : '$1'. type -> atom : '$1'. type -> atom '(' ')' : build_gen_type('$1'). -type -> atom '(' top_types ')' : build_type('$1', '$3'). -type -> atom ':' atom '(' ')' : {remote_type, ?anno('$1'), +type -> atom '(' top_types ')' : {type, ?line('$1'), + normalise('$1'), '$3'}. +type -> atom ':' atom '(' ')' : {remote_type, ?line('$1'), ['$1', '$3', []]}. -type -> atom ':' atom '(' top_types ')' : {remote_type, ?anno('$1'), +type -> atom ':' atom '(' top_types ')' : {remote_type, ?line('$1'), ['$1', '$3', '$5']}. -type -> '[' ']' : {type, ?anno('$1'), nil, []}. -type -> '[' top_type ']' : {type, ?anno('$1'), list, ['$2']}. -type -> '[' top_type ',' '...' ']' : {type, ?anno('$1'), +type -> '[' ']' : {type, ?line('$1'), nil, []}. +type -> '[' top_type ']' : {type, ?line('$1'), list, ['$2']}. +type -> '[' top_type ',' '...' ']' : {type, ?line('$1'), nonempty_list, ['$2']}. -type -> '#' '{' '}' : {type, ?anno('$1'), map, []}. -type -> '#' '{' map_pair_types '}' : {type, ?anno('$1'), map, '$3'}. -type -> '{' '}' : {type, ?anno('$1'), tuple, []}. -type -> '{' top_types '}' : {type, ?anno('$1'), tuple, '$2'}. -type -> '#' atom '{' '}' : {type, ?anno('$1'), record, ['$2']}. -type -> '#' atom '{' field_types '}' : {type, ?anno('$1'), +type -> '#' '{' '}' : {type, ?line('$1'), map, []}. +type -> '#' '{' map_pair_types '}' : {type, ?line('$1'), map, '$3'}. +type -> '{' '}' : {type, ?line('$1'), tuple, []}. +type -> '{' top_types '}' : {type, ?line('$1'), tuple, '$2'}. +type -> '#' atom '{' '}' : {type, ?line('$1'), record, ['$2']}. +type -> '#' atom '{' field_types '}' : {type, ?line('$1'), record, ['$2'|'$4']}. type -> binary_type : '$1'. type -> integer : '$1'. -type -> 'fun' '(' ')' : {type, ?anno('$1'), 'fun', []}. +type -> 'fun' '(' ')' : {type, ?line('$1'), 'fun', []}. type -> 'fun' '(' fun_type_100 ')' : '$3'. fun_type_100 -> '(' '...' ')' '->' top_type - : {type, ?anno('$1'), 'fun', - [{type, ?anno('$1'), any}, '$5']}. + : {type, ?line('$1'), 'fun', + [{type, ?line('$1'), any}, '$5']}. fun_type_100 -> fun_type : '$1'. -fun_type -> '(' ')' '->' top_type : {type, ?anno('$1'), 'fun', - [{type, ?anno('$1'), product, []}, '$4']}. +fun_type -> '(' ')' '->' top_type : {type, ?line('$1'), 'fun', + [{type, ?line('$1'), product, []}, '$4']}. fun_type -> '(' top_types ')' '->' top_type - : {type, ?anno('$1'), 'fun', - [{type, ?anno('$1'), product, '$2'},'$5']}. + : {type, ?line('$1'), 'fun', + [{type, ?line('$1'), product, '$2'},'$5']}. map_pair_types -> map_pair_type : ['$1']. map_pair_types -> map_pair_type ',' map_pair_types : ['$1'|'$3']. -map_pair_type -> top_type '=>' top_type : {type, ?anno('$2'), map_field_assoc,['$1','$3']}. +map_pair_type -> top_type '=>' top_type : {type, ?line('$2'), map_field_assoc,'$1','$3'}. field_types -> field_type : ['$1']. field_types -> field_type ',' field_types : ['$1'|'$3']. -field_type -> atom '::' top_type : {type, ?anno('$1'), field_type, +field_type -> atom '::' top_type : {type, ?line('$1'), field_type, ['$1', '$3']}. -binary_type -> '<<' '>>' : {type, ?anno('$1'),binary, - [abstract2(0, ?anno('$1')), - abstract2(0, ?anno('$1'))]}. -binary_type -> '<<' bin_base_type '>>' : {type, ?anno('$1'),binary, - ['$2', abstract2(0, ?anno('$1'))]}. -binary_type -> '<<' bin_unit_type '>>' : {type, ?anno('$1'),binary, - [abstract2(0, ?anno('$1')), '$2']}. +binary_type -> '<<' '>>' : {type, ?line('$1'),binary, + [abstract(0, ?line('$1')), + abstract(0, ?line('$1'))]}. +binary_type -> '<<' bin_base_type '>>' : {type, ?line('$1'),binary, + ['$2', abstract(0, ?line('$1'))]}. +binary_type -> '<<' bin_unit_type '>>' : {type, ?line('$1'),binary, + [abstract(0, ?line('$1')), '$2']}. binary_type -> '<<' bin_base_type ',' bin_unit_type '>>' - : {type, ?anno('$1'), binary, ['$2', '$4']}. + : {type, ?line('$1'), binary, ['$2', '$4']}. bin_base_type -> var ':' type : build_bin_type(['$1'], '$3'). @@ -208,7 +213,7 @@ function_clauses -> function_clause ';' function_clauses : ['$1'|'$3']. function_clause -> atom clause_args clause_guard clause_body : - {clause,?anno('$1'),element(3, '$1'),'$2','$3','$4'}. + {clause,?line('$1'),element(3, '$1'),'$2','$3','$4'}. clause_args -> argument_list : element(1, '$1'). @@ -219,10 +224,10 @@ clause_body -> '->' exprs: '$2'. -expr -> 'catch' expr : {'catch',?anno('$1'),'$2'}. +expr -> 'catch' expr : {'catch',?line('$1'),'$2'}. expr -> expr_100 : '$1'. -expr_100 -> expr_150 '=' expr_100 : {match,?anno('$2'),'$1','$3'}. +expr_100 -> expr_150 '=' expr_100 : {match,?line('$2'),'$1','$3'}. expr_100 -> expr_150 '!' expr_100 : ?mkop2('$1', '$2', '$3'). expr_100 -> expr_150 : '$1'. @@ -258,7 +263,7 @@ expr_700 -> expr_800 : '$1'. expr_800 -> expr_max ':' expr_max : - {remote,?anno('$2'),'$1','$3'}. + {remote,?line('$2'),'$1','$3'}. expr_800 -> expr_max : '$1'. expr_max -> var : '$1'. @@ -270,7 +275,7 @@ expr_max -> tuple : '$1'. %%expr_max -> struct : '$1'. expr_max -> '(' expr ')' : '$2'. -expr_max -> 'begin' exprs 'end' : {block,?anno('$1'),'$2'}. +expr_max -> 'begin' exprs 'end' : {block,?line('$1'),'$2'}. expr_max -> if_expr : '$1'. expr_max -> case_expr : '$1'. expr_max -> receive_expr : '$1'. @@ -278,22 +283,22 @@ expr_max -> try_expr : '$1'. -list -> '[' ']' : {nil,?anno('$1')}. -list -> '[' expr tail : {cons,?anno('$1'),'$2','$3'}. +list -> '[' ']' : {nil,?line('$1')}. +list -> '[' expr tail : {cons,?line('$1'),'$2','$3'}. -tail -> ']' : {nil,?anno('$1')}. +tail -> ']' : {nil,?line('$1')}. tail -> '|' expr ']' : '$2'. -tail -> ',' expr tail : {cons,?anno('$2'),'$2','$3'}. +tail -> ',' expr tail : {cons,?line('$2'),'$2','$3'}. -binary -> '<<' '>>' : {bin,?anno('$1'),[]}. -binary -> '<<' bin_elements '>>' : {bin,?anno('$1'),'$2'}. +binary -> '<<' '>>' : {bin,?line('$1'),[]}. +binary -> '<<' bin_elements '>>' : {bin,?line('$1'),'$2'}. bin_elements -> bin_element : ['$1']. bin_elements -> bin_element ',' bin_elements : ['$1'|'$3']. bin_element -> bit_expr opt_bit_size_expr opt_bit_type_list : - {bin_element,?anno('$1'),'$1','$2','$3'}. + {bin_element,?line('$1'),'$1','$2','$3'}. bit_expr -> prefix_op expr_max : ?mkop1('$1', '$2'). bit_expr -> expr_max : '$1'. @@ -314,29 +319,29 @@ list_comprehension -> '[' expr '||' lc_exprs ']' : - {lc,?anno('$1'),'$2','$4'}. + {lc,?line('$1'),'$2','$4'}. binary_comprehension -> '<<' binary '||' lc_exprs '>>' : - {bc,?anno('$1'),'$2','$4'}. + {bc,?line('$1'),'$2','$4'}. lc_exprs -> lc_expr : ['$1']. lc_exprs -> lc_expr ',' lc_exprs : ['$1'|'$3']. lc_expr -> expr : '$1'. -lc_expr -> expr '<-' expr : {generate,?anno('$2'),'$1','$3'}. -lc_expr -> binary '<=' expr : {b_generate,?anno('$2'),'$1','$3'}. +lc_expr -> expr '<-' expr : {generate,?line('$2'),'$1','$3'}. +lc_expr -> binary '<=' expr : {b_generate,?line('$2'),'$1','$3'}. -tuple -> '{' '}' : {tuple,?anno('$1'),[]}. -tuple -> '{' exprs '}' : {tuple,?anno('$1'),'$2'}. +tuple -> '{' '}' : {tuple,?line('$1'),[]}. +tuple -> '{' exprs '}' : {tuple,?line('$1'),'$2'}. %%struct -> atom tuple : -%% {struct,?anno('$1'),element(3, '$1'),element(3, '$2')}. +%% {struct,?line('$1'),element(3, '$1'),element(3, '$2')}. map_expr -> '#' map_tuple : - {map, ?anno('$1'),'$2'}. + {map, ?line('$1'),'$2'}. map_expr -> expr_max '#' map_tuple : - {map, ?anno('$2'),'$1','$3'}. + {map, ?line('$2'),'$1','$3'}. map_expr -> map_expr '#' map_tuple : - {map, ?anno('$2'),'$1','$3'}. + {map, ?line('$2'),'$1','$3'}. map_tuple -> '{' '}' : []. map_tuple -> '{' map_fields '}' : '$2'. @@ -348,10 +353,10 @@ map_field -> map_field_exact : '$1'. map_field_assoc -> map_key '=>' expr : - {map_field_assoc,?anno('$1'),'$1','$3'}. + {map_field_assoc,?line('$1'),'$1','$3'}. map_field_exact -> map_key ':=' expr : - {map_field_exact,?anno('$1'),'$1','$3'}. + {map_field_exact,?line('$1'),'$1','$3'}. map_key -> expr : '$1'. @@ -361,17 +366,17 @@ %% always atoms for the moment, this might change in the future. record_expr -> '#' atom '.' atom : - {record_index,?anno('$1'),element(3, '$2'),'$4'}. + {record_index,?line('$1'),element(3, '$2'),'$4'}. record_expr -> '#' atom record_tuple : - {record,?anno('$1'),element(3, '$2'),'$3'}. + {record,?line('$1'),element(3, '$2'),'$3'}. record_expr -> expr_max '#' atom '.' atom : - {record_field,?anno('$2'),'$1',element(3, '$3'),'$5'}. + {record_field,?line('$2'),'$1',element(3, '$3'),'$5'}. record_expr -> expr_max '#' atom record_tuple : - {record,?anno('$2'),'$1',element(3, '$3'),'$4'}. + {record,?line('$2'),'$1',element(3, '$3'),'$4'}. record_expr -> record_expr '#' atom '.' atom : - {record_field,?anno('$2'),'$1',element(3, '$3'),'$5'}. + {record_field,?line('$2'),'$1',element(3, '$3'),'$5'}. record_expr -> record_expr '#' atom record_tuple : - {record,?anno('$2'),'$1',element(3, '$3'),'$4'}. + {record,?line('$2'),'$1',element(3, '$3'),'$4'}. record_tuple -> '{' '}' : []. record_tuple -> '{' record_fields '}' : '$2'. @@ -379,47 +384,47 @@ record_fields -> record_field : ['$1']. record_fields -> record_field ',' record_fields : ['$1' | '$3']. -record_field -> var '=' expr : {record_field,?anno('$1'),'$1','$3'}. -record_field -> atom '=' expr : {record_field,?anno('$1'),'$1','$3'}. +record_field -> var '=' expr : {record_field,?line('$1'),'$1','$3'}. +record_field -> atom '=' expr : {record_field,?line('$1'),'$1','$3'}. %% N.B. This is called from expr_700. function_call -> expr_800 argument_list : - {call,?anno('$1'),'$1',element(1, '$2')}. + {call,?line('$1'),'$1',element(1, '$2')}. -if_expr -> 'if' if_clauses 'end' : {'if',?anno('$1'),'$2'}. +if_expr -> 'if' if_clauses 'end' : {'if',?line('$1'),'$2'}. if_clauses -> if_clause : ['$1']. if_clauses -> if_clause ';' if_clauses : ['$1' | '$3']. if_clause -> guard clause_body : - {clause,?anno(hd(hd('$1'))),[],'$1','$2'}. + {clause,?line(hd(hd('$1'))),[],'$1','$2'}. case_expr -> 'case' expr 'of' cr_clauses 'end' : - {'case',?anno('$1'),'$2','$4'}. + {'case',?line('$1'),'$2','$4'}. cr_clauses -> cr_clause : ['$1']. cr_clauses -> cr_clause ';' cr_clauses : ['$1' | '$3']. cr_clause -> expr clause_guard clause_body : - {clause,?anno('$1'),['$1'],'$2','$3'}. + {clause,?line('$1'),['$1'],'$2','$3'}. receive_expr -> 'receive' cr_clauses 'end' : - {'receive',?anno('$1'),'$2'}. + {'receive',?line('$1'),'$2'}. receive_expr -> 'receive' 'after' expr clause_body 'end' : - {'receive',?anno('$1'),[],'$3','$4'}. + {'receive',?line('$1'),[],'$3','$4'}. receive_expr -> 'receive' cr_clauses 'after' expr clause_body 'end' : - {'receive',?anno('$1'),'$2','$4','$5'}. + {'receive',?line('$1'),'$2','$4','$5'}. fun_expr -> 'fun' atom '/' integer : - {'fun',?anno('$1'),{function,element(3, '$2'),element(3, '$4')}}. + {'fun',?line('$1'),{function,element(3, '$2'),element(3, '$4')}}. fun_expr -> 'fun' atom_or_var ':' atom_or_var '/' integer_or_var : - {'fun',?anno('$1'),{function,'$2','$4','$6'}}. + {'fun',?line('$1'),{function,'$2','$4','$6'}}. fun_expr -> 'fun' fun_clauses 'end' : - build_fun(?anno('$1'), '$2'). + build_fun(?line('$1'), '$2'). atom_or_var -> atom : '$1'. atom_or_var -> var : '$1'. @@ -431,16 +436,16 @@ fun_clauses -> fun_clause ';' fun_clauses : ['$1' | '$3']. fun_clause -> argument_list clause_guard clause_body : - {Args,Anno} = '$1', - {clause,Anno,'fun',Args,'$2','$3'}. + {Args,Pos} = '$1', + {clause,Pos,'fun',Args,'$2','$3'}. fun_clause -> var argument_list clause_guard clause_body : {clause,element(2, '$1'),element(3, '$1'),element(1, '$2'),'$3','$4'}. try_expr -> 'try' exprs 'of' cr_clauses try_catch : - build_try(?anno('$1'),'$2','$4','$5'). + build_try(?line('$1'),'$2','$4','$5'). try_expr -> 'try' exprs try_catch : - build_try(?anno('$1'),'$2',[],'$3'). + build_try(?line('$1'),'$2',[],'$3'). try_catch -> 'catch' try_clauses 'end' : {'$2',[]}. @@ -453,18 +458,18 @@ try_clauses -> try_clause ';' try_clauses : ['$1' | '$3']. try_clause -> expr clause_guard clause_body : - A = ?anno('$1'), - {clause,A,[{tuple,A,[{atom,A,throw},'$1',{var,A,'_'}]}],'$2','$3'}. + L = ?line('$1'), + {clause,L,[{tuple,L,[{atom,L,throw},'$1',{var,L,'_'}]}],'$2','$3'}. try_clause -> atom ':' expr clause_guard clause_body : - A = ?anno('$1'), - {clause,A,[{tuple,A,['$1','$3',{var,A,'_'}]}],'$4','$5'}. + L = ?line('$1'), + {clause,L,[{tuple,L,['$1','$3',{var,L,'_'}]}],'$4','$5'}. try_clause -> var ':' expr clause_guard clause_body : - A = ?anno('$1'), - {clause,A,[{tuple,A,['$1','$3',{var,A,'_'}]}],'$4','$5'}. + L = ?line('$1'), + {clause,L,[{tuple,L,['$1','$3',{var,L,'_'}]}],'$4','$5'}. -argument_list -> '(' ')' : {[],?anno('$1')}. -argument_list -> '(' exprs ')' : {'$2',?anno('$1')}. +argument_list -> '(' ')' : {[],?line('$1')}. +argument_list -> '(' exprs ')' : {'$2',?line('$1')}. exprs -> expr : ['$1']. @@ -481,7 +486,7 @@ strings -> string : '$1'. strings -> string strings : - {string,?anno('$1'),element(3, '$1') ++ element(3, '$2')}. + {string,?line('$1'),element(3, '$1') ++ element(3, '$2')}. prefix_op -> '+' : '$1'. prefix_op -> '-' : '$1'. @@ -516,21 +521,25 @@ comp_op -> '=:=' : '$1'. comp_op -> '=/=' : '$1'. +rule -> rule_clauses : build_rule('$1'). + +rule_clauses -> rule_clause : ['$1']. +rule_clauses -> rule_clause ';' rule_clauses : ['$1'|'$3']. + +rule_clause -> atom clause_args clause_guard rule_body : + {clause,?line('$1'),element(3, '$1'),'$2','$3','$4'}. + +rule_body -> ':-' lc_exprs: '$2'. + + Erlang code. -export([parse_form/1,parse_exprs/1,parse_term/1]). -export([normalise/1,abstract/1,tokens/1,tokens/2]). -export([abstract/2]). -export([inop_prec/1,preop_prec/1,func_prec/0,max_prec/0]). --export([type_inop_prec/1,type_preop_prec/1]). --export([map_anno/2, fold_anno/3, mapfold_anno/3, - new_anno/1, anno_to_term/1, anno_from_term/1]). -export([set_line/2,get_attribute/2,get_attributes/1]). --deprecated([{set_line, 2, next_major_release}, - {get_attribute, 2, next_major_release}, - {get_attributes, 1, next_major_release}]). - %% The following directive is needed for (significantly) faster compilation %% of the generated .erl file by the HiPE compiler. Please do not remove. -compile([{hipe,[{regalloc,linear_scan}]}]). @@ -538,31 +547,30 @@ -export_type([abstract_clause/0, abstract_expr/0, abstract_form/0, error_info/0]). -%% XXX. To be refined. -type abstract_clause() :: term(). -type abstract_expr() :: term(). -type abstract_form() :: term(). -type error_description() :: term(). --type error_info() :: {erl_anno:line(), module(), error_description()}. +-type error_info() :: {erl_scan:line(), module(), error_description()}. -type token() :: erl_scan:token(). -%% mkop(Op, Arg) -> {op,Anno,Op,Arg}. -%% mkop(Left, Op, Right) -> {op,Anno,Op,Left,Right}. +%% mkop(Op, Arg) -> {op,Line,Op,Arg}. +%% mkop(Left, Op, Right) -> {op,Line,Op,Left,Right}. --define(mkop2(L, OpAnno, R), +-define(mkop2(L, OpPos, R), begin - {Op,Anno} = OpAnno, - {op,Anno,Op,L,R} + {Op,Pos} = OpPos, + {op,Pos,Op,L,R} end). --define(mkop1(OpAnno, A), +-define(mkop1(OpPos, A), begin - {Op,Anno} = OpAnno, - {op,Anno,Op,A} + {Op,Pos} = OpPos, + {op,Pos,Op,A} end). -%% keep track of annotation info in tokens --define(anno(Tup), element(2, Tup)). +%% keep track of line info in tokens +-define(line(Tup), element(2, Tup)). %% Entry points compatible to old erl_parse. %% These really suck and are only here until Calle gets multiple @@ -572,10 +580,10 @@ Tokens :: [token()], AbsForm :: abstract_form(), ErrorInfo :: error_info(). -parse_form([{'-',A1},{atom,A2,spec}|Tokens]) -> - parse([{'-',A1},{'spec',A2}|Tokens]); -parse_form([{'-',A1},{atom,A2,callback}|Tokens]) -> - parse([{'-',A1},{'callback',A2}|Tokens]); +parse_form([{'-',L1},{atom,L2,spec}|Tokens]) -> + parse([{'-',L1},{'spec',L2}|Tokens]); +parse_form([{'-',L1},{atom,L2,callback}|Tokens]) -> + parse([{'-',L1},{'callback',L2}|Tokens]); parse_form(Tokens) -> parse(Tokens). @@ -584,8 +592,7 @@ ExprList :: [abstract_expr()], ErrorInfo :: error_info(). parse_exprs(Tokens) -> - A = erl_anno:new(0), - case parse([{atom,A,f},{'(',A},{')',A},{'->',A}|Tokens]) of + case parse([{atom,0,f},{'(',0},{')',0},{'->',0}|Tokens]) of {ok,{function,_Lf,f,0,[{clause,_Lc,[],[],Exprs}]}} -> {ok,Exprs}; {error,_} = Err -> Err @@ -596,43 +603,42 @@ Term :: term(), ErrorInfo :: error_info(). parse_term(Tokens) -> - A = erl_anno:new(0), - case parse([{atom,A,f},{'(',A},{')',A},{'->',A}|Tokens]) of - {ok,{function,_Af,f,0,[{clause,_Ac,[],[],[Expr]}]}} -> + case parse([{atom,0,f},{'(',0},{')',0},{'->',0}|Tokens]) of + {ok,{function,_Lf,f,0,[{clause,_Lc,[],[],[Expr]}]}} -> try normalise(Expr) of Term -> {ok,Term} catch - _:_R -> {error,{location(?anno(Expr)),?MODULE,"bad term"}} + _:_R -> {error,{?line(Expr),?MODULE,"bad term"}} end; - {ok,{function,_Af,f,A,[{clause,_Ac,[],[],[_E1,E2|_Es]}]}} -> - {error,{location(?anno(E2)),?MODULE,"bad term"}}; + {ok,{function,_Lf,f,0,[{clause,_Lc,[],[],[_E1,E2|_Es]}]}} -> + {error,{?line(E2),?MODULE,"bad term"}}; {error,_} = Err -> Err end. -type attributes() :: 'export' | 'file' | 'import' | 'module' | 'opaque' | 'record' | 'type'. -build_typed_attribute({atom,Aa,record}, - {typed_record, {atom,_An,RecordName}, RecTuple}) -> - {attribute,Aa,record,{RecordName,record_tuple(RecTuple)}}; -build_typed_attribute({atom,Aa,Attr}, +build_typed_attribute({atom,La,record}, + {typed_record, {atom,_Ln,RecordName}, RecTuple}) -> + {attribute,La,record,{RecordName,record_tuple(RecTuple)}}; +build_typed_attribute({atom,La,Attr}, {type_def, {call,_,{atom,_,TypeName},Args}, Type}) when Attr =:= 'type' ; Attr =:= 'opaque' -> case lists:all(fun({var, _, _}) -> true; (_) -> false end, Args) of - true -> {attribute,Aa,Attr,{TypeName,Type,Args}}; - false -> error_bad_decl(Aa, Attr) + true -> {attribute,La,Attr,{TypeName,Type,Args}}; + false -> error_bad_decl(La, Attr) end; -build_typed_attribute({atom,Aa,Attr},_) -> +build_typed_attribute({atom,La,Attr},_) -> case Attr of - record -> error_bad_decl(Aa, record); - type -> error_bad_decl(Aa, type); - opaque -> error_bad_decl(Aa, opaque); - _ -> ret_err(Aa, "bad attribute") + record -> error_bad_decl(La, record); + type -> error_bad_decl(La, type); + opaque -> error_bad_decl(La, opaque); + _ -> ret_err(La, "bad attribute") end. -build_type_spec({Kind,Aa}, {SpecFun, TypeSpecs}) +build_type_spec({Kind,La}, {SpecFun, TypeSpecs}) when (Kind =:= spec) or (Kind =:= callback) -> NewSpecFun = case SpecFun of @@ -647,7 +653,7 @@ %% Old style spec. Allow this for now. {Mod,Fun,Arity} end, - {attribute,Aa,Kind,{NewSpecFun, TypeSpecs}}. + {attribute,La,Kind,{NewSpecFun, TypeSpecs}}. find_arity_from_specs([Spec|_]) -> %% Use the first spec to find the arity. If all are not the same, @@ -659,209 +665,204 @@ {type, _, 'fun', [{type, _, product, Args},_]} = Fun, length(Args). -build_def({var, A, '_'}, _Types) -> - ret_err(A, "bad type variable"); build_def(LHS, Types) -> - IsSubType = {atom, ?anno(LHS), is_subtype}, - {type, ?anno(LHS), constraint, [IsSubType, [LHS, Types]]}. + IsSubType = {atom, ?line(LHS), is_subtype}, + {type, ?line(LHS), constraint, [IsSubType, [LHS, Types]]}. -lift_unions(T1, {type, _Aa, union, List}) -> - {type, ?anno(T1), union, [T1|List]}; +lift_unions(T1, {type, _La, union, List}) -> + {type, ?line(T1), union, [T1|List]}; lift_unions(T1, T2) -> - {type, ?anno(T1), union, [T1, T2]}. + {type, ?line(T1), union, [T1, T2]}. -build_gen_type({atom, Aa, tuple}) -> - {type, Aa, tuple, any}; -build_gen_type({atom, Aa, map}) -> - {type, Aa, map, any}; -build_gen_type({atom, Aa, Name}) -> - Tag = type_tag(Name, 0), - {Tag, Aa, Name, []}. +skip_paren({paren_type,_L,[Type]}) -> + skip_paren(Type); +skip_paren(Type) -> + Type. + +build_gen_type({atom, La, tuple}) -> + {type, La, tuple, any}; +build_gen_type({atom, La, map}) -> + {type, La, map, any}; +build_gen_type({atom, La, Name}) -> + {type, La, Name, []}. build_bin_type([{var, _, '_'}|Left], Int) -> build_bin_type(Left, Int); build_bin_type([], Int) -> - Int; -build_bin_type([{var, Aa, _}|_], _) -> - ret_err(Aa, "Bad binary type"). - -build_type({atom, A, Name}, Types) -> - Tag = type_tag(Name, length(Types)), - {Tag, A, Name, Types}. - -type_tag(TypeName, NumberOfTypeVariables) -> - case erl_internal:is_type(TypeName, NumberOfTypeVariables) of - true -> type; - false -> user_type - end. - -abstract2(Term, Anno) -> - Line = erl_anno:line(Anno), - abstract(Term, Line). + skip_paren(Int); +build_bin_type([{var, La, _}|_], _) -> + ret_err(La, "Bad binary type"). %% build_attribute(AttrName, AttrValue) -> -%% {attribute,Anno,module,Module} -%% {attribute,Anno,export,Exports} -%% {attribute,Anno,import,Imports} -%% {attribute,Anno,record,{Name,Inits}} -%% {attribute,Anno,file,{Name,Line}} -%% {attribute,Anno,Name,Val} +%% {attribute,Line,module,Module} +%% {attribute,Line,export,Exports} +%% {attribute,Line,import,Imports} +%% {attribute,Line,record,{Name,Inits}} +%% {attribute,Line,file,{Name,Line}} +%% {attribute,Line,Name,Val} -build_attribute({atom,Aa,module}, Val) -> +build_attribute({atom,La,module}, Val) -> case Val of - [{atom,_Am,Module}] -> - {attribute,Aa,module,Module}; - [{atom,_Am,Module},ExpList] -> - {attribute,Aa,module,{Module,var_list(ExpList)}}; + [{atom,_Lm,Module}] -> + {attribute,La,module,Module}; + [{atom,_Lm,Module},ExpList] -> + {attribute,La,module,{Module,var_list(ExpList)}}; _Other -> - error_bad_decl(Aa, module) + error_bad_decl(La, module) end; -build_attribute({atom,Aa,export}, Val) -> +build_attribute({atom,La,export}, Val) -> case Val of [ExpList] -> - {attribute,Aa,export,farity_list(ExpList)}; - _Other -> error_bad_decl(Aa, export) + {attribute,La,export,farity_list(ExpList)}; + _Other -> error_bad_decl(La, export) end; -build_attribute({atom,Aa,import}, Val) -> +build_attribute({atom,La,import}, Val) -> case Val of - [{atom,_Am,Mod},ImpList] -> - {attribute,Aa,import,{Mod,farity_list(ImpList)}}; - _Other -> error_bad_decl(Aa, import) + [{atom,_Lm,Mod},ImpList] -> + {attribute,La,import,{Mod,farity_list(ImpList)}}; + _Other -> error_bad_decl(La, import) end; -build_attribute({atom,Aa,record}, Val) -> +build_attribute({atom,La,record}, Val) -> case Val of - [{atom,_An,Record},RecTuple] -> - {attribute,Aa,record,{Record,record_tuple(RecTuple)}}; - _Other -> error_bad_decl(Aa, record) + [{atom,_Ln,Record},RecTuple] -> + {attribute,La,record,{Record,record_tuple(RecTuple)}}; + _Other -> error_bad_decl(La, record) end; -build_attribute({atom,Aa,file}, Val) -> +build_attribute({atom,La,file}, Val) -> case Val of - [{string,_An,Name},{integer,_Al,Line}] -> - {attribute,Aa,file,{Name,Line}}; - _Other -> error_bad_decl(Aa, file) + [{string,_Ln,Name},{integer,_Ll,Line}] -> + {attribute,La,file,{Name,Line}}; + _Other -> error_bad_decl(La, file) end; -build_attribute({atom,Aa,Attr}, Val) -> +build_attribute({atom,La,Attr}, Val) -> case Val of [Expr0] -> Expr = attribute_farity(Expr0), - {attribute,Aa,Attr,term(Expr)}; - _Other -> ret_err(Aa, "bad attribute") + {attribute,La,Attr,term(Expr)}; + _Other -> ret_err(La, "bad attribute") end. -var_list({cons,_Ac,{var,_,V},Tail}) -> +var_list({cons,_Lc,{var,_,V},Tail}) -> [V|var_list(Tail)]; -var_list({nil,_An}) -> []; +var_list({nil,_Ln}) -> []; var_list(Other) -> - ret_err(?anno(Other), "bad variable list"). + ret_err(?line(Other), "bad variable list"). -attribute_farity({cons,A,H,T}) -> - {cons,A,attribute_farity(H),attribute_farity(T)}; -attribute_farity({tuple,A,Args0}) -> +attribute_farity({cons,L,H,T}) -> + {cons,L,attribute_farity(H),attribute_farity(T)}; +attribute_farity({tuple,L,Args0}) -> Args = attribute_farity_list(Args0), - {tuple,A,Args}; -attribute_farity({map,A,Args0}) -> - Args = attribute_farity_map(Args0), - {map,A,Args}; -attribute_farity({op,A,'/',{atom,_,_}=Name,{integer,_,_}=Arity}) -> - {tuple,A,[Name,Arity]}; + {tuple,L,Args}; +attribute_farity({op,L,'/',{atom,_,_}=Name,{integer,_,_}=Arity}) -> + {tuple,L,[Name,Arity]}; attribute_farity(Other) -> Other. attribute_farity_list(Args) -> [attribute_farity(A) || A <- Args]. -%% It is not meaningful to have farity keys. -attribute_farity_map(Args) -> - [{Op,A,K,attribute_farity(V)} || {Op,A,K,V} <- Args]. +-spec error_bad_decl(integer(), attributes()) -> no_return(). --spec error_bad_decl(erl_anno:anno(), attributes()) -> no_return(). +error_bad_decl(L, S) -> + ret_err(L, io_lib:format("bad ~w declaration", [S])). -error_bad_decl(Anno, S) -> - ret_err(Anno, io_lib:format("bad ~w declaration", [S])). - -farity_list({cons,_Ac,{op,_Ao,'/',{atom,_Aa,A},{integer,_Ai,I}},Tail}) -> +farity_list({cons,_Lc,{op,_Lo,'/',{atom,_La,A},{integer,_Li,I}},Tail}) -> [{A,I}|farity_list(Tail)]; -farity_list({nil,_An}) -> []; +farity_list({nil,_Ln}) -> []; farity_list(Other) -> - ret_err(?anno(Other), "bad function arity"). + ret_err(?line(Other), "bad function arity"). -record_tuple({tuple,_At,Fields}) -> +record_tuple({tuple,_Lt,Fields}) -> record_fields(Fields); record_tuple(Other) -> - ret_err(?anno(Other), "bad record declaration"). + ret_err(?line(Other), "bad record declaration"). -record_fields([{atom,Aa,A}|Fields]) -> - [{record_field,Aa,{atom,Aa,A}}|record_fields(Fields)]; -record_fields([{match,_Am,{atom,Aa,A},Expr}|Fields]) -> - [{record_field,Aa,{atom,Aa,A},Expr}|record_fields(Fields)]; +record_fields([{atom,La,A}|Fields]) -> + [{record_field,La,{atom,La,A}}|record_fields(Fields)]; +record_fields([{match,_Lm,{atom,La,A},Expr}|Fields]) -> + [{record_field,La,{atom,La,A},Expr}|record_fields(Fields)]; record_fields([{typed,Expr,TypeInfo}|Fields]) -> [Field] = record_fields([Expr]), TypeInfo1 = case Expr of {match, _, _, _} -> TypeInfo; %% If we have an initializer. - {atom, Aa, _} -> + {atom, La, _} -> case has_undefined(TypeInfo) of false -> - lift_unions(abstract2(undefined, Aa), TypeInfo); + TypeInfo2 = maybe_add_paren(TypeInfo), + lift_unions(abstract(undefined, La), TypeInfo2); true -> TypeInfo end end, [{typed_record_field,Field,TypeInfo1}|record_fields(Fields)]; record_fields([Other|_Fields]) -> - ret_err(?anno(Other), "bad record field"); + ret_err(?line(Other), "bad record field"); record_fields([]) -> []. has_undefined({atom,_,undefined}) -> true; has_undefined({ann_type,_,[_,T]}) -> has_undefined(T); +has_undefined({paren_type,_,[T]}) -> + has_undefined(T); has_undefined({type,_,union,Ts}) -> lists:any(fun has_undefined/1, Ts); has_undefined(_) -> false. +maybe_add_paren({ann_type,L,T}) -> + {paren_type,L,[{ann_type,L,T}]}; +maybe_add_paren(T) -> + T. + term(Expr) -> try normalise(Expr) - catch _:_R -> ret_err(?anno(Expr), "bad attribute") + catch _:_R -> ret_err(?line(Expr), "bad attribute") end. -%% build_function([Clause]) -> {function,Anno,Name,Arity,[Clause]} +%% build_function([Clause]) -> {function,Line,Name,Arity,[Clause]} build_function(Cs) -> Name = element(3, hd(Cs)), Arity = length(element(4, hd(Cs))), - {function,?anno(hd(Cs)),Name,Arity,check_clauses(Cs, Name, Arity)}. + {function,?line(hd(Cs)),Name,Arity,check_clauses(Cs, Name, Arity)}. + +%% build_rule([Clause]) -> {rule,Line,Name,Arity,[Clause]'} + +build_rule(Cs) -> + Name = element(3, hd(Cs)), + Arity = length(element(4, hd(Cs))), + {rule,?line(hd(Cs)),Name,Arity,check_clauses(Cs, Name, Arity)}. -%% build_fun(Anno, [Clause]) -> {'fun',Anno,{clauses,[Clause]}}. +%% build_fun(Line, [Clause]) -> {'fun',Line,{clauses,[Clause]}}. -build_fun(Anno, Cs) -> +build_fun(Line, Cs) -> Name = element(3, hd(Cs)), Arity = length(element(4, hd(Cs))), CheckedCs = check_clauses(Cs, Name, Arity), case Name of 'fun' -> - {'fun',Anno,{clauses,CheckedCs}}; + {'fun',Line,{clauses,CheckedCs}}; Name -> - {named_fun,Anno,Name,CheckedCs} + {named_fun,Line,Name,CheckedCs} end. check_clauses(Cs, Name, Arity) -> [case C of - {clause,A,N,As,G,B} when N =:= Name, length(As) =:= Arity -> - {clause,A,As,G,B}; - {clause,A,_N,_As,_G,_B} -> - ret_err(A, "head mismatch") + {clause,L,N,As,G,B} when N =:= Name, length(As) =:= Arity -> + {clause,L,As,G,B}; + {clause,L,_N,_As,_G,_B} -> + ret_err(L, "head mismatch") end || C <- Cs]. -build_try(A,Es,Scs,{Ccs,As}) -> - {'try',A,Es,Scs,Ccs,As}. +build_try(L,Es,Scs,{Ccs,As}) -> + {'try',L,Es,Scs,Ccs,As}. -spec ret_err(_, _) -> no_return(). -ret_err(Anno, S) -> - return_error(location(Anno), S). +ret_err(L, S) -> + {location,Location} = get_attribute(L, location), + return_error(Location, S). -location(Anno) -> - erl_anno:location(Anno). %% Convert between the abstract form of a term and a term. @@ -909,8 +910,7 @@ Data :: term(), AbsTerm :: abstract_expr(). abstract(T) -> - Anno = erl_anno:new(0), - abstract(T, Anno, enc_func(epp:default_encoding())). + abstract(T, 0, enc_func(epp:default_encoding())). -type encoding_func() :: fun((non_neg_integer()) -> boolean()). @@ -920,18 +920,16 @@ Options :: Line | [Option], Option :: {line, Line} | {encoding, Encoding}, Encoding :: 'latin1' | 'unicode' | 'utf8' | 'none' | encoding_func(), - Line :: erl_anno:line(), + Line :: erl_scan:line(), AbsTerm :: abstract_expr(). abstract(T, Line) when is_integer(Line) -> - Anno = erl_anno:new(Line), - abstract(T, Anno, enc_func(epp:default_encoding())); + abstract(T, Line, enc_func(epp:default_encoding())); abstract(T, Options) when is_list(Options) -> Line = proplists:get_value(line, Options, 0), Encoding = proplists:get_value(encoding, Options,epp:default_encoding()), EncFunc = enc_func(Encoding), - Anno = erl_anno:new(Line), - abstract(T, Anno, EncFunc). + abstract(T, Line, EncFunc). -define(UNICODE(C), (C < 16#D800 orelse @@ -945,53 +943,48 @@ enc_func(Fun) when is_function(Fun, 1) -> Fun; enc_func(Term) -> erlang:error({badarg, Term}). -abstract(T, A, _E) when is_integer(T) -> {integer,A,T}; -abstract(T, A, _E) when is_float(T) -> {float,A,T}; -abstract(T, A, _E) when is_atom(T) -> {atom,A,T}; -abstract([], A, _E) -> {nil,A}; -abstract(B, A, _E) when is_bitstring(B) -> - {bin, A, [abstract_byte(Byte, A) || Byte <- bitstring_to_list(B)]}; -abstract([H|T], A, none=E) -> - {cons,A,abstract(H, A, E),abstract(T, A, E)}; -abstract(List, A, E) when is_list(List) -> - abstract_list(List, [], A, E); -abstract(Tuple, A, E) when is_tuple(Tuple) -> - {tuple,A,abstract_tuple_list(tuple_to_list(Tuple), A, E)}; -abstract(Map, A, E) when is_map(Map) -> - {map,A,abstract_map_fields(maps:to_list(Map),A,E)}. +abstract(T, L, _E) when is_integer(T) -> {integer,L,T}; +abstract(T, L, _E) when is_float(T) -> {float,L,T}; +abstract(T, L, _E) when is_atom(T) -> {atom,L,T}; +abstract([], L, _E) -> {nil,L}; +abstract(B, L, _E) when is_bitstring(B) -> + {bin, L, [abstract_byte(Byte, L) || Byte <- bitstring_to_list(B)]}; +abstract([H|T], L, none=E) -> + {cons,L,abstract(H, L, E),abstract(T, L, E)}; +abstract(List, L, E) when is_list(List) -> + abstract_list(List, [], L, E); +abstract(Tuple, L, E) when is_tuple(Tuple) -> + {tuple,L,abstract_tuple_list(tuple_to_list(Tuple), L, E)}. -abstract_list([H|T], String, A, E) -> +abstract_list([H|T], String, L, E) -> case is_integer(H) andalso H >= 0 andalso E(H) of true -> - abstract_list(T, [H|String], A, E); + abstract_list(T, [H|String], L, E); false -> - AbstrList = {cons,A,abstract(H, A, E),abstract(T, A, E)}, - not_string(String, AbstrList, A, E) + AbstrList = {cons,L,abstract(H, L, E),abstract(T, L, E)}, + not_string(String, AbstrList, L, E) end; -abstract_list([], String, A, _E) -> - {string, A, lists:reverse(String)}; -abstract_list(T, String, A, E) -> - not_string(String, abstract(T, A, E), A, E). - -not_string([C|T], Result, A, E) -> - not_string(T, {cons, A, {integer, A, C}, Result}, A, E); -not_string([], Result, _A, _E) -> +abstract_list([], String, L, _E) -> + {string, L, lists:reverse(String)}; +abstract_list(T, String, L, E) -> + not_string(String, abstract(T, L, E), L, E). + +not_string([C|T], Result, L, E) -> + not_string(T, {cons, L, {integer, L, C}, Result}, L, E); +not_string([], Result, _L, _E) -> Result. -abstract_tuple_list([H|T], A, E) -> - [abstract(H, A, E)|abstract_tuple_list(T, A, E)]; -abstract_tuple_list([], _A, _E) -> +abstract_tuple_list([H|T], L, E) -> + [abstract(H, L, E)|abstract_tuple_list(T, L, E)]; +abstract_tuple_list([], _L, _E) -> []. -abstract_map_fields(Fs,A,E) -> - [{map_field_assoc,A,abstract(K,A,E),abstract(V,A,E)}||{K,V}<-Fs]. - -abstract_byte(Byte, A) when is_integer(Byte) -> - {bin_element, A, {integer, A, Byte}, default, default}; -abstract_byte(Bits, A) -> +abstract_byte(Byte, L) when is_integer(Byte) -> + {bin_element, L, {integer, L, Byte}, default, default}; +abstract_byte(Bits, L) -> Sz = bit_size(Bits), <> = Bits, - {bin_element, A, {integer, A, Val}, {integer, A, Sz}, default}. + {bin_element, L, {integer, L, Val}, {integer, L, Sz}, default}. %% Generate a list of tokens representing the abstract term. @@ -1005,32 +998,32 @@ AbsTerm :: abstract_expr(), MoreTokens :: [token()], Tokens :: [token()]. -tokens({char,A,C}, More) -> [{char,A,C}|More]; -tokens({integer,A,N}, More) -> [{integer,A,N}|More]; -tokens({float,A,F}, More) -> [{float,A,F}|More]; -tokens({atom,Aa,A}, More) -> [{atom,Aa,A}|More]; -tokens({var,A,V}, More) -> [{var,A,V}|More]; -tokens({string,A,S}, More) -> [{string,A,S}|More]; -tokens({nil,A}, More) -> [{'[',A},{']',A}|More]; -tokens({cons,A,Head,Tail}, More) -> - [{'[',A}|tokens(Head, tokens_tail(Tail, More))]; -tokens({tuple,A,[]}, More) -> - [{'{',A},{'}',A}|More]; -tokens({tuple,A,[E|Es]}, More) -> - [{'{',A}|tokens(E, tokens_tuple(Es, ?anno(E), More))]. - -tokens_tail({cons,A,Head,Tail}, More) -> - [{',',A}|tokens(Head, tokens_tail(Tail, More))]; -tokens_tail({nil,A}, More) -> - [{']',A}|More]; +tokens({char,L,C}, More) -> [{char,L,C}|More]; +tokens({integer,L,N}, More) -> [{integer,L,N}|More]; +tokens({float,L,F}, More) -> [{float,L,F}|More]; +tokens({atom,L,A}, More) -> [{atom,L,A}|More]; +tokens({var,L,V}, More) -> [{var,L,V}|More]; +tokens({string,L,S}, More) -> [{string,L,S}|More]; +tokens({nil,L}, More) -> [{'[',L},{']',L}|More]; +tokens({cons,L,Head,Tail}, More) -> + [{'[',L}|tokens(Head, tokens_tail(Tail, More))]; +tokens({tuple,L,[]}, More) -> + [{'{',L},{'}',L}|More]; +tokens({tuple,L,[E|Es]}, More) -> + [{'{',L}|tokens(E, tokens_tuple(Es, ?line(E), More))]. + +tokens_tail({cons,L,Head,Tail}, More) -> + [{',',L}|tokens(Head, tokens_tail(Tail, More))]; +tokens_tail({nil,L}, More) -> + [{']',L}|More]; tokens_tail(Other, More) -> - A = ?anno(Other), - [{'|',A}|tokens(Other, [{']',A}|More])]. + L = ?line(Other), + [{'|',L}|tokens(Other, [{']',L}|More])]. -tokens_tuple([E|Es], Anno, More) -> - [{',',Anno}|tokens(E, tokens_tuple(Es, ?anno(E), More))]; -tokens_tuple([], Anno, More) -> - [{'}',Anno}|More]. +tokens_tuple([E|Es], Line, More) -> + [{',',Line}|tokens(E, tokens_tuple(Es, ?line(E), More))]; +tokens_tuple([], Line, More) -> + [{'}',Line}|More]. %% Give the relative precedences of operators. @@ -1085,39 +1078,6 @@ max_prec() -> 900. --type prec() :: non_neg_integer(). - --type type_inop() :: '::' | '|' | '..' | '+' | '-' | 'bor' | 'bxor' - | 'bsl' | 'bsr' | '*' | '/' | 'div' | 'rem' | 'band'. - --type type_preop() :: '+' | '-' | 'bnot' | '#'. - --spec type_inop_prec(type_inop()) -> {prec(), prec(), prec()}. - -type_inop_prec('=') -> {150,100,100}; -type_inop_prec('::') -> {160,150,150}; -type_inop_prec('|') -> {180,170,170}; -type_inop_prec('..') -> {300,200,300}; -type_inop_prec('+') -> {400,400,500}; -type_inop_prec('-') -> {400,400,500}; -type_inop_prec('bor') -> {400,400,500}; -type_inop_prec('bxor') -> {400,400,500}; -type_inop_prec('bsl') -> {400,400,500}; -type_inop_prec('bsr') -> {400,400,500}; -type_inop_prec('*') -> {500,500,600}; -type_inop_prec('/') -> {500,500,600}; -type_inop_prec('div') -> {500,500,600}; -type_inop_prec('rem') -> {500,500,600}; -type_inop_prec('band') -> {500,500,600}; -type_inop_prec('#') -> {800,700,800}. - --spec type_preop_prec(type_preop()) -> {prec(), prec()}. - -type_preop_prec('+') -> {600,700}; -type_preop_prec('-') -> {600,700}; -type_preop_prec('bnot') -> {600,700}; -type_preop_prec('#') -> {700,800}. - %%% [Experimental]. The parser just copies the attributes of the %%% scanner tokens to the abstract format. This design decision has %%% been hidden to some extent: use set_line() and get_attribute() to @@ -1128,168 +1088,13 @@ %%% longer apply. To get all present attributes as a property list %%% get_attributes() should be used. --compile({nowarn_deprecated_function,{erl_scan,set_attribute,3}}). set_line(L, F) -> erl_scan:set_attribute(line, L, F). --compile({nowarn_deprecated_function,{erl_scan,attributes_info,2}}). get_attribute(L, Name) -> erl_scan:attributes_info(L, Name). --compile({nowarn_deprecated_function,{erl_scan,attributes_info,1}}). get_attributes(L) -> erl_scan:attributes_info(L). --spec map_anno(Fun, Abstr) -> NewAbstr when - Fun :: fun((Anno) -> Anno), - Anno :: erl_anno:anno(), - Abstr :: abstract_form() | abstract_expr(), - NewAbstr :: abstract_form() | abstract_expr(). - -map_anno(F0, Abstr) -> - F = fun(A, Acc) -> {F0(A), Acc} end, - {NewAbstr, []} = modify_anno1(Abstr, [], F), - NewAbstr. - --spec fold_anno(Fun, Acc0, Abstr) -> NewAbstr when - Fun :: fun((Anno, AccIn) -> AccOut), - Anno :: erl_anno:anno(), - Acc0 :: term(), - AccIn :: term(), - AccOut :: term(), - Abstr :: abstract_form() | abstract_expr(), - NewAbstr :: abstract_form() | abstract_expr(). - -fold_anno(F0, Acc0, Abstr) -> - F = fun(A, Acc) -> {A, F0(A, Acc)} end, - {_, NewAcc} = modify_anno1(Abstr, Acc0, F), - NewAcc. - --spec mapfold_anno(Fun, Acc0, Abstr) -> {NewAbstr, Acc1} when - Fun :: fun((Anno, AccIn) -> {Anno, AccOut}), - Anno :: erl_anno:anno(), - Acc0 :: term(), - Acc1 :: term(), - AccIn :: term(), - AccOut :: term(), - Abstr :: abstract_form() | abstract_expr(), - NewAbstr :: abstract_form() | abstract_expr(). - -mapfold_anno(F, Acc0, Abstr) -> - modify_anno1(Abstr, Acc0, F). - --spec new_anno(Term) -> Abstr when - Term :: term(), - Abstr :: abstract_form() | abstract_expr(). - -new_anno(Term) -> - map_anno(fun erl_anno:new/1, Term). - --spec anno_to_term(Abstr) -> term() when - Abstr :: abstract_form() | abstract_expr(). - -anno_to_term(Abstract) -> - map_anno(fun erl_anno:to_term/1, Abstract). - --spec anno_from_term(Term) -> abstract_form() | abstract_expr() when - Term :: term(). - -anno_from_term(Term) -> - map_anno(fun erl_anno:from_term/1, Term). - -%% Forms. -%% Recognize what sys_pre_expand does: -modify_anno1({'fun',A,F,{_,_,_}=Id}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {F1,Ac2} = modify_anno1(F, Ac1, Mf), - {{'fun',A1,F1,Id},Ac2}; -modify_anno1({named_fun,A,N,F,{_,_,_}=Id}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {F1,Ac2} = modify_anno1(F, Ac1, Mf), - {{named_fun,A1,N,F1,Id},Ac2}; -modify_anno1({attribute,A,N,[V]}, Ac, Mf) -> - {{attribute,A1,N1,V1},Ac1} = modify_anno1({attribute,A,N,V}, Ac, Mf), - {{attribute,A1,N1,[V1]},Ac1}; -%% End of sys_pre_expand special forms. -modify_anno1({function,F,A}, Ac, _Mf) -> - {{function,F,A},Ac}; -modify_anno1({function,M,F,A}, Ac, Mf) -> - {M1,Ac1} = modify_anno1(M, Ac, Mf), - {F1,Ac2} = modify_anno1(F, Ac1, Mf), - {A1,Ac3} = modify_anno1(A, Ac2, Mf), - {{function,M1,F1,A1},Ac3}; -modify_anno1({attribute,A,record,{Name,Fields}}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {Fields1,Ac2} = modify_anno1(Fields, Ac1, Mf), - {{attribute,A1,record,{Name,Fields1}},Ac2}; -modify_anno1({attribute,A,spec,{Fun,Types}}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {Types1,Ac2} = modify_anno1(Types, Ac1, Mf), - {{attribute,A1,spec,{Fun,Types1}},Ac2}; -modify_anno1({attribute,A,callback,{Fun,Types}}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {Types1,Ac2} = modify_anno1(Types, Ac1, Mf), - {{attribute,A1,callback,{Fun,Types1}},Ac2}; -modify_anno1({attribute,A,type,{TypeName,TypeDef,Args}}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {TypeDef1,Ac2} = modify_anno1(TypeDef, Ac1, Mf), - {Args1,Ac3} = modify_anno1(Args, Ac2, Mf), - {{attribute,A1,type,{TypeName,TypeDef1,Args1}},Ac3}; -modify_anno1({attribute,A,opaque,{TypeName,TypeDef,Args}}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {TypeDef1,Ac2} = modify_anno1(TypeDef, Ac1, Mf), - {Args1,Ac3} = modify_anno1(Args, Ac2, Mf), - {{attribute,A1,opaque,{TypeName,TypeDef1,Args1}},Ac3}; -modify_anno1({attribute,A,Attr,Val}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {{attribute,A1,Attr,Val},Ac1}; -modify_anno1({warning,W}, Ac, _Mf) -> - {{warning,W},Ac}; -modify_anno1({error,W}, Ac, _Mf) -> - {{error,W},Ac}; -%% Expressions. -modify_anno1({clauses,Cs}, Ac, Mf) -> - {Cs1,Ac1} = modify_anno1(Cs, Ac, Mf), - {{clauses,Cs1},Ac1}; -modify_anno1({typed_record_field,Field,Type}, Ac, Mf) -> - {Field1,Ac1} = modify_anno1(Field, Ac, Mf), - {Type1,Ac2} = modify_anno1(Type, Ac1, Mf), - {{typed_record_field,Field1,Type1},Ac2}; -modify_anno1({Tag,A}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {{Tag,A1},Ac1}; -modify_anno1({Tag,A,E1}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {E11,Ac2} = modify_anno1(E1, Ac1, Mf), - {{Tag,A1,E11},Ac2}; -modify_anno1({Tag,A,E1,E2}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {E11,Ac2} = modify_anno1(E1, Ac1, Mf), - {E21,Ac3} = modify_anno1(E2, Ac2, Mf), - {{Tag,A1,E11,E21},Ac3}; -modify_anno1({bin_element,A,E1,E2,TSL}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {E11,Ac2} = modify_anno1(E1, Ac1, Mf), - {E21,Ac3} = modify_anno1(E2, Ac2, Mf), - {{bin_element,A1,E11,E21, TSL},Ac3}; -modify_anno1({Tag,A,E1,E2,E3}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {E11,Ac2} = modify_anno1(E1, Ac1, Mf), - {E21,Ac3} = modify_anno1(E2, Ac2, Mf), - {E31,Ac4} = modify_anno1(E3, Ac3, Mf), - {{Tag,A1,E11,E21,E31},Ac4}; -modify_anno1({Tag,A,E1,E2,E3,E4}, Ac, Mf) -> - {A1,Ac1} = Mf(A, Ac), - {E11,Ac2} = modify_anno1(E1, Ac1, Mf), - {E21,Ac3} = modify_anno1(E2, Ac2, Mf), - {E31,Ac4} = modify_anno1(E3, Ac3, Mf), - {E41,Ac5} = modify_anno1(E4, Ac4, Mf), - {{Tag,A1,E11,E21,E31,E41},Ac5}; -modify_anno1([H|T], Ac, Mf) -> - {H1,Ac1} = modify_anno1(H, Ac, Mf), - {T1,Ac2} = modify_anno1(T, Ac1, Mf), - {[H1|T1],Ac2}; -modify_anno1([], Ac, _Mf) -> {[],Ac}; -modify_anno1(E, Ac, _Mf) when not is_tuple(E), not is_list(E) -> {E,Ac}. - %% vim: ft=erlang diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_posix_msg.erl erlang-17.3-dfsg/lib/stdlib/src/erl_posix_msg.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_posix_msg.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_posix_msg.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_pp.erl erlang-17.3-dfsg/lib/stdlib/src/erl_pp.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_pp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_pp.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,13 +22,12 @@ %%% the parser. It does not always produce pretty code. -export([form/1,form/2, - attribute/1,attribute/2,function/1,function/2, + attribute/1,attribute/2,function/1,function/2,rule/1,rule/2, guard/1,guard/2,exprs/1,exprs/2,exprs/3,expr/1,expr/2,expr/3,expr/4]). -import(lists, [append/1,foldr/3,mapfoldl/3,reverse/1,reverse/2]). -import(io_lib, [write/1,format/2]). --import(erl_parse, [inop_prec/1,preop_prec/1,func_prec/0,max_prec/0, - type_inop_prec/1, type_preop_prec/1]). +-import(erl_parse, [inop_prec/1,preop_prec/1,func_prec/0,max_prec/0]). -define(MAXLINE, 72). @@ -48,23 +46,6 @@ -record(options, {hook, encoding, opts}). -%-define(DEBUG, true). - --ifdef(DEBUG). --define(TEST(T), - %% Assumes that erl_anno has been compiled with DEBUG=true. - %% erl_pp does not use the annoations, but test it anyway. - %% Note: hooks are not handled. - _ = try - erl_parse:map_anno(fun(A) when is_list(A) -> A end, T) - catch - _:_ -> - erlang:error(badarg, [T]) - end). --else. --define(TEST(T), ok). --endif. - %%% %%% Exported functions %%% @@ -80,7 +61,6 @@ Options :: options()). form(Thing, Options) -> - ?TEST(Thing), State = state(Options), frmt(lform(Thing, options(Options), State), State). @@ -95,7 +75,6 @@ Options :: options()). attribute(Thing, Options) -> - ?TEST(Thing), State = state(Options), frmt(lattribute(Thing, options(Options), State), State). @@ -110,9 +89,14 @@ Options :: options()). function(F, Options) -> - ?TEST(F), frmt(lfunction(F, options(Options)), state(Options)). +rule(R) -> + rule(R, none). + +rule(R, Options) -> + frmt(lrule(R, options(Options)), state(Options)). + -spec(guard(Guard) -> io_lib:chars() when Guard :: [erl_parse:abstract_expr()]). @@ -124,7 +108,6 @@ Options :: options()). guard(Gs, Options) -> - ?TEST(Gs), frmt(lguard(Gs, options(Options)), state(Options)). -spec(exprs(Expressions) -> io_lib:chars() when @@ -146,14 +129,12 @@ Options :: options()). exprs(Es, I, Options) -> - ?TEST(Es), frmt({seq,[],[],[$,],lexprs(Es, options(Options))}, I, state(Options)). -spec(expr(Expression) -> io_lib:chars() when Expression :: erl_parse:abstract_expr()). expr(E) -> - ?TEST(E), frmt(lexpr(E, 0, options(none)), state(none)). -spec(expr(Expression, Options) -> io_lib:chars() when @@ -161,7 +142,6 @@ Options :: options()). expr(E, Options) -> - ?TEST(E), frmt(lexpr(E, 0, options(Options)), state(Options)). -spec(expr(Expression, Indent, Options) -> io_lib:chars() when @@ -170,7 +150,6 @@ Options :: options()). expr(E, I, Options) -> - ?TEST(E), frmt(lexpr(E, 0, options(Options)), I, state(Options)). -spec(expr(Expression, Indent, Precedence, Options) -> io_lib:chars() when @@ -180,7 +159,6 @@ Options :: options()). expr(E, I, P, Options) -> - ?TEST(E), frmt(lexpr(E, P, options(Options)), I, state(Options)). %%% @@ -221,6 +199,8 @@ lattribute({attribute,Line,Name,Arg}, Opts, State); lform({function,Line,Name,Arity,Clauses}, Opts, _State) -> lfunction({function,Line,Name,Arity,Clauses}, Opts); +lform({rule,Line,Name,Arity,Clauses}, Opts, _State) -> + lrule({rule,Line,Name,Arity,Clauses}, Opts); %% These are specials to make it easier for the compiler. lform({error,E}, _Opts, _State) -> leaf(format("~p\n", [{error,E}])); @@ -241,97 +221,69 @@ [lattribute(Name, Arg, Opts, State),leaf(".\n")]. lattribute(module, {M,Vs}, _Opts, _State) -> - A = a0(), - attr("module",[{var,A,pname(M)}, - foldr(fun(V, C) -> {cons,A,{var,A,V},C} - end, {nil,A}, Vs)]); + attr("module",[{var,0,pname(M)}, + foldr(fun(V, C) -> {cons,0,{var,0,V},C} + end, {nil,0}, Vs)]); lattribute(module, M, _Opts, _State) -> - attr("module", [{var,a0(),pname(M)}]); + attr("module", [{var,0,pname(M)}]); lattribute(export, Falist, _Opts, _State) -> - call({var,a0(),"-export"}, [falist(Falist)], 0, options(none)); + call({var,0,"-export"}, [falist(Falist)], 0, options(none)); lattribute(import, Name, _Opts, _State) when is_list(Name) -> - attr("import", [{var,a0(),pname(Name)}]); + attr("import", [{var,0,pname(Name)}]); lattribute(import, {From,Falist}, _Opts, _State) -> - attr("import",[{var,a0(),pname(From)},falist(Falist)]); -lattribute(export_type, Talist, _Opts, _State) -> - call({var,a0(),"-export_type"}, [falist(Talist)], 0, options(none)); -lattribute(optional_callbacks, Falist, Opts, _State) -> - ArgL = try falist(Falist) - catch _:_ -> abstract(Falist, Opts) - end, - call({var,a0(),"-optional_callbacks"}, [ArgL], 0, options(none)); + attr("import",[{var,0,pname(From)},falist(Falist)]); lattribute(file, {Name,Line}, _Opts, State) -> - attr("file", [{var,a0(),(State#pp.string_fun)(Name)},{integer,a0(),Line}]); + attr("file", [{var,0,(State#pp.string_fun)(Name)},{integer,0,Line}]); lattribute(record, {Name,Is}, Opts, _State) -> Nl = leaf(format("-record(~w,", [Name])), [{first,Nl,record_fields(Is, Opts)},$)]; -lattribute(Name, Arg, Options, _State) -> - attr(write(Name), [abstract(Arg, Options)]). - -abstract(Arg, #options{encoding = Encoding}) -> - erl_parse:abstract(Arg, [{encoding,Encoding}]). +lattribute(Name, Arg, #options{encoding = Encoding}, _State) -> + attr(write(Name), [erl_parse:abstract(Arg, [{encoding,Encoding}])]). typeattr(Tag, {TypeName,Type,Args}, _Opts) -> {first,leaf("-"++atom_to_list(Tag)++" "), - typed(call({atom,a0(),TypeName}, Args, 0, options(none)), Type)}. + typed(call({atom,0,TypeName}, Args, 0, options(none)), Type)}. -ltype(T) -> - ltype(T, 0). - -ltype({ann_type,_Line,[V,T]}, Prec) -> - {_L,P,_R} = type_inop_prec('::'), - E = typed(lexpr(V, options(none)), T), - maybe_paren(P, Prec, E); -ltype({paren_type,_Line,[T]}, P) -> - %% Generated before Erlang/OTP 18. - ltype(T, P); -ltype({type,_Line,union,Ts}, Prec) -> - {_L,P,R} = type_inop_prec('|'), - E = {seq,[],[],[' |'],ltypes(Ts, R)}, - maybe_paren(P, Prec, E); -ltype({type,_Line,list,[T]}, _) -> +ltype({ann_type,_Line,[V,T]}) -> + typed(lexpr(V, options(none)), T); +ltype({paren_type,_Line,[T]}) -> + [$(,ltype(T),$)]; +ltype({type,_Line,union,Ts}) -> + {seq,[],[],[' |'],ltypes(Ts)}; +ltype({type,_Line,list,[T]}) -> {seq,$[,$],$,,[ltype(T)]}; -ltype({type,_Line,nonempty_list,[T]}, _) -> +ltype({type,_Line,nonempty_list,[T]}) -> {seq,$[,$],[$,],[ltype(T),leaf("...")]}; -ltype({type,Line,nil,[]}, _) -> - lexpr({nil,Line}, options(none)); -ltype({type,Line,map,any}, _) -> +ltype({type,Line,nil,[]}) -> + lexpr({nil,Line}, 0, options(none)); +ltype({type,Line,map,any}) -> simple_type({atom,Line,map}, []); -ltype({type,_Line,map,Pairs}, Prec) -> - {P,_R} = type_preop_prec('#'), - E = map_type(Pairs), - maybe_paren(P, Prec, E); -ltype({type,Line,tuple,any}, _) -> +ltype({type,_Line,map,Pairs}) -> + map_type(Pairs); +ltype({type,Line,tuple,any}) -> simple_type({atom,Line,tuple}, []); -ltype({type,_Line,tuple,Ts}, _) -> - tuple_type(Ts, fun ltype/2); -ltype({type,_Line,record,[{atom,_,N}|Fs]}, Prec) -> - {P,_R} = type_preop_prec('#'), - E = record_type(N, Fs), - maybe_paren(P, Prec, E); -ltype({type,_Line,range,[_I1,_I2]=Es}, Prec) -> - {_L,P,R} = type_inop_prec('..'), - F = fun(E, Opts) -> lexpr(E, R, Opts) end, - E = expr_list(Es, '..', F, options(none)), - maybe_paren(P, Prec, E); -ltype({type,_Line,binary,[I1,I2]}, _) -> +ltype({type,_Line,tuple,Ts}) -> + tuple_type(Ts, fun ltype/1); +ltype({type,_Line,record,[{atom,_,N}|Fs]}) -> + record_type(N, Fs); +ltype({type,_Line,range,[_I1,_I2]=Es}) -> + expr_list(Es, '..', fun lexpr/2, options(none)); +ltype({type,_Line,binary,[I1,I2]}) -> binary_type(I1, I2); % except binary() -ltype({type,_Line,'fun',[]}, _) -> +ltype({type,_Line,'fun',[]}) -> leaf("fun()"); -ltype({type,_,'fun',[{type,_,any},_]}=FunType, _) -> +ltype({type,_,'fun',[{type,_,any},_]}=FunType) -> [fun_type(['fun',$(], FunType),$)]; -ltype({type,_Line,'fun',[{type,_,product,_},_]}=FunType, _) -> +ltype({type,_Line,'fun',[{type,_,product,_},_]}=FunType) -> [fun_type(['fun',$(], FunType),$)]; -ltype({type,Line,T,Ts}, _) -> - simple_type({atom,Line,T}, Ts); -ltype({user_type,Line,T,Ts}, _) -> +ltype({type,Line,T,Ts}) -> simple_type({atom,Line,T}, Ts); -ltype({remote_type,Line,[M,F,Ts]}, _) -> +ltype({remote_type,Line,[M,F,Ts]}) -> simple_type({remote,Line,M,F}, Ts); -ltype({atom,_,T}, _) -> +ltype({atom,_,T}) -> leaf(write(T)); -ltype(E, P) -> - lexpr(E, P, options(none)). +ltype(E) -> + lexpr(E, 0, options(none)). binary_type(I1, I2) -> B = [[] || {integer,_,0} <- [I1]] =:= [], @@ -345,26 +297,34 @@ {first,[$#],map_pair_types(Fs)}. map_pair_types(Fs) -> - tuple_type(Fs, fun map_pair_type/2). + tuple_type(Fs, fun map_pair_type/1). -map_pair_type({type,_Line,map_field_assoc,[KType,VType]}, Prec) -> - {list,[{cstep,[ltype(KType, Prec),leaf(" =>")],ltype(VType, Prec)}]}. +map_pair_type({type,_Line,map_field_assoc,Ktype,Vtype}) -> + {seq,[],[]," =>",[ltype(Ktype),ltype(Vtype)]}. record_type(Name, Fields) -> {first,[record_name(Name)],field_types(Fields)}. field_types(Fs) -> - tuple_type(Fs, fun field_type/2). + tuple_type(Fs, fun field_type/1). -field_type({type,_Line,field_type,[Name,Type]}, _Prec) -> +field_type({type,_Line,field_type,[Name,Type]}) -> typed(lexpr(Name, options(none)), Type). +typed(B, {type,_,union,Ts}) -> + %% Special layout for :: followed by union. + {first,[B,$\s],{seq,[],[],[],union_type(Ts)}}; typed(B, Type) -> - {_L,_P,R} = type_inop_prec('::'), - {list,[{cstep,[B,' ::'],ltype(Type, R)}]}. + {list,[{cstep,[B,' ::'],ltype(Type)}]}. + +union_type([T|Ts]) -> + [[leaf(":: "),ltype(T)] | ltypes(Ts, fun union_elem/1)]. + +union_elem(T) -> + [leaf(" | "),ltype(T)]. tuple_type(Ts, F) -> - {seq,${,$},[$,],ltypes(Ts, F, 0)}. + {seq,${,$},[$,],ltypes(Ts, F)}. specattr(SpecKind, {FuncSpec,TypeSpecs}) -> Func = case FuncSpec of @@ -389,9 +349,6 @@ Gl = {list,[{step,'when',expr_list(Gs, [$,], fun constraint/2, Opts)}]}, {list,[{step,Before,Gl}]}. -constraint({type,_Line,constraint,[{atom,_,is_subtype},[{var,_,_}=V,Type]]}, - _Opts) -> - typed(lexpr(V, options(none)), Type); constraint({type,_Line,constraint,[Tag,As]}, _Opts) -> simple_type(Tag, As). @@ -404,19 +361,19 @@ targs(Ts). simple_type(Tag, Types) -> - {first,lexpr(Tag, options(none)),targs(Types)}. + {first,lexpr(Tag, 0, options(none)),targs(Types)}. targs(Ts) -> - {seq,$(,$),[$,],ltypes(Ts, 0)}. + {seq,$(,$),[$,],ltypes(Ts)}. -ltypes(Ts, Prec) -> - ltypes(Ts, fun ltype/2, Prec). +ltypes(Ts) -> + ltypes(Ts, fun ltype/1). -ltypes(Ts, F, Prec) -> - [F(T, Prec) || T <- Ts]. +ltypes(Ts, F) -> + [F(T) || T <- Ts]. attr(Name, Args) -> - call({var,a0(),format("-~s", [Name])}, Args, 0, options(none)). + call({var,0,format("-~s", [Name])}, Args, 0, options(none)). pname(['' | As]) -> [$. | pname(As)]; @@ -428,10 +385,9 @@ write(A). falist([]) -> - {nil,a0()}; + {nil,0}; falist([{Name,Arity}|Falist]) -> - A = a0(), - {cons,A,{var,A,format("~w/~w", [Name,Arity])},falist(Falist)}. + {cons,0,{var,0,format("~w/~w", [Name,Arity])},falist(Falist)}. lfunction({function,_Line,Name,_Arity,Cs}, Opts) -> Cll = nl_clauses(fun (C, H) -> func_clause(Name, C, H) end, $;, Opts, Cs), @@ -443,6 +399,19 @@ Bl = body(Body, Opts), {step,Gl,Bl}. +lrule({rule,_Line,Name,_Arity,Cs}, Opts) -> + Cll = nl_clauses(fun (C, H) -> rule_clause(Name, C, H) end, $;, Opts, Cs), + [Cll,leaf(".\n")]. + +rule_clause(Name, {clause,Line,Head,Guard,Body}, Opts) -> + Hl = call({atom,Line,Name}, Head, 0, Opts), + Gl = guard_when(Hl, Guard, Opts, leaf(" :-")), + Bl = rule_body(Body, Opts), + {step,Gl,Bl}. + +rule_body(Es, Opts) -> + lc_quals(Es, Opts). + guard_when(Before, Guard, Opts) -> guard_when(Before, Guard, Opts, ' ->'). @@ -1144,9 +1113,6 @@ %% Utilities %% -a0() -> - erl_anno:new(0). - chars_size([C | Es]) when is_integer(C) -> 1 + chars_size(Es); chars_size([E | Es]) -> diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_scan.erl erlang-17.3-dfsg/lib/stdlib/src/erl_scan.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_scan.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_scan.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -56,15 +55,6 @@ token_info/1,token_info/2, attributes_info/1,attributes_info/2,set_attribute/3]). --export([column/1,end_location/1,line/1,location/1,text/1, - category/1,symbol/1]). - --deprecated([{attributes_info, 1, next_major_release}, - {attributes_info, 2, next_major_release}, - {set_attribute, 3, next_major_release}, - {token_info, 1, next_major_release}, - {token_info, 2, next_major_release}]). - %%% Private -export([continuation_location/1]). @@ -88,9 +78,9 @@ -define(SETATTRFUN(F), is_function(F, 1)). -type category() :: atom(). --type column() :: pos_integer(). % Deprecated --type line() :: integer(). % Deprecated --type location() :: line() | {line(),column()}. % Deprecated +-type column() :: pos_integer(). +-type line() :: integer(). +-type location() :: line() | {line(),column()}. -type resword_fun() :: fun((atom()) -> boolean()). -type option() :: 'return' | 'return_white_spaces' | 'return_comments' | 'text' | {'reserved_word_fun', resword_fun()}. @@ -207,56 +197,6 @@ continuation_location({erl_scan_continuation,_,Col,_,Line,_,_,_}) -> {Line,Col}. --spec column(Token) -> erl_anno:column() | 'undefined' when - Token :: token(). - -column(Token) -> - erl_anno:column(element(2, Token)). - --spec end_location(Token) -> erl_anno:location() | 'undefined' when - Token :: token(). - -end_location(Token) -> - erl_anno:end_location(element(2, Token)). - --spec line(Token) -> erl_anno:line() when - Token :: token(). - -line(Token) -> - erl_anno:line(element(2, Token)). - --spec location(Token) -> erl_anno:location() when - Token :: token(). - -location(Token) -> - erl_anno:location(element(2, Token)). - --spec text(Token) -> erl_anno:text() | 'undefined' when - Token :: token(). - -text(Token) -> - erl_anno:text(element(2, Token)). - --spec category(Token) -> category() when - Token :: token(). - -category({Category,_Anno}) -> - Category; -category({Category,_Anno,_Symbol}) -> - Category; -category(T) -> - erlang:error(badarg, [T]). - --spec symbol(Token) -> symbol() when - Token :: token(). - -symbol({Category,_Anno}) -> - Category; -symbol({_Category,_Anno,Symbol}) -> - Symbol; -symbol(T) -> - erlang:error(badarg, [T]). - -type attribute_item() :: 'column' | 'length' | 'line' | 'location' | 'text'. -type info_location() :: location() | term(). @@ -336,17 +276,7 @@ attributes_info(Line, column) when ?ALINE(Line) -> undefined; attributes_info(Attrs, column=Item) -> - case attr_info(Attrs, Item) of - undefined -> - case erl_anno:column(Attrs) of - undefined -> - undefined; - Column -> - {Item,Column} - end; - T -> - T - end; + attr_info(Attrs, Item); attributes_info(Attrs, length=Item) -> case attributes_info(Attrs, text) of undefined -> @@ -360,26 +290,14 @@ ?COLUMN(Column) -> {Item,Line}; attributes_info(Attrs, line=Item) -> - case attr_info(Attrs, Item) of - undefined -> - case attr_info(Attrs, location) of - {location,{Line,_Column}} -> - {Item,Line}; - {location,Line} -> - {Item,Line}; - undefined -> - undefined - end; - T -> - T - end; + attr_info(Attrs, Item); attributes_info({Line,Column}=Location, location=Item) when ?ALINE(Line), ?COLUMN(Column) -> {Item,Location}; attributes_info(Line, location=Item) when ?ALINE(Line) -> {Item,Line}; attributes_info(Attrs, location=Item) -> - {line,Line} = attributes_info(Attrs, line), + {line,Line} = attributes_info(Attrs, line), % assume line is present case attributes_info(Attrs, column) of undefined -> %% If set_attribute() has assigned a term such as {17,42} @@ -501,28 +419,12 @@ [{line,Ln},{column,Column}] end; set_attr(line=Tag, Attrs, Fun) when is_list(Attrs) -> - case lists:keyfind(Tag, 1, Attrs) of - {line,Line} -> - case lists:keyreplace(Tag, 1, Attrs, {line,Fun(Line)}) of - [{line,Ln}] when ?ALINE(Ln) -> - Ln; - As -> - As - end; - false -> - {location, Location} = lists:keyfind(location, 1, Attrs), - Ln = case Location of - {Line,Column} when ?ALINE(Line), ?COLUMN(Column) -> - {Fun(Line),Column}; - _ -> - Fun(Location) - end, - case lists:keyreplace(location, 1, Attrs, {location,Ln}) of - [{location,Ln}] when ?ALINE(Ln) -> - Ln; - As -> - As - end + {line,Line} = lists:keyfind(Tag, 1, Attrs), + case lists:keyreplace(Tag, 1, Attrs, {line,Fun(Line)}) of + [{line,Ln}] when ?ALINE(Ln) -> + Ln; + As -> + As end; set_attr(T1, T2, T3) -> erlang:error(badarg, [T1,T2,T3]). @@ -697,6 +599,9 @@ %% := scan1(":="++Cs, St, Line, Col, Toks) -> tok2(Cs, St, Line, Col, Toks, ":=", ':=', 2); +%% :- +scan1(":-"++Cs, St, Line, Col, Toks) -> + tok2(Cs, St, Line, Col, Toks, ":-", ':-', 2); %% :: for typed records scan1("::"++Cs, St, Line, Col, Toks) -> tok2(Cs, St, Line, Col, Toks, "::", '::', 2); @@ -806,17 +711,17 @@ -define(STR(St, S), if St#erl_scan.text -> S; true -> [] end). scan_dot([$%|_]=Cs, St, Line, Col, Toks, Ncs) -> - Anno = anno(Line, Col, St, Ncs), - {ok,[{dot,Anno}|Toks],Cs,Line,incr_column(Col, 1)}; + Attrs = attributes(Line, Col, St, Ncs), + {ok,[{dot,Attrs}|Toks],Cs,Line,incr_column(Col, 1)}; scan_dot([$\n=C|Cs], St, Line, Col, Toks, Ncs) -> - Anno = anno(Line, Col, St, ?STR(St, Ncs++[C])), - {ok,[{dot,Anno}|Toks],Cs,Line+1,new_column(Col, 1)}; + Attrs = attributes(Line, Col, St, ?STR(St, Ncs++[C])), + {ok,[{dot,Attrs}|Toks],Cs,Line+1,new_column(Col, 1)}; scan_dot([C|Cs], St, Line, Col, Toks, Ncs) when ?WHITE_SPACE(C) -> - Anno = anno(Line, Col, St, ?STR(St, Ncs++[C])), - {ok,[{dot,Anno}|Toks],Cs,Line,incr_column(Col, 2)}; + Attrs = attributes(Line, Col, St, ?STR(St, Ncs++[C])), + {ok,[{dot,Attrs}|Toks],Cs,Line,incr_column(Col, 2)}; scan_dot(eof=Cs, St, Line, Col, Toks, Ncs) -> - Anno = anno(Line, Col, St, Ncs), - {ok,[{dot,Anno}|Toks],Cs,Line,incr_column(Col, 1)}; + Attrs = attributes(Line, Col, St, Ncs), + {ok,[{dot,Attrs}|Toks],Cs,Line,incr_column(Col, 1)}; scan_dot(Cs, St, Line, Col, Toks, Ncs) -> tok2(Cs, St, Line, Col, Toks, Ncs, '.', 1). @@ -871,12 +776,12 @@ %% stop anyway, nothing is gained by not collecting all white spaces. scan_nl_white_space([$\n|Cs], #erl_scan{text = false}=St, Line, no_col=Col, Toks0, Ncs) -> - Toks = [{white_space,anno(Line),lists:reverse(Ncs)}|Toks0], + Toks = [{white_space,Line,lists:reverse(Ncs)}|Toks0], scan_newline(Cs, St, Line+1, Col, Toks); scan_nl_white_space([$\n|Cs], St, Line, Col, Toks, Ncs0) -> Ncs = lists:reverse(Ncs0), - Anno = anno(Line, Col, St, Ncs), - Token = {white_space,Anno,Ncs}, + Attrs = attributes(Line, Col, St, Ncs), + Token = {white_space,Attrs,Ncs}, scan_newline(Cs, St, Line+1, new_column(Col, length(Ncs)), [Token|Toks]); scan_nl_white_space([C|Cs], St, Line, Col, Toks, Ncs) when ?WHITE_SPACE(C) -> scan_nl_white_space(Cs, St, Line, Col, Toks, [C|Ncs]); @@ -884,20 +789,19 @@ {more,{Cs,Col,Toks,Line,Ncs,fun scan_nl_white_space/6}}; scan_nl_white_space(Cs, #erl_scan{text = false}=St, Line, no_col=Col, Toks, Ncs) -> - Anno = anno(Line), - scan1(Cs, St, Line+1, Col, [{white_space,Anno,lists:reverse(Ncs)}|Toks]); + scan1(Cs, St, Line+1, Col, [{white_space,Line,lists:reverse(Ncs)}|Toks]); scan_nl_white_space(Cs, St, Line, Col, Toks, Ncs0) -> Ncs = lists:reverse(Ncs0), - Anno = anno(Line, Col, St, Ncs), - Token = {white_space,Anno,Ncs}, + Attrs = attributes(Line, Col, St, Ncs), + Token = {white_space,Attrs,Ncs}, scan1(Cs, St, Line+1, new_column(Col, length(Ncs)), [Token|Toks]). newline_end(Cs, #erl_scan{text = false}=St, Line, no_col=Col, Toks, _N, Ncs) -> - scan1(Cs, St, Line+1, Col, [{white_space,anno(Line),Ncs}|Toks]); + scan1(Cs, St, Line+1, Col, [{white_space,Line,Ncs}|Toks]); newline_end(Cs, St, Line, Col, Toks, N, Ncs) -> - Anno = anno(Line, Col, St, Ncs), - scan1(Cs, St, Line+1, new_column(Col, N), [{white_space,Anno,Ncs}|Toks]). + Attrs = attributes(Line, Col, St, Ncs), + scan1(Cs, St, Line+1, new_column(Col, N), [{white_space,Attrs,Ncs}|Toks]). scan_spcs([$\s|Cs], St, Line, Col, Toks, N) when N < 16 -> scan_spcs(Cs, St, Line, Col, Toks, N+1); @@ -946,20 +850,20 @@ {eof,Ncol} -> scan_error(char, Line, Col, Line, Ncol, eof); {nl,Val,Str,Ncs,Ncol} -> - Anno = anno(Line, Col, St, ?STR(St, "$\\"++Str)), %" - Ntoks = [{char,Anno,Val}|Toks], + Attrs = attributes(Line, Col, St, ?STR(St, "$\\"++Str)), %" + Ntoks = [{char,Attrs,Val}|Toks], scan1(Ncs, St, Line+1, Ncol, Ntoks); {Val,Str,Ncs,Ncol} -> - Anno = anno(Line, Col, St, ?STR(St, "$\\"++Str)), %" - Ntoks = [{char,Anno,Val}|Toks], + Attrs = attributes(Line, Col, St, ?STR(St, "$\\"++Str)), %" + Ntoks = [{char,Attrs,Val}|Toks], scan1(Ncs, St, Line, Ncol, Ntoks) end; scan_char([$\n=C|Cs], St, Line, Col, Toks) -> - Anno = anno(Line, Col, St, ?STR(St, [$$,C])), - scan1(Cs, St, Line+1, new_column(Col, 1), [{char,Anno,C}|Toks]); + Attrs = attributes(Line, Col, St, ?STR(St, [$$,C])), + scan1(Cs, St, Line+1, new_column(Col, 1), [{char,Attrs,C}|Toks]); scan_char([C|Cs], St, Line, Col, Toks) when ?UNICODE(C) -> - Anno = anno(Line, Col, St, ?STR(St, [$$,C])), - scan1(Cs, St, Line, incr_column(Col, 2), [{char,Anno,C}|Toks]); + Attrs = attributes(Line, Col, St, ?STR(St, [$$,C])), + scan1(Cs, St, Line, incr_column(Col, 2), [{char,Attrs,C}|Toks]); scan_char([C|_Cs], _St, Line, Col, _Toks) when ?CHAR(C) -> scan_error({illegal,character}, Line, Col, Line, incr_column(Col, 1), eof); scan_char([], _St, Line, Col, Toks) -> @@ -978,8 +882,8 @@ Estr = string:substr(Nwcs, 1, 16), % Expanded escape chars. scan_error({string,$\",Estr}, Line0, Col0, Nline, Ncol, Ncs); %" {Ncs,Nline,Ncol,Nstr,Nwcs} -> - Anno = anno(Line0, Col0, St, Nstr), - scan1(Ncs, St, Nline, Ncol, [{string,Anno,Nwcs}|Toks]) + Attrs = attributes(Line0, Col0, St, Nstr), + scan1(Ncs, St, Nline, Ncol, [{string,Attrs,Nwcs}|Toks]) end. scan_qatom(Cs, St, Line, Col, Toks, {Wcs,Str,Line0,Col0}) -> @@ -995,8 +899,8 @@ {Ncs,Nline,Ncol,Nstr,Nwcs} -> case catch list_to_atom(Nwcs) of A when is_atom(A) -> - Anno = anno(Line0, Col0, St, Nstr), - scan1(Ncs, St, Nline, Ncol, [{atom,Anno,A}|Toks]); + Attrs = attributes(Line0, Col0, St, Nstr), + scan1(Ncs, St, Nline, Ncol, [{atom,Attrs,A}|Toks]); _ -> scan_error({illegal,atom}, Line0, Col0, Nline, Ncol, Ncs) end @@ -1272,28 +1176,28 @@ tok3(Cs, St, Line, Col, Toks, comment, Ncs, Ncs). tok2(Cs, #erl_scan{text = false}=St, Line, no_col=Col, Toks, _Wcs, P) -> - scan1(Cs, St, Line, Col, [{P,anno(Line)}|Toks]); + scan1(Cs, St, Line, Col, [{P,Line}|Toks]); tok2(Cs, St, Line, Col, Toks, Wcs, P) -> - Anno = anno(Line, Col, St, Wcs), - scan1(Cs, St, Line, incr_column(Col, length(Wcs)), [{P,Anno}|Toks]). + Attrs = attributes(Line, Col, St, Wcs), + scan1(Cs, St, Line, incr_column(Col, length(Wcs)), [{P,Attrs}|Toks]). tok2(Cs, #erl_scan{text = false}=St, Line, no_col=Col, Toks, _Wcs, P, _N) -> - scan1(Cs, St, Line, Col, [{P,anno(Line)}|Toks]); + scan1(Cs, St, Line, Col, [{P,Line}|Toks]); tok2(Cs, St, Line, Col, Toks, Wcs, P, N) -> - Anno = anno(Line, Col, St, Wcs), - scan1(Cs, St, Line, incr_column(Col, N), [{P,Anno}|Toks]). + Attrs = attributes(Line, Col, St, Wcs), + scan1(Cs, St, Line, incr_column(Col, N), [{P,Attrs}|Toks]). tok3(Cs, #erl_scan{text = false}=St, Line, no_col=Col, Toks, Item, _S, Sym) -> - scan1(Cs, St, Line, Col, [{Item,anno(Line),Sym}|Toks]); + scan1(Cs, St, Line, Col, [{Item,Line,Sym}|Toks]); tok3(Cs, St, Line, Col, Toks, Item, String, Sym) -> - Token = {Item,anno(Line, Col, St, String),Sym}, + Token = {Item,attributes(Line, Col, St, String),Sym}, scan1(Cs, St, Line, incr_column(Col, length(String)), [Token|Toks]). tok3(Cs, #erl_scan{text = false}=St, Line, no_col=Col, Toks, Item, _String, Sym, _Length) -> - scan1(Cs, St, Line, Col, [{Item,anno(Line),Sym}|Toks]); + scan1(Cs, St, Line, Col, [{Item,Line,Sym}|Toks]); tok3(Cs, St, Line, Col, Toks, Item, String, Sym, Length) -> - Token = {Item,anno(Line, Col, St, String),Sym}, + Token = {Item,attributes(Line, Col, St, String),Sym}, scan1(Cs, St, Line, incr_column(Col, Length), [Token|Toks]). scan_error(Error, Line, Col, EndLine, EndCol, Rest) -> @@ -1304,28 +1208,23 @@ scan_error(Error, ErrorLoc, EndLoc, Rest) -> {{error,{ErrorLoc,?MODULE,Error},EndLoc},Rest}. --compile({inline,[anno/4]}). +-compile({inline,[attributes/4]}). -anno(Line, no_col, #erl_scan{text = false}, _String) -> - anno(Line); -anno(Line, no_col, #erl_scan{text = true}, String) -> - Anno = anno(Line), - erl_anno:set_text(String, Anno); -anno(Line, Col, #erl_scan{text = false}, _String) -> - anno({Line, Col}); -anno(Line, Col, #erl_scan{text = true}, String) -> - Anno = anno({Line, Col}), - erl_anno:set_text(String, Anno). +attributes(Line, no_col, #erl_scan{text = false}, _String) -> + Line; +attributes(Line, no_col, #erl_scan{text = true}, String) -> + [{line,Line},{text,String}]; +attributes(Line, Col, #erl_scan{text = false}, _String) -> + {Line,Col}; +attributes(Line, Col, #erl_scan{text = true}, String) -> + [{line,Line},{column,Col},{text,String}]. location(Line, no_col) -> Line; location(Line, Col) when is_integer(Col) -> {Line,Col}. --compile({inline,[anno/1,incr_column/2,new_column/2]}). - -anno(Location) -> - erl_anno:new(Location). +-compile({inline,[incr_column/2,new_column/2]}). incr_column(no_col=Col, _N) -> Col; diff -Nru erlang-18.2-dfsg/lib/stdlib/src/erl_tar.erl erlang-17.3-dfsg/lib/stdlib/src/erl_tar.erl --- erlang-18.2-dfsg/lib/stdlib/src/erl_tar.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/erl_tar.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,7 +22,7 @@ %% Purpose: Unix tar (tape archive) utility. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --export([init/3, create/2, create/3, extract/1, extract/2, table/1, table/2, +-export([create/2, create/3, extract/1, extract/2, table/1, table/2, open/2, close/1, add/3, add/4, t/1, tt/1, format_error/1]). @@ -31,16 +30,10 @@ -record(add_opts, {read_info, % Fun to use for read file/link info. - chunk_size = 0, % For file reading when sending to sftp. 0=do not chunk verbose = false :: boolean()}). % Verbose on/off. %% Opens a tar archive. -init(UsrHandle, AccessMode, Fun) when is_function(Fun,2) -> - {ok, {AccessMode,{tar_descriptor,UsrHandle,Fun}}}. - -%%%================================================================ -%%% The open function with friends is to keep the file and binary api of this module open(Name, Mode) -> case open_mode(Mode) of {ok, Access, Raw, Opts} -> @@ -53,37 +46,27 @@ case file:open(Bin, [ram,binary,read]) of {ok,File} -> _ = [ram_file:uncompress(File) || Opts =:= [compressed]], - init(File,read,file_fun()); + {ok,{read,File}}; Error -> Error end; open1({file, Fd}, read, _Raw, _Opts) -> - init(Fd, read, file_fun()); + {ok, {read, Fd}}; open1(Name, Access, Raw, Opts) -> case file:open(Name, Raw ++ [binary, Access|Opts]) of {ok, File} -> - init(File, Access, file_fun()); + {ok, {Access, File}}; {error, Reason} -> {error, {Name, Reason}} end. -file_fun() -> - fun(write, {Fd,Data}) -> file:write(Fd, Data); - (position, {Fd,Pos}) -> file:position(Fd, Pos); - (read2, {Fd,Size}) -> file:read(Fd,Size); - (close, Fd) -> file:close(Fd) - end. - -%%% End of file and binary api (except for open_mode/1 downwards -%%%================================================================ - %% Closes a tar archive. close({read, File}) -> - ok = do_close(File); + ok = file:close(File); close({write, File}) -> PadResult = pad_file(File), - ok = do_close(File), + ok = file:close(File), PadResult; close(_) -> {error, einval}. @@ -92,6 +75,7 @@ add(File, Name, Options) -> add(File, Name, Name, Options). + add({write, File}, Name, NameInArchive, Options) -> Opts = #add_opts{read_info=fun(F) -> file:read_link_info(F) end}, add1(File, Name, NameInArchive, add_opts(Options, Opts)); @@ -104,8 +88,6 @@ add_opts(T, Opts#add_opts{read_info=fun(F) -> file:read_file_info(F) end}); add_opts([verbose|T], Opts) -> add_opts(T, Opts#add_opts{verbose=true}); -add_opts([{chunks,N}|T], Opts) -> - add_opts(T, Opts#add_opts{chunk_size=N}); add_opts([_|T], Opts) -> add_opts(T, Opts); add_opts([], Opts) -> @@ -301,7 +283,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% add1(TarFile, Bin, NameInArchive, Opts) when is_binary(Bin) -> - Now = calendar:now_to_local_time(erlang:timestamp()), + Now = calendar:now_to_local_time(now()), Info = #file_info{size = byte_size(Bin), type = regular, access = read_write, @@ -339,46 +321,16 @@ {error, {Name, Reason}} end. -add1(Tar, Name, Header, chunked, Options) -> - add_verbose(Options, "a ~ts [chunked ", [Name]), - try - ok = do_write(Tar, Header), - {ok,D} = file:open(Name, [read,binary]), - {ok,NumBytes} = add_read_write_chunks(D, Tar, Options#add_opts.chunk_size, 0, Options), - _ = file:close(D), - ok = do_write(Tar, padding(NumBytes,?record_size)) - of - ok -> - add_verbose(Options, "~n", []), - ok - catch - error:{badmatch,{error,Error}} -> - add_verbose(Options, "~n", []), - {error,{Name,Error}} - end; add1(Tar, Name, Header, Bin, Options) -> add_verbose(Options, "a ~ts~n", [Name]), - do_write(Tar, [Header, Bin, padding(byte_size(Bin), ?record_size)]). - -add_read_write_chunks(D, Tar, ChunkSize, SumNumBytes, Options) -> - case file:read(D, ChunkSize) of - {ok,Bin} -> - ok = do_write(Tar, Bin), - add_verbose(Options, ".", []), - add_read_write_chunks(D, Tar, ChunkSize, SumNumBytes+byte_size(Bin), Options); - eof -> - add_verbose(Options, "]", []), - {ok,SumNumBytes}; - Other -> - Other - end. + file:write(Tar, [Header, Bin, padding(byte_size(Bin), ?record_size)]). add_directory(TarFile, DirName, NameInArchive, Info, Options) -> case file:list_dir(DirName) of {ok, []} -> add_verbose(Options, "a ~ts~n", [DirName]), Header = create_header(NameInArchive, Info), - do_write(TarFile, Header); + file:write(TarFile, Header); {ok, Files} -> Add = fun (File) -> add1(TarFile, @@ -444,7 +396,7 @@ %% Pads out end of file. pad_file(File) -> - {ok,Position} = do_position(File, {cur,0}), + {ok,Position} = file:position(File, {cur,0}), %% There must be at least two zero records at the end. Fill = case ?block_size - (Position rem ?block_size) of Fill0 when Fill0 < 2*?record_size -> @@ -455,7 +407,7 @@ %% Large enough. Fill0 end, - do_write(File, zeroes(Fill)). + file:write(File, zeroes(Fill)). split_filename(Name) when length(Name) =< ?th_name_len -> {"", Name}; @@ -533,36 +485,27 @@ read_opts([], Opts) -> Opts. -foldl_read({AccessMode,TD={tar_descriptor,_UsrHandle,_AccessFun}}, Fun, Accu, Opts) -> - case AccessMode of - read -> - foldl_read0(TD, Fun, Accu, Opts); - _ -> - {error,{read_mode_expected,AccessMode}} - end; foldl_read(TarName, Fun, Accu, Opts) -> case open(TarName, [read|Opts#read_opts.open_mode]) of {ok, {read, File}} -> - Result = foldl_read0(File, Fun, Accu, Opts), - ok = do_close(File), + Result = + case catch foldl_read1(Fun, Accu, File, Opts) of + {'EXIT', Reason} -> + exit(Reason); + {error, {Reason, Format, Args}} -> + read_verbose(Opts, Format, Args), + {error, Reason}; + {error, Reason} -> + {error, Reason}; + Ok -> + Ok + end, + ok = file:close(File), Result; Error -> Error end. -foldl_read0(File, Fun, Accu, Opts) -> - case catch foldl_read1(Fun, Accu, File, Opts) of - {'EXIT', Reason} -> - exit(Reason); - {error, {Reason, Format, Args}} -> - read_verbose(Opts, Format, Args), - {error, Reason}; - {error, Reason} -> - {error, Reason}; - Ok -> - Ok - end. - foldl_read1(Fun, Accu0, File, Opts) -> case get_header(File) of eof -> @@ -616,7 +559,7 @@ ordsets:is_element(Name, Files). get_header(File) -> - case do_read(File, ?record_size) of + case file:read(File, ?record_size) of eof -> throw({error,eof}); {ok, Bin} when is_binary(Bin) -> @@ -747,7 +690,7 @@ skip_to_next(File), {ok,<<>>}; get_element(File, #tar_header{size = Size}) -> - case do_read(File, Size) of + case file:read(File, Size) of {ok,Bin}=Res when byte_size(Bin) =:= Size -> skip_to_next(File), Res; @@ -937,7 +880,7 @@ %% Note: There is no point in handling failure to get the current position %% in the file. If it doesn't work, something serious is wrong. Amount = ((Size + ?record_size - 1) div ?record_size) * ?record_size, - {ok,_} = do_position(File, {cur, Amount}), + {ok,_} = file:position(File, {cur, Amount}), ok. %% Skips to the next record in the file. @@ -945,9 +888,9 @@ skip_to_next(File) -> %% Note: There is no point in handling failure to get the current position %% in the file. If it doesn't work, something serious is wrong. - {ok, Position} = do_position(File, {cur, 0}), + {ok, Position} = file:position(File, {cur, 0}), NewPosition = ((Position + ?record_size - 1) div ?record_size) * ?record_size, - {ok,NewPosition} = do_position(File, NewPosition), + {ok,NewPosition} = file:position(File, NewPosition), ok. %% Prints the message on if the verbose option is given. @@ -973,9 +916,6 @@ read_file_and_info(Name, Opts) -> ReadInfo = Opts#add_opts.read_info, case ReadInfo(Name) of - {ok,Info} when Info#file_info.type =:= regular, - Opts#add_opts.chunk_size>0 -> - {ok,chunked,Info}; {ok,Info} when Info#file_info.type =:= regular -> case file:read_file(Name) of {ok,Bin} -> @@ -1022,12 +962,3 @@ {ok, Access, Raw, Opts}; open_mode(_, _, _, _) -> {error, einval}. - -%%%================================================================ -do_write({tar_descriptor,UsrHandle,Fun}, Data) -> Fun(write,{UsrHandle,Data}). - -do_position({tar_descriptor,UsrHandle,Fun}, Pos) -> Fun(position,{UsrHandle,Pos}). - -do_read({tar_descriptor,UsrHandle,Fun}, Len) -> Fun(read2,{UsrHandle,Len}). - -do_close({tar_descriptor,UsrHandle,Fun}) -> Fun(close,UsrHandle). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/error_logger_file_h.erl erlang-17.3-dfsg/lib/stdlib/src/error_logger_file_h.erl --- erlang-18.2-dfsg/lib/stdlib/src/error_logger_file_h.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/error_logger_file_h.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,28 +23,24 @@ %%% %%% A handler that can be connected to the error_logger -%%% event handler. Writes all events formatted to file. +%%% event handler. +%%% Writes all events formatted to file. +%%% Handles events tagged error, emulator and info. %%% %%% It can only be started from error_logger:swap_handler({logfile, File}) -%%% or error_logger:logfile(File). +%%% or error_logger:logfile(File) %%% -export([init/1, handle_event/2, handle_call/2, handle_info/2, terminate/2, code_change/3]). --record(st, - {fd, - filename, - prev_handler, - depth=unlimited :: 'unlimited' | non_neg_integer()}). - %% This one is used when we takeover from the simple error_logger. init({File, {error_logger, Buf}}) -> case init(File, error_logger) of - {ok, State} -> - write_events(State, Buf), - {ok, State}; + {ok, {Fd, File, PrevHandler}} -> + write_events(Fd, Buf), + {ok, {Fd, File, PrevHandler}}; Error -> Error end; @@ -57,45 +52,49 @@ process_flag(trap_exit, true), case file:open(File, [write]) of {ok,Fd} -> - Depth = get_depth(), - State = #st{fd=Fd,filename=File,prev_handler=PrevHandler, - depth=Depth}, - {ok, State}; + {ok, {Fd, File, PrevHandler}}; Error -> Error end. - -get_depth() -> - case application:get_env(kernel, error_logger_format_depth) of - {ok, Depth} when is_integer(Depth) -> - max(10, Depth); - undefined -> - unlimited - end. - + handle_event({_Type, GL, _Msg}, State) when node(GL) =/= node() -> {ok, State}; -handle_event(Event, State) -> - write_event(State, Event), +handle_event(Event, {Fd, File, PrevHandler}) -> + write_event(Fd, tag_event(Event)), + {ok, {Fd, File, PrevHandler}}; +handle_event(_, State) -> {ok, State}. -handle_info({'EXIT', Fd, _Reason}, #st{fd=Fd,prev_handler=PrevHandler}) -> +handle_info({'EXIT', Fd, _Reason}, {Fd, _File, PrevHandler}) -> case PrevHandler of [] -> remove_handler; _ -> {swap_handler, install_prev, [], PrevHandler, go_back} end; +handle_info({emulator, GL, Chars}, {Fd, File, PrevHandler}) + when node(GL) == node() -> + write_event(Fd, tag_event({emulator, GL, Chars})), + {ok, {Fd, File, PrevHandler}}; +handle_info({emulator, noproc, Chars}, {Fd, File, PrevHandler}) -> + write_event(Fd, tag_event({emulator, noproc, Chars})), + {ok, {Fd, File, PrevHandler}}; handle_info(_, State) -> {ok, State}. -handle_call(filename, #st{filename=File}=State) -> - {ok, File, State}; +handle_call(filename, {Fd, File, Prev}) -> + {ok, File, {Fd, File, Prev}}; handle_call(_Query, State) -> {ok, {error, bad_query}, State}. -terminate(_Reason, #st{fd=Fd}) -> - file:close(Fd). +terminate(_Reason, State) -> + case State of + {Fd, _File, _Prev} -> + ok = file:close(Fd); + _ -> + ok + end, + []. code_change(_OldVsn, State, _Extra) -> {ok, State}. @@ -104,73 +103,69 @@ %%% Misc. functions. %%% ------------------------------------------------------ -write_events(State, [Ev|Es]) -> - %% Write the events in reversed order. - write_events(State, Es), - write_event(State, Ev); -write_events(_State, []) -> - ok. - -write_event(#st{fd=Fd}=State, Event) -> - case parse_event(Event) of - ignore -> - ok; - {Head,Pid,FormatList} -> - Time = maybe_utc(erlang:universaltime()), - Header = write_time(Time, Head), - Body = format_body(State, FormatList), - AtNode = if - node(Pid) =/= node() -> - ["** at node ",atom_to_list(node(Pid))," **\n"]; - true -> - [] - end, - io:put_chars(Fd, [Header,Body,AtNode]) - end. +tag_event(Event) -> + {erlang:universaltime(), Event}. -format_body(State, [{Format,Args}|T]) -> - S = try format(State, Format, Args) of - S0 -> - S0 - catch - _:_ -> - format(State, "ERROR: ~p - ~p\n", [Format,Args]) - end, - [S|format_body(State, T)]; -format_body(_State, []) -> - []. +write_events(Fd, Events) -> write_events1(Fd, lists:reverse(Events)). -format(#st{depth=unlimited}, Format, Args) -> - io_lib:format(Format, Args); -format(#st{depth=Depth}, Format0, Args) -> - Format1 = io_lib:scan_format(Format0, Args), - Format = limit_format(Format1, Depth), - io_lib:build_text(Format). - -limit_format([#{control_char:=C0}=M0|T], Depth) when C0 =:= $p; - C0 =:= $w -> - C = C0 - ($a - $A), %To uppercase. - #{args:=Args} = M0, - M = M0#{control_char:=C,args:=Args++[Depth]}, - [M|limit_format(T, Depth)]; -limit_format([H|T], Depth) -> - [H|limit_format(T, Depth)]; -limit_format([], _) -> - []. +write_events1(Fd, [Event|Es]) -> + write_event(Fd, Event), + write_events1(Fd, Es); +write_events1(_, []) -> + ok. -parse_event({error, _GL, {Pid, Format, Args}}) -> - {"ERROR REPORT",Pid,[{Format,Args}]}; -parse_event({info_msg, _GL, {Pid, Format, Args}}) -> - {"INFO REPORT",Pid,[{Format, Args}]}; -parse_event({warning_msg, _GL, {Pid, Format, Args}}) -> - {"WARNING REPORT",Pid,[{Format,Args}]}; -parse_event({error_report, _GL, {Pid, std_error, Args}}) -> - {"ERROR REPORT",Pid,format_term(Args)}; -parse_event({info_report, _GL, {Pid, std_info, Args}}) -> - {"INFO REPORT",Pid,format_term(Args)}; -parse_event({warning_report, _GL, {Pid, std_warning, Args}}) -> - {"WARNING REPORT",Pid,format_term(Args)}; -parse_event(_) -> ignore. +write_event(Fd, {Time, {error, _GL, {Pid, Format, Args}}}) -> + T = write_time(maybe_utc(Time)), + case catch io_lib:format(add_node(Format,Pid), Args) of + S when is_list(S) -> + io:format(Fd, T ++ S, []); + _ -> + F = add_node("ERROR: ~p - ~p~n", Pid), + io:format(Fd, T ++ F, [Format,Args]) + end; +write_event(Fd, {Time, {emulator, _GL, Chars}}) -> + T = write_time(maybe_utc(Time)), + case catch io_lib:format(Chars, []) of + S when is_list(S) -> + io:format(Fd, T ++ S, []); + _ -> + io:format(Fd, T ++ "ERROR: ~p ~n", [Chars]) + end; +write_event(Fd, {Time, {info, _GL, {Pid, Info, _}}}) -> + T = write_time(maybe_utc(Time)), + io:format(Fd, T ++ add_node("~p~n",Pid),[Info]); +write_event(Fd, {Time, {error_report, _GL, {Pid, std_error, Rep}}}) -> + T = write_time(maybe_utc(Time)), + S = format_report(Rep), + io:format(Fd, T ++ S ++ add_node("", Pid), []); +write_event(Fd, {Time, {info_report, _GL, {Pid, std_info, Rep}}}) -> + T = write_time(maybe_utc(Time), "INFO REPORT"), + S = format_report(Rep), + io:format(Fd, T ++ S ++ add_node("", Pid), []); +write_event(Fd, {Time, {info_msg, _GL, {Pid, Format, Args}}}) -> + T = write_time(maybe_utc(Time), "INFO REPORT"), + case catch io_lib:format(add_node(Format,Pid), Args) of + S when is_list(S) -> + io:format(Fd, T ++ S, []); + _ -> + F = add_node("ERROR: ~p - ~p~n", Pid), + io:format(Fd, T ++ F, [Format,Args]) + end; +write_event(Fd, {Time, {warning_report, _GL, {Pid, std_warning, Rep}}}) -> + T = write_time(maybe_utc(Time), "WARNING REPORT"), + S = format_report(Rep), + io:format(Fd, T ++ S ++ add_node("", Pid), []); +write_event(Fd, {Time, {warning_msg, _GL, {Pid, Format, Args}}}) -> + T = write_time(maybe_utc(Time), "WARNING REPORT"), + case catch io_lib:format(add_node(Format,Pid), Args) of + S when is_list(S) -> + io:format(Fd, T ++ S, []); + _ -> + F = add_node("ERROR: ~p - ~p~n", Pid), + io:format(Fd, T ++ F, [Format,Args]) + end; +write_event(_, _) -> + ok. maybe_utc(Time) -> UTC = case application:get_env(sasl, utc_log) of @@ -187,27 +182,30 @@ maybe_utc(Time, true) -> {utc, Time}; maybe_utc(Time, _) -> {local, calendar:universal_time_to_local_time(Time)}. -format_term(Term) when is_list(Term) -> - case string_p(Term) of +format_report(Rep) when is_list(Rep) -> + case string_p(Rep) of true -> - [{"~s\n",[Term]}]; - false -> - format_term_list(Term) - end; -format_term(Term) -> - [{"~p\n",[Term]}]. - -format_term_list([{Tag,Data}|T]) -> - [{" ~p: ~p\n",[Tag,Data]}|format_term_list(T)]; -format_term_list([Data|T]) -> - [{" ~p\n",[Data]}|format_term_list(T)]; -format_term_list([]) -> - []; -format_term_list(_) -> - %% Continue to allow non-proper lists for now. - %% FIXME: Remove this clause in OTP 19. + io_lib:format("~s~n",[Rep]); + _ -> + format_rep(Rep) + end; +format_report(Rep) -> + io_lib:format("~p~n",[Rep]). + +format_rep([{Tag,Data}|Rep]) -> + io_lib:format(" ~p: ~p~n",[Tag,Data]) ++ format_rep(Rep); +format_rep([Other|Rep]) -> + io_lib:format(" ~p~n",[Other]) ++ format_rep(Rep); +format_rep(_) -> []. +add_node(X, Pid) when is_atom(X) -> + add_node(atom_to_list(X), Pid); +add_node(X, Pid) when node(Pid) =/= node() -> + lists:concat([X,"** at node ",node(Pid)," **~n"]); +add_node(X, _) -> + X. + string_p([]) -> false; string_p(Term) -> @@ -223,10 +221,15 @@ string_p1([$\f|T]) -> string_p1(T); string_p1([$\e|T]) -> string_p1(T); string_p1([H|T]) when is_list(H) -> - string_p1(H) andalso string_p1(T); + case string_p1(H) of + true -> string_p1(T); + _ -> false + end; string_p1([]) -> true; string_p1(_) -> false. +write_time(Time) -> write_time(Time, "ERROR REPORT"). + write_time({utc,{{Y,Mo,D},{H,Mi,S}}}, Type) -> io_lib:format("~n=~s==== ~p-~s-~p::~s:~s:~s UTC ===~n", [Type,D,month(Mo),Y,t(H),t(Mi),t(S)]); diff -Nru erlang-18.2-dfsg/lib/stdlib/src/error_logger_tty_h.erl erlang-17.3-dfsg/lib/stdlib/src/error_logger_tty_h.erl --- erlang-18.2-dfsg/lib/stdlib/src/error_logger_tty_h.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/error_logger_tty_h.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,180 +22,145 @@ %%% %%% A handler that can be connected to the error_logger -%%% event handler. Writes all events formatted to stdout. +%%% event handler. +%%% Writes all events formatted to stdout. +%%% Handles events tagged error, emulator and info. %%% %%% It can only be started from error_logger:swap_handler(tty) -%%% or error_logger:tty(true). +%%% or error_logger:tty(true) %%% -export([init/1, handle_event/2, handle_call/2, handle_info/2, terminate/2, code_change/3]). --export([write_event/2,write_event/3]). - --record(st, - {user, - prev_handler, - io_mod=io, - depth=unlimited}). +-export([write_event/2]). %% This one is used when we takeover from the simple error_logger. init({[], {error_logger, Buf}}) -> User = set_group_leader(), - Depth = get_depth(), - State = #st{user=User,prev_handler=error_logger,depth=Depth}, - write_events(State, Buf), - {ok, State}; + write_events(Buf,io), + {ok, {User, error_logger}}; %% This one is used if someone took over from us, and now wants to %% go back. init({[], {error_logger_tty_h, PrevHandler}}) -> User = set_group_leader(), - {ok, #st{user=User,prev_handler=PrevHandler}}; + {ok, {User, PrevHandler}}; %% This one is used when we are started directly. init([]) -> User = set_group_leader(), - Depth = get_depth(), - {ok, #st{user=User,prev_handler=[],depth=Depth}}. - -get_depth() -> - case application:get_env(kernel, error_logger_format_depth) of - {ok, Depth} when is_integer(Depth) -> - max(10, Depth); - undefined -> - unlimited - end. + {ok, {User, []}}. handle_event({_Type, GL, _Msg}, State) when node(GL) =/= node() -> {ok, State}; handle_event(Event, State) -> - ok = do_write_event(State, tag_event(Event)), + ok = write_event(tag_event(Event),io), {ok, State}. -handle_info({'EXIT', User, _Reason}, - #st{user=User,prev_handler=PrevHandler}=State) -> +handle_info({'EXIT', User, _Reason}, {User, PrevHandler}) -> case PrevHandler of [] -> remove_handler; _ -> - {swap_handler, install_prev, State, + {swap_handler, install_prev, {User, PrevHandler}, PrevHandler, go_back} end; +handle_info({emulator, GL, Chars}, State) when node(GL) == node() -> + ok = write_event(tag_event({emulator, GL, Chars}),io), + {ok, State}; +handle_info({emulator, noproc, Chars}, State) -> + ok = write_event(tag_event({emulator, noproc, Chars}),io), + {ok, State}; handle_info(_, State) -> {ok, State}. handle_call(_Query, State) -> {ok, {error, bad_query}, State}. +% unfortunately, we can't unlink from User - links are not counted! +% if pid(User) -> unlink(User); true -> ok end, terminate(install_prev, _State) -> []; -terminate(_Reason, #st{prev_handler=PrevHandler}) -> +terminate(_Reason, {_User, PrevHandler}) -> {error_logger_tty_h, PrevHandler}. code_change(_OldVsn, State, _Extra) -> {ok, State}. -%% Exported (but unoffical) API. -write_event(Event, IoMod) -> - do_write_event(#st{io_mod=IoMod}, Event). - -write_event(Event, IoMod, Depth) -> - do_write_event(#st{io_mod=IoMod,depth=Depth}, Event). - - %%% ------------------------------------------------------ %%% Misc. functions. %%% ------------------------------------------------------ set_group_leader() -> case whereis(user) of - User when is_pid(User) -> - link(User), - group_leader(User,self()), - User; - _ -> - false + User when is_pid(User) -> link(User), group_leader(User,self()), User; + _ -> false end. tag_event(Event) -> {erlang:universaltime(), Event}. -write_events(State, [Ev|Es]) -> - %% Write the events in reverse order. - _ = write_events(State, Es), - _ = do_write_event(State, Ev), - ok; -write_events(_State, []) -> +%% IOMOd is always 'io' +write_events(Events,IOMod) -> write_events1(lists:reverse(Events),IOMod). + +write_events1([Event|Es],IOMod) -> + ok = write_event(Event,IOMod), + write_events1(Es,IOMod); +write_events1([],_IOMod) -> ok. -do_write_event(State, {Time0, Event}) -> - case parse_event(Event) of - ignore -> - ok; - {Head,Pid,FormatList} -> - Time = maybe_utc(Time0), - Header = write_time(Time, Head), - Body = format_body(State, FormatList), - AtNode = if - node(Pid) =/= node() -> - ["** at node ",atom_to_list(node(Pid))," **\n"]; - true -> - [] - end, - Str = [Header,Body,AtNode], - case State#st.io_mod of - io_lib -> - Str; - io -> - io:put_chars(user, Str) - end +write_event({Time, {error, _GL, {Pid, Format, Args}}},IOMod) -> + T = write_time(maybe_utc(Time)), + case catch io_lib:format(add_node(Format,Pid), Args) of + S when is_list(S) -> + format(IOMod, T ++ S); + _ -> + F = add_node("ERROR: ~p - ~p~n", Pid), + format(IOMod, T ++ F, [Format,Args]) end; -do_write_event(_, _) -> +write_event({Time, {emulator, _GL, Chars}},IOMod) -> + T = write_time(maybe_utc(Time)), + case catch io_lib:format(Chars, []) of + S when is_list(S) -> + format(IOMod, T ++ S); + _ -> + format(IOMod, T ++ "ERROR: ~p ~n", [Chars]) + end; +write_event({Time, {info, _GL, {Pid, Info, _}}},IOMod) -> + T = write_time(maybe_utc(Time)), + format(IOMod, T ++ add_node("~p~n",Pid),[Info]); +write_event({Time, {error_report, _GL, {Pid, std_error, Rep}}},IOMod) -> + T = write_time(maybe_utc(Time)), + S = format_report(Rep), + format(IOMod, T ++ S ++ add_node("", Pid)); +write_event({Time, {info_report, _GL, {Pid, std_info, Rep}}},IOMod) -> + T = write_time(maybe_utc(Time), "INFO REPORT"), + S = format_report(Rep), + format(IOMod, T ++ S ++ add_node("", Pid)); +write_event({Time, {info_msg, _GL, {Pid, Format, Args}}},IOMod) -> + T = write_time(maybe_utc(Time), "INFO REPORT"), + case catch io_lib:format(add_node(Format,Pid), Args) of + S when is_list(S) -> + format(IOMod, T ++ S); + _ -> + F = add_node("ERROR: ~p - ~p~n", Pid), + format(IOMod, T ++ F, [Format,Args]) + end; +write_event({Time, {warning_report, _GL, {Pid, std_warning, Rep}}},IOMod) -> + T = write_time(maybe_utc(Time), "WARNING REPORT"), + S = format_report(Rep), + format(IOMod, T ++ S ++ add_node("", Pid)); +write_event({Time, {warning_msg, _GL, {Pid, Format, Args}}},IOMod) -> + T = write_time(maybe_utc(Time), "WARNING REPORT"), + case catch io_lib:format(add_node(Format,Pid), Args) of + S when is_list(S) -> + format(IOMod, T ++ S); + _ -> + F = add_node("ERROR: ~p - ~p~n", Pid), + format(IOMod, T ++ F, [Format,Args]) + end; +write_event({_Time, _Error},_IOMod) -> ok. -format_body(State, [{Format,Args}|T]) -> - S = try format(State, Format, Args) of - S0 -> - S0 - catch - _:_ -> - format(State, "ERROR: ~p - ~p\n", [Format,Args]) - end, - [S|format_body(State, T)]; -format_body(_State, []) -> - []. - -format(#st{depth=unlimited}, Format, Args) -> - io_lib:format(Format, Args); -format(#st{depth=Depth}, Format0, Args) -> - Format1 = io_lib:scan_format(Format0, Args), - Format = limit_format(Format1, Depth), - io_lib:build_text(Format). - -limit_format([#{control_char:=C0}=M0|T], Depth) when C0 =:= $p; - C0 =:= $w -> - C = C0 - ($a - $A), %To uppercase. - #{args:=Args} = M0, - M = M0#{control_char:=C,args:=Args++[Depth]}, - [M|limit_format(T, Depth)]; -limit_format([H|T], Depth) -> - [H|limit_format(T, Depth)]; -limit_format([], _) -> - []. - -parse_event({error, _GL, {Pid, Format, Args}}) -> - {"ERROR REPORT",Pid,[{Format,Args}]}; -parse_event({info_msg, _GL, {Pid, Format, Args}}) -> - {"INFO REPORT",Pid,[{Format, Args}]}; -parse_event({warning_msg, _GL, {Pid, Format, Args}}) -> - {"WARNING REPORT",Pid,[{Format,Args}]}; -parse_event({error_report, _GL, {Pid, std_error, Args}}) -> - {"ERROR REPORT",Pid,format_term(Args)}; -parse_event({info_report, _GL, {Pid, std_info, Args}}) -> - {"INFO REPORT",Pid,format_term(Args)}; -parse_event({warning_report, _GL, {Pid, std_warning, Args}}) -> - {"WARNING REPORT",Pid,format_term(Args)}; -parse_event(_) -> ignore. - maybe_utc(Time) -> UTC = case application:get_env(sasl, utc_log) of {ok, Val} -> Val; @@ -212,27 +176,34 @@ maybe_utc(Time, true) -> {utc, Time}; maybe_utc(Time, _) -> {local, calendar:universal_time_to_local_time(Time)}. -format_term(Term) when is_list(Term) -> - case string_p(Term) of +format(IOMod, String) -> format(IOMod, String, []). +format(io_lib, String, Args) -> io_lib:format(String, Args); +format(io, String, Args) -> io:format(user, String, Args). + +format_report(Rep) when is_list(Rep) -> + case string_p(Rep) of true -> - [{"~s\n",[Term]}]; - false -> - format_term_list(Term) + io_lib:format("~s~n",[Rep]); + _ -> + format_rep(Rep) end; -format_term(Term) -> - [{"~p\n",[Term]}]. +format_report(Rep) -> + io_lib:format("~p~n",[Rep]). -format_term_list([{Tag,Data}|T]) -> - [{" ~p: ~p\n",[Tag,Data]}|format_term_list(T)]; -format_term_list([Data|T]) -> - [{" ~p\n",[Data]}|format_term_list(T)]; -format_term_list([]) -> - []; -format_term_list(_) -> - %% Continue to allow non-proper lists for now. - %% FIXME: Remove this clause in OTP 19. +format_rep([{Tag,Data}|Rep]) -> + io_lib:format(" ~p: ~p~n",[Tag,Data]) ++ format_rep(Rep); +format_rep([Other|Rep]) -> + io_lib:format(" ~p~n",[Other]) ++ format_rep(Rep); +format_rep(_) -> []. +add_node(X, Pid) when is_atom(X) -> + add_node(atom_to_list(X), Pid); +add_node(X, Pid) when node(Pid) =/= node() -> + lists:concat([X,"** at node ",node(Pid)," **~n"]); +add_node(X, _) -> + X. + string_p([]) -> false; string_p(Term) -> @@ -255,6 +226,7 @@ string_p1([]) -> true; string_p1(_) -> false. +write_time(Time) -> write_time(Time, "ERROR REPORT"). write_time({utc,{{Y,Mo,D},{H,Mi,S}}},Type) -> io_lib:format("~n=~s==== ~p-~s-~p::~s:~s:~s UTC ===~n", [Type,D,month(Mo),Y,t(H),t(Mi),t(S)]); diff -Nru erlang-18.2-dfsg/lib/stdlib/src/escript.erl erlang-17.3-dfsg/lib/stdlib/src/escript.erl --- erlang-18.2-dfsg/lib/stdlib/src/escript.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/escript.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2015. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -621,13 +620,12 @@ {ok, {attribute,_, module, M} = Form} -> epp_parse_file(Epp, S2#state{module = M}, [Form, FileForm]); {ok, _} -> - ModForm = {attribute,a1(),module, Module}, + ModForm = {attribute,1,module, Module}, epp_parse_file2(Epp, S2, [ModForm, FileForm], OptModRes); {error, _} -> epp_parse_file2(Epp, S2, [FileForm], OptModRes); - {eof, LastLine} -> - Anno = anno(LastLine), - S#state{forms_or_bin = [FileForm, {eof, Anno}]} + {eof, _LastLine} = Eof -> + S#state{forms_or_bin = [FileForm, Eof]} end, ok = epp:close(Epp), ok = file:close(Fd), @@ -646,7 +644,7 @@ %% Optionally add export of main/1 Forms2 = case ExpMain of - false -> [{attribute, a0(), export, [{main,1}]} | Forms]; + false -> [{attribute,0,export, [{main,1}]} | Forms]; true -> Forms end, Forms3 = [FileForm2, ModForm2 | Forms2], @@ -665,8 +663,7 @@ end. pre_def_macros(File) -> - {MegaSecs, Secs, MicroSecs} = erlang:timestamp(), - Unique = erlang:unique_integer([positive]), + {MegaSecs, Secs, MicroSecs} = erlang:now(), Replace = fun(Char) -> case Char of $\. -> $\_; @@ -678,9 +675,8 @@ CleanBase ++ "__" ++ "escript__" ++ integer_to_list(MegaSecs) ++ "__" ++ - integer_to_list(Secs) ++ "__" ++ - integer_to_list(MicroSecs) ++ "__" ++ - integer_to_list(Unique), + integer_to_list(Secs) ++ "__" ++ + integer_to_list(MicroSecs), Module = list_to_atom(ModuleStr), PreDefMacros = [{'MODULE', Module, redefine}, {'MODULE_STRING', ModuleStr, redefine}], @@ -724,9 +720,8 @@ io:format("~ts:~w: ~ts\n", [S#state.file,Ln,Mod:format_error(Args)]), epp_parse_file(Epp, S#state{n_errors = S#state.n_errors + 1}, [Form | Forms]); - {eof, LastLine} -> - Anno = anno(LastLine), - S#state{forms_or_bin = lists:reverse([{eof, Anno} | Forms])} + {eof, _LastLine} = Eof -> + S#state{forms_or_bin = lists:reverse([Eof | Forms])} end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -781,8 +776,7 @@ end, Dict = parse_to_dict(Forms2), ArgsA = erl_parse:abstract(Args, 0), - Anno = a0(), - Call = {call,Anno,{atom,Anno,main},[ArgsA]}, + Call = {call,0,{atom,0,main},[ArgsA]}, try _ = erl_eval:expr(Call, erl_eval:new_bindings(), @@ -894,15 +888,6 @@ Enc -> [Enc] end. -a0() -> - anno(0). - -a1() -> - anno(1). - -anno(L) -> - erl_anno:new(L). - fatal(Str) -> throw(Str). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/ets.erl erlang-17.3-dfsg/lib/stdlib/src/ets.erl --- erlang-18.2-dfsg/lib/stdlib/src/ets.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/ets.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -72,8 +71,7 @@ rename/2, safe_fixtable/2, select/1, select/2, select/3, select_count/2, select_delete/2, select_reverse/1, select_reverse/2, select_reverse/3, setopts/2, slot/2, - take/2, - update_counter/3, update_counter/4, update_element/3]). + update_counter/3, update_element/3]). -spec all() -> [Tab] when Tab :: tab(). @@ -135,9 +133,7 @@ | {owner, pid()} | {protection, access()} | {size, non_neg_integer()} - | {type, type()} - | {write_concurrency, boolean()} - | {read_concurrency, boolean()}. + | {type, type()}. info(_) -> erlang:nif_error(undef). @@ -146,8 +142,7 @@ Tab :: tab(), Item :: compressed | fixed | heir | keypos | memory | name | named_table | node | owner | protection - | safe_fixed | size | stats | type - | write_concurrency | read_concurrency, + | safe_fixed | size | stats | type, Value :: term(). info(_, _) -> @@ -405,14 +400,6 @@ slot(_, _) -> erlang:nif_error(undef). --spec take(Tab, Key) -> [Object] when - Tab :: tab(), - Key :: term(), - Object :: tuple(). - -take(_, _) -> - erlang:nif_error(undef). - -spec update_counter(Tab, Key, UpdateOp) -> Result when Tab :: tab(), Key :: term(), @@ -440,38 +427,6 @@ update_counter(_, _, _) -> erlang:nif_error(undef). --spec update_counter(Tab, Key, UpdateOp, Default) -> Result when - Tab :: tab(), - Key :: term(), - UpdateOp :: {Pos, Incr} - | {Pos, Incr, Threshold, SetValue}, - Pos :: integer(), - Incr :: integer(), - Threshold :: integer(), - SetValue :: integer(), - Result :: integer(), - Default :: tuple(); - (Tab, Key, [UpdateOp], Default) -> [Result] when - Tab :: tab(), - Key :: term(), - UpdateOp :: {Pos, Incr} - | {Pos, Incr, Threshold, SetValue}, - Pos :: integer(), - Incr :: integer(), - Threshold :: integer(), - SetValue :: integer(), - Result :: integer(), - Default :: tuple(); - (Tab, Key, Incr, Default) -> Result when - Tab :: tab(), - Key :: term(), - Incr :: integer(), - Result :: integer(), - Default :: tuple(). - -update_counter(_, _, _, _) -> - erlang:nif_error(undef). - -spec update_element(Tab, Key, ElementSpec :: {Pos, Value}) -> boolean() when Tab :: tab(), Key :: term(), @@ -740,8 +695,7 @@ -record(filetab_options, { object_count = false :: boolean(), - md5sum = false :: boolean(), - sync = false :: boolean() + md5sum = false :: boolean() }). -spec tab2file(Tab, Filename) -> 'ok' | {'error', Reason} when @@ -756,7 +710,7 @@ Tab :: tab(), Filename :: file:name(), Options :: [Option], - Option :: {'extended_info', [ExtInfo]} | {'sync', boolean()}, + Option :: {'extended_info', [ExtInfo]}, ExtInfo :: 'md5sum' | 'object_count', Reason :: term(). @@ -837,15 +791,6 @@ List -> LogFun(NewState1,[['$end_of_table',List]]) end, - case FtOptions#filetab_options.sync of - true -> - case disk_log:sync(Name) of - ok -> ok; - {error, Reason2} -> throw(Reason2) - end; - false -> - ok - end, disk_log:close(Name) catch throw:TReason -> @@ -898,24 +843,23 @@ {FinState, [B|TL]}. parse_ft_options(Options) when is_list(Options) -> - {ok, parse_ft_options(Options, #filetab_options{}, false)}. - -parse_ft_options([], FtOpt, _) -> - FtOpt; -parse_ft_options([{sync,true} | Rest], FtOpt, EI) -> - parse_ft_options(Rest, FtOpt#filetab_options{sync = true}, EI); -parse_ft_options([{sync,false} | Rest], FtOpt, EI) -> - parse_ft_options(Rest, FtOpt, EI); -parse_ft_options([{extended_info,L} | Rest], FtOpt0, false) -> - FtOpt1 = parse_ft_info_options(FtOpt0, L), - parse_ft_options(Rest, FtOpt1, true); -parse_ft_options([Other | _], _, _) -> - throw({unknown_option, Other}); -parse_ft_options(Malformed, _, _) -> + {Opt,Rest} = case (catch lists:keytake(extended_info,1,Options)) of + false -> + {[],Options}; + {value,{extended_info,L},R} when is_list(L) -> + {L,R} + end, + case Rest of + [] -> + parse_ft_info_options(#filetab_options{}, Opt); + Other -> + throw({unknown_option, Other}) + end; +parse_ft_options(Malformed) -> throw({malformed_option, Malformed}). parse_ft_info_options(FtOpt,[]) -> - FtOpt; + {ok,FtOpt}; parse_ft_info_options(FtOpt,[object_count | T]) -> parse_ft_info_options(FtOpt#filetab_options{object_count = true}, T); parse_ft_info_options(FtOpt,[md5sum | T]) -> @@ -1309,30 +1253,18 @@ {name, Name} = lists:keyfind(name, 1, I), {type, Type} = lists:keyfind(type, 1, I), {protection, P} = lists:keyfind(protection, 1, I), + {named_table, Val} = lists:keyfind(named_table, 1, I), {keypos, _Kp} = Keypos = lists:keyfind(keypos, 1, I), {size, Sz} = lists:keyfind(size, 1, I), - L1 = [Type, P, Keypos], - L2 = case lists:keyfind(named_table, 1, I) of - {named_table, true} -> [named_table | L1]; - {named_table, false} -> L1 - end, - L3 = case lists:keyfind(compressed, 1, I) of - {compressed, true} -> [compressed | L2]; - {compressed, false} -> L2; - false -> L2 - end, - L4 = case lists:keyfind(write_concurrency, 1, I) of - {write_concurrency, _}=Wcc -> [Wcc | L3]; - _ -> L3 - end, - L5 = case lists:keyfind(read_concurrency, 1, I) of - {read_concurrency, _}=Rcc -> [Rcc | L4]; - false -> L4 - end, + Comp = case lists:keyfind(compressed, 1, I) of + {compressed, true} -> [compressed]; + {compressed, false} -> []; + false -> [] + end, case TabArg of [] -> try - Tab = ets:new(Name, L5), + Tab = ets:new(Name, [Type, P, Keypos] ++ named_table(Val) ++ Comp), {ok, Tab, Sz} catch _:_ -> throw(cannot_create_table) @@ -1341,6 +1273,8 @@ {ok, TabArg, Sz} end. +named_table(true) -> [named_table]; +named_table(false) -> []. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% tabfile_info/1 reads the head information in an ets table dumped to @@ -1679,18 +1613,13 @@ end. get_line(P, Default) -> - case line_string(io:get_line(P)) of + case io:get_line(P) of "\n" -> Default; L -> L end. -%% If the standard input is set to binary mode -%% convert it to a list so we can properly match. -line_string(Binary) when is_binary(Binary) -> unicode:characters_to_list(Binary); -line_string(Other) -> Other. - nonl(S) -> string:strip(S, right, $\n). print_number(Tab, Key, Num) -> diff -Nru erlang-18.2-dfsg/lib/stdlib/src/eval_bits.erl erlang-17.3-dfsg/lib/stdlib/src/eval_bits.erl --- erlang-18.2-dfsg/lib/stdlib/src/eval_bits.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/eval_bits.erl 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ %% %% Copyright Ericsson AB 1999-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/filelib.erl erlang-17.3-dfsg/lib/stdlib/src/filelib.erl --- erlang-18.2-dfsg/lib/stdlib/src/filelib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/filelib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -372,7 +371,7 @@ [Root|Rest] = filename:split(Pattern), case filename:pathtype(Root) of relative -> - Cwd = prepare_base(Cwd0), + Cwd = filename:join([Cwd0]), compile_wildcard_2([Root|Rest], {cwd,Cwd}); _ -> compile_wildcard_2(Rest, {root,0,Root}) diff -Nru erlang-18.2-dfsg/lib/stdlib/src/filename.erl erlang-17.3-dfsg/lib/stdlib/src/filename.erl --- erlang-18.2-dfsg/lib/stdlib/src/filename.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/filename.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2014. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -445,8 +444,6 @@ join1(RelativeName, [], [$:|Rest], win32); join1([], RelativeName, [$/|Result], OsType) -> join1(RelativeName, [], [$/|Result], OsType); -join1([], RelativeName, [$., $/|Result], OsType) -> - join1(RelativeName, [], [$/|Result], OsType); join1([], RelativeName, Result, OsType) -> join1(RelativeName, [], [$/|Result], OsType); join1([[_|_]=List|Rest], RelativeName, Result, OsType) -> @@ -473,8 +470,6 @@ join1b(RelativeName, <<>>, [$:|Rest], win32); join1b(<<>>, RelativeName, [$/|Result], OsType) -> join1b(RelativeName, <<>>, [$/|Result], OsType); -join1b(<<>>, RelativeName, [$., $/|Result], OsType) -> - join1b(RelativeName, <<>>, [$/|Result], OsType); join1b(<<>>, RelativeName, Result, OsType) -> join1b(RelativeName, <<>>, [$/|Result], OsType); join1b(<>, RelativeName, Result, OsType) when is_integer(Char) -> @@ -649,7 +644,7 @@ unix_splitb(Name) -> L = binary:split(Name,[<<"/">>],[global]), LL = case L of - [<<>>|Rest] when Rest =/= [] -> + [<<>>|Rest] -> [<<"/">>|Rest]; _ -> L diff -Nru erlang-18.2-dfsg/lib/stdlib/src/file_sorter.erl erlang-17.3-dfsg/lib/stdlib/src/file_sorter.erl --- erlang-18.2-dfsg/lib/stdlib/src/file_sorter.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/file_sorter.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -1426,8 +1425,8 @@ U = "_", Node = node(), Pid = os:getpid(), - Unique = erlang:unique_integer([positive]), - F = lists:concat(["fs_",Node,U,Pid,U,Unique,"."]), + {MSecs,Secs,MySecs} = now(), + F = lists:concat(["fs_",Node,U,Pid,U,MSecs,U,Secs,U,MySecs,"."]), TmpDir = case TmpDirOpt of default -> Dir; diff -Nru erlang-18.2-dfsg/lib/stdlib/src/gb_sets.erl erlang-17.3-dfsg/lib/stdlib/src/gb_sets.erl --- erlang-18.2-dfsg/lib/stdlib/src/gb_sets.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/gb_sets.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2015. All Rights Reserved. +%% Copyright Ericsson AB 2001-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -138,10 +137,6 @@ %% approach is that it does not require the complete list of all %% elements to be built in memory at one time. %% -%% - iterator_from(X, S): returns an iterator that can be used for -%% traversing the elements of set S greater than or equal to X; -%% see `next'. -%% %% - next(T): returns {X, T1} where X is the smallest element referred %% to by the iterator T, and T1 is the new iterator to be used for %% traversing the remaining elements, or the atom `none' if no @@ -162,8 +157,8 @@ insert/2, add/2, delete/2, delete_any/2, balance/1, union/2, union/1, intersection/2, intersection/1, is_disjoint/2, difference/2, is_subset/2, to_list/1, from_list/1, from_ordset/1, smallest/1, - largest/1, take_smallest/1, take_largest/1, iterator/1, - iterator_from/2, next/1, filter/2, fold/3, is_set/1]). + largest/1, take_smallest/1, take_largest/1, iterator/1, next/1, + filter/2, fold/3, is_set/1]). %% `sets' compatibility aliases: @@ -204,26 +199,29 @@ -export_type([set/0, set/1, iter/0, iter/1]). -type gb_set_node(Element) :: 'nil' | {Element, _, _}. +-type gb_set_node() :: gb_set_node(_). -opaque set(Element) :: {non_neg_integer(), gb_set_node(Element)}. --type set() :: set(_). +-opaque set() :: set(_). -opaque iter(Element) :: [gb_set_node(Element)]. --type iter() :: iter(_). +-opaque iter() :: [gb_set_node()]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% gb_sets:set() in OTP 17 only. + -spec empty() -> Set when - Set :: set(). + Set :: gb_sets:set(). empty() -> {0, nil}. -spec new() -> Set when - Set :: set(). + Set :: gb_sets:set(). new() -> empty(). -spec is_empty(Set) -> boolean() when - Set :: set(). + Set :: gb_sets:set(). is_empty({0, nil}) -> true; @@ -231,7 +229,7 @@ false. -spec size(Set) -> non_neg_integer() when - Set :: set(). + Set :: gb_sets:set(). size({Size, _}) -> Size. @@ -504,22 +502,6 @@ iterator(nil, As) -> As. --spec iterator_from(Element, Set) -> Iter when - Set :: set(Element), - Iter :: iter(Element). - -iterator_from(S, {_, T}) -> - iterator_from(S, T, []). - -iterator_from(S, {K, _, T}, As) when K < S -> - iterator_from(S, T, As); -iterator_from(_, {_, nil, _} = T, As) -> - [T | As]; -iterator_from(S, {_, L, _} = T, As) -> - iterator_from(S, L, [T | As]); -iterator_from(_, nil, As) -> - As. - -spec next(Iter1) -> {Element, Iter2} | 'none' when Iter1 :: iter(Element), Iter2 :: iter(Element). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/gb_trees.erl erlang-17.3-dfsg/lib/stdlib/src/gb_trees.erl --- erlang-18.2-dfsg/lib/stdlib/src/gb_trees.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/gb_trees.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2015. All Rights Reserved. +%% Copyright Ericsson AB 2001-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -103,10 +102,6 @@ %% approach is that it does not require the complete list of all %% elements to be built in memory at one time. %% -%% - iterator_from(K, T): returns an iterator that can be used for -%% traversing the entries of tree T with key greater than or -%% equal to K; see `next'. -%% %% - next(S): returns {X, V, S1} where X is the smallest key referred to %% by the iterator S, and S1 is the new iterator to be used for %% traversing the remaining entries, or the atom `none' if no entries @@ -122,7 +117,7 @@ update/3, enter/3, delete/2, delete_any/2, balance/1, is_defined/2, keys/1, values/1, to_list/1, from_orddict/1, smallest/1, largest/1, take_smallest/1, take_largest/1, - iterator/1, iterator_from/2, next/1, map/2]). + iterator/1, next/1, map/2]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -161,10 +156,11 @@ -type gb_tree_node(K, V) :: 'nil' | {K, V, gb_tree_node(K, V), gb_tree_node(K, V)}. +-type gb_tree_node() :: gb_tree_node(_, _). -opaque tree(Key, Value) :: {non_neg_integer(), gb_tree_node(Key, Value)}. --type tree() :: tree(_, _). +-opaque tree() :: tree(_, _). -opaque iter(Key, Value) :: [gb_tree_node(Key, Value)]. --type iter() :: iter(_, _). +-opaque iter() :: [gb_tree_node()]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -533,29 +529,6 @@ iterator(nil, As) -> As. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - --spec iterator_from(Key, Tree) -> Iter when - Tree :: tree(Key, Value), - Iter :: iter(Key, Value). - -iterator_from(S, {_, T}) -> - iterator_1_from(S, T). - -iterator_1_from(S, T) -> - iterator_from(S, T, []). - -iterator_from(S, {K, _, _, T}, As) when K < S -> - iterator_from(S, T, As); -iterator_from(_, {_, _, nil, _} = T, As) -> - [T | As]; -iterator_from(S, {_, _, L, _} = T, As) -> - iterator_from(S, L, [T | As]); -iterator_from(_, nil, As) -> - As. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -spec next(Iter1) -> 'none' | {Key, Value, Iter2} when Iter1 :: iter(Key, Value), Iter2 :: iter(Key, Value). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/gen.erl erlang-17.3-dfsg/lib/stdlib/src/gen.erl --- erlang-18.2-dfsg/lib/stdlib/src/gen.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/gen.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -27,7 +26,7 @@ %%% The standard behaviour should export init_it/6. %%%----------------------------------------------------------------- -export([start/5, start/6, debug_options/1, - call/3, call/4, reply/2, stop/1, stop/3]). + call/3, call/4, reply/2]). -export([init_it/6, init_it/7]). @@ -146,10 +145,56 @@ call(Process, Label, Request) -> call(Process, Label, Request, ?default_timeout). +%% Local or remote by pid +call(Pid, Label, Request, Timeout) + when is_pid(Pid), Timeout =:= infinity; + is_pid(Pid), is_integer(Timeout), Timeout >= 0 -> + do_call(Pid, Label, Request, Timeout); +%% Local by name +call(Name, Label, Request, Timeout) + when is_atom(Name), Timeout =:= infinity; + is_atom(Name), is_integer(Timeout), Timeout >= 0 -> + case whereis(Name) of + Pid when is_pid(Pid) -> + do_call(Pid, Label, Request, Timeout); + undefined -> + exit(noproc) + end; +%% Global by name call(Process, Label, Request, Timeout) - when Timeout =:= infinity; is_integer(Timeout), Timeout >= 0 -> - Fun = fun(Pid) -> do_call(Pid, Label, Request, Timeout) end, - do_for_proc(Process, Fun). + when ((tuple_size(Process) == 2 andalso element(1, Process) == global) + orelse + (tuple_size(Process) == 3 andalso element(1, Process) == via)) + andalso + (Timeout =:= infinity orelse (is_integer(Timeout) andalso Timeout >= 0)) -> + case where(Process) of + Pid when is_pid(Pid) -> + Node = node(Pid), + try do_call(Pid, Label, Request, Timeout) + catch + exit:{nodedown, Node} -> + %% A nodedown not yet detected by global, + %% pretend that it was. + exit(noproc) + end; + undefined -> + exit(noproc) + end; +%% Local by name in disguise +call({Name, Node}, Label, Request, Timeout) + when Node =:= node(), Timeout =:= infinity; + Node =:= node(), is_integer(Timeout), Timeout >= 0 -> + call(Name, Label, Request, Timeout); +%% Remote by name +call({_Name, Node}=Process, Label, Request, Timeout) + when is_atom(Node), Timeout =:= infinity; + is_atom(Node), is_integer(Timeout), Timeout >= 0 -> + if + node() =:= nonode@nohost -> + exit({nodedown, Node}); + true -> + do_call(Process, Label, Request, Timeout) + end. do_call(Process, Label, Request, Timeout) -> try erlang:monitor(process, Process) of @@ -231,65 +276,6 @@ Msg = {Tag, Reply}, try To ! Msg catch _:_ -> Msg end. -%%----------------------------------------------------------------- -%% Syncronously stop a generic process -%%----------------------------------------------------------------- -stop(Process) -> - stop(Process, normal, infinity). - -stop(Process, Reason, Timeout) - when Timeout =:= infinity; is_integer(Timeout), Timeout >= 0 -> - Fun = fun(Pid) -> proc_lib:stop(Pid, Reason, Timeout) end, - do_for_proc(Process, Fun). - -%%----------------------------------------------------------------- -%% Map different specifications of a process to either Pid or -%% {Name,Node}. Execute the given Fun with the process as only -%% argument. -%% ----------------------------------------------------------------- - -%% Local or remote by pid -do_for_proc(Pid, Fun) when is_pid(Pid) -> - Fun(Pid); -%% Local by name -do_for_proc(Name, Fun) when is_atom(Name) -> - case whereis(Name) of - Pid when is_pid(Pid) -> - Fun(Pid); - undefined -> - exit(noproc) - end; -%% Global by name -do_for_proc(Process, Fun) - when ((tuple_size(Process) == 2 andalso element(1, Process) == global) - orelse - (tuple_size(Process) == 3 andalso element(1, Process) == via)) -> - case where(Process) of - Pid when is_pid(Pid) -> - Node = node(Pid), - try Fun(Pid) - catch - exit:{nodedown, Node} -> - %% A nodedown not yet detected by global, - %% pretend that it was. - exit(noproc) - end; - undefined -> - exit(noproc) - end; -%% Local by name in disguise -do_for_proc({Name, Node}, Fun) when Node =:= node() -> - do_for_proc(Name, Fun); -%% Remote by name -do_for_proc({_Name, Node} = Process, Fun) when is_atom(Node) -> - if - node() =:= nonode@nohost -> - exit({nodedown, Node}); - true -> - Fun(Process) - end. - - %%%----------------------------------------------------------------- %%% Misc. functions. %%%----------------------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/stdlib/src/gen_event.erl erlang-17.3-dfsg/lib/stdlib/src/gen_event.erl --- erlang-18.2-dfsg/lib/stdlib/src/gen_event.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/gen_event.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2014. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -32,8 +31,8 @@ %%% Modified by Martin - uses proc_lib, sys and gen! --export([start/0, start/1, start_link/0, start_link/1, stop/1, stop/3, - notify/2, sync_notify/2, +-export([start/0, start/1, start_link/0, start_link/1, stop/1, notify/2, + sync_notify/2, add_handler/3, add_sup_handler/3, delete_handler/3, swap_handler/3, swap_sup_handler/3, which_handlers/1, call/3, call/4, wake_hib/4]). @@ -50,6 +49,8 @@ -import(error_logger, [error_msg/2]). +-define(reply(X), From ! {element(2,Tag), X}). + -record(handler, {module :: atom(), id = false, state, @@ -100,14 +101,6 @@ -callback code_change(OldVsn :: (term() | {down, term()}), State :: term(), Extra :: term()) -> {ok, NewState :: term()}. --callback format_status(Opt, StatusData) -> Status when - Opt :: 'normal' | 'terminate', - StatusData :: [PDict | State], - PDict :: [{Key :: term(), Value :: term()}], - State :: term(), - Status :: term(). - --optional_callbacks([format_status/2]). %%--------------------------------------------------------------------------- @@ -192,11 +185,7 @@ which_handlers(M) -> rpc(M, which_handlers). -spec stop(emgr_ref()) -> 'ok'. -stop(M) -> - gen:stop(M). - -stop(M, Reason, Timeout) -> - gen:stop(M, Reason, Timeout). +stop(M) -> rpc(M, stop). rpc(M, Cmd) -> {ok, Reply} = gen:call(M, self(), Cmd, infinity), @@ -260,49 +249,49 @@ {notify, Event} -> {Hib,MSL1} = server_notify(Event, handle_event, MSL, ServerName), loop(Parent, ServerName, MSL1, Debug, Hib); - {_From, Tag, {sync_notify, Event}} -> + {From, Tag, {sync_notify, Event}} -> {Hib, MSL1} = server_notify(Event, handle_event, MSL, ServerName), - reply(Tag, ok), + ?reply(ok), loop(Parent, ServerName, MSL1, Debug, Hib); {'EXIT', From, Reason} -> MSL1 = handle_exit(From, Reason, MSL, ServerName), loop(Parent, ServerName, MSL1, Debug, false); - {_From, Tag, {call, Handler, Query}} -> + {From, Tag, {call, Handler, Query}} -> {Hib, Reply, MSL1} = server_call(Handler, Query, MSL, ServerName), - reply(Tag, Reply), + ?reply(Reply), loop(Parent, ServerName, MSL1, Debug, Hib); - {_From, Tag, {add_handler, Handler, Args}} -> + {From, Tag, {add_handler, Handler, Args}} -> {Hib, Reply, MSL1} = server_add_handler(Handler, Args, MSL), - reply(Tag, Reply), + ?reply(Reply), loop(Parent, ServerName, MSL1, Debug, Hib); - {_From, Tag, {add_sup_handler, Handler, Args, SupP}} -> + {From, Tag, {add_sup_handler, Handler, Args, SupP}} -> {Hib, Reply, MSL1} = server_add_sup_handler(Handler, Args, MSL, SupP), - reply(Tag, Reply), + ?reply(Reply), loop(Parent, ServerName, MSL1, Debug, Hib); - {_From, Tag, {delete_handler, Handler, Args}} -> + {From, Tag, {delete_handler, Handler, Args}} -> {Reply, MSL1} = server_delete_handler(Handler, Args, MSL, ServerName), - reply(Tag, Reply), + ?reply(Reply), loop(Parent, ServerName, MSL1, Debug, false); - {_From, Tag, {swap_handler, Handler1, Args1, Handler2, Args2}} -> + {From, Tag, {swap_handler, Handler1, Args1, Handler2, Args2}} -> {Hib, Reply, MSL1} = server_swap_handler(Handler1, Args1, Handler2, Args2, MSL, ServerName), - reply(Tag, Reply), + ?reply(Reply), loop(Parent, ServerName, MSL1, Debug, Hib); - {_From, Tag, {swap_sup_handler, Handler1, Args1, Handler2, Args2, + {From, Tag, {swap_sup_handler, Handler1, Args1, Handler2, Args2, Sup}} -> {Hib, Reply, MSL1} = server_swap_handler(Handler1, Args1, Handler2, Args2, MSL, Sup, ServerName), - reply(Tag, Reply), + ?reply(Reply), loop(Parent, ServerName, MSL1, Debug, Hib); - {_From, Tag, stop} -> + {From, Tag, stop} -> catch terminate_server(normal, Parent, MSL, ServerName), - reply(Tag, ok); - {_From, Tag, which_handlers} -> - reply(Tag, the_handlers(MSL)), + ?reply(ok); + {From, Tag, which_handlers} -> + ?reply(the_handlers(MSL)), loop(Parent, ServerName, MSL, Debug, false); - {_From, Tag, get_modules} -> - reply(Tag, get_modules(MSL)), + {From, Tag, get_modules} -> + ?reply(get_modules(MSL)), loop(Parent, ServerName, MSL, Debug, false); Other -> {Hib, MSL1} = server_notify(Other, handle_info, MSL, ServerName), @@ -314,10 +303,6 @@ do_unlink(Parent, MSL), exit(Reason). -reply({From, Ref}, Msg) -> - From ! {Ref, Msg}, - ok. - %% unlink the supervisor process of all supervised handlers. %% We do not want a handler supervisor to EXIT due to the %% termination of the event manager (server). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/gen_fsm.erl erlang-17.3-dfsg/lib/stdlib/src/gen_fsm.erl --- erlang-18.2-dfsg/lib/stdlib/src/gen_fsm.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/gen_fsm.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -107,7 +106,6 @@ -export([start/3, start/4, start_link/3, start_link/4, - stop/1, stop/3, send_event/2, sync_send_event/2, sync_send_event/3, send_all_state_event/2, sync_send_all_state_event/2, sync_send_all_state_event/3, @@ -162,14 +160,6 @@ -callback code_change(OldVsn :: term() | {down, term()}, StateName :: atom(), StateData :: term(), Extra :: term()) -> {ok, NextStateName :: atom(), NewStateData :: term()}. --callback format_status(Opt, StatusData) -> Status when - Opt :: 'normal' | 'terminate', - StatusData :: [PDict | State], - PDict :: [{Key :: term(), Value :: term()}], - State :: term(), - Status :: term(). - --optional_callbacks([format_status/2]). %%% --------------------------------------------------- %%% Starts a generic state machine. @@ -199,11 +189,6 @@ start_link(Name, Mod, Args, Options) -> gen:start(?MODULE, link, Name, Mod, Args, Options). -stop(Name) -> - gen:stop(Name). - -stop(Name, Reason, Timeout) -> - gen:stop(Name, Reason, Timeout). send_event({global, Name}, Event) -> catch global:send(Name, {'$gen_event', Event}), diff -Nru erlang-18.2-dfsg/lib/stdlib/src/gen_server.erl erlang-17.3-dfsg/lib/stdlib/src/gen_server.erl --- erlang-18.2-dfsg/lib/stdlib/src/gen_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/gen_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -89,7 +88,6 @@ %% API -export([start/3, start/4, start_link/3, start_link/4, - stop/1, stop/3, call/2, call/3, cast/2, reply/2, abcast/2, abcast/3, @@ -139,15 +137,6 @@ -callback code_change(OldVsn :: (term() | {down, term()}), State :: term(), Extra :: term()) -> {ok, NewState :: term()} | {error, Reason :: term()}. --callback format_status(Opt, StatusData) -> Status when - Opt :: 'normal' | 'terminate', - StatusData :: [PDict | State], - PDict :: [{Key :: term(), Value :: term()}], - State :: term(), - Status :: term(). - --optional_callbacks([format_status/2]). - %%% ----------------------------------------------------------------- %%% Starts a generic server. @@ -179,17 +168,6 @@ %% ----------------------------------------------------------------- -%% Stop a generic server and wait for it to terminate. -%% If the server is located at another node, that node will -%% be monitored. -%% ----------------------------------------------------------------- -stop(Name) -> - gen:stop(Name). - -stop(Name, Reason, Timeout) -> - gen:stop(Name, Reason, Timeout). - -%% ----------------------------------------------------------------- %% Make a call to a generic server. %% If the server is located at another node, that node will %% be monitored. @@ -589,88 +567,28 @@ end end. -%% --------------------------------------------------- -%% Helper functions for try-catch of callbacks. -%% Returns the return value of the callback, or -%% {'EXIT', ExitReason, ReportReason} (if an exception occurs) -%% -%% ExitReason is the reason that shall be used when the process -%% terminates. -%% -%% ReportReason is the reason that shall be printed in the error -%% report. -%% -%% These functions are introduced in order to add the stack trace in -%% the error report produced when a callback is terminated with -%% erlang:exit/1 (OTP-12263). -%% --------------------------------------------------- - -try_dispatch({'$gen_cast', Msg}, Mod, State) -> - try_dispatch(Mod, handle_cast, Msg, State); -try_dispatch(Info, Mod, State) -> - try_dispatch(Mod, handle_info, Info, State). - -try_dispatch(Mod, Func, Msg, State) -> - try - {ok, Mod:Func(Msg, State)} - catch - throw:R -> - {ok, R}; - error:R -> - Stacktrace = erlang:get_stacktrace(), - {'EXIT', {R, Stacktrace}, {R, Stacktrace}}; - exit:R -> - Stacktrace = erlang:get_stacktrace(), - {'EXIT', R, {R, Stacktrace}} - end. - -try_handle_call(Mod, Msg, From, State) -> - try - {ok, Mod:handle_call(Msg, From, State)} - catch - throw:R -> - {ok, R}; - error:R -> - Stacktrace = erlang:get_stacktrace(), - {'EXIT', {R, Stacktrace}, {R, Stacktrace}}; - exit:R -> - Stacktrace = erlang:get_stacktrace(), - {'EXIT', R, {R, Stacktrace}} - end. - -try_terminate(Mod, Reason, State) -> - try - {ok, Mod:terminate(Reason, State)} - catch - throw:R -> - {ok, R}; - error:R -> - Stacktrace = erlang:get_stacktrace(), - {'EXIT', {R, Stacktrace}, {R, Stacktrace}}; - exit:R -> - Stacktrace = erlang:get_stacktrace(), - {'EXIT', R, {R, Stacktrace}} - end. - - %%% --------------------------------------------------- %%% Message handling functions %%% --------------------------------------------------- +dispatch({'$gen_cast', Msg}, Mod, State) -> + Mod:handle_cast(Msg, State); +dispatch(Info, Mod, State) -> + Mod:handle_info(Info, State). + handle_msg({'$gen_call', From, Msg}, Parent, Name, State, Mod) -> - Result = try_handle_call(Mod, Msg, From, State), - case Result of - {ok, {reply, Reply, NState}} -> + case catch Mod:handle_call(Msg, From, State) of + {reply, Reply, NState} -> reply(From, Reply), loop(Parent, Name, NState, Mod, infinity, []); - {ok, {reply, Reply, NState, Time1}} -> + {reply, Reply, NState, Time1} -> reply(From, Reply), loop(Parent, Name, NState, Mod, Time1, []); - {ok, {noreply, NState}} -> + {noreply, NState} -> loop(Parent, Name, NState, Mod, infinity, []); - {ok, {noreply, NState, Time1}} -> + {noreply, NState, Time1} -> loop(Parent, Name, NState, Mod, Time1, []); - {ok, {stop, Reason, Reply, NState}} -> + {stop, Reason, Reply, NState} -> {'EXIT', R} = (catch terminate(Reason, Name, Msg, Mod, NState, [])), reply(From, Reply), @@ -678,27 +596,26 @@ Other -> handle_common_reply(Other, Parent, Name, Msg, Mod, State) end; handle_msg(Msg, Parent, Name, State, Mod) -> - Reply = try_dispatch(Msg, Mod, State), + Reply = (catch dispatch(Msg, Mod, State)), handle_common_reply(Reply, Parent, Name, Msg, Mod, State). handle_msg({'$gen_call', From, Msg}, Parent, Name, State, Mod, Debug) -> - Result = try_handle_call(Mod, Msg, From, State), - case Result of - {ok, {reply, Reply, NState}} -> + case catch Mod:handle_call(Msg, From, State) of + {reply, Reply, NState} -> Debug1 = reply(Name, From, Reply, NState, Debug), loop(Parent, Name, NState, Mod, infinity, Debug1); - {ok, {reply, Reply, NState, Time1}} -> + {reply, Reply, NState, Time1} -> Debug1 = reply(Name, From, Reply, NState, Debug), loop(Parent, Name, NState, Mod, Time1, Debug1); - {ok, {noreply, NState}} -> + {noreply, NState} -> Debug1 = sys:handle_debug(Debug, fun print_event/3, Name, {noreply, NState}), loop(Parent, Name, NState, Mod, infinity, Debug1); - {ok, {noreply, NState, Time1}} -> + {noreply, NState, Time1} -> Debug1 = sys:handle_debug(Debug, fun print_event/3, Name, {noreply, NState}), loop(Parent, Name, NState, Mod, Time1, Debug1); - {ok, {stop, Reason, Reply, NState}} -> + {stop, Reason, Reply, NState} -> {'EXIT', R} = (catch terminate(Reason, Name, Msg, Mod, NState, Debug)), _ = reply(Name, From, Reply, NState, Debug), @@ -707,39 +624,39 @@ handle_common_reply(Other, Parent, Name, Msg, Mod, State, Debug) end; handle_msg(Msg, Parent, Name, State, Mod, Debug) -> - Reply = try_dispatch(Msg, Mod, State), + Reply = (catch dispatch(Msg, Mod, State)), handle_common_reply(Reply, Parent, Name, Msg, Mod, State, Debug). handle_common_reply(Reply, Parent, Name, Msg, Mod, State) -> case Reply of - {ok, {noreply, NState}} -> + {noreply, NState} -> loop(Parent, Name, NState, Mod, infinity, []); - {ok, {noreply, NState, Time1}} -> + {noreply, NState, Time1} -> loop(Parent, Name, NState, Mod, Time1, []); - {ok, {stop, Reason, NState}} -> + {stop, Reason, NState} -> terminate(Reason, Name, Msg, Mod, NState, []); - {'EXIT', ExitReason, ReportReason} -> - terminate(ExitReason, ReportReason, Name, Msg, Mod, State, []); - {ok, BadReply} -> - terminate({bad_return_value, BadReply}, Name, Msg, Mod, State, []) + {'EXIT', What} -> + terminate(What, Name, Msg, Mod, State, []); + _ -> + terminate({bad_return_value, Reply}, Name, Msg, Mod, State, []) end. handle_common_reply(Reply, Parent, Name, Msg, Mod, State, Debug) -> case Reply of - {ok, {noreply, NState}} -> + {noreply, NState} -> Debug1 = sys:handle_debug(Debug, fun print_event/3, Name, {noreply, NState}), loop(Parent, Name, NState, Mod, infinity, Debug1); - {ok, {noreply, NState, Time1}} -> + {noreply, NState, Time1} -> Debug1 = sys:handle_debug(Debug, fun print_event/3, Name, {noreply, NState}), loop(Parent, Name, NState, Mod, Time1, Debug1); - {ok, {stop, Reason, NState}} -> + {stop, Reason, NState} -> terminate(Reason, Name, Msg, Mod, NState, Debug); - {'EXIT', ExitReason, ReportReason} -> - terminate(ExitReason, ReportReason, Name, Msg, Mod, State, Debug); - {ok, BadReply} -> - terminate({bad_return_value, BadReply}, Name, Msg, Mod, State, Debug) + {'EXIT', What} -> + terminate(What, Name, Msg, Mod, State, Debug); + _ -> + terminate({bad_return_value, Reply}, Name, Msg, Mod, State, Debug) end. reply(Name, {To, Tag}, Reply, State, Debug) -> @@ -800,20 +717,14 @@ %%% Terminate the server. %%% --------------------------------------------------- --spec terminate(_, _, _, _, _, _) -> no_return(). terminate(Reason, Name, Msg, Mod, State, Debug) -> - terminate(Reason, Reason, Name, Msg, Mod, State, Debug). - --spec terminate(_, _, _, _, _, _, _) -> no_return(). -terminate(ExitReason, ReportReason, Name, Msg, Mod, State, Debug) -> - Reply = try_terminate(Mod, ExitReason, State), - case Reply of - {'EXIT', ExitReason1, ReportReason1} -> + case catch Mod:terminate(Reason, State) of + {'EXIT', R} -> FmtState = format_status(terminate, Mod, get(), State), - error_info(ReportReason1, Name, Msg, FmtState, Debug), - exit(ExitReason1); + error_info(R, Name, Msg, FmtState, Debug), + exit(R); _ -> - case ExitReason of + case Reason of normal -> exit(normal); shutdown -> @@ -822,8 +733,8 @@ exit(Shutdown); _ -> FmtState = format_status(terminate, Mod, get(), State), - error_info(ReportReason, Name, Msg, FmtState, Debug), - exit(ExitReason) + error_info(Reason, Name, Msg, FmtState, Debug), + exit(Reason) end end. @@ -871,10 +782,22 @@ debug_options(Name, Opts) -> case opt(debug, Opts) of - {ok, Options} -> dbg_opts(Name, Options); - _ -> [] + {ok, Options} -> dbg_options(Name, Options); + _ -> dbg_options(Name, []) end. +dbg_options(Name, []) -> + Opts = + case init:get_argument(generic_debug) of + error -> + []; + _ -> + [log, statistics] + end, + dbg_opts(Name, Opts); +dbg_options(Name, Opts) -> + dbg_opts(Name, Opts). + dbg_opts(Name, Opts) -> case catch sys:debug_options(Opts) of {'EXIT',_} -> diff -Nru erlang-18.2-dfsg/lib/stdlib/src/io.erl erlang-17.3-dfsg/lib/stdlib/src/io.erl --- erlang-18.2-dfsg/lib/stdlib/src/io.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/io.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -46,7 +45,7 @@ %% ErrorDescription is whatever the I/O-server sends. -type server_no_data() :: {'error', ErrorDescription :: term()} | 'eof'. --type location() :: erl_anno:location(). +-type location() :: erl_scan:location(). %%------------------------------------------------------------------------- @@ -567,23 +566,12 @@ execute_request(Pid, {Convert,Converted}) -> Mref = erlang:monitor(process, Pid), - Pid ! {io_request,self(),Mref,Converted}, - - receive - {io_reply, Mref, Reply} -> - erlang:demonitor(Mref, [flush]), - if - Convert -> - convert_binaries(Reply); - true -> - Reply - end; - {'DOWN', Mref, _, _, _} -> - receive - {'EXIT', Pid, _What} -> true - after 0 -> true - end, - {error,terminated} + Pid ! {io_request,self(),Pid,Converted}, + if + Convert -> + convert_binaries(wait_io_mon_reply(Pid, Mref)); + true -> + wait_io_mon_reply(Pid, Mref) end. requests(Requests) -> %Requests as atomic action @@ -609,6 +597,26 @@ default_output() -> group_leader(). +wait_io_mon_reply(From, Mref) -> + receive + {io_reply, From, Reply} -> + erlang:demonitor(Mref, [flush]), + Reply; + {'EXIT', From, _What} -> + receive + {'DOWN', Mref, _, _, _} -> true + after 0 -> true + end, + {error,terminated}; + {'DOWN', Mref, _, _, _} -> + receive + {'EXIT', From, _What} -> true + after 0 -> true + end, + {error,terminated} + end. + + %% io_requests(Requests) %% Transform requests into correct i/o server messages. Only handle the %% one we KNOW must be changed, others, including incorrect ones, are diff -Nru erlang-18.2-dfsg/lib/stdlib/src/io_lib.erl erlang-17.3-dfsg/lib/stdlib/src/io_lib.erl --- erlang-18.2-dfsg/lib/stdlib/src/io_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/io_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2014. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -61,7 +60,6 @@ -module(io_lib). -export([fwrite/2,fread/2,fread/3,format/2]). --export([scan_format/2,unscan_format/1,build_text/1]). -export([print/1,print/4,indentation/2]). -export([write/1,write/2,write/3,nl/0,format_prompt/1,format_prompt/2]). @@ -85,7 +83,7 @@ deep_unicode_char_list/1]). -export_type([chars/0, latin1_string/0, continuation/0, - fread_error/0, fread_item/0, format_spec/0]). + fread_error/0, fread_item/0]). %%---------------------------------------------------------------------- @@ -110,18 +108,6 @@ -type fread_item() :: string() | atom() | integer() | float(). --type format_spec() :: - #{ - control_char => char(), - args => [any()], - width => 'none' | integer(), - adjust => 'left' | 'right', - precision => 'none' | integer(), - pad_char => char(), - encoding => 'unicode' | 'latin1', - strings => boolean() - }. - %%---------------------------------------------------------------------- %% Interface calls to sub-modules. @@ -170,31 +156,6 @@ Other end. --spec scan_format(Format, Data) -> FormatList when - Format :: io:format(), - Data :: [term()], - FormatList :: [char() | format_spec()]. - -scan_format(Format, Args) -> - try io_lib_format:scan(Format, Args) - catch - _:_ -> erlang:error(badarg, [Format, Args]) - end. - --spec unscan_format(FormatList) -> {Format, Data} when - FormatList :: [char() | format_spec()], - Format :: io:format(), - Data :: [term()]. - -unscan_format(FormatList) -> - io_lib_format:unscan(FormatList). - --spec build_text(FormatList) -> chars() when - FormatList :: [char() | format_spec()]. - -build_text(FormatList) -> - io_lib_format:build(FormatList). - -spec print(Term) -> chars() when Term :: term(). @@ -288,8 +249,6 @@ end; write(F, _D) when is_function(F) -> erlang:fun_to_list(F); -write(Term, D) when is_map(Term) -> - write_map(Term, D); write(T, D) when is_tuple(T) -> if D =:= 1 -> "{...}"; @@ -298,7 +257,9 @@ [write(element(1, T), D-1)| write_tail(tl(tuple_to_list(T)), D-1, $,)], $}] - end. + end; +%write(Term, D) when is_map(Term) -> write_map(Term, D); +write(Term, D) -> write_map(Term, D). %% write_tail(List, Depth, CharacterBeforeDots) %% Test the terminating case first as this looks better with depth. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/io_lib_format.erl erlang-17.3-dfsg/lib/stdlib/src/io_lib_format.erl --- erlang-18.2-dfsg/lib/stdlib/src/io_lib_format.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/io_lib_format.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2014. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -21,9 +20,10 @@ %% Formatting functions of io library. --export([fwrite/2,fwrite_g/1,indentation/2,scan/2,unscan/1,build/1]). +-export([fwrite/2,fwrite_g/1,indentation/2]). -%% Format the arguments in Args after string Format. Just generate +%% fwrite(Format, ArgList) -> string(). +%% Format the arguments in ArgList after string Format. Just generate %% an error if there is an error in the arguments. %% %% To do the printing command correctly we need to calculate the @@ -37,84 +37,15 @@ %% and it also splits the handling of the control characters into two %% parts. --spec fwrite(Format, Data) -> FormatList when - Format :: io:format(), - Data :: [term()], - FormatList :: [char() | io_lib:format_spec()]. - +fwrite(Format, Args) when is_atom(Format) -> + fwrite(atom_to_list(Format), Args); +fwrite(Format, Args) when is_binary(Format) -> + fwrite(binary_to_list(Format), Args); fwrite(Format, Args) -> - build(scan(Format, Args)). - -%% Build the output text for a pre-parsed format list. - --spec build(FormatList) -> io_lib:chars() when - FormatList :: [char() | io_lib:format_spec()]. - -build(Cs) -> + Cs = collect(Format, Args), Pc = pcount(Cs), build(Cs, Pc, 0). -%% Parse all control sequences in the format string. - --spec scan(Format, Data) -> FormatList when - Format :: io:format(), - Data :: [term()], - FormatList :: [char() | io_lib:format_spec()]. - -scan(Format, Args) when is_atom(Format) -> - scan(atom_to_list(Format), Args); -scan(Format, Args) when is_binary(Format) -> - scan(binary_to_list(Format), Args); -scan(Format, Args) -> - collect(Format, Args). - -%% Revert a pre-parsed format list to a plain character list and a -%% list of arguments. - --spec unscan(FormatList) -> {Format, Data} when - FormatList :: [char() | io_lib:format_spec()], - Format :: io:format(), - Data :: [term()]. - -unscan(Cs) -> - {print(Cs), args(Cs)}. - -args([#{args := As} | Cs]) -> - As ++ args(Cs); -args([_C | Cs]) -> - args(Cs); -args([]) -> - []. - -print([#{control_char := C, width := F, adjust := Ad, precision := P, - pad_char := Pad, encoding := Encoding, strings := Strings} | Cs]) -> - print(C, F, Ad, P, Pad, Encoding, Strings) ++ print(Cs); -print([C | Cs]) -> - [C | print(Cs)]; -print([]) -> - []. - -print(C, F, Ad, P, Pad, Encoding, Strings) -> - [$~] ++ print_field_width(F, Ad) ++ print_precision(P) ++ - print_pad_char(Pad) ++ print_encoding(Encoding) ++ - print_strings(Strings) ++ [C]. - -print_field_width(none, _Ad) -> ""; -print_field_width(F, left) -> integer_to_list(-F); -print_field_width(F, right) -> integer_to_list(F). - -print_precision(none) -> ""; -print_precision(P) -> [$. | integer_to_list(P)]. - -print_pad_char($\s) -> ""; % default, no need to make explicit -print_pad_char(Pad) -> [$., Pad]. - -print_encoding(unicode) -> "t"; -print_encoding(latin1) -> "". - -print_strings(false) -> "l"; -print_strings(true) -> "". - collect([$~|Fmt0], Args0) -> {C,Fmt1,Args1} = collect_cseq(Fmt0, Args0), [C|collect(Fmt1, Args1)]; @@ -129,10 +60,7 @@ {Encoding,Fmt4,Args4} = encoding(Fmt3, Args3), {Strings,Fmt5,Args5} = strings(Fmt4, Args4), {C,As,Fmt6,Args6} = collect_cc(Fmt5, Args5), - FormatSpec = #{control_char => C, args => As, width => F, adjust => Ad, - precision => P, pad_char => Pad, encoding => Encoding, - strings => Strings}, - {FormatSpec,Fmt6,Args6}. + {{C,As,F,Ad,P,Pad,Encoding,Strings},Fmt6,Args6}. encoding([$t|Fmt],Args) -> true = hd(Fmt) =/= $l, @@ -208,19 +136,17 @@ pcount(Cs) -> pcount(Cs, 0). -pcount([#{control_char := $p}|Cs], Acc) -> pcount(Cs, Acc+1); -pcount([#{control_char := $P}|Cs], Acc) -> pcount(Cs, Acc+1); +pcount([{$p,_As,_F,_Ad,_P,_Pad,_Enc,_Str}|Cs], Acc) -> pcount(Cs, Acc+1); +pcount([{$P,_As,_F,_Ad,_P,_Pad,_Enc,_Str}|Cs], Acc) -> pcount(Cs, Acc+1); pcount([_|Cs], Acc) -> pcount(Cs, Acc); pcount([], Acc) -> Acc. -%% build([Control], Pc, Indentation) -> io_lib:chars(). +%% build([Control], Pc, Indentation) -> string(). %% Interpret the control structures. Count the number of print %% remaining and only calculate indentation when necessary. Must also %% be smart when calculating indentation for characters in format. -build([#{control_char := C, args := As, width := F, adjust := Ad, - precision := P, pad_char := Pad, encoding := Enc, - strings := Str} | Cs], Pc0, I) -> +build([{C,As,F,Ad,P,Pad,Enc,Str}|Cs], Pc0, I) -> S = control(C, As, F, Ad, P, Pad, Enc, Str, I), Pc1 = decr_pc(C, Pc0), if @@ -236,14 +162,10 @@ decr_pc($P, Pc) -> Pc - 1; decr_pc(_, Pc) -> Pc. - +%% indentation(String, Indentation) -> Indentation. %% Calculate the indentation of the end of a string given its start %% indentation. We assume tabs at 8 cols. --spec indentation(String, StartIndent) -> integer() when - String :: io_lib:chars(), - StartIndent :: integer(). - indentation([$\n|Cs], _I) -> indentation(Cs, 0); indentation([$\t|Cs], I) -> indentation(Cs, ((I + 8) div 8) * 8); indentation([C|Cs], I) when is_integer(C) -> @@ -444,6 +366,7 @@ float_data([_|Cs], Ds) -> float_data(Cs, Ds). +%% fwrite_g(Float) %% Writes the shortest, correctly rounded string that converts %% to Float when read back with list_to_float/1. %% @@ -451,8 +374,6 @@ %% in Proceedings of the SIGPLAN '96 Conference on Programming %% Language Design and Implementation. --spec fwrite_g(float()) -> string(). - fwrite_g(0.0) -> "0.0"; fwrite_g(Float) when is_float(Float) -> @@ -721,7 +642,7 @@ term([Prefix|S], F, Adj, none, Pad) end. -%% char(Char, Field, Adjust, Precision, PadChar) -> chars(). +%% char(Char, Field, Adjust, Precision, PadChar) -> string(). char(C, none, _Adj, none, _Pad) -> [C]; char(C, F, _Adj, none, _Pad) -> chars(C, F); diff -Nru erlang-18.2-dfsg/lib/stdlib/src/io_lib_fread.erl erlang-17.3-dfsg/lib/stdlib/src/io_lib_fread.erl --- erlang-18.2-dfsg/lib/stdlib/src/io_lib_fread.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/io_lib_fread.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/io_lib_pretty.erl erlang-17.3-dfsg/lib/stdlib/src/io_lib_pretty.erl --- erlang-18.2-dfsg/lib/stdlib/src/io_lib_pretty.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/io_lib_pretty.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/lib.erl erlang-17.3-dfsg/lib/stdlib/src/lib.erl --- erlang-18.2-dfsg/lib/stdlib/src/lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/lists.erl erlang-17.3-dfsg/lib/stdlib/src/lists.erl --- erlang-18.2-dfsg/lib/stdlib/src/lists.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/lists.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/log_mf_h.erl erlang-17.3-dfsg/lib/stdlib/src/log_mf_h.erl --- erlang-18.2-dfsg/lib/stdlib/src/log_mf_h.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/log_mf_h.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/Makefile erlang-17.3-dfsg/lib/stdlib/src/Makefile --- erlang-18.2-dfsg/lib/stdlib/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1996-2015. All Rights Reserved. +# Copyright Ericsson AB 1996-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -59,7 +58,6 @@ edlin \ edlin_expand \ epp \ - erl_anno \ erl_bits \ erl_compile \ erl_eval \ @@ -99,6 +97,7 @@ otp_internal \ orddict \ ordsets \ + pg \ re \ pool \ proc_lib \ @@ -106,7 +105,6 @@ qlc \ qlc_pt \ queue \ - rand \ random \ sets \ shell \ @@ -123,7 +121,6 @@ zip HRL_FILES= \ - ../include/assert.hrl \ ../include/erl_compile.hrl \ ../include/erl_bits.hrl \ ../include/ms_transform.hrl \ @@ -172,7 +169,6 @@ # specifications. primary_bootstrap_compiler: \ $(BOOTSTRAP_COMPILER)/ebin/epp.beam \ - $(BOOTSTRAP_COMPILER)/ebin/erl_anno.beam \ $(BOOTSTRAP_COMPILER)/ebin/erl_scan.beam \ $(BOOTSTRAP_COMPILER)/ebin/erl_parse.beam \ $(BOOTSTRAP_COMPILER)/ebin/erl_lint.beam \ diff -Nru erlang-18.2-dfsg/lib/stdlib/src/maps.erl erlang-17.3-dfsg/lib/stdlib/src/maps.erl --- erlang-18.2-dfsg/lib/stdlib/src/maps.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/maps.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,33 +3,47 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% -module(maps). --export([get/3,filter/2,fold/3, map/2, - size/1, - without/2, with/2]). +-export([ + fold/3, + map/2, + size/1, + without/2, + with/2, + get/3 + ]). %%% BIFs --export([get/2, find/2, from_list/1, - is_key/2, keys/1, merge/2, - new/0, put/3, remove/2, - to_list/1, update/3, values/1]). +-export([ + get/2, + find/2, + from_list/1, + is_key/2, + keys/1, + merge/2, + new/0, + put/3, + remove/2, + to_list/1, + update/3, + values/1 + ]). -spec get(Key,Map) -> Value when Key :: term(), @@ -136,28 +150,13 @@ Value :: term(), Default :: term(). -get(Key,Map,Default) when is_map(Map) -> +get(Key, Map, Default) -> case maps:find(Key, Map) of {ok, Value} -> Value; error -> Default - end; -get(Key,Map,Default) -> - erlang:error({badmap,Map},[Key,Map,Default]). - - --spec filter(Pred,Map1) -> Map2 when - Pred :: fun((Key, Value) -> boolean()), - Key :: term(), - Value :: term(), - Map1 :: map(), - Map2 :: map(). - -filter(Pred,Map) when is_function(Pred,2), is_map(Map) -> - maps:from_list([{K,V}||{K,V}<-maps:to_list(Map),Pred(K,V)]); -filter(Pred,Map) -> - erlang:error(error_type(Map),[Pred,Map]). + end. -spec fold(Fun,Init,Map) -> Acc when @@ -170,10 +169,8 @@ K :: term(), V :: term(). -fold(Fun,Init,Map) when is_function(Fun,3), is_map(Map) -> - lists:foldl(fun({K,V},A) -> Fun(K,V,A) end,Init,maps:to_list(Map)); -fold(Fun,Init,Map) -> - erlang:error(error_type(Map),[Fun,Init,Map]). +fold(Fun, Init, Map) when is_function(Fun,3), is_map(Map) -> + lists:foldl(fun({K,V},A) -> Fun(K,V,A) end,Init,maps:to_list(Map)). -spec map(Fun,Map1) -> Map2 when Fun :: fun((K, V1) -> V2), @@ -183,19 +180,18 @@ V1 :: term(), V2 :: term(). -map(Fun,Map) when is_function(Fun, 2), is_map(Map) -> - maps:from_list([{K,Fun(K,V)}||{K,V}<-maps:to_list(Map)]); -map(Fun,Map) -> - erlang:error(error_type(Map),[Fun,Map]). +map(Fun, Map) when is_function(Fun, 2), is_map(Map) -> + maps:from_list(lists:map(fun + ({K,V}) -> + {K,Fun(K,V)} + end,maps:to_list(Map))). -spec size(Map) -> non_neg_integer() when Map :: map(). size(Map) when is_map(Map) -> - erlang:map_size(Map); -size(Val) -> - erlang:error({badmap,Val},[Val]). + erlang:map_size(Map). -spec without(Ks,Map1) -> Map2 when @@ -204,10 +200,8 @@ Map2 :: map(), K :: term(). -without(Ks,M) when is_list(Ks), is_map(M) -> - maps:from_list([{K,V}||{K,V} <- maps:to_list(M), not lists:member(K, Ks)]); -without(Ks,M) -> - erlang:error(error_type(M),[Ks,M]). +without(Ks, M) when is_list(Ks), is_map(M) -> + maps:from_list([{K,V}||{K,V} <- maps:to_list(M), not lists:member(K, Ks)]). -spec with(Ks, Map1) -> Map2 when @@ -216,11 +210,5 @@ Map2 :: map(), K :: term(). -with(Ks,M) when is_list(Ks), is_map(M) -> - maps:from_list([{K,V}||{K,V} <- maps:to_list(M), lists:member(K, Ks)]); -with(Ks,M) -> - erlang:error(error_type(M),[Ks,M]). - - -error_type(M) when is_map(M) -> badarg; -error_type(V) -> {badmap, V}. +with(Ks, M) when is_list(Ks), is_map(M) -> + maps:from_list([{K,V}||{K,V} <- maps:to_list(M), lists:member(K, Ks)]). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/math.erl erlang-17.3-dfsg/lib/stdlib/src/math.erl --- erlang-18.2-dfsg/lib/stdlib/src/math.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/math.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,7 +24,7 @@ -export([sin/1, cos/1, tan/1, asin/1, acos/1, atan/1, atan2/2, sinh/1, cosh/1, tanh/1, asinh/1, acosh/1, atanh/1, exp/1, log/1, - log2/1, log10/1, pow/2, sqrt/1, erf/1, erfc/1]). + log10/1, pow/2, sqrt/1, erf/1, erfc/1]). -spec acos(X) -> float() when X :: number(). @@ -93,11 +92,6 @@ log(_) -> erlang:nif_error(undef). --spec log2(X) -> float() when - X :: number(). -log2(_) -> - erlang:nif_error(undef). - -spec log10(X) -> float() when X :: number(). log10(_) -> diff -Nru erlang-18.2-dfsg/lib/stdlib/src/ms_transform.erl erlang-17.3-dfsg/lib/stdlib/src/ms_transform.erl --- erlang-18.2-dfsg/lib/stdlib/src/ms_transform.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/ms_transform.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2015. All Rights Reserved. +%% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -726,10 +725,10 @@ th(NewV,NewBind,OuterBound). -toplevel_head_match({match,_,{var,Line,VName},Expr},B,OB) -> +toplevel_head_match({match,Line,{var,_,VName},Expr},B,OB) -> warn_var_clash(Line,VName,OB), {Expr,new_bind({VName,'$_'},B)}; -toplevel_head_match({match,_,Expr,{var,Line,VName}},B,OB) -> +toplevel_head_match({match,Line,Expr,{var,_,VName}},B,OB) -> warn_var_clash(Line,VName,OB), {Expr,new_bind({VName,'$_'},B)}; toplevel_head_match(Other,B,_OB) -> @@ -823,10 +822,9 @@ th(Nonstruct,B,_OB) -> {Nonstruct,B}. -warn_var_clash(Anno,Name,OuterBound) -> +warn_var_clash(Line,Name,OuterBound) -> case gb_sets:is_member(Name,OuterBound) of true -> - Line = erl_anno:line(Anno), add_warning(Line,{?WARN_SHADOW_VAR,Name}); _ -> ok @@ -1081,12 +1079,6 @@ [normalise(Head)|normalise(Tail)]; normalise({tuple,_,Args}) -> list_to_tuple(normalise_list(Args)); -normalise({map,_,Pairs0}) -> - Pairs1 = lists:map(fun ({map_field_exact,_,K,V}) -> - {normalise(K),normalise(V)} - end, - Pairs0), - maps:from_list(Pairs1); %% Special case for unary +/-. normalise({op,_,'+',{char,_,I}}) -> I; normalise({op,_,'+',{integer,_,I}}) -> I; diff -Nru erlang-18.2-dfsg/lib/stdlib/src/orddict.erl erlang-17.3-dfsg/lib/stdlib/src/orddict.erl --- erlang-18.2-dfsg/lib/stdlib/src/orddict.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/orddict.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -26,13 +25,11 @@ -export([store/3,append/3,append_list/3,update/3,update/4,update_counter/3]). -export([fold/3,map/2,filter/2,merge/3]). --export_type([orddict/0, orddict/2]). +-export_type([orddict/0]). %%--------------------------------------------------------------------------- --type orddict() :: orddict(_, _). - --type orddict(Key, Value) :: [{Key, Value}]. +-type orddict() :: [{Key :: term(), Value :: term()}]. %%--------------------------------------------------------------------------- @@ -41,7 +38,8 @@ new() -> []. -spec is_key(Key, Orddict) -> boolean() when - Orddict :: orddict(Key, Value :: term()). + Key :: term(), + Orddict :: orddict(). is_key(Key, [{K,_}|_]) when Key < K -> false; is_key(Key, [{K,_}|Dict]) when Key > K -> is_key(Key, Dict); @@ -49,14 +47,14 @@ is_key(_, []) -> false. -spec to_list(Orddict) -> List when - Orddict :: orddict(Key, Value), - List :: [{Key, Value}]. + Orddict :: orddict(), + List :: [{Key :: term(), Value :: term()}]. to_list(Dict) -> Dict. -spec from_list(List) -> Orddict when - List :: [{Key, Value}], - Orddict :: orddict(Key, Value). + List :: [{Key :: term(), Value :: term()}], + Orddict :: orddict(). from_list([]) -> []; from_list([{_,_}]=Pair) -> Pair; @@ -75,13 +73,17 @@ is_empty([_|_]) -> false. -spec fetch(Key, Orddict) -> Value when - Orddict :: orddict(Key, Value). + Key :: term(), + Value :: term(), + Orddict :: orddict(). fetch(Key, [{K,_}|D]) when Key > K -> fetch(Key, D); fetch(Key, [{K,Value}|_]) when Key == K -> Value. -spec find(Key, Orddict) -> {'ok', Value} | 'error' when - Orddict :: orddict(Key, Value). + Key :: term(), + Orddict :: orddict(), + Value :: term(). find(Key, [{K,_}|_]) when Key < K -> error; find(Key, [{K,_}|D]) when Key > K -> find(Key, D); @@ -89,16 +91,17 @@ find(_, []) -> error. -spec fetch_keys(Orddict) -> Keys when - Orddict :: orddict(Key, Value :: term()), - Keys :: [Key]. + Orddict :: orddict(), + Keys :: [term()]. fetch_keys([{Key,_}|Dict]) -> [Key|fetch_keys(Dict)]; fetch_keys([]) -> []. -spec erase(Key, Orddict1) -> Orddict2 when - Orddict1 :: orddict(Key, Value), - Orddict2 :: orddict(Key, Value). + Key :: term(), + Orddict1 :: orddict(), + Orddict2 :: orddict(). erase(Key, [{K,_}=E|Dict]) when Key < K -> [E|Dict]; erase(Key, [{K,_}=E|Dict]) when Key > K -> @@ -107,11 +110,13 @@ erase(_, []) -> []. -spec store(Key, Value, Orddict1) -> Orddict2 when - Orddict1 :: orddict(Key, Value), - Orddict2 :: orddict(Key, Value). + Key :: term(), + Value :: term(), + Orddict1 :: orddict(), + Orddict2 :: orddict(). -store(Key, New, [{K,_}|_]=Dict) when Key < K -> - [{Key,New}|Dict]; +store(Key, New, [{K,_}=E|Dict]) when Key < K -> + [{Key,New},E|Dict]; store(Key, New, [{K,_}=E|Dict]) when Key > K -> [E|store(Key, New, Dict)]; store(Key, New, [{_K,_Old}|Dict]) -> %Key == K @@ -119,11 +124,13 @@ store(Key, New, []) -> [{Key,New}]. -spec append(Key, Value, Orddict1) -> Orddict2 when - Orddict1 :: orddict(Key, Value), - Orddict2 :: orddict(Key, Value). + Key :: term(), + Value :: term(), + Orddict1 :: orddict(), + Orddict2 :: orddict(). -append(Key, New, [{K,_}|_]=Dict) when Key < K -> - [{Key,[New]}|Dict]; +append(Key, New, [{K,_}=E|Dict]) when Key < K -> + [{Key,[New]},E|Dict]; append(Key, New, [{K,_}=E|Dict]) when Key > K -> [E|append(Key, New, Dict)]; append(Key, New, [{_K,Old}|Dict]) -> %Key == K @@ -131,12 +138,13 @@ append(Key, New, []) -> [{Key,[New]}]. -spec append_list(Key, ValList, Orddict1) -> Orddict2 when - ValList :: [Value], - Orddict1 :: orddict(Key, Value), - Orddict2 :: orddict(Key, Value). + Key :: term(), + ValList :: [Value :: term()], + Orddict1 :: orddict(), + Orddict2 :: orddict(). -append_list(Key, NewList, [{K,_}|_]=Dict) when Key < K -> - [{Key,NewList}|Dict]; +append_list(Key, NewList, [{K,_}=E|Dict]) when Key < K -> + [{Key,NewList},E|Dict]; append_list(Key, NewList, [{K,_}=E|Dict]) when Key > K -> [E|append_list(Key, NewList, Dict)]; append_list(Key, NewList, [{_K,Old}|Dict]) -> %Key == K @@ -145,9 +153,10 @@ [{Key,NewList}]. -spec update(Key, Fun, Orddict1) -> Orddict2 when - Fun :: fun((Value1 :: Value) -> Value2 :: Value), - Orddict1 :: orddict(Key, Value), - Orddict2 :: orddict(Key, Value). + Key :: term(), + Fun :: fun((Value1 :: term()) -> Value2 :: term()), + Orddict1 :: orddict(), + Orddict2 :: orddict(). update(Key, Fun, [{K,_}=E|Dict]) when Key > K -> [E|update(Key, Fun, Dict)]; @@ -155,13 +164,14 @@ [{Key,Fun(Val)}|Dict]. -spec update(Key, Fun, Initial, Orddict1) -> Orddict2 when - Initial :: Value, - Fun :: fun((Value1 :: Value) -> Value2 :: Value), - Orddict1 :: orddict(Key, Value), - Orddict2 :: orddict(Key, Value). + Key :: term(), + Initial :: term(), + Fun :: fun((Value1 :: term()) -> Value2 :: term()), + Orddict1 :: orddict(), + Orddict2 :: orddict(). -update(Key, _, Init, [{K,_}|_]=Dict) when Key < K -> - [{Key,Init}|Dict]; +update(Key, _, Init, [{K,_}=E|Dict]) when Key < K -> + [{Key,Init},E|Dict]; update(Key, Fun, Init, [{K,_}=E|Dict]) when Key > K -> [E|update(Key, Fun, Init, Dict)]; update(Key, Fun, _Init, [{_K,Val}|Dict]) -> %Key == K @@ -169,12 +179,13 @@ update(Key, _, Init, []) -> [{Key,Init}]. -spec update_counter(Key, Increment, Orddict1) -> Orddict2 when - Orddict1 :: orddict(Key, Value), - Orddict2 :: orddict(Key, Value), - Increment :: number(). + Key :: term(), + Increment :: number(), + Orddict1 :: orddict(), + Orddict2 :: orddict(). -update_counter(Key, Incr, [{K,_}|_]=Dict) when Key < K -> - [{Key,Incr}|Dict]; +update_counter(Key, Incr, [{K,_}=E|Dict]) when Key < K -> + [{Key,Incr},E|Dict]; update_counter(Key, Incr, [{K,_}=E|Dict]) when Key > K -> [E|update_counter(Key, Incr, Dict)]; update_counter(Key, Incr, [{_K,Val}|Dict]) -> %Key == K @@ -182,30 +193,28 @@ update_counter(Key, Incr, []) -> [{Key,Incr}]. -spec fold(Fun, Acc0, Orddict) -> Acc1 when - Fun :: fun((Key, Value, AccIn) -> AccOut), - Orddict :: orddict(Key, Value), - Acc0 :: Acc, - Acc1 :: Acc, - AccIn :: Acc, - AccOut :: Acc. + Fun :: fun((Key :: term(), Value :: term(), AccIn :: term()) -> AccOut :: term()), + Acc0 :: term(), + Acc1 :: term(), + Orddict :: orddict(). fold(F, Acc, [{Key,Val}|D]) -> fold(F, F(Key, Val, Acc), D); fold(F, Acc, []) when is_function(F, 3) -> Acc. -spec map(Fun, Orddict1) -> Orddict2 when - Fun :: fun((Key, Value1) -> Value2), - Orddict1 :: orddict(Key, Value1), - Orddict2 :: orddict(Key, Value2). + Fun :: fun((Key :: term(), Value1 :: term()) -> Value2 :: term()), + Orddict1 :: orddict(), + Orddict2 :: orddict(). map(F, [{Key,Val}|D]) -> [{Key,F(Key, Val)}|map(F, D)]; map(F, []) when is_function(F, 2) -> []. -spec filter(Pred, Orddict1) -> Orddict2 when - Pred :: fun((Key, Value) -> boolean()), - Orddict1 :: orddict(Key, Value), - Orddict2 :: orddict(Key, Value). + Pred :: fun((Key :: term(), Value :: term()) -> boolean()), + Orddict1 :: orddict(), + Orddict2 :: orddict(). filter(F, [{Key,Val}=E|D]) -> case F(Key, Val) of @@ -215,10 +224,10 @@ filter(F, []) when is_function(F, 2) -> []. -spec merge(Fun, Orddict1, Orddict2) -> Orddict3 when - Fun :: fun((Key, Value1, Value2) -> Value), - Orddict1 :: orddict(Key, Value1), - Orddict2 :: orddict(Key, Value2), - Orddict3 :: orddict(Key, Value). + Fun :: fun((Key :: term(), Value1 :: term(), Value2 :: term()) -> Value :: term()), + Orddict1 :: orddict(), + Orddict2 :: orddict(), + Orddict3 :: orddict(). merge(F, [{K1,_}=E1|D1], [{K2,_}=E2|D2]) when K1 < K2 -> [E1|merge(F, D1, [E2|D2])]; diff -Nru erlang-18.2-dfsg/lib/stdlib/src/ordsets.erl erlang-17.3-dfsg/lib/stdlib/src/ordsets.erl --- erlang-18.2-dfsg/lib/stdlib/src/ordsets.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/ordsets.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,19 +3,19 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% +%% -module(ordsets). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/otp_internal.erl erlang-17.3-dfsg/lib/stdlib/src/otp_internal.erl --- erlang-18.2-dfsg/lib/stdlib/src/otp_internal.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/otp_internal.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,25 +1,24 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% -module(otp_internal). --export([obsolete/3, obsolete_type/3]). +-export([obsolete/3]). %%---------------------------------------------------------------------- @@ -27,7 +26,7 @@ -type mfas() :: mfa() | {atom(), atom(), [byte()]}. -type release() :: string(). --spec obsolete(module(), atom(), arity()) -> +-spec obsolete(atom(), atom(), byte()) -> 'no' | {tag(), string()} | {tag(), mfas(), release()}. obsolete(Module, Name, Arity) -> @@ -60,11 +59,6 @@ obsolete_1(erlang, hash, 2) -> {deprecated, {erlang, phash2, 2}}; -obsolete_1(erlang, now, 0) -> - {deprecated, - "Deprecated BIF. See the \"Time and Time Correction in Erlang\" " - "chapter of the ERTS User's Guide for more information."}; - obsolete_1(calendar, local_time_to_universal_time, 1) -> {deprecated, {calendar, local_time_to_universal_time_dst, 1}}; @@ -427,13 +421,13 @@ obsolete_1(ssh_cm, session_open, A) when A =:= 2; A =:= 4 -> {removed,{ssh_connection,session_channel,A},"R14B"}; obsolete_1(ssh_cm, direct_tcpip, A) when A =:= 6; A =:= 8 -> - {removed,{ssh_connection,direct_tcpip,A},"R14B"}; + {removed,{ssh_connection,direct_tcpip,A}}; obsolete_1(ssh_cm, tcpip_forward, 3) -> {removed,{ssh_connection,tcpip_forward,3},"R14B"}; obsolete_1(ssh_cm, cancel_tcpip_forward, 3) -> {removed,{ssh_connection,cancel_tcpip_forward,3},"R14B"}; obsolete_1(ssh_cm, open_pty, A) when A =:= 3; A =:= 7; A =:= 9 -> - {removed,{ssh_connection,open_pty,A},"R14B"}; + {removed,{ssh_connection,open_pty,A},"R14"}; obsolete_1(ssh_cm, setenv, 5) -> {removed,{ssh_connection,setenv,5},"R14B"}; obsolete_1(ssh_cm, shell, 2) -> @@ -447,11 +441,11 @@ obsolete_1(ssh_cm, signal, 3) -> {removed,{ssh_connection,signal,3},"R14B"}; obsolete_1(ssh_cm, attach, A) when A =:= 2; A =:= 3 -> - {removed,"no longer useful; removed in R14B"}; + {removed,{ssh,attach,A}}; obsolete_1(ssh_cm, detach, 2) -> - {removed,"no longer useful; removed in R14B"}; + {removed,"no longer useful; will be removed in R14B"}; obsolete_1(ssh_cm, set_user_ack, 4) -> - {removed,"no longer useful; removed in R14B"}; + {removed,"no longer useful; will be removed in R14B"}; obsolete_1(ssh_cm, adjust_window, 3) -> {removed,{ssh_connection,adjust_window,3},"R14B"}; obsolete_1(ssh_cm, close, 2) -> @@ -467,9 +461,9 @@ obsolete_1(ssh_ssh, connect, A) when 1 =< A, A =< 3 -> {removed,{ssh,shell,A},"R14B"}; obsolete_1(ssh_sshd, listen, A) when 0 =< A, A =< 3 -> - {removed,{ssh,daemon,[1,2,3]},"R14B"}; + {removed,{ssh,daemon,[1,2,3]},"R14"}; obsolete_1(ssh_sshd, stop, 1) -> - {removed,{ssh,stop_listener,1},"R14B"}; + {removed,{ssh,stop_listener,1}}; %% Added in R13A. obsolete_1(regexp, _, _) -> @@ -583,70 +577,8 @@ {deprecated,{unicode,characters_to_list,1}}; obsolete_1(asn1rt, utf8_list_to_binary, 1) -> {deprecated,{unicode,characters_to_binary,1}}; - -%% Added in OTP 18. -obsolete_1(core_lib, get_anno, 1) -> - {deprecated,{cerl,get_ann,1}}; -obsolete_1(core_lib, set_anno, 2) -> - {deprecated,{cerl,set_ann,2}}; -obsolete_1(core_lib, is_literal, 1) -> - {deprecated,{cerl,is_literal,1}}; -obsolete_1(core_lib, is_literal_list, 1) -> - {deprecated,"deprecated; use lists:all(fun cerl:is_literal/1, L)" - " instead"}; -obsolete_1(core_lib, literal_value, 1) -> - {deprecated,{core_lib,concrete,1}}; -obsolete_1(erl_scan, set_attribute, 3) -> - {deprecated, - "deprecated (will be removed in OTP 19); use erl_anno:set_line/2 instead"}; -obsolete_1(erl_scan, attributes_info, 1) -> - {deprecated, - "deprecated (will be removed in OTP 19); use " - "erl_anno:{column,line,location,text}/1 instead"}; -obsolete_1(erl_scan, attributes_info, 2) -> - {deprecated, - "deprecated (will be removed in OTP 19); use " - "erl_anno:{column,line,location,text}/1 instead"}; -obsolete_1(erl_scan, token_info, 1) -> - {deprecated, - "deprecated (will be removed in OTP 19); use " - "erl_scan:{category,column,line,location,symbol,text}/1 instead"}; -obsolete_1(erl_scan, token_info, 2) -> - {deprecated, - "deprecated (will be removed in OTP 19); use " - "erl_scan:{category,column,line,location,symbol,text}/1 instead"}; -obsolete_1(erl_parse, set_line, 2) -> - {deprecated, - "deprecated (will be removed in OTP 19); use erl_anno:set_line/2 instead"}; -obsolete_1(erl_parse, get_attributes, 1) -> - {deprecated, - "deprecated (will be removed in OTP 19); use " - "erl_anno:{column,line,location,text}/1 instead"}; -obsolete_1(erl_parse, get_attribute, 2) -> - {deprecated, - "deprecated (will be removed in OTP 19); use " - "erl_anno:{column,line,location,text}/1 instead"}; -obsolete_1(erl_lint, modify_line, 2) -> - {deprecated, - "deprecated (will be removed in OTP 19); use erl_parse:map_anno/2 instead"}; -obsolete_1(ssl, negotiated_next_protocol, 1) -> - {deprecated,{ssl,negotiated_protocol,1}}; - -obsolete_1(ssl, connection_info, 1) -> - {deprecated, "deprecated; use connection_information/[1,2] instead"}; - -obsolete_1(httpd_conf, check_enum, 2) -> - {deprecated, "deprecated; use lists:member/2 instead"}; -obsolete_1(httpd_conf, clean, 1) -> - {deprecated, "deprecated; use sting:strip/1 instead or possible the re module"}; -obsolete_1(httpd_conf, custom_clean, 3) -> - {deprecated, "deprecated; use sting:strip/3 instead or possible the re module"}; -obsolete_1(httpd_conf, is_directory, 1) -> - {deprecated, "deprecated; use filelib:is_dir/1 instead"}; -obsolete_1(httpd_conf, is_file, 1) -> - {deprecated, "deprecated; use filelib:is_file/1 instead"}; -obsolete_1(httpd_conf, make_integer, 1) -> - {deprecated, "deprecated; use erlang:list_to_integer/1 instead"}; +obsolete_1(pg, _, _) -> + {deprecated,"deprecated; will be removed in OTP 18"}; obsolete_1(_, _, _) -> no. @@ -694,30 +626,3 @@ is_snmp_agent_function(del_agent_caps, 1) -> true; is_snmp_agent_function(get_agent_caps, 0) -> true; is_snmp_agent_function(_, _) -> false. - --spec obsolete_type(module(), atom(), arity()) -> - 'no' | {tag(), string()} | {tag(), mfas(), release()}. - -obsolete_type(Module, Name, NumberOfVariables) -> - case obsolete_type_1(Module, Name, NumberOfVariables) of -%% {deprecated=Tag,{_,_,_}=Replacement} -> -%% {Tag,Replacement,"in a future release"}; - {_,String}=Ret when is_list(String) -> - Ret; -%% {_,_,_}=Ret -> -%% Ret; - no -> - no - end. - -obsolete_type_1(erl_scan,column,0) -> - {deprecated, - "deprecated (will be removed in OTP 19); use erl_anno:column() instead"}; -obsolete_type_1(erl_scan,line,0) -> - {deprecated, - "deprecated (will be removed in OTP 19); use erl_anno:line() instead"}; -obsolete_type_1(erl_scan,location,0) -> - {deprecated, - "deprecated (will be removed in OTP 19); use erl_anno:location() instead"}; -obsolete_type_1(_,_,_) -> - no. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/pg.erl erlang-17.3-dfsg/lib/stdlib/src/pg.erl --- erlang-18.2-dfsg/lib/stdlib/src/pg.erl 1970-01-01 00:00:00.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/pg.erl 2014-09-16 19:10:57.000000000 +0000 @@ -0,0 +1,187 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1996-2014. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(pg). +-deprecated(module). + +%% pg provides a process group facility. Messages +%% can be multicasted to all members in the group + +-export([create/1, + create/2, + standby/2, + join/2, + send/2, + esend/2, + members/1, + name_to_pid/1, + master/1]). + + +%% Create a brand new empty process group with the master residing +%% at the local node + +-spec create(PgName) -> 'ok' | {'error', Reason} when + PgName :: term(), + Reason :: 'already_created' | term(). + +create(PgName) -> + catch begin check(PgName), + Pid = spawn(pg,master,[PgName]), + global:register_name(PgName,Pid), + ok end. + +%% Create a brand new empty process group with the master +%% residing at Node + +-spec create(PgName, Node) -> 'ok' | {'error', Reason} when + PgName :: term(), + Node :: node(), + Reason :: 'already_created' | term(). + +create(PgName, Node) -> + catch begin check(PgName), + Pid = spawn(Node,pg,master,[PgName]), + global:register_name(PgName,Pid), + ok end. + +%% Have a process on Node that will act as a standby for the process +%% group manager. So if the node where the manager runs fails, the +%% process group will continue to function. + +-spec standby(term(), node()) -> 'ok'. + +standby(_PgName, _Node) -> + ok. + +%% Tell process group PgName that Pid is a new member of the group +%% synchronously return a list of all old members in the group + +-spec join(PgName, Pid) -> Members when + PgName :: term(), + Pid :: pid(), + Members :: [pid()]. + +join(PgName, Pid) when is_atom(PgName) -> + global:send(PgName, {join,self(),Pid}), + receive + {_P,{members,Members}} -> + Members + end. + +%% Multi cast Mess to all members in the group + +-spec send(PgName, Msg) -> 'ok' when + PgName :: term(), + Msg :: term(). + +send(PgName, Mess) when is_atom(PgName) -> + global:send(PgName, {send, self(), Mess}), + ok; +send(Pg, Mess) when is_pid(Pg) -> + Pg ! {send,self(),Mess}, + ok. + +%% multi cast a message to all members in the group but ourselves +%% If we are a member + +-spec esend(PgName, Msg) -> 'ok' when + PgName :: term(), + Msg :: term(). + +esend(PgName, Mess) when is_atom(PgName) -> + global:send(PgName, {esend,self(),Mess}), + ok; +esend(Pg, Mess) when is_pid(Pg) -> + Pg ! {esend,self(),Mess}, + ok. + +%% Return the members of the group + +-spec members(PgName) -> Members when + PgName :: term(), + Members :: [pid()]. + +members(PgName) when is_atom(PgName) -> + global:send(PgName, {self() ,members}), + receive + {_P,{members,Members}} -> + Members + end; +members(Pg) when is_pid(Pg) -> + Pg ! {self,members}, + receive + {_P,{members,Members}} -> + Members + end. + +-spec name_to_pid(atom()) -> pid() | 'undefined'. + +name_to_pid(PgName) when is_atom(PgName) -> + global:whereis_name(PgName). + +-spec master(term()) -> no_return(). + +master(PgName) -> + process_flag(trap_exit, true), + master_loop(PgName, []). + +master_loop(PgName,Members) -> + receive + {send,From,Message} -> + send_all(Members,{pg_message,From,PgName,Message}), + master_loop(PgName,Members); + {esend,From,Message} -> + send_all(lists:delete(From,Members), + {pg_message,From,PgName,Message}), + master_loop(PgName,Members); + {join,From,Pid} -> + link(Pid), + send_all(Members,{new_member,PgName,Pid}), + From ! {self(),{members,Members}}, + master_loop(PgName,[Pid|Members]); + {From,members} -> + From ! {self(),{members,Members}}, + master_loop(PgName,Members); + {'EXIT',From,_} -> + L = + case lists:member(From,Members) of + true -> + NewMembers = lists:delete(From,Members), + send_all(NewMembers, {crashed_member,PgName,From}), + NewMembers; + false -> + Members + end, + master_loop(PgName,L) + end. + +send_all([], _) -> ok; +send_all([P|Ps], M) -> + P ! M, + send_all(Ps, M). + +%% Check if the process group already exists + +check(PgName) -> + case global:whereis_name(PgName) of + Pid when is_pid(Pid) -> + throw({error,already_created}); + undefined -> + ok + end. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/pool.erl erlang-17.3-dfsg/lib/stdlib/src/pool.erl --- erlang-18.2-dfsg/lib/stdlib/src/pool.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/pool.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/proc_lib.erl erlang-17.3-dfsg/lib/stdlib/src/proc_lib.erl --- erlang-18.2-dfsg/lib/stdlib/src/proc_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/proc_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2014. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,10 +29,8 @@ start/3, start/4, start/5, start_link/3, start_link/4, start_link/5, hibernate/3, init_ack/1, init_ack/2, - init_p/3,init_p/5,format/1,format/2,format/3, - initial_call/1, - translate_initial_call/1, - stop/1, stop/3]). + init_p/3,init_p/5,format/1,format/2,initial_call/1, + translate_initial_call/1]). %% Internal exports. -export([wake_up/3]). @@ -701,118 +698,53 @@ CrashReport :: [term()], Encoding :: latin1 | unicode | utf8. -format(CrashReport, Encoding) -> - format(CrashReport, Encoding, unlimited). - --spec format(CrashReport, Encoding, Depth) -> string() when - CrashReport :: [term()], - Encoding :: latin1 | unicode | utf8, - Depth :: unlimited | pos_integer(). - -format([OwnReport,LinkReport], Encoding, Depth) -> - Extra = {Encoding,Depth}, - OwnFormat = format_report(OwnReport, Extra), - LinkFormat = format_report(LinkReport, Extra), +format([OwnReport,LinkReport], Encoding) -> + OwnFormat = format_report(OwnReport, Encoding), + LinkFormat = format_report(LinkReport, Encoding), Str = io_lib:format(" crasher:~n~ts neighbours:~n~ts", [OwnFormat, LinkFormat]), lists:flatten(Str). -format_report(Rep, Extra) when is_list(Rep) -> - format_rep(Rep, Extra); -format_report(Rep, {Enc,_}) -> +format_report(Rep, Enc) when is_list(Rep) -> + format_rep(Rep,Enc); +format_report(Rep, Enc) -> io_lib:format("~"++modifier(Enc)++"p~n", [Rep]). -format_rep([{initial_call,InitialCall}|Rep], {_Enc,Depth}=Extra) -> - [format_mfa(InitialCall, Depth)|format_rep(Rep, Extra)]; -format_rep([{error_info,{Class,Reason,StackTrace}}|Rep], Extra) -> - [format_exception(Class, Reason, StackTrace, Extra)|format_rep(Rep, Extra)]; -format_rep([{Tag,Data}|Rep], Extra) -> - [format_tag(Tag, Data, Extra)|format_rep(Rep, Extra)]; -format_rep(_, _Extra) -> +format_rep([{initial_call,InitialCall}|Rep], Enc) -> + [format_mfa(InitialCall)|format_rep(Rep, Enc)]; +format_rep([{error_info,{Class,Reason,StackTrace}}|Rep], Enc) -> + [format_exception(Class, Reason, StackTrace, Enc)|format_rep(Rep, Enc)]; +format_rep([{Tag,Data}|Rep], Enc) -> + [format_tag(Tag, Data)|format_rep(Rep, Enc)]; +format_rep(_, _Enc) -> []. -format_exception(Class, Reason, StackTrace, {Enc,_}=Extra) -> - PF = pp_fun(Extra), +format_exception(Class, Reason, StackTrace, Enc) -> + PF = pp_fun(Enc), StackFun = fun(M, _F, _A) -> (M =:= erl_eval) or (M =:= ?MODULE) end, %% EI = " exception: ", EI = " ", [EI, lib:format_exception(1+length(EI), Class, Reason, StackTrace, StackFun, PF, Enc), "\n"]. -format_mfa({M,F,Args}=StartF, Depth) -> +format_mfa({M,F,Args}=StartF) -> try A = length(Args), [" initial call: ",atom_to_list(M),$:,atom_to_list(F),$/, integer_to_list(A),"\n"] catch error:_ -> - format_tag(initial_call, StartF, Depth) + format_tag(initial_call, StartF) end. -pp_fun({Enc,Depth}) -> - {Letter,Tl} = case Depth of - unlimited -> {"p",[]}; - _ -> {"P",[Depth]} - end, - P = modifier(Enc) ++ Letter, +pp_fun(Enc) -> + P = modifier(Enc) ++ "p", fun(Term, I) -> - io_lib:format("~." ++ integer_to_list(I) ++ P, [Term|Tl]) + io_lib:format("~." ++ integer_to_list(I) ++ P, [Term]) end. -format_tag(Tag, Data, {_Enc,Depth}) -> - case Depth of - unlimited -> - io_lib:format(" ~p: ~80.18p~n", [Tag, Data]); - _ -> - io_lib:format(" ~p: ~80.18P~n", [Tag, Data, Depth]) - end. +format_tag(Tag, Data) -> + io_lib:format(" ~p: ~80.18p~n", [Tag, Data]). modifier(latin1) -> ""; modifier(_) -> "t". - - -%%% ----------------------------------------------------------- -%%% Stop a process and wait for it to terminate -%%% ----------------------------------------------------------- --spec stop(Process) -> 'ok' when - Process :: pid() | RegName | {RegName,node()}, - RegName :: atom(). -stop(Process) -> - stop(Process, normal, infinity). - --spec stop(Process, Reason, Timeout) -> 'ok' when - Process :: pid() | RegName | {RegName,node()}, - RegName :: atom(), - Reason :: term(), - Timeout :: timeout(). -stop(Process, Reason, Timeout) -> - {Pid, Mref} = erlang:spawn_monitor(do_stop(Process, Reason)), - receive - {'DOWN', Mref, _, _, Reason} -> - ok; - {'DOWN', Mref, _, _, {noproc,{sys,terminate,_}}} -> - exit(noproc); - {'DOWN', Mref, _, _, CrashReason} -> - exit(CrashReason) - after Timeout -> - exit(Pid, kill), - receive - {'DOWN', Mref, _, _, _} -> - exit(timeout) - end - end. - --spec do_stop(Process, Reason) -> Fun when - Process :: pid() | RegName | {RegName,node()}, - RegName :: atom(), - Reason :: term(), - Fun :: fun(() -> no_return()). -do_stop(Process, Reason) -> - fun() -> - Mref = erlang:monitor(process, Process), - ok = sys:terminate(Process, Reason, infinity), - receive - {'DOWN', Mref, _, _, ExitReason} -> - exit(ExitReason) - end - end. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/proplists.erl erlang-17.3-dfsg/lib/stdlib/src/proplists.erl --- erlang-18.2-dfsg/lib/stdlib/src/proplists.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/proplists.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/qlc.erl erlang-17.3-dfsg/lib/stdlib/src/qlc.erl --- erlang-18.2-dfsg/lib/stdlib/src/qlc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/qlc.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -1007,7 +1006,7 @@ -record(simple_qlc, {p, % atom(), pattern variable le, - line :: erl_anno:anno(), + line, init_value, optz % #optz }). @@ -1149,18 +1148,15 @@ [{match,_,Expr,Q}] -> Q; [{match,_,Expr,Q} | Body] -> - {block, anno0(), lists:reverse(Body, [Q])}; + {block, 0, lists:reverse(Body, [Q])}; _ -> - {block, anno0(), lists:reverse(Body0, [Expr])} + {block, 0, lists:reverse(Body0, [Expr])} end. -abstract(Info, NElements, Depth) -> - abstract1(Info, NElements, Depth, anno1()). - -abstract1({qlc, E0, Qs0, Opt}, NElements, Depth, A) -> +abstract({qlc, E0, Qs0, Opt}, NElements, Depth) -> Qs = lists:map(fun({generate, P, LE}) -> - {generate, A, binary_to_term(P), - abstract1(LE, NElements, Depth, A)}; + {generate, 1, binary_to_term(P), + abstract(LE, NElements, Depth)}; (F) -> binary_to_term(F) end, Qs0), @@ -1169,12 +1165,12 @@ [] -> []; _ -> [abstract_term(Opt, 1)] end, - ?QLC_Q(A, A, A, A, {lc,A,E,Qs}, Os); -abstract1({table, {M, F, As0}}, _NElements, _Depth, Anno) + ?QLC_Q(1, 1, 1, 1, {lc,1,E,Qs}, Os); +abstract({table, {M, F, As0}}, _NElements, _Depth) when is_atom(M), is_atom(F), is_list(As0) -> As = [abstract_term(A, 1) || A <- As0], - {call, Anno, {remote, Anno, {atom, Anno, M}, {atom, Anno, F}}, As}; -abstract1({table, TableDesc}, _NElements, _Depth, _A) -> + {call, 1, {remote, 1, {atom, 1, M}, {atom, 1, F}}, As}; +abstract({table, TableDesc}, _NElements, _Depth) -> case io_lib:deep_char_list(TableDesc) of true -> {ok, Tokens, _} = erl_scan:string(lists:flatten(TableDesc++".")), @@ -1183,28 +1179,27 @@ false -> % abstract expression TableDesc end; -abstract1({append, Infos}, NElements, Depth, A) -> +abstract({append, Infos}, NElements, Depth) -> As = lists:foldr(fun(Info, As0) -> - {cons,A,abstract1(Info, NElements, Depth, A), - As0} - end, {nil, A}, Infos), - {call, A, {remote, A, {atom, A, ?MODULE}, {atom, A, append}}, [As]}; -abstract1({sort, Info, SortOptions}, NElements, Depth, A) -> - {call, A, {remote, A, {atom, A, ?MODULE}, {atom, A, sort}}, - [abstract1(Info, NElements, Depth, A), abstract_term(SortOptions, 1)]}; -abstract1({keysort, Info, Kp, SortOptions}, NElements, Depth, A) -> - {call, A, {remote, A, {atom, A, ?MODULE}, {atom, A, keysort}}, - [abstract_term(Kp, 1), abstract1(Info, NElements, Depth, A), + {cons,1,abstract(Info, NElements, Depth),As0} + end, {nil, 1}, Infos), + {call, 1, {remote, 1, {atom, 1, ?MODULE}, {atom, 1, append}}, [As]}; +abstract({sort, Info, SortOptions}, NElements, Depth) -> + {call, 1, {remote, 1, {atom, 1, ?MODULE}, {atom, 1, sort}}, + [abstract(Info, NElements, Depth), abstract_term(SortOptions, 1)]}; +abstract({keysort, Info, Kp, SortOptions}, NElements, Depth) -> + {call, 1, {remote, 1, {atom, 1, ?MODULE}, {atom, 1, keysort}}, + [abstract_term(Kp, 1), abstract(Info, NElements, Depth), abstract_term(SortOptions, 1)]}; -abstract1({list,L,MS}, NElements, Depth, A) -> - {call, A, {remote, A, {atom, A, ets}, {atom, A, match_spec_run}}, - [abstract1(L, NElements, Depth, A), - {call, A, {remote, A, {atom, A, ets}, {atom, A, match_spec_compile}}, +abstract({list,L,MS}, NElements, Depth) -> + {call, 1, {remote, 1, {atom, 1, ets}, {atom, 1, match_spec_run}}, + [abstract(L, NElements, Depth), + {call, 1, {remote, 1, {atom, 1, ets}, {atom, 1, match_spec_compile}}, [abstract_term(depth(MS, Depth), 1)]}]}; -abstract1({list, L}, NElements, Depth, _A) when NElements =:= infinity; - NElements >= length(L) -> +abstract({list, L}, NElements, Depth) when NElements =:= infinity; + NElements >= length(L) -> abstract_term(depth(L, Depth), 1); -abstract1({list, L}, NElements, Depth, _A) -> +abstract({list, L}, NElements, Depth) -> abstract_term(depth(lists:sublist(L, NElements), Depth) ++ '...', 1). depth(List, infinity) -> @@ -1256,14 +1251,14 @@ abstract_term(Term, 0). abstract_term(Term, Line) -> - abstr_term(Term, anno(Line)). + abstr_term(Term, Line). abstr_term(Tuple, Line) when is_tuple(Tuple) -> {tuple,Line,[abstr_term(E, Line) || E <- tuple_to_list(Tuple)]}; abstr_term([_ | _]=L, Line) -> case io_lib:char_list(L) of true -> - erl_parse:abstract(L, erl_anno:line(Line)); + erl_parse:abstract(L, Line); false -> abstr_list(L, Line) end; @@ -1290,7 +1285,7 @@ abstr_term(PPR, Line) when is_pid(PPR); is_port(PPR); is_reference(PPR) -> {special, Line, lists:flatten(io_lib:write(PPR))}; abstr_term(Simple, Line) -> - erl_parse:abstract(Simple, erl_anno:line(Line)). + erl_parse:abstract(Simple, Line). abstr_list([H | T], Line) -> {cons, Line, abstr_term(H, Line), abstr_list(T, Line)}; @@ -1524,7 +1519,7 @@ %% Only compared constants (==). [Cs1_0, Cs2_0] end, - L = anno0(), + L = 0, G1_0 = {var,L,'G1'}, G2_0 = {var,L,'G2'}, JP = element(JQNum + 1, Code), %% Create code for wh1 and wh2 in #join{}: @@ -1576,7 +1571,7 @@ {P, P}; _ -> {PV, _} = aux_name1('P', 0, abstract_vars(P)), - L = erl_anno:new(0), + L = 0, V = {var, L, PV}, {V, {match, L, V, P}} end, @@ -1584,20 +1579,19 @@ LEI = {generate, term_to_binary(M), LEInfo}, TP = term_to_binary(G), CFs = [begin - A = anno0(), - Call = {call,A,{atom,A,element},[{integer,A,Col},EPV]}, - F = list2op([{op,A,Op,abstract_term(Con),Call} - || {Con,Op} <- ConstOps], 'or', A), + Call = {call,0,{atom,0,element},[{integer,0,Col},EPV]}, + F = list2op([{op,0,Op,abstract_term(Con),Call} + || {Con,Op} <- ConstOps], 'or'), term_to_binary(F) end || {Col,ConstOps} <- ExtraConstants], {{I,G}, [{generate, TP, {qlc, DQP, [LEI | CFs], []}}]} end. -list2op([E], _Op, _Anno) -> +list2op([E], _Op) -> E; -list2op([E | Es], Op, Anno) -> - {op,Anno,Op,E,list2op(Es, Op, Anno)}. +list2op([E | Es], Op) -> + {op,0,Op,E,list2op(Es, Op)}. join_lookup_info(QNum, QInfo, G) -> {generate, _, LEInfo}=I = lists:nth(QNum, QInfo), @@ -1710,7 +1704,7 @@ prep_qlc_lc({simple_v1, PVar, LE_fun, L}, Opt, GOpt, _H) -> check_lookup_option(Opt, false), - prep_simple_qlc(PVar, anno(L), eval_le(LE_fun, GOpt), Opt); + prep_simple_qlc(PVar, L, eval_le(LE_fun, GOpt), Opt); prep_qlc_lc({qlc_v1, QFun, CodeF, Qdata0, QOpt}, Opt, GOpt, _H) -> F = fun(?qual_data(_QNum, _GoI, _SI, fil)=QualData, ModGens) -> {QualData, ModGens}; @@ -1827,7 +1821,7 @@ if Unique and not IsUnique; (Cache =/= false) and not IsCached -> - prep_simple_qlc(?SIMPLE_QVAR, anno(1), Prep, Opt); + prep_simple_qlc(?SIMPLE_QVAR, 1, Prep, Opt); true -> Prep end. @@ -2770,8 +2764,8 @@ U = "_", Node = node(), Pid = os:getpid(), - Unique = erlang:unique_integer(), - F = lists:concat([?MODULE,U,Node,U,Pid,U,Unique]), + {MSecs,Secs,MySecs} = erlang:now(), + F = lists:concat([?MODULE,U,Node,U,Pid,U,MSecs,U,Secs,U,MySecs]), TmpDir = case TmpDirOpt of "" -> {ok, CurDir} = file:get_cwd(), @@ -3778,15 +3772,6 @@ false end. -anno0() -> - anno(0). - -anno1() -> - anno(1). - -anno(L) -> - erl_anno:new(L). - family(L) -> sofs:to_external(sofs:relation_to_family(sofs:relation(L))). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/qlc_pt.erl erlang-17.3-dfsg/lib/stdlib/src/qlc_pt.erl --- erlang-18.2-dfsg/lib/stdlib/src/qlc_pt.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/qlc_pt.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -40,12 +39,7 @@ opt % #qlc_opt }). --record(state, {imp, - maxargs, - records, - xwarnings = [], - intro_vars, - node_info}). +-record(state, {imp, maxargs, records, xwarnings = []}). %-define(debug, true). @@ -72,49 +66,37 @@ Options :: [Option], Option :: type_checker | compile:option()). -parse_transform(Forms0, Options) -> +parse_transform(Forms, Options) -> ?DEBUG("qlc Parse Transform~n", []), - Imported = is_qlc_q_imported(Forms0), - {Forms, FormsNoShadows, State} = initiate(Forms0, Imported), - NodeInfo = State#state.node_info, - try - case called_from_type_checker(Options) of - true -> - %% The returned value should conform to the types, but - %% need not evaluate to anything meaningful. - L = anno0(), - {tuple,_,Fs0} = abstr(#qlc_lc{}, L), - F = fun(_Id, LC, A) -> - Init = simple(L, 'V', LC, L), - {{tuple,L,set_field(#qlc_lc.lc, Fs0, Init)}, A} - end, - {Forms1,ok} = qlc_mapfold(F, ok, Forms, State), - Forms1; - false -> - case - compile_messages(Forms, FormsNoShadows, Options, State) - of - {[],Warnings} -> - ?DEBUG("node info1 ~p~n", - [lists:sort(ets:tab2list(NodeInfo))]), - {NewForms, State1} = - transform(FormsNoShadows, State), - ExtraWs = State1#state.xwarnings, - {[],WForms} = no_duplicates(NewForms, [], Warnings, - ExtraWs, Options), - (restore_locations(WForms, State) ++ - restore_anno(NewForms, NodeInfo)); - {Errors,Warnings} -> - ?DEBUG("node info2 ~p~n", - [lists:sort(ets:tab2list(NodeInfo))]), - {EForms,WForms} = no_duplicates(FormsNoShadows, Errors, - Warnings, [], - Options), - restore_locations(EForms ++ WForms, State) ++ Forms0 - end - end - after - true = ets:delete(NodeInfo) + State = #state{imp = is_qlc_q_imported(Forms), + maxargs = ?COMPILE_MAX_NUM_OF_ARGS, + records = record_attributes(Forms)}, + case called_from_type_checker(Options) of + true -> + %% The returned value should conform to the types, but + %% need not evaluate to anything meaningful. + L = 0, + {tuple,_,Fs0} = abstr(#qlc_lc{}, L), + F = fun(_Id, LC, A) -> + Init = simple(L, 'V', LC, L), + {{tuple,L,set_field(#qlc_lc.lc, Fs0, Init)}, A} + end, + {Forms1,ok} = qlc_mapfold(F, ok, Forms, State), + Forms1; + false -> + FormsNoShadows = no_shadows(Forms, State), + case compile_messages(Forms, FormsNoShadows, Options, State) of + {[],[],Warnings} -> + {NewForms, State1} = transform(FormsNoShadows, State), + ExtraWs = State1#state.xwarnings, + {[],WForms} = no_duplicates(NewForms, [], Warnings, + ExtraWs, Options), + WForms ++ NewForms; + {E0,Errors,Warnings} -> + {EForms,WForms} = no_duplicates(Forms, E0++Errors, + Warnings, [], Options), + EForms ++ WForms ++ Forms + end end. -spec(transform_from_evaluator(LC, Bs) -> Expr when @@ -142,78 +124,30 @@ lists:member(type_checker, Options). transform_expression(LC, Bs0, WithLintErrors) -> - L = anno1(), + L = 1, As = [{var,L,V} || {V,_Val} <- Bs0], Ar = length(As), F = {function,L,bar,Ar,[{clause,L,As,[],[?QLC_Q(L, L, L, L, LC, [])]}]}, - Forms0 = [{attribute,L,file,{"foo",L}}, - {attribute,L,module,foo}, F], - {Forms, FormsNoShadows, State} = initiate(Forms0, false), - NodeInfo = State#state.node_info, + Forms = [{attribute,L,file,{"foo",L}}, + {attribute,L,module,foo}, F], + State = #state{imp = false, + maxargs = ?EVAL_MAX_NUM_OF_ARGS, + records = record_attributes(Forms)}, Options = [], - try compile_messages(Forms, FormsNoShadows, Options, State) of - {Errors0,_Warnings} -> - case restore_locations(Errors0, State) of - [] -> - {NewForms,_State1} = transform(FormsNoShadows, State), - NewForms1 = restore_anno(NewForms, NodeInfo), - {function,L,bar,Ar,[{clause,L,As,[],[NF]}]} = - lists:last(NewForms1), - {ok,NF}; - Errors when WithLintErrors -> - {not_ok,mforms(error, Errors)}; - Errors -> - [{error,Reason} | _] = mforms(error, Errors), - {not_ok, {error, ?APIMOD, Reason}} - end - after - true = ets:delete(NodeInfo) + FormsNoShadows = no_shadows(Forms, State), + case compile_messages(Forms, FormsNoShadows, Options, State) of + {[],[],_Warnings} -> + {NewForms,_State1} = transform(FormsNoShadows, State), + {function,L,bar,Ar,[{clause,L,As,[],[NF]}]} = + lists:last(NewForms), + {ok,NF}; + {E0,Errors,_Warnings} when WithLintErrors -> + {not_ok,mforms(error, E0 ++ Errors)}; + {E0,Errors0,_Warnings} -> + [{error,Reason} | _] = mforms(error, E0++Errors0), + {not_ok, {error, ?APIMOD, Reason}} end. --ifdef(DEBUG). --define(ILIM, 0). --else. --define(ILIM, 255). --endif. - -initiate(Forms0, Imported) -> - NodeInfo = ets:new(?APIMOD, []), - true = ets:insert(NodeInfo, {var_n, ?ILIM}), - exclude_integers_from_unique_line_numbers(Forms0, NodeInfo), - ?DEBUG("node info0 ~p~n", - [lists:sort(ets:tab2list(NodeInfo))]), - State0 = #state{imp = Imported, - maxargs = ?EVAL_MAX_NUM_OF_ARGS, - records = record_attributes(Forms0), - node_info = NodeInfo}, - Forms = save_anno(Forms0, NodeInfo), - FormsNoShadows = no_shadows(Forms, State0), - IntroVars = intro_variables(FormsNoShadows, State0), - State = State0#state{intro_vars = IntroVars}, - {Forms, FormsNoShadows, State}. - -%% Make sure restore_locations() does not confuse integers with (the -%% unique) line numbers. -exclude_integers_from_unique_line_numbers(Forms, NodeInfo) -> - Integers = find_integers(Forms), - lists:foreach(fun(I) -> ets:insert(NodeInfo, {I}) end, Integers). - -find_integers(Forms) -> - F = fun(A) -> - Fs1 = erl_parse:map_anno(fun(_) -> A end, Forms), - ordsets:from_list(integers(Fs1, [])) - end, - ordsets:to_list(ordsets:intersection(F(anno0()), F(anno1()))). - -integers([E | Es], L) -> - integers(Es, integers(E, L)); -integers(T, L) when is_tuple(T) -> - integers(tuple_to_list(T), L); -integers(I, L) when is_integer(I), I > ?ILIM -> - [I | L]; -integers(_, L) -> - L. - -define(I(I), {integer, L, I}). -define(A(A), {atom, L, A}). -define(V(V), {var, L, V}). @@ -230,15 +164,9 @@ %% Avoid duplicated lint warnings and lint errors. Care has been taken %% not to introduce unused variables in the transformed code. %% -no_duplicates(Forms, Errors, Warnings0, ExtraWarnings0, Options) -> +no_duplicates(Forms, Errors, Warnings0, ExtraWarnings, Options) -> %% Some mistakes such as "{X} =:= {}" are found by strong %% validation as well as by qlc. Prefer the warnings from qlc: - %% The Compiler and qlc do not agree on the location of errors. - %% For now, qlc's messages about failing patterns and filters - %% are ignored. - ExtraWarnings = [W || W={_File,[{_,qlc,Tag}]} <- - ExtraWarnings0, - not lists:member(Tag, [nomatch_pattern,nomatch_filter])], Warnings1 = mforms(Warnings0) -- ([{File,[{L,v3_core,nomatch}]} || {File,[{L,qlc,M}]} <- mforms(ExtraWarnings), @@ -257,22 +185,13 @@ lists:sort([{File,[M]} || {File,Ms} <- L, M <- Ms]). mforms2(Tag, L) -> - Line = anno0(), + Line = 0, ML = lists:flatmap(fun({File,Ms}) -> - [[{attribute,Line,file,{File,0}}, {Tag,M}] || + [[{attribute,Line,file,{File,Line}}, {Tag,M}] || M <- Ms] end, lists:sort(L)), lists:flatten(lists:sort(ML)). -restore_locations([T | Ts], State) -> - [restore_locations(T, State) | restore_locations(Ts, State)]; -restore_locations(T, State) when is_tuple(T) -> - list_to_tuple(restore_locations(tuple_to_list(T), State)); -restore_locations(I, State) when I > ?ILIM -> - restore_loc(I, State); -restore_locations(T, _State) -> - T. - is_qlc_q_imported(Forms) -> [[] || {attribute,_,import,{?APIMOD,FAs}} <- Forms, {?Q,1} <- FAs] =/= []. @@ -293,20 +212,13 @@ (_QId, Q, GA, A) -> {Q,GA,A} end, - {_,BGens} = qual_fold(BGenF, [], [], Forms, State), + {_,BGens} = qual_fold(BGenF, [], [], FormsNoShadows, State), GenForm = used_genvar_check(FormsNoShadows, State), ?DEBUG("GenForm = ~ts~n", [catch erl_pp:form(GenForm)]), - {GEs,_} = compile_forms([GenForm], Options), - UsedGenVarMsgs = used_genvar_messages(GEs, State), - NodeInfo = State#state.node_info, - WarnFun = fun(_Id, LC, A) -> {lc_nodes(LC, NodeInfo), A} end, + WarnFun = fun(Id, LC, A) -> {tag_lines(LC, get_lcid_no(Id)), A} end, {WForms,ok} = qlc_mapfold(WarnFun, ok, Forms, State), - {Es,Ws} = compile_forms(WForms, Options), - LcEs = lc_messages(Es, NodeInfo), - LcWs = lc_messages(Ws, NodeInfo), - Errors = badarg(Forms, State) ++ UsedGenVarMsgs++LcEs++BGens, - Warnings = LcWs, - {Errors,Warnings}. + {Es,Ws} = compile_forms(WForms ++ [GenForm], Options), + {badarg(Forms, State),tagged_messages(Es)++BGens,tagged_messages(Ws)}. badarg(Forms, State) -> F = fun(_Id, {lc,_L,_E,_Qs}=LC, Es) -> @@ -318,39 +230,54 @@ {_,E0} = qlc_mapfold(F, [], Forms, State), E0. -lc_nodes(E, NodeInfo) -> - erl_parse:map_anno(fun(Anno) -> - N = erl_anno:line(Anno), - [{N, Data}] = ets:lookup(NodeInfo, N), - NData = Data#{inside_lc => true}, - true = ets:insert(NodeInfo, {N, NData}), - Anno - end, E). - -used_genvar_messages(MsL, S) -> +tag_lines(E, No) -> + map_lines(fun(Id) -> + case is_lcid(Id) of + true -> Id; + false -> make_lcid(Id, No) + end + end, E). + +map_lines(F, E) -> + erl_lint:modify_line(E, F). + +tagged_messages(MsL) -> + [{File, + [{Loc,Mod,untag(T)} || {Loc0,Mod,T} <- Ms, + {true,Loc} <- [tloc(Loc0)]]} + || {File,Ms} <- MsL] + ++ [{File,[{Loc,?APIMOD,{used_generator_variable,V}}]} - || {_, Ms} <- MsL, + || {_, Ms} <- MsL, {XLoc,erl_lint,{unbound_var,_}} <- Ms, - {Loc,File,V} <- [genvar_pos(XLoc, S)]]. + {Loc,File,V} <- [extra(XLoc)]]. -lc_messages(MsL, NodeInfo) -> - [{File,[{Loc,Mod,T} || {Loc,Mod,T} <- Ms, lc_loc(Loc, NodeInfo)]} || - {File,Ms} <- MsL]. - -lc_loc(N, NodeInfo) -> - case ets:lookup(NodeInfo, N) of - [{N, #{inside_lc := true}}] -> - true; - [{N, _}] -> - false - end. +tloc({Id,Column}) -> + {IsLcid,T} = tloc(Id), + {IsLcid,{T,Column}}; +tloc(Id) -> + IsLcid = is_lcid(Id), + {IsLcid,case IsLcid of + true -> get_lcid_line(Id); + false -> any + end}. + +extra({extra,Line,File,V}) -> + {Line,File,V}; +extra({Line,Column}) -> + case extra(Line) of + {L,File,V} -> {{L,Column},File,V}; + Else -> Else + end; +extra(Else) -> + Else. -genvar_pos(Location, S) -> - case ets:lookup(S#state.node_info, Location) of - [{Location, #{genvar_pos := Pos}}] -> - Pos; - [] -> - Location +untag([E | Es]) -> [untag(E) | untag(Es)]; +untag(T) when is_tuple(T) -> list_to_tuple(untag(tuple_to_list(T))); +untag(E) -> + case is_lcid(E) of + true -> get_lcid_line(E); + false -> E end. %% -> [{Qid,[variable()]}]. @@ -366,7 +293,6 @@ %% variables (unless they are unsafe). %% intro_variables(FormsNoShadows, State) -> - NodeInfo = State#state.node_info, Fun = fun(QId, {T,_L,P0,_E0}=Q, {GVs,QIds}, Foo) when T =:= b_generate; T =:= generate -> PVs = qlc:var_ufold(fun({var,_,V}) -> {QId,V} end, P0), @@ -376,11 +302,10 @@ %% where E is an LC expression consisting of a %% template mentioning all variables occurring in F. Vs = ordsets:to_list(qlc:vars(Filter0)), - AnyLine = anno0(), - Vars = [{var,AnyLine,V} || V <- Vs], - LC = embed_vars(Vars, AnyLine), - LC1 = intro_anno(LC, before, QId, NodeInfo), - LC2 = intro_anno(LC, 'after', QId, NodeInfo), + Id = QId#qid.lcid, + LC1 = embed_vars(intro_set_line({QId,f1}, Vs), Id), + LC2 = embed_vars(intro_set_line({QId,f2}, Vs), Id), + AnyLine = -1, Filter = {block,AnyLine,[LC1,Filter0,LC2]}, {Filter,{GVs,[{QId,[]} | QIds]},Foo} end, @@ -392,15 +317,9 @@ Es0 = compile_errors(FForms), %% A variable is bound inside the filter if it is not bound before %% the filter, but it is bound after the filter (obviously). - Before = [{QId,V} || - {L,erl_lint,{unbound_var,V}} <- Es0, - {_L,{QId,before}} <- ets:lookup(NodeInfo, L)], - After = [{QId,V} || - {L,erl_lint,{unbound_var,V}} <- Es0, - {_L,{QId,'after'}} <- ets:lookup(NodeInfo, L)], - Unsafe = [{QId,V} || - {L,erl_lint,{unsafe_var,V,_Where}} <- Es0, - {_L,{QId,'after'}} <- ets:lookup(NodeInfo, L)], + Before = [{QId,V} || {{QId,f1},erl_lint,{unbound_var,V}} <- Es0], + After = [{QId,V} || {{QId,f2},erl_lint,{unbound_var,V}} <- Es0], + Unsafe = [{QId,V} || {{QId,f2},erl_lint,{unsafe_var,V,_Where}} <- Es0], ?DEBUG("Before = ~p~n", [Before]), ?DEBUG("After = ~p~n", [After]), ?DEBUG("Unsafe = ~p~n", [Unsafe]), @@ -409,14 +328,9 @@ I1 = family(IV ++ GenVars), sofs:to_external(sofs:family_union(sofs:family(QIds), I1)). -intro_anno(LC, Where, QId, NodeInfo) -> - Data = {QId,Where}, - Fun = fun(Anno) -> - Location = erl_anno:location(Anno), - true = ets:insert(NodeInfo, {Location,Data}), - Anno - end, - erl_parse:map_anno(Fun, save_anno(LC, NodeInfo)). +intro_set_line(Tag, Vars) -> + L = erl_parse:set_line(1, fun(_) -> Tag end), + [{var,L,V} || V <- Vars]. compile_errors(FormsNoShadows) -> case compile_forms(FormsNoShadows, []) of @@ -427,14 +341,11 @@ lists:flatmap(fun({_File,Es}) -> Es end, Errors) end. +-define(MAX_NUM_OF_LINES, 23). % assume max 1^23 lines (> 8 millions) + compile_forms(Forms0, Options) -> - Exclude = fun(eof) -> true; - (warning) -> true; - (error) -> true; - (_) -> false - end, - Forms = ([F || F <- Forms0, not Exclude(element(1, F))] - ++ [{eof,anno0()}]), + Forms = [F || F <- Forms0, element(1, F) =/= eof] ++ + [{eof,1 bsl ?MAX_NUM_OF_LINES}], try case compile:noenv_forms(Forms, compile_options(Options)) of {ok, _ModName, Ws0} -> @@ -473,23 +384,20 @@ %% for each ListExpr. The expression mentions all introduced variables %% occurring in ListExpr. Running the function through the compiler %% yields error messages for erroneous use of introduced variables. +%% The messages have the form +%% {{extra,LineNo,File,Var},Module,{unbound_var,V}}, where Var is the +%% original variable name and V is the name invented by no_shadows/2. %% used_genvar_check(FormsNoShadows, State) -> - NodeInfo = State#state.node_info, - F = fun(QId, {T, Ln, _P, LE}=Q, {QsIVs0, Exprs0}, IVsSoFar0) + F = fun(QId, {T, Ln, _P, LE}=Q, {QsIVs0, Exprs0}, IVsSoFar0) when T =:= b_generate; T =:= generate -> - F = fun(Var) -> - {var, Anno0, OrigVar} = - undo_no_shadows(Var, State), - {var, Anno, _} = NewVar = save_anno(Var, NodeInfo), - Location0 = erl_anno:location(Anno0), - Location = erl_anno:location(Anno), - [{Location, Data}] = - ets:lookup(NodeInfo, Location), - Pos = {Location0,get(?QLC_FILE),OrigVar}, - NData = Data#{genvar_pos => Pos}, - true = ets:insert(NodeInfo, {Location, NData}), - NewVar + F = fun({var, _, V}=Var) -> + {var, L, OrigVar} = undo_no_shadows(Var), + AF = fun(Line) -> + {extra, Line, get(?QLC_FILE), OrigVar} + end, + L2 = erl_parse:set_line(L, AF), + {var, L2, V} end, Vs = [Var || {var, _, V}=Var <- qlc:var_fold(F, [], LE), lists:member(V, IVsSoFar0)], @@ -503,12 +411,12 @@ {QsIVs, IVsSoFar} = q_intro_vars(QId, QsIVs0, IVsSoFar0), {Filter, {QsIVs, Exprs}, IVsSoFar} end, - Acc0 = {State#state.intro_vars, [{atom, anno0(), true}]}, + IntroVars = intro_variables(FormsNoShadows, State), + Acc0 = {IntroVars, [{atom, 0, true}]}, {_, {[], Exprs}} = qual_fold(F, Acc0, [], FormsNoShadows, State), FunctionNames = [Name || {function, _, Name, _, _} <- FormsNoShadows], UniqueFName = qlc:aux_name(used_genvar, 1, sets:from_list(FunctionNames)), - A = anno0(), - {function,A,UniqueFName,0,[{clause,A,[],[],lists:reverse(Exprs)}]}. + {function,0,UniqueFName,0,[{clause,0,[],[],lists:reverse(Exprs)}]}. q_intro_vars(QId, [{QId, IVs} | QsIVs], IVsSoFar) -> {QsIVs, IVs ++ IVsSoFar}. @@ -606,8 +514,7 @@ %% (calling LEf returns the objects generated by LE). transform(FormsNoShadows, State) -> - _ = erlang:system_flag(backtrace_depth, 500), - IntroVars = State#state.intro_vars, + IntroVars = intro_variables(FormsNoShadows, State), AllVars = sets:from_list(ordsets:to_list(qlc:vars(FormsNoShadows))), ?DEBUG("AllVars = ~p~n", [sets:to_list(AllVars)]), F1 = fun(QId, {generate,_,P,LE}, Foo, {GoI,SI}) -> @@ -681,8 +588,8 @@ [{match,L,{var,L,Fun},FunC}, {call,L,{var,L,Fun},As0}]}]}}, {ok, OrigE0} = dict:find(Id, Source), - OrigE = undo_no_shadows(OrigE0, State), - QCode = qcode(OrigE, XQCs, Source, L, State), + OrigE = undo_no_shadows(OrigE0), + QCode = qcode(OrigE, XQCs, Source, L), Qdata = qdata(XQCs, L), TemplateInfo = template_columns(Qs, E, AllIVs, Dependencies, State), @@ -691,7 +598,7 @@ Opt = opt_info(TemplateInfo, SizeInfo, JoinInfo, MSQs, L, EqColumnConstants, EqualColumnConstants), LCTuple = - case qlc_kind(OrigE, Qs, State) of + case qlc_kind(OrigE, Qs) of qlc -> {tuple,L,[?A(qlc_v1),FunW,QCode,Qdata,Opt]}; {simple, PL, LE, V} -> @@ -705,7 +612,7 @@ end, {NForms,{[],XW}} = qlc_mapfold(F2, {IntroVars,[]}, ModifiedForms1, State), display_forms(NForms), - {NForms, State#state{xwarnings = XW}}. + {restore_line_numbers(NForms), State#state{xwarnings = XW}}. join_kind(Qs, LcL, AllIVs, Dependencies, State) -> {EqualCols2, EqualColsN} = equal_columns(Qs, AllIVs, Dependencies, State), @@ -716,21 +623,20 @@ if EqualColsN =/= []; MatchColsN =/= [] -> {[], - [{get(?QLC_FILE),[{LcL,?APIMOD,too_complex_join}]}]}; + [{get(?QLC_FILE),[{abs(LcL),?APIMOD,too_complex_join}]}]}; EqualCols2 =:= [], MatchCols2 =:= [] -> {[], []}; length(Tables) > 2 -> {[], - [{get(?QLC_FILE),[{LcL,?APIMOD,too_many_joins}]}]}; + [{get(?QLC_FILE),[{abs(LcL),?APIMOD,too_many_joins}]}]}; EqualCols2 =:= MatchCols2 -> {EqualCols2, []}; true -> {{EqualCols2, MatchCols2}, []} end. -qlc_kind(OrigE, Qs, State) -> - {OrigFilterData, OrigGeneratorData} = - qual_data(undo_no_shadows(Qs, State)), +qlc_kind(OrigE, Qs) -> + {OrigFilterData, OrigGeneratorData} = qual_data(undo_no_shadows(Qs)), OrigAllFilters = filters_as_one(OrigFilterData), {_FilterData, GeneratorData} = qual_data(Qs), case {OrigE, OrigAllFilters, OrigGeneratorData} of @@ -757,12 +663,12 @@ lists:foldl(fun({_QId,{fil,_Filter}}, {[]=Frames,Warnings}) -> {Frames,Warnings}; ({_QId,{fil,Filter}}, {Frames,Warnings}) -> - case filter(reset_anno(Filter), Frames, BindFun, + case filter(set_line(Filter, 0), Frames, BindFun, State, Imported) of [] -> {[], [{get(?QLC_FILE), - [{loc(element(2, Filter)),?APIMOD, + [{abs_loc(element(2, Filter)),?APIMOD, nomatch_filter}]} | Warnings]}; Frames1 -> {Frames1,Warnings} @@ -772,7 +678,7 @@ {failed, _, _} -> {Frames, [{get(?QLC_FILE), - [{loc(element(2, Pattern)),?APIMOD, + [{abs_loc(element(2, Pattern)),?APIMOD, nomatch_pattern}]} | Warnings]}; _ -> {Frames,Warnings} @@ -845,8 +751,8 @@ || IdNo <- Ns] ++ [{clause,L,[?V('_')],[],[?A(no_column_fun)]}]. -abstr(Term, Anno) -> - erl_parse:abstract(Term, loc(Anno)). +abstr(Term, Line) -> + erl_parse:abstract(Term, Line). %% Extra generators are introduced for join. join_quals(JoinInfo, QCs, L, LcNo, ExtraConstants, AllVars) -> @@ -931,10 +837,9 @@ {{var, _, _}, []} -> {'fun',L,{clauses,[{clause,L,[H],[],[H]}]}}; _ -> - A = anno0(), G0 = [begin - Call = {call,A,{atom,A,element},[{integer,A,Col},O]}, - list2op([{op,A,Op,Con,Call} || {Con,Op} <- Cs], 'or') + Call = {call,0,{atom,0,element},[{integer,0,Col},O]}, + list2op([{op,0,Op,Con,Call} || {Con,Op} <- Cs], 'or') end || {Col,Cs} <- Constants], G = if G0 =:= [] -> G0; true -> [G0] end, CC1 = {clause,L,[AP],G,[{cons,L,O,closure({call,L,F,[F,C]},L)}]}, @@ -971,15 +876,14 @@ %% order the traverse fun would return them. column_fun(Columns, QualifierNumber, LcL) -> - A = anno0(), ColCls0 = [begin true = Vs0 =/= [], % at least one value to look up Vs1 = list2cons(Vs0), - Fils1 = {tuple,A,[{atom,A,FTag}, + Fils1 = {tuple,0,[{atom,0,FTag}, lists:foldr - (fun(F, Ac) -> {cons,A,{integer,A,F},Ac} - end, {nil,A}, Fils)]}, + (fun(F, A) -> {cons,0,{integer,0,F},A} + end, {nil,0}, Fils)]}, Tag = case ordsets:to_list(qlc:vars(Vs1)) of Imp when length(Imp) > 0, % imported vars length(Vs0) > 1 -> @@ -987,13 +891,13 @@ _ -> values end, - Vs = {tuple,A,[{atom,A,Tag},Vs1,Fils1]}, - {clause,A,[erl_parse:abstract(Col)],[],[Vs]} + Vs = {tuple,0,[{atom,0,Tag},Vs1,Fils1]}, + {clause,0,[erl_parse:abstract(Col)],[],[Vs]} end || {{CIdNo,Col}, Vs0, {FTag,Fils}} <- Columns, CIdNo =:= QualifierNumber] - ++ [{clause,A,[{var,A,'_'}],[],[{atom,A,false}]}], - ColCls = set_anno(ColCls0, LcL), + ++ [{clause,0,[{var,0,'_'}],[],[{atom,0,false}]}], + ColCls = set_line(ColCls0, LcL), {'fun', LcL, {clauses, ColCls}}. %% Tries to find columns of the template that (1) are equal to (or @@ -1016,7 +920,7 @@ MatchColumns = eq_columns2(Qs, AllIVs, Dependencies, State), Equal = template_cols(EqualColumns), Match = template_cols(MatchColumns), - L = anno0(), + L = 0, if Match =:= Equal -> [{?V('_'), Match}]; @@ -1043,7 +947,7 @@ template_as_pattern(E) -> P = simple_template(E), - {?TID,foo,foo,{gen,P,{nil,anno0()}}}. + {?TID,foo,foo,{gen,P,{nil,0}}}. simple_template({call,L,{remote,_,{atom,_,erlang},{atom,_,element}}=Call, [{integer,_,I}=A1,A2]}) when I > 0 -> @@ -1100,10 +1004,10 @@ GQId =:= QId2, {FQId,{fil,F}}=Filter <- Filters, % guard filters only FQId =:= QId] - ++ [{GId#qid.no,Pattern,[],{atom,anno0(),true}} || + ++ [{GId#qid.no,Pattern,[],{atom,0,true}} || {GId,{gen,Pattern,_}} <- GeneratorData, lists:member(GId, NoFilterGIds)], - E = {nil, anno0()}, + E = {nil, 0}, GF = [{{GNum,Pattern},Filter} || {GNum,Pattern,Filter,F} <- Candidates, no =/= try_ms(E, Pattern, F, State)], @@ -1120,7 +1024,7 @@ %% expressione can be replaced by a match specification. [{GNum, AbstrMS, all}] catch _:_ -> - {TemplVar, _} = anon_var({var,anno0(),'_'}, 0), + {TemplVar, _} = anon_var({var,0,'_'}, 0), [one_gen_match_spec(GNum, Pattern, GFilterData, State, TemplVar) || {{GNum,Pattern},GFilterData} <- GFFL] end. @@ -1134,7 +1038,7 @@ {ok, MS, AMS} = try_ms(E, Pattern, filters_as_one(GFilterData), State), case MS of [{'$1',[true],['$1']}] -> - {atom, anno0(), no_match_spec}; + {atom, 0, no_match_spec}; _ -> AMS end. @@ -1156,7 +1060,7 @@ pattern_as_template({match,_,{var,_,_}=V,_E}=P, _TemplVar) -> {V, P}; pattern_as_template(E, TemplVar) -> - L = anno0(), + L = 0, {TemplVar, {match, L, E, TemplVar}}. %% Tries to find columns which are compared or matched against @@ -1299,7 +1203,7 @@ ColFil = [{Column, FId#qid.no} || {FId,{fil,Fil}} <- filter_list(FilterData, Dependencies, State), - [] =/= (SFs = safe_filter(reset_anno(Fil), PatternFrames, + [] =/= (SFs = safe_filter(set_line(Fil, 0), PatternFrames, BindFun, State, Imported)), {GId,PV} <- PatternVars, [] =/= @@ -1488,7 +1392,7 @@ JF = unify(JoinOp, V1, V2, JF2, BindFun, Imported), %% "Run" the filter: - SFs = safe_filter(reset_anno(Fil), PatternFrames, + SFs = safe_filter(set_line(Fil, 0), PatternFrames, BindFun, State, Imported), JImp = qlc:vars([SFs, JF]), % kludge lists:all(fun(Frame) -> @@ -1499,7 +1403,7 @@ filter_info(FilterData, AllIVs, Dependencies, State) -> FilterList = filter_list(FilterData, Dependencies, State), - Filter0 = reset_anno(filters_as_one(FilterList)), + Filter0 = set_line(filters_as_one(FilterList), 0), Anon0 = 0, {Filter, Anon1} = anon_var(Filter0, Anon0), Imported = ordsets:subtract(qlc:vars(Filter), % anonymous too @@ -1606,7 +1510,7 @@ catch _:_ -> P0 % template, records already expanded end, %% Makes test for equality simple: - P2 = reset_anno(P1), + P2 = set_line(P1, 0), {P3, AnonN} = anon_var(P2, AnonI), {P4, F1} = match_in_pattern(tuple2cons(P3), Frame0, BindFun), {P, F2} = element_calls(P4, F1, BindFun, _Imp=[]), % kludge for templates @@ -1646,11 +1550,8 @@ (Var, N) -> {Var, N} end, AnonI, E). -reset_anno(T) -> - set_anno(T, anno0()). - -set_anno(T, A) -> - erl_parse:map_anno(fun(_L) -> A end, T). +set_line(T, L) -> + map_lines(fun(_L) -> L end, T). -record(fstate, {state, bind_fun, imported}). @@ -1772,7 +1673,7 @@ %% same variables have to be the representatives in every frame.) SizesVarsL = [begin - PatVar = {var,anno0(),PV}, + PatVar = {var,0,PV}, PatternSizes = [pattern_size([F], PatVar, false) || F <- Fs], MaxPZ = lists:max([0 | PatternSizes -- [undefined]]), @@ -1791,8 +1692,8 @@ frames2cols(Fs, PatN, PatSizes, Vars, DerefFun, SelectorFun, CompOp) -> Rs = [ begin RL = [{{PatN,Col},cons2tuple(element(2, Const))} || - {V, Col} <- lists:zip(lists:sublist(Vars, PatSz), - lists:seq(1, PatSz)), + {V, Col} <- lists:zip(sublist(Vars, PatSz), + seq(1, PatSz)), %% Do not handle the case where several %% values compare equal, e.g. "X =:= 1 %% andalso X == 1.0". Looking up both @@ -1821,11 +1722,11 @@ [C || {_,Vs}=C <- sofs:to_external(Cs), not col_ignore(Vs, CompOp)]. pat_vars(N) -> - [unique_var() || _ <- lists:seq(1, N)]. + [unique_var() || _ <- seq(1, N)]. pat_tuple(Sz, Vars) when is_integer(Sz), Sz > 0 -> TupleTail = unique_var(), - {cons_tuple, list2cons(lists:sublist(Vars, Sz) ++ TupleTail)}; + {cons_tuple, list2cons(sublist(Vars, Sz) ++ TupleTail)}; pat_tuple(_, _Vars) -> unique_var(). @@ -1839,7 +1740,7 @@ pattern_sizes(PatternVars, Fs) -> [{QId#qid.no, Size} || {QId,PV} <- PatternVars, - undefined =/= (Size = pattern_size(Fs, {var,anno0(),PV}, true))]. + undefined =/= (Size = pattern_size(Fs, {var,0,PV}, true))]. pattern_size(Fs, PatternVar, Exact) -> Fun = fun(F) -> (deref_pattern(_Imported = []))(PatternVar, F) end, @@ -1867,8 +1768,7 @@ element_calls(tuple2cons(expand_expr_records(E, S)), F, BF, Imported). unify_column(Frame, Var, Col, BindFun, Imported) -> - A = anno0(), - Call = {call,A,{atom,A,element},[{integer,A,Col}, {var,A,Var}]}, + Call = {call,0,{atom,0,element},[{integer,0,Col}, {var,0,Var}]}, element_calls(Call, Frame, BindFun, Imported). %% cons_tuple is used for representing {V1, ..., Vi | TupleTail}. @@ -1900,21 +1800,19 @@ {E, F}. unique_var() -> - {var, anno0(), make_ref()}. + {var, 0, make_ref()}. is_unique_var({var, _L, V}) -> is_reference(V). expand_pattern_records(P, State) -> - A = anno0(), - E = {'case',A,{atom,A,true},[{clause,A,[P],[],[{atom,A,true}]}]}, - {'case',_,_,[{clause,A,[NP],_,_}]} = expand_expr_records(E, State), + E = {'case',0,{atom,0,true},[{clause,0,[P],[],[{atom,0,true}]}]}, + {'case',_,_,[{clause,0,[NP],_,_}]} = expand_expr_records(E, State), NP. expand_expr_records(E, State) -> RecordDefs = State#state.records, - A = anno1(), - Forms = RecordDefs ++ [{function,A,foo,0,[{clause,A,[],[],[pe(E)]}]}], + Forms = RecordDefs ++ [{function,1,foo,0,[{clause,1,[],[],[pe(E)]}]}], [{function,_,foo,0,[{clause,_,[],[],[NE]}]}] = erl_expand_records:module(Forms, [no_strict_record_tests]), NE. @@ -2228,15 +2126,15 @@ E. list2cons([E | Es]) -> - {cons, anno0(), E, list2cons(Es)}; + {cons, 0, E, list2cons(Es)}; list2cons([]) -> - {nil, anno0()}; + {nil, 0}; list2cons(E) -> E. %% Returns {..., Variable} if Variable is a tuple tail. cons2tuple({cons_tuple, Es}) -> - {tuple, anno0(), cons2list(Es)}; + {tuple, 0, cons2list(Es)}; cons2tuple(T) when is_tuple(T) -> list_to_tuple(cons2tuple(tuple_to_list(T))); cons2tuple([E | Es]) -> @@ -2275,10 +2173,11 @@ %% not to have guard semantics, affected filters will have to be %% recognized and excluded here as well. try_ms(E, P, Fltr, State) -> - L = anno1(), + L = 1, Fun = {'fun',L,{clauses,[{clause,L,[P],[[Fltr]],[E]}]}}, Expr = {call,L,{remote,L,{atom,L,ets},{atom,L,fun2ms}},[Fun]}, - Form = {function,L,foo,0,[{clause,L,[],[],[Expr]}]}, + Form0 = {function,L,foo,0,[{clause,L,[],[],[Expr]}]}, + Form = restore_line_numbers(Form0), X = ms_transform:parse_transform(State#state.records ++ [Form], []), case catch begin @@ -2295,11 +2194,11 @@ end. filters_as_one([]) -> - {atom, anno0(), true}; + {atom, 0, true}; filters_as_one(FilterData) -> [{_,{fil,Filter1}} | Filters] = lists:reverse(FilterData), lists:foldr(fun({_QId,{fil,Filter}}, AbstF) -> - {op,anno0(),'andalso',Filter,AbstF} + {op,0,'andalso',Filter,AbstF} end, Filter1, Filters). qual_data(Qualifiers) -> @@ -2334,40 +2233,38 @@ {nil,L}. qcon(Cs) -> - A = anno0(), - list2cons([{tuple,A,[{integer,A,Col},list2cons(qcon1(ConstOps))]} || + list2cons([{tuple,0,[{integer,0,Col},list2cons(qcon1(ConstOps))]} || {Col,ConstOps} <- Cs]). qcon1(ConstOps) -> - A = anno0(), - [{tuple,A,[Const,abstr(Op, A)]} || {Const,Op} <- ConstOps]. + [{tuple,0,[Const,abstr(Op, 0)]} || {Const,Op} <- ConstOps]. %% The original code (in Source) is used for filters and the template %% since the translated code can have QLCs and we don't want them to %% be visible. -qcode(E, QCs, Source, L, State) -> +qcode(E, QCs, Source, L) -> CL = [begin Bin = term_to_binary(C, [compressed]), {bin, L, [{bin_element, L, {string, L, binary_to_list(Bin)}, default, default}]} end || {_,C} <- lists:keysort(1, [{qlc:template_state(),E} | - qcode(QCs, Source, State)])], + qcode(QCs, Source)])], {'fun', L, {clauses, [{clause, L, [], [], [{tuple, L, CL}]}]}}. -qcode([{_QId, {_QIvs, {{gen,P,_LE,_GV}, GoI, _SI}}} | QCs], Source, State) -> - [{GoI,undo_no_shadows(P, State)} | qcode(QCs, Source, State)]; -qcode([{QId, {_QIVs, {{fil,_F}, GoI, _SI}}} | QCs], Source, State) -> +qcode([{_QId, {_QIvs, {{gen,P,_LE,_GV}, GoI, _SI}}} | QCs], Source) -> + [{GoI,undo_no_shadows(P)} | qcode(QCs, Source)]; +qcode([{QId, {_QIVs, {{fil,_F}, GoI, _SI}}} | QCs], Source) -> {ok,OrigF} = dict:find(QId, Source), - [{GoI,undo_no_shadows(OrigF, State)} | qcode(QCs, Source, State)]; -qcode([], _Source, _State) -> + [{GoI,undo_no_shadows(OrigF)} | qcode(QCs, Source)]; +qcode([], _Source) -> []. closure(Code, L) -> {'fun',L,{clauses,[{clause,L,[],[],[Code]}]}}. -simple(L, Var, Init, Anno) -> - {tuple,L,[?A(simple_v1),?A(Var),Init,abstr(loc(Anno), Anno)]}. +simple(L, Var, Init, Line) -> + {tuple,L,[?A(simple_v1),?A(Var),Init,?I(Line)]}. clauses([{QId,{QIVs,{QualData,GoI,S}}} | QCs], RL, Fun, Go, NGV, E, IVs,St) -> ?DEBUG("QIVs = ~p~n", [QIVs]), @@ -2529,22 +2426,19 @@ qlc:aux_name(lists:concat([Name, LcN, '_', QN, '_']), N, AllVars). no_compiler_warning(L) -> - Anno = erl_anno:new(L), - erl_anno:set_generated(true, Anno). + erl_parse:set_line(L, fun(Line) -> -abs(Line) end). + +abs_loc(L) -> + loc(erl_parse:set_line(L, fun(Line) -> abs(Line) end)). -loc(A) -> - erl_anno:location(A). +loc(L) -> + {location,Location} = erl_parse:get_attribute(L, location), + Location. list2op([E], _Op) -> E; list2op([E | Es], Op) -> - {op,anno0(),Op,E,list2op(Es, Op)}. - -anno0() -> - erl_anno:new(0). - -anno1() -> - erl_anno:new(1). + {op,0,Op,E,list2op(Es, Op)}. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2597,61 +2491,13 @@ occ_vars(E) -> qlc:var_fold(fun({var,_L,V}) -> V end, [], E). -%% Every Anno is replaced by a unique number. The number is used in a -%% table that holds data about the abstract node where Anno resides. -%% In particular, the original location is kept there, so that the -%% original abstract code can be re-created. -save_anno(Abstr, NodeInfo) -> - F = fun(Anno) -> - N = next_slot(NodeInfo), - Location = erl_anno:location(Anno), - Data = {N, #{location => Location}}, - true = ets:insert(NodeInfo, Data), - erl_anno:new(N) - end, - erl_parse:map_anno(F, Abstr). - -next_slot(T) -> - I = ets:update_counter(T, var_n, 1), - case ets:lookup(T, I) of - [] -> - I; - _ -> - next_slot(T) - end. - -restore_anno(Abstr, NodeInfo) -> - F = fun(Anno) -> - Location = erl_anno:location(Anno), - case ets:lookup(NodeInfo, Location) of - [{Location, Data}] -> - OrigLocation = maps:get(location, Data), - erl_anno:set_location(OrigLocation, Anno); - [{Location}] -> % generated code - Anno; - [] -> - Anno - end - end, - erl_parse:map_anno(F, Abstr). - -restore_loc(Location, #state{node_info = NodeInfo}) -> - case ets:lookup(NodeInfo, Location) of - [{Location, #{location := OrigLocation}}] -> - OrigLocation; - [{Location}] -> - Location; - [] -> - Location - end. - no_shadows(Forms0, State) -> %% Variables that may shadow other variables are introduced in %% LCs and Funs. Such variables (call them SV, Shadowing %% Variables) are now renamed. Each (new) occurrence in a pattern %% is assigned an index (integer), unique in the file. %% - %% The state {LastIndex,ActiveVars,UsedVars,AllVars,Singletons,State} + %% The state {LastIndex,ActiveVars,UsedVars,AllVars,Singletons} %% holds the last index used for each SV (LastIndex), the SVs in %% the current scope (ActiveVars), used SVs (UsedVars, the indexed %% name is the key), all variables occurring in the file @@ -2661,15 +2507,16 @@ %% the indexed name of an SV occurs in the file, next index is %% tried (to avoid mixing up introduced names with existing ones). %% - %% The original names of variables are kept in a table in State. - %% undo_no_shadows/2 re-creates the original code. + %% The original names of variables are kept in the line number + %% position of the abstract code: {var, {nos, OriginalName, L}, + %% NewName}. undo_no_shadows/1 re-creates the original code. AllVars = sets:from_list(ordsets:to_list(qlc:vars(Forms0))), ?DEBUG("nos AllVars = ~p~n", [sets:to_list(AllVars)]), VFun = fun(_Id, LC, Vs) -> nos(LC, Vs) end, LI = ets:new(?APIMOD,[]), UV = ets:new(?APIMOD,[]), D0 = dict:new(), - S1 = {LI, D0, UV, AllVars, [], State}, + S1 = {LI, D0, UV, AllVars, []}, _ = qlc_mapfold(VFun, S1, Forms0, State), ?DEBUG("UsedIntroVars = ~p~n", [ets:match_object(UV, '_')]), Singletons = ets:select(UV, ets:fun2ms(fun({K,0}) -> K end)), @@ -2677,7 +2524,7 @@ true = ets:delete_all_objects(LI), true = ets:delete_all_objects(UV), %% Do it again, this time we know which variables are singletons. - S2 = {LI, D0, UV, AllVars, Singletons, State}, + S2 = {LI, D0, UV, AllVars, Singletons}, {Forms,_} = qlc_mapfold(VFun, S2, Forms0, State), true = ets:delete(LI), true = ets:delete(UV), @@ -2721,11 +2568,11 @@ {Qs, S1} = lists:mapfoldl(F, S, Qs0), {E, _} = nos(E0, S1), {{lc,L,E,Qs}, S}; -nos({var,L,V}=Var, {_LI,Vs,UV,_A,_Sg,State}=S) when V =/= '_' -> +nos({var,L,V}=Var, {_LI,Vs,UV,_A,_Sg}=S) when V =/= '_' -> case used_var(V, Vs, UV) of {true, VN} -> - nos_var(L, V, State), - {{var,L,VN}, S}; + NL = nos_var(L, V), + {{var,NL,VN}, S}; false -> {Var, S} end; @@ -2743,7 +2590,7 @@ {P, S1, PVs1} = nos_pattern(P0, S0, PVs0), {Ps, S, PVs} = nos_pattern(Ps0, S1, PVs1), {[P | Ps], S, PVs}; -nos_pattern({var,L,V}, {LI,Vs0,UV,A,Sg,State}, PVs0) when V =/= '_' -> +nos_pattern({var,L,V}, {LI,Vs0,UV,A,Sg}, PVs0) when V =/= '_' -> {Name, Vs, PVs} = case lists:keyfind(V, 1, PVs0) of {V, VN} -> @@ -2757,25 +2604,16 @@ end, {N, Vs1, [{V,VN} | PVs0]} end, - nos_var(L, V, State), - {{var,L,Name}, {LI,Vs,UV,A,Sg,State}, PVs}; + NL = nos_var(L, V), + {{var,NL,Name}, {LI,Vs,UV,A,Sg}, PVs}; nos_pattern(T, S0, PVs0) when is_tuple(T) -> {TL, S, PVs} = nos_pattern(tuple_to_list(T), S0, PVs0), {list_to_tuple(TL), S, PVs}; nos_pattern(T, S, PVs) -> {T, S, PVs}. -nos_var(Anno, Name, State) -> - NodeInfo = State#state.node_info, - Location = erl_anno:location(Anno), - case ets:lookup(NodeInfo, Location) of - [{Location, #{name := _}}] -> - true; - [{Location, Data}] -> - true = ets:insert(NodeInfo, {Location, Data#{name => Name}}); - [] -> % cannot happen - true - end. +nos_var(L, Name) -> + erl_parse:set_line(L, fun(Line) -> {nos,Name,Line} end). used_var(V, Vs, UV) -> case dict:find(V, Vs) of @@ -2800,30 +2638,69 @@ {VN, NVs} end. -undo_no_shadows(E, State) -> - var_map(fun(Anno) -> undo_no_shadows1(Anno, State) end, E). +undo_no_shadows(E) -> + var_map(fun undo_no_shadows1/1, E). -undo_no_shadows1({var, Anno, _}=Var, State) -> - Location = erl_anno:location(Anno), - NodeInfo = State#state.node_info, - case ets:lookup(NodeInfo, Location) of - [{Location, #{name := Name}}] -> - {var, Anno, Name}; - _ -> +undo_no_shadows1({var, L, _}=Var) -> + case erl_parse:get_attribute(L, line) of + {line,{nos,V,_VL}} -> + NL = erl_parse:set_line(L, fun({nos,_V,VL}) -> VL end), + undo_no_shadows1({var, NL, V}); + _Else -> + Var + end. + +restore_line_numbers(E) -> + var_map(fun restore_line_numbers1/1, E). + +restore_line_numbers1({var, L, V}=Var) -> + case erl_parse:get_attribute(L, line) of + {line,{nos,_,_}} -> + NL = erl_parse:set_line(L, fun({nos,_V,VL}) -> VL end), + restore_line_numbers1({var, NL, V}); + _Else -> Var end. %% QLC identifier. %% The first one encountered in the file has No=1. -make_lcid(Anno, No) when is_integer(No), No > 0 -> - {No, erl_anno:line(Anno)}. +make_lcid(Attrs, No) when is_integer(No), No > 0 -> + F = fun(Line) when is_integer(Line), Line < (1 bsl ?MAX_NUM_OF_LINES) -> + sgn(Line) * ((No bsl ?MAX_NUM_OF_LINES) + sgn(Line) * Line) + end, + erl_parse:set_line(Attrs, F). -get_lcid_no({No, _Line}) -> - No. +is_lcid(Attrs) -> + try + {line,Id} = erl_parse:get_attribute(Attrs, line), + is_integer(Id) andalso (abs(Id) > (1 bsl ?MAX_NUM_OF_LINES)) + catch _:_ -> + false + end. -get_lcid_line({_No, Line}) -> - Line. +get_lcid_no(IdAttrs) -> + {line,Id} = erl_parse:get_attribute(IdAttrs, line), + abs(Id) bsr ?MAX_NUM_OF_LINES. + +get_lcid_line(IdAttrs) -> + {line,Id} = erl_parse:get_attribute(IdAttrs, line), + sgn(Id) * (abs(Id) band ((1 bsl ?MAX_NUM_OF_LINES) - 1)). + +sgn(X) when X >= 0 -> + 1; +sgn(X) when X < 0 -> + -1. + +seq(S, E) when S - E =:= 1 -> + []; +seq(S, E) -> + lists:seq(S, E). + +sublist(_, 0) -> + []; +sublist(L, N) -> + lists:sublist(L, N). qid(LCId, No) -> #qid{no = No, lcid = LCId}. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/queue.erl erlang-17.3-dfsg/lib/stdlib/src/queue.erl --- erlang-18.2-dfsg/lib/stdlib/src/queue.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/queue.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -49,7 +48,7 @@ -opaque queue(Item) :: {list(Item), list(Item)}. --type queue() :: queue(_). +-opaque queue() :: queue(_). %% Creation, inspection and conversion diff -Nru erlang-18.2-dfsg/lib/stdlib/src/rand.erl erlang-17.3-dfsg/lib/stdlib/src/rand.erl --- erlang-18.2-dfsg/lib/stdlib/src/rand.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/rand.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,592 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% ===================================================================== -%% Multiple PRNG module for Erlang/OTP -%% Copyright (c) 2015 Kenji Rikitake -%% ===================================================================== - --module(rand). - --export([seed_s/1, seed_s/2, seed/1, seed/2, - export_seed/0, export_seed_s/1, - uniform/0, uniform/1, uniform_s/1, uniform_s/2, - normal/0, normal_s/1 - ]). - --compile({inline, [exs64_next/1, exsplus_next/1, - exs1024_next/1, exs1024_calc/2, - get_52/1, normal_kiwi/1]}). - --define(DEFAULT_ALG_HANDLER, exsplus). --define(SEED_DICT, rand_seed). - -%% ===================================================================== -%% Types -%% ===================================================================== - -%% This depends on the algorithm handler function --type alg_seed() :: exs64_state() | exsplus_state() | exs1024_state(). -%% This is the algorithm handler function within this module --type alg_handler() :: #{type => alg(), - max => integer(), - next => fun(), - uniform => fun(), - uniform_n => fun()}. - -%% Internal state --opaque state() :: {alg_handler(), alg_seed()}. --type alg() :: exs64 | exsplus | exs1024. --opaque export_state() :: {alg(), alg_seed()}. --export_type([alg/0, state/0, export_state/0]). - -%% ===================================================================== -%% API -%% ===================================================================== - -%% Return algorithm and seed so that RNG state can be recreated with seed/1 --spec export_seed() -> undefined | export_state(). -export_seed() -> - case get(?SEED_DICT) of - {#{type:=Alg}, Seed} -> {Alg, Seed}; - _ -> undefined - end. - --spec export_seed_s(state()) -> export_state(). -export_seed_s({#{type:=Alg}, Seed}) -> {Alg, Seed}. - -%% seed(Alg) seeds RNG with runtime dependent values -%% and return the NEW state - -%% seed({Alg,Seed}) setup RNG with a previously exported seed -%% and return the NEW state - --spec seed(AlgOrExpState::alg() | export_state()) -> state(). -seed(Alg) -> - R = seed_s(Alg), - _ = seed_put(R), - R. - --spec seed_s(AlgOrExpState::alg() | export_state()) -> state(). -seed_s(Alg) when is_atom(Alg) -> - seed_s(Alg, {erlang:phash2([{node(),self()}]), - erlang:system_time(), - erlang:unique_integer()}); -seed_s({Alg0, Seed}) -> - {Alg,_SeedFun} = mk_alg(Alg0), - {Alg, Seed}. - -%% seed/2: seeds RNG with the algorithm and given values -%% and returns the NEW state. - --spec seed(Alg :: alg(), {integer(), integer(), integer()}) -> state(). -seed(Alg0, S0) -> - State = seed_s(Alg0, S0), - _ = seed_put(State), - State. - --spec seed_s(Alg :: alg(), {integer(), integer(), integer()}) -> state(). -seed_s(Alg0, S0 = {_, _, _}) -> - {Alg, Seed} = mk_alg(Alg0), - AS = Seed(S0), - {Alg, AS}. - -%%% uniform/0, uniform/1, uniform_s/1, uniform_s/2 are all -%%% uniformly distributed random numbers. - -%% uniform/0: returns a random float X where 0.0 < X < 1.0, -%% updating the state in the process dictionary. - --spec uniform() -> X::float(). -uniform() -> - {X, Seed} = uniform_s(seed_get()), - _ = seed_put(Seed), - X. - -%% uniform/1: given an integer N >= 1, -%% uniform/1 returns a random integer X where 1 =< X =< N, -%% updating the state in the process dictionary. - --spec uniform(N :: pos_integer()) -> X::pos_integer(). -uniform(N) -> - {X, Seed} = uniform_s(N, seed_get()), - _ = seed_put(Seed), - X. - -%% uniform_s/1: given a state, uniform_s/1 -%% returns a random float X where 0.0 < X < 1.0, -%% and a new state. - --spec uniform_s(state()) -> {X::float(), NewS :: state()}. -uniform_s(State = {#{uniform:=Uniform}, _}) -> - Uniform(State). - -%% uniform_s/2: given an integer N >= 1 and a state, uniform_s/2 -%% uniform_s/2 returns a random integer X where 1 =< X =< N, -%% and a new state. - --spec uniform_s(N::pos_integer(), state()) -> {X::pos_integer(), NewS::state()}. -uniform_s(N, State = {#{uniform_n:=Uniform, max:=Max}, _}) - when 0 < N, N =< Max -> - Uniform(N, State); -uniform_s(N, State0 = {#{uniform:=Uniform}, _}) - when is_integer(N), 0 < N -> - {F, State} = Uniform(State0), - {trunc(F * N) + 1, State}. - -%% normal/0: returns a random float with standard normal distribution -%% updating the state in the process dictionary. - --spec normal() -> float(). -normal() -> - {X, Seed} = normal_s(seed_get()), - _ = seed_put(Seed), - X. - -%% normal_s/1: returns a random float with standard normal distribution -%% The Ziggurat Method for generating random variables - Marsaglia and Tsang -%% Paper and reference code: http://www.jstatsoft.org/v05/i08/ - --spec normal_s(state()) -> {float(), NewS :: state()}. -normal_s(State0) -> - {Sign, R, State} = get_52(State0), - Idx = R band 16#FF, - Idx1 = Idx+1, - {Ki, Wi} = normal_kiwi(Idx1), - X = R * Wi, - case R < Ki of - %% Fast path 95% of the time - true when Sign =:= 0 -> {X, State}; - true -> {-X, State}; - %% Slow path - false when Sign =:= 0 -> normal_s(Idx, Sign, X, State); - false -> normal_s(Idx, Sign, -X, State) - end. - -%% ===================================================================== -%% Internal functions - --define(UINT21MASK, 16#00000000001fffff). --define(UINT32MASK, 16#00000000ffffffff). --define(UINT33MASK, 16#00000001ffffffff). --define(UINT39MASK, 16#0000007fffffffff). --define(UINT58MASK, 16#03ffffffffffffff). --define(UINT64MASK, 16#ffffffffffffffff). - --type uint64() :: 0..16#ffffffffffffffff. --type uint58() :: 0..16#03ffffffffffffff. - --spec seed_put(state()) -> undefined | state(). -seed_put(Seed) -> - put(?SEED_DICT, Seed). - -seed_get() -> - case get(?SEED_DICT) of - undefined -> seed(?DEFAULT_ALG_HANDLER); - Old -> Old % no type checking here - end. - -%% Setup alg record -mk_alg(exs64) -> - {#{type=>exs64, max=>?UINT64MASK, next=>fun exs64_next/1, - uniform=>fun exs64_uniform/1, uniform_n=>fun exs64_uniform/2}, - fun exs64_seed/1}; -mk_alg(exsplus) -> - {#{type=>exsplus, max=>?UINT58MASK, next=>fun exsplus_next/1, - uniform=>fun exsplus_uniform/1, uniform_n=>fun exsplus_uniform/2}, - fun exsplus_seed/1}; -mk_alg(exs1024) -> - {#{type=>exs1024, max=>?UINT64MASK, next=>fun exs1024_next/1, - uniform=>fun exs1024_uniform/1, uniform_n=>fun exs1024_uniform/2}, - fun exs1024_seed/1}. - -%% ===================================================================== -%% exs64 PRNG: Xorshift64* -%% Algorithm by Sebastiano Vigna -%% Reference URL: http://xorshift.di.unimi.it/ -%% ===================================================================== - --type exs64_state() :: uint64(). - -exs64_seed({A1, A2, A3}) -> - {V1, _} = exs64_next(((A1 band ?UINT32MASK) * 4294967197 + 1)), - {V2, _} = exs64_next(((A2 band ?UINT32MASK) * 4294967231 + 1)), - {V3, _} = exs64_next(((A3 band ?UINT32MASK) * 4294967279 + 1)), - ((V1 * V2 * V3) rem (?UINT64MASK - 1)) + 1. - -%% Advance xorshift64* state for one step and generate 64bit unsigned integer --spec exs64_next(exs64_state()) -> {uint64(), exs64_state()}. -exs64_next(R) -> - R1 = R bxor (R bsr 12), - R2 = R1 bxor ((R1 band ?UINT39MASK) bsl 25), - R3 = R2 bxor (R2 bsr 27), - {(R3 * 2685821657736338717) band ?UINT64MASK, R3}. - -exs64_uniform({Alg, R0}) -> - {V, R1} = exs64_next(R0), - {V / 18446744073709551616, {Alg, R1}}. - -exs64_uniform(Max, {Alg, R}) -> - {V, R1} = exs64_next(R), - {(V rem Max) + 1, {Alg, R1}}. - -%% ===================================================================== -%% exsplus PRNG: Xorshift116+ -%% Algorithm by Sebastiano Vigna -%% Reference URL: http://xorshift.di.unimi.it/ -%% 58 bits fits into an immediate on 64bits erlang and is thus much faster. -%% Modification of the original Xorshift128+ algorithm to 116 -%% by Sebastiano Vigna, a lot of thanks for his help and work. -%% ===================================================================== --type exsplus_state() :: nonempty_improper_list(uint58(), uint58()). - -exsplus_seed({A1, A2, A3}) -> - {_, R1} = exsplus_next([(((A1 * 4294967197) + 1) band ?UINT58MASK)| - (((A2 * 4294967231) + 1) band ?UINT58MASK)]), - {_, R2} = exsplus_next([(((A3 * 4294967279) + 1) band ?UINT58MASK)| - tl(R1)]), - R2. - -%% Advance xorshift116+ state for one step and generate 58bit unsigned integer --spec exsplus_next(exsplus_state()) -> {uint58(), exsplus_state()}. -exsplus_next([S1|S0]) -> - %% Note: members s0 and s1 are swapped here - S11 = (S1 bxor (S1 bsl 24)) band ?UINT58MASK, - S12 = S11 bxor S0 bxor (S11 bsr 11) bxor (S0 bsr 41), - {(S0 + S12) band ?UINT58MASK, [S0|S12]}. - -exsplus_uniform({Alg, R0}) -> - {I, R1} = exsplus_next(R0), - {I / (?UINT58MASK+1), {Alg, R1}}. - -exsplus_uniform(Max, {Alg, R}) -> - {V, R1} = exsplus_next(R), - {(V rem Max) + 1, {Alg, R1}}. - -%% ===================================================================== -%% exs1024 PRNG: Xorshift1024* -%% Algorithm by Sebastiano Vigna -%% Reference URL: http://xorshift.di.unimi.it/ -%% ===================================================================== - --type exs1024_state() :: {list(uint64()), list(uint64())}. - -exs1024_seed({A1, A2, A3}) -> - B1 = (((A1 band ?UINT21MASK) + 1) * 2097131) band ?UINT21MASK, - B2 = (((A2 band ?UINT21MASK) + 1) * 2097133) band ?UINT21MASK, - B3 = (((A3 band ?UINT21MASK) + 1) * 2097143) band ?UINT21MASK, - {exs1024_gen1024((B1 bsl 43) bor (B2 bsl 22) bor (B3 bsl 1) bor 1), - []}. - -%% Generate a list of 16 64-bit element list -%% of the xorshift64* random sequence -%% from a given 64-bit seed. -%% Note: dependent on exs64_next/1 --spec exs1024_gen1024(uint64()) -> list(uint64()). -exs1024_gen1024(R) -> - exs1024_gen1024(16, R, []). - -exs1024_gen1024(0, _, L) -> - L; -exs1024_gen1024(N, R, L) -> - {X, R2} = exs64_next(R), - exs1024_gen1024(N - 1, R2, [X|L]). - -%% Calculation of xorshift1024*. -%% exs1024_calc(S0, S1) -> {X, NS1}. -%% X: random number output --spec exs1024_calc(uint64(), uint64()) -> {uint64(), uint64()}. -exs1024_calc(S0, S1) -> - S11 = S1 bxor ((S1 band ?UINT33MASK) bsl 31), - S12 = S11 bxor (S11 bsr 11), - S01 = S0 bxor (S0 bsr 30), - NS1 = S01 bxor S12, - {(NS1 * 1181783497276652981) band ?UINT64MASK, NS1}. - -%% Advance xorshift1024* state for one step and generate 64bit unsigned integer --spec exs1024_next(exs1024_state()) -> {uint64(), exs1024_state()}. -exs1024_next({[S0,S1|L3], RL}) -> - {X, NS1} = exs1024_calc(S0, S1), - {X, {[NS1|L3], [S0|RL]}}; -exs1024_next({[H], RL}) -> - NL = [H|lists:reverse(RL)], - exs1024_next({NL, []}). - -exs1024_uniform({Alg, R0}) -> - {V, R1} = exs1024_next(R0), - {V / 18446744073709551616, {Alg, R1}}. - -exs1024_uniform(Max, {Alg, R}) -> - {V, R1} = exs1024_next(R), - {(V rem Max) + 1, {Alg, R1}}. - -%% ===================================================================== -%% Ziggurat cont -%% ===================================================================== --define(NOR_R, 3.6541528853610087963519472518). --define(NOR_INV_R, 1/?NOR_R). - -%% return a {sign, Random51bits, State} -get_52({Alg=#{next:=Next}, S0}) -> - {Int,S1} = Next(S0), - {((1 bsl 51) band Int), Int band ((1 bsl 51)-1), {Alg, S1}}. - -%% Slow path -normal_s(0, Sign, X0, State0) -> - {U0, S1} = uniform_s(State0), - X = -?NOR_INV_R*math:log(U0), - {U1, S2} = uniform_s(S1), - Y = -math:log(U1), - case Y+Y > X*X of - false -> - normal_s(0, Sign, X0, S2); - true when Sign =:= 0 -> - {?NOR_R + X, S2}; - true -> - {-?NOR_R - X, S2} - end; -normal_s(Idx, _Sign, X, State0) -> - Fi2 = normal_fi(Idx+1), - {U0, S1} = uniform_s(State0), - case ((normal_fi(Idx) - Fi2)*U0 + Fi2) < math:exp(-0.5*X*X) of - true -> {X, S1}; - false -> normal_s(S1) - end. - -%% Tables for generating normal_s -%% ki is zipped with wi (slightly faster) -normal_kiwi(Indx) -> - element(Indx, - {{2104047571236786,1.736725412160263e-15}, {0,9.558660351455634e-17}, - {1693657211986787,1.2708704834810623e-16},{1919380038271141,1.4909740962495474e-16}, - {2015384402196343,1.6658733631586268e-16},{2068365869448128,1.8136120810119029e-16}, - {2101878624052573,1.9429720153135588e-16},{2124958784102998,2.0589500628482093e-16}, - {2141808670795147,2.1646860576895422e-16},{2154644611568301,2.2622940392218116e-16}, - {2164744887587275,2.353271891404589e-16},{2172897953696594,2.438723455742877e-16}, - {2179616279372365,2.5194879829274225e-16},{2185247251868649,2.5962199772528103e-16}, - {2190034623107822,2.6694407473648285e-16},{2194154434521197,2.7395729685142446e-16}, - {2197736978774660,2.8069646002484804e-16},{2200880740891961,2.871905890411393e-16}, - {2203661538010620,2.9346417484728883e-16},{2206138681109102,2.9953809336782113e-16}, - {2208359231806599,3.054303000719244e-16},{2210361007258210,3.111563633892157e-16}, - {2212174742388539,3.1672988018581815e-16},{2213825672704646,3.2216280350549905e-16}, - {2215334711002614,3.274657040793975e-16},{2216719334487595,3.326479811684171e-16}, - {2217994262139172,3.377180341735323e-16},{2219171977965032,3.4268340353119356e-16}, - {2220263139538712,3.475508873172976e-16},{2221276900117330,3.523266384600203e-16}, - {2222221164932930,3.5701624633953494e-16},{2223102796829069,3.616248057159834e-16}, - {2223927782546658,3.661569752965354e-16},{2224701368170060,3.7061702777236077e-16}, - {2225428170204312,3.75008892787478e-16},{2226112267248242,3.7933619401549554e-16}, - {2226757276105256,3.836022812967728e-16},{2227366415328399,3.8781025861250247e-16}, - {2227942558554684,3.919630085325768e-16},{2228488279492521,3.9606321366256378e-16}, - {2229005890047222,4.001133755254669e-16},{2229497472775193,4.041158312414333e-16}, - {2229964908627060,4.080727683096045e-16},{2230409900758597,4.119862377480744e-16}, - {2230833995044585,4.1585816580828064e-16},{2231238597816133,4.1969036444740733e-16}, - {2231624991250191,4.234845407152071e-16},{2231994346765928,4.272423051889976e-16}, - {2232347736722750,4.309651795716294e-16},{2232686144665934,4.346546035512876e-16}, - {2233010474325959,4.383119410085457e-16},{2233321557544881,4.4193848564470665e-16}, - {2233620161276071,4.455354660957914e-16},{2233906993781271,4.491040505882875e-16}, - {2234182710130335,4.52645351185714e-16},{2234447917093496,4.561604276690038e-16}, - {2234703177503020,4.596502910884941e-16},{2234949014150181,4.631159070208165e-16}, - {2235185913274316,4.665581985600875e-16},{2235414327692884,4.699780490694195e-16}, - {2235634679614920,4.733763047158324e-16},{2235847363174595,4.767537768090853e-16}, - {2236052746716837,4.8011124396270155e-16},{2236251174862869,4.834494540935008e-16}, - {2236442970379967,4.867691262742209e-16},{2236628435876762,4.900709524522994e-16}, - {2236807855342765,4.933555990465414e-16},{2236981495548562,4.966237084322178e-16}, - {2237149607321147,4.998759003240909e-16},{2237312426707209,5.031127730659319e-16}, - {2237470176035652,5.0633490483427195e-16},{2237623064889403,5.095428547633892e-16}, - {2237771290995388,5.127371639978797e-16},{2237915041040597,5.159183566785736e-16}, - {2238054491421305,5.190869408670343e-16},{2238189808931712,5.222434094134042e-16}, - {2238321151397660,5.253882407719454e-16},{2238448668260432,5.285218997682382e-16}, - {2238572501115169,5.316448383216618e-16},{2238692784207942,5.34757496126473e-16}, - {2238809644895133,5.378603012945235e-16},{2238923204068402,5.409536709623993e-16}, - {2239033576548190,5.440380118655467e-16},{2239140871448443,5.471137208817361e-16}, - {2239245192514958,5.501811855460336e-16},{2239346638439541,5.532407845392784e-16}, - {2239445303151952,5.56292888151909e-16},{2239541276091442,5.593378587248462e-16}, - {2239634642459498,5.623760510690043e-16},{2239725483455293,5.65407812864896e-16}, - {2239813876495186,5.684334850436814e-16},{2239899895417494,5.714534021509204e-16}, - {2239983610673676,5.744678926941961e-16},{2240065089506935,5.774772794756965e-16}, - {2240144396119183,5.804818799107686e-16},{2240221591827230,5.834820063333892e-16}, - {2240296735208969,5.864779662894365e-16},{2240369882240293,5.894700628185872e-16}, - {2240441086423386,5.924585947256134e-16},{2240510398907004,5.95443856841806e-16}, - {2240577868599305,5.984261402772028e-16},{2240643542273726,6.014057326642664e-16}, - {2240707464668391,6.043829183936125e-16},{2240769678579486,6.073579788423606e-16}, - {2240830224948980,6.103311925956439e-16},{2240889142947082,6.133028356617911e-16}, - {2240946470049769,6.162731816816596e-16},{2241002242111691,6.192425021325847e-16}, - {2241056493434746,6.222110665273788e-16},{2241109256832602,6.251791426088e-16}, - {2241160563691400,6.281469965398895e-16},{2241210444026879,6.311148930905604e-16}, - {2241258926538122,6.34083095820806e-16},{2241306038658137,6.370518672608815e-16}, - {2241351806601435,6.400214690888025e-16},{2241396255408788,6.429921623054896e-16}, - {2241439408989313,6.459642074078832e-16},{2241481290160038,6.489378645603397e-16}, - {2241521920683062,6.519133937646159e-16},{2241561321300462,6.548910550287415e-16}, - {2241599511767028,6.578711085350741e-16},{2241636510880960,6.608538148078259e-16}, - {2241672336512612,6.638394348803506e-16},{2241707005631362,6.668282304624746e-16}, - {2241740534330713,6.698204641081558e-16},{2241772937851689,6.728163993837531e-16}, - {2241804230604585,6.758163010371901e-16},{2241834426189161,6.78820435168298e-16}, - {2241863537413311,6.818290694006254e-16},{2241891576310281,6.848424730550038e-16}, - {2241918554154466,6.878609173251664e-16},{2241944481475843,6.908846754557169e-16}, - {2241969368073071,6.939140229227569e-16},{2241993223025298,6.969492376174829e-16}, - {2242016054702685,6.999906000330764e-16},{2242037870775710,7.030383934552151e-16}, - {2242058678223225,7.060929041565482e-16},{2242078483339331,7.091544215954873e-16}, - {2242097291739040,7.122232386196779e-16},{2242115108362774,7.152996516745303e-16}, - {2242131937479672,7.183839610172063e-16},{2242147782689725,7.214764709364707e-16}, - {2242162646924736,7.245774899788387e-16},{2242176532448092,7.276873311814693e-16}, - {2242189440853337,7.308063123122743e-16},{2242201373061537,7.339347561177405e-16}, - {2242212329317416,7.370729905789831e-16},{2242222309184237,7.4022134917658e-16}, - {2242231311537397,7.433801711647648e-16},{2242239334556717,7.465498018555889e-16}, - {2242246375717369,7.497305929136979e-16},{2242252431779415,7.529229026624058e-16}, - {2242257498775893,7.561270964017922e-16},{2242261571999416,7.5934354673958895e-16}, - {2242264645987196,7.625726339356756e-16},{2242266714504453,7.658147462610487e-16}, - {2242267770526109,7.690702803721919e-16},{2242267806216711,7.723396417018299e-16}, - {2242266812908462,7.756232448671174e-16},{2242264781077289,7.789215140963852e-16}, - {2242261700316818,7.822348836756411e-16},{2242257559310145,7.855637984161084e-16}, - {2242252345799276,7.889087141441755e-16},{2242246046552082,7.922700982152271e-16}, - {2242238647326615,7.956484300529366e-16},{2242230132832625,7.99044201715713e-16}, - {2242220486690076,8.024579184921259e-16},{2242209691384458,8.058900995272657e-16}, - {2242197728218684,8.093412784821501e-16},{2242184577261310,8.128120042284501e-16}, - {2242170217290819,8.163028415809877e-16},{2242154625735679,8.198143720706533e-16}, - {2242137778609839,8.23347194760605e-16},{2242119650443327,8.26901927108847e-16}, - {2242100214207556,8.304792058805374e-16},{2242079441234906,8.340796881136629e-16}, - {2242057301132135,8.377040521420222e-16},{2242033761687079,8.413529986798028e-16}, - {2242008788768107,8.450272519724097e-16},{2241982346215682,8.487275610186155e-16}, - {2241954395725356,8.524547008695596e-16},{2241924896721443,8.562094740106233e-16}, - {2241893806220517,8.599927118327665e-16},{2241861078683830,8.638052762005259e-16}, - {2241826665857598,8.676480611245582e-16},{2241790516600041,8.715219945473698e-16}, - {2241752576693881,8.754280402517175e-16},{2241712788642916,8.793671999021043e-16}, - {2241671091451078,8.833405152308408e-16},{2241627420382235,8.873490703813135e-16}, - {2241581706698773,8.913939944224086e-16},{2241533877376767,8.954764640495068e-16}, - {2241483854795281,8.9959770648911e-16},{2241431556397035,9.037590026260118e-16}, - {2241376894317345,9.079616903740068e-16},{2241319774977817,9.122071683134846e-16}, - {2241260098640860,9.164968996219135e-16},{2241197758920538,9.208324163262308e-16}, - {2241132642244704,9.252153239095693e-16},{2241064627262652,9.296473063086417e-16}, - {2240993584191742,9.341301313425265e-16},{2240919374095536,9.38665656618666e-16}, - {2240841848084890,9.432558359676707e-16},{2240760846432232,9.479027264651738e-16}, - {2240676197587784,9.526084961066279e-16},{2240587717084782,9.57375432209745e-16}, - {2240495206318753,9.622059506294838e-16},{2240398451183567,9.671026058823054e-16}, - {2240297220544165,9.720681022901626e-16},{2240191264522612,9.771053062707209e-16}, - {2240080312570155,9.822172599190541e-16},{2239964071293331,9.874071960480671e-16}, - {2239842221996530,9.926785548807976e-16},{2239714417896699,9.980350026183645e-16}, - {2239580280957725,1.003480452143618e-15},{2239439398282193,1.0090190861637457e-15}, - {2239291317986196,1.0146553831467086e-15},{2239135544468203,1.0203941464683124e-15}, - {2238971532964979,1.0262405372613567e-15},{2238798683265269,1.0322001115486456e-15}, - {2238616332424351,1.03827886235154e-15},{2238423746288095,1.044483267600047e-15}, - {2238220109591890,1.0508203448355195e-15},{2238004514345216,1.057297713900989e-15}, - {2237775946143212,1.06392366906768e-15},{2237533267957822,1.0707072623632994e-15}, - {2237275200846753,1.0776584002668106e-15},{2237000300869952,1.0847879564403425e-15}, - {2236706931309099,1.0921079038149563e-15},{2236393229029147,1.0996314701785628e-15}, - {2236057063479501,1.1073733224935752e-15},{2235695986373246,1.1153497865853155e-15}, - {2235307169458859,1.1235791107110833e-15},{2234887326941578,1.1320817840164846e-15}, - {2234432617919447,1.140880924258278e-15},{2233938522519765,1.1500027537839792e-15}, - {2233399683022677,1.159477189144919e-15},{2232809697779198,1.169338578691096e-15}, - {2232160850599817,1.17962663529558e-15},{2231443750584641,1.190387629928289e-15}, - {2230646845562170,1.2016759392543819e-15},{2229755753817986,1.2135560818666897e-15}, - {2228752329126533,1.2261054417450561e-15},{2227613325162504,1.2394179789163251e-15}, - {2226308442121174,1.2536093926602567e-15},{2224797391720399,1.268824481425501e-15}, - {2223025347823832,1.2852479319096109e-15},{2220915633329809,1.3031206634689985e-15}, - {2218357446087030,1.3227655770195326e-15},{2215184158448668,1.3446300925011171e-15}, - {2211132412537369,1.3693606835128518e-15},{2205758503851065,1.397943667277524e-15}, - {2198248265654987,1.4319989869661328e-15},{2186916352102141,1.4744848603597596e-15}, - {2167562552481814,1.5317872741611144e-15},{2125549880839716,1.6227698675312968e-15}}). - -normal_fi(Indx) -> - element(Indx, - {1.0000000000000000e+00,9.7710170126767082e-01,9.5987909180010600e-01, - 9.4519895344229909e-01,9.3206007595922991e-01,9.1999150503934646e-01, - 9.0872644005213032e-01,8.9809592189834297e-01,8.8798466075583282e-01, - 8.7830965580891684e-01,8.6900868803685649e-01,8.6003362119633109e-01, - 8.5134625845867751e-01,8.4291565311220373e-01,8.3471629298688299e-01, - 8.2672683394622093e-01,8.1892919160370192e-01,8.1130787431265572e-01, - 8.0384948317096383e-01,7.9654233042295841e-01,7.8937614356602404e-01, - 7.8234183265480195e-01,7.7543130498118662e-01,7.6863731579848571e-01, - 7.6195334683679483e-01,7.5537350650709567e-01,7.4889244721915638e-01, - 7.4250529634015061e-01,7.3620759812686210e-01,7.2999526456147568e-01, - 7.2386453346862967e-01,7.1781193263072152e-01,7.1183424887824798e-01, - 7.0592850133275376e-01,7.0009191813651117e-01,6.9432191612611627e-01, - 6.8861608300467136e-01,6.8297216164499430e-01,6.7738803621877308e-01, - 6.7186171989708166e-01,6.6639134390874977e-01,6.6097514777666277e-01, - 6.5561147057969693e-01,6.5029874311081637e-01,6.4503548082082196e-01, - 6.3982027745305614e-01,6.3465179928762327e-01,6.2952877992483625e-01, - 6.2445001554702606e-01,6.1941436060583399e-01,6.1442072388891344e-01, - 6.0946806492577310e-01,6.0455539069746733e-01,5.9968175261912482e-01, - 5.9484624376798689e-01,5.9004799633282545e-01,5.8528617926337090e-01, - 5.8055999610079034e-01,5.7586868297235316e-01,5.7121150673525267e-01, - 5.6658776325616389e-01,5.6199677581452390e-01,5.5743789361876550e-01, - 5.5291049042583185e-01,5.4841396325526537e-01,5.4394773119002582e-01, - 5.3951123425695158e-01,5.3510393238045717e-01,5.3072530440366150e-01, - 5.2637484717168403e-01,5.2205207467232140e-01,5.1775651722975591e-01, - 5.1348772074732651e-01,5.0924524599574761e-01,5.0502866794346790e-01, - 5.0083757512614835e-01,4.9667156905248933e-01,4.9253026364386815e-01, - 4.8841328470545758e-01,4.8432026942668288e-01,4.8025086590904642e-01, - 4.7620473271950547e-01,4.7218153846772976e-01,4.6818096140569321e-01, - 4.6420268904817391e-01,4.6024641781284248e-01,4.5631185267871610e-01, - 4.5239870686184824e-01,4.4850670150720273e-01,4.4463556539573912e-01, - 4.4078503466580377e-01,4.3695485254798533e-01,4.3314476911265209e-01, - 4.2935454102944126e-01,4.2558393133802180e-01,4.2183270922949573e-01, - 4.1810064983784795e-01,4.1438753404089090e-01,4.1069314827018799e-01, - 4.0701728432947315e-01,4.0335973922111429e-01,3.9972031498019700e-01, - 3.9609881851583223e-01,3.9249506145931540e-01,3.8890886001878855e-01, - 3.8534003484007706e-01,3.8178841087339344e-01,3.7825381724561896e-01, - 3.7473608713789086e-01,3.7123505766823922e-01,3.6775056977903225e-01, - 3.6428246812900372e-01,3.6083060098964775e-01,3.5739482014578022e-01, - 3.5397498080007656e-01,3.5057094148140588e-01,3.4718256395679348e-01, - 3.4380971314685055e-01,3.4045225704452164e-01,3.3711006663700588e-01, - 3.3378301583071823e-01,3.3047098137916342e-01,3.2717384281360129e-01, - 3.2389148237639104e-01,3.2062378495690530e-01,3.1737063802991350e-01, - 3.1413193159633707e-01,3.1090755812628634e-01,3.0769741250429189e-01, - 3.0450139197664983e-01,3.0131939610080288e-01,2.9815132669668531e-01, - 2.9499708779996164e-01,2.9185658561709499e-01,2.8872972848218270e-01, - 2.8561642681550159e-01,2.8251659308370741e-01,2.7943014176163772e-01, - 2.7635698929566810e-01,2.7329705406857691e-01,2.7025025636587519e-01, - 2.6721651834356114e-01,2.6419576399726080e-01,2.6118791913272082e-01, - 2.5819291133761890e-01,2.5521066995466168e-01,2.5224112605594190e-01, - 2.4928421241852824e-01,2.4633986350126363e-01,2.4340801542275012e-01, - 2.4048860594050039e-01,2.3758157443123795e-01,2.3468686187232990e-01, - 2.3180441082433859e-01,2.2893416541468023e-01,2.2607607132238020e-01, - 2.2323007576391746e-01,2.2039612748015194e-01,2.1757417672433113e-01, - 2.1476417525117358e-01,2.1196607630703015e-01,2.0917983462112499e-01, - 2.0640540639788071e-01,2.0364274931033485e-01,2.0089182249465656e-01, - 1.9815258654577511e-01,1.9542500351413428e-01,1.9270903690358912e-01, - 1.9000465167046496e-01,1.8731181422380025e-01,1.8463049242679927e-01, - 1.8196065559952254e-01,1.7930227452284767e-01,1.7665532144373500e-01, - 1.7401977008183875e-01,1.7139559563750595e-01,1.6878277480121151e-01, - 1.6618128576448205e-01,1.6359110823236570e-01,1.6101222343751107e-01, - 1.5844461415592431e-01,1.5588826472447920e-01,1.5334316106026283e-01, - 1.5080929068184568e-01,1.4828664273257453e-01,1.4577520800599403e-01, - 1.4327497897351341e-01,1.4078594981444470e-01,1.3830811644855071e-01, - 1.3584147657125373e-01,1.3338602969166913e-01,1.3094177717364430e-01, - 1.2850872227999952e-01,1.2608687022018586e-01,1.2367622820159654e-01, - 1.2127680548479021e-01,1.1888861344290998e-01,1.1651166562561080e-01, - 1.1414597782783835e-01,1.1179156816383801e-01,1.0944845714681163e-01, - 1.0711666777468364e-01,1.0479622562248690e-01,1.0248715894193508e-01, - 1.0018949876880981e-01,9.7903279038862284e-02,9.5628536713008819e-02, - 9.3365311912690860e-02,9.1113648066373634e-02,8.8873592068275789e-02, - 8.6645194450557961e-02,8.4428509570353374e-02,8.2223595813202863e-02, - 8.0030515814663056e-02,7.7849336702096039e-02,7.5680130358927067e-02, - 7.3522973713981268e-02,7.1377949058890375e-02,6.9245144397006769e-02, - 6.7124653827788497e-02,6.5016577971242842e-02,6.2921024437758113e-02, - 6.0838108349539864e-02,5.8767952920933758e-02,5.6710690106202902e-02, - 5.4666461324888914e-02,5.2635418276792176e-02,5.0617723860947761e-02, - 4.8613553215868521e-02,4.6623094901930368e-02,4.4646552251294443e-02, - 4.2684144916474431e-02,4.0736110655940933e-02,3.8802707404526113e-02, - 3.6884215688567284e-02,3.4980941461716084e-02,3.3093219458578522e-02, - 3.1221417191920245e-02,2.9365939758133314e-02,2.7527235669603082e-02, - 2.5705804008548896e-02,2.3902203305795882e-02,2.2117062707308864e-02, - 2.0351096230044517e-02,1.8605121275724643e-02,1.6880083152543166e-02, - 1.5177088307935325e-02,1.3497450601739880e-02,1.1842757857907888e-02, - 1.0214971439701471e-02,8.6165827693987316e-03,7.0508754713732268e-03, - 5.5224032992509968e-03,4.0379725933630305e-03,2.6090727461021627e-03, - 1.2602859304985975e-03}). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/random.erl erlang-17.3-dfsg/lib/stdlib/src/random.erl --- erlang-18.2-dfsg/lib/stdlib/src/random.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/random.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -58,17 +57,11 @@ %% seed({A1, A2, A3}) %% Seed random number generation --spec seed(SValue) -> 'undefined' | ran() when - SValue :: {A1, A2, A3} | integer(), +-spec seed({A1, A2, A3}) -> 'undefined' | ran() when A1 :: integer(), A2 :: integer(), A3 :: integer(). -seed(Int) when is_integer(Int) -> - A1 = (Int bsr 16) band 16#fffffff, - A2 = Int band 16#ffffff, - A3 = (Int bsr 36) bor (A2 bsr 16), - seed(A1, A2, A3); seed({A1, A2, A3}) -> seed(A1, A2, A3). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/re.erl erlang-17.3-dfsg/lib/stdlib/src/re.erl --- erlang-18.2-dfsg/lib/stdlib/src/re.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/re.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -132,9 +131,8 @@ split(Subject,RE,Options) -> try - {NewOpt,Convert,Limit,Strip,Group} = - process_split_params(Options,iodata,-1,false,false), - Unicode = check_for_unicode(RE, Options), + {NewOpt,Convert,Unicode,Limit,Strip,Group} = + process_split_params(Options,iodata,false,-1,false,false), FlatSubject = to_binary(Subject, Unicode), case compile_split(RE,NewOpt) of {error,_Err} -> @@ -325,8 +323,8 @@ replace(Subject,RE,Replacement,Options) -> try - {NewOpt,Convert} = process_repl_params(Options,iodata), - Unicode = check_for_unicode(RE, Options), + {NewOpt,Convert,Unicode} = + process_repl_params(Options,iodata,false), FlatSubject = to_binary(Subject, Unicode), FlatReplacement = to_binary(Replacement, Unicode), IoList = do_replace(FlatSubject,Subject,RE,FlatReplacement,NewOpt), @@ -368,59 +366,65 @@ apply_mlist(FlatSubject,Replacement,[Slist]) end. -process_repl_params([],Convert) -> - {[],Convert}; -process_repl_params([report_errors|_],_) -> +process_repl_params([],Convert,Unicode) -> + {[],Convert,Unicode}; +process_repl_params([unicode|T],C,_U) -> + {NT,NC,NU} = process_repl_params(T,C,true), + {[unicode|NT],NC,NU}; +process_repl_params([report_errors|_],_,_) -> throw(badopt); -process_repl_params([{capture,_,_}|_],_) -> +process_repl_params([{capture,_,_}|_],_,_) -> throw(badopt); -process_repl_params([{capture,_}|_],_) -> +process_repl_params([{capture,_}|_],_,_) -> throw(badopt); -process_repl_params([{return,iodata}|T],_C) -> - process_repl_params(T,iodata); -process_repl_params([{return,list}|T],_C) -> - process_repl_params(T,list); -process_repl_params([{return,binary}|T],_C) -> - process_repl_params(T,binary); -process_repl_params([{return,_}|_],_) -> +process_repl_params([{return,iodata}|T],_C,U) -> + process_repl_params(T,iodata,U); +process_repl_params([{return,list}|T],_C,U) -> + process_repl_params(T,list,U); +process_repl_params([{return,binary}|T],_C,U) -> + process_repl_params(T,binary,U); +process_repl_params([{return,_}|_],_,_) -> throw(badopt); -process_repl_params([H|T],C) -> - {NT,NC} = process_repl_params(T,C), - {[H|NT],NC}. - -process_split_params([],Convert,Limit,Strip,Group) -> - {[],Convert,Limit,Strip,Group}; -process_split_params([trim|T],C,_L,_S,G) -> - process_split_params(T,C,-1,true,G); -process_split_params([{parts,0}|T],C,_L,_S,G) -> - process_split_params(T,C,-1,true,G); -process_split_params([{parts,N}|T],C,_L,_S,G) when is_integer(N), N >= 1 -> - process_split_params(T,C,N-1,false,G); -process_split_params([{parts,infinity}|T],C,_L,_S,G) -> - process_split_params(T,C,-1,false,G); -process_split_params([{parts,_}|_],_,_,_,_) -> +process_repl_params([H|T],C,U) -> + {NT,NC,NU} = process_repl_params(T,C,U), + {[H|NT],NC,NU}. + +process_split_params([],Convert,Unicode,Limit,Strip,Group) -> + {[],Convert,Unicode,Limit,Strip,Group}; +process_split_params([unicode|T],C,_U,L,S,G) -> + {NT,NC,NU,NL,NS,NG} = process_split_params(T,C,true,L,S,G), + {[unicode|NT],NC,NU,NL,NS,NG}; +process_split_params([trim|T],C,U,_L,_S,G) -> + process_split_params(T,C,U,-1,true,G); +process_split_params([{parts,0}|T],C,U,_L,_S,G) -> + process_split_params(T,C,U,-1,true,G); +process_split_params([{parts,N}|T],C,U,_L,_S,G) when is_integer(N), N >= 1 -> + process_split_params(T,C,U,N-1,false,G); +process_split_params([{parts,infinity}|T],C,U,_L,_S,G) -> + process_split_params(T,C,U,-1,false,G); +process_split_params([{parts,_}|_],_,_,_,_,_) -> throw(badopt); -process_split_params([group|T],C,L,S,_G) -> - process_split_params(T,C,L,S,true); -process_split_params([global|_],_,_,_,_) -> +process_split_params([group|T],C,U,L,S,_G) -> + process_split_params(T,C,U,L,S,true); +process_split_params([global|_],_,_,_,_,_) -> throw(badopt); -process_split_params([report_errors|_],_,_,_,_) -> +process_split_params([report_errors|_],_,_,_,_,_) -> throw(badopt); -process_split_params([{capture,_,_}|_],_,_,_,_) -> +process_split_params([{capture,_,_}|_],_,_,_,_,_) -> throw(badopt); -process_split_params([{capture,_}|_],_,_,_,_) -> +process_split_params([{capture,_}|_],_,_,_,_,_) -> throw(badopt); -process_split_params([{return,iodata}|T],_C,L,S,G) -> - process_split_params(T,iodata,L,S,G); -process_split_params([{return,list}|T],_C,L,S,G) -> - process_split_params(T,list,L,S,G); -process_split_params([{return,binary}|T],_C,L,S,G) -> - process_split_params(T,binary,L,S,G); -process_split_params([{return,_}|_],_,_,_,_) -> +process_split_params([{return,iodata}|T],_C,U,L,S,G) -> + process_split_params(T,iodata,U,L,S,G); +process_split_params([{return,list}|T],_C,U,L,S,G) -> + process_split_params(T,list,U,L,S,G); +process_split_params([{return,binary}|T],_C,U,L,S,G) -> + process_split_params(T,binary,U,L,S,G); +process_split_params([{return,_}|_],_,_,_,_,_) -> throw(badopt); -process_split_params([H|T],C,L,S,G) -> - {NT,NC,NL,NS,NG} = process_split_params(T,C,L,S,G), - {[H|NT],NC,NL,NS,NG}. +process_split_params([H|T],C,U,L,S,G) -> + {NT,NC,NU,NL,NS,NG} = process_split_params(T,C,U,L,S,G), + {[H|NT],NC,NU,NL,NS,NG}. apply_mlist(Subject,Replacement,Mlist) -> do_mlist(Subject,Subject,0,precomp_repl(Replacement), Mlist). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/sets.erl erlang-17.3-dfsg/lib/stdlib/src/sets.erl --- erlang-18.2-dfsg/lib/stdlib/src/sets.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/sets.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -71,7 +70,7 @@ segs :: segs(_) % Segments }). --type set() :: set(_). +-opaque set() :: set(_). -opaque set(Element) :: #set{segs :: segs(Element)}. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/shell_default.erl erlang-17.3-dfsg/lib/stdlib/src/shell_default.erl --- erlang-18.2-dfsg/lib/stdlib/src/shell_default.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/shell_default.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,7 +23,7 @@ -module(shell_default). -export([help/0,lc/1,c/1,c/2,nc/1,nl/1,l/1,i/0,pid/3,i/3,m/0,m/1, - memory/0,memory/1,uptime/0, + memory/0,memory/1, erlangrc/1,bi/1, regs/0, flush/0,pwd/0,ls/0,ls/1,cd/1, y/1, y/2, xm/1, bt/1, q/0, @@ -93,7 +92,6 @@ pwd() -> c:pwd(). q() -> c:q(). regs() -> c:regs(). -uptime() -> c:uptime(). xm(Mod) -> c:xm(Mod). y(File) -> c:y(File). y(File, Opts) -> c:y(File, Opts). diff -Nru erlang-18.2-dfsg/lib/stdlib/src/shell.erl erlang-17.3-dfsg/lib/stdlib/src/shell.erl --- erlang-18.2-dfsg/lib/stdlib/src/shell.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/shell.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,7 +22,7 @@ -export([whereis_evaluator/0, whereis_evaluator/1]). -export([start_restricted/1, stop_restricted/0]). -export([local_allowed/3, non_local_allowed/3]). --export([catch_exception/1, prompt_func/1, strings/1]). +-export([prompt_func/1, strings/1]). -define(LINEMAX, 30). -define(CHAR_MAX, 60). @@ -315,8 +314,7 @@ case get_prompt_func() of {M,F} -> L = [{history,N}], - A = erl_anno:new(1), - C = {call,A,{remote,A,{atom,A,M},{atom,A,F}},[{value,A,L}]}, + C = {call,1,{remote,1,{atom,1,M},{atom,1,F}},[{value,1,L}]}, {V,Eval,Bs,Ds} = shell_cmd([C], Eval0, Bs0, RT, Ds0, pmt), {Eval,Bs,Ds,case V of {pmt,Val} -> @@ -418,7 +416,7 @@ {_,undefined,_} -> no_command(N); {Ces,V,CommandN} when is_list(Ces) -> - {value,erl_anno:new(CommandN),V} + {value,CommandN,V} end; expand_expr({call,L,F,Args}, C) -> {call,L,expand_expr(F, C),expand_exprs(Args, C)}; @@ -903,7 +901,7 @@ {atom,Line,ok}; prep_check({value,_CommandN,_Val}) -> %% erl_lint cannot handle the history expansion {value,_,_}. - {atom,a0(),ok}; + {atom,0,ok}; prep_check(T) when is_tuple(T) -> list_to_tuple(prep_check(tuple_to_list(T))); prep_check([E | Es]) -> @@ -915,7 +913,7 @@ E0; expand_records(UsedRecords, E0) -> RecordDefs = [Def || {_Name,Def} <- UsedRecords], - L = erl_anno:new(1), + L = 1, E = prep_rec(E0), Forms = RecordDefs ++ [{function,L,foo,0,[{clause,L,[],[],[E]}]}], [{function,L,foo,0,[{clause,L,[],[],[NE]}]}] = @@ -999,7 +997,12 @@ {value,list_records(record_defs(RT, listify(Recs))),Bs}; local_func(rp, [A], Bs0, _Shell, RT, Lf, Ef) -> {[V],Bs} = expr_list([A], Bs0, Lf, Ef), - Cs = pp(V, _Column=1, _Depth=-1, RT), + Cs = io_lib_pretty:print(V, ([{column, 1}, + {line_length, columns()}, + {depth, -1}, + {max_chars, ?CHAR_MAX}, + {record_print_fun, record_print_fun(RT)}] + ++ enc())), io:requests([{put_chars, unicode, Cs}, nl]), {value,ok,Bs}; local_func(rr, [A], Bs0, _Shell, RT, Lf, Ef) -> @@ -1317,15 +1320,13 @@ case erl_eval:fun_data(Val) of {fun_data,_FBs,FCs0} -> FCs = expand_value(FCs0), % looks nicer - A = a0(), - F = {'fun',A,{clauses,FCs}}, - M = {match,A,{var,A,Name},F}, + F = {'fun',0,{clauses,FCs}}, + M = {match,0,{var,0,Name},F}, io:fwrite(<<"~ts\n">>, [erl_pp:expr(M, enc())]); {named_fun_data,_FBs,FName,FCs0} -> FCs = expand_value(FCs0), % looks nicer - A = a0(), - F = {named_fun,A,FName,FCs}, - M = {match,A,{var,A,Name},F}, + F = {named_fun,0,FName,FCs}, + M = {match,0,{var,0,Name},F}, io:fwrite(<<"~ts\n">>, [erl_pp:expr(M, enc())]); false -> Namel = io_lib:fwrite(<<"~s = ">>, [Name]), @@ -1355,18 +1356,13 @@ %% There is no abstract representation of funs. try_abstract(V, CommandN) -> try erl_parse:abstract(V) - catch - _:_ -> - A = a0(), - {call,A,{atom,A,v},[{integer,A,CommandN}]} + catch _:_ -> {call,0,{atom,0,v},[{integer,0,CommandN}]} end. %% Rather than listing possibly huge results the calls to v/1 are shown. prep_list_commands(E) -> - A = a0(), - substitute_v1(fun({value,Anno,_V}) -> - CommandN = erl_anno:line(Anno), - {call,A,{atom,A,v},[{integer,A,CommandN}]} + substitute_v1(fun({value,CommandN,_V}) -> + {call,0,{atom,0,v},[{integer,0,CommandN}]} end, E). substitute_v1(F, {value,_,_}=Value) -> @@ -1378,9 +1374,6 @@ substitute_v1(_F, E) -> E. -a0() -> - erl_anno:new(0). - check_and_get_history_and_results() -> check_env(shell_history_length), check_env(shell_saved_results), @@ -1392,9 +1385,9 @@ {History, erlang:min(Results, History)}. pp(V, I, RT) -> - pp(V, I, _Depth=?LINEMAX, RT). + pp(V, I, RT, enc()). -pp(V, I, D, RT) -> +pp(V, I, RT, Enc) -> Strings = case application:get_env(stdlib, shell_strings) of {ok, false} -> @@ -1403,10 +1396,10 @@ true end, io_lib_pretty:print(V, ([{column, I}, {line_length, columns()}, - {depth, D}, {max_chars, ?CHAR_MAX}, + {depth, ?LINEMAX}, {max_chars, ?CHAR_MAX}, {strings, Strings}, {record_print_fun, record_print_fun(RT)}] - ++ enc())). + ++ Enc)). columns() -> case io:columns() of diff -Nru erlang-18.2-dfsg/lib/stdlib/src/slave.erl erlang-17.3-dfsg/lib/stdlib/src/slave.erl --- erlang-18.2-dfsg/lib/stdlib/src/slave.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/slave.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -129,7 +128,7 @@ %% {error, {already_running, Name@Host}} -spec start(Host) -> {ok, Node} | {error, Reason} when - Host :: inet:hostname(), + Host :: atom(), Node :: node(), Reason :: timeout | no_rsh | {already_running, Node}. @@ -139,8 +138,8 @@ start(Host, Name, [], no_link). -spec start(Host, Name) -> {ok, Node} | {error, Reason} when - Host :: inet:hostname(), - Name :: atom() | string(), + Host :: atom(), + Name :: atom(), Node :: node(), Reason :: timeout | no_rsh | {already_running, Node}. @@ -148,8 +147,8 @@ start(Host, Name, []). -spec start(Host, Name, Args) -> {ok, Node} | {error, Reason} when - Host :: inet:hostname(), - Name :: atom() | string(), + Host :: atom(), + Name :: atom(), Args :: string(), Node :: node(), Reason :: timeout | no_rsh | {already_running, Node}. @@ -158,7 +157,7 @@ start(Host, Name, Args, no_link). -spec start_link(Host) -> {ok, Node} | {error, Reason} when - Host :: inet:hostname(), + Host :: atom(), Node :: node(), Reason :: timeout | no_rsh | {already_running, Node}. @@ -168,8 +167,8 @@ start(Host, Name, [], self()). -spec start_link(Host, Name) -> {ok, Node} | {error, Reason} when - Host :: inet:hostname(), - Name :: atom() | string(), + Host :: atom(), + Name :: atom(), Node :: node(), Reason :: timeout | no_rsh | {already_running, Node}. @@ -177,8 +176,8 @@ start_link(Host, Name, []). -spec start_link(Host, Name, Args) -> {ok, Node} | {error, Reason} when - Host :: inet:hostname(), - Name :: atom() | string(), + Host :: atom(), + Name :: atom(), Args :: string(), Node :: node(), Reason :: timeout | no_rsh | {already_running, Node}. @@ -211,6 +210,7 @@ Node :: node(). stop(Node) -> +% io:format("stop(~p)~n", [Node]), rpc:call(Node, erlang, halt, []), ok. @@ -229,6 +229,7 @@ Waiter = register_unique_name(0), case mk_cmd(Host, Name, Args, Waiter, Prog) of {ok, Cmd} -> +%% io:format("Command: ~ts~n", [Cmd]), open_port({spawn, Cmd}, [stream]), receive {SlavePid, slave_started} -> diff -Nru erlang-18.2-dfsg/lib/stdlib/src/sofs.erl erlang-17.3-dfsg/lib/stdlib/src/sofs.erl --- erlang-18.2-dfsg/lib/stdlib/src/sofs.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/sofs.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/stdlib.app.src erlang-17.3-dfsg/lib/stdlib/src/stdlib.app.src --- erlang-18.2-dfsg/lib/stdlib/src/stdlib.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/stdlib.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -2,19 +2,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -40,7 +39,6 @@ edlin_expand, epp, eval_bits, - erl_anno, erl_bits, erl_compile, erl_eval, @@ -79,13 +77,13 @@ orddict, ordsets, otp_internal, + pg, pool, proc_lib, proplists, qlc, qlc_pt, queue, - rand, random, re, sets, @@ -105,7 +103,7 @@ dets]}, {applications, [kernel]}, {env, []}, - {runtime_dependencies, ["sasl-2.6","kernel-4.1","erts-7.0","crypto-3.3", + {runtime_dependencies, ["sasl-2.4","kernel-3.0.2","erts-6.2","crypto-3.3", "compiler-5.0"]} ]}. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/stdlib.appup.src erlang-17.3-dfsg/lib/stdlib/src/stdlib.appup.src --- erlang-18.2-dfsg/lib/stdlib/src/stdlib.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/stdlib.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -1,26 +1,27 @@ %% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", %% Up from - max one major revision back - [{<<"2\\.[5-7](\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.* - {<<"2\\.[0-4](\\.[0-9]+)*">>,[restart_new_emulator]}], % 17.0-17.5 + [{<<"2\\.1(\\.[0-9]+)*">>,[restart_new_emulator]}, %% 17.1 + {<<"2\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, %% 17.0 + {<<"1\\.19(\\.[0-9]+)*">>,[restart_new_emulator]}],%% R16 %% Down to - max one major revision back - [{<<"2\\.[5-7](\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.* - {<<"2\\.[0-4](\\.[0-9]+)*">>,[restart_new_emulator]}] % 17.0-17.5 + [{<<"2\\.1(\\.[0-9]+)*">>,[restart_new_emulator]}, %% 17.1 + {<<"2\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, %% 17.0 + {<<"1\\.19(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R16 }. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/string.erl erlang-17.3-dfsg/lib/stdlib/src/string.erl --- erlang-18.2-dfsg/lib/stdlib/src/string.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/string.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -222,47 +221,23 @@ Tokens :: [Token :: nonempty_string()]. tokens(S, Seps) -> - case Seps of - [] -> - case S of - [] -> []; - [_|_] -> [S] - end; - [C] -> - tokens_single_1(reverse(S), C, []); - [_|_] -> - tokens_multiple_1(reverse(S), Seps, []) - end. - -tokens_single_1([Sep|S], Sep, Toks) -> - tokens_single_1(S, Sep, Toks); -tokens_single_1([C|S], Sep, Toks) -> - tokens_single_2(S, Sep, Toks, [C]); -tokens_single_1([], _, Toks) -> - Toks. - -tokens_single_2([Sep|S], Sep, Toks, Tok) -> - tokens_single_1(S, Sep, [Tok|Toks]); -tokens_single_2([C|S], Sep, Toks, Tok) -> - tokens_single_2(S, Sep, Toks, [C|Tok]); -tokens_single_2([], _Sep, Toks, Tok) -> - [Tok|Toks]. + tokens1(S, Seps, []). -tokens_multiple_1([C|S], Seps, Toks) -> +tokens1([C|S], Seps, Toks) -> case member(C, Seps) of - true -> tokens_multiple_1(S, Seps, Toks); - false -> tokens_multiple_2(S, Seps, Toks, [C]) + true -> tokens1(S, Seps, Toks); + false -> tokens2(S, Seps, Toks, [C]) end; -tokens_multiple_1([], _Seps, Toks) -> - Toks. +tokens1([], _Seps, Toks) -> + reverse(Toks). -tokens_multiple_2([C|S], Seps, Toks, Tok) -> +tokens2([C|S], Seps, Toks, Cs) -> case member(C, Seps) of - true -> tokens_multiple_1(S, Seps, [Tok|Toks]); - false -> tokens_multiple_2(S, Seps, Toks, [C|Tok]) + true -> tokens1(S, Seps, [reverse(Cs)|Toks]); + false -> tokens2(S, Seps, Toks, [C|Cs]) end; -tokens_multiple_2([], _Seps, Toks, Tok) -> - [Tok|Toks]. +tokens2([], _Seps, Toks, Cs) -> + reverse([reverse(Cs)|Toks]). -spec chars(Character, Number) -> String when Character :: char(), diff -Nru erlang-18.2-dfsg/lib/stdlib/src/supervisor_bridge.erl erlang-17.3-dfsg/lib/stdlib/src/supervisor_bridge.erl --- erlang-18.2-dfsg/lib/stdlib/src/supervisor_bridge.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/supervisor_bridge.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/supervisor.erl erlang-17.3-dfsg/lib/stdlib/src/supervisor.erl --- erlang-18.2-dfsg/lib/stdlib/src/supervisor.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/supervisor.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -26,7 +25,7 @@ start_child/2, restart_child/2, delete_child/2, terminate_child/2, which_children/1, count_children/1, - check_childspecs/1, get_childspec/2]). + check_childspecs/1]). %% Internal exports -export([init/1, handle_call/3, handle_cast/2, handle_info/2, @@ -35,7 +34,7 @@ %%-------------------------------------------------------------------------- --export_type([sup_flags/0, child_spec/0, startchild_ret/0, strategy/0]). +-export_type([child_spec/0, startchild_ret/0, strategy/0]). %%-------------------------------------------------------------------------- @@ -54,13 +53,7 @@ | {'global', Name :: atom()} | {'via', Module :: module(), Name :: any()} | pid(). --type child_spec() :: #{id => child_id(), % mandatory - start => mfargs(), % mandatory - restart => restart(), % optional - shutdown => shutdown(), % optional - type => worker(), % optional - modules => modules()} % optional - | {Id :: child_id(), +-type child_spec() :: {Id :: child_id(), StartFunc :: mfargs(), Restart :: restart(), Shutdown :: shutdown(), @@ -70,23 +63,6 @@ -type strategy() :: 'one_for_all' | 'one_for_one' | 'rest_for_one' | 'simple_one_for_one'. --type sup_flags() :: #{strategy => strategy(), % optional - intensity => non_neg_integer(), % optional - period => pos_integer()} % optional - | {RestartStrategy :: strategy(), - Intensity :: non_neg_integer(), - Period :: pos_integer()}. - -%%-------------------------------------------------------------------------- -%% Defaults --define(default_flags, #{strategy => one_for_one, - intensity => 1, - period => 5}). --define(default_child_spec, #{restart => permanent, - type => worker}). -%% Default 'shutdown' is 5000 for workers and infinity for supervisors. -%% Default 'modules' is [M], where M comes from the child's start {M,F,A}. - %%-------------------------------------------------------------------------- -record(child, {% pid is undefined when child is not running @@ -120,7 +96,10 @@ -define(is_simple(State), State#state.strategy =:= simple_one_for_one). -callback init(Args :: term()) -> - {ok, {SupFlags :: sup_flags(), [ChildSpec :: child_spec()]}} + {ok, {{RestartStrategy :: strategy(), + MaxR :: non_neg_integer(), + MaxT :: non_neg_integer()}, + [ChildSpec :: child_spec()]}} | ignore. -define(restarting(_Pid_), {restarting,_Pid_}). @@ -199,14 +178,6 @@ terminate_child(Supervisor, Name) -> call(Supervisor, {terminate_child, Name}). --spec get_childspec(SupRef, Id) -> Result when - SupRef :: sup_ref(), - Id :: pid() | child_id(), - Result :: {'ok', child_spec()} | {'error', Error}, - Error :: 'not_found'. -get_childspec(Supervisor, Name) -> - call(Supervisor, {get_childspec, Name}). - -spec which_children(SupRef) -> [{Id,Child,Type,Modules}] when SupRef :: sup_ref(), Id :: child_id() | undefined, @@ -382,7 +353,7 @@ #child{mfargs = {M, F, A}} = Child, Args = A ++ EArgs, case do_start_child_i(M, F, Args) of - {ok, undefined} -> + {ok, undefined} when Child#child.restart_type =:= temporary -> {reply, {ok, undefined}, State}; {ok, Pid} -> NState = save_dynamic_child(Child#child.restart_type, Pid, Args, State), @@ -394,15 +365,6 @@ {reply, What, State} end; -handle_call({start_child, ChildSpec}, _From, State) -> - case check_childspec(ChildSpec) of - {ok, Child} -> - {Resp, NState} = handle_start_child(Child, State), - {reply, Resp, NState}; - What -> - {reply, {error, What}, State} - end; - %% terminate_child for simple_one_for_one can only be done with pid handle_call({terminate_child, Name}, _From, State) when not is_pid(Name), ?is_simple(State) -> @@ -421,10 +383,20 @@ {reply, {error, not_found}, State} end; -%% restart_child request is invalid for simple_one_for_one supervisors -handle_call({restart_child, _Name}, _From, State) when ?is_simple(State) -> +%%% The requests delete_child and restart_child are invalid for +%%% simple_one_for_one supervisors. +handle_call({_Req, _Data}, _From, State) when ?is_simple(State) -> {reply, {error, simple_one_for_one}, State}; +handle_call({start_child, ChildSpec}, _From, State) -> + case check_childspec(ChildSpec) of + {ok, Child} -> + {Resp, NState} = handle_start_child(Child, State), + {reply, Resp, NState}; + What -> + {reply, {error, What}, State} + end; + handle_call({restart_child, Name}, _From, State) -> case get_child(Name, State) of {value, Child} when Child#child.pid =:= undefined -> @@ -446,10 +418,6 @@ {reply, {error, not_found}, State} end; -%% delete_child request is invalid for simple_one_for_one supervisors -handle_call({delete_child, _Name}, _From, State) when ?is_simple(State) -> - {reply, {error, simple_one_for_one}, State}; - handle_call({delete_child, Name}, _From, State) -> case get_child(Name, State) of {value, Child} when Child#child.pid =:= undefined -> @@ -463,14 +431,6 @@ {reply, {error, not_found}, State} end; -handle_call({get_childspec, Name}, _From, State) -> - case get_child(Name, State, ?is_simple(State)) of - {value, Child} -> - {reply, {ok, child_to_spec(Child)}, State}; - false -> - {reply, {error, not_found}, State} - end; - handle_call(which_children, _From, #state{children = [#child{restart_type = temporary, child_type = CT, modules = Mods}]} = @@ -650,11 +610,13 @@ code_change(_, State, _) -> case (State#state.module):init(State#state.args) of {ok, {SupFlags, StartSpec}} -> - case set_flags(SupFlags, State) of - {ok, State1} -> - update_childspec(State1, StartSpec); - {invalid_type, SupFlags} -> - {error, {bad_flags, SupFlags}}; % backwards compatibility + case catch check_flags(SupFlags) of + ok -> + {Strategy, MaxIntensity, Period} = SupFlags, + update_childspec(State#state{strategy = Strategy, + intensity = MaxIntensity, + period = Period}, + StartSpec); Error -> {error, Error} end; @@ -664,6 +626,14 @@ Error end. +check_flags({Strategy, MaxIntensity, Period}) -> + validStrategy(Strategy), + validIntensity(MaxIntensity), + validPeriod(Period), + ok; +check_flags(What) -> + {bad_flags, What}. + update_childspec(State, StartSpec) when ?is_simple(State) -> case check_startspec(StartSpec) of {ok, [Child]} -> @@ -1083,7 +1053,7 @@ {timeout, TRef, kill} -> ?SETS:fold(fun(P, _) -> exit(P, kill) end, ok, Pids), - wait_dynamic_children(Child, Pids, Sz, undefined, EStack) + wait_dynamic_children(Child, Pids, Sz-1, undefined, EStack) end. %%----------------------------------------------------------------- @@ -1218,36 +1188,25 @@ %% Returns: {ok, state()} | Error %%----------------------------------------------------------------- init_state(SupName, Type, Mod, Args) -> - set_flags(Type, #state{name = supname(SupName,Mod), - module = Mod, - args = Args}). - -set_flags(Flags, State) -> - try check_flags(Flags) of - #{strategy := Strategy, intensity := MaxIntensity, period := Period} -> - {ok, State#state{strategy = Strategy, - intensity = MaxIntensity, - period = Period}} - catch - Thrown -> Thrown + case catch init_state1(SupName, Type, Mod, Args) of + {ok, State} -> + {ok, State}; + Error -> + Error end. -check_flags(SupFlags) when is_map(SupFlags) -> - do_check_flags(maps:merge(?default_flags,SupFlags)); -check_flags({Strategy, MaxIntensity, Period}) -> - check_flags(#{strategy => Strategy, - intensity => MaxIntensity, - period => Period}); -check_flags(What) -> - throw({invalid_type, What}). - -do_check_flags(#{strategy := Strategy, - intensity := MaxIntensity, - period := Period} = Flags) -> +init_state1(SupName, {Strategy, MaxIntensity, Period}, Mod, Args) -> validStrategy(Strategy), validIntensity(MaxIntensity), validPeriod(Period), - Flags. + {ok, #state{name = supname(SupName,Mod), + strategy = Strategy, + intensity = MaxIntensity, + period = Period, + module = Mod, + args = Args}}; +init_state1(_SupName, Type, _, _) -> + {invalid_type, Type}. validStrategy(simple_one_for_one) -> true; validStrategy(one_for_one) -> true; @@ -1268,7 +1227,14 @@ %%% ------------------------------------------------------ %%% Check that the children start specification is valid. -%%% Input: [child_spec()] +%%% Shall be a six (6) tuple +%%% {Name, Func, RestartType, Shutdown, ChildType, Modules} +%%% where Name is an atom +%%% Func is {Mod, Fun, Args} == {atom(), atom(), list()} +%%% RestartType is permanent | temporary | transient +%%% Shutdown = integer() > 0 | infinity | brutal_kill +%%% ChildType = supervisor | worker +%%% Modules = [atom()] | dynamic %%% Returns: {ok, [child_rec()]} | Error %%% ------------------------------------------------------ @@ -1278,9 +1244,6 @@ case check_childspec(ChildSpec) of {ok, Child} -> case lists:keymember(Child#child.name, #child.name, Res) of - %% The error message duplicate_child_name is kept for - %% backwards compatibility, although - %% duplicate_child_id would be more correct. true -> {duplicate_child_name, Child#child.name}; false -> check_startspec(T, [Child | Res]) end; @@ -1289,41 +1252,16 @@ check_startspec([], Res) -> {ok, lists:reverse(Res)}. -check_childspec(ChildSpec) when is_map(ChildSpec) -> - catch do_check_childspec(maps:merge(?default_child_spec,ChildSpec)); check_childspec({Name, Func, RestartType, Shutdown, ChildType, Mods}) -> - check_childspec(#{id => Name, - start => Func, - restart => RestartType, - shutdown => Shutdown, - type => ChildType, - modules => Mods}); + catch check_childspec(Name, Func, RestartType, Shutdown, ChildType, Mods); check_childspec(X) -> {invalid_child_spec, X}. -do_check_childspec(#{restart := RestartType, - type := ChildType} = ChildSpec)-> - Name = case ChildSpec of - #{id := N} -> N; - _ -> throw(missing_id) - end, - Func = case ChildSpec of - #{start := F} -> F; - _ -> throw(missing_start) - end, +check_childspec(Name, Func, RestartType, Shutdown, ChildType, Mods) -> validName(Name), validFunc(Func), validRestartType(RestartType), validChildType(ChildType), - Shutdown = case ChildSpec of - #{shutdown := S} -> S; - #{type := worker} -> 5000; - #{type := supervisor} -> infinity - end, - validShutdown(Shutdown), - Mods = case ChildSpec of - #{modules := Ms} -> Ms; - _ -> {M,_,_} = Func, [M] - end, + validShutdown(Shutdown, ChildType), validMods(Mods), {ok, #child{name = Name, mfargs = Func, restart_type = RestartType, shutdown = Shutdown, child_type = ChildType, modules = Mods}}. @@ -1344,11 +1282,11 @@ validRestartType(transient) -> true; validRestartType(RestartType) -> throw({invalid_restart_type, RestartType}). -validShutdown(Shutdown) +validShutdown(Shutdown, _) when is_integer(Shutdown), Shutdown > 0 -> true; -validShutdown(infinity) -> true; -validShutdown(brutal_kill) -> true; -validShutdown(Shutdown) -> throw({invalid_shutdown, Shutdown}). +validShutdown(infinity, _) -> true; +validShutdown(brutal_kill, _) -> true; +validShutdown(Shutdown, _) -> throw({invalid_shutdown, Shutdown}). validMods(dynamic) -> true; validMods(Mods) when is_list(Mods) -> @@ -1361,19 +1299,6 @@ Mods); validMods(Mods) -> throw({invalid_modules, Mods}). -child_to_spec(#child{name = Name, - mfargs = Func, - restart_type = RestartType, - shutdown = Shutdown, - child_type = ChildType, - modules = Mods}) -> - #{id => Name, - start => Func, - restart => RestartType, - shutdown => Shutdown, - type => ChildType, - modules => Mods}. - %%% ------------------------------------------------------ %%% Add a new restart and calculate if the max restart %%% intensity has been reached (in that case the supervisor @@ -1387,7 +1312,7 @@ I = State#state.intensity, P = State#state.period, R = State#state.restarts, - Now = erlang:monotonic_time(1), + Now = erlang:now(), R1 = add_restart([Now|R], Now, P), State1 = State#state{restarts = R1}, case length(R1) of @@ -1407,8 +1332,26 @@ add_restart([], _, _) -> []. -inPeriod(Then, Now, Period) -> - Now =< Then + Period. +inPeriod(Time, Now, Period) -> + case difference(Time, Now) of + T when T > Period -> + false; + _ -> + true + end. + +%% +%% Time = {MegaSecs, Secs, MicroSecs} (NOTE: MicroSecs is ignored) +%% Calculate the time elapsed in seconds between two timestamps. +%% If MegaSecs is equal just subtract Secs. +%% Else calculate the Mega difference and add the Secs difference, +%% note that Secs difference can be negative, e.g. +%% {827, 999999, 676} diff {828, 1, 653753} == > 2 secs. +%% +difference({TimeM, TimeS, _}, {CurM, CurS, _}) when CurM > TimeM -> + ((CurM - TimeM) * 1000000) + (CurS - TimeS); +difference({_, TimeS, _}, {_, CurS, _}) -> + CurS - TimeS. %%% ------------------------------------------------------ %%% Error and progress reporting. @@ -1424,14 +1367,14 @@ extract_child(Child) when is_list(Child#child.pid) -> [{nb_children, length(Child#child.pid)}, - {id, Child#child.name}, + {name, Child#child.name}, {mfargs, Child#child.mfargs}, {restart_type, Child#child.restart_type}, {shutdown, Child#child.shutdown}, {child_type, Child#child.child_type}]; extract_child(Child) -> [{pid, Child#child.pid}, - {id, Child#child.name}, + {name, Child#child.name}, {mfargs, Child#child.mfargs}, {restart_type, Child#child.restart_type}, {shutdown, Child#child.shutdown}, diff -Nru erlang-18.2-dfsg/lib/stdlib/src/sys.erl erlang-17.3-dfsg/lib/stdlib/src/sys.erl --- erlang-18.2-dfsg/lib/stdlib/src/sys.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/sys.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,7 +24,6 @@ get_state/1, get_state/2, replace_state/2, replace_state/3, change_code/4, change_code/5, - terminate/2, terminate/3, log/2, log/3, trace/2, trace/3, statistics/2, statistics/3, log_to_file/2, log_to_file/3, no_debug/1, no_debug/2, install/2, install/3, remove/2, remove/3]). @@ -165,19 +163,6 @@ change_code(Name, Mod, Vsn, Extra, Timeout) -> send_system_msg(Name, {change_code, Mod, Vsn, Extra}, Timeout). --spec terminate(Name, Reason) -> 'ok' when - Name :: name(), - Reason :: term(). -terminate(Name, Reason) -> - send_system_msg(Name, {terminate, Reason}). - --spec terminate(Name, Reason, Timeout) -> 'ok' when - Name :: name(), - Reason :: term(), - Timeout :: timeout(). -terminate(Name, Reason, Timeout) -> - send_system_msg(Name, {terminate, Reason}, Timeout). - %%----------------------------------------------------------------- %% Debug commands %%----------------------------------------------------------------- @@ -313,8 +298,6 @@ {sys, Func, [Name, Arg2]}; mfa(Name, {change_code, Mod, Vsn, Extra}) -> {sys, change_code, [Name, Mod, Vsn, Extra]}; -mfa(Name, {terminate, Reason}) -> - {sys, terminate, [Name, Reason]}; mfa(Name, Atom) -> {sys, Atom, [Name]}. @@ -330,7 +313,7 @@ %% Returns: This function *never* returns! It calls the function %% Module:system_continue(Parent, NDebug, Misc) %% there the process continues the execution or -%% Module:system_terminate(Reason, Parent, Debug, Misc) if +%% Module:system_terminate(Raeson, Parent, Debug, Misc) if %% the process should terminate. %% The Module must export system_continue/3, system_terminate/4 %% and format_status/2 for status information. @@ -356,10 +339,7 @@ suspend_loop(suspended, Parent, Mod, NDebug, NMisc, Hib); {running, Reply, NDebug, NMisc} -> _ = gen:reply(From, Reply), - Mod:system_continue(Parent, NDebug, NMisc); - {{terminating, Reason}, Reply, NDebug, NMisc} -> - _ = gen:reply(From, Reply), - Mod:system_terminate(Reason, Parent, NDebug, NMisc) + Mod:system_continue(Parent, NDebug, NMisc) end. %%----------------------------------------------------------------- @@ -439,8 +419,6 @@ do_cmd(SysState, {debug, What}, _Parent, _Mod, Debug, Misc) -> {Res, NDebug} = debug_cmd(What, Debug), {SysState, Res, NDebug, Misc}; -do_cmd(_, {terminate, Reason}, _Parent, _Mod, Debug, Misc) -> - {{terminating, Reason}, ok, Debug, Misc}; do_cmd(suspended, {change_code, Module, Vsn, Extra}, _Parent, Mod, Debug, Misc) -> {Res, NMisc} = do_change_code(Mod, Module, Vsn, Extra, Misc), diff -Nru erlang-18.2-dfsg/lib/stdlib/src/timer.erl erlang-17.3-dfsg/lib/stdlib/src/timer.erl --- erlang-18.2-dfsg/lib/stdlib/src/timer.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/timer.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -162,11 +161,10 @@ Time :: integer(), Value :: term(). tc(F) -> - T1 = erlang:monotonic_time(), + Before = os:timestamp(), Val = F(), - T2 = erlang:monotonic_time(), - Time = erlang:convert_time_unit(T2 - T1, native, micro_seconds), - {Time, Val}. + After = os:timestamp(), + {now_diff(After, Before), Val}. %% %% Measure the execution time (in microseconds) for Fun(Args). @@ -177,11 +175,10 @@ Time :: integer(), Value :: term(). tc(F, A) -> - T1 = erlang:monotonic_time(), + Before = os:timestamp(), Val = apply(F, A), - T2 = erlang:monotonic_time(), - Time = erlang:convert_time_unit(T2 - T1, native, micro_seconds), - {Time, Val}. + After = os:timestamp(), + {now_diff(After, Before), Val}. %% %% Measure the execution time (in microseconds) for an MFA. @@ -193,11 +190,10 @@ Time :: integer(), Value :: term(). tc(M, F, A) -> - T1 = erlang:monotonic_time(), + Before = os:timestamp(), Val = apply(M, F, A), - T2 = erlang:monotonic_time(), - Time = erlang:convert_time_unit(T2 - T1, native, micro_seconds), - {Time, Val}. + After = os:timestamp(), + {now_diff(After, Before), Val}. %% %% Calculate the time difference (in microseconds) of two @@ -441,8 +437,10 @@ %% %% system_time() -> time in microseconds %% -system_time() -> - erlang:monotonic_time(1000000). +system_time() -> + {M,S,U} = erlang:now(), + 1000000 * (M*1000000 + S) + U. + send([Pid, Msg]) -> Pid ! Msg. diff -Nru erlang-18.2-dfsg/lib/stdlib/src/unicode.erl erlang-17.3-dfsg/lib/stdlib/src/unicode.erl --- erlang-18.2-dfsg/lib/stdlib/src/unicode.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/unicode.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/src/win32reg.erl erlang-17.3-dfsg/lib/stdlib/src/win32reg.erl --- erlang-18.2-dfsg/lib/stdlib/src/win32reg.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/win32reg.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -219,7 +218,12 @@ expand(Rest, [], [C|Result]); expand([$%|Rest], Env0, Result) -> Env = lists:reverse(Env0), - expand(Rest, [], lists:reverse(os:getenv(Env, ""))++Result); + case os:getenv(Env) of + false -> + expand(Rest, [], Result); + Value -> + expand(Rest, [], lists:reverse(Value)++Result) + end; expand([C|Rest], Env, Result) -> expand(Rest, [C|Env], Result); expand([], [], Result) -> diff -Nru erlang-18.2-dfsg/lib/stdlib/src/zip.erl erlang-17.3-dfsg/lib/stdlib/src/zip.erl --- erlang-18.2-dfsg/lib/stdlib/src/zip.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/src/zip.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,7 +24,7 @@ list_dir/1, list_dir/2, table/1, table/2, t/1, tt/1]). -%% unzipping piecemeal +%% unzipping peicemeal -export([openzip_open/1, openzip_open/2, openzip_get/1, openzip_get/2, openzip_t/1, openzip_tt/1, @@ -215,9 +214,7 @@ -type zip_comment() :: #zip_comment{}. -type zip_file() :: #zip_file{}. --opaque handle() :: pid(). - --export_type([create_option/0, filename/0, handle/0]). +-export_type([create_option/0, filename/0]). %% Open a zip archive with options %% @@ -503,7 +500,7 @@ -spec(t(Archive) -> ok when Archive :: file:name() | binary() | ZipHandle, - ZipHandle :: handle()). + ZipHandle :: pid()). t(F) when is_pid(F) -> zip_t(F); t(F) when is_record(F, openzip) -> openzip_t(F); @@ -527,7 +524,7 @@ -spec(tt(Archive) -> ok when Archive :: file:name() | binary() | ZipHandle, - ZipHandle :: handle()). + ZipHandle :: pid()). tt(F) when is_pid(F) -> zip_tt(F); tt(F) when is_record(F, openzip) -> openzip_tt(F); @@ -1117,19 +1114,15 @@ file_name_length = length(Name), extra_field_length = 0}. -server_init(Parent) -> - %% we want to know if our parent dies - process_flag(trap_exit, true), - server_loop(Parent, not_open). %% small, simple, stupid zip-archive server -server_loop(Parent, OpenZip) -> +server_loop(OpenZip) -> receive {From, {open, Archive, Options}} -> case openzip_open(Archive, Options) of {ok, NewOpenZip} -> From ! {self(), {ok, self()}}, - server_loop(Parent, NewOpenZip); + server_loop(NewOpenZip); Error -> From ! {self(), Error} end; @@ -1137,47 +1130,43 @@ From ! {self(), openzip_close(OpenZip)}; {From, get} -> From ! {self(), openzip_get(OpenZip)}, - server_loop(Parent, OpenZip); + server_loop(OpenZip); {From, {get, FileName}} -> From ! {self(), openzip_get(FileName, OpenZip)}, - server_loop(Parent, OpenZip); + server_loop(OpenZip); {From, list_dir} -> From ! {self(), openzip_list_dir(OpenZip)}, - server_loop(Parent, OpenZip); + server_loop(OpenZip); {From, {list_dir, Opts}} -> From ! {self(), openzip_list_dir(OpenZip, Opts)}, - server_loop(Parent, OpenZip); + server_loop(OpenZip); {From, get_state} -> From ! {self(), OpenZip}, - server_loop(Parent, OpenZip); - {'EXIT', Parent, Reason} -> - _ = openzip_close(OpenZip), - exit({parent_died, Reason}); + server_loop(OpenZip); _ -> {error, bad_msg} end. -spec(zip_open(Archive) -> {ok, ZipHandle} | {error, Reason} when Archive :: file:name() | binary(), - ZipHandle :: handle(), + ZipHandle :: pid(), Reason :: term()). zip_open(Archive) -> zip_open(Archive, []). -spec(zip_open(Archive, Options) -> {ok, ZipHandle} | {error, Reason} when Archive :: file:name() | binary(), - ZipHandle :: handle(), + ZipHandle :: pid(), Options :: [Option], Option :: cooked | memory | {cwd, CWD :: file:filename()}, Reason :: term()). zip_open(Archive, Options) -> - Self = self(), - Pid = spawn_link(fun() -> server_init(Self) end), - request(Self, Pid, {open, Archive, Options}). + Pid = spawn(fun() -> server_loop(not_open) end), + request(self(), Pid, {open, Archive, Options}). -spec(zip_get(ZipHandle) -> {ok, [Result]} | {error, Reason} when - ZipHandle :: handle(), + ZipHandle :: pid(), Result :: file:name() | {file:name(), binary()}, Reason :: term()). @@ -1185,14 +1174,14 @@ request(self(), Pid, get). -spec(zip_close(ZipHandle) -> ok | {error, einval} when - ZipHandle :: handle()). + ZipHandle :: pid()). zip_close(Pid) when is_pid(Pid) -> request(self(), Pid, close). -spec(zip_get(FileName, ZipHandle) -> {ok, Result} | {error, Reason} when FileName :: file:name(), - ZipHandle :: handle(), + ZipHandle :: pid(), Result :: file:name() | {file:name(), binary()}, Reason :: term()). @@ -1201,7 +1190,7 @@ -spec(zip_list_dir(ZipHandle) -> {ok, Result} | {error, Reason} when Result :: [zip_comment() | zip_file()], - ZipHandle :: handle(), + ZipHandle :: pid(), Reason :: term()). zip_list_dir(Pid) when is_pid(Pid) -> @@ -1550,33 +1539,57 @@ %% A pwrite-like function for iolists (used by memory-option) -pwrite_binary(B, Pos, Bin) when byte_size(B) =:= Pos -> - append_bins(Bin, B); -pwrite_binary(B, Pos, Bin) -> - erlang:iolist_to_binary(pwrite_iolist(B, Pos, Bin)). +split_iolist(B, Pos) when is_binary(B) -> + split_binary(B, Pos); +split_iolist(L, Pos) when is_list(L) -> + splitter([], L, Pos). + +splitter(Left, Right, 0) -> + {Left, Right}; +splitter(Left, [A | Right], RelPos) when is_list(A) or is_binary(A) -> + Sz = erlang:iolist_size(A), + case Sz > RelPos of + true -> + {Leftx, Rightx} = split_iolist(A, RelPos), + {[Left | Leftx], [Rightx, Right]}; + _ -> + splitter([Left | A], Right, RelPos - Sz) + end; +splitter(Left, [A | Right], RelPos) when is_integer(A) -> + splitter([Left, A], Right, RelPos - 1); +splitter(Left, Right, RelPos) when is_binary(Right) -> + splitter(Left, [Right], RelPos). -append_bins([Bin|Bins], B) when is_binary(Bin) -> - append_bins(Bins, <>); -append_bins([List|Bins], B) when is_list(List) -> - append_bins(Bins, append_bins(List, B)); -append_bins(Bin, B) when is_binary(Bin) -> - <>; -append_bins([_|_]=List, B) -> - <>; -append_bins([], B) -> - B. +skip_iolist(B, Pos) when is_binary(B) -> + case B of + <<_:Pos/binary, Bin/binary>> -> Bin; + _ -> <<>> + end; +skip_iolist(L, Pos) when is_list(L) -> + skipper(L, Pos). -pwrite_iolist(B, Pos, Bin) -> - {Left, Right} = split_binary(B, Pos), +skipper(Right, 0) -> + Right; +skipper([A | Right], RelPos) when is_list(A) or is_binary(A) -> + Sz = erlang:iolist_size(A), + case Sz > RelPos of + true -> + Rightx = skip_iolist(A, RelPos), + [Rightx, Right]; + _ -> + skip_iolist(Right, RelPos - Sz) + end; +skipper([A | Right], RelPos) when is_integer(A) -> + skip_iolist(Right, RelPos - 1). + +pwrite_iolist(Iolist, Pos, Bin) -> + {Left, Right} = split_iolist(Iolist, Pos), Sz = erlang:iolist_size(Bin), - R = skip_bin(Right, Sz), + R = skip_iolist(Right, Sz), [Left, Bin | R]. -skip_bin(B, Pos) when is_binary(B) -> - case B of - <<_:Pos/binary, Bin/binary>> -> Bin; - _ -> <<>> - end. +pwrite_binary(B, Pos, Bin) -> + erlang:iolist_to_binary(pwrite_iolist(B, Pos, Bin)). %% ZIP header manipulations diff -Nru erlang-18.2-dfsg/lib/stdlib/test/array_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/array_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/array_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/array_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/base64_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/base64_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/base64_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/base64_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,8 +29,7 @@ %% Test cases must be exported. -export([base64_encode/1, base64_decode/1, base64_otp_5635/1, base64_otp_6279/1, big/1, illegal/1, mime_decode/1, - mime_decode_to_string/1, - roundtrip_1/1, roundtrip_2/1, roundtrip_3/1, roundtrip_4/1]). + mime_decode_to_string/1, roundtrip/1]). init_per_testcase(_, Config) -> Dog = test_server:timetrap(?t:minutes(4)), @@ -51,11 +49,10 @@ all() -> [base64_encode, base64_decode, base64_otp_5635, base64_otp_6279, big, illegal, mime_decode, mime_decode_to_string, - {group, roundtrip}]. + roundtrip]. groups() -> - [{roundtrip, [parallel], - [roundtrip_1, roundtrip_2, roundtrip_3, roundtrip_4]}]. + []. init_per_suite(Config) -> Config. @@ -244,33 +241,21 @@ %%------------------------------------------------------------------------- -roundtrip_1(Config) when is_list(Config) -> - do_roundtrip(1). - -roundtrip_2(Config) when is_list(Config) -> - do_roundtrip(2). - -roundtrip_3(Config) when is_list(Config) -> - do_roundtrip(3). - -roundtrip_4(Config) when is_list(Config) -> - do_roundtrip(4). - -do_roundtrip(Offset) -> - Sizes = lists:seq(Offset, 255, 4) ++ lists:seq(2400-6+Offset, 2440, 4), - do_roundtrip_1(Sizes, []). +roundtrip(Config) when is_list(Config) -> + Sizes = lists:seq(1, 255) ++ lists:seq(2400-5, 2440), + roundtrip_1(Sizes, []). -do_roundtrip_1([NextSize|Sizes], Current) -> +roundtrip_1([NextSize|Sizes], Current) -> Len = length(Current), io:format("~p", [Len]), - do_roundtrip_2(Current), + do_roundtrip(Current), Next = random_byte_list(NextSize - Len, Current), - do_roundtrip_1(Sizes, Next); -do_roundtrip_1([], Last) -> + roundtrip_1(Sizes, Next); +roundtrip_1([], Last) -> io:format("~p", [length(Last)]), - do_roundtrip_2(Last). + do_roundtrip(Last). -do_roundtrip_2(List) -> +do_roundtrip(List) -> Bin = list_to_binary(List), Base64Bin = base64:encode(List), Base64Bin = base64:encode(Bin), diff -Nru erlang-18.2-dfsg/lib/stdlib/test/beam_lib_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/beam_lib_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/beam_lib_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/beam_lib_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/binary_module_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/binary_module_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/binary_module_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/binary_module_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -507,35 +506,12 @@ ?line [<<1,2,3>>,<<6>>] = Module:split(<<1,2,3,4,5,6,7,8>>, [<<4,5>>,<<7>>,<<8>>], [global,trim]), - ?line [<<1,2,3>>,<<6>>] = Module:split(<<1,2,3,4,5,6,7,8>>, - [<<4,5>>,<<7>>,<<8>>], - [global,trim_all]), ?line [<<1,2,3,4,5,6,7,8>>] = Module:split(<<1,2,3,4,5,6,7,8>>, [<<4,5>>,<<7>>,<<8>>], [global,trim,{scope,{0,4}}]), ?line [<<1,2,3>>,<<6,7,8>>] = Module:split(<<1,2,3,4,5,6,7,8>>, [<<4,5>>,<<7>>,<<8>>], [global,trim,{scope,{0,5}}]), - - ?line [<<>>,<<>>,<<3>>,<<6,7,8>>] = Module:split(<<1,2,3,4,5,6,7,8>>, - [<<1>>,<<2>>,<<4,5>>], - [global,trim]), - ?line [<<3>>,<<6,7,8>>] = Module:split(<<1,2,3,4,5,6,7,8>>, - [<<1>>,<<2>>,<<4,5>>], - [global,trim_all]), - - ?line [<<1,2,3>>,<<>>,<<7,8>>] = Module:split(<<1,2,3,4,5,6,7,8>>, - [<<4,5>>,<<6>>], - [global,trim]), - ?line [<<1,2,3>>,<<7,8>>] = Module:split(<<1,2,3,4,5,6,7,8>>, - [<<4,5>>,<<6>>], - [global,trim_all]), - ?line [<<>>,<<>>,<<3>>,<<>>,<<6>>] = Module:split(<<1,2,3,4,5,6,7,8>>, - [<<1>>,<<2>>,<<4>>,<<5>>,<<7>>,<<8>>], - [global,trim]), - ?line [<<3>>,<<6>>] = Module:split(<<1,2,3,4,5,6,7,8>>, - [<<1>>,<<2>>,<<4>>,<<5>>,<<7>>,<<8>>], - [global,trim_all]), ?line badarg = ?MASK_ERROR( Module:replace(<<1,2,3,4,5,6,7,8>>, [<<4,5>>,<<7>>,<<8>>],<<99>>, @@ -994,51 +970,43 @@ random_ref_comp(doc) -> ["Test pseudorandomly generated cases against reference imlementation"]; random_ref_comp(Config) when is_list(Config) -> - put(success_counter,0), - random:seed({1271,769940,559934}), - Nr = {1,40}, - Hr = {30,1000}, - I1 = 1500, - I2 = 5, - do_random_match_comp(I1,Nr,Hr), + ?line put(success_counter,0), + ?line random:seed({1271,769940,559934}), + ?line do_random_match_comp(5000,{1,40},{30,1000}), io:format("Number of successes: ~p~n",[get(success_counter)]), - do_random_match_comp2(I1,Nr,Hr), + ?line do_random_match_comp2(5000,{1,40},{30,1000}), io:format("Number of successes: ~p~n",[get(success_counter)]), - do_random_match_comp3(I1,Nr,Hr), + ?line do_random_match_comp3(5000,{1,40},{30,1000}), io:format("Number of successes: ~p~n",[get(success_counter)]), - do_random_match_comp4(I1,Nr,Hr), + ?line do_random_match_comp4(5000,{1,40},{30,1000}), io:format("Number of successes: ~p~n",[get(success_counter)]), - do_random_matches_comp(I1,Nr,Hr), + ?line do_random_matches_comp(5000,{1,40},{30,1000}), io:format("Number of successes: ~p~n",[get(success_counter)]), - do_random_matches_comp2(I1,Nr,Hr), + ?line do_random_matches_comp2(5000,{1,40},{30,1000}), io:format("Number of successes: ~p~n",[get(success_counter)]), - do_random_matches_comp3(I2,Nr,Hr), - erts_debug:set_internal_state(available_internal_state,true), - io:format("oldlimit: ~p~n",[ erts_debug:set_internal_state(binary_loop_limit,100)]), - do_random_match_comp(I1,Nr,Hr), - do_random_matches_comp3(I2,Nr,Hr), - io:format("limit was: ~p~n",[ erts_debug:set_internal_state(binary_loop_limit,default)]), - erts_debug:set_internal_state(available_internal_state,false), + ?line do_random_matches_comp3(5,{1,40},{30,1000}), + ?line erts_debug:set_internal_state(available_internal_state,true), + ?line io:format("oldlimit: ~p~n",[ erts_debug:set_internal_state(binary_loop_limit,100)]), + ?line do_random_match_comp(5000,{1,40},{30,1000}), + ?line do_random_matches_comp3(5,{1,40},{30,1000}), + ?line io:format("limit was: ~p~n",[ erts_debug:set_internal_state(binary_loop_limit,default)]), + ?line erts_debug:set_internal_state(available_internal_state,false), ok. random_ref_sr_comp(doc) -> ["Test pseudorandomly generated cases against reference imlementation of split and replace"]; random_ref_sr_comp(Config) when is_list(Config) -> - put(success_counter,0), - random:seed({1271,769940,559934}), - Nr = {1,40}, - Hr = {30,1000}, - I1 = 1500, - do_random_split_comp(I1,Nr,Hr), + ?line put(success_counter,0), + ?line random:seed({1271,769940,559934}), + ?line do_random_split_comp(5000,{1,40},{30,1000}), io:format("Number of successes: ~p~n",[get(success_counter)]), - do_random_replace_comp(I1,Nr,Hr), + ?line do_random_replace_comp(5000,{1,40},{30,1000}), io:format("Number of successes: ~p~n",[get(success_counter)]), - do_random_split_comp2(I1,Nr,Hr), + ?line do_random_split_comp2(5000,{1,40},{30,1000}), io:format("Number of successes: ~p~n",[get(success_counter)]), - do_random_replace_comp2(I1,Nr,Hr), + ?line do_random_replace_comp2(5000,{1,40},{30,1000}), io:format("Number of successes: ~p~n",[get(success_counter)]), ok. - random_ref_fla_comp(doc) -> ["Test pseudorandomly generated cases against reference imlementation of split and replace"]; random_ref_fla_comp(Config) when is_list(Config) -> @@ -1139,9 +1107,7 @@ Needles = [random_substring(NeedleRange,Haystack) || _ <- lists:duplicate(NumNeedles,a)], RefRes = binref:matches(Haystack,Needles), - RefRes = binary:matches(Haystack,Needles), - Compiled = binary:compile_pattern(Needles), - true = do_matches_comp_loop(10000,Compiled,Haystack, RefRes), + true = do_matches_comp_loop(10000,Needles,Haystack, RefRes), do_random_matches_comp3(N-1,NeedleRange,HaystackRange). do_matches_comp_loop(0,_,_,_) -> @@ -1171,8 +1137,9 @@ end. do_matches_comp(N,H) -> A = ?MASK_ERROR(binref:matches(H,N)), - B = ?MASK_ERROR(binary:matches(H,N)), - C = ?MASK_ERROR(binary:matches(make_unaligned(H), + B = ?MASK_ERROR(binref:matches(H,binref:compile_pattern(N))), + C = ?MASK_ERROR(binary:matches(H,N)), + D = ?MASK_ERROR(binary:matches(make_unaligned(H), binary:compile_pattern([make_unaligned2(X) || X <- N]))), if A =/= nomatch -> @@ -1180,14 +1147,14 @@ true -> ok end, - case {(A =:= B), (B =:= C)} of - {true,true} -> + case {(A =:= B), (B =:= C),(C =:= D)} of + {true,true,true} -> true; _ -> io:format("Failed to match ~p (needle) against ~s (haystack)~n", [N,H]), - io:format("A:~p,~nB:~p,~n,C:~p,~n", - [A,B,C]), + io:format("A:~p,~nB:~p,~n,C:~p,~n,D:~p.~n", + [A,B,C,D]), exit(mismatch) end. @@ -1229,44 +1196,46 @@ do_match_comp(N,H) -> A = ?MASK_ERROR(binref:match(H,N)), - B = ?MASK_ERROR(binary:match(make_unaligned(H),N)), - C = ?MASK_ERROR(binary:match(H,binary:compile_pattern([N]))), - D = ?MASK_ERROR(binary:match(H,binary:compile_pattern(make_unaligned(N)))), + B = ?MASK_ERROR(binref:match(H,binref:compile_pattern([N]))), + C = ?MASK_ERROR(binary:match(make_unaligned(H),N)), + D = ?MASK_ERROR(binary:match(H,binary:compile_pattern([N]))), + E = ?MASK_ERROR(binary:match(H,binary:compile_pattern(make_unaligned(N)))), if A =/= nomatch -> put(success_counter,get(success_counter)+1); true -> ok end, - case {(A =:= B), (B =:= C),(C =:= D)} of - {true,true,true} -> + case {(A =:= B), (B =:= C),(C =:= D),(D =:= E)} of + {true,true,true,true} -> true; _ -> io:format("Failed to match ~s (needle) against ~s (haystack)~n", [N,H]), - io:format("A:~p,~nB:~p,~n,C:~p,~n,D:~p.~n", - [A,B,C,D]), + io:format("A:~p,~nB:~p,~n,C:~p,~n,D:~p,E:~p.~n", + [A,B,C,D,E]), exit(mismatch) end. do_match_comp3(N,H) -> A = ?MASK_ERROR(binref:match(H,N)), - B = ?MASK_ERROR(binary:match(H,N)), - C = ?MASK_ERROR(binary:match(H,binary:compile_pattern(N))), + B = ?MASK_ERROR(binref:match(H,binref:compile_pattern(N))), + C = ?MASK_ERROR(binary:match(H,N)), + D = ?MASK_ERROR(binary:match(H,binary:compile_pattern(N))), if A =/= nomatch -> put(success_counter,get(success_counter)+1); true -> ok end, - case {(A =:= B),(B =:= C)} of - {true,true} -> + case {(A =:= B), (B =:= C),(C =:= D)} of + {true,true,true} -> true; _ -> io:format("Failed to match ~s (needle) against ~s (haystack)~n", [N,H]), - io:format("A:~p,~nB:~p,~n,C:~p.~n", - [A,B,C]), + io:format("A:~p,~nB:~p,~n,C:~p,~n,D:~p.~n", + [A,B,C,D]), exit(mismatch) end. @@ -1278,8 +1247,6 @@ true = do_split_comp(Needle,Haystack,[]), true = do_split_comp(Needle,Haystack,[global]), true = do_split_comp(Needle,Haystack,[global,trim]), - true = do_split_comp(Needle,Haystack,[global,trim_all]), - true = do_split_comp(Needle,Haystack,[global,trim,trim_all]), do_random_split_comp(N-1,NeedleRange,HaystackRange). do_random_split_comp2(0,_,_) -> ok; @@ -1290,9 +1257,6 @@ _ <- lists:duplicate(NumNeedles,a)], true = do_split_comp(Needles,Haystack,[]), true = do_split_comp(Needles,Haystack,[global]), - true = do_split_comp(Needles,Haystack,[global,trim]), - true = do_split_comp(Needles,Haystack,[global,trim_all]), - true = do_split_comp(Needles,Haystack,[global,trim,trim_all]), do_random_split_comp2(N-1,NeedleRange,HaystackRange). do_split_comp(N,H,Opts) -> diff -Nru erlang-18.2-dfsg/lib/stdlib/test/binref.erl erlang-17.3-dfsg/lib/stdlib/test/binref.erl --- erlang-18.2-dfsg/lib/stdlib/test/binref.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/binref.erl 2014-09-16 19:10:57.000000000 +0000 @@ -155,8 +155,7 @@ true -> exit(badtype) end, - {Part,Global,Trim,TrimAll} = - get_opts_split(Options,{nomatch,false,false,false}), + {Part,Global,Trim} = get_opts_split(Options,{nomatch,false,false}), {Start,End,NewStack} = case Part of nomatch -> @@ -181,24 +180,20 @@ [X] end end, - do_split(Haystack,MList,0,Trim,TrimAll) + do_split(Haystack,MList,0,Trim) catch _:_ -> erlang:error(badarg) end. -do_split(H,[],N,true,_) when N >= byte_size(H) -> +do_split(H,[],N,true) when N >= byte_size(H) -> []; -do_split(H,[],N,_,true) when N >= byte_size(H) -> - []; -do_split(H,[],N,_,_) -> +do_split(H,[],N,_) -> [part(H,{N,byte_size(H)-N})]; -do_split(H,[{A,B}|T],N,Trim,TrimAll) -> +do_split(H,[{A,B}|T],N,Trim) -> case part(H,{N,A-N}) of - <<>> when TrimAll == true -> - do_split(H,T,A+B,Trim,TrimAll); <<>> -> - Rest = do_split(H,T,A+B,Trim,TrimAll), + Rest = do_split(H,T,A+B,Trim), case {Trim, Rest} of {true,[]} -> []; @@ -206,7 +201,7 @@ [<<>> | Rest] end; Oth -> - [Oth | do_split(H,T,A+B,Trim,TrimAll)] + [Oth | do_split(H,T,A+B,Trim)] end. @@ -570,16 +565,14 @@ get_opts_match(_,_) -> throw(badopt). -get_opts_split([],{Part,Global,Trim,TrimAll}) -> - {Part,Global,Trim,TrimAll}; -get_opts_split([{scope,{A,B}} | T],{_Part,Global,Trim,TrimAll}) -> - get_opts_split(T,{{A,B},Global,Trim,TrimAll}); -get_opts_split([global | T],{Part,_Global,Trim,TrimAll}) -> - get_opts_split(T,{Part,true,Trim,TrimAll}); -get_opts_split([trim | T],{Part,Global,_Trim,TrimAll}) -> - get_opts_split(T,{Part,Global,true,TrimAll}); -get_opts_split([trim_all | T],{Part,Global,Trim,_TrimAll}) -> - get_opts_split(T,{Part,Global,Trim,true}); +get_opts_split([],{Part,Global,Trim}) -> + {Part,Global,Trim}; +get_opts_split([{scope,{A,B}} | T],{_Part,Global,Trim}) -> + get_opts_split(T,{{A,B},Global,Trim}); +get_opts_split([global | T],{Part,_Global,Trim}) -> + get_opts_split(T,{Part,true,Trim}); +get_opts_split([trim | T],{Part,Global,_Trim}) -> + get_opts_split(T,{Part,Global,true}); get_opts_split(_,_) -> throw(badopt). diff -Nru erlang-18.2-dfsg/lib/stdlib/test/calendar_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/calendar_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/calendar_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/calendar_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/c_SUITE_data/m.erl erlang-17.3-dfsg/lib/stdlib/test/c_SUITE_data/m.erl --- erlang-18.2-dfsg/lib/stdlib/test/c_SUITE_data/m.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/c_SUITE_data/m.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/c_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/c_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/c_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/c_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/dets_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/dets_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/dets_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/dets_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -224,7 +223,8 @@ ?format("Crashing dets server \n", []), process_flag(trap_exit, true), - Procs = [whereis(?DETS_SERVER) | [dets:info(Tab, pid) || Tab <- Tabs]], + Procs = [whereis(?DETS_SERVER) | map(fun(Tab) -> dets:info(Tab, pid) end, + Tabs)], foreach(fun(Pid) -> exit(Pid, kill) end, Procs), timer:sleep(100), c:flush(), %% flush all the EXIT sigs @@ -235,32 +235,18 @@ open_files(1, All, Version), ?format("Checking contents of repaired files \n", []), check(Tabs, Data), - + close_all(Tabs), - delete_files(All), + delete_files(All), + P1 = pps(), {Ports0, Procs0} = P0, - Test = fun() -> - P1 = pps(), - {Ports1, Procs1} = P1, - show("Old port", Ports0 -- Ports1), - show("New port", Ports1 -- Ports0), - show("Old procs", Procs0 -- Procs1), - show("New procs", Procs1 -- Procs0), - io:format("Remaining Dets-pids (should be nil): ~p~n", - [find_dets_pids()]), - true = Ports1 =:= Ports0, - %% The dets_server process has been restarted: - [_] = Procs0 -- Procs1, - [_] = Procs1 -- Procs0, - ok - end, - case catch Test() of - ok -> ok; - _ -> - timer:sleep(500), - ok = Test() - end. + {Ports1, Procs1} = P1, + true = Ports1 =:= Ports0, + %% The dets_server process has been restarted: + [_] = Procs0 -- Procs1, + [_] = Procs1 -- Procs0, + ok. check(Tabs, Data) -> foreach(fun(Tab) -> @@ -3289,22 +3275,12 @@ File = filename(Tab, Config), ok = monit(Tab, File), - case feasible() of - false -> {comment, "OK, but did not run all of the test"}; - true -> - ok = kill_while_repairing(Tab, File), - ok = kill_while_init(Tab, File), - ok = open_ro(Tab, File), - ok = open_w(Tab, File, 0, Config), - ok = open_w(Tab, File, 100, Config) - end. - -feasible() -> - LP = erlang:system_info(logical_processors), - (is_integer(LP) - andalso LP >= erlang:system_info(schedulers_online) - andalso not erlang:system_info(debug_compiled) - andalso not erlang:system_info(lock_checking)). + ok = kill_while_repairing(Tab, File), + ok = kill_while_init(Tab, File), + ok = open_ro(Tab, File), + ok = open_w(Tab, File, 0, Config), + ok = open_w(Tab, File, 100, Config), + ok. %% One process logs and another process closes the log. Before %% monitors were used, this would make the client never return. @@ -3331,6 +3307,7 @@ Delay = 1000, dets:start(), Parent = self(), + Ps = processes(), F = fun() -> R = (catch dets:open_file(Tab, [{file,File}])), timer:sleep(Delay), @@ -3341,7 +3318,7 @@ P1 = spawn(F), P2 = spawn(F), P3 = spawn(F), - DetsPid = find_dets_pid(), + DetsPid = find_dets_pid([P1, P2, P3 | Ps]), exit(DetsPid, kill), receive {P1,R1} -> R1 end, @@ -3365,6 +3342,12 @@ file:delete(File), ok. +find_dets_pid(P0) -> + case lists:sort(processes() -- P0) of + [P, _] -> P; + _ -> timer:sleep(100), find_dets_pid(P0) + end. + find_dets_pid() -> case find_dets_pids() of [] -> @@ -3438,13 +3421,6 @@ open_w(Tab, File, Delay, Config) -> create_opened_log(File), - - Tab2 = t2, - File2 = filename(Tab2, Config), - file:delete(File2), - {ok,Tab2} = dets:open_file(Tab2, [{file,File2}]), - ok = dets:close(Tab2), - Parent = self(), F = fun() -> R = dets:open_file(Tab, [{file,File}]), @@ -3454,16 +3430,16 @@ Pid1 = spawn(F), Pid2 = spawn(F), Pid3 = spawn(F), + undefined = dets:info(Tab), % is repairing now + 0 = qlen(), - ok = wait_for_repair_to_start(Tab), - - %% It is assumed that it takes some time to repair the file. + Tab2 = t2, + File2 = filename(Tab2, Config), + file:delete(File2), {ok,Tab2} = dets:open_file(Tab2, [{file,File2}]), - %% The Dets server managed to handle to open_file request. - 0 = qlen(), % still repairing - ok = dets:close(Tab2), file:delete(File2), + 0 = qlen(), % still repairing receive {Pid1,R1} -> {ok, Tab} = R1 end, receive {Pid2,R2} -> {ok, Tab} = R2 end, @@ -3480,15 +3456,6 @@ file:delete(File), ok. -wait_for_repair_to_start(Tab) -> - case catch dets_server:get_pid(Tab) of - {'EXIT', _} -> - timer:sleep(1), - wait_for_repair_to_start(Tab); - Pid when is_pid(Pid) -> - ok - end. - qlen() -> {_, {_, N}} = lists:keysearch(message_queue_len, 1, process_info(self())), N. @@ -4383,7 +4350,6 @@ true = test_server:is_native(M) andalso length(Args) =:= A. check_pps({Ports0,Procs0} = P0) -> - ok = check_dets_tables(), case pps() of P0 -> ok; @@ -4409,45 +4375,13 @@ end end. -%% Copied from dets_server.erl: --define(REGISTRY, dets_registry). --define(OWNERS, dets_owners). --define(STORE, dets). - -check_dets_tables() -> - Store = [T || - T <- ets:all(), - ets:info(T, name) =:= ?STORE, - owner(T) =:= dets], - S = case Store of - [Tab] -> ets:tab2list(Tab); - [] -> [] - end, - case {ets:tab2list(?REGISTRY), ets:tab2list(?OWNERS), S} of - {[], [], []} -> ok; - {R, O, _} -> - io:format("Registry: ~p~n", [R]), - io:format("Owners: ~p~n", [O]), - io:format("Store: ~p~n", [S]), - not_ok - end. - -owner(Tab) -> - Owner = ets:info(Tab, owner), - case process_info(Owner, registered_name) of - {registered_name, Name} -> Name; - _ -> Owner - end. - show(_S, []) -> ok; -show(S, [{Pid, Name, InitCall}|Pids]) when is_pid(Pid) -> - io:format("~s: ~w (~w), ~w: ~p~n", - [S, Pid, proc_reg_name(Name), InitCall, - erlang:process_info(Pid)]), +show(S, [Pid|Pids]) when is_pid(Pid) -> + io:format("~s: ~p~n", [S, erlang:process_info(Pid)]), show(S, Pids); -show(S, [{Port, _}|Ports]) when is_port(Port)-> - io:format("~s: ~w: ~p~n", [S, Port, erlang:port_info(Port)]), +show(S, [Port|Ports]) when is_port(Port)-> + io:format("~s: ~p~n", [S, erlang:port_info(Port)]), show(S, Ports). pps() -> @@ -4463,8 +4397,5 @@ safe_second_element(process_info(P, initial_call))} || P <- processes()]. -proc_reg_name({registered_name, Name}) -> Name; -proc_reg_name([]) -> no_reg_name. - safe_second_element({_,Info}) -> Info; safe_second_element(Other) -> Other. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/dict_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/dict_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/dict_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/dict_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -26,16 +25,16 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2,end_per_testcase/2, - create/1,store/1,iterate/1]). + create/1,store/1]). -include_lib("test_server/include/test_server.hrl"). --import(lists, [foldl/3]). +-import(lists, [foldl/3,reverse/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [create, store, iterate]. + [create, store]. groups() -> []. @@ -94,48 +93,6 @@ D0. %%% -%%% Test specifics for gb_trees. -%%% - -iterate(Config) when is_list(Config) -> - test_all(fun iterate_1/1). - -iterate_1(M) -> - case M(module, []) of - gb_trees -> iterate_2(M); - _ -> ok - end, - M(empty, []). - -iterate_2(M) -> - random:seed(1, 2, 42), - iter_tree(M, 1000). - -iter_tree(_M, 0) -> - ok; -iter_tree(M, N) -> - L = [{I, I} || I <- lists:seq(1, N)], - T = M(from_list, L), - L = lists:reverse(iterate_tree(M, T)), - R = random:uniform(N), - KV = lists:reverse(iterate_tree_from(M, R, T)), - KV = [P || P={K,_} <- L, K >= R], - iter_tree(M, N-1). - -iterate_tree(M, Tree) -> - I = M(iterator, Tree), - iterate_tree_1(M, M(next, I), []). - -iterate_tree_from(M, Start, Tree) -> - I = M(iterator_from, {Start, Tree}), - iterate_tree_1(M, M(next, I), []). - -iterate_tree_1(_, none, R) -> - R; -iterate_tree_1(M, {K, V, I}, R) -> - iterate_tree_1(M, M(next, I), [{K, V} | R]). - -%%% %%% Helper functions. %%% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/dict_test_lib.erl erlang-17.3-dfsg/lib/stdlib/test/dict_test_lib.erl --- erlang-18.2-dfsg/lib/stdlib/test/dict_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/dict_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,9 +29,6 @@ (module, []) -> Mod; (size, D) -> Mod:size(D); (is_empty, D) -> Mod:is_empty(D); - (iterator, S) -> Mod:iterator(S); - (iterator_from, {Start, S}) -> Mod:iterator_from(Start, S); - (next, I) -> Mod:next(I); (to_list, D) -> to_list(Mod, D) end. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/digraph_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/digraph_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/digraph_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/digraph_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/digraph_utils_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/digraph_utils_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/digraph_utils_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/digraph_utils_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/dummy1_h.erl erlang-17.3-dfsg/lib/stdlib/test/dummy1_h.erl --- erlang-18.2-dfsg/lib/stdlib/test/dummy1_h.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/dummy1_h.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/dummy_h.erl erlang-17.3-dfsg/lib/stdlib/test/dummy_h.erl --- erlang-18.2-dfsg/lib/stdlib/test/dummy_h.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/dummy_h.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/edlin_expand_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/edlin_expand_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/edlin_expand_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/edlin_expand_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/mac2.erl erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/mac2.erl --- erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/mac2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/mac2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/mac3.erl erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/mac3.erl --- erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/mac3.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/mac3.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/mac.erl erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/mac.erl --- erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/mac.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/mac.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/pmod.erl erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/pmod.erl --- erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/pmod.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/pmod.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1.erl erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1.erl --- erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1_include_dir.hrl erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1_include_dir.hrl --- erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1_include_dir.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1_include_dir.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1_include.hrl erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1_include.hrl --- erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1_include.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE_data/variable_1_include.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/epp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/epp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2015. All Rights Reserved. +%% Copyright Ericsson AB 1998-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -212,7 +211,7 @@ ?line File = filename:join(?config(data_dir, Config), "mac3.erl"), ?line {ok, List} = epp:parse_file(File, [], []), ?line [_, - {attribute, Anno, l, Line1}, + {attribute, LineCol1, l, Line1}, {attribute, _, f, File}, {attribute, _, machine1, _}, {attribute, _, module, mac3}, @@ -220,9 +219,13 @@ {attribute, _, ms, "mac3"}, {attribute, _, machine2, _} | _] = List, - Line1 = erl_anno:line(Anno), + ?line case LineCol1 of + Line1 -> ok; + {Line1,_} -> ok + end, ok. + variable_1(doc) -> []; variable_1(suite) -> @@ -550,7 +553,11 @@ {ok, AC} = beam_lib:chunks(BeamFile, [abstract_code]), {file_7702,[{abstract_code,{_,Forms}}]} = AC, - Forms2 = unopaque_forms(Forms), + Fun = fun(Attrs) -> + {line, L} = erl_parse:get_attribute(Attrs, line), + L + end, + Forms2 = [erl_lint:modify_line(Form, Fun) || Form <- Forms], ?line [{attribute,1,file,_}, _, @@ -1388,10 +1395,9 @@ do_otp_10820(File, C, PC) -> {ok,Node} = start_node(erl_pp_helper, "+fnu " ++ PC), ok = rpc:call(Node, file, write_file, [File, C]), - {ok, Forms} = rpc:call(Node, epp, parse_file, [File, [],[]]), - [{attribute,1,file,{File,1}}, - {attribute,2,module,any}, - {eof,2}] = unopaque_forms(Forms), + {ok,[{attribute,1,file,{File,1}}, + {attribute,2,module,any}, + {eof,2}]} = rpc:call(Node, epp, parse_file, [File, [],[]]), true = test_server:stop_node(Node), ok. @@ -1434,15 +1440,15 @@ {attribute,1,module,encoding}, {error,_}, {error,{2,epp,cannot_parse}}, - {eof,2}]} = epp_parse_file(ErlFile, []), + {eof,2}]} = epp:parse_file(ErlFile, []), {ok,[{attribute,1,file,_}, {attribute,1,module,encoding}, {eof,3}]} = - epp_parse_file(ErlFile, [{default_encoding,latin1}]), + epp:parse_file(ErlFile, [{default_encoding,latin1}]), {ok,[{attribute,1,file,_}, {attribute,1,module,encoding}, {eof,3}],[{encoding,none}]} = - epp_parse_file(ErlFile, [{default_encoding,latin1},extra]), + epp:parse_file(ErlFile, [{default_encoding,latin1},extra]), %% Try a latin-1 file with encoding given in a comment. C2 = <<"-module(encoding). @@ -1453,27 +1459,27 @@ {ok,[{attribute,1,file,_}, {attribute,1,module,encoding}, {eof,4}]} = - epp_parse_file(ErlFile, []), + epp:parse_file(ErlFile, []), {ok,[{attribute,1,file,_}, {attribute,1,module,encoding}, {eof,4}]} = - epp_parse_file(ErlFile, [{default_encoding,latin1}]), + epp:parse_file(ErlFile, [{default_encoding,latin1}]), {ok,[{attribute,1,file,_}, {attribute,1,module,encoding}, {eof,4}]} = - epp_parse_file(ErlFile, [{default_encoding,utf8}]), + epp:parse_file(ErlFile, [{default_encoding,utf8}]), {ok,[{attribute,1,file,_}, {attribute,1,module,encoding}, {eof,4}],[{encoding,latin1}]} = - epp_parse_file(ErlFile, [extra]), + epp:parse_file(ErlFile, [extra]), {ok,[{attribute,1,file,_}, {attribute,1,module,encoding}, {eof,4}],[{encoding,latin1}]} = - epp_parse_file(ErlFile, [{default_encoding,latin1},extra]), + epp:parse_file(ErlFile, [{default_encoding,latin1},extra]), {ok,[{attribute,1,file,_}, {attribute,1,module,encoding}, {eof,4}],[{encoding,latin1}]} = - epp_parse_file(ErlFile, [{default_encoding,utf8},extra]), + epp:parse_file(ErlFile, [{default_encoding,utf8},extra]), ok. @@ -1546,17 +1552,6 @@ errs([], _File) -> []. -epp_parse_file(File, Opts) -> - case epp:parse_file(File, Opts) of - {ok, Forms} -> - {ok, unopaque_forms(Forms)}; - {ok, Forms, Other} -> - {ok, unopaque_forms(Forms), Other} - end. - -unopaque_forms(Forms) -> - [erl_parse:anno_to_term(Form) || Form <- Forms]. - run_test(Config, Test0) -> Test = [<<"-module(epp_test). -compile(export_all). ">>, Test0], Filename = "epp_test.erl", diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_anno_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/erl_anno_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_anno_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_anno_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,569 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% --module(erl_anno_SUITE). - -%-define(debug, true). - --ifdef(debug). --include_lib("test_server/include/test_server.hrl"). --define(format(S, A), io:format(S, A)). --else. --include_lib("test_server/include/test_server.hrl"). --define(format(S, A), ok). --endif. - --export([all/0, suite/0, groups/0, init_per_suite/1, end_per_suite/1, - init_per_group/2, end_per_group/2, - init_per_testcase/2, end_per_testcase/2]). - --export([new/1, is_anno/1, generated/1, end_location/1, file/1, - line/1, location/1, record/1, text/1, bad/1, neg_line/1]). - --export([parse_abstract/1, mapfold_anno/1]). - -all() -> - [{group, anno}, {group, parse}]. - -groups() -> - [{anno, [], [new, is_anno, generated, end_location, file, - line, location, record, text, bad, neg_line]}, - {parse, [], [parse_abstract, mapfold_anno]}]. - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -init_per_testcase(_Case, Config) -> - Dog=?t:timetrap(?t:minutes(1)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, _Config) -> - Dog=?config(watchdog, _Config), - test_server:timetrap_cancel(Dog), - ok. - --define(INFO(T, V), {T, V}). - --dialyzer({no_fail_call, new/1}). -new(doc) -> - ["Test erl_anno:new/1"]; -new(_Config) -> - {'EXIT', {badarg, _}} = - (catch erl_anno:new([{location,1},{text, "text"}])), % badarg - ok. - -is_anno(doc) -> - ["Test erl_anno:is_anno/1"]; -is_anno(_Config) -> - false = erl_anno:is_anno(a), - false = erl_anno:is_anno({a}), - false = erl_anno:is_anno([]), - false = erl_anno:is_anno([{location, 1}|{generated, true}]), - false = erl_anno:is_anno([{generated,false}]), - false = erl_anno:is_anno([{generated,true}]), - false = erl_anno:is_anno([{location,1},{file,nofile}]), - false = erl_anno:is_anno([{location,1},{text,notext}]), - - true = erl_anno:is_anno(erl_anno:new(1)), - A0 = erl_anno:new({1, 17}), - true = erl_anno:is_anno(A0), - A1 = erl_anno:set_generated(true, A0), - true = erl_anno:is_anno(A1), - A2 = erl_anno:set_file("", A1), - true = erl_anno:is_anno(A2), - A3 = erl_anno:set_record(true, A2), - true = erl_anno:is_anno(A3), - A4 = erl_anno:set_text("text", A3), - true = erl_anno:is_anno(A4), - A5 = erl_anno:set_file(<<"filename">>, A4), - true = erl_anno:is_anno(A5), - ok. - -generated(doc) -> - ["Test 'generated'"]; -generated(_Config) -> - test(1, [{generated, true}, {generated, false}]), - test(1, [{generated, false}, {generated, true}, {generated, false}]), - test({1, 17}, [{generated, false}, - {generated, true}, - {generated, false}]), - test({1, 17}, [{text, "text", [{end_location, {1, 21}}, {length, 4}]}, - {generated, false}, - {generated, true}, - {generated, false}]), - test(1, [{generated, false}, - {generated, true}, - {generated, false}]), - test(1, [{text, "text", [{end_location, 1}, {length, 4}]}, - {generated, false}, - {generated, true}, - {generated, false}]), - ok. - -end_location(doc) -> - ["Test 'end_location'"]; -end_location(_Config) -> - test({1, 17}, [{text, "TEXT", [{end_location, {1, 21}}, {length, 4}]}, - {text, "TEXT\n", [{end_location, {2, 1}}, {length, 5}]}, - {text, "TEXT\ntxt", [{end_location, {2, 4}}, {length, 8}]}]), - test(1, [{text, "TEXT", [{end_location, 1}, {length, 4}]}, - {text, "TEXT\n", [{end_location, 2}, {length, 5}]}, - {text, "TEXT\ntxt", [{end_location, 2}, {length, 8}]}]), - ok. - -file(doc) -> - ["Test 'file'"]; -file(_Config) -> - test(1, [{file, "name"}, {file, ""}]), - test({1, 17}, [{file, "name"}, {file, ""}]), - ok. - -line(doc) -> - ["Test 'line'"]; -line(_Config) -> - test(1, [{line, 17, [{location, 17}]}, - {location, {9, 8}, [{line, 9}, {column, 8}]}, - {line, 14, [{location, {14, 8}}]}]), - ok. - -location(doc) -> - ["Test 'location'"]; -location(_Config) -> - test(1, [{location, 2, [{line,2}]}, - {location, {1, 17}, [{line, 1}, {column, 17}]}, - {location, {9, 6}, [{line, 9}, {column, 6}]}, - {location, 9, [{column, undefined}]}]), - test(1, [{generated, true}, - {location, 2, [{line,2}]}, - {location, {1, 17}, [{line, 1}, {column, 17}]}, - {location, {9, 6}, [{line, 9}, {column, 6}]}, - {location, 9, [{column, undefined}]}]), - test(1, [{record, true}, - {location, 2, [{line,2}]}, - {location, {1, 17}, [{line, 1}, {column, 17}]}, - {location, {9, 6}, [{line, 9}, {column, 6}]}, - {location, 9, [{column, undefined}]}]), - ok. - -record(doc) -> - ["Test 'record'"]; -record(_Config) -> - test({1, 17}, [{record, true}, {record, false}]), - test(1, [{record, true}, {record, false}]), - test({1, 17}, [{generated, false}, - {generated, true}, - {generated, false}]), - test({1, 17}, [{text, "text", [{end_location, {1, 21}}, {length, 4}]}, - {generated, false}, - {generated, true}, - {generated, false}]), - test(1, [{generated, false}, - {generated, true}, - {generated, false}]), - test(1, [{text, "text", [{end_location, 1}, {length, 4}]}, - {generated, false}, - {generated, true}, - {generated, false}]), - ok. - -text(doc) -> - ["Test 'text'"]; -text(_Config) -> - test(1, [{text, "text", [{end_location, 1}, {length, 4}]}, - {text, "", [{end_location, 1}, {length, 0}]}]), - test({1, 17}, [{text, "text", [{end_location, {1,21}}, {length, 4}]}, - {text, "", [{end_location, {1,17}}, {length, 0}]}]), - ok. - --dialyzer({[no_opaque, no_fail_call], bad/1}). -bad(doc) -> - ["Test bad annotations"]; -bad(_Config) -> - Line = erl_anno:new(1), - LineColumn = erl_anno:new({1, 17}), - {'EXIT', {badarg, _}} = - (catch erl_anno:set_generated(true, bad)), % 3rd arg not opaque - {'EXIT', {badarg, _}} = - (catch erl_anno:set_generated(false, bad)), % 3rd arg not opaque - {'EXIT', {badarg, _}} = - (catch erl_anno:set_generated(19, Line)), - {'EXIT', {badarg, _}} = - (catch erl_anno:set_generated(19, LineColumn)), - - {'EXIT', {badarg, _}} = - (catch erl_anno:generated(bad)), % 1st arg not opaque - {'EXIT', {badarg, _}} = - (catch erl_anno:end_location(bad)), % 1st arg not opaque - {'EXIT', {badarg, _}} = - (catch erl_anno:file(bad)), % 1st arg not opaque - {'EXIT', {badarg, _}} = - (catch erl_anno:text(bad)), % 1st arg not opaque - {'EXIT', {badarg, _}} = - (catch erl_anno:record(bad)), % 1st arg not opaque - ok. - -neg_line(doc) -> - ["Test negative line numbers (OTP 18)"]; -neg_line(_Config) -> - neg_line1(false), - neg_line1(true), - ok. - -neg_line1(TextToo) -> - Minus8_0 = erl_anno:new(-8), - Plus8_0 = erl_anno:new(8), - Minus8C_0 = erl_anno:new({-8, 17}), - Plus8C_0 = erl_anno:new({8, 17}), - - [Minus8, Plus8, Minus8C, Plus8C] = - [case TextToo of - true -> - erl_anno:set_text("foo", A); - false -> - A - end || A <- [Minus8_0, Plus8_0, Minus8C_0, Plus8C_0]], - - tst(-3, erl_anno:set_location(3, Minus8)), - tst(-3, erl_anno:set_location(-3, Plus8)), - tst(-3, erl_anno:set_location(-3, Minus8)), - tst({-3,9}, erl_anno:set_location({3, 9}, Minus8)), - tst({-3,9}, erl_anno:set_location({-3, 9}, Plus8)), - tst({-3,9}, erl_anno:set_location({-3, 9}, Minus8)), - tst(-3, erl_anno:set_location(3, Minus8C)), - tst(-3, erl_anno:set_location(-3, Plus8C)), - tst(-3, erl_anno:set_location(-3, Minus8C)), - tst({-3,9}, erl_anno:set_location({3, 9}, Minus8C)), - tst({-3,9}, erl_anno:set_location({-3, 9}, Plus8C)), - tst({-3,9}, erl_anno:set_location({-3, 9}, Minus8C)), - - tst(-8, erl_anno:set_generated(true, Plus8)), - tst(-8, erl_anno:set_generated(true, Minus8)), - tst({-8,17}, erl_anno:set_generated(true, Plus8C)), - tst({-8,17}, erl_anno:set_generated(true, Minus8C)), - tst(8, erl_anno:set_generated(false, Plus8)), - tst(8, erl_anno:set_generated(false, Minus8)), - tst({8,17}, erl_anno:set_generated(false, Plus8C)), - tst({8,17}, erl_anno:set_generated(false, Minus8C)), - - tst(-3, erl_anno:set_line(3, Minus8)), - tst(-3, erl_anno:set_line(-3, Plus8)), - tst(-3, erl_anno:set_line(-3, Minus8)), - tst({-3,17}, erl_anno:set_line(3, Minus8C)), - tst({-3,17}, erl_anno:set_line(-3, Plus8C)), - tst({-3,17}, erl_anno:set_line(-3, Minus8C)), - ok. - -tst(Term, Anno) -> - ?format("Term: ~p\n", [Term]), - ?format("Anno: ~p\n", [Anno]), - case anno_to_term(Anno) of - Term -> - ok; - Else -> - case lists:keyfind(location, 1, Else) of - {location, Term} -> - ok; - _Else2 -> - ?format("Else2 ~p\n", [_Else2]), - io:format("expected ~p\n got ~p\n", [Term, Else]), - exit({Term, Else}) - end - end. - -parse_abstract(doc) -> - ["Test erl_parse:new_anno/1, erl_parse:anno_to_term/1" - ", and erl_parse:anno_from_term/1"]; -parse_abstract(_Config) -> - T = sample_term(), - A = erl_parse:abstract(T, [{line,17}]), - T1 = erl_parse:anno_to_term(A), - Abstr = erl_parse:new_anno(T1), - T = erl_parse:normalise(Abstr), - Abstr2 = erl_parse:anno_from_term(T1), - T = erl_parse:normalise(Abstr2), - ok. - -mapfold_anno(doc) -> - ["Test erl_parse:{map_anno/2,fold_anno/3, and mapfold_anno/3}"]; -mapfold_anno(_Config) -> - T = sample_term(), - Abstr = erl_parse:abstract(T), - CF = fun(Anno, {L, D}) -> - {erl_anno:new(L), {L+1, dict:store(L, Anno, D)}} - end, - {U, {N, D}} = erl_parse:mapfold_anno(CF, {1, dict:new()}, Abstr), - SeqA = erl_parse:fold_anno(fun(Anno, Acc) -> [Anno|Acc] end, [], U), - Seq = [erl_anno:location(A) || A <- SeqA], - Seq = lists:seq(N-1, 1, -1), - NF = fun(Anno) -> - L = erl_anno:location(Anno), - dict:fetch(L, D) - end, - Abstr = erl_parse:map_anno(NF, U), - ok. - -sample_term() -> - %% This is just a sample. - {3,a,4.0,"foo",<<"bar">>,#{a => <<19:64/unsigned-little>>}, - [1000,2000]}. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -test(StartLocation, Updates) -> - S0 = init(StartLocation), - A0 = erl_anno:new(StartLocation), - chk(S0, A0, []), - eval(Updates, S0, A0). - -eval([], _S0, _A0) -> - ok; -eval([{Item, Value}|Updates], S0, A0) -> - {S, A} = set(Item, Value, A0, S0, []), - eval(Updates, S, A); -eval([{Item, Value, Secondary}|Updates], S0, A0) -> - {S, A} = set(Item, Value, A0, S0, Secondary), - eval(Updates, S, A). - -init({Line, Column}) -> - lists:sort([{location, {Line, Column}} | default()]); -init(Line) when is_integer(Line) -> - lists:sort([{location, Line} | default()]). - -set(Item, Value, Anno0, State0, Secondary) -> - true = lists:member(Item, primary_items()), - ?format("Set '~w' to ~p\n", [Item, Value]), - State = set_value(Item, Value, State0), - Anno = anno_set(Item, Value, Anno0), - ?format("State0 ~p\n", [State0]), - ?format("State ~p\n", [State]), - ?format("Anno0 ~p\n", [anno_to_term(Anno0)]), - ?format("Anno ~p\n", [anno_to_term(Anno)]), - chk(State, Anno, Secondary), - ok = frame(Anno0, Anno, Secondary), - {State, Anno}. - -frame(OldAnno, NewAnno, Secondary) -> - SecItems = [I || {I, _} <- Secondary], - Frame = secondary_items() -- (SecItems ++ primary_items()), - ?format("Frame items ~p\n", [Frame]), - frame1(Frame, OldAnno, NewAnno). - -frame1([], _OldAnno, _NewAnno) -> - ok; -frame1([Item|Items], OldAnno, NewAnno) -> - V1 = anno_info(OldAnno, Item), - V2 = anno_info(NewAnno, Item), - ok = check_value(Item, V1, V2), - frame1(Items, OldAnno, NewAnno). - -chk(State, Anno, Secondary) -> - ok = check_simple(Anno), - ok = chk_primary(State, Anno), - ok = check_secondary(Secondary, State, Anno). - -chk_primary(State, Anno) -> - chk_primary(primary_items(), State, Anno). - -chk_primary([], _State, _Anno) -> - ok; -chk_primary([Item | Items], State, Anno) -> - V1 = primary_value(Item, State), - V2 = anno_info(Anno, Item), - ok = check_value(Item, V1, V2), - chk_primary(Items, State, Anno). - -check_secondary([], _State, _Anno) -> - ok; -check_secondary([{Item, _}=V1 | Secondary], State, Anno) -> - V2 = anno_info(Anno, Item), - case {V1, V2} of - {{Item, undefined}, undefined} -> - ok; - _ -> - ok = check_value(Item, V1, V2) - end, - check_secondary(Secondary, State, Anno). - -check_value(Item, V1, V2) -> - ?format("~w: V1 ~p\n", [Item, V1]), - ?format("~w: V2 ~p\n", [Item, V2]), - case V1 =:= V2 of - true -> - ok; - false -> - io:format("~w: expected ~p\n got ~p\n", [Item, V1, V2]), - exit({V1, V2}) - end. - -check_simple(Anno) -> - Term = anno_to_term(Anno), - case find_defaults(Term) of - [] -> - ok; - Ds -> - io:format("found default values ~w in ~p\n", [Ds, Anno]), - exit({defaults, Anno}) - end, - case check_simple1(Term) of - true -> - ok; - false -> - io:format("not simple ~p\n", [Anno]), - exit({not_simple, Anno}) - end. - -check_simple1(L) when is_integer(L) -> - true; -check_simple1({L, C}) when is_integer(L), is_integer(C) -> - true; -check_simple1(List) -> - case lists:sort(List) of - [{location, _}] -> - false; - _ -> - true - end. - -find_defaults(L) when is_list(L) -> - [I || - I <- default_items(), - {I1, Value} <- L, - I =:= I1, - Value =:= default_value(I)]; -find_defaults(_) -> - []. - -anno_to_term(Anno) -> - T = erl_anno:to_term(Anno), - maybe_sort(T). - -maybe_sort(L) when is_list(L) -> - lists:sort(L); -maybe_sort(T) -> - T. - -anno_set(file, Value, Anno) -> - erl_anno:set_file(Value, Anno); -anno_set(generated, Value, Anno) -> - erl_anno:set_generated(Value, Anno); -anno_set(line, Value, Anno) -> - erl_anno:set_line(Value, Anno); -anno_set(location, Value, Anno) -> - erl_anno:set_location(Value, Anno); -anno_set(record, Value, Anno) -> - erl_anno:set_record(Value, Anno); -anno_set(text, Value, Anno) -> - erl_anno:set_text(Value, Anno). - -anno_info(Anno, Item) -> - Value = - case Item of - column -> - erl_anno:column(Anno); - generated -> - erl_anno:generated(Anno); - end_location -> - erl_anno:end_location(Anno); - file -> - erl_anno:file(Anno); - length -> - case erl_anno:text(Anno) of - undefined -> - undefined; - Text -> - length(Text) - end; - line -> - erl_anno:line(Anno); - location -> - erl_anno:location(Anno); - record -> - erl_anno:record(Anno); - text -> - erl_anno:text(Anno); - _ -> - erlang:error(badarg, [Anno, Item]) - end, - if - Value =:= undefined -> - undefined; - true -> - {Item, Value} - end. - -%%% Originally 'location' was primary while 'line' and 'column' were -%%% secondary (their values are determined by 'location'). But since -%%% set_line() is used kind of frequently, 'line' is also primary, -%%% and 'location' secondary (depends on 'line'). 'line' need to be -%%% handled separately. - -set_value(line, Line, State) -> - {location, Location} = primary_value(location, State), - NewLocation = case Location of - {_, Column} -> - {Line, Column}; - _ -> - Line - end, - set_value(location, NewLocation, State); -set_value(Item, Value, State) -> - lists:ukeymerge(1, [{Item, Value}], State). - -primary_value(line, State) -> - {location, Location} = primary_value(location, State), - {line, case Location of - {Line, _} -> - Line; - Line -> - Line - end}; -primary_value(Item, State) -> - case lists:keyfind(Item, 1, State) of - false -> - undefined; - Tuple -> - Tuple - end. - -default() -> - [{Tag, default_value(Tag)} || Tag <- default_items()]. - -primary_items() -> - [file, generated, line, location, record, text]. - -secondary_items() -> - %% 'length' has not been implemented - [column, end_location, length, line, location]. - -default_items() -> - [generated, record]. - -default_value(generated) -> false; -default_value(record) -> false. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_eval_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/erl_eval_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_eval_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_eval_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -1459,35 +1458,8 @@ "lists:map(fun (X) -> X#{price := 0} end, [#{hello => 0, price => nil}]).", [#{hello => 0, price => 0}]), - check(fun () -> - Map = #{ <<33:333>> => "wat" }, - #{ <<33:333>> := "wat" } = Map - end, - "begin " - " Map = #{ <<33:333>> => \"wat\" }, " - " #{ <<33:333>> := \"wat\" } = Map " - "end.", - #{ <<33:333>> => "wat" }), - check(fun () -> - K1 = 1, - K2 = <<42:301>>, - K3 = {3,K2}, - Map = #{ K1 => 1, K2 => 2, K3 => 3, {2,2} => 4}, - #{ K1 := 1, K2 := 2, K3 := 3, {2,2} := 4} = Map - end, - "begin " - " K1 = 1, " - " K2 = <<42:301>>, " - " K3 = {3,K2}, " - " Map = #{ K1 => 1, K2 => 2, K3 => 3, {2,2} => 4}, " - " #{ K1 := 1, K2 := 2, K3 := 3, {2,2} := 4} = Map " - "end.", - #{ 1 => 1, <<42:301>> => 2, {3,<<42:301>>} => 3, {2,2} => 4}), - error_check("[camembert]#{}.", {badmap,[camembert]}), - error_check("[camembert]#{nonexisting:=v}.", {badmap,[camembert]}), + error_check("[camembert]#{}.", {badarg,[camembert]}), error_check("#{} = 1.", {badmatch,1}), - error_check("[]#{a=>error(bad)}.", bad), - error_check("(#{})#{nonexisting:=value}.", {badkey,nonexisting}), ok. %% Check the string in different contexts: as is; in fun; from compiled code. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_expand_records_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/erl_expand_records_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_expand_records_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_expand_records_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_internal_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/erl_internal_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_internal_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_internal_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2014. All Rights Reserved. +%% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -52,7 +51,7 @@ -define(default_timeout, ?t:minutes(2)). init_per_testcase(_Case, Config) -> - Dog = test_server:timetrap(?default_timeout), + ?line Dog = test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. end_per_testcase(_Case, Config) -> @@ -64,50 +63,27 @@ behav(doc) -> ["Check that the behaviour callbacks are correctly defined"]; behav(_) -> - Modules = [application, gen_server, gen_fsm, gen_event, - supervisor_bridge, supervisor], - lists:foreach(fun check_behav/1, Modules). - -check_behav(Module) -> - Callbacks = callbacks(Module), - Optional = optional_callbacks(Module), - check_behav_list(Callbacks, Module:behaviour_info(callbacks)), - check_behav_list(Optional, Module:behaviour_info(optional_callbacks)). + ?line check_behav_list([{start,2}, {stop,1}], + application:behaviour_info(callbacks)), + ?line check_behav_list([{init,1}, {handle_call,3}, {handle_cast,2}, + {handle_info,2}, {terminate,2}, {code_change,3}], + gen_server:behaviour_info(callbacks)), + ?line check_behav_list([{init,1}, {handle_event,3}, {handle_sync_event,4}, + {handle_info,3}, {terminate,3}, {code_change,4}], + gen_fsm:behaviour_info(callbacks)), + ?line check_behav_list([{init,1}, {handle_event,2}, {handle_call,2}, + {handle_info,2}, {terminate,2}, {code_change,3}], + gen_event:behaviour_info(callbacks)), + ?line check_behav_list( [{init,1}, {terminate,2}], + supervisor_bridge:behaviour_info(callbacks)), + ?line check_behav_list([{init,1}], + supervisor:behaviour_info(callbacks)), + ok. check_behav_list([], []) -> ok; check_behav_list([L | L1], L2) -> - true = lists:member(L, L2), - L3 = lists:delete(L, L2), + ?line true = lists:member(L, L2), + ?line L3 = lists:delete(L, L2), check_behav_list(L1, L3). -callbacks(application) -> - [{start,2}, {stop,1}]; -callbacks(gen_server) -> - [{init,1}, {handle_call,3}, {handle_cast,2}, - {handle_info,2}, {terminate,2}, {code_change,3}, - {format_status,2}]; -callbacks(gen_fsm) -> - [{init,1}, {handle_event,3}, {handle_sync_event,4}, - {handle_info,3}, {terminate,3}, {code_change,4}, - {format_status,2}]; -callbacks(gen_event) -> - [{init,1}, {handle_event,2}, {handle_call,2}, - {handle_info,2}, {terminate,2}, {code_change,3}, - {format_status,2}]; -callbacks(supervisor_bridge) -> - [{init,1}, {terminate,2}]; -callbacks(supervisor) -> - [{init,1}]. - -optional_callbacks(application) -> - []; -optional_callbacks(gen_server) -> - [{format_status,2}]; -optional_callbacks(gen_fsm) -> - [{format_status,2}]; -optional_callbacks(gen_event) -> - [{format_status,2}]; -optional_callbacks(supervisor_bridge) -> - []; -optional_callbacks(supervisor) -> - []. + diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/bad_behaviour1.erl erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/bad_behaviour1.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/bad_behaviour1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/bad_behaviour1.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ --module(bad_behaviour1). - --export([behaviour_info/1]). - -behaviour_info(callbacks) -> - [{a,1,bad}]. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/bad_behaviour2.erl erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/bad_behaviour2.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/bad_behaviour2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/bad_behaviour2.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ --module(bad_behaviour2). - --export([behaviour_info/1]). - -behaviour_info(callbacks) -> - undefined. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback1.erl erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback1.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback1.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ --module(callback1). - --callback b1(I :: integer()) -> atom(). --callback b2(A :: atom()) -> integer(). - --optional_callbacks([{b2,1}]). diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback2.erl erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback2.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback2.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ --module(callback2). - --callback b1(I :: integer()) -> atom(). --callback b2(A :: atom()) -> integer(). - --optional_callbacks([b1/1, b2/1]). diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback3.erl erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback3.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback3.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/callback3.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ --module(callback3). - --export([behaviour_info/1]). - -behaviour_info(callbacks) -> - [{f1, 1}]; -behaviour_info(_) -> - undefined. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/format.erl erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/format.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/format.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/format.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/predef.erl erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/predef.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE_data/predef.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE_data/predef.erl 2014-09-16 19:10:57.000000000 +0000 @@ -5,8 +5,8 @@ -export_type([array/0, digraph/0, gb_set/0]). -%% Since Erlang/OTP 18.0 array() and so on are no longer pre-defined, -%% so there is nothing special about them at all. +%% Before Erlang/OTP 17.0 local re-definitions of pre-defined opaque +%% types were ignored but did not generate any warning. -opaque array() :: atom(). -opaque digraph() :: atom(). -opaque gb_set() :: atom(). diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_lint_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_lint_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. +%% Copyright Ericsson AB 1999-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -43,7 +42,6 @@ unused_vars_warn_rec/1, unused_vars_warn_fun/1, unused_vars_OTP_4858/1, - unused_unsafe_vars_warn/1, export_vars_warn/1, shadow_vars/1, unused_import/1, @@ -57,7 +55,7 @@ otp_11772/1, otp_11771/1, otp_11872/1, export_all/1, bif_clash/1, - behaviour_basic/1, behaviour_multiple/1, otp_11861/1, + behaviour_basic/1, behaviour_multiple/1, otp_7550/1, otp_8051/1, format_warn/1, @@ -65,7 +63,7 @@ too_many_arguments/1, basic_errors/1,bin_syntax_errors/1, predef/1, - maps/1,maps_type/1,otp_11851/1,otp_12195/1 + maps/1,maps_type/1 ]). % Default timetrap timeout (set in init_per_testcase). @@ -91,16 +89,16 @@ otp_5362, otp_5371, otp_7227, otp_5494, otp_5644, otp_5878, otp_5917, otp_6585, otp_6885, otp_10436, otp_11254, otp_11772, otp_11771, otp_11872, export_all, - bif_clash, behaviour_basic, behaviour_multiple, otp_11861, + bif_clash, behaviour_basic, behaviour_multiple, otp_7550, otp_8051, format_warn, {group, on_load}, too_many_arguments, basic_errors, bin_syntax_errors, predef, - maps, maps_type, otp_11851, otp_12195]. + maps, maps_type]. groups() -> [{unused_vars_warn, [], [unused_vars_warn_basic, unused_vars_warn_lc, unused_vars_warn_rec, unused_vars_warn_fun, - unused_vars_OTP_4858, unused_unsafe_vars_warn]}, + unused_vars_OTP_4858]}, {on_load, [], [on_load_successful, on_load_failing]}]. init_per_suite(Config) -> @@ -732,48 +730,6 @@ ?line [] = run(Config, Ts), ok. -unused_unsafe_vars_warn(Config) when is_list(Config) -> - Ts = [{unused_unsafe1, - <<"t1() -> - UnusedVar1 = unused1, - try - UnusedVar2 = unused2 - catch - _:_ -> - ok - end, - ok. - ">>, - [warn_unused_vars], - {warnings,[{2,erl_lint,{unused_var,'UnusedVar1'}}, - {4,erl_lint,{unused_var,'UnusedVar2'}}]}}, - {unused_unsafe2, - <<"t2() -> - try - X = 1 - catch - _:_ -> ok - end. - ">>, - [warn_unused_vars], - {warnings,[{3,erl_lint,{unused_var,'X'}}]}}, - {unused_unsafe2, - <<"t3(X, Y) -> - X andalso Y. - ">>, - [warn_unused_vars], - []}, - {unused_unsafe4, - <<"t4() -> - _ = (catch X = X = 1), - _ = case ok of _ -> fun() -> ok end end, - fun (X) -> X end. - ">>, - [warn_unused_vars], - []}], - run(Config, Ts), - ok. - export_vars_warn(doc) -> "Warnings for exported variables"; export_vars_warn(suite) -> []; @@ -852,19 +808,7 @@ [], {error,[{9,erl_lint,{unbound_var,'B'}}], [{9,erl_lint,{exported_var,'Y',{'receive',2}}}, - {10,erl_lint,{shadowed_var,'B',generate}}]}}, - - {exp4, - <<"t(X) -> - if true -> Z = X end, - case X of - 1 -> Z; - 2 -> X - end, - Z = X. - ">>, - [], - {warnings,[{7,erl_lint,{exported_var,'Z',{'if',2}}}]}} + {10,erl_lint,{shadowed_var,'B',generate}}]}} ], ?line [] = run(Config, Ts), ok. @@ -888,15 +832,8 @@ ">>, [nowarn_shadow_vars], {error,[{9,erl_lint,{unbound_var,'B'}}], - [{9,erl_lint,{exported_var,'Y',{'receive',2}}}]}}, - {shadow2, - <<"t() -> - _ = (catch MS = MS = 1), % MS used unsafe - _ = case ok of _ -> fun() -> ok end end, - fun (MS) -> MS end. % MS not shadowed here - ">>, - [], - []}], + [{9,erl_lint,{exported_var,'Y',{'receive',2}}}]}}], + ?line [] = run(Config, Ts), ok. @@ -1021,45 +958,6 @@ [warn_unused_vars], {errors,[{3,erl_lint,{unsafe_var,'X',{'if',2}}}, {4,erl_lint,{unsafe_var,'X',{'if',2}}}], - []}}, - {unsafe8, - <<"t8(X) -> - case X of _ -> catch _Y = 1 end, - _Y." - >>, - [], - {errors,[{3,erl_lint,{unsafe_var,'_Y',{'catch',2}}}], - []}}, - {unsafe9, - <<"t9(X) -> - case X of - 1 -> - catch A = 1, % unsafe only here - B = 1, - C = 1, - D = 1; - 2 -> - A = 2, - % B not bound here - C = 2, - catch D = 2; % unsafe in two clauses - 3 -> - A = 3, - B = 3, - C = 3, - catch D = 3; % unsafe in two clauses - 4 -> - A = 4, - B = 4, - C = 4, - D = 4 - end, - {A,B,C,D}." - >>, - [], - {errors,[{24,erl_lint,{unsafe_var,'A',{'catch',4}}}, - {24,erl_lint,{unsafe_var,'B',{'case',2}}}, - {24,erl_lint,{unsafe_var,'D',{'case',2}}}], []}} ], ?line [] = run(Config, Ts), @@ -2750,9 +2648,8 @@ t() -> 1. ">>, - {error,[{6,erl_lint,{undefined_type,{product,0}}}, - {8,erl_lint,{undefined_type,{dict,0}}}], - [{8,erl_lint,{new_builtin_type,{map,0}}}]} = + {error,[{6,erl_lint,{undefined_type,{product,0}}}], + [{8,erl_lint,{new_var_arity_type,map}}]} = run_test2(Config, Ts, []), ok. @@ -3183,193 +3080,6 @@ ?line [] = run(Config, Ts), ok. -otp_11861(doc) -> - "OTP-11861. behaviour_info() and -callback."; -otp_11861(suite) -> []; -otp_11861(Conf) when is_list(Conf) -> - CallbackFiles = [callback1, callback2, callback3, - bad_behaviour1, bad_behaviour2], - lists:foreach(fun(M) -> - F = filename:join(?datadir, M), - Opts = [{outdir,?privdir}, return], - {ok, M, []} = compile:file(F, Opts) - end, CallbackFiles), - CodePath = code:get_path(), - true = code:add_path(?privdir), - Ts = [{otp_11861_1, - <<" - -export([b1/1]). - -behaviour(callback1). - -behaviour(callback2). - - -spec b1(atom()) -> integer(). - b1(A) when is_atom(A)-> - 3. - ">>, - [], - %% b2/1 is optional in both modules - {warnings,[{4,erl_lint, - {conflicting_behaviours,{b1,1},callback2,3,callback1}}]}}, - {otp_11861_2, - <<" - -export([b2/1]). - -behaviour(callback1). - -behaviour(callback2). - - -spec b2(integer()) -> atom(). - b2(I) when is_integer(I)-> - a. - ">>, - [], - %% b2/1 is optional in callback2, but not in callback1 - {warnings,[{3,erl_lint,{undefined_behaviour_func,{b1,1},callback1}}, - {4,erl_lint, - {conflicting_behaviours,{b2,1},callback2,3,callback1}}]}}, - {otp_11861_3, - <<" - -callback b(_) -> atom(). - -optional_callbacks({b1,1}). % non-existing and ignored - ">>, - [], - []}, - {otp_11861_4, - <<" - -callback b(_) -> atom(). - -optional_callbacks([{b1,1}]). % non-existing - ">>, - [], - %% No behaviour-info(), but callback. - {errors,[{3,erl_lint,{undefined_callback,{lint_test,b1,1}}}],[]}}, - {otp_11861_5, - <<" - -optional_callbacks([{b1,1}]). % non-existing - ">>, - [], - %% No behaviour-info() and no callback: warning anyway - {errors,[{2,erl_lint,{undefined_callback,{lint_test,b1,1}}}],[]}}, - {otp_11861_6, - <<" - -optional_callbacks([b1/1]). % non-existing - behaviour_info(callbacks) -> [{b1,1}]. - ">>, - [], - %% behaviour-info() and no callback: warning anyway - {errors,[{2,erl_lint,{undefined_callback,{lint_test,b1,1}}}],[]}}, - {otp_11861_7, - <<" - -optional_callbacks([b1/1]). % non-existing - -callback b(_) -> atom(). - behaviour_info(callbacks) -> [{b1,1}]. - ">>, - [], - %% behaviour-info() callback: warning - {errors,[{2,erl_lint,{undefined_callback,{lint_test,b1,1}}}, - {3,erl_lint,{behaviour_info,{lint_test,b,1}}}], - []}}, - {otp_11861_8, - <<" - -callback b(_) -> atom(). - -optional_callbacks([b/1, {b, 1}]). - ">>, - [], - {errors,[{3,erl_lint,{redefine_optional_callback,{b,1}}}],[]}}, - {otp_11861_9, - <<" - -behaviour(gen_server). - -export([handle_call/3,handle_cast/2,handle_info/2, - code_change/3, init/1, terminate/2]). - handle_call(_, _, _) -> ok. - handle_cast(_, _) -> ok. - handle_info(_, _) -> ok. - code_change(_, _, _) -> ok. - init(_) -> ok. - terminate(_, _) -> ok. - ">>, - [], - []}, - {otp_11861_9, - <<" - -behaviour(gen_server). - -export([handle_call/3,handle_cast/2,handle_info/2, - code_change/3, init/1, terminate/2, format_status/2]). - handle_call(_, _, _) -> ok. - handle_cast(_, _) -> ok. - handle_info(_, _) -> ok. - code_change(_, _, _) -> ok. - init(_) -> ok. - terminate(_, _) -> ok. - format_status(_, _) -> ok. % optional callback - ">>, - [], - %% Nothing... - []}, - {otp_11861_10, - <<" - -optional_callbacks([{b1,1,bad}]). % badly formed and ignored - behaviour_info(callbacks) -> [{b1,1}]. - ">>, - [], - []}, - {otp_11861_11, - <<" - -behaviour(bad_behaviour1). - ">>, - [], - {warnings,[{2,erl_lint, - {ill_defined_behaviour_callbacks,bad_behaviour1}}]}}, - {otp_11861_12, - <<" - -behaviour(non_existing_behaviour). - ">>, - [], - {warnings,[{2,erl_lint, - {undefined_behaviour,non_existing_behaviour}}]}}, - {otp_11861_13, - <<" - -behaviour(bad_behaviour_none). - ">>, - [], - {warnings,[{2,erl_lint,{undefined_behaviour,bad_behaviour_none}}]}}, - {otp_11861_14, - <<" - -callback b(_) -> atom(). - ">>, - [], - []}, - {otp_11861_15, - <<" - -optional_callbacks([{b1,1,bad}]). % badly formed - -callback b(_) -> atom(). - ">>, - [], - []}, - {otp_11861_16, - <<" - -callback b(_) -> atom(). - -callback b(_) -> atom(). - ">>, - [], - {errors,[{3,erl_lint,{redefine_callback,{b,1}}}],[]}}, - {otp_11861_17, - <<" - -behaviour(bad_behaviour2). - ">>, - [], - {warnings,[{2,erl_lint,{undefined_behaviour_callbacks, - bad_behaviour2}}]}}, - {otp_11861_18, - <<" - -export([f1/1]). - -behaviour(callback3). - f1(_) -> ok. - ">>, - [], - []} - ], - ?line [] = run(Conf, Ts), - true = code:set_path(CodePath), - ok. - otp_7550(doc) -> "Test that the new utf8/utf16/utf32 types do not allow size or unit specifiers."; otp_7550(Config) when is_list(Config) -> @@ -3435,8 +3145,8 @@ ok. format_level(Level, Count, Config) -> - ?line W = get_compilation_result(Config, "format", - [{warn_format, Level}]), + ?line W = get_compilation_warnings(Config, "format", + [{warn_format, Level}]), %% Pick out the 'format' warnings. ?line FW = lists:filter(fun({_Line, erl_lint, {format_error, _}}) -> true; (_) -> false @@ -3604,10 +3314,7 @@ t(<>) -> X; t(<>) -> X; t(<< <<_:8>> >>) -> ok; - t(<<(x ! y):8/integer>>) -> ok; - t(X) -> - {<>,<>, - <>,<>}. + t(<<(x ! y):8/integer>>) -> ok. ">>, [], {error,[{1,erl_lint,illegal_bitsize}, @@ -3616,34 +3323,49 @@ {4,erl_lint,{undefined_bittype,bad_type}}, {5,erl_lint,bittype_unit}, {7,erl_lint,illegal_pattern}, - {8,erl_lint,illegal_pattern}, - {10,erl_lint,{bittype_mismatch,integer,binary,"type"}}, - {10,erl_lint,{bittype_mismatch,unsigned,signed,"sign"}}, - {11,erl_lint,{bittype_mismatch,8,4,"unit"}}, - {11,erl_lint,{bittype_mismatch,big,little,"endianness"}} - ], + {8,erl_lint,illegal_pattern}], [{6,erl_lint,{bad_bitsize,"float"}}]}} ], [] = run(Config, Ts), ok. predef(doc) -> - "OTP-10342: No longer predefined types: array(), digraph(), and so on"; + "OTP-10342: Predefined types: array(), digraph(), and so on"; predef(suite) -> []; predef(Config) when is_list(Config) -> - W = get_compilation_result(Config, "predef", []), + W = get_compilation_warnings(Config, "predef", []), [] = W, - %% dict(), digraph() and so on were removed in Erlang/OTP 18.0. - E2 = get_compilation_result(Config, "predef2", []), - Tag = undefined_type, - {[{7,erl_lint,{Tag,{array,0}}}, - {12,erl_lint,{Tag,{dict,0}}}, - {17,erl_lint,{Tag,{digraph,0}}}, - {27,erl_lint,{Tag,{gb_set,0}}}, - {32,erl_lint,{Tag,{gb_tree,0}}}, - {37,erl_lint,{Tag,{queue,0}}}, - {42,erl_lint,{Tag,{set,0}}}, - {47,erl_lint,{Tag,{tid,0}}}],[]} = E2, + W2 = get_compilation_warnings(Config, "predef2", []), + Tag = deprecated_builtin_type, + [{7,erl_lint,{Tag,{array,0},{array,array,1},"OTP 18.0"}}, + {12,erl_lint,{Tag,{dict,0},{dict,dict,2},"OTP 18.0"}}, + {17,erl_lint,{Tag,{digraph,0},{digraph,graph},"OTP 18.0"}}, + {27,erl_lint,{Tag,{gb_set,0},{gb_sets,set,1},"OTP 18.0"}}, + {32,erl_lint,{Tag,{gb_tree,0},{gb_trees,tree,2},"OTP 18.0"}}, + {37,erl_lint,{Tag,{queue,0},{queue,queue,1},"OTP 18.0"}}, + {42,erl_lint,{Tag,{set,0},{sets,set,1},"OTP 18.0"}}, + {47,erl_lint,{Tag,{tid,0},{ets,tid},"OTP 18.0"}}] = W2, + Ts = [{otp_10342_1, + <<"-compile(nowarn_deprecated_type). + + -spec t(dict()) -> non_neg_integer(). + + t(D) -> + erlang:phash2(D, 3000). + ">>, + {[nowarn_unused_function]}, + []}, + {otp_10342_2, + <<"-spec t(dict()) -> non_neg_integer(). + + t(D) -> + erlang:phash2(D, 3000). + ">>, + {[nowarn_unused_function]}, + {warnings,[{1,erl_lint, + {deprecated_builtin_type,{dict,0},{dict,dict,2}, + "OTP 18.0"}}]}}], + [] = run(Config, Ts), ok. maps(Config) -> @@ -3676,8 +3398,7 @@ g := 1 + 1, h := _, i := (_X = _Y), - j := (x ! y), - <<0:300>> := 33}) -> + j := (x ! y) }) -> {A,F}. ">>, [], @@ -3690,10 +3411,9 @@ {errors,[{1,erl_lint,illegal_map_construction}, {1,erl_lint,{unbound_var,'X'}}], []}}, - {legal_map_construction, + {errors_in_map_keys, <<"t(V) -> #{ a => 1, #{a=>V} => 2, - #{{a,V}=>V} => 2, #{ \"hi\" => wazzup, hi => ho } => yep, [try a catch _:_ -> b end] => nope, ok => 1.0, @@ -3705,7 +3425,11 @@ }. ">>, [], - []}, + {errors,[{2,erl_lint,{illegal_map_key_variable,'V'}}, + {4,erl_lint,illegal_map_key}, + {6,erl_lint,illegal_map_key}, + {8,erl_lint,illegal_map_key}, + {10,erl_lint,illegal_map_key}],[]}}, {errors_in_map_keys_pattern, <<"t(#{ a := 2, #{} := A, @@ -3716,14 +3440,8 @@ A. ">>, [], - {errors,[{4,erl_lint,illegal_map_construction}, - {6,erl_lint,illegal_map_key}],[]}}, - {unused_vars_with_empty_maps, - <<"t(Foo, Bar, Baz) -> {#{},#{}}.">>, - [warn_unused_variables], - {warnings,[{1,erl_lint,{unused_var,'Bar'}}, - {1,erl_lint,{unused_var,'Baz'}}, - {1,erl_lint,{unused_var,'Foo'}}]}}], + {errors,[{4,erl_lint,illegal_map_key}, + {6,erl_lint,{illegal_map_key_variable,'V'}}],[]}}], [] = run(Config, Ts), ok. @@ -3752,128 +3470,7 @@ t(M) -> M. ">>, [], - {warnings,[{3,erl_lint,{new_builtin_type,{map,0}}}]}}], - [] = run(Config, Ts), - ok. - -otp_11851(doc) -> - "OTP-11851: More atoms can be used as type names + bug fixes."; -otp_11851(Config) when is_list(Config) -> - Ts = [ - {otp_11851_1, - <<"-export([t/0]). - -type range(A, B) :: A | B. - - -type union(A) :: A. - - -type product() :: integer(). - - -type tuple(A) :: A. - - -type map(A) :: A. - - -type record() :: a | b. - - -type integer(A) :: A. - - -type atom(A) :: A. - - -type binary(A, B) :: A | B. - - -type 'fun'() :: integer(). - - -type 'fun'(X) :: X. - - -type 'fun'(X, Y) :: X | Y. - - -type all() :: range(atom(), integer()) | union(pid()) | product() - | tuple(reference()) | map(function()) | record() - | integer(atom()) | atom(integer()) - | binary(pid(), tuple()) | 'fun'(port()) - | 'fun'() | 'fun'(<<>>, 'none'). - - -spec t() -> all(). - - t() -> - a. - ">>, - [], - []}, - {otp_11851_2, - <<"-export([a/1, b/1, t/0]). - - -callback b(_) -> integer(). - - -callback ?MODULE:a(_) -> integer(). - - a(_) -> 3. - - b(_) -> a. - - t()-> a. - ">>, - [], - {errors,[{5,erl_lint,{bad_callback,{lint_test,a,1}}}],[]}}, - {otp_11851_3, - <<"-export([a/1]). - - -spec a(_A) -> boolean() when - _ :: atom(), - _A :: integer(). - - a(_) -> true. - ">>, - [], - {errors,[{4,erl_parse,"bad type variable"}],[]}}, - {otp_11851_4, - <<" - -spec a(_) -> ok. - -spec a(_) -> ok. - - -spec ?MODULE:a(_) -> ok. - -spec ?MODULE:a(_) -> ok. - ">>, - [], - {errors,[{3,erl_lint,{redefine_spec,{a,1}}}, - {5,erl_lint,{redefine_spec,{lint_test,a,1}}}, - {6,erl_lint,{redefine_spec,{lint_test,a,1}}}, - {6,erl_lint,{spec_fun_undefined,{a,1}}}], - []}} - ], - [] = run(Config, Ts), - ok. - -otp_12195(doc) -> - "OTP-12195: Check obsolete types (tailor made for OTP 18)."; -otp_12195(Config) when is_list(Config) -> - Ts = [{otp_12195_1, - <<"-export_type([r1/0]). - -type r1() :: erl_scan:line() - | erl_scan:column() - | erl_scan:location() - | erl_anno:line().">>, - [], - {warnings,[{2,erl_lint, - {deprecated_type,{erl_scan,line,0}, - "deprecated (will be removed in OTP 19); " - "use erl_anno:line() instead"}}, - {3,erl_lint, - {deprecated_type,{erl_scan,column,0}, - "deprecated (will be removed in OTP 19); use " - "erl_anno:column() instead"}}, - {4,erl_lint, - {deprecated_type,{erl_scan,location,0}, - "deprecated (will be removed in OTP 19); " - "use erl_anno:location() instead"}}]}}, - {otp_12195_2, - <<"-export_type([r1/0]). - -compile(nowarn_deprecated_type). - -type r1() :: erl_scan:line() - | erl_scan:column() - | erl_scan:location() - | erl_anno:line().">>, - [], - []}], + {warnings,[{3,erl_lint,{new_var_arity_type,map}}]}}], [] = run(Config, Ts), ok. @@ -3890,9 +3487,9 @@ end, lists:foldl(F, [], Tests). -%% Compiles a test file and returns the list of warnings/errors. +%% Compiles a test file and returns the list of warnings. -get_compilation_result(Conf, Filename, Warnings) -> +get_compilation_warnings(Conf, Filename, Warnings) -> ?line DataDir = ?datadir, ?line File = filename:join(DataDir, Filename), {ok,Bin} = file:read_file(File++".erl"), @@ -3901,7 +3498,6 @@ Test = lists:nthtail(Start+Length, FileS), case run_test(Conf, Test, Warnings) of {warnings, Ws} -> Ws; - {errors,Es,Ws} -> {Es,Ws}; [] -> [] end. @@ -3928,35 +3524,22 @@ %% is no reason to produce an output file since we are only %% interested in the errors and warnings. - %% Print warnings, call erl_lint:format_error/1. (But note that - %% the compiler will ignore failing calls to erl_lint:format_error/1.) + %% Print warnings, call erl_lint:format_error/1. compile:file(File, [binary,report|Opts]), case compile:file(File, [binary|Opts]) of - {ok, _M, Code, Ws} when is_binary(Code) -> - warnings(File, Ws); - {error, [{File,Es}], []} -> - {errors, call_format_error(Es), []}; - {error, [{File,Es}], [{File,Ws}]} -> - {error, call_format_error(Es), call_format_error(Ws)}; - {error, [{File,Es1},{File,Es2}], []} -> - {errors2, Es1, Es2} + {ok, _M, Code, Ws} when is_binary(Code) -> warnings(File, Ws); + {error, [{File,Es}], []} -> {errors, Es, []}; + {error, [{File,Es}], [{File,Ws}]} -> {error, Es, Ws}; + {error, [{File,Es1},{File,Es2}], []} -> {errors2, Es1, Es2} end. warnings(File, Ws) -> case lists:append([W || {F, W} <- Ws, F =:= File]) of - [] -> - []; - L -> - {warnings, call_format_error(L)} + [] -> []; + L -> {warnings, L} end. -call_format_error(L) -> - %% Smoke test of format_error/1 to make sure that no crashes - %% slip through. - _ = [Mod:format_error(Term) || {_,Mod,Term} <- L], - L. - fail() -> io:format("failed~n"), ?t:fail(). diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_pp_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/erl_pp_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_pp_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_pp_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2015. All Rights Reserved. +%% Copyright Ericsson AB 2006-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -43,6 +42,7 @@ -export([ func/1, call/1, recs/1, try_catch/1, if_then/1, receive_after/1, bits/1, head_tail/1, cond1/1, block/1, case1/1, ops/1, messages/1, + old_mnemosyne_syntax/1, import_export/1, misc_attrs/1, dialyzer_attrs/1, hook/1, neg_indent/1, @@ -50,7 +50,7 @@ otp_6321/1, otp_6911/1, otp_6914/1, otp_8150/1, otp_8238/1, otp_8473/1, otp_8522/1, otp_8567/1, otp_8664/1, otp_9147/1, - otp_10302/1, otp_10820/1, otp_11100/1, otp_11861/1]). + otp_10302/1, otp_10820/1, otp_11100/1]). %% Internal export. -export([ehook/6]). @@ -77,13 +77,13 @@ [{expr, [], [func, call, recs, try_catch, if_then, receive_after, bits, head_tail, cond1, block, case1, ops, - messages, maps_syntax + messages, old_mnemosyne_syntax, maps_syntax ]}, {attributes, [], [misc_attrs, import_export, dialyzer_attrs]}, {tickets, [], [otp_6321, otp_6911, otp_6914, otp_8150, otp_8238, otp_8473, otp_8522, otp_8567, otp_8664, otp_9147, - otp_10302, otp_10820, otp_11100, otp_11861]}]. + otp_10302, otp_10820, otp_11100]}]. init_per_suite(Config) -> Config. @@ -491,7 +491,7 @@ [{cons,3,{atom,3,a},{cons,3,{atom,3,b},{nil,3}}}]}, {clause,4,[],[[{atom,4,true}]], [{tuple,5,[{atom,5,x},{atom,5,y}]}]}]}, - CChars = flat_expr1(C), + ?line CChars = lists:flatten(erl_pp:expr(C)), % ?line "cond {foo,bar} -> [a,b]; true -> {x,y} end" = CChars, ?line "cond\n" " {foo,bar} ->\n" @@ -558,9 +558,30 @@ lists:flatten(erl_pp:form({error,{some,"error"}})), ?line true = "{warning,{some,\"warning\"}}\n" =:= lists:flatten(erl_pp:form({warning,{some,"warning"}})), - "\n" = flat_form({eof,0}), + ?line true = "\n" =:= lists:flatten(erl_pp:form({eof,0})), + ok. + +old_mnemosyne_syntax(Config) when is_list(Config) -> + %% Since we have kept the ':-' token, + %% better test that we can pretty print it. + R = {rule,12,sales,2, + [{clause,12, + [{var,12,'E'},{atom,12,employee}], + [], + [{generate,13, + {var,13,'E'}, + {call,13,{atom,13,table},[{atom,13,employee}]}}, + {match,14, + {record_field,14,{var,14,'E'},{atom,14,salary}}, + {atom,14,sales}}]}]}, + ?line "sales(E, employee) :-\n" + " E <- table(employee),\n" + " E.salary = sales.\n" = + lists:flatten(erl_pp:form(R)), ok. + + import_export(suite) -> []; import_export(Config) when is_list(Config) -> @@ -583,20 +604,20 @@ misc_attrs(suite) -> []; misc_attrs(Config) when is_list(Config) -> - ok = pp_forms(<<"-module(m). ">>), - ok = pp_forms(<<"-module(m, [Aafjlksfjdlsjflsdfjlsdjflkdsfjlk," - "Blsjfdlslfjsdf]). ">>), - ok = pp_forms(<<"-export([]). ">>), - ok = pp_forms(<<"-export([foo/2, bar/0]). ">>), - ok = pp_forms(<<"-export([bar/0]). ">>), - ok = pp_forms(<<"-import(lists, []). ">>), - ok = pp_forms(<<"-import(lists, [map/2]). ">>), - ok = pp_forms(<<"-import(lists, [map/2, foreach/2]). ">>), - ok = pp_forms(<<"-'wild '({attr2,3}). ">>), - ok = pp_forms(<<"-record(a, {b,c}). ">>), - ok = pp_forms(<<"-record(' a ', {}). ">>), - ok = pp_forms(<<"-record(' a ', {foo = foo:bar()}). ">>), - ok = pp_forms(<<"-custom1(#{test1 => init/2, test2 => [val/1, val/2]}). ">>), + ?line ok = pp_forms(<<"-module(m). ">>), + ?line ok = pp_forms(<<"-module(m, [Aafjlksfjdlsjflsdfjlsdjflkdsfjlk," + "Blsjfdlslfjsdf]). ">>), + ?line ok = pp_forms(<<"-export([]). ">>), + ?line ok = pp_forms(<<"-export([foo/2, bar/0]). ">>), + ?line ok = pp_forms(<<"-export([bar/0]). ">>), + ?line ok = pp_forms(<<"-import(lists, []). ">>), + ?line ok = pp_forms(<<"-import(lists, [map/2]). ">>), + ?line ok = pp_forms(<<"-import(lists, [map/2, foreach/2]). ">>), + ?line ok = pp_forms(<<"-'wild '({attr2,3}). ">>), + ?line ok = pp_forms(<<"-record(a, {b,c}). ">>), + ?line ok = pp_forms(<<"-record(' a ', {}). ">>), + ?line ok = pp_forms(<<"-record(' a ', {foo = foo:bar()}). ">>), + ok. dialyzer_attrs(suite) -> @@ -617,41 +638,59 @@ do_hook(HookFun) -> Lc = parse_expr(binary_to_list(<<"[X || X <- [1,2,3]].">>)), H = HookFun(fun hook/4), - A0 = erl_anno:new(0), - Expr = {call,A0,{atom,A0,fff},[{foo,Lc},{foo,Lc},{foo,Lc}]}, + Expr = {call,0,{atom,0,fff},[{foo,Lc},{foo,Lc},{foo,Lc}]}, EChars = lists:flatten(erl_pp:expr(Expr, 0, H)), - Call = {call,A0,{atom,A0,foo},[Lc]}, - Expr2 = {call,A0,{atom,A0,fff},[Call,Call,Call]}, + Call = {call,0,{atom,0,foo},[Lc]}, + Expr2 = {call,0,{atom,0,fff},[Call,Call,Call]}, EChars2 = erl_pp:exprs([Expr2]), ?line true = EChars =:= lists:flatten(EChars2), EsChars = erl_pp:exprs([Expr], H), ?line true = EChars =:= lists:flatten(EsChars), - A1 = erl_anno:new(1), - F = {function,A1,ffff,0,[{clause,A1,[],[],[Expr]}]}, + F = {function,1,ffff,0,[{clause,1,[],[],[Expr]}]}, FuncChars = lists:flatten(erl_pp:function(F, H)), - F2 = {function,A1,ffff,0,[{clause,A1,[],[],[Expr2]}]}, + F2 = {function,1,ffff,0,[{clause,1,[],[],[Expr2]}]}, FuncChars2 = erl_pp:function(F2), ?line true = FuncChars =:= lists:flatten(FuncChars2), FFormChars = erl_pp:form(F, H), ?line true = FuncChars =:= lists:flatten(FFormChars), - A = {attribute,A1,record,{r,[{record_field,A1,{atom,A1,a},Expr}]}}, + A = {attribute,1,record,{r,[{record_field,1,{atom,1,a},Expr}]}}, AChars = lists:flatten(erl_pp:attribute(A, H)), - A2 = {attribute,A1,record,{r,[{record_field,A1,{atom,A1,a},Expr2}]}}, + A2 = {attribute,1,record,{r,[{record_field,1,{atom,1,a},Expr2}]}}, AChars2 = erl_pp:attribute(A2), ?line true = AChars =:= lists:flatten(AChars2), AFormChars = erl_pp:form(A, H), ?line true = AChars =:= lists:flatten(AFormChars), + R = {rule,0,sales,0, + [{clause,0,[{var,0,'E'},{atom,0,employee}],[], + [{generate,2,{var,2,'E'}, + {call,2,{atom,2,table},[{atom,2,employee}]}}, + {match,3, + {record_field,3,{var,3,'E'},{atom,3,salary}}, + {foo,Expr}}]}]}, + RChars = lists:flatten(erl_pp:rule(R, H)), + R2 = {rule,0,sales,0, + [{clause,0,[{var,0,'E'},{atom,0,employee}],[], + [{generate,2,{var,2,'E'}, + {call,2,{atom,2,table},[{atom,2,employee}]}}, + {match,3, + {record_field,3,{var,3,'E'},{atom,3,salary}}, + {call,0,{atom,0,foo},[Expr2]}}]}]}, + RChars2 = erl_pp:rule(R2), + ?line true = RChars =:= lists:flatten(RChars2), + ARChars = erl_pp:form(R, H), + ?line true = RChars =:= lists:flatten(ARChars), + ?line "INVALID-FORM:{foo,bar}:" = lists:flatten(erl_pp:expr({foo,bar})), %% A list (as before R6), not a list of lists. - G = [{op,A1,'>',{atom,A1,a},{foo,{atom,A1,b}}}], % not a proper guard + G = [{op,1,'>',{atom,1,a},{foo,{atom,1,b}}}], % not a proper guard GChars = lists:flatten(erl_pp:guard(G, H)), - G2 = [{op,A1,'>',{atom,A1,a}, - {call,A0,{atom,A0,foo},[{atom,A1,b}]}}], % not a proper guard + G2 = [{op,1,'>',{atom,1,a}, + {call,0,{atom,0,foo},[{atom,1,b}]}}], % not a proper guard GChars2 = erl_pp:guard(G2), ?line true = GChars =:= lists:flatten(GChars2), @@ -662,14 +701,14 @@ ?line true = EChars =:= lists:flatten(XEChars2), %% Note: no leading spaces before "begin". - Block = {block,A0,[{match,A0,{var,A0,'A'},{integer,A0,3}}, - {atom,A0,true}]}, + Block = {block,0,[{match,0,{var,0,'A'},{integer,0,3}}, + {atom,0,true}]}, ?line "begin\n A =" ++ _ = lists:flatten(erl_pp:expr(Block, 17, none)), %% Special... ?line true = - "{some,value}" =:= lists:flatten(erl_pp:expr({value,A0,{some,value}})), + "{some,value}" =:= lists:flatten(erl_pp:expr({value,0,{some,value}})), %% Silly... ?line true = @@ -677,8 +716,8 @@ flat_expr({'if',0,[{clause,0,[],[],[{atom,0,0}]}]}), %% More compatibility: before R6 - OldIf = {'if',A0,[{clause,A0,[],[{atom,A0,true}],[{atom,A0,b}]}]}, - NewIf = {'if',A0,[{clause,A0,[],[[{atom,A0,true}]],[{atom,A0,b}]}]}, + OldIf = {'if',0,[{clause,0,[],[{atom,0,true}],[{atom,0,b}]}]}, + NewIf = {'if',0,[{clause,0,[],[[{atom,0,true}]],[{atom,0,b}]}]}, OldIfChars = lists:flatten(erl_pp:expr(OldIf)), NewIfChars = lists:flatten(erl_pp:expr(NewIf)), ?line true = OldIfChars =:= NewIfChars, @@ -694,8 +733,7 @@ hook(HE, I, P, H). hook({foo,E}, I, P, H) -> - A = erl_anno:new(0), - erl_pp:expr({call,A,{atom,A,foo},[E]}, I, P, H). + erl_pp:expr({call,0,{atom,0,foo},[E]}, I, P, H). neg_indent(suite) -> []; @@ -778,7 +816,7 @@ {var,6,'X'}, [{clause,7,[{atom,7,true}],[],[{integer,7,12}]}, {clause,8,[{atom,8,false}],[],[{integer,8,14}]}]}]}]}, - Chars = flat_form(F), + ?line Chars = lists:flatten(erl_pp:form(F)), ?line "thomas(X) ->\n" " case X of\n" " true ->\n" @@ -836,7 +874,6 @@ {ex3,<<"-type paren() :: (ann2()). ">>}, {ex4,<<"-type t1() :: atom(). ">>}, {ex5,<<"-type t2() :: [t1()]. ">>}, - {ex56,<<"-type integer(A) :: A. ">>}, {ex6,<<"-type t3(Atom) :: integer(Atom). ">>}, {ex7,<<"-type '\\'t::4'() :: t3('\\'foobar'). ">>}, {ex8,<<"-type t5() :: {t1(), t3(foo)}. ">>}, @@ -960,9 +997,6 @@ "-compile(export_all).\n" "-type t1() :: map().\n" "-type t2() :: #{ atom() => integer(), atom() => float() }.\n" - "-type u() :: #{a => (I :: integer()) | (A :: atom()),\n" - " (X :: atom()) | (Y :: atom()) =>\n" - " (I :: integer()) | (A :: atom())}.\n" "-spec f1(t1()) -> 'true'.\n" "f1(M) when is_map(M) -> true.\n" "-spec f2(t2()) -> integer().\n" @@ -1091,11 +1125,10 @@ Opts = [{hook, fun unicode_hook/4},{encoding,unicode}], Lc = parse_expr("[X || X <- [\"\x{400}\",\"\xFF\"]]."), - A0 = erl_anno:new(0), - Expr = {call,A0,{atom,A0,fff},[{foo,{foo,Lc}},{foo,{foo,Lc}}]}, + Expr = {call,0,{atom,0,fff},[{foo,{foo,Lc}},{foo,{foo,Lc}}]}, EChars = lists:flatten(erl_pp:expr(Expr, 0, Opts)), - Call = {call,A0,{atom,A0,foo},[{call,A0,{atom,A0,foo},[Lc]}]}, - Expr2 = {call,A0,{atom,A0,fff},[Call,Call]}, + Call = {call,0,{atom,0,foo},[{call,0,{atom,0,foo},[Lc]}]}, + Expr2 = {call,0,{atom,0,fff},[Call,Call]}, EChars2 = erl_pp:exprs([Expr2], U), EChars = lists:flatten(EChars2), [$\x{400},$\x{400}] = [C || C <- EChars, C > 255], @@ -1105,8 +1138,7 @@ ok. unicode_hook({foo,E}, I, P, H) -> - A = erl_anno:new(0), - erl_pp:expr({call,A,{atom,A,foo},[E]}, I, P, H). + erl_pp:expr({call,0,{atom,0,foo},[E]}, I, P, H). otp_10820(doc) -> "OTP-10820. Unicode filenames."; @@ -1146,45 +1178,34 @@ %% Cannot trigger the use of the hook function with export/import. "-export([{fy,a}/b]).\n" = pf({attribute,1,export,[{{fy,a},b}]}), - A1 = erl_anno:new(1), "-type foo() :: integer(INVALID-FORM:{foo,bar}:).\n" = - pf({attribute,A1,type,{foo,{type,A1,integer,[{foo,bar}]},[]}}), - pf({attribute,A1,type, - {a,{type,A1,range,[{integer,A1,1},{foo,bar}]},[]}}), + pf({attribute,1,type,{foo,{type,1,integer,[{foo,bar}]},[]}}), + pf({attribute,1,type, + {a,{type,1,range,[{integer,1,1},{foo,bar}]},[]}}), "-type foo(INVALID-FORM:{foo,bar}:) :: A.\n" = - pf({attribute,A1,type,{foo,{var,A1,'A'},[{foo,bar}]}}), - "-type foo() :: INVALID-FORM:{foo,bar}: :: [].\n" = - pf({attribute,A1,type, - {foo,{paren_type,A1, - [{ann_type,A1,[{foo,bar},{type,A1,nil,[]}]}]}, + pf({attribute,1,type,{foo,{var,1,'A'},[{foo,bar}]}}), + "-type foo() :: (INVALID-FORM:{foo,bar}: :: []).\n" = + pf({attribute,1,type, + {foo,{paren_type,1, + [{ann_type,1,[{foo,bar},{type,1,nil,[]}]}]}, []}}), "-type foo() :: <<_:INVALID-FORM:{foo,bar}:>>.\n" = - pf({attribute,A1,type, - {foo,{type,A1,binary,[{foo,bar},{integer,A1,0}]},[]}}), + pf({attribute,1,type, + {foo,{type,1,binary,[{foo,bar},{integer,1,0}]},[]}}), "-type foo() :: <<_:10, _:_*INVALID-FORM:{foo,bar}:>>.\n" = - pf({attribute,A1,type, - {foo,{type,A1,binary,[{integer,A1,10},{foo,bar}]},[]}}), + pf({attribute,1,type, + {foo,{type,1,binary,[{integer,1,10},{foo,bar}]},[]}}), "-type foo() :: #r{INVALID-FORM:{foo,bar}: :: integer()}.\n" = - pf({attribute,A1,type, - {foo,{type,A1,record, - [{atom,A1,r}, - {type,A1,field_type, - [{foo,bar},{type,A1,integer,[]}]}]}, + pf({attribute,1,type, + {foo,{type,1,record, + [{atom,1,r}, + {type,1,field_type, + [{foo,bar},{type,1,integer,[]}]}]}, []}}), ok. -otp_11861(doc) -> - "OTP-11861. behaviour_info() and -callback."; -otp_11861(suite) -> []; -otp_11861(Config) when is_list(Config) -> - "-optional_callbacks([bar/0]).\n" = - pf({attribute,3,optional_callbacks,[{bar,0}]}), - "-optional_callbacks([{bar,1,bad}]).\n" = - pf({attribute,4,optional_callbacks,[{bar,1,bad}]}), - ok. - pf(Form) -> - lists:flatten(erl_pp:form(Form, none)). + lists:flatten(erl_pp:form(Form,none)). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1249,18 +1270,9 @@ <> = Bin, R. -flat_expr1(Expr0) -> - Expr = erl_parse:new_anno(Expr0), - lists:flatten(erl_pp:expr(Expr)). - -flat_expr(Expr0) -> - Expr = erl_parse:new_anno(Expr0), +flat_expr(Expr) -> lists:flatten(erl_pp:expr(Expr, -1, none)). -flat_form(Form0) -> - Form = erl_parse:new_anno(Form0), - lists:flatten(erl_pp:form(Form)). - pp_forms(Bin) -> pp_forms(Bin, none). diff -Nru erlang-18.2-dfsg/lib/stdlib/test/erl_scan_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/erl_scan_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/erl_scan_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/erl_scan_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2015. All Rights Reserved. +%% Copyright Ericsson AB 1998-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -139,7 +138,7 @@ A1s = [$h,$ä,$r], A2s = [$ö,$r,$e], %% Test parsing atom and variable characters. - {ok,Ts1,_} = erl_scan_string(V1s ++ " " ++ V2s ++ + {ok,Ts1,_} = erl_scan:string(V1s ++ " " ++ V2s ++ "\327" ++ A1s ++ " " ++ A2s), V1s = atom_to_list(element(3, nth(1, Ts1))), @@ -152,7 +151,7 @@ %% Test parsing and printing strings. S1 = V1s ++ "\327" ++ A1s ++ "\250" ++ A2s, S1s = "\"" ++ S1 ++ "\"", - {ok,Ts2,_} = erl_scan_string(S1s), + {ok,Ts2,_} = erl_scan:string(S1s), S1 = element(3, nth(1, Ts2)), S1s = flatten(print(element(3, nth(1, Ts2)))), ok %It all worked @@ -220,14 +219,14 @@ test_string([39,65,200,39], [{atom,{1,1},'AÈ'}]), test_string("ärlig östen", [{atom,{1,1},ärlig},{atom,{1,7},östen}]), ?line {ok,[{atom,_,'$a'}],{1,6}} = - erl_scan_string("'$\\a'", {1,1}), + erl_scan:string("'$\\a'", {1,1}), ?line test("'$\\a'"), ok. punctuations() -> L = ["<<", "<-", "<=", "<", ">>", ">=", ">", "->", "--", "-", "++", "+", "=:=", "=/=", "=<", "=>", "==", "=", "/=", - "/", "||", "|", ":=", "::", ":"], + "/", "||", "|", ":=", ":-", "::", ":"], %% One token at a time: [begin W = list_to_atom(S), @@ -269,24 +268,24 @@ comments() -> ?line test("a %%\n b"), - {ok,[],1} = erl_scan_string("%"), + ?line {ok,[],1} = erl_scan:string("%"), ?line test("a %%\n b"), {ok,[{atom,{1,1},a},{atom,{2,2},b}],{2,3}} = - erl_scan_string("a %%\n b", {1,1}), + erl_scan:string("a %%\n b",{1,1}), {ok,[{atom,{1,1},a},{comment,{1,3},"%%"},{atom,{2,2},b}],{2,3}} = - erl_scan_string("a %%\n b",{1,1}, [return_comments]), + erl_scan:string("a %%\n b",{1,1}, [return_comments]), {ok,[{atom,{1,1},a}, {white_space,{1,2}," "}, {white_space,{1,5},"\n "}, {atom,{2,2},b}], {2,3}} = - erl_scan_string("a %%\n b",{1,1},[return_white_spaces]), + erl_scan:string("a %%\n b",{1,1},[return_white_spaces]), {ok,[{atom,{1,1},a}, {white_space,{1,2}," "}, {comment,{1,3},"%%"}, {white_space,{1,5},"\n "}, {atom,{2,2},b}], - {2,3}} = erl_scan_string("a %%\n b",{1,1},[return]), + {2,3}} = erl_scan:string("a %%\n b",{1,1},[return]), ok. errors() -> @@ -338,11 +337,11 @@ erl_scan:string(Str) end || {BS,S} <- [{"3","3"},{"15","f"}, {"12","c"}] ], - {ok,[{integer,1,239},{'@',1}],1} = erl_scan_string("16#ef@"), + ?line {ok,[{integer,1,239},{'@',1}],1} = erl_scan:string("16#ef@"), {ok,[{integer,{1,1},239},{'@',{1,6}}],{1,7}} = - erl_scan_string("16#ef@", {1,1}, []), + erl_scan:string("16#ef@", {1,1}, []), {ok,[{integer,{1,1},14},{atom,{1,5},g@}],{1,7}} = - erl_scan_string("16#eg@", {1,1}, []), + erl_scan:string("16#eg@", {1,1}, []), ok. @@ -383,8 +382,8 @@ {ok,[{'.',{1,1}},{atom,{1,2},a}],{1,3}}} ], [begin - R = erl_scan_string(S), - R2 = erl_scan_string(S, {1,1}, []) + R = erl_scan:string(S), + R2 = erl_scan:string(S, {1,1}, []) end || {S, R, R2} <- Dot], ?line {ok,[{dot,_}=T1],{1,2}} = erl_scan:string(".", {1,1}, text), @@ -418,7 +417,7 @@ {white_space,{1,4},"\n"}, {dot,{2,1}}], {2,3}}, ""} = - erl_scan_tokens(C, "\n. ", {1,1}, return), % any loc, any options + erl_scan:tokens(C, "\n. ", {1,1}, return), % any loc, any options ?line [test_string(S, R) || {S, R} <- [{".$\n", [{'.',{1,1}},{char,{1,2},$\n}]}, @@ -512,7 +511,7 @@ %% An error before R13A. %% ?line {done,Err={error,{1,erl_scan,scan},1},eof} = ?line {done,{ok,[{atom,1,abra}],1},eof} = - erl_scan_tokens(C2, eof, 1), + erl_scan:tokens(C2, eof, 1), %% With column. ?line {more, C3} = erl_scan:tokens([]," \n",{1,1}), @@ -521,7 +520,7 @@ %% An error before R13A. %% ?line {done,{error,{{1,1},erl_scan,scan},{1,5}},eof} = ?line {done,{ok,[{atom,_,abra}],{1,5}},eof} = - erl_scan_tokens(C4, eof, 1), + erl_scan:tokens(C4, eof, 1), %% Robert's scanner returns "" as LeftoverChars; %% the R12B scanner returns eof as LeftoverChars: (eof is correct) @@ -529,26 +528,26 @@ %% An error before R13A. %% ?line {done,{error,{1,erl_scan,scan},1},eof} = ?line {done,{ok,[{atom,1,a}],1},eof} = - erl_scan_tokens(C5,eof,1), + erl_scan:tokens(C5,eof,1), %% With column. {more, C6} = erl_scan:tokens([], "a", {1,1}), %% An error before R13A. %% {done,{error,{1,erl_scan,scan},1},eof} = {done,{ok,[{atom,{1,1},a}],{1,2}},eof} = - erl_scan_tokens(C6,eof,1), + erl_scan:tokens(C6,eof,1), %% A dot followed by eof is special: ?line {more, C} = erl_scan:tokens([], "a.", 1), - {done,{ok,[{atom,1,a},{dot,1}],1},eof} = erl_scan_tokens(C,eof,1), - {ok,[{atom,1,foo},{dot,1}],1} = erl_scan_string("foo."), + ?line {done,{ok,[{atom,1,a},{dot,1}],1},eof} = erl_scan:tokens(C,eof,1), + ?line {ok,[{atom,1,foo},{dot,1}],1} = erl_scan:string("foo."), %% With column. {more, CCol} = erl_scan:tokens([], "a.", {1,1}), {done,{ok,[{atom,{1,1},a},{dot,{1,2}}],{1,3}},eof} = - erl_scan_tokens(CCol,eof,1), + erl_scan:tokens(CCol,eof,1), {ok,[{atom,{1,1},foo},{dot,{1,4}}],{1,5}} = - erl_scan_string("foo.", {1,1}, []), + erl_scan:string("foo.", {1,1}, []), ok. @@ -629,23 +628,23 @@ options() -> %% line and column are not options, but tested here ?line {ok,[{atom,1,foo},{white_space,1," "},{comment,1,"% bar"}], 1} = - erl_scan_string("foo % bar", 1, return), + erl_scan:string("foo % bar", 1, return), ?line {ok,[{atom,1,foo},{white_space,1," "}],1} = - erl_scan_string("foo % bar", 1, return_white_spaces), + erl_scan:string("foo % bar", 1, return_white_spaces), ?line {ok,[{atom,1,foo},{comment,1,"% bar"}],1} = - erl_scan_string("foo % bar", 1, return_comments), + erl_scan:string("foo % bar", 1, return_comments), ?line {ok,[{atom,17,foo}],17} = - erl_scan_string("foo % bar", 17), + erl_scan:string("foo % bar", 17), ?line {'EXIT',{function_clause,_}} = (catch {foo, erl_scan:string("foo % bar", {a,1}, [])}), % type error ?line {ok,[{atom,_,foo}],{17,18}} = - erl_scan_string("foo % bar", {17,9}, []), + erl_scan:string("foo % bar", {17,9}, []), ?line {'EXIT',{function_clause,_}} = (catch {foo, erl_scan:string("foo % bar", {1,0}, [])}), % type error ?line {ok,[{foo,1}],1} = - erl_scan_string("foo % bar",1, [{reserved_word_fun, + erl_scan:string("foo % bar",1, [{reserved_word_fun, fun(W) -> W =:= foo end}]), ?line {'EXIT',{badarg,_}} = (catch {foo, @@ -707,9 +706,8 @@ attributes_info() -> ?line {'EXIT',_} = (catch {foo,erl_scan:attributes_info(foo)}), % type error - [{line,18}] = erl_scan:attributes_info(erl_anno:new(18)), - {location,19} = - erl_scan:attributes_info(erl_anno:new(19), location), + ?line [{line,18}] = erl_scan:attributes_info(18), + ?line {location,19} = erl_scan:attributes_info(19, location), ?line {ok,[{atom,A0,foo}],_} = erl_scan:string("foo", 19, [text]), ?line {location,19} = erl_scan:attributes_info(A0, location), @@ -737,9 +735,7 @@ set_attribute() -> F = fun(Line) -> -Line end, - Anno2 = erl_anno:new(2), - A0 = erl_scan:set_attribute(line, Anno2, F), - {line, -2} = erl_scan:attributes_info(A0, line), + ?line -2 = erl_scan:set_attribute(line, 2, F), ?line {ok,[{atom,A1,foo}],_} = erl_scan:string("foo", {9,17}), ?line A2 = erl_scan:set_attribute(line, A1, F), ?line {line,-9} = erl_scan:attributes_info(A2, line), @@ -769,15 +765,10 @@ ?line {ok,[{atom,A6,foo}],_} = erl_scan:string("foo", 11, [text]), ?line A7 = erl_scan:set_attribute(line, A6, F2), - %% Incompatible with pre 18: - %% {line,{17,11}} = erl_scan:attributes_info(A7, line), - {line,17} = erl_scan:attributes_info(A7, line), + ?line {line,{17,11}} = erl_scan:attributes_info(A7, line), ?line {location,{17,11}} = % mixed up erl_scan:attributes_info(A7, location), - %% Incompatible with pre 18: - %% [{line,{17,11}},{text,"foo"}] = - %% erl_scan:attributes_info(A7, [line,column,text]), - [{line,17},{column,11},{text,"foo"}] = + ?line [{line,{17,11}},{text,"foo"}] = erl_scan:attributes_info(A7, [line,column,text]), ?line {'EXIT',_} = @@ -785,13 +776,9 @@ ?line {'EXIT',{badarg,_}} = (catch {foo, erl_scan:set_attribute(column, [], F2)}), % type error - Attr10 = erl_anno:new(8), - Attr20 = erl_scan:set_attribute(line, Attr10, - fun(L) -> {nos,'X',L} end), %% OTP-9412 - Attr30 = erl_scan:set_attribute(line, Attr20, - fun({nos,_V,VL}) -> VL end), - 8 = erl_anno:to_term(Attr30), + ?line 8 = erl_scan:set_attribute(line, [{line,{nos,'X',8}}], + fun({nos,_V,VL}) -> VL end), ok. column_errors() -> @@ -825,7 +812,7 @@ {white_space,_," "}, {atom,_,a}, {white_space,_,"\n"}], - _} = erl_scan_string("\r a\n", {1,1}, return), + _} = erl_scan:string("\r a\n", {1,1}, return), ?line test("\r a\n"), L = "{\"a\nb\", \"a\\nb\",\nabc\r,def}.\n\n", ?line {ok,[{'{',_}, @@ -842,7 +829,7 @@ {'}',_}, {dot,_}, {white_space,_,"\n"}], - _} = erl_scan_string(L, {1,1}, return), + _} = erl_scan:string(L, {1,1}, return), ?line test(L), ?line test("\"\n\"\n"), ?line test("\n\r\n"), @@ -859,7 +846,7 @@ unicode() -> ?line {ok,[{char,1,83},{integer,1,45}],1} = - erl_scan_string("$\\12345"), % not unicode + erl_scan:string("$\\12345"), % not unicode ?line {error,{1,erl_scan,{illegal,character}},1} = erl_scan:string([1089]), @@ -871,7 +858,7 @@ erl_scan:string("'a"++[1089]++"b'", {1,1}), ?line test("\"a"++[1089]++"b\""), {ok,[{char,1,1}],1} = - erl_scan_string([$$,$\\,$^,1089], 1), + erl_scan:string([$$,$\\,$^,1089], 1), {error,{1,erl_scan,Error},1} = erl_scan:string("\"qa\x{aaa}", 1), @@ -883,13 +870,13 @@ erl_scan:string("'qa\\x{aaa}'",{1,1}), {ok,[{char,1,1089}],1} = - erl_scan_string([$$,1089], 1), + erl_scan:string([$$,1089], 1), {ok,[{char,1,1089}],1} = - erl_scan_string([$$,$\\,1089], 1), + erl_scan:string([$$,$\\,1089], 1), Qs = "$\\x{aaa}", {ok,[{char,1,$\x{aaa}}],1} = - erl_scan_string(Qs, 1), + erl_scan:string(Qs, 1), {ok,[Q2],{1,9}} = erl_scan:string("$\\x{aaa}", {1,1}, [text]), [{category,char},{column,1},{length,8}, @@ -897,19 +884,19 @@ erl_scan:token_info(Q2), U1 = "\"\\x{aaa}\"", - {ok,[{string,A1,[2730]}],{1,10}} = erl_scan:string(U1, {1,1}, [text]), - [{line,1},{column,1},{text,"\"\\x{aaa}\""}] = - erl_scan:attributes_info(A1, [line, column, text]), - {ok,[{string,1,[2730]}],1} = erl_scan_string(U1, 1), + {ok, + [{string,[{line,1},{column,1},{text,"\"\\x{aaa}\""}],[2730]}], + {1,10}} = erl_scan:string(U1, {1,1}, [text]), + {ok,[{string,1,[2730]}],1} = erl_scan:string(U1, 1), U2 = "\"\\x41\\x{fff}\\x42\"", - {ok,[{string,1,[$\x41,$\x{fff},$\x42]}],1} = erl_scan_string(U2, 1), + {ok,[{string,1,[$\x41,$\x{fff},$\x42]}],1} = erl_scan:string(U2, 1), U3 = "\"a\n\\x{fff}\n\"", - {ok,[{string,1,[$a,$\n,$\x{fff},$\n]}],3} = erl_scan_string(U3, 1), + {ok,[{string,1,[$a,$\n,$\x{fff},$\n]}],3} = erl_scan:string(U3, 1), U4 = "\"\\^\n\\x{aaa}\\^\n\"", - {ok,[{string,1,[$\n,$\x{aaa},$\n]}],3} = erl_scan_string(U4, 1), + {ok,[{string,1,[$\n,$\x{aaa},$\n]}],3} = erl_scan:string(U4, 1), %% Keep these tests: ?line test(Qs), @@ -919,15 +906,15 @@ ?line test(U4), Str1 = "\"ab" ++ [1089] ++ "cd\"", - {ok,[{string,1,[$a,$b,1089,$c,$d]}],1} = erl_scan_string(Str1, 1), + {ok,[{string,1,[$a,$b,1089,$c,$d]}],1} = erl_scan:string(Str1, 1), {ok,[{string,{1,1},[$a,$b,1089,$c,$d]}],{1,8}} = - erl_scan_string(Str1, {1,1}), + erl_scan:string(Str1, {1,1}), ?line test(Str1), Comment = "%% "++[1089], {ok,[{comment,1,[$%,$%,$\s,1089]}],1} = - erl_scan_string(Comment, 1, [return]), + erl_scan:string(Comment, 1, [return]), {ok,[{comment,{1,1},[$%,$%,$\s,1089]}],{1,5}} = - erl_scan_string(Comment, {1,1}, [return]), + erl_scan:string(Comment, {1,1}, [return]), ok. more_chars() -> @@ -936,12 +923,12 @@ %% All kinds of tests... ?line {ok,[{char,_,123}],{1,4}} = - erl_scan_string("$\\{",{1,1}), + erl_scan:string("$\\{",{1,1}), ?line {more, C1} = erl_scan:tokens([], "$\\{", {1,1}), ?line {done,{ok,[{char,_,123}],{1,4}},eof} = - erl_scan_tokens(C1, eof, 1), + erl_scan:tokens(C1, eof, 1), ?line {ok,[{char,1,123},{atom,1,a},{'}',1}],1} = - erl_scan_string("$\\{a}"), + erl_scan:string("$\\{a}"), ?line {error,{{1,1},erl_scan,char},{1,4}} = erl_scan:string("$\\x", {1,1}), @@ -1006,11 +993,11 @@ {error,{{1,1},erl_scan,{illegal,atom}},{1,12}} = erl_scan:string("'qa\\x{aaa}'",{1,1}), - {ok,[{char,1,1089}],1} = erl_scan_string([$$,1089], 1), - {ok,[{char,1,1089}],1} = erl_scan_string([$$,$\\,1089],1), + {ok,[{char,1,1089}],1} = erl_scan:string([$$,1089], 1), + {ok,[{char,1,1089}],1} = erl_scan:string([$$,$\\,1089],1), Qs = "$\\x{aaa}", - {ok,[{char,1,2730}],1} = erl_scan_string(Qs, 1), + {ok,[{char,1,2730}],1} = erl_scan:string(Qs,1), {ok,[Q2],{1,9}} = erl_scan:string(Qs,{1,1},[text]), [{category,char},{column,1},{length,8}, {line,1},{symbol,16#aaa},{text,Qs}] = @@ -1024,19 +1011,19 @@ {symbol,[16#aaa]},{text,U1}] = erl_scan:token_info(T1, Tags), U2 = "\"\\x41\\x{fff}\\x42\"", - {ok,[{string,1,[65,4095,66]}],1} = erl_scan_string(U2, 1), + {ok,[{string,1,[65,4095,66]}],1} = erl_scan:string(U2, 1), U3 = "\"a\n\\x{fff}\n\"", - {ok,[{string,1,[97,10,4095,10]}],3} = erl_scan_string(U3, 1), + {ok,[{string,1,[97,10,4095,10]}],3} = erl_scan:string(U3, 1), U4 = "\"\\^\n\\x{aaa}\\^\n\"", - {ok,[{string,1,[10,2730,10]}],3} = erl_scan_string(U4, 1,[]), + {ok,[{string,1,[10,2730,10]}],3} = erl_scan:string(U4, 1,[]), Str1 = "\"ab" ++ [1089] ++ "cd\"", {ok,[{string,1,[97,98,1089,99,100]}],1} = - erl_scan_string(Str1,1), + erl_scan:string(Str1,1), {ok,[{string,{1,1},[97,98,1089,99,100]}],{1,8}} = - erl_scan_string(Str1, {1,1}), + erl_scan:string(Str1, {1,1}), OK1 = 16#D800-1, OK2 = 16#DFFF+1, @@ -1051,19 +1038,19 @@ IllegalL = [Illegal1,Illegal2,Illegal3,Illegal4], [{ok,[{comment,1,[$%,$%,$\s,OK]}],1} = - erl_scan_string("%% "++[OK], 1, [return]) || + erl_scan:string("%% "++[OK], 1, [return]) || OK <- OKL], {ok,[{comment,_,[$%,$%,$\s,OK1]}],{1,5}} = - erl_scan_string("%% "++[OK1], {1,1}, [return]), + erl_scan:string("%% "++[OK1], {1,1}, [return]), [{error,{1,erl_scan,{illegal,character}},1} = erl_scan:string("%% "++[Illegal], 1, [return]) || Illegal <- IllegalL], {error,{{1,1},erl_scan,{illegal,character}},{1,5}} = erl_scan:string("%% "++[Illegal1], {1,1}, [return]), - [{ok,[],1} = erl_scan_string("%% "++[OK], 1, []) || + [{ok,[],1} = erl_scan:string("%% "++[OK], 1, []) || OK <- OKL], - {ok,[],{1,5}} = erl_scan_string("%% "++[OK1], {1,1}, []), + {ok,[],{1,5}} = erl_scan:string("%% "++[OK1], {1,1}, []), [{error,{1,erl_scan,{illegal,character}},1} = erl_scan:string("%% "++[Illegal], 1, []) || Illegal <- IllegalL], @@ -1071,7 +1058,7 @@ erl_scan:string("%% "++[Illegal1], {1,1}, []), [{ok,[{string,{1,1},[OK]}],{1,4}} = - erl_scan_string("\""++[OK]++"\"",{1,1}) || + erl_scan:string("\""++[OK]++"\"",{1,1}) || OK <- OKL], [{error,{{1,2},erl_scan,{illegal,character}},{1,3}} = erl_scan:string("\""++[OK]++"\"",{1,1}) || @@ -1082,93 +1069,93 @@ Illegal <- IllegalL], {ok,[{char,{1,1},OK1}],{1,3}} = - erl_scan_string([$$,OK1],{1,1}), + erl_scan:string([$$,OK1],{1,1}), {error,{{1,1},erl_scan,{illegal,character}},{1,2}} = erl_scan:string([$$,Illegal1],{1,1}), {ok,[{char,{1,1},OK1}],{1,4}} = - erl_scan_string([$$,$\\,OK1],{1,1}), + erl_scan:string([$$,$\\,OK1],{1,1}), {error,{{1,1},erl_scan,{illegal,character}},{1,4}} = erl_scan:string([$$,$\\,Illegal1],{1,1}), {ok,[{string,{1,1},[55295]}],{1,5}} = - erl_scan_string("\"\\"++[OK1]++"\"",{1,1}), + erl_scan:string("\"\\"++[OK1]++"\"",{1,1}), {error,{{1,2},erl_scan,{illegal,character}},{1,4}} = erl_scan:string("\"\\"++[Illegal1]++"\"",{1,1}), {ok,[{char,{1,1},OK1}],{1,10}} = - erl_scan_string("$\\x{D7FF}",{1,1}), + erl_scan:string("$\\x{D7FF}",{1,1}), {error,{{1,1},erl_scan,{illegal,character}},{1,10}} = erl_scan:string("$\\x{D800}",{1,1}), %% Not erl_scan, but erl_parse. - {integer,0,1} = erl_parse_abstract(1), - Float = 3.14, {float,0,Float} = erl_parse_abstract(Float), - {nil,0} = erl_parse_abstract([]), + {integer,0,1} = erl_parse:abstract(1), + Float = 3.14, {float,0,Float} = erl_parse:abstract(Float), + {nil,0} = erl_parse:abstract([]), {bin,0, [{bin_element,0,{integer,0,1},default,default}, {bin_element,0,{integer,0,2},default,default}]} = - erl_parse_abstract(<<1,2>>), + erl_parse:abstract(<<1,2>>), {cons,0,{tuple,0,[{atom,0,a}]},{atom,0,b}} = - erl_parse_abstract([{a} | b]), - {string,0,"str"} = erl_parse_abstract("str"), + erl_parse:abstract([{a} | b]), + {string,0,"str"} = erl_parse:abstract("str"), {cons,0, {integer,0,$a}, {cons,0,{integer,0,55296},{string,0,"c"}}} = - erl_parse_abstract("a"++[55296]++"c"), + erl_parse:abstract("a"++[55296]++"c"), Line = 17, - {integer,Line,1} = erl_parse_abstract(1, Line), - Float = 3.14, {float,Line,Float} = erl_parse_abstract(Float, Line), - {nil,Line} = erl_parse_abstract([], Line), + {integer,Line,1} = erl_parse:abstract(1, Line), + Float = 3.14, {float,Line,Float} = erl_parse:abstract(Float, Line), + {nil,Line} = erl_parse:abstract([], Line), {bin,Line, [{bin_element,Line,{integer,Line,1},default,default}, {bin_element,Line,{integer,Line,2},default,default}]} = - erl_parse_abstract(<<1,2>>, Line), + erl_parse:abstract(<<1,2>>, Line), {cons,Line,{tuple,Line,[{atom,Line,a}]},{atom,Line,b}} = - erl_parse_abstract([{a} | b], Line), - {string,Line,"str"} = erl_parse_abstract("str", Line), + erl_parse:abstract([{a} | b], Line), + {string,Line,"str"} = erl_parse:abstract("str", Line), {cons,Line, {integer,Line,$a}, {cons,Line,{integer,Line,55296},{string,Line,"c"}}} = - erl_parse_abstract("a"++[55296]++"c", Line), + erl_parse:abstract("a"++[55296]++"c", Line), Opts1 = [{line,17}], - {integer,Line,1} = erl_parse_abstract(1, Opts1), - Float = 3.14, {float,Line,Float} = erl_parse_abstract(Float, Opts1), - {nil,Line} = erl_parse_abstract([], Opts1), + {integer,Line,1} = erl_parse:abstract(1, Opts1), + Float = 3.14, {float,Line,Float} = erl_parse:abstract(Float, Opts1), + {nil,Line} = erl_parse:abstract([], Opts1), {bin,Line, [{bin_element,Line,{integer,Line,1},default,default}, {bin_element,Line,{integer,Line,2},default,default}]} = - erl_parse_abstract(<<1,2>>, Opts1), + erl_parse:abstract(<<1,2>>, Opts1), {cons,Line,{tuple,Line,[{atom,Line,a}]},{atom,Line,b}} = - erl_parse_abstract([{a} | b], Opts1), - {string,Line,"str"} = erl_parse_abstract("str", Opts1), + erl_parse:abstract([{a} | b], Opts1), + {string,Line,"str"} = erl_parse:abstract("str", Opts1), {cons,Line, {integer,Line,$a}, {cons,Line,{integer,Line,55296},{string,Line,"c"}}} = - erl_parse_abstract("a"++[55296]++"c", Opts1), + erl_parse:abstract("a"++[55296]++"c", Opts1), [begin - {integer,Line,1} = erl_parse_abstract(1, Opts2), - Float = 3.14, {float,Line,Float} = erl_parse_abstract(Float, Opts2), - {nil,Line} = erl_parse_abstract([], Opts2), + {integer,Line,1} = erl_parse:abstract(1, Opts2), + Float = 3.14, {float,Line,Float} = erl_parse:abstract(Float, Opts2), + {nil,Line} = erl_parse:abstract([], Opts2), {bin,Line, [{bin_element,Line,{integer,Line,1},default,default}, {bin_element,Line,{integer,Line,2},default,default}]} = - erl_parse_abstract(<<1,2>>, Opts2), + erl_parse:abstract(<<1,2>>, Opts2), {cons,Line,{tuple,Line,[{atom,Line,a}]},{atom,Line,b}} = - erl_parse_abstract([{a} | b], Opts2), - {string,Line,"str"} = erl_parse_abstract("str", Opts2), + erl_parse:abstract([{a} | b], Opts2), + {string,Line,"str"} = erl_parse:abstract("str", Opts2), {string,Line,[97,1024,99]} = - erl_parse_abstract("a"++[1024]++"c", Opts2) + erl_parse:abstract("a"++[1024]++"c", Opts2) end || Opts2 <- [[{encoding,unicode},{line,Line}], [{encoding,utf8},{line,Line}]]], {cons,0, {integer,0,97}, {cons,0,{integer,0,1024},{string,0,"c"}}} = - erl_parse_abstract("a"++[1024]++"c", [{encoding,latin1}]), + erl_parse:abstract("a"++[1024]++"c", [{encoding,latin1}]), ok. otp_10990(doc) -> @@ -1185,13 +1172,13 @@ []; otp_10992(Config) when is_list(Config) -> {cons,0,{float,0,42.0},{nil,0}} = - erl_parse_abstract([42.0], [{encoding,unicode}]), + erl_parse:abstract([42.0], [{encoding,unicode}]), {cons,0,{float,0,42.0},{nil,0}} = - erl_parse_abstract([42.0], [{encoding,utf8}]), + erl_parse:abstract([42.0], [{encoding,utf8}]), {cons,0,{integer,0,65},{cons,0,{float,0,42.0},{nil,0}}} = - erl_parse_abstract([$A,42.0], [{encoding,unicode}]), + erl_parse:abstract([$A,42.0], [{encoding,unicode}]), {cons,0,{integer,0,65},{cons,0,{float,0,42.0},{nil,0}}} = - erl_parse_abstract([$A,42.0], [{encoding,utf8}]), + erl_parse:abstract([$A,42.0], [{encoding,utf8}]), ok. otp_11807(doc) -> @@ -1200,72 +1187,29 @@ []; otp_11807(Config) when is_list(Config) -> {cons,0,{integer,0,97},{cons,0,{integer,0,98},{nil,0}}} = - erl_parse_abstract("ab", [{encoding,none}]), + erl_parse:abstract("ab", [{encoding,none}]), {cons,0,{integer,0,-1},{nil,0}} = - erl_parse_abstract([-1], [{encoding,latin1}]), + erl_parse:abstract([-1], [{encoding,latin1}]), ASCII = fun(I) -> I >= 0 andalso I < 128 end, - {string,0,"xyz"} = erl_parse_abstract("xyz", [{encoding,ASCII}]), + {string,0,"xyz"} = erl_parse:abstract("xyz", [{encoding,ASCII}]), {cons,0,{integer,0,228},{nil,0}} = - erl_parse_abstract([228], [{encoding,ASCII}]), + erl_parse:abstract([228], [{encoding,ASCII}]), {cons,0,{integer,0,97},{atom,0,a}} = - erl_parse_abstract("a"++a, [{encoding,latin1}]), + erl_parse:abstract("a"++a, [{encoding,latin1}]), {'EXIT', {{badarg,bad},_}} = % minor backward incompatibility (catch erl_parse:abstract("string", [{encoding,bad}])), ok. test_string(String, ExpectedWithCol) -> - {ok, ExpectedWithCol, _EndWithCol} = erl_scan_string(String, {1, 1}, []), + {ok, ExpectedWithCol, _EndWithCol} = erl_scan:string(String, {1, 1}, []), Expected = [ begin {L,_C} = element(2, T), setelement(2, T, L) end || T <- ExpectedWithCol ], - {ok, Expected, _End} = erl_scan_string(String), + {ok, Expected, _End} = erl_scan:string(String), test(String). -erl_scan_string(String) -> - erl_scan_string(String, 1, []). - -erl_scan_string(String, StartLocation) -> - erl_scan_string(String, StartLocation, []). - -erl_scan_string(String, StartLocation, Options) -> - case erl_scan:string(String, StartLocation, Options) of - {ok, Tokens, EndLocation} -> - {ok, unopaque_tokens(Tokens), EndLocation}; - Else -> - Else - end. - -erl_scan_tokens(C, S, L) -> - erl_scan_tokens(C, S, L, []). - -erl_scan_tokens(C, S, L, O) -> - case erl_scan:tokens(C, S, L, O) of - {done, {ok, Ts, End}, R} -> - {done, {ok, unopaque_tokens(Ts), End}, R}; - Else -> - Else - end. - -unopaque_tokens([]) -> - []; -unopaque_tokens([Token|Tokens]) -> - Attrs = element(2, Token), - Term = erl_anno:to_term(Attrs), - T = setelement(2, Token, Term), - [T | unopaque_tokens(Tokens)]. - -erl_parse_abstract(Term) -> - erl_parse_abstract(Term, []). - -erl_parse_abstract(Term, Options) -> - Abstr = erl_parse:abstract(Term, Options), - unopaque_abstract(Abstr). - -unopaque_abstract(Abstr) -> - erl_parse:anno_to_term(Abstr). - %% test_string(String, Expected, StartLocation, Options) -> %% {ok, Expected, _End} = erl_scan:string(String, StartLocation, Options), %% test(String). @@ -1415,7 +1359,7 @@ simplify([Token|Tokens]) -> {line,Line} = erl_scan:token_info(Token, line), - [setelement(2, Token, erl_anno:new(Line)) | simplify(Tokens)]; + [setelement(2, Token, Line) | simplify(Tokens)]; simplify([]) -> []. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/error_logger_forwarder.erl erlang-17.3-dfsg/lib/stdlib/test/error_logger_forwarder.erl --- erlang-18.2-dfsg/lib/stdlib/test/error_logger_forwarder.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/error_logger_forwarder.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/error_logger_h_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/error_logger_h_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/error_logger_h_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/error_logger_h_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,406 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% --module(error_logger_h_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). --export([logfile/1,logfile_truncated/1,tty/1,tty_truncated/1]). - -%% Event handler exports. --export([init/1,handle_event/2,terminate/2]). - --include_lib("test_server/include/test_server.hrl"). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [logfile,logfile_truncated,tty,tty_truncated]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -logfile(Config) -> - PrivDir = ?config(priv_dir, Config), - LogDir = filename:join(PrivDir, ?MODULE), - Log = filename:join(LogDir, "logfile.log"), - ok = filelib:ensure_dir(Log), - - Ev = event_templates(), - - do_one_logfile(Log, Ev, unlimited), - - Pa = "-pa " ++ filename:dirname(code:which(?MODULE)), - {ok,Node} = start_node(logfile, Pa), - error_logger:logfile({open,Log}), - ok = rpc:call(Node, erlang, apply, [fun gen_events/1,[Ev]]), - AtNode = iolist_to_binary(["** at node ",atom_to_list(Node)," **"]), - error_logger:logfile(close), - analyse_events(Log, Ev, [AtNode], unlimited), - - [] = [{X, file:pid2name(X)} || X <- processes(), Data <- [process_info(X, [current_function])], - Data =/= undefined, - element(1, element(2, lists:keyfind(current_function, 1, Data))) - =:= file_io_server, - file:pid2name(X) =:= {ok, Log}], - - test_server:stop_node(Node), - - cleanup(Log), - ok. - -logfile_truncated(Config) -> - PrivDir = ?config(priv_dir, Config), - LogDir = filename:join(PrivDir, ?MODULE), - Log = filename:join(LogDir, "logfile_truncated.log"), - ok = filelib:ensure_dir(Log), - - Ev = event_templates(), - - Depth = 20, - application:set_env(kernel, error_logger_format_depth, Depth), - try - do_one_logfile(Log, Ev, Depth) - after - application:unset_env(kernel, error_logger_format_depth) - end, - - cleanup(Log), - ok. - -do_one_logfile(Log, Ev, Depth) -> - error_logger:logfile({open,Log}), - gen_events(Ev), - error_logger:logfile(close), - analyse_events(Log, Ev, [], Depth). - -tty(Config) -> - PrivDir = ?config(priv_dir, Config), - LogDir = filename:join(PrivDir, ?MODULE), - Log = filename:join(LogDir, "tty.log"), - ok = filelib:ensure_dir(Log), - - Ev = event_templates(), - - do_one_tty(Log, Ev, unlimited), - - Pa = "-pa " ++ filename:dirname(code:which(?MODULE)), - {ok,Node} = start_node(logfile, Pa), - tty_log_open(Log), - ok = rpc:call(Node, erlang, apply, [fun gen_events/1,[Ev]]), - tty_log_close(), - AtNode = iolist_to_binary(["** at node ",atom_to_list(Node)," **"]), - analyse_events(Log, Ev, [AtNode], unlimited), - - test_server:stop_node(Node), - - cleanup(Log), - ok. - -tty_truncated(Config) -> - PrivDir = ?config(priv_dir, Config), - LogDir = filename:join(PrivDir, ?MODULE), - Log = filename:join(LogDir, "tty_truncated.log"), - ok = filelib:ensure_dir(Log), - - Ev = event_templates(), - - Depth = 20, - application:set_env(kernel, error_logger_format_depth, Depth), - try - do_one_tty(Log, Ev, Depth) - after - application:unset_env(kernel, error_logger_format_depth) - end, - - cleanup(Log), - ok. - -do_one_tty(Log, Ev, Depth) -> - tty_log_open(Log), - gen_events(Ev), - tty_log_close(), - analyse_events(Log, Ev, [], Depth). - -tty_log_open(Log) -> - {ok,Fd} = file:open(Log, [write]), - Depth = case application:get_env(kernel, error_logger_format_depth) of - {ok,D} -> D; - _ -> unlimited - end, - error_logger:add_report_handler(?MODULE, {Fd,Depth}), - Fd. - -tty_log_close() -> - error_logger:delete_report_handler(?MODULE), - ok. - -event_templates() -> - [{error_msg,["Pure error string\n",[]]}, - {error_msg,["Pure error string with error ~p\n",[]]}, - {error_msg,["Error string with ~p\n", [format]]}, - {error_msg,["Error string with bad format ~p\n", []]}, - - {error_report,[error_atom]}, - {error_report,["error string"]}, - {error_report,[[{error_tag,value},error_value]]}, - - {info_msg,["Pure info string\n",[]]}, - {info_msg,["Pure info string with error ~p\n",[]]}, - {info_msg,["Pure string with ~p\n", [format]]}, - {info_msg,["Pure string with bad format ~p\n", []]}, - - {info_report,[info_atom]}, - {info_report,["info string"]}, - {info_report,[[{info_tag,value},info_value]]}, - - {warning_msg,["Pure warning string\n",[]]}, - {warning_msg,["Pure warning string with error ~p\n",[]]}, - {warning_msg,["Warning string with ~p\n", [format]]}, - {warning_msg,["Warning string with bad format ~p\n", []]}, - - {warning_report,[warning_atom]}, - {warning_report,["warning string"]}, - {warning_report,[[{warning_tag,value},warning_value]]}, - - %% Bigger terms. - {error_msg,["fairly big: ~p\n",[lists:seq(1, 128)]]}, - {error_report,[list_to_tuple(lists:seq(1, 100))]}, - {error_report,[lists:seq(32, 126)]}, - {error_report,[[{tag,lists:seq(1, 64)}]]} - ]. - -gen_events(Ev) -> - io:format("node = ~p\n", [node()]), - io:format("group leader = ~p\n", [group_leader()]), - io:format("~p\n", [gen_event:which_handlers(error_logger)]), - call_error_logger(Ev), - - {Pid,Ref} = spawn_monitor(fun() -> error(ouch) end), - receive - {'DOWN',Ref,process,Pid,_} -> - ok - end, - - %% The following calls with a custom type will be ignored. - error_logger:error_report(ignored, value), - error_logger:warning_report(ignored, value), - error_logger:info_report(ignored, value), - receive after 100 -> ok end, - ok. - -analyse_events(Log, Ev, AtNode, Depth) -> - {ok,Bin} = file:read_file(Log), - - io:format("*** Contents of log file ***\n\n~s\n", [Bin]), - - Lines = binary:split(Bin, <<"\n">>, [global,trim_all]), - io:format("~p\n", [Lines]), - - Rest = match_output(Ev, Lines, AtNode, Depth), - io:format("~p\n", [Rest]), - - [] = match_emulator_error(Rest), - ok. - - -call_error_logger([{F,Args}|T]) -> - apply(error_logger, F, Args), - call_error_logger(T); -call_error_logger([]) -> ok. - - -match_emulator_error([Head,Second,Third,_|Lines]) -> - match_head(<<"ERROR">>, Head), - {match,[{0,_}]} = re:run(Second, - "^Error in process <\\d+[.]\\d+[.]\\d+> on " - "node [^ ]* with exit value:"), - {match,[{0,_}]} = re:run(Third, "^[{]ouch,"), - Lines. - -match_output([Item|T], Lines0, AtNode, Depth) -> - try match_item(Item, Lines0, AtNode, Depth) of - Lines -> - match_output(T, Lines, AtNode, Depth) - catch - C:E -> - Stk = erlang:get_stacktrace(), - io:format("ITEM: ~p", [Item]), - io:format("LINES: ~p", [Lines0]), - erlang:raise(C, E, Stk) - end; -match_output([], Lines, _, _) -> Lines. - -match_item(Item, Lines, AtNode, Depth) -> - case item_type(Item) of - {msg,Head,Args} -> - match_format(Head, Args, Lines, AtNode, Depth); - {report,Head,Args} -> - match_term(Head, Args, Lines, AtNode, Depth) - end. - -item_type({error_msg,Args}) -> - {msg,<<"ERROR">>,Args}; -item_type({info_msg,Args}) -> - {msg,<<"INFO">>,Args}; -item_type({warning_msg,Args}) -> - {msg,<<"WARNING">>,Args}; -item_type({error_report,Args}) -> - {report,<<"ERROR">>,Args}; -item_type({info_report,Args}) -> - {report,<<"INFO">>,Args}; -item_type({warning_report,Args}) -> - {report,<<"WARNING">>,Args}. - -match_format(Tag, [Format,Args], [Head|Lines], AtNode, Depth) -> - match_head(Tag, Head), - Bin = try dl_format(Depth, Format, Args) of - Str -> - iolist_to_binary(Str) - catch - _:_ -> - S = dl_format(Depth, "ERROR: ~p - ~p~n", [Format,Args]), - iolist_to_binary(S) - end, - Expected0 = binary:split(Bin, <<"\n">>, [global,trim]), - Expected = Expected0 ++ AtNode, - match_term_lines(Expected, Lines). - -match_term(Tag, [Arg], [Head|Lines], AtNode, Depth) -> - match_head(Tag, Head), - Expected0 = match_term_get_expected(Arg, Depth), - Expected = Expected0 ++ AtNode, - match_term_lines(Expected, Lines). - -match_term_get_expected(List, Depth) when is_list(List) -> - Bin = try iolist_to_binary(dl_format(Depth, "~s\n", [List])) of - Bin0 -> Bin0 - catch - _:_ -> - iolist_to_binary(format_rep(List, Depth)) - end, - binary:split(Bin, <<"\n">>, [global,trim]); -match_term_get_expected(Term, Depth) -> - S = dl_format(Depth, "~p\n", [Term]), - Bin = iolist_to_binary(S), - binary:split(Bin, <<"\n">>, [global,trim]). - -format_rep([{Tag,Data}|Rep], Depth) -> - [dl_format(Depth, " ~p: ~p\n", [Tag,Data])| - format_rep(Rep, Depth)]; -format_rep([Other|Rep], Depth) -> - [dl_format(Depth, " ~p\n", [Other])| - format_rep(Rep, Depth)]; -format_rep([], _Depth) -> []. - -match_term_lines([Line|T], [Line|Lines]) -> - match_term_lines(T, Lines); -match_term_lines([], Lines) -> Lines. - -match_head(Tag, Head) -> - Re = <<"^=",Tag/binary, - " REPORT==== \\d\\d?-[A-Z][a-z][a-z]-\\d{4}::" - "\\d\\d:\\d\\d:\\d\\d ===$">>, - {match,_} = re:run(Head, Re). - -start_node(Name, Args) -> - case test_server:start_node(Name, slave, [{args,Args}]) of - {ok,Node} -> - {ok,Node}; - Error -> - test_server:fail(Error) - end. - -cleanup(File) -> - %% The point of this test case is not to test file operations. - %% Therefore ignore any failures. - case file:delete(File) of - ok -> - ok; - {error,Error1} -> - io:format("file:delete(~s) failed with error ~p", - [File,Error1]) - end, - Dir = filename:dirname(File), - case file:del_dir(Dir) of - ok -> - ok; - {error,Error2} -> - io:format("file:del_dir(~s) failed with error ~p", - [Dir,Error2]) - end, - ok. - - -%% Depth-limited io_lib:format. Intentionally implemented here instead -%% of using io_lib:scan_format/2 to avoid using the same implementation -%% as in the error_logger handlers. - -dl_format(unlimited, Format, Args) -> - io_lib:format(Format, Args); -dl_format(Depth, Format0, Args0) -> - {Format,Args} = dl_format_1(Format0, Args0, Depth, [], []), - io_lib:format(Format, Args). - -dl_format_1("~p"++Fs, [A|As], Depth, Facc, Acc) -> - dl_format_1(Fs, As, Depth, [$P,$~|Facc], [Depth,A|Acc]); -dl_format_1("~w"++Fs, [A|As], Depth, Facc, Acc) -> - dl_format_1(Fs, As, Depth, [$W,$~|Facc], [Depth,A|Acc]); -dl_format_1("~s"++Fs, [A|As], Depth, Facc, Acc) -> - dl_format_1(Fs, As, Depth, [$s,$~|Facc], [A|Acc]); -dl_format_1([F|Fs], As, Depth, Facc, Aacc) -> - dl_format_1(Fs, As, Depth, [F|Facc], Aacc); -dl_format_1([], [], _, Facc, Aacc) -> - {lists:reverse(Facc),lists:reverse(Aacc)}. - -%%% -%%% Our own event handler. There is no way to intercept the output -%%% from error_logger_tty_h, but we can use the same code by -%%% calling error_logger_tty_h:write_event/2. -%%% - -init({_,_}=St) -> - {ok,St}. - -handle_event(Event, {Fd,Depth}=St) -> - case error_logger_tty_h:write_event(tag_event(Event), io_lib, Depth) of - ok -> - ok; - Str when is_list(Str) -> - io:put_chars(Fd, Str) - end, - {ok,St}. - -terminate(_Reason, {Fd,_}) -> - ok = file:close(Fd), - []. - -tag_event(Event) -> - {erlang:universaltime(),Event}. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_app.erl erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_app.erl --- erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict.erl erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict.erl --- erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_sup.erl erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_sup.erl --- erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_app.erl erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_app.erl --- erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_app.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_app.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy.erl erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy.erl --- erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_sup.erl erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_sup.erl --- erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main2.erl erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main2.erl --- erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main.erl erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main.erl --- erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl --- erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/escript_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/escript_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/ets_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/ets_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/ets_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/ets_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -48,7 +47,6 @@ -export([ordered/1, ordered_match/1, interface_equality/1, fixtable_next/1, fixtable_insert/1, rename/1, rename_unnamed/1, evil_rename/1, update_element/1, update_counter/1, evil_update_counter/1, partly_bound/1, match_heavy/1]). --export([update_counter_with_default/1]). -export([member/1]). -export([memory/1]). -export([select_fail/1]). @@ -79,7 +77,6 @@ -export([otp_10182/1]). -export([ets_all/1]). -export([memory_check_summary/1]). --export([take/1]). -export([init_per_testcase/2, end_per_testcase/2]). %% Convenience for manual testing @@ -101,7 +98,7 @@ misc1_do/1, safe_fixtable_do/1, info_do/1, dups_do/1, heavy_lookup_do/1, heavy_lookup_element_do/1, member_do/1, otp_5340_do/1, otp_7665_do/1, meta_wb_do/1, do_heavy_concurrent/1, tab2file2_do/2, exit_large_table_owner_do/2, - types_do/1, sleeper/0, memory_do/1, update_counter_with_default_do/1, + types_do/1, sleeper/0, memory_do/1, ms_tracee_dummy/1, ms_tracee_dummy/2, ms_tracee_dummy/3, ms_tracee_dummy/4 ]). @@ -118,7 +115,6 @@ start_spawn_logger(), wait_for_test_procs(), %% Ensure previous case cleaned up Dog=test_server:timetrap(test_server:minutes(20)), - put('__ETS_TEST_CASE__', Case), [{watchdog, Dog}, {test_case, Case} | Config]. end_per_testcase(_Func, Config) -> @@ -139,8 +135,7 @@ {group, heavy}, ordered, ordered_match, interface_equality, fixtable_next, fixtable_insert, rename, rename_unnamed, evil_rename, update_element, - update_counter, evil_update_counter, - update_counter_with_default, partly_bound, + update_counter, evil_update_counter, partly_bound, match_heavy, {group, fold}, member, t_delete_object, t_init_table, t_whitebox, t_delete_all_objects, t_insert_list, t_test_ms, t_select_delete, t_ets_dets, @@ -158,7 +153,6 @@ otp_9932, otp_9423, ets_all, - take, memory_check_summary]. % MUST BE LAST @@ -218,9 +212,8 @@ ets_test_spawn_logger ! {self(), get_failed_memchecks}, receive {get_failed_memchecks, FailedMemchecks} -> ok end, io:format("Failed memchecks: ~p\n",[FailedMemchecks]), - NoFailedMemchecks = length(FailedMemchecks), - if NoFailedMemchecks > 3 -> - ct:fail("Too many failed (~p) memchecks", [NoFailedMemchecks]); + if FailedMemchecks > 3 -> + ct:fail("Too many failed (~p) memchecks", [FailedMemchecks]); true -> ok end @@ -1388,7 +1381,7 @@ {ok,[X]} -> X; _ -> - {A,B,C} = erlang:timestamp(), + {A,B,C} = erlang:now(), random:seed(A,B,C), get(random_seed) end, @@ -1766,14 +1759,6 @@ OrdSet = ets_new(ordered_set,[ordered_set | Opts]), update_counter_for(Set), update_counter_for(OrdSet), - ets:delete_all_objects(Set), - ets:delete_all_objects(OrdSet), - ets:safe_fixtable(Set, true), - ets:safe_fixtable(OrdSet, true), - update_counter_for(Set), - update_counter_for(OrdSet), - ets:safe_fixtable(Set, false), - ets:safe_fixtable(OrdSet, false), ets:delete(Set), ets:delete(OrdSet), update_counter_neg(Opts). @@ -1793,14 +1778,10 @@ ?line {NewObj, Ret} = uc_mimic(Obj,Arg3), ArgHash = erlang:phash2({T,a,Arg3}), %%io:format("update_counter(~p, ~p, ~p) expecting ~p\n",[T,a,Arg3,Ret]), - [DefaultObj] = ets:lookup(T, a), ?line Ret = ets:update_counter(T,a,Arg3), - Ret = ets:update_counter(T, b, Arg3, DefaultObj), % Use other key ?line ArgHash = erlang:phash2({T,a,Arg3}), %%io:format("NewObj=~p~n ",[NewObj]), ?line [NewObj] = ets:lookup(T,a), - true = ets:lookup(T, b) =:= [setelement(1, NewObj, b)], - ets:delete(T, b), Myself(NewObj,Times-1,Arg3,Myself) end, @@ -2025,44 +2006,6 @@ ets:update_counter(T, dracula, 1), evil_counter_1(Iter-1, T). -update_counter_with_default(Config) when is_list(Config) -> - repeat_for_opts(update_counter_with_default_do). - -update_counter_with_default_do(Opts) -> - T1 = ets_new(a, [set | Opts]), - %% Insert default object. - 3 = ets:update_counter(T1, foo, 2, {beaufort,1}), - %% Increment. - 5 = ets:update_counter(T1, foo, 2, {cabecou,1}), - %% Increment with list. - [9] = ets:update_counter(T1, foo, [{2,4}], {camembert,1}), - %% Same with non-immediate key. - 3 = ets:update_counter(T1, {foo,bar}, 2, {{chaource,chevrotin},1}), - 5 = ets:update_counter(T1, {foo,bar}, 2, {{cantal,comté},1}), - [9] = ets:update_counter(T1, {foo,bar}, [{2,4}], {{emmental,de,savoie},1}), - %% Same with ordered set. - T2 = ets_new(b, [ordered_set | Opts]), - 3 = ets:update_counter(T2, foo, 2, {maroilles,1}), - 5 = ets:update_counter(T2, foo, 2, {mimolette,1}), - [9] = ets:update_counter(T2, foo, [{2,4}], {morbier,1}), - 3 = ets:update_counter(T2, {foo,bar}, 2, {{laguiole},1}), - 5 = ets:update_counter(T2, {foo,bar}, 2, {{saint,nectaire},1}), - [9] = ets:update_counter(T2, {foo,bar}, [{2,4}], {{rocamadour},1}), - %% Arithmetically-equal keys. - 3 = ets:update_counter(T2, 1.0, 2, {1,1}), - 5 = ets:update_counter(T2, 1, 2, {1,1}), - 7 = ets:update_counter(T2, 1, 2, {1.0,1}), - %% Same with reversed type difference. - 3 = ets:update_counter(T2, 2, 2, {2.0,1}), - 5 = ets:update_counter(T2, 2.0, 2, {2.0,1}), - 7 = ets:update_counter(T2, 2.0, 2, {2,1}), - %% bar is not an integer. - {'EXIT',{badarg,_}} = (catch ets:update_counter(T1, qux, 3, {saint,félicien})), - %% No third element in default value. - {'EXIT',{badarg,_}} = (catch ets:update_counter(T1, qux, [{3,1}], {roquefort,1})), - - ok. - fixtable_next(doc) -> ["Check that a first-next sequence always works on a fixed table"]; fixtable_next(suite) -> @@ -3064,13 +3007,13 @@ "~p ets lookups/s",[Values]))}. time_lookup_do(Opts) -> - Tab = ets_new(foo,Opts), - fill_tab(Tab,foo), - ets:insert(Tab,{{a,key},foo}), - {Time,_} = ?t:timecall(test_server,do_times, - [100000,ets,lookup,[Tab,{a,key}]]), - true = ets:delete(Tab), - round(100000 / Time). % lookups/s + ?line Tab = ets_new(foo,Opts), + ?line fill_tab(Tab,foo), + ?line ets:insert(Tab,{{a,key},foo}), + ?line {Time,_} = ?t:timecall(test_server,do_times, + [10000,ets,lookup,[Tab,{a,key}]]), + ?line true = ets:delete(Tab), + round(10000 / Time). % lookups/s badlookup(doc) -> ["Check proper return values from bad lookups in existing/non existing " @@ -3544,9 +3487,12 @@ fun () -> repeat( fun () -> - Uniq = erlang:unique_integer([positive]), - Name = list_to_atom(TestCase ++ "-" ++ - integer_to_list(Uniq)), + {A, B, C} = now(), + ?line Name = list_to_atom( + TestCase + ++ "-" ++ integer_to_list(A) + ++ "-" ++ integer_to_list(B) + ++ "-" ++ integer_to_list(C)), Tab = ets_new(Name, Flags), ForEachData(fun(Data) -> ets:insert(Tab, Data) end), case Fix of @@ -3824,99 +3770,41 @@ repeat_for_opts(match_object_do). match_object_do(Opts) -> - EtsMem = etsmem(), - Tab = ets_new(foobar, Opts), - fill_tab(Tab, foo), - ets:insert(Tab,{{one,4},4}), - ets:insert(Tab,{{one,5},5}), - ets:insert(Tab,{{two,4},4}), - ets:insert(Tab,{{two,5},6}), - ets:insert(Tab, {#{camembert=>cabécou},7}), - ets:insert(Tab, {#{"hi"=>"hello","wazzup"=>"awesome","1337"=>"42"},8}), - ets:insert(Tab, {#{"hi"=>"hello",#{"wazzup"=>3}=>"awesome","1337"=>"42"},9}), - ets:insert(Tab, {#{"hi"=>"hello","wazzup"=>#{"awesome"=>3},"1337"=>"42"},10}), - Is = lists:seq(1,100), - M1 = maps:from_list([{I,I}||I <- Is]), - M2 = maps:from_list([{I,"hi"}||I <- Is]), - ets:insert(Tab, {M1,11}), - ets:insert(Tab, {M2,12}), - - case ets:match_object(Tab, {{one, '_'}, '$0'}) of + ?line EtsMem = etsmem(), + ?line Tab = ets_new(foobar, Opts), + ?line fill_tab(Tab, foo), + ?line ets:insert(Tab, {{one, 4}, 4}), + ?line ets:insert(Tab,{{one,5},5}), + ?line ets:insert(Tab,{{two,4},4}), + ?line ets:insert(Tab,{{two,5},6}), + ?line case ets:match_object(Tab, {{one, '_'}, '$0'}) of [{{one,5},5},{{one,4},4}] -> ok; [{{one,4},4},{{one,5},5}] -> ok; _ -> ?t:fail("ets:match_object() returned something funny.") end, - case ets:match_object(Tab, {{two, '$1'}, '$0'}) of + ?line case ets:match_object(Tab, {{two, '$1'}, '$0'}) of [{{two,5},6},{{two,4},4}] -> ok; [{{two,4},4},{{two,5},6}] -> ok; _ -> ?t:fail("ets:match_object() returned something funny.") end, - case ets:match_object(Tab, {{two, '$9'}, '$4'}) of + ?line case ets:match_object(Tab, {{two, '$9'}, '$4'}) of [{{two,5},6},{{two,4},4}] -> ok; [{{two,4},4},{{two,5},6}] -> ok; _ -> ?t:fail("ets:match_object() returned something funny.") end, - case ets:match_object(Tab, {{two, '$9'}, '$22'}) of + ?line case ets:match_object(Tab, {{two, '$9'}, '$22'}) of [{{two,5},6},{{two,4},4}] -> ok; [{{two,4},4},{{two,5},6}] -> ok; _ -> ?t:fail("ets:match_object() returned something funny.") end, - - % Check that maps are inspected for variables. - [{#{camembert:=cabécou},7}] = ets:match_object(Tab, {#{camembert=>'_'},7}), - - [{#{"hi":="hello",#{"wazzup"=>3}:="awesome","1337":="42"},9}] = - ets:match_object(Tab, {#{#{"wazzup"=>3}=>"awesome","hi"=>"hello","1337"=>"42"},9}), - [{#{"hi":="hello",#{"wazzup"=>3}:="awesome","1337":="42"},9}] = - ets:match_object(Tab, {#{#{"wazzup"=>3}=>"awesome","hi"=>"hello","1337"=>'_'},'_'}), - [{#{"hi":="hello","wazzup":=#{"awesome":=3},"1337":="42"},10}] = - ets:match_object(Tab, {#{"wazzup"=>'_',"hi"=>'_',"1337"=>'_'},10}), - - %% multiple patterns - Pat = {{#{#{"wazzup"=>3}=>"awesome","hi"=>"hello","1337"=>'_'},'$1'},[{is_integer,'$1'}],['$_']}, - [{#{"hi":="hello",#{"wazzup"=>3}:="awesome","1337":="42"},9}] = - ets:select(Tab, [Pat,Pat,Pat,Pat]), - case ets:match_object(Tab, {#{"hi"=>"hello","wazzup"=>'_',"1337"=>"42"},'_'}) of - [{#{"1337" := "42","hi" := "hello","wazzup" := "awesome"},8}, - {#{"1337" := "42","hi" := "hello","wazzup" := #{"awesome" := 3}},10}] -> ok; - [{#{"1337" := "42","hi" := "hello","wazzup" := #{"awesome" := 3}},10}, - {#{"1337" := "42","hi" := "hello","wazzup" := "awesome"},8}] -> ok; - _ -> ?t:fail("ets:match_object() returned something funny.") - end, - case ets:match_object(Tab, {#{"hi"=>'_'},'_'}) of - [{#{"1337":="42", "hi":="hello"},_}, - {#{"1337":="42", "hi":="hello"},_}, - {#{"1337":="42", "hi":="hello"},_}] -> ok; - _ -> ?t:fail("ets:match_object() returned something funny.") - end, - - %% match large maps - [{#{1:=1,2:=2,99:=99,100:=100},11}] = ets:match_object(Tab, {M1,11}), - [{#{1:="hi",2:="hi",99:="hi",100:="hi"},12}] = ets:match_object(Tab, {M2,12}), - case ets:match_object(Tab, {#{1=>'_',2=>'_'},'_'}) of - %% only match a part of the map - [{#{1:=1,5:=5,99:=99,100:=100},11},{#{1:="hi",6:="hi",99:="hi"},12}] -> ok; - [{#{1:="hi",2:="hi",59:="hi"},12},{#{1:=1,2:=2,39:=39,100:=100},11}] -> ok; - _ -> ?t:fail("ets:match_object() returned something funny.") - end, - case ets:match_object(Tab, {maps:from_list([{I,'_'}||I<-Is]),'_'}) of - %% only match a part of the map - [{#{1:=1,5:=5,99:=99,100:=100},11},{#{1:="hi",6:="hi",99:="hi"},12}] -> ok; - [{#{1:="hi",2:="hi",59:="hi"},12},{#{1:=1,2:=2,39:=39,100:=100},11}] -> ok; - _ -> ?t:fail("ets:match_object() returned something funny.") - end, - {'EXIT',{badarg,_}} = (catch ets:match_object(Tab, {#{'$1'=>'_'},7})), - Mve = maps:from_list([{list_to_atom([$$|integer_to_list(I)]),'_'}||I<-Is]), - {'EXIT',{badarg,_}} = (catch ets:match_object(Tab, {Mve,11})), - - % Check that unsuccessful match returns an empty list. - [] = ets:match_object(Tab, {{three,'$0'}, '$92'}), + % Check that unsucessful match returns an empty list. + ?line [] = ets:match_object(Tab, {{three,'$0'}, '$92'}), % Check that '$0' equals '_'. Len = length(ets:match_object(Tab, '$0')), Len = length(ets:match_object(Tab, '_')), - if Len > 4 -> ok end, - true = ets:delete(Tab), - verify_etsmem(EtsMem). + ?line if Len > 4 -> ok end, + ?line true = ets:delete(Tab), + ?line verify_etsmem(EtsMem). match_object2(suite) -> []; match_object2(doc) -> ["Tests that db_match_object does not generate " @@ -4081,39 +3969,21 @@ "ets table."]; tab2file(suite) -> []; tab2file(Config) when is_list(Config) -> - ?line FName = filename:join([?config(priv_dir, Config),"tab2file_case"]), - tab2file_do(FName, []), - tab2file_do(FName, [{sync,true}]), - tab2file_do(FName, [{sync,false}]), - {'EXIT',{{badmatch,{error,_}},_}} = (catch tab2file_do(FName, [{sync,yes}])), - {'EXIT',{{badmatch,{error,_}},_}} = (catch tab2file_do(FName, [sync])), - ok. - -tab2file_do(FName, Opts) -> %% Write an empty ets table to a file, read back and check properties. - ?line Tab = ets_new(ets_SUITE_foo_tab, [named_table, set, public, - {keypos, 2}, - compressed, - {write_concurrency,true}, - {read_concurrency,true}]), - catch file:delete(FName), - Res = ets:tab2file(Tab, FName, Opts), - true = ets:delete(Tab), - ok = Res, + ?line Tab = ets_new(ets_SUITE_foo_tab, [named_table, set, private, + {keypos, 2}]), + ?line FName = filename:join([?config(priv_dir, Config),"tab2file_case"]), + ?line ok = ets:tab2file(Tab, FName), + ?line true = ets:delete(Tab), % ?line EtsMem = etsmem(), ?line {ok, Tab2} = ets:file2tab(FName), - public = ets:info(Tab2, protection), + ?line private = ets:info(Tab2, protection), ?line true = ets:info(Tab2, named_table), ?line 2 = ets:info(Tab2, keypos), ?line set = ets:info(Tab2, type), - true = ets:info(Tab2, compressed), - Smp = erlang:system_info(smp_support), - Smp = ets:info(Tab2, read_concurrency), - Smp = ets:info(Tab2, write_concurrency), ?line true = ets:delete(Tab2), ?line verify_etsmem(EtsMem). - tab2file2(doc) -> ["Check the ets:tab2file function on a ", "filled set/bag type ets table."]; @@ -4329,7 +4199,7 @@ {error,Y} = ets:file2tab(FName,[{verify,true}]), ets:tab2file(TL,FName,[{extended_info,[md5sum]}]), {X,Y} - end || N <- lists:seq(500,600) ], + end || N <- lists:seq(400,500) ], io:format("~p~n",[Res]), file:delete(FName), ok. @@ -4623,16 +4493,16 @@ T. time_match_object(Tab,Match, Res) -> - T1 = erlang:monotonic_time(micro_seconds), + T1 = erlang:now(), Res = ets:match_object(Tab,Match), - T2 = erlang:monotonic_time(micro_seconds), - T2 - T1. + T2 = erlang:now(), + nowdiff(T1,T2). time_match(Tab,Match) -> - T1 = erlang:monotonic_time(micro_seconds), + T1 = erlang:now(), ets:match(Tab,Match), - T2 = erlang:monotonic_time(micro_seconds), - T2 - T1. + T2 = erlang:now(), + nowdiff(T1,T2). seventyfive_percent_success(_,S,Fa,0) -> true = (S > ((S + Fa) * 0.75)); @@ -4657,6 +4527,11 @@ end. +nowtonumber({Mega, Secs, Milli}) -> + Milli + Secs * 1000000 + Mega * 1000000000000. +nowdiff(T1,T2) -> + nowtonumber(T2) - nowtonumber(T1). + create_random_string(0) -> []; @@ -5125,40 +5000,36 @@ grow_shrink(Config) when is_list(Config) -> ?line EtsMem = etsmem(), - - Set = ets_new(a, [set]), - grow_shrink_0(0, 3071, 3000, 5000, Set), - ets:delete(Set), - - %OrdSet = ets_new(a, [ordered_set]), - %grow_shrink_0(0, lists:seq(3071, 5000), OrdSet), - %ets:delete(OrdSet), - + ?line grow_shrink_0(lists:seq(3071, 5000), EtsMem), ?line verify_etsmem(EtsMem). -grow_shrink_0(N, _, _, Max, _) when N >= Max -> - ok; -grow_shrink_0(N0, GrowN, ShrinkN, Max, T) -> - N1 = grow_shrink_1(N0, GrowN, ShrinkN, T), - grow_shrink_0(N1, GrowN, ShrinkN, Max, T). - -grow_shrink_1(N0, GrowN, ShrinkN, T) -> - N1 = grow_shrink_2(N0+1, N0 + GrowN, T), - grow_shrink_3(N1, N1 - ShrinkN, T). - -grow_shrink_2(N, GrowTo, _) when N > GrowTo -> - %io:format("Grown to ~p\n", [GrowTo]), - GrowTo; -grow_shrink_2(N, GrowTo, T) -> +grow_shrink_0([N|Ns], EtsMem) -> + ?line grow_shrink_1(N, [set]), + ?line grow_shrink_1(N, [ordered_set]), + %% Verifying ets-memory here takes too long time, since + %% lock-free allocators were introduced... + %% ?line verify_etsmem(EtsMem), + grow_shrink_0(Ns, EtsMem); +grow_shrink_0([], _) -> ok. + +grow_shrink_1(N, Flags) -> + ?line T = ets_new(a, Flags), + ?line grow_shrink_2(N, N, T), + ?line ets:delete(T). + +grow_shrink_2(0, Orig, T) -> + List = [{I,a} || I <- lists:seq(1, Orig)], + List = lists:sort(ets:tab2list(T)), + grow_shrink_3(Orig, T); +grow_shrink_2(N, Orig, T) -> true = ets:insert(T, {N,a}), - grow_shrink_2(N+1, GrowTo, T). + grow_shrink_2(N-1, Orig, T). -grow_shrink_3(N, ShrinkTo, _) when N =< ShrinkTo -> - %io:format("Shrunk to ~p\n", [ShrinkTo]), - ShrinkTo; -grow_shrink_3(N, ShrinkTo, T) -> +grow_shrink_3(0, T) -> + [] = ets:tab2list(T); +grow_shrink_3(N, T) -> true = ets:delete(T, N), - grow_shrink_3(N-1, ShrinkTo, T). + grow_shrink_3(N-1, T). grow_pseudo_deleted(doc) -> ["Grow a table that still contains pseudo-deleted objects"]; grow_pseudo_deleted(suite) -> []; @@ -5184,29 +5055,17 @@ ?line Left = ets:info(T,size), ?line Mult = get_kept_objects(T), filltabstr(T,Mult), - my_spawn_opt( - fun() -> - true = ets:info(T,fixed), - Self ! start, - io:put_chars("Starting to filltabstr...\n"), - do_tc(fun() -> - filltabstr(T, Mult, Mult+10000) - end, - fun(Elapsed) -> - io:format("Done with filltabstr in ~p ms\n", - [Elapsed]) - end), - Self ! done - end, [link, {scheduler,2}]), + my_spawn_opt(fun()-> ?line true = ets:info(T,fixed), + Self ! start, + io:format("Starting to filltabstr... ~p\n",[now()]), + filltabstr(T,Mult,Mult+10000), + io:format("Done with filltabstr. ~p\n",[now()]), + Self ! done + end, [link, {scheduler,2}]), ?line start = receive_any(), - io:format("Unfixing table... nitems=~p\n", [ets:info(T, size)]), - do_tc(fun() -> - true = ets:safe_fixtable(T, false) - end, - fun(Elapsed) -> - io:format("Unfix table done in ~p ms. nitems=~p\n", - [Elapsed,ets:info(T, size)]) - end), + io:format("Unfixing table...~p nitems=~p\n",[now(),ets:info(T,size)]), + ?line true = ets:safe_fixtable(T,false), + io:format("Unfix table done. ~p nitems=~p\n",[now(),ets:info(T,size)]), ?line false = ets:info(T,fixed), ?line 0 = get_kept_objects(T), ?line done = receive_any(), @@ -5236,28 +5095,17 @@ [true]}]), ?line Half = ets:info(T,size), ?line Half = get_kept_objects(T), - my_spawn_opt( - fun()-> true = ets:info(T,fixed), - Self ! start, - io:put_chars("Starting to delete... ~p\n"), - do_tc(fun() -> - del_one_by_one_set(T, 1, Half+1) - end, - fun(Elapsed) -> - io:format("Done with delete in ~p ms.\n", - [Elapsed]) - end), - Self ! done - end, [link, {scheduler,2}]), + my_spawn_opt(fun()-> ?line true = ets:info(T,fixed), + Self ! start, + io:format("Starting to delete... ~p\n",[now()]), + del_one_by_one_set(T,1,Half+1), + io:format("Done with delete. ~p\n",[now()]), + Self ! done + end, [link, {scheduler,2}]), ?line start = receive_any(), - io:format("Unfixing table... nitems=~p\n", [ets:info(T, size)]), - do_tc(fun() -> - true = ets:safe_fixtable(T, false) - end, - fun(Elapsed) -> - io:format("Unfix table done in ~p ms. nitems=~p\n", - [Elapsed,ets:info(T, size)]) - end), + io:format("Unfixing table...~p nitems=~p\n",[now(),ets:info(T,size)]), + ?line true = ets:safe_fixtable(T,false), + io:format("Unfix table done. ~p nitems=~p\n",[now(),ets:info(T,size)]), ?line false = ets:info(T,fixed), ?line 0 = get_kept_objects(T), ?line done = receive_any(), @@ -5410,42 +5258,30 @@ ?line Deleted = get_kept_objects(T), {Child, Mref} = - my_spawn_opt( - fun()-> - true = ets:info(T,fixed), - Parent ! start, - io:format("Child waiting for table to be unfixed... mem=~p\n", - [ets:info(T, memory)]), - do_tc(fun() -> - repeat_while(fun()-> ets:info(T, fixed) end) - end, - fun(Elapsed) -> - io:format("Table unfixed in ~p ms." - " Child Fixating! mem=~p\n", - [Elapsed,ets:info(T,memory)]) - end), - true = ets:safe_fixtable(T,true), - repeat_while(fun(Key) when Key =< NumOfObjs -> - ets:delete(T,Key), {true,Key+1}; - (Key) -> {false,Key} - end, - Deleted), - 0 = ets:info(T,size), - true = get_kept_objects(T) >= Left, - done = receive_any() - end, - [link, monitor, {scheduler,2}]), + my_spawn_opt(fun()-> ?line true = ets:info(T,fixed), + Parent ! start, + io:format("Child waiting for table to be unfixed... now=~p mem=~p\n", + [now(),ets:info(T,memory)]), + repeat_while(fun()-> ets:info(T,fixed) end), + io:format("Table unfixed. Child Fixating! now=~p mem=~p\n", + [now(),ets:info(T,memory)]), + ?line true = ets:safe_fixtable(T,true), + repeat_while(fun(Key) when Key =< NumOfObjs -> + ets:delete(T,Key), {true,Key+1}; + (Key) -> {false,Key} + end, + Deleted), + ?line 0 = ets:info(T,size), + ?line true = get_kept_objects(T) >= Left, + ?line done = receive_any() + end, + [link, monitor, {scheduler,2}]), ?line start = receive_any(), ?line true = ets:info(T,fixed), - io:put_chars("Parent starting to unfix... ~p\n"), - do_tc(fun() -> - ets:safe_fixtable(T, false) - end, - fun(Elapsed) -> - io:format("Parent done with unfix in ~p ms.\n", - [Elapsed]) - end), + io:format("Parent starting to unfix... ~p\n",[now()]), + ets:safe_fixtable(T,false), + io:format("Parent done with unfix. ~p\n",[now()]), Child ! done, {'DOWN', Mref, process, Child, normal} = receive_any(), ?line false = ets:info(T,fixed), @@ -5746,43 +5582,6 @@ ets_all_run(). -take(Config) when is_list(Config) -> - %% Simple test for set tables. - T1 = ets_new(a, [set]), - [] = ets:take(T1, foo), - ets:insert(T1, {foo,bar}), - [] = ets:take(T1, bar), - [{foo,bar}] = ets:take(T1, foo), - [] = ets:tab2list(T1), - %% Non-immediate key. - ets:insert(T1, {{'not',<<"immediate">>},ok}), - [{{'not',<<"immediate">>},ok}] = ets:take(T1, {'not',<<"immediate">>}), - %% Same with ordered tables. - T2 = ets_new(b, [ordered_set]), - [] = ets:take(T2, foo), - ets:insert(T2, {foo,bar}), - [] = ets:take(T2, bar), - [{foo,bar}] = ets:take(T2, foo), - [] = ets:tab2list(T2), - ets:insert(T2, {{'not',<<"immediate">>},ok}), - [{{'not',<<"immediate">>},ok}] = ets:take(T2, {'not',<<"immediate">>}), - %% Arithmetically-equal keys. - ets:insert(T2, [{1.0,float},{2,integer}]), - [{1.0,float}] = ets:take(T2, 1), - [{2,integer}] = ets:take(T2, 2.0), - [] = ets:tab2list(T2), - %% Same with bag. - T3 = ets_new(c, [bag]), - ets:insert(T3, [{1,1},{1,2},{3,3}]), - [{1,1},{1,2}] = ets:take(T3, 1), - [{3,3}] = ets:take(T3, 3), - [] = ets:tab2list(T3), - ets:delete(T1), - ets:delete(T2), - ets:delete(T3), - ok. - - % % Utility functions: % @@ -5931,7 +5730,7 @@ io:format("Actual: ~p", [MemInfo2]), io:format("Changed tables before: ~p\n",[AllTabs -- AllTabs2]), io:format("Changed tables after: ~p\n", [AllTabs2 -- AllTabs]), - ets_test_spawn_logger ! {failed_memcheck, get('__ETS_TEST_CASE__')}, + ets_test_spawn_logger ! failed_memcheck, {comment, "Failed memory check"} end. @@ -5982,8 +5781,8 @@ From ! test_procs_synced, spawn_logger([From], FailedMemchecks); - {failed_memcheck, TestCase} -> - spawn_logger(Procs, [TestCase|FailedMemchecks]); + failed_memcheck -> + spawn_logger(Procs, FailedMemchecks+1); {Pid, get_failed_memchecks} -> Pid ! {get_failed_memchecks, FailedMemchecks}, @@ -6003,7 +5802,7 @@ case whereis(ets_test_spawn_logger) of Pid when is_pid(Pid) -> true; _ -> register(ets_test_spawn_logger, - spawn_opt(fun () -> spawn_logger([], []) end, + spawn_opt(fun () -> spawn_logger([], 0) end, [{priority, max}])) end. @@ -6447,10 +6246,3 @@ ets_new(Name, Opts) -> %%ets:new(Name, [compressed | Opts]). ets:new(Name, Opts). - -do_tc(Do, Report) -> - T1 = erlang:monotonic_time(), - Do(), - T2 = erlang:monotonic_time(), - Elapsed = erlang:convert_time_unit(T2 - T1, native, milli_seconds), - Report(Elapsed). diff -Nru erlang-18.2-dfsg/lib/stdlib/test/ets_tough_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/ets_tough_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/ets_tough_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/ets_tough_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/expand_test1.erl erlang-17.3-dfsg/lib/stdlib/test/expand_test1.erl --- erlang-18.2-dfsg/lib/stdlib/test/expand_test1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/expand_test1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/ExpandTestCaps1.erl erlang-17.3-dfsg/lib/stdlib/test/ExpandTestCaps1.erl --- erlang-18.2-dfsg/lib/stdlib/test/ExpandTestCaps1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/ExpandTestCaps1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/ExpandTestCaps.erl erlang-17.3-dfsg/lib/stdlib/test/ExpandTestCaps.erl --- erlang-18.2-dfsg/lib/stdlib/test/ExpandTestCaps.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/ExpandTestCaps.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/expand_test.erl erlang-17.3-dfsg/lib/stdlib/test/expand_test.erl --- erlang-18.2-dfsg/lib/stdlib/test/expand_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/expand_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/filelib_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/filelib_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/filelib_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/filelib_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2005-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -78,8 +77,7 @@ L = filelib:wildcard(Wc), L = filelib:wildcard(Wc, erl_prim_loader), L = filelib:wildcard(Wc, "."), - L = filelib:wildcard(Wc, Dir), - L = filelib:wildcard(Wc, Dir++"/.") + L = filelib:wildcard(Wc, Dir) end), ?line file:set_cwd(OldCwd), ?line ok = file:del_dir(Dir), @@ -90,7 +88,6 @@ ?line ok = file:make_dir(Dir), ?line do_wildcard_1(Dir, fun(Wc) -> io:format("~p~n",[{Wc,Dir, X = filelib:wildcard(Wc, Dir)}]),X end), ?line do_wildcard_1(Dir, fun(Wc) -> filelib:wildcard(Wc, Dir++"/") end), - ?line do_wildcard_1(Dir, fun(Wc) -> filelib:wildcard(Wc, Dir++"/.") end), case os:type() of {win32,_} -> ok; diff -Nru erlang-18.2-dfsg/lib/stdlib/test/filename_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/filename_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/filename_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/filename_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2014. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -288,66 +287,38 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% join(Config) when is_list(Config) -> - %% Whenever joining two elements, test the equivalence between - %% join/1 and join/2 (OTP-12158) by using help function - %% filename_join/2. ?line "/" = filename:join(["/"]), ?line "/" = filename:join(["//"]), - "usr/foo.erl" = filename_join("usr","foo.erl"), - "/src/foo.erl" = filename_join(usr, "/src/foo.erl"), - "/src/foo.erl" = filename_join("/src/",'foo.erl'), - "/src/foo.erl" = filename_join(usr, ["/sr", 'c/foo.erl']), - "/src/foo.erl" = filename_join("usr", "/src/foo.erl"), + ?line "usr/foo.erl" = filename:join("usr","foo.erl"), + ?line "/src/foo.erl" = filename:join(usr, "/src/foo.erl"), + ?line "/src/foo.erl" = filename:join(["/src/",'foo.erl']), + ?line "/src/foo.erl" = filename:join(usr, ["/sr", 'c/foo.erl']), + ?line "/src/foo.erl" = filename:join("usr", "/src/foo.erl"), %% Make sure that redundant slashes work too. ?line "a/b/c/d/e/f/g" = filename:join(["a//b/c/////d//e/f/g"]), - "a/b/c/d/e/f/g" = filename_join("a//b/c/", "d//e/f/g"), - "a/b/c/d/e/f/g" = filename_join("a//b/c", "d//e/f/g"), - "/d/e/f/g" = filename_join("a//b/c", "/d//e/f/g"), - "/d/e/f/g" = filename:join("a//b/c", "//d//e/f/g"), - - "foo/bar" = filename_join([$f,$o,$o,$/,[]], "bar"), - - %% Single dots - should be removed if in the middle of the path, - %% but not at the end of the path. - "/." = filename:join(["/."]), - "/" = filename:join(["/./"]), - "/." = filename:join(["/./."]), - "./." = filename:join(["./."]), - - "/a/b" = filename_join("/a/.","b"), - "/a/b/." = filename_join("/a/.","b/."), - "/a/." = filename_join("/a/.","."), - "/a/." = filename_join("/a","."), - "/a/." = filename_join("/a/.",""), - "./." = filename_join("./.","."), - "./." = filename_join("./","."), - "./." = filename_join("./.",""), - "." = filename_join(".",""), - "./." = filename_join(".","."), - - %% Trailing slash shall be removed - except the root - "/" = filename:join(["/"]), - "/" = filename:join(["/./"]), - "/a" = filename:join(["/a/"]), - "/b" = filename_join("/a/","/b/"), - "/a/b" = filename_join("/a/","b/"), + ?line "a/b/c/d/e/f/g" = filename:join(["a//b/c/", "d//e/f/g"]), + ?line "a/b/c/d/e/f/g" = filename:join(["a//b/c", "d//e/f/g"]), + ?line "/d/e/f/g" = filename:join(["a//b/c", "/d//e/f/g"]), + ?line "/d/e/f/g" = filename:join(["a//b/c", "//d//e/f/g"]), + + ?line "foo/bar" = filename:join([$f,$o,$o,$/,[]], "bar"), ?line case os:type() of {win32, _} -> ?line "d:/" = filename:join(["D:/"]), ?line "d:/" = filename:join(["D:\\"]), - "d:/abc" = filename_join("D:/", "abc"), - "d:abc" = filename_join("D:", "abc"), + ?line "d:/abc" = filename:join(["D:/", "abc"]), + ?line "d:abc" = filename:join(["D:", "abc"]), ?line "a/b/c/d/e/f/g" = filename:join(["a//b\\c//\\/\\d/\\e/f\\g"]), ?line "a:usr/foo.erl" = filename:join(["A:","usr","foo.erl"]), ?line "/usr/foo.erl" = filename:join(["A:","/usr","foo.erl"]), - "c:usr" = filename_join("A:","C:usr"), - "a:usr" = filename_join("A:","usr"), - "c:/usr" = filename_join("A:", "C:/usr"), + ?line "c:usr" = filename:join("A:","C:usr"), + ?line "a:usr" = filename:join("A:","usr"), + ?line "c:/usr" = filename:join("A:", "C:/usr"), ?line "c:/usr/foo.erl" = filename:join(["A:","C:/usr","foo.erl"]), ?line "c:usr/foo.erl" = @@ -358,11 +329,6 @@ ok end. -%% Make sure join([A,B]) is equivalent to join(A,B) (OTP-12158) -filename_join(A,B) -> - Res = filename:join(A,B), - Res = filename:join([A,B]). - pathtype(Config) when is_list(Config) -> ?line relative = filename:pathtype(".."), ?line relative = filename:pathtype("foo"), @@ -396,8 +362,6 @@ ?line ["foo", "bar", "hello"]= filename:split("foo////bar//hello"), ?line ["foo", "bar", "hello"]= filename:split(["foo//",'//bar//h',"ello"]), ?line ["foo", "bar", "hello"]= filename:split(["foo//",'//bar//h'|ello]), - ["/"] = filename:split("/"), - [] = filename:split(""), case os:type() of {win32,_} -> ?line ["a:/","msdev","include"] = @@ -669,53 +633,6 @@ ?line <<"foo/bar">> = filename:join([$f,$o,$o,$/,[]], <<"bar">>), - %% Single dots - should be removed if in the middle of the path, - %% but not at the end of the path. - %% Also test equivalence between join/1 and join/2 (OTP-12158) - <<"/.">> = filename:join([<<"/.">>]), - <<"/">> = filename:join([<<"/./">>]), - <<"/.">> = filename:join([<<"/./.">>]), - <<"./.">> = filename:join([<<"./.">>]), - - <<"/a/b">> = filename:join([<<"/a/.">>,<<"b">>]), - <<"/a/b">> = filename:join(<<"/a/.">>,<<"b">>), - - <<"/a/b/.">> = filename:join([<<"/a/.">>,<<"b/.">>]), - <<"/a/b/.">> = filename:join(<<"/a/.">>,<<"b/.">>), - - <<"/a/.">> = filename:join([<<"/a/.">>,<<".">>]), - <<"/a/.">> = filename:join(<<"/a/.">>,<<".">>), - - <<"/a/.">> = filename:join([<<"/a">>,<<".">>]), - <<"/a/.">> = filename:join(<<"/a">>,<<".">>), - - <<"/a/.">> = filename:join([<<"/a/.">>,<<"">>]), - <<"/a/.">> = filename:join(<<"/a/.">>,<<"">>), - - <<"./.">> = filename:join([<<"./.">>,<<".">>]), - <<"./.">> = filename:join(<<"./.">>,<<".">>), - - <<"./.">> = filename:join([<<"./">>,<<".">>]), - <<"./.">> = filename:join(<<"./">>,<<".">>), - - <<"./.">> = filename:join([<<"./.">>,<<"">>]), - <<"./.">> = filename:join(<<"./.">>,<<"">>), - - <<".">> = filename:join([<<".">>,<<"">>]), - <<".">> = filename:join(<<".">>,<<"">>), - - <<"./.">> = filename:join([<<".">>,<<".">>]), - <<"./.">> = filename:join(<<".">>,<<".">>), - - %% Trailing slash shall be removed - except the root - <<"/">> = filename:join([<<"/">>]), - <<"/">> = filename:join([<<"/./">>]), - <<"/a">> = filename:join([<<"/a/">>]), - <<"/b">> = filename:join([<<"/a/">>,<<"/b/">>]), - <<"/b">> = filename:join(<<"/a/">>,<<"/b/">>), - <<"/a/b">> = filename:join([<<"/a/">>,<<"b/">>]), - <<"/a/b">> = filename:join(<<"/a/">>,<<"b/">>), - ?line case os:type() of {win32, _} -> ?line <<"d:/">> = filename:join([<<"D:/">>]), @@ -770,8 +687,6 @@ [<<"/">>,<<"usr">>,<<"local">>,<<"bin">>] = filename:split(<<"/usr/local/bin">>), [<<"foo">>,<<"bar">>]= filename:split(<<"foo/bar">>), [<<"foo">>, <<"bar">>, <<"hello">>]= filename:split(<<"foo////bar//hello">>), - [<<"/">>] = filename:split(<<"/">>), - [] = filename:split(<<"">>), case os:type() of {win32,_} -> [<<"a:/">>,<<"msdev">>,<<"include">>] = diff -Nru erlang-18.2-dfsg/lib/stdlib/test/file_sorter_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/file_sorter_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/file_sorter_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/file_sorter_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/fixtable_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/fixtable_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/fixtable_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/fixtable_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/format_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/format_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/format_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/format_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/gen_event_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/gen_event_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/gen_event_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/gen_event_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2014. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -107,7 +106,7 @@ ?line {error, {already_started, _}} = gen_event:start({global, my_dummy_name}), - ok = gen_event:stop({global, my_dummy_name}, shutdown, 10000), + exit(Pid6, shutdown), receive {'EXIT', Pid6, shutdown} -> ok after 10000 -> @@ -132,105 +131,90 @@ ok. +hibernate(suite) -> []; hibernate(Config) when is_list(Config) -> - {ok,Pid} = gen_event:start({local, my_dummy_handler}), - ok = gen_event:add_handler(my_dummy_handler, dummy_h, [self()]), - [dummy_h] = gen_event:which_handlers(my_dummy_handler), - true = gen_event:call(my_dummy_handler, dummy_h, hibernate), - is_in_erlang_hibernate(Pid), - - Pid ! wake, - is_not_in_erlang_hibernate(Pid), - later = gen_event:call(my_dummy_handler, dummy_h, hibernate_later), - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - is_in_erlang_hibernate(Pid), - - Pid ! wake, - is_not_in_erlang_hibernate(Pid), - gen_event:notify(my_dummy_handler, hibernate), - is_in_erlang_hibernate(Pid), - gen_event:notify(my_dummy_handler, wakeup), - is_not_in_erlang_hibernate(Pid), - gen_event:notify(my_dummy_handler, hibernate), - is_in_erlang_hibernate(Pid), - gen_event:sync_notify(my_dummy_handler, wakeup), - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - ok = gen_event:sync_notify(my_dummy_handler, hibernate), - is_in_erlang_hibernate(Pid), - - Pid ! wake, - is_not_in_erlang_hibernate(Pid), - ok = gen_event:add_handler(my_dummy_handler, dummy1_h, [self()]), - [_,_] = gen_event:which_handlers(my_dummy_handler), - gen_event:notify(my_dummy_handler, hibernate), - is_in_erlang_hibernate(Pid), - gen_event:notify(my_dummy_handler, wakeup), - is_in_erlang_hibernate(Pid), - - Pid ! wake, - is_not_in_erlang_hibernate(Pid), - - Pid ! gnurf, - is_in_erlang_hibernate(Pid), - - Pid ! sleep, - is_in_erlang_hibernate(Pid), - - Pid ! wake, - is_not_in_erlang_hibernate(Pid), - ok = gen_event:stop(my_dummy_handler), - - {ok,Pid2} = gen_event:start({local, my_dummy_handler}), - ok = gen_event:add_handler(my_dummy_handler, dummy_h, - [self(),hibernate]), - is_in_erlang_hibernate(Pid2), - sys:suspend(my_dummy_handler), - is_in_erlang_hibernate(Pid2), - sys:resume(my_dummy_handler), - is_in_erlang_hibernate(Pid2), - - Pid2 ! wake, - is_not_in_erlang_hibernate(Pid2), + ?line {ok,Pid} = gen_event:start({local, my_dummy_handler}), + ?line ok = gen_event:add_handler(my_dummy_handler, dummy_h, [self()]), + ?line [dummy_h] = gen_event:which_handlers(my_dummy_handler), + ?line true = gen_event:call(my_dummy_handler, dummy_h, hibernate), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line Pid ! wake, + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= + erlang:process_info(Pid,current_function)), + ?line later = gen_event:call(my_dummy_handler, dummy_h, hibernate_later), + ?line true = ({current_function,{erlang,hibernate,3}} =/= + erlang:process_info(Pid,current_function)), + ?line receive after 2000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line Pid ! wake, + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= + erlang:process_info(Pid,current_function)), + ?line gen_event:notify(my_dummy_handler,hibernate), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line gen_event:notify(my_dummy_handler,wakeup), + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= + erlang:process_info(Pid,current_function)), + ?line gen_event:notify(my_dummy_handler,hibernate), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line gen_event:sync_notify(my_dummy_handler,wakeup), + ?line true = ({current_function,{erlang,hibernate,3}} =/= + erlang:process_info(Pid,current_function)), + ?line ok = gen_event:sync_notify(my_dummy_handler,hibernate), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line Pid ! wake, + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= + erlang:process_info(Pid,current_function)), + ?line ok = gen_event:add_handler(my_dummy_handler, dummy1_h, [self()]), + ?line [_,_] = gen_event:which_handlers(my_dummy_handler), + ?line gen_event:notify(my_dummy_handler,hibernate), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line gen_event:notify(my_dummy_handler,wakeup), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line Pid ! wake, + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= + erlang:process_info(Pid,current_function)), + ?line Pid ! gnurf, + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line Pid ! sleep, + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line Pid ! wake, + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= + erlang:process_info(Pid,current_function)), + ?line ok = gen_event:stop(my_dummy_handler), + ?line {ok,Pid2} = gen_event:start({local, my_dummy_handler}), + ?line ok = gen_event:add_handler(my_dummy_handler, dummy_h, [self(),hibernate]), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid2,current_function), + ?line sys:suspend(my_dummy_handler), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid2,current_function), + ?line sys:resume(my_dummy_handler), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid2,current_function), + ?line Pid2 ! wake, + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= + erlang:process_info(Pid2,current_function)), - ok = gen_event:stop(my_dummy_handler), + + ?line ok = gen_event:stop(my_dummy_handler), ok. -is_in_erlang_hibernate(Pid) -> - receive after 1 -> ok end, - is_in_erlang_hibernate_1(200, Pid). - -is_in_erlang_hibernate_1(0, Pid) -> - io:format("~p\n", [erlang:process_info(Pid, current_function)]), - ?t:fail(not_in_erlang_hibernate_3); -is_in_erlang_hibernate_1(N, Pid) -> - {current_function,MFA} = erlang:process_info(Pid, current_function), - case MFA of - {erlang,hibernate,3} -> - ok; - _ -> - receive after 10 -> ok end, - is_in_erlang_hibernate_1(N-1, Pid) - end. - -is_not_in_erlang_hibernate(Pid) -> - receive after 1 -> ok end, - is_not_in_erlang_hibernate_1(200, Pid). - -is_not_in_erlang_hibernate_1(0, Pid) -> - io:format("~p\n", [erlang:process_info(Pid, current_function)]), - ?t:fail(not_in_erlang_hibernate_3); -is_not_in_erlang_hibernate_1(N, Pid) -> - {current_function,MFA} = erlang:process_info(Pid, current_function), - case MFA of - {erlang,hibernate,3} -> - receive after 10 -> ok end, - is_not_in_erlang_hibernate_1(N-1, Pid); - _ -> - ok - end. add_handler(doc) -> []; @@ -412,6 +396,7 @@ ok end, ?line ok = gen_event:notify(my_dummy_handler, {swap_event,dummy1_h,swap}), + ?t:sleep(1000), ?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler), ?line ok = gen_event:notify(my_dummy_handler, Event), ?line receive @@ -444,6 +429,7 @@ end, ?line ok = gen_event:notify(my_dummy_handler, {swap_event, {dummy1_h, 9}, swap}), + ?t:sleep(1000), ?line [{dummy1_h,9}] = gen_event:which_handlers(my_dummy_handler), ?line ok = gen_event:notify(my_dummy_handler, Event), ?line receive @@ -483,6 +469,7 @@ ?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]), ?line ok = gen_event:notify(my_dummy_handler, {swap_event,dummy1_h,swap}), + ?t:sleep(1000), ?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler), ?line ok = gen_event:notify(my_dummy_handler, do_crash), @@ -493,6 +480,7 @@ ?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]), ?line ok = gen_event:notify(my_dummy_handler, {swap_event,dummy1_h,swap}), + ?t:sleep(1000), ?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler), ?line ok = gen_event:notify(my_dummy_handler, delete_event), @@ -525,6 +513,7 @@ end, ?line ok = gen_event:sync_notify(my_dummy_handler, {swap_event, dummy1_h, swap}), + ?t:sleep(1000), ?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler), ?line ok = gen_event:sync_notify(my_dummy_handler, Event), ?line receive @@ -557,6 +546,7 @@ end, ?line ok = gen_event:sync_notify(my_dummy_handler, {swap_event, {dummy1_h, 9}, swap}), + ?t:sleep(1000), ?line [{dummy1_h,9}] = gen_event:which_handlers(my_dummy_handler), ?line ok = gen_event:sync_notify(my_dummy_handler, Event), ?line receive @@ -597,6 +587,7 @@ ?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]), ?line ok = gen_event:sync_notify(my_dummy_handler, {swap_event,dummy1_h,swap}), + ?t:sleep(1000), ?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler), ?line ok = gen_event:sync_notify(my_dummy_handler, do_crash), @@ -608,6 +599,7 @@ ?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]), ?line ok = gen_event:sync_notify(my_dummy_handler, {swap_event,dummy1_h,swap}), + ?t:sleep(1000), ?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler), ?line ok = gen_event:sync_notify(my_dummy_handler, delete_event), @@ -781,6 +773,7 @@ ok end, ?line my_dummy_handler ! {swap_info,dummy1_h,swap}, + ?t:sleep(1000), ?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler), ?line my_dummy_handler ! Info, ?line receive @@ -812,6 +805,7 @@ ok end, ?line my_dummy_handler ! {swap_info,{dummy1_h,2},swap}, + ?t:sleep(1000), ?line [{dummy1_h,2}] = gen_event:which_handlers(my_dummy_handler), ?line my_dummy_handler ! Info, ?line receive @@ -843,6 +837,7 @@ ok end, ?line my_dummy_handler ! {swap_info,dummy1_h,swap}, + ?t:sleep(1000), ?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler), ?line my_dummy_handler ! Info, ?line receive diff -Nru erlang-18.2-dfsg/lib/stdlib/test/gen_fsm_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/gen_fsm_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/gen_fsm_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/gen_fsm_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -28,9 +27,6 @@ -export([start1/1, start2/1, start3/1, start4/1, start5/1, start6/1, start7/1, start8/1, start9/1, start10/1, start11/1, start12/1]). --export([stop1/1, stop2/1, stop3/1, stop4/1, stop5/1, stop6/1, stop7/1, - stop8/1, stop9/1, stop10/1]). - -export([ abnormal1/1, abnormal2/1]). -export([shutdown/1]). @@ -70,8 +66,6 @@ [{start, [], [start1, start2, start3, start4, start5, start6, start7, start8, start9, start10, start11, start12]}, - {stop, [], - [stop1, stop2, stop3, stop4, stop5, stop6, stop7, stop8, stop9, stop10]}, {abnormal, [], [abnormal1, abnormal2]}, {sys, [], [sys1, call_format_status, error_format_status, terminate_crash_format, @@ -287,105 +281,6 @@ ok. -%% Anonymous, reason 'normal' -stop1(_Config) -> - {ok, Pid} = gen_fsm:start(?MODULE, [], []), - ok = gen_fsm:stop(Pid), - false = erlang:is_process_alive(Pid), - {'EXIT',noproc} = (catch gen_fsm:stop(Pid)), - ok. - -%% Anonymous, other reason -stop2(_Config) -> - {ok,Pid} = gen_fsm:start(?MODULE, [], []), - ok = gen_fsm:stop(Pid, other_reason, infinity), - false = erlang:is_process_alive(Pid), - ok. - -%% Anonymous, invalid timeout -stop3(_Config) -> - {ok,Pid} = gen_fsm:start(?MODULE, [], []), - {'EXIT',_} = (catch gen_fsm:stop(Pid, other_reason, invalid_timeout)), - true = erlang:is_process_alive(Pid), - ok = gen_fsm:stop(Pid), - false = erlang:is_process_alive(Pid), - ok. - -%% Registered name -stop4(_Config) -> - {ok,Pid} = gen_fsm:start({local,to_stop},?MODULE, [], []), - ok = gen_fsm:stop(to_stop), - false = erlang:is_process_alive(Pid), - {'EXIT',noproc} = (catch gen_fsm:stop(to_stop)), - ok. - -%% Registered name and local node -stop5(_Config) -> - {ok,Pid} = gen_fsm:start({local,to_stop},?MODULE, [], []), - ok = gen_fsm:stop({to_stop,node()}), - false = erlang:is_process_alive(Pid), - {'EXIT',noproc} = (catch gen_fsm:stop({to_stop,node()})), - ok. - -%% Globally registered name -stop6(_Config) -> - {ok, Pid} = gen_fsm:start({global, to_stop}, ?MODULE, [], []), - ok = gen_fsm:stop({global,to_stop}), - false = erlang:is_process_alive(Pid), - {'EXIT',noproc} = (catch gen_fsm:stop({global,to_stop})), - ok. - -%% 'via' registered name -stop7(_Config) -> - dummy_via:reset(), - {ok, Pid} = gen_fsm:start({via, dummy_via, to_stop}, - ?MODULE, [], []), - ok = gen_fsm:stop({via, dummy_via, to_stop}), - false = erlang:is_process_alive(Pid), - {'EXIT',noproc} = (catch gen_fsm:stop({via, dummy_via, to_stop})), - ok. - -%% Anonymous on remote node -stop8(_Config) -> - {ok,Node} = test_server:start_node(gen_fsm_SUITE_stop8,slave,[]), - Dir = filename:dirname(code:which(?MODULE)), - rpc:call(Node,code,add_path,[Dir]), - {ok, Pid} = rpc:call(Node,gen_fsm,start,[?MODULE,[],[]]), - ok = gen_fsm:stop(Pid), - false = rpc:call(Node,erlang,is_process_alive,[Pid]), - {'EXIT',noproc} = (catch gen_fsm:stop(Pid)), - true = test_server:stop_node(Node), - {'EXIT',{{nodedown,Node},_}} = (catch gen_fsm:stop(Pid)), - ok. - -%% Registered name on remote node -stop9(_Config) -> - {ok,Node} = test_server:start_node(gen_fsm_SUITE_stop9,slave,[]), - Dir = filename:dirname(code:which(?MODULE)), - rpc:call(Node,code,add_path,[Dir]), - {ok, Pid} = rpc:call(Node,gen_fsm,start,[{local,to_stop},?MODULE,[],[]]), - ok = gen_fsm:stop({to_stop,Node}), - undefined = rpc:call(Node,erlang,whereis,[to_stop]), - false = rpc:call(Node,erlang,is_process_alive,[Pid]), - {'EXIT',noproc} = (catch gen_fsm:stop({to_stop,Node})), - true = test_server:stop_node(Node), - {'EXIT',{{nodedown,Node},_}} = (catch gen_fsm:stop({to_stop,Node})), - ok. - -%% Globally registered name on remote node -stop10(_Config) -> - {ok,Node} = test_server:start_node(gen_fsm_SUITE_stop10,slave,[]), - Dir = filename:dirname(code:which(?MODULE)), - rpc:call(Node,code,add_path,[Dir]), - {ok, Pid} = rpc:call(Node,gen_fsm,start,[{global,to_stop},?MODULE,[],[]]), - global:sync(), - ok = gen_fsm:stop({global,to_stop}), - false = rpc:call(Node,erlang,is_process_alive,[Pid]), - {'EXIT',noproc} = (catch gen_fsm:stop({global,to_stop})), - true = test_server:stop_node(Node), - {'EXIT',noproc} = (catch gen_fsm:stop({global,to_stop})), - ok. - %% Check that time outs in calls work abnormal1(suite) -> []; abnormal1(Config) when is_list(Config) -> @@ -539,7 +434,7 @@ io:format("Timeout: expected error logger msg", []), ?t:fail() end, - _ = ?t:messages_get(), + [] = ?t:messages_get(), process_flag(trap_exit, OldFl), ok. @@ -597,123 +492,129 @@ ok. %% Hibernation +hibernate(suite) -> []; hibernate(Config) when is_list(Config) -> OldFl = process_flag(trap_exit, true), - {ok, Pid0} = gen_fsm:start_link(?MODULE, hiber_now, []), - is_in_erlang_hibernate(Pid0), - stop_it(Pid0), + ?line {ok, Pid0} = gen_fsm:start_link(?MODULE, hiber_now, []), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid0,current_function), + ?line stop_it(Pid0), test_server:messages_get(), - {ok, Pid} = gen_fsm:start_link(?MODULE, hiber, []), - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid,current_function)), - hibernating = gen_fsm:sync_send_event(Pid, hibernate_sync), - is_in_erlang_hibernate(Pid), - good_morning = gen_fsm:sync_send_event(Pid, wakeup_sync), - is_not_in_erlang_hibernate(Pid), - hibernating = gen_fsm:sync_send_event(Pid, hibernate_sync), - is_in_erlang_hibernate(Pid), - five_more = gen_fsm:sync_send_event(Pid, snooze_sync), - is_in_erlang_hibernate(Pid), - good_morning = gen_fsm:sync_send_event(Pid, wakeup_sync), - is_not_in_erlang_hibernate(Pid), - ok = gen_fsm:send_event(Pid, hibernate_async), - is_in_erlang_hibernate(Pid), - ok = gen_fsm:send_event(Pid, wakeup_async), - is_not_in_erlang_hibernate(Pid), - ok = gen_fsm:send_event(Pid, hibernate_async), - is_in_erlang_hibernate(Pid), - ok = gen_fsm:send_event(Pid, snooze_async), - is_in_erlang_hibernate(Pid), - ok = gen_fsm:send_event(Pid, wakeup_async), - is_not_in_erlang_hibernate(Pid), - - Pid ! hibernate_later, - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - is_in_erlang_hibernate(Pid), - - 'alive!' = gen_fsm:sync_send_event(Pid,'alive?'), - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - Pid ! hibernate_now, - is_in_erlang_hibernate(Pid), - - 'alive!' = gen_fsm:sync_send_event(Pid,'alive?'), - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - - hibernating = gen_fsm:sync_send_all_state_event(Pid, hibernate_sync), - is_in_erlang_hibernate(Pid), - good_morning = gen_fsm:sync_send_all_state_event(Pid, wakeup_sync), - is_not_in_erlang_hibernate(Pid), - hibernating = gen_fsm:sync_send_all_state_event(Pid, hibernate_sync), - is_in_erlang_hibernate(Pid), - five_more = gen_fsm:sync_send_all_state_event(Pid, snooze_sync), - is_in_erlang_hibernate(Pid), - good_morning = gen_fsm:sync_send_all_state_event(Pid, wakeup_sync), - is_not_in_erlang_hibernate(Pid), - ok = gen_fsm:send_all_state_event(Pid, hibernate_async), - is_in_erlang_hibernate(Pid), - ok = gen_fsm:send_all_state_event(Pid, wakeup_async), - is_not_in_erlang_hibernate(Pid), - ok = gen_fsm:send_all_state_event(Pid, hibernate_async), - is_in_erlang_hibernate(Pid), - ok = gen_fsm:send_all_state_event(Pid, snooze_async), - is_in_erlang_hibernate(Pid), - ok = gen_fsm:send_all_state_event(Pid, wakeup_async), - is_not_in_erlang_hibernate(Pid), - - hibernating = gen_fsm:sync_send_all_state_event(Pid, hibernate_sync), - is_in_erlang_hibernate(Pid), - sys:suspend(Pid), - is_in_erlang_hibernate(Pid), - sys:resume(Pid), - is_in_erlang_hibernate(Pid), - receive after 1000 -> ok end, - is_in_erlang_hibernate(Pid), - good_morning = gen_fsm:sync_send_all_state_event(Pid, wakeup_sync), - is_not_in_erlang_hibernate(Pid), - stop_it(Pid), + ?line {ok, Pid} = gen_fsm:start_link(?MODULE, hiber, []), + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line hibernating = gen_fsm:sync_send_event(Pid,hibernate_sync), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line good_morning = gen_fsm:sync_send_event(Pid,wakeup_sync), + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line hibernating = gen_fsm:sync_send_event(Pid,hibernate_sync), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line five_more = gen_fsm:sync_send_event(Pid,snooze_sync), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line good_morning = gen_fsm:sync_send_event(Pid,wakeup_sync), + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line ok = gen_fsm:send_event(Pid,hibernate_async), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line ok = gen_fsm:send_event(Pid,wakeup_async), + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line ok = gen_fsm:send_event(Pid,hibernate_async), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line ok = gen_fsm:send_event(Pid,snooze_async), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line ok = gen_fsm:send_event(Pid,wakeup_async), + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line Pid ! hibernate_later, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line receive after 2000 -> ok end, + ?line ({current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function)), + ?line 'alive!' = gen_fsm:sync_send_event(Pid,'alive?'), + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line Pid ! hibernate_now, + ?line receive after 1000 -> ok end, + ?line ({current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function)), + ?line 'alive!' = gen_fsm:sync_send_event(Pid,'alive?'), + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + + + ?line hibernating = gen_fsm:sync_send_all_state_event(Pid,hibernate_sync), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line good_morning = gen_fsm:sync_send_all_state_event(Pid,wakeup_sync), + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line hibernating = gen_fsm:sync_send_all_state_event(Pid,hibernate_sync), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line five_more = gen_fsm:sync_send_all_state_event(Pid,snooze_sync), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line good_morning = gen_fsm:sync_send_all_state_event(Pid,wakeup_sync), + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line ok = gen_fsm:send_all_state_event(Pid,hibernate_async), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line ok = gen_fsm:send_all_state_event(Pid,wakeup_async), + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line ok = gen_fsm:send_all_state_event(Pid,hibernate_async), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line ok = gen_fsm:send_all_state_event(Pid,snooze_async), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line ok = gen_fsm:send_all_state_event(Pid,wakeup_async), + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + + ?line hibernating = gen_fsm:sync_send_all_state_event(Pid,hibernate_sync), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line sys:suspend(Pid), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line sys:resume(Pid), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = + erlang:process_info(Pid,current_function), + ?line good_morning = gen_fsm:sync_send_all_state_event(Pid,wakeup_sync), + ?line receive after 1000 -> ok end, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line stop_it(Pid), test_server:messages_get(), process_flag(trap_exit, OldFl), ok. -is_in_erlang_hibernate(Pid) -> - receive after 1 -> ok end, - is_in_erlang_hibernate_1(200, Pid). - -is_in_erlang_hibernate_1(0, Pid) -> - io:format("~p\n", [erlang:process_info(Pid, current_function)]), - ?t:fail(not_in_erlang_hibernate_3); -is_in_erlang_hibernate_1(N, Pid) -> - {current_function,MFA} = erlang:process_info(Pid, current_function), - case MFA of - {erlang,hibernate,3} -> - ok; - _ -> - receive after 10 -> ok end, - is_in_erlang_hibernate_1(N-1, Pid) - end. - -is_not_in_erlang_hibernate(Pid) -> - receive after 1 -> ok end, - is_not_in_erlang_hibernate_1(200, Pid). - -is_not_in_erlang_hibernate_1(0, Pid) -> - io:format("~p\n", [erlang:process_info(Pid, current_function)]), - ?t:fail(not_in_erlang_hibernate_3); -is_not_in_erlang_hibernate_1(N, Pid) -> - {current_function,MFA} = erlang:process_info(Pid, current_function), - case MFA of - {erlang,hibernate,3} -> - receive after 10 -> ok end, - is_not_in_erlang_hibernate_1(N-1, Pid); - _ -> - ok - end. + %%sys1(suite) -> []; %%sys1(_) -> diff -Nru erlang-18.2-dfsg/lib/stdlib/test/gen_server_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/gen_server_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/gen_server_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/gen_server_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -37,9 +36,6 @@ get_state/1, replace_state/1, call_with_huge_message_queue/1 ]). --export([stop1/1, stop2/1, stop3/1, stop4/1, stop5/1, stop6/1, stop7/1, - stop8/1, stop9/1, stop10/1]). - % spawn export -export([spec_init_local/2, spec_init_global/2, spec_init_via/2, spec_init_default_timeout/2, spec_init_global_default_timeout/2, @@ -55,7 +51,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [start, {group,stop}, crash, call, cast, cast_fast, info, abcast, + [start, crash, call, cast, cast_fast, info, abcast, multicall, multicall_down, call_remote1, call_remote2, call_remote3, call_remote_n1, call_remote_n2, call_remote_n3, spec_init, @@ -67,8 +63,7 @@ call_with_huge_message_queue]. groups() -> - [{stop, [], - [stop1, stop2, stop3, stop4, stop5, stop6, stop7, stop8, stop9, stop10]}]. + []. init_per_suite(Config) -> Config. @@ -242,105 +237,6 @@ process_flag(trap_exit, OldFl), ok. -%% Anonymous, reason 'normal' -stop1(_Config) -> - {ok, Pid} = gen_server:start(?MODULE, [], []), - ok = gen_server:stop(Pid), - false = erlang:is_process_alive(Pid), - {'EXIT',noproc} = (catch gen_server:stop(Pid)), - ok. - -%% Anonymous, other reason -stop2(_Config) -> - {ok,Pid} = gen_server:start(?MODULE, [], []), - ok = gen_server:stop(Pid, other_reason, infinity), - false = erlang:is_process_alive(Pid), - ok. - -%% Anonymous, invalid timeout -stop3(_Config) -> - {ok,Pid} = gen_server:start(?MODULE, [], []), - {'EXIT',_} = (catch gen_server:stop(Pid, other_reason, invalid_timeout)), - true = erlang:is_process_alive(Pid), - ok = gen_server:stop(Pid), - false = erlang:is_process_alive(Pid), - ok. - -%% Registered name -stop4(_Config) -> - {ok,Pid} = gen_server:start({local,to_stop},?MODULE, [], []), - ok = gen_server:stop(to_stop), - false = erlang:is_process_alive(Pid), - {'EXIT',noproc} = (catch gen_server:stop(to_stop)), - ok. - -%% Registered name and local node -stop5(_Config) -> - {ok,Pid} = gen_server:start({local,to_stop},?MODULE, [], []), - ok = gen_server:stop({to_stop,node()}), - false = erlang:is_process_alive(Pid), - {'EXIT',noproc} = (catch gen_server:stop({to_stop,node()})), - ok. - -%% Globally registered name -stop6(_Config) -> - {ok, Pid} = gen_server:start({global, to_stop}, ?MODULE, [], []), - ok = gen_server:stop({global,to_stop}), - false = erlang:is_process_alive(Pid), - {'EXIT',noproc} = (catch gen_server:stop({global,to_stop})), - ok. - -%% 'via' registered name -stop7(_Config) -> - dummy_via:reset(), - {ok, Pid} = gen_server:start({via, dummy_via, to_stop}, - ?MODULE, [], []), - ok = gen_server:stop({via, dummy_via, to_stop}), - false = erlang:is_process_alive(Pid), - {'EXIT',noproc} = (catch gen_server:stop({via, dummy_via, to_stop})), - ok. - -%% Anonymous on remote node -stop8(_Config) -> - {ok,Node} = test_server:start_node(gen_server_SUITE_stop8,slave,[]), - Dir = filename:dirname(code:which(?MODULE)), - rpc:call(Node,code,add_path,[Dir]), - {ok, Pid} = rpc:call(Node,gen_server,start,[?MODULE,[],[]]), - ok = gen_server:stop(Pid), - false = rpc:call(Node,erlang,is_process_alive,[Pid]), - {'EXIT',noproc} = (catch gen_server:stop(Pid)), - true = test_server:stop_node(Node), - {'EXIT',{{nodedown,Node},_}} = (catch gen_server:stop(Pid)), - ok. - -%% Registered name on remote node -stop9(_Config) -> - {ok,Node} = test_server:start_node(gen_server_SUITE_stop9,slave,[]), - Dir = filename:dirname(code:which(?MODULE)), - rpc:call(Node,code,add_path,[Dir]), - {ok, Pid} = rpc:call(Node,gen_server,start,[{local,to_stop},?MODULE,[],[]]), - ok = gen_server:stop({to_stop,Node}), - undefined = rpc:call(Node,erlang,whereis,[to_stop]), - false = rpc:call(Node,erlang,is_process_alive,[Pid]), - {'EXIT',noproc} = (catch gen_server:stop({to_stop,Node})), - true = test_server:stop_node(Node), - {'EXIT',{{nodedown,Node},_}} = (catch gen_server:stop({to_stop,Node})), - ok. - -%% Globally registered name on remote node -stop10(_Config) -> - {ok,Node} = test_server:start_node(gen_server_SUITE_stop10,slave,[]), - Dir = filename:dirname(code:which(?MODULE)), - rpc:call(Node,code,add_path,[Dir]), - {ok, Pid} = rpc:call(Node,gen_server,start,[{global,to_stop},?MODULE,[],[]]), - global:sync(), - ok = gen_server:stop({global,to_stop}), - false = rpc:call(Node,erlang,is_process_alive,[Pid]), - {'EXIT',noproc} = (catch gen_server:stop({global,to_stop})), - true = test_server:stop_node(Node), - {'EXIT',noproc} = (catch gen_server:stop({global,to_stop})), - ok. - crash(Config) when is_list(Config) -> ?line error_logger_forwarder:register(), @@ -379,9 +275,7 @@ receive {error,_GroupLeader4,{Pid4, "** Generic server"++_, - [Pid4,crash,{formatted, state4}, - {crashed,[{?MODULE,handle_call,3,_} - |_Stacktrace]}]}} -> + [Pid4,crash,{formatted, state4},crashed]}} -> ok; Other4a -> ?line io:format("Unexpected: ~p", [Other4a]), @@ -642,13 +536,15 @@ end, ok. +hibernate(suite) -> []; hibernate(Config) when is_list(Config) -> OldFl = process_flag(trap_exit, true), - {ok, Pid0} = + ?line {ok, Pid0} = gen_server:start_link({local, my_test_name_hibernate0}, - gen_server_SUITE, hibernate, []), - is_in_erlang_hibernate(Pid0), - ok = gen_server:call(my_test_name_hibernate0, stop), + gen_server_SUITE, hibernate, []), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid0,current_function), + ?line ok = gen_server:call(my_test_name_hibernate0, stop), receive {'EXIT', Pid0, stopped} -> ok @@ -656,66 +552,70 @@ test_server:fail(gen_server_did_not_die) end, - {ok, Pid} = + ?line {ok, Pid} = gen_server:start_link({local, my_test_name_hibernate}, - gen_server_SUITE, [], []), + gen_server_SUITE, [], []), - ok = gen_server:call(my_test_name_hibernate, started_p), - true = gen_server:call(my_test_name_hibernate, hibernate), - is_in_erlang_hibernate(Pid), - Parent = self(), + ?line ok = gen_server:call(my_test_name_hibernate, started_p), + ?line true = gen_server:call(my_test_name_hibernate, hibernate), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line Parent = self(), Fun = fun() -> - receive go -> ok end, - receive after 1000 -> ok end, - X = erlang:process_info(Pid, current_function), + receive + go -> + ok + end, + receive + after 1000 -> + ok + end, + X = erlang:process_info(Pid,current_function), Pid ! continue, Parent ! {result,X} end, - Pid2 = spawn_link(Fun), - true = gen_server:call(my_test_name_hibernate, {hibernate_noreply,Pid2}), + ?line Pid2 = spawn_link(Fun), + ?line true = gen_server:call(my_test_name_hibernate, {hibernate_noreply,Pid2}), - gen_server:cast(my_test_name_hibernate, hibernate_later), - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - is_in_erlang_hibernate(Pid), - ok = gen_server:call(my_test_name_hibernate, started_p), - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - - gen_server:cast(my_test_name_hibernate, hibernate_now), - is_in_erlang_hibernate(Pid), - ok = gen_server:call(my_test_name_hibernate, started_p), - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - - Pid ! hibernate_later, - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - is_in_erlang_hibernate(Pid), - ok = gen_server:call(my_test_name_hibernate, started_p), - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - - Pid ! hibernate_now, - is_in_erlang_hibernate(Pid), - ok = gen_server:call(my_test_name_hibernate, started_p), - true = ({current_function,{erlang,hibernate,3}} =/= - erlang:process_info(Pid, current_function)), - receive - {result,R} -> - {current_function,{erlang,hibernate,3}} = R - end, - - true = gen_server:call(my_test_name_hibernate, hibernate), - is_in_erlang_hibernate(Pid), - sys:suspend(my_test_name_hibernate), - is_in_erlang_hibernate(Pid), - sys:resume(my_test_name_hibernate), - is_in_erlang_hibernate(Pid), - ok = gen_server:call(my_test_name_hibernate, started_p), - true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), - - ok = gen_server:call(my_test_name_hibernate, stop), + ?line gen_server:cast(my_test_name_hibernate, hibernate_later), + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line receive after 2000 -> ok end, + ?line ({current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function)), + ?line ok = gen_server:call(my_test_name_hibernate, started_p), + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line gen_server:cast(my_test_name_hibernate, hibernate_now), + ?line receive after 1000 -> ok end, + ?line ({current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function)), + ?line ok = gen_server:call(my_test_name_hibernate, started_p), + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line Pid ! hibernate_later, + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line receive after 2000 -> ok end, + ?line ({current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function)), + ?line ok = gen_server:call(my_test_name_hibernate, started_p), + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line Pid ! hibernate_now, + ?line receive after 1000 -> ok end, + ?line ({current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function)), + ?line ok = gen_server:call(my_test_name_hibernate, started_p), + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + ?line receive + {result,R} -> + ?line {current_function,{erlang,hibernate,3}} = R + end, + ?line true = gen_server:call(my_test_name_hibernate, hibernate), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line sys:suspend(my_test_name_hibernate), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line sys:resume(my_test_name_hibernate), + ?line receive after 1000 -> ok end, + ?line {current_function,{erlang,hibernate,3}} = erlang:process_info(Pid,current_function), + ?line ok = gen_server:call(my_test_name_hibernate, started_p), + ?line true = ({current_function,{erlang,hibernate,3}} =/= erlang:process_info(Pid,current_function)), + + ?line ok = gen_server:call(my_test_name_hibernate, stop), receive {'EXIT', Pid, stopped} -> ok @@ -725,23 +625,6 @@ process_flag(trap_exit, OldFl), ok. -is_in_erlang_hibernate(Pid) -> - receive after 1 -> ok end, - is_in_erlang_hibernate_1(200, Pid). - -is_in_erlang_hibernate_1(0, Pid) -> - io:format("~p\n", [erlang:process_info(Pid, current_function)]), - ?t:fail(not_in_erlang_hibernate_3); -is_in_erlang_hibernate_1(N, Pid) -> - {current_function,MFA} = erlang:process_info(Pid, current_function), - case MFA of - {erlang,hibernate,3} -> - ok; - _ -> - receive after 10 -> ok end, - is_in_erlang_hibernate_1(N-1, Pid) - end. - %% -------------------------------------- %% Test gen_server:abcast and handle_cast. %% Test all different return values from @@ -1143,9 +1026,7 @@ receive {error,_GroupLeader,{Pid, "** Generic server"++_, - [Pid,crash,{formatted, State}, - {crashed,[{?MODULE,handle_call,3,_} - |_Stacktrace]}]}} -> + [Pid,crash,{formatted, State},crashed]}} -> ok; Other -> ?line io:format("Unexpected: ~p", [Other]), @@ -1167,9 +1048,7 @@ receive {error,_GroupLeader,{Pid, "** Generic server"++_, - [Pid,stop, {formatted, State}, - {{crash, terminate},[{?MODULE,terminate,2,_} - |_Stacktrace]}]}} -> + [Pid,stop, {formatted, State},{crash, terminate}]}} -> ok; Other -> io:format("Unexpected: ~p", [Other]), diff -Nru erlang-18.2-dfsg/lib/stdlib/test/id_transform_SUITE_data/External.hrl erlang-17.3-dfsg/lib/stdlib/test/id_transform_SUITE_data/External.hrl --- erlang-18.2-dfsg/lib/stdlib/test/id_transform_SUITE_data/External.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/id_transform_SUITE_data/External.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/id_transform_SUITE_data/m.hrl erlang-17.3-dfsg/lib/stdlib/test/id_transform_SUITE_data/m.hrl --- erlang-18.2-dfsg/lib/stdlib/test/id_transform_SUITE_data/m.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/id_transform_SUITE_data/m.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/id_transform_SUITE_data/m_i.hrl erlang-17.3-dfsg/lib/stdlib/test/id_transform_SUITE_data/m_i.hrl --- erlang-18.2-dfsg/lib/stdlib/test/id_transform_SUITE_data/m_i.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/id_transform_SUITE_data/m_i.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/id_transform_SUITE_data/oe_ex.hrl erlang-17.3-dfsg/lib/stdlib/test/id_transform_SUITE_data/oe_ex.hrl --- erlang-18.2-dfsg/lib/stdlib/test/id_transform_SUITE_data/oe_ex.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/id_transform_SUITE_data/oe_ex.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/id_transform_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/id_transform_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/id_transform_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/id_transform_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -56,26 +55,47 @@ id_transform(doc) -> "Test erl_id_trans."; id_transform(Config) when is_list(Config) -> - File = filename:join([code:lib_dir(stdlib),"examples", - "erl_id_trans.erl"]), - {ok,erl_id_trans,Bin} = compile:file(File,[binary]), - {module,erl_id_trans} = code:load_binary(erl_id_trans, File, Bin), - case test_server:purify_is_running() of - false -> - Dog = ct:timetrap(?t:hours(1)), - Res = run_in_test_suite(), - ?t:timetrap_cancel(Dog), - Res; - true -> - {skip,"Valgrind (too slow)"} - end. + ?line File=filename:join([code:lib_dir(stdlib),"examples", + "erl_id_trans.erl"]), + ?line {ok,erl_id_trans,Bin}=compile:file(File,[binary]), + ?line {module,erl_id_trans}=code:load_binary(erl_id_trans,File,Bin), + ?line case test_server:purify_is_running() of + false -> + Dog = ct:timetrap(?t:hours(1)), + ?line Res = run_in_test_suite(), + ?t:timetrap_cancel(Dog), + Res; + true -> + {skip,"Purify (too slow)"} + end. run_in_test_suite() -> + LibDir = code:lib_dir(), SuperDir = filename:dirname(filename:dirname(code:which(?MODULE))), TestDirs = filelib:wildcard(filename:join([SuperDir,"*_test"])), + {All,Res} = case LibDir of + "/clearcase/otp/erts/lib" -> + %% Only test_suites 'cause clearcase is too slow... + {false,run_list(TestDirs)}; + _ -> + {true,run_codepath_and(TestDirs)} + end, + Comment0 = case All of + true -> []; + false -> "Only testsuite directories traversed" + end, + case Res of + {error,Reason} when Comment0 =/= [] -> + {failed,Comment0++"; "++Reason}; + {error,Reason} -> + {failed,Reason}; + ok -> + {comment,Comment0} + end. + +run_codepath_and(DirList) -> AbsDirs = [filename:absname(X) || X <- code:get_path()], - Dirs = ordsets:from_list(AbsDirs ++ TestDirs), - run_list(Dirs). + run_list(ordsets:from_list([X || X <- AbsDirs] ++ DirList)). run_list(PathL) -> io:format("Where to search for beam files:\n~p\n", [PathL]), @@ -102,7 +122,7 @@ end, case length(SevereFailures) of 0 -> ok; - Len -> {failed,integer_to_list(Len)++" failures"} + Len -> {error,integer_to_list(Len)++" failures"} end. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/io_proto_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/io_proto_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/io_proto_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/io_proto_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -70,7 +69,12 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), - Term = os:getenv("TERM", "dumb"), + Term = case os:getenv("TERM") of + List when is_list(List) -> + List; + _ -> + "dumb" + end, os:putenv("TERM","vt100"), [{watchdog, Dog}, {term, Term} | Config]. end_per_testcase(_Case, Config) -> @@ -477,182 +481,149 @@ ok. -%% Tests various unicode options on random generated files. +unicode_options_gen(suite) -> + []; +unicode_options_gen(doc) -> + ["Tests various unicode options on random generated files"]; unicode_options_gen(Config) when is_list(Config) -> - random:seed(1240, 900586, 553728), - PrivDir = ?config(priv_dir, Config), - AllModes = [utf8,utf16,{utf16,big},{utf16,little}, - utf32,{utf32,big},{utf32,little}], - FSize = 9*1024, - NumItersRead = 2, - NumItersWrite = 2, - Dir = filename:join(PrivDir, "GENDATA1"), - file:make_dir(Dir), - - DoOneFile1 = - fun(Encoding, N, M) -> - ?dbg({Encoding,M,N}), - io:format("Read test: Encoding ~p, Chunk size ~p, Iteration ~p~n",[Encoding,M,N]), - io:format(standard_error, - "Read test: Encoding ~p, Chunk size ~p, Iteration ~p\r\n",[Encoding,M,N]), - Fname = filename:join(Dir, - "genfile_"++enc2str(Encoding)++ - "_"++integer_to_list(N)), - Ulist = random_unicode(FSize), - Bin = unicode:characters_to_binary(Ulist, utf8, Encoding), - ok = file:write_file(Fname, Bin), - - Read1 = fun(FD) -> io:get_line(FD, '') end, - Res1 = read_whole_file(Fname, - [read,read_ahead,{encoding,Encoding}], - Read1), - - Read2 = fun(FD) -> io:get_chars(FD, '', M) end, - Res2 = read_whole_file(Fname, - [read,binary, - read_ahead,{encoding,Encoding}], - Read2), - - Read3 = fun(FD) -> - case io:fread(FD, '', "~ts") of - {ok,D} -> D; - Other -> Other end - end, - Res3 = read_whole_file(Fname, - [read,binary, - read_ahead,{encoding,Encoding}], - Read3), - - Read4 = fun(FD) -> - case io:fread(FD, '', "~ts") of - {ok,D} -> D; - Other -> Other end - end, - Res4 = read_whole_file(Fname, - [read,read_ahead,{encoding,Encoding}], - Read4), - - Ulist2 = [X || X <- Ulist, X =/= $\n, X =/= $\s], - Ulist3 = [X || X <- Ulist, X =/= $\n], - Ulist = done(Res1), - Ulist = done(Res2), - Ulist2 = done(Res3), - Ulist3 = done(Res4), - - file:delete(Fname) - end, - [ [ [ DoOneFile1(E, N, M) || E <- AllModes ] || - M <- [10,1000,128,1024,8192,8193] ] || - N <- lists:seq(1, NumItersRead) ], - - DoOneFile2 = - fun(Encoding,N,M) -> - ?dbg({Encoding,M,N}), - io:format("Write test: Encoding ~p, Chunk size ~p, Iteration ~p~n",[Encoding,M,N]), - io:format(standard_error, - "Write test: Encoding ~p, Chunk size ~p, Iteration ~p\r\n",[Encoding,M,N]), - Fname = filename:join(Dir, - "genfile_"++enc2str(Encoding)++ - "_"++integer_to_list(N)), - Ulist = random_unicode(FSize), - - Res1 = write_read_file(Fname, 1, - [write], - Encoding, - fun(FD) -> io:put_chars(FD, Ulist) end), - - Res2 = write_read_file(Fname, 2, - [write,binary], - Encoding, - fun(FD) -> io:put_chars(FD, Ulist) end), - - Fun3 = fun(FD) -> - _ = [io:format(FD, "~tc", [C]) || C <- Ulist], - ok - end, - Res3 = write_read_file(Fname, 3, - [write], - Encoding, - Fun3), - - Fun4 = fun(FD) -> - io:put_chars(FD, - unicode:characters_to_binary(Ulist)) - end, - Res4 = write_read_file(Fname, 4, - [write], - Encoding, - Fun4), - - LL = string:tokens(Ulist, "\n"), - Fun5 = fun(FD) -> - _ = [io:format(FD, "~ts", [L]) || L <- LL], - ok - end, - Res5 = write_read_file(Fname, 5, - [write], - Encoding, - Fun5), - - Ulist2 = lists:flatten(LL), - ResBin = done(Res1), - ResBin = done(Res2), - ResBin = done(Res3), - ResBin = done(Res4), - Ulist = unicode:characters_to_list(ResBin, Encoding), - - ResBin2 = done(Res5), - Ulist2 = unicode:characters_to_list(ResBin2, Encoding), - - ok - end, - [ [ [ DoOneFile2(E, N, M) || E <- AllModes ] || - M <- [10,1000,128,1024,8192,8193] ] || - N <- lists:seq(1, NumItersWrite) ], + ?line random:seed(1240,900586,553728), + ?line PrivDir = ?config(priv_dir,Config), + ?line AllModes = [utf8,utf16,{utf16,big},{utf16,little},utf32,{utf32,big},{utf32,little}], + ?line FSize = 17*1024, + ?line NumItersRead = 2, + ?line NumItersWrite = 2, + ?line Dir = filename:join([PrivDir,"GENDATA1"]), + ?line file:make_dir(Dir), + + %dbg:tracer(process,{fun(A,_) -> erlang:display(A) end,true}), + %dbg:tpl(file_io_server,x), + %dbg:ctpl(file_io_server,cafu), + %dbg:tp(unicode,x), + + DoOneFile1 = fun(Encoding,N,M) -> + ?dbg({Encoding,M,N}), + io:format("Read test: Encoding ~p, Chunk size ~p, Iteration ~p~n",[Encoding,M,N]), + io:format(standard_error,"Read test: Encoding ~p, Chunk size ~p, Iteration ~p\r\n",[Encoding,M,N]), + ?line Fname = filename:join([Dir,"genfile_"++enc2str(Encoding)++"_"++integer_to_list(N)]), + ?dbg(?LINE), + ?line Ulist = random_unicode(FSize), + ?dbg(?LINE), + ?line my_write_file(Fname,Ulist,Encoding), + ?dbg(?LINE), + ?line {ok,F1} = file:open(Fname,[read,{encoding,Encoding}]), + + ?dbg(?LINE), + ?line Res1 = read_whole_file(fun(FD) -> io:get_line(FD,'') end,F1), + ?dbg(?LINE), + ?line Ulist = unicode:characters_to_list(Res1,unicode), + ?dbg(?LINE), + ?line file:close(F1), + ?line {ok,F2} = file:open(Fname, [read,binary,{encoding,Encoding}]), + ?line Res2 = read_whole_file(fun(FD) -> io:get_chars(FD,'',M) end,F2), + ?line Ulist = unicode:characters_to_list(Res2,unicode), + ?dbg(?LINE), + ?line file:close(F2), + ?line {ok,F3} = file:open(Fname, [read,binary,{encoding,Encoding}]), + ?dbg(?LINE), +%% case {Encoding,M,N} of +%% {{utf16,little},10,2} -> +%% dbg:p(F3,call); +%% _ -> +%% ok +%% end, + + ?line Res3 = read_whole_file(fun(FD) -> case io:fread(FD,'',"~ts") of {ok,D} -> D; O -> O end end, F3), + ?dbg(?LINE), + ?line Ulist2 = [ X || X <- Ulist, + X =/= $\n, X =/= $ ], + ?dbg(?LINE), + ?line Ulist2 = unicode:characters_to_list(Res3,unicode), + ?dbg(?LINE), + ?line file:close(F3), + ?line {ok,F4} = file:open(Fname, [read,{encoding,Encoding}]), + ?line Res4 = read_whole_file(fun(FD) -> case io:fread(FD,'',"~tc") of {ok,D} -> D; O -> O end end,F4), + ?line Ulist3 = [ X || X <- Ulist, + X =/= $\n ], + ?line Ulist3 = unicode:characters_to_list(Res4,unicode), + ?dbg(?LINE), + ?line file:close(F4), + ?line file:delete(Fname) + end, + + [ [ [ DoOneFile1(E,N,M) || E <- AllModes ] || M <- [10,1000,128,1024,8192,8193] ] || N <- lists:seq(1,NumItersRead)], + DoOneFile2 = fun(Encoding,N,M) -> + ?dbg({Encoding,M,N}), + io:format("Write test: Encoding ~p, Chunk size ~p, Iteration ~p~n",[Encoding,M,N]), + io:format(standard_error,"Write test: Encoding ~p, Chunk size ~p, Iteration ~p\r\n",[Encoding,M,N]), + ?line Fname = filename:join([Dir,"genfile_"++enc2str(Encoding)++"_"++integer_to_list(N)]), + ?dbg(?LINE), + ?line Ulist = random_unicode(FSize), + ?dbg(?LINE), + ?line {ok,F1} = file:open(Fname,[write,{encoding,Encoding}]), + ?line io:put_chars(F1,Ulist), + ?line file:close(F1), + ?line Ulist = my_read_file(Fname,Encoding), + ?line file:delete(Fname), + ?line {ok,F2} = file:open(Fname,[write,binary,{encoding,Encoding}]), + ?line io:put_chars(F2,Ulist), + ?line file:close(F2), + ?line Ulist = my_read_file(Fname,Encoding), + ?line file:delete(Fname), + ?line {ok,F3} = file:open(Fname,[write,{encoding,Encoding}]), + ?line LL = string:tokens(Ulist,"\n"), + ?line Ulist2 = lists:flatten(LL), + ?line [ io:format(F3,"~ts",[L]) || L <- LL ], + ?line file:close(F3), + ?line Ulist2 = my_read_file(Fname,Encoding), + ?line file:delete(Fname), + ?line {ok,F4} = file:open(Fname,[write,{encoding,Encoding}]), + ?line [ io:format(F4,"~tc",[C]) || C <- Ulist ], + ?line file:close(F4), + ?line Ulist = my_read_file(Fname,Encoding), + ?line file:delete(Fname), + ?line {ok,F5} = file:open(Fname,[write,{encoding,Encoding}]), + ?line io:put_chars(F5,unicode:characters_to_binary(Ulist)), + ?line file:close(F5), + ?line Ulist = my_read_file(Fname,Encoding), + ?line file:delete(Fname), + ok + end, + [ [ [ DoOneFile2(E,N,M) || E <- AllModes ] || M <- [10,1000,128,1024,8192,8193] ] || N <- lists:seq(1,NumItersWrite)], ok. -read_whole_file(Fname, Options, Fun) -> - do(fun() -> - do_read_whole_file(Fname, Options, Fun) - end). - -do_read_whole_file(Fname, Options, Fun) -> - {ok,F} = file:open(Fname, Options), - Res = do_read_whole_file_1(Fun, F), - ok = file:close(F), - unicode:characters_to_list(Res, unicode). + -do_read_whole_file_1(Fun, F) -> + +read_whole_file(Fun,F) -> case Fun(F) of eof -> []; {error,Error} -> + ?dbg(Error), receive after 10000 -> ok end, exit(Error); Other -> - [Other|do_read_whole_file_1(Fun, F)] + %?dbg(Other), + [Other | read_whole_file(Fun,F)] end. - -write_read_file(Fname0, N, Options, Enc, Writer) -> - Fname = Fname0 ++ "_" ++ integer_to_list(N), - do(fun() -> - do_write_read_file(Fname, Options, Enc, Writer) - end). - -do_write_read_file(Fname, Options, Encoding, Writer) -> - {ok,F} = file:open(Fname, [{encoding,Encoding}|Options]), - Writer(F), - ok = file:close(F), - {ok,Bin} = file:read_file(Fname), - ok = file:delete(Fname), - Bin. + enc2str(Atom) when is_atom(Atom) -> atom_to_list(Atom); enc2str({A1,A2}) when is_atom(A1), is_atom(A2) -> atom_to_list(A1)++"_"++atom_to_list(A2). + + +my_write_file(Filename,UniList,Encoding) -> + Bin = unicode:characters_to_binary(UniList,utf8,Encoding), + file:write_file(Filename,Bin). + +my_read_file(Filename,Encoding) -> + {ok,Bin} = file:read_file(Filename), + unicode:characters_to_list(Bin,Encoding). + random_unicode(0) -> []; random_unicode(N) -> @@ -1378,43 +1349,47 @@ rtnode(Commands,Nodename,ErlPrefix) -> rtnode(Commands,Nodename,ErlPrefix,[]). rtnode(Commands,Nodename,ErlPrefix,Extra) -> - case get_progs() of - {error,_Reason} -> - {skip,"No runerl present"}; - {RunErl,ToErl,Erl} -> - case create_tempdir() of - {error, Reason2} -> - {skip, Reason2}; - Tempdir -> - SPid = start_runerl_node(RunErl, ErlPrefix++ - "\\\""++Erl++"\\\"", - Tempdir, Nodename, Extra), - CPid = start_toerl_server(ToErl, Tempdir), - put(getline_skipped, []), - Res = (catch get_and_put(CPid, Commands, 1)), - case stop_runerl_node(CPid) of - {error,_} -> - CPid2 = start_toerl_server(ToErl, Tempdir), - put(getline_skipped, []), - ok = get_and_put - (CPid2, - [{putline,[7]}, - {sleep, - timeout(short)}, - {putline,""}, - {getline," -->"}, - {putline,"s"}, - {putline,"c"}, - {putline,""}], 1), - stop_runerl_node(CPid2); - _ -> - ok - end, - wait_for_runerl_server(SPid), - ok = ?RM_RF(Tempdir), - ok = Res - end - end. + ?line case get_progs() of + {error,_Reason} -> + ?line {skip,"No runerl present"}; + {RunErl,ToErl,Erl} -> + ?line case create_tempdir() of + {error, Reason2} -> + ?line {skip, Reason2}; + Tempdir -> + ?line SPid = + start_runerl_node(RunErl,ErlPrefix++ + "\\\""++Erl++"\\\"", + Tempdir,Nodename, Extra), + ?line CPid = start_toerl_server(ToErl,Tempdir), + ?line erase(getline_skipped), + ?line Res = + (catch get_and_put(CPid, Commands,1)), + ?line case stop_runerl_node(CPid) of + {error,_} -> + ?line CPid2 = + start_toerl_server + (ToErl,Tempdir), + ?line erase(getline_skipped), + ?line ok = get_and_put + (CPid2, + [{putline,[7]}, + {sleep, + timeout(short)}, + {putline,""}, + {getline," -->"}, + {putline,"s"}, + {putline,"c"}, + {putline,""}],1), + ?line stop_runerl_node(CPid2); + _ -> + ?line ok + end, + ?line wait_for_runerl_server(SPid), + ?line ok = ?RM_RF(Tempdir), + ?line ok = Res + end + end. timeout(long) -> 2 * timeout(normal); @@ -1458,51 +1433,57 @@ after X -> get_and_put(CPid,T,N+1) end; -get_and_put(CPid, [{getline_pred,Pred,Msg}|T]=T0, N) - when is_function(Pred) -> +get_and_put(CPid, [{getline, Match}|T],N) -> ?dbg({getline, Match}), CPid ! {self(), {get_line, timeout(normal)}}, receive {get_line, timeout} -> error_logger:error_msg("~p: getline timeout waiting for \"~s\" " "(command number ~p, skipped: ~p)~n", - [?MODULE,Msg,N,get(getline_skipped)]), + [?MODULE, Match,N,get(getline_skipped)]), {error, timeout}; {get_line, Data} -> ?dbg({data,Data}), - case Pred(Data) of - yes -> - put(getline_skipped, []), + case lists:prefix(Match, Data) of + true -> + erase(getline_skipped), get_and_put(CPid, T,N+1); - no -> - error_logger:error_msg("~p: getline match failure " - "\"~s\" " - "(command number ~p)\n", - [?MODULE,Msg,N]), - {error, no_match}; - maybe -> - List = get(getline_skipped), - put(getline_skipped, List ++ [Data]), - get_and_put(CPid, T0, N) + false -> + case get(getline_skipped) of + undefined -> + put(getline_skipped,[Data]); + List -> + put(getline_skipped,List ++ [Data]) + end, + get_and_put(CPid, [{getline, Match}|T],N) end end; -get_and_put(CPid, [{getline, Match}|T],N) -> - ?dbg({getline, Match}), - F = fun(Data) -> - case lists:prefix(Match, Data) of - true -> yes; - false -> maybe - end - end, - get_and_put(CPid, [{getline_pred,F,Match}|T], N); get_and_put(CPid, [{getline_re, Match}|T],N) -> - F = fun(Data) -> - case re:run(Data, Match, [{capture,none}]) of - match -> yes; - _ -> maybe - end - end, - get_and_put(CPid, [{getline_pred,F,Match}|T], N); + ?dbg({getline_re, Match}), + CPid ! {self(), {get_line, timeout(normal)}}, + receive + {get_line, timeout} -> + error_logger:error_msg("~p: getline_re timeout waiting for \"~s\" " + "(command number ~p, skipped: ~p)~n", + [?MODULE, Match,N,get(getline_skipped)]), + {error, timeout}; + {get_line, Data} -> + ?dbg({data,Data}), + case re:run(Data, Match,[{capture,none}]) of + match -> + erase(getline_skipped), + get_and_put(CPid, T,N+1); + _ -> + case get(getline_skipped) of + undefined -> + put(getline_skipped,[Data]); + List -> + put(getline_skipped,List ++ [Data]) + end, + get_and_put(CPid, [{getline_re, Match}|T],N) + end + end; + get_and_put(CPid, [{putline_raw, Line}|T],N) -> ?dbg({putline_raw, Line}), CPid ! {self(), {send_line, Line}}, @@ -1757,7 +1738,8 @@ end. millistamp() -> - erlang:monotonic_time(milli_seconds). + {Mega, Secs, Micros} = erlang:now(), + (Micros div 1000) + Secs * 1000 + Mega * 1000000000. get_data_within(Port, X, Acc) when X =< 0 -> ?dbg({get_data_within, X, Acc, ?LINE}), @@ -1791,22 +1773,10 @@ end. get_default_shell() -> - Match = fun(Data) -> - case lists:prefix("undefined", Data) of - true -> - yes; - false -> - case re:run(Data, "<\\d+[.]\\d+[.]\\d+>", - [{capture,none}]) of - match -> no; - _ -> maybe - end - end - end, try rtnode([{putline,""}, {putline, "whereis(user_drv)."}, - {getline_pred, Match, "matching of user_drv pid"}], []), + {getline, "undefined"}],[]), old catch _E:_R -> ?dbg({_E,_R}), @@ -1967,15 +1937,3 @@ <>; chomp(Atom) -> Atom. - -do(Fun) -> - {_,Ref} = spawn_monitor(fun() -> - exit(Fun()) - end), - Ref. - -done(Ref) -> - receive - {'DOWN',Ref,process,_,Result} -> - Result - end. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/io_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/io_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/io_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/io_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2014. All Rights Reserved. +%% Copyright Ericsson AB 1999-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,11 +28,9 @@ manpage/1, otp_6708/1, otp_7084/1, otp_7421/1, io_lib_collect_line_3_wb/1, cr_whitespace_in_string/1, io_fread_newlines/1, otp_8989/1, io_lib_fread_literal/1, - printable_range/1, bad_printable_range/1, + printable_range/1, io_lib_print_binary_depth_one/1, otp_10302/1, otp_10755/1, - otp_10836/1, io_lib_width_too_small/1, - io_with_huge_message_queue/1, format_string/1, - maps/1, coverage/1]). + otp_10836/1, io_lib_width_too_small/1]). -export([pretty/2]). @@ -71,10 +68,9 @@ manpage, otp_6708, otp_7084, otp_7421, io_lib_collect_line_3_wb, cr_whitespace_in_string, io_fread_newlines, otp_8989, io_lib_fread_literal, - printable_range, bad_printable_range, + printable_range, io_lib_print_binary_depth_one, otp_10302, otp_10755, otp_10836, - io_lib_width_too_small, io_with_huge_message_queue, - format_string, maps, coverage]. + io_lib_width_too_small]. groups() -> []. @@ -1038,14 +1034,7 @@ lists:flatten(io_lib:format("~s", [R])). fmt(Fmt, Args) -> - FormatList = io_lib:scan_format(Fmt, Args), - {Fmt2, Args2} = io_lib:unscan_format(FormatList), - Chars1 = lists:flatten(io_lib:build_text(FormatList)), - Chars2 = lists:flatten(io_lib:format(Fmt2, Args2)), - Chars3 = lists:flatten(io_lib:format(Fmt, Args)), - Chars1 = Chars2, - Chars2 = Chars3, - Chars3. + lists:flatten(io_lib:format(Fmt, Args)). rfd(a, 0) -> []; @@ -2063,6 +2052,8 @@ [{args, " +pclatin1 -pa " ++ Pa}]), unicode = rpc:call(UNode,io,printable_range,[]), latin1 = rpc:call(LNode,io,printable_range,[]), + {error, _} = test_server:start_node(printable_range_unnicode, slave, + [{args, " +pcunnicode -pa " ++ Pa}]), PrettyOptions = [{column,1}, {line_length,109}, {depth,30}, @@ -2070,69 +2061,48 @@ {record_print_fun, fun(_,_) -> no end}, {encoding,unicode}], - PrintableControls = "\t\v\b\f\e\r\n", - - 1025 = print_max(UNode, [{hello, [1024,1025]}, - PrettyOptions]), - 125 = print_max(LNode, [{hello, [1024,1025]}, - PrettyOptions]), - 125 = print_max(DNode, [{hello, [1024,1025]}, - PrettyOptions]), - 1025 = print_max(UNode, [{hello, <<1024/utf8,1025/utf8>>}, - PrettyOptions]), - 125 = print_max(LNode, [{hello, <<1024/utf8,1025/utf8>>}, - PrettyOptions]), - 125 = print_max(DNode, [{hello, <<1024/utf8,1025/utf8>>}, - PrettyOptions]), - $v = print_max(UNode, [PrintableControls,PrettyOptions]), - $v = print_max(LNode, [PrintableControls,PrettyOptions]), - $v = print_max(DNode, [PrintableControls,PrettyOptions]), - 16#10FFFF = print_max(UNode, - [<<16#10FFFF/utf8,"\t\v\b\f\e\r\n">>, - PrettyOptions]), - $> = print_max(LNode, - [<<16#10FFFF/utf8,"\t\v\b\f\e\r\n">>, - PrettyOptions]), - $> = print_max(DNode, - [<<16#10FFFF/utf8,"\t\v\b\f\e\r\n">>, - PrettyOptions]), + 1025 = lists:max(lists:flatten(rpc:call(UNode,io_lib_pretty,print, + [{hello, [1024,1025]}, + PrettyOptions]))), + 125 = lists:max(lists:flatten(rpc:call(LNode,io_lib_pretty,print, + [{hello, [1024,1025]}, + PrettyOptions]))), + 125 = lists:max(lists:flatten(rpc:call(DNode,io_lib_pretty,print, + [{hello, [1024,1025]}, + PrettyOptions]))), + 1025 = lists:max(lists:flatten(rpc:call(UNode,io_lib_pretty,print, + [{hello, <<1024/utf8,1025/utf8>>}, + PrettyOptions]))), + 125 = lists:max(lists:flatten(rpc:call(LNode,io_lib_pretty,print, + [{hello, <<1024/utf8,1025/utf8>>}, + PrettyOptions]))), + 125 = lists:max(lists:flatten(rpc:call(DNode,io_lib_pretty,print, + [{hello, <<1024/utf8,1025/utf8>>}, + PrettyOptions]))), - 1025 = format_max(UNode, ["~tp", [{hello, [1024,1025]}]]), - 125 = format_max(LNode, ["~tp", [{hello, [1024,1025]}]]), - 125 = format_max(DNode, ["~tp", [{hello, [1024,1025]}]]), - 1025 = format_max(UNode, ["~tp", [{hello, <<1024/utf8,1025/utf8>>}]]), - 125 = format_max(LNode, ["~tp", [{hello, <<1024/utf8,1025/utf8>>}]]), - 125 = format_max(DNode, ["~tp", [{hello, <<1024/utf8,1025/utf8>>}]]), - - $\e = format_max(UNode, ["~ts", [PrintableControls]]), - $\e = format_max(LNode, ["~ts", [PrintableControls]]), - $\e = format_max(DNode, ["~ts", [PrintableControls]]), - + 1025 = lists:max(lists:flatten(rpc:call(UNode,io_lib,format, + ["~tp",[{hello, [1024,1025]}]]))), + 125 = lists:max(lists:flatten(rpc:call(LNode,io_lib,format, + ["~tp",[{hello, [1024,1025]}]]))), + 125 = lists:max(lists:flatten(rpc:call(DNode,io_lib,format, + ["~tp",[{hello, [1024,1025]}]]))), + 1025 = lists:max(lists:flatten(rpc:call(UNode,io_lib,format, + ["~tp", + [{hello, + <<1024/utf8,1025/utf8>>}]]))), + 125 = lists:max(lists:flatten(rpc:call(LNode,io_lib,format, + ["~tp", + [{hello, + <<1024/utf8,1025/utf8>>}]]))), + 125 = lists:max(lists:flatten(rpc:call(DNode,io_lib,format, + ["~tp", + [{hello, + <<1024/utf8,1025/utf8>>}]]))), test_server:stop_node(UNode), test_server:stop_node(LNode), test_server:stop_node(DNode), ok. -print_max(Node, Args) -> - rpc_call_max(Node, io_lib_pretty, print, Args). - -format_max(Node, Args) -> - rpc_call_max(Node, io_lib, format, Args). - -rpc_call_max(Node, M, F, Args) -> - lists:max(lists:flatten(rpc:call(Node, M, F, Args))). - -%% Make sure that a bad specification for a printable range is rejected. -bad_printable_range(Config) when is_list(Config) -> - Cmd = lists:concat([lib:progname()," +pcunnnnnicode -run erlang halt"]), - case os:cmd(Cmd) of - "bad range of printable characters" ++ _ -> - ok; - String -> - io:format("~s\n", [String]), - ?t:fail() - end. - io_lib_print_binary_depth_one(doc) -> "Test binaries printed with a depth of one behave correctly"; io_lib_print_binary_depth_one(Suite) when is_list(Suite) -> @@ -2245,159 +2215,7 @@ after ok %file:delete(Fname) end. -io_lib_width_too_small(_Config) -> +io_lib_width_too_small(Config) -> "**" = lists:flatten(io_lib:format("~2.3w", [3.14])), "**" = lists:flatten(io_lib:format("~2.5w", [3.14])), ok. - -%% Test that the time for a huge message queue is not -%% significantly slower than with an empty message queue. -io_with_huge_message_queue(Config) when is_list(Config) -> - case test_server:is_native(gen) of - true -> - {skip, - "gen is native - huge message queue optimization " - "is not implemented"}; - false -> - do_io_with_huge_message_queue(Config) - end. - -do_io_with_huge_message_queue(Config) -> - PrivDir = ?privdir(Config), - File = filename:join(PrivDir, "slask"), - {ok, F1} = file:open(File, [write]), - - {Time,ok} = timer:tc(fun() -> writes(1000, F1) end), - - [self() ! {msg,N} || N <- lists:seq(1, 500000)], - erlang:garbage_collect(), - {NewTime,ok} = timer:tc(fun() -> writes(1000, F1) end), - file:close(F1), - io:format("Time for empty message queue: ~p", [Time]), - io:format("Time for huge message queue: ~p", [NewTime]), - - IsCover = test_server:is_cover(), - case (NewTime+1) / (Time+1) of - Q when Q < 10; IsCover -> - ok; - Q -> - io:format("Q = ~p", [Q]), - ?t:fail() - end, - ok. - -writes(0, _) -> ok; -writes(N, F1) -> - file:write(F1, "hello\n"), - writes(N - 1, F1). - -format_string(_Config) -> - %% All but padding is tested by fmt/2. - "xxxxxxsssx" = fmt("~10.4.xs", ["sss"]), - "xxxxxxsssx" = fmt("~10.4.*s", [$x, "sss"]), - ok. - -maps(_Config) -> - %% Note that order in which a map is printed is arbitrary. In - %% practice, small maps (non-HAMT) are printed in key order, but - %% the breakpoint for creating big maps (HAMT) is lower in the - %% debug-compiled run-time system than in the optimized run-time - %% system. - %% - %% Therefore, play it completely safe by not assuming any order - %% in a map with more than one element. - - "#{}" = fmt("~w", [#{}]), - "#{a=>b}" = fmt("~w", [#{a=>b}]), - re_fmt(<<"#\\{(a=>b|c=>d),[.][.][.]=>[.][.][.]\\}">>, - "~W", [#{a=>b,c=>d},2]), - re_fmt(<<"#\\{(a=>b|c=>d|e=>f),[.][.][.]=>[.][.][.],[.][.][.]\\}">>, - "~W", [#{a=>b,c=>d,e=>f},2]), - - "#{}" = fmt("~p", [#{}]), - "#{a => b}" = fmt("~p", [#{a=>b}]), - "#{...}" = fmt("~P", [#{a=>b},1]), - re_fmt(<<"#\\{(a => b|c => d),[.][.][.]\\}">>, - "~P", [#{a=>b,c=>d},2]), - re_fmt(<<"#\\{(a => b|c => d|e => f),[.][.][.]\\}">>, - "~P", [#{a=>b,c=>d,e=>f},2]), - - List = [{I,I*I} || I <- lists:seq(1, 20)], - Map = maps:from_list(List), - - "#{...}" = fmt("~P", [Map,1]), - - %% Print a map and parse it back to a map. - S = fmt("~p\n", [Map]), - io:format("~p\n", [S]), - Map = parse_map(S), - - %% Smoke test of a map as key. - MapAsKey = #{Map => "value"}, - io:format("~s\n", [fmt("~p", [MapAsKey])]), - ok. - -re_fmt(Pattern, Format, Args) -> - S = list_to_binary(fmt(Format, Args)), - case re:run(S, Pattern, [{capture,none}]) of - nomatch -> - io:format("Pattern: ~s", [Pattern]), - io:format("Result: ~s", [S]), - ?t:fail(); - match -> - ok - end. - -%% Parse a map consisting of integer keys and values. -parse_map(S0) -> - S1 = parse_expect(S0, "#{"), - {M,S2} = parse_map_1(S1), - S = parse_expect(S2, "}"), - S = "", - M. - -parse_map_1(S0) -> - {Key,S1} = parse_number(S0), - S2 = parse_expect(S1, "=>"), - {Val,S3} = parse_number(S2), - case S3 of - ","++S4 -> - S5 = parse_skip_ws(S4), - {Map,S} = parse_map_1(S5), - {Map#{Key=>Val},S}; - S -> - {#{Key=>Val},S} - end. - -parse_number(S) -> - parse_number(S, none). - -parse_number([C|S], Acc0) when $0 =< C, C =< $9 -> - Acc = case Acc0 of - none -> 0; - _ when is_integer(Acc0) -> Acc0 - end, - parse_number(S, Acc*10+C-$0); -parse_number(S, Acc) -> - {Acc,parse_skip_ws(S)}. - -parse_expect([H|T1], [H|T2]) -> - parse_expect(T1, T2); -parse_expect(S, []) -> - parse_skip_ws(S). - -parse_skip_ws([C|S]) when C =< $\s -> - parse_skip_ws(S); -parse_skip_ws(S) -> - S. - -%% Cover the last uncovered lines for completeness. -coverage(_Config) -> - S1 = io_lib_pretty:print({a,term}, fun(_, _) -> no end), - io:format("~s\n", [S1]), - - %% The tuple of arity three will be ignored. - S2 = io_lib_pretty:print(lists:seq(1, 100), [{depth,1,1}]), - io:format("~s\n", [S2]), - - ok. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/lists_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/lists_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/lists_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/lists_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -38,13 +37,13 @@ % Test cases must be exported. -export([member/1, reverse/1, keymember/1, keysearch_keyfind/1, - keystore/1, keytake/1, keyreplace/1, + keystore/1, keytake/1, append_1/1, append_2/1, seq_loop/1, seq_2/1, seq_3/1, seq_2_e/1, seq_3_e/1, sublist_2/1, sublist_3/1, sublist_2_e/1, sublist_3_e/1, flatten_1/1, flatten_2/1, flatten_1_e/1, flatten_2_e/1, - dropwhile/1, takewhile/1, + dropwhile/1, sort_1/1, sort_stable/1, merge/1, rmerge/1, sort_rand/1, usort_1/1, usort_stable/1, umerge/1, rumerge/1,usort_rand/1, keymerge/1, rkeymerge/1, @@ -62,7 +61,7 @@ zip_unzip/1, zip_unzip3/1, zipwith/1, zipwith3/1, filter_partition/1, otp_5939/1, otp_6023/1, otp_6606/1, otp_7230/1, - suffix/1, subtract/1, droplast/1, hof/1]). + suffix/1, subtract/1, droplast/1]). %% Sort randomized lists until stopped. %% @@ -81,51 +80,37 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [{group, append}, - {group, key}, - {group,sort}, - {group, usort}, - {group, keysort}, - {group, ukeysort}, - {group, funsort}, - {group, ufunsort}, - {group, sublist}, - {group, flatten}, - {group, seq}, - {group, tickets}, - {group, zip}, - {group, misc}]. + [{group, append}, reverse, member, keymember, + keysearch_keyfind, keystore, keytake, dropwhile, {group,sort}, + {group, usort}, {group, keysort}, {group, ukeysort}, + {group, funsort}, {group, ufunsort}, {group, sublist}, + {group, flatten}, {group, seq}, zip_unzip, zip_unzip3, + zipwith, zipwith3, filter_partition, {group, tickets}, + suffix, subtract]. groups() -> - [{append, [parallel], [append_1, append_2]}, - {usort, [parallel], + [{append, [], [append_1, append_2]}, + {usort, [], [umerge, rumerge, usort_1, usort_rand, usort_stable]}, - {keysort, [parallel], + {keysort, [], [keymerge, rkeymerge, keysort_1, keysort_rand, keysort_i, keysort_stable, keysort_error]}, - {key, [parallel], [keymember, keysearch_keyfind, keystore, - keytake, keyreplace]}, - {sort,[parallel],[merge, rmerge, sort_1, sort_rand]}, - {ukeysort, [parallel], + {sort,[],[merge, rmerge, sort_1, sort_rand]}, + {ukeysort, [], [ukeymerge, rukeymerge, ukeysort_1, ukeysort_rand, ukeysort_i, ukeysort_stable, ukeysort_error]}, - {funsort, [parallel], + {funsort, [], [funmerge, rfunmerge, funsort_1, funsort_stable, funsort_error, funsort_rand]}, - {ufunsort, [parallel], + {ufunsort, [], [ufunmerge, rufunmerge, ufunsort_1, ufunsort_stable, ufunsort_error, ufunsort_rand]}, - {seq, [parallel], [seq_loop, seq_2, seq_3, seq_2_e, seq_3_e]}, - {sublist, [parallel], + {seq, [], [seq_loop, seq_2, seq_3, seq_2_e, seq_3_e]}, + {sublist, [], [sublist_2, sublist_3, sublist_2_e, sublist_3_e]}, - {flatten, [parallel], + {flatten, [], [flatten_1, flatten_2, flatten_1_e, flatten_2_e]}, - {tickets, [parallel], [otp_5939, otp_6023, otp_6606, otp_7230]}, - {zip, [parallel], [zip_unzip, zip_unzip3, zipwith, zipwith3]}, - {misc, [parallel], [reverse, member, dropwhile, takewhile, - filter_partition, suffix, subtract, - hof]} - ]. + {tickets, [], [otp_5939, otp_6023, otp_6606, otp_7230]}]. init_per_suite(Config) -> Config. @@ -359,33 +344,6 @@ ok. -takewhile(Config) when is_list(Config) -> - F = fun(C) -> C =/= $@ end, - - [] = lists:takewhile(F, []), - [a] = lists:takewhile(F, [a]), - [a,b] = lists:takewhile(F, [a,b]), - [a,b,c] = lists:takewhile(F, [a,b,c]), - - [] = lists:takewhile(F, [$@]), - [] = lists:takewhile(F, [$@,$@]), - [a] = lists:takewhile(F, [a,$@]), - - [$k] = lists:takewhile(F, [$k,$@]), - [$k,$l] = lists:takewhile(F, [$k,$l,$@,$@]), - [a] = lists:takewhile(F, [a,$@,$@,$@]), - - [] = lists:takewhile(F, [$@,a,$@,b]), - [] = lists:takewhile(F, [$@,$@,a,$@,b]), - [] = lists:takewhile(F, [$@,$@,$@,a,$@,b]), - - Long = lists:seq(1, 1024), - Shorter = lists:seq(1, 400), - - Shorter = lists:takewhile(fun(E) -> E =< 400 end, Long), - - ok. - keystore(doc) -> ["OTP-XXX."]; keystore(suite) -> []; @@ -423,17 +381,6 @@ ?line false = lists:keytake(4, 2, L), ok. -%% Test lists:keyreplace/4. -keyreplace(Config) when is_list(Config) -> - [{new,42}] = lists:keyreplace(k, 1, [{k,1}], {new,42}), - [atom,{new,a,b}] = lists:keyreplace(k, 1, [atom,{k,1}], {new,a,b}), - [a,{x,y,z}] = lists:keyreplace(a, 5, [a,{x,y,z}], {no,use}), - - %% Error cases. - {'EXIT',_} = (catch lists:keyreplace(k, 1, [], not_tuple)), - {'EXIT',_} = (catch lists:keyreplace(k, 0, [], {a,b})), - ok. - merge(doc) -> ["merge functions"]; merge(suite) -> []; merge(Config) when is_list(Config) -> @@ -1757,7 +1704,7 @@ get_seed() -> case random:seed() of undefined -> - erlang:timestamp(); + now(); Tuple -> Tuple end. @@ -2378,25 +2325,19 @@ -define(flatten_error1(X), ?line {'EXIT', _} = (catch lists:flatten(X))). -define(flatten_error2(X,Y), ?line {'EXIT', _} = (catch lists:flatten(X,Y))). -%% Test lists:flatten/1,2 and lists:flatlength/1. +flatten_1(doc) -> ["flatten/1"]; +flatten_1(suite) -> []; flatten_1(Config) when is_list(Config) -> - [] = lists_flatten([]), - [1,2] = lists_flatten([1,2]), - [1,2] = lists_flatten([1,[2]]), - [1,2] = lists_flatten([[1],2]), - [1,2] = lists_flatten([[1],[2]]), - [1,2] = lists_flatten([[1,2]]), - [a,b,c,d] = lists_flatten([[a],[b,c,[d]]]), + ?line [] = lists:flatten([]), + ?line [1,2] = lists:flatten([1,2]), + ?line [1,2] = lists:flatten([1,[2]]), + ?line [1,2] = lists:flatten([[1],2]), + ?line [1,2] = lists:flatten([[1],[2]]), + ?line [1,2] = lists:flatten([[1,2]]), + ?line [a,b,c,d] = lists:flatten([[a],[b,c,[d]]]), ok. -lists_flatten(List) -> - Flat = lists:flatten(List), - Flat = lists:flatten(List, []), - Len = lists:flatlength(List), - Len = length(Flat), - Flat. - flatten_1_e(doc) -> ["flatten/1 error cases"]; flatten_1_e(suite) -> []; flatten_1_e(Config) when is_list(Config) -> @@ -2409,11 +2350,11 @@ %%% clear-cut. Right now, I think that any term should be allowed. %%% But I also wish this function didn't exist at all. -%% Test lists:flatten/2. +flatten_2(doc) -> ["flatten/2"]; +flatten_2(suite) -> []; flatten_2(Config) when is_list(Config) -> - [] = lists:flatten([], []), - [a] = lists:flatten([a], []), - [a,b,c,[no,flatten]] = lists:flatten([[a,[b,c]]], [[no,flatten]]), + ?line [] = lists:flatten([]), + ?line [a] = lists:flatten([a]), ok. flatten_2_e(doc) -> ["flatten/2 error cases"]; @@ -2709,40 +2650,3 @@ ?line {'EXIT', {function_clause, _}} = (catch lists:droplast(x)), ok. - -%% Briefly test the common high-order functions to ensure they -%% are covered. -hof(Config) when is_list(Config) -> - L = [1,2,3], - [1,4,9] = lists:map(fun(N) -> N*N end, L), - [1,4,5,6] = lists:flatmap(fun(1) -> [1]; - (2) -> []; - (3) -> [4,5,6] - end, L), - [{1,[a]},{2,[b]},{3,[c]}] = - lists:keymap(fun(A) -> [A] end, 2, [{1,a},{2,b},{3,c}]), - - [1,3] = lists:filter(fun(N) -> N rem 2 =:= 1 end, L), - FilterMapFun = fun(1) -> true; - (2) -> {true,42}; - (3) -> false - end, - [1,42] = lists:filtermap(FilterMapFun, L), - [1,42] = lists:zf(FilterMapFun, L), - - [3,2,1] = lists:foldl(fun(E, A) -> [E|A] end, [], L), - [1,2,3] = lists:foldr(fun(E, A) -> [E|A] end, [], L), - {[1,4,9],[3,2,1]} = lists:mapfoldl(fun(E, A) -> - {E*E,[E|A]} - end, [], L), - {[1,4,9],[1,2,3]} = lists:mapfoldr(fun(E, A) -> - {E*E,[E|A]} - end, [], L), - - true = lists:any(fun(N) -> N =:= 2 end, L), - false = lists:any(fun(N) -> N =:= 42 end, L), - - true = lists:all(fun(N) -> is_integer(N) end, L), - false = lists:all(fun(N) -> N rem 2 =:= 0 end, L), - - ok. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/log_mf_h_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/log_mf_h_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/log_mf_h_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/log_mf_h_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/Makefile erlang-17.3-dfsg/lib/stdlib/test/Makefile --- erlang-18.2-dfsg/lib/stdlib/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -23,14 +23,12 @@ dummy_via \ edlin_expand_SUITE \ epp_SUITE \ - erl_anno_SUITE \ erl_eval_SUITE \ erl_expand_records_SUITE \ erl_internal_SUITE \ erl_lint_SUITE \ erl_pp_SUITE \ erl_scan_SUITE \ - error_logger_h_SUITE \ escript_SUITE \ ets_SUITE \ ets_tough_SUITE \ @@ -55,7 +53,6 @@ proc_lib_SUITE \ qlc_SUITE \ queue_SUITE \ - rand_SUITE \ random_SUITE \ re_SUITE \ run_pcre_tests \ @@ -108,8 +105,7 @@ ERL_MAKE_FLAGS += ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include \ - -I$(ERL_TOP)/lib/kernel/include \ - -I$(ERL_TOP)/lib/stdlib/include + -I$(ERL_TOP)/lib/kernel/include EBIN = . diff -Nru erlang-18.2-dfsg/lib/stdlib/test/maps_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/maps_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/maps_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/maps_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -35,23 +34,13 @@ -export([init_per_testcase/2]). -export([end_per_testcase/2]). --export([t_get_3/1, t_filter_2/1, - t_fold_3/1,t_map_2/1,t_size_1/1, - t_with_2/1,t_without_2/1]). - -%-define(badmap(V,F,Args), {'EXIT', {{badmap,V}, [{maps,F,Args,_}|_]}}). -%-define(badarg(F,Args), {'EXIT', {badarg, [{maps,F,Args,_}|_]}}). -% silly broken hipe --define(badmap(V,F,_Args), {'EXIT', {{badmap,V}, [{maps,F,_,_}|_]}}). --define(badarg(F,_Args), {'EXIT', {badarg, [{maps,F,_,_}|_]}}). +-export([t_get_3/1,t_with_2/1,t_without_2/1]). suite() -> [{ct_hooks, [ts_install_cth]}]. all() -> - [t_get_3,t_filter_2, - t_fold_3,t_map_2,t_size_1, - t_with_2,t_without_2]. + [t_get_3,t_with_2,t_without_2]. init_per_suite(Config) -> Config. @@ -74,9 +63,6 @@ value1 = maps:get(key1, Map, DefaultValue), value2 = maps:get(key2, Map, DefaultValue), DefaultValue = maps:get(key3, Map, DefaultValue), - - %% error case - ?badmap(a,get,[[a,b],a,def]) = (catch maps:get([a,b],id(a),def)), ok. t_without_2(_Config) -> @@ -84,11 +70,6 @@ M0 = maps:from_list([{{k,I},{v,I}}||I<-lists:seq(1,100)]), M1 = maps:from_list([{{k,I},{v,I}}||I<-lists:seq(1,100) -- Ki]), M1 = maps:without([{k,I}||I <- Ki],M0), - - %% error case - ?badmap(a,without,[[a,b],a]) = (catch maps:without([a,b],id(a))), - ?badmap(a,without,[{a,b},a]) = (catch maps:without({a,b},id(a))), - ?badarg(without,[a,#{}]) = (catch maps:without(a,#{})), ok. t_with_2(_Config) -> @@ -96,63 +77,4 @@ M0 = maps:from_list([{{k,I},{v,I}}||I<-lists:seq(1,100)]), M1 = maps:from_list([{{k,I},{v,I}}||I<-Ki]), M1 = maps:with([{k,I}||I <- Ki],M0), - - %% error case - ?badmap(a,with,[[a,b],a]) = (catch maps:with([a,b],id(a))), - ?badmap(a,with,[{a,b},a]) = (catch maps:with({a,b},id(a))), - ?badarg(with,[a,#{}]) = (catch maps:with(a,#{})), - ok. - -t_filter_2(Config) when is_list(Config) -> - M = #{a => 2, b => 3, c=> 4, "a" => 1, "b" => 2, "c" => 4}, - Pred1 = fun(K,V) -> is_atom(K) andalso (V rem 2) =:= 0 end, - Pred2 = fun(K,V) -> is_list(K) andalso (V rem 2) =:= 0 end, - #{a := 2,c := 4} = maps:filter(Pred1,M), - #{"b" := 2,"c" := 4} = maps:filter(Pred2,M), - %% error case - ?badmap(a,filter,[_,a]) = (catch maps:filter(fun(_,_) -> ok end,id(a))), - ?badarg(filter,[<<>>,#{}]) = (catch maps:filter(id(<<>>),#{})), ok. - -t_fold_3(Config) when is_list(Config) -> - Vs = lists:seq(1,200), - M0 = maps:from_list([{{k,I},I}||I<-Vs]), - #{ {k,1} := 1, {k,200} := 200} = M0, - Tot0 = lists:sum(Vs), - Tot1 = maps:fold(fun({k,_},V,A) -> A + V end, 0, M0), - true = Tot0 =:= Tot1, - - %% error case - ?badmap(a,fold,[_,0,a]) = (catch maps:fold(fun(_,_,_) -> ok end,0,id(a))), - ?badarg(fold,[<<>>,0,#{}]) = (catch maps:fold(id(<<>>),0,#{})), - ok. - -t_map_2(Config) when is_list(Config) -> - Vs = lists:seq(1,200), - M0 = maps:from_list([{{k,I},I}||I<-Vs]), - #{ {k,1} := 1, {k,200} := 200} = M0, - M1 = maps:map(fun({k,_},V) -> V + 42 end, M0), - #{ {k,1} := 43, {k,200} := 242} = M1, - - %% error case - ?badmap(a,map,[_,a]) = (catch maps:map(fun(_,_) -> ok end, id(a))), - ?badarg(map,[<<>>,#{}]) = (catch maps:map(id(<<>>),#{})), - ok. - - -t_size_1(Config) when is_list(Config) -> - 0 = maps:size(#{}), - 10 = maps:size(maps:from_list([{{"k",I},I}||I<-lists:seq(1,10)])), - 20 = maps:size(maps:from_list([{{"k",I},I}||I<-lists:seq(1,20)])), - 30 = maps:size(maps:from_list([{{"k",I},I}||I<-lists:seq(1,30)])), - 40 = maps:size(maps:from_list([{{"k",I},I}||I<-lists:seq(1,40)])), - 50 = maps:size(maps:from_list([{{"k",I},I}||I<-lists:seq(1,50)])), - 60 = maps:size(maps:from_list([{{"k",I},I}||I<-lists:seq(1,60)])), - 600 = maps:size(maps:from_list([{{"k",I},I}||I<-lists:seq(1,600)])), - - %% error case - ?badmap(a,size,[a]) = (catch maps:size(id(a))), - ?badmap(<<>>,size,[<<>>]) = (catch maps:size(id(<<>>))), - ok. - -id(I) -> I. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/ms_transform_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/ms_transform_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/ms_transform_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/ms_transform_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2003-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -92,23 +91,21 @@ " end)">>, ?line [{_,[{_,ms_transform,{?WARN_NUMBER_SHADOW,'A'}}]}] = compile_ww(Prog), - Prog2 = <<"C = 5, - ets:fun2ms(fun ({A,B} = - C) when is_integer(A) and (A+5 > B) -> - {A andalso B,C} - end)">>, - [{_,[{3,ms_transform,{?WARN_NUMBER_SHADOW,'C'}}]}] = + Prog2 = <<"C=5, " + "ets:fun2ms(fun({A,B} = C) " + " when is_integer(A) and (A+5 > B) -> " + " {A andalso B,C} " + " end)">>, + ?line [{_,[{_,ms_transform,{?WARN_NUMBER_SHADOW,'C'}}]}] = compile_ww(Prog2), Rec3 = <<"-record(a,{a,b,c,d=foppa}).">>, - Prog3 = <<"A = 3, - C = 5, - ets:fun2ms(fun (C - = #a{a = A, b = B}) - when is_integer(A) and (A+5 > B) -> - {A andalso B,C} - end)">>, - [{_,[{3,ms_transform,{?WARN_NUMBER_SHADOW,'C'}}, - {4,ms_transform,{?WARN_NUMBER_SHADOW,'A'}}]}] = + Prog3 = <<"A=3,C=5, " + "ets:fun2ms(fun(#a{a = A, b = B} = C) " + " when is_integer(A) and (A+5 > B) -> " + " {A andalso B,C} " + " end)">>, + ?line [{_,[{_,ms_transform,{?WARN_NUMBER_SHADOW,'A'}}, + {_,ms_transform,{?WARN_NUMBER_SHADOW,'C'}}]}] = compile_ww(Rec3,Prog3), Rec4 = <<"-record(a,{a,b,c,d=foppa}).">>, Prog4 = <<"A=3,C=5, " @@ -870,7 +867,6 @@ "-include_lib(\"stdlib/include/ms_transform.hrl\").\n", "-export([tmp/0]).\n", Records/binary,"\n", - "-file(?FILE, 0). ", "tmp() ->\n", Expr/binary,".\n">>, FN=temp_name(), diff -Nru erlang-18.2-dfsg/lib/stdlib/test/naughty_child.erl erlang-17.3-dfsg/lib/stdlib/test/naughty_child.erl --- erlang-18.2-dfsg/lib/stdlib/test/naughty_child.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/naughty_child.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/proc_lib_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/proc_lib_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/proc_lib_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/proc_lib_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2014. All Rights Reserved. +%% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -28,7 +27,7 @@ init_per_group/2,end_per_group/2, crash/1, sync_start_nolink/1, sync_start_link/1, spawn_opt/1, sp1/0, sp2/0, sp3/1, sp4/2, sp5/1, - hibernate/1, stop/1, t_format/1]). + hibernate/1]). -export([ otp_6345/1, init_dont_hang/1]). -export([hib_loop/1, awaken/1]). @@ -39,7 +38,6 @@ -export([otp_6345_init/1, init_dont_hang_init/1]). --export([system_terminate/4]). -ifdef(STANDALONE). -define(line, noop, ). @@ -51,7 +49,7 @@ all() -> [crash, {group, sync_start}, spawn_opt, hibernate, - {group, tickets}, stop, t_format]. + {group, tickets}]. groups() -> [{tickets, [], [otp_6345, init_dont_hang]}, @@ -80,123 +78,77 @@ crash(Config) when is_list(Config) -> error_logger:add_report_handler(?MODULE, self()), - %% Make sure that we don't get a crash report if a process - %% terminates with reason 'shutdown' or reason {shutdown,Reason}. - process_flag(trap_exit, true), - Pid0 = proc_lib:spawn_link(erlang, apply, - [fun() -> exit(shutdown) end,[]]), - Pid1 = proc_lib:spawn_link(erlang, apply, - [fun() -> exit({shutdown,{a,b,c}}) end,[]]), - - receive {'EXIT',Pid0,shutdown} -> ok end, - receive {'EXIT',Pid1,{shutdown,{a,b,c}}} -> ok end, - process_flag(trap_exit, false), - %% We expect any unexpected messages to be caught below, - %% so we don't have explicitly wait some time to be sure. - - %% Spawn export function. - Pid2 = proc_lib:spawn(?MODULE, sp1, []), - Pid2 ! die, - Exp2 = [{initial_call,{?MODULE,sp1,[]}}, - {ancestors,[self()]}, - {error_info,{exit,die,{stacktrace}}}], - analyse_crash(Pid2, Exp2, []), + Pid = proc_lib:spawn(?MODULE, sp1, []), + Pid ! die, + ?line Report = receive + {crash_report, Pid, Report0} -> Report0 + after 2000 -> test_server:fail(no_crash_report) + end, + ?line proc_lib:format(Report), + ?line [PidRep, []] = Report, + ?line {value, {initial_call,{?MODULE,sp1,[]}}} = + lists:keysearch(initial_call, 1, PidRep), + Self = self(), + ?line {value, {ancestors,[Self]}} = + lists:keysearch(ancestors, 1, PidRep), + ?line {value, {error_info,{exit,die,_StackTrace1}}} = + lists:keysearch(error_info, 1, PidRep), - %% Spawn fun. F = fun sp1/0, - Pid3 = proc_lib:spawn(node(), F), - Pid3 ! die, - {module,?MODULE} = erlang:fun_info(F, module), - {name,Fname} = erlang:fun_info(F, name), - Exp3 = [{initial_call,{?MODULE,Fname,[]}}, - {ancestors,[self()]}, - {error_info,{exit,die,{stacktrace}}}], - analyse_crash(Pid3, Exp3, []), + Pid1 = proc_lib:spawn(node(), F), + Pid1 ! die, + ?line [PidRep1, []] = receive + {crash_report, Pid1, Report1} -> Report1 + after 2000 -> test_server:fail(no_crash_report) + end, + ?line {value, {initial_call,{Fmod,Fname,[]}}} = + lists:keysearch(initial_call, 1, PidRep1), + ?line {module,Fmod} = erlang:fun_info(F, module), + ?line {name,Fname} = erlang:fun_info(F, name), + ?line {value, {ancestors,[Self]}} = + lists:keysearch(ancestors, 1, PidRep1), + ?line {value, {error_info,{exit,die,_StackTrace2}}} = + lists:keysearch(error_info, 1, PidRep1), - %% Spawn function with neighbour. - Pid4 = proc_lib:spawn(?MODULE, sp2, []), + Pid2 = proc_lib:spawn(?MODULE, sp2, []), test_server:sleep(100), - {?MODULE,sp2,[]} = proc_lib:initial_call(Pid4), - {?MODULE,sp2,0} = proc_lib:translate_initial_call(Pid4), - Pid4 ! die, - Exp4 = [{initial_call,{?MODULE,sp2,[]}}, - {ancestors,[self()]}, - {error_info,{exit,die,{stacktrace}}}], - Links4 = [[{initial_call,{?MODULE,sp1,[]}}, - {ancestors,[Pid4,self()]}]], - analyse_crash(Pid4, Exp4, Links4), - - %% Make sure that we still get a crash report if the - %% process dictionary have been tampered with. - - Pid5 = proc_lib:spawn(erlang, apply, - [fun() -> - erase(), - exit(abnormal) - end,[]]), - Exp5 = [{initial_call,absent}, - {ancestors,[]}, - {error_info,{exit,abnormal,{stacktrace}}}], - analyse_crash(Pid5, Exp5, []), + ?line {?MODULE,sp2,[]} = proc_lib:initial_call(Pid2), + ?line {?MODULE,sp2,0} = proc_lib:translate_initial_call(Pid2), + Pid2 ! die, + ?line [Pid2Rep, [{neighbour, LinkRep}]] = + receive + {crash_report, Pid2, Report2} -> Report2 + after 2000 -> test_server:fail(no_crash_report) + end, + ?line {value, {initial_call,{?MODULE,sp2,[]}}} = + lists:keysearch(initial_call, 1, Pid2Rep), + ?line {value, {ancestors,[Self]}} = + lists:keysearch(ancestors, 1, Pid2Rep), + ?line {value, {error_info,{exit,die,_StackTrace3}}} = + lists:keysearch(error_info, 1, Pid2Rep), + ?line {value, {initial_call,{?MODULE,sp1,[]}}} = + lists:keysearch(initial_call, 1, LinkRep), - error_logger:delete_report_handler(?MODULE), - ok. + %% Make sure that we don't get a crash report if a process + %% terminates with reason 'shutdown' or reason {shutdown,Reason}. + ?line process_flag(trap_exit, true), + ?line Pid3 = proc_lib:spawn_link(erlang, apply, + [fun() -> exit(shutdown) end,[]]), -analyse_crash(Pid, Expected0, ExpLinks) -> - Expected = [{pid,Pid}|Expected0], - receive - {crash_report, Pid, Report} -> - _ = proc_lib:format(Report), %Smoke test. - [Crash,Links] = Report, - analyse_crash_1(Expected, Crash), - analyse_links(ExpLinks, Links); - Unexpected -> - io:format("~p\n", [Unexpected]), - test_server:fail(unexpected_message) - after 5000 -> - test_server:fail(no_crash_report) - end. + ?line Pid4 = proc_lib:spawn_link(erlang, apply, + [fun() -> exit({shutdown,{a,b,c}}) end,[]]), -analyse_links([H|Es], [{neighbour,N}|Links]) -> - analyse_crash_1(H, N), - analyse_links(Es, Links); -analyse_links([], []) -> - ok. + ?line receive {'EXIT',Pid3,shutdown} -> ok end, + ?line receive {'EXIT',Pid4,{shutdown,{a,b,c}}} -> ok end, + ?line process_flag(trap_exit, false), + + receive + Any -> + ?line ?t:fail({unexpected_message,Any}) + after 2000 -> + ok + end. -analyse_crash_1([{Key,absent}|T], Report) -> - false = lists:keymember(Key, 1, Report), - analyse_crash_1(T, Report); -analyse_crash_1([{Key,Pattern}|T], Report) -> - case lists:keyfind(Key, 1, Report) of - false -> - io:format("~p", [Report]), - test_server:fail({missing_key,Key}); - {Key,Info} -> - try - match_info(Pattern, Info) - catch - no_match -> - io:format("key: ~p", [Key]), - io:format("pattern: ~p", [Pattern]), - io:format("actual: ~p", [Report]), - test_server:fail(no_match) - end, - analyse_crash_1(T, Report) - end; -analyse_crash_1([], _Report) -> - []. - -match_info(T, T) -> - ok; -match_info({stacktrace}, Stk) when is_list(Stk) -> - ok; -match_info([H1|T1], [H2|T2]) -> - match_info(H1, H2), - match_info(T1, T2); -match_info(Tuple1, Tuple2) when tuple_size(Tuple1) =:= tuple_size(Tuple2) -> - match_info(tuple_to_list(Tuple1), tuple_to_list(Tuple2)); -match_info(_, _) -> - throw(no_match). sync_start_nolink(Config) when is_list(Config) -> _Pid = spawn_link(?MODULE, sp5, [self()]), @@ -347,7 +299,6 @@ ?line {value,{initial_call,{?MODULE,hib_loop,[_]}}} = lists:keysearch(initial_call, 1, Report), - error_logger:delete_report_handler(?MODULE), ok. hib_loop(LoopData) -> @@ -410,139 +361,10 @@ exit(Error) end. -init_dont_hang_init(_Parent) -> - error(bad_init). - -%% Test proc_lib:stop/1,3 -stop(_Config) -> - Parent = self(), - SysMsgProc = - fun() -> - receive - {system,From,Request} -> - sys:handle_system_msg(Request,From,Parent,?MODULE,[],[]) - end - end, - - %% Normal case: - %% Process handles system message and terminated with given reason - Pid1 = proc_lib:spawn(SysMsgProc), - ok = proc_lib:stop(Pid1), - false = erlang:is_process_alive(Pid1), - - %% Process does not exit - {'EXIT',noproc} = (catch proc_lib:stop(Pid1)), - - %% Badly handled system message - DieProc = - fun() -> - receive - {system,_From,_Request} -> - exit(die) - end - end, - Pid2 = proc_lib:spawn(DieProc), - {'EXIT',{die,_}} = (catch proc_lib:stop(Pid2)), - - %% Hanging process => timeout - HangProc = - fun() -> - receive - {system,_From,_Request} -> - timer:sleep(5000) - end - end, - Pid3 = proc_lib:spawn(HangProc), - {'EXIT',timeout} = (catch proc_lib:stop(Pid3,normal,1000)), - - %% Success case with other reason than 'normal' - Pid4 = proc_lib:spawn(SysMsgProc), - ok = proc_lib:stop(Pid4,other_reason,infinity), - false = erlang:is_process_alive(Pid4), - - %% System message is handled, but process dies with other reason - %% than the given (in system_terminate/4 below) - Pid5 = proc_lib:spawn(SysMsgProc), - {'EXIT',{badmatch,2}} = (catch proc_lib:stop(Pid5,crash,infinity)), - false = erlang:is_process_alive(Pid5), - - %% Local registered name - Pid6 = proc_lib:spawn(SysMsgProc), - register(to_stop,Pid6), - ok = proc_lib:stop(to_stop), - undefined = whereis(to_stop), - false = erlang:is_process_alive(Pid6), - - %% Remote registered name - {ok,Node} = test_server:start_node(proc_lib_SUITE_stop,slave,[]), - Dir = filename:dirname(code:which(?MODULE)), - rpc:call(Node,code,add_path,[Dir]), - Pid7 = spawn(Node,SysMsgProc), - true = rpc:call(Node,erlang,register,[to_stop,Pid7]), - Pid7 = rpc:call(Node,erlang,whereis,[to_stop]), - ok = proc_lib:stop({to_stop,Node}), - undefined = rpc:call(Node,erlang,whereis,[to_stop]), - false = rpc:call(Node,erlang,is_process_alive,[Pid7]), - - %% Local and remote registered name, but non-existing - {'EXIT',noproc} = (catch proc_lib:stop(to_stop)), - {'EXIT',noproc} = (catch proc_lib:stop({to_stop,Node})), - - true = test_server:stop_node(Node), - - %% Remote registered name, but non-existing node - {'EXIT',{{nodedown,Node},_}} = (catch proc_lib:stop({to_stop,Node})), - ok. - -system_terminate(crash,_Parent,_Deb,_State) -> - error({badmatch,2}); -system_terminate(Reason,_Parent,_Deb,_State) -> - exit(Reason). +init_dont_hang_init(Parent) -> + 1 = 2. -t_format(_Config) -> - error_logger:tty(false), - try - t_format() - after - error_logger:tty(true) - end, - ok. - -t_format() -> - error_logger:add_report_handler(?MODULE, self()), - Pid = proc_lib:spawn(fun t_format_looper/0), - HugeData = gb_sets:from_list(lists:seq(1, 100)), - Pid ! {die,HugeData}, - Report = receive - {crash_report, Pid, Report0} -> Report0 - end, - Usz = do_test_format(Report, unlimited), - Tsz = do_test_format(Report, 20), - - if - Tsz >= Usz -> - ?t:fail(); - true -> - ok - end, - - ok. - -do_test_format(Report, Depth) -> - io:format("*** Depth = ~p", [Depth]), - S0 = proc_lib:format(Report, latin1, Depth), - S = lists:flatten(S0), - io:put_chars(S), - length(S). - -t_format_looper() -> - receive - {die,Data} -> - exit(Data); - _ -> - t_format_looper() - end. %%----------------------------------------------------------------- %% The error_logger handler used. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/qlc_SUITE_data/join_info_compat.erl erlang-17.3-dfsg/lib/stdlib/test/qlc_SUITE_data/join_info_compat.erl --- erlang-18.2-dfsg/lib/stdlib/test/qlc_SUITE_data/join_info_compat.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/qlc_SUITE_data/join_info_compat.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/qlc_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/qlc_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/qlc_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/qlc_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -74,7 +73,6 @@ otp_5644/1, otp_5195/1, otp_6038_bug/1, otp_6359/1, otp_6562/1, otp_6590/1, otp_6673/1, otp_6964/1, otp_7114/1, otp_7238/1, otp_7232/1, otp_7552/1, otp_6674/1, otp_7714/1, otp_11758/1, - otp_12946/1, manpage/1, @@ -144,7 +142,7 @@ {tickets, [], [otp_5644, otp_5195, otp_6038_bug, otp_6359, otp_6562, otp_6590, otp_6673, otp_6964, otp_7114, otp_7232, - otp_7238, otp_7552, otp_6674, otp_7714, otp_11758, otp_12946]}, + otp_7238, otp_7552, otp_6674, otp_7714, otp_11758]}, {compat, [], [backward, forward]}]. init_per_suite(Config) -> @@ -398,8 +396,7 @@ qlc:q([3 || {3=4} <- []]). ">>, [], - %% {warnings,[{{2,27},qlc,nomatch_pattern}]}}, - {warnings,[{2,v3_core,nomatch}]}}, + {warnings,[{{2,27},qlc,nomatch_pattern}]}}, {nomatch2, <<"nomatch() -> @@ -410,8 +407,7 @@ end, [{1},{2}]). ">>, [], - %% {warnings,[{{3,33},qlc,nomatch_pattern}]}}, - {warnings,[{3,v3_core,nomatch}]}}, + {warnings,[{{3,33},qlc,nomatch_pattern}]}}, {nomatch3, <<"nomatch() -> @@ -423,8 +419,7 @@ end, [{1,2},{2,3}]). ">>, [], - %% {warnings,[{{3,52},qlc,nomatch_pattern}]}}, - {warnings,[{3,v3_core,nomatch}]}}, + {warnings,[{{3,52},qlc,nomatch_pattern}]}}, {nomatch4, <<"nomatch() -> @@ -2492,11 +2487,8 @@ (catch qlc:info([X || {X} <- []], {n_elements, 0})), L = lists:seq(1, 1000), \"[1,2,3,4,5,6,7,8,9,10|'...']\" = qlc:info(L, {n_elements, 10}), - {cons,A1,{integer,A2,1},{atom,A3,'...'}} = + {cons,1,{integer,1,1},{atom,1,'...'}} = qlc:info(L, [{n_elements, 1},{format,abstract_code}]), - 1 = erl_anno:line(A1), - 1 = erl_anno:line(A2), - 1 = erl_anno:line(A3), Q = qlc:q([{X} || X <- [a,b,c,d,e,f]]), {call,_,_,[{cons,_,{atom,_,a},{cons,_,{atom,_,b},{cons,_,{atom,_,c}, {atom,_,'...'}}}}, @@ -2913,8 +2905,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{1},{a}])">>, - %% {warnings,[{{2,37},qlc,nomatch_pattern}]}}, - []}, + {warnings,[{{2,37},qlc,nomatch_pattern}]}}, <<"etsc(fun(E) -> Q = qlc:q([X || {X=X,Y=Y}={Y=Y,X=X} <- ets:table(E), @@ -2942,8 +2933,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{a},{b}])">>, - %% {warnings,[{{2,35},qlc,nomatch_pattern}]}}, - []}, + {warnings,[{{2,35},qlc,nomatch_pattern}]}}, {cres, <<"etsc(fun(E) -> @@ -2951,8 +2941,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{a},{b}])">>, - %% {warnings,[{{2,35},qlc,nomatch_pattern}]}}, - []}, + {warnings,[{{2,35},qlc,nomatch_pattern}]}}, <<"etsc(fun(E) -> Q = qlc:q([X || X = <> <- ets:table(E)]), @@ -2999,8 +2988,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{a,b,c},{d,e,f}])">>, - %% {warnings,[{{2,34},qlc,nomatch_pattern}]}} - []} + {warnings,[{{2,34},qlc,nomatch_pattern}]}} ], ?line run(Config, Ts), @@ -3033,9 +3021,8 @@ end, [{3,true},{4,true}])">>, <<"%% Only guards are inspected. No lookup. - E1 = ets:new(e, [ordered_set]), - true = ets:insert(E1, [{1,1}, {2,2}, {3,3}, {4,4}, {5,5}]), - E2 = ets:new(join, [ordered_set]), + E1 = create_ets(1, 10), + E2 = ets:new(join, []), true = ets:insert(E2, [{true,1},{false,2}]), Q = qlc:q([{X,Z} || {_,X} <- ets:table(E1), {Y,Z} <- ets:table(E2), @@ -3064,8 +3051,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{1}, {2}])">>, - %% {warnings,[{{3,46},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{3,46},qlc,nomatch_filter}]}}, {cres, <<"etsc(fun(E) -> @@ -3074,8 +3060,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{1}, {2}])">>, - %% {warnings,[{{3,43},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{3,43},qlc,nomatch_filter}]}}, {cres, <<"etsc(fun(E) -> @@ -3084,8 +3069,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{1}, {2}])">>, - %% {warnings,[{{3,48},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{3,48},qlc,nomatch_filter}]}}, <<"etsc(fun(E) -> Q = qlc:q([{X,Y} || {X,Y} <- ets:table(E), @@ -3100,8 +3084,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{[3]},{[3,4]}])">>, - %% {warnings,[{{2,61},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{2,61},qlc,nomatch_filter}]}}, <<"etsc(fun(E) -> U = 18, @@ -3133,8 +3116,7 @@ [] = lists:sort(qlc:e(Q)), false = lookup_keys(Q) end, [{2},{3},{4},{8}])">>, - %% {warnings,[{{4,44},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{4,44},qlc,nomatch_filter}]}}, {cres, <<"etsc(fun(E) -> @@ -3144,8 +3126,7 @@ [] = lists:sort(qlc:e(Q)), false = lookup_keys(Q) end, [{2},{3},{4},{8}])">>, - %% {warnings,[{{4,35},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{4,35},qlc,nomatch_filter}]}}, <<"F = fun(U) -> Q = qlc:q([X || {X} <- [a,b,c], @@ -3161,8 +3142,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{1,1},{2,1}])">>, - %% {warnings,[{{2,61},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{2,61},qlc,nomatch_filter}]}}, <<"Two = 2.0, etsc(fun(E) -> @@ -3223,10 +3203,8 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{1,b},{2,3}])">>, - %% {warnings,[{2,sys_core_fold,nomatch_guard}, - %% {3,qlc,nomatch_filter}, - %% {3,sys_core_fold,{eval_failure,badarg}}]}}, {warnings,[{2,sys_core_fold,nomatch_guard}, + {3,qlc,nomatch_filter}, {3,sys_core_fold,{eval_failure,badarg}}]}}, <<"etsc(fun(E) -> @@ -3249,8 +3227,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{{1}},{{2}}])">>, - %% {warnings,[{{4,47},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{4,47},qlc,nomatch_filter}]}}, {cres, <<"etsc(fun(E) -> @@ -3260,8 +3237,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{{1}},{{2}}])">>, - %% {warnings,[{{4,47},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{4,47},qlc,nomatch_filter}]}}, <<"etsc(fun(E) -> Q = qlc:q([X || {X} <- ets:table(E), @@ -3321,8 +3297,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{3}, {4}])">>, - %% {warnings,[{{3,44},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{3,44},qlc,nomatch_filter}]}}, <<"etsc(fun(E) -> Q = qlc:q([X || {{X,Y}} <- ets:table(E), @@ -3443,8 +3418,7 @@ end, [{1},{2}])">> ], - - ok = run(Config, Ts), + ?line run(Config, Ts), TsR = [ %% is_record/2,3: @@ -3482,8 +3456,7 @@ end, [{keypos,1}], [#r{}])">> ], - - ok = run(Config, <<"-record(r, {a}).\n">>, TsR), + ?line run(Config, <<"-record(r, {a}).\n">>, TsR), Ts2 = [ <<"etsc(fun(E) -> @@ -3593,6 +3566,7 @@ [{1,2},{2,2}] = qlc:e(Q), [2] = lookup_keys(Q) end, [{keypos,1}], [{1},{2},{3}])">>, + <<"%% Matchspec only. No cache. etsc(fun(E) -> Q = qlc:q([{X,Y} || @@ -3604,7 +3578,7 @@ {generate,_, {table,{ets,_,[_,[{traverse,_}]]}}}],[]} = i(Q), - [{1,2},{1,3},{2,2},{2,3}] = lists:sort(qlc:e(Q)), + [{1,2},{1,3},{2,2},{2,3}] = qlc:e(Q), false = lookup_keys(Q) end, [{keypos,1}], [{1},{2},{3}])">>, <<"%% Matchspec only. Cache @@ -3618,7 +3592,7 @@ {generate,_,{qlc,_, [{generate,_,{table,{ets,_,[_,[{traverse,_}]]}}}], [{cache,ets}]}}],[]} = i(Q), - [{1,2},{1,3},{2,2},{2,3}] = lists:sort(qlc:e(Q)), + [{1,2},{1,3},{2,2},{2,3}] = qlc:e(Q), false = lookup_keys(Q) end, [{keypos,1}], [{1},{2},{3}])">>, <<"%% An empty list. Always unique and cached. @@ -3671,7 +3645,7 @@ ], - ok = run(Config, Ts2), + ?line run(Config, Ts2), LTs = [ <<"etsc(fun(E) -> @@ -3703,8 +3677,7 @@ end, [{1,a},{2,b}])">> ], - - ok = run(Config, LTs), + ?line run(Config, LTs), ok. @@ -3727,8 +3700,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{keypos,2}], [#r{a = 17}, #r{a = 3}, #r{a = 5}])">>, - %% {warnings,[{{4,44},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{4,44},qlc,nomatch_filter}]}}, <<"%% Compares an integer and a float. etsc(fun(E) -> @@ -4032,8 +4004,7 @@ [] = qlc:e(Q), false = lookup_keys(Q) end, [{1,1},{2,0}])">>, - %% {warnings,[{{4,37},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{4,37},qlc,nomatch_filter}]}}, <<"etsc(fun(E) -> Q = qlc:q([{A,B,C} || @@ -6122,7 +6093,7 @@ lists:flatten(qlc:format_error(ErrReply)), qlc_SUITE:install_error_logger(), 20000 = length(F(warning_msg)), - {warning, joining} = qlc_SUITE:read_error_logger(), + {error, joining} = qlc_SUITE:read_error_logger(), 20000 = length(F(info_msg)), {info, joining} = qlc_SUITE:read_error_logger(), 20000 = length(F(error_msg)), @@ -6157,8 +6128,8 @@ {error, caching} = qlc_SUITE:read_error_logger(), {error, caching} = qlc_SUITE:read_error_logger(), 1 = length(F(warning_msg)), - {warning, caching} = qlc_SUITE:read_error_logger(), - {warning, caching} = qlc_SUITE:read_error_logger(), + {error, caching} = qlc_SUITE:read_error_logger(), + {error, caching} = qlc_SUITE:read_error_logger(), 1 = length(F(info_msg)), {info, caching} = qlc_SUITE:read_error_logger(), {info, caching} = qlc_SUITE:read_error_logger(), @@ -6190,7 +6161,7 @@ L = F(info_msg), {info, sorting} = qlc_SUITE:read_error_logger(), L = F(warning_msg), - {warning, sorting} = qlc_SUITE:read_error_logger(), + {error, sorting} = qlc_SUITE:read_error_logger(), qlc_SUITE:uninstall_error_logger(), ets:delete(E1), ets:delete(E2)">>], @@ -6217,7 +6188,7 @@ R = lists:sort(F(error_msg)), {error, caching} = qlc_SUITE:read_error_logger(), R = lists:sort(F(warning_msg)), - {warning, caching} = qlc_SUITE:read_error_logger(), + {error, caching} = qlc_SUITE:read_error_logger(), qlc_SUITE:uninstall_error_logger(), ErrReply = F(not_allowed), {error,qlc,{tmpdir_usage,caching}} = ErrReply, @@ -6246,9 +6217,8 @@ <<"nomatch_1() -> {qlc:q([X || X={X} <- []]), [t || \"a\"=\"b\" <- []]}.">>, [], - %% {warnings,[{{2,30},qlc,nomatch_pattern}, - %% {{2,44},v3_core,nomatch}]}}, - {warnings,[{2,v3_core,nomatch}]}}, + {warnings,[{{2,30},qlc,nomatch_pattern}, + {{2,44},v3_core,nomatch}]}}, %% Not found by qlc... {nomatch_2, @@ -6261,8 +6231,7 @@ <<"nomatch_3() -> qlc:q([t || [$a, $b] = \"ba\" <- []]).">>, [], - %% {warnings,[{{2,37},qlc,nomatch_pattern}]}}, - {warnings,[{2,v3_core,nomatch}]}}, + {warnings,[{{2,37},qlc,nomatch_pattern}]}}, %% Not found by qlc... {nomatch_4, @@ -6283,51 +6252,44 @@ qlc:q([X || X <- [], X =:= {X}]).">>, [], - %% {warnings,[{{3,30},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{3,30},qlc,nomatch_filter}]}}, {nomatch_7, <<"nomatch_7() -> qlc:q([X || {X=Y,{Y}=X} <- []]).">>, [], - %% {warnings,[{{2,28},qlc,nomatch_pattern}]}}, - []}, + {warnings,[{{2,28},qlc,nomatch_pattern}]}}, {nomatch_8, <<"nomatch_8() -> qlc:q([X || {X={},X=[]} <- []]).">>, [], - %% {warnings,[{{2,28},qlc,nomatch_pattern}]}}, - []}, + {warnings,[{{2,28},qlc,nomatch_pattern}]}}, {nomatch_9, <<"nomatch_9() -> qlc:q([X || X <- [], X =:= {}, X =:= []]).">>, [], - %% {warnings,[{{2,49},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{2,49},qlc,nomatch_filter}]}}, {nomatch_10, <<"nomatch_10() -> qlc:q([X || X <- [], ((X =:= 1) or (X =:= 2)) and (X =:= 3)]).">>, [], - %% {warnings,[{{3,53},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{3,53},qlc,nomatch_filter}]}}, {nomatch_11, <<"nomatch_11() -> qlc:q([X || X <- [], x =:= []]).">>, [], - %% {warnings,[{{2,39},qlc,nomatch_filter}]}}, - {warnings,[{2,sys_core_fold,nomatch_guard}]}}, + {warnings,[{{2,39},qlc,nomatch_filter}]}}, {nomatch_12, <<"nomatch_12() -> qlc:q([X || X={} <- [], X =:= []]).">>, [], - %% {warnings,[{{2,42},qlc,nomatch_filter}]}}, - []}, + {warnings,[{{2,42},qlc,nomatch_filter}]}}, {nomatch_13, <<"nomatch_13() -> @@ -6335,9 +6297,8 @@ X={X} <- [], Y={Y} <- []]).">>, [], - %% {warnings,[{{3,29},qlc,nomatch_pattern}, - %% {{4,29},qlc,nomatch_pattern}]}}, - []}, + {warnings,[{{3,29},qlc,nomatch_pattern}, + {{4,29},qlc,nomatch_pattern}]}}, {nomatch_14, <<"nomatch_14() -> @@ -6345,8 +6306,7 @@ 1 > 0, 1 > X]).">>, [], - %% {warnings,[{{2,29},qlc,nomatch_pattern}]}}, - []}, + {warnings,[{{2,29},qlc,nomatch_pattern}]}}, {nomatch_15, <<"nomatch_15() -> @@ -6355,8 +6315,7 @@ 1 > 0, 1 > X]).">>, [], - %% {warnings,[{{2,32},qlc,nomatch_pattern}]}}, - []}, + {warnings,[{{2,32},qlc,nomatch_pattern}]}}, %% Template warning. {nomatch_template1, @@ -6594,19 +6553,18 @@ ?line run(Config, T2), T3 = [ -%% {nomatch_6, -%% <<"nomatch_6() -> -%% qlc:q([X || X <- [], -%% X =:= {X}]).">>, -%% [], -%% {[],["filter evaluates to 'false'"]}}, - -%% {nomatch_7, -%% <<"nomatch_7() -> -%% qlc:q([X || {X=Y,{Y}=X} <- []]).">>, -%% [], -%% {[],["pattern cannot possibly match"]}} - ], + {nomatch_6, + <<"nomatch_6() -> + qlc:q([X || X <- [], + X =:= {X}]).">>, + [], + {[],["filter evaluates to 'false'"]}}, + + {nomatch_7, + <<"nomatch_7() -> + qlc:q([X || {X=Y,{Y}=X} <- []]).">>, + [], + {[],["pattern cannot possibly match"]}}], ?line compile_format(Config, T3), %% *Very* simple test - just check that it doesn't crash. @@ -6864,8 +6822,7 @@ A == 192, B =:= 192.0, {Y} <- [{0},{1},{2}], X == Y]), - A0 = erl_anno:new(0), - {block,A0, + {block,0, [{match,_,_, {call,_,_, [{lc,_,_, @@ -7155,18 +7112,6 @@ ?line run(Config, Ts). -otp_12946(doc) -> - ["Syntax error."]; -otp_12946(suite) -> []; -otp_12946(Config) when is_list(Config) -> - Text = - <<"-export([init/0]). - init() -> - ok. - y">>, - {errors,[{4,erl_parse,_}],[]} = compile_file(Config, Text, []), - ok. - manpage(doc) -> "Examples from qlc(3)."; manpage(suite) -> []; @@ -7447,8 +7392,7 @@ {ok, M} = compile:file(File, [{outdir, ?datadir}]), {module, M} = code:load_abs(filename:rootname(File)), H = M:create_handle(), - A0 = erl_anno:new(0), - {block,A0, + {block,0, [{match,_,_, {call,_,_, [{lc,_,_, @@ -7828,8 +7772,8 @@ end, FormatFun = fun(all) -> - L = erl_anno:new(17), - {call,L,{remote,L,{atom,L,?MODULE},{atom,L,the_list}}, + L = 17, + {call,L,{remote,L,{atom,1,?MODULE},{atom,L,the_list}}, [erl_parse:abstract(List, 17)]}; ({lookup, Column, Values}) -> {?MODULE, list_keys, [Values, Column, List]} @@ -7947,7 +7891,7 @@ {module, _} = code:load_abs(AbsFile, Mod), Ms0 = erlang:process_info(self(),messages), - Before = {{get(), ets:all(), Ms0}, pps()}, + Before = {get(), pps(), ets:all(), Ms0}, %% Prepare the check that the qlc module does not call qlc_pt. _ = [unload_pt() || {file, Name} <- [code:is_loaded(qlc_pt)], @@ -7977,29 +7921,12 @@ run_test(Config, Extra, Body) -> run_test(Config, Extra, {cres,Body,[]}). -wait_for_expected(R, {Strict0,PPS0}=Before, SourceFile, Wait) -> +wait_for_expected(R, Before, SourceFile, Wait) -> Ms = erlang:process_info(self(),messages), - After = {_,PPS1} = {{get(), ets:all(), Ms}, pps()}, + After = {get(), pps(), ets:all(), Ms}, case {R, After} of {ok, Before} -> ok; - {ok, {Strict0,_}} -> - {Ports0,Procs0} = PPS0, - {Ports1,Procs1} = PPS1, - case {Ports1 -- Ports0, Procs1 -- Procs0} of - {[], []} -> ok; - _ when Wait -> - timer:sleep(1000), - wait_for_expected(R, Before, SourceFile, false); - {PortsDiff,ProcsDiff} -> - io:format("failure, got ~p~n, expected ~p\n", - [PPS1, PPS0]), - show("Old port", Ports0 -- Ports1), - show("New port", PortsDiff), - show("Old proc", Procs0 -- Procs1), - show("New proc", ProcsDiff), - fail(SourceFile) - end; _ when Wait -> timer:sleep(1000), wait_for_expected(R, Before, SourceFile, false); @@ -8066,7 +7993,7 @@ case compile:file(File, Opts) of {ok, _M, Ws} -> warnings(File, Ws); {error, [{File,Es}], []} -> {errors, Es, []}; - {error, [{File,Es}], [{File,Ws}]} -> {errors, Es, Ws} + {error, [{File,Es}], [{File,Ws}]} -> {error, Es, Ws} end. comp_compare(T, T) -> @@ -8131,17 +8058,6 @@ filename(Name, Config) -> filename:join(?privdir, Name). -show(_S, []) -> - ok; -show(S, [{Pid, Name, InitCall}|Pids]) when is_pid(Pid) -> - io:format("~s: ~w (~w), ~w: ~p~n", - [S, Pid, proc_reg_name(Name), InitCall, - erlang:process_info(Pid)]), - show(S, Pids); -show(S, [{Port, _}|Ports]) when is_port(Port)-> - io:format("~s: ~w: ~p~n", [S, Port, erlang:port_info(Port)]), - show(S, Ports). - pps() -> {port_list(), process_list()}. @@ -8154,9 +8070,6 @@ safe_second_element(process_info(P, initial_call))} || P <- processes(), is_process_alive(P)]. -proc_reg_name({registered_name, Name}) -> Name; -proc_reg_name([]) -> no_reg_name. - safe_second_element({_,Info}) -> Info; safe_second_element(Other) -> Other. @@ -8192,8 +8105,6 @@ {error, Why}; {info, Why} -> {info, Why}; - {warning, Why} -> - {warning, Why}; {error, Pid, Tuple} -> {error, Pid, Tuple} after 1000 -> @@ -8208,7 +8119,8 @@ init(Tester) -> {ok, Tester}. -handle_event({error, _GL, {_Pid, _Msg, [Why, _]}}, Tester) when is_atom(Why) -> +handle_event({error, _GL, {_Pid, _Msg, [Why, _]}}, Tester) + when is_atom(Why) -> Tester ! {error, Why}, {ok, Tester}; handle_event({error, _GL, {_Pid, _Msg, [P, T]}}, Tester) when is_pid(P) -> @@ -8217,9 +8129,6 @@ handle_event({info_msg, _GL, {_Pid, _Msg, [Why, _]}}, Tester) -> Tester ! {info, Why}, {ok, Tester}; -handle_event({warning_msg, _GL, {_Pid, _Msg, [Why, _]}}, Tester) when is_atom(Why) -> - Tester ! {warning, Why}, - {ok, Tester}; handle_event(_Event, State) -> {ok, State}. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/queue_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/queue_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/queue_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/queue_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/random_iolist.erl erlang-17.3-dfsg/lib/stdlib/test/random_iolist.erl --- erlang-18.2-dfsg/lib/stdlib/test/random_iolist.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/random_iolist.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/random_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/random_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/random_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/random_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -83,7 +82,7 @@ []; seed(Config) when is_list(Config) -> ?line Self = self(), - Seed = {S1, S2, S3} = erlang:timestamp(), + ?line Seed = {S1, S2, S3} = now(), ?line _ = spawn(fun() -> random:seed(S1,S2,S3), Rands = lists:foldl(fun diff -Nru erlang-18.2-dfsg/lib/stdlib/test/random_unicode_list.erl erlang-17.3-dfsg/lib/stdlib/test/random_unicode_list.erl --- erlang-18.2-dfsg/lib/stdlib/test/random_unicode_list.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/random_unicode_list.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/rand_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/rand_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/rand_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/rand_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,540 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2011. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% - --module(rand_SUITE). --export([all/0, suite/0,groups/0, - init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - init_per_testcase/2, end_per_testcase/2 - ]). - --export([interval_int/1, interval_float/1, seed/1, - api_eq/1, reference/1, - basic_stats_uniform_1/1, basic_stats_uniform_2/1, - basic_stats_normal/1, - plugin/1, measure/1 - ]). - --export([test/0, gen/1]). - --include_lib("test_server/include/test_server.hrl"). - -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(3)). --define(LOOP, 1000000). - -init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [seed, interval_int, interval_float, - api_eq, - reference, - {group, basic_stats}, - plugin, measure - ]. - -groups() -> - [{basic_stats, [parallel], - [basic_stats_uniform_1, basic_stats_uniform_2, basic_stats_normal]}]. - -init_per_suite(Config) -> Config. -end_per_suite(_Config) -> ok. - -init_per_group(_GroupName, Config) -> Config. -end_per_group(_GroupName, Config) -> Config. - -%% A simple helper to test without test_server during dev -test() -> - Tests = all(), - lists:foreach(fun(Test) -> - try - ok = ?MODULE:Test([]), - io:format("~p: ok~n", [Test]) - catch _:Reason -> - io:format("Failed: ~p: ~p ~p~n", - [Test, Reason, erlang:get_stacktrace()]) - end - end, Tests). - -algs() -> - [exs64, exsplus, exs1024]. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -seed(doc) -> - ["Test that seed and seed_s and export_seed/0 is working."]; -seed(suite) -> - []; -seed(Config) when is_list(Config) -> - Algs = algs(), - Test = fun(Alg) -> - try seed_1(Alg) - catch _:Reason -> - test_server:fail({Alg, Reason, erlang:get_stacktrace()}) - end - end, - [Test(Alg) || Alg <- Algs], - ok. - -seed_1(Alg) -> - %% Check that uniform seeds automatically, - _ = rand:uniform(), - S00 = get(rand_seed), - erase(), - _ = rand:uniform(), - false = S00 =:= get(rand_seed), %% hopefully - - %% Choosing algo and seed - S0 = rand:seed(Alg, {0, 0, 0}), - %% Check that (documented?) process_dict variable is correct - S0 = get(rand_seed), - S0 = rand:seed_s(Alg, {0, 0, 0}), - %% Check that process_dict should not be used for seed_s functionality - _ = rand:seed_s(Alg, {1, 0, 0}), - S0 = get(rand_seed), - %% Test export - ES0 = rand:export_seed(), - ES0 = rand:export_seed_s(S0), - S0 = rand:seed(ES0), - S0 = rand:seed_s(ES0), - %% seed/1 calls should be unique - S1 = rand:seed(Alg), - false = (S1 =:= rand:seed_s(Alg)), - %% Negative integers works - _ = rand:seed_s(Alg, {-1,-1,-1}), - %% Check that export_seed/1 returns 'undefined' if there is no seed - erase(rand_seed), - undefined = rand:export_seed(), - - %% Other term do not work - {'EXIT', _} = (catch rand:seed_s(foobar, os:timestamp())), - {'EXIT', _} = (catch rand:seed_s(Alg, {asd, 1, 1})), - {'EXIT', _} = (catch rand:seed_s(Alg, {0, 234.1234, 1})), - {'EXIT', _} = (catch rand:seed_s(Alg, {0, 234, [1, 123, 123]})), - ok. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -api_eq(doc) -> - ["Check that both api's are consistent with each other."]; -api_eq(suite) -> - []; -api_eq(_Config) -> - Algs = algs(), - Small = fun(Alg) -> - Seed = rand:seed(Alg), - io:format("Seed ~p~n",[rand:export_seed_s(Seed)]), - api_eq_1(Seed) - end, - _ = [Small(Alg) || Alg <- Algs], - ok. - -api_eq_1(S00) -> - Check = fun(_, Seed) -> - {V0, S0} = rand:uniform_s(Seed), - V0 = rand:uniform(), - {V1, S1} = rand:uniform_s(1000000, S0), - V1 = rand:uniform(1000000), - {V2, S2} = rand:normal_s(S1), - V2 = rand:normal(), - S2 - end, - S1 = lists:foldl(Check, S00, lists:seq(1, 200)), - S1 = get(rand_seed), - {V0, S2} = rand:uniform_s(S1), - V0 = rand:uniform(), - S2 = get(rand_seed), - - Exported = rand:export_seed(), - Exported = rand:export_seed_s(S2), - - S3 = lists:foldl(Check, S2, lists:seq(1, 200)), - S3 = get(rand_seed), - - S4 = lists:foldl(Check, S3, lists:seq(1, 200)), - S4 = get(rand_seed), - %% Verify that we do not have loops - false = S1 =:= S2, - false = S2 =:= S3, - false = S3 =:= S4, - - S2 = rand:seed(Exported), - S3 = lists:foldl(Check, S2, lists:seq(1, 200)), - ok. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -interval_int(doc) -> - ["Check that uniform/1 returns values within the proper interval."]; -interval_int(suite) -> - []; -interval_int(Config) when is_list(Config) -> - Algs = algs(), - Small = fun(Alg) -> - Seed = rand:seed(Alg), - io:format("Seed ~p~n",[rand:export_seed_s(Seed)]), - Max = interval_int_1(100000, 7, 0), - Max =:= 7 orelse exit({7, Alg, Max}) - end, - _ = [Small(Alg) || Alg <- Algs], - %% Test large integers - Large = fun(Alg) -> - Seed = rand:seed(Alg), - io:format("Seed ~p~n",[rand:export_seed_s(Seed)]), - Max = interval_int_1(100000, 1 bsl 128, 0), - Max > 1 bsl 64 orelse exit({large, Alg, Max}) - end, - [Large(Alg) || Alg <- Algs], - ok. - -interval_int_1(0, _, Max) -> Max; -interval_int_1(N, Top, Max) -> - X = rand:uniform(Top), - if - 0 < X, X =< Top -> - ok; - true -> - io:format("X=~p Top=~p 0<~p<~p~n", [X,Top,X,Top]), - exit({X, rand:export_seed()}) - end, - interval_int_1(N-1, Top, max(X, Max)). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -interval_float(doc) -> - ["Check that uniform/0 returns values within the proper interval."]; -interval_float(suite) -> - []; -interval_float(Config) when is_list(Config) -> - Algs = algs(), - Test = fun(Alg) -> - _ = rand:seed(Alg), - interval_float_1(100000) - end, - [Test(Alg) || Alg <- Algs], - ok. - -interval_float_1(0) -> ok; -interval_float_1(N) -> - X = rand:uniform(), - if - 0.0 < X, X < 1.0 -> - ok; - true -> - io:format("X=~p 0<~p<1.0~n", [X,X]), - exit({X, rand:export_seed()}) - end, - interval_float_1(N-1). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -reference(doc) -> ["Check if exs64 algorithm generates the proper sequence."]; -reference(suite) -> []; -reference(Config) when is_list(Config) -> - [reference_1(Alg) || Alg <- algs()], - ok. - -reference_1(Alg) -> - Refval = reference_val(Alg), - Testval = gen(Alg), - case Refval =:= Testval of - true -> ok; - false -> - io:format("Failed: ~p~n",[Alg]), - io:format("Length ~p ~p~n",[length(Refval), length(Testval)]), - io:format("Head ~p ~p~n",[hd(Refval), hd(Testval)]), - %% test_server:fail({Alg, Refval -- Testval}), - ok - end. - -gen(Algo) -> - Seed = case Algo of - exsplus -> %% Printed with orig 'C' code and this seed - rand:seed_s({exsplus, [12345678|12345678]}); - exs64 -> %% Printed with orig 'C' code and this seed - rand:seed_s({exs64, 12345678}); - exs1024 -> %% Printed with orig 'C' code and this seed - rand:seed_s({exs1024, {lists:duplicate(16, 12345678), []}}); - _ -> - rand:seed(Algo, {100, 200, 300}) - end, - gen(?LOOP, Seed, []). - -gen(N, State0 = {#{max:=Max}, _}, Acc) when N > 0 -> - {Random, State} = rand:uniform_s(Max, State0), - case N rem (?LOOP div 100) of - 0 -> gen(N-1, State, [Random|Acc]); - _ -> gen(N-1, State, Acc) - end; -gen(_, _, Acc) -> lists:reverse(Acc). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% This just tests the basics so we have not made any serious errors -%% when making the conversion from the original algorithms. -%% The algorithms must have good properties to begin with -%% - -%% Check that the algorithms generate sound values. - -basic_stats_uniform_1(Config) when is_list(Config) -> - [basic_uniform_1(?LOOP, rand:seed_s(Alg), 0.0, array:new([{default, 0}])) - || Alg <- algs()], - ok. - -basic_stats_uniform_2(Config) when is_list(Config) -> - [basic_uniform_2(?LOOP, rand:seed_s(Alg), 0, array:new([{default, 0}])) - || Alg <- algs()], - ok. - -basic_stats_normal(Config) when is_list(Config) -> - io:format("Testing normal~n",[]), - [basic_normal_1(?LOOP, rand:seed_s(Alg), 0, 0) || Alg <- algs()], - ok. - -basic_uniform_1(N, S0, Sum, A0) when N > 0 -> - {X,S} = rand:uniform_s(S0), - I = trunc(X*100), - A = array:set(I, 1+array:get(I,A0), A0), - basic_uniform_1(N-1, S, Sum+X, A); -basic_uniform_1(0, {#{type:=Alg}, _}, Sum, A) -> - AverN = Sum / ?LOOP, - io:format("~.10w: Average: ~.4f~n", [Alg, AverN]), - Counters = array:to_list(A), - Min = lists:min(Counters), - Max = lists:max(Counters), - io:format("~.10w: Min: ~p Max: ~p~n", [Alg, Min, Max]), - - %% Verify that the basic statistics are ok - %% be gentle we don't want to see to many failing tests - abs(0.5 - AverN) < 0.005 orelse test_server:fail({average, Alg, AverN}), - abs(?LOOP div 100 - Min) < 1000 orelse test_server:fail({min, Alg, Min}), - abs(?LOOP div 100 - Max) < 1000 orelse test_server:fail({max, Alg, Max}), - ok. - -basic_uniform_2(N, S0, Sum, A0) when N > 0 -> - {X,S} = rand:uniform_s(100, S0), - A = array:set(X-1, 1+array:get(X-1,A0), A0), - basic_uniform_2(N-1, S, Sum+X, A); -basic_uniform_2(0, {#{type:=Alg}, _}, Sum, A) -> - AverN = Sum / ?LOOP, - io:format("~.10w: Average: ~.4f~n", [Alg, AverN]), - Counters = tl(array:to_list(A)), - Min = lists:min(Counters), - Max = lists:max(Counters), - io:format("~.10w: Min: ~p Max: ~p~n", [Alg, Min, Max]), - - %% Verify that the basic statistics are ok - %% be gentle we don't want to see to many failing tests - abs(50.5 - AverN) < 0.5 orelse test_server:fail({average, Alg, AverN}), - abs(?LOOP div 100 - Min) < 1000 orelse test_server:fail({min, Alg, Min}), - abs(?LOOP div 100 - Max) < 1000 orelse test_server:fail({max, Alg, Max}), - ok. - -basic_normal_1(N, S0, Sum, Sq) when N > 0 -> - {X,S} = rand:normal_s(S0), - basic_normal_1(N-1, S, X+Sum, X*X+Sq); -basic_normal_1(0, {#{type:=Alg}, _}, Sum, SumSq) -> - Mean = Sum / ?LOOP, - StdDev = math:sqrt((SumSq - (Sum*Sum/?LOOP))/(?LOOP - 1)), - io:format("~.10w: Average: ~7.4f StdDev ~6.4f~n", [Alg, Mean, StdDev]), - %% Verify that the basic statistics are ok - %% be gentle we don't want to see to many failing tests - abs(Mean) < 0.005 orelse test_server:fail({average, Alg, Mean}), - abs(StdDev - 1.0) < 0.005 orelse test_server:fail({stddev, Alg, StdDev}), - ok. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -plugin(doc) -> ["Test that the user can write algorithms"]; -plugin(suite) -> []; -plugin(Config) when is_list(Config) -> - _ = lists:foldl(fun(_, S0) -> - {V1, S1} = rand:uniform_s(10000, S0), - true = is_integer(V1), - {V2, S2} = rand:uniform_s(S1), - true = is_float(V2), - S2 - end, crypto_seed(), lists:seq(1, 200)), - ok. - -%% Test implementation -crypto_seed() -> - {#{type=>crypto, - max=>(1 bsl 64)-1, - next=>fun crypto_next/1, - uniform=>fun crypto_uniform/1, - uniform_n=>fun crypto_uniform_n/2}, - <<>>}. - -%% Be fair and create bignums i.e. 64bits otherwise use 58bits -crypto_next(<>) -> - {Num, Bin}; -crypto_next(_) -> - crypto_next(crypto:rand_bytes((64 div 8)*100)). - -crypto_uniform({Api, Data0}) -> - {Int, Data} = crypto_next(Data0), - {Int / (1 bsl 64), {Api, Data}}. - -crypto_uniform_n(N, {Api, Data0}) when N < (1 bsl 64) -> - {Int, Data} = crypto_next(Data0), - {(Int rem N)+1, {Api, Data}}; -crypto_uniform_n(N, State0) -> - {F,State} = crypto_uniform(State0), - {trunc(F * N) + 1, State}. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% Not a test but measures the time characteristics of the different algorithms -measure(Suite) when is_atom(Suite) -> []; -measure(_Config) -> - Algos = [crypto64|algs()], - io:format("RNG uniform integer performance~n",[]), - _ = measure_1(random, fun(State) -> {int, random:uniform_s(10000, State)} end), - _ = [measure_1(Algo, fun(State) -> {int, rand:uniform_s(10000, State)} end) || Algo <- Algos], - io:format("RNG uniform float performance~n",[]), - _ = measure_1(random, fun(State) -> {uniform, random:uniform_s(State)} end), - _ = [measure_1(Algo, fun(State) -> {uniform, rand:uniform_s(State)} end) || Algo <- Algos], - io:format("RNG normal float performance~n",[]), - io:format("~.10w: not implemented (too few bits)~n", [random]), - _ = [measure_1(Algo, fun(State) -> {normal, rand:normal_s(State)} end) || Algo <- Algos], - ok. - -measure_1(Algo, Gen) -> - Parent = self(), - Seed = fun(crypto64) -> crypto_seed(); - (random) -> random:seed(os:timestamp()), get(random_seed); - (Alg) -> rand:seed_s(Alg) - end, - - Pid = spawn_link(fun() -> - Fun = fun() -> measure_2(?LOOP, Seed(Algo), Gen) end, - {Time, ok} = timer:tc(Fun), - io:format("~.10w: ~pµs~n", [Algo, Time]), - Parent ! {self(), ok}, - normal - end), - receive - {Pid, Msg} -> Msg - end. - -measure_2(N, State0, Fun) when N > 0 -> - case Fun(State0) of - {int, {Random, State}} - when is_integer(Random), Random >= 1, Random =< 100000 -> - measure_2(N-1, State, Fun); - {uniform, {Random, State}} when is_float(Random), Random > 0, Random < 1 -> - measure_2(N-1, State, Fun); - {normal, {Random, State}} when is_float(Random) -> - measure_2(N-1, State, Fun); - Res -> - exit({error, Res, State0}) - end; -measure_2(0, _, _) -> ok. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Data -reference_val(exs64) -> - [16#3737ad0c703ff6c3,16#3868a78fe71adbbd,16#1f01b62b4338b605,16#50876a917437965f, - 16#b2edfe32a10e27fc,16#995924551d8ebae1,16#9f1e6b94e94e0b58,16#27ec029eb0e94f8e, - 16#bf654e6df7fe5c,16#b7d5ef7b79be65e3,16#4bdba4d1c159126b,16#a9c816fdc701292c, - 16#a377b6c89d85ac8b,16#7abb5cd0e5847a6,16#62666f1fc00a0a90,16#1edc3c3d255a8113, - 16#dfc764073767f18e,16#381783d577ca4e34,16#49693588c085ddcb,16#da6fcb16dd5163f3, - 16#e2357a703475b1b7,16#aaa84c4924b5985a,16#b8fe07bb2bac1e49,16#23973ac0160ff064, - 16#1afbc7b023f5d618,16#9f510f7b7caa2a0f,16#d5b0a57f7f5f1084,16#d8c49b66c5f99a29, - 16#e920ac3b598b5213,16#1090d7e27e7a7c76,16#81171917168ee74f,16#f08489a3eb6988e, - 16#396260c4f0b2ed46,16#4fd0a6a6caefd5b2,16#423dff07a3b888a,16#12718773ebd99987, - 16#e50991e540807cb,16#8cfa03bbaa6679d6,16#55bdf86dfbb92dbf,16#eb7145378cce74a8, - 16#71856c224c846595,16#20461588dae6e24d,16#c73b3e63ced74bac,16#775b11813dda0c78, - 16#91f358e51068ede0,16#399955ef36766bc2,16#4489ee072e8a38b1,16#ba77759d52321ca0, - 16#14f519eab5c53db8,16#1f754bd08e4f34c4,16#99e25ca29b2fcfeb,16#da11927c0d9837f8, - 16#1eeb0f87009f5a87,16#a7c444d3b0db1089,16#49c7fbf0714849ad,16#4f2b693e7f8265cb, - 16#80e1493cbaa8f256,16#186f345bcac2661e,16#330065ae0c698d26,16#5235ed0432c42e93, - 16#429792e31ddb10bb,16#8769054bb6533cff,16#1ab382483444201f,16#2216368786fc7b9, - 16#1efea1155216da0b,16#782dc868ba595452,16#2b80f6d159617f48,16#407fc35121b2fa1b, - 16#90e8be6e618873d1,16#40ad4ec92a8abf8e,16#34e2890f583f435,16#838c0aef0a5d8427, - 16#ed4238f4bd6cbcfa,16#7feed11f7a8bb9f0,16#2b0636a93e26c89d,16#481ad4bea5180646, - 16#673e5ad861afe1cc,16#298eeb519d69e74d,16#eb1dd06d168c856,16#4770651519ee7ef9, - 16#7456ebf1bcf608f1,16#d6200f6fbd61ce05,16#c0695dfab11ab6aa,16#5bff449249983843, - 16#7aba88471474c9ac,16#d7e9e4a21c989e91,16#c5e02ee67ccb7ce1,16#4ea8a3a912246153, - 16#f2e6db7c9ce4ec43,16#39498a95d46d2470,16#c5294fcb8cce8aa9,16#a918fe444719f3dc, - 16#98225f754762c0c0,16#f0721204f2cb43f5,16#b98e77b099d1f2d1,16#691d6f75aee3386, - 16#860c7b2354ec24fd,16#33e007bd0fbcb609,16#7170ae9c20fb3d0,16#31d46938fe383a60]; - -reference_val(exs1024) -> - [16#9c61311d0d4a01fd,16#ce963ef5803b703e,16#545dcffb7b644e1a,16#edd56576a8d778d5, - 16#16bee799783c6b45,16#336f0b3caeb417fa,16#29291b8be26dedfa,16#1efed996d2e1b1a8, - 16#c5c04757bd2dadf9,16#11aa6d194009c616,16#ab2b3e82bdb38a91,16#5011ee46fd2609eb, - 16#766db7e5b701a9bb,16#d42cb2632c419f35,16#107c6a2667bf8557,16#3ffbf922cb306967, - 16#1e71e3d024ac5131,16#6fdb368ec67a5f06,16#b0d8e72e7aa6d1c1,16#e5705a02dae89e3b, - 16#9c24eb68c086a1d3,16#418de330f55f71f0,16#2917ddeb278bc8d2,16#aeba7fba67208f39, - 16#10ceaf40f6af1d8d,16#47a6d06811d33132,16#603a661d6caf720a,16#a28bd0c9bcdacb3c, - 16#f44754f006909762,16#6e25e8e67ccc43bc,16#174378ce374a549e,16#b5598ae9f57c4e50, - 16#ca85807fbcd51dd,16#1816e58d6c3cc32a,16#1b4d630d3c8e96a6,16#c19b1e92b4efc5bd, - 16#665597b20ddd721a,16#fdab4eb21b75c0ae,16#86a612dcfea0756c,16#8fc2da192f9a55f0, - 16#d7c954eb1af31b5,16#6f5ee45b1b80101b,16#ebe8ea4e5a67cbf5,16#1cb952026b4c1400, - 16#44e62caffe7452c0,16#b591d8f3e6d7cbcf,16#250303f8d77b6f81,16#8ef2199aae4c9b8d, - 16#a16baa37a14d7b89,16#c006e4d2b2da158b,16#e6ec7abd54c93b31,16#e6b0d79ae2ab6fa7, - 16#93e4b30e4ab7d4cd,16#42a01b6a4ef63033,16#9ab1e94fe94976e,16#426644e1de302a1f, - 16#8e58569192200139,16#744f014a090107c1,16#15d056801d467c6c,16#51bdad3a8c30225f, - 16#abfc61fb3104bd45,16#c610607122272df7,16#905e67c63116ebfc,16#1e4fd5f443bdc18, - 16#1945d1745bc55a4c,16#f7cd2b18989595bb,16#f0d273b2c646a038,16#ee9a6fdc6fd5d734, - 16#541a518bdb700518,16#6e67ab9a65361d76,16#bcfadc9bfe5b2e06,16#69fa334cf3c11496, - 16#9657df3e0395b631,16#fc0d0442160108ec,16#2ee538da7b1f7209,16#8b20c9fae50a5a9e, - 16#a971a4b5c2b3b6a,16#ff6241e32489438e,16#8fd6433f45255777,16#6e6c82f10818b0dc, - 16#59a8fad3f6af616b,16#7eac34f43f12221c,16#6e429ec2951723ec,16#9a65179767a45c37, - 16#a5f8127d1e6fdf35,16#932c50bc633d8d5c,16#f3bbea4e7ebecb8,16#efc3a2bbf6a8674, - 16#451644a99971cb6,16#cf70776d652c150d,16#c1fe0dcb87a25403,16#9523417132b2452e, - 16#8f98bc30d06b980e,16#bb4b288ecb8daa9a,16#59e54beb32f78045,16#f9ab1562456b9d66, - 16#6435f4130304a793,16#b4bb94c2002e1849,16#49a86d1e4bade982,16#457d63d60ed52b95]; - -reference_val(exsplus) -> - [16#bc76c2e638db,16#15ede2ebb16c9fb,16#185ee2c27d6b88d,16#15d5ee9feafc3a5, - 16#1862e91dfce3e6b,16#2c9744b0fb69e46,16#78b21bc01cef6b,16#2d16a2fae6c76ba, - 16#13dfccb8ff86bce,16#1d9474c59e23f4d,16#d2f67dcd7f0dd6,16#2b6d489d51a0725, - 16#1fa52ef484861d8,16#1ae9e2a38f966d4,16#2264ab1e193acca,16#23bbca085039a05, - 16#2b6eea06a0af0e1,16#3ad47fa8866ea20,16#1ec2802d612d855,16#36c1982b134d50, - 16#296b6a23f5b75e0,16#c5eeb600a9875c,16#2a3fd51d735f9d4,16#56fafa3593a070, - 16#13e9d416ec0423e,16#28101a91b23e9dc,16#32e561eb55ce15a,16#94a7dbba66fe4a, - 16#2e1845043bcec1f,16#235f7513a1b5146,16#e37af1bf2d63cb,16#2048033824a1639, - 16#c255c750995f7,16#2c7542058e89ee3,16#204dfeefbdb62ba,16#f5a936ec63dd66, - 16#33b3b7dbbbd8b90,16#c4f0f79026ffe9,16#20ffee2d37aca13,16#2274f931716be2c, - 16#29b883902ba9df1,16#1a838cd5312717f,16#2edfc49ff3dc1d6,16#418145cbec84c2, - 16#d2d8f1a17d49f,16#d41637bfa4cc6f,16#24437e03a0f5df8,16#3d1d87919b94a90, - 16#20d6997b36769b6,16#16f9d7855cd87ca,16#821ef7e2a062a3,16#2c4d11dc4a2da70, - 16#24a3b27f56ed26b,16#144b23c8b97387a,16#34a2ced56930d12,16#21cc0544113a017, - 16#3e780771f634fb2,16#146c259c02e7e18,16#1d99e4cfad0ef1,16#fdf3dabefc6b3a, - 16#7d0806e4d12dfb,16#3e3ae3580532eae,16#2456544200fbd86,16#f83aad4e88db85, - 16#37c134779463b4d,16#21a20bf64b6e735,16#1c0585ac88b69f2,16#1b3fcea8dd30e56, - 16#334bc301aefd97,16#37066eb7e80a946,16#15a19a6331b570f,16#35e67fa43c3f7d0, - 16#152a4020145fb80,16#8d55139491dfbe,16#21d9cba585c059d,16#31475f363654635, - 16#2567b17acb7a104,16#39201be3a7681c5,16#6bc675fd26b601,16#334b93232b1b1e3, - 16#357c402cb732c6a,16#362e32efe4db46a,16#8edc7ae3da51e5,16#31573376785eac9, - 16#6c6145ffa1169d,16#18ec2c393d45359,16#1f1a5f256e7130c,16#131cc2f49b8004f, - 16#36f715a249f4ec2,16#1c27629826c50d3,16#914d9a6648726a,16#27f5bf5ce2301e8, - 16#3dd493b8012970f,16#be13bed1e00e5c,16#ceef033b74ae10,16#3da38c6a50abe03, - 16#15cbd1a421c7a8c,16#22794e3ec6ef3b1,16#26154d26e7ea99f,16#3a66681359a6ab6]. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/re_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/re_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/re_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/re_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -28,7 +27,7 @@ pcre_compile_workspace_overflow/1,re_infinite_loop/1, re_backwards_accented/1,opt_dupnames/1,opt_all_names/1,inspect/1, opt_no_start_optimize/1,opt_never_utf/1,opt_ucp/1, - match_limit/1,sub_binaries/1,copt/1]). + match_limit/1,sub_binaries/1]). -include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). @@ -319,26 +318,32 @@ ["Tests return options of replace together with global searching"]; replace_return(Config) when is_list(Config) -> Dog = ?t:timetrap(?t:minutes(3)), - {'EXIT',{badarg,_}} = (catch re:replace("na","(a","")), - ok = replacetest(<<"nisse">>,"i","a",[{return,binary}],<<"nasse">>), - ok = replacetest("ABC\305abcdABCabcdA","a(?bcd)","X",[global,{return,binary}],<<"ABCÅXABCXA">>), - ok = replacetest("ABCÅabcdABCabcdA","a(?bcd)","X",[global,{return,iodata}],[<<"ABCÅ">>,<<"X">>,<<"ABC">>,<<"X">>|<<"A">>]), - ok = replacetest("ABCÅabcdABCabcdA","a(?bcd)","X",[global,{return,list},unicode],"ABCÅXABCXA"), - ok = replacetest("ABCÅabcdABCabcdA","a(?bcd)","X",[global,{return,binary},unicode],<<65,66,67,195,133,88,65,66,67,88,65>>), - ok = replacetest("ABCÅabcdABCabcdA","a(?bcd)","X",[{return,binary},unicode],<<65,66,67,195,133,88,65,66,67,97,98,99,100,65>>), - ok = replacetest("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\9X",[{return,binary}],<<"iXk">>), - ok = replacetest("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\10X",[{return,binary}],<<"jXk">>), - ok = replacetest("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\11X",[{return,binary}],<<"Xk">>), - ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g9X",[{return,binary}],<<"9X1">>), - ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g10X",[{return,binary}],<<"0X1">>), - ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g11X",[{return,binary}],<<"X1">>), - ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{9}7",[{return,binary}],<<"971">>), - ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{10}7",[{return,binary}],<<"071">>), - ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{11}7",[{return,binary}],<<"71">>), - ok = replacetest("a\x{400}bcd","d","X",[global,{return,list},unicode],"a\x{400}bcX"), - ok = replacetest("a\x{400}bcd","d","X",[global,{return,binary},unicode],<<"a",208,128,"bcX">>), - ok = replacetest("a\x{400}bcd","Z","X",[global,{return,list},unicode],"a\x{400}bcd"), - ok = replacetest("a\x{400}bcd","Z","X",[global,{return,binary},unicode],<<"a",208,128,"bcd">>), + ?line {'EXIT',{badarg,_}} = (catch re:replace("na","(a","")), + ?line <<"nasse">> = re:replace(<<"nisse">>,"i","a",[{return,binary}]), + ?line <<"ABCÅXABCXA">> = re:replace("ABC\305abcdABCabcdA","a(?bcd)","X",[global,{return,binary}]), + + ?line [<<"ABCÅ">>, + <<"X">>, + <<"ABC">>, + <<"X">> | + <<"A">> ] = + re:replace("ABCÅabcdABCabcdA","a(?bcd)","X",[global,{return,iodata}]), + ?line "ABCÅXABCXA" = re:replace("ABCÅabcdABCabcdA","a(?bcd)","X",[global,{return,list},unicode]), + ?line <<65,66,67,195,133,88,65,66,67,88,65>> = re:replace("ABCÅabcdABCabcdA","a(?bcd)","X",[global,{return,binary},unicode]), + ?line <<65,66,67,195,133,88,65,66,67,97,98,99,100,65>> = re:replace("ABCÅabcdABCabcdA","a(?bcd)","X",[{return,binary},unicode]), + ?line <<"iXk">> = re:replace("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\9X",[{return,binary}]), + ?line <<"jXk">> = re:replace("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\10X",[{return,binary}]), + ?line <<"Xk">> = re:replace("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\11X",[{return,binary}]), + ?line <<"9X1">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g9X",[{return,binary}]), + ?line <<"0X1">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g10X",[{return,binary}]), + ?line <<"X1">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g11X",[{return,binary}]), + ?line <<"971">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{9}7",[{return,binary}]), + ?line <<"071">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{10}7",[{return,binary}]), + ?line <<"71">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{11}7",[{return,binary}]), + ?line "a\x{400}bcX" = re:replace("a\x{400}bcd","d","X",[global,{return,list},unicode]), + ?line <<"a",208,128,"bcX">> = re:replace("a\x{400}bcd","d","X",[global,{return,binary},unicode]), + ?line "a\x{400}bcd" = re:replace("a\x{400}bcd","Z","X",[global,{return,list},unicode]), + ?line <<"a",208,128,"bcd">> = re:replace("a\x{400}bcd","Z","X",[global,{return,binary},unicode]), ?t:timetrap_cancel(Dog), ok. @@ -383,35 +388,6 @@ error end. -replacetest(Subject,RE,Replacement,Options,Result) -> - Result = re:replace(Subject,RE,Replacement,Options), - {CompileOptions,ReplaceOptions} = lists:partition(fun copt/1, Options), - {ok,MP} = re:compile(RE,CompileOptions), - Result = re:replace(Subject,MP,Replacement,ReplaceOptions), - ok. - -splittest(Subject,RE,Options,Result) -> - Result = re:split(Subject,RE,Options), - {CompileOptions,SplitOptions} = lists:partition(fun copt/1, Options), - {ok,MP} = re:compile(RE,CompileOptions), - Result = re:split(Subject,MP,SplitOptions), - ok. - -copt(caseless) -> true; -copt(no_start_optimize) -> true; -copt(never_utf) -> true; -copt(ucp) -> true; -copt(dollar_endonly) -> true; -copt(dotall) -> true; -copt(extended) -> true; -copt(firstline) -> true; -copt(multiline) -> true; -copt(no_auto_capture) -> true; -copt(dupnames) -> true; -copt(ungreedy) -> true; -copt(unicode) -> true; -copt(_) -> false. - split_autogen(doc) -> ["Test split with autogenerated erlang module"]; split_autogen(Config) when is_list(Config) -> @@ -424,23 +400,43 @@ ["Test special options to split."]; split_options(Config) when is_list(Config) -> Dog = ?t:timetrap(?t:minutes(1)), - ok = splittest("a b c ","( )",[group,trim],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]]), - ok = splittest("a b c ","( )",[group,{parts,0}],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]]), - ok = splittest("a b c ","( )",[{parts,infinity},group],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<>>]]), - ok = splittest("a b c ","( )",[group],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<>>]]), - ok = splittest(" a b c d ","( +)",[group,trim],[[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<"d">>,<<" ">>]]), - ok = splittest(" a b c d ","( +)",[{parts,0},group],[[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<"d">>,<<" ">>]]), - ok = splittest(" a b c d ","( +)",[{parts,infinity},group],[[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<"d">>,<<" ">>],[<<>>]]), - ok = splittest("a b c d","( +)",[{parts,2},group],[[<<"a">>,<<" ">>],[<<"b c d">>]]), - ok = splittest([967]++" b c d","( +)",[{parts,2},group,{return,list},unicode],[[[967]," "],["b c d"]]), - ok = splittest([967]++" b c d","( +)",[{parts,2},group,{return,binary},unicode],[[<<207,135>>,<<" ">>],[<<"b c d">>]]), - {'EXIT',{badarg,_}} = (catch re:split([967]++" b c d","( +)",[{parts,2},group,{return,binary}])), - {'EXIT',{badarg,_}} = (catch re:split("a b c d","( +)",[{parts,-2}])), - {'EXIT',{badarg,_}} = (catch re:split("a b c d","( +)",[{parts,banan}])), - {'EXIT',{badarg,_}} = (catch re:split("a b c d","( +)",[{capture,all}])), - {'EXIT',{badarg,_}} = (catch re:split("a b c d","( +)",[{capture,[],binary}])), + ?line [[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]] = re:split("a b c ","( )",[group,trim]), + ?line [[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]] = re:split("a b c ","( )",[group,{parts,0}]), + ?line [[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<>>]] = + re:split("a b c ","( )",[{parts,infinity},group]), + ?line [[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<>>]] = + re:split("a b c ","( )",[group]), + ?line [[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>], + [<<"c">>,<<" ">>],[<<"d">>,<<" ">>]] = + re:split(" a b c d ","( +)",[group,trim]), + ?line [[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>], + [<<"c">>,<<" ">>],[<<"d">>,<<" ">>]] = + re:split(" a b c d ","( +)",[{parts,0},group]), + ?line [[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>], + [<<"c">>,<<" ">>],[<<"d">>,<<" ">>],[<<>>]] = + re:split(" a b c d ","( +)",[{parts,infinity},group]), + ?line [[<<"a">>,<<" ">>],[<<"b c d">>]] = + re:split("a b c d","( +)",[{parts,2},group]), + ?line [[[967]," "],["b c d"]] = + re:split([967]++" b c d","( +)", + [{parts,2},group,{return,list},unicode]), + ?line [[<<207,135>>,<<" ">>],[<<"b c d">>]] = + re:split([967]++" b c d","( +)", + [{parts,2},group,{return,binary},unicode]), + ?line {'EXIT',{badarg,_}} = + (catch re:split([967]++" b c d","( +)", + [{parts,2},group,{return,binary}])), + ?line {'EXIT',{badarg,_}} = + (catch re:split("a b c d","( +)",[{parts,-2}])), + ?line {'EXIT',{badarg,_}} = + (catch re:split("a b c d","( +)",[{parts,banan}])), + ?line {'EXIT',{badarg,_}} = + (catch re:split("a b c d","( +)",[{capture,all}])), + ?line {'EXIT',{badarg,_}} = + (catch re:split("a b c d","( +)",[{capture,[],binary}])), % Parts 0 is equal to no parts specification (implicit strip) - ok = splittest("a b c d","( *)",[{parts,0},{return,list}],["a"," ","b"," ","c"," ","d"]), + ?line ["a"," ","b"," ","c"," ","d"] = + re:split("a b c d","( *)",[{parts,0},{return,list}]), ?t:timetrap_cancel(Dog), ok. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/re_testoutput1_replacement_test.erl erlang-17.3-dfsg/lib/stdlib/test/re_testoutput1_replacement_test.erl --- erlang-18.2-dfsg/lib/stdlib/test/re_testoutput1_replacement_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/re_testoutput1_replacement_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/re_testoutput1_split_test.erl erlang-17.3-dfsg/lib/stdlib/test/re_testoutput1_split_test.erl --- erlang-18.2-dfsg/lib/stdlib/test/re_testoutput1_split_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/re_testoutput1_split_test.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/run_pcre_tests.erl erlang-17.3-dfsg/lib/stdlib/test/run_pcre_tests.erl --- erlang-18.2-dfsg/lib/stdlib/test/run_pcre_tests.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/run_pcre_tests.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/select_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/select_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/select_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/select_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -212,7 +211,7 @@ {ok,[X]} -> X; _ -> - {A,B,C} = erlang:timestamp(), + {A,B,C} = erlang:now(), random:seed(A,B,C), get(random_seed) end, diff -Nru erlang-18.2-dfsg/lib/stdlib/test/sets_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/sets_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/sets_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/sets_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -29,7 +28,7 @@ create/1,add_element/1,del_element/1, subtract/1,intersection/1,union/1,is_subset/1, is_set/1,fold/1,filter/1, - take_smallest/1,take_largest/1, iterate/1]). + take_smallest/1,take_largest/1]). -include_lib("test_server/include/test_server.hrl"). @@ -49,7 +48,7 @@ all() -> [create, add_element, del_element, subtract, intersection, union, is_subset, is_set, fold, filter, - take_smallest, take_largest, iterate]. + take_smallest, take_largest]. groups() -> []. @@ -427,44 +426,6 @@ take_largest_3(S, List, M) end. -iterate(Config) when is_list(Config) -> - test_all(fun iterate_1/1). - -iterate_1(M) -> - case M(module, []) of - gb_sets -> iterate_2(M); - _ -> ok - end, - M(empty, []). - -iterate_2(M) -> - random:seed(1, 2, 42), - iter_set(M, 1000). - -iter_set(_M, 0) -> - ok; -iter_set(M, N) -> - L = [I || I <- lists:seq(1, N)], - T = M(from_list, L), - L = lists:reverse(iterate_set(M, T)), - R = random:uniform(N), - S = lists:reverse(iterate_set(M, R, T)), - S = [E || E <- L, E >= R], - iter_set(M, N-1). - -iterate_set(M, Set) -> - I = M(iterator, Set), - iterate_set_1(M, M(next, I), []). - -iterate_set(M, Start, Set) -> - I = M(iterator_from, {Start, Set}), - iterate_set_1(M, M(next, I), []). - -iterate_set_1(_, none, R) -> - R; -iterate_set_1(M, {E, I}, R) -> - iterate_set_1(M, M(next, I), [E | R]). - %%% %%% Helper functions. %%% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/sets_test_lib.erl erlang-17.3-dfsg/lib/stdlib/test/sets_test_lib.erl --- erlang-18.2-dfsg/lib/stdlib/test/sets_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/sets_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -35,10 +34,7 @@ (is_empty, S) -> is_empty(Mod, S); (is_set, S) -> Mod:is_set(S); (is_subset, {S,Set}) -> is_subset(Mod, Eq, S, Set); - (iterator, S) -> Mod:iterator(S); - (iterator_from, {Start, S}) -> Mod:iterator_from(Start, S); (module, []) -> Mod; - (next, I) -> Mod:next(I); (singleton, E) -> singleton(Mod, E); (size, S) -> Mod:size(S); (subtract, {S1,S2}) -> subtract(Mod, S1, S2); diff -Nru erlang-18.2-dfsg/lib/stdlib/test/shell_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/shell_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/shell_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/shell_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2015. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -405,14 +404,13 @@ ?line ok = file:write_file(Test, Contents), RR5 = "rr(\"" ++ Test ++ "\", '_', {d,test1}), rl([test1,test2]).", - A1 = erl_anno:new(1), - [{attribute,A1,record,{test1,_}},ok] = scan(RR5), + ?line [{attribute,1,record,{test1,_}},ok] = scan(RR5), RR6 = "rr(\"" ++ Test ++ "\", '_', {d,test2}), rl([test1,test2]).", - [{attribute,A1,record,{test2,_}},ok] = scan(RR6), + ?line [{attribute,1,record,{test2,_}},ok] = scan(RR6), RR7 = "rr(\"" ++ Test ++ "\", '_', [{d,test1},{d,test2,17}]), rl([test1,test2]).", - [{attribute,A1,record,{test1,_}},{attribute,A1,record,{test2,_}},ok] = - scan(RR7), + ?line [{attribute,1,record,{test1,_}},{attribute,1,record,{test2,_}}, + ok] = scan(RR7), ?line PreReply = scan(<<"rr(prim_file).">>), % preloaded... ?line true = is_list(PreReply), ?line Dir = filename:join(?config(priv_dir, Config), "*.erl"), diff -Nru erlang-18.2-dfsg/lib/stdlib/test/slave_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/slave_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/slave_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/slave_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/sofs_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/sofs_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/sofs_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/sofs_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2001-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/stdlib_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/stdlib_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/stdlib_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/stdlib_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,7 +22,14 @@ -module(stdlib_SUITE). -include_lib("test_server/include/test_server.hrl"). --compile(export_all). + +% Test server specific exports +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). + +% Test cases must be exported. +-export([app_test/1, appup_test/1]). %% %% all/1 @@ -31,10 +37,10 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [app_test, appup_test, assert_test, {group,upgrade}]. + [app_test, appup_test]. groups() -> - [{upgrade,[minor_upgrade,major_upgrade]}]. + []. init_per_suite(Config) -> Config. @@ -42,13 +48,9 @@ end_per_suite(_Config) -> ok. -init_per_group(upgrade, Config) -> - ct_release_test:init(Config); init_per_group(_GroupName, Config) -> Config. -end_per_group(upgrade, Config) -> - ct_release_test:cleanup(Config); end_per_group(_GroupName, Config) -> Config. @@ -76,29 +78,17 @@ appup_tests(_App,{[],[]}) -> {skip,"no previous releases available"}; -appup_tests(App,{OkVsns0,NokVsns}) -> +appup_tests(App,{OkVsns,NokVsns}) -> application:load(App), {_,_,Vsn} = lists:keyfind(App,1,application:loaded_applications()), AppupFileName = atom_to_list(App) ++ ".appup", AppupFile = filename:join([code:lib_dir(App),ebin,AppupFileName]), {ok,[{Vsn,UpFrom,DownTo}=AppupScript]} = file:consult(AppupFile), ct:log("~p~n",[AppupScript]), - OkVsns = - case OkVsns0 -- [Vsn] of - OkVsns0 -> - OkVsns0; - Ok -> - ct:log("Current version, ~p, is same as in previous release.~n" - "Removing this from the list of ok versions.", - [Vsn]), - Ok - end, - ct:log("Testing that appup allows upgrade from these versions: ~p~n", - [OkVsns]), + ct:log("Testing ok versions: ~p~n",[OkVsns]), check_appup(OkVsns,UpFrom,{ok,[restart_new_emulator]}), check_appup(OkVsns,DownTo,{ok,[restart_new_emulator]}), - ct:log("Testing that appup does not allow upgrade from these versions: ~p~n", - [NokVsns]), + ct:log("Testing not ok versions: ~p~n",[NokVsns]), check_appup(NokVsns,UpFrom,error), check_appup(NokVsns,DownTo,error), ok. @@ -163,91 +153,3 @@ end; check_appup([],_,_) -> ok. - - -minor_upgrade(Config) -> - ct_release_test:upgrade(stdlib,minor,{?MODULE,[]},Config). - -major_upgrade(Config) -> - ct_release_test:upgrade(stdlib,major,{?MODULE,[]},Config). - -%% Version numbers are checked by ct_release_test, so there is nothing -%% more to check here... -upgrade_init(CtData,State) -> - {ok,{FromVsn,ToVsn}} = ct_release_test:get_app_vsns(CtData,stdlib), - case ct_release_test:get_appup(CtData,stdlib) of - {ok,{FromVsn,ToVsn,[restart_new_emulator],[restart_new_emulator]}} -> - io:format("Upgrade/downgrade ~p <--> ~p",[FromVsn,ToVsn]); - {error,{vsn_not_found,_}} when FromVsn==ToVsn -> - io:format("No upgrade test for stdlib, same version") - end, - State. -upgrade_upgraded(_CtData,State) -> - State. -upgrade_downgraded(_CtData,State) -> - State. - - --include_lib("stdlib/include/assert.hrl"). --include_lib("stdlib/include/assert.hrl"). % test repeated inclusion -assert_test(suite) -> - []; -assert_test(doc) -> - ["Assert macros test."]; -assert_test(_Config) -> - ok = ?assert(true), - {'EXIT',{{assert, _},_}} = (catch ?assert(false)), - {'EXIT',{{assert, Info1},_}} = (catch ?assert(0)), - {not_boolean,0} = lists:keyfind(not_boolean,1,Info1), - - ok = ?assertNot(false), - {'EXIT',{{assert, _},_}} = (catch ?assertNot(true)), - {'EXIT',{{assert, Info2},_}} = (catch ?assertNot(0)), - {not_boolean,0} = lists:keyfind(not_boolean,1,Info2), - - ok = ?assertMatch({foo,_}, {foo,bar}), - {'EXIT',{{assertMatch,_},_}} = - (catch ?assertMatch({foo,_}, {foo})), - - ok = ?assertMatch({foo,N} when N > 0, {foo,1}), - {'EXIT',{{assertMatch,_},_}} = - (catch ?assertMatch({foo,N} when N > 0, {foo,0})), - - ok = ?assertNotMatch({foo,_}, {foo,bar,baz}), - {'EXIT',{{assertNotMatch,_},_}} = - (catch ?assertNotMatch({foo,_}, {foo,baz})), - - ok = ?assertNotMatch({foo,N} when N > 0, {foo,0}), - {'EXIT',{{assertNotMatch,_},_}} = - (catch ?assertNotMatch({foo,N} when N > 0, {foo,1})), - - ok = ?assertEqual(1.0, 1.0), - {'EXIT',{{assertEqual,_},_}} = (catch ?assertEqual(1, 1.0)), - - ok = ?assertNotEqual(1, 1.0), - {'EXIT',{{assertNotEqual,_},_}} = (catch ?assertNotEqual(1.0, 1.0)), - - ok = ?assertException(error, badarith, 1/0), - ok = ?assertException(exit, foo, exit(foo)), - ok = ?assertException(throw, foo, throw(foo)), - ok = ?assertException(throw, {foo,_}, throw({foo,bar})), - ok = ?assertException(throw, {foo,N} when N > 0, throw({foo,1})), - {'EXIT',{{assertException,Why1},_}} = - (catch ?assertException(error, badarith, 0/1)), - true = lists:keymember(unexpected_success,1,Why1), - {'EXIT',{{assertException,Why2},_}} = - (catch ?assertException(error, badarith, 1/length(0))), - true = lists:keymember(unexpected_exception,1,Why2), - {'EXIT',{{assertException,Why3},_}} = - (catch ?assertException(throw, {foo,N} when N > 0, throw({foo,0}))), - true = lists:keymember(unexpected_exception,1,Why3), - - ok = ?assertNotException(throw, {foo,baz}, throw({foo,bar})), - {'EXIT',{{assertNotException,Why4},_}} = - (catch ?assertNotException(throw, {foo,bar}, throw({foo,bar}))), - true = lists:keymember(unexpected_exception,1,Why4), - - ok = ?assertError(badarith, 1/0), - ok = ?assertExit(foo, exit(foo)), - ok = ?assertThrow(foo, throw(foo)), - ok. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/string_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/string_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/string_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/string_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -121,7 +120,7 @@ chr_rchr(doc) -> []; chr_rchr(Config) when is_list(Config) -> - {_,_,X} = erlang:timestamp(), + ?line {_,_,X} = now(), ?line 0 = string:chr("", (X rem (255-32)) + 32), ?line 0 = string:rchr("", (X rem (255-32)) + 32), ?line 1 = string:chr("x", $x), @@ -145,7 +144,7 @@ str_rstr(doc) -> []; str_rstr(Config) when is_list(Config) -> - {_,_,X} = erlang:timestamp(), + ?line {_,_,X} = now(), ?line 0 = string:str("", [(X rem (255-32)) + 32]), ?line 0 = string:rstr("", [(X rem (255-32)) + 32]), ?line 1 = string:str("x", "x"), @@ -218,39 +217,21 @@ ?line {'EXIT',_} = (catch string:substr("1234", "1")), ok. +tokens(suite) -> + []; +tokens(doc) -> + []; tokens(Config) when is_list(Config) -> - [] = string:tokens("",""), - [] = string:tokens("abc","abc"), - ["abc"] = string:tokens("abc", ""), - ["1","2 34","45","5","6","7"] = do_tokens("1,2 34,45;5,;6;,7", ";,"), - - %% invalid arg type - {'EXIT',_} = (catch string:tokens('x,y', ",")), - {'EXIT',_} = (catch string:tokens("x,y", ',')), - ok. - -do_tokens(S0, Sep0) -> - [H|T] = Sep0, - S = [replace_sep(C, T, H) || C <- S0], - Sep = [H], - io:format("~p ~p\n", [S0,Sep0]), - io:format("~p ~p\n", [S,Sep]), - - Res = string:tokens(S0, Sep0), - Res = string:tokens(Sep0++S0, Sep0), - Res = string:tokens(S0++Sep0, Sep0), - - Res = string:tokens(S, Sep), - Res = string:tokens(Sep++S, Sep), - Res = string:tokens(S++Sep, Sep), - - Res. - -replace_sep(C, Seps, New) -> - case lists:member(C, Seps) of - true -> New; - false -> C - end. + ?line [] = string:tokens("",""), + ?line [] = string:tokens("abc","abc"), + ?line ["abc"] = string:tokens("abc", ""), + ?line ["1","2 34","4","5"] = string:tokens("1,2 34,4;5", ";,"), + %% invalid arg type + ?line {'EXIT',_} = (catch string:tokens('x,y', ",")), + %% invalid arg type + ?line {'EXIT',_} = (catch string:tokens("x,y", ',')), + ok. + chars(suite) -> []; diff -Nru erlang-18.2-dfsg/lib/stdlib/test/supervisor_1.erl erlang-17.3-dfsg/lib/stdlib/test/supervisor_1.erl --- erlang-18.2-dfsg/lib/stdlib/test/supervisor_1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/supervisor_1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/supervisor_2.erl erlang-17.3-dfsg/lib/stdlib/test/supervisor_2.erl --- erlang-18.2-dfsg/lib/stdlib/test/supervisor_2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/supervisor_2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/supervisor_3.erl erlang-17.3-dfsg/lib/stdlib/test/supervisor_3.erl --- erlang-18.2-dfsg/lib/stdlib/test/supervisor_3.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/supervisor_3.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/supervisor_bridge_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/supervisor_bridge_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/supervisor_bridge_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/supervisor_bridge_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/supervisor_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/supervisor_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/supervisor_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/supervisor_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -38,13 +37,9 @@ sup_start_ignore_child/1, sup_start_ignore_temporary_child/1, sup_start_ignore_temporary_child_start_child/1, sup_start_ignore_temporary_child_start_child_simple/1, - sup_start_ignore_permanent_child_start_child_simple/1, - sup_start_error_return/1, sup_start_fail/1, - sup_start_map/1, sup_start_map_simple/1, - sup_start_map_faulty_specs/1, - sup_stop_infinity/1, sup_stop_timeout/1, sup_stop_brutal_kill/1, - child_adm/1, child_adm_simple/1, child_specs/1, extra_return/1, - sup_flags/1]). + sup_start_error_return/1, sup_start_fail/1, sup_stop_infinity/1, + sup_stop_timeout/1, sup_stop_brutal_kill/1, child_adm/1, + child_adm_simple/1, child_specs/1, extra_return/1]). %% Tests concept permanent, transient and temporary -export([ permanent_normal/1, transient_normal/1, @@ -56,8 +51,7 @@ temporary_abnormal/1, temporary_bystander/1]). %% Restart strategy tests --export([ multiple_restarts/1, - one_for_one/1, +-export([ one_for_one/1, one_for_one_escalation/1, one_for_all/1, one_for_all_escalation/1, one_for_all_other_child_fails_restart/1, simple_one_for_one/1, simple_one_for_one_escalation/1, @@ -71,8 +65,7 @@ do_not_save_child_specs_for_temporary_children/1, simple_one_for_one_scale_many_temporary_children/1, simple_global_supervisor/1, hanging_restart_loop/1, - hanging_restart_loop_simple/1, code_change/1, code_change_map/1, - code_change_simple/1, code_change_simple_map/1]). + hanging_restart_loop_simple/1]). %%------------------------------------------------------------------------- @@ -80,9 +73,8 @@ [{ct_hooks,[ts_install_cth]}]. all() -> - [{group, sup_start}, {group, sup_start_map}, {group, sup_stop}, child_adm, - child_adm_simple, extra_return, child_specs, sup_flags, - multiple_restarts, + [{group, sup_start}, {group, sup_stop}, child_adm, + child_adm_simple, extra_return, child_specs, {group, restart_one_for_one}, {group, restart_one_for_all}, {group, restart_simple_one_for_one}, @@ -93,8 +85,7 @@ count_children, do_not_save_start_parameters_for_temporary_children, do_not_save_child_specs_for_temporary_children, simple_one_for_one_scale_many_temporary_children, temporary_bystander, - simple_global_supervisor, hanging_restart_loop, hanging_restart_loop_simple, - code_change, code_change_map, code_change_simple, code_change_simple_map]. + simple_global_supervisor, hanging_restart_loop, hanging_restart_loop_simple]. groups() -> [{sup_start, [], @@ -102,10 +93,7 @@ sup_start_ignore_child, sup_start_ignore_temporary_child, sup_start_ignore_temporary_child_start_child, sup_start_ignore_temporary_child_start_child_simple, - sup_start_ignore_permanent_child_start_child_simple, sup_start_error_return, sup_start_fail]}, - {sup_start_map, [], - [sup_start_map, sup_start_map_simple, sup_start_map_faulty_specs]}, {sup_stop, [], [sup_stop_infinity, sup_stop_timeout, sup_stop_brutal_kill]}, @@ -254,27 +242,6 @@ [1,1,0,1] = get_child_counts(sup_test). %%------------------------------------------------------------------------- -%% Tests what happens if child's init-callback returns ignore for a -%% permanent child when child is started with start_child/2, and the -%% supervisor is simple_one_for_one. -%% Child spec shall NOT be saved!!! -sup_start_ignore_permanent_child_start_child_simple(Config) - when is_list(Config) -> - process_flag(trap_exit, true), - Child1 = {child1, {supervisor_1, start_child, [ignore]}, - permanent, 1000, worker, []}, - {ok, Pid} = start_link({ok, {{simple_one_for_one, 2, 3600}, [Child1]}}), - - {ok, undefined} = supervisor:start_child(sup_test, []), - {ok, CPid2} = supervisor:start_child(sup_test, []), - - [{undefined, CPid2, worker, []}] = supervisor:which_children(sup_test), - [1,1,0,1] = get_child_counts(sup_test), - - %% Regression test: check that the supervisor terminates without error. - exit(Pid, shutdown), - check_exit_reason(Pid, shutdown). -%%------------------------------------------------------------------------- %% Tests what happens if init-callback returns a invalid value. sup_start_error_return(Config) when is_list(Config) -> process_flag(trap_exit, true), @@ -289,84 +256,6 @@ check_exit_reason(Term). %%------------------------------------------------------------------------- -%% Tests that the supervisor process starts correctly with map -%% startspec, and that the full childspec can be read. -sup_start_map(Config) when is_list(Config) -> - process_flag(trap_exit, true), - Child1 = #{id=>child1, start=>{supervisor_1, start_child, []}}, - Child2 = #{id=>child2, - start=>{supervisor_1, start_child, []}, - shutdown=>brutal_kill}, - Child3 = #{id=>child3, - start=>{supervisor_1, start_child, []}, - type=>supervisor}, - {ok, Pid} = start_link({ok, {#{}, [Child1,Child2,Child3]}}), - - %% Check default values - {ok,#{id:=child1, - start:={supervisor_1,start_child,[]}, - restart:=permanent, - shutdown:=5000, - type:=worker, - modules:=[supervisor_1]}} = supervisor:get_childspec(Pid, child1), - {ok,#{id:=child2, - start:={supervisor_1,start_child,[]}, - restart:=permanent, - shutdown:=brutal_kill, - type:=worker, - modules:=[supervisor_1]}} = supervisor:get_childspec(Pid, child2), - {ok,#{id:=child3, - start:={supervisor_1,start_child,[]}, - restart:=permanent, - shutdown:=infinity, - type:=supervisor, - modules:=[supervisor_1]}} = supervisor:get_childspec(Pid, child3), - {error,not_found} = supervisor:get_childspec(Pid, child4), - terminate(Pid, shutdown). - -%%------------------------------------------------------------------------- -%% Tests that the supervisor process starts correctly with map -%% startspec, and that the full childspec can be read when using -%% simple_one_for_one strategy. -sup_start_map_simple(Config) when is_list(Config) -> - process_flag(trap_exit, true), - SupFlags = #{strategy=>simple_one_for_one}, - ChildSpec = #{id=>undefined, - start=>{supervisor_1, start_child, []}, - restart=>temporary}, - {ok, Pid} = start_link({ok, {SupFlags, [ChildSpec]}}), - - {ok, Child1} = supervisor:start_child(Pid, []), - {ok, Child2} = supervisor:start_child(Pid, []), - {ok, Child3} = supervisor:start_child(Pid, []), - - Spec = ChildSpec#{type=>worker, shutdown=>5000, modules=>[supervisor_1]}, - - {ok, Spec} = supervisor:get_childspec(Pid, Child1), - {ok, Spec} = supervisor:get_childspec(Pid, Child2), - {ok, Spec} = supervisor:get_childspec(Pid, Child3), - {error,not_found} = supervisor:get_childspec(Pid, self()), - terminate(Pid, shutdown). - -%%------------------------------------------------------------------------- -%% Tests that the supervisor produces good error messages when start- -%% and child specs are faulty. -sup_start_map_faulty_specs(Config) when is_list(Config) -> - process_flag(trap_exit, true), - Child1 = #{start=>{supervisor_1, start_child, []}}, - Child2 = #{id=>child2}, - Child3 = #{id=>child3, - start=>{supervisor_1, start_child, []}, - silly_flag=>true}, - Child4 = child4, - {error,{start_spec,missing_id}} = start_link({ok, {#{}, [Child1]}}), - {error,{start_spec,missing_start}} = start_link({ok, {#{}, [Child2]}}), - {ok,Pid} = start_link({ok, {#{}, [Child3]}}), - terminate(Pid,shutdown), - {error,{start_spec,{invalid_child_spec,child4}}} = - start_link({ok, {#{}, [Child4]}}). - -%%------------------------------------------------------------------------- %% See sup_stop/1 when Shutdown = infinity, this walue is allowed for %% children of type supervisor _AND_ worker. sup_stop_infinity(Config) when is_list(Config) -> @@ -590,7 +479,7 @@ %% Tests child specs, invalid formats should be rejected. child_specs(Config) when is_list(Config) -> process_flag(trap_exit, true), - {ok, Pid} = start_link({ok, {{one_for_one, 2, 3600}, []}}), + {ok, _Pid} = start_link({ok, {{one_for_one, 2, 3600}, []}}), {error, _} = supervisor:start_child(sup_test, hej), %% Bad child specs @@ -620,7 +509,6 @@ {error, {invalid_modules,dy}} = supervisor:start_child(sup_test, B5), - {error, {badarg, _}} = supervisor:check_childspecs(B1), % should be list {error, {invalid_mfa,mfa}} = supervisor:check_childspecs([B1]), {error, {invalid_restart_type,prmanent}} = supervisor:check_childspecs([B2]), @@ -636,54 +524,6 @@ ok = supervisor:check_childspecs([C3]), ok = supervisor:check_childspecs([C4]), ok = supervisor:check_childspecs([C5]), - - {error,{duplicate_child_name,child}} = supervisor:check_childspecs([C1,C2]), - - terminate(Pid, shutdown), - - %% Faulty child specs in supervisor start - {error, {start_spec, {invalid_mfa, mfa}}} = - start_link({ok, {{one_for_one, 2, 3600}, [B1]}}), - {error, {start_spec, {invalid_restart_type, prmanent}}} = - start_link({ok, {{simple_one_for_one, 2, 3600}, [B2]}}), - - %% simple_one_for_one needs exactly one child - {error,{bad_start_spec,[]}} = - start_link({ok, {{simple_one_for_one, 2, 3600}, []}}), - {error,{bad_start_spec,[C1,C2]}} = - start_link({ok, {{simple_one_for_one, 2, 3600}, [C1,C2]}}), - - ok. - -%%------------------------------------------------------------------------- -%% Test error handling of supervisor flags -sup_flags(_Config) -> - process_flag(trap_exit,true), - {error,{supervisor_data,{invalid_strategy,_}}} = - start_link({ok, {{none_for_one, 2, 3600}, []}}), - {error,{supervisor_data,{invalid_strategy,_}}} = - start_link({ok, {#{strategy=>none_for_one}, []}}), - {error,{supervisor_data,{invalid_intensity,_}}} = - start_link({ok, {{one_for_one, infinity, 3600}, []}}), - {error,{supervisor_data,{invalid_intensity,_}}} = - start_link({ok, {#{intensity=>infinity}, []}}), - {error,{supervisor_data,{invalid_period,_}}} = - start_link({ok, {{one_for_one, 2, 0}, []}}), - {error,{supervisor_data,{invalid_period,_}}} = - start_link({ok, {#{period=>0}, []}}), - {error,{supervisor_data,{invalid_period,_}}} = - start_link({ok, {{one_for_one, 2, infinity}, []}}), - {error,{supervisor_data,{invalid_period,_}}} = - start_link({ok, {#{period=>infinity}, []}}), - - %% SupFlags other than a map or a 3-tuple - {error,{supervisor_data,{invalid_type,_}}} = - start_link({ok, {{one_for_one, 2}, []}}), - - %% Unexpected flags are ignored - {ok,Pid} = start_link({ok,{#{silly_flag=>true},[]}}), - terminate(Pid,shutdown), - ok. %%------------------------------------------------------------------------- @@ -924,39 +764,6 @@ [{child1, _, _, _}] = supervisor:which_children(SupPid2). %%------------------------------------------------------------------------- -%% Test restarting a process multiple times, being careful not -%% to exceed the maximum restart frquency. -multiple_restarts(Config) when is_list(Config) -> - process_flag(trap_exit, true), - Child1 = #{id => child1, - start => {supervisor_1, start_child, []}, - restart => permanent, - shutdown => brutal_kill, - type => worker, - modules => []}, - SupFlags = #{strategy => one_for_one, - intensity => 1, - period => 1}, - {ok, SupPid} = start_link({ok, {SupFlags, []}}), - {ok, CPid1} = supervisor:start_child(sup_test, Child1), - - %% Terminate the process several times, but being careful - %% not to exceed the maximum restart intensity. - terminate(SupPid, CPid1, child1, abnormal), - _ = [begin - receive after 2100 -> ok end, - [{_, Pid, _, _}|_] = supervisor:which_children(sup_test), - terminate(SupPid, Pid, child1, abnormal) - end || _ <- [1,2,3]], - - %% Verify that the supervisor is still alive and clean up. - ok = supervisor:terminate_child(SupPid, child1), - ok = supervisor:delete_child(SupPid, child1), - exit(SupPid, kill), - ok. - - -%%------------------------------------------------------------------------- %% Test the one_for_one base case. one_for_one(Config) when is_list(Config) -> process_flag(trap_exit, true), @@ -1840,186 +1647,6 @@ ok. %%------------------------------------------------------------------------- -%% Test the code_change function -code_change(_Config) -> - process_flag(trap_exit, true), - - SupFlags = {one_for_one, 0, 1}, - {ok, Pid} = start_link({ok, {SupFlags, []}}), - [] = supervisor:which_children(Pid), - - %% Change supervisor flags - S1 = sys:get_state(Pid), - ok = fake_upgrade(Pid,{ok, {{one_for_one, 1, 3}, []}}), - S2 = sys:get_state(Pid), - true = (S1 /= S2), - - %% Faulty childspec - FaultyChild = {child1, permanent, brutal_kill, worker, []}, % missing start - {error,{error,{invalid_child_spec,FaultyChild}}} = - fake_upgrade(Pid,{ok,{SupFlags,[FaultyChild]}}), - - %% Add child1 and child2 - Child1 = {child1, {supervisor_1, start_child, []}, - permanent, 2000, worker, []}, - Child2 = {child2, {supervisor_1, start_child, []}, - permanent, brutal_kill, worker, []}, - ok = fake_upgrade(Pid,{ok,{SupFlags,[Child1,Child2]}}), - %% Children are not automatically started - {ok,_} = supervisor:restart_child(Pid,child1), - {ok,_} = supervisor:restart_child(Pid,child2), - [{child2,_,_,_},{child1,_,_,_}] = supervisor:which_children(Pid), - - %% Change child1, remove child2 and add child3 - Child11 = {child1, {supervisor_1, start_child, []}, - permanent, 1000, worker, []}, - Child3 = {child3, {supervisor_1, start_child, []}, - permanent, brutal_kill, worker, []}, - ok = fake_upgrade(Pid,{ok, {SupFlags, [Child11,Child3]}}), - %% Children are not deleted on upgrade, so it is ok that child2 is - %% still here - [{child2,_,_,_},{child3,_,_,_},{child1,_,_,_}] = - supervisor:which_children(Pid), - - %% Ignore during upgrade - ok = fake_upgrade(Pid,ignore), - - %% Error during upgrade - {error, faulty_return} = fake_upgrade(Pid,faulty_return), - - %% Faulty flags - {error,{error, {invalid_intensity,faulty_intensity}}} = - fake_upgrade(Pid,{ok, {{one_for_one,faulty_intensity,1}, []}}), - {error,{error,{bad_flags, faulty_flags}}} = - fake_upgrade(Pid,{ok, {faulty_flags, []}}), - - terminate(Pid,shutdown). - -code_change_map(_Config) -> - process_flag(trap_exit, true), - - {ok, Pid} = start_link({ok, {#{}, []}}), - [] = supervisor:which_children(Pid), - - %% Change supervisor flags - S1 = sys:get_state(Pid), - ok = fake_upgrade(Pid,{ok, {#{intensity=>1, period=>3}, []}}), - S2 = sys:get_state(Pid), - true = (S1 /= S2), - - %% Faulty childspec - FaultyChild = #{id=>faulty_child}, - {error,{error,missing_start}} = - fake_upgrade(Pid,{ok,{#{},[FaultyChild]}}), - - %% Add child1 and child2 - Child1 = #{id=>child1, - start=>{supervisor_1, start_child, []}, - shutdown=>2000}, - Child2 = #{id=>child2, - start=>{supervisor_1, start_child, []}}, - ok = fake_upgrade(Pid,{ok,{#{},[Child1,Child2]}}), - %% Children are not automatically started - {ok,_} = supervisor:restart_child(Pid,child1), - {ok,_} = supervisor:restart_child(Pid,child2), - [{child2,_,_,_},{child1,_,_,_}] = supervisor:which_children(Pid), - {ok,#{shutdown:=2000}} = supervisor:get_childspec(Pid,child1), - - %% Change child1, remove child2 and add child3 - Child11 = #{id=>child1, - start=>{supervisor_1, start_child, []}, - shutdown=>1000}, - Child3 = #{id=>child3, - start=>{supervisor_1, start_child, []}}, - ok = fake_upgrade(Pid,{ok, {#{}, [Child11,Child3]}}), - %% Children are not deleted on upgrade, so it is ok that child2 is - %% still here - [{child2,_,_,_},{child3,_,_,_},{child1,_,_,_}] = - supervisor:which_children(Pid), - {ok,#{shutdown:=1000}} = supervisor:get_childspec(Pid,child1), - - %% Ignore during upgrade - ok = fake_upgrade(Pid,ignore), - - %% Error during upgrade - {error, faulty_return} = fake_upgrade(Pid,faulty_return), - - %% Faulty flags - {error,{error, {invalid_intensity,faulty_intensity}}} = - fake_upgrade(Pid,{ok, {#{intensity=>faulty_intensity}, []}}), - - terminate(Pid,shutdown). - -code_change_simple(_Config) -> - process_flag(trap_exit, true), - - SimpleChild1 = {child1,{supervisor_1, start_child, []}, permanent, - brutal_kill, worker, []}, - SimpleFlags = {simple_one_for_one, 0, 1}, - {ok, SimplePid} = start_link({ok, {SimpleFlags,[SimpleChild1]}}), - %% Change childspec - SimpleChild11 = {child1,{supervisor_1, start_child, []}, permanent, - 1000, worker, []}, - ok = fake_upgrade(SimplePid,{ok,{SimpleFlags,[SimpleChild11]}}), - - %% Attempt to add child - SimpleChild2 = {child2,{supervisor_1, start_child, []}, permanent, - brutal_kill, worker, []}, - - {error, {error, {ok,[_,_]}}} = - fake_upgrade(SimplePid,{ok,{SimpleFlags,[SimpleChild1,SimpleChild2]}}), - - %% Attempt to remove child - {error, {error, {ok,[]}}} = fake_upgrade(SimplePid,{ok,{SimpleFlags,[]}}), - - terminate(SimplePid,shutdown), - ok. - -code_change_simple_map(_Config) -> - process_flag(trap_exit, true), - - SimpleChild1 = #{id=>child1, - start=>{supervisor_1, start_child, []}}, - SimpleFlags = #{strategy=>simple_one_for_one}, - {ok, SimplePid} = start_link({ok, {SimpleFlags,[SimpleChild1]}}), - %% Change childspec - SimpleChild11 = #{id=>child1, - start=>{supervisor_1, start_child, []}, - shutdown=>1000}, - ok = fake_upgrade(SimplePid,{ok,{SimpleFlags,[SimpleChild11]}}), - - %% Attempt to add child - SimpleChild2 = #{id=>child2, - start=>{supervisor_1, start_child, []}}, - {error, {error, {ok, [_,_]}}} = - fake_upgrade(SimplePid,{ok,{SimpleFlags,[SimpleChild1,SimpleChild2]}}), - - %% Attempt to remove child - {error, {error, {ok, []}}} = - fake_upgrade(SimplePid,{ok,{SimpleFlags,[]}}), - - terminate(SimplePid,shutdown), - ok. - -fake_upgrade(Pid,NewInitReturn) -> - ok = sys:suspend(Pid), - - %% Update state to fake code change - %% The #state record in supervisor.erl holds the arguments given - %% to the callback init function. By replacing these arguments the - %% init function will return something new and by that fake a code - %% change (see init function above in this module). - Fun = fun(State) -> - Size = size(State), % 'args' is the last field in #state. - setelement(Size,State,NewInitReturn) - end, - sys:replace_state(Pid,Fun), - - R = sys:change_code(Pid,gen_server,dummy_vsn,[]), - ok = sys:resume(Pid), - R. - -%%------------------------------------------------------------------------- terminate(Pid, Reason) when Reason =/= supervisor -> terminate(dummy, Pid, dummy, Reason). diff -Nru erlang-18.2-dfsg/lib/stdlib/test/sys_sp1.erl erlang-17.3-dfsg/lib/stdlib/test/sys_sp1.erl --- erlang-18.2-dfsg/lib/stdlib/test/sys_sp1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/sys_sp1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,24 +1,23 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2014. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% -module(sys_sp1). --export([start_link/1]). +-export([start_link/1, stop/0]). -export([alloc/0, free/1]). -export([init/1]). -export([system_continue/3, system_terminate/4, @@ -32,6 +31,10 @@ start_link(NumCh) -> proc_lib:start_link(?MODULE, init, [[self(),NumCh]]). +stop() -> + ?MODULE ! stop, + ok. + alloc() -> ?MODULE ! {self(), alloc}, receive @@ -67,7 +70,11 @@ loop(Chs2, Parent, Deb2); {system, From, Request} -> sys:handle_system_msg(Request, From, Parent, - ?MODULE, Deb, Chs) + ?MODULE, Deb, Chs); + stop -> + sys:handle_debug(Deb, fun write_debug/3, + ?MODULE, {in, stop}), + ok end. system_continue(Parent, Deb, Chs) -> diff -Nru erlang-18.2-dfsg/lib/stdlib/test/sys_sp2.erl erlang-17.3-dfsg/lib/stdlib/test/sys_sp2.erl --- erlang-18.2-dfsg/lib/stdlib/test/sys_sp2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/sys_sp2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,24 +1,23 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2014. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% -module(sys_sp2). --export([start_link/1]). +-export([start_link/1, stop/0]). -export([alloc/0, free/1]). -export([init/1]). -export([system_continue/3, system_terminate/4, @@ -31,6 +30,10 @@ start_link(NumCh) -> proc_lib:start_link(?MODULE, init, [[self(),NumCh]]). +stop() -> + ?MODULE ! stop, + ok. + alloc() -> ?MODULE ! {self(), alloc}, receive @@ -42,6 +45,11 @@ ?MODULE ! {free, Ch}, ok. +%% can't use 2-tuple for state here as we do in sys_sp1, since the 2-tuple +%% is not compatible with the backward compatibility handling for +%% sys:get_state in sys.erl +-record(state, {alloc,free}). + init([Parent,NumCh]) -> register(?MODULE, self()), Chs = channels(NumCh), @@ -66,7 +74,11 @@ loop(Chs2, Parent, Deb2); {system, From, Request} -> sys:handle_system_msg(Request, From, Parent, - ?MODULE, Deb, Chs) + ?MODULE, Deb, Chs); + stop -> + sys:handle_debug(Deb, fun write_debug/3, + ?MODULE, {in, stop}), + ok end. system_continue(Parent, Deb, Chs) -> @@ -79,17 +91,17 @@ io:format(Dev, "~p event = ~p~n", [Name, Event]). channels(NumCh) -> - {_Allocated=[], _Free=lists:seq(1,NumCh)}. + #state{alloc=[], free=lists:seq(1,NumCh)}. -alloc({_, []}) -> - {error, "no channels available"}; -alloc({Allocated, [H|T]}) -> - {H, {[H|Allocated], T}}. +alloc(#state{free=[]}=Channels) -> + {{error, "no channels available"}, Channels}; +alloc(#state{alloc=Allocated, free=[H|T]}) -> + {H, #state{alloc=[H|Allocated], free=T}}. -free(Ch, {Alloc, Free}=Channels) -> +free(Ch, #state{alloc=Alloc, free=Free}=Channels) -> case lists:member(Ch, Alloc) of true -> - {lists:delete(Ch, Alloc), [Ch|Free]}; + #state{alloc=lists:delete(Ch, Alloc), free=[Ch|Free]}; false -> Channels end. diff -Nru erlang-18.2-dfsg/lib/stdlib/test/sys_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/sys_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/sys_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/sys_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2014. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -203,7 +202,14 @@ {Mod,system_get_state},{throw,fail}},_}} -> ok end, - ok = sys:terminate(Mod, normal), + Mod:stop(), + WaitForUnregister = fun W() -> + case whereis(Mod) of + undefined -> ok; + _ -> timer:sleep(10), W() + end + end, + WaitForUnregister(), {ok,_} = Mod:start_link(4), ok = case catch sys:replace_state(Mod, fun(_) -> {} end) of {} -> @@ -212,7 +218,8 @@ {Mod,system_replace_state},{throw,fail}},_}} -> ok end, - ok = sys:terminate(Mod, normal), + Mod:stop(), + WaitForUnregister(), {ok,_} = Mod:start_link(4), StateFun = fun(_) -> error(fail) end, ok = case catch sys:replace_state(Mod, StateFun) of @@ -224,7 +231,7 @@ {'EXIT',{{callback_failed,StateFun,{error,fail}},_}} -> ok end, - ok = sys:terminate(Mod, normal). + Mod:stop(). %%%%%%%%%%%%%%%%%%%% %% Dummy server diff -Nru erlang-18.2-dfsg/lib/stdlib/test/tar_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/tar_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/tar_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/tar_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -90,7 +89,7 @@ ?line io:format("Testing size ~p", [Size]), %% Create a file and archive it. - X0 = erlang:monotonic_time(), + ?line {_, _, X0} = erlang:now(), ?line file:write_file(Name, random_byte_list(X0, Size)), ?line ok = erl_tar:create(Archive, [Name]), ?line ok = file:delete(Name), @@ -655,7 +654,6 @@ ?line ok = erl_tar:add(AD, FileOne, []), ?line ok = erl_tar:add(AD, FileTwo, "second file", []), ?line ok = erl_tar:add(AD, FileThree, [verbose]), - ?line ok = erl_tar:add(AD, FileThree, "chunked", [{chunks,11411},verbose]), ?line ok = erl_tar:add(AD, ADir, [verbose]), ?line ok = erl_tar:add(AD, AnotherDir, [verbose]), ?line ok = erl_tar:close(AD), @@ -663,7 +661,7 @@ ?line ok = erl_tar:t(TarOne), ?line ok = erl_tar:tt(TarOne), - ?line {ok,[FileOne,"second file",FileThree,"chunked",ADir,SomeContent]} = erl_tar:table(TarOne), + ?line {ok,[FileOne,"second file",FileThree,ADir,SomeContent]} = erl_tar:table(TarOne), ?line delete_files(["oac_file","oac_small","oac_big",Dir,AnotherDir,ADir]), diff -Nru erlang-18.2-dfsg/lib/stdlib/test/timer_simple_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/timer_simple_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/timer_simple_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/timer_simple_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -375,6 +374,7 @@ big_test(M) -> Load_Pids = start_nrev(20, M), % Increase if more load wanted :) + apply(M, sleep, [9000]), LPids = spawn_timers(5, M, 10000, 5), apply(M, sleep, [4000]), @@ -483,7 +483,8 @@ X. system_time() -> - erlang:monotonic_time(micro_seconds). + {M,S,U} = erlang:now(), + 1000000*(M*1000000 + S) + U. %% ------------------------------------------------------- %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/timer_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/timer_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/timer_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/timer_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -26,11 +25,14 @@ -include_lib("test_server/include/test_server.hrl"). -%% Random test of the timer module. This is a really nasty test, as it -%% runs a lot of timeouts and then checks in the end if any of them -%% was triggered too early or if any late timeouts was much too late. +%% Test suite for timer module. This is a really nasty test it runs a +%% lot of timeouts and then checks in the end if any of them was +%% trigggered too early or if any late timeouts was much too +%% late. What should be added is more testing of the interface +%% functions I guess. But I don't have time for that now. %% -%% Running time on average is about 90 seconds. +%% Expect it to run for at least 5-10 minutes! + %% The main test case in this module is "do_big_test", which %% orders a large number of timeouts and measures how @@ -38,8 +40,15 @@ %% also a number of other concurrent processes running "nrev" at the same %% time. The result is analyzed afterwards by trying to check if the %% measured values are reasonable. It is hard to determine what is -%% reasonable on different machines; therefore the test can sometimes -%% fail, even though the timer module is ok. +%% reasonable on different machines therefore the test can sometimes +%% fail, even though the timer module is ok. I have checked against +%% previous versions of the timer module (which contained bugs) and it +%% seems it fails every time when running the buggy timer modules. +%% +%% The solution is to rewrite the test suite. Possible strategies for a +%% rewrite: smarter math on the measuring data, test cases with varying +%% amount of load. The test suite should also include tests that test the +%% interface of the timer module. suite() -> [{ct_hooks,[ts_install_cth]}]. @@ -80,7 +89,10 @@ big_test(N) -> C = start_collect(), system_time(), system_time(), system_time(), - random:seed(erlang:timestamp()), + A1 = element(2, erlang:now()), + A2 = A1 * 3, + A3 = element(3, erlang:now()), + random:seed(A1, A2, A3), random:uniform(100),random:uniform(100),random:uniform(100), big_loop(C, N, []), @@ -134,7 +146,7 @@ %%Pids2=Pids1, %% wait a little while - timer:sleep(random:uniform(200)*3), + timer:sleep(random:uniform(200)*10), %% spawn zero, one or two nrev to get some load ;-/ Pids3 = start_nrev(Pids2, random:uniform(100)), @@ -154,14 +166,14 @@ start_after_test(Pids, C, 1) -> - TO1 = random:uniform(100)*47, + TO1 = random:uniform(100)*100, [s_a_t(C, TO1)|Pids]; start_after_test(Pids, C, 2) -> - TO1 = random:uniform(100)*47, - TO2 = TO1 div random:uniform(3) + 101, + TO1 = random:uniform(100)*100, + TO2 = TO1 div random:uniform(3) + 200, [s_a_t(C, TO1),s_a_t(C, TO2)|Pids]; start_after_test(Pids, C, N) -> - TO1 = random:uniform(100)*47, + TO1 = random:uniform(100)*100, start_after_test([s_a_t(C, TO1)|Pids], C, N-1). s_a_t(C, TimeOut) -> @@ -187,7 +199,7 @@ maybe_start_i_test(Pids, C, 1) -> %% ok do it - TOI = random:uniform(53)*49, + TOI = random:uniform(100)*100, CountI = random:uniform(10) + 3, % at least 4 times [spawn_link(timer_SUITE, i_t, [C, TOI, CountI])|Pids]; maybe_start_i_test(Pids, _C, _) -> @@ -362,7 +374,9 @@ system_time() -> - erlang:monotonic_time(milli_seconds). + %%element(1, statistics(wall_clock)). + {M,S,U} = erlang:now(), + 1000000000 * M + 1000 * S + (U div 1000). %% ------------------------------------------------------- %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/unicode_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/unicode_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/unicode_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/unicode_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2008-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -30,13 +29,7 @@ random_lists/1, roundtrips/1, latin1/1, - exceptions/1, - binaries_errors_limit/1, - ex_binaries_errors_utf8/1, - ex_binaries_errors_utf16_little/1, - ex_binaries_errors_utf16_big/1, - ex_binaries_errors_utf32_little/1, - ex_binaries_errors_utf32_big/1]). + exceptions/1, binaries_errors/1]). init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog=?t:timetrap(?t:minutes(20)), @@ -51,17 +44,10 @@ all() -> [utf8_illegal_sequences_bif, utf16_illegal_sequences_bif, random_lists, roundtrips, - latin1, exceptions, - binaries_errors_limit, - {group,binaries_errors}]. + latin1, exceptions, binaries_errors]. groups() -> - [{binaries_errors,[parallel], - [ex_binaries_errors_utf8, - ex_binaries_errors_utf16_little, - ex_binaries_errors_utf16_big, - ex_binaries_errors_utf32_little, - ex_binaries_errors_utf32_big]}]. + []. init_per_suite(Config) -> Config. @@ -75,11 +61,15 @@ end_per_group(_GroupName, Config) -> Config. -binaries_errors_limit(Config) when is_list(Config) -> +binaries_errors(Config) when is_list(Config) -> setlimit(10), ex_binaries_errors_utf8(Config), setlimit(default), - ok. + ex_binaries_errors_utf8(Config), + ex_binaries_errors_utf16_little(Config), + ex_binaries_errors_utf16_big(Config), + ex_binaries_errors_utf32_little(Config), + ex_binaries_errors_utf32_big(Config). ex_binaries_errors_utf8(Config) when is_list(Config) -> %% Original smoke test, we should not forget the original offset... @@ -88,9 +78,8 @@ %% Now, try with longer binary (trapping) BrokenPart = list_to_binary(lists:seq(128,255)), BrokenSz = byte_size(BrokenPart), - Seq255 = lists:seq(1,255), [ begin - OKList = lists:flatten(lists:duplicate(N,Seq255)), + OKList = lists:flatten(lists:duplicate(N,lists:seq(1,255))), OKBin = unicode:characters_to_binary(OKList), OKLen = length(OKList), %% Copy to avoid that the binary get's writable @@ -113,84 +102,109 @@ ok. ex_binaries_errors_utf16_little(Config) when is_list(Config) -> - ex_binaries_errors_utf16(little). - -ex_binaries_errors_utf16_big(Config) when is_list(Config) -> - ex_binaries_errors_utf16(big). - -ex_binaries_errors_utf16(Endian) -> - BrokenSeq = lists:seq(16#DC00, 16#DFFF), - BrokenPart = case Endian of - little -> - << <> || X <- BrokenSeq >>; - big -> - << <> || X <- BrokenSeq >> - end, + BrokenPart = << <> || X <- lists:seq(16#DC00,16#DFFF) >>, BrokenSz = byte_size(BrokenPart), - Seq255 = lists:seq(1, 255), [ begin - OKList = lists:append(lists:duplicate(N, Seq255)), - OKBin = unicode:characters_to_binary(OKList, unicode, {utf16,Endian}), - PartlyBroken = iolist_to_binary([OKBin,BrokenPart]), + OKList = lists:flatten(lists:duplicate(N,lists:seq(1,255))), + OKBin = unicode:characters_to_binary(OKList,unicode,{utf16,little}), + OKLen = length(OKList), + %% Copy to avoid that the binary get's writable + PartlyBroken = binary:copy(<>), PBSz = byte_size(PartlyBroken), {error,OKList,DeepBrokenPart} = - unicode:characters_to_list(PartlyBroken, {utf16,Endian}), + unicode:characters_to_list(PartlyBroken,{utf16,little}), BrokenPart = iolist_to_binary(DeepBrokenPart), - utf16_inner_loop(OKList, BrokenPart, BrokenSz, - PartlyBroken, PBSz, Endian) - end || N <- lists:seq(1, 16, 3) ], + [ begin + NewList = lists:nthtail(X, OKList), + NewSz = byte_size(unicode:characters_to_binary(NewList,unicode,{utf16,little})) + + BrokenSz, + Chomped = binary:part(PartlyBroken,PBSz - NewSz, NewSz), + true = (binary:referenced_byte_size(Chomped) =:= PBSz), + {error,NewList,DeepBrokenPart2} = + unicode:characters_to_list(Chomped,{utf16,little}), + BrokenPart = iolist_to_binary(DeepBrokenPart2) + end || X <- lists:seq(1,OKLen) ] + end || N <- lists:seq(1,16,3) ], ok. - -utf16_inner_loop([_|List], BrokenPart, BrokenSz, PartlyBroken, PBSz, Endian) -> - Sz = length(List)*2 + BrokenSz, - Chomped = binary:part(PartlyBroken, PBSz - Sz, Sz), - true = binary:referenced_byte_size(Chomped) =:= PBSz, - {error,List,DeepBrokenPart} = - unicode:characters_to_list(Chomped, {utf16,Endian}), - BrokenPart = iolist_to_binary(DeepBrokenPart), - utf16_inner_loop(List, BrokenPart, BrokenSz, PartlyBroken, PBSz, Endian); -utf16_inner_loop([], _, _, _, _, _) -> +ex_binaries_errors_utf16_big(Config) when is_list(Config) -> + BrokenPart = << <> || X <- lists:seq(16#DC00,16#DFFF) >>, + BrokenSz = byte_size(BrokenPart), + [ begin + OKList = lists:flatten(lists:duplicate(N,lists:seq(1,255))), + OKBin = unicode:characters_to_binary(OKList,unicode,{utf16,big}), + OKLen = length(OKList), + %% Copy to avoid that the binary get's writable + PartlyBroken = binary:copy(<>), + PBSz = byte_size(PartlyBroken), + {error,OKList,DeepBrokenPart} = + unicode:characters_to_list(PartlyBroken,{utf16,big}), + BrokenPart = iolist_to_binary(DeepBrokenPart), + [ begin + NewList = lists:nthtail(X, OKList), + NewSz = byte_size(unicode:characters_to_binary(NewList,unicode,{utf16,big})) + + BrokenSz, + Chomped = binary:part(PartlyBroken,PBSz - NewSz, NewSz), + true = (binary:referenced_byte_size(Chomped) =:= PBSz), + {error,NewList,DeepBrokenPart2} = + unicode:characters_to_list(Chomped,{utf16,big}), + BrokenPart = iolist_to_binary(DeepBrokenPart2) + end || X <- lists:seq(1,OKLen) ] + end || N <- lists:seq(1,16,3) ], ok. ex_binaries_errors_utf32_big(Config) when is_list(Config) -> - ex_binaries_errors_utf32(big). + BrokenPart = << <> || X <- lists:seq(16#DC00,16#DFFF) >>, + BrokenSz = byte_size(BrokenPart), + [ begin + OKList = lists:flatten(lists:duplicate(N,lists:seq(1,255))), + OKBin = unicode:characters_to_binary(OKList,unicode,{utf32,big}), + OKLen = length(OKList), + %% Copy to avoid that the binary get's writable + PartlyBroken = binary:copy(<>), + PBSz = byte_size(PartlyBroken), + {error,OKList,DeepBrokenPart} = + unicode:characters_to_list(PartlyBroken,{utf32,big}), + BrokenPart = iolist_to_binary(DeepBrokenPart), + [ begin + NewList = lists:nthtail(X, OKList), + NewSz = byte_size(unicode:characters_to_binary(NewList,unicode,{utf32,big})) + + BrokenSz, + Chomped = binary:part(PartlyBroken,PBSz - NewSz, NewSz), + true = (binary:referenced_byte_size(Chomped) =:= PBSz), + {error,NewList,DeepBrokenPart2} = + unicode:characters_to_list(Chomped,{utf32,big}), + BrokenPart = iolist_to_binary(DeepBrokenPart2) + end || X <- lists:seq(1,OKLen) ] + end || N <- lists:seq(1,16,3) ], + ok. ex_binaries_errors_utf32_little(Config) when is_list(Config) -> - ex_binaries_errors_utf32(little). - -ex_binaries_errors_utf32(Endian) -> - BrokenSeq = lists:seq(16#DC00, 16#DFFF), - BrokenPart = case Endian of - little -> - << <> || X <- BrokenSeq >>; - big -> - << <> || X <- BrokenSeq >> - end, + BrokenPart = << <> || X <- lists:seq(16#DC00,16#DFFF) >>, BrokenSz = byte_size(BrokenPart), - Seq255 = lists:seq(1, 255), [ begin - OKList = lists:append(lists:duplicate(N, Seq255)), - OKBin = unicode:characters_to_binary(OKList, unicode, {utf32,Endian}), - PartlyBroken = iolist_to_binary([OKBin,BrokenPart]), + OKList = lists:flatten(lists:duplicate(N,lists:seq(1,255))), + OKBin = unicode:characters_to_binary(OKList,unicode,{utf32,little}), + OKLen = length(OKList), + %% Copy to avoid that the binary get's writable + PartlyBroken = binary:copy(<>), PBSz = byte_size(PartlyBroken), {error,OKList,DeepBrokenPart} = - unicode:characters_to_list(PartlyBroken, {utf32,Endian}), + unicode:characters_to_list(PartlyBroken,{utf32,little}), BrokenPart = iolist_to_binary(DeepBrokenPart), - utf32_inner_loop(OKList, BrokenPart, BrokenSz, - PartlyBroken, PBSz, Endian) - end || N <- lists:seq(1, 16, 3) ], + [ begin + NewList = lists:nthtail(X, OKList), + NewSz = byte_size(unicode:characters_to_binary(NewList,unicode,{utf32,little})) + + BrokenSz, + Chomped = binary:part(PartlyBroken,PBSz - NewSz, NewSz), + true = (binary:referenced_byte_size(Chomped) =:= PBSz), + {error,NewList,DeepBrokenPart2} = + unicode:characters_to_list(Chomped,{utf32,little}), + BrokenPart = iolist_to_binary(DeepBrokenPart2) + end || X <- lists:seq(1,OKLen) ] + end || N <- lists:seq(1,16,3) ], ok. -utf32_inner_loop([_|List], BrokenPart, BrokenSz, PartlyBroken, PBSz, Endian) -> - Sz = length(List)*4 + BrokenSz, - Chomped = binary:part(PartlyBroken, PBSz - Sz, Sz), - true = binary:referenced_byte_size(Chomped) =:= PBSz, - {error,List,DeepBrokenPart} = - unicode:characters_to_list(Chomped, {utf32,Endian}), - BrokenPart = iolist_to_binary(DeepBrokenPart), - utf32_inner_loop(List, BrokenPart, BrokenSz, PartlyBroken, PBSz, Endian); -utf32_inner_loop([], _, _, _, _, _) -> - ok. + exceptions(Config) when is_list(Config) -> setlimit(10), diff -Nru erlang-18.2-dfsg/lib/stdlib/test/win32reg_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/win32reg_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/win32reg_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/win32reg_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/y2k_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/y2k_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/y2k_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/y2k_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/stdlib/test/zip_SUITE.erl erlang-17.3-dfsg/lib/stdlib/test/zip_SUITE.erl --- erlang-18.2-dfsg/lib/stdlib/test/zip_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/test/zip_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2006-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -24,7 +23,7 @@ bad_zip/1, unzip_from_binary/1, unzip_to_binary/1, zip_to_binary/1, unzip_options/1, zip_options/1, list_dir_options/1, aliases/1, - openzip_api/1, zip_api/1, open_leak/1, unzip_jar/1, + openzip_api/1, zip_api/1, unzip_jar/1, compress_control/1, foldl/1]). @@ -39,7 +38,7 @@ [borderline, atomic, bad_zip, unzip_from_binary, unzip_to_binary, zip_to_binary, unzip_options, zip_options, list_dir_options, aliases, openzip_api, - zip_api, open_leak, unzip_jar, compress_control, foldl]. + zip_api, unzip_jar, compress_control, foldl]. groups() -> []. @@ -85,7 +84,7 @@ io:format("Testing size ~p", [Size]), %% Create a file and archive it. - {_, _, X0} = erlang:timestamp(), + {_, _, X0} = erlang:now(), file:write_file(Name, random_byte_list(X0, Size)), {ok, Archive} = zip:zip(Archive, [Name]), ok = file:delete(Name), @@ -319,46 +318,8 @@ %% Clean up. delete_files([Names]), - ok. - -open_leak(doc) -> - ["Test that zip doesn't leak processes and ports where the " - "controlling process dies without closing an zip opened with " - "zip:zip_open/1."]; -open_leak(suite) -> []; -open_leak(Config) when is_list(Config) -> - %% Create a zip archive - Zip = "zip.zip", - {ok, Zip} = zip:zip(Zip, [], []), - - %% Open archive in a another process that dies immediately. - ZipSrv = spawn_zip(Zip, [memory]), - - %% Expect the ZipSrv process to die soon after. - true = spawned_zip_dead(ZipSrv), - - %% Clean up. - delete_files([Zip]), - ok. -spawn_zip(Zip, Options) -> - Self = self(), - spawn(fun() -> Self ! zip:zip_open(Zip, Options) end), - receive - {ok, ZipSrv} -> - ZipSrv - end. - -spawned_zip_dead(ZipSrv) -> - Ref = monitor(process, ZipSrv), - receive - {'DOWN', Ref, _, ZipSrv, _} -> - true - after 1000 -> - false - end. - unzip_options(doc) -> ["Test options for unzip, only cwd and file_list currently"]; unzip_options(suite) -> @@ -556,10 +517,9 @@ unzip_to_binary(Config) when is_list(Config) -> DataDir = ?config(data_dir, Config), PrivDir = ?config(priv_dir, Config), - WorkDir = filename:join(PrivDir, "unzip_to_binary"), - _ = file:make_dir(WorkDir), - ok = file:set_cwd(WorkDir), + delete_all_in(PrivDir), + file:set_cwd(PrivDir), Long = filename:join(DataDir, "abc.zip"), %% Unzip a zip file into a binary @@ -570,7 +530,7 @@ end, FBList), %% Make sure no files created in cwd - {ok,[]} = file:list_dir(WorkDir), + {ok,[]} = file:list_dir(PrivDir), ok. @@ -579,10 +539,8 @@ zip_to_binary(Config) when is_list(Config) -> DataDir = ?config(data_dir, Config), PrivDir = ?config(priv_dir, Config), - WorkDir = filename:join(PrivDir, "zip_to_binary"), - _ = file:make_dir(WorkDir), - - file:set_cwd(WorkDir), + delete_all_in(PrivDir), + file:set_cwd(PrivDir), FileName = "abc.txt", ZipName = "t.zip", FilePath = filename:join(DataDir, FileName), @@ -592,7 +550,7 @@ {ok, {ZipName, ZipB}} = zip:zip(ZipName, [FileName], [memory]), %% Make sure no files created in cwd - {ok,[FileName]} = file:list_dir(WorkDir), + {ok,[FileName]} = file:list_dir(PrivDir), %% Zip to a file {ok, ZipName} = zip:zip(ZipName, [FileName]), @@ -610,7 +568,7 @@ aliases(doc) -> ["Test using the aliases, extract/2, table/2 and create/3"]; aliases(Config) when is_list(Config) -> - {_, _, X0} = erlang:timestamp(), + {_, _, X0} = erlang:now(), Size = 100, B = list_to_binary(random_byte_list(X0, Size)), %% create @@ -699,6 +657,11 @@ end, do_delete_files(Rest, Cnt + DelCnt). +delete_all_in(Dir) -> + {ok, Files} = file:list_dir(Dir), + delete_files(lists:map(fun(F) -> filename:join(Dir,F) end, + Files)). + compress_control(doc) -> ["Test control of which files that should be compressed"]; compress_control(suite) -> []; diff -Nru erlang-18.2-dfsg/lib/stdlib/vsn.mk erlang-17.3-dfsg/lib/stdlib/vsn.mk --- erlang-18.2-dfsg/lib/stdlib/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/stdlib/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -STDLIB_VSN = 2.7 +STDLIB_VSN = 2.2 diff -Nru erlang-18.2-dfsg/lib/syntax_tools/doc/Makefile erlang-17.3-dfsg/lib/syntax_tools/doc/Makefile --- erlang-18.2-dfsg/lib/syntax_tools/doc/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/doc/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/syntax_tools/doc/overview.edoc erlang-17.3-dfsg/lib/syntax_tools/doc/overview.edoc --- erlang-18.2-dfsg/lib/syntax_tools/doc/overview.edoc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/doc/overview.edoc 2014-09-16 19:10:57.000000000 +0000 @@ -2,34 +2,79 @@ Syntax Tools overview page + @author Richard Carlsson -@copyright 1997-2014 Richard Carlsson +@copyright 1997-2004 Richard Carlsson @version {@version} -@title Erlang Syntax and Metaprogramming tools +@title Erlang Syntax Tools -@doc This package contains modules for handling abstract syntax trees (ASTs) -in Erlang, in a way that is compatible with the "abstract format" parse -trees of the stdlib module `erl_parse', together with utilities for reading -source files, {@link erl_prettypr. pretty-printing syntax trees}, {@link -igor. merging and renaming modules}, {@link erl_tidy. cleaning up obsolete -constructs}, and doing {@link merl. metaprogramming} in Erlang. +@doc This package contains modules for handling abstract Erlang syntax +trees, in a way that is compatible with the "parse trees" of the +standard library module `erl_parse', together with utilities for reading +source files in unusual ways and pretty-printing syntax trees. Also +included is an amazing module merger and renamer called Igor, as well as +an automatic code-cleaner. -The abstract layer (defined in {@link erl_syntax}) is nicely +

    The abstract layer (defined in {@link erl_syntax}) is nicely structured and the node types are context-independent. The layer makes it possible to transparently attach source-code comments and user annotations to nodes of the tree. Using the abstract layer makes applications less sensitive to changes in the {@link //stdlib/erl_parse} -data structures, only requiring the `erl_syntax' module to be up-to-date. +data structures, only requiring the {@link erl_syntax} module to be +up-to-date.

    -The pretty printer {@link erl_prettypr} is implemented on top of the +

    The pretty printer {@link erl_prettypr} is implemented on top of the library module {@link prettypr}: this is a powerful and flexible generic -pretty printing library, which is also distributed separately. +pretty printing library, which is also distributed separately.

    -For a short demonstration of parsing and pretty-printing, simply -compile the included module `demo.erl', -and execute `demo:run()' from the Erlang shell. It will compile the -remaining modules and give you further instructions. - -Also try the {@link erl_tidy} module, as follows: -```erl_tidy:dir("any-erlang-source-dir", [test, old_guard_tests]).''' -(the `test' option assures that no files are modified). +

    For a short demonstration of parsing and pretty-printing, simply +compile the included module demo.erl, and execute +demo:run() from the Erlang shell. It will compile the +remaining modules and give you further instructions.

    + +

    Also try the {@link erl_tidy} module, as follows: +

    +    erl_tidy:dir("any-erlang-source-dir", [test, old_guard_tests]).
    +("test" assures that no files are modified).

    + +

    News in 1.4: +

      +
    • Added support for {@link erl_syntax:cond_expr/1. cond-expressions}, + {@link erl_syntax:try_expr/4. try-expressions} and + {@link erl_syntax:class_qualifier/2. class-qualifier patterns}.
    • +
    • Added support for parameterized modules.
    • +
    • {@link igor. Igor} is officially included.
    • +
    • Quick-parse functionality added to {@link epp_dodger}.
    • +
    +

    + +

    News in 1.3: +

      +
    • Added support for qualified names (as used by "packages").
    • +
    • Various internal changes.
    • +
    +

    + +

    News in 1.2: +

      +
    • HTML Documentation (generated with EDoc).
    • +
    • A few bug fixes and some minor interface changes (sorry for any + inconvenience).
    • +
    +

    + +

    News in 1.1: +

      +
    • Module {@link erl_tidy}: check or tidy either a single module, or a + whole directory tree recursively. Rewrites and reformats the code + without losing comments or expanding macros. Safe mode allows + generating reports without modifying files.
    • +
    • Module {@link erl_syntax_lib}: contains support functions for easier + analysis of the source code structure.
    • +
    • Module {@link epp_dodger}: Bypasses the Erlang preprocessor - avoids + macro expansion, file inclusion, conditional compilation, etc. + Allows you to find/modify particular definitions/applications of + macros, and other things previously not possible.
    • +
    +

    diff -Nru erlang-18.2-dfsg/lib/syntax_tools/doc/src/book.xml erlang-17.3-dfsg/lib/syntax_tools/doc/src/book.xml --- erlang-18.2-dfsg/lib/syntax_tools/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/doc/src/Makefile erlang-17.3-dfsg/lib/syntax_tools/doc/src/Makefile --- erlang-18.2-dfsg/lib/syntax_tools/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2006-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -51,8 +50,6 @@ erl_syntax_lib.xml \ erl_tidy.xml \ igor.xml \ - merl.xml \ - merl_transform.xml \ prettypr.xml XML_PART_FILES = part.xml part_notes.xml diff -Nru erlang-18.2-dfsg/lib/syntax_tools/doc/src/notes.xml erlang-17.3-dfsg/lib/syntax_tools/doc/src/notes.xml --- erlang-18.2-dfsg/lib/syntax_tools/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -32,63 +31,6 @@

    This document describes the changes made to the Syntax_Tools application.

    -
    Syntax_Tools 1.7 - -
    Improvements and New Features - - -

    Use the new erl_anno module.

    -

    - Own Id: OTP-12732

    -
    - -

    The merl module has been added to the - syntax_tools application. The Merl library is a - simpler way to work with erl_syntax parse trees.

    -

    - Own Id: OTP-12769

    -
    -
    -
    - -
    - -
    Syntax_Tools 1.6.18 - -
    Fixed Bugs and Malfunctions - - -

    - Fix bad format of error in epp_dodger:parse_file/3

    -

    - Own Id: OTP-12406

    -
    -
    -
    - -
    - -
    Syntax_Tools 1.6.17 - -
    Fixed Bugs and Malfunctions - - -

    - Teach Maps to erl_syntax

    -

    - Affected functions: - erl_syntax:abstract/1 - erl_syntax:concrete/1 - erl_syntax:is_leaf/1 - erl_syntax:is_literal/1

    -

    - Own Id: OTP-12265

    -
    -
    -
    - -
    -
    Syntax_Tools 1.6.16
    Fixed Bugs and Malfunctions diff -Nru erlang-18.2-dfsg/lib/syntax_tools/doc/src/part_notes.xml erlang-17.3-dfsg/lib/syntax_tools/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/syntax_tools/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/doc/src/part.xml erlang-17.3-dfsg/lib/syntax_tools/doc/src/part.xml --- erlang-18.2-dfsg/lib/syntax_tools/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/doc/src/ref_man.xml erlang-17.3-dfsg/lib/syntax_tools/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/syntax_tools/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -30,11 +29,12 @@

    Syntax_Tools contains modules for handling abstract - Erlang syntax trees, in a way that is compatible with the "external - format" parse trees of the STDLIB module erl_parse, together - with utilities for reading source files, pretty-printing syntax trees, - merging and renaming modules, cleaning up obsolete constructs, and - doing metaprogramming in Erlang.

    + Erlang syntax trees, in a way that is compatible with the "parse + trees" of the STDLIB module erl_parse, together with + utilities for reading source files in unusual ways and + pretty-printing syntax trees. Also included is an amazing module + merger and renamer called Igor, as well as an automatic + code-cleaner.

    @@ -44,8 +44,6 @@ - - diff -Nru erlang-18.2-dfsg/lib/syntax_tools/examples/Makefile erlang-17.3-dfsg/lib/syntax_tools/examples/Makefile --- erlang-18.2-dfsg/lib/syntax_tools/examples/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/examples/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/syntax_tools/examples/merl/basicc.erl erlang-17.3-dfsg/lib/syntax_tools/examples/merl/basicc.erl --- erlang-18.2-dfsg/lib/syntax_tools/examples/merl/basicc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/examples/merl/basicc.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,149 +0,0 @@ -%% --------------------------------------------------------------------- -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% @author Richard Carlsson -%% @copyright 2012 Richard Carlsson -%% @doc Basic compiler in Erlang. - --module(basicc). - --export([run/2, make_lines/1, bool/1]). - --include_lib("eunit/include/eunit.hrl"). - --define(INTERPRETED, true). --include("basic_test.erl"). - --include("merl.hrl"). - -run(N, Prog) -> - compile(Prog, tmp), - tmp:run(N, Prog). - -make_lines(Prog) -> - ets:new(line, [private, named_table, ordered_set]), - lists:foreach(fun ({L,_}) -> ets:insert(line, {L,label(L)}) end, Prog). - -compile(Prog, ModName) -> - make_lines(Prog), - Fs0 = lists:map(fun ({L, X}) -> - {true, label(L), - case stmt(X) of - {Stmt, false} -> - [?Q("() -> _@Stmt")]; - {Stmt, true} -> - Next = case ets:next(line, L) of - '$end_of_table' -> - ?Q("stop(0)"); - L1 -> - Label = label(L1), - ?Q("_@Label@()") - end, - [?Q("() -> _@Stmt, _@Next")] - end} - end, Prog), - ets:delete(line), - Run = ?Q(["(N, Prog) ->", - " ets:new(var, [private, named_table]),", - " basicc:make_lines(Prog),", - " goto(N)" - ]), - Stop = ?Q(["(R) ->", - " ets:delete(var),", - " ets:delete(line),", - " R" - ]), - Goto = ?Q(["(L) ->", - " case ets:lookup(line, L) of", - " [{_, X}] -> apply(tmp, X, []);", - " _ ->", - " case ets:next(line, L) of", - " '$end_of_table' -> stop(0);", - " L1 -> goto(L1)", - " end", - " end"]), - Fs = [{true, run, [Run]}, - {false, stop, [Stop]}, - {true, goto, [Goto]} - | Fs0], - Forms = merl_build:module_forms( - lists:foldl(fun ({X, Name, Cs}, S) -> - merl_build:add_function(X, Name, Cs, S) - end, - merl_build:init_module(ModName), - Fs)), - %% %% Write source to file for debugging - %% file:write_file(lists:concat([ModName, "_gen.erl"]), - %% erl_prettypr:format(erl_syntax:form_list(Forms), - %% [{paper,160},{ribbon,80}])), - merl:compile_and_load(Forms, [verbose]). - -label(L) -> - list_to_atom("label_" ++ integer_to_list(L)). - -stmt({print, S, As}) -> - Exprs = [expr(A) || A <- As], - {[?Q(["io:format(_@S@, [_@Exprs])"])], true}; -stmt({set, V, X}) -> - Expr = expr(X), - {[?Q(["ets:insert(var, {_@V@, _@Expr})"])], true}; -stmt({goto, X}) -> - {[jump(X)], false}; -stmt({stop, X}) -> - Expr = expr(X), - {[?Q(["stop(_@Expr)"])], false}; -stmt({iff, X, A, B}) -> - Cond = expr(X), - True = jump(A), - False = jump(B), - {?Q(["case _@Cond of", - " 0 -> _@False;", - " _ -> _@True", - "end"]), - false}. - -jump(X) -> - case ets:lookup(line, X) of - [{_, F}] -> - ?Q(["_@F@()"]); - true -> - Expr = expr(X), - [?Q(["goto(_@Expr)"])] - end. - -expr(X) when is_number(X) ; is_list(X) -> - ?Q("_@X@"); -expr(X) when is_atom(X) -> - ?Q(["case ets:lookup(var, _@X@) of", - " [] -> 0;", - " [{_,V}] -> V", - "end"]); -expr({plus, X, Y}) -> - ExprX = expr(X), - ExprY = expr(Y), - ?Q("_@ExprX + _@ExprY"); -expr({equal, X, Y}) -> - ExprX = expr(X), - ExprY = expr(Y), - ?Q("basicc:bool(_@ExprX == _@ExprY)"); -expr({gt, X, Y}) -> - ExprX = expr(X), - ExprY = expr(Y), - ?Q("basicc:bool(_@ExprX > _@ExprY)"); -expr({knot, X}) -> - Expr = expr(X), - ?Q(["case _@Expr of", - " 0 -> 1;", - " _ -> 0", - "end"]). - -bool(true) -> 1; -bool(false) -> 0. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/examples/merl/basic.erl erlang-17.3-dfsg/lib/syntax_tools/examples/merl/basic.erl --- erlang-18.2-dfsg/lib/syntax_tools/examples/merl/basic.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/examples/merl/basic.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -%% --------------------------------------------------------------------- -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% @author Richard Carlsson -%% @copyright 2012 Richard Carlsson -%% @doc Trivial Basic interpreter in Erlang - --module(basic). - --export([run/2]). - --include_lib("eunit/include/eunit.hrl"). - --define(INTERPRETED, true). --include("basic_test.erl"). - -run(N, Prog) -> - ets:new(var, [private, named_table]), - ets:new(line, [private, named_table, ordered_set]), - lists:foreach(fun (T) -> ets:insert(line, T) end, Prog), - goto(N). - -stop(N) -> - ets:delete(var), - ets:delete(line), - N. - -goto('$end_of_table') -> stop(0); -goto(L) -> - L1 = ets:next(line, L), - %% user-supplied line numbers might not exist - case ets:lookup(line, L) of - [{_, X}] -> - stmt(X, L1); - _ -> - goto(L1) - end. - -stmt({print, S, As}, L) -> io:format(S, [expr(A) || A <- As]), goto(L); -stmt({set, V, X}, L) -> ets:insert(var, {V, expr(X)}), goto(L); -stmt({goto, X}, _L) -> goto(expr(X)); -stmt({stop, X}, _L) -> stop(expr(X)); -stmt({iff, X, A, B}, _L) -> - case expr(X) of - 0 -> goto(B); - _ -> goto(A) - end. - -expr(X) when is_number(X) ; is_list(X) -> - X; -expr(X) when is_atom(X) -> - case ets:lookup(var, X) of - [] -> 0; - [{_,V}] -> V - end; -expr({plus, X, Y}) -> - expr(X) + expr(Y); -expr({equal, X, Y}) -> - bool(expr(X) == expr(Y)); -expr({gt, X, Y}) -> - bool(expr(X) > expr(Y)); -expr({knot, X}) -> - case expr(X) of - 0 -> 1; - _ -> 0 - end. - -bool(true) -> 1; -bool(false) -> 0. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/examples/merl/basic_test.erl erlang-17.3-dfsg/lib/syntax_tools/examples/merl/basic_test.erl --- erlang-18.2-dfsg/lib/syntax_tools/examples/merl/basic_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/examples/merl/basic_test.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -%% --------------------------------------------------------------------- -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% @author Richard Carlsson -%% @copyright 2012 Richard Carlsson -%% @doc Tests. For including in another module. - -%-module(basic_test). -%-import(basic, run/1) - --export([basic_fib/1]). - --include_lib("eunit/include/eunit.hrl"). - -basics_test_() -> - [?_assertEqual(42, run(1,[{1,{stop, 42}}])), - ?_assertEqual("hello", run(1,[{1,{stop,"hello"}}])), - ?_assertEqual(0, run(1,[{1,{print, "hello ~w", [42]}}])), - ?_assertEqual(5, run(1,[{1,{stop, {plus, 2, 3}}}])), - ?_assertEqual(5, run(1,[{1,{stop,{plus, 8, -3}}}])), - ?_assertEqual(0, run(1,[{1,{stop,{equal, 0, 1}}}])), - ?_assertEqual(1, run(1,[{1,{stop,{equal, 1, 1}}}])), - ?_assertEqual(0, run(1,[{1,{stop,{gt, 0, 1}}}])), - ?_assertEqual(0, run(1,[{1,{stop,{gt, 1, 1}}}])), - ?_assertEqual(1, run(1,[{1,{stop,{gt, 2, 1}}}])), - ?_assertEqual(0, run(1,[{1,{stop,{knot, 42}}}])), - ?_assertEqual(1, run(1,[{1,{stop,{knot, 0}}}])), - ?_assertEqual(42, run(1,[{1,{set, x, 42}}, {2,{stop,x}}])), - ?_assertEqual(17, run(1,[{1,{iff, 1, 2, 3}}, - {2,{stop, 17}}, - {3,{stop, 42}}])), - ?_assertEqual(42, run(1,[{1,{iff, 0, 2, 3}}, - {2,{stop, 17}}, - {3,{stop, 42}}])), - ?_assertEqual(17, run(1,[{1,{iff, 1, 2, 3}}, - {2,{stop, 17}}, - {3,{stop, -1}}])), - ?_assertEqual(42, run(1,[{1,{iff, 0, 2, 3}}, - {2,{stop, -1}}, - {3,{stop, 42}}])) - - - ]. - - -fib_test_() -> - [?_assertEqual(fib(N), basic_fib(N)) || N <- lists:seq(1,15) - ]. - - -fib(N) when N > 1 -> - fib(N-1) + fib(N-2); -fib(_) -> - 1. - -basic_fib(N) -> - run(1, - [{1,{set,x,0}}, - {2,{set,a,1}}, - {3,{set,b,0}}, - {10,{iff, {equal, x, N}, 20, 30}}, - {20,{stop,a}}, - {30,{print,"~w, ~w, ~w\n",[x,a,b]}}, - {31,{set,t,a}}, - {32,{set,a,{plus,a,b}}}, - {33,{set,b,t}}, - {34,{set,x,{plus,x,1}}}, - {40,{goto,10}} - ]). diff -Nru erlang-18.2-dfsg/lib/syntax_tools/examples/merl/lispc.erl erlang-17.3-dfsg/lib/syntax_tools/examples/merl/lispc.erl --- erlang-18.2-dfsg/lib/syntax_tools/examples/merl/lispc.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/examples/merl/lispc.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -%% --------------------------------------------------------------------- -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% @author Richard Carlsson -%% @copyright 2012 Richard Carlsson -%% @doc Lisp compiler in Erlang. - --module(lispc). - --export([eval/1]). - --record(st, {}). - --include("lisp_test.erl"). - --include("merl.hrl"). - -eval(Lisp) -> - compile(Lisp, tmp), - tmp:eval(). - -compile(Lisp, ModName) -> - {Code, _} = gen(Lisp, #st{}), - Main = ?Q(["() ->", - " __print = fun (S, Xs) -> io:format(S,Xs), [] end,", - " __apply = fun erlang:apply/2,", - " __plus = fun erlang:'+'/2,", - " __equal = fun lisp:equal/2,", - " __gt = fun lisp:gt/2,", - " __knot = fun lisp:knot/1,", - " __y = fun (F) ->", - " (fun (X) -> F(fun (Y) -> (X(X))(Y) end) end)", - " (fun (X) -> F(fun (Y) -> (X(X))(Y) end) end)", - " end,", - " _@Code"]), - Forms = merl_build:module_forms( - merl_build:add_function(true, eval, [Main], - merl_build:init_module(ModName))), - %% %% Write source to file for debugging - %% file:write_file(lists:concat([ModName, "_gen.erl"]), - %% erl_prettypr:format(erl_syntax:form_list(Forms), - %% [{paper,160},{ribbon,80}])), - merl:compile_and_load(Forms, [verbose]). - -var(Atom) -> - merl:var(list_to_atom("__" ++ atom_to_list(Atom))). - -gen([lambda, Ps, B], St) when is_list(Ps) -> - case lists:all(fun is_atom/1, Ps) andalso - (length(Ps) =:= length(lists:usort(Ps))) of - true -> - Vars = [var(P) || P <- Ps], - {Body, St1} = gen(B, St), - {?Q("fun (_@Vars) -> _@Body end"), St1}; - false -> - throw(bad_lambda) - end; -gen([lambda | _], _) -> - throw(bad_lambda); -gen([def, A, V, B], St) when is_atom(A) -> - Var = var(A), - {Val, St1} = gen(V, St), - {Body, St2} = gen(B, St1), - {?Q("(fun (_@Var) -> _@Body end)(_@Val)"), St2}; -gen([def | _], _) -> - throw(bad_def); -gen([quote, A], St) -> - {merl:term(A), St}; -gen([quote | _], _) -> - throw(bad_quote); -gen([iff, X, A, B], St) -> - {Cond, St1} = gen(X, St), - {True, St2} = gen(A, St1), - {False, St3} = gen(B, St2), - {?Q(["case _@Cond of", - " [] -> _@False;", - " _ -> _@True", - "end"]), - St3}; -gen([do], _) -> - throw(bad_do); -gen([do | As], St0) -> - {Body, St1} = lists:mapfoldl(fun gen/2, St0, As), - {?Q("begin _@Body end"), St1}; -gen([list | As], St0) -> - {Elem, St1} = lists:mapfoldl(fun gen/2, St0, As), - {?Q("[ _@Elem ]"), St1}; -gen([_|_]=L, St) -> - {[F | As], St1} = lists:mapfoldl(fun gen/2, St, L), - {?Q("((_@F)(_@As))"), St1}; -gen(A, St) when is_atom(A) -> - {var(A), St}; -gen(C, St) -> - {merl:term(C), St}. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/examples/merl/lisp.erl erlang-17.3-dfsg/lib/syntax_tools/examples/merl/lisp.erl --- erlang-18.2-dfsg/lib/syntax_tools/examples/merl/lisp.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/examples/merl/lisp.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,160 +0,0 @@ -%% --------------------------------------------------------------------- -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% @author Richard Carlsson -%% @copyright 2012 Richard Carlsson -%% @doc Trivial Lisp interpreter in Erlang. - --module(lisp). - --export([eval/1]). - --export([init/0, equal/2, gt/2, knot/1]). - --record(st, {env}). - --define(INTERPRETED, true). --include("lisp_test.erl"). - -eval(P) -> - {X, _} = eval(P, init()), - X. - -init() -> - Env = [{print, {builtin, fun do_print/2}} - ,{list, {builtin, fun do_list/2}} - ,{apply, {builtin, fun do_apply/2}} - ,{plus, {builtin, fun do_plus/2}} - ,{equal, {builtin, fun do_equal/2}} - ,{gt, {builtin, fun do_gt/2}} - ,{knot, {builtin, fun do_knot/2}} - ,{y, y()} - ], - #st{env=dict:from_list(Env)}. - -eval([lambda, Ps, B], #st{env=E}=St) when is_list(Ps) -> - case lists:all(fun is_atom/1, Ps) andalso - (length(Ps) =:= length(lists:usort(Ps))) of - true -> {{lambda, Ps, B, E}, St}; - false -> throw(bad_lambda) - end; -eval([lambda | _], _) -> - throw(bad_lambda); -eval([def, A, V, B], #st{env=E0}=St) when is_atom(A) -> - {V1, St1} = eval(V, St), - E1 = bind(A, V1, E0), - {X, St2} = eval(B, St1#st{env=E1}), - {X, St2#st{env=E0}}; -eval([def | _], _) -> - throw(bad_def); -eval([quote, A], St) -> - {A, St}; -eval([quote | _], _) -> - throw(bad_quote); -eval([iff, X, A, B], St) -> - case eval(X, St) of - {[], St1} -> eval(B, St1); - {_, St1} -> eval(A, St1) - end; -eval([do], _St0) -> - throw(bad_do); -eval([do | As], St0) -> - lists:foldl(fun (X, {_,St}) -> eval(X, St) end, {[],St0}, As); -eval([_|_]=L, St) -> - {[F | As], St1} = lists:mapfoldl(fun eval/2, St, L), - call(F, As, St1); -eval(A, St) when is_atom(A) -> - {deref(A, St), St}; -eval(C, St) -> - {C, St}. - -%% UTILITY FUNCTIONS - -deref(A, #st{env=E}) -> - case dict:find(A, E) of - {ok, V} -> V; - error -> throw({undefined, A}) - end. - -bind(A, V, E) -> - dict:store(A, V, E). - -bind_args([P | Ps], [A | As], E) -> - bind_args(Ps, As, dict:store(P, A, E)); -bind_args([], [], E) -> - E; -bind_args(_, _, _) -> - throw(bad_arity). - -call({lambda, Ps, B, E}, As, #st{env=E0}=St) -> - {X, St1} = eval(B, St#st{env=bind_args(Ps, As, E)}), - {X, St1#st{env=E0}}; -call({builtin, F}, As, St) -> - F(As, St); -call(X, _, _) -> - throw({bad_fun, X}). - -bool(true) -> 1; -bool(false) -> []. - -%% BUILTINS - -y() -> - {Y, _} = eval([lambda, [f], - [[lambda, [x], [f, [lambda, [y], [[x, x], y]]]], - [lambda, [x], [f, [lambda, [y], [[x, x], y]]]]]], - #st{env=dict:new()}), - Y. - -do_print([S | Xs], St) -> - io:format(S, Xs), - {[], St}; -do_print(_, _) -> - throw(bad_print). - -do_list(As, St) -> - {As, St}. - -do_apply([F, As], St) -> - call(F, As, St); -do_apply(_, _) -> - throw(bad_apply). - -do_plus([X, Y], St) when is_number(X), is_number(Y) -> - {X + Y, St}; -do_plus(As, _) -> - throw({bad_plus, As}). - -do_equal([X, Y], St) -> - {equal(X, Y), St}; -do_equal(As, _) -> - throw({bad_equal, As}). - -equal(X, Y) -> - bool(X =:= Y). - -do_gt([X, Y], St) -> - {gt(X, Y), St}; -do_gt(As, _) -> - throw({bad_gt, As}). - -gt(X, Y) -> - bool(X > Y). - -do_knot([X], St) -> - {knot(X), St}; -do_knot(As, _) -> - throw({bad_gt, As}). - -knot([]) -> - 1; -knot(_) -> - []. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/examples/merl/lisp_test.erl erlang-17.3-dfsg/lib/syntax_tools/examples/merl/lisp_test.erl --- erlang-18.2-dfsg/lib/syntax_tools/examples/merl/lisp_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/examples/merl/lisp_test.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -%% --------------------------------------------------------------------- -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% @author Richard Carlsson -%% @copyright 2012 Richard Carlsson -%% @doc Tests. For including in another module. - -%-module(lisp_test). -%-import(lisp, eval/1) - --export([fib/1, lisp_fib/1]). - --include_lib("eunit/include/eunit.hrl"). - -basics_test_() -> - [?_assertEqual(42, eval(42)), - ?_assertEqual("hello", eval([quote, "hello"])), - ?_assertEqual(print, eval([quote, print])), - ?_assertMatch([17,[1,2],42], eval([list,17,[list,1,2],42])), - ?_assertEqual([], eval([print, [quote, "hello ~w"], [list, 42]])), - ?_assertEqual(5, eval([plus, 2, 3])), - ?_assertEqual(5, eval([plus, 8, -3])), - ?_assertEqual([], eval([equal, 0, 1])), - ?_assertEqual(1, eval([equal, 1, 1])), - ?_assertEqual([], eval([gt, 0, 1])), - ?_assertEqual([], eval([gt, 1, 1])), - ?_assertEqual(1, eval([gt, 2, 1])), - ?_assertEqual([], eval([knot, 42])), - ?_assertEqual(1, eval([knot, []])), - ?_assertEqual(42, eval([do, 17, 42])), - ?_assertEqual([], eval([apply, print, [quote, ["~p", [42]]]])), - ?_assertEqual(42, eval([iff, [], 17, 42])), - ?_assertEqual(17, eval([iff, 1, 17, 42])), - ?_assertEqual(42, eval([iff, [], [apply], 42])), - ?_assertEqual(17, eval([iff, 1, 17, [apply]])), - ?_assertEqual(17, eval([def, foo, 17, foo])), - ?_assertEqual(17, eval([def, bar, 42, [def, foo, 17, foo]])), - ?_assertEqual(42, eval([def, bar, 42, [def, foo, 17, bar]])), - ?_assertEqual(17, eval([def, foo, 42, [def, foo, 17, foo]])) - ]. - --ifdef(INTERPRETED). -interpreter_basics_test_() -> - [?_assertThrow({undefined, foo}, eval(foo)), - ?_assertMatch({builtin,_}, eval(print)), - ?_assertThrow(bad_do, eval([do])), - ?_assertThrow(bad_apply, eval([apply])), - ?_assertThrow({undefined, foo}, eval([def, bar, 17, foo])) - ]. - -interpreter_lambda_test_() -> - [?_assertMatch({lambda,_,_,_}, eval([lambda, [], 42])), - ?_assertMatch({lambda,_,_,_}, eval([lambda, [x], x])), - ?_assertMatch({lambda,_,_,_}, eval([lambda, [x,y], 42])) - ]. --endif. - -lambda_test_() -> - [?_assertThrow(bad_lambda, eval([lambda])), - ?_assertThrow(bad_lambda, eval([lambda, []])), - ?_assertThrow(bad_lambda, eval([lambda, [], 17, 42])), - ?_assertThrow(bad_lambda, eval([lambda, 17, 42])), - ?_assertThrow(bad_lambda, eval([lambda, [17], 42])), - ?_assertThrow(bad_lambda, eval([lambda, [foo, foo], 42])), - ?_assertEqual(42, eval([[lambda, [x], x], 42])), - ?_assertEqual([42, 17], eval([[lambda, [x], [list, x, 17]], 42])), - ?_assertEqual([42, 17], eval([def, f, [def, y, 42, - [lambda, [x], [list, y, x]]], - [f, 17]])) - ]. - -fib_test_() -> - [?_assertEqual(fib(N), lisp_fib(N)) || N <- lists:seq(1,15) - ]. - - -fib(N) when N > 1 -> - fib(N-1) + fib(N-2); -fib(_) -> - 1. - -lisp_fib(N) -> - eval([def, fib, - [y, [lambda, [f], [lambda, [x], - [iff, [gt, x, 1], - [plus, [f, [plus,x,-1]], [f, [plus,x,-2]]], - 1] - ]]], - [fib, N] - ]). diff -Nru erlang-18.2-dfsg/lib/syntax_tools/examples/merl/Makefile erlang-17.3-dfsg/lib/syntax_tools/examples/merl/Makefile --- erlang-18.2-dfsg/lib/syntax_tools/examples/merl/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/examples/merl/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -EBIN=../../ebin -INCLUDES=../../include -SOURCES=merl_build.erl lisp.erl lispc.erl basic.erl basicc.erl -HEADERS=$(INCLUDES)/merl.hrl -OBJECTS=$(SOURCES:%.erl=%.beam) -ERLC_FLAGS=+debug_info -I$(INCLUDES) -pa $(EBIN) - -all: $(OBJECTS) test - -%.beam: %.erl $(HEADERS) Makefile - erlc $(ERLC_FLAGS) -o ./ $< - -# additional dependencies due to the parse transform -lispc.beam basicc.beam: $(EBIN)/merl_transform.beam $(EBIN)/merl.beam - -clean: - -rm -f $(OBJECTS) - -test: - erl -noshell -pa $(EBIN) \ - -eval 'eunit:test([lisp, lispc, basic, basicc],[])' \ - -s init stop diff -Nru erlang-18.2-dfsg/lib/syntax_tools/examples/merl/merl_build.erl erlang-17.3-dfsg/lib/syntax_tools/examples/merl/merl_build.erl --- erlang-18.2-dfsg/lib/syntax_tools/examples/merl/merl_build.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/examples/merl/merl_build.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -%% --------------------------------------------------------------------- -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% @author Richard Carlsson -%% @copyright 2012 Richard Carlsson -%% @doc Making it simple to build a module with merl - --module(merl_build). - --export([init_module/1, module_forms/1, add_function/4, add_record/3, - add_import/3, add_attribute/3, set_file/2]). - --import(merl, [term/1]). - --include("merl.hrl"). - --type filename() :: string(). - --record(module, { name :: atom() - , file :: filename() - , exports=[] :: [{atom(), integer()}] - , imports=[] :: [{atom(), [{atom(), integer()}]}] - , attributes=[] :: [{filename(), atom(), [term()]}] - , records=[] :: [{filename(), atom(), - [{atom(), merl:tree()}]}] - , functions=[] :: [{filename(), atom(), [merl:tree()]}] - }). - -%% TODO: init module from a list of forms (from various sources) - -%% @doc Create a new module representation, using the given module name. -init_module(Name) when is_atom(Name) -> - %% use the module name as the default file name - better than nothing - #module{name=Name, file=atom_to_list(Name)}. - -%% @doc Get the list of syntax tree forms for a module representation. This can -%% be passed to compile/2. -module_forms(#module{name=Name, - exports=Xs, - imports=Is, - records=Rs, - attributes=As, - functions=Fs}) - when is_atom(Name), Name =/= undefined -> - Module = ?Q("-module('@Name@')."), - Exported = [erl_syntax:arity_qualifier(term(N), term(A)) - || {N,A} <- ordsets:from_list(Xs)], - Export = ?Q("-export(['@_Exported'/1])."), - Imports = [?Q("-import('@M@', ['@_NAs'/1]).") - || {M, Ns} <- Is, - NAs <- [[erl_syntax:arity_qualifier(term(N), term(A)) - || {N,A} <- ordsets:from_list(Ns)]] - ], - Attrs = [?Q("-file(\"'@File@\",1). -'@N@'('@T@').") - || {File, N, T} <- lists:reverse(As)], - Records = [?Q("-file(\"'@File@\",1). -record('@N@',{'@_RFs'=[]}).") - || {File, N, Es} <- lists:reverse(Rs), - RFs <- [[erl_syntax:record_field(term(F), V) - || {F,V} <- Es]] - ], - Functions = [?Q("-file(\"'@File@\",1). '@_F'() -> [].") - || {File, N, Cs} <- lists:reverse(Fs), - F <- [erl_syntax:function(term(N), Cs)]], - lists:flatten([Module, Export, Imports, Attrs, Records, Functions]). - -%% @doc Set the source file name for all subsequently added functions, -%% records, and attributes. -set_file(Filename, #module{}=M) -> - M#module{file=filename:flatten(Filename)}. - -%% @doc Add a function to a module representation. -add_function(Exported, Name, Clauses, - #module{file=File, exports=Xs, functions=Fs}=M) - when is_boolean(Exported), is_atom(Name), Clauses =/= [] -> - Arity = length(erl_syntax:clause_patterns(hd(Clauses))), - Xs1 = case Exported of - true -> [{Name,Arity} | Xs]; - false -> Xs - end, - M#module{exports=Xs1, functions=[{File, Name, Clauses} | Fs]}. - -%% @doc Add a record declaration to a module representation. -add_record(Name, Fields, #module{file=File, records=Rs}=M) - when is_atom(Name) -> - M#module{records=[{File, Name, Fields} | Rs]}. - -%% @doc Add a "wild" attribute, such as `-compile(Opts)' to a module -%% representation. Note that such attributes can only have a single argument. -add_attribute(Name, Term, #module{file=File, attributes=As}=M) - when is_atom(Name) -> - M#module{attributes=[{File, Name, Term} | As]}. - -%% @doc Add an import declaration to a module representation. -add_import(From, Names, #module{imports=Is}=M) - when is_atom(From), is_list(Names) -> - M#module{imports=[{From, Names} | Is]}. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/include/merl.hrl erlang-17.3-dfsg/lib/syntax_tools/include/merl.hrl --- erlang-18.2-dfsg/lib/syntax_tools/include/merl.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/include/merl.hrl 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -%% --------------------------------------------------------------------- -%% Header file for merl -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. - --ifndef(MERL_HRL). - - -%% Quoting a piece of code --define(Q(Text), merl:quote(?LINE, Text)). - -%% Quasi-quoting code, substituting metavariables listed in Env --define(Q(Text, Env), merl:qquote(?LINE, Text, Env)). - - --ifndef(MERL_NO_TRANSFORM). --compile({parse_transform, merl_transform}). --endif. - - --endif. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/Makefile erlang-17.3-dfsg/lib/syntax_tools/Makefile --- erlang-18.2-dfsg/lib/syntax_tools/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/epp_dodger.erl erlang-17.3-dfsg/lib/syntax_tools/src/epp_dodger.erl --- erlang-18.2-dfsg/lib/syntax_tools/src/epp_dodger.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/epp_dodger.erl 2014-09-16 19:10:57.000000000 +0000 @@ -88,7 +88,7 @@ %% This is a so-called Erlang I/O ErrorInfo structure; see the {@link %% //stdlib/io} module for details. --type errorinfo() :: {integer(), atom(), term()}. +-type errorinfo() :: term(). % {integer(), atom(), term()}. -type option() :: atom() | {atom(), term()}. @@ -208,8 +208,8 @@ try Parser(Dev, 1, Options) after ok = file:close(Dev) end; - {error, Error} -> - {error, {0, file, Error}} % defer to file:format_error/1 + {error, _} = Error -> + Error end. find_invalid_unicode([H|T]) -> @@ -454,7 +454,7 @@ {L, ?MODULE, Desc}. start_pos([T | _Ts], _L) -> - erl_anno:line(element(2, T)); + element(2, T); start_pos([], L) -> L. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/erl_prettypr.erl erlang-17.3-dfsg/lib/syntax_tools/src/erl_prettypr.erl --- erlang-18.2-dfsg/lib/syntax_tools/src/erl_prettypr.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/erl_prettypr.erl 2014-09-16 19:10:57.000000000 +0000 @@ -50,7 +50,8 @@ | fun((erl_syntax:syntaxTree(), _, _) -> prettypr:document()). -type clause_t() :: 'case_expr' | 'cond_expr' | 'fun_expr' | 'if_expr' | 'receive_expr' | 'try_expr' - | {'function', prettypr:document()}. + | {'function', prettypr:document()} + | {'rule', prettypr:document()}. -record(ctxt, {prec = 0 :: integer(), sub_indent = 2 :: non_neg_integer(), @@ -586,6 +587,8 @@ make_case_clause(D1, D2, D3, Ctxt); try_expr -> make_case_clause(D1, D2, D3, Ctxt); + {rule, N} -> + make_rule_clause(N, D1, D2, D3, Ctxt); undefined -> %% If a clause is formatted out of context, we %% use a "fun-expression" clause style. @@ -848,10 +851,14 @@ floating(text(".")), lay(erl_syntax:record_access_field(Node), set_prec(Ctxt, PrecR))), - T = erl_syntax:record_access_type(Node), - D3 = beside(beside(floating(text("#")), - lay(T, reset_prec(Ctxt))), - D2), + D3 = case erl_syntax:record_access_type(Node) of + none -> + D2; + T -> + beside(beside(floating(text("#")), + lay(T, reset_prec(Ctxt))), + D2) + end, maybe_parentheses(beside(D1, D3), Prec, Ctxt); record_expr -> @@ -919,6 +926,15 @@ D2 = lay(erl_syntax:map_field_exact_value(Node), Ctxt1), par([D1, floating(text(":=")), D2], Ctxt1#ctxt.break_indent); + rule -> + %% Comments on the name will be repeated; cf. + %% `function'. + Ctxt1 = reset_prec(Ctxt), + D1 = lay(erl_syntax:rule_name(Node), Ctxt1), + D2 = lay_clauses(erl_syntax:rule_clauses(Node), + {rule, D1}, Ctxt1), + beside(D2, floating(text("."))); + size_qualifier -> Ctxt1 = set_prec(Ctxt, max_prec()), D1 = lay(erl_syntax:size_qualifier_body(Node), Ctxt1), @@ -1057,6 +1073,10 @@ beside(N, D) end. +make_rule_clause(N, P, G, B, Ctxt) -> + D = make_fun_clause_head(N, P, Ctxt), + append_rule_body(B, append_guard(G, D, Ctxt), Ctxt). + make_case_clause(P, G, B, Ctxt) -> append_clause_body(B, append_guard(G, P, Ctxt), Ctxt). @@ -1072,6 +1092,9 @@ append_clause_body(B, D, Ctxt) -> append_clause_body(B, D, floating(text(" ->")), Ctxt). +append_rule_body(B, D, Ctxt) -> + append_clause_body(B, D, floating(text(" :-")), Ctxt). + append_clause_body(B, D, S, Ctxt) -> sep([beside(D, S), nest(Ctxt#ctxt.break_indent, B)]). diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/erl_recomment.erl erlang-17.3-dfsg/lib/syntax_tools/src/erl_recomment.erl --- erlang-18.2-dfsg/lib/syntax_tools/src/erl_recomment.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/erl_recomment.erl 2014-09-16 19:10:57.000000000 +0000 @@ -123,6 +123,7 @@ form_list -> Tree1 = erl_syntax:flatten_form_list(Tree), Node = build_tree(Tree1), + %% Here we make a small assumption about the substructure of %% a `form_list' tree: it has exactly one group of subtrees. [Node1] = node_subtrees(Node), @@ -752,13 +753,7 @@ {_, L, _} when is_integer(L) -> L; Pos -> - try erl_anno:line(Pos) of - Line -> - Line - catch - _:_ -> - exit({bad_position, Pos}) - end + exit({bad_position, Pos}) end. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/erl_syntax.erl erlang-17.3-dfsg/lib/syntax_tools/src/erl_syntax.erl --- erlang-18.2-dfsg/lib/syntax_tools/src/erl_syntax.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/erl_syntax.erl 2014-09-16 19:10:57.000000000 +0000 @@ -254,6 +254,7 @@ receive_expr_action/1, receive_expr_clauses/1, receive_expr_timeout/1, + record_access/2, record_access/3, record_access_argument/1, record_access_field/1, @@ -270,6 +271,10 @@ record_index_expr/2, record_index_expr_field/1, record_index_expr_type/1, + rule/2, + rule_arity/1, + rule_clauses/1, + rule_name/1, size_qualifier/2, size_qualifier_argument/1, size_qualifier_body/1, @@ -467,16 +472,19 @@ %% record_field %% %% record_index_expr +%% rule %% size_qualifier %% string -%% text %% +%% text %% try_expr %% tuple %% underscore -%% variable %% +%% variable %% warning_marker +%% +%% %% %% %% @@ -532,6 +540,7 @@ %% @see record_expr/2 %% @see record_field/2 %% @see record_index_expr/2 +%% @see rule/2 %% @see size_qualifier/2 %% @see string/1 %% @see text/1 @@ -598,8 +607,10 @@ {record, _, _, _, _} -> record_expr; {record, _, _, _} -> record_expr; {record_field, _, _, _, _} -> record_access; + {record_field, _, _, _} -> record_access; {record_index, _, _, _} -> record_index_expr; {remote, _, _, _} -> module_qualifier; + {rule, _, _, _, _} -> rule; {'try', _, _, _, _, _} -> try_expr; {tuple, _, _} -> tuple; _ -> @@ -658,9 +669,6 @@ operator -> true; % nonstandard type string -> true; text -> true; % nonstandard type - map_expr -> - map_expr_fields(Node) =:= [] andalso - map_expr_argument(Node) =:= none; tuple -> tuple_elements(Node) =:= []; underscore -> true; variable -> true; @@ -682,9 +690,10 @@ %% `comment' %% `error_marker' %% `eof_marker' -%% %% `form_list' +%% %% `function' +%% `rule' %% `warning_marker' %% `text' %% @@ -697,6 +706,7 @@ %% @see error_marker/1 %% @see form_list/1 %% @see function/2 +%% @see rule/2 %% @see warning_marker/1 -spec is_form(syntaxTree()) -> boolean(). @@ -709,6 +719,7 @@ eof_marker -> true; error_marker -> true; form_list -> true; + rule -> true; warning_marker -> true; text -> true; _ -> false @@ -3309,11 +3320,6 @@ [set_pos( list(unfold_function_names(Data, Pos)), Pos)]; - optional_callbacks -> - D = try list(unfold_function_names(Data, Pos)) - catch _:_ -> abstract(Data) - end, - [set_pos(D, Pos)]; import -> {Module, Imports} = Data, [set_pos(atom(Module), Pos), @@ -3466,6 +3472,7 @@ %% @see function_clauses/1 %% @see function_arity/1 %% @see is_form/1 +%% @see rule/2 %% Don't use the name 'function' for this record, to avoid confusion with %% the tuples on the form {function,Name,Arity} used by erl_parse. @@ -4295,32 +4302,49 @@ %% ===================================================================== -%% @doc Creates an abstract record field access expression. The result -%% represents "Argument#Type.Field". +%% @equiv record_access(Argument, none, Field) + +-spec record_access(syntaxTree(), syntaxTree()) -> syntaxTree(). + +record_access(Argument, Field) -> + record_access(Argument, none, Field). + + +%% ===================================================================== +%% @doc Creates an abstract record field access expression. If +%% `Type' is not `none', the result represents +%% "Argument#Type.Field". +%% +%% If `Type' is `none', the result represents +%% "Argument.Field". This is a special +%% form only allowed within Mnemosyne queries. %% +%% @see record_access/2 %% @see record_access_argument/1 %% @see record_access_type/1 %% @see record_access_field/1 %% @see record_expr/3 -record(record_access, {argument :: syntaxTree(), - type :: syntaxTree(), + type :: 'none' | syntaxTree(), field :: syntaxTree()}). %% type(Node) = record_access %% data(Node) = #record_access{argument :: Argument, type :: Type, %% field :: Field} %% -%% Argument = Type = Field = syntaxTree() +%% Argument = Field = syntaxTree() +%% Type = none | syntaxTree() %% %% `erl_parse' representation: %% %% {record_field, Pos, Argument, Type, Field} +%% {record_field, Pos, Argument, Field} %% %% Argument = Field = erl_parse() %% Type = atom() --spec record_access(syntaxTree(), syntaxTree(), syntaxTree()) -> +-spec record_access(syntaxTree(), 'none' | syntaxTree(), syntaxTree()) -> syntaxTree(). record_access(Argument, Type, Field) -> @@ -4333,11 +4357,16 @@ Argument = record_access_argument(Node), Type = record_access_type(Node), Field = record_access_field(Node), - case type(Type) of - atom -> - {record_field, Pos, Argument, concrete(Type), Field}; - _ -> - Node + if Type =:= none -> + {record_field, Pos, Argument, Field}; + true -> + case type(Type) of + atom -> + {record_field, Pos, + Argument, concrete(Type), Field}; + _ -> + Node + end end. @@ -4350,6 +4379,8 @@ record_access_argument(Node) -> case unwrap(Node) of + {record_field, _, Argument, _} -> + Argument; {record_field, _, Argument, _, _} -> Argument; Node1 -> @@ -4358,14 +4389,21 @@ %% ===================================================================== -%% @doc Returns the type subtree of a `record_access' node. +%% @doc Returns the type subtree of a `record_access' node, +%% if any. If `Node' represents +%% "Argument.Field", `none' +%% is returned, otherwise if `Node' represents +%% "Argument#Type.Field", +%% `Type' is returned. %% %% @see record_access/3 --spec record_access_type(syntaxTree()) -> syntaxTree(). +-spec record_access_type(syntaxTree()) -> 'none' | syntaxTree(). record_access_type(Node) -> case unwrap(Node) of + {record_field, _, _, _} -> + none; {record_field, Pos, _, Type, _} -> set_pos(atom(Type), Pos); Node1 -> @@ -4382,6 +4420,8 @@ record_access_field(Node) -> case unwrap(Node) of + {record_field, _, _, Field} -> + Field; {record_field, _, _, _, Field} -> Field; Node1 -> @@ -4760,6 +4800,117 @@ %% ===================================================================== +%% @doc Creates an abstract Mnemosyne rule. If `Clauses' is +%% `[C1, ..., Cn]', the results represents +%% "Name C1; ...; Name +%% Cn.". More exactly, if each `Ci' +%% represents "(Pi1, ..., Pim) Gi -> +%% Bi", then the result represents +%% "Name(P11, ..., P1m) G1 :- +%% B1; ...; Name(Pn1, ..., Pnm) +%% Gn :- Bn.". Rules are source code forms. +%% +%% @see rule_name/1 +%% @see rule_clauses/1 +%% @see rule_arity/1 +%% @see is_form/1 +%% @see function/2 + +-record(rule, {name :: syntaxTree(), clauses :: [syntaxTree()]}). + +%% type(Node) = rule +%% data(Node) = #rule{name :: Name, clauses :: Clauses} +%% +%% Name = syntaxTree() +%% Clauses = [syntaxTree()] +%% +%% (See `function' for notes on why the arity is not stored.) +%% +%% `erl_parse' representation: +%% +%% {rule, Pos, Name, Arity, Clauses} +%% +%% Name = atom() +%% Arity = integer() +%% Clauses = [Clause] \ [] +%% Clause = {clause, ...} +%% +%% where the number of patterns in each clause should be equal to +%% the integer `Arity'; see `clause' for documentation on +%% `erl_parse' clauses. + +-spec rule(syntaxTree(), [syntaxTree()]) -> syntaxTree(). + +rule(Name, Clauses) -> + tree(rule, #rule{name = Name, clauses = Clauses}). + +revert_rule(Node) -> + Name = rule_name(Node), + Clauses = [revert_clause(C) || C <- rule_clauses(Node)], + Pos = get_pos(Node), + case type(Name) of + atom -> + A = rule_arity(Node), + {rule, Pos, concrete(Name), A, Clauses}; + _ -> + Node + end. + + +%% ===================================================================== +%% @doc Returns the name subtree of a `rule' node. +%% +%% @see rule/2 + +-spec rule_name(syntaxTree()) -> syntaxTree(). + +rule_name(Node) -> + case unwrap(Node) of + {rule, Pos, Name, _, _} -> + set_pos(atom(Name), Pos); + Node1 -> + (data(Node1))#rule.name + end. + +%% ===================================================================== +%% @doc Returns the list of clause subtrees of a `rule' node. +%% +%% @see rule/2 + +-spec rule_clauses(syntaxTree()) -> [syntaxTree()]. + +rule_clauses(Node) -> + case unwrap(Node) of + {rule, _, _, _, Clauses} -> + Clauses; + Node1 -> + (data(Node1))#rule.clauses + end. + +%% ===================================================================== +%% @doc Returns the arity of a `rule' node. The result is the +%% number of parameter patterns in the first clause of the rule; +%% subsequent clauses are ignored. +%% +%% An exception is thrown if `rule_clauses(Node)' returns +%% an empty list, or if the first element of that list is not a syntax +%% tree `C' of type `clause' such that +%% `clause_patterns(C)' is a nonempty list. +%% +%% @see rule/2 +%% @see rule_clauses/1 +%% @see clause/3 +%% @see clause_patterns/1 + +-spec rule_arity(syntaxTree()) -> arity(). + +rule_arity(Node) -> + %% Note that this never accesses the arity field of + %% `erl_parse' rule nodes. + length(clause_patterns(hd(rule_clauses(Node)))). + + +%% ===================================================================== %% @doc Creates an abstract generator. The result represents %% "Pattern <- Body". %% @@ -5942,9 +6093,6 @@ nil(); abstract(T) when is_tuple(T) -> tuple(abstract_list(tuple_to_list(T))); -abstract(T) when is_map(T) -> - map_expr([map_field_assoc(abstract(Key),abstract(Value)) - || {Key,Value} <- maps:to_list(T)]); abstract(T) when is_binary(T) -> binary([binary_field(integer(B)) || B <- binary_to_list(T)]); abstract(T) -> @@ -5981,13 +6129,6 @@ %% {@link char/1} function to explicitly create an abstract %% character.) %% -%% Note: `arity_qualifier' nodes are recognized. This is to follow The -%% Erlang Parser when it comes to wild attributes: both {F, A} and F/A -%% are recognized, which makes it possible to turn wild attributes -%% into recognized attributes without at the same time making it -%% impossible to compile files using the new syntax with the old -%% version of the Erlang Compiler. -%% %% @see abstract/1 %% @see is_literal/1 %% @see char/1 @@ -6013,14 +6154,6 @@ | concrete(list_tail(Node))]; tuple -> list_to_tuple(concrete_list(tuple_elements(Node))); - map_expr -> - As = [tuple([map_field_assoc_name(F), - map_field_assoc_value(F)]) || F <- map_expr_fields(Node)], - M0 = maps:from_list(concrete_list(As)), - case map_expr_argument(Node) of - none -> M0; - Node0 -> maps:merge(concrete(Node0),M0) - end; binary -> Fs = [revert_binary_field( binary_field(binary_field_body(F), @@ -6037,20 +6170,6 @@ {value, concrete(F), []} end, [], true), B; - arity_qualifier -> - A = erl_syntax:arity_qualifier_argument(Node), - case erl_syntax:type(A) of - integer -> - F = erl_syntax:arity_qualifier_body(Node), - case erl_syntax:type(F) of - atom -> - {F, A}; - _ -> - erlang:error({badarg, Node}) - end; - _ -> - erlang:error({badarg, Node}) - end; _ -> erlang:error({badarg, Node}) end. @@ -6090,31 +6209,10 @@ is_literal(list_head(T)) andalso is_literal(list_tail(T)); tuple -> lists:all(fun is_literal/1, tuple_elements(T)); - map_expr -> - case map_expr_argument(T) of - none -> true; - Arg -> is_literal(Arg) - end andalso lists:all(fun is_literal_map_field/1, map_expr_fields(T)); - binary -> - lists:all(fun is_literal_binary_field/1, binary_fields(T)); _ -> false end. -is_literal_binary_field(F) -> - case binary_field_types(F) of - [] -> is_literal(binary_field_body(F)); - _ -> false - end. - -is_literal_map_field(F) -> - case type(F) of - map_field_assoc -> - is_literal(map_field_assoc_name(F)) andalso - is_literal(map_field_assoc_value(F)); - map_field_exact -> - false - end. %% ===================================================================== %% @doc Returns an `erl_parse'-compatible representation of a @@ -6244,6 +6342,8 @@ revert_record_expr(Node); record_index_expr -> revert_record_index_expr(Node); + rule -> + revert_rule(Node); string -> revert_string(Node); try_expr -> @@ -6500,9 +6600,15 @@ receive_expr_action(T)] end; record_access -> - [[record_access_argument(T)], - [record_access_type(T)], - [record_access_field(T)]]; + case record_access_type(T) of + none -> + [[record_access_argument(T)], + [record_access_field(T)]]; + R -> + [[record_access_argument(T)], + [R], + [record_access_field(T)]] + end; record_expr -> case record_expr_argument(T) of none -> @@ -6523,6 +6629,8 @@ record_index_expr -> [[record_index_expr_type(T)], [record_index_expr_field(T)]]; + rule -> + [[rule_name(T)], rule_clauses(T)]; size_qualifier -> [[size_qualifier_body(T)], [size_qualifier_argument(T)]]; @@ -6617,6 +6725,8 @@ make_tree(prefix_expr, [[F], [A]]) -> prefix_expr(F, A); make_tree(receive_expr, [C]) -> receive_expr(C); make_tree(receive_expr, [C, [E], A]) -> receive_expr(C, E, A); +make_tree(record_access, [[E], [F]]) -> + record_access(E, F); make_tree(record_access, [[E], [T], [F]]) -> record_access(E, T, F); make_tree(record_expr, [[T], F]) -> record_expr(T, F); @@ -6625,6 +6735,7 @@ make_tree(record_field, [[N], [E]]) -> record_field(N, E); make_tree(record_index_expr, [[T], [F]]) -> record_index_expr(T, F); +make_tree(rule, [[N], C]) -> rule(N, C); make_tree(size_qualifier, [[N], [A]]) -> size_qualifier(N, A); make_tree(try_expr, [B, C, H, A]) -> try_expr(B, C, H, A); make_tree(tuple, [E]) -> tuple(E). diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/erl_syntax_lib.erl erlang-17.3-dfsg/lib/syntax_tools/src/erl_syntax_lib.erl --- erlang-18.2-dfsg/lib/syntax_tools/src/erl_syntax_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/erl_syntax_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -35,7 +35,8 @@ analyze_function_name/1, analyze_implicit_fun/1, analyze_import_attribute/1, analyze_module_attribute/1, analyze_record_attribute/1, analyze_record_expr/1, - analyze_record_field/1, analyze_wild_attribute/1, annotate_bindings/1, + analyze_record_field/1, analyze_rule/1, + analyze_wild_attribute/1, annotate_bindings/1, annotate_bindings/2, fold/3, fold_subtrees/3, foldl_listlist/3, function_name_expansions/1, is_fail_expr/1, limit/2, limit/3, map/2, map_subtrees/2, mapfold/3, mapfold_subtrees/3, @@ -526,6 +527,8 @@ vann_try_expr(Tree, Env); function -> vann_function(Tree, Env); + rule -> + vann_rule(Tree, Env); fun_expr -> vann_fun_expr(Tree, Env); list_comp -> @@ -566,6 +569,15 @@ Bound = [], {ann_bindings(Tree1, Env, Bound, Free), Bound, Free}. +vann_rule(Tree, Env) -> + Cs = erl_syntax:rule_clauses(Tree), + {Cs1, {_, Free}} = vann_clauses(Cs, Env), + N = erl_syntax:rule_name(Tree), + {N1, _, _} = vann(N, Env), + Tree1 = rewrite(Tree, erl_syntax:rule(N1, Cs1)), + Bound = [], + {ann_bindings(Tree1, Env, Bound, Free), Bound, Free}. + vann_fun_expr(Tree, Env) -> Cs = erl_syntax:fun_expr_clauses(Tree), {Cs1, {_, Free}} = vann_clauses(Cs, Env), @@ -934,7 +946,7 @@ %% %% Forms = syntaxTree() | [syntaxTree()] %% Key = attributes | errors | exports | functions | imports -%% | module | records | warnings +%% | module | records | rules | warnings %% %% @doc Analyzes a sequence of "program forms". The given %% `Forms' may be a single syntax tree of type @@ -1035,6 +1047,16 @@ %% that each record name occurs at most once in the list. The %% order of listing is not defined. %% +%%
    `{rules, Rules}'
    +%%
      +%%
    • `Rules = [{atom(), integer()}]'
    • +%%
    +%% `Rules' is a list of the names of the rules that are +%% defined in `Forms' (cf. +%% `analyze_rule/1'). We do not guarantee that each +%% name occurs at most once in the list. The order of listing is +%% not defined.
    +%% %%
    `{warnings, Warnings}'
    %%
      %%
    • `Warnings = [term()]'
    • @@ -1052,11 +1074,12 @@ %% @see analyze_import_attribute/1 %% @see analyze_record_attribute/1 %% @see analyze_function/1 +%% @see analyze_rule/1 %% @see erl_syntax:error_marker_info/1 %% @see erl_syntax:warning_marker_info/1 -type key() :: 'attributes' | 'errors' | 'exports' | 'functions' | 'imports' - | 'module' | 'records' | 'warnings'. + | 'module' | 'records' | 'rules' | 'warnings'. -type info_pair() :: {key(), term()}. -spec analyze_forms(erl_syntax:forms()) -> [info_pair()]. @@ -1076,6 +1099,8 @@ Info; {function, Name} -> finfo_add_function(Name, Info); + {rule, Name} -> + finfo_add_rule(Name, Info); {error_marker, Data} -> finfo_add_error(Data, Info); {warning_marker, Data} -> @@ -1111,7 +1136,8 @@ records = [] :: [{atom(), [{atom(), field_default()}]}], errors = [] :: [term()], warnings = [] :: [term()], - functions = [] :: [{atom(), arity()}]}). + functions = [] :: [{atom(), arity()}], + rules = [] :: [{atom(), arity()}]}). -type field_default() :: 'none' | erl_syntax:syntaxTree(). @@ -1157,6 +1183,9 @@ finfo_add_function(F, Info) -> Info#forms{functions = [F | Info#forms.functions]}. +finfo_add_rule(F, Info) -> + Info#forms{rules = [F | Info#forms.rules]}. + finfo_to_list(Info) -> [{Key, Value} || {Key, {value, Value}} <- @@ -1168,7 +1197,8 @@ {records, list_value(Info#forms.records)}, {errors, list_value(Info#forms.errors)}, {warnings, list_value(Info#forms.warnings)}, - {functions, list_value(Info#forms.functions)} + {functions, list_value(Info#forms.functions)}, + {rules, list_value(Info#forms.rules)} ]]. list_value([]) -> @@ -1199,6 +1229,10 @@ %% %%
      where `Info = analyze_function(Node)'.
      %% +%%
      `{rule, Info}'
      +%% +%%
      where `Info = analyze_rule(Node)'.
      +%% %%
      `{warning_marker, Info}'
      %% %%
      where `Info = @@ -1211,6 +1245,7 @@ %% %% @see analyze_attribute/1 %% @see analyze_function/1 +%% @see analyze_rule/1 %% @see erl_syntax:is_form/1 %% @see erl_syntax:error_marker_info/1 %% @see erl_syntax:warning_marker_info/1 @@ -1223,6 +1258,8 @@ {attribute, analyze_attribute(Node)}; function -> {function, analyze_function(Node)}; + rule -> + {rule, analyze_rule(Node)}; error_marker -> {error_marker, erl_syntax:error_marker_info(Node)}; warning_marker -> @@ -1632,7 +1669,7 @@ %%
      `record_expr':
      %%
      `{atom(), [{atom(), Value}]}'
      %%
      `record_access':
      -%%
      `{atom(), atom()}'
      +%%
      `{atom(), atom()} | atom()'
      %%
      `record_index_expr':
      %%
      `{atom(), atom()}'
      %% @@ -1642,7 +1679,9 @@ %% listed in the order they appear. (See %% `analyze_record_field/1' for details on the field %% descriptors). For a `record_access' node, -%% `Info' represents the record name and the field name. For a +%% `Info' represents the record name and the field name (or +%% if the record name is not included, only the field name; this is +%% allowed only in Mnemosyne-query syntax). For a %% `record_index_expr' node, `Info' represents the %% record name and the name field name. %% @@ -1674,14 +1713,18 @@ F = erl_syntax:record_access_field(Node), case erl_syntax:type(F) of atom -> - A = erl_syntax:record_access_type(Node), - case erl_syntax:type(A) of - atom -> - {record_access, - {erl_syntax:atom_value(A), - erl_syntax:atom_value(F)}}; - _ -> - throw(syntax_error) + case erl_syntax:record_access_type(Node) of + none -> + {record_access, erl_syntax:atom_value(F)}; + A -> + case erl_syntax:type(A) of + atom -> + {record_access, + {erl_syntax:atom_value(A), + erl_syntax:atom_value(F)}}; + _ -> + throw(syntax_error) + end end; _ -> throw(syntax_error) @@ -1792,6 +1835,8 @@ %% The evaluation throws `syntax_error' if %% `Node' does not represent a well-formed function %% definition. +%% +%% @see analyze_rule/1 -spec analyze_function(erl_syntax:syntaxTree()) -> {atom(), arity()}. @@ -1806,6 +1851,37 @@ _ -> throw(syntax_error) end; + _ -> + throw(syntax_error) + end. + + +%% ===================================================================== +%% @spec analyze_rule(Node::syntaxTree()) -> {atom(), integer()} +%% +%% @doc Returns the name and arity of a Mnemosyne rule. The result is a +%% pair `{Name, A}' if `Node' represents a rule +%% "`Name(P_1, ..., P_A) :- ...'". +%% +%% The evaluation throws `syntax_error' if +%% `Node' does not represent a well-formed Mnemosyne +%% rule. +%% +%% @see analyze_function/1 + +-spec analyze_rule(erl_syntax:syntaxTree()) -> {atom(), arity()}. + +analyze_rule(Node) -> + case erl_syntax:type(Node) of + rule -> + N = erl_syntax:rule_name(Node), + case erl_syntax:type(N) of + atom -> + {erl_syntax:atom_value(N), + erl_syntax:rule_arity(Node)}; + _ -> + throw(syntax_error) + end; _ -> throw(syntax_error) end. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/erl_tidy.erl erlang-17.3-dfsg/lib/syntax_tools/src/erl_tidy.erl --- erlang-18.2-dfsg/lib/syntax_tools/src/erl_tidy.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/erl_tidy.erl 2014-09-16 19:10:57.000000000 +0000 @@ -792,11 +792,16 @@ N = erl_syntax_lib:analyze_function(Form), case sets:is_element(N, Used) of false -> - {F, A} = N, - File = proplists:get_value(file, Opts, ""), - report({File, erl_syntax:get_pos(Form), - "removing unused function `~w/~w'."}, - [F, A], Opts), + report_removed_def("function", N, Form, Opts), + false; + true -> + true + end; + rule -> + N = erl_syntax_lib:analyze_rule(Form), + case sets:is_element(N, Used) of + false -> + report_removed_def("rule", N, Form, Opts), false; true -> true @@ -818,6 +823,12 @@ true end. +report_removed_def(Type, {N, A}, Form, Opts) -> + File = proplists:get_value(file, Opts, ""), + report({File, erl_syntax:get_pos(Form), + "removing unused ~s `~w/~w'."}, + [Type, N, A], Opts). + collect_functions(Forms) -> lists:foldl( fun (F, {Names, Defs}) -> @@ -826,6 +837,10 @@ N = erl_syntax_lib:analyze_function(F), {sets:add_element(N, Names), dict:store(N, {F, []}, Defs)}; + rule -> + N = erl_syntax_lib:analyze_rule(F), + {sets:add_element(N, Names), + dict:store(N, {F, []}, Defs)}; _ -> {Names, Defs} end @@ -840,6 +855,11 @@ {F1, Fs1} = dict:fetch(N, Defs), [F1 | lists:reverse(Fs1)] ++ update_forms(Fs, Defs, Imports, Opts); + rule -> + N = erl_syntax_lib:analyze_rule(F), + {F1, Fs1} = dict:fetch(N, Defs), + [F1 | lists:reverse(Fs1)] ++ update_forms(Fs, Defs, Imports, + Opts); attribute -> [update_attribute(F, Imports, Opts) | update_forms(Fs, Defs, Imports, Opts)]; diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/igor.erl erlang-17.3-dfsg/lib/syntax_tools/src/igor.erl --- erlang-18.2-dfsg/lib/syntax_tools/src/igor.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/igor.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1713,6 +1713,8 @@ transform_function(Tree, Env, St); implicit_fun -> transform_implicit_fun(Tree, Env, St); + rule -> + transform_rule(Tree, Env, St); record_expr -> transform_record(Tree, Env, St); record_index_expr -> @@ -1776,6 +1778,27 @@ rename_atom(Node, Atom) -> rewrite(Node, erl_syntax:atom(Atom)). +%% Renaming Mnemosyne rules (just like function definitions) + +transform_rule(T, Env, St) -> + {T1, St1} = default_transform(T, Env, St), + F = erl_syntax_lib:analyze_rule(T1), + {V, Text} = case (Env#code.map)(F) of + F -> + %% Not renamed + {none, []}; + {Atom, _Arity} -> + %% Renamed + Cs = erl_syntax:rule_clauses(T1), + N = rename_atom( + erl_syntax:rule_name(T1), + Atom), + T2 = rewrite(T1, + erl_syntax:rule(N, Cs)), + {{value, T2}, renaming_note(Atom)} + end, + {maybe_modified(V, T1, 2, Text, Env), St1}. + %% Renaming "implicit fun" expressions (done quietly). transform_implicit_fun(T, Env, St) -> diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/Makefile erlang-17.3-dfsg/lib/syntax_tools/src/Makefile --- erlang-18.2-dfsg/lib/syntax_tools/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -22,9 +22,6 @@ # EBIN = ../ebin -INCLUDE=../include - -ERL_COMPILE_FLAGS += -pa $(EBIN) -pa ./ -I$(INCLUDE) ifeq ($(NATIVE_LIBS_ENABLED),yes) ERL_COMPILE_FLAGS += +native @@ -33,15 +30,10 @@ SOURCES=erl_syntax.erl erl_prettypr.erl erl_syntax_lib.erl \ erl_comment_scan.erl erl_recomment.erl erl_tidy.erl \ - epp_dodger.erl prettypr.erl igor.erl \ - merl.erl merl_transform.erl - -INCLUDE_FILES = merl.hrl + epp_dodger.erl prettypr.erl igor.erl OBJECTS=$(SOURCES:%.erl=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET) -INCLUDE_DELIVERABLES = $(INCLUDE_FILES:%=$(INCLUDE)/%) - APP_FILE= syntax_tools.app APP_SRC= $(APP_FILE).src APP_TARGET= $(EBIN)/$(APP_FILE) @@ -60,7 +52,6 @@ clean: - rm -f ./merl_transform.beam rm -f $(OBJECTS) rm -f core *~ @@ -73,15 +64,6 @@ $(EBIN)/%.$(EMULATOR):%.erl $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $< -# special rules and dependencies to apply the transform to itself -$(EBIN)/merl_transform.beam: $(EBIN)/merl.beam ./merl_transform.beam \ - ../include/merl.hrl \ - $(EBIN)/erl_syntax.beam $(EBIN)/erl_syntax_lib.beam -./merl_transform.beam: ./merl_transform.erl $(EBIN)/merl.beam \ - ../include/merl.hrl - $(V_ERLC) -DMERL_NO_TRANSFORM $(ERL_COMPILE_FLAGS) -o ./ $< - - # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- @@ -102,8 +84,6 @@ $(INSTALL_DATA) $(OBJECTS) "$(RELSYSDIR)/ebin" $(INSTALL_DIR) "$(RELSYSDIR)/src" $(INSTALL_DATA) $(SOURCES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(INCLUDE_DELIVERABLES) "$(RELSYSDIR)/include" release_docs_spec: diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/merl.erl erlang-17.3-dfsg/lib/syntax_tools/src/merl.erl --- erlang-18.2-dfsg/lib/syntax_tools/src/merl.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/merl.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,1230 +0,0 @@ -%% --------------------------------------------------------------------- -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% Note: EDoc uses @@ and @} as escape sequences, so in the doc text below, -%% `@@' must be written `@@@@' and `@}' must be written `@@}'. -%% -%% @author Richard Carlsson -%% @copyright 2010-2015 Richard Carlsson -%% -%% @doc Metaprogramming in Erlang. -%% Merl is a more user friendly interface to the `erl_syntax' module, making -%% it easy both to build new ASTs from scratch and to -%% match and decompose existing ASTs. For details that are outside the scope -%% of Merl itself, please see the documentation of {@link erl_syntax}. -%% -%% == Quick start == -%% -%% To enable the full power of Merl, your module needs to include the Merl -%% header file: -%% ```-include_lib("syntax_tools/include/merl.hrl").''' -%% -%% Then, you can use the `?Q(Text)' macros in your code to create ASTs or match -%% on existing ASTs. For example: -%% ```Tuple = ?Q("{foo, 42}"), -%% ?Q("{foo, _@Number}") = Tuple, -%% Call = ?Q("foo:bar(_@Number)")''' -%% -%% Calling `merl:print(Call)' will then print the following code: -%% ```foo:bar(42)''' -%% -%% The `?Q' macros turn the quoted code fragments into ASTs, and lifts -%% metavariables such as `_@Tuple' and `_@Number' to the level of your Erlang -%% code, so you can use the corresponding Erlang variables `Tuple' and `Number' -%% directly. This is the most straightforward way to use Merl, and in many -%% cases it's all you need. -%% -%% You can even write case switches using `?Q' macros as patterns. For example: -%% ```case AST of -%% ?Q("{foo, _@Foo}") -> handle(Foo); -%% ?Q("{bar, _@Bar}") when erl_syntax:is_integer(Bar) -> handle(Bar); -%% _ -> handle_default() -%% end''' -%% -%% These case switches only allow `?Q(...)' or `_' as clause patterns, and the -%% guards may contain any expressions, not just Erlang guard expressions. -%% -%% If the macro `MERL_NO_TRANSFORM' is defined before the `merl.hrl' header -%% file is included, the parse transform used by Merl will be disabled, and in -%% that case, the match expressions `?Q(...) = ...', case switches using -%% `?Q(...)' patterns, and automatic metavariables like `_@Tuple' cannot be -%% used in your code, but the Merl macros and functions still work. To do -%% metavariable substitution, you need to use the `?Q(Text, Map)' macro, e.g.: -%% ```Tuple = ?Q("{foo, _@bar, _@baz}", [{bar, Bar}, {baz,Baz}])''' -%% -%% The text given to a `?Q(Text)' macro can be either a single string, or a -%% list of strings. The latter is useful when you need to split a long -%% expression over multiple lines, e.g.: -%% ```?Q(["case _@Expr of", -%% " {foo, X} -> f(X);", -%% " {bar, X} -> g(X)", -%% " _ -> h(X)" -%% "end"])''' -%% If there is a syntax error somewhere in the text (like the missing semicolon -%% in the second clause above) this allows Merl to generate an error message -%% pointing to the exact line in your source code. (Just remember to -%% comma-separate the strings in the list, otherwise Erlang will concatenate -%% the string fragments as if they were a single string.) -%% -%% == Metavariable syntax == -%% -%% There are several ways to write a metavariable in your quoted code: -%%
        -%%
      • Atoms starting with `@', for example `` '@foo' '' or `` '@Foo' ''
      • -%%
      • Variables starting with `_@', for example `_@bar' or `_@Bar'
      • -%%
      • Strings starting with ``"'@'', for example ``"'@File"''
      • -%%
      • Integers starting with 909, for example `9091' or `909123'
      • -%%
      -%% Following the prefix, one or more `_' or `0' characters may be used to -%% indicate "lifting" of the variable one or more levels, and after that, a `@' -%% or `9' character indicates a glob metavariable (matching zero or more -%% elements in a sequence) rather than a normal metavariable. For example: -%%
        -%%
      • `` '@_foo' '' is lifted one level, and `_@__foo' is lifted two -%% levels
      • -%%
      • `_@@@@bar' is a glob variable, and `_@_@bar' is a lifted glob -%% variable
      • -%%
      • `90901' is a lifted variable,`90991' is a glob variable, and `9090091' -%% is a glob variable lifted two levels
      • -%%
      -%% (Note that the last character in the name is never considered to be a lift -%% or glob marker, hence, `_@__' and `90900' are only lifted one level, not -%% two. Also note that globs only matter for matching; when doing -%% substitutions, a non-glob variable can be used to inject a sequence of -%% elements, and vice versa.) -%% -%% If the name after the prefix and any lift and glob markers is `_' or `0', -%% the variable is treated as an anonymous catch-all pattern in matches. For -%% example, `_@_', `_@@@@_', `_@__', or even `_@__@_'. -%% -%% Finally, if the name without any prefixes or lift/glob markers begins with -%% an uppercase character, as in `_@Foo' or `_@_@Foo', it will become a -%% variable on the Erlang level, and can be used to easily deconstruct and -%% construct syntax trees: -%% ```case Input of -%% ?Q("{foo, _@Number}") -> ?Q("foo:bar(_@Number)"); -%% ...''' -%% We refer to these as "automatic metavariables". If in addition the name ends -%% with `@', as in `_@Foo@', the value of the variable as an Erlang term will -%% be automatically converted to the corresponding abstract syntax tree when -%% used to construct a larger tree. For example, in: -%% ```Bar = {bar, 42}, -%% Foo = ?Q("{foo, _@Bar@@}")''' -%% (where Bar is just some term, not a syntax tree) the result `Foo' will be a -%% syntax tree representing `{foo, {bar, 42}}'. This avoids the need for -%% temporary variables in order to inject data, as in -%% ```TmpBar = erl_syntax:abstract(Bar), -%% Foo = ?Q("{foo, _@TmpBar}")''' -%% -%% If the context requires an integer rather than a variable, an atom, or a -%% string, you cannot use the uppercase convention to mark an automatic -%% metavariable. Instead, if the integer (without the `909'-prefix and -%% lift/glob markers) ends in a `9', the integer will become an Erlang-level -%% variable prefixed with `Q', and if it ends with `99' it will also be -%% automatically abstracted. For example, the following will increment the -%% arity of the exported function f: -%% ```case Form of -%% ?Q("-export([f/90919]).") -> -%% Q2 = erl_syntax:concrete(Q1) + 1, -%% ?Q("-export([f/909299])."); -%% ...''' -%% -%% == When to use the various forms of metavariables == -%% -%% Merl can only parse a fragment of text if it follows the basic syntactical -%% rules of Erlang. In most places, a normal Erlang variable can be used as -%% metavariable, for example: -%% ```?Q("f(_@Arg)") = Expr''' -%% but if you want to match on something like the name of a function, you have -%% to use an atom as metavariable: -%% ```?Q("'@Name'() -> _@@@@_." = Function''' -%% (note the anonymous glob variable `_@@@@_' to ignore the function body). -%% -%% In some contexts, only a string or an integer is allowed. For example, the -%% directive `-file(Name, Line)' requires that `Name' is a string literal and -%% `Line' an integer literal: -%% -%% ```?Q("-file(\"'@File\", 9090).") = ?Q("-file(\"foo.erl\", 42).")).''' -%% This will extract the string literal `"foo.erl"' into the variable `Foo'. -%% Note the use of the anonymous variable `9090' to ignore the line number. To -%% match and also bind a metavariable that must be an integer literal, we can -%% use the convention of ending the integer with a 9, turning it into a -%% Q-prefixed variable on the Erlang level (see the previous section). -%% -%% === Globs === -%% -%% Whenever you want to match out a number of elements in a sequence (zero or -%% more) rather than a fixed set of elements, you need to use a glob. For -%% example: -%% ```?Q("{_@@@@Elements}") = ?Q({a, b, c})''' -%% will bind Elements to the list of individual syntax trees representing the -%% atoms `a', `b', and `c'. This can also be used with static prefix and suffix -%% elements in the sequence. For example: -%% ```?Q("{a, b, _@@@@Elements}") = ?Q({a, b, c, d})''' -%% will bind Elements to the list of the `c' and `d' subtrees, and -%% ```?Q("{_@@@@Elements, c, d}") = ?Q({a, b, c, d})''' -%% will bind Elements to the list of the `a' and `b' subtrees. You can even use -%% plain metavariables in the prefix or suffix: -%% ```?Q("{_@First, _@@@@Rest}") = ?Q({a, b, c})''' -%% or -%% ```?Q("{_@@@@_, _@Last}") = ?Q({a, b, c})''' -%% (ignoring all but the last element). You cannot however have two globs as -%% part of the same sequence. -%% -%% === Lifted metavariables === -%% -%% In some cases, the Erlang syntax rules make it impossible to place a -%% metavariable directly where you would like it. For example, you cannot -%% write: -%% ```?Q("-export([_@@@@Name]).")''' -%% to match out all name/arity pairs in the export list, or to insert a list of -%% exports in a declaration, because the Erlang parser only allows elements on -%% the form `A/I' (where `A' is an atom and `I' an integer) in the export list. -%% A variable like the above is not allowed, but neither is a single atom or -%% integer, so `` '@@@@Name' '' or `909919' wouldn't work either. -%% -%% What you have to do in such cases is to write your metavariable in a -%% syntactically valid position, and use lifting markers to denote where it -%% should really apply, as in: -%% ```?Q("-export(['@@_@@Name'/0]).")''' -%% This causes the variable to be lifted (after parsing) to the next higher -%% level in the syntax tree, replacing that entire subtree. In this case, the -%% `` '@@_@@Name'/0 '' will be replaced with `` '@@@@Name' '', and the ``/0'' -%% part was just used as dummy notation and will be discarded. -%% -%% You may even need to apply lifting more than once. To match the entire -%% export list as a single syntax tree, you can write: -%% ```?Q("-export(['@@__Name'/0]).")''' -%% using two underscores, but with no glob marker this time. This will make the -%% entire ``['@@__Name'/0]'' part be replaced with `` '@@Name' ''. -%% -%% Sometimes, the tree structure of a code fragment isn't very obvious, and -%% parts of the structure may be invisible when printed as source code. For -%% instance, a simple function definition like the following: -%% ```zero() -> 0.''' -%% consists of the name (the atom `zero'), and a list of clauses containing the -%% single clause `() -> 0'. The clause consists of an argument list (empty), a -%% guard (empty), and a body (which is always a list of expressions) containing -%% the single expression `0'. This means that to match out the name and the -%% list of clauses of any function, you'll need to use a pattern like -%% ``?Q("'@Name'() -> _@_@Body.")'', using a dummy clause whose body is a glob -%% lifted one level. -%% -%% To visualize the structure of a syntax tree, you can use the function -%% `merl:show(T)', which prints a summary. For example, entering -%% ```merl:show(merl:quote("inc(X, Y) when Y > 0 -> X + Y."))''' -%% in the Erlang shell will print the following (where the `+' signs separate -%% groups of subtrees on the same level): -%% ```function: inc(X, Y) when ... -> X + Y. -%% atom: inc -%% + -%% clause: (X, Y) when ... -> X + Y -%% variable: X -%% variable: Y -%% + -%% disjunction: Y > 0 -%% conjunction: Y > 0 -%% infix_expr: Y > 0 -%% variable: Y -%% + -%% operator: > -%% + -%% integer: 0 -%% + -%% infix_expr: X + Y -%% variable: X -%% + -%% operator: + -%% + -%% variable: Y''' -%% -%% This shows another important non-obvious case: a clause guard, even if it's -%% as simple as `Y > 0', always consists of a single disjunction of one or more -%% conjunctions of tests, much like a tuple of tuples. Thus: -%%
        -%%
      • ``"when _@Guard ->"'' will only match a guard with exactly one -%% test
      • -%%
      • ``"when _@@@@Guard ->"'' will match a guard with one or more -%% comma-separated tests (but no semicolons), binding `Guard' to the list -%% of tests
      • -%%
      • ``"when _@_Guard ->"'' will match just like the previous pattern, but -%% binds `Guard' to the conjunction subtree
      • -%%
      • ``"when _@_@Guard ->"'' will match an arbitrary nonempty guard, -%% binding `Guard' to the list of conjunction subtrees
      • -%%
      • ``"when _@__Guard ->"'' will match like the previous pattern, but -%% binds `Guard' to the whole disjunction subtree
      • -%%
      • and finally, ``"when _@__@Guard ->"'' will match any clause, -%% binding `Guard' to `[]' if the guard is empty and to `[Disjunction]' -%% otherwise
      • -%%
      -%% -%% Thus, the following pattern matches all possible clauses: -%% ```"(_@@Args) when _@__@Guard -> _@@Body"''' -%% @end - --module(merl). - --export([term/1, var/1, print/1, show/1]). - --export([quote/1, quote/2, qquote/2, qquote/3]). - --export([template/1, tree/1, subst/2, tsubst/2, alpha/2, match/2, switch/2]). - --export([template_vars/1, meta_template/1]). - --export([compile/1, compile/2, compile_and_load/1, compile_and_load/2]). - -%% NOTE: this module may not include merl.hrl! - --type tree() :: erl_syntax:syntaxTree(). - --type tree_or_trees() :: tree() | [tree()]. - --type pattern() :: tree() | template(). - --type pattern_or_patterns() :: pattern() | [pattern()]. - --type env() :: [{Key::id(), pattern_or_patterns()}]. - --type id() :: atom() | integer(). - -%% A list of strings or binaries is assumed to represent individual lines, -%% while a flat string or binary represents source code containing newlines. --type text() :: string() | binary() | [string()] | [binary()]. - --type location() :: erl_anno:location(). - - -%% ------------------------------------------------------------------------ -%% Compiling and loading code directly to memory - -%% @equiv compile(Code, []) -compile(Code) -> - compile(Code, []). - -%% @doc Compile a syntax tree or list of syntax trees representing a module -%% into a binary BEAM object. -%% @see compile_and_load/2 -%% @see compile/1 -compile(Code, Options) when not is_list(Code)-> - case type(Code) of - form_list -> compile(erl_syntax:form_list_elements(Code)); - _ -> compile([Code], Options) - end; -compile(Code, Options0) when is_list(Options0) -> - Forms = [erl_syntax:revert(F) || F <- Code], - Options = [verbose, report_errors, report_warnings, binary | Options0], - compile:noenv_forms(Forms, Options). - - -%% @equiv compile_and_load(Code, []) -compile_and_load(Code) -> - compile_and_load(Code, []). - -%% @doc Compile a syntax tree or list of syntax trees representing a module -%% and load the resulting module into memory. -%% @see compile/2 -%% @see compile_and_load/1 -compile_and_load(Code, Options) -> - case compile(Code, Options) of - {ok, ModuleName, Binary} -> - _ = code:load_binary(ModuleName, "", Binary), - {ok, Binary}; - Other -> Other - end. - - -%% ------------------------------------------------------------------------ -%% Utility functions - - --spec var(atom()) -> tree(). - -%% @doc Create a variable. - -var(Name) -> - erl_syntax:variable(Name). - - --spec term(term()) -> tree(). - -%% @doc Create a syntax tree for a constant term. - -term(Term) -> - erl_syntax:abstract(Term). - - -%% @doc Pretty-print a syntax tree or template to the standard output. This -%% is a utility function for development and debugging. - -print(Ts) when is_list(Ts) -> - lists:foreach(fun print/1, Ts); -print(T) -> - io:put_chars(erl_prettypr:format(tree(T))), - io:nl(). - -%% @doc Print the structure of a syntax tree or template to the standard -%% output. This is a utility function for development and debugging. - -show(Ts) when is_list(Ts) -> - lists:foreach(fun show/1, Ts); -show(T) -> - io:put_chars(pp(tree(T), 0)), - io:nl(). - -pp(T, I) -> - [lists:duplicate(I, $\s), - limit(lists:flatten([atom_to_list(type(T)), ": ", - erl_prettypr:format(erl_syntax_lib:limit(T,3))]), - 79-I), - $\n, - pp_1(lists:filter(fun (X) -> X =/= [] end, subtrees(T)), I+2) - ]. - -pp_1([G], I) -> - pp_2(G, I); -pp_1([G | Gs], I) -> - [pp_2(G, I), lists:duplicate(I, $\s), "+\n" | pp_1(Gs, I)]; -pp_1([], _I) -> - []. - -pp_2(G, I) -> - [pp(E, I) || E <- G]. - -%% limit string to N characters, stay on a single line and compact whitespace -limit([$\n | Cs], N) -> limit([$\s | Cs], N); -limit([$\r | Cs], N) -> limit([$\s | Cs], N); -limit([$\v | Cs], N) -> limit([$\s | Cs], N); -limit([$\t | Cs], N) -> limit([$\s | Cs], N); -limit([$\s, $\s | Cs], N) -> limit([$\s | Cs], N); -limit([C | Cs], N) when C < 32 -> limit(Cs, N); -limit([C | Cs], N) when N > 3 -> [C | limit(Cs, N-1)]; -limit([_C1, _C2, _C3, _C4 | _Cs], 3) -> "..."; -limit(Cs, 3) -> Cs; -limit([_C1, _C2, _C3 | _], 2) -> ".."; -limit(Cs, 2) -> Cs; -limit([_C1, _C2 | _], 1) -> "."; -limit(Cs, 1) -> Cs; -limit(_, _) -> []. - -%% ------------------------------------------------------------------------ -%% Parsing and instantiating code fragments - - --spec qquote(Text::text(), Env::env()) -> tree_or_trees(). - -%% @doc Parse text and substitute meta-variables. -%% -%% @equiv qquote(1, Text, Env) - -qquote(Text, Env) -> - qquote(1, Text, Env). - - --spec qquote(StartPos::location(), Text::text(), Env::env()) -> tree_or_trees(). - -%% @doc Parse text and substitute meta-variables. Takes an initial scanner -%% starting position as first argument. -%% -%% The macro `?Q(Text, Env)' expands to `merl:qquote(?LINE, Text, Env)'. -%% -%% @see quote/2 - -qquote(StartPos, Text, Env) -> - subst(quote(StartPos, Text), Env). - - --spec quote(Text::text()) -> tree_or_trees(). - -%% @doc Parse text. -%% -%% @equiv quote(1, Text) - -quote(Text) -> - quote(1, Text). - - --spec quote(StartPos::location(), Text::text()) -> tree_or_trees(). - -%% @doc Parse text. Takes an initial scanner starting position as first -%% argument. -%% -%% The macro `?Q(Text)' expands to `merl:quote(?LINE, Text, Env)'. -%% -%% @see quote/1 - -quote({Line, Col}, Text) - when is_integer(Line), is_integer(Col) -> - quote_1(Line, Col, Text); -quote(StartPos, Text) when is_integer(StartPos) -> - quote_1(StartPos, undefined, Text). - -quote_1(StartLine, StartCol, Text) -> - %% be backwards compatible as far as R12, ignoring any starting column - StartPos = case erlang:system_info(version) of - "5.6" ++ _ -> StartLine; - "5.7" ++ _ -> StartLine; - "5.8" ++ _ -> StartLine; - _ when StartCol =:= undefined -> StartLine; - _ -> {StartLine, StartCol} - end, - FlatText = flatten_text(Text), - {ok, Ts, _} = erl_scan:string(FlatText, StartPos), - merge_comments(StartLine, erl_comment_scan:string(FlatText), parse_1(Ts)). - -parse_1(Ts) -> - %% if dot tokens are present, it is assumed that the text represents - %% complete forms, not dot-terminated expressions or similar - case split_forms(Ts) of - {ok, Fs} -> parse_forms(Fs); - error -> - parse_2(Ts) - end. - -split_forms(Ts) -> - split_forms(Ts, [], []). - -split_forms([{dot,_}=T|Ts], Fs, As) -> - split_forms(Ts, [lists:reverse(As, [T]) | Fs], []); -split_forms([T|Ts], Fs, As) -> - split_forms(Ts, Fs, [T|As]); -split_forms([], Fs, []) -> - {ok, lists:reverse(Fs)}; -split_forms([], [], _) -> - error; % no dot tokens found - not representing form(s) -split_forms([], _, [T|_]) -> - fail("incomplete form after ~p", [T]). - -parse_forms([Ts | Tss]) -> - case erl_parse:parse_form(Ts) of - {ok, Form} -> [Form | parse_forms(Tss)]; - {error, R} -> parse_error(R) - end; -parse_forms([]) -> - []. - -parse_2(Ts) -> - %% one or more comma-separated expressions? - %% (recall that Ts has no dot tokens if we get to this stage) - case erl_parse:parse_exprs(Ts ++ [{dot,0}]) of - {ok, Exprs} -> Exprs; - {error, E} -> - parse_3(Ts ++ [{'end',0}, {dot,0}], [E]) - end. - -parse_3(Ts, Es) -> - %% try-clause or clauses? - case erl_parse:parse_exprs([{'try',0}, {atom,0,true}, {'catch',0} | Ts]) of - {ok, [{'try',_,_,_,_,_}=X]} -> - %% get the right kind of qualifiers in the clause patterns - erl_syntax:try_expr_handlers(X); - {error, E} -> - parse_4(Ts, [E|Es]) - end. - -parse_4(Ts, Es) -> - %% fun-clause or clauses? (`(a)' is also a pattern, but `(a,b)' isn't, - %% so fun-clauses must be tried before normal case-clauses - case erl_parse:parse_exprs([{'fun',0} | Ts]) of - {ok, [{'fun',_,{clauses,Cs}}]} -> Cs; - {error, E} -> - parse_5(Ts, [E|Es]) - end. - -parse_5(Ts, Es) -> - %% case-clause or clauses? - case erl_parse:parse_exprs([{'case',0}, {atom,0,true}, {'of',0} | Ts]) of - {ok, [{'case',_,_,Cs}]} -> Cs; - {error, E} -> - %% select the best error to report - parse_error(lists:last(lists:sort([E|Es]))) - end. - --dialyzer({nowarn_function, parse_error/1}). % no local return - -parse_error({L, M, R}) when is_atom(M), is_integer(L) -> - fail("~w: ~s", [L, M:format_error(R)]); -parse_error({{L,C}, M, R}) when is_atom(M), is_integer(L), is_integer(C) -> - fail("~w:~w: ~s", [L,C,M:format_error(R)]); -parse_error({_, M, R}) when is_atom(M) -> - fail(M:format_error(R)); -parse_error(R) -> - fail("unknown parse error: ~p", [R]). - -%% ------------------------------------------------------------------------ -%% Templates, substitution and matching - -%% Leaves are normal syntax trees, and inner nodes are tuples -%% {template,Type,Attrs,Groups} where Groups are lists of lists of nodes. -%% Metavariables are 1-tuples {VarName}, where VarName is an atom or an -%% integer. {'_'} and {0} work as anonymous variables in matching. Glob -%% metavariables are tuples {'*',VarName}, and {'*','_'} and {'*',0} are -%% anonymous globs. - -%% Note that although template() :: tree() | ..., it is implied that these -%% syntax trees are free from metavariables, so pattern() :: tree() | -%% template() is in fact a wider type than template(). - --type template() :: tree() - | {id()} - | {'*',id()} - | {template, atom(), term(), [[template()]]}. - --type template_or_templates() :: template() | [template()]. - --spec template(pattern_or_patterns()) -> template_or_templates(). - -%% @doc Turn a syntax tree or list of trees into a template or templates. -%% Templates can be instantiated or matched against, and reverted back to -%% normal syntax trees using {@link tree/1}. If the input is already a -%% template, it is not modified further. -%% -%% @see subst/2 -%% @see match/2 -%% @see tree/1 - -template(Trees) when is_list(Trees) -> - [template_0(T) || T <- Trees]; -template(Tree) -> - template_0(Tree). - -template_0({template, _, _, _}=Template) -> Template; -template_0({'*',_}=Template) -> Template; -template_0({_}=Template) -> Template; -template_0(Tree) -> - case template_1(Tree) of - false -> Tree; - {Name} when is_list(Name) -> - fail("bad metavariable: '~s'", [tl(Name)]); % drop v/n from name - Template -> Template - end. - -%% returns either a template or a lifted metavariable {String}, or 'false' -%% if Tree contained no metavariables -template_1(Tree) -> - case subtrees(Tree) of - [] -> - case metavar(Tree) of - {"v_"++Cs}=V when Cs =/= [] -> V; % to be lifted - {"n0"++Cs}=V when Cs =/= [] -> V; % to be lifted - {"v@"++Cs} when Cs =/= [] -> {'*',list_to_atom(Cs)}; - {"n9"++Cs} when Cs =/= [] -> {'*',list_to_integer(Cs)}; - {"v"++Cs} -> {list_to_atom(Cs)}; - {"n"++Cs} -> {list_to_integer(Cs)}; - false -> false - end; - Gs -> - case template_2(Gs, [], false) of - Gs1 when is_list(Gs1) -> - {template, type(Tree), erl_syntax:get_attrs(Tree), Gs1}; - Other -> - Other - end - end. - -template_2([G | Gs], As, Bool) -> - case template_3(G, [], false) of - {"v_"++Cs}=V when Cs =/= [] -> V; % lift further - {"n0"++Cs}=V when Cs =/= [] -> V; % lift further - {"v@"++Cs} when Cs =/= [] -> {'*',list_to_atom(Cs)}; % stop - {"n9"++Cs} when Cs =/= [] -> {'*',list_to_integer(Cs)}; % stop - {"v"++Cs} when is_list(Cs) -> {list_to_atom(Cs)}; % stop - {"n"++Cs} when is_list(Cs) -> {list_to_integer(Cs)}; % stop - false -> template_2(Gs, [G | As], Bool); - G1 -> template_2(Gs, [G1 | As], true) - end; -template_2([], _As, false) -> false; -template_2([], As, true) -> lists:reverse(As). - -template_3([T | Ts], As, Bool) -> - case template_1(T) of - {"v_"++Cs} when Cs =/= [] -> {"v"++Cs}; % lift - {"n0"++Cs} when Cs =/= [] -> {"n"++Cs}; % lift - false -> template_3(Ts, [T | As], Bool); - T1 -> template_3(Ts, [T1 | As], true) - end; -template_3([], _As, false) -> false; -template_3([], As, true) -> lists:reverse(As). - - -%% @doc Turn a template into a syntax tree representing the template. -%% Meta-variables in the template are turned into normal Erlang variables if -%% their names (after the metavariable prefix characters) begin with an -%% uppercase character. E.g., `_@Foo' in the template becomes the variable -%% `Foo' in the meta-template. Furthermore, variables ending with `@' are -%% automatically wrapped in a call to merl:term/1, so e.g. `_@Foo@ in the -%% template becomes `merl:term(Foo)' in the meta-template. - --spec meta_template(template_or_templates()) -> tree_or_trees(). - -meta_template(Templates) when is_list(Templates) -> - [meta_template_1(T) || T <- Templates]; -meta_template(Template) -> - meta_template_1(Template). - -meta_template_1({template, Type, Attrs, Groups}) -> - erl_syntax:tuple( - [erl_syntax:atom(template), - erl_syntax:atom(Type), - erl_syntax:abstract(Attrs), - erl_syntax:list([erl_syntax:list([meta_template_1(T) || T <- G]) - || G <- Groups])]); -meta_template_1({Var}=V) -> - meta_template_2(Var, V); -meta_template_1({'*',Var}=V) -> - meta_template_2(Var, V); -meta_template_1(Leaf) -> - erl_syntax:abstract(Leaf). - -meta_template_2(Var, V) when is_atom(Var) -> - case atom_to_list(Var) of - [C|_]=Name when C >= $A, C =< $Z ; C >= $À, C =< $Þ, C /= $× -> - case lists:reverse(Name) of - "@"++([_|_]=RevRealName) -> % don't allow empty RealName - RealName = lists:reverse(RevRealName), - erl_syntax:application(erl_syntax:atom(merl), - erl_syntax:atom(term), - [erl_syntax:variable(RealName)]); - _ -> - %% plain automatic metavariable - erl_syntax:variable(Name) - end; - _ -> - erl_syntax:abstract(V) - end; -meta_template_2(Var, V) when is_integer(Var) -> - if Var > 9, (Var rem 10) =:= 9 -> - %% at least 2 digits, ends in 9: make it a Q-variable - if Var > 99, (Var rem 100) =:= 99 -> - %% at least 3 digits, ends in 99: wrap in merl:term/1 - Name = "Q" ++ integer_to_list(Var div 100), - erl_syntax:application(erl_syntax:atom(merl), - erl_syntax:atom(term), - [erl_syntax:variable(Name)]); - true -> - %% plain automatic Q-variable - Name = integer_to_list(Var div 10), - erl_syntax:variable("Q" ++ Name) - end; - true -> - erl_syntax:abstract(V) - end. - - - --spec template_vars(template_or_templates()) -> [id()]. - -%% @doc Return an ordered list of the metavariables in the template. - -template_vars(Template) -> - template_vars(Template, []). - -template_vars(Templates, Vars) when is_list(Templates) -> - lists:foldl(fun template_vars_1/2, Vars, Templates); -template_vars(Template, Vars) -> - template_vars_1(Template, Vars). - -template_vars_1({template, _, _, Groups}, Vars) -> - lists:foldl(fun (G, V) -> lists:foldl(fun template_vars_1/2, V, G) end, - Vars, Groups); -template_vars_1({Var}, Vars) -> - ordsets:add_element(Var, Vars); -template_vars_1({'*',Var}, Vars) -> - ordsets:add_element(Var, Vars); -template_vars_1(_, Vars) -> - Vars. - - --spec tree(template_or_templates()) -> tree_or_trees(). - -%% @doc Revert a template to a normal syntax tree. Any remaining -%% metavariables are turned into `@'-prefixed atoms or `909'-prefixed -%% integers. -%% @see template/1 - -tree(Templates) when is_list(Templates) -> - [tree_1(T) || T <- Templates]; -tree(Template) -> - tree_1(Template). - -tree_1({template, Type, Attrs, Groups}) -> - %% flattening here is needed for templates created via source transforms - Gs = [lists:flatten([tree_1(T) || T <- G]) || G <- Groups], - erl_syntax:set_attrs(make_tree(Type, Gs), Attrs); -tree_1({Var}) when is_atom(Var) -> - erl_syntax:atom(list_to_atom("@"++atom_to_list(Var))); -tree_1({Var}) when is_integer(Var) -> - erl_syntax:integer(list_to_integer("909"++integer_to_list(Var))); -tree_1({'*',Var}) when is_atom(Var) -> - erl_syntax:atom(list_to_atom("@@"++atom_to_list(Var))); -tree_1({'*',Var}) when is_integer(Var) -> - erl_syntax:integer(list_to_integer("9099"++integer_to_list(Var))); -tree_1(Leaf) -> - Leaf. % any syntax tree, not necessarily atomic (due to substitutions) - - --spec subst(pattern_or_patterns(), env()) -> tree_or_trees(). - -%% @doc Substitute metavariables in a pattern or list of patterns, yielding -%% a syntax tree or list of trees as result. Both for normal metavariables -%% and glob metavariables, the substituted value may be a single element or -%% a list of elements. For example, if a list representing `1, 2, 3' is -%% substituted for `var' in either of `[foo, _@var, bar]' or `[foo, _@@var, -%% bar]', the result represents `[foo, 1, 2, 3, bar]'. - -subst(Trees, Env) when is_list(Trees) -> - [subst_0(T, Env) || T <- Trees]; -subst(Tree, Env) -> - subst_0(Tree, Env). - -subst_0(Tree, Env) -> - tree_1(subst_1(template(Tree), Env)). - - --spec tsubst(pattern_or_patterns(), env()) -> template_or_templates(). - -%% @doc Like subst/2, but does not convert the result from a template back -%% to a tree. Useful if you want to do multiple separate substitutions. -%% @see subst/2 -%% @see tree/1 - -tsubst(Trees, Env) when is_list(Trees) -> - [subst_1(template(T), Env) || T <- Trees]; -tsubst(Tree, Env) -> - subst_1(template(Tree), Env). - -subst_1({template, Type, Attrs, Groups}, Env) -> - Gs1 = [lists:flatten([subst_1(T, Env) || T <- G]) || G <- Groups], - {template, Type, Attrs, Gs1}; -subst_1({Var}=V, Env) -> - case lists:keyfind(Var, 1, Env) of - {Var, TreeOrTrees} -> TreeOrTrees; - false -> V - end; -subst_1({'*',Var}=V, Env) -> - case lists:keyfind(Var, 1, Env) of - {Var, TreeOrTrees} -> TreeOrTrees; - false -> V - end; -subst_1(Leaf, _Env) -> - Leaf. - - --spec alpha(pattern_or_patterns(), [{id(), id()}]) -> template_or_templates(). - -%% @doc Alpha converts a pattern (renames variables). Similar to tsubst/1, -%% but only renames variables (including globs). -%% @see tsubst/2 - -alpha(Trees, Env) when is_list(Trees) -> - [alpha_1(template(T), Env) || T <- Trees]; -alpha(Tree, Env) -> - alpha_1(template(Tree), Env). - -alpha_1({template, Type, Attrs, Groups}, Env) -> - Gs1 = [lists:flatten([alpha_1(T, Env) || T <- G]) || G <- Groups], - {template, Type, Attrs, Gs1}; -alpha_1({Var}=V, Env) -> - case lists:keyfind(Var, 1, Env) of - {Var, NewVar} -> {NewVar}; - false -> V - end; -alpha_1({'*',Var}=V, Env) -> - case lists:keyfind(Var, 1, Env) of - {Var, NewVar} -> {'*',NewVar}; - false -> V - end; -alpha_1(Leaf, _Env) -> - Leaf. - - --spec match(pattern_or_patterns(), tree_or_trees()) -> - {ok, env()} | error. - -%% @doc Match a pattern against a syntax tree (or patterns against syntax -%% trees) returning an environment mapping variable names to subtrees; the -%% environment is always sorted on keys. Note that multiple occurrences of -%% metavariables in the pattern is not allowed, but is not checked. -%% -%% @see template/1 -%% @see switch/2 - -match(Patterns, Trees) when is_list(Patterns), is_list(Trees) -> - try {ok, match_1(Patterns, Trees, [])} - catch - error -> error - end; -match(Patterns, Tree) when is_list(Patterns) -> match(Patterns, [Tree]); -match(Pattern, Trees) when is_list(Trees) -> match([Pattern], Trees); -match(Pattern, Tree) -> - try {ok, match_template(template(Pattern), Tree, [])} - catch - error -> error - end. - -match_1([P|Ps], [T | Ts], Dict) -> - match_1(Ps, Ts, match_template(template(P), T, Dict)); -match_1([], [], Dict) -> - Dict; -match_1(_, _, _Dict) -> - erlang:error(merl_match_arity). - -%% match a template against a syntax tree -match_template({template, Type, _, Gs}, Tree, Dict) -> - case type(Tree) of - Type -> match_template_1(Gs, subtrees(Tree), Dict); - _ -> throw(error) % type mismatch - end; -match_template({Var}, _Tree, Dict) - when Var =:= '_' ; Var =:= 0 -> - Dict; % anonymous variable -match_template({Var}, Tree, Dict) -> - orddict:store(Var, Tree, Dict); -match_template(Tree1, Tree2, Dict) -> - %% if Tree1 is not a template, Tree1 and Tree2 are both syntax trees - case compare_trees(Tree1, Tree2) of - true -> Dict; - false -> throw(error) % different trees - end. - -match_template_1([G1 | Gs1], [G2 | Gs2], Dict) -> - match_template_2(G1, G2, match_template_1(Gs1, Gs2, Dict)); -match_template_1([], [], Dict) -> - Dict; -match_template_1(_, _, _Dict) -> - throw(error). % shape mismatch - -match_template_2([{Var} | Ts1], [_ | Ts2], Dict) - when Var =:= '_' ; Var =:= 0 -> - match_template_2(Ts1, Ts2, Dict); % anonymous variable -match_template_2([{Var} | Ts1], [Tree | Ts2], Dict) -> - match_template_2(Ts1, Ts2, orddict:store(Var, Tree, Dict)); -match_template_2([{'*',Var} | Ts1], Ts2, Dict) -> - match_glob(lists:reverse(Ts1), lists:reverse(Ts2), Var, Dict); -match_template_2([T1 | Ts1], [T2 | Ts2], Dict) -> - match_template_2(Ts1, Ts2, match_template(T1, T2, Dict)); -match_template_2([], [], Dict) -> - Dict; -match_template_2(_, _, _Dict) -> - throw(error). % shape mismatch - -%% match the tails in reverse order; no further globs allowed -match_glob([{'*',Var} | _], _, _, _) -> - fail("multiple glob variables in same match group: ~w", [Var]); -match_glob([T1 | Ts1], [T2 | Ts2], Var, Dict) -> - match_glob(Ts1, Ts2, Var, match_template(T1, T2, Dict)); -match_glob([], _Group, Var, Dict) when Var =:= '_' ; Var =:= 0 -> - Dict; % anonymous glob variable -match_glob([], Group, Var, Dict) -> - orddict:store(Var, lists:reverse(Group), Dict); -match_glob(_, _, _, _Dict) -> - throw(error). % shape mismatch - - -%% compare two syntax trees for equivalence -compare_trees(T1, T2) -> - Type1 = type(T1), - case type(T2) of - Type1 -> - case subtrees(T1) of - [] -> - case subtrees(T2) of - [] -> compare_leaves(Type1, T1, T2); - _Gs2 -> false % shape mismatch - end; - Gs1 -> - case subtrees(T2) of - [] -> false; % shape mismatch - Gs2 -> compare_trees_1(Gs1, Gs2) - end - end; - _Type2 -> - false % different tree types - end. - -compare_trees_1([G1 | Gs1], [G2 | Gs2]) -> - compare_trees_2(G1, G2) andalso compare_trees_1(Gs1, Gs2); -compare_trees_1([], []) -> - true; -compare_trees_1(_, _) -> - false. % shape mismatch - -compare_trees_2([T1 | Ts1], [T2 | Ts2]) -> - compare_trees(T1, T2) andalso compare_trees_2(Ts1, Ts2); -compare_trees_2([], []) -> - true; -compare_trees_2(_, _) -> - false. % shape mismatch - -compare_leaves(Type, T1, T2) -> - case Type of - atom -> - erl_syntax:atom_value(T1) - =:= erl_syntax:atom_value(T2); - char -> - erl_syntax:char_value(T1) - =:= erl_syntax:char_value(T2); - float -> - erl_syntax:float_value(T1) - =:= erl_syntax:float_value(T2); - integer -> - erl_syntax:integer_value(T1) - =:= erl_syntax:integer_value(T2); - string -> - erl_syntax:string_value(T1) - =:= erl_syntax:string_value(T2); - operator -> - erl_syntax:operator_name(T1) - =:= erl_syntax:operator_name(T2); - text -> - erl_syntax:text_string(T1) - =:= erl_syntax:text_string(T2); - variable -> - erl_syntax:variable_name(T1) - =:= erl_syntax:variable_name(T2); - _ -> - true % trivially equal nodes - end. - - -%% @doc Match against one or more clauses with patterns and optional guards. -%% -%% Note that clauses following a default action will be ignored. -%% -%% @see match/2 - --type switch_clause() :: - {pattern_or_patterns(), guarded_actions()} - | {pattern_or_patterns(), guard_test(), switch_action()} - | default_action(). - --type guarded_actions() :: guarded_action() | [guarded_action()]. - --type guarded_action() :: switch_action() | {guard_test(), switch_action()}. - --type switch_action() :: fun( (env()) -> any() ). - --type guard_test() :: fun( (env()) -> boolean() ). - --type default_action() :: fun( () -> any() ). - - --spec switch(tree_or_trees(), [switch_clause()]) -> any(). - -switch(Trees, [{Patterns, GuardedActions} | Cs]) when is_list(GuardedActions) -> - switch_1(Trees, Patterns, GuardedActions, Cs); -switch(Trees, [{Patterns, GuardedAction} | Cs]) -> - switch_1(Trees, Patterns, [GuardedAction], Cs); -switch(Trees, [{Patterns, Guard, Action} | Cs]) -> - switch_1(Trees, Patterns, [{Guard, Action}], Cs); -switch(_Trees, [Default | _Cs]) when is_function(Default, 0) -> - Default(); -switch(_Trees, []) -> - erlang:error(merl_switch_clause); -switch(_Tree, _) -> - erlang:error(merl_switch_badarg). - -switch_1(Trees, Patterns, GuardedActions, Cs) -> - case match(Patterns, Trees) of - {ok, Env} -> - switch_2(Env, GuardedActions, Trees, Cs); - error -> - switch(Trees, Cs) - end. - -switch_2(Env, [{Guard, Action} | Bs], Trees, Cs) - when is_function(Guard, 1), is_function(Action, 1) -> - case Guard(Env) of - true -> Action(Env); - false -> switch_2(Env, Bs, Trees, Cs) - end; -switch_2(Env, [Action | _Bs], _Trees, _Cs) when is_function(Action, 1) -> - Action(Env); -switch_2(_Env, [], Trees, Cs) -> - switch(Trees, Cs); -switch_2(_Env, _, _Trees, _Cs) -> - erlang:error(merl_switch_badarg). - - -%% ------------------------------------------------------------------------ -%% Internal utility functions - --dialyzer({nowarn_function, fail/1}). % no local return - -fail(Text) -> - fail(Text, []). - -fail(Fs, As) -> - throw({error, lists:flatten(io_lib:format(Fs, As))}). - -flatten_text([L | _]=Lines) when is_list(L) -> - lists:foldr(fun(S, T) -> S ++ [$\n | T] end, "", Lines); -flatten_text([B | _]=Lines) when is_binary(B) -> - lists:foldr(fun(S, T) -> binary_to_list(S) ++ [$\n | T] end, "", Lines); -flatten_text(Text) when is_binary(Text) -> - binary_to_list(Text); -flatten_text(Text) -> - Text. - --spec metavar(tree()) -> {string()} | false. - -%% Check if a syntax tree represents a metavariable. If not, 'false' is -%% returned; otherwise, this returns a 1-tuple with a string containing the -%% variable name including lift/glob prefixes but without any leading -%% metavariable prefix, and instead prefixed with "v" for a variable or "i" -%% for an integer. -%% -%% Metavariables are atoms starting with @, variables starting with _@, -%% strings starting with "'@, or integers starting with 909. Following the -%% prefix, one or more _ or 0 characters (unless it's the last character in -%% the name) may be used to indicate "lifting" of the variable one or more -%% levels , and after that, a @ or 9 character indicates a glob metavariable -%% rather than a normal metavariable. If the name after the prefix is _ or -%% 0, the variable is treated as an anonymous catch-all pattern in matches. - -metavar(Tree) -> - case type(Tree) of - atom -> - case erl_syntax:atom_name(Tree) of - "@" ++ Cs when Cs =/= [] -> {"v"++Cs}; - _ -> false - end; - variable -> - case erl_syntax:variable_literal(Tree) of - "_@" ++ Cs when Cs =/= [] -> {"v"++Cs}; - _ -> false - end; - integer -> - case erl_syntax:integer_value(Tree) of - N when N >= 9090 -> - case integer_to_list(N) of - "909" ++ Cs -> {"n"++Cs}; - _ -> false - end; - _ -> false - end; - string -> - case erl_syntax:string_value(Tree) of - "'@" ++ Cs -> {"v"++Cs}; - _ -> false - end; - _ -> - false - end. - -%% wrappers around erl_syntax functions to provide more uniform shape of -%% generic subtrees (maybe this can be fixed in syntax_tools one day) - -type(T) -> - case erl_syntax:type(T) of - nil -> list; - Type -> Type - end. - -subtrees(T) -> - case erl_syntax:type(T) of - tuple -> - [erl_syntax:tuple_elements(T)]; %% don't treat {} as a leaf - nil -> - [[], []]; %% don't treat [] as a leaf, but as a list - list -> - case erl_syntax:list_suffix(T) of - none -> - [erl_syntax:list_prefix(T), []]; - S -> - [erl_syntax:list_prefix(T), [S]] - end; - binary_field -> - [[erl_syntax:binary_field_body(T)], - erl_syntax:binary_field_types(T)]; - clause -> - case erl_syntax:clause_guard(T) of - none -> - [erl_syntax:clause_patterns(T), [], - erl_syntax:clause_body(T)]; - G -> - [erl_syntax:clause_patterns(T), [G], - erl_syntax:clause_body(T)] - end; - receive_expr -> - case erl_syntax:receive_expr_timeout(T) of - none -> - [erl_syntax:receive_expr_clauses(T), [], []]; - E -> - [erl_syntax:receive_expr_clauses(T), [E], - erl_syntax:receive_expr_action(T)] - end; - record_expr -> - case erl_syntax:record_expr_argument(T) of - none -> - [[], [erl_syntax:record_expr_type(T)], - erl_syntax:record_expr_fields(T)]; - V -> - [[V], [erl_syntax:record_expr_type(T)], - erl_syntax:record_expr_fields(T)] - end; - record_field -> - case erl_syntax:record_field_value(T) of - none -> - [[erl_syntax:record_field_name(T)], []]; - V -> - [[erl_syntax:record_field_name(T)], [V]] - end; - _ -> - erl_syntax:subtrees(T) - end. - -make_tree(list, [P, []]) -> erl_syntax:list(P); -make_tree(list, [P, [S]]) -> erl_syntax:list(P, S); -make_tree(tuple, [E]) -> erl_syntax:tuple(E); -make_tree(binary_field, [[B], Ts]) -> erl_syntax:binary_field(B, Ts); -make_tree(clause, [P, [], B]) -> erl_syntax:clause(P, none, B); -make_tree(clause, [P, [G], B]) -> erl_syntax:clause(P, G, B); -make_tree(receive_expr, [C, [], _A]) -> erl_syntax:receive_expr(C); -make_tree(receive_expr, [C, [E], A]) -> erl_syntax:receive_expr(C, E, A); -make_tree(record_expr, [[], [T], F]) -> erl_syntax:record_expr(T, F); -make_tree(record_expr, [[E], [T], F]) -> erl_syntax:record_expr(E, T, F); -make_tree(record_field, [[N], []]) -> erl_syntax:record_field(N); -make_tree(record_field, [[N], [E]]) -> erl_syntax:record_field(N, E); -make_tree(Type, Groups) -> - erl_syntax:make_tree(Type, Groups). - -merge_comments(_StartLine, [], [T]) -> T; -merge_comments(_StartLine, [], Ts) -> Ts; -merge_comments(StartLine, Comments, Ts) -> - merge_comments(StartLine, Comments, Ts, []). - -merge_comments(_StartLine, [], [], [T]) -> T; -merge_comments(_StartLine, [], [T], []) -> T; -merge_comments(_StartLine, [], Ts, Acc) -> - lists:reverse(Acc, Ts); -merge_comments(StartLine, Cs, [], Acc) -> - merge_comments(StartLine, [], [], - [erl_syntax:set_pos( - erl_syntax:comment(Indent, Text), - StartLine + Line - 1) - || {Line, _, Indent, Text} <- Cs] ++ Acc); -merge_comments(StartLine, [C|Cs], [T|Ts], Acc) -> - {Line, _Col, Indent, Text} = C, - CommentLine = StartLine + Line - 1, - case erl_syntax:get_pos(T) of - Pos when Pos < CommentLine -> - %% TODO: traverse sub-tree rather than only the top level nodes - merge_comments(StartLine, [C|Cs], Ts, [T|Acc]); - CommentLine -> - Tc = erl_syntax:add_postcomments( - [erl_syntax:comment(Indent, Text)], T), - merge_comments(StartLine, Cs, [Tc|Ts], Acc); - _ -> - Tc = erl_syntax:add_precomments( - [erl_syntax:comment(Indent, Text)], T), - merge_comments(StartLine, Cs, [Tc|Ts], Acc) - end. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/merl_tests.erl erlang-17.3-dfsg/lib/syntax_tools/src/merl_tests.erl --- erlang-18.2-dfsg/lib/syntax_tools/src/merl_tests.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/merl_tests.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,539 +0,0 @@ -%% --------------------------------------------------------------------- -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% @author Richard Carlsson -%% @copyright 2012-2015 Richard Carlsson -%% @doc Unit tests for merl. -%% @private - --module(merl_tests). - -%-define(MERL_NO_TRANSFORM, true). --include("merl.hrl"). - --include_lib("eunit/include/eunit.hrl"). - - -%% utilities - -f(Ts) when is_list(Ts) -> - lists:flatmap(fun erl_prettypr:format/1, Ts); -f(T) -> - erl_prettypr:format(T). - -fe(Env) -> [{Key, f(T)} || {Key, T} <- Env]. - -g_exported_() -> - %% for testing the parse transform, autoexported to avoid complaints - {ok, merl:quote(?LINE, "42")}. - - -ok({ok, X}) -> X. - - -%% -%% tests -%% - -parse_error_test_() -> - [?_assertThrow({error, "1: syntax error before: '{'" ++ _}, - f(merl:quote("{"))) - ]. - -term_test_() -> - [?_assertEqual(tuple, erl_syntax:type(merl:term({}))), - ?_assertEqual("{foo, 42}", f(merl:term({foo, 42}))) - ]. - -quote_form_test_() -> - [?_assertEqual("f(X) -> {ok, X}.", - f(?Q("f(X) -> {ok, X}."))), - ?_assertEqual("-module(foo).", - f(?Q("-module(foo)."))), - ?_assertEqual("-import(bar, [f/1, g/2]).", - f(?Q("-import(bar, [f/1, g/2])."))), - ?_assertEqual(("-module(foo)." - "-export([f/1])." - "f(X) -> {ok, X}."), - f(?Q(["-module(foo).", - "-export([f/1]).", - "f(X) -> {ok, X}."]))) - ]. - -quote_term_test_() -> - [?_assertEqual("foo", - f(?Q("foo"))), - ?_assertEqual("42", - f(?Q("42"))), - ?_assertEqual("{foo, 42}", - f(?Q("{foo, 42}"))), - ?_assertEqual(("1" ++ "2" ++ "3"), - f(?Q("1, 2, 3"))), - ?_assertEqual(("foo" "42" "{}" "true"), - f(?Q("foo, 42, {}, (true)"))) - ]. - -quote_expr_test_() -> - [?_assertEqual("2 + 2", - f(?Q("2 + 2"))), - ?_assertEqual("f(foo, 42)", - f(?Q("f(foo, 42)"))), - ?_assertEqual("case X of\n a -> 1;\n b -> 2\nend", - f(?Q("case X of a -> 1; b -> 2 end"))), - ?_assertEqual(("2 + 2" ++ "f(42)" ++ "catch 22"), - f(?Q("2 + 2, f(42), catch 22"))) - ]. - -quote_try_clause_test_() -> - [?_assertEqual("(error:R) when R =/= foo -> ok", - f(?Q("error:R when R =/= foo -> ok"))), - %% note that without any context, clauses are printed as fun-clauses - ?_assertEqual(("(error:badarg) -> badarg" - "(exit:normal) -> normal" - "(_) -> other"), - f(?Q(["error:badarg -> badarg;", - "exit:normal -> normal;" - "_ -> other"]))) - ]. - -quote_fun_clause_test_() -> - [?_assertEqual("(X, Y) when X < Y -> {ok, X}", - f(?Q("(X, Y) when X < Y -> {ok, X}"))), - ?_assertEqual(("(X, Y) when X < Y -> less" - "(X, Y) when X > Y -> greater" - "(_, _) -> equal"), - f(?Q(["(X, Y) when X < Y -> less;", - "(X, Y) when X > Y -> greater;" - "(_, _) -> equal"])))]. - -quote_case_clause_test_() -> - [?_assertEqual("({X, Y}) when X < Y -> X", - f(?Q("{X, Y} when X < Y -> X"))), - ?_assertEqual(("({X, Y}) when X < Y -> -1" - "({X, Y}) when X > Y -> 1" - "(_) -> 0"), - f(?Q(["{X, Y} when X < Y -> -1;", - "{X, Y} when X > Y -> 1;" - "_ -> 0"])))]. - -quote_comment_test_() -> - [?_assertEqual("%% comment preserved\n" - "{foo, 42}", - f(?Q(["%% comment preserved", - "{foo, 42}"]))), - ?_assertEqual("{foo, 42}" - "%% comment preserved\n", - f(?Q(["{foo, 42}", - "%% comment preserved"]))), - ?_assertEqual(" % just a comment (with indent)\n", - f(?Q(" % just a comment (with indent)"))) - ]. - -metavar_test_() -> - [?_assertEqual("'@foo'", f(merl:tree(merl:template(?Q("'@foo'"))))), - ?_assertEqual("'@foo'", f(merl:tree(merl:template(?Q("_@foo"))))), - ?_assertEqual("'@foo'", f(merl:tree(merl:template(?Q("\"'@foo\""))))), - ?_assertEqual("{'@foo'}", f(merl:tree(merl:template(?Q("{_@foo}"))))), - ?_assertEqual("'@foo'", f(merl:tree(merl:template(?Q("{_@_foo}"))))), - ?_assertEqual("909123", f(merl:tree(merl:template(?Q("{9090123}"))))), - ?_assertEqual("{'@foo'}", - f(merl:tree(merl:template(?Q("{{{_@__foo}}}"))))), - ?_assertEqual("{909123}", - f(merl:tree(merl:template(?Q("{{{90900123}}}"))))), - ?_assertEqual("{'@@foo'}", - f(merl:tree(merl:template(?Q("{{{_@__@foo}}}"))))), - ?_assertEqual("{9099123}", - f(merl:tree(merl:template(?Q("{{{909009123}}}"))))) - ]. - -subst_test_() -> - [?_assertEqual("42", - f(merl:subst(?Q("_@foo"), [{foo, merl:term(42)}]))), - ?_assertEqual("'@foo'", - f(merl:subst(?Q("_@foo"), []))), - ?_assertEqual("{42}", - f(merl:subst(?Q("{_@foo}"), - [{foo, merl:term(42)}]))), - ?_assertEqual("{'@foo'}", - f(merl:subst(?Q("{_@foo}"), []))), - ?_assertEqual("fun bar/0", - f(merl:subst(merl:template(?Q("fun '@foo'/0")), - [{foo, merl:term(bar)}]))), - ?_assertEqual("fun foo/3", - f(merl:subst(merl:template(?Q("fun foo/9091")), - [{1, merl:term(3)}]))), - ?_assertEqual("[42]", - f(merl:subst(merl:template(?Q("[_@foo]")), - [{foo, merl:term(42)}]))), - ?_assertEqual("[foo, bar]", - f(merl:subst(merl:template(?Q("[_@foo]")), - [{foo, [merl:term(foo),merl:term(bar)]}]))), - ?_assertEqual("{fee, fie, foe, fum}", - f(merl:subst(merl:template(?Q("{fee, _@foo, fum}")), - [{foo, [merl:term(fie),merl:term(foe)]}]))), - ?_assertEqual("[foo, bar]", - f(merl:subst(merl:template(?Q("[_@@foo]")), - [{foo, [merl:term(foo),merl:term(bar)]}]))), - ?_assertEqual("{fee, fie, foe, fum}", - f(merl:subst(merl:template(?Q("{fee, _@@foo, fum}")), - [{foo, [merl:term(fie),merl:term(foe)]}]))), - ?_assertEqual("['@@foo']", - f(merl:subst(merl:template(?Q("[_@@foo]")), []))), - ?_assertEqual("foo", - f(merl:subst(merl:template(?Q("[_@_foo]")), - [{foo, merl:term(foo)}]))), - ?_assertEqual("{'@foo'}", - f(merl:subst(merl:template(?Q("{[_@_foo]}")), []))), - ?_assertEqual("{'@@foo'}", - f(merl:subst(merl:template(?Q("{[_@_@foo]}")), []))), - ?_assertEqual("-export([foo/1, bar/2]).", - f(merl:subst(merl:template(?Q("-export(['@_@foo'/0]).")), - [{foo, [erl_syntax:arity_qualifier( - merl:term(foo), - merl:term(1)), - erl_syntax:arity_qualifier( - merl:term(bar), - merl:term(2)) - ]} - ]))) - ]. - -match_test_() -> - [?_assertEqual({ok, []}, merl:match(?Q("foo"), ?Q("foo"))), - ?_assertEqual(error, merl:match(?Q("foo"), ?Q("bar"))), - ?_assertEqual({ok,[]}, merl:match(?Q("{foo,42}"), ?Q("{foo,42}"))), - ?_assertEqual(error, merl:match(?Q("{foo,42}"), ?Q("{foo,bar}"))), - ?_assertEqual({ok,[]}, merl:match(?Q("[foo,[42]]"), ?Q("[foo,[42]]"))), - ?_assertEqual(error, merl:match(?Q("[foo,[42]]"), ?Q("[foo,{42}]"))), - ?_assertEqual({ok,[]}, merl:match(?Q("[foo,[_@_]]"), - ?Q("[foo,[42]]"))), - ?_assertEqual({ok,[]}, merl:match(?Q("[foo,[9090]]"), - ?Q("[foo,[42]]"))), - ?_assertEqual({ok,[]}, merl:match(?Q("{_@_,[_@_,2]}"), - ?Q("{foo,[1,2]}"))), - ?_assertEqual(error, merl:match(?Q("{_@_,[_@_,2]}"), - ?Q("{foo,[1,3]}"))), - ?_assertEqual({ok,[]}, merl:match(?Q("[foo,[9090,9090]]"), - ?Q("[foo,[1,2]]"))), - ?_assertEqual(error, merl:match(?Q("[foo,[9090,9090]]"), - ?Q("[foo,[1,2,3]]"))), - ?_assertEqual([{foo,"42"}], - fe(ok(merl:match(?Q("_@foo"), ?Q("42"))))), - ?_assertEqual([{foo,"42"}], - fe(ok(merl:match(?Q("{_@foo}"), ?Q("{42}"))))), - ?_assertEqual([{1,"0"},{foo,"bar"}], - fe(ok(merl:match(?Q("fun '@foo'/9091"), - ?Q("fun bar/0"))))), - ?_assertEqual([{line,"17"},{text,"\"hello\""}], - fe(ok(merl:match(?Q("{_@line, _@text}"), - ?Q("{17, \"hello\"}"))))), - ?_assertEqual([{line,"17"},{text,"\"hello\""}], - fe(ok(merl:match(?Q("foo(_@line, _@text)"), - ?Q("foo(17, \"hello\")"))))), - ?_assertEqual([{foo,""}], - fe(ok(merl:match(?Q("f(_@@foo)"), - ?Q("f()"))))), - ?_assertEqual([{foo,"fee"}], - fe(ok(merl:match(?Q("f(_@@foo)"), - ?Q("f(fee)"))))), - ?_assertEqual([{foo,"feefiefum"}], - fe(ok(merl:match(?Q("f(_@@foo)"), - ?Q("f(fee, fie, fum)"))))), - ?_assertEqual([{foo,""}], - fe(ok(merl:match(?Q("[_@@foo]"), - ?Q("[]"))))), - ?_assertEqual([{foo,"fee"}], - fe(ok(merl:match(?Q("[_@@foo]"), - ?Q("[fee]"))))), - ?_assertEqual([{foo,"feefiefoefum"}], - fe(ok(merl:match(?Q("[_@@foo]"), - ?Q("[fee, fie, foe, fum]"))))), - ?_assertEqual([{foo,""}], - fe(ok(merl:match(?Q("{_@@foo}"), - ?Q("{}"))))), - ?_assertEqual([{foo,"fee"}], - fe(ok(merl:match(?Q("{_@@foo}"), - ?Q("{fee}"))))), - ?_assertEqual([{foo,"feefiefoefum"}], - fe(ok(merl:match(?Q("{_@@foo}"), - ?Q("{fee, fie, foe, fum}"))))), - ?_assertEqual([{foo,"fie"}], - fe(ok(merl:match(?Q("{fee, _@@foo}"), - ?Q("{fee, fie}"))))), - ?_assertEqual([{foo,"fiefoefum"}], - fe(ok(merl:match(?Q("{fee, _@@foo}"), - ?Q("{fee, fie, foe, fum}"))))), - ?_assertEqual([{foo,"fie"}], - fe(ok(merl:match(?Q("{_@@foo, foe, fum}"), - ?Q("{fie, foe, fum}"))))), - ?_assertEqual([{foo,"feefie"}], - fe(ok(merl:match(?Q("{_@@foo, foe, fum}"), - ?Q("{fee, fie, foe, fum}"))))), - ?_assertEqual([{foo,"fie"}], - fe(ok(merl:match(?Q("{fee, _@@foo, fum}"), - ?Q("{fee, fie, fum}"))))), - ?_assertEqual([{foo,"fiefoe"}], - fe(ok(merl:match(?Q("{fee, _@@foo, fum}"), - ?Q("{fee, fie, foe, fum}"))))), - ?_assertEqual([{foo,"fiefoe"},{post,"fum"},{pre,"fee"}], - fe(ok(merl:match(?Q("{_@pre, _@@foo, _@post}"), - ?Q("{fee, fie, foe, fum}"))))), - ?_assertThrow({error, "multiple glob variables"++_}, - fe(ok(merl:match(?Q("{_@@foo, _@@bar}"), - ?Q("{fee, fie, foe, fum}"))))), - ?_assertEqual([], - fe(ok(merl:match(?Q("{fee, _@@_}"), - ?Q("{fee, fie, foe, fum}"))))), - ?_assertEqual([], - fe(ok(merl:match(?Q("{_@@_, foe, fum}"), - ?Q("{fee, fie, foe, fum}"))))), - ?_assertEqual([{post,"fum"},{pre,"fee"}], - fe(ok(merl:match(?Q("{_@pre, _@@_, _@post}"), - ?Q("{fee, fie, foe, fum}"))))) - ]. - -switch_test_() -> - [?_assertEqual(42, merl:switch(?Q("foo"), [fun () -> 42 end])), - ?_assertEqual(17, merl:switch(?Q("foo"), [fun () -> 17 end, - fun () -> 42 end])), - ?_assertEqual(17, merl:switch(?Q("foo"), [{?Q("foo"), - fun ([]) -> 17 end}, - fun () -> 42 end])), - ?_assertEqual(17, - merl:switch(?Q("foo"), [{?Q("bar"), fun ([]) -> 0 end}, - {?Q("foo"), fun ([]) -> 17 end}, - fun () -> 42 end])), - ?_assertEqual([{foo,"17"}], - merl:switch(?Q("{foo,17}"), - [{?Q("{bar, _@foo}"), fun (_) -> 0 end}, - {?Q("{foo, _@foo}"), fun fe/1}, - fun () -> 42 end])), - ?_assertEqual(17, - merl:switch(?Q("{foo, 17}"), - [{?Q("{foo, _@foo}"), - fun ([{foo, X}]) -> f(X) =:= "17" end, - fun (_) -> 17 end}, - fun () -> 42 end])), - ?_assertEqual([{foo,"17"}], - merl:switch(?Q("{foo, 17}"), - [{?Q("{foo, _@foo}"), - fun ([{foo, X}]) -> f(X) =:= "42" end, - fun (_) -> 0 end}, - {?Q("{foo, _@foo}"), fun fe/1}, - fun () -> 42 end])), - ?_assertEqual(17, - merl:switch(?Q("{foo, 17}"), - [{?Q("{foo, _@foo}"), - [{fun ([{foo, X}]) -> f(X) =:= "17" end, - fun (_) -> 17 end}, - fun (_) -> 0 end]}, - fun () -> 42 end])), - ?_assertEqual([{foo,"17"}], - merl:switch(?Q("{foo, 17}"), - [{?Q("{foo, _@foo}"), - [{fun ([{foo, X}]) -> f(X) =:= "42" end, - fun (_) -> 0 end}, - fun fe/1]}, - fun () -> 42 end])) - ]. - --ifndef(MERL_NO_TRANSFORM). - -inline_meta_test_() -> - [?_assertEqual("{foo}", - f(begin - Foo = ?Q("foo"), - ?Q("{_@Foo}") - end)), - ?_assertEqual("{foo, '@bar'}", - f(begin - Foo = ?Q("foo"), - ?Q("{_@Foo,_@bar}") - end)), - ?_assertEqual("{foo, '@bar'}", - f(begin - Q1 = ?Q("foo"), - ?Q("{90919,_@bar}") - end)) - ]. - -inline_meta_autoabstract_test_() -> - [?_assertEqual("{foo}", - f(begin - Foo = foo, - ?Q("{_@Foo@}") - end)), - ?_assertEqual("{foo, '@bar@'}", - f(begin - Foo = foo, - ?Q("{_@Foo@,_@bar@}") - end)), - ?_assertEqual("{foo, '@bar@'}", - f(begin - Q1 = foo, - ?Q("{909199,_@bar@}") - end)) - ]. - -meta_match_test_() -> - [?_assertEqual("{[bar], baz()}", - f(begin - Tree = ?Q("{foo, [bar], baz()}"), - ?Q("{foo, _@Bar, '@Baz'}") = Tree, - ?Q("{_@Bar, _@Baz}") - end)), - ?_assertEqual("{[bar], baz()}", - f(begin - Tree = ?Q("{foo, [bar], baz()}"), - ?Q("{foo, 90919, 90929}") = Tree, - ?Q("{_@Q1, _@Q2}") - end)), - ?_assertError({badmatch,error}, - f(begin - Tree = ?Q("{foo, [bar], baz()}"), - ?Q("{fie, _@Bar, '@Baz'}") = Tree, - ?Q("{_@Bar, _@Baz}") - end)) - ]. - -meta_case_test_() -> - [?_assertEqual("{[bar], baz()}", - f(begin - Tree = ?Q("{foo, [bar], baz()}"), - case Tree of - ?Q("{foo, _@Bar, '@Baz'}") -> ?Q("{_@Bar, _@Baz}") - end - end)), - ?_assertEqual("{foo, [bar], baz()}", - f(begin - Tree = ?Q("{foo, [bar], baz()}"), - case Tree of - ?Q("{fie, _@Bar, '@Baz'}") -> ?Q("{_@Bar, _@Baz}"); - _ -> Tree - end - end)), - ?_assertError(merl_switch_clause, - f(begin - Tree = ?Q("{foo, [bar], baz()}"), - case Tree of - ?Q("{fie, _@Bar, '@Baz'}") -> ?Q("{_@Bar, _@Baz}") - end - end)), - ?_assertEqual("{foo, 4}", - f(begin - Tree = ?Q("{foo, 3}"), - case Tree of - ?Q("{foo, _@N}") -> - N1 = erl_syntax:concrete(N) + 1, - ?Q("{foo, _@N1@}"); - _ -> Tree - end - end)), - ?_assertEqual("-export([f/4]).", - f(begin - Tree = ?Q("-export([f/3])."), - case Tree of - ?Q("-export([f/90919]).") -> - Q2 = erl_syntax:concrete(Q1) + 1, - ?Q("-export([f/909299])."); - _ -> Tree - end - end)), - ?_assertEqual("{1, [bar], baz()}", - f(begin - Tree = ?Q("{foo, [bar], baz()}"), - case Tree of - ?Q("{foo, _@Bar, '@Baz'}") -> - ?Q("{1, _@Bar, _@Baz}"); - ?Q("{fie, _@Bar, '@Baz'}") -> - ?Q("{2, _@Bar, _@Baz}"); - _ -> Tree - end - end)), - ?_assertEqual("{2, [bar], baz()}", - f(begin - Tree = ?Q("{fie, [bar], baz()}"), - case Tree of - ?Q("{foo, _@Bar, '@Baz'}") -> - ?Q("{1, _@Bar, _@Baz}"); - ?Q("{fie, _@Bar, '@Baz'}") -> - ?Q("{2, _@Bar, _@Baz}"); - _ -> Tree - end - end)), - ?_assertEqual("{2, baz()}", - f(begin - Tree = ?Q("{foo, [bar], baz()}"), - case Tree of - ?Q("{foo, [_@Bar], '@Baz'}") - when erl_syntax:is_atom(Bar, foo) -> - ?Q("{1, _@Baz}"); - ?Q("{foo, [_@Bar], '@Baz'}") - when erl_syntax:is_atom(Bar, bar) -> - ?Q("{2, _@Baz}"); - ?Q("{foo, [_@Bar], '@Baz'}") -> - ?Q("{3, _@Baz}"); - _ -> Tree - end - end)), - ?_assertEqual("{2, 42}", - f(begin - Tree = ?Q("{foo, [bar], 42}"), - case Tree of - ?Q("{foo, [_@Bar], '@Baz'}") - when erl_syntax:is_atom(Bar, bar), - erl_syntax:is_integer(Baz, 17) -> - ?Q("{1, _@Bar}"); - ?Q("{foo, [_@Bar], '@Baz'}") - when erl_syntax:is_atom(Bar, bar), - erl_syntax:is_integer(Baz, 42) -> - ?Q("{2, _@Baz}"); - ?Q("{foo, [_@Bar], '@Baz'}") -> - ?Q("{3, _@Baz}"); - _ -> Tree - end - end)), - ?_assertEqual("{2, 42}", - f(begin - Tree = ?Q("{foo, [baz], 42}"), - case Tree of - ?Q("{foo, [_@Bar], '@Baz'}") - when erl_syntax:is_atom(Bar, bar), - erl_syntax:is_integer(Baz, 17) - ; erl_syntax:is_atom(Bar, baz), - erl_syntax:is_integer(Baz, 17) -> - ?Q("{1, _@Bar}"); - ?Q("{foo, [_@Bar], '@Baz'}") - when erl_syntax:is_atom(Bar, bar), - erl_syntax:is_integer(Baz, 42) - ; erl_syntax:is_atom(Bar, baz), - erl_syntax:is_integer(Baz, 42) -> - ?Q("{2, _@Baz}"); - ?Q("{foo, [_@Bar], '@Baz'}") -> - ?Q("{3, _@Baz}"); - _ -> Tree - end - end)), - ?_assertEqual("{2, foo, Bar, Baz, Bar(), Baz()}", - f(begin - Tree = ?Q("foo(Bar, Baz) -> Bar(), Baz()."), - case Tree of - ?Q("'@Func'(_@Args) -> _@Body.") -> - ?Q("{1, _@Func, _@Args, _@Body}"); - ?Q("'@Func'(_@@Args) -> _@@Body.") -> - ?Q("{2, _@Func, _@Args, _@Body}"); - ?Q("'@Func'(_@Args, Baz) -> _@Body1, _@Body2.") -> - ?Q("{3, _@Func, _@Args, _@Body1, _@Body2}") - end - end)) - ]. - --endif. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/merl_transform.erl erlang-17.3-dfsg/lib/syntax_tools/src/merl_transform.erl --- erlang-18.2-dfsg/lib/syntax_tools/src/merl_transform.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/merl_transform.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,262 +0,0 @@ -%% --------------------------------------------------------------------- -%% Licensed under the Apache License, Version 2.0 (the "License"); you may -%% not use this file except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% @author Richard Carlsson -%% @copyright 2012-2015 Richard Carlsson -%% @doc Parse transform for merl. Enables the use of automatic metavariables -%% and using quasi-quotes in matches and case switches. Also optimizes calls -%% to functions in `merl' by partially evaluating them, turning strings to -%% templates, etc., at compile-time. -%% -%% Using `-include_lib("syntax_tools/include/merl.hrl").' enables this -%% transform, unless the macro `MERL_NO_TRANSFORM' is defined first. - --module(merl_transform). - --export([parse_transform/2]). - -%% NOTE: We cannot use inline metavariables or any other parse transform -%% features in this module, because it must be possible to compile it with -%% the parse transform disabled! --include("merl.hrl"). - -%% TODO: unroll calls to switch? it will probably get messy - -%% TODO: use Igor to make resulting code independent of merl at runtime? - -parse_transform(Forms, _Options) -> - erl_syntax:revert_forms(expand(erl_syntax:form_list(Forms))). - -expand(Tree0) -> - Tree = pre(Tree0), - post(case erl_syntax:subtrees(Tree) of - [] -> - Tree; - Gs -> - erl_syntax:update_tree(Tree, - [[expand(T) || T <- G] || G <- Gs]) - end). - -pre(T) -> - merl:switch( - T, - [{?Q("merl:quote(_@line, _@text) = _@expr"), - fun ([{expr,_}, {line,Line}, {text,Text}]) -> - erl_syntax:is_literal(Text) andalso erl_syntax:is_literal(Line) - end, - fun ([{expr,Expr}, {line,Line}, {text,Text}]) -> - pre_expand_match(Expr, erl_syntax:concrete(Line), - erl_syntax:concrete(Text)) - end}, - {?Q(["case _@expr of", - " merl:quote(_@_, _@text) when _@__@_ -> _@@_; _@_@_ -> 0", - "end"]), - fun case_guard/1, - fun (As) -> case_body(As, T) end}, - fun () -> T end - ]). - -case_guard([{expr,_}, {text,Text}]) -> - erl_syntax:is_literal(Text). - -case_body([{expr,Expr}, {text,_Text}], T) -> - pre_expand_case(Expr, erl_syntax:case_expr_clauses(T), - erl_syntax:get_pos(T)). - -post(T) -> - merl:switch( - T, - [{?Q("merl:_@function(_@@args)"), - [{fun ([{args, As}, {function, F}]) -> - lists:all(fun erl_syntax:is_literal/1, [F|As]) - end, - fun ([{args, As}, {function, F}]) -> - Line = erl_syntax:get_pos(F), - [F1|As1] = lists:map(fun erl_syntax:concrete/1, [F|As]), - eval_call(Line, F1, As1, T) - end}, - fun ([{args, As}, {function, F}]) -> - merl:switch( - F, - [{?Q("qquote"), fun ([]) -> expand_qquote(As, T, 1) end}, - {?Q("subst"), fun ([]) -> expand_template(F, As, T) end}, - {?Q("match"), fun ([]) -> expand_template(F, As, T) end}, - fun () -> T end - ]) - end]}, - fun () -> T end]). - -expand_qquote([Line, Text, Env], T, _) -> - case erl_syntax:is_literal(Line) of - true -> - expand_qquote([Text, Env], T, erl_syntax:concrete(Line)); - false -> - T - end; -expand_qquote([Text, Env], T, Line) -> - case erl_syntax:is_literal(Text) of - true -> - As = [Line, erl_syntax:concrete(Text)], - %% expand further if possible - expand(merl:qquote(Line, "merl:subst(_@tree, _@env)", - [{tree, eval_call(Line, quote, As, T)}, - {env, Env}])); - false -> - T - end; -expand_qquote(_As, T, _StartPos) -> - T. - -expand_template(F, [Pattern | Args], T) -> - case erl_syntax:is_literal(Pattern) of - true -> - Line = erl_syntax:get_pos(Pattern), - As = [erl_syntax:concrete(Pattern)], - merl:qquote(Line, "merl:_@function(_@pattern, _@args)", - [{function, F}, - {pattern, eval_call(Line, template, As, T)}, - {args, Args}]); - false -> - T - end; -expand_template(_F, _As, T) -> - T. - -eval_call(Line, F, As, T) -> - try apply(merl, F, As) of - T1 when F =:= quote -> - %% lift metavariables in a template to Erlang variables - Template = merl:template(T1), - Vars = merl:template_vars(Template), - case lists:any(fun is_inline_metavar/1, Vars) of - true when is_list(T1) -> - merl:qquote(Line, "merl:tree([_@template])", - [{template, merl:meta_template(Template)}]); - true -> - merl:qquote(Line, "merl:tree(_@template)", - [{template, merl:meta_template(Template)}]); - false -> - merl:term(T1) - end; - T1 -> - merl:term(T1) - catch - throw:_Reason -> T - end. - -pre_expand_match(Expr, Line, Text) -> - {Template, Out, _Vars} = rewrite_pattern(Line, Text), - merl:qquote(Line, "{ok, _@out} = merl:match(_@template, _@expr)", - [{expr, Expr}, - {out, Out}, - {template, erl_syntax:abstract(Template)}]). - -rewrite_pattern(Line, Text) -> - %% we must rewrite the metavariables in the pattern to use lowercase, - %% and then use real matching to bind the Erlang-level variables - T0 = merl:template(merl:quote(Line, Text)), - Vars = [V || V <- merl:template_vars(T0), is_inline_metavar(V)], - {merl:alpha(T0, [{V, var_to_tag(V)} || V <- Vars]), - erl_syntax:list([erl_syntax:tuple([erl_syntax:abstract(var_to_tag(V)), - erl_syntax:variable(var_name(V))]) - || V <- Vars]), - Vars}. - -var_name(V) when is_integer(V) -> - V1 = if V > 99, (V rem 100) =:= 99 -> - V div 100; - V > 9, (V rem 10) =:= 9 -> - V div 10; - true -> V - end, - list_to_atom("Q" ++ integer_to_list(V1)); -var_name(V) -> V. - -var_to_tag(V) when is_integer(V) -> V; -var_to_tag(V) -> - list_to_atom(string:to_lower(atom_to_list(V))). - -pre_expand_case(Expr, Clauses, Line) -> - merl:qquote(Line, "merl:switch(_@expr, _@clauses)", - [{clauses, erl_syntax:list([pre_expand_case_clause(C) - || C <- Clauses])}, - {expr, Expr}]). - -pre_expand_case_clause(T) -> - %% note that the only allowed non ``?Q(...) -> ...'' clause is ``_ -> ...'' - merl:switch( - T, - [{?Q("(merl:quote(_@line, _@text)) when _@__@guard -> _@@body"), - fun ([{body,_}, {guard,_}, {line,Line}, {text,Text}]) -> - erl_syntax:is_literal(Text) andalso erl_syntax:is_literal(Line) - end, - fun ([{body,Body}, {guard,Guard}, {line,Line}, {text,Text}]) -> - pre_expand_case_clause(Body, Guard, erl_syntax:concrete(Line), - erl_syntax:concrete(Text)) - end}, - {?Q("_ -> _@@body"), - fun (Env) -> merl:qquote("fun () -> _@body end", Env) end} - ]). - -pre_expand_case_clause(Body, Guard, Line, Text) -> - %% this is similar to a meta-match ``?Q("...") = Term'' - %% (note that the guards may in fact be arbitrary expressions) - {Template, Out, Vars} = rewrite_pattern(Line, Text), - GuardExprs = rewrite_guard(Guard), - Param = [{body, Body}, - {guard,GuardExprs}, - {out, Out}, - {template, erl_syntax:abstract(Template)}, - {unused, dummy_uses(Vars)}], - case GuardExprs of - [] -> - merl:qquote(Line, ["{_@template, ", - " fun (_@out) -> _@unused, _@body end}"], - Param); - _ -> - merl:qquote(Line, ["{_@template, ", - " fun (_@out) -> _@unused, _@guard end, ", - " fun (_@out) -> _@unused, _@body end}"], - Param) - end. - -%% We have to insert dummy variable uses at the beginning of the "guard" and -%% "body" function bodies to avoid warnings for unused variables in the -%% generated code. (Expansions at the Erlang level can't be marked up as -%% compiler generated to allow later compiler stages to ignore them.) -dummy_uses(Vars) -> - [?Q("_ = _@var", [{var, erl_syntax:variable(var_name(V))}]) - || V <- Vars]. - -rewrite_guard([]) -> []; -rewrite_guard([D]) -> [make_orelse(erl_syntax:disjunction_body(D))]. - -make_orelse([]) -> []; -make_orelse([C]) -> make_andalso(erl_syntax:conjunction_body(C)); -make_orelse([C | Cs]) -> - ?Q("_@expr orelse _@rest", - [{expr, make_andalso(erl_syntax:conjunction_body(C))}, - {rest, make_orelse(Cs)}]). - -make_andalso([E]) -> E; -make_andalso([E | Es]) -> - ?Q("_@expr andalso _@rest", [{expr, E}, {rest, make_andalso(Es)}]). - -is_inline_metavar(Var) when is_atom(Var) -> - is_erlang_var(atom_to_list(Var)); -is_inline_metavar(Var) when is_integer(Var) -> - Var > 9 andalso (Var rem 10) =:= 9; -is_inline_metavar(_) -> false. - -is_erlang_var([C|_]) when C >= $A, C =< $Z ; C >= $À, C =< $Þ, C /= $× -> - true; -is_erlang_var(_) -> - false. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/syntax_tools.app.src erlang-17.3-dfsg/lib/syntax_tools/src/syntax_tools.app.src --- erlang-18.2-dfsg/lib/syntax_tools/src/syntax_tools.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/syntax_tools.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -11,11 +11,8 @@ erl_syntax_lib, erl_tidy, igor, - merl, - merl_transform, prettypr]}, {registered,[]}, {applications, [stdlib]}, {env, []}, - {runtime_dependencies, - ["compiler-6.0","erts-6.0","kernel-3.0","stdlib-2.5"]}]}. + {runtime_dependencies, ["stdlib-2.0","kernel-3.0","erts-6.0"]}]}. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/src/syntax_tools.appup.src erlang-17.3-dfsg/lib/syntax_tools/src/syntax_tools.appup.src --- erlang-18.2-dfsg/lib/syntax_tools/src/syntax_tools.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/src/syntax_tools.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/syntax_tools/test/Makefile erlang-17.3-dfsg/lib/syntax_tools/test/Makefile --- erlang-18.2-dfsg/lib/syntax_tools/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -6,8 +6,7 @@ # ---------------------------------------------------- MODULES= \ - syntax_tools_SUITE \ - merl_SUITE + syntax_tools_SUITE ERL_FILES= $(MODULES:%=%.erl) @@ -62,6 +61,5 @@ $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) "$(RELSYSDIR)" $(INSTALL_DATA) syntax_tools.spec syntax_tools.cover "$(RELSYSDIR)" chmod -R u+w "$(RELSYSDIR)" - @tar cf - *_SUITE_data | (cd "$(RELSYSDIR)"; tar xf -) release_docs_spec: diff -Nru erlang-18.2-dfsg/lib/syntax_tools/test/merl_SUITE.erl erlang-17.3-dfsg/lib/syntax_tools/test/merl_SUITE.erl --- erlang-18.2-dfsg/lib/syntax_tools/test/merl_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/test/merl_SUITE.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. -%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -%% AB. All Rights Reserved.'' -%% --module(merl_SUITE). - --include_lib("test_server/include/test_server.hrl"). - -%% include the Merl header file --include_lib("syntax_tools/include/merl.hrl"). - -%% for assert macros --include_lib("eunit/include/eunit.hrl"). - -%% Test server specific exports --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). - -%% Test cases --export([merl_smoke_test/1]). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [merl_smoke_test]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - --define(tokens2str(X), ??X). - -merl_smoke_test(Config) when is_list(Config) -> - ?assertThrow({error, "1: syntax error before: '{'" ++ _}, - f(merl:quote("{"))), - ?assertEqual(tuple, erl_syntax:type(merl:term({}))), - ?assertEqual("{foo, 42}", f(merl:term({foo, 42}))), - ?assertEqual("f(X) -> {ok, X}.", f(?Q("f(X) -> {ok, X}."))), - ?assertEqual("{foo, 42}", f(?Q("{foo, 42}"))), - ?assertEqual("2 + 2", f(?Q("2 + 2"))), - ?assertEqual("%% comment preserved\n{foo, 42}", - f(?Q(["%% comment preserved", "{foo, 42}"]))), - ?assertEqual("'@foo'", f(merl:tree(merl:template(?Q("'@foo'"))))), - ?assertEqual("42", f(merl:subst(?Q("_@foo"), [{foo, merl:term(42)}]))), - ?assertEqual({ok, []}, merl:match(?Q("foo"), ?Q("foo"))), - ?assertEqual(42, merl:switch(?Q("foo"), [fun () -> 42 end])), - ?assertEqual("{foo}", f(begin Foo = ?Q("foo"), ?Q("{_@Foo}") end)), - ?assertEqual("{foo}", f(begin Foo = foo, ?Q("{_@Foo@}") end)), - ?assertEqual("{[bar], baz()}", - f(begin - Tree = ?Q("{foo, [bar], baz()}"), - ?Q("{foo, _@Bar, '@Baz'}") = Tree, - ?Q("{_@Bar, _@Baz}") - end)), - ?assertEqual("{[bar], baz()}", - f(begin - Tree = ?Q("{foo, [bar], baz()}"), - case Tree of - ?Q("{foo, _@Bar, '@Baz'}") -> ?Q("{_@Bar, _@Baz}") - end - end)), - ok. - -%% utilities - -f(Ts) when is_list(Ts) -> - lists:flatmap(fun erl_prettypr:format/1, Ts); -f(T) -> - erl_prettypr:format(T). diff -Nru erlang-18.2-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/m1.erl erlang-17.3-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/m1.erl --- erlang-18.2-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/m1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/m1.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -%% -%% File: m1.erl -%% Author: Björn-Egil Dahlberg -%% Created: 2014-10-24 -%% - --module(m1). - --export([foo/0,bar/1,baz/2]). - -foo() -> - [m2:foo(), - m2:bar()]. - -bar(A) -> - [m2:foo(A), - m2:bar(A), - m2:record_update(3,m2:record())]. - -baz(A,B) -> - [m2:foo(A,B), - m2:bar(A,B)]. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/m2.erl erlang-17.3-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/m2.erl --- erlang-18.2-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/m2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/m2.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -%% -%% File: m2.erl -%% Author: Björn-Egil Dahlberg -%% Created: 2014-10-24 -%% - --module(m2). - - --export([foo/0,foo/1,foo/2, - bar/0,bar/1,bar/2, - record_update/2, record/0]). - -foo() -> ok. -foo(A) -> [item,A]. -foo(A,B) -> A + B. - -bar() -> true. -bar(A) -> {element,A}. -bar(A,B) -> A*B. - --record(rec, {a,b}). - -record() -> #rec{a=3,b=0}. -record_update(V,#rec{a=V0}=R) -> - R#rec{a=V0+V,b=V0}. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/syntax_tools_SUITE_test_module.erl erlang-17.3-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/syntax_tools_SUITE_test_module.erl --- erlang-18.2-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/syntax_tools_SUITE_test_module.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/syntax_tools_SUITE_test_module.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,540 +0,0 @@ --module(syntax_tools_SUITE_test_module). - --export([foo1/1,foo2/3,start_child/2]). - --export([len/1,equal/2,concat/2,chr/2,rchr/2,str/2,rstr/2, - span/2,cspan/2,substr/2,substr/3,tokens/2,chars/2,chars/3]). --export([copies/2,words/1,words/2,strip/1,strip/2,strip/3, - sub_word/2,sub_word/3,left/2,left/3,right/2,right/3, - sub_string/2,sub_string/3,centre/2,centre/3, join/2]). --export([to_upper/1, to_lower/1]). - --import(lists,[reverse/1,member/2]). - - -%% @type some_type() = map() -%% @type some_other_type() = {a, #{ list() => term()}} - --type some_type() :: map(). --type some_other_type() :: {'a', #{ list() => term()} }. - --spec foo1(Map :: #{ 'a' => integer(), 'b' => term()}) -> term(). - -%% @doc Gets value from map. - -foo1(#{ a:= 1, b := V}) -> V. - -%% @spec foo2(some_type(), Type2 :: some_other_type(), map()) -> Value -%% @doc Gets value from map. - --spec foo2( - Type1 :: some_type(), - Type2 :: some_other_type(), - Map :: #{ get => 'value', 'value' => binary()}) -> binary(). - -foo2(Type1, {a,#{ "a" := _}}, #{get := value, value := B}) when is_map(Type1) -> B. - -%% from supervisor 18.0 - --type child() :: 'undefined' | pid(). --type child_id() :: term(). --type mfargs() :: {M :: module(), F :: atom(), A :: [term()] | undefined}. --type modules() :: [module()] | 'dynamic'. --type restart() :: 'permanent' | 'transient' | 'temporary'. --type shutdown() :: 'brutal_kill' | timeout(). --type worker() :: 'worker' | 'supervisor'. --type sup_ref() :: (Name :: atom()) - | {Name :: atom(), Node :: node()} - | {'global', Name :: atom()} - | {'via', Module :: module(), Name :: any()} - | pid(). --type child_spec() :: #{name => child_id(), % mandatory - start => mfargs(), % mandatory - restart => restart(), % optional - shutdown => shutdown(), % optional - type => worker(), % optional - modules => modules()} % optional - | {Id :: child_id(), - StartFunc :: mfargs(), - Restart :: restart(), - Shutdown :: shutdown(), - Type :: worker(), - Modules :: modules()}. - --type startchild_err() :: 'already_present' - | {'already_started', Child :: child()} | term(). --type startchild_ret() :: {'ok', Child :: child()} - | {'ok', Child :: child(), Info :: term()} - | {'error', startchild_err()}. - - --spec start_child(SupRef, ChildSpec) -> startchild_ret() when - SupRef :: sup_ref(), - ChildSpec :: child_spec() | (List :: [term()]). -start_child(Supervisor, ChildSpec) -> - {Supervisor,ChildSpec}. - - -%% From string.erl -%% Robert's bit - -%% len(String) -%% Return the length of a string. - --spec len(String) -> Length when - String :: string(), - Length :: non_neg_integer(). - -len(S) -> length(S). - -%% equal(String1, String2) -%% Test if 2 strings are equal. - --spec equal(String1, String2) -> boolean() when - String1 :: string(), - String2 :: string(). - -equal(S, S) -> true; -equal(_, _) -> false. - -%% concat(String1, String2) -%% Concatenate 2 strings. - --spec concat(String1, String2) -> String3 when - String1 :: string(), - String2 :: string(), - String3 :: string(). - -concat(S1, S2) -> S1 ++ S2. - -%% chr(String, Char) -%% rchr(String, Char) -%% Return the first/last index of the character in a string. - --spec chr(String, Character) -> Index when - String :: string(), - Character :: char(), - Index :: non_neg_integer(). - -chr(S, C) when is_integer(C) -> chr(S, C, 1). - -chr([C|_Cs], C, I) -> I; -chr([_|Cs], C, I) -> chr(Cs, C, I+1); -chr([], _C, _I) -> 0. - --spec rchr(String, Character) -> Index when - String :: string(), - Character :: char(), - Index :: non_neg_integer(). - -rchr(S, C) when is_integer(C) -> rchr(S, C, 1, 0). - -rchr([C|Cs], C, I, _L) -> %Found one, now find next! - rchr(Cs, C, I+1, I); -rchr([_|Cs], C, I, L) -> - rchr(Cs, C, I+1, L); -rchr([], _C, _I, L) -> L. - -%% str(String, SubString) -%% rstr(String, SubString) -%% index(String, SubString) -%% Return the first/last index of the sub-string in a string. -%% index/2 is kept for backwards compatibility. - --spec str(String, SubString) -> Index when - String :: string(), - SubString :: string(), - Index :: non_neg_integer(). - -str(S, Sub) when is_list(Sub) -> str(S, Sub, 1). - -str([C|S], [C|Sub], I) -> - case prefix(Sub, S) of - true -> I; - false -> str(S, [C|Sub], I+1) - end; -str([_|S], Sub, I) -> str(S, Sub, I+1); -str([], _Sub, _I) -> 0. - --spec rstr(String, SubString) -> Index when - String :: string(), - SubString :: string(), - Index :: non_neg_integer(). - -rstr(S, Sub) when is_list(Sub) -> rstr(S, Sub, 1, 0). - -rstr([C|S], [C|Sub], I, L) -> - case prefix(Sub, S) of - true -> rstr(S, [C|Sub], I+1, I); - false -> rstr(S, [C|Sub], I+1, L) - end; -rstr([_|S], Sub, I, L) -> rstr(S, Sub, I+1, L); -rstr([], _Sub, _I, L) -> L. - -prefix([C|Pre], [C|String]) -> prefix(Pre, String); -prefix([], String) when is_list(String) -> true; -prefix(Pre, String) when is_list(Pre), is_list(String) -> false. - -%% span(String, Chars) -> Length. -%% cspan(String, Chars) -> Length. - --spec span(String, Chars) -> Length when - String :: string(), - Chars :: string(), - Length :: non_neg_integer(). - -span(S, Cs) when is_list(Cs) -> span(S, Cs, 0). - -span([C|S], Cs, I) -> - case member(C, Cs) of - true -> span(S, Cs, I+1); - false -> I - end; -span([], _Cs, I) -> I. - --spec cspan(String, Chars) -> Length when - String :: string(), - Chars :: string(), - Length :: non_neg_integer(). - -cspan(S, Cs) when is_list(Cs) -> cspan(S, Cs, 0). - -cspan([C|S], Cs, I) -> - case member(C, Cs) of - true -> I; - false -> cspan(S, Cs, I+1) - end; -cspan([], _Cs, I) -> I. - -%% substr(String, Start) -%% substr(String, Start, Length) -%% Extract a sub-string from String. - --spec substr(String, Start) -> SubString when - String :: string(), - SubString :: string(), - Start :: pos_integer(). - -substr(String, 1) when is_list(String) -> - String; -substr(String, S) when is_integer(S), S > 1 -> - substr2(String, S). - --spec substr(String, Start, Length) -> SubString when - String :: string(), - SubString :: string(), - Start :: pos_integer(), - Length :: non_neg_integer(). - -substr(String, S, L) when is_integer(S), S >= 1, is_integer(L), L >= 0 -> - substr1(substr2(String, S), L). - -substr1([C|String], L) when L > 0 -> [C|substr1(String, L-1)]; -substr1(String, _L) when is_list(String) -> []. %Be nice! - -substr2(String, 1) when is_list(String) -> String; -substr2([_|String], S) -> substr2(String, S-1). - -%% tokens(String, Seperators). -%% Return a list of tokens seperated by characters in Seperators. - --spec tokens(String, SeparatorList) -> Tokens when - String :: string(), - SeparatorList :: string(), - Tokens :: [Token :: nonempty_string()]. - -tokens(S, Seps) -> - tokens1(S, Seps, []). - -tokens1([C|S], Seps, Toks) -> - case member(C, Seps) of - true -> tokens1(S, Seps, Toks); - false -> tokens2(S, Seps, Toks, [C]) - end; -tokens1([], _Seps, Toks) -> - reverse(Toks). - -tokens2([C|S], Seps, Toks, Cs) -> - case member(C, Seps) of - true -> tokens1(S, Seps, [reverse(Cs)|Toks]); - false -> tokens2(S, Seps, Toks, [C|Cs]) - end; -tokens2([], _Seps, Toks, Cs) -> - reverse([reverse(Cs)|Toks]). - --spec chars(Character, Number) -> String when - Character :: char(), - Number :: non_neg_integer(), - String :: string(). - -chars(C, N) -> chars(C, N, []). - --spec chars(Character, Number, Tail) -> String when - Character :: char(), - Number :: non_neg_integer(), - Tail :: string(), - String :: string(). - -chars(C, N, Tail) when N > 0 -> - chars(C, N-1, [C|Tail]); -chars(C, 0, Tail) when is_integer(C) -> - Tail. - -%% Torbjörn's bit. - -%%% COPIES %%% - --spec copies(String, Number) -> Copies when - String :: string(), - Copies :: string(), - Number :: non_neg_integer(). - -copies(CharList, Num) when is_list(CharList), is_integer(Num), Num >= 0 -> - copies(CharList, Num, []). - -copies(_CharList, 0, R) -> - R; -copies(CharList, Num, R) -> - copies(CharList, Num-1, CharList++R). - -%%% WORDS %%% - --spec words(String) -> Count when - String :: string(), - Count :: pos_integer(). - -words(String) -> words(String, $\s). - --spec words(String, Character) -> Count when - String :: string(), - Character :: char(), - Count :: pos_integer(). - -words(String, Char) when is_integer(Char) -> - w_count(strip(String, both, Char), Char, 0). - -w_count([], _, Num) -> Num+1; -w_count([H|T], H, Num) -> w_count(strip(T, left, H), H, Num+1); -w_count([_H|T], Char, Num) -> w_count(T, Char, Num). - -%%% SUB_WORDS %%% - --spec sub_word(String, Number) -> Word when - String :: string(), - Word :: string(), - Number :: integer(). - -sub_word(String, Index) -> sub_word(String, Index, $\s). - --spec sub_word(String, Number, Character) -> Word when - String :: string(), - Word :: string(), - Number :: integer(), - Character :: char(). - -sub_word(String, Index, Char) when is_integer(Index), is_integer(Char) -> - case words(String, Char) of - Num when Num < Index -> - []; - _Num -> - s_word(strip(String, left, Char), Index, Char, 1, []) - end. - -s_word([], _, _, _,Res) -> reverse(Res); -s_word([Char|_],Index,Char,Index,Res) -> reverse(Res); -s_word([H|T],Index,Char,Index,Res) -> s_word(T,Index,Char,Index,[H|Res]); -s_word([Char|T],Stop,Char,Index,Res) when Index < Stop -> - s_word(strip(T,left,Char),Stop,Char,Index+1,Res); -s_word([_|T],Stop,Char,Index,Res) when Index < Stop -> - s_word(T,Stop,Char,Index,Res). - -%%% STRIP %%% - --spec strip(string()) -> string(). - -strip(String) -> strip(String, both). - --spec strip(String, Direction) -> Stripped when - String :: string(), - Stripped :: string(), - Direction :: left | right | both. - -strip(String, left) -> strip_left(String, $\s); -strip(String, right) -> strip_right(String, $\s); -strip(String, both) -> - strip_right(strip_left(String, $\s), $\s). - --spec strip(String, Direction, Character) -> Stripped when - String :: string(), - Stripped :: string(), - Direction :: left | right | both, - Character :: char(). - -strip(String, right, Char) -> strip_right(String, Char); -strip(String, left, Char) -> strip_left(String, Char); -strip(String, both, Char) -> - strip_right(strip_left(String, Char), Char). - -strip_left([Sc|S], Sc) -> - strip_left(S, Sc); -strip_left([_|_]=S, Sc) when is_integer(Sc) -> S; -strip_left([], Sc) when is_integer(Sc) -> []. - -strip_right([Sc|S], Sc) -> - case strip_right(S, Sc) of - [] -> []; - T -> [Sc|T] - end; -strip_right([C|S], Sc) -> - [C|strip_right(S, Sc)]; -strip_right([], Sc) when is_integer(Sc) -> - []. - -%%% LEFT %%% - --spec left(String, Number) -> Left when - String :: string(), - Left :: string(), - Number :: non_neg_integer(). - -left(String, Len) when is_integer(Len) -> left(String, Len, $\s). - --spec left(String, Number, Character) -> Left when - String :: string(), - Left :: string(), - Number :: non_neg_integer(), - Character :: char(). - -left(String, Len, Char) when is_integer(Char) -> - Slen = length(String), - if - Slen > Len -> substr(String, 1, Len); - Slen < Len -> l_pad(String, Len-Slen, Char); - Slen =:= Len -> String - end. - -l_pad(String, Num, Char) -> String ++ chars(Char, Num). - -%%% RIGHT %%% - --spec right(String, Number) -> Right when - String :: string(), - Right :: string(), - Number :: non_neg_integer(). - -right(String, Len) when is_integer(Len) -> right(String, Len, $\s). - --spec right(String, Number, Character) -> Right when - String :: string(), - Right :: string(), - Number :: non_neg_integer(), - Character :: char(). - -right(String, Len, Char) when is_integer(Char) -> - Slen = length(String), - if - Slen > Len -> substr(String, Slen-Len+1); - Slen < Len -> r_pad(String, Len-Slen, Char); - Slen =:= Len -> String - end. - -r_pad(String, Num, Char) -> chars(Char, Num, String). - -%%% CENTRE %%% - --spec centre(String, Number) -> Centered when - String :: string(), - Centered :: string(), - Number :: non_neg_integer(). - -centre(String, Len) when is_integer(Len) -> centre(String, Len, $\s). - --spec centre(String, Number, Character) -> Centered when - String :: string(), - Centered :: string(), - Number :: non_neg_integer(), - Character :: char(). - -centre(String, 0, Char) when is_list(String), is_integer(Char) -> - []; % Strange cases to centre string -centre(String, Len, Char) when is_integer(Char) -> - Slen = length(String), - if - Slen > Len -> substr(String, (Slen-Len) div 2 + 1, Len); - Slen < Len -> - N = (Len-Slen) div 2, - r_pad(l_pad(String, Len-(Slen+N), Char), N, Char); - Slen =:= Len -> String - end. - -%%% SUB_STRING %%% - --spec sub_string(String, Start) -> SubString when - String :: string(), - SubString :: string(), - Start :: pos_integer(). - -sub_string(String, Start) -> substr(String, Start). - --spec sub_string(String, Start, Stop) -> SubString when - String :: string(), - SubString :: string(), - Start :: pos_integer(), - Stop :: pos_integer(). - -sub_string(String, Start, Stop) -> substr(String, Start, Stop - Start + 1). - -%% ISO/IEC 8859-1 (latin1) letters are converted, others are ignored -%% - -to_lower_char(C) when is_integer(C), $A =< C, C =< $Z -> - C + 32; -to_lower_char(C) when is_integer(C), 16#C0 =< C, C =< 16#D6 -> - C + 32; -to_lower_char(C) when is_integer(C), 16#D8 =< C, C =< 16#DE -> - C + 32; -to_lower_char(C) -> - C. - -to_upper_char(C) when is_integer(C), $a =< C, C =< $z -> - C - 32; -to_upper_char(C) when is_integer(C), 16#E0 =< C, C =< 16#F6 -> - C - 32; -to_upper_char(C) when is_integer(C), 16#F8 =< C, C =< 16#FE -> - C - 32; -to_upper_char(C) -> - C. - --spec to_lower(String) -> Result when - String :: io_lib:latin1_string(), - Result :: io_lib:latin1_string() - ; (Char) -> CharResult when - Char :: char(), - CharResult :: char(). - -to_lower(S) when is_list(S) -> - [to_lower_char(C) || C <- S]; -to_lower(C) when is_integer(C) -> - to_lower_char(C). - --spec to_upper(String) -> Result when - String :: io_lib:latin1_string(), - Result :: io_lib:latin1_string() - ; (Char) -> CharResult when - Char :: char(), - CharResult :: char(). - -to_upper(S) when is_list(S) -> - [to_upper_char(C) || C <- S]; -to_upper(C) when is_integer(C) -> - to_upper_char(C). - --spec join(StringList, Separator) -> String when - StringList :: [string()], - Separator :: string(), - String :: string(). - -join([], Sep) when is_list(Sep) -> - []; -join([H|T], Sep) -> - H ++ lists:append([Sep ++ X || X <- T]). diff -Nru erlang-18.2-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/syntax_tools_test.erl erlang-17.3-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/syntax_tools_test.erl --- erlang-18.2-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/syntax_tools_test.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/test/syntax_tools_SUITE_data/syntax_tools_test.erl 1970-01-01 00:00:00.000000000 +0000 @@ -1,115 +0,0 @@ -%% -%% File: syntax_tools_test.erl -%% Author: Björn-Egil Dahlberg -%% Created: 2014-10-23 -%% - --module(syntax_tools_test). - --export([foo1/0,foo2/2,foo3/0,foo4/3,foo5/1]). - --include_lib("kernel/include/file.hrl"). --record(state, { a, b, c, d}). --attribute([foo/0]). - --define(attrib, some_attrib). - --?attrib([foo2/2]). - --define(macro_simple1, ok). --define(MACRO_SIMPLE2, (other)). --define(macro_simple3, ?MODULE). --define(macro_simple4, [?macro_simple3,?MODULE,?MACRO_SIMPLE2]). --define(macro_simple5, (process_info)). --define(macro_string, "hello world"). --define(macro_argument1(X), (X + 3)). --define(macro_argument2(X,Y), (X + 3 * Y)). --define(macro_block(X), begin X end). --define(macro_if(X1,X2), if X1 -> X2; true -> none end). - - --ifdef(macro_def1). --define(macro_cond1, yep). --else. --define(macro_cond1, nope). --endif. --ifndef(macro_def2). --define(macro_cond2, nope). --else. --define(macro_cond2, yep). --endif. --undef(macro_def1). --undef(macro_def2). - -%% basic test -foo1() -> - ok. - -%% macro test -foo2(A,B) -> - % string combining ? - [?macro_string, ?macro_string - ?macro_string, - "hello world " - "more hello", - [?macro_simple1, - ?MACRO_SIMPLE2, - ?macro_simple3, - ?macro_simple4, - ?macro_simple5, - ?macro_string, - ?macro_cond1, - ?macro_cond2, - ?macro_block(A), - ?macro_if(A,B), - ?macro_argument1(A), - ?macro_argument1(begin A end), - ?macro_block(<<"hello">>), - ?macro_block("hello"), - ?macro_block([$h,$e,$l,$l,$0]), - ?macro_argument1(id(<<"hello">>)), - ?macro_argument1(if A -> B; true -> 3.14 end), - ?macro_argument1(case A of ok -> B; C -> C end), - ?macro_argument1(receive M -> M after 100 -> 3 end), - ?macro_argument1(try foo5(A) catch C:?macro_simple5 -> {C,B} end), - ?macro_argument2(A,B)], - A,B,ok]. - -id(I) -> I. -%% basic terms - -foo3() -> - [atom, - 'some other atom', - {tuple,1,2,3}, - 1,2,3,3333, - 3,3333,2,1, - [$a,$b,$c], - "hello world", - <<"hello world">>, - <<1,2,3,4,5:6>>, - 3.1415, - 1.03e33]. - -%% application and records - -foo4(A,B,#state{c = C}=S) -> - Ls = foo3(), - S1 = #state{ a = 1, b = 2 }, - [foo2(A,Ls),B,C, - B(3,C), - erlang:process_info(self()), - erlang:?macro_simple5(self()), - A:?MACRO_SIMPLE2(), - A:?macro_simple1(), - A:process_info(self()), - A:B(3), - S#state{ a = 2, b = B, d = S1 }]. - -foo5(A) -> - try foo2(A,A) of - R -> R - catch - error:?macro_simple5 -> - nope - end. diff -Nru erlang-18.2-dfsg/lib/syntax_tools/test/syntax_tools_SUITE.erl erlang-17.3-dfsg/lib/syntax_tools/test/syntax_tools_SUITE.erl --- erlang-18.2-dfsg/lib/syntax_tools/test/syntax_tools_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/test/syntax_tools_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -%% ``Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings @@ -25,16 +24,12 @@ init_per_group/2,end_per_group/2]). %% Test cases --export([app_test/1,appup_test/1,smoke_test/1,revert/1,revert_map/1, - t_abstract_type/1,t_erl_parse_type/1,t_epp_dodger/1, - t_comment_scan/1,t_igor/1]). +-export([app_test/1,appup_test/1,smoke_test/1,revert/1,revert_map/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [app_test,appup_test,smoke_test,revert,revert_map, - t_abstract_type,t_erl_parse_type,t_epp_dodger, - t_comment_scan,t_igor]. + [app_test,appup_test,smoke_test,revert,revert_map]. groups() -> []. @@ -59,15 +54,15 @@ %% Read and parse all source in the OTP release. smoke_test(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(12)), - Wc = filename:join([code:lib_dir(),"*","src","*.erl"]), - Fs = filelib:wildcard(Wc), - io:format("~p files\n", [length(Fs)]), - case p_run(fun smoke_test_file/1, Fs) of - 0 -> ok; - N -> ?t:fail({N,errors}) - end, - ?t:timetrap_cancel(Dog). + ?line Dog = ?t:timetrap(?t:minutes(12)), + ?line Wc = filename:join([code:lib_dir(),"*","src","*.erl"]), + ?line Fs = filelib:wildcard(Wc), + ?line io:format("~p files\n", [length(Fs)]), + ?line case p_run(fun smoke_test_file/1, Fs) of + 0 -> ok; + N -> ?line ?t:fail({N,errors}) + end, + ?line ?t:timetrap_cancel(Dog). smoke_test_file(File) -> case epp_dodger:parse_file(File) of @@ -99,9 +94,9 @@ io:format("~p files\n", [length(Fs)]), case p_run(fun (File) -> revert_file(File, Path) end, Fs) of 0 -> ok; - N -> ?t:fail({N,errors}) + N -> ?line ?t:fail({N,errors}) end, - ?t:timetrap_cancel(Dog). + ?line ?t:timetrap_cancel(Dog). revert_file(File, Path) -> case epp:parse_file(File, Path, []) of @@ -115,298 +110,14 @@ end. %% Testing bug fix for reverting map_field_assoc -revert_map(Config) when is_list(Config) -> +revert_map(Config) -> Dog = ?t:timetrap(?t:minutes(1)), - [{map_field_assoc,16,{atom,17,name},{var,18,'Value'}}] = - erl_syntax:revert_forms([{tree,map_field_assoc, - {attr,16,[],none}, - {map_field_assoc,{atom,17,name},{var,18,'Value'}}}]), - ?t:timetrap_cancel(Dog). - - - -%% api tests - -t_abstract_type(Config) when is_list(Config) -> - F = fun validate_abstract_type/1, - ok = validate(F,[{hi,atom}, - {1,integer}, - {1.0,float}, - {$a,integer}, - {[],nil}, - {[<<1,2>>,a,b],list}, - {[2,3,<<1,2>>,a,b],list}, - {[$a,$b,$c],string}, - {"hello world",string}, - {<<1,2,3>>,binary}, - {#{a=>1,"b"=>2},map_expr}, - {#{#{i=>1}=>1,"b"=>#{v=>2}},map_expr}, - {{a,b,c},tuple}]), - ok. - -t_erl_parse_type(Config) when is_list(Config) -> - F = fun validate_erl_parse_type/1, - %% leaf types - ok = validate(F,[{"1",integer,true}, - {"123456789",integer,true}, - {"$h", char,true}, - {"3.1415", float,true}, - {"1.33e36", float,true}, - {"\"1.33e36: hello\"", string,true}, - {"Var1", variable,true}, - {"_", underscore,true}, - {"[]", nil,true}, - {"{}", tuple,true}, - {"#{}",map_expr,true}, - {"'some atom'", atom, true}]), - %% composite types - ok = validate(F,[{"case X of t -> t; f -> f end", case_expr,false}, - {"try X of t -> t catch C:R -> error end", try_expr,false}, - {"receive X -> X end", receive_expr,false}, - {"receive M -> X1 after T -> X2 end", receive_expr,false}, - {"catch (X)", catch_expr,false}, - {"fun(X) -> X end", fun_expr,false}, - {"fun Foo(X) -> X end", named_fun_expr,false}, - {"fun foo/2", implicit_fun,false}, - {"fun bar:foo/2", implicit_fun,false}, - {"if X -> t; true -> f end", if_expr,false}, - {"<<1,2,3,4>>", binary,false}, - {"<<1,2,3,4:5>>", binary,false}, - {"<>", binary,false}, - {"begin X end", block_expr,false}, - {"foo(X1,X2)", application,false}, - {"bar:foo(X1,X2)", application,false}, - {"[1,2,3,4]", list,false}, - {"[1|4]", list, false}, - {"[<<1>>,<<2>>,-2,<<>>,[more,list]]", list,false}, - {"[1|[2|[3|[4|[]]]]]", list,false}, - {"#{ a=>1, b=>2 }", map_expr,false}, - {"#{3=>3}#{ a=>1, b=>2 }", map_expr,false}, - {"#{ a:=1, b:=2 }", map_expr,false}, - {"M#{ a=>1, b=>2 }", map_expr,false}, - {"[V||V <- Vs]", list_comp,false}, - {"<< <> || <> <= Bs>>", binary_comp,false}, - {"#state{ a = A, b = B}", record_expr,false}, - {"#state{}", record_expr,false}, - {"#s{ a = #def{ a=A }, b = B}", record_expr,false}, - {"State#state{ a = A, b = B}", record_expr,false}, - {"State#state.a", record_access,false}, - {"#state.a", record_index_expr,false}, - {"-X", prefix_expr,false}, - {"X1 + X2", infix_expr,false}, - {"(X1 + X2) * X3", infix_expr,false}, - {"X1 = X2", match_expr,false}, - {"{a,b,c}", tuple,false}]), - ok. - -%% the macro ?MODULE seems faulty -t_epp_dodger(Config) when is_list(Config) -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - Filenames = ["syntax_tools_SUITE_test_module.erl", - "syntax_tools_test.erl"], - ok = test_epp_dodger(Filenames,DataDir,PrivDir), - ok. - -t_comment_scan(Config) when is_list(Config) -> - DataDir = ?config(data_dir, Config), - Filenames = ["syntax_tools_SUITE_test_module.erl", - "syntax_tools_test.erl"], - ok = test_comment_scan(Filenames,DataDir), - ok. - -t_igor(Config) when is_list(Config) -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - FileM1 = filename:join(DataDir,"m1.erl"), - FileM2 = filename:join(DataDir,"m2.erl"), - ["m.erl",_]=R = igor:merge(m,[FileM1,FileM2],[{outdir,PrivDir}]), - io:format("igor:merge/3 = ~p~n", [R]), - ok. - -test_comment_scan([],_) -> ok; -test_comment_scan([File|Files],DataDir) -> - Filename = filename:join(DataDir,File), - {ok, Fs0} = epp:parse_file(Filename, [], []), - Comments = erl_comment_scan:file(Filename), - Fun = fun(Node) -> - case erl_syntax:is_form(Node) of - true -> - C1 = erl_syntax:comment(2,[" This is a form."]), - Node1 = erl_syntax:add_precomments([C1],Node), - Node1; - false -> - Node - end - end, - Fs1 = erl_recomment:recomment_forms(Fs0, Comments), - Fs2 = erl_syntax_lib:map(Fun, Fs1), - io:format("File: ~s~n", [Filename]), - io:put_chars(erl_prettypr:format(Fs2, [{paper, 120}, - {ribbon, 110}])), - test_comment_scan(Files,DataDir). - - -test_epp_dodger([], _, _) -> ok; -test_epp_dodger([Filename|Files],DataDir,PrivDir) -> - io:format("Parsing ~p~n", [Filename]), - InFile = filename:join(DataDir, Filename), - Parsers = [{fun epp_dodger:parse_file/1,parse_file}, - {fun epp_dodger:quick_parse_file/1,quick_parse_file}, - {fun (File) -> - {ok,Dev} = file:open(File,[read]), - Res = epp_dodger:parse(Dev), - file:close(File), - Res - end, parse}, - {fun (File) -> - {ok,Dev} = file:open(File,[read]), - Res = epp_dodger:quick_parse(Dev), - file:close(File), - Res - end, quick_parse}], - FsForms = parse_with(Parsers, InFile), - ok = pretty_print_parse_forms(FsForms,PrivDir,Filename), - test_epp_dodger(Files,DataDir,PrivDir). - -parse_with([],_) -> []; -parse_with([{Fun,ParserType}|Funs],File) -> - {ok, Fs} = Fun(File), - [{Fs,ParserType}|parse_with(Funs,File)]. - -pretty_print_parse_forms([],_,_) -> ok; -pretty_print_parse_forms([{Fs0,Type}|FsForms],PrivDir,Filename) -> - Parser = atom_to_list(Type), - OutFile = filename:join(PrivDir, Parser ++"_" ++ Filename), - io:format("Pretty print ~p (~w) to ~p~n", [Filename,Type,OutFile]), - Comment = fun (Node,{CntCase,CntTry}=Cnt) -> - case erl_syntax:type(Node) of - case_expr -> - C1 = erl_syntax:comment(2,["Before a case expression"]), - Node1 = erl_syntax:add_precomments([C1],Node), - C2 = erl_syntax:comment(2,["After a case expression"]), - Node2 = erl_syntax:add_postcomments([C2],Node1), - {Node2,{CntCase+1,CntTry}}; - try_expr -> - C1 = erl_syntax:comment(2,["Before a try expression"]), - Node1 = erl_syntax:set_precomments(Node, - erl_syntax:get_precomments(Node) ++ [C1]), - C2 = erl_syntax:comment(2,["After a try expression"]), - Node2 = erl_syntax:set_postcomments(Node1, - erl_syntax:get_postcomments(Node1) ++ [C2]), - {Node2,{CntCase,CntTry+1}}; - _ -> - {Node,Cnt} - end - end, - Fs1 = erl_syntax:form_list(Fs0), - {Fs2,{CC,CT}} = erl_syntax_lib:mapfold(Comment,{0,0}, Fs1), - io:format("Commented on ~w cases and ~w tries~n", [CC,CT]), - PP = erl_prettypr:format(Fs2), - ok = file:write_file(OutFile,iolist_to_binary(PP)), - pretty_print_parse_forms(FsForms,PrivDir,Filename). - - -validate(_,[]) -> ok; -validate(F,[V|Vs]) -> - ok = F(V), - validate(F,Vs). - - -validate_abstract_type({Lit,Type}) -> - Tree = erl_syntax:abstract(Lit), - ok = validate_special_type(Type,Tree), - Type = erl_syntax:type(Tree), - true = erl_syntax:is_literal(Tree), - ErlT = erl_syntax:revert(Tree), - Type = erl_syntax:type(ErlT), - ok = validate_special_type(Type,ErlT), - Conc = erl_syntax:concrete(Tree), - Lit = Conc, - ok. - -validate_erl_parse_type({String,Type,Leaf}) -> - ErlT = string_to_expr(String), - ok = validate_special_type(Type,ErlT), - Type = erl_syntax:type(ErlT), - Leaf = erl_syntax:is_leaf(ErlT), - Tree = erl_syntax_lib:map(fun(Node) -> Node end, ErlT), - Type = erl_syntax:type(Tree), - _ = erl_syntax:meta(Tree), - ok = validate_special_type(Type,Tree), - RevT = erl_syntax:revert(Tree), - ok = validate_special_type(Type,RevT), - Type = erl_syntax:type(RevT), - ok. - -validate_special_type(string,Node) -> - Val = erl_syntax:string_value(Node), - true = erl_syntax:is_string(Node,Val), - _ = erl_syntax:string_literal(Node), - ok; -validate_special_type(variable,Node) -> - _ = erl_syntax:variable_literal(Node), - ok; -validate_special_type(fun_expr,Node) -> - A = erl_syntax:fun_expr_arity(Node), - true = is_integer(A), - ok; -validate_special_type(named_fun_expr,Node) -> - A = erl_syntax:named_fun_expr_arity(Node), - true = is_integer(A), - ok; -validate_special_type(tuple,Node) -> - Size = erl_syntax:tuple_size(Node), - true = is_integer(Size), - ok; -validate_special_type(float,Node) -> - Str = erl_syntax:float_literal(Node), - Val = list_to_float(Str), - Val = erl_syntax:float_value(Node), - false = erl_syntax:is_proper_list(Node), - false = erl_syntax:is_list_skeleton(Node), - ok; -validate_special_type(integer,Node) -> - Str = erl_syntax:integer_literal(Node), - Val = list_to_integer(Str), - true = erl_syntax:is_integer(Node,Val), - Val = erl_syntax:integer_value(Node), - false = erl_syntax:is_proper_list(Node), - ok; -validate_special_type(nil,Node) -> - true = erl_syntax:is_proper_list(Node), - ok; -validate_special_type(list,Node) -> - true = erl_syntax:is_list_skeleton(Node), - _ = erl_syntax:list_tail(Node), - ErrV = erl_syntax:list_head(Node), - false = erl_syntax:is_string(Node,ErrV), - Norm = erl_syntax:normalize_list(Node), - list = erl_syntax:type(Norm), - case erl_syntax:is_proper_list(Node) of - true -> - true = erl_syntax:is_list_skeleton(Node), - Compact = erl_syntax:compact_list(Node), - list = erl_syntax:type(Compact), - [_|_] = erl_syntax:list_elements(Node), - _ = erl_syntax:list_elements(Node), - N = erl_syntax:list_length(Node), - true = N > 0, - ok; - false -> - ok - end; -validate_special_type(_,_) -> - ok. - -%%% scan_and_parse - -string_to_expr(String) -> - io:format("Str: ~p~n", [String]), - {ok, Ts, _} = erl_scan:string(String++"."), - {ok,[Expr]} = erl_parse:parse_exprs(Ts), - Expr. - + ?line [{map_field_assoc,16,{atom,17,name},{var,18,'Value'}}] = + erl_syntax:revert_forms([{tree,map_field_assoc, + {attr,16,[],none}, + {map_field_assoc, + {atom,17,name},{var,18,'Value'}}}]), + ?line ?t:timetrap_cancel(Dog). p_run(Test, List) -> N = erlang:system_info(schedulers), @@ -427,3 +138,4 @@ Refs = Refs0 -- [Ref], p_run_loop(Test, List, N, Refs, Errors) end. + diff -Nru erlang-18.2-dfsg/lib/syntax_tools/vsn.mk erlang-17.3-dfsg/lib/syntax_tools/vsn.mk --- erlang-18.2-dfsg/lib/syntax_tools/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/syntax_tools/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -SYNTAX_TOOLS_VSN = 1.7 +SYNTAX_TOOLS_VSN = 1.6.16 diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/basics_chapter.xml erlang-17.3-dfsg/lib/test_server/doc/src/basics_chapter.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/basics_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/basics_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/book.xml erlang-17.3-dfsg/lib/test_server/doc/src/book.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/example_chapter.xml erlang-17.3-dfsg/lib/test_server/doc/src/example_chapter.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/example_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/example_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -48,7 +47,7 @@ -define(default_timeout, ?t:minutes(1)). init_per_testcase(_Case, Config) -> - Dog=?t:timetrap(?default_timeout), + ?line Dog=?t:timetrap(?default_timeout), [{watchdog, Dog}|Config]. end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), @@ -73,8 +72,8 @@ not_started_func1(doc) -> ["Testing function 1 when application is not started"]. not_started_func1(Config) when list(Config) -> - {error, not_started} = myapp:func1(dummy_ref,1), - {error, not_started} = myapp:func1(dummy_ref,2), + ?line {error, not_started} = myapp:func1(dummy_ref,1), + ?line {error, not_started} = myapp:func1(dummy_ref,2), ok. not_started_func2(suite) -> @@ -82,8 +81,8 @@ not_started_func2(doc) -> ["Testing function 2 when application is not started"]. not_started_func2(Config) when list(Config) -> - {error, not_started} = myapp:func2(dummy_ref,1), - {error, not_started} = myapp:func2(dummy_ref,2), + ?line {error, not_started} = myapp:func2(dummy_ref,1), + ?line {error, not_started} = myapp:func2(dummy_ref,2), ok. @@ -91,7 +90,7 @@ start(doc) -> ["Testing start of my application."]; start(Config) when list(Config) -> - Ref = myapp:start(), + ?line Ref = myapp:start(), case erlang:whereis(my_main_process) of Pid when pid(Pid) -> [{myapp_ref,Ref}|Config]; @@ -106,9 +105,9 @@ func1(doc) -> ["Test that func1 returns ok when argument is 1 and error if argument is 2"]; func1(Config) when list(Config) -> - Ref = ?config(myapp_ref,Config), - ok = myapp:func1(Ref,1), - error = myapp:func1(Ref,2), + ?line Ref = ?config(myapp_ref,Config), + ?line ok = myapp:func1(Ref,1), + ?line error = myapp:func1(Ref,2), ok. func2(suite) -> @@ -116,17 +115,17 @@ func2(doc) -> ["Test that func1 returns ok when argument is 3 and error if argument is 4"]; func2(Config) when list(Config) -> - Ref = ?config(myapp_ref,Config), - ok = myapp:func2(Ref,3), - error = myapp:func2(Ref,4), + ?line Ref = ?config(myapp_ref,Config), + ?line ok = myapp:func2(Ref,3), + ?line error = myapp:func2(Ref,4), ok. %% No specification clause needed for a cleanup function in a conf case!!! stop(doc) -> ["Testing termination of my application"]; stop(Config) when list(Config) -> - Ref = ?config(myapp_ref,Config), - ok = myapp:stop(Ref), + ?line Ref = ?config(myapp_ref,Config), + ?line ok = myapp:stop(Ref), case erlang:whereis(my_main_process) of undefined -> lists:keydelete(myapp_ref,1,Config); diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/Makefile erlang-17.3-dfsg/lib/test_server/doc/src/Makefile --- erlang-18.2-dfsg/lib/test_server/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2002-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -28,10 +27,6 @@ VSN=$(TEST_SERVER_VSN) APPLICATION=test_server -DOC_EXTRA_FRONT_PAGE_INFO=Important note: \ -The Test Server application is obsolete and will be removed \ -in the next major OTP release - # ---------------------------------------------------- # Release directory specification # ---------------------------------------------------- diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/notes_history.xml erlang-17.3-dfsg/lib/test_server/doc/src/notes_history.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/notes.xml erlang-17.3-dfsg/lib/test_server/doc/src/notes.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -33,200 +32,6 @@ notes.xml
    -
    Test_Server 3.9.1 - -
    Fixed Bugs and Malfunctions - - -

    - When generating Makefile from Makefile.src, - ts_lib:get_arg/4 earlier removed all spaces in the - extracted argument. The code was probably meant for - removing leading and trailing spaces only, and is now - corrected to do so.

    -

    - Own Id: OTP-13015

    -
    - -

    - With the Common Test 'create_priv_dir' start option set - to 'auto_per_tc', the name of the priv directory for a - configuration function could clash with the name of the - priv directory for a test case, which would cause Test - Server failure. This error has been corrected.

    -

    - Own Id: OTP-13181

    -
    -
    -
    - -
    - -
    Test_Server 3.9 - -
    Fixed Bugs and Malfunctions - - -

    - The status of an aborted test due to test suite - compilation error has changed from 'auto_skipped' to - 'failed'. This affects both the textual log file, event - handling and CT hook callbacks. The logging of - compilation failures has also been improved, especially - in the case of multiple test suites failing compilation.

    -

    - Own Id: OTP-10816

    -
    - -

    - The Test Server source code parser (erl2html2) failed to - handle the macro tuple in the syntax tree returned by - epp_dodger. This error has been corrected.

    -

    - Own Id: OTP-12740

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - The Test Server application has been marked as obsolete - and will be removed from OTP in the next major release - (OTP 19.0).

    -

    - Own Id: OTP-10923 Aux Id: OTP-12705

    -
    - -

    - When running OTP tests using the ts interface, it is now - possible to specify so called test categories per OTP - application. A test category is represented by a CT test - specification and defines an arbitrary subset of existing - test suites, groups and cases. Examples of test - categories are 'smoke' (smoke tests) and 'bench' - (benchmarks). (Call ts:help() for more info). Also, - functions for reading terms from the current test - specification during test, ct:get_testspec_terms/0 and - ct:get_testspec_terms/1, have been implemented.

    -

    - Own Id: OTP-11962

    -
    -
    -
    - -
    - -
    Test_Server 3.8.1 - -
    Fixed Bugs and Malfunctions - - -

    - If the last expression in a test case causes a timetrap - timeout, the stack trace is ignored and not printed to - the test case log file. This happens because the - {Suite,TestCase,Line} info is not available in the stack - trace in this scenario, due to tail call elimination. - Common Test has been modified to handle this situation by - inserting a {Suite,TestCase,last_expr} tuple in the - correct place and printing the stack trace as expected.

    -

    - Own Id: OTP-12697 Aux Id: seq12848

    -
    -
    -
    - -
    - -
    Test_Server 3.8 - -
    Fixed Bugs and Malfunctions - - -

    - When installing test suites in a cross compilation - environment, ts_install was not able to read the values - of the environment variables specified in the - configuration file. This has been fixed.

    -

    - Own Id: OTP-11441

    -
    - -

    - Printouts by means of ct:log/2/3 or ct:pal/2/3 from the - hook functions on_tc_fail/2 and on_tc_skip/2 would (quite - unexpectedly) end up in the "unexpected i/o" log file - instead of in the test case log file. This behaviour has - been changed so that now, all printouts (including stdio - printouts) from these hook functions will be routed to - the test case log file.

    -

    - Own Id: OTP-12468

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - The format of the information printed on top of the test - case (and configuration function) log file has been - slightly modified, mainly in order to make the start - configuration data easier to read and interpret.

    -

    - Own Id: OTP-12518 Aux Id: seq12808

    -
    -
    -
    - -
    - -
    Test_Server 3.7.2 - -
    Fixed Bugs and Malfunctions - - -

    - The source code to html code generator in Test Server - (and Common Test) would fail to generate anchors in the - html code for functions with non-expandable macros, - resulting in bad html links to such functions. This - correction lets the code generator ignore macros that - can't be expanded (i.e. not pre-process them), so that - correct anchors will always be produced.

    -

    - Own Id: OTP-11766 Aux Id: seq12556

    -
    - -

    - Make sure to install .hrl files when needed

    -

    - Own Id: OTP-12197

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Distribute autoconf helpers to applications at - build time instead of having multiple identical copies - committed in the repository.

    -

    - Own Id: OTP-12348

    -
    -
    -
    - -
    -
    Test_Server 3.7.1
    Fixed Bugs and Malfunctions @@ -327,7 +132,7 @@ configuration function or test specification term), the affected test cases get the status user_skipped instead.

    This update has meant a few changes that - may affect Common Test users in various ways:

    + may affect Common Test users in various ways: The test results and statistics will be affected, which is important to know when running regression tests and comparing results to previous test runs. @@ -347,7 +152,7 @@ auto_skipped rather than user_skipped as before. The event messages that Common Test generates during test runs have been affected by this - update. For details see OTP-11524. + update. For details see OTP-11524.

    Own Id: OTP-11305 Aux Id: OTP-11524

    @@ -474,7 +279,7 @@ that were not opened with the {encoding,utf8} option. If then the argument contained unicode characters above 255, the file descriptor would crash. This has been corrected - by the following modifications:

    Since the + by the following modifications: Since the 'unexpected_io' log file is used only when the test case HTML file is not available (e.g. between test cases), this file is now also a HTML file and as other @@ -496,7 +301,7 @@ path to the last run.<timestamp> directory, is now dependent on the file name mode of the VM. If file names are expected to be unicode, then the 'last_name' file is - UTF-8 encoded, else it is latin1 encoded. + UTF-8 encoded, else it is latin1 encoded.

    Also, ~tp has been changed back to ~p unless it is somehow likely that the argument includes strings. It is @@ -644,7 +449,7 @@

    - Update common test modules to handle Unicode:

    + Update common test modules to handle unicode Use UTF-8 encoding for all HTML files, except the HTML version of the test suite generated with erl2html2:convert, which will have the same encoding as @@ -655,7 +460,7 @@ unicode:characters_to_list and unicode:characters_to_binary for conversion between binaries and strings instead of binary_to_list and - list_to_binary. + list_to_binary.

    diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/part_notes_history.xml erlang-17.3-dfsg/lib/test_server/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/part_notes.xml erlang-17.3-dfsg/lib/test_server/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/part.xml erlang-17.3-dfsg/lib/test_server/doc/src/part.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/ref_man.xml erlang-17.3-dfsg/lib/test_server/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/run_test_chapter.xml erlang-17.3-dfsg/lib/test_server/doc/src/run_test_chapter.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/run_test_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/run_test_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/test_server_app.xml erlang-17.3-dfsg/lib/test_server/doc/src/test_server_app.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/test_server_app.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/test_server_app.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/test_server_ctrl.xml erlang-17.3-dfsg/lib/test_server/doc/src/test_server_ctrl.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/test_server_ctrl.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/test_server_ctrl.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/test_server.xml erlang-17.3-dfsg/lib/test_server/doc/src/test_server.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/test_server.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/test_server.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -812,12 +811,46 @@ +
    + TEST SUITE LINE NUMBERS +

    If a test case fails, the test server can report the exact line + number at which it failed. There are two ways of doing this, + either by using the line macro or by using the + test_server_line parse transform. +

    +

    The line macro is described under TEST SUITE SUPPORT + MACROS below. The line macro will only report the last line + executed when a test case failed. +

    +

    The test_server_line parse transform is activated by + including the headerfile test_server_line.hrl in the test + suite. When doing this, it is important that the + test_server_line module is in the code path of the erlang + node compiling the test suite. The parse transform will report a + history of a maximum of 10 lines when a test case + fails. Consecutive lines in the same function are not shown. +

    +

    The attribute -no_lines(FuncList). can be used in the + test suite to exclude specific functions from the parse + transform. This is necessary e.g. for functions that are executed + on old (i.e. <R10B) OTP releases. FuncList = [{Func,Arity}]. +

    +

    If both the line macro and the parse transform is used in + the same module, the parse transform will overrule the macro. +

    +
    TEST SUITE SUPPORT MACROS

    There are some macros defined in the test_server.hrl that are quite useful for test suite programmers:

    +

    The line macro, is quite + essential when writing test cases. It tells the test server + exactly what line of code that is being executed, so that it can + report this line back if the test case fails. Use this macro at + the beginning of every test case line of code. +

    The config macro, is used to retrieve information from the Config variable sent to all test cases. It is used with two arguments, where the first is the @@ -834,20 +867,24 @@ Whatever added by conf test cases or init_per_testcase/2 -

    Examples of the config macro can be seen in the Examples chapter - in the user's guide.

    -

    The line and line_trace macros are deprecated, see - below.

    -
    - -
    - TEST SUITE LINE NUMBERS -

    In the past, ERTS did not produce line numbers when generating - stacktraces, test_server was thus unable to provide them when reporting - test failures. It had instead two different mecanisms to do it: either by - using the line macro or by using the test_server_line parse - transform. Both are deprecated and should not be used in new tests - anymore.

    +

    Examples of the line and config macros can be + seen in the Examples chapter in the user's guide. +

    +

    If the line_trace macro is defined, you will get a + timestamp (erlang:now()) in your minor log for each + line macro in your suite. This way you can at any time see + which line is currently being executed, and when the line was + called. +

    +

    The line_trace macro can also be used together with the + test_server_line parse transform described above. A + timestamp will then be written for each line in the suite, except + for functions stated in the -no_lines attribute. +

    +

    The line_trace macro can e.g. be defined as a compile + option, like this: +

    +erlc -W -Dline_trace my_SUITE.erl

    diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/test_spec_chapter.xml erlang-17.3-dfsg/lib/test_server/doc/src/test_spec_chapter.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/test_spec_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/test_spec_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/ts.xml erlang-17.3-dfsg/lib/test_server/doc/src/ts.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/ts.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/ts.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/why_test_chapter.xml erlang-17.3-dfsg/lib/test_server/doc/src/why_test_chapter.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/why_test_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/why_test_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/write_framework_chapter.xml erlang-17.3-dfsg/lib/test_server/doc/src/write_framework_chapter.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/write_framework_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/write_framework_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/doc/src/write_test_chapter.xml erlang-17.3-dfsg/lib/test_server/doc/src/write_test_chapter.xml --- erlang-18.2-dfsg/lib/test_server/doc/src/write_test_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/doc/src/write_test_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/test_server/include/test_server.hrl erlang-17.3-dfsg/lib/test_server/include/test_server.hrl --- erlang-18.2-dfsg/lib/test_server/include/test_server.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/include/test_server.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -22,7 +21,7 @@ -line_trace(true). -define(line, io:format(lists:concat([?MODULE,",",integer_to_list(?LINE),": ~p"]), - [erlang:monotonic_time()-erlang:system_info(start_time)]),). + [erlang:now()]),). -else. -define(line,). -endif. diff -Nru erlang-18.2-dfsg/lib/test_server/include/test_server_line.hrl erlang-17.3-dfsg/lib/test_server/include/test_server_line.hrl --- erlang-18.2-dfsg/lib/test_server/include/test_server_line.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/include/test_server_line.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/Makefile erlang-17.3-dfsg/lib/test_server/Makefile --- erlang-18.2-dfsg/lib/test_server/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2009. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/test_server/src/config.guess erlang-17.3-dfsg/lib/test_server/src/config.guess --- erlang-18.2-dfsg/lib/test_server/src/config.guess 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/config.guess 2014-09-16 19:10:57.000000000 +0000 @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2015 Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2015-03-04' +timestamp='2013-02-12' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # -# Please send patches to . +# Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2015 Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -132,27 +132,6 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - ;; -esac - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -168,27 +147,20 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || \ - echo unknown)` + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown - ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in - arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) + arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ @@ -204,13 +176,6 @@ os=netbsd ;; esac - # Determine ABI tags. - case "${UNAME_MACHINE_ARCH}" in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` - ;; - esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -227,7 +192,7 @@ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}${abi}" + echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -593,9 +558,8 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -841,7 +805,7 @@ *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - *:MSYS*:*) + i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -889,21 +853,21 @@ exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -916,57 +880,59 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + echo ${UNAME_MACHINE}-unknown-linux-gnueabi else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - e2k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -985,63 +951,57 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} + echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} + echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} + echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} + echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} + echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1274,31 +1234,19 @@ exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1389,6 +1337,154 @@ exit ;; esac +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + cat >&2 <. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -68,7 +68,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2015 Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,7 +117,7 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os @@ -252,20 +252,19 @@ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arceb \ + | arc \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ - | c4x | c8051 | clipper \ + | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ + | epiphany \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ @@ -283,10 +282,8 @@ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ @@ -298,11 +295,11 @@ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ + | open8 \ + | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ @@ -313,7 +310,6 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -328,10 +324,7 @@ c6x) basic_machine=tic6x-unknown ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -373,22 +366,21 @@ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ + | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ @@ -408,10 +400,8 @@ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ @@ -423,7 +413,6 @@ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ - | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ @@ -441,7 +430,6 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ - | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -518,9 +506,6 @@ basic_machine=i386-pc os=-aros ;; - asmjs) - basic_machine=asmjs-unknown - ;; aux) basic_machine=m68k-apple os=-aux @@ -782,9 +767,6 @@ basic_machine=m68k-isi os=-sysv ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` - ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -812,7 +794,7 @@ os=-mingw64 ;; mingw32) - basic_machine=i686-pc + basic_machine=i386-pc os=-mingw32 ;; mingw32ce) @@ -840,10 +822,6 @@ basic_machine=powerpc-unknown os=-morphos ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; msdos) basic_machine=i386-pc os=-msdos @@ -852,7 +830,7 @@ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i686-pc + basic_machine=i386-pc os=-msys ;; mvs) @@ -1376,7 +1354,7 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* | -cloudabi* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ @@ -1389,14 +1367,14 @@ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1568,9 +1546,6 @@ c4x-* | tic4x-*) os=-coff ;; - c8051-*) - os=-elf - ;; hexagon-*) os=-elf ;; @@ -1614,6 +1589,9 @@ mips*-*) os=-elf ;; + or1k-*) + os=-elf + ;; or32-*) os=-coff ;; @@ -1808,3 +1786,4 @@ # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: + diff -Nru erlang-18.2-dfsg/lib/test_server/src/configure erlang-17.3-dfsg/lib/test_server/src/configure --- erlang-18.2-dfsg/lib/test_server/src/configure 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/configure 1970-01-01 00:00:00.000000000 +0000 @@ -1,6475 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59. -# -# Copyright (C) 2003 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 Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; 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 - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# 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 - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - 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 - - ;; - 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 - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); 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 sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# 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'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# 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` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="conf_vars.in" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEBUG_FLAGS CPP EGREP SHLIB_LD SHLIB_LDFLAGS SHLIB_LDLIBS SHLIB_CFLAGS SHLIB_SUFFIX SHLIB_EXTRACT_ALL EI_CFLAGS ERTS_CFLAGS ERTS_LIBS HCC LD obj exe CROSSLDFLAGS SSLEAY_ROOT JAVAC make_command test_c_compiler LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# 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. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -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 - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -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 | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$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 ;; - - -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 ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - 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 ;; - - -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=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 ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - 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'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -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 - 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 - - -# 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 its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - 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 - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# 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 \`..'] - -_ACEOF - - cat <<_ACEOF -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] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --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] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-debug-mode enable debug mode - --enable-m64-build build 64-bit binaries using the -m64 flag to (g)cc - --enable-m32-build build 32-bit binaries using the -m32 flag to (g)cc - --enable-shlib-thread-safety enable thread safety for build shared libraries - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - 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. - -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style 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 - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF - -Copyright (C) 2003 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 0 -fi -exec 5>config.log -cat >&5 <<_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.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -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` -hostinfo = `(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=. - echo "PATH: $as_dir" -done - -} >&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_sep= -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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$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 - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -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, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >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 - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -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 - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -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 `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -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 - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`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. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -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 - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$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" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -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 - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.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. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; 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 | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* 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 -std1 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 -std1. */ -int osf4_cc_array ['\x00' == 0 ? 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 -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -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 - - -DEBUG_FLAGS="-g -DDEBUG" -if test "$GCC" = yes; then - DEBUG_FLAGS="$DEBUG_FLAGS -Wall $CFLAGS" -fi - - -# Check whether --enable-debug-mode or --disable-debug-mode was given. -if test "${enable_debug_mode+set}" = set; then - enableval="$enable_debug_mode" - case "$enableval" in - no) ;; - *) CFLAGS=$DEBUG_FLAGS ;; - esac -fi; - -# Check whether --enable-m64-build or --disable-m64-build was given. -if test "${enable_m64_build+set}" = set; then - enableval="$enable_m64_build" - case "$enableval" in - no) enable_m64_build=no ;; - *) enable_m64_build=yes ;; - esac - -else - enable_m64_build=no -fi; - -# Check whether --enable-m32-build or --disable-m32-build was given. -if test "${enable_m32_build+set}" = set; then - enableval="$enable_m32_build" - case "$enableval" in - no) enable_m32_build=no ;; - *) enable_m32_build=yes ;; - esac - -else - enable_m32_build=no -fi; - -no_mXX_LDFLAGS="$LDFLAGS" - -if test X${enable_m64_build} = Xyes; then - CFLAGS="-m64 $CFLAGS" - LDFLAGS="-m64 $LDFLAGS" -fi -if test X${enable_m32_build} = Xyes; then - CFLAGS="-m32 $CFLAGS" - LDFLAGS="-m32 $LDFLAGS" -fi - - - -echo "$as_me:$LINENO: checking for sin in -lm" >&5 -echo $ECHO_N "checking for sin in -lm... $ECHO_C" >&6 -if test "${ac_cv_lib_m_sin+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sin (); -int -main () -{ -sin (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_m_sin=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_m_sin=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_m_sin" >&5 -echo "${ECHO_T}$ac_cv_lib_m_sin" >&6 -if test $ac_cv_lib_m_sin = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBM 1 -_ACEOF - - LIBS="-lm $LIBS" - -fi - - -#-------------------------------------------------------------------- -# Interactive UNIX requires -linet instead of -lsocket, plus it -# needs net/errno.h to define the socket-related error codes. -#-------------------------------------------------------------------- - -echo "$as_me:$LINENO: checking for main in -linet" >&5 -echo $ECHO_N "checking for main in -linet... $ECHO_C" >&6 -if test "${ac_cv_lib_inet_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-linet $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - -int -main () -{ -main (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_inet_main=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_inet_main=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_inet_main" >&5 -echo "${ECHO_T}$ac_cv_lib_inet_main" >&6 -if test $ac_cv_lib_inet_main = yes; then - LIBS="$LIBS -linet" -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 -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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 - echo $ECHO_N "(cached) $ECHO_C" >&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 to if __STDC__ is defined, since - # 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # 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 -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$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 to if __STDC__ is defined, since - # 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # 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 - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -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 - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#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)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -if test "${ac_cv_header_net_errno_h+set}" = set; then - echo "$as_me:$LINENO: checking for net/errno.h" >&5 -echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 -if test "${ac_cv_header_net_errno_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 -echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking net/errno.h usability" >&5 -echo $ECHO_N "checking net/errno.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking net/errno.h presence" >&5 -echo $ECHO_N "checking net/errno.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: net/errno.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: net/errno.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: net/errno.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: net/errno.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: net/errno.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: net/errno.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: net/errno.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for net/errno.h" >&5 -echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 -if test "${ac_cv_header_net_errno_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_net_errno_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 -echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 - -fi -if test $ac_cv_header_net_errno_h = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_NET_ERRNO_H 1 -_ACEOF - -fi - - - -#-------------------------------------------------------------------- -# Linux/tcp.h may be needed for sockopt test in kernel -#-------------------------------------------------------------------- - -if test "${ac_cv_header_linux_tcp_h+set}" = set; then - echo "$as_me:$LINENO: checking for linux/tcp.h" >&5 -echo $ECHO_N "checking for linux/tcp.h... $ECHO_C" >&6 -if test "${ac_cv_header_linux_tcp_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_linux_tcp_h" >&5 -echo "${ECHO_T}$ac_cv_header_linux_tcp_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking linux/tcp.h usability" >&5 -echo $ECHO_N "checking linux/tcp.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking linux/tcp.h presence" >&5 -echo $ECHO_N "checking linux/tcp.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: linux/tcp.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: linux/tcp.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/tcp.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: linux/tcp.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: linux/tcp.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: linux/tcp.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/tcp.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: linux/tcp.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/tcp.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: linux/tcp.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/tcp.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: linux/tcp.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/tcp.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: linux/tcp.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: linux/tcp.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: linux/tcp.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for linux/tcp.h" >&5 -echo $ECHO_N "checking for linux/tcp.h... $ECHO_C" >&6 -if test "${ac_cv_header_linux_tcp_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_linux_tcp_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_linux_tcp_h" >&5 -echo "${ECHO_T}$ac_cv_header_linux_tcp_h" >&6 - -fi -if test $ac_cv_header_linux_tcp_h = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_LINUX_TCP_H 1 -_ACEOF - -fi - - -echo "$as_me:$LINENO: checking for sane linux/tcp.h" >&5 -echo $ECHO_N "checking for sane linux/tcp.h... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -int -main () -{ -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - have_sane_linux_tcp_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -have_sane_linux_tcp_h=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $have_sane_linux_tcp_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SANE_LINUX_TCP_H 1 -_ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - -#-------------------------------------------------------------------- -# Linux requires sys/socketio.h instead of sys/sockio.h -#-------------------------------------------------------------------- -if test "${ac_cv_header_sys_socketio_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/socketio.h" >&5 -echo $ECHO_N "checking for sys/socketio.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_socketio_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_socketio_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_socketio_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking sys/socketio.h usability" >&5 -echo $ECHO_N "checking sys/socketio.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking sys/socketio.h presence" >&5 -echo $ECHO_N "checking sys/socketio.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: sys/socketio.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: sys/socketio.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/socketio.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: sys/socketio.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: sys/socketio.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: sys/socketio.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/socketio.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sys/socketio.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/socketio.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: sys/socketio.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/socketio.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: sys/socketio.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/socketio.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sys/socketio.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/socketio.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: sys/socketio.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for sys/socketio.h" >&5 -echo $ECHO_N "checking for sys/socketio.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_socketio_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_sys_socketio_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_socketio_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_socketio_h" >&6 - -fi -if test $ac_cv_header_sys_socketio_h = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_SOCKETIO_H 1 -_ACEOF - -fi - - - - -#-------------------------------------------------------------------- -# Misc -#-------------------------------------------------------------------- -if test "${ac_cv_header_poll_h+set}" = set; then - echo "$as_me:$LINENO: checking for poll.h" >&5 -echo $ECHO_N "checking for poll.h... $ECHO_C" >&6 -if test "${ac_cv_header_poll_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_poll_h" >&5 -echo "${ECHO_T}$ac_cv_header_poll_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking poll.h usability" >&5 -echo $ECHO_N "checking poll.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking poll.h presence" >&5 -echo $ECHO_N "checking poll.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: poll.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: poll.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: poll.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: poll.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: poll.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: poll.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: poll.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: poll.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: poll.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: poll.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: poll.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: poll.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: poll.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: poll.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: poll.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: poll.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for poll.h" >&5 -echo $ECHO_N "checking for poll.h... $ECHO_C" >&6 -if test "${ac_cv_header_poll_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_poll_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_poll_h" >&5 -echo "${ECHO_T}$ac_cv_header_poll_h" >&6 - -fi -if test $ac_cv_header_poll_h = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_POLL_H 1 -_ACEOF - -fi - - - -#-------------------------------------------------------------------- -# The statements below define a collection of symbols related to -# dynamic loading and shared libraries: -# -# SHLIB_CFLAGS - Flags to pass to cc when compiling the components -# of a shared library (may request position-independent -# code, among other things). -# SHLIB_LD - Base command to use for combining object files -# into a shared library. -# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable -# extensions. An empty string means we don't know how -# to use shared libraries on this platform. -#-------------------------------------------------------------------- - -# Step 1: set the variable "system" to hold the name and version number -# for the system. - -echo "$as_me:$LINENO: checking system version (for dynamic loading)" >&5 -echo $ECHO_N "checking system version (for dynamic loading)... $ECHO_C" >&6 -system=`./config.sub $host` -echo "$as_me:$LINENO: result: $system" >&5 -echo "${ECHO_T}$system" >&6 - -# Step 2: check for existence of -ldl library. This is needed because -# Linux can use either -ldl or -ldld for dynamic loading. - -echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - have_dl=yes -else - have_dl=no -fi - - -# Step 3: set configuration options based on system name and version. - -SHLIB_LDLIBS= -fullSrcDir=`cd $srcdir; pwd` -case $system in - *-linux-*) - SHLIB_CFLAGS="-fPIC" - SHLIB_SUFFIX=".so" - if test "$have_dl" = yes; then - SHLIB_LD="${CC}" - SHLIB_LDFLAGS="$LDFLAGS -shared" - LD_FLAGS="-rdynamic" - else - if test "${ac_cv_header_dld_h+set}" = set; then - echo "$as_me:$LINENO: checking for dld.h" >&5 -echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 -if test "${ac_cv_header_dld_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 -echo "${ECHO_T}$ac_cv_header_dld_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking dld.h usability" >&5 -echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking dld.h presence" >&5 -echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: dld.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: dld.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: dld.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: dld.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: dld.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: dld.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: dld.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: dld.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: dld.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for dld.h" >&5 -echo $ECHO_N "checking for dld.h... $ECHO_C" >&6 -if test "${ac_cv_header_dld_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_dld_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5 -echo "${ECHO_T}$ac_cv_header_dld_h" >&6 - -fi -if test $ac_cv_header_dld_h = yes; then - - SHLIB_LD="ld" - SHLIB_LDFLAGS="-shared" -fi - - - if test X${enable_m64_build} = Xyes; then - { { echo "$as_me:$LINENO: error: don't know how to link 64-bit dynamic drivers" >&5 -echo "$as_me: error: don't know how to link 64-bit dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - fi - if test X${enable_m32_build} = Xyes; then - { { echo "$as_me:$LINENO: error: don't know how to link 32-bit dynamic drivers" >&5 -echo "$as_me: error: don't know how to link 32-bit dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - fi - fi - SHLIB_EXTRACT_ALL="" - ;; - *-openbsd*) - # Not available on all versions: check for include file. - if test "${ac_cv_header_dlfcn_h+set}" = set; then - echo "$as_me:$LINENO: checking for dlfcn.h" >&5 -echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 -if test "${ac_cv_header_dlfcn_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 -echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 -echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 -echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for dlfcn.h" >&5 -echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 -if test "${ac_cv_header_dlfcn_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_dlfcn_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 -echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 - -fi -if test $ac_cv_header_dlfcn_h = yes; then - - SHLIB_CFLAGS="-fpic" - SHLIB_LD="${CC}" - SHLIB_LDFLAGS="$LDFLAGS -shared" - SHLIB_SUFFIX=".so" - if test X${enable_m64_build} = Xyes; then - { { echo "$as_me:$LINENO: error: don't know how to link 64-bit dynamic drivers" >&5 -echo "$as_me: error: don't know how to link 64-bit dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - fi - if test X${enable_m32_build} = Xyes; then - { { echo "$as_me:$LINENO: error: don't know how to link 32-bit dynamic drivers" >&5 -echo "$as_me: error: don't know how to link 32-bit dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - fi - -else - - # No dynamic loading. - SHLIB_CFLAGS="" - SHLIB_LD="ld" - SHLIB_LDFLAGS="" - SHLIB_SUFFIX="" - { { echo "$as_me:$LINENO: error: don't know how to compile and link dynamic drivers" >&5 -echo "$as_me: error: don't know how to compile and link dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - -fi - - - SHLIB_EXTRACT_ALL="" - ;; - *-netbsd*|*-freebsd*|*-dragonfly*) - # Not available on all versions: check for include file. - if test "${ac_cv_header_dlfcn_h+set}" = set; then - echo "$as_me:$LINENO: checking for dlfcn.h" >&5 -echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 -if test "${ac_cv_header_dlfcn_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 -echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 -echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 -echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for dlfcn.h" >&5 -echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 -if test "${ac_cv_header_dlfcn_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_dlfcn_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 -echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 - -fi -if test $ac_cv_header_dlfcn_h = yes; then - - SHLIB_CFLAGS="-fpic" - SHLIB_LD="ld" - SHLIB_LDFLAGS="$LDFLAGS -Bshareable -x" - SHLIB_SUFFIX=".so" - if test X${enable_m64_build} = Xyes; then - { { echo "$as_me:$LINENO: error: don't know how to link 64-bit dynamic drivers" >&5 -echo "$as_me: error: don't know how to link 64-bit dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - fi - if test X${enable_m32_build} = Xyes; then - { { echo "$as_me:$LINENO: error: don't know how to link 32-bit dynamic drivers" >&5 -echo "$as_me: error: don't know how to link 32-bit dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - fi - -else - - # No dynamic loading. - SHLIB_CFLAGS="" - SHLIB_LD="ld" - SHLIB_LDFLAGS="" - SHLIB_SUFFIX="" - { { echo "$as_me:$LINENO: error: don't know how to compile and link dynamic drivers" >&5 -echo "$as_me: error: don't know how to compile and link dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - -fi - - - SHLIB_EXTRACT_ALL="" - ;; - *-solaris2*|*-sysv4*) - SHLIB_CFLAGS="-KPIC" - SHLIB_LD="/usr/ccs/bin/ld" - SHLIB_LDFLAGS="$no_mXX_LDFLAGS -G -z text" - if test X${enable_m64_build} = Xyes; then - SHLIB_LDFLAGS="-64 $SHLIB_LDFLAGS" - fi - if test X${enable_m32_build} = Xyes; then - { { echo "$as_me:$LINENO: error: don't know how to link 32-bit dynamic drivers" >&5 -echo "$as_me: error: don't know how to link 32-bit dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - fi - SHLIB_SUFFIX=".so" - SHLIB_EXTRACT_ALL="-z allextract" - ;; - *darwin*) - SHLIB_CFLAGS="-fno-common" - SHLIB_LD="cc" - SHLIB_LDFLAGS="$LDFLAGS -bundle -flat_namespace -undefined suppress" - SHLIB_SUFFIX=".so" - SHLIB_EXTRACT_ALL="" - ;; - *osf1*) - SHLIB_CFLAGS="-fPIC" - SHLIB_LD="ld" - SHLIB_LDFLAGS="$LDFLAGS -shared" - if test X${enable_m64_build} = Xyes; then - { { echo "$as_me:$LINENO: error: don't know how to link 64-bit dynamic drivers" >&5 -echo "$as_me: error: don't know how to link 64-bit dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - fi - if test X${enable_m32_build} = Xyes; then - { { echo "$as_me:$LINENO: error: don't know how to link 32-bit dynamic drivers" >&5 -echo "$as_me: error: don't know how to link 32-bit dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - fi - SHLIB_SUFFIX=".so" - SHLIB_EXTRACT_ALL="" - ;; - *osf5*) - SHLIB_CFLAGS="-fPIC" - SHLIB_LD="${CC} -shared" - SHLIB_LDFLAGS="$LDFLAGS" - SHLIB_SUFFIX=".so" - SHLIB_EXTRACT_ALL="" - ;; - *) - # No dynamic loading. - SHLIB_CFLAGS="" - SHLIB_LD="ld" - SHLIB_LDFLAGS="" - SHLIB_LDLIBS="" - SHLIB_SUFFIX="" - SHLIB_EXTRACT_ALL="" - { { echo "$as_me:$LINENO: error: don't know how to compile and link dynamic drivers" >&5 -echo "$as_me: error: don't know how to compile and link dynamic drivers" >&2;} - { (exit 1); exit 1; }; } - ;; -esac - -# If we're running gcc, then change the C flags for compiling shared -# libraries to the right flags for gcc, instead of those for the -# standard manufacturer compiler. - -if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then - case $system in - *-aix) - ;; - *-bsd*) - ;; - *-irix) - ;; - *-netbsd|*-freebsd|*-openbsd) - ;; - *-riscos) - ;; - *ultrix4.*) - ;; - *darwin*) - ;; - *) - SHLIB_CFLAGS="-fPIC" - ;; - esac -fi - -# Make it possible for erl_interface to use it's own compiler options -EI_CFLAGS="$CFLAGS" - -# Add thread-safety flags if requested -# Check whether --enable-shlib-thread-safety or --disable-shlib-thread-safety was given. -if test "${enable_shlib_thread_safety+set}" = set; then - enableval="$enable_shlib_thread_safety" - case "$enableval" in - no) ;; - *) SHLIB_CFLAGS="$SHLIB_CFLAGS -D_THREAD_SAFE -D_REENTRANT" - CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT" - ;; - esac -fi; - -SHLIB_CFLAGS="$SHLIB_CFLAGS $CFLAGS" - - - - - - - - - - - -#-------------------------------------------------------------------- -# Check for the existence of the -lsocket and -lnsl libraries. -# The order here is important, so that they end up in the right -# order in the command line generated by make. Here are some -# special considerations: -# 1. Use "connect" and "accept" to check for -lsocket, and -# "gethostbyname" to check for -lnsl. -# 2. Use each function name only once: can't redo a check because -# autoconf caches the results of the last check and won't redo it. -# 3. Use -lnsl and -lsocket only if they supply procedures that -# aren't already present in the normal libraries. This is because -# IRIX 5.2 has libraries, but they aren't needed and they're -# bogus: they goof up name resolution if used. -# 4. On some SVR4 systems, can't use -lsocket without -lnsl too. -# To get around this problem, check for both libraries together -# if -lsocket doesn't work by itself. -#-------------------------------------------------------------------- - -erl_checkBoth=0 -echo "$as_me:$LINENO: checking for connect" >&5 -echo $ECHO_N "checking for connect... $ECHO_C" >&6 -if test "${ac_cv_func_connect+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define connect to an innocuous variant, in case declares connect. - For example, HP-UX 11i declares gettimeofday. */ -#define connect innocuous_connect - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char connect (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef connect - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char connect (); -/* 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_connect) || defined (__stub___connect) -choke me -#else -char (*f) () = connect; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != connect; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_connect=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_connect=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 -echo "${ECHO_T}$ac_cv_func_connect" >&6 -if test $ac_cv_func_connect = yes; then - erl_checkSocket=0 -else - erl_checkSocket=1 -fi - -if test "$erl_checkSocket" = 1; then - echo "$as_me:$LINENO: checking for main in -lsocket" >&5 -echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6 -if test "${ac_cv_lib_socket_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - -int -main () -{ -main (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_socket_main=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_socket_main=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_main" >&6 -if test $ac_cv_lib_socket_main = yes; then - LIBS="$LIBS -lsocket" -else - erl_checkBoth=1 -fi - -fi -if test "$erl_checkBoth" = 1; then - tk_oldLibs=$LIBS - LIBS="$LIBS -lsocket -lnsl" - echo "$as_me:$LINENO: checking for accept" >&5 -echo $ECHO_N "checking for accept... $ECHO_C" >&6 -if test "${ac_cv_func_accept+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define accept to an innocuous variant, in case declares accept. - For example, HP-UX 11i declares gettimeofday. */ -#define accept innocuous_accept - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char accept (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef accept - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char accept (); -/* 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_accept) || defined (__stub___accept) -choke me -#else -char (*f) () = accept; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != accept; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_accept=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_accept=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5 -echo "${ECHO_T}$ac_cv_func_accept" >&6 -if test $ac_cv_func_accept = yes; then - erl_checkNsl=0 -else - LIBS=$tk_oldLibs -fi - -fi -echo "$as_me:$LINENO: checking for gethostbyname" >&5 -echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 -if test "${ac_cv_func_gethostbyname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define gethostbyname to an innocuous variant, in case declares gethostbyname. - For example, HP-UX 11i declares gettimeofday. */ -#define gethostbyname innocuous_gethostbyname - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostbyname (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef gethostbyname - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostbyname (); -/* 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_gethostbyname) || defined (__stub___gethostbyname) -choke me -#else -char (*f) () = gethostbyname; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != gethostbyname; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_gethostbyname=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_gethostbyname=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 -if test $ac_cv_func_gethostbyname = yes; then - : -else - echo "$as_me:$LINENO: checking for main in -lnsl" >&5 -echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6 -if test "${ac_cv_lib_nsl_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - -int -main () -{ -main (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_nsl_main=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_nsl_main=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5 -echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6 -if test $ac_cv_lib_nsl_main = yes; then - LIBS="$LIBS -lnsl" -fi - -fi - - - -for ac_func in strerror -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -for ac_func in vsnprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -for ac_func in usleep -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* 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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -# First check if the library is available, then if we can choose between -# two versions of gethostbyname - -echo "$as_me:$LINENO: checking for main in -lresolv" >&5 -echo $ECHO_N "checking for main in -lresolv... $ECHO_C" >&6 -if test "${ac_cv_lib_resolv_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lresolv $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - -int -main () -{ -main (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_resolv_main=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_resolv_main=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_main" >&5 -echo "${ECHO_T}$ac_cv_lib_resolv_main" >&6 -if test $ac_cv_lib_resolv_main = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBRESOLV 1 -_ACEOF - - LIBS="-lresolv $LIBS" - -fi -ac_cv_lib_resolv=ac_cv_lib_resolv_main - -echo "$as_me:$LINENO: checking for res_gethostbyname in -lresolv" >&5 -echo $ECHO_N "checking for res_gethostbyname in -lresolv... $ECHO_C" >&6 -if test "${ac_cv_lib_resolv_res_gethostbyname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lresolv $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char res_gethostbyname (); -int -main () -{ -res_gethostbyname (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_resolv_res_gethostbyname=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_resolv_res_gethostbyname=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_lib_resolv_res_gethostbyname" >&6 -if test $ac_cv_lib_resolv_res_gethostbyname = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_RES_GETHOSTBYNAME 1 -_ACEOF - -fi - - -#-------------------------------------------------------------------- -# Check for isfinite -#-------------------------------------------------------------------- - -echo "$as_me:$LINENO: checking for isfinite" >&5 -echo $ECHO_N "checking for isfinite... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -isfinite(0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - have_isfinite=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -have_isfinite=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -if test $have_isfinite = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_ISFINITE 1 -_ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - cat >>confdefs.h <<\_ACEOF -#define HAVE_FINITE 1 -_ACEOF - - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -#-------------------------------------------------------------------- -# Emulator compatible flags (for drivers) -#-------------------------------------------------------------------- - -ERTS_CFLAGS=$CFLAGS - - -ERTS_LIBS=$LIBS - - -#-------------------------------------------------------------------- -# Special compiler macro to handle cross compiling -# (HCC) is used to compile tools run in the HOST environment -#-------------------------------------------------------------------- -HCC='$(CC)' - - -#-------------------------------------------------------------------- -# ld is used for linking on vxworks -#-------------------------------------------------------------------- -LD='$(CC) $(CFLAGS)' - - -#-------------------------------------------------------------------- -# object file suffix -#-------------------------------------------------------------------- -obj='.o' - - -#-------------------------------------------------------------------- -# executable file suffix -#-------------------------------------------------------------------- -exe='' - - -#-------------------------------------------------------------------- -# flags when linking for cross platform targets (yet 'tis useful with -# native builds) -#-------------------------------------------------------------------- -CROSSLDFLAGS='' - - - - -TARGET=$host - -# We search for SSL. First in the OTP team ClearCase standard location, -# then in the common OS standard locations -# No we do not. -SSL_APP=ssl -CRYPTO_APP=crypto -SSLEAY_ROOT=$TARGET -#for dir in /usr /usr/pkg /usr/local /usr/local/ssl /usr/lib/ssl /usr/ssl; do -# AC_CHECK_HEADER($dir/include/openssl/opensslv.h, -# ac_cv_openssl=yes, ac_cv_openssl=no) -# if test $ac_cv_openssl = yes ; then -# SSLEAY_ROOT="$dir" -# ssl_found=yes -# break -# fi -#done - -# Find a usable java compiler -# -# WARNING this code is copied from ERTS configure.in, and should be -# updated if that code changes. I hate duplicating code, but what -# can I do. -# - -for ac_prog in javac guavac gcj jikes bock -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_JAVAC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$JAVAC"; then - ac_cv_prog_JAVAC="$JAVAC" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_JAVAC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -JAVAC=$ac_cv_prog_JAVAC -if test -n "$JAVAC"; then - echo "$as_me:$LINENO: result: $JAVAC" >&5 -echo "${ECHO_T}$JAVAC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$JAVAC" && break -done - -if test -n "$JAVAC"; then - echo "$as_me:$LINENO: checking for JDK version 1.5" >&5 -echo $ECHO_N "checking for JDK version 1.5... $ECHO_C" >&6 -if test "${ac_cv_prog_javac_ver_1_5+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - java_link='$JAVAC conftest.java 1>&5' -cat > conftest.java <&5 - (eval $java_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest.class; then - rm -rf conftest* - ac_cv_prog_javac_ver_1_5=yes -else - echo "configure: failed program was:" 1>&5 - cat conftest.java 1>&5 - echo "configure: PATH was $PATH" 1>&5 - rm -rf conftest* - ac_cv_prog_javac_ver_1_5=no -fi -rm -f conftest* -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_javac_ver_1_5" >&5 -echo "${ECHO_T}$ac_cv_prog_javac_ver_1_5" >&6 - if test $ac_cv_prog_javac_ver_1_5 = no; then - unset -v JAVAC - fi -fi -if test -n "$JAVAC"; then - - : -fi - -for ac_prog in make gmake -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_make_command+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$make_command"; then - ac_cv_prog_make_command="$make_command" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_make_command="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -make_command=$ac_cv_prog_make_command -if test -n "$make_command"; then - echo "$as_me:$LINENO: result: $make_command" >&5 -echo "${ECHO_T}$make_command" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$make_command" && break -done -test -n "$make_command" || make_command="false" - - - -if test "$GCC" = yes; then - test_c_compiler="{gnuc, undefined}" -else - test_c_compiler="undefined" -fi - - - ac_config_files="$ac_config_files conf_vars" -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, don't put newlines in cache variables' values. -# 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. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *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 \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!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" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - 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}' - -# 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 - -# 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 we branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g -t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g -t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed - - -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_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $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} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; 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 - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# 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 - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - 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 - - ;; - 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 - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); 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 sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# 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'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet 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 ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -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 - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - 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 -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - - - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "conf_vars" ) CONFIG_FILES="$CONFIG_FILES conf_vars" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - 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 to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@DEBUG_FLAGS@,$DEBUG_FLAGS,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@SHLIB_LD@,$SHLIB_LD,;t t -s,@SHLIB_LDFLAGS@,$SHLIB_LDFLAGS,;t t -s,@SHLIB_LDLIBS@,$SHLIB_LDLIBS,;t t -s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t -s,@SHLIB_SUFFIX@,$SHLIB_SUFFIX,;t t -s,@SHLIB_EXTRACT_ALL@,$SHLIB_EXTRACT_ALL,;t t -s,@EI_CFLAGS@,$EI_CFLAGS,;t t -s,@ERTS_CFLAGS@,$ERTS_CFLAGS,;t t -s,@ERTS_LIBS@,$ERTS_LIBS,;t t -s,@HCC@,$HCC,;t t -s,@LD@,$LD,;t t -s,@obj@,$obj,;t t -s,@exe@,$exe,;t t -s,@CROSSLDFLAGS@,$CROSSLDFLAGS,;t t -s,@SSLEAY_ROOT@,$SSLEAY_ROOT,;t t -s,@JAVAC@,$JAVAC,;t t -s,@make_command@,$make_command,;t t -s,@test_c_compiler@,$test_c_compiler,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # 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. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# 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 || { (exit 1); exit 1; } -fi - diff -Nru erlang-18.2-dfsg/lib/test_server/src/configure.in erlang-17.3-dfsg/lib/test_server/src/configure.in --- erlang-18.2-dfsg/lib/test_server/src/configure.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/configure.in 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ dnl dnl Copyright Ericsson AB 1997-2014. All Rights Reserved. dnl -dnl Licensed under the Apache License, Version 2.0 (the "License"); -dnl you may not use this file except in compliance with the License. -dnl You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. +dnl +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. dnl dnl %CopyrightEnd% dnl @@ -358,23 +357,7 @@ # First check if the library is available, then if we can choose between # two versions of gethostbyname AC_HAVE_LIBRARY(resolv) -AC_CHECK_LIB(resolv, res_gethostbyname,[AC_DEFINE(HAVE_RES_GETHOSTBYNAME,1)]) - -#-------------------------------------------------------------------- -# Check for isfinite -#-------------------------------------------------------------------- - -AC_MSG_CHECKING([for isfinite]) -AC_TRY_LINK([#include ], - [isfinite(0);], have_isfinite=yes, have_isfinite=no) - -if test $have_isfinite = yes; then - AC_DEFINE(HAVE_ISFINITE,1) - AC_MSG_RESULT(yes) -else - AC_DEFINE(HAVE_FINITE,1) - AC_MSG_RESULT(no) -fi +AC_CHECK_LIB(resolv, res_gethostbyname,[DEFS="$DEFS -DHAVE_RES_GETHOSTBYNAME=1"]) #-------------------------------------------------------------------- # Emulator compatible flags (for drivers) diff -Nru erlang-18.2-dfsg/lib/test_server/src/erl2html2.erl erlang-17.3-dfsg/lib/test_server/src/erl2html2.erl --- erlang-18.2-dfsg/lib/test_server/src/erl2html2.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/erl2html2.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -23,11 +22,11 @@ %%%------------------------------------------------------------------ -module(erl2html2). --export([convert/3, convert/4]). +-export([convert/2, convert/3]). -convert([], _Dest, _InclPath) -> % Fake clause. +convert([], _Dest) -> % Fake clause. ok; -convert(File, Dest, InclPath) -> +convert(File, Dest) -> %% The generated code uses the BGCOLOR attribute in the %% BODY tag, which wasn't valid until HTML 3.2. Also, %% good HTML should either override all colour attributes @@ -49,12 +48,12 @@ "\n\n" "\n"], - convert(File, Dest, InclPath, Header). + convert(File, Dest, Header). -convert(File, Dest, InclPath, Header) -> +convert(File, Dest, Header) -> %% statistics(runtime), - case parse_file(File, InclPath) of + case parse_file(File) of {ok,Functions} -> %% {_, Time1} = statistics(runtime), %% io:format("Parsed file in ~.2f Seconds.~n",[Time1/1000]), @@ -89,131 +88,55 @@ %%% %%% All function clauses are also marked in order to allow %%% possibly_enhance/2 to write these in bold. -%%% -%%% Use expanded preprocessor directives if possible (epp). Only if -%%% this fails, fall back on using non-expanded code (epp_dodger). - -parse_file(File, InclPath) -> - case epp:open(File, InclPath, []) of +parse_file(File) -> + case epp:open(File, [], []) of {ok,Epp} -> - try parse_preprocessed_file(Epp,File,false) of - Forms -> - epp:close(Epp), - {ok,Forms} - catch - _:{error,_Reason,true} -> - parse_non_preprocessed_file(File); - _:{error,_Reason,false} -> - {ok,[]} - end; - Error = {error,_} -> - Error + Forms = parse_file(Epp,File,false), + epp:close(Epp), + {ok,Forms}; + {error,E} -> + {error,E} end. -parse_preprocessed_file(Epp, File, InCorrectFile) -> + +parse_file(Epp,File,InCorrectFile) -> case epp:parse_erl_form(Epp) of {ok,Form} -> case Form of {attribute,_,file,{File,_}} -> - parse_preprocessed_file(Epp, File, true); + parse_file(Epp,File,true); {attribute,_,file,{_OtherFile,_}} -> - parse_preprocessed_file(Epp, File, false); - {function,L,F,A,Cs} when InCorrectFile -> - {CLs,LastCL} = find_clause_lines(Cs, []), - %% tl(CLs) cause we know the start line already - [{atom_to_list(F),A,get_line(L),LastCL} | tl(CLs)] ++ - parse_preprocessed_file(Epp, File, true); + parse_file(Epp,File,false); + {function,L,F,A,[_|C]} when InCorrectFile -> + Clauses = [{clause,CL} || {clause,CL,_,_,_} <- C], + [{atom_to_list(F),A,L} | Clauses] ++ + parse_file(Epp,File,true); _ -> - parse_preprocessed_file(Epp, File, InCorrectFile) + parse_file(Epp,File,InCorrectFile) end; - {error,Reason={_L,epp,{undefined,_Macro,none}}} -> - throw({error,Reason,InCorrectFile}); - {error,_Reason} -> - parse_preprocessed_file(Epp, File, InCorrectFile); + {error,_E} -> + parse_file(Epp,File,InCorrectFile); {eof,_Location} -> [] end. -parse_non_preprocessed_file(File) -> - case file:open(File, []) of - {ok,Epp} -> - Forms = parse_non_preprocessed_file(Epp, File, 1), - file:close(Epp), - {ok,Forms}; - Error = {error,_E} -> - Error - end. - -parse_non_preprocessed_file(Epp, File, Location) -> - case epp_dodger:parse_form(Epp, Location) of - {ok,Tree,Location1} -> - try erl_syntax:revert(Tree) of - {function,L,F,A,Cs} -> - {CLs,LastCL} = find_clause_lines(Cs, []), - %% tl(CLs) cause we know the start line already - [{atom_to_list(F),A,get_line(L),LastCL} | tl(CLs)] ++ - parse_non_preprocessed_file(Epp, File, Location1); - _ -> - parse_non_preprocessed_file(Epp, File, Location1) - catch - _:_ -> parse_non_preprocessed_file(Epp, File, Location1) - end; - {error,_E,Location1} -> - parse_non_preprocessed_file(Epp, File, Location1); - {eof,_Location} -> - [] - end. - -get_line(Anno) -> - erl_anno:line(Anno). - -%%%----------------------------------------------------------------- -%%% Find the line number of the last expression in the function -find_clause_lines([{clause,CL,_Params,_Op,Exprs}], CLs) -> % last clause - try tuple_to_list(lists:last(Exprs)) of - [_Type,ExprLine | _] when is_integer(ExprLine) -> - {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(ExprLine)}; - [tree,_ | Exprs1] -> - find_clause_lines([{clause,CL,undefined,undefined,Exprs1}], CLs); - [macro,{_var,ExprLine,_MACRO} | _] when is_integer(ExprLine) -> - {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(ExprLine)}; - _ -> - {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(CL)} - catch - _:_ -> - {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(CL)} - end; - -find_clause_lines([{clause,CL,_Params,_Op,_Exprs} | Cs], CLs) -> - find_clause_lines(Cs, [{clause,get_line(CL)}|CLs]). - %%%----------------------------------------------------------------- %%% Add a link target for each line and one for each function definition. -build_html(SFd,DFd,Encoding,FuncsAndCs) -> - build_html(SFd,DFd,Encoding,file:read_line(SFd),1,FuncsAndCs, - false,undefined). - -%% line of last expression in function found -build_html(SFd,DFd,Enc,{ok,Str},LastL,FuncsAndCs,_IsFuncDef,{F,LastL}) -> - LastLineLink = test_server_ctrl:uri_encode(F++"-last_expr",utf8), - file:write(DFd,[""]), - build_html(SFd,DFd,Enc,{ok,Str},LastL,FuncsAndCs,true,undefined); -%% function start line found -build_html(SFd,DFd,Enc,{ok,Str},L0,[{F,A,L0,LastL}|FuncsAndCs], - _IsFuncDef,_FAndLastL) -> +build_html(SFd,DFd,Encoding,Functions) -> + build_html(SFd,DFd,Encoding,file:read_line(SFd),1,Functions,false). + +build_html(SFd,DFd,Encoding,{ok,Str},L,[{F,A,L}|Functions],_IsFuncDef) -> FALink = test_server_ctrl:uri_encode(F++"-"++integer_to_list(A),utf8), - file:write(DFd,[""]), - build_html(SFd,DFd,Enc,{ok,Str},L0,FuncsAndCs,true,{F,LastL}); -build_html(SFd,DFd,Enc,{ok,Str},L,[{clause,L}|FuncsAndCs], - _IsFuncDef,FAndLastL) -> - build_html(SFd,DFd,Enc,{ok,Str},L,FuncsAndCs,true,FAndLastL); -build_html(SFd,DFd,Enc,{ok,Str},L,FuncsAndCs,IsFuncDef,FAndLastL) -> + file:write(DFd,[""]), + build_html(SFd,DFd,Encoding,{ok,Str},L,Functions,true); +build_html(SFd,DFd,Encoding,{ok,Str},L,[{clause,L}|Functions],_IsFuncDef) -> + build_html(SFd,DFd,Encoding,{ok,Str},L,Functions,true); +build_html(SFd,DFd,Encoding,{ok,Str},L,Functions,IsFuncDef) -> LStr = line_number(L), Str1 = line(Str,IsFuncDef), file:write(DFd,[LStr,Str1]), - build_html(SFd,DFd,Enc,file:read_line(SFd),L+1,FuncsAndCs,false,FAndLastL); -build_html(_SFd,_DFd,_Enc,eof,L,_FuncsAndCs,_IsFuncDef,_FAndLastL) -> + build_html(SFd,DFd,Encoding,file:read_line(SFd),L+1,Functions,false); +build_html(_SFd,_DFd,_Encoding,eof,L,_Functions,_IsFuncDef) -> L. line_number(L) -> diff -Nru erlang-18.2-dfsg/lib/test_server/src/Makefile erlang-17.3-dfsg/lib/test_server/src/Makefile --- erlang-18.2-dfsg/lib/test_server/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1996-2013. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # @@ -125,7 +124,7 @@ release_spec: opt $(INSTALL_DIR) "$(RELSYSDIR)/src" $(INSTALL_DATA) $(ERL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(INTERNAL_HRL_FILES) $(TS_HRL_FILES) "$(RELSYSDIR)/src" + $(INSTALL_DATA) $(INTERNAL_HRL_FILES) "$(RELSYSDIR)/src" $(INSTALL_DIR) "$(RELSYSDIR)/include" $(INSTALL_DATA) $(HRL_FILES) "$(RELSYSDIR)/include" $(INSTALL_DIR) "$(RELSYSDIR)/ebin" diff -Nru erlang-18.2-dfsg/lib/test_server/src/test_server.app.src erlang-17.3-dfsg/lib/test_server/src/test_server.app.src --- erlang-18.2-dfsg/lib/test_server/src/test_server.app.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/test_server.app.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% @@ -33,7 +32,7 @@ test_server_break_process]}, {applications, [kernel,stdlib]}, {env, []}, - {runtime_dependencies, ["tools-2.8","stdlib-2.5","runtime_tools-1.8.16", - "observer-2.1","kernel-4.0","inets-6.0", - "syntax_tools-1.7","erts-7.0"]}]}. + {runtime_dependencies, ["tools-2.6.14","stdlib-2.0","runtime_tools-1.8.14", + "observer-2.0","kernel-3.0","inets-5.10", + "erts-6.0"]}]}. diff -Nru erlang-18.2-dfsg/lib/test_server/src/test_server.appup.src erlang-17.3-dfsg/lib/test_server/src/test_server.appup.src --- erlang-18.2-dfsg/lib/test_server/src/test_server.appup.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/test_server.appup.src 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% {"%VSN%", diff -Nru erlang-18.2-dfsg/lib/test_server/src/test_server_ctrl.erl erlang-17.3-dfsg/lib/test_server/src/test_server_ctrl.erl --- erlang-18.2-dfsg/lib/test_server/src/test_server_ctrl.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/test_server_ctrl.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -100,7 +99,7 @@ -define(last_link, "last_link"). -define(last_test, "last_test"). -define(html_ext, ".html"). --define(now, os:timestamp()). +-define(now, erlang:now()). -define(void_fun, fun() -> ok end). -define(mod_result(X), if X == skip -> skipped; @@ -1205,14 +1204,19 @@ report_severe_error(Reason) -> test_server_sup:framework_call(report, [severe_error,Reason]). -ts_tc(M,F,A) -> - Before = erlang:monotonic_time(), - Result = (catch apply(M, F, A)), - After = erlang:monotonic_time(), - Elapsed = erlang:convert_time_unit(After-Before, - native, - micro_seconds), - {Elapsed, Result}. +%% timer:tc/3 +ts_tc(M, F, A) -> + Before = ?now, + Val = (catch apply(M, F, A)), + After = ?now, + Elapsed = elapsed_time(Before, After), + {Elapsed,Val}. + +elapsed_time(Before, After) -> + (element(1,After)*1000000000000 + + element(2,After)*1000000 + element(3,After)) - + (element(1,Before)*1000000000000 + + element(2,Before)*1000000 + element(3,Before)). start_extra_tools(ExtraTools) -> start_extra_tools(ExtraTools, []). @@ -1804,37 +1808,20 @@ put(test_server_minor_footer, Footer), io:put_chars(Fd, Header), - io:put_chars(Fd, ""), - io:put_chars(Fd, "
    \n"),
    -
         SrcListing = downcase(atom_to_list(Mod)) ++ ?src_listing_ext,
    -
    -    case get_fw_mod(?MODULE) of
    -	Mod when Func == error_in_suite ->
    -	    ok;
    +    case {filelib:is_file(filename:join(LogDir, SrcListing)),
    +	  lists:member(no_src, get(test_server_logopts))} of
    +	{true,false} ->
    +	    print(Lev, "source code for ~w:~w/1\n",
    +		  [uri_encode(SrcListing),
    +		   uri_encode(atom_to_list(Func)++"-1",utf8),
    +		   Mod,Func]);
     	_ ->
    -	    {Info,Arity} =
    -		if Func == init_per_suite; Func == end_per_suite ->
    -			{"Config function: ", 1};
    -		   Func == init_per_group; Func == end_per_group ->
    -			{"Config function: ", 2};
    -		   true ->
    -			{"Test case: ", 1}
    -		end,
    -	    
    -	    case {filelib:is_file(filename:join(LogDir, SrcListing)),
    -		  lists:member(no_src, get(test_server_logopts))} of
    -		{true,false} ->
    -		    print(Lev, Info ++ "~w:~w/~w "
    -			  "(click for source code)\n",
    -			  [uri_encode(SrcListing),
    -			   uri_encode(atom_to_list(Func)++"-1",utf8),
    -			   Mod,Func,Arity]);
    -		_ ->
    -		    print(Lev, Info ++ "~w:~w/~w\n", [Mod,Func,Arity])
    -	    end
    +	    ok
         end,
     
    +    io:put_chars(Fd, "
    \n"),
    +
         AbsName.
     
     stop_minor_log_file() ->
    @@ -1940,20 +1927,15 @@
     	{ok,DestInfo} when DestInfo#file_info.mtime >= SrcInfo#file_info.mtime ->
     	    ok;					% dest file up to date
     	_ ->
    -	    InclPath = case application:get_env(test_server, include) of
    -			   {ok,Incls} -> Incls;
    -			   _ -> []
    -		       end,
    -
     	    OutDir = get(test_server_log_dir_base),
     	    case test_server_sup:framework_call(get_html_wrapper,
     						["Module "++Src,false,
     						 OutDir,undefined,
     						 encoding(Src)], "") of
     		Empty when (Empty == "") ; (element(2,Empty) == "")  ->
    -		    erl2html2:convert(Src, Dest, InclPath);
    +		    erl2html2:convert(Src, Dest);
     		{_,Header,_} ->
    -		    erl2html2:convert(Src, Dest, InclPath, Header)
    +		    erl2html2:convert(Src, Dest, Header)
     	    end
         end.
     
    @@ -2026,7 +2008,7 @@
         PreCases ++ [Case|add_init_and_end_per_suite(Cases, NextMod,
     						 NextRef, FwMod)];
     add_init_and_end_per_suite([SkipCase|Cases], LastMod, LastRef, FwMod)
    -  when element(1,SkipCase) == skip_case;  element(1,SkipCase) == auto_skip_case->
    +  when element(1,SkipCase) == skip_case ->
         [SkipCase|add_init_and_end_per_suite(Cases, LastMod, LastRef, FwMod)];
     add_init_and_end_per_suite([{conf,_,_,_}=Case|Cases], LastMod, LastRef, FwMod) ->
         [Case|add_init_and_end_per_suite(Cases, LastMod, LastRef, FwMod)];
    @@ -2491,7 +2473,7 @@
     			file:set_cwd(filename:dirname(get(test_server_dir))),
     			After = ?now,
     			Before = get(test_server_parallel_start_time),
    -			Elapsed = timer:now_diff(After, Before)/1000000,
    +			Elapsed = elapsed_time(Before, After)/1000000,
     			put(test_server_total_time, Elapsed),
     			{false,tl(Mode0),undefined,Elapsed,
     			 update_status(Ref, OkSkipFail, Status)};
    @@ -2500,7 +2482,7 @@
     			%% parallel group (io buffering is active)
     			OkSkipFail = wait_for_cases(Ref),
     			queue_test_case_io(Ref, self(), 0, Mod, Func),
    -			Elapsed = timer:now_diff(?now, conf_start(Ref, Mode0))/1000000,
    +			Elapsed = elapsed_time(conf_start(Ref, Mode0),?now)/1000000,
     			case CurrIOHandler of
     			    {Ref,_} ->
     				%% current_io_handler was set by start conf of this
    @@ -2517,12 +2499,12 @@
     		%% this is an end conf for a non-parallel group that's not
     		%% nested under a parallel group, so no need to buffer io
     		{false,tl(Mode0),undefined,
    -		 timer:now_diff(?now, conf_start(Ref, Mode0))/1000000, Status};
    +		 elapsed_time(conf_start(Ref, Mode0),?now)/1000000, Status};
     	    {Ref,_} ->
     		%% this is an end conf for a non-parallel group nested under
     		%% a parallel group (io buffering is active)
     		queue_test_case_io(Ref, self(), 0, Mod, Func),
    -		Elapsed = timer:now_diff(?now, conf_start(Ref, Mode0))/1000000,
    +		Elapsed = elapsed_time(conf_start(Ref, Mode0),?now)/1000000,
     		case CurrIOHandler of
     		    {Ref,_} ->
     			%% current_io_handler was set by start conf of this
    @@ -2577,7 +2559,7 @@
     			    %% 1. check the TS_RANDOM_SEED env variable
     			    %% 2. check random_seed in process state
     			    %% 3. use value provided with shuffle option
    -			    %% 4. use timestamp() values for seed
    +			    %% 4. use now() values for seed
     			    case os:getenv("TS_RANDOM_SEED") of
     				Undef when Undef == false ; Undef == "undefined" ->
     				    case get(test_server_random_seed) of
    @@ -3089,11 +3071,13 @@
         print(major, "=group_time    ~.3fs", [ConfTime]),
         print(minor, "~n=== Total execution time of group: ~.3fs~n", [ConfTime]).
     
    -print_props([]) ->
    +print_props(_, []) ->
         ok;
    -print_props(Props) ->
    +print_props(true, Props) ->
         print(major, "=group_props   ~p", [Props]),
    -    print(minor, "Group properties: ~p~n", [Props]).
    +    print(minor, "Group properties: ~p~n", [Props]);
    +print_props(_, _) ->
    +    ok.
     
     %% repeat N times:                                  {repeat,N}
     %% repeat N times or until all successful:          {repeat_until_all_ok,N}
    @@ -3698,6 +3682,7 @@
     
         print(major, "=case          ~w:~w", [Mod, Func]),
         MinorName = start_minor_log_file(Mod, Func, self() /= Main),
    +    print(minor, "", [], internal_raw),
         MinorBase = filename:basename(MinorName),
         print(major, "=logfile       ~ts", [filename:basename(MinorName)]),
     
    @@ -3711,8 +3696,8 @@
     		RunDir = filename:dirname(MinorName),
     		Ext =
     		    if Num == 0 ->
    -			    Int = erlang:unique_integer([positive,monotonic]),
    -			    lists:flatten(io_lib:format(".cfg.~w", [Int]));
    +			    {_,S,Us} = now(),
    +			    lists:flatten(io_lib:format(".~w.~w", [S,Us]));
     		       true ->
     			    lists:flatten(io_lib:format(".~w", [Num]))
     		    end,
    @@ -3730,20 +3715,7 @@
     				   [tc_start,{{Mod,{Func,GrName}},
     					      MinorName}]),
     
    -    {ok,Cwd} = file:get_cwd(),
    -    Args2Print = if is_list(UpdatedArgs) ->
    -			 lists:keydelete(tc_group_result, 1, UpdatedArgs);
    -		     true ->
    -			 UpdatedArgs
    -		 end,
    -    if RunInit == skip_init ->
    -	    print_props(get_props(Mode));
    -       true ->
    -	    ok
    -    end,
    -    print(minor, "Config value:\n\n    ~tp\n", [Args2Print]),
    -    print(minor, "Current directory is ~tp\n", [Cwd]),
    -
    +    print_props((RunInit==skip_init), get_props(Mode)),
         GrNameStr =	case GrName of
     		    undefined -> "";
     		    Name      -> cast_to_list(Name)
    @@ -3952,8 +3924,8 @@
     	  "~ts~ts\n",
     	  [Time,Color,ReasonStr2,Comment1]),
         FormatLoc = test_server_sup:format_loc(Loc),
    -    print(minor, "=== Location: ~ts", [FormatLoc]),
    -    print(minor, "=== Reason: ~ts", [ReasonStr1]),
    +    print(minor, "=== location ~ts", [FormatLoc]),
    +    print(minor, "=== reason = ~ts", [ReasonStr1]),
         Ret;
     
     progress(failed, CaseNum, Mod, Func, GrName, Loc, timetrap_timeout, T,
    @@ -3978,8 +3950,8 @@
     	  "~ts\n",
     	  [T/1000,Comment]),
         FormatLoc = test_server_sup:format_loc(Loc),
    -    print(minor, "=== Location: ~ts", [FormatLoc]),
    -    print(minor, "=== Reason: timetrap timeout", []),
    +    print(minor, "=== location ~ts", [FormatLoc]),
    +    print(minor, "=== reason = timetrap timeout", []),
         failed;
     
     progress(failed, CaseNum, Mod, Func, GrName, Loc, {testcase_aborted,Reason}, _T,
    @@ -4004,13 +3976,13 @@
     	  "~ts\n",
     	  [Comment]),
         FormatLoc = test_server_sup:format_loc(Loc),
    -    print(minor, "=== Location: ~ts", [FormatLoc]),
    -    print(minor, "=== Reason: {testcase_aborted,~p}", [Reason]),
    +    print(minor, "=== location ~ts", [FormatLoc]),
    +    print(minor, "=== reason = {testcase_aborted,~p}", [Reason]),
         failed;
     
     progress(failed, CaseNum, Mod, Func, GrName, unknown, Reason, Time,
     	 Comment0, {St0,St1}) ->
    -    print(major, "=result        failed: ~p, ~w", [Reason,unknown_location]),
    +    print(major, "=result        failed: ~p, ~w", [Reason,unknown]),
         print(1, "*** FAILED ~ts ***",
     	  [get_info_str(Mod,Func, CaseNum, get(test_server_cases))]),
         test_server_sup:framework_call(report, [tc_done,{Mod,{Func,GrName},
    @@ -4039,21 +4011,14 @@
     	  "FAILED"
     	  "~ts\n",
     	  [TimeStr,Comment]),
    -    print(minor, "=== Location: ~w", [unknown]),
    +    print(minor, "=== location ~w", [unknown]),
         {FStr,FormattedReason} = format_exception(Reason),
    -    print(minor, "=== Reason: " ++ FStr, [FormattedReason]),
    +    print(minor, "=== reason = " ++ FStr, [FormattedReason]),
         failed;
     
     progress(failed, CaseNum, Mod, Func, GrName, Loc, Reason, Time,
     	 Comment0, {St0,St1}) ->
    -    {LocMaj,LocMin} = if Func == error_in_suite ->
    -			      case get_fw_mod(undefined) of
    -				  Mod -> {unknown_location,unknown};
    -				  _   -> {Loc,Loc}
    -			      end;
    -			 true -> {Loc,Loc}
    -		       end,
    -    print(major, "=result        failed: ~p, ~p", [Reason,LocMaj]),
    +    print(major, "=result        failed: ~p, ~p", [Reason,Loc]),
         print(1, "*** FAILED ~ts ***",
     	  [get_info_str(Mod,Func, CaseNum, get(test_server_cases))]),
         test_server_sup:framework_call(report, [tc_done,{Mod,{Func,GrName},
    @@ -4066,16 +4031,16 @@
     	    "" -> "";
     	    _ -> xhtml("
    ","
    ") ++ to_string(Comment0) end, - FormatLastLoc = test_server_sup:format_loc(get_last_loc(LocMaj)), + FormatLastLoc = test_server_sup:format_loc(get_last_loc(Loc)), print(html, "" ++ St0 ++ "~ts" ++ St1 ++ "" "FAILED" "~ts~ts\n", [TimeStr,FormatLastLoc,Comment]), - FormatLoc = test_server_sup:format_loc(LocMin), - print(minor, "=== Location: ~ts", [FormatLoc]), + FormatLoc = test_server_sup:format_loc(Loc), + print(minor, "=== location ~ts", [FormatLoc]), {FStr,FormattedReason} = format_exception(Reason), - print(minor, "=== Reason: " ++ FStr, [FormattedReason]), + print(minor, "=== reason = " ++ FStr, [FormattedReason]), failed; progress(ok, _CaseNum, Mod, Func, GrName, _Loc, RetVal, Time, @@ -4104,7 +4069,7 @@ "Ok" "~ts\n", [Time,Comment]), - print(minor, "=== Returned value: ~p", [RetVal]), + print(minor, "=== returned value = ~p", [RetVal]), ok. %%-------------------------------------------------------------------- @@ -4692,10 +4657,10 @@ collect_cases({Module, Cases}, St, Mode) when is_list(Cases) -> case (catch collect_case(Cases, St#cc{mod=Module}, [], Mode)) of - Result = {ok,_,_} -> - Result; + {ok, NewCases, NewSt} -> + {ok, NewCases, NewSt}; Other -> - {error,Other} + {error, Other} end; collect_cases({_Mod,_Case}=Spec, St, Mode) -> @@ -4713,9 +4678,9 @@ collect_case(MFA, St, Mode) -> case in_skip_list(MFA, St#cc.skip) of - {true,Comment} when Comment /= make_failed -> + {true,Comment} -> {ok,[{skip_case,{MFA,Comment},Mode}],St}; - _ -> + false -> case MFA of {Mod,Case} -> collect_case_invoke(Mod, Case, MFA, St, Mode); {_Mod,_Case,_Args} -> {ok,[MFA],St} @@ -4777,25 +4742,17 @@ collect_files(Dir, Pattern, St, Mode) -> {ok,Cwd} = file:get_cwd(), Dir1 = filename:join(Cwd, Dir), - Wc = filename:join([Dir1,Pattern++"{.erl,"++code:objfile_extension()++"}"]), + Wc = filename:join([Dir1,Pattern++code:objfile_extension()]), case catch filelib:wildcard(Wc) of {'EXIT', Reason} -> io:format("Could not collect files: ~p~n", [Reason]), {error,{collect_fail,Dir,Pattern}}; - Files -> - %% convert to module names and remove duplicates - Mods = lists:foldl(fun(File, Acc) -> - Mod = fullname_to_mod(File), - case lists:member(Mod, Acc) of - true -> Acc; - false -> [Mod | Acc] - end - end, [], Files), - Tests = [{Mod,all} || Mod <- lists:sort(Mods)], - collect_cases(Tests, St, Mode) + Mods0 -> + Mods = [{path_to_module(Mod),all} || Mod <- lists:sort(Mods0)], + collect_cases(Mods, St, Mode) end. -fullname_to_mod(Path) when is_list(Path) -> +path_to_module(Path) when is_list(Path) -> %% If this is called with a binary, then we are probably in +fnu %% mode and have found a beam file with name encoded as latin1. We %% will let this crash since it can not work to load such a module diff -Nru erlang-18.2-dfsg/lib/test_server/src/test_server.erl erlang-17.3-dfsg/lib/test_server/src/test_server.erl --- erlang-18.2-dfsg/lib/test_server/src/test_server.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/test_server.erl 2014-09-16 19:10:57.000000000 +0000 @@ -1,21 +1,21 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% +%% -module(test_server). -define(DEFAULT_TIMETRAP_SECS, 60). @@ -130,8 +130,7 @@ io:fwrite("done\n\n",[]), {ok,CoverInfo#cover{mods=Include}} end; -cover_compile(CoverInfo=#cover{app=App,excl=Exclude, - incl=Include,cross=Cross}) -> +cover_compile(CoverInfo=#cover{app=App,excl=Exclude,incl=Include,cross=Cross}) -> CrossMods = lists:flatmap(fun({_,M}) -> M end,Cross), case code:lib_dir(App) of {error,bad_name} -> @@ -178,35 +177,68 @@ do_cover_compile(Modules) -> cover:start(), - Sticky = prepare_cover_compile(Modules,[]), - R = cover:compile_beam(Modules), - [warn_compile(Error) || Error <- R,element(1,Error)=/=ok], - [code:stick_mod(M) || M <- Sticky], + pmap1(fun(M) -> do_cover_compile1(M) end,lists:usort(Modules)), ok. -warn_compile({error,{Reason,Module}}) -> - io:fwrite("\nWARNING: Could not cover compile ~ts: ~p\n", - [Module,{error,Reason}]). - -%% Make sure all modules are loaded and unstick if sticky -prepare_cover_compile([M|Ms],Sticky) -> +do_cover_compile1(M) -> case {code:is_sticky(M),code:is_loaded(M)} of {true,_} -> code:unstick_mod(M), - prepare_cover_compile(Ms,[M|Sticky]); + case cover:compile_beam(M) of + {ok,_} -> + ok; + Error -> + io:fwrite("\nWARNING: Could not cover compile ~w: ~p\n", + [M,Error]) + end, + code:stick_mod(M); {false,false} -> case code:load_file(M) of {module,_} -> - prepare_cover_compile([M|Ms],Sticky); + do_cover_compile1(M); Error -> - io:fwrite("\nWARNING: Could not load ~w: ~p\n",[M,Error]), - prepare_cover_compile(Ms,Sticky) + io:fwrite("\nWARNING: Could not load ~w: ~p\n",[M,Error]) end; {false,_} -> - prepare_cover_compile(Ms,Sticky) - end; -prepare_cover_compile([],Sticky) -> - Sticky. + case cover:compile_beam(M) of + {ok,_} -> + ok; + Error -> + io:fwrite("\nWARNING: Could not cover compile ~w: ~p\n", + [M,Error]) + end + end. + +pmap1(Fun,List) -> + NTot = length(List), + NProcs = erlang:system_info(schedulers) * 2, + NPerProc = (NTot div NProcs) + 1, + + {[],Pids} = + lists:foldr( + fun(_,{L,Ps}) -> + {L1,L2} = if length(L)>=NPerProc -> lists:split(NPerProc,L); + true -> {L,[]} % last chunk + end, + {P,_Ref} = + spawn_monitor(fun() -> + exit(lists:map(Fun,L1)) + end), + {L2,[P|Ps]} + end, + {List,[]}, + lists:seq(1,NProcs)), + collect(Pids,[]). + +collect([],Acc) -> + lists:append(Acc); +collect([Pid|Pids],Acc) -> + receive + {'DOWN', _Ref, process, Pid, Result} -> + %% collect(lists:delete(Pid,Pids),[Result|Acc]) + collect(Pids,[Result|Acc]) + end. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% cover_analyse(Dir,#cover{level=Analyse,mods=Modules,stop=Stop) -> @@ -236,40 +268,45 @@ %% after the test is completed. cover_analyse(Dir,#cover{level=Analyse,mods=Modules,stop=Stop}) -> io:fwrite(user, "Cover analysing... ", []), - {ATFOk,ATFFail} = + DetailsFun = case Analyse of details -> case cover:export(filename:join(Dir,"all.coverdata")) of ok -> - {result,Ok1,Fail1} = - cover:analyse_to_file(Modules,[{outdir,Dir},html]), - {lists:map(fun(OutFile) -> - M = list_to_atom( - filename:basename( - filename:rootname(OutFile, - ".COVER.html") - ) - ), - {M,{file,OutFile}} - end, Ok1), - lists:map(fun({Reason,M}) -> - {M,{error,Reason}} - end, Fail1)}; + fun(M) -> + OutFile = filename:join(Dir, + atom_to_list(M) ++ + ".COVER.html"), + case cover:analyse_to_file(M,OutFile,[html]) of + {ok,_} -> + {file,OutFile}; + Error -> + Error + end + end; Error -> - {[],lists:map(fun(M) -> {M,Error} end, Modules)} + fun(_) -> Error end end; overview -> case cover:export(filename:join(Dir,"all.coverdata")) of ok -> - {[],lists:map(fun(M) -> {M,undefined} end, Modules)}; + fun(_) -> undefined end; Error -> - {[],lists:map(fun(M) -> {M,Error} end, Modules)} + fun(_) -> Error end end end, - {result,AOk,AFail} = cover:analyse(Modules,module), - R0 = merge_analysis_results(AOk,ATFOk++ATFFail,[]) ++ - [{M,{error,Reason}} || {Reason,M} <- AFail], - R = lists:sort(R0), + R = pmap2( + fun(M) -> + case cover:analyse(M,module) of + {ok,{M,{Cov,NotCov}}} -> + {M,{Cov,NotCov,DetailsFun(M)}}; + Err -> + io:fwrite(user, + "\nWARNING: Analysis failed for ~w. Reason: ~p\n", + [M,Err]), + {M,Err} + end + end, Modules), io:fwrite(user, "done\n\n", []), case Stop of @@ -282,15 +319,19 @@ end, R. -merge_analysis_results([{M,{Cov,NotCov}}|T],ATF,Acc) -> - case lists:keytake(M,1,ATF) of - {value,{_,R},ATF1} -> - merge_analysis_results(T,ATF1,[{M,{Cov,NotCov,R}}|Acc]); - false -> - merge_analysis_results(T,ATF,Acc) - end; -merge_analysis_results([],_,Acc) -> - Acc. +pmap2(Fun,List) -> + Collector = self(), + Pids = lists:map(fun(E) -> + spawn(fun() -> + Collector ! {res,self(),Fun(E)} + end) + end, List), + lists:map(fun(Pid) -> + receive + {res,Pid,Res} -> + Res + end + end, Pids). do_cover_for_node(Node,CoverFunc) -> do_cover_for_node(Node,CoverFunc,true). @@ -404,6 +445,15 @@ }). run_test_case_apply(Mod, Func, Args, Name, RunInit, TimetrapData) -> + {ok,Cwd} = file:get_cwd(), + Args2Print = case Args of + [Args1] when is_list(Args1) -> + lists:keydelete(tc_group_result, 1, Args1); + _ -> + Args + end, + print(minor, "Test case started with:\n~w:~w(~tp)\n", [Mod,Func,Args2Print]), + print(minor, "Current directory is ~tp\n", [Cwd]), print_timestamp(minor,"Started at "), print(minor, "", [], internal_raw), TCCallback = get(test_server_testcase_callback), @@ -678,7 +728,7 @@ Msg = {E,AbortReason}, {Msg,Loc0,Msg}; Other -> - {{'EXIT',Other},unknown,Other} + {Other,unknown,Other} end, Timeout = end_conf_timeout(Reason, St), Config = [{tc_status,{failed,F}}|Config0], @@ -692,7 +742,7 @@ {testcase_aborted=E,AbortReason,Loc0} -> {{E,AbortReason},Loc0}; Other -> - {{'EXIT',Other},St#st.last_known_loc} + {Other,St#st.last_known_loc} end, Func = case Status of init_per_testcase=F -> {F,Func0}; @@ -729,16 +779,16 @@ EndConfApply = fun() -> timetrap(TVal), - try apply(Mod,end_per_testcase,[Func,Conf]) of - _ -> ok - catch - _:Why -> + case catch apply(Mod,end_per_testcase,[Func,Conf]) of + {'EXIT',Why} -> timer:sleep(1), group_leader() ! {printout,12, "WARNING! " "~w:end_per_testcase(~w, ~p)" " crashed!\n\tReason: ~p\n", - [Mod,Func,Conf,Why]} + [Mod,Func,Conf,Why]}; + _ -> + ok end, Supervisor ! {self(),end_conf} end, @@ -767,11 +817,11 @@ Skip = {skip,{failed,{Mod,init_per_testcase,Why}}}, %% if init_per_testcase fails, the test case %% should be skipped - try do_end_tc_call(Mod,Func, {Pid,Skip,[CurrConf]}, Why) of - _ -> ok - catch - _:FwEndTCErr -> - exit({fw_notify_done,end_tc,FwEndTCErr}) + case catch do_end_tc_call(Mod,Func, {Pid,Skip,[CurrConf]}, Why) of + {'EXIT',FwEndTCErr} -> + exit({fw_notify_done,end_tc,FwEndTCErr}); + _ -> + ok end, %% finished, report back SendTo ! {self(),fw_notify_done, @@ -799,12 +849,12 @@ " failed!\n\tReason: timetrap timeout" " after ~w ms!\n", [Mod,Func,EndConf,TVal]}, FailLoc = proplists:get_value(tc_fail_loc, EndConf), - try do_end_tc_call(Mod,Func, + case catch do_end_tc_call(Mod,Func, {Pid,Report,[EndConf]}, Why) of - _ -> ok - catch - _:FwEndTCErr -> - exit({fw_notify_done,end_tc,FwEndTCErr}) + {'EXIT',FwEndTCErr} -> + exit({fw_notify_done,end_tc,FwEndTCErr}); + _ -> + ok end, Warn = "" "WARNING: end_per_testcase timed out!", @@ -840,21 +890,21 @@ end, FwCall = fun() -> - try fw_error_notify(Mod,Func1,[], - Error,Loc) of - _ -> ok - catch - _:FwErrorNotifyErr -> + case catch fw_error_notify(Mod,Func1,[], + Error,Loc) of + {'EXIT',FwErrorNotifyErr} -> exit({fw_notify_done,error_notification, - FwErrorNotifyErr}) + FwErrorNotifyErr}); + _ -> + ok end, Conf = [{tc_status,{failed,Error}}|CurrConf], - try do_end_tc_call(Mod,Func1, - {Pid,Error,[Conf]},Error) of - _ -> ok - catch - _:FwEndTCErr -> - exit({fw_notify_done,end_tc,FwEndTCErr}) + case catch do_end_tc_call(Mod,Func1, + {Pid,Error,[Conf]},Error) of + {'EXIT',FwEndTCErr} -> + exit({fw_notify_done,end_tc,FwEndTCErr}); + _ -> + ok end, %% finished, report back SendTo ! {self(),fw_notify_done,{died,Error,Loc,[],undefined}} @@ -934,15 +984,12 @@ NewResult = do_end_tc_call(Mod,Func, {{error,Reason},[Conf]}, {fail,Reason}), {{0,NewResult},Where,[]}; - Skip = {SkipType,_Reason} when SkipType == skip; - SkipType == skipped -> - NewResult = do_end_tc_call(Mod,Func, - {Skip,Args0}, Skip), + Skip = {skip,_Reason} -> + NewResult = do_end_tc_call(Mod,Func, {Skip,Args0}, Skip), {{0,NewResult},Where,[]}; AutoSkip = {auto_skip,_Reason} -> %% special case where a conf case "pretends" to be skipped - NewResult = - do_end_tc_call(Mod,Func, {AutoSkip,Args0}, AutoSkip), + NewResult = do_end_tc_call(Mod,Func, {AutoSkip,Args0}, AutoSkip), {{0,NewResult},Where,[]} end, exit({Ref,Time,Value,Loc,Opts}). @@ -953,12 +1000,10 @@ set_tc_state(init_per_testcase, hd(Args)), ensure_timetrap(Args), case init_per_testcase(Mod, Func, Args) of - Skip = {SkipType,Reason} when SkipType == skip; - SkipType == skipped -> + Skip = {skip,Reason} -> Line = get_loc(), Conf = [{tc_status,{skipped,Reason}}|hd(Args)], - NewRes = do_end_tc_call(Mod,Func, - {Skip,[Conf]}, Skip), + NewRes = do_end_tc_call(Mod,Func, {Skip,[Conf]}, Skip), {{0,NewRes},Line,[]}; {skip_and_save,Reason,SaveCfg} -> Line = get_loc(), @@ -976,12 +1021,11 @@ {{0,NewRes},[{Mod,Func}],[]}; {ok,NewConf} -> %% call user callback function if defined - NewConf1 = - user_callback(TCCallback, Mod, Func, init, NewConf), + NewConf1 = user_callback(TCCallback, Mod, Func, init, NewConf), %% save current state in controller loop set_tc_state(tc, NewConf1), %% execute the test case - {{T,Return},Loc} = {ts_tc(Mod,Func,[NewConf1]), get_loc()}, + {{T,Return},Loc} = {ts_tc(Mod, Func, [NewConf1]),get_loc()}, {EndConf,TSReturn,FWReturn} = case Return of {E,TCError} when E=='EXIT' ; E==failed -> @@ -997,39 +1041,30 @@ {[{tc_status,{skipped,Why}}, {save_config,SaveCfg}|NewConf1], Skip,Skip}; - {SkipType,Why} when SkipType == skip; - SkipType == skipped -> - {[{tc_status,{skipped,Why}}|NewConf1],Return, - Return}; + {skip,Why} -> + {[{tc_status,{skipped,Why}}|NewConf1],Return,Return}; _ -> {[{tc_status,ok}|NewConf1],Return,ok} end, %% call user callback function if defined - EndConf1 = - user_callback(TCCallback, Mod, Func, 'end', EndConf), + EndConf1 = user_callback(TCCallback, Mod, Func, 'end', EndConf), %% update current state in controller loop {FWReturn1,TSReturn1,EndConf2} = case end_per_testcase(Mod, Func, EndConf1) of SaveCfg1={save_config,_} -> - {FWReturn,TSReturn, - [SaveCfg1|lists:keydelete(save_config,1, - EndConf1)]}; + {FWReturn,TSReturn,[SaveCfg1|lists:keydelete(save_config,1, + EndConf1)]}; {fail,ReasonToFail} -> %% user has failed the testcase - fw_error_notify(Mod, Func, EndConf1, - ReasonToFail), - {{error,ReasonToFail}, - {failed,ReasonToFail}, - EndConf1}; - {failed,{_,end_per_testcase,_}} = Failure when - FWReturn == ok -> + fw_error_notify(Mod, Func, EndConf1, ReasonToFail), + {{error,ReasonToFail},{failed,ReasonToFail},EndConf1}; + {failed,{_,end_per_testcase,_}} = Failure when FWReturn == ok -> %% unexpected termination in end_per_testcase %% report this as the result to the framework {Failure,TSReturn,EndConf1}; _ -> - %% test case result should be reported to - %% framework no matter the status of - %% end_per_testcase + %% test case result should be reported to framework + %% no matter the status of end_per_testcase {FWReturn,TSReturn,EndConf1} end, %% clear current state in controller loop @@ -1096,8 +1131,7 @@ ReturnTags = [skip,skip_and_save,save_config,comment,return_group_result], %% check if all elements in the list are valid end conf return value tuples case lists:all(fun(Val) when is_tuple(Val) -> - lists:any(fun(T) -> T == element(1, Val) end, - ReturnTags); + lists:any(fun(T) -> T == element(1, Val) end, ReturnTags); (ok) -> true; (_) -> @@ -1131,19 +1165,14 @@ NewReturn -> {NewReturn,SaveOpts} end; -process_return_val1([SaveCfg={save_config,_}|Opts], M,F,[Args], - Loc, Final, SaveOpts) -> +process_return_val1([SaveCfg={save_config,_}|Opts], M,F,[Args], Loc, Final, SaveOpts) -> process_return_val1(Opts, M,F,[[SaveCfg|Args]], Loc, Final, SaveOpts); -process_return_val1([{skip_and_save,Why,SaveCfg}|Opts], M,F,[Args], - Loc, _, SaveOpts) -> - process_return_val1(Opts, M,F,[[{save_config,SaveCfg}|Args]], - Loc, {skip,Why}, SaveOpts); -process_return_val1([GR={return_group_result,_}|Opts], M,F,A, - Loc, Final, SaveOpts) -> +process_return_val1([{skip_and_save,Why,SaveCfg}|Opts], M,F,[Args], Loc, _, SaveOpts) -> + process_return_val1(Opts, M,F,[[{save_config,SaveCfg}|Args]], Loc, {skip,Why}, SaveOpts); +process_return_val1([GR={return_group_result,_}|Opts], M,F,A, Loc, Final, SaveOpts) -> process_return_val1(Opts, M,F,A, Loc, Final, [GR|SaveOpts]); -process_return_val1([RetVal={Tag,_}|Opts], M,F,A, - Loc, _, SaveOpts) when Tag==skip; - Tag==comment -> +process_return_val1([RetVal={Tag,_}|Opts], M,F,A, Loc, _, SaveOpts) when Tag==skip; + Tag==comment -> process_return_val1(Opts, M,F,A, Loc, RetVal, SaveOpts); process_return_val1([_|Opts], M,F,A, Loc, Final, SaveOpts) -> process_return_val1(Opts, M,F,A, Loc, Final, SaveOpts); @@ -1157,8 +1186,7 @@ user_callback(undefined, _, _, _, Args) -> Args; -user_callback({CBMod,CBFunc}, Mod, Func, InitOrEnd, - [Args]) when is_list(Args) -> +user_callback({CBMod,CBFunc}, Mod, Func, InitOrEnd, [Args]) when is_list(Args) -> case catch apply(CBMod, CBFunc, [InitOrEnd,Mod,Func,Args]) of Args1 when is_list(Args1) -> [Args1]; @@ -1313,30 +1341,12 @@ Stk = [rewrite_loc_item(Loc) || Loc <- Stk0], case get(test_server_loc) of [{Suite,Case}] -> - %% Location info unknown, check if {Suite,Case,Line} - %% is available in stacktrace and if so, use stacktrace - %% instead of current test_server_loc. - %% If location is the last expression in a test case - %% function, the info is not available due to tail call - %% elimination. We need to check if the test case has been - %% called by ts_tc/3 and, if so, insert the test case info - %% at that position. + %% location info unknown, check if {Suite,Case,Line} + %% is available in stacktrace. and if so, use stacktrace + %% instead of current test_server_loc case [match || {S,C,_L} <- Stk, S == Suite, C == Case] of - [match|_] -> - put(test_server_loc, Stk); - _ -> - {PreTC,PostTC} = - lists:splitwith(fun({test_server,ts_tc,_}) -> - false; - (_) -> - true - end, Stk), - if PostTC == [] -> - ok; - true -> - put(test_server_loc, - PreTC++[{Suite,Case,last_expr} | PostTC]) - end + [match|_] -> put(test_server_loc, Stk); + _ -> ok end; _ -> put(test_server_loc, Stk) @@ -1363,8 +1373,8 @@ %% Just like io:format, except that depending on the Detail value, the output %% is directed to console, major and/or minor log files. -%% print(Detail,Format,Args) -> -%% test_server_ctrl:print(Detail, Format, Args). +print(Detail,Format,Args) -> + test_server_ctrl:print(Detail, Format, Args). print(Detail,Format,Args,Printer) -> test_server_ctrl:print(Detail, Format, Args, Printer). @@ -1398,12 +1408,9 @@ undefined end. -%% -%% IMPORTANT: get_loc/1 uses the name of this function when analysing -%% stack traces. If the name changes, get_loc/1 must be updated! -%% +%% timer:tc/3 ts_tc(M, F, A) -> - Before = erlang:monotonic_time(), + Before = erlang:now(), Result = try apply(M, F, A) catch @@ -1423,8 +1430,12 @@ {'EXIT',Reason} end end, - After = erlang:monotonic_time(), - Elapsed = erlang:convert_time_unit(After-Before, native, micro_seconds), + After = erlang:now(), + Elapsed = + (element(1,After)*1000000000000 + +element(2,After)*1000000+element(3,After)) - + (element(1,Before)*1000000000000 + +element(2,Before)*1000000+element(3,Before)), {Elapsed, Result}. set_loc(Stk) -> @@ -1767,8 +1778,7 @@ put(test_server_timetraps,[{Handle,TCPid,{TimeToReport,Scale}}]); List -> List1 = lists:delete({infinity,TCPid,{infinity,false}}, List), - put(test_server_timetraps,[{Handle,TCPid, - {TimeToReport,Scale}}|List1]) + put(test_server_timetraps,[{Handle,TCPid,{TimeToReport,Scale}}|List1]) end, Handle. @@ -1827,9 +1837,7 @@ time_ms(infinity, _, _) -> infinity; time_ms(Fun, TCPid, MultAndScale) when is_function(Fun) -> time_ms_apply(Fun, TCPid, MultAndScale); -time_ms({M,F,A}=MFA, TCPid, MultAndScale) when is_atom(M), - is_atom(F), - is_list(A) -> +time_ms({M,F,A}=MFA, TCPid, MultAndScale) when is_atom(M), is_atom(F), is_list(A) -> time_ms_apply(MFA, TCPid, MultAndScale); time_ms(Other, _, _) -> exit({invalid_time_format,Other}). @@ -1843,7 +1851,7 @@ time_ms_apply(Func, TCPid, MultAndScale) -> {_,GL} = process_info(TCPid, group_leader), WhoAmI = self(), % either TC or IO server - T0 = erlang:monotonic_time(), + T0 = now(), UserTTSup = spawn(fun() -> user_timetrap_supervisor(Func, WhoAmI, TCPid, @@ -1876,8 +1884,7 @@ receive {UserTT,Result} -> demonitor(MonRef, [flush]), - T1 = erlang:monotonic_time(), - Elapsed = erlang:convert_time_unit(T1-T0, native, milli_seconds), + Elapsed = trunc(timer:now_diff(now(), T0) / 1000), try time_ms_check(Result) of TimeVal -> %% this is the new timetrap value to set (return value @@ -1945,7 +1952,7 @@ proplists:delete(TCPid, UserTTs)), proceed; {OtherUserTTSup,OtherStartTime} -> - case OtherStartTime - StartTime of + case timer:now_diff(OtherStartTime, StartTime) of Diff when Diff >= 0 -> ignore; _ -> @@ -2400,8 +2407,9 @@ %% run_on_shielded_node(Fun, CArgs) when is_function(Fun), is_list(CArgs) -> - Nr = erlang:unique_integer([positive]), - Name = "shielded_node-" ++ integer_to_list(Nr), + {A,B,C} = now(), + Name = "shielded_node-" ++ integer_to_list(A) ++ "-" ++ integer_to_list(B) + ++ "-" ++ integer_to_list(C), Node = case start_node(Name, slave, [{args, "-hidden " ++ CArgs}]) of {ok, N} -> N; Err -> fail({failed_to_start_shielded_node, Err}) @@ -2460,8 +2468,9 @@ %% A filename of the form is generated, and the %% function checks that that file doesn't already exist. temp_name(Stem) -> - Num = erlang:unique_integer([positive]), - RandomName = Stem ++ integer_to_list(Num), + {A,B,C} = erlang:now(), + RandomNum = A bxor B bxor C, + RandomName = Stem ++ integer_to_list(RandomNum), {ok,Files} = file:list_dir(filename:dirname(Stem)), case lists:member(RandomName,Files) of true -> @@ -2491,7 +2500,11 @@ %% Checks wether the module is natively compiled or not. is_native(Mod) -> - (catch Mod:module_info(native)) =:= true. + case catch Mod:module_info(native_addresses) of + [_|_] -> true; + _Other -> false + end. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% comment(String) -> ok diff -Nru erlang-18.2-dfsg/lib/test_server/src/test_server_gl.erl erlang-17.3-dfsg/lib/test_server/src/test_server_gl.erl --- erlang-18.2-dfsg/lib/test_server/src/test_server_gl.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/test_server_gl.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/test_server_internal.hrl erlang-17.3-dfsg/lib/test_server/src/test_server_internal.hrl --- erlang-18.2-dfsg/lib/test_server/src/test_server_internal.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/test_server_internal.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/test_server_io.erl erlang-17.3-dfsg/lib/test_server/src/test_server_io.erl --- erlang-18.2-dfsg/lib/test_server/src/test_server_io.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/test_server_io.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/test_server_node.erl erlang-17.3-dfsg/lib/test_server/src/test_server_node.erl --- erlang-18.2-dfsg/lib/test_server/src/test_server_node.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/test_server_node.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2002-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -619,8 +618,9 @@ end. random_element(L) -> - random:seed(os:timestamp()), - lists:nth(random:uniform(length(L)), L). + {A,B,C} = now(), + E = lists:sum([A,B,C]) rem length(L), + lists:nth(E+1, L). find_release(latest) -> "/usr/local/otp/releases/latest/bin/erl"; diff -Nru erlang-18.2-dfsg/lib/test_server/src/test_server_sup.erl erlang-17.3-dfsg/lib/test_server/src/test_server_sup.erl --- erlang-18.2-dfsg/lib/test_server/src/test_server_sup.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/test_server_sup.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1998-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -62,37 +61,33 @@ TruncTO = trunc(Timeout), receive after TruncTO -> - kill_the_process(Pid, Timeout0, TruncTO, ReportTVal) - end. - -kill_the_process(Pid, Timeout0, TruncTO, ReportTVal) -> - case is_process_alive(Pid) of - true -> - TimeToReport = if Timeout0 == ReportTVal -> TruncTO; - true -> ReportTVal end, - MFLs = test_server:get_loc(Pid), - Mon = erlang:monitor(process, Pid), - Trap = {timetrap_timeout,TimeToReport,MFLs}, - exit(Pid, Trap), - receive - {'DOWN', Mon, process, Pid, _} -> + case is_process_alive(Pid) of + true -> + TimeToReport = if Timeout0 == ReportTVal -> TruncTO; + true -> ReportTVal end, + MFLs = test_server:get_loc(Pid), + Mon = erlang:monitor(process, Pid), + Trap = {timetrap_timeout,TimeToReport,MFLs}, + exit(Pid, Trap), + receive + {'DOWN', Mon, process, Pid, _} -> + ok + after 10000 -> + %% Pid is probably trapping exits, hit it harder... + catch error_logger:warning_msg( + "Testcase process ~w not " + "responding to timetrap " + "timeout:~n" + " ~p.~n" + "Killing testcase...~n", + [Pid, Trap]), + exit(Pid, kill) + end; + false -> ok - after 10000 -> - %% Pid is probably trapping exits, hit it harder... - catch error_logger:warning_msg( - "Testcase process ~w not " - "responding to timetrap " - "timeout:~n" - " ~p.~n" - "Killing testcase...~n", - [Pid, Trap]), - exit(Pid, kill) - end; - false -> - ok + end end. - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% timetrap_cancel(Handle) -> ok %% Handle = term() @@ -126,8 +121,14 @@ end. timecall(M, F, A) -> - {Elapsed, Val} = timer:tc(M, F, A), - {Elapsed / 1000000, Val}. + Befor = erlang:now(), + Val = apply(M, F, A), + After = erlang:now(), + Elapsed = + (element(1,After)*1000000+element(2,After)+element(3,After)/1000000)- + (element(1,Befor)*1000000+element(2,Befor)+element(3,Befor)/1000000), + {Elapsed, Val}. + call_crash(Time,Crash,M,F,A) -> @@ -811,19 +812,10 @@ case {lists:member(no_src, get(test_server_logopts)), lists:reverse(ModStr)} of {false,[$E,$T,$I,$U,$S,$_|_]} -> - Link = if is_integer(Line) -> - integer_to_list(Line); - Line == last_expr -> - list_to_atom(atom_to_list(Func)++"-last_expr"); - is_atom(Line) -> - atom_to_list(Line); - true -> - Line - end, - io_lib:format("{~w,~w,~w}", + io_lib:format("{~w,~w,~w}", [Mod,Func, test_server_ctrl:uri_encode(downcase(ModStr)), - ?src_listing_ext,Link,Line]); + ?src_listing_ext,Line,Line]); _ -> io_lib:format("{~w,~w,~w}",[Mod,Func,Line]) end. @@ -882,8 +874,9 @@ util_loop(State) -> receive {From,unique_name} -> - Nr = erlang:unique_integer([positive]), - Name = integer_to_list(Nr), + {_,S,Us} = now(), + Ms = trunc(Us/1000), + Name = lists:flatten(io_lib:format("~w.~w", [S,Ms])), if Name == State#util_state.latest_name -> timer:sleep(1), self() ! {From,unique_name}, diff -Nru erlang-18.2-dfsg/lib/test_server/src/things/distr_startup_SUITE.erl erlang-17.3-dfsg/lib/test_server/src/things/distr_startup_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/src/things/distr_startup_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/things/distr_startup_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/things/mnesia_power_SUITE.erl erlang-17.3-dfsg/lib/test_server/src/things/mnesia_power_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/src/things/mnesia_power_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/things/mnesia_power_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/things/random_kill_SUITE.erl erlang-17.3-dfsg/lib/test_server/src/things/random_kill_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/src/things/random_kill_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/things/random_kill_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/things/verify.erl erlang-17.3-dfsg/lib/test_server/src/things/verify.erl --- erlang-18.2-dfsg/lib/test_server/src/things/verify.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/things/verify.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1996-2009. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/ts_autoconf_win32.erl erlang-17.3-dfsg/lib/test_server/src/ts_autoconf_win32.erl --- erlang-18.2-dfsg/lib/test_server/src/ts_autoconf_win32.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/ts_autoconf_win32.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/ts_benchmark.erl erlang-17.3-dfsg/lib/test_server/src/ts_benchmark.erl --- erlang-18.2-dfsg/lib/test_server/src/ts_benchmark.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/ts_benchmark.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/ts.erl erlang-17.3-dfsg/lib/test_server/src/ts.erl --- erlang-18.2-dfsg/lib/test_server/src/ts.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/ts.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -25,20 +24,15 @@ -module(ts). --export([cl_run/1, - run/0, run/1, run/2, run/3, run/4, run/5, - run_category/1, run_category/2, run_category/3, - tests/0, tests/1, suites/1, categories/1, +-export([run/0, run/1, run/2, run/3, run/4, run/5, + tests/0, tests/1, install/0, install/1, + bench/0, bench/1, bench/2, benchmarks/0, + smoke_test/0, smoke_test/1,smoke_test/2, smoke_tests/0, estone/0, estone/1, cross_cover_analyse/1, compile_testcases/0, compile_testcases/1, help/0]). - -%% Functions kept for backwards compatibility --export([bench/0, bench/1, bench/2, benchmarks/0, - smoke_test/0, smoke_test/1,smoke_test/2, smoke_tests/0]). - -export([i/0, l/1, r/0, r/1, r/2, r/3]). %%%---------------------------------------------------------------------- @@ -88,13 +82,10 @@ -define( install_help, [ - " ts:install()\n", - " Install ts with no options.\n", + " ts:install() - Install TS with no Options.\n" + " ts:install([Options]) - Install TS with Options\n" "\n", - " ts:install(Options)\n", - " Install ts with a list of options, see below.\n", - "\n", - "Installation options supported:\n\n", + "Installation options supported:\n", " {longnames, true} - Use fully qualified hostnames\n", " {verbose, Level} - Sets verbosity level for TS output (0,1,2), 0 is\n" " quiet(default).\n" @@ -119,64 +110,21 @@ end. help(uninstalled) -> - H = ["ts is not yet installed. To install use:\n\n"], + H = ["TS is not installed yet. To install use:\n\n"], show_help([H,?install_help]); help(installed) -> - H = ["\n", - "Run functions:\n\n", - " ts:run()\n", - " Run the tests for all apps. The tests are defined by the\n", - " main test specification for each app: ../App_test/App.spec.\n", - "\n", - " ts:run(Apps)\n", - " Apps = atom() | [atom()]\n", - " Run the tests for an app, or set of apps. The tests are\n", - " defined by the main test specification for each app:\n", - " ../App_test/App.spec.\n", - "\n", - " ts:run(App, Suites)\n", - " App = atom(), Suites = atom() | [atom()]\n", - " Run one or more test suites for App (i.e. modules named\n", - " *_SUITE.erl, located in ../App_test/).\n", - "\n", - " ts:run(App, Suite, TestCases)\n", - " App = atom(), Suite = atom(),\n", - " TestCases = TCs | {testcase,TCs}, TCs = atom() | [atom()]\n", - " Run one or more test cases (functions) in Suite.\n", - "\n", - " ts:run(App, Suite, {group,Groups})\n", - " App = atom(), Suite = atom(), Groups = atom() | [atom()]\n", - " Run one or more test case groups in Suite.\n", - "\n", - " ts:run(App, Suite, {group,Group}, {testcase,TestCases})\n", - " App = atom(), Suite = atom(), Group = atom(),\n", - " TestCases = atom() | [atom()]\n", - " Run one or more test cases in a test case group in Suite.\n", - "\n", - " ts:run_category(TestCategory)\n", - " TestCategory = smoke | essential | bench | atom()\n", - " Run the specified category of tests for all apps.\n", - " For each app, the tests are defined by the specification:\n", - " ../App_test/App_TestCategory.spec.\n", + H = ["Run functions:\n", + " ts:run() - Run all available tests.\n", + " ts:run(Spec) - Run all tests in given test spec file.\n", + " The spec file is actually ../*_test/Spec.spec\n", + " ts:run([Specs]) - Run all tests in all given test spec files.\n", + " ts:run(Spec, Mod) - Run a single test suite.\n", + " ts:run(Spec, Mod, Case)\n", + " - Run a single test case.\n", + " All above run functions can have an additional Options argument\n", + " which is a list of options.\n", "\n", - " ts:run_category(Apps, TestCategory)\n", - " Apps = atom() | [atom()],\n", - " TestCategory = smoke | essential | bench | atom()\n", - " Run the specified category of tests for the given app or apps.\n", - "\n", - " Note that the test category parameter may have arbitrary value,\n", - " but should correspond to an existing test specification with file\n", - " name: ../App_test/App_TestCategory.spec.\n", - " Predefined categories exist for smoke tests, essential tests and\n", - " benchmark tests. The corresponding specs are:\n", - " ../*_test/Spec_smoke.spec, ../*_test/Spec_essential.spec and\n", - " ../*_test/Spec_bench.spec.\n", - "\n", - " All above run functions can take an additional last argument,\n", - " Options, which is a list of options (e.g. ts:run(App, Options),\n", - " or ts:run_category(Apps, TestCategory, Options)).\n", - "\n", - "Run options supported:\n\n", + "Run options supported:\n", " batch - Do not start a new xterm\n", " {verbose, Level} - Same as the verbosity option for install\n", " verbose - Same as {verbose, 1}\n", @@ -195,46 +143,47 @@ " files are. The default location is\n" " tests/test_server/.\n" "\n", - "Supported trace information elements:\n\n", + "Supported trace information elements\n", " {tp | tpl, Mod, [] | match_spec()}\n", " {tp | tpl, Mod, Func, [] | match_spec()}\n", " {tp | tpl, Mod, Func, Arity, [] | match_spec()}\n", " {ctp | ctpl, Mod}\n", " {ctp | ctpl, Mod, Func}\n", " {ctp | ctpl, Mod, Func, Arity}\n", - "\n\n", - "Support functions:\n\n", - " ts:tests()\n", - " Returns all apps available for testing.\n", - "\n", - " ts:tests(TestCategory)\n", - " Returns all apps that provide tests in the given category.\n", - "\n", - " ts:suites(App)\n", - " Returns all available test suites for App,\n", - " i.e. ../App_test/*_SUITE.erl\n", "\n", - " ts:categories(App)\n", - " Returns all test categories available for App.\n", - "\n", - " ts:estone()\n", - " Runs estone_SUITE in the kernel application with no run options\n", - "\n", - " ts:estone(Opts)\n", - " Runs estone_SUITE in the kernel application with the given\n", - " run options\n", - "\n", - " ts:cross_cover_analyse(Level)\n", - " Use after ts:run with option cover or cover_details. Analyses\n", - " modules specified with a 'cross' statement in the cover spec file.\n", - " Level can be 'overview' or 'details'.\n", - "\n", - " ts:compile_testcases()\n", - " ts:compile_testcases(Apps)\n", - " Compiles all test cases for the given apps, for usage in a\n", - " cross compilation environment.\n", - "\n\n", - "Installation (already done):\n\n" + "Support functions:\n", + " ts:tests() - Shows all available families of tests.\n", + " ts:tests(Spec) - Shows all available test modules in Spec,\n", + " i.e. ../Spec_test/*_SUITE.erl\n", + " ts:estone() - Run estone_SUITE in kernel application with\n" + " no run options\n", + " ts:estone(Opts) - Run estone_SUITE in kernel application with\n" + " the given run options\n", + " ts:cross_cover_analyse(Level)\n" + " - Used after ts:run with option cover or \n" + " cover_details. Analyses modules specified with\n" + " a 'cross' statement in the cover spec file.\n" + " Level can be 'overview' or 'details'.\n", + " ts:compile_testcases()~n" + " ts:compile_testcases(Apps)~n" + " - Compile all testcases for usage in a cross ~n" + " compile environment." + " \n" + "Benchmark functions:\n" + " ts:benchmarks() - Get all available families of benchmarks\n" + " ts:bench() - Runs all benchmarks\n" + " ts:bench(Spec) - Runs all benchmarks in the given spec file.\n" + " The spec file is actually ../*_test/Spec_bench.spec\n\n" + " ts:bench can take the same Options argument as ts:run.\n" + "Smoke test functions:\n" + " ts:smoke_tests() - Get all available families of smoke tests\n" + " ts:smoke_test() - Runs all smoke tests\n" + " ts:smoke_test(Spec)\n" + " - Runs all smoke tests in the given spec file.\n" + " The spec file is actually ../*_test/Spec_smoke.spec\n\n" + " ts:smoke_test can take the same Options argument as ts:run.\n" + "\n" + "Installation (already done):\n" ], show_help([H,?install_help]). @@ -263,138 +212,86 @@ run_some([], _Opts) -> ok; -run_some(Apps, Opts) -> - case proplists:get_value(test_category, Opts) of - bench -> - check_and_run(fun(Vars) -> ts_benchmark:run(Apps, Opts, Vars) end); - _Other -> - run_some1(Apps, Opts) - end. - -run_some1([], _Opts) -> - ok; -run_some1([{App,Mod}|Apps], Opts) -> - case run(App, Mod, Opts) of +run_some([{Spec,Mod}|Specs], Opts) -> + case run(Spec, Mod, Opts) of ok -> ok; - Error -> io:format("~p: ~p~n",[{App,Mod},Error]) + Error -> io:format("~p: ~p~n",[{Spec,Mod},Error]) end, - run_some1(Apps, Opts); -run_some1([App|Apps], Opts) -> - case run(App, Opts) of + run_some(Specs, Opts); +run_some([Spec|Specs], Opts) -> + case run(Spec, Opts) of ok -> ok; - Error -> io:format("~p: ~p~n",[App,Error]) + Error -> io:format("~p: ~p~n",[Spec,Error]) end, - run_some1(Apps, Opts). + run_some(Specs, Opts). -%% This can be used from command line. Both App and -%% TestCategory must be specified. App may be 'all' -%% and TestCategory may be 'main'. Examples: -%% erl -s ts cl_run kernel smoke -%% erl -s ts cl_run kernel main -%% erl -s ts cl_run all essential -%% erl -s ts cl_run all main -%% When using the 'main' category and running with cover, -%% one can also use the cross_cover_analysis flag. -cl_run([App,Cat|Options0]) when is_atom(App) -> +%% Runs one test spec (interactive). +run(Testspec) when is_atom(Testspec) -> + Options=check_test_get_opts(Testspec, []), + File = atom_to_list(Testspec), + run_test(File, [{spec,[File++".spec"]}], Options); +%% This can be used from command line, e.g. +%% erl -s ts run all_tests +%% When using the all_tests flag and running with cover, one can also +%% use the cross_cover_analysis flag. +run([all_tests|Config0]) -> AllAtomsFun = fun(X) when is_atom(X) -> true; (_) -> false end, - Options1 = - case lists:all(AllAtomsFun, Options0) of + Config1 = + case lists:all(AllAtomsFun,Config0) of true -> %% Could be from command line - lists:map(fun(Opt) -> - to_erlang_term(Opt) - end, Options0) -- [batch]; + lists:map(fun(Conf)->to_erlang_term(Conf) end,Config0)--[batch]; false -> - Options0 -- [batch] + Config0--[batch] end, %% Make sure there is exactly one occurence of 'batch' - Options2 = [batch|Options1], + Config2 = [batch|Config1], - Result = - case {App,Cat} of - {all,main} -> - run(tests(), Options2); - {all,Cat} -> - run_category(Cat, Options2); - {_,main} -> - run(App, Options2); - {_,Cat} -> - run_category(App, Cat, Options2) - end, - case check_for_cross_cover_analysis_flag(Options2) of + R = run(tests(),Config2), + + case check_for_cross_cover_analysis_flag(Config2) of false -> ok; Level -> cross_cover_analyse(Level) end, - Result. -%% run/1 -%% Runs tests for one app (interactive). -run(App) when is_atom(App) -> - Options = check_test_get_opts(App, []), - File = atom_to_list(App), - run_test(File, [{spec,[File++".spec"]},{allow_user_terms,true}], Options); + R; -%% This can be used from command line, e.g. -%% erl -s ts run all -%% erl -s ts run main -run([all,main|Opts]) -> - cl_run([all,main|Opts]); -run([all|Opts]) -> - cl_run([all,main|Opts]); -run([main|Opts]) -> - cl_run([all,main|Opts]); -%% Backwards compatible -run([all_tests|Opts]) -> - cl_run([all,main|Opts]); - -%% run/1 -%% Runs the main tests for all available apps -run(Apps) when is_list(Apps) -> - run(Apps, [batch]). +%% ts:run(ListOfTests) +run(List) when is_list(List) -> + run(List, [batch]). + +run(List, Opts) when is_list(List), is_list(Opts) -> + run_some(List, Opts); %% run/2 -%% Runs the main tests for all available apps -run(Apps, Opts) when is_list(Apps), is_list(Opts) -> - run_some(Apps, Opts); - -%% Runs tests for one app with list of suites or with options -run(App, ModsOrOpts) when is_atom(App), - is_list(ModsOrOpts) -> - case is_list_of_suites(ModsOrOpts) of +%% Runs one test spec with list of suites or with options +run(Testspec, ModsOrConfig) when is_atom(Testspec), + is_list(ModsOrConfig) -> + case is_list_of_suites(ModsOrConfig) of false -> - run(App, {opts_list,ModsOrOpts}); + run(Testspec, {config_list,ModsOrConfig}); true -> - run_some([{App,M} || M <- ModsOrOpts], + run_some([{Testspec,M} || M <- ModsOrConfig], [batch]) end; - -run(App, {opts_list,Opts}) -> - Options = check_test_get_opts(App, Opts), - File = atom_to_list(App), - - %% check if other test category than main has been specified - {CatSpecName,TestCat} = - case proplists:get_value(test_category, Opts) of - undefined -> - {"",main}; - Cat -> - {"_" ++ atom_to_list(Cat),Cat} - end, - +run(Testspec, {config_list,Config}) -> + Options=check_test_get_opts(Testspec, Config), + IsSmoke=proplists:get_value(smoke,Config), + File=atom_to_list(Testspec), WhatToDo = - case App of + case Testspec of %% Known to exist but fails generic tests below emulator -> test; system -> test; erl_interface -> test; epmd -> test; _ -> - case code:lib_dir(App) of + case code:lib_dir(Testspec) of {error,bad_name} -> %% Application does not exist skip; @@ -416,167 +313,92 @@ end end end, - case WhatToDo of - skip -> - SkipSpec = create_skip_spec(App, suites(App)), - run_test(File, [{spec,[SkipSpec]}], Options); - test when TestCat == bench -> - check_and_run(fun(Vars) -> - ts_benchmark:run([App], Options, Vars) - end); - test -> - Spec = File ++ CatSpecName ++ ".spec", - run_test(File, [{spec,[Spec]},{allow_user_terms,true}], Options) - end; - -%% Runs one module for an app (interactive) -run(App, Mod) when is_atom(App), is_atom(Mod) -> - run_test({atom_to_list(App),Mod}, + Spec = + case WhatToDo of + skip -> + create_skip_spec(Testspec, tests(Testspec)); + test when IsSmoke -> + File++"_smoke.spec"; + test -> + File++".spec" + end, + run_test(File, [{spec,[Spec]}], Options); +%% Runs one module in a spec (interactive) +run(Testspec, Mod) when is_atom(Testspec), is_atom(Mod) -> + run_test({atom_to_list(Testspec),Mod}, [{suite,Mod}], [interactive]). %% run/3 -%% Run one module for an app with Opts -run(App, Mod, Opts) when is_atom(App), - is_atom(Mod), - is_list(Opts) -> - Options = check_test_get_opts(App, Opts), - run_test({atom_to_list(App),Mod}, +%% Run one module in a spec with Config +run(Testspec, Mod, Config) when is_atom(Testspec), + is_atom(Mod), + is_list(Config) -> + Options=check_test_get_opts(Testspec, Config), + run_test({atom_to_list(Testspec),Mod}, [{suite,Mod}], Options); - -%% Run multiple modules with Opts -run(App, Mods, Opts) when is_atom(App), - is_list(Mods), - is_list(Opts) -> - run_some([{App,M} || M <- Mods], Opts); - +%% Run multiple modules with Config +run(Testspec, Mods, Config) when is_atom(Testspec), + is_list(Mods), + is_list(Config) -> + run_some([{Testspec,M} || M <- Mods], Config); %% Runs one test case in a module. -run(App, Mod, Case) when is_atom(App), - is_atom(Mod), - is_atom(Case) -> - Options = check_test_get_opts(App, []), +run(Testspec, Mod, Case) when is_atom(Testspec), + is_atom(Mod), + is_atom(Case) -> + Options=check_test_get_opts(Testspec, []), Args = [{suite,Mod},{testcase,Case}], - run_test(atom_to_list(App), Args, Options); - + run_test(atom_to_list(Testspec), Args, Options); %% Runs one or more groups in a module. -run(App, Mod, Grs={group,_Groups}) when is_atom(App), - is_atom(Mod) -> - Options = check_test_get_opts(App, []), +run(Testspec, Mod, Grs={group,_Groups}) when is_atom(Testspec), + is_atom(Mod) -> + Options=check_test_get_opts(Testspec, []), Args = [{suite,Mod},Grs], - run_test(atom_to_list(App), Args, Options); - + run_test(atom_to_list(Testspec), Args, Options); %% Runs one or more test cases in a module. -run(App, Mod, TCs={testcase,_Cases}) when is_atom(App), - is_atom(Mod) -> - Options = check_test_get_opts(App, []), +run(Testspec, Mod, TCs={testcase,_Cases}) when is_atom(Testspec), + is_atom(Mod) -> + Options=check_test_get_opts(Testspec, []), Args = [{suite,Mod},TCs], - run_test(atom_to_list(App), Args, Options). + run_test(atom_to_list(Testspec), Args, Options). %% run/4 %% Run one test case in a module with Options. -run(App, Mod, Case, Opts) when is_atom(App), - is_atom(Mod), - is_atom(Case), - is_list(Opts) -> - Options = check_test_get_opts(App, Opts), +run(Testspec, Mod, Case, Config) when is_atom(Testspec), + is_atom(Mod), + is_atom(Case), + is_list(Config) -> + Options=check_test_get_opts(Testspec, Config), Args = [{suite,Mod},{testcase,Case}], - run_test(atom_to_list(App), Args, Options); - + run_test(atom_to_list(Testspec), Args, Options); %% Run one or more test cases in a module with Options. -run(App, Mod, {testcase,Cases}, Opts) when is_atom(App), - is_atom(Mod) -> - run(App, Mod, Cases, Opts); -run(App, Mod, Cases, Opts) when is_atom(App), - is_atom(Mod), - is_list(Cases), - is_list(Opts) -> - Options = check_test_get_opts(App, Opts), +run(Testspec, Mod, {testcase,Cases}, Config) when is_atom(Testspec), + is_atom(Mod) -> + run(Testspec, Mod, Cases, Config); +run(Testspec, Mod, Cases, Config) when is_atom(Testspec), + is_atom(Mod), + is_list(Cases), + is_list(Config) -> + Options=check_test_get_opts(Testspec, Config), Args = [{suite,Mod},Cases], - run_test(atom_to_list(App), Args, Options); - -%% Run one or more test cases in a group. -run(App, Mod, Gr={group,_Group}, {testcase,Cases}) when is_atom(App), - is_atom(Mod) -> - run(App, Mod, Gr, Cases, [batch]); - - + run_test(atom_to_list(Testspec), Args, Options); %% Run one or more groups in a module with Options. -run(App, Mod, Grs={group,_Groups}, Opts) when is_atom(App), - is_atom(Mod), - is_list(Opts) -> - Options = check_test_get_opts(App, Opts), +run(Testspec, Mod, Grs={group,_Groups}, Config) when is_atom(Testspec), + is_atom(Mod) -> + Options=check_test_get_opts(Testspec, Config), Args = [{suite,Mod},Grs], - run_test(atom_to_list(App), Args, Options). + run_test(atom_to_list(Testspec), Args, Options). %% run/5 %% Run one or more test cases in a group with Options. -run(App, Mod, Group, Cases, Opts) when is_atom(App), - is_atom(Mod), - is_list(Opts) -> +run(Testspec, Mod, Group, Cases, Config) when is_atom(Testspec), + is_atom(Mod), + is_list(Config) -> Group1 = if is_tuple(Group) -> Group; true -> {group,Group} end, Cases1 = if is_tuple(Cases) -> Cases; true -> {testcase,Cases} end, - Options = check_test_get_opts(App, Opts), + Options=check_test_get_opts(Testspec, Config), Args = [{suite,Mod},Group1,Cases1], - run_test(atom_to_list(App), Args, Options). - -%% run_category/1 -run_category(TestCategory) when is_atom(TestCategory) -> - run_category(TestCategory, [batch]). - -%% run_category/2 -run_category(TestCategory, Opts) when is_atom(TestCategory), - is_list(Opts) -> - case ts:tests(TestCategory) of - [] -> - {error, no_tests_available}; - Apps -> - Opts1 = [{test_category,TestCategory} | Opts], - run_some(Apps, Opts1) - end; - -run_category(Apps, TestCategory) when is_atom(TestCategory) -> - run_category(Apps, TestCategory, [batch]). - -%% run_category/3 -run_category(App, TestCategory, Opts) -> - Apps = if is_atom(App) -> [App]; - is_list(App) -> App - end, - Opts1 = [{test_category,TestCategory} | Opts], - run_some(Apps, Opts1). - -%%----------------------------------------------------------------- -%% Functions kept for backwards compatibility - -bench() -> - run_category(bench, []). -bench(Opts) when is_list(Opts) -> - run_category(bench, Opts); -bench(App) -> - run_category(App, bench, []). -bench(App, Opts) when is_atom(App) -> - run_category(App, bench, Opts); -bench(Apps, Opts) when is_list(Apps) -> - run_category(Apps, bench, Opts). - -benchmarks() -> - tests(bench). - -smoke_test() -> - run_category(smoke, []). -smoke_test(Opts) when is_list(Opts) -> - run_category(smoke, Opts); -smoke_test(App) -> - run_category(App, smoke, []). -smoke_test(App, Opts) when is_atom(App) -> - run_category(App, smoke, Opts); -smoke_test(Apps, Opts) when is_list(Apps) -> - run_category(Apps, smoke, Opts). - -smoke_tests() -> - tests(smoke). - -%%----------------------------------------------------------------- + run_test(atom_to_list(Testspec), Args, Options). is_list_of_suites(List) -> lists:all(fun(Suite) -> @@ -594,29 +416,29 @@ %% Create a spec to skip all SUITES, this is used when the application %% to be tested is not part of the OTP release to be tested. -create_skip_spec(App, SuitesToSkip) -> +create_skip_spec(Testspec, SuitesToSkip) -> {ok,Cwd} = file:get_cwd(), - AppString = atom_to_list(App), - Specname = AppString++"_skip.spec", + TestspecString = atom_to_list(Testspec), + Specname = TestspecString++"_skip.spec", {ok,D} = file:open(filename:join([filename:dirname(Cwd), - AppString++"_test",Specname]), + TestspecString++"_test",Specname]), [write]), - TestDir = "\"../"++AppString++"_test\"", + TestDir = "\"../"++TestspecString++"_test\"", io:format(D,"{suites, "++TestDir++", all}.~n",[]), io:format(D,"{skip_suites, "++TestDir++", ~w, \"Skipped as application" " is not in path!\"}.",[SuitesToSkip]), Specname. -%% Check testspec for App to be valid and get possible options -%% from the list. -check_test_get_opts(App, Opts) -> - validate_test(App), - Mode = configmember(batch, {batch, interactive}, Opts), - Vars = configvars(Opts), - Trace = get_config(trace,Opts), - ConfigPath = get_config(config,Opts), - KeepTopcase = configmember(keep_topcase, {keep_topcase,[]}, Opts), - Cover = configcover(App,Opts), +%% Check testspec to be valid and get possible Options +%% from the config. +check_test_get_opts(Testspec, Config) -> + validate_test(Testspec), + Mode = configmember(batch, {batch, interactive}, Config), + Vars = configvars(Config), + Trace = get_config(trace,Config), + ConfigPath = get_config(config,Config), + KeepTopcase = configmember(keep_topcase, {keep_topcase,[]}, Config), + Cover = configcover(Testspec,Config), lists:flatten([Vars,Mode,Trace,KeepTopcase,Cover,ConfigPath]). to_erlang_term(Atom) -> @@ -625,7 +447,7 @@ {ok, Term} = erl_parse:parse_term(Tokens), Term. -%% Validate that Testspec really is a testspec, +%% Validate that a Testspec really is a testspec, %% and exit if not. validate_test(Testspec) -> case lists:member(Testspec, tests()) of @@ -638,10 +460,10 @@ exit(self(), {error, test_not_available}) end. -configvars(Opts) -> - case lists:keysearch(vars, 1, Opts) of +configvars(Config) -> + case lists:keysearch(vars, 1, Config) of {value, {vars, List}} -> - List0 = special_vars(Opts), + List0 = special_vars(Config), Key = fun(T) -> element(1,T) end, DelDupList = lists:filter(fun(V) -> @@ -652,17 +474,17 @@ end, List), {vars, [List0|DelDupList]}; _ -> - {vars, special_vars(Opts)} + {vars, special_vars(Config)} end. -%% Allow some shortcuts in the options... -special_vars(Opts) -> +%% Allow some shortcuts in the Options... +special_vars(Config) -> SpecVars = - case lists:member(verbose, Opts) of + case lists:member(verbose, Config) of true -> [{verbose, 1}]; false -> - case lists:keysearch(verbose, 1, Opts) of + case lists:keysearch(verbose, 1, Config) of {value, {verbose, Lvl}} -> [{verbose, Lvl}]; _ -> @@ -670,13 +492,13 @@ end end, SpecVars1 = - case lists:keysearch(diskless, 1, Opts) of + case lists:keysearch(diskless, 1, Config) of {value,{diskless, true}} -> [{diskless, true} | SpecVars]; _ -> SpecVars end, - case lists:keysearch(testcase_callback, 1, Opts) of + case lists:keysearch(testcase_callback, 1, Config) of {value,{testcase_callback, CBM, CBF}} -> [{ts_testcase_callback, {CBM,CBF}} | SpecVars1]; {value,{testcase_callback, CB}} -> @@ -744,31 +566,50 @@ check_for_cross_cover_analysis_flag([],_,_) -> false. +%% Returns a list of available test suites. -%% Returns all available apps. tests() -> {ok, Cwd} = file:get_cwd(), ts_lib:specs(Cwd). -%% Returns all apps that provide tests in the given test category -tests(main) -> - {ok, Cwd} = file:get_cwd(), - ts_lib:specs(Cwd); -tests(bench) -> - ts_benchmark:benchmarks(); -tests(TestCategory) -> +tests(Spec) -> {ok, Cwd} = file:get_cwd(), - ts_lib:specialized_specs(Cwd, atom_to_list(TestCategory)). - -%% Returns a list of available test suites for App. -suites(App) -> - {ok, Cwd} = file:get_cwd(), - ts_lib:suites(Cwd, atom_to_list(App)). + ts_lib:suites(Cwd, atom_to_list(Spec)). + +%% Benchmark related functions + +bench() -> + bench([]). -%% Returns all available test categories for App -categories(App) -> +bench(Opts) when is_list(Opts) -> + bench(benchmarks(),Opts); +bench(Spec) -> + bench([Spec],[]). + +bench(Spec, Opts) when is_atom(Spec) -> + bench([Spec],Opts); +bench(Specs, Opts) -> + check_and_run(fun(Vars) -> ts_benchmark:run(Specs, Opts, Vars) end). + +benchmarks() -> + ts_benchmark:benchmarks(). + +smoke_test() -> + smoke_test([]). + +smoke_test(Opts) when is_list(Opts) -> + smoke_test(smoke_tests(),Opts); +smoke_test(Spec) -> + smoke_test([Spec],[]). + +smoke_test(Spec, Opts) when is_atom(Spec) -> + smoke_test([Spec],Opts); +smoke_test(Specs, Opts) -> + run(Specs, [{smoke,true}|Opts]). + +smoke_tests() -> {ok, Cwd} = file:get_cwd(), - ts_lib:test_categories(Cwd, atom_to_list(App)). + ts_lib:specialized_specs(Cwd,"smoke"). %% %% estone/0, estone/1 diff -Nru erlang-18.2-dfsg/lib/test_server/src/ts_erl_config.erl erlang-17.3-dfsg/lib/test_server/src/ts_erl_config.erl --- erlang-18.2-dfsg/lib/test_server/src/ts_erl_config.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/ts_erl_config.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/ts.hrl erlang-17.3-dfsg/lib/test_server/src/ts.hrl --- erlang-18.2-dfsg/lib/test_server/src/ts.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/ts.hrl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/src/ts_install_cth.erl erlang-17.3-dfsg/lib/test_server/src/ts_install_cth.erl --- erlang-18.2-dfsg/lib/test_server/src/ts_install_cth.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/ts_install_cth.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -239,15 +238,12 @@ Acc; generate_nodenames2(N, Hosts, Acc) -> Host=lists:nth((N rem (length(Hosts)))+1, Hosts), - Name=list_to_atom(temp_nodename("nod",N) ++ "@" ++ Host), + Name=list_to_atom(temp_nodename("nod", []) ++ "@" ++ Host), generate_nodenames2(N-1, Hosts, [Name|Acc]). -%% We cannot use erlang:unique_integer([positive]) -%% here since this code in run on older test releases as well. -temp_nodename(Base,I) -> - {A,B,C} = os:timestamp(), - Nstr = integer_to_list(I), - Astr = integer_to_list(A), - Bstr = integer_to_list(B), - Cstr = integer_to_list(C), - Base++Nstr++Astr++Bstr++Cstr. +temp_nodename([], Acc) -> + lists:flatten(Acc); +temp_nodename([Chr|Base], Acc) -> + {A,B,C} = erlang:now(), + New = [Chr | integer_to_list(Chr bxor A bxor B+A bxor C+B)], + temp_nodename(Base, [New|Acc]). diff -Nru erlang-18.2-dfsg/lib/test_server/src/ts_install.erl erlang-17.3-dfsg/lib/test_server/src/ts_install.erl --- erlang-18.2-dfsg/lib/test_server/src/ts_install.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/ts_install.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,22 +3,22 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% -module(ts_install). + -export([install/2, platform_id/1]). -include("ts.hrl"). @@ -135,63 +135,15 @@ case filelib:is_file(Configure) of true -> OSXEnv = macosx_cflags(), - UnQuotedEnv = assign_vars(unquote(Env++OSXEnv)), io:format("Running ~s~nEnv: ~p~n", - [lists:flatten(Configure ++ Args),UnQuotedEnv]), + [lists:flatten(Configure ++ Args),Env++OSXEnv]), Port = open_port({spawn, lists:flatten(["\"",Configure,"\"",Args])}, - [stream, eof, {env,UnQuotedEnv}]), + [stream, eof, {env,Env++OSXEnv}]), ts_lib:print_data(Port); false -> {error, no_configure_script} end. -unquote([{Var,Val}|T]) -> - [{Var,unquote(Val)}|unquote(T)]; -unquote([]) -> - []; -unquote("\""++Rest) -> - lists:reverse(tl(lists:reverse(Rest))); -unquote(String) -> - String. - -assign_vars([]) -> - []; -assign_vars([{VAR,FlagsStr} | VARs]) -> - [{VAR,assign_vars(FlagsStr)} | assign_vars(VARs)]; -assign_vars(FlagsStr) -> - Flags = [assign_all_vars(Str,[]) || Str <- string:tokens(FlagsStr, [$ ])], - string:strip(lists:flatten(lists:map(fun(Flag) -> - Flag ++ " " - end, Flags)), right). - -assign_all_vars([$$ | Rest], FlagSoFar) -> - {VarName,Rest1} = get_var_name(Rest, []), - assign_all_vars(Rest1, FlagSoFar ++ assign_var(VarName)); -assign_all_vars([Char | Rest], FlagSoFar) -> - assign_all_vars(Rest, FlagSoFar ++ [Char]); -assign_all_vars([], Flag) -> - Flag. - -get_var_name([Ch | Rest] = Str, VarR) -> - case valid_char(Ch) of - true -> get_var_name(Rest, [Ch | VarR]); - false -> {lists:reverse(VarR),Str} - end; -get_var_name([], VarR) -> - {lists:reverse(VarR),[]}. - -assign_var(VarName) -> - case os:getenv(VarName) of - false -> ""; - Val -> Val - end. - -valid_char(Ch) when Ch >= $a, Ch =< $z -> true; -valid_char(Ch) when Ch >= $A, Ch =< $Z -> true; -valid_char(Ch) when Ch >= $0, Ch =< $9 -> true; -valid_char($_) -> true; -valid_char(_) -> false. - get_xcomp_flag(Flag, Flags) -> get_xcomp_flag(Flag, Flag, Flags). get_xcomp_flag(Flag, Tag, Flags) -> diff -Nru erlang-18.2-dfsg/lib/test_server/src/ts_lib.erl erlang-17.3-dfsg/lib/test_server/src/ts_lib.erl --- erlang-18.2-dfsg/lib/test_server/src/ts_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/ts_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -28,7 +27,7 @@ erlang_type/1, initial_capital/1, specs/1, suites/2, - test_categories/2, specialized_specs/2, + specialized_specs/2, subst_file/3, subst/2, print_data/1, make_non_erlang/2, maybe_atom_to_list/1, progress/4, @@ -97,47 +96,26 @@ Specs = filelib:wildcard(filename:join([filename:dirname(Dir), "*_test", "*_"++PostFix++".spec"])), sort_tests([begin - DirPart = filename:dirname(Name), - AppTest = hd(lists:reverse(filename:split(DirPart))), - list_to_atom(string:substr(AppTest, 1, length(AppTest)-5)) + Base = filename:basename(Name), + list_to_atom(string:substr(Base,1,string:rstr(Base,"_")-1)) end || Name <- Specs]). specs(Dir) -> Specs = filelib:wildcard(filename:join([filename:dirname(Dir), "*_test", "*.{dyn,}spec"])), - %% Make sure only to include the main spec for each application - MainSpecs = - lists:flatmap(fun(FullName) -> - [Spec,TestDir|_] = - lists:reverse(filename:split(FullName)), - [_TestSuffix|TDParts] = - lists:reverse(string:tokens(TestDir,[$_,$.])), - [_SpecSuffix|SParts] = - lists:reverse(string:tokens(Spec,[$_,$.])), - if TDParts == SParts -> - [filename_to_atom(FullName)]; - true -> - [] - end - end, Specs), - sort_tests(MainSpecs). + % Filter away all spec which end with {_bench,_smoke}.spec + NoBench = fun(SpecName) -> + case lists:reverse(SpecName) of + "ceps.hcneb_"++_ -> false; + "ceps.ekoms_"++_ -> false; + _ -> true + end + end, -test_categories(Dir, App) -> - Specs = filelib:wildcard(filename:join([filename:dirname(Dir), - App++"_test", "*.spec"])), - lists:flatmap(fun(FullName) -> - [Spec,_TestDir|_] = - lists:reverse(filename:split(FullName)), - case filename:rootname(Spec -- App) of - "" -> - []; - [_Sep | Cat] -> - [list_to_atom(Cat)] - end - end, Specs). + sort_tests([filename_to_atom(Name) || Name <- Specs, NoBench(Name)]). -suites(Dir, App) -> - Glob=filename:join([filename:dirname(Dir), App++"_test", +suites(Dir, Spec) -> + Glob=filename:join([filename:dirname(Dir), Spec++"_test", "*_SUITE.erl"]), Suites=filelib:wildcard(Glob), [filename_to_atom(Name) || Name <- Suites]. @@ -250,10 +228,12 @@ {Result,Comment,Rest2}. %% extract an argument +get_arg([$ |Rest], Vars, Stop, Acc) -> + get_arg(Rest, Vars, Stop, Acc); get_arg([$(|Rest], Vars, Stop, _) -> get_arg(Rest, Vars, Stop, []); get_arg([Stop|Rest], Vars, Stop, Acc) -> - Arg = string:strip(lists:reverse(Acc)), + Arg = lists:reverse(Acc), Subst = subst(Arg, Vars), {Subst,Rest}; get_arg([C|Rest], Vars, Stop, Acc) -> diff -Nru erlang-18.2-dfsg/lib/test_server/src/ts_make.erl erlang-17.3-dfsg/lib/test_server/src/ts_make.erl --- erlang-18.2-dfsg/lib/test_server/src/ts_make.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/ts_make.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -68,17 +67,7 @@ end. update_last([C|Rest], Line, true) -> - try - %% Utf-8 list to utf-8 binary - %% (e.g. we assume utf-8 bytes from port) - io:put_chars(list_to_binary(Line)) - catch - error:badarg -> - %% io:put_chars/1 badarged - %% this likely means we had unicode code points - %% in our bytes buffer (e.g warning from gcc with åäö) - io:put_chars(unicode:characters_to_binary(Line)) - end, + io:put_chars(list_to_binary(Line)), %% Utf-8 list to utf-8 binary io:nl(), update_last([C|Rest], [], false); update_last([$\r|Rest], Result, Complete) -> diff -Nru erlang-18.2-dfsg/lib/test_server/src/ts_run.erl erlang-17.3-dfsg/lib/test_server/src/ts_run.erl --- erlang-18.2-dfsg/lib/test_server/src/ts_run.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/src/ts_run.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/erl2html2_SUITE_data/include/header3.hrl erlang-17.3-dfsg/lib/test_server/test/erl2html2_SUITE_data/include/header3.hrl --- erlang-18.2-dfsg/lib/test_server/test/erl2html2_SUITE_data/include/header3.hrl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/erl2html2_SUITE_data/include/header3.hrl 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ --define(EPP_SWITCH, on). diff -Nru erlang-18.2-dfsg/lib/test_server/test/erl2html2_SUITE_data/m1.erl erlang-17.3-dfsg/lib/test_server/test/erl2html2_SUITE_data/m1.erl --- erlang-18.2-dfsg/lib/test_server/test/erl2html2_SUITE_data/m1.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/erl2html2_SUITE_data/m1.erl 2014-09-16 19:10:57.000000000 +0000 @@ -7,15 +7,9 @@ -include("header1.hrl"). -include("header2.hrl"). --include("header3.hrl"). -define(MACRO1,value). -%% This macro is used to select parser in erl2html2. -%% If EPP_SWITCH is defined epp is used, else epp_dodger. -epp_switch() -> - ?EPP_SWITCH. - %%% Comment foo(x) -> %% Comment diff -Nru erlang-18.2-dfsg/lib/test_server/test/erl2html2_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/erl2html2_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/erl2html2_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/erl2html2_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. %% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% @@ -131,7 +130,15 @@ %% @end %%-------------------------------------------------------------------- all() -> - [macros_defined, macros_undefined]. + [m1]. + +%%-------------------------------------------------------------------- +%% @spec TestCase() -> Info +%% Info = [tuple()] +%% @end +%%-------------------------------------------------------------------- +m1() -> + []. %%-------------------------------------------------------------------- %% @spec TestCase(Config0) -> @@ -142,29 +149,19 @@ %% Comment = term() %% @end %%-------------------------------------------------------------------- -macros_defined(Config) -> - %% let erl2html2 use epp as parser - DataDir = ?config(data_dir,Config), - InclDir = filename:join(DataDir, "include"), - {Src,Dst} = convert_module("m1",[InclDir],Config), - {true,L} = check_line_numbers(Src,Dst), - ok = check_link_targets(Src,Dst,L,[{baz,0}],[]), - ok. - -macros_undefined(Config) -> - %% let erl2html2 use epp_dodger as parser - {Src,Dst} = convert_module("m1",[],Config), +m1(Config) -> + {Src,Dst} = convert_module("m1",Config), {true,L} = check_line_numbers(Src,Dst), - ok = check_link_targets(Src,Dst,L,[{baz,0}],[{quux,0}]), + ok = check_link_targets(Src,Dst,L,[{baz,0}]), ok. -convert_module(Mod,InclDirs,Config) -> +convert_module(Mod,Config) -> DataDir = ?config(data_dir,Config), PrivDir = ?config(priv_dir,Config), Src = filename:join(DataDir,Mod++".erl"), Dst = filename:join(PrivDir,Mod++".erl.html"), io:format("~s\n",[Src,filename:basename(Src)]), - ok = erl2html2:convert(Src, Dst, InclDirs, ""), + ok = erl2html2:convert(Src, Dst, ""), io:format("~s\n",[Dst,filename:basename(Dst)]), {Src,Dst}. @@ -232,46 +229,36 @@ %% function. %% The test module has -compile(export_all), so all functions are %% found by listing the exported ones. -check_link_targets(Src,Dst,L,RmFncs,ShouldRemain) -> +check_link_targets(Src,Dst,L,RmFncs) -> Mod = list_to_atom(filename:basename(filename:rootname(Src))), Exports = Mod:module_info(exports)--[{module_info,0},{module_info,1}|RmFncs], - LastExprFuncs = [Func || {Func,_A} <- Exports], - {ok,{FAs,Fs,L},_} = - xmerl_sax_parser:file(Dst, - [{event_fun,fun sax_event/3}, - {event_state,{Exports,LastExprFuncs,0}}]), - true = (length(FAs) == length(ShouldRemain)), - [] = [FA || FA <- FAs, not lists:member(FA,ShouldRemain)], - [] = [F || F <- Fs, not lists:keymember(F,1,ShouldRemain)], + {ok,{[],L},_} = xmerl_sax_parser:file(Dst, + [{event_fun,fun sax_event/3}, + {event_state,{Exports,0}}]), ok. sax_event(Event,_Loc,State) -> sax_event(Event,State). -sax_event({startElement,_Uri,"a",_QN,Attrs},{Exports,LastExprFuncs,PrevLine}) -> +sax_event({startElement,_Uri,"a",_QN,Attrs},{Exports,PrevLine}) -> {_,_,"name",Name} = lists:keyfind("name",3,Attrs), case catch list_to_integer(Name) of Line when is_integer(Line) -> case PrevLine + 1 of Line -> - {Exports,LastExprFuncs,Line}; +% erlang:display({found_line,Line}), + {Exports,Line}; Other -> ct:fail({unexpected_line_number_target,Other}) end; {'EXIT',_} -> - {match,[FStr,EndStr]} = - re:run(Name,"^(.*)-(last_expr|[0-9]+)$", - [{capture,all_but_first,list}]), + {match,[FStr,AStr]} = + re:run(Name,"^(.*)-([0-9]+)$",[{capture,all_but_first,list}]), F = list_to_atom(http_uri:decode(FStr)), - case EndStr of - "last_expr" -> - true = lists:member(F,LastExprFuncs), - {Exports,lists:delete(F,LastExprFuncs),PrevLine}; - _ -> - A = list_to_integer(EndStr), - A = proplists:get_value(F,Exports), - {lists:delete({F,A},Exports),LastExprFuncs,PrevLine} - end + A = list_to_integer(AStr), +% erlang:display({found_fnc,F,A}), + A = proplists:get_value(F,Exports), + {lists:delete({F,A},Exports),PrevLine} end; sax_event(_,State) -> State. diff -Nru erlang-18.2-dfsg/lib/test_server/test/Makefile erlang-17.3-dfsg/lib/test_server/test/Makefile --- erlang-18.2-dfsg/lib/test_server/test/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_break_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_break_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_break_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_break_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_conf01_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_conf01_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_conf01_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_conf01_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_conf02_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_conf02_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_conf02_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_conf02_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_cover_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_cover_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_cover_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_cover_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2012. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_parallel01_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_parallel01_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_parallel01_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_parallel01_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_shuffle01_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_shuffle01_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_shuffle01_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_shuffle01_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_skip_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_skip_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_skip_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_skip_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2004-2011. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_unicode_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_unicode_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_unicode_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE_data/test_server_unicode_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE.erl erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_SUITE.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_SUITE.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/test/test_server_test_lib.erl erlang-17.3-dfsg/lib/test_server/test/test_server_test_lib.erl --- erlang-18.2-dfsg/lib/test_server/test/test_server_test_lib.erl 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/test/test_server_test_lib.erl 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ %% %% Copyright Ericsson AB 2009-2013. All Rights Reserved. %% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. %% %% %CopyrightEnd% %% diff -Nru erlang-18.2-dfsg/lib/test_server/vsn.mk erlang-17.3-dfsg/lib/test_server/vsn.mk --- erlang-18.2-dfsg/lib/test_server/vsn.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/test_server/vsn.mk 2014-09-16 19:10:57.000000000 +0000 @@ -1 +1 @@ -TEST_SERVER_VSN = 3.9.1 +TEST_SERVER_VSN = 3.7.1 diff -Nru erlang-18.2-dfsg/lib/tools/c_src/erl_memory.c erlang-17.3-dfsg/lib/tools/c_src/erl_memory.c --- erlang-18.2-dfsg/lib/tools/c_src/erl_memory.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/c_src/erl_memory.c 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ * * Copyright Ericsson AB 2003-2013. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * %CopyrightEnd% */ diff -Nru erlang-18.2-dfsg/lib/tools/c_src/erl_memory_trace_block_table.c erlang-17.3-dfsg/lib/tools/c_src/erl_memory_trace_block_table.c --- erlang-18.2-dfsg/lib/tools/c_src/erl_memory_trace_block_table.c 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/c_src/erl_memory_trace_block_table.c 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/tools/c_src/erl_memory_trace_block_table.h erlang-17.3-dfsg/lib/tools/c_src/erl_memory_trace_block_table.h --- erlang-18.2-dfsg/lib/tools/c_src/erl_memory_trace_block_table.h 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/c_src/erl_memory_trace_block_table.h 2014-09-16 19:10:57.000000000 +0000 @@ -1,14 +1,13 @@ -/* ``Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * * The Initial Developer of the Original Code is Ericsson Utvecklings AB. * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings diff -Nru erlang-18.2-dfsg/lib/tools/c_src/Makefile.in erlang-17.3-dfsg/lib/tools/c_src/Makefile.in --- erlang-18.2-dfsg/lib/tools/c_src/Makefile.in 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/c_src/Makefile.in 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/book.xml erlang-17.3-dfsg/lib/tools/doc/src/book.xml --- erlang-18.2-dfsg/lib/tools/doc/src/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/cover_chapter.xml erlang-17.3-dfsg/lib/tools/doc/src/cover_chapter.xml --- erlang-18.2-dfsg/lib/tools/doc/src/cover_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/cover_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/cover.xml erlang-17.3-dfsg/lib/tools/doc/src/cover.xml --- erlang-18.2-dfsg/lib/tools/doc/src/cover.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/cover.xml 2014-09-16 19:10:57.000000000 +0000 @@ -5,21 +5,20 @@
    2001 - 2015 + 2013 Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -139,18 +138,17 @@ - compile(ModFiles) -> Result | [Result] - compile(ModFiles, Options) -> Result | [Result] - compile_module(ModFiles) -> Result | [Result] - compile_module(ModFiles, Options) -> Result | [Result] - Compile one or more modules for Cover analysis. + compile(ModFile) -> Result + compile(ModFile, Options) -> Result + compile_module(ModFile) -> Result + compile_module(ModFile, Options) -> Result + Compile a module for Cover analysis. - ModFiles = ModFile | [ModFile] ModFile = Module | File  Module = atom()  File = string() Options = [Option] -  Option = {i,Dir} | {d,Macro} | {d,Macro,Value} | export_all +  Option = {i,Dir} | {d,Macro} | {d,Macro,Value} See compile:file/2. Result = {ok,Module} | {error,File} | {error,not_main_node} @@ -167,9 +165,6 @@ returns {ok,Module}. Otherwise the function returns {error,File}. Errors and warnings are printed as they occur.

    -

    If a list of ModFiles is given as input, a list - of Result will be returned. The order of the returned - list is undefined.

    Note that the internal database is (re-)initiated during the compilation, meaning any previously collected coverage data for the module will be lost.

    @@ -199,10 +194,9 @@
    - compile_beam(ModFiles) -> Result | [Result] - Compile one or more modules for Cover analysis, using existing beam(s). + compile_beam(ModFile) -> Result + Compile a module for Cover analysis, using an existing beam. - ModFiles = ModFile | [ModFile] ModFile = Module | BeamFile  Module = atom()  BeamFile = string() @@ -235,9 +229,6 @@ returned.

    {error,BeamFile} is returned if the compiled code can not be loaded on the node.

    -

    If a list of ModFiles is given as input, a list - of Result will be returned. The order of the returned - list is undefined.

    @@ -260,21 +251,16 @@ - analyse() -> {result,Ok,Fail} | {error,not_main_node} - analyse(Modules) -> OneResult | {result,Ok,Fail} | {error,not_main_node} - analyse(Analysis) -> {result,Ok,Fail} | {error,not_main_node} - analyse(Level) -> {result,Ok,Fail} | {error,not_main_node} - analyse(Modules, Analysis) -> OneResult | {result,Ok,Fail} | {error,not_main_node} - analyse(Modules, Level) -> OneResult | {result,Ok,Fail} | {error,not_main_node} - analyse(Analysis, Level) -> {result,Ok,Fail} | {error,not_main_node} - analyse(Modules, Analysis, Level) -> OneResult | {result,Ok,Fail} | {error,not_main_node} - Analyse one or more Cover compiled modules. + analyse(Module) -> {ok,Answer} | {error,Error} + analyse(Module, Analysis) -> {ok,Answer} | {error,Error} + analyse(Module, Level) -> {ok,Answer} | {error,Error} + analyse(Module, Analysis, Level) -> {ok,Answer} | {error,Error} + Analyse a Cover compiled module. - Modules = Module | [Module] - Module = atom() + Module = atom() Analysis = coverage | calls Level = line | clause | function | module - OneResult = {ok,{Module,Value}} | {ok,[{Item,Value}]} | {error, Error} + Answer = {Module,Value} | [{Item,Value}]  Item = Line | Clause | Function   Line = {M,N}   Clause = {M,F,A,C} @@ -283,67 +269,49 @@    N = A = C = integer()  Value = {Cov,NotCov} | Calls   Cov = NotCov = Calls = integer() -  Error = {not_cover_compiled,Module} - Ok = [{Module,Value}] | [{Item,Value}] - Fail = [Error] + Error = {not_cover_compiled,Module} | not_main_node -

    Performs analysis of one or more Cover compiled modules, as +

    Performs analysis of a Cover compiled module Module, as specified by Analysis and Level (see above), by examining the contents of the internal database.

    Analysis defaults to coverage and Level defaults to function.

    -

    If Modules is an atom (one module), the return will - be OneResult, else the return will be - {result,Ok,Fail}.

    -

    If Modules is not given, all modules that have data - in the cover data table, are analysed. Note that this - includes both cover compiled modules and imported - modules.

    -

    If a given module is not Cover compiled, this is indicated - by the error reason {not_cover_compiled,Module}.

    +

    If Module is not Cover compiled, the function returns + {error,{not_cover_compiled,Module}}.

    +

    HINT: It is possible to issue multiple analyse_to_file commands at + the same time.

    - analyse_to_file() -> {result,Ok,Fail} | {error,not_main_node} - analyse_to_file(Modules) -> Answer | {result,Ok,Fail} | {error,not_main_node} - analyse_to_file(Options) -> {result,Ok,Fail} | {error,not_main_node} - analyse_to_file(Modules,Options) -> Answer | {result,Ok,Fail} | {error,not_main_node} - Detailed coverage analysis of one or more Cover compiled modules. + analyse_to_file(Module) -> + analyse_to_file(Module,Options) -> + analyse_to_file(Module, OutFile) -> + analyse_to_file(Module, OutFile, Options) -> {ok,OutFile} | {error,Error} + Detailed coverage analysis of a Cover compiled module. - Modules = Module | [Module] Module = atom() - OutFile = OutDir = string() + OutFile = string() Options = [Option] - Option = html | {outfile,OutFile} | {outdir,OutDir} - Answer = {ok,OutFile} | {error,Error} - Ok = [OutFile] - Fail = [Error] - Error = {not_cover_compiled,Module} | {file,File,Reason} | {no_source_code_found,Module} + Option = html + Error = {not_cover_compiled,Module} | {file,File,Reason} | no_source_code_found | not_main_node  File = string()  Reason = term() -

    Makes copies of the source file for the given modules, - where it for each executable line is specified +

    Makes a copy OutFile of the source file for a module + Module, where it for each executable line is specified how many times it has been executed.

    The output file OutFile defaults to Module.COVER.out, or Module.COVER.html if the option html was used.

    -

    If Modules is an atom (one module), the return will - be Answer, else the return will be a - list, {result,Ok,Fail}.

    -

    If Modules is not given, all modules that have data - in the cover data table, are analysed. Note that this - includes both cover compiled modules and imported - modules.

    -

    If a module is not Cover compiled, this is indicated by the - error reason {not_cover_compiled,Module}.

    +

    If Module is not Cover compiled, the function returns + {error,{not_cover_compiled,Module}}.

    If the source file and/or the output file cannot be opened using file:open/2, the function returns {error,{file,File,Reason}} where File is the file name and Reason is the error reason.

    -

    If a module was cover compiled from the .beam +

    If the module was cover compiled from the .beam file, i.e. using compile_beam/1 or compile_beam_directory/0,1, it is assumed that the source code can be found in the same directory as the @@ -354,8 +322,10 @@ joining ../src and the tail of the compiled path below a trailing src component, then the compiled path itself. - If no source code is found, this is indicated by the error reason - {no_source_code_found,Module}.

    + If no source code is found, + {error,no_source_code_found} is returned.

    +

    HINT: It is possible to issue multiple analyse_to_file commands at + the same time.

    @@ -369,7 +339,7 @@ OutFile = string() Options = [Option] Option = html - Error = {not_cover_compiled,Module} | {file,File,Reason} | {no_source_code_found,Module} | not_main_node + Error = {not_cover_compiled,Module} | {file,File,Reason} | no_source_code_found | not_main_node  File = string()  Reason = term() diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/cprof_chapter.xml erlang-17.3-dfsg/lib/tools/doc/src/cprof_chapter.xml --- erlang-18.2-dfsg/lib/tools/doc/src/cprof_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/cprof_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/cprof.xml erlang-17.3-dfsg/lib/tools/doc/src/cprof.xml --- erlang-18.2-dfsg/lib/tools/doc/src/cprof.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/cprof.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -67,7 +66,7 @@ analyse() -> {AllCallCount, ModAnalysisList} analyse(Limit) -> {AllCallCount, ModAnalysisList} - analyse(Mod) -> ModAnalysis + analyse(Mod) -> ModAnlysis analyse(Mod, Limit) -> ModAnalysis Collect and analyse call counters. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/eprof.xml erlang-17.3-dfsg/lib/tools/doc/src/eprof.xml --- erlang-18.2-dfsg/lib/tools/doc/src/eprof.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/eprof.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -36,7 +35,7 @@ used. The profiling is done using the Erlang trace BIFs. Tracing of local function calls for a specified set of processes is enabled when profiling is begun, and disabled when profiling is stopped.

    -

    When using Eprof, expect a slowdown in program execution.

    +

    When using Eprof expect a slowdown in program execution.

    @@ -131,13 +130,13 @@ analyze() -> ok analyze(Type) -> ok analyze(Type,Options) -> ok - Display profiling results per process. Type = procs | total Options = [{filter, Filter} | {sort, Sort} Filter = [{calls, integer()} | {time, float()}] Sort = time | calls | mfa + Display profiling results per process.

    Call this function when profiling has been stopped to display the results per process, that is:

    diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/erlang_mode_chapter.xml erlang-17.3-dfsg/lib/tools/doc/src/erlang_mode_chapter.xml --- erlang-18.2-dfsg/lib/tools/doc/src/erlang_mode_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/erlang_mode_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/erlang_mode.xml erlang-17.3-dfsg/lib/tools/doc/src/erlang_mode.xml --- erlang-18.2-dfsg/lib/tools/doc/src/erlang_mode.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/erlang_mode.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/fprof_chapter.xml erlang-17.3-dfsg/lib/tools/doc/src/fprof_chapter.xml --- erlang-18.2-dfsg/lib/tools/doc/src/fprof_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/fprof_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/fprof.xml erlang-17.3-dfsg/lib/tools/doc/src/fprof.xml --- erlang-18.2-dfsg/lib/tools/doc/src/fprof.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/fprof.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -790,7 +789,7 @@ function was first unsuspended and then garbage collected. Otherwise the printout would show garbage_collect being called from suspend but not - which function that might have caused the garbage + not which function that might have caused the garbage collection.

    Let us now get back to the test code:

    diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/instrument.xml erlang-17.3-dfsg/lib/tools/doc/src/instrument.xml --- erlang-18.2-dfsg/lib/tools/doc/src/instrument.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/instrument.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/lcnt_chapter.xml erlang-17.3-dfsg/lib/tools/doc/src/lcnt_chapter.xml --- erlang-18.2-dfsg/lib/tools/doc/src/lcnt_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/lcnt_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/lcnt.xml erlang-17.3-dfsg/lib/tools/doc/src/lcnt.xml --- erlang-18.2-dfsg/lib/tools/doc/src/lcnt.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/lcnt.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,19 +9,18 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. - The Initial Developer of the Original Code is Ericsson AB. + The Initial Developer of the Original Code is Ericsson AB. lcnt diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/Makefile erlang-17.3-dfsg/lib/tools/doc/src/Makefile --- erlang-18.2-dfsg/lib/tools/doc/src/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 1997-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/make.xml erlang-17.3-dfsg/lib/tools/doc/src/make.xml --- erlang-18.2-dfsg/lib/tools/doc/src/make.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/make.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. @@ -76,7 +75,7 @@ Load mode. Loads all recompiled modules. netload

    - Net load mode. Loads all recompiled modules on all known nodes.
    + Net load mode. Loads all recompiled modules an all known nodes.

    All items in Options that are not make options are assumed to be compiler options and are passed as-is to diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/notes_history.xml erlang-17.3-dfsg/lib/tools/doc/src/notes_history.xml --- erlang-18.2-dfsg/lib/tools/doc/src/notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/notes.xml erlang-17.3-dfsg/lib/tools/doc/src/notes.xml --- erlang-18.2-dfsg/lib/tools/doc/src/notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -31,169 +30,6 @@

    This document describes the changes made to the Tools application.

    -
    Tools 2.8.2 - -
    Fixed Bugs and Malfunctions - - -

    - The emacs mode does not add a newline after the arrow on - -callback lines anymore.

    -

    - Own Id: OTP-13042

    -
    -
    -
    - -
    - -
    Tools 2.8.1 - -
    Fixed Bugs and Malfunctions - - -

    - If a module includes eunit.hrl, a parse transform adds - the function test/0 on line 0 in the module. A bug in - OTP-18.0 caused cover:analyse_to_file/1 to fail to insert - cover data in the output file when line 0 existed in the - cover data table. This is now corrected.

    -

    - Own Id: OTP-12981

    -
    -
    -
    - -
    - -
    Tools 2.8 - -
    Fixed Bugs and Malfunctions - - -

    - In order to improve performance of the cover tool, new - functions are added for cover compilation and analysis on - multiple files. This allows for more parallelisation.

    -

    - Some improvements of the data base access is also done in - order to improve the performance when analysing and - resetting cover data.

    -

    - Minor incompatibility: An error reason from - analyse_to_file is changed from no_source_code_found to - {no_source_code_found,Module}.

    -

    - *** POTENTIAL INCOMPATIBILITY ***

    -

    - Own Id: OTP-12330 Aux Id: seq12757

    -
    - -

    Attempting to do a cover analysis when neither - source code nor beam file could be found would hang the - cover server. Corrected to return a proper - error.

    -

    - Own Id: OTP-12806

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Allow maps for supervisor flags and child specs

    -

    - Earlier, supervisor flags and child specs were given as - tuples. While this is kept for backwards compatibility, - it is now also allowed to give these parameters as maps, - see sup_flags - and child_spec.

    -

    - Own Id: OTP-11043

    -
    - -

    - Remove Mnemosyne rules support.

    -

    - Own Id: OTP-12511

    -
    - -

    - Add printout of total number of calls and time in eprof

    -

    - Own Id: OTP-12681

    -
    -
    -
    - -
    - -
    Tools 2.7.2 - -
    Fixed Bugs and Malfunctions - - -

    - Fix lcnt sorting and printout of histograms.

    -

    - Own Id: OTP-12364

    -
    - -

    Fix a Unicode bug in the tags module.

    -

    - Own Id: OTP-12567

    -
    - -

    - Fix tags completion in erlang.el for GNU Emacs 23+

    -

    - Own Id: OTP-12583

    -
    -
    -
    - -
    - -
    Tools 2.7.1 - -
    Fixed Bugs and Malfunctions - - -

    - Fixed a typo in erlang-mode comment.

    -

    - Own Id: OTP-12214

    -
    - -

    - Add a skeleton for -spec in Erlang mode for Emacs

    -

    - Own Id: OTP-12283

    -
    -
    -
    - - -
    Improvements and New Features - - -

    - Cover no longer crashes when compiling receive and - the like with just an after clause. Thanks to - José Valim for providing a fix.

    -

    - Own Id: OTP-12328

    -
    -
    -
    - -
    -
    Tools 2.7
    Improvements and New Features diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/part_notes_history.xml erlang-17.3-dfsg/lib/tools/doc/src/part_notes_history.xml --- erlang-18.2-dfsg/lib/tools/doc/src/part_notes_history.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/part_notes_history.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/part_notes.xml erlang-17.3-dfsg/lib/tools/doc/src/part_notes.xml --- erlang-18.2-dfsg/lib/tools/doc/src/part_notes.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/part_notes.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/part.xml erlang-17.3-dfsg/lib/tools/doc/src/part.xml --- erlang-18.2-dfsg/lib/tools/doc/src/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/ref_man.xml erlang-17.3-dfsg/lib/tools/doc/src/ref_man.xml --- erlang-18.2-dfsg/lib/tools/doc/src/ref_man.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/ref_man.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/tags.xml erlang-17.3-dfsg/lib/tools/doc/src/tags.xml --- erlang-18.2-dfsg/lib/tools/doc/src/tags.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/tags.xml 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ Ericsson AB, All Rights Reserved - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. The Initial Developer of the Original Code is Ericsson AB. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/xref_chapter.xml erlang-17.3-dfsg/lib/tools/doc/src/xref_chapter.xml --- erlang-18.2-dfsg/lib/tools/doc/src/xref_chapter.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/xref_chapter.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/doc/src/xref.xml erlang-17.3-dfsg/lib/tools/doc/src/xref.xml --- erlang-18.2-dfsg/lib/tools/doc/src/xref.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/doc/src/xref.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/lib/tools/emacs/erlang.el erlang-17.3-dfsg/lib/tools/emacs/erlang.el --- erlang-18.2-dfsg/lib/tools/emacs/erlang.el 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/emacs/erlang.el 2014-09-16 19:10:57.000000000 +0000 @@ -9,17 +9,16 @@ ;; ;; Copyright Ericsson AB 1996-2014. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. ;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;; @@ -881,10 +880,10 @@ "dt_restore_tag" "dt_spread_tag" "dunlink" - "convert_time_unit" "external_size" "finish_after_on_load" "finish_loading" + "flush_monitor_message" "format_cpu_topology" "fun_info" "fun_info_mfa" @@ -914,7 +913,6 @@ "memory" "module_info" "monitor_node" - "monotonic_time" "nif_error" "phash" "phash2" @@ -948,17 +946,13 @@ "system_info" "system_monitor" "system_profile" - "system_time" "trace" "trace_delivered" "trace_info" "trace_pattern" - "time_offset" - "timestamp" "universaltime" "universaltime_to_localtime" "universaltime_to_posixtime" - "unique_integer" "yield") "Erlang built-in functions (BIFs) that needs erlang: prefix")) @@ -2450,10 +2444,7 @@ ;; Parse the Erlang code from the beginning of the clause to ;; the beginning of the region. (while (< (point) indent-point) - (let ((pt (point))) - (setq state (erlang-partial-parse pt indent-point state)) - (if (= pt (point)) - (error "Illegal syntax")))) + (setq state (erlang-partial-parse (point) indent-point state))) ;; Indent every line in the region (while continue (goto-char indent-point) @@ -2489,11 +2480,8 @@ (if (>= from-end (- (point-max) indent-point)) (setq continue nil) (while (< (point) indent-point) - (let ((pt (point))) - (setq state (erlang-partial-parse - pt indent-point state)) - (if (= pt (point)) - (error "Illegal syntax"))))))))) + (setq state (erlang-partial-parse + (point) indent-point state)))))))) (defun erlang-indent-current-buffer () @@ -2540,10 +2528,7 @@ (goto-char parse-start) (erlang-beginning-of-clause)) (while (< (point) indent-point) - (let ((pt (point))) - (setq state (erlang-partial-parse pt indent-point state)) - (if (= pt (point)) - (error "Illegal syntax")))) + (setq state (erlang-partial-parse (point) indent-point state))) (erlang-calculate-stack-indent indent-point state)))) (defun erlang-show-syntactic-information () @@ -2713,13 +2698,12 @@ (erlang-push (list '|| token (current-column)) stack) (forward-char 2)) - ;; Bit-syntax open. Note that map syntax allows "<<" to follow ":=" - ;; or "=>" without intervening whitespace, so handle that case here - ((looking-at "\\(:=\\|=>\\)?<<") + ;; Bit-syntax open paren + ((looking-at "<<") (erlang-push (list '<< token (current-column)) stack) - (forward-char (- (match-end 0) (match-beginning 0)))) + (forward-char 2)) - ;; Bit-syntax close + ;; Bbit-syntax close paren ((looking-at ">>") (while (memq (car (car stack)) '(|| ->)) (erlang-pop stack)) @@ -4204,10 +4188,7 @@ ;; Do not return `stop' when inside a list comprehension ;; construction. (The point must be after `||'). (while (< (point) orig-point) - (let ((pt (point))) - (setq state (erlang-partial-parse pt orig-point state)) - (if (= pt (point)) - (error "Illegal syntax")))) + (setq state (erlang-partial-parse (point) orig-point state))) (if (and (car state) (eq (car (car (car state))) '||)) nil 'stop))) @@ -4236,7 +4217,7 @@ This function is designed to be a member of a criteria list." (save-excursion (beginning-of-line) - (when (save-match-data (looking-at "-\\(spec\\|type\\|callback\\)")) + (when (save-match-data (looking-at "-\\(spec\\|type\\)")) 'stop))) @@ -4762,23 +4743,6 @@ ;;; `module:tag'. -(when (and (fboundp 'etags-tags-completion-table) - (fboundp 'tags-lazy-completion-table)) ; Emacs 23.1+ - (if (fboundp 'advice-add) - ;; Emacs 24.4+ - (advice-add 'etags-tags-completion-table :around - (lambda (oldfun) - (if (eq find-tag-default-function 'erlang-find-tag-for-completion) - (erlang-etags-tags-completion-table) - (funcall oldfun))) - (list :name 'erlang-replace-tags-table)) - ;; Emacs 23.1-24.3 - (defadvice etags-tags-completion-table (around erlang-replace-tags-table activate) - (if (eq find-tag-default-function 'erlang-find-tag-for-completion) - (setq ad-return-value (erlang-etags-tags-completion-table)) - ad-do-it)))) - - (defun erlang-complete-tag () "Perform tags completion on the text around point. Completes to the set of names listed in the current tags table. @@ -4790,17 +4754,7 @@ (require 'etags) (error nil)) (cond ((and erlang-tags-installed - (fboundp 'etags-tags-completion-table) - (fboundp 'tags-lazy-completion-table)) ; Emacs 23.1+ - ;; This depends on the advice called erlang-replace-tags-table - ;; above. It is not enough to let-bind - ;; tags-completion-table-function since that will not override - ;; the buffer-local value in the TAGS buffer. - (let ((find-tag-default-function 'erlang-find-tag-for-completion)) - (complete-tag))) - ((and erlang-tags-installed - (fboundp 'complete-tag) - (fboundp 'tags-complete-tag)) ; Emacs 19 + (fboundp 'complete-tag)) ; Emacs 19 (let ((orig-tags-complete-tag (symbol-function 'tags-complete-tag))) (fset 'tags-complete-tag (symbol-function 'erlang-tags-complete-tag)) @@ -4815,15 +4769,6 @@ (error "This version of Emacs can't complete tags")))) -(defun erlang-find-tag-for-completion () - (let ((start (save-excursion - (skip-chars-backward "[:word:][:digit:]_:'") - (point)))) - (unless (eq start (point)) - (buffer-substring-no-properties start (point))))) - - - ;; Based on `tags-complete-tag', but this one uses ;; `erlang-tags-completion-table' instead of `tags-completion-table'. ;; @@ -4871,12 +4816,7 @@ ;; the only format supported by Emacs, so far.) (defun erlang-etags-tags-completion-table () (let ((table (make-vector 511 0)) - (file nil) - (progress-reporter - (when (fboundp 'make-progress-reporter) - (make-progress-reporter - (format "Making erlang tags completion table for %s..." buffer-file-name) - (point-min) (point-max))))) + (file nil)) (save-excursion (goto-char (point-min)) ;; This monster regexp matches an etags tag line. @@ -4888,33 +4828,31 @@ ;; \6 is the line to start searching at; ;; \7 is the char to start searching at. (while (progn - (while (and - (eq (following-char) ?\f) - (looking-at "\f\n\\([^,\n]*\\),.*\n")) - (setq file (buffer-substring - (match-beginning 1) (match-end 1))) - (goto-char (match-end 0))) - (re-search-forward - "\ + (while (and + (eq (following-char) ?\f) + (looking-at "\f\n\\([^,\n]*\\),.*\n")) + (setq file (buffer-substring + (match-beginning 1) (match-end 1))) + (goto-char (match-end 0))) + (re-search-forward + "\ ^\\(\\([^\177]+[^-a-zA-Z0-9_$\177]+\\)?\\([-a-zA-Z0-9_$?:]+\\)\ \[^-a-zA-Z0-9_$?:\177]*\\)\177\\(\\([^\n\001]+\\)\001\\)?\ \\([0-9]+\\)?,\\([0-9]+\\)?\n" - nil t)) - (let ((tag (if (match-beginning 5) - ;; There is an explicit tag name. - (buffer-substring (match-beginning 5) (match-end 5)) - ;; No explicit tag name. Best guess. - (buffer-substring (match-beginning 3) (match-end 3)))) - (module (and file - (erlang-get-module-from-file-name file)))) - (intern tag table) - (when (stringp module) - (intern (concat module ":" tag) table) - ;; Only the first ones will be stored in the table. - (intern (concat module ":") table) - (intern (concat module ":module_info") table)) - (when progress-reporter - (progress-reporter-update progress-reporter (point)))))) + nil t)) + (let ((tag (if (match-beginning 5) + ;; There is an explicit tag name. + (buffer-substring (match-beginning 5) (match-end 5)) + ;; No explicit tag name. Best guess. + (buffer-substring (match-beginning 3) (match-end 3)))) + (module (and file + (erlang-get-module-from-file-name file)))) + (intern tag table) + (if (stringp module) + (progn + (intern (concat module ":" tag) table) + ;; Only the first one will be stored in the table. + (intern (concat module ":") table)))))) table)) ;;; diff -Nru erlang-18.2-dfsg/lib/tools/emacs/erlang-eunit.el erlang-17.3-dfsg/lib/tools/emacs/erlang-eunit.el --- erlang-18.2-dfsg/lib/tools/emacs/erlang-eunit.el 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/emacs/erlang-eunit.el 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2009-2010. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. ;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;;; diff -Nru erlang-18.2-dfsg/lib/tools/emacs/erlang-skels.el erlang-17.3-dfsg/lib/tools/emacs/erlang-skels.el --- erlang-18.2-dfsg/lib/tools/emacs/erlang-skels.el 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/emacs/erlang-skels.el 2014-09-16 19:10:57.000000000 +0000 @@ -1,19 +1,18 @@ ;; ;; %CopyrightBegin% ;; -;; Copyright Ericsson AB 2010-2014. All Rights Reserved. +;; Copyright Ericsson AB 2010. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. ;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;;; @@ -32,7 +31,6 @@ ("Module" "module" erlang-skel-module) ("Author" "author" erlang-skel-author) ("Function" "function" erlang-skel-function) - ("Spec" "spec" erlang-skel-spec) () ("Small Header" "small-header" erlang-skel-small-header erlang-skel-header) @@ -56,8 +54,6 @@ erlang-skel-gen-event erlang-skel-header) ("gen_fsm" "gen-fsm" erlang-skel-gen-fsm erlang-skel-header) - ("wx_object" "wx-object" - erlang-skel-wx-object erlang-skel-header) ("Library module" "gen-lib" erlang-skel-lib erlang-skel-header) ("Corba callback" "gen-corba-cb" @@ -151,10 +147,6 @@ "*The template of a function skeleton. Please see the function `tempo-define-template'.") -(defvar erlang-skel-spec - '("-spec " (erlang-skel-get-function-name) "(" (erlang-skel-get-function-args) ") -> undefined.") - "*The template of a -spec for the function following point. -Please see the function `tempo-define-template'.") ;; Attribute templates @@ -353,25 +345,26 @@ "%% @doc" n "%% Whenever a supervisor is started using supervisor:start_link/[2,3]," n "%% this function is called by the new process to find out about" n - "%% restart strategy, maximum restart intensity, and child" n + "%% restart strategy, maximum restart frequency and child" n "%% specifications." n "%%" n "%% @spec init(Args) -> {ok, {SupFlags, [ChildSpec]}} |" n "%% ignore |" n "%% {error, Reason}" n (erlang-skel-separator-end 2) - "init([]) ->" n + "init([]) ->" n> + "RestartStrategy = one_for_one," n> + "MaxRestarts = 1000," n> + "MaxSecondsBetweenRestarts = 3600," n + "" n> + "SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts}," n "" n> - "SupFlags = #{strategy => one_for_one," n> - "intensity => 1," n> - "period => 5}," n + "Restart = permanent," n> + "Shutdown = 2000," n> + "Type = worker," n "" n> - "AChild = #{id => 'AName'," n> - "start => {'AModule', start_link, []}," n> - "restart => permanent," n> - "shutdown => 5000," n> - "type => worker," n> - "modules => ['AModule']}," n + "AChild = {'AName', {'AModule', start_link, []}," n> + "Restart, Shutdown, Type, ['AModule']}," n "" n> "{ok, {SupFlags, [AChild]}}." n n @@ -379,7 +372,7 @@ "%%% Internal functions" n (erlang-skel-double-separator-end 3) ) - "*The template of a supervisor behaviour. + "*The template of an supervisor behaviour. Please see the function `tempo-define-template'.") (defvar erlang-skel-supervisor-bridge @@ -449,7 +442,7 @@ "%%% Internal functions" n (erlang-skel-double-separator-end 3) ) - "*The template of a supervisor_bridge behaviour. + "*The template of an supervisor_bridge behaviour. Please see the function `tempo-define-template'.") (defvar erlang-skel-generic-server @@ -584,7 +577,7 @@ "-record(state, {})." n n (erlang-skel-double-separator-start 3) - "%%% API" n + "%%% gen_event callbacks" n (erlang-skel-double-separator-end 3) n (erlang-skel-separator-start 2) "%% @doc" n @@ -858,137 +851,6 @@ "*The template of a gen_fsm. Please see the function `tempo-define-template'.") -(defvar erlang-skel-wx-object - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(wx_object)." n n - - "-include_lib(\"wx/include/wx.hrl\")." n n - - "%% API" n - "-export([start_link/0])." n n - - "%% wx_object callbacks" n - "-export([init/1, handle_call/3, handle_cast/2, " - "handle_info/2," n> - "handle_event/2, terminate/2, code_change/3])." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator-start 3) - "%%% API" n - (erlang-skel-double-separator-end 3) n - (erlang-skel-separator-start 2) - "%% @doc" n - "%% Starts the server" n - "%%" n - "%% @spec start_link() -> wxWindow()" n - (erlang-skel-separator-end 2) - "start_link() ->" n> - "wx_object:start_link(?MODULE, [], [])." n - n - (erlang-skel-double-separator-start 3) - "%%% wx_object callbacks" n - (erlang-skel-double-separator-end 3) - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Initializes the server" n - "%%" n - "%% @spec init(Args) -> {wxWindow(), State} |" n - "%% {wxWindow(), State, Timeout} |" n - "%% ignore |" n - "%% {stop, Reason}" n - (erlang-skel-separator-end 2) - "init([]) ->" n> - "wx:new()," n> - "Frame = wxFrame:new()," n> - "{Frame, #state{}}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Handling events" n - "%%" n - "%% @spec handle_event(wx{}, State) ->" n - "%% {noreply, State} |" n - "%% {noreply, State, Timeout} |" n - "%% {stop, Reason, State}" n - (erlang-skel-separator-end 2) - "handle_event(#wx{}, State) ->" n> - "{noreply, State}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Handling call messages" n - "%%" n - "%% @spec handle_call(Request, From, State) ->" n - "%% {reply, Reply, State} |" n - "%% {reply, Reply, State, Timeout} |" n - "%% {noreply, State} |" n - "%% {noreply, State, Timeout} |" n - "%% {stop, Reason, Reply, State} |" n - "%% {stop, Reason, State}" n - (erlang-skel-separator-end 2) - "handle_call(_Request, _From, State) ->" n> - "Reply = ok," n> - "{reply, Reply, State}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Handling cast messages" n - "%%" n - "%% @spec handle_cast(Msg, State) -> {noreply, State} |" n - "%% {noreply, State, Timeout} |" n - "%% {stop, Reason, State}" n - (erlang-skel-separator-end 2) - "handle_cast(_Msg, State) ->" n> - "{noreply, State}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Handling all non call/cast messages" n - "%%" n - "%% @spec handle_info(Info, State) -> {noreply, State} |" n - "%% {noreply, State, Timeout} |" n - "%% {stop, Reason, State}" n - (erlang-skel-separator-end 2) - "handle_info(_Info, State) ->" n> - "{noreply, State}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% This function is called by a wx_object when it is about to" n - "%% terminate. It should be the opposite of Module:init/1 and do any" n - "%% necessary cleaning up. When it returns, the wx_object terminates" n - "%% with Reason. The return value is ignored." n - "%%" n - "%% @spec terminate(Reason, State) -> void()" n - (erlang-skel-separator-end 2) - "terminate(_Reason, _State) ->" n> - "ok." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Convert process state when code is changed" n - "%%" n - "%% @spec code_change(OldVsn, State, Extra) -> {ok, NewState}" n - (erlang-skel-separator-end 2) - "code_change(_OldVsn, State, _Extra) ->" n> - "{ok, State}." n - n - (erlang-skel-double-separator-start 3) - "%%% Internal functions" n - (erlang-skel-double-separator-end 3) - ) - "*The template of a generic server. -Please see the function `tempo-define-template'.") - (defvar erlang-skel-lib '((erlang-skel-include erlang-skel-large-header) @@ -1235,7 +1097,7 @@ "Config." n n (erlang-skel-separator-start 2) - "%% @spec end_per_suite(Config0) -> term() | {save_config,Config1}" n + "%% @spec end_per_suite(Config0) -> void() | {save_config,Config1}" n "%% Config0 = Config1 = [tuple()]" n (erlang-skel-separator-end 2) "end_per_suite(_Config) ->" n > @@ -1253,7 +1115,7 @@ (erlang-skel-separator-start 2) "%% @spec end_per_group(GroupName, Config0) ->" n - "%% term() | {save_config,Config1}" n + "%% void() | {save_config,Config1}" n "%% GroupName = atom()" n "%% Config0 = Config1 = [tuple()]" n (erlang-skel-separator-end 2) @@ -1272,7 +1134,7 @@ (erlang-skel-separator-start 2) "%% @spec end_per_testcase(TestCase, Config0) ->" n - "%% term() | {save_config,Config1} | {fail,Reason}" n + "%% void() | {save_config,Config1} | {fail,Reason}" n "%% TestCase = atom()" n "%% Config0 = Config1 = [tuple()]" n "%% Reason = term()" n @@ -1413,7 +1275,7 @@ "%% A list of key/value pairs, holding configuration data for the group." n "%%" n "%% @spec end_per_group(GroupName, Config0) ->" n - "%% term() | {save_config,Config1}" n + "%% void() | {save_config,Config1}" n (erlang-skel-separator-end 2) "end_per_group(_GroupName, _Config) ->" n > "ok." n n @@ -1447,7 +1309,7 @@ "%% A list of key/value pairs, holding the test case configuration." n "%%" n "%% @spec end_per_testcase(TestCase, Config0) ->" n - "%% term() | {save_config,Config1} | {fail,Reason}" n + "%% void() | {save_config,Config1} | {fail,Reason}" n (erlang-skel-separator-end 2) "end_per_testcase(_TestCase, _Config) ->" n > "ok." n n @@ -1684,16 +1546,6 @@ (substring date 4 7) (substring date -4)))) -(defun erlang-skel-get-function-name () - (save-excursion - (erlang-beginning-of-function -1) - (erlang-get-function-name))) - -(defun erlang-skel-get-function-args () - (save-excursion - (erlang-beginning-of-function -1) - (erlang-get-function-arguments))) - ;; Local variables: ;; coding: iso-8859-1 ;; End: diff -Nru erlang-18.2-dfsg/lib/tools/emacs/erlang-skels-old.el erlang-17.3-dfsg/lib/tools/emacs/erlang-skels-old.el --- erlang-18.2-dfsg/lib/tools/emacs/erlang-skels-old.el 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/emacs/erlang-skels-old.el 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ ;; ;; Copyright Ericsson AB 2010. All Rights Reserved. ;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. ;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. ;; ;; %CopyrightEnd% ;;; @@ -839,7 +838,7 @@ "Config." n n (erlang-skel-separator 2) - "%% Function: end_per_suite(Config) -> term()" n + "%% Function: end_per_suite(Config) -> void()" n "%%" n "%% Config = [tuple()]" n "%% A list of key/value pairs, holding the test case configuration." n @@ -868,7 +867,7 @@ "Config." n n (erlang-skel-separator 2) - "%% Function: end_per_testcase(TestCase, Config) -> term()" n + "%% Function: end_per_testcase(TestCase, Config) -> void()" n "%%" n "%% TestCase = atom()" n "%% Name of the test case that is finished." n @@ -994,7 +993,7 @@ "Config." n n (erlang-skel-separator 2) - "%% Function: end_per_suite(Config0) -> term() | {save_config,Config1}" n + "%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}" n "%%" n "%% Config0 = Config1 = [tuple()]" n "%% A list of key/value pairs, holding the test case configuration." n @@ -1022,7 +1021,7 @@ (erlang-skel-separator 2) "%% Function: end_per_group(GroupName, Config0) ->" n - "%% term() | {save_config,Config1}" n + "%% void() | {save_config,Config1}" n "%%" n "%% GroupName = atom()" n "%% Name of the test case group that is finished." n @@ -1055,7 +1054,7 @@ (erlang-skel-separator 2) "%% Function: end_per_testcase(TestCase, Config0) ->" n - "%% term() | {save_config,Config1} | {fail,Reason}" n + "%% void() | {save_config,Config1} | {fail,Reason}" n "%%" n "%% TestCase = atom()" n "%% Name of the test case that is finished." n @@ -1176,7 +1175,7 @@ "Config." n n (erlang-skel-separator 2) - "%% Function: end_per_suite(Config0) -> term() | {save_config,Config1}" n + "%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}" n "%% Config0 = Config1 = [tuple()]" n (erlang-skel-separator 2) "end_per_suite(_Config) ->" n > @@ -1194,7 +1193,7 @@ (erlang-skel-separator 2) "%% Function: end_per_group(GroupName, Config0) ->" n - "%% term() | {save_config,Config1}" n + "%% void() | {save_config,Config1}" n "%% GroupName = atom()" n "%% Config0 = Config1 = [tuple()]" n (erlang-skel-separator 2) @@ -1213,7 +1212,7 @@ (erlang-skel-separator 2) "%% Function: end_per_testcase(TestCase, Config0) ->" n - "%% term() | {save_config,Config1} | {fail,Reason}" n + "%% void() | {save_config,Config1} | {fail,Reason}" n "%% TestCase = atom()" n "%% Config0 = Config1 = [tuple()]" n "%% Reason = term()" n diff -Nru erlang-18.2-dfsg/lib/tools/emacs/internal_doc/emacs.sgml erlang-17.3-dfsg/lib/tools/emacs/internal_doc/emacs.sgml --- erlang-18.2-dfsg/lib/tools/emacs/internal_doc/emacs.sgml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/lib/tools/emacs/internal_doc/emacs.sgml 2014-09-16 19:10:57.000000000 +0000 @@ -1,16 +1,15 @@ diff -Nru erlang-18.2-dfsg/system/doc/top/templates/index.html.src erlang-17.3-dfsg/system/doc/top/templates/index.html.src --- erlang-18.2-dfsg/system/doc/top/templates/index.html.src 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/system/doc/top/templates/index.html.src 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ Copyright Ericsson AB 2009-2014. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. %CopyrightEnd% --> diff -Nru erlang-18.2-dfsg/system/doc/tutorial/appendix.xmlsrc erlang-17.3-dfsg/system/doc/tutorial/appendix.xmlsrc --- erlang-18.2-dfsg/system/doc/tutorial/appendix.xmlsrc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/system/doc/tutorial/appendix.xmlsrc 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/system/doc/tutorial/book.xml erlang-17.3-dfsg/system/doc/tutorial/book.xml --- erlang-18.2-dfsg/system/doc/tutorial/book.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/system/doc/tutorial/book.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/system/doc/tutorial/cnode.xmlsrc erlang-17.3-dfsg/system/doc/tutorial/cnode.xmlsrc --- erlang-18.2-dfsg/system/doc/tutorial/cnode.xmlsrc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/system/doc/tutorial/cnode.xmlsrc 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 20002015 + 20002013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -29,39 +28,19 @@ cnode.xml
    -

    This section outlines an example of how to solve the example - problem in Problem Example - by using a C node. Notice that a C node is not typically - used for solving simple problems like this, a port is - sufficient.

    +

    This is an example of how to solve the example problem by using a C node. Note that a C node would not typically be used for solving a simple problem like this, a port would suffice.

    Erlang Program -

    From Erlang's point of view, the C node is treated like a - normal Erlang node. Thus, calling the functions foo and - bar only involves sending a message to the C node asking - for the function to be called, and receiving the result. Sending - a message requires a recipient, that is, a process that can be - defined using either a pid or a tuple, consisting of a - registered name and a node name. In this case, a tuple is the - only alternative as no pid is known:

    +

    From Erlang's point of view, the C node is treated like a normal Erlang node. Therefore, calling the functions foo and bar only involves sending a message to the C node asking for the function to be called, and receiving the result. Sending a message requires a recipient; a process which can be defined using either a pid or a tuple consisting of a registered name and a node name. In this case a tuple is the only alternative as no pid is known.

     {RegName, Node} ! Msg
    -

    The node name Node is to be the name of the C node. If - short node names are used, the plain name of the node is - cN, where N is an integer. If long node names are - used, there is no such restriction. An example of a C node name - using short node names is thus c1@idril, an example using - long node names is cnode@idril.ericsson.se.

    -

    The registered name, RegName, can be any atom. The name - can be ignored by the C code, or, for example, be used to - distinguish between different types of messages. An example of - Erlang code using short node names follows: +

    The node name Node should be the name of the C node. If short node names are used, the plain name of the node will be cN where N is an integer. If long node names are used, there is no such restriction. An example of a C node name using short node names is thus c1@idril, an example using long node names is cnode@idril.ericsson.se.

    +

    The registered name RegName could be any atom. The name can be ignored by the C code, or it could be used for example to distinguish between different types of messages. Below is an example of what the Erlang code could look like when using short node names.

    - When using long node names, the code is slightly different as - shown in the following example: + When using long node names the code is slightly different as shown in the following example:

    @@ -71,77 +50,39 @@ C Program
    - Setting Up Communication -

    Before calling any other function in Erl_Interface, the - memory handling must be initiated:

    + Setting Up the Communication +

    Before calling any other Erl_Interface function, the memory handling must be initiated.

     erl_init(NULL, 0);
    -

    Now the C node can be initiated. If short node names are - used, this is done by calling erl_connect_init():

    +

    Now the C node can be initiated. If short node names are used, this is done by calling erl_connect_init().

     erl_connect_init(1, "secretcookie", 0);
    -

    Here:

    - - The first argument is the integer used to construct the node name. -

    In the example, the plain node name is c1.

    - The second argument is a string defining the magic cookie. - The third argument is an integer that is used to identify - a particular instance of a C node. -
    -

    If long node node names are used, initiation is done by - calling erl_connect_xinit():

    +

    The first argument is the integer which is used to construct the node name. In the example the plain node name will be c1.

    + + The second argument is a string defining the magic cookie.

    + + The third argument is an integer which is used to identify a particular instance of a C node.

    +

    If long node node names are used, initiation is done by calling erl_connect_xinit().

     erl_connect_xinit("idril", "cnode", "cnode@idril.ericsson.se",
                       &addr, "secretcookie", 0);
    -

    Here:

    - - The first argument is the host name. - The second argument is the plain node name. - The third argument is the full node name. - The fourth argument is a pointer to an in_addr - struct with the IP address of the host. - The fifth argument is the magic cookie. - The sixth argument is the instance number. - -

    The C node can act as a server or a client when setting up - the Erlang-C communication. If it acts as a client, it - connects to an Erlang node by calling erl_connect(), - which returns an open file descriptor at success:

    +

    The first three arguments are the host name, the plain node name, and the full node name. The fourth argument is a pointer to an in_addr struct with the IP address of the host, and the fifth and sixth arguments are the magic cookie and instance number.

    +

    The C node can act as a server or a client when setting up the communication Erlang-C. If it acts as a client, it connects to an Erlang node by calling erl_connect(), which will return an open file descriptor at success.

     fd = erl_connect("e1@idril");
    -

    If the C node acts as a server, it must first create a socket - (call bind() and listen()) listening to a - certain port number port. It then publishes its name - and port number with epmd, the Erlang port mapper - daemon. For details, see the epmd manual page in ERTS:

    +

    If the C node acts as a server, it must first create a socket (call bind() and listen()) listening to a certain port number port. It then publishes its name and port number with epmd (the Erlang port mapper daemon, see the man page for epmd).

     erl_publish(port);
    -

    Now the C node server can accept connections from Erlang nodes:

    +

    Now the C node server can accept connections from Erlang nodes.

     fd = erl_accept(listen, &conn);
    -

    The second argument to erl_accept is a struct - ErlConnect which contains useful information when a - connection has been established, for example, the name of the - Erlang node.

    +

    The second argument to erl_accept is a struct ErlConnect that will contain useful information when a connection has been established; for example, the name of the Erlang node.

    Sending and Receiving Messages -

    The C node can receive a message from Erlang by calling - erl_receive msg(). This function reads data from the - open file descriptor fd into a buffer and puts the - result in an ErlMessage struct emsg. - ErlMessage has a field type defining what kind - of data is received. In this case, the type of interest is - ERL_REG_SEND which indicates that Erlang sent a message - to a registered process at the C node. The actual message, an - ETERM, is in the msg field.

    -

    It is also necessary to take care of the types - ERL_ERROR (an error occurred) and ERL_TICK - (alive check from other node, is to be ignored). Other - possible types indicate process events such as link, unlink, - and exit:

    +

    The C node can receive a message from Erlang by calling erl_receive msg(). This function reads data from the open file descriptor fd into a buffer and puts the result in an ErlMessage struct emsg. ErlMessage has a field type defining which kind of data was received. In this case the type of interest is ERL_REG_SEND which indicates that Erlang sent a message to a registered process at the C node. The actual message, an ETERM, will be in the msg field.

    +

    It is also necessary to take care of the types ERL_ERROR (an error occurred) and ERL_TICK (alive check from other node, should be ignored). Other possible types indicate process events such as link/unlink and exit.

       while (loop) {
     
    @@ -152,16 +93,7 @@
           loop = 0; /* exit while loop */
         } else {
           if (emsg.type == ERL_REG_SEND) {
    -

    As the message is an ETERM struct, Erl_Interface - functions can be used to manipulate it. In this case, the - message becomes a 3-tuple, because that is how the Erlang code - is written. The second element will be the pid of the caller - and the third element will be the tuple {Function,Arg} - determining which function to call, and with which argument. - The result of calling the function is made into an - ETERM struct as well and sent back to Erlang using - erl_send(), which takes the open file descriptor, a - pid, and a term as arguments:

    +

    Since the message is an ETERM struct, Erl_Interface functions can be used to manipulate it. In this case, the message will be a 3-tuple (because that was how the Erlang code was written, see above). The second element will be the pid of the caller and the third element will be the tuple {Function,Arg} determining which function to call with which argument. The result of calling the function is made into an ETERM struct as well and sent back to Erlang using erl_send(), which takes the open file descriptor, a pid and a term as arguments.

             fromp = erl_element(2, emsg.msg);
             tuplep = erl_element(3, emsg.msg);
    @@ -176,30 +108,29 @@
     
             resp = erl_format("{cnode, ~i}", res);
             erl_send(fd, fromp, resp);
    -

    Finally, the memory allocated by the ETERM creating - functions (including erl_receive_msg() must be - freed:

    +

    Finally, the memory allocated by the ETERM creating functions (including erl_receive_msg() must be freed.

             erl_free_term(emsg.from); erl_free_term(emsg.msg);
             erl_free_term(fromp); erl_free_term(tuplep);
             erl_free_term(fnp); erl_free_term(argp);
             erl_free_term(resp);
    -

    The following examples show the resulting C programs. - First a C node server using short node names:

    +

    The resulting C programs can be found in looks like the following examples. First a C node server using short node names.

    -

    A C node server using long node names:

    +

    Below follows a C node server using long node names.

    -

    Finally, the code for the C node client:

    +

    And finally we have the code for the C node client.

    Running the Example -

    Step 1. Compile the C code. This provides the paths to - the Erl_Interface include files and libraries, and to the - socket and nsl libraries:

    +

    1. Compile the C code, providing the paths to the Erl_Interface include files and libraries, and to the socket and nsl libraries.

    +

    In R5B and later versions of OTP, the include and lib directories are situated under OTPROOT/lib/erl_interface-VSN, where OTPROOT is the root directory of the OTP installation (/usr/local/otp in the example above) and VSN is the version of the erl_interface application (3.2.1 in the example above).

    + + In R4B and earlier versions of OTP, include and lib are situated under OTPROOT/usr.

    +      
     >  gcc -o cserver \\ 
     -I/usr/local/otp/lib/erl_interface-3.2.1/include \\ 
     -L/usr/local/otp/lib/erl_interface-3.2.1/lib \\ 
    @@ -217,29 +148,11 @@
     -L/usr/local/otp/lib/erl_interface-3.2.1/lib \\ 
     complex.c cnode_c.c \\ 
     -lerl_interface -lei -lsocket -lnsl
    -

    In Erlang/OTP R5B and later versions of OTP, the - include and lib directories are situated under - OTPROOT/lib/erl_interface-VSN, where OTPROOT is - the root directory of the OTP installation - (/usr/local/otp in the recent example) and VSN is - the version of the Erl_Interface application (3.2.1 in the - recent example).

    -

    In R4B and earlier versions of OTP, include and - lib are situated under OTPROOT/usr.

    -

    Step 2. Compile the Erlang code:

    +

    2. Compile the Erlang code.

     unix> erl -compile complex3 complex4
    -

    Step 3. Run the C node server example with short node names.

    -

    Do as follows:

    - - Start the C program cserver and Erlang in - different windows. - cserver takes a port number as argument and must - be started before trying to call the Erlang functions. - The Erlang node is to be given the short name e1 - and must be set to use the same magic cookie as the C node, - secretcookie: - +

    3. Run the C node server example with short node names.

    +

    Start the C program cserver and Erlang in different windows. cserver takes a port number as argument and must be started before trying to call the Erlang functions. The Erlang node should be given the short name e1 and must be set to use the same magic cookie as the C node, secretcookie.

     unix> cserver 3456
     
    @@ -251,9 +164,7 @@
     4
     (e1@idril)2> complex3:bar(5).
     10
    -

    Step 4. Run the C node client example. Terminate - cserver, but not Erlang, and start cclient. The - Erlang node must be started before the C node client:

    +

    4. Run the C node client example. Terminate cserver but not Erlang and start cclient. The Erlang node must be started before the C node client is.

     unix> cclient
     
    @@ -261,7 +172,7 @@
     4
     (e1@idril)4> complex3:bar(5).
     10
    -

    Step 5. Run the C node server example with long node names:

    +

    5. Run the C node server, long node names, example.

     unix> cserver2 3456
     
    diff -Nru erlang-18.2-dfsg/system/doc/tutorial/c_portdriver.xmlsrc erlang-17.3-dfsg/system/doc/tutorial/c_portdriver.xmlsrc
    --- erlang-18.2-dfsg/system/doc/tutorial/c_portdriver.xmlsrc	2015-12-15 20:10:35.000000000 +0000
    +++ erlang-17.3-dfsg/system/doc/tutorial/c_portdriver.xmlsrc	2014-09-16 19:10:57.000000000 +0000
    @@ -4,63 +4,63 @@
     
       
    - 20002015 + 20002013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. - Port Drivers + Port drivers c_portdriver.xml
    -

    This section outlines an example of how to solve the example problem - in Problem Example - by using a linked-in port driver.

    -

    A port driver is a linked-in driver that is accessible as a port - from an Erlang program. It is a shared library (SO in UNIX, DLL in - Windows), with special entry points. The Erlang runtime system - calls these entry points when the driver is started and when data - is sent to the port. The port driver can also send data to - Erlang.

    -

    As a port driver is dynamically linked into the emulator process, - this is the fastest way of calling C-code from Erlang. Calling - functions in the port driver requires no context switches. But it - is also the least safe way, because a crash in the port driver - brings the emulator down too.

    -

    The scenario is illustrated in the following figure:

    +

    This is an example of how to solve the example problem by using a linked in port driver.

    - Port Driver Communication + Port Driver Communication.
    + Port Drivers +

    A port driver is a linked in driver, that is accessible as a + port from an Erlang program. It is a shared library (SO in Unix, + DLL in Windows), with special entry points. The Erlang runtime + calls these entry points, when the driver is started and when + data is sent to the port. The port driver can also send data to + Erlang.

    +

    Since a port driver is dynamically linked into the emulator + process, this is the fastest way of calling C-code from Erlang. + Calling functions in the port driver requires no context + switches. But it is also the least safe, because a crash in the + port driver brings the emulator down too.

    +
    + +
    Erlang Program -

    Like a port program, the port communicates with an Erlang +

    Just as with a port program, the port communicates with a Erlang process. All communication goes through one Erlang process that is the connected process of the port driver. Terminating this process closes the port driver.

    Before the port is created, the driver must be loaded. This is done with the function erl_dll:load_driver/1, with the name of the shared library as argument.

    -

    The port is then created using the BIF open_port/2, with +

    The port is then created using the BIF open_port/2 with the tuple {spawn, DriverName} as the first argument. The string SharedLib is the name of the port driver. The second - argument is a list of options, none in this case:

    + argument is a list of options, none in this case.

     -module(complex5).
     -export([start/1, init/1]).
    @@ -77,9 +77,9 @@
       register(complex, self()),
       Port = open_port({spawn, SharedLib}, []),
       loop(Port).
    -

    Now complex5:foo/1 and complex5:bar/1 - can be implemented. Both send a message to the - complex process and receive the following reply:

    +

    Now it is possible to implement complex5:foo/1 and + complex5:bar/1. They both send a message to the + complex process and receive the reply.

     foo(X) ->
         call_port({foo, X}).
    @@ -92,14 +92,10 @@
             {complex, Result} ->
                 Result
         end.
    -

    The complex process performs the following:

    - - Encodes the message into a sequence of bytes. - Sends it to the port. - Waits for a reply. - Decodes the reply. - Sends it back to the caller: - +

    The complex process encodes the message into a sequence + of bytes, sends it to the port, waits for a reply, decodes the + reply and sends it back to the caller. +

     loop(Port) ->
         receive
    @@ -112,58 +108,59 @@
                 loop(Port)
         end.

    Assuming that both the arguments and the results from the C - functions are less than 256, a simple encoding/decoding scheme - is employed. In this scheme, foo is represented by byte + functions will be less than 256, a very simple encoding/decoding + scheme is employed where foo is represented by the byte 1, bar is represented by 2, and the argument/result is - represented by a single byte as well:

    + represented by a single byte as well. +

     encode({foo, X}) -> [1, X];
     encode({bar, Y}) -> [2, Y].
    -
    +      
     decode([Int]) -> Int.
    -

    The resulting Erlang program, including functions for stopping - the port and detecting port failures, is as follows:

    +

    The resulting Erlang program, including functionality for + stopping the port and detecting port failures is shown below.

    C Driver

    The C driver is a module that is compiled and linked into a - shared library. It uses a driver structure and includes the + shared library. It uses a driver structure, and includes the header file erl_driver.h.

    The driver structure is filled with the driver name and function pointers. It is returned from the special entry point, declared with the macro )]]>.

    -

    The functions for receiving and sending data are combined into +

    The functions for receiving and sending data, are combined into a function, pointed out by the driver structure. The data sent - into the port is given as arguments, and the replied data is sent - with the C-function driver_output.

    -

    As the driver is a shared module, not a program, no main - function is present. All function pointers are not used - in this example, and the corresponding fields in the + into the port is given as arguments, and the data the port + sends back is sent with the C-function driver_output.

    +

    Since the driver is a shared module, not a program, no main + function should be present. All function pointers are not used + in our example, and the corresponding fields in the driver_entry structure are set to NULL.

    -

    All functions in the driver takes a handle (returned from - start) that is just passed along by the Erlang +

    All functions in the driver, takes a handle (returned from + start), that is just passed along by the erlang process. This must in some way refer to the port driver instance.

    -

    The example_drv_start, is the only function that is called with - a handle to the port instance, so this must be saved. It is - customary to use an allocated driver-defined structure for this - one, and to pass a pointer back as a reference.

    -

    It is not a good idea to use a global variable as the port - driver can be spawned by multiple Erlang processes. This - driver-structure is to be instantiated multiple times: +

    The example_drv_start, is the only function that is called with + a handle to the port instance, so we must save this. It is + customary to use a allocated driver-defined structure for this + one, and pass a pointer back as a reference.

    +

    It is not a good idea to use a global variable; since the port + driver can be spawned by multiple Erlang processes, this + driver-structure should be instantiated multiple times.

    Running the Example -

    Step 1. Compile the C code:

    +

    1. Compile the C code.

     unix> gcc -o exampledrv -fpic -shared complex.c port_driver.c
     windows> cl -LD -MD -Fe exampledrv.dll complex.c port_driver.c
    -

    Step 2. Start Erlang and compile the Erlang code:

    +

    2. Start Erlang and compile the Erlang code.

     > erl
     Erlang (BEAM) emulator version 5.1
    @@ -171,7 +168,7 @@
     Eshell V5.1 (abort with ^G)
     1> c(complex5).
     {ok,complex5}
    -

    Step 3. Run the example:

    +

    3. Run the example.

     2> complex5:start("example_drv").
     <0.34.0>
    diff -Nru erlang-18.2-dfsg/system/doc/tutorial/c_port.xmlsrc erlang-17.3-dfsg/system/doc/tutorial/c_port.xmlsrc
    --- erlang-18.2-dfsg/system/doc/tutorial/c_port.xmlsrc	2015-12-15 20:10:35.000000000 +0000
    +++ erlang-17.3-dfsg/system/doc/tutorial/c_port.xmlsrc	2014-09-16 19:10:57.000000000 +0000
    @@ -4,21 +4,20 @@
     
       
    - 20002015 + 20002013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -29,34 +28,16 @@ c_port.xml
    -

    This section outlines an example of how to solve the example - problem in the previous section - by using a port.

    -

    The scenario is illustrated in the following figure:

    +

    This is an example of how to solve the example problem by using a port.

    - Port Communication + Port Communication.
    Erlang Program -

    All communication between Erlang and C must be established by - creating the port. The Erlang process that creates a port is - said to be the connected process of the port. All - communication to and from the port must go through the connected - process. If the connected process terminates, the port also - terminates (and the external program, if it is written - properly).

    -

    The port is created using the BIF open_port/2 with - {spawn,ExtPrg} as the first argument. The string - ExtPrg is the name of the external program, including any - command line arguments. The second argument is a list of - options, in this case only {packet,2}. This option says - that a 2 byte length indicator is to be used to simplify the - communication between C and Erlang. The Erlang port - automatically adds the length indicator, but this must be done - explicitly in the external C program.

    -

    The process is also set to trap exits, which enables detection - of failure of the external program:

    +

    First of all communication between Erlang and C must be established by creating the port. The Erlang process which creates a port is said to be the connected process of the port. All communication to and from the port should go via the connected process. If the connected process terminates, so will the port (and the external program, if it is written correctly).

    +

    The port is created using the BIF open_port/2 with {spawn,ExtPrg} as the first argument. The string ExtPrg is the name of the external program, including any command line arguments. The second argument is a list of options, in this case only {packet,2}. This option says that a two byte length indicator will be used to simplify the communication between C and Erlang. Adding the length indicator will be done automatically by the Erlang port, but must be done explicitly in the external C program.

    +

    The process is also set to trap exits which makes it possible to detect if the external program fails.

     -module(complex1).
     -export([start/1, init/1]).
    @@ -69,9 +50,7 @@
       process_flag(trap_exit, true),
       Port = open_port({spawn, ExtPrg}, [{packet, 2}]),
       loop(Port).
    -

    Now complex1:foo/1 and complex1:bar/1 can be - implemented. Both send a message to the complex process - and receive the following replies:

    +

    Now it is possible to implement complex1:foo/1 and complex1:bar/1. They both send a message to the complex process and receive the reply.

     foo(X) ->
       call_port({foo, X}).
    @@ -84,14 +63,7 @@
         {complex, Result} ->
           Result
       end.
    -

    The complex process does the following:

    - - Encodes the message into a sequence of bytes. - Sends it to the port. - Waits for a reply. - Decodes the reply. - Sends it back to the caller: - +

    The complex process encodes the message into a sequence of bytes, sends it to the port, waits for a reply, decodes the reply and sends it back to the caller.

     loop(Port) ->
       receive
    @@ -103,52 +75,37 @@
           end,
           loop(Port)
      end.
    -

    Assuming that both the arguments and the results from the C - functions are less than 256, a simple encoding/decoding scheme - is employed. In this scheme, foo is represented by byte - 1, bar is represented by 2, and the argument/result is - represented by a single byte as well:

    +

    Assuming that both the arguments and the results from the C functions will be less than 256, a very simple encoding/decoding scheme is employed where foo is represented by the byte 1, bar is represented by 2, and the argument/result is represented by a single byte as well.

     encode({foo, X}) -> [1, X];
     encode({bar, Y}) -> [2, Y].
    -
    +      
     decode([Int]) -> Int.
    -

    The resulting Erlang program, including functionality for - stopping the port and detecting port failures, is as follows: +

    The resulting Erlang program, including functionality for stopping the port and detecting port failures is shown below.

    C Program -

    On the C side, it is necessary to write functions for receiving - and sending data with 2 byte length indicators from/to Erlang. - By default, the C program is to read from standard input (file - descriptor 0) and write to standard output (file descriptor 1). - Examples of such functions, read_cmd/1 and - write_cmd/2, follows:

    +

    On the C side, it is necessary to write functions for receiving and sending + data with two byte length indicators from/to Erlang. By default, the C program + should read from standard input (file descriptor 0) and write to standard output + (file descriptor 1). Examples of such functions, read_cmd/1 and + write_cmd/2, are shown below.

    -

    Notice that stdin and stdout are for buffered - input/output and must not be used for the communication - with Erlang.

    -

    In the main function, the C program is to listen for a - message from Erlang and, according to the selected - encoding/decoding scheme, use the first byte to determine which - function to call and the second byte as argument to the - function. The result of calling the function is then to be sent - back to Erlang:

    +

    Note that stdin and stdout are for buffered input/output and should not be used for the communication with Erlang!

    +

    In the main function, the C program should listen for a message from Erlang and, according to the selected encoding/decoding scheme, use the first byte to determine which function to call and the second byte as argument to the function. The result of calling the function should then be sent back to Erlang.

    -

    Notice that the C program is in a while-loop, checking - for the return value of read_cmd/1. This is because the C - program must detect when the port closes and terminates.

    +

    Note that the C program is in a while-loop checking for the return value of read_cmd/1. The reason for this is that the C program must detect when the port gets closed and terminate.

    Running the Example -

    Step 1. Compile the C code:

    +

    1. Compile the C code.

     unix> gcc -o extprg complex.c erl_comm.c port.c
    -

    Step 2. Start Erlang and compile the Erlang code:

    +

    2. Start Erlang and compile the Erlang code.

     unix> erl
     Erlang (BEAM) emulator version 4.9.1.2
    @@ -156,7 +113,7 @@
     Eshell V4.9.1.2 (abort with ^G)
     1> c(complex1).
     {ok,complex1}
    -

    Step 3. Run the example:

    +

    3. Run the example.

     2> complex1:start("extprg").
     <0.34.0>
    diff -Nru erlang-18.2-dfsg/system/doc/tutorial/distribution.xml erlang-17.3-dfsg/system/doc/tutorial/distribution.xml
    --- erlang-18.2-dfsg/system/doc/tutorial/distribution.xml	2015-12-15 20:10:35.000000000 +0000
    +++ erlang-17.3-dfsg/system/doc/tutorial/distribution.xml	2014-09-16 19:10:57.000000000 +0000
    @@ -8,17 +8,16 @@
           Ericsson AB. All Rights Reserved.
         
         
    -      Licensed under the Apache License, Version 2.0 (the "License");
    -      you may not use this file except in compliance with the License.
    -      You may obtain a copy of the License at
    - 
    -          http://www.apache.org/licenses/LICENSE-2.0
    -
    -      Unless required by applicable law or agreed to in writing, software
    -      distributed under the License is distributed on an "AS IS" BASIS,
    -      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -      See the License for the specific language governing permissions and
    -      limitations under the License.
    +      The contents of this file are subject to the Erlang Public License,
    +      Version 1.1, (the "License"); you may not use this file except in
    +      compliance with the License. You should have received a copy of the
    +      Erlang Public License along with this software. If not, it can be
    +      retrieved online at http://www.erlang.org/.
    +    
    +      Software distributed under the License is distributed on an "AS IS"
    +      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
    +      the License for the specific language governing rights and limitations
    +      under the License.
         
         
     
    @@ -59,6 +58,7 @@
           global_group - Grouping nodes to global name registration groups.
           net_adm - Various net administration routines.
           net_kernel - Networking kernel.
    +      pg - Distributed named process groups, experimental implementation.
           pg2 - Distributed named process groups.
           pool - Load distribution facility.
           slave - Functions for starting and controlling slave nodes.
    diff -Nru erlang-18.2-dfsg/system/doc/tutorial/ei.c erlang-17.3-dfsg/system/doc/tutorial/ei.c
    --- erlang-18.2-dfsg/system/doc/tutorial/ei.c	2015-12-15 20:10:35.000000000 +0000
    +++ erlang-17.3-dfsg/system/doc/tutorial/ei.c	2014-09-16 19:10:57.000000000 +0000
    @@ -21,7 +21,7 @@
         
         if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) {
           res = foo(ERL_INT_VALUE(argp));
    -    } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) {
    +    } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 17) == 0) {
           res = bar(ERL_INT_VALUE(argp));
         }
     
    diff -Nru erlang-18.2-dfsg/system/doc/tutorial/erl_interface.xmlsrc erlang-17.3-dfsg/system/doc/tutorial/erl_interface.xmlsrc
    --- erlang-18.2-dfsg/system/doc/tutorial/erl_interface.xmlsrc	2015-12-15 20:10:35.000000000 +0000
    +++ erlang-17.3-dfsg/system/doc/tutorial/erl_interface.xmlsrc	2014-09-16 19:10:57.000000000 +0000
    @@ -4,21 +4,20 @@
     
       
    - 20002015 + 20002013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -29,29 +28,14 @@ erl_interface.xml
    - -

    This section outlines an example of how to solve the example - problem in Problem Example by - using a port and Erl_Interface. It is necessary to read the port - example in Ports before reading - this section.

    +

    This is an example of how to solve the example problem by using a port and erl_interface. It is necessary to read the port example before reading this chapter.

    Erlang Program -

    The following example shows an Erlang program communicating - with a C program over a plain port with home made encoding:

    - -

    There are two differences when using Erl_Interface on the C - side compared to the example in - Ports, using only the plain port:

    - - As Erl_Interface operates on the Erlang external term format, - the port must be set to use binaries. - Instead of inventing an encoding/decoding scheme, the - term_to_binary/1 and binary_to_term/1 BIFs are to - be used. - -

    That is:

    +

    The example below shows an Erlang program communicating with a C program over a plain port with home made encoding.

    + +

    Compared to the Erlang module + above used for the plain port, there are two differences when using Erl_Interface on the C side: Since Erl_Interface operates on the Erlang external term format the port must be set to use binaries and, instead of inventing an encoding/decoding scheme, the BIFs term_to_binary/1 and binary_to_term/1 should be used. That is:

     open_port({spawn, ExtPrg}, [{packet, 2}])

    is replaced with:

    @@ -71,110 +55,69 @@ {Port, {data, Data}} -> Caller ! {complex, binary_to_term(Data)} end
    -

    The resulting Erlang program is as follows:

    +

    The resulting Erlang program is shown below.

    -

    Notice that calling complex2:foo/1 and - complex2:bar/1 results in the tuple {foo,X} or - {bar,Y} being sent to the complex process, which - codes them as binaries and sends them to the port. This means - that the C program must be able to handle these two tuples.

    +

    Note that calling complex2:foo/1 and complex2:bar/1 will result in the tuple {foo,X} or {bar,Y} being sent to the complex process, which will code them as binaries and send them to the port. This means that the C program must be able to handle these two tuples.

    C Program -

    The following example shows a C program communicating with an - Erlang program over a plain port with home made encoding:

    +

    The example below shows a C program communicating with an Erlang program over a plain port with home made encoding.

    -

    Compared to the C program in - Ports, using only the plain port, the - while-loop must be rewritten. Messages coming from the - port is on the Erlang external term format. They must be - converted into an ETERM struct, which is a C struct - similar to an Erlang term. The result of calling foo() or - bar() must be converted to the Erlang external term - format before being sent back to the port. But before calling - any other Erl_Interface function, the memory handling must be - initiated:

    +

    Compared to the C program above + used for the plain port the while-loop must be rewritten. Messages coming from the port will be on the Erlang external term format. They should be converted into an ETERM struct, a C struct similar to an Erlang term. The result of calling foo() or bar() must be converted to the Erlang external term format before being sent back to the port. But before calling any other erl_interface function, the memory handling must be initiated.

     erl_init(NULL, 0);
    -

    The following functions, read_cmd() and - write_cmd(), from the erl_comm.c example in - Ports can still be - used for reading from and writing to the port: +

    For reading from and writing to the port the functions read_cmd() and write_cmd() from the erl_comm.c example below + can still be used.

    -

    The function erl_decode() from erl_marshal - converts the binary into an ETERM struct:

    +

    The function erl_decode() from erl_marshal will convert the binary into an ETERM struct.

     int main() {
       ETERM *tuplep;
     
       while (read_cmd(buf) > 0) {
         tuplep = erl_decode(buf);
    -

    Here, tuplep points to an ETERM struct - representing a tuple with two elements; the function name (atom) - and the argument (integer). Using the function - erl_element() from erl_eterm, these elements can - be extracted, but they must also be declared as pointers to an - ETERM struct:

    +

    In this case tuplep now points to an ETERM struct representing a tuple with two elements; the function name (atom) and the argument (integer). By using the function erl_element() from erl_eterm it is possible to extract these elements, which also must be declared as pointers to an ETERM struct.

         fnp = erl_element(1, tuplep);
         argp = erl_element(2, tuplep);
    -

    The macros ERL_ATOM_PTR and ERL_INT_VALUE from - erl_eterm can be used to obtain the actual values of the - atom and the integer. The atom value is represented as a string. - By comparing this value with the strings "foo" and "bar", it can - be decided which function to call:

    +

    The macros ERL_ATOM_PTR and ERL_INT_VALUE from erl_eterm can be used to obtain the actual values of the atom and the integer. The atom value is represented as a string. By comparing this value with the strings "foo" and "bar" it can be decided which function to call.

         if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) {
           res = foo(ERL_INT_VALUE(argp));
         } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) {
           res = bar(ERL_INT_VALUE(argp));
         }
    -

    Now an ETERM struct that represents the integer result - can be constructed using the function erl_mk_int() from - erl_eterm. The function - erl_format() from the module erl_format can also - be used:

    +

    Now an ETERM struct representing the integer result can be constructed using the function erl_mk_int() from erl_eterm. It is also possible to use the function erl_format() from the module erl_format.

         intp = erl_mk_int(res);
    -

    The resulting ETERM struct is converted into the Erlang - external term format using the function erl_encode() from - erl_marshal and sent to Erlang using - write_cmd():

    +

    The resulting ETERM struct is converted into the Erlang external term format using the function erl_encode() from erl_marshal and sent to Erlang using write_cmd().

         erl_encode(intp, buf);
         write_cmd(buf, erl_eterm_len(intp));
    -

    Finally, the memory allocated by the ETERM creating - functions must be freed:

    +

    Last, the memory allocated by the ETERM creating functions must be freed.

         erl_free_compound(tuplep);
         erl_free_term(fnp);
         erl_free_term(argp);
         erl_free_term(intp);
    -

    The resulting C program is as follows:

    +

    The resulting C program is shown below:

    Running the Example -

    Step 1. Compile the C code. This provides the paths to - the include files erl_interface.h and ei.h, and - also to the libraries erl_interface and ei:

    +

    1. Compile the C code, providing the paths to the include files erl_interface.h and ei.h, and to the libraries erl_interface and ei.

     unix> gcc -o extprg -I/usr/local/otp/lib/erl_interface-3.2.1/include \\ 
           -L/usr/local/otp/lib/erl_interface-3.2.1/lib \\ 
           complex.c erl_comm.c ei.c -lerl_interface -lei
    -

    In Erlang/OTP R5B and later versions of OTP, the include - and lib directories are situated under - OTPROOT/lib/erl_interface-VSN, where OTPROOT is - the root directory of the OTP installation - (/usr/local/otp in the recent example) and VSN is - the version of the Erl_interface application (3.2.1 in the - recent example).

    -

    In R4B and earlier versions of OTP, include and lib - are situated under OTPROOT/usr.

    -

    Step 2. Start Erlang and compile the Erlang code:

    +

    In R5B and later versions of OTP, the include and lib directories are situated under OTPROOT/lib/erl_interface-VSN, where OTPROOT is the root directory of the OTP installation (/usr/local/otp in the example above) and VSN is the version of the erl_interface application (3.2.1 in the example above).

    + + In R4B and earlier versions of OTP, include and lib are situated under OTPROOT/usr.

    +

    2. Start Erlang and compile the Erlang code.

     unix> erl
     Erlang (BEAM) emulator version 4.9.1.2
    @@ -182,7 +125,7 @@
     Eshell V4.9.1.2 (abort with ^G)
     1> c(complex2).
     {ok,complex2}
    -

    Step 3. Run the example:

    +

    3. Run the example.

     2> complex2:start("extprg").
     <0.34.0>
    diff -Nru erlang-18.2-dfsg/system/doc/tutorial/example.xmlsrc erlang-17.3-dfsg/system/doc/tutorial/example.xmlsrc
    --- erlang-18.2-dfsg/system/doc/tutorial/example.xmlsrc	2015-12-15 20:10:35.000000000 +0000
    +++ erlang-17.3-dfsg/system/doc/tutorial/example.xmlsrc	2014-09-16 19:10:57.000000000 +0000
    @@ -4,22 +4,21 @@
     
       
    - 20002015 + 20002013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + Problem Example @@ -32,25 +31,16 @@
    Description -

    A common interoperability situation is when you want to incorporate - a piece of code, solving a complex problem, in your Erlang - program. Suppose for example, that you have the following C - functions that you would like to call from Erlang:

    - -

    The functions are deliberately kept as simple as possible, for - readability reasons.

    -

    From an Erlang perspective, it is preferable to be able to call - foo and bar without having to bother about that - they are C functions:

    +

    A common interoperability situation is when there exists a piece of code solving some complex problem, and we would like to incorporate this piece of code in our Erlang program. Suppose for example we have the following C functions that we would like to be able to call from Erlang.

    + +

    (For the sake of keeping the example as simple as possible, the functions are not very complicated in this case).

    +

    Preferably we would like to able to call foo and bar without having to bother about them actually being C functions.

     % Erlang code
     ...
     Res = complex:foo(X),
     ...
    -

    Here, the communication with C is hidden in the implementation - of complex.erl. - In the following sections, it is shown how this module can be - implemented using the different interoperability mechanisms.

    +

    The communication with C is hidden in the implementation of complex.erl. In the following chapters it is shown how this module can be implemented using the different interoperability mechanisms.

    diff -Nru erlang-18.2-dfsg/system/doc/tutorial/introduction.xml erlang-17.3-dfsg/system/doc/tutorial/introduction.xml --- erlang-18.2-dfsg/system/doc/tutorial/introduction.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/system/doc/tutorial/introduction.xml 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 20002015 + 20002013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -29,34 +28,18 @@ introduction.xml
    - -

    This section informs on interoperability, that is, information - exchange, between Erlang and other programming languages. The - included examples mainly treat interoperability between Erlang and - C.

    Purpose -

    The purpose of this tutorial is to describe different - interoperability mechanisms that can be used when integrating a - program written in Erlang with a program written in another - programming language, from the Erlang programmer's - perspective.

    +

    The purpose of this tutorial is to give the reader an orientation of the different interoperability mechanisms that can be used when integrating a program written in Erlang with a program written in another programming language, from the Erlang programmer's point of view.

    Prerequisites -

    It is assumed that you are a skilled Erlang programmer, - familiar with concepts such as Erlang data types, processes, - messages, and error handling.

    -

    To illustrate the interoperability principles, C programs - running in a UNIX environment have been used. It is assumed that - you have enough knowledge to apply these principles to the - relevant programming languages and platforms.

    +

    It is assumed that the reader is a skilled Erlang programmer, familiar with concepts such as Erlang data types, processes, messages and error handling.

    +

    To illustrate the interoperability principles C programs running in a UNIX environment have been used. It is assumed that the reader has enough knowledge to be able to apply these principles to the relevant programming languages and platforms.

    -

    For readability, the example code is kept as simple as - possible. For example, it does not include error handling, - which might be vital in a real-life system.

    +

    For the sake of readability, the example code has been kept as simple as possible. It does not include functionality such as error handling, which might be vital in a real-life system.

    diff -Nru erlang-18.2-dfsg/system/doc/tutorial/Makefile erlang-17.3-dfsg/system/doc/tutorial/Makefile --- erlang-18.2-dfsg/system/doc/tutorial/Makefile 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/system/doc/tutorial/Makefile 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2000-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/system/doc/tutorial/nif.xmlsrc erlang-17.3-dfsg/system/doc/tutorial/nif.xmlsrc --- erlang-18.2-dfsg/system/doc/tutorial/nif.xmlsrc 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/system/doc/tutorial/nif.xmlsrc 2014-09-16 19:10:57.000000000 +0000 @@ -4,21 +4,20 @@
    - 20002015 + 20002013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -29,105 +28,92 @@ nif.xml
    -

    This section outlines an example of how to solve the example - problem in Problem Example - by using Native Implemented Functions (NIFs).

    -

    NIFs were introduced in Erlang/OTP R13B03 as an experimental - feature. It is a simpler and more efficient way of calling C-code - than using port drivers. NIFs are most suitable for synchronous - functions, such as foo and bar in the example, that - do some relatively short calculations without side effects and - return the result.

    -

    A NIF is a function that is implemented in C instead of Erlang. - NIFs appear as any other functions to the callers. They belong to - a module and are called like any other Erlang functions. The NIFs - of a module are compiled and linked into a dynamic loadable, - shared library (SO in UNIX, DLL in Windows). The NIF library must - be loaded in runtime by the Erlang code of the module.

    -

    As a NIF library is dynamically linked into the emulator process, - this is the fastest way of calling C-code from Erlang (alongside - port drivers). Calling NIFs requires no context switches. But it - is also the least safe, because a crash in a NIF brings the - emulator down too.

    +

    This is an example of how to solve the example problem + by using NIFs. NIFs were introduced in R13B03 as an experimental + feature. It is a simpler and more efficient way of calling C-code + than using port drivers. NIFs are most suitable for synchronous functions like + foo and bar in the example, that does some + relatively short calculations without side effects and return the result.

    +
    + NIFs +

    A NIF (Native Implemented Function) is a function that is + implemented in C instead of Erlang. NIFs appear as any other functions to + the callers. They belong to a module and are called like any other Erlang + functions. The NIFs of a module are compiled and linked into a dynamic + loadable shared library (SO in Unix, DLL in Windows). The NIF library must + be loaded in runtime by the Erlang code of the module.

    +

    Since a NIF library is dynamically linked into the emulator + process, this is the fastest way of calling C-code from Erlang (alongside + port drivers). Calling NIFs requires no context switches. But it is also + the least safe, because a crash in a NIF will bring the emulator down + too.

    +
    Erlang Program -

    Even if all functions of a module are NIFs, an Erlang - module is still needed for two reasons:

    - - The NIF library must be explicitly loaded by - Erlang code in the same module. - All NIFs of a module must have an Erlang implementation - as well. - -

    Normally these are minimal stub implementations that throw an - exception. But they can also be used as fallback implementations - for functions that do not have native implemenations on some - architectures.

    -

    NIF libraries are loaded by calling erlang:load_nif/2, - with the name of the shared library as argument. The second - argument can be any term that will be passed on to the library - and used for initialization:

    +

    Even if all functions of a module will be NIFs, you still need an Erlang + module for two reasons. First, the NIF library must be explicitly loaded + by Erlang code in the same module. Second, all NIFs of a module must have + an Erlang implementation as well. Normally these are minimal stub + implementations that throw an exception. But it can also be used as + fallback implementations for functions that do not have native + implemenations on some architectures.

    +

    NIF libraries are loaded by calling erlang:load_nif/2, with the + name of the shared library as argument. The second argument can be any + term that will be passed on to the library and used for + initialization.

    -

    Here, the directive on_load is used to get function - init to be automatically called when the module is - loaded. If init returns anything other than ok, - such when the loading of the NIF library fails in this example, - the module is unloaded and calls to functions within it, - fail.

    -

    Loading the NIF library overrides the stub implementations +

    We use the directive on_load to get function init to be + automatically called when the module is loaded. If init + returns anything other than ok, such when the loading of + the NIF library fails in this example, the module will be + unloaded and calls to functions within it will fail.

    +

    Loading the NIF library will override the stub implementations and cause calls to foo and bar to be dispatched to the NIF implementations instead.

    - NIF Library Code + NIF library code

    The NIFs of the module are compiled and linked into a shared library. Each NIF is implemented as a normal C function. The macro ERL_NIF_INIT together with an array of structures defines the names, - arity, and function pointers of all the NIFs in the module. The header - file erl_nif.h must be included. As the library is a shared - module, not a program, no main function is to be present.

    + arity and function pointers of all the NIFs in the module. The header + file erl_nif.h must be included. Since the library is a shared + module, not a program, no main function should be present.

    The function arguments passed to a NIF appears in an array argv, - with argc as the length of the array, and thus the arity of the + with argc as the length of the array and thus the arity of the function. The Nth argument of the function can be accessed as argv[N-1]. NIFs also take an environment argument that serves as an opaque handle that is needed to be passed on to most API functions. The environment contains information about - the calling Erlang process:

    + the calling Erlang process.

    -

    Here,ERL_NIF_INIT has the following arguments:

    - -

    The first argument must be the name of the +

    The first argument to ERL_NIF_INIT must be the name of the Erlang module as a C-identifier. It will be stringified by the - macro.

    -
    - The second argument is the array of ErlNifFunc - structures containing name, arity, and function pointer of - each NIF. - The remaining arguments are pointers to callback functions - that can be used to initialize the library. They are not used - in this simple example, hence they are all set to NULL. -
    + macro. The second argument is the array of ErlNifFunc + structures containing name, arity and function pointer of + each NIF. The other arguments are pointers to callback functions + that can be used to initialize the library. We do not use them + in this simple example so we set them all to NULL.

    Function arguments and return values are represented as values - of type ERL_NIF_TERM. Here, functions like enif_get_int - and enif_make_int are used to convert between Erlang term - and C-type. - If the function argument argv[0] is not an integer, - enif_get_int returns false, in which case it returns + of type ERL_NIF_TERM. We use functions like enif_get_int + and enif_make_int to convert between Erlang term and C-type. + If the function argument argv[0] is not an integer then + enif_get_int will return false, in which case we return by throwing a badarg-exception with enif_make_badarg.

    Running the Example -

    Step 1. Compile the C code:

    +

    1. Compile the C code.

     unix> gcc -o complex6_nif.so -fpic -shared complex.c complex6_nif.c
     windows> cl -LD -MD -Fe complex6_nif.dll complex.c complex6_nif.c
    -

    Step 2: Start Erlang and compile the Erlang code:

    +

    2. Start Erlang and compile the Erlang code.

     > erl
     Erlang R13B04 (erts-5.7.5) [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false]
    @@ -135,7 +121,7 @@
     Eshell V5.7.5  (abort with ^G)
     1> c(complex6).
     {ok,complex6}
    -

    Step 3: Run the example:

    +

    3. Run the example.

     3> complex6:foo(3).
     4
    diff -Nru erlang-18.2-dfsg/system/doc/tutorial/overview.xml erlang-17.3-dfsg/system/doc/tutorial/overview.xml
    --- erlang-18.2-dfsg/system/doc/tutorial/overview.xml	2015-12-15 20:10:35.000000000 +0000
    +++ erlang-17.3-dfsg/system/doc/tutorial/overview.xml	2014-09-16 19:10:57.000000000 +0000
    @@ -4,21 +4,20 @@
     
       
    - 20002015 + 20002013 Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. @@ -32,90 +31,35 @@
    Built-In Mechanisms -

    Two interoperability mechanisms are built into the Erlang - runtime system, distributed Erlang and ports. - A variation of ports is linked-in drivers.

    +

    There are two interoperability mechanisms built into the Erlang runtime system. One is distributed Erlang and the other one is ports. A variation of ports is linked-in drivers.

    Distributed Erlang -

    An Erlang runtime system is made a distributed Erlang node by - giving it a name. A distributed Erlang node can connect to, - and monitor, other nodes. It can also spawn processes at other - nodes. Message passing and error handling between processes at - different nodes are transparent. A number of useful STDLIB - modules are available in a distributed Erlang system. For - example, global, which provides global name - registration. The distribution mechanism is implemented using - TCP/IP sockets.

    -

    When to use: Distributed Erlang is primarily used - for Erlang-Erlang communication. It can also be used for - communication between Erlang and C, if the C program is - implemented as a C node, see - C and Java Libraries.

    -

    Where to read more: Distributed Erlang and some distributed - programming techniques are described in the Erlang book.

    -

    For more information, see - Distributed Programming.

    -

    Relevant manual pages are the following:

    - - erlang manual page in ERTS - (describes the BIFs) - global manual page in Kernel - net_adm manual page in Kernel - pg2 manual page in Kernel - rpc manual page in Kernel - pool manual page in STDLIB - slave manual page in STDLIB - +

    An Erlang runtime system is made into a distributed Erlang node by giving it a name. A distributed Erlang node can connect to and monitor other nodes, it is also possible to spawn processes at other nodes. Message passing and error handling between processes at different nodes are transparent. There exists a number of useful stdlib modules intended for use in a distributed Erlang system; for example, global which provides global name registration. The distribution mechanism is implemented using TCP/IP sockets.

    +

    When to use: Distributed Erlang is primarily used for communication Erlang-Erlang. It can also be used for communication between Erlang and C, if the C program is implemented as a C node, see below.

    +

    Where to read more: Distributed Erlang and some distributed programming techniques are described in the Erlang book.

    + + In the Erlang/OTP documentation there is a chapter about distributed Erlang in "Getting Started" (User's Guide).

    + + Relevant man pages are erlang (describes the BIFs) and global, net_adm, pg2, rpc, pool and slave.

    Ports and Linked-In Drivers -

    Ports provide the basic mechanism for communication with the - external world, from Erlang's point of view. The ports provide - a byte-oriented interface to an external program. When a port - is created, Erlang can communicate with it by sending and - receiving lists of bytes (not Erlang terms). This means that - the programmer might have to invent a suitable encoding and - decoding scheme.

    -

    The implementation of the port mechanism depends on the - platform. For UNIX, pipes are used and the external program is - assumed to read from standard input and write to standard - output. The external program can be written in any programming - language as long as it can handle the interprocess - communication mechanism with which the port is - implemented.

    -

    The external program resides in another OS process than the - Erlang runtime system. In some cases this is not acceptable. - Consider, for example, drivers with very hard time - requirements. It is therefore possible to write a program in C - according to certain principles, and dynamically link it to - the Erlang runtime system. This is called a linked-in - driver.

    -

    When to use: Ports can be used for all kinds of - interoperability situations where the Erlang program and the - other program runs on the same machine. Programming is fairly - straight-forward.

    -

    Linked-in drivers involves writing certain call-back - functions in C. This requires very good skills as the code is - linked to the Erlang runtime system.

    +

    Ports provide the basic mechanism for communication with the external world, from Erlang's point of view. They provide a byte-oriented interface to an external program. When a port has been created, Erlang can communicate with it by sending and receiving lists of bytes (not Erlang terms). This means that the programmer may have to invent a suitable encoding and decoding scheme.

    +

    The actual implementation of the port mechanism depends on the platform. In the Unix case, pipes are used and the external program should as default read from standard input and write to standard output. Theoretically, the external program could be written in any programming language as long as it can handle the interprocess communication mechanism with which the port is implemented.

    +

    The external program resides in another OS process than the Erlang runtime system. In some cases this is not acceptable, consider for example drivers with very hard time requirements. It is therefore possible to write a program in C according to certain principles and dynamically link it to the Erlang runtime system, this is called a linked-in driver.

    +

    When to use: Being the basic mechanism, ports can be used for all kinds of interoperability situations where the Erlang program and the other program runs on the same machine. Programming is fairly straight-forward.

    + + Linked-in drivers involves writing certain call-back functions in C. Very good skills are required as the code is linked to the Erlang runtime system.

    -

    A faulty linked-in driver causes the entire Erlang runtime - system to leak memory, hang, or crash.

    +

    An erroneous linked-in driver will cause the entire Erlang runtime system to leak memory, hang or crash.

    -

    Where to read more: Ports are described in section - "Miscellaneous Items" of the Erlang book. Linked-in drivers - are described in Appendix E.

    -

    The BIF open_port/2 is documented in the - erlang manual page in - ERTS.

    -

    For linked-in drivers, the programmer needs to read the - erl_ddll manual - page in Kernel.

    -

    Examples: Port example in - Ports.

    +

    Where to read more: Ports are described in the "Miscellaneous Items" chapter of the Erlang book. Linked-in drivers are described in Appendix E.

    + + The BIF open_port/2 is documented in the man page for erlang. For linked-in drivers, the programmer needs to read the information in the man page for erl_ddll.

    +

    Examples:Port example.

    @@ -124,152 +68,64 @@
    Erl_Interface -

    The program at the other side of a port is often a C program. - To help the C programmer, the Erl_Interface library - has been developed, including the following five parts:

    +

    Very often the program at the other side of a port is a C program. To help the C programmer a library called Erl_Interface has been developed. It consists of five parts:

    - - erl_marshal, erl_eterm, erl_format, and - erl_malloc: Handling of the Erlang external term format - - erl_connect: - Communication with distributed Erlang, see C nodes below - - erl_error: - Error print routines - - erl_global: - Access globally registered names - - Registry: - Store and backup of key-value pairs + erl_marshal, erl_eterm, erl_format, erl_malloc Handling of the Erlang external term format. + erl_connect Communication with distributed Erlang, see C nodes below. + erl_error Error print routines. + erl_global Access globally registered names. + Registry Store and backup of key-value pairs. -

    The Erlang external term format is a representation of an - Erlang term as a sequence of bytes, that is, a binary. - Conversion between the two representations is done using the - following BIFs:

    +

    The Erlang external term format is a representation of an Erlang term as a sequence of bytes, a binary. Conversion between the two representations is done using BIFs.

     Binary = term_to_binary(Term)
     Term = binary_to_term(Binary)
    -

    A port can be set to use binaries instead of lists of bytes. - It is then not necessary to invent any encoding/decoding - scheme. Erl_Interface functions are used for unpacking the - binary and convert it into a struct similar to an Erlang term. - Such a struct can be manipulated in different ways, be - converted to the Erlang external format, and sent to - Erlang.

    +

    A port can be set to use binaries instead of lists of bytes. It is then not necessary to invent any encoding/decoding scheme. Erl_Interface functions are used for unpacking the binary and convert it into a struct similar to an Erlang term. Such a struct can be manipulated in different ways and be converted to the Erlang external format and sent to Erlang.

    When to use: In C code, in conjunction with Erlang binaries.

    -

    Where to read more: See the Erlang Interface User's - Guide, Command Reference, and Library Reference. In Erlang/OTP - R5B, and earlier versions, the information is part of the - Kernel application.

    -

    Examples: Erl_Interface example in - Erl_Interface.

    +

    Where to read more: Read about the Erl_Interface User's Guide; Command Reference and Library Reference. In R5B and earlier versions the information can be found under the Kernel application.

    +
    +

    Examples:erl_interface example.

    C Nodes -

    A C program that uses the Erl_Interface functions for setting - up a connection to, and communicating with, a distributed - Erlang node is called a C node, or a hidden - node. The main advantage with a C node is that the - communication from the Erlang programmer's perspective is - extremely easy, as the C program behaves as a distributed - Erlang node.

    -

    When to use: C nodes can typically be used on device - processors (as opposed to control processors) where C is a - better choice than Erlang due to memory limitations or - application characteristics, or both.

    -

    Where to read more: See the erl_connect part - of the Erl_Interface documentation. The programmer also needs - to be familiar with TCP/IP sockets, see Sockets in Standard - Protocols and Distributed Erlang in Built-In Mechanisms.

    -

    Example: C node example in - C Nodes.

    +

    A C program which uses the Erl_Interface functions for setting up a connection to and communicating with a distributed Erlang node is called a C node, or a hidden node. The main advantage with a C node is that the communication from the Erlang programmer's point of view is extremely easy, since the C program behaves as a distributed Erlang node.

    +

    When to use: C nodes can typically be used on device processors (as opposed to control processors) where C is a better choice than Erlang due to memory limitations and/or application characteristics.

    +

    Where to read more: In the erl_connect part of the Erl_Interface documentation, see above. The programmer also needs to be familiar with TCP/IP sockets, see below, and distributed Erlang, see above.

    +

    Examples:C node example.

    Jinterface -

    In Erlang/OTP R6B, a library similar to Erl_Interface for - Java was added called jinterface. It provides a tool - for Java programs to communicate with Erlang nodes.

    +

    In Erlang/OTP R6B, a library similar to Erl_Interface for Java was added called jinterface.

    Standard Protocols -

    Sometimes communication between an Erlang program and another - program using a standard protocol is desirable. Erlang/OTP - currently supports TCP/IP and UDP sockets: as - follows:

    - - SNMP - HTTP - IIOP (CORBA) - -

    Using one of the latter three requires good knowledge about the - protocol and is not covered by this tutorial. See the SNMP, - Inets, and Orber applications, respectively.

    +

    Sometimes communication between an Erlang program and another program using a standard protocol is desirable. Erlang/OTP currently supports TCP/IP and UDP sockets, SNMP, HTTP and IIOP (CORBA). Using one of the latter three requires good knowledge about the protocol and is not covered by this tutorial. Please refer to the documentation for the SNMP, Inets and Orber applications, respectively.

    Sockets -

    Simply put, connection-oriented socket communication (TCP/IP) - consists of an initiator socket ("server") started at a - certain host with a certain port number. A connector socket - ("client"), which is aware of the initiator host name and port - number, can connect to it and data can be sent between - them.

    -

    Connection-less socket communication (UDP) consists of an - initiator socket at a certain host with a certain port number - and a connector socket sending data to it.

    -

    For a detailed description of the socket concept, refer to a - suitable book about network programming. A suggestion is - UNIX Network Programming, Volume 1: Networking APIs - - Sockets and XTI by W. Richard Stevens, ISBN: - 013490012X.

    -

    In Erlang/OTP, access to TCP/IP and UDP sockets is provided - by the modules gen_tcp and gen_udp in - Kernel. Both are easy to use and do not require - detailed knowledge about the socket concept.

    -

    When to use: For programs running on the same or on - another machine than the Erlang program.

    -

    Where to read more: See the gen_tcp and the gen_udp manual pages in - Kernel.

    +

    Simply put, connection-oriented socket communication (TCP/IP) consists of an initiator socket ("server") started at a certain host with a certain port number. A connector socket ("client") aware of the initiator's host name and port number can connect to it and data can be sent between them. Connection-less socket communication (UDP) consists of an initiator socket at a certain host with a certain port number and a connector socket sending data to it. For a detailed description of the socket concept, please refer to a suitable book about network programming. A suggestion is UNIX Network Programming, Volume 1: Networking APIs - Sockets and XTI by W. Richard Stevens, ISBN: 013490012X.

    +

    In Erlang/OTP, access to TCP/IP and UDP sockets is provided by the + Kernel modules gen_tcp and gen_udp. Both are easy to + use and do not require any deeper knowledge about the socket concept.

    +

    When to use: For programs running on the same or on another machine than the Erlang program.

    +

    Where to read more: The man pages for gen_tcp and gen_udp.

    IC -

    IC (Erlang IDL Compiler) is an interface generator that, given - an IDL interface specification, automatically generates stub - code in Erlang, C, or Java. See the IC User's Guide and IC - Reference Manual.

    -

    For details, see the ic - manual page in IC.

    +

    IC (IDL Compiler) is an interface generator which given an IDL interface specification automatically generates stub code in Erlang, C or Java. Please refer to the IC User's Guide and IC Reference Manual.

    Old Applications -

    Two old applications are of interest regarding - interoperability. Both have been replaced by IC and are - mentioned here for reference only:

    - -

    IG - Removed from Erlang/OTP R6B.

    -

    IG (Interface Generator) automatically generated code for - port or socket communication between an Erlang program and a - C program, given a C header file with certain keywords.

    -
    -

    Jive - Removed from Erlang/OTP R7B.

    -

    Jive provided a simple interface between an Erlang program - and a Java program.

    -
    -
    +

    There are two old applications of interest when talking about interoperability: IG which was removed in Erlang/OTP R6B and Jive which was removed in Erlang/OTP R7B. Both applications have been replaced by IC and are mentioned here for reference only.

    +

    IG (Interface Generator) automatically generated code for port or socket communication between an Erlang program and a C program, given a C header file with certain keywords. Jive provided a simple interface between an Erlang program and a Java program.

    diff -Nru erlang-18.2-dfsg/system/doc/tutorial/part.xml erlang-17.3-dfsg/system/doc/tutorial/part.xml --- erlang-18.2-dfsg/system/doc/tutorial/part.xml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/system/doc/tutorial/part.xml 2014-09-16 19:10:57.000000000 +0000 @@ -8,17 +8,16 @@ Ericsson AB. All Rights Reserved. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. diff -Nru erlang-18.2-dfsg/system/doc/tutorial/xmlfiles.mk erlang-17.3-dfsg/system/doc/tutorial/xmlfiles.mk --- erlang-18.2-dfsg/system/doc/tutorial/xmlfiles.mk 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/system/doc/tutorial/xmlfiles.mk 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2009-2010. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/.travis.yml erlang-17.3-dfsg/.travis.yml --- erlang-18.2-dfsg/.travis.yml 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -language: erlang - -otp_release: - - 18.0 - -sudo: false - -addons: - apt: - packages: - - autoconf - - libncurses-dev - - build-essential - - libssl-dev - - libwxgtk2.8-dev - - libgl1-mesa-dev - - libglu1-mesa-dev - - libpng3 - - default-jdk - - g++ - - xsltproc - -before_script: - - set -e - - export ERL_TOP=$PWD - - export PATH=$ERL_TOP/bin:$PATH - - export ERL_LIBS='' - - export MAKEFLAGS=-j6 - - kerl_deactivate - -script: - - ./otp_build all -a - -after_success: - - ./otp_build tests && make release_docs - -after_script: - - cd $ERL_TOP/release/tests/test_server && $ERL_TOP/bin/erl -s ts install -s ts smoke_test batch -s init stop - - diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-arm-android.conf erlang-17.3-dfsg/xcomp/erl-xcomp-arm-android.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-arm-android.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-arm-android.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2009-2010. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-arm-linux.conf erlang-17.3-dfsg/xcomp/erl-xcomp-arm-linux.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-arm-linux.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-arm-linux.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2009-2010. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## @@ -75,8 +74,7 @@ CC="arm-wrs-linux-gnueabi-gcc --sysroot=$ARM_SYSROOT" # * `CFLAGS' - C compiler flags. -CFLAGS="-O2 -DSMALL_MEMORY --sysroot=$ARM_SYSROOT -Wall -g" - +#CFLAGS="-O@OPT_LEVEL@ -DSMALL_MEMORY" # * `STATIC_CFLAGS' - Static C compiler flags. #STATIC_CFLAGS= @@ -89,19 +87,19 @@ CPP="arm-wrs-linux-gnueabi-cpp --sysroot=$ARM_SYSROOT" # * `CPPFLAGS' - C pre-processor flags. -CPPFLAGS="--sysroot=$ARM_SYSROOT" +#CPPFLAGS="--sysroot=$ARM_SYSROOT" # * `CXX' - C++ compiler. CXX="arm-wrs-linux-gnueabi-c++ --sysroot=$ARM_SYSROOT" # * `CXXFLAGS' - C++ compiler flags. -CXXFLAGS="--sysroot=$ARM_SYSROOT" +#CXXFLAGS= # * `LD' - Linker. -LD="arm-wrs-linux-gnueabi-gcc" +#LD= # * `LDFLAGS' - Linker flags. -LDFLAGS="--sysroot=$ARM_SYSROOT" +#LDFLAGS= # * `LIBS' - Libraries. #LIBS= @@ -111,14 +109,14 @@ ## *NOTE*! Either set all or none of the `DED_LD*' variables. # * `DED_LD' - Linker for Dynamically loaded Erlang Drivers. -DED_LD="arm-wrs-linux-gnueabi-gcc" +#DED_LD= # * `DED_LDFLAGS' - Linker flags to use with `DED_LD'. -DED_LDFLAGS="--sysroot=$ARM_SYSROOT -shared -Wl,-Bsymbolic" +#DED_LDFLAGS= # * `DED_LD_FLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library # search path for shared libraries when linking with `DED_LD'. -DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-Wl,-R" +#DED_LD_FLAG_RUNTIME_LIBRARY_PATH= ## -- Large File Support -- diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-avr32-atmel-linux-gnu.conf erlang-17.3-dfsg/xcomp/erl-xcomp-avr32-atmel-linux-gnu.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-avr32-atmel-linux-gnu.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-avr32-atmel-linux-gnu.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2010-2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp.conf.template erlang-17.3-dfsg/xcomp/erl-xcomp.conf.template --- erlang-18.2-dfsg/xcomp/erl-xcomp.conf.template 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp.conf.template 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2009-2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-mips-linux.conf erlang-17.3-dfsg/xcomp/erl-xcomp-mips-linux.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-mips-linux.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-mips-linux.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2010-2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-powerpc64-bgq-linux.conf erlang-17.3-dfsg/xcomp/erl-xcomp-powerpc64-bgq-linux.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-powerpc64-bgq-linux.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-powerpc64-bgq-linux.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2009-2013. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-powerpc-dso-linux-gnu.conf erlang-17.3-dfsg/xcomp/erl-xcomp-powerpc-dso-linux-gnu.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-powerpc-dso-linux-gnu.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-powerpc-dso-linux-gnu.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2009-2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## @@ -56,7 +55,7 @@ # It does not have to be a full `CPU-VENDOR-OS' triplet, but can be. The # full `CPU-VENDOR-OS' triplet will be created by # `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host'. -erl_xcomp_host=powerpc-wrs-linux-gnu +erl_xcomp_host=powerpc-linux-gnu # * `erl_xcomp_configure_flags' - Extra configure flags to pass to the # `configure' script. @@ -71,10 +70,10 @@ ## All variables in this section can also be used when native compiling. # * `CC' - C compiler. -CC=powerpc-wrs-linux-gnu-gcc +CC=powerpc-linux-gnu-gcc # * `CFLAGS' - C compiler flags. -CFLAGS="-O2 --sysroot=/ldisk/cross/gcc-toolchain/sysroot -Wall -g" +#CFLAGS= # * `STATIC_CFLAGS' - Static C compiler flags. #STATIC_CFLAGS= @@ -85,22 +84,22 @@ #CFLAG_RUNTIME_LIBRARY_PATH= # * `CPP' - C pre-processor. -CPP="powerpc-wrs-linux-gnu-cpp " +#CPP= # * `CPPFLAGS' - C pre-processor flags. -CPPFLAGS="--sysroot=/ldisk/cross/gcc-toolchain/sysroot" +#CPPFLAGS= # * `CXX' - C++ compiler. -CXX="powerpc-wrs-linux-gnu-g++" +CXX=powerpc-linux-gnu-g++ # * `CXXFLAGS' - C++ compiler flags. -CXXFLAGS="--sysroot=/ldisk/cross/gcc-toolchain/sysroot" +#CXXFLAGS= # * `LD' - Linker. -LD="powerpc-wrs-linux-gnu-gcc" +LD=powerpc-linux-gnu-ld # * `LDFLAGS' - Linker flags. -LDFLAGS="--sysroot=/ldisk/cross/gcc-toolchain/sysroot" +#LDFLAGS= # * `LIBS' - Libraries. #LIBS= @@ -110,14 +109,14 @@ ## *NOTE*! Either set all or none of the `DED_LD*' variables. # * `DED_LD' - Linker for Dynamically loaded Erlang Drivers. -DED_LD="powerpc-wrs-linux-gnu-gcc" +#DED_LD= # * `DED_LDFLAGS' - Linker flags to use with `DED_LD'. -DED_LDFLAGS="--sysroot=/ldisk/cross/gcc-toolchain/sysroot -shared -Wl,-Bsymbolic" +#DED_LDFLAGS= # * `DED_LD_FLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library # search path for shared libraries when linking with `DED_LD'. -DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-Wl,-R" +#DED_LD_FLAG_RUNTIME_LIBRARY_PATH= ## -- Large File Support -- @@ -135,10 +134,10 @@ ## -- Other Tools -- # * `RANLIB' - `ranlib' archive index tool. -RANLIB=powerpc-wrs-linux-gnu-ranlib +RANLIB=powerpc-linux-gnu-ranlib # * `AR' - `ar' archiving tool. -AR=powerpc-wrs-linux-gnu-ar +AR=powerpc-linux-gnu-ar # * `GETCONF' - `getconf' system configuration inspection tool. `getconf' is # currently used for finding out large file support flags to use, and diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-powerpc-ose5.conf erlang-17.3-dfsg/xcomp/erl-xcomp-powerpc-ose5.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-powerpc-ose5.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-powerpc-ose5.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2009-2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-sfk-linux-ose5.conf erlang-17.3-dfsg/xcomp/erl-xcomp-sfk-linux-ose5.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-sfk-linux-ose5.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-sfk-linux-ose5.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2009-2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf erlang-17.3-dfsg/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2009-2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-vars.sh erlang-17.3-dfsg/xcomp/erl-xcomp-vars.sh --- erlang-18.2-dfsg/xcomp/erl-xcomp-vars.sh 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-vars.sh 2014-09-16 19:10:57.000000000 +0000 @@ -3,17 +3,16 @@ # # Copyright Ericsson AB 2010-2012. All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. # # %CopyrightEnd% # diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-vxworks_ppc32.conf erlang-17.3-dfsg/xcomp/erl-xcomp-vxworks_ppc32.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-vxworks_ppc32.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-vxworks_ppc32.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2009-2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ## diff -Nru erlang-18.2-dfsg/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf erlang-17.3-dfsg/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf --- erlang-18.2-dfsg/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf 2015-12-15 20:10:35.000000000 +0000 +++ erlang-17.3-dfsg/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf 2014-09-16 19:10:57.000000000 +0000 @@ -4,17 +4,16 @@ ## ## Copyright Ericsson AB 2010-2012. All Rights Reserved. ## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. ## ## %CopyrightEnd% ##